@hmcts/media-viewer 4.1.0-exui-2900-rc1 → 4.1.0-viewport-debug
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/esm2022/lib/annotations/annotation-set/annotation-create/box-highlight-create/box-highlight-create.component.mjs +5 -4
- package/esm2022/lib/annotations/annotation-set/annotation-create/highlight-create/highlight-create.directive.mjs +4 -2
- package/esm2022/lib/annotations/annotation-set/ctx-toolbar/ctx-toolbar.component.mjs +4 -3
- package/esm2022/lib/annotations/comment-set/comment/comment.component.mjs +3 -2
- package/esm2022/lib/annotations/comment-set/comment-set-render.service.mjs +3 -2
- package/esm2022/lib/icp/icp-update.service.mjs +2 -2
- package/esm2022/lib/icp/socket.service.mjs +3 -5
- package/esm2022/lib/media-viewer.component.mjs +3 -2
- package/esm2022/lib/shared/util/helpers/html-templates.helper.mjs +12 -1
- package/esm2022/lib/toolbar/main-toolbar/main-toolbar.component.mjs +4 -3
- package/esm2022/lib/toolbar/redaction-search-bar/redaction-search-bar.component.mjs +3 -2
- package/fesm2022/hmcts-media-viewer.mjs +46 -35
- package/fesm2022/hmcts-media-viewer.mjs.map +1 -1
- package/lib/annotations/annotation-set/annotation-create/box-highlight-create/box-highlight-create.component.d.ts.map +1 -1
- package/lib/annotations/annotation-set/annotation-create/highlight-create/highlight-create.directive.d.ts.map +1 -1
- package/lib/annotations/annotation-set/ctx-toolbar/ctx-toolbar.component.d.ts.map +1 -1
- package/lib/annotations/comment-set/comment/comment.component.d.ts.map +1 -1
- package/lib/annotations/comment-set/comment-set-render.service.d.ts.map +1 -1
- package/lib/icp/socket.service.d.ts +1 -1
- package/lib/icp/socket.service.d.ts.map +1 -1
- package/lib/media-viewer.component.d.ts.map +1 -1
- package/lib/shared/util/helpers/html-templates.helper.d.ts +1 -0
- package/lib/shared/util/helpers/html-templates.helper.d.ts.map +1 -1
- package/lib/toolbar/main-toolbar/main-toolbar.component.d.ts.map +1 -1
- package/lib/toolbar/redaction-search-bar/redaction-search-bar.component.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -2067,10 +2067,8 @@ class SocketService {
|
|
|
2067
2067
|
ngOnDestroy() {
|
|
2068
2068
|
this.subscription.unsubscribe();
|
|
2069
2069
|
}
|
|
2070
|
-
connect(url
|
|
2071
|
-
|
|
2072
|
-
socketUrl.searchParams.append('sessionId', `${caseId}--${documentId}`);
|
|
2073
|
-
return this.getSocketClient(socketUrl.toString()).subscribe((socket) => {
|
|
2070
|
+
connect(url) {
|
|
2071
|
+
return this.getSocketClient(url).subscribe((socket) => {
|
|
2074
2072
|
socket.onopen = (event) => {
|
|
2075
2073
|
this.connected$.next(true);
|
|
2076
2074
|
};
|
|
@@ -2177,7 +2175,7 @@ class IcpUpdateService {
|
|
|
2177
2175
|
}
|
|
2178
2176
|
joinSession(username, session) {
|
|
2179
2177
|
this.session = session;
|
|
2180
|
-
this.socket.connect(session.connectionUrl
|
|
2178
|
+
this.socket.connect(session.connectionUrl);
|
|
2181
2179
|
this.socket.connected().subscribe(isConnected => {
|
|
2182
2180
|
if (isConnected) {
|
|
2183
2181
|
this.socket.join({ ...this.session, username });
|
|
@@ -2513,6 +2511,35 @@ const defaultUnsupportedOptions = {
|
|
|
2513
2511
|
showPrint: true
|
|
2514
2512
|
};
|
|
2515
2513
|
|
|
2514
|
+
/**
|
|
2515
|
+
* Helper Class
|
|
2516
|
+
* Used for dynamic templates manipulation
|
|
2517
|
+
* */
|
|
2518
|
+
class HtmlTemplatesHelper {
|
|
2519
|
+
static setDescribedBy(errorMessage, config) {
|
|
2520
|
+
if (!errorMessage) {
|
|
2521
|
+
return config.hint ? `${config.id}-hint` : null;
|
|
2522
|
+
}
|
|
2523
|
+
else if (errorMessage && errorMessage.isInvalid) {
|
|
2524
|
+
return config.hint ? `${config.id}-hint ${config.id}-error` : `${config.id}-error`;
|
|
2525
|
+
}
|
|
2526
|
+
else {
|
|
2527
|
+
return config.hint ? `${config.id}-hint` : null;
|
|
2528
|
+
}
|
|
2529
|
+
}
|
|
2530
|
+
static getAdjustedBoundingRect(element) {
|
|
2531
|
+
const viewportX = window.visualViewport.offsetLeft;
|
|
2532
|
+
const viewportY = window.visualViewport.offsetTop;
|
|
2533
|
+
const viewportScale = window.visualViewport.scale;
|
|
2534
|
+
const viewportPageX = window.visualViewport.pageLeft;
|
|
2535
|
+
const viewportPageY = window.visualViewport.pageTop;
|
|
2536
|
+
if (viewportX || viewportY || viewportScale || viewportPageX || viewportPageY) {
|
|
2537
|
+
console.log(`Viewport X: ${viewportX}, Y: ${viewportY}, Scale: ${viewportScale}, PageX: ${viewportPageX}, PageY: ${viewportPageY}`);
|
|
2538
|
+
}
|
|
2539
|
+
return element.getBoundingClientRect();
|
|
2540
|
+
}
|
|
2541
|
+
}
|
|
2542
|
+
|
|
2516
2543
|
const getTagsRootState = createSelector(getMVState, (state) => state.tags);
|
|
2517
2544
|
const getTagEntities = createSelector(getTagsRootState, getTagNameEnt);
|
|
2518
2545
|
const getTagFilters = createSelector(getTagsRootState, getFilters);
|
|
@@ -2874,7 +2901,7 @@ class RedactionSearchBarComponent {
|
|
|
2874
2901
|
const range = selection.getRangeAt(0).cloneRange();
|
|
2875
2902
|
const clientRects = range.getClientRects();
|
|
2876
2903
|
if (clientRects) {
|
|
2877
|
-
const parentRect = selectedHighLightedElements[0]
|
|
2904
|
+
const parentRect = HtmlTemplatesHelper.getAdjustedBoundingRect(selectedHighLightedElements[0]?.parentElement?.parentElement);
|
|
2878
2905
|
const selectionRectangles = [];
|
|
2879
2906
|
for (let i = 0; i < clientRects.length; i++) {
|
|
2880
2907
|
const selectionRectangle = this.createTextRectangle(clientRects[i], parentRect);
|
|
@@ -3000,7 +3027,7 @@ class CommentSetRenderService {
|
|
|
3000
3027
|
}
|
|
3001
3028
|
}
|
|
3002
3029
|
height(element) {
|
|
3003
|
-
return element.form.nativeElement
|
|
3030
|
+
return HtmlTemplatesHelper.getAdjustedBoundingRect(element.form.nativeElement)?.height | 0;
|
|
3004
3031
|
}
|
|
3005
3032
|
difference(a, b) { return Math.abs(a - b); }
|
|
3006
3033
|
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CommentSetRenderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
@@ -3316,7 +3343,7 @@ class CommentComponent {
|
|
|
3316
3343
|
return this.totalPrevPagesHeight + (this.rectTop * this.zoom);
|
|
3317
3344
|
}
|
|
3318
3345
|
get height() {
|
|
3319
|
-
return this.form.nativeElement
|
|
3346
|
+
return HtmlTemplatesHelper.getAdjustedBoundingRect(this.form.nativeElement).height / this.zoom;
|
|
3320
3347
|
}
|
|
3321
3348
|
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CommentComponent, deps: [{ token: i1.Store }, { token: CommentService }, { token: TagsServices }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3322
3349
|
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: CommentComponent, selector: "mv-anno-comment", inputs: { rotate: "rotate", zoom: "zoom", index: "index", page: "page", comment: "comment", annotation: "annotation" }, outputs: { commentClick: "commentClick", renderComments: "renderComments", delete: "delete", updated: "updated", changes: "changes" }, viewQueries: [{ propertyName: "form", first: true, predicate: ["form"], descendants: true }, { propertyName: "editableComment", first: true, predicate: ["editableComment"], descendants: true }], ngImport: i0, template: "<div\n #form\n (click)=\"onCommentClick()\"\n class=\"aui-comment\"\n [ngClass]=\"{ stylestoggle: (marginToComment$ | async) }\"\n [style.top.px]=\"commentTop\"\n [style.zIndex]=\"selected ? 100 : 0\"\n>\n <div id=\"detailsWrapper {{ index }}\" class=\"aui-comment__header\">\n <span *ngIf=\"author && !editor\" class=\"aui-comment__author\">\n {{ author.forename }} {{ author.surname }}\n </span>\n <span *ngIf=\"editor\" class=\"aui-comment__author\">\n {{ editor.forename }} {{ editor.surname }}\n </span>\n <time [hidden]=\"!selected && !this.editable\" class=\"aui-comment__meta\">\n {{ lastUpdate | momentDate : \"d MMMM y h:mm a\" }}\n </time>\n </div>\n <mv-tags\n [tagItems]=\"tagItems\"\n [userId]=\"createdBy\"\n [editable]=\"editable\"\n [annoId]=\"_comment.annotationId\"\n >\n </mv-tags>\n <textarea\n *ngIf=\"selected && editable\"\n #editableComment\n mvTextAreaAutoExpand\n type=\"text\"\n required\n name=\"content\"\n [maxlength]=\"CHAR_LIMIT\"\n class=\"aui-comment__content form-control mimic-focus edit-mode expanded\"\n [ngModel]=\"fullComment\"\n (ngModelChange)=\"fullComment = $event; reRenderComments(); onCommentChange($event)\"\n aria-label=\"comment\"\n >\n </textarea>\n <p\n *ngIf=\"!editable\"\n mvTextHighlight\n class=\"commentText\"\n [textToHighlight]=\"searchString\"\n >\n {{ fullComment }}\n </p>\n <div\n *ngIf=\"\n selected ||\n this.editable ||\n (!fullComment.length && tagItems && !tagItems.length)\n \"\n class=\"aui-comment__footer commentBtns\"\n >\n <button\n class=\"govuk-button\"\n type=\"button\"\n role=\"button\"\n (click)=\"editOrSave()\"\n >\n {{ !editable ? (\"Edit\" | rpxTranslate) : (\"Save\" | rpxTranslate) }}\n </button>\n <button\n type=\"button\"\n role=\"button\"\n class=\"govuk-button govuk-button--secondary\"\n (click)=\"deleteOrCancel()\"\n >\n {{ !editable ? (\"Delete\" | rpxTranslate) : (\"Cancel\" | rpxTranslate) }}\n </button>\n </div>\n <span class=\"aui-comment__private\">{{ \"private\" | rpxTranslate }}</span>\n</div>\n", dependencies: [{ kind: "directive", type: i5.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: TextHighlightDirective, selector: "[mvTextHighlight]", inputs: ["textToHighlight"] }, { kind: "directive", type: TextareaAutoExpandDirective, selector: "[mvTextAreaAutoExpand]" }, { kind: "component", type: TagsComponent, selector: "mv-tags", inputs: ["tagItems", "userId", "editable", "annoId"] }, { kind: "pipe", type: i5.AsyncPipe, name: "async" }, { kind: "pipe", type: i5$1.RpxTranslatePipe, name: "rpxTranslate" }, { kind: "pipe", type: MomentDatePipe, name: "momentDate" }] }); }
|
|
@@ -3809,7 +3836,7 @@ class BoxHighlightCreateComponent {
|
|
|
3809
3836
|
this.highlightPage();
|
|
3810
3837
|
return;
|
|
3811
3838
|
}
|
|
3812
|
-
const rect = event.target
|
|
3839
|
+
const rect = HtmlTemplatesHelper.getAdjustedBoundingRect(event.target), offsetX = event.clientX - rect.left, offsetY = event.clientY - rect.top;
|
|
3813
3840
|
console.log(`initHighlight: rect=${JSON.stringify(rect)}, clientX=${event.clientX}, clientY=${event.clientY}, offsetX=${offsetX}, offsetY=${offsetY}`);
|
|
3814
3841
|
this.position = 'absolute';
|
|
3815
3842
|
this.backgroundColor = 'yellow';
|
|
@@ -3834,8 +3861,7 @@ class BoxHighlightCreateComponent {
|
|
|
3834
3861
|
}
|
|
3835
3862
|
}
|
|
3836
3863
|
updateHighlight(event) {
|
|
3837
|
-
const rect = event.target
|
|
3838
|
-
console.log(`updateHighlight: rect=${JSON.stringify(rect)}, clientX=${event.clientX}, clientY=${event.clientY}, offsetX=${offsetX}, offsetY=${offsetY}`);
|
|
3864
|
+
const rect = HtmlTemplatesHelper.getAdjustedBoundingRect(event.target), offsetX = event.clientX - rect.left, offsetY = event.clientY - rect.top;
|
|
3839
3865
|
if (this.drawStartX > 0 && this.drawStartY > 0) {
|
|
3840
3866
|
this.height = Math.abs(offsetY - this.drawStartY);
|
|
3841
3867
|
this.width = Math.abs(offsetX - this.drawStartX);
|
|
@@ -3848,6 +3874,7 @@ class BoxHighlightCreateComponent {
|
|
|
3848
3874
|
let rectangle = this.highlightService
|
|
3849
3875
|
.applyRotation(this.pageHeight, this.pageWidth, this.height, this.width, this.top, this.left, this.rotate, this.zoom);
|
|
3850
3876
|
rectangle = { id: v4(), ...rectangle };
|
|
3877
|
+
console.log(`createHighlight: rectangle=${JSON.stringify(rectangle)}`);
|
|
3851
3878
|
this.saveSelection.emit({ rectangles: [rectangle], page: this.page });
|
|
3852
3879
|
this.resetHighlight();
|
|
3853
3880
|
}
|
|
@@ -4037,10 +4064,11 @@ class CtxToolbarComponent {
|
|
|
4037
4064
|
addOrEditComment() {
|
|
4038
4065
|
this.addOrEditCommentEvent.emit();
|
|
4039
4066
|
setTimeout(() => {
|
|
4067
|
+
// This hack to wait until the element is rendered seems to be unreliable,
|
|
4040
4068
|
if (!location.hash) {
|
|
4041
|
-
document.getElementById('viewerContainer')
|
|
4069
|
+
document.getElementById('viewerContainer')?.scrollBy(0, 1);
|
|
4042
4070
|
}
|
|
4043
|
-
},
|
|
4071
|
+
}, 20);
|
|
4044
4072
|
}
|
|
4045
4073
|
createBookmark() {
|
|
4046
4074
|
this.createBookmarkEvent.emit(this.rectangle);
|
|
@@ -4919,7 +4947,8 @@ class HighlightCreateDirective {
|
|
|
4919
4947
|
const range = selection.getRangeAt(0).cloneRange();
|
|
4920
4948
|
const clientRects = range.getClientRects();
|
|
4921
4949
|
if (clientRects) {
|
|
4922
|
-
const parentRect =
|
|
4950
|
+
const parentRect = HtmlTemplatesHelper
|
|
4951
|
+
.getAdjustedBoundingRect(localElement.closest(".textLayer"));
|
|
4923
4952
|
const selectionRectangles = [];
|
|
4924
4953
|
for (let i = 0; i < clientRects.length; i++) {
|
|
4925
4954
|
const selectionRectangle = this.createTextRectangle(clientRects[i], parentRect);
|
|
@@ -5758,8 +5787,8 @@ class MainToolbarComponent {
|
|
|
5758
5787
|
}
|
|
5759
5788
|
}
|
|
5760
5789
|
ngAfterViewInit() {
|
|
5761
|
-
Array.from(this.mvToolbarMain.nativeElement.children).forEach(button => {
|
|
5762
|
-
this.allButtonsWidth +=
|
|
5790
|
+
Array.from(this.mvToolbarMain.nativeElement.children).forEach((button) => {
|
|
5791
|
+
this.allButtonsWidth += HtmlTemplatesHelper.getAdjustedBoundingRect(button).width;
|
|
5763
5792
|
this.widthRequiredForBtn[button.id] = this.allButtonsWidth;
|
|
5764
5793
|
});
|
|
5765
5794
|
this.cdr.detectChanges();
|
|
@@ -6060,24 +6089,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
6060
6089
|
type: Input
|
|
6061
6090
|
}] } });
|
|
6062
6091
|
|
|
6063
|
-
/**
|
|
6064
|
-
* Helper Class
|
|
6065
|
-
* Used for dynamic templates manipulation
|
|
6066
|
-
* */
|
|
6067
|
-
class HtmlTemplatesHelper {
|
|
6068
|
-
static setDescribedBy(errorMessage, config) {
|
|
6069
|
-
if (!errorMessage) {
|
|
6070
|
-
return config.hint ? `${config.id}-hint` : null;
|
|
6071
|
-
}
|
|
6072
|
-
else if (errorMessage && errorMessage.isInvalid) {
|
|
6073
|
-
return config.hint ? `${config.id}-hint ${config.id}-error` : `${config.id}-error`;
|
|
6074
|
-
}
|
|
6075
|
-
else {
|
|
6076
|
-
return config.hint ? `${config.id}-hint` : null;
|
|
6077
|
-
}
|
|
6078
|
-
}
|
|
6079
|
-
}
|
|
6080
|
-
|
|
6081
6092
|
/*
|
|
6082
6093
|
* Gov Uk Fieldset Component
|
|
6083
6094
|
* Used to wrap group fieldset elements
|
|
@@ -6560,7 +6571,7 @@ class MediaViewerComponent {
|
|
|
6560
6571
|
return;
|
|
6561
6572
|
}
|
|
6562
6573
|
if (!this.height) {
|
|
6563
|
-
const compOffsetTop = this.elRef.nativeElement
|
|
6574
|
+
const compOffsetTop = HtmlTemplatesHelper.getAdjustedBoundingRect(this.elRef.nativeElement).top;
|
|
6564
6575
|
const viewerOffsetTop = this.viewerRef.nativeElement.offsetTop;
|
|
6565
6576
|
const offset = compOffsetTop + viewerOffsetTop;
|
|
6566
6577
|
if (this.prevOffset !== offset) {
|