easy3wui 1.5.53-beta1 → 1.5.53-beta2

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.
@@ -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,52 @@ 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
+ console.log('updateFileList', initialValue, fileList, fileIds);
364
+ _this2.setState({
365
+ fileList: fileList, // 文件列表
366
+ fileIds: fileIds // 文件ID
367
+ });
368
+ };
369
+
313
370
  this.onPreview = function (file) {
314
371
  var objPreviewFileNew = (0, _extends3['default'])({}, _comonConfig.objPreviewFile, _this2.props.objPreviewFile);
315
372
  var previewFileUrl = objPreviewFileNew.previewFileUrl,
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-beta2",
4
4
  "description": "easy3wui components for react",
5
5
  "keywords": [
6
6
  "react",