fan-standard-comp 3.0.13 → 3.0.16

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 (118) hide show
  1. package/Readme.md +0 -2
  2. package/dist/{f26952c118ab6cdcd23dc0028ee98c11.svg → e8686421bcdc3738ee1c41da9fa770d7.svg} +0 -0
  3. package/dist/fan-standard-comp.umd.js +16 -16
  4. package/es/ButtonGroup/ButtonList.js +36 -18
  5. package/es/ButtonGroup/ButtonMenu.js +27 -14
  6. package/es/ButtonGroup/PopConfirmTitle.js +16 -5
  7. package/es/ButtonGroup/index.js +131 -82
  8. package/es/DragContent/DragBar.js +18 -6
  9. package/es/DragContent/index.js +30 -12
  10. package/es/FormComp/ChunkUploader/api.js +21 -8
  11. package/es/FormComp/ChunkUploader/index.js +46 -27
  12. package/es/FormComp/ChunkUploader/lib.js +26 -9
  13. package/es/FormComp/ChunkUploader/upload-queue.class.js +12 -5
  14. package/es/FormComp/ChunkUploader/worker.js +7 -2
  15. package/es/FormComp/EditButton/index.js +35 -16
  16. package/es/FormComp/FieldComponent/ReUpload.js +38 -18
  17. package/es/FormComp/FieldComponent/RefactorTreeSelect.js +49 -26
  18. package/es/FormComp/FieldComponent/TitleNode.js +13 -3
  19. package/es/FormComp/FieldComponent/index.js +112 -72
  20. package/es/FormComp/FieldComponent/setReadonlyValues.js +55 -28
  21. package/es/FormComp/RenderItemGroup/index.d.ts +9 -1
  22. package/es/FormComp/RenderItemGroup/index.js +63 -36
  23. package/es/FormComp/Uploader/index.js +64 -38
  24. package/es/FormComp/Uploader/util.js +11 -2
  25. package/es/FormComp/VarTemplate/index.js +44 -31
  26. package/es/FormComp/index.js +15 -1
  27. package/es/NavLeafScroll/index.js +53 -35
  28. package/es/RefactorTree/index.js +52 -29
  29. package/es/RefactorTree/indexTreeNode.js +54 -31
  30. package/es/RefactorTree/style/index.js +3 -1
  31. package/es/RefactorTree/util.js +18 -10
  32. package/es/SpecIcon/fonts/iconfont.js +2 -0
  33. package/es/SpecIcon/index.js +30 -17
  34. package/es/SplitterLayout/Pane.js +17 -5
  35. package/es/SplitterLayout/index.js +24 -13
  36. package/es/StandardContent/SplitterLayout/Pane.js +25 -13
  37. package/es/StandardContent/SplitterLayout/index.js +43 -30
  38. package/es/StandardContent/SubfieldContent.js +28 -13
  39. package/es/StandardContent/WrapperContent.js +24 -10
  40. package/es/StandardFilter/index.js +46 -27
  41. package/es/StandardForm/ActionList.js +21 -8
  42. package/es/StandardForm/StepForm.d.ts +1 -1
  43. package/es/StandardForm/StepForm.js +72 -41
  44. package/es/StandardForm/TabForm.d.ts +1 -1
  45. package/es/StandardForm/TabForm.js +56 -27
  46. package/es/StandardForm/index.d.ts +3 -1
  47. package/es/StandardForm/index.js +57 -28
  48. package/es/StandardModal/UpdateFormRef.js +18 -4
  49. package/es/StandardModal/index.d.ts +1 -1
  50. package/es/StandardModal/index.js +106 -62
  51. package/es/StandardPanel/index.js +53 -32
  52. package/es/StandardTable/index.js +34 -17
  53. package/es/StandardTable/style/index.js +3 -1
  54. package/es/components/IconNode/index.js +17 -6
  55. package/es/components/index.js +15 -2
  56. package/es/data/func.code.js +9 -2
  57. package/es/data/general.config.js +9 -2
  58. package/es/data/index.js +23 -3
  59. package/es/index.js +229 -24
  60. package/es/utils/ValueFormat.js +9 -1
  61. package/es/utils/filterPermission.js +20 -4
  62. package/es/utils/getParentNodes.js +12 -1
  63. package/es/utils/index.js +35 -3
  64. package/lib/ButtonGroup/ButtonList.js +9 -9
  65. package/lib/ButtonGroup/ButtonMenu.js +11 -11
  66. package/lib/ButtonGroup/PopConfirmTitle.js +5 -5
  67. package/lib/ButtonGroup/index.js +75 -56
  68. package/lib/DragContent/DragBar.js +5 -5
  69. package/lib/DragContent/index.js +7 -7
  70. package/lib/FormComp/ChunkUploader/api.js +4 -4
  71. package/lib/FormComp/ChunkUploader/index.js +10 -10
  72. package/lib/FormComp/ChunkUploader/lib.js +2 -2
  73. package/lib/FormComp/ChunkUploader/upload-queue.class.js +2 -2
  74. package/lib/FormComp/ChunkUploader/worker.js +2 -2
  75. package/lib/FormComp/EditButton/index.js +10 -10
  76. package/lib/FormComp/FieldComponent/ReUpload.js +9 -9
  77. package/lib/FormComp/FieldComponent/RefactorTreeSelect.js +16 -16
  78. package/lib/FormComp/FieldComponent/TitleNode.js +4 -4
  79. package/lib/FormComp/FieldComponent/index.js +36 -36
  80. package/lib/FormComp/FieldComponent/setReadonlyValues.js +17 -17
  81. package/lib/FormComp/RenderItemGroup/index.d.ts +9 -1
  82. package/lib/FormComp/RenderItemGroup/index.js +30 -24
  83. package/lib/FormComp/Uploader/index.js +16 -16
  84. package/lib/FormComp/VarTemplate/index.js +23 -25
  85. package/lib/FormComp/index.js +2 -2
  86. package/lib/NavLeafScroll/index.js +28 -28
  87. package/lib/RefactorTree/index.js +14 -14
  88. package/lib/RefactorTree/indexTreeNode.js +19 -19
  89. package/lib/SpecIcon/index.js +13 -13
  90. package/lib/SplitterLayout/Pane.js +4 -4
  91. package/lib/SplitterLayout/index.js +10 -10
  92. package/lib/StandardContent/SplitterLayout/Pane.js +11 -11
  93. package/lib/StandardContent/SplitterLayout/index.js +27 -27
  94. package/lib/StandardContent/SubfieldContent.js +9 -9
  95. package/lib/StandardContent/WrapperContent.js +7 -7
  96. package/lib/StandardFilter/index.js +18 -18
  97. package/lib/StandardForm/ActionList.js +6 -6
  98. package/lib/StandardForm/StepForm.d.ts +1 -1
  99. package/lib/StandardForm/StepForm.js +30 -27
  100. package/lib/StandardForm/TabForm.d.ts +1 -1
  101. package/lib/StandardForm/TabForm.js +17 -14
  102. package/lib/StandardForm/index.d.ts +3 -1
  103. package/lib/StandardForm/index.js +17 -15
  104. package/lib/StandardModal/UpdateFormRef.js +4 -4
  105. package/lib/StandardModal/index.d.ts +1 -1
  106. package/lib/StandardModal/index.js +53 -39
  107. package/lib/StandardPanel/index.js +23 -23
  108. package/lib/StandardTable/index.js +8 -8
  109. package/lib/components/IconNode/index.js +6 -6
  110. package/lib/components/index.js +2 -2
  111. package/lib/data/func.code.js +2 -2
  112. package/lib/data/general.config.js +2 -2
  113. package/lib/data/index.js +3 -3
  114. package/lib/index.js +22 -22
  115. package/lib/utils/ValueFormat.js +2 -2
  116. package/lib/utils/filterPermission.js +2 -2
  117. package/lib/utils/index.js +2 -2
  118. package/package.json +1 -1
@@ -1,3 +1,24 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _classnames = _interopRequireDefault(require("classnames"));
13
+
14
+ var _DragBar = _interopRequireDefault(require("./DragBar"));
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
+
18
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
19
+
20
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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; }
21
+
1
22
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
23
 
3
24
  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,10 +31,6 @@ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(
10
31
 
11
32
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
33
 
13
- import React, { useEffect, useRef, useState } from 'react';
14
- import classNames from 'classnames';
15
- import DragBar from './DragBar';
16
-
17
34
  var DragContent = function DragContent(props) {
18
35
  var children = props.children,
19
36
  className = props.className,
@@ -26,19 +43,19 @@ var DragContent = function DragContent(props) {
26
43
  dragMouseDown = props.dragMouseDown,
27
44
  dragMouseMove = props.dragMouseMove,
28
45
  dragMouseUp = props.dragMouseUp;
29
- var divRef = useRef();
46
+ var divRef = (0, _react.useRef)();
30
47
 
31
- var _useState = useState(0),
48
+ var _useState = (0, _react.useState)(0),
32
49
  _useState2 = _slicedToArray(_useState, 2),
33
50
  targetWidth = _useState2[0],
34
51
  setTargetWidth = _useState2[1];
35
52
 
36
- var _useState3 = useState(0),
53
+ var _useState3 = (0, _react.useState)(0),
37
54
  _useState4 = _slicedToArray(_useState3, 2),
38
55
  targetHeight = _useState4[0],
39
56
  setTargetHeight = _useState4[1];
40
57
 
41
- useEffect(function () {
58
+ (0, _react.useEffect)(function () {
42
59
  setTargetWidth(divRef.current.offsetWidth);
43
60
  setTargetHeight(divRef.current.offsetHeight);
44
61
  }, []);
@@ -157,12 +174,12 @@ var DragContent = function DragContent(props) {
157
174
  };
158
175
  };
159
176
 
160
- return /*#__PURE__*/React.createElement("div", {
177
+ return /*#__PURE__*/_react["default"].createElement("div", {
161
178
  ref: divRef,
162
- className: classNames("spec-grid-dragContent", className),
179
+ className: (0, _classnames["default"])("spec-grid-dragContent", className),
163
180
  style: style
164
181
  }, children, direction && direction.map(function (item, idx) {
165
- return /*#__PURE__*/React.createElement(DragBar, {
182
+ return /*#__PURE__*/_react["default"].createElement(_DragBar["default"], {
166
183
  key: idx,
167
184
  direction: item,
168
185
  onMouseDown: onmousedown
@@ -170,4 +187,5 @@ var DragContent = function DragContent(props) {
170
187
  }));
171
188
  };
172
189
 
173
- export default DragContent;
190
+ var _default = DragContent;
191
+ exports["default"] = _default;
@@ -1,23 +1,34 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.queryFileInfo = queryFileInfo;
7
+ exports.uploadChunk = uploadChunk;
8
+ exports.lockChunk = lockChunk;
9
+
10
+ var _axios = _interopRequireDefault(require("axios"));
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
+
1
14
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
2
15
 
3
16
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
4
17
 
5
- import axios from 'axios';
6
18
  /**
7
19
  * 查询文件上传情况
8
20
  * @param {String} fileHash 文件内容Hash
9
21
  * @param {String} fileName 文件名
10
22
  * @param {Number} chunksLength 分片数量
11
23
  */
12
-
13
- export function queryFileInfo(_ref) {
24
+ function queryFileInfo(_ref) {
14
25
  var fileHash = _ref.fileHash,
15
26
  fileName = _ref.fileName,
16
27
  size = _ref.size,
17
28
  sizeStr = _ref.sizeStr,
18
29
  chunksLength = _ref.chunksLength;
19
30
  console.log('queryFileInfo ==> 查询文件上传情况');
20
- return axios.get('/getFileInfo', {
31
+ return _axios["default"].get('/getFileInfo', {
21
32
  params: {
22
33
  fileHash: fileHash,
23
34
  fileName: fileName,
@@ -37,18 +48,20 @@ export function queryFileInfo(_ref) {
37
48
  * @param {Blob} chunk 文件分片
38
49
  */
39
50
 
40
- export function uploadChunk(fileContentHash, chunkIndex, chunk) {
51
+
52
+ function uploadChunk(fileContentHash, chunkIndex, chunk) {
41
53
  var formData = new FormData();
42
54
  formData.append('fileContentHash', fileContentHash);
43
55
  formData.append('chunkIndex', chunkIndex);
44
56
  formData.append('chunk', chunk);
45
- return axios.post('/uploadChunk', formData).then(function (_ref3) {
57
+ return _axios["default"].post('/uploadChunk', formData).then(function (_ref3) {
46
58
  var result = _ref3.data;
47
59
  return result;
48
60
  });
49
61
  }
50
- export function lockChunk(fileHash, chunkIndex) {
51
- return axios.post('/lockChunk', {
62
+
63
+ function lockChunk(fileHash, chunkIndex) {
64
+ return _axios["default"].post('/lockChunk', {
52
65
  fileHash: fileHash,
53
66
  chunkIndex: chunkIndex
54
67
  }).then( /*#__PURE__*/function () {
@@ -1,3 +1,30 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = withUploader;
9
+
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _propTypes = _interopRequireDefault(require("prop-types"));
13
+
14
+ var _lib = require("./lib");
15
+
16
+ var _api = require("./api");
17
+
18
+ var _uploadQueue = _interopRequireDefault(require("./upload-queue.class"));
19
+
20
+ require("./style/style.less");
21
+
22
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
23
+
24
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
25
+
26
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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; }
27
+
1
28
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
2
29
 
3
30
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
@@ -32,23 +59,15 @@ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(
32
59
 
33
60
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
34
61
 
35
- /* eslint-disable no-unused-vars */
36
- import React, { useEffect, useState, useRef } from 'react';
37
- import PropTypes from 'prop-types';
38
- import { getComponentDisplayName, splitFileToChunks, calFileContentHash, bytesToSize, guid } from './lib';
39
- import { queryFileInfo } from './api';
40
- import UploadQueue from './upload-queue.class';
41
- import './style/style.less';
42
62
  /**
43
63
  * 初始化组件
44
64
  * @param {ReactComponent} component 本高阶组件
45
65
  * @param {ReactComponent} WrappedComponent 被包装的具体实现组件
46
66
  */
47
-
48
67
  function useComponentInit(component, WrappedComponent) {
49
68
  var intervalIDArr = [];
50
69
 
51
- var _useState = useState([]),
70
+ var _useState = (0, _react.useState)([]),
52
71
  _useState2 = _slicedToArray(_useState, 2),
53
72
  filesList = _useState2[0],
54
73
  setFilesList = _useState2[1]; // 定义管理上传的列表
@@ -56,7 +75,7 @@ function useComponentInit(component, WrappedComponent) {
56
75
  /* 定义上传队列,初始化就创建一个UploadQueue类实例 */
57
76
 
58
77
 
59
- var _useState3 = useState(new UploadQueue({
78
+ var _useState3 = (0, _react.useState)(new _uploadQueue["default"]({
60
79
  /* 设立一个定时器,定时(根据hash)查询文件是否上传完成(因为后端需要把所有分片合并起来,因此需要一定的时间) */
61
80
  fileFinishCb: function fileFinishCb(fileHash) {
62
81
  /* 查询文件是否上传完成;是的话则更新状态,渲染上传结果 */
@@ -79,7 +98,7 @@ function useComponentInit(component, WrappedComponent) {
79
98
  switch (_context3.prev = _context3.next) {
80
99
  case 0:
81
100
  _context3.next = 2;
82
- return queryFileInfo({
101
+ return (0, _api.queryFileInfo)({
83
102
  fileHash: fileHash
84
103
  });
85
104
 
@@ -172,23 +191,23 @@ function useComponentInit(component, WrappedComponent) {
172
191
  _useState4 = _slicedToArray(_useState3, 1),
173
192
  uploadQueue = _useState4[0];
174
193
 
175
- useEffect(function () {
194
+ (0, _react.useEffect)(function () {
176
195
  /* 定义displayName是为了在浏览器开发者工具里更好地显示高阶组件名称 */
177
- component.displayName = "withUploader(".concat(getComponentDisplayName(WrappedComponent), ")");
196
+ component.displayName = "withUploader(".concat((0, _lib.getComponentDisplayName)(WrappedComponent), ")");
178
197
  component.defaultProps = {
179
198
  perChunkSize: 1024 * 512,
180
199
  errorCb: function errorCb() {},
181
200
  finishCb: function finishCb() {}
182
201
  };
183
202
  component.propTypes = {
184
- perChunkSize: PropTypes.number,
185
- errorCb: PropTypes.func,
186
- finishCb: PropTypes.func
203
+ perChunkSize: _propTypes["default"].number,
204
+ errorCb: _propTypes["default"].func,
205
+ finishCb: _propTypes["default"].func
187
206
  };
188
207
  }, [component, WrappedComponent]);
189
208
  /* 清理所有定时器 */
190
209
 
191
- useEffect(function () {
210
+ (0, _react.useEffect)(function () {
192
211
  return function () {
193
212
  intervalIDArr.forEach(function (intervalID) {
194
213
  return clearInterval(intervalID);
@@ -209,13 +228,13 @@ function useComponentInit(component, WrappedComponent) {
209
228
 
210
229
  function initFilesListState(file) {
211
230
  var fileInfo = {
212
- hash: guid(),
231
+ hash: (0, _lib.guid)(),
213
232
  // 用uuid来假装hash
214
233
  fileName: file.name,
215
234
  status: 'init',
216
235
  publicPath: '',
217
236
  size: file.size,
218
- sizeStr: bytesToSize(file.size) // 转换当前字节数
237
+ sizeStr: (0, _lib.bytesToSize)(file.size) // 转换当前字节数
219
238
 
220
239
  };
221
240
  this.setFilesList([].concat(_toConsumableArray(this.filesList), [fileInfo]));
@@ -285,10 +304,10 @@ function returnFileInputChangeCb(_ref3) {
285
304
  file = event.target.files[0];
286
305
  currentFileInfo = initFilesListState.call(_this, file);
287
306
  console.log('当前已选择需要上传的文件', file);
288
- chunksArr = splitFileToChunks(file, perChunkSize); // 文件分片
307
+ chunksArr = (0, _lib.splitFileToChunks)(file, perChunkSize); // 文件分片
289
308
 
290
309
  _context4.next = 6;
291
- return calFileContentHash(chunksArr);
310
+ return (0, _lib.calFileContentHash)(chunksArr);
292
311
 
293
312
  case 6:
294
313
  fileContentHash = _context4.sent;
@@ -309,7 +328,7 @@ function returnFileInputChangeCb(_ref3) {
309
328
  /* 查询该文件上传情况 */
310
329
 
311
330
  _context4.next = 12;
312
- return queryFileInfo(_objectSpread(_objectSpread({}, currentFileInfo), {}, {
331
+ return (0, _api.queryFileInfo)(_objectSpread(_objectSpread({}, currentFileInfo), {}, {
313
332
  fileHash: fileContentHash,
314
333
  chunksLength: chunksArr.length
315
334
  }));
@@ -358,13 +377,13 @@ function returnFileInputChangeCb(_ref3) {
358
377
  */
359
378
 
360
379
 
361
- export default function withUploader(WrappedComponent) {
380
+ function withUploader(WrappedComponent) {
362
381
  return function UploaderHoc(props) {
363
382
  var perChunkSize = props.perChunkSize,
364
383
  errorCb = props.errorCb,
365
384
  restProps = _objectWithoutProperties(props, ["perChunkSize", "errorCb"]);
366
385
 
367
- var fileInputRef = useRef(null);
386
+ var fileInputRef = (0, _react.useRef)(null);
368
387
  var state = useComponentInit(UploaderHoc, WrappedComponent);
369
388
  /* 组装传给具体实现组件的props */
370
389
 
@@ -376,9 +395,9 @@ export default function withUploader(WrappedComponent) {
376
395
  filesList: state.filesList
377
396
  });
378
397
 
379
- return /*#__PURE__*/React.createElement("div", {
398
+ return /*#__PURE__*/_react["default"].createElement("div", {
380
399
  className: "upload-hoc"
381
- }, /*#__PURE__*/React.createElement("input", {
400
+ }, /*#__PURE__*/_react["default"].createElement("input", {
382
401
  ref: fileInputRef,
383
402
  type: "file",
384
403
  className: "upload-hoc_file-input",
@@ -386,6 +405,6 @@ export default function withUploader(WrappedComponent) {
386
405
  perChunkSize: perChunkSize,
387
406
  errorCb: errorCb
388
407
  })
389
- }), /*#__PURE__*/React.createElement(WrappedComponent, spreadProps));
408
+ }), /*#__PURE__*/_react["default"].createElement(WrappedComponent, spreadProps));
390
409
  };
391
410
  }
@@ -1,16 +1,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getComponentDisplayName = getComponentDisplayName;
7
+ exports.splitFileToChunks = splitFileToChunks;
8
+ exports.calFileContentHash = calFileContentHash;
9
+ exports.bytesToSize = bytesToSize;
10
+ exports.guid = guid;
11
+
12
+ var _worker = _interopRequireDefault(require("worker-loader!./worker.js"));
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
+
1
16
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
2
17
 
3
18
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
4
19
 
5
- // eslint-disable-next-line import/no-webpack-loader-syntax
6
- import Worker from 'worker-loader!./worker.js'; // 启动 Web Worker
20
+ // 启动 Web Worker
7
21
 
8
22
  /**
9
23
  * 获取组件名称
10
24
  * @param {ReactComponent} component
11
25
  */
12
-
13
- export function getComponentDisplayName(component) {
26
+ function getComponentDisplayName(component) {
14
27
  return component.displayName || component.name || 'Component';
15
28
  }
16
29
  /**
@@ -18,7 +31,8 @@ export function getComponentDisplayName(component) {
18
31
  * @param {File} file 文件
19
32
  */
20
33
 
21
- export function splitFileToChunks(file, perChunkSize) {
34
+
35
+ function splitFileToChunks(file, perChunkSize) {
22
36
  var fileSize = file.size;
23
37
  var total = Math.ceil(fileSize / perChunkSize); // 计算总共要分多少片
24
38
 
@@ -36,7 +50,8 @@ export function splitFileToChunks(file, perChunkSize) {
36
50
  * @param {File} file 文件
37
51
  */
38
52
 
39
- export function calFileContentHash(_x) {
53
+
54
+ function calFileContentHash(_x) {
40
55
  return _calFileContentHash.apply(this, arguments);
41
56
  }
42
57
  /**
@@ -45,6 +60,7 @@ export function calFileContentHash(_x) {
45
60
  * @param {Number} precise 小数精度
46
61
  */
47
62
 
63
+
48
64
  function _calFileContentHash() {
49
65
  _calFileContentHash = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(chunksArr) {
50
66
  var worker;
@@ -52,7 +68,7 @@ function _calFileContentHash() {
52
68
  while (1) {
53
69
  switch (_context.prev = _context.next) {
54
70
  case 0:
55
- worker = new Worker();
71
+ worker = new _worker["default"]();
56
72
  worker.postMessage({
57
73
  chunksArr: chunksArr
58
74
  }); // 传递文件分片
@@ -75,7 +91,7 @@ function _calFileContentHash() {
75
91
  return _calFileContentHash.apply(this, arguments);
76
92
  }
77
93
 
78
- export function bytesToSize(bytes) {
94
+ function bytesToSize(bytes) {
79
95
  var precise = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
80
96
  if (bytes === 0) return '0 B';
81
97
  var k = 1024,
@@ -87,7 +103,8 @@ export function bytesToSize(bytes) {
87
103
  * 生成guid
88
104
  */
89
105
 
90
- export function guid() {
106
+
107
+ function guid() {
91
108
  function S4() {
92
109
  return ((1 + Math.random()) * 0x10000 | 0).toString(16).substring(1);
93
110
  }
@@ -1,3 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _api = require("./api");
9
+
1
10
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
2
11
 
3
12
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
@@ -22,8 +31,6 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
22
31
 
23
32
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
24
33
 
25
- import { lockChunk, uploadChunk } from './api';
26
-
27
34
  var UploadQueue = /*#__PURE__*/function () {
28
35
  // 上传任务队列存储
29
36
  // 是否正在上传
@@ -115,7 +122,7 @@ var UploadQueue = /*#__PURE__*/function () {
115
122
  /* 给分片加锁,避免多个客户端上传同一个分片 */
116
123
 
117
124
  _context.next = 7;
118
- return lockChunk(fileHash, chunkIndex);
125
+ return (0, _api.lockChunk)(fileHash, chunkIndex);
119
126
 
120
127
  case 7:
121
128
  lockResult = _context.sent;
@@ -126,7 +133,7 @@ var UploadQueue = /*#__PURE__*/function () {
126
133
  }
127
134
 
128
135
  _context.next = 11;
129
- return uploadChunk(fileHash, chunkIndex, chunk);
136
+ return (0, _api.uploadChunk)(fileHash, chunkIndex, chunk);
130
137
 
131
138
  case 11:
132
139
  console.log('请求接口uploadChunk=>上传分片文件,执行任务数递减', this.tasksSizePerFile);
@@ -164,4 +171,4 @@ var UploadQueue = /*#__PURE__*/function () {
164
171
  return UploadQueue;
165
172
  }();
166
173
 
167
- export { UploadQueue as default };
174
+ exports["default"] = UploadQueue;
@@ -1,10 +1,15 @@
1
+ "use strict";
2
+
3
+ var _sparkMd = _interopRequireDefault(require("spark-md5"));
4
+
5
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
6
+
1
7
  /* eslint-disable no-restricted-globals */
2
- import SparkMD5 from 'spark-md5';
3
8
  self.addEventListener('message', function (e) {
4
9
  var chunksArr = e.data.chunksArr; // 收到主线程传递来的文件分片
5
10
 
6
11
  console.log('监听\'message\'收到主线程传递来的文件分片', chunksArr);
7
- var spark = new SparkMD5.ArrayBuffer();
12
+ var spark = new _sparkMd["default"].ArrayBuffer();
8
13
  var fileReader = new FileReader();
9
14
  fileReader.readAsArrayBuffer(chunksArr.pop());
10
15
  console.log('创建文件读取', fileReader);
@@ -1,9 +1,31 @@
1
+ "use strict";
2
+
1
3
  function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2
4
 
3
- import "antd/es/button/style";
4
- import _Button from "antd/es/button";
5
- import "antd/es/input/style";
6
- import _Input from "antd/es/input";
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ require("antd/es/button/style");
11
+
12
+ var _button = _interopRequireDefault(require("antd/es/button"));
13
+
14
+ require("antd/es/input/style");
15
+
16
+ var _input = _interopRequireDefault(require("antd/es/input"));
17
+
18
+ var _react = _interopRequireWildcard(require("react"));
19
+
20
+ var _classnames = _interopRequireDefault(require("classnames"));
21
+
22
+ var _icons = require("@ant-design/icons");
23
+
24
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
25
+
26
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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; }
27
+
28
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
7
29
 
8
30
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9
31
 
@@ -21,14 +43,10 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
21
43
 
22
44
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
23
45
 
24
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
46
+ 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; } }
25
47
 
26
48
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
27
49
 
28
- import React, { Component } from 'react';
29
- import classNames from 'classnames';
30
- import { PlusOutlined } from '@ant-design/icons';
31
-
32
50
  var EditButton = /*#__PURE__*/function (_Component) {
33
51
  _inherits(EditButton, _Component);
34
52
 
@@ -90,7 +108,7 @@ var EditButton = /*#__PURE__*/function (_Component) {
90
108
  size = _this$props2$size === void 0 ? 'middle' : _this$props2$size,
91
109
  label = _this$props2.label,
92
110
  _this$props2$icon = _this$props2.icon,
93
- icon = _this$props2$icon === void 0 ? /*#__PURE__*/React.createElement(PlusOutlined, null) : _this$props2$icon,
111
+ icon = _this$props2$icon === void 0 ? /*#__PURE__*/_react["default"].createElement(_icons.PlusOutlined, null) : _this$props2$icon,
94
112
  style = _this$props2.style,
95
113
  className = _this$props2.className,
96
114
  disabled = _this$props2.disabled,
@@ -99,14 +117,14 @@ var EditButton = /*#__PURE__*/function (_Component) {
99
117
  var _this$state = this.state,
100
118
  inputValue = _this$state.inputValue,
101
119
  inputVisible = _this$state.inputVisible;
102
- return /*#__PURE__*/React.createElement("span", {
120
+ return /*#__PURE__*/_react["default"].createElement("span", {
103
121
  style: Object.assign({
104
122
  display: 'inline-block',
105
123
  width: "".concat(width, "px"),
106
124
  verticalAlign: 'middle'
107
125
  }, style),
108
- className: classNames(className, 'spec-edit-button')
109
- }, inputVisible ? /*#__PURE__*/React.createElement(_Input, {
126
+ className: (0, _classnames["default"])(className, 'spec-edit-button')
127
+ }, inputVisible ? /*#__PURE__*/_react["default"].createElement(_input["default"], {
110
128
  ref: this.saveInputRef,
111
129
  type: "text",
112
130
  size: size,
@@ -121,7 +139,7 @@ var EditButton = /*#__PURE__*/function (_Component) {
121
139
  onPressEnter: function onPressEnter() {
122
140
  return _this2.handleInputConfirm();
123
141
  }
124
- }) : /*#__PURE__*/React.createElement(_Button, {
142
+ }) : /*#__PURE__*/_react["default"].createElement(_button["default"], {
125
143
  disabled: disabled,
126
144
  icon: icon,
127
145
  size: size,
@@ -135,6 +153,7 @@ var EditButton = /*#__PURE__*/function (_Component) {
135
153
  }]);
136
154
 
137
155
  return EditButton;
138
- }(Component);
156
+ }(_react.Component);
139
157
 
140
- export default EditButton;
158
+ var _default = EditButton;
159
+ exports["default"] = _default;