@magic-xpa/cli 4.1300.0-dev4130.26 → 4.1300.0-dev4130.28
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 +5 -5
- package/src/schematics/magic-utils/env.js.map +1 -1
- package/src/schematics/magic-utils/env.ts +5 -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 +86 -9
- package/src/schematics/mg-add/index.js.map +1 -1
- package/src/schematics/mg-add/index.ts +100 -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
package/package.json
CHANGED
|
@@ -13,8 +13,8 @@ function getTemplateConfig(app, magic_config, manifest) {
|
|
|
13
13
|
let configs_array = [
|
|
14
14
|
/*
|
|
15
15
|
{
|
|
16
|
-
template : `${this.sourceAngularTemplateRoot}/app
|
|
17
|
-
name : 'app
|
|
16
|
+
template : `${this.sourceAngularTemplateRoot}/app-module.ts`,
|
|
17
|
+
name : 'app-module.ts',
|
|
18
18
|
destination: `${appRoot}/src/app`,
|
|
19
19
|
type : GeneratedFileTypes.TS,
|
|
20
20
|
data : data
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["config.ts"],"names":[],"mappings":";;;AAQA,8CAmDC;AAzDD,2FAA+E;AAElE,QAAA,yBAAyB,GAAS,yBAAyB,CAAC;AAC5D,QAAA,+BAA+B,GAAG,yBAAyB,CAAC;AAGzE,SAAgB,iBAAiB,CAAC,GAAY,EAAE,YAAuB,EAAE,QAAqB;IAE5F,MACE,KAAK,GAAO,GAAG,CAAC,IAAI,EACpB,OAAO,GAAK,YAAY,CAAC,aAAa,GAAG,KAAK,KAAK,EAAE,EACrD,IAAI,GAAQ;QACV,GAAG,EAAE,GAAG;QACR,QAAQ,EAAE,QAAQ;KACnB,CAAC;IAEJ,IAAI,aAAa,GAAG;QAClB;;;;;;;;UAQE;QAEF;YACE,QAAQ,EAAK,GAAG,IAAI,CAAC,yBAAyB,iBAAiB;YAC/D,IAAI,EAAS,SAAS;YACtB,WAAW,EAAE,GAAG,OAAO,iBAAiB;YACxC,IAAI,EAAS,8CAAkB,CAAC,GAAG;YACnC,IAAI,EAAS,IAAI;SAElB;QACD;;;;;;;;UAQE;QACF;YACE,QAAQ,EAAE,GAAG,IAAI,CAAC,yBAAyB,0BAA0B;YACrE,IAAI,EAAE,qBAAqB;YAC3B,WAAW,EAAE,GAAG,OAAO,UAAU;YACjC,IAAI,EAAS,8CAAkB,CAAC,EAAE;YAClC,IAAI,EAAS,IAAI;SAElB;KACF,CAAC;IAIF,OAAO,aAAa,CAAC;AACvB,CAAC;AAAA,CAAC;AAEW,QAAA,cAAc,GAAG;IAC5B,aAAa,EAAG,MAAM;IACtB,cAAc,EAAE,IAAI;IACpB,MAAM,EAAU,YAAY;IAC5B,OAAO,EAAS,IAAI;IACpB,QAAQ,EAAQ,CAAC;CAClB,CAAC","sourcesContent":["import {AppJson, AppConfig, AppManifest} from '../../types/interfaces/app';\nimport {TemplateConfig} from '../../types/interfaces/template.config';\nimport {GeneratedFileTypes} from '../../types/enums/generated-file-types.enum';\n\nexport const sourceAngularTemplateRoot = './templates/angular/src';\nexport const sourceAngularTemplateRootForCli = './templates/angular/src';\n\n\nexport function getTemplateConfig(app: AppJson, magic_config: AppConfig, manifest: AppManifest):TemplateConfig[]\n{\n const\n appId = app.name,\n appRoot = magic_config.output_folder + `\\\\${appId}`,\n data: any = {\n app: app,\n manifest: manifest,\n };\n\n let configs_array = [\n /*\n {\n template : `${this.sourceAngularTemplateRoot}/app
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["config.ts"],"names":[],"mappings":";;;AAQA,8CAmDC;AAzDD,2FAA+E;AAElE,QAAA,yBAAyB,GAAS,yBAAyB,CAAC;AAC5D,QAAA,+BAA+B,GAAG,yBAAyB,CAAC;AAGzE,SAAgB,iBAAiB,CAAC,GAAY,EAAE,YAAuB,EAAE,QAAqB;IAE5F,MACE,KAAK,GAAO,GAAG,CAAC,IAAI,EACpB,OAAO,GAAK,YAAY,CAAC,aAAa,GAAG,KAAK,KAAK,EAAE,EACrD,IAAI,GAAQ;QACV,GAAG,EAAE,GAAG;QACR,QAAQ,EAAE,QAAQ;KACnB,CAAC;IAEJ,IAAI,aAAa,GAAG;QAClB;;;;;;;;UAQE;QAEF;YACE,QAAQ,EAAK,GAAG,IAAI,CAAC,yBAAyB,iBAAiB;YAC/D,IAAI,EAAS,SAAS;YACtB,WAAW,EAAE,GAAG,OAAO,iBAAiB;YACxC,IAAI,EAAS,8CAAkB,CAAC,GAAG;YACnC,IAAI,EAAS,IAAI;SAElB;QACD;;;;;;;;UAQE;QACF;YACE,QAAQ,EAAE,GAAG,IAAI,CAAC,yBAAyB,0BAA0B;YACrE,IAAI,EAAE,qBAAqB;YAC3B,WAAW,EAAE,GAAG,OAAO,UAAU;YACjC,IAAI,EAAS,8CAAkB,CAAC,EAAE;YAClC,IAAI,EAAS,IAAI;SAElB;KACF,CAAC;IAIF,OAAO,aAAa,CAAC;AACvB,CAAC;AAAA,CAAC;AAEW,QAAA,cAAc,GAAG;IAC5B,aAAa,EAAG,MAAM;IACtB,cAAc,EAAE,IAAI;IACpB,MAAM,EAAU,YAAY;IAC5B,OAAO,EAAS,IAAI;IACpB,QAAQ,EAAQ,CAAC;CAClB,CAAC","sourcesContent":["import {AppJson, AppConfig, AppManifest} from '../../types/interfaces/app';\nimport {TemplateConfig} from '../../types/interfaces/template.config';\nimport {GeneratedFileTypes} from '../../types/enums/generated-file-types.enum';\n\nexport const sourceAngularTemplateRoot = './templates/angular/src';\nexport const sourceAngularTemplateRootForCli = './templates/angular/src';\n\n\nexport function getTemplateConfig(app: AppJson, magic_config: AppConfig, manifest: AppManifest):TemplateConfig[]\n{\n const\n appId = app.name,\n appRoot = magic_config.output_folder + `\\\\${appId}`,\n data: any = {\n app: app,\n manifest: manifest,\n };\n\n let configs_array = [\n /*\n {\n template : `${this.sourceAngularTemplateRoot}/app-module.ts`,\n name : 'app-module.ts',\n destination: `${appRoot}/src/app`,\n type : GeneratedFileTypes.TS,\n data : data\n },\n */\n\n {\n template : `${this.sourceAngularTemplateRoot}/styles/app.css`,\n name : 'app.css',\n destination: `${appRoot}/src/app/styles`,\n type : GeneratedFileTypes.CSS,\n data : data\n\n },\n /*\n {\n template : `${this.sourceAngularTemplateRoot}/app/magic/magic.core.module.ts`,\n name : 'magic.core.module.ts',\n destination: `${appRoot}/src/app/magic`,\n type : GeneratedFileTypes.TS,\n data : data\n }\n */\n {\n template: `${this.sourceAngularTemplateRoot}/app/component-list.g.ts`,\n name: 'component-list.g.ts',\n destination: `${appRoot}/src/app`,\n type : GeneratedFileTypes.TS,\n data : data\n\n },\n ];\n\n\n\n return configs_array;\n};\n\nexport const prettierConfig = {\n trailingComma : 'none',\n bracketSpacing: true,\n parser : 'typescript',\n useTabs : true,\n tabWidth : 4\n};\n"]}
|
|
@@ -19,8 +19,8 @@ export function getTemplateConfig(app: AppJson, magic_config: AppConfig, manifes
|
|
|
19
19
|
let configs_array = [
|
|
20
20
|
/*
|
|
21
21
|
{
|
|
22
|
-
template : `${this.sourceAngularTemplateRoot}/app
|
|
23
|
-
name : 'app
|
|
22
|
+
template : `${this.sourceAngularTemplateRoot}/app-module.ts`,
|
|
23
|
+
name : 'app-module.ts',
|
|
24
24
|
destination: `${appRoot}/src/app`,
|
|
25
25
|
type : GeneratedFileTypes.TS,
|
|
26
26
|
data : data
|
|
@@ -18,13 +18,13 @@ class Idependencies {
|
|
|
18
18
|
exports.Idependencies = Idependencies;
|
|
19
19
|
exports.dependencies = [
|
|
20
20
|
// material dependencies
|
|
21
|
-
{ name: "@angular/material", version: '^
|
|
22
|
-
{ name: "@angular/cdk", version: '^
|
|
23
|
-
{ name: "@angular/animations", version: '^
|
|
21
|
+
{ name: "@angular/material", version: '^21.1.4' },
|
|
22
|
+
{ name: "@angular/cdk", version: '^21.1.4' },
|
|
23
|
+
{ name: "@angular/animations", version: '^21.1.4' },
|
|
24
24
|
{ name: "font-awesome", version: '^4.7.0' },
|
|
25
25
|
{ name: "hammerjs", version: '^2.0.8' },
|
|
26
|
-
{ name: "ngx-infinite-scroll", version: '^
|
|
27
|
-
{ name: "ng-dynamic-component", version: '~10.
|
|
26
|
+
{ name: "ngx-infinite-scroll", version: '^21.0.0' },
|
|
27
|
+
{ name: "ng-dynamic-component", version: '~10.8.2' },
|
|
28
28
|
{ name: "ngx-currency", version: "^19.0.0" },
|
|
29
29
|
{ name: "ng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AO,EAAE,UAAU,EAAC;IACnD,EAAC,IAAI,EAAE,WAAW,EAAa,OAAO,EAAE,QAAQ,EAAC;IAEjD,4DAA4D;IAC5D,EAAC,IAAI,EAAE,kBAAkB,EAAO,OAAO,EAAE,QAAQ,EAAC;IAClD,EAAC,IAAI,EAAE,eAAe,EAAU,OAAO,EAAE,QAAQ,EAAC;IAClD,EAAC,IAAI,EAAE,cAAc,EAAW,OAAO,EAAE,QAAQ,EAAC;CAEnD,CAAC;AAEW,QAAA,eAAe,GAAG;IAC7B,EAAC,IAAI,EAAE,sBAAsB,EAAE,OAAO,EAAE,SAAS,EAAC;CACnD,CAAC;AACW,QAAA,GAAG,GAAU,EAAS,CAAC","sourcesContent":["// TODO(PK): hard-code for now, will query npm repo\n// to get this info in the future\nimport { MagicMetadata } from \"./metadata.class\";\nimport { IEnv } from \"../../types/interfaces/env.interface\";\n\nexport const METADATA_DIR = `magic-metadata`;\nexport const GEN_COMPONENTS_ARRAY = 'magicGenComponents';\nexport const GEN_COMPONENTS_HASH = 'magicGenCmpsHash';\nexport const GEN_FOLDER = 'magic';\nexport const MAGIC_CLI_FOLDER = './node_modules/@magic-xpa/cli';\nexport const GEN_LAZY_LOAD_MODULES_ARRAY = 'LazyLoadModulesMap';\nexport const manifest_path = `./${METADATA_DIR}/manifest.json`;\nexport const config_path = `./${METADATA_DIR}/config.json`;\n\nexport class Idependencies {\n constructor(setName:string, setVersion:string){\n this.name = setName;\n this.version = setVersion;\n }\n name:string;\n version:string;\n}\n\nexport var dependencies = [\n\n // material dependencies\n {name: \"@angular/material\" , version: '^
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["env.ts"],"names":[],"mappings":";;;AAKa,QAAA,YAAY,GAAW,gBAAgB,CAAC;AACxC,QAAA,oBAAoB,GAAG,oBAAoB,CAAC;AAC5C,QAAA,mBAAmB,GAAI,kBAAkB,CAAC;AAC1C,QAAA,UAAU,GAAa,OAAO,CAAC;AAC/B,QAAA,gBAAgB,GA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AAC,IAAI,EAAE,sBAAsB,EAAE,OAAO,EAAE,SAAS,EAAC;CACnD,CAAC;AACW,QAAA,GAAG,GAAU,EAAS,CAAC","sourcesContent":["// TODO(PK): hard-code for now, will query npm repo\n// to get this info in the future\nimport { MagicMetadata } from \"./metadata.class\";\nimport { IEnv } from \"../../types/interfaces/env.interface\";\n\nexport const METADATA_DIR = `magic-metadata`;\nexport const GEN_COMPONENTS_ARRAY = 'magicGenComponents';\nexport const GEN_COMPONENTS_HASH = 'magicGenCmpsHash';\nexport const GEN_FOLDER = 'magic';\nexport const MAGIC_CLI_FOLDER = './node_modules/@magic-xpa/cli';\nexport const GEN_LAZY_LOAD_MODULES_ARRAY = 'LazyLoadModulesMap';\nexport const manifest_path = `./${METADATA_DIR}/manifest.json`;\nexport const config_path = `./${METADATA_DIR}/config.json`;\n\nexport class Idependencies {\n constructor(setName:string, setVersion:string){\n this.name = setName;\n this.version = setVersion;\n }\n name:string;\n version:string;\n}\n\nexport var dependencies = [\n\n // material dependencies\n {name: \"@angular/material\" , version: '^21.1.4'},\n {name: \"@angular/cdk\" , version: '^21.1.4'},\n {name: \"@angular/animations\", version: '^21.1.4'},\n {name: \"font-awesome\" , version: '^4.7.0'},\n {name: \"hammerjs\" , version: '^2.0.8'},\n\n {name: \"ngx-infinite-scroll\" , version: '^21.0.0'},\n {name: \"ng-dynamic-component\", version: '~10.8.2'},\n {name: \"ngx-currency\" , version: \"^19.0.0\"},\n {name: \"ngx-mask\" , version: \"^13.1.15\"},\n {name: \"crypto-js\" , version: \"^4.2.0\"},\n\n // Time masking dependencies (hh:mm, hh:mm:ss, hh:mm:ss:mss)\n {name: \"@maskito/angular\" , version: \"^1.4.0\"},\n {name: \"@maskito/core\" , version: \"^1.4.0\"},\n {name: \"@maskito/kit\" , version: \"^1.4.0\"}\n\n];\n\nexport const devDependencies = [\n {name: \"@types/stacktrace-js\", version: '^0.0.32'}\n];\nexport const env : IEnv = {} as any;\n\n"]}
|
|
@@ -24,14 +24,14 @@ export class Idependencies {
|
|
|
24
24
|
export var dependencies = [
|
|
25
25
|
|
|
26
26
|
// material dependencies
|
|
27
|
-
{name: "@angular/material" , version: '^
|
|
28
|
-
{name: "@angular/cdk" , version: '^
|
|
29
|
-
{name: "@angular/animations", version: '^
|
|
27
|
+
{name: "@angular/material" , version: '^21.1.4'},
|
|
28
|
+
{name: "@angular/cdk" , version: '^21.1.4'},
|
|
29
|
+
{name: "@angular/animations", version: '^21.1.4'},
|
|
30
30
|
{name: "font-awesome" , version: '^4.7.0'},
|
|
31
31
|
{name: "hammerjs" , version: '^2.0.8'},
|
|
32
32
|
|
|
33
|
-
{name: "ngx-infinite-scroll" , version: '^
|
|
34
|
-
{name: "ng-dynamic-component", version: '~10.
|
|
33
|
+
{name: "ngx-infinite-scroll" , version: '^21.0.0'},
|
|
34
|
+
{name: "ng-dynamic-component", version: '~10.8.2'},
|
|
35
35
|
{name: "ngx-currency" , version: "^19.0.0"},
|
|
36
36
|
{name: "ngx-mask" , version: "^13.1.15"},
|
|
37
37
|
{name: "crypto-js" , version: "^4.2.0"},
|
|
@@ -32,7 +32,7 @@ class MagicPaths {
|
|
|
32
32
|
return `${this.rootMagicGenFolder}/${env_1.GEN_FOLDER}/${module_name}/app.routes.ts`;
|
|
33
33
|
}
|
|
34
34
|
get rootMagicGenFolder() { return `./${this.project.root}/src/app`; }
|
|
35
|
-
get appComponentPath() { return `./${this.project.root}/src/app/app.
|
|
35
|
+
get appComponentPath() { return `./${this.project.root}/src/app/app.html`; }
|
|
36
36
|
get appRoutesPath() { return `./${this.project.root}/src/app/app.routes.ts`; }
|
|
37
37
|
get appModulePath() { return `./${this.project.root}/src/app/app.module.ts`; }
|
|
38
38
|
get executionPath() { return `./${this.project.root}/src/assets/execution.properties`; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.class.js","sourceRoot":"","sources":["metadata.class.ts"],"names":[],"mappings":";;;AAIA,+BAAsD;AAEtD,mCAA+C;AAG/C,MA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IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,eAAe;QACX,IAAI,CAAC,oBAAoB,GAAG,IAAA,gBAAQ,EAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;QAC5E,OAAO,IAAI,CAAC,oBAAoB,CAAC;IACrC,CAAC;IAED,UAAU;QACR,IAAI,CAAC,YAAY,GAAG,IAAA,gBAAQ,EAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC/D,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;CACF;AAtDD,sCAsDC","sourcesContent":["import { SchematicContext, Tree } from \"@angular-devkit/schematics\";\nimport { AppConfig, ComponentId, Route, RouteTable } from \"../../types/interfaces/app\";\nimport { MagicOptionScheme } from \"./rules/magic-option.scheme\";\nimport { Project } from \"../utils/devkit-utils/config\";\nimport { env, GEN_FOLDER, METADATA_DIR } from \"./env\";\nimport { Manifest } from \"./manifest\";\nimport { getProject, readJson } from \"./utils\";\n\n\nexport class MagicPaths {\n\n // return the current module path\n // for example : for module \"WebModule1\" it returns 'src/app/magic/WebModule1'\n currentModulePath(module_name:string) {\n if (module_name !== \"\") {\n return `${this.rootMagicGenFolder}/${GEN_FOLDER}/${module_name}`;\n }\n\n return `${this.rootMagicGenFolder}/${GEN_FOLDER}`;\n\n\n }\n\n // return the destanation path for create the component\n // for example : for module \"WebModule1\" component \"WebModule1/folder1/bb/cc/it returns 'src/app/magic/WebModule1'\n getDestPathForComponent(module_name:string, componentPath:string) {\n return `${this.currentModulePath(module_name)}/${componentPath}`;\n }\n\n getJsonPathForComponent(cmpJsonPath:string) {\n return `${this.metadataFolderPath}/${cmpJsonPath}.json`;\n }\n\n getRelativePathForComponentInModule(module_name:string, cmpJsonPath:string) {\n let relativePathForComponentInModule = `${cmpJsonPath}`;\n if (module_name !== \"\")\n relativePathForComponentInModule = `${module_name}/${cmpJsonPath}`;\n\n return relativePathForComponentInModule;\n }\n\n getRoutePathForWebModule(module_name:string) {\n\n if (module_name == \"\")\n return this.appRoutesPath;\n\n return `${this.rootMagicGenFolder}/${GEN_FOLDER}/${module_name}/app.routes.ts`;\n }\n get rootMagicGenFolder(){ return `./${this.project.root}/src/app`; }\n get appComponentPath(){ return `./${this.project.root}/src/app/app.component.html`}\n get appRoutesPath(){ return `./${this.project.root}/src/app/app.routes.ts`}\n get appModulePath(){ return `./${this.project.root}/src/app/app.module.ts`}\n get executionPath(){ return `./${this.project.root}/src/assets/execution.properties`}\n get magicStylePath(){ return `./${this.project.root}/src/magic-styles.css`}\n get angularJsonPath(){ return `./angular.json`}\n get tsConfigAppJsonPath(){ return `./${this.project.root}/tsconfig.app.json`}\n\n // get the relative path of module to be used in LazyLoadMap\n magicGenLibModulePath (moduleName){\n\n let rootPath = this.project.root == '' ? this.project.root: this.project.root + '/';\n let modulepath = rootPath+`src/app/${GEN_FOLDER}`;\n if (moduleName !== \"\") {\n return `${modulepath}/${moduleName}/magic.gen.lib.module`;\n }\n return `${modulepath}/magic.gen.lib.module`;\n }\n\n // Files under gen folder\n get magicGenFolderPath (){ return `./${this.project.root}/src/app/${GEN_FOLDER}`}\n\n componentListPathForCurrentModuleName (module_name:string):string{\n return `./${this.project.root}/src/app/${GEN_FOLDER}/${module_name}/component-list.g.ts`\n }\n componentListPath (module_name:string):string{\n\n if (module_name !== \"\"){\n return this.componentListPathForCurrentModuleName(module_name);\n }\n return this.rootMagicComponentListPath;\n }\n\n get rootMagicComponentListPath (){\n\n return `./${this.project.root}/src/app/${GEN_FOLDER}/component-list.g.ts`\n }\n\n get magicGenLibModule (){ return `./${this.project.root}/src/app/${GEN_FOLDER}/magic.gen.lib.module.ts`}\n\n get favIconPath(){ return `./${this.project.root}/public/favicon.ico`; }\n\n get metadataFolderPath(){ return `./${this.project.root}/${METADATA_DIR}`; }\n get manifestPath (){ return `./${this.project.root}/${METADATA_DIR}/manifest.json`; }\n get configPath (){ return `./${this.project.root}/${METADATA_DIR}/config.json`; }\n get programListPath (){return `./${this.project.root}/${METADATA_DIR}/ProgramsList.json`; }\n get routesPath (){ return `./${this.project.root}/${METADATA_DIR}/routes.json`; }\n\n constructor(protected project:Project){\n }\n}\n\n\nexport class MagicMetadata {\n\n private _config: AppConfig;\n private _routesTable: RouteTable[];\n private _programListContents: any;\n\n paths: MagicPaths;\n\n get theme() {\n if (!this.options.theme) {\n this.options.theme = env.metadata.config ?env.metadata.config.theme : 'basicHTML';\n }\n return this.options.theme;\n }\n\n get allow_testing() {\n if (!this.options.allowTesting) {\n this.options.allowTesting = env.metadata.config ?env.metadata.config.allow_testing: false;\n }\n return this.options.allowTesting;\n }\n get config() {\n if (this._config) return this._config;\n return this.loadConfig();\n }\n\n get programListContents(){\n if(this._programListContents) return this._programListContents;\n return this.loadProgramList();\n }\n\n get routesTable(){\n if (this._routesTable) return this._routesTable;\n return this.loadRoutes();\n }\n\n constructor(public host: Tree, public context: SchematicContext, public options: MagicOptionScheme) {\n this.paths = new MagicPaths(getProject(host, options.project));\n }\n\n loadConfig() {\n this._config = readJson(this.host, this.paths.configPath);\n return this._config;\n }\n\n loadProgramList(){\n this._programListContents = readJson(this.host, this.paths.programListPath);\n return this._programListContents;\n }\n\n loadRoutes() {\n this._routesTable = readJson(this.host, this.paths.routesPath);\n return this._routesTable;\n }\n}\n\n\n"]}
|
|
1
|
+
{"version":3,"file":"metadata.class.js","sourceRoot":"","sources":["metadata.class.ts"],"names":[],"mappings":";;;AAIA,+BAAsD;AAEtD,mCAA+C;AAG/C,MAAa,UAAU;IAErB,iCAAiC;IACjC,8EAA8E;IAC/E,iBAAiB,CAAC,WAAkB;QACjC,IAAI,WAAW,KAAK,EAAE,EAAE,CAAC;YACvB,OAAO,GAAG,IAAI,CAAC,kBAAkB,IAAI,gBAAU,IAAI,WAAW,EAAE,CAAC;QACnE,CAAC;QAED,OAAO,GAAG,IAAI,CAAC,kBAAkB,IAAI,gBAAU,EAAE,CAAC;IAG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gBAAQ,EAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC/D,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;CACF;AAtDD,sCAsDC","sourcesContent":["import { SchematicContext, Tree } from \"@angular-devkit/schematics\";\nimport { AppConfig, ComponentId, Route, RouteTable } from \"../../types/interfaces/app\";\nimport { MagicOptionScheme } from \"./rules/magic-option.scheme\";\nimport { Project } from \"../utils/devkit-utils/config\";\nimport { env, GEN_FOLDER, METADATA_DIR } from \"./env\";\nimport { Manifest } from \"./manifest\";\nimport { getProject, readJson } from \"./utils\";\n\n\nexport class MagicPaths {\n\n // return the current module path\n // for example : for module \"WebModule1\" it returns 'src/app/magic/WebModule1'\n currentModulePath(module_name:string) {\n if (module_name !== \"\") {\n return `${this.rootMagicGenFolder}/${GEN_FOLDER}/${module_name}`;\n }\n\n return `${this.rootMagicGenFolder}/${GEN_FOLDER}`;\n\n\n }\n\n // return the destanation path for create the component\n // for example : for module \"WebModule1\" component \"WebModule1/folder1/bb/cc/it returns 'src/app/magic/WebModule1'\n getDestPathForComponent(module_name:string, componentPath:string) {\n return `${this.currentModulePath(module_name)}/${componentPath}`;\n }\n\n getJsonPathForComponent(cmpJsonPath:string) {\n return `${this.metadataFolderPath}/${cmpJsonPath}.json`;\n }\n\n getRelativePathForComponentInModule(module_name:string, cmpJsonPath:string) {\n let relativePathForComponentInModule = `${cmpJsonPath}`;\n if (module_name !== \"\")\n relativePathForComponentInModule = `${module_name}/${cmpJsonPath}`;\n\n return relativePathForComponentInModule;\n }\n\n getRoutePathForWebModule(module_name:string) {\n\n if (module_name == \"\")\n return this.appRoutesPath;\n\n return `${this.rootMagicGenFolder}/${GEN_FOLDER}/${module_name}/app.routes.ts`;\n }\n get rootMagicGenFolder(){ return `./${this.project.root}/src/app`; }\n get appComponentPath(){ return `./${this.project.root}/src/app/app.html`}\n get appRoutesPath(){ return `./${this.project.root}/src/app/app.routes.ts`}\n get appModulePath(){ return `./${this.project.root}/src/app/app.module.ts`}\n get executionPath(){ return `./${this.project.root}/src/assets/execution.properties`}\n get magicStylePath(){ return `./${this.project.root}/src/magic-styles.css`}\n get angularJsonPath(){ return `./angular.json`}\n get tsConfigAppJsonPath(){ return `./${this.project.root}/tsconfig.app.json`}\n\n // get the relative path of module to be used in LazyLoadMap\n magicGenLibModulePath (moduleName){\n\n let rootPath = this.project.root == '' ? this.project.root: this.project.root + '/';\n let modulepath = rootPath+`src/app/${GEN_FOLDER}`;\n if (moduleName !== \"\") {\n return `${modulepath}/${moduleName}/magic.gen.lib.module`;\n }\n return `${modulepath}/magic.gen.lib.module`;\n }\n\n // Files under gen folder\n get magicGenFolderPath (){ return `./${this.project.root}/src/app/${GEN_FOLDER}`}\n\n componentListPathForCurrentModuleName (module_name:string):string{\n return `./${this.project.root}/src/app/${GEN_FOLDER}/${module_name}/component-list.g.ts`\n }\n componentListPath (module_name:string):string{\n\n if (module_name !== \"\"){\n return this.componentListPathForCurrentModuleName(module_name);\n }\n return this.rootMagicComponentListPath;\n }\n\n get rootMagicComponentListPath (){\n\n return `./${this.project.root}/src/app/${GEN_FOLDER}/component-list.g.ts`\n }\n\n get magicGenLibModule (){ return `./${this.project.root}/src/app/${GEN_FOLDER}/magic.gen.lib.module.ts`}\n\n get favIconPath(){ return `./${this.project.root}/public/favicon.ico`; }\n\n get metadataFolderPath(){ return `./${this.project.root}/${METADATA_DIR}`; }\n get manifestPath (){ return `./${this.project.root}/${METADATA_DIR}/manifest.json`; }\n get configPath (){ return `./${this.project.root}/${METADATA_DIR}/config.json`; }\n get programListPath (){return `./${this.project.root}/${METADATA_DIR}/ProgramsList.json`; }\n get routesPath (){ return `./${this.project.root}/${METADATA_DIR}/routes.json`; }\n\n constructor(protected project:Project){\n }\n}\n\n\nexport class MagicMetadata {\n\n private _config: AppConfig;\n private _routesTable: RouteTable[];\n private _programListContents: any;\n\n paths: MagicPaths;\n\n get theme() {\n if (!this.options.theme) {\n this.options.theme = env.metadata.config ?env.metadata.config.theme : 'basicHTML';\n }\n return this.options.theme;\n }\n\n get allow_testing() {\n if (!this.options.allowTesting) {\n this.options.allowTesting = env.metadata.config ?env.metadata.config.allow_testing: false;\n }\n return this.options.allowTesting;\n }\n get config() {\n if (this._config) return this._config;\n return this.loadConfig();\n }\n\n get programListContents(){\n if(this._programListContents) return this._programListContents;\n return this.loadProgramList();\n }\n\n get routesTable(){\n if (this._routesTable) return this._routesTable;\n return this.loadRoutes();\n }\n\n constructor(public host: Tree, public context: SchematicContext, public options: MagicOptionScheme) {\n this.paths = new MagicPaths(getProject(host, options.project));\n }\n\n loadConfig() {\n this._config = readJson(this.host, this.paths.configPath);\n return this._config;\n }\n\n loadProgramList(){\n this._programListContents = readJson(this.host, this.paths.programListPath);\n return this._programListContents;\n }\n\n loadRoutes() {\n this._routesTable = readJson(this.host, this.paths.routesPath);\n return this._routesTable;\n }\n}\n\n\n"]}
|
|
@@ -47,7 +47,7 @@ export class MagicPaths {
|
|
|
47
47
|
return `${this.rootMagicGenFolder}/${GEN_FOLDER}/${module_name}/app.routes.ts`;
|
|
48
48
|
}
|
|
49
49
|
get rootMagicGenFolder(){ return `./${this.project.root}/src/app`; }
|
|
50
|
-
get appComponentPath(){ return `./${this.project.root}/src/app/app.
|
|
50
|
+
get appComponentPath(){ return `./${this.project.root}/src/app/app.html`}
|
|
51
51
|
get appRoutesPath(){ return `./${this.project.root}/src/app/app.routes.ts`}
|
|
52
52
|
get appModulePath(){ return `./${this.project.root}/src/app/app.module.ts`}
|
|
53
53
|
get executionPath(){ return `./${this.project.root}/src/assets/execution.properties`}
|
|
@@ -24,7 +24,8 @@ function mgAdd(options) {
|
|
|
24
24
|
updateAngularJsonWithMagicStyle(options),
|
|
25
25
|
updateTsConfigAppJson(options),
|
|
26
26
|
addLazyLoadProvider(),
|
|
27
|
-
|
|
27
|
+
addZoneChangeDetectionProviderRule(),
|
|
28
|
+
//handel app.html
|
|
28
29
|
//updateAppComponentHtmlFiles (options),
|
|
29
30
|
//handel package.Json
|
|
30
31
|
//addMagicDependenciesToPackageJson (options),
|
|
@@ -32,8 +33,8 @@ function mgAdd(options) {
|
|
|
32
33
|
}
|
|
33
34
|
function updateAppComponentHtmlFiles(options) {
|
|
34
35
|
return (0, generate_rule_1.generate)({
|
|
35
|
-
template: "./templates/angular/src/app/app.
|
|
36
|
-
name: "app.
|
|
36
|
+
template: "./templates/angular/src/app/app.html.ejs",
|
|
37
|
+
name: "app.html",
|
|
37
38
|
destination: env_1.env.metadata.paths.rootMagicGenFolder,
|
|
38
39
|
type: generated_file_types_enum_1.GeneratedFileTypes.HTML,
|
|
39
40
|
data: {
|
|
@@ -46,11 +47,11 @@ function updateAngularJsonWithMagicStyle(options) {
|
|
|
46
47
|
const project = env_1.env.project;
|
|
47
48
|
let isDirty = false;
|
|
48
49
|
let fullPathmagicStylePath = env_1.env.metadata.paths.magicStylePath;
|
|
49
|
-
if (!project.architect.test.options.styles.includes(fullPathmagicStylePath)) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
50
|
+
// if (!project.architect.test.options.styles.includes(fullPathmagicStylePath)) {
|
|
51
|
+
// context.logger.info(` [>]add file ${fullPathmagicStylePath} to test`);
|
|
52
|
+
// project.architect.test.options.styles.push(fullPathmagicStylePath);
|
|
53
|
+
// isDirty = true;
|
|
54
|
+
// }
|
|
54
55
|
if (!project.architect.build.options.styles.includes(fullPathmagicStylePath)) {
|
|
55
56
|
context.logger.info(` [>]add file ${fullPathmagicStylePath} to build`);
|
|
56
57
|
project.architect.build.options.styles.push(fullPathmagicStylePath);
|
|
@@ -123,7 +124,7 @@ function addMagicModuleToAppModule(options) {
|
|
|
123
124
|
}
|
|
124
125
|
function addLazyLoadProvider() {
|
|
125
126
|
return (host) => {
|
|
126
|
-
const appmodule = env_1.env.metadata.paths.rootMagicGenFolder + '/app
|
|
127
|
+
const appmodule = env_1.env.metadata.paths.rootMagicGenFolder + '/app-module.ts';
|
|
127
128
|
const lazyLoaderService = 'LazyLoaderService';
|
|
128
129
|
const lazyLoaderServicePath = './magic/lazy-loader.service';
|
|
129
130
|
let text = host.read(appmodule);
|
|
@@ -138,16 +139,92 @@ function addLazyLoadProvider() {
|
|
|
138
139
|
}
|
|
139
140
|
}
|
|
140
141
|
host.commitUpdate(providerRecorder);
|
|
142
|
+
sourceText = host.read(appmodule).toString('utf-8');
|
|
143
|
+
source = ts.createSourceFile(appmodule, sourceText, ts.ScriptTarget.Latest, true);
|
|
141
144
|
const lazyLoaderServiceImport = (0, ast_utils_1.insertImport)(source, appmodule, lazyLoaderService, lazyLoaderServicePath, false);
|
|
142
145
|
const lazyLoaderServiceChangesRecorder = host.beginUpdate(appmodule);
|
|
143
146
|
if (lazyLoaderServiceImport instanceof change_1.InsertChange)
|
|
144
147
|
lazyLoaderServiceChangesRecorder.insertLeft(lazyLoaderServiceImport.pos, lazyLoaderServiceImport.toAdd);
|
|
145
148
|
host.commitUpdate(lazyLoaderServiceChangesRecorder);
|
|
146
149
|
// add import for MagicLazyLoaderService
|
|
150
|
+
sourceText = host.read(appmodule).toString('utf-8');
|
|
151
|
+
source = ts.createSourceFile(appmodule, sourceText, ts.ScriptTarget.Latest, true);
|
|
147
152
|
const magicLazyLoaderServiceImportChanges = (0, ast_utils_1.insertImport)(source, appmodule, 'MagicLazyLoaderService', '@magic-xpa/angular', false);
|
|
148
153
|
const magicImportChangesRecorder = host.beginUpdate(appmodule);
|
|
149
154
|
magicImportChangesRecorder.insertLeft(magicLazyLoaderServiceImportChanges.pos, magicLazyLoaderServiceImportChanges.toAdd);
|
|
150
155
|
host.commitUpdate(magicImportChangesRecorder);
|
|
151
156
|
};
|
|
152
157
|
}
|
|
158
|
+
function addZoneChangeDetectionProviderRule() {
|
|
159
|
+
return (host) => {
|
|
160
|
+
// Resolve the generated root module path (src/app/app-module.ts in this project layout).
|
|
161
|
+
const appmodule = env_1.env.metadata.paths.rootMagicGenFolder + '/app-module.ts';
|
|
162
|
+
// Append provideZoneChangeDetection() to NgModule.providers if it does not already exist.
|
|
163
|
+
addZoneChangeDetectionProvider(host, appmodule);
|
|
164
|
+
// Re-parse from disk after provider update so import insertion uses fresh AST positions.
|
|
165
|
+
const sourceText = host.read(appmodule).toString('utf-8');
|
|
166
|
+
const source = ts.createSourceFile(appmodule, sourceText, ts.ScriptTarget.Latest, true);
|
|
167
|
+
// Ensure the symbol import exists; insertImport is idempotent and avoids duplicates.
|
|
168
|
+
const zoneChangeDetectionImport = (0, ast_utils_1.insertImport)(source, appmodule, 'provideZoneChangeDetection', '@angular/core', false);
|
|
169
|
+
const zoneChangeDetectionImportChangesRecorder = host.beginUpdate(appmodule);
|
|
170
|
+
if (zoneChangeDetectionImport instanceof change_1.InsertChange)
|
|
171
|
+
zoneChangeDetectionImportChangesRecorder.insertLeft(zoneChangeDetectionImport.pos, zoneChangeDetectionImport.toAdd);
|
|
172
|
+
host.commitUpdate(zoneChangeDetectionImportChangesRecorder);
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
function addZoneChangeDetectionProvider(host, appmodule) {
|
|
176
|
+
const zoneProvider = 'provideZoneChangeDetection()';
|
|
177
|
+
const sourceText = host.read(appmodule).toString('utf-8');
|
|
178
|
+
const source = ts.createSourceFile(appmodule, sourceText, ts.ScriptTarget.Latest, true);
|
|
179
|
+
// Locate the first @NgModule({...}) metadata object in app-module.ts.
|
|
180
|
+
const ngModules = (0, ast_utils_1.getDecoratorMetadata)(source, 'NgModule', '@angular/core');
|
|
181
|
+
if (!ngModules.length) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const ngModuleMetadata = ngModules[0];
|
|
185
|
+
// Find the `providers` property assignment inside @NgModule metadata.
|
|
186
|
+
const providersProperty = ngModuleMetadata.properties
|
|
187
|
+
.filter(ts.isPropertyAssignment)
|
|
188
|
+
.find((prop) => {
|
|
189
|
+
if (ts.isIdentifier(prop.name)) {
|
|
190
|
+
return prop.name.text === 'providers';
|
|
191
|
+
}
|
|
192
|
+
return ts.isStringLiteral(prop.name) && prop.name.text === 'providers';
|
|
193
|
+
});
|
|
194
|
+
if (!providersProperty || !ts.isArrayLiteralExpression(providersProperty.initializer)) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
const providersArray = providersProperty.initializer;
|
|
198
|
+
// Keep this operation idempotent: do nothing if provider already exists.
|
|
199
|
+
const hasZoneProvider = providersArray.elements.some((el) => {
|
|
200
|
+
return el.getText(source).replace(/\s+/g, '') === zoneProvider;
|
|
201
|
+
});
|
|
202
|
+
if (hasZoneProvider) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
let insertPos;
|
|
206
|
+
let toAdd;
|
|
207
|
+
if (providersArray.elements.length === 0) {
|
|
208
|
+
// Empty providers: inject the item directly between [].
|
|
209
|
+
insertPos = providersArray.getEnd() - 1;
|
|
210
|
+
toAdd = zoneProvider;
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
// Non-empty providers: append after last provider, preserving line formatting when possible.
|
|
214
|
+
const lastProvider = providersArray.elements[providersArray.elements.length - 1];
|
|
215
|
+
insertPos = lastProvider.getEnd();
|
|
216
|
+
const lastProviderText = lastProvider.getFullText(source);
|
|
217
|
+
const newLineMatch = lastProviderText.match(/^\r?\n(\r?)\s+/);
|
|
218
|
+
if (newLineMatch) {
|
|
219
|
+
toAdd = `,${newLineMatch[0]}${zoneProvider}`;
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
toAdd = `, ${zoneProvider}`;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
// Apply the computed insertion at the exact Abstract Syntax Tree-derived position.
|
|
226
|
+
const recorder = host.beginUpdate(appmodule);
|
|
227
|
+
recorder.insertLeft(insertPos, toAdd);
|
|
228
|
+
host.commitUpdate(recorder);
|
|
229
|
+
}
|
|
153
230
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRo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AAE,oBAAoB,EAAE,KAAK,CAAC,CAAC;QAC/J,MAAM,0BAA0B,GAAG,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QAC/D,0BAA0B,CAAC,UAAU,CAAC,mCAAmC,CAAC,GAAG,EAAE,mCAAmC,CAAC,KAAK,CAAC,CAAA;QACzH,IAAI,CAAC,YAAY,CAAC,0BAA0B,CAAC,CAAC;IAChD,CAAC,CAAA;AACH,CAAC","sourcesContent":["import {\r\n Rule,\r\n chain,\r\n Tree,\r\n SchematicContext\r\n} from \"@angular-devkit/schematics\";\r\nimport {NodePackageInstallTask} from \"@angular-devkit/schematics/tasks\";\r\n\r\nimport {addPackageToPackageJson} from './../utils/package';\r\nimport { dependencies, devDependencies, env} from \"../magic-utils/env\";\r\nimport { addImportTSModule, copyMagicFiles} from \"../magic-utils/utils\";\r\nimport { initMagicMetadata} from \"../magic-utils/rules/init-magic-metadata.rule\";\r\nimport { addModuleImportToRootModule } from \"../utils/ast\";\r\nimport { LogLn } from \"../magic-utils/Util\";\r\nimport { generate } from \"../magic-utils/rules/generate.rule\";\r\nimport { GeneratedFileTypes } from \"../../types/enums/generated-file-types.enum\";\r\nimport { MagicOptionScheme } from \"../magic-utils/rules/magic-option.scheme\";\r\nimport {addProviderToModule, insertImport} from \"../utils/devkit-utils/ast-utils\";\r\nimport * as ts from 'typescript';\r\nimport {InsertChange} from \"../utils/devkit-utils/change\";\r\nexport function mgAdd(options:MagicOptionScheme): Rule {\r\n return chain([\r\n initMagicMetadata (options),\r\n copyMagicFiles (options),\r\n\r\n // handel app.modules.ts\r\n addMagicModuleToAppModule (options),\r\n\r\n // handel Angular.json\r\n updateAngularJsonWithMagicStyle (options),\r\n\r\n updateTsConfigAppJson (options),\r\n\r\n addLazyLoadProvider(),\r\n // handel app.component.html\r\n //updateAppComponentHtmlFiles (options),\r\n\r\n //handel package.Json\r\n //addMagicDependenciesToPackageJson (options),\r\n ]);\r\n}\r\n\r\nfunction updateAppComponentHtmlFiles(options:MagicOptionScheme): Rule {\r\n return generate({\r\n template : \"./templates/angular/src/app/app.component.html.ejs\",\r\n name : \"app.component.html\",\r\n destination : env.metadata.paths.rootMagicGenFolder,\r\n type :GeneratedFileTypes.HTML,\r\n data : {\r\n skipHelp : options.skipHelp\r\n }\r\n },options)\r\n}\r\nfunction updateAngularJsonWithMagicStyle(options:MagicOptionScheme): Rule {\r\n return (host: Tree, context: SchematicContext) => {\r\n const project = env.project;\r\n let isDirty = false;\r\n\r\n let fullPathmagicStylePath = env.metadata.paths.magicStylePath;\r\n if (!project.architect.test.options.styles.includes(fullPathmagicStylePath)) {\r\n context.logger.info(` [>]add file ${fullPathmagicStylePath} to test`);\r\n project.architect.test.options.styles.push(fullPathmagicStylePath);\r\n isDirty = true;\r\n }\r\n\r\n if (!project.architect.build.options.styles.includes(fullPathmagicStylePath)) {\r\n context.logger.info(` [>]add file ${fullPathmagicStylePath} to build`);\r\n project.architect.build.options.styles.push(fullPathmagicStylePath);\r\n isDirty = true;\r\n }\r\n\r\n if(isDirty){\r\n let fullPath = env.metadata.paths.angularJsonPath;\r\n host.overwrite(fullPath, JSON.stringify(env.workspace, null, 2));\r\n }\r\n\r\n return host;\r\n };\r\n}\r\n\r\n// Angular 10 , does not include .ts file for compilation\r\n// So to avoid compilation error , add *.module.ts in includes section\r\nfunction updateTsConfigAppJson (option: MagicOptionScheme): Rule{\r\n return (host: Tree, context: SchematicContext) => {\r\n\r\n const tsConfigPath = env.metadata.paths.tsConfigAppJsonPath;\r\n const tsConfig = host.read(tsConfigPath).toString();\r\n\r\n // extract the comment\r\n let firstIndex = tsConfig.indexOf('*/');\r\n let secondIndex = tsConfig.indexOf('*/', firstIndex + 2);\r\n let comment = tsConfig.substring(0, secondIndex + 2);\r\n\r\n // replace the comment as parsing json with comment throws exception\r\n var config = JSON.parse(tsConfig.replace(comment, ''));\r\n\r\n //Add module files for compilation\r\n if(!config['include'].includes('src/**/*module.ts'))\r\n config['include'].push('src/**/*module.ts');\r\n\r\n // append the comment again and write the file\r\n host.overwrite(tsConfigPath, comment + \"\\n\" + JSON.stringify(config, null , 2));\r\n return host;\r\n }\r\n}\r\n\r\nfunction addMagicDependenciesToPackageJson(option:MagicOptionScheme): Rule {\r\n\treturn (host: Tree, context: SchematicContext) => {\r\n\t if(!option.skipPackageJson){\r\n for (let dep of dependencies){\r\n LogLn(`[>] Add dependencies ${dep.name}`);\r\n addPackageToPackageJson(host, 'dependencies', dep.name, dep.version);\r\n }\r\n /*\r\n // done in pre-install step\r\n for (let dep of devDependencies){\r\n LogLn(`[>] Add devDependencies ${dep.name}`);\r\n addPackageToPackageJson(host, 'devDependencies', dep.name, dep.version);\r\n }\r\n */\r\n }\r\n\r\n\t\tif(!option.skipInstall){\r\n LogLn(`[>] Install dependencies.`);\r\n context.addTask(new NodePackageInstallTask());\r\n }else{\r\n LogLn(`skipIstalls ${dependencies.length} dependencies`);\r\n LogLn(`skipIstalls ${devDependencies.length} devDependencies`);\r\n }\r\n\r\n\t\treturn host;\r\n\t};\r\n}\r\nfunction addMagicModuleToAppModule(options: MagicOptionScheme) : Rule {\r\n return (host: Tree , context : SchematicContext)=>{\r\n const workspace = env.workspace;\r\n const project = env.project;\r\n\r\n addModuleImportToRootModule(\r\n host,\r\n 'BrowserAnimationsModule',\r\n '@angular/platform-browser/animations',\r\n project);\r\n\r\n addModuleImportToRootModule(\r\n host,\r\n 'ReactiveFormsModule',\r\n '@angular/forms',\r\n project);\r\n\r\n\r\n addModuleImportToRootModule(\r\n host,\r\n 'MagicModule',\r\n \"@magic-xpa/angular\",\r\n project);\r\n\r\n addModuleImportToRootModule(\r\n host,\r\n 'MagicAngularMaterialModule',\r\n \"@magic-xpa/angular-material-core\",\r\n project);\r\n\r\n addModuleImportToRootModule(\r\n host,\r\n 'MagicGenLibModule',\r\n \"./magic/magic.gen.lib.module\",\r\n project);\r\n\r\n addModuleImportToRootModule(\r\n host,\r\n 'MagicRoutingModule',\r\n \"./app.routes\",\r\n project);\r\n\r\n\r\n }\r\n}\r\n\r\nfunction addLazyLoadProvider(): Rule {\r\n return (host: Tree) => {\r\n const appmodule = env.metadata.paths.rootMagicGenFolder + '/app.module.ts';\r\n\r\n const lazyLoaderService = 'LazyLoaderService';\r\n const lazyLoaderServicePath = './magic/lazy-loader.service';\r\n\r\n let text = host.read(appmodule);\r\n let sourceText = text.toString('utf-8');\r\n let source = ts.createSourceFile(appmodule, sourceText, ts.ScriptTarget.Latest, true);\r\n let providerChanges = addProviderToModule(source, appmodule, '{ provide: MagicLazyLoaderService, useClass: LazyLoaderService }', lazyLoaderServicePath)\r\n\r\n const providerRecorder = host.beginUpdate(appmodule);\r\n for (const change of providerChanges) {\r\n if (change instanceof InsertChange) {\r\n if (!change.toAdd.includes('import')) // skip import change\r\n providerRecorder.insertLeft(change.pos, change.toAdd);\r\n }\r\n }\r\n host.commitUpdate(providerRecorder);\r\n\r\n const lazyLoaderServiceImport = insertImport(source, appmodule, lazyLoaderService, lazyLoaderServicePath, false);\r\n const lazyLoaderServiceChangesRecorder = host.beginUpdate(appmodule);\r\n if (lazyLoaderServiceImport instanceof InsertChange)\r\n lazyLoaderServiceChangesRecorder.insertLeft(lazyLoaderServiceImport.pos, lazyLoaderServiceImport.toAdd);\r\n host.commitUpdate(lazyLoaderServiceChangesRecorder);\r\n\r\n // add import for MagicLazyLoaderService\r\n const magicLazyLoaderServiceImportChanges: InsertChange = <InsertChange>insertImport(source, appmodule, 'MagicLazyLoaderService', '@magic-xpa/angular', false);\r\n const magicImportChangesRecorder = host.beginUpdate(appmodule);\r\n magicImportChangesRecorder.insertLeft(magicLazyLoaderServiceImportChanges.pos, magicLazyLoaderServiceImportChanges.toAdd)\r\n host.commitUpdate(magicImportChangesRecorder);\r\n }\r\n}\r\n\r\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAoBA,sBAsBC;AA1CD,2DAKoC;AACpC,4DAAwE;AAExE,gDAA2D;AAC3D,4CAAu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\r\nimport {NodePackageInstallTask} from \"@angular-devkit/schematics/tasks\";\r\n\r\nimport {addPackageToPackageJson} from './../utils/package';\r\nimport { dependencies, devDependencies, env} from \"../magic-utils/env\";\r\nimport { addImportTSModule, copyMagicFiles} from \"../magic-utils/utils\";\r\nimport { initMagicMetadata} from \"../magic-utils/rules/init-magic-metadata.rule\";\r\nimport { addModuleImportToRootModule } from \"../utils/ast\";\r\nimport { LogLn } from \"../magic-utils/Util\";\r\nimport { generate } from \"../magic-utils/rules/generate.rule\";\r\nimport { GeneratedFileTypes } from \"../../types/enums/generated-file-types.enum\";\r\nimport { MagicOptionScheme } from \"../magic-utils/rules/magic-option.scheme\";\r\nimport {addProviderToModule, getDecoratorMetadata, insertImport} from \"../utils/devkit-utils/ast-utils\";\r\nimport * as ts from 'typescript';\r\nimport {InsertChange} from \"../utils/devkit-utils/change\";\r\nexport function mgAdd(options:MagicOptionScheme): Rule {\r\n return chain([\r\n initMagicMetadata (options),\r\n copyMagicFiles (options),\r\n\r\n // handel app.modules.ts\r\n addMagicModuleToAppModule (options),\r\n\r\n // handel Angular.json\r\n updateAngularJsonWithMagicStyle (options),\r\n\r\n updateTsConfigAppJson (options),\r\n\r\n addLazyLoadProvider(),\r\n\r\n addZoneChangeDetectionProviderRule(),\r\n //handel app.html\r\n //updateAppComponentHtmlFiles (options),\r\n\r\n //handel package.Json\r\n //addMagicDependenciesToPackageJson (options),\r\n ]);\r\n}\r\n\r\nfunction updateAppComponentHtmlFiles(options:MagicOptionScheme): Rule {\r\n return generate({\r\n template : \"./templates/angular/src/app/app.html.ejs\",\r\n name : \"app.html\",\r\n destination : env.metadata.paths.rootMagicGenFolder,\r\n type :GeneratedFileTypes.HTML,\r\n data : {\r\n skipHelp : options.skipHelp\r\n }\r\n },options)\r\n}\r\nfunction updateAngularJsonWithMagicStyle(options:MagicOptionScheme): Rule {\r\n return (host: Tree, context: SchematicContext) => {\r\n const project = env.project;\r\n let isDirty = false;\r\n\r\n let fullPathmagicStylePath = env.metadata.paths.magicStylePath;\r\n // if (!project.architect.test.options.styles.includes(fullPathmagicStylePath)) {\r\n // context.logger.info(` [>]add file ${fullPathmagicStylePath} to test`);\r\n // project.architect.test.options.styles.push(fullPathmagicStylePath);\r\n // isDirty = true;\r\n // }\r\n\r\n if (!project.architect.build.options.styles.includes(fullPathmagicStylePath)) {\r\n context.logger.info(` [>]add file ${fullPathmagicStylePath} to build`);\r\n project.architect.build.options.styles.push(fullPathmagicStylePath);\r\n isDirty = true;\r\n }\r\n\r\n if(isDirty){\r\n let fullPath = env.metadata.paths.angularJsonPath;\r\n host.overwrite(fullPath, JSON.stringify(env.workspace, null, 2));\r\n }\r\n\r\n return host;\r\n };\r\n}\r\n\r\n// Angular 10 , does not include .ts file for compilation\r\n// So to avoid compilation error , add *.module.ts in includes section\r\nfunction updateTsConfigAppJson (option: MagicOptionScheme): Rule{\r\n return (host: Tree, context: SchematicContext) => {\r\n\r\n const tsConfigPath = env.metadata.paths.tsConfigAppJsonPath;\r\n const tsConfig = host.read(tsConfigPath).toString();\r\n\r\n // extract the comment\r\n let firstIndex = tsConfig.indexOf('*/');\r\n let secondIndex = tsConfig.indexOf('*/', firstIndex + 2);\r\n let comment = tsConfig.substring(0, secondIndex + 2);\r\n\r\n // replace the comment as parsing json with comment throws exception\r\n var config = JSON.parse(tsConfig.replace(comment, ''));\r\n\r\n //Add module files for compilation\r\n if(!config['include'].includes('src/**/*module.ts'))\r\n config['include'].push('src/**/*module.ts');\r\n\r\n // append the comment again and write the file\r\n host.overwrite(tsConfigPath, comment + \"\\n\" + JSON.stringify(config, null , 2));\r\n return host;\r\n }\r\n}\r\n\r\nfunction addMagicDependenciesToPackageJson(option:MagicOptionScheme): Rule {\r\n\treturn (host: Tree, context: SchematicContext) => {\r\n\t if(!option.skipPackageJson){\r\n for (let dep of dependencies){\r\n LogLn(`[>] Add dependencies ${dep.name}`);\r\n addPackageToPackageJson(host, 'dependencies', dep.name, dep.version);\r\n }\r\n /*\r\n // done in pre-install step\r\n for (let dep of devDependencies){\r\n LogLn(`[>] Add devDependencies ${dep.name}`);\r\n addPackageToPackageJson(host, 'devDependencies', dep.name, dep.version);\r\n }\r\n */\r\n }\r\n\r\n\t\tif(!option.skipInstall){\r\n LogLn(`[>] Install dependencies.`);\r\n context.addTask(new NodePackageInstallTask());\r\n }else{\r\n LogLn(`skipIstalls ${dependencies.length} dependencies`);\r\n LogLn(`skipIstalls ${devDependencies.length} devDependencies`);\r\n }\r\n\r\n\t\treturn host;\r\n\t};\r\n}\r\nfunction addMagicModuleToAppModule(options: MagicOptionScheme) : Rule {\r\n return (host: Tree , context : SchematicContext)=>{\r\n const workspace = env.workspace;\r\n const project = env.project;\r\n\r\n addModuleImportToRootModule(\r\n host,\r\n 'BrowserAnimationsModule',\r\n '@angular/platform-browser/animations',\r\n project);\r\n\r\n addModuleImportToRootModule(\r\n host,\r\n 'ReactiveFormsModule',\r\n '@angular/forms',\r\n project);\r\n\r\n\r\n addModuleImportToRootModule(\r\n host,\r\n 'MagicModule',\r\n \"@magic-xpa/angular\",\r\n project);\r\n\r\n addModuleImportToRootModule(\r\n host,\r\n 'MagicAngularMaterialModule',\r\n \"@magic-xpa/angular-material-core\",\r\n project);\r\n\r\n addModuleImportToRootModule(\r\n host,\r\n 'MagicGenLibModule',\r\n \"./magic/magic.gen.lib.module\",\r\n project);\r\n\r\n addModuleImportToRootModule(\r\n host,\r\n 'MagicRoutingModule',\r\n \"./app.routes\",\r\n project);\r\n\r\n\r\n }\r\n}\r\n\r\nfunction addLazyLoadProvider(): Rule {\r\n return (host: Tree) => {\r\n const appmodule = env.metadata.paths.rootMagicGenFolder + '/app-module.ts';\r\n\r\n const lazyLoaderService = 'LazyLoaderService';\r\n const lazyLoaderServicePath = './magic/lazy-loader.service';\r\n\r\n let text = host.read(appmodule);\r\n let sourceText = text.toString('utf-8');\r\n let source = ts.createSourceFile(appmodule, sourceText, ts.ScriptTarget.Latest, true);\r\n let providerChanges = addProviderToModule(source, appmodule, '{ provide: MagicLazyLoaderService, useClass: LazyLoaderService }', lazyLoaderServicePath)\r\n\r\n const providerRecorder = host.beginUpdate(appmodule);\r\n for (const change of providerChanges) {\r\n if (change instanceof InsertChange) {\r\n if (!change.toAdd.includes('import')) // skip import change\r\n providerRecorder.insertLeft(change.pos, change.toAdd);\r\n }\r\n }\r\n host.commitUpdate(providerRecorder);\r\n\r\n sourceText = host.read(appmodule).toString('utf-8');\r\n source = ts.createSourceFile(appmodule, sourceText, ts.ScriptTarget.Latest, true);\r\n const lazyLoaderServiceImport = insertImport(source, appmodule, lazyLoaderService, lazyLoaderServicePath, false);\r\n const lazyLoaderServiceChangesRecorder = host.beginUpdate(appmodule);\r\n if (lazyLoaderServiceImport instanceof InsertChange)\r\n lazyLoaderServiceChangesRecorder.insertLeft(lazyLoaderServiceImport.pos, lazyLoaderServiceImport.toAdd);\r\n host.commitUpdate(lazyLoaderServiceChangesRecorder);\r\n\r\n // add import for MagicLazyLoaderService\r\n sourceText = host.read(appmodule).toString('utf-8');\r\n source = ts.createSourceFile(appmodule, sourceText, ts.ScriptTarget.Latest, true);\r\n const magicLazyLoaderServiceImportChanges: InsertChange = <InsertChange>insertImport(source, appmodule, 'MagicLazyLoaderService', '@magic-xpa/angular', false);\r\n const magicImportChangesRecorder = host.beginUpdate(appmodule);\r\n magicImportChangesRecorder.insertLeft(magicLazyLoaderServiceImportChanges.pos, magicLazyLoaderServiceImportChanges.toAdd)\r\n host.commitUpdate(magicImportChangesRecorder);\r\n }\r\n}\r\n\r\nfunction addZoneChangeDetectionProviderRule(): Rule {\r\n return (host: Tree) => {\r\n // Resolve the generated root module path (src/app/app-module.ts in this project layout).\r\n const appmodule = env.metadata.paths.rootMagicGenFolder + '/app-module.ts';\r\n\r\n // Append provideZoneChangeDetection() to NgModule.providers if it does not already exist.\r\n addZoneChangeDetectionProvider(host, appmodule);\r\n\r\n // Re-parse from disk after provider update so import insertion uses fresh AST positions.\r\n const sourceText = host.read(appmodule).toString('utf-8');\r\n const source = ts.createSourceFile(appmodule, sourceText, ts.ScriptTarget.Latest, true);\r\n\r\n // Ensure the symbol import exists; insertImport is idempotent and avoids duplicates.\r\n const zoneChangeDetectionImport = insertImport(source, appmodule, 'provideZoneChangeDetection', '@angular/core', false);\r\n const zoneChangeDetectionImportChangesRecorder = host.beginUpdate(appmodule);\r\n if (zoneChangeDetectionImport instanceof InsertChange)\r\n zoneChangeDetectionImportChangesRecorder.insertLeft(zoneChangeDetectionImport.pos, zoneChangeDetectionImport.toAdd);\r\n host.commitUpdate(zoneChangeDetectionImportChangesRecorder);\r\n };\r\n}\r\n\r\nfunction addZoneChangeDetectionProvider(host: Tree, appmodule: string): void {\r\n const zoneProvider = 'provideZoneChangeDetection()';\r\n const sourceText = host.read(appmodule).toString('utf-8');\r\n const source = ts.createSourceFile(appmodule, sourceText, ts.ScriptTarget.Latest, true);\r\n\r\n // Locate the first @NgModule({...}) metadata object in app-module.ts.\r\n const ngModules = getDecoratorMetadata(source, 'NgModule', '@angular/core');\r\n\r\n if (!ngModules.length) {\r\n return;\r\n }\r\n\r\n const ngModuleMetadata = ngModules[0] as ts.ObjectLiteralExpression;\r\n // Find the `providers` property assignment inside @NgModule metadata.\r\n const providersProperty = ngModuleMetadata.properties\r\n .filter(ts.isPropertyAssignment)\r\n .find((prop: ts.PropertyAssignment) => {\r\n if (ts.isIdentifier(prop.name)) {\r\n return prop.name.text === 'providers';\r\n }\r\n\r\n return ts.isStringLiteral(prop.name) && prop.name.text === 'providers';\r\n });\r\n\r\n if (!providersProperty || !ts.isArrayLiteralExpression(providersProperty.initializer)) {\r\n return;\r\n }\r\n\r\n const providersArray = providersProperty.initializer;\r\n // Keep this operation idempotent: do nothing if provider already exists.\r\n const hasZoneProvider = providersArray.elements.some((el: ts.Expression) => {\r\n return el.getText(source).replace(/\\s+/g, '') === zoneProvider;\r\n });\r\n\r\n if (hasZoneProvider) {\r\n return;\r\n }\r\n\r\n let insertPos: number;\r\n let toAdd: string;\r\n if (providersArray.elements.length === 0) {\r\n // Empty providers: inject the item directly between [].\r\n insertPos = providersArray.getEnd() - 1;\r\n toAdd = zoneProvider;\r\n } else {\r\n // Non-empty providers: append after last provider, preserving line formatting when possible.\r\n const lastProvider = providersArray.elements[providersArray.elements.length - 1];\r\n insertPos = lastProvider.getEnd();\r\n const lastProviderText = lastProvider.getFullText(source);\r\n const newLineMatch = lastProviderText.match(/^\\r?\\n(\\r?)\\s+/);\r\n if (newLineMatch) {\r\n toAdd = `,${newLineMatch[0]}${zoneProvider}`;\r\n } else {\r\n toAdd = `, ${zoneProvider}`;\r\n }\r\n }\r\n\r\n // Apply the computed insertion at the exact Abstract Syntax Tree-derived position.\r\n const recorder = host.beginUpdate(appmodule);\r\n recorder.insertLeft(insertPos, toAdd);\r\n host.commitUpdate(recorder);\r\n}\r\n\r\n"]}
|
|
@@ -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`);
|
|
@@ -179,7 +181,7 @@ function addMagicModuleToAppModule(options: MagicOptionScheme) : Rule {
|
|
|
179
181
|
|
|
180
182
|
function addLazyLoadProvider(): Rule {
|
|
181
183
|
return (host: Tree) => {
|
|
182
|
-
const appmodule = env.metadata.paths.rootMagicGenFolder + '/app
|
|
184
|
+
const appmodule = env.metadata.paths.rootMagicGenFolder + '/app-module.ts';
|
|
183
185
|
|
|
184
186
|
const lazyLoaderService = 'LazyLoaderService';
|
|
185
187
|
const lazyLoaderServicePath = './magic/lazy-loader.service';
|
|
@@ -198,6 +200,8 @@ function addLazyLoadProvider(): Rule {
|
|
|
198
200
|
}
|
|
199
201
|
host.commitUpdate(providerRecorder);
|
|
200
202
|
|
|
203
|
+
sourceText = host.read(appmodule).toString('utf-8');
|
|
204
|
+
source = ts.createSourceFile(appmodule, sourceText, ts.ScriptTarget.Latest, true);
|
|
201
205
|
const lazyLoaderServiceImport = insertImport(source, appmodule, lazyLoaderService, lazyLoaderServicePath, false);
|
|
202
206
|
const lazyLoaderServiceChangesRecorder = host.beginUpdate(appmodule);
|
|
203
207
|
if (lazyLoaderServiceImport instanceof InsertChange)
|
|
@@ -205,6 +209,8 @@ function addLazyLoadProvider(): Rule {
|
|
|
205
209
|
host.commitUpdate(lazyLoaderServiceChangesRecorder);
|
|
206
210
|
|
|
207
211
|
// add import for MagicLazyLoaderService
|
|
212
|
+
sourceText = host.read(appmodule).toString('utf-8');
|
|
213
|
+
source = ts.createSourceFile(appmodule, sourceText, ts.ScriptTarget.Latest, true);
|
|
208
214
|
const magicLazyLoaderServiceImportChanges: InsertChange = <InsertChange>insertImport(source, appmodule, 'MagicLazyLoaderService', '@magic-xpa/angular', false);
|
|
209
215
|
const magicImportChangesRecorder = host.beginUpdate(appmodule);
|
|
210
216
|
magicImportChangesRecorder.insertLeft(magicLazyLoaderServiceImportChanges.pos, magicLazyLoaderServiceImportChanges.toAdd)
|
|
@@ -212,3 +218,87 @@ function addLazyLoadProvider(): Rule {
|
|
|
212
218
|
}
|
|
213
219
|
}
|
|
214
220
|
|
|
221
|
+
function addZoneChangeDetectionProviderRule(): Rule {
|
|
222
|
+
return (host: Tree) => {
|
|
223
|
+
// Resolve the generated root module path (src/app/app-module.ts in this project layout).
|
|
224
|
+
const appmodule = env.metadata.paths.rootMagicGenFolder + '/app-module.ts';
|
|
225
|
+
|
|
226
|
+
// Append provideZoneChangeDetection() to NgModule.providers if it does not already exist.
|
|
227
|
+
addZoneChangeDetectionProvider(host, appmodule);
|
|
228
|
+
|
|
229
|
+
// Re-parse from disk after provider update so import insertion uses fresh AST positions.
|
|
230
|
+
const sourceText = host.read(appmodule).toString('utf-8');
|
|
231
|
+
const source = ts.createSourceFile(appmodule, sourceText, ts.ScriptTarget.Latest, true);
|
|
232
|
+
|
|
233
|
+
// Ensure the symbol import exists; insertImport is idempotent and avoids duplicates.
|
|
234
|
+
const zoneChangeDetectionImport = insertImport(source, appmodule, 'provideZoneChangeDetection', '@angular/core', false);
|
|
235
|
+
const zoneChangeDetectionImportChangesRecorder = host.beginUpdate(appmodule);
|
|
236
|
+
if (zoneChangeDetectionImport instanceof InsertChange)
|
|
237
|
+
zoneChangeDetectionImportChangesRecorder.insertLeft(zoneChangeDetectionImport.pos, zoneChangeDetectionImport.toAdd);
|
|
238
|
+
host.commitUpdate(zoneChangeDetectionImportChangesRecorder);
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function addZoneChangeDetectionProvider(host: Tree, appmodule: string): void {
|
|
243
|
+
const zoneProvider = 'provideZoneChangeDetection()';
|
|
244
|
+
const sourceText = host.read(appmodule).toString('utf-8');
|
|
245
|
+
const source = ts.createSourceFile(appmodule, sourceText, ts.ScriptTarget.Latest, true);
|
|
246
|
+
|
|
247
|
+
// Locate the first @NgModule({...}) metadata object in app-module.ts.
|
|
248
|
+
const ngModules = getDecoratorMetadata(source, 'NgModule', '@angular/core');
|
|
249
|
+
|
|
250
|
+
if (!ngModules.length) {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
const ngModuleMetadata = ngModules[0] as ts.ObjectLiteralExpression;
|
|
255
|
+
// Find the `providers` property assignment inside @NgModule metadata.
|
|
256
|
+
const providersProperty = ngModuleMetadata.properties
|
|
257
|
+
.filter(ts.isPropertyAssignment)
|
|
258
|
+
.find((prop: ts.PropertyAssignment) => {
|
|
259
|
+
if (ts.isIdentifier(prop.name)) {
|
|
260
|
+
return prop.name.text === 'providers';
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
return ts.isStringLiteral(prop.name) && prop.name.text === 'providers';
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
if (!providersProperty || !ts.isArrayLiteralExpression(providersProperty.initializer)) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
const providersArray = providersProperty.initializer;
|
|
271
|
+
// Keep this operation idempotent: do nothing if provider already exists.
|
|
272
|
+
const hasZoneProvider = providersArray.elements.some((el: ts.Expression) => {
|
|
273
|
+
return el.getText(source).replace(/\s+/g, '') === zoneProvider;
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
if (hasZoneProvider) {
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
let insertPos: number;
|
|
281
|
+
let toAdd: string;
|
|
282
|
+
if (providersArray.elements.length === 0) {
|
|
283
|
+
// Empty providers: inject the item directly between [].
|
|
284
|
+
insertPos = providersArray.getEnd() - 1;
|
|
285
|
+
toAdd = zoneProvider;
|
|
286
|
+
} else {
|
|
287
|
+
// Non-empty providers: append after last provider, preserving line formatting when possible.
|
|
288
|
+
const lastProvider = providersArray.elements[providersArray.elements.length - 1];
|
|
289
|
+
insertPos = lastProvider.getEnd();
|
|
290
|
+
const lastProviderText = lastProvider.getFullText(source);
|
|
291
|
+
const newLineMatch = lastProviderText.match(/^\r?\n(\r?)\s+/);
|
|
292
|
+
if (newLineMatch) {
|
|
293
|
+
toAdd = `,${newLineMatch[0]}${zoneProvider}`;
|
|
294
|
+
} else {
|
|
295
|
+
toAdd = `, ${zoneProvider}`;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// Apply the computed insertion at the exact Abstract Syntax Tree-derived position.
|
|
300
|
+
const recorder = host.beginUpdate(appmodule);
|
|
301
|
+
recorder.insertLeft(insertPos, toAdd);
|
|
302
|
+
host.commitUpdate(recorder);
|
|
303
|
+
}
|
|
304
|
+
|
|
@@ -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>
|
|
@@ -10,13 +10,14 @@
|
|
|
10
10
|
default: %>
|
|
11
11
|
|
|
12
12
|
<div>
|
|
13
|
+
<% if(ctrl.props.is_table_child){ %>
|
|
14
|
+
@if (mg.isRowInRowEditing(row)) {
|
|
15
|
+
<% } %>
|
|
13
16
|
<mat-form-field
|
|
14
17
|
<% if (ctrl.props.show_zoom_button ){ %>
|
|
15
18
|
style="width: 65%"
|
|
16
19
|
<% } %>
|
|
17
20
|
<%- include(`../../attributes/common/container_attributes`, {ctrl : ctrl}) %>
|
|
18
|
-
<% if(ctrl.props.is_table_child){ %>
|
|
19
|
-
*ngIf="mg.isRowInRowEditing(row)" <%}%>
|
|
20
21
|
>
|
|
21
22
|
<div>
|
|
22
23
|
|
|
@@ -47,10 +48,6 @@ default: %>
|
|
|
47
48
|
<% } else { %>
|
|
48
49
|
|
|
49
50
|
<input
|
|
50
|
-
<% if(ctrl.props.is_table_child){ %>
|
|
51
|
-
*ngIf="mg.isRowInRowEditing(row)"
|
|
52
|
-
<%}%>
|
|
53
|
-
|
|
54
51
|
matInput
|
|
55
52
|
<% if (ctrl.props.attribute == StorageAttributeType.Numeric) { %>
|
|
56
53
|
<% if (ctrl.props.currency) { %>
|
|
@@ -93,25 +90,26 @@ default: %>
|
|
|
93
90
|
<% if (ctrl.props.auto_complete_mode) { %>
|
|
94
91
|
<mat-autocomplete #<%- ctrl.props.id %>="matAutocomplete"
|
|
95
92
|
<%- include('../../attributes/common/base/id', {ctrl : ctrl}) %>>
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
[value]="o.displayValue"
|
|
100
|
-
>
|
|
93
|
+
@for (o of mg.getFilteredList(<%- ctrl.props.enum_id %><% if(ctrl.props.is_table_child){ %>, row.rowId<%}%>); track $index) {
|
|
94
|
+
<mat-option [value]="o.displayValue">
|
|
101
95
|
{{o.displayValue}}
|
|
102
96
|
</mat-option>
|
|
97
|
+
}
|
|
103
98
|
</mat-autocomplete>
|
|
104
99
|
<% } %>
|
|
105
100
|
</div>
|
|
106
101
|
|
|
107
102
|
</mat-form-field>
|
|
103
|
+
<% if(ctrl.props.is_table_child){ %>
|
|
104
|
+
}
|
|
105
|
+
<% } %>
|
|
108
106
|
|
|
109
107
|
<% if(ctrl.props.is_table_child){ %>
|
|
108
|
+
@if (!mg.isRowInRowEditing(row)) {
|
|
110
109
|
<label
|
|
111
110
|
<% if (ctrl.props.show_zoom_button ){ %>
|
|
112
111
|
style="width: 65%"
|
|
113
112
|
<% } %>
|
|
114
|
-
*ngIf="!mg.isRowInRowEditing(row)"
|
|
115
113
|
<%- include('../../attributes/common/base_attributes', {ctrl : ctrl}) %>>
|
|
116
114
|
<% if (ctrl.props.currency) { %>
|
|
117
115
|
{{mg.getFormattedValue(<%- ctrl.props.enum_id %><% if(ctrl.props.is_table_child){ %>, row.rowId<%}%>)
|
|
@@ -122,6 +120,7 @@ default: %>
|
|
|
122
120
|
<%}%>
|
|
123
121
|
|
|
124
122
|
</label>
|
|
123
|
+
}
|
|
125
124
|
<%}%>
|
|
126
125
|
<%- include('./zoom-button.ejs', {ctrl : ctrl}) %>
|
|
127
126
|
</div>
|
|
@@ -129,6 +128,9 @@ default: %>
|
|
|
129
128
|
|
|
130
129
|
case StorageAttributeType.Date: %>
|
|
131
130
|
<div>
|
|
131
|
+
<% if(ctrl.props.is_table_child){ %>
|
|
132
|
+
@if (mg.isRowInRowEditing(row)) {
|
|
133
|
+
<%}%>
|
|
132
134
|
<mat-form-field
|
|
133
135
|
<% if (ctrl.props.show_zoom_button ){ %>
|
|
134
136
|
style="width: 65%"
|
|
@@ -136,9 +138,6 @@ case StorageAttributeType.Date: %>
|
|
|
136
138
|
<%- include(`../../attributes/common/container_attributes`, {ctrl : ctrl}) %>
|
|
137
139
|
<%- include('../../attributes/common/base/id', {ctrl : ctrl}) %>
|
|
138
140
|
[eventsOnly]=true
|
|
139
|
-
<% if(ctrl.props.is_table_child){ %>
|
|
140
|
-
*ngIf="mg.isRowInRowEditing(row)"
|
|
141
|
-
<%}%>
|
|
142
141
|
>
|
|
143
142
|
|
|
144
143
|
<% if(ctrl.props.is_table_child){ %>
|
|
@@ -154,35 +153,40 @@ case StorageAttributeType.Date: %>
|
|
|
154
153
|
<%- ctrl.props.validator %>
|
|
155
154
|
<% } %>
|
|
156
155
|
>
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
156
|
+
<% if ( child.props.is_table_child ) {%>
|
|
157
|
+
@if (!mg.checkIsReadOnly(<%- ctrl.props.enum_id %>) && mg.isRowInRowEditing(row)) {
|
|
158
|
+
<mat-datepicker-toggle matSuffix [for]="<%- ctrl.props.id %>">
|
|
159
|
+
</mat-datepicker-toggle>
|
|
160
|
+
}
|
|
161
|
+
<%} else { %>
|
|
162
|
+
@if (!mg.checkIsReadOnly(<%- ctrl.props.enum_id %>)) {
|
|
163
|
+
<mat-datepicker-toggle matSuffix [for]="<%- ctrl.props.id %>">
|
|
164
|
+
</mat-datepicker-toggle>
|
|
165
|
+
}
|
|
166
|
+
<%}%>
|
|
167
167
|
<mat-datepicker #<%- ctrl.props.id %>></mat-datepicker>
|
|
168
168
|
|
|
169
169
|
<% if(ctrl.props.is_table_child){ %>
|
|
170
170
|
</div>
|
|
171
171
|
<%}%>
|
|
172
172
|
</mat-form-field>
|
|
173
|
+
<% if(ctrl.props.is_table_child){ %>
|
|
174
|
+
}
|
|
175
|
+
<%}%>
|
|
173
176
|
<%- include('./zoom-button.ejs', {ctrl : ctrl}) %>
|
|
174
177
|
|
|
175
178
|
</div>
|
|
176
179
|
<% if(ctrl.props.is_table_child){ %>
|
|
180
|
+
@if (!mg.isRowInRowEditing(row)) {
|
|
177
181
|
<label
|
|
178
182
|
<% if (ctrl.props.show_zoom_button ){ %>
|
|
179
183
|
style="width: 65%"
|
|
180
184
|
<% } %>
|
|
181
|
-
*ngIf="!mg.isRowInRowEditing(row)"
|
|
182
185
|
<%- include('../../attributes/common/base_attributes', {ctrl : ctrl}) %>>
|
|
183
186
|
{{mg.getValue(<%- ctrl.props.enum_id %><% if(ctrl.props.is_table_child){ %>, row.rowId<%}%>)
|
|
184
187
|
<% if (ctrl.props.formatter) { %>| <%- ctrl.props.formatter %> : <%- ctrl.props.enum_id %><%}%>}}
|
|
185
188
|
</label>
|
|
189
|
+
}
|
|
186
190
|
<%}%>
|
|
187
191
|
|
|
188
192
|
<% if(ctrl.props.validator){ %>
|
|
@@ -9,12 +9,11 @@
|
|
|
9
9
|
<%- include('../../attributes/common/base/enabled', {ctrl : ctrl}) %>
|
|
10
10
|
>
|
|
11
11
|
<%# build of items in listbox %>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
[value] = "o.index"
|
|
15
|
-
>
|
|
12
|
+
@for (o of mg.getItemListValues(<%-ctrl.props.enum_id%>); track $index) {
|
|
13
|
+
<mat-list-option [value] = "o.index">
|
|
16
14
|
{{o.displayValue}}
|
|
17
15
|
</mat-list-option>
|
|
16
|
+
}
|
|
18
17
|
</mat-selection-list>
|
|
19
18
|
<% if (ctrl.props.must_input || ctrl.props.validator != null) {%>
|
|
20
19
|
<mgError [magic]=<%- ctrl.props.directive_id %>> </mgError>
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
required
|
|
10
10
|
<% } %>
|
|
11
11
|
>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
[value] = "o.index" >
|
|
12
|
+
@for (o of mg.getItemListValues(<%- ctrl.props.enum_id %>); track $index) {
|
|
13
|
+
<mat-radio-button [value] = "o.index" >
|
|
15
14
|
{{o.displayValue}}
|
|
16
15
|
</mat-radio-button >
|
|
16
|
+
}
|
|
17
17
|
|
|
18
18
|
</mat-radio-group>
|
|
19
19
|
|
|
@@ -5,13 +5,15 @@
|
|
|
5
5
|
[selectedIndex]="mg.getTabSelectedIndex(<%- ctrl.props.enum_id %>)"
|
|
6
6
|
>
|
|
7
7
|
<%# extra div to add the tab style%>
|
|
8
|
-
|
|
8
|
+
@for (o of mg.getItemListValues(<%- ctrl.props.enum_id %>); track $index) {
|
|
9
|
+
<mat-tab
|
|
9
10
|
<% if (ctrl.props.enabled){ %>
|
|
10
11
|
[disabled]="mg.isDisabled(<%- ctrl.props.enum_id %>)"
|
|
11
12
|
<% } %>
|
|
12
13
|
[label]="mg.getTabpageText(<%- ctrl.props.enum_id %>, o.index)"
|
|
13
14
|
>
|
|
14
15
|
</mat-tab>
|
|
16
|
+
}
|
|
15
17
|
</mat-tab-group>
|
|
16
18
|
<%# add tab pages after adding the buttons, so the buttons are at the top%>
|
|
17
19
|
<%- include(`../container`, {child: ctrl}) %>
|
|
@@ -19,8 +19,10 @@
|
|
|
19
19
|
<% ctrl.children.forEach(child =>{ %>
|
|
20
20
|
<% child.props.no_modifiable_descendants = ctrl.props.no_modifiable_descendants; %>
|
|
21
21
|
<%})} %>
|
|
22
|
-
|
|
23
|
-
<
|
|
22
|
+
@for (row of task.Records.list; track $index) {
|
|
23
|
+
<ng-container>
|
|
24
|
+
@if (mg.ifRowCreated(row) && !mg.isDataviewEmpty()) {
|
|
25
|
+
<tr id="row"
|
|
24
26
|
<%if (typeof ctrl.props.no_modifiable_descendants === "undefined") {%>
|
|
25
27
|
[formGroup]="mg.getFormGroupByRow(row.rowId)"
|
|
26
28
|
<%}%>
|
|
@@ -32,6 +34,8 @@
|
|
|
32
34
|
>
|
|
33
35
|
<%- include(`../../container`, {ctrl: ctrl}) %>
|
|
34
36
|
</tr>
|
|
35
|
-
|
|
37
|
+
}
|
|
38
|
+
</ng-container>
|
|
39
|
+
}
|
|
36
40
|
</table>
|
|
37
41
|
</div>
|
|
@@ -9,8 +9,10 @@
|
|
|
9
9
|
[scrollWindow]="false"
|
|
10
10
|
<%}%>
|
|
11
11
|
>
|
|
12
|
-
|
|
13
|
-
<div
|
|
12
|
+
@for (row of task.Records.list; track $index) {
|
|
13
|
+
<div>
|
|
14
|
+
@if (mg.ifRowCreated(row) && !mg.isDataviewEmpty()) {
|
|
15
|
+
<div id="row"
|
|
14
16
|
<% if(magicConfig.allow_testing) { %>
|
|
15
17
|
MgControlType="MgRow"
|
|
16
18
|
<% } %>
|
|
@@ -24,5 +26,7 @@
|
|
|
24
26
|
[magicRow]="row?.rowId">
|
|
25
27
|
<%- include(`../../container`, {ctrl: ctrl}) %>
|
|
26
28
|
</div>
|
|
27
|
-
|
|
29
|
+
}
|
|
30
|
+
</div>
|
|
31
|
+
}
|
|
28
32
|
</div>
|
|
File without changes
|
|
File without changes
|