easy3wui 1.5.53-beta1 → 1.5.53-beta3

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.
@@ -372,7 +372,7 @@ var Easy3wUpload = function (_Component) {
372
372
  for (var i = 0; i < value.length; i += 1) {
373
373
  var status = value[i].status;
374
374
 
375
- if (status !== 'done') {
375
+ if (status === 'uploading') {
376
376
  str = ' ';
377
377
  break;
378
378
  }
@@ -1037,7 +1037,7 @@ var _initialiseProps = function _initialiseProps() {
1037
1037
  for (var i = 0; i < value.length; i += 1) {
1038
1038
  var status = value[i].status;
1039
1039
 
1040
- if (status !== 'done') {
1040
+ if (status === 'uploading') {
1041
1041
  str = ' ';
1042
1042
  break;
1043
1043
  }
@@ -74,6 +74,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'd
74
74
 
75
75
  // const { previewFileUrl, previewFileFlag, previewFileType } = objPreviewFile || {};
76
76
 
77
+ /* eslint-disable react/sort-comp */
77
78
  var formItemStyle = {
78
79
  marginBottom: 6
79
80
  };
@@ -115,6 +116,18 @@ var Easy3wUploadM = function (_Component) {
115
116
  };
116
117
  return _this;
117
118
  }
119
+
120
+ Easy3wUploadM.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
121
+ var initialValue = prevProps.initialValue;
122
+
123
+ if (!this.touchCompareList(this.props.initialValue, initialValue)) {
124
+ this.updateFileList(this.props.initialValue);
125
+ }
126
+ };
127
+ // 对比传入文件列表 返回值 false 不等则更新 true 相等则不更新
128
+
129
+ // 更新文件列表
130
+
118
131
  // 预览
119
132
 
120
133
  // 文件地址处理
@@ -132,8 +145,6 @@ var Easy3wUploadM = function (_Component) {
132
145
  var _state = this.state,
133
146
  fileList = _state.fileList,
134
147
  fileIds = _state.fileIds;
135
-
136
- console.log('renderfileList', fileList, fileIds);
137
148
  var _props = this.props,
138
149
  urlUpFileService = _props.urlUpFileService,
139
150
  urlDownloadFile = _props.urlDownloadFile,
@@ -310,6 +321,51 @@ Easy3wUploadM.defaultProps = {
310
321
  var _initialiseProps = function _initialiseProps() {
311
322
  var _this2 = this;
312
323
 
324
+ this.touchCompareList = function (arrFileList, arrFileListNew) {
325
+ if (!arrFileList || !arrFileListNew || arrFileList.length !== arrFileListNew.length) {
326
+ return false;
327
+ }
328
+ for (var i = 0; i < arrFileList.length; i += 1) {
329
+ var uid = arrFileList[i].uid;
330
+ var uidNew = arrFileListNew[i].uid;
331
+
332
+ if (uid !== uidNew) {
333
+ return false;
334
+ }
335
+ }
336
+ return true;
337
+ };
338
+
339
+ this.updateFileList = function (initialValue) {
340
+ var urlDownloadFile = _this2.props.urlDownloadFile;
341
+
342
+ var fileList = [];
343
+ var fileIds = '';
344
+ if (initialValue && initialValue.length > 0) {
345
+ fileList = initialValue.map(function (obj) {
346
+ var uid = obj.uid,
347
+ name = obj.name,
348
+ status = obj.status;
349
+
350
+ if (fileIds === '') {
351
+ fileIds = uid;
352
+ } else {
353
+ fileIds = fileIds + ',' + uid;
354
+ }
355
+ var url = _this2.urlDeal(urlDownloadFile, uid);
356
+ return { uid: uid, name: name, url: url, status: status || 'done' };
357
+ });
358
+ }
359
+ // return {
360
+ // fileList, // 文件列表
361
+ // fileIds, // 文件ID
362
+ // };
363
+ _this2.setState({
364
+ fileList: fileList, // 文件列表
365
+ fileIds: fileIds // 文件ID
366
+ });
367
+ };
368
+
313
369
  this.onPreview = function (file) {
314
370
  var objPreviewFileNew = (0, _extends3['default'])({}, _comonConfig.objPreviewFile, _this2.props.objPreviewFile);
315
371
  var previewFileUrl = objPreviewFileNew.previewFileUrl,
@@ -360,7 +416,7 @@ var _initialiseProps = function _initialiseProps() {
360
416
  for (var i = 0; i < value.length; i += 1) {
361
417
  var status = value[i].status;
362
418
 
363
- if (status !== 'done') {
419
+ if (status === 'uploading') {
364
420
  str = ' ';
365
421
  break;
366
422
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easy3wui",
3
- "version": "1.5.53-beta1",
3
+ "version": "1.5.53-beta3",
4
4
  "description": "easy3wui components for react",
5
5
  "keywords": [
6
6
  "react",