Commit d08e6dba5d42913fccd4ca67b2e00eea3d5ecfd6

Authored by Vladyslav Prykhodko
1 parent 894a1df1

UI: Added global scope variables in javascript functions

@@ -68,6 +68,10 @@ export class WidgetService { @@ -68,6 +68,10 @@ export class WidgetService {
68 ); 68 );
69 } 69 }
70 70
  71 + public getWidgetScopeVariables(): string[] {
  72 + return ['tinycolor', 'cssjs', 'moment', '$', 'jQuery'];
  73 + }
  74 +
71 public getAllWidgetsBundles(config?: RequestConfig): Observable<Array<WidgetsBundle>> { 75 public getAllWidgetsBundles(config?: RequestConfig): Observable<Array<WidgetsBundle>> {
72 return this.loadWidgetsBundleCache(config).pipe( 76 return this.loadWidgetsBundleCache(config).pipe(
73 map(() => this.allWidgetsBundles) 77 map(() => this.allWidgetsBundles)
@@ -311,5 +315,4 @@ export class WidgetService { @@ -311,5 +315,4 @@ export class WidgetService {
311 this.loadWidgetsBundleCacheSubject = undefined; 315 this.loadWidgetsBundleCacheSubject = undefined;
312 this.widgetTypeInfosCache.clear(); 316 this.widgetTypeInfosCache.clear();
313 } 317 }
314 -  
315 } 318 }
@@ -44,6 +44,7 @@ @@ -44,6 +44,7 @@
44 (ngModelChange)="onActionUpdated()" 44 (ngModelChange)="onActionUpdated()"
45 [fillHeight]="true" 45 [fillHeight]="true"
46 [functionArgs]="['$event', 'widgetContext', 'entityId', 'entityName', 'htmlTemplate', 'additionalParams', 'entityLabel']" 46 [functionArgs]="['$event', 'widgetContext', 'entityId', 'entityName', 'htmlTemplate', 'additionalParams', 'entityLabel']"
  47 + [globalVariables]="functionScopeVariables"
47 [validationArgs]="[]" 48 [validationArgs]="[]"
48 [editorCompleter]="customPrettyActionEditorCompleter"> 49 [editorCompleter]="customPrettyActionEditorCompleter">
49 </tb-js-func> 50 </tb-js-func>
@@ -36,6 +36,7 @@ import { AppState } from '@core/core.state'; @@ -36,6 +36,7 @@ import { AppState } from '@core/core.state';
36 import { combineLatest } from 'rxjs'; 36 import { combineLatest } from 'rxjs';
37 import { CustomActionDescriptor } from '@shared/models/widget.models'; 37 import { CustomActionDescriptor } from '@shared/models/widget.models';
38 import { CustomPrettyActionEditorCompleter } from '@home/components/widget/action/custom-action.models'; 38 import { CustomPrettyActionEditorCompleter } from '@home/components/widget/action/custom-action.models';
  39 +import { WidgetService } from "@core/http/widget.service";
39 40
40 @Component({ 41 @Component({
41 selector: 'tb-custom-action-pretty-editor', 42 selector: 'tb-custom-action-pretty-editor',
@@ -58,6 +59,8 @@ export class CustomActionPrettyEditorComponent extends PageComponent implements @@ -58,6 +59,8 @@ export class CustomActionPrettyEditorComponent extends PageComponent implements
58 59
59 fullscreen = false; 60 fullscreen = false;
60 61
  62 + functionScopeVariables: string[];
  63 +
61 @ViewChildren('leftPanel') 64 @ViewChildren('leftPanel')
62 leftPanelElmRef: QueryList<ElementRef<HTMLElement>>; 65 leftPanelElmRef: QueryList<ElementRef<HTMLElement>>;
63 66
@@ -68,8 +71,10 @@ export class CustomActionPrettyEditorComponent extends PageComponent implements @@ -68,8 +71,10 @@ export class CustomActionPrettyEditorComponent extends PageComponent implements
68 71
69 private propagateChange = (_: any) => {}; 72 private propagateChange = (_: any) => {};
70 73
71 - constructor(protected store: Store<AppState>) { 74 + constructor(protected store: Store<AppState>,
  75 + private widgetService: WidgetService) {
72 super(store); 76 super(store);
  77 + this.functionScopeVariables = this.widgetService.getWidgetScopeVariables();
73 } 78 }
74 79
75 ngOnInit(): void { 80 ngOnInit(): void {
@@ -94,6 +94,7 @@ @@ -94,6 +94,7 @@
94 [(ngModel)]="action.customFunction" 94 [(ngModel)]="action.customFunction"
95 (ngModelChange)="notifyActionUpdated()" 95 (ngModelChange)="notifyActionUpdated()"
96 [functionArgs]="['$event', 'widgetContext', 'entityId', 'entityName', 'htmlTemplate', 'additionalParams', 'entityLabel']" 96 [functionArgs]="['$event', 'widgetContext', 'entityId', 'entityName', 'htmlTemplate', 'additionalParams', 'entityLabel']"
  97 + [globalVariables]="functionScopeVariables"
97 [validationArgs]="[]" 98 [validationArgs]="[]"
98 [editorCompleter]="customPrettyActionEditorCompleter"> 99 [editorCompleter]="customPrettyActionEditorCompleter">
99 </tb-js-func> 100 </tb-js-func>
@@ -41,6 +41,7 @@ import { forkJoin, from } from 'rxjs'; @@ -41,6 +41,7 @@ import { forkJoin, from } from 'rxjs';
41 import { map, tap } from 'rxjs/operators'; 41 import { map, tap } from 'rxjs/operators';
42 import { getAce } from '@shared/models/ace/ace.models'; 42 import { getAce } from '@shared/models/ace/ace.models';
43 import { beautifyCss, beautifyHtml } from '@shared/models/beautify.models'; 43 import { beautifyCss, beautifyHtml } from '@shared/models/beautify.models';
  44 +import { WidgetService } from "@core/http/widget.service";
44 45
45 @Component({ 46 @Component({
46 selector: 'tb-custom-action-pretty-resources-tabs', 47 selector: 'tb-custom-action-pretty-resources-tabs',
@@ -75,12 +76,16 @@ export class CustomActionPrettyResourcesTabsComponent extends PageComponent impl @@ -75,12 +76,16 @@ export class CustomActionPrettyResourcesTabsComponent extends PageComponent impl
75 cssEditor: Ace.Editor; 76 cssEditor: Ace.Editor;
76 setValuesPending = false; 77 setValuesPending = false;
77 78
  79 + functionScopeVariables: string[];
  80 +
78 customPrettyActionEditorCompleter = CustomPrettyActionEditorCompleter; 81 customPrettyActionEditorCompleter = CustomPrettyActionEditorCompleter;
79 82
80 constructor(protected store: Store<AppState>, 83 constructor(protected store: Store<AppState>,
81 private translate: TranslateService, 84 private translate: TranslateService,
  85 + private widgetService: WidgetService,
82 private raf: RafService) { 86 private raf: RafService) {
83 super(store); 87 super(store);
  88 + this.functionScopeVariables = this.widgetService.getWidgetScopeVariables();
84 } 89 }
85 90
86 ngOnInit(): void { 91 ngOnInit(): void {
@@ -35,6 +35,7 @@ @@ -35,6 +35,7 @@
35 formControlName="getLocationFunction" 35 formControlName="getLocationFunction"
36 functionName="getLocation" 36 functionName="getLocation"
37 [functionArgs]="['$event', 'widgetContext', 'entityId', 'entityName', 'additionalParams', 'entityLabel']" 37 [functionArgs]="['$event', 'widgetContext', 'entityId', 'entityName', 'additionalParams', 'entityLabel']"
  38 + [globalVariables]="functionScopeVariables"
38 [editorCompleter]="customActionEditorCompleter" 39 [editorCompleter]="customActionEditorCompleter"
39 ></tb-js-func> 40 ></tb-js-func>
40 </ng-template> 41 </ng-template>
@@ -43,6 +44,7 @@ @@ -43,6 +44,7 @@
43 formControlName="getPhoneNumberFunction" 44 formControlName="getPhoneNumberFunction"
44 functionName="getPhoneNumber" 45 functionName="getPhoneNumber"
45 [functionArgs]="['$event', 'widgetContext', 'entityId', 'entityName', 'additionalParams', 'entityLabel']" 46 [functionArgs]="['$event', 'widgetContext', 'entityId', 'entityName', 'additionalParams', 'entityLabel']"
  47 + [globalVariables]="functionScopeVariables"
46 [editorCompleter]="customActionEditorCompleter" 48 [editorCompleter]="customActionEditorCompleter"
47 ></tb-js-func> 49 ></tb-js-func>
48 </ng-template> 50 </ng-template>
@@ -54,6 +56,7 @@ @@ -54,6 +56,7 @@
54 formControlName="processImageFunction" 56 formControlName="processImageFunction"
55 functionName="processImage" 57 functionName="processImage"
56 [functionArgs]="['imageUrl', '$event', 'widgetContext', 'entityId', 'entityName', 'additionalParams', 'entityLabel']" 58 [functionArgs]="['imageUrl', '$event', 'widgetContext', 'entityId', 'entityName', 'additionalParams', 'entityLabel']"
  59 + [globalVariables]="functionScopeVariables"
57 [editorCompleter]="customActionEditorCompleter" 60 [editorCompleter]="customActionEditorCompleter"
58 ></tb-js-func> 61 ></tb-js-func>
59 </ng-template> 62 </ng-template>
@@ -62,6 +65,7 @@ @@ -62,6 +65,7 @@
62 formControlName="processQrCodeFunction" 65 formControlName="processQrCodeFunction"
63 functionName="processQrCode" 66 functionName="processQrCode"
64 [functionArgs]="['code', 'format', '$event', 'widgetContext', 'entityId', 'entityName', 'additionalParams', 'entityLabel']" 67 [functionArgs]="['code', 'format', '$event', 'widgetContext', 'entityId', 'entityName', 'additionalParams', 'entityLabel']"
  68 + [globalVariables]="functionScopeVariables"
65 [editorCompleter]="customActionEditorCompleter" 69 [editorCompleter]="customActionEditorCompleter"
66 ></tb-js-func> 70 ></tb-js-func>
67 </ng-template> 71 </ng-template>
@@ -70,6 +74,7 @@ @@ -70,6 +74,7 @@
70 formControlName="processLocationFunction" 74 formControlName="processLocationFunction"
71 functionName="processLocation" 75 functionName="processLocation"
72 [functionArgs]="['latitude', 'longitude', '$event', 'widgetContext', 'entityId', 'entityName', 'additionalParams', 'entityLabel']" 76 [functionArgs]="['latitude', 'longitude', '$event', 'widgetContext', 'entityId', 'entityName', 'additionalParams', 'entityLabel']"
  77 + [globalVariables]="functionScopeVariables"
73 [editorCompleter]="customActionEditorCompleter" 78 [editorCompleter]="customActionEditorCompleter"
74 ></tb-js-func> 79 ></tb-js-func>
75 </ng-template> 80 </ng-template>
@@ -81,6 +86,7 @@ @@ -81,6 +86,7 @@
81 formControlName="processLaunchResultFunction" 86 formControlName="processLaunchResultFunction"
82 functionName="processLaunchResult" 87 functionName="processLaunchResult"
83 [functionArgs]="['launched', '$event', 'widgetContext', 'entityId', 'entityName', 'additionalParams', 'entityLabel']" 88 [functionArgs]="['launched', '$event', 'widgetContext', 'entityId', 'entityName', 'additionalParams', 'entityLabel']"
  89 + [globalVariables]="functionScopeVariables"
84 [editorCompleter]="customActionEditorCompleter" 90 [editorCompleter]="customActionEditorCompleter"
85 ></tb-js-func> 91 ></tb-js-func>
86 </ng-template> 92 </ng-template>
@@ -89,12 +95,14 @@ @@ -89,12 +95,14 @@
89 formControlName="handleEmptyResultFunction" 95 formControlName="handleEmptyResultFunction"
90 functionName="handleEmptyResult" 96 functionName="handleEmptyResult"
91 [functionArgs]="['$event', 'widgetContext', 'entityId', 'entityName', 'additionalParams', 'entityLabel']" 97 [functionArgs]="['$event', 'widgetContext', 'entityId', 'entityName', 'additionalParams', 'entityLabel']"
  98 + [globalVariables]="functionScopeVariables"
92 [editorCompleter]="customActionEditorCompleter" 99 [editorCompleter]="customActionEditorCompleter"
93 ></tb-js-func> 100 ></tb-js-func>
94 <tb-js-func *ngIf="mobileActionFormGroup.get('type').value" 101 <tb-js-func *ngIf="mobileActionFormGroup.get('type').value"
95 formControlName="handleErrorFunction" 102 formControlName="handleErrorFunction"
96 functionName="handleError" 103 functionName="handleError"
97 [functionArgs]="['error', '$event', 'widgetContext', 'entityId', 'entityName', 'additionalParams', 'entityLabel']" 104 [functionArgs]="['error', '$event', 'widgetContext', 'entityId', 'entityName', 'additionalParams', 'entityLabel']"
  105 + [globalVariables]="functionScopeVariables"
98 [editorCompleter]="customActionEditorCompleter" 106 [editorCompleter]="customActionEditorCompleter"
99 ></tb-js-func> 107 ></tb-js-func>
100 </div> 108 </div>
@@ -14,26 +14,29 @@ @@ -14,26 +14,29 @@
14 /// limitations under the License. 14 /// limitations under the License.
15 /// 15 ///
16 16
17 -import { Component, forwardRef, Input, OnInit, QueryList, ViewChild, ViewChildren } from '@angular/core'; 17 +import { Component, forwardRef, Input, OnInit, QueryList, ViewChildren } from '@angular/core';
18 import { ControlValueAccessor, FormBuilder, FormGroup, NG_VALUE_ACCESSOR, Validators } from '@angular/forms'; 18 import { ControlValueAccessor, FormBuilder, FormGroup, NG_VALUE_ACCESSOR, Validators } from '@angular/forms';
19 import { Store } from '@ngrx/store'; 19 import { Store } from '@ngrx/store';
20 import { AppState } from '@app/core/core.state'; 20 import { AppState } from '@app/core/core.state';
21 import { coerceBooleanProperty } from '@angular/cdk/coercion'; 21 import { coerceBooleanProperty } from '@angular/cdk/coercion';
22 -import { deepClone } from '@core/utils';  
23 import { 22 import {
24 WidgetMobileActionDescriptor, 23 WidgetMobileActionDescriptor,
25 - WidgetMobileActionType, widgetMobileActionTypeTranslationMap 24 + WidgetMobileActionType,
  25 + widgetMobileActionTypeTranslationMap
26 } from '@shared/models/widget.models'; 26 } from '@shared/models/widget.models';
27 import { CustomActionEditorCompleter } from '@home/components/widget/action/custom-action.models'; 27 import { CustomActionEditorCompleter } from '@home/components/widget/action/custom-action.models';
28 import { JsFuncComponent } from '@shared/components/js-func.component'; 28 import { JsFuncComponent } from '@shared/components/js-func.component';
29 import { 29 import {
30 - getDefaultGetLocationFunction, getDefaultGetPhoneNumberFunction, 30 + getDefaultGetLocationFunction,
  31 + getDefaultGetPhoneNumberFunction,
31 getDefaultHandleEmptyResultFunction, 32 getDefaultHandleEmptyResultFunction,
32 getDefaultHandleErrorFunction, 33 getDefaultHandleErrorFunction,
33 getDefaultProcessImageFunction, 34 getDefaultProcessImageFunction,
34 - getDefaultProcessLaunchResultFunction, getDefaultProcessLocationFunction, 35 + getDefaultProcessLaunchResultFunction,
  36 + getDefaultProcessLocationFunction,
35 getDefaultProcessQrCodeFunction 37 getDefaultProcessQrCodeFunction
36 } from '@home/components/widget/action/mobile-action-editor.models'; 38 } from '@home/components/widget/action/mobile-action-editor.models';
  39 +import { WidgetService } from "@core/http/widget.service";
37 40
38 @Component({ 41 @Component({
39 selector: 'tb-mobile-action-editor', 42 selector: 'tb-mobile-action-editor',
@@ -58,6 +61,8 @@ export class MobileActionEditorComponent implements ControlValueAccessor, OnInit @@ -58,6 +61,8 @@ export class MobileActionEditorComponent implements ControlValueAccessor, OnInit
58 mobileActionFormGroup: FormGroup; 61 mobileActionFormGroup: FormGroup;
59 mobileActionTypeFormGroup: FormGroup; 62 mobileActionTypeFormGroup: FormGroup;
60 63
  64 + functionScopeVariables: string[];
  65 +
61 private requiredValue: boolean; 66 private requiredValue: boolean;
62 get required(): boolean { 67 get required(): boolean {
63 return this.requiredValue; 68 return this.requiredValue;
@@ -73,7 +78,9 @@ export class MobileActionEditorComponent implements ControlValueAccessor, OnInit @@ -73,7 +78,9 @@ export class MobileActionEditorComponent implements ControlValueAccessor, OnInit
73 private propagateChange = (v: any) => { }; 78 private propagateChange = (v: any) => { };
74 79
75 constructor(private store: Store<AppState>, 80 constructor(private store: Store<AppState>,
76 - private fb: FormBuilder) { 81 + private fb: FormBuilder,
  82 + private widgetService: WidgetService) {
  83 + this.functionScopeVariables = this.widgetService.getWidgetScopeVariables();
77 } 84 }
78 85
79 registerOnChange(fn: any): void { 86 registerOnChange(fn: any): void {
@@ -171,6 +171,7 @@ @@ -171,6 +171,7 @@
171 <tb-js-func 171 <tb-js-func
172 formControlName="customFunction" 172 formControlName="customFunction"
173 [functionArgs]="['$event', 'widgetContext', 'entityId', 'entityName', 'additionalParams', 'entityLabel']" 173 [functionArgs]="['$event', 'widgetContext', 'entityId', 'entityName', 'additionalParams', 'entityLabel']"
  174 + [globalVariables]="functionScopeVariables"
174 [validationArgs]="[]" 175 [validationArgs]="[]"
175 [editorCompleter]="customActionEditorCompleter" 176 [editorCompleter]="customActionEditorCompleter"
176 ></tb-js-func> 177 ></tb-js-func>
@@ -47,6 +47,7 @@ import { CustomActionEditorCompleter } from '@home/components/widget/action/cust @@ -47,6 +47,7 @@ import { CustomActionEditorCompleter } from '@home/components/widget/action/cust
47 import { isDefinedAndNotNull } from '@core/utils'; 47 import { isDefinedAndNotNull } from '@core/utils';
48 import { MobileActionEditorComponent } from '@home/components/widget/action/mobile-action-editor.component'; 48 import { MobileActionEditorComponent } from '@home/components/widget/action/mobile-action-editor.component';
49 import { widgetType } from '@shared/models/widget.models'; 49 import { widgetType } from '@shared/models/widget.models';
  50 +import { WidgetService } from "@core/http/widget.service";
50 51
51 export interface WidgetActionDialogData { 52 export interface WidgetActionDialogData {
52 isAdd: boolean; 53 isAdd: boolean;
@@ -88,11 +89,14 @@ export class WidgetActionDialogComponent extends DialogComponent<WidgetActionDia @@ -88,11 +89,14 @@ export class WidgetActionDialogComponent extends DialogComponent<WidgetActionDia
88 submitted = false; 89 submitted = false;
89 widgetType = widgetType; 90 widgetType = widgetType;
90 91
  92 + functionScopeVariables: string[];
  93 +
91 constructor(protected store: Store<AppState>, 94 constructor(protected store: Store<AppState>,
92 protected router: Router, 95 protected router: Router,
93 private utils: UtilsService, 96 private utils: UtilsService,
94 private dashboardService: DashboardService, 97 private dashboardService: DashboardService,
95 private dashboardUtils: DashboardUtilsService, 98 private dashboardUtils: DashboardUtilsService,
  99 + private widgetService: WidgetService,
96 @Inject(MAT_DIALOG_DATA) public data: WidgetActionDialogData, 100 @Inject(MAT_DIALOG_DATA) public data: WidgetActionDialogData,
97 @SkipSelf() private errorStateMatcher: ErrorStateMatcher, 101 @SkipSelf() private errorStateMatcher: ErrorStateMatcher,
98 public dialogRef: MatDialogRef<WidgetActionDialogComponent, WidgetActionDescriptorInfo>, 102 public dialogRef: MatDialogRef<WidgetActionDialogComponent, WidgetActionDescriptorInfo>,
@@ -109,6 +113,7 @@ export class WidgetActionDialogComponent extends DialogComponent<WidgetActionDia @@ -109,6 +113,7 @@ export class WidgetActionDialogComponent extends DialogComponent<WidgetActionDia
109 } else { 113 } else {
110 this.action = this.data.action; 114 this.action = this.data.action;
111 } 115 }
  116 + this.functionScopeVariables = this.widgetService.getWidgetScopeVariables();
112 } 117 }
113 118
114 ngOnInit(): void { 119 ngOnInit(): void {
@@ -67,6 +67,7 @@ @@ -67,6 +67,7 @@
67 <br/> 67 <br/>
68 <tb-js-func #funcBodyEdit 68 <tb-js-func #funcBodyEdit
69 [functionArgs]="['time', 'prevValue']" 69 [functionArgs]="['time', 'prevValue']"
  70 + [globalVariables]="functionScopeVariables"
70 [validationArgs]="[[1, 1],[1, '1']]" 71 [validationArgs]="[[1, 1],[1, '1']]"
71 resultType="any" 72 resultType="any"
72 formControlName="funcBody"> 73 formControlName="funcBody">
@@ -78,6 +79,7 @@ @@ -78,6 +79,7 @@
78 </mat-checkbox> 79 </mat-checkbox>
79 <tb-js-func *ngIf="dataKeyFormGroup.get('usePostProcessing').value" #postFuncBodyEdit 80 <tb-js-func *ngIf="dataKeyFormGroup.get('usePostProcessing').value" #postFuncBodyEdit
80 [functionArgs]="['time', 'value', 'prevValue', 'timePrev', 'prevOrigValue']" 81 [functionArgs]="['time', 'value', 'prevValue', 'timePrev', 'prevOrigValue']"
  82 + [globalVariables]="functionScopeVariables"
81 [validationArgs]="[[1, 1, 1, 1, 1],[1, '1', '1', 1, '1']]" 83 [validationArgs]="[[1, 1, 1, 1, 1],[1, '1', '1', 1, '1']]"
82 resultType="any" 84 resultType="any"
83 formControlName="postFuncBody"> 85 formControlName="postFuncBody">
@@ -40,6 +40,7 @@ import { map, mergeMap, publishReplay, refCount, tap } from 'rxjs/operators'; @@ -40,6 +40,7 @@ import { map, mergeMap, publishReplay, refCount, tap } from 'rxjs/operators';
40 import { alarmFields } from '@shared/models/alarm.models'; 40 import { alarmFields } from '@shared/models/alarm.models';
41 import { JsFuncComponent } from '@shared/components/js-func.component'; 41 import { JsFuncComponent } from '@shared/components/js-func.component';
42 import { JsonFormComponentData } from '@shared/components/json-form/json-form-component.models'; 42 import { JsonFormComponentData } from '@shared/components/json-form/json-form-component.models';
  43 +import { WidgetService } from "@core/http/widget.service";
43 44
44 @Component({ 45 @Component({
45 selector: 'tb-data-key-config', 46 selector: 'tb-data-key-config',
@@ -99,13 +100,17 @@ export class DataKeyConfigComponent extends PageComponent implements OnInit, Con @@ -99,13 +100,17 @@ export class DataKeyConfigComponent extends PageComponent implements OnInit, Con
99 100
100 keySearchText = ''; 101 keySearchText = '';
101 102
  103 + functionScopeVariables: string[];
  104 +
102 constructor(protected store: Store<AppState>, 105 constructor(protected store: Store<AppState>,
103 private utils: UtilsService, 106 private utils: UtilsService,
104 private entityService: EntityService, 107 private entityService: EntityService,
105 private dialog: MatDialog, 108 private dialog: MatDialog,
106 private translate: TranslateService, 109 private translate: TranslateService,
  110 + private widgetService: WidgetService,
107 private fb: FormBuilder) { 111 private fb: FormBuilder) {
108 super(store); 112 super(store);
  113 + this.functionScopeVariables = this.widgetService.getWidgetScopeVariables();
109 } 114 }
110 115
111 ngOnInit(): void { 116 ngOnInit(): void {
@@ -83,6 +83,8 @@ export class JsFuncComponent implements OnInit, OnDestroy, ControlValueAccessor, @@ -83,6 +83,8 @@ export class JsFuncComponent implements OnInit, OnDestroy, ControlValueAccessor,
83 83
84 @Input() editorCompleter: TbEditorCompleter; 84 @Input() editorCompleter: TbEditorCompleter;
85 85
  86 + @Input() globalVariables: Array<string>;
  87 +
86 private noValidateValue: boolean; 88 private noValidateValue: boolean;
87 get noValidate(): boolean { 89 get noValidate(): boolean {
88 return this.noValidateValue; 90 return this.noValidateValue;
@@ -190,6 +192,11 @@ export class JsFuncComponent implements OnInit, OnDestroy, ControlValueAccessor, @@ -190,6 +192,11 @@ export class JsFuncComponent implements OnInit, OnDestroy, ControlValueAccessor,
190 jsWorkerOptions.globals[arg] = false; 192 jsWorkerOptions.globals[arg] = false;
191 }); 193 });
192 } 194 }
  195 + if (this.globalVariables) {
  196 + this.globalVariables.forEach(arg => {
  197 + jsWorkerOptions.globals[arg] = false;
  198 + });
  199 + }
193 // @ts-ignore 200 // @ts-ignore
194 this.jsEditor.session.$worker.send('changeOptions', [jsWorkerOptions]); 201 this.jsEditor.session.$worker.send('changeOptions', [jsWorkerOptions]);
195 } 202 }