@@ -35,7 +35,11 @@ export type IOptionPathGetter = () => string;
3535export const _updateNestedItems = (
3636 items : QueryList < { propertyName : string ; className : string ; component : ICollectionNestedOption } > ,
3737 setChildrenFn : ( propertyName : string , items : QueryList < ICollectionNestedOption > ) => void ,
38- { componentClassName, legacyClassNames } : { componentClassName : string ; legacyClassNames : Record < string , string [ ] > } ,
38+ {
39+ componentClassName,
40+ legacyClassNames,
41+ currentOptions,
42+ } : { componentClassName : string ; legacyClassNames : Record < string , string [ ] > , currentOptions : Map < string , any > } ,
3943) => {
4044 const hasLegacy = { } ;
4145 const groupedItems = { } ;
@@ -62,9 +66,16 @@ export const _updateNestedItems = (
6266 const queryList = new QueryList < ICollectionNestedOption > ( ) ;
6367
6468 queryList . reset ( components ) ;
65-
69+ currentOptions . set ( propertyName , true ) ;
6670 setChildrenFn ( propertyName , queryList ) ;
6771 } ) ;
72+
73+ currentOptions . forEach ( ( updated , propertyName ) => {
74+ if ( ! updated ) {
75+ setChildrenFn ( propertyName , new QueryList < ICollectionNestedOption > ( ) ) ;
76+ }
77+ currentOptions . set ( propertyName , false ) ;
78+ } )
6879} ;
6980
7081@Component ( {
@@ -82,6 +93,8 @@ export abstract class BaseNestedOption implements INestedOptionContainer, IColle
8293 protected abstract get _optionPath ( ) : string ;
8394 protected abstract _fullOptionPath ( ) : string ;
8495
96+ private _currentNestedOptions :Map < string , any > = new Map ( ) ;
97+
8598 constructor ( ) {
8699 this . _collectionContainerImpl = new CollectionNestedOptionContainerImpl ( this . _setOption . bind ( this ) , this . _filterItems . bind ( this ) ) ;
87100 }
@@ -94,6 +107,7 @@ export abstract class BaseNestedOption implements INestedOptionContainer, IColle
94107 {
95108 componentClassName : this . constructor . name ,
96109 legacyClassNames : null ,
110+ currentOptions : this . _currentNestedOptions
97111 } ,
98112 ) ;
99113 }
0 commit comments