@webitel/ui-sdk 3.0.8 → 3.0.10
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/package.json +2 -2
- package/src/modules/AuditForm/components/__tests__/audit-form-question-write-wrapper.spec.js +3 -2
- package/src/modules/AuditForm/components/audit-form-question-read-wrapper.vue +4 -3
- package/src/modules/AuditForm/components/audit-form-question-write-wrapper.vue +10 -9
- package/src/modules/AuditForm/components/audit-form-question.vue +1 -1
- package/src/modules/AuditForm/components/questions/audit-form-question-options.vue +5 -5
- package/src/modules/AuditForm/schemas/AuditFormQuestionOptionsSchema.js +4 -2
- package/src/modules/AuditForm/schemas/AuditFormQuestionSchema.js +1 -1
- package/src/modules/AuditForm/schemas/AuditFormQuestionScoreSchema.js +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webitel/ui-sdk",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.10",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"serve-lib": "vue-cli-service serve",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"vue-observe-visibility": "^1.0.0",
|
|
51
51
|
"vue-router": "^4.1.6",
|
|
52
52
|
"vuejs-datepicker": "^1.6.2",
|
|
53
|
-
"webitel-sdk": "^0.1.
|
|
53
|
+
"webitel-sdk": "^0.1.184"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@babel/eslint-parser": "^7.17.0",
|
package/src/modules/AuditForm/components/__tests__/audit-form-question-write-wrapper.spec.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import { EngineAuditQuestionType } from 'webitel-sdk';
|
|
2
3
|
import {
|
|
3
|
-
generateQuestionOptionsSchema
|
|
4
|
+
generateQuestionOptionsSchema,
|
|
4
5
|
} from '../../schemas/AuditFormQuestionOptionsSchema';
|
|
5
6
|
import AuditFormQuestionWriteWrapper from '../audit-form-question-write-wrapper.vue';
|
|
6
7
|
import { generateQuestionSchema } from '../../schemas/AuditFormQuestionSchema';
|
|
@@ -39,7 +40,7 @@ describe('AuditFormQuestionWriteWrapper', () => {
|
|
|
39
40
|
},
|
|
40
41
|
});
|
|
41
42
|
wrapper.find('.audit-form-question-write-content-question')
|
|
42
|
-
.findComponent({ name: 'wt-select' }).vm.$emit('input', { value:
|
|
43
|
+
.findComponent({ name: 'wt-select' }).vm.$emit('input', { value: EngineAuditQuestionType.Score });
|
|
43
44
|
expect(wrapper.emitted()['change:question'][0][0])
|
|
44
45
|
.toEqual(generateQuestionScoreSchema());
|
|
45
46
|
});
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
:class="{
|
|
14
14
|
'audit-form-question-read-text--required': question.required,
|
|
15
15
|
}"
|
|
16
|
-
>{{ question.
|
|
16
|
+
>{{ question.question }}</p>
|
|
17
17
|
<wt-icon
|
|
18
18
|
class="audit-form-question-read__drag-icon"
|
|
19
19
|
v-if="!disableDragging"
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
|
|
36
36
|
<script setup>
|
|
37
37
|
import { computed } from 'vue';
|
|
38
|
+
import { EngineAuditQuestionType } from 'webitel-sdk';
|
|
38
39
|
import AuditFormQuestionOptions from './questions/audit-form-question-options.vue';
|
|
39
40
|
import AuditFormQuestionScore from './questions/audit-form-question-score.vue';
|
|
40
41
|
import WtIcon from '../../../components/atoms/wt-icon/wt-icon.vue';
|
|
@@ -60,8 +61,8 @@ const emit = defineEmits([
|
|
|
60
61
|
]);
|
|
61
62
|
|
|
62
63
|
const QuestionTypeComponent = computed(() => {
|
|
63
|
-
if (props.question.type ===
|
|
64
|
-
if (props.question.type ===
|
|
64
|
+
if (props.question.type === EngineAuditQuestionType.Option) return AuditFormQuestionOptions;
|
|
65
|
+
if (props.question.type === EngineAuditQuestionType.Score) return AuditFormQuestionScore;
|
|
65
66
|
return null;
|
|
66
67
|
});
|
|
67
68
|
</script>
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
<section class="audit-form-question-write-content">
|
|
32
32
|
<div class="audit-form-question-write-content-question">
|
|
33
33
|
<wt-input
|
|
34
|
-
:value="question.
|
|
34
|
+
:value="question.question"
|
|
35
35
|
:label="$t('webitelUI.auditForm.question')"
|
|
36
|
-
:v="v.question.
|
|
36
|
+
:v="v.question.question"
|
|
37
37
|
required
|
|
38
|
-
@input="updateQuestion({ path: '
|
|
38
|
+
@input="updateQuestion({ path: 'question', value: $event })"
|
|
39
39
|
></wt-input>
|
|
40
40
|
<wt-select
|
|
41
41
|
:value="prettifiedQuestionType"
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
import set from 'lodash/set';
|
|
61
61
|
import cloneDeep from 'lodash/cloneDeep';
|
|
62
62
|
import { computed } from 'vue';
|
|
63
|
+
import { EngineAuditQuestionType } from 'webitel-sdk';
|
|
63
64
|
import WtTooltip from '../../../components/atoms/wt-tooltip/wt-tooltip.vue';
|
|
64
65
|
import WtSwitcher from '../../../components/molecules/wt-switcher/wt-switcher.vue';
|
|
65
66
|
import WtIconBtn from '../../../components/molecules/wt-icon-btn/wt-icon-btn.vue';
|
|
@@ -93,15 +94,15 @@ const emit = defineEmits([
|
|
|
93
94
|
]);
|
|
94
95
|
|
|
95
96
|
const QuestionType = [
|
|
96
|
-
{ value:
|
|
97
|
-
{ value:
|
|
97
|
+
{ value: EngineAuditQuestionType.Option, locale: 'webitelUI.auditForm.type.options' },
|
|
98
|
+
{ value: EngineAuditQuestionType.Score, locale: 'webitelUI.auditForm.type.score' },
|
|
98
99
|
];
|
|
99
100
|
|
|
100
101
|
const prettifiedQuestionType = computed(() => QuestionType.find(({ value }) => value === props.question.type));
|
|
101
102
|
|
|
102
103
|
const QuestionTypeComponent = computed(() => {
|
|
103
|
-
if (props.question.type ===
|
|
104
|
-
if (props.question.type ===
|
|
104
|
+
if (props.question.type === EngineAuditQuestionType.Option) return AuditFormQuestionOptions;
|
|
105
|
+
if (props.question.type === EngineAuditQuestionType.Score) return AuditFormQuestionScore;
|
|
105
106
|
return null;
|
|
106
107
|
});
|
|
107
108
|
|
|
@@ -112,9 +113,9 @@ function updateQuestion({ path, value }) {
|
|
|
112
113
|
|
|
113
114
|
function handleQuestionTypeChange(type) {
|
|
114
115
|
const question = cloneDeep(props.question);
|
|
115
|
-
if (type ===
|
|
116
|
+
if (type === EngineAuditQuestionType.Option) {
|
|
116
117
|
Object.assign(question, generateQuestionOptionsSchema());
|
|
117
|
-
} else if (type ===
|
|
118
|
+
} else if (type === EngineAuditQuestionType.Score) {
|
|
118
119
|
Object.assign(question, generateQuestionScoreSchema());
|
|
119
120
|
}
|
|
120
121
|
emit('change:question', question);
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
class="audit-form-question-options-write"
|
|
6
6
|
>
|
|
7
7
|
<div
|
|
8
|
-
v-for="({
|
|
8
|
+
v-for="({ name, score }, key) of question.options"
|
|
9
9
|
:key="key"
|
|
10
10
|
class="audit-form-question-options-write-row"
|
|
11
11
|
>
|
|
12
12
|
<wt-input
|
|
13
|
-
:value="
|
|
13
|
+
:value="name"
|
|
14
14
|
:label="$tc('webitelUI.auditForm.option', 1)"
|
|
15
|
-
@input="updateQuestion({ path: `options[${key}].
|
|
15
|
+
@input="updateQuestion({ path: `options[${key}].name`, value: $event })"
|
|
16
16
|
></wt-input>
|
|
17
17
|
<wt-input
|
|
18
18
|
:value="score"
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
class="audit-form-question-options-read"
|
|
42
42
|
>
|
|
43
43
|
<wt-radio
|
|
44
|
-
v-for="({
|
|
44
|
+
v-for="({ name, score }) of question.options"
|
|
45
45
|
:key="score"
|
|
46
|
-
:label="
|
|
46
|
+
:label="name"
|
|
47
47
|
:value="score"
|
|
48
48
|
:selected="result ? result.score : result"
|
|
49
49
|
@input="emit('change:result', { score })"
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { EngineAuditQuestionType } from 'webitel-sdk';
|
|
2
|
+
|
|
1
3
|
export const generateOption = () => ({
|
|
2
|
-
|
|
4
|
+
name: '',
|
|
3
5
|
score: 10,
|
|
4
6
|
});
|
|
5
7
|
|
|
6
8
|
export const generateQuestionOptionsSchema = () => ({
|
|
7
|
-
type:
|
|
9
|
+
type: EngineAuditQuestionType.Option,
|
|
8
10
|
options: [
|
|
9
11
|
generateOption(),
|
|
10
12
|
],
|
|
@@ -3,6 +3,6 @@ import { generateQuestionScoreSchema } from './AuditFormQuestionScoreSchema';
|
|
|
3
3
|
// eslint-disable-next-line import/prefer-default-export
|
|
4
4
|
export const generateQuestionSchema = () => ({
|
|
5
5
|
required: false,
|
|
6
|
-
|
|
6
|
+
question: 'Title',
|
|
7
7
|
...generateQuestionScoreSchema(),
|
|
8
8
|
});
|