@magic-xpa/cli 4.1100.0-dev4110.12 → 4.1100.0-dev4110.124

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/README.md +28 -28
  2. package/index.js.map +1 -1
  3. package/index.ts +1 -1
  4. package/package.json +2 -2
  5. package/src/collection.json +75 -75
  6. package/src/public_api.js.map +1 -1
  7. package/src/public_api.ts +5 -5
  8. package/src/schematics/magic-utils/config.js.map +1 -1
  9. package/src/schematics/magic-utils/config.ts +68 -68
  10. package/src/schematics/magic-utils/env.js.map +1 -1
  11. package/src/schematics/magic-utils/env.ts +50 -50
  12. package/src/schematics/magic-utils/manifest.js.map +1 -1
  13. package/src/schematics/magic-utils/manifest.ts +46 -46
  14. package/src/schematics/magic-utils/metadata.class.js.map +1 -1
  15. package/src/schematics/magic-utils/metadata.class.ts +159 -159
  16. package/src/schematics/magic-utils/rules/build-view.rule.js +3 -0
  17. package/src/schematics/magic-utils/rules/build-view.rule.js.map +1 -1
  18. package/src/schematics/magic-utils/rules/build-view.rule.ts +4 -0
  19. package/src/schematics/magic-utils/rules/generate.rule.js.map +1 -1
  20. package/src/schematics/magic-utils/rules/generate.rule.ts +61 -61
  21. package/src/schematics/magic-utils/rules/init-add-modules.rule.js.map +1 -1
  22. package/src/schematics/magic-utils/rules/init-add-modules.rule.ts +360 -360
  23. package/src/schematics/magic-utils/rules/init-magic-metadata.rule.js.map +1 -1
  24. package/src/schematics/magic-utils/rules/init-magic-metadata.rule.ts +19 -19
  25. package/src/schematics/magic-utils/rules/magic-option.scheme.d.ts +1 -0
  26. package/src/schematics/magic-utils/rules/magic-option.scheme.js.map +1 -1
  27. package/src/schematics/magic-utils/rules/magic-option.scheme.ts +24 -23
  28. package/src/schematics/magic-utils/utils.js.map +1 -1
  29. package/src/schematics/magic-utils/utils.ts +134 -134
  30. package/src/schematics/mg-Install-prerequisites/index.js.map +1 -1
  31. package/src/schematics/mg-Install-prerequisites/index.ts +30 -30
  32. package/src/schematics/mg-Install-prerequisites/schema.json +14 -14
  33. package/src/schematics/mg-add/files/src/app/app.component.html +17 -17
  34. package/src/schematics/mg-add/files/src/app/app.routes.ts +14 -14
  35. package/src/schematics/mg-add/files/src/app/magic/component-list.g.ts +9 -9
  36. package/src/schematics/mg-add/files/src/magic-styles.css +131 -131
  37. package/src/schematics/mg-add/schema.json +29 -29
  38. package/src/schematics/mg-add/utils/add-declaration-to-root-module.js.map +1 -1
  39. package/src/schematics/mg-add/utils/add-declaration-to-root-module.ts +12 -12
  40. package/src/schematics/mg-add/webModule/app.routes.ts +14 -14
  41. package/src/schematics/mg-add-tasks/index.js.map +1 -1
  42. package/src/schematics/mg-add-tasks/index.ts +53 -53
  43. package/src/schematics/mg-add-tasks/schema.json +41 -41
  44. package/src/schematics/mg-delete-files/index.js.map +1 -1
  45. package/src/schematics/mg-delete-files/index.ts +12 -12
  46. package/src/schematics/mg-delete-files/schema.json +14 -14
  47. package/src/schematics/mg-gen-module/index.js.map +1 -1
  48. package/src/schematics/mg-gen-module/index.ts +14 -14
  49. package/src/schematics/mg-gen-module/schema.json +24 -24
  50. package/src/schematics/mg-generate/index.js.map +1 -1
  51. package/src/schematics/mg-generate/index.ts +12 -12
  52. package/src/schematics/mg-generate/schema.json +34 -34
  53. package/src/schematics/mg-generate-component/schema.json +6 -0
  54. package/src/schematics/mg-install/index.js.map +1 -1
  55. package/src/schematics/mg-install/index.ts +37 -37
  56. package/src/schematics/mg-install/schema.json +24 -24
  57. package/src/schematics/mg-routes/schema.json +14 -14
  58. package/src/schematics/mg-single-control/schema.json +24 -24
  59. package/src/schematics/utils/ast.js.map +1 -1
  60. package/src/schematics/utils/ast.ts +103 -103
  61. package/src/schematics/utils/devkit-utils/README.md +1 -1
  62. package/src/schematics/utils/devkit-utils/ast-utils.js.map +1 -1
  63. package/src/schematics/utils/devkit-utils/ast-utils.ts +570 -570
  64. package/src/schematics/utils/devkit-utils/ast-utils_old.js.map +1 -1
  65. package/src/schematics/utils/devkit-utils/ast-utils_old.ts +478 -478
  66. package/src/schematics/utils/devkit-utils/change.js.map +1 -1
  67. package/src/schematics/utils/devkit-utils/change.ts +127 -127
  68. package/src/schematics/utils/devkit-utils/component.js.map +1 -1
  69. package/src/schematics/utils/devkit-utils/component.ts +136 -136
  70. package/src/schematics/utils/devkit-utils/config.js.map +1 -1
  71. package/src/schematics/utils/devkit-utils/config.ts +120 -120
  72. package/src/schematics/utils/devkit-utils/find-module.js.map +1 -1
  73. package/src/schematics/utils/devkit-utils/find-module.ts +108 -108
  74. package/src/schematics/utils/devkit-utils/ng-ast-utils.js.map +1 -1
  75. package/src/schematics/utils/devkit-utils/ng-ast-utils.ts +84 -84
  76. package/src/schematics/utils/devkit-utils/parse-name.js.map +1 -1
  77. package/src/schematics/utils/devkit-utils/parse-name.ts +24 -24
  78. package/src/schematics/utils/devkit-utils/route-utils.js.map +1 -1
  79. package/src/schematics/utils/devkit-utils/route-utils.ts +180 -180
  80. package/src/schematics/utils/devkit-utils/validation.js +1 -1
  81. package/src/schematics/utils/devkit-utils/validation.js.map +1 -1
  82. package/src/schematics/utils/devkit-utils/validation.ts +16 -16
  83. package/src/schematics/utils/html.js.map +1 -1
  84. package/src/schematics/utils/html.ts +63 -63
  85. package/src/schematics/utils/lib-versions.js.map +1 -1
  86. package/src/schematics/utils/lib-versions.ts +3 -3
  87. package/src/schematics/utils/package.js.map +1 -1
  88. package/src/schematics/utils/package.ts +22 -22
  89. package/src/schematics/utils/testing.js.map +1 -1
  90. package/src/schematics/utils/testing.ts +25 -25
  91. package/src/types/enums/Enums.js.map +1 -1
  92. package/src/types/enums/Enums.ts +2063 -2063
  93. package/src/types/enums/generated-file-types.enum.js.map +1 -1
  94. package/src/types/enums/generated-file-types.enum.ts +6 -6
  95. package/src/types/enums/horizontal-alignments.enum.js.map +1 -1
  96. package/src/types/enums/horizontal-alignments.enum.ts +6 -6
  97. package/src/types/enums/themes.enum.js.map +1 -1
  98. package/src/types/enums/themes.enum.ts +6 -6
  99. package/src/types/index.js.map +1 -1
  100. package/src/types/index.ts +8 -8
  101. package/src/types/interfaces/app.js.map +1 -1
  102. package/src/types/interfaces/app.ts +89 -89
  103. package/src/types/interfaces/control.js.map +1 -1
  104. package/src/types/interfaces/control.ts +106 -106
  105. package/src/types/interfaces/template.config.js.map +1 -1
  106. package/src/types/interfaces/template.config.ts +11 -11
  107. package/templates/angular/src/app/app.component.html.ejs +17 -17
  108. package/templates/angular/src/app/cmp-array.ejs +3 -3
  109. package/templates/angular/src/app/cmp-hash.ejs +3 -3
  110. package/templates/angular/src/app/component-list.g.ts +21 -21
  111. package/templates/angular/src/app.component.ts +14 -14
  112. package/templates/angular/src/app.module.ts +70 -70
  113. package/templates/angular/src/app.routes.ts +73 -73
  114. package/templates/angular/src/styles/app.css +5 -5
  115. package/templates/attributes/button_attributes.ejs +2 -2
  116. package/templates/attributes/common/base/class.ejs +6 -6
  117. package/templates/attributes/common/base/control_type.ejs +53 -53
  118. package/templates/attributes/common/base/enabled.ejs +9 -9
  119. package/templates/attributes/common/base/imageFileName.ejs +3 -3
  120. package/templates/attributes/common/base/no_control_class.ejs +3 -3
  121. package/templates/attributes/common/base/rtol.ejs +3 -3
  122. package/templates/attributes/common/base/tabindex.ejs +11 -11
  123. package/templates/attributes/common/base/testingId.ejs +8 -8
  124. package/templates/attributes/common/base/tooltip.ejs +7 -7
  125. package/templates/attributes/common/base/visible.ejs +6 -6
  126. package/templates/attributes/common/base/wallpaper.ejs +3 -3
  127. package/templates/attributes/common/base_attributes.ejs +10 -10
  128. package/templates/attributes/common/container_attributes.ejs +6 -6
  129. package/templates/attributes/common/control_attributes.ejs +3 -3
  130. package/templates/attributes/common/format.ejs +5 -5
  131. package/templates/attributes/common/input/hint.ejs +13 -13
  132. package/templates/attributes/common/input/multiline_edit.ejs +3 -3
  133. package/templates/attributes/common/input/must_input.ejs +8 -8
  134. package/templates/attributes/common/input/password_edit.ejs +7 -7
  135. package/templates/attributes/common/input/row_editing_input_attributes.ejs +6 -6
  136. package/templates/attributes/common/input/validation.ejs +5 -5
  137. package/templates/attributes/common/input_attributes.ejs +4 -4
  138. package/templates/attributes/common/no_control_base_attributes.ejs +4 -4
  139. package/templates/attributes/common/row_editing_button_attributes.ejs +10 -10
  140. package/templates/component/view.component.html +14 -14
  141. package/templates/component/view.component.ts +122 -122
  142. package/templates/themes/basicHTML/Code/theme.module.ts +10 -10
  143. package/templates/themes/basicHTML/combobox.ejs +37 -37
  144. package/templates/themes/basicHTML/edit.ejs +169 -168
  145. package/templates/themes/basicHTML/form.ejs +4 -4
  146. package/templates/themes/basicHTML/group.ejs +4 -4
  147. package/templates/themes/basicHTML/image.ejs +6 -6
  148. package/templates/themes/basicHTML/label.ejs +11 -11
  149. package/templates/themes/basicHTML/listbox.ejs +21 -21
  150. package/templates/themes/basicHTML/push-button.ejs +28 -28
  151. package/templates/themes/basicHTML/radio.ejs +20 -20
  152. package/templates/themes/basicHTML/subform.ejs +6 -6
  153. package/templates/themes/basicHTML/tab.ejs +31 -31
  154. package/templates/themes/basicHTML/tabpage.ejs +5 -5
  155. package/templates/themes/basicHiddenHTML/Code/theme.module.ts +10 -10
  156. package/templates/themes/basicHiddenHTML/combobox.ejs +5 -5
  157. package/templates/themes/basicHiddenHTML/form.ejs +3 -3
  158. package/templates/themes/basicHiddenHTML/group.ejs +2 -2
  159. package/templates/themes/basicHiddenHTML/image.ejs +4 -4
  160. package/templates/themes/basicHiddenHTML/label.ejs +1 -1
  161. package/templates/themes/basicHiddenHTML/listbox.ejs +8 -8
  162. package/templates/themes/basicHiddenHTML/push-button.ejs +26 -26
  163. package/templates/themes/basicHiddenHTML/radio.ejs +17 -17
  164. package/templates/themes/basicHiddenHTML/tab.ejs +13 -13
  165. package/templates/themes/basicHiddenHTML/table.ejs +18 -18
  166. package/templates/themes/basicHiddenHTML/tabpage.ejs +2 -2
  167. package/templates/themes/container.ejs +26 -26
  168. package/templates/themes/control.ejs +52 -52
  169. package/templates/themes/editTypeSelector.ejs +1 -1
  170. package/templates/themes/material/Code/theme.module.ts +68 -68
  171. package/templates/themes/material/base_attributes_date.ejs +8 -8
  172. package/templates/themes/material/combobox.ejs +43 -43
  173. package/templates/themes/material/edit.ejs +204 -204
  174. package/templates/themes/material/group.ejs +3 -3
  175. package/templates/themes/material/listbox.ejs +23 -23
  176. package/templates/themes/material/push-button.ejs +28 -28
  177. package/templates/themes/material/radio.ejs +22 -22
  178. package/templates/themes/material/subform.ejs +8 -8
  179. package/templates/themes/material/tab.ejs +19 -19
  180. package/templates/themes/router_outlet.ejs +5 -5
  181. package/templates/themes/table/HTMLTable/table.ejs +37 -37
  182. package/templates/themes/table/grid/additionalComponentCode.ejs +26 -26
  183. package/templates/themes/table/grid/additionalIncludes.ejs +1 -1
  184. package/templates/themes/table/grid/table.ejs +37 -37
  185. package/templates/themes/table/repeatable/column.ejs +11 -11
  186. package/templates/themes/table/repeatable/table.ejs +28 -28
  187. package/templates/themes/tableTypeSelector.ejs +21 -21
  188. package/tsconfig.json +36 -36
@@ -1 +1 @@
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;YACtB,OAAO,GAAG,IAAI,CAAC,kBAAkB,IAAI,gBAAU,IAAI,WAAW,EAAE,CAAC;SAClE;QAED,OAAO,GAAG,IAAI,CAAC,kBAAkB,IAAI,gBAAU,EAAE,CAAC;IAGpD,CAAC;IAED,uDAAuD;IACvD,kHAAkH;IAClH,uBAAuB,CAAC,WAAkB,EAAE,aAAoB;QAC5D,OAAO,GAAG,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,IAAI,aAAa,EAAE,CAAC;IACrE,CAAC;IAED,uBAAuB,CAAC,WAAkB;QACxC,OAAO,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,CAAC;IAC3B,CAAC;IAED,IAAI,mBAAmB;QACnB,IAAG,IAAI,CAAC,oBAAoB;YAAE,OAAO,IAAI,CAAC,oBAAoB,CAAC;QAC/D,OAAO,IAAI,CAAC,eAAe,EAAE,CAAC;IAClC,CAAC;IAED,IAAI,WAAW;QACb,IAAI,IAAI,CAAC,YAAY;YAAE,OAAO,IAAI,CAAC,YAAY,CAAC;QAChD,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;IAC3B,CAAC;IAED,YAAmB,IAAU,EAAS,OAAyB,EAAS,OAA0B;QAA/E,SAAI,GAAJ,IAAI,CAAM;QAAS,YAAO,GAAP,OAAO,CAAkB;QAAS,YAAO,GAAP,OAAO,CAAmB;QAChG,IAAI,CAAC,KAAK,GAAG,IAAI,UAAU,CAAC,IAAA,kBAAU,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IACjE,CAAC;IAED,UAAU;QACR,IAAI,CAAC,OAAO,GAAG,IAAA,gBAAQ,EAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC1D,OAAO,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}/src/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;YACtB,OAAO,GAAG,IAAI,CAAC,kBAAkB,IAAI,gBAAU,IAAI,WAAW,EAAE,CAAC;SAClE;QAED,OAAO,GAAG,IAAI,CAAC,kBAAkB,IAAI,gBAAU,EAAE,CAAC;IAGpD,CAAC;IAED,uDAAuD;IACvD,kHAAkH;IAClH,uBAAuB,CAAC,WAAkB,EAAE,aAAoB;QAC5D,OAAO,GAAG,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,IAAI,aAAa,EAAE,CAAC;IACrE,CAAC;IAED,uBAAuB,CAAC,WAAkB;QACxC,OAAO,GAAG,IAAI,CAAC,kBAAkB,IAAI,WAAW,OAAO,CAAC;IAC1D,CAAC;IAED,mCAAmC,CAAC,WAAkB,EAAE,WAAkB;QACxE,IAAI,gCAAgC,GAAG,GAAG,WAAW,EAAE,CAAC;QACxD,IAAI,WAAW,KAAK,EAAE;YACpB,gCAAgC,GAAG,GAAG,WAAW,IAAI,WAAW,EAAE,CAAC;QAErE,OAAO,gCAAgC,CAAC;IAC1C,CAAC;IAED,wBAAwB,CAAC,WAAkB;QAEzC,IAAI,WAAW,IAAI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yB,EAAS,OAA0B;QAA/E,SAAI,GAAJ,IAAI,CAAM;QAAS,YAAO,GAAP,OAAO,CAAkB;QAAS,YAAO,GAAP,OAAO,CAAmB;QAChG,IAAI,CAAC,KAAK,GAAG,IAAI,UAAU,CAAC,IAAA,kBAAU,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IACjE,CAAC;IAED,UAAU;QACR,IAAI,CAAC,OAAO,GAAG,IAAA,gBAAQ,EAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC1D,OAAO,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\";\r\nimport { AppConfig, ComponentId, Route, RouteTable } from \"../../types/interfaces/app\";\r\nimport { MagicOptionScheme } from \"./rules/magic-option.scheme\";\r\nimport { Project } from \"../utils/devkit-utils/config\";\r\nimport { env, GEN_FOLDER, METADATA_DIR } from \"./env\";\r\nimport { Manifest } from \"./manifest\";\r\nimport { getProject, readJson } from \"./utils\";\r\n\r\n\r\nexport class MagicPaths {\r\n\r\n // return the current module path\r\n // for example : for module \"WebModule1\" it returns 'src/app/magic/WebModule1'\r\n currentModulePath(module_name:string) {\r\n if (module_name !== \"\") {\r\n return `${this.rootMagicGenFolder}/${GEN_FOLDER}/${module_name}`;\r\n }\r\n\r\n return `${this.rootMagicGenFolder}/${GEN_FOLDER}`;\r\n\r\n\r\n }\r\n\r\n // return the destanation path for create the component\r\n // for example : for module \"WebModule1\" component \"WebModule1/folder1/bb/cc/it returns 'src/app/magic/WebModule1'\r\n getDestPathForComponent(module_name:string, componentPath:string) {\r\n return `${this.currentModulePath(module_name)}/${componentPath}`;\r\n }\r\n\r\n getJsonPathForComponent(cmpJsonPath:string) {\r\n return `${this.metadataFolderPath}/${cmpJsonPath}.json`;\r\n }\r\n\r\n getRelativePathForComponentInModule(module_name:string, cmpJsonPath:string) {\r\n let relativePathForComponentInModule = `${cmpJsonPath}`;\r\n if (module_name !== \"\")\r\n relativePathForComponentInModule = `${module_name}/${cmpJsonPath}`;\r\n\r\n return relativePathForComponentInModule;\r\n }\r\n\r\n getRoutePathForWebModule(module_name:string) {\r\n\r\n if (module_name == \"\")\r\n return this.appRoutesPath;\r\n\r\n return `${this.rootMagicGenFolder}/${GEN_FOLDER}/${module_name}/app.routes.ts`;\r\n }\r\n get rootMagicGenFolder(){ return `./${this.project.root}/src/app`; }\r\n get appComponentPath(){ return `./${this.project.root}/src/app/app.component.html`}\r\n get appRoutesPath(){ return `./${this.project.root}/src/app/app.routes.ts`}\r\n get appModulePath(){ return `./${this.project.root}/src/app/app.module.ts`}\r\n get executionPath(){ return `./${this.project.root}/src/assets/execution.properties`}\r\n get magicStylePath(){ return `./${this.project.root}/src/magic-styles.css`}\r\n get angularJsonPath(){ return `./angular.json`}\r\n get tsConfigAppJsonPath(){ return `./${this.project.root}/tsconfig.app.json`}\r\n\r\n // get the relative path of module to be used in LazyLoadMap\r\n magicGenLibModulePath (moduleName){\r\n\r\n let rootPath = this.project.root == '' ? this.project.root: this.project.root + '/';\r\n let modulepath = rootPath+`src/app/${GEN_FOLDER}`;\r\n if (moduleName !== \"\") {\r\n return `${modulepath}/${moduleName}/magic.gen.lib.module`;\r\n }\r\n return `${modulepath}/magic.gen.lib.module`;\r\n }\r\n\r\n // Files under gen folder\r\n get magicGenFolderPath (){ return `./${this.project.root}/src/app/${GEN_FOLDER}`}\r\n\r\n componentListPathForCurrentModuleName (module_name:string):string{\r\n return `./${this.project.root}/src/app/${GEN_FOLDER}/${module_name}/component-list.g.ts`\r\n }\r\n componentListPath (module_name:string):string{\r\n\r\n if (module_name !== \"\"){\r\n return this.componentListPathForCurrentModuleName(module_name);\r\n }\r\n return this.rootMagicComponentListPath;\r\n }\r\n\r\n get rootMagicComponentListPath (){\r\n\r\n return `./${this.project.root}/src/app/${GEN_FOLDER}/component-list.g.ts`\r\n }\r\n\r\n get magicGenLibModule (){ return `./${this.project.root}/src/app/${GEN_FOLDER}/magic.gen.lib.module.ts`}\r\n\r\n get favIconPath(){ return `./${this.project.root}/src/favicon.ico`; }\r\n\r\n get metadataFolderPath(){ return `./${this.project.root}/${METADATA_DIR}`; }\r\n get manifestPath (){ return `./${this.project.root}/${METADATA_DIR}/manifest.json`; }\r\n get configPath (){ return `./${this.project.root}/${METADATA_DIR}/config.json`; }\r\n get programListPath (){return `./${this.project.root}/${METADATA_DIR}/ProgramsList.json`; }\r\n get routesPath (){ return `./${this.project.root}/${METADATA_DIR}/routes.json`; }\r\n\r\n constructor(protected project:Project){\r\n }\r\n}\r\n\r\n\r\nexport class MagicMetadata {\r\n\r\n private _config: AppConfig;\r\n private _routesTable: RouteTable[];\r\n private _programListContents: any;\r\n\r\n paths: MagicPaths;\r\n\r\n get theme() {\r\n if (!this.options.theme) {\r\n this.options.theme = env.metadata.config ?env.metadata.config.theme : 'basicHTML';\r\n }\r\n return this.options.theme;\r\n }\r\n\r\n get allow_testing() {\r\n if (!this.options.allowTesting) {\r\n this.options.allowTesting = env.metadata.config ?env.metadata.config.allow_testing: false;\r\n }\r\n return this.options.allowTesting;\r\n }\r\n get config() {\r\n if (this._config) return this._config;\r\n return this.loadConfig();\r\n }\r\n\r\n get programListContents(){\r\n if(this._programListContents) return this._programListContents;\r\n return this.loadProgramList();\r\n }\r\n\r\n get routesTable(){\r\n if (this._routesTable) return this._routesTable;\r\n return this.loadRoutes();\r\n }\r\n\r\n constructor(public host: Tree, public context: SchematicContext, public options: MagicOptionScheme) {\r\n this.paths = new MagicPaths(getProject(host, options.project));\r\n }\r\n\r\n loadConfig() {\r\n this._config = readJson(this.host, this.paths.configPath);\r\n return this._config;\r\n }\r\n\r\n loadProgramList(){\r\n this._programListContents = readJson(this.host, this.paths.programListPath);\r\n return this._programListContents;\r\n }\r\n\r\n loadRoutes() {\r\n this._routesTable = readJson(this.host, this.paths.routesPath);\r\n return this._routesTable;\r\n }\r\n}\r\n\r\n\r\n"]}
@@ -1,159 +1,159 @@
1
- import { SchematicContext, Tree } from "@angular-devkit/schematics";
2
- import { AppConfig, ComponentId, Route, RouteTable } from "../../types/interfaces/app";
3
- import { MagicOptionScheme } from "./rules/magic-option.scheme";
4
- import { Project } from "../utils/devkit-utils/config";
5
- import { env, GEN_FOLDER, METADATA_DIR } from "./env";
6
- import { Manifest } from "./manifest";
7
- import { getProject, readJson } from "./utils";
8
-
9
-
10
- export class MagicPaths {
11
-
12
- // return the current module path
13
- // for example : for module "WebModule1" it returns 'src/app/magic/WebModule1'
14
- currentModulePath(module_name:string) {
15
- if (module_name !== "") {
16
- return `${this.rootMagicGenFolder}/${GEN_FOLDER}/${module_name}`;
17
- }
18
-
19
- return `${this.rootMagicGenFolder}/${GEN_FOLDER}`;
20
-
21
-
22
- }
23
-
24
- // return the destanation path for create the component
25
- // for example : for module "WebModule1" component "WebModule1/folder1/bb/cc/it returns 'src/app/magic/WebModule1'
26
- getDestPathForComponent(module_name:string, componentPath:string) {
27
- return `${this.currentModulePath(module_name)}/${componentPath}`;
28
- }
29
-
30
- getJsonPathForComponent(cmpJsonPath:string) {
31
- return `${this.metadataFolderPath}/${cmpJsonPath}.json`;
32
- }
33
-
34
- getRelativePathForComponentInModule(module_name:string, cmpJsonPath:string) {
35
- let relativePathForComponentInModule = `${cmpJsonPath}`;
36
- if (module_name !== "")
37
- relativePathForComponentInModule = `${module_name}/${cmpJsonPath}`;
38
-
39
- return relativePathForComponentInModule;
40
- }
41
-
42
- getRoutePathForWebModule(module_name:string) {
43
-
44
- if (module_name == "")
45
- return this.appRoutesPath;
46
-
47
- return `${this.rootMagicGenFolder}/${GEN_FOLDER}/${module_name}/app.routes.ts`;
48
- }
49
- get rootMagicGenFolder(){ return `./${this.project.root}/src/app`; }
50
- get appComponentPath(){ return `./${this.project.root}/src/app/app.component.html`}
51
- get appRoutesPath(){ return `./${this.project.root}/src/app/app.routes.ts`}
52
- get appModulePath(){ return `./${this.project.root}/src/app/app.module.ts`}
53
- get executionPath(){ return `./${this.project.root}/src/assets/execution.properties`}
54
- get magicStylePath(){ return `./${this.project.root}/src/magic-styles.css`}
55
- get angularJsonPath(){ return `./angular.json`}
56
- get tsConfigAppJsonPath(){ return `./${this.project.root}/tsconfig.app.json`}
57
-
58
- // get the relative path of module to be used in LazyLoadMap
59
- magicGenLibModulePath (moduleName){
60
-
61
- let rootPath = this.project.root == '' ? this.project.root: this.project.root + '/';
62
- let modulepath = rootPath+`src/app/${GEN_FOLDER}`;
63
- if (moduleName !== "") {
64
- return `${modulepath}/${moduleName}/magic.gen.lib.module`;
65
- }
66
- return `${modulepath}/magic.gen.lib.module`;
67
- }
68
-
69
- // Files under gen folder
70
- get magicGenFolderPath (){ return `./${this.project.root}/src/app/${GEN_FOLDER}`}
71
-
72
- componentListPathForCurrentModuleName (module_name:string):string{
73
- return `./${this.project.root}/src/app/${GEN_FOLDER}/${module_name}/component-list.g.ts`
74
- }
75
- componentListPath (module_name:string):string{
76
-
77
- if (module_name !== ""){
78
- return this.componentListPathForCurrentModuleName(module_name);
79
- }
80
- return this.rootMagicComponentListPath;
81
- }
82
-
83
- get rootMagicComponentListPath (){
84
-
85
- return `./${this.project.root}/src/app/${GEN_FOLDER}/component-list.g.ts`
86
- }
87
-
88
- get magicGenLibModule (){ return `./${this.project.root}/src/app/${GEN_FOLDER}/magic.gen.lib.module.ts`}
89
-
90
- get favIconPath(){ return `./${this.project.root}/src/favicon.ico`; }
91
-
92
- get metadataFolderPath(){ return `./${this.project.root}/${METADATA_DIR}`; }
93
- get manifestPath (){ return `./${this.project.root}/${METADATA_DIR}/manifest.json`; }
94
- get configPath (){ return `./${this.project.root}/${METADATA_DIR}/config.json`; }
95
- get programListPath (){return `./${this.project.root}/${METADATA_DIR}/ProgramsList.json`; }
96
- get routesPath (){ return `./${this.project.root}/${METADATA_DIR}/routes.json`; }
97
-
98
- constructor(protected project:Project){
99
- }
100
- }
101
-
102
-
103
- export class MagicMetadata {
104
-
105
- private _config: AppConfig;
106
- private _routesTable: RouteTable[];
107
- private _programListContents: any;
108
-
109
- paths: MagicPaths;
110
-
111
- get theme() {
112
- if (!this.options.theme) {
113
- this.options.theme = env.metadata.config ?env.metadata.config.theme : 'basicHTML';
114
- }
115
- return this.options.theme;
116
- }
117
-
118
- get allow_testing() {
119
- if (!this.options.allowTesting) {
120
- this.options.allowTesting = env.metadata.config ?env.metadata.config.allow_testing: false;
121
- }
122
- return this.options.allowTesting;
123
- }
124
- get config() {
125
- if (this._config) return this._config;
126
- return this.loadConfig();
127
- }
128
-
129
- get programListContents(){
130
- if(this._programListContents) return this._programListContents;
131
- return this.loadProgramList();
132
- }
133
-
134
- get routesTable(){
135
- if (this._routesTable) return this._routesTable;
136
- return this.loadRoutes();
137
- }
138
-
139
- constructor(public host: Tree, public context: SchematicContext, public options: MagicOptionScheme) {
140
- this.paths = new MagicPaths(getProject(host, options.project));
141
- }
142
-
143
- loadConfig() {
144
- this._config = readJson(this.host, this.paths.configPath);
145
- return this._config;
146
- }
147
-
148
- loadProgramList(){
149
- this._programListContents = readJson(this.host, this.paths.programListPath);
150
- return this._programListContents;
151
- }
152
-
153
- loadRoutes() {
154
- this._routesTable = readJson(this.host, this.paths.routesPath);
155
- return this._routesTable;
156
- }
157
- }
158
-
159
-
1
+ import { SchematicContext, Tree } from "@angular-devkit/schematics";
2
+ import { AppConfig, ComponentId, Route, RouteTable } from "../../types/interfaces/app";
3
+ import { MagicOptionScheme } from "./rules/magic-option.scheme";
4
+ import { Project } from "../utils/devkit-utils/config";
5
+ import { env, GEN_FOLDER, METADATA_DIR } from "./env";
6
+ import { Manifest } from "./manifest";
7
+ import { getProject, readJson } from "./utils";
8
+
9
+
10
+ export class MagicPaths {
11
+
12
+ // return the current module path
13
+ // for example : for module "WebModule1" it returns 'src/app/magic/WebModule1'
14
+ currentModulePath(module_name:string) {
15
+ if (module_name !== "") {
16
+ return `${this.rootMagicGenFolder}/${GEN_FOLDER}/${module_name}`;
17
+ }
18
+
19
+ return `${this.rootMagicGenFolder}/${GEN_FOLDER}`;
20
+
21
+
22
+ }
23
+
24
+ // return the destanation path for create the component
25
+ // for example : for module "WebModule1" component "WebModule1/folder1/bb/cc/it returns 'src/app/magic/WebModule1'
26
+ getDestPathForComponent(module_name:string, componentPath:string) {
27
+ return `${this.currentModulePath(module_name)}/${componentPath}`;
28
+ }
29
+
30
+ getJsonPathForComponent(cmpJsonPath:string) {
31
+ return `${this.metadataFolderPath}/${cmpJsonPath}.json`;
32
+ }
33
+
34
+ getRelativePathForComponentInModule(module_name:string, cmpJsonPath:string) {
35
+ let relativePathForComponentInModule = `${cmpJsonPath}`;
36
+ if (module_name !== "")
37
+ relativePathForComponentInModule = `${module_name}/${cmpJsonPath}`;
38
+
39
+ return relativePathForComponentInModule;
40
+ }
41
+
42
+ getRoutePathForWebModule(module_name:string) {
43
+
44
+ if (module_name == "")
45
+ return this.appRoutesPath;
46
+
47
+ return `${this.rootMagicGenFolder}/${GEN_FOLDER}/${module_name}/app.routes.ts`;
48
+ }
49
+ get rootMagicGenFolder(){ return `./${this.project.root}/src/app`; }
50
+ get appComponentPath(){ return `./${this.project.root}/src/app/app.component.html`}
51
+ get appRoutesPath(){ return `./${this.project.root}/src/app/app.routes.ts`}
52
+ get appModulePath(){ return `./${this.project.root}/src/app/app.module.ts`}
53
+ get executionPath(){ return `./${this.project.root}/src/assets/execution.properties`}
54
+ get magicStylePath(){ return `./${this.project.root}/src/magic-styles.css`}
55
+ get angularJsonPath(){ return `./angular.json`}
56
+ get tsConfigAppJsonPath(){ return `./${this.project.root}/tsconfig.app.json`}
57
+
58
+ // get the relative path of module to be used in LazyLoadMap
59
+ magicGenLibModulePath (moduleName){
60
+
61
+ let rootPath = this.project.root == '' ? this.project.root: this.project.root + '/';
62
+ let modulepath = rootPath+`src/app/${GEN_FOLDER}`;
63
+ if (moduleName !== "") {
64
+ return `${modulepath}/${moduleName}/magic.gen.lib.module`;
65
+ }
66
+ return `${modulepath}/magic.gen.lib.module`;
67
+ }
68
+
69
+ // Files under gen folder
70
+ get magicGenFolderPath (){ return `./${this.project.root}/src/app/${GEN_FOLDER}`}
71
+
72
+ componentListPathForCurrentModuleName (module_name:string):string{
73
+ return `./${this.project.root}/src/app/${GEN_FOLDER}/${module_name}/component-list.g.ts`
74
+ }
75
+ componentListPath (module_name:string):string{
76
+
77
+ if (module_name !== ""){
78
+ return this.componentListPathForCurrentModuleName(module_name);
79
+ }
80
+ return this.rootMagicComponentListPath;
81
+ }
82
+
83
+ get rootMagicComponentListPath (){
84
+
85
+ return `./${this.project.root}/src/app/${GEN_FOLDER}/component-list.g.ts`
86
+ }
87
+
88
+ get magicGenLibModule (){ return `./${this.project.root}/src/app/${GEN_FOLDER}/magic.gen.lib.module.ts`}
89
+
90
+ get favIconPath(){ return `./${this.project.root}/src/favicon.ico`; }
91
+
92
+ get metadataFolderPath(){ return `./${this.project.root}/${METADATA_DIR}`; }
93
+ get manifestPath (){ return `./${this.project.root}/${METADATA_DIR}/manifest.json`; }
94
+ get configPath (){ return `./${this.project.root}/${METADATA_DIR}/config.json`; }
95
+ get programListPath (){return `./${this.project.root}/${METADATA_DIR}/ProgramsList.json`; }
96
+ get routesPath (){ return `./${this.project.root}/${METADATA_DIR}/routes.json`; }
97
+
98
+ constructor(protected project:Project){
99
+ }
100
+ }
101
+
102
+
103
+ export class MagicMetadata {
104
+
105
+ private _config: AppConfig;
106
+ private _routesTable: RouteTable[];
107
+ private _programListContents: any;
108
+
109
+ paths: MagicPaths;
110
+
111
+ get theme() {
112
+ if (!this.options.theme) {
113
+ this.options.theme = env.metadata.config ?env.metadata.config.theme : 'basicHTML';
114
+ }
115
+ return this.options.theme;
116
+ }
117
+
118
+ get allow_testing() {
119
+ if (!this.options.allowTesting) {
120
+ this.options.allowTesting = env.metadata.config ?env.metadata.config.allow_testing: false;
121
+ }
122
+ return this.options.allowTesting;
123
+ }
124
+ get config() {
125
+ if (this._config) return this._config;
126
+ return this.loadConfig();
127
+ }
128
+
129
+ get programListContents(){
130
+ if(this._programListContents) return this._programListContents;
131
+ return this.loadProgramList();
132
+ }
133
+
134
+ get routesTable(){
135
+ if (this._routesTable) return this._routesTable;
136
+ return this.loadRoutes();
137
+ }
138
+
139
+ constructor(public host: Tree, public context: SchematicContext, public options: MagicOptionScheme) {
140
+ this.paths = new MagicPaths(getProject(host, options.project));
141
+ }
142
+
143
+ loadConfig() {
144
+ this._config = readJson(this.host, this.paths.configPath);
145
+ return this._config;
146
+ }
147
+
148
+ loadProgramList(){
149
+ this._programListContents = readJson(this.host, this.paths.programListPath);
150
+ return this._programListContents;
151
+ }
152
+
153
+ loadRoutes() {
154
+ this._routesTable = readJson(this.host, this.paths.routesPath);
155
+ return this._routesTable;
156
+ }
157
+ }
158
+
159
+
@@ -18,6 +18,9 @@ function buildViews(options, module_name) {
18
18
  const viewId = view.props.id;
19
19
  const dest = metadata.paths.getDestPathForComponent(module_name, view.props.component_path);
20
20
  (0, Util_1.LogLn)(`[>] generate component ${viewId}`);
21
+ //Setting controls_accessor_only property of metadata.config as true to generate HELPER (__.mg.controls.g.ts) file
22
+ if (options.controlsaccessoronly === true)
23
+ metadata.config.controls_accessor_only = true;
21
24
  const data = {
22
25
  MgControlType: index_1.MgControlType,
23
26
  theme: metadata.theme,
@@ -1 +1 @@
1
- {"version":3,"file":"build-view.rule.js","sourceRoot":"","sources":["build-view.rule.ts"],"names":[],"mappings":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A+EC","sourcesContent":["//import * as _ from \"lodash\";\r\n\r\nimport { MagicOptionScheme } from \"./magic-option.scheme\";\r\nimport { chain, Rule, SchematicContext, Tree } from \"@angular-devkit/schematics\";\r\nimport {\r\n CtrlButtonTypeGui,\r\n GeneratedFileTypes,\r\n MgControlType,\r\n SideType,\r\n StorageAttributeType,\r\n TableWebStyle,\r\n RowEditingTypes,\r\n TemplateConfig,\r\n WindowPosition,\r\n WindowType\r\n} from \"../../../types/index\";\r\nimport { LogLn, Util } from \"../Util\";\r\nimport { generate } from \"./generate.rule\";\r\nimport { env, GEN_FOLDER } from \"../env\";\r\n\r\nexport function buildViews(options:MagicOptionScheme, module_name:string) : Rule {\r\n return (host:Tree, context: SchematicContext)=>{\r\n const metadata = env.metadata;\r\n const views = env.app.views;\r\n let rules:Rule[] = [];\r\n\r\n //console.log(`Number of components to generate: ${views.length}`);\r\n\r\n LogLn(`*** Step 3: generate components. (${views.length} components) ***`);\r\n views.forEach( view => {\r\n const viewId = view.props.id;\r\n const dest = metadata.paths.getDestPathForComponent(module_name, view.props.component_path);\r\n\r\n LogLn(`[>] generate component ${viewId}`);\r\n\r\n const data = {\r\n MgControlType : MgControlType,\r\n theme : metadata.theme,\r\n CtrlButtonTypeGui : CtrlButtonTypeGui,\r\n SideType : SideType,\r\n StorageAttributeType: StorageAttributeType,\r\n TableWebStyle : TableWebStyle,\r\n RowEditingTypes : RowEditingTypes,\r\n WindowType : WindowType,\r\n WindowPosition : WindowPosition,\r\n Util : Util,\r\n ctrl : view,\r\n app : env.app,\r\n //_ : _,\r\n magicConfig : metadata.config,\r\n };\r\n const componentFiles: TemplateConfig[] = [\r\n {\r\n type: GeneratedFileTypes.HELPER,\r\n template: './templates/component/mg.accessor.ts',\r\n destination: dest,\r\n name: `${viewId}.mg.controls.g.ts`,\r\n data: data\r\n },\r\n {\r\n type: GeneratedFileTypes.TS,\r\n template: './templates/component/view.component.ts',\r\n destination: dest,\r\n name: `${viewId}.component.ts`,\r\n data: data\r\n },\r\n {\r\n type: GeneratedFileTypes.HTML,\r\n template: './templates/component/view.component.html',\r\n destination: dest,\r\n name: `${viewId}.component.html`,\r\n data: data\r\n },\r\n ];\r\n componentFiles.forEach( templateConfig => {\r\n if(shouldGenerateFileType(templateConfig))\r\n rules.push(generate(templateConfig,options));\r\n });\r\n });\r\n\r\n //console.log(`Number of generate rules: ${rules.length}`);\r\n\r\n return chain(rules)(host,context);\r\n }\r\n\r\n // check if the specified template should be used in generation, enables blocking\r\n // generation according to specified flags\r\n function shouldGenerateFileType(templateConfig): boolean{\r\n if(env.metadata.config.no_controls_accessor && templateConfig.type === GeneratedFileTypes.HELPER)\r\n return false;\r\n\r\n if(!env.metadata.config.controls_accessor_only)\r\n return true;\r\n\r\n if(templateConfig.type === GeneratedFileTypes.HELPER)\r\n return true;\r\n\r\n return false;\r\n }\r\n}\r\n\r\n"]}
1
+ {"version":3,"file":"build-view.rule.js","sourceRoot":"","sources":["build-view.rule.ts"],"names":[],"mappings":";AAAA,8BAA8B;;;AAG9B,2DAAiF;AACjF,gDAW8B;AAC9B,kCAAsC;AACtC,mDAA2C;AAC3C,gCAAyC;AAEzC,SAAgB,UAAU,CAAC,OAAyB,EAAE,WAAkB;IACtE,OAAO,CAAC,IAAS,EAAE,OAAyB,EAAC,EAAE;QAC7C,MAAM,QAAQ,GAAG,SAAG,CAAC,QAAQ,CAAC;QAC9B,MAAM,KAAK,GAAM,SAAG,CAAC,GAAG,CAAC,KAAK,CAAC;QAC/B,IAAI,KAAK,GAAU,EAAE,CAAC;QAEtB,mEAAmE;QAEnE,IAAA,YAAK,EAAC,qCAAqC,KAAK,CAAC,MAAM,kBAAkB,CAAC,CAAC;QAC3E,KAAK,CAAC,OAAO,CAAE,IAAI,CAAC,EAAE;YACpB,MAAM,MAAM,GAAK,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/B,MAAM,IAAI,GAAO,QAAQ,CAAC,KAAK,CAAC,uBAAuB,CAAC,WAAW,EAAE,IAAI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AAE,cAAc,CAAC,EAAE;gBACvC,IAAG,sBAAsB,CAAC,cAAc,CAAC;oBACvC,KAAK,CAAC,IAAI,CAAC,IAAA,wBAAQ,EAAC,cAAc,EAAC,OAAO,CAAC,CAAC,CAAC;YACjD,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,2DAA2D;QAE3D,OAAO,IAAA,kBAAK,EAAC,KAAK,CAAC,CAAC,IAAI,EAAC,OAAO,CAAC,CAAC;IACpC,CAAC,CAAA;IAED,iFAAiF;IACjF,0CAA0C;IAC1C,SAAS,sBAAsB,CAAC,cAAc;QAC5C,IAAG,SAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,oBAAoB,IAAI,cAAc,CAAC,IAAI,KAAK,0BAAkB,CAAC,MAAM;YAC9F,OAAO,KAAK,CAAC;QAEf,IAAG,CAAC,SAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,sBAAsB;YAC5C,OAAO,IAAI,CAAC;QAEd,IAAG,cAAc,CAAC,IAAI,KAAK,0BAAkB,CAAC,MAAM;YAClD,OAAO,IAAI,CAAC;QAEd,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAnFD,gCAmFC","sourcesContent":["//import * as _ from \"lodash\";\r\n\r\nimport { MagicOptionScheme } from \"./magic-option.scheme\";\r\nimport { chain, Rule, SchematicContext, Tree } from \"@angular-devkit/schematics\";\r\nimport {\r\n CtrlButtonTypeGui,\r\n GeneratedFileTypes,\r\n MgControlType,\r\n SideType,\r\n StorageAttributeType,\r\n TableWebStyle,\r\n RowEditingTypes,\r\n TemplateConfig,\r\n WindowPosition,\r\n WindowType\r\n} from \"../../../types/index\";\r\nimport { LogLn, Util } from \"../Util\";\r\nimport { generate } from \"./generate.rule\";\r\nimport { env, GEN_FOLDER } from \"../env\";\r\n\r\nexport function buildViews(options:MagicOptionScheme, module_name:string) : Rule {\r\n return (host:Tree, context: SchematicContext)=>{\r\n const metadata = env.metadata;\r\n const views = env.app.views;\r\n let rules:Rule[] = [];\r\n\r\n //console.log(`Number of components to generate: ${views.length}`);\r\n\r\n LogLn(`*** Step 3: generate components. (${views.length} components) ***`);\r\n views.forEach( view => {\r\n const viewId = view.props.id;\r\n const dest = metadata.paths.getDestPathForComponent(module_name, view.props.component_path);\r\n\r\n LogLn(`[>] generate component ${viewId}`);\r\n\r\n //Setting controls_accessor_only property of metadata.config as true to generate HELPER (__.mg.controls.g.ts) file\r\n if(options.controlsaccessoronly === true)\r\n metadata.config.controls_accessor_only = true;\r\n\r\n const data = {\r\n MgControlType : MgControlType,\r\n theme : metadata.theme,\r\n CtrlButtonTypeGui : CtrlButtonTypeGui,\r\n SideType : SideType,\r\n StorageAttributeType: StorageAttributeType,\r\n TableWebStyle : TableWebStyle,\r\n RowEditingTypes : RowEditingTypes,\r\n WindowType : WindowType,\r\n WindowPosition : WindowPosition,\r\n Util : Util,\r\n ctrl : view,\r\n app : env.app,\r\n //_ : _,\r\n magicConfig : metadata.config,\r\n };\r\n const componentFiles: TemplateConfig[] = [\r\n {\r\n type: GeneratedFileTypes.HELPER,\r\n template: './templates/component/mg.accessor.ts',\r\n destination: dest,\r\n name: `${viewId}.mg.controls.g.ts`,\r\n data: data\r\n },\r\n {\r\n type: GeneratedFileTypes.TS,\r\n template: './templates/component/view.component.ts',\r\n destination: dest,\r\n name: `${viewId}.component.ts`,\r\n data: data\r\n },\r\n {\r\n type: GeneratedFileTypes.HTML,\r\n template: './templates/component/view.component.html',\r\n destination: dest,\r\n name: `${viewId}.component.html`,\r\n data: data\r\n },\r\n ];\r\n componentFiles.forEach( templateConfig => {\r\n if(shouldGenerateFileType(templateConfig))\r\n rules.push(generate(templateConfig,options));\r\n });\r\n });\r\n\r\n //console.log(`Number of generate rules: ${rules.length}`);\r\n\r\n return chain(rules)(host,context);\r\n }\r\n\r\n // check if the specified template should be used in generation, enables blocking\r\n // generation according to specified flags\r\n function shouldGenerateFileType(templateConfig): boolean{\r\n if(env.metadata.config.no_controls_accessor && templateConfig.type === GeneratedFileTypes.HELPER)\r\n return false;\r\n\r\n if(!env.metadata.config.controls_accessor_only)\r\n return true;\r\n\r\n if(templateConfig.type === GeneratedFileTypes.HELPER)\r\n return true;\r\n\r\n return false;\r\n }\r\n}\r\n\r\n"]}
@@ -33,6 +33,10 @@ export function buildViews(options:MagicOptionScheme, module_name:string) : Rule
33
33
 
34
34
  LogLn(`[>] generate component ${viewId}`);
35
35
 
36
+ //Setting controls_accessor_only property of metadata.config as true to generate HELPER (__.mg.controls.g.ts) file
37
+ if(options.controlsaccessoronly === true)
38
+ metadata.config.controls_accessor_only = true;
39
+
36
40
  const data = {
37
41
  MgControlType : MgControlType,
38
42
  theme : metadata.theme,
@@ -1 +1 @@
1
- {"version":3,"file":"generate.rule.js","sourceRoot":"","sources":["generate.rule.ts"],"names":[],"mappings":";;;AAAA,2BAAmC;AACnC,0CAA0C;AAC1C,0CAA2C;AAI3C,kCAAiC;AACjC,gCAA0C;AAC1C,0CAAoE;AAIpE,SAAgB,cAAc,CAAC,MAAe,EAAC,IAAwB;IACrE,MAAM,MAAM,GAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE;QACjD,uBAAuB,EAAE,CAAC;QAC1B,kBAAkB,EAAO,CAAC;QAC1B,iBAAiB,EAAQ,wBAAwB;QAChD,aAAa,EAAG,0BAA0B;KAC5C,CAAC,CAAC;IAEH,MAAM,KAAK,GAAG;QACZ,CAAC,0BAAkB,CAAC,IAAI,CAAC,EAAE,MAAM;QACjC,gFAAgF;QAChF,CAAC,0BAAkB,CAAC,EAAE,CAAC,EAAI,UAAU,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,EAAC,aAAa,EAAG,0BAA0B,EAAC,CAAC;QACzG,CAAC,0BAAkB,CAAC,MAAM,CAAC,EAAI,UAAU,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC;QACnE,CAAC,0BAAkB,CAAC,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,4BA6BC","sourcesContent":["import * as EJS from \"ejs\";\n//import * as prettier from \"prettier\";\nimport * as jsbeautify from \"js-beautify\";\n\nimport { Rule, SchematicContext, Tree } from \"@angular-devkit/schematics\";\n\nimport { logErr } from \"../Util\";\nimport { MAGIC_CLI_FOLDER } from \"../env\";\nimport { GeneratedFileTypes, TemplateConfig } from \"../../../types\";\nimport { MagicOptionScheme } from \"./magic-option.scheme\";\nimport { prettierConfig } from \"../config\";\n\nexport function createGenFuncs(output : string,type: GeneratedFileTypes ) {\n const htmlFn = jsbeautify.html.bind(this, output, {\n \"max_preserve_newlines\": 0,\n \"wrap_line_length\" : 0,\n \"wrap_attributes\" : \"force-expand-multiline\",\n \"brace_style\" : 'collapse,preserve-inline'\n });\n\n const fnMap = {\n [GeneratedFileTypes.HTML]: htmlFn,\n //[GeneratedFileTypes.TS] : prettier.format.bind(this, output, prettierConfig),\n [GeneratedFileTypes.TS] : jsbeautify.js.bind(this, output, {\"brace_style\" : 'collapse,preserve-inline'}),\n [GeneratedFileTypes.HELPER] : jsbeautify.js.bind(this, output, {}),\n [GeneratedFileTypes.CSS] : jsbeautify.css.bind(this, output, { })\n };\n\n return fnMap[type]();\n}\n\nexport function generate(file: TemplateConfig,options:MagicOptionScheme) :Rule{\n return (host:Tree, context: SchematicContext) => {\n EJS.renderFile(\n `${MAGIC_CLI_FOLDER}/${file.template}`,\n file.data,\n {\"rmWhitespace\" : true},\n (err, output) => {\n if (err) { logErr(err); return }\n\n try {\n //if(file.type != GeneratedFileTypes.TS) {\n output = createGenFuncs(output, file.type);\n //}\n\n let path = `${file.destination}/${file.name}`;\n\n if(host.exists(path)){\n host.overwrite(`${file.destination}/${file.name}`, output)\n } else{\n host.create(`${file.destination}/${file.name}`, output);\n }\n }\n catch (err) {\n logErr(output);\n logErr(err);\n }\n });\n return host;\n }\n}\n"]}
1
+ {"version":3,"file":"generate.rule.js","sourceRoot":"","sources":["generate.rule.ts"],"names":[],"mappings":";;;AAAA,2BAAmC;AACn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,OAAM;aAAE;YAEhC,IAAI;gBACF,0CAA0C;gBACxC,MAAM,GAAG,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC7C,GAAG;gBAEH,IAAI,IAAI,GAAG,GAAG,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;gBAE9C,IAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAC;oBACnB,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,CAAA;iBAC3D;qBAAK;oBACJ,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC;iBACzD;aACF;YACD,OAAO,GAAG,EAAE;gBACV,IAAA,aAAM,EAAC,MAAM,CAAC,CAAC;gBACf,IAAA,aAAM,EAAC,GAAG,CAAC,CAAC;aACb;QACH,CAAC,CAAC,CAAC;QACL,OAAO,IAAI,CAAC;IACd,CAAC,CAAA;AACH,CAAC;AA7BD,4BA6BC","sourcesContent":["import * as EJS from \"ejs\";\r\n//import * as prettier from \"prettier\";\r\nimport * as jsbeautify from \"js-beautify\";\r\n\r\nimport { Rule, SchematicContext, Tree } from \"@angular-devkit/schematics\";\r\n\r\nimport { logErr } from \"../Util\";\r\nimport { MAGIC_CLI_FOLDER } from \"../env\";\r\nimport { GeneratedFileTypes, TemplateConfig } from \"../../../types\";\r\nimport { MagicOptionScheme } from \"./magic-option.scheme\";\r\nimport { prettierConfig } from \"../config\";\r\n\r\nexport function createGenFuncs(output : string,type: GeneratedFileTypes ) {\r\n const htmlFn = jsbeautify.html.bind(this, output, {\r\n \"max_preserve_newlines\": 0,\r\n \"wrap_line_length\" : 0,\r\n \"wrap_attributes\" : \"force-expand-multiline\",\r\n \"brace_style\" : 'collapse,preserve-inline'\r\n });\r\n\r\n const fnMap = {\r\n [GeneratedFileTypes.HTML]: htmlFn,\r\n //[GeneratedFileTypes.TS] : prettier.format.bind(this, output, prettierConfig),\r\n [GeneratedFileTypes.TS] : jsbeautify.js.bind(this, output, {\"brace_style\" : 'collapse,preserve-inline'}),\r\n [GeneratedFileTypes.HELPER] : jsbeautify.js.bind(this, output, {}),\r\n [GeneratedFileTypes.CSS] : jsbeautify.css.bind(this, output, { })\r\n };\r\n\r\n return fnMap[type]();\r\n}\r\n\r\nexport function generate(file: TemplateConfig,options:MagicOptionScheme) :Rule{\r\n return (host:Tree, context: SchematicContext) => {\r\n EJS.renderFile(\r\n `${MAGIC_CLI_FOLDER}/${file.template}`,\r\n file.data,\r\n {\"rmWhitespace\" : true},\r\n (err, output) => {\r\n if (err) { logErr(err); return }\r\n\r\n try {\r\n //if(file.type != GeneratedFileTypes.TS) {\r\n output = createGenFuncs(output, file.type);\r\n //}\r\n\r\n let path = `${file.destination}/${file.name}`;\r\n\r\n if(host.exists(path)){\r\n host.overwrite(`${file.destination}/${file.name}`, output)\r\n } else{\r\n host.create(`${file.destination}/${file.name}`, output);\r\n }\r\n }\r\n catch (err) {\r\n logErr(output);\r\n logErr(err);\r\n }\r\n });\r\n return host;\r\n }\r\n}\r\n"]}
@@ -1,61 +1,61 @@
1
- import * as EJS from "ejs";
2
- //import * as prettier from "prettier";
3
- import * as jsbeautify from "js-beautify";
4
-
5
- import { Rule, SchematicContext, Tree } from "@angular-devkit/schematics";
6
-
7
- import { logErr } from "../Util";
8
- import { MAGIC_CLI_FOLDER } from "../env";
9
- import { GeneratedFileTypes, TemplateConfig } from "../../../types";
10
- import { MagicOptionScheme } from "./magic-option.scheme";
11
- import { prettierConfig } from "../config";
12
-
13
- export function createGenFuncs(output : string,type: GeneratedFileTypes ) {
14
- const htmlFn = jsbeautify.html.bind(this, output, {
15
- "max_preserve_newlines": 0,
16
- "wrap_line_length" : 0,
17
- "wrap_attributes" : "force-expand-multiline",
18
- "brace_style" : 'collapse,preserve-inline'
19
- });
20
-
21
- const fnMap = {
22
- [GeneratedFileTypes.HTML]: htmlFn,
23
- //[GeneratedFileTypes.TS] : prettier.format.bind(this, output, prettierConfig),
24
- [GeneratedFileTypes.TS] : jsbeautify.js.bind(this, output, {"brace_style" : 'collapse,preserve-inline'}),
25
- [GeneratedFileTypes.HELPER] : jsbeautify.js.bind(this, output, {}),
26
- [GeneratedFileTypes.CSS] : jsbeautify.css.bind(this, output, { })
27
- };
28
-
29
- return fnMap[type]();
30
- }
31
-
32
- export function generate(file: TemplateConfig,options:MagicOptionScheme) :Rule{
33
- return (host:Tree, context: SchematicContext) => {
34
- EJS.renderFile(
35
- `${MAGIC_CLI_FOLDER}/${file.template}`,
36
- file.data,
37
- {"rmWhitespace" : true},
38
- (err, output) => {
39
- if (err) { logErr(err); return }
40
-
41
- try {
42
- //if(file.type != GeneratedFileTypes.TS) {
43
- output = createGenFuncs(output, file.type);
44
- //}
45
-
46
- let path = `${file.destination}/${file.name}`;
47
-
48
- if(host.exists(path)){
49
- host.overwrite(`${file.destination}/${file.name}`, output)
50
- } else{
51
- host.create(`${file.destination}/${file.name}`, output);
52
- }
53
- }
54
- catch (err) {
55
- logErr(output);
56
- logErr(err);
57
- }
58
- });
59
- return host;
60
- }
61
- }
1
+ import * as EJS from "ejs";
2
+ //import * as prettier from "prettier";
3
+ import * as jsbeautify from "js-beautify";
4
+
5
+ import { Rule, SchematicContext, Tree } from "@angular-devkit/schematics";
6
+
7
+ import { logErr } from "../Util";
8
+ import { MAGIC_CLI_FOLDER } from "../env";
9
+ import { GeneratedFileTypes, TemplateConfig } from "../../../types";
10
+ import { MagicOptionScheme } from "./magic-option.scheme";
11
+ import { prettierConfig } from "../config";
12
+
13
+ export function createGenFuncs(output : string,type: GeneratedFileTypes ) {
14
+ const htmlFn = jsbeautify.html.bind(this, output, {
15
+ "max_preserve_newlines": 0,
16
+ "wrap_line_length" : 0,
17
+ "wrap_attributes" : "force-expand-multiline",
18
+ "brace_style" : 'collapse,preserve-inline'
19
+ });
20
+
21
+ const fnMap = {
22
+ [GeneratedFileTypes.HTML]: htmlFn,
23
+ //[GeneratedFileTypes.TS] : prettier.format.bind(this, output, prettierConfig),
24
+ [GeneratedFileTypes.TS] : jsbeautify.js.bind(this, output, {"brace_style" : 'collapse,preserve-inline'}),
25
+ [GeneratedFileTypes.HELPER] : jsbeautify.js.bind(this, output, {}),
26
+ [GeneratedFileTypes.CSS] : jsbeautify.css.bind(this, output, { })
27
+ };
28
+
29
+ return fnMap[type]();
30
+ }
31
+
32
+ export function generate(file: TemplateConfig,options:MagicOptionScheme) :Rule{
33
+ return (host:Tree, context: SchematicContext) => {
34
+ EJS.renderFile(
35
+ `${MAGIC_CLI_FOLDER}/${file.template}`,
36
+ file.data,
37
+ {"rmWhitespace" : true},
38
+ (err, output) => {
39
+ if (err) { logErr(err); return }
40
+
41
+ try {
42
+ //if(file.type != GeneratedFileTypes.TS) {
43
+ output = createGenFuncs(output, file.type);
44
+ //}
45
+
46
+ let path = `${file.destination}/${file.name}`;
47
+
48
+ if(host.exists(path)){
49
+ host.overwrite(`${file.destination}/${file.name}`, output)
50
+ } else{
51
+ host.create(`${file.destination}/${file.name}`, output);
52
+ }
53
+ }
54
+ catch (err) {
55
+ logErr(output);
56
+ logErr(err);
57
+ }
58
+ });
59
+ return host;
60
+ }
61
+ }