s4y-ui 5.5.1 → 5.6.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/fesm2022/s4y-ui.mjs +191 -3
- package/fesm2022/s4y-ui.mjs.map +1 -1
- package/lib/components/image/components/image-preview/image-preview.component.d.ts +22 -0
- package/lib/components/image/image.component.d.ts +28 -0
- package/lib/components/image/image.service.d.ts +12 -0
- package/lib/components/image/index.d.ts +2 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
- package/src/assets/icons/fullscreen-exit-line.svg +1 -0
- package/src/assets/icons/fullscreen-line.svg +1 -0
- package/src/assets/icons/refresh-line.svg +1 -0
- package/src/assets/icons/zoom-in-line.svg +1 -0
- package/src/assets/icons/zoom-out-line.svg +1 -0
- package/src/scss/styles.scss +132 -0
- package/src/scss/styles.scss.map +1 -1
package/fesm2022/s4y-ui.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { ContentChild, Component, signal, computed, Injectable, inject, input, HostBinding, Input, ChangeDetectionStrategy, NgModule, booleanAttribute, forwardRef, HostListener, Directive, EventEmitter, Output, model, output, ViewEncapsulation, effect, Inject, TemplateRef, ViewChild, ContentChildren, ElementRef, ViewContainerRef, InjectionToken, Injector } from '@angular/core';
|
|
2
|
+
import { ContentChild, Component, signal, computed, Injectable, inject, input, HostBinding, Input, ChangeDetectionStrategy, NgModule, booleanAttribute, forwardRef, HostListener, Directive, EventEmitter, Output, model, output, ViewEncapsulation, effect, Inject, TemplateRef, ViewChild, ContentChildren, ElementRef, ViewContainerRef, viewChild, Renderer2, DestroyRef, InjectionToken, Injector } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
4
|
import { CommonModule, AsyncPipe, JsonPipe, NgClass, NgTemplateOutlet, DOCUMENT, NgIf, NgStyle } from '@angular/common';
|
|
5
5
|
import * as i1$1 from '@angular/platform-browser';
|
|
@@ -14,7 +14,8 @@ import * as i2 from '@angular/forms';
|
|
|
14
14
|
import { NG_VALUE_ACCESSOR, NgControl, FormsModule } from '@angular/forms';
|
|
15
15
|
import { trigger, transition, animate, style, group, query, state } from '@angular/animations';
|
|
16
16
|
import { Overlay } from '@angular/cdk/overlay';
|
|
17
|
-
import { TemplatePortal,
|
|
17
|
+
import { TemplatePortal, ComponentPortal, CdkPortalOutlet } from '@angular/cdk/portal';
|
|
18
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
18
19
|
|
|
19
20
|
class DashboardLayoutComponent {
|
|
20
21
|
asideTemplate;
|
|
@@ -3161,6 +3162,193 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
|
|
|
3161
3162
|
}, styles: [":host{display:flex;align-items:center;justify-content:flex-start;gap:.8rem;padding:0 .4rem;min-height:4rem;width:100%;&:hover{text-decoration:underline}}\n"] }]
|
|
3162
3163
|
}] });
|
|
3163
3164
|
|
|
3165
|
+
class ImagePreviewComponent {
|
|
3166
|
+
imgEl = viewChild('imgEl');
|
|
3167
|
+
src = '';
|
|
3168
|
+
name;
|
|
3169
|
+
overlayRef;
|
|
3170
|
+
zoom = signal(1);
|
|
3171
|
+
MIN_ZOOM = 0.5;
|
|
3172
|
+
MAX_ZOOM = 3;
|
|
3173
|
+
ZOOM_STEP = 0.25;
|
|
3174
|
+
fullScreenImage = signal(false);
|
|
3175
|
+
toggleFullscreen() {
|
|
3176
|
+
this.fullScreenImage.update((value) => !value);
|
|
3177
|
+
}
|
|
3178
|
+
zoomOut() {
|
|
3179
|
+
const currentZoom = this.zoom();
|
|
3180
|
+
const newZoom = Math.max(this.MIN_ZOOM, currentZoom - this.ZOOM_STEP);
|
|
3181
|
+
this.zoom.set(newZoom);
|
|
3182
|
+
this.applyZoom();
|
|
3183
|
+
}
|
|
3184
|
+
zoomIn() {
|
|
3185
|
+
const currentZoom = this.zoom();
|
|
3186
|
+
const newZoom = Math.min(this.MAX_ZOOM, currentZoom + this.ZOOM_STEP);
|
|
3187
|
+
this.zoom.set(newZoom);
|
|
3188
|
+
this.applyZoom();
|
|
3189
|
+
}
|
|
3190
|
+
resetZoom() {
|
|
3191
|
+
this.zoom.set(1);
|
|
3192
|
+
this.applyZoom();
|
|
3193
|
+
}
|
|
3194
|
+
applyZoom() {
|
|
3195
|
+
const img = this.imgEl()?.nativeElement;
|
|
3196
|
+
if (img) {
|
|
3197
|
+
img.style.transform = `scale(${this.zoom()})`;
|
|
3198
|
+
}
|
|
3199
|
+
}
|
|
3200
|
+
close() {
|
|
3201
|
+
if (!this.overlayRef)
|
|
3202
|
+
return;
|
|
3203
|
+
this.overlayRef.dispose();
|
|
3204
|
+
}
|
|
3205
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: ImagePreviewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3206
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.15", type: ImagePreviewComponent, isStandalone: true, selector: "s4y-image-preview", viewQueries: [{ propertyName: "imgEl", first: true, predicate: ["imgEl"], descendants: true, isSignal: true }], ngImport: i0, template: "\r\n<div class=\"preview-controls\">\r\n <div class=\"flex gap-1 align-center\">\r\n <button class=\"btn-close action-btn gray-4\" type=\"button\" (click)=\"close()\">\r\n \u2715\r\n </button>\r\n @if (name) {\r\n <p class=\"medium-text-regular fw-400 \" style=\"color: var(--gray-400)\">{{ name }}</p>\r\n }\r\n </div>\r\n\r\n <div class=\"flex gap-2\">\r\n <button class=\"action-btn\" type=\"button\" (click)=\"zoomOut()\">\r\n\r\n <ng-container [ngTemplateOutlet]=\"zoomOutSvg\"/>\r\n </button>\r\n <button class=\"action-btn\" type=\"button\" (click)=\"zoomIn()\">\r\n <ng-container [ngTemplateOutlet]=\"zoomInSvg\"/>\r\n </button>\r\n <button class=\"action-btn\" type=\"button\" (click)=\"resetZoom()\">\r\n <ng-container [ngTemplateOutlet]=\"refreshSvg\"/>\r\n </button>\r\n\r\n <button class=\"action-btn\" type=\"button\" (click)=\"toggleFullscreen()\">\r\n <ng-container [ngTemplateOutlet]=\"fullScreenImage() ? fullScreenExitSvg : fullscreenSvg\" />\r\n </button>\r\n </div>\r\n</div>\r\n\r\n\r\n<div class=\"preview-img-container\">\r\n <div class=\"img-preview\" [class.full-screen-img]=\"fullScreenImage()\">\r\n <img\r\n #imgEl\r\n style=\"transform-origin: center center\"\r\n [src]=\"src\"\r\n alt=\"Imagem\"\r\n (dblclick)=\"resetZoom()\"\r\n />\r\n </div>\r\n\r\n <div class=\"preview-clickable\" (click)=\"close()\"></div>\r\n</div>\r\n\r\n\r\n<!-- SVG -->\r\n\r\n<ng-template #fullscreenSvg>\r\n <svg width=\"24px\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M8 3V5H4V9H2V3H8ZM2 21V15H4V19H8V21H2ZM22 21H16V19H20V15H22V21ZM22 9H20V5H16V3H22V9Z\"></path></svg>\r\n</ng-template>\r\n\r\n<ng-template #fullScreenExitSvg>\r\n <svg width=\"24px\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M18 7H22V9H16V3H18V7ZM8 9H2V7H6V3H8V9ZM18 17V21H16V15H22V17H18ZM8 15V21H6V17H2V15H8Z\"></path></svg>\r\n</ng-template>\r\n\r\n<ng-template #zoomInSvg>\r\n <svg width=\"24px\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M18.031 16.6168L22.3137 20.8995L20.8995 22.3137L16.6168 18.031C15.0769 19.263 13.124 20 11 20C6.032 20 2 15.968 2 11C2 6.032 6.032 2 11 2C15.968 2 20 6.032 20 11C20 13.124 19.263 15.0769 18.031 16.6168ZM16.0247 15.8748C17.2475 14.6146 18 12.8956 18 11C18 7.1325 14.8675 4 11 4C7.1325 4 4 7.1325 4 11C4 14.8675 7.1325 18 11 18C12.8956 18 14.6146 17.2475 15.8748 16.0247L16.0247 15.8748ZM10 10V7H12V10H15V12H12V15H10V12H7V10H10Z\"></path></svg>\r\n</ng-template>\r\n<ng-template #zoomOutSvg>\r\n <svg width=\"24px\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M18.031 16.6168L22.3137 20.8995L20.8995 22.3137L16.6168 18.031C15.0769 19.263 13.124 20 11 20C6.032 20 2 15.968 2 11C2 6.032 6.032 2 11 2C15.968 2 20 6.032 20 11C20 13.124 19.263 15.0769 18.031 16.6168ZM16.0247 15.8748C17.2475 14.6146 18 12.8956 18 11C18 7.1325 14.8675 4 11 4C7.1325 4 4 7.1325 4 11C4 14.8675 7.1325 18 11 18C12.8956 18 14.6146 17.2475 15.8748 16.0247L16.0247 15.8748ZM7 10H15V12H7V10Z\"></path></svg>\r\n</ng-template>\r\n\r\n<ng-template #refreshSvg>\r\n <svg width=\"24px\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M5.46257 4.43262C7.21556 2.91688 9.5007 2 12 2C17.5228 2 22 6.47715 22 12C22 14.1361 21.3302 16.1158 20.1892 17.7406L17 12H20C20 7.58172 16.4183 4 12 4C9.84982 4 7.89777 4.84827 6.46023 6.22842L5.46257 4.43262ZM18.5374 19.5674C16.7844 21.0831 14.4993 22 12 22C6.47715 22 2 17.5228 2 12C2 9.86386 2.66979 7.88416 3.8108 6.25944L7 12H4C4 16.4183 7.58172 20 12 20C14.1502 20 16.1022 19.1517 17.5398 17.7716L18.5374 19.5674Z\"></path></svg>\r\n</ng-template>\r\n", styles: [":host{width:100%;display:flex;flex-direction:column;gap:1.2rem;min-height:100dvh}.action-btn{border-radius:50%;height:3rem;width:3rem}.action-btn:hover{transition:.2s ease;background-color:var(--gray-700)}.preview-controls{position:sticky;top:0;z-index:10;display:flex;justify-content:space-between;backdrop-filter:blur(6px);background:color-mix(in oklab,#000 45%,transparent);margin-bottom:.5rem;align-items:center;height:5rem;flex-shrink:0;padding:0 1.8rem}.preview-controls button{line-height:0;color:#fff}.preview-controls .btn-close{font-size:2rem;transition:.2s ease}.preview-img-container{flex-grow:1;z-index:3;position:relative;display:flex;align-items:center;padding-bottom:1.2rem}.img-preview{margin:0 auto;display:flex;align-items:center;justify-content:center;z-index:2;width:90%;max-width:70rem;transition:.5s ease}.img-preview img{height:auto;border-radius:var(--radius);width:100%;transition:.5s ease}.img-preview.full-screen-img{max-width:100%;height:auto}.preview-clickable{position:absolute;left:0;top:0;width:100%;height:100%;z-index:1}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
3207
|
+
}
|
|
3208
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: ImagePreviewComponent, decorators: [{
|
|
3209
|
+
type: Component,
|
|
3210
|
+
args: [{ selector: 's4y-image-preview', imports: [NgTemplateOutlet], template: "\r\n<div class=\"preview-controls\">\r\n <div class=\"flex gap-1 align-center\">\r\n <button class=\"btn-close action-btn gray-4\" type=\"button\" (click)=\"close()\">\r\n \u2715\r\n </button>\r\n @if (name) {\r\n <p class=\"medium-text-regular fw-400 \" style=\"color: var(--gray-400)\">{{ name }}</p>\r\n }\r\n </div>\r\n\r\n <div class=\"flex gap-2\">\r\n <button class=\"action-btn\" type=\"button\" (click)=\"zoomOut()\">\r\n\r\n <ng-container [ngTemplateOutlet]=\"zoomOutSvg\"/>\r\n </button>\r\n <button class=\"action-btn\" type=\"button\" (click)=\"zoomIn()\">\r\n <ng-container [ngTemplateOutlet]=\"zoomInSvg\"/>\r\n </button>\r\n <button class=\"action-btn\" type=\"button\" (click)=\"resetZoom()\">\r\n <ng-container [ngTemplateOutlet]=\"refreshSvg\"/>\r\n </button>\r\n\r\n <button class=\"action-btn\" type=\"button\" (click)=\"toggleFullscreen()\">\r\n <ng-container [ngTemplateOutlet]=\"fullScreenImage() ? fullScreenExitSvg : fullscreenSvg\" />\r\n </button>\r\n </div>\r\n</div>\r\n\r\n\r\n<div class=\"preview-img-container\">\r\n <div class=\"img-preview\" [class.full-screen-img]=\"fullScreenImage()\">\r\n <img\r\n #imgEl\r\n style=\"transform-origin: center center\"\r\n [src]=\"src\"\r\n alt=\"Imagem\"\r\n (dblclick)=\"resetZoom()\"\r\n />\r\n </div>\r\n\r\n <div class=\"preview-clickable\" (click)=\"close()\"></div>\r\n</div>\r\n\r\n\r\n<!-- SVG -->\r\n\r\n<ng-template #fullscreenSvg>\r\n <svg width=\"24px\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M8 3V5H4V9H2V3H8ZM2 21V15H4V19H8V21H2ZM22 21H16V19H20V15H22V21ZM22 9H20V5H16V3H22V9Z\"></path></svg>\r\n</ng-template>\r\n\r\n<ng-template #fullScreenExitSvg>\r\n <svg width=\"24px\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M18 7H22V9H16V3H18V7ZM8 9H2V7H6V3H8V9ZM18 17V21H16V15H22V17H18ZM8 15V21H6V17H2V15H8Z\"></path></svg>\r\n</ng-template>\r\n\r\n<ng-template #zoomInSvg>\r\n <svg width=\"24px\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M18.031 16.6168L22.3137 20.8995L20.8995 22.3137L16.6168 18.031C15.0769 19.263 13.124 20 11 20C6.032 20 2 15.968 2 11C2 6.032 6.032 2 11 2C15.968 2 20 6.032 20 11C20 13.124 19.263 15.0769 18.031 16.6168ZM16.0247 15.8748C17.2475 14.6146 18 12.8956 18 11C18 7.1325 14.8675 4 11 4C7.1325 4 4 7.1325 4 11C4 14.8675 7.1325 18 11 18C12.8956 18 14.6146 17.2475 15.8748 16.0247L16.0247 15.8748ZM10 10V7H12V10H15V12H12V15H10V12H7V10H10Z\"></path></svg>\r\n</ng-template>\r\n<ng-template #zoomOutSvg>\r\n <svg width=\"24px\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M18.031 16.6168L22.3137 20.8995L20.8995 22.3137L16.6168 18.031C15.0769 19.263 13.124 20 11 20C6.032 20 2 15.968 2 11C2 6.032 6.032 2 11 2C15.968 2 20 6.032 20 11C20 13.124 19.263 15.0769 18.031 16.6168ZM16.0247 15.8748C17.2475 14.6146 18 12.8956 18 11C18 7.1325 14.8675 4 11 4C7.1325 4 4 7.1325 4 11C4 14.8675 7.1325 18 11 18C12.8956 18 14.6146 17.2475 15.8748 16.0247L16.0247 15.8748ZM7 10H15V12H7V10Z\"></path></svg>\r\n</ng-template>\r\n\r\n<ng-template #refreshSvg>\r\n <svg width=\"24px\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M5.46257 4.43262C7.21556 2.91688 9.5007 2 12 2C17.5228 2 22 6.47715 22 12C22 14.1361 21.3302 16.1158 20.1892 17.7406L17 12H20C20 7.58172 16.4183 4 12 4C9.84982 4 7.89777 4.84827 6.46023 6.22842L5.46257 4.43262ZM18.5374 19.5674C16.7844 21.0831 14.4993 22 12 22C6.47715 22 2 17.5228 2 12C2 9.86386 2.66979 7.88416 3.8108 6.25944L7 12H4C4 16.4183 7.58172 20 12 20C14.1502 20 16.1022 19.1517 17.5398 17.7716L18.5374 19.5674Z\"></path></svg>\r\n</ng-template>\r\n", styles: [":host{width:100%;display:flex;flex-direction:column;gap:1.2rem;min-height:100dvh}.action-btn{border-radius:50%;height:3rem;width:3rem}.action-btn:hover{transition:.2s ease;background-color:var(--gray-700)}.preview-controls{position:sticky;top:0;z-index:10;display:flex;justify-content:space-between;backdrop-filter:blur(6px);background:color-mix(in oklab,#000 45%,transparent);margin-bottom:.5rem;align-items:center;height:5rem;flex-shrink:0;padding:0 1.8rem}.preview-controls button{line-height:0;color:#fff}.preview-controls .btn-close{font-size:2rem;transition:.2s ease}.preview-img-container{flex-grow:1;z-index:3;position:relative;display:flex;align-items:center;padding-bottom:1.2rem}.img-preview{margin:0 auto;display:flex;align-items:center;justify-content:center;z-index:2;width:90%;max-width:70rem;transition:.5s ease}.img-preview img{height:auto;border-radius:var(--radius);width:100%;transition:.5s ease}.img-preview.full-screen-img{max-width:100%;height:auto}.preview-clickable{position:absolute;left:0;top:0;width:100%;height:100%;z-index:1}\n"] }]
|
|
3211
|
+
}] });
|
|
3212
|
+
|
|
3213
|
+
class ImageService {
|
|
3214
|
+
_overlay = inject(Overlay);
|
|
3215
|
+
_overlayRef;
|
|
3216
|
+
open(fileSrc, fileName) {
|
|
3217
|
+
const portal = this.createPortal();
|
|
3218
|
+
this._overlayRef = this.createOverlay();
|
|
3219
|
+
const componentRef = this._overlayRef.attach(portal);
|
|
3220
|
+
componentRef.instance.src = fileSrc;
|
|
3221
|
+
componentRef.instance.name = fileName;
|
|
3222
|
+
componentRef.instance.overlayRef = this._overlayRef;
|
|
3223
|
+
let sub = this._overlayRef.backdropClick().subscribe((_) => {
|
|
3224
|
+
sub.unsubscribe();
|
|
3225
|
+
this.close();
|
|
3226
|
+
});
|
|
3227
|
+
let sub2 = this._overlayRef
|
|
3228
|
+
.keydownEvents()
|
|
3229
|
+
.pipe(filter$1((key) => key.code === 'Escape'))
|
|
3230
|
+
.subscribe((_) => {
|
|
3231
|
+
sub2.unsubscribe();
|
|
3232
|
+
this.close();
|
|
3233
|
+
});
|
|
3234
|
+
return this._overlayRef;
|
|
3235
|
+
}
|
|
3236
|
+
close() {
|
|
3237
|
+
this._overlayRef.dispose();
|
|
3238
|
+
}
|
|
3239
|
+
createOverlay() {
|
|
3240
|
+
const overlay = this._overlay.create({
|
|
3241
|
+
hasBackdrop: true,
|
|
3242
|
+
backdropClass: ['s4y-overlay-bg'],
|
|
3243
|
+
scrollStrategy: this._overlay.scrollStrategies.block(),
|
|
3244
|
+
panelClass: ['s4y-preview-pane'],
|
|
3245
|
+
disposeOnNavigation: true,
|
|
3246
|
+
});
|
|
3247
|
+
overlay.backdropClick().subscribe(() => overlay.dispose());
|
|
3248
|
+
return overlay;
|
|
3249
|
+
}
|
|
3250
|
+
createPortal() {
|
|
3251
|
+
return new ComponentPortal(ImagePreviewComponent);
|
|
3252
|
+
}
|
|
3253
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: ImageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3254
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: ImageService, providedIn: 'root' });
|
|
3255
|
+
}
|
|
3256
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: ImageService, decorators: [{
|
|
3257
|
+
type: Injectable,
|
|
3258
|
+
args: [{
|
|
3259
|
+
providedIn: 'root',
|
|
3260
|
+
}]
|
|
3261
|
+
}] });
|
|
3262
|
+
|
|
3263
|
+
class ImageComponent {
|
|
3264
|
+
imageService = inject(ImageService);
|
|
3265
|
+
elRef = inject(ElementRef);
|
|
3266
|
+
renderer = inject(Renderer2);
|
|
3267
|
+
destroy = inject(DestroyRef);
|
|
3268
|
+
constructor() { }
|
|
3269
|
+
src = input('');
|
|
3270
|
+
fileName = input();
|
|
3271
|
+
disablePreview = input(false);
|
|
3272
|
+
withOverlay = input(false);
|
|
3273
|
+
wrapper;
|
|
3274
|
+
overlayEl;
|
|
3275
|
+
ngOnInit() {
|
|
3276
|
+
this.configureWrapperElement();
|
|
3277
|
+
this.configureOverlay();
|
|
3278
|
+
this.configureEyeSvg();
|
|
3279
|
+
}
|
|
3280
|
+
ngAfterViewInit() {
|
|
3281
|
+
this.onShowOverlay();
|
|
3282
|
+
}
|
|
3283
|
+
configureWrapperElement() {
|
|
3284
|
+
const img = this.elRef.nativeElement;
|
|
3285
|
+
if (!img)
|
|
3286
|
+
return;
|
|
3287
|
+
const parent = img.parentNode;
|
|
3288
|
+
this.wrapper = this.createElement('span');
|
|
3289
|
+
this.addClass(this.wrapper, 's4y-img-wrapper');
|
|
3290
|
+
this.renderer.setStyle(this.wrapper, 'position', 'relative');
|
|
3291
|
+
this.renderer.setStyle(this.wrapper, 'display', 'inline-block');
|
|
3292
|
+
this.renderer.insertBefore(parent, this.wrapper, img);
|
|
3293
|
+
this.renderer.removeChild(parent, img);
|
|
3294
|
+
this.renderer.appendChild(this.wrapper, img);
|
|
3295
|
+
const click$ = fromEvent(this.wrapper, 'click');
|
|
3296
|
+
click$.pipe(takeUntilDestroyed(this.destroy)).subscribe(() => {
|
|
3297
|
+
this.showPreview();
|
|
3298
|
+
});
|
|
3299
|
+
}
|
|
3300
|
+
configureOverlay() {
|
|
3301
|
+
if (this.withOverlay()) {
|
|
3302
|
+
this.overlayEl = this.createElement('div');
|
|
3303
|
+
this.renderer.addClass(this.overlayEl, 's4y-img-overlay');
|
|
3304
|
+
this.renderer.appendChild(this.wrapper, this.overlayEl);
|
|
3305
|
+
}
|
|
3306
|
+
}
|
|
3307
|
+
configureEyeSvg() {
|
|
3308
|
+
const overlay = this.overlayEl;
|
|
3309
|
+
if (!overlay)
|
|
3310
|
+
return;
|
|
3311
|
+
const svgContainer = this.createElement('span');
|
|
3312
|
+
svgContainer.innerHTML = this.eyeSvg;
|
|
3313
|
+
this.renderer.appendChild(overlay, svgContainer);
|
|
3314
|
+
}
|
|
3315
|
+
onShowOverlay() {
|
|
3316
|
+
const wrapper = this.wrapper;
|
|
3317
|
+
const overlay = this.overlayEl;
|
|
3318
|
+
if (!wrapper || !this.withOverlay() || !overlay)
|
|
3319
|
+
return;
|
|
3320
|
+
const wrapperMouseOver$ = fromEvent(this.wrapper, 'mouseover');
|
|
3321
|
+
const wrapperMouseLeave$ = fromEvent(this.wrapper, 'mouseleave');
|
|
3322
|
+
wrapperMouseOver$.pipe(takeUntilDestroyed(this.destroy)).subscribe((x) => {
|
|
3323
|
+
this.addClass(overlay, 'active');
|
|
3324
|
+
});
|
|
3325
|
+
wrapperMouseLeave$.pipe(takeUntilDestroyed(this.destroy)).subscribe((x) => {
|
|
3326
|
+
this.removeClass(overlay, 'active');
|
|
3327
|
+
});
|
|
3328
|
+
}
|
|
3329
|
+
createElement(element) {
|
|
3330
|
+
return this.renderer.createElement(element);
|
|
3331
|
+
}
|
|
3332
|
+
addClass(el, className) {
|
|
3333
|
+
return this.renderer.addClass(el, className);
|
|
3334
|
+
}
|
|
3335
|
+
removeClass(el, className) {
|
|
3336
|
+
return this.renderer.removeClass(el, className);
|
|
3337
|
+
}
|
|
3338
|
+
showPreview() {
|
|
3339
|
+
this.imageService.open(this.src(), this.fileName());
|
|
3340
|
+
}
|
|
3341
|
+
get eyeSvg() {
|
|
3342
|
+
return `<svg width="24px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#fff"><path d="M12.0003 3C17.3924 3 21.8784 6.87976 22.8189 12C21.8784 17.1202 17.3924 21 12.0003 21C6.60812 21 2.12215 17.1202 1.18164 12C2.12215 6.87976 6.60812 3 12.0003 3ZM12.0003 19C16.2359 19 19.8603 16.052 20.7777 12C19.8603 7.94803 16.2359 5 12.0003 5C7.7646 5 4.14022 7.94803 3.22278 12C4.14022 16.052 7.7646 19 12.0003 19ZM12.0003 16.5C9.51498 16.5 7.50026 14.4853 7.50026 12C7.50026 9.51472 9.51498 7.5 12.0003 7.5C14.4855 7.5 16.5003 9.51472 16.5003 12C16.5003 14.4853 14.4855 16.5 12.0003 16.5ZM12.0003 14.5C13.381 14.5 14.5003 13.3807 14.5003 12C14.5003 10.6193 13.381 9.5 12.0003 9.5C10.6196 9.5 9.50026 10.6193 9.50026 12C9.50026 13.3807 10.6196 14.5 12.0003 14.5Z"></path></svg>`;
|
|
3343
|
+
}
|
|
3344
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: ImageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3345
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.15", type: ImageComponent, isStandalone: true, selector: "img[s4yImage]", inputs: { src: { classPropertyName: "src", publicName: "src", isSignal: true, isRequired: false, transformFunction: null }, fileName: { classPropertyName: "fileName", publicName: "fileName", isSignal: true, isRequired: false, transformFunction: null }, disablePreview: { classPropertyName: "disablePreview", publicName: "disablePreview", isSignal: true, isRequired: false, transformFunction: null }, withOverlay: { classPropertyName: "withOverlay", publicName: "withOverlay", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `<ng-content />`, isInline: true, styles: [".s4y-overlay-bg{background-color:#0009}.s4y-preview-pane{height:100dvh;width:100dvw;height:auto;overflow:auto;display:flex;flex-direction:column}.s4y-img-overlay{background-color:#0009;cursor:pointer;width:100%;height:100%;position:absolute;top:0;left:0;transition:.3s ease;opacity:0;display:flex;align-items:center;justify-content:center}.s4y-img-overlay.active{opacity:1}.s4y-eye-overlay{color:#fff}\n"], encapsulation: i0.ViewEncapsulation.None });
|
|
3346
|
+
}
|
|
3347
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: ImageComponent, decorators: [{
|
|
3348
|
+
type: Component,
|
|
3349
|
+
args: [{ selector: 'img[s4yImage]', template: `<ng-content />`, encapsulation: ViewEncapsulation.None, styles: [".s4y-overlay-bg{background-color:#0009}.s4y-preview-pane{height:100dvh;width:100dvw;height:auto;overflow:auto;display:flex;flex-direction:column}.s4y-img-overlay{background-color:#0009;cursor:pointer;width:100%;height:100%;position:absolute;top:0;left:0;transition:.3s ease;opacity:0;display:flex;align-items:center;justify-content:center}.s4y-img-overlay.active{opacity:1}.s4y-eye-overlay{color:#fff}\n"] }]
|
|
3350
|
+
}], ctorParameters: () => [] });
|
|
3351
|
+
|
|
3164
3352
|
const selectMultiAnim = trigger('selectMultiAnim', [
|
|
3165
3353
|
// entra
|
|
3166
3354
|
transition(':enter', [
|
|
@@ -3751,5 +3939,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
|
|
|
3751
3939
|
* Generated bundle index. Do not edit.
|
|
3752
3940
|
*/
|
|
3753
3941
|
|
|
3754
|
-
export { AsideComponent, AsideService, AvatarComponent, BreadcrumbComponent, BreadcrumbItemDirective, BreadcrumbService, ButtonComponent, CheckboxComponent, ClickOutsideDirective, DYNAMIC_DIALOG_DATA, DYNAMIC_DIALOG_OPTIONS, DashboardContainerComponent, DashboardLayoutComponent, DashboardModule, DashboardRoutesComponent, DrawerComponent, DynamicDialogComponent, DynamicDialogRef, DynamicDialogService, ErrorMessageComponent, FormFieldComponent, FormFieldPasswordComponent, FormsKitModule, HintComponent, InputComponent, InputPrefixComponent, InputSufixComponent, LabelComponent, LoadingModalComponent, LoadingModalService, MaskDirective, MenuComponent, MenuItemComponent, ModalComponent, ModalConfirmationComponent, ModalConfirmationService, NavbarComponent, PaginationComponent, PopoverPanelComponent, PopoverTriggerDirective, RadioComponent, SearchBarComponent, SelectComponent, SelectMultiComponent, SidebarRightComponent, SidebarRightService, SliderComponent, SpinnerComponent, StepComponent, StepPanelComponent, StepperComponent, SvgComponent, SvgService, TableComponent, TableSortDirective, ToastComponent, ToastService, ToggleComponent, TooltipComponent, TooltipDirective, TooltipModule, TooltipPosition, modalFadeCombined, sidebarRightAnimation };
|
|
3942
|
+
export { AsideComponent, AsideService, AvatarComponent, BreadcrumbComponent, BreadcrumbItemDirective, BreadcrumbService, ButtonComponent, CheckboxComponent, ClickOutsideDirective, DYNAMIC_DIALOG_DATA, DYNAMIC_DIALOG_OPTIONS, DashboardContainerComponent, DashboardLayoutComponent, DashboardModule, DashboardRoutesComponent, DrawerComponent, DynamicDialogComponent, DynamicDialogRef, DynamicDialogService, ErrorMessageComponent, FormFieldComponent, FormFieldPasswordComponent, FormsKitModule, HintComponent, ImageComponent, ImageService, InputComponent, InputPrefixComponent, InputSufixComponent, LabelComponent, LoadingModalComponent, LoadingModalService, MaskDirective, MenuComponent, MenuItemComponent, ModalComponent, ModalConfirmationComponent, ModalConfirmationService, NavbarComponent, PaginationComponent, PopoverPanelComponent, PopoverTriggerDirective, RadioComponent, SearchBarComponent, SelectComponent, SelectMultiComponent, SidebarRightComponent, SidebarRightService, SliderComponent, SpinnerComponent, StepComponent, StepPanelComponent, StepperComponent, SvgComponent, SvgService, TableComponent, TableSortDirective, ToastComponent, ToastService, ToggleComponent, TooltipComponent, TooltipDirective, TooltipModule, TooltipPosition, modalFadeCombined, sidebarRightAnimation };
|
|
3755
3943
|
//# sourceMappingURL=s4y-ui.mjs.map
|