c3-components 0.0.13 → 0.0.14

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 (132) hide show
  1. package/CONTRIBUTING.md +80 -0
  2. package/bun.lockb +0 -0
  3. package/ng-package.json +19 -0
  4. package/package.json +5 -15
  5. package/{_index.scss → src/_index.scss} +1 -3
  6. package/src/lib/c3-auto-animate/C3AutoAnimate.directive.ts +18 -0
  7. package/src/lib/c3-dialog/c3-dialog.module.ts +30 -0
  8. package/src/lib/c3-dialog/components/c3-dialog-confirm.component.ts +44 -0
  9. package/src/lib/c3-dialog/components/c3-dialog-embed-child.component.ts +40 -0
  10. package/src/lib/c3-dialog/components/c3-dialog-prompt.component.ts +81 -0
  11. package/src/lib/c3-dialog/services/c3-dialog.service.ts +87 -0
  12. package/src/lib/c3-dropdown/c3-dropdown.module.ts +12 -0
  13. package/src/lib/c3-dropdown/components/c3-dropdown.component.spec.ts +22 -0
  14. package/src/lib/c3-dropdown/components/c3-dropdown.component.ts +39 -0
  15. package/src/lib/c3-dropdown/directives/c3-dropdown.trigger.ts +161 -0
  16. package/src/lib/c3-expansion/c3-expansion.module.ts +24 -0
  17. package/src/lib/c3-expansion/components/c3-expansion/c3-expansion.component.html +9 -0
  18. package/src/lib/c3-expansion/components/c3-expansion/c3-expansion.component.ts +33 -0
  19. package/src/lib/c3-expansion/components/c3-expansion-header/c3-expansion-header.component.html +12 -0
  20. package/src/lib/c3-expansion/components/c3-expansion-header/c3-expansion-header.component.ts +21 -0
  21. package/src/lib/c3-expansion/styles/_c3-expansion.scss +39 -0
  22. package/src/lib/c3-file/c3-download/c3-download.module.ts +7 -0
  23. package/src/lib/c3-file/c3-download/c3-download.service.ts +16 -0
  24. package/src/lib/c3-file/c3-input-file/c3-input-file.module.ts +30 -0
  25. package/src/lib/c3-file/c3-input-file/class/c3-input-file.ts +62 -0
  26. package/src/lib/c3-file/c3-input-file/components/c3-input-file/c3-input-file.component.html +7 -0
  27. package/src/lib/c3-file/c3-input-file/components/c3-input-file/c3-input-file.component.ts +96 -0
  28. package/src/lib/c3-file/c3-input-file/components/c3-input-file-container/c3-input-file-container.component.ts +53 -0
  29. package/src/lib/c3-file/c3-input-file/components/c3-input-file-displayer/c3-input-file-displayer.component.ts +107 -0
  30. package/src/lib/c3-file/c3-input-file/components/c3-input-file-trigger/c3-input-file-trigger.component.ts +22 -0
  31. package/src/lib/c3-file/c3-input-file/directives/c3-input-file-trigger.directive.ts +27 -0
  32. package/src/lib/c3-file-upload/c3-file-upload.module.ts +8 -0
  33. package/src/lib/c3-file-viewer/c3-file-viewer.module.ts +30 -0
  34. package/src/lib/c3-file-viewer/components/c3-file-viewer-actions/c3-file-viewer-actions.component.html +185 -0
  35. package/src/lib/c3-file-viewer/components/c3-file-viewer-actions/c3-file-viewer-actions.component.spec.ts +23 -0
  36. package/src/lib/c3-file-viewer/components/c3-file-viewer-actions/c3-file-viewer-actions.component.ts +15 -0
  37. package/src/lib/c3-file-viewer/components/c3-file-viewer-image/c3-file-viewer-image.component.html +7 -0
  38. package/src/lib/c3-file-viewer/components/c3-file-viewer-image/c3-file-viewer-image.component.spec.ts +23 -0
  39. package/src/lib/c3-file-viewer/components/c3-file-viewer-image/c3-file-viewer-image.component.ts +14 -0
  40. package/src/lib/c3-file-viewer/components/c3-file-viewer-pdf/c3-file-viewer-pdf.component.html +7 -0
  41. package/src/lib/c3-file-viewer/components/c3-file-viewer-pdf/c3-file-viewer-pdf.component.spec.ts +23 -0
  42. package/src/lib/c3-file-viewer/components/c3-file-viewer-pdf/c3-file-viewer-pdf.component.ts +25 -0
  43. package/src/lib/c3-file-viewer/components/c3-file-viewer-video/c3-file-viewer-video.component.css +0 -0
  44. package/src/lib/c3-file-viewer/components/c3-file-viewer-video/c3-file-viewer-video.component.html +1 -0
  45. package/src/lib/c3-file-viewer/components/c3-file-viewer-video/c3-file-viewer-video.component.spec.ts +23 -0
  46. package/src/lib/c3-file-viewer/components/c3-file-viewer-video/c3-file-viewer-video.component.ts +35 -0
  47. package/src/lib/c3-file-viewer/components/public/c3-file-viewer/c3-file-viewer.component.html +32 -0
  48. package/src/lib/c3-file-viewer/components/public/c3-file-viewer/c3-file-viewer.component.spec.ts +23 -0
  49. package/src/lib/c3-file-viewer/components/public/c3-file-viewer/c3-file-viewer.component.ts +93 -0
  50. package/src/lib/c3-file-viewer/components/public/c3-file-viewer-dialog/c3-file-viewer-dialog.component.spec.ts +23 -0
  51. package/src/lib/c3-file-viewer/components/public/c3-file-viewer-dialog/c3-file-viewer-dialog.component.ts +37 -0
  52. package/src/lib/c3-file-viewer/components/public/c3-file-viewer-dialog/c3-file-viewer-dialog.spec.ts +22 -0
  53. package/src/lib/c3-file-viewer/components/public/c3-file-viewer-dialog/c3-file-viewer-dialog.ts +12 -0
  54. package/src/lib/c3-file-viewer/consts/default.config.ts +41 -0
  55. package/src/lib/c3-file-viewer/directives/full-screen.directive.spec.ts +11 -0
  56. package/src/lib/c3-file-viewer/directives/full-screen.directive.ts +68 -0
  57. package/src/lib/c3-file-viewer/models/custom-file-event.model.ts +9 -0
  58. package/src/lib/c3-file-viewer/models/file-metadata.ts +13 -0
  59. package/src/lib/c3-file-viewer/models/file-viewer-config.model.ts +53 -0
  60. package/src/lib/c3-file-viewer/models/file-viewer.ts +259 -0
  61. package/src/lib/c3-file-viewer/models/http.client.ts +23 -0
  62. package/src/lib/c3-highlight-text/c3-highlight-text.module.ts +12 -0
  63. package/src/lib/c3-menu/c3-menu.module.ts +12 -0
  64. package/src/lib/c3-modal/c3-modal.module.ts +12 -0
  65. package/src/lib/c3-navbar/c3-navbar.module.ts +12 -0
  66. package/src/lib/c3-pdf-dialog/c3-pdf-dialog.module.ts +12 -0
  67. package/src/lib/c3-rounded-title/c3-rounded-title.module.ts +12 -0
  68. package/src/lib/c3-safe-url/pipes/c3-safe-url.pipe.spec.ts +8 -0
  69. package/src/lib/c3-safe-url/pipes/c3-safe-url.pipe.ts +13 -0
  70. package/{lib → src/lib}/c3-styles/_c3-core.sass +4 -2
  71. package/src/lib/c3-tabs/c3-tabs.module.ts +12 -0
  72. package/{public-api.d.ts → src/public-api.ts} +20 -0
  73. package/tsconfig.lib.json +14 -0
  74. package/tsconfig.lib.prod.json +10 -0
  75. package/tsconfig.spec.json +14 -0
  76. package/esm2022/c3-components.mjs +0 -5
  77. package/esm2022/lib/c3-dialog/c3-dialog.module.mjs +0 -52
  78. package/esm2022/lib/c3-dialog/components/c3-dialog-confirm.component.mjs +0 -51
  79. package/esm2022/lib/c3-dialog/components/c3-dialog-embed-child.component.mjs +0 -32
  80. package/esm2022/lib/c3-dialog/components/c3-dialog-prompt.component.mjs +0 -95
  81. package/esm2022/lib/c3-dialog/services/c3-dialog.service.mjs +0 -79
  82. package/esm2022/lib/c3-dropdown/c3-dropdown.module.mjs +0 -20
  83. package/esm2022/lib/c3-dropdown/components/c3-dropdown.component.mjs +0 -45
  84. package/esm2022/lib/c3-dropdown/directives/c3-dropdown.trigger.mjs +0 -128
  85. package/esm2022/lib/c3-file-viewer/c3-file-viewer.module.mjs +0 -47
  86. package/esm2022/lib/c3-file-viewer/components/c3-file-viewer-actions/c3-file-viewer-actions.component.mjs +0 -17
  87. package/esm2022/lib/c3-file-viewer/components/c3-file-viewer-image/c3-file-viewer-image.component.mjs +0 -20
  88. package/esm2022/lib/c3-file-viewer/components/c3-file-viewer-pdf/c3-file-viewer-pdf.component.mjs +0 -23
  89. package/esm2022/lib/c3-file-viewer/components/c3-file-viewer-video/c3-file-viewer-video.component.mjs +0 -32
  90. package/esm2022/lib/c3-file-viewer/components/public/c3-file-viewer/c3-file-viewer.component.mjs +0 -86
  91. package/esm2022/lib/c3-file-viewer/components/public/c3-file-viewer-dialog/c3-file-viewer-dialog.component.mjs +0 -40
  92. package/esm2022/lib/c3-file-viewer/components/public/c3-file-viewer-dialog/c3-file-viewer-dialog.mjs +0 -26
  93. package/esm2022/lib/c3-file-viewer/consts/default.config.mjs +0 -40
  94. package/esm2022/lib/c3-file-viewer/directives/full-screen.directive.mjs +0 -66
  95. package/esm2022/lib/c3-file-viewer/models/custom-file-event.model.mjs +0 -7
  96. package/esm2022/lib/c3-file-viewer/models/file-metadata.mjs +0 -2
  97. package/esm2022/lib/c3-file-viewer/models/file-viewer-config.model.mjs +0 -2
  98. package/esm2022/lib/c3-file-viewer/models/file-viewer.mjs +0 -206
  99. package/esm2022/lib/c3-file-viewer/models/http.client.mjs +0 -2
  100. package/esm2022/lib/c3-safe-url/pipes/c3-safe-url.pipe.mjs +0 -21
  101. package/esm2022/public-api.mjs +0 -35
  102. package/fesm2022/c3-components.mjs +0 -1056
  103. package/fesm2022/c3-components.mjs.map +0 -1
  104. package/index.d.ts +0 -5
  105. package/lib/c3-dialog/c3-dialog.module.d.ts +0 -15
  106. package/lib/c3-dialog/components/c3-dialog-confirm.component.d.ts +0 -23
  107. package/lib/c3-dialog/components/c3-dialog-embed-child.component.d.ts +0 -18
  108. package/lib/c3-dialog/components/c3-dialog-prompt.component.d.ts +0 -31
  109. package/lib/c3-dialog/services/c3-dialog.service.d.ts +0 -19
  110. package/lib/c3-dropdown/c3-dropdown.module.d.ts +0 -10
  111. package/lib/c3-dropdown/components/c3-dropdown.component.d.ts +0 -15
  112. package/lib/c3-dropdown/directives/c3-dropdown.trigger.d.ts +0 -45
  113. package/lib/c3-file-viewer/c3-file-viewer.module.d.ts +0 -17
  114. package/lib/c3-file-viewer/components/c3-file-viewer-actions/c3-file-viewer-actions.component.d.ts +0 -8
  115. package/lib/c3-file-viewer/components/c3-file-viewer-image/c3-file-viewer-image.component.d.ts +0 -9
  116. package/lib/c3-file-viewer/components/c3-file-viewer-pdf/c3-file-viewer-pdf.component.d.ts +0 -9
  117. package/lib/c3-file-viewer/components/c3-file-viewer-video/c3-file-viewer-video.component.d.ts +0 -12
  118. package/lib/c3-file-viewer/components/public/c3-file-viewer/c3-file-viewer.component.d.ts +0 -25
  119. package/lib/c3-file-viewer/components/public/c3-file-viewer-dialog/c3-file-viewer-dialog.component.d.ts +0 -12
  120. package/lib/c3-file-viewer/components/public/c3-file-viewer-dialog/c3-file-viewer-dialog.d.ts +0 -8
  121. package/lib/c3-file-viewer/consts/default.config.d.ts +0 -2
  122. package/lib/c3-file-viewer/directives/full-screen.directive.d.ts +0 -12
  123. package/lib/c3-file-viewer/models/custom-file-event.model.d.ts +0 -5
  124. package/lib/c3-file-viewer/models/file-metadata.d.ts +0 -12
  125. package/lib/c3-file-viewer/models/file-viewer-config.model.d.ts +0 -48
  126. package/lib/c3-file-viewer/models/file-viewer.d.ts +0 -65
  127. package/lib/c3-file-viewer/models/http.client.d.ts +0 -14
  128. package/lib/c3-safe-url/pipes/c3-safe-url.pipe.d.ts +0 -10
  129. /package/{lib → src/lib}/c3-dropdown/styles/_c3-dropdown.sass +0 -0
  130. /package/{lib → src/lib}/c3-file-viewer/styles/_c3-file-viewer.sass +0 -0
  131. /package/{lib → src/lib}/c3-styles/_c3-root-variables.sass +0 -0
  132. /package/{lib → src/lib}/c3-styles/_utils.sass +0 -0
@@ -0,0 +1,41 @@
1
+ import { C3FileViewerConfig } from '../models/file-viewer-config.model';
2
+
3
+ export const DEFAULT_CONFIG: C3FileViewerConfig = {
4
+ btnContainerClass: 'btn-container',
5
+ btnClass: 'default',
6
+ btnSubClass: 'material-icons',
7
+ zoomFactor: 0.1,
8
+ containerBackgroundColor: '#00000000',
9
+ wheelZoom: false,
10
+ allowFullscreen: true,
11
+ allowKeyboardNavigation: true,
12
+ btnShow: {
13
+ zoomIn: true,
14
+ zoomOut: true,
15
+ rotateClockwise: true,
16
+ rotateCounterClockwise: true,
17
+ next: true,
18
+ prev: true,
19
+ reset: true,
20
+ },
21
+ btnIcons: {
22
+ zoomIn: {
23
+ text: 'zoom_in',
24
+ },
25
+ zoomOut: {
26
+ text: 'zoom_out',
27
+ },
28
+ rotateClockwise: {
29
+ text: 'rotate_right',
30
+ },
31
+ rotateCounterClockwise: {
32
+ text: 'rotate_left',
33
+ },
34
+ fullscreen: {
35
+ text: 'fullscreen',
36
+ },
37
+ reset: {
38
+ text: 'restore',
39
+ },
40
+ },
41
+ };
@@ -0,0 +1,11 @@
1
+ import { ElementRef } from '@angular/core';
2
+ import { FullScreenDirective } from './full-screen.directive';
3
+ import { TestBed } from '@angular/core/testing';
4
+
5
+ describe('FullScreenDirective', () => {
6
+ it('should create an instance', () => {
7
+ const el = TestBed.inject(ElementRef);
8
+ const directive = new FullScreenDirective(el);
9
+ expect(directive).toBeTruthy();
10
+ });
11
+ });
@@ -0,0 +1,68 @@
1
+ import { Directive, ElementRef, Input } from '@angular/core';
2
+ import { BehaviorSubject, debounceTime, filter, skip } from 'rxjs';
3
+
4
+ @Directive({
5
+ selector: '[C3FullScreen], [c3-full-screen]',
6
+ })
7
+ export class FullScreenDirective {
8
+ @Input('c3Screenfull')
9
+ set fullscreenState(value: Boolean | null) {
10
+ this._fullscreenState.next(value?.valueOf() || false);
11
+ }
12
+
13
+ @Input('c3-full-screen')
14
+ set fullscreenStateSetter(value: Boolean | null) {
15
+ this.fullscreenState = value;
16
+ }
17
+
18
+ private _fullscreenState = new BehaviorSubject(false);
19
+
20
+ constructor(private el: ElementRef) {
21
+ this._fullscreenState
22
+ .pipe(
23
+ filter((value) => value !== null),
24
+ skip(2),
25
+ debounceTime(100)
26
+ )
27
+ .subscribe(() => {
28
+ this.defineState();
29
+ });
30
+ }
31
+
32
+ private defineState() {
33
+ if (this._fullscreenState.getValue()) {
34
+ const element: any = this.el.nativeElement;
35
+
36
+ const requestMethod =
37
+ element.requestFullscreen ||
38
+ element.webkitRequestFullScreen ||
39
+ element.mozRequestFullScreen ||
40
+ element.msRequestFullScreen;
41
+
42
+ if (requestMethod) {
43
+ // Native full screen.
44
+ requestMethod.call(element);
45
+ } else {
46
+ console.log('FullScreen Request Method Not Supported on this browser.');
47
+ }
48
+ } else {
49
+ const element: any = document;
50
+
51
+ const requestMethod =
52
+ element.cancelFullscreen ||
53
+ element.webkitExitFullscreen ||
54
+ element.webkitCancelFullScreen ||
55
+ element.mozCancelFullScreen ||
56
+ element.msExitFullScreen;
57
+
58
+ if (requestMethod) {
59
+ // Native Cancel full screen.
60
+ requestMethod.call(element);
61
+ } else {
62
+ console.log(
63
+ 'FullScreen Cancel Request Method Not Supported on this browser.'
64
+ );
65
+ }
66
+ }
67
+ }
68
+ }
@@ -0,0 +1,9 @@
1
+ export class CustomFileEvent {
2
+ public name: string;
3
+ public fileUrl: string;
4
+
5
+ constructor(name: string, fileUrl: string) {
6
+ this.name = name;
7
+ this.fileUrl = fileUrl;
8
+ }
9
+ }
@@ -0,0 +1,13 @@
1
+ import { Observable } from 'rxjs';
2
+
3
+ export interface FileMetadata {
4
+ name: string;
5
+ size?: number;
6
+ type: string;
7
+ lastModified?: Date;
8
+ created?: Date;
9
+ extension?: string;
10
+ location: string;
11
+ objectUrl?: Observable<string>;
12
+ metadata?: Record<string, any>;
13
+ }
@@ -0,0 +1,53 @@
1
+ import { HttpClient } from '@angular/common/http';
2
+
3
+ export interface C3FileViewerConfig {
4
+ btnContainerClass?: string;
5
+ btnClass?: string;
6
+ btnSubClass?: string;
7
+ zoomFactor?: number;
8
+ containerBackgroundColor?: string;
9
+ wheelZoom?: boolean;
10
+ allowFullscreen?: boolean;
11
+ allowKeyboardNavigation?: boolean;
12
+ customClient?: HttpClient['get'];
13
+
14
+ minHeight?: number | string;
15
+ minWidth?: number | string;
16
+ width?: number | string;
17
+ maxHeight?: number | string;
18
+ height?: number | string;
19
+ maxWidth?: number | string;
20
+
21
+ btnShow?: {
22
+ zoomIn?: boolean;
23
+ zoomOut?: boolean;
24
+ rotateClockwise?: boolean;
25
+ rotateCounterClockwise?: boolean;
26
+ next?: boolean;
27
+ prev?: boolean;
28
+ reset?: boolean;
29
+ };
30
+
31
+ btnIcons?: {
32
+ zoomIn?: MultiBtn['btn'];
33
+ zoomOut?: MultiBtn['btn'];
34
+ rotateClockwise?: MultiBtn['btn'];
35
+ rotateCounterClockwise?: MultiBtn['btn'];
36
+ next?: MultiBtn['btn'];
37
+ prev?: MultiBtn['btn'];
38
+ fullscreen?: MultiBtn['btn'];
39
+ reset?: MultiBtn['btn'];
40
+ };
41
+
42
+ customBtns?: Array<{
43
+ name: string;
44
+ icon: MultiBtn['btn'];
45
+ }>;
46
+ }
47
+
48
+ interface MultiBtn {
49
+ btn: {
50
+ classes?: string;
51
+ text?: string;
52
+ };
53
+ }
@@ -0,0 +1,259 @@
1
+ import { BehaviorSubject, Observable, map, tap } from 'rxjs';
2
+ import { DEFAULT_CONFIG } from '../consts/default.config';
3
+ import { C3FileViewerConfig } from './file-viewer-config.model';
4
+ import { HttpClient } from '@angular/common/http';
5
+ import { CustomFileEvent } from './custom-file-event.model';
6
+ import { FileMetadata } from './file-metadata';
7
+ import { inject } from '@angular/core';
8
+
9
+ export class C3FileViewer {
10
+ private _config: C3FileViewerConfig = DEFAULT_CONFIG;
11
+ get config(): C3FileViewerConfig {
12
+ return this._config;
13
+ }
14
+
15
+ set config(value: C3FileViewerConfig) {
16
+ this._config = this.mergeConfig(DEFAULT_CONFIG, value);
17
+ this.config$.next(this._config);
18
+ }
19
+ public config$ = new BehaviorSubject<C3FileViewerConfig>(DEFAULT_CONFIG);
20
+
21
+ public fullscreen$ = new BehaviorSubject<Boolean>(false);
22
+
23
+ public customFile$ = new BehaviorSubject<any>(null);
24
+ public index$ = new BehaviorSubject<number>(0);
25
+ public loading: boolean = true;
26
+ public currentIndex: number = 0;
27
+
28
+ get currentFile(): FileMetadata {
29
+ return this.filesObjectUrl[this.currentIndex];
30
+ }
31
+
32
+ public style = {
33
+ transform: '',
34
+ msTransform: '',
35
+ oTransform: '',
36
+ webkitTransform: '',
37
+ minHeight: 'auto',
38
+ maxHeight: 'auto',
39
+ height: 'auto',
40
+ minWidth: 'auto',
41
+ maxWidth: 'auto',
42
+ width: 'auto',
43
+ };
44
+ public styleHeight = '100%';
45
+ public hovered = false;
46
+
47
+ public set files(value: FileMetadata[]) {
48
+ this._files = value;
49
+ this.currentIndex = 0;
50
+ this.index$.next(this.currentIndex);
51
+
52
+ this.filesObjectUrl = value.map((file) => {
53
+ return {
54
+ ...file,
55
+ objectUrl: file.objectUrl || this.createObjectURL(file),
56
+ };
57
+ });
58
+ }
59
+
60
+ public get files(): FileMetadata[] {
61
+ return this._files;
62
+ }
63
+
64
+ private _files: FileMetadata[] = [];
65
+
66
+ public filesObjectUrl: Array<
67
+ FileMetadata & {
68
+ objectUrl?: Observable<string>;
69
+ }
70
+ > = [];
71
+
72
+ private scale = 1;
73
+ private rotation = 0;
74
+ private translateX = 0;
75
+ private translateY = 0;
76
+ private prevX: number = 0;
77
+ private prevY: number = 0;
78
+
79
+ constructor({
80
+ config,
81
+ files,
82
+ }: {
83
+ config?: C3FileViewerConfig;
84
+ files?: FileMetadata[];
85
+ }) {
86
+ if (config) this.config = config;
87
+ if (files) this.files = files;
88
+
89
+ this.config$.subscribe((config) => {
90
+ const { minHeight, maxHeight, minWidth, maxWidth, height, width } =
91
+ config;
92
+ this.style.minHeight = this.valueToCss(minHeight);
93
+ this.style.height = this.valueToCss(height);
94
+ this.style.width = this.valueToCss(width);
95
+ this.style.maxHeight = this.valueToCss(maxHeight);
96
+ this.style.minWidth = this.valueToCss(minWidth);
97
+ this.style.maxWidth = this.valueToCss(maxWidth);
98
+ this.styleHeight = this.valueToCss(height);
99
+
100
+ this.updateStyle();
101
+ });
102
+ }
103
+
104
+ createObjectURL(file: FileMetadata) {
105
+ this.onLoadStart(file);
106
+ return this.getFile(file.location).pipe(
107
+ map((response) => URL.createObjectURL(response)),
108
+ tap(() => this.onLoad(file))
109
+ );
110
+ }
111
+
112
+ getFile(location: string) {
113
+ const client =
114
+ this.config.customClient ||
115
+ inject(HttpClient).get.bind(inject(HttpClient));
116
+ if (!client) {
117
+ throw new Error(
118
+ 'No http client provided. Please provide a custom client or import HttpClientModule'
119
+ );
120
+ }
121
+
122
+ return client(location, {
123
+ responseType: 'blob',
124
+ });
125
+ }
126
+
127
+ previousImage(event: KeyboardEvent | MouseEvent) {
128
+ if (this.canNavigate(event)) {
129
+ this.loading = true;
130
+ if (this.currentIndex > 0) this.currentIndex--;
131
+ else this.currentIndex = this.files.length - 1;
132
+ this.index$.next(this.currentIndex);
133
+ this.reset();
134
+ }
135
+ }
136
+
137
+ nextImage(event: KeyboardEvent | MouseEvent) {
138
+ if (this.canNavigate(event)) {
139
+ this.loading = true;
140
+ if (this.currentIndex < this.files.length - 1) this.currentIndex++;
141
+ else this.currentIndex = 0;
142
+ this.index$.next(this.currentIndex);
143
+ this.reset();
144
+ }
145
+ }
146
+
147
+ zoomIn() {
148
+ this.scale *= 1 + (this.config.zoomFactor || 0);
149
+ this.updateStyle();
150
+ }
151
+
152
+ zoomOut() {
153
+ if (this.scale > (this.config.zoomFactor || 0)) {
154
+ this.scale /= 1 + (this.config.zoomFactor || 0);
155
+ }
156
+ this.updateStyle();
157
+ }
158
+
159
+ scrollZoom(evt: WheelEvent) {
160
+ if (this.config.wheelZoom) {
161
+ evt.deltaY > 0 ? this.zoomOut() : this.zoomIn();
162
+ return false;
163
+ } else {
164
+ return true;
165
+ }
166
+ }
167
+
168
+ rotateClockwise() {
169
+ this.rotation += 90;
170
+ this.updateStyle();
171
+ }
172
+
173
+ rotateCounterClockwise() {
174
+ this.rotation -= 90;
175
+ this.updateStyle();
176
+ }
177
+
178
+ onLoad(file: FileMetadata) {
179
+ this.loading = false;
180
+ }
181
+
182
+ onLoadStart(file: FileMetadata) {
183
+ this.loading = true;
184
+ }
185
+
186
+ imageNotFound(file: FileMetadata) {
187
+ this.loading = false;
188
+ this.customFile$.next(new CustomFileEvent('imageNotFound', file.location));
189
+ }
190
+
191
+ onDragOver(evt: DragEvent) {
192
+ this.translateX += evt.clientX - this.prevX;
193
+ this.translateY += evt.clientY - this.prevY;
194
+ this.prevX = evt.clientX;
195
+ this.prevY = evt.clientY;
196
+ this.updateStyle();
197
+ }
198
+
199
+ onDragStart(evt: DragEvent) {
200
+ if (evt.target && evt.dataTransfer && evt.dataTransfer.setDragImage) {
201
+ const target = evt.target as HTMLDivElement;
202
+ const nextElementSibling = target.nextElementSibling as HTMLDivElement;
203
+
204
+ if (nextElementSibling)
205
+ evt.dataTransfer.setDragImage(nextElementSibling, 0, 0);
206
+ }
207
+ this.prevX = evt.clientX;
208
+ this.prevY = evt.clientY;
209
+ }
210
+
211
+ toggleFullscreen() {
212
+ const fullScreenValue = this.fullscreen$.getValue();
213
+ this.fullscreen$.next(!fullScreenValue);
214
+ if (fullScreenValue) this.reset();
215
+ }
216
+
217
+ reset() {
218
+ this.scale = 1;
219
+ this.rotation = 0;
220
+ this.translateX = 0;
221
+ this.translateY = 0;
222
+ this.updateStyle();
223
+ }
224
+
225
+ private canNavigate(event: any) {
226
+ return (
227
+ event == null || (this.config.allowKeyboardNavigation && this.hovered)
228
+ );
229
+ }
230
+
231
+ private updateStyle() {
232
+ this.style.transform = `translate(${this.translateX}px, ${this.translateY}px) rotate(${this.rotation}deg) scale(${this.scale})`;
233
+ this.style.msTransform = this.style.transform;
234
+ this.style.webkitTransform = this.style.transform;
235
+ this.style.oTransform = this.style.transform;
236
+ }
237
+
238
+ private valueToCss(value: number | string | undefined) {
239
+ return value ? (typeof value === 'string' ? value : value + 'px') : 'auto';
240
+ }
241
+
242
+ private mergeConfig(
243
+ defaultValues: C3FileViewerConfig,
244
+ overrideValues: C3FileViewerConfig
245
+ ): C3FileViewerConfig {
246
+ let result: C3FileViewerConfig = { ...defaultValues };
247
+ if (overrideValues) {
248
+ result = { ...defaultValues, ...overrideValues };
249
+
250
+ if (overrideValues.btnIcons) {
251
+ result.btnIcons = {
252
+ ...defaultValues.btnIcons,
253
+ ...overrideValues.btnIcons,
254
+ };
255
+ }
256
+ }
257
+ return result;
258
+ }
259
+ }
@@ -0,0 +1,23 @@
1
+ import { HttpContext, HttpHeaders, HttpParams } from '@angular/common/http';
2
+
3
+ export interface HttpClientOptions {
4
+ headers?:
5
+ | HttpHeaders
6
+ | {
7
+ [header: string]: string | string[];
8
+ };
9
+ context?: HttpContext;
10
+ observe?: 'body';
11
+ params?:
12
+ | HttpParams
13
+ | {
14
+ [param: string]:
15
+ | string
16
+ | number
17
+ | boolean
18
+ | ReadonlyArray<string | number | boolean>;
19
+ };
20
+ reportProgress?: boolean;
21
+ responseType: 'blob';
22
+ withCredentials?: boolean;
23
+ }
@@ -0,0 +1,12 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+
4
+
5
+
6
+ @NgModule({
7
+ declarations: [],
8
+ imports: [
9
+ CommonModule
10
+ ]
11
+ })
12
+ export class C3HighlightTextModule { }
@@ -0,0 +1,12 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+
4
+
5
+
6
+ @NgModule({
7
+ declarations: [],
8
+ imports: [
9
+ CommonModule
10
+ ]
11
+ })
12
+ export class C3MenuModule { }
@@ -0,0 +1,12 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+
4
+
5
+
6
+ @NgModule({
7
+ declarations: [],
8
+ imports: [
9
+ CommonModule
10
+ ]
11
+ })
12
+ export class C3ModalModule { }
@@ -0,0 +1,12 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+
4
+
5
+
6
+ @NgModule({
7
+ declarations: [],
8
+ imports: [
9
+ CommonModule
10
+ ]
11
+ })
12
+ export class C3NavbarModule { }
@@ -0,0 +1,12 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+
4
+
5
+
6
+ @NgModule({
7
+ declarations: [],
8
+ imports: [
9
+ CommonModule
10
+ ]
11
+ })
12
+ export class C3PdfDialogModule { }
@@ -0,0 +1,12 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+
4
+
5
+
6
+ @NgModule({
7
+ declarations: [],
8
+ imports: [
9
+ CommonModule
10
+ ]
11
+ })
12
+ export class C3RoundedTitleModule { }
@@ -0,0 +1,8 @@
1
+ import { C3SafeUrlPipe } from './c3-safe-url.pipe';
2
+
3
+ describe('C3SafeUrlPipe', () => {
4
+ it('create an instance', () => {
5
+ const pipe = new C3SafeUrlPipe();
6
+ expect(pipe).toBeTruthy();
7
+ });
8
+ });
@@ -0,0 +1,13 @@
1
+ import { Pipe, PipeTransform } from '@angular/core';
2
+ import { DomSanitizer } from '@angular/platform-browser';
3
+
4
+ @Pipe({
5
+ name: 'c3SafeUrl',
6
+ standalone: true,
7
+ })
8
+ export class C3SafeUrlPipe implements PipeTransform {
9
+ constructor(private sanitizer: DomSanitizer) {}
10
+ transform(url: string | null) {
11
+ return url ? this.sanitizer.bypassSecurityTrustResourceUrl(url) : '';
12
+ }
13
+ }
@@ -1,8 +1,10 @@
1
1
  @use "./c3-root-variables" as *
2
2
  @use "../c3-dropdown/styles/_c3-dropdown" as *
3
- @use "../c3-file-viewer/styles/_c3-file-viewer" as *
3
+ // @use "../c3-file-viewer/styles/_c3-file-viewer" as *
4
+ @use "../c3-expansion/styles/_c3-expansion" as *
4
5
 
5
6
  =c3-core($theme)
6
7
  @include c3-root-variables($theme)
7
8
  @include c3-material-dropdown($theme)
8
- @include c3-file-viewer($theme)
9
+ // @include c3-file-viewer($theme)
10
+ @include c3-expansion($theme)
@@ -0,0 +1,12 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+
4
+
5
+
6
+ @NgModule({
7
+ declarations: [],
8
+ imports: [
9
+ CommonModule
10
+ ]
11
+ })
12
+ export class C3TabsModule { }
@@ -1,10 +1,16 @@
1
+ /*
2
+ * Public API Surface of c3-components
3
+ */
4
+
1
5
  export * from './lib/c3-file-viewer/models/http.client';
6
+
2
7
  /**
3
8
  * Dropdown
4
9
  */
5
10
  export * from './lib/c3-dropdown/components/c3-dropdown.component';
6
11
  export * from './lib/c3-dropdown/directives/c3-dropdown.trigger';
7
12
  export * from './lib/c3-dropdown/c3-dropdown.module';
13
+
8
14
  /**
9
15
  * Dialog
10
16
  */
@@ -13,6 +19,7 @@ export * from './lib/c3-dialog/components/c3-dialog-prompt.component';
13
19
  export * from './lib/c3-dialog/components/c3-dialog-embed-child.component';
14
20
  export * from './lib/c3-dialog/services/c3-dialog.service';
15
21
  export * from './lib/c3-dialog/c3-dialog.module';
22
+
16
23
  /**
17
24
  * File Viewer
18
25
  */
@@ -25,7 +32,20 @@ export * from './lib/c3-file-viewer/models/file-viewer-config.model';
25
32
  export * from './lib/c3-file-viewer/models/file-viewer';
26
33
  export * from './lib/c3-file-viewer/models/file-metadata';
27
34
  export * from './lib/c3-file-viewer/c3-file-viewer.module';
35
+
28
36
  /**
29
37
  * Safe Url
30
38
  */
31
39
  export * from './lib/c3-safe-url/pipes/c3-safe-url.pipe';
40
+
41
+ /**
42
+ * Expansion
43
+ */
44
+ export * from './lib/c3-expansion/c3-expansion.module';
45
+ export * from './lib/c3-expansion/components/c3-expansion/c3-expansion.component';
46
+ export * from './lib/c3-expansion/components/c3-expansion-header/c3-expansion-header.component';
47
+
48
+ /**
49
+ * Auto Animate
50
+ */
51
+ export * from './lib/c3-auto-animate/C3AutoAnimate.directive';
@@ -0,0 +1,14 @@
1
+ /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+ {
3
+ "extends": "../../tsconfig.json",
4
+ "compilerOptions": {
5
+ "outDir": "../../out-tsc/lib",
6
+ "declaration": true,
7
+ "declarationMap": true,
8
+ "inlineSources": true,
9
+ "types": []
10
+ },
11
+ "exclude": [
12
+ "**/*.spec.ts"
13
+ ]
14
+ }
@@ -0,0 +1,10 @@
1
+ /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+ {
3
+ "extends": "./tsconfig.lib.json",
4
+ "compilerOptions": {
5
+ "declarationMap": false
6
+ },
7
+ "angularCompilerOptions": {
8
+ "compilationMode": "partial"
9
+ }
10
+ }