@@ -67,27 +67,25 @@ function setupCreatorForContentManager(creator) {
67
67
} ) ;
68
68
}
69
69
70
- const SERVER_CODE_TAB_COMPONENT_NAME = "svc-tab-servercode " ;
70
+ const SERVER_CODE_TAB_COMPONENT_NAME = "SERVER_CODE_TAB_COMPONENT_NAME " ;
71
71
72
72
// Product managers can make any changes in a form JSON schema.
73
73
// If these changes require server-side code modification, backend developers can use generated code to adjust domain models.
74
74
function setupCreatorForProductManager ( creator ) {
75
- // Register a component that displays server-side code generated based upon the form JSON schema
76
- ko . components . register ( SERVER_CODE_TAB_COMPONENT_NAME , {
77
- viewModel : {
78
- createViewModel : ( params ) => {
79
- const creator = params . creator ;
80
- var model = {
81
- generatedCode : generateDomainModelsCode ( creator . survey )
82
- } ;
83
- return model ;
84
- }
85
- } ,
86
- template : `
87
- <textarea data-bind="value:generatedCode" style="width:100%;height:100%;padding:'5px'">
88
- </textarea>
89
- `
90
- } ) ;
75
+ class DomainCodeGeneratorTabComponent extends SurveyUI . Component {
76
+ render ( ) {
77
+ const textAreaStyle = { width : "100%" , heigth : "100%" , padding : "5px" } ;
78
+ const generatedCode = generateDomainModelsCode ( this . props . creator . survey )
79
+ return React . createElement ( "textarea" , { style : textAreaStyle , value : generatedCode } ) ;
80
+ }
81
+ }
82
+ window . React = { createElement : SurveyUI . createElement } ;
83
+ SurveyUI . ReactElementFactory . Instance . registerElement (
84
+ SERVER_CODE_TAB_COMPONENT_NAME ,
85
+ ( props ) => {
86
+ return React . createElement ( DomainCodeGeneratorTabComponent , props ) ;
87
+ }
88
+ ) ;
91
89
creator . onPropertyValidationCustomError . add ( ( _ , options ) => {
92
90
if ( options . propertyName !== "name" ) return ;
93
91
// Validate the `name` property for the survey, questions, and matrix columns
0 commit comments