@webitel/ui-datalist 26.8.8 → 26.8.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.
Files changed (19) hide show
  1. package/package.json +1 -1
  2. package/src/modules/filters/components/column/column-filter-preview.vue +2 -2
  3. package/src/modules/filters/components/column/column-filter.vue +3 -2
  4. package/src/modules/filters/composables/useColumnFilter.ts +3 -3
  5. package/src/modules/filters/modules/filterConfig/components/agent/agent-filter-value-field.vue +19 -3
  6. package/src/modules/filters/modules/filterConfig/components/call-direction/call-direction-filter-value-field.vue +19 -3
  7. package/src/modules/filters/modules/filterConfig/components/gateway/gateway-filter-value-field.vue +20 -3
  8. package/src/modules/filters/modules/filterConfig/components/user/user-filter-value-field.vue +20 -3
  9. package/src/modules/types/tableStore.types.ts +13 -15
  10. package/types/.tsbuildinfo +1 -1
  11. package/types/modules/filters/components/column/column-filter-preview.vue.d.ts +2 -2
  12. package/types/modules/filters/components/column/column-filter.vue.d.ts +2 -2
  13. package/types/modules/filters/composables/useColumnFilter.d.ts +2 -2
  14. package/types/modules/filters/modules/filterConfig/components/agent/agent-filter-value-field.vue.d.ts +2 -0
  15. package/types/modules/filters/modules/filterConfig/components/call-direction/call-direction-filter-value-field.vue.d.ts +2 -0
  16. package/types/modules/filters/modules/filterConfig/components/gateway/gateway-filter-value-field.vue.d.ts +2 -0
  17. package/types/modules/filters/modules/filterConfig/components/user/user-filter-value-field.vue.d.ts +2 -0
  18. package/types/modules/headers/createTableHeadersStore.d.ts +36 -36
  19. package/types/modules/types/tableStore.types.d.ts +10 -14
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-datalist",
3
- "version": "26.8.8",
3
+ "version": "26.8.10",
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",
@@ -26,9 +26,9 @@
26
26
  <script lang="ts" setup>
27
27
  import type { DataField } from '@webitel/api-services/gen/models';
28
28
  import { WtLoader } from '@webitel/ui-sdk/components';
29
+ import type { WtTableHeader } from '@webitel/ui-sdk/components/wt-table/types/WtTable';
29
30
  import { ComponentSize } from '@webitel/ui-sdk/enums';
30
31
 
31
- import type { DatalistTableHeader } from '../../../types/tableStore.types';
32
32
  import type { IFiltersManager } from '../../classes/FiltersManager';
33
33
  import { useColumnFilter } from '../../composables/useColumnFilter';
34
34
  import { useFilterValuePreview } from '../../composables/useFilterValuePreview';
@@ -42,7 +42,7 @@ import DynamicFilterPreviewInfo from '../preview/dynamic-filter-preview-info.vue
42
42
  * [WTEL-7727](https://webitel.atlassian.net/browse/WTEL-7727)
43
43
  */
44
44
  const props = defineProps<{
45
- header: DatalistTableHeader;
45
+ header: WtTableHeader;
46
46
  filtersManager: IFiltersManager;
47
47
  /** the page's filter definitions; a configured one is reused for the matching header */
48
48
  filterOptions?: FilterConfigDefinition[];
@@ -20,7 +20,8 @@
20
20
  <script lang="ts" setup>
21
21
  import type { DataField } from '@webitel/api-services/gen/models';
22
22
 
23
- import type { DatalistTableHeader } from '../../../types/tableStore.types';
23
+ import type { WtTableHeader } from '@webitel/ui-sdk/components/wt-table/types/WtTable';
24
+
24
25
  import type { FilterInitParams } from '../../classes/Filter';
25
26
  import type { IFiltersManager } from '../../classes/FiltersManager';
26
27
  import { useColumnFilter } from '../../composables/useColumnFilter';
@@ -41,7 +42,7 @@ import ColumnFilterPreview from './column-filter-preview.vue';
41
42
  * [WTEL-7727](https://webitel.atlassian.net/browse/WTEL-7727)
42
43
  */
43
44
  const props = defineProps<{
44
- header: DatalistTableHeader;
45
+ header: WtTableHeader;
45
46
  filtersManager: IFiltersManager;
46
47
  filterOptions?: FilterConfigDefinition[];
47
48
  filterableExtensionFields?: DataField[];
@@ -1,8 +1,8 @@
1
1
  import type { DataField } from '@webitel/api-services/gen/models';
2
+ import type { WtTableHeader } from '@webitel/ui-sdk/components/wt-table/types/WtTable';
2
3
  import { computed, type MaybeRefOrGetter, toValue } from 'vue';
3
4
  import { useI18n } from 'vue-i18n';
4
5
 
5
- import type { DatalistTableHeader } from '../../types/tableStore.types';
6
6
  import type { FilterName } from '../classes/Filter';
7
7
  import type { IFiltersManager } from '../classes/FiltersManager';
8
8
  import { createFilterConfig } from '../modules/filterConfig/classes/createFilterConfig';
@@ -14,7 +14,7 @@ import { createTypeExtensionFilterConfig } from '../modules/filterConfig/compone
14
14
  import type { FilterConfigDefinition } from '../modules/filterConfig/types/FilterConfigDefinition';
15
15
 
16
16
  const isResolvedFilterConfig = (
17
- filter: DatalistTableHeader['filter'],
17
+ filter: WtTableHeader['filter'],
18
18
  ): filter is AnyFilterConfig => typeof filter === 'object' && filter !== null;
19
19
 
20
20
  /**
@@ -36,7 +36,7 @@ export const useColumnFilter = ({
36
36
  filterOptions = [],
37
37
  filterableExtensionFields = [],
38
38
  }: {
39
- header: MaybeRefOrGetter<DatalistTableHeader>;
39
+ header: MaybeRefOrGetter<WtTableHeader>;
40
40
  filtersManager: MaybeRefOrGetter<IFiltersManager>;
41
41
  filterOptions?: MaybeRefOrGetter<FilterConfigDefinition[]>;
42
42
  filterableExtensionFields?: MaybeRefOrGetter<DataField[]>;
@@ -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,9 +13,10 @@
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[];
@@ -26,6 +27,11 @@ const props = defineProps<{
26
27
 
27
28
  const model = defineModel<ModelValue>();
28
29
 
30
+ const props = defineProps<{
31
+ filterConfig?: WtSysTypeFilterConfig;
32
+ disableValidation?: boolean;
33
+ }>();
34
+
29
35
  const emit = defineEmits<{
30
36
  'update:invalid': [
31
37
  boolean,
@@ -34,6 +40,13 @@ const emit = defineEmits<{
34
40
 
35
41
  const { t } = useI18n();
36
42
 
43
+ const labelValue = computed(() => {
44
+ const value = props?.filterConfig?.showFilterName
45
+ ? props?.filterConfig.name
46
+ : 'filterValue';
47
+ return t(`webitelUI.filters.${value}`);
48
+ });
49
+
37
50
  const v$ = useVuelidate(
38
51
  computed(() => ({
39
52
  model: {
@@ -48,7 +61,10 @@ const v$ = useVuelidate(
48
61
  },
49
62
  );
50
63
 
51
- if (!props?.disableValidation) v$.value.$touch();
64
+ onMounted(() => {
65
+ if (!props.disableValidation) v$.value.$touch();
66
+ });
67
+
52
68
  watch(
53
69
  () => v$.value.$invalid,
54
70
  (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,9 +14,10 @@
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
 
22
23
  const props = defineProps<{
@@ -26,6 +27,18 @@ const props = defineProps<{
26
27
  const model = defineModel<string>();
27
28
  const { t } = useI18n();
28
29
 
30
+ const props = defineProps<{
31
+ filterConfig?: WtSysTypeFilterConfig;
32
+ disableValidation?: boolean;
33
+ }>();
34
+
35
+ const labelValue = computed(() => {
36
+ const value = props?.filterConfig?.showFilterName
37
+ ? props?.filterConfig.name
38
+ : 'filterValue';
39
+ return t(`webitelUI.filters.${value}`);
40
+ });
41
+
29
42
  const v$ = useVuelidate(
30
43
  computed(() => ({
31
44
  model: {
@@ -40,13 +53,16 @@ const v$ = useVuelidate(
40
53
  },
41
54
  );
42
55
 
43
- if (!props?.disableValidation) v$.value.$touch();
44
56
  const emit = defineEmits<{
45
57
  'update:invalid': [
46
58
  boolean,
47
59
  ];
48
60
  }>();
49
61
 
62
+ onMounted(() => {
63
+ if (!props.disableValidation) v$.value.$touch();
64
+ });
65
+
50
66
  watch(
51
67
  () => v$.value.$invalid,
52
68
  (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,9 +13,10 @@
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[];
@@ -26,6 +27,11 @@ const props = defineProps<{
26
27
 
27
28
  const model = defineModel<ModelValue>();
28
29
 
30
+ const props = defineProps<{
31
+ filterConfig?: WtSysTypeFilterConfig;
32
+ disableValidation?: boolean;
33
+ }>();
34
+
29
35
  const emit = defineEmits<{
30
36
  'update:invalid': [
31
37
  boolean,
@@ -33,6 +39,13 @@ const emit = defineEmits<{
33
39
  }>();
34
40
  const { t } = useI18n();
35
41
 
42
+ const labelValue = computed(() => {
43
+ const value = props?.filterConfig?.showFilterName
44
+ ? props?.filterConfig.name
45
+ : 'filterValue';
46
+ return t(`webitelUI.filters.${value}`);
47
+ });
48
+
36
49
  const v$ = useVuelidate(
37
50
  computed(() => ({
38
51
  model: {
@@ -46,7 +59,11 @@ const v$ = useVuelidate(
46
59
  $autoDirty: true,
47
60
  },
48
61
  );
49
- if (!props?.disableValidation) v$.value.$touch();
62
+
63
+ onMounted(() => {
64
+ if (!props.disableValidation) v$.value.$touch();
65
+ });
66
+
50
67
  const searchGateway = async (params: { search?: string }) => {
51
68
  return params.search
52
69
  ? 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,9 +13,10 @@
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[];
@@ -26,6 +27,11 @@ const props = defineProps<{
26
27
 
27
28
  const model = defineModel<ModelValue>();
28
29
 
30
+ const props = defineProps<{
31
+ filterConfig?: WtSysTypeFilterConfig;
32
+ disableValidation?: boolean;
33
+ }>();
34
+
29
35
  const emit = defineEmits<{
30
36
  'update:invalid': [
31
37
  boolean,
@@ -33,6 +39,13 @@ const emit = defineEmits<{
33
39
  }>();
34
40
  const { t } = useI18n();
35
41
 
42
+ const labelValue = computed(() => {
43
+ const value = props?.filterConfig?.showFilterName
44
+ ? props?.filterConfig.name
45
+ : 'filterValue';
46
+ return t(`webitelUI.filters.${value}`);
47
+ });
48
+
36
49
  const v$ = useVuelidate(
37
50
  computed(() => ({
38
51
  model: {
@@ -46,7 +59,11 @@ const v$ = useVuelidate(
46
59
  $autoDirty: true,
47
60
  },
48
61
  );
49
- if (!props?.disableValidation) v$.value.$touch();
62
+
63
+ onMounted(() => {
64
+ if (!props.disableValidation) v$.value.$touch();
65
+ });
66
+
50
67
  watch(
51
68
  () => v$.value.$invalid,
52
69
  (invalid) => {
@@ -1,27 +1,19 @@
1
1
  import type { ApiModule } from '@webitel/ui-sdk/api/types/ApiModule';
2
- import type { WtTableHeader } from '@webitel/ui-sdk/components/wt-table/types/WtTable';
2
+ import type {
3
+ WtTableHeader,
4
+ WtTableHeaderFilter,
5
+ } from '@webitel/ui-sdk/components/wt-table/types/WtTable';
3
6
  import type { Ref } from 'vue';
4
7
 
5
- import type { FilterName, IFiltersManager } from '../filters';
8
+ import type { IFiltersManager } from '../filters';
6
9
  import type { DatalistStoreProviderType } from './StoreProvider';
7
10
 
8
- /**
9
- * Minimal shape of an already-resolved header filter. Deliberately not the full
10
- * `AnyFilterConfig` (with its `Component` props): `createTableHeadersStore` keeps headers in a
11
- * plain `ref<DatalistTableHeader[]>`, and `Component` props there send Vue's `UnwrapRef` into
12
- * excessive type-instantiation depth (TS2589). `useColumnFilter`'s `isResolvedFilterConfig`
13
- * narrows a value of this shape back to `AnyFilterConfig` for actual use.
14
- */
15
- export type ResolvedHeaderFilter = {
16
- name: FilterName;
17
- };
18
-
19
11
  /**
20
12
  * Table header shape used inside the datalist stores. In addition to the
21
13
  * base {@link WtTableHeader} shape, datalist stores key columns by `field`
22
14
  * and may flag dynamically-appended headers for lazy initialization.
23
15
  */
24
- export type DatalistTableHeader = Omit<WtTableHeader, 'filter'> & {
16
+ export type DatalistTableHeader = WtTableHeader & {
25
17
  field: string;
26
18
  shouldBeInitialized?: boolean;
27
19
  /**
@@ -37,8 +29,14 @@ export type DatalistTableHeader = Omit<WtTableHeader, 'filter'> & {
37
29
  * config here lets `headers.ts` map the header to its filter once, instead of
38
30
  * `useColumnFilter` searching `filterOptions`/`filterableExtensionFields` for it on every
39
31
  * column.
32
+ *
33
+ * {@link WtTableHeaderFilter} deliberately keeps only the `name` of a resolved config and not
34
+ * the full `AnyFilterConfig` (with its `Component` props): `createTableHeadersStore` keeps
35
+ * headers in a plain `ref<DatalistTableHeader[]>`, and `Component` props there send Vue's
36
+ * `UnwrapRef` into excessive type-instantiation depth (TS2589). `useColumnFilter`'s
37
+ * `isResolvedFilterConfig` narrows it back to `AnyFilterConfig` for actual use.
40
38
  */
41
- filter?: WtTableHeader['filter'] | ResolvedHeaderFilter;
39
+ filter?: WtTableHeaderFilter;
42
40
  };
43
41
 
44
42
  export type TrackSelectedRowBy<T> = (row: T) => T;