@webitel/ui-sdk 24.10.3 → 24.10.5
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/dist/ui-sdk.css +1 -1
- package/dist/ui-sdk.js +111 -114
- package/dist/ui-sdk.umd.cjs +8 -8
- package/package.json +6 -4
- package/src/api/axios/generateInstance.js +1 -4
- package/src/api/clients/agents/agents.js +31 -78
- package/src/api/clients/buckets/buckets.js +17 -57
- package/src/api/clients/calendars/calendars.js +18 -71
- package/src/api/clients/chatGateways/chatGateways.js +23 -61
- package/src/api/clients/chatGateways/defaults/webChatGateway.js +6 -8
- package/src/api/clients/chatGateways/enums/WebchatAlternativeChannel.enum.js +3 -3
- package/src/api/clients/communications/communications.js +20 -62
- package/src/api/clients/configurations/configurations.js +18 -3
- package/src/api/clients/flows/flow.js +17 -60
- package/src/api/clients/gateways/gateways.js +20 -59
- package/src/api/clients/index.js +1 -1
- package/src/api/clients/lists/blacklists.js +18 -60
- package/src/api/clients/media/media.js +13 -43
- package/src/api/clients/queues/defaults/processing.js +10 -6
- package/src/api/clients/queues/queues.js +21 -69
- package/src/api/clients/roles/roles.js +15 -33
- package/src/api/clients/users/__tests__/users.spec.js +43 -26
- package/src/api/clients/users/users.js +21 -56
- package/src/api/crm/contactChatMessagesHistory.js +8 -23
- package/src/api/crm/contacts.js +235 -0
- package/src/api/crm/enums/ContactsSearchMode.js +9 -0
- package/src/api/crm/index.js +2 -3
- package/src/api/defaults/getDefaultGetParams/getDefaultGetParams.js +1 -4
- package/src/api/defaults/getDefaultInstance/getDefaultInstance.js +10 -11
- package/src/api/defaults/getDefaultOpenAPIConfig/getDefaultOpenAPIConfig.js +6 -5
- package/src/api/defaults/index.js +2 -4
- package/src/api/history/index.js +1 -3
- package/src/api/history/transcript/callTranscript.js +10 -30
- package/src/api/interceptors/request/updateToken.interceptor.js +1 -2
- package/src/api/transformers/merge/merge.transformer.js +4 -1
- package/src/api/transformers/mergeEach/mergeEach.transformer.js +4 -4
- package/src/api/transformers/notify/notify.transformer.js +9 -6
- package/src/api/transformers/starToSearch/starToSearch.transformer.js +8 -6
- package/src/components/index.js +3 -6
- package/src/components/on-demand/wt-cc-agent-status-timers/__tests__/wt-cc-agent-status-timers.spec.js +2 -4
- package/src/components/transitions/wt-expand-transition.vue +2 -3
- package/src/components/wt-app-header/__tests__/WtAppNavigator.spec.js +1 -2
- package/src/components/wt-app-header/__tests__/WtHeaderActions.spec.js +1 -2
- package/src/components/wt-app-header/wt-app-navigator.vue +15 -9
- package/src/components/wt-avatar/wt-avatar.vue +8 -3
- package/src/components/wt-button/wt-button.vue +0 -1
- package/src/components/wt-button-select/__tests__/WtButtonSelect.spec.js +4 -5
- package/src/components/wt-button-select/wt-button-select.vue +0 -1
- package/src/components/wt-context-menu/wt-context-menu.vue +32 -35
- package/src/components/wt-dummy/wt-dummy.vue +2 -5
- package/src/components/wt-expansion-panel/wt-expansion-panel.vue +10 -7
- package/src/components/wt-filters-panel-wrapper/__tests__/WtFiltersPanelWrapper.spec.js +4 -8
- package/src/components/wt-icon/wt-icon.vue +0 -1
- package/src/components/wt-indicator/__tests__/WtIndicator.spec.js +3 -2
- package/src/components/wt-indicator/wt-indicator.vue +10 -1
- package/src/components/wt-input/wt-input.vue +7 -10
- package/src/components/wt-item-link/wt-item-link.vue +7 -4
- package/src/components/wt-navigation-bar/__tests__/WtNavigationBar.spec.js +7 -15
- package/src/components/wt-navigation-bar/wt-navigation-bar.vue +7 -7
- package/src/components/wt-notification/wt-notification.vue +1 -2
- package/src/components/wt-notifications-bar/__tests__/WtNotificationsBar.spec.js +6 -3
- package/src/components/wt-notifications-bar/wt-notifications-bar.vue +4 -1
- package/src/components/wt-page-wrapper/__tests__/WtPageWrapper.spec.js +1 -2
- package/src/components/wt-pagination/wt-pagination.vue +1 -3
- package/src/components/wt-player/scripts/__tests__/createPlyrURL.spec.js +4 -8
- package/src/components/wt-player/wt-player.vue +13 -4
- package/src/components/wt-popup/wt-popup.vue +2 -1
- package/src/components/wt-search-bar/wt-search-bar.vue +1 -1
- package/src/components/wt-select/mixins/multiselectMixin.js +2 -5
- package/src/components/wt-select/wt-select.vue +12 -11
- package/src/components/wt-slider/wt-slider.vue +4 -2
- package/src/components/wt-status-select/wt-status-select.vue +10 -6
- package/src/components/wt-stepper/wt-stepper.vue +6 -4
- package/src/components/wt-switcher/wt-switcher.vue +1 -3
- package/src/components/wt-table/__tests__/WtTable.spec.js +2 -5
- package/src/components/wt-table/wt-table.vue +18 -16
- package/src/components/wt-table-column-select/wt-table-column-select.vue +9 -8
- package/src/components/wt-tabs/wt-tabs.vue +1 -3
- package/src/components/wt-tags-input/mixin/taggableMixin.js +7 -7
- package/src/components/wt-textarea/__tests__/WtTextarea.spec.js +2 -4
- package/src/components/wt-textarea/wt-textarea.vue +3 -2
- package/src/components/wt-timepicker/wt-timepicker.vue +1 -3
- package/src/components/wt-tooltip/_internals/useTooltipTriggerSubscriptions.js +1 -3
- package/src/components/wt-tooltip/_internals/wt-tooltip-floating.vue +8 -12
- package/src/components/wt-tooltip/wt-tooltip.vue +13 -13
- package/src/composables/useCachedInterval/__tests__/useCachedInterval.spec.js +6 -4
- package/src/composables/useCachedInterval/useCachedInterval.js +3 -8
- package/src/composables/useRepresentableAgentPauseCause/__tests__/useRepresentableAgentPauseCause.spec.js +11 -33
- package/src/composables/useRepresentableAgentPauseCause/useRepresentableAgentPauseCause.js +11 -9
- package/src/enums/WebitelApplications/AdminSections.enum.js +28 -28
- package/src/enums/WebitelApplications/CrmSections.enum.js +1 -1
- package/src/locale/en/en.js +12 -15
- package/src/locale/es/es.js +4 -8
- package/src/locale/kz/kz.js +5 -7
- package/src/locale/ru/ru.js +7 -11
- package/src/locale/ua/ua.js +13 -17
- package/src/mixins/dataFilterMixins/__tests__/enumFilterMixin.spec.js +1 -2
- package/src/mixins/dataFilterMixins/__tests__/sortFilterMixin.spec.js +4 -2
- package/src/mixins/dataFilterMixins/__tests__/urlControllerMixin.spec.js +4 -1
- package/src/mixins/dataFilterMixins/_urlControllerMixin/_urlControllerMixin.js +1 -1
- package/src/mixins/dataFilterMixins/apiFilterMixin.js +1 -2
- package/src/mixins/dataFilterMixins/baseFilterMixin/baseFilterMixin.js +1 -2
- package/src/mixins/dataFilterMixins/enumFilterMixin.js +5 -6
- package/src/mixins/dataFilterMixins/paginationFilterMixin.js +1 -2
- package/src/mixins/dataFilterMixins/sortFilterMixin.js +1 -4
- package/src/mixins/validationMixin/__tests__/validationMixin.spec.js +1 -2
- package/src/mixins/validationMixin/useValidation.js +25 -19
- package/src/mixins/validationMixin/validationMixin.js +22 -10
- package/src/modules/AgentStatusSelect/api/pause-cause.js +3 -11
- package/src/modules/AgentStatusSelect/components/__tests__/wt-cc-agent-status-select.spec.js +16 -18
- package/src/modules/AgentStatusSelect/components/__tests__/wt-cc-pause-cause-popup.spec.js +1 -2
- package/src/modules/AgentStatusSelect/components/_internals/wt-cc-pause-cause-popup.vue +12 -12
- package/src/modules/AgentStatusSelect/components/_internals/wt-cc-status-select-error-popup.vue +0 -1
- package/src/modules/AgentStatusSelect/components/wt-cc-agent-status-select.vue +20 -7
- package/src/modules/Appearance/components/__tests__/wt-dark-mode-switcher.spec.js +2 -4
- package/src/modules/Appearance/components/wt-dark-mode-switcher.vue +0 -1
- package/src/modules/AuditForm/components/__tests__/audit-form-question-read-wrapper.spec.js +1 -2
- package/src/modules/AuditForm/components/__tests__/audit-form-question-write-wrapper.spec.js +15 -25
- package/src/modules/AuditForm/components/__tests__/audit-form.spec.js +11 -20
- package/src/modules/AuditForm/components/audit-form-question-read-wrapper.vue +1 -4
- package/src/modules/AuditForm/components/audit-form-question-write-wrapper.vue +4 -7
- package/src/modules/AuditForm/components/audit-form-question.vue +18 -17
- package/src/modules/AuditForm/components/audit-form.vue +12 -14
- package/src/modules/AuditForm/components/questions/options/__tests__/audit-form-question-options-write-row.spec.js +1 -2
- package/src/modules/AuditForm/components/questions/options/__tests__/audit-form-question-options.spec.js +1 -3
- package/src/modules/AuditForm/components/questions/options/audit-form-question-options-write-row.vue +11 -15
- package/src/modules/AuditForm/components/questions/options/audit-form-question-options.vue +1 -4
- package/src/modules/AuditForm/components/questions/score/audit-form-question-score.vue +16 -20
- package/src/modules/AuditForm/schemas/AuditFormQuestionOptionsSchema.js +1 -3
- package/src/modules/CSVExport/CSVExport.js +3 -7
- package/src/modules/CSVExport/XLSExport.js +6 -7
- package/src/modules/CSVExport/__tests__/CSVExport.spec.js +1 -2
- package/src/modules/CSVExport/mixins/exportCSVMixin.js +2 -5
- package/src/modules/CSVExport/mixins/exportXLSMixin.js +2 -4
- package/src/modules/CardStoreModule/store/CardStoreModule.js +2 -6
- package/src/modules/DeleteConfirmationPopup/__tests__/delete-confirmation-popup.spec.js +13 -10
- package/src/modules/DeleteConfirmationPopup/components/delete-confirmation-popup.vue +5 -14
- package/src/modules/FilesExport/FilesExport.js +4 -3
- package/src/modules/FilesExport/__tests__/FilesExport.spec.js +12 -12
- package/src/modules/FilesExport/mixins/exportFilesMixin.js +6 -7
- package/src/modules/FilesExport/scripts/generateMediaURL.js +1 -2
- package/src/modules/Filters/classes/BaseFilterSchema.js +21 -25
- package/src/modules/Filters/components/filter-pagination.vue +7 -3
- package/src/modules/Filters/components/filter-search.vue +21 -12
- package/src/modules/Filters/components/filter-table-fields.vue +1 -3
- package/src/modules/Filters/scripts/getters/index.js +1 -5
- package/src/modules/Filters/scripts/getters/queryGetter.js +2 -3
- package/src/modules/Filters/scripts/restores/index.js +1 -4
- package/src/modules/Filters/scripts/setters/index.js +1 -5
- package/src/modules/Filters/scripts/setters/querySetter.js +24 -22
- package/src/modules/Filters/scripts/utils/changeRouteQuery.js +16 -15
- package/src/modules/Filters/store/FiltersStoreModule.js +51 -45
- package/src/modules/Filters/store/__tests__/FiltersStoreModule.spec.js +51 -45
- package/src/modules/Notifications/store/NotificationsStoreModule.js +41 -38
- package/src/modules/Notifications/store/__tests__/NotificationsStoreModule.actions.spec.js +6 -6
- package/src/modules/QueryFilters/api/defaults.js +2 -3
- package/src/modules/QueryFilters/classes/ApiFilterSchema.js +1 -4
- package/src/modules/QueryFilters/classes/EnumFilterSchema.js +1 -4
- package/src/modules/QueryFilters/components/__tests__/filter-datetime.spec.js +1 -2
- package/src/modules/QueryFilters/components/__tests__/filter-from-to.spec.js +2 -4
- package/src/modules/QueryFilters/components/__tests__/filter-search.spec.js +2 -4
- package/src/modules/QueryFilters/components/filter-table-fields.vue +1 -5
- package/src/modules/QueryFilters/mixins/__tests__/apiFilterMixin.spec.js +4 -3
- package/src/modules/QueryFilters/mixins/__tests__/enumFilterMixin.spec.js +2 -4
- package/src/modules/QueryFilters/mixins/__tests__/sortFilterMixin.spec.js +4 -2
- package/src/modules/QueryFilters/mixins/__tests__/urlControllerMixin.spec.js +4 -1
- package/src/modules/QueryFilters/mixins/_urlControllerMixin/_urlControllerMixin.js +1 -1
- package/src/modules/QueryFilters/mixins/apiFilterMixin.js +1 -1
- package/src/modules/QueryFilters/mixins/baseFilterMixin/baseFilterMixin.js +4 -2
- package/src/modules/QueryFilters/mixins/enumFilterMixin.js +9 -11
- package/src/modules/QueryFilters/mixins/paginationFilterMixin.js +2 -4
- package/src/modules/QueryFilters/mixins/sortFilterMixin.js +2 -5
- package/src/modules/QueryFilters/store/QueryFiltersStoreModule.js +13 -17
- package/src/modules/QueryFilters/store/__tests__/QueryFiltersStoreModule.spec.js +15 -16
- package/src/modules/TableStoreModule/store/TableStoreModule.js +14 -33
- package/src/modules/TableStoreModule/store/__tests__/TableStoreModule.spec.js +69 -83
- package/src/modules/Userinfo/api/userinfo.js +6 -19
- package/src/modules/Userinfo/classes/ApplicationsAccess.js +5 -12
- package/src/modules/Userinfo/store/UserinfoStoreModule.js +38 -41
- package/src/plugins/breakpoint/breakpoint.plugin.js +11 -16
- package/src/scripts/__tests__/caseConverters.spec.js +1 -4
- package/src/scripts/__tests__/debounce.spec.js +3 -1
- package/src/scripts/__tests__/prettifyFileSize.spec.js +2 -2
- package/src/scripts/__tests__/preventHiddenPageCallsDecorator.spec.js +7 -4
- package/src/scripts/__tests__/updateObject.spec.js +3 -5
- package/src/scripts/caseConverters.js +22 -38
- package/src/scripts/debounce.js +1 -5
- package/src/scripts/editProxy.js +8 -7
- package/src/scripts/prettifyFileSize.js +1 -1
- package/src/scripts/preventHiddenPageCallsDecorator.js +3 -6
- package/src/store/BaseStoreModules/ApiStoreModule.js +7 -33
- package/src/store/BaseStoreModules/BaseStoreModule.js +14 -23
- package/src/store/BaseStoreModules/__tests__/BaseStoreModule.spec.js +7 -28
- package/src/store/helpers/getNamespacedState.js +2 -4
- package/src/store/new/modules/apiStoreModule/apiStoreModule.js +7 -27
- package/src/store/new/modules/cardStoreModule/cardStoreModule.js +0 -1
- package/src/store/new/modules/tableStoreModule/__tests__/tableStoreModule.spec.js +64 -77
- package/src/store/new/modules/tableStoreModule/tableStoreModule.js +12 -29
- package/src/tests/mocks/axiosMock.js +25 -19
- package/src/validators/decimalValidator.js +5 -4
- package/src/validators/websocketValidator/__tests__/websocketValidator.spec.js +1 -2
- package/src/validators/websocketValidator/websocketValidator.js +1 -1
|
@@ -57,9 +57,7 @@
|
|
|
57
57
|
<script setup>
|
|
58
58
|
import { computed, ref, toRef } from 'vue';
|
|
59
59
|
import { useI18n } from 'vue-i18n';
|
|
60
|
-
import {
|
|
61
|
-
useRepresentableAgentPauseCause,
|
|
62
|
-
} from '../../../../composables/useRepresentableAgentPauseCause/useRepresentableAgentPauseCause.js';
|
|
60
|
+
import { useRepresentableAgentPauseCause } from '../../../../composables/useRepresentableAgentPauseCause/useRepresentableAgentPauseCause.js';
|
|
63
61
|
|
|
64
62
|
const props = defineProps({
|
|
65
63
|
options: {
|
|
@@ -78,15 +76,17 @@ const { t } = useI18n();
|
|
|
78
76
|
|
|
79
77
|
const { representablePauseCause } = useRepresentableAgentPauseCause(options);
|
|
80
78
|
|
|
81
|
-
const pauseCause = computed(() =>
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
79
|
+
const pauseCause = computed(() =>
|
|
80
|
+
representablePauseCause.value.map((cause) => ({
|
|
81
|
+
...cause,
|
|
82
|
+
duration: cause.isOverflow
|
|
83
|
+
? `-${cause.durationMin - cause.limitMin} ${t('webitelUI.agentStatusSelect.pauseCausePopup.min')}`
|
|
84
|
+
: `${cause.durationMin} ${t('webitelUI.agentStatusSelect.pauseCausePopup.min')}`,
|
|
85
|
+
limit: cause.limitMin
|
|
86
|
+
? `${cause.limitMin} ${t('webitelUI.agentStatusSelect.pauseCausePopup.min')}`
|
|
87
|
+
: t('webitelUI.agentStatusSelect.pauseCausePopup.unlimited'),
|
|
88
|
+
})),
|
|
89
|
+
);
|
|
90
90
|
|
|
91
91
|
function select(option) {
|
|
92
92
|
selected.value = option;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
:status="status"
|
|
5
5
|
:status-duration="statusDuration"
|
|
6
6
|
@closed="handleClosed"
|
|
7
|
-
@change="
|
|
7
|
+
@change="handleSelectInput"
|
|
8
8
|
/>
|
|
9
9
|
<pause-cause-popup
|
|
10
10
|
v-if="isPauseCausePopup"
|
|
@@ -54,6 +54,7 @@ const PauseCauseAPI = PauseCauseAPIFactory(api);
|
|
|
54
54
|
const isPauseCausePopup = ref(false);
|
|
55
55
|
const pauseCauses = ref([]);
|
|
56
56
|
const error = ref(null);
|
|
57
|
+
const chosenStatus = ref('');
|
|
57
58
|
|
|
58
59
|
function openPauseCausePopup() {
|
|
59
60
|
isPauseCausePopup.value = true;
|
|
@@ -83,21 +84,33 @@ async function changeStatus({ status, pauseCause }) {
|
|
|
83
84
|
}
|
|
84
85
|
}
|
|
85
86
|
|
|
86
|
-
async function
|
|
87
|
-
if (status === props.status) return;
|
|
88
|
-
|
|
87
|
+
async function handleStatus(status) {
|
|
89
88
|
if (status === AgentStatus.PAUSE) {
|
|
90
89
|
await loadPauseCauses();
|
|
91
90
|
if (pauseCauses.value.length) {
|
|
92
91
|
openPauseCausePopup();
|
|
92
|
+
return;
|
|
93
93
|
}
|
|
94
|
-
} else {
|
|
95
|
-
await changeStatus({ status });
|
|
96
94
|
}
|
|
95
|
+
if (status === props.status) return;
|
|
96
|
+
await changeStatus({ status });
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function handleSelectInput(newStatus) {
|
|
100
|
+
handleStatus(newStatus);
|
|
101
|
+
chosenStatus.value = newStatus;
|
|
102
|
+
// we need to save changes which come from input, because sometimes we want
|
|
103
|
+
// to choose 'pause' repeatedly and have to check the previous status
|
|
97
104
|
}
|
|
98
105
|
|
|
99
106
|
function handleClosed(event) {
|
|
100
|
-
|
|
107
|
+
// sometimes we want to choose 'pause' repeatedly
|
|
108
|
+
// but 'change' event from wt-status-select can't give us the same value,
|
|
109
|
+
// in this case we have to use value from 'closed' event to choose 'pause' status
|
|
110
|
+
if ((event.value === chosenStatus.value || !chosenStatus.value) // if closed status the same as chosen, or chosen status is empty
|
|
111
|
+
&& event.value === AgentStatus.PAUSE) { // and only for 'pause' status
|
|
112
|
+
handleStatus(event.value);
|
|
113
|
+
}
|
|
101
114
|
}
|
|
102
115
|
|
|
103
116
|
function handlePauseCauseInput(pauseCause) {
|
|
@@ -19,10 +19,8 @@ describe('WtDarkModeSwitcher', () => {
|
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
it('toggles dark mode class', async () => {
|
|
22
|
-
expect(window.document.documentElement.classList.contains('theme--dark'))
|
|
23
|
-
.toBe(false);
|
|
22
|
+
expect(window.document.documentElement.classList.contains('theme--dark')).toBe(false);
|
|
24
23
|
await wrapper.findComponent({ name: 'wt-switcher' }).trigger('change');
|
|
25
|
-
expect(window.document.documentElement.classList.contains('theme--dark'))
|
|
26
|
-
.toBe(true);
|
|
24
|
+
expect(window.document.documentElement.classList.contains('theme--dark')).toBe(true);
|
|
27
25
|
});
|
|
28
26
|
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { shallowMount } from '@vue/test-utils';
|
|
2
|
-
import AuditFormQuestionReadWrapper
|
|
3
|
-
from '../audit-form-question-read-wrapper.vue';
|
|
2
|
+
import AuditFormQuestionReadWrapper from '../audit-form-question-read-wrapper.vue';
|
|
4
3
|
|
|
5
4
|
describe('AuditFormQuestionReadWrapper', () => {
|
|
6
5
|
it('renders a component', () => {
|
package/src/modules/AuditForm/components/__tests__/audit-form-question-write-wrapper.spec.js
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import { shallowMount } from '@vue/test-utils';
|
|
2
2
|
import { EngineAuditQuestionType } from 'webitel-sdk';
|
|
3
|
-
import {
|
|
4
|
-
generateQuestionOptionsSchema,
|
|
5
|
-
} from '../../schemas/AuditFormQuestionOptionsSchema.js';
|
|
3
|
+
import { generateQuestionOptionsSchema } from '../../schemas/AuditFormQuestionOptionsSchema.js';
|
|
6
4
|
import { generateQuestionSchema } from '../../schemas/AuditFormQuestionSchema.js';
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
} from '../../schemas/AuditFormQuestionScoreSchema.js';
|
|
10
|
-
import AuditFormQuestionWriteWrapper
|
|
11
|
-
from '../audit-form-question-write-wrapper.vue';
|
|
5
|
+
import { generateQuestionScoreSchema } from '../../schemas/AuditFormQuestionScoreSchema.js';
|
|
6
|
+
import AuditFormQuestionWriteWrapper from '../audit-form-question-write-wrapper.vue';
|
|
12
7
|
|
|
13
8
|
const v = { question: {} };
|
|
14
9
|
|
|
@@ -30,11 +25,8 @@ describe('AuditFormQuestionWriteWrapper', () => {
|
|
|
30
25
|
v,
|
|
31
26
|
},
|
|
32
27
|
});
|
|
33
|
-
wrapper.findComponent({ name: 'wt-switcher' })
|
|
34
|
-
.
|
|
35
|
-
.$emit('change', !question.required);
|
|
36
|
-
expect(wrapper.emitted()['change:question'][0][0].required)
|
|
37
|
-
.toBe(!question.required);
|
|
28
|
+
wrapper.findComponent({ name: 'wt-switcher' }).vm.$emit('change', !question.required);
|
|
29
|
+
expect(wrapper.emitted()['change:question'][0][0].required).toBe(!question.required);
|
|
38
30
|
});
|
|
39
31
|
it('correctly changes question type to Score', () => {
|
|
40
32
|
const question = {};
|
|
@@ -44,12 +36,11 @@ describe('AuditFormQuestionWriteWrapper', () => {
|
|
|
44
36
|
v,
|
|
45
37
|
},
|
|
46
38
|
});
|
|
47
|
-
wrapper
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
expect(wrapper.emitted()['change:question'][0][0])
|
|
52
|
-
.toEqual(generateQuestionScoreSchema());
|
|
39
|
+
wrapper
|
|
40
|
+
.find('.audit-form-question-write-content-question')
|
|
41
|
+
.findComponent({ name: 'wt-select' })
|
|
42
|
+
.vm.$emit('input', { value: EngineAuditQuestionType.Score });
|
|
43
|
+
expect(wrapper.emitted()['change:question'][0][0]).toEqual(generateQuestionScoreSchema());
|
|
53
44
|
});
|
|
54
45
|
it('correctly changes question type to Options', () => {
|
|
55
46
|
const question = {};
|
|
@@ -59,11 +50,10 @@ describe('AuditFormQuestionWriteWrapper', () => {
|
|
|
59
50
|
v,
|
|
60
51
|
},
|
|
61
52
|
});
|
|
62
|
-
wrapper
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
expect(wrapper.emitted()['change:question'][0][0])
|
|
67
|
-
.toEqual(generateQuestionOptionsSchema());
|
|
53
|
+
wrapper
|
|
54
|
+
.find('.audit-form-question-write-content-question')
|
|
55
|
+
.findComponent({ name: 'wt-select' })
|
|
56
|
+
.vm.$emit('input', { value: EngineAuditQuestionType.Option });
|
|
57
|
+
expect(wrapper.emitted()['change:question'][0][0]).toEqual(generateQuestionOptionsSchema());
|
|
68
58
|
});
|
|
69
59
|
});
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { mount } from '@vue/test-utils';
|
|
2
2
|
import { ref } from 'vue';
|
|
3
|
-
import {
|
|
4
|
-
useDestroyableSortable,
|
|
5
|
-
} from '../../../../composables/useDestroyableSortable/useDestroyableSortable.js';
|
|
3
|
+
import { useDestroyableSortable } from '../../../../composables/useDestroyableSortable/useDestroyableSortable.js';
|
|
6
4
|
import { generateQuestionSchema } from '../../schemas/AuditFormQuestionSchema.js';
|
|
7
5
|
import AuditForm from '../audit-form.vue';
|
|
8
6
|
|
|
@@ -32,8 +30,9 @@ describe('AuditForm', () => {
|
|
|
32
30
|
await wrapper.vm.$nextTick();
|
|
33
31
|
await wrapper.vm.$nextTick();
|
|
34
32
|
console.info(wrapper.html());
|
|
35
|
-
expect(wrapper.emitted()['update:questions'][0][0])
|
|
36
|
-
|
|
33
|
+
expect(wrapper.emitted()['update:questions'][0][0]).toEqual([
|
|
34
|
+
generateQuestionSchema({ required: true }),
|
|
35
|
+
]);
|
|
37
36
|
});
|
|
38
37
|
it('delete event from child question emits update without passed question', async () => {
|
|
39
38
|
const wrapper = mount(AuditForm, {
|
|
@@ -42,11 +41,8 @@ describe('AuditForm', () => {
|
|
|
42
41
|
questions: [generateQuestionSchema()],
|
|
43
42
|
},
|
|
44
43
|
});
|
|
45
|
-
await wrapper.findComponent({ name: 'audit-form-question' })
|
|
46
|
-
.
|
|
47
|
-
.$emit('delete', { key: 0 });
|
|
48
|
-
expect(wrapper.emitted()['update:questions'][0][0])
|
|
49
|
-
.toEqual([]);
|
|
44
|
+
await wrapper.findComponent({ name: 'audit-form-question' }).vm.$emit('delete', { key: 0 });
|
|
45
|
+
expect(wrapper.emitted()['update:questions'][0][0]).toEqual([]);
|
|
50
46
|
});
|
|
51
47
|
it('copy event from child question emits update with duplicated questions', async () => {
|
|
52
48
|
const question = generateQuestionSchema();
|
|
@@ -56,21 +52,16 @@ describe('AuditForm', () => {
|
|
|
56
52
|
questions: [question],
|
|
57
53
|
},
|
|
58
54
|
});
|
|
59
|
-
await wrapper
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
expect(wrapper.emitted()['update:questions'][0][0])
|
|
63
|
-
.toEqual([question, question]);
|
|
55
|
+
await wrapper
|
|
56
|
+
.findComponent({ name: 'audit-form-question' })
|
|
57
|
+
.vm.$emit('copy', { question, key: 0 });
|
|
58
|
+
expect(wrapper.emitted()['update:questions'][0][0]).toEqual([question, question]);
|
|
64
59
|
});
|
|
65
60
|
it('initializes result depending on passed questions', () => {
|
|
66
61
|
const wrapper = mount(AuditForm, {
|
|
67
62
|
props: {
|
|
68
63
|
mode: 'fill',
|
|
69
|
-
questions: [
|
|
70
|
-
generateQuestionSchema(),
|
|
71
|
-
generateQuestionSchema(),
|
|
72
|
-
generateQuestionSchema(),
|
|
73
|
-
],
|
|
64
|
+
questions: [generateQuestionSchema(), generateQuestionSchema(), generateQuestionSchema()],
|
|
74
65
|
},
|
|
75
66
|
});
|
|
76
67
|
expect(wrapper.emitted()['update:result'][0][0]).toEqual([{}, {}, {}]);
|
|
@@ -73,10 +73,7 @@ const props = defineProps({
|
|
|
73
73
|
},
|
|
74
74
|
});
|
|
75
75
|
|
|
76
|
-
const emit = defineEmits([
|
|
77
|
-
'change:result',
|
|
78
|
-
'activate',
|
|
79
|
-
]);
|
|
76
|
+
const emit = defineEmits(['change:result', 'activate']);
|
|
80
77
|
|
|
81
78
|
const QuestionTypeComponent = computed(() => {
|
|
82
79
|
if (props.question.type === EngineAuditQuestionType.Option) return AuditFormQuestionOptions;
|
|
@@ -89,18 +89,16 @@ const props = defineProps({
|
|
|
89
89
|
},
|
|
90
90
|
});
|
|
91
91
|
|
|
92
|
-
const emit = defineEmits([
|
|
93
|
-
'change:question',
|
|
94
|
-
'copy',
|
|
95
|
-
'delete',
|
|
96
|
-
]);
|
|
92
|
+
const emit = defineEmits(['change:question', 'copy', 'delete']);
|
|
97
93
|
|
|
98
94
|
const QuestionType = [
|
|
99
95
|
{ value: EngineAuditQuestionType.Option, locale: 'webitelUI.auditForm.type.options' },
|
|
100
96
|
{ value: EngineAuditQuestionType.Score, locale: 'webitelUI.auditForm.type.score' },
|
|
101
97
|
];
|
|
102
98
|
|
|
103
|
-
const prettifiedQuestionType = computed(() =>
|
|
99
|
+
const prettifiedQuestionType = computed(() =>
|
|
100
|
+
QuestionType.find(({ value }) => value === props.question.type),
|
|
101
|
+
);
|
|
104
102
|
|
|
105
103
|
const QuestionTypeComponent = computed(() => {
|
|
106
104
|
if (props.question.type === EngineAuditQuestionType.Option) return AuditFormQuestionOptions;
|
|
@@ -122,7 +120,6 @@ function handleQuestionTypeChange(type) {
|
|
|
122
120
|
}
|
|
123
121
|
emit('change:question', question);
|
|
124
122
|
}
|
|
125
|
-
|
|
126
123
|
</script>
|
|
127
124
|
|
|
128
125
|
<style lang="scss" scoped>
|
|
@@ -56,12 +56,7 @@ const props = defineProps({
|
|
|
56
56
|
},
|
|
57
57
|
});
|
|
58
58
|
|
|
59
|
-
const emits = defineEmits([
|
|
60
|
-
'copy',
|
|
61
|
-
'delete',
|
|
62
|
-
'update:question',
|
|
63
|
-
'update:result',
|
|
64
|
-
]);
|
|
59
|
+
const emits = defineEmits(['copy', 'delete', 'update:question', 'update:result']);
|
|
65
60
|
|
|
66
61
|
const QuestionState = {
|
|
67
62
|
SAVED: 'saved',
|
|
@@ -73,17 +68,23 @@ const state = ref(QuestionState.SAVED);
|
|
|
73
68
|
// is needed for useVuelidate, because props.question/props.result isn't reactive
|
|
74
69
|
const { question, result } = toRefs(props);
|
|
75
70
|
|
|
76
|
-
const v$ = useVuelidate(
|
|
77
|
-
(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
71
|
+
const v$ = useVuelidate(
|
|
72
|
+
computed(() =>
|
|
73
|
+
props.mode === 'create'
|
|
74
|
+
? {
|
|
75
|
+
question: {
|
|
76
|
+
question: { required },
|
|
77
|
+
},
|
|
78
|
+
}
|
|
79
|
+
: {
|
|
80
|
+
result: {
|
|
81
|
+
required: (value) => (question.value.required ? !isEmpty(value) : true),
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
),
|
|
85
|
+
{ question, result },
|
|
86
|
+
{ $autoDirty: true },
|
|
87
|
+
);
|
|
87
88
|
|
|
88
89
|
const component = computed(() => {
|
|
89
90
|
if (props.readonly) return QuestionRead;
|
|
@@ -45,8 +45,8 @@ const props = defineProps({
|
|
|
45
45
|
type: String,
|
|
46
46
|
required: true,
|
|
47
47
|
/*
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
* Available options: ['create', 'fill']
|
|
49
|
+
* */
|
|
50
50
|
},
|
|
51
51
|
questions: {
|
|
52
52
|
type: Array,
|
|
@@ -61,11 +61,7 @@ const props = defineProps({
|
|
|
61
61
|
},
|
|
62
62
|
});
|
|
63
63
|
|
|
64
|
-
const emit = defineEmits([
|
|
65
|
-
'update:questions',
|
|
66
|
-
'update:result',
|
|
67
|
-
'update:validation',
|
|
68
|
-
]);
|
|
64
|
+
const emit = defineEmits(['update:questions', 'update:result', 'update:validation']);
|
|
69
65
|
|
|
70
66
|
const v$ = useVuelidate();
|
|
71
67
|
|
|
@@ -131,9 +127,8 @@ function initQuestions() {
|
|
|
131
127
|
async function atQuestionAdded() {
|
|
132
128
|
// wait for new question to render
|
|
133
129
|
await nextTick();
|
|
134
|
-
const index =
|
|
135
|
-
? -1
|
|
136
|
-
: isQuestionAdded.index;
|
|
130
|
+
const index =
|
|
131
|
+
isQuestionAdded.index && isQuestionAdded.index === 'last' ? -1 : isQuestionAdded.index;
|
|
137
132
|
auditQuestions.value.at(index).activateQuestion();
|
|
138
133
|
|
|
139
134
|
isQuestionAdded.value = false;
|
|
@@ -154,10 +149,13 @@ const { reloadSortable } = useDestroyableSortable(sortableWrapper, {
|
|
|
154
149
|
|
|
155
150
|
watch(v$, () => emit('update:validation', { invalid: isInvalidForm.value, v$: v$.value }));
|
|
156
151
|
watchEffect(initResult);
|
|
157
|
-
watch(
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
152
|
+
watch(
|
|
153
|
+
() => props.questions,
|
|
154
|
+
() => {
|
|
155
|
+
if (!isQuestionAdded.value) return;
|
|
156
|
+
atQuestionAdded();
|
|
157
|
+
},
|
|
158
|
+
);
|
|
161
159
|
|
|
162
160
|
onMounted(() => {
|
|
163
161
|
initQuestions();
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { mount, shallowMount } from '@vue/test-utils';
|
|
2
|
-
import AuditFormQuestionOptionsWriteRow
|
|
3
|
-
from '../audit-form-question-options-write-row.vue';
|
|
2
|
+
import AuditFormQuestionOptionsWriteRow from '../audit-form-question-options-write-row.vue';
|
|
4
3
|
|
|
5
4
|
describe('AuditFormQuestionOptionsWriteRow', () => {
|
|
6
5
|
it('renders a component', () => {
|
|
@@ -17,9 +17,7 @@ describe('AuditFormQuestionOptions', () => {
|
|
|
17
17
|
mode: 'write',
|
|
18
18
|
},
|
|
19
19
|
});
|
|
20
|
-
wrapper.findComponent('.audit-form-question-options-write__add-button')
|
|
21
|
-
.vm
|
|
22
|
-
.$emit('click');
|
|
20
|
+
wrapper.findComponent('.audit-form-question-options-write__add-button').vm.$emit('click');
|
|
23
21
|
expect(wrapper.emitted()['change:question'][0][0].options.length).toBe(2);
|
|
24
22
|
});
|
|
25
23
|
it('deletes existing question option at "delete" icon-btn click', () => {
|
package/src/modules/AuditForm/components/questions/options/audit-form-question-options-write-row.vue
CHANGED
|
@@ -47,27 +47,23 @@ const props = defineProps({
|
|
|
47
47
|
},
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
-
const emit = defineEmits([
|
|
51
|
-
'change:option',
|
|
52
|
-
'delete',
|
|
53
|
-
]);
|
|
50
|
+
const emit = defineEmits(['change:option', 'delete']);
|
|
54
51
|
|
|
55
52
|
// is needed for useVuelidate, because props.question/props.result isn't reactive
|
|
56
53
|
const { option } = toRefs(props);
|
|
57
54
|
|
|
58
55
|
const v$ = useVuelidate(
|
|
59
|
-
computed(() => (
|
|
60
|
-
{
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
decimalValidator: decimalValidator(2),
|
|
68
|
-
},
|
|
56
|
+
computed(() => ({
|
|
57
|
+
option: {
|
|
58
|
+
name: { required },
|
|
59
|
+
score: {
|
|
60
|
+
required,
|
|
61
|
+
minValue: minValue(0),
|
|
62
|
+
maxValue: maxValue(10),
|
|
63
|
+
decimalValidator: decimalValidator(2),
|
|
69
64
|
},
|
|
70
|
-
}
|
|
65
|
+
},
|
|
66
|
+
})),
|
|
71
67
|
{ option },
|
|
72
68
|
{ $autoDirty: true },
|
|
73
69
|
);
|
|
@@ -60,10 +60,7 @@ const props = defineProps({
|
|
|
60
60
|
},
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
-
const emit = defineEmits([
|
|
64
|
-
'change:question',
|
|
65
|
-
'change:result',
|
|
66
|
-
]);
|
|
63
|
+
const emit = defineEmits(['change:question', 'change:result']);
|
|
67
64
|
|
|
68
65
|
function updateQuestion({ path, value }) {
|
|
69
66
|
emit('change:question', updateObject({ obj: props.question, path, value }));
|
|
@@ -60,32 +60,28 @@ const props = defineProps({
|
|
|
60
60
|
},
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
-
const emit = defineEmits([
|
|
64
|
-
'change:question',
|
|
65
|
-
'change:result',
|
|
66
|
-
]);
|
|
63
|
+
const emit = defineEmits(['change:question', 'change:result']);
|
|
67
64
|
|
|
68
65
|
// is needed for useVuelidate, because props.question/props.result isn't reactive
|
|
69
66
|
const { question } = toRefs(props);
|
|
70
67
|
|
|
71
68
|
const v$ = useVuelidate(
|
|
72
|
-
computed(() => (
|
|
73
|
-
{
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
integer,
|
|
80
|
-
},
|
|
81
|
-
max: {
|
|
82
|
-
minValue: minValue(props.question.min ? props.question.min : 1),
|
|
83
|
-
maxValue: maxValue(10),
|
|
84
|
-
required,
|
|
85
|
-
integer,
|
|
86
|
-
},
|
|
69
|
+
computed(() => ({
|
|
70
|
+
question: {
|
|
71
|
+
min: {
|
|
72
|
+
minValue: minValue(0),
|
|
73
|
+
maxValue: maxValue(9),
|
|
74
|
+
required,
|
|
75
|
+
integer,
|
|
87
76
|
},
|
|
88
|
-
|
|
77
|
+
max: {
|
|
78
|
+
minValue: minValue(props.question.min ? props.question.min : 1),
|
|
79
|
+
maxValue: maxValue(10),
|
|
80
|
+
required,
|
|
81
|
+
integer,
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
})),
|
|
89
85
|
{ question },
|
|
90
86
|
{ $autoDirty: true },
|
|
91
87
|
);
|
|
@@ -6,8 +6,7 @@ const cast = {
|
|
|
6
6
|
object: (separator) => {
|
|
7
7
|
const cast = (object) => {
|
|
8
8
|
if (Array.isArray(object)) {
|
|
9
|
-
return object.map((item) => cast(item))
|
|
10
|
-
.join(separator);
|
|
9
|
+
return object.map((item) => cast(item)).join(separator);
|
|
11
10
|
}
|
|
12
11
|
return object.name || JSON.stringify(object);
|
|
13
12
|
};
|
|
@@ -34,8 +33,7 @@ export default class CSVExport {
|
|
|
34
33
|
header: true,
|
|
35
34
|
delimiter,
|
|
36
35
|
};
|
|
37
|
-
const localStorageOptions = JSON.parse(localStorage.getItem('csv-export-options')) ||
|
|
38
|
-
{};
|
|
36
|
+
const localStorageOptions = JSON.parse(localStorage.getItem('csv-export-options')) || {};
|
|
39
37
|
return {
|
|
40
38
|
...defaultOptions,
|
|
41
39
|
...localStorageOptions,
|
|
@@ -59,12 +57,10 @@ export default class CSVExport {
|
|
|
59
57
|
let csv = '';
|
|
60
58
|
let isNext = false;
|
|
61
59
|
// why _columns? https://webitel.atlassian.net/browse/DEV-3797
|
|
62
|
-
let columns = params._columns ||
|
|
63
|
-
(params?.fields ? objSnakeToCamel(params?.fields) : []);
|
|
60
|
+
let columns = params._columns || (params?.fields ? objSnakeToCamel(params?.fields) : []);
|
|
64
61
|
let page = 1;
|
|
65
62
|
|
|
66
63
|
do {
|
|
67
|
-
|
|
68
64
|
const { items, next } = await this.fetchMethod({
|
|
69
65
|
...params,
|
|
70
66
|
page,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as XLSX from 'xlsx';
|
|
2
1
|
import { saveAs } from 'file-saver-es';
|
|
2
|
+
import * as XLSX from 'xlsx';
|
|
3
3
|
import { objSnakeToCamel } from '../../scripts/caseConverters.js';
|
|
4
4
|
|
|
5
5
|
export default class XLSExport {
|
|
@@ -29,9 +29,9 @@ export default class XLSExport {
|
|
|
29
29
|
|
|
30
30
|
// NOTE: creates a new object that only includes the properties specified in the columns array
|
|
31
31
|
filterDataByColumns(data, columns) {
|
|
32
|
-
return data.map(item => {
|
|
33
|
-
|
|
34
|
-
columns.forEach(column => {
|
|
32
|
+
return data.map((item) => {
|
|
33
|
+
const filteredItem = {};
|
|
34
|
+
columns.forEach((column) => {
|
|
35
35
|
const value = item.hasOwnProperty(column) ? this.extractNameFromObject(item[column]) : ''; // '' needed to display column that has no data
|
|
36
36
|
filteredItem[column] = value;
|
|
37
37
|
});
|
|
@@ -41,7 +41,7 @@ export default class XLSExport {
|
|
|
41
41
|
|
|
42
42
|
// NOTE: calculates the width of the columns based on the data to display it in the EXEL file
|
|
43
43
|
calculateColumnWidths(data, columns) {
|
|
44
|
-
return columns.map(column => {
|
|
44
|
+
return columns.map((column) => {
|
|
45
45
|
const maxLength = data.reduce((max, item) => {
|
|
46
46
|
const value = item[column] || '';
|
|
47
47
|
return Math.max(max, value.toString().length);
|
|
@@ -66,8 +66,7 @@ export default class XLSExport {
|
|
|
66
66
|
let data = [];
|
|
67
67
|
let isNext = false;
|
|
68
68
|
let page = 1;
|
|
69
|
-
|
|
70
|
-
(params?.fields ? objSnakeToCamel(params?.fields) : []);
|
|
69
|
+
const columns = params._columns || (params?.fields ? objSnakeToCamel(params?.fields) : []);
|
|
71
70
|
|
|
72
71
|
do {
|
|
73
72
|
const { items, next } = await this.fetchMethod({
|
|
@@ -14,9 +14,7 @@ export default {
|
|
|
14
14
|
return this.CSVExport ? this.CSVExport.downloadProgress.count : 0;
|
|
15
15
|
},
|
|
16
16
|
selectedIds() {
|
|
17
|
-
return this.dataList
|
|
18
|
-
.filter((item) => item._isSelected)
|
|
19
|
-
.map((item) => item.id);
|
|
17
|
+
return this.dataList.filter((item) => item._isSelected).map((item) => item.id);
|
|
20
18
|
},
|
|
21
19
|
isAnySelected() {
|
|
22
20
|
return !!this.selectedIds.length;
|
|
@@ -31,7 +29,7 @@ export default {
|
|
|
31
29
|
async exportCSV(exportParams) {
|
|
32
30
|
const routeQuery = this.$route?.query;
|
|
33
31
|
const params = {
|
|
34
|
-
...exportParams || routeQuery,
|
|
32
|
+
...(exportParams || routeQuery),
|
|
35
33
|
size: 5000,
|
|
36
34
|
};
|
|
37
35
|
if (this.isAnySelected) params.id = this.selectedIds;
|
|
@@ -41,7 +39,6 @@ export default {
|
|
|
41
39
|
} catch (err) {
|
|
42
40
|
throw err;
|
|
43
41
|
}
|
|
44
|
-
|
|
45
42
|
},
|
|
46
43
|
},
|
|
47
44
|
};
|