@gsp-svc/formdoc-upload 0.1.38 → 0.1.39
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 +175 -209
- 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/lib/upload/file-upload/file-upload.component.js +176 -208
- package/esm2015/lib/upload/upload.service.js +3 -9
- package/esm5/lib/upload/file-upload/file-upload.component.js +176 -210
- package/esm5/lib/upload/upload.service.js +3 -9
- package/fesm2015/gsp-svc-formdoc-upload.js +178 -216
- package/fesm2015/gsp-svc-formdoc-upload.js.map +1 -1
- package/fesm5/gsp-svc-formdoc-upload.js +178 -218
- package/fesm5/gsp-svc-formdoc-upload.js.map +1 -1
- package/lib/upload/file-upload/file-upload.component.d.ts +3 -3
- package/package.json +1 -1
|
@@ -414,15 +414,10 @@
|
|
|
414
414
|
request.metadataId = metadataId;
|
|
415
415
|
request.rootId = rootId;
|
|
416
416
|
request.path = path;
|
|
417
|
-
return this.
|
|
417
|
+
return this.httpclient.post(url, request, { responseType: 'text' }).pipe(operators.tap(( /**
|
|
418
418
|
* @param {?} res
|
|
419
419
|
* @return {?}
|
|
420
|
-
*/function (res) { }))
|
|
421
|
-
* @param {?} error
|
|
422
|
-
* @return {?}
|
|
423
|
-
*/function (error) {
|
|
424
|
-
return of.of(error);
|
|
425
|
-
})));
|
|
420
|
+
*/function (res) { })));
|
|
426
421
|
};
|
|
427
422
|
/**
|
|
428
423
|
* @param {?} uploadFileInfoList
|
|
@@ -1072,68 +1067,62 @@
|
|
|
1072
1067
|
* @return {?}
|
|
1073
1068
|
*/
|
|
1074
1069
|
function (uuid, selectedFile, fileName) {
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
// let name: string = selectedFile.name;
|
|
1132
|
-
// let errType = name.substring(selectedFile.name.lastIndexOf('.'));
|
|
1133
|
-
// this.errTypeList.push(errType);
|
|
1134
|
-
}
|
|
1135
|
-
resolve(fileInfo);
|
|
1136
|
-
}));
|
|
1070
|
+
/** @type {?} */
|
|
1071
|
+
var fileInfo;
|
|
1072
|
+
fileInfo = {
|
|
1073
|
+
id: uuid,
|
|
1074
|
+
name: fileName,
|
|
1075
|
+
type: selectedFile.type,
|
|
1076
|
+
source: "",
|
|
1077
|
+
size: this.getFileSize(selectedFile.size),
|
|
1078
|
+
fileSize: selectedFile.size,
|
|
1079
|
+
picListDisplayName: this.getPicListDisplayName(fileName),
|
|
1080
|
+
queueListDisplayName: this.getQueueDisplayName(fileName),
|
|
1081
|
+
//content: reader.result.toString(),
|
|
1082
|
+
hasUploaded: false,
|
|
1083
|
+
mouseOn: false,
|
|
1084
|
+
selectd: false,
|
|
1085
|
+
isUploading: true,
|
|
1086
|
+
uploadResult: false,
|
|
1087
|
+
uploadProcess: 0,
|
|
1088
|
+
errorMessage: "",
|
|
1089
|
+
extensionDropListId: 0,
|
|
1090
|
+
extensionName: "",
|
|
1091
|
+
securityDropListId: 0,
|
|
1092
|
+
securityInfo: this.securityInfoList[0]
|
|
1093
|
+
};
|
|
1094
|
+
if (this.storageExtension != null)
|
|
1095
|
+
fileInfo.extensionName = this.defaultPropertyName;
|
|
1096
|
+
/** @type {?} */
|
|
1097
|
+
var type = selectedFile.type;
|
|
1098
|
+
if (type.includes("tiff")) {
|
|
1099
|
+
this.addDocInfo(selectedFile, fileInfo, DocType.Other);
|
|
1100
|
+
}
|
|
1101
|
+
else if (type.includes("image")) {
|
|
1102
|
+
this.addDocInfo(selectedFile, fileInfo, DocType.Image);
|
|
1103
|
+
}
|
|
1104
|
+
else if (type.includes("word")) {
|
|
1105
|
+
this.addDocInfo(selectedFile, fileInfo, DocType.Word);
|
|
1106
|
+
}
|
|
1107
|
+
else if (type.includes("pdf")) {
|
|
1108
|
+
this.addDocInfo(selectedFile, fileInfo, DocType.Pdf);
|
|
1109
|
+
}
|
|
1110
|
+
else if (type.includes("plain")) {
|
|
1111
|
+
this.addDocInfo(selectedFile, fileInfo, DocType.Txt);
|
|
1112
|
+
}
|
|
1113
|
+
else if (type.includes("sheet") || type.includes("excel")) {
|
|
1114
|
+
this.addDocInfo(selectedFile, fileInfo, DocType.Excel);
|
|
1115
|
+
}
|
|
1116
|
+
else if (type.includes("powerpoint") || type.includes("presentation")) {
|
|
1117
|
+
this.addDocInfo(selectedFile, fileInfo, DocType.Powerpoint);
|
|
1118
|
+
}
|
|
1119
|
+
else {
|
|
1120
|
+
this.addDocInfo(selectedFile, fileInfo, DocType.Other);
|
|
1121
|
+
// let name: string = selectedFile.name;
|
|
1122
|
+
// let errType = name.substring(selectedFile.name.lastIndexOf('.'));
|
|
1123
|
+
// this.errTypeList.push(errType);
|
|
1124
|
+
}
|
|
1125
|
+
return fileInfo;
|
|
1137
1126
|
};
|
|
1138
1127
|
/**
|
|
1139
1128
|
* @param {?} uuid
|
|
@@ -1154,85 +1143,81 @@
|
|
|
1154
1143
|
if (state === void 0) {
|
|
1155
1144
|
state = FileState.New;
|
|
1156
1145
|
}
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1146
|
+
/** @type {?} */
|
|
1147
|
+
var fileInfo = this.handleFileInfo(uuid, selectedFile, fileName);
|
|
1148
|
+
/** @type {?} */
|
|
1149
|
+
var chunkTotal = Math.ceil(selectedFile.size / this.bufferSize);
|
|
1150
|
+
/** @type {?} */
|
|
1151
|
+
var chunkIndex = 0;
|
|
1152
|
+
this.fileTotalChunk[uuid] = chunkTotal;
|
|
1153
|
+
/** @type {?} */
|
|
1154
|
+
var uploadFileInfo = new UploadFileInfo();
|
|
1155
|
+
uploadFileInfo.metadataId = uuid;
|
|
1156
|
+
uploadFileInfo.fileName = fileInfo.name;
|
|
1157
|
+
uploadFileInfo.fileSize = fileInfo.size;
|
|
1158
|
+
uploadFileInfo.state = state;
|
|
1159
|
+
uploadFileInfo.securityInfo = this.securityInfoList[0];
|
|
1160
|
+
while (chunkIndex < chunkTotal) {
|
|
1161
1161
|
/** @type {?} */
|
|
1162
|
-
var
|
|
1162
|
+
var uploadInfo = new GspFormUploadEntity;
|
|
1163
|
+
uploadInfo.formId = this.formId;
|
|
1164
|
+
uploadInfo.mode = OperatingModes.Temp;
|
|
1165
|
+
uploadInfo.rootId = this.rootId;
|
|
1163
1166
|
/** @type {?} */
|
|
1164
|
-
var
|
|
1167
|
+
var docInfo = new GspFormDocInfo;
|
|
1168
|
+
docInfo.fileName = fileName;
|
|
1169
|
+
docInfo.metadataId = uuid;
|
|
1170
|
+
docInfo.total = chunkTotal;
|
|
1171
|
+
this.uploadedChunk[docInfo.metadataId] = 0;
|
|
1165
1172
|
/** @type {?} */
|
|
1166
|
-
var
|
|
1167
|
-
_this.fileTotalChunk[uuid] = chunkTotal;
|
|
1173
|
+
var nextSize = Math.min((chunkIndex + 1) * this.bufferSize, selectedFile.size);
|
|
1168
1174
|
/** @type {?} */
|
|
1169
|
-
var
|
|
1170
|
-
|
|
1171
|
-
|
|
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
|
-
}
|
|
1175
|
+
var fileData = selectedFile.slice(chunkIndex * this.bufferSize, nextSize);
|
|
1176
|
+
// let reader = new FileReader();
|
|
1177
|
+
// reader.readAsBinaryString(fileData);
|
|
1218
1178
|
/** @type {?} */
|
|
1219
|
-
var
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1179
|
+
var innerIndex = chunkIndex;
|
|
1180
|
+
// reader.onload = () => {
|
|
1181
|
+
// docInfo.fileContent = btoa(reader.result.toString());
|
|
1182
|
+
docInfo.size = selectedFile.size;
|
|
1183
|
+
docInfo.index = innerIndex;
|
|
1184
|
+
docInfo.fileContent = "";
|
|
1185
|
+
//chunkIndex++;
|
|
1186
|
+
if (this.haveExtensionProperty)
|
|
1187
|
+
docInfo.exPropertyName = this.defaultPropertyName;
|
|
1188
|
+
//docInfo.isLast = true;
|
|
1189
|
+
uploadInfo.docInfo = docInfo;
|
|
1190
|
+
// let info = uploadInfo;
|
|
1191
|
+
// this.requestArray.push(this.uploadService.uploadFile(uploadInfo));
|
|
1192
|
+
// this.requestBodyArray.push(info);
|
|
1193
|
+
//封装请求formdata
|
|
1194
|
+
/** @type {?} */
|
|
1195
|
+
var formData = new FormData();
|
|
1196
|
+
formData.append('uploadInfo', JSON.stringify(uploadInfo));
|
|
1197
|
+
formData.append('docInfo', JSON.stringify(docInfo));
|
|
1198
|
+
formData.append('file', fileData);
|
|
1199
|
+
this.sendUploadRequest(formData, fileInfo, docInfo, uploadFileInfo);
|
|
1200
|
+
// }
|
|
1201
|
+
//console.log(chunkIndex + 1);
|
|
1202
|
+
chunkIndex = chunkIndex + 1;
|
|
1203
|
+
}
|
|
1204
|
+
/** @type {?} */
|
|
1205
|
+
var index = -1;
|
|
1206
|
+
this.files.forEach(( /**
|
|
1207
|
+
* @param {?} x
|
|
1208
|
+
* @return {?}
|
|
1209
|
+
*/function (x) {
|
|
1210
|
+
if (x.name == fileInfo.name) {
|
|
1211
|
+
if (index == -1)
|
|
1212
|
+
index = _this.files.indexOf(x);
|
|
1234
1213
|
}
|
|
1235
1214
|
}));
|
|
1215
|
+
if (index != -1 && index != this.files.length - 1) {
|
|
1216
|
+
this.files.splice(index, 1);
|
|
1217
|
+
this.uploadFileInfoList.splice(index, 1);
|
|
1218
|
+
this.uploadedFileInfoList.splice(index, 1);
|
|
1219
|
+
this.uploadedFileTotal--;
|
|
1220
|
+
}
|
|
1236
1221
|
};
|
|
1237
1222
|
/**
|
|
1238
1223
|
* @param {?} formData
|
|
@@ -1475,54 +1460,57 @@
|
|
|
1475
1460
|
*/
|
|
1476
1461
|
function (selectdFile, fileInfo, docType) {
|
|
1477
1462
|
var _this = this;
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1463
|
+
switch (docType) {
|
|
1464
|
+
case DocType.Word: {
|
|
1465
|
+
fileInfo.source = "/platform/runtime/dfs/images/word.png";
|
|
1466
|
+
this.files.push(fileInfo);
|
|
1467
|
+
break;
|
|
1468
|
+
}
|
|
1469
|
+
case DocType.Pdf: {
|
|
1470
|
+
fileInfo.source = "/platform/runtime/dfs/images/pdf.png";
|
|
1471
|
+
this.files.push(fileInfo);
|
|
1472
|
+
break;
|
|
1473
|
+
}
|
|
1474
|
+
case DocType.Excel: {
|
|
1475
|
+
fileInfo.source = "/platform/runtime/dfs/images/excel.png";
|
|
1476
|
+
this.files.push(fileInfo);
|
|
1477
|
+
break;
|
|
1478
|
+
}
|
|
1479
|
+
case DocType.Txt: {
|
|
1480
|
+
fileInfo.source = "/platform/runtime/dfs/images/txt.png";
|
|
1481
|
+
this.files.push(fileInfo);
|
|
1482
|
+
break;
|
|
1483
|
+
}
|
|
1484
|
+
case DocType.Powerpoint: {
|
|
1485
|
+
fileInfo.source = "/platform/runtime/dfs/images/ppt.png";
|
|
1486
|
+
this.files.push(fileInfo);
|
|
1487
|
+
break;
|
|
1488
|
+
}
|
|
1489
|
+
case DocType.Other: {
|
|
1490
|
+
fileInfo.source = "/platform/runtime/dfs/images/file.png";
|
|
1491
|
+
this.files.push(fileInfo);
|
|
1492
|
+
break;
|
|
1493
|
+
}
|
|
1494
|
+
case DocType.Image: {
|
|
1495
|
+
/** @type {?} */
|
|
1496
|
+
var reader_1 = new FileReader();
|
|
1497
|
+
reader_1.readAsDataURL(selectdFile);
|
|
1498
|
+
reader_1.onload = ( /**
|
|
1499
|
+
* @param {?} _event
|
|
1500
|
+
* @return {?}
|
|
1501
|
+
*/function (_event) {
|
|
1502
|
+
/** @type {?} */
|
|
1503
|
+
var imgUrl = reader_1.result;
|
|
1504
|
+
if (_this.injector != null) {
|
|
1505
|
+
/** @type {?} */
|
|
1506
|
+
var sanitizer = _this.injector.get(platformBrowser.DomSanitizer);
|
|
1507
|
+
imgUrl = sanitizer.bypassSecurityTrustResourceUrl(imgUrl);
|
|
1508
|
+
}
|
|
1509
|
+
fileInfo.source = imgUrl;
|
|
1510
1510
|
_this.files.push(fileInfo);
|
|
1511
|
-
|
|
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
|
-
}
|
|
1511
|
+
});
|
|
1523
1512
|
}
|
|
1524
|
-
|
|
1525
|
-
}));
|
|
1513
|
+
}
|
|
1526
1514
|
};
|
|
1527
1515
|
/**
|
|
1528
1516
|
* @param {?} selectdFile
|
|
@@ -1533,28 +1521,6 @@
|
|
|
1533
1521
|
* @return {?}
|
|
1534
1522
|
*/
|
|
1535
1523
|
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) {
|
|
1548
|
-
/** @type {?} */
|
|
1549
|
-
var imgUrl = reader.result;
|
|
1550
|
-
if (_this.injector != null) {
|
|
1551
|
-
/** @type {?} */
|
|
1552
|
-
var sanitizer = _this.injector.get(platformBrowser.DomSanitizer);
|
|
1553
|
-
imgUrl = sanitizer.bypassSecurityTrustResourceUrl(imgUrl);
|
|
1554
|
-
}
|
|
1555
|
-
resolve(imgUrl);
|
|
1556
|
-
});
|
|
1557
|
-
}));
|
|
1558
1524
|
};
|
|
1559
1525
|
/**
|
|
1560
1526
|
* @param {?} strList
|