@@ -5,6 +5,7 @@ import { GenerateImportedSymbol } from 'src/codegen/dataTypes/GenerateImportedSy
5
5
import { GenerateObject } from 'src/codegen/dataTypes/GenerateObject' ;
6
6
import { GenerateRaw } from 'src/codegen/dataTypes/GenerateRaw' ;
7
7
import { GenerateUnion } from 'src/codegen/dataTypes/GenerateUnion' ;
8
+ import { ExprVal } from 'src/features/expressions/types' ;
8
9
import { ValidationPlugin } from 'src/features/validation/ValidationPlugin' ;
9
10
import { CompCategory } from 'src/layout/common' ;
10
11
import { isNodeDefChildrenPlugin , NodeDefPlugin } from 'src/utils/layout/plugins/NodeDefPlugin' ;
@@ -157,6 +158,24 @@ export class ComponentConfig {
157
158
158
159
const name = 'dataModelBindings' ;
159
160
const existing = this . inner . getProperty ( name ) ?. type ;
161
+
162
+ if ( ! existing || existing instanceof GenerateRaw ) {
163
+ // For all components with dataModelBindings, the backend wants this property defined so that app-developers can
164
+ // escape from hidden-data-deletion per-component.
165
+ this . inner . addProperty (
166
+ new CG . prop (
167
+ 'removeWhenHidden' ,
168
+ new CG . expr ( ExprVal . Boolean )
169
+ . setTitle ( 'Remove fields from component dataModelBindings when hidden expression is true' )
170
+ . setDescription (
171
+ 'Override the logic cleaning data for hidden components at task end, if you want to keep data ' +
172
+ 'referenced in hidden components. Currently only has effect if AppSettings.RemoveHiddenData is enabled.' ,
173
+ )
174
+ . optional ( ) ,
175
+ ) ,
176
+ ) ;
177
+ }
178
+
160
179
if ( existing && existing instanceof GenerateUnion ) {
161
180
existing . addType ( type ) ;
162
181
} else if ( existing && ! ( existing instanceof GenerateRaw ) ) {
0 commit comments