ngx-rendering-service-lib 0.0.0
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/environments/environment.d.ts +5 -0
- package/esm2022/environments/environment.mjs +6 -0
- package/esm2022/index.mjs +13 -0
- package/esm2022/lib/dto/AssetStateData.mjs +2 -0
- package/esm2022/lib/module/RenderModule.mjs +2 -0
- package/esm2022/lib/module/eduhtml/eduHtml.component.mjs +34 -0
- package/esm2022/lib/module/image/image.component.mjs +51 -0
- package/esm2022/lib/module/pdf/pdf.component.mjs +81 -0
- package/esm2022/lib/module/spreadsheet/spreadsheet.component.mjs +47 -0
- package/esm2022/lib/module/url/url.component.mjs +118 -0
- package/esm2022/lib/module/video/video.component.mjs +61 -0
- package/esm2022/lib/render.component.mjs +145 -0
- package/esm2022/lib/rendering-api.module.mjs +23 -0
- package/esm2022/lib/rendering.module.mjs +25 -0
- package/esm2022/ngx-rendering-service-lib.mjs +5 -0
- package/esm2022/rendering-service-lib.module.mjs +32 -0
- package/fesm2022/ngx-rendering-service-lib.mjs +613 -0
- package/fesm2022/ngx-rendering-service-lib.mjs.map +1 -0
- package/index.d.ts +9 -0
- package/lib/dto/AssetStateData.d.ts +10 -0
- package/lib/module/RenderModule.d.ts +6 -0
- package/lib/module/eduhtml/eduHtml.component.d.ts +14 -0
- package/lib/module/image/image.component.d.ts +17 -0
- package/lib/module/pdf/pdf.component.d.ts +21 -0
- package/lib/module/spreadsheet/spreadsheet.component.d.ts +17 -0
- package/lib/module/url/url.component.d.ts +29 -0
- package/lib/module/video/video.component.d.ts +15 -0
- package/lib/render.component.d.ts +25 -0
- package/lib/rendering-api.module.d.ts +7 -0
- package/lib/rendering.module.d.ts +8 -0
- package/package.json +39 -0
- package/rendering-service-lib.module.d.ts +10 -0
|
@@ -0,0 +1,613 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { NgModule, signal, Component, Input, HostListener, ViewChild, ViewEncapsulation } from '@angular/core';
|
|
3
|
+
import * as i2 from '@angular/common';
|
|
4
|
+
import { CommonModule, NgOptimizedImage } from '@angular/common';
|
|
5
|
+
import * as i1 from 'ngx-edu-sharing-api';
|
|
6
|
+
import { EduSharingApiModule } from 'ngx-edu-sharing-api';
|
|
7
|
+
import * as i3 from '@angular/material/icon';
|
|
8
|
+
import { MatIconModule, MatIcon } from '@angular/material/icon';
|
|
9
|
+
import * as i2$1 from '@angular/material/button';
|
|
10
|
+
import { MatButtonModule, MatIconButton } from '@angular/material/button';
|
|
11
|
+
import { MatSelect, MatOption } from '@angular/material/select';
|
|
12
|
+
import { FormsModule } from '@angular/forms';
|
|
13
|
+
import { MatMenu, MatMenuTrigger, MatMenuItem } from '@angular/material/menu';
|
|
14
|
+
import * as i3$1 from 'ng2-pdfjs-viewer';
|
|
15
|
+
import { PdfJsViewerModule } from 'ng2-pdfjs-viewer';
|
|
16
|
+
import * as i1$1 from 'ngx-rendering-service-api';
|
|
17
|
+
import { RenderingServiceApiModule } from 'ngx-rendering-service-api';
|
|
18
|
+
import { YouTubePlayer } from '@angular/youtube-player';
|
|
19
|
+
import * as i1$2 from '@angular/platform-browser';
|
|
20
|
+
import { BehaviorSubject, Subject, firstValueFrom, interval, takeUntil, switchMap } from 'rxjs';
|
|
21
|
+
import * as i3$2 from '@angular/material/progress-spinner';
|
|
22
|
+
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
23
|
+
import * as i4 from '@angular/material/progress-bar';
|
|
24
|
+
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
|
25
|
+
|
|
26
|
+
const environment = {
|
|
27
|
+
production: false,
|
|
28
|
+
rootUrl: 'http://localhost:8080',
|
|
29
|
+
esRootUrl: 'http://repository.127.0.0.1.nip.io:8100/edu-sharing/rest',
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
class RenderingModule {
|
|
33
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: RenderingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
34
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.6", ngImport: i0, type: RenderingModule, imports: [CommonModule, i1.EduSharingApiModule], exports: [CommonModule] }); }
|
|
35
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: RenderingModule, imports: [CommonModule,
|
|
36
|
+
EduSharingApiModule.forRoot({ rootUrl: environment.esRootUrl }), CommonModule] }); }
|
|
37
|
+
}
|
|
38
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: RenderingModule, decorators: [{
|
|
39
|
+
type: NgModule,
|
|
40
|
+
args: [{
|
|
41
|
+
imports: [
|
|
42
|
+
CommonModule,
|
|
43
|
+
EduSharingApiModule.forRoot({ rootUrl: environment.esRootUrl })
|
|
44
|
+
],
|
|
45
|
+
exports: [
|
|
46
|
+
CommonModule
|
|
47
|
+
]
|
|
48
|
+
}]
|
|
49
|
+
}] });
|
|
50
|
+
|
|
51
|
+
class ImageComponent {
|
|
52
|
+
constructor(element) {
|
|
53
|
+
this.element = element;
|
|
54
|
+
this.activeObject = signal(undefined);
|
|
55
|
+
}
|
|
56
|
+
ngAfterViewInit() {
|
|
57
|
+
this.loadOptimalSize();
|
|
58
|
+
}
|
|
59
|
+
loadOptimalSize() {
|
|
60
|
+
const size = this.element.nativeElement.getBoundingClientRect();
|
|
61
|
+
const allFinishedItems = this.data?.items?.filter(item => item.link !== "");
|
|
62
|
+
this.activeObject.set(allFinishedItems?.sort((a, b) => {
|
|
63
|
+
// sort by the image size closest to the viewport
|
|
64
|
+
return Math.abs(a.width - size.width) > Math.abs(b.width - size.width) ? 1 : -1;
|
|
65
|
+
})[0]);
|
|
66
|
+
}
|
|
67
|
+
toggleFullscreen() {
|
|
68
|
+
if (document.fullscreenElement) {
|
|
69
|
+
document.exitFullscreen();
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
this.element.nativeElement.requestFullscreen();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: ImageComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
76
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.6", type: ImageComponent, isStandalone: true, selector: "rs-module-image", inputs: { data: "data", node: "node" }, host: { listeners: { "document:fullscreenchange": "loadOptimalSize()" } }, ngImport: i0, template: "<div class=\"image-wrapper\"\n *ngIf=\"activeObject()\"\n>\n <img\n #image\n [src]=\"activeObject()?.link\"\n [alt]=\"node?.title\"\n >\n <button mat-icon-button (click)=\"toggleFullscreen()\"><mat-icon>fullscreen</mat-icon></button>\n</div>\n", styles: [":host{position:relative;display:flex;align-items:center}.image-wrapper{width:100%}.image-wrapper img{width:100%;position:relative}.image-wrapper button{position:absolute;right:0;color:#fff;background-color:#00000080}\n"], dependencies: [{ kind: "ngmodule", type: RenderingModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2$1.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] }); }
|
|
77
|
+
}
|
|
78
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: ImageComponent, decorators: [{
|
|
79
|
+
type: Component,
|
|
80
|
+
args: [{ selector: 'rs-module-image', standalone: true, imports: [
|
|
81
|
+
RenderingModule,
|
|
82
|
+
MatButtonModule,
|
|
83
|
+
MatIconModule,
|
|
84
|
+
], template: "<div class=\"image-wrapper\"\n *ngIf=\"activeObject()\"\n>\n <img\n #image\n [src]=\"activeObject()?.link\"\n [alt]=\"node?.title\"\n >\n <button mat-icon-button (click)=\"toggleFullscreen()\"><mat-icon>fullscreen</mat-icon></button>\n</div>\n", styles: [":host{position:relative;display:flex;align-items:center}.image-wrapper{width:100%}.image-wrapper img{width:100%;position:relative}.image-wrapper button{position:absolute;right:0;color:#fff;background-color:#00000080}\n"] }]
|
|
85
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { data: [{
|
|
86
|
+
type: Input
|
|
87
|
+
}], node: [{
|
|
88
|
+
type: Input
|
|
89
|
+
}], loadOptimalSize: [{
|
|
90
|
+
type: HostListener,
|
|
91
|
+
args: ['document:fullscreenchange']
|
|
92
|
+
}] } });
|
|
93
|
+
|
|
94
|
+
var image_component = /*#__PURE__*/Object.freeze({
|
|
95
|
+
__proto__: null,
|
|
96
|
+
ImageComponent: ImageComponent
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
class VideoComponent {
|
|
100
|
+
constructor() {
|
|
101
|
+
this.activeObject = signal(undefined);
|
|
102
|
+
}
|
|
103
|
+
ngAfterViewInit() {
|
|
104
|
+
const downlink = navigator.connection?.downlink;
|
|
105
|
+
let optimalResolution = 720;
|
|
106
|
+
if (downlink < 2) {
|
|
107
|
+
optimalResolution = 240;
|
|
108
|
+
}
|
|
109
|
+
if (downlink > 6) {
|
|
110
|
+
optimalResolution = 1080;
|
|
111
|
+
}
|
|
112
|
+
const allFinishedItems = this.data?.items?.filter(item => item.link !== "");
|
|
113
|
+
this.activeObject.set(allFinishedItems?.sort((a, b) => {
|
|
114
|
+
// sort by the image size closest to the viewport
|
|
115
|
+
return Math.abs(a.width - optimalResolution) > Math.abs(b.width - optimalResolution) ? 1 : -1;
|
|
116
|
+
})[0]);
|
|
117
|
+
}
|
|
118
|
+
switchResolution(item) {
|
|
119
|
+
this.activeObject.set(item);
|
|
120
|
+
const currentTime = this.videoRef?.nativeElement.currentTime;
|
|
121
|
+
this.videoRef?.nativeElement.load();
|
|
122
|
+
if (currentTime !== undefined) {
|
|
123
|
+
this.videoRef.nativeElement.currentTime = currentTime;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: VideoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
127
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.6", type: VideoComponent, isStandalone: true, selector: "rs-module-video", inputs: { data: "data", node: "node" }, viewQueries: [{ propertyName: "videoRef", first: true, predicate: ["video"], descendants: true }], ngImport: i0, template: "<div class=\"video-wrapper\" *ngIf=\"activeObject()\">\n <video\n controls\n #video\n >\n <source [src]=\"activeObject()?.link\" />\n </video>\n <button\n mat-icon-button\n [matMenuTriggerFor]=\"resolutionMenu\"\n >\n <mat-icon>settings</mat-icon>\n </button>\n <mat-menu\n #resolutionMenu=\"matMenu\"\n xPosition=\"before\"\n >\n <button\n mat-menu-item\n *ngFor=\"let item of data?.items\"\n [disabled]=\"item.link === ''\"\n (click)=\"item.height !== activeObject()?.height && switchResolution(item)\"\n >\n <ng-container\n [ngTemplateOutlet]=\"item.link !== '' ? ready : loading\"\n [ngTemplateOutletContext]=\"{item:item}\"\n >\n </ng-container>\n </button>\n\n </mat-menu>\n</div>\n\n<ng-template #ready let-item='item'>\n <div style=\"display: flex; justify-content: space-between\">\n <mat-icon *ngIf=\"item.height === activeObject()?.height\">\n done\n </mat-icon>\n <div *ngIf=\"item.height !== activeObject()?.height\"></div>\n <div>\n {{item.height}}p\n </div>\n </div>\n</ng-template>\n\n<ng-template #loading let-item='item'>\n <div style=\"display: flex; justify-content: space-between\">\n <div>\n {{item.progress >= 0 ? \"Converting: \" + item.progress + \"%\" : \"Queue position: \" + -item.progress}}\n </div>\n <div style=\"padding-left: .5em\">\n {{item.height}}p\n </div>\n </div>\n</ng-template>\n", styles: [".video-wrapper{width:100%;position:relative}.video-wrapper video{width:100%;display:block}.video-wrapper button{position:absolute;right:0;top:0;color:#fff;background-color:#00000080}\n"], dependencies: [{ kind: "ngmodule", type: RenderingModule }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: FormsModule }, { kind: "component", type: MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "directive", type: MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "component", type: MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }] }); }
|
|
128
|
+
}
|
|
129
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: VideoComponent, decorators: [{
|
|
130
|
+
type: Component,
|
|
131
|
+
args: [{ selector: 'rs-module-video', standalone: true, imports: [
|
|
132
|
+
RenderingModule,
|
|
133
|
+
MatIcon,
|
|
134
|
+
MatIconButton,
|
|
135
|
+
MatSelect,
|
|
136
|
+
FormsModule,
|
|
137
|
+
MatOption,
|
|
138
|
+
MatMenu,
|
|
139
|
+
MatMenuTrigger,
|
|
140
|
+
MatMenuItem
|
|
141
|
+
], template: "<div class=\"video-wrapper\" *ngIf=\"activeObject()\">\n <video\n controls\n #video\n >\n <source [src]=\"activeObject()?.link\" />\n </video>\n <button\n mat-icon-button\n [matMenuTriggerFor]=\"resolutionMenu\"\n >\n <mat-icon>settings</mat-icon>\n </button>\n <mat-menu\n #resolutionMenu=\"matMenu\"\n xPosition=\"before\"\n >\n <button\n mat-menu-item\n *ngFor=\"let item of data?.items\"\n [disabled]=\"item.link === ''\"\n (click)=\"item.height !== activeObject()?.height && switchResolution(item)\"\n >\n <ng-container\n [ngTemplateOutlet]=\"item.link !== '' ? ready : loading\"\n [ngTemplateOutletContext]=\"{item:item}\"\n >\n </ng-container>\n </button>\n\n </mat-menu>\n</div>\n\n<ng-template #ready let-item='item'>\n <div style=\"display: flex; justify-content: space-between\">\n <mat-icon *ngIf=\"item.height === activeObject()?.height\">\n done\n </mat-icon>\n <div *ngIf=\"item.height !== activeObject()?.height\"></div>\n <div>\n {{item.height}}p\n </div>\n </div>\n</ng-template>\n\n<ng-template #loading let-item='item'>\n <div style=\"display: flex; justify-content: space-between\">\n <div>\n {{item.progress >= 0 ? \"Converting: \" + item.progress + \"%\" : \"Queue position: \" + -item.progress}}\n </div>\n <div style=\"padding-left: .5em\">\n {{item.height}}p\n </div>\n </div>\n</ng-template>\n", styles: [".video-wrapper{width:100%;position:relative}.video-wrapper video{width:100%;display:block}.video-wrapper button{position:absolute;right:0;top:0;color:#fff;background-color:#00000080}\n"] }]
|
|
142
|
+
}], propDecorators: { data: [{
|
|
143
|
+
type: Input
|
|
144
|
+
}], node: [{
|
|
145
|
+
type: Input
|
|
146
|
+
}], videoRef: [{
|
|
147
|
+
type: ViewChild,
|
|
148
|
+
args: ["video"]
|
|
149
|
+
}] } });
|
|
150
|
+
|
|
151
|
+
var video_component = /*#__PURE__*/Object.freeze({
|
|
152
|
+
__proto__: null,
|
|
153
|
+
VideoComponent: VideoComponent
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
class PdfComponent {
|
|
157
|
+
constructor(assetControllerService) {
|
|
158
|
+
this.assetControllerService = assetControllerService;
|
|
159
|
+
this.restrictedView = false;
|
|
160
|
+
}
|
|
161
|
+
ngOnChanges(changes) {
|
|
162
|
+
this.downloadFile();
|
|
163
|
+
}
|
|
164
|
+
downloadFile() {
|
|
165
|
+
if (this.data?.items === undefined || this.data.items[0].link === "") {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
const url = new URL(this.data.items[0].link);
|
|
169
|
+
const assetParams = url.searchParams.get('assetParams');
|
|
170
|
+
if (assetParams === null) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
const params = {
|
|
174
|
+
assetParams: assetParams
|
|
175
|
+
};
|
|
176
|
+
this.assetControllerService.getAsset$Response(params)
|
|
177
|
+
.subscribe(async (response) => {
|
|
178
|
+
let responseData = response.body;
|
|
179
|
+
if (response.headers.get("content-type") === "application/octet-stream") {
|
|
180
|
+
this.restrictedView = true;
|
|
181
|
+
responseData = responseData.slice(0, responseData.size, "application/pdf");
|
|
182
|
+
}
|
|
183
|
+
this.fileData = responseData;
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
onDocumentLoad() {
|
|
187
|
+
if (this.restrictedView) {
|
|
188
|
+
const iFrameDocument = this.viewerRef?.iframe.nativeElement.contentWindow.document;
|
|
189
|
+
const iFrameWindow = this.viewerRef?.iframe.nativeElement.contentWindow;
|
|
190
|
+
iFrameWindow.print = () => { alert("Nice try!"); };
|
|
191
|
+
iFrameDocument.querySelector(".textLayer").style.display = "none";
|
|
192
|
+
iFrameDocument.body.addEventListener('contextmenu', (event) => { event.preventDefault(); });
|
|
193
|
+
['keyup', 'keydown'].forEach(type => {
|
|
194
|
+
iFrameDocument.addEventListener(type, (event) => {
|
|
195
|
+
if ((event.key === 's' && event.ctrlKey) || event.key === 'F12') {
|
|
196
|
+
event.preventDefault();
|
|
197
|
+
if (event.stopImmediatePropagation) {
|
|
198
|
+
event.stopImmediatePropagation();
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
event.stopPropagation();
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: PdfComponent, deps: [{ token: i1$1.AssetControllerService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
209
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.6", type: PdfComponent, isStandalone: true, selector: "rs-module-pdf", inputs: { data: "data", node: "node" }, viewQueries: [{ propertyName: "viewerRef", first: true, predicate: ["pdfViewer"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"pdf-wrapper\" *ngIf=\"fileData !== undefined\">\n <ng2-pdfjs-viewer\n #pdfViewer\n [pdfSrc]=\"fileData\"\n [print]=\"!restrictedView\"\n [download]=\"!restrictedView\"\n (onDocumentLoad)=\"onDocumentLoad()\"\n >\n </ng2-pdfjs-viewer>\n</div>\n", styles: [":host{position:relative;display:flex;align-items:center;width:100%}.pdf-wrapper{width:100%;height:100%}\n"], dependencies: [{ kind: "ngmodule", type: RenderingModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "ngmodule", type: MatIconModule }, { kind: "ngmodule", type: PdfJsViewerModule }, { kind: "component", type: i3$1.PdfJsViewerComponent, selector: "ng2-pdfjs-viewer", inputs: ["viewerId", "viewerFolder", "externalWindow", "target", "showSpinner", "downloadFileName", "openFile", "download", "startDownload", "viewBookmark", "print", "startPrint", "fullScreen", "find", "zoom", "nameddest", "pagemode", "lastPage", "rotatecw", "rotateccw", "cursor", "scroll", "spread", "locale", "useOnlyCssZoom", "errorOverride", "errorAppend", "errorMessage", "diagnosticLogs", "externalWindowOptions", "page", "pdfSrc"], outputs: ["onBeforePrint", "onAfterPrint", "onDocumentLoad", "onPageChange"] }] }); }
|
|
210
|
+
}
|
|
211
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: PdfComponent, decorators: [{
|
|
212
|
+
type: Component,
|
|
213
|
+
args: [{ selector: 'rs-module-pdf', standalone: true, imports: [
|
|
214
|
+
RenderingModule,
|
|
215
|
+
MatButtonModule,
|
|
216
|
+
MatIconModule,
|
|
217
|
+
PdfJsViewerModule
|
|
218
|
+
], template: "<div class=\"pdf-wrapper\" *ngIf=\"fileData !== undefined\">\n <ng2-pdfjs-viewer\n #pdfViewer\n [pdfSrc]=\"fileData\"\n [print]=\"!restrictedView\"\n [download]=\"!restrictedView\"\n (onDocumentLoad)=\"onDocumentLoad()\"\n >\n </ng2-pdfjs-viewer>\n</div>\n", styles: [":host{position:relative;display:flex;align-items:center;width:100%}.pdf-wrapper{width:100%;height:100%}\n"] }]
|
|
219
|
+
}], ctorParameters: () => [{ type: i1$1.AssetControllerService }], propDecorators: { data: [{
|
|
220
|
+
type: Input
|
|
221
|
+
}], node: [{
|
|
222
|
+
type: Input
|
|
223
|
+
}], viewerRef: [{
|
|
224
|
+
type: ViewChild,
|
|
225
|
+
args: ["pdfViewer"]
|
|
226
|
+
}] } });
|
|
227
|
+
|
|
228
|
+
var pdf_component = /*#__PURE__*/Object.freeze({
|
|
229
|
+
__proto__: null,
|
|
230
|
+
PdfComponent: PdfComponent
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
class UrlComponent {
|
|
234
|
+
constructor(sanitizer) {
|
|
235
|
+
this.sanitizer = sanitizer;
|
|
236
|
+
this.gdpr = undefined;
|
|
237
|
+
this.gdprOk = false;
|
|
238
|
+
this.embedding = null;
|
|
239
|
+
this.externalId = null;
|
|
240
|
+
this.url = "";
|
|
241
|
+
this.isRemoteRepoResource = false;
|
|
242
|
+
}
|
|
243
|
+
ngOnChanges(changes) {
|
|
244
|
+
this.url = this.node?.properties !== undefined ? this.node.properties["ccm:wwwurl"][0] : "";
|
|
245
|
+
this.setEmbeddingType();
|
|
246
|
+
}
|
|
247
|
+
isProtected() {
|
|
248
|
+
return this.gdpr === undefined;
|
|
249
|
+
}
|
|
250
|
+
setEmbeddingType() {
|
|
251
|
+
if (this.detectYouTube()) {
|
|
252
|
+
this.embedding = "youtube";
|
|
253
|
+
this.getExternalId();
|
|
254
|
+
}
|
|
255
|
+
else if (this.url.includes("vimeo.com")) {
|
|
256
|
+
this.embedding = "vimeo";
|
|
257
|
+
this.getExternalId();
|
|
258
|
+
}
|
|
259
|
+
else if (this.node?.mediatype?.includes("audio")) {
|
|
260
|
+
this.embedding = "audio";
|
|
261
|
+
}
|
|
262
|
+
else if (this.detectImage()) {
|
|
263
|
+
this.embedding = "image";
|
|
264
|
+
}
|
|
265
|
+
else if (this.detectPixabay()) {
|
|
266
|
+
this.url = this.node?.preview?.url ?? "";
|
|
267
|
+
this.embedding = "image";
|
|
268
|
+
}
|
|
269
|
+
else if (this.detectVideo()) { }
|
|
270
|
+
}
|
|
271
|
+
consentToGdprWarning() {
|
|
272
|
+
this.gdprOk = true;
|
|
273
|
+
}
|
|
274
|
+
getExternalId() {
|
|
275
|
+
if (this.embedding === "youtube") {
|
|
276
|
+
if (this.isRemoteRepoResource) {
|
|
277
|
+
this.externalId = this.node?.remote?.id ?? "";
|
|
278
|
+
}
|
|
279
|
+
else if (this.url.includes("youtu.be")) {
|
|
280
|
+
const split = this.url.split("/");
|
|
281
|
+
this.externalId = split[split.length - 1];
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
const url = new URL(this.url);
|
|
285
|
+
this.externalId = url.searchParams.get("v");
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
else if (this.embedding === "vimeo") {
|
|
289
|
+
const split = this.url.split("/");
|
|
290
|
+
this.externalId = split[split.length - 1];
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
getVimeoUri() {
|
|
294
|
+
let url = '//player.vimeo.com/video/' + this.externalId;
|
|
295
|
+
return this.sanitizer.bypassSecurityTrustResourceUrl(url);
|
|
296
|
+
}
|
|
297
|
+
detectImage() {
|
|
298
|
+
if (this.node?.properties !== undefined && this.node.properties["ccm:remoterepositorytype"][0] === "DDB") {
|
|
299
|
+
return false;
|
|
300
|
+
}
|
|
301
|
+
if (this.node?.mediatype === 'file-image') {
|
|
302
|
+
return true;
|
|
303
|
+
}
|
|
304
|
+
const mimeTypeSplit = this.node?.mimetype?.split("/") ?? [];
|
|
305
|
+
return mimeTypeSplit.length === 2 && ['png', 'jpg', 'jpeg', 'gif'].includes(mimeTypeSplit[1]);
|
|
306
|
+
}
|
|
307
|
+
detectYouTube() {
|
|
308
|
+
if (this.url.includes(".youtube.com/watch?") || this.url.includes("youtu.be")) {
|
|
309
|
+
return true;
|
|
310
|
+
}
|
|
311
|
+
if (this.node?.remote?.repository?.repositoryType?.toLowerCase() === "youtube") {
|
|
312
|
+
this.isRemoteRepoResource = true;
|
|
313
|
+
return true;
|
|
314
|
+
}
|
|
315
|
+
return false;
|
|
316
|
+
}
|
|
317
|
+
detectPixabay() {
|
|
318
|
+
return this.node?.remote?.repository?.repositoryType?.toLowerCase() === "pixabay";
|
|
319
|
+
}
|
|
320
|
+
detectVideo() {
|
|
321
|
+
return (["mp4", "webm"].includes(this.url.split(".").pop() ?? ""));
|
|
322
|
+
}
|
|
323
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: UrlComponent, deps: [{ token: i1$2.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
324
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.6", type: UrlComponent, isStandalone: true, selector: "rs-module-url", inputs: { data: "data", node: "node" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"url-wrapper\">\n <div *ngIf=\"gdprOk\">\n <ng-container *ngIf=\"embedding === 'youtube' && externalId !== ''\">\n <youtube-player\n [videoId]=\"externalId ?? ''\"\n [disableCookies]=\"true\"\n ></youtube-player>\n </ng-container>\n <ng-container *ngIf=\"embedding === 'vimeo' && externalId !== ''\">\n <iframe [src]=\"getVimeoUri()\"></iframe>\n </ng-container>\n <ng-container *ngIf=\"embedding === 'audio' && url !== ''\" >\n <div class=\"audio-wrapper\">\n <video\n controls\n style=\"max-width: 100%\"\n [src]=\"url\"\n poster=\"assets/img/audio.svg\"\n >\n </video>\n </div>\n </ng-container>\n <ng-container *ngIf=\"embedding === 'image' && url !== ''\">\n <div class=\"image-wrapper\">\n <img\n [ngSrc]=\"url\"\n [alt]=\"node?.title ?? 'Edu-Sharing image'\"\n [title]=\"node?.title ?? 'Edu-Sharing image'\"\n width=\"100%\"\n height=\"auto\"\n >\n </div>\n </ng-container>\n <ng-container *ngIf=\"embedding === 'video' && url !== ''\">\n <div class=\"video-wrapper\">\n <video\n controls\n [src]=\"url\"\n >\n </video>\n </div>\n </ng-container>\n </div>\n <div *ngIf=\"!gdprOk\">\n Halt! Stop!\n <button mat-button (click)=\"consentToGdprWarning()\">Weiter!</button>\n </div>\n</div>\n", styles: [":host{position:relative;display:flex;align-items:center}.url-wrapper{width:100%}.url-wrapper .audio-wrapper video[poster]{object-fit:cover}\n"], dependencies: [{ kind: "ngmodule", type: RenderingModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2$1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: YouTubePlayer, selector: "youtube-player", inputs: ["videoId", "height", "width", "startSeconds", "endSeconds", "suggestedQuality", "playerVars", "disableCookies", "loadApi", "disablePlaceholder", "showBeforeIframeApiLoads", "placeholderButtonLabel", "placeholderImageQuality"], outputs: ["ready", "stateChange", "error", "apiChange", "playbackQualityChange", "playbackRateChange"] }, { kind: "directive", type: NgOptimizedImage, selector: "img[ngSrc]", inputs: ["ngSrc", "ngSrcset", "sizes", "width", "height", "loading", "priority", "loaderParams", "disableOptimizedSrcset", "fill", "placeholder", "placeholderConfig", "src", "srcset"] }] }); }
|
|
325
|
+
}
|
|
326
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: UrlComponent, decorators: [{
|
|
327
|
+
type: Component,
|
|
328
|
+
args: [{ selector: 'rs-module-url', standalone: true, imports: [
|
|
329
|
+
RenderingModule,
|
|
330
|
+
MatButtonModule,
|
|
331
|
+
MatIconModule,
|
|
332
|
+
YouTubePlayer,
|
|
333
|
+
NgOptimizedImage,
|
|
334
|
+
], template: "<div class=\"url-wrapper\">\n <div *ngIf=\"gdprOk\">\n <ng-container *ngIf=\"embedding === 'youtube' && externalId !== ''\">\n <youtube-player\n [videoId]=\"externalId ?? ''\"\n [disableCookies]=\"true\"\n ></youtube-player>\n </ng-container>\n <ng-container *ngIf=\"embedding === 'vimeo' && externalId !== ''\">\n <iframe [src]=\"getVimeoUri()\"></iframe>\n </ng-container>\n <ng-container *ngIf=\"embedding === 'audio' && url !== ''\" >\n <div class=\"audio-wrapper\">\n <video\n controls\n style=\"max-width: 100%\"\n [src]=\"url\"\n poster=\"assets/img/audio.svg\"\n >\n </video>\n </div>\n </ng-container>\n <ng-container *ngIf=\"embedding === 'image' && url !== ''\">\n <div class=\"image-wrapper\">\n <img\n [ngSrc]=\"url\"\n [alt]=\"node?.title ?? 'Edu-Sharing image'\"\n [title]=\"node?.title ?? 'Edu-Sharing image'\"\n width=\"100%\"\n height=\"auto\"\n >\n </div>\n </ng-container>\n <ng-container *ngIf=\"embedding === 'video' && url !== ''\">\n <div class=\"video-wrapper\">\n <video\n controls\n [src]=\"url\"\n >\n </video>\n </div>\n </ng-container>\n </div>\n <div *ngIf=\"!gdprOk\">\n Halt! Stop!\n <button mat-button (click)=\"consentToGdprWarning()\">Weiter!</button>\n </div>\n</div>\n", styles: [":host{position:relative;display:flex;align-items:center}.url-wrapper{width:100%}.url-wrapper .audio-wrapper video[poster]{object-fit:cover}\n"] }]
|
|
335
|
+
}], ctorParameters: () => [{ type: i1$2.DomSanitizer }], propDecorators: { data: [{
|
|
336
|
+
type: Input
|
|
337
|
+
}], node: [{
|
|
338
|
+
type: Input
|
|
339
|
+
}] } });
|
|
340
|
+
|
|
341
|
+
var url_component = /*#__PURE__*/Object.freeze({
|
|
342
|
+
__proto__: null,
|
|
343
|
+
UrlComponent: UrlComponent
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
class EduHtmlComponent {
|
|
347
|
+
constructor(sanitizer) {
|
|
348
|
+
this.sanitizer = sanitizer;
|
|
349
|
+
}
|
|
350
|
+
getSafeUri() {
|
|
351
|
+
if (this.data?.items !== undefined && this.data.items[0].link) {
|
|
352
|
+
return this.sanitizer.bypassSecurityTrustResourceUrl(this.data.items[0].link);
|
|
353
|
+
}
|
|
354
|
+
return new class {
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: EduHtmlComponent, deps: [{ token: i1$2.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
358
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.6", type: EduHtmlComponent, isStandalone: true, selector: "rs-module-eduHtml", inputs: { data: "data", node: "node" }, ngImport: i0, template: "<div class=\"eduHtml-wrapper\" *ngIf=\"data?.items !== undefined\">\n <iframe [src]=\"getSafeUri()\"></iframe>\n</div>\n", styles: [":host{position:relative;display:flex;align-items:center;width:100%}.eduHtml-wrapper{width:100%}\n"], dependencies: [{ kind: "ngmodule", type: RenderingModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "ngmodule", type: MatIconModule }] }); }
|
|
359
|
+
}
|
|
360
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: EduHtmlComponent, decorators: [{
|
|
361
|
+
type: Component,
|
|
362
|
+
args: [{ selector: 'rs-module-eduHtml', standalone: true, imports: [
|
|
363
|
+
RenderingModule,
|
|
364
|
+
MatButtonModule,
|
|
365
|
+
MatIconModule
|
|
366
|
+
], template: "<div class=\"eduHtml-wrapper\" *ngIf=\"data?.items !== undefined\">\n <iframe [src]=\"getSafeUri()\"></iframe>\n</div>\n", styles: [":host{position:relative;display:flex;align-items:center;width:100%}.eduHtml-wrapper{width:100%}\n"] }]
|
|
367
|
+
}], ctorParameters: () => [{ type: i1$2.DomSanitizer }], propDecorators: { data: [{
|
|
368
|
+
type: Input
|
|
369
|
+
}], node: [{
|
|
370
|
+
type: Input
|
|
371
|
+
}] } });
|
|
372
|
+
|
|
373
|
+
var eduHtml_component = /*#__PURE__*/Object.freeze({
|
|
374
|
+
__proto__: null,
|
|
375
|
+
EduHtmlComponent: EduHtmlComponent
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
class SpreadsheetComponent {
|
|
379
|
+
constructor(assetControllerService) {
|
|
380
|
+
this.assetControllerService = assetControllerService;
|
|
381
|
+
this.fileData = "";
|
|
382
|
+
}
|
|
383
|
+
ngOnChanges(changes) {
|
|
384
|
+
this.downloadFile();
|
|
385
|
+
}
|
|
386
|
+
downloadFile() {
|
|
387
|
+
if (this.data?.items === undefined || this.data.items[0].link === "") {
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
const url = new URL(this.data.items[0].link);
|
|
391
|
+
const assetParams = url.searchParams.get('assetParams');
|
|
392
|
+
if (assetParams === null) {
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
const params = {
|
|
396
|
+
assetParams: assetParams
|
|
397
|
+
};
|
|
398
|
+
this.assetControllerService.getAsset$Response(params)
|
|
399
|
+
.subscribe(async (response) => {
|
|
400
|
+
this.fileData = await response.body.text();
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: SpreadsheetComponent, deps: [{ token: i1$1.AssetControllerService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
404
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.6", type: SpreadsheetComponent, isStandalone: true, selector: "rs-module-spreadsheet", inputs: { data: "data", node: "node" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"spreadsheet-wrapper\" [innerHTML]=\"fileData\"></div>\n", styles: [":host{position:relative;display:flex;align-items:center;width:100%}.spreadsheet-wrapper{width:100%;max-height:30em;padding:.5em}table{border-collapse:collapse}tr{border:none}td{border-right:dotted 1px lightslategrey;border-left:dotted 1px lightslategrey}tr:nth-child(odd){background-color:#b0c4de}td{padding:.5em}td:hover{background-color:#ffa07a}\n"], dependencies: [{ kind: "ngmodule", type: RenderingModule }, { kind: "ngmodule", type: MatButtonModule }, { kind: "ngmodule", type: MatIconModule }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
405
|
+
}
|
|
406
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: SpreadsheetComponent, decorators: [{
|
|
407
|
+
type: Component,
|
|
408
|
+
args: [{ selector: 'rs-module-spreadsheet', standalone: true, imports: [
|
|
409
|
+
RenderingModule,
|
|
410
|
+
MatButtonModule,
|
|
411
|
+
MatIconModule,
|
|
412
|
+
], encapsulation: ViewEncapsulation.None, template: "<div class=\"spreadsheet-wrapper\" [innerHTML]=\"fileData\"></div>\n", styles: [":host{position:relative;display:flex;align-items:center;width:100%}.spreadsheet-wrapper{width:100%;max-height:30em;padding:.5em}table{border-collapse:collapse}tr{border:none}td{border-right:dotted 1px lightslategrey;border-left:dotted 1px lightslategrey}tr:nth-child(odd){background-color:#b0c4de}td{padding:.5em}td:hover{background-color:#ffa07a}\n"] }]
|
|
413
|
+
}], ctorParameters: () => [{ type: i1$1.AssetControllerService }], propDecorators: { data: [{
|
|
414
|
+
type: Input
|
|
415
|
+
}], node: [{
|
|
416
|
+
type: Input
|
|
417
|
+
}] } });
|
|
418
|
+
|
|
419
|
+
var spreadsheet_component = /*#__PURE__*/Object.freeze({
|
|
420
|
+
__proto__: null,
|
|
421
|
+
SpreadsheetComponent: SpreadsheetComponent
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
class RenderingApiModule {
|
|
425
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: RenderingApiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
426
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.6", ngImport: i0, type: RenderingApiModule, imports: [i1$1.RenderingServiceApiModule] }); }
|
|
427
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: RenderingApiModule, imports: [RenderingServiceApiModule.forRoot({
|
|
428
|
+
rootUrl: environment.rootUrl
|
|
429
|
+
})] }); }
|
|
430
|
+
}
|
|
431
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: RenderingApiModule, decorators: [{
|
|
432
|
+
type: NgModule,
|
|
433
|
+
args: [{
|
|
434
|
+
imports: [
|
|
435
|
+
RenderingServiceApiModule.forRoot({
|
|
436
|
+
rootUrl: environment.rootUrl
|
|
437
|
+
})
|
|
438
|
+
]
|
|
439
|
+
}]
|
|
440
|
+
}] });
|
|
441
|
+
|
|
442
|
+
class RenderComponent {
|
|
443
|
+
constructor(renderControllerService, jobInfoControllerService) {
|
|
444
|
+
this.renderControllerService = renderControllerService;
|
|
445
|
+
this.jobInfoControllerService = jobInfoControllerService;
|
|
446
|
+
this.renderData$ = new BehaviorSubject(null);
|
|
447
|
+
this.finished = new Subject();
|
|
448
|
+
this.someButNotAllFinished = new Subject();
|
|
449
|
+
this.progress$ = new BehaviorSubject(null);
|
|
450
|
+
this.useUrlModule = false;
|
|
451
|
+
}
|
|
452
|
+
async ngOnChanges(changes) {
|
|
453
|
+
if (this.node === undefined || !this.checkIfBackendModule()) {
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
const renderResponseData = (await firstValueFrom(this.renderControllerService.getRenderData({
|
|
457
|
+
body: this.request
|
|
458
|
+
})));
|
|
459
|
+
// It is possible that there is completed data AND a job id (if there).
|
|
460
|
+
// We need the data then AND trigger the progress logic to keep loading the unfinished resolutions.
|
|
461
|
+
if (renderResponseData.jobId === null) {
|
|
462
|
+
const items = renderResponseData.objectLinks?.map(item => {
|
|
463
|
+
const assetItem = {
|
|
464
|
+
link: item.link,
|
|
465
|
+
progress: 100,
|
|
466
|
+
height: item.height,
|
|
467
|
+
width: item.width
|
|
468
|
+
};
|
|
469
|
+
return assetItem;
|
|
470
|
+
});
|
|
471
|
+
const data = {
|
|
472
|
+
module: renderResponseData.module,
|
|
473
|
+
items: items
|
|
474
|
+
};
|
|
475
|
+
renderResponseData.objectLinks !== undefined && this.renderData$.next(data);
|
|
476
|
+
this.finished.next();
|
|
477
|
+
}
|
|
478
|
+
else {
|
|
479
|
+
this.progress$.next({ module: renderResponseData.module });
|
|
480
|
+
interval(500).pipe(takeUntil(this.finished), switchMap(() => this.jobInfoControllerService.getJobInfo({ jobId: renderResponseData.jobId }).pipe())).subscribe(async (status) => {
|
|
481
|
+
// Some, but not all, jobs are finished ->
|
|
482
|
+
if (status.jobs.some(j => j.status === 'FINISHED') && status.status !== 'FINISHED') {
|
|
483
|
+
const items = status.jobs.map(subJob => {
|
|
484
|
+
const assetItem = {
|
|
485
|
+
link: subJob.objectLink?.link ?? "",
|
|
486
|
+
progress: subJob.status !== 'QUEUED' ? subJob.progress : -(subJob.progress + 1),
|
|
487
|
+
height: subJob.objectLink?.height ?? subJob.quality,
|
|
488
|
+
width: subJob.objectLink?.width ?? 0
|
|
489
|
+
};
|
|
490
|
+
return assetItem;
|
|
491
|
+
});
|
|
492
|
+
const data = {
|
|
493
|
+
module: renderResponseData.module,
|
|
494
|
+
items: items
|
|
495
|
+
};
|
|
496
|
+
this.renderData$.next(data);
|
|
497
|
+
this.someButNotAllFinished.next(true);
|
|
498
|
+
// all finished and/or failed
|
|
499
|
+
}
|
|
500
|
+
else if (status.status === 'FINISHED' || status.status === 'FAILED') {
|
|
501
|
+
const items = status.jobs.map(subJob => {
|
|
502
|
+
const assetItem = {
|
|
503
|
+
link: subJob.objectLink?.link ?? "",
|
|
504
|
+
progress: subJob.progress,
|
|
505
|
+
height: subJob.objectLink?.height ?? subJob.quality,
|
|
506
|
+
width: subJob.objectLink?.width ?? 0
|
|
507
|
+
};
|
|
508
|
+
return assetItem;
|
|
509
|
+
});
|
|
510
|
+
const data = {
|
|
511
|
+
module: renderResponseData.module,
|
|
512
|
+
items: items
|
|
513
|
+
};
|
|
514
|
+
this.renderData$.next(data);
|
|
515
|
+
this.finished.next();
|
|
516
|
+
}
|
|
517
|
+
else {
|
|
518
|
+
// no finished jobs -> show either one progress bar with race leader (progress 0-100)
|
|
519
|
+
// or queue position (progress (-inf,-1])
|
|
520
|
+
let progress = 0;
|
|
521
|
+
if (status.jobs.some(j => j.status === 'PROCESSING')) {
|
|
522
|
+
progress = Math.max(...status.jobs.map(j => j.progress));
|
|
523
|
+
}
|
|
524
|
+
else if (status.jobs.some(j => j.status === 'QUEUED')) {
|
|
525
|
+
progress = -(Math.min(...status.jobs.map(j => j.progress + 1)));
|
|
526
|
+
}
|
|
527
|
+
this.progress$.next({
|
|
528
|
+
module: status.module,
|
|
529
|
+
progress: progress
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
checkIfBackendModule() {
|
|
536
|
+
if (["youtube", "pixabay"].includes((this.node?.remote?.repository?.repositoryType ?? "").toLowerCase())) {
|
|
537
|
+
this.useUrlModule = true;
|
|
538
|
+
return false;
|
|
539
|
+
}
|
|
540
|
+
if (this.node?.properties === undefined) {
|
|
541
|
+
return true;
|
|
542
|
+
}
|
|
543
|
+
if (this.node?.properties["ccm:replicationsource"] !== undefined && (this.node.properties["ccm:replicationsource"][0] ?? "") === "oai:dmglib.org") {
|
|
544
|
+
this.useUrlModule = true;
|
|
545
|
+
return false;
|
|
546
|
+
}
|
|
547
|
+
if (this.node?.properties["ccm:wwwurl"].length > 0) {
|
|
548
|
+
this.useUrlModule = true;
|
|
549
|
+
return false;
|
|
550
|
+
}
|
|
551
|
+
return true;
|
|
552
|
+
}
|
|
553
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: RenderComponent, deps: [{ token: i1$1.RenderControllerService }, { token: i1$1.JobInfoControllerService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
554
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.6", type: RenderComponent, isStandalone: true, selector: "rs-root", inputs: { request: "request", node: "node" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"module\">\n <ng-container *ngIf=\"renderData$ | async as data\">\n @defer (when data?.module === 'IMAGE'){\n <rs-module-image [data]=\"data\" [node]=\"node\"></rs-module-image>\n } @loading {\n <ng-container *ngTemplateOutlet=\"loading\"></ng-container>\n }\n @defer (when data?.module === 'VIDEO' || data?.module === 'AUDIO'){\n <rs-module-video [data]=\"data\" [node]=\"node\"></rs-module-video>\n } @loading {\n <ng-container *ngTemplateOutlet=\"loading\"></ng-container>\n }\n @defer (when data?.module === 'PDF' || data?.module === 'DOCUMENT') {\n <rs-module-pdf [data]=\"data\" [node]=\"node\"></rs-module-pdf>\n } @loading {\n <ng-container *ngTemplateOutlet=\"loading\"></ng-container>\n }\n @defer (when data?.module === 'EDUHTML') {\n <rs-module-eduHtml [data]=\"data\" [node]=\"node\"></rs-module-eduHtml>\n } @loading {\n <ng-container *ngTemplateOutlet=\"loading\"></ng-container>\n }\n @defer (when data?.module === 'SPREADSHEET') {\n <rs-module-spreadsheet [data]=\"data\" [node]=\"node\"></rs-module-spreadsheet>\n } @loading {\n <ng-container *ngTemplateOutlet=\"loading\"></ng-container>\n }\n </ng-container>\n <ng-container *ngIf=\"useUrlModule\">\n @defer (when useUrlModule) {\n <rs-module-url [node]=\"node\"></rs-module-url>\n }\n </ng-container>\n <div class=\"progress\" *ngIf=\"(renderData$ | async) === null;\">\n <ng-container *ngIf=\"progress$ | async as progress\">\n <ng-container [ngSwitch]=\"['VIDEO', 'AUDIO'].includes(progress.module) ? 'bar' : 'spinner'\">\n <ng-container *ngSwitchCase=\"'bar'\">\n <div *ngIf=\"(progress.progress ?? 0) < 0\">Queue position: {{-(progress.progress ?? 0)}}</div>\n <mat-progress-bar [value]=\"(progress.progress ?? 0)\" *ngIf=\"(progress.progress ?? 0) >= 0\"></mat-progress-bar>\n </ng-container>\n <ng-container *ngSwitchCase=\"'spinner'\">\n <div *ngIf=\"(progress.progress ?? 0) < 0\">Queue position: {{-(progress.progress ?? 0)}</div>\n <mat-spinner [diameter]=\"50\" *ngIf=\"(progress.progress ?? 0) >= 0\"></mat-spinner>\n </ng-container>\n </ng-container>\n </ng-container>\n </div>\n</div>\n\n<ng-template #loading>\n <div class=\"progress\">\n <mat-spinner></mat-spinner>\n </div>\n</ng-template>\n", styles: [":host{display:flex;flex-direction:column;gap:20px;padding:10px 30px}.module{overflow:auto;display:flex;flex-grow:1;height:auto;border:1px solid #aaa;padding:20px}.module rs-module-image,.module rs-module-video{width:100%}.module .progress{display:flex;justify-content:center;flex-grow:1}\n"], dependencies: [{ kind: "ngmodule", type: RenderingApiModule }, { kind: "ngmodule", type: RenderingModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i2.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i3$2.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "ngmodule", type: MatProgressBarModule }, { kind: "component", type: i4.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }], deferBlockDependencies: [() => [Promise.resolve().then(function () { return image_component; }).then(m => m.ImageComponent)], () => [Promise.resolve().then(function () { return video_component; }).then(m => m.VideoComponent)], () => [Promise.resolve().then(function () { return pdf_component; }).then(m => m.PdfComponent)], () => [Promise.resolve().then(function () { return eduHtml_component; }).then(m => m.EduHtmlComponent)], () => [Promise.resolve().then(function () { return spreadsheet_component; }).then(m => m.SpreadsheetComponent)], () => [Promise.resolve().then(function () { return url_component; }).then(m => m.UrlComponent)]] }); }
|
|
555
|
+
}
|
|
556
|
+
i0.ɵɵngDeclareClassMetadataAsync({ minVersion: "18.0.0", version: "18.2.6", ngImport: i0, type: RenderComponent, resolveDeferredDeps: () => [Promise.resolve().then(function () { return image_component; }).then(m => m.ImageComponent), Promise.resolve().then(function () { return video_component; }).then(m => m.VideoComponent), Promise.resolve().then(function () { return pdf_component; }).then(m => m.PdfComponent), Promise.resolve().then(function () { return eduHtml_component; }).then(m => m.EduHtmlComponent), Promise.resolve().then(function () { return spreadsheet_component; }).then(m => m.SpreadsheetComponent), Promise.resolve().then(function () { return url_component; }).then(m => m.UrlComponent)], resolveMetadata: (ImageComponent, VideoComponent, PdfComponent, EduHtmlComponent, SpreadsheetComponent, UrlComponent) => ({ decorators: [{
|
|
557
|
+
type: Component,
|
|
558
|
+
args: [{ selector: 'rs-root', standalone: true, imports: [
|
|
559
|
+
RenderingApiModule,
|
|
560
|
+
RenderingModule,
|
|
561
|
+
ImageComponent,
|
|
562
|
+
VideoComponent,
|
|
563
|
+
MatProgressSpinnerModule,
|
|
564
|
+
MatProgressBarModule,
|
|
565
|
+
PdfComponent,
|
|
566
|
+
UrlComponent,
|
|
567
|
+
EduHtmlComponent,
|
|
568
|
+
SpreadsheetComponent,
|
|
569
|
+
], template: "<div class=\"module\">\n <ng-container *ngIf=\"renderData$ | async as data\">\n @defer (when data?.module === 'IMAGE'){\n <rs-module-image [data]=\"data\" [node]=\"node\"></rs-module-image>\n } @loading {\n <ng-container *ngTemplateOutlet=\"loading\"></ng-container>\n }\n @defer (when data?.module === 'VIDEO' || data?.module === 'AUDIO'){\n <rs-module-video [data]=\"data\" [node]=\"node\"></rs-module-video>\n } @loading {\n <ng-container *ngTemplateOutlet=\"loading\"></ng-container>\n }\n @defer (when data?.module === 'PDF' || data?.module === 'DOCUMENT') {\n <rs-module-pdf [data]=\"data\" [node]=\"node\"></rs-module-pdf>\n } @loading {\n <ng-container *ngTemplateOutlet=\"loading\"></ng-container>\n }\n @defer (when data?.module === 'EDUHTML') {\n <rs-module-eduHtml [data]=\"data\" [node]=\"node\"></rs-module-eduHtml>\n } @loading {\n <ng-container *ngTemplateOutlet=\"loading\"></ng-container>\n }\n @defer (when data?.module === 'SPREADSHEET') {\n <rs-module-spreadsheet [data]=\"data\" [node]=\"node\"></rs-module-spreadsheet>\n } @loading {\n <ng-container *ngTemplateOutlet=\"loading\"></ng-container>\n }\n </ng-container>\n <ng-container *ngIf=\"useUrlModule\">\n @defer (when useUrlModule) {\n <rs-module-url [node]=\"node\"></rs-module-url>\n }\n </ng-container>\n <div class=\"progress\" *ngIf=\"(renderData$ | async) === null;\">\n <ng-container *ngIf=\"progress$ | async as progress\">\n <ng-container [ngSwitch]=\"['VIDEO', 'AUDIO'].includes(progress.module) ? 'bar' : 'spinner'\">\n <ng-container *ngSwitchCase=\"'bar'\">\n <div *ngIf=\"(progress.progress ?? 0) < 0\">Queue position: {{-(progress.progress ?? 0)}}</div>\n <mat-progress-bar [value]=\"(progress.progress ?? 0)\" *ngIf=\"(progress.progress ?? 0) >= 0\"></mat-progress-bar>\n </ng-container>\n <ng-container *ngSwitchCase=\"'spinner'\">\n <div *ngIf=\"(progress.progress ?? 0) < 0\">Queue position: {{-(progress.progress ?? 0)}</div>\n <mat-spinner [diameter]=\"50\" *ngIf=\"(progress.progress ?? 0) >= 0\"></mat-spinner>\n </ng-container>\n </ng-container>\n </ng-container>\n </div>\n</div>\n\n<ng-template #loading>\n <div class=\"progress\">\n <mat-spinner></mat-spinner>\n </div>\n</ng-template>\n", styles: [":host{display:flex;flex-direction:column;gap:20px;padding:10px 30px}.module{overflow:auto;display:flex;flex-grow:1;height:auto;border:1px solid #aaa;padding:20px}.module rs-module-image,.module rs-module-video{width:100%}.module .progress{display:flex;justify-content:center;flex-grow:1}\n"] }]
|
|
570
|
+
}], ctorParameters: () => [{ type: i1$1.RenderControllerService }, { type: i1$1.JobInfoControllerService }], propDecorators: { request: [{
|
|
571
|
+
type: Input
|
|
572
|
+
}], node: [{
|
|
573
|
+
type: Input
|
|
574
|
+
}] } }) });
|
|
575
|
+
|
|
576
|
+
class RenderingServiceLibModule {
|
|
577
|
+
static forRoot() {
|
|
578
|
+
return {
|
|
579
|
+
ngModule: RenderingServiceLibModule,
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: RenderingServiceLibModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
583
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.6", ngImport: i0, type: RenderingServiceLibModule, imports: [RenderComponent,
|
|
584
|
+
CommonModule], exports: [CommonModule,
|
|
585
|
+
RenderComponent] }); }
|
|
586
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: RenderingServiceLibModule, imports: [RenderComponent,
|
|
587
|
+
CommonModule, CommonModule] }); }
|
|
588
|
+
}
|
|
589
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: RenderingServiceLibModule, decorators: [{
|
|
590
|
+
type: NgModule,
|
|
591
|
+
args: [{
|
|
592
|
+
declarations: [],
|
|
593
|
+
imports: [
|
|
594
|
+
RenderComponent,
|
|
595
|
+
CommonModule,
|
|
596
|
+
],
|
|
597
|
+
exports: [
|
|
598
|
+
CommonModule,
|
|
599
|
+
RenderComponent
|
|
600
|
+
],
|
|
601
|
+
}]
|
|
602
|
+
}] });
|
|
603
|
+
|
|
604
|
+
/*
|
|
605
|
+
* Public API Surface of edu-sharing-ui
|
|
606
|
+
*/
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* Generated bundle index. Do not edit.
|
|
610
|
+
*/
|
|
611
|
+
|
|
612
|
+
export { EduHtmlComponent, ImageComponent, PdfComponent, RenderComponent, RenderingModule, RenderingServiceLibModule, SpreadsheetComponent, UrlComponent, VideoComponent };
|
|
613
|
+
//# sourceMappingURL=ngx-rendering-service-lib.mjs.map
|