@coreui/angular 5.7.12 → 5.7.14
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 +315 -259
- package/fesm2022/coreui-angular.mjs.map +1 -1
- package/package.json +2 -2
- package/types/coreui-angular.d.ts +56 -45
|
@@ -1,7 +1,6 @@
|
|
|
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, group, query, trigger, state, transition, 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';
|
|
@@ -11,6 +10,7 @@ import { createPopper } from '@popperjs/core';
|
|
|
11
10
|
import * as i1$1 from '@angular/cdk/a11y';
|
|
12
11
|
import { FocusKeyManager, FocusMonitor, A11yModule } from '@angular/cdk/a11y';
|
|
13
12
|
import { BreakpointObserver } from '@angular/cdk/layout';
|
|
13
|
+
import { trigger, state, style, transition, animate } from '@angular/animations';
|
|
14
14
|
import { IconDirective } from '@coreui/icons-angular';
|
|
15
15
|
|
|
16
16
|
var BreakpointInfix;
|
|
@@ -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');
|
|
358
345
|
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
346
|
+
else {
|
|
347
|
+
this.#renderer.removeClass(host, 'show');
|
|
348
|
+
}
|
|
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,
|
|
@@ -2282,15 +2298,8 @@ class CarouselService {
|
|
|
2282
2298
|
setIndex(index) {
|
|
2283
2299
|
this.#carouselIndex.next(index);
|
|
2284
2300
|
}
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
}
|
|
2288
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselService, decorators: [{
|
|
2289
|
-
type: Injectable
|
|
2290
|
-
}] });
|
|
2291
|
-
|
|
2292
|
-
class CarouselState {
|
|
2293
|
-
#carouselService = inject(CarouselService);
|
|
2301
|
+
animating = signal(false, /* @ts-ignore */
|
|
2302
|
+
...(ngDevMode ? [{ debugName: "animating" }] : /* istanbul ignore next */ []));
|
|
2294
2303
|
#state = {
|
|
2295
2304
|
activeItemIndex: -1,
|
|
2296
2305
|
animate: true,
|
|
@@ -2309,7 +2318,7 @@ class CarouselState {
|
|
|
2309
2318
|
if (prevState.activeItemIndex !== nextState.activeItemIndex) {
|
|
2310
2319
|
const activeItemIndex = this.state.activeItemIndex || 0;
|
|
2311
2320
|
const itemInterval = (this.state.items && this.state.items[activeItemIndex]?.interval()) || -1;
|
|
2312
|
-
this
|
|
2321
|
+
this.setIndex({
|
|
2313
2322
|
active: nextState.activeItemIndex,
|
|
2314
2323
|
interval: itemInterval,
|
|
2315
2324
|
lastItemIndex: (nextState.items?.length ?? 0) - 1
|
|
@@ -2331,7 +2340,7 @@ class CarouselState {
|
|
|
2331
2340
|
}
|
|
2332
2341
|
}
|
|
2333
2342
|
setNextIndex(nextIndex) {
|
|
2334
|
-
this
|
|
2343
|
+
this.setIndex(nextIndex);
|
|
2335
2344
|
}
|
|
2336
2345
|
direction(direction = 'next') {
|
|
2337
2346
|
this.state = { direction };
|
|
@@ -2360,10 +2369,10 @@ class CarouselState {
|
|
|
2360
2369
|
interval: 0
|
|
2361
2370
|
};
|
|
2362
2371
|
}
|
|
2363
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type:
|
|
2364
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type:
|
|
2372
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2373
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselService });
|
|
2365
2374
|
}
|
|
2366
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type:
|
|
2375
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselService, decorators: [{
|
|
2367
2376
|
type: Injectable
|
|
2368
2377
|
}] });
|
|
2369
2378
|
|
|
@@ -2372,9 +2381,9 @@ class CarouselConfig {
|
|
|
2372
2381
|
activeIndex = 0;
|
|
2373
2382
|
/* Animate transition of slides */
|
|
2374
2383
|
animate = true;
|
|
2375
|
-
/* Default direction of auto
|
|
2384
|
+
/* Default direction of auto-changing of slides */
|
|
2376
2385
|
direction = 'next';
|
|
2377
|
-
/* Default interval of auto
|
|
2386
|
+
/* Default interval of auto-changing of slides */
|
|
2378
2387
|
interval;
|
|
2379
2388
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2380
2389
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselConfig, providedIn: 'root' });
|
|
@@ -2388,7 +2397,6 @@ class CarouselComponent {
|
|
|
2388
2397
|
config = inject(CarouselConfig);
|
|
2389
2398
|
#hostElement = inject(ElementRef);
|
|
2390
2399
|
#carouselService = inject(CarouselService);
|
|
2391
|
-
#carouselState = inject(CarouselState);
|
|
2392
2400
|
#intersectionService = inject(IntersectionService);
|
|
2393
2401
|
#listenersService = inject(ListenersService);
|
|
2394
2402
|
constructor() {
|
|
@@ -2396,7 +2404,7 @@ class CarouselComponent {
|
|
|
2396
2404
|
}
|
|
2397
2405
|
loadConfig() {
|
|
2398
2406
|
this.activeIndex.update((activeIndex) => this.config?.activeIndex ?? activeIndex);
|
|
2399
|
-
this.animate.update((animate) => this.config?.animate ?? animate);
|
|
2407
|
+
this.animate.update((animate) => (animate === false ? animate : (this.config?.animate ?? animate)));
|
|
2400
2408
|
this.direction.update((direction) => this.config?.direction ?? direction);
|
|
2401
2409
|
this.interval.update((interval) => this.config?.interval ?? interval);
|
|
2402
2410
|
}
|
|
@@ -2412,8 +2420,8 @@ class CarouselComponent {
|
|
|
2412
2420
|
* @return boolean
|
|
2413
2421
|
*/
|
|
2414
2422
|
animateInput = input(true, { ...(ngDevMode ? { debugName: "animateInput" } : /* istanbul ignore next */ {}), alias: 'animate' });
|
|
2415
|
-
animate = linkedSignal(
|
|
2416
|
-
|
|
2423
|
+
animate = linkedSignal(this.animateInput, /* @ts-ignore */
|
|
2424
|
+
...(ngDevMode ? [{ debugName: "animate" }] : /* istanbul ignore next */ []));
|
|
2417
2425
|
/**
|
|
2418
2426
|
* Carousel direction. [docs]
|
|
2419
2427
|
* @return {'next' | 'prev'}
|
|
@@ -2431,7 +2439,7 @@ class CarouselComponent {
|
|
|
2431
2439
|
computation: (value) => value });
|
|
2432
2440
|
#intervalEffect = effect(() => {
|
|
2433
2441
|
const interval = this.interval();
|
|
2434
|
-
this.#
|
|
2442
|
+
this.#carouselService.state = { interval: interval };
|
|
2435
2443
|
interval ? this.setTimer() : this.resetTimer();
|
|
2436
2444
|
}, /* @ts-ignore */
|
|
2437
2445
|
...(ngDevMode ? [{ debugName: "#intervalEffect" }] : /* istanbul ignore next */ []));
|
|
@@ -2449,7 +2457,7 @@ class CarouselComponent {
|
|
|
2449
2457
|
touch = input(true, /* @ts-ignore */
|
|
2450
2458
|
...(ngDevMode ? [{ debugName: "touch" }] : /* istanbul ignore next */ []));
|
|
2451
2459
|
/**
|
|
2452
|
-
* Set type of the transition.
|
|
2460
|
+
* Set the type of the transition.
|
|
2453
2461
|
* @return {'slide' | 'crossfade'}
|
|
2454
2462
|
* @default 'slide'
|
|
2455
2463
|
*/
|
|
@@ -2472,16 +2480,18 @@ class CarouselComponent {
|
|
|
2472
2480
|
swipeSubscription;
|
|
2473
2481
|
#destroyRef = inject(DestroyRef);
|
|
2474
2482
|
ngOnInit() {
|
|
2475
|
-
this.
|
|
2483
|
+
this.carouselServiceSubscribe();
|
|
2476
2484
|
}
|
|
2477
2485
|
ngOnDestroy() {
|
|
2478
2486
|
this.resetTimer();
|
|
2479
2487
|
this.clearListeners();
|
|
2480
2488
|
this.swipeSubscribe(false);
|
|
2489
|
+
// Ensure IntersectionObserver is cleaned up
|
|
2490
|
+
this.#intersectionService?.unobserve(this.#hostElement);
|
|
2481
2491
|
}
|
|
2482
2492
|
ngAfterContentInit() {
|
|
2483
2493
|
this.intersectionServiceSubscribe();
|
|
2484
|
-
this.#
|
|
2494
|
+
this.#carouselService.state = {
|
|
2485
2495
|
activeItemIndex: this.activeIndex(),
|
|
2486
2496
|
animate: this.animate(),
|
|
2487
2497
|
interval: this.interval(),
|
|
@@ -2519,8 +2529,8 @@ class CarouselComponent {
|
|
|
2519
2529
|
this.resetTimer();
|
|
2520
2530
|
if (interval > 0) {
|
|
2521
2531
|
this.timerId = setTimeout(() => {
|
|
2522
|
-
const nextIndex = this.#
|
|
2523
|
-
this.#
|
|
2532
|
+
const nextIndex = this.#carouselService.direction(direction);
|
|
2533
|
+
this.#carouselService.state = { activeItemIndex: nextIndex };
|
|
2524
2534
|
}, interval);
|
|
2525
2535
|
}
|
|
2526
2536
|
}
|
|
@@ -2528,7 +2538,7 @@ class CarouselComponent {
|
|
|
2528
2538
|
clearTimeout(this.timerId);
|
|
2529
2539
|
this.timerId = undefined;
|
|
2530
2540
|
}
|
|
2531
|
-
|
|
2541
|
+
carouselServiceSubscribe() {
|
|
2532
2542
|
this.#carouselService.carouselIndex$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((nextItem) => {
|
|
2533
2543
|
if ('active' in nextItem && typeof nextItem.active === 'number') {
|
|
2534
2544
|
this.itemChange?.emit(nextItem.active);
|
|
@@ -2545,7 +2555,7 @@ class CarouselComponent {
|
|
|
2545
2555
|
this.#intersectionService.createIntersectionObserver(this.#hostElement);
|
|
2546
2556
|
this.#intersectionService.intersecting$
|
|
2547
2557
|
.pipe(filter((next) => next.hostElement === this.#hostElement), finalize(() => {
|
|
2548
|
-
this.#intersectionService
|
|
2558
|
+
this.#intersectionService?.unobserve(this.#hostElement);
|
|
2549
2559
|
}), takeUntilDestroyed(this.#destroyRef))
|
|
2550
2560
|
.subscribe((next) => {
|
|
2551
2561
|
this.visible = next.isIntersecting;
|
|
@@ -2563,10 +2573,13 @@ class CarouselComponent {
|
|
|
2563
2573
|
.subscribe(([touchstart, [touchend, touchmove]]) => {
|
|
2564
2574
|
touchstart.stopPropagation();
|
|
2565
2575
|
touchmove.stopPropagation();
|
|
2576
|
+
if (this.#carouselService.animating()) {
|
|
2577
|
+
return;
|
|
2578
|
+
}
|
|
2566
2579
|
const distanceX = touchstart.touches[0]?.clientX - touchmove.touches[0]?.clientX || 0;
|
|
2567
2580
|
if (Math.abs(distanceX) > 0.3 * carouselElement.clientWidth && touchstart.timeStamp <= touchmove.timeStamp) {
|
|
2568
|
-
const nextIndex = this.#
|
|
2569
|
-
this.#
|
|
2581
|
+
const nextIndex = this.#carouselService.direction(distanceX > 0 ? 'next' : 'prev');
|
|
2582
|
+
this.#carouselService.state = { activeItemIndex: nextIndex };
|
|
2570
2583
|
}
|
|
2571
2584
|
});
|
|
2572
2585
|
}
|
|
@@ -2575,11 +2588,11 @@ class CarouselComponent {
|
|
|
2575
2588
|
}
|
|
2576
2589
|
}
|
|
2577
2590
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2578
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.0", type: CarouselComponent, isStandalone: true, selector: "c-carousel", inputs: { activeIndexInput: { classPropertyName: "activeIndexInput", publicName: "activeIndex", isSignal: true, isRequired: false, transformFunction: null }, animateInput: { classPropertyName: "animateInput", publicName: "animate", isSignal: true, isRequired: false, transformFunction: null }, directionInput: { classPropertyName: "directionInput", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, intervalInput: { classPropertyName: "intervalInput", publicName: "interval", isSignal: true, isRequired: false, transformFunction: null }, pause: { classPropertyName: "pause", publicName: "pause", isSignal: true, isRequired: false, transformFunction: null }, touch: { classPropertyName: "touch", publicName: "touch", isSignal: true, isRequired: false, transformFunction: null }, transition: { classPropertyName: "transition", publicName: "transition", isSignal: true, isRequired: false, transformFunction: null }, wrap: { classPropertyName: "wrap", publicName: "wrap", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemChange: "itemChange" }, host: { properties: { "class.carousel-fade": "transition() === \"crossfade\" && animate()" }, classAttribute: "carousel slide" }, providers: [CarouselService,
|
|
2591
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.0", type: CarouselComponent, isStandalone: true, selector: "c-carousel", inputs: { activeIndexInput: { classPropertyName: "activeIndexInput", publicName: "activeIndex", isSignal: true, isRequired: false, transformFunction: null }, animateInput: { classPropertyName: "animateInput", publicName: "animate", isSignal: true, isRequired: false, transformFunction: null }, directionInput: { classPropertyName: "directionInput", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, intervalInput: { classPropertyName: "intervalInput", publicName: "interval", isSignal: true, isRequired: false, transformFunction: null }, pause: { classPropertyName: "pause", publicName: "pause", isSignal: true, isRequired: false, transformFunction: null }, touch: { classPropertyName: "touch", publicName: "touch", isSignal: true, isRequired: false, transformFunction: null }, transition: { classPropertyName: "transition", publicName: "transition", isSignal: true, isRequired: false, transformFunction: null }, wrap: { classPropertyName: "wrap", publicName: "wrap", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemChange: "itemChange" }, host: { properties: { "class.carousel-fade": "transition() === \"crossfade\" && animate()" }, classAttribute: "carousel slide" }, providers: [CarouselService, ListenersService], exportAs: ["cCarousel"], hostDirectives: [{ directive: ThemeDirective, inputs: ["dark", "dark"] }], ngImport: i0, template: '<ng-content />', isInline: true, styles: [":host{display:block}\n"] });
|
|
2579
2592
|
}
|
|
2580
2593
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselComponent, decorators: [{
|
|
2581
2594
|
type: Component,
|
|
2582
|
-
args: [{ selector: 'c-carousel', template: '<ng-content />', providers: [CarouselService,
|
|
2595
|
+
args: [{ selector: 'c-carousel', template: '<ng-content />', providers: [CarouselService, ListenersService], hostDirectives: [{ directive: ThemeDirective, inputs: ['dark'] }], exportAs: 'cCarousel', host: {
|
|
2583
2596
|
class: 'carousel slide',
|
|
2584
2597
|
'[class.carousel-fade]': 'transition() === "crossfade" && animate()'
|
|
2585
2598
|
}, styles: [":host{display:block}\n"] }]
|
|
@@ -2597,7 +2610,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
|
|
|
2597
2610
|
}] });
|
|
2598
2611
|
|
|
2599
2612
|
class CarouselControlComponent {
|
|
2600
|
-
#
|
|
2613
|
+
#carouselService = inject(CarouselService);
|
|
2601
2614
|
/**
|
|
2602
2615
|
* Carousel control caption. [docs]
|
|
2603
2616
|
* @return string
|
|
@@ -2639,11 +2652,14 @@ class CarouselControlComponent {
|
|
|
2639
2652
|
}
|
|
2640
2653
|
}
|
|
2641
2654
|
onClick($event) {
|
|
2655
|
+
if (this.#carouselService.animating()) {
|
|
2656
|
+
return;
|
|
2657
|
+
}
|
|
2642
2658
|
this.#play();
|
|
2643
2659
|
}
|
|
2644
2660
|
#play(direction = this.direction()) {
|
|
2645
|
-
const nextIndex = this.#
|
|
2646
|
-
this.#
|
|
2661
|
+
const nextIndex = this.#carouselService.direction(direction);
|
|
2662
|
+
this.#carouselService.state = { activeItemIndex: nextIndex };
|
|
2647
2663
|
}
|
|
2648
2664
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2649
2665
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.0", type: CarouselControlComponent, isStandalone: true, selector: "c-carousel-control", inputs: { captionInput: { classPropertyName: "captionInput", publicName: "caption", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, role: { classPropertyName: "role", publicName: "role", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "keyup": "onKeyUp($event)", "click": "onClick($event)" }, properties: { "attr.role": "role()", "class": "hostClasses()" } }, exportAs: ["cCarouselControl"], ngImport: i0, template: "<ng-content>\n <span [attr.aria-hidden]=\"true\" [class]=\"carouselControlIconClass()\"></span>\n <span class=\"visually-hidden\">{{ caption() }}</span>\n</ng-content>\n" });
|
|
@@ -2661,7 +2677,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
|
|
|
2661
2677
|
class CarouselIndicatorsComponent {
|
|
2662
2678
|
#destroyRef = inject(DestroyRef);
|
|
2663
2679
|
#carouselService = inject(CarouselService);
|
|
2664
|
-
#carouselState = inject(CarouselState);
|
|
2665
2680
|
items = [];
|
|
2666
2681
|
active = signal(0, /* @ts-ignore */
|
|
2667
2682
|
...(ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []));
|
|
@@ -2675,16 +2690,19 @@ class CarouselIndicatorsComponent {
|
|
|
2675
2690
|
...(ngDevMode ? [{ debugName: "templates" }] : /* istanbul ignore next */ []));
|
|
2676
2691
|
ngOnInit() {
|
|
2677
2692
|
this.#carouselService.carouselIndex$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((nextIndex) => {
|
|
2678
|
-
this.items = this.#
|
|
2693
|
+
this.items = this.#carouselService?.state?.items?.map((item) => item.index) ?? [];
|
|
2679
2694
|
if ('active' in nextIndex) {
|
|
2680
2695
|
this.active.set(nextIndex.active ?? 0);
|
|
2681
2696
|
}
|
|
2682
2697
|
});
|
|
2683
2698
|
}
|
|
2684
2699
|
onClick(index) {
|
|
2700
|
+
if (this.#carouselService.animating()) {
|
|
2701
|
+
return;
|
|
2702
|
+
}
|
|
2685
2703
|
if (index !== this.active()) {
|
|
2686
2704
|
const direction = index < this.active() ? 'prev' : 'next';
|
|
2687
|
-
this.#
|
|
2705
|
+
this.#carouselService.state = { direction, activeItemIndex: index };
|
|
2688
2706
|
}
|
|
2689
2707
|
}
|
|
2690
2708
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselIndicatorsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -2696,19 +2714,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
|
|
|
2696
2714
|
}], propDecorators: { contentTemplates: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => TemplateIdDirective), { ...{ descendants: true }, isSignal: true }] }] } });
|
|
2697
2715
|
|
|
2698
2716
|
class CarouselItemComponent {
|
|
2717
|
+
#elementRef = inject((ElementRef));
|
|
2699
2718
|
#destroyRef = inject(DestroyRef);
|
|
2700
2719
|
#carouselService = inject(CarouselService);
|
|
2720
|
+
#timeoutId;
|
|
2721
|
+
#rafId;
|
|
2701
2722
|
index;
|
|
2702
2723
|
/**
|
|
2703
2724
|
* @ignore
|
|
2704
2725
|
*/
|
|
2705
2726
|
activeInput = input(false, { ...(ngDevMode ? { debugName: "activeInput" } : /* istanbul ignore next */ {}), transform: booleanAttribute, alias: 'active' });
|
|
2706
|
-
active = linkedSignal(
|
|
2707
|
-
|
|
2708
|
-
return value;
|
|
2709
|
-
} });
|
|
2727
|
+
active = linkedSignal(this.activeInput, /* @ts-ignore */
|
|
2728
|
+
...(ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []));
|
|
2710
2729
|
/**
|
|
2711
|
-
* Time delay before cycling to next item. If -1, uses carousel interval value.
|
|
2730
|
+
* Time delay before cycling to the next item. If -1, uses carousel interval value.
|
|
2712
2731
|
* @return number
|
|
2713
2732
|
* @default -1
|
|
2714
2733
|
*/
|
|
@@ -2722,102 +2741,119 @@ class CarouselItemComponent {
|
|
|
2722
2741
|
role = input('group', /* @ts-ignore */
|
|
2723
2742
|
...(ngDevMode ? [{ debugName: "role" }] : /* istanbul ignore next */ []));
|
|
2724
2743
|
constructor() {
|
|
2744
|
+
this.#elementRef.nativeElement.style.transition = '1ms';
|
|
2745
|
+
}
|
|
2746
|
+
ngOnInit() {
|
|
2747
|
+
console.log('OnInit', this.#carouselService.state.animate);
|
|
2725
2748
|
this.#carouselService.carouselIndex$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((nextIndex) => {
|
|
2726
2749
|
if ('active' in nextIndex) {
|
|
2750
|
+
console.log('#carouselService', this.#carouselService.state.animate, this.#elementRef.nativeElement.style.transition);
|
|
2751
|
+
if (this.#carouselService.state.animate && this.#elementRef.nativeElement.style.transition !== '') {
|
|
2752
|
+
this.#timeoutId = setTimeout(() => {
|
|
2753
|
+
this.#elementRef.nativeElement.style.transition = '';
|
|
2754
|
+
this.#timeoutId = undefined;
|
|
2755
|
+
}, 500);
|
|
2756
|
+
}
|
|
2757
|
+
this.prevActive.set(this.active());
|
|
2727
2758
|
this.active.set(nextIndex.active === this.index);
|
|
2728
2759
|
}
|
|
2729
2760
|
});
|
|
2761
|
+
// Clean up timeout on destroy
|
|
2762
|
+
this.#destroyRef.onDestroy(() => {
|
|
2763
|
+
if (this.#timeoutId !== undefined) {
|
|
2764
|
+
clearTimeout(this.#timeoutId);
|
|
2765
|
+
}
|
|
2766
|
+
if (this.#rafId !== undefined) {
|
|
2767
|
+
cancelAnimationFrame(this.#rafId);
|
|
2768
|
+
}
|
|
2769
|
+
});
|
|
2730
2770
|
}
|
|
2771
|
+
hostClasses = computed(() => {
|
|
2772
|
+
const order = this.orderClassName();
|
|
2773
|
+
const direction = this.directionClassName();
|
|
2774
|
+
return {
|
|
2775
|
+
active: this.activeClass(),
|
|
2776
|
+
[`${order}`]: !!order,
|
|
2777
|
+
[`${direction}`]: !!direction,
|
|
2778
|
+
'd-none': !this.activeClass() && !order && !direction
|
|
2779
|
+
};
|
|
2780
|
+
}, /* @ts-ignore */
|
|
2781
|
+
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
2782
|
+
prevActive = signal(false, /* @ts-ignore */
|
|
2783
|
+
...(ngDevMode ? [{ debugName: "prevActive" }] : /* istanbul ignore next */ []));
|
|
2784
|
+
activeClass = signal(false, /* @ts-ignore */
|
|
2785
|
+
...(ngDevMode ? [{ debugName: "activeClass" }] : /* istanbul ignore next */ []));
|
|
2786
|
+
orderClassName = signal('', /* @ts-ignore */
|
|
2787
|
+
...(ngDevMode ? [{ debugName: "orderClassName" }] : /* istanbul ignore next */ []));
|
|
2788
|
+
directionClassName = signal('', /* @ts-ignore */
|
|
2789
|
+
...(ngDevMode ? [{ debugName: "directionClassName" }] : /* istanbul ignore next */ []));
|
|
2790
|
+
#activeEffect = effect((OnCleanup) => {
|
|
2791
|
+
const active = this.active();
|
|
2792
|
+
const prevActive = untracked(this.prevActive);
|
|
2793
|
+
const direction = this.#carouselService.state?.direction;
|
|
2794
|
+
this.activeClass.set(prevActive);
|
|
2795
|
+
if (active) {
|
|
2796
|
+
this.orderClassName.set(`carousel-item-${direction}`);
|
|
2797
|
+
}
|
|
2798
|
+
if (prevActive || active) {
|
|
2799
|
+
if (this.#rafId) {
|
|
2800
|
+
cancelAnimationFrame(this.#rafId);
|
|
2801
|
+
}
|
|
2802
|
+
this.#rafId = requestAnimationFrame(() => {
|
|
2803
|
+
// reflow is necessary to proper transition
|
|
2804
|
+
void this.#elementRef.nativeElement.offsetHeight;
|
|
2805
|
+
this.directionClassName.set(`carousel-item-${direction === 'next' ? 'start' : 'end'}`);
|
|
2806
|
+
this.#rafId = undefined;
|
|
2807
|
+
});
|
|
2808
|
+
}
|
|
2809
|
+
const handleTransitionStart = () => {
|
|
2810
|
+
if (active) {
|
|
2811
|
+
this.#carouselService.animating.set(true);
|
|
2812
|
+
}
|
|
2813
|
+
};
|
|
2814
|
+
const handleTransitionEnd = () => {
|
|
2815
|
+
if (active) {
|
|
2816
|
+
this.#carouselService.animating.set(false);
|
|
2817
|
+
}
|
|
2818
|
+
this.directionClassName.set('');
|
|
2819
|
+
this.orderClassName.set('');
|
|
2820
|
+
this.activeClass.set(active);
|
|
2821
|
+
};
|
|
2822
|
+
this.#elementRef.nativeElement.addEventListener('transitionstart', handleTransitionStart);
|
|
2823
|
+
this.#elementRef.nativeElement.addEventListener('transitionend', handleTransitionEnd);
|
|
2824
|
+
OnCleanup(() => {
|
|
2825
|
+
this.#elementRef.nativeElement.removeEventListener('transitionstart', handleTransitionStart);
|
|
2826
|
+
this.#elementRef.nativeElement.removeEventListener('transitionend', handleTransitionEnd);
|
|
2827
|
+
});
|
|
2828
|
+
}, /* @ts-ignore */
|
|
2829
|
+
...(ngDevMode ? [{ debugName: "#activeEffect" }] : /* istanbul ignore next */ []));
|
|
2731
2830
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2732
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
2831
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.0", type: CarouselItemComponent, isStandalone: true, selector: "c-carousel-item", inputs: { activeInput: { classPropertyName: "activeInput", publicName: "active", isSignal: true, isRequired: false, transformFunction: null }, interval: { classPropertyName: "interval", publicName: "interval", isSignal: true, isRequired: false, transformFunction: null }, role: { classPropertyName: "role", publicName: "role", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "hostClasses()", "attr.role": "role()" }, classAttribute: "carousel-item" }, exportAs: ["cCarouselItem"], ngImport: i0, template: `
|
|
2832
|
+
<!-- @if (this.activeClass() || (this.orderClassName() && this.directionClassName())) {-->
|
|
2833
|
+
<ng-content />
|
|
2834
|
+
<!-- }-->
|
|
2835
|
+
`, isInline: true });
|
|
2733
2836
|
}
|
|
2734
2837
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselItemComponent, decorators: [{
|
|
2735
2838
|
type: Component,
|
|
2736
|
-
args: [{
|
|
2839
|
+
args: [{
|
|
2840
|
+
selector: 'c-carousel-item',
|
|
2841
|
+
template: `
|
|
2842
|
+
<!-- @if (this.activeClass() || (this.orderClassName() && this.directionClassName())) {-->
|
|
2843
|
+
<ng-content />
|
|
2844
|
+
<!-- }-->
|
|
2845
|
+
`,
|
|
2846
|
+
exportAs: 'cCarouselItem',
|
|
2847
|
+
host: {
|
|
2737
2848
|
class: 'carousel-item',
|
|
2738
|
-
'[class
|
|
2849
|
+
'[class]': 'hostClasses()',
|
|
2739
2850
|
'[attr.role]': 'role()'
|
|
2740
|
-
}
|
|
2851
|
+
}
|
|
2852
|
+
}]
|
|
2741
2853
|
}], ctorParameters: () => [], propDecorators: { activeInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "active", required: false }] }], interval: [{ type: i0.Input, args: [{ isSignal: true, alias: "interval", required: false }] }], role: [{ type: i0.Input, args: [{ isSignal: true, alias: "role", required: false }] }] } });
|
|
2742
2854
|
|
|
2743
|
-
function toSlideLeft(fromState, toState) {
|
|
2744
|
-
return toState.left === true && toState.type === 'slide';
|
|
2745
|
-
}
|
|
2746
|
-
function toSlideRight(fromState, toState) {
|
|
2747
|
-
return toState.left === false && toState.type === 'slide';
|
|
2748
|
-
}
|
|
2749
|
-
function toFadeLeft(fromState, toState) {
|
|
2750
|
-
return toState.left === true && toState.type !== 'slide';
|
|
2751
|
-
}
|
|
2752
|
-
function toFadeRight(fromState, toState) {
|
|
2753
|
-
return toState.left === false && toState.type !== 'slide';
|
|
2754
|
-
}
|
|
2755
|
-
const slideAnimationLeft = animation(group([
|
|
2756
|
-
query(':leave', [
|
|
2757
|
-
animate('0.6s ease-in-out', style({
|
|
2758
|
-
transform: 'translateX(-100%)'
|
|
2759
|
-
}))
|
|
2760
|
-
], { optional: true }),
|
|
2761
|
-
query(':enter', [
|
|
2762
|
-
style({
|
|
2763
|
-
transform: 'translateX(100%)'
|
|
2764
|
-
}),
|
|
2765
|
-
animate('0.6s ease-in-out', style('*'))
|
|
2766
|
-
], { optional: true })
|
|
2767
|
-
]));
|
|
2768
|
-
const slideAnimationRight = animation(group([
|
|
2769
|
-
query(':enter', [
|
|
2770
|
-
style({
|
|
2771
|
-
transform: 'translateX(-100%)'
|
|
2772
|
-
}),
|
|
2773
|
-
animate('0.6s ease-in-out', style('*'))
|
|
2774
|
-
], { optional: true }),
|
|
2775
|
-
query(':leave', [
|
|
2776
|
-
animate('0.6s ease-in-out', style({
|
|
2777
|
-
transform: 'translateX(100%)'
|
|
2778
|
-
}))
|
|
2779
|
-
], { optional: true })
|
|
2780
|
-
]));
|
|
2781
|
-
const fadeAnimationLeft = animation(group([
|
|
2782
|
-
query(':leave', [
|
|
2783
|
-
animate('0.9s ease-in-out', style({
|
|
2784
|
-
zIndex: 0,
|
|
2785
|
-
opacity: 0
|
|
2786
|
-
}))
|
|
2787
|
-
], { optional: true }),
|
|
2788
|
-
query(':enter', [
|
|
2789
|
-
style({
|
|
2790
|
-
zIndex: 1,
|
|
2791
|
-
opacity: 1
|
|
2792
|
-
}),
|
|
2793
|
-
animate('0.6s ease-in-out', style('*'))
|
|
2794
|
-
], { optional: true })
|
|
2795
|
-
]));
|
|
2796
|
-
const fadeAnimationRight = animation(group([
|
|
2797
|
-
query(':enter', [
|
|
2798
|
-
style({
|
|
2799
|
-
zIndex: 1,
|
|
2800
|
-
opacity: 1
|
|
2801
|
-
}),
|
|
2802
|
-
animate('0.6s ease-in-out', style('*'))
|
|
2803
|
-
], { optional: true }),
|
|
2804
|
-
query(':leave', [
|
|
2805
|
-
animate('0.9s ease-in-out', style({
|
|
2806
|
-
zIndex: 0,
|
|
2807
|
-
opacity: 0
|
|
2808
|
-
}))
|
|
2809
|
-
], { optional: true })
|
|
2810
|
-
]));
|
|
2811
|
-
const carouselPlay = trigger('carouselPlay', [
|
|
2812
|
-
state('*', style({ transform: 'translateX(0)', display: 'block', opacity: 1 })),
|
|
2813
|
-
transition(toFadeLeft, useAnimation(fadeAnimationLeft)),
|
|
2814
|
-
transition(toFadeRight, useAnimation(fadeAnimationRight)),
|
|
2815
|
-
transition(toSlideLeft, useAnimation(slideAnimationLeft)),
|
|
2816
|
-
transition(toSlideRight, useAnimation(slideAnimationRight))
|
|
2817
|
-
]);
|
|
2818
|
-
|
|
2819
2855
|
class CarouselInnerComponent {
|
|
2820
|
-
#
|
|
2856
|
+
#carouselService = inject(CarouselService);
|
|
2821
2857
|
activeIndex = signal(undefined, /* @ts-ignore */
|
|
2822
2858
|
...(ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []));
|
|
2823
2859
|
animate = signal(true, /* @ts-ignore */
|
|
@@ -2845,7 +2881,7 @@ class CarouselInnerComponent {
|
|
|
2845
2881
|
}
|
|
2846
2882
|
ngAfterContentChecked() {
|
|
2847
2883
|
this.setItems();
|
|
2848
|
-
const state = this.#
|
|
2884
|
+
const state = this.#carouselService?.state;
|
|
2849
2885
|
const nextIndex = state?.activeItemIndex;
|
|
2850
2886
|
const nextDirection = state?.direction;
|
|
2851
2887
|
if (this.activeIndex() !== nextIndex) {
|
|
@@ -2860,18 +2896,16 @@ class CarouselInnerComponent {
|
|
|
2860
2896
|
const contentItems = this.contentItems();
|
|
2861
2897
|
if (this.#prevContentItems() !== contentItems) {
|
|
2862
2898
|
this.#prevContentItems.set([...contentItems]);
|
|
2863
|
-
this.#
|
|
2899
|
+
this.#carouselService.setItems(contentItems);
|
|
2864
2900
|
}
|
|
2865
2901
|
}
|
|
2866
2902
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselInnerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2867
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.0", type: CarouselInnerComponent, isStandalone: true, selector: "c-carousel-inner", host: { properties: { "
|
|
2903
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.0", type: CarouselInnerComponent, isStandalone: true, selector: "c-carousel-inner", host: { properties: { "attr.aria-live": "ariaLive()" }, classAttribute: "carousel-inner" }, queries: [{ propertyName: "contentItems", predicate: CarouselItemComponent, isSignal: true }], ngImport: i0, template: '<ng-content />', isInline: true, styles: [":host{display:block}\n"] });
|
|
2868
2904
|
}
|
|
2869
2905
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselInnerComponent, decorators: [{
|
|
2870
2906
|
type: Component,
|
|
2871
|
-
args: [{ selector: 'c-carousel-inner',
|
|
2907
|
+
args: [{ selector: 'c-carousel-inner', template: '<ng-content />', host: {
|
|
2872
2908
|
class: 'carousel-inner',
|
|
2873
|
-
'[@carouselPlay]': 'slideType()',
|
|
2874
|
-
'[@.disabled]': '!animate()',
|
|
2875
2909
|
'[attr.aria-live]': 'ariaLive()'
|
|
2876
2910
|
}, styles: [":host{display:block}\n"] }]
|
|
2877
2911
|
}], propDecorators: { contentItems: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CarouselItemComponent), { isSignal: true }] }] } });
|
|
@@ -2892,7 +2926,7 @@ class CarouselModule {
|
|
|
2892
2926
|
CarouselIndicatorsComponent,
|
|
2893
2927
|
CarouselInnerComponent,
|
|
2894
2928
|
CarouselItemComponent] });
|
|
2895
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselModule, providers: [CarouselService,
|
|
2929
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselModule, providers: [CarouselService, CarouselConfig] });
|
|
2896
2930
|
}
|
|
2897
2931
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CarouselModule, decorators: [{
|
|
2898
2932
|
type: NgModule,
|
|
@@ -2905,7 +2939,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
|
|
|
2905
2939
|
CarouselInnerComponent,
|
|
2906
2940
|
CarouselItemComponent
|
|
2907
2941
|
],
|
|
2908
|
-
providers: [CarouselService,
|
|
2942
|
+
providers: [CarouselService, CarouselConfig],
|
|
2909
2943
|
exports: [
|
|
2910
2944
|
CarouselComponent,
|
|
2911
2945
|
CarouselCaptionComponent,
|
|
@@ -5055,12 +5089,11 @@ class NavbarComponent {
|
|
|
5055
5089
|
if (!collapse) {
|
|
5056
5090
|
return;
|
|
5057
5091
|
}
|
|
5058
|
-
const animate = collapse.animate();
|
|
5059
5092
|
collapse.animate.set(false);
|
|
5060
5093
|
collapse.toggle(false);
|
|
5061
5094
|
setTimeout(() => {
|
|
5062
5095
|
collapse.toggle(result.matches);
|
|
5063
|
-
setTimeout(() => collapse.animate.set(
|
|
5096
|
+
setTimeout(() => collapse.animate.set(collapse.animateInput()));
|
|
5064
5097
|
});
|
|
5065
5098
|
});
|
|
5066
5099
|
onCleanup(() => subscription.unsubscribe());
|
|
@@ -5141,27 +5174,29 @@ class NavbarTogglerDirective {
|
|
|
5141
5174
|
}
|
|
5142
5175
|
/**
|
|
5143
5176
|
* Reference to navbar collapse element (via # template variable) . [docs]
|
|
5144
|
-
* @
|
|
5177
|
+
* @return string
|
|
5145
5178
|
* @default 'button'
|
|
5146
5179
|
*/
|
|
5147
5180
|
collapseRef = input(undefined, { ...(ngDevMode ? { debugName: "collapseRef" } : /* istanbul ignore next */ {}), alias: 'cNavbarToggler' });
|
|
5148
5181
|
/**
|
|
5149
5182
|
* Default type for navbar-toggler. [docs]
|
|
5150
|
-
* @
|
|
5183
|
+
* @return string
|
|
5151
5184
|
* @default 'button'
|
|
5152
5185
|
*/
|
|
5153
5186
|
type = input('button', /* @ts-ignore */
|
|
5154
5187
|
...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
|
|
5155
5188
|
/**
|
|
5156
5189
|
* Default aria-label attr for navbar-toggler. [docs]
|
|
5157
|
-
* @
|
|
5190
|
+
* @return string
|
|
5158
5191
|
* @default 'Toggle navigation'
|
|
5159
5192
|
*/
|
|
5160
5193
|
ariaLabel = input('Toggle navigation', /* @ts-ignore */
|
|
5161
5194
|
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
5162
5195
|
handleClick($event) {
|
|
5163
5196
|
const collapseRef = this.collapseRef();
|
|
5164
|
-
|
|
5197
|
+
if (collapseRef) {
|
|
5198
|
+
collapseRef?.toggle(!collapseRef?.visible());
|
|
5199
|
+
}
|
|
5165
5200
|
}
|
|
5166
5201
|
addDefaultIcon() {
|
|
5167
5202
|
const span = this.#renderer.createElement('span');
|
|
@@ -8825,85 +8860,116 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
|
|
|
8825
8860
|
}]
|
|
8826
8861
|
}] });
|
|
8827
8862
|
|
|
8863
|
+
const getTransitionDurationFromElement = (element) => {
|
|
8864
|
+
if (!element) {
|
|
8865
|
+
return 0;
|
|
8866
|
+
}
|
|
8867
|
+
// Get transition-duration of the element
|
|
8868
|
+
let { transitionDuration, transitionDelay } = window.getComputedStyle(element);
|
|
8869
|
+
const floatTransitionDuration = Number.parseFloat(transitionDuration);
|
|
8870
|
+
const floatTransitionDelay = Number.parseFloat(transitionDelay);
|
|
8871
|
+
// Return 0 if element or transition duration is not found
|
|
8872
|
+
if (!floatTransitionDuration && !floatTransitionDelay) {
|
|
8873
|
+
return 0;
|
|
8874
|
+
}
|
|
8875
|
+
// If multiple durations are defined, take the first
|
|
8876
|
+
transitionDuration = transitionDuration.split(',')[0];
|
|
8877
|
+
transitionDelay = transitionDelay.split(',')[0];
|
|
8878
|
+
return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * 1000;
|
|
8879
|
+
};
|
|
8880
|
+
|
|
8828
8881
|
class TabPanelComponent {
|
|
8829
|
-
tabsService = inject(TabsService);
|
|
8882
|
+
#tabsService = inject(TabsService);
|
|
8883
|
+
#elementRef = inject(ElementRef);
|
|
8830
8884
|
/**
|
|
8831
8885
|
* aria-labelledby attribute
|
|
8832
|
-
* @
|
|
8886
|
+
* @return string
|
|
8833
8887
|
* @default undefined
|
|
8834
8888
|
*/
|
|
8835
8889
|
ariaLabelledBy = input(undefined, { ...(ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {}), alias: 'aria-labelledby' });
|
|
8836
8890
|
/**
|
|
8837
8891
|
* Element id attribute
|
|
8838
|
-
* @
|
|
8892
|
+
* @return string
|
|
8839
8893
|
* @default undefined
|
|
8840
8894
|
*/
|
|
8841
8895
|
id = input(/* @ts-ignore */
|
|
8842
8896
|
...(ngDevMode ? [undefined, { debugName: "id" }] : /* istanbul ignore next */ []));
|
|
8843
8897
|
/**
|
|
8844
8898
|
* Item key.
|
|
8845
|
-
* @
|
|
8899
|
+
* @return string | number
|
|
8846
8900
|
* @required
|
|
8847
8901
|
*/
|
|
8848
8902
|
itemKey = input.required(/* @ts-ignore */
|
|
8849
8903
|
...(ngDevMode ? [{ debugName: "itemKey" }] : /* istanbul ignore next */ []));
|
|
8850
8904
|
/**
|
|
8851
8905
|
* Element role.
|
|
8852
|
-
* @
|
|
8906
|
+
* @return string
|
|
8853
8907
|
* @default 'tabpanel'
|
|
8854
8908
|
*/
|
|
8855
8909
|
role = input('tabpanel', /* @ts-ignore */
|
|
8856
8910
|
...(ngDevMode ? [{ debugName: "role" }] : /* istanbul ignore next */ []));
|
|
8857
8911
|
/**
|
|
8858
8912
|
* tabindex attribute.
|
|
8859
|
-
* @
|
|
8913
|
+
* @return number
|
|
8860
8914
|
* @default 0
|
|
8861
8915
|
*/
|
|
8862
8916
|
tabindex = input(0, { ...(ngDevMode ? { debugName: "tabindex" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
8863
8917
|
/**
|
|
8864
8918
|
* Enable fade in transition.
|
|
8865
|
-
* @
|
|
8919
|
+
* @return boolean
|
|
8866
8920
|
* @default true
|
|
8867
8921
|
*/
|
|
8868
8922
|
transition = input(true, /* @ts-ignore */
|
|
8869
8923
|
...(ngDevMode ? [{ debugName: "transition" }] : /* istanbul ignore next */ []));
|
|
8870
8924
|
/**
|
|
8871
8925
|
* visible change output
|
|
8872
|
-
* @
|
|
8926
|
+
* @return VisibleChangeEvent
|
|
8873
8927
|
*/
|
|
8874
8928
|
visibleChange = output();
|
|
8875
8929
|
show = signal(false, /* @ts-ignore */
|
|
8876
8930
|
...(ngDevMode ? [{ debugName: "show" }] : /* istanbul ignore next */ []));
|
|
8877
8931
|
visible = computed(() => {
|
|
8878
|
-
const visible = this
|
|
8932
|
+
const visible = this.#tabsService.activeItemKey() === this.itemKey() && !this.#tabsService.activeItem()?.disabled;
|
|
8879
8933
|
this.visibleChange?.emit({ itemKey: this.itemKey(), visible });
|
|
8880
8934
|
return visible;
|
|
8881
8935
|
}, /* @ts-ignore */
|
|
8882
8936
|
...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
|
|
8883
|
-
|
|
8937
|
+
#transitionDuration = 0;
|
|
8938
|
+
#visibleEffect = effect(() => {
|
|
8939
|
+
const isVisible = this.visible();
|
|
8940
|
+
const hasTransition = this.transition();
|
|
8941
|
+
if (!hasTransition) {
|
|
8942
|
+
this.show.set(isVisible);
|
|
8943
|
+
}
|
|
8944
|
+
else {
|
|
8945
|
+
requestAnimationFrame(() => {
|
|
8946
|
+
if (this.#transitionDuration === 0) {
|
|
8947
|
+
this.#transitionDuration = getTransitionDurationFromElement(this.#elementRef.nativeElement);
|
|
8948
|
+
}
|
|
8949
|
+
setTimeout(() => this.show.set(isVisible), this.#transitionDuration || 0);
|
|
8950
|
+
});
|
|
8951
|
+
}
|
|
8952
|
+
}, /* @ts-ignore */
|
|
8953
|
+
...(ngDevMode ? [{ debugName: "#visibleEffect" }] : /* istanbul ignore next */ []));
|
|
8954
|
+
propId = computed(() => this.id() ?? `${this.#tabsService.id()}-panel-${this.itemKey()}`, /* @ts-ignore */
|
|
8884
8955
|
...(ngDevMode ? [{ debugName: "propId" }] : /* istanbul ignore next */ []));
|
|
8885
|
-
attrAriaLabelledBy = computed(() => this.ariaLabelledBy() ?? `${this
|
|
8956
|
+
attrAriaLabelledBy = computed(() => this.ariaLabelledBy() ?? `${this.#tabsService.id()}-tab-${this.itemKey()}`, /* @ts-ignore */
|
|
8886
8957
|
...(ngDevMode ? [{ debugName: "attrAriaLabelledBy" }] : /* istanbul ignore next */ []));
|
|
8887
8958
|
hostClasses = computed(() => ({
|
|
8888
8959
|
'tab-pane': true,
|
|
8889
|
-
active: this.
|
|
8960
|
+
active: this.visible(),
|
|
8890
8961
|
fade: this.transition(),
|
|
8891
8962
|
show: this.show(),
|
|
8892
|
-
invisible: this
|
|
8963
|
+
invisible: this.#tabsService.activeItem()?.disabled
|
|
8893
8964
|
}), /* @ts-ignore */
|
|
8894
8965
|
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
8895
|
-
|
|
8896
|
-
|
|
8966
|
+
onTransitionEnd($event) {
|
|
8967
|
+
if ($event.propertyName === 'opacity' && $event.target === this.#elementRef.nativeElement) {
|
|
8968
|
+
this.show.set(this.visible());
|
|
8969
|
+
}
|
|
8897
8970
|
}
|
|
8898
8971
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: TabPanelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
8899
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.0", type: TabPanelComponent, isStandalone: true, selector: "c-tab-panel", inputs: { ariaLabelledBy: { classPropertyName: "ariaLabelledBy", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, itemKey: { classPropertyName: "itemKey", publicName: "itemKey", isSignal: true, isRequired: true, transformFunction: null }, role: { classPropertyName: "role", publicName: "role", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null }, transition: { classPropertyName: "transition", publicName: "transition", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { visibleChange: "visibleChange" }, host: { listeners: { "
|
|
8900
|
-
trigger('fadeInOut', [
|
|
8901
|
-
state('show', style({ opacity: 1 })),
|
|
8902
|
-
state('hide', style({ opacity: 0 })),
|
|
8903
|
-
state('void', style({ opacity: 1 })),
|
|
8904
|
-
transition('* => *', [query('@*', [animateChild()], { optional: true }), animate('150ms linear')])
|
|
8905
|
-
])
|
|
8906
|
-
] });
|
|
8972
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.0", type: TabPanelComponent, isStandalone: true, selector: "c-tab-panel", inputs: { ariaLabelledBy: { classPropertyName: "ariaLabelledBy", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, itemKey: { classPropertyName: "itemKey", publicName: "itemKey", isSignal: true, isRequired: true, transformFunction: null }, role: { classPropertyName: "role", publicName: "role", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null }, transition: { classPropertyName: "transition", publicName: "transition", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { visibleChange: "visibleChange" }, host: { listeners: { "transitionend": "onTransitionEnd($event)" }, properties: { "class": "hostClasses()", "tabindex": "visible() ? tabindex() : -1", "attr.aria-labelledby": "attrAriaLabelledBy()", "id": "propId()", "attr.role": "role()" } }, exportAs: ["cTabPanel"], ngImport: i0, template: '<ng-content />', isInline: true });
|
|
8907
8973
|
}
|
|
8908
8974
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: TabPanelComponent, decorators: [{
|
|
8909
8975
|
type: Component,
|
|
@@ -8917,18 +8983,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
|
|
|
8917
8983
|
'[attr.aria-labelledby]': 'attrAriaLabelledBy()',
|
|
8918
8984
|
'[id]': 'propId()',
|
|
8919
8985
|
'[attr.role]': 'role()',
|
|
8920
|
-
'
|
|
8921
|
-
|
|
8922
|
-
'(@fadeInOut.done)': 'onAnimationDone($event)'
|
|
8923
|
-
},
|
|
8924
|
-
animations: [
|
|
8925
|
-
trigger('fadeInOut', [
|
|
8926
|
-
state('show', style({ opacity: 1 })),
|
|
8927
|
-
state('hide', style({ opacity: 0 })),
|
|
8928
|
-
state('void', style({ opacity: 1 })),
|
|
8929
|
-
transition('* => *', [query('@*', [animateChild()], { optional: true }), animate('150ms linear')])
|
|
8930
|
-
])
|
|
8931
|
-
]
|
|
8986
|
+
'(transitionend)': 'onTransitionEnd($event)'
|
|
8987
|
+
}
|
|
8932
8988
|
}]
|
|
8933
8989
|
}], propDecorators: { ariaLabelledBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], itemKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemKey", required: true }] }], role: [{ type: i0.Input, args: [{ isSignal: true, alias: "role", required: false }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }], transition: [{ type: i0.Input, args: [{ isSignal: true, alias: "transition", required: false }] }], visibleChange: [{ type: i0.Output, args: ["visibleChange"] }] } });
|
|
8934
8990
|
|