@webitel/ui-sdk 24.12.44 → 24.12.45
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
CHANGED
|
@@ -43,6 +43,7 @@ import {
|
|
|
43
43
|
watch,
|
|
44
44
|
watchEffect,
|
|
45
45
|
} from 'vue';
|
|
46
|
+
|
|
46
47
|
import WtButton from '../../../components/wt-button/wt-button.vue';
|
|
47
48
|
import { useDestroyableSortable } from '../../../composables/useDestroyableSortable/useDestroyableSortable.js';
|
|
48
49
|
import { generateQuestionSchema } from '../schemas/AuditFormQuestionSchema.js';
|
|
@@ -82,7 +83,7 @@ const auditQuestions = ref(null);
|
|
|
82
83
|
const isQuestionAdded = reactive({ value: false, index: null });
|
|
83
84
|
|
|
84
85
|
async function addQuestion({ index, question } = {}) {
|
|
85
|
-
const questions = [...props.questions];
|
|
86
|
+
const questions = [...(props.questions || [])];
|
|
86
87
|
const newQuestion = question || generateQuestionSchema();
|
|
87
88
|
if (index != null) questions.splice(index, 0, newQuestion);
|
|
88
89
|
else questions.push(newQuestion);
|
|
@@ -124,12 +125,12 @@ function handleResultUpdate({ key, value }) {
|
|
|
124
125
|
}
|
|
125
126
|
|
|
126
127
|
function initResult() {
|
|
127
|
-
const result = props.questions
|
|
128
|
+
const result = props.questions?.map(() => ({}));
|
|
128
129
|
emit('update:result', result);
|
|
129
130
|
}
|
|
130
131
|
|
|
131
132
|
function initQuestions() {
|
|
132
|
-
if (props.mode === 'create' && !props.questions
|
|
133
|
+
if (props.mode === 'create' && !props.questions?.length) {
|
|
133
134
|
addQuestion({ question: generateQuestionSchema({ required: true }) });
|
|
134
135
|
} else if (props.questions.length)
|
|
135
136
|
auditQuestions.value.at(0).activateQuestion();
|