@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
|
@@ -11,7 +11,7 @@ import { ProgressModule } from '@farris/ui-progress';
|
|
|
11
11
|
import { FormsModule } from '@angular/forms';
|
|
12
12
|
import { ComboListModule } from '@farris/ui-combo-list';
|
|
13
13
|
import { CacheService, HttpService, LanguageService, SessionService } from '@ecp-caf/caf-common';
|
|
14
|
-
import { Injectable, Pipe, Inject, LOCALE_ID, Component,
|
|
14
|
+
import { Injectable, Pipe, Inject, LOCALE_ID, Component, ViewChild, Input, NgModule, Injector, ComponentFactoryResolver, defineInjectable } from '@angular/core';
|
|
15
15
|
import { BsModalService } from '@farris/ui-modal';
|
|
16
16
|
import { of as of$1 } from 'rxjs';
|
|
17
17
|
import { HttpClientModule, HttpClient } from '@angular/common/http';
|
|
@@ -139,6 +139,13 @@ class GspFormDocOperateEntity {
|
|
|
139
139
|
class ChangeInstanceRequest {
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
+
/**
|
|
143
|
+
* @fileoverview added by tsickle
|
|
144
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
145
|
+
*/
|
|
146
|
+
class CopyFileRequest {
|
|
147
|
+
}
|
|
148
|
+
|
|
142
149
|
/**
|
|
143
150
|
* @fileoverview added by tsickle
|
|
144
151
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -352,6 +359,32 @@ class UploadService {
|
|
|
352
359
|
return of(error);
|
|
353
360
|
})));
|
|
354
361
|
}
|
|
362
|
+
/**
|
|
363
|
+
* @param {?} metadataId
|
|
364
|
+
* @param {?} rootId
|
|
365
|
+
* @param {?} path
|
|
366
|
+
* @return {?}
|
|
367
|
+
*/
|
|
368
|
+
copyFile(metadataId, rootId, path) {
|
|
369
|
+
/** @type {?} */
|
|
370
|
+
let url = "/api/runtime/dfs/v1.0/formdoc/copy";
|
|
371
|
+
/** @type {?} */
|
|
372
|
+
let request = new CopyFileRequest;
|
|
373
|
+
request.metadataId = metadataId;
|
|
374
|
+
request.rootId = rootId;
|
|
375
|
+
request.path = path;
|
|
376
|
+
return this.http.post(url, request).pipe(tap((/**
|
|
377
|
+
* @param {?} res
|
|
378
|
+
* @return {?}
|
|
379
|
+
*/
|
|
380
|
+
res => { })), catchError((/**
|
|
381
|
+
* @param {?} error
|
|
382
|
+
* @return {?}
|
|
383
|
+
*/
|
|
384
|
+
(error) => {
|
|
385
|
+
return of(error);
|
|
386
|
+
})));
|
|
387
|
+
}
|
|
355
388
|
/**
|
|
356
389
|
* @param {?} uploadFileInfoList
|
|
357
390
|
* @param {?} rootId
|
|
@@ -666,7 +699,7 @@ class FileUploadComponent {
|
|
|
666
699
|
this.beyondFileList = [];
|
|
667
700
|
this.showType = 0;
|
|
668
701
|
this.mouseOn = false;
|
|
669
|
-
this.bufferSize = 1024 * 1024;
|
|
702
|
+
this.bufferSize = 10 * 1024 * 1024;
|
|
670
703
|
this.selectedFileCount = 0;
|
|
671
704
|
this.uploadIconAddress = '/platform/runtime/dfs/images/upload.svg';
|
|
672
705
|
this.uploadLittleIconAddress = '/platform/runtime/dfs/images/uploadIcon.svg';
|
|
@@ -971,6 +1004,76 @@ class FileUploadComponent {
|
|
|
971
1004
|
showErrorMessage(file) {
|
|
972
1005
|
this.msgService.error(this.localepipe.transform('uploadFailure') + file.errorMessage);
|
|
973
1006
|
}
|
|
1007
|
+
/**
|
|
1008
|
+
* @param {?} uuid
|
|
1009
|
+
* @param {?} selectedFile
|
|
1010
|
+
* @param {?} fileName
|
|
1011
|
+
* @return {?}
|
|
1012
|
+
*/
|
|
1013
|
+
handleFileInfo(uuid, selectedFile, fileName) {
|
|
1014
|
+
return new Promise((/**
|
|
1015
|
+
* @param {?} resolve
|
|
1016
|
+
* @return {?}
|
|
1017
|
+
*/
|
|
1018
|
+
resolve => {
|
|
1019
|
+
/** @type {?} */
|
|
1020
|
+
let fileInfo;
|
|
1021
|
+
fileInfo = {
|
|
1022
|
+
id: uuid,
|
|
1023
|
+
name: fileName,
|
|
1024
|
+
type: selectedFile.type,
|
|
1025
|
+
source: "",
|
|
1026
|
+
size: this.getFileSize(selectedFile.size),
|
|
1027
|
+
fileSize: selectedFile.size,
|
|
1028
|
+
picListDisplayName: this.getPicListDisplayName(fileName),
|
|
1029
|
+
queueListDisplayName: this.getQueueDisplayName(fileName),
|
|
1030
|
+
//content: reader.result.toString(),
|
|
1031
|
+
hasUploaded: false,
|
|
1032
|
+
mouseOn: false,
|
|
1033
|
+
selectd: false,
|
|
1034
|
+
isUploading: true,
|
|
1035
|
+
uploadResult: false,
|
|
1036
|
+
uploadProcess: 0,
|
|
1037
|
+
errorMessage: "",
|
|
1038
|
+
extensionDropListId: 0,
|
|
1039
|
+
extensionName: "",
|
|
1040
|
+
securityDropListId: 0,
|
|
1041
|
+
securityInfo: this.securityInfoList[0]
|
|
1042
|
+
};
|
|
1043
|
+
if (this.storageExtension != null)
|
|
1044
|
+
fileInfo.extensionName = this.defaultPropertyName;
|
|
1045
|
+
/** @type {?} */
|
|
1046
|
+
let type = selectedFile.type;
|
|
1047
|
+
if (type.includes("tiff")) {
|
|
1048
|
+
this.addDocInfo(selectedFile, fileInfo, DocType.Other);
|
|
1049
|
+
}
|
|
1050
|
+
else if (type.includes("image")) {
|
|
1051
|
+
this.addDocInfo(selectedFile, fileInfo, DocType.Image);
|
|
1052
|
+
}
|
|
1053
|
+
else if (type.includes("word")) {
|
|
1054
|
+
this.addDocInfo(selectedFile, fileInfo, DocType.Word);
|
|
1055
|
+
}
|
|
1056
|
+
else if (type.includes("pdf")) {
|
|
1057
|
+
this.addDocInfo(selectedFile, fileInfo, DocType.Pdf);
|
|
1058
|
+
}
|
|
1059
|
+
else if (type.includes("plain")) {
|
|
1060
|
+
this.addDocInfo(selectedFile, fileInfo, DocType.Txt);
|
|
1061
|
+
}
|
|
1062
|
+
else if (type.includes("sheet") || type.includes("excel")) {
|
|
1063
|
+
this.addDocInfo(selectedFile, fileInfo, DocType.Excel);
|
|
1064
|
+
}
|
|
1065
|
+
else if (type.includes("powerpoint") || type.includes("presentation")) {
|
|
1066
|
+
this.addDocInfo(selectedFile, fileInfo, DocType.Powerpoint);
|
|
1067
|
+
}
|
|
1068
|
+
else {
|
|
1069
|
+
this.addDocInfo(selectedFile, fileInfo, DocType.Other);
|
|
1070
|
+
// let name: string = selectedFile.name;
|
|
1071
|
+
// let errType = name.substring(selectedFile.name.lastIndexOf('.'));
|
|
1072
|
+
// this.errTypeList.push(errType);
|
|
1073
|
+
}
|
|
1074
|
+
resolve(fileInfo);
|
|
1075
|
+
}));
|
|
1076
|
+
}
|
|
974
1077
|
/**
|
|
975
1078
|
* @param {?} uuid
|
|
976
1079
|
* @param {?} selectedFile
|
|
@@ -979,159 +1082,118 @@ class FileUploadComponent {
|
|
|
979
1082
|
* @return {?}
|
|
980
1083
|
*/
|
|
981
1084
|
uploadFile(uuid, selectedFile, fileName, state = FileState.New) {
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
fileInfo = {
|
|
988
|
-
id: uuid,
|
|
989
|
-
name: fileName,
|
|
990
|
-
type: selectedFile.type,
|
|
991
|
-
source: "",
|
|
992
|
-
size: this.getFileSize(selectedFile.size),
|
|
993
|
-
fileSize: selectedFile.size,
|
|
994
|
-
picListDisplayName: this.getPicListDisplayName(fileName),
|
|
995
|
-
queueListDisplayName: this.getQueueDisplayName(fileName),
|
|
996
|
-
//content: reader.result.toString(),
|
|
997
|
-
hasUploaded: false,
|
|
998
|
-
mouseOn: false,
|
|
999
|
-
selectd: false,
|
|
1000
|
-
isUploading: true,
|
|
1001
|
-
uploadResult: false,
|
|
1002
|
-
uploadProcess: 0,
|
|
1003
|
-
errorMessage: "",
|
|
1004
|
-
extensionDropListId: 0,
|
|
1005
|
-
extensionName: "",
|
|
1006
|
-
securityDropListId: 0,
|
|
1007
|
-
securityInfo: this.securityInfoList[0]
|
|
1008
|
-
};
|
|
1009
|
-
if (this.storageExtension != null)
|
|
1010
|
-
fileInfo.extensionName = this.defaultPropertyName;
|
|
1011
|
-
/** @type {?} */
|
|
1012
|
-
let chunkTotal = Math.ceil(selectedFile.size / this.bufferSize);
|
|
1013
|
-
/** @type {?} */
|
|
1014
|
-
let chunkIndex = 0;
|
|
1015
|
-
this.fileTotalChunk[uuid] = chunkTotal;
|
|
1016
|
-
/** @type {?} */
|
|
1017
|
-
let uploadFileInfo = new UploadFileInfo();
|
|
1018
|
-
uploadFileInfo.metadataId = uuid;
|
|
1019
|
-
uploadFileInfo.fileName = fileInfo.name;
|
|
1020
|
-
uploadFileInfo.fileSize = fileInfo.size;
|
|
1021
|
-
uploadFileInfo.state = state;
|
|
1022
|
-
uploadFileInfo.securityInfo = this.securityInfoList[0];
|
|
1023
|
-
while (chunkIndex < chunkTotal) {
|
|
1024
|
-
/** @type {?} */
|
|
1025
|
-
let uploadInfo = new GspFormUploadEntity;
|
|
1026
|
-
uploadInfo.formId = this.formId;
|
|
1027
|
-
uploadInfo.mode = OperatingModes.Temp;
|
|
1028
|
-
uploadInfo.rootId = this.rootId;
|
|
1085
|
+
this.handleFileInfo(uuid, selectedFile, fileName).then((/**
|
|
1086
|
+
* @param {?} res
|
|
1087
|
+
* @return {?}
|
|
1088
|
+
*/
|
|
1089
|
+
res => {
|
|
1029
1090
|
/** @type {?} */
|
|
1030
|
-
let
|
|
1031
|
-
docInfo.fileName = fileName;
|
|
1032
|
-
docInfo.metadataId = uuid;
|
|
1033
|
-
docInfo.total = chunkTotal;
|
|
1034
|
-
this.uploadedChunk[docInfo.metadataId] = 0;
|
|
1091
|
+
let fileInfo = res;
|
|
1035
1092
|
/** @type {?} */
|
|
1036
|
-
let
|
|
1093
|
+
let chunkTotal = Math.ceil(selectedFile.size / this.bufferSize);
|
|
1037
1094
|
/** @type {?} */
|
|
1038
|
-
let
|
|
1039
|
-
|
|
1040
|
-
// reader.readAsBinaryString(fileData);
|
|
1095
|
+
let chunkIndex = 0;
|
|
1096
|
+
this.fileTotalChunk[uuid] = chunkTotal;
|
|
1041
1097
|
/** @type {?} */
|
|
1042
|
-
let
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1098
|
+
let uploadFileInfo = new UploadFileInfo();
|
|
1099
|
+
uploadFileInfo.metadataId = uuid;
|
|
1100
|
+
uploadFileInfo.fileName = fileInfo.name;
|
|
1101
|
+
uploadFileInfo.fileSize = fileInfo.size;
|
|
1102
|
+
uploadFileInfo.state = state;
|
|
1103
|
+
uploadFileInfo.securityInfo = this.securityInfoList[0];
|
|
1104
|
+
while (chunkIndex < chunkTotal) {
|
|
1105
|
+
/** @type {?} */
|
|
1106
|
+
let uploadInfo = new GspFormUploadEntity;
|
|
1107
|
+
uploadInfo.formId = this.formId;
|
|
1108
|
+
uploadInfo.mode = OperatingModes.Temp;
|
|
1109
|
+
uploadInfo.rootId = this.rootId;
|
|
1110
|
+
/** @type {?} */
|
|
1111
|
+
let docInfo = new GspFormDocInfo;
|
|
1112
|
+
docInfo.fileName = fileName;
|
|
1113
|
+
docInfo.metadataId = uuid;
|
|
1114
|
+
docInfo.total = chunkTotal;
|
|
1115
|
+
this.uploadedChunk[docInfo.metadataId] = 0;
|
|
1116
|
+
/** @type {?} */
|
|
1117
|
+
let nextSize = Math.min((chunkIndex + 1) * this.bufferSize, selectedFile.size);
|
|
1118
|
+
/** @type {?} */
|
|
1119
|
+
let fileData = selectedFile.slice(chunkIndex * this.bufferSize, nextSize);
|
|
1120
|
+
// let reader = new FileReader();
|
|
1121
|
+
// reader.readAsBinaryString(fileData);
|
|
1122
|
+
/** @type {?} */
|
|
1123
|
+
let innerIndex = chunkIndex;
|
|
1124
|
+
// reader.onload = () => {
|
|
1125
|
+
// docInfo.fileContent = btoa(reader.result.toString());
|
|
1126
|
+
docInfo.size = selectedFile.size;
|
|
1127
|
+
docInfo.index = innerIndex;
|
|
1128
|
+
docInfo.fileContent = "";
|
|
1129
|
+
//chunkIndex++;
|
|
1130
|
+
if (this.haveExtensionProperty)
|
|
1131
|
+
docInfo.exPropertyName = this.defaultPropertyName;
|
|
1132
|
+
//docInfo.isLast = true;
|
|
1133
|
+
uploadInfo.docInfo = docInfo;
|
|
1134
|
+
// let info = uploadInfo;
|
|
1135
|
+
// this.requestArray.push(this.uploadService.uploadFile(uploadInfo));
|
|
1136
|
+
// this.requestBodyArray.push(info);
|
|
1137
|
+
//封装请求formdata
|
|
1138
|
+
/** @type {?} */
|
|
1139
|
+
let formData = new FormData();
|
|
1140
|
+
formData.append('uploadInfo', JSON.stringify(uploadInfo));
|
|
1141
|
+
formData.append('docInfo', JSON.stringify(docInfo));
|
|
1142
|
+
formData.append('file', fileData);
|
|
1143
|
+
// }
|
|
1144
|
+
//console.log(chunkIndex + 1);
|
|
1145
|
+
chunkIndex = chunkIndex + 1;
|
|
1146
|
+
}
|
|
1057
1147
|
/** @type {?} */
|
|
1058
|
-
let
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
formData.append('file', fileData);
|
|
1062
|
-
this.uploadSliceFile(formData).subscribe((/**
|
|
1063
|
-
* @param {?} res
|
|
1148
|
+
let index = -1;
|
|
1149
|
+
this.files.forEach((/**
|
|
1150
|
+
* @param {?} x
|
|
1064
1151
|
* @return {?}
|
|
1065
1152
|
*/
|
|
1066
|
-
|
|
1067
|
-
if (
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
this.files[this.files.indexOf(fileInfo)].errorMessage = res.error.Message;
|
|
1071
|
-
}
|
|
1072
|
-
else {
|
|
1073
|
-
this.uploadedChunk[docInfo.metadataId]++;
|
|
1074
|
-
this.files[this.files.indexOf(fileInfo)].uploadProcess = Number.parseInt((this.uploadedChunk[docInfo.metadataId] / this.fileTotalChunk[docInfo.metadataId] * 100).toFixed(0));
|
|
1075
|
-
if (this.uploadedChunk[docInfo.metadataId] == this.fileTotalChunk[docInfo.metadataId]) {
|
|
1076
|
-
this.files[this.files.indexOf(fileInfo)].uploadResult = true;
|
|
1077
|
-
this.files[this.files.indexOf(fileInfo)].isUploading = false;
|
|
1078
|
-
this.uploadFileInfoList = this.uploadFileInfoList.concat(uploadFileInfo);
|
|
1079
|
-
this.uploadedFileInfoList = this.uploadedFileInfoList.concat(uploadFileInfo);
|
|
1080
|
-
this.uploadedFileTotal++;
|
|
1081
|
-
}
|
|
1153
|
+
x => {
|
|
1154
|
+
if (x.name == fileInfo.name) {
|
|
1155
|
+
if (index == -1)
|
|
1156
|
+
index = this.files.indexOf(x);
|
|
1082
1157
|
}
|
|
1083
1158
|
}));
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
else if (type.includes("plain")) {
|
|
1103
|
-
this.addDocInfo(selectedFile, fileInfo, DocType.Txt);
|
|
1104
|
-
}
|
|
1105
|
-
else if (type.includes("sheet") || type.includes("excel")) {
|
|
1106
|
-
this.addDocInfo(selectedFile, fileInfo, DocType.Excel);
|
|
1107
|
-
}
|
|
1108
|
-
else if (type.includes("powerpoint") || type.includes("presentation")) {
|
|
1109
|
-
this.addDocInfo(selectedFile, fileInfo, DocType.Powerpoint);
|
|
1110
|
-
}
|
|
1111
|
-
else {
|
|
1112
|
-
this.addDocInfo(selectedFile, fileInfo, DocType.Other);
|
|
1113
|
-
// let name: string = selectedFile.name;
|
|
1114
|
-
// let errType = name.substring(selectedFile.name.lastIndexOf('.'));
|
|
1115
|
-
// this.errTypeList.push(errType);
|
|
1116
|
-
}
|
|
1117
|
-
/** @type {?} */
|
|
1118
|
-
let index = -1;
|
|
1119
|
-
this.files.forEach((/**
|
|
1120
|
-
* @param {?} x
|
|
1159
|
+
if (index != -1 && index != this.files.length - 1) {
|
|
1160
|
+
this.files.splice(index, 1);
|
|
1161
|
+
this.uploadFileInfoList.splice(index, 1);
|
|
1162
|
+
this.uploadedFileInfoList.splice(index, 1);
|
|
1163
|
+
this.uploadedFileTotal--;
|
|
1164
|
+
}
|
|
1165
|
+
}));
|
|
1166
|
+
}
|
|
1167
|
+
/**
|
|
1168
|
+
* @param {?} formData
|
|
1169
|
+
* @param {?} fileInfo
|
|
1170
|
+
* @param {?} docInfo
|
|
1171
|
+
* @param {?} uploadFileInfo
|
|
1172
|
+
* @return {?}
|
|
1173
|
+
*/
|
|
1174
|
+
sendUploadRequest(formData, fileInfo, docInfo, uploadFileInfo) {
|
|
1175
|
+
this.uploadSliceFile(formData).subscribe((/**
|
|
1176
|
+
* @param {?} res
|
|
1121
1177
|
* @return {?}
|
|
1122
1178
|
*/
|
|
1123
|
-
|
|
1124
|
-
if (
|
|
1125
|
-
|
|
1126
|
-
|
|
1179
|
+
res => {
|
|
1180
|
+
if (res != null) {
|
|
1181
|
+
this.files[this.files.indexOf(fileInfo)].uploadResult = false;
|
|
1182
|
+
this.files[this.files.indexOf(fileInfo)].isUploading = false;
|
|
1183
|
+
this.files[this.files.indexOf(fileInfo)].errorMessage = res.error.Message;
|
|
1184
|
+
}
|
|
1185
|
+
else {
|
|
1186
|
+
this.uploadedChunk[docInfo.metadataId]++;
|
|
1187
|
+
this.files[this.files.indexOf(fileInfo)].uploadProcess = Number.parseInt((this.uploadedChunk[docInfo.metadataId] / this.fileTotalChunk[docInfo.metadataId] * 100).toFixed(0));
|
|
1188
|
+
if (this.uploadedChunk[docInfo.metadataId] == this.fileTotalChunk[docInfo.metadataId]) {
|
|
1189
|
+
this.files[this.files.indexOf(fileInfo)].uploadResult = true;
|
|
1190
|
+
this.files[this.files.indexOf(fileInfo)].isUploading = false;
|
|
1191
|
+
this.uploadFileInfoList = this.uploadFileInfoList.concat(uploadFileInfo);
|
|
1192
|
+
this.uploadedFileInfoList = this.uploadedFileInfoList.concat(uploadFileInfo);
|
|
1193
|
+
this.uploadedFileTotal++;
|
|
1194
|
+
}
|
|
1127
1195
|
}
|
|
1128
1196
|
}));
|
|
1129
|
-
if (index != -1 && index != this.files.length - 1) {
|
|
1130
|
-
this.files.splice(index, 1);
|
|
1131
|
-
this.uploadFileInfoList.splice(index, 1);
|
|
1132
|
-
this.uploadedFileInfoList.splice(index, 1);
|
|
1133
|
-
this.uploadedFileTotal--;
|
|
1134
|
-
}
|
|
1135
1197
|
}
|
|
1136
1198
|
/**
|
|
1137
1199
|
* @param {?} formdata
|
|
@@ -1312,59 +1374,85 @@ class FileUploadComponent {
|
|
|
1312
1374
|
* @return {?}
|
|
1313
1375
|
*/
|
|
1314
1376
|
addDocInfo(selectdFile, fileInfo, docType) {
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1377
|
+
return new Promise((/**
|
|
1378
|
+
* @param {?} resolve
|
|
1379
|
+
* @return {?}
|
|
1380
|
+
*/
|
|
1381
|
+
resolve => {
|
|
1382
|
+
switch (docType) {
|
|
1383
|
+
case DocType.Word: {
|
|
1384
|
+
fileInfo.source = "/platform/runtime/dfs/images/word.png";
|
|
1385
|
+
this.files.push(fileInfo);
|
|
1386
|
+
break;
|
|
1387
|
+
}
|
|
1388
|
+
case DocType.Pdf: {
|
|
1389
|
+
fileInfo.source = "/platform/runtime/dfs/images/pdf.png";
|
|
1390
|
+
this.files.push(fileInfo);
|
|
1391
|
+
break;
|
|
1392
|
+
}
|
|
1393
|
+
case DocType.Excel: {
|
|
1394
|
+
fileInfo.source = "/platform/runtime/dfs/images/excel.png";
|
|
1395
|
+
this.files.push(fileInfo);
|
|
1396
|
+
break;
|
|
1397
|
+
}
|
|
1398
|
+
case DocType.Txt: {
|
|
1399
|
+
fileInfo.source = "/platform/runtime/dfs/images/txt.png";
|
|
1400
|
+
this.files.push(fileInfo);
|
|
1401
|
+
break;
|
|
1402
|
+
}
|
|
1403
|
+
case DocType.Powerpoint: {
|
|
1404
|
+
fileInfo.source = "/platform/runtime/dfs/images/ppt.png";
|
|
1405
|
+
this.files.push(fileInfo);
|
|
1406
|
+
break;
|
|
1407
|
+
}
|
|
1408
|
+
case DocType.Other: {
|
|
1409
|
+
fileInfo.source = "/platform/runtime/dfs/images/file.png";
|
|
1410
|
+
this.files.push(fileInfo);
|
|
1411
|
+
break;
|
|
1412
|
+
}
|
|
1413
|
+
case DocType.Image: {
|
|
1414
|
+
this.getImageUrl(selectdFile).then((/**
|
|
1415
|
+
* @param {?} res
|
|
1416
|
+
* @return {?}
|
|
1417
|
+
*/
|
|
1418
|
+
res => {
|
|
1419
|
+
fileInfo.source = res;
|
|
1420
|
+
this.files.push(fileInfo);
|
|
1421
|
+
resolve(fileInfo);
|
|
1422
|
+
}));
|
|
1423
|
+
}
|
|
1345
1424
|
}
|
|
1346
|
-
|
|
1425
|
+
resolve(fileInfo);
|
|
1426
|
+
}));
|
|
1427
|
+
}
|
|
1428
|
+
/**
|
|
1429
|
+
* @param {?} selectdFile
|
|
1430
|
+
* @return {?}
|
|
1431
|
+
*/
|
|
1432
|
+
getImageUrl(selectdFile) {
|
|
1433
|
+
return new Promise((/**
|
|
1434
|
+
* @param {?} resolve
|
|
1435
|
+
* @return {?}
|
|
1436
|
+
*/
|
|
1437
|
+
resolve => {
|
|
1438
|
+
/** @type {?} */
|
|
1439
|
+
let reader = new FileReader();
|
|
1440
|
+
reader.readAsDataURL(selectdFile);
|
|
1441
|
+
reader.onload = (/**
|
|
1442
|
+
* @param {?} _event
|
|
1443
|
+
* @return {?}
|
|
1444
|
+
*/
|
|
1445
|
+
(_event) => {
|
|
1347
1446
|
/** @type {?} */
|
|
1348
|
-
let
|
|
1349
|
-
|
|
1350
|
-
reader.onload = (/**
|
|
1351
|
-
* @param {?} _event
|
|
1352
|
-
* @return {?}
|
|
1353
|
-
*/
|
|
1354
|
-
(_event) => {
|
|
1447
|
+
let imgUrl = reader.result;
|
|
1448
|
+
if (this.injector != null) {
|
|
1355
1449
|
/** @type {?} */
|
|
1356
|
-
let
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
else
|
|
1363
|
-
fileInfo.source = imgUrl;
|
|
1364
|
-
this.files.push(fileInfo);
|
|
1365
|
-
});
|
|
1366
|
-
break;
|
|
1367
|
-
}
|
|
1450
|
+
let sanitizer = this.injector.get(DomSanitizer);
|
|
1451
|
+
imgUrl = sanitizer.bypassSecurityTrustResourceUrl(imgUrl);
|
|
1452
|
+
}
|
|
1453
|
+
resolve(imgUrl);
|
|
1454
|
+
});
|
|
1455
|
+
}));
|
|
1368
1456
|
}
|
|
1369
1457
|
/**
|
|
1370
1458
|
* @param {?} strList
|
|
@@ -2059,6 +2147,6 @@ class SecurityEntity {
|
|
|
2059
2147
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2060
2148
|
*/
|
|
2061
2149
|
|
|
2062
|
-
export { FormdocUploadService, FormdocUploadComponent, FormdocUploadModule, UploadDialogMoudle, UploadDialogComponent, UploadDialogService, UploadService, DownloadService, FileUploadComponent, UploadFileInfo, UploadModule, ɵa, UploadLimit, GspFormDocOperateEntity, GspFormRemoveListEntity, GspFormUploadListEntity, GspFormDocInfo, GspDocMetaProperty, GspFormUploadEntity, FileInfo, OperatingModes, FileState, GspDocSecurityBaseInfo, SecurityEntity, ExStorageFileInfo, LocalLangPipe as ɵb };
|
|
2150
|
+
export { FormdocUploadService, FormdocUploadComponent, FormdocUploadModule, UploadDialogMoudle, UploadDialogComponent, UploadDialogService, UploadService, DownloadService, FileUploadComponent, UploadFileInfo, UploadModule, ɵa, UploadLimit, GspFormDocOperateEntity, GspFormRemoveListEntity, GspFormUploadListEntity, GspFormDocInfo, GspDocMetaProperty, GspFormUploadEntity, FileInfo, OperatingModes, FileState, GspDocSecurityBaseInfo, SecurityEntity, ExStorageFileInfo, CopyFileRequest, LocalLangPipe as ɵb };
|
|
2063
2151
|
|
|
2064
2152
|
//# sourceMappingURL=gsp-svc-formdoc-upload.js.map
|