@@ -12,18 +12,31 @@ export const filterProcessSync: ProcessorFnSync<FilterScope> = (context: FilterC
12
12
const modelType = Utils . getModelType ( component ) ;
13
13
switch ( modelType ) {
14
14
case 'dataObject' :
15
- scope . filter [ absolutePath ] = { data : { } } ;
15
+ scope . filter [ absolutePath ] = {
16
+ compModelType : modelType ,
17
+ include : true ,
18
+ value : { data : { } }
19
+ } ;
16
20
break ;
17
21
case 'array' :
18
- scope . filter [ absolutePath ] = true ;
22
+ scope . filter [ absolutePath ] = {
23
+ compModelType : modelType ,
24
+ include : true ,
25
+ } ;
19
26
break ;
20
27
case 'object' :
21
28
if ( component . type !== 'container' ) {
22
- scope . filter [ absolutePath ] = true ;
29
+ scope . filter [ absolutePath ] = {
30
+ compModelType : modelType ,
31
+ include : true ,
32
+ } ;
23
33
}
24
34
break ;
25
35
default :
26
- scope . filter [ absolutePath ] = true ;
36
+ scope . filter [ absolutePath ] = {
37
+ compModelType : modelType ,
38
+ include : true ,
39
+ } ;
27
40
break ;
28
41
}
29
42
}
@@ -37,13 +50,13 @@ export const filterPostProcess: ProcessorFnSync<FilterScope> = (context: FilterC
37
50
const { scope, submission } = context ;
38
51
const filtered = { } ;
39
52
for ( const path in scope . filter ) {
40
- if ( scope . filter [ path ] ) {
53
+ if ( scope . filter [ path ] . include ) {
41
54
let value = get ( submission ?. data , path ) ;
42
55
if ( isObject ( value ) && isObject ( scope . filter [ path ] ) ) {
43
- if ( ( value as any ) . data ) {
44
- value = { ...value , ...scope . filter [ path ] , data : ( value as any ) ?. data }
56
+ if ( scope . filter [ path ] . compModelType === 'dataObject' ) {
57
+ value = { ...value , ...scope . filter [ path ] . value , data : ( value as any ) ?. data }
45
58
} else {
46
- value = { ...value , ...scope . filter [ path ] }
59
+ value = { ...value , ...scope . filter [ path ] . value }
47
60
}
48
61
}
49
62
set ( filtered , path , value ) ;
0 commit comments