@webitel/ui-datalist 26.8.9 → 26.8.11

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-datalist",
3
- "version": "26.8.9",
3
+ "version": "26.8.11",
4
4
  "description": "Toolkit for building data lists in webitel ui system",
5
5
  "scripts": {
6
6
  "build:types": "vue-tsc -b tsconfig.build.json",
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <wt-multi-select
3
- :label="t('webitelUI.filters.filterValue')"
3
+ :label="labelValue"
4
4
  :search-method="searchMethod"
5
5
  :model-value="model"
6
6
  :v="!disableValidation && v$.model"
@@ -13,19 +13,21 @@
13
13
  import { useVuelidate } from '@vuelidate/core';
14
14
  import { required } from '@vuelidate/validators';
15
15
  import { WtMultiSelect } from '@webitel/ui-sdk/components';
16
- import { computed, watch } from 'vue';
16
+ import { computed, onMounted, watch } from 'vue';
17
17
  import { useI18n } from 'vue-i18n';
18
18
 
19
+ import { WtSysTypeFilterConfig } from '../../classes/FilterConfig';
19
20
  import { searchMethod } from './config.js';
20
21
 
21
22
  type ModelValue = number[];
22
23
 
24
+ const model = defineModel<ModelValue>();
25
+
23
26
  const props = defineProps<{
27
+ filterConfig?: WtSysTypeFilterConfig;
24
28
  disableValidation?: boolean;
25
29
  }>();
26
30
 
27
- const model = defineModel<ModelValue>();
28
-
29
31
  const emit = defineEmits<{
30
32
  'update:invalid': [
31
33
  boolean,
@@ -34,6 +36,13 @@ const emit = defineEmits<{
34
36
 
35
37
  const { t } = useI18n();
36
38
 
39
+ const labelValue = computed(() => {
40
+ const value = props?.filterConfig?.showFilterName
41
+ ? props?.filterConfig.name
42
+ : 'filterValue';
43
+ return t(`webitelUI.filters.${value}`);
44
+ });
45
+
37
46
  const v$ = useVuelidate(
38
47
  computed(() => ({
39
48
  model: {
@@ -48,7 +57,10 @@ const v$ = useVuelidate(
48
57
  },
49
58
  );
50
59
 
51
- if (!props?.disableValidation) v$.value.$touch();
60
+ onMounted(() => {
61
+ if (!props.disableValidation) v$.value.$touch();
62
+ });
63
+
52
64
  watch(
53
65
  () => v$.value.$invalid,
54
66
  (invalid) => {
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <wt-single-select
3
3
  :clearable="false"
4
- :label="t('webitelUI.filters.filterValue')"
4
+ :label="labelValue"
5
5
  :options="CallDirectionFilterOptions"
6
6
  v-model:model-value="model"
7
7
  :v="!disableValidation && v$.model"
@@ -14,17 +14,26 @@
14
14
  import { useVuelidate } from '@vuelidate/core';
15
15
  import { required } from '@vuelidate/validators';
16
16
  import { WtSingleSelect } from '@webitel/ui-sdk/components';
17
- import { computed, watch } from 'vue';
17
+ import { computed, onMounted, watch } from 'vue';
18
18
  import { useI18n } from 'vue-i18n';
19
19
 
20
+ import { WtSysTypeFilterConfig } from '../../classes/FilterConfig';
20
21
  import { CallDirectionFilterOptions } from '../../enums/options/CallDirectionFilterOptions';
21
22
 
23
+ const model = defineModel<string>();
24
+ const { t } = useI18n();
25
+
22
26
  const props = defineProps<{
27
+ filterConfig?: WtSysTypeFilterConfig;
23
28
  disableValidation?: boolean;
24
29
  }>();
25
30
 
26
- const model = defineModel<string>();
27
- const { t } = useI18n();
31
+ const labelValue = computed(() => {
32
+ const value = props?.filterConfig?.showFilterName
33
+ ? props?.filterConfig.name
34
+ : 'filterValue';
35
+ return t(`webitelUI.filters.${value}`);
36
+ });
28
37
 
29
38
  const v$ = useVuelidate(
30
39
  computed(() => ({
@@ -40,13 +49,16 @@ const v$ = useVuelidate(
40
49
  },
41
50
  );
42
51
 
43
- if (!props?.disableValidation) v$.value.$touch();
44
52
  const emit = defineEmits<{
45
53
  'update:invalid': [
46
54
  boolean,
47
55
  ];
48
56
  }>();
49
57
 
58
+ onMounted(() => {
59
+ if (!props.disableValidation) v$.value.$touch();
60
+ });
61
+
50
62
  watch(
51
63
  () => v$.value.$invalid,
52
64
  (invalid) => {
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <wt-multi-select
3
- :label="t('webitelUI.filters.filterValue')"
3
+ :label="labelValue"
4
4
  :search-method="searchGateway"
5
5
  :v="!disableValidation && v$.model"
6
6
  :model-value="model"
@@ -13,19 +13,21 @@
13
13
  import { useVuelidate } from '@vuelidate/core';
14
14
  import { required } from '@vuelidate/validators';
15
15
  import { WtMultiSelect } from '@webitel/ui-sdk/components';
16
- import { computed, watch } from 'vue';
16
+ import { computed, onMounted, watch } from 'vue';
17
17
  import { useI18n } from 'vue-i18n';
18
18
 
19
+ import { WtSysTypeFilterConfig } from '../../classes/FilterConfig';
19
20
  import { searchMethod } from './config.js';
20
21
 
21
22
  type ModelValue = number[];
22
23
 
24
+ const model = defineModel<ModelValue>();
25
+
23
26
  const props = defineProps<{
27
+ filterConfig?: WtSysTypeFilterConfig;
24
28
  disableValidation?: boolean;
25
29
  }>();
26
30
 
27
- const model = defineModel<ModelValue>();
28
-
29
31
  const emit = defineEmits<{
30
32
  'update:invalid': [
31
33
  boolean,
@@ -33,6 +35,13 @@ const emit = defineEmits<{
33
35
  }>();
34
36
  const { t } = useI18n();
35
37
 
38
+ const labelValue = computed(() => {
39
+ const value = props?.filterConfig?.showFilterName
40
+ ? props?.filterConfig.name
41
+ : 'filterValue';
42
+ return t(`webitelUI.filters.${value}`);
43
+ });
44
+
36
45
  const v$ = useVuelidate(
37
46
  computed(() => ({
38
47
  model: {
@@ -46,7 +55,11 @@ const v$ = useVuelidate(
46
55
  $autoDirty: true,
47
56
  },
48
57
  );
49
- if (!props?.disableValidation) v$.value.$touch();
58
+
59
+ onMounted(() => {
60
+ if (!props.disableValidation) v$.value.$touch();
61
+ });
62
+
50
63
  const searchGateway = async (params: { search?: string }) => {
51
64
  return params.search
52
65
  ? await searchMethod({
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <wt-multi-select
3
- :label="t('webitelUI.filters.filterValue')"
3
+ :label="labelValue"
4
4
  :search-method="searchMethod"
5
5
  :model-value="model"
6
6
  :v="!disableValidation && v$.model"
@@ -13,19 +13,21 @@
13
13
  import { useVuelidate } from '@vuelidate/core';
14
14
  import { required } from '@vuelidate/validators';
15
15
  import { WtMultiSelect } from '@webitel/ui-sdk/components';
16
- import { computed, watch } from 'vue';
16
+ import { computed, onMounted, watch } from 'vue';
17
17
  import { useI18n } from 'vue-i18n';
18
18
 
19
+ import { WtSysTypeFilterConfig } from '../../classes/FilterConfig';
19
20
  import { searchMethod } from './config.js';
20
21
 
21
22
  type ModelValue = number[];
22
23
 
24
+ const model = defineModel<ModelValue>();
25
+
23
26
  const props = defineProps<{
27
+ filterConfig?: WtSysTypeFilterConfig;
24
28
  disableValidation?: boolean;
25
29
  }>();
26
30
 
27
- const model = defineModel<ModelValue>();
28
-
29
31
  const emit = defineEmits<{
30
32
  'update:invalid': [
31
33
  boolean,
@@ -33,6 +35,13 @@ const emit = defineEmits<{
33
35
  }>();
34
36
  const { t } = useI18n();
35
37
 
38
+ const labelValue = computed(() => {
39
+ const value = props?.filterConfig?.showFilterName
40
+ ? props?.filterConfig.name
41
+ : 'filterValue';
42
+ return t(`webitelUI.filters.${value}`);
43
+ });
44
+
36
45
  const v$ = useVuelidate(
37
46
  computed(() => ({
38
47
  model: {
@@ -46,7 +55,11 @@ const v$ = useVuelidate(
46
55
  $autoDirty: true,
47
56
  },
48
57
  );
49
- if (!props?.disableValidation) v$.value.$touch();
58
+
59
+ onMounted(() => {
60
+ if (!props.disableValidation) v$.value.$touch();
61
+ });
62
+
50
63
  watch(
51
64
  () => v$.value.$invalid,
52
65
  (invalid) => {