@wavemaker/angular-codegen 12.0.0-next.45057 → 12.0.0-next.45058

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,6 @@
1
+ import { registerCustomWidgetConfig } from '../../framework/util/page-util';
2
+
3
+ export const initCustomWidgetConfig = () => {
4
+ {{registerCustomWidgetConfig customWidgetConfigMap}}
5
+ return true;
6
+ };
@@ -0,0 +1,3 @@
1
+ export const initScript = (Widget, App, Utils) => {
2
+ {{ jsContent }}
3
+ }
@@ -0,0 +1,44 @@
1
+ import { Component, Injector, Optional, ViewEncapsulation } from '@angular/core';
2
+
3
+ import { UserDefinedExecutionContext } from '@wm/core';
4
+
5
+ import { initScript } from './{{name}}.component.script';
6
+ import { getVariables } from './{{name}}.component.variables';
7
+ import { AppRef, BaseCustomWidgetComponent } from '@wm/runtime/base';
8
+ import { initCustomWidgetConfig } from '../customwidget-config'
9
+ {{WMComponentsImportStmts requiredWMComponents}}
10
+
11
+ @Component({
12
+ standalone: true,
13
+ selector: 'app-custom-{{name}}',
14
+ templateUrl: './{{name}}.component.html',
15
+ styleUrls: ['./{{name}}.component.css'],
16
+ encapsulation: ViewEncapsulation.None,
17
+ imports: [ {{WMComponentModuleStmts requiredWMComponents}}],
18
+ providers: [
19
+ {
20
+ provide: UserDefinedExecutionContext,
21
+ useExisting: {{componentName}}
22
+ }
23
+ ]
24
+ })
25
+ export class {{componentName}} extends BaseCustomWidgetComponent {
26
+
27
+ override customWidgetName = '{{name}}';
28
+ [key: string]: any;
29
+ {{#if enableSpa}}spa = true;{{/if}}
30
+
31
+ constructor() {
32
+ super();
33
+ super.init();
34
+ initCustomWidgetConfig();
35
+ }
36
+
37
+ getVariables() {
38
+ return getVariables();
39
+ }
40
+
41
+ evalUserScript(Widget, App, Utils) {
42
+ initScript(Widget, App, Utils);
43
+ }
44
+ }
@@ -4,6 +4,7 @@ import { Routes, RouterModule } from '@angular/router';
4
4
 
5
5
  import { RuntimeBaseModule, CanDeactivateNgPageGuard } from '@wm/runtime/base';
6
6
  {{WMComponentsImportStmts requiredWMComponents}}
7
+ {{WMCustomComponentsImportStmts requireCustomComponents}}
7
8
 
8
9
  import { AppCodeGenModule } from '../../app-codegen.module';
9
10
 
@@ -25,6 +26,10 @@ const requiredComponentModules = [
25
26
  {{WMComponentModuleStmts requiredWMComponents}}
26
27
  ];
27
28
 
29
+ const requiredCustomWidgetComponents= [
30
+ {{WMCustomComponentStmts requireCustomComponents}}
31
+ ]
32
+
28
33
  const requiredPartialModules: any[] = [
29
34
  {{PartialModuleStmts requiredPartials}}
30
35
  ];
@@ -34,6 +39,7 @@ const requiredPartialModules: any[] = [
34
39
  imports: [
35
40
  ...requiredComponentModules,
36
41
  ...requiredPartialModules,
42
+ ...requiredCustomWidgetComponents,
37
43
  RouterModule.forChild(routes),
38
44
  NgCommonModule,
39
45
  AppCodeGenModule,