@webitel/ui-sdk 26.8.51 → 26.8.53

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.53",
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
 
@@ -9,18 +9,72 @@ 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
+ type DeepPartial<T> = T extends object
13
+ ? {
14
+ [K in keyof T]?: DeepPartial<T[K]>;
15
+ }
16
+ : T;
17
+
18
+ interface EmptyImageSet {
19
+ dark: string;
20
+ light: string;
21
+ }
22
+
23
+ interface EmptyStateVariants<T> {
24
+ filters: T;
25
+ error: T;
26
+ empty: T;
27
+ }
28
+
29
+ interface EmptyStateConfig {
30
+ image: EmptyStateVariants<EmptyImageSet>;
31
+ headline: EmptyStateVariants<string>;
32
+ title: EmptyStateVariants<string>;
33
+ text: EmptyStateVariants<string>;
34
+ primaryActionText: EmptyStateVariants<string>;
35
+ secondaryActionText: EmptyStateVariants<string>;
36
+ }
37
+
38
+ /** duck-typed readable ref — accepts `Ref`/`ComputedRef`/Pinia `ToRef` alike, only `.value` is ever read */
39
+ type Readable<T> = {
40
+ value: T;
41
+ };
42
+
43
+ export interface UseTableEmptySource {
44
+ dataList?: Readable<unknown[] | undefined>;
45
+ filters?: Readable<Record<string, unknown> | undefined>;
46
+ error?: Readable<unknown>;
47
+ isLoading?: Readable<boolean | undefined>;
48
+ }
49
+
50
+ type MaybeOverridesGetter =
51
+ | DeepPartial<EmptyStateConfig>
52
+ | Readable<DeepPartial<EmptyStateConfig>>
53
+ | (() => DeepPartial<EmptyStateConfig>);
54
+
55
+ const resolveOverrides = (
56
+ source: MaybeOverridesGetter,
57
+ ): DeepPartial<EmptyStateConfig> => {
58
+ if (typeof source === 'function') return source();
59
+ if (source && typeof source === 'object' && 'value' in source) {
60
+ return source.value;
61
+ }
62
+ return source;
63
+ };
64
+
12
65
  /**
13
- * @param {{ dataList?: unknown; filters?: unknown; error?: unknown; isLoading?: unknown }} [source]
14
- * @param {object} [overrides]
66
+ * @param overrides plain object, ref, computed, or getter use a reactive
67
+ * source (not a plain object literal) if any value inside depends on
68
+ * locale/dark mode, so it re-evaluates instead of freezing at first render
15
69
  */
16
70
  export const useTableEmpty = (
17
- { dataList, filters, error, isLoading } = {},
18
- overrides = {},
71
+ { dataList, filters, error, isLoading }: UseTableEmptySource = {},
72
+ overrides: MaybeOverridesGetter = {},
19
73
  ) => {
20
74
  const { t } = useI18n();
21
75
 
22
76
  // use computed, so that at locale change, texts will be updated too
23
- const defaults = computed(() => ({
77
+ const defaults = computed<EmptyStateConfig>(() => ({
24
78
  image: {
25
79
  filters: {
26
80
  dark: EmptyFiltersDark,
@@ -62,18 +116,24 @@ export const useTableEmpty = (
62
116
  },
63
117
  }));
64
118
 
65
- const merged = computed(() => deepmerge(defaults.value, overrides));
119
+ const merged = computed<EmptyStateConfig>(
120
+ () =>
121
+ deepmerge(
122
+ defaults.value,
123
+ resolveOverrides(overrides),
124
+ ) as EmptyStateConfig,
125
+ );
66
126
 
67
- const darkMode = toRef(inject('darkMode'));
127
+ const darkMode = toRef(inject<boolean>('darkMode'));
68
128
 
69
129
  const emptyState = computed(() => {
70
130
  return !isLoading?.value && !error?.value && !dataList?.value?.length;
71
131
  });
72
132
 
73
- const emptyCause = computed(() => {
133
+ const emptyCause = computed<EmptyCause | null>(() => {
74
134
  if (!emptyState?.value) return null;
75
135
 
76
- if (error.value) return EmptyCause.ERROR;
136
+ if (error?.value) return EmptyCause.ERROR;
77
137
  if (filters?.value) {
78
138
  const uncheckedFilters = [
79
139
  'page',