monkey-front-components 0.0.384 → 0.0.387

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 (276) hide show
  1. package/esm2020/lib/components/base/base-component.mjs +322 -0
  2. package/esm2020/lib/components/base/base-dynamic-array.mjs +221 -0
  3. package/esm2020/lib/components/base/base-dynamic.mjs +99 -0
  4. package/esm2020/lib/components/base/base-scroll-component.mjs +55 -0
  5. package/esm2020/lib/components/base/base-validators.mjs +19 -0
  6. package/esm2020/lib/components/base/index.mjs +6 -0
  7. package/esm2020/lib/components/dynamic/button/button.component.mjs +52 -0
  8. package/esm2020/lib/components/dynamic/button/index.mjs +2 -0
  9. package/esm2020/lib/components/dynamic/dynamic-directive.mjs +95 -0
  10. package/esm2020/lib/components/dynamic/dynamic.module.mjs +84 -0
  11. package/esm2020/lib/components/dynamic/file-upload/file-upload.component.mjs +52 -0
  12. package/esm2020/lib/components/dynamic/file-upload/index.mjs +2 -0
  13. package/esm2020/lib/components/dynamic/form/dynamic-form-array.component.mjs +72 -0
  14. package/esm2020/lib/components/dynamic/form/dynamic-form.component.mjs +46 -0
  15. package/esm2020/lib/components/dynamic/form/index.mjs +3 -0
  16. package/esm2020/lib/components/dynamic/index.mjs +9 -0
  17. package/esm2020/lib/components/dynamic/input/index.mjs +2 -0
  18. package/esm2020/lib/components/dynamic/input/input.component.mjs +65 -0
  19. package/esm2020/lib/components/dynamic/input-phone/index.mjs +2 -0
  20. package/esm2020/lib/components/dynamic/input-phone/input-phone.component.mjs +65 -0
  21. package/esm2020/lib/components/dynamic/radio/index.mjs +2 -0
  22. package/esm2020/lib/components/dynamic/radio/radio.component.mjs +33 -0
  23. package/esm2020/lib/components/dynamic/select/index.mjs +2 -0
  24. package/esm2020/lib/components/dynamic/select/select.component.mjs +80 -0
  25. package/esm2020/lib/components/dynamic/select-search/index.mjs +2 -0
  26. package/esm2020/lib/components/dynamic/select-search/select-search.component.mjs +80 -0
  27. package/esm2020/lib/components/index.mjs +4 -0
  28. package/esm2020/lib/components/shared/filter/filter.component.mjs +119 -0
  29. package/esm2020/lib/components/shared/filter/filter.module.mjs +63 -0
  30. package/esm2020/lib/components/shared/filter/index.mjs +3 -0
  31. package/esm2020/lib/components/shared/filter/menu/index.mjs +2 -0
  32. package/esm2020/lib/components/shared/filter/menu/menu.component.mjs +120 -0
  33. package/esm2020/lib/components/shared/filter/menu/menu.module.mjs +70 -0
  34. package/esm2020/lib/components/shared/filter/options/children/children.component.mjs +50 -0
  35. package/esm2020/lib/components/shared/filter/options/children/index.mjs +2 -0
  36. package/esm2020/lib/components/shared/filter/options/currency/currency.component.mjs +46 -0
  37. package/esm2020/lib/components/shared/filter/options/currency/index.mjs +2 -0
  38. package/esm2020/lib/components/shared/filter/options/date-range/date-range.component.mjs +65 -0
  39. package/esm2020/lib/components/shared/filter/options/date-range/index.mjs +2 -0
  40. package/esm2020/lib/components/shared/filter/options/index.mjs +2 -0
  41. package/esm2020/lib/components/shared/filter/options/input/index.mjs +2 -0
  42. package/esm2020/lib/components/shared/filter/options/input/input.component.mjs +46 -0
  43. package/esm2020/lib/components/shared/filter/options/options.component.mjs +68 -0
  44. package/esm2020/lib/components/shared/filter/options/options.module.mjs +95 -0
  45. package/esm2020/lib/components/shared/filter/options/status/index.mjs +2 -0
  46. package/esm2020/lib/components/shared/filter/options/status/status.component.mjs +66 -0
  47. package/esm2020/lib/components/shared/filter/selected/index.mjs +2 -0
  48. package/esm2020/lib/components/shared/filter/selected/item/children/children.component.mjs +57 -0
  49. package/esm2020/lib/components/shared/filter/selected/item/children/index.mjs +2 -0
  50. package/esm2020/lib/components/shared/filter/selected/item/currency/currency.component.mjs +29 -0
  51. package/esm2020/lib/components/shared/filter/selected/item/currency/index.mjs +2 -0
  52. package/esm2020/lib/components/shared/filter/selected/item/date-range/date-range.component.mjs +42 -0
  53. package/esm2020/lib/components/shared/filter/selected/item/date-range/index.mjs +2 -0
  54. package/esm2020/lib/components/shared/filter/selected/item/date-with-action/date-with-action.component.mjs +33 -0
  55. package/esm2020/lib/components/shared/filter/selected/item/date-with-action/index.mjs +2 -0
  56. package/esm2020/lib/components/shared/filter/selected/item/index.mjs +8 -0
  57. package/esm2020/lib/components/shared/filter/selected/item/input/index.mjs +2 -0
  58. package/esm2020/lib/components/shared/filter/selected/item/input/input.component.mjs +28 -0
  59. package/esm2020/lib/components/shared/filter/selected/item/item.component.mjs +74 -0
  60. package/esm2020/lib/components/shared/filter/selected/item/status/index.mjs +2 -0
  61. package/esm2020/lib/components/shared/filter/selected/item/status/status.component.mjs +39 -0
  62. package/esm2020/lib/components/shared/filter/selected/selected.component.mjs +80 -0
  63. package/esm2020/lib/components/shared/filter/selected/selected.module.mjs +90 -0
  64. package/esm2020/lib/components/shared/index.mjs +5 -0
  65. package/esm2020/lib/components/shared/password-strength/index.mjs +3 -0
  66. package/esm2020/lib/components/shared/password-strength/password-strength.component.mjs +85 -0
  67. package/esm2020/lib/components/shared/password-strength/password-strength.mjs +2 -0
  68. package/esm2020/lib/components/shared/password-strength/password-strength.module.mjs +50 -0
  69. package/esm2020/lib/components/shared/products/filter/filter.component.mjs +36 -0
  70. package/esm2020/lib/components/shared/products/index.mjs +3 -0
  71. package/esm2020/lib/components/shared/products/products.component.mjs +91 -0
  72. package/esm2020/lib/components/shared/products/products.module.mjs +22 -0
  73. package/esm2020/lib/components/shared/products/providers/index.mjs +2 -0
  74. package/esm2020/lib/components/shared/products/providers/products.model.mjs +38 -0
  75. package/esm2020/lib/components/shared/progress-bar/index.mjs +4 -0
  76. package/esm2020/lib/components/shared/progress-bar/progress-bar.component.mjs +28 -0
  77. package/esm2020/lib/components/shared/progress-bar/progress-bar.module.mjs +18 -0
  78. package/esm2020/lib/components/shared/progress-bar/progress-bar.service.mjs +49 -0
  79. package/esm2020/lib/interfaces/field-config.mjs +2 -0
  80. package/esm2020/lib/interfaces/index.mjs +2 -0
  81. package/esm2020/monkey-front-components.mjs +5 -0
  82. package/esm2020/public-api.mjs +5 -0
  83. package/fesm2015/monkey-front-components.mjs +2877 -0
  84. package/fesm2015/monkey-front-components.mjs.map +1 -0
  85. package/fesm2020/monkey-front-components.mjs +2859 -0
  86. package/fesm2020/monkey-front-components.mjs.map +1 -0
  87. package/lib/components/base/base-component.d.ts +50 -0
  88. package/lib/components/base/base-dynamic-array.d.ts +34 -0
  89. package/lib/components/base/base-dynamic.d.ts +24 -0
  90. package/lib/components/base/base-scroll-component.d.ts +16 -0
  91. package/lib/components/base/base-validators.d.ts +1 -0
  92. package/{src/lib/components/base/index.ts → lib/components/base/index.d.ts} +5 -5
  93. package/lib/components/dynamic/button/button.component.d.ts +17 -0
  94. package/{src/lib/components/dynamic/button/index.ts → lib/components/dynamic/button/index.d.ts} +1 -1
  95. package/lib/components/dynamic/dynamic-directive.d.ts +22 -0
  96. package/lib/components/dynamic/dynamic.module.d.ts +20 -0
  97. package/lib/components/dynamic/file-upload/file-upload.component.d.ts +17 -0
  98. package/{src/lib/components/dynamic/file-upload/index.ts → lib/components/dynamic/file-upload/index.d.ts} +1 -1
  99. package/lib/components/dynamic/form/dynamic-form-array.component.d.ts +16 -0
  100. package/lib/components/dynamic/form/dynamic-form.component.d.ts +14 -0
  101. package/{src/lib/components/dynamic/form/index.ts → lib/components/dynamic/form/index.d.ts} +2 -2
  102. package/{src/lib/components/dynamic/index.ts → lib/components/dynamic/index.d.ts} +8 -8
  103. package/{src/lib/components/dynamic/input/index.ts → lib/components/dynamic/input/index.d.ts} +1 -1
  104. package/lib/components/dynamic/input/input.component.d.ts +20 -0
  105. package/{src/lib/components/dynamic/input-phone/index.ts → lib/components/dynamic/input-phone/index.d.ts} +1 -1
  106. package/lib/components/dynamic/input-phone/input-phone.component.d.ts +20 -0
  107. package/{src/lib/components/dynamic/radio/index.ts → lib/components/dynamic/radio/index.d.ts} +1 -1
  108. package/lib/components/dynamic/radio/radio.component.d.ts +11 -0
  109. package/{src/lib/components/dynamic/select/index.ts → lib/components/dynamic/select/index.d.ts} +1 -1
  110. package/lib/components/dynamic/select/select.component.d.ts +16 -0
  111. package/{src/lib/components/dynamic/select-search/index.ts → lib/components/dynamic/select-search/index.d.ts} +1 -1
  112. package/lib/components/dynamic/select-search/select-search.component.d.ts +16 -0
  113. package/{src/lib/components/index.ts → lib/components/index.d.ts} +3 -3
  114. package/lib/components/shared/filter/filter.component.d.ts +32 -0
  115. package/lib/components/shared/filter/filter.module.d.ts +14 -0
  116. package/{src/lib/components/shared/filter/index.ts → lib/components/shared/filter/index.d.ts} +2 -2
  117. package/{src/lib/components/shared/filter/menu/index.ts → lib/components/shared/filter/menu/index.d.ts} +1 -1
  118. package/lib/components/shared/filter/menu/menu.component.d.ts +24 -0
  119. package/lib/components/shared/filter/menu/menu.module.d.ts +14 -0
  120. package/lib/components/shared/filter/options/children/children.component.d.ts +17 -0
  121. package/{src/lib/components/shared/filter/options/children/index.ts → lib/components/shared/filter/options/children/index.d.ts} +1 -1
  122. package/lib/components/shared/filter/options/currency/currency.component.d.ts +17 -0
  123. package/{src/lib/components/shared/filter/options/currency/index.ts → lib/components/shared/filter/options/currency/index.d.ts} +1 -1
  124. package/lib/components/shared/filter/options/date-range/date-range.component.d.ts +24 -0
  125. package/{src/lib/components/shared/filter/options/date-range/index.ts → lib/components/shared/filter/options/date-range/index.d.ts} +1 -1
  126. package/{src/lib/components/shared/filter/options/index.ts → lib/components/shared/filter/options/index.d.ts} +1 -1
  127. package/{src/lib/components/shared/filter/options/input/index.ts → lib/components/shared/filter/options/input/index.d.ts} +1 -1
  128. package/lib/components/shared/filter/options/input/input.component.d.ts +17 -0
  129. package/lib/components/shared/filter/options/options.component.d.ts +20 -0
  130. package/lib/components/shared/filter/options/options.module.d.ts +18 -0
  131. package/{src/lib/components/shared/filter/options/status/index.ts → lib/components/shared/filter/options/status/index.d.ts} +1 -1
  132. package/lib/components/shared/filter/options/status/status.component.d.ts +19 -0
  133. package/{src/lib/components/shared/filter/selected/index.ts → lib/components/shared/filter/selected/index.d.ts} +1 -1
  134. package/lib/components/shared/filter/selected/item/children/children.component.d.ts +16 -0
  135. package/{src/lib/components/shared/filter/selected/item/children/index.ts → lib/components/shared/filter/selected/item/children/index.d.ts} +1 -1
  136. package/lib/components/shared/filter/selected/item/currency/currency.component.d.ts +11 -0
  137. package/{src/lib/components/shared/filter/selected/item/currency/index.ts → lib/components/shared/filter/selected/item/currency/index.d.ts} +1 -1
  138. package/lib/components/shared/filter/selected/item/date-range/date-range.component.d.ts +12 -0
  139. package/{src/lib/components/shared/filter/selected/item/date-range/index.ts → lib/components/shared/filter/selected/item/date-range/index.d.ts} +1 -1
  140. package/lib/components/shared/filter/selected/item/date-with-action/date-with-action.component.d.ts +11 -0
  141. package/{src/lib/components/shared/filter/selected/item/date-with-action/index.ts → lib/components/shared/filter/selected/item/date-with-action/index.d.ts} +1 -1
  142. package/{src/lib/components/shared/filter/selected/item/index.ts → lib/components/shared/filter/selected/item/index.d.ts} +7 -7
  143. package/{src/lib/components/shared/filter/selected/item/input/index.ts → lib/components/shared/filter/selected/item/input/index.d.ts} +1 -1
  144. package/lib/components/shared/filter/selected/item/input/input.component.d.ts +11 -0
  145. package/lib/components/shared/filter/selected/item/item.component.d.ts +20 -0
  146. package/{src/lib/components/shared/filter/selected/item/status/index.ts → lib/components/shared/filter/selected/item/status/index.d.ts} +1 -1
  147. package/lib/components/shared/filter/selected/item/status/status.component.d.ts +13 -0
  148. package/lib/components/shared/filter/selected/selected.component.d.ts +18 -0
  149. package/lib/components/shared/filter/selected/selected.module.d.ts +21 -0
  150. package/{src/lib/components/shared/index.ts → lib/components/shared/index.d.ts} +4 -4
  151. package/{src/lib/components/shared/password-strength/index.ts → lib/components/shared/password-strength/index.d.ts} +2 -2
  152. package/lib/components/shared/password-strength/password-strength.component.d.ts +23 -0
  153. package/lib/components/shared/password-strength/password-strength.d.ts +5 -0
  154. package/lib/components/shared/password-strength/password-strength.module.d.ts +12 -0
  155. package/lib/components/shared/products/filter/filter.component.d.ts +12 -0
  156. package/{src/lib/components/shared/products/index.ts → lib/components/shared/products/index.d.ts} +2 -2
  157. package/lib/components/shared/products/products.component.d.ts +20 -0
  158. package/lib/components/shared/products/products.module.d.ts +11 -0
  159. package/{src/lib/components/shared/products/providers/index.ts → lib/components/shared/products/providers/index.d.ts} +1 -1
  160. package/lib/components/shared/products/providers/products.model.d.ts +13 -0
  161. package/{src/lib/components/shared/progress-bar/index.ts → lib/components/shared/progress-bar/index.d.ts} +3 -3
  162. package/lib/components/shared/progress-bar/progress-bar.component.d.ts +12 -0
  163. package/lib/components/shared/progress-bar/progress-bar.module.d.ts +8 -0
  164. package/lib/components/shared/progress-bar/progress-bar.service.d.ts +14 -0
  165. package/lib/interfaces/field-config.d.ts +54 -0
  166. package/{src/lib/interfaces/index.ts → lib/interfaces/index.d.ts} +1 -1
  167. package/monkey-front-components-0.0.387.tgz +0 -0
  168. package/monkey-front-components.d.ts +5 -0
  169. package/package.json +25 -5
  170. package/public-api.d.ts +1 -0
  171. package/karma.conf.js +0 -44
  172. package/monkey-front-components-0.0.384.tgz +0 -0
  173. package/ng-package.json +0 -10
  174. package/src/lib/components/base/base-component.ts +0 -359
  175. package/src/lib/components/base/base-dynamic-array.ts +0 -233
  176. package/src/lib/components/base/base-dynamic.ts +0 -90
  177. package/src/lib/components/base/base-scroll-component.ts +0 -52
  178. package/src/lib/components/base/base-validators.ts +0 -19
  179. package/src/lib/components/dynamic/button/button.component.html +0 -4
  180. package/src/lib/components/dynamic/button/button.component.scss +0 -7
  181. package/src/lib/components/dynamic/button/button.component.ts +0 -47
  182. package/src/lib/components/dynamic/dynamic-directive.ts +0 -102
  183. package/src/lib/components/dynamic/dynamic.module.ts +0 -53
  184. package/src/lib/components/dynamic/file-upload/file-upload.component.html +0 -10
  185. package/src/lib/components/dynamic/file-upload/file-upload.component.ts +0 -46
  186. package/src/lib/components/dynamic/form/dynamic-form-array.component.html +0 -19
  187. package/src/lib/components/dynamic/form/dynamic-form-array.component.scss +0 -10
  188. package/src/lib/components/dynamic/form/dynamic-form-array.component.ts +0 -75
  189. package/src/lib/components/dynamic/form/dynamic-form.component.html +0 -7
  190. package/src/lib/components/dynamic/form/dynamic-form.component.ts +0 -49
  191. package/src/lib/components/dynamic/input/input.component.html +0 -9
  192. package/src/lib/components/dynamic/input/input.component.ts +0 -58
  193. package/src/lib/components/dynamic/input-phone/input-phone.component.html +0 -7
  194. package/src/lib/components/dynamic/input-phone/input-phone.component.ts +0 -58
  195. package/src/lib/components/dynamic/radio/radio.component.html +0 -8
  196. package/src/lib/components/dynamic/radio/radio.component.ts +0 -22
  197. package/src/lib/components/dynamic/select/select.component.html +0 -14
  198. package/src/lib/components/dynamic/select/select.component.ts +0 -75
  199. package/src/lib/components/dynamic/select-search/select-search.component.html +0 -15
  200. package/src/lib/components/dynamic/select-search/select-search.component.ts +0 -76
  201. package/src/lib/components/shared/filter/filter.component.html +0 -51
  202. package/src/lib/components/shared/filter/filter.component.scss +0 -79
  203. package/src/lib/components/shared/filter/filter.component.ts +0 -117
  204. package/src/lib/components/shared/filter/filter.module.ts +0 -36
  205. package/src/lib/components/shared/filter/menu/menu.component.html +0 -28
  206. package/src/lib/components/shared/filter/menu/menu.component.scss +0 -62
  207. package/src/lib/components/shared/filter/menu/menu.component.ts +0 -122
  208. package/src/lib/components/shared/filter/menu/menu.module.ts +0 -41
  209. package/src/lib/components/shared/filter/options/children/children.component.html +0 -6
  210. package/src/lib/components/shared/filter/options/children/children.component.scss +0 -30
  211. package/src/lib/components/shared/filter/options/children/children.component.ts +0 -58
  212. package/src/lib/components/shared/filter/options/currency/currency.component.html +0 -3
  213. package/src/lib/components/shared/filter/options/currency/currency.component.scss +0 -19
  214. package/src/lib/components/shared/filter/options/currency/currency.component.ts +0 -52
  215. package/src/lib/components/shared/filter/options/date-range/date-range.component.html +0 -3
  216. package/src/lib/components/shared/filter/options/date-range/date-range.component.scss +0 -34
  217. package/src/lib/components/shared/filter/options/date-range/date-range.component.ts +0 -72
  218. package/src/lib/components/shared/filter/options/input/input.component.html +0 -3
  219. package/src/lib/components/shared/filter/options/input/input.component.scss +0 -19
  220. package/src/lib/components/shared/filter/options/input/input.component.ts +0 -52
  221. package/src/lib/components/shared/filter/options/options.component.html +0 -43
  222. package/src/lib/components/shared/filter/options/options.component.scss +0 -56
  223. package/src/lib/components/shared/filter/options/options.component.ts +0 -58
  224. package/src/lib/components/shared/filter/options/options.module.ts +0 -58
  225. package/src/lib/components/shared/filter/options/status/status.component.html +0 -4
  226. package/src/lib/components/shared/filter/options/status/status.component.scss +0 -29
  227. package/src/lib/components/shared/filter/options/status/status.component.ts +0 -73
  228. package/src/lib/components/shared/filter/selected/item/children/children.component.html +0 -19
  229. package/src/lib/components/shared/filter/selected/item/children/children.component.scss +0 -68
  230. package/src/lib/components/shared/filter/selected/item/children/children.component.ts +0 -49
  231. package/src/lib/components/shared/filter/selected/item/currency/currency.component.html +0 -1
  232. package/src/lib/components/shared/filter/selected/item/currency/currency.component.scss +0 -4
  233. package/src/lib/components/shared/filter/selected/item/currency/currency.component.ts +0 -26
  234. package/src/lib/components/shared/filter/selected/item/date-range/date-range.component.html +0 -2
  235. package/src/lib/components/shared/filter/selected/item/date-range/date-range.component.scss +0 -4
  236. package/src/lib/components/shared/filter/selected/item/date-range/date-range.component.ts +0 -39
  237. package/src/lib/components/shared/filter/selected/item/date-with-action/date-with-action.component.html +0 -1
  238. package/src/lib/components/shared/filter/selected/item/date-with-action/date-with-action.component.scss +0 -4
  239. package/src/lib/components/shared/filter/selected/item/date-with-action/date-with-action.component.ts +0 -29
  240. package/src/lib/components/shared/filter/selected/item/input/input.component.html +0 -1
  241. package/src/lib/components/shared/filter/selected/item/input/input.component.scss +0 -4
  242. package/src/lib/components/shared/filter/selected/item/input/input.component.ts +0 -26
  243. package/src/lib/components/shared/filter/selected/item/item.component.html +0 -38
  244. package/src/lib/components/shared/filter/selected/item/item.component.scss +0 -72
  245. package/src/lib/components/shared/filter/selected/item/item.component.ts +0 -71
  246. package/src/lib/components/shared/filter/selected/item/status/status.component.html +0 -1
  247. package/src/lib/components/shared/filter/selected/item/status/status.component.scss +0 -4
  248. package/src/lib/components/shared/filter/selected/item/status/status.component.ts +0 -36
  249. package/src/lib/components/shared/filter/selected/selected.component.html +0 -3
  250. package/src/lib/components/shared/filter/selected/selected.component.scss +0 -9
  251. package/src/lib/components/shared/filter/selected/selected.component.ts +0 -76
  252. package/src/lib/components/shared/filter/selected/selected.module.ts +0 -60
  253. package/src/lib/components/shared/password-strength/password-strength.component.html +0 -50
  254. package/src/lib/components/shared/password-strength/password-strength.component.scss +0 -70
  255. package/src/lib/components/shared/password-strength/password-strength.component.ts +0 -89
  256. package/src/lib/components/shared/password-strength/password-strength.module.ts +0 -24
  257. package/src/lib/components/shared/password-strength/password-strength.ts +0 -5
  258. package/src/lib/components/shared/products/filter/filter.component.html +0 -6
  259. package/src/lib/components/shared/products/filter/filter.component.scss +0 -20
  260. package/src/lib/components/shared/products/filter/filter.component.ts +0 -34
  261. package/src/lib/components/shared/products/products.component.html +0 -15
  262. package/src/lib/components/shared/products/products.component.scss +0 -70
  263. package/src/lib/components/shared/products/products.component.ts +0 -104
  264. package/src/lib/components/shared/products/products.module.ts +0 -13
  265. package/src/lib/components/shared/products/providers/products.model.ts +0 -60
  266. package/src/lib/components/shared/progress-bar/progress-bar.component.html +0 -3
  267. package/src/lib/components/shared/progress-bar/progress-bar.component.scss +0 -6
  268. package/src/lib/components/shared/progress-bar/progress-bar.component.ts +0 -27
  269. package/src/lib/components/shared/progress-bar/progress-bar.module.ts +0 -10
  270. package/src/lib/components/shared/progress-bar/progress-bar.service.ts +0 -59
  271. package/src/lib/interfaces/field-config.ts +0 -58
  272. package/src/public-api.ts +0 -5
  273. package/src/test.ts +0 -26
  274. package/tsconfig.lib.json +0 -20
  275. package/tsconfig.lib.prod.json +0 -10
  276. package/tsconfig.spec.json +0 -17
@@ -1,359 +0,0 @@
1
- /* eslint-disable max-len */
2
- import { AbstractControl, FormGroup } from '@angular/forms';
3
- import { Subject } from 'rxjs';
4
- import { OnDestroy, Directive } from '@angular/core';
5
- import { takeUntil } from 'rxjs/operators';
6
- import { MonkeyUtils } from 'monkey-style-guide';
7
- import {
8
- MonkeyEcxCommonsService,
9
- MonkeyEcxErrorResponse,
10
- MonkeyEcxPaginationOptions,
11
- MonkeyEcxScrollOptions,
12
- MonkeyEcxSupportOptions,
13
- MonkeyEcxTranslateOptions,
14
- ValidateUtils
15
- } from 'monkey-front-core';
16
-
17
- @Directive({
18
- selector: '[baseComponent]'
19
- })
20
- export abstract class BaseComponent implements OnDestroy {
21
- __monkeyecxFormErrors: any | any[];
22
-
23
- __unsubscribeAll: Subject<any>;
24
-
25
- __paginationOptions: MonkeyEcxPaginationOptions | null = null;
26
-
27
- __i18n: any;
28
-
29
- __isMobile = this.isMobile();
30
-
31
- __locales = ['pt-BR', 'es-CL'];
32
-
33
- private paginationFunc: any;
34
-
35
- protected constructor() {
36
- this.__unsubscribeAll = new Subject();
37
- }
38
-
39
- private isMobile() {
40
- const isMobileWidth = (window.screen.width <= 640) ||
41
- (window.matchMedia &&
42
- window.matchMedia('only screen and (max-width: 640px)').matches
43
- );
44
- return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|Mobile/i.test(
45
- navigator.userAgent
46
- )) || isMobileWidth;
47
- }
48
-
49
- private handlePagination(create = true) {
50
- const { __paginationOptions } = this;
51
-
52
- if (__paginationOptions) {
53
- const { mainElement, service } = __paginationOptions;
54
-
55
- const element = document.getElementById(mainElement);
56
-
57
- if (element) {
58
- element.scroll = null;
59
- element.onscroll = null;
60
-
61
- element.removeEventListener('scroll', (element as any).eventListeners('scroll'));
62
- element.removeEventListener('scroll', (element as any).eventListeners('scroll')[0]);
63
- if (create) {
64
- element.addEventListener('scroll', () => {
65
- const { scrollTop, scrollHeight, offsetHeight } = element;
66
- const contentHeight = scrollHeight - offsetHeight;
67
-
68
- if (contentHeight <= scrollTop) {
69
- service.doPagination();
70
- }
71
- });
72
- }
73
- }
74
- }
75
- }
76
-
77
- private handleSupport(supportControls: MonkeyEcxSupportOptions) {
78
- const { service, show } = supportControls;
79
- const method = show ? 'show' : 'hide';
80
- service[method.toLowerCase()]();
81
- }
82
-
83
- private handleTranslate(translateOptions: MonkeyEcxTranslateOptions) {
84
- const { service } = translateOptions;
85
- service.__oni18nDataChanged$
86
- .pipe(takeUntil(this.__unsubscribeAll))
87
- .subscribe(() => {
88
- const data = service.__i18n;
89
- if (data) {
90
- this.__i18n = data;
91
- }
92
- });
93
- }
94
-
95
- private handleViewScroll(options: MonkeyEcxScrollOptions) {
96
- const { elementId, service } = options;
97
-
98
- if (elementId === service?.__savedState?.scrollElementId) {
99
- this.goScroll(elementId);
100
-
101
- service.__savedState.scrollElementId = null;
102
- }
103
- }
104
-
105
- private getErrorFirstMessageTranslated(formControl: AbstractControl | null = null) {
106
- if (formControl?.hasError('required')) return 'FIELD-REQUIRED';
107
- if (formControl?.hasError('invalid')) return 'FIELD-INVALID';
108
- if (formControl?.hasError('email')) return 'INVALID-EMAIL';
109
- if (formControl?.hasError('minlength')) return 'MIN-LENGTH';
110
- if (formControl?.hasError('maxlength')) return 'MAX-LENGTH';
111
- if (formControl?.hasError('max')) return 'MAX';
112
- if (formControl?.hasError('min')) return 'MIN';
113
- if (formControl?.hasError('passwordsNotMatching')) return 'MATCH-PASSWORD';
114
- if (formControl?.hasError('invalidDate')) return 'INVALID-DATE';
115
- if (formControl?.hasError('invalidTrue')) return 'INVALID-TRUE';
116
- if (formControl?.hasError('invalidCpfCnpj')) return 'INVALID-DOCUMENT';
117
- if (formControl?.hasError('invalidZipCode')) return 'INVALID-ZIPCODE';
118
- if (formControl?.hasError('invalidCombo')) return 'INVALID-COMBO';
119
- if (formControl?.hasError('invalidUrl')) return 'INVALID-URL';
120
- if (formControl?.hasError('invalidUnlockRegister')) { return 'INVALID-UNLOCK-REGISTER'; }
121
- if (formControl?.hasError('dateStartMustBeLessThanAnd')) {
122
- return 'DATE-START-MUST-BE-LESS-THAN-AND';
123
- }
124
- if (formControl?.hasError('dateEndMustBeGreaterThanStart')) {
125
- return 'DATE-END-MUST-BE-GREATER-THAN-SART';
126
- }
127
- if (formControl?.hasError('phone')) return 'INVALID-PHONE';
128
- if (formControl?.hasError('invalidValueGreaterThanZero')) return 'INVALID-GREATER-THAN-ZERO';
129
-
130
- return 'FIELD-INVALID';
131
- }
132
-
133
- private getErrorLastMessageNotTranslated(formControl: AbstractControl | null = null) {
134
- if (formControl?.hasError('minlength')) {
135
- return `${formControl?.getError('minlength').requiredLength} caracteres.`;
136
- }
137
- if (formControl?.hasError('maxlength')) {
138
- return `${formControl?.getError('maxlength').requiredLength} caracteres.`;
139
- }
140
- if (formControl?.hasError('max')) { return `${formControl?.getError('max').max}`; }
141
- if (formControl?.hasError('min')) { return `${formControl?.getError('min').min}`; }
142
-
143
- return '';
144
- }
145
-
146
- public validateFormWithTranslate(f: FormGroup, index?: number): boolean {
147
- const formErrors: any = f.value;
148
-
149
- if (f.status === 'VALID') return true;
150
-
151
- if (!formErrors) return true;
152
- Object.entries(formErrors).forEach(([key, value]) => {
153
- const control = f.get(key);
154
- formErrors[key] = '';
155
- if (control && !control.valid) {
156
- const msg = {
157
- first: `ERRORS.${this.getErrorFirstMessageTranslated(f.get(key))}`,
158
- last: this.getErrorLastMessageNotTranslated(f.get(key))
159
- };
160
- formErrors[key] = msg;
161
- }
162
- });
163
-
164
- if (MonkeyUtils.persistNullEmptyUndefined(index)) { this.__monkeyecxFormErrors[index || 0] = formErrors; } else {
165
- this.__monkeyecxFormErrors = formErrors;
166
- }
167
-
168
- return false;
169
- }
170
-
171
- public copyToClipboard(val: string) {
172
- const selBox = document.createElement('textarea');
173
- selBox.style.position = 'fixed';
174
- selBox.style.left = '0';
175
- selBox.style.top = '0';
176
- selBox.style.opacity = '0';
177
- selBox.value = val;
178
- document.body.appendChild(selBox);
179
- selBox.focus();
180
- selBox.select();
181
- document.execCommand('copy');
182
- document.body.removeChild(selBox);
183
- }
184
-
185
- public validateForm(f: FormGroup, index?: number, alias?: string): boolean {
186
- const formErrors: any = f.value;
187
- if (f.status === 'VALID') return true;
188
-
189
- if (!formErrors) return true;
190
- Object.entries(formErrors).forEach(([key, value]) => {
191
- const control = f.get(key);
192
- formErrors[key] = '';
193
- if (control && !control.valid) {
194
- const msg = {
195
- firstMessage: `ERRORS.${this.getErrorFirstMessageTranslated(
196
- f.get(key)
197
- )}`,
198
- lastMessage: this.getErrorLastMessageNotTranslated(f.get(key))
199
- };
200
- formErrors[key] = msg;
201
- }
202
- });
203
-
204
- if (MonkeyUtils.persistNullEmptyUndefined(index)) {
205
- this.__monkeyecxFormErrors[index || 0] = formErrors;
206
- } else {
207
- let obj: any;
208
-
209
- if (alias) {
210
- obj = {
211
- [alias]: {
212
- ...formErrors
213
- }
214
- };
215
- } else {
216
- obj = formErrors;
217
- }
218
-
219
- this.__monkeyecxFormErrors = {
220
- ...this.__monkeyecxFormErrors,
221
- ...obj
222
- };
223
- }
224
- f.markAllAsTouched();
225
- return false;
226
- }
227
-
228
- public clearAllServiceData(clearData: boolean) {
229
- const context = this;
230
- Object.values(context).forEach((ctx: any) => {
231
- if (ctx instanceof MonkeyEcxCommonsService) {
232
- ctx.clear(clearData);
233
- }
234
- });
235
- }
236
-
237
- public ngOnInit(args: {
238
- paginationOptions?: MonkeyEcxPaginationOptions;
239
- supportControls?: MonkeyEcxSupportOptions;
240
- scrollOptions?: MonkeyEcxScrollOptions;
241
- translateOptions?: MonkeyEcxTranslateOptions;
242
- }) {
243
- if (args?.paginationOptions) {
244
- this.__paginationOptions = args?.paginationOptions;
245
- this.handlePagination();
246
- }
247
- if (args?.supportControls) {
248
- this.handleSupport(args?.supportControls);
249
- }
250
- if (args?.translateOptions) {
251
- this.handleTranslate(args?.translateOptions);
252
- }
253
- if (args?.scrollOptions) {
254
- this.handleViewScroll(args.scrollOptions);
255
- }
256
- }
257
-
258
- public ngOnDestroy(clearData: boolean = true) {
259
- this.__unsubscribeAll.next();
260
- this.__unsubscribeAll.complete();
261
- this.clearAllServiceData(clearData);
262
- this.handlePagination(false);
263
- }
264
-
265
- public handleErrorFromServices(error: MonkeyEcxErrorResponse, f: FormGroup) {
266
- this.__monkeyecxFormErrors = null;
267
- if (error.type === 'Parameter_Error') {
268
- Object.entries(f.value).forEach(([key, value]) => {
269
- error.notifications.forEach((_: any) => {
270
- const field = _.split(':')[0];
271
- const description = _.split(':')[1];
272
- if (field === key) {
273
- const msg = {
274
- firstMessage: '',
275
- lastMessage: description
276
- };
277
- this.__monkeyecxFormErrors = {
278
- ...this.__monkeyecxFormErrors,
279
- [key]: msg
280
- };
281
- f.controls[key].setErrors({
282
- incorrect: true
283
- });
284
- }
285
- });
286
- });
287
- }
288
-
289
- f.markAllAsTouched();
290
- }
291
-
292
- public goBack() {
293
- window.history.back();
294
- }
295
-
296
- public goScroll(id: string) {
297
- const element = document.getElementById(id);
298
- if (element) element.scrollIntoView();
299
- }
300
-
301
- public getEmbeddedData(data: any, field: string): any[] | any {
302
- const { _embedded } = data;
303
- return _embedded ? _embedded[field] : null;
304
- }
305
-
306
- public openWindow(url: string) {
307
- window.open(`${url}`, '_blank');
308
- }
309
-
310
- public fillI18n(data: any) {
311
- this.__i18n = data;
312
- }
313
-
314
- public getCountryPrefix(country: string) {
315
- return {
316
- br: 55,
317
- cl: 56
318
- }[country];
319
- }
320
-
321
- public getCountryCurrencyChartFormat(country: string) {
322
- return {
323
- br: 'R$ #,###,##0.00',
324
- cl: 'CLP #,###,##0'
325
- }[country];
326
- }
327
-
328
- public getCountryValidators(country: string) {
329
- return {
330
- br: {
331
- governmentId: ValidateUtils.DocumentValidator
332
- },
333
- cl: {
334
- governmentId: ValidateUtils.DocumentRutValidator
335
- }
336
- }[country];
337
- }
338
-
339
- public isAbleToHandlePagination() {
340
- const { __paginationOptions } = this;
341
-
342
- if (__paginationOptions) {
343
- const { service } = __paginationOptions;
344
-
345
- const links = service.__links;
346
- if (links && links?.next) return true;
347
- }
348
- return false;
349
- }
350
-
351
- public onHandlePagination() {
352
- const { __paginationOptions } = this;
353
-
354
- if (__paginationOptions) {
355
- const { service } = __paginationOptions;
356
- service.doPagination();
357
- }
358
- }
359
- }
@@ -1,233 +0,0 @@
1
- import { Directive, EventEmitter, Input, OnInit, OnChanges, Output } from '@angular/core';
2
- import { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms';
3
- import { MonkeyUtils } from 'monkey-style-guide';
4
- import { Subject } from 'rxjs';
5
- import { takeUntil } from 'rxjs/operators';
6
- import { MECXFieldConfig, MECXFieldConfigValidator } from '../../interfaces';
7
- import { BaseComponent } from './base-component';
8
- import { validators } from './base-validators';
9
-
10
- @Directive({
11
- selector: '[baseDynamicArray]'
12
- })
13
- export abstract class BaseDynamicArray extends BaseComponent implements OnInit, OnChanges {
14
- @Input() onHandleSubmit = new EventEmitter<any>();
15
-
16
- @Input() onHandleUpdateForm = new EventEmitter<any>();
17
-
18
- @Output() onHandleSubmitFormReady: EventEmitter<any> = new EventEmitter<any>();
19
-
20
- @Input() self: any;
21
-
22
- @Input() fields: MECXFieldConfig[] = [];
23
-
24
- @Input() data: any;
25
-
26
- @Input() qtd: number = 1;
27
-
28
- @Input() disabled: boolean = false;
29
-
30
- _form: FormGroup | null = null;
31
-
32
- // eslint-disable-next-line object-curly-newline
33
- _plusValidations: any[] = [];
34
-
35
- private changesUnsubscribe = new Subject();
36
-
37
- constructor(private fb: FormBuilder) {
38
- super();
39
- }
40
-
41
- private handleInternalPlusValidation(
42
- mainField: any,
43
- data: any
44
- ) {
45
- const { operator, field, value } = mainField;
46
- const validators: any = {
47
- e: (val1: any, val2: string) => { return val1 === val2; },
48
- lt: (val1: any, val2: string) => { return val1 < val2; },
49
- gt: (val1: any, val2: string) => { return val1 > val2; }
50
- };
51
-
52
- return validators[operator](data?.[field] || data, value);
53
- }
54
-
55
- private makeInternalPlusValidation(
56
- data: any,
57
- sourceField: string,
58
- settings: any,
59
- rowIndex: number
60
- ) {
61
- const changeFields = (show: boolean) => {
62
- const saved = [...this.fields];
63
-
64
- saved.map((val) => {
65
- const valSaved = {
66
- ...val
67
- };
68
- if (val.name === sourceField) {
69
- this._plusValidations[rowIndex] = {
70
- [sourceField]: {
71
- ...valSaved,
72
- alwaysShow: show
73
- }
74
- };
75
- this.createOneControl(val.name, this.formValues?.controls[rowIndex], show);
76
- } else {
77
- this._plusValidations[rowIndex] = {
78
- ...valSaved
79
- };
80
- }
81
- return null;
82
- });
83
- };
84
-
85
- const validated = this.handleInternalPlusValidation(settings, data);
86
- changeFields(validated);
87
- }
88
-
89
- private createOneControl(fieldName: string, ctrl: any, create = true) {
90
- const { fields } = this;
91
- if (!fields) return;
92
-
93
- fields.forEach((field: MECXFieldConfig) => {
94
- const { fieldType, validations, name, disabled } = field;
95
- if (name !== fieldName) return;
96
- let { value } = field;
97
- if (fieldType === 'button') return;
98
- if (fieldType === 'radiobutton' || fieldType === 'checkbox' || fieldType === 'select') {
99
- value = '';
100
- }
101
- if (create) {
102
- const control = this.fb.control(value, this.bindValidations(validations || []));
103
- if (disabled || this.disabled) control.disable();
104
- ctrl.addControl(name, control);
105
- } else {
106
- ctrl.removeControl(name);
107
- }
108
- });
109
- }
110
-
111
- private createControl(data?: any) {
112
- const { fields } = this;
113
- if (!fields) return null;
114
- // eslint-disable-next-line object-curly-newline
115
- const group = this.fb.group({});
116
- fields.forEach((field: MECXFieldConfig) => {
117
- const { fieldType, validations, name, disabled, alwaysShow } = field;
118
- let { value } = field;
119
- if (field.alwaysShowPlusValidation) {
120
- if (!this.handleInternalPlusValidation(field.alwaysShowPlusValidation, data)) return;
121
- } else if (!alwaysShow) return;
122
- if (fieldType === 'button') return;
123
- if (fieldType === 'radiobutton' || fieldType === 'checkbox' || fieldType === 'select') {
124
- value = '';
125
- }
126
- const control = this.fb.control(value, this.bindValidations(validations || []));
127
- if (disabled || this.disabled) control.disable();
128
- group.addControl(name as string, control);
129
- });
130
-
131
- return group;
132
- }
133
-
134
- private bindValidations(validations: MECXFieldConfigValidator[]) {
135
- if (validations.length > 0) {
136
- const validList: any[] = [];
137
- validations.forEach((valid: MECXFieldConfigValidator) => {
138
- const validated = valid.param
139
- ? validators[valid.name](valid.param)
140
- : validators[valid.name];
141
- validList.push(validated);
142
- });
143
- return Validators.compose(validList);
144
- }
145
- return null;
146
- }
147
-
148
- private buildForm(): FormGroup {
149
- const form = this.fb.group({
150
- fields: this.fb.array([])
151
- });
152
-
153
- form?.controls.fields?.valueChanges.subscribe((_) => {
154
- this.watchForChanges();
155
- });
156
-
157
- return form;
158
- }
159
-
160
- private watchForChanges() {
161
- const { fields, changesUnsubscribe } = this;
162
- changesUnsubscribe.next();
163
-
164
- this.formValues?.controls?.map((control: any, index: number) => {
165
- fields.forEach((fieldConfig: MECXFieldConfig) => {
166
- const { name, alwaysShowPlusValidation } = fieldConfig;
167
- if (!alwaysShowPlusValidation) return;
168
- const { field } = alwaysShowPlusValidation;
169
- if (field) {
170
- control.controls[field]?.valueChanges.pipe(
171
- takeUntil(changesUnsubscribe)).subscribe((_: any) => {
172
- this.makeInternalPlusValidation(
173
- _,
174
- name as string,
175
- alwaysShowPlusValidation,
176
- index
177
- );
178
- });
179
- }
180
- });
181
- return null;
182
- });
183
- }
184
-
185
- public formBase = () => {
186
- // return this.fb.group(this.createControl());
187
- return this.createControl();
188
- };
189
-
190
- public get formValues() {
191
- return this._form ? (this._form.get('fields') as FormArray) : null;
192
- }
193
-
194
- public fillValues() {
195
- const { data, qtd } = this;
196
- if ((!this._form) && qtd) return;
197
- if (qtd > 0) {
198
- Array<any>(qtd)
199
- .fill(null)
200
- .map((_, index) => {
201
- let form = this.createControl();
202
- if (data && data[index]) {
203
- form = this.createControl(data[index]);
204
- const handledData = data[index];
205
- Object.entries(handledData).forEach(([key, value]) => {
206
- if (MonkeyUtils.persistNullEmptyUndefined(value) && form?.controls[key]) {
207
- form?.controls[key].setValue(value);
208
- }
209
- });
210
- }
211
- this.formValues?.push(form as any);
212
-
213
- return null;
214
- });
215
- }
216
- }
217
-
218
- ngOnInit() {
219
- this._form = this.buildForm();
220
- this.fillValues();
221
-
222
- this.onHandleUpdateForm.subscribe(() => {
223
- this.fillValues();
224
- });
225
- }
226
-
227
- ngOnChanges() {
228
- if (!this._form) {
229
- this._form = this.buildForm();
230
- }
231
- this.fillValues();
232
- }
233
- }
@@ -1,90 +0,0 @@
1
- import { Directive, EventEmitter, Input, OnInit, OnChanges, Output } from '@angular/core';
2
- import { FormBuilder, FormGroup, Validators } from '@angular/forms';
3
- import { MonkeyUtils } from 'monkey-style-guide';
4
- import { MECXFieldConfig, MECXFieldConfigValidator } from '../../interfaces';
5
- import { BaseComponent } from './base-component';
6
- import { validators } from './base-validators';
7
-
8
- @Directive({
9
- selector: '[baseDynamic]'
10
- })
11
- export abstract class BaseDynamic extends BaseComponent implements OnInit, OnChanges {
12
- @Input() onHandleSubmit = new EventEmitter<any>();
13
-
14
- @Input() onHandleUpdateForm = new EventEmitter<any>();
15
-
16
- @Output() onHandleSubmitFormReady: EventEmitter<any> = new EventEmitter<any>();
17
-
18
- @Input() self: any;
19
-
20
- @Input() fields: MECXFieldConfig[] = [];
21
-
22
- @Input() data: any;
23
-
24
- @Input() disabled: boolean = false;
25
-
26
- _form: FormGroup | null = null;
27
-
28
- constructor(private fb: FormBuilder) {
29
- super();
30
- }
31
-
32
- private createControl() {
33
- const { fields } = this;
34
- if (!fields) return null;
35
- // eslint-disable-next-line object-curly-newline
36
- const group = this.fb.group({});
37
- fields.forEach((field: MECXFieldConfig) => {
38
- const { fieldType, validations, name, disabled } = field;
39
- let { value } = field;
40
- if (fieldType === 'button') return;
41
- if (fieldType === 'radiobutton' || fieldType === 'checkbox' || fieldType === 'select') {
42
- value = '';
43
- }
44
- const control = this.fb.control(value, this.bindValidations(validations || []));
45
- if (disabled || this.disabled) control.disable();
46
- group.addControl(name as string, control);
47
- });
48
- return group;
49
- }
50
-
51
- private bindValidations(validations: MECXFieldConfigValidator[]) {
52
- if (validations.length > 0) {
53
- const validList: any[] = [];
54
- validations.forEach((valid: MECXFieldConfigValidator) => {
55
- const validated = valid.param
56
- ? validators[valid.name](valid.param)
57
- : validators[valid.name];
58
- validList.push(validated);
59
- });
60
- return Validators.compose(validList);
61
- }
62
- return null;
63
- }
64
-
65
- public fillValues() {
66
- const { data } = this;
67
- if (!data || !this._form) return;
68
- Object.entries(data).forEach(([key, value]) => {
69
- if (MonkeyUtils.persistNullEmptyUndefined(value) && this._form?.controls[key]) {
70
- this._form?.controls[key]?.setValue(value);
71
- }
72
- });
73
- }
74
-
75
- ngOnInit() {
76
- this._form = this.createControl();
77
- this.fillValues();
78
-
79
- this.onHandleUpdateForm.subscribe(() => {
80
- this.fillValues();
81
- });
82
- }
83
-
84
- ngOnChanges() {
85
- if (!this._form) {
86
- this._form = this.createControl();
87
- }
88
- this.fillValues();
89
- }
90
- }