s4y-ui 5.0.1 → 5.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/s4y-ui.mjs +663 -21
- package/fesm2022/s4y-ui.mjs.map +1 -1
- package/lib/components/dynamic-dialog/dynamic-dialog.component.d.ts +4 -2
- package/lib/components/dynamic-dialog/dynamic-dialog.ref.d.ts +23 -1
- package/lib/components/dynamic-dialog/dynamic-dialog.service.d.ts +8 -6
- package/lib/components/dynamic-dialog/dynamic-dialog.tokens.d.ts +1 -1
- package/lib/components/dynamic-dialog/dynamic-dialog.util.d.ts +3 -0
- package/lib/components/dynamic-loading-global/dynamic-loading-global.component.d.ts +6 -0
- package/lib/components/dynamic-loading-global/dynamic-loading-global.service.d.ts +13 -0
- package/lib/components/dynamic-loading-global/index.d.ts +1 -0
- package/lib/components/image/components/image-preview/image-preview.component.d.ts +22 -0
- package/lib/components/image/image.component.d.ts +31 -0
- package/lib/components/image/image.service.d.ts +12 -0
- package/lib/components/image/index.d.ts +2 -0
- package/lib/components/modal/modal.component.d.ts +3 -1
- package/lib/components/rating/rating.component.d.ts +40 -0
- package/lib/components/select/select.component.d.ts +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +3 -0
- package/src/assets/icons/fullscreen-exit-line.svg +1 -0
- package/src/assets/icons/fullscreen-line.svg +1 -0
- package/src/assets/icons/refresh-line.svg +1 -0
- package/src/assets/icons/zoom-in-line.svg +1 -0
- package/src/assets/icons/zoom-out-line.svg +1 -0
- package/src/scss/styles.scss +153 -0
- package/src/scss/styles.scss.map +1 -1
package/fesm2022/s4y-ui.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { ContentChild, Component, signal, computed, Injectable, inject, input, HostBinding, Input, ChangeDetectionStrategy, NgModule, booleanAttribute, forwardRef, HostListener, Directive, EventEmitter, Output, model, output, ViewEncapsulation, effect, Inject, TemplateRef, ViewChild, ContentChildren, ElementRef, ViewContainerRef, InjectionToken, Injector } from '@angular/core';
|
|
2
|
+
import { ContentChild, Component, signal, computed, Injectable, inject, input, HostBinding, Input, ChangeDetectionStrategy, NgModule, booleanAttribute, forwardRef, HostListener, Directive, EventEmitter, Output, model, output, ViewEncapsulation, effect, Inject, TemplateRef, ViewChild, ContentChildren, ElementRef, ViewContainerRef, viewChild, Renderer2, DestroyRef, InjectionToken, Injector } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
4
|
import { CommonModule, AsyncPipe, JsonPipe, NgClass, NgTemplateOutlet, DOCUMENT, NgIf, NgStyle } from '@angular/common';
|
|
5
5
|
import * as i1$1 from '@angular/platform-browser';
|
|
@@ -14,7 +14,8 @@ import * as i2 from '@angular/forms';
|
|
|
14
14
|
import { NG_VALUE_ACCESSOR, NgControl, FormsModule } from '@angular/forms';
|
|
15
15
|
import { trigger, transition, animate, style, group, query, state } from '@angular/animations';
|
|
16
16
|
import { Overlay } from '@angular/cdk/overlay';
|
|
17
|
-
import { TemplatePortal,
|
|
17
|
+
import { TemplatePortal, ComponentPortal, CdkPortalOutlet } from '@angular/cdk/portal';
|
|
18
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
18
19
|
|
|
19
20
|
class DashboardLayoutComponent {
|
|
20
21
|
asideTemplate;
|
|
@@ -1394,6 +1395,8 @@ class ModalComponent {
|
|
|
1394
1395
|
withHeader = input(true);
|
|
1395
1396
|
closeOnBackdrop = input(true);
|
|
1396
1397
|
closeOnEsc = input(true);
|
|
1398
|
+
interceptBackdropClick = input(false);
|
|
1399
|
+
onBackdrop = output();
|
|
1397
1400
|
constructor(renderer, document) {
|
|
1398
1401
|
this.renderer = renderer;
|
|
1399
1402
|
this.document = document;
|
|
@@ -1416,9 +1419,13 @@ class ModalComponent {
|
|
|
1416
1419
|
}
|
|
1417
1420
|
ngAfterViewInit() { }
|
|
1418
1421
|
onBackdropClick(evt) {
|
|
1419
|
-
if (!this.closeOnBackdrop)
|
|
1422
|
+
if (!this.closeOnBackdrop())
|
|
1420
1423
|
return;
|
|
1421
1424
|
if (evt.target === evt.currentTarget) {
|
|
1425
|
+
if (this.interceptBackdropClick()) {
|
|
1426
|
+
this.onBackdrop.emit();
|
|
1427
|
+
return;
|
|
1428
|
+
}
|
|
1422
1429
|
this.onClose();
|
|
1423
1430
|
}
|
|
1424
1431
|
}
|
|
@@ -1431,7 +1438,7 @@ class ModalComponent {
|
|
|
1431
1438
|
window.removeEventListener('keydown', this.escListener);
|
|
1432
1439
|
}
|
|
1433
1440
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: ModalComponent, deps: [{ token: i0.Renderer2 }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Component });
|
|
1434
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.15", type: ModalComponent, isStandalone: true, selector: "s4y-modal", inputs: { scrollableContent: { classPropertyName: "scrollableContent", publicName: "scrollableContent", isSignal: true, isRequired: false, transformFunction: null }, centeredModal: { classPropertyName: "centeredModal", publicName: "centeredModal", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, modalStyle: { classPropertyName: "modalStyle", publicName: "modalStyle", isSignal: true, isRequired: false, transformFunction: null }, visible: { classPropertyName: "visible", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null }, withHeader: { classPropertyName: "withHeader", publicName: "withHeader", isSignal: true, isRequired: false, transformFunction: null }, closeOnBackdrop: { classPropertyName: "closeOnBackdrop", publicName: "closeOnBackdrop", isSignal: true, isRequired: false, transformFunction: null }, closeOnEsc: { classPropertyName: "closeOnEsc", publicName: "closeOnEsc", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { visible: "visibleChange", requestClose: "requestClose" }, queries: [{ propertyName: "modalHeaderTemplate", first: true, predicate: ["modalHeaderTemplate"], descendants: true }, { propertyName: "modalFooterTemplate", first: true, predicate: ["modalFooterTemplate"], descendants: true }], ngImport: i0, template: "@if (visible()) {\r\n <div\r\n class=\"s4y-modal-wrapper\"\r\n [class.s4y-modal-wrapper-with-scrollable]=\"!scrollableContent()\"\r\n [class.s4y-modal-wrapper-centered]=\"centeredModal()\"\r\n @modalFadeCombined\r\n cdkScrollable\r\n (click)=\"onBackdropClick($event)\"\r\n role=\"dialog\"\r\n aria-modal=\"true\"\r\n >\r\n <div\r\n class=\"s4y-modal-container\"\r\n [class.s4y-modal-container__scrollable-content]=\"scrollableContent()\"\r\n [ngStyle]=\"modalStyle()\"\r\n >\r\n @if (modalHeaderTemplate) {\r\n <ng-container [ngTemplateOutlet]=\"modalHeaderTemplate\"></ng-container>\r\n }\r\n @if (!modalHeaderTemplate && withHeader()) {\r\n <div class=\"s4y-modal-header\">\r\n <h2 class=\"s4y-modal-header__title\">{{ title() }}</h2>\r\n <button role=\"button\" (click)=\"onClose()\">\r\n <p>×</p>\r\n </button>\r\n </div>\r\n }\r\n\r\n <div\r\n class=\"s4y-modal-body\"\r\n [class.s4y-modal-body__scrollable-content]=\"scrollableContent()\"\r\n cdkScrollable\r\n >\r\n <ng-content></ng-content>\r\n </div>\r\n @if (modalFooterTemplate) {\r\n <div class=\"s4y-modal-footer\">\r\n <ng-container [ngTemplateOutlet]=\"modalFooterTemplate\"></ng-container>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n}\r\n", styles: [".s4y-modal-wrapper{position:fixed;inset:0;display:flex;align-items:flex-start;justify-content:center;z-index:var(--z-index-modal-backdrop);padding:3.8rem;background-color:#000000b3}.s4y-modal-wrapper.s4y-modal-wrapper-with-scrollable{overflow-y:auto;-webkit-overflow-scrolling:auto}.s4y-modal-wrapper.s4y-modal-wrapper-centered{align-items:center;justify-content:center}.s4y-modal-container{background:#fff;width:100%;min-width:300px;max-width:500px;border-radius:var(--radius);z-index:var(--z-index-modal);box-shadow:0 4px 12px #0003;animation:fadeInUp .3s ease;padding:1.8rem 2rem 2.2rem;display:flex;flex-direction:column}@media screen and (min-width: 320px) and (max-width: 480px){.s4y-modal-container{width:90%}}@media screen and (min-width: 481px) and (max-width: 767px){.s4y-modal-container{width:90%}}@media screen and (min-width: 768px) and (max-width: 1024px){.s4y-modal-container{width:90%}}.s4y-modal-header{padding-bottom:1rem;flex-shrink:0;display:flex;align-items:center;justify-content:space-between}.s4y-modal-header button{padding:.6rem 1.2rem;font-size:1.8rem;cursor:pointer}.s4y-modal-header .s4y-modal-header__title{font-size:1.8rem;color:var(--primary-color)}.s4y-modal-body{flex-grow:1}.s4y-modal-footer{padding:1rem 0;flex-shrink:0}.s4y-modal-body__scrollable-content{overflow-y:auto}.s4y-modal-container__scrollable-content{max-height:90dvh;min-height:18rem}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: CdkScrollable, selector: "[cdk-scrollable], [cdkScrollable]" }], animations: [modalFadeCombined] });
|
|
1441
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.15", type: ModalComponent, isStandalone: true, selector: "s4y-modal", inputs: { scrollableContent: { classPropertyName: "scrollableContent", publicName: "scrollableContent", isSignal: true, isRequired: false, transformFunction: null }, centeredModal: { classPropertyName: "centeredModal", publicName: "centeredModal", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, modalStyle: { classPropertyName: "modalStyle", publicName: "modalStyle", isSignal: true, isRequired: false, transformFunction: null }, visible: { classPropertyName: "visible", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null }, withHeader: { classPropertyName: "withHeader", publicName: "withHeader", isSignal: true, isRequired: false, transformFunction: null }, closeOnBackdrop: { classPropertyName: "closeOnBackdrop", publicName: "closeOnBackdrop", isSignal: true, isRequired: false, transformFunction: null }, closeOnEsc: { classPropertyName: "closeOnEsc", publicName: "closeOnEsc", isSignal: true, isRequired: false, transformFunction: null }, interceptBackdropClick: { classPropertyName: "interceptBackdropClick", publicName: "interceptBackdropClick", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { visible: "visibleChange", requestClose: "requestClose", onBackdrop: "onBackdrop" }, queries: [{ propertyName: "modalHeaderTemplate", first: true, predicate: ["modalHeaderTemplate"], descendants: true }, { propertyName: "modalFooterTemplate", first: true, predicate: ["modalFooterTemplate"], descendants: true }], ngImport: i0, template: "@if (visible()) {\r\n <div\r\n class=\"s4y-modal-wrapper\"\r\n [class.s4y-modal-wrapper-with-scrollable]=\"!scrollableContent()\"\r\n [class.s4y-modal-wrapper-centered]=\"centeredModal()\"\r\n @modalFadeCombined\r\n cdkScrollable\r\n (click)=\"onBackdropClick($event)\"\r\n role=\"dialog\"\r\n aria-modal=\"true\"\r\n >\r\n <div\r\n class=\"s4y-modal-container\"\r\n [class.s4y-modal-container__scrollable-content]=\"scrollableContent()\"\r\n [ngStyle]=\"modalStyle()\"\r\n >\r\n @if (modalHeaderTemplate) {\r\n <ng-container [ngTemplateOutlet]=\"modalHeaderTemplate\"></ng-container>\r\n }\r\n @if (!modalHeaderTemplate && withHeader()) {\r\n <div class=\"s4y-modal-header\">\r\n <h2 class=\"s4y-modal-header__title\">{{ title() }}</h2>\r\n <button role=\"button\" (click)=\"onClose()\">\r\n <p>×</p>\r\n </button>\r\n </div>\r\n }\r\n\r\n <div\r\n class=\"s4y-modal-body\"\r\n [class.s4y-modal-body__scrollable-content]=\"scrollableContent()\"\r\n cdkScrollable\r\n >\r\n <ng-content></ng-content>\r\n </div>\r\n @if (modalFooterTemplate) {\r\n <div class=\"s4y-modal-footer\">\r\n <ng-container [ngTemplateOutlet]=\"modalFooterTemplate\"></ng-container>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n}\r\n", styles: [".s4y-modal-wrapper{position:fixed;inset:0;display:flex;align-items:flex-start;justify-content:center;z-index:var(--z-index-modal-backdrop);padding:3.8rem;background-color:#000000b3}.s4y-modal-wrapper.s4y-modal-wrapper-with-scrollable{overflow-y:auto;-webkit-overflow-scrolling:auto}.s4y-modal-wrapper.s4y-modal-wrapper-centered{align-items:center;justify-content:center}.s4y-modal-container{background:#fff;width:100%;min-width:300px;max-width:500px;border-radius:var(--radius);z-index:var(--z-index-modal);box-shadow:0 4px 12px #0003;animation:fadeInUp .3s ease;padding:1.8rem 2rem 2.2rem;display:flex;flex-direction:column}@media screen and (min-width: 320px) and (max-width: 480px){.s4y-modal-container{width:90%}}@media screen and (min-width: 481px) and (max-width: 767px){.s4y-modal-container{width:90%}}@media screen and (min-width: 768px) and (max-width: 1024px){.s4y-modal-container{width:90%}}.s4y-modal-header{padding-bottom:1rem;flex-shrink:0;display:flex;align-items:center;justify-content:space-between}.s4y-modal-header button{padding:.6rem 1.2rem;font-size:1.8rem;cursor:pointer}.s4y-modal-header .s4y-modal-header__title{font-size:1.8rem;color:var(--primary-color)}.s4y-modal-body{flex-grow:1}.s4y-modal-footer{padding:1rem 0;flex-shrink:0}.s4y-modal-body__scrollable-content{overflow-y:auto}.s4y-modal-container__scrollable-content{max-height:90dvh;min-height:18rem}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: CdkScrollable, selector: "[cdk-scrollable], [cdkScrollable]" }], animations: [modalFadeCombined] });
|
|
1435
1442
|
}
|
|
1436
1443
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: ModalComponent, decorators: [{
|
|
1437
1444
|
type: Component,
|
|
@@ -1684,7 +1691,7 @@ class SelectComponent {
|
|
|
1684
1691
|
provide: NG_VALUE_ACCESSOR,
|
|
1685
1692
|
useExisting: forwardRef(() => SelectComponent),
|
|
1686
1693
|
},
|
|
1687
|
-
], queries: [{ propertyName: "optionTemplate", first: true, predicate: ["optionTemplate"], descendants: true }, { propertyName: "errorTemplate", first: true, predicate: ["errorTemplate"], descendants: true }, { propertyName: "emptyTemplate", first: true, predicate: ["emptyTemplate"], descendants: true }, { propertyName: "selectedOptionTemplate", first: true, predicate: ["selectedOptionTemplate"], descendants: true }], ngImport: i0, template: "<label\r\n class=\"s4y-select-container\"\r\n [style.maxWidth]=\"widthStyle()\"\r\n s4yClickOutside\r\n (clickOutside)=\"isOpened = false\"\r\n>\r\n <p class=\"s4y-select-label\">\r\n {{ label() }}\r\n </p>\r\n\r\n <div\r\n class=\"s4y-select-container__wrapper\"\r\n [class.disabled]=\"isDisabled\"\r\n (click)=\"isOpened = !isOpened\"\r\n [attr.aria-expanded]=\"isOpened ? 'true' : 'false'\"\r\n tabindex=\"0\"\r\n aria-controls=\"select-options-container\"\r\n >\r\n <div class=\"s4y-select-container__placeholder\">\r\n @if (selectedOptionTemplate) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"selectedOptionTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: selectedOption?.option }\"\r\n ></ng-container>\r\n } @else {\r\n @if (!selectedOption) {\r\n <p>Selecione...</p>\r\n } @else {\r\n <p>{{ selectedOption }}</p>\r\n }\r\n }\r\n </div>\r\n @if (isOpened) {\r\n <ng-container [ngTemplateOutlet]=\"arrowUp\"></ng-container>\r\n }\r\n @if (!isOpened) {\r\n <ng-container [ngTemplateOutlet]=\"arrowDown\"></ng-container>\r\n }\r\n </div>\r\n <div @selectAnimation class=\"s4y-select-options-container\" *ngIf=\"isOpened\">\r\n <div class=\"s4y-select-options\">\r\n @if (withSearch()) {\r\n <div class=\"s4y-select-options__search\">\r\n <input\r\n [ngModel]=\"onSearch()\"\r\n (ngModelChange)=\"onSearch.set($event)\"\r\n placeholder=\"Pesquisar...\"\r\n type=\"text\"\r\n name=\"search-option\"\r\n id=\"search-option\"\r\n autocomplete=\"off\"\r\n />\r\n <ng-container [ngTemplateOutlet]=\"searchIcon\"></ng-container>\r\n </div>\r\n }\r\n @if (isLoading()) {\r\n <div class=\"s4y-select-container__loading\">\r\n <s4y-spinner [size]=\"'mini'\"></s4y-spinner>\r\n </div>\r\n } @else if (hasError()) {\r\n @if (errorTemplate) {\r\n <p class=\"s4y-select-options__message\">\r\n <ng-container [ngTemplateOutlet]=\"errorTemplate\"></ng-container>\r\n </p>\r\n } @else {\r\n <p class=\"s4y-select-options__message\">\r\n {{ errorMessageDefault() }}\r\n </p>\r\n }\r\n } @else {\r\n <div\r\n class=\"s4y-select-options__scroll\"\r\n role=\"listbox\"\r\n aria-live=\"polite\"\r\n >\r\n @for (option of transformedOptions(); track $index) {\r\n <p\r\n [class.selected]=\"option.selected\"\r\n class=\"s4y-select-options__item\"\r\n role=\"option\"\r\n aria-selected=\"false\"\r\n tabindex=\"0\"\r\n (click)=\"setSelectedOption(option)\"\r\n (keyup.enter)=\"setSelectedOption(option)\"\r\n >\r\n <ng-container\r\n *ngTemplateOutlet=\"\r\n optionTemplate;\r\n context: { $implicit: option?.option }\r\n \"\r\n ></ng-container>\r\n </p>\r\n } @empty {\r\n @if (emptyTemplate) {\r\n <p\r\n class=\"s4y-select-options__message\"\r\n role=\"status\"\r\n aria-live=\"assertive\"\r\n >\r\n <ng-container [ngTemplateOutlet]=\"emptyTemplate\"></ng-container>\r\n </p>\r\n } @else {\r\n <p\r\n class=\"s4y-select-options__message\"\r\n role=\"status\"\r\n aria-live=\"assertive\"\r\n >\r\n {{ emptyMessageDefault() }}\r\n </p>\r\n }\r\n }\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n</label>\r\n\r\n<!-- arrows -->\r\n<ng-template #arrowDown>\r\n <svg\r\n class=\"s4y-select__svg\"\r\n width=\"18px\"\r\n height=\"18px\"\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</ng-template>\r\n\r\n<ng-template #arrowUp>\r\n <svg\r\n class=\"s4y-select__svg\"\r\n width=\"18px\"\r\n height=\"18px\"\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 10.8284L7.0502 15.7782L5.63599 14.364L11.9999 8L18.3639 14.364L16.9497 15.7782L11.9999 10.8284Z\"\r\n ></path>\r\n </svg>\r\n</ng-template>\r\n\r\n<ng-template #searchIcon>\r\n <svg\r\n width=\"18px\"\r\n height=\"18px\"\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 2C15.968 2 20 6.032 20 11C20 15.968 15.968 20 11 20C6.032 20 2 15.968 2 11C2 6.032 6.032 2 11 2ZM11 18C14.8675 18 18 14.8675 18 11C18 7.1325 14.8675 4 11 4C7.1325 4 4 7.1325 4 11C4 14.8675 7.1325 18 11 18ZM19.4853 18.0711L22.3137 20.8995L20.8995 22.3137L18.0711 19.4853L19.4853 18.0711Z\"\r\n ></path>\r\n </svg>\r\n</ng-template>\r\n", styles: [".s4y-select-container{display:block;min-width:12rem}.s4y-select-container .s4y-select-label{margin-bottom:.8rem;font-size:1.4rem}.s4y-select-container .s4y-select-container__wrapper{
|
|
1694
|
+
], queries: [{ propertyName: "optionTemplate", first: true, predicate: ["optionTemplate"], descendants: true }, { propertyName: "errorTemplate", first: true, predicate: ["errorTemplate"], descendants: true }, { propertyName: "emptyTemplate", first: true, predicate: ["emptyTemplate"], descendants: true }, { propertyName: "selectedOptionTemplate", first: true, predicate: ["selectedOptionTemplate"], descendants: true }], ngImport: i0, template: "<label\r\n class=\"s4y-select-container\"\r\n [style.maxWidth]=\"widthStyle()\"\r\n s4yClickOutside\r\n (clickOutside)=\"isOpened = false\"\r\n>\r\n <p class=\"s4y-select-label\">\r\n {{ label() }}\r\n </p>\r\n\r\n <div\r\n class=\"s4y-select-container__wrapper\"\r\n [class.disabled]=\"isDisabled\"\r\n (click)=\"isOpened = !isOpened\"\r\n [attr.aria-expanded]=\"isOpened ? 'true' : 'false'\"\r\n tabindex=\"0\"\r\n aria-controls=\"select-options-container\"\r\n >\r\n <div class=\"s4y-select-container__placeholder\">\r\n @if (selectedOptionTemplate) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"selectedOptionTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: selectedOption?.option }\"\r\n ></ng-container>\r\n } @else {\r\n @if (!selectedOption) {\r\n <p>Selecione...</p>\r\n } @else {\r\n <p>{{ selectedOption }}</p>\r\n }\r\n }\r\n </div>\r\n @if (isOpened) {\r\n <ng-container [ngTemplateOutlet]=\"arrowUp\"></ng-container>\r\n }\r\n @if (!isOpened) {\r\n <ng-container [ngTemplateOutlet]=\"arrowDown\"></ng-container>\r\n }\r\n </div>\r\n <ng-content select=\"s4y-error-message\"></ng-content>\r\n <div @selectAnimation class=\"s4y-select-options-container\" *ngIf=\"isOpened\">\r\n <div class=\"s4y-select-options\">\r\n @if (withSearch()) {\r\n <div class=\"s4y-select-options__search\">\r\n <input\r\n [ngModel]=\"onSearch()\"\r\n (ngModelChange)=\"onSearch.set($event)\"\r\n placeholder=\"Pesquisar...\"\r\n type=\"text\"\r\n name=\"search-option\"\r\n id=\"search-option\"\r\n autocomplete=\"off\"\r\n />\r\n <ng-container [ngTemplateOutlet]=\"searchIcon\"></ng-container>\r\n </div>\r\n }\r\n @if (isLoading()) {\r\n <div class=\"s4y-select-container__loading\">\r\n <s4y-spinner [size]=\"'mini'\"></s4y-spinner>\r\n </div>\r\n } @else if (hasError()) {\r\n @if (errorTemplate) {\r\n <p class=\"s4y-select-options__message\">\r\n <ng-container [ngTemplateOutlet]=\"errorTemplate\"></ng-container>\r\n </p>\r\n } @else {\r\n <p class=\"s4y-select-options__message\">\r\n {{ errorMessageDefault() }}\r\n </p>\r\n }\r\n } @else {\r\n <div\r\n class=\"s4y-select-options__scroll\"\r\n role=\"listbox\"\r\n aria-live=\"polite\"\r\n >\r\n @for (option of transformedOptions(); track $index) {\r\n <p\r\n [class.selected]=\"option.selected\"\r\n class=\"s4y-select-options__item\"\r\n role=\"option\"\r\n aria-selected=\"false\"\r\n tabindex=\"0\"\r\n (click)=\"setSelectedOption(option)\"\r\n (keyup.enter)=\"setSelectedOption(option)\"\r\n >\r\n <ng-container\r\n *ngTemplateOutlet=\"\r\n optionTemplate;\r\n context: { $implicit: option?.option }\r\n \"\r\n ></ng-container>\r\n </p>\r\n } @empty {\r\n @if (emptyTemplate) {\r\n <p\r\n class=\"s4y-select-options__message\"\r\n role=\"status\"\r\n aria-live=\"assertive\"\r\n >\r\n <ng-container [ngTemplateOutlet]=\"emptyTemplate\"></ng-container>\r\n </p>\r\n } @else {\r\n <p\r\n class=\"s4y-select-options__message\"\r\n role=\"status\"\r\n aria-live=\"assertive\"\r\n >\r\n {{ emptyMessageDefault() }}\r\n </p>\r\n }\r\n }\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n</label>\r\n\r\n<!-- arrows -->\r\n<ng-template #arrowDown>\r\n <svg\r\n class=\"s4y-select__svg\"\r\n width=\"18px\"\r\n height=\"18px\"\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</ng-template>\r\n\r\n<ng-template #arrowUp>\r\n <svg\r\n class=\"s4y-select__svg\"\r\n width=\"18px\"\r\n height=\"18px\"\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 10.8284L7.0502 15.7782L5.63599 14.364L11.9999 8L18.3639 14.364L16.9497 15.7782L11.9999 10.8284Z\"\r\n ></path>\r\n </svg>\r\n</ng-template>\r\n\r\n<ng-template #searchIcon>\r\n <svg\r\n width=\"18px\"\r\n height=\"18px\"\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 2C15.968 2 20 6.032 20 11C20 15.968 15.968 20 11 20C6.032 20 2 15.968 2 11C2 6.032 6.032 2 11 2ZM11 18C14.8675 18 18 14.8675 18 11C18 7.1325 14.8675 4 11 4C7.1325 4 4 7.1325 4 11C4 14.8675 7.1325 18 11 18ZM19.4853 18.0711L22.3137 20.8995L20.8995 22.3137L18.0711 19.4853L19.4853 18.0711Z\"\r\n ></path>\r\n </svg>\r\n</ng-template>\r\n", styles: [".s4y-select-container{display:block;min-width:12rem}.s4y-select-container .s4y-select-label{margin-bottom:.8rem;font-size:1.4rem}.s4y-select-container .s4y-select-container__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);transition:.5s ease;min-height:4.6rem}.s4y-select-container .s4y-select-container__wrapper.disabled{opacity:.5;cursor:default;pointer-events:none;-webkit-user-select:none;user-select:none}.s4y-select-container .s4y-select-container__placeholder{color:var(--gray-900);font-size:1.4rem}.s4y-select-container .s4y-select-options-container{position:relative}.s4y-select-container .s4y-select-options{position:absolute;top:5px;left:0;display:flex;flex-direction:column;gap:.6rem;border-radius:var(--radius);padding:1.2rem 1.6rem;background-color:#fff;border:1px solid var(--gray-500);width:100%;max-height:24rem;z-index:var(--z-index-select-dropdown)}.s4y-select-container .s4y-select-options__scroll{overflow-y:auto}.s4y-select-container .s4y-select-options__item{padding:.8rem;font-size:1.4rem}.s4y-select-container .s4y-select-options__item:hover{border-radius:var(--radius);cursor:pointer;background-color:var(--gray-200)}.s4y-select-container .s4y-select-options__item.selected{background-color:var(--primary-color);color:var(--gray-100)}.s4y-select-container .s4y-select-options__message{font-size:1.4rem;color:var(--gray-900)}.s4y-select-container .s4y-select-container__loading{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.s4y-select-container .s4y-select-options__search{display:flex;align-items:center;justify-content:space-between;padding:1.2rem;border-radius:var(--radius);border:1px solid var(--gray-500);margin-bottom:1rem}.s4y-select-container .s4y-select-options__search input{font-size:1.4rem}.s4y-select-container .s4y-select-options__search input::placeholder{font-size:1.4rem}:host.ng-invalid.ng-touched .s4y-select-label,:host.ng-invalid.ng-dirty .s4y-select-label{color:var(--danger-color)}:host.ng-invalid.ng-touched .s4y-select-container__wrapper,:host.ng-invalid.ng-dirty .s4y-select-container__wrapper{border:1px solid var(--danger-color);background-color:#fff6f5}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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"] }, { kind: "directive", type: ClickOutsideDirective, selector: "[s4yClickOutside]", inputs: ["isVisible"], outputs: ["clickOutside"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], animations: [selectAnimation] });
|
|
1688
1695
|
}
|
|
1689
1696
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: SelectComponent, decorators: [{
|
|
1690
1697
|
type: Component,
|
|
@@ -1694,7 +1701,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
|
|
|
1694
1701
|
provide: NG_VALUE_ACCESSOR,
|
|
1695
1702
|
useExisting: forwardRef(() => SelectComponent),
|
|
1696
1703
|
},
|
|
1697
|
-
], template: "<label\r\n class=\"s4y-select-container\"\r\n [style.maxWidth]=\"widthStyle()\"\r\n s4yClickOutside\r\n (clickOutside)=\"isOpened = false\"\r\n>\r\n <p class=\"s4y-select-label\">\r\n {{ label() }}\r\n </p>\r\n\r\n <div\r\n class=\"s4y-select-container__wrapper\"\r\n [class.disabled]=\"isDisabled\"\r\n (click)=\"isOpened = !isOpened\"\r\n [attr.aria-expanded]=\"isOpened ? 'true' : 'false'\"\r\n tabindex=\"0\"\r\n aria-controls=\"select-options-container\"\r\n >\r\n <div class=\"s4y-select-container__placeholder\">\r\n @if (selectedOptionTemplate) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"selectedOptionTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: selectedOption?.option }\"\r\n ></ng-container>\r\n } @else {\r\n @if (!selectedOption) {\r\n <p>Selecione...</p>\r\n } @else {\r\n <p>{{ selectedOption }}</p>\r\n }\r\n }\r\n </div>\r\n @if (isOpened) {\r\n <ng-container [ngTemplateOutlet]=\"arrowUp\"></ng-container>\r\n }\r\n @if (!isOpened) {\r\n <ng-container [ngTemplateOutlet]=\"arrowDown\"></ng-container>\r\n }\r\n </div>\r\n <div @selectAnimation class=\"s4y-select-options-container\" *ngIf=\"isOpened\">\r\n <div class=\"s4y-select-options\">\r\n @if (withSearch()) {\r\n <div class=\"s4y-select-options__search\">\r\n <input\r\n [ngModel]=\"onSearch()\"\r\n (ngModelChange)=\"onSearch.set($event)\"\r\n placeholder=\"Pesquisar...\"\r\n type=\"text\"\r\n name=\"search-option\"\r\n id=\"search-option\"\r\n autocomplete=\"off\"\r\n />\r\n <ng-container [ngTemplateOutlet]=\"searchIcon\"></ng-container>\r\n </div>\r\n }\r\n @if (isLoading()) {\r\n <div class=\"s4y-select-container__loading\">\r\n <s4y-spinner [size]=\"'mini'\"></s4y-spinner>\r\n </div>\r\n } @else if (hasError()) {\r\n @if (errorTemplate) {\r\n <p class=\"s4y-select-options__message\">\r\n <ng-container [ngTemplateOutlet]=\"errorTemplate\"></ng-container>\r\n </p>\r\n } @else {\r\n <p class=\"s4y-select-options__message\">\r\n {{ errorMessageDefault() }}\r\n </p>\r\n }\r\n } @else {\r\n <div\r\n class=\"s4y-select-options__scroll\"\r\n role=\"listbox\"\r\n aria-live=\"polite\"\r\n >\r\n @for (option of transformedOptions(); track $index) {\r\n <p\r\n [class.selected]=\"option.selected\"\r\n class=\"s4y-select-options__item\"\r\n role=\"option\"\r\n aria-selected=\"false\"\r\n tabindex=\"0\"\r\n (click)=\"setSelectedOption(option)\"\r\n (keyup.enter)=\"setSelectedOption(option)\"\r\n >\r\n <ng-container\r\n *ngTemplateOutlet=\"\r\n optionTemplate;\r\n context: { $implicit: option?.option }\r\n \"\r\n ></ng-container>\r\n </p>\r\n } @empty {\r\n @if (emptyTemplate) {\r\n <p\r\n class=\"s4y-select-options__message\"\r\n role=\"status\"\r\n aria-live=\"assertive\"\r\n >\r\n <ng-container [ngTemplateOutlet]=\"emptyTemplate\"></ng-container>\r\n </p>\r\n } @else {\r\n <p\r\n class=\"s4y-select-options__message\"\r\n role=\"status\"\r\n aria-live=\"assertive\"\r\n >\r\n {{ emptyMessageDefault() }}\r\n </p>\r\n }\r\n }\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n</label>\r\n\r\n<!-- arrows -->\r\n<ng-template #arrowDown>\r\n <svg\r\n class=\"s4y-select__svg\"\r\n width=\"18px\"\r\n height=\"18px\"\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</ng-template>\r\n\r\n<ng-template #arrowUp>\r\n <svg\r\n class=\"s4y-select__svg\"\r\n width=\"18px\"\r\n height=\"18px\"\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 10.8284L7.0502 15.7782L5.63599 14.364L11.9999 8L18.3639 14.364L16.9497 15.7782L11.9999 10.8284Z\"\r\n ></path>\r\n </svg>\r\n</ng-template>\r\n\r\n<ng-template #searchIcon>\r\n <svg\r\n width=\"18px\"\r\n height=\"18px\"\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 2C15.968 2 20 6.032 20 11C20 15.968 15.968 20 11 20C6.032 20 2 15.968 2 11C2 6.032 6.032 2 11 2ZM11 18C14.8675 18 18 14.8675 18 11C18 7.1325 14.8675 4 11 4C7.1325 4 4 7.1325 4 11C4 14.8675 7.1325 18 11 18ZM19.4853 18.0711L22.3137 20.8995L20.8995 22.3137L18.0711 19.4853L19.4853 18.0711Z\"\r\n ></path>\r\n </svg>\r\n</ng-template>\r\n", styles: [".s4y-select-container{display:block;min-width:12rem}.s4y-select-container .s4y-select-label{margin-bottom:.8rem;font-size:1.4rem}.s4y-select-container .s4y-select-container__wrapper{
|
|
1704
|
+
], template: "<label\r\n class=\"s4y-select-container\"\r\n [style.maxWidth]=\"widthStyle()\"\r\n s4yClickOutside\r\n (clickOutside)=\"isOpened = false\"\r\n>\r\n <p class=\"s4y-select-label\">\r\n {{ label() }}\r\n </p>\r\n\r\n <div\r\n class=\"s4y-select-container__wrapper\"\r\n [class.disabled]=\"isDisabled\"\r\n (click)=\"isOpened = !isOpened\"\r\n [attr.aria-expanded]=\"isOpened ? 'true' : 'false'\"\r\n tabindex=\"0\"\r\n aria-controls=\"select-options-container\"\r\n >\r\n <div class=\"s4y-select-container__placeholder\">\r\n @if (selectedOptionTemplate) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"selectedOptionTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: selectedOption?.option }\"\r\n ></ng-container>\r\n } @else {\r\n @if (!selectedOption) {\r\n <p>Selecione...</p>\r\n } @else {\r\n <p>{{ selectedOption }}</p>\r\n }\r\n }\r\n </div>\r\n @if (isOpened) {\r\n <ng-container [ngTemplateOutlet]=\"arrowUp\"></ng-container>\r\n }\r\n @if (!isOpened) {\r\n <ng-container [ngTemplateOutlet]=\"arrowDown\"></ng-container>\r\n }\r\n </div>\r\n <ng-content select=\"s4y-error-message\"></ng-content>\r\n <div @selectAnimation class=\"s4y-select-options-container\" *ngIf=\"isOpened\">\r\n <div class=\"s4y-select-options\">\r\n @if (withSearch()) {\r\n <div class=\"s4y-select-options__search\">\r\n <input\r\n [ngModel]=\"onSearch()\"\r\n (ngModelChange)=\"onSearch.set($event)\"\r\n placeholder=\"Pesquisar...\"\r\n type=\"text\"\r\n name=\"search-option\"\r\n id=\"search-option\"\r\n autocomplete=\"off\"\r\n />\r\n <ng-container [ngTemplateOutlet]=\"searchIcon\"></ng-container>\r\n </div>\r\n }\r\n @if (isLoading()) {\r\n <div class=\"s4y-select-container__loading\">\r\n <s4y-spinner [size]=\"'mini'\"></s4y-spinner>\r\n </div>\r\n } @else if (hasError()) {\r\n @if (errorTemplate) {\r\n <p class=\"s4y-select-options__message\">\r\n <ng-container [ngTemplateOutlet]=\"errorTemplate\"></ng-container>\r\n </p>\r\n } @else {\r\n <p class=\"s4y-select-options__message\">\r\n {{ errorMessageDefault() }}\r\n </p>\r\n }\r\n } @else {\r\n <div\r\n class=\"s4y-select-options__scroll\"\r\n role=\"listbox\"\r\n aria-live=\"polite\"\r\n >\r\n @for (option of transformedOptions(); track $index) {\r\n <p\r\n [class.selected]=\"option.selected\"\r\n class=\"s4y-select-options__item\"\r\n role=\"option\"\r\n aria-selected=\"false\"\r\n tabindex=\"0\"\r\n (click)=\"setSelectedOption(option)\"\r\n (keyup.enter)=\"setSelectedOption(option)\"\r\n >\r\n <ng-container\r\n *ngTemplateOutlet=\"\r\n optionTemplate;\r\n context: { $implicit: option?.option }\r\n \"\r\n ></ng-container>\r\n </p>\r\n } @empty {\r\n @if (emptyTemplate) {\r\n <p\r\n class=\"s4y-select-options__message\"\r\n role=\"status\"\r\n aria-live=\"assertive\"\r\n >\r\n <ng-container [ngTemplateOutlet]=\"emptyTemplate\"></ng-container>\r\n </p>\r\n } @else {\r\n <p\r\n class=\"s4y-select-options__message\"\r\n role=\"status\"\r\n aria-live=\"assertive\"\r\n >\r\n {{ emptyMessageDefault() }}\r\n </p>\r\n }\r\n }\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n</label>\r\n\r\n<!-- arrows -->\r\n<ng-template #arrowDown>\r\n <svg\r\n class=\"s4y-select__svg\"\r\n width=\"18px\"\r\n height=\"18px\"\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</ng-template>\r\n\r\n<ng-template #arrowUp>\r\n <svg\r\n class=\"s4y-select__svg\"\r\n width=\"18px\"\r\n height=\"18px\"\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 10.8284L7.0502 15.7782L5.63599 14.364L11.9999 8L18.3639 14.364L16.9497 15.7782L11.9999 10.8284Z\"\r\n ></path>\r\n </svg>\r\n</ng-template>\r\n\r\n<ng-template #searchIcon>\r\n <svg\r\n width=\"18px\"\r\n height=\"18px\"\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 2C15.968 2 20 6.032 20 11C20 15.968 15.968 20 11 20C6.032 20 2 15.968 2 11C2 6.032 6.032 2 11 2ZM11 18C14.8675 18 18 14.8675 18 11C18 7.1325 14.8675 4 11 4C7.1325 4 4 7.1325 4 11C4 14.8675 7.1325 18 11 18ZM19.4853 18.0711L22.3137 20.8995L20.8995 22.3137L18.0711 19.4853L19.4853 18.0711Z\"\r\n ></path>\r\n </svg>\r\n</ng-template>\r\n", styles: [".s4y-select-container{display:block;min-width:12rem}.s4y-select-container .s4y-select-label{margin-bottom:.8rem;font-size:1.4rem}.s4y-select-container .s4y-select-container__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);transition:.5s ease;min-height:4.6rem}.s4y-select-container .s4y-select-container__wrapper.disabled{opacity:.5;cursor:default;pointer-events:none;-webkit-user-select:none;user-select:none}.s4y-select-container .s4y-select-container__placeholder{color:var(--gray-900);font-size:1.4rem}.s4y-select-container .s4y-select-options-container{position:relative}.s4y-select-container .s4y-select-options{position:absolute;top:5px;left:0;display:flex;flex-direction:column;gap:.6rem;border-radius:var(--radius);padding:1.2rem 1.6rem;background-color:#fff;border:1px solid var(--gray-500);width:100%;max-height:24rem;z-index:var(--z-index-select-dropdown)}.s4y-select-container .s4y-select-options__scroll{overflow-y:auto}.s4y-select-container .s4y-select-options__item{padding:.8rem;font-size:1.4rem}.s4y-select-container .s4y-select-options__item:hover{border-radius:var(--radius);cursor:pointer;background-color:var(--gray-200)}.s4y-select-container .s4y-select-options__item.selected{background-color:var(--primary-color);color:var(--gray-100)}.s4y-select-container .s4y-select-options__message{font-size:1.4rem;color:var(--gray-900)}.s4y-select-container .s4y-select-container__loading{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.s4y-select-container .s4y-select-options__search{display:flex;align-items:center;justify-content:space-between;padding:1.2rem;border-radius:var(--radius);border:1px solid var(--gray-500);margin-bottom:1rem}.s4y-select-container .s4y-select-options__search input{font-size:1.4rem}.s4y-select-container .s4y-select-options__search input::placeholder{font-size:1.4rem}:host.ng-invalid.ng-touched .s4y-select-label,:host.ng-invalid.ng-dirty .s4y-select-label{color:var(--danger-color)}:host.ng-invalid.ng-touched .s4y-select-container__wrapper,:host.ng-invalid.ng-dirty .s4y-select-container__wrapper{border:1px solid var(--danger-color);background-color:#fff6f5}\n"] }]
|
|
1698
1705
|
}], propDecorators: { optionTemplate: [{
|
|
1699
1706
|
type: ContentChild,
|
|
1700
1707
|
args: ['optionTemplate']
|
|
@@ -3155,6 +3162,207 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
|
|
|
3155
3162
|
}, styles: [":host{display:flex;align-items:center;justify-content:flex-start;gap:.8rem;padding:0 .4rem;min-height:4rem;width:100%;&:hover{text-decoration:underline}}\n"] }]
|
|
3156
3163
|
}] });
|
|
3157
3164
|
|
|
3165
|
+
class ImagePreviewComponent {
|
|
3166
|
+
imgEl = viewChild('imgEl');
|
|
3167
|
+
src = '';
|
|
3168
|
+
name;
|
|
3169
|
+
overlayRef;
|
|
3170
|
+
zoom = signal(1);
|
|
3171
|
+
MIN_ZOOM = 0.5;
|
|
3172
|
+
MAX_ZOOM = 3;
|
|
3173
|
+
ZOOM_STEP = 0.25;
|
|
3174
|
+
fullScreenImage = signal(false);
|
|
3175
|
+
toggleFullscreen() {
|
|
3176
|
+
this.fullScreenImage.update((value) => !value);
|
|
3177
|
+
}
|
|
3178
|
+
zoomOut() {
|
|
3179
|
+
const currentZoom = this.zoom();
|
|
3180
|
+
const newZoom = Math.max(this.MIN_ZOOM, currentZoom - this.ZOOM_STEP);
|
|
3181
|
+
this.zoom.set(newZoom);
|
|
3182
|
+
this.applyZoom();
|
|
3183
|
+
}
|
|
3184
|
+
zoomIn() {
|
|
3185
|
+
const currentZoom = this.zoom();
|
|
3186
|
+
const newZoom = Math.min(this.MAX_ZOOM, currentZoom + this.ZOOM_STEP);
|
|
3187
|
+
this.zoom.set(newZoom);
|
|
3188
|
+
this.applyZoom();
|
|
3189
|
+
}
|
|
3190
|
+
resetZoom() {
|
|
3191
|
+
this.zoom.set(1);
|
|
3192
|
+
this.applyZoom();
|
|
3193
|
+
}
|
|
3194
|
+
applyZoom() {
|
|
3195
|
+
const img = this.imgEl()?.nativeElement;
|
|
3196
|
+
if (img) {
|
|
3197
|
+
img.style.transform = `scale(${this.zoom()})`;
|
|
3198
|
+
}
|
|
3199
|
+
}
|
|
3200
|
+
close() {
|
|
3201
|
+
if (!this.overlayRef)
|
|
3202
|
+
return;
|
|
3203
|
+
this.overlayRef.dispose();
|
|
3204
|
+
}
|
|
3205
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: ImagePreviewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3206
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.15", type: ImagePreviewComponent, isStandalone: true, selector: "s4y-image-preview", viewQueries: [{ propertyName: "imgEl", first: true, predicate: ["imgEl"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"s4y-image-preview-container\">\r\n <div class=\"s4y-preview-controls\">\r\n <div class=\"flex gap-1 align-center\">\r\n <button\r\n class=\"btn-close s4y-action-btn gray-4\"\r\n type=\"button\"\r\n (click)=\"close()\"\r\n >\r\n \u2715\r\n </button>\r\n @if (name) {\r\n <p class=\"medium-text-regular fw-400\" style=\"color: var(--gray-400)\">\r\n {{ name }}\r\n </p>\r\n }\r\n </div>\r\n\r\n <div class=\"flex gap-2\">\r\n <button class=\"s4y-action-btn\" type=\"button\" (click)=\"zoomOut()\">\r\n <ng-container [ngTemplateOutlet]=\"zoomOutSvg\" />\r\n </button>\r\n <button class=\"s4y-action-btn\" type=\"button\" (click)=\"zoomIn()\">\r\n <ng-container [ngTemplateOutlet]=\"zoomInSvg\" />\r\n </button>\r\n <button class=\"s4y-action-btn\" type=\"button\" (click)=\"resetZoom()\">\r\n <ng-container [ngTemplateOutlet]=\"refreshSvg\" />\r\n </button>\r\n\r\n <button class=\"s4y-action-btn\" type=\"button\" (click)=\"toggleFullscreen()\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"\r\n fullScreenImage() ? fullScreenExitSvg : fullscreenSvg\r\n \"\r\n />\r\n </button>\r\n </div>\r\n </div>\r\n\r\n <div class=\"s4y-preview-img-container\">\r\n <div class=\"s4y-img-preview\" [class.full-screen-img]=\"fullScreenImage()\">\r\n <img\r\n #imgEl\r\n style=\"transform-origin: center center\"\r\n [src]=\"src\"\r\n alt=\"Imagem\"\r\n (dblclick)=\"resetZoom()\"\r\n />\r\n </div>\r\n\r\n <div class=\"s4y-preview-clickable\" (click)=\"close()\"></div>\r\n </div>\r\n</div>\r\n\r\n<!-- SVG -->\r\n\r\n<ng-template #fullscreenSvg>\r\n <svg\r\n width=\"24px\"\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=\"M8 3V5H4V9H2V3H8ZM2 21V15H4V19H8V21H2ZM22 21H16V19H20V15H22V21ZM22 9H20V5H16V3H22V9Z\"\r\n ></path>\r\n </svg>\r\n</ng-template>\r\n\r\n<ng-template #fullScreenExitSvg>\r\n <svg\r\n width=\"24px\"\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=\"M18 7H22V9H16V3H18V7ZM8 9H2V7H6V3H8V9ZM18 17V21H16V15H22V17H18ZM8 15V21H6V17H2V15H8Z\"\r\n ></path>\r\n </svg>\r\n</ng-template>\r\n\r\n<ng-template #zoomInSvg>\r\n <svg\r\n width=\"24px\"\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=\"M18.031 16.6168L22.3137 20.8995L20.8995 22.3137L16.6168 18.031C15.0769 19.263 13.124 20 11 20C6.032 20 2 15.968 2 11C2 6.032 6.032 2 11 2C15.968 2 20 6.032 20 11C20 13.124 19.263 15.0769 18.031 16.6168ZM16.0247 15.8748C17.2475 14.6146 18 12.8956 18 11C18 7.1325 14.8675 4 11 4C7.1325 4 4 7.1325 4 11C4 14.8675 7.1325 18 11 18C12.8956 18 14.6146 17.2475 15.8748 16.0247L16.0247 15.8748ZM10 10V7H12V10H15V12H12V15H10V12H7V10H10Z\"\r\n ></path>\r\n </svg>\r\n</ng-template>\r\n<ng-template #zoomOutSvg>\r\n <svg\r\n width=\"24px\"\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=\"M18.031 16.6168L22.3137 20.8995L20.8995 22.3137L16.6168 18.031C15.0769 19.263 13.124 20 11 20C6.032 20 2 15.968 2 11C2 6.032 6.032 2 11 2C15.968 2 20 6.032 20 11C20 13.124 19.263 15.0769 18.031 16.6168ZM16.0247 15.8748C17.2475 14.6146 18 12.8956 18 11C18 7.1325 14.8675 4 11 4C7.1325 4 4 7.1325 4 11C4 14.8675 7.1325 18 11 18C12.8956 18 14.6146 17.2475 15.8748 16.0247L16.0247 15.8748ZM7 10H15V12H7V10Z\"\r\n ></path>\r\n </svg>\r\n</ng-template>\r\n\r\n<ng-template #refreshSvg>\r\n <svg\r\n width=\"24px\"\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=\"M5.46257 4.43262C7.21556 2.91688 9.5007 2 12 2C17.5228 2 22 6.47715 22 12C22 14.1361 21.3302 16.1158 20.1892 17.7406L17 12H20C20 7.58172 16.4183 4 12 4C9.84982 4 7.89777 4.84827 6.46023 6.22842L5.46257 4.43262ZM18.5374 19.5674C16.7844 21.0831 14.4993 22 12 22C6.47715 22 2 17.5228 2 12C2 9.86386 2.66979 7.88416 3.8108 6.25944L7 12H4C4 16.4183 7.58172 20 12 20C14.1502 20 16.1022 19.1517 17.5398 17.7716L18.5374 19.5674Z\"\r\n ></path>\r\n </svg>\r\n</ng-template>\r\n", styles: [".s4y-image-preview-container{width:100%;display:flex;flex-direction:column;gap:1.2rem;min-height:100dvh}.s4y-image-preview-container .s4y-action-btn{border-radius:50%;height:3rem;width:3rem}.s4y-image-preview-container .s4y-action-btn:hover{transition:.2s ease;background-color:var(--gray-700)}.s4y-image-preview-container .s4y-preview-controls{position:sticky;top:0;z-index:10;display:flex;justify-content:space-between;backdrop-filter:blur(6px);background:color-mix(in oklab,#000 45%,transparent);margin-bottom:.5rem;align-items:center;height:5rem;flex-shrink:0;padding:0 1.8rem}.s4y-image-preview-container .s4y-preview-controls button{line-height:0;color:#fff}.s4y-image-preview-container .s4y-preview-controls .btn-close{font-size:2rem;transition:.2s ease}.s4y-image-preview-container .s4y-preview-img-container{flex-grow:1;z-index:3;position:relative;display:flex;align-items:center;padding-bottom:1.2rem}.s4y-image-preview-container .s4y-img-preview{margin:0 auto;display:flex;align-items:center;justify-content:center;z-index:2;width:90%;max-width:70rem;transition:.5s ease}.s4y-image-preview-container .s4y-img-preview img{height:auto;border-radius:var(--radius);width:100%;transition:.5s ease}.s4y-image-preview-container .s4y-img-preview.full-screen-img{max-width:100%;height:auto}.s4y-image-preview-container .s4y-preview-clickable{position:absolute;left:0;top:0;width:100%;height:100%;z-index:1}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], encapsulation: i0.ViewEncapsulation.None });
|
|
3207
|
+
}
|
|
3208
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: ImagePreviewComponent, decorators: [{
|
|
3209
|
+
type: Component,
|
|
3210
|
+
args: [{ selector: 's4y-image-preview', imports: [NgTemplateOutlet], encapsulation: ViewEncapsulation.None, template: "<div class=\"s4y-image-preview-container\">\r\n <div class=\"s4y-preview-controls\">\r\n <div class=\"flex gap-1 align-center\">\r\n <button\r\n class=\"btn-close s4y-action-btn gray-4\"\r\n type=\"button\"\r\n (click)=\"close()\"\r\n >\r\n \u2715\r\n </button>\r\n @if (name) {\r\n <p class=\"medium-text-regular fw-400\" style=\"color: var(--gray-400)\">\r\n {{ name }}\r\n </p>\r\n }\r\n </div>\r\n\r\n <div class=\"flex gap-2\">\r\n <button class=\"s4y-action-btn\" type=\"button\" (click)=\"zoomOut()\">\r\n <ng-container [ngTemplateOutlet]=\"zoomOutSvg\" />\r\n </button>\r\n <button class=\"s4y-action-btn\" type=\"button\" (click)=\"zoomIn()\">\r\n <ng-container [ngTemplateOutlet]=\"zoomInSvg\" />\r\n </button>\r\n <button class=\"s4y-action-btn\" type=\"button\" (click)=\"resetZoom()\">\r\n <ng-container [ngTemplateOutlet]=\"refreshSvg\" />\r\n </button>\r\n\r\n <button class=\"s4y-action-btn\" type=\"button\" (click)=\"toggleFullscreen()\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"\r\n fullScreenImage() ? fullScreenExitSvg : fullscreenSvg\r\n \"\r\n />\r\n </button>\r\n </div>\r\n </div>\r\n\r\n <div class=\"s4y-preview-img-container\">\r\n <div class=\"s4y-img-preview\" [class.full-screen-img]=\"fullScreenImage()\">\r\n <img\r\n #imgEl\r\n style=\"transform-origin: center center\"\r\n [src]=\"src\"\r\n alt=\"Imagem\"\r\n (dblclick)=\"resetZoom()\"\r\n />\r\n </div>\r\n\r\n <div class=\"s4y-preview-clickable\" (click)=\"close()\"></div>\r\n </div>\r\n</div>\r\n\r\n<!-- SVG -->\r\n\r\n<ng-template #fullscreenSvg>\r\n <svg\r\n width=\"24px\"\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=\"M8 3V5H4V9H2V3H8ZM2 21V15H4V19H8V21H2ZM22 21H16V19H20V15H22V21ZM22 9H20V5H16V3H22V9Z\"\r\n ></path>\r\n </svg>\r\n</ng-template>\r\n\r\n<ng-template #fullScreenExitSvg>\r\n <svg\r\n width=\"24px\"\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=\"M18 7H22V9H16V3H18V7ZM8 9H2V7H6V3H8V9ZM18 17V21H16V15H22V17H18ZM8 15V21H6V17H2V15H8Z\"\r\n ></path>\r\n </svg>\r\n</ng-template>\r\n\r\n<ng-template #zoomInSvg>\r\n <svg\r\n width=\"24px\"\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=\"M18.031 16.6168L22.3137 20.8995L20.8995 22.3137L16.6168 18.031C15.0769 19.263 13.124 20 11 20C6.032 20 2 15.968 2 11C2 6.032 6.032 2 11 2C15.968 2 20 6.032 20 11C20 13.124 19.263 15.0769 18.031 16.6168ZM16.0247 15.8748C17.2475 14.6146 18 12.8956 18 11C18 7.1325 14.8675 4 11 4C7.1325 4 4 7.1325 4 11C4 14.8675 7.1325 18 11 18C12.8956 18 14.6146 17.2475 15.8748 16.0247L16.0247 15.8748ZM10 10V7H12V10H15V12H12V15H10V12H7V10H10Z\"\r\n ></path>\r\n </svg>\r\n</ng-template>\r\n<ng-template #zoomOutSvg>\r\n <svg\r\n width=\"24px\"\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=\"M18.031 16.6168L22.3137 20.8995L20.8995 22.3137L16.6168 18.031C15.0769 19.263 13.124 20 11 20C6.032 20 2 15.968 2 11C2 6.032 6.032 2 11 2C15.968 2 20 6.032 20 11C20 13.124 19.263 15.0769 18.031 16.6168ZM16.0247 15.8748C17.2475 14.6146 18 12.8956 18 11C18 7.1325 14.8675 4 11 4C7.1325 4 4 7.1325 4 11C4 14.8675 7.1325 18 11 18C12.8956 18 14.6146 17.2475 15.8748 16.0247L16.0247 15.8748ZM7 10H15V12H7V10Z\"\r\n ></path>\r\n </svg>\r\n</ng-template>\r\n\r\n<ng-template #refreshSvg>\r\n <svg\r\n width=\"24px\"\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=\"M5.46257 4.43262C7.21556 2.91688 9.5007 2 12 2C17.5228 2 22 6.47715 22 12C22 14.1361 21.3302 16.1158 20.1892 17.7406L17 12H20C20 7.58172 16.4183 4 12 4C9.84982 4 7.89777 4.84827 6.46023 6.22842L5.46257 4.43262ZM18.5374 19.5674C16.7844 21.0831 14.4993 22 12 22C6.47715 22 2 17.5228 2 12C2 9.86386 2.66979 7.88416 3.8108 6.25944L7 12H4C4 16.4183 7.58172 20 12 20C14.1502 20 16.1022 19.1517 17.5398 17.7716L18.5374 19.5674Z\"\r\n ></path>\r\n </svg>\r\n</ng-template>\r\n", styles: [".s4y-image-preview-container{width:100%;display:flex;flex-direction:column;gap:1.2rem;min-height:100dvh}.s4y-image-preview-container .s4y-action-btn{border-radius:50%;height:3rem;width:3rem}.s4y-image-preview-container .s4y-action-btn:hover{transition:.2s ease;background-color:var(--gray-700)}.s4y-image-preview-container .s4y-preview-controls{position:sticky;top:0;z-index:10;display:flex;justify-content:space-between;backdrop-filter:blur(6px);background:color-mix(in oklab,#000 45%,transparent);margin-bottom:.5rem;align-items:center;height:5rem;flex-shrink:0;padding:0 1.8rem}.s4y-image-preview-container .s4y-preview-controls button{line-height:0;color:#fff}.s4y-image-preview-container .s4y-preview-controls .btn-close{font-size:2rem;transition:.2s ease}.s4y-image-preview-container .s4y-preview-img-container{flex-grow:1;z-index:3;position:relative;display:flex;align-items:center;padding-bottom:1.2rem}.s4y-image-preview-container .s4y-img-preview{margin:0 auto;display:flex;align-items:center;justify-content:center;z-index:2;width:90%;max-width:70rem;transition:.5s ease}.s4y-image-preview-container .s4y-img-preview img{height:auto;border-radius:var(--radius);width:100%;transition:.5s ease}.s4y-image-preview-container .s4y-img-preview.full-screen-img{max-width:100%;height:auto}.s4y-image-preview-container .s4y-preview-clickable{position:absolute;left:0;top:0;width:100%;height:100%;z-index:1}\n"] }]
|
|
3211
|
+
}] });
|
|
3212
|
+
|
|
3213
|
+
class ImageService {
|
|
3214
|
+
_overlay = inject(Overlay);
|
|
3215
|
+
_overlayRef;
|
|
3216
|
+
open(fileSrc, fileName) {
|
|
3217
|
+
const portal = this.createPortal();
|
|
3218
|
+
this._overlayRef = this.createOverlay();
|
|
3219
|
+
const componentRef = this._overlayRef.attach(portal);
|
|
3220
|
+
componentRef.instance.src = fileSrc;
|
|
3221
|
+
componentRef.instance.name = fileName;
|
|
3222
|
+
componentRef.instance.overlayRef = this._overlayRef;
|
|
3223
|
+
let sub = this._overlayRef.backdropClick().subscribe((_) => {
|
|
3224
|
+
sub.unsubscribe();
|
|
3225
|
+
this.close();
|
|
3226
|
+
});
|
|
3227
|
+
let sub2 = this._overlayRef
|
|
3228
|
+
.keydownEvents()
|
|
3229
|
+
.pipe(filter$1((key) => key.code === 'Escape'))
|
|
3230
|
+
.subscribe((_) => {
|
|
3231
|
+
sub2.unsubscribe();
|
|
3232
|
+
this.close();
|
|
3233
|
+
});
|
|
3234
|
+
return this._overlayRef;
|
|
3235
|
+
}
|
|
3236
|
+
close() {
|
|
3237
|
+
this._overlayRef.dispose();
|
|
3238
|
+
}
|
|
3239
|
+
createOverlay() {
|
|
3240
|
+
const overlay = this._overlay.create({
|
|
3241
|
+
hasBackdrop: true,
|
|
3242
|
+
backdropClass: ['s4y-overlay-bg'],
|
|
3243
|
+
scrollStrategy: this._overlay.scrollStrategies.block(),
|
|
3244
|
+
panelClass: ['s4y-preview-pane'],
|
|
3245
|
+
disposeOnNavigation: true,
|
|
3246
|
+
});
|
|
3247
|
+
overlay.backdropClick().subscribe(() => overlay.dispose());
|
|
3248
|
+
return overlay;
|
|
3249
|
+
}
|
|
3250
|
+
createPortal() {
|
|
3251
|
+
return new ComponentPortal(ImagePreviewComponent);
|
|
3252
|
+
}
|
|
3253
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: ImageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3254
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: ImageService, providedIn: 'root' });
|
|
3255
|
+
}
|
|
3256
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: ImageService, decorators: [{
|
|
3257
|
+
type: Injectable,
|
|
3258
|
+
args: [{
|
|
3259
|
+
providedIn: 'root',
|
|
3260
|
+
}]
|
|
3261
|
+
}] });
|
|
3262
|
+
|
|
3263
|
+
class ImageComponent {
|
|
3264
|
+
imageService = inject(ImageService);
|
|
3265
|
+
elRef = inject(ElementRef);
|
|
3266
|
+
renderer = inject(Renderer2);
|
|
3267
|
+
destroy = inject(DestroyRef);
|
|
3268
|
+
constructor() { }
|
|
3269
|
+
src = input('', {
|
|
3270
|
+
alias: 's4ySrc',
|
|
3271
|
+
});
|
|
3272
|
+
innerTpl = input();
|
|
3273
|
+
fileName = input();
|
|
3274
|
+
disablePreview = input(false);
|
|
3275
|
+
withOverlay = input(false);
|
|
3276
|
+
wrapper;
|
|
3277
|
+
overlayEl;
|
|
3278
|
+
ngOnInit() {
|
|
3279
|
+
this.configureWrapperElement();
|
|
3280
|
+
this.configureOverlay();
|
|
3281
|
+
this.configureEyeSvg();
|
|
3282
|
+
this.configureImageSrc();
|
|
3283
|
+
}
|
|
3284
|
+
ngAfterViewInit() {
|
|
3285
|
+
this.onShowOverlay();
|
|
3286
|
+
}
|
|
3287
|
+
configureWrapperElement() {
|
|
3288
|
+
const img = this.ImageEl;
|
|
3289
|
+
if (!img)
|
|
3290
|
+
return;
|
|
3291
|
+
const parent = img.parentNode;
|
|
3292
|
+
this.wrapper = this.createElement('span');
|
|
3293
|
+
this.addClass(this.wrapper, 's4y-img-wrapper');
|
|
3294
|
+
this.renderer.setStyle(this.wrapper, 'position', 'relative');
|
|
3295
|
+
this.renderer.setStyle(this.wrapper, 'display', 'inline-block');
|
|
3296
|
+
this.renderer.insertBefore(parent, this.wrapper, img);
|
|
3297
|
+
this.renderer.removeChild(parent, img);
|
|
3298
|
+
this.renderer.appendChild(this.wrapper, img);
|
|
3299
|
+
const click$ = fromEvent(this.wrapper, 'click');
|
|
3300
|
+
click$.pipe(takeUntilDestroyed(this.destroy)).subscribe(() => {
|
|
3301
|
+
this.showPreview();
|
|
3302
|
+
});
|
|
3303
|
+
}
|
|
3304
|
+
configureOverlay() {
|
|
3305
|
+
if (this.withOverlay()) {
|
|
3306
|
+
this.overlayEl = this.createElement('div');
|
|
3307
|
+
this.renderer.addClass(this.overlayEl, 's4y-img-overlay');
|
|
3308
|
+
this.renderer.appendChild(this.wrapper, this.overlayEl);
|
|
3309
|
+
}
|
|
3310
|
+
}
|
|
3311
|
+
configureEyeSvg() {
|
|
3312
|
+
const overlay = this.overlayEl;
|
|
3313
|
+
if (!overlay)
|
|
3314
|
+
return;
|
|
3315
|
+
const svgContainer = this.createElement('span');
|
|
3316
|
+
svgContainer.innerHTML = this.eyeSvg;
|
|
3317
|
+
this.renderer.appendChild(overlay, svgContainer);
|
|
3318
|
+
}
|
|
3319
|
+
configureImageSrc() {
|
|
3320
|
+
const imgEl = this.ImageEl;
|
|
3321
|
+
const src = this.src();
|
|
3322
|
+
if (!imgEl || !src)
|
|
3323
|
+
return;
|
|
3324
|
+
this.renderer.setAttribute(imgEl, 'src', src);
|
|
3325
|
+
}
|
|
3326
|
+
onShowOverlay() {
|
|
3327
|
+
const wrapper = this.wrapper;
|
|
3328
|
+
const overlay = this.overlayEl;
|
|
3329
|
+
if (!wrapper || !this.withOverlay() || !overlay)
|
|
3330
|
+
return;
|
|
3331
|
+
const wrapperMouseOver$ = fromEvent(this.wrapper, 'mouseover');
|
|
3332
|
+
const wrapperMouseLeave$ = fromEvent(this.wrapper, 'mouseleave');
|
|
3333
|
+
wrapperMouseOver$.pipe(takeUntilDestroyed(this.destroy)).subscribe((x) => {
|
|
3334
|
+
this.addClass(overlay, 'active');
|
|
3335
|
+
});
|
|
3336
|
+
wrapperMouseLeave$.pipe(takeUntilDestroyed(this.destroy)).subscribe((x) => {
|
|
3337
|
+
this.removeClass(overlay, 'active');
|
|
3338
|
+
});
|
|
3339
|
+
}
|
|
3340
|
+
createElement(element) {
|
|
3341
|
+
return this.renderer.createElement(element);
|
|
3342
|
+
}
|
|
3343
|
+
addClass(el, className) {
|
|
3344
|
+
return this.renderer.addClass(el, className);
|
|
3345
|
+
}
|
|
3346
|
+
removeClass(el, className) {
|
|
3347
|
+
return this.renderer.removeClass(el, className);
|
|
3348
|
+
}
|
|
3349
|
+
showPreview() {
|
|
3350
|
+
this.imageService.open(this.src(), this.fileName());
|
|
3351
|
+
}
|
|
3352
|
+
get eyeSvg() {
|
|
3353
|
+
return `<svg width="24px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#fff"><path d="M12.0003 3C17.3924 3 21.8784 6.87976 22.8189 12C21.8784 17.1202 17.3924 21 12.0003 21C6.60812 21 2.12215 17.1202 1.18164 12C2.12215 6.87976 6.60812 3 12.0003 3ZM12.0003 19C16.2359 19 19.8603 16.052 20.7777 12C19.8603 7.94803 16.2359 5 12.0003 5C7.7646 5 4.14022 7.94803 3.22278 12C4.14022 16.052 7.7646 19 12.0003 19ZM12.0003 16.5C9.51498 16.5 7.50026 14.4853 7.50026 12C7.50026 9.51472 9.51498 7.5 12.0003 7.5C14.4855 7.5 16.5003 9.51472 16.5003 12C16.5003 14.4853 14.4855 16.5 12.0003 16.5ZM12.0003 14.5C13.381 14.5 14.5003 13.3807 14.5003 12C14.5003 10.6193 13.381 9.5 12.0003 9.5C10.6196 9.5 9.50026 10.6193 9.50026 12C9.50026 13.3807 10.6196 14.5 12.0003 14.5Z"></path></svg>`;
|
|
3354
|
+
}
|
|
3355
|
+
get ImageEl() {
|
|
3356
|
+
return this.elRef.nativeElement;
|
|
3357
|
+
}
|
|
3358
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: ImageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3359
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.15", type: ImageComponent, isStandalone: true, selector: "img[s4yImage]", inputs: { src: { classPropertyName: "src", publicName: "s4ySrc", isSignal: true, isRequired: false, transformFunction: null }, innerTpl: { classPropertyName: "innerTpl", publicName: "innerTpl", isSignal: true, isRequired: false, transformFunction: null }, fileName: { classPropertyName: "fileName", publicName: "fileName", isSignal: true, isRequired: false, transformFunction: null }, disablePreview: { classPropertyName: "disablePreview", publicName: "disablePreview", isSignal: true, isRequired: false, transformFunction: null }, withOverlay: { classPropertyName: "withOverlay", publicName: "withOverlay", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `<ng-content />`, isInline: true, styles: [".s4y-img-overlay.active{opacity:1}.s4y-eye-overlay{color:#fff}.s4y-img-overlay{background-color:#0009;cursor:pointer;width:100%;height:100%;position:absolute;top:0;left:0;transition:.3s ease;opacity:0;display:flex;align-items:center;justify-content:center}\n"], encapsulation: i0.ViewEncapsulation.None });
|
|
3360
|
+
}
|
|
3361
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: ImageComponent, decorators: [{
|
|
3362
|
+
type: Component,
|
|
3363
|
+
args: [{ selector: 'img[s4yImage]', template: `<ng-content />`, encapsulation: ViewEncapsulation.None, styles: [".s4y-img-overlay.active{opacity:1}.s4y-eye-overlay{color:#fff}.s4y-img-overlay{background-color:#0009;cursor:pointer;width:100%;height:100%;position:absolute;top:0;left:0;transition:.3s ease;opacity:0;display:flex;align-items:center;justify-content:center}\n"] }]
|
|
3364
|
+
}], ctorParameters: () => [] });
|
|
3365
|
+
|
|
3158
3366
|
const selectMultiAnim = trigger('selectMultiAnim', [
|
|
3159
3367
|
// entra
|
|
3160
3368
|
transition(':enter', [
|
|
@@ -3351,6 +3559,25 @@ async function toMaybeBooleanPromise(value) {
|
|
|
3351
3559
|
return await firstValueFrom(value);
|
|
3352
3560
|
return value;
|
|
3353
3561
|
}
|
|
3562
|
+
async function toHandlerResult(ret) {
|
|
3563
|
+
if (ret instanceof Promise)
|
|
3564
|
+
return await ret;
|
|
3565
|
+
if (ret instanceof EventEmitter)
|
|
3566
|
+
return await firstValueFrom(ret);
|
|
3567
|
+
if (isObservable(ret))
|
|
3568
|
+
return await firstValueFrom(ret);
|
|
3569
|
+
return ret;
|
|
3570
|
+
}
|
|
3571
|
+
async function allow(canDismiss, reason) {
|
|
3572
|
+
if (!canDismiss)
|
|
3573
|
+
return true;
|
|
3574
|
+
try {
|
|
3575
|
+
return await Promise.resolve(canDismiss(reason));
|
|
3576
|
+
}
|
|
3577
|
+
catch {
|
|
3578
|
+
return false;
|
|
3579
|
+
}
|
|
3580
|
+
}
|
|
3354
3581
|
|
|
3355
3582
|
class DynamicDialogRef {
|
|
3356
3583
|
overlayRef;
|
|
@@ -3363,6 +3590,9 @@ class DynamicDialogRef {
|
|
|
3363
3590
|
_afterClosed = new Subject();
|
|
3364
3591
|
panelEl;
|
|
3365
3592
|
isClosing = false;
|
|
3593
|
+
_container;
|
|
3594
|
+
_opts;
|
|
3595
|
+
_contentComponentRef;
|
|
3366
3596
|
constructor(overlayRef) {
|
|
3367
3597
|
this.overlayRef = overlayRef;
|
|
3368
3598
|
this.afterOpened$ = this._afterOpened.asObservable();
|
|
@@ -3445,6 +3675,72 @@ class DynamicDialogRef {
|
|
|
3445
3675
|
}
|
|
3446
3676
|
this.overlayRef.dispose();
|
|
3447
3677
|
}
|
|
3678
|
+
_attachContentComponent(componentRef) {
|
|
3679
|
+
this._contentComponentRef = componentRef;
|
|
3680
|
+
}
|
|
3681
|
+
getComponent() {
|
|
3682
|
+
return this._contentComponentRef?.instance;
|
|
3683
|
+
}
|
|
3684
|
+
hasComponent() {
|
|
3685
|
+
return !!this._contentComponentRef;
|
|
3686
|
+
}
|
|
3687
|
+
_attachForButtonUpdates(container, opts) {
|
|
3688
|
+
this._container = container;
|
|
3689
|
+
this._opts = opts;
|
|
3690
|
+
// garantir objetos
|
|
3691
|
+
this._opts.okBtnOptions ??= {};
|
|
3692
|
+
this._opts.cancelBtnOptions ??= {};
|
|
3693
|
+
}
|
|
3694
|
+
updateButtons(patch) {
|
|
3695
|
+
if (!this._opts)
|
|
3696
|
+
return;
|
|
3697
|
+
if (patch.ok)
|
|
3698
|
+
Object.assign(this._opts.okBtnOptions, patch.ok);
|
|
3699
|
+
if (patch.cancel)
|
|
3700
|
+
Object.assign(this._opts.cancelBtnOptions, patch.cancel);
|
|
3701
|
+
this._markForCheck();
|
|
3702
|
+
}
|
|
3703
|
+
// OK
|
|
3704
|
+
setOkLoading(state) {
|
|
3705
|
+
this._ensureBtn('ok').loading = state;
|
|
3706
|
+
// se você usa okLoading interno como overlay, mantenha em sincronia:
|
|
3707
|
+
this._container.okLoading = !!state;
|
|
3708
|
+
this._markForCheck();
|
|
3709
|
+
}
|
|
3710
|
+
setOkDisabled(state) {
|
|
3711
|
+
this._ensureBtn('ok').disabled = state;
|
|
3712
|
+
this._markForCheck();
|
|
3713
|
+
}
|
|
3714
|
+
setOkText(text) {
|
|
3715
|
+
this._ensureBtn('ok').text = text;
|
|
3716
|
+
this._markForCheck();
|
|
3717
|
+
}
|
|
3718
|
+
// Cancel
|
|
3719
|
+
setCancelLoading(state) {
|
|
3720
|
+
this._ensureBtn('cancel').loading = state;
|
|
3721
|
+
this._container.cancelLoading = !!state;
|
|
3722
|
+
this._markForCheck();
|
|
3723
|
+
}
|
|
3724
|
+
setCancelDisabled(state) {
|
|
3725
|
+
this._ensureBtn('cancel').disabled = state;
|
|
3726
|
+
this._markForCheck();
|
|
3727
|
+
}
|
|
3728
|
+
setCancelText(text) {
|
|
3729
|
+
this._ensureBtn('cancel').text = text;
|
|
3730
|
+
this._markForCheck();
|
|
3731
|
+
}
|
|
3732
|
+
_ensureBtn(which) {
|
|
3733
|
+
if (!this._opts)
|
|
3734
|
+
throw new Error('Dialog options not attached.');
|
|
3735
|
+
const key = which === 'ok' ? 'okBtnOptions' : 'cancelBtnOptions';
|
|
3736
|
+
this._opts[key] ??= {};
|
|
3737
|
+
return this._opts[key];
|
|
3738
|
+
}
|
|
3739
|
+
_markForCheck() {
|
|
3740
|
+
const cdr = this._container?.cdr;
|
|
3741
|
+
if (cdr?.markForCheck)
|
|
3742
|
+
cdr.markForCheck();
|
|
3743
|
+
}
|
|
3448
3744
|
}
|
|
3449
3745
|
|
|
3450
3746
|
class DynamicDialogComponent {
|
|
@@ -3460,10 +3756,17 @@ class DynamicDialogComponent {
|
|
|
3460
3756
|
footerTemplate;
|
|
3461
3757
|
contentTemplate;
|
|
3462
3758
|
templateContext;
|
|
3759
|
+
portalOutlet;
|
|
3463
3760
|
constructor(ref, dialogOptions) {
|
|
3464
3761
|
this.ref = ref;
|
|
3465
3762
|
this.dialogOptions = dialogOptions;
|
|
3466
3763
|
}
|
|
3764
|
+
ngAfterViewInit() {
|
|
3765
|
+
if (this.portalOutlet?.attachedRef) {
|
|
3766
|
+
console.log();
|
|
3767
|
+
this.ref._attachContentComponent(this.portalOutlet.attachedRef);
|
|
3768
|
+
}
|
|
3769
|
+
}
|
|
3467
3770
|
get data() {
|
|
3468
3771
|
return this.injectedData;
|
|
3469
3772
|
}
|
|
@@ -3472,10 +3775,16 @@ class DynamicDialogComponent {
|
|
|
3472
3775
|
return;
|
|
3473
3776
|
this.okLoading = true;
|
|
3474
3777
|
try {
|
|
3475
|
-
const
|
|
3476
|
-
|
|
3778
|
+
const component = this.ref.getComponent();
|
|
3779
|
+
const out = await toHandlerResult(this.dialogOptions?.onOk?.({
|
|
3780
|
+
data: this.injectedData,
|
|
3781
|
+
ref: this.ref,
|
|
3782
|
+
component,
|
|
3783
|
+
}));
|
|
3784
|
+
if (out === false)
|
|
3477
3785
|
return;
|
|
3478
|
-
|
|
3786
|
+
const result = out === true || typeof out === 'undefined' ? undefined : out;
|
|
3787
|
+
await this.ref.closeAnimated(result, 'ok');
|
|
3479
3788
|
}
|
|
3480
3789
|
finally {
|
|
3481
3790
|
this.okLoading = false;
|
|
@@ -3485,22 +3794,25 @@ class DynamicDialogComponent {
|
|
|
3485
3794
|
async onCancel() {
|
|
3486
3795
|
if (this.cancelLoading)
|
|
3487
3796
|
return;
|
|
3488
|
-
this.cancelLoading = true;
|
|
3797
|
+
// this.cancelLoading = true;
|
|
3489
3798
|
try {
|
|
3490
|
-
const
|
|
3799
|
+
const component = this.ref.getComponent();
|
|
3800
|
+
const out = await toHandlerResult(this.dialogOptions?.onCancel?.({
|
|
3491
3801
|
data: this.injectedData,
|
|
3492
3802
|
ref: this.ref,
|
|
3803
|
+
component,
|
|
3493
3804
|
}));
|
|
3494
|
-
if (
|
|
3495
|
-
return;
|
|
3496
|
-
|
|
3805
|
+
if (out === false)
|
|
3806
|
+
return; // NÃO fecha
|
|
3807
|
+
const result = out === true || typeof out === 'undefined' ? undefined : out;
|
|
3808
|
+
await this.ref.closeAnimated(result, 'cancel');
|
|
3497
3809
|
}
|
|
3498
3810
|
finally {
|
|
3499
3811
|
this.cancelLoading = false;
|
|
3500
3812
|
}
|
|
3501
3813
|
}
|
|
3502
3814
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: DynamicDialogComponent, deps: [{ token: DynamicDialogRef }, { token: DYNAMIC_DIALOG_OPTIONS }], target: i0.ɵɵFactoryTarget.Component });
|
|
3503
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.15", type: DynamicDialogComponent, isStandalone: true, selector: "s4y-dynamic-dialog", inputs: { contentPortal: "contentPortal", headerTemplate: "headerTemplate", footerTemplate: "footerTemplate", contentTemplate: "contentTemplate", templateContext: "templateContext" }, host: { attributes: { "role": "dialog", "aria-modal": "true", "tabindex": "-1" }, properties: { "attr.aria-labelledby": "'s4y-dialog-title'" }, classAttribute: "s4y-dialog" }, ngImport: i0, template: "<article class=\"s4y-dialog\" role=\"dialog\" aria-modal=\"true\">\r\n @if (headerTemplate) {\r\n <header\r\n class=\"s4y-dialog-header\"\r\n [class.s4y-centered-header]=\"dialogOptions?.centeredHeader\"\r\n [ngStyle]=\"dialogOptions?.headerStyle\"\r\n >\r\n <ng-container\r\n [ngTemplateOutlet]=\"headerTemplate\"\r\n [ngTemplateOutletContext]=\"templateContext\"\r\n >\r\n </ng-container>\r\n </header>\r\n } @else if (dialogOptions?.title || dialogOptions?.description) {\r\n <header\r\n class=\"s4y-dialog-header\"\r\n [class.s4y-centered-header]=\"dialogOptions?.centeredHeader\"\r\n [ngStyle]=\"dialogOptions?.headerStyle\"\r\n >\r\n <h2 class=\"s4y-dialog-header__title\">{{ dialogOptions?.title }}</h2>\r\n <p class=\"s4y-dialog-header__description\">\r\n {{ dialogOptions?.description }}\r\n </p>\r\n </header>\r\n }\r\n\r\n @if (dialogOptions?.closable || dialogOptions?.closable == undefined) {\r\n <button class=\"s4y-dialog-close-btn\" (click)=\"ref.closeAnimated(undefined, 'close')\" aria-label=\"Fechar\">\r\n ×\r\n </button>\r\n }\r\n\r\n <section class=\"s4y-dialog__body\" [ngStyle]=\"dialogOptions?.bodyStyle\">\r\n @if (contentTemplate) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"contentTemplate\"\r\n [ngTemplateOutletContext]=\"templateContext\"\r\n >\r\n </ng-container>\r\n } @else {\r\n <ng-template\r\n cdkPortalOutlet\r\n [cdkPortalOutlet]=\"contentPortal\"\r\n ></ng-template>\r\n }\r\n </section>\r\n\r\n @let cancelBtnOptions = this.dialogOptions?.cancelBtnOptions;\r\n @let okBtnOptions = this.dialogOptions?.okBtnOptions;\r\n\r\n @if (!(dialogOptions?.hideFooter ?? false)) {\r\n <footer\r\n class=\"flex gap-1 s4y-dialog__footer\"\r\n [ngStyle]=\"dialogOptions?.footerStyle\"\r\n >\r\n @if (footerTemplate) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"footerTemplate\"\r\n [ngTemplateOutletContext]=\"templateContext\"\r\n >\r\n </ng-container>\r\n } @else {\r\n @if (cancelBtnOptions?.text) {\r\n <button\r\n (click)=\"onCancel()\"\r\n [loading]=\"cancelLoading || (cancelBtnOptions?.loading ?? false)\"\r\n [fullWidth]=\"cancelBtnOptions?.fullWidth ?? false\"\r\n s4yButton\r\n [variant]=\"cancelBtnOptions?.variant ?? 'gray'\"\r\n [outlined]=\"cancelBtnOptions?.outlined ?? true\"\r\n [disabled]=\"cancelBtnOptions?.disabled ?? false\"\r\n [size]=\"cancelBtnOptions?.size ?? 'small'\"\r\n >\r\n {{ cancelBtnOptions?.text ?? \"Cancelar\" }}\r\n </button>\r\n }\r\n @if (okBtnOptions?.text) {\r\n <button\r\n (click)=\"onOk()\"\r\n [loading]=\"okLoading || (okBtnOptions?.loading ?? false)\"\r\n [fullWidth]=\"okBtnOptions?.fullWidth ?? false\"\r\n s4yButton\r\n [variant]=\"okBtnOptions?.variant ?? 'primary'\"\r\n [outlined]=\"okBtnOptions?.outlined ?? false\"\r\n [disabled]=\"okBtnOptions?.disabled ?? false\"\r\n [size]=\"okBtnOptions?.size ?? 'small'\"\r\n >\r\n {{ okBtnOptions?.text ?? \"Ok\" }}\r\n </button>\r\n }\r\n }\r\n </footer>\r\n }\r\n</article>\r\n", styles: [".s4y-dialog{display:flex;flex-direction:column;max-height:90dvh;overflow:hidden;position:relative}.s4y-dialog-header{display:flex;flex-direction:column;align-items:flex-start;flex-shrink:0;padding-bottom:1.4rem;gap:.4rem}.s4y-centered-header{align-items:center}.s4y-dialog-action{display:flex;align-items:center;justify-content:space-between;width:100%}.s4y-dialog__footer{display:flex;align-items:center;justify-content:flex-end;gap:1rem;padding-top:1.4rem;flex-shrink:0}@media screen and (min-width: 320px) and (max-width: 480px){.s4y-dialog__footer{flex-direction:column-reverse}.s4y-dialog__footer button{width:100%}}.s4y-dialog-header__title{font-size:1.8rem;color:var(--primary-color)}.s4y-dialog-header__description{font-size:2rem;font-size:1.4rem;font-weight:400;color:var(--gray-700)}.s4y-dialog__body{flex:1 1 auto;min-height:0;overflow-y:auto}.s4y-dialog-close-btn{padding:0rem 1.4rem;cursor:pointer;font-size:2rem;position:absolute;right:0;top:0;transition:.5 ease}.s4y-dialog-close-btn:hover{background-color:var(--gray-200);border-radius:var(--radius)}\n"], dependencies: [{ kind: "directive", type: CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "component", type: ButtonComponent, selector: "button[s4yButton], a[s4yButton]", inputs: ["disabled", "outlined", "loading", "size", "variant", "fullWidth", "iconAligned"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], animations: [] });
|
|
3815
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.15", type: DynamicDialogComponent, isStandalone: true, selector: "s4y-dynamic-dialog", inputs: { contentPortal: "contentPortal", headerTemplate: "headerTemplate", footerTemplate: "footerTemplate", contentTemplate: "contentTemplate", templateContext: "templateContext" }, host: { attributes: { "role": "dialog", "aria-modal": "true", "tabindex": "-1" }, properties: { "attr.aria-labelledby": "'s4y-dialog-title'" }, classAttribute: "s4y-dialog" }, viewQueries: [{ propertyName: "portalOutlet", first: true, predicate: CdkPortalOutlet, descendants: true }], ngImport: i0, template: "<article class=\"s4y-dialog\" role=\"dialog\" aria-modal=\"true\">\r\n @if (headerTemplate) {\r\n <header\r\n class=\"s4y-dialog-header\"\r\n [class.s4y-centered-header]=\"dialogOptions?.centeredHeader\"\r\n [ngStyle]=\"dialogOptions?.headerStyle\"\r\n >\r\n <ng-container\r\n [ngTemplateOutlet]=\"headerTemplate\"\r\n [ngTemplateOutletContext]=\"templateContext\"\r\n >\r\n </ng-container>\r\n </header>\r\n } @else if (dialogOptions?.title || dialogOptions?.description) {\r\n <header\r\n class=\"s4y-dialog-header\"\r\n [class.s4y-centered-header]=\"dialogOptions?.centeredHeader\"\r\n [ngStyle]=\"dialogOptions?.headerStyle\"\r\n >\r\n <h2 class=\"s4y-dialog-header__title\">{{ dialogOptions?.title }}</h2>\r\n <p class=\"s4y-dialog-header__description\">\r\n {{ dialogOptions?.description }}\r\n </p>\r\n </header>\r\n }\r\n\r\n @if (dialogOptions?.closable || dialogOptions?.closable == undefined) {\r\n <button class=\"s4y-dialog-close-btn\" (click)=\"ref.closeAnimated(undefined, 'close')\" aria-label=\"Fechar\">\r\n ×\r\n </button>\r\n }\r\n\r\n <section class=\"s4y-dialog__body\" [ngStyle]=\"dialogOptions?.bodyStyle\">\r\n @if (contentTemplate) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"contentTemplate\"\r\n [ngTemplateOutletContext]=\"templateContext\"\r\n >\r\n </ng-container>\r\n } @else {\r\n <ng-template\r\n cdkPortalOutlet\r\n [cdkPortalOutlet]=\"contentPortal\"\r\n ></ng-template>\r\n }\r\n </section>\r\n\r\n @let cancelBtnOptions = this.dialogOptions?.cancelBtnOptions;\r\n @let okBtnOptions = this.dialogOptions?.okBtnOptions;\r\n\r\n @if (!(dialogOptions?.hideFooter ?? false)) {\r\n <footer\r\n class=\"flex gap-1 s4y-dialog__footer\"\r\n [ngStyle]=\"dialogOptions?.footerStyle\"\r\n >\r\n @if (footerTemplate) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"footerTemplate\"\r\n [ngTemplateOutletContext]=\"templateContext\"\r\n >\r\n </ng-container>\r\n } @else {\r\n @if (cancelBtnOptions?.text) {\r\n <button\r\n (click)=\"onCancel()\"\r\n [loading]=\"cancelLoading || (cancelBtnOptions?.loading ?? false)\"\r\n [fullWidth]=\"cancelBtnOptions?.fullWidth ?? false\"\r\n s4yButton\r\n [variant]=\"cancelBtnOptions?.variant ?? 'gray'\"\r\n [outlined]=\"cancelBtnOptions?.outlined ?? true\"\r\n [disabled]=\"cancelBtnOptions?.disabled ?? false\"\r\n [size]=\"cancelBtnOptions?.size ?? 'small'\"\r\n >\r\n {{ cancelBtnOptions?.text ?? \"Cancelar\" }}\r\n </button>\r\n }\r\n @if (okBtnOptions?.text) {\r\n <button\r\n (click)=\"onOk()\"\r\n [loading]=\"okLoading || (okBtnOptions?.loading ?? false)\"\r\n [fullWidth]=\"okBtnOptions?.fullWidth ?? false\"\r\n s4yButton\r\n [variant]=\"okBtnOptions?.variant ?? 'primary'\"\r\n [outlined]=\"okBtnOptions?.outlined ?? false\"\r\n [disabled]=\"okBtnOptions?.disabled ?? false\"\r\n [size]=\"okBtnOptions?.size ?? 'small'\"\r\n >\r\n {{ okBtnOptions?.text ?? \"Ok\" }}\r\n </button>\r\n }\r\n }\r\n </footer>\r\n }\r\n</article>\r\n", styles: [".s4y-dialog{display:flex;flex-direction:column;max-height:90dvh;overflow:hidden;position:relative}.s4y-dialog-header{display:flex;flex-direction:column;align-items:flex-start;flex-shrink:0;padding-bottom:1.4rem;gap:.4rem}.s4y-centered-header{align-items:center}.s4y-dialog-action{display:flex;align-items:center;justify-content:space-between;width:100%}.s4y-dialog__footer{display:flex;align-items:center;justify-content:flex-end;gap:1rem;padding-top:1.4rem;flex-shrink:0}@media screen and (min-width: 320px) and (max-width: 480px){.s4y-dialog__footer{flex-direction:column-reverse}.s4y-dialog__footer button{width:100%}}.s4y-dialog-header__title{font-size:1.8rem;color:var(--primary-color)}.s4y-dialog-header__description{font-size:2rem;font-size:1.4rem;font-weight:400;color:var(--gray-700)}.s4y-dialog__body{flex:1 1 auto;min-height:0;overflow-y:auto}.s4y-dialog-close-btn{padding:0rem 1.4rem;cursor:pointer;font-size:2rem;position:absolute;right:0;top:0;transition:.5 ease}.s4y-dialog-close-btn:hover{background-color:var(--gray-200);border-radius:var(--radius)}\n"], dependencies: [{ kind: "directive", type: CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "component", type: ButtonComponent, selector: "button[s4yButton], a[s4yButton]", inputs: ["disabled", "outlined", "loading", "size", "variant", "fullWidth", "iconAligned"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], animations: [] });
|
|
3504
3816
|
}
|
|
3505
3817
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: DynamicDialogComponent, decorators: [{
|
|
3506
3818
|
type: Component,
|
|
@@ -3524,12 +3836,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
|
|
|
3524
3836
|
type: Input
|
|
3525
3837
|
}], templateContext: [{
|
|
3526
3838
|
type: Input
|
|
3839
|
+
}], portalOutlet: [{
|
|
3840
|
+
type: ViewChild,
|
|
3841
|
+
args: [CdkPortalOutlet, { static: false }]
|
|
3527
3842
|
}] } });
|
|
3528
3843
|
|
|
3529
3844
|
class DynamicDialogService {
|
|
3530
3845
|
overlay = inject(Overlay);
|
|
3531
3846
|
rootInjector = inject(Injector);
|
|
3532
|
-
open(component, opts
|
|
3847
|
+
open(component, opts) {
|
|
3848
|
+
opts = opts ?? {};
|
|
3533
3849
|
const overlayRef = this.overlay.create(this.buildOverlayConfig(opts));
|
|
3534
3850
|
overlayRef.updateSize({
|
|
3535
3851
|
width: opts.width ?? 'auto',
|
|
@@ -3546,19 +3862,26 @@ class DynamicDialogService {
|
|
|
3546
3862
|
classes.forEach((c) => overlayRef.addPanelClass(c));
|
|
3547
3863
|
}
|
|
3548
3864
|
const dialogRef = new DynamicDialogRef(overlayRef);
|
|
3865
|
+
const untilClosed$ = dialogRef.afterClosed$.pipe(take(1));
|
|
3549
3866
|
if (opts.closeOnBackdrop) {
|
|
3550
3867
|
overlayRef
|
|
3551
3868
|
.backdropClick()
|
|
3552
|
-
.pipe(
|
|
3553
|
-
.subscribe(() => {
|
|
3869
|
+
.pipe(takeUntil(untilClosed$))
|
|
3870
|
+
.subscribe(async () => {
|
|
3871
|
+
if (!(await allow(opts.canDismiss, 'backdrop')))
|
|
3872
|
+
return;
|
|
3554
3873
|
dialogRef.closeAnimated(undefined, 'backdrop');
|
|
3555
3874
|
});
|
|
3556
3875
|
}
|
|
3557
3876
|
if (opts.closeOnEsc !== false) {
|
|
3558
3877
|
overlayRef
|
|
3559
3878
|
.keydownEvents()
|
|
3560
|
-
.pipe(filter$1((e) => e.key === 'Escape' || e.key === 'Esc'),
|
|
3561
|
-
.subscribe(() =>
|
|
3879
|
+
.pipe(filter$1((e) => e.key === 'Escape' || e.key === 'Esc'), takeUntil(untilClosed$))
|
|
3880
|
+
.subscribe(async () => {
|
|
3881
|
+
if (!(await allow(opts.canDismiss, 'esc')))
|
|
3882
|
+
return;
|
|
3883
|
+
dialogRef.closeAnimated(undefined, 'esc');
|
|
3884
|
+
});
|
|
3562
3885
|
}
|
|
3563
3886
|
// injeta o ref + dados no componente container
|
|
3564
3887
|
const injector = Injector.create({
|
|
@@ -3572,6 +3895,7 @@ class DynamicDialogService {
|
|
|
3572
3895
|
// anexa o container
|
|
3573
3896
|
const containerPortal = new ComponentPortal(DynamicDialogComponent, null, injector);
|
|
3574
3897
|
const containerRef = overlayRef.attach(containerPortal);
|
|
3898
|
+
dialogRef._attachForButtonUpdates(containerRef.instance, opts);
|
|
3575
3899
|
const templateCtx = {
|
|
3576
3900
|
$implicit: opts.data,
|
|
3577
3901
|
data: opts.data,
|
|
@@ -3620,6 +3944,324 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
|
|
|
3620
3944
|
}]
|
|
3621
3945
|
}] });
|
|
3622
3946
|
|
|
3947
|
+
class DynamicLoadingGlobalComponent {
|
|
3948
|
+
message = signal('Carregando dados...');
|
|
3949
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: DynamicLoadingGlobalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3950
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: DynamicLoadingGlobalComponent, isStandalone: true, selector: "s4y-dynamic-loading-global", ngImport: i0, template: `
|
|
3951
|
+
<div class="s4y-dynamic-loading-container">
|
|
3952
|
+
<span class="s4y-dynamic-loading-container__loader"></span>
|
|
3953
|
+
<p>{{ message() }}</p>
|
|
3954
|
+
</div>
|
|
3955
|
+
`, isInline: true, styles: [".s4y-dynamic-loading-container{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1.8rem;color:#fff}.s4y-dynamic-loading-container__loader{width:48px;height:48px;border-radius:50%;display:inline-block;border-top:3px solid #fff;border-right:3px solid transparent;box-sizing:border-box;animation:rotation 1s linear infinite}@keyframes rotation{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"], encapsulation: i0.ViewEncapsulation.None });
|
|
3956
|
+
}
|
|
3957
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: DynamicLoadingGlobalComponent, decorators: [{
|
|
3958
|
+
type: Component,
|
|
3959
|
+
args: [{ selector: 's4y-dynamic-loading-global', imports: [], template: `
|
|
3960
|
+
<div class="s4y-dynamic-loading-container">
|
|
3961
|
+
<span class="s4y-dynamic-loading-container__loader"></span>
|
|
3962
|
+
<p>{{ message() }}</p>
|
|
3963
|
+
</div>
|
|
3964
|
+
`, encapsulation: ViewEncapsulation.None, styles: [".s4y-dynamic-loading-container{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1.8rem;color:#fff}.s4y-dynamic-loading-container__loader{width:48px;height:48px;border-radius:50%;display:inline-block;border-top:3px solid #fff;border-right:3px solid transparent;box-sizing:border-box;animation:rotation 1s linear infinite}@keyframes rotation{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"] }]
|
|
3965
|
+
}] });
|
|
3966
|
+
|
|
3967
|
+
class DynamicLoadingGlobalService {
|
|
3968
|
+
overlay = inject(Overlay);
|
|
3969
|
+
overlays = new Map();
|
|
3970
|
+
constructor() { }
|
|
3971
|
+
showLoading(message) {
|
|
3972
|
+
const overlayRef = this.createOverlay();
|
|
3973
|
+
const portal = this.loadingComponentPortal();
|
|
3974
|
+
const id = crypto.randomUUID();
|
|
3975
|
+
const componentRef = overlayRef.attach(portal);
|
|
3976
|
+
if (message) {
|
|
3977
|
+
componentRef.instance.message.set(message);
|
|
3978
|
+
}
|
|
3979
|
+
this.overlays.set(id, { overlayRef, componentRef });
|
|
3980
|
+
return id;
|
|
3981
|
+
}
|
|
3982
|
+
updateMessage(id, message) {
|
|
3983
|
+
const entry = this.overlays.get(id);
|
|
3984
|
+
if (entry) {
|
|
3985
|
+
entry.componentRef.instance.message.set(message);
|
|
3986
|
+
}
|
|
3987
|
+
}
|
|
3988
|
+
hiddenLoading(id) {
|
|
3989
|
+
if (id) {
|
|
3990
|
+
const entry = this.overlays.get(id);
|
|
3991
|
+
if (entry) {
|
|
3992
|
+
entry.overlayRef.dispose();
|
|
3993
|
+
this.overlays.delete(id);
|
|
3994
|
+
}
|
|
3995
|
+
}
|
|
3996
|
+
else {
|
|
3997
|
+
this.overlays.forEach((entry) => entry.overlayRef.dispose());
|
|
3998
|
+
this.overlays.clear();
|
|
3999
|
+
}
|
|
4000
|
+
}
|
|
4001
|
+
loadingComponentPortal() {
|
|
4002
|
+
return new ComponentPortal(DynamicLoadingGlobalComponent);
|
|
4003
|
+
}
|
|
4004
|
+
createOverlay() {
|
|
4005
|
+
return this.overlay.create({
|
|
4006
|
+
backdropClass: ['s4y-overlay-bg'],
|
|
4007
|
+
panelClass: ['s4y-centered-panel-content'],
|
|
4008
|
+
scrollStrategy: this.overlay.scrollStrategies.block(),
|
|
4009
|
+
hasBackdrop: true,
|
|
4010
|
+
disposeOnNavigation: true,
|
|
4011
|
+
});
|
|
4012
|
+
}
|
|
4013
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: DynamicLoadingGlobalService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4014
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: DynamicLoadingGlobalService, providedIn: 'root' });
|
|
4015
|
+
}
|
|
4016
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: DynamicLoadingGlobalService, decorators: [{
|
|
4017
|
+
type: Injectable,
|
|
4018
|
+
args: [{
|
|
4019
|
+
providedIn: 'root',
|
|
4020
|
+
}]
|
|
4021
|
+
}], ctorParameters: () => [] });
|
|
4022
|
+
|
|
4023
|
+
const SIZE_MAP = {
|
|
4024
|
+
xs: 16,
|
|
4025
|
+
sm: 20,
|
|
4026
|
+
md: 24,
|
|
4027
|
+
lg: 32,
|
|
4028
|
+
xl: 40,
|
|
4029
|
+
};
|
|
4030
|
+
class RatingComponent {
|
|
4031
|
+
sanitizer = inject(DomSanitizer);
|
|
4032
|
+
value = signal(0);
|
|
4033
|
+
hoverValue = signal(null);
|
|
4034
|
+
count = input(5);
|
|
4035
|
+
size = input('md');
|
|
4036
|
+
sizePx = computed(() => {
|
|
4037
|
+
const v = this.size();
|
|
4038
|
+
return typeof v === 'number' ? v : (SIZE_MAP[v] ?? SIZE_MAP.md);
|
|
4039
|
+
});
|
|
4040
|
+
allowHalf = input(false);
|
|
4041
|
+
readOnly = input(false);
|
|
4042
|
+
disabled = signal(false);
|
|
4043
|
+
onChange = () => { };
|
|
4044
|
+
onTouched = () => { };
|
|
4045
|
+
stars = computed(() => {
|
|
4046
|
+
const totalStars = this.count(); // número, ex: 5
|
|
4047
|
+
const displayValue = this.hoverValue() ?? this.value();
|
|
4048
|
+
const result = [];
|
|
4049
|
+
for (let i = 0; i < totalStars; i++) {
|
|
4050
|
+
let icon = this.starLineIcon;
|
|
4051
|
+
if (displayValue >= i + 1) {
|
|
4052
|
+
icon = this.starFillIcon;
|
|
4053
|
+
}
|
|
4054
|
+
else if (this.allowHalf() && displayValue >= i + 0.5) {
|
|
4055
|
+
icon = this.starHalfIcon;
|
|
4056
|
+
}
|
|
4057
|
+
result.push(this.sanitizer.bypassSecurityTrustHtml(icon));
|
|
4058
|
+
}
|
|
4059
|
+
return result;
|
|
4060
|
+
});
|
|
4061
|
+
get isDisabledClass() {
|
|
4062
|
+
return this.disabled();
|
|
4063
|
+
}
|
|
4064
|
+
get isReadOnlyClass() {
|
|
4065
|
+
return this.readOnly();
|
|
4066
|
+
}
|
|
4067
|
+
clearHoverStar() {
|
|
4068
|
+
this.hoverValue.set(null);
|
|
4069
|
+
}
|
|
4070
|
+
writeValue(value) {
|
|
4071
|
+
const total = this.count();
|
|
4072
|
+
const normalized = typeof value === 'number' ? Math.max(0, Math.min(value, total)) : 0;
|
|
4073
|
+
this.value.set(this.allowHalf()
|
|
4074
|
+
? Math.round(normalized * 2) / 2
|
|
4075
|
+
: Math.round(normalized));
|
|
4076
|
+
}
|
|
4077
|
+
registerOnChange(fn) {
|
|
4078
|
+
this.onChange = fn;
|
|
4079
|
+
}
|
|
4080
|
+
registerOnTouched(fn) {
|
|
4081
|
+
this.onTouched = fn;
|
|
4082
|
+
}
|
|
4083
|
+
setDisabledState(isDisabled) {
|
|
4084
|
+
this.disabled.set(isDisabled);
|
|
4085
|
+
}
|
|
4086
|
+
setRating(index, event) {
|
|
4087
|
+
if (!this.isInteractive)
|
|
4088
|
+
return;
|
|
4089
|
+
//é um array, entao a posicao é 0
|
|
4090
|
+
const next = this.allowHalf() ? this.computeHalf(index, event) : index + 1;
|
|
4091
|
+
if (next === this.value()) {
|
|
4092
|
+
this.updateValue(0);
|
|
4093
|
+
this.hoverValue.set(null);
|
|
4094
|
+
}
|
|
4095
|
+
else {
|
|
4096
|
+
this.updateValue(next);
|
|
4097
|
+
}
|
|
4098
|
+
}
|
|
4099
|
+
onKey(event) {
|
|
4100
|
+
if (!this.isInteractive)
|
|
4101
|
+
return;
|
|
4102
|
+
const total = this.count();
|
|
4103
|
+
const step = this.allowHalf() ? 0.5 : 1;
|
|
4104
|
+
const base = this.hoverValue() ?? this.value();
|
|
4105
|
+
if (event.key === 'ArrowRight' || event.key === 'ArrowUp') {
|
|
4106
|
+
const next = Math.min(base + step, total);
|
|
4107
|
+
this.hoverValue.set(next);
|
|
4108
|
+
event.preventDefault();
|
|
4109
|
+
return;
|
|
4110
|
+
}
|
|
4111
|
+
if (event.key === 'ArrowLeft' || event.key === 'ArrowDown') {
|
|
4112
|
+
const next = Math.max(base - step, 0);
|
|
4113
|
+
this.hoverValue.set(next);
|
|
4114
|
+
event.preventDefault();
|
|
4115
|
+
return;
|
|
4116
|
+
}
|
|
4117
|
+
if (event.key === 'Home') {
|
|
4118
|
+
this.hoverValue.set(0);
|
|
4119
|
+
event.preventDefault();
|
|
4120
|
+
return;
|
|
4121
|
+
}
|
|
4122
|
+
if (event.key === 'End') {
|
|
4123
|
+
this.hoverValue.set(total);
|
|
4124
|
+
event.preventDefault();
|
|
4125
|
+
return;
|
|
4126
|
+
}
|
|
4127
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
4128
|
+
const targetValue = this.hoverValue() ?? this.value();
|
|
4129
|
+
this.updateValue(targetValue);
|
|
4130
|
+
this.hoverValue.set(null);
|
|
4131
|
+
event.preventDefault();
|
|
4132
|
+
return;
|
|
4133
|
+
}
|
|
4134
|
+
if (event.key === 'Escape') {
|
|
4135
|
+
this.hoverValue.set(null);
|
|
4136
|
+
event.preventDefault();
|
|
4137
|
+
return;
|
|
4138
|
+
}
|
|
4139
|
+
}
|
|
4140
|
+
onStarHover(index, event) {
|
|
4141
|
+
if (!this.isInteractive)
|
|
4142
|
+
return;
|
|
4143
|
+
if (this.allowHalf()) {
|
|
4144
|
+
this.hoverValue.set(this.computeHalf(index, event));
|
|
4145
|
+
}
|
|
4146
|
+
else {
|
|
4147
|
+
this.hoverValue.set(index + 1);
|
|
4148
|
+
}
|
|
4149
|
+
}
|
|
4150
|
+
onStarHoverTouch(index, event) {
|
|
4151
|
+
if (!this.isInteractive)
|
|
4152
|
+
return;
|
|
4153
|
+
if (this.allowHalf()) {
|
|
4154
|
+
this.hoverValue.set(this.computeHalf(index, event));
|
|
4155
|
+
}
|
|
4156
|
+
else {
|
|
4157
|
+
this.hoverValue.set(index + 1);
|
|
4158
|
+
}
|
|
4159
|
+
}
|
|
4160
|
+
onTouchCommit(index, event) {
|
|
4161
|
+
if (!this.isInteractive)
|
|
4162
|
+
return;
|
|
4163
|
+
const next = this.allowHalf() ? this.computeHalf(index, event) : index + 1;
|
|
4164
|
+
// Em mobile, toque único normalmente deve setar; se tocar de novo no mesmo, zera:
|
|
4165
|
+
if (next === this.value()) {
|
|
4166
|
+
this.updateValue(0);
|
|
4167
|
+
this.hoverValue.set(null);
|
|
4168
|
+
}
|
|
4169
|
+
else {
|
|
4170
|
+
this.updateValue(next);
|
|
4171
|
+
}
|
|
4172
|
+
// evita rolagem acidental ao tocar/arrastar levemente
|
|
4173
|
+
event.preventDefault();
|
|
4174
|
+
}
|
|
4175
|
+
updateValue(value) {
|
|
4176
|
+
const newValue = this.allowHalf()
|
|
4177
|
+
? Math.round(value * 2) / 2
|
|
4178
|
+
: Math.round(value);
|
|
4179
|
+
this.value.set(newValue);
|
|
4180
|
+
this.onChange(newValue);
|
|
4181
|
+
this.onTouched();
|
|
4182
|
+
}
|
|
4183
|
+
getClientXFromEvent(e) {
|
|
4184
|
+
if (e instanceof TouchEvent) {
|
|
4185
|
+
const t = e.touches[0] ?? e.changedTouches[0];
|
|
4186
|
+
return t?.clientX ?? 0;
|
|
4187
|
+
}
|
|
4188
|
+
return e.clientX ?? 0;
|
|
4189
|
+
}
|
|
4190
|
+
computeHalf(index, e) {
|
|
4191
|
+
const target = e.currentTarget;
|
|
4192
|
+
const rect = target.getBoundingClientRect();
|
|
4193
|
+
const clientX = this.getClientXFromEvent(e);
|
|
4194
|
+
const relativeX = clientX - rect.left; // 0..width
|
|
4195
|
+
const isHalf = relativeX < rect.width / 2;
|
|
4196
|
+
return isHalf ? index + 0.5 : index + 1;
|
|
4197
|
+
}
|
|
4198
|
+
get isInteractive() {
|
|
4199
|
+
return !this.disabled() && !this.readOnly();
|
|
4200
|
+
}
|
|
4201
|
+
get starLineIcon() {
|
|
4202
|
+
return `<svg
|
|
4203
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
4204
|
+
viewBox="0 0 24 24"
|
|
4205
|
+
fill="currentColor"
|
|
4206
|
+
>
|
|
4207
|
+
<path
|
|
4208
|
+
d="M12.0006 18.26L4.94715 22.2082L6.52248 14.2799L0.587891 8.7918L8.61493 7.84006L12.0006 0.5L15.3862 7.84006L23.4132 8.7918L17.4787 14.2799L19.054 22.2082L12.0006 18.26ZM12.0006 15.968L16.2473 18.3451L15.2988 13.5717L18.8719 10.2674L14.039 9.69434L12.0006 5.27502L9.96214 9.69434L5.12921 10.2674L8.70231 13.5717L7.75383 18.3451L12.0006 15.968Z"
|
|
4209
|
+
></path>
|
|
4210
|
+
</svg>`;
|
|
4211
|
+
}
|
|
4212
|
+
get starFillIcon() {
|
|
4213
|
+
return `<svg
|
|
4214
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
4215
|
+
viewBox="0 0 24 24"
|
|
4216
|
+
fill="currentColor"
|
|
4217
|
+
>
|
|
4218
|
+
<path
|
|
4219
|
+
d="M12.0006 18.26L4.94715 22.2082L6.52248 14.2799L0.587891 8.7918L8.61493 7.84006L12.0006 0.5L15.3862 7.84006L23.4132 8.7918L17.4787 14.2799L19.054 22.2082L12.0006 18.26Z"
|
|
4220
|
+
></path>
|
|
4221
|
+
</svg>`;
|
|
4222
|
+
}
|
|
4223
|
+
get starHalfIcon() {
|
|
4224
|
+
return `
|
|
4225
|
+
<svg
|
|
4226
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
4227
|
+
viewBox="0 0 24 24"
|
|
4228
|
+
fill="currentColor"
|
|
4229
|
+
>
|
|
4230
|
+
<path
|
|
4231
|
+
d="M12.0006 15.968L16.2473 18.3451L15.2988 13.5717L18.8719 10.2674L14.039 9.69434L12.0006 5.27502V15.968ZM12.0006 18.26L4.94715 22.2082L6.52248 14.2799L0.587891 8.7918L8.61493 7.84006L12.0006 0.5L15.3862 7.84006L23.4132 8.7918L17.4787 14.2799L19.054 22.2082L12.0006 18.26Z"
|
|
4232
|
+
></path>
|
|
4233
|
+
</svg>
|
|
4234
|
+
`;
|
|
4235
|
+
}
|
|
4236
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: RatingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4237
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.15", type: RatingComponent, isStandalone: true, selector: "s4y-rating", inputs: { count: { classPropertyName: "count", publicName: "count", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, allowHalf: { classPropertyName: "allowHalf", publicName: "allowHalf", isSignal: true, isRequired: false, transformFunction: null }, readOnly: { classPropertyName: "readOnly", publicName: "readOnly", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "mouseleave": "clearHoverStar()" }, properties: { "class.s4y-rating--disabled": "this.isDisabledClass", "class.s4y-rating--readonly": "this.isReadOnlyClass" } }, providers: [
|
|
4238
|
+
{
|
|
4239
|
+
provide: NG_VALUE_ACCESSOR,
|
|
4240
|
+
useExisting: forwardRef(() => RatingComponent),
|
|
4241
|
+
multi: true,
|
|
4242
|
+
},
|
|
4243
|
+
], ngImport: i0, template: "<div\r\n class=\"s4y-star-container\"\r\n role=\"slider\"\r\n [attr.aria-valuemin]=\"0\"\r\n [attr.aria-valuemax]=\"count()\"\r\n [attr.aria-valuenow]=\"value()\"\r\n [attr.aria-valuetext]=\"(hoverValue() ?? value()) + ' de ' + count()\"\r\n [attr.aria-readonly]=\"readOnly() ? 'true' : null\"\r\n [attr.aria-disabled]=\"disabled() ? 'true' : null\"\r\n tabindex=\"0\"\r\n (blur)=\"onTouched()\"\r\n (keydown)=\"onKey($event)\"\r\n>\r\n @for (star of stars(); track $index) {\r\n <button\r\n tabindex=\"-1\"\r\n (click)=\"setRating($index, $event)\"\r\n (mousemove)=\"onStarHover($index, $event)\"\r\n (touchstart)=\"onStarHoverTouch($index, $event)\"\r\n (touchend)=\"onTouchCommit($index, $event)\"\r\n [innerHTML]=\"star\"\r\n [disabled]=\"disabled()\"\r\n role=\"button\"\r\n class=\"s4y-star-item\"\r\n [style.height.px]=\"sizePx()\"\r\n [style.width.px]=\"sizePx()\"\r\n [attr.aria-label]=\"'Avaliar com ' + ($index + 1) + ' estrela(s)'\"\r\n ></button>\r\n }\r\n</div>\r\n", styles: [":host(.s4y-rating--disabled) .s4y-star-item{cursor:not-allowed;opacity:.6;pointer-events:none}:host(.s4y-rating--readonly) .s4y-star-item{cursor:default}.s4y-star-container{display:flex;gap:.8rem}.s4y-star-container .s4y-star-item{cursor:pointer;color:#ffc309}.s4y-star-container .s4y-star-item svg{width:100%;height:100%}.s4y-star-item{display:inline-flex;align-items:center;justify-content:center;padding:0;border:0;background:transparent;line-height:0;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}.s4y-star-item svg{width:100%;height:100%;display:block;pointer-events:none}\n"] });
|
|
4244
|
+
}
|
|
4245
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: RatingComponent, decorators: [{
|
|
4246
|
+
type: Component,
|
|
4247
|
+
args: [{ selector: 's4y-rating', providers: [
|
|
4248
|
+
{
|
|
4249
|
+
provide: NG_VALUE_ACCESSOR,
|
|
4250
|
+
useExisting: forwardRef(() => RatingComponent),
|
|
4251
|
+
multi: true,
|
|
4252
|
+
},
|
|
4253
|
+
], template: "<div\r\n class=\"s4y-star-container\"\r\n role=\"slider\"\r\n [attr.aria-valuemin]=\"0\"\r\n [attr.aria-valuemax]=\"count()\"\r\n [attr.aria-valuenow]=\"value()\"\r\n [attr.aria-valuetext]=\"(hoverValue() ?? value()) + ' de ' + count()\"\r\n [attr.aria-readonly]=\"readOnly() ? 'true' : null\"\r\n [attr.aria-disabled]=\"disabled() ? 'true' : null\"\r\n tabindex=\"0\"\r\n (blur)=\"onTouched()\"\r\n (keydown)=\"onKey($event)\"\r\n>\r\n @for (star of stars(); track $index) {\r\n <button\r\n tabindex=\"-1\"\r\n (click)=\"setRating($index, $event)\"\r\n (mousemove)=\"onStarHover($index, $event)\"\r\n (touchstart)=\"onStarHoverTouch($index, $event)\"\r\n (touchend)=\"onTouchCommit($index, $event)\"\r\n [innerHTML]=\"star\"\r\n [disabled]=\"disabled()\"\r\n role=\"button\"\r\n class=\"s4y-star-item\"\r\n [style.height.px]=\"sizePx()\"\r\n [style.width.px]=\"sizePx()\"\r\n [attr.aria-label]=\"'Avaliar com ' + ($index + 1) + ' estrela(s)'\"\r\n ></button>\r\n }\r\n</div>\r\n", styles: [":host(.s4y-rating--disabled) .s4y-star-item{cursor:not-allowed;opacity:.6;pointer-events:none}:host(.s4y-rating--readonly) .s4y-star-item{cursor:default}.s4y-star-container{display:flex;gap:.8rem}.s4y-star-container .s4y-star-item{cursor:pointer;color:#ffc309}.s4y-star-container .s4y-star-item svg{width:100%;height:100%}.s4y-star-item{display:inline-flex;align-items:center;justify-content:center;padding:0;border:0;background:transparent;line-height:0;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}.s4y-star-item svg{width:100%;height:100%;display:block;pointer-events:none}\n"] }]
|
|
4254
|
+
}], propDecorators: { isDisabledClass: [{
|
|
4255
|
+
type: HostBinding,
|
|
4256
|
+
args: ['class.s4y-rating--disabled']
|
|
4257
|
+
}], isReadOnlyClass: [{
|
|
4258
|
+
type: HostBinding,
|
|
4259
|
+
args: ['class.s4y-rating--readonly']
|
|
4260
|
+
}], clearHoverStar: [{
|
|
4261
|
+
type: HostListener,
|
|
4262
|
+
args: ['mouseleave']
|
|
4263
|
+
}] } });
|
|
4264
|
+
|
|
3623
4265
|
/*
|
|
3624
4266
|
* Public API Surface of s4y-components
|
|
3625
4267
|
*/
|
|
@@ -3629,5 +4271,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
|
|
|
3629
4271
|
* Generated bundle index. Do not edit.
|
|
3630
4272
|
*/
|
|
3631
4273
|
|
|
3632
|
-
export { AsideComponent, AsideService, AvatarComponent, BreadcrumbComponent, BreadcrumbItemDirective, BreadcrumbService, ButtonComponent, CheckboxComponent, ClickOutsideDirective, DYNAMIC_DIALOG_DATA, DYNAMIC_DIALOG_OPTIONS, DashboardContainerComponent, DashboardLayoutComponent, DashboardModule, DashboardRoutesComponent, DrawerComponent, DynamicDialogComponent, DynamicDialogRef, DynamicDialogService, ErrorMessageComponent, FormFieldComponent, FormFieldPasswordComponent, FormsKitModule, HintComponent, InputComponent, InputPrefixComponent, InputSufixComponent, LabelComponent, LoadingModalComponent, LoadingModalService, MaskDirective, MenuComponent, MenuItemComponent, ModalComponent, ModalConfirmationComponent, ModalConfirmationService, NavbarComponent, PaginationComponent, PopoverPanelComponent, PopoverTriggerDirective, RadioComponent, SearchBarComponent, SelectComponent, SelectMultiComponent, SidebarRightComponent, SidebarRightService, SliderComponent, SpinnerComponent, StepComponent, StepPanelComponent, StepperComponent, SvgComponent, SvgService, TableComponent, TableSortDirective, ToastComponent, ToastService, ToggleComponent, TooltipComponent, TooltipDirective, TooltipModule, TooltipPosition, modalFadeCombined, sidebarRightAnimation };
|
|
4274
|
+
export { AsideComponent, AsideService, AvatarComponent, BreadcrumbComponent, BreadcrumbItemDirective, BreadcrumbService, ButtonComponent, CheckboxComponent, ClickOutsideDirective, DYNAMIC_DIALOG_DATA, DYNAMIC_DIALOG_OPTIONS, DashboardContainerComponent, DashboardLayoutComponent, DashboardModule, DashboardRoutesComponent, DrawerComponent, DynamicDialogComponent, DynamicDialogRef, DynamicDialogService, DynamicLoadingGlobalService, ErrorMessageComponent, FormFieldComponent, FormFieldPasswordComponent, FormsKitModule, HintComponent, ImageComponent, ImageService, InputComponent, InputPrefixComponent, InputSufixComponent, LabelComponent, LoadingModalComponent, LoadingModalService, MaskDirective, MenuComponent, MenuItemComponent, ModalComponent, ModalConfirmationComponent, ModalConfirmationService, NavbarComponent, PaginationComponent, PopoverPanelComponent, PopoverTriggerDirective, RadioComponent, RatingComponent, SearchBarComponent, SelectComponent, SelectMultiComponent, SidebarRightComponent, SidebarRightService, SliderComponent, SpinnerComponent, StepComponent, StepPanelComponent, StepperComponent, SvgComponent, SvgService, TableComponent, TableSortDirective, ToastComponent, ToastService, ToggleComponent, TooltipComponent, TooltipDirective, TooltipModule, TooltipPosition, modalFadeCombined, sidebarRightAnimation };
|
|
3633
4275
|
//# sourceMappingURL=s4y-ui.mjs.map
|