s4y-ui 1.0.2 → 1.0.4
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 +1175 -0
- package/fesm2022/s4y-ui.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/components/avatar/avatar.component.d.ts +15 -0
- package/lib/components/breadcrumb/breadcrumb.component.d.ts +19 -0
- package/{src/lib/components/breadcrumb/index.ts → lib/components/breadcrumb/index.d.ts} +1 -1
- package/lib/components/button/button.component.d.ts +15 -0
- package/lib/components/dashboard/aside/aside.component.d.ts +37 -0
- package/lib/components/dashboard/aside/aside.service.d.ts +8 -0
- package/lib/components/dashboard/dashboard-container/dashboard-container.component.d.ts +5 -0
- package/lib/components/dashboard/dashboard-layout/dashboard-layout.component.d.ts +5 -0
- package/lib/components/dashboard/dashboard-routes/dashboard-routes.component.d.ts +5 -0
- package/lib/components/dashboard/dashboard.module.d.ts +14 -0
- package/{src/lib/components/dashboard/index.ts → lib/components/dashboard/index.d.ts} +6 -7
- package/lib/components/dashboard/navbar/navbar.component.d.ts +9 -0
- package/lib/components/drawer/drawer.animation.d.ts +1 -0
- package/lib/components/drawer/drawer.component.d.ts +36 -0
- package/lib/components/forms-kit/components/error-message/error-message.component.d.ts +5 -0
- package/lib/components/forms-kit/components/hint/hint.component.d.ts +5 -0
- package/lib/components/forms-kit/components/input/input.component.d.ts +5 -0
- package/lib/components/forms-kit/components/input-prefix/input-prefix.component.d.ts +5 -0
- package/lib/components/forms-kit/components/input-sufix/input-sufix.component.d.ts +5 -0
- package/lib/components/forms-kit/components/label/label.component.d.ts +5 -0
- package/lib/components/forms-kit/form-field/form-field.component.d.ts +5 -0
- package/lib/components/forms-kit/form-field-password/form-field-password.component.d.ts +23 -0
- package/lib/components/forms-kit/forms-kit.module.d.ts +15 -0
- package/{src/lib/components/forms-kit/index.ts → lib/components/forms-kit/index.d.ts} +9 -10
- package/lib/components/spinner/interface.d.ts +2 -0
- package/lib/components/spinner/spinner.component.d.ts +11 -0
- package/{src/lib/components/svg/index.ts → lib/components/svg/index.d.ts} +2 -3
- package/lib/components/svg/svg.component.d.ts +16 -0
- package/lib/components/svg/svg.service.d.ts +8 -0
- package/lib/components/table/actions/sortTable.directive.d.ts +25 -0
- package/{src/lib/components/table/index.ts → lib/components/table/index.d.ts} +2 -2
- package/lib/components/table/table.component.d.ts +16 -0
- package/{src/lib/components/toast/index.ts → lib/components/toast/index.d.ts} +2 -2
- package/lib/components/toast/toast.animation.d.ts +2 -0
- package/lib/components/toast/toast.component.d.ts +12 -0
- package/lib/components/toast/toast.interface.d.ts +8 -0
- package/lib/components/toast/toast.service.d.ts +12 -0
- package/{src/lib/directives/index.ts → lib/directives/index.d.ts} +1 -1
- package/lib/directives/mask/mask.directive.d.ts +28 -0
- package/package.json +26 -15
- package/{src/public-api.ts → public-api.d.ts} +11 -16
- package/src/scss/styles.scss +95 -0
- package/src/scss/styles.scss.map +1 -0
- package/.storybook/main.ts +0 -15
- package/.storybook/preview.ts +0 -17
- package/.storybook/tsconfig.json +0 -12
- package/.storybook/typings.d.ts +0 -4
- package/documentation.json +0 -1352
- package/ng-package.json +0 -8
- package/src/lib/components/avatar/avatar.component.html +0 -10
- package/src/lib/components/avatar/avatar.component.scss +0 -45
- package/src/lib/components/avatar/avatar.component.spec.ts +0 -23
- package/src/lib/components/avatar/avatar.component.ts +0 -65
- package/src/lib/components/breadcrumb/breadcrumb.component.html +0 -15
- package/src/lib/components/breadcrumb/breadcrumb.component.scss +0 -30
- package/src/lib/components/breadcrumb/breadcrumb.component.spec.ts +0 -23
- package/src/lib/components/breadcrumb/breadcrumb.component.ts +0 -56
- package/src/lib/components/button/button.component.scss +0 -342
- package/src/lib/components/button/button.component.ts +0 -70
- package/src/lib/components/button/button.stories.ts +0 -124
- package/src/lib/components/dashboard/aside/aside.component.html +0 -110
- package/src/lib/components/dashboard/aside/aside.component.scss +0 -381
- package/src/lib/components/dashboard/aside/aside.component.spec.ts +0 -23
- package/src/lib/components/dashboard/aside/aside.component.ts +0 -84
- package/src/lib/components/dashboard/aside/aside.service.ts +0 -14
- package/src/lib/components/dashboard/dashboard-container/dashboard-container.component.html +0 -1
- package/src/lib/components/dashboard/dashboard-container/dashboard-container.component.scss +0 -9
- package/src/lib/components/dashboard/dashboard-container/dashboard-container.component.spec.ts +0 -23
- package/src/lib/components/dashboard/dashboard-container/dashboard-container.component.ts +0 -9
- package/src/lib/components/dashboard/dashboard-layout/dashboard-layout.component.html +0 -8
- package/src/lib/components/dashboard/dashboard-layout/dashboard-layout.component.scss +0 -11
- package/src/lib/components/dashboard/dashboard-layout/dashboard-layout.component.spec.ts +0 -23
- package/src/lib/components/dashboard/dashboard-layout/dashboard-layout.component.ts +0 -9
- package/src/lib/components/dashboard/dashboard-routes/dashboard-routes.component.html +0 -1
- package/src/lib/components/dashboard/dashboard-routes/dashboard-routes.component.scss +0 -6
- package/src/lib/components/dashboard/dashboard-routes/dashboard-routes.component.ts +0 -9
- package/src/lib/components/dashboard/dashboard.module.ts +0 -24
- package/src/lib/components/dashboard/navbar/navbar.component.html +0 -21
- package/src/lib/components/dashboard/navbar/navbar.component.scss +0 -41
- package/src/lib/components/dashboard/navbar/navbar.component.spec.ts +0 -23
- package/src/lib/components/dashboard/navbar/navbar.component.ts +0 -15
- package/src/lib/components/drawer/drawer.animation.ts +0 -51
- package/src/lib/components/drawer/drawer.component.html +0 -46
- package/src/lib/components/drawer/drawer.component.scss +0 -87
- package/src/lib/components/drawer/drawer.component.ts +0 -139
- package/src/lib/components/forms-kit/components/error-message/error-message.component.html +0 -1
- package/src/lib/components/forms-kit/components/error-message/error-message.component.scss +0 -7
- package/src/lib/components/forms-kit/components/error-message/error-message.component.ts +0 -9
- package/src/lib/components/forms-kit/components/hint/hint.component.html +0 -1
- package/src/lib/components/forms-kit/components/hint/hint.component.scss +0 -7
- package/src/lib/components/forms-kit/components/hint/hint.component.spec.ts +0 -23
- package/src/lib/components/forms-kit/components/hint/hint.component.ts +0 -9
- package/src/lib/components/forms-kit/components/input/input.component.html +0 -1
- package/src/lib/components/forms-kit/components/input/input.component.scss +0 -21
- package/src/lib/components/forms-kit/components/input/input.component.ts +0 -9
- package/src/lib/components/forms-kit/components/input-prefix/input-prefix.component.html +0 -1
- package/src/lib/components/forms-kit/components/input-prefix/input-prefix.component.scss +0 -12
- package/src/lib/components/forms-kit/components/input-prefix/input-prefix.component.spec.ts +0 -23
- package/src/lib/components/forms-kit/components/input-prefix/input-prefix.component.ts +0 -9
- package/src/lib/components/forms-kit/components/input-sufix/input-sufix.component.html +0 -1
- package/src/lib/components/forms-kit/components/input-sufix/input-sufix.component.scss +0 -12
- package/src/lib/components/forms-kit/components/input-sufix/input-sufix.component.spec.ts +0 -23
- package/src/lib/components/forms-kit/components/input-sufix/input-sufix.component.ts +0 -9
- package/src/lib/components/forms-kit/components/label/label.component.html +0 -1
- package/src/lib/components/forms-kit/components/label/label.component.scss +0 -4
- package/src/lib/components/forms-kit/components/label/label.component.ts +0 -9
- package/src/lib/components/forms-kit/form-field/form-field.component.html +0 -9
- package/src/lib/components/forms-kit/form-field/form-field.component.scss +0 -36
- package/src/lib/components/forms-kit/form-field/form-field.component.ts +0 -9
- package/src/lib/components/forms-kit/form-field-password/form-field-password.component.html +0 -57
- package/src/lib/components/forms-kit/form-field-password/form-field-password.component.scss +0 -45
- package/src/lib/components/forms-kit/form-field-password/form-field-password.component.ts +0 -65
- package/src/lib/components/forms-kit/form-field-password/form-field-password.stories.ts +0 -205
- package/src/lib/components/forms-kit/form-kit.stories.ts +0 -149
- package/src/lib/components/forms-kit/forms-kit.module.ts +0 -28
- package/src/lib/components/spinner/interface.ts +0 -2
- package/src/lib/components/spinner/spinner.component.html +0 -1
- package/src/lib/components/spinner/spinner.component.scss +0 -45
- package/src/lib/components/spinner/spinner.component.ts +0 -20
- package/src/lib/components/svg/svg.component.html +0 -26
- package/src/lib/components/svg/svg.component.scss +0 -46
- package/src/lib/components/svg/svg.component.ts +0 -87
- package/src/lib/components/svg/svg.service.ts +0 -33
- package/src/lib/components/table/actions/sortTable.directive.ts +0 -175
- package/src/lib/components/table/table.component.html +0 -64
- package/src/lib/components/table/table.component.scss +0 -97
- package/src/lib/components/table/table.component.ts +0 -37
- package/src/lib/components/toast/toast.animation.ts +0 -42
- package/src/lib/components/toast/toast.component.html +0 -23
- package/src/lib/components/toast/toast.component.scss +0 -135
- package/src/lib/components/toast/toast.component.spec.ts +0 -23
- package/src/lib/components/toast/toast.component.ts +0 -22
- package/src/lib/components/toast/toast.interface.ts +0 -14
- package/src/lib/components/toast/toast.service.ts +0 -40
- package/src/lib/directives/mask/mask.directive.stories.ts +0 -176
- package/src/lib/directives/mask/mask.directive.ts +0 -242
- package/src/scss/_medias.scss +0 -31
- package/src/scss/_reset.scss +0 -52
- package/src/scss/_variables.scss +0 -24
- package/src/scss/_z-index.scss +0 -25
- package/src/scss/style.scss +0 -4
- package/tsconfig.lib.json +0 -13
- package/tsconfig.lib.prod.json +0 -11
- package/tsconfig.spec.json +0 -15
|
@@ -0,0 +1,1175 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Component, signal, computed, Injectable, inject, ContentChild, input, HostBinding, NgModule, booleanAttribute, model, forwardRef, HostListener, Directive, Input, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/common';
|
|
4
|
+
import { CommonModule, NgFor, NgIf, NgClass, AsyncPipe, JsonPipe, NgTemplateOutlet } from '@angular/common';
|
|
5
|
+
import * as i1$2 from '@angular/platform-browser';
|
|
6
|
+
import { DomSanitizer } from '@angular/platform-browser';
|
|
7
|
+
import * as i1$1 from '@angular/router';
|
|
8
|
+
import { Router, RouterLink, NavigationEnd } from '@angular/router';
|
|
9
|
+
import { NG_VALUE_ACCESSOR, NgControl } from '@angular/forms';
|
|
10
|
+
import { filter, defer, from, throwError } from 'rxjs';
|
|
11
|
+
import { trigger, transition, animate, style, group, query } from '@angular/animations';
|
|
12
|
+
import { catchError, map } from 'rxjs/operators';
|
|
13
|
+
|
|
14
|
+
class DashboardLayoutComponent {
|
|
15
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: DashboardLayoutComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
16
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.7", type: DashboardLayoutComponent, isStandalone: false, selector: "s4y-dashboard-layout", ngImport: i0, template: "<div class=\"s4y-dashboard-layout\">\r\n <ng-content select=\"s4y-aside\"></ng-content>\r\n\r\n <div class=\"s4y-dashboard-layout__content\">\r\n <ng-content select=\"s4y-navbar\"></ng-content>\r\n <ng-content select=\"s4y-dashboard-routes\"></ng-content>\r\n </div>\r\n</div>\r\n", styles: [".s4y-dashboard-layout{height:100dvh;width:100dvw;display:flex}.s4y-dashboard-layout__content{flex-grow:1;position:relative}\n"] });
|
|
17
|
+
}
|
|
18
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: DashboardLayoutComponent, decorators: [{
|
|
19
|
+
type: Component,
|
|
20
|
+
args: [{ selector: 's4y-dashboard-layout', standalone: false, template: "<div class=\"s4y-dashboard-layout\">\r\n <ng-content select=\"s4y-aside\"></ng-content>\r\n\r\n <div class=\"s4y-dashboard-layout__content\">\r\n <ng-content select=\"s4y-navbar\"></ng-content>\r\n <ng-content select=\"s4y-dashboard-routes\"></ng-content>\r\n </div>\r\n</div>\r\n", styles: [".s4y-dashboard-layout{height:100dvh;width:100dvw;display:flex}.s4y-dashboard-layout__content{flex-grow:1;position:relative}\n"] }]
|
|
21
|
+
}] });
|
|
22
|
+
|
|
23
|
+
class AsideService {
|
|
24
|
+
_isOpened = signal(true);
|
|
25
|
+
isOpened = computed(() => this._isOpened());
|
|
26
|
+
onToggle() {
|
|
27
|
+
this._isOpened.update((state) => !state);
|
|
28
|
+
}
|
|
29
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: AsideService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
30
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: AsideService, providedIn: 'root' });
|
|
31
|
+
}
|
|
32
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: AsideService, decorators: [{
|
|
33
|
+
type: Injectable,
|
|
34
|
+
args: [{
|
|
35
|
+
providedIn: 'root',
|
|
36
|
+
}]
|
|
37
|
+
}] });
|
|
38
|
+
|
|
39
|
+
class NavbarComponent {
|
|
40
|
+
_asideService = inject(AsideService);
|
|
41
|
+
actionsTemplate;
|
|
42
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: NavbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
43
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.7", type: NavbarComponent, isStandalone: false, selector: "s4y-navbar", queries: [{ propertyName: "actionsTemplate", first: true, predicate: ["actionsTemplate"], descendants: true }], ngImport: i0, template: "<nav class=\"s4y-navbar-container\">\r\n <button (click)=\"_asideService.onToggle()\" class=\"s4y-navbar-container__btn\">\r\n <ng-container [ngTemplateOutlet]=\"menuIcon\"></ng-container>\r\n </button>\r\n\r\n <div class=\"s4y-navbar-container__actions\">\r\n <ng-container *ngIf=\"actionsTemplate\">\r\n <ng-container [ngTemplateOutlet]=\"actionsTemplate\"></ng-container>\r\n </ng-container>\r\n </div>\r\n</nav>\r\n\r\n<ng-template #menuIcon>\r\n <svg\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"currentColor\"\r\n >\r\n <path d=\"M3 4H21V6H3V4ZM3 11H15V13H3V11ZM3 18H21V20H3V18Z\"></path>\r\n </svg>\r\n</ng-template>\r\n", styles: [":host{display:block;display:flex;align-items:center;justify-content:center}.s4y-navbar-container{display:flex;justify-content:space-between;align-items:center;background-color:#fff;border-bottom:1px solid var(--gray-200);min-height:5.8rem;width:100%;height:var(--nav-height);margin:0 1.4rem;width:calc(100% - 1.4rem)}.s4y-navbar-container__actions{display:flex;gap:1.6rem}.s4y-navbar-container__btn{height:4.2rem;width:4.2rem;border-radius:100%;background-color:var(--gray-200);display:flex;align-items:center;justify-content:center}.s4y-navbar-container__btn svg{width:2.2rem;height:2.2rem}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
44
|
+
}
|
|
45
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: NavbarComponent, decorators: [{
|
|
46
|
+
type: Component,
|
|
47
|
+
args: [{ selector: 's4y-navbar', standalone: false, template: "<nav class=\"s4y-navbar-container\">\r\n <button (click)=\"_asideService.onToggle()\" class=\"s4y-navbar-container__btn\">\r\n <ng-container [ngTemplateOutlet]=\"menuIcon\"></ng-container>\r\n </button>\r\n\r\n <div class=\"s4y-navbar-container__actions\">\r\n <ng-container *ngIf=\"actionsTemplate\">\r\n <ng-container [ngTemplateOutlet]=\"actionsTemplate\"></ng-container>\r\n </ng-container>\r\n </div>\r\n</nav>\r\n\r\n<ng-template #menuIcon>\r\n <svg\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"currentColor\"\r\n >\r\n <path d=\"M3 4H21V6H3V4ZM3 11H15V13H3V11ZM3 18H21V20H3V18Z\"></path>\r\n </svg>\r\n</ng-template>\r\n", styles: [":host{display:block;display:flex;align-items:center;justify-content:center}.s4y-navbar-container{display:flex;justify-content:space-between;align-items:center;background-color:#fff;border-bottom:1px solid var(--gray-200);min-height:5.8rem;width:100%;height:var(--nav-height);margin:0 1.4rem;width:calc(100% - 1.4rem)}.s4y-navbar-container__actions{display:flex;gap:1.6rem}.s4y-navbar-container__btn{height:4.2rem;width:4.2rem;border-radius:100%;background-color:var(--gray-200);display:flex;align-items:center;justify-content:center}.s4y-navbar-container__btn svg{width:2.2rem;height:2.2rem}\n"] }]
|
|
48
|
+
}], propDecorators: { actionsTemplate: [{
|
|
49
|
+
type: ContentChild,
|
|
50
|
+
args: ['actionsTemplate']
|
|
51
|
+
}] } });
|
|
52
|
+
|
|
53
|
+
class S4yAvatarComponent {
|
|
54
|
+
src = input(undefined); // URL da imagem
|
|
55
|
+
alt = input('Avatar'); // Texto alternativo
|
|
56
|
+
size = input('md'); // Tamanho
|
|
57
|
+
rounded = input(true); // Arredondar ou não
|
|
58
|
+
border = input(false); // Borda decorativa
|
|
59
|
+
// Estados internos
|
|
60
|
+
imageLoaded = signal(false);
|
|
61
|
+
imageError = signal(false);
|
|
62
|
+
get hostClasses() {
|
|
63
|
+
const classes = [];
|
|
64
|
+
switch (this.size()) {
|
|
65
|
+
case 'sm':
|
|
66
|
+
classes.push('s4y-avatar-sm');
|
|
67
|
+
break;
|
|
68
|
+
case 'md':
|
|
69
|
+
classes.push('s4y-avatar-md');
|
|
70
|
+
break;
|
|
71
|
+
case 'lg':
|
|
72
|
+
classes.push('s4y-avatar-lg');
|
|
73
|
+
break;
|
|
74
|
+
case 'xl':
|
|
75
|
+
classes.push('s4y-avatar-xl');
|
|
76
|
+
break;
|
|
77
|
+
default:
|
|
78
|
+
classes.push('s4y-avatar-md');
|
|
79
|
+
}
|
|
80
|
+
classes.push(this.rounded() ? 's4y-avatar-rounded' : 's4y-avatar-square');
|
|
81
|
+
if (this.border()) {
|
|
82
|
+
classes.push('s4y-avatar-border');
|
|
83
|
+
}
|
|
84
|
+
return classes.join(' ');
|
|
85
|
+
}
|
|
86
|
+
onLoad() {
|
|
87
|
+
this.imageLoaded.set(true);
|
|
88
|
+
this.imageError.set(false);
|
|
89
|
+
}
|
|
90
|
+
onError() {
|
|
91
|
+
this.imageError.set(true);
|
|
92
|
+
}
|
|
93
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: S4yAvatarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
94
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.7", type: S4yAvatarComponent, isStandalone: true, selector: "s4y-avatar", inputs: { src: { classPropertyName: "src", publicName: "src", isSignal: true, isRequired: false, transformFunction: null }, alt: { classPropertyName: "alt", publicName: "alt", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, border: { classPropertyName: "border", publicName: "border", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "this.hostClasses" } }, ngImport: i0, template: "@if (src()) {\r\n<img [src]=\"src()\" [alt]=\"alt()\" />\r\n\r\n}@else {\r\n<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\r\n <path\r\n d=\"M4 22C4 17.5817 7.58172 14 12 14C16.4183 14 20 17.5817 20 22H18C18 18.6863 15.3137 16 12 16C8.68629 16 6 18.6863 6 22H4ZM12 13C8.685 13 6 10.315 6 7C6 3.685 8.685 1 12 1C15.315 1 18 3.685 18 7C18 10.315 15.315 13 12 13ZM12 11C14.21 11 16 9.21 16 7C16 4.79 14.21 3 12 3C9.79 3 8 4.79 8 7C8 9.21 9.79 11 12 11Z\"\r\n ></path>\r\n</svg>\r\n}\r\n", styles: [":host{display:block;overflow:hidden;object-fit:cover;object-position:top center;flex-shrink:0}:host.s4y-avatar-sm{width:32px;height:32px;font-size:.75rem}:host.s4y-avatar-md{width:42px;height:42px;font-size:1rem}:host.s4y-avatar-lg{width:72px;height:72px;font-size:1.25rem}:host.s4y-avatar-xl{width:96px;height:96px;font-size:1.5rem}:host.s4y-avatar-rounded{border-radius:50%}:host.s4y-avatar-square{border-radius:8px}:host.s4y-avatar-border{border:1px solid var(--primary-color)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
|
|
95
|
+
}
|
|
96
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: S4yAvatarComponent, decorators: [{
|
|
97
|
+
type: Component,
|
|
98
|
+
args: [{ selector: 's4y-avatar', imports: [CommonModule], template: "@if (src()) {\r\n<img [src]=\"src()\" [alt]=\"alt()\" />\r\n\r\n}@else {\r\n<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\r\n <path\r\n d=\"M4 22C4 17.5817 7.58172 14 12 14C16.4183 14 20 17.5817 20 22H18C18 18.6863 15.3137 16 12 16C8.68629 16 6 18.6863 6 22H4ZM12 13C8.685 13 6 10.315 6 7C6 3.685 8.685 1 12 1C15.315 1 18 3.685 18 7C18 10.315 15.315 13 12 13ZM12 11C14.21 11 16 9.21 16 7C16 4.79 14.21 3 12 3C9.79 3 8 4.79 8 7C8 9.21 9.79 11 12 11Z\"\r\n ></path>\r\n</svg>\r\n}\r\n", styles: [":host{display:block;overflow:hidden;object-fit:cover;object-position:top center;flex-shrink:0}:host.s4y-avatar-sm{width:32px;height:32px;font-size:.75rem}:host.s4y-avatar-md{width:42px;height:42px;font-size:1rem}:host.s4y-avatar-lg{width:72px;height:72px;font-size:1.25rem}:host.s4y-avatar-xl{width:96px;height:96px;font-size:1.5rem}:host.s4y-avatar-rounded{border-radius:50%}:host.s4y-avatar-square{border-radius:8px}:host.s4y-avatar-border{border:1px solid var(--primary-color)}\n"] }]
|
|
99
|
+
}], propDecorators: { hostClasses: [{
|
|
100
|
+
type: HostBinding,
|
|
101
|
+
args: ['class']
|
|
102
|
+
}] } });
|
|
103
|
+
|
|
104
|
+
class AsideComponent {
|
|
105
|
+
_asideService = inject(AsideService);
|
|
106
|
+
router = inject(Router);
|
|
107
|
+
sanitizer = inject(DomSanitizer);
|
|
108
|
+
asideService = inject(AsideService);
|
|
109
|
+
menus = input([]);
|
|
110
|
+
companyLogoSrc = input('https://vanderson-teste.sirv.com/ChatGPT%20Image%2024%20de%20abr.%20de%202025%2C%2009_37_39%201%20(1).png');
|
|
111
|
+
companyTitle = input('Solution4You');
|
|
112
|
+
companyDescription = input('Tecnologia');
|
|
113
|
+
userImage = input('https://images.unsplash.com/photo-1678286742832-26543bb49959?q=80&w=1976&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D');
|
|
114
|
+
userName = input('Vanderson Oliveira');
|
|
115
|
+
userEmail = input('vanderson@example.com');
|
|
116
|
+
isOpened = this._asideService.isOpened;
|
|
117
|
+
menuTemplate;
|
|
118
|
+
headerTemplate;
|
|
119
|
+
footerTemplate;
|
|
120
|
+
onToggle(menu) {
|
|
121
|
+
if (menu.children && menu.children.length > 0) {
|
|
122
|
+
this.closeOtherMenus(menu);
|
|
123
|
+
if (!this.isOpened()) {
|
|
124
|
+
this._asideService.onToggle();
|
|
125
|
+
}
|
|
126
|
+
menu.isOpen = !menu.isOpen;
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
this.router.navigate([menu.link]);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
closeOtherMenus(menuToKeepOpen) {
|
|
133
|
+
this.menus().forEach((menu) => {
|
|
134
|
+
if (menu !== menuToKeepOpen) {
|
|
135
|
+
menu.isOpen = false;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
sanitizeSvg(iconUri) {
|
|
140
|
+
return this.sanitizer.bypassSecurityTrustHtml(iconUri); // Sanitiza o conteúdo SVG
|
|
141
|
+
}
|
|
142
|
+
closeWithClickedOverlay() {
|
|
143
|
+
this.asideService.onToggle();
|
|
144
|
+
}
|
|
145
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: AsideComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
146
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.7", type: AsideComponent, isStandalone: false, selector: "s4y-aside", inputs: { menus: { classPropertyName: "menus", publicName: "menus", isSignal: true, isRequired: false, transformFunction: null }, companyLogoSrc: { classPropertyName: "companyLogoSrc", publicName: "companyLogoSrc", isSignal: true, isRequired: false, transformFunction: null }, companyTitle: { classPropertyName: "companyTitle", publicName: "companyTitle", isSignal: true, isRequired: false, transformFunction: null }, companyDescription: { classPropertyName: "companyDescription", publicName: "companyDescription", isSignal: true, isRequired: false, transformFunction: null }, userImage: { classPropertyName: "userImage", publicName: "userImage", isSignal: true, isRequired: false, transformFunction: null }, userName: { classPropertyName: "userName", publicName: "userName", isSignal: true, isRequired: false, transformFunction: null }, userEmail: { classPropertyName: "userEmail", publicName: "userEmail", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.data-opened": "isOpened()" } }, queries: [{ propertyName: "menuTemplate", first: true, predicate: ["menuTemplate"], descendants: true }, { propertyName: "headerTemplate", first: true, predicate: ["headerTemplate"], descendants: true }, { propertyName: "footerTemplate", first: true, predicate: ["footerTemplate"], descendants: true }], ngImport: i0, template: "<div class=\"s4y-aside-overlay\" (click)=\"closeWithClickedOverlay()\"></div>\r\n\r\n<aside [attr.data-opened]=\"isOpened()\" class=\"s4y-aside\">\r\n <div class=\"s4y-aside-header__container\">\r\n @if (headerTemplate) {\r\n <ng-container [ngTemplateOutlet]=\"headerTemplate\"></ng-container>\r\n } @else {\r\n <div class=\"s4y-aside-header\">\r\n <img class=\"s4y-aside-logo\" [src]=\"companyLogoSrc()\" />\r\n <div class=\"s4y-aside-header__infor\">\r\n <p class=\"s4y-aside-title\">{{ companyTitle() }}</p>\r\n <p class=\"s4y-aside-description\">{{ companyDescription() }}</p>\r\n </div>\r\n </div>\r\n }\r\n </div>\r\n\r\n <div class=\"s4y-aside-body__container\">\r\n <!-- Body Abaixo -->\r\n <div class=\"s4y-aside-body-section\">\r\n @for (menu of menus(); track $index) {\r\n <div class=\"s4y-aside-body-section__item\">\r\n <div\r\n class=\"s4y-aside-body-section-item__infor\"\r\n [class.active]=\"menu.isOpen\"\r\n (click)=\"onToggle(menu)\"\r\n >\r\n <div\r\n class=\"s4y-aside-body-section-item-title\"\r\n [class.closed]=\"!isOpened\"\r\n >\r\n @if (menuTemplate) {\r\n <ng-container\r\n *ngTemplateOutlet=\"menuTemplate; context: { $implicit: menu }\"\r\n ></ng-container>\r\n } @else { @if (menu.iconUri) {\r\n <img [src]=\"menu.iconUri\" alt=\"Icone\" />\r\n }\r\n <p>{{ menu.title }}</p>\r\n }\r\n </div>\r\n\r\n @if (menu.children?.length) {\r\n <!-- -->\r\n @if (menu.isOpen) {\r\n <ng-container [ngTemplateOutlet]=\"arrowBottom\"></ng-container>\r\n } @else {\r\n <ng-container [ngTemplateOutlet]=\"arrowRight\"></ng-container>\r\n }\r\n <!-- -->\r\n }\r\n </div>\r\n @if (menu.isOpen) {\r\n <div class=\"s4y-aside-body-section-item__children\">\r\n @for (children of menu.children; track $index) {\r\n <div class=\"s4y-aside-body-section-item-children__item\">\r\n <a>{{ children.title }}</a>\r\n </div>\r\n }\r\n </div>\r\n }\r\n </div>\r\n }\r\n <!-- <div class=\"s4y-aside-body-section__scroll\"></div> -->\r\n </div>\r\n <!-- Body Acima -->\r\n <div class=\"s4y-aside-body__user\">\r\n @if (footerTemplate) {\r\n <ng-container [ngTemplateOutlet]=\"footerTemplate\"></ng-container>\r\n } @else {\r\n <s4y-avatar [src]=\"userImage()\"></s4y-avatar>\r\n <div class=\"s4y-aside-body-user__infor\">\r\n <p class=\"s4y-aside-body-user_name\">{{ userName() }}</p>\r\n <p class=\"s4y-aside-body-user_email\">{{ userEmail() }}</p>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n</aside>\r\n\r\n<ng-template #arrowRight>\r\n <span class=\"s4y-aside-arrow\">\r\n <svg\r\n width=\"1.8rem\"\r\n height=\"1.8rem\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"currentColor\"\r\n >\r\n <path\r\n d=\"M13.1717 12.0007L8.22192 7.05093L9.63614 5.63672L16.0001 12.0007L9.63614 18.3646L8.22192 16.9504L13.1717 12.0007Z\"\r\n ></path>\r\n </svg>\r\n </span>\r\n</ng-template>\r\n<ng-template #arrowBottom>\r\n <span class=\"s4y-aside-arrow\">\r\n <svg\r\n width=\"1.8rem\"\r\n height=\"1.8rem\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"currentColor\"\r\n >\r\n <path\r\n d=\"M11.9999 13.1714L16.9497 8.22168L18.3639 9.63589L11.9999 15.9999L5.63599 9.63589L7.0502 8.22168L11.9999 13.1714Z\"\r\n ></path>\r\n </svg>\r\n </span>\r\n</ng-template>\r\n", styles: ["@charset \"UTF-8\";.s4y-aside-overlay{display:none}@media screen and (min-width: 320px) and (max-width: 480px){.s4y-aside-overlay{position:fixed;display:block;top:0;left:0;width:100vw;height:100vh;background-color:#00000080;z-index:var(--z-index-overlay)}}@media screen and (min-width: 481px) and (max-width: 767px){.s4y-aside-overlay{position:fixed;display:block;top:0;left:0;width:100vw;height:100vh;background-color:#00000080;z-index:var(--z-index-overlay)}}@media screen and (min-width: 768px) and (max-width: 1024px){.s4y-aside-overlay{position:fixed;display:block;top:0;left:0;width:100vw;height:100vh;background-color:#00000080;z-index:var(--z-index-overlay)}}.s4y-aside{background-color:var(--primary-color);height:100dvh;overflow-x:hidden;width:8rem;border-right:1px solid var(--gray-200);display:flex;flex-direction:column;transition:.5s ease,padding .5s ease;flex-shrink:0}@media screen and (min-width: 320px) and (max-width: 480px){.s4y-aside{position:fixed;top:0;left:0;width:80%;z-index:var(--z-index-emergency)}}@media screen and (min-width: 481px) and (max-width: 767px){.s4y-aside{position:fixed;top:0;left:0;width:80%;max-width:32rem;z-index:var(--z-index-emergency)}}@media screen and (min-width: 768px) and (max-width: 1024px){.s4y-aside{position:fixed;top:0;left:0;width:80%;max-width:32rem;z-index:var(--z-index-emergency)}}.s4y-aside-header__container{height:var(--nav-height);position:relative;display:flex;align-items:center;border-bottom:1px solid var(--gray-200);padding:1.4rem 0;margin:0 1.4rem}.s4y-aside-header{display:flex;align-items:center;gap:1.4rem}.s4y-aside-logo{max-width:4rem;max-height:4rem;border-radius:var(--radius);object-fit:cover;border:1px solid var(--gray-300);flex-shrink:0}.s4y-aside-header__infor{display:flex;flex-direction:column;gap:.2}.s4y-aside-title{font-size:1.6rem;font-weight:700;color:var(--gray-100)}.s4y-aside-description{font-size:1.3rem;color:var(--gray-200)}.s4y-aside-body__container{display:flex;flex-direction:column;flex-grow:1}.s4y-aside-body-section{margin:1.8rem 1.4rem 0;flex-grow:1;overflow-y:auto;overflow-x:hidden;padding:1.4rem 0;display:flex;flex-direction:column;gap:.6rem;height:calc(100dvh - 15.4rem)}.s4y-aside-body-section-item__children{font-size:1.4rem;margin:.6rem 0 .6rem 2.2rem;display:flex;flex-direction:column;gap:1rem;color:var(--gray-100)}.s4y-aside-body-section-item__children a{cursor:pointer}.s4y-aside-body-section-item__children a:hover{text-decoration:underline;color:var(--gray-100)}.s4y-aside-body-section-item__infor{padding:1rem;display:flex;align-items:center;justify-content:space-between;font-size:1.4rem;gap:.8rem;height:4rem;color:var(--gray-100);cursor:pointer;transition:.5s ease}.s4y-aside-body-section-item__infor:hover{color:#fff;border-radius:var(--radius)}.s4y-aside-body-section-item__infor.active{border-radius:var(--radius);color:#fff}.s4y-aside-body-section-item-title{display:flex;align-items:center;justify-content:center;gap:.8rem}.s4y-aside-body-section-item-title img{width:2.8rem}.s4y-aside-body__user{height:6.8rem;padding:1.4rem 0;margin:0 1.4rem;border-top:1px solid var(--gray-200);display:flex;align-items:center;justify-content:flex-start;flex-shrink:0;gap:1.4rem}.s4y-aside-body-user__image{width:3.8rem;height:3.8rem;border-radius:100%;object-fit:cover;object-position:top center;flex-shrink:0}.s4y-aside-body-user_name{font-size:1.4rem;font-weight:700;color:var(--gray-100)}.s4y-aside-body-user_email{font-size:1.3rem;color:var(--gray-200)}@media screen and (min-width: 320px) and (max-width: 480px){:host[data-opened=false] .s4y-aside{transform:translate(-100%)}:host[data-opened=false] .s4y-aside-overlay{opacity:0;pointer-events:none}:host[data-opened=true] .s4y-aside{transform:translate(0)}:host[data-opened=true] .s4y-aside-overlay{opacity:1}}@media screen and (min-width: 481px) and (max-width: 767px){:host[data-opened=false] .s4y-aside{transform:translate(-100%)}:host[data-opened=false] .s4y-aside-overlay{opacity:0;pointer-events:none}:host[data-opened=true] .s4y-aside{transform:translate(0)}:host[data-opened=true] .s4y-aside-overlay{opacity:1}}@media screen and (min-width: 768px) and (max-width: 1024px){:host[data-opened=false] .s4y-aside{transform:translate(-100%)}:host[data-opened=false] .s4y-aside-overlay{opacity:0;pointer-events:none}:host[data-opened=true] .s4y-aside{transform:translate(0)}:host[data-opened=true] .s4y-aside-overlay{opacity:1}}@media screen and (min-width: 1025px) and (max-width: 1280px){:host[data-opened=false] .s4y-aside-body-section-item__infor{align-items:center;justify-content:center}:host[data-opened=false] .s4y-aside-body-section-item-title p{display:none}:host[data-opened=false] .s4y-aside-body-section-item__children{display:none}:host[data-opened=false] .s4y-aside-arrow{display:none}:host[data-opened=false] .s4y-aside-header__infor{display:none}:host[data-opened=false] .s4y-aside-body-user__infor{display:none}:host[data-opened=false] .s4y-aside-header__container,:host[data-opened=false] .s4y-aside-body__user{align-items:center;justify-content:center}:host[data-opened=true] .s4y-aside{width:28rem}}@media screen and (min-width: 1281px){:host[data-opened=false] .s4y-aside-body-section-item__infor{align-items:center;justify-content:center}:host[data-opened=false] .s4y-aside-body-section-item-title p{display:none}:host[data-opened=false] .s4y-aside-body-section-item__children{display:none}:host[data-opened=false] .s4y-aside-arrow{display:none}:host[data-opened=false] .s4y-aside-header__infor{display:none}:host[data-opened=false] .s4y-aside-body-user__infor{display:none}:host[data-opened=false] .s4y-aside-header__container,:host[data-opened=false] .s4y-aside-body__user{align-items:center;justify-content:center}:host[data-opened=true] .s4y-aside{width:28rem}}\n"], dependencies: [{ kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: S4yAvatarComponent, selector: "s4y-avatar", inputs: ["src", "alt", "size", "rounded", "border"] }] });
|
|
147
|
+
}
|
|
148
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: AsideComponent, decorators: [{
|
|
149
|
+
type: Component,
|
|
150
|
+
args: [{ selector: 's4y-aside', standalone: false, host: {
|
|
151
|
+
'[attr.data-opened]': 'isOpened()',
|
|
152
|
+
}, template: "<div class=\"s4y-aside-overlay\" (click)=\"closeWithClickedOverlay()\"></div>\r\n\r\n<aside [attr.data-opened]=\"isOpened()\" class=\"s4y-aside\">\r\n <div class=\"s4y-aside-header__container\">\r\n @if (headerTemplate) {\r\n <ng-container [ngTemplateOutlet]=\"headerTemplate\"></ng-container>\r\n } @else {\r\n <div class=\"s4y-aside-header\">\r\n <img class=\"s4y-aside-logo\" [src]=\"companyLogoSrc()\" />\r\n <div class=\"s4y-aside-header__infor\">\r\n <p class=\"s4y-aside-title\">{{ companyTitle() }}</p>\r\n <p class=\"s4y-aside-description\">{{ companyDescription() }}</p>\r\n </div>\r\n </div>\r\n }\r\n </div>\r\n\r\n <div class=\"s4y-aside-body__container\">\r\n <!-- Body Abaixo -->\r\n <div class=\"s4y-aside-body-section\">\r\n @for (menu of menus(); track $index) {\r\n <div class=\"s4y-aside-body-section__item\">\r\n <div\r\n class=\"s4y-aside-body-section-item__infor\"\r\n [class.active]=\"menu.isOpen\"\r\n (click)=\"onToggle(menu)\"\r\n >\r\n <div\r\n class=\"s4y-aside-body-section-item-title\"\r\n [class.closed]=\"!isOpened\"\r\n >\r\n @if (menuTemplate) {\r\n <ng-container\r\n *ngTemplateOutlet=\"menuTemplate; context: { $implicit: menu }\"\r\n ></ng-container>\r\n } @else { @if (menu.iconUri) {\r\n <img [src]=\"menu.iconUri\" alt=\"Icone\" />\r\n }\r\n <p>{{ menu.title }}</p>\r\n }\r\n </div>\r\n\r\n @if (menu.children?.length) {\r\n <!-- -->\r\n @if (menu.isOpen) {\r\n <ng-container [ngTemplateOutlet]=\"arrowBottom\"></ng-container>\r\n } @else {\r\n <ng-container [ngTemplateOutlet]=\"arrowRight\"></ng-container>\r\n }\r\n <!-- -->\r\n }\r\n </div>\r\n @if (menu.isOpen) {\r\n <div class=\"s4y-aside-body-section-item__children\">\r\n @for (children of menu.children; track $index) {\r\n <div class=\"s4y-aside-body-section-item-children__item\">\r\n <a>{{ children.title }}</a>\r\n </div>\r\n }\r\n </div>\r\n }\r\n </div>\r\n }\r\n <!-- <div class=\"s4y-aside-body-section__scroll\"></div> -->\r\n </div>\r\n <!-- Body Acima -->\r\n <div class=\"s4y-aside-body__user\">\r\n @if (footerTemplate) {\r\n <ng-container [ngTemplateOutlet]=\"footerTemplate\"></ng-container>\r\n } @else {\r\n <s4y-avatar [src]=\"userImage()\"></s4y-avatar>\r\n <div class=\"s4y-aside-body-user__infor\">\r\n <p class=\"s4y-aside-body-user_name\">{{ userName() }}</p>\r\n <p class=\"s4y-aside-body-user_email\">{{ userEmail() }}</p>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n</aside>\r\n\r\n<ng-template #arrowRight>\r\n <span class=\"s4y-aside-arrow\">\r\n <svg\r\n width=\"1.8rem\"\r\n height=\"1.8rem\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"currentColor\"\r\n >\r\n <path\r\n d=\"M13.1717 12.0007L8.22192 7.05093L9.63614 5.63672L16.0001 12.0007L9.63614 18.3646L8.22192 16.9504L13.1717 12.0007Z\"\r\n ></path>\r\n </svg>\r\n </span>\r\n</ng-template>\r\n<ng-template #arrowBottom>\r\n <span class=\"s4y-aside-arrow\">\r\n <svg\r\n width=\"1.8rem\"\r\n height=\"1.8rem\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"currentColor\"\r\n >\r\n <path\r\n d=\"M11.9999 13.1714L16.9497 8.22168L18.3639 9.63589L11.9999 15.9999L5.63599 9.63589L7.0502 8.22168L11.9999 13.1714Z\"\r\n ></path>\r\n </svg>\r\n </span>\r\n</ng-template>\r\n", styles: ["@charset \"UTF-8\";.s4y-aside-overlay{display:none}@media screen and (min-width: 320px) and (max-width: 480px){.s4y-aside-overlay{position:fixed;display:block;top:0;left:0;width:100vw;height:100vh;background-color:#00000080;z-index:var(--z-index-overlay)}}@media screen and (min-width: 481px) and (max-width: 767px){.s4y-aside-overlay{position:fixed;display:block;top:0;left:0;width:100vw;height:100vh;background-color:#00000080;z-index:var(--z-index-overlay)}}@media screen and (min-width: 768px) and (max-width: 1024px){.s4y-aside-overlay{position:fixed;display:block;top:0;left:0;width:100vw;height:100vh;background-color:#00000080;z-index:var(--z-index-overlay)}}.s4y-aside{background-color:var(--primary-color);height:100dvh;overflow-x:hidden;width:8rem;border-right:1px solid var(--gray-200);display:flex;flex-direction:column;transition:.5s ease,padding .5s ease;flex-shrink:0}@media screen and (min-width: 320px) and (max-width: 480px){.s4y-aside{position:fixed;top:0;left:0;width:80%;z-index:var(--z-index-emergency)}}@media screen and (min-width: 481px) and (max-width: 767px){.s4y-aside{position:fixed;top:0;left:0;width:80%;max-width:32rem;z-index:var(--z-index-emergency)}}@media screen and (min-width: 768px) and (max-width: 1024px){.s4y-aside{position:fixed;top:0;left:0;width:80%;max-width:32rem;z-index:var(--z-index-emergency)}}.s4y-aside-header__container{height:var(--nav-height);position:relative;display:flex;align-items:center;border-bottom:1px solid var(--gray-200);padding:1.4rem 0;margin:0 1.4rem}.s4y-aside-header{display:flex;align-items:center;gap:1.4rem}.s4y-aside-logo{max-width:4rem;max-height:4rem;border-radius:var(--radius);object-fit:cover;border:1px solid var(--gray-300);flex-shrink:0}.s4y-aside-header__infor{display:flex;flex-direction:column;gap:.2}.s4y-aside-title{font-size:1.6rem;font-weight:700;color:var(--gray-100)}.s4y-aside-description{font-size:1.3rem;color:var(--gray-200)}.s4y-aside-body__container{display:flex;flex-direction:column;flex-grow:1}.s4y-aside-body-section{margin:1.8rem 1.4rem 0;flex-grow:1;overflow-y:auto;overflow-x:hidden;padding:1.4rem 0;display:flex;flex-direction:column;gap:.6rem;height:calc(100dvh - 15.4rem)}.s4y-aside-body-section-item__children{font-size:1.4rem;margin:.6rem 0 .6rem 2.2rem;display:flex;flex-direction:column;gap:1rem;color:var(--gray-100)}.s4y-aside-body-section-item__children a{cursor:pointer}.s4y-aside-body-section-item__children a:hover{text-decoration:underline;color:var(--gray-100)}.s4y-aside-body-section-item__infor{padding:1rem;display:flex;align-items:center;justify-content:space-between;font-size:1.4rem;gap:.8rem;height:4rem;color:var(--gray-100);cursor:pointer;transition:.5s ease}.s4y-aside-body-section-item__infor:hover{color:#fff;border-radius:var(--radius)}.s4y-aside-body-section-item__infor.active{border-radius:var(--radius);color:#fff}.s4y-aside-body-section-item-title{display:flex;align-items:center;justify-content:center;gap:.8rem}.s4y-aside-body-section-item-title img{width:2.8rem}.s4y-aside-body__user{height:6.8rem;padding:1.4rem 0;margin:0 1.4rem;border-top:1px solid var(--gray-200);display:flex;align-items:center;justify-content:flex-start;flex-shrink:0;gap:1.4rem}.s4y-aside-body-user__image{width:3.8rem;height:3.8rem;border-radius:100%;object-fit:cover;object-position:top center;flex-shrink:0}.s4y-aside-body-user_name{font-size:1.4rem;font-weight:700;color:var(--gray-100)}.s4y-aside-body-user_email{font-size:1.3rem;color:var(--gray-200)}@media screen and (min-width: 320px) and (max-width: 480px){:host[data-opened=false] .s4y-aside{transform:translate(-100%)}:host[data-opened=false] .s4y-aside-overlay{opacity:0;pointer-events:none}:host[data-opened=true] .s4y-aside{transform:translate(0)}:host[data-opened=true] .s4y-aside-overlay{opacity:1}}@media screen and (min-width: 481px) and (max-width: 767px){:host[data-opened=false] .s4y-aside{transform:translate(-100%)}:host[data-opened=false] .s4y-aside-overlay{opacity:0;pointer-events:none}:host[data-opened=true] .s4y-aside{transform:translate(0)}:host[data-opened=true] .s4y-aside-overlay{opacity:1}}@media screen and (min-width: 768px) and (max-width: 1024px){:host[data-opened=false] .s4y-aside{transform:translate(-100%)}:host[data-opened=false] .s4y-aside-overlay{opacity:0;pointer-events:none}:host[data-opened=true] .s4y-aside{transform:translate(0)}:host[data-opened=true] .s4y-aside-overlay{opacity:1}}@media screen and (min-width: 1025px) and (max-width: 1280px){:host[data-opened=false] .s4y-aside-body-section-item__infor{align-items:center;justify-content:center}:host[data-opened=false] .s4y-aside-body-section-item-title p{display:none}:host[data-opened=false] .s4y-aside-body-section-item__children{display:none}:host[data-opened=false] .s4y-aside-arrow{display:none}:host[data-opened=false] .s4y-aside-header__infor{display:none}:host[data-opened=false] .s4y-aside-body-user__infor{display:none}:host[data-opened=false] .s4y-aside-header__container,:host[data-opened=false] .s4y-aside-body__user{align-items:center;justify-content:center}:host[data-opened=true] .s4y-aside{width:28rem}}@media screen and (min-width: 1281px){:host[data-opened=false] .s4y-aside-body-section-item__infor{align-items:center;justify-content:center}:host[data-opened=false] .s4y-aside-body-section-item-title p{display:none}:host[data-opened=false] .s4y-aside-body-section-item__children{display:none}:host[data-opened=false] .s4y-aside-arrow{display:none}:host[data-opened=false] .s4y-aside-header__infor{display:none}:host[data-opened=false] .s4y-aside-body-user__infor{display:none}:host[data-opened=false] .s4y-aside-header__container,:host[data-opened=false] .s4y-aside-body__user{align-items:center;justify-content:center}:host[data-opened=true] .s4y-aside{width:28rem}}\n"] }]
|
|
153
|
+
}], propDecorators: { menuTemplate: [{
|
|
154
|
+
type: ContentChild,
|
|
155
|
+
args: ['menuTemplate']
|
|
156
|
+
}], headerTemplate: [{
|
|
157
|
+
type: ContentChild,
|
|
158
|
+
args: ['headerTemplate']
|
|
159
|
+
}], footerTemplate: [{
|
|
160
|
+
type: ContentChild,
|
|
161
|
+
args: ['footerTemplate']
|
|
162
|
+
}] } });
|
|
163
|
+
|
|
164
|
+
class DashboardRoutesComponent {
|
|
165
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: DashboardRoutesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
166
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.7", type: DashboardRoutesComponent, isStandalone: false, selector: "s4y-dashboard-routes", ngImport: i0, template: "<ng-content></ng-content>\r\n", styles: [":host{display:block;overflow-y:auto;overflow-x:hidden;height:calc(100dvh - var(--nav-height))}\n"] });
|
|
167
|
+
}
|
|
168
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: DashboardRoutesComponent, decorators: [{
|
|
169
|
+
type: Component,
|
|
170
|
+
args: [{ selector: 's4y-dashboard-routes', standalone: false, template: "<ng-content></ng-content>\r\n", styles: [":host{display:block;overflow-y:auto;overflow-x:hidden;height:calc(100dvh - var(--nav-height))}\n"] }]
|
|
171
|
+
}] });
|
|
172
|
+
|
|
173
|
+
class DashboardContainerComponent {
|
|
174
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: DashboardContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
175
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.7", type: DashboardContainerComponent, isStandalone: false, selector: "s4y-dashboard-container", ngImport: i0, template: "<ng-content></ng-content>\r\n", styles: [":host{display:block;padding:1.4rem 4rem 3.2rem;min-height:100%}\n"] });
|
|
176
|
+
}
|
|
177
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: DashboardContainerComponent, decorators: [{
|
|
178
|
+
type: Component,
|
|
179
|
+
args: [{ selector: 's4y-dashboard-container', standalone: false, template: "<ng-content></ng-content>\r\n", styles: [":host{display:block;padding:1.4rem 4rem 3.2rem;min-height:100%}\n"] }]
|
|
180
|
+
}] });
|
|
181
|
+
|
|
182
|
+
const COMPONENTS$1 = [
|
|
183
|
+
DashboardLayoutComponent,
|
|
184
|
+
AsideComponent,
|
|
185
|
+
NavbarComponent,
|
|
186
|
+
DashboardRoutesComponent,
|
|
187
|
+
DashboardContainerComponent,
|
|
188
|
+
];
|
|
189
|
+
class DashboardModule {
|
|
190
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: DashboardModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
191
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.7", ngImport: i0, type: DashboardModule, declarations: [DashboardLayoutComponent,
|
|
192
|
+
AsideComponent,
|
|
193
|
+
NavbarComponent,
|
|
194
|
+
DashboardRoutesComponent,
|
|
195
|
+
DashboardContainerComponent], imports: [RouterLink, CommonModule, S4yAvatarComponent], exports: [DashboardLayoutComponent,
|
|
196
|
+
AsideComponent,
|
|
197
|
+
NavbarComponent,
|
|
198
|
+
DashboardRoutesComponent,
|
|
199
|
+
DashboardContainerComponent] });
|
|
200
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: DashboardModule, imports: [CommonModule, S4yAvatarComponent] });
|
|
201
|
+
}
|
|
202
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: DashboardModule, decorators: [{
|
|
203
|
+
type: NgModule,
|
|
204
|
+
args: [{
|
|
205
|
+
declarations: [COMPONENTS$1],
|
|
206
|
+
exports: [COMPONENTS$1],
|
|
207
|
+
imports: [RouterLink, CommonModule, S4yAvatarComponent],
|
|
208
|
+
}]
|
|
209
|
+
}] });
|
|
210
|
+
|
|
211
|
+
// lib/components/dashboard/index.ts
|
|
212
|
+
|
|
213
|
+
class ButtonComponent {
|
|
214
|
+
disabled = input(false);
|
|
215
|
+
outlined = input(false, { transform: booleanAttribute });
|
|
216
|
+
loading = input(false);
|
|
217
|
+
size = input('medium');
|
|
218
|
+
variant = input('primary');
|
|
219
|
+
fullWidth = input(false);
|
|
220
|
+
ngAfterViewInit() { }
|
|
221
|
+
get isDisabled() {
|
|
222
|
+
return this.loading() || this.disabled();
|
|
223
|
+
}
|
|
224
|
+
variantClass = computed(() => {
|
|
225
|
+
switch (this.variant()) {
|
|
226
|
+
case 'primary':
|
|
227
|
+
return 'btn-primary';
|
|
228
|
+
case 'secondary':
|
|
229
|
+
return 'btn-secondary';
|
|
230
|
+
case 'danger':
|
|
231
|
+
return 'btn-danger';
|
|
232
|
+
case 'success':
|
|
233
|
+
return 'btn-success';
|
|
234
|
+
case 'info':
|
|
235
|
+
return 'btn-info';
|
|
236
|
+
default:
|
|
237
|
+
return 'btn-primary';
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: ButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
241
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.7", type: ButtonComponent, isStandalone: true, selector: "button[s4y-button], a[s4y-button]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, outlined: { classPropertyName: "outlined", publicName: "outlined", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, fullWidth: { classPropertyName: "fullWidth", publicName: "fullWidth", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.btn-default": "true", "class.loading": "loading()", "attr.size": "size()", "attr.variant": "variant()", "style.width": "fullWidth() ? \"100%\" : null", "class.outlined": "outlined()", "class.disabled": "disabled()", "class": "variantClass()", "disabled": "this.isDisabled" } }, ngImport: i0, template: `
|
|
242
|
+
@if (loading()) {
|
|
243
|
+
<div class="loader"></div>
|
|
244
|
+
} @else {
|
|
245
|
+
<ng-content></ng-content>
|
|
246
|
+
}
|
|
247
|
+
`, isInline: true, styles: [":host.btn-default{display:flex;align-items:center;justify-content:center;gap:.8rem;color:#fff;height:4rem;min-width:9.2rem;font-size:1.4rem;font-weight:500;border-radius:var(--radius);padding:.8rem 1.6rem;transition:.5s ease}:host([size=extra-small]){height:2.4rem;min-width:6.4rem;font-size:1.2rem;padding:.4rem .8rem}:host([size=small]){height:3.2rem;min-width:8rem;font-size:1.3rem;padding:.6rem 1.2rem}:host([size=medium]){height:4rem;min-width:9.2rem;font-size:1.4rem;padding:.8rem 1.6rem}:host([size=large]){height:4.8rem;min-width:10.4rem;font-size:1.5rem;padding:1rem 2rem}:host([size=extra-large]){height:5.6rem;min-width:11.6rem;font-size:1.6rem;padding:1.2rem 2.4rem}:host.btn-primary{background-color:var(--primary-color);border:1px solid var(--primary-color)}:host.btn-primary:hover{background-color:transparent;color:var(--primary-color);border:1px solid var(--primary-color)}:host.btn-primary:hover .loader{border:3px solid var(--primary-color)}:host.btn-primary.outlined{background-color:transparent;border:1px solid var(--primary-color);color:var(--primary-color)}:host.btn-primary.outlined .loader{border:3px solid var(--primary-color)}:host.btn-primary.outlined:hover{color:#fff;background-color:var(--primary-color)}:host.btn-primary.outlined:hover .loader{border:3px solid #fff}:host.btn-secondary{background-color:var(--secondary-color);border:1px solid var(--secondary-color)}:host.btn-secondary:hover{border:1px solid var(--secondary-color);color:var(--secondary-color);background-color:transparent}:host.btn-secondary:hover .loader{border:3px solid var(--secondary-color)}:host.btn-secondary.outlined{border:1px solid var(--secondary-color);background-color:transparent;color:var(--secondary-color)}:host.btn-secondary.outlined .loader{border:3px solid var(--secondary-color)}:host.btn-secondary.outlined:hover{background-color:var(--secondary-color);color:#fff;border:1px solid var(--secondary-color)}:host.btn-secondary.outlined:hover .loader{border:3px solid #fff}:host.btn-danger{background-color:var(--danger-color);border:1px solid var(--danger-color)}:host.btn-danger:hover{border:1px solid var(--danger-color);color:var(--danger-color);background-color:transparent}:host.btn-danger:hover .loader{border:3px solid var(--danger-color)}:host.btn-danger.outlined{border:1px solid var(--danger-color);color:var(--danger-color);background-color:transparent}:host.btn-danger.outlined .loader{border:3px solid var(--danger-color)}:host.btn-danger.outlined:hover{color:#fff;background-color:var(--danger-color);border:1px solid var(--danger-color)}:host.btn-danger.outlined:hover .loader{border:3px solid #fff}:host.btn-success{background-color:var(--success-color);border:1px solid var(--success-color)}:host.btn-success:hover{border:1px solid var(--success-color);color:var(--success-color);background-color:transparent}:host.btn-success:hover .loader{border:3px solid var(--success-color)}:host.btn-success.outlined{border:1px solid var(--success-color);color:var(--success-color);background-color:transparent}:host.btn-success.outlined .loader{border:3px solid var(--success-color)}:host.btn-success.outlined:hover{background-color:var(--success-color);border:1px solid var(--success-color);color:#fff}:host.btn-success.outlined:hover .loader{border:3px solid #fff}:host.btn-info{background-color:var(--infor-color);border:1px solid var(--infor-color)}:host.btn-info:hover{border:1px solid var(--infor-color);color:var(--infor-color);background-color:transparent}:host.btn-info:hover .loader{border:3px solid var(--infor-color)}:host.btn-info.outlined{border:1px solid var(--infor-color);color:var(--infor-color);background-color:transparent}:host.btn-info.outlined .loader{border:3px solid var(--infor-color)}:host.btn-info.outlined:hover{background-color:var(--infor-color);border:1px solid var(--infor-color);color:#fff}:host.btn-info.outlined:hover .loader{border:3px solid #fff}:host.disabled{background-color:#979797;color:#fff;cursor:default;border:1px solid #979797;padding:.8rem 1.6rem}:host.disabled:hover{background-color:#979797;color:#fff;border:1px solid #979797}:host.disabled.outlined{background-color:transparent;color:#979797;border:1px solid #979797;pointer-events:none}.loader{width:16px;aspect-ratio:1;border-radius:50%;border:3px solid #fff;animation:l20-1 .8s infinite linear alternate,l20-2 1.6s infinite linear}@keyframes l20-1{0%{clip-path:polygon(50% 50%,0 0,50% 0%,50% 0%,50% 0%,50% 0%,50% 0%)}12.5%{clip-path:polygon(50% 50%,0 0,50% 0%,100% 0%,100% 0%,100% 0%,100% 0%)}25%{clip-path:polygon(50% 50%,0 0,50% 0%,100% 0%,100% 100%,100% 100%,100% 100%)}50%{clip-path:polygon(50% 50%,0 0,50% 0%,100% 0%,100% 100%,50% 100%,0% 100%)}62.5%{clip-path:polygon(50% 50%,100% 0,100% 0%,100% 0%,100% 100%,50% 100%,0% 100%)}75%{clip-path:polygon(50% 50%,100% 100%,100% 100%,100% 100%,100% 100%,50% 100%,0% 100%)}to{clip-path:polygon(50% 50%,50% 100%,50% 100%,50% 100%,50% 100%,50% 100%,0% 100%)}}@keyframes l20-2{0%{transform:scaleY(1) rotate(0)}49.99%{transform:scaleY(1) rotate(135deg)}50%{transform:scaleY(-1) rotate(0)}to{transform:scaleY(-1) rotate(-135deg)}}\n"] });
|
|
248
|
+
}
|
|
249
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: ButtonComponent, decorators: [{
|
|
250
|
+
type: Component,
|
|
251
|
+
args: [{ selector: 'button[s4y-button], a[s4y-button]', imports: [], template: `
|
|
252
|
+
@if (loading()) {
|
|
253
|
+
<div class="loader"></div>
|
|
254
|
+
} @else {
|
|
255
|
+
<ng-content></ng-content>
|
|
256
|
+
}
|
|
257
|
+
`, standalone: true, host: {
|
|
258
|
+
'[class.btn-default]': 'true',
|
|
259
|
+
'[class.loading]': 'loading()',
|
|
260
|
+
'[attr.size]': 'size()',
|
|
261
|
+
'[attr.variant]': 'variant()',
|
|
262
|
+
'[style.width]': 'fullWidth() ? "100%" : null',
|
|
263
|
+
'[class.outlined]': 'outlined()',
|
|
264
|
+
'[class.disabled]': 'disabled()',
|
|
265
|
+
'[class]': 'variantClass()',
|
|
266
|
+
}, styles: [":host.btn-default{display:flex;align-items:center;justify-content:center;gap:.8rem;color:#fff;height:4rem;min-width:9.2rem;font-size:1.4rem;font-weight:500;border-radius:var(--radius);padding:.8rem 1.6rem;transition:.5s ease}:host([size=extra-small]){height:2.4rem;min-width:6.4rem;font-size:1.2rem;padding:.4rem .8rem}:host([size=small]){height:3.2rem;min-width:8rem;font-size:1.3rem;padding:.6rem 1.2rem}:host([size=medium]){height:4rem;min-width:9.2rem;font-size:1.4rem;padding:.8rem 1.6rem}:host([size=large]){height:4.8rem;min-width:10.4rem;font-size:1.5rem;padding:1rem 2rem}:host([size=extra-large]){height:5.6rem;min-width:11.6rem;font-size:1.6rem;padding:1.2rem 2.4rem}:host.btn-primary{background-color:var(--primary-color);border:1px solid var(--primary-color)}:host.btn-primary:hover{background-color:transparent;color:var(--primary-color);border:1px solid var(--primary-color)}:host.btn-primary:hover .loader{border:3px solid var(--primary-color)}:host.btn-primary.outlined{background-color:transparent;border:1px solid var(--primary-color);color:var(--primary-color)}:host.btn-primary.outlined .loader{border:3px solid var(--primary-color)}:host.btn-primary.outlined:hover{color:#fff;background-color:var(--primary-color)}:host.btn-primary.outlined:hover .loader{border:3px solid #fff}:host.btn-secondary{background-color:var(--secondary-color);border:1px solid var(--secondary-color)}:host.btn-secondary:hover{border:1px solid var(--secondary-color);color:var(--secondary-color);background-color:transparent}:host.btn-secondary:hover .loader{border:3px solid var(--secondary-color)}:host.btn-secondary.outlined{border:1px solid var(--secondary-color);background-color:transparent;color:var(--secondary-color)}:host.btn-secondary.outlined .loader{border:3px solid var(--secondary-color)}:host.btn-secondary.outlined:hover{background-color:var(--secondary-color);color:#fff;border:1px solid var(--secondary-color)}:host.btn-secondary.outlined:hover .loader{border:3px solid #fff}:host.btn-danger{background-color:var(--danger-color);border:1px solid var(--danger-color)}:host.btn-danger:hover{border:1px solid var(--danger-color);color:var(--danger-color);background-color:transparent}:host.btn-danger:hover .loader{border:3px solid var(--danger-color)}:host.btn-danger.outlined{border:1px solid var(--danger-color);color:var(--danger-color);background-color:transparent}:host.btn-danger.outlined .loader{border:3px solid var(--danger-color)}:host.btn-danger.outlined:hover{color:#fff;background-color:var(--danger-color);border:1px solid var(--danger-color)}:host.btn-danger.outlined:hover .loader{border:3px solid #fff}:host.btn-success{background-color:var(--success-color);border:1px solid var(--success-color)}:host.btn-success:hover{border:1px solid var(--success-color);color:var(--success-color);background-color:transparent}:host.btn-success:hover .loader{border:3px solid var(--success-color)}:host.btn-success.outlined{border:1px solid var(--success-color);color:var(--success-color);background-color:transparent}:host.btn-success.outlined .loader{border:3px solid var(--success-color)}:host.btn-success.outlined:hover{background-color:var(--success-color);border:1px solid var(--success-color);color:#fff}:host.btn-success.outlined:hover .loader{border:3px solid #fff}:host.btn-info{background-color:var(--infor-color);border:1px solid var(--infor-color)}:host.btn-info:hover{border:1px solid var(--infor-color);color:var(--infor-color);background-color:transparent}:host.btn-info:hover .loader{border:3px solid var(--infor-color)}:host.btn-info.outlined{border:1px solid var(--infor-color);color:var(--infor-color);background-color:transparent}:host.btn-info.outlined .loader{border:3px solid var(--infor-color)}:host.btn-info.outlined:hover{background-color:var(--infor-color);border:1px solid var(--infor-color);color:#fff}:host.btn-info.outlined:hover .loader{border:3px solid #fff}:host.disabled{background-color:#979797;color:#fff;cursor:default;border:1px solid #979797;padding:.8rem 1.6rem}:host.disabled:hover{background-color:#979797;color:#fff;border:1px solid #979797}:host.disabled.outlined{background-color:transparent;color:#979797;border:1px solid #979797;pointer-events:none}.loader{width:16px;aspect-ratio:1;border-radius:50%;border:3px solid #fff;animation:l20-1 .8s infinite linear alternate,l20-2 1.6s infinite linear}@keyframes l20-1{0%{clip-path:polygon(50% 50%,0 0,50% 0%,50% 0%,50% 0%,50% 0%,50% 0%)}12.5%{clip-path:polygon(50% 50%,0 0,50% 0%,100% 0%,100% 0%,100% 0%,100% 0%)}25%{clip-path:polygon(50% 50%,0 0,50% 0%,100% 0%,100% 100%,100% 100%,100% 100%)}50%{clip-path:polygon(50% 50%,0 0,50% 0%,100% 0%,100% 100%,50% 100%,0% 100%)}62.5%{clip-path:polygon(50% 50%,100% 0,100% 0%,100% 0%,100% 100%,50% 100%,0% 100%)}75%{clip-path:polygon(50% 50%,100% 100%,100% 100%,100% 100%,100% 100%,50% 100%,0% 100%)}to{clip-path:polygon(50% 50%,50% 100%,50% 100%,50% 100%,50% 100%,50% 100%,0% 100%)}}@keyframes l20-2{0%{transform:scaleY(1) rotate(0)}49.99%{transform:scaleY(1) rotate(135deg)}50%{transform:scaleY(-1) rotate(0)}to{transform:scaleY(-1) rotate(-135deg)}}\n"] }]
|
|
267
|
+
}], propDecorators: { isDisabled: [{
|
|
268
|
+
type: HostBinding,
|
|
269
|
+
args: ['disabled']
|
|
270
|
+
}] } });
|
|
271
|
+
|
|
272
|
+
class FormFieldComponent {
|
|
273
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: FormFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
274
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.7", type: FormFieldComponent, isStandalone: false, selector: "s4y-form-field", ngImport: i0, template: "<label class=\"form-field\">\r\n <ng-content select=\"s4y-label\"></ng-content>\r\n <div class=\"input-wrapper\">\r\n <ng-content select=\"s4y-input-prefix\"></ng-content>\r\n <ng-content select=\"input, textarea\"></ng-content>\r\n <ng-content select=\"s4y-input-sufix\"></ng-content>\r\n </div>\r\n</label>\r\n<ng-content select=\"s4y-hint, s4y-error-message\"></ng-content>\r\n", styles: [".form-field{display:flex;flex-direction:column;gap:.8rem}.form-field .input-wrapper{border-radius:var(--radius);display:flex;align-items:center;justify-content:space-between;padding:1.2rem 1.6rem;background-color:#fff;gap:1rem;border:1px solid var(--gray-500)}.form-field:has(input:disabled) .input-wrapper,.form-field:has(textarea:disabled) .input-wrapper{background-color:var(--gray-200)}.form-field:has(input.ng-invalid.ng-touched) .input-wrapper{border:1px solid var(--danger-color);background-color:#fff6f5}.form-field:has(input:focus) .input-wrapper{border:1px solid var(--primary-color)}\n"] });
|
|
275
|
+
}
|
|
276
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: FormFieldComponent, decorators: [{
|
|
277
|
+
type: Component,
|
|
278
|
+
args: [{ selector: 's4y-form-field', standalone: false, template: "<label class=\"form-field\">\r\n <ng-content select=\"s4y-label\"></ng-content>\r\n <div class=\"input-wrapper\">\r\n <ng-content select=\"s4y-input-prefix\"></ng-content>\r\n <ng-content select=\"input, textarea\"></ng-content>\r\n <ng-content select=\"s4y-input-sufix\"></ng-content>\r\n </div>\r\n</label>\r\n<ng-content select=\"s4y-hint, s4y-error-message\"></ng-content>\r\n", styles: [".form-field{display:flex;flex-direction:column;gap:.8rem}.form-field .input-wrapper{border-radius:var(--radius);display:flex;align-items:center;justify-content:space-between;padding:1.2rem 1.6rem;background-color:#fff;gap:1rem;border:1px solid var(--gray-500)}.form-field:has(input:disabled) .input-wrapper,.form-field:has(textarea:disabled) .input-wrapper{background-color:var(--gray-200)}.form-field:has(input.ng-invalid.ng-touched) .input-wrapper{border:1px solid var(--danger-color);background-color:#fff6f5}.form-field:has(input:focus) .input-wrapper{border:1px solid var(--primary-color)}\n"] }]
|
|
279
|
+
}] });
|
|
280
|
+
|
|
281
|
+
class InputComponent {
|
|
282
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: InputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
283
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.7", type: InputComponent, isStandalone: false, selector: "input[s4y-input], textarea[s4y-input]", ngImport: i0, template: "<p>input works!</p>\r\n", styles: [":host{background-color:transparent;outline:none;font-size:1.4rem;color:var(--gray-700);width:100%}:host::placeholder{font-size:1.4rem;transition:.3s ease;color:var(--gray-400)}:host:focus::placeholder{opacity:0}:host:disabled{color:#fff}\n"] });
|
|
284
|
+
}
|
|
285
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: InputComponent, decorators: [{
|
|
286
|
+
type: Component,
|
|
287
|
+
args: [{ selector: 'input[s4y-input], textarea[s4y-input]', standalone: false, template: "<p>input works!</p>\r\n", styles: [":host{background-color:transparent;outline:none;font-size:1.4rem;color:var(--gray-700);width:100%}:host::placeholder{font-size:1.4rem;transition:.3s ease;color:var(--gray-400)}:host:focus::placeholder{opacity:0}:host:disabled{color:#fff}\n"] }]
|
|
288
|
+
}] });
|
|
289
|
+
|
|
290
|
+
class LabelComponent {
|
|
291
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: LabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
292
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.7", type: LabelComponent, isStandalone: false, selector: "s4y-label", ngImport: i0, template: "<ng-content></ng-content>\r\n", styles: [":host{font-size:1.4rem;max-width:max-content}\n"] });
|
|
293
|
+
}
|
|
294
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: LabelComponent, decorators: [{
|
|
295
|
+
type: Component,
|
|
296
|
+
args: [{ selector: 's4y-label', standalone: false, template: "<ng-content></ng-content>\r\n", styles: [":host{font-size:1.4rem;max-width:max-content}\n"] }]
|
|
297
|
+
}] });
|
|
298
|
+
|
|
299
|
+
class HintComponent {
|
|
300
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: HintComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
301
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.7", type: HintComponent, isStandalone: false, selector: "s4y-hint", ngImport: i0, template: "<ng-content></ng-content>\r\n", styles: [":host{font-size:1.2rem;color:var(--danger-color);margin-top:.8rem;display:block;color:var(--gray-700)}\n"] });
|
|
302
|
+
}
|
|
303
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: HintComponent, decorators: [{
|
|
304
|
+
type: Component,
|
|
305
|
+
args: [{ selector: 's4y-hint', standalone: false, template: "<ng-content></ng-content>\r\n", styles: [":host{font-size:1.2rem;color:var(--danger-color);margin-top:.8rem;display:block;color:var(--gray-700)}\n"] }]
|
|
306
|
+
}] });
|
|
307
|
+
|
|
308
|
+
class ErrorMessageComponent {
|
|
309
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: ErrorMessageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
310
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.7", type: ErrorMessageComponent, isStandalone: false, selector: "s4y-error-message", ngImport: i0, template: "<ng-content></ng-content>\r\n", styles: [":host{font-size:1.2rem;color:var(--danger-color);margin-top:.8rem;display:block;font-weight:500}\n"] });
|
|
311
|
+
}
|
|
312
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: ErrorMessageComponent, decorators: [{
|
|
313
|
+
type: Component,
|
|
314
|
+
args: [{ selector: 's4y-error-message', standalone: false, template: "<ng-content></ng-content>\r\n", styles: [":host{font-size:1.2rem;color:var(--danger-color);margin-top:.8rem;display:block;font-weight:500}\n"] }]
|
|
315
|
+
}] });
|
|
316
|
+
|
|
317
|
+
class InputPrefixComponent {
|
|
318
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: InputPrefixComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
319
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.7", type: InputPrefixComponent, isStandalone: false, selector: "s4y-input-prefix", ngImport: i0, template: "<ng-content></ng-content>\r\n", styles: [":host{cursor:pointer;width:100%;height:100%;max-width:2rem;max-height:2rem;display:flex;align-items:center;justify-content:center;background-color:transparent;border:none}\n"] });
|
|
320
|
+
}
|
|
321
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: InputPrefixComponent, decorators: [{
|
|
322
|
+
type: Component,
|
|
323
|
+
args: [{ selector: 's4y-input-prefix', standalone: false, template: "<ng-content></ng-content>\r\n", styles: [":host{cursor:pointer;width:100%;height:100%;max-width:2rem;max-height:2rem;display:flex;align-items:center;justify-content:center;background-color:transparent;border:none}\n"] }]
|
|
324
|
+
}] });
|
|
325
|
+
|
|
326
|
+
class InputSufixComponent {
|
|
327
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: InputSufixComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
328
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.7", type: InputSufixComponent, isStandalone: false, selector: "s4y-input-sufix", ngImport: i0, template: "<ng-content></ng-content>\r\n", styles: [":host{cursor:pointer;width:100%;height:100%;max-width:2rem;max-height:2rem;display:flex;align-items:center;justify-content:center;background-color:transparent;border:none}\n"] });
|
|
329
|
+
}
|
|
330
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: InputSufixComponent, decorators: [{
|
|
331
|
+
type: Component,
|
|
332
|
+
args: [{ selector: 's4y-input-sufix', standalone: false, template: "<ng-content></ng-content>\r\n", styles: [":host{cursor:pointer;width:100%;height:100%;max-width:2rem;max-height:2rem;display:flex;align-items:center;justify-content:center;background-color:transparent;border:none}\n"] }]
|
|
333
|
+
}] });
|
|
334
|
+
|
|
335
|
+
class FormFieldPasswordComponent {
|
|
336
|
+
type = 'password';
|
|
337
|
+
label = input('Senha');
|
|
338
|
+
name = input();
|
|
339
|
+
id = input();
|
|
340
|
+
model = model('');
|
|
341
|
+
value = '';
|
|
342
|
+
disabled = false;
|
|
343
|
+
isDisabled = input(false);
|
|
344
|
+
hasError = model(false);
|
|
345
|
+
togglePasswordVisibility() {
|
|
346
|
+
this.type = this.type === 'text' ? 'password' : 'text';
|
|
347
|
+
}
|
|
348
|
+
onInput(e) {
|
|
349
|
+
const value = e.target.value;
|
|
350
|
+
this.value = value;
|
|
351
|
+
this.model.set(value);
|
|
352
|
+
this.onChanged(this.value);
|
|
353
|
+
this.onTouched();
|
|
354
|
+
this.hasError.set(false);
|
|
355
|
+
}
|
|
356
|
+
onChanged = (value) => { };
|
|
357
|
+
onTouched = () => { };
|
|
358
|
+
writeValue(value) {
|
|
359
|
+
this.value = value || '';
|
|
360
|
+
}
|
|
361
|
+
registerOnChange(fn) {
|
|
362
|
+
this.onChanged = fn;
|
|
363
|
+
}
|
|
364
|
+
registerOnTouched(fn) {
|
|
365
|
+
this.onTouched = fn;
|
|
366
|
+
}
|
|
367
|
+
setDisabledState(isDisabled) {
|
|
368
|
+
this.disabled = isDisabled;
|
|
369
|
+
}
|
|
370
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: FormFieldPasswordComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
371
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.7", type: FormFieldPasswordComponent, isStandalone: false, selector: "s4y-form-field-password", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null }, isDisabled: { classPropertyName: "isDisabled", publicName: "isDisabled", isSignal: true, isRequired: false, transformFunction: null }, hasError: { classPropertyName: "hasError", publicName: "hasError", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { model: "modelChange", hasError: "hasErrorChange" }, providers: [
|
|
372
|
+
{
|
|
373
|
+
multi: true,
|
|
374
|
+
provide: NG_VALUE_ACCESSOR,
|
|
375
|
+
useExisting: forwardRef(() => FormFieldPasswordComponent),
|
|
376
|
+
},
|
|
377
|
+
], ngImport: i0, template: "<label class=\"form-field\">\r\n <s4y-label>\r\n {{ label() }}\r\n </s4y-label>\r\n <div class=\"input-wrapper\" [class.error]=\"hasError()\">\r\n <ng-content select=\"s4y-input-prefix\"></ng-content>\r\n <input\r\n s4y-input\r\n [value]=\"value\"\r\n (input)=\"onInput($event)\"\r\n (blur)=\"onTouched()\"\r\n [disabled]=\"disabled || isDisabled()\"\r\n [type]=\"type\"\r\n [name]=\"name()\"\r\n [id]=\"id()\"\r\n />\r\n <s4y-input-sufix>\r\n <button\r\n type=\"button\"\r\n class=\"shown-password\"\r\n (click)=\"togglePasswordVisibility()\"\r\n >\r\n <ng-container *ngTemplateOutlet=\"eye\"></ng-container>\r\n </button>\r\n </s4y-input-sufix>\r\n </div>\r\n</label>\r\n<ng-content select=\"s4y-hint, s4y-error-message\"></ng-content>\r\n\r\n<!-- Icone cadeado -->\r\n<ng-template #eye>\r\n <!-- Olho fechado -->\r\n @if (type == 'password') {\r\n <svg\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"currentColor\"\r\n >\r\n <path\r\n 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\"\r\n ></path>\r\n </svg>\r\n }\r\n\r\n <!-- Olho aberto -->\r\n @if (type == 'text') {\r\n <svg\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"currentColor\"\r\n >\r\n <path\r\n d=\"M17.8827 19.2968C16.1814 20.3755 14.1638 21.0002 12.0003 21.0002C6.60812 21.0002 2.12215 17.1204 1.18164 12.0002C1.61832 9.62282 2.81932 7.5129 4.52047 5.93457L1.39366 2.80777L2.80788 1.39355L22.6069 21.1925L21.1927 22.6068L17.8827 19.2968ZM5.9356 7.3497C4.60673 8.56015 3.6378 10.1672 3.22278 12.0002C4.14022 16.0521 7.7646 19.0002 12.0003 19.0002C13.5997 19.0002 15.112 18.5798 16.4243 17.8384L14.396 15.8101C13.7023 16.2472 12.8808 16.5002 12.0003 16.5002C9.51498 16.5002 7.50026 14.4854 7.50026 12.0002C7.50026 11.1196 7.75317 10.2981 8.19031 9.60442L5.9356 7.3497ZM12.9139 14.328L9.67246 11.0866C9.5613 11.3696 9.50026 11.6777 9.50026 12.0002C9.50026 13.3809 10.6196 14.5002 12.0003 14.5002C12.3227 14.5002 12.6309 14.4391 12.9139 14.328ZM20.8068 16.5925L19.376 15.1617C20.0319 14.2268 20.5154 13.1586 20.7777 12.0002C19.8603 7.94818 16.2359 5.00016 12.0003 5.00016C11.1544 5.00016 10.3329 5.11773 9.55249 5.33818L7.97446 3.76015C9.22127 3.26959 10.5793 3.00016 12.0003 3.00016C17.3924 3.00016 21.8784 6.87992 22.8189 12.0002C22.5067 13.6998 21.8038 15.2628 20.8068 16.5925ZM11.7229 7.50857C11.8146 7.50299 11.9071 7.50016 12.0003 7.50016C14.4855 7.50016 16.5003 9.51488 16.5003 12.0002C16.5003 12.0933 16.4974 12.1858 16.4919 12.2775L11.7229 7.50857Z\"\r\n ></path>\r\n </svg>\r\n }\r\n</ng-template>\r\n", styles: [".form-field{display:flex;flex-direction:column;gap:.8rem}.form-field .input-wrapper{border-radius:var(--radius);display:flex;align-items:center;justify-content:space-between;padding:1.2rem 1.6rem;background-color:#fff;gap:1rem;border:1px solid var(--gray-500)}.form-field:has(input:disabled) .input-wrapper{background-color:var(--gray-200)}:host.ng-invalid.ng-touched .input-wrapper{border:1px solid var(--danger-color);background-color:#fff6f5}.form-field:has(input:focus) .input-wrapper{border:1px solid var(--primary-color)}.shown-password{height:48px;width:48px}.form-field .input-wrapper.error{border:1px solid var(--danger-color);background-color:#fff6f5}\n"], dependencies: [{ kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: InputComponent, selector: "input[s4y-input], textarea[s4y-input]" }, { kind: "component", type: LabelComponent, selector: "s4y-label" }, { kind: "component", type: InputSufixComponent, selector: "s4y-input-sufix" }] });
|
|
378
|
+
}
|
|
379
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: FormFieldPasswordComponent, decorators: [{
|
|
380
|
+
type: Component,
|
|
381
|
+
args: [{ selector: 's4y-form-field-password', standalone: false, providers: [
|
|
382
|
+
{
|
|
383
|
+
multi: true,
|
|
384
|
+
provide: NG_VALUE_ACCESSOR,
|
|
385
|
+
useExisting: forwardRef(() => FormFieldPasswordComponent),
|
|
386
|
+
},
|
|
387
|
+
], template: "<label class=\"form-field\">\r\n <s4y-label>\r\n {{ label() }}\r\n </s4y-label>\r\n <div class=\"input-wrapper\" [class.error]=\"hasError()\">\r\n <ng-content select=\"s4y-input-prefix\"></ng-content>\r\n <input\r\n s4y-input\r\n [value]=\"value\"\r\n (input)=\"onInput($event)\"\r\n (blur)=\"onTouched()\"\r\n [disabled]=\"disabled || isDisabled()\"\r\n [type]=\"type\"\r\n [name]=\"name()\"\r\n [id]=\"id()\"\r\n />\r\n <s4y-input-sufix>\r\n <button\r\n type=\"button\"\r\n class=\"shown-password\"\r\n (click)=\"togglePasswordVisibility()\"\r\n >\r\n <ng-container *ngTemplateOutlet=\"eye\"></ng-container>\r\n </button>\r\n </s4y-input-sufix>\r\n </div>\r\n</label>\r\n<ng-content select=\"s4y-hint, s4y-error-message\"></ng-content>\r\n\r\n<!-- Icone cadeado -->\r\n<ng-template #eye>\r\n <!-- Olho fechado -->\r\n @if (type == 'password') {\r\n <svg\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"currentColor\"\r\n >\r\n <path\r\n 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\"\r\n ></path>\r\n </svg>\r\n }\r\n\r\n <!-- Olho aberto -->\r\n @if (type == 'text') {\r\n <svg\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"currentColor\"\r\n >\r\n <path\r\n d=\"M17.8827 19.2968C16.1814 20.3755 14.1638 21.0002 12.0003 21.0002C6.60812 21.0002 2.12215 17.1204 1.18164 12.0002C1.61832 9.62282 2.81932 7.5129 4.52047 5.93457L1.39366 2.80777L2.80788 1.39355L22.6069 21.1925L21.1927 22.6068L17.8827 19.2968ZM5.9356 7.3497C4.60673 8.56015 3.6378 10.1672 3.22278 12.0002C4.14022 16.0521 7.7646 19.0002 12.0003 19.0002C13.5997 19.0002 15.112 18.5798 16.4243 17.8384L14.396 15.8101C13.7023 16.2472 12.8808 16.5002 12.0003 16.5002C9.51498 16.5002 7.50026 14.4854 7.50026 12.0002C7.50026 11.1196 7.75317 10.2981 8.19031 9.60442L5.9356 7.3497ZM12.9139 14.328L9.67246 11.0866C9.5613 11.3696 9.50026 11.6777 9.50026 12.0002C9.50026 13.3809 10.6196 14.5002 12.0003 14.5002C12.3227 14.5002 12.6309 14.4391 12.9139 14.328ZM20.8068 16.5925L19.376 15.1617C20.0319 14.2268 20.5154 13.1586 20.7777 12.0002C19.8603 7.94818 16.2359 5.00016 12.0003 5.00016C11.1544 5.00016 10.3329 5.11773 9.55249 5.33818L7.97446 3.76015C9.22127 3.26959 10.5793 3.00016 12.0003 3.00016C17.3924 3.00016 21.8784 6.87992 22.8189 12.0002C22.5067 13.6998 21.8038 15.2628 20.8068 16.5925ZM11.7229 7.50857C11.8146 7.50299 11.9071 7.50016 12.0003 7.50016C14.4855 7.50016 16.5003 9.51488 16.5003 12.0002C16.5003 12.0933 16.4974 12.1858 16.4919 12.2775L11.7229 7.50857Z\"\r\n ></path>\r\n </svg>\r\n }\r\n</ng-template>\r\n", styles: [".form-field{display:flex;flex-direction:column;gap:.8rem}.form-field .input-wrapper{border-radius:var(--radius);display:flex;align-items:center;justify-content:space-between;padding:1.2rem 1.6rem;background-color:#fff;gap:1rem;border:1px solid var(--gray-500)}.form-field:has(input:disabled) .input-wrapper{background-color:var(--gray-200)}:host.ng-invalid.ng-touched .input-wrapper{border:1px solid var(--danger-color);background-color:#fff6f5}.form-field:has(input:focus) .input-wrapper{border:1px solid var(--primary-color)}.shown-password{height:48px;width:48px}.form-field .input-wrapper.error{border:1px solid var(--danger-color);background-color:#fff6f5}\n"] }]
|
|
388
|
+
}] });
|
|
389
|
+
|
|
390
|
+
const COMPONENTS = [
|
|
391
|
+
FormFieldComponent,
|
|
392
|
+
InputComponent,
|
|
393
|
+
LabelComponent,
|
|
394
|
+
HintComponent,
|
|
395
|
+
ErrorMessageComponent,
|
|
396
|
+
InputPrefixComponent,
|
|
397
|
+
InputSufixComponent,
|
|
398
|
+
FormFieldPasswordComponent,
|
|
399
|
+
];
|
|
400
|
+
class FormsKitModule {
|
|
401
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: FormsKitModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
402
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.7", ngImport: i0, type: FormsKitModule, declarations: [FormFieldComponent,
|
|
403
|
+
InputComponent,
|
|
404
|
+
LabelComponent,
|
|
405
|
+
HintComponent,
|
|
406
|
+
ErrorMessageComponent,
|
|
407
|
+
InputPrefixComponent,
|
|
408
|
+
InputSufixComponent,
|
|
409
|
+
FormFieldPasswordComponent], imports: [CommonModule], exports: [FormFieldComponent,
|
|
410
|
+
InputComponent,
|
|
411
|
+
LabelComponent,
|
|
412
|
+
HintComponent,
|
|
413
|
+
ErrorMessageComponent,
|
|
414
|
+
InputPrefixComponent,
|
|
415
|
+
InputSufixComponent,
|
|
416
|
+
FormFieldPasswordComponent] });
|
|
417
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: FormsKitModule, imports: [CommonModule] });
|
|
418
|
+
}
|
|
419
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: FormsKitModule, decorators: [{
|
|
420
|
+
type: NgModule,
|
|
421
|
+
args: [{
|
|
422
|
+
declarations: COMPONENTS,
|
|
423
|
+
exports: COMPONENTS,
|
|
424
|
+
imports: [CommonModule],
|
|
425
|
+
}]
|
|
426
|
+
}] });
|
|
427
|
+
|
|
428
|
+
// lib/components/forms-kit/index.ts
|
|
429
|
+
|
|
430
|
+
class MaskDirective {
|
|
431
|
+
el;
|
|
432
|
+
mask = input(undefined, { alias: 's4yMask' });
|
|
433
|
+
showMaskType = input(false);
|
|
434
|
+
control = inject(NgControl, { optional: true });
|
|
435
|
+
constructor(el) {
|
|
436
|
+
this.el = el;
|
|
437
|
+
}
|
|
438
|
+
ngAfterViewInit() {
|
|
439
|
+
if (this.showMaskType()) {
|
|
440
|
+
this._applyPlaceholderMask();
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
_applyPlaceholderMask() {
|
|
444
|
+
const input = this.el.nativeElement;
|
|
445
|
+
switch (this.mask()) {
|
|
446
|
+
case 'cep':
|
|
447
|
+
input.value = this._toCEP(input.value);
|
|
448
|
+
break;
|
|
449
|
+
case 'cpf':
|
|
450
|
+
input.value = this._toCPF(input.value);
|
|
451
|
+
break;
|
|
452
|
+
case 'cnpj':
|
|
453
|
+
input.value = this._toCNPJ(input.value);
|
|
454
|
+
break;
|
|
455
|
+
case 'data':
|
|
456
|
+
input.value = this._toDate(input.value);
|
|
457
|
+
break;
|
|
458
|
+
case 'moeda':
|
|
459
|
+
input.value = this._toCurrency(input.value);
|
|
460
|
+
break;
|
|
461
|
+
case 'porcentagem':
|
|
462
|
+
input.value = this._toPercent(input.value);
|
|
463
|
+
break;
|
|
464
|
+
case 'telefone':
|
|
465
|
+
input.value = this._toMobilePhone(input.value);
|
|
466
|
+
break;
|
|
467
|
+
case 'telefone-fixo':
|
|
468
|
+
input.value = this._toLandlinePhone(input.value);
|
|
469
|
+
break;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
onFocusOrClick() {
|
|
473
|
+
const input = this.el.nativeElement;
|
|
474
|
+
const value = input.value;
|
|
475
|
+
const templates = {
|
|
476
|
+
data: '__/__/____',
|
|
477
|
+
cpf: '___.___.___-__',
|
|
478
|
+
cnpj: '__.___.___/____-__',
|
|
479
|
+
cep: '_____-___',
|
|
480
|
+
moeda: '', // máscara de moeda não precisa de cursor fixo
|
|
481
|
+
porcentagem: '', // idem
|
|
482
|
+
telefone: '(__) _____-____',
|
|
483
|
+
'telefone-fixo': '(__) ____-____',
|
|
484
|
+
};
|
|
485
|
+
const template = templates[this.mask()];
|
|
486
|
+
// Só reposiciona se tiver template definido
|
|
487
|
+
if (template) {
|
|
488
|
+
this._setCursorToNextEditable(template, value);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
onInput(e) {
|
|
492
|
+
const input = this.el.nativeElement;
|
|
493
|
+
const value = input.value;
|
|
494
|
+
switch (this.mask()) {
|
|
495
|
+
case 'data': {
|
|
496
|
+
const template = '__/__/____';
|
|
497
|
+
const masked = this._applyMaskTemplate(value, template);
|
|
498
|
+
input.value = masked;
|
|
499
|
+
this._setCursorToNextEditable(template, value);
|
|
500
|
+
break;
|
|
501
|
+
}
|
|
502
|
+
case 'cpf': {
|
|
503
|
+
const template = '___.___.___-__';
|
|
504
|
+
const masked = this._applyMaskTemplate(value, template);
|
|
505
|
+
input.value = masked;
|
|
506
|
+
this._setCursorToNextEditable(template, value);
|
|
507
|
+
break;
|
|
508
|
+
}
|
|
509
|
+
case 'cnpj': {
|
|
510
|
+
const template = '__.___.___/____-__';
|
|
511
|
+
const masked = this._applyMaskTemplate(value, template);
|
|
512
|
+
input.value = masked;
|
|
513
|
+
this._setCursorToNextEditable(template, value);
|
|
514
|
+
break;
|
|
515
|
+
}
|
|
516
|
+
case 'cep': {
|
|
517
|
+
const template = '_____-___';
|
|
518
|
+
const masked = this._applyMaskTemplate(value, template);
|
|
519
|
+
input.value = masked;
|
|
520
|
+
this._setCursorToNextEditable(template, value);
|
|
521
|
+
break;
|
|
522
|
+
}
|
|
523
|
+
case 'telefone': {
|
|
524
|
+
const template = '(__) _____-____';
|
|
525
|
+
const masked = this._toMobilePhone(value);
|
|
526
|
+
input.value = masked;
|
|
527
|
+
this._setCursorToNextEditable(template, value);
|
|
528
|
+
break;
|
|
529
|
+
}
|
|
530
|
+
case 'telefone-fixo': {
|
|
531
|
+
const template = '(__) ____-____';
|
|
532
|
+
const masked = this._toLandlinePhone(value);
|
|
533
|
+
input.value = masked;
|
|
534
|
+
this._setCursorToNextEditable(template, value);
|
|
535
|
+
break;
|
|
536
|
+
}
|
|
537
|
+
case 'moeda': {
|
|
538
|
+
input.value = this._toCurrency(value);
|
|
539
|
+
break;
|
|
540
|
+
}
|
|
541
|
+
case 'porcentagem': {
|
|
542
|
+
input.value = this._toPercent(value);
|
|
543
|
+
break;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
if (this.control && this.control.control) {
|
|
547
|
+
this.control.control.setValue(input.value, { emitEvent: false });
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
_toDate = (value) => this._applyMaskTemplate(value, '__/__/____');
|
|
551
|
+
_toCPF = (value) => this._applyMaskTemplate(value, '___.___.___-__');
|
|
552
|
+
_toCNPJ = (value) => this._applyMaskTemplate(value, '__.___.___/____-__');
|
|
553
|
+
_toCEP = (value) => this._applyMaskTemplate(value, '_____-___');
|
|
554
|
+
_toMobilePhone = (value) => this._applyMaskTemplate(value, '(__) _____-____');
|
|
555
|
+
_toLandlinePhone = (value) => this._applyMaskTemplate(value, '(__) ____-____');
|
|
556
|
+
_toCurrency = (value) => {
|
|
557
|
+
// Remove qualquer caractere não numérico
|
|
558
|
+
const cleaned = value.replace(/\D/g, '');
|
|
559
|
+
// Se estiver vazio, retorna 0 formatado
|
|
560
|
+
if (!cleaned)
|
|
561
|
+
return 'R$ 0,00';
|
|
562
|
+
const number = parseFloat(cleaned) / 100;
|
|
563
|
+
return number.toLocaleString('pt-BR', {
|
|
564
|
+
style: 'currency',
|
|
565
|
+
currency: 'BRL',
|
|
566
|
+
});
|
|
567
|
+
};
|
|
568
|
+
_toPercent = (value) => {
|
|
569
|
+
// Remove tudo que não for número
|
|
570
|
+
const cleaned = value.replace(/\D/g, '');
|
|
571
|
+
// Limita a 6 dígitos (ex: 999999 → 9999,99%)
|
|
572
|
+
const limited = cleaned.slice(0, 6);
|
|
573
|
+
// Garante um valor numérico válido
|
|
574
|
+
const number = parseFloat(limited || '0') / 100;
|
|
575
|
+
// Formata com 2 casas decimais e adiciona % manualmente
|
|
576
|
+
return (number.toLocaleString('pt-BR', {
|
|
577
|
+
minimumFractionDigits: 2,
|
|
578
|
+
maximumFractionDigits: 2,
|
|
579
|
+
}) + '%');
|
|
580
|
+
};
|
|
581
|
+
_applyMaskTemplate(value, template) {
|
|
582
|
+
const result = template.split('');
|
|
583
|
+
let i = 0;
|
|
584
|
+
for (const digit of value.replace(/\D/g, '')) {
|
|
585
|
+
while (i < result.length && !['_'].includes(result[i]))
|
|
586
|
+
i++;
|
|
587
|
+
if (i < result.length)
|
|
588
|
+
result[i++] = digit;
|
|
589
|
+
}
|
|
590
|
+
return result.join('');
|
|
591
|
+
}
|
|
592
|
+
_getCursorPosition(template, digitsCount) {
|
|
593
|
+
let count = 0;
|
|
594
|
+
for (let i = 0; i < template.length; i++) {
|
|
595
|
+
if (template[i].match(/[_\d]/))
|
|
596
|
+
count++;
|
|
597
|
+
if (count >= digitsCount)
|
|
598
|
+
return i + 1;
|
|
599
|
+
}
|
|
600
|
+
return template.length;
|
|
601
|
+
}
|
|
602
|
+
_setCursorToNextEditable(template, value) {
|
|
603
|
+
const input = this.el.nativeElement;
|
|
604
|
+
const digits = value.replace(/\D/g, '');
|
|
605
|
+
const nextPos = this._getCursorPosition(template, digits.length);
|
|
606
|
+
setTimeout(() => input.setSelectionRange(nextPos, nextPos));
|
|
607
|
+
}
|
|
608
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: MaskDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
609
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.7", type: MaskDirective, isStandalone: true, selector: "[s4yMask]", inputs: { mask: { classPropertyName: "mask", publicName: "s4yMask", isSignal: true, isRequired: false, transformFunction: null }, showMaskType: { classPropertyName: "showMaskType", publicName: "showMaskType", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "focus": "onFocusOrClick()", "click": "onFocusOrClick()", "input": "onInput($event)" } }, ngImport: i0 });
|
|
610
|
+
}
|
|
611
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: MaskDirective, decorators: [{
|
|
612
|
+
type: Directive,
|
|
613
|
+
args: [{
|
|
614
|
+
selector: '[s4yMask]',
|
|
615
|
+
standalone: true,
|
|
616
|
+
}]
|
|
617
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { onFocusOrClick: [{
|
|
618
|
+
type: HostListener,
|
|
619
|
+
args: ['focus']
|
|
620
|
+
}, {
|
|
621
|
+
type: HostListener,
|
|
622
|
+
args: ['click']
|
|
623
|
+
}], onInput: [{
|
|
624
|
+
type: HostListener,
|
|
625
|
+
args: ['input', ['$event']]
|
|
626
|
+
}] } });
|
|
627
|
+
|
|
628
|
+
class BreadcrumbComponent {
|
|
629
|
+
router;
|
|
630
|
+
activatedRoute;
|
|
631
|
+
breadcrumbs = [];
|
|
632
|
+
separator = input('/');
|
|
633
|
+
constructor(router, activatedRoute) {
|
|
634
|
+
this.router = router;
|
|
635
|
+
this.activatedRoute = activatedRoute;
|
|
636
|
+
}
|
|
637
|
+
ngOnInit() {
|
|
638
|
+
this.router.events
|
|
639
|
+
.pipe(filter((event) => event instanceof NavigationEnd))
|
|
640
|
+
.subscribe((event) => {
|
|
641
|
+
const url = event.urlAfterRedirects;
|
|
642
|
+
this.breadcrumbs = this.buildBreadcrumb(url);
|
|
643
|
+
});
|
|
644
|
+
this.breadcrumbs = this.buildBreadcrumb(this.router.url);
|
|
645
|
+
}
|
|
646
|
+
buildBreadcrumb(url) {
|
|
647
|
+
const segments = url.split('/').filter(Boolean);
|
|
648
|
+
let path = '';
|
|
649
|
+
return segments.map((segment) => {
|
|
650
|
+
path += `/${segment}`;
|
|
651
|
+
return {
|
|
652
|
+
url: path,
|
|
653
|
+
name: this.formatLabel(segment),
|
|
654
|
+
};
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
formatLabel(label) {
|
|
658
|
+
return label.replace(/[-_]/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase());
|
|
659
|
+
}
|
|
660
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: BreadcrumbComponent, deps: [{ token: i1$1.Router }, { token: i1$1.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component });
|
|
661
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.7", type: BreadcrumbComponent, isStandalone: true, selector: "s4y-breadcrumb", inputs: { separator: { classPropertyName: "separator", publicName: "separator", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<nav class=\"s4y-breadcrumb\">\r\n <ng-container *ngFor=\"let crumb of breadcrumbs; let last = last\">\r\n <a\r\n *ngIf=\"!last; else lastCrumb\"\r\n [routerLink]=\"crumb.url\"\r\n class=\"breadcrumb-link\"\r\n >\r\n {{ crumb.name }}\r\n </a>\r\n <ng-template #lastCrumb>\r\n <span class=\"breadcrumb-current\">{{ crumb.name }}</span>\r\n </ng-template>\r\n <span *ngIf=\"!last\" class=\"breadcrumb-separator\">{{ separator() }}</span>\r\n </ng-container>\r\n</nav>\r\n", styles: [".s4y-breadcrumb{display:flex;flex-wrap:wrap;align-items:center;font-size:1.4rem;color:var(--gray-900);gap:.4rem}.s4y-breadcrumb a:hover{text-decoration:underline}.s4y-breadcrumb .breadcrumb-link{text-decoration:none}.s4y-breadcrumb .breadcrumb-link:hover{text-decoration:underline}.s4y-breadcrumb .breadcrumb-current{font-weight:700;color:#222}.s4y-breadcrumb .breadcrumb-separator{margin:0 .25rem;color:#aaa}\n"], dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }] });
|
|
662
|
+
}
|
|
663
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: BreadcrumbComponent, decorators: [{
|
|
664
|
+
type: Component,
|
|
665
|
+
args: [{ selector: 's4y-breadcrumb', imports: [NgFor, NgIf, RouterLink], template: "<nav class=\"s4y-breadcrumb\">\r\n <ng-container *ngFor=\"let crumb of breadcrumbs; let last = last\">\r\n <a\r\n *ngIf=\"!last; else lastCrumb\"\r\n [routerLink]=\"crumb.url\"\r\n class=\"breadcrumb-link\"\r\n >\r\n {{ crumb.name }}\r\n </a>\r\n <ng-template #lastCrumb>\r\n <span class=\"breadcrumb-current\">{{ crumb.name }}</span>\r\n </ng-template>\r\n <span *ngIf=\"!last\" class=\"breadcrumb-separator\">{{ separator() }}</span>\r\n </ng-container>\r\n</nav>\r\n", styles: [".s4y-breadcrumb{display:flex;flex-wrap:wrap;align-items:center;font-size:1.4rem;color:var(--gray-900);gap:.4rem}.s4y-breadcrumb a:hover{text-decoration:underline}.s4y-breadcrumb .breadcrumb-link{text-decoration:none}.s4y-breadcrumb .breadcrumb-link:hover{text-decoration:underline}.s4y-breadcrumb .breadcrumb-current{font-weight:700;color:#222}.s4y-breadcrumb .breadcrumb-separator{margin:0 .25rem;color:#aaa}\n"] }]
|
|
666
|
+
}], ctorParameters: () => [{ type: i1$1.Router }, { type: i1$1.ActivatedRoute }] });
|
|
667
|
+
|
|
668
|
+
const ToastAnimation = trigger('ToastAnimation', [
|
|
669
|
+
// TOPO
|
|
670
|
+
transition('top-left => void, top-right => void', [
|
|
671
|
+
animate('300ms ease-in', style({ opacity: 0, transform: 'translateY(-20px)' })),
|
|
672
|
+
]),
|
|
673
|
+
transition('void => top-left, void => top-right', [
|
|
674
|
+
style({ opacity: 0, transform: 'translateY(-20px)' }),
|
|
675
|
+
animate('300ms ease-out', style({ opacity: 1, transform: 'translateY(0)' })),
|
|
676
|
+
]),
|
|
677
|
+
// BOTTOM
|
|
678
|
+
transition('bottom-left => void, bottom-right => void', [
|
|
679
|
+
animate('300ms ease-in', style({ opacity: 0, transform: 'translateY(20px)' })),
|
|
680
|
+
]),
|
|
681
|
+
transition('void => bottom-left, void => bottom-right', [
|
|
682
|
+
style({ opacity: 0, transform: 'translateY(20px)' }),
|
|
683
|
+
animate('300ms ease-out', style({ opacity: 1, transform: 'translateY(0)' })),
|
|
684
|
+
]),
|
|
685
|
+
]);
|
|
686
|
+
|
|
687
|
+
class ToastService {
|
|
688
|
+
_toasts = signal([]);
|
|
689
|
+
toasts = computed(() => this._toasts());
|
|
690
|
+
add(toast) {
|
|
691
|
+
const internalId = crypto.randomUUID();
|
|
692
|
+
const toastWithId = { ...toast, __internalId: internalId };
|
|
693
|
+
this._toasts.update((list) => [...list, toastWithId]);
|
|
694
|
+
if (toast.duration && toast.duration > 0) {
|
|
695
|
+
setTimeout(() => {
|
|
696
|
+
this.removeByInternalId(internalId);
|
|
697
|
+
}, toast.duration);
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
remove(index) {
|
|
701
|
+
this._toasts.update((prevState) => {
|
|
702
|
+
const newToasts = prevState.filter((_, i) => index != i);
|
|
703
|
+
return newToasts;
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
removeByInternalId(id) {
|
|
707
|
+
this._toasts.update((list) => list.filter((toast) => toast.__internalId !== id));
|
|
708
|
+
}
|
|
709
|
+
clearAll() {
|
|
710
|
+
this._toasts.set([]);
|
|
711
|
+
}
|
|
712
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: ToastService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
713
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: ToastService });
|
|
714
|
+
}
|
|
715
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: ToastService, decorators: [{
|
|
716
|
+
type: Injectable
|
|
717
|
+
}] });
|
|
718
|
+
|
|
719
|
+
class ToastComponent {
|
|
720
|
+
_toastService;
|
|
721
|
+
position = input('top-left');
|
|
722
|
+
constructor(_toastService) {
|
|
723
|
+
this._toastService = _toastService;
|
|
724
|
+
}
|
|
725
|
+
toasts = computed(() => this._toastService.toasts());
|
|
726
|
+
isBottomPosition = computed(() => this.position().startsWith('bottom'));
|
|
727
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: ToastComponent, deps: [{ token: ToastService }], target: i0.ɵɵFactoryTarget.Component });
|
|
728
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.7", type: ToastComponent, isStandalone: true, selector: "s4y-toast", inputs: { position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<!-- Ajustar os icones -->\r\n\r\n<div class=\"s4y-toast-container\" [ngClass]=\"position()\">\r\n @for (toast of toasts(); track $index; let i = $index) {\r\n <div class=\"s4y-toast-item\" [@ToastAnimation]=\"position()\">\r\n <div class=\"s4y-toast-item_content\">\r\n <div class=\"s4y-toast-item_icon {{ toast.type }}\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"#fff\">\r\n <path\r\n d=\"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM11 7H13V9H11V7ZM11 11H13V17H11V11Z\"\r\n ></path>\r\n </svg>\r\n </div>\r\n <p class=\"s4y-toast-item_message\">\r\n {{ toast.message }}\r\n </p>\r\n </div>\r\n <button (click)=\"_toastService.remove(i)\" class=\"s4y-toast-item_close\">\r\n ×\r\n </button>\r\n </div>\r\n }\r\n</div>\r\n", styles: [".s4y-toast-container{display:flex;flex-direction:column;gap:1.4rem;position:fixed;width:100%;margin:1.8rem;min-width:280px;max-width:480px;z-index:var(--z-index-toast)}@media screen and (min-width: 320px) and (max-width: 480px){.s4y-toast-container{width:90%;margin:0}}@media screen and (min-width: 481px) and (max-width: 767px){.s4y-toast-container{width:90%;margin:0}}.s4y-toast-container.top-left{top:1rem;left:1rem;align-items:flex-start;justify-content:flex-start}.s4y-toast-container.top-right{top:1rem;right:1rem;align-items:flex-end;justify-content:flex-start}.s4y-toast-container.bottom-left{bottom:1rem;left:1rem;align-items:flex-start;justify-content:flex-end;flex-direction:column-reverse}.s4y-toast-container.bottom-right{bottom:1rem;right:1rem;align-items:flex-end;justify-content:flex-end;flex-direction:column-reverse}.s4y-toast-item{border-radius:var(--radius);display:flex;align-items:center;justify-content:space-between;padding:1.4rem;gap:1.2rem;position:relative;box-shadow:#00000005 0 1px 3px,#1b1f2326 0 0 0 1px;background-color:#fff;border:1px solid var(--gray-100);width:100%}.s4y-toast-item .s4y-toast-item_content{flex-grow:1;display:flex;align-items:center;gap:1.4rem}.s4y-toast-item .s4y-toast-item_message{color:var(--gray-900);font-size:1.4rem;font-weight:500}@media screen and (min-width: 320px) and (max-width: 480px){.s4y-toast-item .s4y-toast-item_message{font-size:1.2rem}}@media screen and (min-width: 481px) and (max-width: 767px){.s4y-toast-item .s4y-toast-item_message{font-size:1.2rem}}.s4y-toast-item .s4y-toast-item_icon{display:flex;align-items:center;width:4rem;padding:.8rem;justify-content:center;color:#fff;border-radius:var(--radius);flex-shrink:0}.s4y-toast-item .s4y-toast-item_icon.success{background-color:var(--success-color)}.s4y-toast-item .s4y-toast-item_icon.error{background-color:var(--danger-color)}.s4y-toast-item .s4y-toast-item_icon.warning{background-color:var(--warning-color)}.s4y-toast-item .s4y-toast-item_icon.info{background-color:var(--infor-color)}.s4y-toast-item .s4y-toast-item_close{display:flex;align-items:center;width:4rem;padding:.8rem;justify-content:center;border-radius:var(--radius);font-size:1.8rem;cursor:pointer;transition:.5s ease;color:var(--gray-900)}.s4y-toast-item .s4y-toast-item_close:hover{background-color:var(--gray-100)}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], animations: [ToastAnimation] });
|
|
729
|
+
}
|
|
730
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: ToastComponent, decorators: [{
|
|
731
|
+
type: Component,
|
|
732
|
+
args: [{ selector: 's4y-toast', imports: [NgClass], animations: [ToastAnimation], template: "<!-- Ajustar os icones -->\r\n\r\n<div class=\"s4y-toast-container\" [ngClass]=\"position()\">\r\n @for (toast of toasts(); track $index; let i = $index) {\r\n <div class=\"s4y-toast-item\" [@ToastAnimation]=\"position()\">\r\n <div class=\"s4y-toast-item_content\">\r\n <div class=\"s4y-toast-item_icon {{ toast.type }}\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"#fff\">\r\n <path\r\n d=\"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM11 7H13V9H11V7ZM11 11H13V17H11V11Z\"\r\n ></path>\r\n </svg>\r\n </div>\r\n <p class=\"s4y-toast-item_message\">\r\n {{ toast.message }}\r\n </p>\r\n </div>\r\n <button (click)=\"_toastService.remove(i)\" class=\"s4y-toast-item_close\">\r\n ×\r\n </button>\r\n </div>\r\n }\r\n</div>\r\n", styles: [".s4y-toast-container{display:flex;flex-direction:column;gap:1.4rem;position:fixed;width:100%;margin:1.8rem;min-width:280px;max-width:480px;z-index:var(--z-index-toast)}@media screen and (min-width: 320px) and (max-width: 480px){.s4y-toast-container{width:90%;margin:0}}@media screen and (min-width: 481px) and (max-width: 767px){.s4y-toast-container{width:90%;margin:0}}.s4y-toast-container.top-left{top:1rem;left:1rem;align-items:flex-start;justify-content:flex-start}.s4y-toast-container.top-right{top:1rem;right:1rem;align-items:flex-end;justify-content:flex-start}.s4y-toast-container.bottom-left{bottom:1rem;left:1rem;align-items:flex-start;justify-content:flex-end;flex-direction:column-reverse}.s4y-toast-container.bottom-right{bottom:1rem;right:1rem;align-items:flex-end;justify-content:flex-end;flex-direction:column-reverse}.s4y-toast-item{border-radius:var(--radius);display:flex;align-items:center;justify-content:space-between;padding:1.4rem;gap:1.2rem;position:relative;box-shadow:#00000005 0 1px 3px,#1b1f2326 0 0 0 1px;background-color:#fff;border:1px solid var(--gray-100);width:100%}.s4y-toast-item .s4y-toast-item_content{flex-grow:1;display:flex;align-items:center;gap:1.4rem}.s4y-toast-item .s4y-toast-item_message{color:var(--gray-900);font-size:1.4rem;font-weight:500}@media screen and (min-width: 320px) and (max-width: 480px){.s4y-toast-item .s4y-toast-item_message{font-size:1.2rem}}@media screen and (min-width: 481px) and (max-width: 767px){.s4y-toast-item .s4y-toast-item_message{font-size:1.2rem}}.s4y-toast-item .s4y-toast-item_icon{display:flex;align-items:center;width:4rem;padding:.8rem;justify-content:center;color:#fff;border-radius:var(--radius);flex-shrink:0}.s4y-toast-item .s4y-toast-item_icon.success{background-color:var(--success-color)}.s4y-toast-item .s4y-toast-item_icon.error{background-color:var(--danger-color)}.s4y-toast-item .s4y-toast-item_icon.warning{background-color:var(--warning-color)}.s4y-toast-item .s4y-toast-item_icon.info{background-color:var(--infor-color)}.s4y-toast-item .s4y-toast-item_close{display:flex;align-items:center;width:4rem;padding:.8rem;justify-content:center;border-radius:var(--radius);font-size:1.8rem;cursor:pointer;transition:.5s ease;color:var(--gray-900)}.s4y-toast-item .s4y-toast-item_close:hover{background-color:var(--gray-100)}\n"] }]
|
|
733
|
+
}], ctorParameters: () => [{ type: ToastService }] });
|
|
734
|
+
|
|
735
|
+
// src/app/icon/icon.service.ts
|
|
736
|
+
class SvgService {
|
|
737
|
+
requests = new Map();
|
|
738
|
+
getSvgContent(url) {
|
|
739
|
+
let request = this.requests.get(url);
|
|
740
|
+
if (!request) {
|
|
741
|
+
request = fetch(url).then((response) => {
|
|
742
|
+
if (!response.ok) {
|
|
743
|
+
throw new Error(`Erro ao carregar SVG: ${response.statusText}`);
|
|
744
|
+
}
|
|
745
|
+
return response.text();
|
|
746
|
+
});
|
|
747
|
+
this.requests.set(url, request);
|
|
748
|
+
}
|
|
749
|
+
return defer(() => from(request)).pipe(catchError((error) => {
|
|
750
|
+
console.error('Erro ao carregar SVG:', error);
|
|
751
|
+
return throwError(() => error);
|
|
752
|
+
}));
|
|
753
|
+
}
|
|
754
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: SvgService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
755
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: SvgService, providedIn: 'root' });
|
|
756
|
+
}
|
|
757
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: SvgService, decorators: [{
|
|
758
|
+
type: Injectable,
|
|
759
|
+
args: [{
|
|
760
|
+
providedIn: 'root',
|
|
761
|
+
}]
|
|
762
|
+
}] });
|
|
763
|
+
|
|
764
|
+
// import { NgIf, NgStyle } from '@angular/common';
|
|
765
|
+
// import { HttpClient } from '@angular/common/http';
|
|
766
|
+
// import { ChangeDetectionStrategy, Component, Input, OnChanges, SimpleChanges } from '@angular/core';
|
|
767
|
+
// import { DomSanitizer } from '@angular/platform-browser';
|
|
768
|
+
// import { SvgService } from './svg.service';
|
|
769
|
+
// @Component({
|
|
770
|
+
// selector: 's4y-svg',
|
|
771
|
+
// imports: [NgStyle, NgIf],
|
|
772
|
+
// templateUrl: './svg.component.html',
|
|
773
|
+
// styleUrl: './svg.component.scss',
|
|
774
|
+
// changeDetection: ChangeDetectionStrategy.OnPush,
|
|
775
|
+
// })
|
|
776
|
+
// export class SvgComponent implements OnChanges {
|
|
777
|
+
// @Input() src!: string;
|
|
778
|
+
// @Input() mode: 'inline' | 'mask' = 'mask';
|
|
779
|
+
// @Input() size: string = '24px';
|
|
780
|
+
// @Input() color: string = 'currentColor';
|
|
781
|
+
// svgContent: any = '';
|
|
782
|
+
// maskStyle = '';
|
|
783
|
+
// constructor(
|
|
784
|
+
// private http: HttpClient,
|
|
785
|
+
// private sanitizer: DomSanitizer,
|
|
786
|
+
// private svgService: SvgService
|
|
787
|
+
// ) {}
|
|
788
|
+
// ngOnChanges(changes: SimpleChanges): void {
|
|
789
|
+
// if (!this.src) return;
|
|
790
|
+
// if (this.mode === 'inline') {
|
|
791
|
+
// this.http.get(this.src, { responseType: 'text' }).subscribe((svg) => {
|
|
792
|
+
// this.svgContent = this.sanitizer.bypassSecurityTrustHtml(svg);
|
|
793
|
+
// });
|
|
794
|
+
// } else if (this.mode === 'mask') {
|
|
795
|
+
// this.maskStyle = `url("${this.src}")`;
|
|
796
|
+
// }
|
|
797
|
+
// }
|
|
798
|
+
// }
|
|
799
|
+
// src/app/icon/icon.component.ts
|
|
800
|
+
class SvgComponent {
|
|
801
|
+
sanitizer;
|
|
802
|
+
svgService;
|
|
803
|
+
size = 'default';
|
|
804
|
+
svgContent;
|
|
805
|
+
constructor(sanitizer, svgService) {
|
|
806
|
+
this.sanitizer = sanitizer;
|
|
807
|
+
this.svgService = svgService;
|
|
808
|
+
}
|
|
809
|
+
set src(value) {
|
|
810
|
+
this.setSvgContent(value);
|
|
811
|
+
}
|
|
812
|
+
setSvgContent(src) {
|
|
813
|
+
this.svgContent = this.svgService
|
|
814
|
+
.getSvgContent(src)
|
|
815
|
+
.pipe(map((content) => this.sanitizer.bypassSecurityTrustHtml(content)));
|
|
816
|
+
}
|
|
817
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: SvgComponent, deps: [{ token: i1$2.DomSanitizer }, { token: SvgService }], target: i0.ɵɵFactoryTarget.Component });
|
|
818
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.7", type: SvgComponent, isStandalone: true, selector: "s4y-svg", inputs: { size: "size", src: "src" }, host: { properties: { "class": "this.size" } }, ngImport: i0, template: "<!-- <span\r\n *ngIf=\"mode === 'inline'\"\r\n class=\"s4y-svg-inline\"\r\n [innerHTML]=\"svgContent\"\r\n [ngStyle]=\"{\r\n width: size,\r\n height: size,\r\n color: color\r\n }\"\r\n></span>\r\n\r\n<span\r\n *ngIf=\"mode === 'mask'\"\r\n class=\"s4y-svg-mask\"\r\n [ngStyle]=\"{\r\n WebkitMaskImage: maskStyle,\r\n maskImage: maskStyle,\r\n width: size,\r\n height: size,\r\n backgroundColor: color\r\n }\"\r\n></span> -->\r\n\r\n<div class=\"icon-inner\" [innerHTML]=\"svgContent | async\"></div>\r\n\r\n{{ svgContent | json }}\r\n", styles: [":host{--icon-font-size: 1em;display:inline-block;width:1em;height:1em;text-align:center;font-size:var(--icon-font-size);contain:strict;fill:currentColor;box-sizing:content-box!important}.icon-inner{display:block;width:100%;height:100%}svg{width:100%;height:100%;max-width:100%;max-height:100%}:host(.small){width:16px;height:16px}:host(.default){width:24px;height:24px}:host(.large){width:32px;height:32px}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: JsonPipe, name: "json" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
819
|
+
}
|
|
820
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: SvgComponent, decorators: [{
|
|
821
|
+
type: Component,
|
|
822
|
+
args: [{ selector: 's4y-svg', imports: [AsyncPipe, JsonPipe], changeDetection: ChangeDetectionStrategy.OnPush, template: "<!-- <span\r\n *ngIf=\"mode === 'inline'\"\r\n class=\"s4y-svg-inline\"\r\n [innerHTML]=\"svgContent\"\r\n [ngStyle]=\"{\r\n width: size,\r\n height: size,\r\n color: color\r\n }\"\r\n></span>\r\n\r\n<span\r\n *ngIf=\"mode === 'mask'\"\r\n class=\"s4y-svg-mask\"\r\n [ngStyle]=\"{\r\n WebkitMaskImage: maskStyle,\r\n maskImage: maskStyle,\r\n width: size,\r\n height: size,\r\n backgroundColor: color\r\n }\"\r\n></span> -->\r\n\r\n<div class=\"icon-inner\" [innerHTML]=\"svgContent | async\"></div>\r\n\r\n{{ svgContent | json }}\r\n", styles: [":host{--icon-font-size: 1em;display:inline-block;width:1em;height:1em;text-align:center;font-size:var(--icon-font-size);contain:strict;fill:currentColor;box-sizing:content-box!important}.icon-inner{display:block;width:100%;height:100%}svg{width:100%;height:100%;max-width:100%;max-height:100%}:host(.small){width:16px;height:16px}:host(.default){width:24px;height:24px}:host(.large){width:32px;height:32px}\n"] }]
|
|
823
|
+
}], ctorParameters: () => [{ type: i1$2.DomSanitizer }, { type: SvgService }], propDecorators: { size: [{
|
|
824
|
+
type: Input
|
|
825
|
+
}, {
|
|
826
|
+
type: HostBinding,
|
|
827
|
+
args: ['class']
|
|
828
|
+
}], src: [{
|
|
829
|
+
type: Input
|
|
830
|
+
}] } });
|
|
831
|
+
|
|
832
|
+
const drawerAnimation = trigger('drawerAnimation', [
|
|
833
|
+
transition(':enter', [
|
|
834
|
+
group([
|
|
835
|
+
query(':self', [
|
|
836
|
+
style({ opacity: 0 }),
|
|
837
|
+
animate('300ms ease-out', style({ opacity: 1 })),
|
|
838
|
+
]),
|
|
839
|
+
query('.s4y-drawer-container', [
|
|
840
|
+
style({ transform: '{{transformFrom}}' }),
|
|
841
|
+
animate('300ms ease-out', style({ transform: 'translate(0, 0)' })),
|
|
842
|
+
], { optional: true }),
|
|
843
|
+
]),
|
|
844
|
+
], { params: { transformFrom: 'translateX(100%)' } }),
|
|
845
|
+
transition(':leave', [
|
|
846
|
+
group([
|
|
847
|
+
query(':self', [
|
|
848
|
+
style({ opacity: 1 }),
|
|
849
|
+
animate('300ms ease-in', style({ opacity: 0 })),
|
|
850
|
+
]),
|
|
851
|
+
query('.s4y-drawer-container', [
|
|
852
|
+
style({ transform: 'translate(0, 0)' }),
|
|
853
|
+
animate('300ms ease-in', style({ transform: '{{transformTo}}' })),
|
|
854
|
+
], { optional: true }),
|
|
855
|
+
]),
|
|
856
|
+
], { params: { transformTo: 'translateX(100%)' } }),
|
|
857
|
+
]);
|
|
858
|
+
|
|
859
|
+
class DrawerComponent {
|
|
860
|
+
position = input('right');
|
|
861
|
+
isOpen = model(false);
|
|
862
|
+
size = input('medium');
|
|
863
|
+
backdrop = input(true);
|
|
864
|
+
closeOnBackdropClick = input(true);
|
|
865
|
+
hasCloseButton = input(true);
|
|
866
|
+
title = input('Title');
|
|
867
|
+
isVisible = computed(() => this.isOpen());
|
|
868
|
+
headerTemplate;
|
|
869
|
+
bodyTemplate;
|
|
870
|
+
footerTemplate;
|
|
871
|
+
constructor() { }
|
|
872
|
+
ngOnInit() { }
|
|
873
|
+
drawerSize = computed(() => {
|
|
874
|
+
const size = this.size();
|
|
875
|
+
const position = this.position();
|
|
876
|
+
let value;
|
|
877
|
+
switch (size) {
|
|
878
|
+
case 'small':
|
|
879
|
+
value = '250px';
|
|
880
|
+
break;
|
|
881
|
+
case 'medium':
|
|
882
|
+
value = '400px';
|
|
883
|
+
break;
|
|
884
|
+
case 'large':
|
|
885
|
+
value = '600px';
|
|
886
|
+
break;
|
|
887
|
+
default:
|
|
888
|
+
value = size;
|
|
889
|
+
}
|
|
890
|
+
if (position === 'left' || position === 'right') {
|
|
891
|
+
return { width: value, height: null };
|
|
892
|
+
}
|
|
893
|
+
else {
|
|
894
|
+
return { width: null, height: value };
|
|
895
|
+
}
|
|
896
|
+
});
|
|
897
|
+
isHorizontal = computed(() => {
|
|
898
|
+
const pos = this.position();
|
|
899
|
+
return pos === 'left' || pos === 'right';
|
|
900
|
+
});
|
|
901
|
+
isVertical = computed(() => {
|
|
902
|
+
const pos = this.position();
|
|
903
|
+
return pos === 'top' || pos === 'bottom';
|
|
904
|
+
});
|
|
905
|
+
transformFrom = computed(() => {
|
|
906
|
+
switch (this.position()) {
|
|
907
|
+
case 'left':
|
|
908
|
+
return 'translateX(-100%)';
|
|
909
|
+
case 'right':
|
|
910
|
+
return 'translateX(100%)';
|
|
911
|
+
case 'top':
|
|
912
|
+
return 'translateY(-100%)';
|
|
913
|
+
case 'bottom':
|
|
914
|
+
return 'translateY(100%)';
|
|
915
|
+
default:
|
|
916
|
+
return 'translateX(100%)'; // Default: right
|
|
917
|
+
}
|
|
918
|
+
});
|
|
919
|
+
transformTo = computed(() => {
|
|
920
|
+
switch (this.position()) {
|
|
921
|
+
case 'left':
|
|
922
|
+
return 'translateX(-100%)';
|
|
923
|
+
case 'right':
|
|
924
|
+
return 'translateX(100%)';
|
|
925
|
+
case 'top':
|
|
926
|
+
return 'translateY(-100%)';
|
|
927
|
+
case 'bottom':
|
|
928
|
+
return 'translateY(100%)';
|
|
929
|
+
default:
|
|
930
|
+
return 'translateX(100%)'; // Default: right
|
|
931
|
+
}
|
|
932
|
+
});
|
|
933
|
+
closeOnPressEscapeKey(event) {
|
|
934
|
+
this.close();
|
|
935
|
+
}
|
|
936
|
+
onBackdropClick(event) {
|
|
937
|
+
const target = event.target;
|
|
938
|
+
if (target.classList.contains('s4y-overlay')) {
|
|
939
|
+
if (this.closeOnBackdropClick() && this.isOpen()) {
|
|
940
|
+
this.isOpen.set(false);
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
close() {
|
|
945
|
+
if (this.isOpen()) {
|
|
946
|
+
this.isOpen.set(false);
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
onAnimationDone(event) {
|
|
950
|
+
if (!this.isOpen()) {
|
|
951
|
+
this.isOpen.set(false);
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: DrawerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
955
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.7", type: DrawerComponent, isStandalone: true, selector: "s4y-drawer", inputs: { position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, isOpen: { classPropertyName: "isOpen", publicName: "isOpen", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, backdrop: { classPropertyName: "backdrop", publicName: "backdrop", isSignal: true, isRequired: false, transformFunction: null }, closeOnBackdropClick: { classPropertyName: "closeOnBackdropClick", publicName: "closeOnBackdropClick", isSignal: true, isRequired: false, transformFunction: null }, hasCloseButton: { classPropertyName: "hasCloseButton", publicName: "hasCloseButton", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { isOpen: "isOpenChange" }, host: { listeners: { "document:keydown.escape": "closeOnPressEscapeKey($event)" } }, queries: [{ propertyName: "headerTemplate", first: true, predicate: ["headerTemplate"], descendants: true }, { propertyName: "bodyTemplate", first: true, predicate: ["bodyTemplate"], descendants: true }, { propertyName: "footerTemplate", first: true, predicate: ["footerTemplate"], descendants: true }], ngImport: i0, template: "@if(isVisible()){\r\n<div\r\n [@drawerAnimation]=\"{\r\n value: '',\r\n params: {\r\n transformFrom: transformFrom(),\r\n transformTo: transformTo()\r\n }\r\n }\"\r\n [class.s4y-overlay]=\"backdrop()\"\r\n (click)=\"onBackdropClick($event)\"\r\n>\r\n <div\r\n [style.maxWidth]=\"drawerSize().width\"\r\n [style.maxHeight]=\"drawerSize().height\"\r\n [ngClass]=\"{\r\n 's4y-drawer-left': position() === 'left',\r\n 's4y-drawer-right': position() === 'right',\r\n 's4y-drawer-top': position() === 'top',\r\n 's4y-drawer-bottom': position() === 'bottom'\r\n }\"\r\n class=\"s4y-drawer-container\"\r\n >\r\n <header class=\"s4y-header\">\r\n @if(headerTemplate) {\r\n <ng-container *ngTemplateOutlet=\"headerTemplate\"></ng-container>\r\n }\r\n <!-- -->\r\n @else {\r\n <h3>{{ title() }}</h3>\r\n @if (hasCloseButton()) {\r\n <button (click)=\"close()\">×</button>\r\n } }\r\n </header>\r\n\r\n <div class=\"s4y-body-content\">\r\n <ng-container *ngTemplateOutlet=\"bodyTemplate\"></ng-container>\r\n </div>\r\n @if(footerTemplate) {\r\n <div class=\"s4y-footer-content\">\r\n <ng-container *ngTemplateOutlet=\"footerTemplate\"></ng-container>\r\n </div>\r\n }\r\n </div>\r\n</div>\r\n}\r\n", styles: [".s4y-overlay{background-color:#000000b3;height:100dvh;width:100dvw;position:fixed;top:0;left:0;z-index:var(--z-index-drawer)}.s4y-drawer-container{position:fixed;width:100%;height:100dvh;display:flex;flex-direction:column;background-color:#fff;border:1px solid var(--gray-300);box-shadow:#00000029 0 1px 4px}@media screen and (min-width: 320px) and (max-width: 480px){.s4y-drawer-container{width:90%}}@media screen and (min-width: 481px) and (max-width: 767px){.s4y-drawer-container{width:90%}}.s4y-header{padding:1.8rem;display:flex;align-items:center;justify-content:space-between}.s4y-header button{height:100%;display:inline-block;width:2.8rem;font-size:2.2rem}.s4y-body-content{flex-grow:1;overflow-y:auto;padding-bottom:1.8rem}.s4y-drawer-left{left:0}.s4y-drawer-left .s4y-body-content{padding-left:1.8rem}.s4y-drawer-right{right:0}.s4y-drawer-right .s4y-body-content{padding-left:1.8rem}.s4y-drawer-top{top:0;width:100dvw}.s4y-drawer-top .s4y-body-content{padding-left:1.8rem}.s4y-drawer-bottom{width:100dvw;bottom:0}.s4y-drawer-bottom .s4y-body-content{padding-left:1.8rem}.s4y-footer-content{padding:1.8rem}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], animations: [drawerAnimation] });
|
|
956
|
+
}
|
|
957
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: DrawerComponent, decorators: [{
|
|
958
|
+
type: Component,
|
|
959
|
+
args: [{ selector: 's4y-drawer', imports: [NgClass, NgTemplateOutlet], animations: [drawerAnimation], template: "@if(isVisible()){\r\n<div\r\n [@drawerAnimation]=\"{\r\n value: '',\r\n params: {\r\n transformFrom: transformFrom(),\r\n transformTo: transformTo()\r\n }\r\n }\"\r\n [class.s4y-overlay]=\"backdrop()\"\r\n (click)=\"onBackdropClick($event)\"\r\n>\r\n <div\r\n [style.maxWidth]=\"drawerSize().width\"\r\n [style.maxHeight]=\"drawerSize().height\"\r\n [ngClass]=\"{\r\n 's4y-drawer-left': position() === 'left',\r\n 's4y-drawer-right': position() === 'right',\r\n 's4y-drawer-top': position() === 'top',\r\n 's4y-drawer-bottom': position() === 'bottom'\r\n }\"\r\n class=\"s4y-drawer-container\"\r\n >\r\n <header class=\"s4y-header\">\r\n @if(headerTemplate) {\r\n <ng-container *ngTemplateOutlet=\"headerTemplate\"></ng-container>\r\n }\r\n <!-- -->\r\n @else {\r\n <h3>{{ title() }}</h3>\r\n @if (hasCloseButton()) {\r\n <button (click)=\"close()\">×</button>\r\n } }\r\n </header>\r\n\r\n <div class=\"s4y-body-content\">\r\n <ng-container *ngTemplateOutlet=\"bodyTemplate\"></ng-container>\r\n </div>\r\n @if(footerTemplate) {\r\n <div class=\"s4y-footer-content\">\r\n <ng-container *ngTemplateOutlet=\"footerTemplate\"></ng-container>\r\n </div>\r\n }\r\n </div>\r\n</div>\r\n}\r\n", styles: [".s4y-overlay{background-color:#000000b3;height:100dvh;width:100dvw;position:fixed;top:0;left:0;z-index:var(--z-index-drawer)}.s4y-drawer-container{position:fixed;width:100%;height:100dvh;display:flex;flex-direction:column;background-color:#fff;border:1px solid var(--gray-300);box-shadow:#00000029 0 1px 4px}@media screen and (min-width: 320px) and (max-width: 480px){.s4y-drawer-container{width:90%}}@media screen and (min-width: 481px) and (max-width: 767px){.s4y-drawer-container{width:90%}}.s4y-header{padding:1.8rem;display:flex;align-items:center;justify-content:space-between}.s4y-header button{height:100%;display:inline-block;width:2.8rem;font-size:2.2rem}.s4y-body-content{flex-grow:1;overflow-y:auto;padding-bottom:1.8rem}.s4y-drawer-left{left:0}.s4y-drawer-left .s4y-body-content{padding-left:1.8rem}.s4y-drawer-right{right:0}.s4y-drawer-right .s4y-body-content{padding-left:1.8rem}.s4y-drawer-top{top:0;width:100dvw}.s4y-drawer-top .s4y-body-content{padding-left:1.8rem}.s4y-drawer-bottom{width:100dvw;bottom:0}.s4y-drawer-bottom .s4y-body-content{padding-left:1.8rem}.s4y-footer-content{padding:1.8rem}\n"] }]
|
|
960
|
+
}], ctorParameters: () => [], propDecorators: { headerTemplate: [{
|
|
961
|
+
type: ContentChild,
|
|
962
|
+
args: ['headerTemplate']
|
|
963
|
+
}], bodyTemplate: [{
|
|
964
|
+
type: ContentChild,
|
|
965
|
+
args: ['bodyTemplate']
|
|
966
|
+
}], footerTemplate: [{
|
|
967
|
+
type: ContentChild,
|
|
968
|
+
args: ['footerTemplate']
|
|
969
|
+
}], closeOnPressEscapeKey: [{
|
|
970
|
+
type: HostListener,
|
|
971
|
+
args: ['document:keydown.escape', ['$event']]
|
|
972
|
+
}] } });
|
|
973
|
+
|
|
974
|
+
class SpinnerComponent {
|
|
975
|
+
size = input('small');
|
|
976
|
+
color = input('primary');
|
|
977
|
+
constructor() { }
|
|
978
|
+
ngOnInit() { }
|
|
979
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: SpinnerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
980
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.7", type: SpinnerComponent, isStandalone: true, selector: "s4y-spinner", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.size": "size()", "attr.color": "color()" } }, ngImport: i0, template: "\n", styles: [":host{width:48px;height:48px;border:5px solid var(--primary-color);border-bottom-color:transparent;border-radius:50%;display:inline-block;box-sizing:border-box;animation:rotation 1s linear infinite}@keyframes rotation{0%{transform:rotate(0)}to{transform:rotate(360deg)}}:host[size=small]{width:30px;height:30px;border-bottom-color:transparent;border-width:4px}:host[size=medium]{width:48px;height:48px;border-bottom-color:transparent}:host[size=large]{width:70px;height:70px;border-bottom-color:transparent}:host[color=primary]{border-color:var(--primary-color);border-bottom-color:transparent}:host[color=secondary]{border-color:var(--secondary-color);border-bottom-color:transparent}\n"] });
|
|
981
|
+
}
|
|
982
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: SpinnerComponent, decorators: [{
|
|
983
|
+
type: Component,
|
|
984
|
+
args: [{ selector: 's4y-spinner', host: {
|
|
985
|
+
'[attr.size]': 'size()',
|
|
986
|
+
'[attr.color]': 'color()',
|
|
987
|
+
}, template: "\n", styles: [":host{width:48px;height:48px;border:5px solid var(--primary-color);border-bottom-color:transparent;border-radius:50%;display:inline-block;box-sizing:border-box;animation:rotation 1s linear infinite}@keyframes rotation{0%{transform:rotate(0)}to{transform:rotate(360deg)}}:host[size=small]{width:30px;height:30px;border-bottom-color:transparent;border-width:4px}:host[size=medium]{width:48px;height:48px;border-bottom-color:transparent}:host[size=large]{width:70px;height:70px;border-bottom-color:transparent}:host[color=primary]{border-color:var(--primary-color);border-bottom-color:transparent}:host[color=secondary]{border-color:var(--secondary-color);border-bottom-color:transparent}\n"] }]
|
|
988
|
+
}], ctorParameters: () => [] });
|
|
989
|
+
|
|
990
|
+
class TableComponent {
|
|
991
|
+
headers = input([]);
|
|
992
|
+
data = input([]);
|
|
993
|
+
isLoading = input(false);
|
|
994
|
+
hasError = input(false);
|
|
995
|
+
rowTemplate;
|
|
996
|
+
headTemplate;
|
|
997
|
+
emptyTemplate;
|
|
998
|
+
errorTemplate;
|
|
999
|
+
errorMessageDefault = input('Não foi possível carregar os dados.');
|
|
1000
|
+
emptyMessageDefault = input(' Não encontramos dados para exibir.');
|
|
1001
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: TableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1002
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.7", type: TableComponent, isStandalone: true, selector: "s4y-table", inputs: { headers: { classPropertyName: "headers", publicName: "headers", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: false, transformFunction: null }, hasError: { classPropertyName: "hasError", publicName: "hasError", isSignal: true, isRequired: false, transformFunction: null }, errorMessageDefault: { classPropertyName: "errorMessageDefault", publicName: "errorMessageDefault", isSignal: true, isRequired: false, transformFunction: null }, emptyMessageDefault: { classPropertyName: "emptyMessageDefault", publicName: "emptyMessageDefault", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "rowTemplate", first: true, predicate: ["rowTemplate"], descendants: true }, { propertyName: "headTemplate", first: true, predicate: ["headTemplate"], descendants: true }, { propertyName: "emptyTemplate", first: true, predicate: ["emptyTemplate"], descendants: true }, { propertyName: "errorTemplate", first: true, predicate: ["errorTemplate"], descendants: true }], ngImport: i0, template: "<div class=\"s4y-table-container\">\r\n <table class=\"s4y-table\">\r\n <thead>\r\n <tr>\r\n <ng-container [ngTemplateOutlet]=\"headTemplate\"></ng-container>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n @if (isLoading()) {\r\n <tr class=\"loading\">\r\n <td [colSpan]=\"headers().length\">\r\n <s4y-spinner></s4y-spinner>\r\n </td>\r\n </tr>\r\n } @else if (hasError()) {\r\n @if (errorTemplate) {\r\n <ng-container [ngTemplateOutlet]=\"errorTemplate\"></ng-container>\r\n } @else {\r\n <tr class=\"error\">\r\n <td [colSpan]=\"headers().length\">\r\n {{errorMessageDefault()}}\r\n </td>\r\n </tr>\r\n }\r\n } @else {\r\n <ng-container [ngTemplateOutlet]=\"tableContent\"></ng-container>\r\n }\r\n </tbody>\r\n </table>\r\n</div>\r\n\r\n<ng-template #SortIcon>\r\n <svg\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"currentColor\"\r\n >\r\n <path\r\n d=\"M4.86885 11H2.6665L6 3H8L11.3334 11H9.13113L8.7213 10H5.27869L4.86885 11ZM6.09836 8H7.90163L7 5.8L6.09836 8ZM18.9999 16V3H16.9999V16H13.9999L17.9999 21L21.9999 16H18.9999ZM10.9999 13H2.99992V15H7.85414L2.99992 19V21H10.9999V19H6.14605L10.9999 15V13Z\"\r\n ></path>\r\n </svg>\r\n</ng-template>\r\n\r\n<ng-template #tableContent>\r\n @for (row of data(); track $index) {\r\n <tr>\r\n <ng-container\r\n [ngTemplateOutlet]=\"rowTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: row }\"\r\n >\r\n </ng-container>\r\n </tr>\r\n } @empty {\r\n @if (emptyTemplate) {\r\n <ng-container [ngTemplateOutlet]=\"emptyTemplate\"></ng-container>\r\n } @else {\r\n <tr class=\"empty-content\">\r\n <td [colSpan]=\"headers().length\">\r\n {{emptyMessageDefault()}}\r\n </td>\r\n </tr>\r\n }\r\n }\r\n</ng-template>\r\n", styles: [".s4y-table-container{overflow:auto}@media screen and (min-width: 320px) and (max-width: 480px){.s4y-table-container{width:90dvw;padding-bottom:1.4rem}}@media screen and (min-width: 481px) and (max-width: 767px){.s4y-table-container{width:90dvw;padding-bottom:1.4rem}}.s4y-table{border-collapse:collapse;width:100%}@media screen and (min-width: 320px) and (max-width: 480px){.s4y-table{background-color:#00f}}.s4y-table .s4y-table-head-th__content{display:flex;justify-content:space-between}.s4y-table span{display:flex;align-items:center;justify-content:center;width:1.8rem;height:1.8rem;font-size:1.2rem}.s4y-table thead{background-color:#eaeaea}.s4y-table tbody tr{border-bottom:1px solid var(--gray-400);background-color:#fff}.s4y-table tfoot{background-color:#eaeaea}.s4y-table tr{font-size:1.4rem;height:5rem;white-space:nowrap}.s4y-table th,.s4y-table td{text-align:start;padding:0 1.4rem}.s4y-table td:first-child,.s4y-table td:last-child,.s4y-table th:first-child,.s4y-table th:last-child{padding:0 1.4rem}.s4y-table th.sorted{background-color:var(--primary-color);color:#fff}.s4y-table td.sorted{background-color:var(--gray-200)}.s4y-table tr.empty-content,.s4y-table tr.loading,.s4y-table tr.error{border:none}.s4y-table tr.empty-content td,.s4y-table tr.loading td,.s4y-table tr.error td{text-align:center;height:28rem;background-color:transparent;color:var(--gray-900);font-weight:700;border:none}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: SpinnerComponent, selector: "s4y-spinner", inputs: ["size", "color"] }], encapsulation: i0.ViewEncapsulation.None });
|
|
1003
|
+
}
|
|
1004
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: TableComponent, decorators: [{
|
|
1005
|
+
type: Component,
|
|
1006
|
+
args: [{ selector: 's4y-table', imports: [CommonModule, SpinnerComponent], encapsulation: ViewEncapsulation.None, template: "<div class=\"s4y-table-container\">\r\n <table class=\"s4y-table\">\r\n <thead>\r\n <tr>\r\n <ng-container [ngTemplateOutlet]=\"headTemplate\"></ng-container>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n @if (isLoading()) {\r\n <tr class=\"loading\">\r\n <td [colSpan]=\"headers().length\">\r\n <s4y-spinner></s4y-spinner>\r\n </td>\r\n </tr>\r\n } @else if (hasError()) {\r\n @if (errorTemplate) {\r\n <ng-container [ngTemplateOutlet]=\"errorTemplate\"></ng-container>\r\n } @else {\r\n <tr class=\"error\">\r\n <td [colSpan]=\"headers().length\">\r\n {{errorMessageDefault()}}\r\n </td>\r\n </tr>\r\n }\r\n } @else {\r\n <ng-container [ngTemplateOutlet]=\"tableContent\"></ng-container>\r\n }\r\n </tbody>\r\n </table>\r\n</div>\r\n\r\n<ng-template #SortIcon>\r\n <svg\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"currentColor\"\r\n >\r\n <path\r\n d=\"M4.86885 11H2.6665L6 3H8L11.3334 11H9.13113L8.7213 10H5.27869L4.86885 11ZM6.09836 8H7.90163L7 5.8L6.09836 8ZM18.9999 16V3H16.9999V16H13.9999L17.9999 21L21.9999 16H18.9999ZM10.9999 13H2.99992V15H7.85414L2.99992 19V21H10.9999V19H6.14605L10.9999 15V13Z\"\r\n ></path>\r\n </svg>\r\n</ng-template>\r\n\r\n<ng-template #tableContent>\r\n @for (row of data(); track $index) {\r\n <tr>\r\n <ng-container\r\n [ngTemplateOutlet]=\"rowTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: row }\"\r\n >\r\n </ng-container>\r\n </tr>\r\n } @empty {\r\n @if (emptyTemplate) {\r\n <ng-container [ngTemplateOutlet]=\"emptyTemplate\"></ng-container>\r\n } @else {\r\n <tr class=\"empty-content\">\r\n <td [colSpan]=\"headers().length\">\r\n {{emptyMessageDefault()}}\r\n </td>\r\n </tr>\r\n }\r\n }\r\n</ng-template>\r\n", styles: [".s4y-table-container{overflow:auto}@media screen and (min-width: 320px) and (max-width: 480px){.s4y-table-container{width:90dvw;padding-bottom:1.4rem}}@media screen and (min-width: 481px) and (max-width: 767px){.s4y-table-container{width:90dvw;padding-bottom:1.4rem}}.s4y-table{border-collapse:collapse;width:100%}@media screen and (min-width: 320px) and (max-width: 480px){.s4y-table{background-color:#00f}}.s4y-table .s4y-table-head-th__content{display:flex;justify-content:space-between}.s4y-table span{display:flex;align-items:center;justify-content:center;width:1.8rem;height:1.8rem;font-size:1.2rem}.s4y-table thead{background-color:#eaeaea}.s4y-table tbody tr{border-bottom:1px solid var(--gray-400);background-color:#fff}.s4y-table tfoot{background-color:#eaeaea}.s4y-table tr{font-size:1.4rem;height:5rem;white-space:nowrap}.s4y-table th,.s4y-table td{text-align:start;padding:0 1.4rem}.s4y-table td:first-child,.s4y-table td:last-child,.s4y-table th:first-child,.s4y-table th:last-child{padding:0 1.4rem}.s4y-table th.sorted{background-color:var(--primary-color);color:#fff}.s4y-table td.sorted{background-color:var(--gray-200)}.s4y-table tr.empty-content,.s4y-table tr.loading,.s4y-table tr.error{border:none}.s4y-table tr.empty-content td,.s4y-table tr.loading td,.s4y-table tr.error td{text-align:center;height:28rem;background-color:transparent;color:var(--gray-900);font-weight:700;border:none}\n"] }]
|
|
1007
|
+
}], propDecorators: { rowTemplate: [{
|
|
1008
|
+
type: ContentChild,
|
|
1009
|
+
args: ['rowTemplate']
|
|
1010
|
+
}], headTemplate: [{
|
|
1011
|
+
type: ContentChild,
|
|
1012
|
+
args: ['headTemplate']
|
|
1013
|
+
}], emptyTemplate: [{
|
|
1014
|
+
type: ContentChild,
|
|
1015
|
+
args: ['emptyTemplate']
|
|
1016
|
+
}], errorTemplate: [{
|
|
1017
|
+
type: ContentChild,
|
|
1018
|
+
args: ['errorTemplate']
|
|
1019
|
+
}] } });
|
|
1020
|
+
|
|
1021
|
+
class SortTableDirective {
|
|
1022
|
+
el;
|
|
1023
|
+
renderer;
|
|
1024
|
+
s4yColumnName = input(undefined);
|
|
1025
|
+
data = input([]);
|
|
1026
|
+
isSortedAsc = true;
|
|
1027
|
+
icon;
|
|
1028
|
+
constructor(el, renderer) {
|
|
1029
|
+
this.el = el;
|
|
1030
|
+
this.renderer = renderer;
|
|
1031
|
+
}
|
|
1032
|
+
ngOnInit() { }
|
|
1033
|
+
ngAfterViewInit() {
|
|
1034
|
+
this.icon = this.createIcon();
|
|
1035
|
+
if (this.icon && this.s4yColumnName()) {
|
|
1036
|
+
this.applySortButton();
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
createSpanElement() {
|
|
1040
|
+
const span = this.renderer.createElement('span');
|
|
1041
|
+
span.role = 'button';
|
|
1042
|
+
this.renderer.setStyle(span, 'cursor', 'pointer');
|
|
1043
|
+
this.renderer.createText(this.svgIconAsc);
|
|
1044
|
+
return span;
|
|
1045
|
+
}
|
|
1046
|
+
applySortButton() {
|
|
1047
|
+
const thElement = this.el.nativeElement;
|
|
1048
|
+
let thText = this.el.nativeElement.textContent.trim();
|
|
1049
|
+
thElement.textContent = '';
|
|
1050
|
+
/* A div vai agrupar os dois, e espalhar na horizontal */
|
|
1051
|
+
const thContainer = this.renderer.createElement('div');
|
|
1052
|
+
const headerText = this.renderer.createText(thText);
|
|
1053
|
+
const span = this.createSpanElement();
|
|
1054
|
+
this.renderer.appendChild(span, this.icon);
|
|
1055
|
+
this.renderer.appendChild(thContainer, headerText);
|
|
1056
|
+
this.renderer.appendChild(thContainer, span);
|
|
1057
|
+
this.renderer.appendChild(thElement, thContainer);
|
|
1058
|
+
this.applyStyleInThContainer(thContainer);
|
|
1059
|
+
this.renderer.listen(span, 'click', () => this.toggleSort());
|
|
1060
|
+
}
|
|
1061
|
+
toggleSort() {
|
|
1062
|
+
this.isSortedAsc = !this.isSortedAsc;
|
|
1063
|
+
this.updateSortIcon();
|
|
1064
|
+
this.sortColumnData();
|
|
1065
|
+
}
|
|
1066
|
+
createIcon() {
|
|
1067
|
+
const icon = this.renderer.createElement('svg');
|
|
1068
|
+
this.renderer.setProperty(icon, 'innerHTML', this.svgIconAsc);
|
|
1069
|
+
return icon;
|
|
1070
|
+
}
|
|
1071
|
+
sortColumnData() {
|
|
1072
|
+
const columnName = this.s4yColumnName();
|
|
1073
|
+
const data = this.data();
|
|
1074
|
+
if (columnName && columnName.trim() !== '' && data.length > 0) {
|
|
1075
|
+
data.sort((a, b) => {
|
|
1076
|
+
const columnA = a[columnName];
|
|
1077
|
+
const columnB = b[columnName];
|
|
1078
|
+
if (columnA < columnB) {
|
|
1079
|
+
return this.isSortedAsc ? -1 : 1;
|
|
1080
|
+
}
|
|
1081
|
+
if (columnA > columnB) {
|
|
1082
|
+
return this.isSortedAsc ? 1 : -1;
|
|
1083
|
+
}
|
|
1084
|
+
return 0;
|
|
1085
|
+
});
|
|
1086
|
+
this.updateSortIcon();
|
|
1087
|
+
this.applySortedClass();
|
|
1088
|
+
console.log('Dados ordenados:', data); // Dados ordenados no console
|
|
1089
|
+
}
|
|
1090
|
+
else {
|
|
1091
|
+
console.error('Nome da coluna não definido ou inválido!');
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
applySortedClass() {
|
|
1095
|
+
const thElements = this.el.nativeElement
|
|
1096
|
+
.closest('table')
|
|
1097
|
+
.querySelectorAll('th');
|
|
1098
|
+
const tdElements = this.el.nativeElement
|
|
1099
|
+
.closest('table')
|
|
1100
|
+
.querySelectorAll('td');
|
|
1101
|
+
const thElement = this.el.nativeElement;
|
|
1102
|
+
const isAlreadySorted = thElement.classList.contains('sorted');
|
|
1103
|
+
if (isAlreadySorted) {
|
|
1104
|
+
thElements.forEach((th) => {
|
|
1105
|
+
this.renderer.removeClass(th, 'sorted');
|
|
1106
|
+
});
|
|
1107
|
+
tdElements.forEach((td) => {
|
|
1108
|
+
this.renderer.removeClass(td, 'sorted');
|
|
1109
|
+
});
|
|
1110
|
+
return;
|
|
1111
|
+
}
|
|
1112
|
+
thElements.forEach((th) => {
|
|
1113
|
+
this.renderer.removeClass(th, 'sorted');
|
|
1114
|
+
});
|
|
1115
|
+
tdElements.forEach((td) => {
|
|
1116
|
+
this.renderer.removeClass(td, 'sorted');
|
|
1117
|
+
});
|
|
1118
|
+
this.renderer.addClass(thElement, 'sorted');
|
|
1119
|
+
const columnIndex = Array.from(thElements).indexOf(thElement);
|
|
1120
|
+
const trElements = this.el.nativeElement
|
|
1121
|
+
.closest('table')
|
|
1122
|
+
.querySelectorAll('tr');
|
|
1123
|
+
trElements.forEach((tr) => {
|
|
1124
|
+
const td = tr.children[columnIndex];
|
|
1125
|
+
if (td) {
|
|
1126
|
+
this.renderer.addClass(td, 'sorted');
|
|
1127
|
+
}
|
|
1128
|
+
});
|
|
1129
|
+
}
|
|
1130
|
+
applyStyleInThContainer(thContainer) {
|
|
1131
|
+
this.renderer.setStyle(thContainer, 'display', 'flex');
|
|
1132
|
+
this.renderer.setStyle(thContainer, 'justify-content', 'space-between');
|
|
1133
|
+
this.renderer.setStyle(thContainer, 'align-items', 'center');
|
|
1134
|
+
}
|
|
1135
|
+
updateSortIcon() {
|
|
1136
|
+
let iconSvg = this.isSortedAsc ? this.svgIconAsc : this.svgIconDesc;
|
|
1137
|
+
this.renderer.setProperty(this.icon, 'innerHTML', iconSvg);
|
|
1138
|
+
}
|
|
1139
|
+
svgIconAsc = `<svg
|
|
1140
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1141
|
+
viewBox="0 0 24 24"
|
|
1142
|
+
fill="currentColor"
|
|
1143
|
+
width="1.8rem"
|
|
1144
|
+
height="1.8rem"
|
|
1145
|
+
>
|
|
1146
|
+
<path
|
|
1147
|
+
d="M4.86885 11H2.6665L6 3H8L11.3334 11H9.13113L8.7213 10H5.27869L4.86885 11ZM6.09836 8H7.90163L7 5.8L6.09836 8ZM18.9999 16V3H16.9999V16H13.9999L17.9999 21L21.9999 16H18.9999ZM10.9999 13H2.99992V15H7.85414L2.99992 19V21H10.9999V19H6.14605L10.9999 15V13Z"
|
|
1148
|
+
></path>
|
|
1149
|
+
</svg>`;
|
|
1150
|
+
svgIconDesc = `<svg xmlns="http://www.w3.org/2000/svg"
|
|
1151
|
+
width="1.8rem"
|
|
1152
|
+
height="1.8rem"
|
|
1153
|
+
viewBox="0 0 24 24"
|
|
1154
|
+
fill="currentColor"><path d="M4.86885 11H2.6665L6 3H8L11.3334 11H9.13113L8.7213 10H5.27869L4.86885 11ZM6.09836 8H7.90163L7 5.8L6.09836 8ZM21.9999 8L17.9999 3L13.9999 8H16.9999V21H18.9999V8H21.9999ZM10.9999 13H2.99992V15H7.85414L2.99992 19V21H10.9999V19H6.14605L10.9999 15V13Z"></path></svg>`;
|
|
1155
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: SortTableDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1156
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.7", type: SortTableDirective, isStandalone: true, selector: "[s4ySortTable]", inputs: { s4yColumnName: { classPropertyName: "s4yColumnName", publicName: "s4yColumnName", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
1157
|
+
}
|
|
1158
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: SortTableDirective, decorators: [{
|
|
1159
|
+
type: Directive,
|
|
1160
|
+
args: [{
|
|
1161
|
+
selector: '[s4ySortTable]',
|
|
1162
|
+
}]
|
|
1163
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }] });
|
|
1164
|
+
|
|
1165
|
+
/*
|
|
1166
|
+
* Public API Surface of s4y-components
|
|
1167
|
+
*/
|
|
1168
|
+
// Exporta tudo do index.ts de cada pasta
|
|
1169
|
+
|
|
1170
|
+
/**
|
|
1171
|
+
* Generated bundle index. Do not edit.
|
|
1172
|
+
*/
|
|
1173
|
+
|
|
1174
|
+
export { AsideComponent, BreadcrumbComponent, ButtonComponent, DashboardContainerComponent, DashboardLayoutComponent, DashboardModule, DashboardRoutesComponent, DrawerComponent, ErrorMessageComponent, FormFieldComponent, FormFieldPasswordComponent, FormsKitModule, HintComponent, InputComponent, InputPrefixComponent, InputSufixComponent, LabelComponent, MaskDirective, NavbarComponent, S4yAvatarComponent, SortTableDirective, SpinnerComponent, SvgComponent, SvgService, TableComponent, ToastComponent, ToastService };
|
|
1175
|
+
//# sourceMappingURL=s4y-ui.mjs.map
|