@wizishop/img-manager 0.2.108 → 14.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (300) hide show
  1. package/esm2020/lib/animations/easeInOut/ease-in-out.animation.mjs +12 -0
  2. package/esm2020/lib/animations/insertRemove/insert-remove.animation.mjs +9 -0
  3. package/esm2020/lib/animations/listAnnimation/list.animation.mjs +16 -0
  4. package/esm2020/lib/components/canva-btn/canva-btn.component.mjs +67 -0
  5. package/esm2020/lib/components/images-view/images-actions-handler.mjs +151 -0
  6. package/esm2020/lib/components/images-view/images-view.component.mjs +474 -0
  7. package/esm2020/lib/components/images-view/mosaic-view/img-card/img-card.component.mjs +66 -0
  8. package/esm2020/lib/components/images-view/mosaic-view/mosaic-view.component.mjs +68 -0
  9. package/esm2020/lib/components/images-view/table-view/table-view.component.mjs +48 -0
  10. package/esm2020/lib/components/img-editor/cropper/cropper.component.mjs +307 -0
  11. package/esm2020/lib/components/img-editor/img-editor.component.mjs +109 -0
  12. package/esm2020/lib/components/img-editor/info-section/info-section.component.mjs +54 -0
  13. package/esm2020/lib/components/img-selection/img-selection.component.mjs +59 -0
  14. package/esm2020/lib/components/img-tabs/img-tabs.component.mjs +122 -0
  15. package/esm2020/lib/components/img-upload/img-upload.component.mjs +118 -0
  16. package/esm2020/lib/components/loader/loader.component.mjs +21 -0
  17. package/esm2020/lib/components/pexels-lib/pexels-lib.component.mjs +200 -0
  18. package/esm2020/lib/components/shared/alert/alert.component.mjs +27 -0
  19. package/esm2020/lib/components/shared/checkbox/checkbox.component.mjs +52 -0
  20. package/esm2020/lib/components/shared/dropdown/dropdown.component.mjs +21 -0
  21. package/esm2020/lib/components/shared/input-search/input-search.component.mjs +54 -0
  22. package/esm2020/lib/components/shared/pagination/page-selector/page-selector.component.mjs +49 -0
  23. package/esm2020/lib/components/shared/pagination/pagination.component.mjs +49 -0
  24. package/esm2020/lib/components/shared/select/call-to-action.model.mjs +2 -0
  25. package/esm2020/lib/components/shared/select/select-items.dto.mjs +2 -0
  26. package/esm2020/lib/components/shared/select/select.component.mjs +110 -0
  27. package/esm2020/lib/components/shared/table/table.component.mjs +116 -0
  28. package/esm2020/lib/components/upload-list/upload-list.component.mjs +79 -0
  29. package/esm2020/lib/directives/abstract-debounce/abstract-debounce.directive.mjs +37 -0
  30. package/esm2020/lib/directives/abstract-debounce/debounce-keyup.directive.mjs +24 -0
  31. package/esm2020/lib/directives/auto-hide.directive.mjs +48 -0
  32. package/esm2020/lib/directives/copy-to-clipboard.directive.mjs +37 -0
  33. package/esm2020/lib/directives/drag-drop.directive.mjs +57 -0
  34. package/esm2020/lib/directives/loading.directive.mjs +42 -0
  35. package/esm2020/lib/directives/table/checkBoxRow.directive.mjs +114 -0
  36. package/esm2020/lib/directives/table/column.directive.mjs +45 -0
  37. package/esm2020/lib/directives/table/columnHeader.directive.mjs +204 -0
  38. package/esm2020/lib/directives/table/raw.directive.mjs +31 -0
  39. package/esm2020/lib/directives/zindex-toggle.directive.mjs +42 -0
  40. package/esm2020/lib/dto/ImgManagerDisplayConfig.dto.mjs +2 -0
  41. package/esm2020/lib/dto/canva-create-design.dto.mjs +4 -0
  42. package/esm2020/lib/dto/canva.dto.mjs +4 -0
  43. package/esm2020/lib/dto/config/apis/api.dto.mjs +9 -0
  44. package/esm2020/lib/dto/config/external/external-config.dto.mjs +3 -0
  45. package/esm2020/lib/dto/config/image-cdn/image-cdn-config.dto.mjs +10 -0
  46. package/esm2020/lib/dto/export-dtos.api.mjs +11 -0
  47. package/esm2020/lib/dto/img-editor-config.dto.mjs +2 -0
  48. package/esm2020/lib/dto/img-manager.dto.mjs +2 -0
  49. package/esm2020/lib/dto/pexels-img.dto.mjs +2 -0
  50. package/esm2020/lib/dto/picture-name-update.dto.mjs +2 -0
  51. package/esm2020/lib/dto/stateDisplayed.dto.mjs +2 -0
  52. package/esm2020/lib/dto/tabDisplayed.dto.mjs +2 -0
  53. package/esm2020/lib/dto/wizi-block-media.dto.mjs +3 -0
  54. package/esm2020/lib/pipes/images/img-src.pipe.mjs +28 -0
  55. package/esm2020/lib/pipes/number-to-array.pipe.mjs +16 -0
  56. package/esm2020/lib/pipes/pagination/array-total-pages/array-pages.pipe.mjs +28 -0
  57. package/esm2020/lib/pipes/pagination/large-number-of-page/large-number-of-page.pipe.mjs +53 -0
  58. package/esm2020/lib/pipes/pagination/text/custom-text.pipe.mjs +35 -0
  59. package/esm2020/lib/pipes/pagination/total-pages/is-last-page.pipe.mjs +25 -0
  60. package/esm2020/lib/pipes/select/select-filters.pipe.mjs +19 -0
  61. package/esm2020/lib/services/alert.service.mjs +53 -0
  62. package/esm2020/lib/services/canva.service.mjs +159 -0
  63. package/esm2020/lib/services/config/external-config.service.mjs +49 -0
  64. package/esm2020/lib/services/config/img-cdn.service.mjs +28 -0
  65. package/esm2020/lib/services/dom.service.mjs +36 -0
  66. package/{esm2015/lib/services/img-event.service.js → esm2020/lib/services/img-event.service.mjs} +11 -12
  67. package/esm2020/lib/services/img-manager.service.mjs +138 -0
  68. package/{esm2015/lib/services/img-selection.service.js → esm2020/lib/services/img-selection.service.mjs} +11 -12
  69. package/esm2020/lib/services/pexels.service.mjs +62 -0
  70. package/esm2020/lib/services/rename-picture.service.mjs +68 -0
  71. package/esm2020/lib/services/table/filters-table.service.mjs +63 -0
  72. package/{esm2015/lib/services/user-settings.service.js → esm2020/lib/services/user-settings.service.mjs} +11 -12
  73. package/esm2020/lib/wz-img-manager.component.mjs +186 -0
  74. package/esm2020/lib/wz-img-manager.module.mjs +193 -0
  75. package/esm2020/public-api.mjs +11 -0
  76. package/esm2020/wizishop-img-manager.mjs +5 -0
  77. package/fesm2015/wizishop-img-manager.mjs +4134 -0
  78. package/fesm2015/wizishop-img-manager.mjs.map +1 -0
  79. package/fesm2020/wizishop-img-manager.mjs +4140 -0
  80. package/fesm2020/wizishop-img-manager.mjs.map +1 -0
  81. package/index.d.ts +5 -0
  82. package/lib/components/canva-btn/canva-btn.component.d.ts +9 -6
  83. package/lib/components/images-view/images-actions-handler.d.ts +3 -0
  84. package/lib/components/images-view/images-view.component.d.ts +3 -0
  85. package/lib/components/images-view/mosaic-view/img-card/img-card.component.d.ts +3 -0
  86. package/lib/components/images-view/mosaic-view/mosaic-view.component.d.ts +3 -0
  87. package/lib/components/images-view/table-view/table-view.component.d.ts +3 -0
  88. package/lib/components/img-editor/cropper/cropper.component.d.ts +6 -3
  89. package/lib/components/img-editor/img-editor.component.d.ts +3 -0
  90. package/lib/components/img-editor/info-section/info-section.component.d.ts +3 -0
  91. package/lib/components/img-selection/img-selection.component.d.ts +3 -0
  92. package/lib/components/img-tabs/img-tabs.component.d.ts +3 -0
  93. package/lib/components/img-upload/img-upload.component.d.ts +4 -1
  94. package/lib/components/loader/loader.component.d.ts +3 -0
  95. package/lib/components/pexels-lib/pexels-lib.component.d.ts +3 -0
  96. package/lib/components/shared/alert/alert.component.d.ts +3 -0
  97. package/lib/components/shared/checkbox/checkbox.component.d.ts +3 -0
  98. package/lib/components/shared/dropdown/dropdown.component.d.ts +3 -0
  99. package/lib/components/shared/input-search/input-search.component.d.ts +3 -0
  100. package/lib/components/shared/pagination/page-selector/page-selector.component.d.ts +3 -0
  101. package/lib/components/shared/pagination/pagination.component.d.ts +3 -0
  102. package/lib/components/shared/select/select.component.d.ts +3 -0
  103. package/lib/components/shared/table/table.component.d.ts +3 -0
  104. package/lib/components/upload-list/upload-list.component.d.ts +3 -0
  105. package/lib/directives/abstract-debounce/abstract-debounce.directive.d.ts +3 -0
  106. package/lib/directives/abstract-debounce/debounce-keyup.directive.d.ts +3 -0
  107. package/lib/directives/auto-hide.directive.d.ts +3 -0
  108. package/lib/directives/copy-to-clipboard.directive.d.ts +3 -0
  109. package/lib/directives/drag-drop.directive.d.ts +3 -0
  110. package/lib/directives/loading.directive.d.ts +3 -0
  111. package/lib/directives/table/checkBoxRow.directive.d.ts +3 -0
  112. package/lib/directives/table/column.directive.d.ts +3 -0
  113. package/lib/directives/table/columnHeader.directive.d.ts +3 -0
  114. package/lib/directives/table/raw.directive.d.ts +3 -0
  115. package/lib/directives/zindex-toggle.directive.d.ts +3 -0
  116. package/lib/dto/pexels-img.dto.d.ts +1 -0
  117. package/lib/pipes/images/img-src.pipe.d.ts +3 -0
  118. package/lib/pipes/number-to-array.pipe.d.ts +3 -0
  119. package/lib/pipes/pagination/array-total-pages/array-pages.pipe.d.ts +3 -0
  120. package/lib/pipes/pagination/large-number-of-page/large-number-of-page.pipe.d.ts +7 -1
  121. package/lib/pipes/pagination/text/custom-text.pipe.d.ts +3 -0
  122. package/lib/pipes/pagination/total-pages/is-last-page.pipe.d.ts +3 -0
  123. package/lib/pipes/select/select-filters.pipe.d.ts +3 -0
  124. package/lib/services/alert.service.d.ts +3 -0
  125. package/lib/services/canva.service.d.ts +3 -0
  126. package/lib/services/config/external-config.service.d.ts +3 -0
  127. package/lib/services/config/img-cdn.service.d.ts +3 -0
  128. package/lib/services/dom.service.d.ts +3 -0
  129. package/lib/services/img-event.service.d.ts +3 -0
  130. package/lib/services/img-manager.service.d.ts +5 -2
  131. package/lib/services/img-selection.service.d.ts +3 -0
  132. package/lib/services/pexels.service.d.ts +7 -4
  133. package/lib/services/rename-picture.service.d.ts +3 -0
  134. package/lib/services/table/filters-table.service.d.ts +3 -0
  135. package/lib/services/user-settings.service.d.ts +3 -0
  136. package/lib/wz-img-manager.component.d.ts +3 -0
  137. package/lib/wz-img-manager.module.d.ts +56 -0
  138. package/package.json +47 -29
  139. package/wizishop-img-manager-14.0.0.tgz +0 -0
  140. package/wz-img-manager.scss +4 -404
  141. package/bundles/wizishop-img-manager.umd.js +0 -5077
  142. package/bundles/wizishop-img-manager.umd.js.map +0 -1
  143. package/bundles/wizishop-img-manager.umd.min.js +0 -16
  144. package/bundles/wizishop-img-manager.umd.min.js.map +0 -1
  145. package/esm2015/lib/animations/easeInOut/ease-in-out.animation.js +0 -12
  146. package/esm2015/lib/animations/insertRemove/insert-remove.animation.js +0 -9
  147. package/esm2015/lib/animations/listAnnimation/list.animation.js +0 -16
  148. package/esm2015/lib/components/canva-btn/canva-btn.component.js +0 -70
  149. package/esm2015/lib/components/images-view/images-actions-handler.js +0 -180
  150. package/esm2015/lib/components/images-view/images-view.component.js +0 -492
  151. package/esm2015/lib/components/images-view/mosaic-view/img-card/img-card.component.js +0 -84
  152. package/esm2015/lib/components/images-view/mosaic-view/mosaic-view.component.js +0 -79
  153. package/esm2015/lib/components/images-view/table-view/table-view.component.js +0 -49
  154. package/esm2015/lib/components/img-editor/cropper/cropper.component.js +0 -300
  155. package/esm2015/lib/components/img-editor/img-editor.component.js +0 -112
  156. package/esm2015/lib/components/img-editor/info-section/info-section.component.js +0 -59
  157. package/esm2015/lib/components/img-selection/img-selection.component.js +0 -62
  158. package/esm2015/lib/components/img-tabs/img-tabs.component.js +0 -131
  159. package/esm2015/lib/components/img-upload/img-upload.component.js +0 -125
  160. package/esm2015/lib/components/loader/loader.component.js +0 -28
  161. package/esm2015/lib/components/pexels-lib/pexels-lib.component.js +0 -208
  162. package/esm2015/lib/components/shared/alert/alert.component.js +0 -37
  163. package/esm2015/lib/components/shared/checkbox/checkbox.component.js +0 -69
  164. package/esm2015/lib/components/shared/dropdown/dropdown.component.js +0 -26
  165. package/esm2015/lib/components/shared/input-search/input-search.component.js +0 -62
  166. package/esm2015/lib/components/shared/pagination/page-selector/page-selector.component.js +0 -55
  167. package/esm2015/lib/components/shared/pagination/pagination.component.js +0 -51
  168. package/esm2015/lib/components/shared/select/call-to-action.model.js +0 -1
  169. package/esm2015/lib/components/shared/select/select-items.dto.js +0 -1
  170. package/esm2015/lib/components/shared/select/select.component.js +0 -133
  171. package/esm2015/lib/components/shared/table/table.component.js +0 -133
  172. package/esm2015/lib/components/upload-list/upload-list.component.js +0 -87
  173. package/esm2015/lib/directives/abstract-debounce/abstract-debounce.directive.js +0 -40
  174. package/esm2015/lib/directives/abstract-debounce/debounce-keyup.directive.js +0 -26
  175. package/esm2015/lib/directives/auto-hide.directive.js +0 -55
  176. package/esm2015/lib/directives/copy-to-clipboard.directive.js +0 -40
  177. package/esm2015/lib/directives/drag-drop.directive.js +0 -68
  178. package/esm2015/lib/directives/loading.directive.js +0 -44
  179. package/esm2015/lib/directives/table/checkBoxRow.directive.js +0 -128
  180. package/esm2015/lib/directives/table/column.directive.js +0 -49
  181. package/esm2015/lib/directives/table/columnHeader.directive.js +0 -221
  182. package/esm2015/lib/directives/table/raw.directive.js +0 -33
  183. package/esm2015/lib/directives/zindex-toggle.directive.js +0 -49
  184. package/esm2015/lib/dto/ImgManagerDisplayConfig.dto.js +0 -1
  185. package/esm2015/lib/dto/canva-create-design.dto.js +0 -4
  186. package/esm2015/lib/dto/canva.dto.js +0 -4
  187. package/esm2015/lib/dto/config/apis/api.dto.js +0 -9
  188. package/esm2015/lib/dto/config/external/external-config.dto.js +0 -3
  189. package/esm2015/lib/dto/config/image-cdn/image-cdn-config.dto.js +0 -10
  190. package/esm2015/lib/dto/export-dtos.api.js +0 -5
  191. package/esm2015/lib/dto/img-editor-config.dto.js +0 -1
  192. package/esm2015/lib/dto/img-manager.dto.js +0 -1
  193. package/esm2015/lib/dto/pexels-img.dto.js +0 -1
  194. package/esm2015/lib/dto/picture-name-update.dto.js +0 -1
  195. package/esm2015/lib/dto/stateDisplayed.dto.js +0 -1
  196. package/esm2015/lib/dto/tabDisplayed.dto.js +0 -1
  197. package/esm2015/lib/dto/wizi-block-media.dto.js +0 -3
  198. package/esm2015/lib/pipes/images/img-src.pipe.js +0 -29
  199. package/esm2015/lib/pipes/number-to-array.pipe.js +0 -14
  200. package/esm2015/lib/pipes/pagination/array-total-pages/array-pages.pipe.js +0 -26
  201. package/esm2015/lib/pipes/pagination/large-number-of-page/large-number-of-page.pipe.js +0 -51
  202. package/esm2015/lib/pipes/pagination/text/custom-text.pipe.js +0 -36
  203. package/esm2015/lib/pipes/pagination/total-pages/is-last-page.pipe.js +0 -23
  204. package/esm2015/lib/pipes/select/select-filters.pipe.js +0 -17
  205. package/esm2015/lib/services/alert.service.js +0 -59
  206. package/esm2015/lib/services/canva.service.js +0 -171
  207. package/esm2015/lib/services/config/external-config.service.js +0 -55
  208. package/esm2015/lib/services/config/img-cdn.service.js +0 -29
  209. package/esm2015/lib/services/dom.service.js +0 -36
  210. package/esm2015/lib/services/img-manager.service.js +0 -142
  211. package/esm2015/lib/services/pexels.service.js +0 -70
  212. package/esm2015/lib/services/rename-picture.service.js +0 -74
  213. package/esm2015/lib/services/table/filters-table.service.js +0 -67
  214. package/esm2015/lib/wz-img-manager.component.js +0 -212
  215. package/esm2015/lib/wz-img-manager.module.js +0 -132
  216. package/esm2015/public-api.js +0 -11
  217. package/esm2015/wizishop-img-manager.js +0 -57
  218. package/esm5/lib/animations/easeInOut/ease-in-out.animation.js +0 -12
  219. package/esm5/lib/animations/insertRemove/insert-remove.animation.js +0 -9
  220. package/esm5/lib/animations/listAnnimation/list.animation.js +0 -16
  221. package/esm5/lib/components/canva-btn/canva-btn.component.js +0 -72
  222. package/esm5/lib/components/images-view/images-actions-handler.js +0 -183
  223. package/esm5/lib/components/images-view/images-view.component.js +0 -535
  224. package/esm5/lib/components/images-view/mosaic-view/img-card/img-card.component.js +0 -87
  225. package/esm5/lib/components/images-view/mosaic-view/mosaic-view.component.js +0 -82
  226. package/esm5/lib/components/images-view/table-view/table-view.component.js +0 -52
  227. package/esm5/lib/components/img-editor/cropper/cropper.component.js +0 -312
  228. package/esm5/lib/components/img-editor/img-editor.component.js +0 -115
  229. package/esm5/lib/components/img-editor/info-section/info-section.component.js +0 -64
  230. package/esm5/lib/components/img-selection/img-selection.component.js +0 -64
  231. package/esm5/lib/components/img-tabs/img-tabs.component.js +0 -133
  232. package/esm5/lib/components/img-upload/img-upload.component.js +0 -138
  233. package/esm5/lib/components/loader/loader.component.js +0 -29
  234. package/esm5/lib/components/pexels-lib/pexels-lib.component.js +0 -216
  235. package/esm5/lib/components/shared/alert/alert.component.js +0 -38
  236. package/esm5/lib/components/shared/checkbox/checkbox.component.js +0 -71
  237. package/esm5/lib/components/shared/dropdown/dropdown.component.js +0 -27
  238. package/esm5/lib/components/shared/input-search/input-search.component.js +0 -68
  239. package/esm5/lib/components/shared/pagination/page-selector/page-selector.component.js +0 -64
  240. package/esm5/lib/components/shared/pagination/pagination.component.js +0 -56
  241. package/esm5/lib/components/shared/select/call-to-action.model.js +0 -1
  242. package/esm5/lib/components/shared/select/select-items.dto.js +0 -1
  243. package/esm5/lib/components/shared/select/select.component.js +0 -136
  244. package/esm5/lib/components/shared/table/table.component.js +0 -135
  245. package/esm5/lib/components/upload-list/upload-list.component.js +0 -103
  246. package/esm5/lib/directives/abstract-debounce/abstract-debounce.directive.js +0 -42
  247. package/esm5/lib/directives/abstract-debounce/debounce-keyup.directive.js +0 -28
  248. package/esm5/lib/directives/auto-hide.directive.js +0 -57
  249. package/esm5/lib/directives/copy-to-clipboard.directive.js +0 -42
  250. package/esm5/lib/directives/drag-drop.directive.js +0 -69
  251. package/esm5/lib/directives/loading.directive.js +0 -46
  252. package/esm5/lib/directives/table/checkBoxRow.directive.js +0 -137
  253. package/esm5/lib/directives/table/column.directive.js +0 -50
  254. package/esm5/lib/directives/table/columnHeader.directive.js +0 -229
  255. package/esm5/lib/directives/table/raw.directive.js +0 -34
  256. package/esm5/lib/directives/zindex-toggle.directive.js +0 -54
  257. package/esm5/lib/dto/ImgManagerDisplayConfig.dto.js +0 -1
  258. package/esm5/lib/dto/canva-create-design.dto.js +0 -8
  259. package/esm5/lib/dto/canva.dto.js +0 -8
  260. package/esm5/lib/dto/config/apis/api.dto.js +0 -11
  261. package/esm5/lib/dto/config/external/external-config.dto.js +0 -7
  262. package/esm5/lib/dto/config/image-cdn/image-cdn-config.dto.js +0 -12
  263. package/esm5/lib/dto/export-dtos.api.js +0 -5
  264. package/esm5/lib/dto/img-editor-config.dto.js +0 -1
  265. package/esm5/lib/dto/img-manager.dto.js +0 -1
  266. package/esm5/lib/dto/pexels-img.dto.js +0 -1
  267. package/esm5/lib/dto/picture-name-update.dto.js +0 -1
  268. package/esm5/lib/dto/stateDisplayed.dto.js +0 -1
  269. package/esm5/lib/dto/tabDisplayed.dto.js +0 -1
  270. package/esm5/lib/dto/wizi-block-media.dto.js +0 -7
  271. package/esm5/lib/pipes/images/img-src.pipe.js +0 -30
  272. package/esm5/lib/pipes/number-to-array.pipe.js +0 -17
  273. package/esm5/lib/pipes/pagination/array-total-pages/array-pages.pipe.js +0 -29
  274. package/esm5/lib/pipes/pagination/large-number-of-page/large-number-of-page.pipe.js +0 -54
  275. package/esm5/lib/pipes/pagination/text/custom-text.pipe.js +0 -37
  276. package/esm5/lib/pipes/pagination/total-pages/is-last-page.pipe.js +0 -26
  277. package/esm5/lib/pipes/select/select-filters.pipe.js +0 -20
  278. package/esm5/lib/services/alert.service.js +0 -62
  279. package/esm5/lib/services/canva.service.js +0 -181
  280. package/esm5/lib/services/config/external-config.service.js +0 -56
  281. package/esm5/lib/services/config/img-cdn.service.js +0 -34
  282. package/esm5/lib/services/dom.service.js +0 -39
  283. package/esm5/lib/services/img-event.service.js +0 -46
  284. package/esm5/lib/services/img-manager.service.js +0 -143
  285. package/esm5/lib/services/img-selection.service.js +0 -143
  286. package/esm5/lib/services/pexels.service.js +0 -72
  287. package/esm5/lib/services/rename-picture.service.js +0 -88
  288. package/esm5/lib/services/table/filters-table.service.js +0 -68
  289. package/esm5/lib/services/user-settings.service.js +0 -30
  290. package/esm5/lib/wz-img-manager.component.js +0 -228
  291. package/esm5/lib/wz-img-manager.module.js +0 -131
  292. package/esm5/public-api.js +0 -11
  293. package/esm5/wizishop-img-manager.js +0 -57
  294. package/fesm2015/wizishop-img-manager.js +0 -4533
  295. package/fesm2015/wizishop-img-manager.js.map +0 -1
  296. package/fesm5/wizishop-img-manager.js +0 -4814
  297. package/fesm5/wizishop-img-manager.js.map +0 -1
  298. package/wizishop-img-manager-0.2.108.tgz +0 -0
  299. package/wizishop-img-manager.d.ts +0 -56
  300. package/wizishop-img-manager.metadata.json +0 -1
@@ -1,4533 +0,0 @@
1
- import { __decorate, __metadata, __param } from 'tslib';
2
- import { ɵɵdefineInjectable, Injectable, ɵɵinject, EventEmitter, Input, Output, HostListener, Component, ViewChild, ElementRef, HostBinding, Directive, ViewEncapsulation, Pipe, ApplicationRef, Renderer2, Inject, ComponentFactoryResolver, Injector, NgModule } from '@angular/core';
3
- import { ReplaySubject, Observable, Subject, BehaviorSubject, forkJoin } from 'rxjs';
4
- import { HttpParams, HttpHeaders, HttpClient, HttpClientModule } from '@angular/common/http';
5
- import { TranslateService, TranslateModule } from '@ngx-translate/core';
6
- import { NwbAlertService, NwbFilterRoutingBuilder, NwbAllModule } from '@wizishop/ng-wizi-bulma';
7
- import { take, debounceTime, map, takeUntil, distinctUntilChanged, tap } from 'rxjs/operators';
8
- import { trigger, state, style, transition, animate, query, stagger } from '@angular/animations';
9
- import { Router } from '@angular/router';
10
- import { DOCUMENT, CommonModule } from '@angular/common';
11
- import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
12
- import { NgScrollbarModule } from 'ngx-scrollbar';
13
- import { NgScrollbarReachedModule } from 'ngx-scrollbar/reached-event';
14
- import { ImageCropperModule } from 'ngx-image-cropper';
15
- import { CdkTableModule } from '@angular/cdk/table';
16
- import { DragDropModule } from '@angular/cdk/drag-drop';
17
- import { v4 } from 'uuid';
18
- import { PerfectScrollbarModule } from 'ngx-perfect-scrollbar';
19
-
20
- let ImgSelectionService = class ImgSelectionService {
21
- constructor() {
22
- this.imgSelectedList = [];
23
- this.multipleImgMode = false;
24
- this.imgSelectionSubscriber = [];
25
- this.imgListLoading = new ReplaySubject();
26
- }
27
- getImgSelection() {
28
- return this.imgSelectedList;
29
- }
30
- // Use in img manager webelement, when the product img selection is retrieved
31
- setImgSelection(imgSelectedList) {
32
- this.imgSelectedList.length = 0; // Remove all the elements from the array and keep the reference
33
- if (imgSelectedList && imgSelectedList.length) {
34
- imgSelectedList.forEach(elem => this.imgSelectedList.push(elem));
35
- }
36
- this.emitImgSelectionChange();
37
- }
38
- addImgSelected(picture) {
39
- if (this.multipleImgMode) {
40
- this.imgSelectedList.push(picture);
41
- }
42
- else {
43
- this.imgSelectedList = [picture];
44
- }
45
- this.emitImgSelectionChange();
46
- }
47
- getImgSelectionChange() {
48
- const obsImgSelection = new Observable(subscriber => {
49
- this.imgSelectionSubscriber.push(subscriber);
50
- });
51
- return obsImgSelection;
52
- }
53
- emitImgSelectionChange() {
54
- this.imgSelectionSubscriber.map(obs => obs.next(JSON.parse(JSON.stringify(this.imgSelectedList))));
55
- }
56
- removeImgSelectedByIndex(index) {
57
- this.imgSelectedList.splice(index, 1);
58
- this.emitImgSelectionChange();
59
- }
60
- removeImgSelectedById(id_file) {
61
- if (!this.multipleImgMode) {
62
- this.imgSelectedList = [];
63
- return;
64
- }
65
- let index = 0;
66
- for (const img of this.imgSelectedList) {
67
- if (img.id_file === id_file) {
68
- this.removeImgSelectedByIndex(index);
69
- break;
70
- }
71
- index++;
72
- }
73
- }
74
- removeImgSelectionByIds(id_file_list) {
75
- if (!this.multipleImgMode) {
76
- this.imgSelectedList = [];
77
- return;
78
- }
79
- for (let index = this.imgSelectedList.length - 1; index > -1; index--) {
80
- const id_file = this.imgSelectedList[index].id_file;
81
- if (id_file_list.indexOf(id_file) !== -1) {
82
- this.removeImgSelectedByIndex(index);
83
- }
84
- }
85
- }
86
- removeAllImgSelected() {
87
- this.imgSelectedList.length = 0;
88
- this.emitImgSelectionChange();
89
- // Remove all the elements from the array and keep the reference
90
- }
91
- setMultipleImgMode(activated) {
92
- this.multipleImgMode = activated;
93
- }
94
- initImgSelectedList(imgSelectedList) {
95
- // Retrieve the imgSelectedList from parameter
96
- if (imgSelectedList) {
97
- this.imgSelectedList = imgSelectedList;
98
- return;
99
- }
100
- // Remove all elements from imgSelectedList
101
- if (this.imgSelectedList && this.imgSelectedList.length) {
102
- this.imgSelectedList.splice(0, this.imgSelectedList.length);
103
- return;
104
- }
105
- this.imgSelectedList = [];
106
- }
107
- /**
108
- * Use to display the loader on img selection list
109
- * @param loading
110
- */
111
- emitImgListLoading(loading) {
112
- this.imgListLoading.next(loading);
113
- }
114
- /**
115
- * Use to display the loader on img selection list
116
- * @param loading
117
- */
118
- getImgListLoadingEventListner() {
119
- return this.imgListLoading.asObservable();
120
- }
121
- /**
122
- * Use angular cdk function
123
- * Called by img selection component
124
- * @param event
125
- */
126
- moveImgOrder(event) {
127
- const fromIndex = event.previousIndex;
128
- const toIndex = event.currentIndex;
129
- this.imgSelectedList.splice(toIndex, 0, this.imgSelectedList.splice(fromIndex, 1)[0]);
130
- this.emitImgSelectionChange();
131
- }
132
- };
133
- ImgSelectionService.ɵprov = ɵɵdefineInjectable({ factory: function ImgSelectionService_Factory() { return new ImgSelectionService(); }, token: ImgSelectionService, providedIn: "root" });
134
- ImgSelectionService = __decorate([
135
- Injectable({
136
- providedIn: 'root'
137
- }),
138
- __metadata("design:paramtypes", [])
139
- ], ImgSelectionService);
140
-
141
- class ImgManagerConfigDto {
142
- }
143
-
144
- let ImgManagerService = class ImgManagerService {
145
- constructor(http) {
146
- this.http = http;
147
- this.params = new HttpParams().set("limit", "20").set("page", "1");
148
- // Display the img selection
149
- this.pageFicheProductConfig = {
150
- stateDisplayed: 'closed',
151
- multipleImgMode: true,
152
- showImgManagerModule: true,
153
- showSelection: true,
154
- displayBtn: true,
155
- pageficheProduct: true
156
- };
157
- this.angularFicheProductConfig = {
158
- stateDisplayed: 'closed',
159
- multipleImgMode: true,
160
- showImgManagerModule: true,
161
- showSelection: true,
162
- displayBtn: false,
163
- pageficheProduct: true
164
- };
165
- this.wiziblockConfig = {
166
- stateDisplayed: 'closed',
167
- multipleImgMode: false,
168
- showImgManagerModule: true,
169
- showSelection: false,
170
- displayBtn: false
171
- };
172
- this.simpleWithButtonOpenerConfig = {
173
- stateDisplayed: 'closed',
174
- multipleImgMode: false,
175
- showImgManagerModule: true,
176
- showSelection: false,
177
- displayBtn: true
178
- };
179
- this.fullWindowConfig = {
180
- stateDisplayed: 'window',
181
- multipleImgMode: false,
182
- showImgManagerModule: true,
183
- showSelection: false,
184
- displayBtn: false
185
- };
186
- }
187
- setApiConfig(img_manager_route, shop_token) {
188
- this.imgManagerRoute = img_manager_route;
189
- this.shopToken = shop_token;
190
- }
191
- getOptionsHeaders(params) {
192
- const header = { headers: new HttpHeaders({
193
- Authorization: 'Bearer ' + this.shopToken
194
- })
195
- };
196
- if (params) {
197
- this.getParams(params);
198
- header['params'] = this.params;
199
- }
200
- return header;
201
- }
202
- getShopImgList(params) {
203
- return this.http.get(`${this.imgManagerRoute}/images`, this.getOptionsHeaders(params));
204
- }
205
- getShopTotalImgList(params) {
206
- return this.http.get(`${this.imgManagerRoute}/total/image`, this.getOptionsHeaders(params));
207
- }
208
- getShopImg(idFile) {
209
- return this.http.get(`${this.imgManagerRoute}/images/${idFile}`, this.getOptionsHeaders());
210
- }
211
- getParams(params) {
212
- this.params = new HttpParams();
213
- this.params = this.params.set('id_file:sort', 'desc');
214
- for (const param in params) {
215
- this.params = this.params.set(param, params[param]);
216
- }
217
- }
218
- uploadFile(formData) {
219
- return this.http.post(`${this.imgManagerRoute}/images/template`, formData, this.getOptionsHeaders());
220
- }
221
- uploadFileByUrl(url, fileName) {
222
- const body = {
223
- url,
224
- fileName
225
- };
226
- return this.http.post(`${this.imgManagerRoute}/images/template`, { url, fileName }, this.getOptionsHeaders());
227
- }
228
- replaceImg(imageBase64, id_file) {
229
- const body = {
230
- imageBase64,
231
- type: "RAW"
232
- };
233
- return this.http.put(`${this.imgManagerRoute}/images/${id_file}/replace`, body, this.getOptionsHeaders());
234
- }
235
- changeImgName(fileName, id_file) {
236
- return this.http.put(`${this.imgManagerRoute}/images/${id_file}?file_name=${fileName}`, null, this.getOptionsHeaders());
237
- }
238
- removeImg(id_file) {
239
- return this.http.delete(`${this.imgManagerRoute}/images/${id_file}`, this.getOptionsHeaders());
240
- }
241
- removeMultipleImg(id_array) {
242
- return this.http.post(`${this.imgManagerRoute}/images-multiple-delete`, { id_array }, this.getOptionsHeaders());
243
- }
244
- getImgManagerDisplayConfig(displayName) {
245
- switch (displayName) {
246
- case "window":
247
- return this.fullWindowConfig;
248
- case "wizi-block":
249
- return this.wiziblockConfig;
250
- case "fiche-product":
251
- return this.pageFicheProductConfig;
252
- case "simple-with-button":
253
- return this.simpleWithButtonOpenerConfig;
254
- case 'angular-fiche-product':
255
- return this.angularFicheProductConfig;
256
- default:
257
- return;
258
- }
259
- }
260
- getAllImgManagerDisplayConfig() {
261
- return [
262
- this.fullWindowConfig,
263
- this.wiziblockConfig,
264
- this.pageFicheProductConfig,
265
- this.simpleWithButtonOpenerConfig,
266
- ];
267
- }
268
- };
269
- ImgManagerService.ctorParameters = () => [
270
- { type: HttpClient }
271
- ];
272
- ImgManagerService.ɵprov = ɵɵdefineInjectable({ factory: function ImgManagerService_Factory() { return new ImgManagerService(ɵɵinject(HttpClient)); }, token: ImgManagerService, providedIn: "root" });
273
- ImgManagerService = __decorate([
274
- Injectable({
275
- providedIn: 'root'
276
- }),
277
- __metadata("design:paramtypes", [HttpClient])
278
- ], ImgManagerService);
279
-
280
- let ImgCDNService = class ImgCDNService {
281
- constructor() {
282
- this.imgCDNConfig = null;
283
- }
284
- setImgCDNConfig(imgCDNConfig) {
285
- this.imgCDNConfig = imgCDNConfig;
286
- }
287
- getUrlImg(size) {
288
- const urlProperty = Object.keys(this.imgCDNConfig)
289
- .filter(url => new RegExp(size, 'i').test(url))[0];
290
- return this.imgCDNConfig[urlProperty];
291
- }
292
- getAllSize() {
293
- return Object.keys(this.imgCDNConfig)
294
- .map(elem => elem.match(/_(\w+)_/)[1]);
295
- }
296
- };
297
- ImgCDNService.ɵprov = ɵɵdefineInjectable({ factory: function ImgCDNService_Factory() { return new ImgCDNService(); }, token: ImgCDNService, providedIn: "root" });
298
- ImgCDNService = __decorate([
299
- Injectable({
300
- providedIn: 'root'
301
- }),
302
- __metadata("design:paramtypes", [])
303
- ], ImgCDNService);
304
-
305
- let ImgManagerConfigService = class ImgManagerConfigService {
306
- constructor(imgManagerService, imgCDNService) {
307
- this.imgManagerService = imgManagerService;
308
- this.imgCDNService = imgCDNService;
309
- }
310
- /**
311
- * Set imgManagerService and imgCDNService
312
- * Canva and Pexel service retrieve the externalConfig at their initialization
313
- * @param externalConfig
314
- */
315
- setExternalConfig(externalConfig) {
316
- this.externalConfig = externalConfig;
317
- this.imgManagerService.setApiConfig(externalConfig.api.image_manager_route, externalConfig.api.shop_token);
318
- this.imgCDNService.setImgCDNConfig(externalConfig.imgCDNConfig);
319
- }
320
- getCanvaApiURL() {
321
- return this.externalConfig.api.canva_url;
322
- }
323
- getCanvaApiToken() {
324
- return this.externalConfig.api.canva_token;
325
- }
326
- getRouteAssets() {
327
- return this.externalConfig.api.assets_route;
328
- }
329
- getPexelsApiURL() {
330
- return this.externalConfig.api.pexels_route;
331
- }
332
- getPexelsApiToken() {
333
- return this.externalConfig.api.pexels_token;
334
- }
335
- getShopCategory() {
336
- return this.externalConfig.api.shop_category;
337
- }
338
- };
339
- ImgManagerConfigService.ctorParameters = () => [
340
- { type: ImgManagerService },
341
- { type: ImgCDNService }
342
- ];
343
- ImgManagerConfigService.ɵprov = ɵɵdefineInjectable({ factory: function ImgManagerConfigService_Factory() { return new ImgManagerConfigService(ɵɵinject(ImgManagerService), ɵɵinject(ImgCDNService)); }, token: ImgManagerConfigService, providedIn: "root" });
344
- ImgManagerConfigService = __decorate([
345
- Injectable({
346
- providedIn: 'root'
347
- }),
348
- __metadata("design:paramtypes", [ImgManagerService,
349
- ImgCDNService])
350
- ], ImgManagerConfigService);
351
-
352
- let UserSettingsService = class UserSettingsService {
353
- constructor() {
354
- this.userdisplayPreference = 'WzImgManagerListDisplayed';
355
- }
356
- /**
357
- * true : display list
358
- * false : display mosaic
359
- * @param value
360
- */
361
- setUserDisplayPreference(value) {
362
- localStorage.setItem(this.userdisplayPreference, '' + value);
363
- }
364
- getUserDisplayPreference() {
365
- const value = localStorage.getItem(this.userdisplayPreference);
366
- return value == 'true';
367
- }
368
- };
369
- UserSettingsService.ɵprov = ɵɵdefineInjectable({ factory: function UserSettingsService_Factory() { return new UserSettingsService(); }, token: UserSettingsService, providedIn: "root" });
370
- UserSettingsService = __decorate([
371
- Injectable({
372
- providedIn: 'root'
373
- }),
374
- __metadata("design:paramtypes", [])
375
- ], UserSettingsService);
376
-
377
- let AlertService = class AlertService {
378
- constructor(nwbAlertService, translateService) {
379
- this.nwbAlertService = nwbAlertService;
380
- this.translateService = translateService;
381
- this.actionMsg = 'ImgManager.alert.action';
382
- this.alertConfig = {
383
- message: '',
384
- duration: 5000
385
- };
386
- }
387
- openAlert(msgKey) {
388
- this.closePreviousAlert();
389
- this.translateService.get(msgKey).subscribe(trans => {
390
- this.alertConfig.message = trans;
391
- this.setAlertColor(msgKey);
392
- this.alertRefComponent = this.nwbAlertService.open(this.alertConfig);
393
- this.alertRefComponent.afterClosed().subscribe();
394
- });
395
- }
396
- openAlertWithBackendRespons(msgKey, msgBackend) {
397
- this.translateService.get(msgKey).subscribe(trans => {
398
- this.alertConfig.message = trans;
399
- this.alertConfig.message += '<br/>' + JSON.parse(msgBackend).message;
400
- this.closePreviousAlert();
401
- this.alertRefComponent = this.nwbAlertService.open(this.alertConfig);
402
- this.alertRefComponent.afterClosed().subscribe();
403
- });
404
- }
405
- closePreviousAlert() {
406
- if (this.alertRefComponent) {
407
- this.alertRefComponent.dismiss();
408
- }
409
- }
410
- setAlertColor(msgKey) {
411
- const isErrorMsg = /error/i.test(msgKey);
412
- this.alertConfig.color = isErrorMsg ? 'is-danger' : 'is-success';
413
- }
414
- };
415
- AlertService.ctorParameters = () => [
416
- { type: NwbAlertService },
417
- { type: TranslateService }
418
- ];
419
- AlertService.ɵprov = ɵɵdefineInjectable({ factory: function AlertService_Factory() { return new AlertService(ɵɵinject(NwbAlertService), ɵɵinject(TranslateService)); }, token: AlertService, providedIn: "root" });
420
- AlertService = __decorate([
421
- Injectable({
422
- providedIn: 'root'
423
- }),
424
- __metadata("design:paramtypes", [NwbAlertService,
425
- TranslateService])
426
- ], AlertService);
427
-
428
- let ImgEventService = class ImgEventService {
429
- constructor() {
430
- this.imgToEditEvent = new Subject();
431
- this.imgRemoved = new Subject();
432
- this.imgAdded = new Subject();
433
- this.listDisplayedChange = new Subject();
434
- }
435
- emitImgRemoved(id_file) {
436
- this.imgRemoved.next(id_file);
437
- }
438
- getImgRemovedEventListner() {
439
- return this.imgRemoved.asObservable();
440
- }
441
- emitImgToEdit(imgToEdit) {
442
- this.imgToEditEvent.next(imgToEdit);
443
- }
444
- getImgToEditEventListner() {
445
- return this.imgToEditEvent.asObservable();
446
- }
447
- emitImgAdded(id_file) {
448
- this.imgAdded.next(id_file);
449
- }
450
- getImgAddedEventListner() {
451
- return this.imgAdded.asObservable();
452
- }
453
- emitlistDisplayedChange(value) {
454
- this.listDisplayedChange.next(value);
455
- }
456
- getlistDisplayedChange() {
457
- return this.listDisplayedChange.asObservable();
458
- }
459
- };
460
- ImgEventService.ɵprov = ɵɵdefineInjectable({ factory: function ImgEventService_Factory() { return new ImgEventService(); }, token: ImgEventService, providedIn: "root" });
461
- ImgEventService = __decorate([
462
- Injectable({
463
- providedIn: 'root'
464
- }),
465
- __metadata("design:paramtypes", [])
466
- ], ImgEventService);
467
-
468
- let CanvaService = class CanvaService {
469
- constructor(externalConfigService, imgManager, wzImgEventService, alertService, translateService) {
470
- this.externalConfigService = externalConfigService;
471
- this.imgManager = imgManager;
472
- this.wzImgEventService = wzImgEventService;
473
- this.alertService = alertService;
474
- this.translateService = translateService;
475
- this.imgLoading = false;
476
- this.uploadingImg = 'ImgManager.CanvaBtn.uploadingImg';
477
- this.successUploadPhoto = 'ImgManager.CanvaBtn.successImport';
478
- this.errorUploadCanvaImg = 'ImgManager.CanvaBtn.errorUploadCanvaImg';
479
- this.errorRenameCanvaImg = 'ImgManager.CanvaBtn.errorRenameCanvaImg';
480
- this.forceToOpenCanva = false;
481
- this.bindExpectedImgSizeEvent = new BehaviorSubject(null);
482
- this.bindExpectedSizeDone = this.bindExpectedImgSizeEvent.asObservable();
483
- }
484
- setCanvaApiConfig() {
485
- this.canvaApiURL = this.externalConfigService.getCanvaApiURL();
486
- this.canvaApiKey = this.externalConfigService.getCanvaApiToken();
487
- }
488
- getCanvaLogo() {
489
- return this.externalConfigService.getRouteAssets() + "canva/icon_canva.svg";
490
- }
491
- bindEventExepectedImgSizeChange() {
492
- return this.bindExpectedSizeDone;
493
- }
494
- expectedImgSizesChange(mediaDTO) {
495
- this.bindExpectedImgSizeEvent.next(mediaDTO);
496
- if (this.forceToOpenCanva) {
497
- this.openCanva(parseInt(mediaDTO.image_width), parseInt(mediaDTO.image_height));
498
- }
499
- }
500
- getCanvaApi() {
501
- if (!this.canvaApiURL || !this.canvaApiKey) {
502
- this.setCanvaApiConfig();
503
- }
504
- return new Observable(observer => {
505
- this.loadCanva().subscribe({
506
- complete: () => {
507
- if (this.canvaApi && Canva.DesignButton) {
508
- observer.next(this.canvaApi);
509
- observer.complete();
510
- }
511
- else {
512
- this.initializeCanva(observer);
513
- }
514
- }
515
- });
516
- });
517
- }
518
- initializeCanva(observer) {
519
- if (Canva.DesignButton) {
520
- Canva.DesignButton.initialize({
521
- apiKey: this.canvaApiKey
522
- }).then((canvaApi) => {
523
- this.canvaApi = canvaApi;
524
- observer.next(this.canvaApi);
525
- observer.complete();
526
- });
527
- }
528
- }
529
- loadCanva() {
530
- return new Observable(observer => {
531
- if (this.canvaApi) {
532
- observer.complete();
533
- }
534
- else {
535
- this.loadCanvaScript(observer);
536
- }
537
- });
538
- }
539
- loadCanvaScript(observer) {
540
- const node = document.createElement('script');
541
- node.src = this.canvaApiURL;
542
- node.type = 'text/javascript';
543
- node.async = false;
544
- node.charset = 'utf-8';
545
- node.onload = () => {
546
- observer.complete();
547
- };
548
- document.getElementsByTagName('head')[0].appendChild(node);
549
- }
550
- openCanva(width, height) {
551
- if (this.imgLoading) {
552
- return;
553
- }
554
- this.getCanvaApi().pipe(take(1)).subscribe((api) => {
555
- this.canvaApi = api;
556
- this.addOverflowBody();
557
- this.createDesign(width, height);
558
- });
559
- }
560
- addOverflowBody() {
561
- document.body.classList.add('ovh-canva');
562
- }
563
- removeOverflowBody() {
564
- document.body.classList.remove('ovh-canva');
565
- }
566
- createDesign(width, height) {
567
- const createDesign = {
568
- type: 'EtsyShopIcon',
569
- dimensions: {
570
- units: 'px',
571
- width: width ? width : undefined,
572
- height: height ? height : undefined,
573
- },
574
- publishLabel: this.translateService.instant('ImgManager.CanvaBtn.publish'),
575
- };
576
- this.canvaApi.createDesign({
577
- design: createDesign,
578
- onDesignPublish: ({ exportUrl, designTitle }) => this.designPublished(exportUrl, designTitle),
579
- onDesignClose: () => {
580
- this.removeOverflowBody();
581
- }
582
- });
583
- }
584
- designPublished(exportUrl, designTitle) {
585
- this.alertService.openAlert(this.uploadingImg);
586
- this.imgLoading = true;
587
- this.imgManager.uploadFileByUrl(exportUrl, designTitle).pipe(take(1)).subscribe((img) => {
588
- this.imgLoading = false;
589
- this.removeOverflowBody();
590
- this.wzImgEventService.emitImgAdded(img.id_file);
591
- this.alertService.openAlert(this.successUploadPhoto);
592
- }, error => {
593
- this.imgLoading = false;
594
- this.removeOverflowBody();
595
- if (error.error.code === 406 && error.error.message) {
596
- this.alertService.openAlertWithBackendRespons(this.errorUploadCanvaImg, error.error.message);
597
- }
598
- else {
599
- this.alertService.openAlert(this.errorUploadCanvaImg);
600
- }
601
- });
602
- }
603
- };
604
- CanvaService.ctorParameters = () => [
605
- { type: ImgManagerConfigService },
606
- { type: ImgManagerService },
607
- { type: ImgEventService },
608
- { type: AlertService },
609
- { type: TranslateService }
610
- ];
611
- CanvaService.ɵprov = ɵɵdefineInjectable({ factory: function CanvaService_Factory() { return new CanvaService(ɵɵinject(ImgManagerConfigService), ɵɵinject(ImgManagerService), ɵɵinject(ImgEventService), ɵɵinject(AlertService), ɵɵinject(TranslateService)); }, token: CanvaService, providedIn: "root" });
612
- CanvaService = __decorate([
613
- Injectable({
614
- providedIn: 'root'
615
- }),
616
- __metadata("design:paramtypes", [ImgManagerConfigService,
617
- ImgManagerService,
618
- ImgEventService,
619
- AlertService,
620
- TranslateService])
621
- ], CanvaService);
622
-
623
- let DomService = class DomService {
624
- constructor() {
625
- this.documentEventSource = new Subject();
626
- this.documentEventDone = this.documentEventSource.asObservable();
627
- this.documentScrollSource = new Subject();
628
- this.documentScrollDone = this.documentScrollSource.asObservable();
629
- }
630
- documentEvent() {
631
- return this.documentEventDone;
632
- }
633
- setDocumentEventListener() {
634
- document.body.addEventListener('click', event => {
635
- this.documentEventSource.next(event.target);
636
- });
637
- }
638
- documentScroll() {
639
- return this.documentScrollDone;
640
- }
641
- setScrollEventListener() {
642
- window.onscroll = () => {
643
- this.documentScrollSource.next(window);
644
- };
645
- }
646
- };
647
- DomService.ɵprov = ɵɵdefineInjectable({ factory: function DomService_Factory() { return new DomService(); }, token: DomService, providedIn: "root" });
648
- DomService = __decorate([
649
- Injectable({
650
- providedIn: 'root'
651
- })
652
- ], DomService);
653
-
654
- let WzImgManagerComponent = class WzImgManagerComponent {
655
- constructor(imgSelectionService, externalConfigService, userSettingsService, canvaService, imgEventService, domService) {
656
- this.imgSelectionService = imgSelectionService;
657
- this.externalConfigService = externalConfigService;
658
- this.userSettingsService = userSettingsService;
659
- this.canvaService = canvaService;
660
- this.imgEventService = imgEventService;
661
- this.domService = domService;
662
- this.showSelection = false;
663
- this.imgManagerClosed = new EventEmitter();
664
- this._multipleImgMode = false;
665
- this._showImgManagerModule = false;
666
- this.close = false;
667
- this.listDisplayed = false;
668
- this.hideTab = false;
669
- }
670
- // If forceToOpenCanva is true : Canva will open with the canvaService.expectedImgSizesChange
671
- // If forceToOpenCanva is a WiziBlockMediaDto, Canva open immediatly
672
- set forceToOpenCanva(forceToOpenCanva) {
673
- this.canvaService.forceToOpenCanva = !!forceToOpenCanva;
674
- if (typeof forceToOpenCanva === 'boolean') {
675
- return;
676
- }
677
- this.canvaService.expectedImgSizesChange(forceToOpenCanva);
678
- }
679
- set multipleImgMode(activate) {
680
- this._multipleImgMode = activate;
681
- this.imgSelectionService.setMultipleImgMode(this._multipleImgMode);
682
- }
683
- get multipleImgMode() {
684
- return this._multipleImgMode;
685
- }
686
- set showImgManagerModule(activate) {
687
- this._showImgManagerModule = activate;
688
- if (activate) {
689
- this.displaySmall();
690
- }
691
- }
692
- get showImgManagerModule() {
693
- return this._multipleImgMode;
694
- }
695
- onKeydownHandler(event) {
696
- if (this.stateDisplayed && this.stateDisplayed !== 'window') {
697
- this.onClose();
698
- }
699
- }
700
- ngOnInit() {
701
- this.externalConfigService.setExternalConfig(this.externalConfig);
702
- this.imgSelectionService.setMultipleImgMode(this._multipleImgMode);
703
- this.imgSelectionService.initImgSelectedList(null);
704
- this.selectImgEvent = this.imgSelectionService.getImgSelectionChange().subscribe(imgSlection => {
705
- if (imgSlection && imgSlection.length && this.checkCloseImgManager()) {
706
- // Close the img manager
707
- this.onClose();
708
- }
709
- });
710
- this.checkUserDisplayPreference();
711
- // Use when the img manager is full open or open in page. This display the user preference display, mosaic or list.
712
- this.listDisplayedEvent = this.imgEventService.getlistDisplayedChange().subscribe(value => this.listDisplayed = value);
713
- // Register dom service to listen on all event on the body to avoid having multiple instance of the same thing every where
714
- this.domService.setDocumentEventListener();
715
- }
716
- checkUserDisplayPreference() {
717
- if (this.stateDisplayed === 'window' || this.stateDisplayed === 'full') {
718
- this.listDisplayed = this.userSettingsService.getUserDisplayPreference();
719
- }
720
- }
721
- setCurrentTab(event) {
722
- if (event === 'img-edition') {
723
- this.hideTab = true;
724
- return;
725
- }
726
- this.hideTab = false;
727
- }
728
- displaySmall() {
729
- if (this.stateDisplayed !== 'window') {
730
- setTimeout(() => {
731
- this.stateDisplayed = 'small';
732
- this.addBodyBottomPaddingForModule();
733
- }, 10);
734
- }
735
- }
736
- openSmall() {
737
- this.stateDisplayed = 'small';
738
- this.setBodyMainScroll();
739
- this.listDisplayed = false;
740
- }
741
- openFull() {
742
- this.stateDisplayed = 'full';
743
- this.checkUserDisplayPreference();
744
- this.hideBodyMainScroll();
745
- }
746
- onClose() {
747
- this.stateDisplayed = 'closed';
748
- this.hideTab = false;
749
- this.setBodyMainScroll();
750
- this.removeBodyBottomPaddingForModule();
751
- // Wait the end of the closing annimation
752
- setTimeout(() => {
753
- this.imgManagerClosed.emit();
754
- }, 250);
755
- }
756
- onImgManagerClosed() {
757
- this.onClose();
758
- }
759
- /**
760
- * Close the img manager after one img is selected, if not in multiple img to select
761
- */
762
- checkCloseImgManager() {
763
- return !this.multipleImgMode && this.stateDisplayed !== 'window' ? true : false;
764
- }
765
- hideBodyMainScroll() {
766
- const html = document.getElementsByTagName('html')[0];
767
- if (!this.overflowHTML) {
768
- this.overflowHTML = html.style.overflowY;
769
- }
770
- html.style.overflowY = "hidden";
771
- }
772
- setBodyMainScroll() {
773
- const html = document.getElementsByTagName('html')[0];
774
- html.style.overflowY = this.overflowHTML ? this.overflowHTML : "scroll";
775
- }
776
- addBodyBottomPaddingForModule() {
777
- const body = document.getElementsByTagName('body')[0];
778
- this.bodyPadding = this.bodyPadding ? parseInt(body.style.paddingBottom) : 0;
779
- body.style.paddingBottom = this.bodyPadding + 300 + 'px';
780
- }
781
- removeBodyBottomPaddingForModule() {
782
- if (typeof this.bodyPadding !== 'undefined') {
783
- const body = document.getElementsByTagName('body')[0];
784
- body.style.paddingBottom = this.bodyPadding + 'px';
785
- this.bodyPadding = 0;
786
- }
787
- }
788
- changeDisplayTab() {
789
- this.stateDisplayed = 'full';
790
- }
791
- ngOnDestroy() {
792
- this.selectImgEvent.unsubscribe();
793
- this.canvaService.expectedImgSizesChange(null);
794
- this.listDisplayedEvent.unsubscribe();
795
- }
796
- };
797
- WzImgManagerComponent.ctorParameters = () => [
798
- { type: ImgSelectionService },
799
- { type: ImgManagerConfigService },
800
- { type: UserSettingsService },
801
- { type: CanvaService },
802
- { type: ImgEventService },
803
- { type: DomService }
804
- ];
805
- __decorate([
806
- Input(),
807
- __metadata("design:type", String)
808
- ], WzImgManagerComponent.prototype, "stateDisplayed", void 0);
809
- __decorate([
810
- Input(),
811
- __metadata("design:type", Boolean)
812
- ], WzImgManagerComponent.prototype, "showSelection", void 0);
813
- __decorate([
814
- Input(),
815
- __metadata("design:type", ImgManagerConfigDto)
816
- ], WzImgManagerComponent.prototype, "externalConfig", void 0);
817
- __decorate([
818
- Input(),
819
- __metadata("design:type", Object),
820
- __metadata("design:paramtypes", [Object])
821
- ], WzImgManagerComponent.prototype, "forceToOpenCanva", null);
822
- __decorate([
823
- Output(),
824
- __metadata("design:type", Object)
825
- ], WzImgManagerComponent.prototype, "imgManagerClosed", void 0);
826
- __decorate([
827
- Input(),
828
- __metadata("design:type", Boolean),
829
- __metadata("design:paramtypes", [Boolean])
830
- ], WzImgManagerComponent.prototype, "multipleImgMode", null);
831
- __decorate([
832
- Input(),
833
- __metadata("design:type", Boolean),
834
- __metadata("design:paramtypes", [Boolean])
835
- ], WzImgManagerComponent.prototype, "showImgManagerModule", null);
836
- __decorate([
837
- HostListener('document:keydown.escape', ['$event']),
838
- __metadata("design:type", Function),
839
- __metadata("design:paramtypes", [KeyboardEvent]),
840
- __metadata("design:returntype", void 0)
841
- ], WzImgManagerComponent.prototype, "onKeydownHandler", null);
842
- WzImgManagerComponent = __decorate([
843
- Component({
844
- selector: 'wz-img-manager',
845
- template: "<div class=\"wz-img-manager\">\n <!-- Img slection handler -->\n <div class=\"wz-img-manager__selectionHandler\" *ngIf=\"showSelection\">\n <img-selection></img-selection>\n </div>\n\n <!-- Img manager module -->\n <div\n *ngIf=\"_showImgManagerModule\"\n class=\"wz-img-manager__module\"\n [ngClass]=\"{\n 'wz-img-manager__module--small': stateDisplayed === 'small',\n 'wz-img-manager__module--full': stateDisplayed === 'full',\n 'wz-img-manager__module--window': stateDisplayed === 'window',\n 'wz-img-manager__module--edit': hideTab}\"\n >\n\n <div class=\"wz-img-manager__module__header\" *ngIf=\"stateDisplayed !== 'window'\">\n <button (click)=\"openSmall()\" *ngIf=\"stateDisplayed === 'full'\"><span>Expand</span><i class=\"fal fa-compress-alt\"></i></button>\n <button (click)=\"openSmall()\" *ngIf=\"stateDisplayed === 'closed'\"><span>Expand</span><i class=\"fal fa-expand-alt\"></i></button>\n <button (click)=\"openFull()\" *ngIf=\"stateDisplayed === 'small'\"><span>Expand</span><i class=\"fal fa-expand-alt\"></i></button>\n <button (click)=\"onClose()\" *ngIf=\"stateDisplayed !== 'closed'\"><span>Close</span><i class=\"fal fa-times\"></i></button>\n </div>\n\n <div\n class=\"wz-img-manager__module__content wz-block\"\n [ngClass]=\"{'wz-block--window': stateDisplayed === 'window'}\">\n <img-tabs\n [stateDisplayed]=\"stateDisplayed\"\n [multipleImgMode]=\"multipleImgMode\"\n [listDisplayed]=\"listDisplayed\"\n (imgManagerClosed)=\"onImgManagerClosed()\"\n (switchDisplayWindow)=\"changeDisplayTab()\"\n (currentTab)=\"setCurrentTab($event)\">\n </img-tabs>\n </div>\n </div>\n\n</div>\n"
846
- }),
847
- __metadata("design:paramtypes", [ImgSelectionService,
848
- ImgManagerConfigService,
849
- UserSettingsService,
850
- CanvaService,
851
- ImgEventService,
852
- DomService])
853
- ], WzImgManagerComponent);
854
-
855
- const easeInOut = // the fade-in/fade-out animation.
856
- trigger('easeInOut', [
857
- // the "in" style determines the "resting" state of the element when it is visible.
858
- state('in', style({ opacity: 1 })),
859
- // fade in when created. this could also be written as transition('void => *')
860
- transition(':enter', [
861
- style({ opacity: 0 }),
862
- animate('0.5s ease-in-out')
863
- ]),
864
- ]);
865
-
866
- let ImgUploadComponent = class ImgUploadComponent {
867
- constructor(imgManager, alertService, externalConfigService) {
868
- this.imgManager = imgManager;
869
- this.alertService = alertService;
870
- this.externalConfigService = externalConfigService;
871
- this.files = [];
872
- this.isLoading = false;
873
- this.imgUploaded = new EventEmitter();
874
- this.loadingText = 'ImgManager.ImgUpload.loading';
875
- this.errorUploadingImg = 'ImgManager.ImgUpload.errorUploadingImg';
876
- this.errorNotImg = 'ImgManager.ImgUpload.errorNotImg';
877
- this.MAX_IMAGE_SIZE = 10000000; // In bytes
878
- }
879
- ngOnInit() {
880
- this.assetsIcon = this.getAssets();
881
- }
882
- filesChangeByClick(event) {
883
- this.uploadFile(event.target.files);
884
- }
885
- getAssets() {
886
- return this.externalConfigService.getRouteAssets() + "img/icon_picture.svg";
887
- }
888
- filesChangeByDragAndDrop(filesList) {
889
- this.removeDragAndDropStyle();
890
- this.uploadFile(filesList);
891
- }
892
- uploadFile(files) {
893
- if (files && !files.length) {
894
- return;
895
- }
896
- this.isLoading = true;
897
- const imgToUploadList = [];
898
- for (const file of files) {
899
- console.log('file', file.size);
900
- if (!this.isFileImage(file.type)) {
901
- this.alertService.openAlert(this.errorNotImg);
902
- this.isLoading = false;
903
- continue;
904
- }
905
- if (!this.isSizeValid(file.size)) {
906
- this.alertService.openAlert(`L'image : ${file.name} est trop grande (${this.getImageSizeInKo(file.size)}ko). Taille maximum acceptée: ${this.getImageSizeInKo(this.MAX_IMAGE_SIZE)}ko`);
907
- this.isLoading = false;
908
- continue;
909
- }
910
- const formData = new FormData();
911
- formData.append('image', file, file.name);
912
- imgToUploadList.push(this.imgManager.uploadFile(formData));
913
- }
914
- forkJoin(imgToUploadList).subscribe((img) => {
915
- this.onImgUpload(img),
916
- this.isLoading = false;
917
- }, error => {
918
- var _a, _b;
919
- if (((_b = (_a = error) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.message) && error.statusText !== 'Bad Request') {
920
- this.alertService.openAlertWithBackendRespons(this.errorUploadingImg, error.error.message);
921
- }
922
- else {
923
- this.alertService.openAlert(this.errorUploadingImg);
924
- }
925
- this.isLoading = false;
926
- });
927
- }
928
- /**
929
- * Send the img uploaded to the tabs components,
930
- * Then the tabs components add the img to upload list by calling the method onImgUploaded of the upload-list component
931
- * @param img
932
- */
933
- onImgUpload(img) {
934
- this.imgUploaded.emit(img);
935
- }
936
- isFileImage(fileType) {
937
- return fileType.split('/')[0] === 'image';
938
- }
939
- isSizeValid(imageBytesSize) {
940
- return imageBytesSize < this.MAX_IMAGE_SIZE;
941
- }
942
- getImageSizeInKo(size) {
943
- return Math.round(size / 1024);
944
- }
945
- /**
946
- * Remove the style of the drag and drop box
947
- * After an img is droped, the box is still grey
948
- */
949
- removeDragAndDropStyle() {
950
- this.dragAndDropBox.nativeElement.style = '';
951
- }
952
- };
953
- ImgUploadComponent.ctorParameters = () => [
954
- { type: ImgManagerService },
955
- { type: AlertService },
956
- { type: ImgManagerConfigService }
957
- ];
958
- __decorate([
959
- Input(),
960
- __metadata("design:type", String)
961
- ], ImgUploadComponent.prototype, "stateDisplayed", void 0);
962
- __decorate([
963
- Output(),
964
- __metadata("design:type", Object)
965
- ], ImgUploadComponent.prototype, "imgUploaded", void 0);
966
- __decorate([
967
- ViewChild('dragAndDropBox'),
968
- __metadata("design:type", ElementRef)
969
- ], ImgUploadComponent.prototype, "dragAndDropBox", void 0);
970
- ImgUploadComponent = __decorate([
971
- Component({
972
- selector: 'img-upload',
973
- template: "<div\n class=\"img-upload has-text-centered\"\n [ngClass]=\"{'img-upload--small': stateDisplayed === 'small'}\"\n (click)=\"fileInput.click()\"\n appDragDrop\n (onFileDropped)=\"filesChangeByDragAndDrop($event)\"\n #dragAndDropBox\n [@easeInOut]=\"'in'\"\n>\n <input hidden type=\"file\" #fileInput (change)=\"filesChangeByClick($event)\" accept=\"image/*\" multiple >\n <div class=\"img-upload__container\" [ngClass]=\"{'img-upload__container--small': stateDisplayed === 'small'}\">\n\n <div class=\"img-upload__container__wrapper\">\n\n <div class=\"img-upload__container__loader\" *ngIf=\"isLoading\">\n <wz-loader [small]=\"true\" [position]=\"'relative'\"></wz-loader>\n </div>\n\n <ng-container *ngIf=\"!isLoading\">\n <div class=\"blueColor img-upload__container__dropImgIconDiv\">\n <img *ngIf=\"assetsIcon\" [src]=\"assetsIcon\" alt=\"icon picture\" />\n <p>{{ 'ImgManager.ImgUpload.dropImg' | translate }}</p>\n </div>\n\n <p class=\"img-upload__container__or\">{{ 'ImgManager.ImgUpload.or' | translate }}</p>\n\n <div class=\"img-upload__container__text\">\n <i class=\"fal fa-file-upload\"></i>{{ 'ImgManager.ImgUpload.selectImg' | translate }}\n </div>\n </ng-container>\n\n </div>\n </div>\n</div>\n",
974
- animations: [
975
- easeInOut
976
- ]
977
- }),
978
- __metadata("design:paramtypes", [ImgManagerService,
979
- AlertService,
980
- ImgManagerConfigService])
981
- ], ImgUploadComponent);
982
-
983
- let RenamePictureService = class RenamePictureService {
984
- constructor(imgManager, alertService) {
985
- this.imgManager = imgManager;
986
- this.alertService = alertService;
987
- this.picturesList = [];
988
- this.pictureNameChanged = new Subject();
989
- this.errorRenameImg = 'ImgManager.ImgList.errorRenameImg';
990
- this.msgSavingImgName = 'ImgManager.ImgLib.savingImgName';
991
- this.msgImgNameSaved = 'ImgManager.ImgLib.imgNameSaved';
992
- this.setEvents();
993
- }
994
- setPicturesList(picturesList) {
995
- this.picturesList = picturesList;
996
- }
997
- onRenamePicture(pictureRenamed) {
998
- this.pictureNameChanged.next(pictureRenamed);
999
- }
1000
- setEvents() {
1001
- this.pictureNameChanged
1002
- .pipe(debounceTime(800)) // wait 0.8 sec after the last event before emitting last event
1003
- .subscribe((pictureNameUpdate) => {
1004
- this.renamePicture(pictureNameUpdate);
1005
- });
1006
- }
1007
- renamePicture(pictureNameUpdate) {
1008
- const picture = this.getPictureById(pictureNameUpdate.id);
1009
- if (!picture) {
1010
- this.alertService.openAlert(this.errorRenameImg);
1011
- return;
1012
- }
1013
- this.alertService.openAlert(this.msgSavingImgName);
1014
- this.imgManager
1015
- .changeImgName(picture.display_name, picture.id_file)
1016
- .subscribe((data) => {
1017
- picture.display_name = data.display_name;
1018
- this.alertService.openAlert(this.msgImgNameSaved);
1019
- }, (error) => {
1020
- picture.display_name = pictureNameUpdate.previousName;
1021
- this.alertService.openAlert(this.errorRenameImg);
1022
- });
1023
- }
1024
- getPictureById(id_file) {
1025
- if (!this.picturesList) {
1026
- return;
1027
- }
1028
- for (const picture of this.picturesList) {
1029
- if (picture.id_file === id_file) {
1030
- return picture;
1031
- }
1032
- }
1033
- return null;
1034
- }
1035
- };
1036
- RenamePictureService.ctorParameters = () => [
1037
- { type: ImgManagerService },
1038
- { type: AlertService }
1039
- ];
1040
- RenamePictureService.ɵprov = ɵɵdefineInjectable({ factory: function RenamePictureService_Factory() { return new RenamePictureService(ɵɵinject(ImgManagerService), ɵɵinject(AlertService)); }, token: RenamePictureService, providedIn: "root" });
1041
- RenamePictureService = __decorate([
1042
- Injectable({ providedIn: 'root' }),
1043
- __metadata("design:paramtypes", [ImgManagerService,
1044
- AlertService])
1045
- ], RenamePictureService);
1046
-
1047
- let UploadListComponent = class UploadListComponent {
1048
- constructor(imgSelectionService, renamePictureService) {
1049
- this.imgSelectionService = imgSelectionService;
1050
- this.renamePictureService = renamePictureService;
1051
- this.picturesList = [];
1052
- this.multipleImgMode = false;
1053
- this.switchDisplayWindow = new EventEmitter();
1054
- }
1055
- ngOnInit() {
1056
- this.setEvents();
1057
- }
1058
- onImgUploaded(img) {
1059
- img.forEach(picture => this.picturesList.push(picture));
1060
- this.renamePictureService.setPicturesList(this.picturesList);
1061
- }
1062
- onToggleSelectImg(index) {
1063
- if (this.stateDisplayed === 'window') {
1064
- return;
1065
- }
1066
- if (!this.picturesList[index].selected) {
1067
- this.imgSelectionService.addImgSelected(this.picturesList[index]);
1068
- this.picturesList[index].selected = true;
1069
- }
1070
- else {
1071
- this.imgSelectionService.removeImgSelectedById(this.picturesList[index].id_file);
1072
- this.picturesList[index].selected = false;
1073
- }
1074
- }
1075
- switchDisplayWindowCard() {
1076
- this.switchDisplayWindow.emit(true);
1077
- }
1078
- onRenamePicture(pictureRenamed) {
1079
- this.renamePictureService.onRenamePicture(pictureRenamed);
1080
- }
1081
- setEvents() {
1082
- this.imgSelectionChange = this.imgSelectionService.getImgSelectionChange().subscribe(imgSelection => {
1083
- const idFileList = [];
1084
- imgSelection.map(img => idFileList.push(img.id_file));
1085
- for (const picture of this.picturesList) {
1086
- if (idFileList.indexOf(picture.id_file) === -1) {
1087
- picture.selected = false;
1088
- }
1089
- }
1090
- });
1091
- }
1092
- ngOnDestroy() {
1093
- this.imgSelectionChange.unsubscribe();
1094
- }
1095
- };
1096
- UploadListComponent.ctorParameters = () => [
1097
- { type: ImgSelectionService },
1098
- { type: RenamePictureService }
1099
- ];
1100
- __decorate([
1101
- Input(),
1102
- __metadata("design:type", String)
1103
- ], UploadListComponent.prototype, "stateDisplayed", void 0);
1104
- __decorate([
1105
- Input(),
1106
- __metadata("design:type", String)
1107
- ], UploadListComponent.prototype, "tabDisplayed", void 0);
1108
- __decorate([
1109
- Input(),
1110
- __metadata("design:type", Boolean)
1111
- ], UploadListComponent.prototype, "multipleImgMode", void 0);
1112
- __decorate([
1113
- Output(),
1114
- __metadata("design:type", EventEmitter)
1115
- ], UploadListComponent.prototype, "switchDisplayWindow", void 0);
1116
- UploadListComponent = __decorate([
1117
- Component({
1118
- selector: 'upload-list',
1119
- template: "<div class=\"upload-list\" [ngClass]=\"{'smallDisplay': stateDisplayed === 'small'}\" [@easeInOut]=\"'in'\">\n\n <perfect-scrollbar\n #scrollable\n [config]=\"{ suppressScrollX: true }\"\n class=\"upload-list__scroll\"\n [ngClass]=\"{\n 'upload-list__scroll--smallDisplay': stateDisplayed === 'small',\n 'upload-list__scroll--window': stateDisplayed === 'window'}\"\n >\n <div class=\"upload-list__box\">\n <div class=\"upload-list__box__container\">\n <div>\n <p class=\"mainColor\">\n {{ picturesList? picturesList.length : '' }}\n <ng-container *ngIf=\"picturesList && picturesList.length > 1\">{{ 'ImgManager.UploadList.imgSuccessImport' | translate }}</ng-container>\n <ng-container *ngIf=\"picturesList && picturesList.length === 1\">{{ 'ImgManager.UploadList.imgSuccessImportOne' | translate }}</ng-container>\n </p>\n <div class=\"dropdown is-hoverable\">\n <div class=\"dropdown-trigger\">\n <i\n aria-haspopup=\"true\" aria-controls=\"dropdown-menuInfoSeo\"\n class=\"fas fa-info-circle\">\n </i>\n </div>\n <div class=\"dropdown-menu dropDownShadow\" id=\"dropdown-menuInfoSeo\" role=\"menu\">\n <div class=\"dropdown-content\">\n <div class=\"dropdown-item\">\n <p>{{ 'ImgManager.UploadList.seo.rezise' | translate }}</p>\n <p><i class=\"fal fa-check\"></i> 100%</p>\n </div>\n <div class=\"dropdown-item\">\n <p>{{ 'ImgManager.UploadList.seo.webp' | translate }}</p>\n <p><i class=\"fal fa-check\"></i> 100%</p>\n </div>\n <div class=\"dropdown-item\">\n <p>{{ 'ImgManager.UploadList.seo.cdn' | translate }}</p>\n <p><i class=\"fal fa-check\"></i> 100%</p>\n </div>\n <div class=\"dropdown-item\">\n <p>{{ 'ImgManager.UploadList.seo.lazyloading' | translate }}</p>\n <p><i class=\"fal fa-check\"></i> 100%</p>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"upload-list__box__cards\">\n <div class=\"upload-list__box__cards__card\" *ngFor=\"let picture of picturesList; let index = index;\">\n <img-card\n [picture]=\"picture\"\n [stateDisplayed]=\"stateDisplayed\"\n (toggleImgSelected)=\"onToggleSelectImg(index)\"\n (switchDisplayWindow)=\"switchDisplayWindowCard()\"\n (pictureNameChange)=\"onRenamePicture($event)\"\n ></img-card>\n <div class=\"upload-list__box__cards__card__btnBox\">\n <button class=\"button success upload-list__box__cards__card__btnBox__btn\"><i class=\"fal fa-check\"></i></button>\n </div>\n </div>\n </div>\n </div>\n </perfect-scrollbar>\n</div>\n",
1120
- animations: [
1121
- easeInOut
1122
- ]
1123
- }),
1124
- __metadata("design:paramtypes", [ImgSelectionService,
1125
- RenamePictureService])
1126
- ], UploadListComponent);
1127
-
1128
- let ImgTabsComponent = class ImgTabsComponent {
1129
- constructor(imgEventEditService, alertService, route) {
1130
- this.imgEventEditService = imgEventEditService;
1131
- this.alertService = alertService;
1132
- this.route = route;
1133
- this.multipleImgMode = false;
1134
- this.listDisplayed = false;
1135
- this.imgManagerClosed = new EventEmitter();
1136
- this.currentTab = new EventEmitter();
1137
- this.switchDisplayWindow = new EventEmitter();
1138
- this.tabs = [
1139
- {
1140
- name: 'ImgManager.Tabs.addImg',
1141
- value: 'img-upload',
1142
- selected: true,
1143
- id: 0
1144
- },
1145
- {
1146
- name: 'ImgManager.Tabs.imgLib',
1147
- value: 'images-view',
1148
- id: 1
1149
- },
1150
- {
1151
- name: 'ImgManager.Tabs.freeImgLib',
1152
- value: 'pexels-lib',
1153
- id: 2
1154
- },
1155
- {
1156
- name: 'ImgManager.Tabs.Editor',
1157
- value: 'img-edition',
1158
- hide: true,
1159
- id: 3
1160
- }
1161
- ];
1162
- this.tabActive = this.tabs[0];
1163
- /* tabActive = 'images-view';
1164
- tabs: string[] = ['img-upload', 'images-view', 'pexels-lib', 'img-edition']; */
1165
- this.editTab = false;
1166
- this.imgUpload = false;
1167
- this.snackBarNewVersionConfig = {
1168
- message: '',
1169
- duration: 3000
1170
- };
1171
- }
1172
- ngOnInit() {
1173
- this.imgEventEditService.getImgToEditEventListner().subscribe(imgToEdit => {
1174
- this.tabActive = this.tabs[3];
1175
- this.imgToEdit = imgToEdit;
1176
- this.editTab = true;
1177
- this.currentTab.emit(this.tabs[3]);
1178
- });
1179
- }
1180
- toggleTabs(item) {
1181
- this.imgUpload = false;
1182
- this.editTab = false;
1183
- this.tabActive = item;
1184
- }
1185
- onImgUploaded(img) {
1186
- this.imgUpload = true;
1187
- this.imgUploadedComponent.onImgUploaded(img);
1188
- }
1189
- onEditClosed(msgKey) {
1190
- this.editTab = false;
1191
- this.toggleTabs(this.tabs[1]);
1192
- if (msgKey) {
1193
- this.alertService.openAlert(msgKey);
1194
- }
1195
- this.currentTab.emit('close');
1196
- }
1197
- onShowImgUploaded() {
1198
- this.tabActive = this.tabs[1];
1199
- }
1200
- switchDisplayWindowImgView() {
1201
- this.switchDisplayWindow.emit(true);
1202
- }
1203
- switchRouterLink(event) {
1204
- }
1205
- onImgManagerClosed() {
1206
- this.imgManagerClosed.emit();
1207
- }
1208
- };
1209
- ImgTabsComponent.ctorParameters = () => [
1210
- { type: ImgEventService },
1211
- { type: AlertService },
1212
- { type: Router }
1213
- ];
1214
- __decorate([
1215
- Input(),
1216
- __metadata("design:type", Boolean)
1217
- ], ImgTabsComponent.prototype, "multipleImgMode", void 0);
1218
- __decorate([
1219
- Input(),
1220
- __metadata("design:type", String)
1221
- ], ImgTabsComponent.prototype, "stateDisplayed", void 0);
1222
- __decorate([
1223
- Input(),
1224
- __metadata("design:type", Object)
1225
- ], ImgTabsComponent.prototype, "listDisplayed", void 0);
1226
- __decorate([
1227
- Output(),
1228
- __metadata("design:type", Object)
1229
- ], ImgTabsComponent.prototype, "imgManagerClosed", void 0);
1230
- __decorate([
1231
- Output(),
1232
- __metadata("design:type", Object)
1233
- ], ImgTabsComponent.prototype, "currentTab", void 0);
1234
- __decorate([
1235
- Output(),
1236
- __metadata("design:type", EventEmitter)
1237
- ], ImgTabsComponent.prototype, "switchDisplayWindow", void 0);
1238
- __decorate([
1239
- ViewChild('imgUploadedImg'),
1240
- __metadata("design:type", UploadListComponent)
1241
- ], ImgTabsComponent.prototype, "imgUploadedComponent", void 0);
1242
- ImgTabsComponent = __decorate([
1243
- Component({
1244
- selector: 'img-tabs',
1245
- template: "<div\n class=\"img-tabs\" [ngClass]=\"{'small': stateDisplayed === 'small'}\">\n <div class=\"wrapper-tabs\">\n <div\n class=\"tabs\"\n [ngClass]=\"\n {\n 'tabs--notWindow': stateDisplayed !== 'window',\n 'tabs--notDisplayed': stateDisplayed === 'window' && tabActive.value === tabs[3].value\n }\">\n\n <ul>\n <li class=\"is-active\" [ngClass]=\"{'is-active': tabActive.value === tabs[0].value}\" (click)=\"toggleTabs(tabs[0])\"><a>{{ tabs[0].name | translate }}</a></li>\n <li [ngClass]=\"{'is-active': tabActive.value === tabs[1].value}\" (click)=\"toggleTabs(tabs[1])\"><a>{{ tabs[1].name | translate }}</a></li>\n <li [ngClass]=\"{'is-active': tabActive.value === tabs[2].value}\" (click)=\"toggleTabs(tabs[2])\"><a>{{ tabs[2].name | translate }}</a></li>\n <li [ngClass]=\"{'is-active': tabActive.value === tabs[3].value}\" *ngIf=\"editTab\"><a>{{ tabs[3].name | translate }}</a></li>\n </ul>\n <div\n class=\"img-tabs__canva\"\n [ngClass]=\"{'img-tabs__canva--window': stateDisplayed === 'window'}\">\n <canva-btn\n (showImgUploaded)=\"onShowImgUploaded()\"\n [stateDisplayed]=\"stateDisplayed\">\n </canva-btn>\n </div>\n </div>\n <div class=\"select-mobile-page\">\n <wac-select\n [(ngModel)]=\"tabActive\"\n name=\"tabs\"\n [items]=\"tabs\"\n ></wac-select>\n </div>\n </div>\n\n <!-- Upload section -->\n <div\n class=\"columns img-tabs__tabsFirst\"\n [ngClass]=\"{\n 'img-tabs__tabsFirst--small': stateDisplayed === 'small',\n 'img-tabs__tabsFirst--window': stateDisplayed === 'window'\n }\"\n *ngIf=\"tabActive.value === tabs[0].value\">\n <div class=\"column img-tabs__tabsFirst__upload\">\n <img-upload\n [stateDisplayed]=\"stateDisplayed\"\n (imgUploaded)=\"onImgUploaded($event)\"\n ></img-upload>\n </div>\n <div class=\"column img-tabs__tabsFirst__list\" [ngClass]=\"{\n 'img-tabs__tabsFirst__list--upload': imgUpload\n }\">\n <images-view\n *ngIf=\"!imgUpload\"\n [stateDisplayed]=\"stateDisplayed\"\n [listDisplayed]=\"false\"\n [multipleImgMode]=\"multipleImgMode\"\n [tabDisplayed]=\"tabActive.value\"\n [nbRowToShow]=\"2\"\n (switchDisplayWindow)=\"switchDisplayWindowImgView()\"\n [fullSize]=\"false\">\n </images-view>\n\n\n <div [hidden]=\"!imgUpload\">\n <upload-list\n #imgUploadedImg\n [stateDisplayed]=\"stateDisplayed\"\n [tabDisplayed]=\"tabActive.value\"\n [multipleImgMode]=\"multipleImgMode\"\n (switchDisplayWindow)=\"switchDisplayWindowImgView()\"\n >\n </upload-list>\n </div>\n </div>\n </div>\n\n <!-- Images section -->\n <div class=\"columns img-tabs__tabsSecond\" *ngIf=\"tabActive.value === tabs[1].value\">\n <div class=\"column\">\n\n <images-view\n [stateDisplayed]=\"stateDisplayed\"\n [listDisplayed]=\"listDisplayed\"\n [multipleImgMode]=\"multipleImgMode\"\n [tabDisplayed]=\"tabActive.value\"\n (switchDisplayWindow)=\"switchDisplayWindowImgView()\"\n [fullSize]=\"true\">\n </images-view>\n\n </div>\n </div>\n\n <!-- Pexel img section -->\n <div class=\"columns img-tabs__tabsThird\" *ngIf=\"tabActive.value === tabs[2].value\">\n <div class=\"column\">\n <pexels-lib\n [stateDisplayed]=\"stateDisplayed\"\n (showImgUploaded)=\"onShowImgUploaded()\">\n </pexels-lib>\n </div>\n </div>\n\n <!--Edition section -->\n <div class=\"columns img-tabs__tabsEdit\" *ngIf=\"tabActive.value === tabs[3].value\">\n <div class=\"column\">\n <img-editor\n [stateDisplayed]=\"stateDisplayed\"\n [imgToEdit]=\"imgToEdit\"\n (editClosed)=\"onEditClosed($event)\">\n </img-editor>\n </div>\n </div>\n\n</div>\n"
1246
- }),
1247
- __metadata("design:paramtypes", [ImgEventService,
1248
- AlertService,
1249
- Router])
1250
- ], ImgTabsComponent);
1251
-
1252
- let DragDropDirective = class DragDropDirective {
1253
- constructor() {
1254
- this.onFileDropped = new EventEmitter();
1255
- this.background = '#fff';
1256
- this.opacity = '1';
1257
- }
1258
- onDragOver(evt) {
1259
- evt.preventDefault();
1260
- evt.stopPropagation();
1261
- this.background = '#f5f5f5';
1262
- this.opacity = '0.8';
1263
- }
1264
- onDragLeave(evt) {
1265
- evt.preventDefault();
1266
- evt.stopPropagation();
1267
- this.background = '#fff';
1268
- this.opacity = '1';
1269
- }
1270
- ondrop(evt) {
1271
- evt.preventDefault();
1272
- evt.stopPropagation();
1273
- this.background = '#f5f5f5';
1274
- this.opacity = '1';
1275
- const files = evt.dataTransfer.files;
1276
- if (files.length > 0) {
1277
- this.onFileDropped.emit(files);
1278
- }
1279
- }
1280
- };
1281
- __decorate([
1282
- Output(),
1283
- __metadata("design:type", Object)
1284
- ], DragDropDirective.prototype, "onFileDropped", void 0);
1285
- __decorate([
1286
- HostBinding('style.background-color'),
1287
- __metadata("design:type", Object)
1288
- ], DragDropDirective.prototype, "background", void 0);
1289
- __decorate([
1290
- HostBinding('style.opacity'),
1291
- __metadata("design:type", Object)
1292
- ], DragDropDirective.prototype, "opacity", void 0);
1293
- __decorate([
1294
- HostListener('dragover', ['$event']),
1295
- __metadata("design:type", Function),
1296
- __metadata("design:paramtypes", [Object]),
1297
- __metadata("design:returntype", void 0)
1298
- ], DragDropDirective.prototype, "onDragOver", null);
1299
- __decorate([
1300
- HostListener('dragleave', ['$event']),
1301
- __metadata("design:type", Function),
1302
- __metadata("design:paramtypes", [Object]),
1303
- __metadata("design:returntype", void 0)
1304
- ], DragDropDirective.prototype, "onDragLeave", null);
1305
- __decorate([
1306
- HostListener('drop', ['$event']),
1307
- __metadata("design:type", Function),
1308
- __metadata("design:paramtypes", [Object]),
1309
- __metadata("design:returntype", void 0)
1310
- ], DragDropDirective.prototype, "ondrop", null);
1311
- DragDropDirective = __decorate([
1312
- Directive({
1313
- selector: '[appDragDrop]'
1314
- })
1315
- ], DragDropDirective);
1316
-
1317
- let PexelsService = class PexelsService {
1318
- constructor(http, externalConfigService, translateService) {
1319
- this.http = http;
1320
- this.externalConfigService = externalConfigService;
1321
- this.translateService = translateService;
1322
- this.languages = { 'fr': 'fr-FR', 'en': 'en-US', 'it': 'it-IT', 'es': 'es-ES' };
1323
- this.setLang(this.translateService.currentLang);
1324
- this.translateService.onLangChange.subscribe(langData => {
1325
- this.setLang(langData.lang);
1326
- });
1327
- }
1328
- setLang(lang) {
1329
- this.lang = this.languages[lang] ? this.languages[lang] : 'fr-FR';
1330
- }
1331
- searchOnPexels(toSearch, perPage, page) {
1332
- if (!this.apiBaseUrl || this.apiKey) {
1333
- this.apiBaseUrl = this.externalConfigService.getPexelsApiURL();
1334
- this.apiKey = this.externalConfigService.getPexelsApiToken();
1335
- }
1336
- const httpOptions = {
1337
- headers: new HttpHeaders({
1338
- Authorization: 'Bearer ' + this.apiKey
1339
- })
1340
- };
1341
- let request;
1342
- // If search value is not empty or blank
1343
- if (toSearch && !/^\s*$/.test(toSearch)) {
1344
- request = `/search?query=${toSearch}&per_page=${perPage}&page=${page}&locale=${this.lang}`;
1345
- }
1346
- else { // Search by category or display Pexels selection
1347
- const shopCategory = this.externalConfigService.getShopCategory();
1348
- // Search by shop category
1349
- if (shopCategory && shopCategory !== 'other' && shopCategory !== 'btob') {
1350
- request = `/search?query=${shopCategory}&per_page=${perPage}&page=${page}&locale=en-US`;
1351
- }
1352
- else { // Display Pexels selection
1353
- request = `/curated?per_page=${perPage}&page=${page}`;
1354
- }
1355
- }
1356
- return this.http.get(this.apiBaseUrl + request, httpOptions).pipe(map((data) => {
1357
- return data;
1358
- }));
1359
- }
1360
- };
1361
- PexelsService.ctorParameters = () => [
1362
- { type: HttpClient },
1363
- { type: ImgManagerConfigService },
1364
- { type: TranslateService }
1365
- ];
1366
- PexelsService.ɵprov = ɵɵdefineInjectable({ factory: function PexelsService_Factory() { return new PexelsService(ɵɵinject(HttpClient), ɵɵinject(ImgManagerConfigService), ɵɵinject(TranslateService)); }, token: PexelsService, providedIn: "root" });
1367
- PexelsService = __decorate([
1368
- Injectable({
1369
- providedIn: 'root'
1370
- }),
1371
- __metadata("design:paramtypes", [HttpClient,
1372
- ImgManagerConfigService,
1373
- TranslateService])
1374
- ], PexelsService);
1375
-
1376
- const listAnnimation = // the fade-in/fade-out animation.
1377
- trigger('listAnimation', [
1378
- transition(':enter, * => 0, * => -1', []),
1379
- transition(':increment', [
1380
- query(':enter', [
1381
- style({ opacity: 0, transform: 'translateY(100px)' }),
1382
- stagger(50, [
1383
- animate('500ms cubic-bezier(0.35, 0, 0.25, 1)', style({ opacity: 1, transform: 'none' })),
1384
- ]),
1385
- ], { optional: true })
1386
- ]),
1387
- ]);
1388
-
1389
- let PexelLibComponent = class PexelLibComponent {
1390
- constructor(wzImgLibService, imgManager, alertService, translateService) {
1391
- this.wzImgLibService = wzImgLibService;
1392
- this.imgManager = imgManager;
1393
- this.alertService = alertService;
1394
- this.translateService = translateService;
1395
- this.searchValue = '';
1396
- /** Pass to true to hide search input */
1397
- this.disableSearch = false;
1398
- this.showImgUploaded = new EventEmitter();
1399
- this.perPage = 30;
1400
- this.searchUpdated = new Subject();
1401
- this.nbResult = 0;
1402
- this.currentPage = 1;
1403
- this.isLoading = true;
1404
- this.initComponent = true;
1405
- this.photosColumns = [];
1406
- this.nbColumuns = 6;
1407
- this.responsiveColumns = [1250, 1050, 750, 500];
1408
- this.outerElement = null;
1409
- this.uploadingImg = 'ImgManager.PexelLib.uploadingImg';
1410
- this.untitled = 'ImgManager.PexelLib.untitled';
1411
- this.successUploadPhoto = 'ImgManager.PexelLib.successImport';
1412
- this.errorUploadPhoto = 'ImgManager.PexelLib.errorUploadPhoto';
1413
- this.errorRetrievePhotos = 'ImgManager.PexelLib.errorRetrievePhotos';
1414
- this.subs = [];
1415
- }
1416
- set content(control) {
1417
- this.outerElement = control;
1418
- }
1419
- ngOnInit() {
1420
- }
1421
- ngAfterViewInit() {
1422
- this.oldSearchValue = this.searchValue;
1423
- this.isLoading = false;
1424
- this.setNbColumnsToDisplayPhoto();
1425
- this.setPhotosColumns();
1426
- this.search();
1427
- }
1428
- setNbColumnsToDisplayPhoto() {
1429
- const width = this.outerElement.nativeElement.offsetWidth;
1430
- if (this.stateDisplayed !== 'window') {
1431
- this.nbColumuns = 8;
1432
- }
1433
- this.responsiveColumns.forEach(value => {
1434
- if (width < value) {
1435
- this.nbColumuns--;
1436
- }
1437
- });
1438
- }
1439
- onSearchNameChanged() {
1440
- this.onSearchChange();
1441
- }
1442
- onBottomReached() {
1443
- this.scrollHandler();
1444
- }
1445
- onSearchChange() {
1446
- this.search();
1447
- }
1448
- search() {
1449
- if (this.isLoading) {
1450
- return;
1451
- }
1452
- if (this.searchValue !== this.oldSearchValue) {
1453
- this.resetSearch();
1454
- }
1455
- // All the picture are displayed
1456
- if (this.nbResult && this.nbResult <= (this.currentPage - 1) * this.perPage) {
1457
- return;
1458
- }
1459
- this.isLoading = true;
1460
- const searchSub = this.wzImgLibService.searchOnPexels(this.searchValue, this.perPage, this.currentPage).subscribe((data) => {
1461
- this.wzImgLibDto = data;
1462
- this.nbResult = this.wzImgLibDto.total_results;
1463
- if (this.nbResult) {
1464
- data.photos.forEach(photo => {
1465
- const bestColumnIndex = this.getBestColumn();
1466
- const height = (photo.height / photo.width) * 1000;
1467
- this.photosColumns[bestColumnIndex].height += height;
1468
- this.photosColumns[bestColumnIndex].photos.push(photo);
1469
- });
1470
- }
1471
- this.isLoading = false;
1472
- this.initComponent = false;
1473
- }, error => {
1474
- this.isLoading = false;
1475
- this.initComponent = false;
1476
- this.alertService.openAlert(this.errorRetrievePhotos);
1477
- });
1478
- this.subs.push(searchSub);
1479
- }
1480
- scrollHandler() {
1481
- if (this.isLoading) {
1482
- return;
1483
- }
1484
- const bestColumnIndex = this.getBestColumn();
1485
- const lastPic = this.photosColumns[bestColumnIndex].photos[this.photosColumns[bestColumnIndex].photos.length - 1];
1486
- const lastPhoto = lastPic ? document.querySelector('img[src="' + lastPic.src.medium + '"]') : null;
1487
- if (lastPhoto) {
1488
- if (!this.isLoading) {
1489
- this.currentPage += 1;
1490
- this.search();
1491
- }
1492
- }
1493
- }
1494
- setPhotosColumns() {
1495
- for (let indexColumn = 0; indexColumn < this.nbColumuns; indexColumn++) {
1496
- const photosColumn = {
1497
- height: 0,
1498
- photos: []
1499
- };
1500
- this.photosColumns.push(photosColumn);
1501
- }
1502
- }
1503
- getBestColumn() {
1504
- const bestColumn = {
1505
- index: 0,
1506
- height: this.photosColumns[0].height
1507
- };
1508
- this.photosColumns.forEach((photosColumn, index) => {
1509
- if (bestColumn.height > photosColumn.height) {
1510
- bestColumn.index = index;
1511
- bestColumn.height = photosColumn.height;
1512
- }
1513
- });
1514
- return bestColumn.index;
1515
- }
1516
- resetSearch() {
1517
- this.oldSearchValue = this.searchValue;
1518
- this.photosColumns = [];
1519
- this.currentPage = 1;
1520
- this.setPhotosColumns();
1521
- }
1522
- uploadPhoto(photo, url) {
1523
- photo.uploading = true;
1524
- const uploadSub = this.imgManager.uploadFileByUrl(url, this.translateService.instant(this.untitled)).subscribe((img) => {
1525
- photo.uploading = false;
1526
- photo.uploaded = true;
1527
- this.alertService.openAlert(this.successUploadPhoto);
1528
- }, error => {
1529
- photo.uploading = false;
1530
- if (error.error.code === 406 && error.error.message) {
1531
- this.alertService.openAlertWithBackendRespons(this.errorUploadPhoto, error.error.message);
1532
- }
1533
- else {
1534
- this.alertService.openAlert(this.errorUploadPhoto);
1535
- }
1536
- });
1537
- // Display img uploading msg
1538
- this.alertService.openAlert(this.uploadingImg);
1539
- this.subs.push(uploadSub);
1540
- }
1541
- ngOnDestroy() {
1542
- this.subs.forEach(sub => sub.unsubscribe());
1543
- }
1544
- };
1545
- PexelLibComponent.ctorParameters = () => [
1546
- { type: PexelsService },
1547
- { type: ImgManagerService },
1548
- { type: AlertService },
1549
- { type: TranslateService }
1550
- ];
1551
- __decorate([
1552
- Input(),
1553
- __metadata("design:type", String)
1554
- ], PexelLibComponent.prototype, "stateDisplayed", void 0);
1555
- __decorate([
1556
- Input(),
1557
- __metadata("design:type", String)
1558
- ], PexelLibComponent.prototype, "searchValue", void 0);
1559
- __decorate([
1560
- Input(),
1561
- __metadata("design:type", Boolean)
1562
- ], PexelLibComponent.prototype, "disableSearch", void 0);
1563
- __decorate([
1564
- Output(),
1565
- __metadata("design:type", Object)
1566
- ], PexelLibComponent.prototype, "showImgUploaded", void 0);
1567
- __decorate([
1568
- ViewChild('outerElement'),
1569
- __metadata("design:type", ElementRef),
1570
- __metadata("design:paramtypes", [ElementRef])
1571
- ], PexelLibComponent.prototype, "content", null);
1572
- PexelLibComponent = __decorate([
1573
- Component({
1574
- selector: 'pexels-lib',
1575
- template: "<div class=\"pexels-lib\" #outerElement [@easeInOut]=\"'in'\">\n <perfect-scrollbar\n scrollYMarginOffset=\"300\"\n class=\"pexels-lib__scroll\"\n [ngClass]=\"{'pexels-lib__scroll--smallDisplay': stateDisplayed === 'small'}\"\n (psYReachEnd)=\"onBottomReached()\"\n >\n <div\n *ngIf=\"!disableSearch\"\n class=\"pexels-lib__search\"\n [ngClass]=\"{'pexels-lib__search--smallDisplay': stateDisplayed === 'small'}\"\n >\n <wz-input-search\n [(ngModel)]=\"searchValue\"\n [placeholder]=\"'ImgManager.SearchBar.placeholder' | translate\"\n (changeDebounced)=\"onSearchNameChanged()\"\n [smallPadding]=\"stateDisplayed === 'small'\">\n </wz-input-search>\n </div>\n\n <div *ngIf=\"!initComponent\" class=\"pexels-lib__wrapper\">\n <p *ngIf=\"nbResult\" class=\"pexels-lib__wrapper__result-nb\">{{ 'ImgManager.PexelLib.nbImgFound' | translate }} : {{ nbResult }}</p>\n\n <div class=\"pexels-lib__wrapper__result\">\n\n <div *ngFor=\"let photosColumn of photosColumns; let indexCol = index;\" class=\"pexels-lib__wrapper__result__column\" [@listAnimation]=\"photosColumn.photos.length\">\n <div *ngFor=\"let photo of photosColumn.photos; let indexPhoto = index;\" class=\"pexels-lib__wrapper__result__column__element\">\n\n <img [alt]=\"photo.src.medium\" [src]=\"photo.src.medium\"\n class=\"pexels-lib__wrapper__result__column__element__img\"/>\n\n <div class=\"pexels-lib__wrapper__result__column__element__wrapper\">\n <span class=\"pexels-lib__wrapper__result__column__element__wrapper__infos\">\n {{ photo.width }} x {{ photo.height}}\n </span>\n\n <div class=\"dropdown is-up\" [ngClass]=\"{'is-hoverable': !photo.uploading}\">\n <div class=\"dropdown-trigger\">\n <button\n class=\"button pexels-lib__wrapper__result__column__element__wrapper__button\"\n aria-haspopup=\"true\"\n aria-controls=\"dropdown-menu\">\n\n <div *ngIf=\"!photo.uploading\" (click)=\"uploadPhoto(photo, photo.src.large2x)\">\n <span>{{ 'ImgManager.PexelLib.import' | translate }}</span>\n <span class=\"icon is-small\">\n <i class=\"fas fa-angle-up\" aria-hidden=\"true\"></i>\n </span>\n <ng-container *ngIf=\"photo.uploaded\">\n &nbsp;<i class=\"fal fa-check\"></i>\n </ng-container>\n </div>\n\n <ng-container *ngIf=\"photo.uploading\">\n {{ 'ImgManager.PexelLib.importation' | translate }}\n <span btnLoadingAnim class=\"btnLoadingAnnimation\"></span>\n </ng-container>\n\n </button>\n </div>\n <div class=\"dropdown-menu pexels-lib__wrapper__result__column__element__wrapper__dropdown\" id=\"dropdown-menu\" role=\"menu\">\n <div class=\"dropdown-content\">\n <div class=\"dropdown-content__wrapper\">\n <div class=\"dropdown-item\" (click)=\"uploadPhoto(photo, photo.src.portrait)\">\n <p>{{ 'ImgManager.PexelLib.portrait' | translate }}</p>\n <i class=\"fal fa-check iPortrait\"></i>\n </div>\n <div class=\"dropdown-item\" (click)=\"uploadPhoto(photo, photo.src.landscape)\">\n <p>{{ 'ImgManager.PexelLib.landscape' | translate }}</p>\n <i class=\"fal fa-check iLandscape\"></i>\n </div>\n <div class=\"dropdown-item\" (click)=\"uploadPhoto(photo, photo.src.large2x)\">\n <p>{{ 'ImgManager.PexelLib.original' | translate }}</p>\n <i class=\"fal fa-check iOriginal\"></i>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n </div>\n </div>\n </div>\n </div>\n <ng-container *ngIf=\"isLoading\">\n <wz-loader></wz-loader>\n </ng-container>\n <div\n *ngIf=\"!isLoading && !nbResult\"\n class=\"pexels-lib__alert\"\n [@easeInOut]=\"'in'\">\n <wz-alert [warning]=\"true\">\n {{ 'ImgManager.PexelLib.noResult' | translate }}\n </wz-alert>\n </div>\n\n </perfect-scrollbar>\n</div>\n",
1576
- animations: [
1577
- easeInOut,
1578
- listAnnimation
1579
- ]
1580
- }),
1581
- __metadata("design:paramtypes", [PexelsService,
1582
- ImgManagerService,
1583
- AlertService,
1584
- TranslateService])
1585
- ], PexelLibComponent);
1586
-
1587
- let ImagesActionHandler = class ImagesActionHandler {
1588
- constructor(imgManager, imgSelectionService, http, imgCDNService, imgEventCardService, alertService, translateService, externalService) {
1589
- this.imgManager = imgManager;
1590
- this.imgSelectionService = imgSelectionService;
1591
- this.http = http;
1592
- this.imgCDNService = imgCDNService;
1593
- this.imgEventCardService = imgEventCardService;
1594
- this.alertService = alertService;
1595
- this.translateService = translateService;
1596
- this.externalService = externalService;
1597
- this.picturesList = [];
1598
- this.picturesListChange = new EventEmitter();
1599
- this.tableFilters = {
1600
- sort: undefined,
1601
- order: undefined,
1602
- searchValue: '',
1603
- totalItems: 0,
1604
- itemsPerPage: 30,
1605
- currentPage: 1
1606
- };
1607
- this.displayPexelsResults = false;
1608
- this.disable = false;
1609
- this.disableChange = new EventEmitter();
1610
- this.filtersChange = new EventEmitter();
1611
- this.pictureNameChange = new EventEmitter();
1612
- this.isLoading = false;
1613
- this.errorRemoveImg = 'ImgManager.ImgList.errorRemoveImg';
1614
- this.errorAlreadyUsedImg = 'ImgManager.ImgList.errorAlreadyUsed';
1615
- this.fakeImgRoute = this.externalService.getRouteAssets() + 'img/fake.png';
1616
- }
1617
- /** Event emit when the header checkbox is checked */
1618
- onToggleAllCheckBoxRow(event) {
1619
- this.picturesList.forEach(data => {
1620
- data.delSelected = event;
1621
- });
1622
- this._pictureListeChange();
1623
- }
1624
- onToggleDelSelection(index) {
1625
- if (this.disable) {
1626
- return;
1627
- }
1628
- this.picturesList[index].delSelected = !this.picturesList[index].delSelected;
1629
- this._pictureListeChange();
1630
- }
1631
- /** Event emit each time filters change */
1632
- onFiltersChange() {
1633
- this.filtersChange.emit();
1634
- }
1635
- onEdit(picture) {
1636
- this.imgEventCardService.emitImgToEdit(picture);
1637
- }
1638
- onToggleSelectImg(index) {
1639
- if (this.disable || this.stateDisplayed === 'window') {
1640
- return;
1641
- }
1642
- if (!this.picturesList[index].selected) {
1643
- this.imgSelectionService.addImgSelected(this.picturesList[index]);
1644
- this.picturesList[index].selected = true;
1645
- }
1646
- else {
1647
- this.imgSelectionService.removeImgSelectedById(this.picturesList[index].id_file);
1648
- this.picturesList[index].selected = false;
1649
- }
1650
- }
1651
- onRemoveImg(picture) {
1652
- picture.deleted = true;
1653
- this.imgManager.removeImg(picture.id_file).subscribe(data => {
1654
- this.imgEventCardService.emitImgRemoved(picture.id_file);
1655
- this.imgSelectionService.removeImgSelectedById(picture.id_file);
1656
- }, error => {
1657
- const msg = error.status === 409 ? this.errorAlreadyUsedImg : this.errorRemoveImg;
1658
- picture.deleted = false;
1659
- this.alertService.openAlert(msg);
1660
- });
1661
- }
1662
- onPictureNotLoading(event) {
1663
- event.target.src = this.fakeImgRoute;
1664
- }
1665
- onDownloadImg(display_name, file_name) {
1666
- this.http.get(this.getRAWImgRoute(file_name), { responseType: 'blob' }).subscribe(val => {
1667
- let url = URL.createObjectURL(val);
1668
- this.downloadUrl(url, display_name);
1669
- URL.revokeObjectURL(url);
1670
- });
1671
- }
1672
- onNameChange(id_file) {
1673
- this.pictureNameChange.emit({ id: id_file, previousName: this.previousName });
1674
- }
1675
- getRAWImgRoute(file_name) {
1676
- return this.imgCDNService.getUrlImg('raw') + file_name;
1677
- }
1678
- _pictureListeChange() {
1679
- this.picturesListChange.emit();
1680
- }
1681
- downloadUrl(url, fileName) {
1682
- const a = document.createElement('a');
1683
- a.href = url;
1684
- a.download = fileName;
1685
- a.click();
1686
- }
1687
- ngDestroy() {
1688
- if (this.getDataAPISub) {
1689
- this.getDataAPISub.unsubscribe();
1690
- }
1691
- }
1692
- };
1693
- ImagesActionHandler.ctorParameters = () => [
1694
- { type: ImgManagerService },
1695
- { type: ImgSelectionService },
1696
- { type: HttpClient },
1697
- { type: ImgCDNService },
1698
- { type: ImgEventService },
1699
- { type: AlertService },
1700
- { type: TranslateService },
1701
- { type: ImgManagerConfigService }
1702
- ];
1703
- __decorate([
1704
- Input(),
1705
- __metadata("design:type", Array)
1706
- ], ImagesActionHandler.prototype, "picturesList", void 0);
1707
- __decorate([
1708
- Output(),
1709
- __metadata("design:type", EventEmitter)
1710
- ], ImagesActionHandler.prototype, "picturesListChange", void 0);
1711
- __decorate([
1712
- Input(),
1713
- __metadata("design:type", Object)
1714
- ], ImagesActionHandler.prototype, "tableFilters", void 0);
1715
- __decorate([
1716
- Input(),
1717
- __metadata("design:type", Boolean)
1718
- ], ImagesActionHandler.prototype, "displayPexelsResults", void 0);
1719
- __decorate([
1720
- Input(),
1721
- __metadata("design:type", Boolean)
1722
- ], ImagesActionHandler.prototype, "disable", void 0);
1723
- __decorate([
1724
- Output(),
1725
- __metadata("design:type", EventEmitter)
1726
- ], ImagesActionHandler.prototype, "disableChange", void 0);
1727
- __decorate([
1728
- Output(),
1729
- __metadata("design:type", Object)
1730
- ], ImagesActionHandler.prototype, "filtersChange", void 0);
1731
- __decorate([
1732
- Output(),
1733
- __metadata("design:type", EventEmitter)
1734
- ], ImagesActionHandler.prototype, "pictureNameChange", void 0);
1735
- __decorate([
1736
- Input(),
1737
- __metadata("design:type", Object)
1738
- ], ImagesActionHandler.prototype, "isLoading", void 0);
1739
- __decorate([
1740
- Input(),
1741
- __metadata("design:type", String)
1742
- ], ImagesActionHandler.prototype, "stateDisplayed", void 0);
1743
- ImagesActionHandler = __decorate([
1744
- Directive(),
1745
- __metadata("design:paramtypes", [ImgManagerService,
1746
- ImgSelectionService,
1747
- HttpClient,
1748
- ImgCDNService,
1749
- ImgEventService,
1750
- AlertService,
1751
- TranslateService,
1752
- ImgManagerConfigService])
1753
- ], ImagesActionHandler);
1754
-
1755
- let ImgCardComponent = class ImgCardComponent extends ImagesActionHandler {
1756
- constructor(imgManager, imgSelectionService, http, imgCDNService, imgEventCardService, alertService, translateService, externalService) {
1757
- super(imgManager, imgSelectionService, http, imgCDNService, imgEventCardService, alertService, translateService, externalService);
1758
- this.focusInput = false;
1759
- this.toggleImgSelected = new EventEmitter();
1760
- this.switchDisplayWindow = new EventEmitter();
1761
- this.isUploadSection = false;
1762
- this.activeConfirmDelete = false;
1763
- }
1764
- ngOnInit() {
1765
- this.isUploadSection = this.tabDisplayed === 'img-upload';
1766
- }
1767
- displayLargeWindow() {
1768
- this.switchDisplayWindow.emit(true);
1769
- }
1770
- onToggleImgSelected() {
1771
- this.toggleImgSelected.next();
1772
- }
1773
- };
1774
- ImgCardComponent.ctorParameters = () => [
1775
- { type: ImgManagerService },
1776
- { type: ImgSelectionService },
1777
- { type: HttpClient },
1778
- { type: ImgCDNService },
1779
- { type: ImgEventService },
1780
- { type: AlertService },
1781
- { type: TranslateService },
1782
- { type: ImgManagerConfigService }
1783
- ];
1784
- __decorate([
1785
- Input(),
1786
- __metadata("design:type", String)
1787
- ], ImgCardComponent.prototype, "tabDisplayed", void 0);
1788
- __decorate([
1789
- Input(),
1790
- __metadata("design:type", Boolean)
1791
- ], ImgCardComponent.prototype, "fullSize", void 0);
1792
- __decorate([
1793
- Input(),
1794
- __metadata("design:type", Object)
1795
- ], ImgCardComponent.prototype, "picture", void 0);
1796
- __decorate([
1797
- Input(),
1798
- __metadata("design:type", Number)
1799
- ], ImgCardComponent.prototype, "index", void 0);
1800
- __decorate([
1801
- Output(),
1802
- __metadata("design:type", EventEmitter)
1803
- ], ImgCardComponent.prototype, "toggleImgSelected", void 0);
1804
- __decorate([
1805
- Output(),
1806
- __metadata("design:type", EventEmitter)
1807
- ], ImgCardComponent.prototype, "switchDisplayWindow", void 0);
1808
- ImgCardComponent = __decorate([
1809
- Component({
1810
- selector: 'img-card',
1811
- template: "<div class=\"addCssPriority\" [@easeInOut]=\"'in'\" [ngClass]=\"{ 'fullSize': fullSize }\">\n <div class=\"img-card\">\n <div class=\"img-card__container\"\n [ngClass]=\"{\n 'smallDisplay': stateDisplayed === 'small' || isUploadSection,\n 'imgSelected': picture.selected,\n 'deletion': picture.deleted}\">\n <img\n class=\"img-card__container__img\"\n [src]=\"picture.file_name | imgSrc : '400'\"\n [alt]=\"picture.display_name\"\n (click)=\"onToggleImgSelected()\"\n (error)=\"picture.imgNotLoaded=true;onPictureNotLoading($event);\"\n />\n <div\n class=\"img-card__container__config\"\n *ngIf=\"!picture.deleted && stateDisplayed !== 'small'\"\n >\n <button class=\"size\"><i class=\"fal fa-image-polaroid\"></i><span>{{picture.raw_height}}x{{picture.raw_width}}</span></button>\n <button class=\"dl\" (click)=\"onDownloadImg(picture.display_name, picture.file_name)\"><i class=\"fal fa-download\"></i><span>{{ 'ImgManager.ImgCard.download' | translate }}</span></button>\n <button class=\"edit\" (click)=\"onEdit(picture)\"><i class=\"far fa-crop-alt\"></i><span>{{ 'ImgManager.ImgCard.edit' | translate }}</span></button>\n <button class=\"deleted\" (click)=\"activeConfirmDelete = true;\"><i class=\"fal fa-times\"></i><span>{{ 'ImgManager.ImgCard.del' | translate }}</span></button>\n <button class=\"selected\" (click)=\"onToggleImgSelected()\" *ngIf=\"stateDisplayed !== 'window'\">\n <i *ngIf=\"!picture.selected\" class=\"fal fa-square\"></i>\n <i *ngIf=\"picture.selected\" class=\"fas fa-check-square checked\"></i>\n <span>{{ 'ImgManager.ImgCard.select' | translate }}</span>\n </button>\n </div>\n <div\n class=\"img-card__container__config img-card__container__config--small\"\n *ngIf=\"!picture.deleted && stateDisplayed === 'small'\"\n >\n <button class=\"show-edit\" (click)=\"displayLargeWindow()\"><i class=\"fas fa-edit\"></i></button>\n </div>\n <div class=\"img-card__container__delete\" [ngClass]=\"{ 'show' : activeConfirmDelete}\">\n <span>{{ 'ImgManager.ImgCard.confirmDeleteImg' | translate }}</span>\n <div>\n <button (click)=\"activeConfirmDelete = false;\">{{ 'no' | translate }}</button>\n <button (click)=\"onRemoveImg(picture);activeConfirmDelete = false;\">{{ 'yes' | translate }}</button>\n </div>\n </div>\n <div class=\"img-card__container__valid\" *ngIf=\"stateDisplayed === 'small' && tabDisplayed == 'img-upload'\">\n <i class=\"far fa-check\"></i>\n <span>{{ 'ImgManager.ImgCard.validImgSmall' | translate }}</span>\n </div>\n <div\n *ngIf=\"picture.imgNotLoaded\"\n class=\"img-card__container__overlay\"\n [ngClass]=\"{'img-card__container__overlay--smallDisplay': stateDisplayed === 'small' || isUploadSection}\">\n <i (click)=\"onToggleImgSelected()\" class=\"fad fa-folder-times\"></i>\n </div>\n <span btnLoadingAnim class=\"btnLoadingAnnimation\" *ngIf=\"picture.deleted\"></span>\n\n </div>\n <div\n class=\"img-card__nameContainer\"\n [ngClass]=\"{'smallNameDisplay': stateDisplayed === 'small' || isUploadSection, 'focus': focusInput}\">\n <input\n type=\"text\"\n class=\"wzImgMngInput img-card__nameContainer__name\"\n [(ngModel)]=\"picture.display_name\"\n (ngModelChange)=\"onNameChange(picture.id_file)\"\n (focus)=\"previousName=picture.display_name;focusInput = true;\"\n (blur)=\"focusInput = false;\"\n >\n <span>{{picture.display_name}}</span>\n </div>\n\n </div>\n</div>\n",
1812
- animations: [
1813
- easeInOut
1814
- ]
1815
- }),
1816
- __metadata("design:paramtypes", [ImgManagerService,
1817
- ImgSelectionService,
1818
- HttpClient,
1819
- ImgCDNService,
1820
- ImgEventService,
1821
- AlertService,
1822
- TranslateService,
1823
- ImgManagerConfigService])
1824
- ], ImgCardComponent);
1825
-
1826
- let ImgEditorComponent = class ImgEditorComponent {
1827
- constructor(imgManagerService) {
1828
- this.imgManagerService = imgManagerService;
1829
- this.editClosed = new EventEmitter();
1830
- this.isLoading = false;
1831
- this.isImgModified = false;
1832
- this.isNameModified = false;
1833
- this.currentCroppedImage = ''; // Img modified return in base64 by the cropper
1834
- this.msgFailSave = 'ImgManager.ImgEditor.msgFailSave';
1835
- this.msgFailLoad = 'ImgManager.ImgEditor.msgFailLoad';
1836
- this.msgSuccessEdit = "Les modifications de l'image ont bien été enregistrées.";
1837
- }
1838
- ngOnInit() {
1839
- this.previousName = this.imgToEdit.display_name;
1840
- }
1841
- onSave() {
1842
- if (this.isLoading) {
1843
- return;
1844
- }
1845
- this.isLoading = true;
1846
- if (!this.isImgModified && !this.isNameModified) {
1847
- this.isLoading = false;
1848
- this.onEditClosed();
1849
- }
1850
- const obsReplaceImg = this.imgManagerService.replaceImg(this.currentCroppedImage, this.imgToEdit.id_file);
1851
- const obsChangeImgName = this.imgManagerService.changeImgName(this.imgToEdit.display_name, this.imgToEdit.id_file);
1852
- if (this.isImgModified && this.isNameModified) {
1853
- this.ranameAndReplaceImg(obsChangeImgName, obsReplaceImg);
1854
- return;
1855
- }
1856
- if (this.isImgModified) {
1857
- obsReplaceImg.subscribe(data => {
1858
- this.isLoading = false;
1859
- this.onEditClosed(this.msgSuccessEdit);
1860
- }, error => {
1861
- this.isLoading = false;
1862
- this.currentCroppedImage = '';
1863
- this.onEditClosed(this.msgFailSave);
1864
- });
1865
- return;
1866
- }
1867
- if (this.isNameModified) {
1868
- obsChangeImgName.subscribe(data => {
1869
- this.isLoading = false;
1870
- this.previousName = this.imgToEdit.display_name;
1871
- this.onEditClosed(this.msgSuccessEdit);
1872
- }, error => {
1873
- this.isLoading = false;
1874
- this.imgToEdit.display_name = this.previousName;
1875
- this.onEditClosed(this.msgFailSave);
1876
- });
1877
- }
1878
- this.isNameModified = false;
1879
- }
1880
- onEditClosed(msgKey) {
1881
- this.editClosed.emit(msgKey);
1882
- }
1883
- onRestartEdit() {
1884
- this.isImgModified = false;
1885
- this.isNameModified = false;
1886
- this.imgToEdit.display_name = this.previousName;
1887
- }
1888
- onCancel() {
1889
- this.onEditClosed('');
1890
- }
1891
- onImgCropped(imgBase64) {
1892
- this.currentCroppedImage = imgBase64;
1893
- }
1894
- ranameAndReplaceImg(obsChangeImgName, obsReplaceImg) {
1895
- // Avoid to use forkjoin, because it can create conflict and loos the img
1896
- obsChangeImgName.subscribe(res1 => {
1897
- obsReplaceImg.subscribe(res2 => {
1898
- this.onEditClosed(this.msgSuccessEdit);
1899
- }, error => {
1900
- this.onEditClosed(this.msgFailSave);
1901
- });
1902
- }, error => {
1903
- this.onEditClosed(this.msgFailSave);
1904
- });
1905
- }
1906
- };
1907
- ImgEditorComponent.ctorParameters = () => [
1908
- { type: ImgManagerService }
1909
- ];
1910
- __decorate([
1911
- Input(),
1912
- __metadata("design:type", Object)
1913
- ], ImgEditorComponent.prototype, "stateDisplayed", void 0);
1914
- __decorate([
1915
- Input(),
1916
- __metadata("design:type", Object)
1917
- ], ImgEditorComponent.prototype, "imgToEdit", void 0);
1918
- __decorate([
1919
- Output(),
1920
- __metadata("design:type", Object)
1921
- ], ImgEditorComponent.prototype, "editClosed", void 0);
1922
- ImgEditorComponent = __decorate([
1923
- Component({
1924
- selector: 'img-editor',
1925
- template: "<div class=\"img-editor\" [@easeInOut]=\"'in'\">\n\n <!-- Button Action Section -->\n\n <div class=\"img-editor__infoSection__actions\">\n <div>\n <button\n class=\"button img-editor__infoSection__actions__cancel\"\n (click)=\"onCancel()\"\n [disabled]=\"isLoading || (!isImgModified && !isNameModified)\"\n >\n {{ 'ImgManager.ImgLib.cancel' | translate }}\n </button>\n <div\n class=\"button danger button img-editor__infoSection__actions__save\"\n [ngClass]=\"{'img-editor__infoSection__actions__save--disable': isLoading}\"\n (click)=\"onSave()\"\n >\n {{ 'ImgManager.ImgEditor.saveBtn' | translate }}\n <span btnLoadingAnim *ngIf=\"isLoading\" class=\"btnLoadingAnnimation\"></span>\n </div>\n\n </div>\n </div>\n\n <perfect-scrollbar\n [config]=\"{suppressScrollX: true}\"\n class=\"img-editor__scroll\"\n [ngClass]=\"{\n 'img-editor__scroll--full': stateDisplayed === 'full',\n 'img-editor__scroll--smallDisplay': stateDisplayed === 'small',\n 'img-editor__scroll--window': stateDisplayed === 'window'\n }\"\n >\n <div class=\"columns\">\n <!-- Left section -->\n <div class=\"column is-one-third img-editor__infoSection\">\n\n <info-section\n [imgToEdit]=\"imgToEdit\"\n [(isNameModified)]=\"isNameModified\"\n >\n </info-section>\n </div>\n\n\n <!-- Right section -->\n <div class=\"column img-editor__container\">\n <cropper\n [imgToEdit]=\"imgToEdit\"\n [(isImgModified)]=\"isImgModified\"\n (currentCroppedImageChange)=\"onImgCropped($event)\"\n (editClosed)=\"onEditClosed($event)\">\n </cropper>\n </div>\n </div>\n </perfect-scrollbar>\n</div>\n",
1926
- animations: [
1927
- easeInOut
1928
- ]
1929
- }),
1930
- __metadata("design:paramtypes", [ImgManagerService])
1931
- ], ImgEditorComponent);
1932
-
1933
- let CanvaBtnComponent = class CanvaBtnComponent {
1934
- constructor(canvaService) {
1935
- this.canvaService = canvaService;
1936
- this.showImgUploaded = new EventEmitter();
1937
- this.imgLoading = false;
1938
- this.availableFormat = {
1939
- 'ImgManager.CanvaBtn.smallSquare': {
1940
- 'width': 500,
1941
- 'height': 500
1942
- },
1943
- 'ImgManager.CanvaBtn.mediumSquare': {
1944
- 'width': 1000,
1945
- 'height': 1000
1946
- },
1947
- 'ImgManager.CanvaBtn.bigSquare': {
1948
- 'width': 2500,
1949
- 'height': 2500
1950
- }
1951
- };
1952
- this.openDropDownMenu = false;
1953
- this.subs = [];
1954
- }
1955
- ngOnInit() {
1956
- this.canvaLogoRouteAssets = this.canvaService.getCanvaLogo();
1957
- this.listenCanvaExpectedSize();
1958
- }
1959
- listenCanvaExpectedSize() {
1960
- // Subcribe to askImg from wizi-block
1961
- const subExpectedImgSizesChange = this.canvaService.bindEventExepectedImgSizeChange().subscribe((mediaDTO) => {
1962
- if (mediaDTO) {
1963
- this.expectedWidth = parseInt(mediaDTO.image_width, 10);
1964
- this.expectedHeight = parseInt(mediaDTO.image_height, 10);
1965
- }
1966
- else {
1967
- this.expectedWidth = undefined;
1968
- this.expectedHeight = undefined;
1969
- }
1970
- });
1971
- this.subs.push(subExpectedImgSizesChange);
1972
- }
1973
- onOpenCanva(width, height) {
1974
- this.canvaService.openCanva(width, height);
1975
- }
1976
- ngOnDestroy() {
1977
- this.subs.forEach(sub => sub.unsubscribe());
1978
- }
1979
- };
1980
- CanvaBtnComponent.ctorParameters = () => [
1981
- { type: CanvaService }
1982
- ];
1983
- __decorate([
1984
- Input(),
1985
- __metadata("design:type", String)
1986
- ], CanvaBtnComponent.prototype, "stateDisplayed", void 0);
1987
- __decorate([
1988
- Output(),
1989
- __metadata("design:type", Object)
1990
- ], CanvaBtnComponent.prototype, "showImgUploaded", void 0);
1991
- CanvaBtnComponent = __decorate([
1992
- Component({
1993
- selector: 'canva-btn',
1994
- template: "<div class=\"canva dropdown is-right is-hoverable\"\n wzAutoHide (clickOutside)=\"openDropDownMenu = false;\"\n [ngClass]=\"{'is-up': stateDisplayed === 'small', 'noTooltip': stateDisplayed !== 'small'}\"\n >\n <div class=\"dropdown-trigger\">\n <div\n class=\"button canva-btn\"\n aria-controls=\"dropdown-menuCanva\"\n (click)=\"openDropDownMenu = true;\"\n >\n <span>{{'ImgManager.CanvaBtn.createImg' | translate}}</span>\n <img [src]=\"canvaLogoRouteAssets\" class=\"canva-btn__logo\">\n\n <span btnLoadingAnim class=\"btnLoadingAnnimation\" *ngIf=\"imgLoading\"></span>\n </div>\n </div>\n <div\n class=\"dropdown-menu dropDownShadow\"\n [ngClass]=\"{'displayDropDownMenu': openDropDownMenu }\"\n id=\"dropdown-menuCanva\"\n role=\"menu\">\n <perfect-scrollbar\n class=\"smallScroll\"\n >\n <div class=\"dropdown-content\">\n <div class=\"dropdownTitle\">\n <p>{{'ImgManager.CanvaBtn.createImg.title' | translate}}</p>\n </div>\n\n <div class=\"infoItem\">\n <p>{{'ImgManager.CanvaBtn.info' | translate}}</p>\n </div>\n\n <ng-container >\n <div\n *ngIf=\"expectedWidth && expectedHeight\"\n class=\"dropdown-item-wrapper\"\n >\n <div class=\"dropdown-item expectedSizes\" (click)=\"onOpenCanva(expectedWidth, expectedHeight)\">\n <p>{{'ImgManager.CanvaBtn.recommanded' | translate}}</p><p>{{expectedWidth}}*{{expectedHeight}}</p>\n </div>\n </div>\n </ng-container>\n\n <div\n *ngFor=\"let format of availableFormat| keyvalue\"\n class=\"dropdown-item-wrapper\">\n <div\n (click)=\"onOpenCanva(format.value.width, format.value.height)\"\n class=\"dropdown-item\">\n <p>{{format.key | translate}}</p><p>{{format.value.width}}*{{format.value.height}}</p>\n </div>\n </div>\n </div>\n </perfect-scrollbar>\n </div>\n</div>\n"
1995
- }),
1996
- __metadata("design:paramtypes", [CanvaService])
1997
- ], CanvaBtnComponent);
1998
-
1999
- let ImgSelectionComponent = class ImgSelectionComponent {
2000
- constructor(imgSelectionService) {
2001
- this.imgSelectionService = imgSelectionService;
2002
- this.imgManagerClosed = new EventEmitter();
2003
- this.imgSelectedList = [];
2004
- this.removingAll = false;
2005
- this.cancellingAll = false;
2006
- this.importingAll = false;
2007
- this.dragStart = false;
2008
- this.isLoading = false;
2009
- this.trashPositionIndex = 0;
2010
- this.trashPositionLeft = '-5px';
2011
- }
2012
- ngOnInit() {
2013
- this.getImgSelected();
2014
- this.imgSelectionService.getImgListLoadingEventListner().subscribe(loading => {
2015
- this.isLoading = loading;
2016
- });
2017
- }
2018
- init() {
2019
- this.removingAll = false;
2020
- this.cancellingAll = false;
2021
- this.importingAll = false;
2022
- }
2023
- getImgSelected() {
2024
- this.imgSelectedList = this.imgSelectionService.getImgSelection();
2025
- }
2026
- removeImg(index) {
2027
- this.imgSelectionService.removeImgSelectedByIndex(index);
2028
- }
2029
- drop(event) {
2030
- if (event.previousIndex !== event.currentIndex) {
2031
- this.imgSelectionService.moveImgOrder(event);
2032
- }
2033
- }
2034
- removeImgFromSelection(event) {
2035
- this.imgSelectionService.removeImgSelectedByIndex(event.previousIndex);
2036
- }
2037
- };
2038
- ImgSelectionComponent.ctorParameters = () => [
2039
- { type: ImgSelectionService }
2040
- ];
2041
- __decorate([
2042
- Input(),
2043
- __metadata("design:type", String)
2044
- ], ImgSelectionComponent.prototype, "tabDisplayed", void 0);
2045
- __decorate([
2046
- Output(),
2047
- __metadata("design:type", Object)
2048
- ], ImgSelectionComponent.prototype, "imgManagerClosed", void 0);
2049
- ImgSelectionComponent = __decorate([
2050
- Component({
2051
- selector: 'img-selection',
2052
- template: "<div\n class=\"trash\"\n cdkDropList\n #unSelectList=\"cdkDropList\"\n (cdkDropListDropped)=\"removeImgFromSelection($event)\">\n <p>{{'ImgManager.ImgSelection.unselect' | translate}}</p>\n</div>\n\n<div\n class=\"img-selection\"\n [ngClass]=\"{'img-selection--visible' : imgSelectedList && imgSelectedList.length}\"\n *ngIf=\"!isLoading\">\n\n <div\n cdkDropList\n #selectionList=\"cdkDropList\"\n cdkDropListOrientation=\"horizontal\"\n class=\"list_img_selection\"\n (cdkDropListDropped)=\"drop($event)\"\n [cdkDropListConnectedTo]=\"[unSelectList]\"\n >\n\n <div\n class=\"img_box\"\n *ngFor=\"let picture of imgSelectedList; let index = index\"\n cdkDrag\n (cdkDragStarted)=\"dragStart = true;\"\n (cdkDragEnded)=\"dragStart = false;\"\n >\n\n <img\n *ngIf=\"index < 1\"\n class=\"drag__img\"\n [src]=\"picture.file_name | imgSrc : '400'\"\n [title]=\"picture.display_name\"\n />\n\n <img\n *ngIf=\"index > 0\"\n class=\"drag__img\"\n [src]=\"picture.file_name | imgSrc : '200'\"\n [title]=\"picture.display_name\"\n />\n\n <div class=\"delete-btn\" (click)=\"removeImg(index)\">{{'ImgManager.ImgSelection.deleteImg' | translate}}</div>\n\n <span class=\"drag__tooltips\">{{'ImgManager.ImgSelection.tooltips' | translate}}</span>\n\n </div>\n </div>\n</div>\n\n<!-- Loader -->\n<ng-container *ngIf=\"isLoading\">\n <wz-loader></wz-loader>\n</ng-container>\n"
2053
- }),
2054
- __metadata("design:paramtypes", [ImgSelectionService])
2055
- ], ImgSelectionComponent);
2056
-
2057
- let LoadingDirective = class LoadingDirective {
2058
- constructor(el) {
2059
- this.currentLoading = 0;
2060
- this.interval = null;
2061
- this.element = el;
2062
- this.launchLoading();
2063
- }
2064
- launchLoading() {
2065
- if (this.interval !== null) {
2066
- return;
2067
- }
2068
- this.currentLoading = 10;
2069
- this.element.nativeElement.style.width = this.currentLoading + '%';
2070
- this.interval = setInterval(() => {
2071
- if (this.currentLoading < 80) {
2072
- this.currentLoading += Math.floor(Math.random() * 15);
2073
- this.element.nativeElement.style.width = this.currentLoading + '%';
2074
- }
2075
- if (this.currentLoading >= 80 && this.currentLoading < 95) {
2076
- this.currentLoading += Math.floor(Math.random() * 2);
2077
- this.element.nativeElement.style.width = this.currentLoading + '%';
2078
- }
2079
- }, 70);
2080
- }
2081
- ngOnDestroy() {
2082
- if (this.interval) {
2083
- clearInterval(this.interval);
2084
- this.interval = null;
2085
- }
2086
- }
2087
- };
2088
- LoadingDirective.ctorParameters = () => [
2089
- { type: ElementRef }
2090
- ];
2091
- LoadingDirective = __decorate([
2092
- Directive({
2093
- selector: '[btnLoadingAnim]'
2094
- }),
2095
- __metadata("design:paramtypes", [ElementRef])
2096
- ], LoadingDirective);
2097
-
2098
- let AutoHideDirective = class AutoHideDirective {
2099
- constructor(_elementRef, domService) {
2100
- this._elementRef = _elementRef;
2101
- this.domService = domService;
2102
- this.forceOn = null;
2103
- this.clickOutside = new EventEmitter();
2104
- }
2105
- ngAfterViewInit() {
2106
- this.domService.documentEvent().subscribe((targetElement) => {
2107
- const clickedInside = this._elementRef.nativeElement.contains(targetElement);
2108
- const classNameFromElement = targetElement.getAttribute('class');
2109
- if (!clickedInside && (classNameFromElement === null || !classNameFromElement.includes(this.triggerElement))) {
2110
- this.clickOutside.emit(null);
2111
- }
2112
- if (this.forceOn != null && classNameFromElement !== null) {
2113
- let needToClose = true;
2114
- this.forceOn.forEach(v => {
2115
- if (!classNameFromElement.includes(v)) {
2116
- needToClose = false;
2117
- }
2118
- });
2119
- if (needToClose) {
2120
- this.clickOutside.emit(null);
2121
- }
2122
- }
2123
- });
2124
- }
2125
- };
2126
- AutoHideDirective.ctorParameters = () => [
2127
- { type: ElementRef },
2128
- { type: DomService }
2129
- ];
2130
- __decorate([
2131
- Input(),
2132
- __metadata("design:type", String)
2133
- ], AutoHideDirective.prototype, "triggerElement", void 0);
2134
- __decorate([
2135
- Input(),
2136
- __metadata("design:type", Array)
2137
- ], AutoHideDirective.prototype, "forceOn", void 0);
2138
- __decorate([
2139
- Output('clickOutside'),
2140
- __metadata("design:type", EventEmitter)
2141
- ], AutoHideDirective.prototype, "clickOutside", void 0);
2142
- AutoHideDirective = __decorate([
2143
- Directive({
2144
- selector: '[wzAutoHide]'
2145
- }),
2146
- __metadata("design:paramtypes", [ElementRef, DomService])
2147
- ], AutoHideDirective);
2148
-
2149
- let CopyClipboardDirective = class CopyClipboardDirective {
2150
- constructor() {
2151
- this.copied = new EventEmitter();
2152
- }
2153
- onClick(event) {
2154
- event.preventDefault();
2155
- if (!this.payload)
2156
- return;
2157
- let listener = (e) => {
2158
- let clipboard = e.clipboardData || window["clipboardData"];
2159
- clipboard.setData("text", this.payload.toString());
2160
- e.preventDefault();
2161
- this.copied.emit(this.payload);
2162
- };
2163
- document.addEventListener("copy", listener, false);
2164
- document.execCommand("copy");
2165
- document.removeEventListener("copy", listener, false);
2166
- }
2167
- };
2168
- __decorate([
2169
- Input("copy-clipboard"),
2170
- __metadata("design:type", String)
2171
- ], CopyClipboardDirective.prototype, "payload", void 0);
2172
- __decorate([
2173
- Output("copied"),
2174
- __metadata("design:type", EventEmitter)
2175
- ], CopyClipboardDirective.prototype, "copied", void 0);
2176
- __decorate([
2177
- HostListener("click", ["$event"]),
2178
- __metadata("design:type", Function),
2179
- __metadata("design:paramtypes", [MouseEvent]),
2180
- __metadata("design:returntype", void 0)
2181
- ], CopyClipboardDirective.prototype, "onClick", null);
2182
- CopyClipboardDirective = __decorate([
2183
- Directive({ selector: '[copy-clipboard]' })
2184
- ], CopyClipboardDirective);
2185
-
2186
- let DropdownComponent = class DropdownComponent {
2187
- constructor() {
2188
- this.disable = false;
2189
- }
2190
- ngOnInit() {
2191
- }
2192
- };
2193
- __decorate([
2194
- Input(),
2195
- __metadata("design:type", String)
2196
- ], DropdownComponent.prototype, "dropDownMenuClass", void 0);
2197
- __decorate([
2198
- Input(),
2199
- __metadata("design:type", Boolean)
2200
- ], DropdownComponent.prototype, "disable", void 0);
2201
- DropdownComponent = __decorate([
2202
- Component({
2203
- selector: 'dropdown',
2204
- template: "<div class=\"dropdown dropdownWizi\" [ngClass]=\"{'is-hoverable': !disable}\">\n <div class=\"dropdown-trigger\">\n\n <!-- Label -->\n <ng-content select=\"[label]\"></ng-content>\n\n </div>\n <div class=\"dropdown-menu\" [ngClass]=\"dropDownMenuClass\" role=\"menu\">\n <div class=\"dropdown-content\">\n\n <!-- Content -->\n <ng-content select=\"[item]\"></ng-content>\n\n </div>\n </div>\n</div>"
2205
- }),
2206
- __metadata("design:paramtypes", [])
2207
- ], DropdownComponent);
2208
-
2209
- let EditorInfoSectionComponent = class EditorInfoSectionComponent {
2210
- constructor(alertService) {
2211
- this.alertService = alertService;
2212
- this._isNameModified = false;
2213
- this.isNameModifiedChange = new EventEmitter();
2214
- this.msgCopyToClipBoard = 'ImgManager.ImgEditor.copytoClipBoard';
2215
- }
2216
- set isNameModified(isNameModified) {
2217
- this._isNameModified = isNameModified;
2218
- }
2219
- get isNameModified() {
2220
- return this._isNameModified;
2221
- }
2222
- ngOnInit() {
2223
- this.init();
2224
- }
2225
- init() {
2226
- this.imgName = this.imgToEdit.display_name;
2227
- }
2228
- getFileSize() {
2229
- return this.imgToEdit ? Math.round(parseInt(this.imgToEdit.size) / 1000) : '-';
2230
- }
2231
- copyToClipBoard(event) {
2232
- this.alertService.openAlert(this.msgCopyToClipBoard);
2233
- }
2234
- onNameChange() {
2235
- this.isNameModifiedChange.emit(true);
2236
- }
2237
- };
2238
- EditorInfoSectionComponent.ctorParameters = () => [
2239
- { type: AlertService }
2240
- ];
2241
- __decorate([
2242
- Input(),
2243
- __metadata("design:type", Object)
2244
- ], EditorInfoSectionComponent.prototype, "imgToEdit", void 0);
2245
- __decorate([
2246
- Input(),
2247
- __metadata("design:type", Boolean),
2248
- __metadata("design:paramtypes", [Boolean])
2249
- ], EditorInfoSectionComponent.prototype, "isNameModified", null);
2250
- __decorate([
2251
- Output(),
2252
- __metadata("design:type", Object)
2253
- ], EditorInfoSectionComponent.prototype, "isNameModifiedChange", void 0);
2254
- EditorInfoSectionComponent = __decorate([
2255
- Component({
2256
- selector: 'info-section',
2257
- template: "\n<!-- Img properties -->\n<div class=\"img-editor__infoSection__propertyEditable\">\n <p class=\"mainColor\">\n {{ 'ImgManager.UploadList.properties.imgName' | translate }}\n <span class=\"img-editor__infoSection__propertyEditable__tooltips\" [nwbToolTip]=\"'ImgManager.ImgEditor.NameInfo' | translate\" [nwbToolTipIsMultiline]=\"true\" nwbToolTipPosition=\"right\"><i class=\"fas fa-info-circle\"></i></span>\n </p>\n <input\n type=\"text\"\n class=\"img-editor__infoSection__propertyEditable__input\"\n placeholder=\"{{'ImgManager.ImgEditor.nameEx' | translate}} \"\n [(ngModel)]=\"imgToEdit.display_name\"\n debounceKeyUp\n [debounceTime]=\"500\"\n (onEventChange)=\"onNameChange()\">\n</div>\n<div class=\"img-editor__infoSection__propertyEditable\">\n <p class=\"mainColor\">{{ 'ImgManager.UploadList.properties.imgURL' | translate }}</p>\n <button [copy-clipboard]=\"imgToEdit.file_name | imgSrc : 'raw'\" (copied)=\"copyToClipBoard($event)\" ><span class=\"img-editor__infoSection__propertyEditable__span\">{{imgToEdit.file_name}}</span>&nbsp;&nbsp;<i class=\"far fa-copy\"></i></button>\n</div>\n<div class=\"img-editor__infoSection__property\">\n <p class=\"mainColor\">{{ 'ImgManager.UploadList.properties.imgSize' | translate }}&nbsp;:</p>\n <p>{{imgToEdit.raw_height}}*{{imgToEdit.raw_width}}px</p>\n</div>\n<div class=\"img-editor__infoSection__property\">\n <p class=\"mainColor\">{{ 'ImgManager.UploadList.properties.imgWeight' | translate }}&nbsp;:</p>\n <p >{{getFileSize()}}&nbsp;ko</p>\n</div>\n\n<!-- SEO info -->\n\n<span class=\"img-editor__infoSection__divider\"></span>\n\n<div class=\"img-editor__infoSection__titleSEO\">\n <p class=\"mainColor\">{{ 'ImgManager.UploadList.seo.title' | translate }}</p>\n</div>\n\n<div class=\"img-editor__infoSection__propertySEO\">\n <p class=\"mainColor\">{{ 'ImgManager.UploadList.seo.rezise' | translate }}</p>\n <p><i class=\"fal fa-check\"></i>&nbsp;100%</p>\n <p class=\"img-editor__infoSection__propertySEO__tooltips\" [nwbToolTip]=\"'ImgManager.UploadList.seo.reziseTooltips' | translate\" [nwbToolTipIsMultiline]=\"true\" nwbToolTipPosition=\"right\"><i class=\"fas fa-info-circle\"></i></p>\n</div>\n<div class=\"img-editor__infoSection__propertySEO\">\n <p class=\"mainColor\">{{ 'ImgManager.UploadList.seo.webp' | translate }}</p>\n <p><i class=\"fal fa-check\"></i>&nbsp;100%</p>\n <p class=\"img-editor__infoSection__propertySEO__tooltips\" [nwbToolTip]=\"'ImgManager.UploadList.seo.webpTooltips' | translate\" [nwbToolTipIsMultiline]=\"true\" nwbToolTipPosition=\"right\"><i class=\"fas fa-info-circle\"></i></p>\n</div>\n<div class=\"img-editor__infoSection__propertySEO\">\n <p class=\"mainColor\">{{ 'ImgManager.UploadList.seo.cdn' | translate }}</p>\n <p><i class=\"fal fa-check\"></i>&nbsp;100%</p>\n <p class=\"img-editor__infoSection__propertySEO__tooltips\" [nwbToolTip]=\"'ImgManager.UploadList.seo.cdnTooltips' | translate\" [nwbToolTipIsMultiline]=\"true\" nwbToolTipPosition=\"right\"><i class=\"fas fa-info-circle\"></i></p>\n\n</div>\n<div class=\"img-editor__infoSection__propertySEO\">\n <p class=\"mainColor\">{{ 'ImgManager.UploadList.seo.lazyloading' | translate }}</p>\n <p><i class=\"fal fa-check\"></i>&nbsp;100%</p>\n <p class=\"img-editor__infoSection__propertySEO__tooltips\" [nwbToolTip]=\"'ImgManager.UploadList.seo.lazyloadingTooltips' | translate\" [nwbToolTipIsMultiline]=\"true\" nwbToolTipPosition=\"right\"><i class=\"fas fa-info-circle\"></i></p>\n</div>\n"
2258
- }),
2259
- __metadata("design:paramtypes", [AlertService])
2260
- ], EditorInfoSectionComponent);
2261
-
2262
- const insertRemove = // the fade-in/fade-out animation.
2263
- trigger('insertRemoveAnnim', [
2264
- transition(':enter', [
2265
- style({ opacity: 0 }),
2266
- animate('0.5s ease-in-out', style({ opacity: 1 })),
2267
- ])
2268
- ]);
2269
-
2270
- let CropperComponent = class CropperComponent {
2271
- constructor(imgCDNService) {
2272
- this.imgCDNService = imgCDNService;
2273
- this._isImgModified = false;
2274
- this.isImgModifiedChange = new EventEmitter();
2275
- this.editClosed = new EventEmitter();
2276
- this.currentCroppedImageChange = new EventEmitter();
2277
- this.msgFailLoad = 'ImgManager.ImgEditor.msgFailLoad';
2278
- this.isNameModified = false;
2279
- this.isCropperReady = false; // Use to not display the crop validation btn, after the img is loaded or changed
2280
- this.currentCroppedImage = ''; // Img modified return in base64
2281
- this.isCropped = false;
2282
- this.isLoading = false;
2283
- this._isImgCropped = false;
2284
- this.imgCropperChange = new Subject();
2285
- this.skipNextImgCropped = 1;
2286
- this.imageChangedEvent = '';
2287
- this.croppedImage = '';
2288
- this.canvasRotation = 0;
2289
- this.rotation = 0;
2290
- this.scale = 1;
2291
- this.showCropper = false;
2292
- this.containWithinAspectRatio = false;
2293
- this.transform = {};
2294
- // dropdown list
2295
- this.resolutionConfig = [
2296
- {
2297
- label: 'ImgManager.ImgEditor.config.origin',
2298
- config: {
2299
- maintainAspectRatio: true
2300
- },
2301
- },
2302
- {
2303
- label: 'ImgManager.ImgEditor.config.free',
2304
- config: {
2305
- maintainAspectRatio: false
2306
- },
2307
- active: true
2308
- },
2309
- {
2310
- label: 'ImgManager.ImgEditor.config.square',
2311
- config: {
2312
- maintainAspectRatio: true,
2313
- aspectRatio: 1 / 1
2314
- }
2315
- },
2316
- {
2317
- label: 'ImgManager.ImgEditor.config.Portrait',
2318
- config: {
2319
- maintainAspectRatio: true,
2320
- aspectRatio: 3 / 4
2321
- }
2322
- },
2323
- {
2324
- label: 'ImgManager.ImgEditor.config.landscape',
2325
- config: {
2326
- maintainAspectRatio: true,
2327
- aspectRatio: 5 / 3
2328
- }
2329
- }
2330
- ];
2331
- this.rotationConfig = [
2332
- {
2333
- label: 'ImgManager.ImgEditor.config.schedule',
2334
- icon: "fal fa-redo-alt",
2335
- method: "rotateRight",
2336
- active: true
2337
- },
2338
- {
2339
- label: 'ImgManager.ImgEditor.config.AntiSchedule',
2340
- icon: "fal fa-undo-alt",
2341
- method: "rotateLeft"
2342
- },
2343
- {
2344
- label: 'ImgManager.ImgEditor.config.flipVert',
2345
- icon: "fal fa-sort-alt",
2346
- method: "flipVertical"
2347
- },
2348
- {
2349
- label: 'ImgManager.ImgEditor.config.flipHoriz',
2350
- icon: "fal fa-exchange-alt",
2351
- method: "flipHorizontal"
2352
- }
2353
- ];
2354
- this.zoomConfig = [
2355
- {
2356
- label: 'ImgManager.ImgEditor.config.zoom',
2357
- icon: "fal fa-search-plus",
2358
- method: "zoomIn",
2359
- active: true
2360
- },
2361
- {
2362
- label: 'ImgManager.ImgEditor.config.dezoom',
2363
- icon: "fal fa-search-minus",
2364
- method: "zoomOut"
2365
- }
2366
- ];
2367
- // Img cropper variables
2368
- this.imgCropperConfig = {
2369
- maintainAspectRatio: false,
2370
- aspectRatio: undefined
2371
- };
2372
- }
2373
- set isImgModified(isImgModified) {
2374
- this._isImgModified = isImgModified;
2375
- if (!isImgModified) {
2376
- this.restartEdit();
2377
- }
2378
- }
2379
- get isImgModified() {
2380
- return this._isImgModified;
2381
- }
2382
- set isImgCropped(isImgCropped) {
2383
- setTimeout(() => {
2384
- this._isImgCropped = isImgCropped;
2385
- }, 0);
2386
- }
2387
- get isImgCropped() {
2388
- return this._isImgCropped;
2389
- }
2390
- ngOnInit() {
2391
- this.init();
2392
- this.detectImgCropperChange();
2393
- }
2394
- init() {
2395
- this.imgRoute = this.getRAWImgRoute();
2396
- this.imgType = this.getImgType();
2397
- this.croppedImage = null;
2398
- this.setDefautAspectRatio();
2399
- }
2400
- getRAWImgRoute() {
2401
- return this.imgCDNService.getUrlImg('raw') + this.imgToEdit.file_name;
2402
- }
2403
- getImgType() {
2404
- return this.imgToEdit.file_name ? this.imgToEdit.file_name.split('.').pop() : undefined;
2405
- }
2406
- setDefautAspectRatio() {
2407
- const height = parseInt(this.imgToEdit.raw_height);
2408
- const width = parseInt(this.imgToEdit.raw_width);
2409
- this.defaultAspectRatio = height / width;
2410
- this.resolutionConfig[0].config.aspectRatio = this.defaultAspectRatio;
2411
- this.imgCropperConfig.aspectRatio = this.defaultAspectRatio;
2412
- }
2413
- onEditClosed(msgKey) {
2414
- this.editClosed.emit(msgKey);
2415
- }
2416
- onRestart() {
2417
- this.isImgModifiedChange.emit(false);
2418
- }
2419
- restartEdit() {
2420
- this.init();
2421
- this.resetConfCropper();
2422
- }
2423
- onImgModified() {
2424
- this.isImgModified = true;
2425
- this.isImgModifiedChange.emit(true);
2426
- }
2427
- ////// Img cropper methods ////////////////////////////////////////////////////////////////////////////////////////////////////////
2428
- /* Cropper output events */
2429
- fileChangeEvent(event) {
2430
- this.imageChangedEvent = event;
2431
- }
2432
- imageCropped(event) {
2433
- this.imgCropperChange.next();
2434
- this.currentCroppedImage = event.base64;
2435
- this.currentCroppedImageChange.emit(this.currentCroppedImage);
2436
- }
2437
- imageLoaded() {
2438
- this.showCropper = true;
2439
- }
2440
- cropperReady() {
2441
- this.isCropperReady = true;
2442
- }
2443
- loadImageFailed() {
2444
- this.onEditClosed(this.msgFailLoad);
2445
- }
2446
- /* Resize functions */
2447
- changeResolutionSize(index) {
2448
- this.setActiveItem(this.resolutionConfig, index);
2449
- const config = this.resolutionConfig[index].config;
2450
- this.setCropperProperties(config);
2451
- }
2452
- confirmCrop() {
2453
- setTimeout(() => {
2454
- this.imgRoute = null;
2455
- this.croppedImage = this.currentCroppedImage;
2456
- this.skipNextImgCropped = 2;
2457
- this.isImgCropped = false;
2458
- }, 0);
2459
- this.resetConfCropper();
2460
- this.onImgModified();
2461
- }
2462
- resetConfCropper() {
2463
- this.scale = 1;
2464
- this.rotation = 0;
2465
- this.canvasRotation = 0;
2466
- this.transform = {};
2467
- }
2468
- setActiveItem(array, index) {
2469
- // Set active-item class for the dropdown
2470
- array.forEach((item, indexItem) => {
2471
- item.active = indexItem === index ? true : false;
2472
- });
2473
- }
2474
- setCropperProperties(config) {
2475
- for (const property in config) {
2476
- this.imgCropperConfig[property] = config[property];
2477
- }
2478
- }
2479
- detectImgCropperChange() {
2480
- this.imgCropperChange
2481
- .subscribe(() => {
2482
- this.skipNextImgCropped--;
2483
- if (this.skipNextImgCropped >= 0) {
2484
- return;
2485
- }
2486
- this.skipNextImgCropped = 0;
2487
- this.isImgCropped = true;
2488
- });
2489
- }
2490
- /* Rotations functions */
2491
- rotateLeft() {
2492
- this.canvasRotation--;
2493
- this.flipAfterRotate();
2494
- this.onImgModified();
2495
- }
2496
- rotateRight() {
2497
- this.canvasRotation++;
2498
- this.flipAfterRotate();
2499
- this.onImgModified();
2500
- }
2501
- flipHorizontal() {
2502
- this.transform = Object.assign(Object.assign({}, this.transform), { flipH: !this.transform.flipH });
2503
- this.onImgModified();
2504
- }
2505
- flipVertical() {
2506
- this.transform = Object.assign(Object.assign({}, this.transform), { flipV: !this.transform.flipV });
2507
- this.onImgModified();
2508
- }
2509
- flipAfterRotate() {
2510
- const flippedH = this.transform.flipH;
2511
- const flippedV = this.transform.flipV;
2512
- this.transform = Object.assign(Object.assign({}, this.transform), { flipH: flippedV, flipV: flippedH });
2513
- }
2514
- /* Zoom functions */
2515
- zoomOut() {
2516
- this.scale -= this.scale < 0.2 ? 0 : .1;
2517
- this.transform = Object.assign(Object.assign({}, this.transform), { scale: this.scale });
2518
- this.onImgModified();
2519
- }
2520
- zoomIn() {
2521
- this.scale += .1;
2522
- this.transform = Object.assign(Object.assign({}, this.transform), { scale: this.scale });
2523
- this.onImgModified();
2524
- }
2525
- applyMethod(method) {
2526
- this[method](); // call the method contains in zoomConfig or rotationConfig
2527
- }
2528
- };
2529
- CropperComponent.ctorParameters = () => [
2530
- { type: ImgCDNService }
2531
- ];
2532
- __decorate([
2533
- Input(),
2534
- __metadata("design:type", Object)
2535
- ], CropperComponent.prototype, "imgToEdit", void 0);
2536
- __decorate([
2537
- Input(),
2538
- __metadata("design:type", Boolean),
2539
- __metadata("design:paramtypes", [Boolean])
2540
- ], CropperComponent.prototype, "isImgModified", null);
2541
- __decorate([
2542
- Output(),
2543
- __metadata("design:type", Object)
2544
- ], CropperComponent.prototype, "isImgModifiedChange", void 0);
2545
- __decorate([
2546
- Output(),
2547
- __metadata("design:type", Object)
2548
- ], CropperComponent.prototype, "editClosed", void 0);
2549
- __decorate([
2550
- Output(),
2551
- __metadata("design:type", Object)
2552
- ], CropperComponent.prototype, "currentCroppedImageChange", void 0);
2553
- CropperComponent = __decorate([
2554
- Component({
2555
- selector: 'cropper',
2556
- template: "<div class=\"img-editor__container__toolsContainer\">\n\n <div *ngIf=\"isImgCropped\">\n <div\n class=\"img-editor__container__toolsContainer__tool img-editor__container__toolsContainer__tool--button\"\n (click)=\"confirmCrop()\"\n [nwbToolTip]=\"'ImgManager.ImgEditor.ValidtToolTip' | translate\"\n nwbToolTipPosition=\"left\"\n >\n <i class=\"far fa-check\"></i>\n <p>{{ 'ImgManager.ImgEditor.Valid' | translate }}</p>\n </div>\n </div>\n\n <!-- Resolution -->\n <dropdown dropdownId=\"dropdown-resolution\">\n <ng-container label>\n <div\n class=\"img-editor__container__toolsContainer__tool\"\n >\n <i class=\"far fa-crop\"></i>\n <p>{{ 'ImgManager.ImgEditor.crop' | translate }}</p>\n </div>\n </ng-container>\n <ng-container item *ngFor=\"let item of resolutionConfig; let index = index;\">\n <div\n class=\"dropdown-item\"\n [ngClass]=\"{'active-item': item.active}\"\n (click)=\"changeResolutionSize(index)\">\n <p>{{item.label | translate}}</p>\n </div>\n </ng-container>\n </dropdown>\n\n <!-- Zoom -->\n <dropdown dropdownId=\"dropdown-rotation\">\n <ng-container label>\n <div class=\"img-editor__container__toolsContainer__tool\" (click)=\"zoomIn()\">\n <i class=\"far fa-expand-arrows-alt\"></i>\n <p>{{ 'ImgManager.ImgEditor.display' | translate }}</p>\n </div>\n </ng-container>\n <ng-container item *ngFor=\"let item of zoomConfig; let index = index;\">\n <div\n class=\"dropdown-item\"\n [ngClass]=\"{'active-item': item.active}\"\n (click)=\"applyMethod(item.method)\">\n <i *ngIf=\"item.icon\" [ngClass]=\"item.icon\"></i>\n <p>{{item.label | translate}}</p>\n </div>\n </ng-container>\n </dropdown>\n\n <!-- Rotation -->\n <dropdown dropdownId=\"dropdown-rotation\" dropDownMenuClass=\"img-editor__container__toolsContainer__RotationDropdown\">\n <ng-container label>\n <div class=\"img-editor__container__toolsContainer__tool\" (click)=\"rotateRight()\">\n <i class=\"far fa-redo\"></i>\n <p>{{ 'ImgManager.ImgEditor.rotation' | translate }}</p>\n </div>\n </ng-container>\n <ng-container item *ngFor=\"let item of rotationConfig; let index = index;\">\n <div\n class=\"dropdown-item\"\n [ngClass]=\"{'active-item': item.active}\"\n (click)=\"applyMethod(item.method)\">\n <i *ngIf=\"item.icon\" [ngClass]=\"item.icon\"></i>\n <p>{{item.label | translate}}</p>\n </div>\n </ng-container>\n </dropdown>\n\n <div\n class=\"img-editor__container__toolsContainer__tool\"\n (click)=\"onRestart()\"\n @insertRemoveAnnim\n >\n <i class=\"far fa-retweet-alt\"></i>\n <p>{{ 'ImgManager.ImgEditor.restart' | translate }}</p>\n </div>\n</div>\n\n<div class=\"img-editor__image-cropper\" >\n <image-cropper\n [imageURL]=\"imgRoute\"\n [imageBase64]=\"croppedImage\"\n [maintainAspectRatio]=\"imgCropperConfig.maintainAspectRatio\"\n [containWithinAspectRatio]=\"containWithinAspectRatio\"\n [aspectRatio]=\"imgCropperConfig.aspectRatio\"\n [onlyScaleDown]=\"true\"\n [roundCropper]=\"false\"\n [canvasRotation]=\"canvasRotation\"\n [transform]=\"transform\"\n [alignImage]=\"'center'\"\n [style.display]=\"showCropper ? null : 'none'\"\n [format]=\"imgType\"\n [backgroundColor]=\"'white'\"\n (imageCropped)=\"imageCropped($event)\"\n (imageLoaded)=\"imageLoaded()\"\n (cropperReady)=\"cropperReady()\"\n (loadImageFailed)=\"loadImageFailed()\"\n ></image-cropper>\n</div>\n",
2557
- animations: [
2558
- insertRemove
2559
- ]
2560
- }),
2561
- __metadata("design:paramtypes", [ImgCDNService])
2562
- ], CropperComponent);
2563
-
2564
- let ImagesViewComponent = class ImagesViewComponent {
2565
- constructor(imgManager, imgEventService, imgSelectionService, alertService, userSettingsService, renamePictureService) {
2566
- this.imgManager = imgManager;
2567
- this.imgEventService = imgEventService;
2568
- this.imgSelectionService = imgSelectionService;
2569
- this.alertService = alertService;
2570
- this.userSettingsService = userSettingsService;
2571
- this.renamePictureService = renamePictureService;
2572
- this.listDisplayed = false; // Display format list or mosaic
2573
- this.multipleImgMode = false;
2574
- this.switchDisplayWindow = new EventEmitter();
2575
- // Data filters
2576
- this.tableFilters = {
2577
- sort: undefined,
2578
- order: undefined,
2579
- searchValue: '',
2580
- totalItems: 0,
2581
- itemsPerPage: 0,
2582
- currentPage: 1
2583
- };
2584
- this.widthLargeCard = 219; // Default value of a card width 199 + margin 20
2585
- this.widthSmallCard = 160; // Default value of a card width 140 + margin 20
2586
- this.nbFakeImg = 0;
2587
- this.imgFullWidthConfig = [
2588
- {
2589
- max: 419,
2590
- largeImgWidthFactor: 1,
2591
- smallImgWidthFactor: 0.5
2592
- },
2593
- {
2594
- max: 499,
2595
- largeImgWidthFactor: 1,
2596
- smallImgWidthFactor: 0.5
2597
- },
2598
- {
2599
- max: 719,
2600
- largeImgWidthFactor: 0.5,
2601
- smallImgWidthFactor: 0.3333
2602
- },
2603
- {
2604
- max: 1023,
2605
- largeImgWidthFactor: 0.3333,
2606
- smallImgWidthFactor: 0.2
2607
- },
2608
- {
2609
- max: 1399,
2610
- largeImgWidthFactor: 0.25,
2611
- smallImgWidthFactor: 0.125
2612
- },
2613
- {
2614
- max: 1599,
2615
- largeImgWidthFactor: 0.2,
2616
- smallImgWidthFactor: 0.1111
2617
- },
2618
- {
2619
- largeImgWidthFactor: 0.1666,
2620
- smallImgWidthFactor: 0.1
2621
- }
2622
- ];
2623
- this.imgWidthConfig = [
2624
- {
2625
- max: 1024,
2626
- largeImgWidthFactor: 0.25,
2627
- smallImgWidthFactor: 0.125
2628
- },
2629
- {
2630
- max: 1199,
2631
- largeImgWidthFactor: 0.3333,
2632
- smallImgWidthFactor: 0.2
2633
- },
2634
- {
2635
- max: 1299,
2636
- largeImgWidthFactor: 0.3333,
2637
- smallImgWidthFactor: 0.1666
2638
- },
2639
- {
2640
- max: 1399,
2641
- largeImgWidthFactor: 0.25,
2642
- smallImgWidthFactor: 0.1666
2643
- },
2644
- {
2645
- max: 1599,
2646
- largeImgWidthFactor: 0.25,
2647
- smallImgWidthFactor: 0.14
2648
- },
2649
- {
2650
- largeImgWidthFactor: 0.25,
2651
- smallImgWidthFactor: 0.125
2652
- }
2653
- ];
2654
- this.searchQueryChanged = new Subject();
2655
- this.filtersChanged = new Subject();
2656
- this.picturesList = [];
2657
- this.savePictureList = [];
2658
- this.nbImgToDelSelected = 0;
2659
- this.disable = false; // Use to disable action during server request
2660
- this.isLoading = true;
2661
- this.isTotalRetieved = false;
2662
- this.delListImgLoader = false;
2663
- this.initComponent = true;
2664
- this.failLoaded = false;
2665
- this.displayPexelsResults = false; // Use when no img find by name, display img from Pexels
2666
- this.confirmImgSup = false;
2667
- // Paginator Params
2668
- this.pageIndex = 0;
2669
- this.length = 0;
2670
- this.pageSize = 30; // Default value
2671
- this.pageSizeOptions = [25, 50, 100, 250];
2672
- this.errorGetAllImg = 'ImgManager.ImgLib.errorGetAllImg';
2673
- this.errorGetTotalImg = 'ImgManager.ImgLib.errorGetTotalImg';
2674
- this.errorGetImg = 'ImgManager.ImgLib.errorGetCanvaImg';
2675
- this.msgNoImgFound = 'ImgManager.ImgLib.noImgFound';
2676
- this.errorRemoveImg = 'ImgManager.ImgList.errorRemoveImg';
2677
- }
2678
- ngOnInit() {
2679
- /* if (this.maxLengthCardShow) {
2680
- this.reducePictureListMaxLength();
2681
- } */
2682
- this.setEvents();
2683
- this.imgSelectedList = this.imgSelectionService.getImgSelection();
2684
- }
2685
- ngAfterViewInit() {
2686
- this.setNbImgToDisplay();
2687
- this._getImgList();
2688
- if (!this.savePictureList) {
2689
- this.savePictureList = this.picturesList;
2690
- }
2691
- }
2692
- /* reducePictureListMaxLength() {
2693
- this.picturesList.splice(0, this.maxLengthCardShow);
2694
- } */
2695
- getImgList() {
2696
- this.filtersChanged.next();
2697
- }
2698
- /**
2699
- * true : go to list display
2700
- * false : go to mosaic display
2701
- * @param activate
2702
- */
2703
- onSwitchFormatDisplayed(activate) {
2704
- this.listDisplayed = activate;
2705
- this.userSettingsService.setUserDisplayPreference(activate);
2706
- this.imgEventService.emitlistDisplayedChange(activate);
2707
- }
2708
- /**
2709
- * Calcul the number of img selected for masse deletion
2710
- */
2711
- onImgSelected() {
2712
- this.setNbImgToDelSelected();
2713
- }
2714
- onShowImgUploaded() {
2715
- this.searchText = null;
2716
- this.searchedValue = null;
2717
- this.getImgList();
2718
- }
2719
- onRenamePicture(pictureRenamed) {
2720
- console.log('onRenamePicture pictureRenamed', pictureRenamed);
2721
- this.renamePictureService.onRenamePicture(pictureRenamed);
2722
- }
2723
- removeListImg() {
2724
- if (this.disable) {
2725
- return;
2726
- }
2727
- this.disable = true;
2728
- this.delListImgLoader = true;
2729
- this.confirmImgSup = false;
2730
- // Get the id of the img to remove
2731
- // And add deleted property
2732
- const idImgToRemove = [];
2733
- this.picturesList.forEach(img => {
2734
- if (img.delSelected) {
2735
- img.deleted = true;
2736
- idImgToRemove.push(img.id_file);
2737
- }
2738
- });
2739
- this.imgManager.removeMultipleImg(idImgToRemove).subscribe(() => {
2740
- this.getImgList();
2741
- this.imgSelectionService.removeImgSelectionByIds(idImgToRemove);
2742
- }, error => {
2743
- this.getImgList();
2744
- this.alertService.openAlert(this.errorRemoveImg);
2745
- });
2746
- }
2747
- selectImgChosen() {
2748
- if (this.disable) {
2749
- return;
2750
- }
2751
- const picturesListSelected = [];
2752
- this.picturesList.map(img => {
2753
- if (img.delSelected) {
2754
- img.delSelected = false;
2755
- img.selected = true;
2756
- }
2757
- if (img.selected) {
2758
- picturesListSelected.push(img);
2759
- }
2760
- });
2761
- this.setNbImgToDelSelected();
2762
- this.imgSelectionService.setImgSelection(picturesListSelected);
2763
- }
2764
- displayConfirmImgSup() {
2765
- if (this.disable) {
2766
- return;
2767
- }
2768
- this.confirmImgSup = true;
2769
- }
2770
- cancelSup() {
2771
- this.confirmImgSup = false;
2772
- }
2773
- /**
2774
- * Event emit when a img selected in order to delete
2775
- */
2776
- onPicturesListChange() {
2777
- this.setNbImgToDelSelected();
2778
- }
2779
- onFiltersChange() {
2780
- this.getImgList();
2781
- }
2782
- /**
2783
- * Set default number of img per page to display at the initialisation
2784
- * This number is between 30 and 50
2785
- */
2786
- setNbImgToDisplay() {
2787
- const containerWidth = this.imgLibContainer.nativeElement.offsetWidth + 30; // + 30px -> left + right margin
2788
- const scrollWidth = window.innerWidth - document.body.offsetWidth;
2789
- const [maxImgWidthFactor, minImgWidthFactor] = this.getImgWidthFactors();
2790
- const minImgWidth = Math.floor(containerWidth * minImgWidthFactor);
2791
- const maxImgWidth = Math.ceil((containerWidth + scrollWidth) * maxImgWidthFactor);
2792
- this.nbMaxImgPerLine = Math.floor(containerWidth / minImgWidth);
2793
- this.nbMinImgPerLine = Math.floor((containerWidth + scrollWidth) / maxImgWidth);
2794
- this.pageSize = this.getTotalImgPerPage();
2795
- }
2796
- getImgWidthFactors() {
2797
- const screenWidth = window.innerWidth;
2798
- let minWidth = 0;
2799
- let imgSizesConfig = [];
2800
- const currentImgWidthConfig = this.fullSize ? this.imgFullWidthConfig : this.imgWidthConfig;
2801
- for (const widthConfig of currentImgWidthConfig) {
2802
- if (!widthConfig.max) {
2803
- imgSizesConfig = [widthConfig.largeImgWidthFactor, widthConfig.smallImgWidthFactor];
2804
- break;
2805
- }
2806
- if (minWidth < screenWidth && screenWidth <= widthConfig.max) {
2807
- imgSizesConfig = [widthConfig.largeImgWidthFactor, widthConfig.smallImgWidthFactor];
2808
- break;
2809
- }
2810
- minWidth = widthConfig.max;
2811
- }
2812
- return imgSizesConfig;
2813
- }
2814
- getTotalImgPerPage() {
2815
- if (this.nbRowToShow) {
2816
- const nbImgPerLine = this.stateDisplayed === 'full' ? this.nbMinImgPerLine : this.nbMaxImgPerLine;
2817
- return nbImgPerLine * this.nbRowToShow;
2818
- }
2819
- let total = this.nbMinImgPerLine;
2820
- while (total < 30 || total % this.nbMaxImgPerLine !== 0 || total % this.nbMinImgPerLine !== 0) {
2821
- total += this.nbMinImgPerLine;
2822
- }
2823
- return total;
2824
- }
2825
- setParams() {
2826
- var _a;
2827
- this.params = {
2828
- limit: ((_a = this.maxLengthCardShow) === null || _a === void 0 ? void 0 : _a.toString()) || (this.tableFilters.itemsPerPage ? this.tableFilters.itemsPerPage.toString() : this.pageSize.toString()),
2829
- page: this.tableFilters.currentPage.toString()
2830
- };
2831
- if (this.tableFilters.searchValue) {
2832
- this.params["display_name:contains"] = this.tableFilters.searchValue.toString();
2833
- }
2834
- }
2835
- initVariables(loadingSuccess) {
2836
- this.nbImgToDelSelected = 0;
2837
- this.disable = false;
2838
- this.isLoading = false;
2839
- this.delListImgLoader = false;
2840
- this.initComponent = false;
2841
- this.displayPexelsResults = false;
2842
- this.failLoaded = !loadingSuccess;
2843
- this.nbFakeImg = 0;
2844
- }
2845
- selectImgSelected() {
2846
- if (!this.imgSelectedList || !this.imgSelectedList.length) {
2847
- return;
2848
- }
2849
- const idImgSlectedList = [];
2850
- this.imgSelectedList.forEach(img => idImgSlectedList.push(img.id_file));
2851
- this.picturesList.forEach(picture => {
2852
- if (idImgSlectedList.indexOf(picture.id_file) !== -1) {
2853
- picture.selected = true;
2854
- }
2855
- });
2856
- }
2857
- displayPexelsLib() {
2858
- this.displayPexelsResults = true;
2859
- this.alertService.openAlert(this.msgNoImgFound);
2860
- }
2861
- /**
2862
- * Set a img list in order to fill properly all the line of images displayed in mosaic.
2863
- * Otherwise, the space-between css will do a bad display
2864
- */
2865
- calculNbImgFake(nbImgDisplayed) {
2866
- const nbImgPerLine = this.stateDisplayed === 'small' || this.tabDisplayed === 'img-upload' ? this.nbMaxImgPerLine : this.nbMinImgPerLine;
2867
- if (nbImgDisplayed % nbImgPerLine !== 0) {
2868
- this.nbFakeImg = nbImgPerLine - nbImgDisplayed % nbImgPerLine;
2869
- }
2870
- }
2871
- getImg(id_file) {
2872
- this.imgManager.getShopImg(id_file).pipe(take(1)).subscribe((picture) => {
2873
- if (!this.imgAlreadyExist(picture.id_file)) {
2874
- // check the img is not already present
2875
- this.picturesList.unshift(picture);
2876
- this.length += 1;
2877
- }
2878
- }, error => {
2879
- this.alertService.openAlert(this.errorGetImg);
2880
- });
2881
- }
2882
- imgAlreadyExist(id_file) {
2883
- for (const img of this.picturesList) {
2884
- if (img.id_file === id_file) {
2885
- return true;
2886
- }
2887
- }
2888
- return false;
2889
- }
2890
- setNbImgToDelSelected() {
2891
- this.nbImgToDelSelected = this.picturesList.filter(img => img.delSelected).length;
2892
- if (!this.nbImgToDelSelected) {
2893
- this.confirmImgSup = false;
2894
- }
2895
- }
2896
- setEvents() {
2897
- // Add a timer to retrieve img when the search bar or the paginator are used
2898
- this.searchQueryChanged
2899
- .pipe(debounceTime(400)) // wait 0.5 sec after the last event before emitting last event
2900
- .subscribe(data => {
2901
- this.getImgList();
2902
- });
2903
- this.filtersChanged
2904
- .pipe(debounceTime(800)) // wait 0.8 sec after the last event before emitting last event
2905
- .subscribe(data => {
2906
- this._getImgList();
2907
- });
2908
- // Reload img when img is/are removed
2909
- this.imgRemovedEvent = this.imgEventService.getImgRemovedEventListner().subscribe(id_file => {
2910
- this.getImgList();
2911
- });
2912
- // Create img from Canva
2913
- this.imgAddedEvent = this.imgEventService.getImgAddedEventListner().subscribe(id_file => {
2914
- if (id_file && !this.imgAlreadyExist(id_file)) {
2915
- this.getImg(id_file);
2916
- }
2917
- });
2918
- this.imgSelectionChange = this.imgSelectionService.getImgSelectionChange().subscribe(imgSelection => {
2919
- if (this.listDisplayed) {
2920
- return;
2921
- }
2922
- const idFileList = [];
2923
- imgSelection.map(img => idFileList.push(img.id_file));
2924
- for (const picture of this.picturesList) {
2925
- if (idFileList.indexOf(picture.id_file) === -1) {
2926
- picture.selected = false;
2927
- }
2928
- }
2929
- });
2930
- }
2931
- _getImgList() {
2932
- this.isLoading = true;
2933
- this.displayPexelsResults = false;
2934
- this.setParams();
2935
- this.refreshTotalImgList();
2936
- this.imgManager.getShopImgList(this.params).pipe(take(1)).subscribe((data) => {
2937
- this.initVariables(true);
2938
- const nbImgDisplayed = data.data.length;
2939
- this.calculNbImgFake(nbImgDisplayed);
2940
- this.picturesList = data.data;
2941
- this.renamePictureService.setPicturesList(this.picturesList);
2942
- this.selectImgSelected();
2943
- this.length = this.isTotalRetieved ? this.length : data.totalRecords;
2944
- this.tableFilters.totalItems = this.isTotalRetieved ? this.tableFilters.totalItems : data.totalRecords;
2945
- this.tableFilters.itemsPerPage = this.tableFilters.itemsPerPage ? this.tableFilters.itemsPerPage : this.pageSize;
2946
- // Display Pexels if no result
2947
- if (data.totalRecords === 0) {
2948
- this.displayPexelsLib();
2949
- }
2950
- }, error => {
2951
- this.alertService.openAlert(this.errorGetAllImg);
2952
- this.initVariables(false);
2953
- });
2954
- }
2955
- refreshTotalImgList() {
2956
- const searchValue = this.tableFilters.searchValue;
2957
- if (this.isTotalRetieved && searchValue === this.previousSearchValue) {
2958
- // Keep current total result
2959
- return;
2960
- }
2961
- this.isTotalRetieved = false;
2962
- this.imgManager.getShopTotalImgList(this.params).pipe(take(1)).subscribe((data) => {
2963
- this.previousSearchValue = searchValue;
2964
- this.isTotalRetieved = true;
2965
- this.length = data.totalRecords;
2966
- this.tableFilters.totalItems = data.totalRecords;
2967
- }, error => {
2968
- //this.alertService.openAlert(this.errorGetTotalImg);
2969
- this.initVariables(false);
2970
- });
2971
- }
2972
- switchDisplayWindowMosaic() {
2973
- this.switchDisplayWindow.emit(true);
2974
- }
2975
- ngOnDestroy() {
2976
- this.searchQueryChanged.unsubscribe();
2977
- this.imgRemovedEvent.unsubscribe();
2978
- this.imgAddedEvent.unsubscribe();
2979
- this.imgSelectionChange.unsubscribe();
2980
- }
2981
- };
2982
- ImagesViewComponent.ctorParameters = () => [
2983
- { type: ImgManagerService },
2984
- { type: ImgEventService },
2985
- { type: ImgSelectionService },
2986
- { type: AlertService },
2987
- { type: UserSettingsService },
2988
- { type: RenamePictureService }
2989
- ];
2990
- __decorate([
2991
- Input(),
2992
- __metadata("design:type", String)
2993
- ], ImagesViewComponent.prototype, "stateDisplayed", void 0);
2994
- __decorate([
2995
- Input(),
2996
- __metadata("design:type", String)
2997
- ], ImagesViewComponent.prototype, "tabDisplayed", void 0);
2998
- __decorate([
2999
- Input(),
3000
- __metadata("design:type", Boolean)
3001
- ], ImagesViewComponent.prototype, "fullSize", void 0);
3002
- __decorate([
3003
- Input(),
3004
- __metadata("design:type", Number)
3005
- ], ImagesViewComponent.prototype, "maxLengthCardShow", void 0);
3006
- __decorate([
3007
- Input(),
3008
- __metadata("design:type", Number)
3009
- ], ImagesViewComponent.prototype, "nbRowToShow", void 0);
3010
- __decorate([
3011
- Input(),
3012
- __metadata("design:type", Object)
3013
- ], ImagesViewComponent.prototype, "listDisplayed", void 0);
3014
- __decorate([
3015
- Input(),
3016
- __metadata("design:type", Object)
3017
- ], ImagesViewComponent.prototype, "multipleImgMode", void 0);
3018
- __decorate([
3019
- Output(),
3020
- __metadata("design:type", EventEmitter)
3021
- ], ImagesViewComponent.prototype, "switchDisplayWindow", void 0);
3022
- __decorate([
3023
- ViewChild('imgLibContainer'),
3024
- __metadata("design:type", ElementRef)
3025
- ], ImagesViewComponent.prototype, "imgLibContainer", void 0);
3026
- ImagesViewComponent = __decorate([
3027
- Component({
3028
- selector: 'images-view',
3029
- template: "<div class=\"images-view\" [ngClass]=\"{'fullSize': fullSize, 'small': stateDisplayed === 'small'}\" [@easeInOut]=\"'in'\">\n <!-- Subheader : Img number and actions btn (sup img list, switch forma display) -->\n <div\n *ngIf=\"(stateDisplayed !== 'small' || tabDisplayed === 'img-upload')\"\n class=\"images-view__container\"\n [ngClass]=\"{'images-view__container--uploadTab': tabDisplayed === 'img-upload', 'images-view__container--window': stateDisplayed === 'window'}\"\n >\n\n <div *ngIf=\"tabDisplayed !== 'img-upload'\">\n <p class=\"mainColor\">{{ 'ImgManager.ImgLib.nbImg' | translate }} : {{length}}</p>\n </div>\n <div *ngIf=\"tabDisplayed === 'img-upload'\">\n <p class=\"mainColor\">{{ 'ImgManager.ImgLib.lastImgs' | translate }}</p>\n </div>\n\n <div class=\"field has-addons subHeaderActions\" *ngIf=\"tabDisplayed !== 'img-upload'\">\n\n <!-- For listforma : Display btn del multiple img & Confirm action -->\n <div class=\"images-view__container__boxAction\">\n\n\n <!-- S\u00E9lectionner -->\n <button\n class=\"button success images-view__container__boxAction__import\"\n @insertRemoveAnnim\n *ngIf=\"listDisplayed && nbImgToDelSelected && !confirmImgSup && !delListImgLoader && multipleImgMode\"\n (click)=\"selectImgChosen()\"\n >\n <i class=\"fal fa-check\"></i>\n {{ 'ImgManager.ImgLib.select' | translate }} ({{nbImgToDelSelected}})\n </button>\n\n <!-- Display btn del multiple img -->\n <button\n *ngIf=\"listDisplayed && nbImgToDelSelected && !confirmImgSup\"\n (click)=\"displayConfirmImgSup()\"\n class=\"button images-view__container__boxAction__delBtn danger\"\n @insertRemoveAnnim\n >\n <i class=\"fal fa-times\"></i>{{ 'ImgManager.ImgLib.delMlt' | translate }} ({{nbImgToDelSelected}})\n <span btnLoadingAnim *ngIf=\"delListImgLoader\" class=\"btnLoadingAnnimation\"></span>\n </button>\n\n <!-- Confirm action -->\n <div\n class=\"images-view__container__boxAction__confirmSup\"\n [ngClass]=\"{'images-view__container__boxAction__confirmSup--visible': confirmImgSup}\">\n <p *ngIf=\"nbImgToDelSelected > 1\" class=\"images-view__container__boxAction__confirmSup__text\">{{ 'ImgManager.ImgLib.confirmSupQuestions' | translate:{nbImage: nbImgToDelSelected} }}</p>\n <p *ngIf=\"nbImgToDelSelected === 1\" class=\"images-view__container__boxAction__confirmSup__text\">{{ 'ImgManager.ImgLib.confirmSupQuestion' | translate:{nbImage: nbImgToDelSelected} }}</p>\n <div>\n <button\n class=\"button images-view__container__boxAction__confirmSup__cancel\"\n (click)=\"cancelSup()\"\n >\n {{ 'ImgManager.ImgLib.cancel' | translate }}\n </button>\n <button\n (click)=\"removeListImg()\"\n class=\"button images-view__container__delBtn danger\"\n >\n {{ 'ImgManager.ImgLib.confirm' | translate }}\n </button>\n </div>\n </div>\n\n </div>\n\n\n <!-- Swith mosaic/list forma -->\n <div class=\"field has-addons images-view__container__buttonBox\">\n <div class=\"control\">\n <div\n class=\"button is-lighted images-view__container__buttonBox__btn\"\n [ngClass]=\"{'actifDisplayed': !listDisplayed}\"\n (click)=\"onSwitchFormatDisplayed(false)\"\n >\n <span class=\"icon is-small\">\n <i class=\"far fa-th\"></i>\n </span>\n </div>\n </div>\n\n <div class=\"control\">\n <div class=\"button is-lighted images-view__container__buttonBox__btn\"\n [ngClass]=\"{'actifDisplayed': listDisplayed}\"\n (click)=\"onSwitchFormatDisplayed(true)\"\n >\n <span class=\"icon is-small\">\n <i class=\"fas fa-bars\"></i>\n </span>\n </div>\n </div>\n </div>\n </div>\n </div>\n</div>\n\n\n <!-- Images section -->\n<perfect-scrollbar\n [config]=\"{ suppressScrollX: true }\"\n class=\"images-view__scroll\"\n [ngClass]=\"{\n 'images-view__scroll--hide--mosaic': displayPexelsResults && !listDisplayed,\n 'images-view__scroll--hide--mosaic--small': displayPexelsResults && !listDisplayed && stateDisplayed === 'small',\n 'images-view__scroll--hide--table': displayPexelsResults && listDisplayed,\n 'images-view__scroll--full': stateDisplayed === 'full',\n 'images-view__scroll--smallDisplay' : stateDisplayed === 'small' && tabDisplayed !== 'img-upload',\n 'images-view__scroll--smallUploadDisplay' : stateDisplayed === 'small' && tabDisplayed === 'img-upload',\n 'images-view__scroll--window': stateDisplayed === 'window'\n}\"\n>\n <div #imgLibContainer class=\"images-view__wrapper\">\n <div *ngIf=\"!listDisplayed || stateDisplayed === 'small'\" [@easeInOut]=\"'in'\">\n <mosaic-view\n [picturesList]=\"picturesList\"\n (picturesListChange)=\"onPicturesListChange()\"\n [tableFilters]=\"tableFilters\"\n (filtersChange)=\"onFiltersChange()\"\n [(disable)]=\"disable\"\n (pictureNameChange)=\"onRenamePicture($event)\"\n (switchDisplayWindow)=\"switchDisplayWindowMosaic()\"\n [nbFakeImg]=\"nbFakeImg\"\n [stateDisplayed]=\"stateDisplayed\"\n [tabDisplayed]=\"tabDisplayed\"\n [displayPexelsResults]=\"displayPexelsResults\"\n [isLoading]=\"isLoading\"\n [fullSize]=\"fullSize\"\n >\n </mosaic-view>\n </div>\n\n <div *ngIf=\"listDisplayed && stateDisplayed !== 'small'\" [@easeInOut]=\"'in'\">\n <table-view\n [picturesList]=\"picturesList\"\n (picturesListChange)=\"onPicturesListChange()\"\n [tableFilters]=\"tableFilters\"\n (filtersChange)=\"onFiltersChange()\"\n [(disable)]=\"disable\"\n (pictureNameChange)=\"onRenamePicture($event)\"\n [displayPexelsResults]=\"displayPexelsResults\"\n [stateDisplayed]=\"stateDisplayed\"\n [isLoading]=\"isLoading\"\n >\n </table-view>\n </div>\n\n </div>\n</perfect-scrollbar>\n\n<!-- Pexels Section - When no img found -->\n<div\n *ngIf=\"displayPexelsResults\"\n class=\"images-view--pexels\"\n [@easeInOut]=\"'in'\">\n <pexels-lib\n [searchValue]=\"tableFilters.searchValue\"\n (showImgUploaded)=\"onShowImgUploaded()\"\n [disableSearch]=\"true\"\n >\n </pexels-lib>\n</div>\n",
3030
- animations: [
3031
- easeInOut,
3032
- insertRemove
3033
- ]
3034
- }),
3035
- __metadata("design:paramtypes", [ImgManagerService,
3036
- ImgEventService,
3037
- ImgSelectionService,
3038
- AlertService,
3039
- UserSettingsService,
3040
- RenamePictureService])
3041
- ], ImagesViewComponent);
3042
-
3043
- let MosaicViewComponent = class MosaicViewComponent extends ImagesActionHandler {
3044
- constructor(imgManager, imgSelectionService, http, imgCDNService, imgEventCardService, alertService, translateService, externalService) {
3045
- super(imgManager, imgSelectionService, http, imgCDNService, imgEventCardService, alertService, translateService, externalService);
3046
- this.nbFakeImg = 0;
3047
- this.switchDisplayWindow = new EventEmitter();
3048
- }
3049
- ngOnInit() {
3050
- }
3051
- onSearchChange(event) {
3052
- // Reset table filters
3053
- this.tableFilters.sort = undefined;
3054
- this.tableFilters.order = undefined;
3055
- this.tableFilters.currentPage = 1;
3056
- this.filtersChange.emit(this.tableFilters);
3057
- }
3058
- onCardRenamePicture(pictureRenamed) {
3059
- this.pictureNameChange.next(pictureRenamed);
3060
- }
3061
- switchDisplayWindowCard() {
3062
- this.switchDisplayWindow.emit(true);
3063
- }
3064
- };
3065
- MosaicViewComponent.ctorParameters = () => [
3066
- { type: ImgManagerService },
3067
- { type: ImgSelectionService },
3068
- { type: HttpClient },
3069
- { type: ImgCDNService },
3070
- { type: ImgEventService },
3071
- { type: AlertService },
3072
- { type: TranslateService },
3073
- { type: ImgManagerConfigService }
3074
- ];
3075
- __decorate([
3076
- Input(),
3077
- __metadata("design:type", String)
3078
- ], MosaicViewComponent.prototype, "tabDisplayed", void 0);
3079
- __decorate([
3080
- Input(),
3081
- __metadata("design:type", Boolean)
3082
- ], MosaicViewComponent.prototype, "fullSize", void 0);
3083
- __decorate([
3084
- Input(),
3085
- __metadata("design:type", Number)
3086
- ], MosaicViewComponent.prototype, "nbFakeImg", void 0);
3087
- __decorate([
3088
- Output(),
3089
- __metadata("design:type", EventEmitter)
3090
- ], MosaicViewComponent.prototype, "switchDisplayWindow", void 0);
3091
- MosaicViewComponent = __decorate([
3092
- Component({
3093
- selector: 'mosaic-view',
3094
- template: "<div class=\"mosaic\" [ngClass]=\"{'fullSize': fullSize, 'small': stateDisplayed === 'small', 'mosaic--displayPexelsImg': displayPexelsResults}\">\n <!-- Search section -->\n <div\n class=\"mosaic__search\"\n [ngClass]=\"{'mosaic__search--small': stateDisplayed === 'small'}\"\n *ngIf=\"tabDisplayed !== 'img-upload'\">\n <wz-input-search\n [(ngModel)]=\"tableFilters.searchValue\"\n (changeDebounced)=\"onSearchChange($event)\"\n [placeholder]=\"'ImgManager.SearchBar.placeholder' | translate\"\n [smallPadding]=\"stateDisplayed === 'small'\"\n ></wz-input-search>\n </div>\n\n <!-- Cards section -->\n <div\n class=\"mosaic__container__cards\"\n [ngClass]=\"{'mosaic__container__cards--padding': stateDisplayed !== 'window'}\"\n [@listAnimation]=\"picturesList.length\"\n *ngIf=\"!isLoading && !displayPexelsResults\"\n >\n <img-card\n *ngFor=\"let picture of picturesList; let index = index;\"\n [picture]=\"picture\"\n [stateDisplayed]=\"stateDisplayed\"\n [tabDisplayed]=\"tabDisplayed\"\n [disable]=\"disable\"\n (toggleImgSelected)=\"onToggleSelectImg(index)\"\n (pictureNameChange)=\"onCardRenamePicture($event)\"\n (switchDisplayWindow)=\"switchDisplayWindowCard()\"\n [fullSize]=\"fullSize\"\n ></img-card>\n <div\n *ngFor=\"let fakeImg of nbFakeImg | numberToArray\"\n class=\"mosaic__container__cards__fakeImg\"\n [ngClass]=\"{'mosaic__container__cards__fakeImg--smallFakeImg': stateDisplayed === 'small' || tabDisplayed === 'img-upload'}\">\n </div>\n </div>\n <!-- Loader section -->\n <div class=\"mosaic__container__loader\" *ngIf=\"isLoading\">\n <wz-loader [small]=\"true\"></wz-loader>\n </div>\n\n <!-- Pagination section -->\n <div class=\"mosaic__pagination\" *ngIf=\"picturesList.length && tabDisplayed !== 'img-upload' && !displayPexelsResults\" >\n <wz-pagination\n [pagination]=\"tableFilters\"\n (pageChange)=\"onFiltersChange()\"\n >\n </wz-pagination>\n </div>\n\n</div>\n",
3095
- animations: [
3096
- listAnnimation
3097
- ]
3098
- }),
3099
- __metadata("design:paramtypes", [ImgManagerService,
3100
- ImgSelectionService,
3101
- HttpClient,
3102
- ImgCDNService,
3103
- ImgEventService,
3104
- AlertService,
3105
- TranslateService,
3106
- ImgManagerConfigService])
3107
- ], MosaicViewComponent);
3108
-
3109
- let TableViewComponent = class TableViewComponent extends ImagesActionHandler {
3110
- constructor(imgManager, imgSelectionService, http, imgCDNService, imgEventCardService, alertService, translateService, externalService) {
3111
- super(imgManager, imgSelectionService, http, imgCDNService, imgEventCardService, alertService, translateService, externalService);
3112
- this.dataTableName = 'imgagesView'; // Name of your table
3113
- }
3114
- ngOnInit() {
3115
- }
3116
- };
3117
- TableViewComponent.ctorParameters = () => [
3118
- { type: ImgManagerService },
3119
- { type: ImgSelectionService },
3120
- { type: HttpClient },
3121
- { type: ImgCDNService },
3122
- { type: ImgEventService },
3123
- { type: AlertService },
3124
- { type: TranslateService },
3125
- { type: ImgManagerConfigService }
3126
- ];
3127
- TableViewComponent = __decorate([
3128
- Component({
3129
- selector: 'table-view',
3130
- template: "<div class=\"table-view\" [@listAnimation]=\"picturesList.length\">\n <wz-table\n [checkbox]=\"true\"\n (toggleAllCheckBox)=\"onToggleAllCheckBoxRow($event)\"\n [(tableFilters)]=\"tableFilters\"\n (tableFiltersChange)=\"onFiltersChange()\"\n [placeholder]=\"'ImgManager.SearchBar.placeholder' | translate\"\n [disablePagniation]=\"displayPexelsResults\"\n [isLoading]=\"isLoading\"\n >\n <!-- Header Section -->\n <div\n headerCell\n [headerName]=\"'ImgManager.ImgList.titleImgName' | translate\"\n columnSize=\"2\"\n sortName=\"name\"\n ></div>\n <div\n headerCell\n centerCell=\"center\"\n [headerName]=\"'ImgManager.ImgList.titleResolution' | translate\"\n ></div>\n <div headerCell columnSize=\"0\"></div>\n\n <!-- Body Section -->\n <div\n tableRow\n checkBoxRow\n [checkBoxValue]=\"picture.delSelected\"\n (checkBoxValueChange)=\"onToggleDelSelection(index)\"\n *ngFor=\"let picture of picturesList; let index = index\"\n >\n\n <div tableColumn columnSize=\"2\">\n <div class=\"table-view__row__container\">\n <div\n class=\"table-view__row__container__imgContainer\"\n [ngClass]=\"{'imgSelected': picture.selected}\"\n (click)=\"onToggleSelectImg(index)\">\n <img\n class=\"table-view__row__container__imgContainer__img\"\n [src]=\"picture.file_name | imgSrc : '100'\"\n alt=\"picture.display_name\"\n [ngClass]=\"{'pictureDeletion': picture.deleted}\"\n (error)=\"picture.imgNotLoaded=true;onPictureNotLoading($event);\"\n />\n <!-- If the img is not loaded, or the link is broken, an icon is displayed -->\n <div\n *ngIf=\"picture.imgNotLoaded\"\n class=\"table-view__row__container__imgContainer__overlay\"\n >\n <i class=\"fad fa-folder-times\"></i>\n </div>\n </div>\n <input\n type=\"text\"\n class=\"wzImgMngInput table-view__row__container__name\"\n [(ngModel)]=\"picture.display_name\"\n (focus)=\"previousName=picture.display_name\"\n (blur)=\"onNameChange(picture.id_file)\"\n (click)=\"onToggleDelSelection(index)\"\n [ngClass]=\"{'desabled': picture.deleted}\"\n [disabled]=\"picture.deleted\"\n >\n </div>\n </div>\n\n <div\n tableColumn\n centerCell=\"center\"\n (click)=\"onToggleDelSelection(index)\"\n >\n <p class=\"grey\">{{picture.raw_height}}x{{picture.raw_width}}</p>\n </div>\n\n <div tableColumn centerCell=\"center\" columnSize=\"0\" class=\"table-view__dropdown-options\">\n <!-- Dropdown -->\n <dropdown dropdownId=\"dropdown-options\" [disable]=\"picture.deleted\">\n <ng-container label>\n <div class=\"table-view__dropdown-options__label rotate\">\n <span> <i class=\"far fa-ellipsis-h is-size-4\" aria-haspopup=\"true\" aria-controls=\"dropdown-menu\"> </i> </span>\n </div>\n </ng-container>\n <ng-container item>\n <div\n class=\"dropdown-item\"\n (click)=\"onDownloadImg(picture.display_name, picture.file_name)\"\n >\n <i class=\"far fa-download download\"></i>&nbsp;\n <p>{{ 'ImgManager.ImgList.download' | translate }}</p>\n </div>\n </ng-container>\n <ng-container item>\n <div\n class=\"dropdown-item\"\n (click)=\"onEdit(picture)\"\n >\n <i class=\"far fa-crop-alt edit\"></i>&nbsp;\n <p>{{ 'ImgManager.ImgList.edit' | translate }}</p>\n </div>\n </ng-container>\n <ng-container item>\n <div\n class=\"dropdown-item\"\n (click)=\"onRemoveImg(picture)\"\n >\n <i class=\"fal fa-times deleted\"></i>&nbsp;\n <p>{{ 'ImgManager.ImgList.remove' | translate }}</p>\n </div>\n </ng-container>\n </dropdown>\n </div>\n </div>\n </wz-table>\n</div>\n",
3131
- animations: [
3132
- listAnnimation
3133
- ]
3134
- }),
3135
- __metadata("design:paramtypes", [ImgManagerService,
3136
- ImgSelectionService,
3137
- HttpClient,
3138
- ImgCDNService,
3139
- ImgEventService,
3140
- AlertService,
3141
- TranslateService,
3142
- ImgManagerConfigService])
3143
- ], TableViewComponent);
3144
-
3145
- let FiltersTableService = class FiltersTableService {
3146
- constructor(filterRoutingBuilder) {
3147
- this.filterRoutingBuilder = filterRoutingBuilder;
3148
- this.filterGroups = new Map();
3149
- this.dataTableFilters = {
3150
- sort: undefined,
3151
- order: undefined,
3152
- searchValue: undefined,
3153
- totalItems: 0,
3154
- itemsPerPage: 0,
3155
- currentPage: 0
3156
- };
3157
- this.sortSubject = new Subject();
3158
- }
3159
- getTableFilterGroup(dataTableName) {
3160
- if (this.filterGroups.has(dataTableName)) {
3161
- return this.filterGroups.get(dataTableName);
3162
- }
3163
- const filterGroup = this.filterRoutingBuilder.group(this.dataTableFilters, dataTableName);
3164
- this.filterGroups.set(dataTableName, filterGroup);
3165
- return filterGroup;
3166
- }
3167
- /**
3168
- * Use to reset the others sorts of the table
3169
- * @param dataTableName
3170
- * @param sortName
3171
- * @param order
3172
- */
3173
- emitSortChange(dataTableName, sortName, order) {
3174
- this.sortSubject.next({ dataTableName, sortName, order });
3175
- }
3176
- getSortChangeListner() {
3177
- return this.sortSubject.asObservable();
3178
- }
3179
- setPaginationFilters(dataTableName, totalItems, itemsPerPage, currentPage) {
3180
- const filterGroup = this.getTableFilterGroup(dataTableName);
3181
- filterGroup.setValues({
3182
- itemsPerPage,
3183
- currentPage
3184
- });
3185
- }
3186
- setInitialPaginationFiltersIfNotExist(dataTableName, itemsPerPage, currentPage) {
3187
- const filterGroup = this.getTableFilterGroup(dataTableName);
3188
- filterGroup.setValues({
3189
- itemsPerPage: filterGroup.get('itemsPerPage') ? parseInt(filterGroup.get('itemsPerPage')) : itemsPerPage,
3190
- currentPage: filterGroup.get('currentPage') ? parseInt(filterGroup.get('currentPage')) : currentPage
3191
- });
3192
- }
3193
- };
3194
- FiltersTableService.ctorParameters = () => [
3195
- { type: NwbFilterRoutingBuilder }
3196
- ];
3197
- FiltersTableService.ɵprov = ɵɵdefineInjectable({ factory: function FiltersTableService_Factory() { return new FiltersTableService(ɵɵinject(NwbFilterRoutingBuilder)); }, token: FiltersTableService, providedIn: "root" });
3198
- FiltersTableService = __decorate([
3199
- Injectable({
3200
- providedIn: 'root'
3201
- }),
3202
- __metadata("design:paramtypes", [NwbFilterRoutingBuilder])
3203
- ], FiltersTableService);
3204
-
3205
- let TableComponent = class TableComponent {
3206
- constructor(filtersTableService) {
3207
- this.filtersTableService = filtersTableService;
3208
- this.tableFiltersChange = new EventEmitter();
3209
- this.placeholder = '';
3210
- /// Input/Output of checkbox ///
3211
- /** Pass to true to display checkbox in the header table */
3212
- this.checkbox = false;
3213
- /** Emit new header checboxValue */
3214
- this.toggleAllCheckBox = new EventEmitter();
3215
- /// Input to disable section ///
3216
- /** Pass to true to hide search input */
3217
- this.disableSearch = false;
3218
- /** Pass to true to hide the pagniator */
3219
- this.disablePagniation = false;
3220
- /// Input for loader on table body ///
3221
- this.isLoading = false;
3222
- }
3223
- ngOnInit() {
3224
- this.headerCheckBoxId = v4(); // Create checkbox unique id
3225
- /* Handle routing filters */
3226
- if (this.tableRoutingName) {
3227
- this._filterGroup = this.filtersTableService.getTableFilterGroup(this.tableRoutingName);
3228
- // Performe initial fetch data
3229
- this._filterGroup.valuesChange$.next([]);
3230
- this.setTablesFilters();
3231
- // Listen to filters changes with debounced time to limit multiple api calls
3232
- this.filterGroupChangeSub = this._filterGroup.valuesChange$.subscribe(filters => {
3233
- this.setTablesFilters();
3234
- });
3235
- }
3236
- }
3237
- onToggleAllCheckBox(event) {
3238
- this.toggleAllCheckBox.emit(event.target.checked);
3239
- }
3240
- searchChange(event) {
3241
- // Reset table filters
3242
- this.tableFilters.sort = undefined;
3243
- this.tableFilters.order = undefined;
3244
- this.tableFilters.currentPage = 1;
3245
- this.tableFiltersChange.emit(this.tableFilters);
3246
- // Reset routing filters
3247
- if (this._filterGroup) {
3248
- this._filterGroup.setValues({
3249
- searchValue: this.tableFilters.searchValue,
3250
- sort: undefined,
3251
- order: undefined,
3252
- currentPage: 1
3253
- });
3254
- }
3255
- }
3256
- pageChange() {
3257
- this.tableFiltersChange.emit(this.tableFilters);
3258
- if (this._filterGroup) {
3259
- this._filterGroup.setValues({
3260
- itemsPerPage: this.tableFilters.itemsPerPage,
3261
- currentPage: this.tableFilters.currentPage
3262
- });
3263
- }
3264
- }
3265
- /**
3266
- * Set tableFilters from routing data existing in the url
3267
- * */
3268
- setTablesFilters() {
3269
- this.tableFilters = {
3270
- sort: this._filterGroup.get('sort'),
3271
- order: this._filterGroup.get('order'),
3272
- searchValue: this._filterGroup.get('searchValue'),
3273
- itemsPerPage: this._filterGroup.get('itemsPerPage') ? parseInt(this._filterGroup.get('itemsPerPage')) : 0,
3274
- currentPage: this._filterGroup.get('currentPage') ? parseInt(this._filterGroup.get('currentPage')) : 0,
3275
- totalItems: this.tableFilters.totalItems
3276
- };
3277
- this.tableFiltersChange.emit(this.tableFilters);
3278
- }
3279
- ngDestroy() {
3280
- if (this.filterGroupChangeSub) {
3281
- this.filterGroupChangeSub.unsubscribe();
3282
- }
3283
- }
3284
- };
3285
- TableComponent.ctorParameters = () => [
3286
- { type: FiltersTableService }
3287
- ];
3288
- __decorate([
3289
- Input(),
3290
- __metadata("design:type", Object)
3291
- ], TableComponent.prototype, "tableFilters", void 0);
3292
- __decorate([
3293
- Output(),
3294
- __metadata("design:type", EventEmitter)
3295
- ], TableComponent.prototype, "tableFiltersChange", void 0);
3296
- __decorate([
3297
- Input(),
3298
- __metadata("design:type", String)
3299
- ], TableComponent.prototype, "tableRoutingName", void 0);
3300
- __decorate([
3301
- Input(),
3302
- __metadata("design:type", String)
3303
- ], TableComponent.prototype, "placeholder", void 0);
3304
- __decorate([
3305
- Input(),
3306
- __metadata("design:type", Object)
3307
- ], TableComponent.prototype, "checkbox", void 0);
3308
- __decorate([
3309
- Output(),
3310
- __metadata("design:type", EventEmitter)
3311
- ], TableComponent.prototype, "toggleAllCheckBox", void 0);
3312
- __decorate([
3313
- Input(),
3314
- __metadata("design:type", Boolean)
3315
- ], TableComponent.prototype, "disableSearch", void 0);
3316
- __decorate([
3317
- Input(),
3318
- __metadata("design:type", Boolean)
3319
- ], TableComponent.prototype, "disablePagniation", void 0);
3320
- __decorate([
3321
- Input(),
3322
- __metadata("design:type", Object)
3323
- ], TableComponent.prototype, "isLoading", void 0);
3324
- TableComponent = __decorate([
3325
- Component({
3326
- selector: 'wz-table',
3327
- template: "<div class=\"wz-table\">\n <!-- Header section -->\n <div class=\"wz-table__head\" id=\"headerTable\">\n <div *ngIf=\"checkbox\" class=\"wz-table__head__cell wz-table__head__cell--checkbox\">\n <wz-checkbox [id]=\"headerCheckBoxId\" (change)=\"onToggleAllCheckBox($event)\" [alone]=\"true\"></wz-checkbox>\n </div>\n\n <!-- Header contents are added with the headerCell directive -->\n <ng-content select=\"[headerCell]\"></ng-content>\n </div>\n\n <!-- Search section -->\n <div *ngIf=\"!disableSearch\" class=\"wz-table__search\">\n <wz-input-search\n [(ngModel)]=\"tableFilters.searchValue\"\n (changeDebounced)=\"searchChange($event)\"\n [placeholder]=\"placeholder\"\n [smallPadding]=\"true\"\n ></wz-input-search>\n </div>\n\n <!-- Body section -->\n <div class=\"wz-table__body\">\n <!-- Loader on body -->\n <div class=\"wz-table__body__loader\" *ngIf=\"isLoading\">\n <wz-loader [small]=\"true\"></wz-loader>\n </div>\n <!-- Body contents are added with the tableRow directive -->\n <ng-content select=\"[tableRow]\" *ngIf=\"!isLoading\"></ng-content>\n </div>\n\n <!-- Pagination section -->\n <wz-pagination *ngIf=\"!disablePagniation\" [pagination]=\"tableFilters\" (pageChange)=\"pageChange()\"></wz-pagination>\n</div>\n",
3328
- encapsulation: ViewEncapsulation.None
3329
- }),
3330
- __metadata("design:paramtypes", [FiltersTableService])
3331
- ], TableComponent);
3332
-
3333
- var InputSearchComponent_1;
3334
- let InputSearchComponent = InputSearchComponent_1 = class InputSearchComponent {
3335
- constructor() {
3336
- this.placeholder = '';
3337
- this.smallPadding = false;
3338
- this.innerValue = '';
3339
- this.changeDebounced = new EventEmitter(); // debounced
3340
- this.onTouchedCallback = () => { };
3341
- this.onChangeCallback = () => { };
3342
- }
3343
- get value() {
3344
- return this.innerValue;
3345
- }
3346
- set value(v) {
3347
- if (v !== this.innerValue) {
3348
- this.innerValue = v;
3349
- this.onChangeCallback(v);
3350
- }
3351
- }
3352
- writeValue(value) {
3353
- if (value !== this.innerValue) {
3354
- this.innerValue = value;
3355
- }
3356
- }
3357
- registerOnChange(fn) {
3358
- this.onChangeCallback = fn;
3359
- }
3360
- registerOnTouched(fn) {
3361
- this.onTouchedCallback = fn;
3362
- }
3363
- handleDebouncedKeyUp(event) {
3364
- this.changeDebounced.emit(event.target.value);
3365
- }
3366
- };
3367
- __decorate([
3368
- Input(),
3369
- __metadata("design:type", Object)
3370
- ], InputSearchComponent.prototype, "placeholder", void 0);
3371
- __decorate([
3372
- Input(),
3373
- __metadata("design:type", Object)
3374
- ], InputSearchComponent.prototype, "smallPadding", void 0);
3375
- __decorate([
3376
- Input(),
3377
- __metadata("design:type", Object)
3378
- ], InputSearchComponent.prototype, "id", void 0);
3379
- __decorate([
3380
- Output(),
3381
- __metadata("design:type", Object)
3382
- ], InputSearchComponent.prototype, "changeDebounced", void 0);
3383
- InputSearchComponent = InputSearchComponent_1 = __decorate([
3384
- Component({
3385
- selector: 'wz-input-search',
3386
- template: "<div class=\"input-search field\" [ngClass]=\"smallPadding ? 'small-padding' : ''\">\n <p class=\"control has-icons-left has-icons-right\">\n <input\n [placeholder]=\"placeholder\"\n value=\"\"\n class=\"input\"\n type=\"text\"\n [attr.id]=\"id\"\n [(ngModel)]=\"value\"\n debounceKeyUp\n [debounceTime]=\"1000\"\n (onEventChange)=\"handleDebouncedKeyUp($event)\"\n />\n <i class=\"icon fal fa-search\"></i>\n </p>\n</div>\n",
3387
- providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: InputSearchComponent_1, multi: true }]
3388
- })
3389
- ], InputSearchComponent);
3390
-
3391
- let PagniationIsLastPage = class PagniationIsLastPage {
3392
- /**
3393
- * Return true, if the current page is the last page. Otherwise, return false.
3394
- * @param currentPage
3395
- * @param totalItems
3396
- * @param itemsPerPage
3397
- */
3398
- transform(currentPage, totalItems, itemsPerPage) {
3399
- if (!(currentPage >= 0 && totalItems >= 0 && itemsPerPage >= 0)) {
3400
- throw new Error('currentPage or totalItems or itemsPerPage is/are missing in PagniationIsLastPage pipe.');
3401
- }
3402
- return currentPage === Math.ceil(totalItems / itemsPerPage);
3403
- }
3404
- };
3405
- PagniationIsLastPage = __decorate([
3406
- Pipe({
3407
- name: 'IsLastPage'
3408
- })
3409
- ], PagniationIsLastPage);
3410
-
3411
- let PaginationComponent = class PaginationComponent {
3412
- constructor() {
3413
- this.pageChange = new EventEmitter();
3414
- }
3415
- set pagination(pagination) {
3416
- this._pagination = pagination;
3417
- }
3418
- get pagination() {
3419
- return this._pagination;
3420
- }
3421
- decrementPage() {
3422
- if (this.pagination.currentPage <= 1) {
3423
- return;
3424
- }
3425
- this.pagination.currentPage--;
3426
- this.pageChange.emit(this.pagination);
3427
- }
3428
- incrementPage() {
3429
- const isLastPage = new PagniationIsLastPage().transform(this.pagination.currentPage, this.pagination.totalItems, this.pagination.itemsPerPage);
3430
- if (isLastPage) {
3431
- return;
3432
- }
3433
- this.pagination.currentPage++;
3434
- this.pageChange.emit(this.pagination);
3435
- }
3436
- onGotoPageChange(pageNumber) {
3437
- this.pagination.currentPage = parseInt(pageNumber);
3438
- this.pageChange.emit(this.pagination);
3439
- }
3440
- };
3441
- __decorate([
3442
- Input(),
3443
- __metadata("design:type", Object),
3444
- __metadata("design:paramtypes", [Object])
3445
- ], PaginationComponent.prototype, "pagination", null);
3446
- __decorate([
3447
- Output(),
3448
- __metadata("design:type", EventEmitter)
3449
- ], PaginationComponent.prototype, "pageChange", void 0);
3450
- PaginationComponent = __decorate([
3451
- Component({
3452
- selector: 'wz-pagination',
3453
- template: "<div class=\"wz-pagination\" *ngIf=\"pagination && pagination.itemsPerPage\">\n <div class=\"wz-pagination__wrapper\">\n <div class=\"wz-pagination__wrapper__page\">\n <p>{{ 'PaginationComponent.page' | translate }}</p>\n\n <wz-page-selector [pagination]=\"pagination\" [totalItems]=\"pagination.totalItems\" (pageChange)=\"onGotoPageChange($event)\"></wz-page-selector>\n </div>\n\n <div class=\"wz-pagination__wrapper__elements\">\n <p>{{ pagination.currentPage | customPagniationText: pagination.totalItems:pagination.itemsPerPage }}</p>\n </div>\n\n <div class=\"wz-pagination__wrapper__arrows\">\n <div\n (click)=\"decrementPage()\"\n class=\"wz-pagination__wrapper__arrows__arrow wz-pagination__wrapper__arrows__arrow--left\"\n [ngClass]=\"{ 'wz-pagination__wrapper__arrows__arrow--disabled': pagination.currentPage === 1 }\"\n >\n <span class=\"wz-pagination__wrapper__arrows__arrow__icon\"></span>\n </div>\n <div\n (click)=\"incrementPage()\"\n class=\"wz-pagination__wrapper__arrows__arrow wz-pagination__wrapper__arrows__arrow--right\"\n [ngClass]=\"{\n 'wz-pagination__wrapper__arrows__arrow--disabled':\n pagination.currentPage | IsLastPage: pagination.totalItems:pagination.itemsPerPage\n }\"\n >\n <span class=\"wz-pagination__wrapper__arrows__arrow__icon\"></span>\n </div>\n </div>\n </div>\n</div>\n"
3454
- }),
3455
- __metadata("design:paramtypes", [])
3456
- ], PaginationComponent);
3457
-
3458
- let PagniationArrayTotalPages = class PagniationArrayTotalPages {
3459
- /**
3460
- * Return an incremental array corresponding with the number page
3461
- * [ 1, 2, 3 ..., last page number ]
3462
- * @param totalItems
3463
- * @param itemsPerPage
3464
- */
3465
- transform(totalItems, itemsPerPage) {
3466
- if (!(totalItems >= 0 && itemsPerPage >= 0)) {
3467
- throw new Error('totalItems or itemsPerPage missing in ArrayTotalPages pipe.');
3468
- }
3469
- const arrayLength = Math.ceil(totalItems / itemsPerPage);
3470
- return Array.apply(null, { length: arrayLength })
3471
- .map(Number.call, Number)
3472
- .map((x) => x + 1);
3473
- }
3474
- };
3475
- PagniationArrayTotalPages = __decorate([
3476
- Pipe({
3477
- name: 'ArrayTotalPages'
3478
- })
3479
- ], PagniationArrayTotalPages);
3480
-
3481
- let PagniationText = class PagniationText {
3482
- constructor(translateService) {
3483
- this.translateService = translateService;
3484
- }
3485
- /**
3486
- * Update pagination text if at least one entrie change
3487
- * @param currentPage
3488
- * @param totalItems
3489
- * @param itemsPerPage
3490
- */
3491
- transform(currentPage, totalItems, itemsPerPage) {
3492
- let currentItemsLow = 0, currentItemsHigh = 0;
3493
- if (totalItems) {
3494
- currentItemsLow = (currentPage - 1) * itemsPerPage + 1;
3495
- currentItemsHigh = currentPage * itemsPerPage;
3496
- }
3497
- if (currentItemsHigh > totalItems) {
3498
- currentItemsHigh = totalItems;
3499
- }
3500
- return this.translateService.instant('PaginationComponent.on', { low: currentItemsLow, high: currentItemsHigh, total: totalItems });
3501
- }
3502
- };
3503
- PagniationText.ctorParameters = () => [
3504
- { type: TranslateService }
3505
- ];
3506
- PagniationText = __decorate([
3507
- Pipe({
3508
- name: 'customPagniationText'
3509
- }),
3510
- __metadata("design:paramtypes", [TranslateService])
3511
- ], PagniationText);
3512
-
3513
- var CheckboxComponent_1;
3514
- let CheckboxComponent = CheckboxComponent_1 = class CheckboxComponent {
3515
- constructor() {
3516
- this.label = '';
3517
- this.alone = false;
3518
- this.checked = false;
3519
- this.id = '';
3520
- this.disabled = false;
3521
- }
3522
- registerOnChange(fn) {
3523
- this._onChange = fn;
3524
- }
3525
- registerOnTouched(fn) {
3526
- this._onTouched = fn;
3527
- }
3528
- setDisabledState(isDisabled) {
3529
- this.disabled = isDisabled;
3530
- }
3531
- writeValue(obj) {
3532
- this.value = obj;
3533
- }
3534
- onChange(value) {
3535
- if (this._onChange) {
3536
- this._onChange(value);
3537
- }
3538
- }
3539
- };
3540
- __decorate([
3541
- Input(),
3542
- __metadata("design:type", Object)
3543
- ], CheckboxComponent.prototype, "label", void 0);
3544
- __decorate([
3545
- Input(),
3546
- __metadata("design:type", Object)
3547
- ], CheckboxComponent.prototype, "value", void 0);
3548
- __decorate([
3549
- Input(),
3550
- __metadata("design:type", String)
3551
- ], CheckboxComponent.prototype, "type", void 0);
3552
- __decorate([
3553
- Input(),
3554
- __metadata("design:type", Object)
3555
- ], CheckboxComponent.prototype, "alone", void 0);
3556
- __decorate([
3557
- Input(),
3558
- __metadata("design:type", Object)
3559
- ], CheckboxComponent.prototype, "checked", void 0);
3560
- __decorate([
3561
- Input(),
3562
- __metadata("design:type", Object)
3563
- ], CheckboxComponent.prototype, "id", void 0);
3564
- __decorate([
3565
- Input(),
3566
- __metadata("design:type", String)
3567
- ], CheckboxComponent.prototype, "name", void 0);
3568
- CheckboxComponent = CheckboxComponent_1 = __decorate([
3569
- Component({
3570
- selector: 'wz-checkbox',
3571
- template: "<div class=\"checkBoxField field\" [ngClass]=\"{ 'field--nowrap': type === 'column', alone: alone }\">\n <div class=\"field__row\">\n <input\n type=\"checkbox\"\n [id]=\"id\"\n class=\"is-checkradio\"\n [name]=\"name\"\n [value]=\"value\"\n [disabled]=\"disabled\"\n [(ngModel)]=\"value\"\n [checked]=\"checked\"\n (ngModelChange)=\"onChange($event)\"\n />\n <label [attr.for]=\"id\">{{ label }}</label>\n </div>\n</div>\n",
3572
- encapsulation: ViewEncapsulation.None,
3573
- providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: CheckboxComponent_1, multi: true }]
3574
- }),
3575
- __metadata("design:paramtypes", [])
3576
- ], CheckboxComponent);
3577
-
3578
- let CheckBoxRow = class CheckBoxRow {
3579
- constructor(currentRow, appRef, renderer, document, resolver, injector) {
3580
- this.currentRow = currentRow;
3581
- this.appRef = appRef;
3582
- this.renderer = renderer;
3583
- this.document = document;
3584
- this.resolver = resolver;
3585
- this.injector = injector;
3586
- this.checkBoxValueChange = new EventEmitter();
3587
- }
3588
- set checkBoxValue(value) {
3589
- this._value = value;
3590
- if (this.checkboxComponentRef) {
3591
- this.setCheckBoxValue();
3592
- }
3593
- }
3594
- get checkBoxValue() {
3595
- return this._value;
3596
- }
3597
- ngOnInit() {
3598
- this.createCheckBoxComponent();
3599
- this.handleChecboxInputs();
3600
- this.handleCheckboxOutputs();
3601
- }
3602
- createCheckBoxComponent() {
3603
- // Create the container
3604
- const checkBoxContainer = document.createElement('div');
3605
- checkBoxContainer.className = 'wz-table__body__line__cell wz-table__body__line__cell--checkbox';
3606
- // Insert divCheckBox in the DOM as the first child of the row
3607
- this.renderer.insertBefore(this.currentRow.nativeElement, checkBoxContainer, this.currentRow.nativeElement.firstChild);
3608
- // Insert the CheckBoxComponent inside the container (DOM and Angular DOM)
3609
- this.htmlContainer = new HtmlContainer(checkBoxContainer, this.appRef, this.resolver, this.injector);
3610
- this.checkboxComponentRef = this.htmlContainer.attach(CheckboxComponent);
3611
- }
3612
- handleChecboxInputs() {
3613
- this.checkboxComponentRef.instance.id = this.checkBoxId ? this.checkBoxId : v4();
3614
- this.checkboxComponentRef.instance.name = this.checkBoxName ? this.checkBoxName : undefined;
3615
- this.checkboxComponentRef.instance.alone = true;
3616
- this.setCheckBoxValue();
3617
- }
3618
- setCheckBoxValue() {
3619
- this.checkboxComponentRef.instance.value = this.checkBoxValue;
3620
- }
3621
- handleCheckboxOutputs() {
3622
- // Detect checkbox changes
3623
- this.checkboxComponentRef.instance.registerOnChange(() => {
3624
- this._toggleCheckbox();
3625
- });
3626
- }
3627
- _toggleCheckbox() {
3628
- this.checkBoxValue = !this.checkBoxValue;
3629
- this.checkBoxValueChange.emit(this.checkBoxValue);
3630
- }
3631
- ngOnDestroy() {
3632
- this.htmlContainer.dispose();
3633
- }
3634
- };
3635
- CheckBoxRow.ctorParameters = () => [
3636
- { type: ElementRef },
3637
- { type: ApplicationRef },
3638
- { type: Renderer2 },
3639
- { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
3640
- { type: ComponentFactoryResolver },
3641
- { type: Injector }
3642
- ];
3643
- __decorate([
3644
- Input('checkBoxId'),
3645
- __metadata("design:type", Object)
3646
- ], CheckBoxRow.prototype, "checkBoxId", void 0);
3647
- __decorate([
3648
- Input('checkBoxName'),
3649
- __metadata("design:type", String)
3650
- ], CheckBoxRow.prototype, "checkBoxName", void 0);
3651
- __decorate([
3652
- Input('checkBoxValue'),
3653
- __metadata("design:type", Boolean),
3654
- __metadata("design:paramtypes", [Boolean])
3655
- ], CheckBoxRow.prototype, "checkBoxValue", null);
3656
- __decorate([
3657
- Output(),
3658
- __metadata("design:type", EventEmitter)
3659
- ], CheckBoxRow.prototype, "checkBoxValueChange", void 0);
3660
- CheckBoxRow = __decorate([
3661
- Directive({
3662
- selector: '[checkBoxRow]'
3663
- }),
3664
- __param(3, Inject(DOCUMENT)),
3665
- __metadata("design:paramtypes", [ElementRef,
3666
- ApplicationRef,
3667
- Renderer2, Object, ComponentFactoryResolver,
3668
- Injector])
3669
- ], CheckBoxRow);
3670
- class HtmlContainer {
3671
- constructor(hostElement, appRef, componentFactoryResolver, injector) {
3672
- this.hostElement = hostElement;
3673
- this.appRef = appRef;
3674
- this.componentFactoryResolver = componentFactoryResolver;
3675
- this.injector = injector;
3676
- this.attached = false;
3677
- }
3678
- attach(component) {
3679
- if (this.attached) {
3680
- throw new Error('component has already been attached');
3681
- }
3682
- this.attached = true;
3683
- const childComponentFactory = this.componentFactoryResolver.resolveComponentFactory(component);
3684
- let componentRef = childComponentFactory.create(this.injector);
3685
- this.appRef.attachView(componentRef.hostView);
3686
- this.disposeFn = () => {
3687
- this.appRef.detachView(componentRef.hostView);
3688
- componentRef.destroy();
3689
- };
3690
- this.hostElement.appendChild(componentRef.hostView.rootNodes[0]);
3691
- return componentRef;
3692
- }
3693
- dispose() {
3694
- if (this.attached) {
3695
- this.disposeFn();
3696
- }
3697
- }
3698
- }
3699
-
3700
- let TableColumn = class TableColumn {
3701
- constructor(currentCell, renderer, document) {
3702
- this.currentCell = currentCell;
3703
- this.renderer = renderer;
3704
- this.document = document;
3705
- this.centerCellValue = ['left', 'center', 'right'];
3706
- }
3707
- ngAfterViewInit() {
3708
- this.applyCustomStylesOnCell();
3709
- }
3710
- applyCustomStylesOnCell() {
3711
- this.currentCell.nativeElement.style.flexGrow = typeof this.columnSize !== 'undefined' ? this.columnSize : '1';
3712
- this.renderer.addClass(this.currentCell.nativeElement, 'wz-table__body__line__cell');
3713
- if (this.centerCell) {
3714
- if (this.centerCellValue.indexOf(this.centerCell) === -1) {
3715
- throw 'Error : The centerCell directive has no matched value. The value must be one of the following : left, center, right.';
3716
- }
3717
- let className = 'wz-table__body__line__cell--center' + '--' + this.centerCell;
3718
- this.renderer.addClass(this.currentCell.nativeElement, className);
3719
- }
3720
- }
3721
- };
3722
- TableColumn.ctorParameters = () => [
3723
- { type: ElementRef },
3724
- { type: Renderer2 },
3725
- { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
3726
- ];
3727
- __decorate([
3728
- Input('columnSize'),
3729
- __metadata("design:type", String)
3730
- ], TableColumn.prototype, "columnSize", void 0);
3731
- __decorate([
3732
- Input('centerCell'),
3733
- __metadata("design:type", String)
3734
- ], TableColumn.prototype, "centerCell", void 0);
3735
- TableColumn = __decorate([
3736
- Directive({
3737
- selector: '[tableColumn]'
3738
- }),
3739
- __param(2, Inject(DOCUMENT)),
3740
- __metadata("design:paramtypes", [ElementRef, Renderer2, Object])
3741
- ], TableColumn);
3742
-
3743
- let TableColumnHeader = class TableColumnHeader {
3744
- constructor(currentCell, renderer, document, filtersTableService) {
3745
- this.currentCell = currentCell;
3746
- this.renderer = renderer;
3747
- this.document = document;
3748
- this.filtersTableService = filtersTableService;
3749
- this._headerName = '';
3750
- this.filterRouting = false; // Optional. Set to true to use Filter Routing.
3751
- this.onSortChange = new EventEmitter(); // Emit the sort value (true, false, undefuned) of the current sort icon when clicking
3752
- this.tableFiltersChange = new EventEmitter();
3753
- this.centerCellValue = ['left', 'center', 'right'];
3754
- this.subscriptions = [];
3755
- }
3756
- set headerName(value) {
3757
- this._headerName = value;
3758
- this.setHeaderName();
3759
- }
3760
- get headerName() {
3761
- return this._headerName;
3762
- }
3763
- ngOnInit() {
3764
- if (this.tableName && this.sortName) {
3765
- if (this.filterRouting) {
3766
- this.handleSortRouting();
3767
- }
3768
- else {
3769
- this.handleSortBasic();
3770
- }
3771
- }
3772
- }
3773
- ngAfterViewInit() {
3774
- this.applyCustomStylesOnCell();
3775
- this.renderHeaderColumn();
3776
- }
3777
- handleSortRouting() {
3778
- this.filterGroup = this.filtersTableService.getTableFilterGroup(this.tableName);
3779
- const filterGroupChangeSub = this.filterGroup.valuesChange$.subscribe(filters => {
3780
- const filterSort = filters.filter(filter => filter.key === 'sort')[0];
3781
- if (this.sortName !== filterSort.value) {
3782
- this.resetSortIcon();
3783
- }
3784
- });
3785
- this.subscriptions.push(filterGroupChangeSub);
3786
- }
3787
- handleSortBasic() {
3788
- const sortChangeSub = this.filtersTableService.getSortChangeListner().subscribe(sort => {
3789
- if (this.tableName === sort.dataTableName && this.sortName !== sort.sortName) {
3790
- // Reset the current sort icon
3791
- this.resetSortIcon();
3792
- }
3793
- });
3794
- this.subscriptions.push(sortChangeSub);
3795
- }
3796
- resetSortIcon() {
3797
- // Replace current icon with default icon
3798
- this.contentHeader.className = this.contentHeader.className.replace(this.getCurrentSortIcon(), 'idle');
3799
- }
3800
- applyCustomStylesOnCell() {
3801
- this.currentCell.nativeElement.style.flexGrow = typeof this.columnSize !== 'undefined' ? this.columnSize : '1';
3802
- this.renderer.addClass(this.currentCell.nativeElement, 'wz-table__head__cell');
3803
- if (this.centerCell) {
3804
- if (this.centerCellValue.indexOf(this.centerCell) === -1) {
3805
- throw 'Error : The centerCell directive has no matched value. The value must be one of the following : left, center, right.';
3806
- }
3807
- let className = 'wz-table__head__cell--center' + '--' + this.centerCell;
3808
- this.renderer.addClass(this.currentCell.nativeElement, className);
3809
- }
3810
- }
3811
- renderHeaderColumn() {
3812
- this.createHeaderContent();
3813
- this.renderer.appendChild(this.currentCell.nativeElement, this.contentHeader);
3814
- }
3815
- createHeaderContent() {
3816
- this.contentHeader = document.createElement('a');
3817
- this.contentHeader.className = 'wz-table__head__cell__search';
3818
- this.setHeaderName();
3819
- if (this.tableName && this.sortName) {
3820
- this.handleSort();
3821
- }
3822
- }
3823
- setHeaderName() {
3824
- if (!this.contentHeader) {
3825
- return;
3826
- }
3827
- this.contentHeader.innerHTML = this.headerName;
3828
- }
3829
- handleSort() {
3830
- // Set icon in the header column cell
3831
- this.contentHeader.className += ' wz-table__head__cell__search--' + this.getInitialSortIcon();
3832
- // On click on the content header, change the icon and emit event
3833
- this.renderer.listen(this.contentHeader, 'click', () => {
3834
- const currentIcon = this.getCurrentSortIcon();
3835
- let newIcon;
3836
- let newSort, newOrder;
3837
- switch (currentIcon) {
3838
- case 'idle':
3839
- newIcon = 'up';
3840
- newSort = this.sortName;
3841
- newOrder = true;
3842
- break;
3843
- case 'up':
3844
- newIcon = 'down';
3845
- newSort = this.sortName;
3846
- newOrder = false;
3847
- break;
3848
- case 'down':
3849
- newIcon = 'idle';
3850
- break;
3851
- default:
3852
- newIcon = 'idle';
3853
- break;
3854
- }
3855
- // Replace the icon
3856
- this.contentHeader.className = this.contentHeader.className.replace(currentIcon, newIcon);
3857
- this.emitEvents(newSort, newOrder);
3858
- });
3859
- }
3860
- getInitialSortIcon() {
3861
- if (!this.filterRouting) {
3862
- return 'idle';
3863
- }
3864
- // Get Initial Sort Icon for Routing Filter
3865
- let initialSortIcon = 'idle';
3866
- if (this.filterGroup.get('sort') === this.sortName) {
3867
- initialSortIcon = this.filterGroup.get('order') == 'true' ? 'up' : 'down';
3868
- }
3869
- return initialSortIcon;
3870
- }
3871
- getCurrentSortIcon() {
3872
- const regexp = /wz-table__head__cell__search--(?<icon>\w+)/;
3873
- const { groups } = regexp.exec(this.contentHeader.className);
3874
- return groups.icon;
3875
- }
3876
- emitEvents(newSort, newOrder) {
3877
- if (this.filterRouting) {
3878
- // Will send the filter routing value has changes event
3879
- this.filterGroup.setValues({
3880
- sort: newSort,
3881
- order: newOrder,
3882
- currentPage: 1
3883
- });
3884
- }
3885
- else {
3886
- // Send the event sort change
3887
- this.filtersTableService.emitSortChange(this.tableName, this.sortName, newOrder);
3888
- }
3889
- if (this.tableFilters) {
3890
- this.tableFilters.sort = this.sortName;
3891
- this.tableFilters.order = newOrder;
3892
- this.tableFilters.currentPage = 1;
3893
- this.tableFiltersChange.emit(this.tableFilters);
3894
- }
3895
- this.onSortChange.emit(newOrder);
3896
- }
3897
- ngOnDestroy() {
3898
- this.subscriptions.forEach(subscription => {
3899
- subscription.unsubscribe();
3900
- });
3901
- }
3902
- };
3903
- TableColumnHeader.ctorParameters = () => [
3904
- { type: ElementRef },
3905
- { type: Renderer2 },
3906
- { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
3907
- { type: FiltersTableService }
3908
- ];
3909
- __decorate([
3910
- Input('headerName') // Optional.
3911
- ,
3912
- __metadata("design:type", String),
3913
- __metadata("design:paramtypes", [String])
3914
- ], TableColumnHeader.prototype, "headerName", null);
3915
- __decorate([
3916
- Input('columnSize'),
3917
- __metadata("design:type", String)
3918
- ], TableColumnHeader.prototype, "columnSize", void 0);
3919
- __decorate([
3920
- Input('filterRouting'),
3921
- __metadata("design:type", Boolean)
3922
- ], TableColumnHeader.prototype, "filterRouting", void 0);
3923
- __decorate([
3924
- Input('tableName'),
3925
- __metadata("design:type", String)
3926
- ], TableColumnHeader.prototype, "tableName", void 0);
3927
- __decorate([
3928
- Input('sortName'),
3929
- __metadata("design:type", String)
3930
- ], TableColumnHeader.prototype, "sortName", void 0);
3931
- __decorate([
3932
- Input('centerCell'),
3933
- __metadata("design:type", String)
3934
- ], TableColumnHeader.prototype, "centerCell", void 0);
3935
- __decorate([
3936
- Output(),
3937
- __metadata("design:type", EventEmitter)
3938
- ], TableColumnHeader.prototype, "onSortChange", void 0);
3939
- __decorate([
3940
- Input(),
3941
- __metadata("design:type", Object)
3942
- ], TableColumnHeader.prototype, "tableFilters", void 0);
3943
- __decorate([
3944
- Output(),
3945
- __metadata("design:type", EventEmitter)
3946
- ], TableColumnHeader.prototype, "tableFiltersChange", void 0);
3947
- TableColumnHeader = __decorate([
3948
- Directive({
3949
- // The selector has the same name as the headerCell selector in table.component.html
3950
- selector: '[headerCell]'
3951
- }),
3952
- __param(2, Inject(DOCUMENT)),
3953
- __metadata("design:paramtypes", [ElementRef,
3954
- Renderer2, Object, FiltersTableService])
3955
- ], TableColumnHeader);
3956
-
3957
- let TableRow = class TableRow {
3958
- constructor(currentCell, renderer, document) {
3959
- this.currentCell = currentCell;
3960
- this.renderer = renderer;
3961
- this.document = document;
3962
- }
3963
- ngAfterViewInit() {
3964
- this.applyCustomStylesOnCell();
3965
- }
3966
- applyCustomStylesOnCell() {
3967
- this.renderer.addClass(this.currentCell.nativeElement, 'wz-table__body__line');
3968
- }
3969
- };
3970
- TableRow.ctorParameters = () => [
3971
- { type: ElementRef },
3972
- { type: Renderer2 },
3973
- { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
3974
- ];
3975
- TableRow = __decorate([
3976
- Directive({
3977
- // The selector has the same name as the tableRaw selector in table.component.html
3978
- selector: '[tableRow]'
3979
- }),
3980
- __param(2, Inject(DOCUMENT)),
3981
- __metadata("design:paramtypes", [ElementRef, Renderer2, Object])
3982
- ], TableRow);
3983
-
3984
- let ImageSrcPipe = class ImageSrcPipe {
3985
- constructor(imgCDNService) {
3986
- this.imgCDNService = imgCDNService;
3987
- }
3988
- transform(pictureName, size) {
3989
- if (!size) {
3990
- throw "The size is undefined in ImageSrcPipe.";
3991
- }
3992
- const route = this.imgCDNService.getUrlImg(size);
3993
- if (!route) {
3994
- throw "The expected size is not defined in ImageSrcPipe.";
3995
- }
3996
- return route + pictureName;
3997
- }
3998
- };
3999
- ImageSrcPipe.ctorParameters = () => [
4000
- { type: ImgCDNService }
4001
- ];
4002
- ImageSrcPipe = __decorate([
4003
- Pipe({
4004
- name: 'imgSrc'
4005
- }),
4006
- __metadata("design:paramtypes", [ImgCDNService])
4007
- ], ImageSrcPipe);
4008
-
4009
- let AbstractDebounceDirective = class AbstractDebounceDirective {
4010
- constructor() {
4011
- this.debounceTime = 500;
4012
- this.onEventChange = new EventEmitter();
4013
- this.emitEvent$ = new Subject();
4014
- this.subscription$ = new Subject();
4015
- }
4016
- ngOnInit() {
4017
- this.emitEvent$
4018
- .pipe(takeUntil(this.subscription$), debounceTime(this.debounceTime), distinctUntilChanged(), tap(value => this.emitChange(value)))
4019
- .subscribe();
4020
- }
4021
- emitChange(value) {
4022
- this.onEventChange.emit(value);
4023
- }
4024
- ngOnDestroy() {
4025
- this.subscription$.next();
4026
- this.subscription$.complete();
4027
- }
4028
- };
4029
- __decorate([
4030
- Input(),
4031
- __metadata("design:type", Number)
4032
- ], AbstractDebounceDirective.prototype, "debounceTime", void 0);
4033
- __decorate([
4034
- Output(),
4035
- __metadata("design:type", EventEmitter)
4036
- ], AbstractDebounceDirective.prototype, "onEventChange", void 0);
4037
- AbstractDebounceDirective = __decorate([
4038
- Directive({
4039
- selector: 'AbstractDebounceDirective'
4040
- }),
4041
- __metadata("design:paramtypes", [])
4042
- ], AbstractDebounceDirective);
4043
-
4044
- let DebounceKeyupDirective = class DebounceKeyupDirective extends AbstractDebounceDirective {
4045
- constructor() {
4046
- super();
4047
- }
4048
- onKeyUp(event) {
4049
- event.preventDefault();
4050
- this.emitEvent$.next(event);
4051
- }
4052
- };
4053
- __decorate([
4054
- HostListener('keyup', ['$event']),
4055
- __metadata("design:type", Function),
4056
- __metadata("design:paramtypes", [Object]),
4057
- __metadata("design:returntype", void 0)
4058
- ], DebounceKeyupDirective.prototype, "onKeyUp", null);
4059
- DebounceKeyupDirective = __decorate([
4060
- Directive({
4061
- selector: 'input[debounceKeyUp]'
4062
- }),
4063
- __metadata("design:paramtypes", [])
4064
- ], DebounceKeyupDirective);
4065
-
4066
- let LoaderComponent = class LoaderComponent {
4067
- constructor() {
4068
- this.small = false;
4069
- }
4070
- };
4071
- __decorate([
4072
- Input(),
4073
- __metadata("design:type", String)
4074
- ], LoaderComponent.prototype, "text", void 0);
4075
- __decorate([
4076
- Input(),
4077
- __metadata("design:type", Object)
4078
- ], LoaderComponent.prototype, "small", void 0);
4079
- __decorate([
4080
- Input(),
4081
- __metadata("design:type", String)
4082
- ], LoaderComponent.prototype, "position", void 0);
4083
- LoaderComponent = __decorate([
4084
- Component({
4085
- selector: 'wz-loader',
4086
- template: "<div class=\"wz-loader\" [ngClass]=\"{'is-small': small}\" [ngStyle]=\"{'position': position}\">\n <div class='loader loader1'>\n <div>\n <div>\n <div>\n <div>\n <div>\n <div></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n <p class=\"is-textcentered\" *ngIf=\"text\" [innerHTML]=\"text\"></p>\n</div>\n",
4087
- encapsulation: ViewEncapsulation.None
4088
- })
4089
- ], LoaderComponent);
4090
-
4091
- let AlertComponent = class AlertComponent {
4092
- constructor() {
4093
- this.icon = true;
4094
- this.warning = false;
4095
- this.success = false;
4096
- this.iconClass = 'fas fa-info';
4097
- }
4098
- ngOnInit() { }
4099
- };
4100
- __decorate([
4101
- Input(),
4102
- __metadata("design:type", Object)
4103
- ], AlertComponent.prototype, "icon", void 0);
4104
- __decorate([
4105
- Input(),
4106
- __metadata("design:type", Object)
4107
- ], AlertComponent.prototype, "warning", void 0);
4108
- __decorate([
4109
- Input(),
4110
- __metadata("design:type", Object)
4111
- ], AlertComponent.prototype, "success", void 0);
4112
- __decorate([
4113
- Input(),
4114
- __metadata("design:type", Object)
4115
- ], AlertComponent.prototype, "iconClass", void 0);
4116
- AlertComponent = __decorate([
4117
- Component({
4118
- selector: 'wz-alert',
4119
- template: "<div class=\"wz-alert\" [ngClass]=\"{ success: success, warning: warning }\">\n <i *ngIf=\"icon\" [ngClass]=\"iconClass\"></i>\n <p><ng-content></ng-content></p>\n</div>\n",
4120
- styles: [".wz-alert{width:100%;background-color:rgba(82,174,205,.15);color:#52aecd;border-radius:3px;display:flex;flex-wrap:nowrap;justify-content:space-between;padding:20px}.wz-alert.success{background-color:rgba(46,204,113,.15)}.wz-alert.success p,.wz-alert.success p>*{color:#11552e}.wz-alert.success i{color:#2ecc71}.wz-alert.warning{background-color:rgba(233,86,86,.15)}.wz-alert.warning p,.wz-alert.warning p>*{color:#3a0505}.wz-alert.warning i{color:#e95656}.wz-alert p{width:100%;font-size:rem(14);line-height:rem(25);margin:0;padding:0;color:#1e5568}.wz-alert p>*{color:#1e5568}.wz-alert i{width:auto;margin:0 10px 0 0;color:inherit;font-size:rem(14);line-height:rem(25)}"]
4121
- }),
4122
- __metadata("design:paramtypes", [])
4123
- ], AlertComponent);
4124
-
4125
- let NumberToArray = class NumberToArray {
4126
- transform(number) {
4127
- return Array.from('x'.repeat(number));
4128
- }
4129
- };
4130
- NumberToArray = __decorate([
4131
- Pipe({
4132
- name: 'numberToArray'
4133
- })
4134
- ], NumberToArray);
4135
-
4136
- let PageSelectorComponent = class PageSelectorComponent {
4137
- constructor() {
4138
- this.openAbsoluteSelect = false;
4139
- this.largeNumberOfPage = false;
4140
- this.numberOfPage = 0;
4141
- this.pageChange = new EventEmitter();
4142
- }
4143
- set pagination(pagination) {
4144
- this._pagination = pagination;
4145
- }
4146
- get pagination() {
4147
- return this._pagination;
4148
- }
4149
- set totalItems(totalItems) {
4150
- this.numberOfPage = Math.ceil(totalItems / this.pagination.itemsPerPage);
4151
- this.largeNumberOfPage = this.numberOfPage > 30;
4152
- }
4153
- get totalItems() {
4154
- return this._totalItems;
4155
- }
4156
- onGotoPageChange(event, directValue) {
4157
- if (directValue) {
4158
- this.pageChange.emit(event);
4159
- this.openAbsoluteSelect = false;
4160
- }
4161
- else {
4162
- this.pageChange.emit(parseInt(event.target.value));
4163
- }
4164
- }
4165
- };
4166
- __decorate([
4167
- Input(),
4168
- __metadata("design:type", Object),
4169
- __metadata("design:paramtypes", [Object])
4170
- ], PageSelectorComponent.prototype, "pagination", null);
4171
- __decorate([
4172
- Input(),
4173
- __metadata("design:type", Number),
4174
- __metadata("design:paramtypes", [Number])
4175
- ], PageSelectorComponent.prototype, "totalItems", null);
4176
- __decorate([
4177
- Output(),
4178
- __metadata("design:type", EventEmitter)
4179
- ], PageSelectorComponent.prototype, "pageChange", void 0);
4180
- PageSelectorComponent = __decorate([
4181
- Component({
4182
- selector: 'wz-page-selector',
4183
- template: "<div class=\"wz-selector\">\n\n <div class=\"wz-selector__default\" [ngStyle]=\"{'width': 40 + (10*pagination.currentPage.toString().length) + 'px'}\">\n <div class=\"wz-selector__default__base\" *ngIf=\"largeNumberOfPage;\" (click)=\"openAbsoluteSelect = !openAbsoluteSelect\">\n <input name=\"page-input\" [value]=\"pagination.currentPage\" (change)=\"onGotoPageChange($event, false);openAbsoluteSelect = false;\" [ngStyle]=\"{'width': 40 + (10*pagination.currentPage.toString().length) + 'px'}\" />\n <i class=\"fas fa-sort-down\"></i>\n </div>\n <div class=\"wz-selector__default__absolute\" *ngIf=\"openAbsoluteSelect\">\n <div class=\"wz-selector__default__absolute__wrapper\" *ngFor=\"let pageIndex of (pagination.totalItems | LargeNumberOfPage: pagination.itemsPerPage : pagination.currentPage).slice().reverse() as result\">\n <div class=\"wz-selector__default__absolute__wrapper__item\" [ngClass]=\"{'selected': pageIndex.value === pagination.currentPage}\" (click)=\"onGotoPageChange(pageIndex.value, true)\">\n <span>{{ pageIndex.display }}</span>\n </div>\n </div>\n </div>\n </div>\n\n <ng-container *ngIf=\"!largeNumberOfPage\">\n <select name=\"page\" (change)=\"onGotoPageChange($event, false)\" [ngStyle]=\"{'width': 40 + (10*pagination.currentPage.toString().length) + 'px'}\">\n <ng-container *ngFor=\"let pageIndex of pagination.totalItems | ArrayTotalPages: pagination.itemsPerPage\">\n <option [selected]=\"pageIndex === pagination.currentPage\" [value]=\"pageIndex\">\n {{ pageIndex }}\n </option>\n </ng-container>\n </select>\n </ng-container>\n</div>\n"
4184
- }),
4185
- __metadata("design:paramtypes", [])
4186
- ], PageSelectorComponent);
4187
-
4188
- let LargeNumberOfPagePipe = class LargeNumberOfPagePipe {
4189
- /**
4190
- * Return an incremental array
4191
- * Display 30 pages, from -15 to +15 of the current page
4192
- * @param totalItems
4193
- * @param itemsPerPage
4194
- */
4195
- transform(totalItems, itemsPerPage, currentPage) {
4196
- if (!(totalItems >= 0 && itemsPerPage >= 0)) {
4197
- throw new Error('totalItems or itemsPerPage missing in ArrayTotalPages pipe.');
4198
- }
4199
- let arrayLength = 32;
4200
- const startAtPage = currentPage <= 15 ? 0 : currentPage - 15;
4201
- const totalPage = Math.ceil(totalItems / itemsPerPage);
4202
- const arrayWithPageNumber = Array.apply(null, { length: arrayLength })
4203
- .map(Number.call, Number)
4204
- .map((x) => {
4205
- const pageIndex = {
4206
- display: startAtPage + x + 1,
4207
- value: startAtPage + x + 1
4208
- };
4209
- if (x === arrayLength - 2) {
4210
- pageIndex.display = '...';
4211
- }
4212
- if (x === arrayLength - 1) {
4213
- pageIndex.display = totalPage;
4214
- pageIndex.value = totalPage;
4215
- }
4216
- return pageIndex;
4217
- });
4218
- if (startAtPage) {
4219
- arrayWithPageNumber.unshift({
4220
- display: 1,
4221
- value: 1
4222
- }, {
4223
- display: "...",
4224
- value: 2
4225
- });
4226
- }
4227
- return arrayWithPageNumber;
4228
- }
4229
- };
4230
- LargeNumberOfPagePipe = __decorate([
4231
- Pipe({
4232
- name: 'LargeNumberOfPage'
4233
- })
4234
- ], LargeNumberOfPagePipe);
4235
-
4236
- var SelectComponent_1;
4237
- let SelectComponent = SelectComponent_1 = class SelectComponent {
4238
- constructor(translateService) {
4239
- this.translateService = translateService;
4240
- this.search = false;
4241
- this.type = 'default';
4242
- this.maxWidth = '100%';
4243
- this.disabled = false;
4244
- this.selectValue = new EventEmitter();
4245
- this.clickOnCallToAction = new EventEmitter();
4246
- this.openCategories = false;
4247
- this.searchValue = '';
4248
- this.indexItemSelected = -1;
4249
- // ControlValueAccessor methods
4250
- this.onChange = () => { };
4251
- this.onTouch = () => { };
4252
- }
4253
- ngOnInit() {
4254
- this.indexItemSelected = this.items.findIndex(item => item.selected);
4255
- }
4256
- onClose() {
4257
- this.openCategories = false;
4258
- }
4259
- customTB(item, index) {
4260
- return `${item.id}-${index}`;
4261
- }
4262
- onSelectItem(id) {
4263
- this.unselectAll();
4264
- this.setIndexItemSelected(id);
4265
- const itemSelected = this.getItemSelected();
4266
- itemSelected.selected = true;
4267
- this.selectValue.emit(this.indexItemSelected);
4268
- this.onChange(itemSelected);
4269
- }
4270
- onClickCallToAction() {
4271
- this.onClose();
4272
- this.clickOnCallToAction.emit(this.callToAction.value);
4273
- }
4274
- getItemSelected() {
4275
- return this.items[this.indexItemSelected];
4276
- }
4277
- showCategories() {
4278
- this.openCategories = true;
4279
- setTimeout(() => {
4280
- this.searchElement.nativeElement.focus();
4281
- }, 0);
4282
- }
4283
- unselectAll() {
4284
- this.items.forEach(item => item.selected = false);
4285
- }
4286
- setIndexItemSelected(id) {
4287
- this.indexItemSelected = this.items.findIndex(item => item.id === id);
4288
- }
4289
- writeValue(selectItem) {
4290
- if (!selectItem) {
4291
- return;
4292
- }
4293
- this.unselectAll();
4294
- selectItem.selected = true;
4295
- this.setIndexItemSelected(selectItem.id);
4296
- }
4297
- registerOnChange(fn) {
4298
- this.onChange = fn;
4299
- }
4300
- registerOnTouched(fn) {
4301
- this.onTouch = fn;
4302
- }
4303
- };
4304
- SelectComponent.ctorParameters = () => [
4305
- { type: TranslateService }
4306
- ];
4307
- __decorate([
4308
- Input(),
4309
- __metadata("design:type", Array)
4310
- ], SelectComponent.prototype, "items", void 0);
4311
- __decorate([
4312
- Input(),
4313
- __metadata("design:type", String)
4314
- ], SelectComponent.prototype, "placeholder", void 0);
4315
- __decorate([
4316
- Input(),
4317
- __metadata("design:type", String)
4318
- ], SelectComponent.prototype, "label", void 0);
4319
- __decorate([
4320
- Input(),
4321
- __metadata("design:type", String)
4322
- ], SelectComponent.prototype, "maxWidthItems", void 0);
4323
- __decorate([
4324
- Input(),
4325
- __metadata("design:type", Object)
4326
- ], SelectComponent.prototype, "search", void 0);
4327
- __decorate([
4328
- Input(),
4329
- __metadata("design:type", Object)
4330
- ], SelectComponent.prototype, "type", void 0);
4331
- __decorate([
4332
- Input(),
4333
- __metadata("design:type", Object)
4334
- ], SelectComponent.prototype, "callToAction", void 0);
4335
- __decorate([
4336
- Input(),
4337
- __metadata("design:type", Object)
4338
- ], SelectComponent.prototype, "maxWidth", void 0);
4339
- __decorate([
4340
- Input(),
4341
- __metadata("design:type", Object)
4342
- ], SelectComponent.prototype, "disabled", void 0);
4343
- __decorate([
4344
- Output(),
4345
- __metadata("design:type", Object)
4346
- ], SelectComponent.prototype, "selectValue", void 0);
4347
- __decorate([
4348
- Output(),
4349
- __metadata("design:type", Object)
4350
- ], SelectComponent.prototype, "clickOnCallToAction", void 0);
4351
- __decorate([
4352
- ViewChild('search'),
4353
- __metadata("design:type", ElementRef)
4354
- ], SelectComponent.prototype, "searchElement", void 0);
4355
- SelectComponent = SelectComponent_1 = __decorate([
4356
- Component({
4357
- selector: 'wac-select',
4358
- template: "<p *ngIf=\"label\" [innerHTML]=\"label\" class=\"wac-select__label\"></p>\n\n<div class=\"wac-select\" wzAutoHide (clickOutside)=\"onClose()\" [ngStyle]=\"{ 'max-width': maxWidth }\" [zIndexToggle]=\"openCategories\">\n\n <div class=\"wac-select__current\" [ngClass]=\"{ 'select-disabled' : disabled }\" (click)=\"!disabled && openCategories = !openCategories\" *ngIf=\"!search\">\n <span *ngIf=\"indexItemSelected !== -1\" class=\"icon\" [innerHTML]=\"items[indexItemSelected].icon\"></span>\n <span [innerHTML]=\"(indexItemSelected !== -1 ? items[indexItemSelected].name : placeholder) | translate\"></span><span><i class=\"fas fa-chevron-down\"></i></span>\n </div>\n\n <div class=\"wac-select__current wac-select__current--withSearch\" [ngClass]=\"{ 'select-disabled' : disabled, 'open-search': openCategories }\" *ngIf=\"search\">\n <div class=\"wac-select__current__search\" *ngIf=\"openCategories && !disabled\">\n <i class=\"far fa-search\"></i>\n <input #search type=\"text\" [(ngModel)]=\"searchValue\" />\n </div>\n <span (click)=\"openCategories = !openCategories;\" *ngIf=\"items[indexItemSelected]?.icon && !openCategories\" class=\"icon\" [innerHTML]=\"items[indexItemSelected].icon\"></span>\n <span (click)=\"showCategories()\" [innerHTML]=\"items[indexItemSelected]?.name ? items[indexItemSelected].name : placeholder\"></span>\n <span (click)=\"openCategories = !openCategories;\"><i class=\"fas fa-chevron-down\"></i></span>\n </div>\n\n <div class=\"wac-select__content\" *ngIf=\"!disabled\" [ngClass]=\"{ hidden: !openCategories, open: type === 'open' }\" [ngStyle]=\"{ 'max-width': maxWidthItems }\">\n <div [perfectScrollbar]=\"{ suppressScrollX: true }\" *ngIf=\"items.length\">\n\n <div *ngIf=\"callToAction\" class=\"wac-select__content__cta\">\n <div (click)=\"onClickCallToAction()\">\n <i *ngIf=\"callToAction.icon\" [classList]=\"callToAction.icon\"></i><strong *ngIf=\"callToAction.boldText\">{{ callToAction.boldText }}</strong\n ><span>{{ callToAction?.name }}</span>\n </div>\n </div>\n\n <div\n *ngFor=\"let item of items | selectFilters: searchValue; let index = index;\"\n (click)=\"onClose()\"\n class=\"wac-select__content__item\"\n >\n <div *ngIf=\"!item.hide\" [ngClass]=\"{ selected: item.selected }\" (click)=\"onSelectItem(item.id)\">\n <span class=\"icon\" [innerHTML]=\"item.icon\" *ngIf=\"item.icon\"></span>{{ item.name | translate }}\n </div>\n </div>\n\n </div>\n\n <div *ngIf=\"!(items | selectFilters: searchValue)?.length\" class=\"wac-select__content__empty\">\n <span>{{'wac.datatable.noresult' | translate}}</span>\n </div>\n\n </div>\n</div>",
4359
- providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: SelectComponent_1, multi: true }]
4360
- }),
4361
- __metadata("design:paramtypes", [TranslateService])
4362
- ], SelectComponent);
4363
-
4364
- let SelectFiltersPipe = class SelectFiltersPipe {
4365
- transform(items, filterName) {
4366
- return items.filter(item => {
4367
- const regexp = new RegExp(filterName, 'i');
4368
- return regexp.test(item.name);
4369
- });
4370
- }
4371
- };
4372
- SelectFiltersPipe = __decorate([
4373
- Pipe({
4374
- name: 'selectFilters'
4375
- })
4376
- ], SelectFiltersPipe);
4377
-
4378
- let ZindexToggleDirective = class ZindexToggleDirective {
4379
- constructor(currentElement, renderer) {
4380
- this.currentElement = currentElement;
4381
- this.renderer = renderer;
4382
- this.isActived = false;
4383
- }
4384
- set isActive(value) {
4385
- this.isActived = value;
4386
- this.switchToggle();
4387
- }
4388
- get isActive() {
4389
- return this.isActived;
4390
- }
4391
- ngOnInit() {
4392
- }
4393
- switchToggle() {
4394
- if (this.isActived) {
4395
- this.renderer.addClass(this.currentElement.nativeElement.parentElement.parentNode, 'zindexToggle');
4396
- }
4397
- else {
4398
- this.renderer.removeClass(this.currentElement.nativeElement.parentElement.parentNode, 'zindexToggle');
4399
- }
4400
- }
4401
- ngOnDestroy() {
4402
- }
4403
- };
4404
- ZindexToggleDirective.ctorParameters = () => [
4405
- { type: ElementRef },
4406
- { type: Renderer2 }
4407
- ];
4408
- __decorate([
4409
- Output(),
4410
- __metadata("design:type", EventEmitter)
4411
- ], ZindexToggleDirective.prototype, "onEventChange", void 0);
4412
- __decorate([
4413
- Input('zIndexToggle'),
4414
- __metadata("design:type", Boolean),
4415
- __metadata("design:paramtypes", [Boolean])
4416
- ], ZindexToggleDirective.prototype, "isActive", null);
4417
- ZindexToggleDirective = __decorate([
4418
- Directive({
4419
- selector: '[zIndexToggle]'
4420
- }),
4421
- __metadata("design:paramtypes", [ElementRef, Renderer2])
4422
- ], ZindexToggleDirective);
4423
-
4424
- ;
4425
- const components = [
4426
- WzImgManagerComponent,
4427
- ImgTabsComponent,
4428
- ImgUploadComponent,
4429
- PexelLibComponent,
4430
- ImgCardComponent,
4431
- UploadListComponent,
4432
- ImgEditorComponent,
4433
- EditorInfoSectionComponent,
4434
- CanvaBtnComponent,
4435
- ImgSelectionComponent,
4436
- LoaderComponent,
4437
- DropdownComponent,
4438
- CropperComponent,
4439
- ImagesViewComponent,
4440
- MosaicViewComponent,
4441
- TableViewComponent,
4442
- TableComponent,
4443
- InputSearchComponent,
4444
- PaginationComponent,
4445
- CheckboxComponent,
4446
- AlertComponent,
4447
- PageSelectorComponent,
4448
- SelectComponent
4449
- ];
4450
- const directives = [
4451
- DragDropDirective,
4452
- LoadingDirective,
4453
- AutoHideDirective,
4454
- CopyClipboardDirective,
4455
- TableColumn,
4456
- CheckBoxRow,
4457
- TableColumnHeader,
4458
- TableRow,
4459
- AbstractDebounceDirective,
4460
- DebounceKeyupDirective,
4461
- ZindexToggleDirective
4462
- ];
4463
- const pipes = [
4464
- PagniationArrayTotalPages,
4465
- PagniationIsLastPage,
4466
- PagniationText,
4467
- ImageSrcPipe,
4468
- NumberToArray,
4469
- LargeNumberOfPagePipe,
4470
- SelectFiltersPipe
4471
- ];
4472
- let WzImgManagerModule = class WzImgManagerModule {
4473
- };
4474
- WzImgManagerModule = __decorate([
4475
- NgModule({
4476
- declarations: [
4477
- ...components,
4478
- ...directives,
4479
- ...pipes
4480
- ],
4481
- imports: [
4482
- CommonModule,
4483
- HttpClientModule,
4484
- FormsModule,
4485
- NgScrollbarModule,
4486
- NgScrollbarReachedModule,
4487
- NwbAllModule,
4488
- ImageCropperModule,
4489
- CdkTableModule,
4490
- DragDropModule,
4491
- TranslateModule,
4492
- PerfectScrollbarModule
4493
- ],
4494
- providers: [],
4495
- exports: [
4496
- WzImgManagerComponent
4497
- ]
4498
- })
4499
- ], WzImgManagerModule);
4500
-
4501
- class CanvaButtonApi {
4502
- }
4503
- ;
4504
-
4505
- class ImgApiDto {
4506
- constructor() {
4507
- this.image_manager_route = '';
4508
- this.pexels_route = '';
4509
- this.canva_url = '';
4510
- this.assets_route = 'assets/img-manager/';
4511
- }
4512
- }
4513
-
4514
- class ImgCDNConfigDTO {
4515
- constructor() {
4516
- this.url_raw_image = '';
4517
- this.url_100_image = '';
4518
- this.url_200_image = '';
4519
- this.url_400_image = '';
4520
- this.url_800_image = '';
4521
- }
4522
- }
4523
-
4524
- /*
4525
- * Public API Surface of wz-img-manager
4526
- */
4527
-
4528
- /**
4529
- * Generated bundle index. Do not edit.
4530
- */
4531
-
4532
- export { CanvaButtonApi, CanvaService, ImgApiDto, ImgCDNConfigDTO, ImgManagerConfigDto, ImgManagerService, ImgSelectionService, RenamePictureService, WzImgManagerComponent, WzImgManagerModule, ImgManagerConfigService as ɵa, ImgCDNService as ɵb, TableComponent as ɵba, FiltersTableService as ɵbb, InputSearchComponent as ɵbc, PaginationComponent as ɵbd, CheckboxComponent as ɵbe, AlertComponent as ɵbf, PageSelectorComponent as ɵbg, SelectComponent as ɵbh, DragDropDirective as ɵbi, LoadingDirective as ɵbj, AutoHideDirective as ɵbk, CopyClipboardDirective as ɵbl, TableColumn as ɵbm, CheckBoxRow as ɵbn, TableColumnHeader as ɵbo, TableRow as ɵbp, AbstractDebounceDirective as ɵbq, DebounceKeyupDirective as ɵbr, ZindexToggleDirective as ɵbs, PagniationArrayTotalPages as ɵbt, PagniationIsLastPage as ɵbu, PagniationText as ɵbv, ImageSrcPipe as ɵbw, NumberToArray as ɵbx, LargeNumberOfPagePipe as ɵby, SelectFiltersPipe as ɵbz, UserSettingsService as ɵc, ImgEventService as ɵd, AlertService as ɵe, DomService as ɵf, ImgTabsComponent as ɵg, ImgUploadComponent as ɵh, easeInOut as ɵi, PexelLibComponent as ɵj, listAnnimation as ɵk, PexelsService as ɵl, ImgCardComponent as ɵm, ImagesActionHandler as ɵn, UploadListComponent as ɵo, ImgEditorComponent as ɵp, EditorInfoSectionComponent as ɵq, CanvaBtnComponent as ɵr, ImgSelectionComponent as ɵs, LoaderComponent as ɵt, DropdownComponent as ɵu, CropperComponent as ɵv, insertRemove as ɵw, ImagesViewComponent as ɵx, MosaicViewComponent as ɵy, TableViewComponent as ɵz };
4533
- //# sourceMappingURL=wizishop-img-manager.js.map