tnx-shared 5.3.408 → 5.3.410

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.
@@ -30665,9 +30665,11 @@
30665
30665
  _this.thumborEndpoint = '';
30666
30666
  _this.fileWithThumborEndpoint = '';
30667
30667
  _this.filePathEndpoint = '';
30668
+ _this.version = '';
30668
30669
  _this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.fileEndpoint;
30669
30670
  _this.fileWithThumborEndpoint = _moduleConfigService.getConfig().environment.apiDomain.fileWithThumborEndpoint;
30670
30671
  _this.thumborEndpoint = _moduleConfigService.getConfig().environment.apiDomain.thumbor;
30672
+ _this.version = _moduleConfigService.getConfig().environment.apiVersion;
30671
30673
  _this.filePathEndpoint = _moduleConfigService.getConfig().environment.apiDomain.filePathEndpoint;
30672
30674
  return _this;
30673
30675
  }
@@ -30850,6 +30852,10 @@
30850
30852
  var url = this.serviceUri + "/UploadWithByteArray";
30851
30853
  return this._http.post(url, formData, { responseType: 'text' }).toPromise();
30852
30854
  };
30855
+ FileObjectService.prototype.kySoSmartCA = function (model) {
30856
+ var url = this.endPoint + "/" + this.version + "/KySoFile/SmartCASignFile";
30857
+ return this.defaultPost(url, model);
30858
+ };
30853
30859
  return FileObjectService;
30854
30860
  }(BaseService));
30855
30861
  FileObjectService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function FileObjectService_Factory() { return new FileObjectService(i0__namespace.ɵɵinject(i1__namespace$1.HttpClient), i0__namespace.ɵɵinject(i0__namespace.INJECTOR), i0__namespace.ɵɵinject(ModuleConfigService)); }, token: FileObjectService, providedIn: "root" });
@@ -35762,6 +35768,7 @@
35762
35768
  command: function () {
35763
35769
  _this.signFileSmartCA(item);
35764
35770
  },
35771
+ visible: item.extension == '.PDF'
35765
35772
  },
35766
35773
  {
35767
35774
  label: 'Ký số cá nhân (USB)', icon: 'fas fa-signature',
@@ -36832,7 +36839,10 @@
36832
36839
  entity: rowData.entity,
36833
36840
  entityKey: rowData.entityKey,
36834
36841
  fileBase64Content: dataKySo.fileBase64Content,
36842
+ userChuKySoId: dataKySo.id,
36835
36843
  showKySoButton: true,
36844
+ width: dataKySo.width,
36845
+ height: dataKySo.height,
36836
36846
  };
36837
36847
  this.forms.fileViewer.show = true;
36838
36848
  return [2 /*return*/];
@@ -50540,6 +50550,28 @@
50540
50550
  return styleClass;
50541
50551
  };
50542
50552
  FileViewerComponent.prototype.kySoHandle = function () {
50553
+ return __awaiter(this, void 0, void 0, function () {
50554
+ var res;
50555
+ return __generator(this, function (_b) {
50556
+ switch (_b.label) {
50557
+ case 0:
50558
+ this.showWaitBox('Đang thực hiện ký số, vui lòng kiểm tra ứng dụng SmartCA');
50559
+ return [4 /*yield*/, this._fileObjectService.kySoSmartCA(this.model.data)];
50560
+ case 1:
50561
+ res = _b.sent();
50562
+ if (res.success) {
50563
+ this._notifierService.showSuccess('Thực hiện ký số thành công');
50564
+ }
50565
+ else {
50566
+ this._notifierService.showWarning(res.error);
50567
+ }
50568
+ this.hideWaitBox();
50569
+ this.show = false;
50570
+ this.onClose.next();
50571
+ return [2 /*return*/];
50572
+ }
50573
+ });
50574
+ });
50543
50575
  };
50544
50576
  FileViewerComponent.prototype.ngAfterViewInit = function () {
50545
50577
  var _this = this;
@@ -50548,11 +50580,33 @@
50548
50580
  var _a;
50549
50581
  var pdfViewer = (_a = window.PDFViewerApplication) === null || _a === void 0 ? void 0 : _a.pdfViewer;
50550
50582
  if (pdfViewer) {
50551
- // Add click listener to each page canvas
50552
- var container = document.querySelector('#viewerContainer');
50553
- container === null || container === void 0 ? void 0 : container.addEventListener('click', function (e) {
50554
- _this.handlePageClick(e, pdfViewer);
50583
+ // Lấy tất cả canvas elements
50584
+ var canvases = document.querySelectorAll('#viewerContainer canvas');
50585
+ canvases.forEach(function (canvas) {
50586
+ canvas.addEventListener('click', function (e) {
50587
+ _this.handlePageClick(e, pdfViewer);
50588
+ });
50589
+ });
50590
+ // Optional: Theo dõi khi có canvas mới được render (khi scroll PDF)
50591
+ var observer = new MutationObserver(function () {
50592
+ var newCanvases = document.querySelectorAll('#viewerContainer canvas');
50593
+ newCanvases.forEach(function (canvas) {
50594
+ // Kiểm tra nếu chưa có listener (tránh thêm duplicate)
50595
+ if (!canvas._hasClickListener) {
50596
+ canvas.addEventListener('click', function (e) {
50597
+ _this.handlePageClick(e, pdfViewer);
50598
+ });
50599
+ canvas._hasClickListener = true;
50600
+ }
50601
+ });
50555
50602
  });
50603
+ var container = document.querySelector('#viewerContainer');
50604
+ if (container) {
50605
+ observer.observe(container, {
50606
+ childList: true,
50607
+ subtree: true
50608
+ });
50609
+ }
50556
50610
  }
50557
50611
  }, 1000);
50558
50612
  };
@@ -50562,25 +50616,51 @@
50562
50616
  if (marker) {
50563
50617
  marker.remove();
50564
50618
  }
50565
- if (target.classList.contains('canvasWrapper') ||
50566
- target.tagName === 'CANVAS') {
50567
- // Get page number and coordinates
50619
+ if (target.tagName === 'CANVAS') {
50568
50620
  var pageDiv = target.closest('.page');
50569
50621
  var pageNumber = parseInt((pageDiv === null || pageDiv === void 0 ? void 0 : pageDiv.getAttribute('data-page-number')) || '1');
50570
- var rect = target.getBoundingClientRect();
50571
- var x = event.clientX - rect.left;
50572
- var y = event.clientY - rect.top;
50573
- // Create marker at this position
50574
- this.createMarker(target, x, y, pageNumber);
50622
+ // Dùng offsetX/Y với scale adjustment
50623
+ var x = event.offsetX;
50624
+ var y = event.offsetY;
50625
+ // Điều chỉnh theo scale của canvas
50626
+ var scaleX = target.width / target.clientWidth;
50627
+ var scaleY = target.height / target.clientHeight;
50628
+ x = x * scaleX;
50629
+ y = y * scaleY;
50630
+ var WIDTH = this.model.data.width || 100;
50631
+ var HEIGHT = this.model.data.height || 100;
50632
+ // Convert pixel sang point
50633
+ var clickXPoint = this.pixelToPoint(x);
50634
+ var clickYPoint = this.pixelToPoint(y);
50635
+ var widthPoint = this.pixelToPoint(WIDTH);
50636
+ var heightPoint = this.pixelToPoint(HEIGHT);
50637
+ var canvasHeightPoint = this.pixelToPoint(target.height);
50638
+ // Chuyển đổi Y coordinate (PDF origin ở dưới)
50639
+ var pdfY = canvasHeightPoint - clickYPoint;
50640
+ var x1 = clickXPoint;
50641
+ var y1 = pdfY - heightPoint;
50642
+ var x2 = clickXPoint + widthPoint;
50643
+ var y2 = pdfY;
50644
+ var rectangle = Math.floor(x1) + "," + Math.floor(y1) + "," + Math.floor(x2) + "," + Math.floor(y2);
50645
+ console.log('PDF Rectangle:', rectangle);
50646
+ console.log('==================');
50647
+ this.model.data.signatureLocation = rectangle;
50648
+ // Tạo marker với tọa độ đã điều chỉnh (nhưng hiển thị theo display size)
50649
+ this.createMarker(target, event.offsetX, event.offsetY, pageNumber);
50575
50650
  }
50576
50651
  };
50577
50652
  FileViewerComponent.prototype.createMarker = function (parent, x, y, page) {
50578
50653
  var marker = document.createElement('div');
50579
50654
  marker.id = 'custom-marker';
50580
- marker.style.cssText = "\n position: absolute;\n left: " + x + "px;\n top: " + y + "px;\n width: 100px;\n height: 100px;\n background-image: url(" + this.model.data.fileBase64Content + ");\n pointer-events: none;\n background-size: contain; /* Fits the image */\n background-repeat: no-repeat; /* No tiling */\n background-position: center top; /* Positioning */\n z-index: 999;\n ";
50655
+ marker.style.cssText = "\n position: absolute;\n left: " + x + "px;\n top: " + y + "px;\n transform: translate(-50%,-50%);\n width: " + this.model.data.width + "px;\n height: " + this.model.data.height + "px;\n background-image: url(" + this.model.data.fileBase64Content + ");\n pointer-events: none;\n background-size: contain; /* Fits the image */\n background-repeat: no-repeat; /* No tiling */\n background-position: center top; /* Positioning */\n z-index: 999;\n ";
50656
+ this.model.data.page = page;
50581
50657
  var pageContainer = parent.closest('.page');
50582
50658
  pageContainer === null || pageContainer === void 0 ? void 0 : pageContainer.appendChild(marker);
50583
50659
  };
50660
+ FileViewerComponent.prototype.pixelToPoint = function (pixel, dpi) {
50661
+ if (dpi === void 0) { dpi = 96; }
50662
+ return pixel * 72 / dpi;
50663
+ };
50584
50664
  return FileViewerComponent;
50585
50665
  }(ComponentBase));
50586
50666
  FileViewerComponent.decorators = [