@magic-xpa/cli 4.1201.0-dev4121.307 → 4.1201.0-dev4121.308

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/package.json +1 -1
  2. package/src/schematics/magic-utils/config.js +2 -2
  3. package/src/schematics/magic-utils/config.js.map +1 -1
  4. package/src/schematics/magic-utils/config.ts +2 -2
  5. package/src/schematics/magic-utils/env.js +6 -5
  6. package/src/schematics/magic-utils/env.js.map +1 -1
  7. package/src/schematics/magic-utils/env.ts +6 -5
  8. package/src/schematics/magic-utils/metadata.class.js +1 -1
  9. package/src/schematics/magic-utils/metadata.class.js.map +1 -1
  10. package/src/schematics/magic-utils/metadata.class.ts +1 -1
  11. package/src/schematics/mg-add/index.js +123 -9
  12. package/src/schematics/mg-add/index.js.map +1 -1
  13. package/src/schematics/mg-add/index.ts +160 -27
  14. package/templates/angular/src/{app.module.ts → app-module.ts} +3 -3
  15. package/templates/angular/src/{app.component.ts → app.ts} +1 -1
  16. package/templates/attributes/common/row_editing_button_attributes.ejs +2 -2
  17. package/templates/themes/basicHTML/combobox.ejs +10 -7
  18. package/templates/themes/basicHTML/edit.ejs +19 -9
  19. package/templates/themes/basicHTML/image.ejs +3 -2
  20. package/templates/themes/basicHTML/listbox.ejs +3 -4
  21. package/templates/themes/basicHTML/push-button.ejs +0 -1
  22. package/templates/themes/basicHTML/radio.ejs +3 -2
  23. package/templates/themes/basicHTML/tab.ejs +3 -1
  24. package/templates/themes/basicHiddenHTML/radio.ejs +3 -2
  25. package/templates/themes/basicHiddenHTML/table.ejs +7 -3
  26. package/templates/themes/container.ejs +12 -1
  27. package/templates/themes/material/combobox.ejs +9 -7
  28. package/templates/themes/material/edit.ejs +30 -26
  29. package/templates/themes/material/listbox.ejs +3 -4
  30. package/templates/themes/material/push-button.ejs +0 -1
  31. package/templates/themes/material/radio.ejs +3 -3
  32. package/templates/themes/material/tab.ejs +3 -1
  33. package/templates/themes/table/HTMLTable/table.ejs +7 -3
  34. package/templates/themes/table/repeatable/table.ejs +7 -3
  35. /package/src/schematics/mg-add/files/src/app/{app.component.html → app.html} +0 -0
  36. /package/templates/angular/src/app/{app.component.html.ejs → app.html.ejs} +0 -0
@@ -15,7 +15,7 @@ import { LogLn } from "../magic-utils/Util";
15
15
  import { generate } from "../magic-utils/rules/generate.rule";
16
16
  import { GeneratedFileTypes } from "../../types/enums/generated-file-types.enum";
17
17
  import { MagicOptionScheme } from "../magic-utils/rules/magic-option.scheme";
18
- import {addProviderToModule, insertImport} from "../utils/devkit-utils/ast-utils";
18
+ import {addProviderToModule, getDecoratorMetadata, insertImport} from "../utils/devkit-utils/ast-utils";
19
19
  import * as ts from 'typescript';
20
20
  import {InsertChange} from "../utils/devkit-utils/change";
21
21
  export function mgAdd(options:MagicOptionScheme): Rule {
@@ -32,7 +32,9 @@ export function mgAdd(options:MagicOptionScheme): Rule {
32
32
  updateTsConfigAppJson (options),
33
33
 
34
34
  addLazyLoadProvider(),
35
- // handel app.component.html
35
+
36
+ addZoneChangeDetectionProviderRule(),
37
+ //handel app.html
36
38
  //updateAppComponentHtmlFiles (options),
37
39
 
38
40
  //handel package.Json
@@ -42,8 +44,8 @@ export function mgAdd(options:MagicOptionScheme): Rule {
42
44
 
43
45
  function updateAppComponentHtmlFiles(options:MagicOptionScheme): Rule {
44
46
  return generate({
45
- template : "./templates/angular/src/app/app.component.html.ejs",
46
- name : "app.component.html",
47
+ template : "./templates/angular/src/app/app.html.ejs",
48
+ name : "app.html",
47
49
  destination : env.metadata.paths.rootMagicGenFolder,
48
50
  type :GeneratedFileTypes.HTML,
49
51
  data : {
@@ -51,32 +53,75 @@ function updateAppComponentHtmlFiles(options:MagicOptionScheme): Rule {
51
53
  }
52
54
  },options)
53
55
  }
54
- function updateAngularJsonWithMagicStyle(options:MagicOptionScheme): Rule {
55
- return (host: Tree, context: SchematicContext) => {
56
- const project = env.project;
57
- let isDirty = false;
56
+ function updateAngularJsonWithMagicStyle(options:MagicOptionScheme): Rule {
57
+ return (host: Tree, context: SchematicContext) => {
58
+ const project = env.project;
59
+ let isDirty = false;
58
60
 
59
61
  let fullPathmagicStylePath = env.metadata.paths.magicStylePath;
60
- if (!project.architect.test.options.styles.includes(fullPathmagicStylePath)) {
61
- context.logger.info(` [>]add file ${fullPathmagicStylePath} to test`);
62
- project.architect.test.options.styles.push(fullPathmagicStylePath);
63
- isDirty = true;
64
- }
65
-
66
- if (!project.architect.build.options.styles.includes(fullPathmagicStylePath)) {
67
- context.logger.info(` [>]add file ${fullPathmagicStylePath} to build`);
68
- project.architect.build.options.styles.push(fullPathmagicStylePath);
69
- isDirty = true;
70
- }
71
-
72
- if(isDirty){
73
- let fullPath = env.metadata.paths.angularJsonPath;
74
- host.overwrite(fullPath, JSON.stringify(env.workspace, null, 2));
75
- }
62
+ // if (!project.architect.test.options.styles.includes(fullPathmagicStylePath)) {
63
+ // context.logger.info(` [>]add file ${fullPathmagicStylePath} to test`);
64
+ // project.architect.test.options.styles.push(fullPathmagicStylePath);
65
+ // isDirty = true;
66
+ // }
67
+
68
+ if (!project.architect.build.options.styles.includes(fullPathmagicStylePath)) {
69
+ context.logger.info(` [>]add file ${fullPathmagicStylePath} to build`);
70
+ project.architect.build.options.styles.push(fullPathmagicStylePath);
71
+ isDirty = true;
72
+ }
73
+
74
+ const buildOptions = project?.architect?.build?.options;
75
+ const testOptions = project?.architect?.test?.options;
76
+
77
+ if (buildOptions) {
78
+ const changed = ensurePolyfills(buildOptions, ['zone.js']);
79
+ if (changed) {
80
+ context.logger.info(` [>]add polyfill zone.js to build`);
81
+ isDirty = true;
82
+ }
83
+ }
84
+
85
+ if (testOptions) {
86
+ const changed = ensurePolyfills(testOptions, ['zone.js', 'zone.js/testing']);
87
+ if (changed) {
88
+ context.logger.info(` [>]add polyfills zone.js, zone.js/testing to test`);
89
+ isDirty = true;
90
+ }
91
+ }
92
+
93
+ if(isDirty){
94
+ let fullPath = env.metadata.paths.angularJsonPath;
95
+ host.overwrite(fullPath, JSON.stringify(env.workspace, null, 2));
96
+ }
76
97
 
77
98
  return host;
78
- };
79
- }
99
+ };
100
+ }
101
+
102
+ function ensurePolyfills(options: any, requiredPolyfills: string[]): boolean {
103
+ let polyfills: any[] = [];
104
+
105
+ if (Array.isArray(options.polyfills)) {
106
+ polyfills = [...options.polyfills];
107
+ } else if (typeof options.polyfills === 'string' && options.polyfills.trim()) {
108
+ polyfills = [options.polyfills];
109
+ }
110
+
111
+ let changed = !Array.isArray(options.polyfills);
112
+ for (const entry of requiredPolyfills) {
113
+ if (!polyfills.includes(entry)) {
114
+ polyfills.push(entry);
115
+ changed = true;
116
+ }
117
+ }
118
+
119
+ if (changed) {
120
+ options.polyfills = polyfills;
121
+ }
122
+
123
+ return changed;
124
+ }
80
125
 
81
126
  // Angular 10 , does not include .ts file for compilation
82
127
  // So to avoid compilation error , add *.module.ts in includes section
@@ -179,7 +224,7 @@ function addMagicModuleToAppModule(options: MagicOptionScheme) : Rule {
179
224
 
180
225
  function addLazyLoadProvider(): Rule {
181
226
  return (host: Tree) => {
182
- const appmodule = env.metadata.paths.rootMagicGenFolder + '/app.module.ts';
227
+ const appmodule = env.metadata.paths.rootMagicGenFolder + '/app-module.ts';
183
228
 
184
229
  const lazyLoaderService = 'LazyLoaderService';
185
230
  const lazyLoaderServicePath = './magic/lazy-loader.service';
@@ -198,6 +243,8 @@ function addLazyLoadProvider(): Rule {
198
243
  }
199
244
  host.commitUpdate(providerRecorder);
200
245
 
246
+ sourceText = host.read(appmodule).toString('utf-8');
247
+ source = ts.createSourceFile(appmodule, sourceText, ts.ScriptTarget.Latest, true);
201
248
  const lazyLoaderServiceImport = insertImport(source, appmodule, lazyLoaderService, lazyLoaderServicePath, false);
202
249
  const lazyLoaderServiceChangesRecorder = host.beginUpdate(appmodule);
203
250
  if (lazyLoaderServiceImport instanceof InsertChange)
@@ -205,6 +252,8 @@ function addLazyLoadProvider(): Rule {
205
252
  host.commitUpdate(lazyLoaderServiceChangesRecorder);
206
253
 
207
254
  // add import for MagicLazyLoaderService
255
+ sourceText = host.read(appmodule).toString('utf-8');
256
+ source = ts.createSourceFile(appmodule, sourceText, ts.ScriptTarget.Latest, true);
208
257
  const magicLazyLoaderServiceImportChanges: InsertChange = <InsertChange>insertImport(source, appmodule, 'MagicLazyLoaderService', '@magic-xpa/angular', false);
209
258
  const magicImportChangesRecorder = host.beginUpdate(appmodule);
210
259
  magicImportChangesRecorder.insertLeft(magicLazyLoaderServiceImportChanges.pos, magicLazyLoaderServiceImportChanges.toAdd)
@@ -212,3 +261,87 @@ function addLazyLoadProvider(): Rule {
212
261
  }
213
262
  }
214
263
 
264
+ function addZoneChangeDetectionProviderRule(): Rule {
265
+ return (host: Tree) => {
266
+ // Resolve the generated root module path (src/app/app-module.ts in this project layout).
267
+ const appmodule = env.metadata.paths.rootMagicGenFolder + '/app-module.ts';
268
+
269
+ // Append provideZoneChangeDetection() to NgModule.providers if it does not already exist.
270
+ addZoneChangeDetectionProvider(host, appmodule);
271
+
272
+ // Re-parse from disk after provider update so import insertion uses fresh AST positions.
273
+ const sourceText = host.read(appmodule).toString('utf-8');
274
+ const source = ts.createSourceFile(appmodule, sourceText, ts.ScriptTarget.Latest, true);
275
+
276
+ // Ensure the symbol import exists; insertImport is idempotent and avoids duplicates.
277
+ const zoneChangeDetectionImport = insertImport(source, appmodule, 'provideZoneChangeDetection', '@angular/core', false);
278
+ const zoneChangeDetectionImportChangesRecorder = host.beginUpdate(appmodule);
279
+ if (zoneChangeDetectionImport instanceof InsertChange)
280
+ zoneChangeDetectionImportChangesRecorder.insertLeft(zoneChangeDetectionImport.pos, zoneChangeDetectionImport.toAdd);
281
+ host.commitUpdate(zoneChangeDetectionImportChangesRecorder);
282
+ };
283
+ }
284
+
285
+ function addZoneChangeDetectionProvider(host: Tree, appmodule: string): void {
286
+ const zoneProvider = 'provideZoneChangeDetection()';
287
+ const sourceText = host.read(appmodule).toString('utf-8');
288
+ const source = ts.createSourceFile(appmodule, sourceText, ts.ScriptTarget.Latest, true);
289
+
290
+ // Locate the first @NgModule({...}) metadata object in app-module.ts.
291
+ const ngModules = getDecoratorMetadata(source, 'NgModule', '@angular/core');
292
+
293
+ if (!ngModules.length) {
294
+ return;
295
+ }
296
+
297
+ const ngModuleMetadata = ngModules[0] as ts.ObjectLiteralExpression;
298
+ // Find the `providers` property assignment inside @NgModule metadata.
299
+ const providersProperty = ngModuleMetadata.properties
300
+ .filter(ts.isPropertyAssignment)
301
+ .find((prop: ts.PropertyAssignment) => {
302
+ if (ts.isIdentifier(prop.name)) {
303
+ return prop.name.text === 'providers';
304
+ }
305
+
306
+ return ts.isStringLiteral(prop.name) && prop.name.text === 'providers';
307
+ });
308
+
309
+ if (!providersProperty || !ts.isArrayLiteralExpression(providersProperty.initializer)) {
310
+ return;
311
+ }
312
+
313
+ const providersArray = providersProperty.initializer;
314
+ // Keep this operation idempotent: do nothing if provider already exists.
315
+ const hasZoneProvider = providersArray.elements.some((el: ts.Expression) => {
316
+ return el.getText(source).replace(/\s+/g, '') === zoneProvider;
317
+ });
318
+
319
+ if (hasZoneProvider) {
320
+ return;
321
+ }
322
+
323
+ let insertPos: number;
324
+ let toAdd: string;
325
+ if (providersArray.elements.length === 0) {
326
+ // Empty providers: inject the item directly between [].
327
+ insertPos = providersArray.getEnd() - 1;
328
+ toAdd = zoneProvider;
329
+ } else {
330
+ // Non-empty providers: append after last provider, preserving line formatting when possible.
331
+ const lastProvider = providersArray.elements[providersArray.elements.length - 1];
332
+ insertPos = lastProvider.getEnd();
333
+ const lastProviderText = lastProvider.getFullText(source);
334
+ const newLineMatch = lastProviderText.match(/^\r?\n(\r?)\s+/);
335
+ if (newLineMatch) {
336
+ toAdd = `,${newLineMatch[0]}${zoneProvider}`;
337
+ } else {
338
+ toAdd = `, ${zoneProvider}`;
339
+ }
340
+ }
341
+
342
+ // Apply the computed insertion at the exact Abstract Syntax Tree-derived position.
343
+ const recorder = host.beginUpdate(appmodule);
344
+ recorder.insertLeft(insertPos, toAdd);
345
+ host.commitUpdate(recorder);
346
+ }
347
+
@@ -2,7 +2,7 @@ import {BrowserModule} from '@angular/platform-browser';
2
2
  import {NgModule} from '@angular/core';
3
3
  import {ReactiveFormsModule} from '@angular/forms';
4
4
 
5
- import {AppComponent} from './app.component';
5
+ import {App} from './app';
6
6
  import {DynamicModule} from 'ng-dynamic-component';
7
7
  import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
8
8
  import {ComponentArray, compHash, title} from './component-list.g';
@@ -30,7 +30,7 @@ import {MagicModule,ComponentListMagicService} from '@magic-xpa/angular';
30
30
 
31
31
 
32
32
  @NgModule({
33
- declarations: [AppComponent, ...ComponentArray],
33
+ declarations: [App, ...ComponentArray],
34
34
  imports: [
35
35
  // Angular modules
36
36
  BrowserModule,
@@ -59,7 +59,7 @@ import {MagicModule,ComponentListMagicService} from '@magic-xpa/angular';
59
59
  InfiniteScrollDirective,
60
60
  DynamicModule.withComponents(ComponentArray)
61
61
  ],
62
- bootstrap: [AppComponent],
62
+ bootstrap: [App],
63
63
  })
64
64
  export class AppModule {
65
65
  constructor(componentList:ComponentListMagicService) {
@@ -12,5 +12,5 @@ declare let myExtObject: any;
12
12
  `,
13
13
  standalone: false,
14
14
  })
15
- export class AppComponent {
15
+ export class App {
16
16
  }
@@ -1,10 +1,10 @@
1
1
  <% if (ctrl.props.is_table_child && ctrl.controlType === MgControlType.CTRL_TYPE_BUTTON) {%>
2
2
  <% if ( ctrl.props.row_editing_type && ctrl.props.row_editing_type !== RowEditingTypes.NoneRowEditing) {%>
3
3
  <% if ( ctrl.props.row_editing_type === RowEditingTypes.EnterRowEditing) {%>
4
- *ngIf="!mg.isRowInRowEditing(row)"
4
+ [hidden]="mg.isRowInRowEditing(row)"
5
5
  <%}%>
6
6
  <% if ( ctrl.props.row_editing_type === RowEditingTypes.SaveRowEditing || ctrl.props.row_editing_type === RowEditingTypes.CancelRowEditing) {%>
7
- *ngIf="mg.isRowInRowEditing(row)"
7
+ [hidden]="!mg.isRowInRowEditing(row)"
8
8
  <%}%>
9
9
  <%}%>
10
10
  <%}%>
@@ -6,32 +6,35 @@
6
6
 
7
7
  <%# show combo box in table only while we on row edit %>
8
8
  <% if (ctrl.props.is_table_child) { %>
9
- <div *ngIf="mg.isRowInRowEditing(row)">
9
+ @if (mg.isRowInRowEditing(row)) {
10
+ <div>
10
11
  <%}%>
11
12
  <select
12
13
  <%- include('../../attributes/common/base_attributes', {ctrl : ctrl}) %>
13
14
  <%- include('../../attributes/common/base/formControlName', {ctrl : ctrl}) %>
14
15
  <% if (ctrl.props.must_input && !ctrl.props.must_input.has_exp) { %> required <%}%>
15
16
  >
16
- <option
17
- *ngFor="let o of mg.getItemListValues(<%- ctrl.props.enum_id %><% if(ctrl.props.is_table_child){ %>, row.rowId<%}%>);"
18
- [selected]="o.index == mg.getValue(<%- ctrl.props.enum_id %><% if(ctrl.props.is_table_child){ %>, row.rowId<%}%>)"
19
- [value] = "o.index"
20
- >
17
+ @for (o of mg.getItemListValues(<%- ctrl.props.enum_id %><% if(ctrl.props.is_table_child){ %>, row.rowId<%}%>); track $index) {
18
+ <option [selected]="o.index == mg.getValue(<%- ctrl.props.enum_id %><% if(ctrl.props.is_table_child){ %>, row.rowId<%}%>)"
19
+ [value] = "o.index">
21
20
  {{o.displayValue}}
22
21
  </option>
22
+ }
23
23
  </select>
24
24
  <% if (ctrl.props.must_input || ctrl.props.validator != null) {%>
25
25
  <mgError [magic]=<%- ctrl.props.directive_id %>> </mgError>
26
26
  <%}%>
27
27
  <% if (ctrl.props.is_table_child) { %>
28
28
  </div>
29
+ }
29
30
 
30
31
  <%# show lable in table only while we on row read only %>
31
- <div *ngIf="!mg.isRowInRowEditing(row)">
32
+ @if (!mg.isRowInRowEditing(row)) {
33
+ <div>
32
34
  <label <%- include('../../attributes/common/base_attributes', {ctrl : ctrl}) %>>
33
35
  {{ mg.getDisplayValue(<%- ctrl.props.enum_id %>, row.rowId) }}
34
36
  </label>
35
37
  </div>
38
+ }
36
39
  <%}%>
37
40
  </div>
@@ -8,7 +8,8 @@
8
8
  <div >
9
9
  <% if (ctrl.style && ctrl.style.multiline_edit ){ %>
10
10
 
11
- <textarea *ngIf="mg.isRowInRowEditing(row)"
11
+ @if (mg.isRowInRowEditing(row)) {
12
+ <textarea
12
13
  type="text"
13
14
  <%- include('../../attributes/common/base/formControlName', {ctrl : ctrl}) %>
14
15
  <%- include('../../attributes/common/base_attributes', {ctrl : ctrl}) %>
@@ -20,16 +21,17 @@
20
21
  <% if (ctrl.props.validator) { %><%- ctrl.props.validator %><%}%>
21
22
  >
22
23
  </textarea>
24
+ }
23
25
 
24
26
  <% } else { %>
27
+ <% if(ctrl.props.is_table_child){ %>
28
+ @if (mg.isRowInRowEditing(row)) {
29
+ <%}%>
25
30
  <input
26
31
  <% if (ctrl.props.show_zoom_button ){ %>
27
32
  style="width: 70%"
28
33
  <% } %>
29
34
  <%- include('../../attributes/common/base/formControlName', {ctrl : ctrl}) %>
30
- <% if(ctrl.props.is_table_child){ %>
31
- *ngIf="mg.isRowInRowEditing(row)"
32
- <%}%>
33
35
 
34
36
  <% if (ctrl.props.attribute == StorageAttributeType.Numeric) { %>
35
37
  <% if (ctrl.props.currency) { %>
@@ -52,13 +54,16 @@
52
54
  <%- ' '%>
53
55
  <% if (ctrl.props.validator) { %><%- ctrl.props.validator %><%}%>
54
56
  />
57
+ <% if(ctrl.props.is_table_child){ %>
58
+ }
59
+ <%}%>
55
60
  <% } %>
56
61
  <%- include(`../../attributes/common/input/validation`, {ctrl : ctrl}) %>
57
62
 
58
63
  <% if(ctrl.props.is_table_child){ %>
59
64
 
65
+ @if (!mg.isRowInRowEditing(row)) {
60
66
  <label
61
- *ngIf="!mg.isRowInRowEditing(row)"
62
67
  <%- include('../../attributes/common/base_attributes', {ctrl : ctrl}) %>>
63
68
  <% if (ctrl.props.currency ) { %>
64
69
  {{mg.getFormattedValue(<%- ctrl.props.enum_id %><% if(ctrl.props.is_table_child){ %>, row.rowId<%}%>)
@@ -71,6 +76,7 @@
71
76
 
72
77
 
73
78
  </label>
79
+ }
74
80
  <%}%>
75
81
  <%- include('./zoom-button.ejs', {ctrl : ctrl}) %>
76
82
  </div>
@@ -78,8 +84,8 @@
78
84
  case StorageAttributeType.Date: %>
79
85
 
80
86
  <% if(ctrl.props.is_table_child){ %>
87
+ @if (mg.isRowInRowEditing(row)) {
81
88
  <div
82
- *ngIf="mg.isRowInRowEditing(row)"
83
89
  style="display: flex; flex-direction: row">
84
90
  <%}%>
85
91
 
@@ -102,24 +108,26 @@
102
108
 
103
109
  <% if(ctrl.props.is_table_child){ %>
104
110
  </div>
111
+ }
105
112
  <%}%>
106
113
 
107
114
 
108
115
  <% if(ctrl.props.is_table_child){ %>
116
+ @if (!mg.isRowInRowEditing(row)) {
109
117
  <label
110
- *ngIf="!mg.isRowInRowEditing(row)"
111
118
  <%- include('../../attributes/common/base_attributes', {ctrl : ctrl}) %>>
112
119
  {{mg.getValue(<%- ctrl.props.enum_id %><% if(ctrl.props.is_table_child){ %>, row.rowId<%}%>)
113
120
  <% if (ctrl.props.formatter) { %>| <%- ctrl.props.formatter %> : <%- ctrl.props.enum_id %><%}%>}}
114
121
  </label>
122
+ }
115
123
  <%}%>
116
124
  <%- include('./zoom-button.ejs', {ctrl : ctrl}) %>
117
125
  <% break;
118
126
 
119
127
  case StorageAttributeType.Time: %>
120
128
  <% if(ctrl.props.is_table_child){ %>
129
+ @if (mg.isRowInRowEditing(row)) {
121
130
  <div
122
- *ngIf="mg.isRowInRowEditing(row)"
123
131
  style="display: flex; flex-direction: row">
124
132
  <%}%>
125
133
 
@@ -141,15 +149,17 @@
141
149
 
142
150
  <% if(ctrl.props.is_table_child){ %>
143
151
  </div>
152
+ }
144
153
  <%}%>
145
154
 
146
155
  <% if(ctrl.props.is_table_child){ %>
156
+ @if (!mg.isRowInRowEditing(row)) {
147
157
  <label
148
- *ngIf="!mg.isRowInRowEditing(row)"
149
158
  <%- include('../../attributes/common/base_attributes', {ctrl : ctrl}) %>>
150
159
  {{mg.getValue(<%- ctrl.props.enum_id %><% if(ctrl.props.is_table_child){ %>, row.rowId<%}%>)
151
160
  <% if (ctrl.props.formatter) { %>| <%- ctrl.props.formatter %> : <%- ctrl.props.enum_id %><%}%>}}
152
161
  </label>
162
+ }
153
163
  <%}%>
154
164
  <%- include('./zoom-button.ejs', {ctrl : ctrl}) %>
155
165
  <% break;
@@ -1,6 +1,7 @@
1
-
2
- <div *ngIf="mg.isImageExists(<%- ctrl.props.enum_id %>)">
1
+ @if (mg.isImageExists(<%- ctrl.props.enum_id %>)) {
2
+ <div>
3
3
  <img <%- include('../../attributes/common/base_attributes', {ctrl : ctrl}) %>
4
4
  <%- include('../../attributes/common/base/enabled', {ctrl : ctrl}) %>
5
5
  [src]="mg.getImage(<%- ctrl.props.enum_id %><% if(ctrl.props.is_table_child){ %>, row.rowId<%}%>)" />
6
6
  </div>
7
+ }
@@ -8,12 +8,11 @@
8
8
  <% if (ctrl.props.must_input && !ctrl.props.must_input.has_exp) { %> required <%}%>
9
9
  >
10
10
  <%# build of items in listbox %>
11
- <option
12
- *ngFor="let o of mg.getItemListValues(<%-ctrl.props.enum_id%>);"
13
- [value] = "o.index"
14
- >
11
+ @for (o of mg.getItemListValues(<%-ctrl.props.enum_id%>); track $index) {
12
+ <option [value] = "o.index">
15
13
  {{o.displayValue}}
16
14
  </option>
15
+ }
17
16
  </select>
18
17
  <% if (ctrl.props.must_input || ctrl.props.validator != null) {%>
19
18
  <mgError [magic]=<%- ctrl.props.directive_id %>> </mgError>
@@ -25,4 +25,3 @@ case CtrlButtonTypeGui.Hypertext : %>
25
25
  <%- include('../../attributes/common/format.ejs', {ctrl : ctrl}) %>
26
26
  </button>
27
27
  <% } %> %>
28
-
@@ -2,8 +2,8 @@
2
2
  <%- include('../../attributes/common/base_attributes', {ctrl : ctrl}) %>
3
3
  (change)="task.mgOnRadioSelectionChanged(<%-ctrl.props.enum_id%>)"
4
4
  >
5
- <div
6
- *ngFor="let o of mg.getItemListValues(<%-ctrl.props.enum_id%>);">
5
+ @for (o of mg.getItemListValues(<%-ctrl.props.enum_id%>); track $index) {
6
+ <div>
7
7
  <label>
8
8
  <input
9
9
  type="radio"
@@ -14,6 +14,7 @@
14
14
  {{o.displayValue}}
15
15
  </label>
16
16
  </div>
17
+ }
17
18
  <% if (ctrl.props.must_input || ctrl.props.validator != null) {%>
18
19
  <mgError [magic]=<%- ctrl.props.directive_id %>> </mgError>
19
20
  <%}%>
@@ -12,7 +12,8 @@
12
12
  <% }%>
13
13
 
14
14
  <%# add buttons for each tab page%>
15
- <div *ngFor="let o of mg.getItemListValues(<%-ctrl.props.enum_id%>)">
15
+ @for (o of mg.getItemListValues(<%-ctrl.props.enum_id%>); track $index) {
16
+ <div>
16
17
  <button class="tab_button"
17
18
  <%- include('../../attributes/common/base/enabled', {ctrl : ctrl}) %>
18
19
  (click)="task.mgOnTabSelectionChanged(<%-ctrl.props.enum_id%>, o.index)"
@@ -21,6 +22,7 @@
21
22
  {{mg.getTabpageText(<%- ctrl.props.enum_id %>, o.index)}}
22
23
  </button>
23
24
  </div>
25
+ }
24
26
 
25
27
  <% if ( tab_side == SideType.Top) { %>
26
28
  <%# add tab pages after adding the buttons, so the buttons are at the top%>
@@ -2,8 +2,8 @@
2
2
  <%- include('../../attributes/common/no_control_base_attributes', {ctrl : ctrl}) %>
3
3
  magicMark="magicRadio"
4
4
  >
5
- <div
6
- *ngFor="let o of mgGetListboxValues(<%-ctrl.props.enum_id%>);">
5
+ @for (o of mgGetListboxValues(<%-ctrl.props.enum_id%>); track $index) {
6
+ <div>
7
7
  <label>
8
8
  <input
9
9
  type="radio"
@@ -14,4 +14,5 @@
14
14
  {{o.displayValue}}
15
15
  </label>
16
16
  </div>
17
+ }
17
18
  </div>
@@ -7,12 +7,16 @@
7
7
  (scrolled)="tableService.onScrollDown()"
8
8
  [scrollWindow]="false"
9
9
  >
10
- <div *ngFor="let row of task.Records.list">
11
- <div *ngIf="mg.ifRowCreated(row)" id="row">
10
+ @for (row of task.Records.list; track $index) {
11
+ <div>
12
+ @if (mg.ifRowCreated(row)) {
13
+ <div id="row">
12
14
  <form [formGroup]="mg.getFormGroupByRow(row.rowId)" class="table_row"
13
15
  [ngClass]="{ 'selected': mg.isRowSelected(<%= ctrl.props.enum_id %>, row.rowId)}">
14
16
  <%- include(`../container`, {ctrl: ctrl}) %>
15
17
  </form>
16
18
  </div>
17
- </div>
19
+ }
20
+ </div>
21
+ }
18
22
  </div>
@@ -6,6 +6,9 @@
6
6
  <% if (line_id !== null) {%>
7
7
  <% if( typeof child.props.common_line_id === "undefined" || child.props.common_line_id !== line_id) {%>
8
8
  </div>
9
+ <% if (ctrl.props.web_style === TableWebStyle.MatGrid) { %>
10
+ }
11
+ <% } %>
9
12
  <% line_id = null;%>
10
13
  <%}}%>
11
14
 
@@ -13,7 +16,12 @@
13
16
  <% if (line_id === null && typeof child.props.common_line_id !== "undefined" &&
14
17
  child.controlType !== MgControlType.CTRL_TYPE_TAB) { %>
15
18
  <% line_id = child.props.common_line_id; %>
16
- <div style="display: flex; flex-direction: row" <% if ( ctrl.props.web_style === TableWebStyle.MatGrid) { %>*ngIf="mg.ifRowCreated(row)" <%}%> >
19
+ <% if (ctrl.props.web_style === TableWebStyle.MatGrid) { %>
20
+ @if (mg.ifRowCreated(row)) {
21
+ <div style="display: flex; flex-direction: row">
22
+ <% } else { %>
23
+ <div style="display: flex; flex-direction: row">
24
+ <% } %>
17
25
  <%}%>
18
26
 
19
27
  <%- include(`./control`, {child: child}) %>
@@ -23,4 +31,7 @@
23
31
  <%# close the line-wrapping div, in case it was left open %>
24
32
  <%if (line_id !== null) {%>
25
33
  </div>
34
+ <% if (ctrl.props.web_style === TableWebStyle.MatGrid) { %>
35
+ }
36
+ <% } %>
26
37
  <%}} %>
@@ -6,7 +6,8 @@
6
6
 
7
7
  <%# show combo box in table only while we on row edit %>
8
8
  <% if (ctrl.props.is_table_child) { %>
9
- <div *ngIf="mg.isRowInRowEditing(row)">
9
+ @if (mg.isRowInRowEditing(row)) {
10
+ <div>
10
11
  <%}%>
11
12
 
12
13
  <% if (ctrl.props.editable) { %>
@@ -29,13 +30,11 @@
29
30
  required
30
31
  <% } %>
31
32
  >
32
- <mat-option
33
- *ngFor="let o of mg.getItemListValues(<%- ctrl.props.enum_id %><% if(ctrl.props.is_table_child){ %>, row.rowId<%}%>);"
34
-
35
- [value]="o.index"
36
- >
33
+ @for (o of mg.getItemListValues(<%- ctrl.props.enum_id %><% if(ctrl.props.is_table_child){ %>, row.rowId<%}%>); track $index) {
34
+ <mat-option [value]="o.index">
37
35
  {{o.displayValue}}
38
36
  </mat-option>
37
+ }
39
38
  </mat-select>
40
39
  </mat-form-field>
41
40
 
@@ -47,12 +46,15 @@
47
46
 
48
47
  <% if (ctrl.props.is_table_child) { %>
49
48
  </div>
49
+ }
50
50
  <%# show lable in table only while we on row read only %>
51
- <div *ngIf="!mg.isRowInRowEditing(row)">
51
+ @if (!mg.isRowInRowEditing(row)) {
52
+ <div>
52
53
  <label <%- include('../../attributes/common/base_attributes', {ctrl : ctrl}) %>>
53
54
  {{ mg.getDisplayValue(<%- ctrl.props.enum_id %>, row.rowId) }}
54
55
  </label>
55
56
  </div>
57
+ }
56
58
  <%}%>
57
59
 
58
60
  </div>