cloud-b2b 1.1.59 → 1.1.61

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 (314) hide show
  1. package/es/Area/Area.js +141 -0
  2. package/es/Card/Card.js +19 -0
  3. package/es/CodeInput/CodeInput.js +123 -0
  4. package/es/Control/Control.js +444 -0
  5. package/es/Control/event.js +43 -0
  6. package/es/Enhance/Dialogs.js +52 -0
  7. package/es/Enhance/Loading.js +131 -0
  8. package/{src → es}/Enhance/index.js +6 -8
  9. package/es/Header/Header.js +162 -0
  10. package/es/Header/Vertical.js +106 -0
  11. package/es/ImageView/ImageView.js +100 -0
  12. package/es/Indent/Indent.js +19 -0
  13. package/es/InpurCascader/InputCascader.js +117 -0
  14. package/es/InputEditor/InputEditor.js +173 -0
  15. package/es/InputSearch/InputSearch.js +266 -0
  16. package/es/InputSelect/InputSelect.js +160 -0
  17. package/es/InputTreeSelect/InputTreeSelect.js +121 -0
  18. package/es/InputWriting/InputWriting.js +85 -0
  19. package/es/Layout/Layout.js +201 -0
  20. package/es/LayoutLink/LayoutLink.js +73 -0
  21. package/es/Link/Link.js +85 -0
  22. package/es/Loading/Loading.js +13 -0
  23. package/es/Loading2/Loading2.js +9 -0
  24. package/es/ModalWithDrag/ModalWithDrag.js +29 -0
  25. package/{src → es}/ModalWithDrag/drag.js +116 -128
  26. package/es/NumberInput/NumberInput.js +200 -0
  27. package/es/Search/Search.js +497 -0
  28. package/es/Search2/Search.js +597 -0
  29. package/{src → es}/Search2/Search.less +0 -1
  30. package/es/Sidebar/Sidebar.js +144 -0
  31. package/es/Sidebar2/Sidebar.js +165 -0
  32. package/es/SuperForm/SuperForm.js +598 -0
  33. package/es/SuperForm2/SuperForm.js +687 -0
  34. package/es/SuperIcon/SuperIcon.js +27 -0
  35. package/es/SuperPagination/SuperPagination.js +109 -0
  36. package/es/SuperTab/SuperTab.js +107 -0
  37. package/es/SuperTab2/SuperTab2.js +145 -0
  38. package/es/SuperTable/DragSortRow.js +97 -0
  39. package/es/SuperTable/FilterDropDown.js +164 -0
  40. package/es/SuperTable/SuperTable.js +808 -0
  41. package/es/SuperTable/fixed.js +34 -0
  42. package/es/SuperTable2/SuperTable2.js +926 -0
  43. package/{src → es}/SuperTable2/SuperTable2.less +2 -1
  44. package/es/SuperTable2/SuperTableCell.js +234 -0
  45. package/es/SuperTable3/FilterDropDown.js +164 -0
  46. package/es/SuperTable3/SuperTable.js +665 -0
  47. package/es/SuperTable3/fixed.js +34 -0
  48. package/es/SuperToolbar/SuperToolbar.js +195 -0
  49. package/es/SuperUpload/SuperUpload.js +356 -0
  50. package/es/Title/Title.js +33 -0
  51. package/es/Viewer/ImageViews.js +258 -0
  52. package/es/Viewer/Viewer.js +122 -0
  53. package/es/WingBlank/WingBlank.js +16 -0
  54. package/es/helper.js +240 -0
  55. package/{src → es}/history.js +6 -6
  56. package/es/index.js +38 -0
  57. package/{src → es}/style.less +2 -1
  58. package/es/variables.js +6 -0
  59. package/lib/Area/Area.js +149 -0
  60. package/lib/Area/package.json +6 -0
  61. package/lib/Card/Card.js +27 -0
  62. package/lib/Card/package.json +6 -0
  63. package/lib/CodeInput/CodeInput.js +131 -0
  64. package/lib/CodeInput/package.json +6 -0
  65. package/lib/Control/Control.js +450 -0
  66. package/lib/Control/event.js +51 -0
  67. package/lib/Control/package.json +6 -0
  68. package/lib/Enhance/Dialogs.js +60 -0
  69. package/lib/Enhance/Loading.js +138 -0
  70. package/lib/Enhance/index.js +25 -0
  71. package/lib/Enhance/package.json +6 -0
  72. package/lib/Header/Header.js +169 -0
  73. package/lib/Header/Header.less +95 -0
  74. package/lib/Header/Vertical.js +114 -0
  75. package/lib/Header/Vertical.less +60 -0
  76. package/lib/Header/package.json +6 -0
  77. package/lib/ImageView/ImageView.js +108 -0
  78. package/lib/ImageView/ImageView.less +14 -0
  79. package/lib/ImageView/package.json +6 -0
  80. package/lib/Indent/Indent.js +27 -0
  81. package/lib/Indent/package.json +6 -0
  82. package/lib/InpurCascader/InputCascader.js +124 -0
  83. package/lib/InpurCascader/package.json +6 -0
  84. package/lib/InputEditor/InputEditor.js +181 -0
  85. package/lib/InputEditor/inputEditor.less +8 -0
  86. package/lib/InputEditor/package.json +6 -0
  87. package/lib/InputSearch/InputSearch.js +274 -0
  88. package/lib/InputSearch/package.json +6 -0
  89. package/lib/InputSelect/InputSelect.js +168 -0
  90. package/lib/InputSelect/package.json +6 -0
  91. package/lib/InputTreeSelect/InputTreeSelect.js +128 -0
  92. package/lib/InputTreeSelect/package.json +6 -0
  93. package/lib/InputWriting/InputWriting.js +93 -0
  94. package/lib/InputWriting/package.json +6 -0
  95. package/lib/Layout/Layout.js +209 -0
  96. package/lib/Layout/Layout.less +28 -0
  97. package/lib/Layout/package.json +6 -0
  98. package/lib/LayoutLink/LayoutLink.js +86 -0
  99. package/lib/LayoutLink/LayoutLink.less +53 -0
  100. package/lib/LayoutLink/package.json +6 -0
  101. package/lib/Link/Link.js +93 -0
  102. package/lib/Link/package.json +6 -0
  103. package/lib/Loading/Loading.js +21 -0
  104. package/lib/Loading/Loading.less +13 -0
  105. package/lib/Loading/package.json +6 -0
  106. package/lib/Loading2/Loading2.js +17 -0
  107. package/lib/Loading2/Loading2.less +19 -0
  108. package/lib/Loading2/package.json +6 -0
  109. package/lib/ModalWithDrag/ModalWithDrag.js +37 -0
  110. package/lib/ModalWithDrag/ModalWithDrag.less +6 -0
  111. package/lib/ModalWithDrag/drag.js +124 -0
  112. package/lib/ModalWithDrag/package.json +6 -0
  113. package/lib/NumberInput/NumberInput.js +208 -0
  114. package/lib/NumberInput/package.json +6 -0
  115. package/lib/Search/Search.js +510 -0
  116. package/lib/Search/Search.less +63 -0
  117. package/lib/Search/package.json +6 -0
  118. package/lib/Search2/Search.js +609 -0
  119. package/lib/Search2/Search.less +64 -0
  120. package/lib/Search2/package.json +6 -0
  121. package/lib/Sidebar/Sidebar.js +152 -0
  122. package/lib/Sidebar/Sidebar.less +78 -0
  123. package/lib/Sidebar/package.json +6 -0
  124. package/lib/Sidebar2/Sidebar.js +173 -0
  125. package/lib/Sidebar2/Sidebar.less +153 -0
  126. package/lib/Sidebar2/package.json +6 -0
  127. package/lib/SuperForm/SuperForm.js +610 -0
  128. package/lib/SuperForm/SuperForm.less +52 -0
  129. package/lib/SuperForm/package.json +6 -0
  130. package/lib/SuperForm2/SuperForm.js +699 -0
  131. package/lib/SuperForm2/SuperForm.less +52 -0
  132. package/lib/SuperForm2/package.json +6 -0
  133. package/lib/SuperIcon/SuperIcon.js +35 -0
  134. package/lib/SuperIcon/package.json +6 -0
  135. package/lib/SuperPagination/SuperPagination.js +117 -0
  136. package/lib/SuperPagination/package.json +6 -0
  137. package/lib/SuperTab/SuperTab.js +115 -0
  138. package/lib/SuperTab/SuperTab.less +43 -0
  139. package/lib/SuperTab/package.json +6 -0
  140. package/lib/SuperTab2/SuperTab2.js +153 -0
  141. package/lib/SuperTab2/SuperTab2.less +18 -0
  142. package/lib/SuperTab2/package.json +6 -0
  143. package/lib/SuperTable/DragSortRow.js +105 -0
  144. package/lib/SuperTable/DragSortRow.less +17 -0
  145. package/lib/SuperTable/FilterDropDown.js +172 -0
  146. package/lib/SuperTable/FilterDropDown.less +30 -0
  147. package/lib/SuperTable/SuperTable.js +816 -0
  148. package/lib/SuperTable/SuperTable.less +132 -0
  149. package/lib/SuperTable/fixed.js +42 -0
  150. package/lib/SuperTable/package.json +6 -0
  151. package/lib/SuperTable2/SuperTable2.js +939 -0
  152. package/lib/SuperTable2/SuperTable2.less +119 -0
  153. package/lib/SuperTable2/SuperTableCell.js +239 -0
  154. package/lib/SuperTable2/package.json +6 -0
  155. package/lib/SuperTable3/FilterDropDown.js +172 -0
  156. package/lib/SuperTable3/FilterDropDown.less +29 -0
  157. package/lib/SuperTable3/SuperTable.js +673 -0
  158. package/lib/SuperTable3/SuperTable.less +99 -0
  159. package/lib/SuperTable3/fixed.js +42 -0
  160. package/lib/SuperTable3/package.json +6 -0
  161. package/lib/SuperToolbar/SuperToolbar.js +203 -0
  162. package/lib/SuperToolbar/SuperToolbar.less +17 -0
  163. package/lib/SuperToolbar/package.json +6 -0
  164. package/lib/SuperUpload/SuperUpload.js +368 -0
  165. package/lib/SuperUpload/SuperUpload.less +28 -0
  166. package/lib/SuperUpload/package.json +6 -0
  167. package/lib/Title/Title.js +41 -0
  168. package/lib/Title/Title.less +35 -0
  169. package/lib/Title/package.json +6 -0
  170. package/lib/Viewer/ImageViews.js +266 -0
  171. package/lib/Viewer/Viewer.js +130 -0
  172. package/lib/Viewer/Viewer.less +67 -0
  173. package/lib/Viewer/imgView.less +59 -0
  174. package/lib/Viewer/package.json +7 -0
  175. package/lib/WingBlank/WingBlank.js +24 -0
  176. package/lib/WingBlank/WingBlank.less +12 -0
  177. package/lib/WingBlank/package.json +6 -0
  178. package/lib/adjust.less +89 -0
  179. package/lib/helper.js +246 -0
  180. package/lib/history.js +12 -0
  181. package/lib/index.js +278 -0
  182. package/lib/index.less +32 -0
  183. package/lib/style.less +31 -0
  184. package/lib/variables.js +14 -0
  185. package/lib/variables.less +73 -0
  186. package/package.json +22 -44
  187. package/src/Area/Area.js +0 -94
  188. package/src/Card/Card.js +0 -16
  189. package/src/CodeInput/CodeInput.js +0 -76
  190. package/src/Control/Control.js +0 -338
  191. package/src/Control/event.js +0 -45
  192. package/src/Enhance/Dialogs.js +0 -24
  193. package/src/Enhance/Loading.js +0 -83
  194. package/src/Header/Header.js +0 -149
  195. package/src/Header/Vertical.js +0 -74
  196. package/src/ImageView/ImageView.js +0 -62
  197. package/src/Indent/Indent.js +0 -12
  198. package/src/InpurCascader/InputCascader.js +0 -83
  199. package/src/InputEditor/InputEditor.js +0 -93
  200. package/src/InputSearch/InputSearch.js +0 -186
  201. package/src/InputSelect/InputSelect.js +0 -103
  202. package/src/InputTreeSelect/InputTreeSelect.js +0 -87
  203. package/src/InputWriting/InputWriting.js +0 -65
  204. package/src/Layout/Layout.js +0 -121
  205. package/src/LayoutLink/LayoutLink.js +0 -59
  206. package/src/Link/Link.js +0 -57
  207. package/src/Loading/Loading.js +0 -15
  208. package/src/Loading2/Loading2.js +0 -15
  209. package/src/ModalWithDrag/ModalWithDrag.js +0 -17
  210. package/src/NumberInput/NumberInput.js +0 -137
  211. package/src/Search/Search.js +0 -368
  212. package/src/Search2/Search.js +0 -436
  213. package/src/Sidebar/Sidebar.js +0 -111
  214. package/src/Sidebar2/Sidebar.js +0 -143
  215. package/src/SuperForm/SuperForm.js +0 -519
  216. package/src/SuperForm2/SuperForm.js +0 -588
  217. package/src/SuperIcon/SuperIcon.js +0 -14
  218. package/src/SuperPagination/SuperPagination.js +0 -65
  219. package/src/SuperTab/SuperTab.js +0 -84
  220. package/src/SuperTab2/SuperTab2.js +0 -94
  221. package/src/SuperTable/DragSortRow.js +0 -62
  222. package/src/SuperTable/FilterDropDown.js +0 -111
  223. package/src/SuperTable/SuperTable.js +0 -590
  224. package/src/SuperTable/fixed.js +0 -34
  225. package/src/SuperTable2/SuperTable2.js +0 -624
  226. package/src/SuperTable2/SuperTableCell.js +0 -175
  227. package/src/SuperTable3/FilterDropDown.js +0 -111
  228. package/src/SuperTable3/SuperTable.js +0 -498
  229. package/src/SuperTable3/fixed.js +0 -34
  230. package/src/SuperToolbar/SuperToolbar.js +0 -128
  231. package/src/SuperUpload/SuperUpload.js +0 -137
  232. package/src/Title/Title.js +0 -18
  233. package/src/Viewer/ImageViews.js +0 -220
  234. package/src/Viewer/Viewer.js +0 -97
  235. package/src/WingBlank/WingBlank.js +0 -14
  236. package/src/helper.js +0 -185
  237. package/src/index.js +0 -39
  238. package/src/variables.js +0 -5
  239. package/test/index.html +0 -10
  240. package/test/test.js +0 -16
  241. package/test/test.less +0 -12
  242. package/test/webpack.config.js +0 -71
  243. package/tools/babel.config.js +0 -14
  244. package/tools/build.js +0 -70
  245. package/tools/publish.js +0 -9
  246. package/tools/util.js +0 -53
  247. /package/{src → es}/Area/package.json +0 -0
  248. /package/{src → es}/Card/package.json +0 -0
  249. /package/{src → es}/CodeInput/package.json +0 -0
  250. /package/{src → es}/Control/package.json +0 -0
  251. /package/{src → es}/Enhance/package.json +0 -0
  252. /package/{src → es}/Header/Header.less +0 -0
  253. /package/{src → es}/Header/Vertical.less +0 -0
  254. /package/{src → es}/Header/package.json +0 -0
  255. /package/{src → es}/ImageView/ImageView.less +0 -0
  256. /package/{src → es}/ImageView/package.json +0 -0
  257. /package/{src → es}/Indent/package.json +0 -0
  258. /package/{src → es}/InpurCascader/package.json +0 -0
  259. /package/{src → es}/InputEditor/inputEditor.less +0 -0
  260. /package/{src → es}/InputEditor/package.json +0 -0
  261. /package/{src → es}/InputSearch/package.json +0 -0
  262. /package/{src → es}/InputSelect/package.json +0 -0
  263. /package/{src → es}/InputTreeSelect/package.json +0 -0
  264. /package/{src → es}/InputWriting/package.json +0 -0
  265. /package/{src → es}/Layout/Layout.less +0 -0
  266. /package/{src → es}/Layout/package.json +0 -0
  267. /package/{src → es}/LayoutLink/LayoutLink.less +0 -0
  268. /package/{src → es}/LayoutLink/package.json +0 -0
  269. /package/{src → es}/Link/package.json +0 -0
  270. /package/{src → es}/Loading/Loading.less +0 -0
  271. /package/{src → es}/Loading/package.json +0 -0
  272. /package/{src → es}/Loading2/Loading2.less +0 -0
  273. /package/{src → es}/Loading2/package.json +0 -0
  274. /package/{src → es}/ModalWithDrag/ModalWithDrag.less +0 -0
  275. /package/{src → es}/ModalWithDrag/package.json +0 -0
  276. /package/{src → es}/NumberInput/package.json +0 -0
  277. /package/{src → es}/Search/Search.less +0 -0
  278. /package/{src → es}/Search/package.json +0 -0
  279. /package/{src → es}/Search2/package.json +0 -0
  280. /package/{src → es}/Sidebar/Sidebar.less +0 -0
  281. /package/{src → es}/Sidebar/package.json +0 -0
  282. /package/{src → es}/Sidebar2/Sidebar.less +0 -0
  283. /package/{src → es}/Sidebar2/package.json +0 -0
  284. /package/{src → es}/SuperForm/SuperForm.less +0 -0
  285. /package/{src → es}/SuperForm/package.json +0 -0
  286. /package/{src → es}/SuperForm2/SuperForm.less +0 -0
  287. /package/{src → es}/SuperForm2/package.json +0 -0
  288. /package/{src → es}/SuperIcon/package.json +0 -0
  289. /package/{src → es}/SuperPagination/package.json +0 -0
  290. /package/{src → es}/SuperTab/SuperTab.less +0 -0
  291. /package/{src → es}/SuperTab/package.json +0 -0
  292. /package/{src → es}/SuperTab2/SuperTab2.less +0 -0
  293. /package/{src → es}/SuperTab2/package.json +0 -0
  294. /package/{src → es}/SuperTable/DragSortRow.less +0 -0
  295. /package/{src → es}/SuperTable/FilterDropDown.less +0 -0
  296. /package/{src → es}/SuperTable/SuperTable.less +0 -0
  297. /package/{src → es}/SuperTable/package.json +0 -0
  298. /package/{src → es}/SuperTable2/package.json +0 -0
  299. /package/{src → es}/SuperTable3/FilterDropDown.less +0 -0
  300. /package/{src → es}/SuperTable3/SuperTable.less +0 -0
  301. /package/{src → es}/SuperTable3/package.json +0 -0
  302. /package/{src → es}/SuperToolbar/SuperToolbar.less +0 -0
  303. /package/{src → es}/SuperToolbar/package.json +0 -0
  304. /package/{src → es}/SuperUpload/SuperUpload.less +0 -0
  305. /package/{src → es}/SuperUpload/package.json +0 -0
  306. /package/{src → es}/Title/Title.less +0 -0
  307. /package/{src → es}/Title/package.json +0 -0
  308. /package/{src → es}/Viewer/Viewer.less +0 -0
  309. /package/{src → es}/Viewer/imgView.less +0 -0
  310. /package/{src → es}/Viewer/package.json +0 -0
  311. /package/{src → es}/WingBlank/WingBlank.less +0 -0
  312. /package/{src → es}/WingBlank/package.json +0 -0
  313. /package/{src → es}/adjust.less +0 -0
  314. /package/{src → es}/variables.less +0 -0
@@ -0,0 +1,19 @@
1
+ @import '../variables.less';
2
+
3
+ .@{cloudlink-prefix}-Loading2 {
4
+ position: fixed;
5
+ left: 0;
6
+ right: 0;
7
+ top: 0;
8
+ bottom: 0;
9
+ z-index: 1001;
10
+ text-align: center;
11
+
12
+ > div {
13
+ display: inline-block;
14
+ width: 200px;
15
+ line-height: 100px;
16
+ border-radius: @border-radius-base;
17
+ margin-top: ~'calc(50vh - 50px)';
18
+ }
19
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "Loading2",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "main": "./Loading2.js"
6
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
5
+ _Object$defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+ var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
10
+ var _modal = _interopRequireDefault(require("antd/lib/modal"));
11
+ var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
12
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
13
+ var _react = _interopRequireDefault(require("react"));
14
+ var _drag = _interopRequireDefault(require("./drag"));
15
+ var _variables = _interopRequireDefault(require("../variables"));
16
+ var _excluded = ["className", "children", "title"];
17
+ var onLoad = function onLoad(e) {
18
+ var dragElement = e.parentNode.parentNode;
19
+ var targetElement = dragElement.parentNode.parentNode;
20
+ (0, _drag["default"])(dragElement, targetElement);
21
+ };
22
+ var ModalWithDrag = function ModalWithDrag(_ref) {
23
+ var _context;
24
+ var className = _ref.className,
25
+ children = _ref.children,
26
+ title = _ref.title,
27
+ props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
28
+ props.title = /*#__PURE__*/_react["default"].createElement("div", {
29
+ ref: function ref(e) {
30
+ return e && onLoad(e);
31
+ }
32
+ }, title);
33
+ return /*#__PURE__*/_react["default"].createElement(_modal["default"], (0, _extends2["default"])({
34
+ className: (0, _concat["default"])(_context = "".concat(className, " ")).call(_context, (0, _variables["default"])('ModalWithDrag'))
35
+ }, props), children);
36
+ };
37
+ var _default = exports["default"] = ModalWithDrag;
@@ -0,0 +1,6 @@
1
+ @import '../variables.less';
2
+
3
+ .@{cloudlink-prefix}-ModalWithDrag :global(.ant-modal-body) {
4
+ max-height: ~'calc(100vh - 185px)';
5
+ overflow: auto;
6
+ }
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
5
+ _Object$defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+ var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
10
+ var _parseInt2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/parse-int"));
11
+ // 依据CSS3的transform属性进行移动
12
+ var dragByTransform = function dragByTransform(dragElement, targetElement) {
13
+ var mouseMove = null;
14
+ var mouseUp = null;
15
+ var active = false;
16
+ var offsetX = 0;
17
+ var offsetY = 0;
18
+ var x = 0;
19
+ var y = 0;
20
+ dragElement.style.cursor = 'move';
21
+ dragElement.onmousedown = function (e) {
22
+ mouseMove = document.onmousemove;
23
+ mouseUp = document.onmouseup;
24
+ x = e.clientX;
25
+ y = e.clientY;
26
+ active = true;
27
+
28
+ // 如果下拉框拥有焦点,通过使其失去焦点来关闭掉下拉框
29
+ if (document.activeElement && document.activeElement !== dragElement) {
30
+ document.activeElement.blur();
31
+ }
32
+ document.onmousemove = function (e) {
33
+ if (active) {
34
+ var _context;
35
+ var x2 = offsetX + e.clientX - x;
36
+ var y2 = offsetY + e.clientY - y;
37
+ targetElement.style.transform = (0, _concat["default"])(_context = "translate(".concat(x2, "px, ")).call(_context, y2, "px)");
38
+ }
39
+ mouseMove && mouseMove(e);
40
+ };
41
+ document.onmouseup = function (e) {
42
+ if (active) {
43
+ document.onmousemove = mouseMove;
44
+ document.onmouseup = mouseUp;
45
+ offsetX += e.clientX - x;
46
+ offsetY += e.clientY - y;
47
+ active = false;
48
+ }
49
+ mouseUp && mouseUp(e);
50
+ };
51
+ return false;
52
+ };
53
+ };
54
+
55
+ // 获取相关CSS属性
56
+ var getCss = function getCss(o, key) {
57
+ return o.currentStyle ? o.currentStyle[key] : document.defaultView.getComputedStyle(o)[key];
58
+ };
59
+
60
+ // 依据position属性进行移动
61
+ var dragByPosition = function dragByPosition(dragElement, targetElement) {
62
+ var mouseMove = null;
63
+ var mouseUp = null;
64
+ var active = false;
65
+ var left = 0;
66
+ var top = 0;
67
+ var x = 0;
68
+ var y = 0;
69
+ dragElement.style.cursor = 'move';
70
+ dragElement.onmousedown = function (e) {
71
+ mouseMove = document.onmousemove;
72
+ mouseUp = document.onmouseup;
73
+ x = e.clientX;
74
+ y = e.clientY;
75
+ active = true;
76
+ if (getCss(targetElement, 'left') !== 'auto') {
77
+ left = (0, _parseInt2["default"])(getCss(targetElement, "left"));
78
+ }
79
+ if (getCss(targetElement, 'top') !== 'auto') {
80
+ top = (0, _parseInt2["default"])(getCss(targetElement, 'top'));
81
+ }
82
+
83
+ // 如果下拉框拥有焦点,通过使其失去焦点来关闭掉下拉框
84
+ if (document.activeElement && document.activeElement !== dragElement) {
85
+ document.activeElement.blur();
86
+ }
87
+ document.onmousemove = function (e) {
88
+ if (active) {
89
+ var top2 = top + e.clientY - y;
90
+ targetElement.style.left = "".concat(left + e.clientX - x, "px");
91
+ targetElement.style.top = "".concat(top2 > 0 ? top2 : 0, "px");
92
+ }
93
+ mouseMove && mouseMove(e);
94
+ };
95
+ document.onmouseup = function (e) {
96
+ if (active) {
97
+ document.onmousemove = mouseMove;
98
+ document.onmouseup = mouseUp;
99
+ active = false;
100
+ }
101
+ mouseUp && mouseUp(e);
102
+ };
103
+ return false;
104
+ };
105
+ };
106
+ var drag = function drag(dragElement, targetElement) {
107
+ if (!dragElement || !targetElement) {
108
+ console.error('请传入有效的HTML元素对象');
109
+ return;
110
+ }
111
+
112
+ // 已经绑定过,不需要再次绑定
113
+ if (dragElement.onmousedown) {
114
+ return;
115
+ }
116
+
117
+ // 如果目标元素是非定位元素采用transform属性进行移动
118
+ if (getCss(targetElement, 'position') === 'static') {
119
+ dragByTransform(dragElement, targetElement);
120
+ } else {
121
+ dragByPosition(dragElement, targetElement);
122
+ }
123
+ };
124
+ var _default = exports["default"] = drag;
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "ModalWithDrag",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "main": "./ModalWithDrag.js"
6
+ }
@@ -0,0 +1,208 @@
1
+ "use strict";
2
+
3
+ var _Reflect$construct = require("@babel/runtime-corejs3/core-js-stable/reflect/construct");
4
+ var _Object$keys2 = require("@babel/runtime-corejs3/core-js-stable/object/keys");
5
+ var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
6
+ var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
7
+ var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
8
+ var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
9
+ var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
10
+ var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
11
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
12
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
13
+ _Object$defineProperty(exports, "__esModule", {
14
+ value: true
15
+ });
16
+ exports["default"] = void 0;
17
+ var _input = _interopRequireDefault(require("antd/lib/input"));
18
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
19
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
20
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/assertThisInitialized"));
21
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
22
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
23
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/getPrototypeOf"));
24
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
25
+ var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
26
+ var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
27
+ var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
28
+ var _react = _interopRequireDefault(require("react"));
29
+ var _propTypes = _interopRequireDefault(require("prop-types"));
30
+ var _helper = require("../helper");
31
+ function ownKeys(e, r) { var t = _Object$keys2(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
32
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context3 = ownKeys(Object(t), !0)).call(_context3, function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context4 = ownKeys(Object(t))).call(_context4, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
33
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
34
+ 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; } }
35
+ var parseNumber = function parseNumber(value, _ref) {
36
+ var _context;
37
+ var real = _ref.real,
38
+ sign = _ref.sign,
39
+ zero = _ref.zero,
40
+ precision = _ref.precision,
41
+ fixed = _ref.fixed,
42
+ big = _ref.big;
43
+ var invalid = {
44
+ invalid: true,
45
+ value: ''
46
+ };
47
+ if (value === '') {
48
+ return {
49
+ value: value
50
+ };
51
+ }
52
+
53
+ // 非数字
54
+ value = big ? value : Number(value);
55
+ if (isNaN(value)) {
56
+ return invalid;
57
+ }
58
+
59
+ // 不能为实数,却包含小数点
60
+ if (!real && (0, _includes["default"])(_context = String(value)).call(_context, '.')) {
61
+ return invalid;
62
+ }
63
+
64
+ // 不能为负数,却小于0
65
+ if (!sign && value < 0) {
66
+ return invalid;
67
+ }
68
+
69
+ // 不能为0,却为0
70
+ if (!zero && value === 0) {
71
+ return invalid;
72
+ }
73
+ if (real) {
74
+ precision = Number(precision);
75
+ if (precision) {
76
+ value = value.toFixed(precision);
77
+ value = value.toString(); // 将数值转换为字符串
78
+ value = value.replace(/(\.\d*?[1-9])0+$|\.0*$/, "$1"); // 去除小数点后无意义的零
79
+ if (!fixed) {
80
+ value = Number(value);
81
+ }
82
+ }
83
+ }
84
+ return {
85
+ value: value
86
+ };
87
+ };
88
+
89
+ /**
90
+ * real: true表示带小数点,默认为false
91
+ * sign: true表示带正负号,默认为false
92
+ * precision: real为true时,小数的精度;否则无效
93
+ * zero:true表示可以输入0,默认为false
94
+ * fixed: real为true时生效; true表示固定显示指定精度的小数,精度由precision确定,默认值为false
95
+ * big: big为ture时生效; true标识为大数值,与上面所有属性互斥
96
+ */
97
+ var PROPS = {
98
+ defaultValue: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
99
+ real: _propTypes["default"].bool,
100
+ sign: _propTypes["default"].bool,
101
+ precision: _propTypes["default"].any,
102
+ zero: _propTypes["default"].bool,
103
+ fixed: _propTypes["default"].bool,
104
+ big: _propTypes["default"].bool,
105
+ inputRef: _propTypes["default"].func,
106
+ onChange: _propTypes["default"].func,
107
+ onBlur: _propTypes["default"].func
108
+ };
109
+ var PROPS_KEYS = (0, _keys["default"])(PROPS);
110
+ var NumberInput = /*#__PURE__*/function (_React$Component) {
111
+ (0, _inherits2["default"])(NumberInput, _React$Component);
112
+ var _super = _createSuper(NumberInput);
113
+ function NumberInput() {
114
+ var _context2;
115
+ var _this;
116
+ (0, _classCallCheck2["default"])(this, NumberInput);
117
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
118
+ args[_key] = arguments[_key];
119
+ }
120
+ _this = _super.call.apply(_super, (0, _concat["default"])(_context2 = [this]).call(_context2, args));
121
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "state", {
122
+ typo: false,
123
+ value: ''
124
+ });
125
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChange", function (event) {
126
+ var value = event.target.value;
127
+ if (!_this.hasSpecialChar(value)) {
128
+ _this.setState({
129
+ value: value,
130
+ typo: true
131
+ });
132
+ }
133
+ });
134
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onBlur", function (event) {
135
+ var _this$props = _this.props,
136
+ onBlur = _this$props.onBlur,
137
+ onChange = _this$props.onChange,
138
+ fixed = _this$props.fixed;
139
+ if (_this.state.typo) {
140
+ var _this$format = _this.format(_this.state.value, fixed),
141
+ invalid = _this$format.invalid,
142
+ value = _this$format.value;
143
+ _this.setState({
144
+ typo: false,
145
+ value: ''
146
+ });
147
+ if (!invalid) {
148
+ onChange && onChange(value);
149
+ }
150
+ onBlur && onBlur(event); //有输入才触发外部失去焦点事件,避免非必要请求
151
+ }
152
+ });
153
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "hasSpecialChar", function (value) {
154
+ if ((0, _includes["default"])(value).call(value, '+')) {
155
+ return true;
156
+ } else if (!_this.props.sign && (0, _includes["default"])(value).call(value, '-')) {
157
+ return true;
158
+ } else {
159
+ return !_this.props.real && (0, _includes["default"])(value).call(value, '.');
160
+ }
161
+ });
162
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "format", function (value, fixed) {
163
+ var _this$props2 = _this.props,
164
+ real = _this$props2.real,
165
+ sign = _this$props2.sign,
166
+ zero = _this$props2.zero,
167
+ precision = _this$props2.precision,
168
+ big = _this$props2.big;
169
+ return parseNumber(value, {
170
+ real: real,
171
+ sign: sign,
172
+ zero: zero,
173
+ precision: precision,
174
+ fixed: fixed,
175
+ big: big
176
+ });
177
+ });
178
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getShowValue", function () {
179
+ if (_this.state.typo) {
180
+ // 处于输入状态从state中取值
181
+ return _this.state.value;
182
+ } else {
183
+ // 处于非输入状态从props中取值
184
+ return _this.format(_this.props.defaultValue, _this.props.fixed).value;
185
+ }
186
+ });
187
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getProps", function () {
188
+ var props = (0, _helper.getObjectExclude)(_this.props, PROPS_KEYS);
189
+ return _objectSpread(_objectSpread({}, props), {}, {
190
+ type: 'text',
191
+ ref: _this.props.inputRef || null,
192
+ value: _this.getShowValue(),
193
+ onChange: _this.onChange,
194
+ onBlur: _this.onBlur
195
+ });
196
+ });
197
+ return _this;
198
+ }
199
+ (0, _createClass2["default"])(NumberInput, [{
200
+ key: "render",
201
+ value: function render() {
202
+ return /*#__PURE__*/_react["default"].createElement(_input["default"], this.getProps());
203
+ }
204
+ }]);
205
+ return NumberInput;
206
+ }(_react["default"].Component);
207
+ (0, _defineProperty2["default"])(NumberInput, "propTypes", PROPS);
208
+ var _default = exports["default"] = NumberInput;
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "NumberInput",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "main": "./NumberInput.js"
6
+ }