@webitel/ui-sdk 24.12.29 → 24.12.34

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 (295) hide show
  1. package/CHANGELOG.md +271 -131
  2. package/README.md +6 -0
  3. package/dist/img/sprite/index.js +8 -2
  4. package/dist/img/sprite/tree-collapse.svg +4 -0
  5. package/dist/img/sprite/tree-cross.svg +5 -0
  6. package/dist/img/sprite/tree-line.svg +10 -0
  7. package/dist/ui-sdk.css +1 -1
  8. package/dist/ui-sdk.js +7736 -7442
  9. package/dist/ui-sdk.umd.cjs +17 -17
  10. package/package.json +13 -6
  11. package/src/api/axios/generateInstance.js +6 -2
  12. package/src/api/clients/agents/agentChats.js +18 -19
  13. package/src/api/clients/agents/agents.js +29 -7
  14. package/src/api/clients/buckets/buckets.js +16 -3
  15. package/src/api/clients/calendars/calendars.js +21 -3
  16. package/src/api/clients/catalog/catalog.js +1 -3
  17. package/src/api/clients/chatGateways/chatGateways.js +41 -12
  18. package/src/api/clients/communications/communications.js +25 -6
  19. package/src/api/clients/configurations/configurations.js +13 -3
  20. package/src/api/clients/flows/flow.js +20 -9
  21. package/src/api/clients/gateways/gateways.js +12 -3
  22. package/src/api/clients/lists/blacklists.js +16 -3
  23. package/src/api/clients/media/media.js +16 -3
  24. package/src/api/clients/queues/queues.js +16 -6
  25. package/src/api/clients/roles/roles.js +3 -1
  26. package/src/api/clients/skills/skills.js +16 -3
  27. package/src/api/clients/teams/teams.js +17 -7
  28. package/src/api/clients/users/__tests__/users.spec.js +3 -1
  29. package/src/api/clients/users/users.js +8 -2
  30. package/src/api/clients//321/201ontacts/contactChatMessagesHistory.js +21 -13
  31. package/src/api/clients//321/201ontacts/contacts.js +38 -15
  32. package/src/api/history/transcript/callTranscript.js +10 -2
  33. package/src/api/interceptors/request/updateToken.interceptor.js +2 -1
  34. package/src/api/transformers/applyTransform.js +5 -1
  35. package/src/api/transformers/camelToSnake/camelToSnake.transformer.js +2 -1
  36. package/src/api/transformers/snakeToCamel/snakeToCamel.transformer.js +2 -1
  37. package/src/assets/icons/sprite/index.js +8 -2
  38. package/src/assets/icons/sprite/tree-collapse.svg +4 -0
  39. package/src/assets/icons/sprite/tree-cross.svg +5 -0
  40. package/src/assets/icons/sprite/tree-line.svg +10 -0
  41. package/src/components/index.js +8 -12
  42. package/src/components/on-demand/wt-navigation-menu/components/_internals/nav-menu-lvl-1.vue +4 -2
  43. package/src/components/on-demand/wt-navigation-menu/components/_internals/nav-menu-lvl-2.vue +3 -4
  44. package/src/components/on-demand/wt-navigation-menu/components/wt-navigation-menu.vue +6 -6
  45. package/src/components/on-demand/wt-route-transition/wt-route-transition.vue +12 -12
  46. package/src/components/on-demand/wt-save-failed-popup/wt-save-failed-popup.vue +1 -3
  47. package/src/components/on-demand/wt-selection-popup/wt-selection-popup.vue +3 -3
  48. package/src/components/on-demand/wt-start-page/components/start-page-card.vue +4 -2
  49. package/src/components/on-demand/wt-start-page/components/start-page-logo.vue +1 -1
  50. package/src/components/on-demand/wt-start-page/components/wt-start-page.vue +2 -3
  51. package/src/components/on-demand/wt-table-transition/wt-table-transition.vue +7 -7
  52. package/src/components/wt-action-bar/wt-action-bar.vue +16 -12
  53. package/src/components/wt-app-header/__tests__/WtHeaderActions.spec.js +3 -1
  54. package/src/components/wt-app-header/_variables.scss +0 -1
  55. package/src/components/wt-app-header/wt-app-header.vue +4 -4
  56. package/src/components/wt-app-header/wt-app-navigator.vue +6 -7
  57. package/src/components/wt-app-header/wt-header-actions.vue +6 -8
  58. package/src/components/wt-avatar/wt-avatar.vue +4 -3
  59. package/src/components/wt-badge/wt-badge.vue +1 -2
  60. package/src/components/wt-button/wt-button.vue +3 -5
  61. package/src/components/wt-button-select/__tests__/WtButtonSelect.spec.js +6 -2
  62. package/src/components/wt-button-select/wt-button-select.vue +3 -4
  63. package/src/components/wt-checkbox/_variables.scss +1 -2
  64. package/src/components/wt-checkbox/wt-checkbox.vue +1 -2
  65. package/src/components/wt-chip/_variables.scss +0 -1
  66. package/src/components/wt-confirm-dialog/wt-confirm-dialog.vue +15 -5
  67. package/src/components/wt-context-menu/_variables.scss +3 -1
  68. package/src/components/wt-context-menu/wt-context-menu.vue +1 -3
  69. package/src/components/wt-copy-action/wt-copy-action.vue +1 -2
  70. package/src/components/wt-datepicker/_variables.scss +17 -5
  71. package/src/components/wt-datepicker/wt-datepicker.vue +2 -7
  72. package/src/components/wt-divider/_variables.scss +0 -1
  73. package/src/components/wt-divider/wt-divider.vue +5 -3
  74. package/src/components/wt-dual-panel/__tests__/WtDualPanel.js +2 -2
  75. package/src/components/wt-dual-panel/wt-dual-panel.vue +6 -5
  76. package/src/components/wt-dummy/_variables.scss +0 -1
  77. package/src/components/wt-dummy/wt-dummy.vue +1 -1
  78. package/src/components/wt-empty/wt-empty.vue +42 -34
  79. package/src/components/wt-error-page/_variables.scss +0 -1
  80. package/src/components/wt-error-page/wt-error-page.vue +2 -4
  81. package/src/components/wt-expansion-panel/_variables.scss +0 -1
  82. package/src/components/wt-expansion-panel/wt-expansion-panel.vue +3 -8
  83. package/src/components/wt-filters-panel-wrapper/__tests__/WtFiltersPanelWrapper.spec.js +12 -4
  84. package/src/components/wt-filters-panel-wrapper/wt-filters-panel-wrapper.vue +8 -7
  85. package/src/components/wt-headline/_variables.scss +0 -1
  86. package/src/components/wt-headline-nav/_variables.scss +0 -1
  87. package/src/components/wt-headline-nav/wt-headline-nav.vue +2 -1
  88. package/src/components/wt-hint/wt-hint.vue +1 -3
  89. package/src/components/wt-icon/_variables.scss +0 -1
  90. package/src/components/wt-icon-action/wt-icon-action.vue +13 -12
  91. package/src/components/wt-icon-btn/_variables.scss +0 -2
  92. package/src/components/wt-icon-btn/wt-icon-btn.vue +4 -6
  93. package/src/components/wt-image/wt-image.vue +14 -13
  94. package/src/components/wt-indicator/wt-indicator.vue +2 -7
  95. package/src/components/wt-input/_variables.scss +1 -2
  96. package/src/components/wt-input/wt-input.vue +13 -10
  97. package/src/components/wt-input-info/_variables.scss +0 -1
  98. package/src/components/wt-intersection-observer/__tests__/WtIntersectionObserver.spec.js +1 -1
  99. package/src/components/wt-intersection-observer/wt-intersection-observer.vue +9 -8
  100. package/src/components/wt-item-link/_variables.scss +0 -1
  101. package/src/components/wt-label/_variables.scss +0 -1
  102. package/src/components/wt-label/wt-label.vue +1 -4
  103. package/src/components/wt-load-bar/_variables.scss +0 -1
  104. package/src/components/wt-load-bar/wt-load-bar.vue +0 -1
  105. package/src/components/wt-loader/_variables.scss +0 -2
  106. package/src/components/wt-loader/wt-loader.vue +1 -3
  107. package/src/components/wt-logo/wt-logo.vue +1 -1
  108. package/src/components/wt-navigation-bar/__tests__/WtNavigationBar.spec.js +9 -3
  109. package/src/components/wt-navigation-bar/_variables.scss +9 -3
  110. package/src/components/wt-navigation-bar/wt-navigation-bar.vue +27 -11
  111. package/src/components/wt-notification/_variables.scss +0 -1
  112. package/src/components/wt-notifications-bar/__tests__/WtNotificationsBar.spec.js +1 -1
  113. package/src/components/wt-notifications-bar/_variables.scss +1 -2
  114. package/src/components/wt-notifications-bar/wt-notifications-bar.vue +4 -2
  115. package/src/components/wt-page-header/wt-page-header.vue +3 -2
  116. package/src/components/wt-page-wrapper/__tests__/WtPageWrapper.spec.js +3 -1
  117. package/src/components/wt-page-wrapper/_variables.scss +0 -1
  118. package/src/components/wt-page-wrapper/wt-page-wrapper.vue +0 -2
  119. package/src/components/wt-pagination/_variables.scss +1 -2
  120. package/src/components/wt-pagination/wt-pagination.vue +2 -1
  121. package/src/components/wt-player/_variables.scss +6 -2
  122. package/src/components/wt-player/wt-player.vue +52 -53
  123. package/src/components/wt-popup/_variables.scss +0 -1
  124. package/src/components/wt-popup/wt-popup.vue +2 -8
  125. package/src/components/wt-progress-bar/_variables.scss +0 -1
  126. package/src/components/wt-progress-bar/wt-progress-bar.vue +7 -6
  127. package/src/components/wt-radio/_variables.scss +1 -2
  128. package/src/components/wt-radio/wt-radio.vue +1 -2
  129. package/src/components/wt-rounded-action/_variables.scss +3 -1
  130. package/src/components/wt-search-bar/_variables.scss +4 -2
  131. package/src/components/wt-search-bar/wt-search-bar.vue +10 -4
  132. package/src/components/wt-select/_multiselect.scss +9 -15
  133. package/src/components/wt-select/_variables.scss +3 -2
  134. package/src/components/wt-select/mixins/multiselectMixin.js +2 -1
  135. package/src/components/wt-select/wt-select.vue +25 -26
  136. package/src/components/wt-slider/_variables.scss +0 -1
  137. package/src/components/wt-slider/wt-slider.vue +3 -3
  138. package/src/components/wt-status-select/_variables.scss +8 -4
  139. package/src/components/wt-stepper/_variables.scss +0 -1
  140. package/src/components/wt-stepper/wt-stepper.vue +5 -5
  141. package/src/components/wt-switcher/_variables.scss +0 -1
  142. package/src/components/wt-switcher/wt-switcher.vue +2 -3
  143. package/src/components/wt-table/__tests__/WtTable.spec.js +8 -2
  144. package/src/components/wt-table/_variables.scss +0 -1
  145. package/src/components/wt-table/types/table-header.ts +8 -0
  146. package/src/components/wt-table/wt-table.vue +111 -109
  147. package/src/components/wt-table-actions/_variables.scss +1 -2
  148. package/src/components/wt-table-actions/wt-table-actions.vue +1 -2
  149. package/src/components/wt-table-column-select/wt-table-column-select.vue +11 -8
  150. package/src/components/wt-tabs/_variables.scss +0 -1
  151. package/src/components/wt-tabs/wt-tabs.vue +6 -6
  152. package/src/components/wt-tags-input/__tests__/WtTagsInput.spec.js +6 -6
  153. package/src/components/wt-tags-input/mixin/taggableMixin.js +3 -1
  154. package/src/components/wt-tags-input/wt-tags-input.vue +8 -10
  155. package/src/components/wt-textarea/__tests__/WtTextarea.spec.js +6 -2
  156. package/src/components/wt-textarea/_variables.scss +0 -1
  157. package/src/components/wt-textarea/wt-textarea.vue +6 -7
  158. package/src/components/wt-time-input/wt-time-input.vue +1 -2
  159. package/src/components/wt-timepicker/_variables.scss +1 -2
  160. package/src/components/wt-timepicker/wt-timepicker.vue +10 -8
  161. package/src/components/wt-tooltip/_internals/useTooltipTriggerSubscriptions.js +6 -1
  162. package/src/components/wt-tooltip/_internals/wt-tooltip-floating.vue +1 -3
  163. package/src/components/wt-tooltip/_variables.scss +0 -1
  164. package/src/components/wt-tooltip/wt-tooltip.vue +13 -2
  165. package/src/components/wt-tree-table/_variables.scss +19 -0
  166. package/src/components/wt-tree-table/wt-tree-table.vue +323 -0
  167. package/src/components/wt-tree-table-row/wt-tree-table-row.vue +171 -0
  168. package/src/composables/useAccessControl/useAccessControl.js +12 -4
  169. package/src/composables/useCachedInterval/useCachedInterval.js +6 -2
  170. package/src/composables/useCachedItemInstanceName/useCachedItemInstanceName.js +4 -1
  171. package/src/composables/useCard/useCardComponent.js +10 -9
  172. package/src/composables/useCard/useCardTabs.js +6 -3
  173. package/src/composables/useRepresentableAgentPauseCause/__tests__/useRepresentableAgentPauseCause.spec.js +20 -10
  174. package/src/composables/useValidate/useValidate.js +1 -1
  175. package/src/composables/useWtTable/useWtTable.ts +25 -0
  176. package/src/css/main.scss +7 -1
  177. package/src/css/pages/table-page.scss +1 -2
  178. package/src/css/styleguide/border-radius/_border-radius.scss +1 -1
  179. package/src/css/styleguide/colors/_deprecated.scss +83 -24
  180. package/src/css/styleguide/colors/_palette.scss +1340 -251
  181. package/src/css/styleguide/colors/reusable/_text-field.scss +6 -2
  182. package/src/css/styleguide/fonts/_fonts.scss +36 -18
  183. package/src/css/styleguide/spacings/_spacings.scss +1 -1
  184. package/src/css/styleguide/transitions/_transitions.scss +1 -1
  185. package/src/css/styleguide/transitions/fade/_fade.scss +5 -4
  186. package/src/css/styleguide/viewport-breakpoints/_viewport-breakpoints.scss +0 -1
  187. package/src/enums/WebitelApplications/WebitelApplications.enum.js +7 -7
  188. package/src/enums/index.js +5 -10
  189. package/src/locale/en/en.js +5 -2
  190. package/src/locale/ru/ru.js +7 -3
  191. package/src/locale/ua/ua.js +7 -3
  192. package/src/mixins/dataFilterMixins/__tests__/apiFilterMixin.spec.js +2 -1
  193. package/src/mixins/dataFilterMixins/apiFilterMixin.js +3 -1
  194. package/src/mixins/dataFilterMixins/baseFilterMixin/baseFilterMixin.js +2 -1
  195. package/src/mixins/dataFilterMixins/enumFilterMixin.js +2 -1
  196. package/src/mixins/dataFilterMixins/paginationFilterMixin.js +4 -1
  197. package/src/mixins/dataFilterMixins/sortFilterMixin.js +2 -1
  198. package/src/mixins/validationMixin/useValidation.js +17 -7
  199. package/src/mixins/validationMixin/validationMixin.js +16 -8
  200. package/src/modules/AgentStatusSelect/api/pause-cause.js +4 -1
  201. package/src/modules/AgentStatusSelect/components/__tests__/wt-cc-agent-status-select.spec.js +18 -6
  202. package/src/modules/AgentStatusSelect/components/_internals/wt-cc-pause-cause-popup.vue +3 -2
  203. package/src/modules/AgentStatusSelect/components/wt-cc-agent-status-select.vue +5 -2
  204. package/src/modules/Appearance/components/__tests__/wt-dark-mode-switcher.spec.js +6 -2
  205. package/src/modules/AuditForm/components/__tests__/audit-form-question-write-wrapper.spec.js +12 -4
  206. package/src/modules/AuditForm/components/__tests__/audit-form.spec.js +18 -5
  207. package/src/modules/AuditForm/components/audit-form-question-read-wrapper.vue +4 -2
  208. package/src/modules/AuditForm/components/audit-form-question-write-wrapper.vue +15 -5
  209. package/src/modules/AuditForm/components/audit-form-question.vue +10 -4
  210. package/src/modules/AuditForm/components/audit-form.vue +24 -7
  211. package/src/modules/AuditForm/components/questions/options/__tests__/audit-form-question-options.spec.js +6 -2
  212. package/src/modules/AuditForm/components/questions/options/audit-form-question-options.vue +5 -5
  213. package/src/modules/AuditForm/components/questions/score/audit-form-question-score.vue +9 -4
  214. package/src/modules/CSVExport/CSVExport.js +5 -2
  215. package/src/modules/CSVExport/XLSExport.js +7 -7
  216. package/src/modules/CSVExport/__tests__/CSVExport.spec.js +4 -1
  217. package/src/modules/CSVExport/mixins/exportCSVMixin.js +3 -1
  218. package/src/modules/CSVExport/mixins/exportXLSMixin.js +3 -1
  219. package/src/modules/CardStoreModule/composables/useCardStore.js +6 -2
  220. package/src/modules/DeleteConfirmationPopup/__tests__/delete-confirmation-popup.spec.js +3 -3
  221. package/src/modules/DeleteConfirmationPopup/components/delete-confirmation-popup.vue +6 -3
  222. package/src/modules/FilesExport/__tests__/FilesExport.spec.js +6 -2
  223. package/src/modules/FilesExport/mixins/exportFilesMixin.js +6 -2
  224. package/src/modules/FilesExport/scripts/generateMediaURL.js +2 -1
  225. package/src/modules/Filters/classes/BaseFilterSchema.js +15 -6
  226. package/src/modules/Filters/components/filter-datetime.vue +7 -5
  227. package/src/modules/Filters/components/filter-pagination.vue +7 -5
  228. package/src/modules/Filters/components/filter-search.vue +4 -4
  229. package/src/modules/Filters/components/filter-select.vue +33 -24
  230. package/src/modules/Filters/components/filter-table-fields.vue +1 -3
  231. package/src/modules/Filters/composables/useTableFilters.js +3 -1
  232. package/src/modules/Filters/scripts/getters/localStorageGetter.js +6 -2
  233. package/src/modules/Filters/scripts/getters/queryGetter.js +2 -1
  234. package/src/modules/Filters/scripts/setters/localStorageSetter.js +6 -2
  235. package/src/modules/Filters/scripts/setters/querySetter.js +2 -1
  236. package/src/modules/Filters/scripts/utils/changeRouteQuery.js +2 -1
  237. package/src/modules/Filters/store/FiltersStoreModule.js +3 -3
  238. package/src/modules/Notifications/store/NotificationsStoreModule.js +14 -5
  239. package/src/modules/Notifications/store/__tests__/NotificationsStoreModule.actions.spec.js +10 -3
  240. package/src/modules/ObjectPermissions/_internals/components/permissions-role-row.vue +1 -3
  241. package/src/modules/ObjectPermissions/_internals/components/permissions-role-select.vue +1 -3
  242. package/src/modules/ObjectPermissions/_internals/components/permissions-tab-role-popup.vue +8 -5
  243. package/src/modules/ObjectPermissions/_internals/modules/filters/store/filters.store.js +3 -4
  244. package/src/modules/ObjectPermissions/_internals/store/helpers/createObjectPermissionsStoreModule.js +1 -2
  245. package/src/modules/ObjectPermissions/_internals/store/modules/objectPermissionsStoreModule.js +10 -14
  246. package/src/modules/ObjectPermissions/components/permissions-tab.vue +12 -12
  247. package/src/modules/ObjectPermissions/store/index.js +2 -6
  248. package/src/modules/QueryFilters/components/__tests__/filter-datetime.spec.js +3 -1
  249. package/src/modules/QueryFilters/components/__tests__/filter-from-to.spec.js +6 -2
  250. package/src/modules/QueryFilters/components/__tests__/filter-search.spec.js +7 -2
  251. package/src/modules/QueryFilters/components/abstract-api-filter.vue +15 -5
  252. package/src/modules/QueryFilters/components/abstract-enum-filter.vue +15 -5
  253. package/src/modules/QueryFilters/components/filter-datetime.vue +1 -3
  254. package/src/modules/QueryFilters/components/filter-from-to.vue +1 -1
  255. package/src/modules/QueryFilters/components/filter-search.vue +1 -3
  256. package/src/modules/QueryFilters/components/filter-table-fields.vue +1 -3
  257. package/src/modules/QueryFilters/mixins/__tests__/enumFilterMixin.spec.js +4 -1
  258. package/src/modules/QueryFilters/mixins/baseFilterMixin/baseFilterMixin.js +9 -3
  259. package/src/modules/QueryFilters/mixins/enumFilterMixin.js +10 -3
  260. package/src/modules/QueryFilters/mixins/paginationFilterMixin.js +4 -2
  261. package/src/modules/QueryFilters/mixins/sortFilterMixin.js +2 -1
  262. package/src/modules/QueryFilters/store/QueryFiltersStoreModule.js +2 -1
  263. package/src/modules/QueryFilters/store/__tests__/QueryFiltersStoreModule.spec.js +10 -3
  264. package/src/modules/TableComponentModule/composables/useTableEmpty.js +13 -4
  265. package/src/modules/TableStoreModule/composables/useTableStore.js +18 -6
  266. package/src/modules/TableStoreModule/store/TableStoreModule.js +36 -21
  267. package/src/modules/TableStoreModule/store/__tests__/TableStoreModule.spec.js +7 -2
  268. package/src/modules/Userinfo/api/userinfo.js +4 -1
  269. package/src/modules/Userinfo/classes/ApplicationsAccess.js +3 -1
  270. package/src/modules/Userinfo/store/UserinfoStoreModule.js +25 -9
  271. package/src/plugins/breakpoint/breakpoint.plugin.js +2 -1
  272. package/src/scripts/__tests__/caseConverters.spec.js +4 -1
  273. package/src/scripts/__tests__/updateObject.spec.js +6 -2
  274. package/src/scripts/caseConverters.js +37 -29
  275. package/src/scripts/compareSize.ts +9 -6
  276. package/src/scripts/debounce.js +2 -1
  277. package/src/scripts/index.js +2 -8
  278. package/src/scripts/logger.js +4 -4
  279. package/src/scripts/preventHiddenPageCallsDecorator.js +6 -2
  280. package/src/scripts/saveAsJSON.js +3 -1
  281. package/src/scripts/sortQueryAdapters.js +11 -0
  282. package/src/store/BaseStoreModules/ApiStoreModule.js +26 -7
  283. package/src/store/BaseStoreModules/BaseStoreModule.js +2 -1
  284. package/src/store/BaseStoreModules/__tests__/BaseStoreModule.spec.js +28 -7
  285. package/src/store/helpers/getNamespacedState.js +3 -1
  286. package/src/store/new/modules/apiStoreModule/apiStoreModule.js +19 -14
  287. package/src/store/new/modules/cardStoreModule/useCardStore.js +6 -2
  288. package/src/store/new/modules/tableStoreModule/__tests__/tableStoreModule.spec.js +6 -8
  289. package/src/store/new/modules/tableStoreModule/tableStoreModule.js +31 -28
  290. package/src/store/new/modules/tableStoreModule/useTableStore.js +18 -6
  291. package/src/validators/variableSearchValidator/__tests__/variableSearchValidator.spec.js +2 -1
  292. package/src/validators/websocketValidator/__tests__/websocketValidator.spec.js +3 -1
  293. package/src/components/wt-table/_internals/getSortOrder.js +0 -12
  294. /package/dist/img/sprite/{plus.svg → tree-expand.svg} +0 -0
  295. /package/src/assets/icons/sprite/{plus.svg → tree-expand.svg} +0 -0
@@ -1,5 +1,9 @@
1
1
  const isPageHidden = () =>
2
- document.hidden || document.msHidden || document.webkitHidden || document.mozHidden;
2
+ document.hidden ||
3
+ document.msHidden ||
4
+ document.webkitHidden ||
5
+ document.mozHidden;
3
6
 
4
- const preventHiddenPageCallsDecorator = (method) => (args) => isPageHidden() || method(args);
7
+ const preventHiddenPageCallsDecorator = (method) => (args) =>
8
+ isPageHidden() || method(args);
5
9
  export default preventHiddenPageCallsDecorator;
@@ -2,7 +2,9 @@ import { saveAs } from 'file-saver-es';
2
2
 
3
3
  const saveAsJSON = (name, content) => {
4
4
  const fileName = name.replace(/[ ,]+/g, '-');
5
- const file = new Blob([JSON.stringify(content, null, 4)], { type: 'application/json' });
5
+ const file = new Blob([JSON.stringify(content, null, 4)], {
6
+ type: 'application/json',
7
+ });
6
8
  saveAs(file, fileName);
7
9
  };
8
10
 
@@ -25,3 +25,14 @@ export const queryToSortAdapter = (order) => {
25
25
  return SortSymbols.NONE;
26
26
  }
27
27
  };
28
+
29
+ export const getNextSortOrder = (sort) => {
30
+ switch (sort) {
31
+ case SortSymbols.ASC:
32
+ return SortSymbols.DESC;
33
+ case SortSymbols.DESC:
34
+ return SortSymbols.NONE;
35
+ default:
36
+ return SortSymbols.ASC;
37
+ }
38
+ };
@@ -1,11 +1,15 @@
1
1
  import BaseStoreModule from './BaseStoreModule.js';
2
2
 
3
- const getParentIdFromContext = (context) => context?.getters?.PARENT_ID || context?.state?.parentId;
3
+ const getParentIdFromContext = (context) =>
4
+ context?.getters?.PARENT_ID || context?.state?.parentId;
4
5
 
5
6
  export default class ApiStoreModule extends BaseStoreModule {
6
7
  generateAPIActions(api) {
7
8
  if (!api) throw new ReferenceError('pass API module!');
8
- this.actions.GET_LIST = (_, { context: callerContext = {}, params = {} }) => {
9
+ this.actions.GET_LIST = (
10
+ _,
11
+ { context: callerContext = {}, params = {} },
12
+ ) => {
9
13
  if (!api.getList) throw Error('No API "getList" method provided');
10
14
  return api.getList({
11
15
  ...callerContext.state,
@@ -14,7 +18,10 @@ export default class ApiStoreModule extends BaseStoreModule {
14
18
  });
15
19
  };
16
20
 
17
- this.actions.GET_ITEM = (_, { context: callerContext = {}, params = {} } = {}) => {
21
+ this.actions.GET_ITEM = (
22
+ _,
23
+ { context: callerContext = {}, params = {} } = {},
24
+ ) => {
18
25
  if (!api.get) throw Error('No API "get" method provided');
19
26
  return api.get({
20
27
  ...callerContext.state,
@@ -23,7 +30,10 @@ export default class ApiStoreModule extends BaseStoreModule {
23
30
  });
24
31
  };
25
32
 
26
- this.actions.POST_ITEM = (_, { context: callerContext = {}, ...rest } = {}) => {
33
+ this.actions.POST_ITEM = (
34
+ _,
35
+ { context: callerContext = {}, ...rest } = {},
36
+ ) => {
27
37
  if (!api.add) throw Error('No API "add" method provided');
28
38
  return api.add({
29
39
  ...callerContext.state,
@@ -32,7 +42,10 @@ export default class ApiStoreModule extends BaseStoreModule {
32
42
  });
33
43
  };
34
44
 
35
- this.actions.PATCH_ITEM = (_, { context: callerContext = {}, id, changes, ...rest }) => {
45
+ this.actions.PATCH_ITEM = (
46
+ _,
47
+ { context: callerContext = {}, id, changes, ...rest },
48
+ ) => {
36
49
  if (!api.patch) throw Error('No API "patch" method provided');
37
50
  return api.patch({
38
51
  ...callerContext.state,
@@ -43,7 +56,10 @@ export default class ApiStoreModule extends BaseStoreModule {
43
56
  });
44
57
  };
45
58
 
46
- this.actions.UPD_ITEM = (_, { context: callerContext = {}, ...rest } = {}) => {
59
+ this.actions.UPD_ITEM = (
60
+ _,
61
+ { context: callerContext = {}, ...rest } = {},
62
+ ) => {
47
63
  if (!api.update) throw Error('No API "update" method provided');
48
64
  return api.update({
49
65
  ...callerContext.state,
@@ -52,7 +68,10 @@ export default class ApiStoreModule extends BaseStoreModule {
52
68
  });
53
69
  };
54
70
 
55
- this.actions.DELETE_ITEM = (_, { context: callerContext = {}, id, ...rest }) => {
71
+ this.actions.DELETE_ITEM = (
72
+ _,
73
+ { context: callerContext = {}, id, ...rest },
74
+ ) => {
56
75
  if (!api.delete) throw Error('No API "delete" method provided');
57
76
  return api.delete({
58
77
  ...callerContext.state,
@@ -26,7 +26,8 @@ export default class BaseStoreModule {
26
26
  this.actions.PATCH_ITEM = (context, { id, changes }) =>
27
27
  this._APIModule.patch({ ...context.state, id, changes });
28
28
  this.actions.UPD_ITEM = (context) => this._APIModule.update(context.state);
29
- this.actions.DELETE_ITEM = (context, id) => this._APIModule.delete({ ...context.state, id });
29
+ this.actions.DELETE_ITEM = (context, id) =>
30
+ this._APIModule.delete({ ...context.state, id });
30
31
  return this;
31
32
  }
32
33
 
@@ -15,7 +15,10 @@ describe('Base Store Module', () => {
15
15
  module = new BaseStoreModule();
16
16
  });
17
17
  it('attaches api module and generates API actions from it', () => {
18
- const _module = module.attachAPIModule(APIModule).generateAPIActions().getModule();
18
+ const _module = module
19
+ .attachAPIModule(APIModule)
20
+ .generateAPIActions()
21
+ .getModule();
19
22
  expect(_module.actions.GET_LIST).toBeTruthy();
20
23
  expect(_module.actions.GET_ITEM).toBeTruthy();
21
24
  expect(_module.actions.POST_ITEM).toBeTruthy();
@@ -28,7 +31,10 @@ describe('Base Store Module', () => {
28
31
  const params = { jest2: 'jest1' };
29
32
  const context = { state };
30
33
  const expectedParams = { jest: 'jest', jest2: 'jest1' };
31
- const _module = module.attachAPIModule(APIModule).generateAPIActions().getModule();
34
+ const _module = module
35
+ .attachAPIModule(APIModule)
36
+ .generateAPIActions()
37
+ .getModule();
32
38
  _module.actions.GET_LIST(context, params);
33
39
  expect(APIModule.getList).toHaveBeenCalledWith(expectedParams);
34
40
  });
@@ -37,7 +43,10 @@ describe('Base Store Module', () => {
37
43
  const params = { jest2: 'jest1' };
38
44
  const context = { state };
39
45
  const expectedParams = { jest: 'jest', jest2: 'jest1' };
40
- const _module = module.attachAPIModule(APIModule).generateAPIActions().getModule();
46
+ const _module = module
47
+ .attachAPIModule(APIModule)
48
+ .generateAPIActions()
49
+ .getModule();
41
50
  _module.actions.GET_ITEM(context, params);
42
51
  expect(APIModule.get).toHaveBeenCalledWith(expectedParams);
43
52
  });
@@ -45,7 +54,10 @@ describe('Base Store Module', () => {
45
54
  const state = { jest: 'jest' };
46
55
  const context = { state };
47
56
  const expectedParams = { jest: 'jest' };
48
- const _module = module.attachAPIModule(APIModule).generateAPIActions().getModule();
57
+ const _module = module
58
+ .attachAPIModule(APIModule)
59
+ .generateAPIActions()
60
+ .getModule();
49
61
  _module.actions.POST_ITEM(context);
50
62
  expect(APIModule.add).toHaveBeenCalledWith(expectedParams);
51
63
  });
@@ -58,7 +70,10 @@ describe('Base Store Module', () => {
58
70
  id: '1',
59
71
  changes: { jest: 'my change!' },
60
72
  };
61
- const _module = module.attachAPIModule(APIModule).generateAPIActions().getModule();
73
+ const _module = module
74
+ .attachAPIModule(APIModule)
75
+ .generateAPIActions()
76
+ .getModule();
62
77
  _module.actions.PATCH_ITEM(context, params);
63
78
  expect(APIModule.patch).toHaveBeenCalledWith(expectedParams);
64
79
  });
@@ -66,7 +81,10 @@ describe('Base Store Module', () => {
66
81
  const state = { jest: 'jest' };
67
82
  const context = { state };
68
83
  const expectedParams = { jest: 'jest' };
69
- const _module = module.attachAPIModule(APIModule).generateAPIActions().getModule();
84
+ const _module = module
85
+ .attachAPIModule(APIModule)
86
+ .generateAPIActions()
87
+ .getModule();
70
88
  _module.actions.UPD_ITEM(context);
71
89
  expect(APIModule.update).toHaveBeenCalledWith(expectedParams);
72
90
  });
@@ -75,7 +93,10 @@ describe('Base Store Module', () => {
75
93
  const params = '1';
76
94
  const context = { state };
77
95
  const expectedParams = { jest: 'jest', id: '1' };
78
- const _module = module.attachAPIModule(APIModule).generateAPIActions().getModule();
96
+ const _module = module
97
+ .attachAPIModule(APIModule)
98
+ .generateAPIActions()
99
+ .getModule();
79
100
  _module.actions.DELETE_ITEM(context, params);
80
101
  expect(APIModule.delete).toHaveBeenCalledWith(expectedParams);
81
102
  });
@@ -1,4 +1,6 @@
1
1
  const getNamespacedState = (state, namespace) =>
2
- namespace.split('/').reduce((subState, subNamespace) => subState[subNamespace], state);
2
+ namespace
3
+ .split('/')
4
+ .reduce((subState, subNamespace) => subState[subNamespace], state);
3
5
 
4
6
  export default getNamespacedState;
@@ -1,4 +1,5 @@
1
- const getParentIdFromContext = (context) => context?.getters?.PARENT_ID || context?.state?.parentId;
1
+ const getParentIdFromContext = (context) =>
2
+ context?.getters?.PARENT_ID || context?.state?.parentId;
2
3
 
3
4
  const state = () => ({
4
5
  api: null,
@@ -8,7 +9,8 @@ const getters = {};
8
9
 
9
10
  const actions = {
10
11
  GET_LIST: (apiContext, { context: callerContext = {}, params = {} }) => {
11
- if (!apiContext.state.api.getList) throw Error('No API "getList" method provided');
12
+ if (!apiContext.state.api.getList)
13
+ throw Error('No API "getList" method provided');
12
14
  return apiContext.state.api.getList({
13
15
  ...callerContext.state,
14
16
  parentId: getParentIdFromContext(callerContext),
@@ -35,7 +37,8 @@ const actions = {
35
37
  },
36
38
 
37
39
  UPD_ITEM: (apiContext, { context: callerContext = {}, ...rest } = {}) => {
38
- if (!apiContext.state.api.update) throw Error('No API "update" method provided');
40
+ if (!apiContext.state.api.update)
41
+ throw Error('No API "update" method provided');
39
42
  return apiContext.state.api.update({
40
43
  ...callerContext.state,
41
44
  parentId: getParentIdFromContext(callerContext),
@@ -43,8 +46,12 @@ const actions = {
43
46
  });
44
47
  },
45
48
 
46
- PATCH_ITEM: (apiContext, { context: callerContext = {}, id, changes, ...rest }) => {
47
- if (!apiContext.state.api.patch) throw Error('No API "patch" method provided');
49
+ PATCH_ITEM: (
50
+ apiContext,
51
+ { context: callerContext = {}, id, changes, ...rest },
52
+ ) => {
53
+ if (!apiContext.state.api.patch)
54
+ throw Error('No API "patch" method provided');
48
55
  return apiContext.state.api.patch({
49
56
  ...callerContext.state,
50
57
  parentId: getParentIdFromContext(callerContext),
@@ -55,7 +62,8 @@ const actions = {
55
62
  },
56
63
 
57
64
  DELETE_ITEM: (apiContext, { context: callerContext = {}, id, ...rest }) => {
58
- if (!apiContext.state.api.delete) throw Error('No API "delete" method provided');
65
+ if (!apiContext.state.api.delete)
66
+ throw Error('No API "delete" method provided');
59
67
  return apiContext.state.api.delete({
60
68
  ...callerContext.state,
61
69
  parentId: getParentIdFromContext(callerContext),
@@ -68,7 +76,8 @@ const actions = {
68
76
  apiContext,
69
77
  { context: callerContext = {}, params = {} },
70
78
  ) => {
71
- if (!apiContext.state.api.getList) throw Error('No API "getPermissionsList" method provided');
79
+ if (!apiContext.state.api.getList)
80
+ throw Error('No API "getPermissionsList" method provided');
72
81
  return apiContext.state.api.getPermissionsList({
73
82
  ...callerContext.state,
74
83
  parentId: getParentIdFromContext(callerContext),
@@ -78,14 +87,10 @@ const actions = {
78
87
 
79
88
  PATCH_OBJECT_PERMISSIONS_ITEM: (
80
89
  apiContext,
81
- {
82
- context: callerContext = {},
83
- id,
84
- changes,
85
- ...rest
86
- },
90
+ { context: callerContext = {}, id, changes, ...rest },
87
91
  ) => {
88
- if (!apiContext.state.api.patch) throw Error('No API "patchPermissions" method provided');
92
+ if (!apiContext.state.api.patch)
93
+ throw Error('No API "patchPermissions" method provided');
89
94
  return apiContext.state.api.patchPermissions({
90
95
  ...callerContext.state,
91
96
  parentId: getParentIdFromContext(callerContext),
@@ -9,8 +9,12 @@ export const useCardStore = (namespace) => {
9
9
  ? namespace
10
10
  : `${namespace}/card`;
11
11
 
12
- const id = computed(() => getNamespacedState(store.state, cardNamespace).itemId);
13
- const itemInstance = computed(() => getNamespacedState(store.state, cardNamespace).itemInstance);
12
+ const id = computed(
13
+ () => getNamespacedState(store.state, cardNamespace).itemId,
14
+ );
15
+ const itemInstance = computed(
16
+ () => getNamespacedState(store.state, cardNamespace).itemInstance,
17
+ );
14
18
 
15
19
  function loadItem(payload) {
16
20
  return store.dispatch(`${cardNamespace}/LOAD_ITEM`, payload);
@@ -1,13 +1,9 @@
1
1
  import { createRouter, createWebHistory } from 'vue-router';
2
2
  import { createStore } from 'vuex';
3
- import FilterEvent
4
- from '../../../../../modules/Filters/enums/FilterEvent.enum.js';
5
- import FiltersStoreModule
6
- from '../../../../../modules/Filters/store/FiltersStoreModule.js';
3
+ import FilterEvent from '../../../../../modules/Filters/enums/FilterEvent.enum.js';
4
+ import FiltersStoreModule from '../../../../../modules/Filters/store/FiltersStoreModule.js';
7
5
  import { SortSymbols } from '../../../../../scripts/sortQueryAdapters.js';
8
- import {
9
- createTableStoreModule,
10
- } from '../../../helpers/createTableStoreModule.js';
6
+ import { createTableStoreModule } from '../../../helpers/createTableStoreModule.js';
11
7
 
12
8
  describe('TableStoreModule', () => {
13
9
  it('correctly computes FIELDS getter', () => {
@@ -240,7 +236,9 @@ describe('TableStoreModule integration with FiltersStoreModule', () => {
240
236
  value: ['surname'],
241
237
  });
242
238
 
243
- expect(store.getters['table/filters/GET_FILTER']('fields')).toEqual(['surname']);
239
+ expect(store.getters['table/filters/GET_FILTER']('fields')).toEqual([
240
+ 'surname',
241
+ ]);
244
242
 
245
243
  expect(store.getters['table/FIELDS']).toEqual(['id', 'included']);
246
244
 
@@ -48,7 +48,8 @@ const getters = {
48
48
 
49
49
  const actions = {
50
50
  // FIXME: maybe move to filters module?
51
- SET_FILTER: (context, payload) => context.dispatch('filters/SET_FILTER', payload),
51
+ SET_FILTER: (context, payload) =>
52
+ context.dispatch('filters/SET_FILTER', payload),
52
53
 
53
54
  // FIXME: maybe move to filters module?
54
55
  ON_FILTER_EVENT: async (context, { event, payload }) => {
@@ -67,14 +68,16 @@ const actions = {
67
68
  // FIXME: maybe move to filters module?
68
69
  HANDLE_FILTERS_RESTORE: async (context, { fields, sort }) => {
69
70
  if (sort) await context.dispatch('HANDLE_SORT_CHANGE', { value: sort });
70
- if (fields?.length) await context.dispatch('HANDLE_FIELDS_CHANGE', { value: fields });
71
+ if (fields?.length)
72
+ await context.dispatch('HANDLE_FIELDS_CHANGE', { value: fields });
71
73
  return context.dispatch('LOAD_DATA_LIST');
72
74
  },
73
75
 
74
76
  // FIXME: maybe move to filters module?
75
77
  HANDLE_FILTER_RESET: async (context, { fields, sort }) => {
76
78
  if (sort) await context.dispatch('HANDLE_SORT_CHANGE', { value: sort });
77
- if (fields?.length) await context.dispatch('HANDLE_FIELDS_CHANGE', { value: fields });
79
+ if (fields?.length)
80
+ await context.dispatch('HANDLE_FIELDS_CHANGE', { value: fields });
78
81
  return context.dispatch('LOAD_DATA_LIST');
79
82
  },
80
83
 
@@ -112,17 +115,19 @@ const actions = {
112
115
  const nextSort = queryToSortAdapter(value?.slice(0, 1) || '');
113
116
  const field = nextSort ? value.slice(1) : value;
114
117
 
115
- const headers = context.state.headers.map(({ sort: currentSort, ...header }) => {
116
- let sort;
118
+ const headers = context.state.headers.map(
119
+ ({ sort: currentSort, ...header }) => {
120
+ let sort;
117
121
 
118
- if (field) {
119
- sort = field === header.field ? nextSort : currentSort;
120
- } else {
121
- sort = nextSort; // null
122
- }
122
+ if (field) {
123
+ sort = field === header.field ? nextSort : currentSort;
124
+ } else {
125
+ sort = nextSort; // null
126
+ }
123
127
 
124
- return { ...header, sort };
125
- });
128
+ return { ...header, sort };
129
+ },
130
+ );
126
131
 
127
132
  context.commit('SET', { path: 'headers', value: headers });
128
133
  },
@@ -133,13 +138,13 @@ const actions = {
133
138
 
134
139
  const params = context.getters.GET_LIST_PARAMS(query);
135
140
  try {
136
- const {
137
- items = [],
138
- next = false,
139
- } = await context.dispatch('GET_LIST_API', {
140
- context,
141
- params,
142
- });
141
+ const { items = [], next = false } = await context.dispatch(
142
+ 'GET_LIST_API',
143
+ {
144
+ context,
145
+ params,
146
+ },
147
+ );
143
148
 
144
149
  context.commit('SET', { path: 'dataList', value: items });
145
150
  context.commit('SET', { path: 'isNextPage', value: next });
@@ -222,21 +227,19 @@ const actions = {
222
227
  },
223
228
 
224
229
  DELETE_BULK: async (context, deleted) =>
225
- Promise.allSettled(deleted.map((item) => context.dispatch('DELETE_SINGLE', item))),
230
+ Promise.allSettled(
231
+ deleted.map((item) => context.dispatch('DELETE_SINGLE', item)),
232
+ ),
226
233
 
227
234
  SET_SELECTED: (context, selected) => {
228
235
  context.commit('SET', { path: 'selected', value: selected });
229
236
  },
230
237
 
231
238
  GET_LIST_API: (context, payload) => context.dispatch('api/GET_LIST', payload),
232
- PATCH_ITEM_API: (
233
- context,
234
- payload,
235
- ) => context.dispatch('api/PATCH_ITEM', payload),
236
- DELETE_ITEM_API: (
237
- context,
238
- payload,
239
- ) => context.dispatch('api/DELETE_ITEM', payload),
239
+ PATCH_ITEM_API: (context, payload) =>
240
+ context.dispatch('api/PATCH_ITEM', payload),
241
+ DELETE_ITEM_API: (context, payload) =>
242
+ context.dispatch('api/DELETE_ITEM', payload),
240
243
 
241
244
  RESET_TABLE_STATE: async (context) => {
242
245
  context.commit('RESET_TABLE_STATE');
@@ -7,17 +7,29 @@ export const useTableStore = (namespace) => {
7
7
 
8
8
  const tableNamespace = `${namespace}/table`;
9
9
 
10
- const dataList = computed(() => getNamespacedState(store.state, tableNamespace).dataList);
10
+ const dataList = computed(
11
+ () => getNamespacedState(store.state, tableNamespace).dataList,
12
+ );
11
13
 
12
- const selected = computed(() => getNamespacedState(store.state, tableNamespace).selected);
14
+ const selected = computed(
15
+ () => getNamespacedState(store.state, tableNamespace).selected,
16
+ );
13
17
 
14
- const isLoading = computed(() => getNamespacedState(store.state, tableNamespace).isLoading);
18
+ const isLoading = computed(
19
+ () => getNamespacedState(store.state, tableNamespace).isLoading,
20
+ );
15
21
 
16
- const headers = computed(() => getNamespacedState(store.state, tableNamespace).headers);
22
+ const headers = computed(
23
+ () => getNamespacedState(store.state, tableNamespace).headers,
24
+ );
17
25
 
18
- const isNext = computed(() => getNamespacedState(store.state, tableNamespace).isNextPage);
26
+ const isNext = computed(
27
+ () => getNamespacedState(store.state, tableNamespace).isNextPage,
28
+ );
19
29
 
20
- const error = computed(() => getNamespacedState(store.state, tableNamespace).errors);
30
+ const error = computed(
31
+ () => getNamespacedState(store.state, tableNamespace).errors,
32
+ );
21
33
 
22
34
  function loadData(payload) {
23
35
  return store.dispatch(`${tableNamespace}/LOAD_DATA_LIST`, payload);
@@ -42,7 +42,8 @@ describe('Variable search validator', () => {
42
42
  expect(variableSearchValidator(searchValue)).toBe(true);
43
43
  });
44
44
  it('Multiple "=" search', () => {
45
- const searchValue = 'height=5 feet 5½ inches (166 cm), age=1231, fin=123231';
45
+ const searchValue =
46
+ 'height=5 feet 5½ inches (166 cm), age=1231, fin=123231';
46
47
  expect(variableSearchValidator(searchValue)).toBe(false);
47
48
  });
48
49
  });
@@ -20,7 +20,9 @@ describe('websocketValidator', () => {
20
20
  expect(websocketValidator('wss://example.com/ws')).toBe(true);
21
21
  });
22
22
  it('truthy case 7: dns name', () => {
23
- expect(websocketValidator('wss://socket.socket.com/v3/channel_123?api_key=123')).toBe(true);
23
+ expect(
24
+ websocketValidator('wss://socket.socket.com/v3/channel_123?api_key=123'),
25
+ ).toBe(true);
24
26
  });
25
27
  it('falsy case 1: empty string', () => {
26
28
  expect(websocketValidator('')).toBe(false);
@@ -1,12 +0,0 @@
1
- const getNextSortOrder = (sort) => {
2
- switch (sort) {
3
- case 'asc':
4
- return 'desc';
5
- case 'desc':
6
- return null;
7
- default:
8
- return 'asc';
9
- }
10
- };
11
-
12
- export default getNextSortOrder;
File without changes