File

src/ui/breadcrumbs/smart-breadcrumb-navigation.component.ts

Description

A component used for displaying a breadcrumb trail of the current smart route.

Implements

OnInit OnDestroy IBreadCrumbComponent AfterViewInit

Metadata

Index

Properties
Methods
Inputs
Outputs
Accessors

Constructor

constructor(router: Router, viewManager: SmartViewManagerService, smartConfig: SmartConfig, breadcrumbRegistry: SmartBreadcrumbRegistryService, serviceAdapter: SmartServiceAdapter, elementRef: ElementRef, breadcrumbHelper: SmartBreadcrumbHelperService, navHelper: SmartBreadCrumbNavigationHelperService)
Parameters :
Name Type Optional
router Router No
viewManager SmartViewManagerService No
smartConfig SmartConfig No
breadcrumbRegistry SmartBreadcrumbRegistryService No
serviceAdapter SmartServiceAdapter No
elementRef ElementRef No
breadcrumbHelper SmartBreadcrumbHelperService No
navHelper SmartBreadCrumbNavigationHelperService No

Inputs

disabled
Type : boolean
Default value : false
routerOutlet
Type : string
showBackButton
Type : boolean
Default value : false

Outputs

breadcrumbsRefreshed
Type : EventEmitter<IBreadCrumb[]>
onReady
Type : EventEmitter<SmartBreadCrumbNavigationComponent>

Methods

getBreadcrumbByFormId
getBreadcrumbByFormId(formId: string)

Given a form ID, returns a breadcrumb component instance

Parameters :
Name Type Optional Description
formId string No

the form ID

{SmartBreadcrumbComponent}

getBreadcrumbByUrlSegment
getBreadcrumbByUrlSegment(urlSegment: string)

Given a URL segment, returns a breadcrumb component instance

Parameters :
Name Type Optional Description
urlSegment string No

the URL segment

{SmartBreadcrumbComponent}

getCrumbQueryParamsKey
getCrumbQueryParamsKey(crumb: IBreadCrumb)

Returns the query params key for a breadcrumb, used by template for tracking.

Parameters :
Name Type Optional Description
crumb IBreadCrumb No
  • The breadcrumb model
Returns : string
  • The query params key
goBack
goBack()

Navigate back

Returns : void
navigate
navigate(breadcrumb: IBreadCrumb)

Navigates to the view associated with the given breadcrumb. When navigating back via breadcrumb, truncates the navigation stack to that point.

Parameters :
Name Type Optional
breadcrumb IBreadCrumb No
Returns : void

Properties

breadcrumbComponentInstances
Type : QueryList<SmartBreadcrumbComponent>
Decorators :
@ViewChildren(SmartBreadcrumbComponent)
Public elementRef
Type : ElementRef
homeBreadcrumb
Type : IBreadCrumb
Public smartConfig
Type : SmartConfig
trackCrumb
Type : unknown
Default value : () => {...}

Track function for the breadcrumb list used by template @for directive.

Parameters :
Name Description
_index
  • The item index (unused)
crumb
  • The breadcrumb model

Accessors

breadcrumbs
getbreadcrumbs()

The breadcrumbs that are currently displayed

Returns : IBreadCrumb[]
<!--
**************************************************************************
* Copyright © 2006-2026 by Consultingwerk Ltd. ("CW") -                  *
* www.consultingwerk.com and other contributors as listed                *
* below. All Rights Reserved.                                            *
*                                                                        *
*  Software is distributed on an "AS IS", WITHOUT WARRANTY OF ANY        *
*   KIND, either express or implied.                                     *
*                                                                        *
*  Contributors:                                                         *
*                                                                        *
**************************************************************************

--------------------------------------------------------------------------
    File        : smart-breadcrumb-navigation.component.html
    Purpose     : Template for Smart Breadcrumb Navigation.
    Author(s)   : Radu Nicoara
    Created     : Dec 07, 2017
--------------------------------------------------------------------------
-->
@if (smartConfig.showSingleBreadcrumb !== false || (!routerOutlet && breadcrumbs.length > 0) || breadcrumbs.length > 1) {
    <nav 
        class="d-flex align-items-center smart-breadcrumb-navigation my-1" 
        [ngClass]="{ disabled: disabled }">
            @if (showBackButton) {
                <button type="button" class="breadcrumb-back-button me-2" (click)="goBack()" [disabled]="disabled">
                    <i class="fa-solid fa-chevron-left"></i>
                </button>
            }
            <ol class="breadcrumb m-0 p-0 bg-transparent">
                @for (item of breadcrumbs; track trackCrumb(i, item); let i = $index; let last = $last) {
                    <li class="breadcrumb-item">
                        <smart-breadcrumb 
                            [model]="item" 
                            [disabled]="disabled || last" 
                            [routerOutlet]="routerOutlet || 'view'"
                            [queryParamsKey]="getCrumbQueryParamsKey(item)"
                            [isLast]="last"
                            (onClick)="navigate(item)">
                        </smart-breadcrumb>
                    </li>
                }
            </ol>
    </nav>
}

./smart-breadcrumb-navigation.component.css

/**********************************************************************
 * Copyright © 2006-2026 by Consultingwerk Ltd. ("CW") -              *
 * www.consultingwerk.com and other contributors as listed            *
 * below. All Rights Reserved.                                        *
 *                                                                    *
 *  Software is distributed on an "AS IS", WITHOUT WARRANTY OF ANY    *
 *   KIND, either express or implied.                                 *
 *                                                                    *
 *  Contributors:                                                     *
 *                                                                    *
 **********************************************************************/
/*------------------------------------------------------------------------
    File        : smart-breadcrumb-navigation.component.css
    Purpose     : Styles for Smart Breadcrumb Navigation.
    Author(s)   : Radu Nicoara
    Created     : Dec 07, 2017
  ----------------------------------------------------------------------*/

/* Kendo-styled breadcrumb navigation using Bootstrap utilities + Kendo variables */
.smart-breadcrumb-navigation {
    font-family: var(--kendo-font-family, inherit);
    font-size: var(--kendo-font-size, 0.875rem);
    line-height: var(--kendo-line-height, 1.5);
}

.smart-breadcrumb-navigation .breadcrumb {
    background: transparent;
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--kendo-spacing-1, 0.25rem);
}

.smart-breadcrumb-navigation .breadcrumb-item {
    display: flex;
    align-items: center;
    gap: var(--kendo-spacing-1, 0.25rem);
}

.smart-breadcrumb-navigation .smart-breadcrumb-label {
    color: var(--kendo-color-primary, #0d6efd);
    text-decoration: none;
    cursor: pointer;
    padding: var(--kendo-spacing-1, 0.25rem) var(--kendo-spacing-2, 0.5rem);
    border-radius: var(--kendo-border-radius-md, 0.375rem);
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.smart-breadcrumb-navigation .smart-breadcrumb-label:hover {
    color: var(--kendo-color-primary-hover, #0c64e4);
    text-decoration: none;
}

.smart-breadcrumb-navigation .smart-breadcrumb-label:focus {
    outline: 2px solid var(--kendo-color-primary-emphasis, rgba(13, 110, 253, 0.4));
    outline-offset: 2px;
}

.smart-breadcrumb-navigation .smart-breadcrumb-label.disabled {
    color: var(--kendo-color-subtle, #596169);
    cursor: default;
    pointer-events: none;
}

.smart-breadcrumb-navigation .smart-breadcrumb-label.is-last {
    color: var(--kendo-color-on-app-surface, #212529);
    cursor: default;
    font-weight: var(--kendo-font-weight-semibold, 600);
}

.smart-breadcrumb-navigation .breadcrumb-separator {
    color: var(--kendo-color-subtle, #596169);
    font-size: var(--kendo-font-size-sm, 0.75rem);
    user-select: none;
}

.smart-breadcrumb-navigation.disabled {
    opacity: 0.6;
    pointer-events: none;
}

/* Breadcrumb back button styling */
.smart-breadcrumb-navigation .breadcrumb-back-button {
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 50%;
    background-color: #f0f0f0;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-right: 0.7rem;
    
    &:disabled {
        background-color: #f8f8f8;
        cursor: not-allowed;
        opacity: 0.6;
        
        i {
            color: #999;
        }
    }
    
    i {
        font-size: 0.8rem;
        color: #666;
    }
}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""