@webitel/ui-sdk 25.10.30 → 25.10.32

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": "25.10.30",
3
+ "version": "25.10.32",
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 lint:fix || true) && npm run publish-lib",
@@ -56,7 +56,7 @@
56
56
  "@vuepic/vue-datepicker": "^4.5.1",
57
57
  "@vueuse/components": "^13.0.0",
58
58
  "@webitel/api-services": "^0.0.44",
59
- "@webitel/styleguide": "^24.12.72",
59
+ "@webitel/styleguide": "^24.12.73",
60
60
  "autosize": "^6.0.1",
61
61
  "axios": "^1.8.3",
62
62
  "clipboard-copy": "^4.0.1",
@@ -24,6 +24,7 @@
24
24
  row-reorder
25
25
  :reorderable-column="false"
26
26
  header-style="width: 1%;"
27
+ body-style="width: 1%;"
27
28
  :pt="{
28
29
  columnresizer: {
29
30
  class: {
@@ -45,6 +46,7 @@
45
46
  column-key="row-select"
46
47
  :reorderable-column="false"
47
48
  header-style="width: 1%;"
49
+ body-style="width: 1%;"
48
50
  :pt="{
49
51
  columnresizer: {
50
52
  class: {
@@ -420,5 +422,6 @@ const columnReorder = async ({dropIndex, originalEvent}) => {
420
422
  position: absolute;
421
423
  transform: translateY(-50%);
422
424
  top: 50%;
425
+ z-index: 1;
423
426
  }
424
427
  </style>
@@ -0,0 +1,70 @@
1
+ import applyTransform, { notify } from '@webitel/ui-sdk/api/transformers/index';
2
+ import { computed, Ref, ref } from 'vue';
3
+ import { useRoute } from 'vue-router';
4
+
5
+ import CSVExport from '../CSVExport';
6
+
7
+ export type CSVRow = Record<string, any>;
8
+
9
+ export type FetchMethod = (params: Record<string, any>) => Promise<{
10
+ items: CSVRow[];
11
+ next: boolean;
12
+ }>;
13
+
14
+ interface CSVExportOptions {
15
+ filename?: string;
16
+ delimiter?: string;
17
+ }
18
+
19
+ const CSV_EXPORT_BATCH_SIZE = 5000;
20
+
21
+ export function useCSVExport({ selected }: { selected: Ref<number[]> }) {
22
+ const CSVExportInstance = ref<null | InstanceType<typeof CSVExport>>(null);
23
+ const route = useRoute();
24
+
25
+ const CSVDownloadProgress = computed(() =>
26
+ CSVExportInstance.value
27
+ ? CSVExportInstance.value.downloadProgress.count
28
+ : 0,
29
+ );
30
+
31
+ const isCSVLoading = computed(() => !!CSVDownloadProgress.value);
32
+
33
+ const isAnySelected = computed(() => !!selected.value.length);
34
+
35
+ function initCSVExport(
36
+ fetchMethod: FetchMethod,
37
+ options: CSVExportOptions = {},
38
+ ) {
39
+ CSVExportInstance.value = new CSVExport(fetchMethod, options);
40
+ }
41
+
42
+ async function exportCSV(exportParams?: Record<string, any>) {
43
+ const routeQuery = route.query;
44
+ const params = {
45
+ ...(exportParams || routeQuery),
46
+ size: CSV_EXPORT_BATCH_SIZE,
47
+ };
48
+
49
+ if (isAnySelected.value) {
50
+ params.id = selected.value;
51
+ }
52
+
53
+ try {
54
+ await CSVExportInstance.value?.export(params);
55
+ } catch (err) {
56
+ throw applyTransform(err, [notify]);
57
+ }
58
+ }
59
+
60
+ return {
61
+ CSVExportInstance,
62
+
63
+ CSVDownloadProgress,
64
+ isCSVLoading,
65
+ isAnySelected,
66
+
67
+ initCSVExport,
68
+ exportCSV,
69
+ };
70
+ }
@@ -50,6 +50,8 @@ const table = {
50
50
 
51
51
  .p-datatable-thead > tr > th {
52
52
  overflow: hidden;
53
+ position: relative;
54
+ z-index: 2;
53
55
  }
54
56
 
55
57
  .p-datatable-column-resizer {
@@ -0,0 +1,50 @@
1
+ import { Ref } from 'vue';
2
+ import CSVExport from '../CSVExport';
3
+ export type CSVRow = Record<string, any>;
4
+ export type FetchMethod = (params: Record<string, any>) => Promise<{
5
+ items: CSVRow[];
6
+ next: boolean;
7
+ }>;
8
+ interface CSVExportOptions {
9
+ filename?: string;
10
+ delimiter?: string;
11
+ }
12
+ export declare function useCSVExport({ selected }: {
13
+ selected: Ref<number[]>;
14
+ }): {
15
+ CSVExportInstance: Ref<{
16
+ filename: string;
17
+ fetchMethod: any;
18
+ downloadProgress: {
19
+ count: number;
20
+ };
21
+ delimiter: any;
22
+ resetProgress: () => void;
23
+ zippingProgress: {
24
+ percent: number;
25
+ };
26
+ save: (csv: any) => void;
27
+ stringify: (params?: {}) => Promise<string>;
28
+ export: (params: any) => Promise<void>;
29
+ }, CSVExport | {
30
+ filename: string;
31
+ fetchMethod: any;
32
+ downloadProgress: {
33
+ count: number;
34
+ };
35
+ delimiter: any;
36
+ resetProgress: () => void;
37
+ zippingProgress: {
38
+ percent: number;
39
+ };
40
+ save: (csv: any) => void;
41
+ stringify: (params?: {}) => Promise<string>;
42
+ export: (params: any) => Promise<void>;
43
+ }>;
44
+ CSVDownloadProgress: import("vue").ComputedRef<number>;
45
+ isCSVLoading: import("vue").ComputedRef<boolean>;
46
+ isAnySelected: import("vue").ComputedRef<boolean>;
47
+ initCSVExport: (fetchMethod: FetchMethod, options?: CSVExportOptions) => void;
48
+ exportCSV: (exportParams?: Record<string, any>) => Promise<void>;
49
+ };
50
+ export {};