1+ import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api' ;
2+ import { UmbObjectState , appendToFrozenArray } from '@umbraco-cms/backoffice/observable-api' ;
3+ import { UmbContextBase } from '@umbraco-cms/backoffice/class-api' ;
4+ import { UMB_PROPERTY_CONTEXT } from '@umbraco-cms/backoffice/property' ;
5+ import { umbConfirmModal } from '@umbraco-cms/backoffice/modal' ;
6+ import { UMB_BLOCK_GRID_AREA_TYPE_ENTRIES_CONTEXT } from '../../property-editors/block-grid-areas-config/block-grid-area-type-entries.context-token.js' ;
17import {
28 UmbBlockGridScaleManager ,
39 type UmbBlockGridScalableContext ,
410} from '../../context/block-grid-scale-manager/block-grid-scale-manager.controller.js' ;
5- import { UMB_BLOCK_GRID_AREA_TYPE_ENTRIES_CONTEXT } from '../../property-editors/block-grid-areas-config/block-grid-area-type-entries.context-token.js' ;
611import { UMB_BLOCK_GRID_AREA_CONFIG_ENTRY_CONTEXT } from './block-grid-area-config-entry.context-token.js' ;
712import type { UmbBlockGridTypeAreaType } from '@umbraco-cms/backoffice/block-grid' ;
8- import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api' ;
9- import { UmbObjectState } from '@umbraco-cms/backoffice/observable-api' ;
10- import { UmbContextBase } from '@umbraco-cms/backoffice/class-api' ;
11- import { UMB_PROPERTY_CONTEXT } from '@umbraco-cms/backoffice/property' ;
12- import { umbConfirmModal } from '@umbraco-cms/backoffice/modal' ;
1313export class UmbBlockGridAreaConfigEntryContext
1414 extends UmbContextBase < UmbBlockGridAreaConfigEntryContext >
1515 implements UmbBlockGridScalableContext
@@ -21,6 +21,7 @@ export class UmbBlockGridAreaConfigEntryContext
2121 //
2222 #areaKey?: string ;
2323 #area = new UmbObjectState < UmbBlockGridTypeAreaType | undefined > ( undefined ) ;
24+ readonly area = this . #area. asObservable ( ) ;
2425 readonly alias = this . #area. asObservablePart ( ( x ) => x ?. alias ) ;
2526 readonly columnSpan = this . #area. asObservablePart ( ( x ) => x ?. columnSpan ) ;
2627 readonly rowSpan = this . #area. asObservablePart ( ( x ) => x ?. rowSpan ?? 1 ) ;
@@ -85,7 +86,19 @@ export class UmbBlockGridAreaConfigEntryContext
8586 this . #area. setValue ( areaType ) ;
8687 }
8788 } ,
88- 'observeAreaKey' ,
89+ 'observeAreaData' ,
90+ ) ;
91+ this . observe (
92+ this . area ,
93+ ( area ) => {
94+ if ( area && this . #propertyContext) {
95+ const value = this . #propertyContext. getValue ( ) as Array < UmbBlockGridTypeAreaType > | undefined ;
96+ if ( ! value ) return ;
97+ const newValue = appendToFrozenArray ( value , area , ( x ) => x . key === this . #areaKey) ;
98+ this . #propertyContext?. setValue ( newValue ) ;
99+ }
100+ } ,
101+ 'observeInternalArea' ,
89102 ) ;
90103 }
91104
0 commit comments