@webitel/ui-sdk 3.1.58 → 3.1.60

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-sdk",
3
- "version": "3.1.58",
3
+ "version": "3.1.60",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve-lib": "vue-cli-service serve",
@@ -4,6 +4,7 @@
4
4
  <wt-switcher
5
5
  :value="question.required"
6
6
  :label="$t('reusable.required')"
7
+ :disabled="first"
7
8
  @change="updateQuestion({ path: 'required', value: $event })"
8
9
  ></wt-switcher>
9
10
  <div class="audit-form-question-write-header__actions">
@@ -20,7 +21,7 @@
20
21
  <template v-slot:activator>
21
22
  <wt-icon-btn
22
23
  icon="bucket"
23
- :disabled="disableDelete"
24
+ :disabled="first"
24
25
  @click="emit('delete')"
25
26
  ></wt-icon-btn>
26
27
  </template>
@@ -79,9 +80,9 @@ const props = defineProps({
79
80
  type: Object,
80
81
  required: true,
81
82
  },
82
- disableDelete: {
83
+ first: {
83
84
  type: Boolean,
84
- default: true,
85
+ default: false,
85
86
  },
86
87
  v: {
87
88
  type: Object,
@@ -11,7 +11,7 @@
11
11
  :question="question"
12
12
  :result="(result && result[key]) ? result[key] : null"
13
13
  :mode="mode"
14
- :disable-delete="questions.length <= 1"
14
+ :first="key === 0"
15
15
  :readonly="readonly"
16
16
  @copy="copyQuestion({ question, key })"
17
17
  @delete="deleteQuestion({ question, key})"
@@ -32,7 +32,7 @@
32
32
  <script setup>
33
33
  import cloneDeep from 'lodash/cloneDeep';
34
34
  import {
35
- watch, watchEffect, ref, computed,
35
+ watch, watchEffect, ref, computed, onMounted,
36
36
  } from 'vue';
37
37
  import { useVuelidate } from '@vuelidate/core';
38
38
  import { useDestroyableSortable } from '../composables/useDestroyableSortable';
@@ -115,6 +115,12 @@ function initResult() {
115
115
  emit('update:result', result);
116
116
  }
117
117
 
118
+ function initQuestions() {
119
+ if (props.mode === 'create' && !props.questions.length) {
120
+ addQuestion(generateQuestionSchema({ required: true }));
121
+ }
122
+ }
123
+
118
124
  const sortableWrapper = ref(null);
119
125
 
120
126
  const { reloadSortable } = useDestroyableSortable(sortableWrapper, {
@@ -128,6 +134,10 @@ const { reloadSortable } = useDestroyableSortable(sortableWrapper, {
128
134
 
129
135
  watch(v$, () => emit('update:validation', v$));
130
136
  watchEffect(initResult);
137
+
138
+ onMounted(() => {
139
+ initQuestions();
140
+ });
131
141
  </script>
132
142
 
133
143
  <style lang="scss" scoped>
@@ -1,8 +1,8 @@
1
1
  import { generateQuestionScoreSchema } from './AuditFormQuestionScoreSchema';
2
2
 
3
3
  // eslint-disable-next-line import/prefer-default-export
4
- export const generateQuestionSchema = () => ({
5
- required: true,
6
- question: 'Title',
4
+ export const generateQuestionSchema = ({ required = false } = {}) => ({
5
+ required,
6
+ question: '',
7
7
  ...generateQuestionScoreSchema(),
8
8
  });
@@ -29,17 +29,9 @@ export default class TableStoreModule extends BaseStoreModule {
29
29
  fields = [...new Set(fields)];
30
30
  return fields;
31
31
  },
32
- // GET_DATA_FIELDS_BY_VALUE: (state) => (headerValues) => state.headers
33
- // .reduce((fields, header) => {
34
- // if (headerValues.includes(header.value)) return fields.concat(header.field);
35
- // return [...new Set(fields)];
36
- // }, []),
37
32
 
38
33
  // main GET_LIST params collector
39
34
  GET_LIST_PARAMS: (state, getters) => (query) => {
40
- // const fields = (query.fields
41
- // ? getters.GET_DATA_FIELDS_BY_VALUE(query.fields)
42
- // : getters.FIELDS).concat(getters.REQUIRED_FIELDS);
43
35
  const fields = getters.FIELDS.concat(getters.REQUIRED_FIELDS);
44
36
 
45
37
  const filters = getters.GET_FILTERS || getters['filters/GET_FILTERS'];