@webitel/ui-datalist 26.8.21 → 26.8.22
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/action/action-filter-value-field.vue +75 -0
- package/src/modules/filters/modules/filterConfig/components/action/action-filter-value-preview.vue +35 -0
- package/src/modules/filters/modules/filterConfig/components/index.ts +14 -0
- package/src/modules/filters/modules/filterConfig/components/object/index.ts +29 -0
- package/src/modules/filters/modules/filterConfig/components/object/object-filter-value-field.vue +82 -0
- package/src/modules/filters/modules/filterConfig/components/object/object-filter-value-preview.vue +13 -0
- package/src/modules/filters/modules/filterConfig/composables/useActionOptions.ts +24 -0
- package/src/modules/filters/modules/filterConfig/enums/FilterOption.ts +3 -0
- package/types/.tsbuildinfo +1 -1
- package/types/modules/filters/modules/filterConfig/components/action/action-filter-value-field.vue.d.ts +18 -0
- package/types/modules/filters/modules/filterConfig/components/action/action-filter-value-preview.vue.d.ts +6 -0
- package/types/modules/filters/modules/filterConfig/components/index.d.ts +35 -1
- package/types/modules/filters/modules/filterConfig/components/object/index.d.ts +29 -0
- package/types/modules/filters/modules/filterConfig/components/object/object-filter-value-field.vue.d.ts +19 -0
- package/types/modules/filters/modules/filterConfig/components/object/object-filter-value-preview.vue.d.ts +6 -0
- package/types/modules/filters/modules/filterConfig/composables/useActionOptions.d.ts +6 -0
- package/types/modules/filters/modules/filterConfig/enums/FilterOption.d.ts +3 -0
package/package.json
CHANGED
package/src/modules/filters/modules/filterConfig/components/action/action-filter-value-field.vue
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<wt-multi-select
|
|
3
|
+
:label="labelValue"
|
|
4
|
+
:options="options"
|
|
5
|
+
v-model:model-value="model"
|
|
6
|
+
:v="!disableValidation && v$.model"
|
|
7
|
+
chips-view
|
|
8
|
+
data-key="value"
|
|
9
|
+
option-label="label"
|
|
10
|
+
option-value="value"
|
|
11
|
+
/>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script lang="ts" setup>
|
|
15
|
+
import { useVuelidate } from '@vuelidate/core';
|
|
16
|
+
import { required } from '@vuelidate/validators';
|
|
17
|
+
import { WtMultiSelect } from '@webitel/ui-sdk/components';
|
|
18
|
+
import { computed, onMounted, watch } from 'vue';
|
|
19
|
+
import { useI18n } from 'vue-i18n';
|
|
20
|
+
|
|
21
|
+
import { WtSysTypeFilterConfig } from '../../classes/FilterConfig';
|
|
22
|
+
import { useActionOptions } from '../../composables/useActionOptions';
|
|
23
|
+
|
|
24
|
+
const model = defineModel<string[]>();
|
|
25
|
+
const { t } = useI18n();
|
|
26
|
+
|
|
27
|
+
const props = defineProps<{
|
|
28
|
+
filterConfig?: WtSysTypeFilterConfig;
|
|
29
|
+
disableValidation?: boolean;
|
|
30
|
+
}>();
|
|
31
|
+
|
|
32
|
+
const v$ = useVuelidate(
|
|
33
|
+
computed(() => ({
|
|
34
|
+
model: {
|
|
35
|
+
required,
|
|
36
|
+
},
|
|
37
|
+
})),
|
|
38
|
+
{
|
|
39
|
+
model,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
$autoDirty: true,
|
|
43
|
+
},
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
const emit = defineEmits<{
|
|
47
|
+
'update:invalid': [
|
|
48
|
+
boolean,
|
|
49
|
+
];
|
|
50
|
+
}>();
|
|
51
|
+
|
|
52
|
+
const labelKey = computed(() =>
|
|
53
|
+
props?.filterConfig?.showFilterName ? props.filterConfig.name : 'filterValue',
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const labelValue = computed(() => t(`webitelUI.filters.${labelKey.value}`));
|
|
57
|
+
|
|
58
|
+
const { options } = useActionOptions();
|
|
59
|
+
|
|
60
|
+
onMounted(() => {
|
|
61
|
+
if (!props?.disableValidation) v$.value.$touch();
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
watch(
|
|
65
|
+
() => v$.value.$invalid,
|
|
66
|
+
(invalid) => {
|
|
67
|
+
emit('update:invalid', invalid);
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
immediate: true,
|
|
71
|
+
},
|
|
72
|
+
);
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
<style scoped></style>
|
package/src/modules/filters/modules/filterConfig/components/action/action-filter-value-preview.vue
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
|
|
15
|
+
import { useActionOptions } from '../../composables/useActionOptions';
|
|
16
|
+
|
|
17
|
+
const props = defineProps<{
|
|
18
|
+
value?: string[];
|
|
19
|
+
}>();
|
|
20
|
+
|
|
21
|
+
const { options } = useActionOptions();
|
|
22
|
+
|
|
23
|
+
const arrayLabels = computed(() =>
|
|
24
|
+
options.value.reduce<Record<string, string>>((acc, { value, label }) => {
|
|
25
|
+
acc[value] = label;
|
|
26
|
+
return acc;
|
|
27
|
+
}, {}),
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const arrayValues = computed(() =>
|
|
31
|
+
(props.value ?? []).map((v) => arrayLabels.value[v] || v),
|
|
32
|
+
);
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<style scoped></style>
|
|
@@ -5,6 +5,8 @@ import DateTimeOptionsFilterValueField from './_shared/date-time-filter/date-tim
|
|
|
5
5
|
import DateTimeOptionsFilterValuePreview from './_shared/date-time-filter/date-time-options/date-time-options-filter-value-preview.vue';
|
|
6
6
|
import StringFilterValueField from './_shared/string-filter/string-filter-value-field.vue';
|
|
7
7
|
import StringFilterValuePreview from './_shared/string-filter/string-filter-value-preview.vue';
|
|
8
|
+
import ActionFilter from './action/action-filter-value-field.vue';
|
|
9
|
+
import ActionFilterPreview from './action/action-filter-value-preview.vue';
|
|
8
10
|
import { createAgentFilterConfig } from './agent';
|
|
9
11
|
import AgentFilter from './agent/agent-filter-value-field.vue';
|
|
10
12
|
import AgentFilterPreview from './agent/agent-filter-value-preview.vue';
|
|
@@ -91,6 +93,9 @@ import HasTranscriptionFilter from './has-transcription/has-transcription-filter
|
|
|
91
93
|
import HasTranscriptionFilterPreview from './has-transcription/has-transcription-filter-value-preview.vue';
|
|
92
94
|
import HasUserFilter from './has-user/has-user-filter-value-field.vue';
|
|
93
95
|
import HasUserFilterPreview from './has-user/has-user-filter-value-preview.vue';
|
|
96
|
+
import { createObjectFilterConfig } from './object';
|
|
97
|
+
import ObjectFilter from './object/object-filter-value-field.vue';
|
|
98
|
+
import ObjectFilterPreview from './object/object-filter-value-preview.vue';
|
|
94
99
|
import { createQueueFilterConfig } from './queue';
|
|
95
100
|
import QueueFilter from './queue/queue-filter-value-field.vue';
|
|
96
101
|
import QueueFilterPreview from './queue/queue-filter-value-preview.vue';
|
|
@@ -137,6 +142,8 @@ import VariableFilter from './variable/variable-filter-value-field.vue';
|
|
|
137
142
|
import VariableFilterPreview from './variable/variable-filter-value-preview.vue';
|
|
138
143
|
|
|
139
144
|
export {
|
|
145
|
+
ActionFilter,
|
|
146
|
+
ActionFilterPreview,
|
|
140
147
|
AgentFilter,
|
|
141
148
|
AgentFilterPreview,
|
|
142
149
|
AgentStatusFilter,
|
|
@@ -204,6 +211,8 @@ export {
|
|
|
204
211
|
HasTranscriptionFilterPreview,
|
|
205
212
|
HasUserFilter,
|
|
206
213
|
HasUserFilterPreview,
|
|
214
|
+
ObjectFilter,
|
|
215
|
+
ObjectFilterPreview,
|
|
207
216
|
QueueFilter,
|
|
208
217
|
QueueFilterPreview,
|
|
209
218
|
QueuePeriodFilter,
|
|
@@ -285,6 +294,8 @@ export const FilterOptionToValueComponentMap: Record<FilterOption, Component> =
|
|
|
285
294
|
[FilterOption.MemberName]: StringFilterValueField,
|
|
286
295
|
[FilterOption.MemberDestination]: StringFilterValueField,
|
|
287
296
|
[FilterOption.CallReportingResult]: CallReportingResultFilter,
|
|
297
|
+
[FilterOption.Action]: ActionFilter,
|
|
298
|
+
[FilterOption.Object]: ObjectFilter,
|
|
288
299
|
[FilterOption.CaseStatus]: CaseStatusFilterValueField,
|
|
289
300
|
[FilterOption.CaseSource]: CaseSourceFilterValueField,
|
|
290
301
|
[FilterOption.CaseService]: CaseServiceFilterValueField,
|
|
@@ -321,6 +332,8 @@ export const FilterOptionToPreviewComponentMap: Record<
|
|
|
321
332
|
[FilterOption.MemberName]: StringFilterValuePreview,
|
|
322
333
|
[FilterOption.MemberDestination]: StringFilterValuePreview,
|
|
323
334
|
[FilterOption.CallReportingResult]: CallReportingResultFilterPreview,
|
|
335
|
+
[FilterOption.Action]: ActionFilterPreview,
|
|
336
|
+
[FilterOption.Object]: ObjectFilterPreview,
|
|
324
337
|
[FilterOption.Agent]: AgentFilterPreview,
|
|
325
338
|
[FilterOption.Region]: RegionFilterPreview,
|
|
326
339
|
[FilterOption.UtilizationProgress]: UtilizationProgressFilterPreview,
|
|
@@ -385,6 +398,7 @@ export const FilterOptionToFilterConfigCreatorMap = {
|
|
|
385
398
|
[FilterOption.CaseSlaCondition]: createCaseSlaConditionFilterConfig,
|
|
386
399
|
[FilterOption.CaseSource]: createCaseSourceFilterConfig,
|
|
387
400
|
[FilterOption.CaseStatus]: createCaseStatusFilterConfig,
|
|
401
|
+
[FilterOption.Object]: createObjectFilterConfig,
|
|
388
402
|
[FilterOption.Contact]: createContactFilterConfig,
|
|
389
403
|
[FilterOption.ContactGroup]: createContactGroupFilterConfig,
|
|
390
404
|
[FilterOption.ContactLabel]: createContactLabelFilterConfig,
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ChangelogsAPI } from '@webitel/api-services/api';
|
|
2
|
+
import { WtObject } from '@webitel/ui-sdk/enums';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
type FilterConfigBaseParams,
|
|
6
|
+
WtSysTypeFilterConfig,
|
|
7
|
+
} from '../../classes/FilterConfig';
|
|
8
|
+
import { gateFilterSearch } from '../../composables/useFilterReadAccess';
|
|
9
|
+
import { FilterOption } from '../../enums/FilterOption';
|
|
10
|
+
import ObjectFilterValueField from './object-filter-value-field.vue';
|
|
11
|
+
import ObjectFilterValuePreview from './object-filter-value-preview.vue';
|
|
12
|
+
|
|
13
|
+
class ObjectFilterConfig extends WtSysTypeFilterConfig {
|
|
14
|
+
readonly name = FilterOption.Object;
|
|
15
|
+
valueInputComponent = ObjectFilterValueField;
|
|
16
|
+
valuePreviewComponent = ObjectFilterValuePreview;
|
|
17
|
+
|
|
18
|
+
searchRecords = gateFilterSearch(
|
|
19
|
+
WtObject.ChangeLog,
|
|
20
|
+
(params: Record<string, unknown>) =>
|
|
21
|
+
ChangelogsAPI.getObjectsList({
|
|
22
|
+
...params,
|
|
23
|
+
includeExisting: true,
|
|
24
|
+
}),
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const createObjectFilterConfig = (params?: FilterConfigBaseParams) =>
|
|
29
|
+
new ObjectFilterConfig(params);
|
package/src/modules/filters/modules/filterConfig/components/object/object-filter-value-field.vue
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<wt-multi-select
|
|
3
|
+
:label="labelValue"
|
|
4
|
+
:disabled="!hasReadAccess"
|
|
5
|
+
:search-method="searchMethod"
|
|
6
|
+
:model-value="model"
|
|
7
|
+
:v="!disableValidation && v$.model"
|
|
8
|
+
option-value="id"
|
|
9
|
+
@update:model-value="handleInput"
|
|
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 { WtObject } from '@webitel/ui-sdk/enums';
|
|
18
|
+
import { computed, onMounted, watch } from 'vue';
|
|
19
|
+
import { useI18n } from 'vue-i18n';
|
|
20
|
+
|
|
21
|
+
import { WtSysTypeFilterConfig } from '../../classes/FilterConfig';
|
|
22
|
+
import { useFilterReadAccess } from '../../composables/useFilterReadAccess';
|
|
23
|
+
|
|
24
|
+
type ModelValue = number[];
|
|
25
|
+
|
|
26
|
+
const props = defineProps<{
|
|
27
|
+
filterConfig: WtSysTypeFilterConfig;
|
|
28
|
+
disableValidation?: boolean;
|
|
29
|
+
}>();
|
|
30
|
+
|
|
31
|
+
const model = defineModel<ModelValue>();
|
|
32
|
+
|
|
33
|
+
const emit = defineEmits<{
|
|
34
|
+
'update:invalid': [
|
|
35
|
+
boolean,
|
|
36
|
+
];
|
|
37
|
+
}>();
|
|
38
|
+
const { t } = useI18n();
|
|
39
|
+
|
|
40
|
+
const { hasReadAccess, gateSearch } = useFilterReadAccess(WtObject.ChangeLog);
|
|
41
|
+
const searchMethod = gateSearch(props.filterConfig.searchRecords);
|
|
42
|
+
|
|
43
|
+
const labelKey = computed(() =>
|
|
44
|
+
props?.filterConfig?.showFilterName ? props.filterConfig.name : 'filterValue',
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
const labelValue = computed(() => t(`webitelUI.filters.${labelKey.value}`));
|
|
48
|
+
|
|
49
|
+
const v$ = useVuelidate(
|
|
50
|
+
computed(() => ({
|
|
51
|
+
model: {
|
|
52
|
+
required,
|
|
53
|
+
},
|
|
54
|
+
})),
|
|
55
|
+
{
|
|
56
|
+
model,
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
$autoDirty: true,
|
|
60
|
+
},
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
onMounted(() => {
|
|
64
|
+
if (!props?.disableValidation) v$.value.$touch();
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
watch(
|
|
68
|
+
() => v$.value.$invalid,
|
|
69
|
+
(invalid) => {
|
|
70
|
+
emit('update:invalid', invalid);
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
immediate: true,
|
|
74
|
+
},
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
const handleInput = (value: ModelValue) => {
|
|
78
|
+
model.value = value;
|
|
79
|
+
};
|
|
80
|
+
</script>
|
|
81
|
+
|
|
82
|
+
<style scoped></style>
|
package/src/modules/filters/modules/filterConfig/components/object/object-filter-value-preview.vue
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<lookup-filter-value-preview v-bind="props" />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script lang="ts" setup>
|
|
6
|
+
import LookupFilterValuePreview from '../_shared/lookup-filter-preview/lookup-filter-value-preview.vue';
|
|
7
|
+
|
|
8
|
+
const props = defineProps<{
|
|
9
|
+
value: unknown[];
|
|
10
|
+
}>();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<style scoped></style>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { LoggerAction } from '@webitel/api-services/gen/models';
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
import { useI18n } from 'vue-i18n';
|
|
4
|
+
|
|
5
|
+
const ActionLocale = {
|
|
6
|
+
[LoggerAction.Create]: 'reusable.create',
|
|
7
|
+
[LoggerAction.Update]: 'reusable.edit',
|
|
8
|
+
[LoggerAction.Delete]: 'reusable.delete',
|
|
9
|
+
} as const;
|
|
10
|
+
|
|
11
|
+
export function useActionOptions() {
|
|
12
|
+
const { t } = useI18n();
|
|
13
|
+
|
|
14
|
+
const options = computed(() =>
|
|
15
|
+
Object.entries(ActionLocale).map(([value, locale]) => ({
|
|
16
|
+
value,
|
|
17
|
+
label: t(locale),
|
|
18
|
+
})),
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
options,
|
|
23
|
+
};
|
|
24
|
+
}
|