tnx-shared 5.1.419 → 5.1.420
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/tnx-shared.umd.js +83 -44
- package/bundles/tnx-shared.umd.js.map +1 -1
- package/bundles/tnx-shared.umd.min.js +1 -1
- package/bundles/tnx-shared.umd.min.js.map +1 -1
- package/components/file-explorer/file-viewer/file-viewer.component.d.ts +4 -4
- package/components/file-explorer/file-viewer/file-viewer.component.d.ts.map +1 -1
- package/components/file-explorer/services/download-link.service.d.ts +1 -1
- package/components/file-explorer/services/download-link.service.d.ts.map +1 -1
- package/components/file-upload/file-upload.component.d.ts +12 -1
- package/components/file-upload/file-upload.component.d.ts.map +1 -1
- package/esm2015/components/file-explorer/file-viewer/file-viewer.component.js +37 -36
- package/esm2015/components/file-explorer/services/download-link.service.js +4 -4
- package/esm2015/components/file-upload/file-upload.component.js +36 -3
- package/fesm2015/tnx-shared.js +73 -40
- package/fesm2015/tnx-shared.js.map +1 -1
- package/package.json +2 -2
- package/tnx-shared.metadata.json +1 -1
|
@@ -9053,12 +9053,12 @@
|
|
|
9053
9053
|
var svUrl = this.serviceUri + "/GenerateDownloadLinkMultiple";
|
|
9054
9054
|
return this.defaultPost(svUrl, model);
|
|
9055
9055
|
};
|
|
9056
|
-
DownloadLinkService.prototype.getAnonymousDownloadUrl = function (hash) {
|
|
9057
|
-
return this.serviceUri + "/Download/" + hash;
|
|
9058
|
-
};
|
|
9059
9056
|
DownloadLinkService.prototype.getDownloadForSignUrl = function (hash) {
|
|
9060
9057
|
return this.serviceUri + "/DownloadForSign/" + hash;
|
|
9061
9058
|
};
|
|
9059
|
+
DownloadLinkService.prototype.getAnonymousDownloadUrl = function (hash) {
|
|
9060
|
+
return this.serviceUri + "/Download/" + hash;
|
|
9061
|
+
};
|
|
9062
9062
|
DownloadLinkService.prototype.getAnonymousDownloadUrlForViewer = function (hash, forceUsingInternal) {
|
|
9063
9063
|
if (forceUsingInternal === void 0) { forceUsingInternal = false; }
|
|
9064
9064
|
if (this._moduleConfigService.getConfig().environment.usingInternalFileEndpointForView || forceUsingInternal) {
|
|
@@ -35525,11 +35525,12 @@
|
|
|
35525
35525
|
|
|
35526
35526
|
var FileUploadComponent = /** @class */ (function (_super) {
|
|
35527
35527
|
__extends(FileUploadComponent, _super);
|
|
35528
|
-
function FileUploadComponent(_fileObjectService, _notifierService, _downloadLinkService, _injector) {
|
|
35528
|
+
function FileUploadComponent(_fileObjectService, _notifierService, _downloadLinkService, _fileExplorerService, _injector) {
|
|
35529
35529
|
var _this = _super.call(this, _injector) || this;
|
|
35530
35530
|
_this._fileObjectService = _fileObjectService;
|
|
35531
35531
|
_this._notifierService = _notifierService;
|
|
35532
35532
|
_this._downloadLinkService = _downloadLinkService;
|
|
35533
|
+
_this._fileExplorerService = _fileExplorerService;
|
|
35533
35534
|
_this.chooseLabel = 'Chọn';
|
|
35534
35535
|
_this.readonly = true;
|
|
35535
35536
|
_this.accept = 'image/*,.xlsx,.xls,.pdf,.doc,.docx,.zip,.rar';
|
|
@@ -35552,6 +35553,14 @@
|
|
|
35552
35553
|
_this.hasFile = false;
|
|
35553
35554
|
_this.showNoti = false;
|
|
35554
35555
|
_this.notification = null;
|
|
35556
|
+
_this.forms = {
|
|
35557
|
+
fileViewer: {
|
|
35558
|
+
formData: {
|
|
35559
|
+
data: {},
|
|
35560
|
+
},
|
|
35561
|
+
show: false,
|
|
35562
|
+
}
|
|
35563
|
+
};
|
|
35555
35564
|
return _this;
|
|
35556
35565
|
}
|
|
35557
35566
|
FileUploadComponent.prototype.writeValue = function (obj) {
|
|
@@ -35686,12 +35695,44 @@
|
|
|
35686
35695
|
this._downloadLinkService.downloadLink(model);
|
|
35687
35696
|
}
|
|
35688
35697
|
};
|
|
35698
|
+
FileUploadComponent.prototype.openFileViewer = function () {
|
|
35699
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
35700
|
+
var fileBinary, fileObject, fileName;
|
|
35701
|
+
return __generator(this, function (_a) {
|
|
35702
|
+
switch (_a.label) {
|
|
35703
|
+
case 0: return [4 /*yield*/, this._fileExplorerService.checkPhysicalFile(this.fileId)];
|
|
35704
|
+
case 1:
|
|
35705
|
+
fileBinary = _a.sent();
|
|
35706
|
+
if (!fileBinary.success) {
|
|
35707
|
+
this._notifierService.showWarning('File không tồn tại, vui lòng liên hệ quản trị viên');
|
|
35708
|
+
return [2 /*return*/];
|
|
35709
|
+
}
|
|
35710
|
+
return [4 /*yield*/, this._fileObjectService.getDetail(this.fileId)];
|
|
35711
|
+
case 2:
|
|
35712
|
+
fileObject = _a.sent();
|
|
35713
|
+
fileName = '';
|
|
35714
|
+
if (!fileObject.success) {
|
|
35715
|
+
this._notifierService.showWarning('Có lỗi trong lúc lấy dữ liệu file, vui lòng liên hệ quản trị viên');
|
|
35716
|
+
return [2 /*return*/];
|
|
35717
|
+
}
|
|
35718
|
+
fileName = fileObject === null || fileObject === void 0 ? void 0 : fileObject.name;
|
|
35719
|
+
this.forms.fileViewer.formData.data = {
|
|
35720
|
+
fileId: this.fileId,
|
|
35721
|
+
isFileVersion: false,
|
|
35722
|
+
fileName: fileName,
|
|
35723
|
+
};
|
|
35724
|
+
this.forms.fileViewer.show = true;
|
|
35725
|
+
return [2 /*return*/];
|
|
35726
|
+
}
|
|
35727
|
+
});
|
|
35728
|
+
});
|
|
35729
|
+
};
|
|
35689
35730
|
return FileUploadComponent;
|
|
35690
35731
|
}(ComponentBase));
|
|
35691
35732
|
FileUploadComponent.decorators = [
|
|
35692
35733
|
{ type: i0.Component, args: [{
|
|
35693
35734
|
selector: 'file-upload',
|
|
35694
|
-
template: "<div class=\"file-upload\">\r\n <div class=\"fl-icon\">\r\n <i *ngIf=\"loading\" class=\"pi pi-spin pi-spinner\" style=\"font-size: 2rem\"></i>\r\n <i *ngIf=\"!loading\" class=\"pi pi-file-o\" style=\"font-size: 2rem\"></i>\r\n </div>\r\n\r\n <div class=\"fl-file-name\" (click)=\"
|
|
35735
|
+
template: "<div class=\"file-upload\">\r\n <div class=\"fl-icon\">\r\n <i *ngIf=\"loading\" class=\"pi pi-spin pi-spinner\" style=\"font-size: 2rem\"></i>\r\n <i *ngIf=\"!loading\" class=\"pi pi-file-o\" style=\"font-size: 2rem\"></i>\r\n </div>\r\n\r\n <div class=\"fl-file-name\" (click)=\"openFileViewer()\">\r\n <span *ngIf=\"!showNoti\">{{selectedFileName}}</span>\r\n <span *ngIf=\"showNoti\"> {{notification}} </span>\r\n </div>\r\n\r\n <div class=\"fl-buttons\">\r\n <button *ngIf=\"!hasFile && !readonly\" pTooltip=\"Ch\u1ECDn file\" class=\"fl-choose\"\r\n class=\"link-or-action p-button-text p-button-rounded fl-choose\" tooltipPosition=\"top\" pButton type=\"button\"\r\n icon=\"pi pi-plus\" (click)=\"onOpenSelect()\"></button>\r\n\r\n <button *ngIf=\"hasFile && !readonly\" (click)=\"onRemoveFile()\"\r\n class=\"link-or-action p-button-text p-button-rounded p-button-danger fl-remove\" pTooltip=\"X\u00F3a file\"\r\n tooltipPosition=\"top\" pButton type=\"button\" icon=\"pi pi-trash\"></button>\r\n\r\n <button [disabled]=\"!menu || !menu.length\" type=\"button\" pButton icon=\"pi pi-ellipsis-v\"\r\n class=\"link-or-action p-button-text p-button-rounded\" pTooltip=\"Th\u00EAm\" tooltipPosition=\"top\"\r\n (click)=\"showContextMenu($event)\"></button>\r\n </div>\r\n\r\n <div style=\"display: none;\">\r\n <p-fileUpload #file [accept]=\"accept\" [auto]=\"false\" class=\"file-upload\" mode=\"basic\"\r\n [chooseLabel]=\"chooseLabel\" name=\"file[]\" [accept]=\"accept\" pTooltip=\"Ch\u1ECDn t\u1EEB m\u00E1y t\u00EDnh\"\r\n toolStipPosition=\"top\" multiple=\"single\" [invalidFileSizeMessageSummary]=\"invalidFileSizeMessageSummary\"\r\n [invalidFileSizeMessageDetail]=\"invalidFileSizeMessageDetail\"\r\n [invalidFileTypeMessageSummary]=\"invalidFileTypeMessageSummary\"\r\n [invalidFileTypeMessageDetail]=\"invalidFileTypeMessageDetail\"\r\n [invalidFileLimitMessageSummary]=\"invalidFileLimitMessageSummary\"\r\n [invalidFileLimitMessageDetail]=\"invalidFileLimitMessageDetail\" (onSelect)=\"onSelectFile($event)\"\r\n (onError)=\"handleError($event)\">\r\n </p-fileUpload>\r\n </div>\r\n\r\n</div>\r\n\r\n<p-contextMenu #contextMenu [appendTo]=\"'body'\" [model]=\"menu\" styleClass=\"fm-contextMenu-panel\">\r\n</p-contextMenu>\r\n\r\n<file-viewer #fileViewerNew *ngIf=\"forms.fileViewer.show\" [parentModel]=\"model\" [parentContext]=\"context\"\r\n [readonly]=\"readonly\" [model]=\"forms.fileViewer.formData\" (onClose)=\"forms.fileViewer.show = false;\">\r\n</file-viewer>",
|
|
35695
35736
|
providers: [
|
|
35696
35737
|
{
|
|
35697
35738
|
provide: forms.NG_VALUE_ACCESSOR,
|
|
@@ -35707,6 +35748,7 @@
|
|
|
35707
35748
|
{ type: FileObjectService },
|
|
35708
35749
|
{ type: NotifierService },
|
|
35709
35750
|
{ type: DownloadLinkService },
|
|
35751
|
+
{ type: FileExplorerService },
|
|
35710
35752
|
{ type: i0.Injector }
|
|
35711
35753
|
]; };
|
|
35712
35754
|
FileUploadComponent.propDecorators = {
|
|
@@ -51148,6 +51190,10 @@
|
|
|
51148
51190
|
case 0:
|
|
51149
51191
|
this.data = this.model.data;
|
|
51150
51192
|
if (!this.data.fileId && !this.data.fileVersionId) {
|
|
51193
|
+
if (this.data.fileUrl != null && this.data.fileUrl !== '') {
|
|
51194
|
+
this.data.extension = this._fileObjectService.getFileExtension(this.data.name);
|
|
51195
|
+
this.data.fileType = this._fileObjectService.getFileType(this.data.extension);
|
|
51196
|
+
}
|
|
51151
51197
|
return [2 /*return*/];
|
|
51152
51198
|
}
|
|
51153
51199
|
data = null;
|
|
@@ -51180,24 +51226,40 @@
|
|
|
51180
51226
|
this.model.images = [];
|
|
51181
51227
|
this.model.isImage = true;
|
|
51182
51228
|
this.show = true;
|
|
51229
|
+
this.context.root.subscribe(ComCtxConstants.ROOT.KEY_DOWN_ESC, function () {
|
|
51230
|
+
_this.closeSidebar(null);
|
|
51231
|
+
});
|
|
51232
|
+
var forceUsingInternal = false;
|
|
51233
|
+
var processFunc;
|
|
51183
51234
|
switch (this.data.fileType) {
|
|
51184
51235
|
case FILE_TYPES.IMAGE:
|
|
51185
|
-
this.processShowImage();
|
|
51236
|
+
processFunc = this.processShowImage.bind(this);
|
|
51186
51237
|
break;
|
|
51187
51238
|
case FILE_TYPES.VIDEO:
|
|
51188
51239
|
case FILE_TYPES.AUDIO:
|
|
51189
|
-
this.processVideoOrAudio();
|
|
51240
|
+
processFunc = this.processVideoOrAudio.bind(this);
|
|
51190
51241
|
break;
|
|
51191
51242
|
case FILE_TYPES.PDF:
|
|
51192
|
-
this.processFilePdf();
|
|
51243
|
+
processFunc = this.processFilePdf.bind(this);
|
|
51193
51244
|
break;
|
|
51194
51245
|
default:
|
|
51195
|
-
this.
|
|
51246
|
+
this.model.isImage = false;
|
|
51247
|
+
forceUsingInternal = true;
|
|
51248
|
+
processFunc = this.processOtherFileExtension.bind(this);
|
|
51196
51249
|
break;
|
|
51197
51250
|
}
|
|
51198
|
-
this.
|
|
51199
|
-
|
|
51200
|
-
|
|
51251
|
+
if (!this.data.fileUrl || this.data.fileUrl === '') {
|
|
51252
|
+
var model = this.getGenerateDownloadLinkModel();
|
|
51253
|
+
this._downloadLinkService
|
|
51254
|
+
.generateDownloadLink(model)
|
|
51255
|
+
.then(function (rs) {
|
|
51256
|
+
var url = _this._downloadLinkService.getAnonymousDownloadUrlForViewer(rs.data, forceUsingInternal);
|
|
51257
|
+
processFunc(url);
|
|
51258
|
+
});
|
|
51259
|
+
}
|
|
51260
|
+
else {
|
|
51261
|
+
processFunc(this.data.fileUrl);
|
|
51262
|
+
}
|
|
51201
51263
|
};
|
|
51202
51264
|
FileViewerComponent.prototype.getGenerateDownloadLinkModel = function () {
|
|
51203
51265
|
return {
|
|
@@ -51205,15 +51267,6 @@
|
|
|
51205
51267
|
fileVersionId: this.data.fileVersionId
|
|
51206
51268
|
};
|
|
51207
51269
|
};
|
|
51208
|
-
FileViewerComponent.prototype.processShowImage = function () {
|
|
51209
|
-
var _this = this;
|
|
51210
|
-
var model = this.getGenerateDownloadLinkModel();
|
|
51211
|
-
this._downloadLinkService.generateDownloadLink(model)
|
|
51212
|
-
.then(function (rs) {
|
|
51213
|
-
_this.model.images = [_this._downloadLinkService.getAnonymousDownloadUrlForViewer(rs.data)];
|
|
51214
|
-
// this.showImageWhenLoaded();
|
|
51215
|
-
});
|
|
51216
|
-
};
|
|
51217
51270
|
FileViewerComponent.prototype.showImageWhenLoaded = function () {
|
|
51218
51271
|
var _this = this;
|
|
51219
51272
|
var done = false;
|
|
@@ -51232,31 +51285,17 @@
|
|
|
51232
51285
|
setTimeout(function () { return _this.showImageWhenLoaded(); }, 50);
|
|
51233
51286
|
}
|
|
51234
51287
|
};
|
|
51235
|
-
FileViewerComponent.prototype.
|
|
51236
|
-
|
|
51237
|
-
var model = this.getGenerateDownloadLinkModel();
|
|
51238
|
-
this._downloadLinkService.generateDownloadLink(model)
|
|
51239
|
-
.then(function (rs) {
|
|
51240
|
-
_this.model.fileUrl = _this._downloadLinkService.getAnonymousDownloadUrlForViewer(rs.data);
|
|
51241
|
-
});
|
|
51288
|
+
FileViewerComponent.prototype.processShowImage = function (url) {
|
|
51289
|
+
this.model.images = [url];
|
|
51242
51290
|
};
|
|
51243
|
-
FileViewerComponent.prototype.
|
|
51244
|
-
|
|
51245
|
-
var model = this.getGenerateDownloadLinkModel();
|
|
51246
|
-
this._downloadLinkService.generateDownloadLink(model)
|
|
51247
|
-
.then(function (rs) {
|
|
51248
|
-
_this.model.fileUrl = _this._downloadLinkService.getAnonymousDownloadUrl(rs.data);
|
|
51249
|
-
});
|
|
51291
|
+
FileViewerComponent.prototype.processVideoOrAudio = function (url) {
|
|
51292
|
+
this.model.fileUrl = url;
|
|
51250
51293
|
};
|
|
51251
|
-
FileViewerComponent.prototype.
|
|
51252
|
-
|
|
51253
|
-
|
|
51254
|
-
|
|
51255
|
-
this.
|
|
51256
|
-
.then(function (rs) {
|
|
51257
|
-
var fileUrl = _this._downloadLinkService.getAnonymousDownloadUrlForViewer(rs.data, true);
|
|
51258
|
-
_this.initDocumentViewer(_this.data.extension, _this.data.fileType, fileUrl);
|
|
51259
|
-
});
|
|
51294
|
+
FileViewerComponent.prototype.processFilePdf = function (url) {
|
|
51295
|
+
this.model.fileUrl = url;
|
|
51296
|
+
};
|
|
51297
|
+
FileViewerComponent.prototype.processOtherFileExtension = function (url) {
|
|
51298
|
+
this.initDocumentViewer(this.data.extension, this.data.fileType, url);
|
|
51260
51299
|
};
|
|
51261
51300
|
FileViewerComponent.prototype.initDocumentViewer = function (fileExtension, fileType, fileUrl) {
|
|
51262
51301
|
var config = {
|