@libs-ui/components-gallery 0.2.10-6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,315 @@
1
+ import * as i0 from '@angular/core';
2
+ import { signal, input, model, output, viewChild, viewChildren, effect, untracked, Component, ChangeDetectionStrategy } from '@angular/core';
3
+ import { Subject, fromEvent, takeUntil } from 'rxjs';
4
+ import { viewDataNumberByLanguage } from '@libs-ui/utils';
5
+ import { LibsUiComponentsPopoverComponent } from '@libs-ui/components-popover';
6
+ import * as i1 from '@ngx-translate/core';
7
+ import { TranslateModule } from '@ngx-translate/core';
8
+
9
+ /* eslint-disable @typescript-eslint/no-explicit-any */
10
+ class LibsUiComponentsGalleryViewerComponent {
11
+ /* PROPERTY */
12
+ indexSelected = signal(0);
13
+ scaleValue = signal(1);
14
+ ratio = signal('100%');
15
+ fullScreen = signal(false);
16
+ isShowButton = signal(false);
17
+ disable = signal(true);
18
+ hoverContentViewImage = signal(false);
19
+ // private imagesElementRef = signal<Array<ElementRef>>([]);
20
+ step = signal(0.1);
21
+ draggableEl = signal(null);
22
+ widthDefault = signal(0);
23
+ heightDefault = signal(0);
24
+ viewPort = signal(undefined);
25
+ canDrag = signal(false);
26
+ widthImage = signal(0);
27
+ isFirstRender = signal(false);
28
+ timeouts = signal([]);
29
+ onDestroy = new Subject();
30
+ /* INPUT */
31
+ images = input.required();
32
+ fieldDisplaySrcImage = input.required();
33
+ imageSelected = model();
34
+ removeBackdrop = input();
35
+ zIndex = input(1200);
36
+ singleImage = input(false);
37
+ /* OUTPUT */
38
+ outClose = output();
39
+ /* VIEW CHILD */
40
+ containerRef = viewChild('containerRef');
41
+ singleImageRef = viewChild('singleImageRef');
42
+ elementRatioRef = viewChild('elementRatioRef');
43
+ fullContainerRef = viewChild('fullContainerRef');
44
+ imagesRef = viewChildren('imagesRef');
45
+ constructor() {
46
+ effect(() => {
47
+ if (this.singleImage()) {
48
+ return;
49
+ }
50
+ const indexSelected = this.images().findIndex(item => item[this.fieldDisplaySrcImage()] === this.imageSelected()?.[this.fieldDisplaySrcImage()]);
51
+ untracked(() => {
52
+ this.indexSelected.set(indexSelected);
53
+ this.createTimeout((id) => {
54
+ clearTimeout(id);
55
+ this.imagesRef()[this.indexSelected()].nativeElement.scrollIntoView();
56
+ }, 100);
57
+ });
58
+ });
59
+ }
60
+ ngAfterViewInit() {
61
+ fromEvent(document, 'keyup').pipe(takeUntil(this.onDestroy)).subscribe((event) => {
62
+ event.stopPropagation();
63
+ if (event.key === 'ArrowLeft') {
64
+ this.handlerPreviousImage(event);
65
+ return;
66
+ }
67
+ if (event.key === 'ArrowRight') {
68
+ this.handlerNextImage(event);
69
+ return;
70
+ }
71
+ });
72
+ this.isFirstRender.set(true);
73
+ fromEvent(window, 'resize').pipe(takeUntil(this.onDestroy)).subscribe(this.setWidthImages.bind(this));
74
+ this.createTimeout((id) => {
75
+ clearTimeout(id);
76
+ this.setWidthImages();
77
+ }, 300);
78
+ }
79
+ /* FUNCTIONS */
80
+ setWidthImages() {
81
+ if (!this.fullScreen()) {
82
+ this.imagesRef().forEach(image => {
83
+ image.nativeElement.style.width = image.nativeElement.getBoundingClientRect().height + 'px';
84
+ });
85
+ }
86
+ const singleImageRef = this.singleImageRef();
87
+ if (singleImageRef) {
88
+ singleImageRef.nativeElement.style.width = '';
89
+ singleImageRef.nativeElement.style.height = '';
90
+ }
91
+ this.viewPort.set(this.containerRef()?.nativeElement.getBoundingClientRect());
92
+ const img = new Image();
93
+ img.src = this.imageSelected()?.[this.fieldDisplaySrcImage()];
94
+ img.onload = () => {
95
+ this.widthDefault.set(img.naturalWidth);
96
+ this.heightDefault.set(img.naturalHeight);
97
+ this.widthImage.set(this.singleImageRef()?.nativeElement.width);
98
+ this.setStyleSelectImage();
99
+ };
100
+ }
101
+ handlerImageError(e, image) {
102
+ const event = e;
103
+ event.stopPropagation();
104
+ image['isError'] = true;
105
+ }
106
+ handlerShowButton(isShow) {
107
+ this.isShowButton.set(isShow);
108
+ }
109
+ handlerMouseEvent(event, status) {
110
+ event.stopPropagation();
111
+ this.hoverContentViewImage.set(status);
112
+ }
113
+ handlerClosePopup(e) {
114
+ e.stopPropagation();
115
+ this.outClose.emit();
116
+ }
117
+ handlerZoom(event, type) {
118
+ event.stopPropagation();
119
+ this.isFirstRender.set(false);
120
+ this.disable.set(false);
121
+ const element = this.singleImageRef()?.nativeElement;
122
+ if (!element) {
123
+ return;
124
+ }
125
+ const draggableEl = this.makeElementDraggable({
126
+ element: element,
127
+ isOverflowHiddenDesired: true,
128
+ });
129
+ this.draggableEl.set(draggableEl);
130
+ if (this.scaleValue() * this.widthDefault() / this.widthImage() * 100 < 1) {
131
+ this.scaleValue.set(1 / 100 * this.widthImage() / this.widthDefault());
132
+ }
133
+ if (this.scaleValue() * this.widthDefault() / this.widthImage() * 100 > 5000 * 0.9) {
134
+ this.scaleValue.set(5000 * 0.9 / 100 * this.widthImage() / this.widthDefault());
135
+ }
136
+ if (type === 'in') {
137
+ const scaleValue = this.scaleValue() * (1 + this.step());
138
+ this.scaleValue.set(scaleValue);
139
+ }
140
+ if (type === 'out') {
141
+ const scaleValue = this.scaleValue() / (1 + this.step());
142
+ this.scaleValue.set(scaleValue);
143
+ }
144
+ this.setWidthHeight(element);
145
+ element.style.position = `absolute`;
146
+ if (!this.canDrag && this.draggableEl() && this.draggableEl()?.stopDraggableBehavior) {
147
+ this.draggableEl()?.stopDraggableBehavior?.();
148
+ }
149
+ }
150
+ handlerNextImage(e) {
151
+ const indexSelected = this.indexSelected() + 1;
152
+ this.handlerSelectImage(e, this.images()[indexSelected], indexSelected);
153
+ }
154
+ handlerPreviousImage(e) {
155
+ const indexSelected = this.indexSelected() - 1;
156
+ this.handlerSelectImage(e, this.images()[indexSelected], indexSelected);
157
+ }
158
+ handlerSelectImage(e, imageSelected, indexSelected) {
159
+ e.stopPropagation();
160
+ if (!imageSelected) {
161
+ return;
162
+ }
163
+ this.isFirstRender.set(true);
164
+ const elementRatio = this.elementRatioRef()?.nativeElement;
165
+ if (elementRatio) {
166
+ elementRatio.style.display = 'none';
167
+ }
168
+ this.imageSelected.set(imageSelected);
169
+ this.indexSelected.set(indexSelected);
170
+ this.scaleValue.set(1);
171
+ this.imagesRef()[indexSelected].nativeElement.scrollIntoView();
172
+ this.setWidthImages();
173
+ }
174
+ handlerFullScreen() {
175
+ this.createTimeout((id) => {
176
+ clearTimeout(id);
177
+ this.disable.set(true);
178
+ const element = this.singleImageRef()?.nativeElement;
179
+ const fullElement = this.fullContainerRef()?.nativeElement;
180
+ this.fullScreen.set(!this.fullScreen());
181
+ if (!fullElement) {
182
+ return;
183
+ }
184
+ if (this.fullScreen()) {
185
+ fullElement.style.width = '95%';
186
+ fullElement.style.height = '95%';
187
+ }
188
+ if (!this.fullScreen()) {
189
+ fullElement.style.width = '80%';
190
+ fullElement.style.height = '90%';
191
+ }
192
+ this.viewPort.set(this.containerRef()?.nativeElement.getBoundingClientRect());
193
+ if (!element) {
194
+ return;
195
+ }
196
+ this.setStyleSelectImage(true);
197
+ element.style.left = `unset`;
198
+ element.style.top = `unset`;
199
+ }, 0);
200
+ }
201
+ handlerReset() {
202
+ this.disable.set(true);
203
+ this.setStyleSelectImage(true);
204
+ }
205
+ makeElementDraggable = ({ element, DRAGGABLE_CSS_CLASS = 'draggable-element', }) => {
206
+ if (!element) {
207
+ return null;
208
+ }
209
+ const isTheRequiredCSSAlreadyInPlace = !!Array.from(element.ownerDocument.getElementsByTagName('style')).filter((styleEl) => styleEl?.textContent?.includes(`.${DRAGGABLE_CSS_CLASS}`))?.[0];
210
+ if (!isTheRequiredCSSAlreadyInPlace) {
211
+ element.ownerDocument.body.appendChild(Object.assign(element.ownerDocument.createElement('style'), {
212
+ textContent: `
213
+ .${DRAGGABLE_CSS_CLASS} {
214
+ position: absolute;
215
+ cursor: grabbing !important;
216
+ }
217
+ `,
218
+ }));
219
+ }
220
+ if (!element.classList.contains(DRAGGABLE_CSS_CLASS)) {
221
+ element.classList.add(DRAGGABLE_CSS_CLASS);
222
+ }
223
+ element.onmousedown = (mouseDownEvent) => {
224
+ mouseDownEvent.preventDefault();
225
+ element.onmousemove = (mouseMoveEvent) => {
226
+ mouseMoveEvent.preventDefault();
227
+ const rectElement = element.getBoundingClientRect();
228
+ if (rectElement.left + rectElement.width + mouseMoveEvent.movementX > (this.viewPort()?.width || 0) + (this.viewPort()?.left || 0) && rectElement.left + mouseMoveEvent.movementX < (this.viewPort()?.left || 0)) {
229
+ element.style.left = `${element.offsetLeft + mouseMoveEvent.movementX}px`;
230
+ }
231
+ if (rectElement.top + rectElement.height + mouseMoveEvent.movementY > (this.viewPort()?.height || 0) + (this.viewPort()?.top || 0) && rectElement.top + mouseMoveEvent.movementY < (this.viewPort()?.top || 0)) {
232
+ element.style.top = `${element.offsetTop + mouseMoveEvent.movementY}px`;
233
+ }
234
+ };
235
+ };
236
+ element.ownerDocument.onmouseup = (mouseUpEvent) => {
237
+ mouseUpEvent.preventDefault();
238
+ element.onmousemove = null;
239
+ };
240
+ return Object.assign(element, {
241
+ stopDraggableBehavior() {
242
+ element.classList.remove(DRAGGABLE_CSS_CLASS);
243
+ element.onmousedown = null;
244
+ element.onmousemove = null;
245
+ element.onmouseup = null;
246
+ element.style.left = 'unset';
247
+ element.style.top = 'unset';
248
+ return element;
249
+ },
250
+ });
251
+ };
252
+ setStyleSelectImage(reset) {
253
+ const element = this.singleImageRef()?.nativeElement;
254
+ if (!element) {
255
+ return;
256
+ }
257
+ const scaleValue = (((this.viewPort()?.width || 0) / this.widthDefault()) < ((this.viewPort()?.height || 0) - (this.singleImage() ? 0 : 40)) / this.heightDefault()) ? ((this.viewPort()?.width || 0) / this.widthDefault()) : ((this.viewPort()?.height || 0) - (this.singleImage() ? 0 : 40)) / this.heightDefault();
258
+ this.scaleValue.set(scaleValue);
259
+ if (this.scaleValue() > 1 && (reset || this.isFirstRender()) && !this.fullScreen()) {
260
+ this.scaleValue.set(1);
261
+ }
262
+ this.setWidthHeight(element);
263
+ if (this.fullScreen()) {
264
+ element.style.position = `unset`;
265
+ return;
266
+ }
267
+ }
268
+ setWidthHeight(element) {
269
+ element.style.width = `${this.scaleValue() * this.widthDefault()}px`;
270
+ element.style.height = `${this.scaleValue() * this.heightDefault()}px`;
271
+ this.canDrag.set(false);
272
+ const rectElement = element.getBoundingClientRect();
273
+ if ((rectElement.width > (this.viewPort()?.width || 0)) || (rectElement.height > (this.viewPort()?.height || 0))) {
274
+ this.canDrag.set(true);
275
+ }
276
+ if (rectElement.left + rectElement.width < (this.viewPort()?.width || 0) + (this.viewPort()?.left || 0) || rectElement.left > (this.viewPort()?.left || 0)) {
277
+ element.style.left = `unset`;
278
+ }
279
+ if (rectElement.top + rectElement.height < (this.viewPort()?.top || 0) + (this.viewPort()?.height || 0) || rectElement.top > (this.viewPort()?.top || 0)) {
280
+ element.style.top = `unset`;
281
+ }
282
+ this.setDisplayRatio();
283
+ }
284
+ setDisplayRatio() {
285
+ const element = this.singleImageRef()?.nativeElement;
286
+ this.ratio.set(`${viewDataNumberByLanguage(element.width / this.widthDefault() * 100, false, 0)}%`);
287
+ const elementRatio = this.elementRatioRef()?.nativeElement;
288
+ elementRatio.style.display = 'flex';
289
+ this.createTimeout((id) => {
290
+ clearTimeout(id);
291
+ elementRatio.style.display = 'none';
292
+ }, 1000);
293
+ }
294
+ createTimeout(callback, delay) {
295
+ const timeoutId = setTimeout(() => callback(timeoutId), delay);
296
+ this.timeouts.update(ids => [...ids, timeoutId]);
297
+ }
298
+ ngOnDestroy() {
299
+ this.timeouts().forEach(item => clearTimeout(item));
300
+ this.onDestroy.next();
301
+ this.onDestroy.complete();
302
+ }
303
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsGalleryViewerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
304
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: LibsUiComponentsGalleryViewerComponent, isStandalone: true, selector: "libs_ui-components-gallery-viewer", inputs: { images: { classPropertyName: "images", publicName: "images", isSignal: true, isRequired: true, transformFunction: null }, fieldDisplaySrcImage: { classPropertyName: "fieldDisplaySrcImage", publicName: "fieldDisplaySrcImage", isSignal: true, isRequired: true, transformFunction: null }, imageSelected: { classPropertyName: "imageSelected", publicName: "imageSelected", isSignal: true, isRequired: false, transformFunction: null }, removeBackdrop: { classPropertyName: "removeBackdrop", publicName: "removeBackdrop", isSignal: true, isRequired: false, transformFunction: null }, zIndex: { classPropertyName: "zIndex", publicName: "zIndex", isSignal: true, isRequired: false, transformFunction: null }, singleImage: { classPropertyName: "singleImage", publicName: "singleImage", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { imageSelected: "imageSelectedChange", outClose: "outClose" }, viewQueries: [{ propertyName: "containerRef", first: true, predicate: ["containerRef"], descendants: true, isSignal: true }, { propertyName: "singleImageRef", first: true, predicate: ["singleImageRef"], descendants: true, isSignal: true }, { propertyName: "elementRatioRef", first: true, predicate: ["elementRatioRef"], descendants: true, isSignal: true }, { propertyName: "fullContainerRef", first: true, predicate: ["fullContainerRef"], descendants: true, isSignal: true }, { propertyName: "imagesRef", predicate: ["imagesRef"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (images() || singleImage()) {\n <div class=\"libs-ui-gallery-img-popup\"\n [class.bg-[transparent]]=\"removeBackdrop()\"\n [style.zIndex]=\"zIndex()\">\n <div #fullContainerRef\n class=\"libs-ui-gallery-img-popup-container\">\n <div class=\"flex justify-end mb-[16px] z-10\">\n <i class=\"libs-ui-icon-close text-[24px] text-[#ffffff] cursor-pointer\"\n (click)=\"handlerClosePopup($event)\"></i>\n </div>\n <div class=\"relative w-full h-full\">\n <div class=\"flex flex-col w-full h-full justify-between\">\n <div class=\"libs-ui-gallery-img-popup-container-preview w-full h-full\">\n <div class=\"flex flex-col w-full h-full relative\"\n (mouseenter)=\"handlerShowButton(true)\"\n (mouseleave)=\"handlerShowButton(false)\">\n <div #containerRef\n class=\"flex w-full h-full relative\">\n <div class=\"absolute flex items-center justify-center w-full h-full overflow-hidden\"\n (mouseenter)=\"handlerMouseEvent($event, true)\"\n (mouseleave)=\"handlerMouseEvent($event,false)\">\n @if (fieldDisplaySrcImage() && imageSelected(); as imageSelected) {\n <img #singleImageRef\n [src]=\"imageSelected[fieldDisplaySrcImage()]\"\n class=\"flex m-[auto]\"\n (error)=\"handlerImageError($event, imageSelected)\" />\n }\n <div #elementRatioRef\n class=\"libs-ui-gallery-img-popup-container-preview-ratio items-center justify-center libs-ui-font-h5m text-[#e6e7ea] w-[80px] h-[34px] rounded-[4px] absolute top-[50%] left-[50%]\">\n {{ ratio() }}\n </div>\n </div>\n </div>\n @if (!imageSelected()?.['error']) {\n <div class=\"relative w-full\"\n (mouseenter)=\"handlerMouseEvent($event, true)\"\n [class.hidden]=\"!hoverContentViewImage()\">\n <div class=\"flex w-full justify-center libs-ui-font-h5r absolute z-10 top-[-44px]\">\n <libs_ui-components-popover [config]=\"{content: 'i18n_zoom_out', direction: 'top', zIndex:1300}\">\n <div class=\"libs-ui-gallery-img-popup-container-preview-button rounded-l-[8px]\"\n (click)=\"handlerZoom($event,'out')\">\n <div class=\"w-[16px] h-[16px] p-[1px] \">\n <div class=\"border-[#ffffff] border-[1px] rounded-[50%] text-[#ffffff] flex items-center justify-center text-[14px] w-full h-full\">-</div>\n </div>\n </div>\n </libs_ui-components-popover>\n <libs_ui-components-popover [config]=\"{content: 'i18n_zoom_in', direction: 'top', zIndex:1300}\">\n <div class=\"libs-ui-gallery-img-popup-container-preview-button\"\n (click)=\"handlerZoom($event,'in')\">\n <div class=\"w-[16px] h-[16px] p-[1px] \">\n <div class=\"border-[#ffffff] border-[1px] rounded-[50%] text-[#ffffff] flex items-center justify-center text-[12px] w-full h-full\">+</div>\n </div>\n </div>\n </libs_ui-components-popover>\n <libs_ui-components-popover [config]=\"{content: fullScreen() ? 'i18n_action_exit_full_screen' : 'i18n_action_view_full_screen', direction: 'top', zIndex:1300}\">\n <div class=\"libs-ui-gallery-img-popup-container-preview-button\"\n (click)=\"handlerFullScreen()\">\n <i class=\"{{ fullScreen() ? 'libs-ui-icon-fullscreen-exit' : 'libs-ui-icon-fullscreen-open' }} text-[#ffffff] text-[16px]\"></i>\n </div>\n </libs_ui-components-popover>\n <div class=\"libs-ui-gallery-img-popup-container-preview-button rounded-r-[8px] border-l border-l-1 border-[#5d636b] flex items-center\"\n (click)=\"handlerReset()\">\n <i class=\"libs-ui-icon-refresh text-16px mr-[8px]\"\n [class.text-[#ffffff]]=\"!disable()\"\n [class.text-[#6a7383]]=\"disable()\"></i>\n <div class=\"libs-ui-font-h5r\"\n [class.text-[#ffffff]]=\"!disable()\"\n [class.text-[#6a7383]]=\"disable()\">{{ 'i18n_restore' | translate }}</div>\n </div>\n </div>\n </div>\n }\n @if (!singleImage()) {\n <div class=\"flex justify-center libs-ui-font-h5r text-[#ffffff] mt-[12px]\">\n @if (fullScreen()) {\n <div class=\"mr-[16px] flex items-center\">\n <div class=\"rotate-180\"\n [class.cursor-pointer]=\"indexSelected() !== 0\"\n [class.pointer-events-none]=\"indexSelected() === 0\"\n (click)=\"handlerPreviousImage($event)\">\n <i class=\"text-[24px] cursor-pointer text-[#ffffff] libs-ui-icon-chevron-right\"\n [class.libs-ui-disable]=\"indexSelected() === 0\"></i>\n </div>\n </div>\n }\n <div class=\"flex aitems-center\">\n {{ indexSelected()+1 }}/{{ images().length }}\n </div>\n\n @if (fullScreen()) {\n <div class=\"ml-[16px] flex items-center\">\n <div [class.cursor-pointer]=\"indexSelected() !== images().length - 1\"\n [class.pointer-events-none]=\"indexSelected() === images().length - 1\"\n (click)=\"handlerNextImage($event)\">\n <i class=\"text-[24px] cursor-pointer text-[#ffffff] libs-ui-icon-chevron-right\"\n [class.libs-ui-disable]=\"indexSelected() ===images().length - 1\"></i>\n </div>\n </div>\n }\n </div>\n }\n </div>\n </div>\n\n @if (!singleImage()) {\n <div class=\"libs-ui-gallery-img-popup-container-list px-[32px] mt-[24px] flex\"\n [class.!hidden]=\"fullScreen()\">\n <div class=\"mr-[24px] flex items-center\">\n <div class=\"rotate-180\"\n [class.cursor-pointer]=\"indexSelected() !== 0\"\n [class.pointer-events-none]=\"indexSelected() === 0\"\n (click)=\"handlerPreviousImage($event)\">\n <i class=\"text-[24px] cursor-pointer text-[#ffffff] libs-ui-icon-chevron-right\"\n [class.libs-ui-disable]=\"indexSelected() === 0\"></i>\n </div>\n </div>\n\n <div class=\"flex max-w-[80%] relative\">\n <div class=\"flex h-full overflow-[hidden]\">\n @for (image of images(); track index; let index = $index; let last = $last) {\n <div #imagesRef\n class=\"libs-ui-gallery-img-popup-container-list-item\"\n [class.mr-[12px]]=\"!last\"\n [attr.active]=\"image[fieldDisplaySrcImage()] === imageSelected()?.[fieldDisplaySrcImage()]\">\n <div class=\"flex w-full h-full justify-center items-center\"\n (click)=\"handlerSelectImage($event,image,index)\">\n <div class=\"flex items-center justify-center w-full h-full\">\n <img [src]=\"image[fieldDisplaySrcImage()]\"\n class=\"flex max-h-full max-w-full m-[auto]\"\n (error)=\"handlerImageError($event, image)\" />\n </div>\n </div>\n </div>\n }\n </div>\n </div>\n <div class=\"ml-[24px] flex items-center\">\n <div [class.cursor-pointer]=\"indexSelected() !==images().length - 1\"\n [class.pointer-events-none]=\"indexSelected() ===images().length - 1\"\n (click)=\"handlerNextImage($event)\">\n <i class=\"text-[24px] cursor-pointer text-[#ffffff] libs-ui-icon-chevron-right\"\n [class.libs-ui-disable]=\"indexSelected() ===images().length - 1\"></i>\n </div>\n </div>\n </div>\n }\n </div>\n </div>\n </div>\n </div>\n }\n", styles: [".libs-ui-gallery-img-popup{display:flex;width:100%;height:100%;position:absolute;top:0;left:0;background-color:#000000b3;z-index:1000;justify-content:center}.libs-ui-gallery-img-popup .libs-ui-gallery-img-popup-container{position:relative;width:80%;height:90%;display:flex;flex-direction:column;margin:auto}.libs-ui-gallery-img-popup .libs-ui-gallery-img-popup-container .libs-ui-gallery-img-popup-container-preview{display:flex;position:relative}.libs-ui-gallery-img-popup .libs-ui-gallery-img-popup-container .libs-ui-gallery-img-popup-container-preview .libs-ui-gallery-img-popup-container-preview-ratio{background:#071631;opacity:.65}.libs-ui-gallery-img-popup .libs-ui-gallery-img-popup-container .libs-ui-gallery-img-popup-container-preview .libs-ui-gallery-img-popup-container-preview-button{height:32px;background:#071631;display:flex;align-items:center;justify-content:center;cursor:pointer;padding:8px;color:#fff}.libs-ui-gallery-img-popup .libs-ui-gallery-img-popup-container .libs-ui-gallery-img-popup-container-preview .libs-ui-gallery-img-popup-container-preview-button:hover{background:#5d636b}.libs-ui-gallery-img-popup .libs-ui-gallery-img-popup-container .libs-ui-gallery-img-popup-container-list{display:flex;flex-shrink:0;justify-content:center;height:15%}.libs-ui-gallery-img-popup .libs-ui-gallery-img-popup-container .libs-ui-gallery-img-popup-container-list .libs-ui-gallery-img-popup-container-list-item{cursor:pointer;height:100%;display:flex;align-items:center;justify-content:center;flex-shrink:0;border:1px solid #E6E7EA;border-radius:8px;padding:2px;max-width:118px!important;max-height:118px!important}.libs-ui-gallery-img-popup .libs-ui-gallery-img-popup-container .libs-ui-gallery-img-popup-container-list .libs-ui-gallery-img-popup-container-list-item[active=true]{border:1px solid var(--libs-ui-color-default, #226FF5)}\n"], dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }, { kind: "component", type: LibsUiComponentsPopoverComponent, selector: "libs_ui-components-popover,[LibsUiComponentsPopoverDirective]", inputs: ["debugId", "flagMouse", "type", "mode", "config", "ignoreShowPopover", "elementRefCustom", "classInclude", "ignoreHiddenPopoverContentWhenMouseLeave", "ignoreStopPropagationEvent", "ignoreCursorPointerModeLikeClick", "isAddContentToParentDocument", "ignoreClickOutside"], outputs: ["outEvent", "outChangStageFlagMouse", "outEventPopoverContent", "outFunctionsControl"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
305
+ }
306
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsGalleryViewerComponent, decorators: [{
307
+ type: Component,
308
+ args: [{ selector: 'libs_ui-components-gallery-viewer', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
309
+ TranslateModule,
310
+ LibsUiComponentsPopoverComponent,
311
+ ], template: "@if (images() || singleImage()) {\n <div class=\"libs-ui-gallery-img-popup\"\n [class.bg-[transparent]]=\"removeBackdrop()\"\n [style.zIndex]=\"zIndex()\">\n <div #fullContainerRef\n class=\"libs-ui-gallery-img-popup-container\">\n <div class=\"flex justify-end mb-[16px] z-10\">\n <i class=\"libs-ui-icon-close text-[24px] text-[#ffffff] cursor-pointer\"\n (click)=\"handlerClosePopup($event)\"></i>\n </div>\n <div class=\"relative w-full h-full\">\n <div class=\"flex flex-col w-full h-full justify-between\">\n <div class=\"libs-ui-gallery-img-popup-container-preview w-full h-full\">\n <div class=\"flex flex-col w-full h-full relative\"\n (mouseenter)=\"handlerShowButton(true)\"\n (mouseleave)=\"handlerShowButton(false)\">\n <div #containerRef\n class=\"flex w-full h-full relative\">\n <div class=\"absolute flex items-center justify-center w-full h-full overflow-hidden\"\n (mouseenter)=\"handlerMouseEvent($event, true)\"\n (mouseleave)=\"handlerMouseEvent($event,false)\">\n @if (fieldDisplaySrcImage() && imageSelected(); as imageSelected) {\n <img #singleImageRef\n [src]=\"imageSelected[fieldDisplaySrcImage()]\"\n class=\"flex m-[auto]\"\n (error)=\"handlerImageError($event, imageSelected)\" />\n }\n <div #elementRatioRef\n class=\"libs-ui-gallery-img-popup-container-preview-ratio items-center justify-center libs-ui-font-h5m text-[#e6e7ea] w-[80px] h-[34px] rounded-[4px] absolute top-[50%] left-[50%]\">\n {{ ratio() }}\n </div>\n </div>\n </div>\n @if (!imageSelected()?.['error']) {\n <div class=\"relative w-full\"\n (mouseenter)=\"handlerMouseEvent($event, true)\"\n [class.hidden]=\"!hoverContentViewImage()\">\n <div class=\"flex w-full justify-center libs-ui-font-h5r absolute z-10 top-[-44px]\">\n <libs_ui-components-popover [config]=\"{content: 'i18n_zoom_out', direction: 'top', zIndex:1300}\">\n <div class=\"libs-ui-gallery-img-popup-container-preview-button rounded-l-[8px]\"\n (click)=\"handlerZoom($event,'out')\">\n <div class=\"w-[16px] h-[16px] p-[1px] \">\n <div class=\"border-[#ffffff] border-[1px] rounded-[50%] text-[#ffffff] flex items-center justify-center text-[14px] w-full h-full\">-</div>\n </div>\n </div>\n </libs_ui-components-popover>\n <libs_ui-components-popover [config]=\"{content: 'i18n_zoom_in', direction: 'top', zIndex:1300}\">\n <div class=\"libs-ui-gallery-img-popup-container-preview-button\"\n (click)=\"handlerZoom($event,'in')\">\n <div class=\"w-[16px] h-[16px] p-[1px] \">\n <div class=\"border-[#ffffff] border-[1px] rounded-[50%] text-[#ffffff] flex items-center justify-center text-[12px] w-full h-full\">+</div>\n </div>\n </div>\n </libs_ui-components-popover>\n <libs_ui-components-popover [config]=\"{content: fullScreen() ? 'i18n_action_exit_full_screen' : 'i18n_action_view_full_screen', direction: 'top', zIndex:1300}\">\n <div class=\"libs-ui-gallery-img-popup-container-preview-button\"\n (click)=\"handlerFullScreen()\">\n <i class=\"{{ fullScreen() ? 'libs-ui-icon-fullscreen-exit' : 'libs-ui-icon-fullscreen-open' }} text-[#ffffff] text-[16px]\"></i>\n </div>\n </libs_ui-components-popover>\n <div class=\"libs-ui-gallery-img-popup-container-preview-button rounded-r-[8px] border-l border-l-1 border-[#5d636b] flex items-center\"\n (click)=\"handlerReset()\">\n <i class=\"libs-ui-icon-refresh text-16px mr-[8px]\"\n [class.text-[#ffffff]]=\"!disable()\"\n [class.text-[#6a7383]]=\"disable()\"></i>\n <div class=\"libs-ui-font-h5r\"\n [class.text-[#ffffff]]=\"!disable()\"\n [class.text-[#6a7383]]=\"disable()\">{{ 'i18n_restore' | translate }}</div>\n </div>\n </div>\n </div>\n }\n @if (!singleImage()) {\n <div class=\"flex justify-center libs-ui-font-h5r text-[#ffffff] mt-[12px]\">\n @if (fullScreen()) {\n <div class=\"mr-[16px] flex items-center\">\n <div class=\"rotate-180\"\n [class.cursor-pointer]=\"indexSelected() !== 0\"\n [class.pointer-events-none]=\"indexSelected() === 0\"\n (click)=\"handlerPreviousImage($event)\">\n <i class=\"text-[24px] cursor-pointer text-[#ffffff] libs-ui-icon-chevron-right\"\n [class.libs-ui-disable]=\"indexSelected() === 0\"></i>\n </div>\n </div>\n }\n <div class=\"flex aitems-center\">\n {{ indexSelected()+1 }}/{{ images().length }}\n </div>\n\n @if (fullScreen()) {\n <div class=\"ml-[16px] flex items-center\">\n <div [class.cursor-pointer]=\"indexSelected() !== images().length - 1\"\n [class.pointer-events-none]=\"indexSelected() === images().length - 1\"\n (click)=\"handlerNextImage($event)\">\n <i class=\"text-[24px] cursor-pointer text-[#ffffff] libs-ui-icon-chevron-right\"\n [class.libs-ui-disable]=\"indexSelected() ===images().length - 1\"></i>\n </div>\n </div>\n }\n </div>\n }\n </div>\n </div>\n\n @if (!singleImage()) {\n <div class=\"libs-ui-gallery-img-popup-container-list px-[32px] mt-[24px] flex\"\n [class.!hidden]=\"fullScreen()\">\n <div class=\"mr-[24px] flex items-center\">\n <div class=\"rotate-180\"\n [class.cursor-pointer]=\"indexSelected() !== 0\"\n [class.pointer-events-none]=\"indexSelected() === 0\"\n (click)=\"handlerPreviousImage($event)\">\n <i class=\"text-[24px] cursor-pointer text-[#ffffff] libs-ui-icon-chevron-right\"\n [class.libs-ui-disable]=\"indexSelected() === 0\"></i>\n </div>\n </div>\n\n <div class=\"flex max-w-[80%] relative\">\n <div class=\"flex h-full overflow-[hidden]\">\n @for (image of images(); track index; let index = $index; let last = $last) {\n <div #imagesRef\n class=\"libs-ui-gallery-img-popup-container-list-item\"\n [class.mr-[12px]]=\"!last\"\n [attr.active]=\"image[fieldDisplaySrcImage()] === imageSelected()?.[fieldDisplaySrcImage()]\">\n <div class=\"flex w-full h-full justify-center items-center\"\n (click)=\"handlerSelectImage($event,image,index)\">\n <div class=\"flex items-center justify-center w-full h-full\">\n <img [src]=\"image[fieldDisplaySrcImage()]\"\n class=\"flex max-h-full max-w-full m-[auto]\"\n (error)=\"handlerImageError($event, image)\" />\n </div>\n </div>\n </div>\n }\n </div>\n </div>\n <div class=\"ml-[24px] flex items-center\">\n <div [class.cursor-pointer]=\"indexSelected() !==images().length - 1\"\n [class.pointer-events-none]=\"indexSelected() ===images().length - 1\"\n (click)=\"handlerNextImage($event)\">\n <i class=\"text-[24px] cursor-pointer text-[#ffffff] libs-ui-icon-chevron-right\"\n [class.libs-ui-disable]=\"indexSelected() ===images().length - 1\"></i>\n </div>\n </div>\n </div>\n }\n </div>\n </div>\n </div>\n </div>\n }\n", styles: [".libs-ui-gallery-img-popup{display:flex;width:100%;height:100%;position:absolute;top:0;left:0;background-color:#000000b3;z-index:1000;justify-content:center}.libs-ui-gallery-img-popup .libs-ui-gallery-img-popup-container{position:relative;width:80%;height:90%;display:flex;flex-direction:column;margin:auto}.libs-ui-gallery-img-popup .libs-ui-gallery-img-popup-container .libs-ui-gallery-img-popup-container-preview{display:flex;position:relative}.libs-ui-gallery-img-popup .libs-ui-gallery-img-popup-container .libs-ui-gallery-img-popup-container-preview .libs-ui-gallery-img-popup-container-preview-ratio{background:#071631;opacity:.65}.libs-ui-gallery-img-popup .libs-ui-gallery-img-popup-container .libs-ui-gallery-img-popup-container-preview .libs-ui-gallery-img-popup-container-preview-button{height:32px;background:#071631;display:flex;align-items:center;justify-content:center;cursor:pointer;padding:8px;color:#fff}.libs-ui-gallery-img-popup .libs-ui-gallery-img-popup-container .libs-ui-gallery-img-popup-container-preview .libs-ui-gallery-img-popup-container-preview-button:hover{background:#5d636b}.libs-ui-gallery-img-popup .libs-ui-gallery-img-popup-container .libs-ui-gallery-img-popup-container-list{display:flex;flex-shrink:0;justify-content:center;height:15%}.libs-ui-gallery-img-popup .libs-ui-gallery-img-popup-container .libs-ui-gallery-img-popup-container-list .libs-ui-gallery-img-popup-container-list-item{cursor:pointer;height:100%;display:flex;align-items:center;justify-content:center;flex-shrink:0;border:1px solid #E6E7EA;border-radius:8px;padding:2px;max-width:118px!important;max-height:118px!important}.libs-ui-gallery-img-popup .libs-ui-gallery-img-popup-container .libs-ui-gallery-img-popup-container-list .libs-ui-gallery-img-popup-container-list-item[active=true]{border:1px solid var(--libs-ui-color-default, #226FF5)}\n"] }]
312
+ }], ctorParameters: () => [] });
313
+
314
+ export { LibsUiComponentsGalleryViewerComponent };
315
+ //# sourceMappingURL=libs-ui-components-gallery-viewer.component-BWW_1gPm.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"libs-ui-components-gallery-viewer.component-BWW_1gPm.mjs","sources":["../../../../../libs-ui/components/gallery/src/viewer/viewer.component.ts","../../../../../libs-ui/components/gallery/src/viewer/viewer.component.html"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { AfterViewInit, ChangeDetectionStrategy, Component, effect, ElementRef, input, model, OnDestroy, output, signal, untracked, viewChild, viewChildren } from \"@angular/core\";\nimport { IBoundingClientRect, IEvent } from \"@libs-ui/interfaces-types\";\nimport { IZoomDragHTMLElement } from \"../interfaces/zoom.interface\";\nimport { fromEvent, Subject, takeUntil } from \"rxjs\";\nimport { viewDataNumberByLanguage } from \"@libs-ui/utils\";\nimport { LibsUiComponentsPopoverComponent } from \"@libs-ui/components-popover\";\nimport { TranslateModule } from \"@ngx-translate/core\";\n\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'libs_ui-components-gallery-viewer',\n templateUrl: './viewer.component.html',\n styleUrls: ['./viewer.component.scss'],\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n TranslateModule,\n LibsUiComponentsPopoverComponent,\n ]\n})\nexport class LibsUiComponentsGalleryViewerComponent implements AfterViewInit, OnDestroy {\n /* PROPERTY */\n protected indexSelected = signal<number>(0);\n protected scaleValue = signal<number>(1);\n protected ratio = signal<string>('100%');\n protected fullScreen = signal<boolean>(false);\n protected isShowButton = signal<boolean>(false);\n protected disable = signal<boolean>(true);\n protected hoverContentViewImage = signal<boolean>(false);\n\n // private imagesElementRef = signal<Array<ElementRef>>([]);\n private step = signal<number>(0.1);\n private draggableEl = signal<IZoomDragHTMLElement | null>(null);\n private widthDefault = signal<number>(0);\n private heightDefault = signal<number>(0);\n private viewPort = signal<IBoundingClientRect | undefined>(undefined);\n private canDrag = signal<boolean>(false);\n private widthImage = signal<number>(0);\n private isFirstRender = signal<boolean>(false);\n private timeouts = signal<Array<number>>([]);\n\n private onDestroy = new Subject<void>();\n\n /* INPUT */\n readonly images = input.required<Array<Record<string, any>>>();\n readonly fieldDisplaySrcImage = input.required<string>();\n readonly imageSelected = model<Record<string, any>>();\n readonly removeBackdrop = input<boolean>();\n readonly zIndex = input<number>(1200);\n readonly singleImage = input<boolean>(false);\n\n /* OUTPUT */\n readonly outClose = output<void>();\n\n /* VIEW CHILD */\n protected containerRef = viewChild<ElementRef>('containerRef');\n protected singleImageRef = viewChild<ElementRef>('singleImageRef');\n protected elementRatioRef = viewChild<ElementRef>('elementRatioRef');\n protected fullContainerRef = viewChild<ElementRef>('fullContainerRef');\n protected imagesRef = viewChildren<ElementRef>('imagesRef');\n\n constructor() {\n effect(() => {\n if (this.singleImage()) {\n return;\n }\n const indexSelected = this.images().findIndex(item => item[this.fieldDisplaySrcImage()] === this.imageSelected()?.[this.fieldDisplaySrcImage()]);\n\n untracked(() => {\n this.indexSelected.set(indexSelected);\n\n this.createTimeout((id) => {\n clearTimeout(id);\n this.imagesRef()[this.indexSelected()].nativeElement.scrollIntoView();\n }, 100);\n });\n });\n }\n\n ngAfterViewInit() {\n fromEvent<KeyboardEvent>(document, 'keyup').pipe(takeUntil(this.onDestroy)).subscribe((event) => {\n event.stopPropagation();\n if (event.key === 'ArrowLeft') {\n this.handlerPreviousImage(event);\n\n return;\n }\n if (event.key === 'ArrowRight') {\n this.handlerNextImage(event);\n\n return;\n }\n });\n this.isFirstRender.set(true);\n fromEvent(window, 'resize').pipe(takeUntil(this.onDestroy)).subscribe(this.setWidthImages.bind(this));\n\n this.createTimeout((id) => {\n clearTimeout(id);\n this.setWidthImages();\n }, 300);\n }\n\n /* FUNCTIONS */\n private setWidthImages() {\n if (!this.fullScreen()) {\n this.imagesRef().forEach(image => {\n image.nativeElement.style.width = image.nativeElement.getBoundingClientRect().height + 'px';\n });\n }\n const singleImageRef = this.singleImageRef();\n if (singleImageRef) {\n singleImageRef.nativeElement.style.width = '';\n singleImageRef.nativeElement.style.height = '';\n }\n this.viewPort.set(this.containerRef()?.nativeElement.getBoundingClientRect());\n const img = new Image();\n\n img.src = this.imageSelected()?.[this.fieldDisplaySrcImage()] as string;\n img.onload = () => {\n this.widthDefault.set(img.naturalWidth);\n this.heightDefault.set(img.naturalHeight);\n this.widthImage.set(this.singleImageRef()?.nativeElement.width);\n\n this.setStyleSelectImage();\n };\n }\n\n protected handlerImageError(e: ErrorEvent, image: Record<string, any>) {\n const event = e as IEvent;\n\n event.stopPropagation();\n\n image['isError'] = true;\n }\n\n protected handlerShowButton(isShow: boolean) {\n this.isShowButton.set(isShow);\n }\n\n protected handlerMouseEvent(event: Event, status: boolean) {\n event.stopPropagation();\n this.hoverContentViewImage.set(status);\n }\n\n protected handlerClosePopup(e: Event) {\n e.stopPropagation();\n this.outClose.emit();\n }\n\n protected handlerZoom(event: MouseEvent, type: 'in' | 'out') {\n event.stopPropagation();\n this.isFirstRender.set(false);\n this.disable.set(false);\n const element = this.singleImageRef()?.nativeElement;\n\n if (!element) {\n return;\n }\n const draggableEl = this.makeElementDraggable({\n element: element,\n isOverflowHiddenDesired: true,\n });\n\n this.draggableEl.set(draggableEl);\n\n if (this.scaleValue() * this.widthDefault() / this.widthImage() * 100 < 1) {\n this.scaleValue.set(1 / 100 * this.widthImage() / this.widthDefault());\n }\n if (this.scaleValue() * this.widthDefault() / this.widthImage() * 100 > 5000 * 0.9) {\n this.scaleValue.set(5000 * 0.9 / 100 * this.widthImage() / this.widthDefault());\n }\n if (type === 'in') {\n const scaleValue = this.scaleValue() * (1 + this.step());\n this.scaleValue.set(scaleValue);\n }\n if (type === 'out') {\n const scaleValue = this.scaleValue() / (1 + this.step());\n this.scaleValue.set(scaleValue);\n }\n this.setWidthHeight(element);\n element.style.position = `absolute`;\n if (!this.canDrag && this.draggableEl() && this.draggableEl()?.stopDraggableBehavior) {\n\n this.draggableEl()?.stopDraggableBehavior?.();\n }\n }\n\n protected handlerNextImage(e: Event) {\n const indexSelected = this.indexSelected() + 1;\n\n this.handlerSelectImage(e, this.images()[indexSelected], indexSelected);\n }\n\n protected handlerPreviousImage(e: Event) {\n const indexSelected = this.indexSelected() - 1;\n\n this.handlerSelectImage(e, this.images()[indexSelected], indexSelected);\n }\n\n protected handlerSelectImage(e: Event, imageSelected: Record<string, any>, indexSelected: number) {\n e.stopPropagation();\n if (!imageSelected) {\n return;\n }\n this.isFirstRender.set(true);\n const elementRatio = this.elementRatioRef()?.nativeElement;\n\n if (elementRatio) {\n elementRatio.style.display = 'none';\n }\n this.imageSelected.set(imageSelected);\n this.indexSelected.set(indexSelected);\n this.scaleValue.set(1);\n this.imagesRef()[indexSelected].nativeElement.scrollIntoView();\n this.setWidthImages();\n }\n\n protected handlerFullScreen() {\n this.createTimeout((id) => {\n clearTimeout(id);\n this.disable.set(true);\n const element = this.singleImageRef()?.nativeElement;\n const fullElement = this.fullContainerRef()?.nativeElement;\n\n this.fullScreen.set(!this.fullScreen());\n\n if (!fullElement) {\n return;\n }\n if (this.fullScreen()) {\n fullElement.style.width = '95%';\n fullElement.style.height = '95%';\n }\n if (!this.fullScreen()) {\n fullElement.style.width = '80%';\n fullElement.style.height = '90%';\n }\n this.viewPort.set(this.containerRef()?.nativeElement.getBoundingClientRect());\n if (!element) {\n return;\n }\n this.setStyleSelectImage(true);\n element.style.left = `unset`;\n element.style.top = `unset`;\n }, 0);\n }\n\n protected handlerReset() {\n this.disable.set(true);\n this.setStyleSelectImage(true);\n }\n\n private makeElementDraggable = ({\n element,\n DRAGGABLE_CSS_CLASS = 'draggable-element',\n }: {\n element: HTMLElement | null;\n isOverflowHiddenDesired?: boolean;\n DRAGGABLE_CSS_CLASS?: string;\n }): IZoomDragHTMLElement | null => {\n if (!element) {\n return null;\n }\n const isTheRequiredCSSAlreadyInPlace = !!Array.from(\n element.ownerDocument.getElementsByTagName('style')\n ).filter((styleEl) =>\n styleEl?.textContent?.includes(`.${DRAGGABLE_CSS_CLASS}`)\n )?.[0];\n\n if (!isTheRequiredCSSAlreadyInPlace) {\n element.ownerDocument.body.appendChild(\n Object.assign(element.ownerDocument.createElement('style'), {\n textContent: `\n .${DRAGGABLE_CSS_CLASS} {\n position: absolute;\n cursor: grabbing !important;\n }\n `,\n })\n );\n }\n\n if (!element.classList.contains(DRAGGABLE_CSS_CLASS)) {\n element.classList.add(DRAGGABLE_CSS_CLASS);\n }\n element.onmousedown = (mouseDownEvent) => {\n mouseDownEvent.preventDefault();\n element.onmousemove = (mouseMoveEvent) => {\n mouseMoveEvent.preventDefault();\n const rectElement = element.getBoundingClientRect();\n\n if (rectElement.left + rectElement.width + mouseMoveEvent.movementX > (this.viewPort()?.width || 0) + (this.viewPort()?.left || 0) && rectElement.left + mouseMoveEvent.movementX < (this.viewPort()?.left || 0)) {\n element.style.left = `${element.offsetLeft + mouseMoveEvent.movementX}px`;\n }\n if (rectElement.top + rectElement.height + mouseMoveEvent.movementY > (this.viewPort()?.height || 0) + (this.viewPort()?.top || 0) && rectElement.top + mouseMoveEvent.movementY < (this.viewPort()?.top || 0)) {\n element.style.top = `${element.offsetTop + mouseMoveEvent.movementY}px`;\n }\n };\n };\n element.ownerDocument.onmouseup = (mouseUpEvent) => {\n mouseUpEvent.preventDefault();\n element.onmousemove = null;\n };\n\n return Object.assign(element, {\n stopDraggableBehavior() {\n element.classList.remove(DRAGGABLE_CSS_CLASS);\n element.onmousedown = null;\n element.onmousemove = null;\n element.onmouseup = null;\n element.style.left = 'unset';\n element.style.top = 'unset';\n\n return element;\n },\n });\n };\n\n private setStyleSelectImage(reset?: boolean) {\n const element = this.singleImageRef()?.nativeElement;\n\n if (!element) {\n return;\n }\n const scaleValue = (((this.viewPort()?.width || 0) / this.widthDefault()) < ((this.viewPort()?.height || 0) - (this.singleImage() ? 0 : 40)) / this.heightDefault()) ? ((this.viewPort()?.width || 0) / this.widthDefault()) : ((this.viewPort()?.height || 0) - (this.singleImage() ? 0 : 40)) / this.heightDefault();\n\n this.scaleValue.set(scaleValue);\n\n if (this.scaleValue() > 1 && (reset || this.isFirstRender()) && !this.fullScreen()) {\n this.scaleValue.set(1);\n }\n this.setWidthHeight(element);\n if (this.fullScreen()) {\n element.style.position = `unset`;\n\n return;\n }\n }\n\n private setWidthHeight(element: HTMLElement) {\n element.style.width = `${this.scaleValue() * this.widthDefault()}px`;\n element.style.height = `${this.scaleValue() * this.heightDefault()}px`;\n this.canDrag.set(false);\n const rectElement = element.getBoundingClientRect();\n\n if ((rectElement.width > (this.viewPort()?.width || 0)) || (rectElement.height > (this.viewPort()?.height || 0))) {\n this.canDrag.set(true);\n }\n if (rectElement.left + rectElement.width < (this.viewPort()?.width || 0) + (this.viewPort()?.left || 0) || rectElement.left > (this.viewPort()?.left || 0)) {\n element.style.left = `unset`;\n }\n if (rectElement.top + rectElement.height < (this.viewPort()?.top || 0) + (this.viewPort()?.height || 0) || rectElement.top > (this.viewPort()?.top || 0)) {\n element.style.top = `unset`;\n }\n\n this.setDisplayRatio();\n }\n\n private setDisplayRatio() {\n const element = this.singleImageRef()?.nativeElement;\n\n this.ratio.set(`${viewDataNumberByLanguage(element.width / this.widthDefault() * 100, false, 0)}%`);\n const elementRatio = this.elementRatioRef()?.nativeElement;\n\n elementRatio.style.display = 'flex';\n this.createTimeout((id) => {\n clearTimeout(id);\n elementRatio.style.display = 'none';\n }, 1000);\n }\n\n private createTimeout(callback: (id: number) => void, delay: number) {\n const timeoutId = setTimeout(() => callback(timeoutId), delay) as unknown as number;\n this.timeouts.update(ids => [...ids, timeoutId]);\n }\n\n ngOnDestroy() {\n this.timeouts().forEach(item => clearTimeout(item));\n this.onDestroy.next();\n this.onDestroy.complete();\n }\n}","@if (images() || singleImage()) {\n <div class=\"libs-ui-gallery-img-popup\"\n [class.bg-[transparent]]=\"removeBackdrop()\"\n [style.zIndex]=\"zIndex()\">\n <div #fullContainerRef\n class=\"libs-ui-gallery-img-popup-container\">\n <div class=\"flex justify-end mb-[16px] z-10\">\n <i class=\"libs-ui-icon-close text-[24px] text-[#ffffff] cursor-pointer\"\n (click)=\"handlerClosePopup($event)\"></i>\n </div>\n <div class=\"relative w-full h-full\">\n <div class=\"flex flex-col w-full h-full justify-between\">\n <div class=\"libs-ui-gallery-img-popup-container-preview w-full h-full\">\n <div class=\"flex flex-col w-full h-full relative\"\n (mouseenter)=\"handlerShowButton(true)\"\n (mouseleave)=\"handlerShowButton(false)\">\n <div #containerRef\n class=\"flex w-full h-full relative\">\n <div class=\"absolute flex items-center justify-center w-full h-full overflow-hidden\"\n (mouseenter)=\"handlerMouseEvent($event, true)\"\n (mouseleave)=\"handlerMouseEvent($event,false)\">\n @if (fieldDisplaySrcImage() && imageSelected(); as imageSelected) {\n <img #singleImageRef\n [src]=\"imageSelected[fieldDisplaySrcImage()]\"\n class=\"flex m-[auto]\"\n (error)=\"handlerImageError($event, imageSelected)\" />\n }\n <div #elementRatioRef\n class=\"libs-ui-gallery-img-popup-container-preview-ratio items-center justify-center libs-ui-font-h5m text-[#e6e7ea] w-[80px] h-[34px] rounded-[4px] absolute top-[50%] left-[50%]\">\n {{ ratio() }}\n </div>\n </div>\n </div>\n @if (!imageSelected()?.['error']) {\n <div class=\"relative w-full\"\n (mouseenter)=\"handlerMouseEvent($event, true)\"\n [class.hidden]=\"!hoverContentViewImage()\">\n <div class=\"flex w-full justify-center libs-ui-font-h5r absolute z-10 top-[-44px]\">\n <libs_ui-components-popover [config]=\"{content: 'i18n_zoom_out', direction: 'top', zIndex:1300}\">\n <div class=\"libs-ui-gallery-img-popup-container-preview-button rounded-l-[8px]\"\n (click)=\"handlerZoom($event,'out')\">\n <div class=\"w-[16px] h-[16px] p-[1px] \">\n <div class=\"border-[#ffffff] border-[1px] rounded-[50%] text-[#ffffff] flex items-center justify-center text-[14px] w-full h-full\">-</div>\n </div>\n </div>\n </libs_ui-components-popover>\n <libs_ui-components-popover [config]=\"{content: 'i18n_zoom_in', direction: 'top', zIndex:1300}\">\n <div class=\"libs-ui-gallery-img-popup-container-preview-button\"\n (click)=\"handlerZoom($event,'in')\">\n <div class=\"w-[16px] h-[16px] p-[1px] \">\n <div class=\"border-[#ffffff] border-[1px] rounded-[50%] text-[#ffffff] flex items-center justify-center text-[12px] w-full h-full\">+</div>\n </div>\n </div>\n </libs_ui-components-popover>\n <libs_ui-components-popover [config]=\"{content: fullScreen() ? 'i18n_action_exit_full_screen' : 'i18n_action_view_full_screen', direction: 'top', zIndex:1300}\">\n <div class=\"libs-ui-gallery-img-popup-container-preview-button\"\n (click)=\"handlerFullScreen()\">\n <i class=\"{{ fullScreen() ? 'libs-ui-icon-fullscreen-exit' : 'libs-ui-icon-fullscreen-open' }} text-[#ffffff] text-[16px]\"></i>\n </div>\n </libs_ui-components-popover>\n <div class=\"libs-ui-gallery-img-popup-container-preview-button rounded-r-[8px] border-l border-l-1 border-[#5d636b] flex items-center\"\n (click)=\"handlerReset()\">\n <i class=\"libs-ui-icon-refresh text-16px mr-[8px]\"\n [class.text-[#ffffff]]=\"!disable()\"\n [class.text-[#6a7383]]=\"disable()\"></i>\n <div class=\"libs-ui-font-h5r\"\n [class.text-[#ffffff]]=\"!disable()\"\n [class.text-[#6a7383]]=\"disable()\">{{ 'i18n_restore' | translate }}</div>\n </div>\n </div>\n </div>\n }\n @if (!singleImage()) {\n <div class=\"flex justify-center libs-ui-font-h5r text-[#ffffff] mt-[12px]\">\n @if (fullScreen()) {\n <div class=\"mr-[16px] flex items-center\">\n <div class=\"rotate-180\"\n [class.cursor-pointer]=\"indexSelected() !== 0\"\n [class.pointer-events-none]=\"indexSelected() === 0\"\n (click)=\"handlerPreviousImage($event)\">\n <i class=\"text-[24px] cursor-pointer text-[#ffffff] libs-ui-icon-chevron-right\"\n [class.libs-ui-disable]=\"indexSelected() === 0\"></i>\n </div>\n </div>\n }\n <div class=\"flex aitems-center\">\n {{ indexSelected()+1 }}/{{ images().length }}\n </div>\n\n @if (fullScreen()) {\n <div class=\"ml-[16px] flex items-center\">\n <div [class.cursor-pointer]=\"indexSelected() !== images().length - 1\"\n [class.pointer-events-none]=\"indexSelected() === images().length - 1\"\n (click)=\"handlerNextImage($event)\">\n <i class=\"text-[24px] cursor-pointer text-[#ffffff] libs-ui-icon-chevron-right\"\n [class.libs-ui-disable]=\"indexSelected() ===images().length - 1\"></i>\n </div>\n </div>\n }\n </div>\n }\n </div>\n </div>\n\n @if (!singleImage()) {\n <div class=\"libs-ui-gallery-img-popup-container-list px-[32px] mt-[24px] flex\"\n [class.!hidden]=\"fullScreen()\">\n <div class=\"mr-[24px] flex items-center\">\n <div class=\"rotate-180\"\n [class.cursor-pointer]=\"indexSelected() !== 0\"\n [class.pointer-events-none]=\"indexSelected() === 0\"\n (click)=\"handlerPreviousImage($event)\">\n <i class=\"text-[24px] cursor-pointer text-[#ffffff] libs-ui-icon-chevron-right\"\n [class.libs-ui-disable]=\"indexSelected() === 0\"></i>\n </div>\n </div>\n\n <div class=\"flex max-w-[80%] relative\">\n <div class=\"flex h-full overflow-[hidden]\">\n @for (image of images(); track index; let index = $index; let last = $last) {\n <div #imagesRef\n class=\"libs-ui-gallery-img-popup-container-list-item\"\n [class.mr-[12px]]=\"!last\"\n [attr.active]=\"image[fieldDisplaySrcImage()] === imageSelected()?.[fieldDisplaySrcImage()]\">\n <div class=\"flex w-full h-full justify-center items-center\"\n (click)=\"handlerSelectImage($event,image,index)\">\n <div class=\"flex items-center justify-center w-full h-full\">\n <img [src]=\"image[fieldDisplaySrcImage()]\"\n class=\"flex max-h-full max-w-full m-[auto]\"\n (error)=\"handlerImageError($event, image)\" />\n </div>\n </div>\n </div>\n }\n </div>\n </div>\n <div class=\"ml-[24px] flex items-center\">\n <div [class.cursor-pointer]=\"indexSelected() !==images().length - 1\"\n [class.pointer-events-none]=\"indexSelected() ===images().length - 1\"\n (click)=\"handlerNextImage($event)\">\n <i class=\"text-[24px] cursor-pointer text-[#ffffff] libs-ui-icon-chevron-right\"\n [class.libs-ui-disable]=\"indexSelected() ===images().length - 1\"></i>\n </div>\n </div>\n </div>\n }\n </div>\n </div>\n </div>\n </div>\n }\n"],"names":[],"mappings":";;;;;;;;AAAA;MAqBa,sCAAsC,CAAA;;AAEvC,IAAA,aAAa,GAAG,MAAM,CAAS,CAAC,CAAC,CAAC;AAClC,IAAA,UAAU,GAAG,MAAM,CAAS,CAAC,CAAC,CAAC;AAC/B,IAAA,KAAK,GAAG,MAAM,CAAS,MAAM,CAAC,CAAC;AAC/B,IAAA,UAAU,GAAG,MAAM,CAAU,KAAK,CAAC,CAAC;AACpC,IAAA,YAAY,GAAG,MAAM,CAAU,KAAK,CAAC,CAAC;AACtC,IAAA,OAAO,GAAG,MAAM,CAAU,IAAI,CAAC,CAAC;AAChC,IAAA,qBAAqB,GAAG,MAAM,CAAU,KAAK,CAAC,CAAC;;AAGjD,IAAA,IAAI,GAAG,MAAM,CAAS,GAAG,CAAC,CAAC;AAC3B,IAAA,WAAW,GAAG,MAAM,CAA8B,IAAI,CAAC,CAAC;AACxD,IAAA,YAAY,GAAG,MAAM,CAAS,CAAC,CAAC,CAAC;AACjC,IAAA,aAAa,GAAG,MAAM,CAAS,CAAC,CAAC,CAAC;AAClC,IAAA,QAAQ,GAAG,MAAM,CAAkC,SAAS,CAAC,CAAC;AAC9D,IAAA,OAAO,GAAG,MAAM,CAAU,KAAK,CAAC,CAAC;AACjC,IAAA,UAAU,GAAG,MAAM,CAAS,CAAC,CAAC,CAAC;AAC/B,IAAA,aAAa,GAAG,MAAM,CAAU,KAAK,CAAC,CAAC;AACvC,IAAA,QAAQ,GAAG,MAAM,CAAgB,EAAE,CAAC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,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,mCAAmC,cAGjC,IAAI,EAAA,eAAA,EACC,uBAAuB,CAAC,MAAM,EACtC,OAAA,EAAA;wBACP,eAAe;wBACf,gCAAgC;AACjC,qBAAA,EAAA,QAAA,EAAA,sqRAAA,EAAA,MAAA,EAAA,CAAA,k0DAAA,CAAA,EAAA,CAAA;;;;;"}
@@ -0,0 +1,139 @@
1
+ import { NgComponentOutlet, AsyncPipe } from '@angular/common';
2
+ import * as i0 from '@angular/core';
3
+ import { computed, signal, model, input, output, inject, effect, untracked, Component, ChangeDetectionStrategy } from '@angular/core';
4
+ import { LibsUiIconsGetIconComponentPipe } from '@libs-ui/icons';
5
+ import { LibsUiDynamicComponentService } from '@libs-ui/services-dynamic-component';
6
+ import { uuid, isEmbedFrame, UtilsCommunicateMicroKeyGlobal, UtilsCommunicateMicro } from '@libs-ui/utils';
7
+ import dayjs from 'dayjs';
8
+
9
+ /* eslint-disable @typescript-eslint/no-explicit-any */
10
+ class LibsUiComponentsGalleryComponent {
11
+ /* PROPERTY */
12
+ imagesDisplay = computed(() => {
13
+ return this.images().slice(this.start(), this.end());
14
+ });
15
+ idOverlay = signal(uuid());
16
+ idInterval = signal(undefined);
17
+ viewerRef;
18
+ /* INPUT */
19
+ images = model.required();
20
+ start = input(0);
21
+ end = input(3);
22
+ zIndex = input(1200);
23
+ fieldDisplaySrcImage = input('url');
24
+ ignoreOverlayCountImage = input();
25
+ imageArrayStringConvert = input(); // sử dụng trong 1 số trường hợp images là Array<string>
26
+ /* OUTPUT */
27
+ outFunctionsControl = output();
28
+ outViewerEvent = output();
29
+ /* INJECT */
30
+ dynamicComponent = inject(LibsUiDynamicComponentService);
31
+ constructor() {
32
+ effect(() => {
33
+ const imgConvert = this.imageArrayStringConvert();
34
+ const fieldGetSrc = this.fieldDisplaySrcImage();
35
+ if (!imgConvert?.length || !fieldGetSrc) {
36
+ return;
37
+ }
38
+ untracked(() => {
39
+ const convertedImages = imgConvert?.map(item => {
40
+ return {
41
+ [fieldGetSrc]: item
42
+ };
43
+ }) || [];
44
+ this.images.set(convertedImages);
45
+ });
46
+ });
47
+ }
48
+ ngOnInit() {
49
+ this.outFunctionsControl.emit({
50
+ open: (imageSelected) => this.handlerSelectImage(undefined, imageSelected),
51
+ viewerRef: this.ViewerRef
52
+ });
53
+ }
54
+ /* FUNCTIONS */
55
+ async handlerSelectImage(event, imageSelected) {
56
+ event?.stopPropagation();
57
+ if (this.viewerRef) {
58
+ return;
59
+ }
60
+ const viewerComponent = await import('./libs-ui-components-gallery-viewer.component-BWW_1gPm.mjs').then(c => c.LibsUiComponentsGalleryViewerComponent);
61
+ this.viewerRef = this.dynamicComponent.resolveComponentFactory(viewerComponent);
62
+ this.outFunctionsControl.emit({ viewerRef: this.ViewerRef, open: (imageSelected) => this.handlerSelectImage(undefined, imageSelected) });
63
+ this.viewerRef.setInput('fieldDisplaySrcImage', this.fieldDisplaySrcImage());
64
+ this.viewerRef.setInput('images', this.images());
65
+ this.viewerRef.setInput('imageSelected', imageSelected);
66
+ this.viewerRef.setInput('zIndex', this.zIndex());
67
+ this.viewerRef.setInput('singleImage', this.images().length <= 1);
68
+ const sub = this.viewerRef.instance.outClose.subscribe(() => {
69
+ sub.unsubscribe();
70
+ this.closePopup();
71
+ });
72
+ this.dynamicComponent.addToBody(this.viewerRef);
73
+ this.outViewerEvent.emit('show');
74
+ if (isEmbedFrame()) {
75
+ const data = {
76
+ type: UtilsCommunicateMicroKeyGlobal.KEY_MESSAGE_MODAL,
77
+ response: {
78
+ message: 'open',
79
+ state: true,
80
+ idOverlay: this.idOverlay,
81
+ timeLiveUpdate: dayjs().unix()
82
+ }
83
+ };
84
+ UtilsCommunicateMicro.PostMessageToParent(data);
85
+ this.idInterval.set(setInterval(() => {
86
+ data.response.timeLiveUpdate = dayjs().unix();
87
+ UtilsCommunicateMicro.PostMessageToParent(data);
88
+ }, 2000));
89
+ }
90
+ }
91
+ handlerImageError(e, image) {
92
+ const event = e;
93
+ event.stopPropagation();
94
+ image['isError'] = true;
95
+ }
96
+ closePopup() {
97
+ clearInterval(this.idInterval());
98
+ if (this.viewerRef) {
99
+ this.outViewerEvent.emit('remove');
100
+ if (isEmbedFrame()) {
101
+ const data = {
102
+ type: UtilsCommunicateMicroKeyGlobal.KEY_MESSAGE_MODAL,
103
+ response: {
104
+ message: 'close',
105
+ state: false,
106
+ idOverlay: this.idOverlay
107
+ }
108
+ };
109
+ UtilsCommunicateMicro.PostMessageToParent(data);
110
+ }
111
+ }
112
+ this.dynamicComponent.remove(this.viewerRef);
113
+ this.viewerRef = undefined;
114
+ this.outFunctionsControl.emit({ viewerRef: this.ViewerRef, open: (imageSelected) => this.handlerSelectImage(undefined, imageSelected) });
115
+ }
116
+ get ViewerRef() {
117
+ return this.viewerRef;
118
+ }
119
+ ngOnDestroy() {
120
+ this.viewerRef?.destroy();
121
+ this.closePopup();
122
+ }
123
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsGalleryComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
124
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: LibsUiComponentsGalleryComponent, isStandalone: true, selector: "libs_ui-components-gallery", inputs: { images: { classPropertyName: "images", publicName: "images", isSignal: true, isRequired: true, transformFunction: null }, start: { classPropertyName: "start", publicName: "start", isSignal: true, isRequired: false, transformFunction: null }, end: { classPropertyName: "end", publicName: "end", isSignal: true, isRequired: false, transformFunction: null }, zIndex: { classPropertyName: "zIndex", publicName: "zIndex", isSignal: true, isRequired: false, transformFunction: null }, fieldDisplaySrcImage: { classPropertyName: "fieldDisplaySrcImage", publicName: "fieldDisplaySrcImage", isSignal: true, isRequired: false, transformFunction: null }, ignoreOverlayCountImage: { classPropertyName: "ignoreOverlayCountImage", publicName: "ignoreOverlayCountImage", isSignal: true, isRequired: false, transformFunction: null }, imageArrayStringConvert: { classPropertyName: "imageArrayStringConvert", publicName: "imageArrayStringConvert", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { images: "imagesChange", outFunctionsControl: "outFunctionsControl", outViewerEvent: "outViewerEvent" }, ngImport: i0, template: "@if (images()) {\n <div class=\"flex nowrap w-100 h-100\">\n @for (image of imagesDisplay(); track $index; let last = $last) {\n <div class=\"w-full h-full libs-ui-border-general relative cursor-pointer\"\n [class.mr-[12px]]=\"!last\"\n (click)=\"handlerSelectImage($event, image)\">\n <div class=\"flex items-center justify-center w-full h-full\">\n @if (!image['isError']) {\n <img [src]=\"image[fieldDisplaySrcImage()]\"\n class=\"flex libs-uipercent-max-height-100 libs-uipercent-max-width-100 m-auto\"\n (error)='handlerImageError($event, image)' />\n }\n @if (image['isError']) {\n <div *ngComponentOutlet=\"'image-default' | LibsUiIconsGetIconComponentPipe | async\"></div>\n }\n </div>\n @if (last && images().length > end() && !ignoreOverlayCountImage()) {\n <div class=\"flex w-full h-full absolute top-0 left-0 items-center justify-center bg-[#000] opacity-5\">\n </div>\n <div class=\"flex w-full h-full absolute top-0 left-0 items-center justify-center\">\n <span class=\"libs-ui-font-h3s libs-ui-font-size-20px text-[#ffffff]\">+ {{ images().length - end() }}</span>\n </div>\n }\n </div>\n }\n </div>\n}\n", styles: [""], dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: LibsUiIconsGetIconComponentPipe, name: "LibsUiIconsGetIconComponentPipe" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
125
+ }
126
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsGalleryComponent, decorators: [{
127
+ type: Component,
128
+ args: [{ selector: 'libs_ui-components-gallery', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
129
+ NgComponentOutlet, AsyncPipe,
130
+ LibsUiIconsGetIconComponentPipe
131
+ ], template: "@if (images()) {\n <div class=\"flex nowrap w-100 h-100\">\n @for (image of imagesDisplay(); track $index; let last = $last) {\n <div class=\"w-full h-full libs-ui-border-general relative cursor-pointer\"\n [class.mr-[12px]]=\"!last\"\n (click)=\"handlerSelectImage($event, image)\">\n <div class=\"flex items-center justify-center w-full h-full\">\n @if (!image['isError']) {\n <img [src]=\"image[fieldDisplaySrcImage()]\"\n class=\"flex libs-uipercent-max-height-100 libs-uipercent-max-width-100 m-auto\"\n (error)='handlerImageError($event, image)' />\n }\n @if (image['isError']) {\n <div *ngComponentOutlet=\"'image-default' | LibsUiIconsGetIconComponentPipe | async\"></div>\n }\n </div>\n @if (last && images().length > end() && !ignoreOverlayCountImage()) {\n <div class=\"flex w-full h-full absolute top-0 left-0 items-center justify-center bg-[#000] opacity-5\">\n </div>\n <div class=\"flex w-full h-full absolute top-0 left-0 items-center justify-center\">\n <span class=\"libs-ui-font-h3s libs-ui-font-size-20px text-[#ffffff]\">+ {{ images().length - end() }}</span>\n </div>\n }\n </div>\n }\n </div>\n}\n" }]
132
+ }], ctorParameters: () => [] });
133
+
134
+ /**
135
+ * Generated bundle index. Do not edit.
136
+ */
137
+
138
+ export { LibsUiComponentsGalleryComponent };
139
+ //# sourceMappingURL=libs-ui-components-gallery.mjs.map