@magic-xpa/cli 4.1201.1 → 4.1202.0
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.
- package/package.json +1 -1
- package/src/schematics/magic-utils/config.js +2 -2
- package/src/schematics/magic-utils/config.js.map +1 -1
- package/src/schematics/magic-utils/config.ts +2 -2
- package/src/schematics/magic-utils/env.js +6 -5
- package/src/schematics/magic-utils/env.js.map +1 -1
- package/src/schematics/magic-utils/env.ts +6 -5
- package/src/schematics/magic-utils/metadata.class.js +1 -1
- package/src/schematics/magic-utils/metadata.class.js.map +1 -1
- package/src/schematics/magic-utils/metadata.class.ts +1 -1
- package/src/schematics/mg-add/index.js +127 -9
- package/src/schematics/mg-add/index.js.map +1 -1
- package/src/schematics/mg-add/index.ts +149 -10
- package/templates/angular/src/{app.module.ts → app-module.ts} +3 -3
- package/templates/angular/src/{app.component.ts → app.ts} +1 -1
- package/templates/attributes/common/row_editing_button_attributes.ejs +2 -2
- package/templates/themes/basicHTML/combobox.ejs +10 -7
- package/templates/themes/basicHTML/edit.ejs +19 -9
- package/templates/themes/basicHTML/image.ejs +3 -2
- package/templates/themes/basicHTML/listbox.ejs +3 -4
- package/templates/themes/basicHTML/push-button.ejs +0 -1
- package/templates/themes/basicHTML/radio.ejs +3 -2
- package/templates/themes/basicHTML/tab.ejs +3 -1
- package/templates/themes/basicHiddenHTML/radio.ejs +3 -2
- package/templates/themes/basicHiddenHTML/table.ejs +7 -3
- package/templates/themes/container.ejs +12 -1
- package/templates/themes/material/combobox.ejs +9 -7
- package/templates/themes/material/edit.ejs +30 -26
- package/templates/themes/material/listbox.ejs +3 -4
- package/templates/themes/material/push-button.ejs +0 -1
- package/templates/themes/material/radio.ejs +3 -3
- package/templates/themes/material/tab.ejs +3 -1
- package/templates/themes/table/HTMLTable/table.ejs +7 -3
- package/templates/themes/table/repeatable/table.ejs +7 -3
- /package/src/schematics/mg-add/files/src/app/{app.component.html → app.html} +0 -0
- /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
|
-
|
|
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.
|
|
46
|
-
name : "app.
|
|
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 : {
|
|
@@ -57,11 +59,11 @@ function updateAngularJsonWithMagicStyle(options:MagicOptionScheme): Rule {
|
|
|
57
59
|
let isDirty = false;
|
|
58
60
|
|
|
59
61
|
let fullPathmagicStylePath = env.metadata.paths.magicStylePath;
|
|
60
|
-
if (!project.architect.test.options.styles.includes(fullPathmagicStylePath)) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
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
|
+
// }
|
|
65
67
|
|
|
66
68
|
if (!project.architect.build.options.styles.includes(fullPathmagicStylePath)) {
|
|
67
69
|
context.logger.info(` [>]add file ${fullPathmagicStylePath} to build`);
|
|
@@ -69,6 +71,25 @@ function updateAngularJsonWithMagicStyle(options:MagicOptionScheme): Rule {
|
|
|
69
71
|
isDirty = true;
|
|
70
72
|
}
|
|
71
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
|
+
|
|
72
93
|
if(isDirty){
|
|
73
94
|
let fullPath = env.metadata.paths.angularJsonPath;
|
|
74
95
|
host.overwrite(fullPath, JSON.stringify(env.workspace, null, 2));
|
|
@@ -78,6 +99,30 @@ function updateAngularJsonWithMagicStyle(options:MagicOptionScheme): Rule {
|
|
|
78
99
|
};
|
|
79
100
|
}
|
|
80
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
|
+
}
|
|
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
|
|
83
128
|
function updateTsConfigAppJson (option: MagicOptionScheme): Rule{
|
|
@@ -98,6 +143,12 @@ function updateTsConfigAppJson (option: MagicOptionScheme): Rule{
|
|
|
98
143
|
if(!config['include'].includes('src/**/*module.ts'))
|
|
99
144
|
config['include'].push('src/**/*module.ts');
|
|
100
145
|
|
|
146
|
+
if (!config['compilerOptions'])
|
|
147
|
+
config['compilerOptions'] = {};
|
|
148
|
+
|
|
149
|
+
// Ensures forceConsistentCasingInFileNames is set to false inorder to avoid path casing differences while compilation
|
|
150
|
+
config['compilerOptions']['forceConsistentCasingInFileNames'] = false;
|
|
151
|
+
|
|
101
152
|
// append the comment again and write the file
|
|
102
153
|
host.overwrite(tsConfigPath, comment + "\n" + JSON.stringify(config, null , 2));
|
|
103
154
|
return host;
|
|
@@ -179,7 +230,7 @@ function addMagicModuleToAppModule(options: MagicOptionScheme) : Rule {
|
|
|
179
230
|
|
|
180
231
|
function addLazyLoadProvider(): Rule {
|
|
181
232
|
return (host: Tree) => {
|
|
182
|
-
const appmodule = env.metadata.paths.rootMagicGenFolder + '/app
|
|
233
|
+
const appmodule = env.metadata.paths.rootMagicGenFolder + '/app-module.ts';
|
|
183
234
|
|
|
184
235
|
const lazyLoaderService = 'LazyLoaderService';
|
|
185
236
|
const lazyLoaderServicePath = './magic/lazy-loader.service';
|
|
@@ -198,6 +249,8 @@ function addLazyLoadProvider(): Rule {
|
|
|
198
249
|
}
|
|
199
250
|
host.commitUpdate(providerRecorder);
|
|
200
251
|
|
|
252
|
+
sourceText = host.read(appmodule).toString('utf-8');
|
|
253
|
+
source = ts.createSourceFile(appmodule, sourceText, ts.ScriptTarget.Latest, true);
|
|
201
254
|
const lazyLoaderServiceImport = insertImport(source, appmodule, lazyLoaderService, lazyLoaderServicePath, false);
|
|
202
255
|
const lazyLoaderServiceChangesRecorder = host.beginUpdate(appmodule);
|
|
203
256
|
if (lazyLoaderServiceImport instanceof InsertChange)
|
|
@@ -205,6 +258,8 @@ function addLazyLoadProvider(): Rule {
|
|
|
205
258
|
host.commitUpdate(lazyLoaderServiceChangesRecorder);
|
|
206
259
|
|
|
207
260
|
// add import for MagicLazyLoaderService
|
|
261
|
+
sourceText = host.read(appmodule).toString('utf-8');
|
|
262
|
+
source = ts.createSourceFile(appmodule, sourceText, ts.ScriptTarget.Latest, true);
|
|
208
263
|
const magicLazyLoaderServiceImportChanges: InsertChange = <InsertChange>insertImport(source, appmodule, 'MagicLazyLoaderService', '@magic-xpa/angular', false);
|
|
209
264
|
const magicImportChangesRecorder = host.beginUpdate(appmodule);
|
|
210
265
|
magicImportChangesRecorder.insertLeft(magicLazyLoaderServiceImportChanges.pos, magicLazyLoaderServiceImportChanges.toAdd)
|
|
@@ -212,3 +267,87 @@ function addLazyLoadProvider(): Rule {
|
|
|
212
267
|
}
|
|
213
268
|
}
|
|
214
269
|
|
|
270
|
+
function addZoneChangeDetectionProviderRule(): Rule {
|
|
271
|
+
return (host: Tree) => {
|
|
272
|
+
// Resolve the generated root module path (src/app/app-module.ts in this project layout).
|
|
273
|
+
const appmodule = env.metadata.paths.rootMagicGenFolder + '/app-module.ts';
|
|
274
|
+
|
|
275
|
+
// Append provideZoneChangeDetection() to NgModule.providers if it does not already exist.
|
|
276
|
+
addZoneChangeDetectionProvider(host, appmodule);
|
|
277
|
+
|
|
278
|
+
// Re-parse from disk after provider update so import insertion uses fresh AST positions.
|
|
279
|
+
const sourceText = host.read(appmodule).toString('utf-8');
|
|
280
|
+
const source = ts.createSourceFile(appmodule, sourceText, ts.ScriptTarget.Latest, true);
|
|
281
|
+
|
|
282
|
+
// Ensure the symbol import exists; insertImport is idempotent and avoids duplicates.
|
|
283
|
+
const zoneChangeDetectionImport = insertImport(source, appmodule, 'provideZoneChangeDetection', '@angular/core', false);
|
|
284
|
+
const zoneChangeDetectionImportChangesRecorder = host.beginUpdate(appmodule);
|
|
285
|
+
if (zoneChangeDetectionImport instanceof InsertChange)
|
|
286
|
+
zoneChangeDetectionImportChangesRecorder.insertLeft(zoneChangeDetectionImport.pos, zoneChangeDetectionImport.toAdd);
|
|
287
|
+
host.commitUpdate(zoneChangeDetectionImportChangesRecorder);
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
function addZoneChangeDetectionProvider(host: Tree, appmodule: string): void {
|
|
292
|
+
const zoneProvider = 'provideZoneChangeDetection()';
|
|
293
|
+
const sourceText = host.read(appmodule).toString('utf-8');
|
|
294
|
+
const source = ts.createSourceFile(appmodule, sourceText, ts.ScriptTarget.Latest, true);
|
|
295
|
+
|
|
296
|
+
// Locate the first @NgModule({...}) metadata object in app-module.ts.
|
|
297
|
+
const ngModules = getDecoratorMetadata(source, 'NgModule', '@angular/core');
|
|
298
|
+
|
|
299
|
+
if (!ngModules.length) {
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
const ngModuleMetadata = ngModules[0] as ts.ObjectLiteralExpression;
|
|
304
|
+
// Find the `providers` property assignment inside @NgModule metadata.
|
|
305
|
+
const providersProperty = ngModuleMetadata.properties
|
|
306
|
+
.filter(ts.isPropertyAssignment)
|
|
307
|
+
.find((prop: ts.PropertyAssignment) => {
|
|
308
|
+
if (ts.isIdentifier(prop.name)) {
|
|
309
|
+
return prop.name.text === 'providers';
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
return ts.isStringLiteral(prop.name) && prop.name.text === 'providers';
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
if (!providersProperty || !ts.isArrayLiteralExpression(providersProperty.initializer)) {
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
const providersArray = providersProperty.initializer;
|
|
320
|
+
// Keep this operation idempotent: do nothing if provider already exists.
|
|
321
|
+
const hasZoneProvider = providersArray.elements.some((el: ts.Expression) => {
|
|
322
|
+
return el.getText(source).replace(/\s+/g, '') === zoneProvider;
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
if (hasZoneProvider) {
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
let insertPos: number;
|
|
330
|
+
let toAdd: string;
|
|
331
|
+
if (providersArray.elements.length === 0) {
|
|
332
|
+
// Empty providers: inject the item directly between [].
|
|
333
|
+
insertPos = providersArray.getEnd() - 1;
|
|
334
|
+
toAdd = zoneProvider;
|
|
335
|
+
} else {
|
|
336
|
+
// Non-empty providers: append after last provider, preserving line formatting when possible.
|
|
337
|
+
const lastProvider = providersArray.elements[providersArray.elements.length - 1];
|
|
338
|
+
insertPos = lastProvider.getEnd();
|
|
339
|
+
const lastProviderText = lastProvider.getFullText(source);
|
|
340
|
+
const newLineMatch = lastProviderText.match(/^\r?\n(\r?)\s+/);
|
|
341
|
+
if (newLineMatch) {
|
|
342
|
+
toAdd = `,${newLineMatch[0]}${zoneProvider}`;
|
|
343
|
+
} else {
|
|
344
|
+
toAdd = `, ${zoneProvider}`;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// Apply the computed insertion at the exact Abstract Syntax Tree-derived position.
|
|
349
|
+
const recorder = host.beginUpdate(appmodule);
|
|
350
|
+
recorder.insertLeft(insertPos, toAdd);
|
|
351
|
+
host.commitUpdate(recorder);
|
|
352
|
+
}
|
|
353
|
+
|
|
@@ -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 {
|
|
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: [
|
|
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: [
|
|
62
|
+
bootstrap: [App],
|
|
63
63
|
})
|
|
64
64
|
export class AppModule {
|
|
65
65
|
constructor(componentList:ComponentListMagicService) {
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
[
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
12
|
-
|
|
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>
|
|
@@ -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
|
-
|
|
6
|
-
|
|
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
|
-
|
|
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
|
-
|
|
6
|
-
|
|
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
|
-
|
|
11
|
-
<div
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
33
|
-
|
|
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
|
-
|
|
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>
|