@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,
|
|
14
|
+
import { Injectable, Pipe, Inject, LOCALE_ID, Injector, ComponentFactoryResolver, Component, ViewChild, Input, NgModule, 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';
|
|
@@ -157,6 +157,16 @@ var ChangeInstanceRequest = /** @class */ (function () {
|
|
|
157
157
|
return ChangeInstanceRequest;
|
|
158
158
|
}());
|
|
159
159
|
|
|
160
|
+
/**
|
|
161
|
+
* @fileoverview added by tsickle
|
|
162
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
163
|
+
*/
|
|
164
|
+
var CopyFileRequest = /** @class */ (function () {
|
|
165
|
+
function CopyFileRequest() {
|
|
166
|
+
}
|
|
167
|
+
return CopyFileRequest;
|
|
168
|
+
}());
|
|
169
|
+
|
|
160
170
|
/**
|
|
161
171
|
* @fileoverview added by tsickle
|
|
162
172
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -411,6 +421,38 @@ var UploadService = /** @class */ (function () {
|
|
|
411
421
|
return of(error);
|
|
412
422
|
})));
|
|
413
423
|
};
|
|
424
|
+
/**
|
|
425
|
+
* @param {?} metadataId
|
|
426
|
+
* @param {?} rootId
|
|
427
|
+
* @param {?} path
|
|
428
|
+
* @return {?}
|
|
429
|
+
*/
|
|
430
|
+
UploadService.prototype.copyFile = /**
|
|
431
|
+
* @param {?} metadataId
|
|
432
|
+
* @param {?} rootId
|
|
433
|
+
* @param {?} path
|
|
434
|
+
* @return {?}
|
|
435
|
+
*/
|
|
436
|
+
function (metadataId, rootId, path) {
|
|
437
|
+
/** @type {?} */
|
|
438
|
+
var url = "/api/runtime/dfs/v1.0/formdoc/copy";
|
|
439
|
+
/** @type {?} */
|
|
440
|
+
var request = new CopyFileRequest;
|
|
441
|
+
request.metadataId = metadataId;
|
|
442
|
+
request.rootId = rootId;
|
|
443
|
+
request.path = path;
|
|
444
|
+
return this.http.post(url, request).pipe(tap((/**
|
|
445
|
+
* @param {?} res
|
|
446
|
+
* @return {?}
|
|
447
|
+
*/
|
|
448
|
+
function (res) { })), catchError((/**
|
|
449
|
+
* @param {?} error
|
|
450
|
+
* @return {?}
|
|
451
|
+
*/
|
|
452
|
+
function (error) {
|
|
453
|
+
return of(error);
|
|
454
|
+
})));
|
|
455
|
+
};
|
|
414
456
|
/**
|
|
415
457
|
* @param {?} uploadFileInfoList
|
|
416
458
|
* @param {?} rootId
|
|
@@ -752,7 +794,7 @@ var FileUploadComponent = /** @class */ (function () {
|
|
|
752
794
|
this.beyondFileList = [];
|
|
753
795
|
this.showType = 0;
|
|
754
796
|
this.mouseOn = false;
|
|
755
|
-
this.bufferSize = 1024 * 1024;
|
|
797
|
+
this.bufferSize = 10 * 1024 * 1024;
|
|
756
798
|
this.selectedFileCount = 0;
|
|
757
799
|
this.uploadIconAddress = '/platform/runtime/dfs/images/upload.svg';
|
|
758
800
|
this.uploadLittleIconAddress = '/platform/runtime/dfs/images/uploadIcon.svg';
|
|
@@ -1076,6 +1118,83 @@ var FileUploadComponent = /** @class */ (function () {
|
|
|
1076
1118
|
function (file) {
|
|
1077
1119
|
this.msgService.error(this.localepipe.transform('uploadFailure') + file.errorMessage);
|
|
1078
1120
|
};
|
|
1121
|
+
/**
|
|
1122
|
+
* @param {?} uuid
|
|
1123
|
+
* @param {?} selectedFile
|
|
1124
|
+
* @param {?} fileName
|
|
1125
|
+
* @return {?}
|
|
1126
|
+
*/
|
|
1127
|
+
FileUploadComponent.prototype.handleFileInfo = /**
|
|
1128
|
+
* @param {?} uuid
|
|
1129
|
+
* @param {?} selectedFile
|
|
1130
|
+
* @param {?} fileName
|
|
1131
|
+
* @return {?}
|
|
1132
|
+
*/
|
|
1133
|
+
function (uuid, selectedFile, fileName) {
|
|
1134
|
+
var _this = this;
|
|
1135
|
+
return new Promise((/**
|
|
1136
|
+
* @param {?} resolve
|
|
1137
|
+
* @return {?}
|
|
1138
|
+
*/
|
|
1139
|
+
function (resolve) {
|
|
1140
|
+
/** @type {?} */
|
|
1141
|
+
var fileInfo;
|
|
1142
|
+
fileInfo = {
|
|
1143
|
+
id: uuid,
|
|
1144
|
+
name: fileName,
|
|
1145
|
+
type: selectedFile.type,
|
|
1146
|
+
source: "",
|
|
1147
|
+
size: _this.getFileSize(selectedFile.size),
|
|
1148
|
+
fileSize: selectedFile.size,
|
|
1149
|
+
picListDisplayName: _this.getPicListDisplayName(fileName),
|
|
1150
|
+
queueListDisplayName: _this.getQueueDisplayName(fileName),
|
|
1151
|
+
//content: reader.result.toString(),
|
|
1152
|
+
hasUploaded: false,
|
|
1153
|
+
mouseOn: false,
|
|
1154
|
+
selectd: false,
|
|
1155
|
+
isUploading: true,
|
|
1156
|
+
uploadResult: false,
|
|
1157
|
+
uploadProcess: 0,
|
|
1158
|
+
errorMessage: "",
|
|
1159
|
+
extensionDropListId: 0,
|
|
1160
|
+
extensionName: "",
|
|
1161
|
+
securityDropListId: 0,
|
|
1162
|
+
securityInfo: _this.securityInfoList[0]
|
|
1163
|
+
};
|
|
1164
|
+
if (_this.storageExtension != null)
|
|
1165
|
+
fileInfo.extensionName = _this.defaultPropertyName;
|
|
1166
|
+
/** @type {?} */
|
|
1167
|
+
var type = selectedFile.type;
|
|
1168
|
+
if (type.includes("tiff")) {
|
|
1169
|
+
_this.addDocInfo(selectedFile, fileInfo, DocType.Other);
|
|
1170
|
+
}
|
|
1171
|
+
else if (type.includes("image")) {
|
|
1172
|
+
_this.addDocInfo(selectedFile, fileInfo, DocType.Image);
|
|
1173
|
+
}
|
|
1174
|
+
else if (type.includes("word")) {
|
|
1175
|
+
_this.addDocInfo(selectedFile, fileInfo, DocType.Word);
|
|
1176
|
+
}
|
|
1177
|
+
else if (type.includes("pdf")) {
|
|
1178
|
+
_this.addDocInfo(selectedFile, fileInfo, DocType.Pdf);
|
|
1179
|
+
}
|
|
1180
|
+
else if (type.includes("plain")) {
|
|
1181
|
+
_this.addDocInfo(selectedFile, fileInfo, DocType.Txt);
|
|
1182
|
+
}
|
|
1183
|
+
else if (type.includes("sheet") || type.includes("excel")) {
|
|
1184
|
+
_this.addDocInfo(selectedFile, fileInfo, DocType.Excel);
|
|
1185
|
+
}
|
|
1186
|
+
else if (type.includes("powerpoint") || type.includes("presentation")) {
|
|
1187
|
+
_this.addDocInfo(selectedFile, fileInfo, DocType.Powerpoint);
|
|
1188
|
+
}
|
|
1189
|
+
else {
|
|
1190
|
+
_this.addDocInfo(selectedFile, fileInfo, DocType.Other);
|
|
1191
|
+
// let name: string = selectedFile.name;
|
|
1192
|
+
// let errType = name.substring(selectedFile.name.lastIndexOf('.'));
|
|
1193
|
+
// this.errTypeList.push(errType);
|
|
1194
|
+
}
|
|
1195
|
+
resolve(fileInfo);
|
|
1196
|
+
}));
|
|
1197
|
+
};
|
|
1079
1198
|
/**
|
|
1080
1199
|
* @param {?} uuid
|
|
1081
1200
|
* @param {?} selectedFile
|
|
@@ -1093,163 +1212,126 @@ var FileUploadComponent = /** @class */ (function () {
|
|
|
1093
1212
|
function (uuid, selectedFile, fileName, state) {
|
|
1094
1213
|
var _this = this;
|
|
1095
1214
|
if (state === void 0) { state = FileState.New; }
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
fileInfo = {
|
|
1102
|
-
id: uuid,
|
|
1103
|
-
name: fileName,
|
|
1104
|
-
type: selectedFile.type,
|
|
1105
|
-
source: "",
|
|
1106
|
-
size: this.getFileSize(selectedFile.size),
|
|
1107
|
-
fileSize: selectedFile.size,
|
|
1108
|
-
picListDisplayName: this.getPicListDisplayName(fileName),
|
|
1109
|
-
queueListDisplayName: this.getQueueDisplayName(fileName),
|
|
1110
|
-
//content: reader.result.toString(),
|
|
1111
|
-
hasUploaded: false,
|
|
1112
|
-
mouseOn: false,
|
|
1113
|
-
selectd: false,
|
|
1114
|
-
isUploading: true,
|
|
1115
|
-
uploadResult: false,
|
|
1116
|
-
uploadProcess: 0,
|
|
1117
|
-
errorMessage: "",
|
|
1118
|
-
extensionDropListId: 0,
|
|
1119
|
-
extensionName: "",
|
|
1120
|
-
securityDropListId: 0,
|
|
1121
|
-
securityInfo: this.securityInfoList[0]
|
|
1122
|
-
};
|
|
1123
|
-
if (this.storageExtension != null)
|
|
1124
|
-
fileInfo.extensionName = this.defaultPropertyName;
|
|
1125
|
-
/** @type {?} */
|
|
1126
|
-
var chunkTotal = Math.ceil(selectedFile.size / this.bufferSize);
|
|
1127
|
-
/** @type {?} */
|
|
1128
|
-
var chunkIndex = 0;
|
|
1129
|
-
this.fileTotalChunk[uuid] = chunkTotal;
|
|
1130
|
-
/** @type {?} */
|
|
1131
|
-
var uploadFileInfo = new UploadFileInfo();
|
|
1132
|
-
uploadFileInfo.metadataId = uuid;
|
|
1133
|
-
uploadFileInfo.fileName = fileInfo.name;
|
|
1134
|
-
uploadFileInfo.fileSize = fileInfo.size;
|
|
1135
|
-
uploadFileInfo.state = state;
|
|
1136
|
-
uploadFileInfo.securityInfo = this.securityInfoList[0];
|
|
1137
|
-
var _loop_2 = function () {
|
|
1138
|
-
/** @type {?} */
|
|
1139
|
-
var uploadInfo = new GspFormUploadEntity;
|
|
1140
|
-
uploadInfo.formId = this_2.formId;
|
|
1141
|
-
uploadInfo.mode = OperatingModes.Temp;
|
|
1142
|
-
uploadInfo.rootId = this_2.rootId;
|
|
1215
|
+
this.handleFileInfo(uuid, selectedFile, fileName).then((/**
|
|
1216
|
+
* @param {?} res
|
|
1217
|
+
* @return {?}
|
|
1218
|
+
*/
|
|
1219
|
+
function (res) {
|
|
1143
1220
|
/** @type {?} */
|
|
1144
|
-
var
|
|
1145
|
-
docInfo.fileName = fileName;
|
|
1146
|
-
docInfo.metadataId = uuid;
|
|
1147
|
-
docInfo.total = chunkTotal;
|
|
1148
|
-
this_2.uploadedChunk[docInfo.metadataId] = 0;
|
|
1221
|
+
var fileInfo = res;
|
|
1149
1222
|
/** @type {?} */
|
|
1150
|
-
var
|
|
1223
|
+
var chunkTotal = Math.ceil(selectedFile.size / _this.bufferSize);
|
|
1151
1224
|
/** @type {?} */
|
|
1152
|
-
var
|
|
1153
|
-
|
|
1154
|
-
// reader.readAsBinaryString(fileData);
|
|
1225
|
+
var chunkIndex = 0;
|
|
1226
|
+
_this.fileTotalChunk[uuid] = chunkTotal;
|
|
1155
1227
|
/** @type {?} */
|
|
1156
|
-
var
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1228
|
+
var uploadFileInfo = new UploadFileInfo();
|
|
1229
|
+
uploadFileInfo.metadataId = uuid;
|
|
1230
|
+
uploadFileInfo.fileName = fileInfo.name;
|
|
1231
|
+
uploadFileInfo.fileSize = fileInfo.size;
|
|
1232
|
+
uploadFileInfo.state = state;
|
|
1233
|
+
uploadFileInfo.securityInfo = _this.securityInfoList[0];
|
|
1234
|
+
while (chunkIndex < chunkTotal) {
|
|
1235
|
+
/** @type {?} */
|
|
1236
|
+
var uploadInfo = new GspFormUploadEntity;
|
|
1237
|
+
uploadInfo.formId = _this.formId;
|
|
1238
|
+
uploadInfo.mode = OperatingModes.Temp;
|
|
1239
|
+
uploadInfo.rootId = _this.rootId;
|
|
1240
|
+
/** @type {?} */
|
|
1241
|
+
var docInfo = new GspFormDocInfo;
|
|
1242
|
+
docInfo.fileName = fileName;
|
|
1243
|
+
docInfo.metadataId = uuid;
|
|
1244
|
+
docInfo.total = chunkTotal;
|
|
1245
|
+
_this.uploadedChunk[docInfo.metadataId] = 0;
|
|
1246
|
+
/** @type {?} */
|
|
1247
|
+
var nextSize = Math.min((chunkIndex + 1) * _this.bufferSize, selectedFile.size);
|
|
1248
|
+
/** @type {?} */
|
|
1249
|
+
var fileData = selectedFile.slice(chunkIndex * _this.bufferSize, nextSize);
|
|
1250
|
+
// let reader = new FileReader();
|
|
1251
|
+
// reader.readAsBinaryString(fileData);
|
|
1252
|
+
/** @type {?} */
|
|
1253
|
+
var innerIndex = chunkIndex;
|
|
1254
|
+
// reader.onload = () => {
|
|
1255
|
+
// docInfo.fileContent = btoa(reader.result.toString());
|
|
1256
|
+
docInfo.size = selectedFile.size;
|
|
1257
|
+
docInfo.index = innerIndex;
|
|
1258
|
+
docInfo.fileContent = "";
|
|
1259
|
+
//chunkIndex++;
|
|
1260
|
+
if (_this.haveExtensionProperty)
|
|
1261
|
+
docInfo.exPropertyName = _this.defaultPropertyName;
|
|
1262
|
+
//docInfo.isLast = true;
|
|
1263
|
+
uploadInfo.docInfo = docInfo;
|
|
1264
|
+
// let info = uploadInfo;
|
|
1265
|
+
// this.requestArray.push(this.uploadService.uploadFile(uploadInfo));
|
|
1266
|
+
// this.requestBodyArray.push(info);
|
|
1267
|
+
//封装请求formdata
|
|
1268
|
+
/** @type {?} */
|
|
1269
|
+
var formData = new FormData();
|
|
1270
|
+
formData.append('uploadInfo', JSON.stringify(uploadInfo));
|
|
1271
|
+
formData.append('docInfo', JSON.stringify(docInfo));
|
|
1272
|
+
formData.append('file', fileData);
|
|
1273
|
+
// }
|
|
1274
|
+
//console.log(chunkIndex + 1);
|
|
1275
|
+
chunkIndex = chunkIndex + 1;
|
|
1276
|
+
}
|
|
1171
1277
|
/** @type {?} */
|
|
1172
|
-
var
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
formData.append('file', fileData);
|
|
1176
|
-
this_2.uploadSliceFile(formData).subscribe((/**
|
|
1177
|
-
* @param {?} res
|
|
1278
|
+
var index = -1;
|
|
1279
|
+
_this.files.forEach((/**
|
|
1280
|
+
* @param {?} x
|
|
1178
1281
|
* @return {?}
|
|
1179
1282
|
*/
|
|
1180
|
-
function (
|
|
1181
|
-
if (
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
_this.files[_this.files.indexOf(fileInfo)].errorMessage = res.error.Message;
|
|
1185
|
-
}
|
|
1186
|
-
else {
|
|
1187
|
-
_this.uploadedChunk[docInfo.metadataId]++;
|
|
1188
|
-
_this.files[_this.files.indexOf(fileInfo)].uploadProcess = Number.parseInt((_this.uploadedChunk[docInfo.metadataId] / _this.fileTotalChunk[docInfo.metadataId] * 100).toFixed(0));
|
|
1189
|
-
if (_this.uploadedChunk[docInfo.metadataId] == _this.fileTotalChunk[docInfo.metadataId]) {
|
|
1190
|
-
_this.files[_this.files.indexOf(fileInfo)].uploadResult = true;
|
|
1191
|
-
_this.files[_this.files.indexOf(fileInfo)].isUploading = false;
|
|
1192
|
-
_this.uploadFileInfoList = _this.uploadFileInfoList.concat(uploadFileInfo);
|
|
1193
|
-
_this.uploadedFileInfoList = _this.uploadedFileInfoList.concat(uploadFileInfo);
|
|
1194
|
-
_this.uploadedFileTotal++;
|
|
1195
|
-
}
|
|
1283
|
+
function (x) {
|
|
1284
|
+
if (x.name == fileInfo.name) {
|
|
1285
|
+
if (index == -1)
|
|
1286
|
+
index = _this.files.indexOf(x);
|
|
1196
1287
|
}
|
|
1197
1288
|
}));
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
this.addDocInfo(selectedFile, fileInfo, DocType.Excel);
|
|
1225
|
-
}
|
|
1226
|
-
else if (type.includes("powerpoint") || type.includes("presentation")) {
|
|
1227
|
-
this.addDocInfo(selectedFile, fileInfo, DocType.Powerpoint);
|
|
1228
|
-
}
|
|
1229
|
-
else {
|
|
1230
|
-
this.addDocInfo(selectedFile, fileInfo, DocType.Other);
|
|
1231
|
-
// let name: string = selectedFile.name;
|
|
1232
|
-
// let errType = name.substring(selectedFile.name.lastIndexOf('.'));
|
|
1233
|
-
// this.errTypeList.push(errType);
|
|
1234
|
-
}
|
|
1235
|
-
/** @type {?} */
|
|
1236
|
-
var index = -1;
|
|
1237
|
-
this.files.forEach((/**
|
|
1238
|
-
* @param {?} x
|
|
1289
|
+
if (index != -1 && index != _this.files.length - 1) {
|
|
1290
|
+
_this.files.splice(index, 1);
|
|
1291
|
+
_this.uploadFileInfoList.splice(index, 1);
|
|
1292
|
+
_this.uploadedFileInfoList.splice(index, 1);
|
|
1293
|
+
_this.uploadedFileTotal--;
|
|
1294
|
+
}
|
|
1295
|
+
}));
|
|
1296
|
+
};
|
|
1297
|
+
/**
|
|
1298
|
+
* @param {?} formData
|
|
1299
|
+
* @param {?} fileInfo
|
|
1300
|
+
* @param {?} docInfo
|
|
1301
|
+
* @param {?} uploadFileInfo
|
|
1302
|
+
* @return {?}
|
|
1303
|
+
*/
|
|
1304
|
+
FileUploadComponent.prototype.sendUploadRequest = /**
|
|
1305
|
+
* @param {?} formData
|
|
1306
|
+
* @param {?} fileInfo
|
|
1307
|
+
* @param {?} docInfo
|
|
1308
|
+
* @param {?} uploadFileInfo
|
|
1309
|
+
* @return {?}
|
|
1310
|
+
*/
|
|
1311
|
+
function (formData, fileInfo, docInfo, uploadFileInfo) {
|
|
1312
|
+
var _this = this;
|
|
1313
|
+
this.uploadSliceFile(formData).subscribe((/**
|
|
1314
|
+
* @param {?} res
|
|
1239
1315
|
* @return {?}
|
|
1240
1316
|
*/
|
|
1241
|
-
function (
|
|
1242
|
-
if (
|
|
1243
|
-
|
|
1244
|
-
|
|
1317
|
+
function (res) {
|
|
1318
|
+
if (res != null) {
|
|
1319
|
+
_this.files[_this.files.indexOf(fileInfo)].uploadResult = false;
|
|
1320
|
+
_this.files[_this.files.indexOf(fileInfo)].isUploading = false;
|
|
1321
|
+
_this.files[_this.files.indexOf(fileInfo)].errorMessage = res.error.Message;
|
|
1322
|
+
}
|
|
1323
|
+
else {
|
|
1324
|
+
_this.uploadedChunk[docInfo.metadataId]++;
|
|
1325
|
+
_this.files[_this.files.indexOf(fileInfo)].uploadProcess = Number.parseInt((_this.uploadedChunk[docInfo.metadataId] / _this.fileTotalChunk[docInfo.metadataId] * 100).toFixed(0));
|
|
1326
|
+
if (_this.uploadedChunk[docInfo.metadataId] == _this.fileTotalChunk[docInfo.metadataId]) {
|
|
1327
|
+
_this.files[_this.files.indexOf(fileInfo)].uploadResult = true;
|
|
1328
|
+
_this.files[_this.files.indexOf(fileInfo)].isUploading = false;
|
|
1329
|
+
_this.uploadFileInfoList = _this.uploadFileInfoList.concat(uploadFileInfo);
|
|
1330
|
+
_this.uploadedFileInfoList = _this.uploadedFileInfoList.concat(uploadFileInfo);
|
|
1331
|
+
_this.uploadedFileTotal++;
|
|
1332
|
+
}
|
|
1245
1333
|
}
|
|
1246
1334
|
}));
|
|
1247
|
-
if (index != -1 && index != this.files.length - 1) {
|
|
1248
|
-
this.files.splice(index, 1);
|
|
1249
|
-
this.uploadFileInfoList.splice(index, 1);
|
|
1250
|
-
this.uploadedFileInfoList.splice(index, 1);
|
|
1251
|
-
this.uploadedFileTotal--;
|
|
1252
|
-
}
|
|
1253
1335
|
};
|
|
1254
1336
|
/**
|
|
1255
1337
|
* @param {?} formdata
|
|
@@ -1464,59 +1546,90 @@ var FileUploadComponent = /** @class */ (function () {
|
|
|
1464
1546
|
*/
|
|
1465
1547
|
function (selectdFile, fileInfo, docType) {
|
|
1466
1548
|
var _this = this;
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1549
|
+
return new Promise((/**
|
|
1550
|
+
* @param {?} resolve
|
|
1551
|
+
* @return {?}
|
|
1552
|
+
*/
|
|
1553
|
+
function (resolve) {
|
|
1554
|
+
switch (docType) {
|
|
1555
|
+
case DocType.Word: {
|
|
1556
|
+
fileInfo.source = "/platform/runtime/dfs/images/word.png";
|
|
1557
|
+
_this.files.push(fileInfo);
|
|
1558
|
+
break;
|
|
1559
|
+
}
|
|
1560
|
+
case DocType.Pdf: {
|
|
1561
|
+
fileInfo.source = "/platform/runtime/dfs/images/pdf.png";
|
|
1562
|
+
_this.files.push(fileInfo);
|
|
1563
|
+
break;
|
|
1564
|
+
}
|
|
1565
|
+
case DocType.Excel: {
|
|
1566
|
+
fileInfo.source = "/platform/runtime/dfs/images/excel.png";
|
|
1567
|
+
_this.files.push(fileInfo);
|
|
1568
|
+
break;
|
|
1569
|
+
}
|
|
1570
|
+
case DocType.Txt: {
|
|
1571
|
+
fileInfo.source = "/platform/runtime/dfs/images/txt.png";
|
|
1572
|
+
_this.files.push(fileInfo);
|
|
1573
|
+
break;
|
|
1574
|
+
}
|
|
1575
|
+
case DocType.Powerpoint: {
|
|
1576
|
+
fileInfo.source = "/platform/runtime/dfs/images/ppt.png";
|
|
1577
|
+
_this.files.push(fileInfo);
|
|
1578
|
+
break;
|
|
1579
|
+
}
|
|
1580
|
+
case DocType.Other: {
|
|
1581
|
+
fileInfo.source = "/platform/runtime/dfs/images/file.png";
|
|
1582
|
+
_this.files.push(fileInfo);
|
|
1583
|
+
break;
|
|
1584
|
+
}
|
|
1585
|
+
case DocType.Image: {
|
|
1586
|
+
_this.getImageUrl(selectdFile).then((/**
|
|
1587
|
+
* @param {?} res
|
|
1588
|
+
* @return {?}
|
|
1589
|
+
*/
|
|
1590
|
+
function (res) {
|
|
1591
|
+
fileInfo.source = res;
|
|
1592
|
+
_this.files.push(fileInfo);
|
|
1593
|
+
resolve(fileInfo);
|
|
1594
|
+
}));
|
|
1595
|
+
}
|
|
1497
1596
|
}
|
|
1498
|
-
|
|
1597
|
+
resolve(fileInfo);
|
|
1598
|
+
}));
|
|
1599
|
+
};
|
|
1600
|
+
/**
|
|
1601
|
+
* @param {?} selectdFile
|
|
1602
|
+
* @return {?}
|
|
1603
|
+
*/
|
|
1604
|
+
FileUploadComponent.prototype.getImageUrl = /**
|
|
1605
|
+
* @param {?} selectdFile
|
|
1606
|
+
* @return {?}
|
|
1607
|
+
*/
|
|
1608
|
+
function (selectdFile) {
|
|
1609
|
+
var _this = this;
|
|
1610
|
+
return new Promise((/**
|
|
1611
|
+
* @param {?} resolve
|
|
1612
|
+
* @return {?}
|
|
1613
|
+
*/
|
|
1614
|
+
function (resolve) {
|
|
1615
|
+
/** @type {?} */
|
|
1616
|
+
var reader = new FileReader();
|
|
1617
|
+
reader.readAsDataURL(selectdFile);
|
|
1618
|
+
reader.onload = (/**
|
|
1619
|
+
* @param {?} _event
|
|
1620
|
+
* @return {?}
|
|
1621
|
+
*/
|
|
1622
|
+
function (_event) {
|
|
1499
1623
|
/** @type {?} */
|
|
1500
|
-
var
|
|
1501
|
-
|
|
1502
|
-
reader_1.onload = (/**
|
|
1503
|
-
* @param {?} _event
|
|
1504
|
-
* @return {?}
|
|
1505
|
-
*/
|
|
1506
|
-
function (_event) {
|
|
1624
|
+
var imgUrl = reader.result;
|
|
1625
|
+
if (_this.injector != null) {
|
|
1507
1626
|
/** @type {?} */
|
|
1508
|
-
var
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
else
|
|
1515
|
-
fileInfo.source = imgUrl;
|
|
1516
|
-
_this.files.push(fileInfo);
|
|
1517
|
-
});
|
|
1518
|
-
break;
|
|
1519
|
-
}
|
|
1627
|
+
var sanitizer = _this.injector.get(DomSanitizer);
|
|
1628
|
+
imgUrl = sanitizer.bypassSecurityTrustResourceUrl(imgUrl);
|
|
1629
|
+
}
|
|
1630
|
+
resolve(imgUrl);
|
|
1631
|
+
});
|
|
1632
|
+
}));
|
|
1520
1633
|
};
|
|
1521
1634
|
/**
|
|
1522
1635
|
* @param {?} strList
|
|
@@ -2344,6 +2457,6 @@ var SecurityEntity = /** @class */ (function () {
|
|
|
2344
2457
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2345
2458
|
*/
|
|
2346
2459
|
|
|
2347
|
-
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 };
|
|
2460
|
+
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 };
|
|
2348
2461
|
|
|
2349
2462
|
//# sourceMappingURL=gsp-svc-formdoc-upload.js.map
|