@webitel/ui-sdk 26.2.89 → 26.2.91

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-sdk",
3
- "version": "26.2.89",
3
+ "version": "26.2.91",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "make-all": "npm version patch --git-tag-version false && npm run build && (npm run build:types || true) && (npm run biome:format:all || true) && npm run publish-lib",
@@ -10,7 +10,7 @@
10
10
  "biome:format:all": "npx biome check --write ./src",
11
11
  "build:types": "vue-tsc -p ./tsconfig.build.json",
12
12
  "publish-lib": " npm publish --access public --tag latest",
13
- "docs:dev": "vitepress dev docs --port 8080",
13
+ "docs:dev": "vitepress dev docs",
14
14
  "docs:build": "vitepress build docs",
15
15
  "lint:fix-staged": "npx lint-staged",
16
16
  "lint:package": "publint",
@@ -122,6 +122,7 @@ interface Props {
122
122
  store?: any;
123
123
  entityIdKey?: string;
124
124
  entityIdValue?: string | number;
125
+ isCreatedAtFilter: boolean;
125
126
  onDeleteItem?: (item: WebitelMediaExporterExportRecord) => Promise<void>;
126
127
  }
127
128
 
@@ -129,6 +130,7 @@ const props = withDefaults(defineProps<Props>(), {
129
130
  store: undefined,
130
131
  entityIdKey: undefined,
131
132
  entityIdValue: undefined,
133
+ isCreatedAtFilter: false,
132
134
  onDeleteItem: undefined,
133
135
  });
134
136
 
@@ -167,14 +169,14 @@ const initializeDefaultFilters = () => {
167
169
  });
168
170
  }
169
171
 
170
- if (!hasFilter('createdAtFrom')) {
172
+ if (!hasFilter('createdAtFrom') && props.isCreatedAtFilter) {
171
173
  addFilter({
172
174
  name: 'createdAtFrom',
173
175
  value: getStartOfDay(),
174
176
  });
175
177
  }
176
178
 
177
- if (!hasFilter('createdAtTo')) {
179
+ if (!hasFilter('createdAtTo') && props.isCreatedAtFilter) {
178
180
  addFilter({
179
181
  name: 'createdAtTo',
180
182
  value: getEndOfDay(),
@@ -209,6 +211,14 @@ const {
209
211
  closeDelete,
210
212
  } = useDeleteConfirmationPopup();
211
213
 
214
+ const tabFilters = computed(() =>
215
+ filtersManager.value.getAllValues({
216
+ exclude: [
217
+ props.entityIdKey,
218
+ ],
219
+ }),
220
+ );
221
+
212
222
  const {
213
223
  showEmpty,
214
224
  image: imageEmpty,
@@ -216,7 +226,7 @@ const {
216
226
  } = useTableEmpty({
217
227
  dataList,
218
228
  error,
219
- filters: computed(() => filtersManager.value.getAllValues()),
229
+ filters: tabFilters.value,
220
230
  isLoading,
221
231
  });
222
232
 
@@ -0,0 +1,34 @@
1
+ import { createPinia, setActivePinia, storeToRefs } from 'pinia';
2
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
3
+
4
+ import { createUserinfoStore } from '../userinfoStore';
5
+
6
+ describe('UserinfoAccessControl', () => {
7
+ let useUserinfoStore: ReturnType<typeof createUserinfoStore>;
8
+
9
+ beforeEach(() => {
10
+ const pinia = createPinia();
11
+ setActivePinia(pinia);
12
+ useUserinfoStore = createUserinfoStore();
13
+ });
14
+
15
+ it('should be defined', async () => {
16
+ vi.mock(import('../../api/UserinfoAPI'), () => ({
17
+ getSession: vi.fn().mockResolvedValue({
18
+ userId: 1,
19
+ username: 'test',
20
+ permissions: [],
21
+ scope: [],
22
+ access: {},
23
+ license: [],
24
+ }),
25
+ getUiVisibilityAccess: vi.fn().mockResolvedValue({}),
26
+ }));
27
+ const userinfoStore = useUserinfoStore();
28
+ const { initialize } = userinfoStore;
29
+ const { userId } = storeToRefs(userinfoStore);
30
+ await initialize();
31
+
32
+ expect(userId.value).toBe(1);
33
+ });
34
+ });
@@ -3,8 +3,7 @@ import { beforeEach, describe, expect, it } from 'vitest';
3
3
  import { createApp, h } from 'vue';
4
4
  import { createRouter, createWebHistory, type Router } from 'vue-router';
5
5
 
6
- import { AdminSections, WtApplication, WtObject } from '../../../../../enums';
7
- import { CrudGlobalAction } from '../../enums';
6
+ import { AdminSections, WtApplication, WtObject } from '../../../../enums';
8
7
  import { createUserAccessStore } from '../accessStore';
9
8
 
10
9
  describe('AccessStore', () => {
@@ -25,6 +24,7 @@ describe('AccessStore', () => {
25
24
  name: 'users',
26
25
  component: () => h('div', 'users'),
27
26
  meta: {
27
+ WtApplication: WtApplication.Admin,
28
28
  WtObject: WtObject.User,
29
29
  UiSection: AdminSections.Users,
30
30
  },
@@ -48,6 +48,7 @@ describe('AccessStore', () => {
48
48
  permissions: [],
49
49
  scope: [],
50
50
  access: {},
51
+ license: [],
51
52
  });
52
53
 
53
54
  await router.push({
@@ -59,26 +60,6 @@ describe('AccessStore', () => {
59
60
  expect(router.currentRoute.value.name).not.toBe('users');
60
61
  });
61
62
 
62
- it('allows route access if has global permission', async () => {
63
- const { initialize, routeAccessGuard } = useAccessStore();
64
- router.beforeEach(routeAccessGuard);
65
-
66
- initialize({
67
- permissions: [
68
- {
69
- id: CrudGlobalAction.Read,
70
- },
71
- ],
72
- scope: [],
73
- access: {},
74
- });
75
-
76
- await router.push({
77
- name: 'users',
78
- });
79
- expect(router.currentRoute.value.name).toBe('users');
80
- });
81
-
82
63
  it('allows route access if has scope permission, app visibility and section visibility', async () => {
83
64
  const { initialize, routeAccessGuard } = useAccessStore();
84
65
  router.beforeEach(routeAccessGuard);
@@ -99,6 +80,7 @@ describe('AccessStore', () => {
99
80
  },
100
81
  },
101
82
  },
83
+ license: [],
102
84
  });
103
85
 
104
86
  await router.push({
@@ -127,6 +109,7 @@ describe('AccessStore', () => {
127
109
  },
128
110
  },
129
111
  },
112
+ license: [],
130
113
  });
131
114
 
132
115
  await router.push({
@@ -155,6 +138,7 @@ describe('AccessStore', () => {
155
138
  },
156
139
  },
157
140
  },
141
+ license: [],
158
142
  });
159
143
 
160
144
  await router.push({
@@ -3,6 +3,7 @@ interface Props {
3
3
  store?: any;
4
4
  entityIdKey?: string;
5
5
  entityIdValue?: string | number;
6
+ isCreatedAtFilter: boolean;
6
7
  onDeleteItem?: (item: WebitelMediaExporterExportRecord) => Promise<void>;
7
8
  }
8
9
  declare var __VLS_1: {
@@ -18,8 +19,9 @@ declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, i
18
19
  store: any;
19
20
  entityIdKey: string;
20
21
  entityIdValue: string | number;
22
+ isCreatedAtFilter: boolean;
21
23
  onDeleteItem: (item: WebitelMediaExporterExportRecord) => Promise<void>;
22
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
24
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
23
25
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
24
26
  declare const _default: typeof __VLS_export;
25
27
  export default _default;