@webitel/ui-sdk 0.1.13 → 0.1.100

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 (376) hide show
  1. package/README.md +29 -29
  2. package/dist/img/plyr.svg +68 -0
  3. package/dist/img/sprite/account.svg +4 -0
  4. package/dist/img/sprite/adfs.svg +5 -0
  5. package/dist/img/sprite/app-navigator.svg +11 -0
  6. package/dist/img/sprite/arrow-down.svg +3 -0
  7. package/dist/img/sprite/arrow-left.svg +3 -0
  8. package/dist/img/sprite/arrow-right.svg +3 -0
  9. package/dist/img/sprite/arrow-up.svg +3 -0
  10. package/dist/img/sprite/attach.svg +3 -0
  11. package/dist/img/sprite/attention.svg +3 -0
  12. package/dist/img/sprite/back.svg +4 -0
  13. package/dist/img/sprite/bell-badged.svg +4 -0
  14. package/dist/img/sprite/bell.svg +3 -0
  15. package/dist/img/sprite/bucket.svg +3 -0
  16. package/dist/img/sprite/calendar.svg +3 -0
  17. package/dist/img/sprite/call--filled.svg +3 -0
  18. package/dist/img/sprite/call-add-to--filled.svg +4 -0
  19. package/dist/img/sprite/call-add-to.svg +4 -0
  20. package/dist/img/sprite/call-disconnect--filled.svg +3 -0
  21. package/dist/img/sprite/call-disconnect.svg +3 -0
  22. package/dist/img/sprite/call-end--filled.svg +3 -0
  23. package/dist/img/sprite/call-end.svg +3 -0
  24. package/dist/img/sprite/call-inbound--filled.svg +4 -0
  25. package/dist/img/sprite/call-inbound.svg +3 -0
  26. package/dist/img/sprite/call-missed--filled.svg +4 -0
  27. package/dist/img/sprite/call-missed.svg +3 -0
  28. package/dist/img/sprite/call-outbound--filled.svg +3 -0
  29. package/dist/img/sprite/call-outbound.svg +3 -0
  30. package/dist/img/sprite/call-ringing--filled.svg +5 -0
  31. package/dist/img/sprite/call-ringing.svg +3 -0
  32. package/dist/img/sprite/call-transfer--filled.svg +4 -0
  33. package/dist/img/sprite/call-transfer.svg +3 -0
  34. package/dist/img/sprite/call.svg +3 -0
  35. package/dist/img/sprite/chat--filled.svg +3 -0
  36. package/dist/img/sprite/chat-emoji.svg +3 -0
  37. package/dist/img/sprite/chat-end--filled.svg +3 -0
  38. package/dist/img/sprite/chat-end.svg +4 -0
  39. package/dist/img/sprite/chat-group.svg +5 -0
  40. package/dist/img/sprite/chat-join.svg +4 -0
  41. package/dist/img/sprite/chat-message-status-read.svg +3 -0
  42. package/dist/img/sprite/chat-message-status-sent.svg +3 -0
  43. package/dist/img/sprite/chat-quick-response--filled.svg +3 -0
  44. package/dist/img/sprite/chat-quick-response.svg +3 -0
  45. package/dist/img/sprite/chat-reply.svg +3 -0
  46. package/dist/img/sprite/chat-send.svg +6 -0
  47. package/dist/img/sprite/chat-transfer--filled.svg +3 -0
  48. package/dist/img/sprite/chat-transfer.svg +4 -0
  49. package/dist/img/sprite/chat.svg +3 -0
  50. package/dist/img/sprite/checkbox--checked--filled.svg +3 -0
  51. package/dist/img/sprite/checkbox--checked.svg +3 -0
  52. package/dist/img/sprite/checkbox.svg +3 -0
  53. package/dist/img/sprite/clear.svg +3 -0
  54. package/dist/img/sprite/close--filled.svg +3 -0
  55. package/dist/img/sprite/close.svg +3 -0
  56. package/dist/img/sprite/collapse.svg +5 -0
  57. package/dist/img/sprite/column-select.svg +4 -0
  58. package/dist/img/sprite/contacts.svg +3 -0
  59. package/dist/img/sprite/copy.svg +3 -0
  60. package/dist/img/sprite/docs.svg +6 -0
  61. package/dist/img/sprite/done.svg +4 -0
  62. package/dist/img/sprite/download.svg +5 -0
  63. package/dist/img/sprite/edit.svg +3 -0
  64. package/dist/img/sprite/expand.svg +5 -0
  65. package/dist/img/sprite/eye--closed.svg +5 -0
  66. package/dist/img/sprite/eye--opened.svg +4 -0
  67. package/dist/img/sprite/filter.svg +5 -0
  68. package/dist/img/sprite/generate.svg +4 -0
  69. package/dist/img/sprite/google.svg +6 -0
  70. package/dist/img/sprite/history.svg +4 -0
  71. package/dist/img/sprite/hold.svg +3 -0
  72. package/dist/img/sprite/index.js +120 -0
  73. package/dist/img/sprite/lock.svg +3 -0
  74. package/dist/img/sprite/logout.svg +3 -0
  75. package/dist/img/sprite/menu.svg +3 -0
  76. package/dist/img/sprite/messenger-facebook.svg +3 -0
  77. package/dist/img/sprite/messenger-infobip.svg +9 -0
  78. package/dist/img/sprite/messenger-telegram.svg +6 -0
  79. package/dist/img/sprite/messenger-viber.svg +3 -0
  80. package/dist/img/sprite/messenger-web-chat.svg +7 -0
  81. package/dist/img/sprite/messenger-whatsapp.svg +4 -0
  82. package/dist/img/sprite/mic-muted.svg +6 -0
  83. package/dist/img/sprite/mic.svg +4 -0
  84. package/dist/img/sprite/move.svg +6 -0
  85. package/dist/img/sprite/note.svg +3 -0
  86. package/dist/img/sprite/numpad.svg +24 -0
  87. package/dist/img/sprite/pause.svg +3 -0
  88. package/dist/img/sprite/play.svg +4 -0
  89. package/dist/img/sprite/plus.svg +3 -0
  90. package/dist/img/sprite/prompter.svg +3 -0
  91. package/dist/img/sprite/queue-member.svg +3 -0
  92. package/dist/img/sprite/radio--checked.svg +4 -0
  93. package/dist/img/sprite/radio.svg +3 -0
  94. package/dist/img/sprite/rec-off.svg +3 -0
  95. package/dist/img/sprite/rec.svg +4 -0
  96. package/dist/img/sprite/refresh.svg +4 -0
  97. package/dist/img/sprite/rounded-info.svg +3 -0
  98. package/dist/img/sprite/search.svg +3 -0
  99. package/dist/img/sprite/send-arrow.svg +4 -0
  100. package/dist/img/sprite/settings.svg +3 -0
  101. package/dist/img/sprite/sort-arrow-down.svg +4 -0
  102. package/dist/img/sprite/sort-arrow-up.svg +4 -0
  103. package/dist/img/sprite/sound-off.svg +4 -0
  104. package/dist/img/sprite/sound-on.svg +3 -0
  105. package/dist/img/sprite/star--filled.svg +3 -0
  106. package/dist/img/sprite/star.svg +3 -0
  107. package/dist/img/sprite/stop.svg +4 -0
  108. package/dist/img/sprite/tick.svg +3 -0
  109. package/dist/img/sprite/upload.svg +5 -0
  110. package/dist/img/sprite/video-off.svg +4 -0
  111. package/dist/img/sprite/video.svg +3 -0
  112. package/dist/img/sprite/widget-avg-hold.svg +3 -0
  113. package/dist/img/sprite/widget-avg-talk.svg +8 -0
  114. package/dist/img/sprite/widget-handles.svg +4 -0
  115. package/dist/img/sprite/widget-inbound.svg +6 -0
  116. package/dist/img/sprite/widget-missed.svg +5 -0
  117. package/dist/img/sprite/widget-occupancy.svg +5 -0
  118. package/dist/img/sprite/widget-utilization.svg +6 -0
  119. package/dist/img/sprite/zoom-in.svg +3 -0
  120. package/dist/img/sprite/zoom-out.svg +3 -0
  121. package/dist/ui-sdk.common.js +8729 -4165
  122. package/dist/ui-sdk.common.js.map +1 -1
  123. package/dist/ui-sdk.css +1 -1
  124. package/dist/ui-sdk.umd.js +8729 -4165
  125. package/dist/ui-sdk.umd.js.map +1 -1
  126. package/dist/ui-sdk.umd.min.js +3 -1
  127. package/dist/ui-sdk.umd.min.js.map +1 -1
  128. package/package.json +64 -42
  129. package/src/components/atoms/wt-badge/__tests__/WtBadge.spec.js +19 -0
  130. package/src/components/atoms/wt-badge/wt-badge.vue +23 -0
  131. package/src/components/atoms/wt-button/__tests__/WtButton.spec.js +29 -0
  132. package/src/components/atoms/wt-button/wt-button.vue +211 -0
  133. package/src/components/atoms/wt-context-menu/__tests__/WtContextMenu.spec.js +43 -0
  134. package/src/components/atoms/wt-context-menu/wt-context-menu.vue +78 -0
  135. package/src/components/atoms/wt-divider/__tests__/WtDivider.spec.js +9 -0
  136. package/src/components/atoms/wt-divider/wt-divider.vue +25 -0
  137. package/src/components/atoms/wt-icon/__tests__/WtIcon.spec.js +24 -0
  138. package/src/components/atoms/wt-icon/wt-icon.vue +134 -0
  139. package/src/components/atoms/wt-indicator/__tests__/WtIndicator.spec.js +29 -0
  140. package/src/components/atoms/wt-indicator/wt-indicator.vue +81 -0
  141. package/src/components/atoms/wt-input-info/__tests__/WtInputInfo.spec.js +9 -0
  142. package/src/components/atoms/wt-input-info/wt-input-info.vue +35 -0
  143. package/src/components/atoms/wt-loader/__tests__/WtLoader.spec.js +9 -0
  144. package/src/components/atoms/wt-loader/_internals/wt-loader--md.vue +83 -0
  145. package/src/components/atoms/wt-loader/_internals/wt-loader--sm.vue +189 -0
  146. package/src/components/atoms/wt-loader/wt-loader.vue +34 -0
  147. package/src/components/atoms/wt-rounded-action/__tests__/WtRoundedAction.spec.js +20 -0
  148. package/src/components/atoms/wt-rounded-action/wt-rounded-action.vue +227 -0
  149. package/src/components/atoms/wt-tooltip/__tests__/WtTooltip.spec.js +29 -0
  150. package/src/components/atoms/wt-tooltip/wt-tooltip.vue +54 -0
  151. package/src/components/index.js +102 -0
  152. package/src/components/molecules/wt-button-select/__tests__/WtButtonSelect.spec.js +63 -0
  153. package/src/components/molecules/wt-button-select/wt-button-select.vue +187 -0
  154. package/src/components/molecules/wt-checkbox/__tests__/WtCheckbox.spec.js +41 -0
  155. package/src/components/molecules/wt-checkbox/wt-checkbox.vue +175 -0
  156. package/src/components/molecules/wt-datepicker/__tests__/WtDatepicker.spec.js +28 -0
  157. package/src/components/molecules/wt-datepicker/wt-datepicker.vue +209 -0
  158. package/src/components/molecules/wt-datetimepicker/__tests__/WtDatetimepicker.spec.js +67 -0
  159. package/src/components/molecules/wt-datetimepicker/wt-datetimepicker.vue +314 -0
  160. package/src/components/molecules/wt-icon-btn/__tests__/WtIconBtn.spec.js +31 -0
  161. package/src/components/molecules/wt-icon-btn/wt-icon-btn.vue +113 -0
  162. package/src/components/molecules/wt-input/__tests__/WtInput.spec.js +25 -0
  163. package/src/components/molecules/wt-input/wt-input.vue +342 -0
  164. package/src/components/molecules/wt-label/__tests__/WtLabel.spec.js +9 -0
  165. package/src/components/molecules/wt-label/wt-label.vue +87 -0
  166. package/src/components/molecules/wt-notification/__tests__/WtNotification.spec.js +21 -0
  167. package/src/components/molecules/wt-notification/wt-notification.vue +74 -0
  168. package/src/components/molecules/wt-popup/__tests__/WtPopup.spec.js +47 -0
  169. package/src/components/molecules/wt-popup/wt-popup.vue +130 -0
  170. package/src/components/molecules/wt-progress-bar/__tests__/WtProgressBar.spec.js +17 -0
  171. package/src/components/molecules/wt-progress-bar/wt-progress-bar.vue +80 -0
  172. package/src/components/molecules/wt-radio/__tests__/WtRadio.spec.js +42 -0
  173. package/src/components/molecules/wt-radio/wt-radio.vue +168 -0
  174. package/src/components/molecules/wt-search-bar/__tests__/WtSearchBar.spec.js +36 -0
  175. package/src/components/molecules/wt-search-bar/wt-search-bar.vue +205 -0
  176. package/src/components/molecules/wt-select/__tests__/WtSelect.spec.js +53 -0
  177. package/src/components/molecules/wt-select/wt-select.vue +553 -0
  178. package/src/components/molecules/wt-slider/__tests__/WtSlider.spec.js +9 -0
  179. package/src/components/molecules/wt-slider/wt-slider.vue +175 -0
  180. package/src/components/molecules/wt-switcher/__tests__/WtSwitcher.spec.js +31 -0
  181. package/src/components/molecules/wt-switcher/wt-switcher.vue +177 -0
  182. package/src/components/molecules/wt-tabs/__tests__/WtTabs.spec.js +36 -0
  183. package/src/components/molecules/wt-tabs/wt-tabs.vue +127 -0
  184. package/src/components/molecules/wt-tags-input/__tests__/WtTagsInput.spec.js +45 -0
  185. package/src/components/molecules/wt-tags-input/wt-tags-input.vue +295 -0
  186. package/src/components/molecules/wt-textarea/__tests__/WtTextarea.spec.js +46 -0
  187. package/src/components/molecules/wt-textarea/wt-textarea.vue +185 -0
  188. package/src/components/molecules/wt-time-input/__tests__/WtTimeInput.spec.js +25 -0
  189. package/src/components/molecules/wt-time-input/wt-time-input.vue +192 -0
  190. package/src/components/molecules/wt-timepicker/__tests__/WtTimepicker.spec.js +60 -0
  191. package/src/components/molecules/wt-timepicker/wt-timepicker.vue +176 -0
  192. package/src/components/organisms/wt-app-header/__tests__/WtAppHeader.spec.js +19 -0
  193. package/src/components/organisms/wt-app-header/__tests__/WtAppNavigator.spec.js +23 -0
  194. package/src/components/organisms/wt-app-header/__tests__/WtHeaderActions.spec.js +21 -0
  195. package/src/components/organisms/wt-app-header/wt-app-header.vue +23 -0
  196. package/src/components/organisms/wt-app-header/wt-app-navigator.vue +245 -0
  197. package/src/components/organisms/wt-app-header/wt-header-actions.vue +177 -0
  198. package/src/components/organisms/wt-error-page/__tests__/wt-error-page.spec.js +17 -0
  199. package/src/components/organisms/wt-error-page/wt-error-page.vue +104 -0
  200. package/src/components/organisms/wt-filters-panel-wrapper/__tests__/wt-filters-panel-wrapper.spec.js +24 -0
  201. package/src/components/organisms/wt-filters-panel-wrapper/wt-filters-panel-wrapper.vue +146 -0
  202. package/src/components/organisms/wt-headline/__tests__/WtHeadline.spec.js +47 -0
  203. package/src/components/organisms/wt-headline/wt-headline.vue +46 -0
  204. package/src/components/organisms/wt-navigation-bar/__tests__/WtNavigationBar.spec.js +64 -0
  205. package/src/components/organisms/wt-navigation-bar/wt-navigation-bar.vue +249 -0
  206. package/src/components/organisms/wt-notifications-bar/__tests__/WtNotificationsBar.spec.js +50 -0
  207. package/src/components/organisms/wt-notifications-bar/wt-notifications-bar.vue +71 -0
  208. package/src/components/organisms/wt-page-wrapper/__tests__/WtPageWrapper.spec.js +33 -0
  209. package/src/components/organisms/wt-page-wrapper/wt-page-wrapper.vue +60 -0
  210. package/src/components/organisms/wt-pagination/__tests__/WtPagination.spec.js +38 -0
  211. package/src/components/organisms/wt-pagination/wt-pagination.vue +134 -0
  212. package/src/components/organisms/wt-player/__tests__/WtPlayer.spec.js +9 -0
  213. package/src/components/organisms/wt-player/wt-player.vue +139 -0
  214. package/src/components/organisms/wt-status-select/__tests__/WtStatusSelect.spec.js +25 -0
  215. package/src/components/organisms/wt-status-select/_internals/StatusOptions.lookup.js +24 -0
  216. package/src/components/organisms/wt-status-select/wt-status-select.vue +110 -0
  217. package/src/components/organisms/wt-table/__tests__/WtTable.spec.js +133 -0
  218. package/src/components/organisms/wt-table/__tests__/WtTableDeleteAction.spec.js +9 -0
  219. package/src/components/organisms/wt-table/__tests__/WtTableEditAction.spec.js +9 -0
  220. package/src/components/organisms/wt-table/_internals/getSortOrder.js +12 -0
  221. package/src/components/organisms/wt-table/table-cells/wt-table-delete-action.vue +18 -0
  222. package/src/components/organisms/wt-table/table-cells/wt-table-edit-action.vue +19 -0
  223. package/src/components/organisms/wt-table/wt-table.vue +241 -0
  224. package/src/components/organisms/wt-table-actions/__tests__/WtTableActions.spec.js +9 -0
  225. package/src/components/organisms/wt-table-actions/wt-table-actions.vue +90 -0
  226. package/src/components/organisms/wt-table-column-select/__tests__/WtTableColumnSelect.spec.js +31 -0
  227. package/src/components/organisms/wt-table-column-select/wt-table-column-select.vue +116 -0
  228. package/src/components/transitions/__tests__/ExpandTransition.spec.js +9 -0
  229. package/src/components/transitions/expand-transition.vue +70 -0
  230. package/src/css/colors/_colors.scss +151 -67
  231. package/src/css/components/_components.scss +41 -25
  232. package/src/css/components/atoms/wt-badge/_variables.scss +6 -5
  233. package/src/css/components/atoms/wt-badge/wt-badge.scss +40 -8
  234. package/src/css/components/atoms/wt-button/_variables.scss +45 -46
  235. package/src/css/components/atoms/wt-context-menu/_variables.scss +10 -0
  236. package/src/css/components/atoms/wt-divider/_variables.scss +4 -4
  237. package/src/css/components/atoms/wt-icon/_variables.scss +7 -28
  238. package/src/css/components/atoms/wt-indicator/_variables.scss +18 -0
  239. package/src/css/components/atoms/wt-input-info/_variables.scss +6 -5
  240. package/src/css/components/atoms/wt-label/_variables.scss +4 -4
  241. package/src/css/components/atoms/wt-loader/_variables.scss +7 -7
  242. package/src/css/components/atoms/wt-rounded-action/_variables.scss +30 -0
  243. package/src/css/components/atoms/wt-tooltip/_variables.scss +9 -9
  244. package/src/css/components/molecules/wt-button-select/_variables.scss +21 -0
  245. package/src/css/components/molecules/wt-checkbox/_variables.scss +3 -3
  246. package/src/css/components/molecules/wt-datepicker/_variables.scss +20 -20
  247. package/src/css/components/molecules/wt-datepicker/datepicker-calendar.scss +101 -100
  248. package/src/css/components/molecules/wt-datetimepicker/_variables.scss +11 -11
  249. package/src/css/components/molecules/wt-icon-btn/_variables.scss +2 -2
  250. package/src/css/components/molecules/wt-input/_variables.scss +7 -5
  251. package/src/css/components/molecules/wt-notification/_variables.scss +9 -9
  252. package/src/css/components/molecules/wt-popup/_variables.scss +11 -10
  253. package/src/css/components/molecules/wt-progress-bar/_variables.scss +11 -0
  254. package/src/css/components/molecules/wt-radio/_variables.scss +6 -6
  255. package/src/css/components/molecules/wt-search-bar/_variables.scss +3 -3
  256. package/src/css/components/molecules/wt-select/_variables.scss +25 -23
  257. package/src/css/components/molecules/wt-slider/_variables.scss +15 -0
  258. package/src/css/components/molecules/wt-switcher/_variables.scss +17 -14
  259. package/src/css/components/molecules/wt-tabs/_variables.scss +13 -13
  260. package/src/css/components/molecules/wt-tags-input/_variables.scss +25 -0
  261. package/src/css/components/molecules/wt-textarea/_variables.scss +4 -4
  262. package/src/css/components/molecules/wt-timepicker/_variables.scss +4 -3
  263. package/src/css/components/organisms/wt-app-header/_variables.scss +20 -0
  264. package/src/css/components/organisms/wt-headline/_variables.scss +7 -0
  265. package/src/css/components/organisms/wt-navigation-bar/_variables.scss +14 -0
  266. package/src/css/components/organisms/wt-notifications-bar/_variables.scss +7 -0
  267. package/src/css/components/organisms/wt-page-wrapper/_variables.scss +5 -0
  268. package/src/css/components/organisms/wt-pagination/_variables.scss +6 -6
  269. package/src/css/components/organisms/wt-player/_variables.scss +8 -0
  270. package/src/css/components/organisms/wt-status-select/_variables.scss +6 -0
  271. package/src/css/components/organisms/wt-table/_variables.scss +16 -0
  272. package/src/css/components/organisms/wt-table-actions/_variables.scss +4 -0
  273. package/src/css/display-helpers/_display-helpers.scss +21 -0
  274. package/src/css/fonts/_fonts.scss +9 -0
  275. package/src/css/main.scss +67 -65
  276. package/src/css/shadows/_shadows.scss +7 -0
  277. package/src/css/sizes/_sizes.scss +2 -0
  278. package/src/css/sizes/_spacing.scss +33 -0
  279. package/src/css/sizes/_viewport-breakpoints.scss +20 -0
  280. package/src/css/styleguide/{styleguide.scss → _styleguide.scss} +4 -3
  281. package/src/css/styleguide/scroll.scss +43 -40
  282. package/src/css/transitions/_transitions.scss +1 -0
  283. package/src/css/transitions/fade/_fade.scss +8 -0
  284. package/src/css/typography/_typography.scss +72 -72
  285. package/src/enums/AgentStatus/AgentStatus.enum.js +6 -0
  286. package/src/enums/WebitelApplications/AdminSections.enum.js +41 -0
  287. package/src/enums/WebitelApplications/SupervisorSections.enum.js +7 -0
  288. package/src/enums/WebitelApplications/WebitelApplications.enum.js +10 -0
  289. package/src/locale/en/en.js +192 -0
  290. package/src/locale/i18n.js +2 -0
  291. package/src/locale/ru/ru.js +192 -2
  292. package/src/locale/ua/ua.js +217 -0
  293. package/src/mixins/dataFilterMixins/__tests__/apiFilterMixin.spec.js +57 -0
  294. package/src/mixins/dataFilterMixins/__tests__/enumFilterMixin.spec.js +66 -0
  295. package/src/mixins/dataFilterMixins/__tests__/paginationFilterMixin.spec.js +93 -0
  296. package/src/mixins/dataFilterMixins/__tests__/sortFilterMixin.spec.js +60 -0
  297. package/src/mixins/dataFilterMixins/__tests__/urlControllerMixin.spec.js +48 -0
  298. package/src/mixins/dataFilterMixins/_urlControllerMixin/_urlControllerMixin.js +37 -0
  299. package/src/mixins/dataFilterMixins/apiFilterMixin.js +23 -0
  300. package/src/mixins/dataFilterMixins/baseFilterMixin/baseFilterMixin.js +29 -0
  301. package/src/mixins/dataFilterMixins/enumFilterMixin.js +30 -0
  302. package/src/mixins/dataFilterMixins/paginationFilterMixin.js +79 -0
  303. package/src/mixins/dataFilterMixins/sortFilterMixin.js +75 -0
  304. package/src/mixins/validationMixin/__tests__/validationMixin.spec.js +47 -0
  305. package/src/mixins/validationMixin/validationMixin.js +41 -0
  306. package/src/modules/CSVExport/CSVExport.js +88 -0
  307. package/src/modules/CSVExport/__tests__/CSVExport.spec.js +63 -0
  308. package/src/modules/CSVExport/mixins/exportCSVMixin.js +46 -0
  309. package/src/modules/FilesExport/FilesExport.js +110 -0
  310. package/src/modules/FilesExport/__tests__/FilesExport.spec.js +66 -0
  311. package/src/modules/FilesExport/mixins/exportFilesMixin.js +46 -0
  312. package/src/modules/FilesExport/scripts/generateMediaURL.js +7 -0
  313. package/src/modules/QueryFilters/api/__tests__/defaults.spec.js +18 -0
  314. package/src/modules/QueryFilters/api/defaults.js +16 -0
  315. package/src/modules/QueryFilters/classes/ApiFilterSchema.js +32 -0
  316. package/src/modules/QueryFilters/classes/BaseFilterSchema.js +6 -0
  317. package/src/modules/QueryFilters/classes/EnumFilterSchema.js +23 -0
  318. package/src/modules/QueryFilters/classes/__tests__/ApiFilterSchema.spec.js +25 -0
  319. package/src/modules/QueryFilters/components/__tests__/abstract-api-filter.spec.js +54 -0
  320. package/src/modules/QueryFilters/components/__tests__/abstract-enum-filter.spec.js +40 -0
  321. package/src/modules/QueryFilters/components/__tests__/filter-search.spec.js +49 -0
  322. package/src/modules/QueryFilters/components/abstract-api-filter.vue +42 -0
  323. package/src/modules/QueryFilters/components/abstract-enum-filter.vue +32 -0
  324. package/src/modules/QueryFilters/components/filter-search.vue +33 -0
  325. package/src/modules/QueryFilters/mixins/__tests__/apiFilterMixin.spec.js +48 -0
  326. package/src/modules/QueryFilters/mixins/__tests__/enumFilterMixin.spec.js +70 -0
  327. package/src/modules/QueryFilters/mixins/__tests__/paginationFilterMixin.spec.js +86 -0
  328. package/src/modules/QueryFilters/mixins/__tests__/sortFilterMixin.spec.js +58 -0
  329. package/src/modules/QueryFilters/mixins/__tests__/urlControllerMixin.spec.js +48 -0
  330. package/src/modules/QueryFilters/mixins/_urlControllerMixin/_urlControllerMixin.js +39 -0
  331. package/src/modules/QueryFilters/mixins/apiFilterMixin.js +36 -0
  332. package/src/modules/QueryFilters/mixins/baseFilterMixin/baseFilterMixin.js +34 -0
  333. package/src/modules/QueryFilters/mixins/enumFilterMixin.js +46 -0
  334. package/src/modules/QueryFilters/mixins/paginationFilterMixin.js +76 -0
  335. package/src/modules/QueryFilters/mixins/sortFilterMixin.js +56 -0
  336. package/src/modules/QueryFilters/store/QueryFiltersStoreModule.js +50 -0
  337. package/src/modules/QueryFilters/store/__tests__/QueryFiltersStoreModule.spec.js +83 -0
  338. package/src/modules/QueryFilters/store/queryFilters.js +6 -0
  339. package/src/modules/Userinfo/api/BaseAPIService.js +7 -0
  340. package/src/modules/Userinfo/api/auth.js +29 -0
  341. package/src/modules/Userinfo/api/userinfo.js +32 -0
  342. package/src/modules/Userinfo/classes/ApplicationsAccess.js +170 -0
  343. package/src/modules/Userinfo/components/__tests__/auth.spec.js +57 -0
  344. package/src/modules/Userinfo/components/the-auth.vue +75 -0
  345. package/src/modules/Userinfo/store/UserinfoStoreModule.js +112 -0
  346. package/src/scripts/__tests__/caseConverters.spec.js +72 -0
  347. package/src/scripts/__tests__/convertDuration.spec.js +21 -0
  348. package/src/scripts/__tests__/debounce.spec.js +15 -0
  349. package/src/scripts/__tests__/editProxy.spec.js +9 -0
  350. package/src/scripts/__tests__/isEmpty.spec.js +16 -0
  351. package/src/scripts/__tests__/prettifyFileSize.spec.js +18 -0
  352. package/src/scripts/__tests__/prettifyTime.spec.js +18 -0
  353. package/src/scripts/__tests__/preventHiddenPageCallsDecorator.spec.js +16 -0
  354. package/src/scripts/__tests__/sortQueryAdapters.spec.js +12 -0
  355. package/src/scripts/caseConverters.js +77 -0
  356. package/src/scripts/convertDuration.js +15 -0
  357. package/src/scripts/editProxy.js +9 -0
  358. package/src/scripts/eventBus.js +4 -0
  359. package/src/scripts/isEmpty.js +9 -0
  360. package/src/scripts/prettifyFileSize.js +11 -0
  361. package/src/scripts/prettifyTime.js +9 -0
  362. package/src/scripts/preventHiddenPageCallsDecorator.js +6 -0
  363. package/src/scripts/sortQueryAdapters.js +21 -0
  364. package/src/store/BaseStoreModules/BaseStoreModule.js +49 -0
  365. package/src/store/BaseStoreModules/__tests__/BaseStoreModule.spec.js +104 -0
  366. package/src/store/helpers/__tests__/getNamespacedState.spec.js +11 -0
  367. package/src/store/helpers/getNamespacedState.js +5 -0
  368. package/dist/img/arrow-down--active--md.7b60f2fb6090366652124f77c543a516.svg +0 -3
  369. package/dist/img/arrow-down--disabled--md.f58424cd673258365e78863edd1e92cc.svg +0 -3
  370. package/dist/img/arrow-down--md.1843b60e1c244e066a650e8d19ea83c9.svg +0 -3
  371. package/dist/img/calendar--active--md.7fd3d949ec7234a4940ea452d95b4165.svg +0 -6
  372. package/dist/img/calendar--disabled--md.8e7a1e18f93ae8af270060400e6f881c.svg +0 -3
  373. package/dist/img/calendar--md.9c265581c3a405ff0f0e46e8092f36b8.svg +0 -6
  374. package/src/css/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
  375. package/src/css/fonts/Montserrat/Montserrat-SemiBold.ttf +0 -0
  376. package/src/css/fonts.scss +0 -9
@@ -0,0 +1,88 @@
1
+ import { saveAs } from 'file-saver';
2
+ import stringify from 'csv-stringify/lib/sync';
3
+ import { objSnakeToCamel } from '../../scripts/caseConverters';
4
+
5
+ const cast = {
6
+ object: (separator) => {
7
+ const cast = (object) => {
8
+ if (Array.isArray(object)) {
9
+ return object.map((item) => cast(item))
10
+ .join(separator);
11
+ }
12
+ return object.name || JSON.stringify(object);
13
+ };
14
+ return cast;
15
+ },
16
+ };
17
+
18
+ export default class CSVExport {
19
+ filename = 'export';
20
+
21
+ fetchMethod = null;
22
+
23
+ downloadProgress = { count: 0 };
24
+
25
+ constructor(fetchMethod, { filename }) {
26
+ if (!fetchMethod) throw new Error('fetch method should be specified!');
27
+ this.fetchMethod = fetchMethod;
28
+ this.filename = filename;
29
+ }
30
+
31
+ static _getStringifyOptions() {
32
+ const defaultOptions = {
33
+ header: true,
34
+ delimiter: ',',
35
+ };
36
+ const localStorageOptions = JSON.parse(localStorage.getItem('csv-export-options')) || {};
37
+ return {
38
+ ...defaultOptions,
39
+ ...localStorageOptions,
40
+ cast: {
41
+ object: cast.object(localStorageOptions.valueDelimiter || ' | '),
42
+ },
43
+ };
44
+ }
45
+
46
+ resetProgress() {
47
+ this.downloadProgress = { count: 0 };
48
+ this.zippingProgress = { percent: 0 };
49
+ }
50
+
51
+ save(csv) {
52
+ saveAs(csv, `${this.filename}.csv`);
53
+ }
54
+
55
+ async stringify(params = {}) {
56
+ let csv = 'data:text/csv;charset=utf-8,';
57
+ let isNext = false;
58
+ let columns = params?.fields ? objSnakeToCamel(params?.fields) : [];
59
+ let page = 1;
60
+
61
+ do {
62
+ // eslint-disable-next-line no-await-in-loop
63
+ const { items, next } = await this.fetchMethod({
64
+ ...params,
65
+ page,
66
+ });
67
+ if (!columns.length && items.length) columns = Object.keys(items[0]);
68
+
69
+ const options = {
70
+ ...CSVExport._getStringifyOptions(),
71
+ columns,
72
+ };
73
+
74
+ csv += stringify(items, options);
75
+ this.downloadProgress.count += items.length;
76
+
77
+ isNext = next;
78
+ page += 1;
79
+ } while (isNext);
80
+ return csv;
81
+ }
82
+
83
+ async export(params) {
84
+ const csv = await this.stringify(params);
85
+ this.save(csv);
86
+ this.resetProgress();
87
+ }
88
+ }
@@ -0,0 +1,63 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import * as fileSaver from 'file-saver';
3
+ import stringify from 'csv-stringify/lib/sync';
4
+ import CSVExportMixin from '../mixins/exportCSVMixin';
5
+ import '../../../../tests/mocks/localStorageMock';
6
+
7
+ jest.mock('csv-stringify/lib/sync');
8
+ jest.mock('file-saver');
9
+ const dataList = [
10
+ { _isSelected: true, id: 1 },
11
+ { _isSelected: true, id: 2 },
12
+ { _isSelected: true, id: 3 },
13
+ ];
14
+
15
+ describe('CSV Export', () => {
16
+ let wrapper;
17
+ const Component = {
18
+ render() {
19
+ },
20
+ mixins: [CSVExportMixin],
21
+ created() {
22
+ this.initCSVExport(() => ({ items: dataList }), { filename: 'jest' });
23
+ },
24
+ data: () => ({ dataList }),
25
+ };
26
+
27
+ it('goes through all important steps to generate and save csv', async () => {
28
+ wrapper = shallowMount(Component);
29
+ await wrapper.vm.exportCSV();
30
+ expect(stringify).toHaveBeenCalled();
31
+ expect(fileSaver.saveAs).toHaveBeenCalled();
32
+ });
33
+
34
+ it('mixin correctly computes empty export progress from class data', () => {
35
+ wrapper = shallowMount(Component);
36
+ expect(wrapper.vm.CSVDownloadProgress).toBe(0);
37
+ });
38
+
39
+ it('computes selected ids and isAnySelected', async () => {
40
+ wrapper = shallowMount(Component);
41
+ const selectedIds = [1, 2, 3];
42
+ expect(wrapper.vm.selectedIds).toEqual(selectedIds);
43
+ expect(wrapper.vm.isAnySelected).toBe(true);
44
+ });
45
+
46
+ it('correctly generates csv headers from passed fields', async () => {
47
+ wrapper = shallowMount(Component);
48
+ const params = { fields: ['id', 'col1', 'columnTwo'] };
49
+ await wrapper.vm.exportCSV(params);
50
+ expect(stringify.mock.calls.pop()[1].columns).toEqual(params.fields); // last mock call, 2nd param, columns obj param
51
+ });
52
+
53
+ it('config csv export from localStorage', async () => {
54
+ wrapper = shallowMount(Component);
55
+ const csvExportOptions = {
56
+ header: false,
57
+ delimiter: ';',
58
+ };
59
+ localStorage.setItem('csv-export-options', JSON.stringify(csvExportOptions));
60
+ await wrapper.vm.exportCSV();
61
+ expect(stringify.mock.calls.pop()[1]).toMatchObject(csvExportOptions);
62
+ });
63
+ });
@@ -0,0 +1,46 @@
1
+ import CSVExport from '../CSVExport';
2
+
3
+ export default {
4
+ data: () => ({
5
+ CSVExport: null,
6
+ }),
7
+
8
+ computed: {
9
+ isCSVLoading() {
10
+ return !!this.CSVDownloadProgress;
11
+ },
12
+
13
+ CSVDownloadProgress() {
14
+ return this.CSVExport ? this.CSVExport.downloadProgress.count : 0;
15
+ },
16
+ selectedIds() {
17
+ return this.dataList
18
+ .filter((item) => item._isSelected)
19
+ .map((item) => item.id);
20
+ },
21
+ isAnySelected() {
22
+ return !!this.selectedIds.length;
23
+ },
24
+ },
25
+
26
+ methods: {
27
+ initCSVExport(fetchMethod, options) {
28
+ this.CSVExport = new CSVExport(fetchMethod, options);
29
+ },
30
+
31
+ async exportCSV(exportParams) {
32
+ const routeQuery = this.$route?.query;
33
+ const params = {
34
+ ...exportParams || routeQuery,
35
+ size: 5000,
36
+ };
37
+ if (this.isAnySelected) params.ids = this.selectedIds;
38
+
39
+ try {
40
+ await this.CSVExport.export(params);
41
+ } catch (err) {
42
+ throw err;
43
+ };
44
+ },
45
+ },
46
+ };
@@ -0,0 +1,110 @@
1
+ import jszipUtils from 'jszip-utils';
2
+ import { saveAs } from 'file-saver';
3
+ import JSZip from 'jszip';
4
+ import generateMediaURL from './scripts/generateMediaURL';
5
+
6
+ /* eslint-disable no-await-in-loop, no-restricted-syntax */
7
+ export default class FilesExport {
8
+ filename = 'files';
9
+
10
+ fetchMethod = null;
11
+
12
+ isLoading = false;
13
+
14
+ downloadProgress = { count: 0 };
15
+
16
+ zippingProgress = { percent: 0 };
17
+
18
+ filesURL = generateMediaURL;
19
+
20
+ constructor({ fetchMethod, filename, filesURL }) {
21
+ if (fetchMethod) this.fetchMethod = fetchMethod;
22
+ if (filename) this.filename = filename;
23
+ if (filesURL) this.filesURL = filesURL;
24
+ }
25
+
26
+ _fetchFileBinary(fileId) {
27
+ const url = this.filesURL(fileId);
28
+ return new Promise((resolve, reject) => (
29
+ jszipUtils.getBinaryContent(url, (err, data) => {
30
+ if (err) {
31
+ reject(err);
32
+ } else {
33
+ resolve(data);
34
+ }
35
+ })));
36
+ }
37
+
38
+ resetProgress() {
39
+ this.downloadProgress = { count: 0 };
40
+ this.zippingProgress = { percent: 0 };
41
+ }
42
+
43
+ async _addFilesToZip(items, zip) {
44
+ for (const item of items) {
45
+ if (item.files) {
46
+ await this._addFilesToZip(item.files, zip);
47
+ } else {
48
+ const binary = await this._fetchFileBinary(item.id);
49
+ const ext = item.mimeType.split('/').pop();
50
+ zip.file(`${item.name}.${ext}`, binary);
51
+ this.downloadProgress.count += 1;
52
+ }
53
+ }
54
+ }
55
+
56
+ async _generateZip(zip) {
57
+ try {
58
+ return await zip.generateAsync({ type: 'blob' }, (progress) => {
59
+ this.zippingProgress = progress;
60
+ });
61
+ } catch (err) {
62
+ throw new Error('Failed to generate zip file');
63
+ }
64
+ }
65
+
66
+ async _saveZip(file) {
67
+ try {
68
+ saveAs(file, `${this.filename}.zip`);
69
+ } catch (err) {
70
+ throw new Error('Failed to save a file');
71
+ }
72
+ }
73
+
74
+ async _fetchAndZip(zip, requestParams) {
75
+ const params = {
76
+ from: 0,
77
+ size: 5000,
78
+ fields: ['files'],
79
+ ...requestParams,
80
+ };
81
+
82
+ let page = 1;
83
+ let isNext = false;
84
+ do {
85
+ const { items, next } = await this.fetchMethod({ ...params, page });
86
+ await this._addFilesToZip(items, zip);
87
+
88
+ isNext = next;
89
+ page += 1;
90
+ } while (isNext);
91
+ }
92
+
93
+ async exportFiles(files, { reqParams }) {
94
+ try {
95
+ this.isLoading = true;
96
+ const zip = new JSZip();
97
+ if (files && files.length) await this._addFilesToZip(files, zip);
98
+ else {
99
+ await this._fetchAndZip(zip, reqParams);
100
+ }
101
+ const file = await this._generateZip(zip);
102
+ await this._saveZip(file);
103
+ this.resetProgress();
104
+ } catch (err) {
105
+ throw err;
106
+ } finally {
107
+ this.isLoading = false;
108
+ }
109
+ }
110
+ }
@@ -0,0 +1,66 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import * as fileSaver from 'file-saver';
3
+ import jszip from 'jszip';
4
+ import jszipUtils from 'jszip-utils';
5
+ import FilesExportMixin from '../mixins/exportFilesMixin';
6
+ import '../../../../tests/mocks/localStorageMock';
7
+
8
+ jest.mock('jszip');
9
+ jest.mock('jszip-utils');
10
+ jest.mock('file-saver');
11
+ const dataList = [
12
+ { files: [{ name: 'jest', id: '1', mimeType: 'mime/type' }] },
13
+ ];
14
+ const selectedDataList = [
15
+ { _isSelected: true, files: [{ name: 'jest1', id: '1', mimeType: 'mime/type' }] },
16
+ { _isSelected: true, files: [{ name: 'jest2', id: '2', mimeType: 'mime/type' }] },
17
+ ];
18
+
19
+ describe('File Export', () => {
20
+ jszipUtils.getBinaryContent.mockImplementation((url, callback) => callback(null, {}));
21
+ let wrapper;
22
+ const Component = {
23
+ render() {
24
+ },
25
+ mixins: [FilesExportMixin],
26
+ created() {
27
+ this.initFilesExport({ fetchMethod: () => ({ items: dataList }), filename: 'jest' });
28
+ },
29
+ data: () => ({ dataList }),
30
+ };
31
+
32
+ it('goes through all important steps to save file', async () => {
33
+ wrapper = shallowMount(Component);
34
+ await wrapper.vm.exportFiles();
35
+ expect(jszip).toHaveBeenCalled();
36
+ expect(jszipUtils.getBinaryContent).toHaveBeenCalled();
37
+ expect(fileSaver.saveAs).toHaveBeenCalled();
38
+ });
39
+
40
+ it('mixin correctly computes empty export progress from class data', () => {
41
+ wrapper = shallowMount(Component);
42
+ expect(wrapper.vm.filesDownloadProgress).toBe(0);
43
+ expect(wrapper.vm.filesZippingProgress).toBe(0);
44
+ });
45
+
46
+ it('mixin correctly computes selectedFiles()', () => {
47
+ wrapper = shallowMount(Component, {
48
+ computed: { selectedItems() { return selectedDataList; } },
49
+ });
50
+ expect(wrapper.vm.getSelectedFiles())
51
+ .toEqual([...selectedDataList[0].files, ...selectedDataList[1].files]);
52
+ });
53
+
54
+ it('mixin catches export error and resets isFilesLoading on export error', async () => {
55
+ wrapper = shallowMount(Component);
56
+ wrapper.vm.FilesExport = null; // like FilesExport wasn't initialized
57
+ // wrapper.vm.FilesExport.exportFiles = function () { throw new Error(); };
58
+ // await expect(async () => Promise.reject(await wrapper.vm.exportFiles())).rejects.toThrowError();
59
+ try {
60
+ await wrapper.vm.exportFiles();
61
+ } catch (err) {
62
+ expect(err).toBeTruthy();
63
+ expect(wrapper.vm.isFilesLoading).toBeFalsy();
64
+ }
65
+ });
66
+ });
@@ -0,0 +1,46 @@
1
+ import FilesExport from '../FilesExport';
2
+
3
+ export default {
4
+ data: () => ({
5
+ FilesExport: null,
6
+ }),
7
+
8
+ computed: {
9
+ isFilesLoading() {
10
+ return this.FilesExport?.isLoading;
11
+ },
12
+
13
+ filesDownloadProgress() {
14
+ return this.FilesExport ? this.FilesExport.downloadProgress.count : 0;
15
+ },
16
+
17
+ filesZippingProgress() {
18
+ return this.FilesExport ? Math.floor(this.FilesExport.zippingProgress.percent) : 0;
19
+ },
20
+ },
21
+
22
+ methods: {
23
+ initFilesExport(options) {
24
+ this.FilesExport = new FilesExport(options);
25
+ },
26
+
27
+ getSelectedFiles() {
28
+ let files = null;
29
+ if (this.selectedItems?.length) {
30
+ files = this.selectedItems.reduce((filesAccumulator, next) => (
31
+ next.files ? [...filesAccumulator, ...next.files] : filesAccumulator), []);
32
+ }
33
+ return files;
34
+ },
35
+
36
+ async exportFiles(files, reqParams = {}) {
37
+ if (!this.FilesExport) throw new Error('FilesExport is not initialized');
38
+ const exportFiles = files || this.getSelectedFiles();
39
+ try {
40
+ await this.FilesExport.exportFiles(exportFiles, { reqParams });
41
+ } catch (err) {
42
+ throw err;
43
+ }
44
+ },
45
+ },
46
+ };
@@ -0,0 +1,7 @@
1
+ const generateMediaURL = (id) => {
2
+ const token = localStorage.getItem('access-token');
3
+ const BASE_URL = process.env.VUE_APP_API_URL;
4
+ return `${BASE_URL}/storage/recordings/${id}/stream?access_token=${token}`;
5
+ };
6
+
7
+ export default generateMediaURL;
@@ -0,0 +1,18 @@
1
+ import { listResponseHandler } from '../defaults';
2
+
3
+ describe('filter api Defaults', () => {
4
+ it('listResponseHandler returns only lookups from response', () => {
5
+ const response = {
6
+ items: [
7
+ { name: 'jest1', id: 1, myField: '1' },
8
+ { name: 'jest2', id: 2, obj: [] },
9
+ ],
10
+ next: true,
11
+ };
12
+ const expectedResult = [
13
+ { name: 'jest1', id: 1 },
14
+ { name: 'jest2', id: 2 },
15
+ ];
16
+ expect(listResponseHandler(response)).toEqual(expectedResult);
17
+ });
18
+ });
@@ -0,0 +1,16 @@
1
+ const PAGE = 1;
2
+ const SIZE = 20;
3
+ const FIELDS = ['id', 'name'];
4
+
5
+ export const defaultParams = {
6
+ page: PAGE,
7
+ size: SIZE,
8
+ fields: FIELDS,
9
+ };
10
+
11
+ export const listResponseHandler = (response) => (
12
+ response.items.map((item) => ({
13
+ name: item.name,
14
+ id: item.id,
15
+ }))
16
+ );
@@ -0,0 +1,32 @@
1
+ import BaseFilterSchema from './BaseFilterSchema';
2
+
3
+ export default class ApiFilterSchema extends BaseFilterSchema {
4
+ constructor(params = {}) {
5
+ const {
6
+ value = [],
7
+ defaultValue = [],
8
+ } = params;
9
+ super({ value, defaultValue });
10
+ const {
11
+ locale = { label: 'filter' },
12
+ storedProp = 'id',
13
+ multiple = true,
14
+ closeOnSelect = false,
15
+ API,
16
+ } = params;
17
+ this.locale = locale;
18
+ this.storedProp = storedProp;
19
+ this.multiple = multiple;
20
+ this.closeOnSelect = closeOnSelect;
21
+ this.API = API;
22
+ }
23
+
24
+ search(params) {
25
+ return this.API(params);
26
+ }
27
+
28
+ fetchSelected(idsList) {
29
+ const params = { size: idsList.length, ids: idsList };
30
+ return this.API(params);
31
+ }
32
+ }
@@ -0,0 +1,6 @@
1
+ export default class BaseFilterSchema {
2
+ constructor({ value = '', defaultValue = '' } = {}) {
3
+ this.value = value;
4
+ this.defaultValue = defaultValue;
5
+ }
6
+ }
@@ -0,0 +1,23 @@
1
+ import BaseFilterSchema from './BaseFilterSchema';
2
+
3
+ export default class EnumFilterSchema extends BaseFilterSchema {
4
+ constructor(params = {}) {
5
+ const {
6
+ value = [],
7
+ defaultValue = [],
8
+ } = params;
9
+ super({ value, defaultValue });
10
+ const {
11
+ locale = { label: 'filter' },
12
+ storedProp = 'value',
13
+ multiple = true,
14
+ closeOnSelect = false,
15
+ options = [],
16
+ } = params;
17
+ this.locale = locale;
18
+ this.storedProp = storedProp;
19
+ this.multiple = multiple;
20
+ this.closeOnSelect = closeOnSelect;
21
+ this.options = options;
22
+ }
23
+ }
@@ -0,0 +1,25 @@
1
+ import ApiFilterSchema from '../ApiFilterSchema';
2
+
3
+ describe('Api Filter Schema', () => {
4
+ const APIMock = jest.fn();
5
+ beforeEach(() => {
6
+ APIMock.mockClear();
7
+ });
8
+ it('creates default class without passed params', () => {
9
+ const filter = new ApiFilterSchema();
10
+ expect(filter).toBeTruthy();
11
+ });
12
+ it('calls API getList() method at search()', () => {
13
+ const params = { page: 1 };
14
+ const filter = new ApiFilterSchema({ API: APIMock });
15
+ filter.search(params);
16
+ expect(APIMock).toHaveBeenCalledWith(params);
17
+ });
18
+ it('calls API getList() method at fetchSelected()', () => {
19
+ const idsList = [1];
20
+ const expectedParams = { size: 1, ids: [1] };
21
+ const filter = new ApiFilterSchema({ API: APIMock });
22
+ filter.fetchSelected(idsList);
23
+ expect(APIMock).toHaveBeenCalledWith(expectedParams);
24
+ });
25
+ });
@@ -0,0 +1,54 @@
1
+ import { shallowMount, createLocalVue } from '@vue/test-utils';
2
+ import Vuex from 'vuex';
3
+ import VueRouter from 'vue-router';
4
+ import AbstractApiFilter from '../abstract-api-filter.vue';
5
+ import ApiFilterSchema from '../../classes/ApiFilterSchema';
6
+
7
+ const localVue = createLocalVue();
8
+ localVue.use(Vuex);
9
+ localVue.use(VueRouter);
10
+ const router = new VueRouter();
11
+
12
+ describe('Abstract Api Filter', () => {
13
+ const namespace = 'jest';
14
+ const filterQuery = 'jest';
15
+ const filterSchema = new ApiFilterSchema({ locale: {} });
16
+ const searchMock = jest.fn();
17
+ const fetchSelectedMock = jest.fn();
18
+ jest.spyOn(filterSchema, 'search').mockImplementation(searchMock);
19
+ jest.spyOn(filterSchema, 'fetchSelected').mockImplementation(fetchSelectedMock);
20
+ const store = new Vuex.Store({
21
+ modules: {
22
+ [namespace]: {
23
+ namespaced: true,
24
+ state: {
25
+ [filterQuery]: filterSchema,
26
+ },
27
+ },
28
+ },
29
+ });
30
+
31
+ const mountOptions = {
32
+ localVue,
33
+ store,
34
+ router,
35
+ propsData: {
36
+ namespace,
37
+ filterQuery,
38
+ },
39
+ };
40
+ it('renders a component', () => {
41
+ const wrapper = shallowMount(AbstractApiFilter, mountOptions);
42
+ expect(wrapper.exists()).toBe(true);
43
+ });
44
+ it('calls filter schema API search()', () => {
45
+ const wrapper = shallowMount(AbstractApiFilter, mountOptions);
46
+ wrapper.vm.search();
47
+ expect(searchMock).toHaveBeenCalled();
48
+ });
49
+ it(' filter schema API fetchSelected()', () => {
50
+ const wrapper = shallowMount(AbstractApiFilter, mountOptions);
51
+ wrapper.vm.fetchSelected();
52
+ expect(fetchSelectedMock).toHaveBeenCalled();
53
+ });
54
+ });
@@ -0,0 +1,40 @@
1
+ import { shallowMount, createLocalVue } from '@vue/test-utils';
2
+ import Vuex from 'vuex';
3
+ import VueRouter from 'vue-router';
4
+ import AbstractEnumFilter from '../abstract-enum-filter.vue';
5
+ import EnumFilterSchema from '../../classes/EnumFilterSchema';
6
+
7
+ const localVue = createLocalVue();
8
+ localVue.use(Vuex);
9
+ localVue.use(VueRouter);
10
+ const router = new VueRouter();
11
+
12
+ describe('Abstract Enum Filter', () => {
13
+ const namespace = 'jest';
14
+ const filterQuery = 'jest';
15
+ const filterSchema = new EnumFilterSchema({ locale: {} });
16
+ const store = new Vuex.Store({
17
+ modules: {
18
+ [namespace]: {
19
+ namespaced: true,
20
+ state: {
21
+ [filterQuery]: filterSchema,
22
+ },
23
+ },
24
+ },
25
+ });
26
+
27
+ const mountOptions = {
28
+ localVue,
29
+ store,
30
+ router,
31
+ propsData: {
32
+ namespace,
33
+ filterQuery,
34
+ },
35
+ };
36
+ it('renders a component', () => {
37
+ const wrapper = shallowMount(AbstractEnumFilter, mountOptions);
38
+ expect(wrapper.exists()).toBe(true);
39
+ });
40
+ });