File

core/resizable-grid/resizable-grid.component.ts

Implements

OnInit AfterViewInit OnChanges OnDestroy

Metadata

Index

Properties
Methods
Inputs
HostBindings
HostListeners
Accessors

Constructor

constructor(renderer: Renderer2)

Creates an instance of ResizableGridComponent.

Parameters :
Name Type Optional Description
renderer Renderer2 No

Angular Renderer2 for DOM manipulation.

Inputs

collapseThreshold
Type : number
Default value : 320

Minimum width (in pixels) before a column is considered collapsed.

leftColumnWidth
Type : string
Default value : '50%'

Initial width of the left column (A). Can be any valid CSS width value (e.g., '50%', '300px').

trackId
Type : string | null
Default value : null

Optional key for localStorage to persist the left column width between sessions.

HostBindings

class.is-resizing
Type : boolean
Default value : false

True if the user is currently resizing the grid.

style.--col-a-width
Type : string
Default value : '50%'

CSS width value for the left column (A). Used for dynamic styling via HostBinding.

HostListeners

window:mousemove
Arguments : '$event'
window:mousemove(event: MouseEvent)

Mouse move event handler for resizing columns.

Parameters :
Name Optional Description
event No

MouseEvent

window:mouseup
window:mouseup()

Mouse up event handler for ending resize and applying collapse logic.

Methods

ngAfterViewInit
ngAfterViewInit()

Angular lifecycle hook. Sets up initial column width after view initialization.

Returns : void
ngOnChanges
ngOnChanges(changes: SimpleChanges)

Angular lifecycle hook. Handles changes to input properties.

Parameters :
Name Type Optional Description
changes SimpleChanges No

Object containing changed input properties.

Returns : void
ngOnDestroy
ngOnDestroy()

Angular lifecycle hook. Cleans up cursor style if resizing is active.

Returns : void
ngOnInit
ngOnInit()
Returns : void
onKeyDown
onKeyDown(event: KeyboardEvent)

Keyboard event handler for resizing columns with arrow keys.

Parameters :
Name Type Optional Description
event KeyboardEvent No

KeyboardEvent

Returns : void
onMouseDown
onMouseDown(event: MouseEvent)

Mouse down event handler for starting resize.

Parameters :
Name Type Optional Description
event MouseEvent No

MouseEvent

Returns : void
onMouseMove
onMouseMove(event: MouseEvent)
Decorators :
@HostListener('window:mousemove', ['$event'])

Mouse move event handler for resizing columns.

Parameters :
Name Type Optional Description
event MouseEvent No

MouseEvent

Returns : void
onMouseUp
onMouseUp()
Decorators :
@HostListener('window:mouseup')

Mouse up event handler for ending resize and applying collapse logic.

Returns : void

Properties

colA
Type : ElementRef<HTMLDivElement>
Decorators :
@ViewChild('colA')

Reference to the left column element.

colAId
Type : string
colB
Type : ElementRef<HTMLDivElement>
Decorators :
@ViewChild('colB')

Reference to the right column element.

colBId
Type : string
isResizing
Default value : false
Decorators :
@HostBinding('class.is-resizing')

True if the user is currently resizing the grid.

Accessors

colAWidthPercent
getcolAWidthPercent()

Public getter for aria-valuenow

Returns : number
<div class="resizable-grid-container" [class.is-resizing]="isResizing">
  <div #colA class="col-a" [id]="colAId">
    <!-- Content for the left column goes here -->
    <ng-content select="[left-pane]"></ng-content>
  </div>
  <div
    class="resizer"
    (mousedown)="onMouseDown($event)"
    (keydown)="onKeyDown($event)"
    tabindex="0"
    role="separator"
    aria-orientation="vertical"
    [attr.aria-controls]="colAId + ' ' + colBId"
    [attr.aria-label]="'Resize columns' | translate"
    [attr.aria-valuenow]="colAWidthPercent"
    aria-valuemin="0"
    aria-valuemax="100"
  >
    <i class="dlt-c8y-icon-arrow-circle-divide-horizontal"></i>
  </div>
  <div #colB class="col-b" [id]="colBId">
    <!-- Content for the right column goes here -->
    <ng-content select="[right-pane]"></ng-content>
  </div>
</div>

results matching ""

    No results matching ""