@webitel/ui-datalist 26.12.3 → 26.12.5
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 +1 -1
- package/src/modules/filters/modules/filterConfig/components/flow-type/flow-type-filter-value-field.vue +77 -0
- package/src/modules/filters/modules/filterConfig/components/flow-type/flow-type-filter-value-preview.vue +34 -0
- package/src/modules/filters/modules/filterConfig/components/index.ts +6 -0
- package/src/modules/filters/modules/filterConfig/components/tags/index.ts +17 -1
- package/src/modules/filters/modules/filterConfig/components/tags/tags-filter-value-field.vue +12 -2
- package/src/modules/filters/modules/filterConfig/composables/useFlowTypeOptions.ts +21 -0
- package/src/modules/filters/modules/filterConfig/enums/FilterOption.ts +1 -0
- package/src/modules/filters/modules/filterConfig/index.ts +6 -1
- package/src/modules/permissions-page/stores/createPermissionsStore.ts +3 -1
- package/types/.tsbuildinfo +1 -1
- package/types/modules/filters/modules/filterConfig/components/flow-type/flow-type-filter-value-field.vue.d.ts +18 -0
- package/types/modules/filters/modules/filterConfig/components/flow-type/flow-type-filter-value-preview.vue.d.ts +6 -0
- package/types/modules/filters/modules/filterConfig/components/index.d.ts +3 -1
- package/types/modules/filters/modules/filterConfig/components/tags/index.d.ts +32 -0
- package/types/modules/filters/modules/filterConfig/composables/useFlowTypeOptions.d.ts +7 -0
- package/types/modules/filters/modules/filterConfig/enums/FilterOption.d.ts +1 -0
- package/types/modules/filters/modules/filterConfig/index.d.ts +2 -1
package/package.json
CHANGED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<wt-multi-select
|
|
3
|
+
:label="labelValue"
|
|
4
|
+
:options="options"
|
|
5
|
+
v-model:model-value="model"
|
|
6
|
+
:v="!disableValidation && v$.model"
|
|
7
|
+
data-key="value"
|
|
8
|
+
option-label="label"
|
|
9
|
+
option-value="value"
|
|
10
|
+
/>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script lang="ts" setup>
|
|
14
|
+
import { useVuelidate } from '@vuelidate/core';
|
|
15
|
+
import { required } from '@vuelidate/validators';
|
|
16
|
+
import { WtMultiSelect } from '@webitel/ui-sdk/components';
|
|
17
|
+
import { computed, onMounted, watch } from 'vue';
|
|
18
|
+
import { useI18n } from 'vue-i18n';
|
|
19
|
+
import { WtSysTypeFilterConfig } from '../../classes/FilterConfig';
|
|
20
|
+
import { useFlowTypeOptions } from '../../composables/useFlowTypeOptions';
|
|
21
|
+
|
|
22
|
+
const model = defineModel<string[]>();
|
|
23
|
+
const { t } = useI18n();
|
|
24
|
+
|
|
25
|
+
const props = defineProps<{
|
|
26
|
+
filterConfig?: WtSysTypeFilterConfig;
|
|
27
|
+
disableValidation?: boolean;
|
|
28
|
+
}>();
|
|
29
|
+
|
|
30
|
+
const v$ = useVuelidate(
|
|
31
|
+
computed(() => ({
|
|
32
|
+
model: {
|
|
33
|
+
required,
|
|
34
|
+
},
|
|
35
|
+
})),
|
|
36
|
+
{
|
|
37
|
+
model,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
$autoDirty: true,
|
|
41
|
+
},
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const emit = defineEmits<{
|
|
45
|
+
'update:invalid': [
|
|
46
|
+
boolean,
|
|
47
|
+
];
|
|
48
|
+
}>();
|
|
49
|
+
|
|
50
|
+
const labelValue = computed(() =>
|
|
51
|
+
t(
|
|
52
|
+
`webitelUI.filters.${
|
|
53
|
+
props?.filterConfig?.showFilterName
|
|
54
|
+
? props?.filterConfig.name
|
|
55
|
+
: 'filterValue'
|
|
56
|
+
}`,
|
|
57
|
+
),
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
const { options } = useFlowTypeOptions();
|
|
61
|
+
|
|
62
|
+
onMounted(() => {
|
|
63
|
+
if (!props?.disableValidation) v$.value.$touch();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
watch(
|
|
67
|
+
() => v$.value.$invalid,
|
|
68
|
+
(invalid) => {
|
|
69
|
+
emit('update:invalid', invalid);
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
immediate: true,
|
|
73
|
+
},
|
|
74
|
+
);
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<style scoped></style>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ul>
|
|
3
|
+
<li
|
|
4
|
+
v-for="(label, index) of arrayValues"
|
|
5
|
+
:key="index"
|
|
6
|
+
>
|
|
7
|
+
{{ label }}
|
|
8
|
+
</li>
|
|
9
|
+
</ul>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script lang="ts" setup>
|
|
13
|
+
import { computed } from 'vue';
|
|
14
|
+
import { useFlowTypeOptions } from '../../composables/useFlowTypeOptions';
|
|
15
|
+
|
|
16
|
+
const props = defineProps<{
|
|
17
|
+
value: string[];
|
|
18
|
+
}>();
|
|
19
|
+
|
|
20
|
+
const { options } = useFlowTypeOptions();
|
|
21
|
+
|
|
22
|
+
const arrayLabels = computed(() =>
|
|
23
|
+
options.value.reduce<Record<string, string>>((acc, { value, label }) => {
|
|
24
|
+
acc[value] = label;
|
|
25
|
+
return acc;
|
|
26
|
+
}, {}),
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const arrayValues = computed(() =>
|
|
30
|
+
(props.value ?? []).map((v) => arrayLabels.value[v] || v),
|
|
31
|
+
);
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<style scoped></style>
|
|
@@ -75,6 +75,8 @@ import ContactLabelFilterPreview from './contact-label/contact-label-filter-valu
|
|
|
75
75
|
import { createContactOwnerFilterConfig } from './contact-owner';
|
|
76
76
|
import ContactOwnerFilter from './contact-owner/contact-owner-filter-value-field.vue';
|
|
77
77
|
import ContactOwnerFilterPreview from './contact-owner/contact-owner-filter-value-preview.vue';
|
|
78
|
+
import FlowTypeFilter from './flow-type/flow-type-filter-value-field.vue';
|
|
79
|
+
import FlowTypeFilterPreview from './flow-type/flow-type-filter-value-preview.vue';
|
|
78
80
|
import { createGatewayFilterConfig } from './gateway';
|
|
79
81
|
import GatewayFilter from './gateway/gateway-filter-value-field.vue';
|
|
80
82
|
import GatewayFilterPreview from './gateway/gateway-filter-value-preview.vue';
|
|
@@ -195,6 +197,8 @@ export {
|
|
|
195
197
|
ContactOwnerFilter,
|
|
196
198
|
ContactOwnerFilterPreview,
|
|
197
199
|
DateTimeOptionsFilterValueField,
|
|
200
|
+
FlowTypeFilter,
|
|
201
|
+
FlowTypeFilterPreview,
|
|
198
202
|
GatewayFilter,
|
|
199
203
|
GatewayFilterPreview,
|
|
200
204
|
GranteeFilter,
|
|
@@ -269,6 +273,7 @@ export const FilterOptionToValueComponentMap: Record<FilterOption, Component> =
|
|
|
269
273
|
[FilterOption.HangupCause]: HangupCauseFilterValueField,
|
|
270
274
|
[FilterOption.Queue]: QueueFilter,
|
|
271
275
|
[FilterOption.QueueType]: QueueTypeFilter,
|
|
276
|
+
[FilterOption.FlowType]: FlowTypeFilter,
|
|
272
277
|
[FilterOption.QueuePeriod]: QueuePeriodFilter,
|
|
273
278
|
[FilterOption.RatedBy]: RatedByFilter,
|
|
274
279
|
[FilterOption.HasFile]: HasFileFilter,
|
|
@@ -350,6 +355,7 @@ export const FilterOptionToPreviewComponentMap: Record<
|
|
|
350
355
|
[FilterOption.HangupCause]: HangupCauseFilterValuePreview,
|
|
351
356
|
[FilterOption.Queue]: QueueFilterPreview,
|
|
352
357
|
[FilterOption.QueueType]: QueueTypeFilterPreview,
|
|
358
|
+
[FilterOption.FlowType]: FlowTypeFilterPreview,
|
|
353
359
|
[FilterOption.QueuePeriod]: QueuePeriodFilterPreview,
|
|
354
360
|
[FilterOption.RatedBy]: RatedByFilterPreview,
|
|
355
361
|
[FilterOption.HasFile]: HasFileFilterPreview,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { QueuesAPI } from '@webitel/api-services/api';
|
|
1
|
+
import { FlowsAPI, QueuesAPI } from '@webitel/api-services/api';
|
|
2
2
|
import { WtObject } from '@webitel/ui-sdk/enums';
|
|
3
3
|
|
|
4
4
|
import {
|
|
@@ -20,3 +20,19 @@ class QueueTagsFilterConfig extends WtSysTypeFilterConfig {
|
|
|
20
20
|
|
|
21
21
|
export const createQueueTagsFilterConfig = (params?: FilterConfigBaseParams) =>
|
|
22
22
|
new QueueTagsFilterConfig(params);
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* [Claude] Flow tags share the queue tags shape and the `tags` request param, so
|
|
26
|
+
* this config keeps the same name and components and swaps only the search.
|
|
27
|
+
* It isn't in the name → creator map (that slot is queue tags): create it directly.
|
|
28
|
+
*/
|
|
29
|
+
class FlowTagsFilterConfig extends WtSysTypeFilterConfig {
|
|
30
|
+
readonly name = FilterOption.QueueTags;
|
|
31
|
+
valueInputComponent = TagsFilterValueField;
|
|
32
|
+
valuePreviewComponent = TagsFilterValuePreview;
|
|
33
|
+
|
|
34
|
+
searchRecords = gateFilterSearch(WtObject.Flow, FlowsAPI.getFlowTags);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const createFlowTagsFilterConfig = (params?: FilterConfigBaseParams) =>
|
|
38
|
+
new FlowTagsFilterConfig(params);
|
package/src/modules/filters/modules/filterConfig/components/tags/tags-filter-value-field.vue
CHANGED
|
@@ -21,7 +21,10 @@ import { computed, onMounted, watch } from 'vue';
|
|
|
21
21
|
import { useI18n } from 'vue-i18n';
|
|
22
22
|
|
|
23
23
|
import { WtSysTypeFilterConfig } from '../../classes/FilterConfig';
|
|
24
|
-
import {
|
|
24
|
+
import {
|
|
25
|
+
type GatedFilterSearch,
|
|
26
|
+
useFilterReadAccess,
|
|
27
|
+
} from '../../composables/useFilterReadAccess';
|
|
25
28
|
|
|
26
29
|
/**
|
|
27
30
|
* Queue tags are free-form strings, so the filter stores names rather than ids
|
|
@@ -47,7 +50,14 @@ const emit = defineEmits<{
|
|
|
47
50
|
}>();
|
|
48
51
|
const { t } = useI18n();
|
|
49
52
|
|
|
50
|
-
|
|
53
|
+
// [Claude] the access object comes from the config's gated search, so flow tags reuse this field
|
|
54
|
+
const accessObject =
|
|
55
|
+
(
|
|
56
|
+
props.filterConfig.searchRecords as Partial<
|
|
57
|
+
GatedFilterSearch<unknown[], unknown>
|
|
58
|
+
>
|
|
59
|
+
).accessObject ?? WtObject.Queue;
|
|
60
|
+
const { hasReadAccess, gateSearch } = useFilterReadAccess(accessObject);
|
|
51
61
|
const searchMethod = gateSearch(props.filterConfig.searchRecords);
|
|
52
62
|
|
|
53
63
|
const labelValue = computed(() =>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { EngineRoutingSchemaType } from '@webitel/api-services/gen/models';
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
import { useI18n } from 'vue-i18n';
|
|
4
|
+
|
|
5
|
+
/** [Claude] every flow type but "default" — the flows API adds it to any type filter itself */
|
|
6
|
+
export function useFlowTypeOptions() {
|
|
7
|
+
const { t } = useI18n();
|
|
8
|
+
|
|
9
|
+
const options = computed(() =>
|
|
10
|
+
Object.values(EngineRoutingSchemaType)
|
|
11
|
+
.filter((value) => value !== EngineRoutingSchemaType.Default)
|
|
12
|
+
.map((value) => ({
|
|
13
|
+
value,
|
|
14
|
+
label: t(`objects.flow.type.${value}`),
|
|
15
|
+
})),
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
options,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -4,5 +4,10 @@ export * from './types/FilterConfigDefinition';
|
|
|
4
4
|
|
|
5
5
|
import { createFilterConfig } from './classes/createFilterConfig';
|
|
6
6
|
import { createDateRangeFilterConfig } from './components/_shared/date-time-filter/filterConfig';
|
|
7
|
+
import { createFlowTagsFilterConfig } from './components/tags';
|
|
7
8
|
|
|
8
|
-
export {
|
|
9
|
+
export {
|
|
10
|
+
createDateRangeFilterConfig,
|
|
11
|
+
createFilterConfig,
|
|
12
|
+
createFlowTagsFilterConfig,
|
|
13
|
+
};
|