ngx-axis-appforge 0.0.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 (447) hide show
  1. package/.editorconfig +17 -0
  2. package/README.md +111 -0
  3. package/angular.json +40 -0
  4. package/axis-components/badge/badge.css +3 -0
  5. package/axis-components/badge/badge.html +20 -0
  6. package/axis-components/badge/badge.options.ts +23 -0
  7. package/axis-components/badge/badge.ts +17 -0
  8. package/axis-components/badge/design/config.ts +52 -0
  9. package/axis-components/badge/design/ng-package.json +5 -0
  10. package/axis-components/badge/design/setting/setting.css +0 -0
  11. package/axis-components/badge/design/setting/setting.html +181 -0
  12. package/axis-components/badge/design/setting/setting.ts +126 -0
  13. package/axis-components/badge/ng-package.json +5 -0
  14. package/axis-components/button/button.css +3 -0
  15. package/axis-components/button/button.html +13 -0
  16. package/axis-components/button/button.options.ts +17 -0
  17. package/axis-components/button/button.ts +56 -0
  18. package/axis-components/button/design/config.ts +30 -0
  19. package/axis-components/button/design/ng-package.json +5 -0
  20. package/axis-components/button/design/setting/setting.css +0 -0
  21. package/axis-components/button/design/setting/setting.html +151 -0
  22. package/axis-components/button/design/setting/setting.ts +76 -0
  23. package/axis-components/button/ng-package.json +5 -0
  24. package/axis-components/cmp-map.ts +52 -0
  25. package/axis-components/cmplib.ts +9 -0
  26. package/axis-components/desc/desc.css +8 -0
  27. package/axis-components/desc/desc.html +19 -0
  28. package/axis-components/desc/desc.options.ts +24 -0
  29. package/axis-components/desc/desc.ts +29 -0
  30. package/axis-components/desc/design/config.ts +113 -0
  31. package/axis-components/desc/design/desc-item-setting/desc-item-setting.css +0 -0
  32. package/axis-components/desc/design/desc-item-setting/desc-item-setting.html +47 -0
  33. package/axis-components/desc/design/desc-item-setting/desc-item-setting.ts +40 -0
  34. package/axis-components/desc/design/desc-items-menu/desc-items-menu.css +0 -0
  35. package/axis-components/desc/design/desc-items-menu/desc-items-menu.html +9 -0
  36. package/axis-components/desc/design/desc-items-menu/desc-items-menu.ts +23 -0
  37. package/axis-components/desc/design/desc-setting/desc-setting.css +0 -0
  38. package/axis-components/desc/design/desc-setting/desc-setting.html +76 -0
  39. package/axis-components/desc/design/desc-setting/desc-setting.ts +51 -0
  40. package/axis-components/desc/design/ng-package.json +5 -0
  41. package/axis-components/desc/ng-package.json +5 -0
  42. package/axis-components/design/cmplib/cmplib.css +5 -0
  43. package/axis-components/design/cmplib/cmplib.html +52 -0
  44. package/axis-components/design/cmplib/cmplib.ts +96 -0
  45. package/axis-components/design/design/config.ts +29 -0
  46. package/axis-components/design/design/ng-package.json +5 -0
  47. package/axis-components/design/design/setting/setting.css +0 -0
  48. package/axis-components/design/design/setting/setting.html +33 -0
  49. package/axis-components/design/design/setting/setting.ts +33 -0
  50. package/axis-components/design/design.css +15 -0
  51. package/axis-components/design/design.html +51 -0
  52. package/axis-components/design/design.options.ts +9 -0
  53. package/axis-components/design/design.ts +509 -0
  54. package/axis-components/design/ng-package.json +5 -0
  55. package/axis-components/design/preview/drag.service.ts +148 -0
  56. package/axis-components/design/preview/drop-handler.ts +56 -0
  57. package/axis-components/design/preview/preview.css +3 -0
  58. package/axis-components/design/preview/preview.html +1 -0
  59. package/axis-components/design/preview/preview.ts +250 -0
  60. package/axis-components/design/preview/select.service.ts +140 -0
  61. package/axis-components/design/shortcut-key.ts +160 -0
  62. package/axis-components/design/toolbar/toolbar.css +24 -0
  63. package/axis-components/design/toolbar/toolbar.html +96 -0
  64. package/axis-components/design/toolbar/toolbar.ts +65 -0
  65. package/axis-components/design/tree/drag-drop.ts +125 -0
  66. package/axis-components/design/tree/tree.css +30 -0
  67. package/axis-components/design/tree/tree.html +49 -0
  68. package/axis-components/design/tree/tree.ts +292 -0
  69. package/axis-components/dynamic-container/design/config.ts +30 -0
  70. package/axis-components/dynamic-container/design/ng-package.json +5 -0
  71. package/axis-components/dynamic-container/design/setting/setting.css +0 -0
  72. package/axis-components/dynamic-container/design/setting/setting.html +20 -0
  73. package/axis-components/dynamic-container/design/setting/setting.ts +30 -0
  74. package/axis-components/dynamic-container/dynamic-container.css +3 -0
  75. package/axis-components/dynamic-container/dynamic-container.html +2 -0
  76. package/axis-components/dynamic-container/dynamic-container.options.ts +6 -0
  77. package/axis-components/dynamic-container/dynamic-container.ts +17 -0
  78. package/axis-components/dynamic-container/ng-package.json +5 -0
  79. package/axis-components/editor/editor.css +47 -0
  80. package/axis-components/editor/editor.html +10 -0
  81. package/axis-components/editor/editor.options.ts +10 -0
  82. package/axis-components/editor/editor.ts +86 -0
  83. package/axis-components/editor/ng-package.json +5 -0
  84. package/axis-components/examples/examples/badge.ts +17 -0
  85. package/axis-components/examples/examples/button.ts +38 -0
  86. package/axis-components/examples/examples/desc.ts +31 -0
  87. package/axis-components/examples/examples/design.ts +15 -0
  88. package/axis-components/examples/examples/dynamic-container.ts +21 -0
  89. package/axis-components/examples/examples/flex.ts +18 -0
  90. package/axis-components/examples/examples/form-item.ts +39 -0
  91. package/axis-components/examples/examples/form.ts +315 -0
  92. package/axis-components/examples/examples/icon.ts +16 -0
  93. package/axis-components/examples/examples/image.ts +15 -0
  94. package/axis-components/examples/examples/input-component.ts +15 -0
  95. package/axis-components/examples/examples/input-icon.ts +15 -0
  96. package/axis-components/examples/examples/input-json.ts +15 -0
  97. package/axis-components/examples/examples/input-number.ts +15 -0
  98. package/axis-components/examples/examples/input.ts +15 -0
  99. package/axis-components/examples/examples/modal.ts +15 -0
  100. package/axis-components/examples/examples/scope.ts +17 -0
  101. package/axis-components/examples/examples/single-selector.ts +25 -0
  102. package/axis-components/examples/examples/splitter.ts +36 -0
  103. package/axis-components/examples/examples/table.ts +126 -0
  104. package/axis-components/examples/examples/text.ts +15 -0
  105. package/axis-components/examples/examples/textarea.ts +15 -0
  106. package/axis-components/examples/examples/tree-selector.ts +35 -0
  107. package/axis-components/examples/examples/upload.ts +15 -0
  108. package/axis-components/examples/examples.ts +73 -0
  109. package/axis-components/flex/design/config.ts +49 -0
  110. package/axis-components/flex/design/ng-package.json +5 -0
  111. package/axis-components/flex/design/setting/setting.css +0 -0
  112. package/axis-components/flex/design/setting/setting.html +72 -0
  113. package/axis-components/flex/design/setting/setting.ts +43 -0
  114. package/axis-components/flex/flex.css +5 -0
  115. package/axis-components/flex/flex.html +6 -0
  116. package/axis-components/flex/flex.options.ts +12 -0
  117. package/axis-components/flex/flex.ts +15 -0
  118. package/axis-components/flex/ng-package.json +5 -0
  119. package/axis-components/form/design/config.ts +71 -0
  120. package/axis-components/form/design/ng-package.json +5 -0
  121. package/axis-components/form/design/setting/setting.css +0 -0
  122. package/axis-components/form/design/setting/setting.html +21 -0
  123. package/axis-components/form/design/setting/setting.ts +31 -0
  124. package/axis-components/form/form.css +3 -0
  125. package/axis-components/form/form.html +3 -0
  126. package/axis-components/form/form.options.ts +9 -0
  127. package/axis-components/form/form.ts +121 -0
  128. package/axis-components/form/ng-package.json +5 -0
  129. package/axis-components/form-item/design/config.ts +43 -0
  130. package/axis-components/form-item/design/ng-package.json +5 -0
  131. package/axis-components/form-item/design/setting/input-validator/input-validator.css +8 -0
  132. package/axis-components/form-item/design/setting/input-validator/input-validator.html +140 -0
  133. package/axis-components/form-item/design/setting/input-validator/input-validator.ts +158 -0
  134. package/axis-components/form-item/design/setting/setting.css +0 -0
  135. package/axis-components/form-item/design/setting/setting.html +39 -0
  136. package/axis-components/form-item/design/setting/setting.ts +40 -0
  137. package/axis-components/form-item/form-item.css +4 -0
  138. package/axis-components/form-item/form-item.html +16 -0
  139. package/axis-components/form-item/form-item.options.ts +12 -0
  140. package/axis-components/form-item/form-item.ts +128 -0
  141. package/axis-components/form-item/ng-package.json +5 -0
  142. package/axis-components/icon/design/config.ts +29 -0
  143. package/axis-components/icon/design/ng-package.json +5 -0
  144. package/axis-components/icon/design/setting/setting.css +0 -0
  145. package/axis-components/icon/design/setting/setting.html +67 -0
  146. package/axis-components/icon/design/setting/setting.ts +48 -0
  147. package/axis-components/icon/icon.css +0 -0
  148. package/axis-components/icon/icon.html +7 -0
  149. package/axis-components/icon/icon.options.ts +10 -0
  150. package/axis-components/icon/icon.ts +17 -0
  151. package/axis-components/icon/ng-package.json +5 -0
  152. package/axis-components/image/design/config.ts +30 -0
  153. package/axis-components/image/design/ng-package.json +5 -0
  154. package/axis-components/image/design/setting/setting.css +0 -0
  155. package/axis-components/image/design/setting/setting.html +42 -0
  156. package/axis-components/image/design/setting/setting.ts +37 -0
  157. package/axis-components/image/image.css +58 -0
  158. package/axis-components/image/image.html +14 -0
  159. package/axis-components/image/image.options.ts +8 -0
  160. package/axis-components/image/image.ts +29 -0
  161. package/axis-components/image/ng-package.json +5 -0
  162. package/axis-components/input/design/config.ts +80 -0
  163. package/axis-components/input/design/ng-package.json +5 -0
  164. package/axis-components/input/design/setting/setting.css +0 -0
  165. package/axis-components/input/design/setting/setting.html +79 -0
  166. package/axis-components/input/design/setting/setting.ts +51 -0
  167. package/axis-components/input/input.css +4 -0
  168. package/axis-components/input/input.html +32 -0
  169. package/axis-components/input/input.options.ts +14 -0
  170. package/axis-components/input/input.ts +53 -0
  171. package/axis-components/input/ng-package.json +5 -0
  172. package/axis-components/input-component/design/config.ts +30 -0
  173. package/axis-components/input-component/design/ng-package.json +5 -0
  174. package/axis-components/input-component/design/setting/setting.css +0 -0
  175. package/axis-components/input-component/design/setting/setting.html +33 -0
  176. package/axis-components/input-component/design/setting/setting.ts +33 -0
  177. package/axis-components/input-component/input-component.css +4 -0
  178. package/axis-components/input-component/input-component.html +25 -0
  179. package/axis-components/input-component/input-component.options.ts +7 -0
  180. package/axis-components/input-component/input-component.ts +50 -0
  181. package/axis-components/input-component/ng-package.json +5 -0
  182. package/axis-components/input-icon/design/config.ts +30 -0
  183. package/axis-components/input-icon/design/ng-package.json +5 -0
  184. package/axis-components/input-icon/design/setting/setting.css +0 -0
  185. package/axis-components/input-icon/design/setting/setting.html +29 -0
  186. package/axis-components/input-icon/design/setting/setting.ts +33 -0
  187. package/axis-components/input-icon/input-icon.css +4 -0
  188. package/axis-components/input-icon/input-icon.html +70 -0
  189. package/axis-components/input-icon/input-icon.options.ts +7 -0
  190. package/axis-components/input-icon/input-icon.ts +51 -0
  191. package/axis-components/input-icon/ng-package.json +5 -0
  192. package/axis-components/input-json/design/config.ts +29 -0
  193. package/axis-components/input-json/design/ng-package.json +5 -0
  194. package/axis-components/input-json/design/setting/setting.css +0 -0
  195. package/axis-components/input-json/design/setting/setting.html +7 -0
  196. package/axis-components/input-json/design/setting/setting.ts +26 -0
  197. package/axis-components/input-json/input-json.css +4 -0
  198. package/axis-components/input-json/input-json.html +19 -0
  199. package/axis-components/input-json/input-json.ts +67 -0
  200. package/axis-components/input-json/ng-package.json +5 -0
  201. package/axis-components/input-number/design/config.ts +30 -0
  202. package/axis-components/input-number/design/ng-package.json +5 -0
  203. package/axis-components/input-number/design/setting/setting.css +0 -0
  204. package/axis-components/input-number/design/setting/setting.html +118 -0
  205. package/axis-components/input-number/design/setting/setting.ts +66 -0
  206. package/axis-components/input-number/input-number.css +22 -0
  207. package/axis-components/input-number/input-number.html +11 -0
  208. package/axis-components/input-number/input-number.options.ts +17 -0
  209. package/axis-components/input-number/input-number.ts +30 -0
  210. package/axis-components/input-number/ng-package.json +5 -0
  211. package/axis-components/modal/design/config.ts +50 -0
  212. package/axis-components/modal/design/ng-package.json +5 -0
  213. package/axis-components/modal/design/set-modal-visible-handler/set-modal-visible-handler.css +0 -0
  214. package/axis-components/modal/design/set-modal-visible-handler/set-modal-visible-handler.html +15 -0
  215. package/axis-components/modal/design/set-modal-visible-handler/set-modal-visible-handler.ts +34 -0
  216. package/axis-components/modal/design/setting/setting.css +0 -0
  217. package/axis-components/modal/design/setting/setting.html +139 -0
  218. package/axis-components/modal/design/setting/setting.ts +92 -0
  219. package/axis-components/modal/modal.css +0 -0
  220. package/axis-components/modal/modal.html +7 -0
  221. package/axis-components/modal/modal.options.ts +20 -0
  222. package/axis-components/modal/modal.ts +57 -0
  223. package/axis-components/modal/ng-package.json +5 -0
  224. package/axis-components/ng-package.json +5 -0
  225. package/axis-components/scope/design/config.ts +59 -0
  226. package/axis-components/scope/design/ng-package.json +5 -0
  227. package/axis-components/scope/design/setting/datasource-editor/datasource-editor.css +28 -0
  228. package/axis-components/scope/design/setting/datasource-editor/datasource-editor.html +188 -0
  229. package/axis-components/scope/design/setting/datasource-editor/datasource-editor.ts +245 -0
  230. package/axis-components/scope/design/setting/setting.css +0 -0
  231. package/axis-components/scope/design/setting/setting.html +19 -0
  232. package/axis-components/scope/design/setting/setting.ts +30 -0
  233. package/axis-components/scope/ng-package.json +5 -0
  234. package/axis-components/scope/scope.css +6 -0
  235. package/axis-components/scope/scope.html +4 -0
  236. package/axis-components/scope/scope.options.ts +8 -0
  237. package/axis-components/scope/scope.ts +48 -0
  238. package/axis-components/single-selector/design/config.ts +30 -0
  239. package/axis-components/single-selector/design/ng-package.json +5 -0
  240. package/axis-components/single-selector/design/setting/setting.css +0 -0
  241. package/axis-components/single-selector/design/setting/setting.html +164 -0
  242. package/axis-components/single-selector/design/setting/setting.ts +80 -0
  243. package/axis-components/single-selector/ng-package.json +5 -0
  244. package/axis-components/single-selector/single-selector.css +8 -0
  245. package/axis-components/single-selector/single-selector.html +51 -0
  246. package/axis-components/single-selector/single-selector.options.ts +22 -0
  247. package/axis-components/single-selector/single-selector.ts +80 -0
  248. package/axis-components/splitter/design/config.ts +84 -0
  249. package/axis-components/splitter/design/ng-package.json +5 -0
  250. package/axis-components/splitter/design/splitter-menu/splitter-menu.css +0 -0
  251. package/axis-components/splitter/design/splitter-menu/splitter-menu.html +10 -0
  252. package/axis-components/splitter/design/splitter-menu/splitter-menu.ts +22 -0
  253. package/axis-components/splitter/design/splitter-panel-setting/splitter-panel-setting.css +0 -0
  254. package/axis-components/splitter/design/splitter-panel-setting/splitter-panel-setting.html +66 -0
  255. package/axis-components/splitter/design/splitter-panel-setting/splitter-panel-setting.ts +47 -0
  256. package/axis-components/splitter/design/splitter-setting/splitter-setting.css +0 -0
  257. package/axis-components/splitter/design/splitter-setting/splitter-setting.html +28 -0
  258. package/axis-components/splitter/design/splitter-setting/splitter-setting.ts +30 -0
  259. package/axis-components/splitter/ng-package.json +5 -0
  260. package/axis-components/splitter/splitter.css +7 -0
  261. package/axis-components/splitter/splitter.html +12 -0
  262. package/axis-components/splitter/splitter.options.ts +18 -0
  263. package/axis-components/splitter/splitter.ts +29 -0
  264. package/axis-components/table/design/config.ts +147 -0
  265. package/axis-components/table/design/ng-package.json +5 -0
  266. package/axis-components/table/design/table-field-setting/table-field-setting.css +0 -0
  267. package/axis-components/table/design/table-field-setting/table-field-setting.html +259 -0
  268. package/axis-components/table/design/table-field-setting/table-field-setting.ts +105 -0
  269. package/axis-components/table/design/table-fields-menu/table-fields-menu.css +0 -0
  270. package/axis-components/table/design/table-fields-menu/table-fields-menu.html +9 -0
  271. package/axis-components/table/design/table-fields-menu/table-fields-menu.ts +24 -0
  272. package/axis-components/table/design/table-setting/table-setting.css +0 -0
  273. package/axis-components/table/design/table-setting/table-setting.html +417 -0
  274. package/axis-components/table/design/table-setting/table-setting.ts +173 -0
  275. package/axis-components/table/expand.ts +12 -0
  276. package/axis-components/table/ng-package.json +5 -0
  277. package/axis-components/table/select.ts +66 -0
  278. package/axis-components/table/table-setter/table-setter.css +55 -0
  279. package/axis-components/table/table-setter/table-setter.html +38 -0
  280. package/axis-components/table/table-setter/table-setter.ts +121 -0
  281. package/axis-components/table/table.css +5 -0
  282. package/axis-components/table/table.html +191 -0
  283. package/axis-components/table/table.options.ts +72 -0
  284. package/axis-components/table/table.ts +204 -0
  285. package/axis-components/text/design/config.ts +30 -0
  286. package/axis-components/text/design/ng-package.json +5 -0
  287. package/axis-components/text/design/setting/setting.css +0 -0
  288. package/axis-components/text/design/setting/setting.html +84 -0
  289. package/axis-components/text/design/setting/setting.ts +54 -0
  290. package/axis-components/text/ng-package.json +5 -0
  291. package/axis-components/text/text.css +3 -0
  292. package/axis-components/text/text.html +17 -0
  293. package/axis-components/text/text.options.ts +10 -0
  294. package/axis-components/text/text.ts +54 -0
  295. package/axis-components/textarea/design/config.ts +30 -0
  296. package/axis-components/textarea/design/ng-package.json +5 -0
  297. package/axis-components/textarea/design/setting/setting.css +0 -0
  298. package/axis-components/textarea/design/setting/setting.html +76 -0
  299. package/axis-components/textarea/design/setting/setting.ts +55 -0
  300. package/axis-components/textarea/ng-package.json +5 -0
  301. package/axis-components/textarea/textarea.css +4 -0
  302. package/axis-components/textarea/textarea.html +11 -0
  303. package/axis-components/textarea/textarea.options.ts +13 -0
  304. package/axis-components/textarea/textarea.ts +49 -0
  305. package/axis-components/tree-selector/design/config.ts +55 -0
  306. package/axis-components/tree-selector/design/ng-package.json +5 -0
  307. package/axis-components/tree-selector/design/tree-selector-menu/tree-selector-menu.css +0 -0
  308. package/axis-components/tree-selector/design/tree-selector-menu/tree-selector-menu.html +9 -0
  309. package/axis-components/tree-selector/design/tree-selector-menu/tree-selector-menu.ts +26 -0
  310. package/axis-components/tree-selector/design/tree-selector-menu-setting/tree-selector-menu-setting.css +0 -0
  311. package/axis-components/tree-selector/design/tree-selector-menu-setting/tree-selector-menu-setting.html +80 -0
  312. package/axis-components/tree-selector/design/tree-selector-menu-setting/tree-selector-menu-setting.ts +58 -0
  313. package/axis-components/tree-selector/design/tree-selector-setting/tree-selector-setting.css +0 -0
  314. package/axis-components/tree-selector/design/tree-selector-setting/tree-selector-setting.html +235 -0
  315. package/axis-components/tree-selector/design/tree-selector-setting/tree-selector-setting.ts +87 -0
  316. package/axis-components/tree-selector/ng-package.json +5 -0
  317. package/axis-components/tree-selector/tree-selector.css +43 -0
  318. package/axis-components/tree-selector/tree-selector.html +65 -0
  319. package/axis-components/tree-selector/tree-selector.options.ts +50 -0
  320. package/axis-components/tree-selector/tree-selector.ts +252 -0
  321. package/axis-components/upload/design/config.ts +37 -0
  322. package/axis-components/upload/design/ng-package.json +5 -0
  323. package/axis-components/upload/design/setting/setting.css +0 -0
  324. package/axis-components/upload/design/setting/setting.html +288 -0
  325. package/axis-components/upload/design/setting/setting.ts +96 -0
  326. package/axis-components/upload/ng-package.json +5 -0
  327. package/axis-components/upload/upload.css +3 -0
  328. package/axis-components/upload/upload.html +36 -0
  329. package/axis-components/upload/upload.options.ts +29 -0
  330. package/axis-components/upload/upload.ts +130 -0
  331. package/axis-components-covers/badge.svg +1 -0
  332. package/axis-components-covers/button.svg +14 -0
  333. package/axis-components-covers/desc.svg +39 -0
  334. package/axis-components-covers/design.jpg +0 -0
  335. package/axis-components-covers/dynamic-container.svg +9 -0
  336. package/axis-components-covers/flex.svg +33 -0
  337. package/axis-components-covers/form-item.svg +22 -0
  338. package/axis-components-covers/form.svg +38 -0
  339. package/axis-components-covers/icon.svg +22 -0
  340. package/axis-components-covers/image.svg +13 -0
  341. package/axis-components-covers/input-component.svg +27 -0
  342. package/axis-components-covers/input-icon.svg +29 -0
  343. package/axis-components-covers/input-json.svg +29 -0
  344. package/axis-components-covers/input-number.svg +35 -0
  345. package/axis-components-covers/input.svg +21 -0
  346. package/axis-components-covers/modal.svg +23 -0
  347. package/axis-components-covers/scope.svg +9 -0
  348. package/axis-components-covers/single-selector.svg +20 -0
  349. package/axis-components-covers/splitter.svg +8 -0
  350. package/axis-components-covers/table.svg +27 -0
  351. package/axis-components-covers/text.svg +22 -0
  352. package/axis-components-covers/textarea.svg +9 -0
  353. package/axis-components-covers/tree-selector.svg +77 -0
  354. package/axis-components-covers/upload.svg +26 -0
  355. package/core/base/base-menu.ts +22 -0
  356. package/core/base/base.ts +143 -0
  357. package/core/base/design-builder.ts +8 -0
  358. package/core/base/funfield-base.ts +106 -0
  359. package/core/base/funfield-value-base.ts +53 -0
  360. package/core/base/value-access.ts +70 -0
  361. package/core/directives/dynamic.ts +216 -0
  362. package/core/directives/scope.ts +432 -0
  363. package/core/models/api.options.ts +5 -0
  364. package/core/models/base.options.ts +11 -0
  365. package/core/models/cmplib.ts +7 -0
  366. package/core/models/data-source.options.ts +11 -0
  367. package/core/models/data.options.ts +6 -0
  368. package/core/models/design-build.ts +26 -0
  369. package/core/models/design-config.ts +14 -0
  370. package/core/models/design-tree-node.ts +16 -0
  371. package/core/models/event-desc.ts +28 -0
  372. package/core/models/event-handler.ts +6 -0
  373. package/core/models/event.options.ts +14 -0
  374. package/core/models/examples.ts +21 -0
  375. package/core/models/form-registe.options.ts +12 -0
  376. package/core/models/fun-field.options.ts +6 -0
  377. package/core/models/initobs.ts +8 -0
  378. package/core/models/options-node.ts +149 -0
  379. package/core/models/static-data-source.options.ts +4 -0
  380. package/core/models/trigge-events.options.ts +3 -0
  381. package/core/models/value-access.options.ts +10 -0
  382. package/core/ng-package.json +5 -0
  383. package/core/pipes/how-long.pipe.ts +69 -0
  384. package/core/public-api.ts +39 -0
  385. package/core/share/api-handler/api-handler.css +0 -0
  386. package/core/share/api-handler/api-handler.html +38 -0
  387. package/core/share/api-handler/api-handler.ts +51 -0
  388. package/core/share/array-filter-handler/array-filter-handler.css +0 -0
  389. package/core/share/array-filter-handler/array-filter-handler.html +26 -0
  390. package/core/share/array-filter-handler/array-filter-handler.ts +65 -0
  391. package/core/share/array-filter-handler/input-filter-options/filter-options.css +19 -0
  392. package/core/share/array-filter-handler/input-filter-options/filter-options.html +57 -0
  393. package/core/share/array-filter-handler/input-filter-options/filter-options.ts +100 -0
  394. package/core/share/base-design-setting/base-design-setting.css +0 -0
  395. package/core/share/base-design-setting/base-design-setting.html +50 -0
  396. package/core/share/base-design-setting/base-design-setting.ts +55 -0
  397. package/core/share/base-event-handler-descs.ts +100 -0
  398. package/core/share/common-menu/common-menu.css +0 -0
  399. package/core/share/common-menu/common-menu.html +21 -0
  400. package/core/share/common-menu/common-menu.ts +73 -0
  401. package/core/share/data-handler/data-handler.css +0 -0
  402. package/core/share/data-handler/data-handler.html +13 -0
  403. package/core/share/data-handler/data-handler.ts +39 -0
  404. package/core/share/events-handler.service.ts +185 -0
  405. package/core/share/fun-field/fun-field.css +55 -0
  406. package/core/share/fun-field/fun-field.html +175 -0
  407. package/core/share/fun-field/fun-field.ts +363 -0
  408. package/core/share/input-trigger/input-trigger.css +16 -0
  409. package/core/share/input-trigger/input-trigger.html +114 -0
  410. package/core/share/input-trigger/input-trigger.ts +394 -0
  411. package/core/share/msg-tip-handler/msg-tip-handler.css +0 -0
  412. package/core/share/msg-tip-handler/msg-tip-handler.html +40 -0
  413. package/core/share/msg-tip-handler/msg-tip-handler.ts +46 -0
  414. package/core/share/refresh-data-source-handler/refresh-data-source-handler.css +0 -0
  415. package/core/share/refresh-data-source-handler/refresh-data-source-handler.html +29 -0
  416. package/core/share/refresh-data-source-handler/refresh-data-source-handler.ts +55 -0
  417. package/core/share/route-handler/route-handler.css +0 -0
  418. package/core/share/route-handler/route-handler.html +49 -0
  419. package/core/share/route-handler/route-handler.ts +51 -0
  420. package/core/share/set-data-source-handler/set-data-source-handler.css +0 -0
  421. package/core/share/set-data-source-handler/set-data-source-handler.html +23 -0
  422. package/core/share/set-data-source-handler/set-data-source-handler.ts +44 -0
  423. package/core/share/simple-menu/simple-menu.css +0 -0
  424. package/core/share/simple-menu/simple-menu.html +5 -0
  425. package/core/share/simple-menu/simple-menu.ts +17 -0
  426. package/core/share/tokens.ts +29 -0
  427. package/core/share/value-design-setting/value-design-setting.css +0 -0
  428. package/core/share/value-design-setting/value-design-setting.html +48 -0
  429. package/core/share/value-design-setting/value-design-setting.ts +54 -0
  430. package/core/utils/code-name.utils.ts +19 -0
  431. package/core/utils/components-loader.ts +29 -0
  432. package/core/utils/declaration.utils.ts +38 -0
  433. package/core/utils/dynamic.util.ts +57 -0
  434. package/core/utils/form-validators.ts +160 -0
  435. package/core/utils/form.util.ts +25 -0
  436. package/core/utils/http.utils.ts +8 -0
  437. package/core/utils/object.utils.ts +182 -0
  438. package/core/utils/scripts-loader.ts +25 -0
  439. package/ng-package.json +13 -0
  440. package/package.json +37 -0
  441. package/providers/ng-package.json +5 -0
  442. package/providers/providers.ts +44 -0
  443. package/providers/public-api.ts +1 -0
  444. package/public-api.ts +1 -0
  445. package/tsconfig.json +38 -0
  446. package/tsconfig.lib.json +19 -0
  447. package/tsconfig.lib.prod.json +11 -0
@@ -0,0 +1,23 @@
1
+ <form nz-form [formGroup]="fg">
2
+ <nz-form-item>
3
+ <nz-form-label [nzSpan]="6" nzRequired>
4
+ 数据源名
5
+ </nz-form-label>
6
+ <nz-form-control nzSpan="18">
7
+ <axis-fun-field formControlName="name" [noListen]="noListen()">
8
+ <input nz-input ngModel [ngModelOptions]="{standalone:true}" />
9
+ </axis-fun-field>
10
+ </nz-form-control>
11
+ </nz-form-item>
12
+ <nz-form-item>
13
+ <nz-form-label [nzSpan]="6">
14
+ 数据
15
+ </nz-form-label>
16
+ <nz-form-control nzSpan="18">
17
+ <axis-fun-field formControlName="data" [noListen]="noListen()">
18
+ <ng-container [axisDynamic]="{component:'axis-components/input-json',inuse:true}" [standalone]="true"
19
+ ngModel [ngModelOptions]="{standalone:true}"></ng-container>
20
+ </axis-fun-field>
21
+ </nz-form-control>
22
+ </nz-form-item>
23
+ </form>
@@ -0,0 +1,44 @@
1
+ import { ChangeDetectionStrategy, Component, forwardRef, inject } from '@angular/core';
2
+ import { FormsModule, NG_VALUE_ACCESSOR, ReactiveFormsModule, UntypedFormGroup } from '@angular/forms';
3
+ import { NzFormModule } from 'ng-zorro-antd/form';
4
+ import { FunField } from '../fun-field/fun-field';
5
+ import { NzSelectModule } from 'ng-zorro-antd/select';
6
+ import { DynamicDirective } from '../../directives/dynamic';
7
+ import { NzInputModule } from 'ng-zorro-antd/input';
8
+ import { NzSwitchModule } from 'ng-zorro-antd/switch';
9
+ import { NzRadioModule } from 'ng-zorro-antd/radio';
10
+ import { FunFieldValueBase } from '../../base/funfield-value-base';
11
+ import { FormValidators } from '../../utils/form-validators';
12
+ import { FunFieldOptions } from '../../models/fun-field.options';
13
+ import { InputTrigger } from '../input-trigger/input-trigger';
14
+
15
+ @Component({
16
+ selector: 'axis-set-data-source-handler',
17
+ imports: [NzFormModule, ReactiveFormsModule, FunField, FormsModule, NzSelectModule, DynamicDirective, NzInputModule, NzSwitchModule, NzRadioModule],
18
+ templateUrl: './set-data-source-handler.html',
19
+ styleUrl: './set-data-source-handler.css',
20
+ changeDetection: ChangeDetectionStrategy.OnPush,
21
+ providers: [
22
+ {
23
+ provide: NG_VALUE_ACCESSOR,
24
+ useExisting: forwardRef(() => SetDataSourceHandler),
25
+ multi: true
26
+ }
27
+ ]
28
+ })
29
+ export class SetDataSourceHandler extends FunFieldValueBase {
30
+ readonly noListen = inject(InputTrigger).noListen;
31
+ override fg: UntypedFormGroup = this.fb.group({
32
+ name: [undefined, FormValidators.requiredFun],
33
+ data: [],
34
+ });
35
+
36
+ protected override funFields: FunFieldOptions = {
37
+ name: {
38
+ defaultValue: null,
39
+ },
40
+ data: {
41
+ defaultValue: null,
42
+ },
43
+ };
44
+ }
File without changes
@@ -0,0 +1,5 @@
1
+ <nz-dropdown-menu #menu="nzDropdownMenu">
2
+ <ul nz-menu>
3
+ <axis-common-menu [baseMenu]="this"></axis-common-menu>
4
+ </ul>
5
+ </nz-dropdown-menu>
@@ -0,0 +1,17 @@
1
+ import { ChangeDetectionStrategy, Component } from '@angular/core';
2
+ import { NzDropDownModule } from 'ng-zorro-antd/dropdown';
3
+ import { NzIconModule } from 'ng-zorro-antd/icon';
4
+ import { CommonMenu } from '../common-menu/common-menu';
5
+ import { BaseMenu } from '../../base/base-menu';
6
+
7
+ @Component({
8
+ selector: 'axis-design-simple-menu',
9
+ imports: [NzDropDownModule, NzIconModule, CommonMenu],
10
+ templateUrl: './simple-menu.html',
11
+ styleUrl: './simple-menu.css',
12
+ changeDetection: ChangeDetectionStrategy.OnPush,
13
+ })
14
+ export class SimpleMenu extends BaseMenu {
15
+
16
+
17
+ }
@@ -0,0 +1,29 @@
1
+ import { InjectionToken } from "@angular/core";
2
+ import { ScopeInfo } from "../models/design-build";
3
+ import { OptionsNode } from "../models/options-node";
4
+ import { ComponentsLoader } from "../utils/components-loader";
5
+ import { BehaviorSubject, Observable } from "rxjs";
6
+ import { EventHandlerDesc, EventHandlerDescGroup } from "../models/event-desc";
7
+ import { RegisteFormControlOptions, RegisteValueAccessOptions } from "../models/form-registe.options";
8
+ import { DesignConfig } from "../models/design-config";
9
+ import { ExampleGroup } from "../models/examples";
10
+ import { EventsHandler } from "../models/event-handler";
11
+
12
+ export const AXIS_DESIGN_OPTIONS_NODE_FOR_MENU = new InjectionToken<{ current: OptionsNode, parent?: OptionsNode }>('axis.design.optionsNodeForMenu');
13
+ export const AXIS_DESIGN_SCOPE_INFOS_GETTER_TOKEN = new InjectionToken<(scopeId?: string) => BehaviorSubject<ScopeInfo[]>>('axis.design.scopeInfosGetter');
14
+ export const AXIS_DESIGN_COMPONENT_INFO_FOR_SETTING_TOKEN = new InjectionToken<{ component: string, componentName: string, nodes: OptionsNode[], eventHandlerDescs: { [event: string]: EventHandlerDesc } }[]>('axis.design.optionsNodesForSetting');
15
+ export const AXIS_DESIGN_ALL_PERMISSIONS_TOKEN = new InjectionToken<{ [permission: string]: string }>('axis.design.allPermissions');
16
+ export const AXIS_DESIGN_CHOOSE_COMPONENT_FUNC_TOKEN = new InjectionToken<(...tags: string[]) => Observable<{ options?: any, config?: DesignConfig }>>('axis.design.chooseComponentFunc');
17
+ export const AXIS_DESIGN_CMPLIBS_TOKEN = new InjectionToken<{ libName: string, lib: ExampleGroup[] }[]>('axis.design.cmplibs');
18
+
19
+ export const AXIS_COMPONENTS_TOKEN = new InjectionToken<{ [module: string]: () => Promise<any> }>('axis.components');
20
+ export const AXIS_COMPONENTS_LOADER_TOKEN = new InjectionToken<ComponentsLoader>('axis.componentsLoader');
21
+ export const AXIS_SCRIPTS_TOKEN = new InjectionToken<{ [name: string]: string }>('axis.scripts');
22
+ export const AXIS_EVENT_HANDLERS_TOKEN = new InjectionToken<EventsHandler[]>('axis.eventHandlers');
23
+ export const AXIS_EVENT_HANDLER_DESCS_TOKEN = new InjectionToken<EventHandlerDescGroup[]>('axis.eventHandlersDescs');
24
+ export const AXIS_INJECT_DATA_TOKEN = new InjectionToken<any>('axis.injectData');
25
+ export const AXIS_INJECT_FUNC_TOKEN = new InjectionToken<{ [name: string]: Function }>('axis.injectFunc');
26
+ export const AXIS_CURRENT_USER_PERMISSIONS_TOKEN = new InjectionToken<string[]>('axis.currentUserPermissions');
27
+
28
+ export const AXIS_FORM_REGISTE_CONTROL_TOKEN = new InjectionToken<(opt: RegisteFormControlOptions) => void>('axis.form.registeControl');
29
+ export const AXIS_FORMITEM_REGISTE_VALUE_ACCESS_TOKEN = new InjectionToken<(opt: RegisteValueAccessOptions) => void>('axis.form-item.registeValueAccess');
@@ -0,0 +1,48 @@
1
+ <form [formGroup]="fg()" nz-form>
2
+ <nz-collapse [nzBordered]="false">
3
+ <nz-collapse-panel nzHeader="值组件设置">
4
+ <nz-form-item>
5
+ <nz-form-label nzSpan="8">
6
+ 初始值
7
+ </nz-form-label>
8
+ <nz-form-control nzSpan="16">
9
+ <axis-fun-field formControlName="initValue" [exclude]="exclude()" [scopeId]="scopeId()">
10
+ <ng-container [axisDynamic]="{component:'axis-components/input-json',inuse:true}"
11
+ [standalone]="true" ngModel [ngModelOptions]="{standalone:true}"></ng-container>
12
+ </axis-fun-field>
13
+ </nz-form-control>
14
+ </nz-form-item>
15
+ <nz-form-item>
16
+ <nz-form-label nzSpan="8" nzRequired>
17
+ 初始事件
18
+ </nz-form-label>
19
+ <nz-form-control nzSpan="16">
20
+ <nz-switch formControlName="emitInitEvent"></nz-switch>
21
+ </nz-form-control>
22
+ </nz-form-item>
23
+ <nz-form-item>
24
+ <nz-form-label nzSpan="8" nzRequired>
25
+ 禁用
26
+ </nz-form-label>
27
+ <nz-form-control nzSpan="16">
28
+ <axis-fun-field formControlName="disabled" [exclude]="exclude()" [scopeId]="scopeId()">
29
+ <nz-switch ngModel [ngModelOptions]="{standalone:true}"></nz-switch>
30
+ </axis-fun-field>
31
+ </nz-form-control>
32
+ </nz-form-item>
33
+ <nz-form-item>
34
+ <nz-form-label nzSpan="8" nzRequired>
35
+ 只读
36
+ </nz-form-label>
37
+ <nz-form-control nzSpan="16">
38
+ <axis-fun-field formControlName="readonly" [exclude]="exclude()" [scopeId]="scopeId()">
39
+ <nz-switch ngModel [ngModelOptions]="{standalone:true}"></nz-switch>
40
+ </axis-fun-field>
41
+ </nz-form-control>
42
+ </nz-form-item>
43
+ </nz-collapse-panel>
44
+ @if (showLine()) {
45
+ <div></div>
46
+ }
47
+ </nz-collapse>
48
+ </form>
@@ -0,0 +1,54 @@
1
+ import { AfterViewInit, ChangeDetectionStrategy, Component, ElementRef, input, signal } from '@angular/core';
2
+ import { NzCollapseModule } from 'ng-zorro-antd/collapse';
3
+ import { NzFormModule } from 'ng-zorro-antd/form';
4
+ import { FunField } from '../fun-field/fun-field';
5
+ import { NzSwitchModule } from 'ng-zorro-antd/switch';
6
+ import { FormsModule, ReactiveFormsModule, UntypedFormGroup } from '@angular/forms';
7
+ import { NzInputModule } from 'ng-zorro-antd/input';
8
+ import { DynamicDirective } from '../../directives/dynamic';
9
+ import { FormValidators } from '../../utils/form-validators';
10
+ import { NzSelectModule } from 'ng-zorro-antd/select';
11
+ import { FunFieldOptions } from '../../models/fun-field.options';
12
+
13
+ @Component({
14
+ selector: 'axis-value-design-setting',
15
+ imports: [NzCollapseModule, NzFormModule, FunField, NzSwitchModule, FormsModule, NzInputModule, ReactiveFormsModule, DynamicDirective, NzSelectModule],
16
+ templateUrl: './value-design-setting.html',
17
+ styleUrl: './value-design-setting.css',
18
+ changeDetection: ChangeDetectionStrategy.OnPush,
19
+ })
20
+ export class ValueDesignSetting implements AfterViewInit {
21
+
22
+ constructor(private element: ElementRef) { }
23
+
24
+ readonly showLine = signal(false);
25
+ readonly scopeId = input<string>();
26
+ readonly exclude = input<string[]>([]);
27
+
28
+ fg = input.required<UntypedFormGroup>();
29
+
30
+ ngAfterViewInit(): void {
31
+ if (this.element.nativeElement.nextElementSibling) {
32
+ this.showLine.set(true);
33
+ }
34
+ }
35
+ }
36
+
37
+ export const valueFbConfig = {
38
+ initValue: [],
39
+ emitInitEvent: [true, FormValidators.required],
40
+ disabled: [undefined, [FormValidators.requiredFun]],
41
+ readonly: [undefined, [FormValidators.requiredFun]],
42
+ };
43
+
44
+ export const valueFunField: FunFieldOptions = {
45
+ initValue: {
46
+ defaultValue: undefined
47
+ },
48
+ disabled: {
49
+ defaultValue: false
50
+ },
51
+ readonly: {
52
+ defaultValue: false
53
+ }
54
+ }
@@ -0,0 +1,19 @@
1
+ export function codeName(code?: string, name?: string): string {
2
+ if (code && name) {
3
+ return `[${code}]${name}`
4
+ }
5
+ if (code) {
6
+ return `[${code}]`
7
+ }
8
+ return name || "";
9
+ }
10
+
11
+ export function nameCode(name?: string, code?: string): string {
12
+ if (code && name) {
13
+ return `${name}[${code}]`
14
+ }
15
+ if (code) {
16
+ return `[${code}]`
17
+ }
18
+ return name || "";
19
+ }
@@ -0,0 +1,29 @@
1
+ import { inject, Injectable } from "@angular/core";
2
+ import { AXIS_COMPONENTS_TOKEN } from "../share/tokens";
3
+
4
+ @Injectable()
5
+ export class ComponentsLoader {
6
+
7
+ private readonly components = inject(AXIS_COMPONENTS_TOKEN);
8
+ private readonly loadedMap = new Map<string, any>();
9
+ private readonly loadingMap = new Map<string, Promise<any>>();
10
+
11
+ loadComponent(component: string): Promise<any> {
12
+ if (this.loadedMap.has(component)) {
13
+ return Promise.resolve(this.loadedMap.get(component)!);
14
+ }
15
+ if (this.loadingMap.has(component)) {
16
+ return this.loadingMap.get(component)!;
17
+ }
18
+ if (!this.components[component]) {
19
+ return Promise.reject(`component ${component} not found`)
20
+ }
21
+ this.loadingMap.set(component, this.components[component]().then(module => {
22
+ const m = module[Object.keys(module)[0]];
23
+ this.loadedMap.set(component, m);
24
+ this.loadingMap.delete(component);
25
+ return m;
26
+ }));
27
+ return this.loadingMap.get(component)!;
28
+ }
29
+ }
@@ -0,0 +1,38 @@
1
+ // 生成变量的类型声明
2
+ export function generateDeclarations(args: any): string {
3
+ return Object.entries(args).map(([name, value]) =>
4
+ `declare const ${name}: ${convertToTsType(value)};`
5
+ ).join('\n');
6
+ }
7
+
8
+ // 将 JavaScript 值转换为 TypeScript 类型表达式
9
+ function convertToTsType(value: any): string {
10
+ if (value === null) return 'null';
11
+ if (value === undefined) return 'undefined';
12
+
13
+ const type = typeof value;
14
+
15
+ if (type === 'string') return 'string';
16
+ if (type === 'number') return 'number';
17
+ if (type === 'boolean') return 'boolean';
18
+ if (type === 'function') return 'Function';
19
+
20
+ if (Array.isArray(value)) {
21
+ if (value.length > 0) {
22
+ return `Array<${convertToTsType(value[0])}>`;
23
+ }
24
+ return 'any[]';
25
+ }
26
+
27
+ if (type === 'object') {
28
+ const props = Object.entries(value)
29
+ .map(([key, val]) =>
30
+ `${key}: ${convertToTsType(val)};`
31
+ )
32
+ .join('\n ');
33
+
34
+ return `{\n ${props}\n}`;
35
+ }
36
+
37
+ return 'any';
38
+ }
@@ -0,0 +1,57 @@
1
+
2
+ export interface DynamicFnOptions {
3
+ fnBody?: string;
4
+ args?: any[] | object;
5
+ }
6
+
7
+ const notDefinedRegDefault = /^(.*) is not defined$/;
8
+ const notDefinedRegIOS = /^Can't find variable: (.*)$/;
9
+ export function fn(fnBody: string, argsObj: any, ignoreUndefined = false, printError = true) {
10
+ let argsName: string[] = [];
11
+ let args: any[] = [];
12
+ if (argsObj) {
13
+ argsName = Object.keys(argsObj);
14
+ args = argsName.map(n => argsObj[n]);
15
+ }
16
+ while (true) {
17
+ try {
18
+ const fun = new Function(...argsName, fnBody);
19
+ if (fun && fun instanceof Function) {
20
+ return fun(...args);
21
+ } else if (printError) {
22
+ _consoleError(fnBody, args, argsName);
23
+ }
24
+ } catch (e) {
25
+ if (ignoreUndefined && e instanceof ReferenceError && (notDefinedRegDefault.test(e.message) || notDefinedRegIOS.test(e.message))) {
26
+ const defaultMatch = notDefinedRegDefault.exec(e.message);
27
+ const iosMatch = notDefinedRegIOS.exec(e.message);
28
+ if (defaultMatch) {
29
+ argsName.push(defaultMatch[1]);
30
+ continue;
31
+ } else if (iosMatch && iosMatch[1]) {
32
+ argsName.push(iosMatch[1]);
33
+ continue;
34
+ }
35
+ }
36
+ if (printError) {
37
+ _consoleError(fnBody, args, argsName, e as Error);
38
+ }
39
+ }
40
+ return null;
41
+ }
42
+
43
+ }
44
+
45
+ function _consoleError(fnBody: string, args: any[], argsName: string[], e?: Error) {
46
+ let ds: any[] = [];
47
+ args.forEach((e, i) => {
48
+ ds[i] = { name: argsName[i], value: e };
49
+ });
50
+ console.groupCollapsed(`%c 函数${e ? '编译' : '执行'}失败`, "color:red");
51
+ if (e) {
52
+ console.error("失败原因", e.message);
53
+ }
54
+ console.log("函数体", fnBody);
55
+ console.log("数据源", ds);
56
+ console.groupEnd();
57
+ }
@@ -0,0 +1,160 @@
1
+ import { AbstractControl, UntypedFormControl, ValidationErrors, ValidatorFn, Validators } from "@angular/forms";
2
+ import { NzSafeAny } from "ng-zorro-antd/core/types";
3
+
4
+ export type MyErrorsOptions = { 'zh-cn': string } & Record<string, NzSafeAny>;
5
+ export type MyValidationErrors = Record<string, MyErrorsOptions>;
6
+
7
+ export class FormValidators extends Validators {
8
+
9
+ static override required(control: AbstractControl): ValidationErrors | null {
10
+ let error = Validators.required(control);
11
+ if (error) {
12
+ return { required: { 'zh-cn': "必填项" } };
13
+ }
14
+ return null;
15
+ }
16
+
17
+ static requiredFun(control: AbstractControl): ValidationErrors | null {
18
+ let error = FormValidators.required(control);
19
+ if (!error) {
20
+ error = FormValidators.required(new UntypedFormControl(control.value?.funMode ? control.value?.fnValue.fn : control.value?.originValue));
21
+ }
22
+ if (error) {
23
+ return { required: { 'zh-cn': "必填项" } };
24
+ }
25
+ return null;
26
+ }
27
+
28
+
29
+ static equal(comparedValue: string | (() => string | null)) {
30
+ return (control: AbstractControl): ValidationErrors | null => {
31
+ if (!control.value) {
32
+ return null;
33
+ }
34
+ let cv;
35
+ if (typeof (comparedValue) != "function") {
36
+ cv = comparedValue;
37
+ } else {
38
+ try { cv = comparedValue(); } catch { }
39
+ }
40
+ return control.value != cv ? { notEqual: true } : null;
41
+ }
42
+ }
43
+
44
+ static override minLength(minLength: number): ValidatorFn {
45
+ const validator = Validators.minLength(minLength);
46
+ return (control: AbstractControl): MyValidationErrors | null => {
47
+ if (validator(control) === null) {
48
+ return null;
49
+ }
50
+ return { minlength: { 'zh-cn': `最小长度为 ${minLength}` } };
51
+ };
52
+ }
53
+
54
+ static override maxLength(maxLength: number): ValidatorFn {
55
+ const validator = Validators.maxLength(maxLength);
56
+ return (control: AbstractControl): MyValidationErrors | null => {
57
+ if (validator(control) === null) {
58
+ return null;
59
+ }
60
+ return { minlength: { 'zh-cn': `最大长度为 ${maxLength}` } };
61
+ };
62
+ }
63
+
64
+ static override min(minvalue: number): ValidatorFn {
65
+ const validator = Validators.min(minvalue);
66
+ return (control: AbstractControl): MyValidationErrors | null => {
67
+ if (validator(control) === null) {
68
+ return null;
69
+ }
70
+ return { minlength: { 'zh-cn': `最小值为 ${minvalue}` } };
71
+ };
72
+ }
73
+
74
+ static override max(maxvalue: number): ValidatorFn {
75
+ const validator = Validators.max(maxvalue);
76
+ return (control: AbstractControl): MyValidationErrors | null => {
77
+ if (validator(control) === null) {
78
+ return null;
79
+ }
80
+ return { minlength: { 'zh-cn': `最大值为 ${maxvalue}` } };
81
+ };
82
+ }
83
+
84
+ static override pattern(pattern: string | RegExp): ValidatorFn {
85
+ const validator = Validators.pattern(pattern);
86
+ return (control: AbstractControl): MyValidationErrors | null => {
87
+ if (validator(control) === null) {
88
+ return null;
89
+ }
90
+ return { pattern: { 'zh-cn': "输入不正确" } };
91
+ };
92
+ }
93
+
94
+ // static uniqueConstraints(constraintsGroup: string, keyField: string | undefined, editTable: EditTableComponent): ValidatorFn {
95
+ // const fields = editTable.fields.filter(f => f.validators?.some(v => v.startsWith(`uniqueConstraints:${constraintsGroup}`)));
96
+ // const errText = fields.map(f => `[${f.title}]`).join("加") + "须唯一";
97
+ // return (control: AbstractControl): MyValidationErrors | null => {
98
+ // if (!control.parent) {
99
+ // return null;
100
+ // }
101
+ // control.parent.updateValueAndValidity();
102
+ // const rowValue = control.parent?.value;
103
+ // const otherCtrl = Array.from(editTable.ctrlMap.values())
104
+ // .filter(c => c != control.parent);
105
+ // if (otherCtrl
106
+ // .some(c => fields.every(f => {
107
+ // let value1 = c.value[f.field];
108
+ // let value2 = rowValue[f.field];
109
+ // if (keyField) {
110
+ // value1 = value1?.[keyField];
111
+ // value2 = value2?.[keyField];
112
+ // }
113
+ // return value1 == value2;
114
+ // }))) {
115
+ // return { uniqueConstraints: { 'zh-cn': errText } };
116
+ // }
117
+ // return null;
118
+ // };
119
+ // }
120
+
121
+ // static datasource(dataSourceName: string, host?: EditTableComponent | FormComponent, triggeEvent?: TriggeEventOptions): AsyncValidatorFn {
122
+ // return (control: AbstractControl): Promise<MyValidationErrors | null> | Observable<MyValidationErrors | null> => {
123
+ // return host?.triggeEvent("controlValid", { value: control.value }, triggeEvent)
124
+ // .pipe(mergeMap(_ => host!.dataSource!.getDataSource(dataSourceName).pipe(take(1), map(error => error ? ({ datasource: { 'zh-cn': error } }) : null)))) || of(null);
125
+ // };
126
+ // }
127
+
128
+ // static _mapValid(valid: string, host?: EditTableComponent | FormComponent): ValidatorFn | null {
129
+ // const validParams = valid.split(":");
130
+ // switch (validParams[0]) {
131
+ // case "required":
132
+ // return FormValidators.required;
133
+ // case "minlength":
134
+ // return FormValidators.minLength(+validParams[1]);
135
+ // case "min":
136
+ // return FormValidators.min(+validParams[1]);
137
+ // case "max":
138
+ // return FormValidators.max(+validParams[1]);
139
+ // case "pattern":
140
+ // return FormValidators.pattern(validParams[1]);
141
+ // case "uniqueConstraints":
142
+ // return FormValidators.uniqueConstraints(validParams[1], validParams[2], host as EditTableComponent);
143
+ // }
144
+ // return null;
145
+ // }
146
+
147
+ // static _mapAsyncValid(valid: string, host?: EditTableComponent | FormComponent, triggeEvent?: TriggeEventOptions): AsyncValidatorFn | null {
148
+ // const validParams = valid.split(":");
149
+ // switch (validParams[0]) {
150
+ // case "datasource":
151
+ // return FormValidators.datasource(validParams[1], host, triggeEvent);
152
+ // }
153
+ // return null;
154
+ // }
155
+
156
+
157
+ // static mapValidators(validators: string[], host?: EditTableComponent | FormComponent, triggeEvent?: TriggeEventOptions): [ValidatorFn[], AsyncValidatorFn[]] {
158
+ // return [validators?.map(v => FormValidators._mapValid(v, host)).filter(e => e).map(e => e as ValidatorFn) || [], validators?.map(v => FormValidators._mapAsyncValid(v, host, triggeEvent)).filter(e => e).map(e => e as AsyncValidatorFn) || []];
159
+ // }
160
+ }
@@ -0,0 +1,25 @@
1
+ import { AbstractControl, FormArray, FormGroup } from "@angular/forms";
2
+
3
+ export function updateAndValidAll(form: FormGroup | FormArray | AbstractControl, options: { markAsDirty?: boolean } = { markAsDirty: true }) {
4
+ let isValid = true;
5
+ if (form instanceof FormGroup) {
6
+ Object.values(form.controls).forEach(control => {
7
+ if (!updateAndValidAll(control, options)) {
8
+ isValid = false;
9
+ }
10
+ });
11
+ } else if (form instanceof FormArray) {
12
+ form.controls.forEach(control => {
13
+ if (!updateAndValidAll(control, options)) {
14
+ isValid = false;
15
+ }
16
+ })
17
+ } else {
18
+ if (options.markAsDirty ?? true) {
19
+ form.markAsDirty();
20
+ }
21
+ form.updateValueAndValidity({ onlySelf: true });
22
+ isValid = form.valid;
23
+ }
24
+ return isValid;
25
+ }
@@ -0,0 +1,8 @@
1
+ import { HttpClient, HttpRequest } from "@angular/common/http";
2
+ import { ApiOptions } from "../models/api.options";
3
+ import { map, catchError, of, Observable } from "rxjs";
4
+
5
+ export function sendApi(opt: ApiOptions, http: HttpClient): Observable<any> {
6
+ return http.request(new HttpRequest(opt.method?.toUpperCase() as any || "GET", opt.url, opt.body))
7
+ .pipe(map((h: any) => h.body), catchError(e => of(undefined)));
8
+ }