@webitel/ui-sdk 26.8.104 → 26.8.105

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 (35) hide show
  1. package/dist/{components-oyMSmFwI.js → components-D574RP8y.js} +10 -6
  2. package/dist/{composables-OP5kSvlh.js → composables-Vg-QfE_2.js} +112 -86
  3. package/dist/ui-sdk.css +1 -1
  4. package/dist/ui-sdk.js +1 -1
  5. package/dist/ui-sdk.umd.cjs +512 -512
  6. package/dist/{wt-chat-emoji-CdNBvJez.js → wt-chat-emoji-D1RzspYn.js} +1 -1
  7. package/dist/{wt-display-chip-items-1uWroA2z.js → wt-display-chip-items-D9E7qoJ8.js} +1 -1
  8. package/dist/{wt-expansion-card-CJjtuFDk.js → wt-expansion-card-DzZYhwnW.js} +1 -1
  9. package/dist/{wt-galleria-CmaNfz7E.js → wt-galleria-iRpRiDc6.js} +1 -1
  10. package/dist/{wt-send-message-popup-C3qRY8Lk.js → wt-send-message-popup-C_6OHIhY.js} +1 -1
  11. package/dist/{wt-table-xmGhfp4p.js → wt-table-_qNHChZt.js} +2 -2
  12. package/dist/{wt-type-extension-value-input-CkBr5oPm.js → wt-type-extension-value-input-C9aMICVN.js} +1 -1
  13. package/dist/{wt-vidstack-player-P4fT1R6k.js → wt-vidstack-player-CLimONj6.js} +1 -1
  14. package/package.json +1 -1
  15. package/src/components/_internals/composables/useSelect/__tests__/useSelectAutoOpen.spec.ts +206 -0
  16. package/src/components/_internals/composables/useSelect/types.ts +1 -0
  17. package/src/components/_internals/composables/useSelect/useSelect.ts +6 -2
  18. package/src/components/_internals/composables/useSelect/useSelectAutoOpen.ts +106 -0
  19. package/src/components/_internals/types/PrimevueInstance.ts +1 -0
  20. package/src/components/wt-multi-select/wt-multi-select.vue +2 -0
  21. package/src/components/wt-single-select/wt-single-select.vue +2 -0
  22. package/src/components/wt-table/wt-table.vue +6 -0
  23. package/src/modules/UploadCsvPopup/components/wt-upload-csv-popup.vue +27 -27
  24. package/src/modules/UploadCsvPopup/composable/__tests__/useUploadCsv.spec.js +1 -1
  25. package/src/modules/UploadCsvPopup/composable/useUploadCsv.ts +3 -1
  26. package/types/.tsbuildinfo +1 -1
  27. package/types/components/_internals/composables/useSelect/types.d.ts +1 -0
  28. package/types/components/_internals/composables/useSelect/useSelect.d.ts +1 -1
  29. package/types/components/_internals/composables/useSelect/useSelectAutoOpen.d.ts +15 -0
  30. package/types/components/_internals/types/PrimevueInstance.d.ts +1 -0
  31. package/types/components/wt-datepicker/wt-datepicker.vue.d.ts +2 -2
  32. package/types/components/wt-multi-select/wt-multi-select.vue.d.ts +1 -0
  33. package/types/components/wt-popover/wt-popover.vue.d.ts +2 -2
  34. package/types/components/wt-single-select/wt-single-select.vue.d.ts +1 -0
  35. package/types/components/wt-tooltip/_internals/wt-tooltip-floating.vue.d.ts +2 -2
@@ -1,4 +1,4 @@
1
- import "./components-oyMSmFwI.js";
1
+ import "./components-D574RP8y.js";
2
2
  import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
3
3
  import { c as t } from "./enums-Bd-8yrmg.js";
4
4
  import { t as n } from "./wt-button-BzYDkfhK.js";
@@ -1,4 +1,4 @@
1
- import { C as e, i as t } from "./components-oyMSmFwI.js";
1
+ import { C as e, i as t } from "./components-D574RP8y.js";
2
2
  import { t as n } from "./_plugin-vue_export-helper-B3ysoDQm.js";
3
3
  import { t as r } from "./utils-B_8uwL9P.js";
4
4
  import { Fragment as i, computed as a, createCommentVNode as o, createElementBlock as s, createTextVNode as c, createVNode as l, defineComponent as u, openBlock as d, renderList as f, renderSlot as p, toDisplayString as m, unref as h, withCtx as g } from "vue";
@@ -1,7 +1,7 @@
1
1
  import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
2
2
  import { c as t } from "./enums-Bd-8yrmg.js";
3
3
  import { t as n } from "./useExpansion-DVdIpoOn.js";
4
- import "./composables-OP5kSvlh.js";
4
+ import "./composables-Vg-QfE_2.js";
5
5
  import { t as r } from "./wt-expand-transition-C2p9bR4j.js";
6
6
  import { createElementBlock as i, createElementVNode as a, createVNode as o, defineComponent as s, guardReactiveProps as c, normalizeClass as l, normalizeProps as u, openBlock as d, renderSlot as f, resolveComponent as p, toRef as m, unref as h, vShow as g, withCtx as _, withDirectives as v, withKeys as y } from "vue";
7
7
  //#region src/components/wt-expansion-card/wt-expansion-card.vue?vue&type=script&setup=true&lang.ts
@@ -1,6 +1,6 @@
1
1
  import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
2
2
  import { t } from "./vue-i18n-B88GcHzn.js";
3
- import { a as n, o as r } from "./composables-OP5kSvlh.js";
3
+ import { a as n, o as r } from "./composables-Vg-QfE_2.js";
4
4
  import { Fragment as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, defineComponent as f, mergeModels as p, mergeProps as m, nextTick as h, normalizeClass as g, onMounted as _, onUnmounted as v, openBlock as y, ref as b, renderSlot as x, resolveComponent as S, toDisplayString as C, unref as w, useAttrs as T, useModel as E, vShow as D, watch as O, withCtx as k, withDirectives as A } from "vue";
5
5
  //#region src/modules/DeleteConfirmationPopup/composables/useDeleteConfirmationPopup.ts
6
6
  var j = () => {
@@ -1,4 +1,4 @@
1
- import { n as e } from "./components-oyMSmFwI.js";
1
+ import { n as e } from "./components-D574RP8y.js";
2
2
  import "./convertDuration-CGW5IDMW.js";
3
3
  import { n as t, r as n } from "./clients-BZ1QzRFi.js";
4
4
  import { t as r } from "./vue-i18n-B88GcHzn.js";
@@ -4,7 +4,7 @@ import { t as n } from "./wt-badge-lFnfK2an.js";
4
4
  import { t as r } from "./vue-i18n-B88GcHzn.js";
5
5
  import { n as i, t as a } from "./sortQueryAdapters-CyYXvnDN.js";
6
6
  import { t as o } from "./wt-icon-btn-CeGGT2PO.js";
7
- import { t as s } from "./composables-OP5kSvlh.js";
7
+ import { t as s } from "./composables-Vg-QfE_2.js";
8
8
  import { t as c } from "./wt-popover-DuZFw3bg.js";
9
9
  import { Fragment as l, computed as u, createBlock as d, createCommentVNode as f, createElementBlock as p, createElementVNode as m, createSlots as h, createTextVNode as g, createVNode as _, defineComponent as v, guardReactiveProps as y, nextTick as b, normalizeClass as x, normalizeProps as S, normalizeStyle as C, onMounted as w, onUnmounted as T, openBlock as E, ref as D, renderList as ee, renderSlot as O, resolveComponent as k, resolveDirective as te, toDisplayString as A, unref as j, useSlots as M, useTemplateRef as ne, withCtx as N, withDirectives as P, withModifiers as F } from "vue";
10
10
  //#region src/components/wt-table/_internals/wt-table-column-filter.vue?vue&type=script&setup=true&lang.ts
@@ -433,6 +433,6 @@ var I = ["onPointerenter", "onPointerleave"], L = /*#__PURE__*/ e(/* @__PURE__ *
433
433
  ]))]);
434
434
  };
435
435
  }
436
- }), [["__scopeId", "data-v-ac0e4169"]]);
436
+ }), [["__scopeId", "data-v-d94711c3"]]);
437
437
  //#endregion
438
438
  export { H as default };
@@ -1,4 +1,4 @@
1
- import { a as e, o as t, r as n, s as r } from "./components-oyMSmFwI.js";
1
+ import { a as e, o as t, r as n, s as r } from "./components-D574RP8y.js";
2
2
  import { t as i } from "./clients-BZ1QzRFi.js";
3
3
  import { t as a } from "./enums-Bd-8yrmg.js";
4
4
  import { t as o } from "./vue-i18n-B88GcHzn.js";
@@ -1,4 +1,4 @@
1
- import { w as e } from "./components-oyMSmFwI.js";
1
+ import { w as e } from "./components-D574RP8y.js";
2
2
  import "./convertDuration-CGW5IDMW.js";
3
3
  import { t } from "./_plugin-vue_export-helper-B3ysoDQm.js";
4
4
  import { c as n } from "./enums-Bd-8yrmg.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-sdk",
3
- "version": "26.8.104",
3
+ "version": "26.8.105",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "npm run docs:dev",
@@ -0,0 +1,206 @@
1
+ import { flushPromises, mount } from '@vue/test-utils';
2
+ import { describe, expect, it, vi } from 'vitest';
3
+ import { defineComponent, ref } from 'vue';
4
+
5
+ import type { SelectComponentRef } from '../types';
6
+ import { useSelectAutoOpen } from '../useSelectAutoOpen';
7
+
8
+ const useFakeRaf = () => {
9
+ const queue: FrameRequestCallback[] = [];
10
+
11
+ vi.stubGlobal('requestAnimationFrame', (cb: FrameRequestCallback) => {
12
+ queue.push(cb);
13
+ return queue.length;
14
+ });
15
+ vi.stubGlobal('cancelAnimationFrame', vi.fn());
16
+
17
+ return {
18
+ flushFrame: async () => {
19
+ const pending = queue.splice(0, queue.length);
20
+ for (const cb of pending) cb(0);
21
+ await flushPromises();
22
+ },
23
+ pendingFrames: () => queue.length,
24
+ };
25
+ };
26
+
27
+ const setup = ({
28
+ autoOpen = true,
29
+ rects = [
30
+ {},
31
+ ] as Array<Partial<DOMRect>>,
32
+ animations = [] as Animation[],
33
+ } = {}) => {
34
+ const show = vi.fn();
35
+ let call = 0;
36
+
37
+ const el = {
38
+ getAnimations: () => animations,
39
+ parentElement: null,
40
+ getBoundingClientRect: () =>
41
+ ({
42
+ top: 0,
43
+ left: 0,
44
+ width: 100,
45
+ height: 20,
46
+ ...rects[Math.min(call++, rects.length - 1)],
47
+ }) as DOMRect,
48
+ } as unknown as HTMLElement;
49
+
50
+ const selectRef = ref<SelectComponentRef | undefined>({
51
+ show,
52
+ $el: el,
53
+ });
54
+
55
+ let openWhenSettled = async () => {};
56
+
57
+ const wrapper = mount(
58
+ defineComponent({
59
+ setup() {
60
+ ({ openWhenSettled } = useSelectAutoOpen(() => autoOpen, selectRef));
61
+ return () => null;
62
+ },
63
+ }),
64
+ );
65
+
66
+ return {
67
+ show,
68
+ wrapper,
69
+ open: async () => {
70
+ void openWhenSettled();
71
+ await flushPromises();
72
+ },
73
+ };
74
+ };
75
+
76
+ const neverEndingAnimation = () =>
77
+ ({
78
+ finished: new Promise<void>(() => {}),
79
+ }) as unknown as Animation;
80
+
81
+ describe('useSelectAutoOpen', () => {
82
+ it('schedules nothing when autoOpen is off', async () => {
83
+ const raf = useFakeRaf();
84
+ const { show, open } = setup({
85
+ autoOpen: false,
86
+ });
87
+
88
+ await open();
89
+
90
+ expect(raf.pendingFrames()).toBe(0);
91
+ expect(show).not.toHaveBeenCalled();
92
+ });
93
+
94
+ it('does not open while an ancestor animation is still running', async () => {
95
+ const raf = useFakeRaf();
96
+ const { show, open } = setup({
97
+ animations: [
98
+ neverEndingAnimation(),
99
+ ],
100
+ });
101
+
102
+ await open();
103
+ await raf.flushFrame();
104
+ await raf.flushFrame();
105
+
106
+ expect(show).not.toHaveBeenCalled();
107
+ });
108
+
109
+ it('opens once the ancestor animation resolves and the rect is stable', async () => {
110
+ const raf = useFakeRaf();
111
+ const { show, open } = setup({
112
+ animations: [
113
+ {
114
+ finished: Promise.resolve(),
115
+ } as unknown as Animation,
116
+ ],
117
+ rects: [
118
+ {
119
+ top: 10,
120
+ },
121
+ ],
122
+ });
123
+
124
+ await open();
125
+
126
+ await raf.flushFrame();
127
+ expect(show).not.toHaveBeenCalled();
128
+
129
+ await raf.flushFrame();
130
+ expect(show).toHaveBeenCalledTimes(1);
131
+ });
132
+
133
+ it('keeps waiting while the trigger is still moving', async () => {
134
+ const raf = useFakeRaf();
135
+ const { show, open } = setup({
136
+ rects: [
137
+ {
138
+ top: 0,
139
+ },
140
+ {
141
+ top: 40,
142
+ },
143
+ {
144
+ top: 70,
145
+ },
146
+ {
147
+ top: 80,
148
+ },
149
+ {
150
+ top: 80,
151
+ },
152
+ ],
153
+ });
154
+
155
+ await open();
156
+
157
+ await raf.flushFrame();
158
+ await raf.flushFrame();
159
+ await raf.flushFrame();
160
+ await raf.flushFrame();
161
+ expect(show).not.toHaveBeenCalled();
162
+
163
+ await raf.flushFrame();
164
+ expect(show).toHaveBeenCalledTimes(1);
165
+ });
166
+
167
+ it('gives up waiting and opens after the frame cap', async () => {
168
+ const raf = useFakeRaf();
169
+ const { show, open } = setup({
170
+ rects: Array.from(
171
+ {
172
+ length: 40,
173
+ },
174
+ (_, i) => ({
175
+ top: i * 3,
176
+ }),
177
+ ),
178
+ });
179
+
180
+ await open();
181
+ for (let i = 0; i < 30; i += 1) await raf.flushFrame();
182
+
183
+ expect(show).toHaveBeenCalledTimes(1);
184
+ });
185
+
186
+ it('stops waiting when the select unmounts', async () => {
187
+ const raf = useFakeRaf();
188
+ const { show, wrapper, open } = setup({
189
+ rects: [
190
+ {
191
+ top: 0,
192
+ },
193
+ {
194
+ top: 40,
195
+ },
196
+ ],
197
+ });
198
+
199
+ await open();
200
+ await raf.flushFrame();
201
+ wrapper.unmount();
202
+ await raf.flushFrame();
203
+
204
+ expect(show).not.toHaveBeenCalled();
205
+ });
206
+ });
@@ -64,6 +64,7 @@ export interface UseSelectParams
64
64
  Pick<UseSelectDropdownParams, 'selectId' | 'selectRef' | 'filterInput'> {
65
65
  manualCustomValues?: boolean;
66
66
  isSingle: boolean;
67
+ autoOpen?: () => boolean | undefined;
67
68
  // biome-ignore lint/suspicious/noExplicitAny: receives the component's typed emit
68
69
  emit?: (event: any, ...args: any[]) => void;
69
70
  }
@@ -1,5 +1,6 @@
1
1
  import { onMounted } from 'vue';
2
2
  import type { UseSelectParams } from './types';
3
+ import { useSelectAutoOpen } from './useSelectAutoOpen';
3
4
  import { useSelectCustomValues } from './useSelectCustomValues';
4
5
  import { useSelectDropdown } from './useSelectDropdown';
5
6
  import { useSelectLoader } from './useSelectLoader';
@@ -19,6 +20,7 @@ export const useSelect = ({
19
20
  searchMethod,
20
21
  selectId,
21
22
  isSingle,
23
+ autoOpen,
22
24
  strictApiOptions = undefined,
23
25
  // biome-ignore lint/suspicious/noExplicitAny: receives the component's typed emit
24
26
  emit = (_event: any, ..._args: any[]) => {},
@@ -70,6 +72,8 @@ export const useSelect = ({
70
72
 
71
73
  const { showFooterLoader } = useSelectLoader(isLoading);
72
74
 
75
+ const { openWhenSettled } = useSelectAutoOpen(autoOpen, selectRef);
76
+
73
77
  const { onInputKeydown } = useSelectCustomValues({
74
78
  selected,
75
79
  filteredOptions,
@@ -85,8 +89,8 @@ export const useSelect = ({
85
89
 
86
90
  onMounted(async () => {
87
91
  await fetchSelectedByIds();
88
- if (!searchMethod.value) return;
89
- fetchOptions();
92
+ if (searchMethod.value) await fetchOptions();
93
+ openWhenSettled();
90
94
  });
91
95
 
92
96
  const clearValue = () => {
@@ -0,0 +1,106 @@
1
+ import { onBeforeUnmount, type Ref } from 'vue';
2
+
3
+ import type { SelectComponentRef } from './types';
4
+
5
+ /** ~500ms at 60fps — opens anyway if something animates without end. */
6
+ const MAX_SETTLE_FRAMES = 30;
7
+
8
+ /** `getAnimations()` marks the real end; polling geometry reads a lull mid-animation as one. */
9
+ const waitForAncestorAnimations = async (el: HTMLElement) => {
10
+ const animations: Animation[] = [];
11
+ let node: HTMLElement | null = el;
12
+
13
+ while (node) {
14
+ if (typeof node.getAnimations === 'function') {
15
+ animations.push(...node.getAnimations());
16
+ }
17
+ node = node.parentElement;
18
+ }
19
+
20
+ if (!animations.length) return;
21
+
22
+ await Promise.all(
23
+ animations.map((animation) => animation.finished.catch(() => undefined)),
24
+ );
25
+ };
26
+
27
+ /**
28
+ * Opens the dropdown (`autoOpen`) only once the select has stopped moving.
29
+ *
30
+ * In a popover the trigger keeps shifting through the 300ms enter animation,
31
+ * and primevue aligns the overlay to the trigger's rect — open too early and
32
+ * the dropdown sits in the wrong place until it snaps. The options half is the
33
+ * caller's: `useSelect` calls this after the first fetch resolves.
34
+ *
35
+ * [WTEL-10353](https://webitel.atlassian.net/browse/WTEL-10353)
36
+ */
37
+ export const useSelectAutoOpen = (
38
+ autoOpen: (() => boolean | undefined) | undefined,
39
+ selectRef: Ref<SelectComponentRef | undefined>,
40
+ ) => {
41
+ let rafId: number | null = null;
42
+ let isCancelled = false;
43
+
44
+ const cancel = () => {
45
+ isCancelled = true;
46
+ if (rafId !== null) {
47
+ cancelAnimationFrame(rafId);
48
+ rafId = null;
49
+ }
50
+ };
51
+
52
+ const waitForSettledRect = () =>
53
+ new Promise<void>((resolve) => {
54
+ let previousRect: DOMRect | undefined;
55
+ let frames = 0;
56
+
57
+ const step = () => {
58
+ rafId = null;
59
+ if (isCancelled) return;
60
+
61
+ const el = selectRef.value?.$el;
62
+ if (!el) return;
63
+
64
+ const rect = el.getBoundingClientRect();
65
+ const isSettled =
66
+ !!previousRect &&
67
+ rect.top === previousRect.top &&
68
+ rect.left === previousRect.left &&
69
+ rect.width === previousRect.width &&
70
+ rect.height === previousRect.height;
71
+
72
+ if (isSettled || ++frames >= MAX_SETTLE_FRAMES) {
73
+ resolve();
74
+ return;
75
+ }
76
+
77
+ previousRect = rect;
78
+ rafId = requestAnimationFrame(step);
79
+ };
80
+
81
+ rafId = requestAnimationFrame(step);
82
+ });
83
+
84
+ const openWhenSettled = async () => {
85
+ if (!autoOpen?.()) return;
86
+
87
+ const el = selectRef.value?.$el;
88
+ if (!el) return;
89
+
90
+ isCancelled = false;
91
+
92
+ await waitForAncestorAnimations(el);
93
+ if (isCancelled) return;
94
+
95
+ await waitForSettledRect();
96
+ if (isCancelled) return;
97
+
98
+ selectRef.value?.show?.();
99
+ };
100
+
101
+ onBeforeUnmount(cancel);
102
+
103
+ return {
104
+ openWhenSettled,
105
+ };
106
+ };
@@ -11,5 +11,6 @@ export interface PrimevueInstance {
11
11
  export interface PrimevueOverlayInstance extends PrimevueInstance {
12
12
  overlay?: HTMLElement;
13
13
  alignOverlay?: () => void;
14
+ show?: (event?: Event) => void;
14
15
  hide?: () => void;
15
16
  }
@@ -167,6 +167,7 @@ interface Props extends Omit<SelectProps, 'options'> {
167
167
  * false disables options search
168
168
  */
169
169
  filterable?: boolean;
170
+ autoOpen?: boolean;
170
171
  /**
171
172
  * true shows the clear button
172
173
  */
@@ -260,6 +261,7 @@ const {
260
261
  searchMethod: computed(() => props.searchMethod),
261
262
  selectId: computed(() => selectId),
262
263
  isSingle: false,
264
+ autoOpen: () => props.autoOpen,
263
265
  strictApiOptions: computed(() => props.strictApiOptions),
264
266
  emit,
265
267
  });
@@ -140,6 +140,7 @@ interface Props extends Omit<SelectProps, 'size' | 'options'> {
140
140
  * false disables options search
141
141
  */
142
142
  filterable?: boolean;
143
+ autoOpen?: boolean;
143
144
  /**
144
145
  * true shows the clear button
145
146
  */
@@ -227,6 +228,7 @@ const {
227
228
  searchMethod: computed(() => props.searchMethod),
228
229
  selectId: computed(() => selectId),
229
230
  isSingle: true,
231
+ autoOpen: () => props.autoOpen,
230
232
  strictApiOptions: computed(() => props.strictApiOptions),
231
233
  emit,
232
234
  });
@@ -673,7 +673,13 @@ onUnmounted(() => {
673
673
  .wt-table__empty {
674
674
  position: absolute;
675
675
  inset: 0;
676
+ z-index: 1;
676
677
  display: flex;
678
+ pointer-events: none;
679
+ }
680
+
681
+ .wt-table__empty > * {
682
+ pointer-events: auto;
677
683
  }
678
684
 
679
685
  .wt-table :deep(.wt-table__wrapper--overlay tr.p-datatable-empty-message) {
@@ -139,63 +139,63 @@ import { ref, toRefs } from 'vue';
139
139
  import { useI18n } from 'vue-i18n';
140
140
 
141
141
  import useUploadCsv, {
142
- type UseUploadCsvProps,
142
+ type UseUploadCsvProps,
143
143
  } from '../composable/useUploadCsv';
144
144
  import type { CsvMappingField } from '../scripts/normalizeCSVData';
145
145
  import HandlingCSVMode from '../types/WtUploadCSVHandlingMode.enum';
146
146
 
147
147
  interface CharsetOption {
148
- name: string;
149
- value: string;
148
+ name: string;
149
+ value: string;
150
150
  }
151
151
 
152
152
  interface Props extends UseUploadCsvProps {
153
- file: File | null;
154
- mappingFields: CsvMappingField[];
153
+ file: File | null;
154
+ mappingFields: CsvMappingField[];
155
155
  }
156
156
 
157
157
  const props = withDefaults(defineProps<Props>(), {
158
- file: null,
159
- mappingFields: () => [],
160
- handlingMode: HandlingCSVMode.PROCESS,
158
+ file: null,
159
+ mappingFields: () => [],
160
+ handlingMode: HandlingCSVMode.PROCESS,
161
161
  });
162
162
 
163
163
  const emit = defineEmits<{
164
- (e: 'changeMappingFields', value: unknown[]): void;
165
- (e: 'save'): void;
166
- (e: 'close'): void;
164
+ (e: 'changeMappingFields', value: unknown[]): void;
165
+ (e: 'save'): void;
166
+ (e: 'close'): void;
167
167
  }>();
168
168
 
169
169
  const { t } = useI18n();
170
170
 
171
171
  const getFieldLabel = (field: CsvMappingField) =>
172
- field.locale ? t(field.locale) : field.name;
172
+ field.locale ? t(field.locale) : field.name;
173
173
 
174
174
  const skipHeaders = ref(true);
175
175
  const separator = ref(',');
176
176
  const charsetOptions = ref<CharsetOption[]>([]);
177
177
  const charset = ref<CharsetOption>({
178
- name: 'UTF-8',
179
- value: 'utf-8',
178
+ name: 'UTF-8',
179
+ value: 'utf-8',
180
180
  });
181
181
 
182
182
  const { file, mappingFields } = toRefs(props);
183
183
 
184
184
  const {
185
- isReadingFile,
186
- isParsingCSV,
187
- isParsingPreview,
188
- csvPreviewTableData,
189
- csvPreviewTableHeaders,
190
- csvColumns,
191
- allowSaveAction,
192
- processCSV,
193
- close,
185
+ isReadingFile,
186
+ isParsingCSV,
187
+ isParsingPreview,
188
+ csvPreviewTableData,
189
+ csvPreviewTableHeaders,
190
+ csvColumns,
191
+ allowSaveAction,
192
+ processCSV,
193
+ close,
194
194
  } = useUploadCsv({
195
- props,
196
- emit,
197
- skipHeaders,
198
- separator,
195
+ props,
196
+ emit,
197
+ skipHeaders,
198
+ separator,
199
199
  });
200
200
  </script>
201
201
 
@@ -91,7 +91,7 @@ describe('useUploadCsv', () => {
91
91
  it('mounts a component with the composable', () => {
92
92
  const wrapper = shallowMount(Component, {
93
93
  props: {
94
- file: {},
94
+ file: null,
95
95
  },
96
96
  });
97
97
 
@@ -226,7 +226,9 @@ const useUploadCsv = ({
226
226
  (file) => {
227
227
  if (file) initUploadPopup();
228
228
  },
229
- { immediate: true }, // if popup has v-if=file
229
+ {
230
+ immediate: true,
231
+ }, // if popup has v-if=file
230
232
  );
231
233
 
232
234
  return {