11import {
22 ChangeDetectionStrategy ,
33 Component ,
4- HostBinding ,
54 Signal ,
65 booleanAttribute ,
76 computed ,
@@ -16,7 +15,6 @@ import { SplitAreaSize, areaSizeTransform, boundaryAreaSizeTransform } from '../
1615
1716@Component ( {
1817 selector : 'as-split-area' ,
19- standalone : true ,
2018 exportAs : 'asSplitArea' ,
2119 templateUrl : './split-area.component.html' ,
2220 styleUrl : './split-area.component.css' ,
@@ -27,6 +25,12 @@ import { SplitAreaSize, areaSizeTransform, boundaryAreaSizeTransform } from '../
2725 } ,
2826 ] ,
2927 changeDetection : ChangeDetectionStrategy . OnPush ,
28+ host : {
29+ '[class]' : 'hostClasses()' ,
30+ '[style.grid-column]' : 'hostGridColumnStyle()' ,
31+ '[style.grid-row]' : 'hostGridRowStyle()' ,
32+ '[style.position]' : 'hostPositionStyle()' ,
33+ } ,
3034} )
3135export class SplitAreaComponent {
3236 protected readonly split = inject ( SplitComponent )
@@ -58,28 +62,22 @@ export class SplitAreaComponent {
5862 */
5963 readonly _normalizedMaxSize = computed ( ( ) => this . normalizeMaxSize ( ) )
6064 private readonly index = computed ( ( ) => this . split . _areas ( ) . findIndex ( ( area ) => area === this ) )
61- private readonly gridAreaNum = computed ( ( ) => this . index ( ) * 2 + 1 )
62- private readonly hostClasses = computed ( ( ) =>
65+ protected readonly gridAreaNum = computed ( ( ) => this . index ( ) * 2 + 1 )
66+ protected readonly hostClasses = computed ( ( ) =>
6367 createClassesString ( {
6468 [ 'as-split-area' ] : true ,
6569 [ 'as-min' ] : this . visible ( ) && this . _internalSize ( ) === this . _normalizedMinSize ( ) ,
6670 [ 'as-max' ] : this . visible ( ) && this . _internalSize ( ) === this . _normalizedMaxSize ( ) ,
6771 [ 'as-hidden' ] : ! this . visible ( ) ,
6872 } ) ,
6973 )
70-
71- @HostBinding ( 'class' ) protected get hostClassesBinding ( ) {
72- return this . hostClasses ( )
73- }
74- @HostBinding ( 'style.grid-column' ) protected get hostGridColumnStyleBinding ( ) {
75- return this . split . direction ( ) === 'horizontal' ? `${ this . gridAreaNum ( ) } / ${ this . gridAreaNum ( ) } ` : undefined
76- }
77- @HostBinding ( 'style.grid-row' ) protected get hostGridRowStyleBinding ( ) {
78- return this . split . direction ( ) === 'vertical' ? `${ this . gridAreaNum ( ) } / ${ this . gridAreaNum ( ) } ` : undefined
79- }
80- @HostBinding ( 'style.position' ) protected get hostPositionStyleBinding ( ) {
81- return this . split . _isDragging ( ) ? 'relative' : undefined
82- }
74+ protected readonly hostGridColumnStyle = computed ( ( ) =>
75+ this . split . direction ( ) === 'horizontal' ? `${ this . gridAreaNum ( ) } / ${ this . gridAreaNum ( ) } ` : undefined ,
76+ )
77+ protected readonly hostGridRowStyle = computed ( ( ) =>
78+ this . split . direction ( ) === 'vertical' ? `${ this . gridAreaNum ( ) } / ${ this . gridAreaNum ( ) } ` : undefined ,
79+ )
80+ protected readonly hostPositionStyle = computed ( ( ) => ( this . split . _isDragging ( ) ? 'relative' : undefined ) )
8381
8482 private normalizeMinSize ( ) {
8583 const defaultMinSize = 0
0 commit comments