cmat 0.0.78 → 0.0.79
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/cmat-components-adapter.mjs +9 -46
- package/fesm2022/cmat-components-adapter.mjs.map +1 -1
- package/fesm2022/cmat-components-breadcrumb.mjs +104 -205
- package/fesm2022/cmat-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/cmat-components-card.mjs +4 -8
- package/fesm2022/cmat-components-card.mjs.map +1 -1
- package/fesm2022/cmat-components-carousel.mjs +12 -12
- package/fesm2022/cmat-components-cascade.mjs +14 -20
- package/fesm2022/cmat-components-cascade.mjs.map +1 -1
- package/fesm2022/cmat-components-chip-input.mjs +21 -21
- package/fesm2022/cmat-components-chip-input.mjs.map +1 -1
- package/fesm2022/cmat-components-code-editor.mjs +4 -22
- package/fesm2022/cmat-components-code-editor.mjs.map +1 -1
- package/fesm2022/cmat-components-custom-formly.mjs +153 -220
- package/fesm2022/cmat-components-custom-formly.mjs.map +1 -1
- package/fesm2022/cmat-components-date-range.mjs +5 -177
- package/fesm2022/cmat-components-date-range.mjs.map +1 -1
- package/fesm2022/cmat-components-date-time-display.mjs +3 -15
- package/fesm2022/cmat-components-date-time-display.mjs.map +1 -1
- package/fesm2022/cmat-components-drawer.mjs +6 -96
- package/fesm2022/cmat-components-drawer.mjs.map +1 -1
- package/fesm2022/cmat-components-empty-state.mjs +4 -25
- package/fesm2022/cmat-components-empty-state.mjs.map +1 -1
- package/fesm2022/cmat-components-file-preview.mjs +3 -21
- package/fesm2022/cmat-components-file-preview.mjs.map +1 -1
- package/fesm2022/cmat-components-filter-toolbar.mjs +7 -50
- package/fesm2022/cmat-components-filter-toolbar.mjs.map +1 -1
- package/fesm2022/cmat-components-form-actions.mjs +3 -9
- package/fesm2022/cmat-components-form-actions.mjs.map +1 -1
- package/fesm2022/cmat-components-fullscreen.mjs +4 -4
- package/fesm2022/cmat-components-fullscreen.mjs.map +1 -1
- package/fesm2022/cmat-components-highlight.mjs +6 -31
- package/fesm2022/cmat-components-highlight.mjs.map +1 -1
- package/fesm2022/cmat-components-image-viewer.mjs +3 -12
- package/fesm2022/cmat-components-image-viewer.mjs.map +1 -1
- package/fesm2022/cmat-components-inline-loading.mjs +3 -12
- package/fesm2022/cmat-components-inline-loading.mjs.map +1 -1
- package/fesm2022/cmat-components-json-editor.mjs +10 -13
- package/fesm2022/cmat-components-json-editor.mjs.map +1 -1
- package/fesm2022/cmat-components-knob-input.mjs +18 -12
- package/fesm2022/cmat-components-knob-input.mjs.map +1 -1
- package/fesm2022/cmat-components-masonry.mjs +3 -9
- package/fesm2022/cmat-components-masonry.mjs.map +1 -1
- package/fesm2022/cmat-components-material-color-picker.mjs +3 -23
- package/fesm2022/cmat-components-material-color-picker.mjs.map +1 -1
- package/fesm2022/cmat-components-material-datetimepicker.mjs +49 -397
- package/fesm2022/cmat-components-material-datetimepicker.mjs.map +1 -1
- package/fesm2022/cmat-components-navigation.mjs +183 -725
- package/fesm2022/cmat-components-navigation.mjs.map +1 -1
- package/fesm2022/cmat-components-opt-input.mjs +7 -10
- package/fesm2022/cmat-components-opt-input.mjs.map +1 -1
- package/fesm2022/cmat-components-org-chart.mjs +11 -11
- package/fesm2022/cmat-components-org-chart.mjs.map +1 -1
- package/fesm2022/cmat-components-page-header.mjs +8 -19
- package/fesm2022/cmat-components-page-header.mjs.map +1 -1
- package/fesm2022/cmat-components-pagination.mjs +96 -93
- package/fesm2022/cmat-components-pagination.mjs.map +1 -1
- package/fesm2022/cmat-components-password-strength.mjs +10 -11
- package/fesm2022/cmat-components-password-strength.mjs.map +1 -1
- package/fesm2022/cmat-components-popover.mjs +15 -149
- package/fesm2022/cmat-components-popover.mjs.map +1 -1
- package/fesm2022/cmat-components-progress-bar.mjs +9 -16
- package/fesm2022/cmat-components-progress-bar.mjs.map +1 -1
- package/fesm2022/cmat-components-qrcode.mjs +5 -11
- package/fesm2022/cmat-components-qrcode.mjs.map +1 -1
- package/fesm2022/cmat-components-rating.mjs +3 -3
- package/fesm2022/cmat-components-rich-text-editor.mjs +4 -25
- package/fesm2022/cmat-components-rich-text-editor.mjs.map +1 -1
- package/fesm2022/cmat-components-select-search.mjs +46 -72
- package/fesm2022/cmat-components-select-search.mjs.map +1 -1
- package/fesm2022/cmat-components-select-table.mjs +193 -150
- package/fesm2022/cmat-components-select-table.mjs.map +1 -1
- package/fesm2022/cmat-components-select-tree.mjs +124 -78
- package/fesm2022/cmat-components-select-tree.mjs.map +1 -1
- package/fesm2022/cmat-components-skeleton.mjs +4 -22
- package/fesm2022/cmat-components-skeleton.mjs.map +1 -1
- package/fesm2022/cmat-components-speed-dial.mjs +9 -11
- package/fesm2022/cmat-components-speed-dial.mjs.map +1 -1
- package/fesm2022/cmat-components-status-tag.mjs +3 -18
- package/fesm2022/cmat-components-status-tag.mjs.map +1 -1
- package/fesm2022/cmat-components-table-toolbar.mjs +3 -15
- package/fesm2022/cmat-components-table-toolbar.mjs.map +1 -1
- package/fesm2022/cmat-components-timeline.mjs +18 -21
- package/fesm2022/cmat-components-timeline.mjs.map +1 -1
- package/fesm2022/cmat-components-toast.mjs +16 -14
- package/fesm2022/cmat-components-toast.mjs.map +1 -1
- package/fesm2022/cmat-components-transfer-picker.mjs +103 -80
- package/fesm2022/cmat-components-transfer-picker.mjs.map +1 -1
- package/fesm2022/cmat-components-treetable.mjs +6 -6
- package/fesm2022/cmat-components-upload.mjs +21 -36
- package/fesm2022/cmat-components-upload.mjs.map +1 -1
- package/fesm2022/cmat-components-x6-angular-shape.mjs +0 -1
- package/fesm2022/cmat-components-x6-angular-shape.mjs.map +1 -1
- package/fesm2022/cmat-directives-animate-on-scroll.mjs +6 -27
- package/fesm2022/cmat-directives-animate-on-scroll.mjs.map +1 -1
- package/fesm2022/cmat-directives-arrow-cursor.mjs +7 -9
- package/fesm2022/cmat-directives-arrow-cursor.mjs.map +1 -1
- package/fesm2022/cmat-directives-autofocus.mjs +3 -3
- package/fesm2022/cmat-directives-data-exporter.mjs +24 -33
- package/fesm2022/cmat-directives-data-exporter.mjs.map +1 -1
- package/fesm2022/cmat-directives-debounce.mjs +14 -17
- package/fesm2022/cmat-directives-debounce.mjs.map +1 -1
- package/fesm2022/cmat-directives-digit-only.mjs +6 -23
- package/fesm2022/cmat-directives-digit-only.mjs.map +1 -1
- package/fesm2022/cmat-directives-equal-validator.mjs +3 -3
- package/fesm2022/cmat-directives-seamless-auto-scroll.mjs +4 -11
- package/fesm2022/cmat-directives-seamless-auto-scroll.mjs.map +1 -1
- package/fesm2022/cmat-lib-mock-api.mjs +6 -43
- package/fesm2022/cmat-lib-mock-api.mjs.map +1 -1
- package/fesm2022/cmat-pipes-bytes.mjs +3 -3
- package/fesm2022/cmat-pipes-date-format.mjs +3 -3
- package/fesm2022/cmat-pipes-find-by-key.mjs +3 -5
- package/fesm2022/cmat-pipes-find-by-key.mjs.map +1 -1
- package/fesm2022/cmat-pipes-group-by.mjs +3 -3
- package/fesm2022/cmat-pipes-keys.mjs +3 -3
- package/fesm2022/cmat-pipes-secure.mjs +8 -12
- package/fesm2022/cmat-pipes-secure.mjs.map +1 -1
- package/fesm2022/cmat-pipes-uppercase.mjs +3 -3
- package/fesm2022/cmat-services-alert.mjs +3 -3
- package/fesm2022/cmat-services-config.mjs +50 -26
- package/fesm2022/cmat-services-config.mjs.map +1 -1
- package/fesm2022/cmat-services-confirmation.mjs +9 -11
- package/fesm2022/cmat-services-confirmation.mjs.map +1 -1
- package/fesm2022/cmat-services-data.mjs +56 -101
- package/fesm2022/cmat-services-data.mjs.map +1 -1
- package/fesm2022/cmat-services-export-as.mjs +4 -32
- package/fesm2022/cmat-services-export-as.mjs.map +1 -1
- package/fesm2022/cmat-services-loading.mjs +49 -40
- package/fesm2022/cmat-services-loading.mjs.map +1 -1
- package/fesm2022/cmat-services-local-storage.mjs +3 -3
- package/fesm2022/cmat-services-media-watcher.mjs +19 -25
- package/fesm2022/cmat-services-media-watcher.mjs.map +1 -1
- package/fesm2022/cmat-services-platform.mjs +3 -10
- package/fesm2022/cmat-services-platform.mjs.map +1 -1
- package/fesm2022/cmat-services-splash-screen.mjs +8 -13
- package/fesm2022/cmat-services-splash-screen.mjs.map +1 -1
- package/fesm2022/cmat-services-title.mjs +8 -12
- package/fesm2022/cmat-services-title.mjs.map +1 -1
- package/fesm2022/cmat-services-translation.mjs +3 -3
- package/fesm2022/cmat-services-utils.mjs +5 -27
- package/fesm2022/cmat-services-utils.mjs.map +1 -1
- package/fesm2022/cmat-validators.mjs +0 -8
- package/fesm2022/cmat-validators.mjs.map +1 -1
- package/fesm2022/cmat.mjs +3159 -3441
- package/fesm2022/cmat.mjs.map +1 -1
- package/package.json +1 -1
- package/tailwind/plugins/helpers.js +1 -10
- package/tailwind/plugins/scrollbar/index.js +0 -1
- package/tailwind/plugins/scrollbar/typedefs.js +1 -7
- package/tailwind/plugins/scrollbar/utilities.js +9 -58
- package/tailwind/plugins/scrollbar/variants.js +2 -17
- package/tailwind/plugins/theming.js +1 -57
- package/tailwind/utils/generate-contrasts.js +1 -12
- package/tailwind/utils/generate-palette.js +1 -32
- package/types/cmat-components-adapter.d.ts +0 -25
- package/types/cmat-components-breadcrumb.d.ts +25 -175
- package/types/cmat-components-carousel.d.ts +0 -18
- package/types/cmat-components-cascade.d.ts +1 -1
- package/types/cmat-components-chip-input.d.ts +4 -3
- package/types/cmat-components-code-editor.d.ts +0 -18
- package/types/cmat-components-custom-formly.d.ts +22 -28
- package/types/cmat-components-date-range.d.ts +0 -71
- package/types/cmat-components-date-time-display.d.ts +0 -15
- package/types/cmat-components-drawer.d.ts +0 -42
- package/types/cmat-components-empty-state.d.ts +0 -21
- package/types/cmat-components-file-preview.d.ts +0 -18
- package/types/cmat-components-filter-toolbar.d.ts +3 -43
- package/types/cmat-components-form-actions.d.ts +0 -6
- package/types/cmat-components-image-viewer.d.ts +0 -12
- package/types/cmat-components-inline-loading.d.ts +0 -9
- package/types/cmat-components-knob-input.d.ts +1 -1
- package/types/cmat-components-material-datetimepicker.d.ts +0 -263
- package/types/cmat-components-navigation.d.ts +24 -164
- package/types/cmat-components-opt-input.d.ts +1 -1
- package/types/cmat-components-page-header.d.ts +2 -16
- package/types/cmat-components-pagination.d.ts +22 -24
- package/types/cmat-components-popover.d.ts +1 -109
- package/types/cmat-components-progress-bar.d.ts +3 -4
- package/types/cmat-components-rich-text-editor.d.ts +0 -21
- package/types/cmat-components-select-search.d.ts +3 -19
- package/types/cmat-components-select-table.d.ts +17 -4
- package/types/cmat-components-select-tree.d.ts +20 -19
- package/types/cmat-components-skeleton.d.ts +0 -18
- package/types/cmat-components-status-tag.d.ts +0 -15
- package/types/cmat-components-table-toolbar.d.ts +0 -12
- package/types/cmat-components-timeline.d.ts +3 -4
- package/types/cmat-components-toast.d.ts +1 -0
- package/types/cmat-components-transfer-picker.d.ts +23 -27
- package/types/cmat-components-upload.d.ts +7 -10
- package/types/cmat-components-x6-angular-shape.d.ts +0 -1
- package/types/cmat-directives-arrow-cursor.d.ts +1 -1
- package/types/cmat-directives-debounce.d.ts +3 -4
- package/types/cmat-pipes-secure.d.ts +3 -4
- package/types/cmat-services-config.d.ts +35 -13
- package/types/cmat-services-data.d.ts +13 -12
- package/types/cmat-services-export-as.d.ts +0 -22
- package/types/cmat-services-loading.d.ts +15 -10
- package/types/cmat-services-media-watcher.d.ts +10 -13
- package/types/cmat-services-splash-screen.d.ts +2 -4
- package/types/cmat-services-title.d.ts +3 -5
- package/types/cmat.d.ts +655 -1308
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Directive, inject, Injectable, TemplateRef, Input, ContentChild, ChangeDetectionStrategy, ViewEncapsulation, Component } from '@angular/core';
|
|
3
|
-
import { NgClass, NgTemplateOutlet
|
|
2
|
+
import { Directive, inject, DestroyRef, signal, Injectable, computed, TemplateRef, Input, ContentChild, ChangeDetectionStrategy, ViewEncapsulation, Component } from '@angular/core';
|
|
3
|
+
import { NgClass, NgTemplateOutlet } from '@angular/common';
|
|
4
|
+
import { toObservable, takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
|
|
4
5
|
import { ActivatedRoute, Router, GuardsCheckEnd, RouterLink } from '@angular/router';
|
|
5
|
-
import {
|
|
6
|
-
import { isNull } from 'lodash-es';
|
|
7
|
-
import { Subject, BehaviorSubject } from 'rxjs';
|
|
6
|
+
import { filter } from 'rxjs/operators';
|
|
8
7
|
|
|
9
|
-
/**
|
|
10
|
-
* This directive is used to customize the breadcrumb label behavior
|
|
11
|
-
* *cmatBreadcrumbItem directive can be used in the child element of cmat-breadcrumb
|
|
12
|
-
* Usage: refer to the demo - app.component.html
|
|
13
|
-
*/
|
|
14
8
|
class CmatBreadcrumbItemDirective {
|
|
15
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
16
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.
|
|
9
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: CmatBreadcrumbItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
10
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.8", type: CmatBreadcrumbItemDirective, isStandalone: true, selector: "[cmatBreadcrumbItem]", ngImport: i0 }); }
|
|
17
11
|
}
|
|
18
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
12
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: CmatBreadcrumbItemDirective, decorators: [{
|
|
19
13
|
type: Directive,
|
|
20
14
|
args: [{
|
|
21
15
|
selector: '[cmatBreadcrumbItem]'
|
|
@@ -29,57 +23,27 @@ const PATH_PARAM = {
|
|
|
29
23
|
REGEX_REPLACER: '/[^/]+',
|
|
30
24
|
};
|
|
31
25
|
const ALIAS_PREFIX = '@';
|
|
32
|
-
const isNonEmpty = (obj) => obj && Object.keys(obj).length > 0;
|
|
26
|
+
const isNonEmpty = (obj) => !!obj && Object.keys(obj).length > 0;
|
|
33
27
|
class CmatBreadcrumbService {
|
|
34
28
|
constructor() {
|
|
35
29
|
this._activatedRoute = inject(ActivatedRoute);
|
|
36
30
|
this._router = inject(Router);
|
|
31
|
+
this._destroyRef = inject(DestroyRef);
|
|
37
32
|
this._baseHref = '/';
|
|
38
|
-
this.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
*/
|
|
44
|
-
this._dynamicBreadcrumbStore = [];
|
|
45
|
-
/**
|
|
46
|
-
* breadcrumbList for the current route
|
|
47
|
-
* When breadcrumb info is changed dynamically, check if the currentBreadcrumbs is effected
|
|
48
|
-
* If effected, update the change and emit a new stream
|
|
49
|
-
*/
|
|
33
|
+
this._dynamicBreadcrumbStore = {
|
|
34
|
+
alias: new Map(),
|
|
35
|
+
routeLink: new Map(),
|
|
36
|
+
routeRegex: new Map(),
|
|
37
|
+
};
|
|
50
38
|
this._currentBreadcrumbs = [];
|
|
51
39
|
this._previousBreadcrumbs = [];
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
* Emits on every route change OR dynamic update of breadcrumb
|
|
55
|
-
*/
|
|
56
|
-
this._breadcrumbs = new BehaviorSubject([]);
|
|
40
|
+
this._breadcrumbs = signal([], ...(ngDevMode ? [{ debugName: "_breadcrumbs" }] : /* istanbul ignore next */ []));
|
|
41
|
+
this._breadcrumbs$ = toObservable(this._breadcrumbs);
|
|
57
42
|
this._detectRouteChanges();
|
|
58
43
|
}
|
|
59
44
|
get breadcrumbs$() {
|
|
60
|
-
return this._breadcrumbs
|
|
45
|
+
return this._breadcrumbs$;
|
|
61
46
|
}
|
|
62
|
-
ngOnDestroy() {
|
|
63
|
-
this._unsubscribeAll.next(void 0);
|
|
64
|
-
this._unsubscribeAll.complete();
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Update breadcrumb dynamically
|
|
68
|
-
*
|
|
69
|
-
* key can be a path | alias
|
|
70
|
-
*
|
|
71
|
-
* 1) Using complete route path. route can be passed the same way you define angular routes
|
|
72
|
-
* - path can be passed as 'exact path(routeLink)' or 'path with params(routeRegex)'
|
|
73
|
-
* - update label Ex: set('/mentor', 'Mentor'), set('/mentor/:id', 'Mentor Details')
|
|
74
|
-
* - change visibility Ex: set('/mentor/:id/edit', { skip: true })
|
|
75
|
-
* ------------------------------------------ OR ------------------------------------------
|
|
76
|
-
* 2) Using route alias (prefixed with '@'). alias should be unique for a route
|
|
77
|
-
* - update label Ex: set('@mentor', 'Enabler')
|
|
78
|
-
* - change visibility Ex: set('@mentorEdit', { skip: true })
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
* value can be string | BreadcrumbObject | BreadcrumbFunction
|
|
82
|
-
*/
|
|
83
47
|
set(key, breadcrumb) {
|
|
84
48
|
const breadcrumbObject = this._extractObject(breadcrumb);
|
|
85
49
|
let updateArgs;
|
|
@@ -98,26 +62,15 @@ class CmatBreadcrumbService {
|
|
|
98
62
|
{ ...breadcrumbObject, routeLink: this._ensureLeadingSlash(key) },
|
|
99
63
|
];
|
|
100
64
|
}
|
|
101
|
-
// For this route if previously a breadcrumb is not defined that sets isAutoGeneratedLabel: true
|
|
102
|
-
// change it to false since this is user supplied value
|
|
103
65
|
updateArgs[1].isAutoGeneratedLabel = false;
|
|
104
66
|
this._updateStore(...updateArgs);
|
|
105
67
|
this._updateCurrentBreadcrumbs(...updateArgs);
|
|
106
68
|
}
|
|
107
|
-
/**
|
|
108
|
-
* Whenever route changes build breadcrumb list again
|
|
109
|
-
*/
|
|
110
69
|
_detectRouteChanges() {
|
|
111
|
-
// Special case where breadcrumb service & component instantiates after a route is navigated.
|
|
112
|
-
// Ex: put breadcrumbs within *ngIf and this.router.events would be empty
|
|
113
|
-
// This check is also required where { initialNavigation: 'enabledBlocking' } is applied to routes
|
|
114
70
|
this._setupBreadcrumbs(this._activatedRoute.snapshot);
|
|
115
71
|
this._router.events
|
|
116
|
-
.pipe(
|
|
72
|
+
.pipe(takeUntilDestroyed(this._destroyRef), filter((event) => event instanceof GuardsCheckEnd))
|
|
117
73
|
.subscribe((event) => {
|
|
118
|
-
// activatedRoute doesn't carry data when shouldReuseRoute returns false
|
|
119
|
-
// use the event data with GuardsCheckEnd as workaround
|
|
120
|
-
// Check for shouldActivate in case where the authGuard returns false the breadcrumbs shouldn't be changed
|
|
121
74
|
if (event.shouldActivate) {
|
|
122
75
|
this._setupBreadcrumbs(event.state.root);
|
|
123
76
|
}
|
|
@@ -125,7 +78,6 @@ class CmatBreadcrumbService {
|
|
|
125
78
|
}
|
|
126
79
|
_setupBreadcrumbs(activatedRouteSnapshot) {
|
|
127
80
|
this._previousBreadcrumbs = this._currentBreadcrumbs;
|
|
128
|
-
// breadcrumb label for base OR root path. Usually, this can be set as 'Home'
|
|
129
81
|
const rootBreadcrumb = this._getRootBreadcrumb();
|
|
130
82
|
this._currentBreadcrumbs = rootBreadcrumb ? [rootBreadcrumb] : [];
|
|
131
83
|
this._prepareBreadcrumbList(activatedRouteSnapshot, this._baseHref);
|
|
@@ -144,11 +96,19 @@ class CmatBreadcrumbService {
|
|
|
144
96
|
}
|
|
145
97
|
}
|
|
146
98
|
_prepareBreadcrumbItem(activatedRouteSnapshot, routeLinkPrefix) {
|
|
147
|
-
const
|
|
148
|
-
|
|
99
|
+
const routeData = this._parseRouteData(activatedRouteSnapshot.routeConfig);
|
|
100
|
+
if (!routeData) {
|
|
101
|
+
return {
|
|
102
|
+
label: '',
|
|
103
|
+
routeLink: routeLinkPrefix,
|
|
104
|
+
isAutoGeneratedLabel: true,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
const { path, breadcrumb } = routeData;
|
|
108
|
+
const resolvedSegment = this._resolvePathSegment(path ?? '', activatedRouteSnapshot);
|
|
149
109
|
const routeLink = `${routeLinkPrefix}${resolvedSegment}`;
|
|
150
110
|
const storeItem = this._getFromStore(routeLink, breadcrumb.alias);
|
|
151
|
-
const label = this._extractLabel(storeItem?.label ?? breadcrumb?.label, resolvedSegment);
|
|
111
|
+
const label = this._extractLabel(storeItem?.label ?? breadcrumb?.label ?? '', resolvedSegment);
|
|
152
112
|
let isAutoGeneratedLabel = false;
|
|
153
113
|
let autoGeneratedLabel = '';
|
|
154
114
|
if (!label) {
|
|
@@ -158,7 +118,7 @@ class CmatBreadcrumbService {
|
|
|
158
118
|
return {
|
|
159
119
|
...storeItem,
|
|
160
120
|
...breadcrumb,
|
|
161
|
-
label: isAutoGeneratedLabel ? autoGeneratedLabel : label,
|
|
121
|
+
label: isAutoGeneratedLabel ? autoGeneratedLabel : (label ?? ''),
|
|
162
122
|
routeLink,
|
|
163
123
|
isAutoGeneratedLabel,
|
|
164
124
|
...this._getQueryParamsFromPreviousList(routeLink),
|
|
@@ -177,18 +137,28 @@ class CmatBreadcrumbService {
|
|
|
177
137
|
}
|
|
178
138
|
const lastCrumb = this._currentBreadcrumbs[this._currentBreadcrumbs.length - 1];
|
|
179
139
|
this._setQueryParamsForActiveBreadcrumb(lastCrumb, activatedRouteSnapshot);
|
|
180
|
-
// remove breadcrumb items that needs to be hidden
|
|
181
140
|
const breadcrumbsToShow = this._currentBreadcrumbs.filter(item => !item.skip);
|
|
182
|
-
this._breadcrumbs.
|
|
141
|
+
this._breadcrumbs.set([...breadcrumbsToShow]);
|
|
183
142
|
return void 0;
|
|
184
143
|
}
|
|
185
144
|
_getFromStore(routeLink, alias) {
|
|
186
|
-
|
|
145
|
+
if (alias) {
|
|
146
|
+
const aliasBreadcrumb = this._dynamicBreadcrumbStore.alias.get(alias);
|
|
147
|
+
if (aliasBreadcrumb) {
|
|
148
|
+
return aliasBreadcrumb;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
const routeLinkBreadcrumb = this._dynamicBreadcrumbStore.routeLink.get(routeLink);
|
|
152
|
+
if (routeLinkBreadcrumb) {
|
|
153
|
+
return routeLinkBreadcrumb;
|
|
154
|
+
}
|
|
155
|
+
for (const breadcrumb of this._dynamicBreadcrumbStore.routeRegex.values()) {
|
|
156
|
+
if (this._matchRegex(routeLink, breadcrumb.routeRegex)) {
|
|
157
|
+
return breadcrumb;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return void 0;
|
|
187
161
|
}
|
|
188
|
-
/**
|
|
189
|
-
* use exact match instead of regexp.test
|
|
190
|
-
* for /mentor/[^/]+ we should match '/mentor/12' but not '/mentor/12/abc'
|
|
191
|
-
*/
|
|
192
162
|
_matchRegex(routeLink, routeRegex) {
|
|
193
163
|
if (routeRegex && routeLink) {
|
|
194
164
|
const match = new RegExp(routeRegex).exec(routeLink);
|
|
@@ -196,14 +166,7 @@ class CmatBreadcrumbService {
|
|
|
196
166
|
}
|
|
197
167
|
return null;
|
|
198
168
|
}
|
|
199
|
-
/**
|
|
200
|
-
* if the path segment has route params, read the param value from url
|
|
201
|
-
* for each segment of route this gets called
|
|
202
|
-
*
|
|
203
|
-
* for mentor/:id/view - it gets called with mentor, :id, view 3 times
|
|
204
|
-
*/
|
|
205
169
|
_resolvePathSegment(segment, activatedRouteSnapshot) {
|
|
206
|
-
//quirk -segment can be defined as view/:id in route config in which case you need to make it view/<resolved-param>
|
|
207
170
|
if (segment.includes(PATH_PARAM.PREFIX)) {
|
|
208
171
|
Object.entries(activatedRouteSnapshot.params).forEach(([key, value]) => {
|
|
209
172
|
segment = segment.replace(`:${key}`, `${value}`);
|
|
@@ -211,17 +174,11 @@ class CmatBreadcrumbService {
|
|
|
211
174
|
}
|
|
212
175
|
return segment;
|
|
213
176
|
}
|
|
214
|
-
/**
|
|
215
|
-
* queryParams & fragments for previous breadcrumb path are copied over to new list
|
|
216
|
-
*/
|
|
217
177
|
_getQueryParamsFromPreviousList(routeLink) {
|
|
218
178
|
const { queryParams, fragment } = this._previousBreadcrumbs.find(item => item.routeLink === routeLink) ??
|
|
219
179
|
{};
|
|
220
180
|
return { queryParams, fragment };
|
|
221
181
|
}
|
|
222
|
-
/**
|
|
223
|
-
* set current activated route query params to the last breadcrumb item
|
|
224
|
-
*/
|
|
225
182
|
_setQueryParamsForActiveBreadcrumb(lastItem, activatedRouteSnapshot) {
|
|
226
183
|
if (lastItem) {
|
|
227
184
|
const { queryParams, fragment } = activatedRouteSnapshot;
|
|
@@ -229,101 +186,74 @@ class CmatBreadcrumbService {
|
|
|
229
186
|
lastItem.fragment = fragment ?? void 0;
|
|
230
187
|
}
|
|
231
188
|
}
|
|
232
|
-
/**
|
|
233
|
-
* For a specific route, breadcrumb can be defined either on parent OR it's child(which has empty path)
|
|
234
|
-
* When both are defined, child takes precedence
|
|
235
|
-
*
|
|
236
|
-
* Ex: Below we are setting breadcrumb on both parent and child.
|
|
237
|
-
* So, child takes precedence and "Defined On Child" is displayed for the route 'home'
|
|
238
|
-
* { path: 'home', loadChildren: './home/home.module#HomeModule' , data: {breadcrumb: "Defined On Module"}}
|
|
239
|
-
* AND
|
|
240
|
-
* children: [
|
|
241
|
-
* { path: '', component: ShowUserComponent, data: {breadcrumb: "Defined On Child" }
|
|
242
|
-
* ]
|
|
243
|
-
*/
|
|
244
189
|
_parseRouteData(routeConfig) {
|
|
245
|
-
if (
|
|
190
|
+
if (!routeConfig) {
|
|
246
191
|
return void 0;
|
|
192
|
+
}
|
|
247
193
|
const { path, data } = routeConfig;
|
|
248
194
|
const breadcrumb = this._mergeWithBaseChildData(routeConfig, data?.['breadcrumb']);
|
|
249
195
|
return { path, breadcrumb };
|
|
250
196
|
}
|
|
251
|
-
/**
|
|
252
|
-
* get empty children of a module or Component. Empty child is the one with path: ''
|
|
253
|
-
* When parent and it's children (that has empty route path) define data merge them both with child taking precedence
|
|
254
|
-
*/
|
|
255
197
|
_mergeWithBaseChildData(routeConfig, config) {
|
|
256
198
|
if (!routeConfig) {
|
|
257
199
|
return this._extractObject(config);
|
|
258
200
|
}
|
|
259
201
|
let baseChild = void 0;
|
|
260
202
|
if (routeConfig.loadChildren) {
|
|
261
|
-
|
|
262
|
-
baseChild = routeConfig._loadedRoutes.find((route) => route.path === '');
|
|
203
|
+
baseChild = routeConfig._loadedRoutes?.find(route => route.path === '');
|
|
263
204
|
}
|
|
264
205
|
else if (routeConfig.children) {
|
|
265
|
-
|
|
266
|
-
baseChild = routeConfig.children.find((route) => route.path === '');
|
|
206
|
+
baseChild = routeConfig.children.find(route => route.path === '');
|
|
267
207
|
}
|
|
268
208
|
const childConfig = baseChild?.data?.['breadcrumb'];
|
|
269
209
|
return childConfig
|
|
270
|
-
? this._mergeWithBaseChildData(baseChild, {
|
|
210
|
+
? this._mergeWithBaseChildData(baseChild ?? null, {
|
|
271
211
|
...this._extractObject(config),
|
|
272
212
|
...this._extractObject(childConfig),
|
|
273
213
|
})
|
|
274
214
|
: this._extractObject(config);
|
|
275
215
|
}
|
|
276
|
-
/**
|
|
277
|
-
* Update the store to reuse for dynamic declarations
|
|
278
|
-
* If the store already has this route definition update it, else add
|
|
279
|
-
*/
|
|
280
216
|
_updateStore(key, breadcrumb) {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
...this._dynamicBreadcrumbStore[storeItemIndex],
|
|
285
|
-
...breadcrumb,
|
|
286
|
-
};
|
|
217
|
+
if (key === 'alias' && breadcrumb.alias) {
|
|
218
|
+
this._dynamicBreadcrumbStore.alias.set(breadcrumb.alias, { ...this._dynamicBreadcrumbStore.alias.get(breadcrumb.alias), ...breadcrumb });
|
|
219
|
+
return;
|
|
287
220
|
}
|
|
288
|
-
|
|
289
|
-
this._dynamicBreadcrumbStore.
|
|
221
|
+
if (key === 'routeLink' && breadcrumb.routeLink) {
|
|
222
|
+
this._dynamicBreadcrumbStore.routeLink.set(breadcrumb.routeLink, { ...this._dynamicBreadcrumbStore.routeLink.get(breadcrumb.routeLink), ...breadcrumb });
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
if (key === 'routeRegex' && breadcrumb.routeRegex) {
|
|
226
|
+
this._dynamicBreadcrumbStore.routeRegex.set(breadcrumb.routeRegex, { ...this._dynamicBreadcrumbStore.routeRegex.get(breadcrumb.routeRegex), ...breadcrumb });
|
|
290
227
|
}
|
|
291
228
|
}
|
|
292
|
-
/**
|
|
293
|
-
* If breadcrumb is present in current breadcrumbs update it and emit new stream
|
|
294
|
-
*/
|
|
295
229
|
_updateCurrentBreadcrumbs(key, breadcrumb) {
|
|
296
|
-
const itemIndex = this._currentBreadcrumbs.findIndex(item =>
|
|
297
|
-
|
|
298
|
-
|
|
230
|
+
const itemIndex = this._currentBreadcrumbs.findIndex((item) => {
|
|
231
|
+
if (key === 'routeRegex') {
|
|
232
|
+
return this._matchRegex(item.routeLink, breadcrumb.routeRegex);
|
|
233
|
+
}
|
|
234
|
+
if (key === 'alias') {
|
|
235
|
+
return item.alias === breadcrumb.alias;
|
|
236
|
+
}
|
|
237
|
+
return item.routeLink === breadcrumb.routeLink;
|
|
238
|
+
});
|
|
299
239
|
if (itemIndex > -1) {
|
|
300
240
|
this._currentBreadcrumbs[itemIndex] = {
|
|
301
241
|
...this._currentBreadcrumbs[itemIndex],
|
|
302
242
|
...breadcrumb,
|
|
303
243
|
};
|
|
304
|
-
|
|
305
|
-
this._breadcrumbs.next([...breadcrumbsToShow]);
|
|
244
|
+
this._publishCurrentBreadcrumbs();
|
|
306
245
|
}
|
|
307
246
|
}
|
|
308
|
-
/**
|
|
309
|
-
* For a route with path param, we create regex dynamically from angular route syntax
|
|
310
|
-
* '/mentor/:id' becomes '/mentor/[^/]',
|
|
311
|
-
* breadcrumbService.set('/mentor/:id', 'Uday') should update 'Uday' as label for '/mentor/2' OR 'mentor/ada'
|
|
312
|
-
*/
|
|
313
247
|
_buildRegex(path) {
|
|
314
248
|
return this._ensureLeadingSlash(path).replace(new RegExp(PATH_PARAM.REGEX_IDENTIFIER, 'g'), PATH_PARAM.REGEX_REPLACER);
|
|
315
249
|
}
|
|
316
250
|
_ensureLeadingSlash(path) {
|
|
317
251
|
return path.startsWith('/') ? path : `/${path}`;
|
|
318
252
|
}
|
|
319
|
-
/**
|
|
320
|
-
* In App's RouteConfig, breadcrumb can be defined as a string OR a function OR an object
|
|
321
|
-
*
|
|
322
|
-
* string: simple static breadcrumb label for a path
|
|
323
|
-
* function: callback that gets invoked with resolved path param
|
|
324
|
-
* object: additional data defined along with breadcrumb label that gets passed to *cmatBreadcrumbItem directive
|
|
325
|
-
*/
|
|
326
253
|
_extractLabel(config, resolvedParam) {
|
|
254
|
+
if (!config) {
|
|
255
|
+
return undefined;
|
|
256
|
+
}
|
|
327
257
|
const label = typeof config === 'object' ? config.label : config;
|
|
328
258
|
if (typeof label === 'function') {
|
|
329
259
|
return label(resolvedParam);
|
|
@@ -331,17 +261,19 @@ class CmatBreadcrumbService {
|
|
|
331
261
|
return label;
|
|
332
262
|
}
|
|
333
263
|
_extractObject(config) {
|
|
334
|
-
// don't include {label} if config is undefined. This is important since we merge the configs
|
|
335
264
|
if (config &&
|
|
336
265
|
(typeof config === 'string' || typeof config === 'function')) {
|
|
337
266
|
return { label: config };
|
|
338
267
|
}
|
|
339
268
|
return config || {};
|
|
340
269
|
}
|
|
341
|
-
|
|
342
|
-
|
|
270
|
+
_publishCurrentBreadcrumbs() {
|
|
271
|
+
this._breadcrumbs.set(this._currentBreadcrumbs.filter(item => !item.skip));
|
|
272
|
+
}
|
|
273
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: CmatBreadcrumbService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
274
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: CmatBreadcrumbService, providedIn: 'root' }); }
|
|
343
275
|
}
|
|
344
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
276
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: CmatBreadcrumbService, decorators: [{
|
|
345
277
|
type: Injectable,
|
|
346
278
|
args: [{
|
|
347
279
|
providedIn: 'root',
|
|
@@ -350,74 +282,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.7", ngImpor
|
|
|
350
282
|
|
|
351
283
|
class CmatBreadcrumbComponent {
|
|
352
284
|
constructor() {
|
|
353
|
-
|
|
354
|
-
* 如果为true,即使没有任何映射标签,面包屑也会自动生成
|
|
355
|
-
* 默认标签与路由segment相同
|
|
356
|
-
*/
|
|
357
|
-
this.autoGenerate = true;
|
|
358
|
-
/**
|
|
359
|
-
* 默认情况下,查询参数将与breadcrumbs一起保留
|
|
360
|
-
*/
|
|
285
|
+
this.itemTemplate = null;
|
|
361
286
|
this.preserveQueryParams = true;
|
|
362
|
-
/**
|
|
363
|
-
* 默认情况下,fragments参数将与breadcrumbs一起保留
|
|
364
|
-
*/
|
|
365
287
|
this.preserveFragment = true;
|
|
366
|
-
/**
|
|
367
|
-
* 可提供覆盖样式,增加特异性
|
|
368
|
-
*/
|
|
369
288
|
this.class = '';
|
|
370
|
-
this.
|
|
289
|
+
this.separatorTemplate = null;
|
|
290
|
+
this.breadcrumbs = computed(() => {
|
|
291
|
+
const breadcrumbs = this._breadcrumbItems();
|
|
292
|
+
if (this._autoGenerate()) {
|
|
293
|
+
return breadcrumbs;
|
|
294
|
+
}
|
|
295
|
+
return breadcrumbs.filter(breadcrumb => !breadcrumb.isAutoGeneratedLabel);
|
|
296
|
+
}, ...(ngDevMode ? [{ debugName: "breadcrumbs" }] : /* istanbul ignore next */ []));
|
|
371
297
|
this._breadcrumbService = inject(CmatBreadcrumbService);
|
|
298
|
+
this._autoGenerate = signal(true, ...(ngDevMode ? [{ debugName: "_autoGenerate" }] : /* istanbul ignore next */ []));
|
|
299
|
+
this._breadcrumbItems = toSignal(this._breadcrumbService.breadcrumbs$, { initialValue: [] });
|
|
300
|
+
this._separator = '/';
|
|
372
301
|
}
|
|
373
|
-
|
|
374
|
-
|
|
302
|
+
set autoGenerate(value) {
|
|
303
|
+
this._autoGenerate.set(value);
|
|
304
|
+
}
|
|
305
|
+
get autoGenerate() {
|
|
306
|
+
return this._autoGenerate();
|
|
375
307
|
}
|
|
376
|
-
/**
|
|
377
|
-
* 面包屑分隔符, 默认'/'.
|
|
378
|
-
* 用户可以通过传递字符串或模板来自定义分隔符
|
|
379
|
-
*
|
|
380
|
-
* 字符串 --> Ex: <cmat-breadcrumb separator="-"></cmat-breadcrumb>
|
|
381
|
-
*
|
|
382
|
-
* 模板 --> Ex: <cmat-breadcrumb [separator]="separatorTemplate"></cmat-breadcrumb>
|
|
383
|
-
* <ng-template #separatorTemplate><mat-icon>arrow_right</mat-icon></ng-template>
|
|
384
|
-
*/
|
|
385
308
|
set separator(value) {
|
|
386
|
-
|
|
387
|
-
this.separatorTemplate = value;
|
|
388
|
-
this._separator = undefined;
|
|
389
|
-
}
|
|
390
|
-
else {
|
|
391
|
-
this.separatorTemplate = null;
|
|
392
|
-
this._separator = value || '/';
|
|
393
|
-
}
|
|
309
|
+
this._separator = value;
|
|
394
310
|
}
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
.filter((breadcrumb) => {
|
|
398
|
-
// Usually, breadcrumb list can contain a combination of auto generated and user specified labels
|
|
399
|
-
// this filters autogenerated labels in case of "[autoGenerate]: false"
|
|
400
|
-
if (this.autoGenerate) {
|
|
401
|
-
return true;
|
|
402
|
-
}
|
|
403
|
-
return !breadcrumb.isAutoGeneratedLabel;
|
|
404
|
-
})
|
|
405
|
-
.map((breadcrumb) => {
|
|
406
|
-
// Do not mutate breadcrumb as its source of truth.
|
|
407
|
-
// There can be scenarios where we can have multiple cmat-breadcrumb instances in page
|
|
408
|
-
const { routeInterceptor, routeLink } = breadcrumb;
|
|
409
|
-
return {
|
|
410
|
-
...breadcrumb,
|
|
411
|
-
routeLink: routeInterceptor?.(breadcrumb, routeLink) ?? routeLink,
|
|
412
|
-
};
|
|
413
|
-
})));
|
|
311
|
+
get separator() {
|
|
312
|
+
return this._separator;
|
|
414
313
|
}
|
|
415
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
416
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
314
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: CmatBreadcrumbComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
315
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: CmatBreadcrumbComponent, isStandalone: true, selector: "cmat-breadcrumb", inputs: { autoGenerate: "autoGenerate", preserveQueryParams: "preserveQueryParams", preserveFragment: "preserveFragment", class: "class", anchorTarget: "anchorTarget", separator: "separator" }, queries: [{ propertyName: "itemTemplate", first: true, predicate: CmatBreadcrumbItemDirective, descendants: true, read: TemplateRef }], exportAs: ["cmatBreadcrumb"], ngImport: i0, template: "<nav aria-label=\"breadcrumb\" class=\"m-0\" [ngClass]=\"class\">\r\n <ol class=\"flex items-center flex-wrap m-0 p-0\">\r\n @for (\r\n breadcrumb of breadcrumbs(); track\r\n breadcrumb.routeLink ?? $index; let isLast = $last; let isFirst = $first; let index = $index; let count = $count) {\r\n <li class=\"list-none\">\r\n @if (!isLast) {\r\n <a class=\"cmat-breadcrumb-link\"\r\n rel=\"noopener noreferrer\"\r\n [ngClass]=\"{ 'pointer-events-none cursor-not-allowed': breadcrumb.disable }\" [attr.aria-disabled]=\"breadcrumb.disable\"\r\n [attr.tabIndex]=\"breadcrumb.disable ? -1 : 0\" [routerLink]=\"\r\n breadcrumb.routeInterceptor\r\n ? breadcrumb.routeInterceptor( breadcrumb,breadcrumb.routeLink)\r\n : breadcrumb.routeLink\" [queryParams]=\"preserveQueryParams ? breadcrumb.queryParams : undefined\"\r\n [fragment]=\"preserveFragment ? breadcrumb.fragment : undefined\"\r\n [target]=\"anchorTarget ? anchorTarget : '_self'\">\r\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: { $implicit: breadcrumb.label, info: breadcrumb.info, last: isLast, first: isFirst, index: index, count: count }\"></ng-container>\r\n @if (!itemTemplate) {\r\n {{\r\n breadcrumb.label\r\n }}\r\n }\r\n </a>\r\n }\r\n @if (isLast) {\r\n <span class=\"flex items-center\">\r\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: { $implicit: breadcrumb.label, info: breadcrumb.info, last: isLast, first: isFirst, index: index, count: count }\"></ng-container>\r\n @if (!itemTemplate) {\r\n {{\r\n breadcrumb.label\r\n }}\r\n }\r\n </span>\r\n }\r\n </li>\r\n @if (!isLast) {\r\n <li class=\"flex select-none mx-4\" aria-hidden=\"true\" role=\"separator\">\r\n <ng-container *ngTemplateOutlet=\"separatorTemplate\"></ng-container>\r\n @if (separatorTemplate===null) {\r\n {{ separator }}\r\n }\r\n </li>\r\n }\r\n}\r\n</ol>\r\n</nav>\r\n", styles: ["cmat-breadcrumb .cmat-breadcrumb-link{display:flex;align-items:center;white-space:nowrap;color:inherit;text-decoration:none;transition:text-decoration .3s;cursor:pointer}cmat-breadcrumb .cmat-breadcrumb-link:hover{text-decoration-line:underline}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
417
316
|
}
|
|
418
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
317
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: CmatBreadcrumbComponent, decorators: [{
|
|
419
318
|
type: Component,
|
|
420
|
-
args: [{ selector: 'cmat-breadcrumb', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'cmatBreadcrumb', imports: [NgClass,
|
|
319
|
+
args: [{ selector: 'cmat-breadcrumb', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'cmatBreadcrumb', imports: [NgClass, RouterLink, NgTemplateOutlet], template: "<nav aria-label=\"breadcrumb\" class=\"m-0\" [ngClass]=\"class\">\r\n <ol class=\"flex items-center flex-wrap m-0 p-0\">\r\n @for (\r\n breadcrumb of breadcrumbs(); track\r\n breadcrumb.routeLink ?? $index; let isLast = $last; let isFirst = $first; let index = $index; let count = $count) {\r\n <li class=\"list-none\">\r\n @if (!isLast) {\r\n <a class=\"cmat-breadcrumb-link\"\r\n rel=\"noopener noreferrer\"\r\n [ngClass]=\"{ 'pointer-events-none cursor-not-allowed': breadcrumb.disable }\" [attr.aria-disabled]=\"breadcrumb.disable\"\r\n [attr.tabIndex]=\"breadcrumb.disable ? -1 : 0\" [routerLink]=\"\r\n breadcrumb.routeInterceptor\r\n ? breadcrumb.routeInterceptor( breadcrumb,breadcrumb.routeLink)\r\n : breadcrumb.routeLink\" [queryParams]=\"preserveQueryParams ? breadcrumb.queryParams : undefined\"\r\n [fragment]=\"preserveFragment ? breadcrumb.fragment : undefined\"\r\n [target]=\"anchorTarget ? anchorTarget : '_self'\">\r\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: { $implicit: breadcrumb.label, info: breadcrumb.info, last: isLast, first: isFirst, index: index, count: count }\"></ng-container>\r\n @if (!itemTemplate) {\r\n {{\r\n breadcrumb.label\r\n }}\r\n }\r\n </a>\r\n }\r\n @if (isLast) {\r\n <span class=\"flex items-center\">\r\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: { $implicit: breadcrumb.label, info: breadcrumb.info, last: isLast, first: isFirst, index: index, count: count }\"></ng-container>\r\n @if (!itemTemplate) {\r\n {{\r\n breadcrumb.label\r\n }}\r\n }\r\n </span>\r\n }\r\n </li>\r\n @if (!isLast) {\r\n <li class=\"flex select-none mx-4\" aria-hidden=\"true\" role=\"separator\">\r\n <ng-container *ngTemplateOutlet=\"separatorTemplate\"></ng-container>\r\n @if (separatorTemplate===null) {\r\n {{ separator }}\r\n }\r\n </li>\r\n }\r\n}\r\n</ol>\r\n</nav>\r\n", styles: ["cmat-breadcrumb .cmat-breadcrumb-link{display:flex;align-items:center;white-space:nowrap;color:inherit;text-decoration:none;transition:text-decoration .3s;cursor:pointer}cmat-breadcrumb .cmat-breadcrumb-link:hover{text-decoration-line:underline}\n"] }]
|
|
421
320
|
}], propDecorators: { itemTemplate: [{
|
|
422
321
|
type: ContentChild,
|
|
423
322
|
args: [CmatBreadcrumbItemDirective, { static: false, read: TemplateRef }]
|