@webitel/ui-datalist 26.8.10 → 26.8.12

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.
Files changed (26) hide show
  1. package/package.json +1 -1
  2. package/src/modules/filters/components/config/dynamic-view/dynamic-filter-config-form.vue +1 -0
  3. package/src/modules/filters/components/config/static-view/__tests__/static-filter-field.spec.ts +127 -0
  4. package/src/modules/filters/components/config/static-view/static-filter-field.vue +17 -2
  5. package/src/modules/filters/composables/useFilterConfigsToolkit.ts +5 -5
  6. package/src/modules/filters/composables/useFilterValueChange.ts +1 -10
  7. package/src/modules/filters/modules/filterConfig/classes/FilterConfig.ts +9 -1
  8. package/src/modules/filters/modules/filterConfig/components/_shared/date-time-filter/date-time-options/__tests__/date-time-options-filter-value-field.spec.ts +43 -0
  9. package/src/modules/filters/modules/filterConfig/components/_shared/date-time-filter/date-time-options/date-time-options-filter-value-field.vue +81 -43
  10. package/src/modules/filters/modules/filterConfig/components/_shared/date-time-filter/filterConfig.ts +27 -0
  11. package/src/modules/filters/modules/filterConfig/components/_shared/string-filter/string-filter-value-field.vue +11 -2
  12. package/src/modules/filters/modules/filterConfig/components/agent/agent-filter-value-field.vue +4 -9
  13. package/src/modules/filters/modules/filterConfig/components/call-direction/call-direction-filter-value-field.vue +0 -4
  14. package/src/modules/filters/modules/filterConfig/components/gateway/gateway-filter-value-field.vue +0 -4
  15. package/src/modules/filters/modules/filterConfig/components/rating/rating-from-to-filter-value-field.vue +33 -7
  16. package/src/modules/filters/modules/filterConfig/components/user/user-filter-value-field.vue +0 -4
  17. package/src/modules/filters/modules/filterConfig/index.ts +2 -1
  18. package/types/.tsbuildinfo +1 -1
  19. package/types/modules/filters/composables/useFilterValueChange.d.ts +0 -10
  20. package/types/modules/filters/modules/filterConfig/classes/FilterConfig.d.ts +5 -1
  21. package/types/modules/filters/modules/filterConfig/components/_shared/date-time-filter/date-time-options/date-time-options-filter-value-field.vue.d.ts +10 -0
  22. package/types/modules/filters/modules/filterConfig/components/_shared/date-time-filter/filterConfig.d.ts +7 -0
  23. package/types/modules/filters/modules/filterConfig/components/_shared/string-filter/string-filter-value-field.vue.d.ts +2 -0
  24. package/types/modules/filters/modules/filterConfig/components/agent/agent-filter-value-field.vue.d.ts +2 -2
  25. package/types/modules/filters/modules/filterConfig/components/rating/rating-from-to-filter-value-field.vue.d.ts +5 -3
  26. package/types/modules/filters/modules/filterConfig/index.d.ts +2 -1
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="rating-from-to-filter-value-field">
3
3
  <wt-input-number
4
- :label="`${t('reusable.from')}:`"
4
+ :label="fromLabel"
5
5
  :placeholder="t('webitelUI.filters.filterValue')"
6
6
  :v="!disableValidation && vFrom"
7
7
  :model-value="value.from"
@@ -10,7 +10,7 @@
10
10
  />
11
11
 
12
12
  <wt-input-number
13
- :label="`${t('reusable.to')}:`"
13
+ :label="toLabel"
14
14
  :placeholder="t('webitelUI.filters.filterValue')"
15
15
  :v="!disableValidation && vTo"
16
16
  :model-value="value.to"
@@ -23,17 +23,20 @@
23
23
  <script lang="ts" setup>
24
24
  import { useVuelidate } from '@vuelidate/core';
25
25
  import { maxValue, requiredIf } from '@vuelidate/validators';
26
- import { computed, watch } from 'vue';
26
+ import { computed, onMounted, watch } from 'vue';
27
27
  import { useI18n } from 'vue-i18n';
28
28
 
29
- const props = defineProps<{
30
- disableValidation?: boolean;
31
- }>();
29
+ import type { BaseFilterConfig } from '../../classes/FilterConfig';
32
30
 
33
31
  type ModelValue = {
34
32
  from: number | null;
35
33
  to: number | null;
36
34
  };
35
+
36
+ const props = defineProps<{
37
+ filterConfig?: BaseFilterConfig;
38
+ disableValidation?: boolean;
39
+ }>();
37
40
  const model = defineModel<ModelValue>({
38
41
  default: (): ModelValue => ({
39
42
  from: null,
@@ -57,6 +60,25 @@ const emit = defineEmits<{
57
60
 
58
61
  const { t } = useI18n();
59
62
 
63
+ /** in the static panel every filter is shown at once, so each needs its own name */
64
+ const filterNamePrefix = computed(() =>
65
+ props.filterConfig?.showFilterName
66
+ ? `${t(`webitelUI.filters.${props.filterConfig.name}`)}: `
67
+ : '',
68
+ );
69
+
70
+ const fromLabel = computed(() =>
71
+ filterNamePrefix.value
72
+ ? `${filterNamePrefix.value}${t('reusable.from')}`
73
+ : `${t('reusable.from')}:`,
74
+ );
75
+
76
+ const toLabel = computed(() =>
77
+ filterNamePrefix.value
78
+ ? `${filterNamePrefix.value}${t('reusable.to')}`
79
+ : `${t('reusable.to')}:`,
80
+ );
81
+
60
82
  const v$ = useVuelidate<{
61
83
  model: ModelValue;
62
84
  }>(
@@ -84,7 +106,11 @@ const v$ = useVuelidate<{
84
106
  $autoDirty: true,
85
107
  },
86
108
  );
87
- if (!props?.disableValidation) v$.value.$touch();
109
+
110
+ onMounted(() => {
111
+ if (!props.disableValidation) v$.value.$touch();
112
+ });
113
+
88
114
  const vFrom = computed(() => {
89
115
  const modelValidation = v$.value.model;
90
116
  if (!modelValidation) return undefined;
@@ -21,10 +21,6 @@ import { searchMethod } from './config.js';
21
21
 
22
22
  type ModelValue = number[];
23
23
 
24
- const props = defineProps<{
25
- disableValidation?: boolean;
26
- }>();
27
-
28
24
  const model = defineModel<ModelValue>();
29
25
 
30
26
  const props = defineProps<{
@@ -3,5 +3,6 @@ export * from './types/DynamicFilterPreviewComponent';
3
3
  export * from './types/FilterConfigDefinition';
4
4
 
5
5
  import { createFilterConfig } from './classes/createFilterConfig';
6
+ import { createDateRangeFilterConfig } from './components/_shared/date-time-filter/filterConfig';
6
7
 
7
- export { createFilterConfig };
8
+ export { createDateRangeFilterConfig, createFilterConfig };