tnx-shared 5.1.418 → 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 +94 -51
- 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/components/splash-component/splash-component-v1/splash-component-v1.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/esm2015/components/splash-component/splash-component-v1/splash-component-v1.component.js +9 -3
- package/esm2015/components/splash-component/splash-component-v2/splash-component-v2.component.js +2 -2
- package/esm2015/services/permission.service.js +9 -4
- package/esm2015/services/position.service.js +4 -4
- package/fesm2015/tnx-shared.js +91 -47
- package/fesm2015/tnx-shared.js.map +1 -1
- package/package.json +2 -2
- package/services/permission.service.d.ts.map +1 -1
- package/services/position.service.d.ts +2 -2
- package/services/position.service.d.ts.map +1 -1
- 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) {
|
|
@@ -20279,7 +20279,7 @@
|
|
|
20279
20279
|
: this._checkPermission(userPermissions, permissionToCheck)];
|
|
20280
20280
|
}
|
|
20281
20281
|
else {
|
|
20282
|
-
console.log(
|
|
20282
|
+
// console.log(`Không có quyền với phân hệ [${service}]`);
|
|
20283
20283
|
return [2 /*return*/, false];
|
|
20284
20284
|
}
|
|
20285
20285
|
return [3 /*break*/, 3];
|
|
@@ -20305,6 +20305,8 @@
|
|
|
20305
20305
|
var userPermissionPointer = 0;
|
|
20306
20306
|
// pointer permission đang check
|
|
20307
20307
|
var permissionToCheckPointer = 0;
|
|
20308
|
+
// mark co the check query param
|
|
20309
|
+
var aboutToCheckQueryParam = false;
|
|
20308
20310
|
// check từng char của 2 mảng
|
|
20309
20311
|
for (; permissionToCheckPointer < permissionToCheck.length;) {
|
|
20310
20312
|
// nếu char là ký tự bắt đầu template => tịnh tiến pointer của 2 mảng
|
|
@@ -20318,10 +20320,13 @@
|
|
|
20318
20320
|
if (userPermission[userPermissionPointer] != '}') {
|
|
20319
20321
|
continue;
|
|
20320
20322
|
}
|
|
20323
|
+
if (userPermission[userPermissionPointer] === '?') {
|
|
20324
|
+
aboutToCheckQueryParam = true;
|
|
20325
|
+
}
|
|
20321
20326
|
++userPermissionPointer; // tiến tiến đến ký tự sau kết thúc template
|
|
20322
20327
|
// check trường hợp trường hợp chuỗi template có dạng "{template}acsekjf"
|
|
20323
20328
|
// => cần check các ký tự sau template và trước ký tự '/'
|
|
20324
|
-
if (userPermission[userPermissionPointer] != '/') {
|
|
20329
|
+
if (userPermission[userPermissionPointer] != '/' && (aboutToCheckQueryParam && userPermission[userPermissionPointer] != '&')) {
|
|
20325
20330
|
needRecheck = true;
|
|
20326
20331
|
for (; userPermissionPointer < userPermission.length; userPermissionPointer++) {
|
|
20327
20332
|
if (userPermissionPointer == userPermission.length - 1) {
|
|
@@ -20339,7 +20344,7 @@
|
|
|
20339
20344
|
if (permissionToCheckPointer == permissionToCheck.length - 1) {
|
|
20340
20345
|
break;
|
|
20341
20346
|
}
|
|
20342
|
-
if (permissionToCheck[permissionToCheckPointer] == '/') {
|
|
20347
|
+
if (permissionToCheck[permissionToCheckPointer] == '/' || (aboutToCheckQueryParam && permissionToCheck[permissionToCheckPointer] == '&')) {
|
|
20343
20348
|
break;
|
|
20344
20349
|
}
|
|
20345
20350
|
}
|
|
@@ -35520,11 +35525,12 @@
|
|
|
35520
35525
|
|
|
35521
35526
|
var FileUploadComponent = /** @class */ (function (_super) {
|
|
35522
35527
|
__extends(FileUploadComponent, _super);
|
|
35523
|
-
function FileUploadComponent(_fileObjectService, _notifierService, _downloadLinkService, _injector) {
|
|
35528
|
+
function FileUploadComponent(_fileObjectService, _notifierService, _downloadLinkService, _fileExplorerService, _injector) {
|
|
35524
35529
|
var _this = _super.call(this, _injector) || this;
|
|
35525
35530
|
_this._fileObjectService = _fileObjectService;
|
|
35526
35531
|
_this._notifierService = _notifierService;
|
|
35527
35532
|
_this._downloadLinkService = _downloadLinkService;
|
|
35533
|
+
_this._fileExplorerService = _fileExplorerService;
|
|
35528
35534
|
_this.chooseLabel = 'Chọn';
|
|
35529
35535
|
_this.readonly = true;
|
|
35530
35536
|
_this.accept = 'image/*,.xlsx,.xls,.pdf,.doc,.docx,.zip,.rar';
|
|
@@ -35547,6 +35553,14 @@
|
|
|
35547
35553
|
_this.hasFile = false;
|
|
35548
35554
|
_this.showNoti = false;
|
|
35549
35555
|
_this.notification = null;
|
|
35556
|
+
_this.forms = {
|
|
35557
|
+
fileViewer: {
|
|
35558
|
+
formData: {
|
|
35559
|
+
data: {},
|
|
35560
|
+
},
|
|
35561
|
+
show: false,
|
|
35562
|
+
}
|
|
35563
|
+
};
|
|
35550
35564
|
return _this;
|
|
35551
35565
|
}
|
|
35552
35566
|
FileUploadComponent.prototype.writeValue = function (obj) {
|
|
@@ -35681,12 +35695,44 @@
|
|
|
35681
35695
|
this._downloadLinkService.downloadLink(model);
|
|
35682
35696
|
}
|
|
35683
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
|
+
};
|
|
35684
35730
|
return FileUploadComponent;
|
|
35685
35731
|
}(ComponentBase));
|
|
35686
35732
|
FileUploadComponent.decorators = [
|
|
35687
35733
|
{ type: i0.Component, args: [{
|
|
35688
35734
|
selector: 'file-upload',
|
|
35689
|
-
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>",
|
|
35690
35736
|
providers: [
|
|
35691
35737
|
{
|
|
35692
35738
|
provide: forms.NG_VALUE_ACCESSOR,
|
|
@@ -35702,6 +35748,7 @@
|
|
|
35702
35748
|
{ type: FileObjectService },
|
|
35703
35749
|
{ type: NotifierService },
|
|
35704
35750
|
{ type: DownloadLinkService },
|
|
35751
|
+
{ type: FileExplorerService },
|
|
35705
35752
|
{ type: i0.Injector }
|
|
35706
35753
|
]; };
|
|
35707
35754
|
FileUploadComponent.propDecorators = {
|
|
@@ -43141,7 +43188,7 @@
|
|
|
43141
43188
|
var PositionService = /** @class */ (function (_super) {
|
|
43142
43189
|
__extends(PositionService, _super);
|
|
43143
43190
|
function PositionService(http, injector, _moduleConfigService) {
|
|
43144
|
-
var _this = _super.call(this, http, injector, _moduleConfigService.getConfig().environment.apiDomain.userOrgEndpoint + "/" + _moduleConfigService.getConfig().environment.apiVersion + "/
|
|
43191
|
+
var _this = _super.call(this, http, injector, _moduleConfigService.getConfig().environment.apiDomain.userOrgEndpoint + "/" + _moduleConfigService.getConfig().environment.apiVersion + "/DmChucVu") || this;
|
|
43145
43192
|
_this._moduleConfigService = _moduleConfigService;
|
|
43146
43193
|
_this.entityName = 'DmChucVu';
|
|
43147
43194
|
_this.serviceCode = 'UserOrg';
|
|
@@ -51143,6 +51190,10 @@
|
|
|
51143
51190
|
case 0:
|
|
51144
51191
|
this.data = this.model.data;
|
|
51145
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
|
+
}
|
|
51146
51197
|
return [2 /*return*/];
|
|
51147
51198
|
}
|
|
51148
51199
|
data = null;
|
|
@@ -51175,24 +51226,40 @@
|
|
|
51175
51226
|
this.model.images = [];
|
|
51176
51227
|
this.model.isImage = true;
|
|
51177
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;
|
|
51178
51234
|
switch (this.data.fileType) {
|
|
51179
51235
|
case FILE_TYPES.IMAGE:
|
|
51180
|
-
this.processShowImage();
|
|
51236
|
+
processFunc = this.processShowImage.bind(this);
|
|
51181
51237
|
break;
|
|
51182
51238
|
case FILE_TYPES.VIDEO:
|
|
51183
51239
|
case FILE_TYPES.AUDIO:
|
|
51184
|
-
this.processVideoOrAudio();
|
|
51240
|
+
processFunc = this.processVideoOrAudio.bind(this);
|
|
51185
51241
|
break;
|
|
51186
51242
|
case FILE_TYPES.PDF:
|
|
51187
|
-
this.processFilePdf();
|
|
51243
|
+
processFunc = this.processFilePdf.bind(this);
|
|
51188
51244
|
break;
|
|
51189
51245
|
default:
|
|
51190
|
-
this.
|
|
51246
|
+
this.model.isImage = false;
|
|
51247
|
+
forceUsingInternal = true;
|
|
51248
|
+
processFunc = this.processOtherFileExtension.bind(this);
|
|
51191
51249
|
break;
|
|
51192
51250
|
}
|
|
51193
|
-
this.
|
|
51194
|
-
|
|
51195
|
-
|
|
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
|
+
}
|
|
51196
51263
|
};
|
|
51197
51264
|
FileViewerComponent.prototype.getGenerateDownloadLinkModel = function () {
|
|
51198
51265
|
return {
|
|
@@ -51200,15 +51267,6 @@
|
|
|
51200
51267
|
fileVersionId: this.data.fileVersionId
|
|
51201
51268
|
};
|
|
51202
51269
|
};
|
|
51203
|
-
FileViewerComponent.prototype.processShowImage = function () {
|
|
51204
|
-
var _this = this;
|
|
51205
|
-
var model = this.getGenerateDownloadLinkModel();
|
|
51206
|
-
this._downloadLinkService.generateDownloadLink(model)
|
|
51207
|
-
.then(function (rs) {
|
|
51208
|
-
_this.model.images = [_this._downloadLinkService.getAnonymousDownloadUrlForViewer(rs.data)];
|
|
51209
|
-
// this.showImageWhenLoaded();
|
|
51210
|
-
});
|
|
51211
|
-
};
|
|
51212
51270
|
FileViewerComponent.prototype.showImageWhenLoaded = function () {
|
|
51213
51271
|
var _this = this;
|
|
51214
51272
|
var done = false;
|
|
@@ -51227,31 +51285,17 @@
|
|
|
51227
51285
|
setTimeout(function () { return _this.showImageWhenLoaded(); }, 50);
|
|
51228
51286
|
}
|
|
51229
51287
|
};
|
|
51230
|
-
FileViewerComponent.prototype.
|
|
51231
|
-
|
|
51232
|
-
var model = this.getGenerateDownloadLinkModel();
|
|
51233
|
-
this._downloadLinkService.generateDownloadLink(model)
|
|
51234
|
-
.then(function (rs) {
|
|
51235
|
-
_this.model.fileUrl = _this._downloadLinkService.getAnonymousDownloadUrlForViewer(rs.data);
|
|
51236
|
-
});
|
|
51288
|
+
FileViewerComponent.prototype.processShowImage = function (url) {
|
|
51289
|
+
this.model.images = [url];
|
|
51237
51290
|
};
|
|
51238
|
-
FileViewerComponent.prototype.
|
|
51239
|
-
|
|
51240
|
-
var model = this.getGenerateDownloadLinkModel();
|
|
51241
|
-
this._downloadLinkService.generateDownloadLink(model)
|
|
51242
|
-
.then(function (rs) {
|
|
51243
|
-
_this.model.fileUrl = _this._downloadLinkService.getAnonymousDownloadUrl(rs.data);
|
|
51244
|
-
});
|
|
51291
|
+
FileViewerComponent.prototype.processVideoOrAudio = function (url) {
|
|
51292
|
+
this.model.fileUrl = url;
|
|
51245
51293
|
};
|
|
51246
|
-
FileViewerComponent.prototype.
|
|
51247
|
-
|
|
51248
|
-
|
|
51249
|
-
|
|
51250
|
-
this.
|
|
51251
|
-
.then(function (rs) {
|
|
51252
|
-
var fileUrl = _this._downloadLinkService.getAnonymousDownloadUrlForViewer(rs.data, true);
|
|
51253
|
-
_this.initDocumentViewer(_this.data.extension, _this.data.fileType, fileUrl);
|
|
51254
|
-
});
|
|
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);
|
|
51255
51299
|
};
|
|
51256
51300
|
FileViewerComponent.prototype.initDocumentViewer = function (fileExtension, fileType, fileUrl) {
|
|
51257
51301
|
var config = {
|
|
@@ -53713,7 +53757,6 @@
|
|
|
53713
53757
|
return [4 /*yield*/, this._permissionService.isAuthorized(element.code, (element.code + ".MODULE." + element.code).toUpperCase(), true)];
|
|
53714
53758
|
case 3:
|
|
53715
53759
|
isAuthorized = _c.sent();
|
|
53716
|
-
// const isAuthorized = await this._permissionService.isAuthorized(element.code, `test/lksjeflksejflseifjseifjslkejfkiki/test/kkjlskejflsekfjseklfj`.toUpperCase());
|
|
53717
53760
|
if (isAuthorized) {
|
|
53718
53761
|
arr.push(element);
|
|
53719
53762
|
}
|
|
@@ -53748,7 +53791,7 @@
|
|
|
53748
53791
|
}
|
|
53749
53792
|
});
|
|
53750
53793
|
if (_this.appSwitcherItems.length === 1) {
|
|
53751
|
-
_this.switchApp(_this.appSwitcherItems[0]);
|
|
53794
|
+
setTimeout(function (x) { return _this.switchApp(_this.appSwitcherItems[0]); }, 100);
|
|
53752
53795
|
}
|
|
53753
53796
|
}
|
|
53754
53797
|
});
|
|
@@ -53958,7 +54001,7 @@
|
|
|
53958
54001
|
}
|
|
53959
54002
|
});
|
|
53960
54003
|
if (_this.appSwitcherItems.length === 1) {
|
|
53961
|
-
_this.switchApp(_this.appSwitcherItems[0]);
|
|
54004
|
+
setTimeout(function (x) { return _this.switchApp(_this.appSwitcherItems[0]); }, 100);
|
|
53962
54005
|
}
|
|
53963
54006
|
}
|
|
53964
54007
|
});
|