@webitel/ui-sdk 24.12.94 → 24.12.96

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 (46) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/ui-sdk.css +1 -1
  3. package/dist/ui-sdk.js +2124 -2158
  4. package/dist/ui-sdk.umd.cjs +16 -16
  5. package/package.json +14 -8
  6. package/src/api/defaults/getDefaultInstance/getDefaultInstance.js +5 -2
  7. package/src/api/defaults/index.js +1 -1
  8. package/src/components/wt-dual-panel/wt-dual-panel.vue +1 -2
  9. package/src/components/wt-icon-action/iconMappings.js +1 -1
  10. package/src/composables/useAccessControl/v2/createUserAccessControl.ts +66 -0
  11. package/src/composables/useAccessControl/v2/types/CreateUserAccessControl.d.ts +21 -0
  12. package/src/enums/CrudAction/CrudAction.js +6 -0
  13. package/src/enums/CrudAction/CrudAction.ts +8 -0
  14. package/src/enums/WtObject/WtObject.js +51 -1
  15. package/src/enums/WtObject/WtObject.ts +51 -1
  16. package/src/enums/index.js +6 -19
  17. package/src/enums/index.ts +33 -0
  18. package/src/locale/en/en.js +2 -1
  19. package/src/locale/ru/ru.js +2 -1
  20. package/src/locale/ua/ua.js +2 -1
  21. package/src/mixins/validationMixin/useValidation.js +2 -0
  22. package/src/modules/Filters/v2/filters/components/config/dynamic-filter-config-form-label.vue +50 -0
  23. package/src/modules/Filters/v2/filters/components/{dynamic/config → config}/dynamic-filter-config-form.vue +14 -5
  24. package/src/modules/Filters/v2/filters/components/{dynamic/config → config}/dynamic-filter-config-view.vue +1 -1
  25. package/src/modules/Filters/v2/filters/components/{dynamic/dynamic-filter-add-action.vue → dynamic-filter-add-action.vue} +2 -1
  26. package/src/modules/Filters/v2/filters/components/{dynamic/preview → preview}/dynamic-filter-preview-info.vue +1 -1
  27. package/src/modules/Filters/v2/filters/components/{dynamic/preview → preview}/dynamic-filter-preview.vue +4 -4
  28. package/src/modules/Filters/v2/filters/components/table-filters-panel.vue +3 -3
  29. package/src/modules/Filters/v2/filters/components/values/users/config.js +4 -0
  30. package/src/modules/Filters/v2/filters/components/values/users/user-filter-value-field.vue +35 -0
  31. package/src/modules/Filters/v2/filters/components/values/users/user-filter-value-preview.vue +13 -0
  32. package/src/modules/Userinfo/api/userinfo.js +21 -34
  33. package/src/modules/Userinfo/store/UserinfoStoreModule.js +1 -1
  34. package/src/modules/Userinfo/v2/api/UserinfoAPI.ts +62 -0
  35. package/src/modules/Userinfo/v2/enums/GlobalActions/GlobalActions.ts +36 -0
  36. package/src/modules/Userinfo/v2/enums/ScopeClass/ScopeClass.ts +47 -0
  37. package/src/modules/Userinfo/v2/enums/index.ts +7 -0
  38. package/src/modules/Userinfo/v2/index.ts +0 -0
  39. package/src/modules/Userinfo/v2/mappings/mappings.ts +161 -0
  40. package/src/modules/Userinfo/v2/scripts/utils.ts +123 -0
  41. package/src/modules/Userinfo/v2/stores/__tests__/accessStore.spec.ts +136 -0
  42. package/src/modules/Userinfo/v2/stores/accessStore.ts +131 -0
  43. package/src/modules/Userinfo/v2/stores/userinfoStore.ts +56 -0
  44. package/src/modules/Userinfo/v2/types/UserAccess.d.ts +118 -0
  45. package/src/modules/Filters/v2/filters/components/static/search-filter.vue +0 -14
  46. /package/src/modules/Filters/v2/filters/components/{dynamic/dynamic-filter-panel-wrapper.vue → dynamic-filter-panel-wrapper.vue} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-sdk",
3
- "version": "24.12.94",
3
+ "version": "24.12.96",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vite",
@@ -16,8 +16,9 @@
16
16
  "docs:dev": "vitepress dev docs --port 8080",
17
17
  "docs:build": "vitepress build docs",
18
18
  "docs:preview": "vitepress preview docs",
19
- "tsc": "vue-tsc -p tsconfig.json",
20
- "update-node": "nvm install --lts && nvm alias default node"
19
+ "tsc": "tsc -p tsconfig.json",
20
+ "update-node": "nvm install --lts && nvm alias default node",
21
+ "i": "npm install"
21
22
  },
22
23
  "main": "./dist/@webitel/ui-sdk.mjs",
23
24
  "type": "module",
@@ -34,6 +35,10 @@
34
35
  "import": "./src/enums/index.js",
35
36
  "require": "./src/enums/index.js"
36
37
  },
38
+ "./components": {
39
+ "import": "./src/components/index.js",
40
+ "require": "./src/components/index.js"
41
+ },
37
42
  "./scripts": {
38
43
  "import": "./src/scripts/index.js",
39
44
  "require": "./src/scripts/index.js"
@@ -140,13 +145,13 @@
140
145
  "devDependencies": {
141
146
  "@eslint/js": "^9.17.0",
142
147
  "@tsconfig/node22": "^22.0.0",
143
- "@types/node": "^22.9.1",
148
+ "@types/node": "^22.12.0",
144
149
  "@vitejs/plugin-vue": "^5.2.0",
145
150
  "@vitest/coverage-v8": "^2.1.5",
146
151
  "@vue/compat": "^3.5.13",
147
152
  "@vue/compiler-sfc": "^3.5.13",
148
153
  "@vue/test-utils": "^2.4.6",
149
- "@vue/tsconfig": "^0.6.0",
154
+ "@vue/tsconfig": "^0.7.0",
150
155
  "eslint": "^9.17.0",
151
156
  "eslint-config-prettier": "^9.1.0",
152
157
  "eslint-plugin-simple-import-sort": "^12.1.1",
@@ -162,8 +167,8 @@
162
167
  "prettier": "^3.4.2",
163
168
  "prismjs": "^1.29.0",
164
169
  "sass": "^1.81.0",
165
- "typescript": "5.6.3",
166
- "typescript-eslint": "^8.18.1",
170
+ "typescript": "5.7.3",
171
+ "typescript-eslint": "^8.22.0",
167
172
  "typescript-plugin-css-modules": "^5.1.0",
168
173
  "vite": "^5.4.11",
169
174
  "vite-plugin-checker": "^0.8.0",
@@ -175,7 +180,8 @@
175
180
  "vitest": "^2.1.5",
176
181
  "vue": "^3.5.13",
177
182
  "vue-tsc": "^2.1.10",
178
- "vuex": "^4.1.0"
183
+ "vuex": "^4.1.0",
184
+ "pinia": "^2.3.0"
179
185
  },
180
186
  "optionalDependencies": {
181
187
  "@rollup/rollup-linux-x64-gnu": "4.9.5"
@@ -2,13 +2,16 @@ import generateInstance from '../../axios/generateInstance.js';
2
2
  import updateTokenInterceptor from '../../interceptors/request/updateToken.interceptor.js';
3
3
  import handleUnauthorizedInterceptor from '../../interceptors/response/handleUnauthorized.interceptor.js';
4
4
 
5
- const getDefaultInstance = () =>
6
- generateInstance({
5
+ const getDefaultInstance = () => {
6
+ return generateInstance({
7
7
  interceptors: {
8
8
  request: [updateTokenInterceptor],
9
9
  response: [handleUnauthorizedInterceptor],
10
10
  },
11
11
  baseURL: import.meta.env.VITE_API_URL,
12
12
  });
13
+ };
14
+
15
+ export { getDefaultInstance };
13
16
 
14
17
  export default getDefaultInstance;
@@ -4,8 +4,8 @@ import getDefaultInstance from './getDefaultInstance/getDefaultInstance.js';
4
4
  import getDefaultOpenAPIConfig from './getDefaultOpenAPIConfig/getDefaultOpenAPIConfig.js';
5
5
 
6
6
  export {
7
- getDefaultGetParams,
8
7
  getDefaultGetListResponse,
8
+ getDefaultGetParams,
9
9
  getDefaultInstance,
10
10
  getDefaultOpenAPIConfig,
11
11
  };
@@ -33,8 +33,7 @@
33
33
  <script setup>
34
34
  import { computed, defineEmits, ref } from 'vue';
35
35
 
36
- import IconAction from '../../enums/IconAction/IconAction.enum.js';
37
- import { ComponentSize } from '../../enums/index.js';
36
+ import { ComponentSize, IconAction } from '../../enums';
38
37
 
39
38
  const props = defineProps({
40
39
  actionsPanel: {
@@ -1,4 +1,4 @@
1
- import { IconAction } from '../../enums/index.js';
1
+ import { IconAction } from '../../enums';
2
2
 
3
3
  export const WtIconActionIconMappings = Object.freeze({
4
4
  [IconAction.ADD]: 'plus',
@@ -0,0 +1,66 @@
1
+ import { computed } from 'vue';
2
+ import { useRoute } from 'vue-router';
3
+
4
+ import { _wtUiLog } from '../../../scripts/logger';
5
+ import type {
6
+ CreateUserAccessControlComposableParams,
7
+ UseAccessControlReturn,
8
+ } from './types/CreateUserAccessControl';
9
+
10
+ export const createUserAccessControlComposable = (
11
+ useUserinfoStore: CreateUserAccessControlComposableParams,
12
+ ) => {
13
+ const useUserAccessControl = (
14
+ resource?: string,
15
+ // options: UseUserAccessControlComposableOptions = {},
16
+ ): UseAccessControlReturn => {
17
+ const route = useRoute();
18
+ const object = resource || route?.meta?.WtObject;
19
+
20
+ const userinfoStore = useUserinfoStore();
21
+
22
+ if (!object) {
23
+ _wtUiLog.error({
24
+ module: 'access control',
25
+ entity: 'useUserAccessControl composable',
26
+ })(
27
+ 'No WtObject found in route meta or passed as first param, cannot check access control',
28
+ );
29
+ }
30
+
31
+ const hasReadAccess = computed(() => {
32
+ return userinfoStore.hasReadAccess(object);
33
+ });
34
+ const hasCreateAccess = computed(() => {
35
+ return userinfoStore.hasCreateAccess(object);
36
+ });
37
+ const hasUpdateAccess = computed(() => {
38
+ return userinfoStore.hasUpdateAccess(object);
39
+ });
40
+ const hasDeleteAccess = computed(() => {
41
+ return userinfoStore.hasDeleteAccess(object);
42
+ });
43
+
44
+ const hasSaveActionAccess = computed(() => {
45
+ if (route.params.id === 'new') return hasCreateAccess.value;
46
+ return hasUpdateAccess.value;
47
+ });
48
+
49
+ const disableUserInput = computed(() => {
50
+ if (route.params.id === 'new') return !hasCreateAccess.value;
51
+ return !hasUpdateAccess.value;
52
+ });
53
+
54
+ return {
55
+ hasReadAccess,
56
+ hasCreateAccess,
57
+ hasUpdateAccess,
58
+ hasDeleteAccess,
59
+
60
+ hasSaveActionAccess,
61
+ disableUserInput,
62
+ };
63
+ };
64
+
65
+ return useUserAccessControl;
66
+ };
@@ -0,0 +1,21 @@
1
+ import type { Ref } from 'vue';
2
+
3
+ import type { WtObject } from '../../../../enums';
4
+ import type { createUserAccessStore } from '../../../../modules/Userinfo/v2/stores/accessStore';
5
+
6
+ export type CreateUserAccessControlComposableParams =
7
+ ReturnType<createUserAccessStore>;
8
+
9
+ export type UseUserAccessControlComposableOptions = {
10
+ resource?: WtObject;
11
+ };
12
+
13
+ export interface UseAccessControlReturn {
14
+ hasReadAccess: Ref<boolean>;
15
+ hasCreateAccess: Ref<boolean>;
16
+ hasUpdateAccess: Ref<boolean>;
17
+ hasDeleteAccess: Ref<boolean>;
18
+
19
+ hasSaveActionAccess: Ref<boolean>;
20
+ disableUserInput: Ref<boolean>;
21
+ }
@@ -0,0 +1,6 @@
1
+ export const CrudAction = {
2
+ Read: 'read',
3
+ Create: 'create',
4
+ Update: 'update',
5
+ Delete: 'delete',
6
+ };
@@ -0,0 +1,8 @@
1
+ export const CrudAction = {
2
+ Read: 'read',
3
+ Create: 'create',
4
+ Update: 'update',
5
+ Delete: 'delete',
6
+ } as const;
7
+
8
+ export type CrudAction = (typeof CrudAction)[keyof typeof CrudAction];
@@ -5,5 +5,55 @@ export const WtObject = {
5
5
  Agent: 'agent',
6
6
  Queue: 'queue',
7
7
  Contact: 'contact',
8
- Regions: 'regions',
8
+ Region: 'region',
9
+ User: 'user',
10
+ Resource: 'resource',
11
+ Device: 'device',
12
+ License: 'license',
13
+ Flow: 'flow',
14
+ Dialplan: 'dialplan',
15
+ Gateway: 'gateway',
16
+ Chatplan: 'chatplan',
17
+ ChatGateway: 'chatGateway',
18
+ Blacklist: 'blacklist',
19
+ Calendar: 'calendar',
20
+ Communication: 'communication',
21
+ PauseCause: 'pauseCause',
22
+ Media: 'media',
23
+ ShiftTemplate: 'shiftTemplate',
24
+ PauseTemplate: 'pauseTemplate',
25
+ WorkingCondition: 'workingCondition',
26
+ Skill: 'skill',
27
+ Bucket: 'bucket',
28
+ Member: 'member',
29
+ ResourceGroup: 'resourceGroup',
30
+ Team: 'team',
31
+ Storage: 'storage',
32
+ CognitiveProfile: 'cognitiveProfile',
33
+ EmailProfile: 'emailProfile',
34
+ SingleSignOn: 'singleSignOn',
35
+ ImportCsv: 'importCsv',
36
+ Trigger: 'trigger',
37
+ Role: 'role',
38
+ Object: 'object',
39
+ ChangeLog: 'changelog',
40
+ Configuration: 'configuration',
41
+ GlobalVariable: 'globalVariable',
42
+ ActiveCall: 'activeCall',
43
+ Scorecard: 'scorecard',
44
+ Logger: 'logger',
45
+ Call: 'call',
46
+ RecordFile: 'recordFile',
47
+ ContactGroup: 'contactGroup',
48
+ ChatBot: 'chatBot',
49
+ Cases: 'cases',
50
+ CaseComment: 'caseComment',
51
+ Slas: 'slas',
52
+ ServiceCatalog: 'serviceCatalog',
53
+ CaseSource: 'caseSource',
54
+ CloseReasonGroup: 'closeReasonGroup',
55
+ Priorities: 'priorities',
56
+ Status: 'status',
57
+ Source: 'source',
58
+ CustomLookup: 'customLookup',
9
59
  };
@@ -5,7 +5,57 @@ export const WtObject = {
5
5
  Agent: 'agent',
6
6
  Queue: 'queue',
7
7
  Contact: 'contact',
8
- Regions: 'regions',
8
+ Region: 'region',
9
+ User: 'user',
10
+ Resource: 'resource',
11
+ Device: 'device',
12
+ License: 'license',
13
+ Flow: 'flow',
14
+ Dialplan: 'dialplan',
15
+ Gateway: 'gateway',
16
+ Chatplan: 'chatplan',
17
+ ChatGateway: 'chatGateway',
18
+ Blacklist: 'blacklist',
19
+ Calendar: 'calendar',
20
+ Communication: 'communication',
21
+ PauseCause: 'pauseCause',
22
+ Media: 'media',
23
+ ShiftTemplate: 'shiftTemplate',
24
+ PauseTemplate: 'pauseTemplate',
25
+ WorkingCondition: 'workingCondition',
26
+ Skill: 'skill',
27
+ Bucket: 'bucket',
28
+ Member: 'member',
29
+ ResourceGroup: 'resourceGroup',
30
+ Team: 'team',
31
+ Storage: 'storage',
32
+ CognitiveProfile: 'cognitiveProfile',
33
+ EmailProfile: 'emailProfile',
34
+ SingleSignOn: 'singleSignOn',
35
+ ImportCsv: 'importCsv',
36
+ Trigger: 'trigger',
37
+ Role: 'role',
38
+ Object: 'object',
39
+ ChangeLog: 'changelog',
40
+ Configuration: 'configuration',
41
+ GlobalVariable: 'globalVariable',
42
+ ActiveCall: 'activeCall',
43
+ Scorecard: 'scorecard',
44
+ Logger: 'logger',
45
+ Call: 'call',
46
+ RecordFile: 'recordFile',
47
+ ContactGroup: 'contactGroup',
48
+ ChatBot: 'chatBot',
49
+ Cases: 'cases',
50
+ CaseComment: 'caseComment',
51
+ Slas: 'slas',
52
+ ServiceCatalog: 'serviceCatalog',
53
+ CaseSource: 'caseSource',
54
+ CloseReasonGroup: 'closeReasonGroup',
55
+ Priorities: 'priorities',
56
+ Status: 'status',
57
+ Source: 'source',
58
+ CustomLookup: 'customLookup',
9
59
  } as const;
10
60
 
11
61
  export type WtObject = (typeof WtObject)[keyof typeof WtObject];
@@ -2,28 +2,15 @@ import AbstractUserStatus from './AbstractUserStatus/AbstractUserStatus.enum.js'
2
2
  import AgentStatus from './AgentStatus/AgentStatus.enum.js';
3
3
  import ChatGatewayProvider from './ChatGatewayProvider/ChatGatewayProvider.enum.js';
4
4
  import { ComponentSize } from './ComponentSize/ComponentSize';
5
+ import { CrudAction } from './CrudAction/CrudAction';
5
6
  import IconAction from './IconAction/IconAction.enum.js';
6
7
  import QueueType from './QueueType/QueueType.enum.js';
7
8
  import TypesExportedSettings from './TypesExportedSettings/TypesExportedSettings.enum.js';
8
9
  import { AdminSections } from './WebitelApplications/AdminSections';
9
- import AuditorSections from './WebitelApplications/AuditorSections.enum.js';
10
- import CrmSections from './WebitelApplications/CrmSections.enum.js';
11
- import SupervisorSections from './WebitelApplications/SupervisorSections.enum.js';
10
+ import { AuditorSections } from './WebitelApplications/AuditorSections';
11
+ import { CrmSections } from './WebitelApplications/CrmSections';
12
+ import { SupervisorSections } from './WebitelApplications/SupervisorSections';
12
13
  import WebitelApplications from './WebitelApplications/WebitelApplications.enum.js';
14
+ import { WtApplication } from './WebitelApplications/WtApplication';
13
15
  import { WtObject } from './WtObject/WtObject';
14
-
15
- export {
16
- AbstractUserStatus,
17
- AdminSections,
18
- AgentStatus,
19
- AuditorSections,
20
- ChatGatewayProvider,
21
- ComponentSize,
22
- CrmSections,
23
- IconAction,
24
- QueueType,
25
- SupervisorSections,
26
- TypesExportedSettings,
27
- WebitelApplications,
28
- WtObject,
29
- };
16
+ export { AbstractUserStatus, AdminSections, AgentStatus, AuditorSections, ChatGatewayProvider, ComponentSize, CrmSections, CrudAction, IconAction, QueueType, SupervisorSections, TypesExportedSettings, WebitelApplications, WtApplication, WtObject, };
@@ -0,0 +1,33 @@
1
+ import AbstractUserStatus from './AbstractUserStatus/AbstractUserStatus.enum.js';
2
+ import AgentStatus from './AgentStatus/AgentStatus.enum.js';
3
+ import ChatGatewayProvider from './ChatGatewayProvider/ChatGatewayProvider.enum.js';
4
+ import { ComponentSize } from './ComponentSize/ComponentSize';
5
+ import { CrudAction } from './CrudAction/CrudAction';
6
+ import IconAction from './IconAction/IconAction.enum.js';
7
+ import QueueType from './QueueType/QueueType.enum.js';
8
+ import TypesExportedSettings from './TypesExportedSettings/TypesExportedSettings.enum.js';
9
+ import { AdminSections } from './WebitelApplications/AdminSections';
10
+ import { AuditorSections } from './WebitelApplications/AuditorSections';
11
+ import { CrmSections } from './WebitelApplications/CrmSections';
12
+ import { SupervisorSections } from './WebitelApplications/SupervisorSections';
13
+ import WebitelApplications from './WebitelApplications/WebitelApplications.enum.js';
14
+ import { WtApplication } from './WebitelApplications/WtApplication';
15
+ import { WtObject } from './WtObject/WtObject';
16
+
17
+ export {
18
+ AbstractUserStatus,
19
+ AdminSections,
20
+ AgentStatus,
21
+ AuditorSections,
22
+ ChatGatewayProvider,
23
+ ComponentSize,
24
+ CrmSections,
25
+ CrudAction,
26
+ IconAction,
27
+ QueueType,
28
+ SupervisorSections,
29
+ TypesExportedSettings,
30
+ WebitelApplications,
31
+ WtApplication,
32
+ WtObject,
33
+ };
@@ -6,8 +6,8 @@ import {
6
6
  EngineRoutingSchemaType,
7
7
  } from 'webitel-sdk';
8
8
 
9
+ import { IconAction } from '../../enums';
9
10
  import ChatGatewayProvider from '../../enums/ChatGatewayProvider/ChatGatewayProvider.enum.js';
10
- import { IconAction } from '../../enums/index.js';
11
11
  import QueueType from '../../enums/QueueType/QueueType.enum.js';
12
12
  import AdminSections from '../../enums/WebitelApplications/AdminSections.enum.js';
13
13
  import AuditorSections from '../../enums/WebitelApplications/AuditorSections.enum.js';
@@ -296,6 +296,7 @@ export default {
296
296
  macValidator: 'Should look like MAC',
297
297
  minValue: 'Value should be not less than',
298
298
  maxValue: 'Value should be not much than',
299
+ maxLength: 'The length should not be greater than',
299
300
  sameAs: 'Incorrect password',
300
301
  requiredArrayValue: 'Array should not be empty',
301
302
  minLength: 'Quantity of characters should not be less than',
@@ -6,8 +6,8 @@ import {
6
6
  EngineRoutingSchemaType,
7
7
  } from 'webitel-sdk';
8
8
 
9
+ import { IconAction } from '../../enums';
9
10
  import ChatGatewayProvider from '../../enums/ChatGatewayProvider/ChatGatewayProvider.enum.js';
10
- import { IconAction } from '../../enums/index.js';
11
11
  import QueueType from '../../enums/QueueType/QueueType.enum.js';
12
12
  import AdminSections from '../../enums/WebitelApplications/AdminSections.enum.js';
13
13
  import AuditorSections from '../../enums/WebitelApplications/AuditorSections.enum.js';
@@ -293,6 +293,7 @@ export default {
293
293
  macValidator: 'Необходимо ввести MAC-адрес',
294
294
  minValue: 'Значение должно быть не меньше',
295
295
  maxValue: 'Значение должно быть не больше',
296
+ maxLength: 'Длина не должна быть больше, чем',
296
297
  sameAs: 'Неверный пароль',
297
298
  requiredArrayValue: 'Поле не должно быть пустым',
298
299
  minLength: 'Количество символов не должно быть меньше, чем',
@@ -6,8 +6,8 @@ import {
6
6
  EngineRoutingSchemaType,
7
7
  } from 'webitel-sdk';
8
8
 
9
+ import { IconAction } from '../../enums';
9
10
  import ChatGatewayProvider from '../../enums/ChatGatewayProvider/ChatGatewayProvider.enum.js';
10
- import { IconAction } from '../../enums/index.js';
11
11
  import QueueType from '../../enums/QueueType/QueueType.enum.js';
12
12
  import AdminSections from '../../enums/WebitelApplications/AdminSections.enum.js';
13
13
  import AuditorSections from '../../enums/WebitelApplications/AuditorSections.enum.js';
@@ -293,6 +293,7 @@ export default {
293
293
  macValidator: 'Необхідно ввести MAC-адрес',
294
294
  minValue: 'Значення повинно бути не менше',
295
295
  maxValue: 'Значення повинно бути не більше',
296
+ maxLength: 'Довжина не повинна бути більшою, ніж',
296
297
  sameAs: 'Неправильний пароль',
297
298
  requiredArrayValue: 'Поле не повинно бути пустим',
298
299
  minLength: 'Кількість символів повинна бути не меншою, ніж',
@@ -39,6 +39,8 @@ export function useValidation({
39
39
  validationText = `${t('validation.minValue')} ${v.value.minValue.$params.min}`;
40
40
  else if (v.value.maxValue?.$invalid)
41
41
  validationText = `${t('validation.maxValue')} ${v.value.maxValue.$params.max}`;
42
+ else if (v.value.maxLength?.$invalid)
43
+ validationText = `${t('validation.maxLength')} ${v.value.maxLength.$params.max}`;
42
44
  else if (v.value.sipAccountValidator?.$invalid)
43
45
  validationText = t('validation.sipAccountValidator');
44
46
  else if (v.value.minLength?.$invalid)
@@ -0,0 +1,50 @@
1
+ <template>
2
+ <wt-input
3
+ :value="model"
4
+ :label="t('webitelUI.filters.filterLabel')"
5
+ :v="v$"
6
+ @input="model = $event"
7
+ />
8
+ </template>
9
+
10
+ <script setup lang="ts">
11
+ import { useVuelidate } from '@vuelidate/core';
12
+ import { maxLength } from '@vuelidate/validators';
13
+ import { computed, watch } from 'vue';
14
+ import { useI18n } from 'vue-i18n';
15
+
16
+ import WtInput from '../../../../../../../components/wt-input/wt-input.vue';
17
+
18
+ const MAX_STRING_LENGTH = 50;
19
+
20
+ const model = defineModel<string>();
21
+
22
+ interface Emits {
23
+ 'update:invalid': [boolean];
24
+ }
25
+ const emit = defineEmits<Emits>();
26
+
27
+ const { t } = useI18n();
28
+
29
+ const v$ = useVuelidate(
30
+ computed(() => ({
31
+ model: {
32
+ // maybe make maxLength value by props
33
+ maxLength: maxLength(MAX_STRING_LENGTH),
34
+ },
35
+ })),
36
+ { model },
37
+ { $autoDirty: true },
38
+ );
39
+ v$.value.$touch();
40
+
41
+ watch(
42
+ () => v$.value.$invalid,
43
+ (invalid) => {
44
+ emit('update:invalid', invalid);
45
+ },
46
+ { immediate: true },
47
+ );
48
+ </script>
49
+
50
+ <style scoped lang="scss"></style>
@@ -8,6 +8,7 @@
8
8
  use-value-from-options-by-prop="id"
9
9
  @input="filterName = $event"
10
10
  />
11
+
11
12
  <slot
12
13
  name="value-input"
13
14
  v-bind="{
@@ -18,11 +19,13 @@
18
19
  onValueInvalidChange: (v) => (invalid = v),
19
20
  }"
20
21
  />
21
- <wt-input
22
- v-model="filterLabel"
23
- :label="t('webitelUI.filters.filterLabel')"
24
- @input="touchedLabel = true"
22
+
23
+ <dynamic-filter-config-form-label
24
+ :value="filterLabel"
25
+ @update:value="onLabelValueUpdate"
26
+ @update:invalid="(v) => (invalid = v)"
25
27
  />
28
+
26
29
  <footer class="dynamic-filter-config-form-footer">
27
30
  <wt-button
28
31
  :disabled="invalid"
@@ -31,6 +34,7 @@
31
34
  >
32
35
  {{ t('reusable.save') }}
33
36
  </wt-button>
37
+
34
38
  <wt-button
35
39
  color="secondary"
36
40
  wide
@@ -48,13 +52,13 @@ import { ref, watch } from 'vue';
48
52
  import { useI18n } from 'vue-i18n';
49
53
 
50
54
  import WtButton from '../../../../../../../components/wt-button/wt-button.vue';
51
- import WtInput from '../../../../../../../components/wt-input/wt-input.vue';
52
55
  import WtSelect from '../../../../../../../components/wt-select/wt-select.vue';
53
56
  import type {
54
57
  FilterInitParams,
55
58
  FilterName,
56
59
  IFilter,
57
60
  } from '../../../types/Filter';
61
+ import DynamicFilterConfigFormLabel from './dynamic-filter-config-form-label.vue';
58
62
 
59
63
  interface FilterNameSelectRepresentation {
60
64
  name: string;
@@ -91,6 +95,11 @@ const editMode = !!props.filter;
91
95
 
92
96
  const invalid = ref(false);
93
97
 
98
+ const onLabelValueUpdate = (val: string) => {
99
+ filterLabel.value = val;
100
+ touchedLabel.value = true;
101
+ };
102
+
94
103
  const submit = () => {
95
104
  emit('submit', {
96
105
  name: filterName.value,
@@ -23,7 +23,7 @@
23
23
  * and their styling
24
24
  */
25
25
 
26
- import WtTooltip from '../../../../../../../components/wt-tooltip/wt-tooltip.vue';
26
+ import WtTooltip from '../../../../../../components/wt-tooltip/wt-tooltip.vue';
27
27
  </script>
28
28
 
29
29
  <style lang="scss" scoped></style>
@@ -5,7 +5,7 @@
5
5
  <p v-if="props.showLabel">
6
6
  {{ t('webitelUI.filters.addFilter') }}
7
7
  </p>
8
- <wt-icon-btn icon="add-filter" />
8
+ <wt-icon-action action="add" />
9
9
  </div>
10
10
  </template>
11
11
 
@@ -18,6 +18,7 @@
18
18
  <script lang="ts" setup>
19
19
  import { useI18n } from 'vue-i18n';
20
20
 
21
+ import WtIconAction from '../../../../../components/wt-icon-action/wt-icon-action.vue';
21
22
  import DynamicFilterConfigView from './config/dynamic-filter-config-view.vue';
22
23
 
23
24
  interface Props {
@@ -23,7 +23,7 @@
23
23
  </template>
24
24
 
25
25
  <script lang="ts" setup>
26
- import type { FilterName, FilterValue } from '../../../types/Filter';
26
+ import type { FilterName, FilterValue } from '../../types/Filter';
27
27
 
28
28
  interface Props {
29
29
  name: FilterName;
@@ -29,10 +29,10 @@
29
29
  </template>
30
30
 
31
31
  <script lang="ts" setup>
32
- import WtChip from '../../../../../../../components/wt-chip/wt-chip.vue';
33
- import WtIconBtn from '../../../../../../../components/wt-icon-btn/wt-icon-btn.vue';
34
- import WtTooltip from '../../../../../../../components/wt-tooltip/wt-tooltip.vue';
35
- import type { IFilter } from '../../../types/Filter';
32
+ import WtChip from '../../../../../../components/wt-chip/wt-chip.vue';
33
+ import WtIconBtn from '../../../../../../components/wt-icon-btn/wt-icon-btn.vue';
34
+ import WtTooltip from '../../../../../../components/wt-tooltip/wt-tooltip.vue';
35
+ import type { IFilter } from '../../types/Filter';
36
36
  import DynamicFilterConfigView from '../config/dynamic-filter-config-view.vue';
37
37
  import DynamicFilterPreviewInfo from './dynamic-filter-preview-info.vue';
38
38
 
@@ -64,9 +64,9 @@
64
64
  </template>
65
65
 
66
66
  <script lang="ts" setup>
67
- import DynamicFilterConfigForm from './dynamic/config/dynamic-filter-config-form.vue';
68
- import DynamicFilterAddAction from './dynamic/dynamic-filter-add-action.vue';
69
- import DynamicFilterPreview from './dynamic/preview/dynamic-filter-preview.vue';
67
+ import DynamicFilterConfigForm from './config/dynamic-filter-config-form.vue';
68
+ import DynamicFilterAddAction from './dynamic-filter-add-action.vue';
69
+ import DynamicFilterPreview from './preview/dynamic-filter-preview.vue';
70
70
 
71
71
  interface Props {}
72
72
 
@@ -0,0 +1,4 @@
1
+ // import { UsersApi}
2
+
3
+ export const searchMethod = UsersAPI.getLookup;
4
+ export const localePath = ''; /* label locale goes here */