@gsp-svc/formdoc-upload 0.1.37 → 0.1.38
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/bundles/gsp-svc-formdoc-upload.umd.js +301 -194
- package/bundles/gsp-svc-formdoc-upload.umd.js.map +1 -1
- package/bundles/gsp-svc-formdoc-upload.umd.min.js +1 -1
- package/bundles/gsp-svc-formdoc-upload.umd.min.js.map +1 -1
- package/esm2015/gsp-svc-formdoc-upload.js +2 -2
- package/esm2015/lib/upload/entity/copyfilerequest.js +15 -0
- package/esm2015/lib/upload/entity/fileinfo.js +1 -1
- package/esm2015/lib/upload/file-upload/file-upload.component.js +247 -192
- package/esm2015/lib/upload/upload.service.js +28 -1
- package/esm2015/public-api.js +2 -1
- package/esm5/gsp-svc-formdoc-upload.js +2 -2
- package/esm5/lib/upload/entity/copyfilerequest.js +19 -0
- package/esm5/lib/upload/entity/fileinfo.js +1 -1
- package/esm5/lib/upload/file-upload/file-upload.component.js +267 -196
- package/esm5/lib/upload/upload.service.js +34 -1
- package/esm5/public-api.js +2 -1
- package/fesm2015/gsp-svc-formdoc-upload.js +281 -193
- package/fesm2015/gsp-svc-formdoc-upload.js.map +1 -1
- package/fesm5/gsp-svc-formdoc-upload.js +310 -197
- package/fesm5/gsp-svc-formdoc-upload.js.map +1 -1
- package/gsp-svc-formdoc-upload.metadata.json +1 -1
- package/lib/upload/entity/copyfilerequest.d.ts +5 -0
- package/lib/upload/entity/fileinfo.d.ts +1 -1
- package/lib/upload/file-upload/file-upload.component.d.ts +4 -1
- package/lib/upload/upload.service.d.ts +1 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
|
@@ -144,6 +144,16 @@
|
|
|
144
144
|
return ChangeInstanceRequest;
|
|
145
145
|
}());
|
|
146
146
|
|
|
147
|
+
/**
|
|
148
|
+
* @fileoverview added by tsickle
|
|
149
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
150
|
+
*/
|
|
151
|
+
var CopyFileRequest = /** @class */ (function () {
|
|
152
|
+
function CopyFileRequest() {
|
|
153
|
+
}
|
|
154
|
+
return CopyFileRequest;
|
|
155
|
+
}());
|
|
156
|
+
|
|
147
157
|
/**
|
|
148
158
|
* @fileoverview added by tsickle
|
|
149
159
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -384,6 +394,36 @@
|
|
|
384
394
|
return of.of(error);
|
|
385
395
|
})));
|
|
386
396
|
};
|
|
397
|
+
/**
|
|
398
|
+
* @param {?} metadataId
|
|
399
|
+
* @param {?} rootId
|
|
400
|
+
* @param {?} path
|
|
401
|
+
* @return {?}
|
|
402
|
+
*/
|
|
403
|
+
UploadService.prototype.copyFile = /**
|
|
404
|
+
* @param {?} metadataId
|
|
405
|
+
* @param {?} rootId
|
|
406
|
+
* @param {?} path
|
|
407
|
+
* @return {?}
|
|
408
|
+
*/
|
|
409
|
+
function (metadataId, rootId, path) {
|
|
410
|
+
/** @type {?} */
|
|
411
|
+
var url = "/api/runtime/dfs/v1.0/formdoc/copy";
|
|
412
|
+
/** @type {?} */
|
|
413
|
+
var request = new CopyFileRequest;
|
|
414
|
+
request.metadataId = metadataId;
|
|
415
|
+
request.rootId = rootId;
|
|
416
|
+
request.path = path;
|
|
417
|
+
return this.http.post(url, request).pipe(operators.tap(( /**
|
|
418
|
+
* @param {?} res
|
|
419
|
+
* @return {?}
|
|
420
|
+
*/function (res) { })), operators.catchError(( /**
|
|
421
|
+
* @param {?} error
|
|
422
|
+
* @return {?}
|
|
423
|
+
*/function (error) {
|
|
424
|
+
return of.of(error);
|
|
425
|
+
})));
|
|
426
|
+
};
|
|
387
427
|
/**
|
|
388
428
|
* @param {?} uploadFileInfoList
|
|
389
429
|
* @param {?} rootId
|
|
@@ -710,7 +750,7 @@
|
|
|
710
750
|
this.beyondFileList = [];
|
|
711
751
|
this.showType = 0;
|
|
712
752
|
this.mouseOn = false;
|
|
713
|
-
this.bufferSize = 1024 * 1024;
|
|
753
|
+
this.bufferSize = 10 * 1024 * 1024;
|
|
714
754
|
this.selectedFileCount = 0;
|
|
715
755
|
this.uploadIconAddress = '/platform/runtime/dfs/images/upload.svg';
|
|
716
756
|
this.uploadLittleIconAddress = '/platform/runtime/dfs/images/uploadIcon.svg';
|
|
@@ -1019,6 +1059,82 @@
|
|
|
1019
1059
|
function (file) {
|
|
1020
1060
|
this.msgService.error(this.localepipe.transform('uploadFailure') + file.errorMessage);
|
|
1021
1061
|
};
|
|
1062
|
+
/**
|
|
1063
|
+
* @param {?} uuid
|
|
1064
|
+
* @param {?} selectedFile
|
|
1065
|
+
* @param {?} fileName
|
|
1066
|
+
* @return {?}
|
|
1067
|
+
*/
|
|
1068
|
+
FileUploadComponent.prototype.handleFileInfo = /**
|
|
1069
|
+
* @param {?} uuid
|
|
1070
|
+
* @param {?} selectedFile
|
|
1071
|
+
* @param {?} fileName
|
|
1072
|
+
* @return {?}
|
|
1073
|
+
*/
|
|
1074
|
+
function (uuid, selectedFile, fileName) {
|
|
1075
|
+
var _this = this;
|
|
1076
|
+
return new Promise(( /**
|
|
1077
|
+
* @param {?} resolve
|
|
1078
|
+
* @return {?}
|
|
1079
|
+
*/function (resolve) {
|
|
1080
|
+
/** @type {?} */
|
|
1081
|
+
var fileInfo;
|
|
1082
|
+
fileInfo = {
|
|
1083
|
+
id: uuid,
|
|
1084
|
+
name: fileName,
|
|
1085
|
+
type: selectedFile.type,
|
|
1086
|
+
source: "",
|
|
1087
|
+
size: _this.getFileSize(selectedFile.size),
|
|
1088
|
+
fileSize: selectedFile.size,
|
|
1089
|
+
picListDisplayName: _this.getPicListDisplayName(fileName),
|
|
1090
|
+
queueListDisplayName: _this.getQueueDisplayName(fileName),
|
|
1091
|
+
//content: reader.result.toString(),
|
|
1092
|
+
hasUploaded: false,
|
|
1093
|
+
mouseOn: false,
|
|
1094
|
+
selectd: false,
|
|
1095
|
+
isUploading: true,
|
|
1096
|
+
uploadResult: false,
|
|
1097
|
+
uploadProcess: 0,
|
|
1098
|
+
errorMessage: "",
|
|
1099
|
+
extensionDropListId: 0,
|
|
1100
|
+
extensionName: "",
|
|
1101
|
+
securityDropListId: 0,
|
|
1102
|
+
securityInfo: _this.securityInfoList[0]
|
|
1103
|
+
};
|
|
1104
|
+
if (_this.storageExtension != null)
|
|
1105
|
+
fileInfo.extensionName = _this.defaultPropertyName;
|
|
1106
|
+
/** @type {?} */
|
|
1107
|
+
var type = selectedFile.type;
|
|
1108
|
+
if (type.includes("tiff")) {
|
|
1109
|
+
_this.addDocInfo(selectedFile, fileInfo, DocType.Other);
|
|
1110
|
+
}
|
|
1111
|
+
else if (type.includes("image")) {
|
|
1112
|
+
_this.addDocInfo(selectedFile, fileInfo, DocType.Image);
|
|
1113
|
+
}
|
|
1114
|
+
else if (type.includes("word")) {
|
|
1115
|
+
_this.addDocInfo(selectedFile, fileInfo, DocType.Word);
|
|
1116
|
+
}
|
|
1117
|
+
else if (type.includes("pdf")) {
|
|
1118
|
+
_this.addDocInfo(selectedFile, fileInfo, DocType.Pdf);
|
|
1119
|
+
}
|
|
1120
|
+
else if (type.includes("plain")) {
|
|
1121
|
+
_this.addDocInfo(selectedFile, fileInfo, DocType.Txt);
|
|
1122
|
+
}
|
|
1123
|
+
else if (type.includes("sheet") || type.includes("excel")) {
|
|
1124
|
+
_this.addDocInfo(selectedFile, fileInfo, DocType.Excel);
|
|
1125
|
+
}
|
|
1126
|
+
else if (type.includes("powerpoint") || type.includes("presentation")) {
|
|
1127
|
+
_this.addDocInfo(selectedFile, fileInfo, DocType.Powerpoint);
|
|
1128
|
+
}
|
|
1129
|
+
else {
|
|
1130
|
+
_this.addDocInfo(selectedFile, fileInfo, DocType.Other);
|
|
1131
|
+
// let name: string = selectedFile.name;
|
|
1132
|
+
// let errType = name.substring(selectedFile.name.lastIndexOf('.'));
|
|
1133
|
+
// this.errTypeList.push(errType);
|
|
1134
|
+
}
|
|
1135
|
+
resolve(fileInfo);
|
|
1136
|
+
}));
|
|
1137
|
+
};
|
|
1022
1138
|
/**
|
|
1023
1139
|
* @param {?} uuid
|
|
1024
1140
|
* @param {?} selectedFile
|
|
@@ -1038,161 +1154,123 @@
|
|
|
1038
1154
|
if (state === void 0) {
|
|
1039
1155
|
state = FileState.New;
|
|
1040
1156
|
}
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
//reader.onload = (e) => {
|
|
1046
|
-
fileInfo = {
|
|
1047
|
-
id: uuid,
|
|
1048
|
-
name: fileName,
|
|
1049
|
-
type: selectedFile.type,
|
|
1050
|
-
source: "",
|
|
1051
|
-
size: this.getFileSize(selectedFile.size),
|
|
1052
|
-
fileSize: selectedFile.size,
|
|
1053
|
-
picListDisplayName: this.getPicListDisplayName(fileName),
|
|
1054
|
-
queueListDisplayName: this.getQueueDisplayName(fileName),
|
|
1055
|
-
//content: reader.result.toString(),
|
|
1056
|
-
hasUploaded: false,
|
|
1057
|
-
mouseOn: false,
|
|
1058
|
-
selectd: false,
|
|
1059
|
-
isUploading: true,
|
|
1060
|
-
uploadResult: false,
|
|
1061
|
-
uploadProcess: 0,
|
|
1062
|
-
errorMessage: "",
|
|
1063
|
-
extensionDropListId: 0,
|
|
1064
|
-
extensionName: "",
|
|
1065
|
-
securityDropListId: 0,
|
|
1066
|
-
securityInfo: this.securityInfoList[0]
|
|
1067
|
-
};
|
|
1068
|
-
if (this.storageExtension != null)
|
|
1069
|
-
fileInfo.extensionName = this.defaultPropertyName;
|
|
1070
|
-
/** @type {?} */
|
|
1071
|
-
var chunkTotal = Math.ceil(selectedFile.size / this.bufferSize);
|
|
1072
|
-
/** @type {?} */
|
|
1073
|
-
var chunkIndex = 0;
|
|
1074
|
-
this.fileTotalChunk[uuid] = chunkTotal;
|
|
1075
|
-
/** @type {?} */
|
|
1076
|
-
var uploadFileInfo = new UploadFileInfo();
|
|
1077
|
-
uploadFileInfo.metadataId = uuid;
|
|
1078
|
-
uploadFileInfo.fileName = fileInfo.name;
|
|
1079
|
-
uploadFileInfo.fileSize = fileInfo.size;
|
|
1080
|
-
uploadFileInfo.state = state;
|
|
1081
|
-
uploadFileInfo.securityInfo = this.securityInfoList[0];
|
|
1082
|
-
var _loop_2 = function () {
|
|
1083
|
-
/** @type {?} */
|
|
1084
|
-
var uploadInfo = new GspFormUploadEntity;
|
|
1085
|
-
uploadInfo.formId = this_2.formId;
|
|
1086
|
-
uploadInfo.mode = OperatingModes.Temp;
|
|
1087
|
-
uploadInfo.rootId = this_2.rootId;
|
|
1157
|
+
this.handleFileInfo(uuid, selectedFile, fileName).then(( /**
|
|
1158
|
+
* @param {?} res
|
|
1159
|
+
* @return {?}
|
|
1160
|
+
*/function (res) {
|
|
1088
1161
|
/** @type {?} */
|
|
1089
|
-
var
|
|
1090
|
-
docInfo.fileName = fileName;
|
|
1091
|
-
docInfo.metadataId = uuid;
|
|
1092
|
-
docInfo.total = chunkTotal;
|
|
1093
|
-
this_2.uploadedChunk[docInfo.metadataId] = 0;
|
|
1162
|
+
var fileInfo = res;
|
|
1094
1163
|
/** @type {?} */
|
|
1095
|
-
var
|
|
1164
|
+
var chunkTotal = Math.ceil(selectedFile.size / _this.bufferSize);
|
|
1096
1165
|
/** @type {?} */
|
|
1097
|
-
var
|
|
1098
|
-
|
|
1099
|
-
// reader.readAsBinaryString(fileData);
|
|
1166
|
+
var chunkIndex = 0;
|
|
1167
|
+
_this.fileTotalChunk[uuid] = chunkTotal;
|
|
1100
1168
|
/** @type {?} */
|
|
1101
|
-
var
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1169
|
+
var uploadFileInfo = new UploadFileInfo();
|
|
1170
|
+
uploadFileInfo.metadataId = uuid;
|
|
1171
|
+
uploadFileInfo.fileName = fileInfo.name;
|
|
1172
|
+
uploadFileInfo.fileSize = fileInfo.size;
|
|
1173
|
+
uploadFileInfo.state = state;
|
|
1174
|
+
uploadFileInfo.securityInfo = _this.securityInfoList[0];
|
|
1175
|
+
while (chunkIndex < chunkTotal) {
|
|
1176
|
+
/** @type {?} */
|
|
1177
|
+
var uploadInfo = new GspFormUploadEntity;
|
|
1178
|
+
uploadInfo.formId = _this.formId;
|
|
1179
|
+
uploadInfo.mode = OperatingModes.Temp;
|
|
1180
|
+
uploadInfo.rootId = _this.rootId;
|
|
1181
|
+
/** @type {?} */
|
|
1182
|
+
var docInfo = new GspFormDocInfo;
|
|
1183
|
+
docInfo.fileName = fileName;
|
|
1184
|
+
docInfo.metadataId = uuid;
|
|
1185
|
+
docInfo.total = chunkTotal;
|
|
1186
|
+
_this.uploadedChunk[docInfo.metadataId] = 0;
|
|
1187
|
+
/** @type {?} */
|
|
1188
|
+
var nextSize = Math.min((chunkIndex + 1) * _this.bufferSize, selectedFile.size);
|
|
1189
|
+
/** @type {?} */
|
|
1190
|
+
var fileData = selectedFile.slice(chunkIndex * _this.bufferSize, nextSize);
|
|
1191
|
+
// let reader = new FileReader();
|
|
1192
|
+
// reader.readAsBinaryString(fileData);
|
|
1193
|
+
/** @type {?} */
|
|
1194
|
+
var innerIndex = chunkIndex;
|
|
1195
|
+
// reader.onload = () => {
|
|
1196
|
+
// docInfo.fileContent = btoa(reader.result.toString());
|
|
1197
|
+
docInfo.size = selectedFile.size;
|
|
1198
|
+
docInfo.index = innerIndex;
|
|
1199
|
+
docInfo.fileContent = "";
|
|
1200
|
+
//chunkIndex++;
|
|
1201
|
+
if (_this.haveExtensionProperty)
|
|
1202
|
+
docInfo.exPropertyName = _this.defaultPropertyName;
|
|
1203
|
+
//docInfo.isLast = true;
|
|
1204
|
+
uploadInfo.docInfo = docInfo;
|
|
1205
|
+
// let info = uploadInfo;
|
|
1206
|
+
// this.requestArray.push(this.uploadService.uploadFile(uploadInfo));
|
|
1207
|
+
// this.requestBodyArray.push(info);
|
|
1208
|
+
//封装请求formdata
|
|
1209
|
+
/** @type {?} */
|
|
1210
|
+
var formData = new FormData();
|
|
1211
|
+
formData.append('uploadInfo', JSON.stringify(uploadInfo));
|
|
1212
|
+
formData.append('docInfo', JSON.stringify(docInfo));
|
|
1213
|
+
formData.append('file', fileData);
|
|
1214
|
+
// }
|
|
1215
|
+
//console.log(chunkIndex + 1);
|
|
1216
|
+
chunkIndex = chunkIndex + 1;
|
|
1217
|
+
}
|
|
1116
1218
|
/** @type {?} */
|
|
1117
|
-
var
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
formData.append('file', fileData);
|
|
1121
|
-
this_2.uploadSliceFile(formData).subscribe(( /**
|
|
1122
|
-
* @param {?} res
|
|
1219
|
+
var index = -1;
|
|
1220
|
+
_this.files.forEach(( /**
|
|
1221
|
+
* @param {?} x
|
|
1123
1222
|
* @return {?}
|
|
1124
|
-
*/function (
|
|
1125
|
-
if (
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
_this.files[_this.files.indexOf(fileInfo)].errorMessage = res.error.Message;
|
|
1129
|
-
}
|
|
1130
|
-
else {
|
|
1131
|
-
_this.uploadedChunk[docInfo.metadataId]++;
|
|
1132
|
-
_this.files[_this.files.indexOf(fileInfo)].uploadProcess = Number.parseInt((_this.uploadedChunk[docInfo.metadataId] / _this.fileTotalChunk[docInfo.metadataId] * 100).toFixed(0));
|
|
1133
|
-
if (_this.uploadedChunk[docInfo.metadataId] == _this.fileTotalChunk[docInfo.metadataId]) {
|
|
1134
|
-
_this.files[_this.files.indexOf(fileInfo)].uploadResult = true;
|
|
1135
|
-
_this.files[_this.files.indexOf(fileInfo)].isUploading = false;
|
|
1136
|
-
_this.uploadFileInfoList = _this.uploadFileInfoList.concat(uploadFileInfo);
|
|
1137
|
-
_this.uploadedFileInfoList = _this.uploadedFileInfoList.concat(uploadFileInfo);
|
|
1138
|
-
_this.uploadedFileTotal++;
|
|
1139
|
-
}
|
|
1223
|
+
*/function (x) {
|
|
1224
|
+
if (x.name == fileInfo.name) {
|
|
1225
|
+
if (index == -1)
|
|
1226
|
+
index = _this.files.indexOf(x);
|
|
1140
1227
|
}
|
|
1141
1228
|
}));
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
this.addDocInfo(selectedFile, fileInfo, DocType.Excel);
|
|
1169
|
-
}
|
|
1170
|
-
else if (type.includes("powerpoint") || type.includes("presentation")) {
|
|
1171
|
-
this.addDocInfo(selectedFile, fileInfo, DocType.Powerpoint);
|
|
1172
|
-
}
|
|
1173
|
-
else {
|
|
1174
|
-
this.addDocInfo(selectedFile, fileInfo, DocType.Other);
|
|
1175
|
-
// let name: string = selectedFile.name;
|
|
1176
|
-
// let errType = name.substring(selectedFile.name.lastIndexOf('.'));
|
|
1177
|
-
// this.errTypeList.push(errType);
|
|
1178
|
-
}
|
|
1179
|
-
/** @type {?} */
|
|
1180
|
-
var index = -1;
|
|
1181
|
-
this.files.forEach(( /**
|
|
1182
|
-
* @param {?} x
|
|
1229
|
+
if (index != -1 && index != _this.files.length - 1) {
|
|
1230
|
+
_this.files.splice(index, 1);
|
|
1231
|
+
_this.uploadFileInfoList.splice(index, 1);
|
|
1232
|
+
_this.uploadedFileInfoList.splice(index, 1);
|
|
1233
|
+
_this.uploadedFileTotal--;
|
|
1234
|
+
}
|
|
1235
|
+
}));
|
|
1236
|
+
};
|
|
1237
|
+
/**
|
|
1238
|
+
* @param {?} formData
|
|
1239
|
+
* @param {?} fileInfo
|
|
1240
|
+
* @param {?} docInfo
|
|
1241
|
+
* @param {?} uploadFileInfo
|
|
1242
|
+
* @return {?}
|
|
1243
|
+
*/
|
|
1244
|
+
FileUploadComponent.prototype.sendUploadRequest = /**
|
|
1245
|
+
* @param {?} formData
|
|
1246
|
+
* @param {?} fileInfo
|
|
1247
|
+
* @param {?} docInfo
|
|
1248
|
+
* @param {?} uploadFileInfo
|
|
1249
|
+
* @return {?}
|
|
1250
|
+
*/
|
|
1251
|
+
function (formData, fileInfo, docInfo, uploadFileInfo) {
|
|
1252
|
+
var _this = this;
|
|
1253
|
+
this.uploadSliceFile(formData).subscribe(( /**
|
|
1254
|
+
* @param {?} res
|
|
1183
1255
|
* @return {?}
|
|
1184
|
-
*/function (
|
|
1185
|
-
if (
|
|
1186
|
-
|
|
1187
|
-
|
|
1256
|
+
*/function (res) {
|
|
1257
|
+
if (res != null) {
|
|
1258
|
+
_this.files[_this.files.indexOf(fileInfo)].uploadResult = false;
|
|
1259
|
+
_this.files[_this.files.indexOf(fileInfo)].isUploading = false;
|
|
1260
|
+
_this.files[_this.files.indexOf(fileInfo)].errorMessage = res.error.Message;
|
|
1261
|
+
}
|
|
1262
|
+
else {
|
|
1263
|
+
_this.uploadedChunk[docInfo.metadataId]++;
|
|
1264
|
+
_this.files[_this.files.indexOf(fileInfo)].uploadProcess = Number.parseInt((_this.uploadedChunk[docInfo.metadataId] / _this.fileTotalChunk[docInfo.metadataId] * 100).toFixed(0));
|
|
1265
|
+
if (_this.uploadedChunk[docInfo.metadataId] == _this.fileTotalChunk[docInfo.metadataId]) {
|
|
1266
|
+
_this.files[_this.files.indexOf(fileInfo)].uploadResult = true;
|
|
1267
|
+
_this.files[_this.files.indexOf(fileInfo)].isUploading = false;
|
|
1268
|
+
_this.uploadFileInfoList = _this.uploadFileInfoList.concat(uploadFileInfo);
|
|
1269
|
+
_this.uploadedFileInfoList = _this.uploadedFileInfoList.concat(uploadFileInfo);
|
|
1270
|
+
_this.uploadedFileTotal++;
|
|
1271
|
+
}
|
|
1188
1272
|
}
|
|
1189
1273
|
}));
|
|
1190
|
-
if (index != -1 && index != this.files.length - 1) {
|
|
1191
|
-
this.files.splice(index, 1);
|
|
1192
|
-
this.uploadFileInfoList.splice(index, 1);
|
|
1193
|
-
this.uploadedFileInfoList.splice(index, 1);
|
|
1194
|
-
this.uploadedFileTotal--;
|
|
1195
|
-
}
|
|
1196
1274
|
};
|
|
1197
1275
|
/**
|
|
1198
1276
|
* @param {?} formdata
|
|
@@ -1397,58 +1475,86 @@
|
|
|
1397
1475
|
*/
|
|
1398
1476
|
function (selectdFile, fileInfo, docType) {
|
|
1399
1477
|
var _this = this;
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1478
|
+
return new Promise(( /**
|
|
1479
|
+
* @param {?} resolve
|
|
1480
|
+
* @return {?}
|
|
1481
|
+
*/function (resolve) {
|
|
1482
|
+
switch (docType) {
|
|
1483
|
+
case DocType.Word: {
|
|
1484
|
+
fileInfo.source = "/platform/runtime/dfs/images/word.png";
|
|
1485
|
+
_this.files.push(fileInfo);
|
|
1486
|
+
break;
|
|
1487
|
+
}
|
|
1488
|
+
case DocType.Pdf: {
|
|
1489
|
+
fileInfo.source = "/platform/runtime/dfs/images/pdf.png";
|
|
1490
|
+
_this.files.push(fileInfo);
|
|
1491
|
+
break;
|
|
1492
|
+
}
|
|
1493
|
+
case DocType.Excel: {
|
|
1494
|
+
fileInfo.source = "/platform/runtime/dfs/images/excel.png";
|
|
1495
|
+
_this.files.push(fileInfo);
|
|
1496
|
+
break;
|
|
1497
|
+
}
|
|
1498
|
+
case DocType.Txt: {
|
|
1499
|
+
fileInfo.source = "/platform/runtime/dfs/images/txt.png";
|
|
1500
|
+
_this.files.push(fileInfo);
|
|
1501
|
+
break;
|
|
1502
|
+
}
|
|
1503
|
+
case DocType.Powerpoint: {
|
|
1504
|
+
fileInfo.source = "/platform/runtime/dfs/images/ppt.png";
|
|
1505
|
+
_this.files.push(fileInfo);
|
|
1506
|
+
break;
|
|
1507
|
+
}
|
|
1508
|
+
case DocType.Other: {
|
|
1509
|
+
fileInfo.source = "/platform/runtime/dfs/images/file.png";
|
|
1510
|
+
_this.files.push(fileInfo);
|
|
1511
|
+
break;
|
|
1512
|
+
}
|
|
1513
|
+
case DocType.Image: {
|
|
1514
|
+
_this.getImageUrl(selectdFile).then(( /**
|
|
1515
|
+
* @param {?} res
|
|
1516
|
+
* @return {?}
|
|
1517
|
+
*/function (res) {
|
|
1518
|
+
fileInfo.source = res;
|
|
1519
|
+
_this.files.push(fileInfo);
|
|
1520
|
+
resolve(fileInfo);
|
|
1521
|
+
}));
|
|
1522
|
+
}
|
|
1430
1523
|
}
|
|
1431
|
-
|
|
1524
|
+
resolve(fileInfo);
|
|
1525
|
+
}));
|
|
1526
|
+
};
|
|
1527
|
+
/**
|
|
1528
|
+
* @param {?} selectdFile
|
|
1529
|
+
* @return {?}
|
|
1530
|
+
*/
|
|
1531
|
+
FileUploadComponent.prototype.getImageUrl = /**
|
|
1532
|
+
* @param {?} selectdFile
|
|
1533
|
+
* @return {?}
|
|
1534
|
+
*/
|
|
1535
|
+
function (selectdFile) {
|
|
1536
|
+
var _this = this;
|
|
1537
|
+
return new Promise(( /**
|
|
1538
|
+
* @param {?} resolve
|
|
1539
|
+
* @return {?}
|
|
1540
|
+
*/function (resolve) {
|
|
1541
|
+
/** @type {?} */
|
|
1542
|
+
var reader = new FileReader();
|
|
1543
|
+
reader.readAsDataURL(selectdFile);
|
|
1544
|
+
reader.onload = ( /**
|
|
1545
|
+
* @param {?} _event
|
|
1546
|
+
* @return {?}
|
|
1547
|
+
*/function (_event) {
|
|
1432
1548
|
/** @type {?} */
|
|
1433
|
-
var
|
|
1434
|
-
|
|
1435
|
-
reader_1.onload = ( /**
|
|
1436
|
-
* @param {?} _event
|
|
1437
|
-
* @return {?}
|
|
1438
|
-
*/function (_event) {
|
|
1549
|
+
var imgUrl = reader.result;
|
|
1550
|
+
if (_this.injector != null) {
|
|
1439
1551
|
/** @type {?} */
|
|
1440
|
-
var
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
else
|
|
1447
|
-
fileInfo.source = imgUrl;
|
|
1448
|
-
_this.files.push(fileInfo);
|
|
1449
|
-
});
|
|
1450
|
-
break;
|
|
1451
|
-
}
|
|
1552
|
+
var sanitizer = _this.injector.get(platformBrowser.DomSanitizer);
|
|
1553
|
+
imgUrl = sanitizer.bypassSecurityTrustResourceUrl(imgUrl);
|
|
1554
|
+
}
|
|
1555
|
+
resolve(imgUrl);
|
|
1556
|
+
});
|
|
1557
|
+
}));
|
|
1452
1558
|
};
|
|
1453
1559
|
/**
|
|
1454
1560
|
* @param {?} strList
|
|
@@ -2299,6 +2405,7 @@
|
|
|
2299
2405
|
exports.GspDocSecurityBaseInfo = GspDocSecurityBaseInfo;
|
|
2300
2406
|
exports.SecurityEntity = SecurityEntity;
|
|
2301
2407
|
exports.ExStorageFileInfo = ExStorageFileInfo;
|
|
2408
|
+
exports.CopyFileRequest = CopyFileRequest;
|
|
2302
2409
|
exports.ɵb = LocalLangPipe;
|
|
2303
2410
|
|
|
2304
2411
|
Object.defineProperty(exports, '__esModule', { value: true });
|