tnx-shared 5.0.72 → 5.0.73
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 +35 -5
- 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/service-file-upload/service-file-upload.component.d.ts +3 -0
- package/components/service-file-upload/service-file-upload.component.d.ts.map +1 -1
- package/esm2015/components/service-file-upload/service-file-upload.component.js +32 -2
- package/fesm2015/tnx-shared.js +31 -1
- package/fesm2015/tnx-shared.js.map +1 -1
- package/package.json +2 -2
- package/tnx-shared.metadata.json +1 -1
|
@@ -35760,6 +35760,12 @@
|
|
|
35760
35760
|
_this.onRemove = new i0.EventEmitter();
|
|
35761
35761
|
_this.onChanged = new i0.EventEmitter();
|
|
35762
35762
|
_this.dataModel = {};
|
|
35763
|
+
_this.supportedExtensions = [
|
|
35764
|
+
'pdf',
|
|
35765
|
+
'jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp',
|
|
35766
|
+
'mp4', 'webm', 'ogg',
|
|
35767
|
+
'mp3', 'wav', 'aac' // Âm thanh
|
|
35768
|
+
];
|
|
35763
35769
|
if (_this._userService.isValidAccessToken()) {
|
|
35764
35770
|
_this.userId = _this._userService.getUserIdCombine();
|
|
35765
35771
|
}
|
|
@@ -35793,8 +35799,8 @@
|
|
|
35793
35799
|
ServiceFileUploadComponent.prototype.getServiceFile = function () {
|
|
35794
35800
|
return __awaiter(this, void 0, void 0, function () {
|
|
35795
35801
|
var serviceRequestModel, fileObject;
|
|
35796
|
-
return __generator(this, function (
|
|
35797
|
-
switch (
|
|
35802
|
+
return __generator(this, function (_b) {
|
|
35803
|
+
switch (_b.label) {
|
|
35798
35804
|
case 0:
|
|
35799
35805
|
if (!this.hasKeys()) return [3 /*break*/, 2];
|
|
35800
35806
|
serviceRequestModel = {
|
|
@@ -35806,7 +35812,7 @@
|
|
|
35806
35812
|
this.setNoti('Đang lấy đính kèm...');
|
|
35807
35813
|
return [4 /*yield*/, this._fileObjectService.getSingleServiceFile(serviceRequestModel)];
|
|
35808
35814
|
case 1:
|
|
35809
|
-
fileObject = (
|
|
35815
|
+
fileObject = (_b.sent()).data;
|
|
35810
35816
|
this.loading = false;
|
|
35811
35817
|
this.setNoti(null);
|
|
35812
35818
|
if (fileObject) {
|
|
@@ -35826,7 +35832,7 @@
|
|
|
35826
35832
|
this.selectedFileName = null;
|
|
35827
35833
|
this.onChangeBase(null);
|
|
35828
35834
|
this.onChanged.emit();
|
|
35829
|
-
|
|
35835
|
+
_b.label = 3;
|
|
35830
35836
|
case 3:
|
|
35831
35837
|
this.setMenu();
|
|
35832
35838
|
return [2 /*return*/];
|
|
@@ -36073,12 +36079,36 @@
|
|
|
36073
36079
|
ServiceFileUploadComponent.prototype.setDisabledState = function (isDisabled) {
|
|
36074
36080
|
this.isDisabled = isDisabled;
|
|
36075
36081
|
};
|
|
36082
|
+
ServiceFileUploadComponent.prototype.isViewableFile = function (url) {
|
|
36083
|
+
var _a;
|
|
36084
|
+
if (!url) {
|
|
36085
|
+
return false;
|
|
36086
|
+
}
|
|
36087
|
+
try {
|
|
36088
|
+
// Lấy phần mở rộng của file từ URL
|
|
36089
|
+
var extension = (_a = url.split('.').pop()) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
36090
|
+
return extension ? this.supportedExtensions.includes(extension) : false;
|
|
36091
|
+
}
|
|
36092
|
+
catch (error) {
|
|
36093
|
+
console.error('Lỗi khi kiểm tra đuôi file:', error);
|
|
36094
|
+
return false;
|
|
36095
|
+
}
|
|
36096
|
+
};
|
|
36097
|
+
ServiceFileUploadComponent.prototype.onDownloadOrViewFile = function () {
|
|
36098
|
+
if (this.isViewableFile(this.selectedFileName)) {
|
|
36099
|
+
var url = this._fileObjectService.getPublicDownloadLinkByFileId(this.fileId);
|
|
36100
|
+
window.open(url, '_blank');
|
|
36101
|
+
}
|
|
36102
|
+
else {
|
|
36103
|
+
this.onDownloadFile();
|
|
36104
|
+
}
|
|
36105
|
+
};
|
|
36076
36106
|
return ServiceFileUploadComponent;
|
|
36077
36107
|
}(ComponentBase));
|
|
36078
36108
|
ServiceFileUploadComponent.decorators = [
|
|
36079
36109
|
{ type: i0.Component, args: [{
|
|
36080
36110
|
selector: 'service-file-upload',
|
|
36081
|
-
template: "<div class=\"file-upload\">\r\n <div class=\"fl-icon\">\r\n <i *ngIf=\"loading\" class=\"pi pi-spin pi-spinner\"></i>\r\n <i *ngIf=\"!loading\" class=\"pi pi-file-o\"></i>\r\n </div>\r\n\r\n <div class=\"fl-file-name\" (click)=\"
|
|
36111
|
+
template: "<div class=\"file-upload\">\r\n <div class=\"fl-icon\">\r\n <i *ngIf=\"loading\" class=\"pi pi-spin pi-spinner\"></i>\r\n <i *ngIf=\"!loading\" class=\"pi pi-file-o\"></i>\r\n </div>\r\n\r\n <div class=\"fl-file-name\" (click)=\"onDownloadOrViewFile()\">\r\n <div>\r\n <ng-container *ngIf=\"!showNoti\">\r\n <span pTooltip=\"{{selectedFileName}}\">{{selectedFileNameShort}}</span>\r\n <span *ngIf=\"extension\">.{{extension}} </span>\r\n </ng-container>\r\n <span *ngIf=\"showNoti\"> {{notification}} </span>\r\n </div>\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\" class=\"file-upload\" mode=\"basic\" [chooseLabel]=\"chooseLabel\" name=\"file[]\"\r\n [maxFileSize]=\"control.maxFileSize\" pTooltip=\"Ch\u1ECDn t\u1EEB m\u00E1y t\u00EDnh\" toolStipPosition=\"top\" multiple=\"single\"\r\n [invalidFileSizeMessageSummary]=\"control.invalidFileSizeMessageSummary\"\r\n [invalidFileSizeMessageDetail]=\"control.invalidFileSizeMessageDetail\"\r\n [invalidFileTypeMessageSummary]=\"control.invalidFileTypeMessageSummary\"\r\n [invalidFileTypeMessageDetail]=\"control.invalidFileTypeMessageDetail\"\r\n [invalidFileLimitMessageSummary]=\"control.invalidFileLimitMessageSummary\"\r\n [invalidFileLimitMessageDetail]=\"control.invalidFileLimitMessageDetail\" [accept]=\"accept\"\r\n (onSelect)=\"onSelectFile($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>",
|
|
36082
36112
|
providers: [
|
|
36083
36113
|
{
|
|
36084
36114
|
provide: forms.NG_VALUE_ACCESSOR,
|