@coreui/angular-pro 5.7.11 → 5.7.12
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, ElementRef, Directive, input, Renderer2, effect, TemplateRef, booleanAttribute, untracked, NgModule, computed, Injectable, Component, afterNextRender, linkedSignal, output, signal, contentChildren, DestroyRef, forwardRef, DOCUMENT, NgZone, ChangeDetectorRef, contentChild, Input, IterableDiffers, numberAttribute, ViewChild, ContentChildren, ViewChildren, ChangeDetectionStrategy, PLATFORM_ID, RendererFactory2, viewChildren, viewChild, Injector, ViewContainerRef, inputBinding, outputBinding, KeyValueDiffers, Pipe, HostBinding, model, afterEveryRender, afterRenderEffect, HostListener, runInInjectionContext, ViewEncapsulation
|
|
2
|
+
import { inject, ElementRef, Directive, input, Renderer2, effect, TemplateRef, booleanAttribute, untracked, NgModule, computed, Injectable, Component, afterNextRender, linkedSignal, output, signal, contentChildren, DestroyRef, forwardRef, DOCUMENT, NgZone, ChangeDetectorRef, contentChild, Input, IterableDiffers, numberAttribute, ViewChild, ContentChildren, ViewChildren, ChangeDetectionStrategy, PLATFORM_ID, RendererFactory2, viewChildren, viewChild, Injector, ViewContainerRef, inputBinding, outputBinding, MAX_ANIMATION_TIMEOUT, KeyValueDiffers, Pipe, HostBinding, model, afterEveryRender, afterRenderEffect, HostListener, runInInjectionContext, ViewEncapsulation } from '@angular/core';
|
|
3
3
|
import { NgTemplateOutlet, I18nPluralPipe, NgStyle, AsyncPipe, isPlatformServer, isPlatformBrowser, formatDate } from '@angular/common';
|
|
4
|
-
import { animation, animate, style, AnimationBuilder, useAnimation,
|
|
4
|
+
import { animation, animate, style, AnimationBuilder, useAnimation, group, query, trigger, state, transition, animateChild } from '@angular/animations';
|
|
5
5
|
import { toObservable, takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
|
|
6
6
|
import * as i1 from '@angular/forms';
|
|
7
7
|
import { FormsModule, NG_VALUE_ACCESSOR, FormGroup, FormControl, Validators, ReactiveFormsModule } from '@angular/forms';
|
|
@@ -5013,6 +5013,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
|
|
|
5013
5013
|
}] });
|
|
5014
5014
|
|
|
5015
5015
|
class AlertComponent {
|
|
5016
|
+
#hostElement = inject(ElementRef);
|
|
5017
|
+
#maxAnimationTimeout = inject(MAX_ANIMATION_TIMEOUT);
|
|
5016
5018
|
/**
|
|
5017
5019
|
* Sets the color context of the component to one of CoreUI’s themed colors.
|
|
5018
5020
|
* @return Colors
|
|
@@ -5034,50 +5036,42 @@ class AlertComponent {
|
|
|
5034
5036
|
variant = input(/* @ts-ignore */
|
|
5035
5037
|
...(ngDevMode ? [undefined, { debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
5036
5038
|
/**
|
|
5037
|
-
* Optionally adds a close button to alert and allow it to self
|
|
5039
|
+
* Optionally adds a close button to the alert and allow it to self-dismiss.
|
|
5038
5040
|
* @return boolean
|
|
5039
5041
|
* @default false
|
|
5040
5042
|
*/
|
|
5041
|
-
|
|
5042
|
-
#dismissible = linkedSignal({ ...(ngDevMode ? { debugName: "#dismissible" } : /* istanbul ignore next */ {}), source: this.dismissibleInput,
|
|
5043
|
-
computation: (value) => {
|
|
5044
|
-
return value;
|
|
5045
|
-
} });
|
|
5046
|
-
set dismissible(value) {
|
|
5047
|
-
this.#dismissible.set(value);
|
|
5048
|
-
}
|
|
5049
|
-
get dismissible() {
|
|
5050
|
-
return this.#dismissible();
|
|
5051
|
-
}
|
|
5043
|
+
dismissible = input(false, { ...(ngDevMode ? { debugName: "dismissible" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
5052
5044
|
/**
|
|
5053
5045
|
* Adds animation for dismissible alert.
|
|
5054
5046
|
* @return boolean
|
|
5055
5047
|
*/
|
|
5056
5048
|
fade = input(false, { ...(ngDevMode ? { debugName: "fade" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
5057
5049
|
/**
|
|
5058
|
-
* Toggle the visibility of alert component.
|
|
5050
|
+
* Toggle the visibility of the alert component.
|
|
5059
5051
|
* @return boolean
|
|
5060
5052
|
*/
|
|
5061
5053
|
visibleInput = input(true, { ...(ngDevMode ? { debugName: "visibleInput" } : /* istanbul ignore next */ {}), transform: booleanAttribute, alias: 'visible' });
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
return value;
|
|
5065
|
-
} });
|
|
5066
|
-
set visible(value) {
|
|
5067
|
-
if (this.#visible() !== value) {
|
|
5068
|
-
this.#visible.set(value);
|
|
5069
|
-
this.visibleChange?.emit(value);
|
|
5070
|
-
}
|
|
5071
|
-
}
|
|
5072
|
-
get visible() {
|
|
5073
|
-
return this.#visible();
|
|
5074
|
-
}
|
|
5075
|
-
hide = signal(false, /* @ts-ignore */
|
|
5076
|
-
...(ngDevMode ? [{ debugName: "hide" }] : /* istanbul ignore next */ []));
|
|
5054
|
+
visible = linkedSignal(this.visibleInput, /* @ts-ignore */
|
|
5055
|
+
...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
|
|
5077
5056
|
/**
|
|
5078
|
-
* Event triggered on the alert
|
|
5057
|
+
* Event triggered on the alert visibility change.
|
|
5058
|
+
* @return boolean
|
|
5079
5059
|
*/
|
|
5080
5060
|
visibleChange = output();
|
|
5061
|
+
hide = signal(false, /* @ts-ignore */
|
|
5062
|
+
...(ngDevMode ? [{ debugName: "hide" }] : /* istanbul ignore next */ []));
|
|
5063
|
+
#visibleEffect = effect(() => {
|
|
5064
|
+
const visible = this.visible();
|
|
5065
|
+
if (visible) {
|
|
5066
|
+
this.hide.set(false);
|
|
5067
|
+
}
|
|
5068
|
+
}, /* @ts-ignore */
|
|
5069
|
+
...(ngDevMode ? [{ debugName: "#visibleEffect" }] : /* istanbul ignore next */ []));
|
|
5070
|
+
#hideEffect = effect(() => {
|
|
5071
|
+
const hide = this.hide();
|
|
5072
|
+
this.visibleChange.emit(!hide);
|
|
5073
|
+
}, /* @ts-ignore */
|
|
5074
|
+
...(ngDevMode ? [{ debugName: "#hideEffect" }] : /* istanbul ignore next */ []));
|
|
5081
5075
|
contentTemplates = contentChildren(TemplateIdDirective, { ...(ngDevMode ? { debugName: "contentTemplates" } : /* istanbul ignore next */ {}), descendants: true });
|
|
5082
5076
|
templates = computed(() => {
|
|
5083
5077
|
return this.contentTemplates().reduce((acc, child) => {
|
|
@@ -5086,72 +5080,58 @@ class AlertComponent {
|
|
|
5086
5080
|
}, {});
|
|
5087
5081
|
}, /* @ts-ignore */
|
|
5088
5082
|
...(ngDevMode ? [{ debugName: "templates" }] : /* istanbul ignore next */ []));
|
|
5089
|
-
get animateType() {
|
|
5090
|
-
return this.visible ? 'show' : 'hide';
|
|
5091
|
-
}
|
|
5092
5083
|
hostClasses = computed(() => {
|
|
5093
5084
|
const color = this.color();
|
|
5094
5085
|
const variant = this.variant();
|
|
5086
|
+
const visible = this.visible();
|
|
5095
5087
|
return {
|
|
5096
5088
|
alert: true,
|
|
5097
|
-
'alert-dismissible': this.dismissible,
|
|
5089
|
+
'alert-dismissible': this.dismissible(),
|
|
5098
5090
|
fade: this.fade(),
|
|
5099
|
-
show:
|
|
5091
|
+
show: visible,
|
|
5092
|
+
'd-none': this.hide() && !visible,
|
|
5100
5093
|
[`alert-${color}`]: !!color && variant !== 'solid',
|
|
5101
5094
|
[`bg-${color}`]: !!color && variant === 'solid',
|
|
5102
5095
|
'text-white': !!color && variant === 'solid'
|
|
5103
5096
|
};
|
|
5104
5097
|
}, /* @ts-ignore */
|
|
5105
5098
|
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
onAnimationDone($event) {
|
|
5110
|
-
this.onAnimationEvent($event);
|
|
5111
|
-
}
|
|
5112
|
-
onAnimationEvent(event) {
|
|
5113
|
-
this.hide.set(event.phaseName === 'start' && event.toState === 'show');
|
|
5114
|
-
if (event.phaseName === 'done') {
|
|
5115
|
-
this.hide.set(event.toState === 'hide' || event.toState === 'void');
|
|
5116
|
-
if (event.toState === 'show') {
|
|
5099
|
+
onTransitionStart($event) {
|
|
5100
|
+
if ($event.propertyName === 'opacity') {
|
|
5101
|
+
if (this.visible()) {
|
|
5117
5102
|
this.hide.set(false);
|
|
5118
5103
|
}
|
|
5119
5104
|
}
|
|
5120
5105
|
}
|
|
5106
|
+
onTransitionEnd($event) {
|
|
5107
|
+
if ($event.propertyName === 'opacity') {
|
|
5108
|
+
this.hide.set(!this.visible());
|
|
5109
|
+
}
|
|
5110
|
+
}
|
|
5111
|
+
#leavingInProgress = false;
|
|
5112
|
+
handleLeaving($event) {
|
|
5113
|
+
if (this.#leavingInProgress)
|
|
5114
|
+
return;
|
|
5115
|
+
this.#leavingInProgress = true;
|
|
5116
|
+
this.#hostElement.nativeElement.classList.remove('show');
|
|
5117
|
+
setTimeout(() => {
|
|
5118
|
+
$event.animationComplete();
|
|
5119
|
+
}, this.#maxAnimationTimeout);
|
|
5120
|
+
}
|
|
5121
5121
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: AlertComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
5122
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.0", type: AlertComponent, isStandalone: true, selector: "c-alert", inputs: { color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, role: { classPropertyName: "role", publicName: "role", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null },
|
|
5123
|
-
trigger('fadeInOut', [
|
|
5124
|
-
state('show', style({ opacity: 1, height: '*', padding: '*', border: '*', margin: '*' })),
|
|
5125
|
-
state('hide', style({ opacity: 0, height: 0, padding: 0, border: 0, margin: 0 })),
|
|
5126
|
-
state('void', style({ opacity: 0, height: 0, padding: 0, border: 0, margin: 0 })),
|
|
5127
|
-
transition('show => hide', [animate('.3s ease-out')]),
|
|
5128
|
-
transition('hide => show', [animate('.3s ease-in')]),
|
|
5129
|
-
transition('show => void', [animate('.3s ease-out')]),
|
|
5130
|
-
transition('void => show', [animate('.3s ease-in')])
|
|
5131
|
-
])
|
|
5132
|
-
] });
|
|
5122
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.0", type: AlertComponent, isStandalone: true, selector: "c-alert", inputs: { color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, role: { classPropertyName: "role", publicName: "role", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, dismissible: { classPropertyName: "dismissible", publicName: "dismissible", isSignal: true, isRequired: false, transformFunction: null }, fade: { classPropertyName: "fade", publicName: "fade", isSignal: true, isRequired: false, transformFunction: null }, visibleInput: { classPropertyName: "visibleInput", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { visibleChange: "visibleChange" }, host: { listeners: { "animate.leave": "handleLeaving($event)", "transitionend": "onTransitionEnd($event)", "transitionstart": "onTransitionStart($event)" }, properties: { "attr.role": "role()", "class": "hostClasses()", "attr.hidden": "hide() ? \"\" : null" } }, providers: [{ provide: MAX_ANIMATION_TIMEOUT, useValue: 300 }], queries: [{ propertyName: "contentTemplates", predicate: TemplateIdDirective, descendants: true, isSignal: true }], exportAs: ["cAlert"], ngImport: i0, template: "@if (visible() || !hide()) {\n @if (dismissible()) {\n <ng-container *ngTemplateOutlet=\"templates()?.['alertButtonCloseTemplate'] || defaultAlertButtonCloseTemplate\" />\n }\n <ng-content />\n}\n<ng-template #defaultAlertButtonCloseTemplate>\n <button (click)=\"visible.set(false)\" aria-label=\"Close\" cButtonClose></button>\n</ng-template>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: ButtonCloseDirective, selector: "[cButtonClose]", inputs: ["white"] }] });
|
|
5133
5123
|
}
|
|
5134
5124
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: AlertComponent, decorators: [{
|
|
5135
5125
|
type: Component,
|
|
5136
|
-
args: [{ selector: 'c-alert', exportAs: 'cAlert', imports: [NgTemplateOutlet, ButtonCloseDirective],
|
|
5137
|
-
trigger('fadeInOut', [
|
|
5138
|
-
state('show', style({ opacity: 1, height: '*', padding: '*', border: '*', margin: '*' })),
|
|
5139
|
-
state('hide', style({ opacity: 0, height: 0, padding: 0, border: 0, margin: 0 })),
|
|
5140
|
-
state('void', style({ opacity: 0, height: 0, padding: 0, border: 0, margin: 0 })),
|
|
5141
|
-
transition('show => hide', [animate('.3s ease-out')]),
|
|
5142
|
-
transition('hide => show', [animate('.3s ease-in')]),
|
|
5143
|
-
transition('show => void', [animate('.3s ease-out')]),
|
|
5144
|
-
transition('void => show', [animate('.3s ease-in')])
|
|
5145
|
-
])
|
|
5146
|
-
], host: {
|
|
5147
|
-
'[@.disabled]': '!fade()',
|
|
5148
|
-
'[@fadeInOut]': 'animateType',
|
|
5126
|
+
args: [{ selector: 'c-alert', exportAs: 'cAlert', imports: [NgTemplateOutlet, ButtonCloseDirective], host: {
|
|
5149
5127
|
'[attr.role]': 'role()',
|
|
5150
5128
|
'[class]': 'hostClasses()',
|
|
5151
|
-
'(
|
|
5152
|
-
'(
|
|
5153
|
-
|
|
5154
|
-
|
|
5129
|
+
'(animate.leave)': 'handleLeaving($event)',
|
|
5130
|
+
'(transitionend)': 'onTransitionEnd($event)',
|
|
5131
|
+
'(transitionstart)': 'onTransitionStart($event)',
|
|
5132
|
+
'[attr.hidden]': 'hide() ? "" : null'
|
|
5133
|
+
}, providers: [{ provide: MAX_ANIMATION_TIMEOUT, useValue: 300 }], template: "@if (visible() || !hide()) {\n @if (dismissible()) {\n <ng-container *ngTemplateOutlet=\"templates()?.['alertButtonCloseTemplate'] || defaultAlertButtonCloseTemplate\" />\n }\n <ng-content />\n}\n<ng-template #defaultAlertButtonCloseTemplate>\n <button (click)=\"visible.set(false)\" aria-label=\"Close\" cButtonClose></button>\n</ng-template>\n", styles: [":host{display:block}\n"] }]
|
|
5134
|
+
}], propDecorators: { color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], role: [{ type: i0.Input, args: [{ isSignal: true, alias: "role", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], dismissible: [{ type: i0.Input, args: [{ isSignal: true, alias: "dismissible", required: false }] }], fade: [{ type: i0.Input, args: [{ isSignal: true, alias: "fade", required: false }] }], visibleInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "visible", required: false }] }], visibleChange: [{ type: i0.Output, args: ["visibleChange"] }], contentTemplates: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => TemplateIdDirective), { ...{ descendants: true }, isSignal: true }] }] } });
|
|
5155
5135
|
|
|
5156
5136
|
class AlertModule {
|
|
5157
5137
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: AlertModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|