@magic-xpa/cli 4.1000.0 → 4.1100.0-dev000.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (307) hide show
  1. package/README.md +28 -28
  2. package/index.d.ts +1 -1
  3. package/index.js +4 -4
  4. package/index.js.map +1 -1
  5. package/index.ts +1 -1
  6. package/package.json +2 -2
  7. package/src/collection.json +75 -75
  8. package/src/public_api.d.ts +3 -3
  9. package/src/public_api.js +6 -6
  10. package/src/public_api.js.map +1 -1
  11. package/src/public_api.ts +5 -5
  12. package/src/schematics/magic-utils/Util.d.ts +6 -6
  13. package/src/schematics/magic-utils/Util.js +26 -26
  14. package/src/schematics/magic-utils/Util.js.map +1 -1
  15. package/src/schematics/magic-utils/config.d.ts +12 -12
  16. package/src/schematics/magic-utils/config.js +56 -56
  17. package/src/schematics/magic-utils/config.js.map +1 -1
  18. package/src/schematics/magic-utils/config.ts +68 -68
  19. package/src/schematics/magic-utils/env.d.ts +23 -23
  20. package/src/schematics/magic-utils/env.js +39 -39
  21. package/src/schematics/magic-utils/env.js.map +1 -1
  22. package/src/schematics/magic-utils/env.ts +50 -50
  23. package/src/schematics/magic-utils/manifest.d.ts +11 -11
  24. package/src/schematics/magic-utils/manifest.js +40 -40
  25. package/src/schematics/magic-utils/manifest.js.map +1 -1
  26. package/src/schematics/magic-utils/manifest.ts +46 -46
  27. package/src/schematics/magic-utils/metadata.class.d.ts +51 -51
  28. package/src/schematics/magic-utils/metadata.class.js +124 -124
  29. package/src/schematics/magic-utils/metadata.class.js.map +1 -1
  30. package/src/schematics/magic-utils/metadata.class.ts +159 -159
  31. package/src/schematics/magic-utils/process-json.d.ts +2 -2
  32. package/src/schematics/magic-utils/process-json.js +157 -158
  33. package/src/schematics/magic-utils/process-json.js.map +1 -1
  34. package/src/schematics/magic-utils/rules/build-control.rule.d.ts +5 -5
  35. package/src/schematics/magic-utils/rules/build-control.rule.js +73 -74
  36. package/src/schematics/magic-utils/rules/build-control.rule.js.map +1 -1
  37. package/src/schematics/magic-utils/rules/build-view.rule.d.ts +3 -3
  38. package/src/schematics/magic-utils/rules/build-view.rule.js +82 -80
  39. package/src/schematics/magic-utils/rules/build-view.rule.js.map +1 -1
  40. package/src/schematics/magic-utils/rules/build-view.rule.ts +4 -0
  41. package/src/schematics/magic-utils/rules/component-list.rule.d.ts +3 -3
  42. package/src/schematics/magic-utils/rules/component-list.rule.js +316 -317
  43. package/src/schematics/magic-utils/rules/component-list.rule.js.map +1 -1
  44. package/src/schematics/magic-utils/rules/generate.rule.d.ts +5 -5
  45. package/src/schematics/magic-utils/rules/generate.rule.js +53 -54
  46. package/src/schematics/magic-utils/rules/generate.rule.js.map +1 -1
  47. package/src/schematics/magic-utils/rules/generate.rule.ts +61 -61
  48. package/src/schematics/magic-utils/rules/init-add-modules.rule.d.ts +12 -12
  49. package/src/schematics/magic-utils/rules/init-add-modules.rule.js +295 -296
  50. package/src/schematics/magic-utils/rules/init-add-modules.rule.js.map +1 -1
  51. package/src/schematics/magic-utils/rules/init-add-modules.rule.ts +360 -360
  52. package/src/schematics/magic-utils/rules/init-gen-components.rule.d.ts +4 -4
  53. package/src/schematics/magic-utils/rules/init-gen-components.rule.js +65 -66
  54. package/src/schematics/magic-utils/rules/init-gen-components.rule.js.map +1 -1
  55. package/src/schematics/magic-utils/rules/init-magic-metadata.rule.d.ts +3 -3
  56. package/src/schematics/magic-utils/rules/init-magic-metadata.rule.js +17 -18
  57. package/src/schematics/magic-utils/rules/init-magic-metadata.rule.js.map +1 -1
  58. package/src/schematics/magic-utils/rules/init-magic-metadata.rule.ts +19 -19
  59. package/src/schematics/magic-utils/rules/load-views-gen.rule.d.ts +3 -3
  60. package/src/schematics/magic-utils/rules/load-views-gen.rule.js +28 -29
  61. package/src/schematics/magic-utils/rules/load-views-gen.rule.js.map +1 -1
  62. package/src/schematics/magic-utils/rules/magic-option.scheme.d.ts +22 -21
  63. package/src/schematics/magic-utils/rules/magic-option.scheme.js +2 -2
  64. package/src/schematics/magic-utils/rules/magic-option.scheme.js.map +1 -1
  65. package/src/schematics/magic-utils/rules/magic-option.scheme.ts +24 -23
  66. package/src/schematics/magic-utils/utils.d.ts +12 -12
  67. package/src/schematics/magic-utils/utils.js +116 -117
  68. package/src/schematics/magic-utils/utils.js.map +1 -1
  69. package/src/schematics/magic-utils/utils.ts +134 -134
  70. package/src/schematics/mg-Install-prerequisites/index.d.ts +3 -3
  71. package/src/schematics/mg-Install-prerequisites/index.js +24 -25
  72. package/src/schematics/mg-Install-prerequisites/index.js.map +1 -1
  73. package/src/schematics/mg-Install-prerequisites/index.ts +30 -30
  74. package/src/schematics/mg-Install-prerequisites/schema.json +14 -14
  75. package/src/schematics/mg-add/files/src/app/app.component.html +17 -17
  76. package/src/schematics/mg-add/files/src/app/app.routes.ts +14 -14
  77. package/src/schematics/mg-add/files/src/app/magic/component-list.g.ts +9 -9
  78. package/src/schematics/mg-add/files/src/app/magic/lazy-loader.service.ts +2 -1
  79. package/src/schematics/mg-add/files/src/app/magic/magic.gen.lib.module.ts +19 -19
  80. package/src/schematics/mg-add/files/src/magic-styles.css +131 -131
  81. package/src/schematics/mg-add/index.d.ts +3 -3
  82. package/src/schematics/mg-add/index.js +150 -151
  83. package/src/schematics/mg-add/index.js.map +1 -1
  84. package/src/schematics/mg-add/schema.json +29 -29
  85. package/src/schematics/mg-add/utils/add-declaration-to-root-module.d.ts +2 -2
  86. package/src/schematics/mg-add/utils/add-declaration-to-root-module.js +10 -11
  87. package/src/schematics/mg-add/utils/add-declaration-to-root-module.js.map +1 -1
  88. package/src/schematics/mg-add/utils/add-declaration-to-root-module.ts +12 -12
  89. package/src/schematics/mg-add/webModule/app.routes.ts +14 -14
  90. package/src/schematics/mg-add-tasks/index.d.ts +3 -3
  91. package/src/schematics/mg-add-tasks/index.js +29 -30
  92. package/src/schematics/mg-add-tasks/index.js.map +1 -1
  93. package/src/schematics/mg-add-tasks/index.ts +53 -53
  94. package/src/schematics/mg-add-tasks/schema.json +41 -41
  95. package/src/schematics/mg-delete-files/index.d.ts +3 -3
  96. package/src/schematics/mg-delete-files/index.js +12 -13
  97. package/src/schematics/mg-delete-files/index.js.map +1 -1
  98. package/src/schematics/mg-delete-files/index.ts +12 -12
  99. package/src/schematics/mg-delete-files/schema.json +14 -14
  100. package/src/schematics/mg-gen-module/index.d.ts +3 -3
  101. package/src/schematics/mg-gen-module/index.js +14 -15
  102. package/src/schematics/mg-gen-module/index.js.map +1 -1
  103. package/src/schematics/mg-gen-module/index.ts +14 -14
  104. package/src/schematics/mg-gen-module/schema.json +24 -24
  105. package/src/schematics/mg-generate/index.d.ts +3 -3
  106. package/src/schematics/mg-generate/index.js +12 -13
  107. package/src/schematics/mg-generate/index.js.map +1 -1
  108. package/src/schematics/mg-generate/index.ts +12 -12
  109. package/src/schematics/mg-generate/schema.json +34 -34
  110. package/src/schematics/mg-generate-component/index.d.ts +3 -3
  111. package/src/schematics/mg-generate-component/index.js +34 -35
  112. package/src/schematics/mg-generate-component/index.js.map +1 -1
  113. package/src/schematics/mg-generate-component/schema.json +6 -0
  114. package/src/schematics/mg-install/index.d.ts +3 -3
  115. package/src/schematics/mg-install/index.js +29 -30
  116. package/src/schematics/mg-install/index.js.map +1 -1
  117. package/src/schematics/mg-install/index.ts +37 -37
  118. package/src/schematics/mg-install/schema.json +24 -24
  119. package/src/schematics/mg-routes/index.d.ts +6 -6
  120. package/src/schematics/mg-routes/index.js +62 -63
  121. package/src/schematics/mg-routes/index.js.map +1 -1
  122. package/src/schematics/mg-routes/schema.json +14 -14
  123. package/src/schematics/mg-single-control/index.d.ts +3 -3
  124. package/src/schematics/mg-single-control/index.js +28 -29
  125. package/src/schematics/mg-single-control/index.js.map +1 -1
  126. package/src/schematics/mg-single-control/schema.json +24 -24
  127. package/src/schematics/utils/ast.d.ts +21 -21
  128. package/src/schematics/utils/ast.js +90 -91
  129. package/src/schematics/utils/ast.js.map +1 -1
  130. package/src/schematics/utils/ast.ts +103 -103
  131. package/src/schematics/utils/devkit-utils/README.md +1 -1
  132. package/src/schematics/utils/devkit-utils/ast-utils.d.ts +87 -87
  133. package/src/schematics/utils/devkit-utils/ast-utils.js +489 -490
  134. package/src/schematics/utils/devkit-utils/ast-utils.js.map +1 -1
  135. package/src/schematics/utils/devkit-utils/ast-utils.ts +570 -570
  136. package/src/schematics/utils/devkit-utils/ast-utils_old.d.ts +68 -68
  137. package/src/schematics/utils/devkit-utils/ast-utils_old.js +419 -420
  138. package/src/schematics/utils/devkit-utils/ast-utils_old.js.map +1 -1
  139. package/src/schematics/utils/devkit-utils/ast-utils_old.ts +478 -478
  140. package/src/schematics/utils/devkit-utils/change.d.ts +66 -66
  141. package/src/schematics/utils/devkit-utils/change.js +94 -94
  142. package/src/schematics/utils/devkit-utils/change.js.map +1 -1
  143. package/src/schematics/utils/devkit-utils/change.ts +127 -127
  144. package/src/schematics/utils/devkit-utils/component.d.ts +2 -2
  145. package/src/schematics/utils/devkit-utils/component.js +96 -97
  146. package/src/schematics/utils/devkit-utils/component.js.map +1 -1
  147. package/src/schematics/utils/devkit-utils/component.ts +136 -136
  148. package/src/schematics/utils/devkit-utils/config.d.ts +78 -78
  149. package/src/schematics/utils/devkit-utils/config.js +52 -52
  150. package/src/schematics/utils/devkit-utils/config.js.map +1 -1
  151. package/src/schematics/utils/devkit-utils/config.ts +120 -120
  152. package/src/schematics/utils/devkit-utils/find-module.d.ts +28 -28
  153. package/src/schematics/utils/devkit-utils/find-module.js +92 -93
  154. package/src/schematics/utils/devkit-utils/find-module.js.map +1 -1
  155. package/src/schematics/utils/devkit-utils/find-module.ts +108 -108
  156. package/src/schematics/utils/devkit-utils/ng-ast-utils.d.ts +5 -5
  157. package/src/schematics/utils/devkit-utils/ng-ast-utils.js +73 -74
  158. package/src/schematics/utils/devkit-utils/ng-ast-utils.js.map +1 -1
  159. package/src/schematics/utils/devkit-utils/ng-ast-utils.ts +84 -84
  160. package/src/schematics/utils/devkit-utils/parse-name.d.ts +13 -13
  161. package/src/schematics/utils/devkit-utils/parse-name.js +19 -20
  162. package/src/schematics/utils/devkit-utils/parse-name.js.map +1 -1
  163. package/src/schematics/utils/devkit-utils/parse-name.ts +24 -24
  164. package/src/schematics/utils/devkit-utils/route-utils.d.ts +20 -20
  165. package/src/schematics/utils/devkit-utils/route-utils.js +133 -134
  166. package/src/schematics/utils/devkit-utils/route-utils.js.map +1 -1
  167. package/src/schematics/utils/devkit-utils/route-utils.ts +180 -180
  168. package/src/schematics/utils/devkit-utils/validation.d.ts +1 -1
  169. package/src/schematics/utils/devkit-utils/validation.js +18 -19
  170. package/src/schematics/utils/devkit-utils/validation.js.map +1 -1
  171. package/src/schematics/utils/devkit-utils/validation.ts +16 -16
  172. package/src/schematics/utils/html.d.ts +18 -18
  173. package/src/schematics/utils/html.js +59 -60
  174. package/src/schematics/utils/html.js.map +1 -1
  175. package/src/schematics/utils/html.ts +63 -63
  176. package/src/schematics/utils/lib-versions.d.ts +3 -3
  177. package/src/schematics/utils/lib-versions.js +6 -6
  178. package/src/schematics/utils/lib-versions.js.map +1 -1
  179. package/src/schematics/utils/lib-versions.ts +3 -3
  180. package/src/schematics/utils/package.d.ts +5 -5
  181. package/src/schematics/utils/package.js +20 -21
  182. package/src/schematics/utils/package.js.map +1 -1
  183. package/src/schematics/utils/package.ts +22 -22
  184. package/src/schematics/utils/testing.d.ts +5 -5
  185. package/src/schematics/utils/testing.js +26 -27
  186. package/src/schematics/utils/testing.js.map +1 -1
  187. package/src/schematics/utils/testing.ts +25 -25
  188. package/src/types/enums/Enums.d.ts +1646 -1646
  189. package/src/types/enums/Enums.js +1862 -1862
  190. package/src/types/enums/Enums.js.map +1 -1
  191. package/src/types/enums/Enums.ts +2063 -2063
  192. package/src/types/enums/generated-file-types.enum.d.ts +6 -6
  193. package/src/types/enums/generated-file-types.enum.js +10 -10
  194. package/src/types/enums/generated-file-types.enum.js.map +1 -1
  195. package/src/types/enums/generated-file-types.enum.ts +6 -6
  196. package/src/types/enums/horizontal-alignments.enum.d.ts +5 -5
  197. package/src/types/enums/horizontal-alignments.enum.js +9 -9
  198. package/src/types/enums/horizontal-alignments.enum.js.map +1 -1
  199. package/src/types/enums/horizontal-alignments.enum.ts +6 -6
  200. package/src/types/enums/themes.enum.d.ts +6 -6
  201. package/src/types/enums/themes.enum.js +10 -10
  202. package/src/types/enums/themes.enum.js.map +1 -1
  203. package/src/types/enums/themes.enum.ts +6 -6
  204. package/src/types/index.d.ts +7 -7
  205. package/src/types/index.js +10 -10
  206. package/src/types/index.js.map +1 -1
  207. package/src/types/index.ts +8 -8
  208. package/src/types/interfaces/app.d.ts +53 -53
  209. package/src/types/interfaces/app.js +9 -9
  210. package/src/types/interfaces/app.js.map +1 -1
  211. package/src/types/interfaces/app.ts +89 -89
  212. package/src/types/interfaces/control.d.ts +82 -82
  213. package/src/types/interfaces/control.js +2 -2
  214. package/src/types/interfaces/control.js.map +1 -1
  215. package/src/types/interfaces/control.ts +106 -106
  216. package/src/types/interfaces/env.interface.d.ts +19 -19
  217. package/src/types/interfaces/env.interface.js +10 -10
  218. package/src/types/interfaces/template.config.d.ts +8 -8
  219. package/src/types/interfaces/template.config.js +2 -2
  220. package/src/types/interfaces/template.config.js.map +1 -1
  221. package/src/types/interfaces/template.config.ts +11 -11
  222. package/templates/angular/src/app/app.component.html.ejs +17 -17
  223. package/templates/angular/src/app/cmp-array.ejs +3 -3
  224. package/templates/angular/src/app/cmp-hash.ejs +3 -3
  225. package/templates/angular/src/app/component-list.g.ts +21 -21
  226. package/templates/angular/src/app.component.ts +14 -14
  227. package/templates/angular/src/app.module.ts +70 -70
  228. package/templates/angular/src/app.routes.ts +73 -73
  229. package/templates/angular/src/styles/app.css +5 -5
  230. package/templates/attributes/button_attributes.ejs +2 -2
  231. package/templates/attributes/common/base/class.ejs +6 -6
  232. package/templates/attributes/common/base/control_type.ejs +53 -53
  233. package/templates/attributes/common/base/enabled.ejs +9 -9
  234. package/templates/attributes/common/base/imageFileName.ejs +3 -3
  235. package/templates/attributes/common/base/no_control_class.ejs +3 -3
  236. package/templates/attributes/common/base/rtol.ejs +3 -3
  237. package/templates/attributes/common/base/tabindex.ejs +11 -11
  238. package/templates/attributes/common/base/testingId.ejs +8 -8
  239. package/templates/attributes/common/base/tooltip.ejs +7 -7
  240. package/templates/attributes/common/base/visible.ejs +6 -6
  241. package/templates/attributes/common/base/wallpaper.ejs +3 -3
  242. package/templates/attributes/common/base_attributes.ejs +10 -10
  243. package/templates/attributes/common/container_attributes.ejs +6 -6
  244. package/templates/attributes/common/control_attributes.ejs +3 -3
  245. package/templates/attributes/common/format.ejs +5 -5
  246. package/templates/attributes/common/input/hint.ejs +13 -13
  247. package/templates/attributes/common/input/multiline_edit.ejs +3 -3
  248. package/templates/attributes/common/input/must_input.ejs +8 -8
  249. package/templates/attributes/common/input/password_edit.ejs +7 -7
  250. package/templates/attributes/common/input/row_editing_input_attributes.ejs +6 -6
  251. package/templates/attributes/common/input/validation.ejs +5 -5
  252. package/templates/attributes/common/input_attributes.ejs +4 -4
  253. package/templates/attributes/common/no_control_base_attributes.ejs +4 -4
  254. package/templates/attributes/common/row_editing_button_attributes.ejs +10 -10
  255. package/templates/component/view.component.html +14 -14
  256. package/templates/component/view.component.ts +123 -122
  257. package/templates/themes/basicHTML/Code/theme.module.ts +10 -10
  258. package/templates/themes/basicHTML/checkbox.ejs +1 -1
  259. package/templates/themes/basicHTML/combobox.ejs +37 -37
  260. package/templates/themes/basicHTML/edit.ejs +169 -168
  261. package/templates/themes/basicHTML/form.ejs +4 -4
  262. package/templates/themes/basicHTML/group.ejs +4 -4
  263. package/templates/themes/basicHTML/image.ejs +6 -6
  264. package/templates/themes/basicHTML/label.ejs +11 -11
  265. package/templates/themes/basicHTML/listbox.ejs +21 -21
  266. package/templates/themes/basicHTML/push-button.ejs +28 -28
  267. package/templates/themes/basicHTML/radio.ejs +20 -20
  268. package/templates/themes/basicHTML/subform.ejs +6 -6
  269. package/templates/themes/basicHTML/tab.ejs +31 -31
  270. package/templates/themes/basicHTML/tabpage.ejs +5 -5
  271. package/templates/themes/basicHiddenHTML/Code/theme.module.ts +10 -10
  272. package/templates/themes/basicHiddenHTML/combobox.ejs +5 -5
  273. package/templates/themes/basicHiddenHTML/form.ejs +3 -3
  274. package/templates/themes/basicHiddenHTML/group.ejs +2 -2
  275. package/templates/themes/basicHiddenHTML/image.ejs +4 -4
  276. package/templates/themes/basicHiddenHTML/label.ejs +1 -1
  277. package/templates/themes/basicHiddenHTML/listbox.ejs +8 -8
  278. package/templates/themes/basicHiddenHTML/push-button.ejs +26 -26
  279. package/templates/themes/basicHiddenHTML/radio.ejs +17 -17
  280. package/templates/themes/basicHiddenHTML/tab.ejs +13 -13
  281. package/templates/themes/basicHiddenHTML/table.ejs +18 -18
  282. package/templates/themes/basicHiddenHTML/tabpage.ejs +2 -2
  283. package/templates/themes/container.ejs +26 -26
  284. package/templates/themes/control.ejs +52 -52
  285. package/templates/themes/editTypeSelector.ejs +1 -1
  286. package/templates/themes/material/Code/theme.module.ts +68 -68
  287. package/templates/themes/material/base_attributes_date.ejs +8 -8
  288. package/templates/themes/material/checkbox.ejs +1 -1
  289. package/templates/themes/material/combobox.ejs +43 -43
  290. package/templates/themes/material/edit.ejs +204 -204
  291. package/templates/themes/material/group.ejs +3 -3
  292. package/templates/themes/material/listbox.ejs +22 -23
  293. package/templates/themes/material/push-button.ejs +28 -28
  294. package/templates/themes/material/radio.ejs +22 -22
  295. package/templates/themes/material/subform.ejs +8 -8
  296. package/templates/themes/material/tab.ejs +19 -19
  297. package/templates/themes/router_outlet.ejs +5 -5
  298. package/templates/themes/table/HTMLTable/columnHeader.ejs +3 -1
  299. package/templates/themes/table/HTMLTable/table.ejs +37 -37
  300. package/templates/themes/table/grid/additionalComponentCode.ejs +26 -26
  301. package/templates/themes/table/grid/additionalIncludes.ejs +1 -1
  302. package/templates/themes/table/grid/column.ejs +3 -1
  303. package/templates/themes/table/grid/table.ejs +37 -37
  304. package/templates/themes/table/repeatable/column.ejs +11 -11
  305. package/templates/themes/table/repeatable/table.ejs +28 -28
  306. package/templates/themes/tableTypeSelector.ejs +21 -21
  307. package/tsconfig.json +36 -36
@@ -1,159 +1,158 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.processJson = void 0;
4
- const Util_1 = require("./Util");
5
- const util_1 = require("util");
6
- const Enums_1 = require("../../../src/types/enums/Enums");
7
- // mapping for properties which are implemented using a class
8
- const Map = {
9
- style: [
10
- {
11
- name: 'font',
12
- suffix: 'mgFont'
13
- },
14
- {
15
- name: 'focus_color',
16
- suffix: 'mgFocusColor'
17
- },
18
- {
19
- name: 'border_color',
20
- suffix: 'mgBorderColor'
21
- },
22
- {
23
- name: 'border',
24
- options: {
25
- "false": 'hidden_border'
26
- }
27
- },
28
- {
29
- name: 'border_style',
30
- options: {
31
- "1": 'twod_border',
32
- "2": 'threed_border',
33
- "3": 'threedsunken_border',
34
- "4": 'windows_border',
35
- "5": 'windows_border',
36
- "6": 'emboss_border',
37
- "7": 'hidden_border'
38
- }
39
- },
40
- {
41
- name: 'multiline_edit',
42
- options: {
43
- "true": 'multiline',
44
- }
45
- }
46
- ],
47
- props: [],
48
- hint: []
49
- };
50
- //////////////////////////////////////////////////////////////////
51
- // process the views' json, find the classes used for each control
52
- //////////////////////////////////////////////////////////////////
53
- function processJson(appJson) {
54
- const views$ = Object.assign([], appJson.views);
55
- appJson.views.length = 0;
56
- // loop on all views
57
- views$.forEach(view$ => {
58
- if (view$) {
59
- (0, Util_1.LogLn)(`[>] Processing JSON file for component ${view$.props.id}`);
60
- processControl(view$);
61
- appJson.views.push(view$);
62
- }
63
- });
64
- return appJson;
65
- }
66
- exports.processJson = processJson;
67
- function CalcClassForControl(control, controlClasses) {
68
- if (control.controlType != Enums_1.MgControlType.CTRL_TYPE_TABPAGE) {
69
- if (control.controlType === Enums_1.MgControlType.CTRL_TYPE_BUTTON && control.props.button_style === Enums_1.CtrlButtonTypeGui.Image) {
70
- controlClasses.push("button_image_background_size");
71
- }
72
- if (control.controlType === Enums_1.MgControlType.CTRL_TYPE_LABEL) {
73
- controlClasses.push("lable_overflow");
74
- }
75
- if (control.controlType === Enums_1.MgControlType.CTRL_TYPE_COLUMN) {
76
- controlClasses.push("table_row");
77
- }
78
- if (control.controlType === Enums_1.MgControlType.CTRL_TYPE_TABLE) {
79
- if (control.props.scroll_bar) {
80
- controlClasses.push("table_scrollBar");
81
- }
82
- }
83
- if (control.controlType === Enums_1.MgControlType.CTRL_TYPE_TABLE || control.controlType === Enums_1.MgControlType.CTRL_TYPE_GROUP) {
84
- controlClasses.push("container_border");
85
- }
86
- // if (control.children) {
87
- // control.children.forEach((ctrl$: Control) => {
88
- // CalcClassForControl(ctrl$, controlClasses)
89
- // });
90
- // }
91
- }
92
- }
93
- ///////////////////////////////////////////////////////////////////////////////////////////////////
94
- // for each special chars we will add "\" before the special char.
95
- // For example : control name "Blabla?" the class name will be "Blabla\?"
96
- ///////////////////////////////////////////////////////////////////////////////////////////////////
97
- function getControlClassNameInCss(controlNameStr) {
98
- var controlName = controlNameStr;
99
- //The following chars are created problem in css = ["!" "," "+", ":", ",", "~", ";", "\"" "{" "}" ">" " "];
100
- //TODO:need to be check with Rotem let specialCharsForRotem = ["!"];
101
- // replace all special chars
102
- let specialCharsWork = ["\\", "#", "$", "%", "&", "(", ")", "*", "-", ".", "/", "<", "=", "?", "@", "[", "]", "^", "`", "|"];
103
- for (let i = 0; i < specialCharsWork.length; i++) {
104
- controlName = controlName.split(specialCharsWork[i]).join("\\" + specialCharsWork[i]);
105
- }
106
- return controlName;
107
- }
108
- //////////////////////////////////////////////////////////////////
109
- // recursively process the controls' properties, find the classes used for the control
110
- //////////////////////////////////////////////////////////////////
111
- function processControl(control) {
112
- const categoryNames = Object.keys(Map);
113
- //LogLn(">> Generating CSS class list for \"" + control.props.id + "\"");
114
- const controlClasses = [];
115
- // use the control's id as a class
116
- //control["class_name_in_css"] = getControlClassNameInCss(control.props.id);
117
- //controlClasses.push(control.props.id + "Props");
118
- CalcClassForControl(control, controlClasses);
119
- // loop on all item names from the "Map" object
120
- categoryNames.forEach((catName) => {
121
- let catRuleArray = Map[catName];
122
- catRuleArray.forEach((rule, i) => {
123
- let ruleSet$;
124
- if (control[catName]) {
125
- ruleSet$ = control[catName][rule.name];
126
- }
127
- else {
128
- return;
129
- }
130
- if ((0, util_1.isNullOrUndefined)(ruleSet$))
131
- return;
132
- // ... or turn on the has-expession flag
133
- if (!(0, util_1.isNullOrUndefined)(ruleSet$.has_exp) && ruleSet$.has_exp) {
134
- control.hasClassExpression = true;
135
- }
136
- // find and keep the class name...
137
- else {
138
- if (Map[catName] && Map[catName][i] && Map[catName][i] && Map[catName][i]['options']) {
139
- if (!(0, util_1.isNullOrUndefined)(Map[catName][i]['options'][String(ruleSet$)]))
140
- controlClasses.push(Map[catName][i]['options'][String(ruleSet$)]);
141
- }
142
- else {
143
- controlClasses.push(Map[catName] && Map[catName][i] && Map[catName][i] && Map[catName][i]['suffix'] + ruleSet$);
144
- }
145
- }
146
- });
147
- control.classes = controlClasses.join(' ');
148
- });
149
- //LogLn("generated classes \"" + control.classes + "\"");
150
- // go over control's children
151
- if (control.children) {
152
- //LogLn("processing child controls...");
153
- control.children.forEach((ctrl$) => {
154
- processControl(ctrl$);
155
- });
156
- //LogLn("...children processing done")
157
- }
158
- }
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.processJson = processJson;
4
+ const Util_1 = require("./Util");
5
+ const util_1 = require("util");
6
+ const Enums_1 = require("../../../src/types/enums/Enums");
7
+ // mapping for properties which are implemented using a class
8
+ const Map = {
9
+ style: [
10
+ {
11
+ name: 'font',
12
+ suffix: 'mgFont'
13
+ },
14
+ {
15
+ name: 'focus_color',
16
+ suffix: 'mgFocusColor'
17
+ },
18
+ {
19
+ name: 'border_color',
20
+ suffix: 'mgBorderColor'
21
+ },
22
+ {
23
+ name: 'border',
24
+ options: {
25
+ "false": 'hidden_border'
26
+ }
27
+ },
28
+ {
29
+ name: 'border_style',
30
+ options: {
31
+ "1": 'twod_border',
32
+ "2": 'threed_border',
33
+ "3": 'threedsunken_border',
34
+ "4": 'windows_border',
35
+ "5": 'windows_border',
36
+ "6": 'emboss_border',
37
+ "7": 'hidden_border'
38
+ }
39
+ },
40
+ {
41
+ name: 'multiline_edit',
42
+ options: {
43
+ "true": 'multiline',
44
+ }
45
+ }
46
+ ],
47
+ props: [],
48
+ hint: []
49
+ };
50
+ //////////////////////////////////////////////////////////////////
51
+ // process the views' json, find the classes used for each control
52
+ //////////////////////////////////////////////////////////////////
53
+ function processJson(appJson) {
54
+ const views$ = Object.assign([], appJson.views);
55
+ appJson.views.length = 0;
56
+ // loop on all views
57
+ views$.forEach(view$ => {
58
+ if (view$) {
59
+ (0, Util_1.LogLn)(`[>] Processing JSON file for component ${view$.props.id}`);
60
+ processControl(view$);
61
+ appJson.views.push(view$);
62
+ }
63
+ });
64
+ return appJson;
65
+ }
66
+ function CalcClassForControl(control, controlClasses) {
67
+ if (control.controlType != Enums_1.MgControlType.CTRL_TYPE_TABPAGE) {
68
+ if (control.controlType === Enums_1.MgControlType.CTRL_TYPE_BUTTON && control.props.button_style === Enums_1.CtrlButtonTypeGui.Image) {
69
+ controlClasses.push("button_image_background_size");
70
+ }
71
+ if (control.controlType === Enums_1.MgControlType.CTRL_TYPE_LABEL) {
72
+ controlClasses.push("lable_overflow");
73
+ }
74
+ if (control.controlType === Enums_1.MgControlType.CTRL_TYPE_COLUMN) {
75
+ controlClasses.push("table_row");
76
+ }
77
+ if (control.controlType === Enums_1.MgControlType.CTRL_TYPE_TABLE) {
78
+ if (control.props.scroll_bar) {
79
+ controlClasses.push("table_scrollBar");
80
+ }
81
+ }
82
+ if (control.controlType === Enums_1.MgControlType.CTRL_TYPE_TABLE || control.controlType === Enums_1.MgControlType.CTRL_TYPE_GROUP) {
83
+ controlClasses.push("container_border");
84
+ }
85
+ // if (control.children) {
86
+ // control.children.forEach((ctrl$: Control) => {
87
+ // CalcClassForControl(ctrl$, controlClasses)
88
+ // });
89
+ // }
90
+ }
91
+ }
92
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
93
+ // for each special chars we will add "\" before the special char.
94
+ // For example : control name "Blabla?" the class name will be "Blabla\?"
95
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
96
+ function getControlClassNameInCss(controlNameStr) {
97
+ var controlName = controlNameStr;
98
+ //The following chars are created problem in css = ["!" "," "+", ":", ",", "~", ";", "\"" "{" "}" ">" " "];
99
+ //TODO:need to be check with Rotem let specialCharsForRotem = ["!"];
100
+ // replace all special chars
101
+ let specialCharsWork = ["\\", "#", "$", "%", "&", "(", ")", "*", "-", ".", "/", "<", "=", "?", "@", "[", "]", "^", "`", "|"];
102
+ for (let i = 0; i < specialCharsWork.length; i++) {
103
+ controlName = controlName.split(specialCharsWork[i]).join("\\" + specialCharsWork[i]);
104
+ }
105
+ return controlName;
106
+ }
107
+ //////////////////////////////////////////////////////////////////
108
+ // recursively process the controls' properties, find the classes used for the control
109
+ //////////////////////////////////////////////////////////////////
110
+ function processControl(control) {
111
+ const categoryNames = Object.keys(Map);
112
+ //LogLn(">> Generating CSS class list for \"" + control.props.id + "\"");
113
+ const controlClasses = [];
114
+ // use the control's id as a class
115
+ //control["class_name_in_css"] = getControlClassNameInCss(control.props.id);
116
+ //controlClasses.push(control.props.id + "Props");
117
+ CalcClassForControl(control, controlClasses);
118
+ // loop on all item names from the "Map" object
119
+ categoryNames.forEach((catName) => {
120
+ let catRuleArray = Map[catName];
121
+ catRuleArray.forEach((rule, i) => {
122
+ let ruleSet$;
123
+ if (control[catName]) {
124
+ ruleSet$ = control[catName][rule.name];
125
+ }
126
+ else {
127
+ return;
128
+ }
129
+ if ((0, util_1.isNullOrUndefined)(ruleSet$))
130
+ return;
131
+ // ... or turn on the has-expession flag
132
+ if (!(0, util_1.isNullOrUndefined)(ruleSet$.has_exp) && ruleSet$.has_exp) {
133
+ control.hasClassExpression = true;
134
+ }
135
+ // find and keep the class name...
136
+ else {
137
+ if (Map[catName] && Map[catName][i] && Map[catName][i] && Map[catName][i]['options']) {
138
+ if (!(0, util_1.isNullOrUndefined)(Map[catName][i]['options'][String(ruleSet$)]))
139
+ controlClasses.push(Map[catName][i]['options'][String(ruleSet$)]);
140
+ }
141
+ else {
142
+ controlClasses.push(Map[catName] && Map[catName][i] && Map[catName][i] && Map[catName][i]['suffix'] + ruleSet$);
143
+ }
144
+ }
145
+ });
146
+ control.classes = controlClasses.join(' ');
147
+ });
148
+ //LogLn("generated classes \"" + control.classes + "\"");
149
+ // go over control's children
150
+ if (control.children) {
151
+ //LogLn("processing child controls...");
152
+ control.children.forEach((ctrl$) => {
153
+ processControl(ctrl$);
154
+ });
155
+ //LogLn("...children processing done")
156
+ }
157
+ }
159
158
  //# sourceMappingURL=process-json.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"process-json.js","sourceRoot":"","sources":["process-json.ts"],"names":[],"mappings":";;;AACA,iCAA+C;AAC/C,+BAAyC;AACzC,0DAAkF;AAElF,6DAA6D;AAC7D,MAAM,GAAG,GAAqG;IAC1G,KAAK,EAAE;QACH;YACI,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,QAAQ;SACnB;QACD;YACI,IAAI,EAAE,aAAa;YACnB,MAAM,EAAE,cAAc;SACzB;QAED;YACI,IAAI,EAAE,cAAc;YACpB,MAAM,EAAE,eAAe;SAC1B;QACD;YACI,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACL,OAAO,EAAE,eAAe;aAC3B;SACJ;QACD;YACI,IAAI,EAAE,cAAc;YACpB,OAAO,EAAE;gBACL,GAAG,EAAE,aAAa;gBAClB,GAAG,EAAE,eAAe;gBACpB,GAAG,EAAE,qBAAqB;gBAC1B,GAAG,EAAE,gBAAgB;gBACrB,GAAG,EAAE,gBAAgB;gBACrB,GAAG,EAAE,eAAe;gBACpB,GAAG,EAAE,eAAe;aACvB;SACJ;QACD;YACI,IAAI,EAAE,gBAAgB;YACtB,OAAO,EAAE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CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;iBACzE;qBACI;oBACD,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC;iBACnH;aACJ;QAEL,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,yDAAyD;IAEzD,6BAA6B;IAC7B,IAAI,OAAO,CAAC,QAAQ,EAAE;QAClB,wCAAwC;QACxC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAc,EAAE,EAAE;YACxC,cAAc,CAAC,KAAK,CAAC,CAAA;QACzB,CAAC,CAAC,CAAC;QACH,sCAAsC;KACzC;AAEL,CAAC","sourcesContent":["import {AppJson, View,Control} from '../../types/index';\r\nimport {LogLn,} from \"./Util\";\r\nimport { isNullOrUndefined } from \"util\";\r\nimport { MgControlType, CtrlButtonTypeGui } from \"../../../src/types/enums/Enums\";\r\n\r\n// mapping for properties which are implemented using a class\r\nconst Map: { [category: string]: { name: string, suffix?: string, options?: { [val: string]: string } }[] } = {\r\n style: [\r\n {\r\n name: 'font',\r\n suffix: 'mgFont'\r\n },\r\n {\r\n name: 'focus_color',\r\n suffix: 'mgFocusColor'\r\n },\r\n\r\n {\r\n name: 'border_color',\r\n suffix: 'mgBorderColor'\r\n },\r\n {\r\n name: 'border',\r\n options: {\r\n \"false\": 'hidden_border'\r\n }\r\n },\r\n {\r\n name: 'border_style',\r\n options: {\r\n \"1\": 'twod_border',\r\n \"2\": 'threed_border',\r\n \"3\": 'threedsunken_border',\r\n \"4\": 'windows_border',\r\n \"5\": 'windows_border',\r\n \"6\": 'emboss_border',\r\n \"7\": 'hidden_border'\r\n }\r\n },\r\n {\r\n name: 'multiline_edit',\r\n options: {\r\n \"true\": 'multiline',\r\n\r\n }\r\n }\r\n ],\r\n props: [],\r\n hint: []\r\n};\r\n\r\n//////////////////////////////////////////////////////////////////\r\n// process the views' json, find the classes used for each control\r\n//////////////////////////////////////////////////////////////////\r\nexport function processJson(appJson: AppJson) :AppJson {\r\n\r\n const views$: View[] = Object.assign([], appJson.views);\r\n appJson.views.length = 0;\r\n\r\n // loop on all views\r\n views$.forEach( view$ => {\r\n if(view$){\r\n LogLn(`[>] Processing JSON file for component ${view$.props.id}`);\r\n processControl(view$);\r\n appJson.views.push(view$);\r\n }\r\n });\r\n return appJson;\r\n}\r\n\r\nfunction CalcClassForControl(control: Control, controlClasses: string[] ){\r\n if (control.controlType != MgControlType.CTRL_TYPE_TABPAGE){\r\n\r\n if (control.controlType === MgControlType.CTRL_TYPE_BUTTON && control.props.button_style === CtrlButtonTypeGui.Image) {\r\n controlClasses.push(\"button_image_background_size\");\r\n }\r\n\r\n if (control.controlType === MgControlType.CTRL_TYPE_LABEL) {\r\n controlClasses.push(\"lable_overflow\");\r\n }\r\n\r\n\r\n if (control.controlType === MgControlType.CTRL_TYPE_COLUMN ) {\r\n controlClasses.push(\"table_row\");\r\n }\r\n\r\n if (control.controlType === MgControlType.CTRL_TYPE_TABLE){\r\n\r\n if (control.props.scroll_bar) {\r\n controlClasses.push(\"table_scrollBar\");\r\n }\r\n }\r\n\r\n if(control.controlType === MgControlType.CTRL_TYPE_TABLE || control.controlType === MgControlType.CTRL_TYPE_GROUP) {\r\n controlClasses.push(\"container_border\");\r\n }\r\n\r\n // if (control.children) {\r\n // control.children.forEach((ctrl$: Control) => {\r\n // CalcClassForControl(ctrl$, controlClasses)\r\n // });\r\n // }\r\n }\r\n}\r\n///////////////////////////////////////////////////////////////////////////////////////////////////\r\n// for each special chars we will add \"\\\" before the special char.\r\n// For example : control name \"Blabla?\" the class name will be \"Blabla\\?\"\r\n///////////////////////////////////////////////////////////////////////////////////////////////////\r\nfunction getControlClassNameInCss(controlNameStr: string): string {\r\n var controlName = controlNameStr;\r\n\r\n //The following chars are created problem in css = [\"!\" \",\" \"+\", \":\", \",\", \"~\", \";\", \"\\\"\" \"{\" \"}\" \">\" \" \"];\r\n //TODO:need to be check with Rotem let specialCharsForRotem = [\"!\"];\r\n\r\n // replace all special chars\r\n let specialCharsWork = [\"\\\\\", \"#\", \"$\", \"%\", \"&\", \"(\", \")\", \"*\", \"-\", \".\", \"/\", \"<\", \"=\", \"?\", \"@\", \"[\", \"]\", \"^\", \"`\", \"|\"];\r\n for (let i = 0; i < specialCharsWork.length; i++) {\r\n controlName = controlName.split(specialCharsWork[i]).join(\"\\\\\" + specialCharsWork[i]);\r\n }\r\n\r\n return controlName;\r\n}\r\n\r\n//////////////////////////////////////////////////////////////////\r\n// recursively process the controls' properties, find the classes used for the control\r\n//////////////////////////////////////////////////////////////////\r\nfunction processControl(control: Control) {\r\n\r\n const categoryNames: string[] = Object.keys(Map);\r\n\r\n //LogLn(\">> Generating CSS class list for \\\"\" + control.props.id + \"\\\"\");\r\n\r\n const controlClasses: string[] = [];\r\n\r\n // use the control's id as a class\r\n //control[\"class_name_in_css\"] = getControlClassNameInCss(control.props.id);\r\n //controlClasses.push(control.props.id + \"Props\");\r\n CalcClassForControl(control, controlClasses);\r\n\r\n // loop on all item names from the \"Map\" object\r\n categoryNames.forEach((catName) => {\r\n let catRuleArray: { name: string, suffix?: string, options?: { [val: string]: string } }[] = Map[catName];\r\n\r\n catRuleArray.forEach((rule, i) => {\r\n\r\n let ruleSet$;\r\n if (control[catName]) {\r\n ruleSet$ = control[catName][rule.name];\r\n }\r\n else {\r\n return;\r\n }\r\n if (isNullOrUndefined(ruleSet$)) return;\r\n\r\n // ... or turn on the has-expession flag\r\n if (!isNullOrUndefined(ruleSet$.has_exp) && ruleSet$.has_exp) {\r\n control.hasClassExpression = true;\r\n }\r\n // find and keep the class name...\r\n else {\r\n if (Map[catName] && Map[catName][i] && Map[catName][i] && Map[catName][i]['options']) {\r\n if (!isNullOrUndefined(Map[catName][i]['options'][String(ruleSet$)]))\r\n controlClasses.push(Map[catName][i]['options'][String(ruleSet$)]);\r\n }\r\n else {\r\n controlClasses.push(Map[catName] && Map[catName][i] && Map[catName][i] && Map[catName][i]['suffix'] + ruleSet$);\r\n }\r\n }\r\n\r\n });\r\n\r\n control.classes = controlClasses.join(' ');\r\n });\r\n\r\n //LogLn(\"generated classes \\\"\" + control.classes + \"\\\"\");\r\n\r\n // go over control's children\r\n if (control.children) {\r\n //LogLn(\"processing child controls...\");\r\n control.children.forEach((ctrl$: Control) => {\r\n processControl(ctrl$)\r\n });\r\n //LogLn(\"...children processing done\")\r\n }\r\n\r\n}\r\n"]}
1
+ {"version":3,"file":"process-json.js","sourceRoot":"","sources":["process-json.ts"],"names":[],"mappings":";;AAsDA,kCAcC;AAnED,iCAA+C;AAC/C,+BAAyC;AACzC,0DAAkF;AAElF,6DAA6D;AAC7D,MAAM,GAAG,GAAqG;IAC1G,KAAK,EAAE;QACH;YACI,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,QAAQ;SACnB;QACD;YACI,IAAI,EAAE,aAAa;YACnB,MAAM,EAAE,cAAc;SACzB;QAED;YACI,IAAI,EAAE,cAAc;YACpB,MAAM,EAAE,eAAe;SAC1B;QACD;YACI,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACL,OAAO,EAAE,eAAe;aAC3B;SACJ;QACD;YACI,IAAI,EAAE,cAAc;YACpB,OAAO,EAAE;gBACL,GAAG,EAAE,aAAa;gBAClB,GAAG,EAAE,eAAe;gBACpB,GAAG,EAAE,qBAAqB;gBAC1B,GAAG,EAAE,gBAAgB;gBACrB,GAAG,EAAE,gBAAgB;gBACrB,GAAG,EAAE,eAAe;gBACpB,GAAG,EAAE,eAAe;aACvB;SACJ;QACD;YACI,IAAI,EAAE,gBAAgB;YACtB,OA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AC,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;wBAChE,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;gBAC1E,CAAC;qBACI,CAAC;oBACF,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC;gBACpH,CAAC;YACL,CAAC;QAEL,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,yDAAyD;IAEzD,6BAA6B;IAC7B,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QACnB,wCAAwC;QACxC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAc,EAAE,EAAE;YACxC,cAAc,CAAC,KAAK,CAAC,CAAA;QACzB,CAAC,CAAC,CAAC;QACH,sCAAsC;IAC1C,CAAC;AAEL,CAAC","sourcesContent":["import {AppJson, View,Control} from '../../types/index';\r\nimport {LogLn,} from \"./Util\";\r\nimport { isNullOrUndefined } from \"util\";\r\nimport { MgControlType, CtrlButtonTypeGui } from \"../../../src/types/enums/Enums\";\r\n\r\n// mapping for properties which are implemented using a class\r\nconst Map: { [category: string]: { name: string, suffix?: string, options?: { [val: string]: string } }[] } = {\r\n style: [\r\n {\r\n name: 'font',\r\n suffix: 'mgFont'\r\n },\r\n {\r\n name: 'focus_color',\r\n suffix: 'mgFocusColor'\r\n },\r\n\r\n {\r\n name: 'border_color',\r\n suffix: 'mgBorderColor'\r\n },\r\n {\r\n name: 'border',\r\n options: {\r\n \"false\": 'hidden_border'\r\n }\r\n },\r\n {\r\n name: 'border_style',\r\n options: {\r\n \"1\": 'twod_border',\r\n \"2\": 'threed_border',\r\n \"3\": 'threedsunken_border',\r\n \"4\": 'windows_border',\r\n \"5\": 'windows_border',\r\n \"6\": 'emboss_border',\r\n \"7\": 'hidden_border'\r\n }\r\n },\r\n {\r\n name: 'multiline_edit',\r\n options: {\r\n \"true\": 'multiline',\r\n\r\n }\r\n }\r\n ],\r\n props: [],\r\n hint: []\r\n};\r\n\r\n//////////////////////////////////////////////////////////////////\r\n// process the views' json, find the classes used for each control\r\n//////////////////////////////////////////////////////////////////\r\nexport function processJson(appJson: AppJson) :AppJson {\r\n\r\n const views$: View[] = Object.assign([], appJson.views);\r\n appJson.views.length = 0;\r\n\r\n // loop on all views\r\n views$.forEach( view$ => {\r\n if(view$){\r\n LogLn(`[>] Processing JSON file for component ${view$.props.id}`);\r\n processControl(view$);\r\n appJson.views.push(view$);\r\n }\r\n });\r\n return appJson;\r\n}\r\n\r\nfunction CalcClassForControl(control: Control, controlClasses: string[] ){\r\n if (control.controlType != MgControlType.CTRL_TYPE_TABPAGE){\r\n\r\n if (control.controlType === MgControlType.CTRL_TYPE_BUTTON && control.props.button_style === CtrlButtonTypeGui.Image) {\r\n controlClasses.push(\"button_image_background_size\");\r\n }\r\n\r\n if (control.controlType === MgControlType.CTRL_TYPE_LABEL) {\r\n controlClasses.push(\"lable_overflow\");\r\n }\r\n\r\n\r\n if (control.controlType === MgControlType.CTRL_TYPE_COLUMN ) {\r\n controlClasses.push(\"table_row\");\r\n }\r\n\r\n if (control.controlType === MgControlType.CTRL_TYPE_TABLE){\r\n\r\n if (control.props.scroll_bar) {\r\n controlClasses.push(\"table_scrollBar\");\r\n }\r\n }\r\n\r\n if(control.controlType === MgControlType.CTRL_TYPE_TABLE || control.controlType === MgControlType.CTRL_TYPE_GROUP) {\r\n controlClasses.push(\"container_border\");\r\n }\r\n\r\n // if (control.children) {\r\n // control.children.forEach((ctrl$: Control) => {\r\n // CalcClassForControl(ctrl$, controlClasses)\r\n // });\r\n // }\r\n }\r\n}\r\n///////////////////////////////////////////////////////////////////////////////////////////////////\r\n// for each special chars we will add \"\\\" before the special char.\r\n// For example : control name \"Blabla?\" the class name will be \"Blabla\\?\"\r\n///////////////////////////////////////////////////////////////////////////////////////////////////\r\nfunction getControlClassNameInCss(controlNameStr: string): string {\r\n var controlName = controlNameStr;\r\n\r\n //The following chars are created problem in css = [\"!\" \",\" \"+\", \":\", \",\", \"~\", \";\", \"\\\"\" \"{\" \"}\" \">\" \" \"];\r\n //TODO:need to be check with Rotem let specialCharsForRotem = [\"!\"];\r\n\r\n // replace all special chars\r\n let specialCharsWork = [\"\\\\\", \"#\", \"$\", \"%\", \"&\", \"(\", \")\", \"*\", \"-\", \".\", \"/\", \"<\", \"=\", \"?\", \"@\", \"[\", \"]\", \"^\", \"`\", \"|\"];\r\n for (let i = 0; i < specialCharsWork.length; i++) {\r\n controlName = controlName.split(specialCharsWork[i]).join(\"\\\\\" + specialCharsWork[i]);\r\n }\r\n\r\n return controlName;\r\n}\r\n\r\n//////////////////////////////////////////////////////////////////\r\n// recursively process the controls' properties, find the classes used for the control\r\n//////////////////////////////////////////////////////////////////\r\nfunction processControl(control: Control) {\r\n\r\n const categoryNames: string[] = Object.keys(Map);\r\n\r\n //LogLn(\">> Generating CSS class list for \\\"\" + control.props.id + \"\\\"\");\r\n\r\n const controlClasses: string[] = [];\r\n\r\n // use the control's id as a class\r\n //control[\"class_name_in_css\"] = getControlClassNameInCss(control.props.id);\r\n //controlClasses.push(control.props.id + \"Props\");\r\n CalcClassForControl(control, controlClasses);\r\n\r\n // loop on all item names from the \"Map\" object\r\n categoryNames.forEach((catName) => {\r\n let catRuleArray: { name: string, suffix?: string, options?: { [val: string]: string } }[] = Map[catName];\r\n\r\n catRuleArray.forEach((rule, i) => {\r\n\r\n let ruleSet$;\r\n if (control[catName]) {\r\n ruleSet$ = control[catName][rule.name];\r\n }\r\n else {\r\n return;\r\n }\r\n if (isNullOrUndefined(ruleSet$)) return;\r\n\r\n // ... or turn on the has-expession flag\r\n if (!isNullOrUndefined(ruleSet$.has_exp) && ruleSet$.has_exp) {\r\n control.hasClassExpression = true;\r\n }\r\n // find and keep the class name...\r\n else {\r\n if (Map[catName] && Map[catName][i] && Map[catName][i] && Map[catName][i]['options']) {\r\n if (!isNullOrUndefined(Map[catName][i]['options'][String(ruleSet$)]))\r\n controlClasses.push(Map[catName][i]['options'][String(ruleSet$)]);\r\n }\r\n else {\r\n controlClasses.push(Map[catName] && Map[catName][i] && Map[catName][i] && Map[catName][i]['suffix'] + ruleSet$);\r\n }\r\n }\r\n\r\n });\r\n\r\n control.classes = controlClasses.join(' ');\r\n });\r\n\r\n //LogLn(\"generated classes \\\"\" + control.classes + \"\\\"\");\r\n\r\n // go over control's children\r\n if (control.children) {\r\n //LogLn(\"processing child controls...\");\r\n control.children.forEach((ctrl$: Control) => {\r\n processControl(ctrl$)\r\n });\r\n //LogLn(\"...children processing done\")\r\n }\r\n\r\n}\r\n"]}
@@ -1,5 +1,5 @@
1
- import { MagicOptionScheme } from "./magic-option.scheme";
2
- import { Rule } from "@angular-devkit/schematics";
3
- import { TemplateConfig } from "../../../types/index";
4
- export declare function buildControl(options: MagicOptionScheme, module_name: string): Rule;
5
- export declare function generate(file: TemplateConfig, options: MagicOptionScheme): Rule;
1
+ import { MagicOptionScheme } from "./magic-option.scheme";
2
+ import { Rule } from "@angular-devkit/schematics";
3
+ import { TemplateConfig } from "../../../types/index";
4
+ export declare function buildControl(options: MagicOptionScheme, module_name: string): Rule;
5
+ export declare function generate(file: TemplateConfig, options: MagicOptionScheme): Rule;
@@ -1,75 +1,74 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generate = exports.buildControl = void 0;
4
- const schematics_1 = require("@angular-devkit/schematics");
5
- const index_1 = require("../../../types/index");
6
- const Util_1 = require("../Util");
7
- const env_1 = require("../env");
8
- const EJS = require("ejs");
9
- const Util_2 = require("../Util");
10
- const jsbeautify = require("js-beautify");
11
- const generate_rule_1 = require("./generate.rule");
12
- const htmlBeautify = jsbeautify.html;
13
- //
14
- // build the HTML of a single control
15
- //
16
- function buildControl(options, module_name) {
17
- return (host, context) => {
18
- const metadata = env_1.env.metadata;
19
- const view = env_1.env.app.views[0];
20
- let rules = [];
21
- const viewId = view.props.id;
22
- const dest = metadata.paths.getDestPathForComponent(module_name, view.props.component_path);
23
- const data = {
24
- MgControlType: index_1.MgControlType,
25
- theme: metadata.theme,
26
- CtrlButtonTypeGui: index_1.CtrlButtonTypeGui,
27
- SideType: index_1.SideType,
28
- StorageAttributeType: index_1.StorageAttributeType,
29
- TableWebStyle: index_1.TableWebStyle,
30
- RowEditingTypes: index_1.RowEditingTypes,
31
- WindowType: index_1.WindowType,
32
- WindowPosition: index_1.WindowPosition,
33
- Util: Util_1.Util,
34
- child: view,
35
- ctrl: view,
36
- app: env_1.env.app,
37
- magicConfig: metadata.config,
38
- };
39
- const componentFiles = [
40
- {
41
- type: index_1.GeneratedFileTypes.HTML,
42
- template: './templates/themes/control.ejs',
43
- destination: dest,
44
- name: `${viewId}.component.html`,
45
- data: data
46
- },
47
- ];
48
- componentFiles.forEach(templateConfig => {
49
- rules.push(generate(templateConfig, options));
50
- });
51
- return (0, schematics_1.chain)(rules)(host, context);
52
- };
53
- }
54
- exports.buildControl = buildControl;
55
- //
56
- // Call EJS to generate HTML and write the result to stdout
57
- //
58
- function generate(file, options) {
59
- return (host, context) => {
60
- EJS.renderFile(`${env_1.MAGIC_CLI_FOLDER}/${file.template}`, file.data, {}, (err, output) => {
61
- try {
62
- output = (0, generate_rule_1.createGenFuncs)(output, file.type);
63
- }
64
- catch (err) {
65
- (0, Util_2.logErr)(output);
66
- (0, Util_2.logErr)(err);
67
- }
68
- // send the output directly to the stdout, so the calling app will get it
69
- console.log(output);
70
- });
71
- return host;
72
- };
73
- }
74
- exports.generate = generate;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildControl = buildControl;
4
+ exports.generate = generate;
5
+ const schematics_1 = require("@angular-devkit/schematics");
6
+ const index_1 = require("../../../types/index");
7
+ const Util_1 = require("../Util");
8
+ const env_1 = require("../env");
9
+ const EJS = require("ejs");
10
+ const Util_2 = require("../Util");
11
+ const jsbeautify = require("js-beautify");
12
+ const generate_rule_1 = require("./generate.rule");
13
+ const htmlBeautify = jsbeautify.html;
14
+ //
15
+ // build the HTML of a single control
16
+ //
17
+ function buildControl(options, module_name) {
18
+ return (host, context) => {
19
+ const metadata = env_1.env.metadata;
20
+ const view = env_1.env.app.views[0];
21
+ let rules = [];
22
+ const viewId = view.props.id;
23
+ const dest = metadata.paths.getDestPathForComponent(module_name, view.props.component_path);
24
+ const data = {
25
+ MgControlType: index_1.MgControlType,
26
+ theme: metadata.theme,
27
+ CtrlButtonTypeGui: index_1.CtrlButtonTypeGui,
28
+ SideType: index_1.SideType,
29
+ StorageAttributeType: index_1.StorageAttributeType,
30
+ TableWebStyle: index_1.TableWebStyle,
31
+ RowEditingTypes: index_1.RowEditingTypes,
32
+ WindowType: index_1.WindowType,
33
+ WindowPosition: index_1.WindowPosition,
34
+ Util: Util_1.Util,
35
+ child: view,
36
+ ctrl: view,
37
+ app: env_1.env.app,
38
+ magicConfig: metadata.config,
39
+ };
40
+ const componentFiles = [
41
+ {
42
+ type: index_1.GeneratedFileTypes.HTML,
43
+ template: './templates/themes/control.ejs',
44
+ destination: dest,
45
+ name: `${viewId}.component.html`,
46
+ data: data
47
+ },
48
+ ];
49
+ componentFiles.forEach(templateConfig => {
50
+ rules.push(generate(templateConfig, options));
51
+ });
52
+ return (0, schematics_1.chain)(rules)(host, context);
53
+ };
54
+ }
55
+ //
56
+ // Call EJS to generate HTML and write the result to stdout
57
+ //
58
+ function generate(file, options) {
59
+ return (host, context) => {
60
+ EJS.renderFile(`${env_1.MAGIC_CLI_FOLDER}/${file.template}`, file.data, {}, (err, output) => {
61
+ try {
62
+ output = (0, generate_rule_1.createGenFuncs)(output, file.type);
63
+ }
64
+ catch (err) {
65
+ (0, Util_2.logErr)(output);
66
+ (0, Util_2.logErr)(err);
67
+ }
68
+ // send the output directly to the stdout, so the calling app will get it
69
+ console.log(output);
70
+ });
71
+ return host;
72
+ };
73
+ }
75
74
  //# sourceMappingURL=build-control.rule.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"build-control.rule.js","sourceRoot":"","sources":["build-control.rule.ts"],"names":[],"mappings":";;;AACA,2DAAiF;AACjF,gDAW8B;AAC9B,kCAA+B;AAC/B,gCAA2D;AAC3D,2BAA2B;AAC3B,kCAAsC;AACtC,0CAA0C;AAC1C,mDAAiD;AAEjD,MAAM,YAAY,GAAG,UAAU,CAAC,IAAI,CAAC;AAErC,EAAE;AACF,qCAAqC;AACrC,EAAE;AACF,SAAgB,YAAY,CAAC,OAAyB,EAAE,WAAkB;IACxE,OAAO,CAAC,IAAS,EAAE,OAAyB,EAAC,EAAE;QAC7C,MAAM,QAAQ,GAAG,SAAG,CAAC,QAAQ,CAAC;QAC9B,MAAM,IAAI,GAAM,SAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACjC,IAAI,KAAK,GAAU,EAAE,CAAC;QAEpB,MAAM,MAAM,GAAK,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,GAAO,QAAQ,CAAC,KAAK,CAAC,uBAAuB,CAAC,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAChG,MAAM,IAAI,GAAO;YACf,aAAa,EAAO,qBAAa;YACjC,KAAK,EAAe,QAAQ,CAAC,KAAK;YAClC,iBAAiB,EAAG,yBAAiB;YACrC,QAAQ,EAAY,gBAAQ;YAC5B,oBAAoB,EAAE,4BAAoB;YAC1C,aAAa,EAAO,qBAAa;YACjC,eAAe,EAAK,uBAAe;YACnC,UAA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C,CAAC;QACtB,CAAC,CAAC,CAAC;QACL,OAAO,IAAI,CAAC;IACd,CAAC,CAAA;AACH,CAAC;AAnBD,4BAmBC","sourcesContent":["import { 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 { Util } from \"../Util\";\r\nimport { env, GEN_FOLDER, MAGIC_CLI_FOLDER } from \"../env\";\r\nimport * as EJS from 'ejs';\r\nimport { logErr, Log } from \"../Util\";\r\nimport * as jsbeautify from 'js-beautify';\r\nimport { createGenFuncs } from \"./generate.rule\";\r\n\r\nconst htmlBeautify = jsbeautify.html;\r\n\r\n//\r\n// build the HTML of a single control\r\n//\r\nexport function buildControl(options:MagicOptionScheme, module_name:string) : Rule {\r\n return (host:Tree, context: SchematicContext)=>{\r\n const metadata = env.metadata;\r\n const view = env.app.views[0];\r\n let rules:Rule[] = [];\r\n\r\n const viewId = view.props.id;\r\n const dest = metadata.paths.getDestPathForComponent(module_name, view.props.component_path);\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 child : view,\r\n ctrl : view,\r\n app : env.app,\r\n magicConfig : metadata.config,\r\n };\r\n const componentFiles: TemplateConfig[] = [\r\n {\r\n type: GeneratedFileTypes.HTML,\r\n template: './templates/themes/control.ejs',\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 rules.push(generate(templateConfig, options));\r\n });\r\n\r\n return chain(rules)(host,context);\r\n }\r\n}\r\n\r\n//\r\n// Call EJS to generate HTML and write the result to stdout\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 {},\r\n (err, output) => {\r\n try {\r\n output = createGenFuncs(output, file.type);\r\n }\r\n catch (err) {\r\n logErr(output);\r\n logErr(err);\r\n }\r\n // send the output directly to the stdout, so the calling app will get it\r\n console.log(output);\r\n });\r\n return host;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"build-control.rule.js","sourceRoot":"","sources":["build-control.rule.ts"],"names":[],"mappings":";;AA0BA,oCAuCC;AAKD,4BAmBC;AAxFD,2DAAiF;AACjF,gDAW8B;AAC9B,kCAA+B;AAC/B,gCAA2D;AAC3D,2BAA2B;AAC3B,kCAAsC;AACtC,0CAA0C;AAC1C,mDAAiD;AAEjD,MAAM,YAAY,GAAG,UAAU,CAAC,IAAI,CAAC;AAErC,EAAE;AACF,qCAAqC;AACrC,EAAE;AACF,SAAgB,YAAY,CAAC,OAAyB,EAAE,WAAkB;IACxE,OAAO,CAAC,IAAS,EAAE,OAAyB,EAAC,EAAE;QAC7C,MAAM,QAAQ,GAAG,SAAG,CAAC,QAAQ,CAAC;QAC9B,MAAM,IAAI,GAAM,SAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACjC,IAAI,KAAK,GAAU,EAAE,CAAC;QAEpB,MAAM,MAAM,GAAK,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,GAAO,QAAQ,CAAC,KAAK,CAAC,uBAAuB,CAAC,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAChG,MAAM,IAAI,GAAO;YACf,aAAa,EAAO,qBAA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CAAC;YAC7C,CAAC;YACD,OAAO,GAAG,EAAE,CAAC;gBACX,IAAA,aAAM,EAAC,MAAM,CAAC,CAAC;gBACf,IAAA,aAAM,EAAC,GAAG,CAAC,CAAC;YACd,CAAC;YACD,yEAAyE;YACzE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACtB,CAAC,CAAC,CAAC;QACL,OAAO,IAAI,CAAC;IACd,CAAC,CAAA;AACH,CAAC","sourcesContent":["import { 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 { Util } from \"../Util\";\r\nimport { env, GEN_FOLDER, MAGIC_CLI_FOLDER } from \"../env\";\r\nimport * as EJS from 'ejs';\r\nimport { logErr, Log } from \"../Util\";\r\nimport * as jsbeautify from 'js-beautify';\r\nimport { createGenFuncs } from \"./generate.rule\";\r\n\r\nconst htmlBeautify = jsbeautify.html;\r\n\r\n//\r\n// build the HTML of a single control\r\n//\r\nexport function buildControl(options:MagicOptionScheme, module_name:string) : Rule {\r\n return (host:Tree, context: SchematicContext)=>{\r\n const metadata = env.metadata;\r\n const view = env.app.views[0];\r\n let rules:Rule[] = [];\r\n\r\n const viewId = view.props.id;\r\n const dest = metadata.paths.getDestPathForComponent(module_name, view.props.component_path);\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 child : view,\r\n ctrl : view,\r\n app : env.app,\r\n magicConfig : metadata.config,\r\n };\r\n const componentFiles: TemplateConfig[] = [\r\n {\r\n type: GeneratedFileTypes.HTML,\r\n template: './templates/themes/control.ejs',\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 rules.push(generate(templateConfig, options));\r\n });\r\n\r\n return chain(rules)(host,context);\r\n }\r\n}\r\n\r\n//\r\n// Call EJS to generate HTML and write the result to stdout\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 {},\r\n (err, output) => {\r\n try {\r\n output = createGenFuncs(output, file.type);\r\n }\r\n catch (err) {\r\n logErr(output);\r\n logErr(err);\r\n }\r\n // send the output directly to the stdout, so the calling app will get it\r\n console.log(output);\r\n });\r\n return host;\r\n }\r\n}\r\n"]}
@@ -1,3 +1,3 @@
1
- import { MagicOptionScheme } from "./magic-option.scheme";
2
- import { Rule } from "@angular-devkit/schematics";
3
- export declare function buildViews(options: MagicOptionScheme, module_name: string): Rule;
1
+ import { MagicOptionScheme } from "./magic-option.scheme";
2
+ import { Rule } from "@angular-devkit/schematics";
3
+ export declare function buildViews(options: MagicOptionScheme, module_name: string): Rule;