c3-components 0.0.0-watch → 0.0.2

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.
Files changed (59) hide show
  1. package/esm2020/c3-components.mjs +5 -0
  2. package/esm2020/lib/c3-dialog/c3-dialog.module.mjs +56 -0
  3. package/esm2020/lib/c3-dialog/components/c3-dialog-confirm.component.mjs +52 -0
  4. package/esm2020/lib/c3-dialog/components/c3-dialog-embed-child.component.mjs +32 -0
  5. package/esm2020/lib/c3-dialog/components/c3-dialog-prompt.component.mjs +95 -0
  6. package/esm2020/lib/c3-dialog/services/c3-dialog.service.mjs +79 -0
  7. package/esm2020/lib/c3-dropdown/c3-dropdown.module.mjs +20 -0
  8. package/esm2020/lib/c3-dropdown/components/c3-dropdown.component.mjs +45 -0
  9. package/esm2020/lib/c3-dropdown/directives/c3-dropdown.trigger.mjs +128 -0
  10. package/esm2020/lib/c3-file-viewer/c3-file-viewer.module.mjs +38 -0
  11. package/esm2020/lib/c3-file-viewer/components/c3-file-viewer/c3-file-viewer.component.mjs +84 -0
  12. package/esm2020/lib/c3-file-viewer/components/c3-file-viewer-actions/c3-file-viewer-actions.component.mjs +17 -0
  13. package/esm2020/lib/c3-file-viewer/components/c3-file-viewer-image/c3-file-viewer-image.component.mjs +20 -0
  14. package/esm2020/lib/c3-file-viewer/components/c3-file-viewer-pdf/c3-file-viewer-pdf.component.mjs +23 -0
  15. package/esm2020/lib/c3-file-viewer/components/c3-file-viewer-video/c3-file-viewer-video.component.mjs +32 -0
  16. package/esm2020/lib/c3-file-viewer/consts/default.config.mjs +40 -0
  17. package/esm2020/lib/c3-file-viewer/directives/full-screen.directive.mjs +66 -0
  18. package/esm2020/lib/c3-file-viewer/models/custom-file-event.model.mjs +7 -0
  19. package/esm2020/lib/c3-file-viewer/models/file-metadata.mjs +2 -0
  20. package/esm2020/lib/c3-file-viewer/models/file-viewer-config.model.mjs +2 -0
  21. package/esm2020/lib/c3-file-viewer/models/file-viewer.mjs +205 -0
  22. package/esm2020/lib/c3-file-viewer/models/http.client.mjs +2 -0
  23. package/esm2020/lib/c3-safe-url/pipes/c3-safe-url.pipe.mjs +21 -0
  24. package/esm2020/public-api.mjs +33 -0
  25. package/fesm2015/c3-components.mjs +1001 -0
  26. package/fesm2015/c3-components.mjs.map +1 -0
  27. package/fesm2020/c3-components.mjs +997 -0
  28. package/fesm2020/c3-components.mjs.map +1 -0
  29. package/index.d.ts +5 -0
  30. package/lib/c3-dialog/c3-dialog.module.d.ts +16 -0
  31. package/lib/c3-dialog/components/c3-dialog-confirm.component.d.ts +23 -0
  32. package/lib/c3-dialog/components/c3-dialog-embed-child.component.d.ts +18 -0
  33. package/lib/c3-dialog/components/c3-dialog-prompt.component.d.ts +31 -0
  34. package/lib/c3-dialog/services/c3-dialog.service.d.ts +19 -0
  35. package/lib/c3-dropdown/c3-dropdown.module.d.ts +10 -0
  36. package/lib/c3-dropdown/components/c3-dropdown.component.d.ts +15 -0
  37. package/lib/c3-dropdown/directives/c3-dropdown.trigger.d.ts +45 -0
  38. package/lib/c3-dropdown/styles/_c3-dropdown.sass +22 -0
  39. package/lib/c3-file-viewer/c3-file-viewer.module.d.ts +15 -0
  40. package/lib/c3-file-viewer/components/c3-file-viewer/c3-file-viewer.component.d.ts +24 -0
  41. package/lib/c3-file-viewer/components/c3-file-viewer-actions/c3-file-viewer-actions.component.d.ts +8 -0
  42. package/lib/c3-file-viewer/components/c3-file-viewer-image/c3-file-viewer-image.component.d.ts +9 -0
  43. package/lib/c3-file-viewer/components/c3-file-viewer-pdf/c3-file-viewer-pdf.component.d.ts +9 -0
  44. package/lib/c3-file-viewer/components/c3-file-viewer-video/c3-file-viewer-video.component.d.ts +12 -0
  45. package/lib/c3-file-viewer/consts/default.config.d.ts +2 -0
  46. package/lib/c3-file-viewer/directives/full-screen.directive.d.ts +12 -0
  47. package/lib/c3-file-viewer/models/custom-file-event.model.d.ts +5 -0
  48. package/lib/c3-file-viewer/models/file-metadata.d.ts +12 -0
  49. package/lib/c3-file-viewer/models/file-viewer-config.model.d.ts +48 -0
  50. package/lib/c3-file-viewer/models/file-viewer.d.ts +68 -0
  51. package/lib/c3-file-viewer/models/http.client.d.ts +14 -0
  52. package/lib/c3-file-viewer/styles/_c3-file-viewer.sass +116 -0
  53. package/lib/c3-safe-url/pipes/c3-safe-url.pipe.d.ts +10 -0
  54. package/lib/c3-styles/_c3-core.sass +8 -0
  55. package/lib/c3-styles/_c3-root-variables.sass +107 -0
  56. package/lib/c3-styles/_utils.sass +27 -0
  57. package/package.json +1 -4
  58. package/public-api.d.ts +29 -0
  59. package/src/lib/c3-file/c3-input-file/components/c3-input-file/c3-input-file.component.scss +3 -0
@@ -0,0 +1,1001 @@
1
+ import * as i0 from '@angular/core';
2
+ import { TemplateRef, Component, ViewChild, Input, forwardRef, Directive, HostListener, NgModule, Inject, ViewContainerRef, Injectable, Pipe, EventEmitter, Output, ViewEncapsulation, Optional } from '@angular/core';
3
+ import * as i1 from '@angular/common';
4
+ import { CommonModule } from '@angular/common';
5
+ import * as i2$1 from '@angular/forms';
6
+ import { NG_VALUE_ACCESSOR, FormsModule, ReactiveFormsModule } from '@angular/forms';
7
+ import * as i1$1 from '@angular/cdk/overlay';
8
+ import { OverlayConfig, OverlayModule } from '@angular/cdk/overlay';
9
+ import { coerceBooleanProperty } from '@angular/cdk/coercion';
10
+ import { TemplatePortal } from '@angular/cdk/portal';
11
+ import { Subscription, Subject, merge, takeUntil, BehaviorSubject, filter, skip, debounceTime, mergeMap, tap, map } from 'rxjs';
12
+ import * as i1$2 from '@angular/material/dialog';
13
+ import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
14
+ import * as i2 from '@angular/material/button';
15
+ import { MatButtonModule } from '@angular/material/button';
16
+ import * as i3 from '@angular/flex-layout/flex';
17
+ import * as i5 from '@angular/material/form-field';
18
+ import { MatFormFieldModule } from '@angular/material/form-field';
19
+ import * as i6 from '@angular/material/input';
20
+ import { MatInputModule } from '@angular/material/input';
21
+ import * as i7 from '@angular/cdk/text-field';
22
+ import { __awaiter } from 'tslib';
23
+ import { FlexLayoutModule } from '@angular/flex-layout';
24
+ import * as i1$4 from '@angular/common/http';
25
+ import { HttpClientModule } from '@angular/common/http';
26
+ import * as i1$3 from '@angular/platform-browser';
27
+
28
+ class C3DropdownComponent {
29
+ constructor(_changeDetectorRef) {
30
+ this._changeDetectorRef = _changeDetectorRef;
31
+ /** Classes to be added to the container of the content. Supports the same syntax as `ngClass`. */
32
+ this.dropdownClass = '';
33
+ }
34
+ ngOnChanges(changes) {
35
+ if (changes['dropdownClass']) {
36
+ this._markForCheck();
37
+ }
38
+ }
39
+ _markForCheck() {
40
+ this._changeDetectorRef.markForCheck();
41
+ }
42
+ }
43
+ C3DropdownComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: C3DropdownComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
44
+ C3DropdownComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", type: C3DropdownComponent, selector: "c3-dropdown", inputs: { dropdownClass: "dropdownClass" }, viewQueries: [{ propertyName: "template", first: true, predicate: TemplateRef, descendants: true }], usesOnChanges: true, ngImport: i0, template: `
45
+ <ng-template>
46
+ <div class="c3-dropdown-panel" [ngClass]="dropdownClass">
47
+ <ng-content></ng-content>
48
+ </div>
49
+ </ng-template>
50
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
51
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: C3DropdownComponent, decorators: [{
52
+ type: Component,
53
+ args: [{
54
+ selector: 'c3-dropdown',
55
+ template: `
56
+ <ng-template>
57
+ <div class="c3-dropdown-panel" [ngClass]="dropdownClass">
58
+ <ng-content></ng-content>
59
+ </div>
60
+ </ng-template>
61
+ `,
62
+ }]
63
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { template: [{
64
+ type: ViewChild,
65
+ args: [TemplateRef]
66
+ }], dropdownClass: [{
67
+ type: Input
68
+ }] } });
69
+
70
+ const MAT_DROPDOWN_VALUE_ACCESSOR = {
71
+ provide: NG_VALUE_ACCESSOR,
72
+ useExisting: forwardRef(() => C3DropdownTrigger),
73
+ multi: true,
74
+ };
75
+ /**
76
+ * @description The C3DropdownTrigger directive is used to display or hide a dropdown menu
77
+ * C3DropdownComponent when an item is clicked.
78
+ * @selector [c3Dropdown]
79
+ * @exportAs c3DropdownTrigger
80
+ * @input c3Dropdown - A reference to an instance of C3DropdownComponent.
81
+ * @input c3DropdownDisabled - A boolean indicating whether the directive should be disabled.
82
+ * @input c3DropdownClass - A string, an array of strings, a set of strings or a
83
+ * object representing the CSS classes to be applied to the dropdown menu.
84
+ */
85
+ class C3DropdownTrigger {
86
+ /** Whether the dropdown is disabled. */
87
+ get dropdownDisabled() {
88
+ return this._dropdownDisabled;
89
+ }
90
+ set dropdownDisabled(value) {
91
+ this._dropdownDisabled = coerceBooleanProperty(value);
92
+ }
93
+ constructor(_element, _overlay, _viewContainerRef) {
94
+ this._element = _element;
95
+ this._overlay = _overlay;
96
+ this._viewContainerRef = _viewContainerRef;
97
+ this._closingActionsSubscription = Subscription.EMPTY;
98
+ this._destroyed = new Subject();
99
+ this._dropdownClass = '';
100
+ this._dropdownDisabled = false;
101
+ /** Classes to be passed to the dropdown menu. Supports the same syntax as `ngClass`. */
102
+ this.dropdownClass = '';
103
+ }
104
+ onClick() {
105
+ this.show();
106
+ }
107
+ ngOnChanges(changes) {
108
+ if (changes['dropdownClass'] && this.dropdown) {
109
+ this.dropdown.dropdownClass = this._dropdownClass;
110
+ this.dropdown._markForCheck();
111
+ }
112
+ }
113
+ ngOnDestroy() {
114
+ this._destroyed.next();
115
+ this._destroyed.complete();
116
+ this._closingActionsSubscription.unsubscribe();
117
+ this.close();
118
+ }
119
+ show() {
120
+ if (!this.dropdown)
121
+ return;
122
+ const overlayRef = this._overlay.create(this._getOverlayConfig());
123
+ const portal = new TemplatePortal(this.dropdown.template, this._viewContainerRef);
124
+ overlayRef.attach(portal);
125
+ this.overlayRef = overlayRef;
126
+ this._closingActionsSubscription = this._menuClosingActions().subscribe(() => this.close());
127
+ }
128
+ close() {
129
+ if (this.overlayRef && this.overlayRef.hasAttached())
130
+ this.overlayRef.detach();
131
+ }
132
+ _getOverlayConfig() {
133
+ const belowPosition = {
134
+ originX: 'start',
135
+ originY: 'bottom',
136
+ overlayX: 'start',
137
+ overlayY: 'top',
138
+ };
139
+ const abovePosition = {
140
+ originX: 'start',
141
+ originY: 'top',
142
+ overlayX: 'start',
143
+ overlayY: 'bottom',
144
+ // The overlay edge connected to the trigger should have squared corners, while
145
+ // the opposite end has rounded corners. We apply a CSS class to swap the
146
+ // border-radius based on the overlay position.
147
+ panelClass: 'mat-autocomplete-panel-above',
148
+ };
149
+ const positionStrategy = this._overlay
150
+ .position()
151
+ .flexibleConnectedTo(this._element)
152
+ .withLockedPosition()
153
+ .withPositions([belowPosition, abovePosition]);
154
+ return new OverlayConfig({
155
+ positionStrategy,
156
+ backdropClass: 'cdk-overlay-transparent-backdrop',
157
+ hasBackdrop: true,
158
+ });
159
+ }
160
+ /** Returns a stream that emits whenever an action that should close the menu occurs. */
161
+ _menuClosingActions() {
162
+ const backdrop = this.overlayRef.backdropClick();
163
+ const detachments = this.overlayRef.detachments();
164
+ return merge(backdrop, detachments).pipe(takeUntil(this._destroyed));
165
+ }
166
+ }
167
+ C3DropdownTrigger.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: C3DropdownTrigger, deps: [{ token: i0.ElementRef }, { token: i1$1.Overlay }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
168
+ C3DropdownTrigger.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.8", type: C3DropdownTrigger, selector: "[c3Dropdown]", inputs: { dropdown: ["c3Dropdown", "dropdown"], dropdownDisabled: ["c3DropdownDisabled", "dropdownDisabled"], dropdownClass: ["c3DropdownClass", "dropdownClass"] }, host: { listeners: { "click": "onClick()" } }, providers: [MAT_DROPDOWN_VALUE_ACCESSOR], exportAs: ["c3DropdownTrigger"], usesOnChanges: true, ngImport: i0 });
169
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: C3DropdownTrigger, decorators: [{
170
+ type: Directive,
171
+ args: [{
172
+ selector: '[c3Dropdown]',
173
+ exportAs: 'c3DropdownTrigger',
174
+ providers: [MAT_DROPDOWN_VALUE_ACCESSOR],
175
+ }]
176
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$1.Overlay }, { type: i0.ViewContainerRef }]; }, propDecorators: { dropdown: [{
177
+ type: Input,
178
+ args: ['c3Dropdown']
179
+ }], dropdownDisabled: [{
180
+ type: Input,
181
+ args: ['c3DropdownDisabled']
182
+ }], dropdownClass: [{
183
+ type: Input,
184
+ args: ['c3DropdownClass']
185
+ }], onClick: [{
186
+ type: HostListener,
187
+ args: ['click']
188
+ }] } });
189
+
190
+ class C3DropdownModule {
191
+ }
192
+ C3DropdownModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: C3DropdownModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
193
+ C3DropdownModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: C3DropdownModule, declarations: [C3DropdownComponent, C3DropdownTrigger], imports: [CommonModule, OverlayModule], exports: [C3DropdownComponent, C3DropdownTrigger] });
194
+ C3DropdownModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: C3DropdownModule, imports: [CommonModule, OverlayModule] });
195
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: C3DropdownModule, decorators: [{
196
+ type: NgModule,
197
+ args: [{
198
+ imports: [CommonModule, OverlayModule],
199
+ declarations: [C3DropdownComponent, C3DropdownTrigger],
200
+ exports: [C3DropdownComponent, C3DropdownTrigger],
201
+ }]
202
+ }] });
203
+
204
+ class ConfirmDialogComponent {
205
+ constructor(dialogRef, data) {
206
+ this.dialogRef = dialogRef;
207
+ this.data = data;
208
+ }
209
+ onNoClick() {
210
+ this.dialogRef.close();
211
+ }
212
+ }
213
+ ConfirmDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfirmDialogComponent, deps: [{ token: i1$2.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
214
+ ConfirmDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", type: ConfirmDialogComponent, selector: "ConfirmDialogComponent", ngImport: i0, template: `
215
+ <mat-dialog-content>
216
+ <div [innerHtml]="data.text"></div>
217
+ </mat-dialog-content>
218
+ <mat-dialog-actions fxLayout="row" fxLayoutAlign="end center">
219
+ <button mat-button mat-dialog-close [color]="data.reject?.color">
220
+ {{ data.reject?.text }}
221
+ </button>
222
+ <button mat-button [color]="data.accept?.color" [mat-dialog-close]="true">
223
+ {{ data.accept?.text }}
224
+ </button>
225
+ </mat-dialog-actions>
226
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1$2.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i1$2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i1$2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "component", type: i2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i3.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i3.DefaultLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg]", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }] });
227
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfirmDialogComponent, decorators: [{
228
+ type: Component,
229
+ args: [{
230
+ selector: 'ConfirmDialogComponent',
231
+ template: `
232
+ <mat-dialog-content>
233
+ <div [innerHtml]="data.text"></div>
234
+ </mat-dialog-content>
235
+ <mat-dialog-actions fxLayout="row" fxLayoutAlign="end center">
236
+ <button mat-button mat-dialog-close [color]="data.reject?.color">
237
+ {{ data.reject?.text }}
238
+ </button>
239
+ <button mat-button [color]="data.accept?.color" [mat-dialog-close]="true">
240
+ {{ data.accept?.text }}
241
+ </button>
242
+ </mat-dialog-actions>
243
+ `,
244
+ }]
245
+ }], ctorParameters: function () {
246
+ return [{ type: i1$2.MatDialogRef }, { type: undefined, decorators: [{
247
+ type: Inject,
248
+ args: [MAT_DIALOG_DATA]
249
+ }] }];
250
+ } });
251
+
252
+ class C3PromptDialogComponent {
253
+ constructor(dialogRef, data, _fb) {
254
+ this.dialogRef = dialogRef;
255
+ this.data = data;
256
+ this._fb = _fb;
257
+ this.result = this._fb.control(data.defaultValue, data.validators);
258
+ }
259
+ onNoClick() {
260
+ this.dialogRef.close();
261
+ }
262
+ }
263
+ C3PromptDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: C3PromptDialogComponent, deps: [{ token: i1$2.MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: i2$1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component });
264
+ C3PromptDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", type: C3PromptDialogComponent, selector: "PrompDialogComponent", ngImport: i0, template: `
265
+ <div mat-dialog-title>{{ data.text }}</div>
266
+ <mat-dialog-content>
267
+ <mat-form-field>
268
+ <mat-label *ngIf="data.placeholder">{{ data.placeholder }}</mat-label>
269
+ <input
270
+ *ngIf="!data.multiline"
271
+ matInput
272
+ [formControl]="result"
273
+ (keydown.enter)="dialogRef.close(result.value)"
274
+ />
275
+ <textarea
276
+ *ngIf="data.multiline"
277
+ matInput
278
+ [formControl]="result"
279
+ cdkTextareaAutosize
280
+ ></textarea>
281
+ </mat-form-field>
282
+ </mat-dialog-content>
283
+ <mat-dialog-actions align="center">
284
+ <button mat-raised-button mat-dialog-close [class]="data.reject?.color">
285
+ {{ data.reject?.text }}
286
+ </button>
287
+ <button
288
+ mat-raised-button
289
+ [disabled]="result.invalid || (data.required && !result.value)"
290
+ [class]="data.accept?.color"
291
+ [mat-dialog-close]="result.value"
292
+ >
293
+ {{ data.accept?.text }}
294
+ </button>
295
+ </mat-dialog-actions>
296
+ `, isInline: true, styles: ["mat-form-field{width:100%}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$2.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i1$2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i1$2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "component", type: i2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i5.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i5.MatLabel, selector: "mat-label" }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "directive", type: i7.CdkTextareaAutosize, selector: "textarea[cdkTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "cdkTextareaAutosize", "placeholder"], exportAs: ["cdkTextareaAutosize"] }, { kind: "directive", type: i2$1.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$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] });
297
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: C3PromptDialogComponent, decorators: [{
298
+ type: Component,
299
+ args: [{ selector: 'PrompDialogComponent', template: `
300
+ <div mat-dialog-title>{{ data.text }}</div>
301
+ <mat-dialog-content>
302
+ <mat-form-field>
303
+ <mat-label *ngIf="data.placeholder">{{ data.placeholder }}</mat-label>
304
+ <input
305
+ *ngIf="!data.multiline"
306
+ matInput
307
+ [formControl]="result"
308
+ (keydown.enter)="dialogRef.close(result.value)"
309
+ />
310
+ <textarea
311
+ *ngIf="data.multiline"
312
+ matInput
313
+ [formControl]="result"
314
+ cdkTextareaAutosize
315
+ ></textarea>
316
+ </mat-form-field>
317
+ </mat-dialog-content>
318
+ <mat-dialog-actions align="center">
319
+ <button mat-raised-button mat-dialog-close [class]="data.reject?.color">
320
+ {{ data.reject?.text }}
321
+ </button>
322
+ <button
323
+ mat-raised-button
324
+ [disabled]="result.invalid || (data.required && !result.value)"
325
+ [class]="data.accept?.color"
326
+ [mat-dialog-close]="result.value"
327
+ >
328
+ {{ data.accept?.text }}
329
+ </button>
330
+ </mat-dialog-actions>
331
+ `, styles: ["mat-form-field{width:100%}\n"] }]
332
+ }], ctorParameters: function () {
333
+ return [{ type: i1$2.MatDialogRef }, { type: undefined, decorators: [{
334
+ type: Inject,
335
+ args: [MAT_DIALOG_DATA]
336
+ }] }, { type: i2$1.FormBuilder }];
337
+ } });
338
+
339
+ class C3DialogEmbedChildComponent {
340
+ constructor(dialogRef, data, _cdr) {
341
+ this.dialogRef = dialogRef;
342
+ this.data = data;
343
+ this._cdr = _cdr;
344
+ }
345
+ ngAfterViewInit() {
346
+ this.createdComponent = this.target.createComponent(this.data.component);
347
+ this._cdr.detectChanges();
348
+ }
349
+ }
350
+ C3DialogEmbedChildComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: C3DialogEmbedChildComponent, deps: [{ token: i1$2.MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
351
+ C3DialogEmbedChildComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", type: C3DialogEmbedChildComponent, selector: "C3DialogEmbedChildComponent", viewQueries: [{ propertyName: "target", first: true, predicate: ["target"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: `<mat-dialog-content>
352
+ <ng-template #target></ng-template>
353
+ </mat-dialog-content>`, isInline: true, dependencies: [{ kind: "directive", type: i1$2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }] });
354
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: C3DialogEmbedChildComponent, decorators: [{
355
+ type: Component,
356
+ args: [{ selector: 'C3DialogEmbedChildComponent', template: `<mat-dialog-content>
357
+ <ng-template #target></ng-template>
358
+ </mat-dialog-content>` }]
359
+ }], ctorParameters: function () {
360
+ return [{ type: i1$2.MatDialogRef }, { type: undefined, decorators: [{
361
+ type: Inject,
362
+ args: [MAT_DIALOG_DATA]
363
+ }] }, { type: i0.ChangeDetectorRef }];
364
+ }, propDecorators: { target: [{
365
+ type: ViewChild,
366
+ args: ['target', { read: ViewContainerRef }]
367
+ }] } });
368
+
369
+ class C3DialogService {
370
+ constructor(dialog) {
371
+ this.dialog = dialog;
372
+ }
373
+ confirm(data) {
374
+ return new Promise((resolve, reject) => {
375
+ const dialogRef = this.dialog.open(ConfirmDialogComponent, {
376
+ width: data.width || '250px',
377
+ data: {
378
+ text: data.text,
379
+ reject: {
380
+ color: data.reject && data.reject.color ? data.reject.color : undefined,
381
+ text: (data.reject && data.reject.text) || 'Annuler',
382
+ },
383
+ accept: {
384
+ color: (data.accept && data.accept.color) || 'primary',
385
+ text: (data.accept && data.accept.text) || 'Accepter',
386
+ },
387
+ },
388
+ });
389
+ dialogRef.afterClosed().subscribe((result) => __awaiter(this, void 0, void 0, function* () {
390
+ if (result)
391
+ resolve(true);
392
+ else
393
+ resolve(false);
394
+ }));
395
+ });
396
+ }
397
+ prompt(data) {
398
+ return new Promise((resolve, reject) => {
399
+ const dialogRef = this.dialog.open(C3PromptDialogComponent, {
400
+ width: data.width || '250px',
401
+ maxWidth: data.maxWidth || '100vw',
402
+ data: {
403
+ text: data.text,
404
+ defaultValue: data.defaultValue,
405
+ placeholder: data.placeholder,
406
+ multiline: data.multiline,
407
+ validators: data.validators,
408
+ required: data.required,
409
+ reject: {
410
+ color: data.reject && data.reject.color
411
+ ? data.reject.color
412
+ : undefined,
413
+ text: (data.reject && data.reject.text) || 'Annuler',
414
+ },
415
+ accept: {
416
+ color: (data.accept && data.accept.color) || 'primary',
417
+ text: (data.accept && data.accept.text) || 'Accepter',
418
+ },
419
+ },
420
+ });
421
+ dialogRef.afterClosed().subscribe((result) => __awaiter(this, void 0, void 0, function* () {
422
+ if (result)
423
+ resolve(result);
424
+ else
425
+ resolve(false);
426
+ }));
427
+ });
428
+ }
429
+ createDialgFromComponent(config) {
430
+ return this.dialog.open(C3DialogEmbedChildComponent, config);
431
+ }
432
+ }
433
+ C3DialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: C3DialogService, deps: [{ token: i1$2.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable });
434
+ C3DialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: C3DialogService, providedIn: 'root' });
435
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: C3DialogService, decorators: [{
436
+ type: Injectable,
437
+ args: [{
438
+ providedIn: 'root',
439
+ }]
440
+ }], ctorParameters: function () { return [{ type: i1$2.MatDialog }]; } });
441
+
442
+ class C3DialogModule {
443
+ }
444
+ C3DialogModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: C3DialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
445
+ C3DialogModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: C3DialogModule, declarations: [ConfirmDialogComponent,
446
+ C3PromptDialogComponent,
447
+ C3DialogEmbedChildComponent], imports: [CommonModule,
448
+ MatDialogModule,
449
+ MatButtonModule,
450
+ MatFormFieldModule,
451
+ MatInputModule,
452
+ FormsModule,
453
+ FlexLayoutModule,
454
+ ReactiveFormsModule] });
455
+ C3DialogModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: C3DialogModule, providers: [C3DialogService], imports: [CommonModule,
456
+ MatDialogModule,
457
+ MatButtonModule,
458
+ MatFormFieldModule,
459
+ MatInputModule,
460
+ FormsModule,
461
+ FlexLayoutModule,
462
+ ReactiveFormsModule] });
463
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: C3DialogModule, decorators: [{
464
+ type: NgModule,
465
+ args: [{
466
+ declarations: [
467
+ ConfirmDialogComponent,
468
+ C3PromptDialogComponent,
469
+ C3DialogEmbedChildComponent,
470
+ ],
471
+ imports: [
472
+ CommonModule,
473
+ MatDialogModule,
474
+ MatButtonModule,
475
+ MatFormFieldModule,
476
+ MatInputModule,
477
+ FormsModule,
478
+ FlexLayoutModule,
479
+ ReactiveFormsModule,
480
+ ],
481
+ providers: [C3DialogService],
482
+ }]
483
+ }] });
484
+
485
+ class FullScreenDirective {
486
+ set fullscreenState(value) {
487
+ this._fullscreenState.next((value === null || value === void 0 ? void 0 : value.valueOf()) || false);
488
+ }
489
+ set fullscreenStateSetter(value) {
490
+ this.fullscreenState = value;
491
+ }
492
+ constructor(el) {
493
+ this.el = el;
494
+ this._fullscreenState = new BehaviorSubject(false);
495
+ this._fullscreenState
496
+ .pipe(filter((value) => value !== null), skip(2), debounceTime(100))
497
+ .subscribe(() => {
498
+ this.defineState();
499
+ });
500
+ }
501
+ defineState() {
502
+ if (this._fullscreenState.getValue()) {
503
+ const element = this.el.nativeElement;
504
+ const requestMethod = element.requestFullscreen ||
505
+ element.webkitRequestFullScreen ||
506
+ element.mozRequestFullScreen ||
507
+ element.msRequestFullScreen;
508
+ if (requestMethod) {
509
+ // Native full screen.
510
+ requestMethod.call(element);
511
+ }
512
+ else {
513
+ console.log('FullScreen Request Method Not Supported on this browser.');
514
+ }
515
+ }
516
+ else {
517
+ const element = document;
518
+ const requestMethod = element.cancelFullscreen ||
519
+ element.webkitExitFullscreen ||
520
+ element.webkitCancelFullScreen ||
521
+ element.mozCancelFullScreen ||
522
+ element.msExitFullScreen;
523
+ if (requestMethod) {
524
+ // Native Cancel full screen.
525
+ requestMethod.call(element);
526
+ }
527
+ else {
528
+ console.log('FullScreen Cancel Request Method Not Supported on this browser.');
529
+ }
530
+ }
531
+ }
532
+ }
533
+ FullScreenDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FullScreenDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
534
+ FullScreenDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.8", type: FullScreenDirective, selector: "[C3FullScreen], [c3-full-screen]", inputs: { fullscreenState: ["c3Screenfull", "fullscreenState"], fullscreenStateSetter: ["c3-full-screen", "fullscreenStateSetter"] }, ngImport: i0 });
535
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FullScreenDirective, decorators: [{
536
+ type: Directive,
537
+ args: [{
538
+ selector: '[C3FullScreen], [c3-full-screen]',
539
+ }]
540
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { fullscreenState: [{
541
+ type: Input,
542
+ args: ['c3Screenfull']
543
+ }], fullscreenStateSetter: [{
544
+ type: Input,
545
+ args: ['c3-full-screen']
546
+ }] } });
547
+
548
+ class C3FileViewerActionsComponent {
549
+ get config() {
550
+ return this.fileViewer.config;
551
+ }
552
+ }
553
+ C3FileViewerActionsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: C3FileViewerActionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
554
+ C3FileViewerActionsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", type: C3FileViewerActionsComponent, selector: "c3-file-viewer-actions", inputs: { fileViewer: "fileViewer" }, ngImport: i0, template: "<div class=\"nav-button-container\">\n <button\n *ngIf=\"config.btnShow?.prev\"\n type=\"button\"\n [class]=\"config.btnClass\"\n (click)=\"fileViewer.previousImage($event)\"\n [disabled]=\"fileViewer.currentIndex === 0\"\n >\n <span\n *ngIf=\"config.btnIcons?.prev?.classes\"\n [class]=\"config.btnIcons?.prev?.classes\"\n ></span>\n </button>\n <a\n [class]=\"config.btnClass\"\n *ngIf=\"config.btnIcons?.prev?.text\"\n (click)=\"fileViewer.previousImage($event)\"\n >\n <span [class]=\"config.btnSubClass\">{{ config.btnIcons?.prev?.text }}</span>\n </a>\n <button\n *ngIf=\"config.btnShow?.next\"\n type=\"button\"\n [class]=\"config.btnClass\"\n (click)=\"fileViewer.nextImage($event)\"\n [disabled]=\"fileViewer.currentIndex === fileViewer.files.length - 1\"\n >\n <span\n *ngIf=\"config.btnIcons?.next?.classes\"\n [class]=\"config.btnIcons?.next?.classes\"\n ></span>\n </button>\n <a\n [class]=\"config.btnClass\"\n *ngIf=\"config.btnIcons?.next?.text\"\n (click)=\"fileViewer.nextImage($event)\"\n >\n <span [class]=\"config.btnSubClass\">{{ config.btnIcons?.next?.text }}</span>\n </a>\n</div>\n\n<!-- Button Container -->\n<div\n class=\"btn-container\"\n [class]=\"config.btnContainerClass\"\n *ngIf=\"fileViewer.currentFile.type.startsWith('image')\"\n>\n <!-- Rotate Counter Clockwise -->\n <ng-container *ngIf=\"config.btnShow?.rotateCounterClockwise\">\n <button\n type=\"button\"\n [class]=\"config.btnClass\"\n (click)=\"fileViewer.rotateCounterClockwise()\"\n *ngIf=\"config.btnIcons?.rotateCounterClockwise?.classes\"\n >\n <span [class]=\"config.btnIcons?.rotateCounterClockwise?.classes\"></span>\n </button>\n <a\n [class]=\"config.btnClass\"\n *ngIf=\"config.btnIcons?.rotateCounterClockwise?.text\"\n (click)=\"fileViewer.rotateCounterClockwise()\"\n >\n <span [class]=\"config.btnSubClass\">{{\n config.btnIcons?.rotateCounterClockwise?.text\n }}</span>\n </a>\n </ng-container>\n\n <!-- Rotate Clockwise -->\n <ng-container *ngIf=\"config.btnShow?.rotateClockwise\">\n <button\n type=\"button\"\n [class]=\"config.btnClass\"\n (click)=\"fileViewer.rotateClockwise()\"\n *ngIf=\"config.btnIcons?.rotateClockwise?.classes\"\n >\n <span [class]=\"config.btnIcons?.rotateClockwise?.classes\"></span>\n </button>\n <a\n [class]=\"config.btnClass\"\n *ngIf=\"config.btnIcons?.rotateClockwise?.text\"\n (click)=\"fileViewer.rotateClockwise()\"\n >\n <span [class]=\"config.btnSubClass\">{{\n config.btnIcons?.rotateClockwise?.text\n }}</span>\n </a>\n </ng-container>\n\n <!-- Zoom Out -->\n <ng-container *ngIf=\"config.btnShow?.zoomOut\">\n <button\n type=\"button\"\n [class]=\"config.btnClass\"\n (click)=\"fileViewer.zoomOut()\"\n *ngIf=\"config.btnIcons?.zoomOut?.classes\"\n >\n <span [class]=\"config.btnIcons?.zoomOut?.classes\"></span>\n </button>\n <a\n [class]=\"config.btnClass\"\n *ngIf=\"config.btnIcons?.zoomOut?.text\"\n (click)=\"fileViewer.zoomOut()\"\n >\n <span [class]=\"config.btnSubClass\">{{\n config.btnIcons?.zoomOut?.text\n }}</span>\n </a>\n </ng-container>\n\n <!-- Zoom In -->\n <ng-container *ngIf=\"config.btnShow?.zoomIn\">\n <button\n type=\"button\"\n [class]=\"config.btnClass\"\n (click)=\"fileViewer.zoomIn()\"\n *ngIf=\"config.btnIcons?.zoomIn?.classes\"\n >\n <span [class]=\"config.btnIcons?.zoomIn?.classes\"></span>\n </button>\n <a\n [class]=\"config.btnClass\"\n *ngIf=\"config.btnIcons?.zoomIn?.text\"\n (click)=\"fileViewer.zoomIn()\"\n >\n <span [class]=\"config.btnSubClass\">{{\n config.btnIcons?.zoomIn?.text\n }}</span>\n </a>\n </ng-container>\n\n <!-- Fullscreen -->\n <ng-container *ngIf=\"config.allowFullscreen\">\n <button\n type=\"button\"\n [class]=\"config.btnClass\"\n (click)=\"fileViewer.toggleFullscreen()\"\n *ngIf=\"config.btnIcons?.fullscreen?.classes\"\n >\n <span [class]=\"config.btnIcons?.fullscreen?.classes\"></span>\n </button>\n <a\n [class]=\"config.btnClass\"\n *ngIf=\"config.btnIcons?.fullscreen?.text\"\n (click)=\"fileViewer.toggleFullscreen()\"\n >\n <span [class]=\"config.btnSubClass\">{{\n config.btnIcons?.fullscreen?.text\n }}</span>\n </a>\n </ng-container>\n\n <!-- Reset -->\n <ng-container *ngIf=\"config.btnShow?.reset\">\n <button\n type=\"button\"\n [class]=\"config.btnClass\"\n (click)=\"fileViewer.reset()\"\n *ngIf=\"config.btnIcons?.reset?.classes\"\n >\n <span [class]=\"config.btnIcons?.reset?.classes\"></span>\n </button>\n <a\n [class]=\"config.btnClass\"\n *ngIf=\"config.btnIcons?.reset?.text\"\n (click)=\"fileViewer.reset()\"\n >\n <span [class]=\"config.btnSubClass\">{{\n config.btnIcons?.reset?.text\n }}</span>\n </a>\n </ng-container>\n\n <!-- Custom Buttons -->\n <ng-container *ngFor=\"let cBtn of config.customBtns\">\n <button *ngIf=\"cBtn.icon.classes\" type=\"button\" [class]=\"config.btnClass\">\n <span *ngIf=\"cBtn.icon.classes\" [class]=\"cBtn.icon.classes\"></span>\n </button>\n <ng-container *ngIf=\"cBtn.icon.text\">\n <a [class]=\"config.btnClass\" *ngIf=\"cBtn.icon.text\">\n <span [class]=\"config.btnSubClass\">{{ cBtn.icon.text }}</span>\n </a>\n </ng-container>\n </ng-container>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
555
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: C3FileViewerActionsComponent, decorators: [{
556
+ type: Component,
557
+ args: [{ selector: 'c3-file-viewer-actions', template: "<div class=\"nav-button-container\">\n <button\n *ngIf=\"config.btnShow?.prev\"\n type=\"button\"\n [class]=\"config.btnClass\"\n (click)=\"fileViewer.previousImage($event)\"\n [disabled]=\"fileViewer.currentIndex === 0\"\n >\n <span\n *ngIf=\"config.btnIcons?.prev?.classes\"\n [class]=\"config.btnIcons?.prev?.classes\"\n ></span>\n </button>\n <a\n [class]=\"config.btnClass\"\n *ngIf=\"config.btnIcons?.prev?.text\"\n (click)=\"fileViewer.previousImage($event)\"\n >\n <span [class]=\"config.btnSubClass\">{{ config.btnIcons?.prev?.text }}</span>\n </a>\n <button\n *ngIf=\"config.btnShow?.next\"\n type=\"button\"\n [class]=\"config.btnClass\"\n (click)=\"fileViewer.nextImage($event)\"\n [disabled]=\"fileViewer.currentIndex === fileViewer.files.length - 1\"\n >\n <span\n *ngIf=\"config.btnIcons?.next?.classes\"\n [class]=\"config.btnIcons?.next?.classes\"\n ></span>\n </button>\n <a\n [class]=\"config.btnClass\"\n *ngIf=\"config.btnIcons?.next?.text\"\n (click)=\"fileViewer.nextImage($event)\"\n >\n <span [class]=\"config.btnSubClass\">{{ config.btnIcons?.next?.text }}</span>\n </a>\n</div>\n\n<!-- Button Container -->\n<div\n class=\"btn-container\"\n [class]=\"config.btnContainerClass\"\n *ngIf=\"fileViewer.currentFile.type.startsWith('image')\"\n>\n <!-- Rotate Counter Clockwise -->\n <ng-container *ngIf=\"config.btnShow?.rotateCounterClockwise\">\n <button\n type=\"button\"\n [class]=\"config.btnClass\"\n (click)=\"fileViewer.rotateCounterClockwise()\"\n *ngIf=\"config.btnIcons?.rotateCounterClockwise?.classes\"\n >\n <span [class]=\"config.btnIcons?.rotateCounterClockwise?.classes\"></span>\n </button>\n <a\n [class]=\"config.btnClass\"\n *ngIf=\"config.btnIcons?.rotateCounterClockwise?.text\"\n (click)=\"fileViewer.rotateCounterClockwise()\"\n >\n <span [class]=\"config.btnSubClass\">{{\n config.btnIcons?.rotateCounterClockwise?.text\n }}</span>\n </a>\n </ng-container>\n\n <!-- Rotate Clockwise -->\n <ng-container *ngIf=\"config.btnShow?.rotateClockwise\">\n <button\n type=\"button\"\n [class]=\"config.btnClass\"\n (click)=\"fileViewer.rotateClockwise()\"\n *ngIf=\"config.btnIcons?.rotateClockwise?.classes\"\n >\n <span [class]=\"config.btnIcons?.rotateClockwise?.classes\"></span>\n </button>\n <a\n [class]=\"config.btnClass\"\n *ngIf=\"config.btnIcons?.rotateClockwise?.text\"\n (click)=\"fileViewer.rotateClockwise()\"\n >\n <span [class]=\"config.btnSubClass\">{{\n config.btnIcons?.rotateClockwise?.text\n }}</span>\n </a>\n </ng-container>\n\n <!-- Zoom Out -->\n <ng-container *ngIf=\"config.btnShow?.zoomOut\">\n <button\n type=\"button\"\n [class]=\"config.btnClass\"\n (click)=\"fileViewer.zoomOut()\"\n *ngIf=\"config.btnIcons?.zoomOut?.classes\"\n >\n <span [class]=\"config.btnIcons?.zoomOut?.classes\"></span>\n </button>\n <a\n [class]=\"config.btnClass\"\n *ngIf=\"config.btnIcons?.zoomOut?.text\"\n (click)=\"fileViewer.zoomOut()\"\n >\n <span [class]=\"config.btnSubClass\">{{\n config.btnIcons?.zoomOut?.text\n }}</span>\n </a>\n </ng-container>\n\n <!-- Zoom In -->\n <ng-container *ngIf=\"config.btnShow?.zoomIn\">\n <button\n type=\"button\"\n [class]=\"config.btnClass\"\n (click)=\"fileViewer.zoomIn()\"\n *ngIf=\"config.btnIcons?.zoomIn?.classes\"\n >\n <span [class]=\"config.btnIcons?.zoomIn?.classes\"></span>\n </button>\n <a\n [class]=\"config.btnClass\"\n *ngIf=\"config.btnIcons?.zoomIn?.text\"\n (click)=\"fileViewer.zoomIn()\"\n >\n <span [class]=\"config.btnSubClass\">{{\n config.btnIcons?.zoomIn?.text\n }}</span>\n </a>\n </ng-container>\n\n <!-- Fullscreen -->\n <ng-container *ngIf=\"config.allowFullscreen\">\n <button\n type=\"button\"\n [class]=\"config.btnClass\"\n (click)=\"fileViewer.toggleFullscreen()\"\n *ngIf=\"config.btnIcons?.fullscreen?.classes\"\n >\n <span [class]=\"config.btnIcons?.fullscreen?.classes\"></span>\n </button>\n <a\n [class]=\"config.btnClass\"\n *ngIf=\"config.btnIcons?.fullscreen?.text\"\n (click)=\"fileViewer.toggleFullscreen()\"\n >\n <span [class]=\"config.btnSubClass\">{{\n config.btnIcons?.fullscreen?.text\n }}</span>\n </a>\n </ng-container>\n\n <!-- Reset -->\n <ng-container *ngIf=\"config.btnShow?.reset\">\n <button\n type=\"button\"\n [class]=\"config.btnClass\"\n (click)=\"fileViewer.reset()\"\n *ngIf=\"config.btnIcons?.reset?.classes\"\n >\n <span [class]=\"config.btnIcons?.reset?.classes\"></span>\n </button>\n <a\n [class]=\"config.btnClass\"\n *ngIf=\"config.btnIcons?.reset?.text\"\n (click)=\"fileViewer.reset()\"\n >\n <span [class]=\"config.btnSubClass\">{{\n config.btnIcons?.reset?.text\n }}</span>\n </a>\n </ng-container>\n\n <!-- Custom Buttons -->\n <ng-container *ngFor=\"let cBtn of config.customBtns\">\n <button *ngIf=\"cBtn.icon.classes\" type=\"button\" [class]=\"config.btnClass\">\n <span *ngIf=\"cBtn.icon.classes\" [class]=\"cBtn.icon.classes\"></span>\n </button>\n <ng-container *ngIf=\"cBtn.icon.text\">\n <a [class]=\"config.btnClass\" *ngIf=\"cBtn.icon.text\">\n <span [class]=\"config.btnSubClass\">{{ cBtn.icon.text }}</span>\n </a>\n </ng-container>\n </ng-container>\n</div>\n" }]
558
+ }], propDecorators: { fileViewer: [{
559
+ type: Input
560
+ }] } });
561
+
562
+ class C3SafeUrlPipe {
563
+ constructor(sanitizer) {
564
+ this.sanitizer = sanitizer;
565
+ }
566
+ transform(url) {
567
+ return url ? this.sanitizer.bypassSecurityTrustResourceUrl(url) : '';
568
+ }
569
+ }
570
+ C3SafeUrlPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: C3SafeUrlPipe, deps: [{ token: i1$3.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
571
+ C3SafeUrlPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: C3SafeUrlPipe, isStandalone: true, name: "c3SafeUrl" });
572
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: C3SafeUrlPipe, decorators: [{
573
+ type: Pipe,
574
+ args: [{
575
+ name: 'c3SafeUrl',
576
+ standalone: true,
577
+ }]
578
+ }], ctorParameters: function () { return [{ type: i1$3.DomSanitizer }]; } });
579
+
580
+ class C3FileViewerImageComponent {
581
+ constructor() {
582
+ this.dragstart = new EventEmitter();
583
+ }
584
+ }
585
+ C3FileViewerImageComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: C3FileViewerImageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
586
+ C3FileViewerImageComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", type: C3FileViewerImageComponent, selector: "c3-file-viewer-image, [c3-file-viewer-image]", inputs: { fileViewer: "fileViewer" }, outputs: { dragstart: "dragstart" }, ngImport: i0, template: "<img\n *ngIf=\"fileViewer.currentFile.objectUrl\"\n [src]=\"fileViewer.currentFile.objectUrl | async | c3SafeUrl\"\n [ngStyle]=\"fileViewer.style\"\n alt=\"Image not found...\"\n (dragstart)=\"dragstart.emit($event)\"\n/>\n", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: C3SafeUrlPipe, name: "c3SafeUrl" }] });
587
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: C3FileViewerImageComponent, decorators: [{
588
+ type: Component,
589
+ args: [{ selector: 'c3-file-viewer-image, [c3-file-viewer-image]', template: "<img\n *ngIf=\"fileViewer.currentFile.objectUrl\"\n [src]=\"fileViewer.currentFile.objectUrl | async | c3SafeUrl\"\n [ngStyle]=\"fileViewer.style\"\n alt=\"Image not found...\"\n (dragstart)=\"dragstart.emit($event)\"\n/>\n" }]
590
+ }], propDecorators: { fileViewer: [{
591
+ type: Input
592
+ }], dragstart: [{
593
+ type: Output
594
+ }] } });
595
+
596
+ class C3FileViewerPdfComponent {
597
+ constructor() {
598
+ this.dragstart = new EventEmitter();
599
+ }
600
+ }
601
+ C3FileViewerPdfComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: C3FileViewerPdfComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
602
+ C3FileViewerPdfComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", type: C3FileViewerPdfComponent, selector: "c3-file-viewer-pdf", inputs: { fileViewer: "fileViewer" }, outputs: { dragstart: "dragstart" }, host: { styleAttribute: "display: block", classAttribute: "c3-file-viewer-pdf" }, ngImport: i0, template: "<!-- pdf viewer -->\n<embed\n type=\"application/pdf\"\n [src]=\"fileViewer.currentFile.objectUrl | async | c3SafeUrl\"\n [style.height]=\"'100%'\"\n [style.width]=\"'100%'\"\n/>\n", dependencies: [{ kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: C3SafeUrlPipe, name: "c3SafeUrl" }], encapsulation: i0.ViewEncapsulation.None });
603
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: C3FileViewerPdfComponent, decorators: [{
604
+ type: Component,
605
+ args: [{ selector: 'c3-file-viewer-pdf', encapsulation: ViewEncapsulation.None, host: {
606
+ style: 'display: block',
607
+ class: 'c3-file-viewer-pdf',
608
+ }, template: "<!-- pdf viewer -->\n<embed\n type=\"application/pdf\"\n [src]=\"fileViewer.currentFile.objectUrl | async | c3SafeUrl\"\n [style.height]=\"'100%'\"\n [style.width]=\"'100%'\"\n/>\n" }]
609
+ }], propDecorators: { fileViewer: [{
610
+ type: Input
611
+ }], dragstart: [{
612
+ type: Output
613
+ }] } });
614
+
615
+ class C3FileViewerVideoComponent {
616
+ set _srcUpdated({ location }) {
617
+ this.src$.next(location);
618
+ }
619
+ constructor() {
620
+ this.src = '';
621
+ this.src$ = new Subject();
622
+ this.src$
623
+ .pipe(mergeMap((src) => this.fileViewer.getFile(src)), filter((blob) => blob.type.startsWith('application/pdf')), tap((blob) => (this.src = URL.createObjectURL(blob))))
624
+ .subscribe({
625
+ next: () => null,
626
+ error: (error) => {
627
+ console.log(error);
628
+ },
629
+ });
630
+ }
631
+ }
632
+ C3FileViewerVideoComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: C3FileViewerVideoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
633
+ C3FileViewerVideoComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", type: C3FileViewerVideoComponent, selector: "c3-file-viewer-video", inputs: { _srcUpdated: ["file", "_srcUpdated"], fileViewer: "fileViewer" }, ngImport: i0, template: "<video controls [src]=\"src\" crossorigin=\"*\"></video>\n" });
634
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: C3FileViewerVideoComponent, decorators: [{
635
+ type: Component,
636
+ args: [{ selector: 'c3-file-viewer-video', template: "<video controls [src]=\"src\" crossorigin=\"*\"></video>\n" }]
637
+ }], ctorParameters: function () { return []; }, propDecorators: { _srcUpdated: [{
638
+ type: Input,
639
+ args: ['file']
640
+ }], fileViewer: [{
641
+ type: Input
642
+ }] } });
643
+
644
+ class C3FileViewerComponent {
645
+ constructor(moduleConfig, _http) {
646
+ this.moduleConfig = moduleConfig;
647
+ this._http = _http;
648
+ this.indexChange = new EventEmitter();
649
+ this.configChange = new EventEmitter();
650
+ this.customFileEvent = new EventEmitter();
651
+ }
652
+ ngOnInit() {
653
+ if (!this.fileViewer.http)
654
+ this.fileViewer.http = this._http;
655
+ this.fileViewer.customFile$.subscribe((event) => {
656
+ this.customFileEvent.emit(event);
657
+ });
658
+ this.fileViewer.index$.subscribe((index) => {
659
+ this.indexChange.emit(index);
660
+ });
661
+ this.fileViewer.config$.subscribe((config) => {
662
+ this.configChange.emit(config);
663
+ });
664
+ }
665
+ onMouseOver() {
666
+ this.fileViewer.hovered = true;
667
+ }
668
+ onMouseLeave() {
669
+ this.fileViewer.hovered = false;
670
+ }
671
+ ngOnChanges(changes) {
672
+ if (changes['screenHeightOccupied'] && this.fileViewer)
673
+ this.fileViewer.styleHeight =
674
+ 'calc(100% - ' + this.screenHeightOccupied + 'px)';
675
+ }
676
+ next(event) {
677
+ this.fileViewer.nextImage(event);
678
+ }
679
+ previous(event) {
680
+ this.fileViewer.previousImage(event);
681
+ }
682
+ }
683
+ C3FileViewerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: C3FileViewerComponent, deps: [{ token: 'config', optional: true }, { token: i1$4.HttpClient }], target: i0.ɵɵFactoryTarget.Component });
684
+ C3FileViewerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", type: C3FileViewerComponent, selector: "c3-file-viewer", inputs: { screenHeightOccupied: "screenHeightOccupied", fileViewer: "fileViewer" }, outputs: { indexChange: "indexChange", configChange: "configChange", customFileEvent: "customFileEvent" }, host: { listeners: { "mouseover": "onMouseOver()", "mouseleave": "onMouseLeave()", "window:keyup.ArrowRight": "next($event)", "window:keyup.ArrowLeft": "previous($event)" }, classAttribute: "c3-file-viewer" }, usesOnChanges: true, ngImport: i0, template: "<div\n class=\"container\"\n *ngIf=\"fileViewer\"\n [c3-full-screen]=\"fileViewer.fullscreen$ | async\"\n [style.height]=\"fileViewer.styleHeight\"\n [style.backgroundColor]=\"fileViewer.config.containerBackgroundColor\"\n (wheel)=\"fileViewer.scrollZoom($event)\"\n (dragover)=\"fileViewer.onDragOver($event)\"\n>\n <c3-file-viewer-image\n *ngIf=\"fileViewer.currentFile.type.startsWith('image')\"\n [fileViewer]=\"fileViewer\"\n [style]=\"fileViewer.style\"\n (dragstart)=\"fileViewer.onDragStart($event)\"\n />\n\n <c3-file-viewer-video\n *ngIf=\"fileViewer.currentFile.type.startsWith('video')\"\n />\n\n <c3-file-viewer-pdf\n *ngIf=\"fileViewer.currentFile.type.startsWith('application/pdf')\"\n [fileViewer]=\"fileViewer\"\n />\n <!-- Div below will be used to hide the 'ghost' image when dragging -->\n <div></div>\n <div class=\"spinner-container\" *ngIf=\"fileViewer.loading\">\n <div class=\"spinner\"></div>\n </div>\n\n <c3-file-viewer-actions [fileViewer]=\"fileViewer\" />\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: FullScreenDirective, selector: "[C3FullScreen], [c3-full-screen]", inputs: ["c3Screenfull", "c3-full-screen"] }, { kind: "component", type: C3FileViewerActionsComponent, selector: "c3-file-viewer-actions", inputs: ["fileViewer"] }, { kind: "component", type: C3FileViewerImageComponent, selector: "c3-file-viewer-image, [c3-file-viewer-image]", inputs: ["fileViewer"], outputs: ["dragstart"] }, { kind: "component", type: C3FileViewerPdfComponent, selector: "c3-file-viewer-pdf", inputs: ["fileViewer"], outputs: ["dragstart"] }, { kind: "component", type: C3FileViewerVideoComponent, selector: "c3-file-viewer-video", inputs: ["file", "fileViewer"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], encapsulation: i0.ViewEncapsulation.None });
685
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: C3FileViewerComponent, decorators: [{
686
+ type: Component,
687
+ args: [{ selector: 'c3-file-viewer', encapsulation: ViewEncapsulation.None, host: {
688
+ class: 'c3-file-viewer',
689
+ }, template: "<div\n class=\"container\"\n *ngIf=\"fileViewer\"\n [c3-full-screen]=\"fileViewer.fullscreen$ | async\"\n [style.height]=\"fileViewer.styleHeight\"\n [style.backgroundColor]=\"fileViewer.config.containerBackgroundColor\"\n (wheel)=\"fileViewer.scrollZoom($event)\"\n (dragover)=\"fileViewer.onDragOver($event)\"\n>\n <c3-file-viewer-image\n *ngIf=\"fileViewer.currentFile.type.startsWith('image')\"\n [fileViewer]=\"fileViewer\"\n [style]=\"fileViewer.style\"\n (dragstart)=\"fileViewer.onDragStart($event)\"\n />\n\n <c3-file-viewer-video\n *ngIf=\"fileViewer.currentFile.type.startsWith('video')\"\n />\n\n <c3-file-viewer-pdf\n *ngIf=\"fileViewer.currentFile.type.startsWith('application/pdf')\"\n [fileViewer]=\"fileViewer\"\n />\n <!-- Div below will be used to hide the 'ghost' image when dragging -->\n <div></div>\n <div class=\"spinner-container\" *ngIf=\"fileViewer.loading\">\n <div class=\"spinner\"></div>\n </div>\n\n <c3-file-viewer-actions [fileViewer]=\"fileViewer\" />\n</div>\n" }]
690
+ }], ctorParameters: function () {
691
+ return [{ type: undefined, decorators: [{
692
+ type: Optional
693
+ }, {
694
+ type: Inject,
695
+ args: ['config']
696
+ }] }, { type: i1$4.HttpClient }];
697
+ }, propDecorators: { screenHeightOccupied: [{
698
+ type: Input
699
+ }], fileViewer: [{
700
+ type: Input
701
+ }], indexChange: [{
702
+ type: Output
703
+ }], configChange: [{
704
+ type: Output
705
+ }], customFileEvent: [{
706
+ type: Output
707
+ }], onMouseOver: [{
708
+ type: HostListener,
709
+ args: ['mouseover']
710
+ }], onMouseLeave: [{
711
+ type: HostListener,
712
+ args: ['mouseleave']
713
+ }], next: [{
714
+ type: HostListener,
715
+ args: ['window:keyup.ArrowRight', ['$event']]
716
+ }], previous: [{
717
+ type: HostListener,
718
+ args: ['window:keyup.ArrowLeft', ['$event']]
719
+ }] } });
720
+
721
+ class CustomFileEvent {
722
+ constructor(name, fileUrl) {
723
+ this.name = name;
724
+ this.fileUrl = fileUrl;
725
+ }
726
+ }
727
+
728
+ const DEFAULT_CONFIG = {
729
+ btnContainerClass: 'btn-container',
730
+ btnClass: 'default',
731
+ btnSubClass: 'material-icons',
732
+ zoomFactor: 0.1,
733
+ containerBackgroundColor: '#00000000',
734
+ wheelZoom: false,
735
+ allowFullscreen: true,
736
+ allowKeyboardNavigation: true,
737
+ btnShow: {
738
+ zoomIn: true,
739
+ zoomOut: true,
740
+ rotateClockwise: true,
741
+ rotateCounterClockwise: true,
742
+ next: true,
743
+ prev: true,
744
+ reset: true,
745
+ },
746
+ btnIcons: {
747
+ zoomIn: {
748
+ text: 'zoom_in',
749
+ },
750
+ zoomOut: {
751
+ text: 'zoom_out',
752
+ },
753
+ rotateClockwise: {
754
+ text: 'rotate_right',
755
+ },
756
+ rotateCounterClockwise: {
757
+ text: 'rotate_left',
758
+ },
759
+ fullscreen: {
760
+ text: 'fullscreen',
761
+ },
762
+ reset: {
763
+ text: 'restore',
764
+ },
765
+ },
766
+ };
767
+
768
+ class C3FileViewer {
769
+ get config() {
770
+ return this._config;
771
+ }
772
+ set config(value) {
773
+ this._config = this.mergeConfig(DEFAULT_CONFIG, value);
774
+ this.config$.next(this._config);
775
+ }
776
+ get currentFile() {
777
+ return this.filesObjectUrl[this.currentIndex];
778
+ }
779
+ set files(value) {
780
+ this._files = value;
781
+ this.currentIndex = 0;
782
+ this.index$.next(this.currentIndex);
783
+ this.filesObjectUrl = value.map((file) => {
784
+ return Object.assign(Object.assign({}, file), { objectUrl: file.objectUrl || this.createObjectURL(file) });
785
+ });
786
+ }
787
+ get files() {
788
+ return this._files;
789
+ }
790
+ constructor({ http, config, files, }) {
791
+ this._config = DEFAULT_CONFIG;
792
+ this.config$ = new BehaviorSubject(DEFAULT_CONFIG);
793
+ this.fullscreen$ = new BehaviorSubject(false);
794
+ this.customFile$ = new BehaviorSubject(null);
795
+ this.index$ = new BehaviorSubject(0);
796
+ this.loading = true;
797
+ this.currentIndex = 0;
798
+ this.style = {
799
+ transform: '',
800
+ msTransform: '',
801
+ oTransform: '',
802
+ webkitTransform: '',
803
+ minHeight: 'auto',
804
+ maxHeight: 'auto',
805
+ height: 'auto',
806
+ minWidth: 'auto',
807
+ maxWidth: 'auto',
808
+ width: 'auto',
809
+ };
810
+ this.styleHeight = '100%';
811
+ this.hovered = false;
812
+ this._files = [];
813
+ this.filesObjectUrl = [];
814
+ this.scale = 1;
815
+ this.rotation = 0;
816
+ this.translateX = 0;
817
+ this.translateY = 0;
818
+ this.prevX = 0;
819
+ this.prevY = 0;
820
+ if (http)
821
+ this.http = http;
822
+ if (config)
823
+ this.config = config;
824
+ if (files)
825
+ this.files = files;
826
+ this.config$.subscribe((config) => {
827
+ const { minHeight, maxHeight, minWidth, maxWidth, height, width } = config;
828
+ this.style.minHeight = this.valueToCss(minHeight);
829
+ this.style.height = this.valueToCss(height);
830
+ this.style.width = this.valueToCss(width);
831
+ this.style.maxHeight = this.valueToCss(maxHeight);
832
+ this.style.minWidth = this.valueToCss(minWidth);
833
+ this.style.maxWidth = this.valueToCss(maxWidth);
834
+ this.styleHeight = this.valueToCss(height);
835
+ this.updateStyle();
836
+ });
837
+ }
838
+ createObjectURL(file) {
839
+ this.onLoadStart(file);
840
+ return this.getFile(file.location).pipe(map((response) => URL.createObjectURL(response)), tap(() => this.onLoad(file)));
841
+ }
842
+ getFile(location) {
843
+ var _a;
844
+ const client = this.config.customClient || ((_a = this.http) === null || _a === void 0 ? void 0 : _a.get.bind(this.http));
845
+ if (!client) {
846
+ throw new Error('No http client provided. Please provide a custom client or import HttpClientModule');
847
+ }
848
+ return client(location, {
849
+ responseType: 'blob',
850
+ });
851
+ }
852
+ previousImage(event) {
853
+ if (this.canNavigate(event)) {
854
+ this.loading = true;
855
+ if (this.currentIndex > 0)
856
+ this.currentIndex--;
857
+ else
858
+ this.currentIndex = this.files.length - 1;
859
+ this.index$.next(this.currentIndex);
860
+ this.reset();
861
+ }
862
+ }
863
+ nextImage(event) {
864
+ if (this.canNavigate(event)) {
865
+ this.loading = true;
866
+ if (this.currentIndex < this.files.length - 1)
867
+ this.currentIndex++;
868
+ else
869
+ this.currentIndex = 0;
870
+ this.index$.next(this.currentIndex);
871
+ this.reset();
872
+ }
873
+ }
874
+ zoomIn() {
875
+ this.scale *= 1 + (this.config.zoomFactor || 0);
876
+ this.updateStyle();
877
+ }
878
+ zoomOut() {
879
+ if (this.scale > (this.config.zoomFactor || 0)) {
880
+ this.scale /= 1 + (this.config.zoomFactor || 0);
881
+ }
882
+ this.updateStyle();
883
+ }
884
+ scrollZoom(evt) {
885
+ if (this.config.wheelZoom) {
886
+ evt.deltaY > 0 ? this.zoomOut() : this.zoomIn();
887
+ return false;
888
+ }
889
+ else {
890
+ return true;
891
+ }
892
+ }
893
+ rotateClockwise() {
894
+ this.rotation += 90;
895
+ this.updateStyle();
896
+ }
897
+ rotateCounterClockwise() {
898
+ this.rotation -= 90;
899
+ this.updateStyle();
900
+ }
901
+ onLoad(file) {
902
+ this.loading = false;
903
+ }
904
+ onLoadStart(file) {
905
+ this.loading = true;
906
+ }
907
+ imageNotFound(file) {
908
+ this.loading = false;
909
+ this.customFile$.next(new CustomFileEvent('imageNotFound', file.location));
910
+ }
911
+ onDragOver(evt) {
912
+ this.translateX += evt.clientX - this.prevX;
913
+ this.translateY += evt.clientY - this.prevY;
914
+ this.prevX = evt.clientX;
915
+ this.prevY = evt.clientY;
916
+ this.updateStyle();
917
+ }
918
+ onDragStart(evt) {
919
+ if (evt.target && evt.dataTransfer && evt.dataTransfer.setDragImage) {
920
+ const target = evt.target;
921
+ const nextElementSibling = target.nextElementSibling;
922
+ if (nextElementSibling)
923
+ evt.dataTransfer.setDragImage(nextElementSibling, 0, 0);
924
+ }
925
+ this.prevX = evt.clientX;
926
+ this.prevY = evt.clientY;
927
+ }
928
+ toggleFullscreen() {
929
+ const fullScreenValue = this.fullscreen$.getValue();
930
+ this.fullscreen$.next(!fullScreenValue);
931
+ if (fullScreenValue)
932
+ this.reset();
933
+ }
934
+ reset() {
935
+ this.scale = 1;
936
+ this.rotation = 0;
937
+ this.translateX = 0;
938
+ this.translateY = 0;
939
+ this.updateStyle();
940
+ }
941
+ canNavigate(event) {
942
+ return (event == null || (this.config.allowKeyboardNavigation && this.hovered));
943
+ }
944
+ updateStyle() {
945
+ this.style.transform = `translate(${this.translateX}px, ${this.translateY}px) rotate(${this.rotation}deg) scale(${this.scale})`;
946
+ this.style.msTransform = this.style.transform;
947
+ this.style.webkitTransform = this.style.transform;
948
+ this.style.oTransform = this.style.transform;
949
+ }
950
+ valueToCss(value) {
951
+ return value ? (typeof value === 'string' ? value : value + 'px') : 'auto';
952
+ }
953
+ mergeConfig(defaultValues, overrideValues) {
954
+ let result = Object.assign({}, defaultValues);
955
+ if (overrideValues) {
956
+ result = Object.assign(Object.assign({}, defaultValues), overrideValues);
957
+ if (overrideValues.btnIcons) {
958
+ result.btnIcons = Object.assign(Object.assign({}, defaultValues.btnIcons), overrideValues.btnIcons);
959
+ }
960
+ }
961
+ return result;
962
+ }
963
+ }
964
+
965
+ class C3FileViewerModule {
966
+ }
967
+ C3FileViewerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: C3FileViewerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
968
+ C3FileViewerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: C3FileViewerModule, declarations: [FullScreenDirective,
969
+ C3FileViewerComponent,
970
+ C3FileViewerActionsComponent,
971
+ C3FileViewerImageComponent,
972
+ C3FileViewerPdfComponent,
973
+ C3FileViewerVideoComponent], imports: [CommonModule, HttpClientModule, C3SafeUrlPipe], exports: [FullScreenDirective, C3FileViewerComponent] });
974
+ C3FileViewerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: C3FileViewerModule, imports: [CommonModule, HttpClientModule] });
975
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: C3FileViewerModule, decorators: [{
976
+ type: NgModule,
977
+ args: [{
978
+ providers: [],
979
+ declarations: [
980
+ FullScreenDirective,
981
+ C3FileViewerComponent,
982
+ C3FileViewerActionsComponent,
983
+ C3FileViewerImageComponent,
984
+ C3FileViewerPdfComponent,
985
+ C3FileViewerVideoComponent,
986
+ ],
987
+ imports: [CommonModule, HttpClientModule, C3SafeUrlPipe],
988
+ exports: [FullScreenDirective, C3FileViewerComponent],
989
+ }]
990
+ }] });
991
+
992
+ /*
993
+ * Public API Surface of c3-components
994
+ */
995
+
996
+ /**
997
+ * Generated bundle index. Do not edit.
998
+ */
999
+
1000
+ export { C3DialogEmbedChildComponent, C3DialogModule, C3DialogService, C3DropdownComponent, C3DropdownModule, C3DropdownTrigger, C3FileViewer, C3FileViewerComponent, C3FileViewerModule, C3PromptDialogComponent, C3SafeUrlPipe, ConfirmDialogComponent, CustomFileEvent, FullScreenDirective, MAT_DROPDOWN_VALUE_ACCESSOR };
1001
+ //# sourceMappingURL=c3-components.mjs.map