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.
- package/bundles/tnx-shared.umd.js +93 -13
- 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-manager/file-manager.component.d.ts.map +1 -1
- package/components/file-explorer/file-viewer/file-viewer.component.d.ts +2 -1
- package/components/file-explorer/file-viewer/file-viewer.component.d.ts.map +1 -1
- package/components/file-explorer/services/file-object.service.d.ts +2 -0
- package/components/file-explorer/services/file-object.service.d.ts.map +1 -1
- package/esm2015/components/file-explorer/file-manager/file-manager.component.js +5 -1
- package/esm2015/components/file-explorer/file-viewer/file-viewer.component.js +76 -15
- package/esm2015/components/file-explorer/services/file-object.service.js +7 -1
- package/fesm2015/tnx-shared.js +85 -14
- package/fesm2015/tnx-shared.js.map +1 -1
- package/package.json +2 -2
- package/tnx-shared.metadata.json +1 -1
package/fesm2015/tnx-shared.js
CHANGED
|
@@ -26235,9 +26235,11 @@ class FileObjectService extends BaseService {
|
|
|
26235
26235
|
this.thumborEndpoint = '';
|
|
26236
26236
|
this.fileWithThumborEndpoint = '';
|
|
26237
26237
|
this.filePathEndpoint = '';
|
|
26238
|
+
this.version = '';
|
|
26238
26239
|
this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.fileEndpoint;
|
|
26239
26240
|
this.fileWithThumborEndpoint = _moduleConfigService.getConfig().environment.apiDomain.fileWithThumborEndpoint;
|
|
26240
26241
|
this.thumborEndpoint = _moduleConfigService.getConfig().environment.apiDomain.thumbor;
|
|
26242
|
+
this.version = _moduleConfigService.getConfig().environment.apiVersion;
|
|
26241
26243
|
this.filePathEndpoint = _moduleConfigService.getConfig().environment.apiDomain.filePathEndpoint;
|
|
26242
26244
|
}
|
|
26243
26245
|
getFileUrlWithThumbor(fileId, width = 0, height = 0) {
|
|
@@ -26417,6 +26419,10 @@ class FileObjectService extends BaseService {
|
|
|
26417
26419
|
const url = `${this.serviceUri}/UploadWithByteArray`;
|
|
26418
26420
|
return this._http.post(url, formData, { responseType: 'text' }).toPromise();
|
|
26419
26421
|
}
|
|
26422
|
+
kySoSmartCA(model) {
|
|
26423
|
+
const url = `${this.endPoint}/${this.version}/KySoFile/SmartCASignFile`;
|
|
26424
|
+
return this.defaultPost(url, model);
|
|
26425
|
+
}
|
|
26420
26426
|
}
|
|
26421
26427
|
FileObjectService.ɵprov = i0.ɵɵdefineInjectable({ factory: function FileObjectService_Factory() { return new FileObjectService(i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(ModuleConfigService)); }, token: FileObjectService, providedIn: "root" });
|
|
26422
26428
|
FileObjectService.decorators = [
|
|
@@ -31164,6 +31170,7 @@ class FileManagerComponent extends DataListBase {
|
|
|
31164
31170
|
command: () => {
|
|
31165
31171
|
this.signFileSmartCA(item);
|
|
31166
31172
|
},
|
|
31173
|
+
visible: item.extension == '.PDF'
|
|
31167
31174
|
},
|
|
31168
31175
|
{
|
|
31169
31176
|
label: 'Ký số cá nhân (USB)', icon: 'fas fa-signature',
|
|
@@ -32112,7 +32119,10 @@ class FileManagerComponent extends DataListBase {
|
|
|
32112
32119
|
entity: rowData.entity,
|
|
32113
32120
|
entityKey: rowData.entityKey,
|
|
32114
32121
|
fileBase64Content: dataKySo.fileBase64Content,
|
|
32122
|
+
userChuKySoId: dataKySo.id,
|
|
32115
32123
|
showKySoButton: true,
|
|
32124
|
+
width: dataKySo.width,
|
|
32125
|
+
height: dataKySo.height,
|
|
32116
32126
|
};
|
|
32117
32127
|
this.forms.fileViewer.show = true;
|
|
32118
32128
|
});
|
|
@@ -34046,6 +34056,19 @@ class FileViewerComponent extends ComponentBase {
|
|
|
34046
34056
|
return styleClass;
|
|
34047
34057
|
}
|
|
34048
34058
|
kySoHandle() {
|
|
34059
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34060
|
+
this.showWaitBox('Đang thực hiện ký số, vui lòng kiểm tra ứng dụng SmartCA');
|
|
34061
|
+
const res = yield this._fileObjectService.kySoSmartCA(this.model.data);
|
|
34062
|
+
if (res.success) {
|
|
34063
|
+
this._notifierService.showSuccess('Thực hiện ký số thành công');
|
|
34064
|
+
}
|
|
34065
|
+
else {
|
|
34066
|
+
this._notifierService.showWarning(res.error);
|
|
34067
|
+
}
|
|
34068
|
+
this.hideWaitBox();
|
|
34069
|
+
this.show = false;
|
|
34070
|
+
this.onClose.next();
|
|
34071
|
+
});
|
|
34049
34072
|
}
|
|
34050
34073
|
ngAfterViewInit() {
|
|
34051
34074
|
// Access the PDF.js viewer instance
|
|
@@ -34053,11 +34076,33 @@ class FileViewerComponent extends ComponentBase {
|
|
|
34053
34076
|
var _a;
|
|
34054
34077
|
const pdfViewer = (_a = window.PDFViewerApplication) === null || _a === void 0 ? void 0 : _a.pdfViewer;
|
|
34055
34078
|
if (pdfViewer) {
|
|
34056
|
-
//
|
|
34057
|
-
const
|
|
34058
|
-
|
|
34059
|
-
|
|
34079
|
+
// Lấy tất cả canvas elements
|
|
34080
|
+
const canvases = document.querySelectorAll('#viewerContainer canvas');
|
|
34081
|
+
canvases.forEach((canvas) => {
|
|
34082
|
+
canvas.addEventListener('click', (e) => {
|
|
34083
|
+
this.handlePageClick(e, pdfViewer);
|
|
34084
|
+
});
|
|
34085
|
+
});
|
|
34086
|
+
// Optional: Theo dõi khi có canvas mới được render (khi scroll PDF)
|
|
34087
|
+
const observer = new MutationObserver(() => {
|
|
34088
|
+
const newCanvases = document.querySelectorAll('#viewerContainer canvas');
|
|
34089
|
+
newCanvases.forEach((canvas) => {
|
|
34090
|
+
// Kiểm tra nếu chưa có listener (tránh thêm duplicate)
|
|
34091
|
+
if (!canvas._hasClickListener) {
|
|
34092
|
+
canvas.addEventListener('click', (e) => {
|
|
34093
|
+
this.handlePageClick(e, pdfViewer);
|
|
34094
|
+
});
|
|
34095
|
+
canvas._hasClickListener = true;
|
|
34096
|
+
}
|
|
34097
|
+
});
|
|
34060
34098
|
});
|
|
34099
|
+
const container = document.querySelector('#viewerContainer');
|
|
34100
|
+
if (container) {
|
|
34101
|
+
observer.observe(container, {
|
|
34102
|
+
childList: true,
|
|
34103
|
+
subtree: true
|
|
34104
|
+
});
|
|
34105
|
+
}
|
|
34061
34106
|
}
|
|
34062
34107
|
}, 1000);
|
|
34063
34108
|
}
|
|
@@ -34067,16 +34112,37 @@ class FileViewerComponent extends ComponentBase {
|
|
|
34067
34112
|
if (marker) {
|
|
34068
34113
|
marker.remove();
|
|
34069
34114
|
}
|
|
34070
|
-
if (target.
|
|
34071
|
-
target.tagName === 'CANVAS') {
|
|
34072
|
-
// Get page number and coordinates
|
|
34115
|
+
if (target.tagName === 'CANVAS') {
|
|
34073
34116
|
const pageDiv = target.closest('.page');
|
|
34074
34117
|
const pageNumber = parseInt((pageDiv === null || pageDiv === void 0 ? void 0 : pageDiv.getAttribute('data-page-number')) || '1');
|
|
34075
|
-
|
|
34076
|
-
|
|
34077
|
-
|
|
34078
|
-
//
|
|
34079
|
-
|
|
34118
|
+
// Dùng offsetX/Y với scale adjustment
|
|
34119
|
+
let x = event.offsetX;
|
|
34120
|
+
let y = event.offsetY;
|
|
34121
|
+
// Điều chỉnh theo scale của canvas
|
|
34122
|
+
const scaleX = target.width / target.clientWidth;
|
|
34123
|
+
const scaleY = target.height / target.clientHeight;
|
|
34124
|
+
x = x * scaleX;
|
|
34125
|
+
y = y * scaleY;
|
|
34126
|
+
const WIDTH = this.model.data.width || 100;
|
|
34127
|
+
const HEIGHT = this.model.data.height || 100;
|
|
34128
|
+
// Convert pixel sang point
|
|
34129
|
+
const clickXPoint = this.pixelToPoint(x);
|
|
34130
|
+
const clickYPoint = this.pixelToPoint(y);
|
|
34131
|
+
const widthPoint = this.pixelToPoint(WIDTH);
|
|
34132
|
+
const heightPoint = this.pixelToPoint(HEIGHT);
|
|
34133
|
+
const canvasHeightPoint = this.pixelToPoint(target.height);
|
|
34134
|
+
// Chuyển đổi Y coordinate (PDF origin ở dưới)
|
|
34135
|
+
const pdfY = canvasHeightPoint - clickYPoint;
|
|
34136
|
+
const x1 = clickXPoint;
|
|
34137
|
+
const y1 = pdfY - heightPoint;
|
|
34138
|
+
const x2 = clickXPoint + widthPoint;
|
|
34139
|
+
const y2 = pdfY;
|
|
34140
|
+
const rectangle = `${Math.floor(x1)},${Math.floor(y1)},${Math.floor(x2)},${Math.floor(y2)}`;
|
|
34141
|
+
console.log('PDF Rectangle:', rectangle);
|
|
34142
|
+
console.log('==================');
|
|
34143
|
+
this.model.data.signatureLocation = rectangle;
|
|
34144
|
+
// Tạo marker với tọa độ đã điều chỉnh (nhưng hiển thị theo display size)
|
|
34145
|
+
this.createMarker(target, event.offsetX, event.offsetY, pageNumber);
|
|
34080
34146
|
}
|
|
34081
34147
|
}
|
|
34082
34148
|
createMarker(parent, x, y, page) {
|
|
@@ -34086,8 +34152,9 @@ class FileViewerComponent extends ComponentBase {
|
|
|
34086
34152
|
position: absolute;
|
|
34087
34153
|
left: ${x}px;
|
|
34088
34154
|
top: ${y}px;
|
|
34089
|
-
|
|
34090
|
-
|
|
34155
|
+
transform: translate(-50%,-50%);
|
|
34156
|
+
width: ${this.model.data.width}px;
|
|
34157
|
+
height: ${this.model.data.height}px;
|
|
34091
34158
|
background-image: url(${this.model.data.fileBase64Content});
|
|
34092
34159
|
pointer-events: none;
|
|
34093
34160
|
background-size: contain; /* Fits the image */
|
|
@@ -34095,9 +34162,13 @@ class FileViewerComponent extends ComponentBase {
|
|
|
34095
34162
|
background-position: center top; /* Positioning */
|
|
34096
34163
|
z-index: 999;
|
|
34097
34164
|
`;
|
|
34165
|
+
this.model.data.page = page;
|
|
34098
34166
|
const pageContainer = parent.closest('.page');
|
|
34099
34167
|
pageContainer === null || pageContainer === void 0 ? void 0 : pageContainer.appendChild(marker);
|
|
34100
34168
|
}
|
|
34169
|
+
pixelToPoint(pixel, dpi = 96) {
|
|
34170
|
+
return pixel * 72 / dpi;
|
|
34171
|
+
}
|
|
34101
34172
|
}
|
|
34102
34173
|
FileViewerComponent.decorators = [
|
|
34103
34174
|
{ type: Component, args: [{
|