c3-components 0.0.7 → 0.0.8

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