@webitel/ui-sdk 0.1.1 → 0.1.2-vite
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.
- package/CHANGELOG.md +9 -0
- package/README.md +29 -29
- package/dist/demo.html +1 -10
- package/dist/img/plyr.svg +68 -0
- package/dist/img/sprite/account.svg +4 -0
- package/dist/img/sprite/adfs.svg +5 -0
- package/dist/img/sprite/app-navigator.svg +11 -0
- package/dist/img/sprite/arrow-down.svg +3 -0
- package/dist/img/sprite/arrow-left.svg +3 -0
- package/dist/img/sprite/arrow-mix.svg +5 -0
- package/dist/img/sprite/arrow-right.svg +3 -0
- package/dist/img/sprite/arrow-up.svg +3 -0
- package/dist/img/sprite/attach.svg +3 -0
- package/dist/img/sprite/attention.svg +3 -0
- package/dist/img/sprite/azure.svg +19 -0
- package/dist/img/sprite/back.svg +4 -0
- package/dist/img/sprite/bell-badged.svg +4 -0
- package/dist/img/sprite/bell.svg +3 -0
- package/dist/img/sprite/bucket.svg +3 -0
- package/dist/img/sprite/calendar.svg +3 -0
- package/dist/img/sprite/call--filled.svg +3 -0
- package/dist/img/sprite/call-add-to--filled.svg +4 -0
- package/dist/img/sprite/call-add-to.svg +4 -0
- package/dist/img/sprite/call-disconnect--filled.svg +3 -0
- package/dist/img/sprite/call-disconnect.svg +3 -0
- package/dist/img/sprite/call-end--filled.svg +3 -0
- package/dist/img/sprite/call-end.svg +3 -0
- package/dist/img/sprite/call-inbound--filled.svg +4 -0
- package/dist/img/sprite/call-inbound.svg +3 -0
- package/dist/img/sprite/call-missed--filled.svg +4 -0
- package/dist/img/sprite/call-missed.svg +3 -0
- package/dist/img/sprite/call-outbound--filled.svg +3 -0
- package/dist/img/sprite/call-outbound.svg +3 -0
- package/dist/img/sprite/call-ringing--filled.svg +5 -0
- package/dist/img/sprite/call-ringing.svg +3 -0
- package/dist/img/sprite/call-transfer--filled.svg +4 -0
- package/dist/img/sprite/call-transfer.svg +3 -0
- package/dist/img/sprite/call.svg +3 -0
- package/dist/img/sprite/chat--filled.svg +3 -0
- package/dist/img/sprite/chat-emoji.svg +3 -0
- package/dist/img/sprite/chat-end--filled.svg +3 -0
- package/dist/img/sprite/chat-end.svg +4 -0
- package/dist/img/sprite/chat-group.svg +5 -0
- package/dist/img/sprite/chat-join.svg +4 -0
- package/dist/img/sprite/chat-message-status-read.svg +3 -0
- package/dist/img/sprite/chat-message-status-sent.svg +3 -0
- package/dist/img/sprite/chat-quick-response--filled.svg +3 -0
- package/dist/img/sprite/chat-quick-response.svg +3 -0
- package/dist/img/sprite/chat-reply.svg +3 -0
- package/dist/img/sprite/chat-send.svg +6 -0
- package/dist/img/sprite/chat-transfer--filled.svg +3 -0
- package/dist/img/sprite/chat-transfer.svg +4 -0
- package/dist/img/sprite/chat.svg +3 -0
- package/dist/img/sprite/checkbox--checked--filled.svg +3 -0
- package/dist/img/sprite/checkbox--checked.svg +3 -0
- package/dist/img/sprite/checkbox.svg +3 -0
- package/dist/img/sprite/clear.svg +3 -0
- package/dist/img/sprite/close--filled.svg +3 -0
- package/dist/img/sprite/close.svg +3 -0
- package/dist/img/sprite/collapse.svg +5 -0
- package/dist/img/sprite/column-select.svg +4 -0
- package/dist/img/sprite/conference.svg +8 -0
- package/dist/img/sprite/contacts.svg +3 -0
- package/dist/img/sprite/copy.svg +3 -0
- package/dist/img/sprite/docs.svg +6 -0
- package/dist/img/sprite/done.svg +4 -0
- package/dist/img/sprite/download.svg +5 -0
- package/dist/img/sprite/edit.svg +3 -0
- package/dist/img/sprite/email.svg +3 -0
- package/dist/img/sprite/expand.svg +5 -0
- package/dist/img/sprite/eye--closed.svg +5 -0
- package/dist/img/sprite/eye--opened.svg +4 -0
- package/dist/img/sprite/filter.svg +5 -0
- package/dist/img/sprite/generate.svg +4 -0
- package/dist/img/sprite/google.svg +6 -0
- package/dist/img/sprite/history.svg +4 -0
- package/dist/img/sprite/hold.svg +3 -0
- package/dist/img/sprite/idle.svg +4 -0
- package/dist/img/sprite/index.js +1 -0
- package/dist/img/sprite/instagram.svg +28 -0
- package/dist/img/sprite/job--accept.svg +4 -0
- package/dist/img/sprite/job--end.svg +4 -0
- package/dist/img/sprite/job.svg +5 -0
- package/dist/img/sprite/lock.svg +3 -0
- package/dist/img/sprite/logout.svg +3 -0
- package/dist/img/sprite/mail--color.svg +4 -0
- package/dist/img/sprite/mail.svg +3 -0
- package/dist/img/sprite/menu.svg +3 -0
- package/dist/img/sprite/messenger-facebook--filled.svg +3 -0
- package/dist/img/sprite/messenger-facebook.svg +9 -0
- package/dist/img/sprite/messenger-infobip.svg +5 -0
- package/dist/img/sprite/messenger-messenger.svg +12 -0
- package/dist/img/sprite/messenger-telegram--filled.svg +3 -0
- package/dist/img/sprite/messenger-telegram.svg +10 -0
- package/dist/img/sprite/messenger-viber--filled.svg +3 -0
- package/dist/img/sprite/messenger-viber.svg +3 -0
- package/dist/img/sprite/messenger-web-chat.svg +7 -0
- package/dist/img/sprite/messenger-whatsapp--filled.svg +4 -0
- package/dist/img/sprite/messenger-whatsapp.svg +10 -0
- package/dist/img/sprite/meta.svg +17 -0
- package/dist/img/sprite/mic-muted.svg +6 -0
- package/dist/img/sprite/mic.svg +4 -0
- package/dist/img/sprite/move.svg +6 -0
- package/dist/img/sprite/note.svg +3 -0
- package/dist/img/sprite/numpad.svg +24 -0
- package/dist/img/sprite/options.svg +5 -0
- package/dist/img/sprite/pause.svg +3 -0
- package/dist/img/sprite/pin.svg +3 -0
- package/dist/img/sprite/play.svg +4 -0
- package/dist/img/sprite/plus.svg +3 -0
- package/dist/img/sprite/preview-tag-application.svg +6 -0
- package/dist/img/sprite/preview-tag-audio.svg +4 -0
- package/dist/img/sprite/preview-tag-image.svg +4 -0
- package/dist/img/sprite/preview-tag-video.svg +4 -0
- package/dist/img/sprite/prompter.svg +3 -0
- package/dist/img/sprite/queue-member.svg +3 -0
- package/dist/img/sprite/radio--checked.svg +4 -0
- package/dist/img/sprite/radio.svg +3 -0
- package/dist/img/sprite/rec-off.svg +3 -0
- package/dist/img/sprite/rec.svg +4 -0
- package/dist/img/sprite/refresh.svg +4 -0
- package/dist/img/sprite/role.svg +3 -0
- package/dist/img/sprite/rounded-info.svg +3 -0
- package/dist/img/sprite/scorecard.svg +4 -0
- package/dist/img/sprite/search.svg +3 -0
- package/dist/img/sprite/send-arrow.svg +4 -0
- package/dist/img/sprite/settings.svg +3 -0
- package/dist/img/sprite/sort-arrow-down.svg +4 -0
- package/dist/img/sprite/sort-arrow-up.svg +4 -0
- package/dist/img/sprite/sound-off.svg +4 -0
- package/dist/img/sprite/sound-on.svg +3 -0
- package/dist/img/sprite/star--filled.svg +3 -0
- package/dist/img/sprite/star.svg +3 -0
- package/dist/img/sprite/stop.svg +4 -0
- package/dist/img/sprite/stt-download.svg +4 -0
- package/dist/img/sprite/stt-search.svg +3 -0
- package/dist/img/sprite/stt.svg +4 -0
- package/dist/img/sprite/telegram-bot.svg +6 -0
- package/dist/img/sprite/tick.svg +3 -0
- package/dist/img/sprite/tts-download.svg +5 -0
- package/dist/img/sprite/unpin.svg +5 -0
- package/dist/img/sprite/upload.svg +5 -0
- package/dist/img/sprite/user.svg +3 -0
- package/dist/img/sprite/video-cam-off.svg +4 -0
- package/dist/img/sprite/video-cam.svg +3 -0
- package/dist/img/sprite/zoom-in.svg +3 -0
- package/dist/img/sprite/zoom-out.svg +4 -0
- package/dist/ui-sdk.common.js +43300 -0
- package/dist/ui-sdk.common.js.map +1 -0
- package/dist/ui-sdk.css +1 -0
- package/dist/ui-sdk.umd.js +43319 -0
- package/dist/ui-sdk.umd.js.map +1 -0
- package/dist/ui-sdk.umd.min.js +35 -0
- package/dist/ui-sdk.umd.min.js.map +1 -0
- package/package.json +95 -44
- package/src/api/axios/generateInstance.js +25 -0
- package/src/api/defaults/getDefaultGetListResponse/getDefaultGetListResponse.js +6 -0
- package/src/api/defaults/getDefaultGetParams/getDefaultGetParams.js +9 -0
- package/src/api/defaults/index.js +7 -0
- package/src/api/interceptors/request/updateToken.interceptor.js +10 -0
- package/src/api/interceptors/response/handleUnauthorized.interceptor.js +12 -0
- package/src/api/transformers/applyTransform.js +8 -0
- package/src/api/transformers/camelToSnake/camelToSnake.transformer.js +4 -0
- package/src/api/transformers/generateUrl/generateUrl.transformer.js +13 -0
- package/src/api/transformers/index.js +23 -0
- package/src/api/transformers/log/log.transformer.js +6 -0
- package/src/api/transformers/merge/merge.transformer.js +5 -0
- package/src/api/transformers/mergeEach/mergeEach.transformer.js +8 -0
- package/src/api/transformers/notify/notify.transformer.js +32 -0
- package/src/api/transformers/sanitize/sanitize.transformer.js +12 -0
- package/src/api/transformers/snakeToCamel/snakeToCamel.transformer.js +4 -0
- package/src/api/transformers/starToSearch/starToSearch.transformer.js +12 -0
- package/src/components/index.js +91 -33
- package/src/components/on-demand/wt-cc-agent-status-timers/__tests__/wt-cc-agent-status-timers.spec.js +25 -0
- package/src/components/on-demand/wt-cc-agent-status-timers/wt-cc-agent-status-timers.vue +48 -0
- package/src/components/transitions/__tests__/ExpandTransition.spec.js +9 -0
- package/src/components/transitions/wt-expand-transition.vue +72 -0
- package/src/components/wt-app-header/__tests__/WtAppHeader.spec.js +19 -0
- package/src/components/wt-app-header/__tests__/WtAppNavigator.spec.js +23 -0
- package/src/components/wt-app-header/__tests__/WtHeaderActions.spec.js +21 -0
- package/src/components/wt-app-header/_variables.scss +25 -0
- package/src/components/wt-app-header/wt-app-header.vue +29 -0
- package/src/components/wt-app-header/wt-app-navigator.vue +278 -0
- package/src/components/wt-app-header/wt-header-actions.vue +183 -0
- package/src/components/wt-avatar/__tests__/wt-avatar.spec.js +9 -0
- package/src/components/wt-avatar/_variables.scss +32 -0
- package/src/components/wt-avatar/wt-avatar.vue +187 -0
- package/src/components/wt-badge/__tests__/wt-badge.spec.js +9 -0
- package/src/components/wt-badge/_variables.scss +3 -0
- package/src/components/wt-badge/wt-badge.vue +59 -0
- package/src/components/wt-button/Readme.md +23 -0
- package/src/components/wt-button/__tests__/WtButton.spec.js +29 -0
- package/src/components/wt-button/_variables.scss +41 -0
- package/src/components/wt-button/wt-button.vue +205 -0
- package/src/components/wt-button-select/Readme.md +13 -0
- package/src/components/wt-button-select/__tests__/WtButtonSelect.spec.js +40 -0
- package/src/components/wt-button-select/_variables.scss +7 -0
- package/src/components/wt-button-select/wt-button-select.vue +130 -0
- package/src/components/wt-checkbox/__tests__/WtCheckbox.spec.js +41 -0
- package/src/components/wt-checkbox/_variables.scss +4 -0
- package/src/components/wt-checkbox/wt-checkbox.vue +191 -0
- package/src/components/wt-chip/__tests__/WtChip.spec.js +19 -0
- package/src/components/wt-chip/_variables.scss +7 -0
- package/src/components/wt-chip/wt-chip.scss +41 -0
- package/src/components/wt-chip/wt-chip.vue +24 -0
- package/src/components/wt-context-menu/__tests__/WtContextMenu.spec.js +9 -0
- package/src/components/wt-context-menu/_variables.scss +9 -0
- package/src/components/wt-context-menu/wt-context-menu.vue +131 -0
- package/src/components/wt-copy-action/__tests__/WtCopyAction.spec.js +14 -0
- package/src/components/wt-copy-action/wt-copy-action.vue +63 -0
- package/src/components/wt-datepicker/__tests__/WtDatepicker.spec.js +28 -0
- package/src/components/wt-datepicker/_variables.scss +56 -0
- package/src/components/wt-datepicker/wt-datepicker.vue +240 -0
- package/src/components/wt-divider/__tests__/WtDivider.spec.js +9 -0
- package/src/components/wt-divider/_variables.scss +5 -0
- package/src/components/wt-divider/wt-divider.vue +30 -0
- package/src/components/wt-dummy/__tests__/WtDummy.spec.js +9 -0
- package/src/components/wt-dummy/wt-dummy.vue +73 -0
- package/src/components/wt-error-page/__tests__/wt-error-page.spec.js +17 -0
- package/src/components/wt-error-page/wt-error-page.vue +104 -0
- package/src/components/wt-expansion-panel/__tests__/WtExpansionPanel.spec.js +9 -0
- package/src/components/wt-expansion-panel/wt-expansion-panel.vue +67 -0
- package/src/components/wt-filters-panel-wrapper/__tests__/WtFiltersPanelWrapper.spec.js +24 -0
- package/src/components/wt-filters-panel-wrapper/wt-filters-panel-wrapper.vue +146 -0
- package/src/components/wt-headline/__tests__/WtHeadline.spec.js +47 -0
- package/src/components/wt-headline/_variables.scss +6 -0
- package/src/components/wt-headline/wt-headline.vue +50 -0
- package/src/components/wt-headline-nav/Readme.md +9 -0
- package/src/components/wt-headline-nav/__tests__/wt-headline-nav.spec.js +13 -0
- package/src/components/wt-headline-nav/_variables.scss +8 -0
- package/src/components/wt-headline-nav/wt-headline-nav.vue +97 -0
- package/src/components/wt-hint/__tests__/WtHint.spec.js +9 -0
- package/src/components/wt-hint/wt-hint.vue +27 -0
- package/src/components/wt-icon/Readme.md +327 -0
- package/src/components/wt-icon/__tests__/WtIcon.spec.js +24 -0
- package/src/components/wt-icon/_variables.scss +31 -0
- package/src/components/wt-icon/docs/cleanup-svg-fill-none.png +0 -0
- package/src/components/wt-icon/docs/cleanup-svg-fill.png +0 -0
- package/src/components/wt-icon/docs/cleanup-svg-viewbox-correct.png +0 -0
- package/src/components/wt-icon/docs/cleanup-svg-viewbox-incorrect.png +0 -0
- package/src/components/wt-icon/docs/cleanup-svg-width-height.png +0 -0
- package/src/components/wt-icon/docs/svg-icon-code-example.png +0 -0
- package/src/components/wt-icon/docs/svg-sprite-in-dom.png +0 -0
- package/src/components/wt-icon/wt-icon.vue +172 -0
- package/src/components/wt-icon-action/__tests__/WtIconAction.spec.js +9 -0
- package/src/components/wt-icon-action/_internals/__tests__/WtAddIconAction.spec.js +9 -0
- package/src/components/wt-icon-action/_internals/__tests__/WtDeleteIconAction.spec.js +9 -0
- package/src/components/wt-icon-action/_internals/__tests__/WtDownloadIconAction.spec.js +9 -0
- package/src/components/wt-icon-action/_internals/__tests__/WtEditIconAction.spec.js +9 -0
- package/src/components/wt-icon-action/_internals/__tests__/WtHistoryIconAction.spec.js +9 -0
- package/src/components/wt-icon-action/_internals/__tests__/WtRefreshIconAction.spec.js +9 -0
- package/src/components/wt-icon-action/_internals/wt-add-icon-action.vue +27 -0
- package/src/components/wt-icon-action/_internals/wt-delete-icon-action.vue +27 -0
- package/src/components/wt-icon-action/_internals/wt-download-icon-action.vue +27 -0
- package/src/components/wt-icon-action/_internals/wt-edit-icon-action.vue +27 -0
- package/src/components/wt-icon-action/_internals/wt-history-icon-action.vue +27 -0
- package/src/components/wt-icon-action/_internals/wt-refresh-icon-action.vue +27 -0
- package/src/components/wt-icon-action/wt-icon-action.vue +54 -0
- package/src/components/wt-icon-btn/Readme.md +10 -0
- package/src/components/wt-icon-btn/__tests__/WtIconBtn.spec.js +15 -0
- package/src/components/wt-icon-btn/_variables.scss +9 -0
- package/src/components/wt-icon-btn/wt-icon-btn.vue +47 -0
- package/src/components/wt-indicator/__tests__/WtIndicator.spec.js +29 -0
- package/src/components/wt-indicator/_variables.scss +22 -0
- package/src/components/wt-indicator/wt-indicator.vue +124 -0
- package/src/components/wt-input/__tests__/WtInput.spec.js +25 -0
- package/src/components/wt-input/_variables.scss +8 -0
- package/src/components/wt-input/wt-input.vue +343 -0
- package/src/components/wt-input-info/__tests__/WtInputInfo.spec.js +9 -0
- package/src/{css/components/atoms → components}/wt-input-info/_variables.scss +7 -6
- package/src/components/wt-input-info/wt-input-info.vue +40 -0
- package/src/components/wt-item-link/__tests__/WtItemLink.spec.js +9 -0
- package/src/components/wt-item-link/wt-item-link.vue +57 -0
- package/src/components/wt-label/__tests__/WtLabel.spec.js +9 -0
- package/src/{css/components/atoms → components}/wt-label/_variables.scss +3 -4
- package/src/components/wt-label/mixins/labelUsageMixin.js +21 -0
- package/src/components/wt-label/wt-label.vue +77 -0
- package/src/components/wt-load-bar/__tests__/WtLoadBar.spec.js +9 -0
- package/src/components/wt-load-bar/_variables.scss +6 -0
- package/src/components/wt-load-bar/wt-load-bar.vue +55 -0
- package/src/components/wt-loader/__tests__/WtLoader.spec.js +9 -0
- package/src/components/{atoms/wt-loader/wt-loader.vue → wt-loader/_internals/wt-loader--md.vue} +5 -6
- package/src/components/wt-loader/_internals/wt-loader--sm.vue +73 -0
- package/src/components/wt-loader/_variables.scss +8 -0
- package/src/components/wt-loader/wt-loader.vue +37 -0
- package/src/components/wt-navigation-bar/__tests__/WtNavigationBar.spec.js +68 -0
- package/src/components/wt-navigation-bar/_variables.scss +16 -0
- package/src/components/wt-navigation-bar/wt-navigation-bar.vue +282 -0
- package/src/components/wt-notification/__tests__/WtNotification.spec.js +21 -0
- package/src/components/wt-notification/_variables.scss +10 -0
- package/src/components/wt-notification/wt-notification.vue +86 -0
- package/src/components/wt-notifications-bar/__tests__/WtNotificationsBar.spec.js +50 -0
- package/src/components/wt-notifications-bar/_variables.scss +7 -0
- package/src/components/wt-notifications-bar/wt-notifications-bar.vue +78 -0
- package/src/components/wt-page-header/__tests__/wt-page-header.spec.js +9 -0
- package/src/components/wt-page-header/wt-page-header.vue +83 -0
- package/src/components/wt-page-wrapper/__tests__/WtPageWrapper.spec.js +33 -0
- package/src/components/wt-page-wrapper/_variables.scss +5 -0
- package/src/components/wt-page-wrapper/wt-page-wrapper.vue +58 -0
- package/src/components/wt-pagination/__tests__/WtPagination.spec.js +38 -0
- package/src/components/wt-pagination/_variables.scss +5 -0
- package/src/components/wt-pagination/wt-pagination.vue +148 -0
- package/src/components/wt-player/__tests__/WtPlayer.spec.js +9 -0
- package/src/components/wt-player/_variables.scss +8 -0
- package/src/components/wt-player/wt-player.vue +208 -0
- package/src/components/wt-popup/__tests__/WtPopup.spec.js +47 -0
- package/src/components/wt-popup/_variables.scss +20 -0
- package/src/components/wt-popup/wt-popup.vue +138 -0
- package/src/components/wt-progress-bar/__tests__/WtProgressBar.spec.js +17 -0
- package/src/components/wt-progress-bar/_variables.scss +11 -0
- package/src/components/wt-progress-bar/wt-progress-bar.vue +89 -0
- package/src/components/wt-radio/__tests__/WtRadio.spec.js +42 -0
- package/src/{css/components/molecules → components}/wt-radio/_variables.scss +6 -6
- package/src/components/wt-radio/wt-radio.vue +180 -0
- package/src/components/wt-rounded-action/Readme.md +68 -0
- package/src/components/wt-rounded-action/__tests__/WtRoundedAction.spec.js +9 -0
- package/src/components/wt-rounded-action/_variables.scss +14 -0
- package/src/components/wt-rounded-action/wt-rounded-action.vue +139 -0
- package/src/components/wt-search-bar/__tests__/WtSearchBar.spec.js +44 -0
- package/src/components/wt-search-bar/_variables.scss +8 -0
- package/src/components/wt-search-bar/wt-search-bar.vue +222 -0
- package/src/components/wt-select/__tests__/WtSelect.spec.js +27 -0
- package/src/components/wt-select/_multiselect.scss +198 -0
- package/src/components/wt-select/_variables.scss +14 -0
- package/src/components/wt-select/mixins/__tests__/multiselectMixin.spec.js +32 -0
- package/src/components/wt-select/mixins/multiselectMixin.js +151 -0
- package/src/components/wt-select/wt-select.vue +288 -0
- package/src/components/wt-slider/__tests__/WtSlider.spec.js +9 -0
- package/src/components/wt-slider/_variables.scss +15 -0
- package/src/components/wt-slider/wt-slider.vue +179 -0
- package/src/components/wt-status-select/__tests__/WtStatusSelect.spec.js +25 -0
- package/src/components/wt-status-select/_internals/StatusOptions.lookup.js +24 -0
- package/src/components/wt-status-select/_variables.scss +6 -0
- package/src/components/wt-status-select/wt-status-select.vue +134 -0
- package/src/components/wt-stepper/__tests__/WtStepper.spec.vue.js +18 -0
- package/src/components/wt-stepper/wt-stepper.vue +89 -0
- package/src/components/wt-switcher/__tests__/WtSwitcher.spec.js +31 -0
- package/src/components/wt-switcher/_variables.scss +17 -0
- package/src/components/wt-switcher/wt-switcher.vue +191 -0
- package/src/components/wt-table/__tests__/WtTable.spec.js +134 -0
- package/src/components/wt-table/_internals/getSortOrder.js +12 -0
- package/src/components/wt-table/_variables.scss +16 -0
- package/src/components/wt-table/wt-table.vue +269 -0
- package/src/components/wt-table-actions/__tests__/WtTableActions.spec.js +9 -0
- package/src/components/wt-table-actions/_variables.scss +5 -0
- package/src/components/wt-table-actions/wt-table-actions.vue +110 -0
- package/src/components/wt-table-column-select/__tests__/WtTableColumnSelect.spec.js +31 -0
- package/src/components/wt-table-column-select/wt-table-column-select.vue +178 -0
- package/src/components/wt-tabs/__tests__/WtTabs.spec.js +36 -0
- package/src/{css/components/molecules → components}/wt-tabs/_variables.scss +14 -14
- package/src/components/wt-tabs/wt-tabs.vue +125 -0
- package/src/components/wt-tags-input/__tests__/WtTagsInput.spec.js +42 -0
- package/src/components/wt-tags-input/_variables.scss +24 -0
- package/src/components/wt-tags-input/wt-tags-input.vue +226 -0
- package/src/components/wt-textarea/__tests__/WtTextarea.spec.js +46 -0
- package/src/components/wt-textarea/_variables.scss +5 -0
- package/src/components/wt-textarea/wt-textarea.vue +223 -0
- package/src/components/wt-time-input/__tests__/WtTimeInput.spec.js +25 -0
- package/src/components/wt-time-input/wt-time-input.vue +187 -0
- package/src/components/wt-timepicker/__tests__/WtTimepicker.spec.js +60 -0
- package/src/components/wt-timepicker/_variables.scss +5 -0
- package/src/components/wt-timepicker/wt-timepicker.vue +181 -0
- package/src/components/wt-tooltip/__tests__/WtTooltip.spec.js +30 -0
- package/src/components/wt-tooltip/_internals/useTooltipTriggerSubscriptions.js +68 -0
- package/src/components/wt-tooltip/_internals/wt-tooltip-floating.vue +48 -0
- package/src/components/wt-tooltip/_variables.scss +11 -0
- package/src/components/wt-tooltip/wt-tooltip.vue +150 -0
- package/src/composables/useCachedInterval/__tests__/useCachedInterval.spec.js +14 -0
- package/src/composables/useCachedInterval/useCachedInterval.js +21 -0
- package/src/composables/useDestroyableSortable/useDestroyableSortable.js +66 -0
- package/src/composables/useRepresentableAgentPauseCause/__tests__/useRepresentableAgentPauseCause.spec.js +83 -0
- package/src/composables/useRepresentableAgentPauseCause/useRepresentableAgentPauseCause.js +37 -0
- package/src/css/main.scss +72 -69
- package/src/css/styleguide/_styleguide.scss +9 -0
- package/src/css/styleguide/border-radius/_border-radius.scss +4 -0
- package/src/css/styleguide/colors/_colors.scss +180 -0
- package/src/css/styleguide/colors/_deprecated.scss +151 -0
- package/src/css/styleguide/colors/_palette.scss +358 -0
- package/src/css/styleguide/display-helpers/_display-helpers.scss +23 -0
- package/src/css/styleguide/elevations/_elevations.scss +13 -0
- package/src/css/styleguide/fonts/_fonts.scss +126 -0
- package/src/css/styleguide/placeholder/_placeholder.scss +49 -0
- package/src/css/styleguide/scroll.scss +43 -40
- package/src/css/styleguide/spacings/_spacings.scss +15 -0
- package/src/css/styleguide/transitions/_transitions.scss +1 -0
- package/src/css/styleguide/transitions/fade/_fade.scss +8 -0
- package/src/css/styleguide/typography/_typography.scss +113 -0
- package/src/css/styleguide/viewport-breakpoints/_viewport-breakpoints.scss +25 -0
- package/src/directives/clickaway/clickaway.js +3 -52
- package/src/directives/index.js +0 -5
- package/src/enums/AbstractUserStatus/AbstractUserStatus.enum.js +8 -0
- package/src/enums/AgentStatus/AgentStatus.enum.js +6 -0
- package/src/enums/WebitelApplications/AdminSections.enum.js +50 -0
- package/src/enums/WebitelApplications/AuditorSections.enum.js +5 -0
- package/src/enums/WebitelApplications/CrmSections.enum.js +5 -0
- package/src/enums/WebitelApplications/SupervisorSections.enum.js +7 -0
- package/src/enums/WebitelApplications/WebitelApplications.enum.js +11 -0
- package/src/locale/.DS_Store +0 -0
- package/src/locale/en/en.js +333 -0
- package/src/locale/es/es.js +282 -0
- package/src/locale/i18n.js +9 -5
- package/src/locale/ru/ru.js +334 -3
- package/src/locale/ua/ua.js +358 -0
- package/src/mixins/dataFilterMixins/__tests__/apiFilterMixin.spec.js +55 -0
- package/src/mixins/dataFilterMixins/__tests__/enumFilterMixin.spec.js +70 -0
- package/src/mixins/dataFilterMixins/__tests__/paginationFilterMixin.spec.js +85 -0
- package/src/mixins/dataFilterMixins/__tests__/sortFilterMixin.spec.js +57 -0
- package/src/mixins/dataFilterMixins/__tests__/urlControllerMixin.spec.js +48 -0
- package/src/mixins/dataFilterMixins/_urlControllerMixin/_urlControllerMixin.js +37 -0
- package/src/mixins/dataFilterMixins/apiFilterMixin.js +23 -0
- package/src/mixins/dataFilterMixins/baseFilterMixin/baseFilterMixin.js +29 -0
- package/src/mixins/dataFilterMixins/enumFilterMixin.js +30 -0
- package/src/mixins/dataFilterMixins/paginationFilterMixin.js +79 -0
- package/src/mixins/dataFilterMixins/sortFilterMixin.js +75 -0
- package/src/mixins/validationMixin/__tests__/validationMixin.spec.js +47 -0
- package/src/mixins/validationMixin/useValidation.js +41 -0
- package/src/mixins/validationMixin/validationMixin.js +26 -10
- package/src/modules/AgentStatusSelect/api/agent-status.js +24 -0
- package/src/modules/AgentStatusSelect/api/pause-cause.js +47 -0
- package/src/modules/AgentStatusSelect/components/__tests__/wt-cc-agent-status-select.spec.js +83 -0
- package/src/modules/AgentStatusSelect/components/__tests__/wt-cc-pause-cause-popup.spec.js +18 -0
- package/src/modules/AgentStatusSelect/components/_internals/wt-cc-pause-cause-popup.vue +122 -0
- package/src/modules/AgentStatusSelect/components/_internals/wt-cc-status-select-error-popup.vue +55 -0
- package/src/modules/AgentStatusSelect/components/wt-cc-agent-status-select.vue +107 -0
- package/src/modules/AuditForm/components/__tests__/audit-form-question-read-wrapper.spec.js +14 -0
- package/src/modules/AuditForm/components/__tests__/audit-form-question-write-wrapper.spec.js +60 -0
- package/src/modules/AuditForm/components/__tests__/audit-form-question.spec.js +14 -0
- package/src/modules/AuditForm/components/__tests__/audit-form.spec.js +70 -0
- package/src/modules/AuditForm/components/audit-form-question-read-wrapper.vue +132 -0
- package/src/modules/AuditForm/components/audit-form-question-write-wrapper.vue +154 -0
- package/src/modules/AuditForm/components/audit-form-question.vue +136 -0
- package/src/modules/AuditForm/components/audit-form.vue +183 -0
- package/src/modules/AuditForm/components/questions/options/__tests__/audit-form-question-options-write-row.spec.js +24 -0
- package/src/modules/AuditForm/components/questions/options/__tests__/audit-form-question-options.spec.js +45 -0
- package/src/modules/AuditForm/components/questions/options/audit-form-question-options-write-row.vue +89 -0
- package/src/modules/AuditForm/components/questions/options/audit-form-question-options.vue +97 -0
- package/src/modules/AuditForm/components/questions/score/__tests__/audit-form-question-score.spec.js +30 -0
- package/src/modules/AuditForm/components/questions/score/audit-form-question-score.vue +132 -0
- package/src/modules/AuditForm/schemas/AuditFormQuestionOptionsSchema.js +13 -0
- package/src/modules/AuditForm/schemas/AuditFormQuestionSchema.js +8 -0
- package/src/modules/AuditForm/schemas/AuditFormQuestionScoreSchema.js +8 -0
- package/src/modules/CSVExport/CSVExport.js +89 -0
- package/src/modules/CSVExport/__tests__/CSVExport.spec.js +63 -0
- package/src/modules/CSVExport/mixins/exportCSVMixin.js +46 -0
- package/src/modules/CardStoreModule/composables/useCardStore.js +55 -0
- package/src/modules/CardStoreModule/store/CardStoreModule.js +84 -0
- package/src/modules/DeleteConfirmationPopup/components/delete-confirmation-popup.vue +87 -0
- package/src/modules/DeleteConfirmationPopup/composables/useDeleteConfirmationPopup.js +28 -0
- package/src/modules/FilesExport/FilesExport.js +113 -0
- package/src/modules/FilesExport/__tests__/FilesExport.spec.js +66 -0
- package/src/modules/FilesExport/mixins/exportFilesMixin.js +46 -0
- package/src/modules/FilesExport/scripts/generateMediaURL.js +7 -0
- package/src/modules/Filters/classes/BaseFilterSchema.js +13 -0
- package/src/modules/Filters/components/filter-pagination.vue +61 -0
- package/src/modules/Filters/components/filter-table-fields.vue +61 -0
- package/src/modules/Filters/composables/useTableFilters.js +17 -0
- package/src/modules/Filters/restores/filterFieldsRestore.js +9 -0
- package/src/modules/Filters/restores/readme.md +1 -0
- package/src/modules/Filters/store/FiltersStoreModule.js +181 -0
- package/src/modules/Notifications/assets/audio/end-chat.wav +0 -0
- package/src/modules/Notifications/assets/audio/new-chat.wav +0 -0
- package/src/modules/Notifications/assets/audio/new-message.wav +0 -0
- package/src/modules/Notifications/assets/audio/ringing.mp3 +0 -0
- package/src/modules/Notifications/assets/img/notification-icon.png +0 -0
- package/src/modules/Notifications/store/NotificationsStoreModule.js +185 -0
- package/src/modules/Notifications/store/__tests__/NotificationsStoreModule.actions.spec.js +130 -0
- package/src/modules/Notifications/store/__tests__/NotificationsStoreModule.mutations.spec.js +49 -0
- package/src/modules/QueryFilters/api/__tests__/defaults.spec.js +18 -0
- package/src/modules/QueryFilters/api/defaults.js +16 -0
- package/src/modules/QueryFilters/classes/ApiFilterSchema.js +32 -0
- package/src/modules/QueryFilters/classes/BaseFilterSchema.js +6 -0
- package/src/modules/QueryFilters/classes/EnumFilterSchema.js +23 -0
- package/src/modules/QueryFilters/classes/__tests__/ApiFilterSchema.spec.js +25 -0
- package/src/modules/QueryFilters/components/__tests__/abstract-api-filter.spec.js +52 -0
- package/src/modules/QueryFilters/components/__tests__/abstract-enum-filter.spec.js +38 -0
- package/src/modules/QueryFilters/components/__tests__/filter-datetime.spec.js +49 -0
- package/src/modules/QueryFilters/components/__tests__/filter-from-to.spec.js +63 -0
- package/src/modules/QueryFilters/components/__tests__/filter-search.spec.js +47 -0
- package/src/modules/QueryFilters/components/abstract-api-filter.vue +42 -0
- package/src/modules/QueryFilters/components/abstract-enum-filter.vue +32 -0
- package/src/modules/QueryFilters/components/filter-datetime.vue +40 -0
- package/src/modules/QueryFilters/components/filter-from-to.vue +143 -0
- package/src/modules/QueryFilters/components/filter-search.vue +33 -0
- package/src/modules/QueryFilters/components/filter-table-fields.vue +101 -0
- package/src/modules/QueryFilters/mixins/__tests__/apiFilterMixin.spec.js +48 -0
- package/src/modules/QueryFilters/mixins/__tests__/enumFilterMixin.spec.js +68 -0
- package/src/modules/QueryFilters/mixins/__tests__/paginationFilterMixin.spec.js +79 -0
- package/src/modules/QueryFilters/mixins/__tests__/sortFilterMixin.spec.js +63 -0
- package/src/modules/QueryFilters/mixins/__tests__/urlControllerMixin.spec.js +46 -0
- package/src/modules/QueryFilters/mixins/_urlControllerMixin/_urlControllerMixin.js +39 -0
- package/src/modules/QueryFilters/mixins/apiFilterMixin.js +41 -0
- package/src/modules/QueryFilters/mixins/baseFilterMixin/baseFilterMixin.js +34 -0
- package/src/modules/QueryFilters/mixins/enumFilterMixin.js +51 -0
- package/src/modules/QueryFilters/mixins/paginationFilterMixin.js +76 -0
- package/src/modules/QueryFilters/mixins/sortFilterMixin.js +56 -0
- package/src/modules/QueryFilters/store/QueryFiltersStoreModule.js +61 -0
- package/src/modules/QueryFilters/store/__tests__/QueryFiltersStoreModule.spec.js +89 -0
- package/src/modules/QueryFilters/store/queryFilters.js +6 -0
- package/src/modules/TableStoreModule/composables/useTableStore.js +58 -0
- package/src/modules/TableStoreModule/store/TableStoreModule.js +207 -0
- package/src/modules/Userinfo/api/BaseAPIService.js +7 -0
- package/src/modules/Userinfo/api/auth.js +31 -0
- package/src/modules/Userinfo/api/userinfo.js +44 -0
- package/src/modules/Userinfo/classes/ApplicationsAccess.js +217 -0
- package/src/modules/Userinfo/components/__tests__/auth.spec.js +55 -0
- package/src/modules/Userinfo/components/the-auth.vue +76 -0
- package/src/modules/Userinfo/enums/Permissions.enum.js +7 -0
- package/src/modules/Userinfo/store/UserinfoStoreModule.js +153 -0
- package/src/plugins/breakpoint/breakpoint.plugin.js +137 -0
- package/src/scripts/__tests__/caseConverters.spec.js +81 -0
- package/src/scripts/__tests__/convertDuration.spec.js +21 -0
- package/src/scripts/__tests__/debounce.spec.js +14 -0
- package/src/scripts/__tests__/editProxy.spec.js +9 -0
- package/src/scripts/__tests__/isEmpty.spec.js +16 -0
- package/src/scripts/__tests__/prettifyFileSize.spec.js +18 -0
- package/src/scripts/__tests__/prettifyTime.spec.js +18 -0
- package/src/scripts/__tests__/preventHiddenPageCallsDecorator.spec.js +16 -0
- package/src/scripts/__tests__/sortQueryAdapters.spec.js +12 -0
- package/src/scripts/__tests__/updateObject.spec.js +19 -0
- package/src/scripts/caseConverters.js +89 -0
- package/src/scripts/convertDuration.js +15 -0
- package/src/scripts/debounce.js +3 -9
- package/src/scripts/editProxy.js +9 -0
- package/src/scripts/eventBus.js +8 -0
- package/src/scripts/isEmpty.js +9 -0
- package/src/scripts/prettifyFileSize.js +11 -0
- package/src/scripts/prettifyTime.js +9 -0
- package/src/scripts/preventHiddenPageCallsDecorator.js +6 -0
- package/src/scripts/sortQueryAdapters.js +21 -0
- package/src/scripts/updateObject.js +6 -0
- package/src/store/BaseStoreModules/ApiStoreModule.js +93 -0
- package/src/store/BaseStoreModules/BaseStoreModule.js +49 -0
- package/src/store/BaseStoreModules/__tests__/BaseStoreModule.spec.js +104 -0
- package/src/store/ReactiveNowStoreModule/ReactiveNowStoreModule.js +27 -0
- package/src/store/helpers/__tests__/getNamespacedState.spec.js +11 -0
- package/src/store/helpers/getNamespacedState.js +5 -0
- package/src/validators/decimalValidator.js +9 -0
- package/src/validators/domainValidator.js +5 -0
- package/.eslintrc.js +0 -34
- package/babel.config.js +0 -5
- package/dist/@webitel/ui-sdk.common.js +0 -11586
- package/dist/@webitel/ui-sdk.common.js.map +0 -1
- package/dist/@webitel/ui-sdk.css +0 -1
- package/dist/@webitel/ui-sdk.umd.js +0 -11596
- package/dist/@webitel/ui-sdk.umd.js.map +0 -1
- package/dist/@webitel/ui-sdk.umd.min.js +0 -2
- package/dist/@webitel/ui-sdk.umd.min.js.map +0 -1
- package/dist/fonts/Montserrat-Regular.ee653992.ttf +0 -0
- package/dist/fonts/Montserrat-SemiBold.c641dbee.ttf +0 -0
- package/dist/img/arrow-down--active--md.06c6b9a1.svg +0 -3
- package/dist/img/arrow-down--disabled--md.8dd31dcb.svg +0 -3
- package/dist/img/arrow-down--md.907c231e.svg +0 -3
- package/dist/img/calendar--active--md.b649abe2.svg +0 -6
- package/dist/img/calendar--disabled--md.ff268289.svg +0 -3
- package/dist/img/calendar--md.d0280382.svg +0 -6
- package/jest.config.js +0 -3
- package/package-lock.json +0 -15072
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -17
- package/src/assets/icons/arrow-down--active--md.svg +0 -3
- package/src/assets/icons/arrow-down--disabled--md.svg +0 -3
- package/src/assets/icons/arrow-down--md.svg +0 -3
- package/src/assets/icons/calendar--active--md.svg +0 -6
- package/src/assets/icons/calendar--disabled--md.svg +0 -3
- package/src/assets/icons/calendar--md.svg +0 -6
- package/src/components/atoms/wt-badge/wt-badge.vue +0 -15
- package/src/components/atoms/wt-button/wt-button.vue +0 -202
- package/src/components/atoms/wt-divider/wt-divider.vue +0 -24
- package/src/components/atoms/wt-icon/wt-icon.vue +0 -499
- package/src/components/atoms/wt-input-info/wt-input-info.vue +0 -34
- package/src/components/atoms/wt-label/wt-label.vue +0 -58
- package/src/components/atoms/wt-tooltip/wt-tooltip.vue +0 -54
- package/src/components/molecules/wt-checkbox/wt-checkbox.vue +0 -167
- package/src/components/molecules/wt-datepicker/wt-datepicker.vue +0 -200
- package/src/components/molecules/wt-datetimepicker/wt-datetimepicker.vue +0 -306
- package/src/components/molecules/wt-icon-btn/wt-icon-btn.vue +0 -69
- package/src/components/molecules/wt-input/wt-input.vue +0 -300
- package/src/components/molecules/wt-notification/wt-notification.vue +0 -74
- package/src/components/molecules/wt-popup/wt-popup.vue +0 -89
- package/src/components/molecules/wt-radio/wt-radio.vue +0 -168
- package/src/components/molecules/wt-search-bar/wt-search-bar.vue +0 -186
- package/src/components/molecules/wt-select/wt-select.vue +0 -394
- package/src/components/molecules/wt-switcher/wt-switcher.vue +0 -157
- package/src/components/molecules/wt-tabs/wt-tabs.vue +0 -125
- package/src/components/molecules/wt-textarea/wt-textarea.vue +0 -141
- package/src/components/molecules/wt-time-input/wt-time-input.vue +0 -141
- package/src/components/molecules/wt-timepicker/wt-timepicker.vue +0 -110
- package/src/components/organisms/wt-pagination/wt-pagination.vue +0 -122
- package/src/css/colors/_colors.scss +0 -67
- package/src/css/components/_components.scss +0 -25
- package/src/css/components/atoms/wt-badge/_variables.scss +0 -6
- package/src/css/components/atoms/wt-badge/wt-badge.scss +0 -8
- package/src/css/components/atoms/wt-button/_variables.scss +0 -47
- package/src/css/components/atoms/wt-divider/_variables.scss +0 -5
- package/src/css/components/atoms/wt-icon/_variables.scss +0 -29
- package/src/css/components/atoms/wt-loader/_variables.scss +0 -8
- package/src/css/components/atoms/wt-tooltip/_variables.scss +0 -10
- package/src/css/components/molecules/wt-checkbox/_variables.scss +0 -4
- package/src/css/components/molecules/wt-datepicker/_variables.scss +0 -20
- package/src/css/components/molecules/wt-datepicker/datepicker-calendar.scss +0 -100
- package/src/css/components/molecules/wt-datetimepicker/_variables.scss +0 -12
- package/src/css/components/molecules/wt-icon-btn/_variables.scss +0 -3
- package/src/css/components/molecules/wt-input/_variables.scss +0 -6
- package/src/css/components/molecules/wt-notification/_variables.scss +0 -10
- package/src/css/components/molecules/wt-popup/_variables.scss +0 -11
- package/src/css/components/molecules/wt-search-bar/_variables.scss +0 -4
- package/src/css/components/molecules/wt-select/_variables.scss +0 -23
- package/src/css/components/molecules/wt-switcher/_variables.scss +0 -14
- package/src/css/components/molecules/wt-textarea/_variables.scss +0 -5
- package/src/css/components/molecules/wt-timepicker/_variables.scss +0 -4
- package/src/css/components/organisms/wt-pagination/_variables.scss +0 -7
- package/src/css/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/src/css/fonts/Montserrat/Montserrat-SemiBold.ttf +0 -0
- package/src/css/fonts.scss +0 -9
- package/src/css/styleguide/styleguide.scss +0 -3
- package/src/css/typography/_typography.scss +0 -72
- package/src/install.js +0 -15
- package/src/main.js +0 -14
- package/src/playground.vue +0 -451
- package/src/the-app.vue +0 -20
- package/vue.config.js +0 -11
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<wt-popup
|
|
3
|
+
class="delete-confirmation-popup"
|
|
4
|
+
min-width="480"
|
|
5
|
+
@close="close"
|
|
6
|
+
>
|
|
7
|
+
<template v-slot:title>{{ $t('webitelUI.deleteConfirmationPopup.title') }}</template>
|
|
8
|
+
<template v-slot:main>
|
|
9
|
+
<p>
|
|
10
|
+
{{ deleteMessage }}
|
|
11
|
+
{{ $t('webitelUI.deleteConfirmationPopup.undoneActionAlert') }}
|
|
12
|
+
</p>
|
|
13
|
+
</template>
|
|
14
|
+
<template v-slot:actions>
|
|
15
|
+
<wt-button
|
|
16
|
+
color="secondary"
|
|
17
|
+
:disabled="isDeleting"
|
|
18
|
+
@click="close"
|
|
19
|
+
>{{ $t('reusable.cancel') }}
|
|
20
|
+
</wt-button>
|
|
21
|
+
<wt-button
|
|
22
|
+
color="danger"
|
|
23
|
+
:loading="isDeleting"
|
|
24
|
+
@click="confirm"
|
|
25
|
+
>{{ $t('reusable.delete') }}
|
|
26
|
+
</wt-button>
|
|
27
|
+
</template>
|
|
28
|
+
</wt-popup>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script setup>
|
|
32
|
+
import { computed, ref } from 'vue';
|
|
33
|
+
import { useI18n } from 'vue-i18n';
|
|
34
|
+
|
|
35
|
+
const props = defineProps({
|
|
36
|
+
deleteCount: {
|
|
37
|
+
type: Number,
|
|
38
|
+
required: true,
|
|
39
|
+
},
|
|
40
|
+
callback: {
|
|
41
|
+
type: Function,
|
|
42
|
+
required: true,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const emit = defineEmits([
|
|
47
|
+
'close',
|
|
48
|
+
]);
|
|
49
|
+
|
|
50
|
+
const { t } = useI18n();
|
|
51
|
+
|
|
52
|
+
const isDeleting = ref(false);
|
|
53
|
+
|
|
54
|
+
const deleteMessage = computed(() => {
|
|
55
|
+
if (props.deleteCount === 0) {
|
|
56
|
+
return t(
|
|
57
|
+
'webitelUI.deleteConfirmationPopup.askingAlert',
|
|
58
|
+
2,
|
|
59
|
+
null,
|
|
60
|
+
{ count: t('webitelUI.deleteConfirmationPopup.deleteAll') },
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
return t(
|
|
64
|
+
'webitelUI.deleteConfirmationPopup.askingAlert',
|
|
65
|
+
{ count: props.deleteCount },
|
|
66
|
+
null,
|
|
67
|
+
);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
function close() {
|
|
71
|
+
emit('close');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async function confirm() {
|
|
75
|
+
try {
|
|
76
|
+
isDeleting.value = true;
|
|
77
|
+
await props.callback();
|
|
78
|
+
close();
|
|
79
|
+
} finally {
|
|
80
|
+
isDeleting.value = false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
</script>
|
|
84
|
+
|
|
85
|
+
<style scoped>
|
|
86
|
+
|
|
87
|
+
</style>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ref } from 'vue';
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
4
|
+
export const useDeleteConfirmationPopup = () => {
|
|
5
|
+
const isVisible = ref(false);
|
|
6
|
+
const deleteCount = ref(null);
|
|
7
|
+
const deleteCallback = ref(null);
|
|
8
|
+
|
|
9
|
+
function askDeleteConfirmation({ deleted, callback }) {
|
|
10
|
+
if (Array.isArray(deleted)) deleteCount.value = deleted.length;
|
|
11
|
+
else deleteCount.value = 1;
|
|
12
|
+
isVisible.value = true;
|
|
13
|
+
deleteCallback.value = callback;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function closeDelete() {
|
|
17
|
+
isVisible.value = false;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
isVisible,
|
|
22
|
+
deleteCount,
|
|
23
|
+
deleteCallback,
|
|
24
|
+
|
|
25
|
+
askDeleteConfirmation,
|
|
26
|
+
closeDelete,
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import jszipUtils from 'jszip-utils';
|
|
2
|
+
import { saveAs } from 'file-saver';
|
|
3
|
+
import JSZip from 'jszip';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import generateMediaURL from './scripts/generateMediaURL';
|
|
6
|
+
|
|
7
|
+
/* eslint-disable no-await-in-loop, no-restricted-syntax */
|
|
8
|
+
export default class FilesExport {
|
|
9
|
+
filename = 'files';
|
|
10
|
+
|
|
11
|
+
fetchMethod = null;
|
|
12
|
+
|
|
13
|
+
isLoading = false;
|
|
14
|
+
|
|
15
|
+
downloadProgress = { count: 0 };
|
|
16
|
+
|
|
17
|
+
zippingProgress = { percent: 0 };
|
|
18
|
+
|
|
19
|
+
filesURL = generateMediaURL;
|
|
20
|
+
|
|
21
|
+
constructor({ fetchMethod, filename, filesURL }) {
|
|
22
|
+
if (fetchMethod) this.fetchMethod = fetchMethod;
|
|
23
|
+
if (filename) this.filename = filename;
|
|
24
|
+
if (filesURL) this.filesURL = filesURL;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
_fetchFileBinary(fileId) {
|
|
28
|
+
const url = this.filesURL(fileId);
|
|
29
|
+
return new Promise((resolve, reject) => (
|
|
30
|
+
jszipUtils.getBinaryContent(url, (err, data) => {
|
|
31
|
+
if (err) {
|
|
32
|
+
reject(err);
|
|
33
|
+
} else {
|
|
34
|
+
resolve(data);
|
|
35
|
+
}
|
|
36
|
+
})));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
resetProgress() {
|
|
40
|
+
this.downloadProgress = { count: 0 };
|
|
41
|
+
this.zippingProgress = { percent: 0 };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async _addFilesToZip(items, zip) {
|
|
45
|
+
for (const item of items) {
|
|
46
|
+
if (item.files) {
|
|
47
|
+
await this._addFilesToZip(item.files, zip);
|
|
48
|
+
} else {
|
|
49
|
+
const binary = await this._fetchFileBinary(item.id);
|
|
50
|
+
const ext = item.mimeType.split('/').pop();
|
|
51
|
+
// itemName needed to remove extension from item.name https://stackoverflow.com/a/31615711
|
|
52
|
+
const itemName = path.parse(item.name).name;
|
|
53
|
+
zip.file(`${itemName}.${ext}`, binary);
|
|
54
|
+
this.downloadProgress.count += 1;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async _generateZip(zip) {
|
|
60
|
+
try {
|
|
61
|
+
return await zip.generateAsync({ type: 'blob' }, (progress) => {
|
|
62
|
+
this.zippingProgress = progress;
|
|
63
|
+
});
|
|
64
|
+
} catch (err) {
|
|
65
|
+
throw new Error('Failed to generate zip file');
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async _saveZip(file) {
|
|
70
|
+
try {
|
|
71
|
+
saveAs(file, `${this.filename}.zip`);
|
|
72
|
+
} catch (err) {
|
|
73
|
+
throw new Error('Failed to save a file');
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
async _fetchAndZip(zip, requestParams) {
|
|
78
|
+
const params = {
|
|
79
|
+
from: 0,
|
|
80
|
+
size: 5000,
|
|
81
|
+
fields: ['files'],
|
|
82
|
+
...requestParams,
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
let page = 1;
|
|
86
|
+
let isNext = false;
|
|
87
|
+
do {
|
|
88
|
+
const { items, next } = await this.fetchMethod({ ...params, page });
|
|
89
|
+
await this._addFilesToZip(items, zip);
|
|
90
|
+
|
|
91
|
+
isNext = next;
|
|
92
|
+
page += 1;
|
|
93
|
+
} while (isNext);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
async exportFiles(files, { reqParams }) {
|
|
97
|
+
try {
|
|
98
|
+
this.isLoading = true;
|
|
99
|
+
const zip = new JSZip();
|
|
100
|
+
if (files && files.length) await this._addFilesToZip(files, zip);
|
|
101
|
+
else {
|
|
102
|
+
await this._fetchAndZip(zip, reqParams);
|
|
103
|
+
}
|
|
104
|
+
const file = await this._generateZip(zip);
|
|
105
|
+
await this._saveZip(file);
|
|
106
|
+
this.resetProgress();
|
|
107
|
+
} catch (err) {
|
|
108
|
+
throw err;
|
|
109
|
+
} finally {
|
|
110
|
+
this.isLoading = false;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -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 || import.meta.env.VITE_API_URL;
|
|
4
|
+
return `${BASE_URL}/storage/recordings/${id}/stream?access_token=${token}`;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export default generateMediaURL;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export default class BaseFilterSchema {
|
|
2
|
+
constructor({
|
|
3
|
+
value = '',
|
|
4
|
+
defaultValue = '',
|
|
5
|
+
restore,
|
|
6
|
+
localStorageKey,
|
|
7
|
+
} = {}) {
|
|
8
|
+
this.value = value;
|
|
9
|
+
this.defaultValue = defaultValue;
|
|
10
|
+
if (restore) this.restore = restore;
|
|
11
|
+
if (localStorageKey) this.localStorageKey = localStorageKey;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<wt-pagination
|
|
3
|
+
:next="isNext"
|
|
4
|
+
:prev="page > 1"
|
|
5
|
+
:size="localSize"
|
|
6
|
+
debounce
|
|
7
|
+
@input="localSize = $event"
|
|
8
|
+
@change="setSize(localSize)"
|
|
9
|
+
@next="setPage(+page + 1)"
|
|
10
|
+
@prev="setPage(page - 1)"
|
|
11
|
+
></wt-pagination>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script setup>
|
|
15
|
+
import { computed, ref, watch } from 'vue';
|
|
16
|
+
import { useStore } from 'vuex';
|
|
17
|
+
import getNamespacedState from '../../../store/helpers/getNamespacedState';
|
|
18
|
+
|
|
19
|
+
const props = defineProps({
|
|
20
|
+
namespace: {
|
|
21
|
+
type: String,
|
|
22
|
+
required: true,
|
|
23
|
+
},
|
|
24
|
+
isNext: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: false,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const pageFilterName = 'page';
|
|
31
|
+
const sizeFilterName = 'size';
|
|
32
|
+
|
|
33
|
+
const store = useStore();
|
|
34
|
+
|
|
35
|
+
const localSize = ref(0);
|
|
36
|
+
|
|
37
|
+
const page = computed(() => getNamespacedState(store.state, props.namespace)[pageFilterName].value);
|
|
38
|
+
const size = computed(() => getNamespacedState(store.state, props.namespace)[sizeFilterName].value);
|
|
39
|
+
|
|
40
|
+
function setFilter(payload) {
|
|
41
|
+
return store.dispatch(`${props.namespace}/SET_FILTER`, payload);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function setPage(value) {
|
|
45
|
+
return setFilter({ value, filter: pageFilterName });
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function setSize(value) {
|
|
49
|
+
if (value === size.value) return;
|
|
50
|
+
// eslint-disable-next-line consistent-return
|
|
51
|
+
return setFilter({ value, filter: sizeFilterName });
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
watch(size, () => {
|
|
55
|
+
localSize.value = size.value;
|
|
56
|
+
}, { immediate: true });
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<style lang="scss" scoped>
|
|
60
|
+
|
|
61
|
+
</style>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<wt-table-column-select
|
|
3
|
+
:headers="headers"
|
|
4
|
+
:static-headers="staticHeaders"
|
|
5
|
+
@change="handleChange"
|
|
6
|
+
></wt-table-column-select>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script setup>
|
|
10
|
+
import { computed } from 'vue';
|
|
11
|
+
import { useStore } from 'vuex';
|
|
12
|
+
import getNamespacedState from '../../../store/helpers/getNamespacedState';
|
|
13
|
+
|
|
14
|
+
const props = defineProps({
|
|
15
|
+
namespace: {
|
|
16
|
+
type: String,
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
headers: {
|
|
20
|
+
type: Array,
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
staticHeaders: {
|
|
24
|
+
type: Array,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const emit = defineEmits(
|
|
29
|
+
'change',
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
// const storedProp = 'value';
|
|
33
|
+
const filterQuery = 'fields';
|
|
34
|
+
|
|
35
|
+
const store = useStore();
|
|
36
|
+
|
|
37
|
+
const filterSchema = computed(() => getNamespacedState(store.state, props.namespace)[filterQuery]);
|
|
38
|
+
|
|
39
|
+
function setValue(payload) {
|
|
40
|
+
return store.dispatch(`${props.namespace}/SET_FILTER`, payload);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function setToLocalStorage({ value }) {
|
|
44
|
+
localStorage.setItem(filterSchema.value.localStorageKey, value);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function handleChange(headers) {
|
|
48
|
+
const value = headers.filter((item) => item.show).map(({ value }) => value);
|
|
49
|
+
const params = {
|
|
50
|
+
filter: filterQuery,
|
|
51
|
+
value,
|
|
52
|
+
};
|
|
53
|
+
setToLocalStorage(params);
|
|
54
|
+
setValue(params);
|
|
55
|
+
emit('change', headers);
|
|
56
|
+
}
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<style scoped>
|
|
60
|
+
|
|
61
|
+
</style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useStore } from 'vuex';
|
|
2
|
+
|
|
3
|
+
export const useTableFilters = (namespace) => {
|
|
4
|
+
const store = useStore();
|
|
5
|
+
|
|
6
|
+
const filtersNamespace = `${namespace}/filters`;
|
|
7
|
+
|
|
8
|
+
function restoreFilters(payload) {
|
|
9
|
+
return store.dispatch(`${filtersNamespace}/RESTORE_FILTERS`, payload);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
restoreFilters();
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
filtersNamespace,
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"restore" functions for filters
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import deepEqual from 'deep-equal';
|
|
2
|
+
import debounce from '../../../scripts/debounce';
|
|
3
|
+
import isEmpty from '../../../scripts/isEmpty';
|
|
4
|
+
import BaseStoreModule from '../../../store/BaseStoreModules/BaseStoreModule';
|
|
5
|
+
|
|
6
|
+
const SET_FILTER_SOURCE = Object.freeze({
|
|
7
|
+
RESTORE: 'restore', // when filter is restored at session start
|
|
8
|
+
DEFAULT: 'default',
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export default class FiltersStoreModule extends BaseStoreModule {
|
|
12
|
+
getters = {
|
|
13
|
+
ROUTER: () => console.error('setup ROUTER getter for filters store'),
|
|
14
|
+
TABLE_NAMESPACE: () => console.error('setup TABLE_NAMESPACE getter for filters store'),
|
|
15
|
+
|
|
16
|
+
// get value of specific filter
|
|
17
|
+
GET_FILTER: (state) => (filter) => {
|
|
18
|
+
if (!state[filter]) return null;
|
|
19
|
+
const { value, storedProp, multiple } = state[filter];
|
|
20
|
+
if (multiple) return value.map((item) => item[storedProp]); // if arr, map
|
|
21
|
+
if (storedProp) return value[storedProp]; // if object and has specific prop, return this prop
|
|
22
|
+
return value; // else return val
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
// get all filters values
|
|
26
|
+
GET_FILTERS: (state, getters) => Object.keys(state)
|
|
27
|
+
.reduce((filters, filterKey) => {
|
|
28
|
+
const filterValue = getters.GET_FILTER(filterKey);
|
|
29
|
+
return isEmpty(filterValue) ? filters : {
|
|
30
|
+
...filters,
|
|
31
|
+
[filterKey]: filterValue,
|
|
32
|
+
};
|
|
33
|
+
}, {}),
|
|
34
|
+
|
|
35
|
+
// get value of filter from query string by query key
|
|
36
|
+
GET_VALUE_FROM_QUERY: (state, getters) => ({ filterQuery }) => (
|
|
37
|
+
getters.ROUTER.currentRoute.value.query[filterQuery]
|
|
38
|
+
),
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
actions = {
|
|
42
|
+
SET_FILTER: async (context, {
|
|
43
|
+
filter,
|
|
44
|
+
value,
|
|
45
|
+
source = SET_FILTER_SOURCE.DEFAULT,
|
|
46
|
+
silent = false, // if true, don't call ON_FILTER_SET event
|
|
47
|
+
}) => {
|
|
48
|
+
const { multiple, defaultValue } = context.state[filter];
|
|
49
|
+
|
|
50
|
+
let newValue = value;
|
|
51
|
+
|
|
52
|
+
if (value) {
|
|
53
|
+
if (multiple && !Array.isArray(value)) newValue = [value];
|
|
54
|
+
} else if (value === null || value === undefined) {
|
|
55
|
+
newValue = defaultValue;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
await context.dispatch('SET_VALUE_TO_QUERY', {
|
|
59
|
+
filterQuery: filter,
|
|
60
|
+
value,
|
|
61
|
+
storedProp: context.state[filter].storedProp,
|
|
62
|
+
});
|
|
63
|
+
context.commit('SET_FILTER', { filter, value: newValue });
|
|
64
|
+
|
|
65
|
+
if (source !== SET_FILTER_SOURCE.RESTORE && filter !== 'page') {
|
|
66
|
+
await context.dispatch('SET_FILTER', {
|
|
67
|
+
filter: 'page',
|
|
68
|
+
value: 1,
|
|
69
|
+
silent: true,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (!silent) await context.dispatch('ON_FILTER_SET', { filter, value });
|
|
74
|
+
},
|
|
75
|
+
SET_VALUE_TO_QUERY: async (
|
|
76
|
+
context,
|
|
77
|
+
{ filterQuery, value, storedProp = 'id' },
|
|
78
|
+
) => {
|
|
79
|
+
let newValue = '';
|
|
80
|
+
if (Array.isArray(value)) {
|
|
81
|
+
if (value.length && typeof value[0] !== 'object') {
|
|
82
|
+
newValue = value;
|
|
83
|
+
} else {
|
|
84
|
+
newValue = value.map((item) => item[storedProp]);
|
|
85
|
+
}
|
|
86
|
+
} else if (typeof value === 'object' && value !== null) {
|
|
87
|
+
newValue = value[storedProp];
|
|
88
|
+
} else {
|
|
89
|
+
newValue = value;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return context.dispatch('CHANGE_ROUTE_QUERY', ({
|
|
93
|
+
value: newValue,
|
|
94
|
+
filterQuery,
|
|
95
|
+
}));
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
CHANGE_ROUTE_QUERY: (context, { value, filterQuery }) => {
|
|
99
|
+
if (deepEqual(context.getters.GET_VALUE_FROM_QUERY({ filterQuery }), value)) return;
|
|
100
|
+
const query = { ...context.getters.ROUTER.currentRoute.value.query };
|
|
101
|
+
query[filterQuery] = value;
|
|
102
|
+
// eslint-disable-next-line consistent-return
|
|
103
|
+
return context.getters.ROUTER.replace({
|
|
104
|
+
name: context.getters.ROUTER.currentRoute.value.name,
|
|
105
|
+
query,
|
|
106
|
+
});
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
RESTORE_FILTER: async (context, { filter }) => {
|
|
110
|
+
const query = context.getters.GET_VALUE_FROM_QUERY({ filterQuery: filter });
|
|
111
|
+
// note: restore fn may still return value even if there's no query value
|
|
112
|
+
// from localStorage, for instance
|
|
113
|
+
const value = context.state[filter].restore
|
|
114
|
+
? context.state[filter].restore({ query })
|
|
115
|
+
: query;
|
|
116
|
+
if (value) {
|
|
117
|
+
if (filter
|
|
118
|
+
=== 'sort') await context.dispatch('RESTORE_SORT', { value });
|
|
119
|
+
else if (filter
|
|
120
|
+
=== 'fields') await context.dispatch('RESTORE_FIELDS', { value });
|
|
121
|
+
await context.dispatch('SET_FILTER', ({
|
|
122
|
+
filter,
|
|
123
|
+
value,
|
|
124
|
+
source: SET_FILTER_SOURCE.RESTORE,
|
|
125
|
+
}));
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
return false;
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
RESTORE_FILTERS: async (context) => {
|
|
132
|
+
const restores = [];
|
|
133
|
+
for (const filter of Object.keys(context.state)) {
|
|
134
|
+
// collect restores in order to check if there were actually any restores
|
|
135
|
+
// empty restore returns "false"
|
|
136
|
+
const result = await context.dispatch('RESTORE_FILTER', { filter });
|
|
137
|
+
restores.push(result);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// if no filters to restore, call LOAD_LIST manually
|
|
141
|
+
if (restores.every((restore) => restore === false)) {
|
|
142
|
+
context.dispatch('LOAD_DATA_LIST');
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
RESET_FILTERS: (context) => Promise.allSettled(Object.keys(context.state)
|
|
147
|
+
.map((filter) => {
|
|
148
|
+
return context.dispatch('SET_FILTER', {
|
|
149
|
+
filter,
|
|
150
|
+
value: context.state[filter].defaultValue,
|
|
151
|
+
});
|
|
152
|
+
})),
|
|
153
|
+
|
|
154
|
+
ON_FILTER_SET: (
|
|
155
|
+
context,
|
|
156
|
+
{ filter, value },
|
|
157
|
+
) => context.dispatch('LOAD_DATA_LIST'),
|
|
158
|
+
|
|
159
|
+
LOAD_DATA_LIST: (context) => context.dispatch(
|
|
160
|
+
`${context.getters.TABLE_NAMESPACE}/LOAD_DATA_LIST`,
|
|
161
|
+
{ filters: context.getters.GET_FILTERS },
|
|
162
|
+
{ root: true },
|
|
163
|
+
),
|
|
164
|
+
RESTORE_SORT: (context, { value }) => context.dispatch(
|
|
165
|
+
`${context.getters.TABLE_NAMESPACE}/RESTORE_SORT_FROM_FILTER`,
|
|
166
|
+
{ value },
|
|
167
|
+
{ root: true },
|
|
168
|
+
),
|
|
169
|
+
RESTORE_FIELDS: (context, { value }) => context.dispatch(
|
|
170
|
+
`${context.getters.TABLE_NAMESPACE}/RESTORE_FIELDS_FROM_FILTER`,
|
|
171
|
+
{ value },
|
|
172
|
+
{ root: true },
|
|
173
|
+
),
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
mutations = {
|
|
177
|
+
SET_FILTER: (state, { filter, value }) => {
|
|
178
|
+
state[filter].value = value;
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
}
|