@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
|
@@ -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, Injector, ComponentFactoryResolver,
|
|
14
|
+
import { Injectable, Pipe, Inject, LOCALE_ID, Component, NgModule, Injector, ComponentFactoryResolver, ViewChild, Input, 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';
|
|
@@ -441,17 +441,11 @@ var UploadService = /** @class */ (function () {
|
|
|
441
441
|
request.metadataId = metadataId;
|
|
442
442
|
request.rootId = rootId;
|
|
443
443
|
request.path = path;
|
|
444
|
-
return this.
|
|
444
|
+
return this.httpclient.post(url, request, { responseType: 'text' }).pipe(tap((/**
|
|
445
445
|
* @param {?} res
|
|
446
446
|
* @return {?}
|
|
447
447
|
*/
|
|
448
|
-
function (res) { }))
|
|
449
|
-
* @param {?} error
|
|
450
|
-
* @return {?}
|
|
451
|
-
*/
|
|
452
|
-
function (error) {
|
|
453
|
-
return of(error);
|
|
454
|
-
})));
|
|
448
|
+
function (res) { })));
|
|
455
449
|
};
|
|
456
450
|
/**
|
|
457
451
|
* @param {?} uploadFileInfoList
|
|
@@ -1131,69 +1125,62 @@ var FileUploadComponent = /** @class */ (function () {
|
|
|
1131
1125
|
* @return {?}
|
|
1132
1126
|
*/
|
|
1133
1127
|
function (uuid, selectedFile, fileName) {
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
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
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
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
|
-
}));
|
|
1128
|
+
/** @type {?} */
|
|
1129
|
+
var fileInfo;
|
|
1130
|
+
fileInfo = {
|
|
1131
|
+
id: uuid,
|
|
1132
|
+
name: fileName,
|
|
1133
|
+
type: selectedFile.type,
|
|
1134
|
+
source: "",
|
|
1135
|
+
size: this.getFileSize(selectedFile.size),
|
|
1136
|
+
fileSize: selectedFile.size,
|
|
1137
|
+
picListDisplayName: this.getPicListDisplayName(fileName),
|
|
1138
|
+
queueListDisplayName: this.getQueueDisplayName(fileName),
|
|
1139
|
+
//content: reader.result.toString(),
|
|
1140
|
+
hasUploaded: false,
|
|
1141
|
+
mouseOn: false,
|
|
1142
|
+
selectd: false,
|
|
1143
|
+
isUploading: true,
|
|
1144
|
+
uploadResult: false,
|
|
1145
|
+
uploadProcess: 0,
|
|
1146
|
+
errorMessage: "",
|
|
1147
|
+
extensionDropListId: 0,
|
|
1148
|
+
extensionName: "",
|
|
1149
|
+
securityDropListId: 0,
|
|
1150
|
+
securityInfo: this.securityInfoList[0]
|
|
1151
|
+
};
|
|
1152
|
+
if (this.storageExtension != null)
|
|
1153
|
+
fileInfo.extensionName = this.defaultPropertyName;
|
|
1154
|
+
/** @type {?} */
|
|
1155
|
+
var type = selectedFile.type;
|
|
1156
|
+
if (type.includes("tiff")) {
|
|
1157
|
+
this.addDocInfo(selectedFile, fileInfo, DocType.Other);
|
|
1158
|
+
}
|
|
1159
|
+
else if (type.includes("image")) {
|
|
1160
|
+
this.addDocInfo(selectedFile, fileInfo, DocType.Image);
|
|
1161
|
+
}
|
|
1162
|
+
else if (type.includes("word")) {
|
|
1163
|
+
this.addDocInfo(selectedFile, fileInfo, DocType.Word);
|
|
1164
|
+
}
|
|
1165
|
+
else if (type.includes("pdf")) {
|
|
1166
|
+
this.addDocInfo(selectedFile, fileInfo, DocType.Pdf);
|
|
1167
|
+
}
|
|
1168
|
+
else if (type.includes("plain")) {
|
|
1169
|
+
this.addDocInfo(selectedFile, fileInfo, DocType.Txt);
|
|
1170
|
+
}
|
|
1171
|
+
else if (type.includes("sheet") || type.includes("excel")) {
|
|
1172
|
+
this.addDocInfo(selectedFile, fileInfo, DocType.Excel);
|
|
1173
|
+
}
|
|
1174
|
+
else if (type.includes("powerpoint") || type.includes("presentation")) {
|
|
1175
|
+
this.addDocInfo(selectedFile, fileInfo, DocType.Powerpoint);
|
|
1176
|
+
}
|
|
1177
|
+
else {
|
|
1178
|
+
this.addDocInfo(selectedFile, fileInfo, DocType.Other);
|
|
1179
|
+
// let name: string = selectedFile.name;
|
|
1180
|
+
// let errType = name.substring(selectedFile.name.lastIndexOf('.'));
|
|
1181
|
+
// this.errTypeList.push(errType);
|
|
1182
|
+
}
|
|
1183
|
+
return fileInfo;
|
|
1197
1184
|
};
|
|
1198
1185
|
/**
|
|
1199
1186
|
* @param {?} uuid
|
|
@@ -1212,87 +1199,82 @@ var FileUploadComponent = /** @class */ (function () {
|
|
|
1212
1199
|
function (uuid, selectedFile, fileName, state) {
|
|
1213
1200
|
var _this = this;
|
|
1214
1201
|
if (state === void 0) { state = FileState.New; }
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1202
|
+
/** @type {?} */
|
|
1203
|
+
var fileInfo = this.handleFileInfo(uuid, selectedFile, fileName);
|
|
1204
|
+
/** @type {?} */
|
|
1205
|
+
var chunkTotal = Math.ceil(selectedFile.size / this.bufferSize);
|
|
1206
|
+
/** @type {?} */
|
|
1207
|
+
var chunkIndex = 0;
|
|
1208
|
+
this.fileTotalChunk[uuid] = chunkTotal;
|
|
1209
|
+
/** @type {?} */
|
|
1210
|
+
var uploadFileInfo = new UploadFileInfo();
|
|
1211
|
+
uploadFileInfo.metadataId = uuid;
|
|
1212
|
+
uploadFileInfo.fileName = fileInfo.name;
|
|
1213
|
+
uploadFileInfo.fileSize = fileInfo.size;
|
|
1214
|
+
uploadFileInfo.state = state;
|
|
1215
|
+
uploadFileInfo.securityInfo = this.securityInfoList[0];
|
|
1216
|
+
while (chunkIndex < chunkTotal) {
|
|
1220
1217
|
/** @type {?} */
|
|
1221
|
-
var
|
|
1218
|
+
var uploadInfo = new GspFormUploadEntity;
|
|
1219
|
+
uploadInfo.formId = this.formId;
|
|
1220
|
+
uploadInfo.mode = OperatingModes.Temp;
|
|
1221
|
+
uploadInfo.rootId = this.rootId;
|
|
1222
1222
|
/** @type {?} */
|
|
1223
|
-
var
|
|
1223
|
+
var docInfo = new GspFormDocInfo;
|
|
1224
|
+
docInfo.fileName = fileName;
|
|
1225
|
+
docInfo.metadataId = uuid;
|
|
1226
|
+
docInfo.total = chunkTotal;
|
|
1227
|
+
this.uploadedChunk[docInfo.metadataId] = 0;
|
|
1224
1228
|
/** @type {?} */
|
|
1225
|
-
var
|
|
1226
|
-
_this.fileTotalChunk[uuid] = chunkTotal;
|
|
1229
|
+
var nextSize = Math.min((chunkIndex + 1) * this.bufferSize, selectedFile.size);
|
|
1227
1230
|
/** @type {?} */
|
|
1228
|
-
var
|
|
1229
|
-
|
|
1230
|
-
|
|
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
|
-
}
|
|
1231
|
+
var fileData = selectedFile.slice(chunkIndex * this.bufferSize, nextSize);
|
|
1232
|
+
// let reader = new FileReader();
|
|
1233
|
+
// reader.readAsBinaryString(fileData);
|
|
1277
1234
|
/** @type {?} */
|
|
1278
|
-
var
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1235
|
+
var innerIndex = chunkIndex;
|
|
1236
|
+
// reader.onload = () => {
|
|
1237
|
+
// docInfo.fileContent = btoa(reader.result.toString());
|
|
1238
|
+
docInfo.size = selectedFile.size;
|
|
1239
|
+
docInfo.index = innerIndex;
|
|
1240
|
+
docInfo.fileContent = "";
|
|
1241
|
+
//chunkIndex++;
|
|
1242
|
+
if (this.haveExtensionProperty)
|
|
1243
|
+
docInfo.exPropertyName = this.defaultPropertyName;
|
|
1244
|
+
//docInfo.isLast = true;
|
|
1245
|
+
uploadInfo.docInfo = docInfo;
|
|
1246
|
+
// let info = uploadInfo;
|
|
1247
|
+
// this.requestArray.push(this.uploadService.uploadFile(uploadInfo));
|
|
1248
|
+
// this.requestBodyArray.push(info);
|
|
1249
|
+
//封装请求formdata
|
|
1250
|
+
/** @type {?} */
|
|
1251
|
+
var formData = new FormData();
|
|
1252
|
+
formData.append('uploadInfo', JSON.stringify(uploadInfo));
|
|
1253
|
+
formData.append('docInfo', JSON.stringify(docInfo));
|
|
1254
|
+
formData.append('file', fileData);
|
|
1255
|
+
this.sendUploadRequest(formData, fileInfo, docInfo, uploadFileInfo);
|
|
1256
|
+
// }
|
|
1257
|
+
//console.log(chunkIndex + 1);
|
|
1258
|
+
chunkIndex = chunkIndex + 1;
|
|
1259
|
+
}
|
|
1260
|
+
/** @type {?} */
|
|
1261
|
+
var index = -1;
|
|
1262
|
+
this.files.forEach((/**
|
|
1263
|
+
* @param {?} x
|
|
1264
|
+
* @return {?}
|
|
1265
|
+
*/
|
|
1266
|
+
function (x) {
|
|
1267
|
+
if (x.name == fileInfo.name) {
|
|
1268
|
+
if (index == -1)
|
|
1269
|
+
index = _this.files.indexOf(x);
|
|
1294
1270
|
}
|
|
1295
1271
|
}));
|
|
1272
|
+
if (index != -1 && index != this.files.length - 1) {
|
|
1273
|
+
this.files.splice(index, 1);
|
|
1274
|
+
this.uploadFileInfoList.splice(index, 1);
|
|
1275
|
+
this.uploadedFileInfoList.splice(index, 1);
|
|
1276
|
+
this.uploadedFileTotal--;
|
|
1277
|
+
}
|
|
1296
1278
|
};
|
|
1297
1279
|
/**
|
|
1298
1280
|
* @param {?} formData
|
|
@@ -1546,56 +1528,58 @@ var FileUploadComponent = /** @class */ (function () {
|
|
|
1546
1528
|
*/
|
|
1547
1529
|
function (selectdFile, fileInfo, docType) {
|
|
1548
1530
|
var _this = this;
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1531
|
+
switch (docType) {
|
|
1532
|
+
case DocType.Word: {
|
|
1533
|
+
fileInfo.source = "/platform/runtime/dfs/images/word.png";
|
|
1534
|
+
this.files.push(fileInfo);
|
|
1535
|
+
break;
|
|
1536
|
+
}
|
|
1537
|
+
case DocType.Pdf: {
|
|
1538
|
+
fileInfo.source = "/platform/runtime/dfs/images/pdf.png";
|
|
1539
|
+
this.files.push(fileInfo);
|
|
1540
|
+
break;
|
|
1541
|
+
}
|
|
1542
|
+
case DocType.Excel: {
|
|
1543
|
+
fileInfo.source = "/platform/runtime/dfs/images/excel.png";
|
|
1544
|
+
this.files.push(fileInfo);
|
|
1545
|
+
break;
|
|
1546
|
+
}
|
|
1547
|
+
case DocType.Txt: {
|
|
1548
|
+
fileInfo.source = "/platform/runtime/dfs/images/txt.png";
|
|
1549
|
+
this.files.push(fileInfo);
|
|
1550
|
+
break;
|
|
1551
|
+
}
|
|
1552
|
+
case DocType.Powerpoint: {
|
|
1553
|
+
fileInfo.source = "/platform/runtime/dfs/images/ppt.png";
|
|
1554
|
+
this.files.push(fileInfo);
|
|
1555
|
+
break;
|
|
1556
|
+
}
|
|
1557
|
+
case DocType.Other: {
|
|
1558
|
+
fileInfo.source = "/platform/runtime/dfs/images/file.png";
|
|
1559
|
+
this.files.push(fileInfo);
|
|
1560
|
+
break;
|
|
1561
|
+
}
|
|
1562
|
+
case DocType.Image: {
|
|
1563
|
+
/** @type {?} */
|
|
1564
|
+
var reader_1 = new FileReader();
|
|
1565
|
+
reader_1.readAsDataURL(selectdFile);
|
|
1566
|
+
reader_1.onload = (/**
|
|
1567
|
+
* @param {?} _event
|
|
1568
|
+
* @return {?}
|
|
1569
|
+
*/
|
|
1570
|
+
function (_event) {
|
|
1571
|
+
/** @type {?} */
|
|
1572
|
+
var imgUrl = reader_1.result;
|
|
1573
|
+
if (_this.injector != null) {
|
|
1574
|
+
/** @type {?} */
|
|
1575
|
+
var sanitizer = _this.injector.get(DomSanitizer);
|
|
1576
|
+
imgUrl = sanitizer.bypassSecurityTrustResourceUrl(imgUrl);
|
|
1577
|
+
}
|
|
1578
|
+
fileInfo.source = imgUrl;
|
|
1582
1579
|
_this.files.push(fileInfo);
|
|
1583
|
-
|
|
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
|
-
}
|
|
1580
|
+
});
|
|
1596
1581
|
}
|
|
1597
|
-
|
|
1598
|
-
}));
|
|
1582
|
+
}
|
|
1599
1583
|
};
|
|
1600
1584
|
/**
|
|
1601
1585
|
* @param {?} selectdFile
|
|
@@ -1606,30 +1590,6 @@ var FileUploadComponent = /** @class */ (function () {
|
|
|
1606
1590
|
* @return {?}
|
|
1607
1591
|
*/
|
|
1608
1592
|
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) {
|
|
1623
|
-
/** @type {?} */
|
|
1624
|
-
var imgUrl = reader.result;
|
|
1625
|
-
if (_this.injector != null) {
|
|
1626
|
-
/** @type {?} */
|
|
1627
|
-
var sanitizer = _this.injector.get(DomSanitizer);
|
|
1628
|
-
imgUrl = sanitizer.bypassSecurityTrustResourceUrl(imgUrl);
|
|
1629
|
-
}
|
|
1630
|
-
resolve(imgUrl);
|
|
1631
|
-
});
|
|
1632
|
-
}));
|
|
1633
1593
|
};
|
|
1634
1594
|
/**
|
|
1635
1595
|
* @param {?} strList
|