File

src/ui/layout-container/smart-layout-container.component.ts

Description

SmartLayoutContainerComponent handles rendering of JSON layouts with columns/rows structure and manages stretch mode/flexbox styling for immediate children components.

Implements

OnInit OnChanges OnDestroy

Metadata

Index

Properties
Methods
Inputs
Accessors

Inputs

columnClass
Type : string
Default value : ''

Additional CSS classes to apply to columns

containerClass
Type : string
Default value : ''

Additional CSS classes to apply to the container

height
Type : number

Optional height for the container

layout
Type : any

The JSON layout configuration to render

stretchMode
Type : boolean
Default value : false

Whether to enable stretch mode for layout components

Methods

Public componentLoaded
componentLoaded(instanceName: string, componentInstance: AbstractFormChild)

Called when a child component has finished loading Applies stretch mode styling if enabled

Parameters :
Name Type Optional
instanceName string No
componentInstance AbstractFormChild No
Returns : void
Public trackByFn
trackByFn(index: number, item: any)

TrackBy function for ngFor loops

Parameters :
Name Type Optional
index number No
item any No
Returns : any

Properties

anyRowHasStretchChild
Type : unknown
Default value : false
columnWidthCssClass
Type : string
Default value : ''
containerStyles
Type : literal type
Default value : {}
flexboxStyling
Type : SmartFormItemsStyling
Default value : {}
flexDirectionClass
Type : string
Default value : 'flex-column flex-md-row'
formColumnContainer
Type : ElementRef
Decorators :
@ViewChild('formColumnContainer', {read: ElementRef})

Container element reference for applying flex direction

processedLayout
Type : any
rowStretchInfo
Type : boolean[]
Default value : []

Accessors

hasRows
gethasRows()

Whether the layout has rows structure

Returns : boolean
hasColumns
gethasColumns()

Whether the layout has columns structure

Returns : boolean
effectiveColumnClass
geteffectiveColumnClass()

CSS classes applied to each rendered form column.

Returns : string
<!--
**************************************************************************
* 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-layout-container.component.html
    Purpose     : Template for Smart Layout Container.
    Author(s)   : Radu Nicoara
    Created     : Aug 21, 2025
--------------------------------------------------------------------------
-->
<!-- Rows layout -->
@if (hasRows) {
<div
	class="container-fluid px-0 h-100"
	[ngClass]="containerClass"
	[ngStyle]="containerStyles"
>
	<div class="d-flex flex-column h-100 gap-2 rows-flex-container">
		@for (row of processedLayout.rows; track trackByFn(idx, row); let last =
		$last; let idx = $index) {
		<FormRow
			class="smart-form-row"
			[formItems]="row.items"
			[stretchMode]="stretchMode"
			[isLastRow]="last"
			[shouldStretch]="rowStretchInfo[idx]"
		>
		</FormRow>
		}
	</div>
</div>
}

<!-- Columns layout -->
@if (hasColumns) {
<div
	class="container-fluid px-0 h-100"
	[ngClass]="containerClass"
	[ngStyle]="containerStyles"
>
	<div
		#formColumnContainer
		class="flex-container d-flex flex-column flex-md-row p-0"
		[ngClass]="{
			'pe-2 gap-2':
				$safeNavigationMigration(processedLayout.columns?.length) > 1
		}"
		style="overflow-y: auto; overflow-x: hidden"
	>
		@for (column of processedLayout.columns; track trackByFn(idx, column);
		let idx = $index) {
		<FormColumn
			[class]="
				'form-column gap-2 ' +
				columnWidthCssClass +
				' ' +
				effectiveColumnClass
			"
			[formItems]="column.items"
		>
		</FormColumn>
		}
	</div>
</div>
}

./smart-layout-container.component.scss

/**********************************************************************
 * 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-layout-container.component.scss
    Purpose     : Styles for Smart Layout Container.
    Author(s)   : Radu Nicoara
    Created     : Aug 21, 2025
  ----------------------------------------------------------------------*/

/* Smart Layout Container Component Styles */

:host {
    display: block;
    width: 100%;
    height: 100%;
}

.flex-container {
    &.d-flex {
        height: 100%;
        width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
        
        .form-column {
            display: flex;
            flex-direction: column;
            min-height: 0; // allow children to shrink and avoid overflow when siblings have fixed heights (e.g., toolbar)
            padding-left: 0; // neutralize Bootstrap column gutter when not direct child of .row
            padding-right: 0; // neutralize Bootstrap column gutter when not direct child of .row
            min-width: 0; // prevent horizontal overflow due to content sizing
            box-sizing: border-box;
            height: 100%; // ensure vertical flex children can stretch using available height
        }
    }
}

:host-context(.split-pane-left-container) .flex-container.d-flex,
:host-context(.split-pane-right-container) .flex-container.d-flex {
    padding-right: 2px;
}

.rows-flex-container {
    min-height: 0; // allow flex children to shrink below natural content height
}

.smart-form-row {    
    &.flex-md-row {
        @media (min-width: 768px) {
            .form-column {
                margin-bottom: 0;
                margin-right: 1rem;
                
                &:last-child {
                    margin-right: 0;
                }
            }
        }
    }
}

// Stretch mode specific styles
:host-context(.stretch-mode) {
    .container-fluid {
        height: 100%;
        display: flex;
        flex-direction: column;
    }
    
    .smart-form-row {
        flex: 1;
        display: flex;
        
        .form-column {
            display: flex;
            flex-direction: column;
            min-height: 0; // critical for nested flex layout in tab pages
        }
    }
}

// Responsive adjustments
@media (max-width: 767.98px) {
    .flex-container {
        flex-direction: column !important;
        
        .form-column {
            width: 100% !important;
            max-width: 100% !important;
        }
    }
}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""