monkey-front-components 0.0.383 → 0.0.384

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/karma.conf.js +44 -0
  2. package/monkey-front-components-0.0.384.tgz +0 -0
  3. package/ng-package.json +10 -0
  4. package/package.json +7 -27
  5. package/src/lib/components/base/base-component.ts +359 -0
  6. package/src/lib/components/base/base-dynamic-array.ts +233 -0
  7. package/src/lib/components/base/base-dynamic.ts +90 -0
  8. package/src/lib/components/base/base-scroll-component.ts +52 -0
  9. package/src/lib/components/base/base-validators.ts +19 -0
  10. package/{lib/components/base/index.d.ts → src/lib/components/base/index.ts} +5 -5
  11. package/src/lib/components/dynamic/button/button.component.html +4 -0
  12. package/src/lib/components/dynamic/button/button.component.scss +7 -0
  13. package/src/lib/components/dynamic/button/button.component.ts +47 -0
  14. package/{lib/components/dynamic/button/index.d.ts → src/lib/components/dynamic/button/index.ts} +1 -1
  15. package/src/lib/components/dynamic/dynamic-directive.ts +102 -0
  16. package/src/lib/components/dynamic/dynamic.module.ts +53 -0
  17. package/src/lib/components/dynamic/file-upload/file-upload.component.html +10 -0
  18. package/src/lib/components/dynamic/file-upload/file-upload.component.ts +46 -0
  19. package/{lib/components/dynamic/file-upload/index.d.ts → src/lib/components/dynamic/file-upload/index.ts} +1 -1
  20. package/src/lib/components/dynamic/form/dynamic-form-array.component.html +19 -0
  21. package/src/lib/components/dynamic/form/dynamic-form-array.component.scss +10 -0
  22. package/src/lib/components/dynamic/form/dynamic-form-array.component.ts +75 -0
  23. package/src/lib/components/dynamic/form/dynamic-form.component.html +7 -0
  24. package/src/lib/components/dynamic/form/dynamic-form.component.ts +49 -0
  25. package/{lib/components/dynamic/form/index.d.ts → src/lib/components/dynamic/form/index.ts} +2 -2
  26. package/{lib/components/dynamic/index.d.ts → src/lib/components/dynamic/index.ts} +8 -8
  27. package/{lib/components/dynamic/input/index.d.ts → src/lib/components/dynamic/input/index.ts} +1 -1
  28. package/src/lib/components/dynamic/input/input.component.html +9 -0
  29. package/src/lib/components/dynamic/input/input.component.ts +58 -0
  30. package/{lib/components/dynamic/input-phone/index.d.ts → src/lib/components/dynamic/input-phone/index.ts} +1 -1
  31. package/src/lib/components/dynamic/input-phone/input-phone.component.html +7 -0
  32. package/src/lib/components/dynamic/input-phone/input-phone.component.ts +58 -0
  33. package/{lib/components/dynamic/radio/index.d.ts → src/lib/components/dynamic/radio/index.ts} +1 -1
  34. package/src/lib/components/dynamic/radio/radio.component.html +8 -0
  35. package/src/lib/components/dynamic/radio/radio.component.ts +22 -0
  36. package/{lib/components/dynamic/select/index.d.ts → src/lib/components/dynamic/select/index.ts} +1 -1
  37. package/src/lib/components/dynamic/select/select.component.html +14 -0
  38. package/src/lib/components/dynamic/select/select.component.ts +75 -0
  39. package/{lib/components/dynamic/select-search/index.d.ts → src/lib/components/dynamic/select-search/index.ts} +1 -1
  40. package/src/lib/components/dynamic/select-search/select-search.component.html +15 -0
  41. package/src/lib/components/dynamic/select-search/select-search.component.ts +76 -0
  42. package/{lib/components/index.d.ts → src/lib/components/index.ts} +3 -3
  43. package/src/lib/components/shared/filter/filter.component.html +51 -0
  44. package/src/lib/components/shared/filter/filter.component.scss +79 -0
  45. package/src/lib/components/shared/filter/filter.component.ts +117 -0
  46. package/src/lib/components/shared/filter/filter.module.ts +36 -0
  47. package/{lib/components/shared/filter/index.d.ts → src/lib/components/shared/filter/index.ts} +2 -2
  48. package/{lib/components/shared/filter/menu/index.d.ts → src/lib/components/shared/filter/menu/index.ts} +1 -1
  49. package/src/lib/components/shared/filter/menu/menu.component.html +28 -0
  50. package/src/lib/components/shared/filter/menu/menu.component.scss +62 -0
  51. package/src/lib/components/shared/filter/menu/menu.component.ts +122 -0
  52. package/src/lib/components/shared/filter/menu/menu.module.ts +41 -0
  53. package/src/lib/components/shared/filter/options/children/children.component.html +6 -0
  54. package/src/lib/components/shared/filter/options/children/children.component.scss +30 -0
  55. package/src/lib/components/shared/filter/options/children/children.component.ts +58 -0
  56. package/{lib/components/shared/filter/options/children/index.d.ts → src/lib/components/shared/filter/options/children/index.ts} +1 -1
  57. package/src/lib/components/shared/filter/options/currency/currency.component.html +3 -0
  58. package/src/lib/components/shared/filter/options/currency/currency.component.scss +19 -0
  59. package/src/lib/components/shared/filter/options/currency/currency.component.ts +52 -0
  60. package/{lib/components/shared/filter/options/currency/index.d.ts → src/lib/components/shared/filter/options/currency/index.ts} +1 -1
  61. package/src/lib/components/shared/filter/options/date-range/date-range.component.html +3 -0
  62. package/src/lib/components/shared/filter/options/date-range/date-range.component.scss +34 -0
  63. package/src/lib/components/shared/filter/options/date-range/date-range.component.ts +72 -0
  64. package/{lib/components/shared/filter/options/date-range/index.d.ts → src/lib/components/shared/filter/options/date-range/index.ts} +1 -1
  65. package/{lib/components/shared/filter/options/index.d.ts → src/lib/components/shared/filter/options/index.ts} +1 -1
  66. package/{lib/components/shared/filter/options/input/index.d.ts → src/lib/components/shared/filter/options/input/index.ts} +1 -1
  67. package/src/lib/components/shared/filter/options/input/input.component.html +3 -0
  68. package/src/lib/components/shared/filter/options/input/input.component.scss +19 -0
  69. package/src/lib/components/shared/filter/options/input/input.component.ts +52 -0
  70. package/src/lib/components/shared/filter/options/options.component.html +43 -0
  71. package/src/lib/components/shared/filter/options/options.component.scss +56 -0
  72. package/src/lib/components/shared/filter/options/options.component.ts +58 -0
  73. package/src/lib/components/shared/filter/options/options.module.ts +58 -0
  74. package/{lib/components/shared/filter/options/status/index.d.ts → src/lib/components/shared/filter/options/status/index.ts} +1 -1
  75. package/src/lib/components/shared/filter/options/status/status.component.html +4 -0
  76. package/src/lib/components/shared/filter/options/status/status.component.scss +29 -0
  77. package/src/lib/components/shared/filter/options/status/status.component.ts +73 -0
  78. package/{lib/components/shared/filter/selected/index.d.ts → src/lib/components/shared/filter/selected/index.ts} +1 -1
  79. package/src/lib/components/shared/filter/selected/item/children/children.component.html +19 -0
  80. package/src/lib/components/shared/filter/selected/item/children/children.component.scss +68 -0
  81. package/src/lib/components/shared/filter/selected/item/children/children.component.ts +49 -0
  82. package/{lib/components/shared/filter/selected/item/children/index.d.ts → src/lib/components/shared/filter/selected/item/children/index.ts} +1 -1
  83. package/src/lib/components/shared/filter/selected/item/currency/currency.component.html +1 -0
  84. package/src/lib/components/shared/filter/selected/item/currency/currency.component.scss +4 -0
  85. package/src/lib/components/shared/filter/selected/item/currency/currency.component.ts +26 -0
  86. package/{lib/components/shared/filter/selected/item/currency/index.d.ts → src/lib/components/shared/filter/selected/item/currency/index.ts} +1 -1
  87. package/src/lib/components/shared/filter/selected/item/date-range/date-range.component.html +2 -0
  88. package/src/lib/components/shared/filter/selected/item/date-range/date-range.component.scss +4 -0
  89. package/src/lib/components/shared/filter/selected/item/date-range/date-range.component.ts +39 -0
  90. package/{lib/components/shared/filter/selected/item/date-range/index.d.ts → src/lib/components/shared/filter/selected/item/date-range/index.ts} +1 -1
  91. package/src/lib/components/shared/filter/selected/item/date-with-action/date-with-action.component.html +1 -0
  92. package/src/lib/components/shared/filter/selected/item/date-with-action/date-with-action.component.scss +4 -0
  93. package/src/lib/components/shared/filter/selected/item/date-with-action/date-with-action.component.ts +29 -0
  94. package/{lib/components/shared/filter/selected/item/date-with-action/index.d.ts → src/lib/components/shared/filter/selected/item/date-with-action/index.ts} +1 -1
  95. package/{lib/components/shared/filter/selected/item/index.d.ts → src/lib/components/shared/filter/selected/item/index.ts} +7 -7
  96. package/{lib/components/shared/filter/selected/item/input/index.d.ts → src/lib/components/shared/filter/selected/item/input/index.ts} +1 -1
  97. package/src/lib/components/shared/filter/selected/item/input/input.component.html +1 -0
  98. package/src/lib/components/shared/filter/selected/item/input/input.component.scss +4 -0
  99. package/src/lib/components/shared/filter/selected/item/input/input.component.ts +26 -0
  100. package/src/lib/components/shared/filter/selected/item/item.component.html +38 -0
  101. package/src/lib/components/shared/filter/selected/item/item.component.scss +72 -0
  102. package/src/lib/components/shared/filter/selected/item/item.component.ts +71 -0
  103. package/{lib/components/shared/filter/selected/item/status/index.d.ts → src/lib/components/shared/filter/selected/item/status/index.ts} +1 -1
  104. package/src/lib/components/shared/filter/selected/item/status/status.component.html +1 -0
  105. package/src/lib/components/shared/filter/selected/item/status/status.component.scss +4 -0
  106. package/src/lib/components/shared/filter/selected/item/status/status.component.ts +36 -0
  107. package/src/lib/components/shared/filter/selected/selected.component.html +3 -0
  108. package/src/lib/components/shared/filter/selected/selected.component.scss +9 -0
  109. package/src/lib/components/shared/filter/selected/selected.component.ts +76 -0
  110. package/src/lib/components/shared/filter/selected/selected.module.ts +60 -0
  111. package/{lib/components/shared/index.d.ts → src/lib/components/shared/index.ts} +4 -4
  112. package/{lib/components/shared/password-strength/index.d.ts → src/lib/components/shared/password-strength/index.ts} +2 -2
  113. package/src/lib/components/shared/password-strength/password-strength.component.html +50 -0
  114. package/src/lib/components/shared/password-strength/password-strength.component.scss +70 -0
  115. package/src/lib/components/shared/password-strength/password-strength.component.ts +89 -0
  116. package/src/lib/components/shared/password-strength/password-strength.module.ts +24 -0
  117. package/src/lib/components/shared/password-strength/password-strength.ts +5 -0
  118. package/src/lib/components/shared/products/filter/filter.component.html +6 -0
  119. package/src/lib/components/shared/products/filter/filter.component.scss +20 -0
  120. package/src/lib/components/shared/products/filter/filter.component.ts +34 -0
  121. package/{lib/components/shared/products/index.d.ts → src/lib/components/shared/products/index.ts} +2 -2
  122. package/src/lib/components/shared/products/products.component.html +15 -0
  123. package/src/lib/components/shared/products/products.component.scss +70 -0
  124. package/src/lib/components/shared/products/products.component.ts +104 -0
  125. package/src/lib/components/shared/products/products.module.ts +13 -0
  126. package/{lib/components/shared/products/providers/index.d.ts → src/lib/components/shared/products/providers/index.ts} +1 -1
  127. package/src/lib/components/shared/products/providers/products.model.ts +60 -0
  128. package/{lib/components/shared/progress-bar/index.d.ts → src/lib/components/shared/progress-bar/index.ts} +3 -3
  129. package/src/lib/components/shared/progress-bar/progress-bar.component.html +3 -0
  130. package/src/lib/components/shared/progress-bar/progress-bar.component.scss +6 -0
  131. package/src/lib/components/shared/progress-bar/progress-bar.component.ts +27 -0
  132. package/src/lib/components/shared/progress-bar/progress-bar.module.ts +10 -0
  133. package/src/lib/components/shared/progress-bar/progress-bar.service.ts +59 -0
  134. package/src/lib/interfaces/field-config.ts +58 -0
  135. package/{lib/interfaces/index.d.ts → src/lib/interfaces/index.ts} +1 -1
  136. package/src/public-api.ts +5 -0
  137. package/src/test.ts +26 -0
  138. package/tsconfig.lib.json +20 -0
  139. package/tsconfig.lib.prod.json +10 -0
  140. package/tsconfig.spec.json +17 -0
  141. package/esm2020/lib/components/base/base-component.mjs +0 -322
  142. package/esm2020/lib/components/base/base-dynamic-array.mjs +0 -221
  143. package/esm2020/lib/components/base/base-dynamic.mjs +0 -99
  144. package/esm2020/lib/components/base/base-scroll-component.mjs +0 -55
  145. package/esm2020/lib/components/base/base-validators.mjs +0 -19
  146. package/esm2020/lib/components/base/index.mjs +0 -6
  147. package/esm2020/lib/components/dynamic/button/button.component.mjs +0 -52
  148. package/esm2020/lib/components/dynamic/button/index.mjs +0 -2
  149. package/esm2020/lib/components/dynamic/dynamic-directive.mjs +0 -95
  150. package/esm2020/lib/components/dynamic/dynamic.module.mjs +0 -84
  151. package/esm2020/lib/components/dynamic/file-upload/file-upload.component.mjs +0 -52
  152. package/esm2020/lib/components/dynamic/file-upload/index.mjs +0 -2
  153. package/esm2020/lib/components/dynamic/form/dynamic-form-array.component.mjs +0 -72
  154. package/esm2020/lib/components/dynamic/form/dynamic-form.component.mjs +0 -46
  155. package/esm2020/lib/components/dynamic/form/index.mjs +0 -3
  156. package/esm2020/lib/components/dynamic/index.mjs +0 -9
  157. package/esm2020/lib/components/dynamic/input/index.mjs +0 -2
  158. package/esm2020/lib/components/dynamic/input/input.component.mjs +0 -65
  159. package/esm2020/lib/components/dynamic/input-phone/index.mjs +0 -2
  160. package/esm2020/lib/components/dynamic/input-phone/input-phone.component.mjs +0 -65
  161. package/esm2020/lib/components/dynamic/radio/index.mjs +0 -2
  162. package/esm2020/lib/components/dynamic/radio/radio.component.mjs +0 -33
  163. package/esm2020/lib/components/dynamic/select/index.mjs +0 -2
  164. package/esm2020/lib/components/dynamic/select/select.component.mjs +0 -80
  165. package/esm2020/lib/components/dynamic/select-search/index.mjs +0 -2
  166. package/esm2020/lib/components/dynamic/select-search/select-search.component.mjs +0 -80
  167. package/esm2020/lib/components/index.mjs +0 -4
  168. package/esm2020/lib/components/shared/filter/filter.component.mjs +0 -119
  169. package/esm2020/lib/components/shared/filter/filter.module.mjs +0 -63
  170. package/esm2020/lib/components/shared/filter/index.mjs +0 -3
  171. package/esm2020/lib/components/shared/filter/menu/index.mjs +0 -2
  172. package/esm2020/lib/components/shared/filter/menu/menu.component.mjs +0 -120
  173. package/esm2020/lib/components/shared/filter/menu/menu.module.mjs +0 -70
  174. package/esm2020/lib/components/shared/filter/options/children/children.component.mjs +0 -50
  175. package/esm2020/lib/components/shared/filter/options/children/index.mjs +0 -2
  176. package/esm2020/lib/components/shared/filter/options/currency/currency.component.mjs +0 -46
  177. package/esm2020/lib/components/shared/filter/options/currency/index.mjs +0 -2
  178. package/esm2020/lib/components/shared/filter/options/date-range/date-range.component.mjs +0 -65
  179. package/esm2020/lib/components/shared/filter/options/date-range/index.mjs +0 -2
  180. package/esm2020/lib/components/shared/filter/options/index.mjs +0 -2
  181. package/esm2020/lib/components/shared/filter/options/input/index.mjs +0 -2
  182. package/esm2020/lib/components/shared/filter/options/input/input.component.mjs +0 -46
  183. package/esm2020/lib/components/shared/filter/options/options.component.mjs +0 -68
  184. package/esm2020/lib/components/shared/filter/options/options.module.mjs +0 -95
  185. package/esm2020/lib/components/shared/filter/options/status/index.mjs +0 -2
  186. package/esm2020/lib/components/shared/filter/options/status/status.component.mjs +0 -66
  187. package/esm2020/lib/components/shared/filter/selected/index.mjs +0 -2
  188. package/esm2020/lib/components/shared/filter/selected/item/children/children.component.mjs +0 -57
  189. package/esm2020/lib/components/shared/filter/selected/item/children/index.mjs +0 -2
  190. package/esm2020/lib/components/shared/filter/selected/item/currency/currency.component.mjs +0 -29
  191. package/esm2020/lib/components/shared/filter/selected/item/currency/index.mjs +0 -2
  192. package/esm2020/lib/components/shared/filter/selected/item/date-range/date-range.component.mjs +0 -42
  193. package/esm2020/lib/components/shared/filter/selected/item/date-range/index.mjs +0 -2
  194. package/esm2020/lib/components/shared/filter/selected/item/date-with-action/date-with-action.component.mjs +0 -33
  195. package/esm2020/lib/components/shared/filter/selected/item/date-with-action/index.mjs +0 -2
  196. package/esm2020/lib/components/shared/filter/selected/item/index.mjs +0 -8
  197. package/esm2020/lib/components/shared/filter/selected/item/input/index.mjs +0 -2
  198. package/esm2020/lib/components/shared/filter/selected/item/input/input.component.mjs +0 -28
  199. package/esm2020/lib/components/shared/filter/selected/item/item.component.mjs +0 -74
  200. package/esm2020/lib/components/shared/filter/selected/item/status/index.mjs +0 -2
  201. package/esm2020/lib/components/shared/filter/selected/item/status/status.component.mjs +0 -39
  202. package/esm2020/lib/components/shared/filter/selected/selected.component.mjs +0 -80
  203. package/esm2020/lib/components/shared/filter/selected/selected.module.mjs +0 -90
  204. package/esm2020/lib/components/shared/index.mjs +0 -5
  205. package/esm2020/lib/components/shared/password-strength/index.mjs +0 -3
  206. package/esm2020/lib/components/shared/password-strength/password-strength.component.mjs +0 -85
  207. package/esm2020/lib/components/shared/password-strength/password-strength.mjs +0 -2
  208. package/esm2020/lib/components/shared/password-strength/password-strength.module.mjs +0 -50
  209. package/esm2020/lib/components/shared/products/filter/filter.component.mjs +0 -36
  210. package/esm2020/lib/components/shared/products/index.mjs +0 -3
  211. package/esm2020/lib/components/shared/products/products.component.mjs +0 -91
  212. package/esm2020/lib/components/shared/products/products.module.mjs +0 -22
  213. package/esm2020/lib/components/shared/products/providers/index.mjs +0 -2
  214. package/esm2020/lib/components/shared/products/providers/products.model.mjs +0 -38
  215. package/esm2020/lib/components/shared/progress-bar/index.mjs +0 -4
  216. package/esm2020/lib/components/shared/progress-bar/progress-bar.component.mjs +0 -28
  217. package/esm2020/lib/components/shared/progress-bar/progress-bar.module.mjs +0 -18
  218. package/esm2020/lib/components/shared/progress-bar/progress-bar.service.mjs +0 -49
  219. package/esm2020/lib/interfaces/field-config.mjs +0 -2
  220. package/esm2020/lib/interfaces/index.mjs +0 -2
  221. package/esm2020/monkey-front-components.mjs +0 -5
  222. package/esm2020/public-api.mjs +0 -5
  223. package/fesm2015/monkey-front-components.mjs +0 -2877
  224. package/fesm2015/monkey-front-components.mjs.map +0 -1
  225. package/fesm2020/monkey-front-components.mjs +0 -2859
  226. package/fesm2020/monkey-front-components.mjs.map +0 -1
  227. package/lib/components/base/base-component.d.ts +0 -50
  228. package/lib/components/base/base-dynamic-array.d.ts +0 -34
  229. package/lib/components/base/base-dynamic.d.ts +0 -24
  230. package/lib/components/base/base-scroll-component.d.ts +0 -16
  231. package/lib/components/base/base-validators.d.ts +0 -1
  232. package/lib/components/dynamic/button/button.component.d.ts +0 -17
  233. package/lib/components/dynamic/dynamic-directive.d.ts +0 -22
  234. package/lib/components/dynamic/dynamic.module.d.ts +0 -20
  235. package/lib/components/dynamic/file-upload/file-upload.component.d.ts +0 -17
  236. package/lib/components/dynamic/form/dynamic-form-array.component.d.ts +0 -16
  237. package/lib/components/dynamic/form/dynamic-form.component.d.ts +0 -14
  238. package/lib/components/dynamic/input/input.component.d.ts +0 -20
  239. package/lib/components/dynamic/input-phone/input-phone.component.d.ts +0 -20
  240. package/lib/components/dynamic/radio/radio.component.d.ts +0 -11
  241. package/lib/components/dynamic/select/select.component.d.ts +0 -16
  242. package/lib/components/dynamic/select-search/select-search.component.d.ts +0 -16
  243. package/lib/components/shared/filter/filter.component.d.ts +0 -32
  244. package/lib/components/shared/filter/filter.module.d.ts +0 -14
  245. package/lib/components/shared/filter/menu/menu.component.d.ts +0 -24
  246. package/lib/components/shared/filter/menu/menu.module.d.ts +0 -14
  247. package/lib/components/shared/filter/options/children/children.component.d.ts +0 -17
  248. package/lib/components/shared/filter/options/currency/currency.component.d.ts +0 -17
  249. package/lib/components/shared/filter/options/date-range/date-range.component.d.ts +0 -24
  250. package/lib/components/shared/filter/options/input/input.component.d.ts +0 -17
  251. package/lib/components/shared/filter/options/options.component.d.ts +0 -20
  252. package/lib/components/shared/filter/options/options.module.d.ts +0 -18
  253. package/lib/components/shared/filter/options/status/status.component.d.ts +0 -19
  254. package/lib/components/shared/filter/selected/item/children/children.component.d.ts +0 -16
  255. package/lib/components/shared/filter/selected/item/currency/currency.component.d.ts +0 -11
  256. package/lib/components/shared/filter/selected/item/date-range/date-range.component.d.ts +0 -12
  257. package/lib/components/shared/filter/selected/item/date-with-action/date-with-action.component.d.ts +0 -11
  258. package/lib/components/shared/filter/selected/item/input/input.component.d.ts +0 -11
  259. package/lib/components/shared/filter/selected/item/item.component.d.ts +0 -20
  260. package/lib/components/shared/filter/selected/item/status/status.component.d.ts +0 -13
  261. package/lib/components/shared/filter/selected/selected.component.d.ts +0 -18
  262. package/lib/components/shared/filter/selected/selected.module.d.ts +0 -21
  263. package/lib/components/shared/password-strength/password-strength.component.d.ts +0 -23
  264. package/lib/components/shared/password-strength/password-strength.d.ts +0 -5
  265. package/lib/components/shared/password-strength/password-strength.module.d.ts +0 -12
  266. package/lib/components/shared/products/filter/filter.component.d.ts +0 -12
  267. package/lib/components/shared/products/products.component.d.ts +0 -20
  268. package/lib/components/shared/products/products.module.d.ts +0 -11
  269. package/lib/components/shared/products/providers/products.model.d.ts +0 -13
  270. package/lib/components/shared/progress-bar/progress-bar.component.d.ts +0 -12
  271. package/lib/components/shared/progress-bar/progress-bar.module.d.ts +0 -8
  272. package/lib/components/shared/progress-bar/progress-bar.service.d.ts +0 -14
  273. package/lib/interfaces/field-config.d.ts +0 -54
  274. package/monkey-front-components-0.0.383.tgz +0 -0
  275. package/monkey-front-components.d.ts +0 -5
  276. package/public-api.d.ts +0 -1
@@ -1,2859 +0,0 @@
1
- import { Subject, BehaviorSubject } from 'rxjs';
2
- import * as i0 from '@angular/core';
3
- import { Directive, EventEmitter, Input, Output, Component, ViewEncapsulation, HostBinding, ViewChild, NgModule, Injectable } from '@angular/core';
4
- import { takeUntil, debounceTime, filter } from 'rxjs/operators';
5
- import * as i1$2 from 'monkey-style-guide';
6
- import { MonkeyUtils, MonkeyInputModule, MonkeySelectModule, MonkeyRadioButtonModule, MonkeyOptionModule, MonkeyFileUploadModule, MonkeyButtonModule, MonkeyInputPhoneModule, MonkeyBadgeModule, MonkeyCheckboxModule, MonkeyDateRangePickerModule, MonkeyIconModule } from 'monkey-style-guide';
7
- import * as i1$4 from 'monkey-front-core';
8
- import { MonkeyEcxCommonsService, ValidateUtils, Validators as Validators$1, MonkeyEcxUtils, MonkeyEcxDirectivesModule, MonkeyEcxPipesModule } from 'monkey-front-core';
9
- import * as i1 from '@angular/forms';
10
- import { Validators, FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';
11
- import * as i3 from '@angular/common';
12
- import { isPlatformBrowser, CommonModule } from '@angular/common';
13
- import * as i1$1 from '@angular/router';
14
- import { NavigationStart, NavigationEnd, RouterModule, NavigationError, NavigationCancel } from '@angular/router';
15
- import * as i1$3 from '@ngx-translate/core';
16
- import { TranslateModule } from '@ngx-translate/core';
17
-
18
- class BaseComponent {
19
- constructor() {
20
- this.__paginationOptions = null;
21
- this.__isMobile = this.isMobile();
22
- this.__locales = ['pt-BR', 'es-CL'];
23
- this.__unsubscribeAll = new Subject();
24
- }
25
- isMobile() {
26
- const isMobileWidth = (window.screen.width <= 640) ||
27
- (window.matchMedia &&
28
- window.matchMedia('only screen and (max-width: 640px)').matches);
29
- return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|Mobile/i.test(navigator.userAgent)) || isMobileWidth;
30
- }
31
- handlePagination(create = true) {
32
- const { __paginationOptions } = this;
33
- if (__paginationOptions) {
34
- const { mainElement, service } = __paginationOptions;
35
- const element = document.getElementById(mainElement);
36
- if (element) {
37
- element.scroll = null;
38
- element.onscroll = null;
39
- element.removeEventListener('scroll', element.eventListeners('scroll'));
40
- element.removeEventListener('scroll', element.eventListeners('scroll')[0]);
41
- if (create) {
42
- element.addEventListener('scroll', () => {
43
- const { scrollTop, scrollHeight, offsetHeight } = element;
44
- const contentHeight = scrollHeight - offsetHeight;
45
- if (contentHeight <= scrollTop) {
46
- service.doPagination();
47
- }
48
- });
49
- }
50
- }
51
- }
52
- }
53
- handleSupport(supportControls) {
54
- const { service, show } = supportControls;
55
- const method = show ? 'show' : 'hide';
56
- service[method.toLowerCase()]();
57
- }
58
- handleTranslate(translateOptions) {
59
- const { service } = translateOptions;
60
- service.__oni18nDataChanged$
61
- .pipe(takeUntil(this.__unsubscribeAll))
62
- .subscribe(() => {
63
- const data = service.__i18n;
64
- if (data) {
65
- this.__i18n = data;
66
- }
67
- });
68
- }
69
- handleViewScroll(options) {
70
- const { elementId, service } = options;
71
- if (elementId === service?.__savedState?.scrollElementId) {
72
- this.goScroll(elementId);
73
- service.__savedState.scrollElementId = null;
74
- }
75
- }
76
- getErrorFirstMessageTranslated(formControl = null) {
77
- if (formControl?.hasError('required'))
78
- return 'FIELD-REQUIRED';
79
- if (formControl?.hasError('invalid'))
80
- return 'FIELD-INVALID';
81
- if (formControl?.hasError('email'))
82
- return 'INVALID-EMAIL';
83
- if (formControl?.hasError('minlength'))
84
- return 'MIN-LENGTH';
85
- if (formControl?.hasError('maxlength'))
86
- return 'MAX-LENGTH';
87
- if (formControl?.hasError('max'))
88
- return 'MAX';
89
- if (formControl?.hasError('min'))
90
- return 'MIN';
91
- if (formControl?.hasError('passwordsNotMatching'))
92
- return 'MATCH-PASSWORD';
93
- if (formControl?.hasError('invalidDate'))
94
- return 'INVALID-DATE';
95
- if (formControl?.hasError('invalidTrue'))
96
- return 'INVALID-TRUE';
97
- if (formControl?.hasError('invalidCpfCnpj'))
98
- return 'INVALID-DOCUMENT';
99
- if (formControl?.hasError('invalidZipCode'))
100
- return 'INVALID-ZIPCODE';
101
- if (formControl?.hasError('invalidCombo'))
102
- return 'INVALID-COMBO';
103
- if (formControl?.hasError('invalidUrl'))
104
- return 'INVALID-URL';
105
- if (formControl?.hasError('invalidUnlockRegister')) {
106
- return 'INVALID-UNLOCK-REGISTER';
107
- }
108
- if (formControl?.hasError('dateStartMustBeLessThanAnd')) {
109
- return 'DATE-START-MUST-BE-LESS-THAN-AND';
110
- }
111
- if (formControl?.hasError('dateEndMustBeGreaterThanStart')) {
112
- return 'DATE-END-MUST-BE-GREATER-THAN-SART';
113
- }
114
- if (formControl?.hasError('phone'))
115
- return 'INVALID-PHONE';
116
- if (formControl?.hasError('invalidValueGreaterThanZero'))
117
- return 'INVALID-GREATER-THAN-ZERO';
118
- return 'FIELD-INVALID';
119
- }
120
- getErrorLastMessageNotTranslated(formControl = null) {
121
- if (formControl?.hasError('minlength')) {
122
- return `${formControl?.getError('minlength').requiredLength} caracteres.`;
123
- }
124
- if (formControl?.hasError('maxlength')) {
125
- return `${formControl?.getError('maxlength').requiredLength} caracteres.`;
126
- }
127
- if (formControl?.hasError('max')) {
128
- return `${formControl?.getError('max').max}`;
129
- }
130
- if (formControl?.hasError('min')) {
131
- return `${formControl?.getError('min').min}`;
132
- }
133
- return '';
134
- }
135
- validateFormWithTranslate(f, index) {
136
- const formErrors = f.value;
137
- if (f.status === 'VALID')
138
- return true;
139
- if (!formErrors)
140
- return true;
141
- Object.entries(formErrors).forEach(([key, value]) => {
142
- const control = f.get(key);
143
- formErrors[key] = '';
144
- if (control && !control.valid) {
145
- const msg = {
146
- first: `ERRORS.${this.getErrorFirstMessageTranslated(f.get(key))}`,
147
- last: this.getErrorLastMessageNotTranslated(f.get(key))
148
- };
149
- formErrors[key] = msg;
150
- }
151
- });
152
- if (MonkeyUtils.persistNullEmptyUndefined(index)) {
153
- this.__monkeyecxFormErrors[index || 0] = formErrors;
154
- }
155
- else {
156
- this.__monkeyecxFormErrors = formErrors;
157
- }
158
- return false;
159
- }
160
- copyToClipboard(val) {
161
- const selBox = document.createElement('textarea');
162
- selBox.style.position = 'fixed';
163
- selBox.style.left = '0';
164
- selBox.style.top = '0';
165
- selBox.style.opacity = '0';
166
- selBox.value = val;
167
- document.body.appendChild(selBox);
168
- selBox.focus();
169
- selBox.select();
170
- document.execCommand('copy');
171
- document.body.removeChild(selBox);
172
- }
173
- validateForm(f, index, alias) {
174
- const formErrors = f.value;
175
- if (f.status === 'VALID')
176
- return true;
177
- if (!formErrors)
178
- return true;
179
- Object.entries(formErrors).forEach(([key, value]) => {
180
- const control = f.get(key);
181
- formErrors[key] = '';
182
- if (control && !control.valid) {
183
- const msg = {
184
- firstMessage: `ERRORS.${this.getErrorFirstMessageTranslated(f.get(key))}`,
185
- lastMessage: this.getErrorLastMessageNotTranslated(f.get(key))
186
- };
187
- formErrors[key] = msg;
188
- }
189
- });
190
- if (MonkeyUtils.persistNullEmptyUndefined(index)) {
191
- this.__monkeyecxFormErrors[index || 0] = formErrors;
192
- }
193
- else {
194
- let obj;
195
- if (alias) {
196
- obj = {
197
- [alias]: {
198
- ...formErrors
199
- }
200
- };
201
- }
202
- else {
203
- obj = formErrors;
204
- }
205
- this.__monkeyecxFormErrors = {
206
- ...this.__monkeyecxFormErrors,
207
- ...obj
208
- };
209
- }
210
- f.markAllAsTouched();
211
- return false;
212
- }
213
- clearAllServiceData(clearData) {
214
- const context = this;
215
- Object.values(context).forEach((ctx) => {
216
- if (ctx instanceof MonkeyEcxCommonsService) {
217
- ctx.clear(clearData);
218
- }
219
- });
220
- }
221
- ngOnInit(args) {
222
- if (args?.paginationOptions) {
223
- this.__paginationOptions = args?.paginationOptions;
224
- this.handlePagination();
225
- }
226
- if (args?.supportControls) {
227
- this.handleSupport(args?.supportControls);
228
- }
229
- if (args?.translateOptions) {
230
- this.handleTranslate(args?.translateOptions);
231
- }
232
- if (args?.scrollOptions) {
233
- this.handleViewScroll(args.scrollOptions);
234
- }
235
- }
236
- ngOnDestroy(clearData = true) {
237
- this.__unsubscribeAll.next();
238
- this.__unsubscribeAll.complete();
239
- this.clearAllServiceData(clearData);
240
- this.handlePagination(false);
241
- }
242
- handleErrorFromServices(error, f) {
243
- this.__monkeyecxFormErrors = null;
244
- if (error.type === 'Parameter_Error') {
245
- Object.entries(f.value).forEach(([key, value]) => {
246
- error.notifications.forEach((_) => {
247
- const field = _.split(':')[0];
248
- const description = _.split(':')[1];
249
- if (field === key) {
250
- const msg = {
251
- firstMessage: '',
252
- lastMessage: description
253
- };
254
- this.__monkeyecxFormErrors = {
255
- ...this.__monkeyecxFormErrors,
256
- [key]: msg
257
- };
258
- f.controls[key].setErrors({
259
- incorrect: true
260
- });
261
- }
262
- });
263
- });
264
- }
265
- f.markAllAsTouched();
266
- }
267
- goBack() {
268
- window.history.back();
269
- }
270
- goScroll(id) {
271
- const element = document.getElementById(id);
272
- if (element)
273
- element.scrollIntoView();
274
- }
275
- getEmbeddedData(data, field) {
276
- const { _embedded } = data;
277
- return _embedded ? _embedded[field] : null;
278
- }
279
- openWindow(url) {
280
- window.open(`${url}`, '_blank');
281
- }
282
- fillI18n(data) {
283
- this.__i18n = data;
284
- }
285
- getCountryPrefix(country) {
286
- return {
287
- br: 55,
288
- cl: 56
289
- }[country];
290
- }
291
- getCountryCurrencyChartFormat(country) {
292
- return {
293
- br: 'R$ #,###,##0.00',
294
- cl: 'CLP #,###,##0'
295
- }[country];
296
- }
297
- getCountryValidators(country) {
298
- return {
299
- br: {
300
- governmentId: ValidateUtils.DocumentValidator
301
- },
302
- cl: {
303
- governmentId: ValidateUtils.DocumentRutValidator
304
- }
305
- }[country];
306
- }
307
- isAbleToHandlePagination() {
308
- const { __paginationOptions } = this;
309
- if (__paginationOptions) {
310
- const { service } = __paginationOptions;
311
- const links = service.__links;
312
- if (links && links?.next)
313
- return true;
314
- }
315
- return false;
316
- }
317
- onHandlePagination() {
318
- const { __paginationOptions } = this;
319
- if (__paginationOptions) {
320
- const { service } = __paginationOptions;
321
- service.doPagination();
322
- }
323
- }
324
- }
325
- BaseComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
326
- BaseComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.1", type: BaseComponent, selector: "[baseComponent]", ngImport: i0 });
327
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BaseComponent, decorators: [{
328
- type: Directive,
329
- args: [{
330
- selector: '[baseComponent]'
331
- }]
332
- }], ctorParameters: function () { return []; } });
333
-
334
- const validators = {
335
- required: Validators.required,
336
- email: Validators$1.email,
337
- governmentId: Validators$1.documentBR,
338
- governmentIdRut: Validators$1.documentCL,
339
- documentBR: Validators$1.documentBR,
340
- documentCL: Validators$1.documentCL,
341
- date: Validators$1.date,
342
- zipCode: Validators$1.zipCode,
343
- minLength: (param) => {
344
- return Validators.minLength(param);
345
- },
346
- maxLength: (param) => {
347
- return Validators.maxLength(param);
348
- }
349
- };
350
-
351
- class BaseDynamicArray extends BaseComponent {
352
- constructor(fb) {
353
- super();
354
- this.fb = fb;
355
- this.onHandleSubmit = new EventEmitter();
356
- this.onHandleUpdateForm = new EventEmitter();
357
- this.onHandleSubmitFormReady = new EventEmitter();
358
- this.fields = [];
359
- this.qtd = 1;
360
- this.disabled = false;
361
- this._form = null;
362
- // eslint-disable-next-line object-curly-newline
363
- this._plusValidations = [];
364
- this.changesUnsubscribe = new Subject();
365
- this.formBase = () => {
366
- // return this.fb.group(this.createControl());
367
- return this.createControl();
368
- };
369
- }
370
- handleInternalPlusValidation(mainField, data) {
371
- const { operator, field, value } = mainField;
372
- const validators = {
373
- e: (val1, val2) => { return val1 === val2; },
374
- lt: (val1, val2) => { return val1 < val2; },
375
- gt: (val1, val2) => { return val1 > val2; }
376
- };
377
- return validators[operator](data?.[field] || data, value);
378
- }
379
- makeInternalPlusValidation(data, sourceField, settings, rowIndex) {
380
- const changeFields = (show) => {
381
- const saved = [...this.fields];
382
- saved.map((val) => {
383
- const valSaved = {
384
- ...val
385
- };
386
- if (val.name === sourceField) {
387
- this._plusValidations[rowIndex] = {
388
- [sourceField]: {
389
- ...valSaved,
390
- alwaysShow: show
391
- }
392
- };
393
- this.createOneControl(val.name, this.formValues?.controls[rowIndex], show);
394
- }
395
- else {
396
- this._plusValidations[rowIndex] = {
397
- ...valSaved
398
- };
399
- }
400
- return null;
401
- });
402
- };
403
- const validated = this.handleInternalPlusValidation(settings, data);
404
- changeFields(validated);
405
- }
406
- createOneControl(fieldName, ctrl, create = true) {
407
- const { fields } = this;
408
- if (!fields)
409
- return;
410
- fields.forEach((field) => {
411
- const { fieldType, validations, name, disabled } = field;
412
- if (name !== fieldName)
413
- return;
414
- let { value } = field;
415
- if (fieldType === 'button')
416
- return;
417
- if (fieldType === 'radiobutton' || fieldType === 'checkbox' || fieldType === 'select') {
418
- value = '';
419
- }
420
- if (create) {
421
- const control = this.fb.control(value, this.bindValidations(validations || []));
422
- if (disabled || this.disabled)
423
- control.disable();
424
- ctrl.addControl(name, control);
425
- }
426
- else {
427
- ctrl.removeControl(name);
428
- }
429
- });
430
- }
431
- createControl(data) {
432
- const { fields } = this;
433
- if (!fields)
434
- return null;
435
- // eslint-disable-next-line object-curly-newline
436
- const group = this.fb.group({});
437
- fields.forEach((field) => {
438
- const { fieldType, validations, name, disabled, alwaysShow } = field;
439
- let { value } = field;
440
- if (field.alwaysShowPlusValidation) {
441
- if (!this.handleInternalPlusValidation(field.alwaysShowPlusValidation, data))
442
- return;
443
- }
444
- else if (!alwaysShow)
445
- return;
446
- if (fieldType === 'button')
447
- return;
448
- if (fieldType === 'radiobutton' || fieldType === 'checkbox' || fieldType === 'select') {
449
- value = '';
450
- }
451
- const control = this.fb.control(value, this.bindValidations(validations || []));
452
- if (disabled || this.disabled)
453
- control.disable();
454
- group.addControl(name, control);
455
- });
456
- return group;
457
- }
458
- bindValidations(validations) {
459
- if (validations.length > 0) {
460
- const validList = [];
461
- validations.forEach((valid) => {
462
- const validated = valid.param
463
- ? validators[valid.name](valid.param)
464
- : validators[valid.name];
465
- validList.push(validated);
466
- });
467
- return Validators.compose(validList);
468
- }
469
- return null;
470
- }
471
- buildForm() {
472
- const form = this.fb.group({
473
- fields: this.fb.array([])
474
- });
475
- form?.controls.fields?.valueChanges.subscribe((_) => {
476
- this.watchForChanges();
477
- });
478
- return form;
479
- }
480
- watchForChanges() {
481
- const { fields, changesUnsubscribe } = this;
482
- changesUnsubscribe.next();
483
- this.formValues?.controls?.map((control, index) => {
484
- fields.forEach((fieldConfig) => {
485
- const { name, alwaysShowPlusValidation } = fieldConfig;
486
- if (!alwaysShowPlusValidation)
487
- return;
488
- const { field } = alwaysShowPlusValidation;
489
- if (field) {
490
- control.controls[field]?.valueChanges.pipe(takeUntil(changesUnsubscribe)).subscribe((_) => {
491
- this.makeInternalPlusValidation(_, name, alwaysShowPlusValidation, index);
492
- });
493
- }
494
- });
495
- return null;
496
- });
497
- }
498
- get formValues() {
499
- return this._form ? this._form.get('fields') : null;
500
- }
501
- fillValues() {
502
- const { data, qtd } = this;
503
- if ((!this._form) && qtd)
504
- return;
505
- if (qtd > 0) {
506
- Array(qtd)
507
- .fill(null)
508
- .map((_, index) => {
509
- let form = this.createControl();
510
- if (data && data[index]) {
511
- form = this.createControl(data[index]);
512
- const handledData = data[index];
513
- Object.entries(handledData).forEach(([key, value]) => {
514
- if (MonkeyUtils.persistNullEmptyUndefined(value) && form?.controls[key]) {
515
- form?.controls[key].setValue(value);
516
- }
517
- });
518
- }
519
- this.formValues?.push(form);
520
- return null;
521
- });
522
- }
523
- }
524
- ngOnInit() {
525
- this._form = this.buildForm();
526
- this.fillValues();
527
- this.onHandleUpdateForm.subscribe(() => {
528
- this.fillValues();
529
- });
530
- }
531
- ngOnChanges() {
532
- if (!this._form) {
533
- this._form = this.buildForm();
534
- }
535
- this.fillValues();
536
- }
537
- }
538
- BaseDynamicArray.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BaseDynamicArray, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Directive });
539
- BaseDynamicArray.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.1", type: BaseDynamicArray, selector: "[baseDynamicArray]", inputs: { onHandleSubmit: "onHandleSubmit", onHandleUpdateForm: "onHandleUpdateForm", self: "self", fields: "fields", data: "data", qtd: "qtd", disabled: "disabled" }, outputs: { onHandleSubmitFormReady: "onHandleSubmitFormReady" }, usesInheritance: true, usesOnChanges: true, ngImport: i0 });
540
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BaseDynamicArray, decorators: [{
541
- type: Directive,
542
- args: [{
543
- selector: '[baseDynamicArray]'
544
- }]
545
- }], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { onHandleSubmit: [{
546
- type: Input
547
- }], onHandleUpdateForm: [{
548
- type: Input
549
- }], onHandleSubmitFormReady: [{
550
- type: Output
551
- }], self: [{
552
- type: Input
553
- }], fields: [{
554
- type: Input
555
- }], data: [{
556
- type: Input
557
- }], qtd: [{
558
- type: Input
559
- }], disabled: [{
560
- type: Input
561
- }] } });
562
-
563
- class BaseDynamic extends BaseComponent {
564
- constructor(fb) {
565
- super();
566
- this.fb = fb;
567
- this.onHandleSubmit = new EventEmitter();
568
- this.onHandleUpdateForm = new EventEmitter();
569
- this.onHandleSubmitFormReady = new EventEmitter();
570
- this.fields = [];
571
- this.disabled = false;
572
- this._form = null;
573
- }
574
- createControl() {
575
- const { fields } = this;
576
- if (!fields)
577
- return null;
578
- // eslint-disable-next-line object-curly-newline
579
- const group = this.fb.group({});
580
- fields.forEach((field) => {
581
- const { fieldType, validations, name, disabled } = field;
582
- let { value } = field;
583
- if (fieldType === 'button')
584
- return;
585
- if (fieldType === 'radiobutton' || fieldType === 'checkbox' || fieldType === 'select') {
586
- value = '';
587
- }
588
- const control = this.fb.control(value, this.bindValidations(validations || []));
589
- if (disabled || this.disabled)
590
- control.disable();
591
- group.addControl(name, control);
592
- });
593
- return group;
594
- }
595
- bindValidations(validations) {
596
- if (validations.length > 0) {
597
- const validList = [];
598
- validations.forEach((valid) => {
599
- const validated = valid.param
600
- ? validators[valid.name](valid.param)
601
- : validators[valid.name];
602
- validList.push(validated);
603
- });
604
- return Validators.compose(validList);
605
- }
606
- return null;
607
- }
608
- fillValues() {
609
- const { data } = this;
610
- if (!data || !this._form)
611
- return;
612
- Object.entries(data).forEach(([key, value]) => {
613
- if (MonkeyUtils.persistNullEmptyUndefined(value) && this._form?.controls[key]) {
614
- this._form?.controls[key]?.setValue(value);
615
- }
616
- });
617
- }
618
- ngOnInit() {
619
- this._form = this.createControl();
620
- this.fillValues();
621
- this.onHandleUpdateForm.subscribe(() => {
622
- this.fillValues();
623
- });
624
- }
625
- ngOnChanges() {
626
- if (!this._form) {
627
- this._form = this.createControl();
628
- }
629
- this.fillValues();
630
- }
631
- }
632
- BaseDynamic.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BaseDynamic, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Directive });
633
- BaseDynamic.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.1", type: BaseDynamic, selector: "[baseDynamic]", inputs: { onHandleSubmit: "onHandleSubmit", onHandleUpdateForm: "onHandleUpdateForm", self: "self", fields: "fields", data: "data", disabled: "disabled" }, outputs: { onHandleSubmitFormReady: "onHandleSubmitFormReady" }, usesInheritance: true, usesOnChanges: true, ngImport: i0 });
634
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BaseDynamic, decorators: [{
635
- type: Directive,
636
- args: [{
637
- selector: '[baseDynamic]'
638
- }]
639
- }], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { onHandleSubmit: [{
640
- type: Input
641
- }], onHandleUpdateForm: [{
642
- type: Input
643
- }], onHandleSubmitFormReady: [{
644
- type: Output
645
- }], self: [{
646
- type: Input
647
- }], fields: [{
648
- type: Input
649
- }], data: [{
650
- type: Input
651
- }], disabled: [{
652
- type: Input
653
- }] } });
654
-
655
- class BaseScrollComponent extends BaseComponent {
656
- constructor(_pId, _rt) {
657
- super();
658
- this._pId = _pId;
659
- this._rt = _rt;
660
- this.routeScrollPositions = {};
661
- }
662
- saveScroll(url) {
663
- const element = document.getElementById('container-3');
664
- this.routeScrollPositions[url] = element.scrollTop;
665
- }
666
- restoreScroll(url) {
667
- const savedScroll = this.routeScrollPositions[url];
668
- const element = document.getElementById('container-3');
669
- if (!savedScroll) {
670
- return;
671
- }
672
- element.scrollTop = savedScroll;
673
- }
674
- addScrollTopListeners() {
675
- if ('scrollRestoration' in history) {
676
- history.scrollRestoration = 'manual';
677
- }
678
- this._rt.events.subscribe(event => {
679
- if (event instanceof NavigationStart) {
680
- this.saveScroll(this._rt.url);
681
- }
682
- else if (event instanceof NavigationEnd) {
683
- setTimeout(() => {
684
- this.restoreScroll(event.url);
685
- });
686
- }
687
- });
688
- }
689
- ngOnInit() {
690
- if (isPlatformBrowser(this._pId)) {
691
- this.addScrollTopListeners();
692
- }
693
- }
694
- }
695
- BaseScrollComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BaseScrollComponent, deps: [{ token: Object }, { token: i1$1.Router }], target: i0.ɵɵFactoryTarget.Directive });
696
- BaseScrollComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.1", type: BaseScrollComponent, selector: "[baseScrollComponent]", usesInheritance: true, ngImport: i0 });
697
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BaseScrollComponent, decorators: [{
698
- type: Directive,
699
- args: [{
700
- selector: '[baseScrollComponent]'
701
- }]
702
- }], ctorParameters: function () { return [{ type: Object }, { type: i1$1.Router }]; } });
703
-
704
- class MECXDynamicFileUploadComponent {
705
- constructor(cdr) {
706
- this.cdr = cdr;
707
- // eslint-disable-next-line object-curly-newline
708
- this._formErrors = {};
709
- this._function = (file, callback) => {
710
- if (this._form?.disabled)
711
- return;
712
- if (!this._field?.functions?.onHandleUpload) {
713
- console.error('onHandleUpload not declared');
714
- return;
715
- }
716
- const { func, type } = this._field?.functions?.onHandleUpload;
717
- if (!func || !this.self[func]) {
718
- console.error('onHandleUpload not declared');
719
- return;
720
- }
721
- this.self[func](file, type, callback);
722
- };
723
- // not to do
724
- }
725
- get className() {
726
- return this._field?.style?.class;
727
- }
728
- ngOnChanges() {
729
- this.cdr.detectChanges();
730
- }
731
- }
732
- MECXDynamicFileUploadComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXDynamicFileUploadComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
733
- MECXDynamicFileUploadComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: MECXDynamicFileUploadComponent, selector: "mecx-dynamic-file-upload", inputs: { _field: "_field", _form: "_form", _formErrors: "_formErrors", self: "self" }, host: { properties: { "class": "this.className" } }, usesOnChanges: true, ngImport: i0, template: "<monkey-file-upload\n errorMessage=\"{{ _formErrors[_field?.name]?.firstMessage | translate }} {{ _formErrors[_field?.name]?.lastMessage }}\"\n [icon]=\"_field?.icon\" [formControl]=\"_form.controls[_field?.name]\"\n [placeholder]=\"_field?.placeholder | translate\"\n [helperMessage]=\"_field?.helperMessage | translate\" [label]=\"_field?.label | translate\"\n [maxSize]=\"_field?.maxSize || 5242880\" [fileUpload]=\"_function\"\n [maxSizeErrorMessage]=\"'FIELD.FILE.MAX-FILE' | translate\"\n [allowedExtensionErrorMessage]=\"'FIELD.FILE.ALLOWED-EXTENSION' | translate\"\n [allowedExtensions]=\"_field?.allowedExtensions || []\" *ngIf=\"_field\">\n</monkey-file-upload>", components: [{ type: i1$2.MonkeyFileUploadComponent, selector: "monkey-file-upload", inputs: ["name", "label", "helperMessage", "placeholder", "icon", "infoMessage", "uploadOngoingMessage", "errorMessage", "listenFiles", "maxSize", "allowedExtensions", "maxSizeErrorMessage", "allowedExtensionErrorMessage", "fileUpload", "value"], outputs: ["onChange", "onHandleFilesReady"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], pipes: { "translate": i1$3.TranslatePipe }, encapsulation: i0.ViewEncapsulation.None });
734
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXDynamicFileUploadComponent, decorators: [{
735
- type: Component,
736
- args: [{ selector: 'mecx-dynamic-file-upload', encapsulation: ViewEncapsulation.None, template: "<monkey-file-upload\n errorMessage=\"{{ _formErrors[_field?.name]?.firstMessage | translate }} {{ _formErrors[_field?.name]?.lastMessage }}\"\n [icon]=\"_field?.icon\" [formControl]=\"_form.controls[_field?.name]\"\n [placeholder]=\"_field?.placeholder | translate\"\n [helperMessage]=\"_field?.helperMessage | translate\" [label]=\"_field?.label | translate\"\n [maxSize]=\"_field?.maxSize || 5242880\" [fileUpload]=\"_function\"\n [maxSizeErrorMessage]=\"'FIELD.FILE.MAX-FILE' | translate\"\n [allowedExtensionErrorMessage]=\"'FIELD.FILE.ALLOWED-EXTENSION' | translate\"\n [allowedExtensions]=\"_field?.allowedExtensions || []\" *ngIf=\"_field\">\n</monkey-file-upload>" }]
737
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { _field: [{
738
- type: Input
739
- }], _form: [{
740
- type: Input
741
- }], _formErrors: [{
742
- type: Input
743
- }], self: [{
744
- type: Input
745
- }], className: [{
746
- type: HostBinding,
747
- args: ['class']
748
- }] } });
749
-
750
- class MECXDynamicButtonComponent {
751
- constructor(cdr) {
752
- this.cdr = cdr;
753
- this._field = null;
754
- this._form = null;
755
- // eslint-disable-next-line object-curly-newline
756
- this._formErrors = {};
757
- // not to do
758
- }
759
- get className() {
760
- return this._field?.style?.class;
761
- }
762
- ngOnChanges() {
763
- this.cdr.detectChanges();
764
- }
765
- onClick() {
766
- const { _form, _field, self } = this;
767
- if (_form?.disabled || !_field)
768
- return;
769
- const { name, value } = _field;
770
- const func = _field?.functions?.onClick;
771
- if (func) {
772
- self[func]({
773
- name,
774
- value,
775
- form: _form
776
- });
777
- }
778
- }
779
- }
780
- MECXDynamicButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXDynamicButtonComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
781
- MECXDynamicButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: MECXDynamicButtonComponent, selector: "mecx-dynamic-button", inputs: { _field: "_field", _form: "_form", _formErrors: "_formErrors", self: "self" }, host: { properties: { "class": "this.className" } }, usesOnChanges: true, ngImport: i0, template: "<monkey-button [icon]=\"_field?.icon\" [type]=\"_field?.type\" [color]=\"_field?.color\"\n (click)=\"onClick()\">\n {{ _field?.label | translate }}\n</monkey-button>", styles: ["mecx-dynamic-button monkey-button button{height:40px}\n"], components: [{ type: i1$2.MonkeyButtonComponent, selector: "monkey-button", inputs: ["label", "icon", "iconPosition", "type", "color", "disabled", "size"] }], pipes: { "translate": i1$3.TranslatePipe }, encapsulation: i0.ViewEncapsulation.None });
782
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXDynamicButtonComponent, decorators: [{
783
- type: Component,
784
- args: [{ selector: 'mecx-dynamic-button', encapsulation: ViewEncapsulation.None, template: "<monkey-button [icon]=\"_field?.icon\" [type]=\"_field?.type\" [color]=\"_field?.color\"\n (click)=\"onClick()\">\n {{ _field?.label | translate }}\n</monkey-button>", styles: ["mecx-dynamic-button monkey-button button{height:40px}\n"] }]
785
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { _field: [{
786
- type: Input
787
- }], _form: [{
788
- type: Input
789
- }], _formErrors: [{
790
- type: Input
791
- }], self: [{
792
- type: Input
793
- }], className: [{
794
- type: HostBinding,
795
- args: ['class']
796
- }] } });
797
-
798
- class MECXDynamicInputComponent {
799
- constructor(cdr) {
800
- this.cdr = cdr;
801
- this._field = null;
802
- this._form = null;
803
- // eslint-disable-next-line object-curly-newline
804
- this._formErrors = {};
805
- this.inputElement = null;
806
- // not to do
807
- }
808
- get className() {
809
- return this._field?.style?.class;
810
- }
811
- ngOnInit() {
812
- this.cdr.detectChanges();
813
- }
814
- ngOnChanges() {
815
- this.cdr.detectChanges();
816
- }
817
- onChange(event) {
818
- const { _form, _field, self } = this;
819
- if (!_field || !_form)
820
- return;
821
- const { name } = _field;
822
- const func = _field?.functions?.onChange;
823
- const isValid = _form?.get(_field?.name)?.valid;
824
- if (func) {
825
- self[func]({
826
- name,
827
- isValid,
828
- event,
829
- ctrl: _form.get(this._field?.name),
830
- form: _form
831
- });
832
- }
833
- }
834
- }
835
- MECXDynamicInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXDynamicInputComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
836
- MECXDynamicInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: MECXDynamicInputComponent, selector: "mecx-dynamic-input", inputs: { _field: "_field", _form: "_form", _formErrors: "_formErrors", self: "self" }, host: { properties: { "class": "this.className" } }, viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["inputElement"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<monkey-input\r\n errorMessage=\"{{ _formErrors[_field?.name]?.firstMessage | translate }} {{ _formErrors[_field?.name]?.lastMessage }}\"\r\n [mask]=\"_field?.mask\" [prefix]=\"_field?.prefix\" [name]=\"_field?.name\"\r\n [formControl]=\"_form.controls[_field?.name]\" [placeholder]=\"_field?.placeholder | translate\"\r\n [helperMessage]=\"_field?.helperMessage | translate\" [label]=\"_field?.label | translate\"\r\n [type]=\"_field?.type\" #inputElement (onChange)=\"onChange($event)\"\r\n [onlyNumber]=\"_field?.onlyNumber\" [currency]=\"_field?.currency\" [maxLength]=\"_field?.maxLength\"\r\n [maxDateToday]=\"_field?.maxDateToday\">\r\n</monkey-input>", components: [{ type: i1$2.MonkeyInputComponent, selector: "monkey-input", inputs: ["name", "label", "helperMessage", "placeholder", "icon", "type", "infoMessage", "errorMessage", "mask", "prefix", "maxLength", "onlyNumber", "onlyAlphaNumeric", "upperCase", "lowerCase", "capitalize", "currency", "percent", "maxDateToday", "value"], outputs: ["onChange"] }], directives: [{ type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], pipes: { "translate": i1$3.TranslatePipe }, encapsulation: i0.ViewEncapsulation.None });
837
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXDynamicInputComponent, decorators: [{
838
- type: Component,
839
- args: [{ selector: 'mecx-dynamic-input', encapsulation: ViewEncapsulation.None, template: "<monkey-input\r\n errorMessage=\"{{ _formErrors[_field?.name]?.firstMessage | translate }} {{ _formErrors[_field?.name]?.lastMessage }}\"\r\n [mask]=\"_field?.mask\" [prefix]=\"_field?.prefix\" [name]=\"_field?.name\"\r\n [formControl]=\"_form.controls[_field?.name]\" [placeholder]=\"_field?.placeholder | translate\"\r\n [helperMessage]=\"_field?.helperMessage | translate\" [label]=\"_field?.label | translate\"\r\n [type]=\"_field?.type\" #inputElement (onChange)=\"onChange($event)\"\r\n [onlyNumber]=\"_field?.onlyNumber\" [currency]=\"_field?.currency\" [maxLength]=\"_field?.maxLength\"\r\n [maxDateToday]=\"_field?.maxDateToday\">\r\n</monkey-input>" }]
840
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { _field: [{
841
- type: Input
842
- }], _form: [{
843
- type: Input
844
- }], _formErrors: [{
845
- type: Input
846
- }], self: [{
847
- type: Input
848
- }], inputElement: [{
849
- type: ViewChild,
850
- args: ['inputElement', {
851
- static: true
852
- }]
853
- }], className: [{
854
- type: HostBinding,
855
- args: ['class']
856
- }] } });
857
-
858
- class MECXDynamicInputPhoneComponent {
859
- constructor(cdr) {
860
- this.cdr = cdr;
861
- this._field = null;
862
- this._form = null;
863
- // eslint-disable-next-line object-curly-newline
864
- this._formErrors = {};
865
- this.inputElement = null;
866
- // not to do
867
- }
868
- get className() {
869
- return this._field?.style?.class;
870
- }
871
- ngOnInit() {
872
- this.cdr.detectChanges();
873
- }
874
- ngOnChanges() {
875
- this.cdr.detectChanges();
876
- }
877
- onChange(event) {
878
- const { _form, _field, self } = this;
879
- if (!_field || !_form)
880
- return;
881
- const { name } = _field;
882
- const func = _field?.functions?.onChange;
883
- const isValid = _form?.get(_field?.name)?.valid;
884
- if (func) {
885
- self[func]({
886
- name,
887
- isValid,
888
- event,
889
- ctrl: _form.get(this._field?.name),
890
- form: _form
891
- });
892
- }
893
- }
894
- }
895
- MECXDynamicInputPhoneComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXDynamicInputPhoneComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
896
- MECXDynamicInputPhoneComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: MECXDynamicInputPhoneComponent, selector: "mecx-dynamic-input-phone", inputs: { _field: "_field", _form: "_form", _formErrors: "_formErrors", self: "self" }, host: { properties: { "class": "this.className" } }, viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["inputElement"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<monkey-input-phone [name]=\"_field?.name\" [label]=\"_field?.label | translate\"\r\n [helperMessage]=\"_field?.helperMessage | translate\"\r\n [placeholder]=\"_field?.placeholder | translate\" [icon]=\"_field?.icon\"\r\n (onChange)=\"onChange($event)\" [internationalNumber]=\"_field?.internationalNumber\"\r\n errorMessage=\"{{ _formErrors[_field?.name]?.firstMessage | translate }} {{ _formErrors[_field?.name]?.lastMessage }}\"\r\n [maxLength]=\"_field?.maxLength\" [formControl]=\"_form.controls[_field?.name]\" #inputElement>\r\n</monkey-input-phone>", components: [{ type: i1$2.MonkeyInputPhoneComponent, selector: "monkey-input-phone", inputs: ["name", "label", "helperMessage", "placeholder", "icon", "infoMessage", "errorMessage", "maxLength", "internationalNumber", "value"], outputs: ["onChange"] }], directives: [{ type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], pipes: { "translate": i1$3.TranslatePipe }, encapsulation: i0.ViewEncapsulation.None });
897
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXDynamicInputPhoneComponent, decorators: [{
898
- type: Component,
899
- args: [{ selector: 'mecx-dynamic-input-phone', encapsulation: ViewEncapsulation.None, template: "<monkey-input-phone [name]=\"_field?.name\" [label]=\"_field?.label | translate\"\r\n [helperMessage]=\"_field?.helperMessage | translate\"\r\n [placeholder]=\"_field?.placeholder | translate\" [icon]=\"_field?.icon\"\r\n (onChange)=\"onChange($event)\" [internationalNumber]=\"_field?.internationalNumber\"\r\n errorMessage=\"{{ _formErrors[_field?.name]?.firstMessage | translate }} {{ _formErrors[_field?.name]?.lastMessage }}\"\r\n [maxLength]=\"_field?.maxLength\" [formControl]=\"_form.controls[_field?.name]\" #inputElement>\r\n</monkey-input-phone>" }]
900
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { _field: [{
901
- type: Input
902
- }], _form: [{
903
- type: Input
904
- }], _formErrors: [{
905
- type: Input
906
- }], self: [{
907
- type: Input
908
- }], inputElement: [{
909
- type: ViewChild,
910
- args: ['inputElement', {
911
- static: true
912
- }]
913
- }], className: [{
914
- type: HostBinding,
915
- args: ['class']
916
- }] } });
917
-
918
- class MECXDynamicRadioComponent {
919
- constructor() {
920
- this._field = null;
921
- this._form = null;
922
- // eslint-disable-next-line object-curly-newline
923
- this._formErrors = {};
924
- }
925
- get className() {
926
- return this._field?.style?.class;
927
- }
928
- }
929
- MECXDynamicRadioComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXDynamicRadioComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
930
- MECXDynamicRadioComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: MECXDynamicRadioComponent, selector: "mecx-dynamic-radio", inputs: { _field: "_field", _form: "_form", _formErrors: "_formErrors" }, host: { properties: { "class": "this.className" } }, ngImport: i0, template: "<monkey-radiobutton\n errorMessage=\"{{ _formErrors[_field?.name]?.firstMessage | translate }} {{ _formErrors[_field?.name]?.lastMessage }}\"\n [formControl]=\"_form.controls[_field?.name]\" [helperMessage]=\"_field?.helperMessage | translate\"\n [label]=\"_field?.label | translate\">\n <monkey-option *ngFor=\"let value of _field?.value\" [label]=\"value.description | translate\"\n [value]=\"value.value\">\n </monkey-option>\n</monkey-radiobutton>", components: [{ type: i1$2.MonkeyRadioButtonComponent, selector: "monkey-radiobutton", inputs: ["label", "helperMessage", "placeholder", "icon", "infoMessage", "errorMessage", "value"], outputs: ["onChange"] }, { type: i1$2.MonkeyOptionComponent, selector: "monkey-option", inputs: ["type", "label", "value", "selectAll", "selected", "enableClick"], outputs: ["onSelectOption"] }], directives: [{ type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "translate": i1$3.TranslatePipe }, encapsulation: i0.ViewEncapsulation.None });
931
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXDynamicRadioComponent, decorators: [{
932
- type: Component,
933
- args: [{ selector: 'mecx-dynamic-radio', encapsulation: ViewEncapsulation.None, template: "<monkey-radiobutton\n errorMessage=\"{{ _formErrors[_field?.name]?.firstMessage | translate }} {{ _formErrors[_field?.name]?.lastMessage }}\"\n [formControl]=\"_form.controls[_field?.name]\" [helperMessage]=\"_field?.helperMessage | translate\"\n [label]=\"_field?.label | translate\">\n <monkey-option *ngFor=\"let value of _field?.value\" [label]=\"value.description | translate\"\n [value]=\"value.value\">\n </monkey-option>\n</monkey-radiobutton>" }]
934
- }], propDecorators: { _field: [{
935
- type: Input
936
- }], _form: [{
937
- type: Input
938
- }], _formErrors: [{
939
- type: Input
940
- }], className: [{
941
- type: HostBinding,
942
- args: ['class']
943
- }] } });
944
-
945
- class MECXDynamicSelectComponent {
946
- constructor() {
947
- this._field = null;
948
- this._form = null;
949
- // eslint-disable-next-line object-curly-newline
950
- this._formErrors = {};
951
- this._onHandleOptions = new EventEmitter();
952
- }
953
- get className() {
954
- return this._field?.style?.class;
955
- }
956
- onHandleGenericLoad() {
957
- const { _form, _field, self } = this;
958
- if (_form?.disabled || !_field || !_field?.functions?.onHandleGenericLoad)
959
- return;
960
- const { name } = _field;
961
- if (_field?.value?.length)
962
- return;
963
- const { func, url } = _field?.functions?.onHandleGenericLoad;
964
- if (!func || !self[func]) {
965
- console.error('onHandleGenericLoad not declared');
966
- return;
967
- }
968
- _form?.disable();
969
- self[func]({
970
- name,
971
- url,
972
- form: _form,
973
- callback: (data) => {
974
- if (this._field) {
975
- this._field.value = data;
976
- }
977
- this._form?.enable();
978
- this._onHandleOptions.next(null);
979
- }
980
- });
981
- }
982
- onChange(event) {
983
- const { _form, _field, self } = this;
984
- if (!_field || !_form)
985
- return;
986
- const { name } = _field;
987
- const func = _field?.functions?.onChange;
988
- const isValid = _form?.get(_field.name)?.valid;
989
- if (func) {
990
- self[func]({
991
- name,
992
- isValid,
993
- event,
994
- ctrl: _form?.get(this._field?.name),
995
- form: _form,
996
- value: _field.value
997
- });
998
- }
999
- }
1000
- }
1001
- MECXDynamicSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXDynamicSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1002
- MECXDynamicSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: MECXDynamicSelectComponent, selector: "mecx-dynamic-select", inputs: { _field: "_field", _form: "_form", _formErrors: "_formErrors", self: "self" }, host: { properties: { "class": "this.className" } }, ngImport: i0, template: "<monkey-select\n errorMessage=\"{{ _formErrors[_field?.name]?.firstMessage | translate }} {{ _formErrors[_field?.name]?.lastMessage }}\"\n [formControl]=\"_form.controls[_field?.name]\" [helperMessage]=\"_field?.helperMessage | translate\"\n [label]=\"_field?.label | translate\" (click)=\"onHandleGenericLoad()\"\n [onHandleOptions]=\"_onHandleOptions\" (onChange)=\"onChange($event)\"\n [labelSelect]=\"_form.get(_field?.name).value || ('FIELD.SELECT' | translate)\"\n [placeholder]=\"_field?.placeholder | translate\">\n <monkey-option [label]=\"'FIELD.LOADING' | translate\" *ngIf=\"!_field?.value?.length\"\n enableClick=\"false\">\n </monkey-option>\n <monkey-option *ngFor=\"let value of _field?.value\" [label]=\"value.description | translate\"\n [value]=\"value.value\">\n </monkey-option>\n</monkey-select>", components: [{ type: i1$2.MonkeySelectComponent, selector: "monkey-select", inputs: ["label", "helperMessage", "placeholder", "icon", "infoMessage", "errorMessage", "labelSelect", "onHandleOptions", "value"], outputs: ["onChange"] }, { type: i1$2.MonkeyOptionComponent, selector: "monkey-option", inputs: ["type", "label", "value", "selectAll", "selected", "enableClick"], outputs: ["onSelectOption"] }], directives: [{ type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "translate": i1$3.TranslatePipe }, encapsulation: i0.ViewEncapsulation.None });
1003
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXDynamicSelectComponent, decorators: [{
1004
- type: Component,
1005
- args: [{ selector: 'mecx-dynamic-select', encapsulation: ViewEncapsulation.None, template: "<monkey-select\n errorMessage=\"{{ _formErrors[_field?.name]?.firstMessage | translate }} {{ _formErrors[_field?.name]?.lastMessage }}\"\n [formControl]=\"_form.controls[_field?.name]\" [helperMessage]=\"_field?.helperMessage | translate\"\n [label]=\"_field?.label | translate\" (click)=\"onHandleGenericLoad()\"\n [onHandleOptions]=\"_onHandleOptions\" (onChange)=\"onChange($event)\"\n [labelSelect]=\"_form.get(_field?.name).value || ('FIELD.SELECT' | translate)\"\n [placeholder]=\"_field?.placeholder | translate\">\n <monkey-option [label]=\"'FIELD.LOADING' | translate\" *ngIf=\"!_field?.value?.length\"\n enableClick=\"false\">\n </monkey-option>\n <monkey-option *ngFor=\"let value of _field?.value\" [label]=\"value.description | translate\"\n [value]=\"value.value\">\n </monkey-option>\n</monkey-select>" }]
1006
- }], propDecorators: { _field: [{
1007
- type: Input
1008
- }], _form: [{
1009
- type: Input
1010
- }], _formErrors: [{
1011
- type: Input
1012
- }], self: [{
1013
- type: Input
1014
- }], className: [{
1015
- type: HostBinding,
1016
- args: ['class']
1017
- }] } });
1018
-
1019
- class MECXDynamicSelectSearchComponent {
1020
- constructor() {
1021
- this._field = null;
1022
- this._form = null;
1023
- // eslint-disable-next-line object-curly-newline
1024
- this._formErrors = {};
1025
- this._onHandleOptions = new EventEmitter();
1026
- }
1027
- get className() {
1028
- return this._field?.style?.class;
1029
- }
1030
- onHandleGenericLoad() {
1031
- const { _form, _field, self } = this;
1032
- if (_form?.disabled || !_field || !_field?.functions?.onHandleGenericLoad)
1033
- return;
1034
- const { name } = _field;
1035
- const { func, url } = _field?.functions?.onHandleGenericLoad || {
1036
- func: null, url: ''
1037
- };
1038
- if (!func || !self[func]) {
1039
- console.error('onHandleGenericLoad not declared');
1040
- return;
1041
- }
1042
- _form?.disable();
1043
- self[func]({
1044
- name,
1045
- url,
1046
- form: _form,
1047
- callback: (data) => {
1048
- if (this._field) {
1049
- this._field.value = data;
1050
- }
1051
- this._form?.enable();
1052
- this._onHandleOptions.next(null);
1053
- }
1054
- });
1055
- }
1056
- onChange(event) {
1057
- const { _form, _field, self } = this;
1058
- if (!_field || !_form)
1059
- return;
1060
- const { name } = _field;
1061
- const func = _field?.functions?.onChange;
1062
- const isValid = _form?.get(_field?.name)?.valid;
1063
- if (func) {
1064
- self[func]({
1065
- name,
1066
- isValid,
1067
- event,
1068
- ctrl: _form.get(this._field?.name),
1069
- form: _form,
1070
- value: _field.value
1071
- });
1072
- }
1073
- }
1074
- }
1075
- MECXDynamicSelectSearchComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXDynamicSelectSearchComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1076
- MECXDynamicSelectSearchComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: MECXDynamicSelectSearchComponent, selector: "mecx-dynamic-select-search", inputs: { _field: "_field", _form: "_form", _formErrors: "_formErrors", self: "self" }, host: { properties: { "class": "this.className" } }, ngImport: i0, template: "<monkey-select-search\n errorMessage=\"{{ _formErrors[_field?.name]?.firstMessage | translate }} {{ _formErrors[_field?.name]?.lastMessage }}\"\n [formControl]=\"_form.controls[_field?.name]\" [helperMessage]=\"_field?.helperMessage | translate\"\n [label]=\"_field?.label | translate\" (click)=\"onHandleGenericLoad()\"\n [onHandleOptions]=\"_onHandleOptions\" (onChange)=\"onChange($event)\"\n [fieldToCompare]=\"_field?.fieldToCompare\"\n [labelSelect]=\"_form.get(_field?.name).value || ('FIELD.SELECT' | translate)\"\n [placeholder]=\"_field?.placeholder | translate\">\n <monkey-option [label]=\"'FIELD.LOADING' | translate\" *ngIf=\"!_field?.value?.length\"\n enableClick=\"false\">\n </monkey-option>\n <monkey-option *ngFor=\"let value of _field?.value\" [label]=\"value.description | translate\"\n [value]=\"value.value\">\n </monkey-option>\n</monkey-select-search>", components: [{ type: i1$2.MonkeySelectSearchComponent, selector: "monkey-select-search", inputs: ["label", "helperMessage", "placeholder", "icon", "infoMessage", "errorMessage", "labelSelect", "fieldToCompare", "onHandleOptions", "value"], outputs: ["onChange", "onSearch"] }, { type: i1$2.MonkeyOptionComponent, selector: "monkey-option", inputs: ["type", "label", "value", "selectAll", "selected", "enableClick"], outputs: ["onSelectOption"] }], directives: [{ type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "translate": i1$3.TranslatePipe }, encapsulation: i0.ViewEncapsulation.None });
1077
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXDynamicSelectSearchComponent, decorators: [{
1078
- type: Component,
1079
- args: [{ selector: 'mecx-dynamic-select-search', encapsulation: ViewEncapsulation.None, template: "<monkey-select-search\n errorMessage=\"{{ _formErrors[_field?.name]?.firstMessage | translate }} {{ _formErrors[_field?.name]?.lastMessage }}\"\n [formControl]=\"_form.controls[_field?.name]\" [helperMessage]=\"_field?.helperMessage | translate\"\n [label]=\"_field?.label | translate\" (click)=\"onHandleGenericLoad()\"\n [onHandleOptions]=\"_onHandleOptions\" (onChange)=\"onChange($event)\"\n [fieldToCompare]=\"_field?.fieldToCompare\"\n [labelSelect]=\"_form.get(_field?.name).value || ('FIELD.SELECT' | translate)\"\n [placeholder]=\"_field?.placeholder | translate\">\n <monkey-option [label]=\"'FIELD.LOADING' | translate\" *ngIf=\"!_field?.value?.length\"\n enableClick=\"false\">\n </monkey-option>\n <monkey-option *ngFor=\"let value of _field?.value\" [label]=\"value.description | translate\"\n [value]=\"value.value\">\n </monkey-option>\n</monkey-select-search>" }]
1080
- }], propDecorators: { _field: [{
1081
- type: Input
1082
- }], _form: [{
1083
- type: Input
1084
- }], _formErrors: [{
1085
- type: Input
1086
- }], self: [{
1087
- type: Input
1088
- }], className: [{
1089
- type: HostBinding,
1090
- args: ['class']
1091
- }] } });
1092
-
1093
- const componentMapper = {
1094
- input: MECXDynamicInputComponent,
1095
- 'input-phone': MECXDynamicInputPhoneComponent,
1096
- radiobutton: MECXDynamicRadioComponent,
1097
- select: MECXDynamicSelectComponent,
1098
- 'select-search': MECXDynamicSelectSearchComponent,
1099
- 'file-upload': MECXDynamicFileUploadComponent,
1100
- button: MECXDynamicButtonComponent
1101
- };
1102
- class MECXDynamicDirective {
1103
- constructor(resolver, container, cdr) {
1104
- this.resolver = resolver;
1105
- this.container = container;
1106
- this.cdr = cdr;
1107
- this.field = null;
1108
- this.form = null;
1109
- // not to do
1110
- }
1111
- handleInternalPlusValidation() {
1112
- if (!this.field?.alwaysShowPlusValidation)
1113
- return false;
1114
- const { operator, value, field } = this.field?.alwaysShowPlusValidation;
1115
- const validators = {
1116
- e: (val1, val2) => { return val1 === val2; },
1117
- lt: (val1, val2) => { return val1 < val2; },
1118
- gt: (val1, val2) => { return val1 > val2; }
1119
- };
1120
- const data = this.form?.controls[field]?.value;
1121
- return validators[operator](data, value);
1122
- }
1123
- buildComponent() {
1124
- if (this.componentRef?.instance)
1125
- return;
1126
- const factory = this.resolver.resolveComponentFactory(componentMapper[this.field?.fieldType]);
1127
- this.componentRef = this.container.createComponent(factory);
1128
- this.componentRef.instance._field = this.field;
1129
- this.componentRef.instance._form = this.form;
1130
- // eslint-disable-next-line object-curly-newline
1131
- this.componentRef.instance._formErrors = this.formErrors || {};
1132
- this.componentRef.instance.self = this.self;
1133
- }
1134
- ngOnInit() {
1135
- if (!this.field?.alwaysShow && !this.handleInternalPlusValidation())
1136
- return;
1137
- this.buildComponent();
1138
- }
1139
- ngOnChanges() {
1140
- if (this.plusValidations && this.plusValidations[this.field?.name]) {
1141
- if (!this.field?.alwaysShow && this.plusValidations[this.field?.name].alwaysShow) {
1142
- setTimeout(() => {
1143
- this.buildComponent();
1144
- this.cdr.detectChanges();
1145
- }, 1);
1146
- }
1147
- if (this.componentRef?.instance &&
1148
- !this.plusValidations[this.field?.name].alwaysShow) {
1149
- this.componentRef.destroy();
1150
- this.componentRef = null;
1151
- this.form?.controls[this.field?.name]?.setValue(null);
1152
- this.form?.controls[this.field?.name]?.clearValidators();
1153
- }
1154
- }
1155
- if (!this.componentRef?.instance)
1156
- return;
1157
- this.componentRef.instance._formErrors = this.formErrors || {};
1158
- }
1159
- }
1160
- MECXDynamicDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXDynamicDirective, deps: [{ token: i0.ComponentFactoryResolver }, { token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
1161
- MECXDynamicDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.1", type: MECXDynamicDirective, selector: "[MECXDynamic]", inputs: { field: "field", form: "form", formErrors: "formErrors", self: "self", plusValidations: "plusValidations" }, usesOnChanges: true, ngImport: i0 });
1162
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXDynamicDirective, decorators: [{
1163
- type: Directive,
1164
- args: [{
1165
- selector: '[MECXDynamic]'
1166
- }]
1167
- }], ctorParameters: function () { return [{ type: i0.ComponentFactoryResolver }, { type: i0.ViewContainerRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { field: [{
1168
- type: Input
1169
- }], form: [{
1170
- type: Input
1171
- }], formErrors: [{
1172
- type: Input
1173
- }], self: [{
1174
- type: Input
1175
- }], plusValidations: [{
1176
- type: Input
1177
- }] } });
1178
-
1179
- class MECXDynamicFormComponent extends BaseDynamic {
1180
- constructor(fb, cdr) {
1181
- super(fb);
1182
- this.cdr = cdr;
1183
- this.unsubscribeAll = new Subject();
1184
- }
1185
- ngOnInit() {
1186
- super.ngOnInit();
1187
- this.onHandleSubmit.pipe(takeUntil(this.unsubscribeAll)).subscribe((func) => {
1188
- this.onSubmit(func);
1189
- });
1190
- }
1191
- ngOnDestroy() {
1192
- this.unsubscribeAll.next();
1193
- this.unsubscribeAll.complete();
1194
- }
1195
- onSubmit(callback) {
1196
- const { _form } = this;
1197
- // eslint-disable-next-line object-curly-newline
1198
- this.__monkeyecxFormErrors = {};
1199
- const isValid = this.validateForm(_form);
1200
- this.cdr.detectChanges();
1201
- this.onHandleSubmitFormReady.next({
1202
- validate: {
1203
- isValid
1204
- },
1205
- callback,
1206
- form: _form
1207
- });
1208
- }
1209
- }
1210
- MECXDynamicFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXDynamicFormComponent, deps: [{ token: i1.FormBuilder }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1211
- MECXDynamicFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: MECXDynamicFormComponent, selector: "mecx-dynamic-form", usesInheritance: true, ngImport: i0, template: "<form name=\"form\" [formGroup]=\"_form\" *ngIf=\"_form\">\n <div class=\"row\">\n <div *ngFor=\"let field of fields;\" MECXDynamic [field]=\"field\" [form]=\"_form\" [self]=\"self\"\n [formErrors]=\"__monkeyecxFormErrors\" [style.display]=\"'none'\">\n </div>\n </div>\n</form>", directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: MECXDynamicDirective, selector: "[MECXDynamic]", inputs: ["field", "form", "formErrors", "self", "plusValidations"] }], encapsulation: i0.ViewEncapsulation.None });
1212
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXDynamicFormComponent, decorators: [{
1213
- type: Component,
1214
- args: [{ selector: 'mecx-dynamic-form', styles: [], encapsulation: ViewEncapsulation.None, template: "<form name=\"form\" [formGroup]=\"_form\" *ngIf=\"_form\">\n <div class=\"row\">\n <div *ngFor=\"let field of fields;\" MECXDynamic [field]=\"field\" [form]=\"_form\" [self]=\"self\"\n [formErrors]=\"__monkeyecxFormErrors\" [style.display]=\"'none'\">\n </div>\n </div>\n</form>" }]
1215
- }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: i0.ChangeDetectorRef }]; } });
1216
-
1217
- class MECXDynamicFormArrayComponent extends BaseDynamicArray {
1218
- constructor(fb, cdr) {
1219
- super(fb);
1220
- this.cdr = cdr;
1221
- this.unsubscribeAll = new Subject();
1222
- this.__monkeyecxFormErrors = [];
1223
- }
1224
- ngOnInit() {
1225
- super.ngOnInit();
1226
- this.onHandleSubmit.pipe(takeUntil(this.unsubscribeAll)).subscribe((func) => {
1227
- this.onSubmit(func);
1228
- });
1229
- }
1230
- ngOnDestroy() {
1231
- this.unsubscribeAll.next();
1232
- this.unsubscribeAll.complete();
1233
- }
1234
- onSubmit(callback) {
1235
- const { _form } = this;
1236
- // eslint-disable-next-line object-curly-newline
1237
- this.__monkeyecxFormErrors = [];
1238
- let validate = {
1239
- isValid: false
1240
- };
1241
- let hasErrors = false;
1242
- if (this.formValues) {
1243
- this.__monkeyecxFormErrors = [this.formValues.length];
1244
- this.formValues.controls.forEach((item, index) => {
1245
- if (item instanceof FormGroup) {
1246
- if (!this.validateForm(item, index)) {
1247
- hasErrors = true;
1248
- }
1249
- }
1250
- });
1251
- }
1252
- validate = {
1253
- isValid: !hasErrors
1254
- };
1255
- this.cdr.detectChanges();
1256
- this.onHandleSubmitFormReady.next({
1257
- validate,
1258
- callback,
1259
- form: _form
1260
- });
1261
- }
1262
- onHandleAdd() {
1263
- this.formValues?.push(this.formBase());
1264
- this.cdr.detectChanges();
1265
- }
1266
- onHandleRemove(index) {
1267
- this.formValues?.removeAt(index);
1268
- this._plusValidations.splice(index, 1);
1269
- }
1270
- }
1271
- MECXDynamicFormArrayComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXDynamicFormArrayComponent, deps: [{ token: i1.FormBuilder }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1272
- MECXDynamicFormArrayComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: MECXDynamicFormArrayComponent, selector: "mecx-dynamic-form-array", usesInheritance: true, ngImport: i0, template: "<form name=\"form\" [formGroup]=\"_form\" *ngIf=\"_form\">\n <div formArrayName=\"fields\">\n <div *ngFor=\"let item of formValues.controls; let indForm=index\" [formGroupName]=\"indForm\">\n <monkey-button type=\"secondary\" color=\"error\" icon=\"close-20\" iconPosition=\"right\"\n [label]=\"'BUTTONS.REMOVE' | translate\" (click)=\"onHandleRemove(indForm)\"\n *ngIf=\"formValues.controls.length > 1 && !disabled\">\n </monkey-button>\n <div class=\"row mt-3\">\n <div *ngFor=\"let field of fields;\" MECXDynamic [field]=\"field\" [form]=\"item\" [self]=\"self\"\n [formErrors]=\"__monkeyecxFormErrors[indForm]\"\n [plusValidations]=\"_plusValidations[indForm]\" [style.display]=\"'none'\">\n </div>\n </div>\n </div>\n </div>\n</form>\n<monkey-button type=\"secondary\" color=\"theme\" icon=\"more-20\" iconPosition=\"right\"\n [label]=\"'BUTTONS.ADD' | translate\" (click)=\"onHandleAdd()\" *ngIf=\"!disabled\">\n</monkey-button>", styles: ["mecx-dynamic-form-array monkey-button{width:100%}mecx-dynamic-form-array monkey-button button{width:100%;height:40px}\n"], components: [{ type: i1$2.MonkeyButtonComponent, selector: "monkey-button", inputs: ["label", "icon", "iconPosition", "type", "color", "disabled", "size"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { type: MECXDynamicDirective, selector: "[MECXDynamic]", inputs: ["field", "form", "formErrors", "self", "plusValidations"] }], pipes: { "translate": i1$3.TranslatePipe }, encapsulation: i0.ViewEncapsulation.None });
1273
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXDynamicFormArrayComponent, decorators: [{
1274
- type: Component,
1275
- args: [{ selector: 'mecx-dynamic-form-array', encapsulation: ViewEncapsulation.None, template: "<form name=\"form\" [formGroup]=\"_form\" *ngIf=\"_form\">\n <div formArrayName=\"fields\">\n <div *ngFor=\"let item of formValues.controls; let indForm=index\" [formGroupName]=\"indForm\">\n <monkey-button type=\"secondary\" color=\"error\" icon=\"close-20\" iconPosition=\"right\"\n [label]=\"'BUTTONS.REMOVE' | translate\" (click)=\"onHandleRemove(indForm)\"\n *ngIf=\"formValues.controls.length > 1 && !disabled\">\n </monkey-button>\n <div class=\"row mt-3\">\n <div *ngFor=\"let field of fields;\" MECXDynamic [field]=\"field\" [form]=\"item\" [self]=\"self\"\n [formErrors]=\"__monkeyecxFormErrors[indForm]\"\n [plusValidations]=\"_plusValidations[indForm]\" [style.display]=\"'none'\">\n </div>\n </div>\n </div>\n </div>\n</form>\n<monkey-button type=\"secondary\" color=\"theme\" icon=\"more-20\" iconPosition=\"right\"\n [label]=\"'BUTTONS.ADD' | translate\" (click)=\"onHandleAdd()\" *ngIf=\"!disabled\">\n</monkey-button>", styles: ["mecx-dynamic-form-array monkey-button{width:100%}mecx-dynamic-form-array monkey-button button{width:100%;height:40px}\n"] }]
1276
- }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: i0.ChangeDetectorRef }]; } });
1277
-
1278
- class MECXDynamicModule {
1279
- }
1280
- MECXDynamicModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXDynamicModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1281
- MECXDynamicModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXDynamicModule, declarations: [MECXDynamicButtonComponent,
1282
- MECXDynamicFileUploadComponent,
1283
- MECXDynamicFormComponent,
1284
- MECXDynamicFormArrayComponent,
1285
- MECXDynamicInputComponent,
1286
- MECXDynamicInputPhoneComponent,
1287
- MECXDynamicRadioComponent,
1288
- MECXDynamicSelectComponent,
1289
- MECXDynamicSelectSearchComponent,
1290
- MECXDynamicDirective], imports: [CommonModule,
1291
- FormsModule,
1292
- ReactiveFormsModule,
1293
- MonkeyInputModule,
1294
- MonkeySelectModule,
1295
- MonkeyRadioButtonModule,
1296
- MonkeyOptionModule,
1297
- MonkeyFileUploadModule,
1298
- MonkeyButtonModule,
1299
- MonkeyInputPhoneModule, i1$3.TranslateModule], exports: [MECXDynamicDirective, MECXDynamicFormComponent, MECXDynamicFormArrayComponent] });
1300
- MECXDynamicModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXDynamicModule, imports: [[
1301
- CommonModule,
1302
- FormsModule,
1303
- ReactiveFormsModule,
1304
- MonkeyInputModule,
1305
- MonkeySelectModule,
1306
- MonkeyRadioButtonModule,
1307
- MonkeyOptionModule,
1308
- MonkeyFileUploadModule,
1309
- MonkeyButtonModule,
1310
- MonkeyInputPhoneModule,
1311
- TranslateModule.forChild()
1312
- ]] });
1313
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXDynamicModule, decorators: [{
1314
- type: NgModule,
1315
- args: [{
1316
- declarations: [
1317
- MECXDynamicButtonComponent,
1318
- MECXDynamicFileUploadComponent,
1319
- MECXDynamicFormComponent,
1320
- MECXDynamicFormArrayComponent,
1321
- MECXDynamicInputComponent,
1322
- MECXDynamicInputPhoneComponent,
1323
- MECXDynamicRadioComponent,
1324
- MECXDynamicSelectComponent,
1325
- MECXDynamicSelectSearchComponent,
1326
- MECXDynamicDirective
1327
- ],
1328
- imports: [
1329
- CommonModule,
1330
- FormsModule,
1331
- ReactiveFormsModule,
1332
- MonkeyInputModule,
1333
- MonkeySelectModule,
1334
- MonkeyRadioButtonModule,
1335
- MonkeyOptionModule,
1336
- MonkeyFileUploadModule,
1337
- MonkeyButtonModule,
1338
- MonkeyInputPhoneModule,
1339
- TranslateModule.forChild()
1340
- ],
1341
- exports: [MECXDynamicDirective, MECXDynamicFormComponent, MECXDynamicFormArrayComponent],
1342
- entryComponents: [MECXDynamicInputComponent]
1343
- }]
1344
- }] });
1345
-
1346
- class MECXFilterSelectedItemDateWithActionComponent {
1347
- constructor() {
1348
- this.option = null;
1349
- this._date = '';
1350
- }
1351
- onHandleSelectedValue({ field, getValue }) {
1352
- const value = getValue()?.[field];
1353
- if (MonkeyEcxUtils.persistNullEmptyUndefined(value)) {
1354
- this._date = value;
1355
- }
1356
- }
1357
- ngOnChanges(changes) {
1358
- if (changes.option) {
1359
- const { currentValue } = changes.option;
1360
- if (currentValue && JSON.stringify(currentValue) !== '{}') {
1361
- this.onHandleSelectedValue(currentValue);
1362
- }
1363
- }
1364
- }
1365
- }
1366
- MECXFilterSelectedItemDateWithActionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterSelectedItemDateWithActionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1367
- MECXFilterSelectedItemDateWithActionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: MECXFilterSelectedItemDateWithActionComponent, selector: "mecx-filter-selected-item-date-with-action", inputs: { option: "option" }, usesOnChanges: true, ngImport: i0, template: "{{ _date | monkeyecxFormatDateTimelapse: false }}", styles: [""], pipes: { "monkeyecxFormatDateTimelapse": i1$4.MonkeyEcxFormatDateTimelapsePipe } });
1368
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterSelectedItemDateWithActionComponent, decorators: [{
1369
- type: Component,
1370
- args: [{ selector: 'mecx-filter-selected-item-date-with-action', template: "{{ _date | monkeyecxFormatDateTimelapse: false }}", styles: [""] }]
1371
- }], propDecorators: { option: [{
1372
- type: Input
1373
- }] } });
1374
-
1375
- class MECXFilterSelectedItemDateRangeComponent {
1376
- constructor() {
1377
- this.option = null;
1378
- this._startDate = '';
1379
- this._endDate = '';
1380
- }
1381
- onHandleSelectedValue({ field, value, getValue }) {
1382
- try {
1383
- value = value || getValue()?.[field];
1384
- if (value && JSON.stringify(value) !== '{}') {
1385
- const objDates = JSON.parse(value);
1386
- this._startDate = objDates?.startDate;
1387
- this._endDate = objDates?.endDate;
1388
- }
1389
- }
1390
- catch (e) {
1391
- const objDates = JSON.parse(value?.dates);
1392
- this._startDate = objDates?.startDate;
1393
- this._endDate = objDates?.endDate;
1394
- }
1395
- }
1396
- ngOnChanges(changes) {
1397
- if (changes.option) {
1398
- const { currentValue } = changes.option;
1399
- if (currentValue && JSON.stringify(currentValue) !== '{}') {
1400
- this.onHandleSelectedValue(currentValue);
1401
- }
1402
- }
1403
- }
1404
- }
1405
- MECXFilterSelectedItemDateRangeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterSelectedItemDateRangeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1406
- MECXFilterSelectedItemDateRangeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: MECXFilterSelectedItemDateRangeComponent, selector: "mecx-filter-selected-item-date-range", inputs: { option: "option" }, usesOnChanges: true, ngImport: i0, template: "{{ _startDate | monkeyecxFormatDateTimelapse: false }} -\n{{ _endDate | monkeyecxFormatDateTimelapse: false }}", styles: [""], pipes: { "monkeyecxFormatDateTimelapse": i1$4.MonkeyEcxFormatDateTimelapsePipe } });
1407
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterSelectedItemDateRangeComponent, decorators: [{
1408
- type: Component,
1409
- args: [{ selector: 'mecx-filter-selected-item-date-range', template: "{{ _startDate | monkeyecxFormatDateTimelapse: false }} -\n{{ _endDate | monkeyecxFormatDateTimelapse: false }}", styles: [""] }]
1410
- }], propDecorators: { option: [{
1411
- type: Input
1412
- }] } });
1413
-
1414
- class MECXFilterSelectedItemChildrenComponent {
1415
- constructor(elRef) {
1416
- this.elRef = elRef;
1417
- this.option = null;
1418
- this.onShow = new EventEmitter();
1419
- this.onRemove = new EventEmitter();
1420
- this._child = null;
1421
- // not to do
1422
- }
1423
- validateValue(value) {
1424
- if (!value)
1425
- return false;
1426
- if (typeof value === 'object') {
1427
- return value && JSON.stringify(value) !== '{}';
1428
- }
1429
- return MonkeyEcxUtils.persistNullEmptyUndefined(value);
1430
- }
1431
- onHandleSelectedValue({ children }) {
1432
- const found = children.find(({ field, getValue }) => {
1433
- return this.validateValue(getValue()?.[field]);
1434
- });
1435
- if (!found) {
1436
- this.elRef.nativeElement.remove();
1437
- return;
1438
- }
1439
- this._child = found;
1440
- }
1441
- ngOnChanges(changes) {
1442
- if (changes.option) {
1443
- const { currentValue } = changes.option;
1444
- if (currentValue && JSON.stringify(currentValue) !== '{}') {
1445
- this.onHandleSelectedValue(currentValue);
1446
- }
1447
- }
1448
- }
1449
- }
1450
- MECXFilterSelectedItemChildrenComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterSelectedItemChildrenComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1451
- MECXFilterSelectedItemChildrenComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: MECXFilterSelectedItemChildrenComponent, selector: "mecx-filter-selected-item-children", inputs: { option: "option" }, outputs: { onShow: "onShow", onRemove: "onRemove" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"box\">\n <div class=\"data\">\n {{ option.label | translate }}\n </div>\n <div class=\"value\" [id]=\"'mecx-filter-selected-item-'+option?.field\" (click)=\"onShow.next()\">\n <ng-container *ngIf=\"option?.type as type\">\n <ng-container [ngSwitch]=\"type+'-'+_child?.type\">\n <mecx-filter-selected-item-date-with-action *ngSwitchCase=\"'date-with-action'\"\n [option]=\"_child\">\n </mecx-filter-selected-item-date-with-action>\n <mecx-filter-selected-item-date-range *ngSwitchCase=\"'date-date-range'\" [option]=\"_child\">\n </mecx-filter-selected-item-date-range>\n </ng-container>\n </ng-container>\n </div>\n <div class=\"action\" (click)=\"onShow.next()\">\n <monkey-icon icon=\"arrow-right-14\" color=\"#4B4A53\"></monkey-icon>\n </div>\n</div>", styles: [":host{display:flex}:host .box{display:flex;justify-content:space-between;align-items:center;background:#ffffff;border:1px solid #d6d6d6;box-sizing:border-box;border-radius:120px;height:40px}:host .box .data{display:flex;align-items:center;padding-left:12px;height:100%;font-style:normal;font-weight:400;font-size:14px;line-height:24px;text-align:center;color:#72717e}:host .box .value{cursor:pointer;display:flex;align-items:center;padding:12px;height:100%;font-style:normal;font-weight:400;font-size:14px;line-height:24px;text-align:center;color:#72717e;background-color:#6d6d6d0a}:host .box .value:hover{background-color:#6d6d6d0c;font-weight:400;text-decoration:underline}:host .box .action{cursor:pointer;border-left:1px solid #d6d6d6;padding:12px;color:#908e9d;font-weight:500;font-size:18px;height:40px;align-items:center;display:flex}:host .box .action:hover{background-color:#6d6d6d0c;border-top-right-radius:120px;border-bottom-right-radius:120px}\n"], components: [{ type: MECXFilterSelectedItemDateWithActionComponent, selector: "mecx-filter-selected-item-date-with-action", inputs: ["option"] }, { type: MECXFilterSelectedItemDateRangeComponent, selector: "mecx-filter-selected-item-date-range", inputs: ["option"] }, { type: i1$2.MonkeyIconComponent, selector: "monkey-icon", inputs: ["icon", "color", "contrast", "disabled"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i3.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }], pipes: { "translate": i1$3.TranslatePipe } });
1452
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterSelectedItemChildrenComponent, decorators: [{
1453
- type: Component,
1454
- args: [{ selector: 'mecx-filter-selected-item-children', template: "<div class=\"box\">\n <div class=\"data\">\n {{ option.label | translate }}\n </div>\n <div class=\"value\" [id]=\"'mecx-filter-selected-item-'+option?.field\" (click)=\"onShow.next()\">\n <ng-container *ngIf=\"option?.type as type\">\n <ng-container [ngSwitch]=\"type+'-'+_child?.type\">\n <mecx-filter-selected-item-date-with-action *ngSwitchCase=\"'date-with-action'\"\n [option]=\"_child\">\n </mecx-filter-selected-item-date-with-action>\n <mecx-filter-selected-item-date-range *ngSwitchCase=\"'date-date-range'\" [option]=\"_child\">\n </mecx-filter-selected-item-date-range>\n </ng-container>\n </ng-container>\n </div>\n <div class=\"action\" (click)=\"onShow.next()\">\n <monkey-icon icon=\"arrow-right-14\" color=\"#4B4A53\"></monkey-icon>\n </div>\n</div>", styles: [":host{display:flex}:host .box{display:flex;justify-content:space-between;align-items:center;background:#ffffff;border:1px solid #d6d6d6;box-sizing:border-box;border-radius:120px;height:40px}:host .box .data{display:flex;align-items:center;padding-left:12px;height:100%;font-style:normal;font-weight:400;font-size:14px;line-height:24px;text-align:center;color:#72717e}:host .box .value{cursor:pointer;display:flex;align-items:center;padding:12px;height:100%;font-style:normal;font-weight:400;font-size:14px;line-height:24px;text-align:center;color:#72717e;background-color:#6d6d6d0a}:host .box .value:hover{background-color:#6d6d6d0c;font-weight:400;text-decoration:underline}:host .box .action{cursor:pointer;border-left:1px solid #d6d6d6;padding:12px;color:#908e9d;font-weight:500;font-size:18px;height:40px;align-items:center;display:flex}:host .box .action:hover{background-color:#6d6d6d0c;border-top-right-radius:120px;border-bottom-right-radius:120px}\n"] }]
1455
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { option: [{
1456
- type: Input
1457
- }], onShow: [{
1458
- type: Output
1459
- }], onRemove: [{
1460
- type: Output
1461
- }] } });
1462
-
1463
- class MECXFilterSelectedItemCurrencyComponent {
1464
- constructor() {
1465
- this.option = null;
1466
- this._value = null;
1467
- }
1468
- onHandleSelectedValue({ value }) {
1469
- this._value = value;
1470
- }
1471
- ngOnChanges(changes) {
1472
- if (changes.option) {
1473
- const { currentValue } = changes.option;
1474
- if (currentValue && JSON.stringify(currentValue) !== '{}') {
1475
- this.onHandleSelectedValue(currentValue);
1476
- }
1477
- }
1478
- }
1479
- }
1480
- MECXFilterSelectedItemCurrencyComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterSelectedItemCurrencyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1481
- MECXFilterSelectedItemCurrencyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: MECXFilterSelectedItemCurrencyComponent, selector: "mecx-filter-selected-item-currency", inputs: { option: "option" }, usesOnChanges: true, ngImport: i0, template: "{{ _value | monkeyecxFormatCurrency }}", styles: [""], pipes: { "monkeyecxFormatCurrency": i1$4.MonkeyEcxFormatCurrencyPipe } });
1482
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterSelectedItemCurrencyComponent, decorators: [{
1483
- type: Component,
1484
- args: [{ selector: 'mecx-filter-selected-item-currency', template: "{{ _value | monkeyecxFormatCurrency }}", styles: [""] }]
1485
- }], propDecorators: { option: [{
1486
- type: Input
1487
- }] } });
1488
-
1489
- class MECXFilterSelectedItemInputComponent {
1490
- constructor() {
1491
- this.option = null;
1492
- this._value = null;
1493
- }
1494
- onHandleSelectedValue({ value }) {
1495
- this._value = value;
1496
- }
1497
- ngOnChanges(changes) {
1498
- if (changes.option) {
1499
- const { currentValue } = changes.option;
1500
- if (currentValue && JSON.stringify(currentValue) !== '{}') {
1501
- this.onHandleSelectedValue(currentValue);
1502
- }
1503
- }
1504
- }
1505
- }
1506
- MECXFilterSelectedItemInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterSelectedItemInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1507
- MECXFilterSelectedItemInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: MECXFilterSelectedItemInputComponent, selector: "mecx-filter-selected-item-input", inputs: { option: "option" }, usesOnChanges: true, ngImport: i0, template: "{{ _value }}", styles: [""] });
1508
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterSelectedItemInputComponent, decorators: [{
1509
- type: Component,
1510
- args: [{ selector: 'mecx-filter-selected-item-input', template: "{{ _value }}", styles: [""] }]
1511
- }], propDecorators: { option: [{
1512
- type: Input
1513
- }] } });
1514
-
1515
- class MECXFilterSelectedItemStatusComponent {
1516
- constructor() {
1517
- this.option = null;
1518
- this._selectedValue = '';
1519
- this._labelMoreValues = '';
1520
- }
1521
- onHandleSelectedValue({ value, i18n }) {
1522
- const { labelMoreValues } = this;
1523
- const selected = `${value}`.split(',');
1524
- this._selectedValue = `${i18n}${selected[0]}`.trim();
1525
- if (selected.length >= 2) {
1526
- this._labelMoreValues = `, ${labelMoreValues} ${selected.length - 1}`;
1527
- }
1528
- else
1529
- this._labelMoreValues = '';
1530
- }
1531
- ngOnChanges(changes) {
1532
- if (changes.option) {
1533
- const { currentValue } = changes.option;
1534
- if (currentValue && JSON.stringify(currentValue) !== '{}') {
1535
- this.onHandleSelectedValue(currentValue);
1536
- }
1537
- }
1538
- }
1539
- }
1540
- MECXFilterSelectedItemStatusComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterSelectedItemStatusComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1541
- MECXFilterSelectedItemStatusComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: MECXFilterSelectedItemStatusComponent, selector: "mecx-filter-selected-item-status", inputs: { option: "option", labelMoreValues: "labelMoreValues" }, usesOnChanges: true, ngImport: i0, template: "{{ _selectedValue | translate }}{{ _labelMoreValues }}", styles: [""], pipes: { "translate": i1$3.TranslatePipe } });
1542
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterSelectedItemStatusComponent, decorators: [{
1543
- type: Component,
1544
- args: [{ selector: 'mecx-filter-selected-item-status', template: "{{ _selectedValue | translate }}{{ _labelMoreValues }}", styles: [""] }]
1545
- }], propDecorators: { option: [{
1546
- type: Input
1547
- }], labelMoreValues: [{
1548
- type: Input
1549
- }] } });
1550
-
1551
- class MECXFilterOptionsChildrenComponent {
1552
- constructor() {
1553
- this.option = null;
1554
- this.onSubmit = new EventEmitter();
1555
- this.onShow = new EventEmitter();
1556
- this.eventHandle = new EventEmitter();
1557
- // not to do
1558
- }
1559
- ngOnInit() {
1560
- const { eventHandle, onSubmit, option: { field } } = this;
1561
- this.eventSubscription = eventHandle.pipe(debounceTime(100)).subscribe((value) => {
1562
- onSubmit.next({ [field]: value });
1563
- });
1564
- }
1565
- ngOnDestroy() {
1566
- this.eventSubscription.unsubscribe();
1567
- }
1568
- onHandleChildrenAction(child) {
1569
- const { field, type, action } = child;
1570
- if (type === 'with-action') {
1571
- this.eventHandle.next(JSON.stringify({
1572
- [field]: action()
1573
- }));
1574
- }
1575
- else {
1576
- this.onShow.next(child);
1577
- }
1578
- }
1579
- onHandleValidateSelected({ field, getValue }) {
1580
- return !!getValue()?.[field];
1581
- }
1582
- }
1583
- MECXFilterOptionsChildrenComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterOptionsChildrenComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1584
- MECXFilterOptionsChildrenComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: MECXFilterOptionsChildrenComponent, selector: "mecx-filter-options-children", inputs: { option: "option" }, outputs: { onSubmit: "onSubmit", onShow: "onShow" }, ngImport: i0, template: "<ng-container *ngFor=\"let child of option?.children\">\n <div class=\"item\" (click)=\"onHandleChildrenAction(child)\"\n [class.selected]=\"onHandleValidateSelected(child)\">\n {{ child.label | translate }}\n </div>\n</ng-container>", styles: [":host{display:flex;flex-direction:column;min-width:180px}:host .item{cursor:pointer;font-style:normal;font-weight:400;font-size:16px;line-height:24px;color:#72717e;padding:8px 24px}:host .item.selected{cursor:not-allowed!important;background-color:var(--mecx-color-theme-400)!important;color:var(--mecx-color-theme-contrast-main)!important;font-weight:400}:host .item:hover{background-color:var(--mecx-color-theme-100)!important;color:#72717e!important;font-weight:400}\n"], directives: [{ type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "translate": i1$3.TranslatePipe } });
1585
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterOptionsChildrenComponent, decorators: [{
1586
- type: Component,
1587
- args: [{ selector: 'mecx-filter-options-children', template: "<ng-container *ngFor=\"let child of option?.children\">\n <div class=\"item\" (click)=\"onHandleChildrenAction(child)\"\n [class.selected]=\"onHandleValidateSelected(child)\">\n {{ child.label | translate }}\n </div>\n</ng-container>", styles: [":host{display:flex;flex-direction:column;min-width:180px}:host .item{cursor:pointer;font-style:normal;font-weight:400;font-size:16px;line-height:24px;color:#72717e;padding:8px 24px}:host .item.selected{cursor:not-allowed!important;background-color:var(--mecx-color-theme-400)!important;color:var(--mecx-color-theme-contrast-main)!important;font-weight:400}:host .item:hover{background-color:var(--mecx-color-theme-100)!important;color:#72717e!important;font-weight:400}\n"] }]
1588
- }], ctorParameters: function () { return []; }, propDecorators: { option: [{
1589
- type: Input
1590
- }], onSubmit: [{
1591
- type: Output
1592
- }], onShow: [{
1593
- type: Output
1594
- }] } });
1595
-
1596
- class MECXFilterOptionsStatusComponent {
1597
- constructor() {
1598
- this.option = null;
1599
- this.onSubmit = new EventEmitter();
1600
- this._value = '';
1601
- this.eventHandle = new EventEmitter();
1602
- // not to do
1603
- }
1604
- verifySelected(value) {
1605
- return this._value?.includes(value);
1606
- }
1607
- ngOnInit() {
1608
- const { eventHandle, onSubmit, option: { field } } = this;
1609
- this.eventSubscription = eventHandle
1610
- .pipe(debounceTime(800))
1611
- .subscribe((value) => {
1612
- onSubmit.next({ [field]: value });
1613
- });
1614
- }
1615
- ngOnDestroy() {
1616
- this.eventSubscription.unsubscribe();
1617
- }
1618
- ngOnChanges(changes) {
1619
- if (changes.option) {
1620
- const { currentValue } = changes.option;
1621
- if (currentValue && JSON.stringify(currentValue) !== '{}') {
1622
- this._value = currentValue?.value;
1623
- }
1624
- }
1625
- }
1626
- onHandleChecked(cmp) {
1627
- const { _value } = this;
1628
- return `${_value}`.split(',')?.indexOf(cmp) >= 0;
1629
- }
1630
- onChangeFilter(event, value) {
1631
- event.preventDefault();
1632
- event.stopPropagation();
1633
- const selected = !this.verifySelected(value);
1634
- const filters = this._value?.split(',') || [];
1635
- if (!selected) {
1636
- filters.splice(filters.indexOf(value), 1);
1637
- }
1638
- else {
1639
- filters.push(value);
1640
- }
1641
- this._value = filters?.length ? filters.join(',') : null;
1642
- this.eventHandle.next(this._value);
1643
- }
1644
- }
1645
- MECXFilterOptionsStatusComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterOptionsStatusComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1646
- MECXFilterOptionsStatusComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: MECXFilterOptionsStatusComponent, selector: "mecx-filter-options-status", inputs: { option: "option" }, outputs: { onSubmit: "onSubmit" }, usesOnChanges: true, ngImport: i0, template: "<monkey-checkbox type=\"multiple\" *ngFor=\"let op of option?.values\"\n [description]=\"op?.description | translate\" [value]=\"onHandleChecked(op?.value)\"\n (click)=\"onChangeFilter($event, op?.value)\">\n</monkey-checkbox>", styles: [":host{display:flex;flex-direction:column;max-width:232px;min-width:180px;max-height:500px;padding:12px 12px 8px;color:#72717e;overflow:auto}:host ::ng-deep mecx-form-field mecx-form-field-body.checkbox{padding:0!important}:host ::ng-deep mecx-form-field mecx-form-field-body.checkbox .mecx-check-container{height:unset!important}:host ::ng-deep mecx-form-field mecx-form-field-body.checkbox .mecx-check-container .mecx-check-mark{top:50%;transform:translateY(-50%)}:host ::ng-deep monkey-checkbox{margin:6px 0!important}\n"], components: [{ type: i1$2.MonkeyCheckboxComponent, selector: "monkey-checkbox", inputs: ["label", "type", "helperMessage", "infoMessage", "errorMessage", "description", "value"], outputs: ["onChange"] }], directives: [{ type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "translate": i1$3.TranslatePipe } });
1647
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterOptionsStatusComponent, decorators: [{
1648
- type: Component,
1649
- args: [{ selector: 'mecx-filter-options-status', template: "<monkey-checkbox type=\"multiple\" *ngFor=\"let op of option?.values\"\n [description]=\"op?.description | translate\" [value]=\"onHandleChecked(op?.value)\"\n (click)=\"onChangeFilter($event, op?.value)\">\n</monkey-checkbox>", styles: [":host{display:flex;flex-direction:column;max-width:232px;min-width:180px;max-height:500px;padding:12px 12px 8px;color:#72717e;overflow:auto}:host ::ng-deep mecx-form-field mecx-form-field-body.checkbox{padding:0!important}:host ::ng-deep mecx-form-field mecx-form-field-body.checkbox .mecx-check-container{height:unset!important}:host ::ng-deep mecx-form-field mecx-form-field-body.checkbox .mecx-check-container .mecx-check-mark{top:50%;transform:translateY(-50%)}:host ::ng-deep monkey-checkbox{margin:6px 0!important}\n"] }]
1650
- }], ctorParameters: function () { return []; }, propDecorators: { option: [{
1651
- type: Input
1652
- }], onSubmit: [{
1653
- type: Output
1654
- }] } });
1655
-
1656
- class MECXFilterOptionsDateRangeComponent {
1657
- constructor() {
1658
- this.option = null;
1659
- this.onSubmit = new EventEmitter();
1660
- this._value = {
1661
- startDate: null,
1662
- endDate: null
1663
- };
1664
- this._moveDaysForward = true;
1665
- this.eventHandle = new EventEmitter();
1666
- // not to do
1667
- }
1668
- onHandleSelectedValue({ field, value, getValue }) {
1669
- try {
1670
- value = value || getValue()?.[field];
1671
- if (MonkeyEcxUtils.persistNullEmptyUndefined(value)) {
1672
- this._value = JSON.parse(value);
1673
- }
1674
- }
1675
- catch (e) {
1676
- // not to do
1677
- }
1678
- }
1679
- ngOnInit() {
1680
- const { eventHandle, onSubmit, option: { field } } = this;
1681
- this.eventSubscription = eventHandle
1682
- .pipe(debounceTime(800))
1683
- .subscribe((value) => {
1684
- onSubmit.next({ [field]: value });
1685
- });
1686
- }
1687
- ngOnDestroy() {
1688
- this.eventSubscription.unsubscribe();
1689
- }
1690
- ngOnChanges(changes) {
1691
- if (changes.option) {
1692
- const { currentValue } = changes.option;
1693
- if (currentValue && JSON.stringify(currentValue) !== '{}') {
1694
- this.onHandleSelectedValue(currentValue);
1695
- }
1696
- }
1697
- }
1698
- onChangeFilter(value) {
1699
- if (!value?.endDate)
1700
- return;
1701
- this.eventHandle.next(JSON.stringify(value));
1702
- }
1703
- }
1704
- MECXFilterOptionsDateRangeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterOptionsDateRangeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1705
- MECXFilterOptionsDateRangeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: MECXFilterOptionsDateRangeComponent, selector: "mecx-filter-options-date-range", inputs: { option: "option" }, outputs: { onSubmit: "onSubmit" }, usesOnChanges: true, ngImport: i0, template: "<monkey-date-range-picker [(value)]=\"_value\" [i18n]=\"'CALENDAR' | translate\"\n [moveDaysForward]=\"_moveDaysForward\" (onChange)=\"onChangeFilter($event)\">\n</monkey-date-range-picker>", styles: [":host{display:flex;flex-direction:column;padding:12px 12px 8px}:host .title{color:#4b4a53;font-size:18px;line-height:21px;font-weight:500;text-align:left;margin-bottom:4px}:host ::ng-deep mecx-date-range-picker-group-action{display:none}:host ::ng-deep monkey-date-range-picker mecx-date-range-picker-group mecx-date-range-picker-group-info{display:none}:host ::ng-deep monkey-date-range-picker mecx-date-range-picker-group mecx-date-range-picker-group-header{display:none}\n"], components: [{ type: i1$2.MonkeyDateRangePickerComponent, selector: "monkey-date-range-picker", inputs: ["label", "helperMessage", "i18n", "infoMessage", "errorMessage", "moveDaysForward", "minDate", "value"], outputs: ["onChange"] }], pipes: { "translate": i1$3.TranslatePipe } });
1706
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterOptionsDateRangeComponent, decorators: [{
1707
- type: Component,
1708
- args: [{ selector: 'mecx-filter-options-date-range', template: "<monkey-date-range-picker [(value)]=\"_value\" [i18n]=\"'CALENDAR' | translate\"\n [moveDaysForward]=\"_moveDaysForward\" (onChange)=\"onChangeFilter($event)\">\n</monkey-date-range-picker>", styles: [":host{display:flex;flex-direction:column;padding:12px 12px 8px}:host .title{color:#4b4a53;font-size:18px;line-height:21px;font-weight:500;text-align:left;margin-bottom:4px}:host ::ng-deep mecx-date-range-picker-group-action{display:none}:host ::ng-deep monkey-date-range-picker mecx-date-range-picker-group mecx-date-range-picker-group-info{display:none}:host ::ng-deep monkey-date-range-picker mecx-date-range-picker-group mecx-date-range-picker-group-header{display:none}\n"] }]
1709
- }], ctorParameters: function () { return []; }, propDecorators: { option: [{
1710
- type: Input
1711
- }], onSubmit: [{
1712
- type: Output
1713
- }] } });
1714
-
1715
- class MECXFilterOptionsCurrencyComponent {
1716
- constructor() {
1717
- this.option = null;
1718
- this.onSubmit = new EventEmitter();
1719
- this._value = 0;
1720
- this.eventHandle = new EventEmitter();
1721
- // not to do
1722
- }
1723
- ngOnInit() {
1724
- const { eventHandle, onSubmit, option: { field } } = this;
1725
- this.eventSubscription = eventHandle
1726
- .pipe(debounceTime(800))
1727
- .subscribe((value) => {
1728
- onSubmit.next({ [field]: value });
1729
- });
1730
- }
1731
- ngOnDestroy() {
1732
- this.eventSubscription.unsubscribe();
1733
- }
1734
- ngOnChanges(changes) {
1735
- if (changes.option) {
1736
- const { currentValue } = changes.option;
1737
- if (currentValue && JSON.stringify(currentValue) !== '{}') {
1738
- this._value = currentValue?.value;
1739
- }
1740
- }
1741
- }
1742
- onChangeFilter(value) {
1743
- this.eventHandle.next(value);
1744
- }
1745
- }
1746
- MECXFilterOptionsCurrencyComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterOptionsCurrencyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1747
- MECXFilterOptionsCurrencyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: MECXFilterOptionsCurrencyComponent, selector: "mecx-filter-options-currency", inputs: { option: "option" }, outputs: { onSubmit: "onSubmit" }, usesOnChanges: true, ngImport: i0, template: "<monkey-input currency=\"true\" type=\"text\" maxLength=\"25\" [(value)]=\"_value\"\n (onChange)=\"onChangeFilter($event)\">\n</monkey-input>", styles: [":host{display:flex;flex-direction:column;max-width:232px;min-width:180px;padding:12px 12px 8px;color:#72717e}:host .title{color:#4b4a53;font-size:18px;line-height:21px;font-weight:500;text-align:left;margin-bottom:4px}\n"], components: [{ type: i1$2.MonkeyInputComponent, selector: "monkey-input", inputs: ["name", "label", "helperMessage", "placeholder", "icon", "type", "infoMessage", "errorMessage", "mask", "prefix", "maxLength", "onlyNumber", "onlyAlphaNumeric", "upperCase", "lowerCase", "capitalize", "currency", "percent", "maxDateToday", "value"], outputs: ["onChange"] }] });
1748
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterOptionsCurrencyComponent, decorators: [{
1749
- type: Component,
1750
- args: [{ selector: 'mecx-filter-options-currency', template: "<monkey-input currency=\"true\" type=\"text\" maxLength=\"25\" [(value)]=\"_value\"\n (onChange)=\"onChangeFilter($event)\">\n</monkey-input>", styles: [":host{display:flex;flex-direction:column;max-width:232px;min-width:180px;padding:12px 12px 8px;color:#72717e}:host .title{color:#4b4a53;font-size:18px;line-height:21px;font-weight:500;text-align:left;margin-bottom:4px}\n"] }]
1751
- }], ctorParameters: function () { return []; }, propDecorators: { option: [{
1752
- type: Input
1753
- }], onSubmit: [{
1754
- type: Output
1755
- }] } });
1756
-
1757
- class MECXFilterOptionsInputComponent {
1758
- constructor() {
1759
- this.option = null;
1760
- this.onSubmit = new EventEmitter();
1761
- this._value = '';
1762
- this.eventHandle = new EventEmitter();
1763
- // not to do
1764
- }
1765
- ngOnInit() {
1766
- const { eventHandle, onSubmit, option: { field } } = this;
1767
- this.eventSubscription = eventHandle
1768
- .pipe(debounceTime(800))
1769
- .subscribe((value) => {
1770
- onSubmit.next({ [field]: value });
1771
- });
1772
- }
1773
- ngOnDestroy() {
1774
- this.eventSubscription.unsubscribe();
1775
- }
1776
- ngOnChanges(changes) {
1777
- if (changes.option) {
1778
- const { currentValue } = changes.option;
1779
- if (currentValue && JSON.stringify(currentValue) !== '{}') {
1780
- this._value = currentValue?.value;
1781
- }
1782
- }
1783
- }
1784
- onChangeFilter(value) {
1785
- this.eventHandle.next(value);
1786
- }
1787
- }
1788
- MECXFilterOptionsInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterOptionsInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1789
- MECXFilterOptionsInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: MECXFilterOptionsInputComponent, selector: "mecx-filter-options-input", inputs: { option: "option" }, outputs: { onSubmit: "onSubmit" }, usesOnChanges: true, ngImport: i0, template: "<monkey-input type=\"text\" maxLength=\"255\" [(value)]=\"_value\"\n (onChange)=\"onChangeFilter($event)\">\n</monkey-input>", styles: [":host{display:flex;flex-direction:column;max-width:232px;min-width:180px;padding:12px 12px 8px;color:#72717e}:host .title{color:#4b4a53;font-size:18px;line-height:21px;font-weight:500;text-align:left;margin-bottom:4px}\n"], components: [{ type: i1$2.MonkeyInputComponent, selector: "monkey-input", inputs: ["name", "label", "helperMessage", "placeholder", "icon", "type", "infoMessage", "errorMessage", "mask", "prefix", "maxLength", "onlyNumber", "onlyAlphaNumeric", "upperCase", "lowerCase", "capitalize", "currency", "percent", "maxDateToday", "value"], outputs: ["onChange"] }] });
1790
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterOptionsInputComponent, decorators: [{
1791
- type: Component,
1792
- args: [{ selector: 'mecx-filter-options-input', template: "<monkey-input type=\"text\" maxLength=\"255\" [(value)]=\"_value\"\n (onChange)=\"onChangeFilter($event)\">\n</monkey-input>", styles: [":host{display:flex;flex-direction:column;max-width:232px;min-width:180px;padding:12px 12px 8px;color:#72717e}:host .title{color:#4b4a53;font-size:18px;line-height:21px;font-weight:500;text-align:left;margin-bottom:4px}\n"] }]
1793
- }], ctorParameters: function () { return []; }, propDecorators: { option: [{
1794
- type: Input
1795
- }], onSubmit: [{
1796
- type: Output
1797
- }] } });
1798
-
1799
- class MECXFilterOptionsComponent {
1800
- constructor() {
1801
- this.option = null;
1802
- this.closeDirectly = false;
1803
- this.onClose = new EventEmitter();
1804
- this.onRemove = new EventEmitter();
1805
- this.onSubmit = new EventEmitter();
1806
- this.onShowFromChildren = new EventEmitter();
1807
- this._showMenu = false;
1808
- this.closeMenu = () => {
1809
- this._showMenu = false;
1810
- };
1811
- // not to do
1812
- }
1813
- onHandleChildrenAction(child) {
1814
- const { option } = this;
1815
- const { field, action } = child;
1816
- this.onSubmit.next({
1817
- [option.field]: {
1818
- [field]: action()
1819
- }
1820
- });
1821
- }
1822
- onHandleSubmitChildren(event) {
1823
- this.onSubmit.next(event);
1824
- }
1825
- onHandleSubmit(event) {
1826
- this.onSubmit.next(event);
1827
- }
1828
- onHandleShowMenu() {
1829
- const { closeDirectly } = this;
1830
- if (closeDirectly) {
1831
- this.onClose.next();
1832
- return;
1833
- }
1834
- this._showMenu = true;
1835
- }
1836
- }
1837
- MECXFilterOptionsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterOptionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1838
- MECXFilterOptionsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: MECXFilterOptionsComponent, selector: "mecx-filter-options", inputs: { option: "option", closeDirectly: "closeDirectly" }, outputs: { onClose: "onClose", onRemove: "onRemove", onSubmit: "onSubmit", onShowFromChildren: "onShowFromChildren" }, ngImport: i0, template: "<div class=\"d-flex justify-content-between header\">\n <span class=\"title\">\n {{ option?.label | translate }}\n </span>\n <div class=\"close\" #actionElement (click)=\"onHandleShowMenu()\">\n <monkey-icon icon=\"close-12\" color=\"#474747\"></monkey-icon>\n </div>\n</div>\n<ng-container *ngIf=\"option?.type as type\">\n <ng-container *ngIf=\"option?.children; else withoutChildren\">\n <mecx-filter-options-children [option]=\"option\" (onSubmit)=\"onHandleSubmitChildren($event)\"\n (onShow)=\"onShowFromChildren.next($event)\">\n </mecx-filter-options-children>\n </ng-container>\n <ng-template #withoutChildren>\n <ng-container [ngSwitch]=\"type\">\n <mecx-filter-options-status *ngSwitchCase=\"'status'\" [option]=\"option\"\n (onSubmit)=\"onHandleSubmit($event)\">\n </mecx-filter-options-status>\n <mecx-filter-options-date-range *ngSwitchCase=\"'date-range'\" [option]=\"option\"\n (onSubmit)=\"onHandleSubmit($event)\">\n </mecx-filter-options-date-range>\n <mecx-filter-options-currency *ngSwitchCase=\"'currency'\" [option]=\"option\"\n (onSubmit)=\"onHandleSubmit($event)\">\n </mecx-filter-options-currency>\n <mecx-filter-options-input *ngSwitchCase=\"'input'\" [option]=\"option\"\n (onSubmit)=\"onHandleSubmit($event)\">\n </mecx-filter-options-input>\n </ng-container>\n </ng-template>\n</ng-container>\n\n<ng-container\n *monkeyecxPopover=\"_showMenu; target: $any(actionElement); closed: closeMenu; dir: 'ltr'\">\n <div class=\"close-menu\">\n <monkey-button type=\"tertiary\" color=\"error\" (click)=\"onRemove.next()\" size=\"sm\">\n {{ 'BUTTONS.REMOVE' | translate }}\n </monkey-button>\n <monkey-button type=\"tertiary\" color=\"theme\" (click)=\"onClose.next()\" size=\"sm\">\n {{ 'BUTTONS.CLOSE' | translate }}\n </monkey-button>\n </div>\n</ng-container>", styles: [":host{display:flex;flex-direction:column;background:#fafafa;border:1px solid #d6d6d6;box-sizing:border-box;box-shadow:0 4px 36px -8px #6d6d6d3a;border-radius:8px!important;margin:0 8px}:host .header{border-bottom:1px solid #d6d6d6;padding:8px}:host .header .title{color:#4b4a53;font-style:normal;font-size:14px;line-height:16px;font-weight:500;text-align:left}:host .header .close{cursor:pointer;border-radius:120px;padding:4px}:host .header .close:hover{background-color:#6d6d6d0c}.close-menu{display:flex;flex-direction:column;background:#fafafa;border:1px solid #d6d6d6;box-sizing:border-box;box-shadow:0 4px 36px -8px #6d6d6d3a;border-radius:8px!important;margin:0 8px;padding:8px}.close-menu ::ng-deep monkey-button{width:100%}.close-menu ::ng-deep monkey-button button{width:100%}\n"], components: [{ type: i1$2.MonkeyIconComponent, selector: "monkey-icon", inputs: ["icon", "color", "contrast", "disabled"] }, { type: MECXFilterOptionsChildrenComponent, selector: "mecx-filter-options-children", inputs: ["option"], outputs: ["onSubmit", "onShow"] }, { type: MECXFilterOptionsStatusComponent, selector: "mecx-filter-options-status", inputs: ["option"], outputs: ["onSubmit"] }, { type: MECXFilterOptionsDateRangeComponent, selector: "mecx-filter-options-date-range", inputs: ["option"], outputs: ["onSubmit"] }, { type: MECXFilterOptionsCurrencyComponent, selector: "mecx-filter-options-currency", inputs: ["option"], outputs: ["onSubmit"] }, { type: MECXFilterOptionsInputComponent, selector: "mecx-filter-options-input", inputs: ["option"], outputs: ["onSubmit"] }, { type: i1$2.MonkeyButtonComponent, selector: "monkey-button", inputs: ["label", "icon", "iconPosition", "type", "color", "disabled", "size"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i3.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i1$4.MonkeyEcxPopoverDirective, selector: "[monkeyecxPopover]", inputs: ["monkeyecxPopover", "monkeyecxPopoverClosed", "monkeyecxPopoverTarget", "monkeyecxPopoverMinwidth", "monkeyecxPopoverBackdrop", "monkeyecxPopoverWatch", "monkeyecxPopoverDir", "monkeyecxPopoverContextmenu", "monkeyecxPopoverHeight"] }], pipes: { "translate": i1$3.TranslatePipe } });
1839
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterOptionsComponent, decorators: [{
1840
- type: Component,
1841
- args: [{ selector: 'mecx-filter-options', template: "<div class=\"d-flex justify-content-between header\">\n <span class=\"title\">\n {{ option?.label | translate }}\n </span>\n <div class=\"close\" #actionElement (click)=\"onHandleShowMenu()\">\n <monkey-icon icon=\"close-12\" color=\"#474747\"></monkey-icon>\n </div>\n</div>\n<ng-container *ngIf=\"option?.type as type\">\n <ng-container *ngIf=\"option?.children; else withoutChildren\">\n <mecx-filter-options-children [option]=\"option\" (onSubmit)=\"onHandleSubmitChildren($event)\"\n (onShow)=\"onShowFromChildren.next($event)\">\n </mecx-filter-options-children>\n </ng-container>\n <ng-template #withoutChildren>\n <ng-container [ngSwitch]=\"type\">\n <mecx-filter-options-status *ngSwitchCase=\"'status'\" [option]=\"option\"\n (onSubmit)=\"onHandleSubmit($event)\">\n </mecx-filter-options-status>\n <mecx-filter-options-date-range *ngSwitchCase=\"'date-range'\" [option]=\"option\"\n (onSubmit)=\"onHandleSubmit($event)\">\n </mecx-filter-options-date-range>\n <mecx-filter-options-currency *ngSwitchCase=\"'currency'\" [option]=\"option\"\n (onSubmit)=\"onHandleSubmit($event)\">\n </mecx-filter-options-currency>\n <mecx-filter-options-input *ngSwitchCase=\"'input'\" [option]=\"option\"\n (onSubmit)=\"onHandleSubmit($event)\">\n </mecx-filter-options-input>\n </ng-container>\n </ng-template>\n</ng-container>\n\n<ng-container\n *monkeyecxPopover=\"_showMenu; target: $any(actionElement); closed: closeMenu; dir: 'ltr'\">\n <div class=\"close-menu\">\n <monkey-button type=\"tertiary\" color=\"error\" (click)=\"onRemove.next()\" size=\"sm\">\n {{ 'BUTTONS.REMOVE' | translate }}\n </monkey-button>\n <monkey-button type=\"tertiary\" color=\"theme\" (click)=\"onClose.next()\" size=\"sm\">\n {{ 'BUTTONS.CLOSE' | translate }}\n </monkey-button>\n </div>\n</ng-container>", styles: [":host{display:flex;flex-direction:column;background:#fafafa;border:1px solid #d6d6d6;box-sizing:border-box;box-shadow:0 4px 36px -8px #6d6d6d3a;border-radius:8px!important;margin:0 8px}:host .header{border-bottom:1px solid #d6d6d6;padding:8px}:host .header .title{color:#4b4a53;font-style:normal;font-size:14px;line-height:16px;font-weight:500;text-align:left}:host .header .close{cursor:pointer;border-radius:120px;padding:4px}:host .header .close:hover{background-color:#6d6d6d0c}.close-menu{display:flex;flex-direction:column;background:#fafafa;border:1px solid #d6d6d6;box-sizing:border-box;box-shadow:0 4px 36px -8px #6d6d6d3a;border-radius:8px!important;margin:0 8px;padding:8px}.close-menu ::ng-deep monkey-button{width:100%}.close-menu ::ng-deep monkey-button button{width:100%}\n"] }]
1842
- }], ctorParameters: function () { return []; }, propDecorators: { option: [{
1843
- type: Input
1844
- }], closeDirectly: [{
1845
- type: Input
1846
- }], onClose: [{
1847
- type: Output
1848
- }], onRemove: [{
1849
- type: Output
1850
- }], onSubmit: [{
1851
- type: Output
1852
- }], onShowFromChildren: [{
1853
- type: Output
1854
- }] } });
1855
-
1856
- class MECXFilterSelectedItemComponent {
1857
- constructor() {
1858
- this.onClose = new EventEmitter();
1859
- this.onSubmit = new EventEmitter();
1860
- this._option = null;
1861
- this._showMenu = false;
1862
- this._actionElement = null;
1863
- this.closeMenu = () => {
1864
- this._showMenu = false;
1865
- };
1866
- // not to do
1867
- }
1868
- set option(value) {
1869
- this._option = value;
1870
- }
1871
- onHandleShowMenu() {
1872
- const { _option } = this;
1873
- this._actionElement = document.getElementById(`mecx-filter-selected-item-${_option?.field}`);
1874
- setTimeout(() => {
1875
- this._showMenu = true;
1876
- }, 0);
1877
- }
1878
- onHandleClose() {
1879
- this._showMenu = false;
1880
- this.onClose.next();
1881
- }
1882
- onHandleSubmit(event) {
1883
- this.onSubmit.next(event);
1884
- }
1885
- onHandleRemove() {
1886
- const { _option } = this;
1887
- const { field } = _option;
1888
- this.onSubmit.next({ [field]: null });
1889
- }
1890
- onHandleShowFromChildren(event) {
1891
- const { _option } = this;
1892
- const { label } = _option;
1893
- this.onHandleShowMenu();
1894
- this.onHandleSubmit = (event) => {
1895
- this.onSubmit.next({
1896
- [_option.field]: JSON.stringify(event)
1897
- });
1898
- };
1899
- this._option = {
1900
- ...event,
1901
- label
1902
- };
1903
- }
1904
- }
1905
- MECXFilterSelectedItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterSelectedItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1906
- MECXFilterSelectedItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: MECXFilterSelectedItemComponent, selector: "mecx-filter-selected-item", inputs: { option: "option" }, outputs: { onClose: "onClose", onSubmit: "onSubmit" }, ngImport: i0, template: "<ng-container *ngIf=\"_option?.type as type\">\n <ng-container *ngIf=\"_option?.children; else withoutChildren\">\n <mecx-filter-selected-item-children [option]=\"_option\" (onShow)=\"onHandleShowMenu()\"\n (onRemove)=\"onHandleRemove()\">\n </mecx-filter-selected-item-children>\n </ng-container>\n <ng-template #withoutChildren>\n <div class=\"box\">\n <div class=\"data\">\n {{ _option.label | translate }}\n </div>\n <div class=\"value\" [id]=\"'mecx-filter-selected-item-'+_option?.field\"\n (click)=\"onHandleShowMenu()\">\n <ng-container [ngSwitch]=\"type\">\n <mecx-filter-selected-item-currency *ngSwitchCase=\"'currency'\" [option]=\"_option\">\n </mecx-filter-selected-item-currency>\n <mecx-filter-selected-item-input *ngSwitchCase=\"'input'\" [option]=\"_option\">\n </mecx-filter-selected-item-input>\n <mecx-filter-selected-item-date-range *ngSwitchCase=\"'date-range'\" [option]=\"_option\">\n </mecx-filter-selected-item-date-range>\n <mecx-filter-selected-item-status *ngSwitchCase=\"'status'\" [option]=\"_option\"\n [labelMoreValues]=\"'FIELD.AND-MORE' | translate\">\n </mecx-filter-selected-item-status>\n </ng-container>\n </div>\n <div class=\"action\" (click)=\"onHandleShowMenu()\">\n <monkey-icon icon=\"arrow-right-14\" color=\"#4B4A53\"></monkey-icon>\n </div>\n </div>\n </ng-template>\n</ng-container>\n<ng-container\n *monkeyecxPopover=\"_showMenu; target: $any(_actionElement); closed: closeMenu; dir: 'ltr'\">\n <mecx-filter-options [option]=\"_option\" (onClose)=\"onHandleClose()\"\n (onRemove)=\"onHandleRemove()\" (onSubmit)=\"onHandleSubmit($event)\"\n (onShowFromChildren)=\"onHandleShowFromChildren($event)\">\n </mecx-filter-options>\n</ng-container>", styles: [":host{display:flex}:host .box{display:flex;justify-content:space-between;align-items:center;background:#ffffff;border:1px solid #d6d6d6;box-sizing:border-box;border-radius:120px;height:40px}:host .box .data{display:flex;align-items:center;padding:12px 8px;height:100%;font-style:normal;font-weight:400;font-size:14px;line-height:24px;text-align:center;color:#72717e}:host .box .value{cursor:pointer;display:flex;align-items:center;padding:12px 8px;height:100%;font-style:normal;font-weight:400;font-size:14px;line-height:24px;text-align:center;color:#72717e;background-color:#6d6d6d0a}:host .box .value:hover{background-color:#6d6d6d0c;font-weight:400;text-decoration:underline}:host .box .action{cursor:pointer;border-left:1px solid #d6d6d6;padding:8px;color:#908e9d;font-weight:500;font-size:18px;height:40px;align-items:center;display:flex}:host .box .action:hover{background-color:#6d6d6d0c;border-top-right-radius:120px;border-bottom-right-radius:120px}mecx-filter-options{margin:4px 0}\n"], components: [{ type: MECXFilterSelectedItemChildrenComponent, selector: "mecx-filter-selected-item-children", inputs: ["option"], outputs: ["onShow", "onRemove"] }, { type: MECXFilterSelectedItemCurrencyComponent, selector: "mecx-filter-selected-item-currency", inputs: ["option"] }, { type: MECXFilterSelectedItemInputComponent, selector: "mecx-filter-selected-item-input", inputs: ["option"] }, { type: MECXFilterSelectedItemDateRangeComponent, selector: "mecx-filter-selected-item-date-range", inputs: ["option"] }, { type: MECXFilterSelectedItemStatusComponent, selector: "mecx-filter-selected-item-status", inputs: ["option", "labelMoreValues"] }, { type: i1$2.MonkeyIconComponent, selector: "monkey-icon", inputs: ["icon", "color", "contrast", "disabled"] }, { type: MECXFilterOptionsComponent, selector: "mecx-filter-options", inputs: ["option", "closeDirectly"], outputs: ["onClose", "onRemove", "onSubmit", "onShowFromChildren"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i3.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i1$4.MonkeyEcxPopoverDirective, selector: "[monkeyecxPopover]", inputs: ["monkeyecxPopover", "monkeyecxPopoverClosed", "monkeyecxPopoverTarget", "monkeyecxPopoverMinwidth", "monkeyecxPopoverBackdrop", "monkeyecxPopoverWatch", "monkeyecxPopoverDir", "monkeyecxPopoverContextmenu", "monkeyecxPopoverHeight"] }], pipes: { "translate": i1$3.TranslatePipe } });
1907
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterSelectedItemComponent, decorators: [{
1908
- type: Component,
1909
- args: [{ selector: 'mecx-filter-selected-item', template: "<ng-container *ngIf=\"_option?.type as type\">\n <ng-container *ngIf=\"_option?.children; else withoutChildren\">\n <mecx-filter-selected-item-children [option]=\"_option\" (onShow)=\"onHandleShowMenu()\"\n (onRemove)=\"onHandleRemove()\">\n </mecx-filter-selected-item-children>\n </ng-container>\n <ng-template #withoutChildren>\n <div class=\"box\">\n <div class=\"data\">\n {{ _option.label | translate }}\n </div>\n <div class=\"value\" [id]=\"'mecx-filter-selected-item-'+_option?.field\"\n (click)=\"onHandleShowMenu()\">\n <ng-container [ngSwitch]=\"type\">\n <mecx-filter-selected-item-currency *ngSwitchCase=\"'currency'\" [option]=\"_option\">\n </mecx-filter-selected-item-currency>\n <mecx-filter-selected-item-input *ngSwitchCase=\"'input'\" [option]=\"_option\">\n </mecx-filter-selected-item-input>\n <mecx-filter-selected-item-date-range *ngSwitchCase=\"'date-range'\" [option]=\"_option\">\n </mecx-filter-selected-item-date-range>\n <mecx-filter-selected-item-status *ngSwitchCase=\"'status'\" [option]=\"_option\"\n [labelMoreValues]=\"'FIELD.AND-MORE' | translate\">\n </mecx-filter-selected-item-status>\n </ng-container>\n </div>\n <div class=\"action\" (click)=\"onHandleShowMenu()\">\n <monkey-icon icon=\"arrow-right-14\" color=\"#4B4A53\"></monkey-icon>\n </div>\n </div>\n </ng-template>\n</ng-container>\n<ng-container\n *monkeyecxPopover=\"_showMenu; target: $any(_actionElement); closed: closeMenu; dir: 'ltr'\">\n <mecx-filter-options [option]=\"_option\" (onClose)=\"onHandleClose()\"\n (onRemove)=\"onHandleRemove()\" (onSubmit)=\"onHandleSubmit($event)\"\n (onShowFromChildren)=\"onHandleShowFromChildren($event)\">\n </mecx-filter-options>\n</ng-container>", styles: [":host{display:flex}:host .box{display:flex;justify-content:space-between;align-items:center;background:#ffffff;border:1px solid #d6d6d6;box-sizing:border-box;border-radius:120px;height:40px}:host .box .data{display:flex;align-items:center;padding:12px 8px;height:100%;font-style:normal;font-weight:400;font-size:14px;line-height:24px;text-align:center;color:#72717e}:host .box .value{cursor:pointer;display:flex;align-items:center;padding:12px 8px;height:100%;font-style:normal;font-weight:400;font-size:14px;line-height:24px;text-align:center;color:#72717e;background-color:#6d6d6d0a}:host .box .value:hover{background-color:#6d6d6d0c;font-weight:400;text-decoration:underline}:host .box .action{cursor:pointer;border-left:1px solid #d6d6d6;padding:8px;color:#908e9d;font-weight:500;font-size:18px;height:40px;align-items:center;display:flex}:host .box .action:hover{background-color:#6d6d6d0c;border-top-right-radius:120px;border-bottom-right-radius:120px}mecx-filter-options{margin:4px 0}\n"] }]
1910
- }], ctorParameters: function () { return []; }, propDecorators: { option: [{
1911
- type: Input
1912
- }], onClose: [{
1913
- type: Output
1914
- }], onSubmit: [{
1915
- type: Output
1916
- }] } });
1917
-
1918
- class MECXFilterSelectedComponent {
1919
- constructor() {
1920
- this.model = [];
1921
- this.onOpenFilters = new EventEmitter();
1922
- this.onClose = new EventEmitter();
1923
- this.onSubmit = new EventEmitter();
1924
- this._model = [];
1925
- // not to do
1926
- }
1927
- validateValue({ field, value, getValue }) {
1928
- try {
1929
- value = value || getValue()?.[field];
1930
- if (!value)
1931
- return false;
1932
- if (typeof value === 'object') {
1933
- return value && JSON.stringify(value) !== '{}';
1934
- }
1935
- return MonkeyEcxUtils.persistNullEmptyUndefined(value);
1936
- }
1937
- catch (e) {
1938
- // not to do
1939
- }
1940
- return false;
1941
- }
1942
- onHandleSelectedValue(value) {
1943
- this._model = value?.map((_) => {
1944
- const { children } = _;
1945
- let obj = null;
1946
- if (children) {
1947
- obj = {
1948
- ..._,
1949
- children
1950
- };
1951
- }
1952
- else if (this.validateValue(_)) {
1953
- obj = {
1954
- ..._,
1955
- ...obj || {}
1956
- };
1957
- }
1958
- return obj;
1959
- })?.filter((_) => {
1960
- return _;
1961
- });
1962
- }
1963
- ngOnChanges(changes) {
1964
- if (changes.model) {
1965
- const { currentValue } = changes.model;
1966
- if (currentValue && JSON.stringify(currentValue) !== '{}') {
1967
- this.onHandleSelectedValue(currentValue);
1968
- }
1969
- }
1970
- }
1971
- onHandleClose() {
1972
- this.onClose.next();
1973
- }
1974
- onHandleSubmit(event) {
1975
- this.onSubmit.next(event);
1976
- }
1977
- }
1978
- MECXFilterSelectedComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterSelectedComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1979
- MECXFilterSelectedComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: MECXFilterSelectedComponent, selector: "mecx-filter-selected", inputs: { model: "model" }, outputs: { onOpenFilters: "onOpenFilters", onClose: "onClose", onSubmit: "onSubmit" }, usesOnChanges: true, ngImport: i0, template: "<mecx-filter-selected-item *ngFor=\"let option of _model\" (onSubmit)=\"onHandleSubmit($event)\"\n (onClose)=\"onHandleClose()\" [option]=\"option\">\n</mecx-filter-selected-item>", styles: [":host{display:flex}:host ::ng-deep mecx-filter-selected-item{margin-right:8px}\n"], components: [{ type: MECXFilterSelectedItemComponent, selector: "mecx-filter-selected-item", inputs: ["option"], outputs: ["onClose", "onSubmit"] }], directives: [{ type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
1980
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterSelectedComponent, decorators: [{
1981
- type: Component,
1982
- args: [{ selector: 'mecx-filter-selected', template: "<mecx-filter-selected-item *ngFor=\"let option of _model\" (onSubmit)=\"onHandleSubmit($event)\"\n (onClose)=\"onHandleClose()\" [option]=\"option\">\n</mecx-filter-selected-item>", styles: [":host{display:flex}:host ::ng-deep mecx-filter-selected-item{margin-right:8px}\n"] }]
1983
- }], ctorParameters: function () { return []; }, propDecorators: { model: [{
1984
- type: Input
1985
- }], onOpenFilters: [{
1986
- type: Output
1987
- }], onClose: [{
1988
- type: Output
1989
- }], onSubmit: [{
1990
- type: Output
1991
- }] } });
1992
-
1993
- class MECXFilterMenuComponent {
1994
- constructor() {
1995
- this.model = [];
1996
- this.onClose = new EventEmitter();
1997
- this.onSubmit = new EventEmitter();
1998
- this._onHandleSubmit = null;
1999
- this._model = [];
2000
- this._showMenu = false;
2001
- this._menuOption = null;
2002
- this.closeMenu = () => {
2003
- this._showMenu = false;
2004
- };
2005
- // not to do
2006
- }
2007
- validateValue({ field, value, getValue }) {
2008
- try {
2009
- value = value || getValue()?.[field];
2010
- if (!value)
2011
- return false;
2012
- if (typeof value === 'object') {
2013
- return value && JSON.stringify(value) !== '{}';
2014
- }
2015
- return MonkeyEcxUtils.persistNullEmptyUndefined(value);
2016
- }
2017
- catch (e) {
2018
- // not to do
2019
- }
2020
- return false;
2021
- }
2022
- onHandleSubmitValue(value) {
2023
- this.onSubmit.next(value);
2024
- this.onHandleClose();
2025
- }
2026
- onHandleMenus(value) {
2027
- this._model = value?.map((_) => {
2028
- const { children } = _;
2029
- let obj = null;
2030
- if (children) {
2031
- obj = {
2032
- ..._,
2033
- children: children?.filter((_) => {
2034
- return !this.validateValue(_);
2035
- })
2036
- };
2037
- }
2038
- else if (!this.validateValue(_)) {
2039
- obj = {
2040
- ..._,
2041
- ...obj || {}
2042
- };
2043
- }
2044
- return obj;
2045
- })?.filter((_) => {
2046
- return _;
2047
- });
2048
- this._model = this._model?.sort((a, b) => {
2049
- const groupA = `${a?.group}`.toLowerCase();
2050
- const groupB = `${b?.group}`.toLowerCase();
2051
- return groupA !== groupB ? 1 : -1;
2052
- });
2053
- }
2054
- ngOnChanges(changes) {
2055
- if (changes.model) {
2056
- const { currentValue } = changes.model;
2057
- if (currentValue && JSON.stringify(currentValue) !== '{}') {
2058
- this.onHandleMenus(currentValue);
2059
- }
2060
- }
2061
- }
2062
- onHandleChildrenAction(option, child) {
2063
- const { field, type, action } = child;
2064
- if (type === 'with-action') {
2065
- this.onHandleSubmitValue({
2066
- [option.field]: JSON.stringify({
2067
- [field]: action()
2068
- })
2069
- });
2070
- }
2071
- else {
2072
- this._showMenu = true;
2073
- this._menuOption = child;
2074
- this.onHandleSubmit = (event) => {
2075
- this.onHandleSubmitValue({
2076
- [option.field]: JSON.stringify(event)
2077
- });
2078
- };
2079
- }
2080
- }
2081
- onHandleShowMenu(option) {
2082
- this._showMenu = true;
2083
- this._menuOption = option;
2084
- }
2085
- onHandleClose() {
2086
- this._showMenu = false;
2087
- this.onClose.next();
2088
- }
2089
- onHandleSubmit(event) {
2090
- this.onHandleSubmitValue(event);
2091
- }
2092
- }
2093
- MECXFilterMenuComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2094
- MECXFilterMenuComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: MECXFilterMenuComponent, selector: "mecx-filter-menu", inputs: { model: "model" }, outputs: { onClose: "onClose", onSubmit: "onSubmit" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"d-flex flex-column\" #actionElement>\n <ng-container *ngFor=\"let menu of _model; let index = index\">\n <ng-container *ngIf=\"menu?.children; else withoutChildren\">\n <div class=\"item no-action\">\n {{ menu.label | translate }}\n </div>\n <div class=\"separator\"></div>\n <ng-container *ngFor=\"let child of menu?.children\">\n <div class=\"item children\" (click)=\"onHandleChildrenAction(menu, child)\">\n {{ child.label | translate }}\n </div>\n </ng-container>\n </ng-container>\n <ng-template #withoutChildren>\n <div class=\"item\" (click)=\"onHandleShowMenu(menu)\">\n {{ menu.label | translate }}\n </div>\n </ng-template>\n <ng-container *ngIf=\"_model[index+1]?.group as next; _model[index]?.group as current\">\n <div class=\"separator\" *ngIf=\"next !== current\"></div>\n </ng-container>\n </ng-container>\n</div>\n<ng-container\n *monkeyecxPopover=\"_showMenu; target: $any(actionElement); closed: closeMenu; dir: 'rt'\">\n <mecx-filter-options [option]=\"_menuOption\" (onClose)=\"onHandleClose()\"\n (onSubmit)=\"onHandleSubmit($event)\" [closeDirectly]=\"true\"></mecx-filter-options>\n</ng-container>", styles: [":host{display:flex;flex-direction:column;background:#fafafa;border:1px solid #d6d6d6;box-sizing:border-box;box-shadow:0 4px 36px -8px #6d6d6d3a;border-radius:16px!important;min-width:192px;margin:4px 8px;overflow:auto;max-height:500px}:host ::ng-deep monkey-button{width:100%}:host ::ng-deep monkey-button button{justify-content:flex-start!important;width:100%}:host .item{font-style:normal;font-weight:400;font-size:16px;line-height:24px;color:#72717e;padding:8px 24px}:host .item.no-action{cursor:not-allowed;padding:8px;margin:0!important;font-weight:500}:host .item:first-child{margin:12px 0 0}:host .item:last-child{margin:0 0 12px}:host .item:not(.no-action){cursor:pointer}:host .item:not(.no-action):hover{background-color:var(--mecx-color-theme-200)!important;color:var(--mecx-color-theme-main)!important;font-weight:400}:host .separator{border-bottom:1px solid #ebebeb}\n"], components: [{ type: MECXFilterOptionsComponent, selector: "mecx-filter-options", inputs: ["option", "closeDirectly"], outputs: ["onClose", "onRemove", "onSubmit", "onShowFromChildren"] }], directives: [{ type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1$4.MonkeyEcxPopoverDirective, selector: "[monkeyecxPopover]", inputs: ["monkeyecxPopover", "monkeyecxPopoverClosed", "monkeyecxPopoverTarget", "monkeyecxPopoverMinwidth", "monkeyecxPopoverBackdrop", "monkeyecxPopoverWatch", "monkeyecxPopoverDir", "monkeyecxPopoverContextmenu", "monkeyecxPopoverHeight"] }], pipes: { "translate": i1$3.TranslatePipe } });
2095
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterMenuComponent, decorators: [{
2096
- type: Component,
2097
- args: [{ selector: 'mecx-filter-menu', template: "<div class=\"d-flex flex-column\" #actionElement>\n <ng-container *ngFor=\"let menu of _model; let index = index\">\n <ng-container *ngIf=\"menu?.children; else withoutChildren\">\n <div class=\"item no-action\">\n {{ menu.label | translate }}\n </div>\n <div class=\"separator\"></div>\n <ng-container *ngFor=\"let child of menu?.children\">\n <div class=\"item children\" (click)=\"onHandleChildrenAction(menu, child)\">\n {{ child.label | translate }}\n </div>\n </ng-container>\n </ng-container>\n <ng-template #withoutChildren>\n <div class=\"item\" (click)=\"onHandleShowMenu(menu)\">\n {{ menu.label | translate }}\n </div>\n </ng-template>\n <ng-container *ngIf=\"_model[index+1]?.group as next; _model[index]?.group as current\">\n <div class=\"separator\" *ngIf=\"next !== current\"></div>\n </ng-container>\n </ng-container>\n</div>\n<ng-container\n *monkeyecxPopover=\"_showMenu; target: $any(actionElement); closed: closeMenu; dir: 'rt'\">\n <mecx-filter-options [option]=\"_menuOption\" (onClose)=\"onHandleClose()\"\n (onSubmit)=\"onHandleSubmit($event)\" [closeDirectly]=\"true\"></mecx-filter-options>\n</ng-container>", styles: [":host{display:flex;flex-direction:column;background:#fafafa;border:1px solid #d6d6d6;box-sizing:border-box;box-shadow:0 4px 36px -8px #6d6d6d3a;border-radius:16px!important;min-width:192px;margin:4px 8px;overflow:auto;max-height:500px}:host ::ng-deep monkey-button{width:100%}:host ::ng-deep monkey-button button{justify-content:flex-start!important;width:100%}:host .item{font-style:normal;font-weight:400;font-size:16px;line-height:24px;color:#72717e;padding:8px 24px}:host .item.no-action{cursor:not-allowed;padding:8px;margin:0!important;font-weight:500}:host .item:first-child{margin:12px 0 0}:host .item:last-child{margin:0 0 12px}:host .item:not(.no-action){cursor:pointer}:host .item:not(.no-action):hover{background-color:var(--mecx-color-theme-200)!important;color:var(--mecx-color-theme-main)!important;font-weight:400}:host .separator{border-bottom:1px solid #ebebeb}\n"] }]
2098
- }], ctorParameters: function () { return []; }, propDecorators: { model: [{
2099
- type: Input
2100
- }], onClose: [{
2101
- type: Output
2102
- }], onSubmit: [{
2103
- type: Output
2104
- }] } });
2105
-
2106
- class MECXFilterComponent {
2107
- constructor() {
2108
- this.searchPlaceholder = '';
2109
- this.orderPlaceholder = '';
2110
- this.menus = [];
2111
- this.orders = [];
2112
- this.enableSearch = true;
2113
- this.isLoading = false;
2114
- this.onFilter = new EventEmitter();
2115
- this._order = null;
2116
- this._search = '';
2117
- this._showMenu = false;
2118
- this._hasFilterByMenu = false;
2119
- this._actionElement = null;
2120
- this.closeMenu = () => {
2121
- this._showMenu = false;
2122
- };
2123
- // not to do
2124
- }
2125
- set search(value) {
2126
- this._search = value;
2127
- }
2128
- set order(value) {
2129
- this._order = value;
2130
- }
2131
- validateValue({ field, value, getValue }) {
2132
- try {
2133
- value = value || getValue()?.[field];
2134
- if (!value)
2135
- return false;
2136
- if (typeof value === 'object') {
2137
- return value && JSON.stringify(value) !== '{}';
2138
- }
2139
- return MonkeyEcxUtils.persistNullEmptyUndefined(value);
2140
- }
2141
- catch (e) {
2142
- // not to do
2143
- }
2144
- return false;
2145
- }
2146
- handleFilters() {
2147
- const { menus } = this;
2148
- let found = menus.find((_) => {
2149
- return this.validateValue(_);
2150
- });
2151
- if (!found) {
2152
- found = menus.find(({ children }) => {
2153
- return (children || [])?.find((_) => {
2154
- return this.validateValue(_);
2155
- });
2156
- });
2157
- }
2158
- this._hasFilterByMenu = !!found;
2159
- }
2160
- ngOnChanges(changes) {
2161
- if (changes.menus) {
2162
- const { currentValue } = changes.menus;
2163
- if (currentValue && JSON.stringify(currentValue) !== '{}') {
2164
- this.handleFilters();
2165
- }
2166
- }
2167
- }
2168
- onSearchFilter(event) {
2169
- this.onFilter.next({ search: event });
2170
- }
2171
- onClearFilter() {
2172
- this._search = '';
2173
- this.onFilter.next({ search: null });
2174
- }
2175
- onHandleSubmit(event) {
2176
- this.onFilter.next(event);
2177
- }
2178
- onHandleShowMenu() {
2179
- this._actionElement = document.getElementById('mecx-filters-add-filter');
2180
- setTimeout(() => {
2181
- this._showMenu = true;
2182
- }, 0);
2183
- }
2184
- onHandleClose() {
2185
- this._showMenu = false;
2186
- }
2187
- onHandleOrder(event) {
2188
- this.onFilter.next({ sort: event });
2189
- }
2190
- }
2191
- MECXFilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2192
- MECXFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: MECXFilterComponent, selector: "mecx-filter", inputs: { searchPlaceholder: "searchPlaceholder", orderPlaceholder: "orderPlaceholder", menus: "menus", orders: "orders", enableSearch: "enableSearch", search: "search", order: "order", isLoading: "isLoading" }, outputs: { onFilter: "onFilter" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"d-flex flex-column full-width\">\n <div class=\"d-flex flex-column flex-md-row justify-content-between\">\n <div class=\"d-flex full-width\">\n <ng-container *ngIf=\"enableSearch\">\n <monkey-input-filter [placeholder]=\"searchPlaceholder | translate\"\n (onChange)=\"onSearchFilter($event)\" icon=\"search-16\" iconPosition=\"left\"\n [(value)]=\"_search\">\n </monkey-input-filter>\n </ng-container>\n <ng-container *ngIf=\"!_hasFilterByMenu\">\n <div class=\"d-flex actions\" id=\"mecx-filters-add-filter\">\n <monkey-button type=\"filter\" color=\"border\" (click)=\"onHandleShowMenu()\" icon=\"more-16\"\n iconPosition=\"right\">\n {{ 'BUTTONS.ADD-FILTER' | translate }}\n </monkey-button>\n </div>\n </ng-container>\n </div>\n <div class=\"order hidden-sm hidden-xs\">\n <ng-container *ngTemplateOutlet=\"orderBy\"></ng-container>\n </div>\n </div>\n <ng-container *ngIf=\"_hasFilterByMenu\">\n <div class=\"separator\"></div>\n <div class=\"d-flex full-width\">\n <mecx-filter-selected (onSubmit)=\"onHandleSubmit($event)\" (onClose)=\"onHandleClose()\"\n [model]=\"menus\"></mecx-filter-selected>\n <div class=\"more-filters\">\n <monkey-button type=\"filter\" color=\"border\" icon=\"more-16\" id=\"mecx-filters-add-filter\"\n (click)=\"onHandleShowMenu()\">\n </monkey-button>\n </div>\n </div>\n </ng-container>\n <div class=\"order hidden-md hidden-lg\">\n <ng-container *ngTemplateOutlet=\"orderBy\"></ng-container>\n </div>\n</div>\n\n<mecx-filter-menu\n *monkeyecxPopover=\"_showMenu; target: $any(_actionElement); closed: closeMenu; dir: 'ltr'\"\n (onSubmit)=\"onHandleSubmit($event)\" (onClose)=\"onHandleClose()\" [model]=\"menus\">\n</mecx-filter-menu>\n\n<ng-template #orderBy>\n <monkey-select-filter (onChange)=\"onHandleOrder($event)\" [placeholder]=\"orderPlaceholder | translate\" type=\"none\"\n [(value)]=\"_order\">\n <monkey-option *ngFor=\"let ordBy of orders\" [label]=\"ordBy?.label | translate\" [value]=\"ordBy?.value\">\n </monkey-option>\n </monkey-select-filter>\n</ng-template>", styles: [":host{display:flex;width:100%;align-items:center}@media screen and (max-width: 959px){:host{flex-direction:column;max-width:100%}:host ::ng-deep monkey-input-filter{width:100%}:host ::ng-deep monkey-select-filter{width:100%}:host ::ng-deep monkey-button{width:100%}:host ::ng-deep monkey-button button{width:100%}}@media screen and (min-width: 960px){:host .actions ::ng-deep monkey-button{margin-left:8px}:host .actions ::ng-deep monkey-button button{width:170px}}:host .more-filters ::ng-deep monkey-button monkey-icon{margin-right:unset!important}@media screen and (min-width: 960px){:host .order{width:230px}}@media screen and (max-width: 959px){:host .order{margin-top:8px}}:host ::ng-deep monkey-button{margin-bottom:0}:host ::ng-deep mecx-form-field-filter mecx-form-field-body{height:40px;margin:0}@media screen and (min-width: 960px){:host ::ng-deep monkey-input-filter{width:464px}}:host .separator{border-bottom:1px solid #ebebeb;margin-top:16px;margin-bottom:16px}\n"], components: [{ type: i1$2.MonkeyInputFilterComponent, selector: "monkey-input-filter", inputs: ["name", "label", "helperMessage", "placeholder", "icon", "type", "infoMessage", "errorMessage", "mask", "prefix", "onlyNumber", "onlyAlphaNumeric", "upperCase", "lowerCase", "capitalize", "currency", "iconPosition", "value"], outputs: ["onChange"] }, { type: i1$2.MonkeyButtonComponent, selector: "monkey-button", inputs: ["label", "icon", "iconPosition", "type", "color", "disabled", "size"] }, { type: MECXFilterSelectedComponent, selector: "mecx-filter-selected", inputs: ["model"], outputs: ["onOpenFilters", "onClose", "onSubmit"] }, { type: MECXFilterMenuComponent, selector: "mecx-filter-menu", inputs: ["model"], outputs: ["onClose", "onSubmit"] }, { type: i1$2.MonkeySelectFilterComponent, selector: "monkey-select-filter", inputs: ["placeholder", "icon", "type", "value"], outputs: ["onChange"] }, { type: i1$2.MonkeyOptionComponent, selector: "monkey-option", inputs: ["type", "label", "value", "selectAll", "selected", "enableClick"], outputs: ["onSelectOption"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i1$4.MonkeyEcxPopoverDirective, selector: "[monkeyecxPopover]", inputs: ["monkeyecxPopover", "monkeyecxPopoverClosed", "monkeyecxPopoverTarget", "monkeyecxPopoverMinwidth", "monkeyecxPopoverBackdrop", "monkeyecxPopoverWatch", "monkeyecxPopoverDir", "monkeyecxPopoverContextmenu", "monkeyecxPopoverHeight"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "translate": i1$3.TranslatePipe } });
2193
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterComponent, decorators: [{
2194
- type: Component,
2195
- args: [{ selector: 'mecx-filter', template: "<div class=\"d-flex flex-column full-width\">\n <div class=\"d-flex flex-column flex-md-row justify-content-between\">\n <div class=\"d-flex full-width\">\n <ng-container *ngIf=\"enableSearch\">\n <monkey-input-filter [placeholder]=\"searchPlaceholder | translate\"\n (onChange)=\"onSearchFilter($event)\" icon=\"search-16\" iconPosition=\"left\"\n [(value)]=\"_search\">\n </monkey-input-filter>\n </ng-container>\n <ng-container *ngIf=\"!_hasFilterByMenu\">\n <div class=\"d-flex actions\" id=\"mecx-filters-add-filter\">\n <monkey-button type=\"filter\" color=\"border\" (click)=\"onHandleShowMenu()\" icon=\"more-16\"\n iconPosition=\"right\">\n {{ 'BUTTONS.ADD-FILTER' | translate }}\n </monkey-button>\n </div>\n </ng-container>\n </div>\n <div class=\"order hidden-sm hidden-xs\">\n <ng-container *ngTemplateOutlet=\"orderBy\"></ng-container>\n </div>\n </div>\n <ng-container *ngIf=\"_hasFilterByMenu\">\n <div class=\"separator\"></div>\n <div class=\"d-flex full-width\">\n <mecx-filter-selected (onSubmit)=\"onHandleSubmit($event)\" (onClose)=\"onHandleClose()\"\n [model]=\"menus\"></mecx-filter-selected>\n <div class=\"more-filters\">\n <monkey-button type=\"filter\" color=\"border\" icon=\"more-16\" id=\"mecx-filters-add-filter\"\n (click)=\"onHandleShowMenu()\">\n </monkey-button>\n </div>\n </div>\n </ng-container>\n <div class=\"order hidden-md hidden-lg\">\n <ng-container *ngTemplateOutlet=\"orderBy\"></ng-container>\n </div>\n</div>\n\n<mecx-filter-menu\n *monkeyecxPopover=\"_showMenu; target: $any(_actionElement); closed: closeMenu; dir: 'ltr'\"\n (onSubmit)=\"onHandleSubmit($event)\" (onClose)=\"onHandleClose()\" [model]=\"menus\">\n</mecx-filter-menu>\n\n<ng-template #orderBy>\n <monkey-select-filter (onChange)=\"onHandleOrder($event)\" [placeholder]=\"orderPlaceholder | translate\" type=\"none\"\n [(value)]=\"_order\">\n <monkey-option *ngFor=\"let ordBy of orders\" [label]=\"ordBy?.label | translate\" [value]=\"ordBy?.value\">\n </monkey-option>\n </monkey-select-filter>\n</ng-template>", styles: [":host{display:flex;width:100%;align-items:center}@media screen and (max-width: 959px){:host{flex-direction:column;max-width:100%}:host ::ng-deep monkey-input-filter{width:100%}:host ::ng-deep monkey-select-filter{width:100%}:host ::ng-deep monkey-button{width:100%}:host ::ng-deep monkey-button button{width:100%}}@media screen and (min-width: 960px){:host .actions ::ng-deep monkey-button{margin-left:8px}:host .actions ::ng-deep monkey-button button{width:170px}}:host .more-filters ::ng-deep monkey-button monkey-icon{margin-right:unset!important}@media screen and (min-width: 960px){:host .order{width:230px}}@media screen and (max-width: 959px){:host .order{margin-top:8px}}:host ::ng-deep monkey-button{margin-bottom:0}:host ::ng-deep mecx-form-field-filter mecx-form-field-body{height:40px;margin:0}@media screen and (min-width: 960px){:host ::ng-deep monkey-input-filter{width:464px}}:host .separator{border-bottom:1px solid #ebebeb;margin-top:16px;margin-bottom:16px}\n"] }]
2196
- }], ctorParameters: function () { return []; }, propDecorators: { searchPlaceholder: [{
2197
- type: Input
2198
- }], orderPlaceholder: [{
2199
- type: Input
2200
- }], menus: [{
2201
- type: Input
2202
- }], orders: [{
2203
- type: Input
2204
- }], enableSearch: [{
2205
- type: Input
2206
- }], search: [{
2207
- type: Input
2208
- }], order: [{
2209
- type: Input
2210
- }], isLoading: [{
2211
- type: Input
2212
- }], onFilter: [{
2213
- type: Output
2214
- }] } });
2215
-
2216
- class MECXFilterOptionsModule {
2217
- }
2218
- MECXFilterOptionsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterOptionsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2219
- MECXFilterOptionsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterOptionsModule, declarations: [MECXFilterOptionsChildrenComponent,
2220
- MECXFilterOptionsComponent,
2221
- MECXFilterOptionsCurrencyComponent,
2222
- MECXFilterOptionsDateRangeComponent,
2223
- MECXFilterOptionsInputComponent,
2224
- MECXFilterOptionsStatusComponent], imports: [CommonModule,
2225
- FormsModule,
2226
- MonkeyBadgeModule,
2227
- MonkeyButtonModule,
2228
- MonkeyCheckboxModule,
2229
- MonkeyDateRangePickerModule,
2230
- MonkeyEcxDirectivesModule,
2231
- MonkeyIconModule,
2232
- MonkeyInputModule,
2233
- MonkeyOptionModule,
2234
- MonkeySelectModule,
2235
- ReactiveFormsModule,
2236
- RouterModule, i1$3.TranslateModule], exports: [MECXFilterOptionsChildrenComponent,
2237
- MECXFilterOptionsComponent,
2238
- MECXFilterOptionsCurrencyComponent,
2239
- MECXFilterOptionsDateRangeComponent,
2240
- MECXFilterOptionsInputComponent,
2241
- MECXFilterOptionsStatusComponent] });
2242
- MECXFilterOptionsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterOptionsModule, imports: [[
2243
- CommonModule,
2244
- FormsModule,
2245
- MonkeyBadgeModule,
2246
- MonkeyButtonModule,
2247
- MonkeyCheckboxModule,
2248
- MonkeyDateRangePickerModule,
2249
- MonkeyEcxDirectivesModule,
2250
- MonkeyIconModule,
2251
- MonkeyInputModule,
2252
- MonkeyOptionModule,
2253
- MonkeySelectModule,
2254
- ReactiveFormsModule,
2255
- RouterModule,
2256
- TranslateModule.forChild()
2257
- ]] });
2258
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterOptionsModule, decorators: [{
2259
- type: NgModule,
2260
- args: [{
2261
- declarations: [
2262
- MECXFilterOptionsChildrenComponent,
2263
- MECXFilterOptionsComponent,
2264
- MECXFilterOptionsCurrencyComponent,
2265
- MECXFilterOptionsDateRangeComponent,
2266
- MECXFilterOptionsInputComponent,
2267
- MECXFilterOptionsStatusComponent
2268
- ],
2269
- imports: [
2270
- CommonModule,
2271
- FormsModule,
2272
- MonkeyBadgeModule,
2273
- MonkeyButtonModule,
2274
- MonkeyCheckboxModule,
2275
- MonkeyDateRangePickerModule,
2276
- MonkeyEcxDirectivesModule,
2277
- MonkeyIconModule,
2278
- MonkeyInputModule,
2279
- MonkeyOptionModule,
2280
- MonkeySelectModule,
2281
- ReactiveFormsModule,
2282
- RouterModule,
2283
- TranslateModule.forChild()
2284
- ],
2285
- exports: [
2286
- MECXFilterOptionsChildrenComponent,
2287
- MECXFilterOptionsComponent,
2288
- MECXFilterOptionsCurrencyComponent,
2289
- MECXFilterOptionsDateRangeComponent,
2290
- MECXFilterOptionsInputComponent,
2291
- MECXFilterOptionsStatusComponent
2292
- ]
2293
- }]
2294
- }] });
2295
-
2296
- class MECXFilterMenuModule {
2297
- }
2298
- MECXFilterMenuModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterMenuModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2299
- MECXFilterMenuModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterMenuModule, declarations: [MECXFilterMenuComponent], imports: [CommonModule,
2300
- FormsModule,
2301
- ReactiveFormsModule,
2302
- MonkeyEcxDirectivesModule,
2303
- MonkeyButtonModule,
2304
- MonkeyBadgeModule,
2305
- MonkeyIconModule,
2306
- MonkeyInputModule,
2307
- MonkeyCheckboxModule,
2308
- MonkeySelectModule,
2309
- MonkeyOptionModule,
2310
- MonkeyDateRangePickerModule,
2311
- RouterModule,
2312
- MECXFilterOptionsModule, i1$3.TranslateModule], exports: [MECXFilterMenuComponent] });
2313
- MECXFilterMenuModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterMenuModule, imports: [[
2314
- CommonModule,
2315
- FormsModule,
2316
- ReactiveFormsModule,
2317
- MonkeyEcxDirectivesModule,
2318
- MonkeyButtonModule,
2319
- MonkeyBadgeModule,
2320
- MonkeyIconModule,
2321
- MonkeyInputModule,
2322
- MonkeyCheckboxModule,
2323
- MonkeySelectModule,
2324
- MonkeyOptionModule,
2325
- MonkeyDateRangePickerModule,
2326
- RouterModule,
2327
- MECXFilterOptionsModule,
2328
- TranslateModule.forChild()
2329
- ]] });
2330
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterMenuModule, decorators: [{
2331
- type: NgModule,
2332
- args: [{
2333
- declarations: [MECXFilterMenuComponent],
2334
- imports: [
2335
- CommonModule,
2336
- FormsModule,
2337
- ReactiveFormsModule,
2338
- MonkeyEcxDirectivesModule,
2339
- MonkeyButtonModule,
2340
- MonkeyBadgeModule,
2341
- MonkeyIconModule,
2342
- MonkeyInputModule,
2343
- MonkeyCheckboxModule,
2344
- MonkeySelectModule,
2345
- MonkeyOptionModule,
2346
- MonkeyDateRangePickerModule,
2347
- RouterModule,
2348
- MECXFilterOptionsModule,
2349
- TranslateModule.forChild()
2350
- ],
2351
- exports: [MECXFilterMenuComponent]
2352
- }]
2353
- }] });
2354
-
2355
- class MECXFilterSelectedModule {
2356
- }
2357
- MECXFilterSelectedModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterSelectedModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2358
- MECXFilterSelectedModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterSelectedModule, declarations: [MECXFilterSelectedComponent,
2359
- MECXFilterSelectedItemChildrenComponent,
2360
- MECXFilterSelectedItemComponent,
2361
- MECXFilterSelectedItemCurrencyComponent,
2362
- MECXFilterSelectedItemDateRangeComponent,
2363
- MECXFilterSelectedItemDateWithActionComponent,
2364
- MECXFilterSelectedItemInputComponent,
2365
- MECXFilterSelectedItemStatusComponent], imports: [CommonModule,
2366
- FormsModule,
2367
- MECXFilterOptionsModule,
2368
- MonkeyBadgeModule,
2369
- MonkeyButtonModule,
2370
- MonkeyCheckboxModule,
2371
- MonkeyDateRangePickerModule,
2372
- MonkeyEcxDirectivesModule,
2373
- MonkeyEcxPipesModule,
2374
- MonkeyIconModule,
2375
- MonkeyInputModule,
2376
- MonkeyOptionModule,
2377
- MonkeySelectModule,
2378
- ReactiveFormsModule,
2379
- RouterModule, i1$3.TranslateModule], exports: [MECXFilterSelectedComponent] });
2380
- MECXFilterSelectedModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterSelectedModule, imports: [[
2381
- CommonModule,
2382
- FormsModule,
2383
- MECXFilterOptionsModule,
2384
- MonkeyBadgeModule,
2385
- MonkeyButtonModule,
2386
- MonkeyCheckboxModule,
2387
- MonkeyDateRangePickerModule,
2388
- MonkeyEcxDirectivesModule,
2389
- MonkeyEcxPipesModule,
2390
- MonkeyIconModule,
2391
- MonkeyInputModule,
2392
- MonkeyOptionModule,
2393
- MonkeySelectModule,
2394
- ReactiveFormsModule,
2395
- RouterModule,
2396
- TranslateModule.forChild()
2397
- ]] });
2398
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterSelectedModule, decorators: [{
2399
- type: NgModule,
2400
- args: [{
2401
- declarations: [
2402
- MECXFilterSelectedComponent,
2403
- MECXFilterSelectedItemChildrenComponent,
2404
- MECXFilterSelectedItemComponent,
2405
- MECXFilterSelectedItemCurrencyComponent,
2406
- MECXFilterSelectedItemDateRangeComponent,
2407
- MECXFilterSelectedItemDateWithActionComponent,
2408
- MECXFilterSelectedItemInputComponent,
2409
- MECXFilterSelectedItemStatusComponent
2410
- ],
2411
- imports: [
2412
- CommonModule,
2413
- FormsModule,
2414
- MECXFilterOptionsModule,
2415
- MonkeyBadgeModule,
2416
- MonkeyButtonModule,
2417
- MonkeyCheckboxModule,
2418
- MonkeyDateRangePickerModule,
2419
- MonkeyEcxDirectivesModule,
2420
- MonkeyEcxPipesModule,
2421
- MonkeyIconModule,
2422
- MonkeyInputModule,
2423
- MonkeyOptionModule,
2424
- MonkeySelectModule,
2425
- ReactiveFormsModule,
2426
- RouterModule,
2427
- TranslateModule.forChild()
2428
- ],
2429
- exports: [MECXFilterSelectedComponent]
2430
- }]
2431
- }] });
2432
-
2433
- class MECXFilterModule {
2434
- }
2435
- MECXFilterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2436
- MECXFilterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterModule, declarations: [MECXFilterComponent], imports: [MonkeyEcxDirectivesModule,
2437
- MonkeyEcxPipesModule,
2438
- MonkeyButtonModule,
2439
- MonkeyInputModule,
2440
- MonkeyIconModule,
2441
- MonkeySelectModule,
2442
- MonkeyOptionModule, i1$3.TranslateModule, MECXFilterMenuModule,
2443
- MECXFilterSelectedModule,
2444
- CommonModule,
2445
- FormsModule,
2446
- ReactiveFormsModule], exports: [MECXFilterComponent] });
2447
- MECXFilterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterModule, imports: [[
2448
- MonkeyEcxDirectivesModule,
2449
- MonkeyEcxPipesModule,
2450
- MonkeyButtonModule,
2451
- MonkeyInputModule,
2452
- MonkeyIconModule,
2453
- MonkeySelectModule,
2454
- MonkeyOptionModule,
2455
- TranslateModule.forChild(),
2456
- MECXFilterMenuModule,
2457
- MECXFilterSelectedModule,
2458
- CommonModule,
2459
- FormsModule,
2460
- ReactiveFormsModule
2461
- ]] });
2462
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterModule, decorators: [{
2463
- type: NgModule,
2464
- args: [{
2465
- declarations: [MECXFilterComponent],
2466
- imports: [
2467
- MonkeyEcxDirectivesModule,
2468
- MonkeyEcxPipesModule,
2469
- MonkeyButtonModule,
2470
- MonkeyInputModule,
2471
- MonkeyIconModule,
2472
- MonkeySelectModule,
2473
- MonkeyOptionModule,
2474
- TranslateModule.forChild(),
2475
- MECXFilterMenuModule,
2476
- MECXFilterSelectedModule,
2477
- CommonModule,
2478
- FormsModule,
2479
- ReactiveFormsModule
2480
- ],
2481
- exports: [MECXFilterComponent]
2482
- }]
2483
- }] });
2484
-
2485
- class MECXPasswordStrengthComponent {
2486
- constructor(configService) {
2487
- this.configService = configService;
2488
- this.passwordToCheck = null;
2489
- this.i18n = null;
2490
- this.onHandleSubmitReady = new EventEmitter();
2491
- this._validatorsPasswordPass = [];
2492
- this._stepPassword = 0;
2493
- this.validatorsPassword = new Map();
2494
- // not do
2495
- }
2496
- handleColor(score) {
2497
- let idx = 0;
2498
- if (score > 50)
2499
- idx = 1;
2500
- if (score === 100)
2501
- idx = 2;
2502
- this._stepPassword = idx;
2503
- }
2504
- passwordStrengthValidator(pass) {
2505
- this._validatorsPasswordPass = [];
2506
- let score = 0;
2507
- this.validatorsPassword.forEach((key, value) => {
2508
- this._validatorsPasswordPass.push({
2509
- regex: `${value}`,
2510
- validate: `${key.VALIDATE}` === String(RegExp(`${key.REGEX}`).test(pass)),
2511
- percent: 100 / this.validatorsPassword.size
2512
- });
2513
- });
2514
- this._validatorsPasswordPass.forEach((check) => {
2515
- if (check.validate) {
2516
- score += check.percent;
2517
- }
2518
- });
2519
- return Math.trunc(score);
2520
- }
2521
- onHandleReady() {
2522
- const validate = this._validatorsPasswordPass?.find(({ validate }) => { return !validate; });
2523
- this.onHandleSubmitReady.next(!validate);
2524
- }
2525
- onHandleChages() {
2526
- const password = this.passwordToCheck;
2527
- this.handleColor(this.passwordStrengthValidator(password));
2528
- this.onHandleReady();
2529
- }
2530
- onHandlePasswordStrengthKeys(params) {
2531
- const ps = params?.program?.screens?.login?.passwordStrength;
2532
- if (ps) {
2533
- Object.entries(ps)
2534
- .forEach(([key, value]) => {
2535
- if (MonkeyEcxUtils.persistNullEmptyUndefined(value)) {
2536
- this.validatorsPassword.set(key, value);
2537
- }
2538
- });
2539
- this.onHandleChages();
2540
- }
2541
- }
2542
- ngOnInit() {
2543
- this.configService.config().subscribe((_) => {
2544
- this.onHandlePasswordStrengthKeys(_);
2545
- });
2546
- }
2547
- ngOnChanges() {
2548
- this.onHandleChages();
2549
- }
2550
- }
2551
- MECXPasswordStrengthComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXPasswordStrengthComponent, deps: [{ token: i1$4.MonkeyEcxConfigService }], target: i0.ɵɵFactoryTarget.Component });
2552
- MECXPasswordStrengthComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: MECXPasswordStrengthComponent, selector: "mecx-password-strength", inputs: { passwordToCheck: "passwordToCheck", i18n: "i18n" }, outputs: { onHandleSubmitReady: "onHandleSubmitReady" }, usesOnChanges: true, ngImport: i0, template: "<ng-container *ngIf=\"_validatorsPasswordPass?.length\">\n <div id=\"strength\" class=\"d-flex full-width flex-column justify-content-center align-items-center\"\n #strength>\n <div id=\"strengthBar\" class=\"strength-bar d-flex full-width flex-row\">\n <div class=\"d-flex full-width align-items-center\">\n <div class=\"bar-label\">\n <small>{{ i18n?.TITLE }}</small>\n </div>\n </div>\n <div class=\"d-flex full-width align-items-center flex-column\">\n <div class=\"point\" [class.error]=\"_stepPassword === 0\"\n [class.warning]=\"_stepPassword === 1\"\n [class.success]=\"_stepPassword === 2\">\n </div>\n <ng-container *ngIf=\"_stepPassword === 0\">\n <ng-container *ngTemplateOutlet=\"stepPasswordLabel\"></ng-container>\n </ng-container>\n </div>\n <div class=\"d-flex full-width align-items-center flex-column\">\n <div class=\"point\" [class.warning]=\"_stepPassword === 1\"\n [class.success]=\"_stepPassword === 2\"></div>\n <ng-container *ngIf=\"_stepPassword === 1\">\n <ng-container *ngTemplateOutlet=\"stepPasswordLabel\"></ng-container>\n </ng-container>\n </div>\n <div class=\"d-flex full-width align-items-center flex-column\">\n <div class=\"point\" [class.success]=\"_stepPassword === 2\"></div>\n <ng-container *ngIf=\"_stepPassword === 2\">\n <ng-container *ngTemplateOutlet=\"stepPasswordLabel\"></ng-container>\n </ng-container>\n </div>\n </div>\n </div>\n <div class=\"callbacks mt-2 row\">\n <div class=\"col-sm-6 mt-2 d-flex justify-content-start\"\n *ngFor=\"let validators of _validatorsPasswordPass\">\n <monkey-icon *ngIf=\"validators.validate\" icon=\"check-circle-20\"></monkey-icon>\n <monkey-icon *ngIf=\"!validators.validate\" icon=\"error-20\"></monkey-icon>\n <span class=\"ml-2\">\n {{ i18n?.TYPES?.[validators.regex] }}\n </span>\n </div>\n </div>\n</ng-container>\n<ng-template #stepPasswordLabel>\n <div class=\"name-point mt-1\" [class.error]=\"_stepPassword === 0\"\n [class.warning]=\"_stepPassword === 1\" [class.success]=\"_stepPassword === 2\">\n {{ i18n?.LABELS?.[_stepPassword] }}\n </div>\n</ng-template>", styles: ["mecx-password-strength{margin-bottom:8px}mecx-password-strength .strength-bar{display:inline;list-style:none;padding:0;vertical-align:2px;gap:.5rem}mecx-password-strength .strength-bar .bar-label{font-style:normal;font-weight:400;font-size:14px;line-height:16px;color:#4b4a53;text-align:left}mecx-password-strength .strength-bar .point:last-child{margin:0}mecx-password-strength .callbacks{font-style:normal;font-weight:400;font-size:14px;line-height:16px;color:#72717e;text-align:left}mecx-password-strength .point{background:#ebebeb;border-radius:8px;display:inline-block;height:8px;margin-right:4px;width:100%}mecx-password-strength .point.success{background:var(--mecx-color-success-main)}mecx-password-strength .point.warning{background:var(--mecx-color-warning-main)}mecx-password-strength .point.error{background:var(--mecx-color-error-main)}mecx-password-strength .name-point.success{color:var(--mecx-color-success-main)}mecx-password-strength .name-point.warning{color:var(--mecx-color-warning-main)}mecx-password-strength .name-point.error{color:var(--mecx-color-error-main)}\n"], components: [{ type: i1$2.MonkeyIconComponent, selector: "monkey-icon", inputs: ["icon", "color", "contrast", "disabled"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], encapsulation: i0.ViewEncapsulation.None });
2553
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXPasswordStrengthComponent, decorators: [{
2554
- type: Component,
2555
- args: [{ selector: 'mecx-password-strength', encapsulation: ViewEncapsulation.None, template: "<ng-container *ngIf=\"_validatorsPasswordPass?.length\">\n <div id=\"strength\" class=\"d-flex full-width flex-column justify-content-center align-items-center\"\n #strength>\n <div id=\"strengthBar\" class=\"strength-bar d-flex full-width flex-row\">\n <div class=\"d-flex full-width align-items-center\">\n <div class=\"bar-label\">\n <small>{{ i18n?.TITLE }}</small>\n </div>\n </div>\n <div class=\"d-flex full-width align-items-center flex-column\">\n <div class=\"point\" [class.error]=\"_stepPassword === 0\"\n [class.warning]=\"_stepPassword === 1\"\n [class.success]=\"_stepPassword === 2\">\n </div>\n <ng-container *ngIf=\"_stepPassword === 0\">\n <ng-container *ngTemplateOutlet=\"stepPasswordLabel\"></ng-container>\n </ng-container>\n </div>\n <div class=\"d-flex full-width align-items-center flex-column\">\n <div class=\"point\" [class.warning]=\"_stepPassword === 1\"\n [class.success]=\"_stepPassword === 2\"></div>\n <ng-container *ngIf=\"_stepPassword === 1\">\n <ng-container *ngTemplateOutlet=\"stepPasswordLabel\"></ng-container>\n </ng-container>\n </div>\n <div class=\"d-flex full-width align-items-center flex-column\">\n <div class=\"point\" [class.success]=\"_stepPassword === 2\"></div>\n <ng-container *ngIf=\"_stepPassword === 2\">\n <ng-container *ngTemplateOutlet=\"stepPasswordLabel\"></ng-container>\n </ng-container>\n </div>\n </div>\n </div>\n <div class=\"callbacks mt-2 row\">\n <div class=\"col-sm-6 mt-2 d-flex justify-content-start\"\n *ngFor=\"let validators of _validatorsPasswordPass\">\n <monkey-icon *ngIf=\"validators.validate\" icon=\"check-circle-20\"></monkey-icon>\n <monkey-icon *ngIf=\"!validators.validate\" icon=\"error-20\"></monkey-icon>\n <span class=\"ml-2\">\n {{ i18n?.TYPES?.[validators.regex] }}\n </span>\n </div>\n </div>\n</ng-container>\n<ng-template #stepPasswordLabel>\n <div class=\"name-point mt-1\" [class.error]=\"_stepPassword === 0\"\n [class.warning]=\"_stepPassword === 1\" [class.success]=\"_stepPassword === 2\">\n {{ i18n?.LABELS?.[_stepPassword] }}\n </div>\n</ng-template>", styles: ["mecx-password-strength{margin-bottom:8px}mecx-password-strength .strength-bar{display:inline;list-style:none;padding:0;vertical-align:2px;gap:.5rem}mecx-password-strength .strength-bar .bar-label{font-style:normal;font-weight:400;font-size:14px;line-height:16px;color:#4b4a53;text-align:left}mecx-password-strength .strength-bar .point:last-child{margin:0}mecx-password-strength .callbacks{font-style:normal;font-weight:400;font-size:14px;line-height:16px;color:#72717e;text-align:left}mecx-password-strength .point{background:#ebebeb;border-radius:8px;display:inline-block;height:8px;margin-right:4px;width:100%}mecx-password-strength .point.success{background:var(--mecx-color-success-main)}mecx-password-strength .point.warning{background:var(--mecx-color-warning-main)}mecx-password-strength .point.error{background:var(--mecx-color-error-main)}mecx-password-strength .name-point.success{color:var(--mecx-color-success-main)}mecx-password-strength .name-point.warning{color:var(--mecx-color-warning-main)}mecx-password-strength .name-point.error{color:var(--mecx-color-error-main)}\n"] }]
2556
- }], ctorParameters: function () { return [{ type: i1$4.MonkeyEcxConfigService }]; }, propDecorators: { passwordToCheck: [{
2557
- type: Input
2558
- }], i18n: [{
2559
- type: Input
2560
- }], onHandleSubmitReady: [{
2561
- type: Output
2562
- }] } });
2563
-
2564
- class MECXPasswordStrengthModule {
2565
- }
2566
- MECXPasswordStrengthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXPasswordStrengthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2567
- MECXPasswordStrengthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXPasswordStrengthModule, declarations: [MECXPasswordStrengthComponent], imports: [CommonModule,
2568
- FormsModule,
2569
- ReactiveFormsModule,
2570
- MonkeyEcxPipesModule,
2571
- MonkeyEcxDirectivesModule,
2572
- MonkeyButtonModule,
2573
- MonkeyInputModule,
2574
- MonkeyIconModule, i1$3.TranslateModule], exports: [MECXPasswordStrengthComponent] });
2575
- MECXPasswordStrengthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXPasswordStrengthModule, imports: [[
2576
- CommonModule,
2577
- FormsModule,
2578
- ReactiveFormsModule,
2579
- MonkeyEcxPipesModule,
2580
- MonkeyEcxDirectivesModule,
2581
- MonkeyButtonModule,
2582
- MonkeyInputModule,
2583
- MonkeyIconModule,
2584
- TranslateModule.forChild()
2585
- ]] });
2586
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXPasswordStrengthModule, decorators: [{
2587
- type: NgModule,
2588
- args: [{
2589
- declarations: [MECXPasswordStrengthComponent],
2590
- imports: [
2591
- CommonModule,
2592
- FormsModule,
2593
- ReactiveFormsModule,
2594
- MonkeyEcxPipesModule,
2595
- MonkeyEcxDirectivesModule,
2596
- MonkeyButtonModule,
2597
- MonkeyInputModule,
2598
- MonkeyIconModule,
2599
- TranslateModule.forChild()
2600
- ],
2601
- exports: [MECXPasswordStrengthComponent]
2602
- }]
2603
- }] });
2604
-
2605
- class MECXProgressBarService {
2606
- constructor(router) {
2607
- this.router = router;
2608
- this.visible = new BehaviorSubject(false);
2609
- this.init();
2610
- }
2611
- init() {
2612
- this.router.events
2613
- .pipe(filter((event) => {
2614
- return event instanceof NavigationStart;
2615
- }))
2616
- .subscribe(() => {
2617
- this.show();
2618
- });
2619
- this.router.events
2620
- .pipe(filter((event) => {
2621
- return (event instanceof NavigationEnd ||
2622
- event instanceof NavigationError ||
2623
- event instanceof NavigationCancel);
2624
- }))
2625
- .subscribe(() => {
2626
- this.hide();
2627
- });
2628
- }
2629
- show() {
2630
- this.visible.next(true);
2631
- }
2632
- hide() {
2633
- this.visible.next(false);
2634
- }
2635
- visibleConfig() {
2636
- return this.visible.asObservable();
2637
- }
2638
- }
2639
- MECXProgressBarService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXProgressBarService, deps: [{ token: i1$1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
2640
- MECXProgressBarService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXProgressBarService, providedIn: 'root' });
2641
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXProgressBarService, decorators: [{
2642
- type: Injectable,
2643
- args: [{
2644
- providedIn: 'root'
2645
- }]
2646
- }], ctorParameters: function () { return [{ type: i1$1.Router }]; } });
2647
-
2648
- class MECXProgressBarComponent extends BaseComponent {
2649
- constructor(progressBarService) {
2650
- super();
2651
- this.progressBarService = progressBarService;
2652
- this.visible = false;
2653
- }
2654
- ngOnInit() {
2655
- this.progressBarService
2656
- .visibleConfig()
2657
- .pipe(takeUntil(this.__unsubscribeAll))
2658
- .subscribe((visible) => {
2659
- this.visible = visible;
2660
- });
2661
- }
2662
- }
2663
- MECXProgressBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXProgressBarComponent, deps: [{ token: MECXProgressBarService }], target: i0.ɵɵFactoryTarget.Component });
2664
- MECXProgressBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: MECXProgressBarComponent, selector: "mecx-progress-bar", usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"visible\">\n <progress class=\"monkey-progress monkey-progress__theme\"></progress>\n</ng-container>", styles: ["app-progress-bar{position:absolute;width:100%;margin-top:-9.5px;z-index:99998}\n"], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], encapsulation: i0.ViewEncapsulation.None });
2665
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXProgressBarComponent, decorators: [{
2666
- type: Component,
2667
- args: [{ selector: 'mecx-progress-bar', encapsulation: ViewEncapsulation.None, template: "<ng-container *ngIf=\"visible\">\n <progress class=\"monkey-progress monkey-progress__theme\"></progress>\n</ng-container>", styles: ["app-progress-bar{position:absolute;width:100%;margin-top:-9.5px;z-index:99998}\n"] }]
2668
- }], ctorParameters: function () { return [{ type: MECXProgressBarService }]; } });
2669
-
2670
- class MECXProgressBarModule {
2671
- }
2672
- MECXProgressBarModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXProgressBarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2673
- MECXProgressBarModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXProgressBarModule, declarations: [MECXProgressBarComponent], imports: [CommonModule], exports: [MECXProgressBarComponent] });
2674
- MECXProgressBarModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXProgressBarModule, imports: [[CommonModule]] });
2675
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXProgressBarModule, decorators: [{
2676
- type: NgModule,
2677
- args: [{
2678
- declarations: [MECXProgressBarComponent],
2679
- imports: [CommonModule],
2680
- exports: [MECXProgressBarComponent]
2681
- }]
2682
- }] });
2683
-
2684
- class ProductsModel {
2685
- constructor(data) {
2686
- this.url = data?.url;
2687
- this.token = data?.token;
2688
- this.username = data?.username;
2689
- this.ownerGovernmentId = data?.ownerGovernmentId;
2690
- this.ownerName = data?.ownerName;
2691
- this.product = data?.product;
2692
- this.name = data?.name;
2693
- this.type = data?.type;
2694
- this.handleLogo();
2695
- }
2696
- handleLogo() {
2697
- const { product, token, url } = this;
2698
- if (!url)
2699
- return;
2700
- const sufix = {
2701
- SALES_FINANCE: 'SF_',
2702
- SPIKE: 'SF_',
2703
- SUPPLY_CHAIN: 'SF_'
2704
- }[product];
2705
- const { hostname } = new URL(url);
2706
- const lastDot = hostname?.lastIndexOf('.');
2707
- const previousLastDot = hostname?.lastIndexOf('.', lastDot - 1);
2708
- const domain = hostname?.substring(previousLastDot + 1, hostname?.length);
2709
- const handledToken = token?.replace(sufix, '');
2710
- const path = {
2711
- 'monkeyecx.com': 'scf/br',
2712
- 'monkey.exchange': 'scf/br',
2713
- 'monkeyexchange.cl': 'scf/cl',
2714
- 'sales.finance': 'sf',
2715
- 'spike.cash': 'spike',
2716
- 'monkey.credit': 'credit'
2717
- }[domain];
2718
- this.logo = `https://assets.monkey.exchange/${path}/wl/${handledToken}/login.svg`.toLowerCase();
2719
- }
2720
- }
2721
-
2722
- class MECXProductsFilterComponent {
2723
- constructor() {
2724
- this.isLoading = false;
2725
- this.onChangeFilter = new EventEmitter();
2726
- this._search = '';
2727
- // not to do
2728
- }
2729
- onSearchFilter(event) {
2730
- this._search = event;
2731
- if (!event) {
2732
- this.onChangeFilter.next('');
2733
- return;
2734
- }
2735
- event = `${event}`.toLowerCase();
2736
- this.onChangeFilter.next(event);
2737
- }
2738
- onClearFilter() {
2739
- this._search = '';
2740
- this.onChangeFilter.next(this._search);
2741
- }
2742
- }
2743
- MECXProductsFilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXProductsFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2744
- MECXProductsFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: MECXProductsFilterComponent, selector: "mecx-products-filter", inputs: { isLoading: "isLoading" }, outputs: { onChangeFilter: "onChangeFilter" }, ngImport: i0, template: "<monkey-input-filter [placeholder]=\"'SIDEBAR-ACTIONS.PROFILE.FILTER.SEARCH-INPUT' | translate\"\n (onChange)=\"onSearchFilter($event)\" icon=\"search-16\" [(value)]=\"_search\">\n</monkey-input-filter>\n<monkey-button type=\"filter\" color=\"border\" (click)=\"onClearFilter()\">\n Limpar\n</monkey-button>", styles: [":host{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}:host ::ng-deep mecx-form-field-filter mecx-form-field-body{height:44px}:host ::ng-deep monkey-input-filter{width:100%}@media screen and (min-width: 960px){:host ::ng-deep monkey-input-filter{margin-right:8px}}\n"], components: [{ type: i1$2.MonkeyInputFilterComponent, selector: "monkey-input-filter", inputs: ["name", "label", "helperMessage", "placeholder", "icon", "type", "infoMessage", "errorMessage", "mask", "prefix", "onlyNumber", "onlyAlphaNumeric", "upperCase", "lowerCase", "capitalize", "currency", "iconPosition", "value"], outputs: ["onChange"] }, { type: i1$2.MonkeyButtonComponent, selector: "monkey-button", inputs: ["label", "icon", "iconPosition", "type", "color", "disabled", "size"] }], pipes: { "translate": i1$3.TranslatePipe } });
2745
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXProductsFilterComponent, decorators: [{
2746
- type: Component,
2747
- args: [{ selector: 'mecx-products-filter', template: "<monkey-input-filter [placeholder]=\"'SIDEBAR-ACTIONS.PROFILE.FILTER.SEARCH-INPUT' | translate\"\n (onChange)=\"onSearchFilter($event)\" icon=\"search-16\" [(value)]=\"_search\">\n</monkey-input-filter>\n<monkey-button type=\"filter\" color=\"border\" (click)=\"onClearFilter()\">\n Limpar\n</monkey-button>", styles: [":host{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}:host ::ng-deep mecx-form-field-filter mecx-form-field-body{height:44px}:host ::ng-deep monkey-input-filter{width:100%}@media screen and (min-width: 960px){:host ::ng-deep monkey-input-filter{margin-right:8px}}\n"] }]
2748
- }], ctorParameters: function () { return []; }, propDecorators: { isLoading: [{
2749
- type: Input
2750
- }], onChangeFilter: [{
2751
- type: Output
2752
- }] } });
2753
-
2754
- class MECXProductsComponent extends BaseComponent {
2755
- constructor(tokenStorage) {
2756
- super();
2757
- this.tokenStorage = tokenStorage;
2758
- this.onAccess = new EventEmitter();
2759
- this._filter = '';
2760
- this._hasMoreProducts = false;
2761
- }
2762
- onImgError(img) {
2763
- const index = Math.floor(Math.random() * (6 - 1 + 1)) + 1;
2764
- img.src = `https://assets.monkeyecx.com/icons/icon-${index}.svg`;
2765
- img.className = 'no-image';
2766
- }
2767
- onHandleProducts() {
2768
- const { _filter } = this;
2769
- this._filteredProducts = this._products.map(({ name, items }) => {
2770
- const found = items?.filter((_) => {
2771
- const cmpA = `${_.name}`.toLowerCase();
2772
- const cmpB = `${_filter}`.toLowerCase();
2773
- return cmpA.includes(cmpB);
2774
- });
2775
- if (found && found.length) {
2776
- return {
2777
- name,
2778
- items: found
2779
- };
2780
- }
2781
- return null;
2782
- }).filter((_) => { return _; });
2783
- }
2784
- onHandleMe() {
2785
- const programs = this.tokenStorage.getMe()?.programs?.map((_) => {
2786
- return new ProductsModel(_);
2787
- });
2788
- const onlyUnique = (value, index, self) => {
2789
- return self.indexOf(value) === index;
2790
- };
2791
- const products = programs.map(({ product }) => {
2792
- return product;
2793
- }).filter(onlyUnique);
2794
- this._hasMoreProducts = (products?.length || 0) > 1;
2795
- this._products = Object.entries(products).map(([key, value]) => {
2796
- const found = programs.filter(({ product }) => {
2797
- return `${product}` === `${value}`;
2798
- })?.sort((a, b) => {
2799
- const groupA = `${a?.name}`.toLowerCase();
2800
- const groupB = `${b?.name}`.toLowerCase();
2801
- return groupA !== groupB ? 1 : -1;
2802
- });
2803
- return {
2804
- name: value,
2805
- items: found
2806
- };
2807
- })?.sort((a, b) => {
2808
- const groupA = `${a?.name}`.toLowerCase();
2809
- const groupB = `${b?.name}`.toLowerCase();
2810
- return groupA !== groupB ? -1 : 1;
2811
- });
2812
- this._filteredProducts = this._products;
2813
- }
2814
- ngOnInit() {
2815
- this.tokenStorage
2816
- .meHasChanged()
2817
- .pipe(takeUntil(this.__unsubscribeAll))
2818
- .subscribe(() => {
2819
- this.onHandleMe();
2820
- });
2821
- }
2822
- onHandleChangeFilter(event) {
2823
- this._filter = event;
2824
- this.onHandleProducts();
2825
- }
2826
- }
2827
- MECXProductsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXProductsComponent, deps: [{ token: i1$4.MonkeyEcxTokenStorageService }], target: i0.ɵɵFactoryTarget.Component });
2828
- MECXProductsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: MECXProductsComponent, selector: "mecx-products", outputs: { onAccess: "onAccess" }, usesInheritance: true, ngImport: i0, template: "<mecx-products-filter (onChangeFilter)=\"onHandleChangeFilter($event)\"></mecx-products-filter>\r\n<div class=\"products-list\">\r\n <div *ngFor=\"let product of _filteredProducts\" class=\"product\">\r\n <span class=\"title\" *ngIf=\"_hasMoreProducts\">{{ 'PRODUCTS.'+product.name | translate }}</span>\r\n <div class=\"items\">\r\n <div *ngFor=\"let item of product.items\" class=\"item\"\r\n (click)=\"onAccess.next(item)\">\r\n <div class=\"icon\">\r\n <img [src]=\"item.logo\" #img (error)=\"onImgError(img)\">\r\n </div>\r\n <span class=\"name\">{{ item.name }}</span>\r\n </div>\r\n </div>\r\n </div>\r\n</div>", styles: [":host{display:flex;flex-direction:column;overflow:hidden}:host .products-list{display:flex;flex-direction:column;overflow:auto}:host .product{display:flex;flex-direction:column}:host .product .title{font-style:normal;font-weight:600;font-size:24px;line-height:32px;letter-spacing:.04em;color:#4b4a53;margin:32px 0}:host .product .items{display:grid;grid-template-columns:repeat(2,1fr);grid-column-gap:10px;grid-row-gap:10px}:host .product .items .item{cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:100px;padding:12px}:host .product .items .item .icon{margin:12px 0}:host .product .items .item .icon img{width:100%;max-width:140px}:host .product .items .item .icon .no-image{width:52px;height:52px}:host .product .items .item .name{font-style:normal;font-weight:400;font-size:18px;line-height:24px;color:#72717e;margin-top:8px}:host .product .items .item:hover{box-shadow:0 25px 52px 8px #eaeaeae0}\n"], components: [{ type: MECXProductsFilterComponent, selector: "mecx-products-filter", inputs: ["isLoading"], outputs: ["onChangeFilter"] }], directives: [{ type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "translate": i1$3.TranslatePipe } });
2829
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXProductsComponent, decorators: [{
2830
- type: Component,
2831
- args: [{ selector: 'mecx-products', template: "<mecx-products-filter (onChangeFilter)=\"onHandleChangeFilter($event)\"></mecx-products-filter>\r\n<div class=\"products-list\">\r\n <div *ngFor=\"let product of _filteredProducts\" class=\"product\">\r\n <span class=\"title\" *ngIf=\"_hasMoreProducts\">{{ 'PRODUCTS.'+product.name | translate }}</span>\r\n <div class=\"items\">\r\n <div *ngFor=\"let item of product.items\" class=\"item\"\r\n (click)=\"onAccess.next(item)\">\r\n <div class=\"icon\">\r\n <img [src]=\"item.logo\" #img (error)=\"onImgError(img)\">\r\n </div>\r\n <span class=\"name\">{{ item.name }}</span>\r\n </div>\r\n </div>\r\n </div>\r\n</div>", styles: [":host{display:flex;flex-direction:column;overflow:hidden}:host .products-list{display:flex;flex-direction:column;overflow:auto}:host .product{display:flex;flex-direction:column}:host .product .title{font-style:normal;font-weight:600;font-size:24px;line-height:32px;letter-spacing:.04em;color:#4b4a53;margin:32px 0}:host .product .items{display:grid;grid-template-columns:repeat(2,1fr);grid-column-gap:10px;grid-row-gap:10px}:host .product .items .item{cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:100px;padding:12px}:host .product .items .item .icon{margin:12px 0}:host .product .items .item .icon img{width:100%;max-width:140px}:host .product .items .item .icon .no-image{width:52px;height:52px}:host .product .items .item .name{font-style:normal;font-weight:400;font-size:18px;line-height:24px;color:#72717e;margin-top:8px}:host .product .items .item:hover{box-shadow:0 25px 52px 8px #eaeaeae0}\n"] }]
2832
- }], ctorParameters: function () { return [{ type: i1$4.MonkeyEcxTokenStorageService }]; }, propDecorators: { onAccess: [{
2833
- type: Output
2834
- }] } });
2835
-
2836
- class MECXProductsModule {
2837
- }
2838
- MECXProductsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXProductsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2839
- MECXProductsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXProductsModule, declarations: [MECXProductsComponent, MECXProductsFilterComponent], imports: [CommonModule, i1$3.TranslateModule, MonkeyInputModule, MonkeyButtonModule], exports: [MECXProductsComponent] });
2840
- MECXProductsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXProductsModule, imports: [[CommonModule, TranslateModule.forChild(), MonkeyInputModule, MonkeyButtonModule]] });
2841
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXProductsModule, decorators: [{
2842
- type: NgModule,
2843
- args: [{
2844
- declarations: [MECXProductsComponent, MECXProductsFilterComponent],
2845
- imports: [CommonModule, TranslateModule.forChild(), MonkeyInputModule, MonkeyButtonModule],
2846
- exports: [MECXProductsComponent]
2847
- }]
2848
- }] });
2849
-
2850
- /*
2851
- * Public API Surface of monkey-front-components
2852
- */
2853
-
2854
- /**
2855
- * Generated bundle index. Do not edit.
2856
- */
2857
-
2858
- export { BaseComponent, BaseDynamic, BaseDynamicArray, BaseScrollComponent, MECXDynamicDirective, MECXDynamicFileUploadComponent, MECXDynamicFormArrayComponent, MECXDynamicFormComponent, MECXDynamicInputComponent, MECXDynamicInputPhoneComponent, MECXDynamicModule, MECXDynamicRadioComponent, MECXDynamicSelectComponent, MECXFilterComponent, MECXFilterModule, MECXPasswordStrengthComponent, MECXPasswordStrengthModule, MECXProductsComponent, MECXProductsModule, MECXProgressBarComponent, MECXProgressBarModule, MECXProgressBarService, validators };
2859
- //# sourceMappingURL=monkey-front-components.mjs.map