@libs-ui/components-gallery 0.1.1-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/esm2022/gallery.component.mjs +131 -0
- package/esm2022/index.mjs +4 -0
- package/esm2022/interfaces/functions-control-event.interface.mjs +2 -0
- package/esm2022/interfaces/index.mjs +3 -0
- package/esm2022/interfaces/zoom.interface.mjs +2 -0
- package/esm2022/libs-ui-components-gallery.mjs +5 -0
- package/esm2022/viewer/viewer.component.mjs +320 -0
- package/fesm2022/libs-ui-components-gallery.mjs +460 -0
- package/fesm2022/libs-ui-components-gallery.mjs.map +1 -0
- package/gallery.component.d.ts +29 -0
- package/index.d.ts +3 -0
- package/interfaces/functions-control-event.interface.d.ts +5 -0
- package/interfaces/index.d.ts +2 -0
- package/interfaces/zoom.interface.d.ts +3 -0
- package/package.json +33 -0
- package/viewer/viewer.component.d.ts +56 -0
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
import { NgComponentOutlet, AsyncPipe } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { computed, signal, model, input, output, inject, effect, untracked, ChangeDetectionStrategy, Component, viewChild, viewChildren, DestroyRef } from '@angular/core';
|
|
4
|
+
import { LibsUiIconsGetIconComponentPipe } from '@libs-ui/icons';
|
|
5
|
+
import { LibsUiDynamicComponentService } from '@libs-ui/services-dynamic-component';
|
|
6
|
+
import { uuid, isEmbedFrame, getDayjs, UtilsCommunicateMicroKeyGlobal, UtilsCommunicateMicro, viewDataNumberByLanguage } from '@libs-ui/utils';
|
|
7
|
+
import { fromEvent } from 'rxjs';
|
|
8
|
+
import { LibsUiComponentsPopoverComponent } from '@libs-ui/components-popover';
|
|
9
|
+
import * as i1 from '@ngx-translate/core';
|
|
10
|
+
import { TranslateModule } from '@ngx-translate/core';
|
|
11
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
12
|
+
|
|
13
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
14
|
+
class LibsUiComponentsGalleryComponent {
|
|
15
|
+
// #region PROPERTY
|
|
16
|
+
imagesDisplay = computed(() => {
|
|
17
|
+
return this.images().slice(this.start(), this.end());
|
|
18
|
+
});
|
|
19
|
+
idOverlay = signal(uuid());
|
|
20
|
+
idInterval = signal(undefined);
|
|
21
|
+
viewerRef;
|
|
22
|
+
// #region INPUT
|
|
23
|
+
images = model.required();
|
|
24
|
+
start = input(0);
|
|
25
|
+
end = input(3);
|
|
26
|
+
zIndex = input(1200);
|
|
27
|
+
fieldDisplaySrcImage = input('url');
|
|
28
|
+
ignoreOverlayCountImage = input();
|
|
29
|
+
imageArrayStringConvert = input(); // sử dụng trong 1 số trường hợp images là Array<string>
|
|
30
|
+
// #region OUTPUT
|
|
31
|
+
outFunctionsControl = output();
|
|
32
|
+
outViewerEvent = output();
|
|
33
|
+
// #region INJECT
|
|
34
|
+
dynamicComponent = inject(LibsUiDynamicComponentService);
|
|
35
|
+
constructor() {
|
|
36
|
+
effect(() => {
|
|
37
|
+
const imgConvert = this.imageArrayStringConvert();
|
|
38
|
+
const fieldGetSrc = this.fieldDisplaySrcImage();
|
|
39
|
+
if (!imgConvert?.length || !fieldGetSrc) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
untracked(() => {
|
|
43
|
+
const convertedImages = imgConvert?.map((item) => {
|
|
44
|
+
return {
|
|
45
|
+
[fieldGetSrc]: item,
|
|
46
|
+
};
|
|
47
|
+
}) || [];
|
|
48
|
+
this.images.set(convertedImages);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
ngOnInit() {
|
|
53
|
+
this.outFunctionsControl.emit(this.FunctionsControl);
|
|
54
|
+
}
|
|
55
|
+
/* FUNCTIONS */
|
|
56
|
+
get FunctionsControl() {
|
|
57
|
+
return {
|
|
58
|
+
open: (imageSelected) => this.handlerSelectImage(undefined, imageSelected),
|
|
59
|
+
viewerRef: this.ViewerRef,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
async handlerSelectImage(event, imageSelected) {
|
|
63
|
+
event?.stopPropagation();
|
|
64
|
+
if (this.viewerRef) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const viewerComponent = await Promise.resolve().then(function () { return viewer_component; }).then((c) => c.LibsUiComponentsGalleryViewerComponent);
|
|
68
|
+
this.viewerRef = this.dynamicComponent.resolveComponentFactory(viewerComponent);
|
|
69
|
+
this.outFunctionsControl.emit({ viewerRef: this.ViewerRef, open: (imageSelected) => this.handlerSelectImage(undefined, imageSelected) });
|
|
70
|
+
this.viewerRef.setInput('fieldDisplaySrcImage', this.fieldDisplaySrcImage());
|
|
71
|
+
this.viewerRef.setInput('images', this.images());
|
|
72
|
+
this.viewerRef.setInput('imageSelected', imageSelected);
|
|
73
|
+
this.viewerRef.setInput('zIndex', this.zIndex());
|
|
74
|
+
this.viewerRef.setInput('singleImage', this.images().length <= 1);
|
|
75
|
+
const sub = this.viewerRef.instance.outClose.subscribe(() => {
|
|
76
|
+
sub.unsubscribe();
|
|
77
|
+
this.closePopup();
|
|
78
|
+
});
|
|
79
|
+
this.dynamicComponent.addToBody(this.viewerRef);
|
|
80
|
+
this.outViewerEvent.emit('show');
|
|
81
|
+
if (isEmbedFrame()) {
|
|
82
|
+
const data = {
|
|
83
|
+
type: UtilsCommunicateMicroKeyGlobal.KEY_MESSAGE_MODAL,
|
|
84
|
+
response: {
|
|
85
|
+
message: 'open',
|
|
86
|
+
state: true,
|
|
87
|
+
idOverlay: this.idOverlay,
|
|
88
|
+
timeLiveUpdate: getDayjs().unix(),
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
UtilsCommunicateMicro.PostMessageToParent(data);
|
|
92
|
+
this.idInterval.set(setInterval(() => {
|
|
93
|
+
data.response.timeLiveUpdate = getDayjs().unix();
|
|
94
|
+
UtilsCommunicateMicro.PostMessageToParent(data);
|
|
95
|
+
}, 2000));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
handlerImageError(e, image) {
|
|
99
|
+
const event = e;
|
|
100
|
+
event.stopPropagation();
|
|
101
|
+
image['isError'] = true;
|
|
102
|
+
}
|
|
103
|
+
closePopup() {
|
|
104
|
+
clearInterval(this.idInterval());
|
|
105
|
+
if (this.viewerRef) {
|
|
106
|
+
this.outViewerEvent.emit('remove');
|
|
107
|
+
if (isEmbedFrame()) {
|
|
108
|
+
const data = {
|
|
109
|
+
type: UtilsCommunicateMicroKeyGlobal.KEY_MESSAGE_MODAL,
|
|
110
|
+
response: {
|
|
111
|
+
message: 'close',
|
|
112
|
+
state: false,
|
|
113
|
+
idOverlay: this.idOverlay,
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
UtilsCommunicateMicro.PostMessageToParent(data);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
this.dynamicComponent.remove(this.viewerRef);
|
|
120
|
+
this.viewerRef = undefined;
|
|
121
|
+
this.outFunctionsControl.emit({ viewerRef: this.ViewerRef, open: (imageSelected) => this.handlerSelectImage(undefined, imageSelected) });
|
|
122
|
+
}
|
|
123
|
+
get ViewerRef() {
|
|
124
|
+
return this.viewerRef;
|
|
125
|
+
}
|
|
126
|
+
ngOnDestroy() {
|
|
127
|
+
this.viewerRef?.destroy();
|
|
128
|
+
this.closePopup();
|
|
129
|
+
}
|
|
130
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsGalleryComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
131
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", 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 w-full h-full\">\n @for (image of imagesDisplay(); track $index) {\n <div\n #itemRef\n class=\"w-full h-full rounded-[4px] overflow-hidden relative cursor-pointer\"\n [class.mr-[8px]]=\"!$last\"\n (click)=\"handlerSelectImage($event, image)\">\n <div class=\"flex items-center justify-center w-full h-full\">\n @if (!image['isError']) {\n <img\n [src]=\"image[fieldDisplaySrcImage()]\"\n class=\"flex max-w-full max-h-full m-auto\"\n (error)=\"handlerImageError($event, image)\" />\n }\n @if (image['isError']) {\n <div *ngComponentOutlet=\"'image-default' | LibsUiIconsGetIconComponentPipe | async; inputs: { size: itemRef.clientWidth }\"></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-black/15\">\n <span class=\"libs-ui-font-h5m text-white\">+{{ 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 });
|
|
132
|
+
}
|
|
133
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsGalleryComponent, decorators: [{
|
|
134
|
+
type: Component,
|
|
135
|
+
args: [{ selector: 'libs_ui-components-gallery', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgComponentOutlet, AsyncPipe, LibsUiIconsGetIconComponentPipe], template: "@if (images()) {\n <div class=\"flex w-full h-full\">\n @for (image of imagesDisplay(); track $index) {\n <div\n #itemRef\n class=\"w-full h-full rounded-[4px] overflow-hidden relative cursor-pointer\"\n [class.mr-[8px]]=\"!$last\"\n (click)=\"handlerSelectImage($event, image)\">\n <div class=\"flex items-center justify-center w-full h-full\">\n @if (!image['isError']) {\n <img\n [src]=\"image[fieldDisplaySrcImage()]\"\n class=\"flex max-w-full max-h-full m-auto\"\n (error)=\"handlerImageError($event, image)\" />\n }\n @if (image['isError']) {\n <div *ngComponentOutlet=\"'image-default' | LibsUiIconsGetIconComponentPipe | async; inputs: { size: itemRef.clientWidth }\"></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-black/15\">\n <span class=\"libs-ui-font-h5m text-white\">+{{ images().length - end() }}</span>\n </div>\n }\n </div>\n }\n </div>\n}\n" }]
|
|
136
|
+
}], ctorParameters: () => [] });
|
|
137
|
+
|
|
138
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
139
|
+
class LibsUiComponentsGalleryViewerComponent {
|
|
140
|
+
// #region PROPERTY
|
|
141
|
+
indexSelected = signal(0);
|
|
142
|
+
scaleValue = signal(1);
|
|
143
|
+
ratio = signal('100%');
|
|
144
|
+
fullScreen = signal(false);
|
|
145
|
+
isShowButton = signal(false);
|
|
146
|
+
disable = signal(true);
|
|
147
|
+
hoverContentViewImage = signal(false);
|
|
148
|
+
step = signal(0.1);
|
|
149
|
+
draggableEl = signal(null);
|
|
150
|
+
widthDefault = signal(0);
|
|
151
|
+
heightDefault = signal(0);
|
|
152
|
+
viewPort = signal(undefined);
|
|
153
|
+
canDrag = signal(false);
|
|
154
|
+
widthImage = signal(0);
|
|
155
|
+
isFirstRender = signal(false);
|
|
156
|
+
timeouts = signal([]);
|
|
157
|
+
// #region INPUT
|
|
158
|
+
images = input.required();
|
|
159
|
+
fieldDisplaySrcImage = input.required();
|
|
160
|
+
imageSelected = model();
|
|
161
|
+
removeBackdrop = input();
|
|
162
|
+
zIndex = input(1200, { transform: (val) => val ?? 1200 });
|
|
163
|
+
singleImage = input(false);
|
|
164
|
+
classContainerInclude = input();
|
|
165
|
+
// #region OUTPUT
|
|
166
|
+
outClose = output();
|
|
167
|
+
// #region VIEW CHILD
|
|
168
|
+
containerRef = viewChild('containerRef');
|
|
169
|
+
singleImageRef = viewChild('singleImageRef');
|
|
170
|
+
elementRatioRef = viewChild('elementRatioRef');
|
|
171
|
+
fullContainerRef = viewChild('fullContainerRef');
|
|
172
|
+
imagesRef = viewChildren('imagesRef');
|
|
173
|
+
destroyRef = inject(DestroyRef);
|
|
174
|
+
constructor() {
|
|
175
|
+
effect(() => {
|
|
176
|
+
if (this.singleImage()) {
|
|
177
|
+
if (this.images().length) {
|
|
178
|
+
untracked(() => {
|
|
179
|
+
this.imageSelected.set(this.images()[0]);
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
untracked(() => {
|
|
185
|
+
const indexSelected = this.images().findIndex((item) => item[this.fieldDisplaySrcImage()] === this.imageSelected()?.[this.fieldDisplaySrcImage()]);
|
|
186
|
+
this.indexSelected.set(indexSelected);
|
|
187
|
+
this.createTimeout((id) => {
|
|
188
|
+
this.clearTimeout(id);
|
|
189
|
+
this.imagesRef()[this.indexSelected()].nativeElement.scrollIntoView();
|
|
190
|
+
}, 100);
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
ngAfterViewInit() {
|
|
195
|
+
fromEvent(document, 'keyup')
|
|
196
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
197
|
+
.subscribe((event) => {
|
|
198
|
+
event.stopPropagation();
|
|
199
|
+
if (event.key === 'Escape') {
|
|
200
|
+
this.handlerClosePopup(event);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
if (event.key === 'ArrowLeft') {
|
|
204
|
+
this.handlerPreviousImage(event);
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
if (event.key === 'ArrowRight') {
|
|
208
|
+
this.handlerNextImage(event);
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
this.isFirstRender.set(true);
|
|
213
|
+
fromEvent(window, 'resize').pipe(takeUntilDestroyed(this.destroyRef)).subscribe(this.setWidthImages.bind(this));
|
|
214
|
+
this.createTimeout((id) => {
|
|
215
|
+
this.clearTimeout(id);
|
|
216
|
+
this.setWidthImages();
|
|
217
|
+
}, 300);
|
|
218
|
+
}
|
|
219
|
+
/* FUNCTIONS */
|
|
220
|
+
setWidthImages() {
|
|
221
|
+
const singleImageRef = this.singleImageRef();
|
|
222
|
+
if (singleImageRef) {
|
|
223
|
+
singleImageRef.nativeElement.style.width = '';
|
|
224
|
+
singleImageRef.nativeElement.style.height = '';
|
|
225
|
+
}
|
|
226
|
+
this.viewPort.set(this.containerRef()?.nativeElement.getBoundingClientRect());
|
|
227
|
+
const img = new Image();
|
|
228
|
+
img.src = this.imageSelected()?.[this.fieldDisplaySrcImage()];
|
|
229
|
+
img.onload = () => {
|
|
230
|
+
this.widthDefault.set(img.naturalWidth);
|
|
231
|
+
this.heightDefault.set(img.naturalHeight);
|
|
232
|
+
this.widthImage.set(this.singleImageRef()?.nativeElement.width);
|
|
233
|
+
this.setStyleSelectImage();
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
handlerImageError(e, image) {
|
|
237
|
+
const event = e;
|
|
238
|
+
event.stopPropagation();
|
|
239
|
+
image['isError'] = true;
|
|
240
|
+
}
|
|
241
|
+
handlerShowButton(isShow) {
|
|
242
|
+
this.isShowButton.set(isShow);
|
|
243
|
+
}
|
|
244
|
+
handlerMouseEvent(event, status) {
|
|
245
|
+
event.stopPropagation();
|
|
246
|
+
this.hoverContentViewImage.set(status);
|
|
247
|
+
}
|
|
248
|
+
handlerClosePopup(e) {
|
|
249
|
+
e.stopPropagation();
|
|
250
|
+
this.outClose.emit();
|
|
251
|
+
}
|
|
252
|
+
handlerZoom(event, type) {
|
|
253
|
+
event.stopPropagation();
|
|
254
|
+
this.isFirstRender.set(false);
|
|
255
|
+
this.disable.set(false);
|
|
256
|
+
const element = this.singleImageRef()?.nativeElement;
|
|
257
|
+
if (!element) {
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
const draggableEl = this.makeElementDraggable({
|
|
261
|
+
element: element,
|
|
262
|
+
isOverflowHiddenDesired: true,
|
|
263
|
+
});
|
|
264
|
+
this.draggableEl.set(draggableEl);
|
|
265
|
+
if (((this.scaleValue() * this.widthDefault()) / this.widthImage()) * 100 < 1) {
|
|
266
|
+
this.scaleValue.set(((1 / 100) * this.widthImage()) / this.widthDefault());
|
|
267
|
+
}
|
|
268
|
+
if (((this.scaleValue() * this.widthDefault()) / this.widthImage()) * 100 > 5000 * 0.9) {
|
|
269
|
+
this.scaleValue.set((((5000 * 0.9) / 100) * this.widthImage()) / this.widthDefault());
|
|
270
|
+
}
|
|
271
|
+
if (type === 'in') {
|
|
272
|
+
const scaleValue = this.scaleValue() * (1 + this.step());
|
|
273
|
+
this.scaleValue.set(scaleValue);
|
|
274
|
+
}
|
|
275
|
+
if (type === 'out') {
|
|
276
|
+
const scaleValue = this.scaleValue() / (1 + this.step());
|
|
277
|
+
this.scaleValue.set(scaleValue);
|
|
278
|
+
}
|
|
279
|
+
this.setWidthHeight(element);
|
|
280
|
+
element.style.position = `absolute`;
|
|
281
|
+
if (!this.canDrag() && this.draggableEl() && this.draggableEl()?.stopDraggableBehavior) {
|
|
282
|
+
this.draggableEl()?.stopDraggableBehavior?.();
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
handlerNextImage(e) {
|
|
286
|
+
const indexSelected = this.indexSelected() + 1;
|
|
287
|
+
this.handlerSelectImage(e, this.images()[indexSelected], indexSelected);
|
|
288
|
+
}
|
|
289
|
+
handlerPreviousImage(e) {
|
|
290
|
+
const indexSelected = this.indexSelected() - 1;
|
|
291
|
+
this.handlerSelectImage(e, this.images()[indexSelected], indexSelected);
|
|
292
|
+
}
|
|
293
|
+
handlerSelectImage(e, imageSelected, indexSelected) {
|
|
294
|
+
e.stopPropagation();
|
|
295
|
+
if (!imageSelected) {
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
this.isFirstRender.set(true);
|
|
299
|
+
const elementRatio = this.elementRatioRef()?.nativeElement;
|
|
300
|
+
if (elementRatio) {
|
|
301
|
+
elementRatio.style.display = 'none';
|
|
302
|
+
}
|
|
303
|
+
this.imageSelected.set(imageSelected);
|
|
304
|
+
this.indexSelected.set(indexSelected);
|
|
305
|
+
this.scaleValue.set(1);
|
|
306
|
+
this.imagesRef()[indexSelected].nativeElement.scrollIntoView();
|
|
307
|
+
this.setWidthImages();
|
|
308
|
+
}
|
|
309
|
+
handlerFullScreen() {
|
|
310
|
+
this.createTimeout((id) => {
|
|
311
|
+
this.clearTimeout(id);
|
|
312
|
+
this.disable.set(true);
|
|
313
|
+
const element = this.singleImageRef()?.nativeElement;
|
|
314
|
+
const fullElement = this.fullContainerRef()?.nativeElement;
|
|
315
|
+
this.fullScreen.set(!this.fullScreen());
|
|
316
|
+
if (!fullElement) {
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
if (this.fullScreen()) {
|
|
320
|
+
fullElement.style.width = '95%';
|
|
321
|
+
fullElement.style.height = '95%';
|
|
322
|
+
}
|
|
323
|
+
if (!this.fullScreen()) {
|
|
324
|
+
fullElement.style.width = '80%';
|
|
325
|
+
fullElement.style.height = '90%';
|
|
326
|
+
}
|
|
327
|
+
this.viewPort.set(this.containerRef()?.nativeElement.getBoundingClientRect());
|
|
328
|
+
if (!element) {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
this.setStyleSelectImage(true);
|
|
332
|
+
element.style.left = `unset`;
|
|
333
|
+
element.style.top = `unset`;
|
|
334
|
+
}, 0);
|
|
335
|
+
}
|
|
336
|
+
handlerReset() {
|
|
337
|
+
this.disable.set(true);
|
|
338
|
+
this.setStyleSelectImage(true);
|
|
339
|
+
}
|
|
340
|
+
makeElementDraggable = ({ element, DRAGGABLE_CSS_CLASS = 'draggable-element' }) => {
|
|
341
|
+
if (!element) {
|
|
342
|
+
return null;
|
|
343
|
+
}
|
|
344
|
+
const isTheRequiredCSSAlreadyInPlace = !!Array.from(element.ownerDocument.getElementsByTagName('style')).filter((styleEl) => styleEl?.textContent?.includes(`.${DRAGGABLE_CSS_CLASS}`))?.[0];
|
|
345
|
+
if (!isTheRequiredCSSAlreadyInPlace) {
|
|
346
|
+
element.ownerDocument.body.appendChild(Object.assign(element.ownerDocument.createElement('style'), {
|
|
347
|
+
textContent: `
|
|
348
|
+
.${DRAGGABLE_CSS_CLASS} {
|
|
349
|
+
position: absolute;
|
|
350
|
+
cursor: grabbing !important;
|
|
351
|
+
}
|
|
352
|
+
`,
|
|
353
|
+
}));
|
|
354
|
+
}
|
|
355
|
+
if (!element.classList.contains(DRAGGABLE_CSS_CLASS)) {
|
|
356
|
+
element.classList.add(DRAGGABLE_CSS_CLASS);
|
|
357
|
+
}
|
|
358
|
+
element.onmousedown = (mouseDownEvent) => {
|
|
359
|
+
mouseDownEvent.preventDefault();
|
|
360
|
+
element.onmousemove = (mouseMoveEvent) => {
|
|
361
|
+
mouseMoveEvent.preventDefault();
|
|
362
|
+
const rectElement = element.getBoundingClientRect();
|
|
363
|
+
if (rectElement.left + rectElement.width + mouseMoveEvent.movementX > (this.viewPort()?.width || 0) + (this.viewPort()?.left || 0) && rectElement.left + mouseMoveEvent.movementX < (this.viewPort()?.left || 0)) {
|
|
364
|
+
element.style.left = `${element.offsetLeft + mouseMoveEvent.movementX}px`;
|
|
365
|
+
}
|
|
366
|
+
if (rectElement.top + rectElement.height + mouseMoveEvent.movementY > (this.viewPort()?.height || 0) + (this.viewPort()?.top || 0) && rectElement.top + mouseMoveEvent.movementY < (this.viewPort()?.top || 0)) {
|
|
367
|
+
element.style.top = `${element.offsetTop + mouseMoveEvent.movementY}px`;
|
|
368
|
+
}
|
|
369
|
+
};
|
|
370
|
+
};
|
|
371
|
+
element.ownerDocument.onmouseup = (mouseUpEvent) => {
|
|
372
|
+
mouseUpEvent.preventDefault();
|
|
373
|
+
element.onmousemove = null;
|
|
374
|
+
};
|
|
375
|
+
return Object.assign(element, {
|
|
376
|
+
stopDraggableBehavior() {
|
|
377
|
+
element.classList.remove(DRAGGABLE_CSS_CLASS);
|
|
378
|
+
element.onmousedown = null;
|
|
379
|
+
element.onmousemove = null;
|
|
380
|
+
element.onmouseup = null;
|
|
381
|
+
element.style.left = 'unset';
|
|
382
|
+
element.style.top = 'unset';
|
|
383
|
+
return element;
|
|
384
|
+
},
|
|
385
|
+
});
|
|
386
|
+
};
|
|
387
|
+
setStyleSelectImage(reset) {
|
|
388
|
+
const element = this.singleImageRef()?.nativeElement;
|
|
389
|
+
if (!element) {
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
const scaleValue = (this.viewPort()?.width || 0) / this.widthDefault() < ((this.viewPort()?.height || 0) - (this.singleImage() ? 0 : 40)) / this.heightDefault()
|
|
393
|
+
? (this.viewPort()?.width || 0) / this.widthDefault()
|
|
394
|
+
: ((this.viewPort()?.height || 0) - (this.singleImage() ? 0 : 40)) / this.heightDefault();
|
|
395
|
+
this.scaleValue.set(scaleValue);
|
|
396
|
+
if (this.scaleValue() > 1 && (reset || this.isFirstRender()) && !this.fullScreen()) {
|
|
397
|
+
this.scaleValue.set(1);
|
|
398
|
+
}
|
|
399
|
+
this.setWidthHeight(element);
|
|
400
|
+
if (this.fullScreen()) {
|
|
401
|
+
element.style.position = `unset`;
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
setWidthHeight(element) {
|
|
406
|
+
element.style.width = `${this.scaleValue() * this.widthDefault()}px`;
|
|
407
|
+
element.style.height = `${this.scaleValue() * this.heightDefault()}px`;
|
|
408
|
+
this.canDrag.set(false);
|
|
409
|
+
const rectElement = element.getBoundingClientRect();
|
|
410
|
+
if (rectElement.width > (this.viewPort()?.width || 0) || rectElement.height > (this.viewPort()?.height || 0)) {
|
|
411
|
+
this.canDrag.set(true);
|
|
412
|
+
}
|
|
413
|
+
if (rectElement.left + rectElement.width < (this.viewPort()?.width || 0) + (this.viewPort()?.left || 0) || rectElement.left > (this.viewPort()?.left || 0)) {
|
|
414
|
+
element.style.left = `unset`;
|
|
415
|
+
}
|
|
416
|
+
if (rectElement.top + rectElement.height < (this.viewPort()?.top || 0) + (this.viewPort()?.height || 0) || rectElement.top > (this.viewPort()?.top || 0)) {
|
|
417
|
+
element.style.top = `unset`;
|
|
418
|
+
}
|
|
419
|
+
this.setDisplayRatio();
|
|
420
|
+
}
|
|
421
|
+
setDisplayRatio() {
|
|
422
|
+
const element = this.singleImageRef()?.nativeElement;
|
|
423
|
+
this.ratio.set(`${viewDataNumberByLanguage((element.width / this.widthDefault()) * 100, false, 0)}%`);
|
|
424
|
+
const elementRatio = this.elementRatioRef()?.nativeElement;
|
|
425
|
+
elementRatio.style.display = 'flex';
|
|
426
|
+
this.createTimeout((id) => {
|
|
427
|
+
this.clearTimeout(id);
|
|
428
|
+
elementRatio.style.display = 'none';
|
|
429
|
+
}, 1000);
|
|
430
|
+
}
|
|
431
|
+
createTimeout(callback, delay) {
|
|
432
|
+
const timeoutId = setTimeout(() => callback(timeoutId), delay);
|
|
433
|
+
this.timeouts.update((ids) => [...ids, timeoutId]);
|
|
434
|
+
}
|
|
435
|
+
clearTimeout(id) {
|
|
436
|
+
clearTimeout(id);
|
|
437
|
+
this.timeouts.update((ids) => ids.filter((idStore) => idStore !== id));
|
|
438
|
+
}
|
|
439
|
+
ngOnDestroy() {
|
|
440
|
+
this.timeouts().forEach((item) => clearTimeout(item));
|
|
441
|
+
}
|
|
442
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsGalleryViewerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
443
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", 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 }, classContainerInclude: { classPropertyName: "classContainerInclude", publicName: "classContainerInclude", 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\n class=\"libs-ui-gallery-img-popup libs-ui-gallery-img-popup-backdrop\"\n [class.!bg-[transparent]]=\"removeBackdrop()\"\n [style.zIndex]=\"zIndex()\">\n <div\n #fullContainerRef\n class=\"libs-ui-gallery-img-popup-container {{ classContainerInclude() || '' }}\">\n <div class=\"flex w-full justify-end mb-[16px] z-10\">\n <i\n class=\"libs-ui-icon-close text-[24px] p-[4px] rounded-[4px] text-[#ffffff] cursor-pointer bg-[#030B184D] hover:bg-[#030B1826]\"\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\n class=\"flex flex-col w-full h-full relative\"\n (mouseenter)=\"handlerShowButton(true)\"\n (mouseleave)=\"handlerShowButton(false)\">\n <div\n #containerRef\n class=\"flex w-full h-full relative\">\n <div\n 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\n #singleImageRef\n [src]=\"imageSelected[fieldDisplaySrcImage()]\"\n class=\"flex m-[auto]\"\n (error)=\"handlerImageError($event, imageSelected)\" />\n }\n <div\n #elementRatioRef\n class=\"libs-ui-gallery-img-popup-container-preview-ratio flex 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\n 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: zIndex() + 100 }\">\n <i\n class=\"libs-ui-gallery-img-popup-container-preview-button rounded-l-[8px] libs-ui-icon-zoom-out before:text-[16px]\"\n (click)=\"handlerZoom($event, 'out')\"></i>\n </libs_ui-components-popover>\n <libs_ui-components-popover [config]=\"{ content: 'i18n_zoom_in', direction: 'top', zIndex: zIndex() + 100 }\">\n <i\n class=\"libs-ui-gallery-img-popup-container-preview-button libs-ui-icon-zoom-in before:text-[16px]\"\n (click)=\"handlerZoom($event, 'in')\"></i>\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: zIndex() + 100 }\">\n <div\n 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\n 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\n class=\"libs-ui-icon-refresh text-16px mr-[8px]\"\n [class.text-[#ffffff]]=\"!disable()\"\n [class.text-[#6a7383]]=\"disable()\"></i>\n <div\n class=\"libs-ui-font-h5r libs-ui-gallery-text-restore\"\n [class.text-[#ffffff]]=\"!disable()\"\n [class.text-[#6a7383]]=\"disable()\">\n {{ 'i18n_restore' | translate }}\n </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\n class=\"rotate-180\"\n [class.cursor-pointer]=\"indexSelected() !== 0\"\n [class.pointer-events-none]=\"indexSelected() === 0\"\n (click)=\"handlerPreviousImage($event)\">\n <i\n 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 items-center\">{{ indexSelected() + 1 }}/{{ images().length }}</div>\n\n @if (fullScreen()) {\n <div class=\"ml-[16px] flex items-center\">\n <div\n [class.cursor-pointer]=\"indexSelected() !== images().length - 1\"\n [class.pointer-events-none]=\"indexSelected() === images().length - 1\"\n (click)=\"handlerNextImage($event)\">\n <i\n 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\n 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\n class=\"rotate-180\"\n [class.cursor-pointer]=\"indexSelected() !== 0\"\n [class.pointer-events-none]=\"indexSelected() === 0\"\n (click)=\"handlerPreviousImage($event)\">\n <i\n 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 overflow-hidden\">\n <div class=\"flex h-full overflow-hidden\">\n @for (image of images(); track index; let index = $index; let last = $last) {\n <div\n #imagesRef\n class=\"libs-ui-gallery-img-popup-container-list-item\"\n [class.mr-[12px]]=\"!last\"\n [style.width.px]=\"imagesRef.offsetHeight\"\n [attr.active]=\"image[fieldDisplaySrcImage()] === imageSelected()?.[fieldDisplaySrcImage()]\">\n <div\n 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\n [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\n [class.cursor-pointer]=\"indexSelected() !== images().length - 1\"\n [class.pointer-events-none]=\"indexSelected() === images().length - 1\"\n (click)=\"handlerNextImage($event)\">\n <i\n 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:fixed;top:0;left:0;z-index:1000;justify-content:center}.libs-ui-gallery-img-popup-backdrop{background-color:#030b1850;backdrop-filter:blur(3px)}.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-preview .libs-ui-gallery-img-popup-container-preview-button:hover .libs-ui-gallery-text-restore{color:#fff}.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", "initEventInElementRefCustom", "classInclude", "ignoreHiddenPopoverContentWhenMouseLeave", "ignoreStopPropagationEvent", "ignoreCursorPointerModeLikeClick", "isAddContentToParentDocument", "ignoreClickOutside"], outputs: ["outEvent", "outChangStageFlagMouse", "outEventPopoverContent", "outFunctionsControl"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
444
|
+
}
|
|
445
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsGalleryViewerComponent, decorators: [{
|
|
446
|
+
type: Component,
|
|
447
|
+
args: [{ selector: 'libs_ui-components-gallery-viewer', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [TranslateModule, LibsUiComponentsPopoverComponent], template: "@if (images() || singleImage()) {\n <div\n class=\"libs-ui-gallery-img-popup libs-ui-gallery-img-popup-backdrop\"\n [class.!bg-[transparent]]=\"removeBackdrop()\"\n [style.zIndex]=\"zIndex()\">\n <div\n #fullContainerRef\n class=\"libs-ui-gallery-img-popup-container {{ classContainerInclude() || '' }}\">\n <div class=\"flex w-full justify-end mb-[16px] z-10\">\n <i\n class=\"libs-ui-icon-close text-[24px] p-[4px] rounded-[4px] text-[#ffffff] cursor-pointer bg-[#030B184D] hover:bg-[#030B1826]\"\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\n class=\"flex flex-col w-full h-full relative\"\n (mouseenter)=\"handlerShowButton(true)\"\n (mouseleave)=\"handlerShowButton(false)\">\n <div\n #containerRef\n class=\"flex w-full h-full relative\">\n <div\n 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\n #singleImageRef\n [src]=\"imageSelected[fieldDisplaySrcImage()]\"\n class=\"flex m-[auto]\"\n (error)=\"handlerImageError($event, imageSelected)\" />\n }\n <div\n #elementRatioRef\n class=\"libs-ui-gallery-img-popup-container-preview-ratio flex 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\n 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: zIndex() + 100 }\">\n <i\n class=\"libs-ui-gallery-img-popup-container-preview-button rounded-l-[8px] libs-ui-icon-zoom-out before:text-[16px]\"\n (click)=\"handlerZoom($event, 'out')\"></i>\n </libs_ui-components-popover>\n <libs_ui-components-popover [config]=\"{ content: 'i18n_zoom_in', direction: 'top', zIndex: zIndex() + 100 }\">\n <i\n class=\"libs-ui-gallery-img-popup-container-preview-button libs-ui-icon-zoom-in before:text-[16px]\"\n (click)=\"handlerZoom($event, 'in')\"></i>\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: zIndex() + 100 }\">\n <div\n 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\n 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\n class=\"libs-ui-icon-refresh text-16px mr-[8px]\"\n [class.text-[#ffffff]]=\"!disable()\"\n [class.text-[#6a7383]]=\"disable()\"></i>\n <div\n class=\"libs-ui-font-h5r libs-ui-gallery-text-restore\"\n [class.text-[#ffffff]]=\"!disable()\"\n [class.text-[#6a7383]]=\"disable()\">\n {{ 'i18n_restore' | translate }}\n </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\n class=\"rotate-180\"\n [class.cursor-pointer]=\"indexSelected() !== 0\"\n [class.pointer-events-none]=\"indexSelected() === 0\"\n (click)=\"handlerPreviousImage($event)\">\n <i\n 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 items-center\">{{ indexSelected() + 1 }}/{{ images().length }}</div>\n\n @if (fullScreen()) {\n <div class=\"ml-[16px] flex items-center\">\n <div\n [class.cursor-pointer]=\"indexSelected() !== images().length - 1\"\n [class.pointer-events-none]=\"indexSelected() === images().length - 1\"\n (click)=\"handlerNextImage($event)\">\n <i\n 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\n 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\n class=\"rotate-180\"\n [class.cursor-pointer]=\"indexSelected() !== 0\"\n [class.pointer-events-none]=\"indexSelected() === 0\"\n (click)=\"handlerPreviousImage($event)\">\n <i\n 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 overflow-hidden\">\n <div class=\"flex h-full overflow-hidden\">\n @for (image of images(); track index; let index = $index; let last = $last) {\n <div\n #imagesRef\n class=\"libs-ui-gallery-img-popup-container-list-item\"\n [class.mr-[12px]]=\"!last\"\n [style.width.px]=\"imagesRef.offsetHeight\"\n [attr.active]=\"image[fieldDisplaySrcImage()] === imageSelected()?.[fieldDisplaySrcImage()]\">\n <div\n 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\n [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\n [class.cursor-pointer]=\"indexSelected() !== images().length - 1\"\n [class.pointer-events-none]=\"indexSelected() === images().length - 1\"\n (click)=\"handlerNextImage($event)\">\n <i\n 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:fixed;top:0;left:0;z-index:1000;justify-content:center}.libs-ui-gallery-img-popup-backdrop{background-color:#030b1850;backdrop-filter:blur(3px)}.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-preview .libs-ui-gallery-img-popup-container-preview-button:hover .libs-ui-gallery-text-restore{color:#fff}.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"] }]
|
|
448
|
+
}], ctorParameters: () => [] });
|
|
449
|
+
|
|
450
|
+
var viewer_component = /*#__PURE__*/Object.freeze({
|
|
451
|
+
__proto__: null,
|
|
452
|
+
LibsUiComponentsGalleryViewerComponent: LibsUiComponentsGalleryViewerComponent
|
|
453
|
+
});
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* Generated bundle index. Do not edit.
|
|
457
|
+
*/
|
|
458
|
+
|
|
459
|
+
export { LibsUiComponentsGalleryComponent, LibsUiComponentsGalleryViewerComponent };
|
|
460
|
+
//# sourceMappingURL=libs-ui-components-gallery.mjs.map
|