fan-standard-comp 3.2.0 → 3.2.2

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 (293) hide show
  1. package/Readme.md +1 -33
  2. package/dist/09cd8e9be7081f2166444cce393fe968.svg +54 -0
  3. package/dist/e3378c145b7db195ad068735e15fb28a.svg +165 -0
  4. package/dist/fan-standard-comp.umd.js +166 -444
  5. package/dist/fonts/iconfont.ttf +0 -0
  6. package/dist/fonts/iconfont.woff +0 -0
  7. package/dist/fonts/lg.ttf +0 -0
  8. package/dist/fonts/lg.woff +0 -0
  9. package/dist/fonts/lg.woff2 +0 -0
  10. package/es/ButtonGroup/ButtonList.d.ts +2 -1
  11. package/es/ButtonGroup/ButtonMenu.d.ts +2 -1
  12. package/es/ButtonGroup/PopConfirmTitle.js +5 -5
  13. package/es/ButtonGroup/index.d.ts +3 -1
  14. package/es/ButtonGroup/index.js +147 -178
  15. package/es/ButtonGroup/style/index.less +4 -1
  16. package/es/CalendarCoordPicker/CalendarMonthPicker.d.ts +5 -0
  17. package/es/CalendarCoordPicker/CalendarMonthPicker.js +26 -0
  18. package/es/CalendarCoordPicker/index.d.ts +8 -0
  19. package/es/CalendarCoordPicker/index.js +296 -0
  20. package/es/CalendarCoordPicker/index.less +31 -0
  21. package/es/ConfigContext/index.d.ts +7 -0
  22. package/es/ConfigContext/index.js +12 -0
  23. package/es/DragContent/index.d.ts +1 -1
  24. package/es/DragContent/index.js +5 -5
  25. package/es/FormComp/ChunkUploader/api.js +14 -14
  26. package/es/FormComp/ChunkUploader/index.js +132 -139
  27. package/es/FormComp/ChunkUploader/lib.js +21 -21
  28. package/es/FormComp/ChunkUploader/upload-queue.class.js +64 -66
  29. package/es/FormComp/EditButton/index.d.ts +1 -1
  30. package/es/FormComp/EditButton/index.js +15 -17
  31. package/es/FormComp/FieldComponent/ReUpload.d.ts +1 -1
  32. package/es/FormComp/FieldComponent/ReUpload.js +37 -23
  33. package/es/FormComp/FieldComponent/RefactorTextarea.js +32 -0
  34. package/es/FormComp/FieldComponent/RefactorTreeSelect.js +72 -19
  35. package/es/FormComp/FieldComponent/TitleNode.d.ts +2 -1
  36. package/es/FormComp/FieldComponent/index.d.ts +1 -1
  37. package/es/FormComp/FieldComponent/index.js +33 -23
  38. package/es/FormComp/FieldComponent/setReadonlyValues.js +6 -6
  39. package/es/FormComp/RenderItemGroup/index.js +24 -8
  40. package/es/FormComp/Uploader/index.d.ts +3 -1
  41. package/es/FormComp/Uploader/index.js +243 -119
  42. package/es/FormComp/VarTemplate/index.js +57 -64
  43. package/es/ImageGallery/ImagePreview.d.ts +13 -0
  44. package/es/ImageGallery/ImagePreview.js +168 -0
  45. package/es/ImageGallery/PreviewStyles/ImagePreview.less +730 -0
  46. package/es/ImageGallery/PreviewStyles/fonts/lg.svg +54 -0
  47. package/es/ImageGallery/PreviewStyles/fonts/lg.ttf +0 -0
  48. package/es/ImageGallery/PreviewStyles/fonts/lg.woff +0 -0
  49. package/es/ImageGallery/PreviewStyles/fonts/lg.woff2 +0 -0
  50. package/es/ImageGallery/PreviewStyles/lg-thumbnail.css +108 -0
  51. package/es/ImageGallery/PreviewStyles/lg-video.css +144 -0
  52. package/es/ImageGallery/PreviewStyles/lg-zoom.css +116 -0
  53. package/es/ImageGallery/PreviewStyles/lightgallery.css +728 -0
  54. package/es/ImageGallery/SliderContent.d.ts +7 -0
  55. package/es/ImageGallery/SliderContent.js +699 -0
  56. package/es/ImageGallery/Thumbnail.d.ts +3 -0
  57. package/es/ImageGallery/Thumbnail.js +296 -0
  58. package/es/ImageGallery/hook/uniqueId.d.ts +1 -0
  59. package/es/ImageGallery/hook/uniqueId.js +10 -0
  60. package/es/ImageGallery/index.d.ts +4 -0
  61. package/es/ImageGallery/index.js +29 -0
  62. package/es/ImageGallery/style/index.less +5 -0
  63. package/es/ImageGallery/types.d.ts +5 -0
  64. package/es/ImageGallery/types.js +1 -0
  65. package/es/NavLeafScroll/index.js +94 -50
  66. package/es/RefactorTree/index.d.ts +1 -1
  67. package/es/RefactorTree/index.js +6 -6
  68. package/es/RefactorTree/indexTreeNode.d.ts +1 -1
  69. package/es/RefactorTree/indexTreeNode.js +19 -17
  70. package/es/RefactorTree/util.js +18 -18
  71. package/es/SpecIcon/fonts/demo_index.html +559 -5
  72. package/es/SpecIcon/fonts/iconfont.css +101 -3
  73. package/es/SpecIcon/fonts/iconfont.js +34 -27
  74. package/es/SpecIcon/fonts/iconfont.json +168 -0
  75. package/es/SpecIcon/fonts/iconfont.svg +163 -171
  76. package/es/SpecIcon/fonts/iconfont.ttf +0 -0
  77. package/es/SpecIcon/fonts/iconfont.woff +0 -0
  78. package/es/SpecIcon/fonts/iconfont.woff2 +0 -0
  79. package/es/SpecIcon/style/iconfont.less +106 -11
  80. package/es/SplitterLayout/Pane.d.ts +1 -1
  81. package/es/SplitterLayout/index.js +25 -26
  82. package/es/StandardContent/SplitterLayout/Pane.js +3 -3
  83. package/es/StandardContent/SplitterLayout/index.js +25 -26
  84. package/es/StandardContent/SubfieldContent.d.ts +1 -1
  85. package/es/StandardContent/WrapperContent.d.ts +1 -1
  86. package/es/StandardDragModal/index.d.ts +11 -3
  87. package/es/StandardDragModal/index.js +25 -3
  88. package/es/StandardFilter/index.d.ts +5 -16
  89. package/es/StandardFilter/index.js +212 -200
  90. package/es/StandardFilter/indexClass.d.ts +37 -0
  91. package/es/StandardFilter/indexClass.js +217 -0
  92. package/es/StandardFilter/style/index.less +82 -9
  93. package/es/StandardForm/StepForm.d.ts +1 -1
  94. package/es/StandardForm/StepForm.js +28 -22
  95. package/es/StandardForm/TabForm.d.ts +1 -1
  96. package/es/StandardForm/TabForm.js +41 -43
  97. package/es/StandardForm/index.d.ts +1 -1
  98. package/es/StandardForm/index.js +5 -5
  99. package/es/StandardModal/UpdateFormRef.js +0 -1
  100. package/es/StandardModal/index.d.ts +2 -1
  101. package/es/StandardModal/index.js +25 -39
  102. package/es/StandardPanel/index.d.ts +1 -1
  103. package/es/StandardPanel/index.js +7 -7
  104. package/es/StandardTable/index.d.ts +1 -0
  105. package/es/StandardTable/index.js +44 -26
  106. package/es/components/IconNode/index.d.ts +1 -1
  107. package/es/components/IconNode/index.js +0 -1
  108. package/es/data/general.config.js +31 -0
  109. package/es/index.d.ts +3 -1
  110. package/es/index.js +6 -2
  111. package/es/utils/filterPermission.js +7 -10
  112. package/es/utils/getParentNodes.js +101 -26
  113. package/es/utils/index.js +2 -3
  114. package/es/utils/urlUtils.js +76 -0
  115. package/lib/ButtonGroup/ButtonList.d.ts +2 -1
  116. package/lib/ButtonGroup/ButtonList.js +2 -3
  117. package/lib/ButtonGroup/ButtonMenu.d.ts +2 -1
  118. package/lib/ButtonGroup/ButtonMenu.js +2 -3
  119. package/lib/ButtonGroup/PopConfirmTitle.js +7 -8
  120. package/lib/ButtonGroup/index.d.ts +3 -1
  121. package/lib/ButtonGroup/index.js +151 -183
  122. package/lib/ButtonGroup/style/index.less +4 -1
  123. package/lib/CalendarCoordPicker/CalendarMonthPicker.d.ts +5 -0
  124. package/lib/CalendarCoordPicker/CalendarMonthPicker.js +36 -0
  125. package/lib/CalendarCoordPicker/index.d.ts +8 -0
  126. package/lib/CalendarCoordPicker/index.js +305 -0
  127. package/lib/CalendarCoordPicker/index.less +31 -0
  128. package/lib/ConfigContext/index.d.ts +7 -0
  129. package/lib/ConfigContext/index.js +17 -0
  130. package/lib/DragContent/DragBar.js +2 -3
  131. package/lib/DragContent/index.d.ts +1 -1
  132. package/lib/DragContent/index.js +9 -10
  133. package/lib/FormComp/ChunkUploader/api.js +15 -15
  134. package/lib/FormComp/ChunkUploader/index.js +135 -142
  135. package/lib/FormComp/ChunkUploader/lib.js +22 -22
  136. package/lib/FormComp/ChunkUploader/upload-queue.class.js +66 -69
  137. package/lib/FormComp/ChunkUploader/worker.js +1 -1
  138. package/lib/FormComp/EditButton/index.d.ts +1 -1
  139. package/lib/FormComp/EditButton/index.js +19 -22
  140. package/lib/FormComp/FieldComponent/ReUpload.d.ts +1 -1
  141. package/lib/FormComp/FieldComponent/ReUpload.js +40 -28
  142. package/lib/FormComp/FieldComponent/RefactorTextarea.js +42 -0
  143. package/lib/FormComp/FieldComponent/RefactorTreeSelect.js +75 -23
  144. package/lib/FormComp/FieldComponent/TitleNode.d.ts +2 -1
  145. package/lib/FormComp/FieldComponent/TitleNode.js +2 -3
  146. package/lib/FormComp/FieldComponent/index.d.ts +1 -1
  147. package/lib/FormComp/FieldComponent/index.js +38 -26
  148. package/lib/FormComp/FieldComponent/setReadonlyValues.js +15 -20
  149. package/lib/FormComp/RenderItemGroup/index.js +26 -11
  150. package/lib/FormComp/Uploader/index.d.ts +3 -1
  151. package/lib/FormComp/Uploader/index.js +244 -123
  152. package/lib/FormComp/VarTemplate/index.js +63 -71
  153. package/lib/FormComp/index.js +1 -1
  154. package/lib/ImageGallery/ImagePreview.d.ts +13 -0
  155. package/lib/ImageGallery/ImagePreview.js +178 -0
  156. package/lib/ImageGallery/PreviewStyles/ImagePreview.less +730 -0
  157. package/lib/ImageGallery/PreviewStyles/fonts/lg.svg +54 -0
  158. package/lib/ImageGallery/PreviewStyles/fonts/lg.ttf +0 -0
  159. package/lib/ImageGallery/PreviewStyles/fonts/lg.woff +0 -0
  160. package/lib/ImageGallery/PreviewStyles/fonts/lg.woff2 +0 -0
  161. package/lib/ImageGallery/PreviewStyles/lg-thumbnail.css +108 -0
  162. package/lib/ImageGallery/PreviewStyles/lg-video.css +144 -0
  163. package/lib/ImageGallery/PreviewStyles/lg-zoom.css +116 -0
  164. package/lib/ImageGallery/PreviewStyles/lightgallery.css +728 -0
  165. package/lib/ImageGallery/SliderContent.d.ts +7 -0
  166. package/lib/ImageGallery/SliderContent.js +708 -0
  167. package/lib/ImageGallery/Thumbnail.d.ts +3 -0
  168. package/lib/ImageGallery/Thumbnail.js +306 -0
  169. package/lib/ImageGallery/hook/uniqueId.d.ts +1 -0
  170. package/lib/ImageGallery/hook/uniqueId.js +17 -0
  171. package/lib/ImageGallery/index.d.ts +4 -0
  172. package/lib/ImageGallery/index.js +36 -0
  173. package/lib/ImageGallery/style/index.less +5 -0
  174. package/lib/ImageGallery/types.d.ts +5 -0
  175. package/lib/ImageGallery/types.js +5 -0
  176. package/lib/NavLeafScroll/index.js +98 -55
  177. package/lib/RefactorTree/index.d.ts +1 -1
  178. package/lib/RefactorTree/index.js +10 -11
  179. package/lib/RefactorTree/indexTreeNode.d.ts +1 -1
  180. package/lib/RefactorTree/indexTreeNode.js +23 -22
  181. package/lib/RefactorTree/util.js +18 -18
  182. package/lib/SpecIcon/fonts/demo_index.html +559 -5
  183. package/lib/SpecIcon/fonts/iconfont.css +101 -3
  184. package/lib/SpecIcon/fonts/iconfont.js +34 -27
  185. package/lib/SpecIcon/fonts/iconfont.json +168 -0
  186. package/lib/SpecIcon/fonts/iconfont.svg +163 -171
  187. package/lib/SpecIcon/fonts/iconfont.ttf +0 -0
  188. package/lib/SpecIcon/fonts/iconfont.woff +0 -0
  189. package/lib/SpecIcon/fonts/iconfont.woff2 +0 -0
  190. package/lib/SpecIcon/index.js +2 -3
  191. package/lib/SpecIcon/style/iconfont.less +106 -11
  192. package/lib/SplitterLayout/Pane.d.ts +1 -1
  193. package/lib/SplitterLayout/Pane.js +2 -3
  194. package/lib/SplitterLayout/index.js +27 -29
  195. package/lib/StandardContent/SplitterLayout/Pane.js +5 -6
  196. package/lib/StandardContent/SplitterLayout/index.js +27 -29
  197. package/lib/StandardContent/SubfieldContent.d.ts +1 -1
  198. package/lib/StandardContent/SubfieldContent.js +2 -3
  199. package/lib/StandardContent/WrapperContent.d.ts +1 -1
  200. package/lib/StandardContent/WrapperContent.js +2 -3
  201. package/lib/StandardDragModal/index.d.ts +11 -3
  202. package/lib/StandardDragModal/index.js +27 -33
  203. package/lib/StandardFilter/index.d.ts +5 -16
  204. package/lib/StandardFilter/index.js +215 -201
  205. package/lib/StandardFilter/indexClass.d.ts +37 -0
  206. package/lib/StandardFilter/indexClass.js +223 -0
  207. package/lib/StandardFilter/style/index.less +82 -9
  208. package/lib/StandardForm/ActionList.js +2 -3
  209. package/lib/StandardForm/StepForm.d.ts +1 -1
  210. package/lib/StandardForm/StepForm.js +32 -27
  211. package/lib/StandardForm/TabForm.d.ts +1 -1
  212. package/lib/StandardForm/TabForm.js +45 -48
  213. package/lib/StandardForm/index.d.ts +1 -1
  214. package/lib/StandardForm/index.js +9 -10
  215. package/lib/StandardModal/UpdateFormRef.js +3 -4
  216. package/lib/StandardModal/index.d.ts +2 -1
  217. package/lib/StandardModal/index.js +29 -43
  218. package/lib/StandardPanel/index.d.ts +1 -1
  219. package/lib/StandardPanel/index.js +11 -12
  220. package/lib/StandardTable/index.d.ts +1 -0
  221. package/lib/StandardTable/index.js +49 -29
  222. package/lib/components/IconNode/index.d.ts +1 -1
  223. package/lib/components/IconNode/index.js +2 -4
  224. package/lib/components/index.js +1 -1
  225. package/lib/data/func.code.js +2 -3
  226. package/lib/data/general.config.js +33 -3
  227. package/lib/data/index.js +1 -1
  228. package/lib/index.d.ts +3 -1
  229. package/lib/index.js +30 -10
  230. package/lib/utils/ValueFormat.js +1 -2
  231. package/lib/utils/filterPermission.js +11 -18
  232. package/lib/utils/getParentNodes.js +103 -29
  233. package/lib/utils/index.js +5 -27
  234. package/lib/utils/urlUtils.js +82 -0
  235. package/package.json +14 -9
  236. package/dist/f26952c118ab6cdcd23dc0028ee98c11.svg +0 -173
  237. package/dist/fonts/iconfont.eot +0 -0
  238. package/es/StandardDragModal/ChangeStandardModal.d.ts +0 -44
  239. package/es/StandardDragModal/ChangeStandardModal.js +0 -493
  240. package/es/StandardDragModal/DraggableModal.d.ts +0 -7
  241. package/es/StandardDragModal/DraggableModal.js +0 -31
  242. package/es/StandardDragModal/DraggableModalContext.d.ts +0 -9
  243. package/es/StandardDragModal/DraggableModalContext.js +0 -5
  244. package/es/StandardDragModal/DraggableModalInner.d.ts +0 -16
  245. package/es/StandardDragModal/DraggableModalInner.js +0 -114
  246. package/es/StandardDragModal/DraggableModalProvider.d.ts +0 -4
  247. package/es/StandardDragModal/DraggableModalProvider.js +0 -40
  248. package/es/StandardDragModal/Modal.d.ts +0 -11
  249. package/es/StandardDragModal/Modal.js +0 -24
  250. package/es/StandardDragModal/ResizeHandle.d.ts +0 -2
  251. package/es/StandardDragModal/ResizeHandle.js +0 -8
  252. package/es/StandardDragModal/clamp.d.ts +0 -1
  253. package/es/StandardDragModal/clamp.js +0 -3
  254. package/es/StandardDragModal/draggableModalReducer.d.ts +0 -66
  255. package/es/StandardDragModal/draggableModalReducer.js +0 -157
  256. package/es/StandardDragModal/getWindowSize.d.ts +0 -4
  257. package/es/StandardDragModal/getWindowSize.js +0 -6
  258. package/es/StandardDragModal/index.less +0 -65
  259. package/es/StandardDragModal/useDrag.d.ts +0 -5
  260. package/es/StandardDragModal/useDrag.js +0 -66
  261. package/es/StandardDragModal/usePrevious.d.ts +0 -1
  262. package/es/StandardDragModal/usePrevious.js +0 -8
  263. package/es/StandardDragModal/useResize.d.ts +0 -7
  264. package/es/StandardDragModal/useResize.js +0 -74
  265. package/es/utils/dictSelectUtil.js +0 -153
  266. package/lib/StandardDragModal/ChangeStandardModal.d.ts +0 -44
  267. package/lib/StandardDragModal/ChangeStandardModal.js +0 -502
  268. package/lib/StandardDragModal/DraggableModal.d.ts +0 -7
  269. package/lib/StandardDragModal/DraggableModal.js +0 -40
  270. package/lib/StandardDragModal/DraggableModalContext.d.ts +0 -9
  271. package/lib/StandardDragModal/DraggableModalContext.js +0 -15
  272. package/lib/StandardDragModal/DraggableModalInner.d.ts +0 -16
  273. package/lib/StandardDragModal/DraggableModalInner.js +0 -124
  274. package/lib/StandardDragModal/DraggableModalProvider.d.ts +0 -4
  275. package/lib/StandardDragModal/DraggableModalProvider.js +0 -48
  276. package/lib/StandardDragModal/Modal.d.ts +0 -11
  277. package/lib/StandardDragModal/Modal.js +0 -32
  278. package/lib/StandardDragModal/ResizeHandle.d.ts +0 -2
  279. package/lib/StandardDragModal/ResizeHandle.js +0 -18
  280. package/lib/StandardDragModal/clamp.d.ts +0 -1
  281. package/lib/StandardDragModal/clamp.js +0 -10
  282. package/lib/StandardDragModal/draggableModalReducer.d.ts +0 -66
  283. package/lib/StandardDragModal/draggableModalReducer.js +0 -167
  284. package/lib/StandardDragModal/getWindowSize.d.ts +0 -4
  285. package/lib/StandardDragModal/getWindowSize.js +0 -13
  286. package/lib/StandardDragModal/index.less +0 -65
  287. package/lib/StandardDragModal/useDrag.d.ts +0 -5
  288. package/lib/StandardDragModal/useDrag.js +0 -73
  289. package/lib/StandardDragModal/usePrevious.d.ts +0 -1
  290. package/lib/StandardDragModal/usePrevious.js +0 -15
  291. package/lib/StandardDragModal/useResize.d.ts +0 -7
  292. package/lib/StandardDragModal/useResize.js +0 -81
  293. package/lib/utils/dictSelectUtil.js +0 -161
@@ -1,124 +0,0 @@
1
- "use strict";
2
-
3
- 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); }
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.DraggableModalInner = void 0;
8
- require("antd/es/modal/style");
9
- var _modal = _interopRequireDefault(require("antd/es/modal"));
10
- var _tslib = require("tslib");
11
- var React = _interopRequireWildcard(require("react"));
12
- var _ResizeHandle = require("./ResizeHandle");
13
- var _useDrag = require("./useDrag");
14
- var _usePrevious = require("./usePrevious");
15
- var _useResize = require("./useResize");
16
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
- var modalStyle = {
20
- margin: 0,
21
- paddingBottom: 0,
22
- pointerEvents: 'auto'
23
- };
24
- function DraggableModalInnerNonMemo(_a) {
25
- var id = _a.id,
26
- modalState = _a.modalState,
27
- dispatch = _a.dispatch,
28
- visible = _a.visible,
29
- children = _a.children,
30
- title = _a.title,
31
- initialWidth = _a.initialWidth,
32
- initialHeight = _a.initialHeight,
33
- otherProps = (0, _tslib.__rest)(_a, ["id", "modalState", "dispatch", "visible", "children", "title", "initialWidth", "initialHeight"]); // Call on mount and unmount.
34
- (0, React.useEffect)(function () {
35
- dispatch({
36
- type: 'mount',
37
- id: id,
38
- intialState: {
39
- initialWidth: initialWidth,
40
- initialHeight: initialHeight
41
- }
42
- });
43
- return function () {
44
- return dispatch({
45
- type: 'unmount',
46
- id: id
47
- });
48
- };
49
- }, [dispatch, id, initialWidth, initialHeight]);
50
- // Bring this to the front if it's been opened with props.
51
- var visiblePrevious = (0, _usePrevious.usePrevious)(visible);
52
- (0, React.useEffect)(function () {
53
- if (visible !== visiblePrevious) {
54
- if (visible) {
55
- dispatch({
56
- type: 'show',
57
- id: id
58
- });
59
- } else {
60
- dispatch({
61
- type: 'hide',
62
- id: id
63
- });
64
- }
65
- }
66
- }, [visible, visiblePrevious, id, dispatch]);
67
- var zIndex = modalState.zIndex,
68
- x = modalState.x,
69
- y = modalState.y,
70
- width = modalState.width,
71
- height = modalState.height;
72
- var style = (0, React.useMemo)(function () {
73
- return Object.assign(Object.assign({}, modalStyle), {
74
- top: y,
75
- left: x,
76
- height: height
77
- });
78
- }, [y, x, height]);
79
- var onFocus = (0, React.useCallback)(function () {
80
- return dispatch({
81
- type: 'focus',
82
- id: id
83
- });
84
- }, [id, dispatch]);
85
- var onDragWithID = (0, React.useCallback)(function (args) {
86
- return dispatch(Object.assign({
87
- type: 'drag',
88
- id: id
89
- }, args));
90
- }, [dispatch, id]);
91
- var onResizeWithID = (0, React.useCallback)(function (args) {
92
- return dispatch(Object.assign({
93
- type: 'resize',
94
- id: id
95
- }, args));
96
- }, [dispatch, id]);
97
- var onMouseDrag = (0, _useDrag.useDrag)(x, y, onDragWithID);
98
- var onMouseResize = (0, _useResize.useResize)(x, y, width, height, onResizeWithID);
99
- var titleElement = (0, React.useMemo)(function () {
100
- return /*#__PURE__*/React.createElement("div", {
101
- className: "ant-design-draggable-modal-title",
102
- onMouseDown: onMouseDrag,
103
- onClick: onFocus
104
- }, title);
105
- }, [onMouseDrag, onFocus, title]);
106
- return /*#__PURE__*/React.createElement(_modal.default, Object.assign({
107
- wrapClassName: "ant-design-draggable-modal",
108
- style: style,
109
- width: width,
110
- destroyOnClose: true,
111
- mask: false,
112
- maskClosable: false,
113
- zIndex: zIndex,
114
- title: titleElement,
115
- open: visible
116
- }, otherProps), children, /*#__PURE__*/React.createElement(_ResizeHandle.ResizeHandle, {
117
- onMouseDown: onMouseResize
118
- }));
119
- }
120
- var DraggableModalInner = /*#__PURE__*/(0, React.memo)(DraggableModalInnerNonMemo);
121
- exports.DraggableModalInner = DraggableModalInner;
122
- if (process.env.NODE_ENV !== 'production') {
123
- DraggableModalInner.displayName = 'DraggableModalInner';
124
- }
@@ -1,4 +0,0 @@
1
- import * as React from 'react';
2
- export declare const DraggableModalProvider: ({ children, }: {
3
- children: React.ReactNode;
4
- }) => React.ReactElement;
@@ -1,48 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.DraggableModalProvider = void 0;
7
- var React = _interopRequireWildcard(require("react"));
8
- var _DraggableModalContext = require("./DraggableModalContext");
9
- var _getWindowSize = require("./getWindowSize");
10
- var _draggableModalReducer = require("./draggableModalReducer");
11
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
12
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
- 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); }
14
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
15
- 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."); }
16
- 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); }
17
- 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; }
18
- 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; } }
19
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
- var DraggableModalProvider = function DraggableModalProvider(_ref) {
21
- var children = _ref.children;
22
- var _useReducer = (0, React.useReducer)(_draggableModalReducer.draggableModalReducer, _draggableModalReducer.initialModalsState),
23
- _useReducer2 = _slicedToArray(_useReducer, 2),
24
- state = _useReducer2[0],
25
- dispatch = _useReducer2[1];
26
- (0, React.useEffect)(function () {
27
- var onResize = function onResize() {
28
- return dispatch({
29
- type: 'windowResize',
30
- size: (0, _getWindowSize.getWindowSize)()
31
- });
32
- };
33
- if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object') {
34
- window.addEventListener('resize', onResize);
35
- onResize();
36
- }
37
- return function () {
38
- (typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' && window.removeEventListener('resize', onResize);
39
- };
40
- }, [dispatch]);
41
- return /*#__PURE__*/React.createElement(_DraggableModalContext.DraggableModalContext.Provider, {
42
- value: {
43
- state: state,
44
- dispatch: dispatch
45
- }
46
- }, children);
47
- };
48
- exports.DraggableModalProvider = DraggableModalProvider;
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import './index.less';
3
- interface StandardDragModalProps {
4
- visible: boolean;
5
- title?: string | React.ReactNode;
6
- initialWidth?: number;
7
- initialHeight?: number;
8
- [k: string]: any;
9
- }
10
- declare const StandardDragModal: (props: StandardDragModalProps) => JSX.Element;
11
- export default StandardDragModal;
@@ -1,32 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _tslib = require("tslib");
8
- var _react = _interopRequireDefault(require("react"));
9
- var _index = require("./index");
10
- require("./index.less");
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
- var StandardDragModal = function StandardDragModal(props) {
13
- var visible = props.visible,
14
- onCancel = props.onCancel,
15
- onSubmit = props.onSubmit,
16
- children = props.children,
17
- others = (0, _tslib.__rest)(props, ["visible", "onCancel", "onSubmit", "children"]);
18
- var handleOk = function handleOk() {
19
- onSubmit && onSubmit();
20
- };
21
- var handleCancel = function handleCancel() {
22
- onCancel && onCancel();
23
- };
24
- return /*#__PURE__*/_react.default.createElement(_index.DraggableModalProvider, null, /*#__PURE__*/_react.default.createElement(_index.DraggableModal, Object.assign({
25
- visible: visible,
26
- onOk: handleOk,
27
- onCancel: handleCancel,
28
- zIndex: 1001
29
- }, others), children));
30
- };
31
- var _default = StandardDragModal;
32
- exports.default = _default;
@@ -1,2 +0,0 @@
1
- import * as React from 'react';
2
- export declare const ResizeHandle: (props: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>) => React.ReactElement;
@@ -1,18 +0,0 @@
1
- "use strict";
2
-
3
- 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); }
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.ResizeHandle = void 0;
8
- var React = _interopRequireWildcard(require("react"));
9
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
10
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
11
- var ResizeHandle = function ResizeHandle(props) {
12
- return /*#__PURE__*/React.createElement("div", Object.assign({
13
- className: "ant-design-draggable-modal-resize-handle"
14
- }, props), /*#__PURE__*/React.createElement("div", {
15
- className: "ant-design-draggable-modal-resize-handle-inner"
16
- }));
17
- };
18
- exports.ResizeHandle = ResizeHandle;
@@ -1 +0,0 @@
1
- export declare const clamp: (min: number, max: number, value: number) => number;
@@ -1,10 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.clamp = void 0;
7
- var clamp = function clamp(min, max, value) {
8
- return Math.max(min, Math.min(max, value));
9
- };
10
- exports.clamp = clamp;
@@ -1,66 +0,0 @@
1
- export declare type ModalID = string;
2
- export interface ModalState {
3
- x: number;
4
- y: number;
5
- width: number;
6
- height: number;
7
- zIndex: number;
8
- visible: boolean;
9
- }
10
- export interface ModalsState {
11
- maxZIndex: number;
12
- windowSize: {
13
- width: number;
14
- height: number;
15
- };
16
- modals: {
17
- [key: string]: ModalState;
18
- };
19
- }
20
- export declare const initialModalsState: ModalsState;
21
- export declare const initialModalState: ModalState;
22
- export declare type Action = {
23
- type: 'show';
24
- id: ModalID;
25
- } | {
26
- type: 'hide';
27
- id: ModalID;
28
- } | {
29
- type: 'focus';
30
- id: ModalID;
31
- } | {
32
- type: 'unmount';
33
- id: ModalID;
34
- } | {
35
- type: 'mount';
36
- id: ModalID;
37
- intialState: {
38
- initialWidth?: number;
39
- initialHeight?: number;
40
- };
41
- } | {
42
- type: 'windowResize';
43
- size: {
44
- width: number;
45
- height: number;
46
- };
47
- } | {
48
- type: 'drag';
49
- id: ModalID;
50
- x: number;
51
- y: number;
52
- } | {
53
- type: 'resize';
54
- id: ModalID;
55
- x: number;
56
- y: number;
57
- width: number;
58
- height: number;
59
- };
60
- export declare const getModalState: ({ state, id, initialWidth, initialHeight, }: {
61
- state: ModalsState;
62
- id: ModalID;
63
- initialWidth?: number;
64
- initialHeight?: number;
65
- }) => ModalState;
66
- export declare const draggableModalReducer: (state: ModalsState, action: Action) => ModalsState;
@@ -1,167 +0,0 @@
1
- "use strict";
2
-
3
- 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); }
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.initialModalsState = exports.initialModalState = exports.getModalState = exports.draggableModalReducer = void 0;
8
- var _getWindowSize = require("./getWindowSize");
9
- var _clamp = require("./clamp");
10
- 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; }
11
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
12
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
13
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
14
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
15
- 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); }
16
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
17
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
18
- 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; }
19
- var mapObject = function mapObject(o, f) {
20
- return Object.assign.apply(Object, [{}].concat(_toConsumableArray(Object.keys(o).map(function (k) {
21
- return _defineProperty({}, k, f(o[k]));
22
- }))));
23
- };
24
- var initialModalsState = {
25
- maxZIndex: 0,
26
- windowSize: (0, _getWindowSize.getWindowSize)(),
27
- modals: {}
28
- };
29
- exports.initialModalsState = initialModalsState;
30
- var initialModalState = {
31
- x: 0,
32
- y: 0,
33
- width: 800,
34
- height: 800,
35
- zIndex: 0,
36
- visible: false
37
- };
38
- exports.initialModalState = initialModalState;
39
- var getInitialModalState = function getInitialModalState(_ref2) {
40
- var _ref2$initialWidth = _ref2.initialWidth,
41
- initialWidth = _ref2$initialWidth === void 0 ? initialModalState.width : _ref2$initialWidth,
42
- _ref2$initialHeight = _ref2.initialHeight,
43
- initialHeight = _ref2$initialHeight === void 0 ? initialModalState.height : _ref2$initialHeight;
44
- return Object.assign(Object.assign({}, initialModalState), {
45
- width: initialWidth,
46
- height: initialHeight
47
- });
48
- };
49
- var getModalState = function getModalState(_ref3) {
50
- var state = _ref3.state,
51
- id = _ref3.id,
52
- initialWidth = _ref3.initialWidth,
53
- initialHeight = _ref3.initialHeight;
54
- return state.modals[id] || getInitialModalState({
55
- initialWidth: initialWidth,
56
- initialHeight: initialHeight
57
- });
58
- };
59
- exports.getModalState = getModalState;
60
- var getNextZIndex = function getNextZIndex(state, id) {
61
- return getModalState({
62
- state: state,
63
- id: id
64
- }).zIndex === state.maxZIndex ? state.maxZIndex : state.maxZIndex + 1;
65
- };
66
- var clampDrag = function clampDrag(windowWidth, windowHeight, x, y, width, height) {
67
- var maxX = windowWidth - width;
68
- var maxY = windowHeight - height;
69
- var clampedX = (0, _clamp.clamp)(0, maxX, x);
70
- var clampedY = (0, _clamp.clamp)(0, maxY, y);
71
- return {
72
- x: clampedX,
73
- y: clampedY
74
- };
75
- };
76
- var clampResize = function clampResize(windowWidth, windowHeight, x, y, width, height) {
77
- var maxWidth = windowWidth - x;
78
- var maxHeight = windowHeight - y;
79
- var clampedWidth = (0, _clamp.clamp)(200, maxWidth, width);
80
- var clampedHeight = (0, _clamp.clamp)(200, maxHeight, height);
81
- return {
82
- width: clampedWidth,
83
- height: clampedHeight
84
- };
85
- };
86
- var draggableModalReducer = function draggableModalReducer(state, action) {
87
- switch (action.type) {
88
- case 'resize':
89
- var size = clampResize(state.windowSize.width, state.windowSize.height, action.x, action.y, action.width, action.height);
90
- return Object.assign(Object.assign({}, state), {
91
- maxZIndex: getNextZIndex(state, action.id),
92
- modals: Object.assign(Object.assign({}, state.modals), _defineProperty({}, action.id, Object.assign(Object.assign(Object.assign({}, state.modals[action.id]), size), {
93
- zIndex: getNextZIndex(state, action.id)
94
- })))
95
- });
96
- case 'drag':
97
- return Object.assign(Object.assign({}, state), {
98
- maxZIndex: getNextZIndex(state, action.id),
99
- modals: Object.assign(Object.assign({}, state.modals), _defineProperty({}, action.id, Object.assign(Object.assign(Object.assign({}, state.modals[action.id]), clampDrag(state.windowSize.width, state.windowSize.height, action.x, action.y, state.modals[action.id].width, state.modals[action.id].height)), {
100
- zIndex: getNextZIndex(state, action.id)
101
- })))
102
- });
103
- case 'show':
104
- {
105
- var _modalState = state.modals[action.id];
106
- var centerX = state.windowSize.width / 2 - _modalState.width / 2;
107
- var centerY = state.windowSize.height / 2 - _modalState.height / 2;
108
- var position = clampDrag(state.windowSize.width, state.windowSize.height, centerX, centerY, _modalState.width, _modalState.height);
109
- var _size = clampResize(state.windowSize.width, state.windowSize.height, position.x, position.y, _modalState.width, _modalState.height);
110
- return Object.assign(Object.assign({}, state), {
111
- maxZIndex: state.maxZIndex + 1,
112
- modals: Object.assign(Object.assign({}, state.modals), _defineProperty({}, action.id, Object.assign(Object.assign(Object.assign(Object.assign({}, _modalState), position), _size), {
113
- zIndex: state.maxZIndex + 1,
114
- visible: true
115
- })))
116
- });
117
- }
118
- case 'focus':
119
- var modalState = state.modals[action.id];
120
- return Object.assign(Object.assign({}, state), {
121
- maxZIndex: state.maxZIndex + 1,
122
- modals: Object.assign(Object.assign({}, state.modals), _defineProperty({}, action.id, Object.assign(Object.assign({}, modalState), {
123
- zIndex: state.maxZIndex + 1
124
- })))
125
- });
126
- case 'hide':
127
- {
128
- var _modalState2 = state.modals[action.id];
129
- return Object.assign(Object.assign({}, state), {
130
- modals: Object.assign(Object.assign({}, state.modals), _defineProperty({}, action.id, Object.assign(Object.assign({}, _modalState2), {
131
- visible: false
132
- })))
133
- });
134
- }
135
- case 'mount':
136
- var initialState = getInitialModalState(action.intialState);
137
- return Object.assign(Object.assign({}, state), {
138
- maxZIndex: state.maxZIndex + 1,
139
- modals: Object.assign(Object.assign({}, state.modals), _defineProperty({}, action.id, Object.assign(Object.assign({}, initialState), {
140
- x: state.windowSize.width / 2 - initialState.width / 2,
141
- y: state.windowSize.height / 2 - initialState.height / 2,
142
- zIndex: state.maxZIndex + 1
143
- })))
144
- });
145
- case 'unmount':
146
- var modalsClone = Object.assign({}, state.modals);
147
- delete modalsClone[action.id];
148
- return Object.assign(Object.assign({}, state), {
149
- modals: modalsClone
150
- });
151
- case 'windowResize':
152
- return Object.assign(Object.assign({}, state), {
153
- windowSize: action.size,
154
- modals: mapObject(state.modals, function (modalState) {
155
- if (!modalState.visible) {
156
- return modalState;
157
- }
158
- var position = clampDrag(state.windowSize.width, state.windowSize.height, modalState.x, modalState.y, modalState.width, modalState.height);
159
- var size = clampResize(state.windowSize.width, state.windowSize.height, position.x, position.y, modalState.width, modalState.height);
160
- return Object.assign(Object.assign(Object.assign({}, modalState), position), size);
161
- })
162
- });
163
- default:
164
- throw new Error();
165
- }
166
- };
167
- exports.draggableModalReducer = draggableModalReducer;
@@ -1,4 +0,0 @@
1
- export declare const getWindowSize: () => {
2
- width: number;
3
- height: number;
4
- };
@@ -1,13 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getWindowSize = void 0;
7
- var getWindowSize = function getWindowSize() {
8
- return {
9
- width: window.innerWidth || 0,
10
- height: window.innerHeight || 0
11
- };
12
- };
13
- exports.getWindowSize = getWindowSize;
@@ -1,65 +0,0 @@
1
- /**
2
- * NOTE: This is not compiled.
3
- */
4
-
5
- .ant-design-draggable-modal {
6
- pointer-events: none;
7
- overflow: hidden !important;
8
- }
9
-
10
- .ant-design-draggable-modal .ant-modal {
11
- display: flex;
12
- max-width: none;
13
- transform-origin: 50% 50% !important;
14
- }
15
-
16
- .ant-design-draggable-modal .ant-modal-content {
17
- flex: 1;
18
- display: flex;
19
- flex-direction: column;
20
- }
21
-
22
- .ant-design-draggable-modal .ant-modal-header {
23
- flex: 0;
24
- padding: 0;
25
- }
26
-
27
- .ant-design-draggable-modal .ant-modal-footer {
28
- flex: 0;
29
- padding: 16px;
30
- }
31
-
32
- .ant-design-draggable-modal .ant-design-draggable-modal-title {
33
- cursor: move;
34
- padding: 16px;
35
- }
36
-
37
- .ant-design-draggable-modal .ant-design-draggable-modal-title::before {
38
- content: '\00a0';
39
- }
40
-
41
- .ant-design-draggable-modal .ant-modal-body {
42
- flex: 1;
43
- overflow-y: auto;
44
- padding: 16px;
45
- }
46
-
47
- .ant-design-draggable-modal-resize-handle-inner {
48
- width: 12px;
49
- right: 14px;
50
- border: 2px solid grey;
51
- height: 12px;
52
- bottom: 14px;
53
- position: absolute;
54
- border-top: 0;
55
- border-left: 0;
56
- }
57
-
58
- .ant-design-draggable-modal-resize-handle {
59
- right: -10px;
60
- width: 44px;
61
- bottom: -10px;
62
- cursor: se-resize;
63
- height: 44px;
64
- position: absolute;
65
- }
@@ -1,5 +0,0 @@
1
- import * as React from 'react';
2
- export declare const useDrag: (x: number, y: number, onDrag: (args: {
3
- x: number;
4
- y: number;
5
- }) => void) => (e: React.MouseEvent) => void;
@@ -1,73 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useDrag = void 0;
7
- var _react = require("react");
8
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
9
- 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."); }
10
- 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); }
11
- 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; }
12
- 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; } }
13
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
- var useDrag = function useDrag(x, y, onDrag) {
15
- var _useState = (0, _react.useState)(false),
16
- _useState2 = _slicedToArray(_useState, 2),
17
- dragging = _useState2[0],
18
- setDragging = _useState2[1];
19
- var _useState3 = (0, _react.useState)({
20
- initX: 0,
21
- initY: 0,
22
- mouseDownX: 0,
23
- mouseDownY: 0
24
- }),
25
- _useState4 = _slicedToArray(_useState3, 2),
26
- initialDragState = _useState4[0],
27
- setInitialDragState = _useState4[1];
28
- var onMouseDown = (0, _react.useCallback)(function (e) {
29
- e.preventDefault();
30
- setInitialDragState({
31
- initX: x,
32
- initY: y,
33
- mouseDownX: e.clientX,
34
- mouseDownY: e.clientY
35
- });
36
- setDragging(true);
37
- }, [x, y, setDragging, setInitialDragState]);
38
- (0, _react.useEffect)(function () {
39
- var onMouseMove = function onMouseMove(e) {
40
- if (dragging) {
41
- var initX = initialDragState.initX,
42
- mouseDownX = initialDragState.mouseDownX,
43
- initY = initialDragState.initY,
44
- mouseDownY = initialDragState.mouseDownY;
45
- var dx = e.clientX - mouseDownX;
46
- var dy = e.clientY - mouseDownY;
47
- var _x = initX + dx;
48
- var _y = initY + dy;
49
- onDrag({
50
- x: _x,
51
- y: _y
52
- });
53
- }
54
- };
55
- window.addEventListener('mousemove', onMouseMove, {
56
- passive: true
57
- });
58
- return function () {
59
- return window.removeEventListener('mousemove', onMouseMove);
60
- };
61
- }, [initialDragState, dragging, onDrag]);
62
- (0, _react.useEffect)(function () {
63
- var onMouseUp = function onMouseUp() {
64
- setDragging(false);
65
- };
66
- window.addEventListener('mouseup', onMouseUp);
67
- return function () {
68
- return window.removeEventListener('mouseup', onMouseUp);
69
- };
70
- }, [setDragging]);
71
- return onMouseDown;
72
- };
73
- exports.useDrag = useDrag;
@@ -1 +0,0 @@
1
- export declare const usePrevious: <T>(value: T) => T;