@webitel/ui-sdk 26.8.51 → 26.8.52

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.
@@ -1,4 +1,4 @@
1
- import "./components-9JJurJkY.js";
1
+ import "./components-C4rE9PlV.js";
2
2
  import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
3
3
  import { l as t } from "./enums-DY3jIXFF.js";
4
4
  import { t as n } from "./wt-button-2_aOV7LX.js";
@@ -1,4 +1,4 @@
1
- import { C as e, i as t } from "./components-9JJurJkY.js";
1
+ import { C as e, i as t } from "./components-C4rE9PlV.js";
2
2
  import { t as n } from "./_plugin-vue_export-helper-B3ysoDQm.js";
3
3
  import { t as r } from "./displayText-CtaxzaBz.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,6 +1,6 @@
1
1
  import { t as e } from "./rolldown-runtime-BEcgMyyN.js";
2
- import { n as t, r as n } from "./clients-rgtvDufW.js";
3
- import { T as r, n as i, w as a } from "./components-9JJurJkY.js";
2
+ import { n as t, r as n } from "./clients-jhkEj9YI.js";
3
+ import { T as r, n as i, w as a } from "./components-C4rE9PlV.js";
4
4
  import { t as o } from "./vue-i18n-Db_oYfO8.js";
5
5
  import { n as s } from "./useEventBus-B-ZeklLu.js";
6
6
  import { createBlock as c, createTextVNode as l, createVNode as u, defineComponent as d, mergeProps as f, onMounted as p, openBlock as m, ref as h, resolveComponent as g, toDisplayString as _, unref as v, withCtx as y } from "vue";
@@ -1,5 +1,5 @@
1
- import { t as e } from "./clients-rgtvDufW.js";
2
- import { a as t, o as n, r, s as i } from "./components-9JJurJkY.js";
1
+ import { t as e } from "./clients-jhkEj9YI.js";
2
+ import { a as t, o as n, r, s as i } from "./components-C4rE9PlV.js";
3
3
  import { t as a } from "./enums-DY3jIXFF.js";
4
4
  import { t as o } from "./vue-i18n-Db_oYfO8.js";
5
5
  import { computed as s, createBlock as c, createCommentVNode as l, createVNode as u, defineComponent as d, mergeModels as f, mergeProps as p, openBlock as m, renderSlot as h, resolveComponent as g, unref as _, useModel as v } from "vue";
@@ -1,4 +1,4 @@
1
- import { D as e } from "./components-9JJurJkY.js";
1
+ import { D as e } from "./components-C4rE9PlV.js";
2
2
  import { t } from "./_plugin-vue_export-helper-B3ysoDQm.js";
3
3
  import { l as n } from "./enums-DY3jIXFF.js";
4
4
  import "./wt-button-2_aOV7LX.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-sdk",
3
- "version": "26.8.51",
3
+ "version": "26.8.52",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "npm run docs:dev",
@@ -1,7 +1,6 @@
1
1
  export * from './useCachedInterval/useCachedInterval';
2
2
  export * from './useCachedItemInstanceName/useCachedItemInstanceName';
3
3
  export * from './useCard/useCardComponent';
4
- export * from './useCard/useCardTabs';
5
4
  export * from './useClose/useClose';
6
5
  export * from './useDestroyableSortable/useDestroyableSortable';
7
6
  export * from './useEventBus/useEventBus';
@@ -252,7 +252,7 @@ const {
252
252
  } = useTableEmpty({
253
253
  dataList,
254
254
  error,
255
- filters: tabFilters.value,
255
+ filters: tabFilters,
256
256
  isLoading,
257
257
  });
258
258
 
@@ -1,5 +1,5 @@
1
1
  import deepmerge from 'deepmerge';
2
- import { computed, inject, toRef } from 'vue';
2
+ import { computed, inject, type MaybeRefOrGetter, toRef, toValue } from 'vue';
3
3
  import { useI18n } from 'vue-i18n';
4
4
 
5
5
  import { EmptyCause } from '../../../enums/index';
@@ -9,18 +9,46 @@ import EmptyFiltersLight from '../_internals/assets/empty-filters-light.svg';
9
9
  import EmptyTableDark from '../_internals/assets/empty-table-dark.svg';
10
10
  import EmptyTableLight from '../_internals/assets/empty-table-light.svg';
11
11
 
12
- /**
13
- * @param {{ dataList?: unknown; filters?: unknown; error?: unknown; isLoading?: unknown }} [source]
14
- * @param {object} [overrides]
15
- */
12
+ interface EmptyImageSet {
13
+ dark: string;
14
+ light: string;
15
+ }
16
+
17
+ interface EmptyStateVariants<T> {
18
+ filters: T;
19
+ error: T;
20
+ empty: T;
21
+ }
22
+
23
+ interface EmptyStateConfig {
24
+ image: EmptyStateVariants<EmptyImageSet>;
25
+ headline: EmptyStateVariants<string>;
26
+ title: EmptyStateVariants<string>;
27
+ text: EmptyStateVariants<string>;
28
+ primaryActionText: EmptyStateVariants<string>;
29
+ secondaryActionText: EmptyStateVariants<string>;
30
+ }
31
+
32
+ /** duck-typed readable ref — accepts `Ref`/`ComputedRef`/Pinia `ToRef` alike, only `.value` is ever read */
33
+ type Readable<T> = {
34
+ value: T;
35
+ };
36
+
37
+ export interface UseTableEmptySource {
38
+ dataList?: Readable<unknown[] | undefined>;
39
+ filters?: Readable<Record<string, unknown> | undefined>;
40
+ error?: Readable<unknown>;
41
+ isLoading?: Readable<boolean | undefined>;
42
+ }
43
+
16
44
  export const useTableEmpty = (
17
- { dataList, filters, error, isLoading } = {},
18
- overrides = {},
45
+ { dataList, filters, error, isLoading }: UseTableEmptySource = {},
46
+ overrides: MaybeRefOrGetter<Partial<EmptyStateConfig>> = {},
19
47
  ) => {
20
48
  const { t } = useI18n();
21
49
 
22
50
  // use computed, so that at locale change, texts will be updated too
23
- const defaults = computed(() => ({
51
+ const defaults = computed<EmptyStateConfig>(() => ({
24
52
  image: {
25
53
  filters: {
26
54
  dark: EmptyFiltersDark,
@@ -62,18 +90,18 @@ export const useTableEmpty = (
62
90
  },
63
91
  }));
64
92
 
65
- const merged = computed(() => deepmerge(defaults.value, overrides));
93
+ const merged = computed(() => deepmerge(defaults.value, toValue(overrides)));
66
94
 
67
- const darkMode = toRef(inject('darkMode'));
95
+ const darkMode = toRef(inject<boolean>('darkMode'));
68
96
 
69
97
  const emptyState = computed(() => {
70
98
  return !isLoading?.value && !error?.value && !dataList?.value?.length;
71
99
  });
72
100
 
73
- const emptyCause = computed(() => {
101
+ const emptyCause = computed<EmptyCause | null>(() => {
74
102
  if (!emptyState?.value) return null;
75
103
 
76
- if (error.value) return EmptyCause.ERROR;
104
+ if (error?.value) return EmptyCause.ERROR;
77
105
  if (filters?.value) {
78
106
  const uncheckedFilters = [
79
107
  'page',