@coreui/angular 5.7.11 → 5.7.13
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/coreui-angular.mjs +162 -165
- package/fesm2022/coreui-angular.mjs.map +1 -1
- package/package.json +2 -2
- package/types/coreui-angular.d.ts +43 -46
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, ElementRef, Directive, input, Renderer2, effect, TemplateRef, booleanAttribute, untracked, NgModule, computed, Injectable, Component,
|
|
2
|
+
import { inject, ElementRef, Directive, input, Renderer2, effect, TemplateRef, booleanAttribute, untracked, NgModule, computed, Injectable, Component, linkedSignal, output, signal, contentChildren, numberAttribute, MAX_ANIMATION_TIMEOUT, DestroyRef, DOCUMENT, PLATFORM_ID, RendererFactory2, afterNextRender, forwardRef, NgZone, ChangeDetectorRef, contentChild, afterEveryRender, viewChild, ViewContainerRef, model, afterRenderEffect, ChangeDetectionStrategy, Pipe, Input, HostBinding, ContentChildren, HostListener, Injector, runInInjectionContext, ViewEncapsulation } from '@angular/core';
|
|
3
3
|
import { NgTemplateOutlet, isPlatformServer, isPlatformBrowser } from '@angular/common';
|
|
4
|
-
import { animation, animate, style, AnimationBuilder, useAnimation, trigger, state, transition, group, query, animateChild } from '@angular/animations';
|
|
5
4
|
import { takeUntilDestroyed, toSignal, toObservable } from '@angular/core/rxjs-interop';
|
|
6
5
|
import { fromEvent, Subject, BehaviorSubject, merge, takeWhile, skipWhile } from 'rxjs';
|
|
7
6
|
import * as i1 from '@angular/router';
|
|
8
7
|
import { RouterModule, Router, ActivatedRoute, NavigationEnd, RouterLink } from '@angular/router';
|
|
9
8
|
import { filter, tap, finalize, zipWith, withLatestFrom, debounceTime } from 'rxjs/operators';
|
|
9
|
+
import { animation, group, query, animate, style, trigger, state, transition, useAnimation, animateChild } from '@angular/animations';
|
|
10
10
|
import { createPopper } from '@popperjs/core';
|
|
11
11
|
import * as i1$1 from '@angular/cdk/a11y';
|
|
12
12
|
import { FocusKeyManager, FocusMonitor, A11yModule } from '@angular/cdk/a11y';
|
|
@@ -261,74 +261,62 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
|
|
|
261
261
|
args: [{ selector: 'c-accordion', template: '<ng-content />', exportAs: 'cAccordionItem', providers: [AccordionService], host: { '[class]': 'hostClasses()' }, styles: [":host{display:block}\n"] }]
|
|
262
262
|
}], propDecorators: { flush: [{ type: i0.Input, args: [{ isSignal: true, alias: "flush", required: false }] }], alwaysOpen: [{ type: i0.Input, args: [{ isSignal: true, alias: "alwaysOpen", required: false }] }] } });
|
|
263
263
|
|
|
264
|
-
const expandAnimation = animation([animate('{{ time }} {{ easing }}')]);
|
|
265
|
-
const collapseAnimation = animation([
|
|
266
|
-
style({ height: '*', minHeight: '*' }),
|
|
267
|
-
animate('{{ time }} {{ easing }}', style({ height: 0, minHeight: 0 }))
|
|
268
|
-
]);
|
|
269
|
-
const expandHorizontalAnimation = animation([animate('{{ time }} {{ easing }}')]);
|
|
270
|
-
const collapseHorizontalAnimation = animation([animate('{{ time }} {{ easing }}')]);
|
|
271
|
-
|
|
272
264
|
class CollapseDirective {
|
|
273
|
-
|
|
265
|
+
static ngAcceptInputType_animate;
|
|
266
|
+
static ngAcceptInputType_horizontal;
|
|
267
|
+
static ngAcceptInputType_navbar;
|
|
268
|
+
static ngAcceptInputType_visible;
|
|
274
269
|
#hostElement = inject(ElementRef);
|
|
275
270
|
#renderer = inject(Renderer2);
|
|
276
|
-
#
|
|
277
|
-
|
|
278
|
-
afterNextRender({
|
|
279
|
-
read: () => {
|
|
280
|
-
this.#initialized.set(true);
|
|
281
|
-
}
|
|
282
|
-
});
|
|
283
|
-
}
|
|
271
|
+
#unlistenTransitionEnd;
|
|
272
|
+
#isFirstChange = true;
|
|
284
273
|
/**
|
|
285
|
-
* @ignore
|
|
274
|
+
* @ignore internal
|
|
286
275
|
*/
|
|
287
276
|
animateInput = input(true, { ...(ngDevMode ? { debugName: "animateInput" } : /* istanbul ignore next */ {}), transform: booleanAttribute, alias: 'animate' });
|
|
288
|
-
animate = linkedSignal(
|
|
289
|
-
|
|
277
|
+
animate = linkedSignal(this.animateInput, /* @ts-ignore */
|
|
278
|
+
...(ngDevMode ? [{ debugName: "animate" }] : /* istanbul ignore next */ []));
|
|
290
279
|
/**
|
|
291
280
|
* Set horizontal collapsing to transition the width instead of height.
|
|
292
|
-
* @
|
|
281
|
+
* @return boolean
|
|
293
282
|
* @default false
|
|
294
283
|
*/
|
|
295
284
|
horizontal = input(false, { ...(ngDevMode ? { debugName: "horizontal" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
296
285
|
/**
|
|
297
|
-
* Toggle the visibility of collapsible element.
|
|
298
|
-
* @
|
|
286
|
+
* Toggle the visibility of a collapsible element.
|
|
287
|
+
* @return boolean
|
|
299
288
|
* @default false
|
|
300
289
|
*/
|
|
301
290
|
visibleInput = input(false, { ...(ngDevMode ? { debugName: "visibleInput" } : /* istanbul ignore next */ {}), transform: booleanAttribute, alias: 'visible' });
|
|
291
|
+
/**
|
|
292
|
+
* Event emitted on visibility change. [docs]
|
|
293
|
+
* @return boolean
|
|
294
|
+
*/
|
|
302
295
|
visibleChange = output();
|
|
303
|
-
visible = linkedSignal(
|
|
304
|
-
|
|
305
|
-
...(ngDevMode ? [{ debugName: "#initialized" }] : /* istanbul ignore next */ []));
|
|
296
|
+
visible = linkedSignal(this.visibleInput, /* @ts-ignore */
|
|
297
|
+
...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
|
|
306
298
|
#visibleEffect = effect(() => {
|
|
307
299
|
const visible = this.visible();
|
|
308
|
-
if (this.#
|
|
309
|
-
|
|
300
|
+
if (this.#isFirstChange || !untracked(() => this.animate())) {
|
|
301
|
+
// no transition
|
|
302
|
+
this.#isFirstChange = false;
|
|
303
|
+
this.setInitialState(visible);
|
|
304
|
+
return;
|
|
310
305
|
}
|
|
306
|
+
untracked(() => {
|
|
307
|
+
this.runTransition(visible);
|
|
308
|
+
});
|
|
311
309
|
}, /* @ts-ignore */
|
|
312
310
|
...(ngDevMode ? [{ debugName: "#visibleEffect" }] : /* istanbul ignore next */ []));
|
|
313
311
|
/**
|
|
314
|
-
* Add `navbar` prop for grouping and hiding navbar contents by a parent breakpoint.
|
|
315
|
-
* @
|
|
312
|
+
* Add a `navbar` prop for grouping and hiding navbar contents by a parent breakpoint.
|
|
313
|
+
* @return boolean
|
|
316
314
|
* @default false
|
|
317
315
|
*/
|
|
318
316
|
navbar = input(false, { ...(ngDevMode ? { debugName: "navbar" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
319
|
-
/**
|
|
320
|
-
* @ignore
|
|
321
|
-
*/
|
|
322
|
-
duration = input('350ms', /* @ts-ignore */
|
|
323
|
-
...(ngDevMode ? [{ debugName: "duration" }] : /* istanbul ignore next */ []));
|
|
324
|
-
/**
|
|
325
|
-
* @ignore
|
|
326
|
-
*/
|
|
327
|
-
transition = input('ease', /* @ts-ignore */
|
|
328
|
-
...(ngDevMode ? [{ debugName: "transition" }] : /* istanbul ignore next */ []));
|
|
329
317
|
/**
|
|
330
318
|
* Event emitted on visibility change. [docs]
|
|
331
|
-
* @
|
|
319
|
+
* @return string
|
|
332
320
|
*/
|
|
333
321
|
collapseChange = output();
|
|
334
322
|
hostClasses = computed(() => {
|
|
@@ -339,60 +327,88 @@ class CollapseDirective {
|
|
|
339
327
|
}, /* @ts-ignore */
|
|
340
328
|
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
341
329
|
ngOnDestroy() {
|
|
342
|
-
this.
|
|
330
|
+
this.clearPendingCallbacks();
|
|
343
331
|
}
|
|
344
332
|
toggle(visible = !this.visible()) {
|
|
345
333
|
this.visible.set(visible);
|
|
346
334
|
}
|
|
347
|
-
|
|
348
|
-
this.#
|
|
349
|
-
this.#
|
|
335
|
+
clearPendingCallbacks() {
|
|
336
|
+
this.#unlistenTransitionEnd?.();
|
|
337
|
+
this.#unlistenTransitionEnd = undefined;
|
|
350
338
|
}
|
|
351
|
-
|
|
352
|
-
if (this.#player?.hasStarted()) {
|
|
353
|
-
this.destroyPlayer();
|
|
354
|
-
}
|
|
339
|
+
setInitialState(visible) {
|
|
355
340
|
const host = this.#hostElement.nativeElement;
|
|
341
|
+
this.#renderer.addClass(host, 'collapse');
|
|
342
|
+
this.#renderer.removeClass(host, 'collapsing');
|
|
356
343
|
if (visible) {
|
|
357
|
-
this.#renderer.
|
|
344
|
+
this.#renderer.addClass(host, 'show');
|
|
345
|
+
}
|
|
346
|
+
else {
|
|
347
|
+
this.#renderer.removeClass(host, 'show');
|
|
358
348
|
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
349
|
+
}
|
|
350
|
+
runTransition(visible) {
|
|
351
|
+
this.clearPendingCallbacks();
|
|
352
|
+
const host = this.#hostElement.nativeElement;
|
|
362
353
|
const dimension = this.horizontal() ? 'width' : 'height';
|
|
363
354
|
const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
|
|
364
355
|
const scrollSize = `scroll${capitalizedDimension}`;
|
|
365
|
-
const
|
|
366
|
-
|
|
367
|
-
!visible && host.offsetHeight && host.style[dimension] && host.scrollHeight;
|
|
368
|
-
this.#renderer.setStyle(host, dimension, visible ? 0 : `${host.getBoundingClientRect()[dimension]}px`);
|
|
369
|
-
this.#player.onStart(() => {
|
|
356
|
+
const animate = this.animate();
|
|
357
|
+
if (visible) {
|
|
370
358
|
this.setMaxSize();
|
|
359
|
+
// Switch off `collapse`/`show` before we measure its scroll size below.
|
|
371
360
|
this.#renderer.removeClass(host, 'collapse');
|
|
361
|
+
this.#renderer.removeClass(host, 'show');
|
|
372
362
|
this.#renderer.addClass(host, 'collapsing');
|
|
363
|
+
this.collapseChange?.emit('opening');
|
|
364
|
+
// Reading scrollHeight/scrollWidth forces a synchronous reflow, committing the 0-size
|
|
365
|
+
// starting point before we set the target size below, so the browser animates the change.
|
|
366
|
+
const targetSize = host[scrollSize];
|
|
367
|
+
this.#renderer.setStyle(host, dimension, `${targetSize}px`);
|
|
368
|
+
}
|
|
369
|
+
else {
|
|
370
|
+
// Lock in the current pixel size first so the browser has a committed starting point,
|
|
371
|
+
// then switch to the collapsing state and clear it so the size can animate down to 0.
|
|
372
|
+
const startSize = host.getBoundingClientRect()[dimension];
|
|
373
|
+
this.#renderer.setStyle(host, dimension, `${startSize}px`);
|
|
374
|
+
// Force a reflow so the browser registers the starting size before the next style change.
|
|
375
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
376
|
+
host.offsetHeight;
|
|
377
|
+
this.#renderer.removeClass(host, 'collapse');
|
|
373
378
|
this.#renderer.removeClass(host, 'show');
|
|
374
|
-
this.#renderer.
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
this.#
|
|
379
|
+
this.#renderer.addClass(host, 'collapsing');
|
|
380
|
+
this.collapseChange?.emit('collapsing');
|
|
381
|
+
// Now that the starting size is committed, set the target size (0) so the browser
|
|
382
|
+
// animates the transition down.
|
|
383
|
+
this.#renderer.setStyle(host, dimension, '0px');
|
|
384
|
+
}
|
|
385
|
+
const finish = () => this.finishTransition(visible, host, dimension);
|
|
386
|
+
if (animate) {
|
|
387
|
+
this.#unlistenTransitionEnd = this.#renderer.listen(host, 'transitionend', (event) => {
|
|
388
|
+
// Ignore bubbled transitionend events from descendant elements.
|
|
389
|
+
if (event.target === host && event.propertyName === dimension) {
|
|
390
|
+
finish();
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
else {
|
|
395
|
+
finish();
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
finishTransition(visible, host, dimension) {
|
|
399
|
+
this.clearPendingCallbacks();
|
|
400
|
+
this.#renderer.removeClass(host, 'collapsing');
|
|
401
|
+
this.#renderer.addClass(host, 'collapse');
|
|
402
|
+
if (visible) {
|
|
403
|
+
this.#renderer.addClass(host, 'show');
|
|
404
|
+
}
|
|
405
|
+
else {
|
|
406
|
+
this.#renderer.removeClass(host, 'show');
|
|
407
|
+
}
|
|
408
|
+
this.#renderer.removeStyle(host, 'transition');
|
|
409
|
+
this.#renderer.removeStyle(host, dimension);
|
|
410
|
+
this.collapseChange?.emit(visible ? 'open' : 'collapsed');
|
|
411
|
+
this.visibleChange?.emit(visible);
|
|
396
412
|
}
|
|
397
413
|
setMaxSize() {
|
|
398
414
|
const host = this.#hostElement.nativeElement;
|
|
@@ -403,16 +419,16 @@ class CollapseDirective {
|
|
|
403
419
|
}
|
|
404
420
|
}
|
|
405
421
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CollapseDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
406
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.0", type: CollapseDirective, isStandalone: true, selector: "[cCollapse]", inputs: { animateInput: { classPropertyName: "animateInput", publicName: "animate", isSignal: true, isRequired: false, transformFunction: null }, horizontal: { classPropertyName: "horizontal", publicName: "horizontal", isSignal: true, isRequired: false, transformFunction: null }, visibleInput: { classPropertyName: "visibleInput", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null }, navbar: { classPropertyName: "navbar", publicName: "navbar", isSignal: true, isRequired: false, transformFunction: null }
|
|
422
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.0", type: CollapseDirective, isStandalone: true, selector: "[cCollapse]", inputs: { animateInput: { classPropertyName: "animateInput", publicName: "animate", isSignal: true, isRequired: false, transformFunction: null }, horizontal: { classPropertyName: "horizontal", publicName: "horizontal", isSignal: true, isRequired: false, transformFunction: null }, visibleInput: { classPropertyName: "visibleInput", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null }, navbar: { classPropertyName: "navbar", publicName: "navbar", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { visibleChange: "visibleChange", collapseChange: "collapseChange" }, host: { properties: { "class": "hostClasses()" } }, exportAs: ["cCollapse"], ngImport: i0 });
|
|
407
423
|
}
|
|
408
424
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CollapseDirective, decorators: [{
|
|
409
425
|
type: Directive,
|
|
410
426
|
args: [{
|
|
411
427
|
selector: '[cCollapse]',
|
|
412
428
|
exportAs: 'cCollapse',
|
|
413
|
-
host: { '[class]': 'hostClasses()'
|
|
429
|
+
host: { '[class]': 'hostClasses()' }
|
|
414
430
|
}]
|
|
415
|
-
}],
|
|
431
|
+
}], propDecorators: { animateInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "animate", required: false }] }], horizontal: [{ type: i0.Input, args: [{ isSignal: true, alias: "horizontal", required: false }] }], visibleInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "visible", required: false }] }], visibleChange: [{ type: i0.Output, args: ["visibleChange"] }], navbar: [{ type: i0.Input, args: [{ isSignal: true, alias: "navbar", required: false }] }], collapseChange: [{ type: i0.Output, args: ["collapseChange"] }] } });
|
|
416
432
|
|
|
417
433
|
class CollapseModule {
|
|
418
434
|
static forRoot() {
|
|
@@ -473,7 +489,7 @@ class AccordionItemComponent {
|
|
|
473
489
|
this.#accordionService.toggleItem(this);
|
|
474
490
|
}
|
|
475
491
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: AccordionItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
476
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.0", type: AccordionItemComponent, isStandalone: true, selector: "c-accordion-item", inputs: { visibleInput: { classPropertyName: "visibleInput", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "accordion-item" }, queries: [{ propertyName: "contentTemplates", predicate: TemplateIdDirective, descendants: true, isSignal: true }], exportAs: ["cAccordionItem"], ngImport: i0, template: "@let tmpl = templates();\n<ng-container>\n <div class=\"accordion-header\">\n <ng-container *ngTemplateOutlet=\"tmpl['accordionHeaderTemplate'] || defaultAccordionHeaderTemplate; context: itemContext\" />\n </div>\n <div class=\"accordion-collapse\" cCollapse [visible]=\"itemVisible()\" [attr.aria-expanded]=\"itemVisible()\" [id]=\"contentId\">\n <ng-container *ngTemplateOutlet=\"tmpl['accordionBodyTemplate'] || defaultAccordionBodyTemplate; context: itemContext\" />\n </div>\n</ng-container>\n\n<ng-template #defaultAccordionHeaderTemplate>\n <button cAccordionButton [collapsed]=\"!itemVisible()\" [attr.aria-controls]=\"contentId\" (click)=\"toggleItem()\">\n <ng-container *ngTemplateOutlet=\"tmpl['accordionHeader'] || defaultAccordionHeaderContentTemplate; context: itemContext\" />\n </button>\n</ng-template>\n\n<ng-template #defaultAccordionHeaderContentTemplate>\n <ng-content />\n</ng-template>\n\n<ng-template #defaultAccordionBodyTemplate>\n <div class=\"accordion-body\">\n <ng-container *ngTemplateOutlet=\"tmpl['accordionBody'] || defaultAccordionBodyContentTemplate; context: itemContext\" />\n </div>\n</ng-template>\n\n<ng-template #defaultAccordionBodyContentTemplate>\n <ng-content />\n</ng-template>\n", styles: [":host{display:block;overflow:hidden}\n"], dependencies: [{ kind: "directive", type: AccordionButtonDirective, selector: "[cAccordionButton]", inputs: ["collapsed", "type"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: CollapseDirective, selector: "[cCollapse]", inputs: ["animate", "horizontal", "visible", "navbar"
|
|
492
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.0", type: AccordionItemComponent, isStandalone: true, selector: "c-accordion-item", inputs: { visibleInput: { classPropertyName: "visibleInput", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "accordion-item" }, queries: [{ propertyName: "contentTemplates", predicate: TemplateIdDirective, descendants: true, isSignal: true }], exportAs: ["cAccordionItem"], ngImport: i0, template: "@let tmpl = templates();\n<ng-container>\n <div class=\"accordion-header\">\n <ng-container *ngTemplateOutlet=\"tmpl['accordionHeaderTemplate'] || defaultAccordionHeaderTemplate; context: itemContext\" />\n </div>\n <div class=\"accordion-collapse\" cCollapse [visible]=\"itemVisible()\" [attr.aria-expanded]=\"itemVisible()\" [id]=\"contentId\">\n <ng-container *ngTemplateOutlet=\"tmpl['accordionBodyTemplate'] || defaultAccordionBodyTemplate; context: itemContext\" />\n </div>\n</ng-container>\n\n<ng-template #defaultAccordionHeaderTemplate>\n <button cAccordionButton [collapsed]=\"!itemVisible()\" [attr.aria-controls]=\"contentId\" (click)=\"toggleItem()\">\n <ng-container *ngTemplateOutlet=\"tmpl['accordionHeader'] || defaultAccordionHeaderContentTemplate; context: itemContext\" />\n </button>\n</ng-template>\n\n<ng-template #defaultAccordionHeaderContentTemplate>\n <ng-content />\n</ng-template>\n\n<ng-template #defaultAccordionBodyTemplate>\n <div class=\"accordion-body\">\n <ng-container *ngTemplateOutlet=\"tmpl['accordionBody'] || defaultAccordionBodyContentTemplate; context: itemContext\" />\n </div>\n</ng-template>\n\n<ng-template #defaultAccordionBodyContentTemplate>\n <ng-content />\n</ng-template>\n", styles: [":host{display:block;overflow:hidden}\n"], dependencies: [{ kind: "directive", type: AccordionButtonDirective, selector: "[cAccordionButton]", inputs: ["collapsed", "type"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: CollapseDirective, selector: "[cCollapse]", inputs: ["animate", "horizontal", "visible", "navbar"], outputs: ["visibleChange", "collapseChange"], exportAs: ["cCollapse"] }] });
|
|
477
493
|
}
|
|
478
494
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: AccordionItemComponent, decorators: [{
|
|
479
495
|
type: Component,
|
|
@@ -699,6 +715,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
|
|
|
699
715
|
}] });
|
|
700
716
|
|
|
701
717
|
class AlertComponent {
|
|
718
|
+
#hostElement = inject(ElementRef);
|
|
719
|
+
#maxAnimationTimeout = inject(MAX_ANIMATION_TIMEOUT);
|
|
702
720
|
/**
|
|
703
721
|
* Sets the color context of the component to one of CoreUI’s themed colors.
|
|
704
722
|
* @return Colors
|
|
@@ -720,50 +738,42 @@ class AlertComponent {
|
|
|
720
738
|
variant = input(/* @ts-ignore */
|
|
721
739
|
...(ngDevMode ? [undefined, { debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
722
740
|
/**
|
|
723
|
-
* Optionally adds a close button to alert and allow it to self
|
|
741
|
+
* Optionally adds a close button to the alert and allow it to self-dismiss.
|
|
724
742
|
* @return boolean
|
|
725
743
|
* @default false
|
|
726
744
|
*/
|
|
727
|
-
|
|
728
|
-
#dismissible = linkedSignal({ ...(ngDevMode ? { debugName: "#dismissible" } : /* istanbul ignore next */ {}), source: this.dismissibleInput,
|
|
729
|
-
computation: (value) => {
|
|
730
|
-
return value;
|
|
731
|
-
} });
|
|
732
|
-
set dismissible(value) {
|
|
733
|
-
this.#dismissible.set(value);
|
|
734
|
-
}
|
|
735
|
-
get dismissible() {
|
|
736
|
-
return this.#dismissible();
|
|
737
|
-
}
|
|
745
|
+
dismissible = input(false, { ...(ngDevMode ? { debugName: "dismissible" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
738
746
|
/**
|
|
739
747
|
* Adds animation for dismissible alert.
|
|
740
748
|
* @return boolean
|
|
741
749
|
*/
|
|
742
750
|
fade = input(false, { ...(ngDevMode ? { debugName: "fade" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
743
751
|
/**
|
|
744
|
-
* Toggle the visibility of alert component.
|
|
752
|
+
* Toggle the visibility of the alert component.
|
|
745
753
|
* @return boolean
|
|
746
754
|
*/
|
|
747
755
|
visibleInput = input(true, { ...(ngDevMode ? { debugName: "visibleInput" } : /* istanbul ignore next */ {}), transform: booleanAttribute, alias: 'visible' });
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
return value;
|
|
751
|
-
} });
|
|
752
|
-
set visible(value) {
|
|
753
|
-
if (this.#visible() !== value) {
|
|
754
|
-
this.#visible.set(value);
|
|
755
|
-
this.visibleChange?.emit(value);
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
get visible() {
|
|
759
|
-
return this.#visible();
|
|
760
|
-
}
|
|
761
|
-
hide = signal(false, /* @ts-ignore */
|
|
762
|
-
...(ngDevMode ? [{ debugName: "hide" }] : /* istanbul ignore next */ []));
|
|
756
|
+
visible = linkedSignal(this.visibleInput, /* @ts-ignore */
|
|
757
|
+
...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
|
|
763
758
|
/**
|
|
764
|
-
* Event triggered on the alert
|
|
759
|
+
* Event triggered on the alert visibility change.
|
|
760
|
+
* @return boolean
|
|
765
761
|
*/
|
|
766
762
|
visibleChange = output();
|
|
763
|
+
hide = signal(false, /* @ts-ignore */
|
|
764
|
+
...(ngDevMode ? [{ debugName: "hide" }] : /* istanbul ignore next */ []));
|
|
765
|
+
#visibleEffect = effect(() => {
|
|
766
|
+
const visible = this.visible();
|
|
767
|
+
if (visible) {
|
|
768
|
+
this.hide.set(false);
|
|
769
|
+
}
|
|
770
|
+
}, /* @ts-ignore */
|
|
771
|
+
...(ngDevMode ? [{ debugName: "#visibleEffect" }] : /* istanbul ignore next */ []));
|
|
772
|
+
#hideEffect = effect(() => {
|
|
773
|
+
const hide = this.hide();
|
|
774
|
+
this.visibleChange.emit(!hide);
|
|
775
|
+
}, /* @ts-ignore */
|
|
776
|
+
...(ngDevMode ? [{ debugName: "#hideEffect" }] : /* istanbul ignore next */ []));
|
|
767
777
|
contentTemplates = contentChildren(TemplateIdDirective, { ...(ngDevMode ? { debugName: "contentTemplates" } : /* istanbul ignore next */ {}), descendants: true });
|
|
768
778
|
templates = computed(() => {
|
|
769
779
|
return this.contentTemplates().reduce((acc, child) => {
|
|
@@ -772,72 +782,58 @@ class AlertComponent {
|
|
|
772
782
|
}, {});
|
|
773
783
|
}, /* @ts-ignore */
|
|
774
784
|
...(ngDevMode ? [{ debugName: "templates" }] : /* istanbul ignore next */ []));
|
|
775
|
-
get animateType() {
|
|
776
|
-
return this.visible ? 'show' : 'hide';
|
|
777
|
-
}
|
|
778
785
|
hostClasses = computed(() => {
|
|
779
786
|
const color = this.color();
|
|
780
787
|
const variant = this.variant();
|
|
788
|
+
const visible = this.visible();
|
|
781
789
|
return {
|
|
782
790
|
alert: true,
|
|
783
|
-
'alert-dismissible': this.dismissible,
|
|
791
|
+
'alert-dismissible': this.dismissible(),
|
|
784
792
|
fade: this.fade(),
|
|
785
|
-
show:
|
|
793
|
+
show: visible,
|
|
794
|
+
'd-none': this.hide() && !visible,
|
|
786
795
|
[`alert-${color}`]: !!color && variant !== 'solid',
|
|
787
796
|
[`bg-${color}`]: !!color && variant === 'solid',
|
|
788
797
|
'text-white': !!color && variant === 'solid'
|
|
789
798
|
};
|
|
790
799
|
}, /* @ts-ignore */
|
|
791
800
|
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
onAnimationDone($event) {
|
|
796
|
-
this.onAnimationEvent($event);
|
|
797
|
-
}
|
|
798
|
-
onAnimationEvent(event) {
|
|
799
|
-
this.hide.set(event.phaseName === 'start' && event.toState === 'show');
|
|
800
|
-
if (event.phaseName === 'done') {
|
|
801
|
-
this.hide.set(event.toState === 'hide' || event.toState === 'void');
|
|
802
|
-
if (event.toState === 'show') {
|
|
801
|
+
onTransitionStart($event) {
|
|
802
|
+
if ($event.propertyName === 'opacity') {
|
|
803
|
+
if (this.visible()) {
|
|
803
804
|
this.hide.set(false);
|
|
804
805
|
}
|
|
805
806
|
}
|
|
806
807
|
}
|
|
808
|
+
onTransitionEnd($event) {
|
|
809
|
+
if ($event.propertyName === 'opacity') {
|
|
810
|
+
this.hide.set(!this.visible());
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
#leavingInProgress = false;
|
|
814
|
+
handleLeaving($event) {
|
|
815
|
+
if (this.#leavingInProgress)
|
|
816
|
+
return;
|
|
817
|
+
this.#leavingInProgress = true;
|
|
818
|
+
this.#hostElement.nativeElement.classList.remove('show');
|
|
819
|
+
setTimeout(() => {
|
|
820
|
+
$event.animationComplete();
|
|
821
|
+
}, this.#maxAnimationTimeout);
|
|
822
|
+
}
|
|
807
823
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: AlertComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
808
|
-
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 },
|
|
809
|
-
trigger('fadeInOut', [
|
|
810
|
-
state('show', style({ opacity: 1, height: '*', padding: '*', border: '*', margin: '*' })),
|
|
811
|
-
state('hide', style({ opacity: 0, height: 0, padding: 0, border: 0, margin: 0 })),
|
|
812
|
-
state('void', style({ opacity: 0, height: 0, padding: 0, border: 0, margin: 0 })),
|
|
813
|
-
transition('show => hide', [animate('.3s ease-out')]),
|
|
814
|
-
transition('hide => show', [animate('.3s ease-in')]),
|
|
815
|
-
transition('show => void', [animate('.3s ease-out')]),
|
|
816
|
-
transition('void => show', [animate('.3s ease-in')])
|
|
817
|
-
])
|
|
818
|
-
] });
|
|
824
|
+
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"] }] });
|
|
819
825
|
}
|
|
820
826
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: AlertComponent, decorators: [{
|
|
821
827
|
type: Component,
|
|
822
|
-
args: [{ selector: 'c-alert', exportAs: 'cAlert', imports: [NgTemplateOutlet, ButtonCloseDirective],
|
|
823
|
-
trigger('fadeInOut', [
|
|
824
|
-
state('show', style({ opacity: 1, height: '*', padding: '*', border: '*', margin: '*' })),
|
|
825
|
-
state('hide', style({ opacity: 0, height: 0, padding: 0, border: 0, margin: 0 })),
|
|
826
|
-
state('void', style({ opacity: 0, height: 0, padding: 0, border: 0, margin: 0 })),
|
|
827
|
-
transition('show => hide', [animate('.3s ease-out')]),
|
|
828
|
-
transition('hide => show', [animate('.3s ease-in')]),
|
|
829
|
-
transition('show => void', [animate('.3s ease-out')]),
|
|
830
|
-
transition('void => show', [animate('.3s ease-in')])
|
|
831
|
-
])
|
|
832
|
-
], host: {
|
|
833
|
-
'[@.disabled]': '!fade()',
|
|
834
|
-
'[@fadeInOut]': 'animateType',
|
|
828
|
+
args: [{ selector: 'c-alert', exportAs: 'cAlert', imports: [NgTemplateOutlet, ButtonCloseDirective], host: {
|
|
835
829
|
'[attr.role]': 'role()',
|
|
836
830
|
'[class]': 'hostClasses()',
|
|
837
|
-
'(
|
|
838
|
-
'(
|
|
839
|
-
|
|
840
|
-
|
|
831
|
+
'(animate.leave)': 'handleLeaving($event)',
|
|
832
|
+
'(transitionend)': 'onTransitionEnd($event)',
|
|
833
|
+
'(transitionstart)': 'onTransitionStart($event)',
|
|
834
|
+
'[attr.hidden]': 'hide() ? "" : null'
|
|
835
|
+
}, 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"] }]
|
|
836
|
+
}], 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 }] }] } });
|
|
841
837
|
|
|
842
838
|
class AlertModule {
|
|
843
839
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: AlertModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
@@ -5075,12 +5071,11 @@ class NavbarComponent {
|
|
|
5075
5071
|
if (!collapse) {
|
|
5076
5072
|
return;
|
|
5077
5073
|
}
|
|
5078
|
-
const animate = collapse.animate();
|
|
5079
5074
|
collapse.animate.set(false);
|
|
5080
5075
|
collapse.toggle(false);
|
|
5081
5076
|
setTimeout(() => {
|
|
5082
5077
|
collapse.toggle(result.matches);
|
|
5083
|
-
setTimeout(() => collapse.animate.set(
|
|
5078
|
+
setTimeout(() => collapse.animate.set(collapse.animateInput()));
|
|
5084
5079
|
});
|
|
5085
5080
|
});
|
|
5086
5081
|
onCleanup(() => subscription.unsubscribe());
|
|
@@ -5161,27 +5156,29 @@ class NavbarTogglerDirective {
|
|
|
5161
5156
|
}
|
|
5162
5157
|
/**
|
|
5163
5158
|
* Reference to navbar collapse element (via # template variable) . [docs]
|
|
5164
|
-
* @
|
|
5159
|
+
* @return string
|
|
5165
5160
|
* @default 'button'
|
|
5166
5161
|
*/
|
|
5167
5162
|
collapseRef = input(undefined, { ...(ngDevMode ? { debugName: "collapseRef" } : /* istanbul ignore next */ {}), alias: 'cNavbarToggler' });
|
|
5168
5163
|
/**
|
|
5169
5164
|
* Default type for navbar-toggler. [docs]
|
|
5170
|
-
* @
|
|
5165
|
+
* @return string
|
|
5171
5166
|
* @default 'button'
|
|
5172
5167
|
*/
|
|
5173
5168
|
type = input('button', /* @ts-ignore */
|
|
5174
5169
|
...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
|
|
5175
5170
|
/**
|
|
5176
5171
|
* Default aria-label attr for navbar-toggler. [docs]
|
|
5177
|
-
* @
|
|
5172
|
+
* @return string
|
|
5178
5173
|
* @default 'Toggle navigation'
|
|
5179
5174
|
*/
|
|
5180
5175
|
ariaLabel = input('Toggle navigation', /* @ts-ignore */
|
|
5181
5176
|
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
5182
5177
|
handleClick($event) {
|
|
5183
5178
|
const collapseRef = this.collapseRef();
|
|
5184
|
-
|
|
5179
|
+
if (collapseRef) {
|
|
5180
|
+
collapseRef?.toggle(!collapseRef?.visible());
|
|
5181
|
+
}
|
|
5185
5182
|
}
|
|
5186
5183
|
addDefaultIcon() {
|
|
5187
5184
|
const span = this.#renderer.createElement('span');
|