fan-standard-comp 3.1.9 → 3.2.0
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.
- package/Readme.md +35 -0
- package/dist/fan-standard-comp.umd.js +15 -10
- package/es/ButtonGroup/ButtonList.js +0 -3
- package/es/ButtonGroup/ButtonMenu.js +0 -3
- package/es/ButtonGroup/PopConfirmTitle.js +5 -15
- package/es/ButtonGroup/index.d.ts +2 -0
- package/es/ButtonGroup/index.js +223 -193
- package/es/ButtonGroup/style/index.less +1 -1
- package/es/DragContent/DragBar.js +2 -6
- package/es/DragContent/index.js +44 -75
- package/es/FormComp/ChunkUploader/api.js +6 -10
- package/es/FormComp/ChunkUploader/index.js +105 -171
- package/es/FormComp/ChunkUploader/lib.js +4 -17
- package/es/FormComp/ChunkUploader/upload-queue.class.js +10 -45
- package/es/FormComp/ChunkUploader/worker.js +0 -3
- package/es/FormComp/EditButton/index.js +24 -49
- package/es/FormComp/FieldComponent/ReUpload.js +18 -38
- package/es/FormComp/FieldComponent/RefactorTreeSelect.js +37 -75
- package/es/FormComp/FieldComponent/TitleNode.js +1 -3
- package/es/FormComp/FieldComponent/index.js +38 -74
- package/es/FormComp/FieldComponent/setReadonlyValues.js +34 -63
- package/es/FormComp/FieldComponent/style/index.less +6 -0
- package/es/FormComp/RenderItemGroup/index.js +46 -74
- package/es/FormComp/Uploader/index.js +36 -77
- package/es/FormComp/Uploader/util.js +0 -6
- package/es/FormComp/VarTemplate/index.js +58 -96
- package/es/NavLeafScroll/index.js +172 -154
- package/es/NavLeafScroll/style/index.less +33 -1
- package/es/RefactorTree/index.js +36 -53
- package/es/RefactorTree/indexTreeNode.js +35 -68
- package/es/RefactorTree/util.js +9 -43
- package/es/SpecIcon/fonts/iconfont.js +7 -12
- package/es/SpecIcon/index.js +16 -25
- package/es/SplitterLayout/Pane.js +2 -5
- package/es/SplitterLayout/index.js +20 -70
- package/es/StandardContent/SplitterLayout/Pane.js +6 -10
- package/es/StandardContent/SplitterLayout/index.js +12 -63
- package/es/StandardContent/SubfieldContent.js +12 -14
- package/es/StandardContent/WrapperContent.js +8 -10
- package/es/StandardDragModal/ChangeStandardModal.d.ts +44 -0
- package/es/StandardDragModal/ChangeStandardModal.js +493 -0
- package/es/StandardDragModal/DraggableModal.d.ts +7 -0
- package/es/StandardDragModal/DraggableModal.js +31 -0
- package/es/StandardDragModal/DraggableModalContext.d.ts +9 -0
- package/es/StandardDragModal/DraggableModalContext.js +5 -0
- package/es/StandardDragModal/DraggableModalInner.d.ts +16 -0
- package/es/StandardDragModal/DraggableModalInner.js +114 -0
- package/es/StandardDragModal/DraggableModalProvider.d.ts +4 -0
- package/es/StandardDragModal/DraggableModalProvider.js +40 -0
- package/es/StandardDragModal/Modal.d.ts +11 -0
- package/es/StandardDragModal/Modal.js +24 -0
- package/es/StandardDragModal/ResizeHandle.d.ts +2 -0
- package/es/StandardDragModal/ResizeHandle.js +8 -0
- package/es/StandardDragModal/clamp.d.ts +1 -0
- package/es/StandardDragModal/clamp.js +3 -0
- package/es/StandardDragModal/draggableModalReducer.d.ts +66 -0
- package/es/StandardDragModal/draggableModalReducer.js +157 -0
- package/es/StandardDragModal/getWindowSize.d.ts +4 -0
- package/es/StandardDragModal/getWindowSize.js +6 -0
- package/es/StandardDragModal/index.d.ts +3 -11
- package/es/StandardDragModal/index.js +3 -30
- package/es/StandardDragModal/index.less +65 -0
- package/es/StandardDragModal/useDrag.d.ts +5 -0
- package/es/StandardDragModal/useDrag.js +66 -0
- package/es/StandardDragModal/usePrevious.d.ts +1 -0
- package/es/StandardDragModal/usePrevious.js +8 -0
- package/es/StandardDragModal/useResize.d.ts +7 -0
- package/es/StandardDragModal/useResize.js +74 -0
- package/es/StandardFilter/index.d.ts +1 -0
- package/es/StandardFilter/index.js +32 -70
- package/es/StandardForm/ActionList.js +5 -7
- package/es/StandardForm/StepForm.js +50 -71
- package/es/StandardForm/TabForm.js +58 -70
- package/es/StandardForm/index.js +37 -56
- package/es/StandardModal/UpdateFormRef.js +1 -4
- package/es/StandardModal/index.d.ts +0 -1
- package/es/StandardModal/index.js +115 -159
- package/es/StandardPanel/index.js +19 -35
- package/es/StandardTable/index.js +20 -30
- package/es/components/IconNode/index.js +0 -4
- package/es/index.d.ts +1 -0
- package/es/index.js +15 -14
- package/es/utils/ValueFormat.js +0 -9
- package/es/utils/dictSelectUtil.js +153 -0
- package/es/utils/filterPermission.js +16 -34
- package/es/utils/getParentNodes.js +24 -47
- package/es/utils/index.js +2 -1
- package/lib/ButtonGroup/ButtonList.js +1 -13
- package/lib/ButtonGroup/ButtonMenu.js +1 -8
- package/lib/ButtonGroup/PopConfirmTitle.js +3 -16
- package/lib/ButtonGroup/index.d.ts +2 -0
- package/lib/ButtonGroup/index.js +226 -216
- package/lib/ButtonGroup/style/index.less +1 -1
- package/lib/DragContent/DragBar.js +2 -10
- package/lib/DragContent/index.js +47 -85
- package/lib/FormComp/ChunkUploader/api.js +6 -15
- package/lib/FormComp/ChunkUploader/index.js +107 -185
- package/lib/FormComp/ChunkUploader/lib.js +8 -27
- package/lib/FormComp/ChunkUploader/upload-queue.class.js +10 -46
- package/lib/FormComp/ChunkUploader/worker.js +1 -5
- package/lib/FormComp/EditButton/index.js +26 -60
- package/lib/FormComp/FieldComponent/ReUpload.js +21 -50
- package/lib/FormComp/FieldComponent/RefactorTreeSelect.js +39 -90
- package/lib/FormComp/FieldComponent/TitleNode.js +1 -5
- package/lib/FormComp/FieldComponent/index.js +38 -110
- package/lib/FormComp/FieldComponent/setReadonlyValues.js +37 -79
- package/lib/FormComp/FieldComponent/style/index.less +6 -0
- package/lib/FormComp/RenderItemGroup/index.js +46 -87
- package/lib/FormComp/Uploader/index.js +38 -95
- package/lib/FormComp/Uploader/util.js +1 -9
- package/lib/FormComp/VarTemplate/index.js +62 -106
- package/lib/FormComp/index.js +0 -2
- package/lib/NavLeafScroll/index.js +174 -165
- package/lib/NavLeafScroll/style/index.less +33 -1
- package/lib/RefactorTree/index.js +36 -67
- package/lib/RefactorTree/indexTreeNode.js +37 -83
- package/lib/RefactorTree/util.js +11 -45
- package/lib/SpecIcon/fonts/iconfont.js +7 -12
- package/lib/SpecIcon/index.js +16 -30
- package/lib/SplitterLayout/Pane.js +0 -7
- package/lib/SplitterLayout/index.js +18 -72
- package/lib/StandardContent/SplitterLayout/Pane.js +6 -14
- package/lib/StandardContent/SplitterLayout/index.js +12 -68
- package/lib/StandardContent/SubfieldContent.js +12 -21
- package/lib/StandardContent/WrapperContent.js +8 -16
- package/lib/StandardDragModal/ChangeStandardModal.d.ts +44 -0
- package/lib/StandardDragModal/ChangeStandardModal.js +502 -0
- package/lib/StandardDragModal/DraggableModal.d.ts +7 -0
- package/lib/StandardDragModal/DraggableModal.js +40 -0
- package/lib/StandardDragModal/DraggableModalContext.d.ts +9 -0
- package/lib/StandardDragModal/DraggableModalContext.js +15 -0
- package/lib/StandardDragModal/DraggableModalInner.d.ts +16 -0
- package/lib/StandardDragModal/DraggableModalInner.js +124 -0
- package/lib/StandardDragModal/DraggableModalProvider.d.ts +4 -0
- package/lib/StandardDragModal/DraggableModalProvider.js +48 -0
- package/lib/StandardDragModal/Modal.d.ts +11 -0
- package/lib/StandardDragModal/Modal.js +32 -0
- package/lib/StandardDragModal/ResizeHandle.d.ts +2 -0
- package/lib/StandardDragModal/ResizeHandle.js +18 -0
- package/lib/StandardDragModal/clamp.d.ts +1 -0
- package/lib/StandardDragModal/clamp.js +10 -0
- package/lib/StandardDragModal/draggableModalReducer.d.ts +66 -0
- package/lib/StandardDragModal/draggableModalReducer.js +167 -0
- package/lib/StandardDragModal/getWindowSize.d.ts +4 -0
- package/lib/StandardDragModal/getWindowSize.js +13 -0
- package/lib/StandardDragModal/index.d.ts +3 -11
- package/lib/StandardDragModal/index.js +33 -38
- package/lib/StandardDragModal/index.less +65 -0
- package/lib/StandardDragModal/useDrag.d.ts +5 -0
- package/lib/StandardDragModal/useDrag.js +73 -0
- package/lib/StandardDragModal/usePrevious.d.ts +1 -0
- package/lib/StandardDragModal/usePrevious.js +15 -0
- package/lib/StandardDragModal/useResize.d.ts +7 -0
- package/lib/StandardDragModal/useResize.js +81 -0
- package/lib/StandardFilter/index.d.ts +1 -0
- package/lib/StandardFilter/index.js +30 -78
- package/lib/StandardForm/ActionList.js +5 -12
- package/lib/StandardForm/StepForm.js +52 -90
- package/lib/StandardForm/TabForm.js +61 -88
- package/lib/StandardForm/index.js +40 -75
- package/lib/StandardModal/UpdateFormRef.js +4 -12
- package/lib/StandardModal/index.d.ts +0 -1
- package/lib/StandardModal/index.js +117 -184
- package/lib/StandardPanel/index.js +22 -48
- package/lib/StandardTable/index.js +20 -39
- package/lib/components/IconNode/index.js +0 -7
- package/lib/components/index.js +0 -2
- package/lib/data/index.js +4 -7
- package/lib/index.d.ts +1 -0
- package/lib/index.js +50 -68
- package/lib/utils/ValueFormat.js +0 -10
- package/lib/utils/dictSelectUtil.js +161 -0
- package/lib/utils/filterPermission.js +15 -39
- package/lib/utils/getParentNodes.js +25 -52
- package/lib/utils/index.js +24 -9
- package/package.json +6 -5
|
@@ -1,59 +1,44 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
1
2
|
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
|
-
|
|
3
3
|
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
|
-
|
|
5
4
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
6
|
-
|
|
7
5
|
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."); }
|
|
8
|
-
|
|
9
6
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
-
|
|
11
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
|
12
|
-
|
|
7
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
13
8
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
14
|
-
|
|
15
9
|
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; }
|
|
16
|
-
|
|
17
10
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
18
|
-
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
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
|
-
|
|
11
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
12
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
13
|
+
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; }
|
|
14
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
15
|
+
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); }
|
|
25
16
|
import { lockChunk, uploadChunk } from './api';
|
|
26
|
-
|
|
27
17
|
var UploadQueue = /*#__PURE__*/function () {
|
|
28
18
|
// 上传任务队列存储
|
|
29
19
|
// 是否正在上传
|
|
30
20
|
// 记录每个文件还剩下多少上传任务,作为判断文件是否完成上传的依据
|
|
21
|
+
|
|
31
22
|
// 文件完成上传的回调函数
|
|
23
|
+
|
|
32
24
|
function UploadQueue(_ref) {
|
|
33
25
|
var fileFinishCb = _ref.fileFinishCb;
|
|
34
|
-
|
|
35
26
|
_classCallCheck(this, UploadQueue);
|
|
36
|
-
|
|
37
27
|
_defineProperty(this, "uploadQueue", []);
|
|
38
|
-
|
|
39
28
|
_defineProperty(this, "isUploading", false);
|
|
40
|
-
|
|
41
29
|
_defineProperty(this, "tasksSizePerFile", {});
|
|
42
|
-
|
|
43
30
|
_defineProperty(this, "fileFinishCb", function () {});
|
|
44
|
-
|
|
45
31
|
if (!!fileFinishCb && typeof fileFinishCb === 'function') {
|
|
46
32
|
this.fileFinishCb = fileFinishCb;
|
|
47
33
|
}
|
|
48
34
|
}
|
|
35
|
+
|
|
49
36
|
/**
|
|
50
37
|
* 建立上传队列,规则:
|
|
51
38
|
* 找出服务端记录里当前该文件所有状态为'wait'的文件分片
|
|
52
39
|
* @param {Object} fileInfo 文件上传情况
|
|
53
40
|
* @param {Array} chunksArr 分片数组
|
|
54
41
|
*/
|
|
55
|
-
|
|
56
|
-
|
|
57
42
|
_createClass(UploadQueue, [{
|
|
58
43
|
key: "addChunksToQueue",
|
|
59
44
|
value: function addChunksToQueue(fileInfo, chunksArr) {
|
|
@@ -68,7 +53,6 @@ var UploadQueue = /*#__PURE__*/function () {
|
|
|
68
53
|
};
|
|
69
54
|
});
|
|
70
55
|
/* 添加上传任务到队列中 */
|
|
71
|
-
|
|
72
56
|
if (newTasks.length > 0) {
|
|
73
57
|
this.uploadQueue = [].concat(_toConsumableArray(this.uploadQueue), _toConsumableArray(newTasks));
|
|
74
58
|
this.tasksSizePerFile[newTasks[0].hash] = newTasks.length; // 记录当前文件有多少个上传任务
|
|
@@ -77,7 +61,6 @@ var UploadQueue = /*#__PURE__*/function () {
|
|
|
77
61
|
/**
|
|
78
62
|
* 触发上传
|
|
79
63
|
*/
|
|
80
|
-
|
|
81
64
|
}, {
|
|
82
65
|
key: "run",
|
|
83
66
|
value: function run() {
|
|
@@ -89,13 +72,11 @@ var UploadQueue = /*#__PURE__*/function () {
|
|
|
89
72
|
/**
|
|
90
73
|
* 上传下一个分片
|
|
91
74
|
*/
|
|
92
|
-
|
|
93
75
|
}, {
|
|
94
76
|
key: "uploadNext",
|
|
95
77
|
value: function () {
|
|
96
78
|
var _uploadNext = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
97
79
|
var _this$uploadQueue$shi, chunkIndex, chunk, fileHash, lockResult;
|
|
98
|
-
|
|
99
80
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
100
81
|
while (1) {
|
|
101
82
|
switch (_context.prev = _context.next) {
|
|
@@ -104,47 +85,35 @@ var UploadQueue = /*#__PURE__*/function () {
|
|
|
104
85
|
_context.next = 3;
|
|
105
86
|
break;
|
|
106
87
|
}
|
|
107
|
-
|
|
108
88
|
this.isUploading = false;
|
|
109
89
|
return _context.abrupt("return");
|
|
110
|
-
|
|
111
90
|
case 3:
|
|
112
91
|
_this$uploadQueue$shi = this.uploadQueue.shift(), chunkIndex = _this$uploadQueue$shi.index, chunk = _this$uploadQueue$shi.chunk, fileHash = _this$uploadQueue$shi.hash; // 从上传队列里取出一个上传任务
|
|
113
|
-
|
|
114
92
|
console.log('请求接口lockChunk=>给分片加锁,避免多个客户端上传同一个分片');
|
|
115
93
|
/* 给分片加锁,避免多个客户端上传同一个分片 */
|
|
116
|
-
|
|
117
94
|
_context.next = 7;
|
|
118
95
|
return lockChunk(fileHash, chunkIndex);
|
|
119
|
-
|
|
120
96
|
case 7:
|
|
121
97
|
lockResult = _context.sent;
|
|
122
|
-
|
|
123
98
|
if (!lockResult) {
|
|
124
99
|
_context.next = 16;
|
|
125
100
|
break;
|
|
126
101
|
}
|
|
127
|
-
|
|
128
102
|
_context.next = 11;
|
|
129
103
|
return uploadChunk(fileHash, chunkIndex, chunk);
|
|
130
|
-
|
|
131
104
|
case 11:
|
|
132
105
|
console.log('请求接口uploadChunk=>上传分片文件,执行任务数递减', this.tasksSizePerFile);
|
|
133
106
|
/* 判断该文件的所有分片是否都上传完(任务数递减为0时) */
|
|
134
|
-
|
|
135
107
|
if (--this.tasksSizePerFile[fileHash] === 0) {
|
|
136
108
|
this.fileFinishCb(fileHash);
|
|
137
109
|
console.log('fileFinishCb=>该文件的所有分片已都上传完');
|
|
138
110
|
}
|
|
139
|
-
|
|
140
111
|
this.uploadNext();
|
|
141
112
|
_context.next = 17;
|
|
142
113
|
break;
|
|
143
|
-
|
|
144
114
|
case 16:
|
|
145
115
|
// 加锁失败,表示已有另一个客户端上传此分片,因此丢弃当前上传任务
|
|
146
116
|
this.uploadNext();
|
|
147
|
-
|
|
148
117
|
case 17:
|
|
149
118
|
case "end":
|
|
150
119
|
return _context.stop();
|
|
@@ -152,16 +121,12 @@ var UploadQueue = /*#__PURE__*/function () {
|
|
|
152
121
|
}
|
|
153
122
|
}, _callee, this);
|
|
154
123
|
}));
|
|
155
|
-
|
|
156
124
|
function uploadNext() {
|
|
157
125
|
return _uploadNext.apply(this, arguments);
|
|
158
126
|
}
|
|
159
|
-
|
|
160
127
|
return uploadNext;
|
|
161
128
|
}()
|
|
162
129
|
}]);
|
|
163
|
-
|
|
164
130
|
return UploadQueue;
|
|
165
131
|
}();
|
|
166
|
-
|
|
167
132
|
export { UploadQueue as default };
|
|
@@ -2,16 +2,13 @@
|
|
|
2
2
|
import SparkMD5 from 'spark-md5';
|
|
3
3
|
self.addEventListener('message', function (e) {
|
|
4
4
|
var chunksArr = e.data.chunksArr; // 收到主线程传递来的文件分片
|
|
5
|
-
|
|
6
5
|
console.log('监听\'message\'收到主线程传递来的文件分片', chunksArr);
|
|
7
6
|
var spark = new SparkMD5.ArrayBuffer();
|
|
8
7
|
var fileReader = new FileReader();
|
|
9
8
|
fileReader.readAsArrayBuffer(chunksArr.pop());
|
|
10
9
|
console.log('创建文件读取', fileReader);
|
|
11
|
-
|
|
12
10
|
fileReader.onload = function (e) {
|
|
13
11
|
spark.append(e.target.result);
|
|
14
|
-
|
|
15
12
|
if (chunksArr.length === 0) {
|
|
16
13
|
self.postMessage({
|
|
17
14
|
hash: spark.end()
|
|
@@ -1,46 +1,30 @@
|
|
|
1
|
-
function _typeof(
|
|
2
|
-
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
2
|
import "antd/es/button/style";
|
|
4
3
|
import _Button from "antd/es/button";
|
|
5
4
|
import "antd/es/input/style";
|
|
6
5
|
import _Input from "antd/es/input";
|
|
7
|
-
|
|
8
6
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
|
-
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
17
|
-
|
|
7
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
8
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
9
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
10
|
+
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); }
|
|
11
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
12
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
18
13
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
19
|
-
|
|
20
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
21
|
-
|
|
14
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
22
15
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
27
|
-
|
|
16
|
+
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; } }
|
|
17
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
28
18
|
import React, { Component } from 'react';
|
|
29
19
|
import classNames from 'classnames';
|
|
30
20
|
import { PlusOutlined } from '@ant-design/icons';
|
|
31
|
-
|
|
32
21
|
var EditButton = /*#__PURE__*/function (_Component) {
|
|
33
22
|
_inherits(EditButton, _Component);
|
|
34
|
-
|
|
35
23
|
var _super = _createSuper(EditButton);
|
|
36
|
-
|
|
37
24
|
function EditButton(props) {
|
|
38
25
|
var _this;
|
|
39
|
-
|
|
40
26
|
_classCallCheck(this, EditButton);
|
|
41
|
-
|
|
42
27
|
_this = _super.call(this, props);
|
|
43
|
-
|
|
44
28
|
_this.handleClick = function () {
|
|
45
29
|
_this.setState({
|
|
46
30
|
inputVisible: true
|
|
@@ -48,57 +32,50 @@ var EditButton = /*#__PURE__*/function (_Component) {
|
|
|
48
32
|
return _this.input.focus();
|
|
49
33
|
});
|
|
50
34
|
};
|
|
51
|
-
|
|
52
35
|
_this.saveInputRef = function (input) {
|
|
53
36
|
_this.input = input;
|
|
54
37
|
};
|
|
55
|
-
|
|
56
38
|
_this.handleInputChange = function (e) {
|
|
57
39
|
_this.setState({
|
|
58
40
|
inputValue: e.target.value
|
|
59
41
|
});
|
|
60
42
|
};
|
|
61
|
-
|
|
62
43
|
_this.handleInputConfirm = function () {
|
|
63
44
|
var _this$props = _this.props,
|
|
64
|
-
|
|
65
|
-
|
|
45
|
+
onSave = _this$props.onSave,
|
|
46
|
+
onChange = _this$props.onChange;
|
|
66
47
|
var inputValue = _this.state.inputValue;
|
|
67
48
|
if (onSave) onSave(inputValue);
|
|
68
49
|
if (onChange) onChange(inputValue);
|
|
69
|
-
|
|
70
50
|
_this.setState({
|
|
71
51
|
inputVisible: false,
|
|
72
52
|
inputValue: ''
|
|
73
53
|
});
|
|
74
54
|
};
|
|
75
|
-
|
|
76
55
|
_this.state = {
|
|
77
56
|
inputValue: '',
|
|
78
57
|
inputVisible: false
|
|
79
58
|
};
|
|
80
59
|
return _this;
|
|
81
60
|
}
|
|
82
|
-
|
|
83
61
|
_createClass(EditButton, [{
|
|
84
62
|
key: "render",
|
|
85
63
|
value: function render() {
|
|
86
64
|
var _this2 = this;
|
|
87
|
-
|
|
88
65
|
var _this$props2 = this.props,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
66
|
+
_this$props2$size = _this$props2.size,
|
|
67
|
+
size = _this$props2$size === void 0 ? 'middle' : _this$props2$size,
|
|
68
|
+
label = _this$props2.label,
|
|
69
|
+
_this$props2$icon = _this$props2.icon,
|
|
70
|
+
icon = _this$props2$icon === void 0 ? /*#__PURE__*/React.createElement(PlusOutlined, null) : _this$props2$icon,
|
|
71
|
+
style = _this$props2.style,
|
|
72
|
+
className = _this$props2.className,
|
|
73
|
+
disabled = _this$props2.disabled,
|
|
74
|
+
_this$props2$width = _this$props2.width,
|
|
75
|
+
width = _this$props2$width === void 0 ? 106 : _this$props2$width;
|
|
99
76
|
var _this$state = this.state,
|
|
100
|
-
|
|
101
|
-
|
|
77
|
+
inputValue = _this$state.inputValue,
|
|
78
|
+
inputVisible = _this$state.inputVisible;
|
|
102
79
|
return /*#__PURE__*/React.createElement("span", {
|
|
103
80
|
style: Object.assign({
|
|
104
81
|
display: 'inline-block',
|
|
@@ -133,8 +110,6 @@ var EditButton = /*#__PURE__*/function (_Component) {
|
|
|
133
110
|
}, label));
|
|
134
111
|
}
|
|
135
112
|
}]);
|
|
136
|
-
|
|
137
113
|
return EditButton;
|
|
138
114
|
}(Component);
|
|
139
|
-
|
|
140
115
|
export default EditButton;
|
|
@@ -1,63 +1,48 @@
|
|
|
1
1
|
import "antd/es/upload/style";
|
|
2
2
|
import _Upload from "antd/es/upload";
|
|
3
|
-
|
|
4
3
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
5
|
-
|
|
6
4
|
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."); }
|
|
7
|
-
|
|
8
5
|
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); }
|
|
9
|
-
|
|
10
6
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
11
|
-
|
|
12
|
-
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
13
|
-
|
|
7
|
+
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; } }
|
|
14
8
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
|
-
|
|
16
9
|
import { __awaiter, __rest } from "tslib";
|
|
17
10
|
import React, { useCallback, useEffect, useState } from "react";
|
|
18
11
|
import StandardModal from "../../StandardModal/index";
|
|
19
|
-
|
|
20
12
|
function getBase64(file) {
|
|
21
13
|
return new Promise(function (resolve, reject) {
|
|
22
14
|
var reader = new FileReader();
|
|
23
15
|
reader.readAsDataURL(file);
|
|
24
|
-
|
|
25
16
|
reader.onload = function () {
|
|
26
17
|
return resolve(reader.result);
|
|
27
18
|
};
|
|
28
|
-
|
|
29
19
|
reader.onerror = function (error) {
|
|
30
20
|
return reject(error);
|
|
31
21
|
};
|
|
32
22
|
});
|
|
33
23
|
}
|
|
34
|
-
|
|
35
24
|
var ReUpload = /*#__PURE__*/React.forwardRef(function (deProps, ref) {
|
|
36
25
|
var viewOnly = deProps.viewOnly,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
26
|
+
onChange = deProps.onChange,
|
|
27
|
+
value = deProps.value,
|
|
28
|
+
_deProps$modalConfig = deProps.modalConfig,
|
|
29
|
+
modalConfig = _deProps$modalConfig === void 0 ? {} : _deProps$modalConfig,
|
|
30
|
+
otherProps = __rest(deProps, ["viewOnly", "onChange", "value", "modalConfig"]);
|
|
43
31
|
var _useState = useState(),
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
fileList = _useState2[0],
|
|
34
|
+
setFileList = _useState2[1];
|
|
48
35
|
var _useState3 = useState({
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
36
|
+
previewVisible: false,
|
|
37
|
+
previewImage: '',
|
|
38
|
+
previewTitle: ''
|
|
39
|
+
}),
|
|
40
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
41
|
+
previewConfig = _useState4[0],
|
|
42
|
+
setPreviewConfig = _useState4[1];
|
|
57
43
|
useEffect(function () {
|
|
58
44
|
setFileList(value);
|
|
59
45
|
}, [value]);
|
|
60
|
-
|
|
61
46
|
var handlePreview = function handlePreview(file) {
|
|
62
47
|
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
63
48
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
@@ -68,20 +53,16 @@ var ReUpload = /*#__PURE__*/React.forwardRef(function (deProps, ref) {
|
|
|
68
53
|
_context.next = 4;
|
|
69
54
|
break;
|
|
70
55
|
}
|
|
71
|
-
|
|
72
56
|
_context.next = 3;
|
|
73
57
|
return getBase64(file.originFileObj);
|
|
74
|
-
|
|
75
58
|
case 3:
|
|
76
59
|
file.preview = _context.sent;
|
|
77
|
-
|
|
78
60
|
case 4:
|
|
79
61
|
setPreviewConfig({
|
|
80
62
|
previewImage: file.url || file.preview,
|
|
81
63
|
previewVisible: true,
|
|
82
64
|
previewTitle: file.name || file.url.substring(file.url.lastIndexOf('/') + 1)
|
|
83
65
|
});
|
|
84
|
-
|
|
85
66
|
case 5:
|
|
86
67
|
case "end":
|
|
87
68
|
return _context.stop();
|
|
@@ -90,11 +71,10 @@ var ReUpload = /*#__PURE__*/React.forwardRef(function (deProps, ref) {
|
|
|
90
71
|
}, _callee);
|
|
91
72
|
}));
|
|
92
73
|
};
|
|
93
|
-
|
|
94
74
|
var uploadChange = useCallback(function (_ref) {
|
|
95
75
|
var file = _ref.file,
|
|
96
|
-
|
|
97
|
-
|
|
76
|
+
fileList = _ref.fileList,
|
|
77
|
+
event = _ref.event;
|
|
98
78
|
setFileList(fileList);
|
|
99
79
|
onChange && onChange(fileList, {
|
|
100
80
|
file: file,
|