@webitel/ui-sdk 26.8.116 → 26.8.118

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-DSjkNfg7.js";
1
+ import "./components-CeOlovz8.js";
2
2
  import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
3
3
  import { m as t } from "./enums-CsINFPBu.js";
4
4
  import { t as n } from "./wt-button-rUZKbswL.js";
@@ -1,4 +1,4 @@
1
- import { C as e, i as t } from "./components-DSjkNfg7.js";
1
+ import { C as e, i as t } from "./components-CeOlovz8.js";
2
2
  import { t as n } from "./_plugin-vue_export-helper-B3ysoDQm.js";
3
3
  import { t as r } from "./utils-DHSDTqJG.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
- import { n as e } from "./components-DSjkNfg7.js";
1
+ import { n as e } from "./components-CeOlovz8.js";
2
2
  import "./convertDuration-CW5qzlwH.js";
3
- import { i as t, r as n } from "./clients-BFB093fa.js";
3
+ import { i as t, r as n } from "./clients-DWcx-Mfk.js";
4
4
  import { n as r } from "./vue-i18n-VBiROMZ4.js";
5
5
  import { n as i } from "./useEventBus-B-ZeklLu.js";
6
6
  import { createBlock as a, createTextVNode as o, createVNode as s, defineComponent as c, mergeProps as l, onMounted as u, openBlock as d, ref as f, resolveComponent as p, toDisplayString as m, unref as h, withCtx as g } from "vue";
@@ -1,8 +1,8 @@
1
1
  import { a as e, c as t, i as n, n as r, r as i, s as a, t as o } from "./dist-EXdgfpvN.js";
2
2
  import { n as s } from "./genClient-CvWlQ0TZ.js";
3
3
  import { a as c } from "./caseConverters-DGri4uJo.js";
4
- import { a as l, o as u, r as d, s as f } from "./components-DSjkNfg7.js";
5
- import { a as p, n as m, t as h } from "./clients-BFB093fa.js";
4
+ import { a as l, o as u, r as d, s as f } from "./components-CeOlovz8.js";
5
+ import { a as p, n as m, t as h } from "./clients-DWcx-Mfk.js";
6
6
  import { a as g, b as _, d as v, f as y, g as b, i as x, n as S, o as C, r as w, s as T, t as E, y as D } from "./enums-CsINFPBu.js";
7
7
  import { n as ee, t as te } from "./vue-i18n-VBiROMZ4.js";
8
8
  import "./wt-toast-pXV44Y3v.js";
@@ -1,4 +1,4 @@
1
- import { w as e } from "./components-DSjkNfg7.js";
1
+ import { w as e } from "./components-CeOlovz8.js";
2
2
  import "./convertDuration-CW5qzlwH.js";
3
3
  import { t } from "./_plugin-vue_export-helper-B3ysoDQm.js";
4
4
  import { m as n } from "./enums-CsINFPBu.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-sdk",
3
- "version": "26.8.116",
3
+ "version": "26.8.118",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "npm run docs:dev",
@@ -9,6 +9,10 @@
9
9
  --wt-popup-size-md: 800px;
10
10
  --wt-popup-size-lg: 1140px;
11
11
 
12
+ --wt-popup-height-sm: 300px;
13
+ --wt-popup-height-md: 400px;
14
+ --wt-popup-height-lg: 600px;
15
+
12
16
  --popup-max-height: 90%;
13
17
 
14
18
  --wt-popup-background-color: var(--dp-24-surface-color);
@@ -1,7 +1,14 @@
1
1
  <template>
2
2
  <div
3
- v-show="showPopupComponent" :class="[`wt-popup--size-${size}`, { 'wt-popup--overflow': overflow }]"
4
- class="wt-popup">
3
+ v-show="showPopupComponent"
4
+ :class="[
5
+ `wt-popup--size-${size}`,
6
+ height && `wt-popup--height-${height}`,
7
+ {
8
+ 'wt-popup--overflow': overflow,
9
+ }]"
10
+ class="wt-popup"
11
+ >
5
12
  <!-- &lt;!&ndash; @slot check source code for scoped bindings :( &ndash;&gt;-->
6
13
  <!-- <slot-->
7
14
  <!-- class="wt-popup-activator"-->
@@ -51,6 +58,12 @@ interface Props {
51
58
  */
52
59
  shown?: boolean;
53
60
  size?: ComponentSize;
61
+ /**
62
+ * temprorary height of the popup for WS2
63
+ * to avoid WS1 popup broken
64
+ * will be removed after primevue migration
65
+ */
66
+ height?: ComponentSize;
54
67
  /**
55
68
  * if true, popup contents will overflow popup container, without scrolling
56
69
  * useful for small popups with select components, which have not enough space
@@ -207,6 +220,18 @@ watch(wrapperShown, (value) => {
207
220
  width: var(--wt-popup-size-lg);
208
221
  }
209
222
 
223
+ .wt-popup--height-sm .wt-popup__popup {
224
+ height: var(--wt-popup-height-sm);
225
+ }
226
+
227
+ .wt-popup--height-md .wt-popup__popup {
228
+ height: var(--wt-popup-height-md);
229
+ }
230
+
231
+ .wt-popup--height-lg .wt-popup__popup {
232
+ height: var(--wt-popup-height-lg);
233
+ }
234
+
210
235
  .wt-popup__popup {
211
236
  display: flex;
212
237
  flex-direction: column;
@@ -4,5 +4,6 @@ export * from './useCard/useCardComponent';
4
4
  export * from './useClose/useClose';
5
5
  export * from './useDestroyableSortable/useDestroyableSortable';
6
6
  export * from './useEventBus/useEventBus';
7
+ export * from './useMinDurationLoader/useMinDurationLoader';
7
8
  export * from './useRepresentableAgentPauseCause/useRepresentableAgentPauseCause';
8
9
  export * from './useValidate/useValidate';
@@ -0,0 +1,30 @@
1
+ import { type Ref, ref } from 'vue';
2
+
3
+ export interface UseMinDurationLoaderReturn {
4
+ isLoading: Ref<boolean>;
5
+ runWithMinDuration: <T>(action: () => Promise<T>) => Promise<T>;
6
+ }
7
+
8
+ export const useMinDurationLoader = (
9
+ minDurationMs = 500,
10
+ ): UseMinDurationLoaderReturn => {
11
+ const isLoading = ref(false);
12
+
13
+ const runWithMinDuration = async <T>(
14
+ action: () => Promise<T>,
15
+ ): Promise<T> => {
16
+ isLoading.value = true;
17
+ try {
18
+ return await action();
19
+ } finally {
20
+ setTimeout(() => {
21
+ isLoading.value = false;
22
+ }, minDurationMs);
23
+ }
24
+ };
25
+
26
+ return {
27
+ isLoading,
28
+ runWithMinDuration,
29
+ };
30
+ };
@@ -0,0 +1,83 @@
1
+ import { describe, expect, it } from 'vitest';
2
+
3
+ import { findTreePath } from '../findTreePath';
4
+
5
+ interface Service {
6
+ id: string;
7
+ name: string;
8
+ service?: Service[];
9
+ }
10
+
11
+ const services: Service[] = [
12
+ {
13
+ id: 'billing',
14
+ name: 'Billing',
15
+ service: [
16
+ {
17
+ id: 'refunds',
18
+ name: 'Refunds',
19
+ service: [
20
+ {
21
+ id: 'card',
22
+ name: 'Card refund',
23
+ },
24
+ ],
25
+ },
26
+ ],
27
+ },
28
+ {
29
+ id: 'support',
30
+ name: 'Support',
31
+ },
32
+ ];
33
+
34
+ const byId = (id: string) => (service: Service) => service.id === id;
35
+
36
+ describe('findTreePath', () => {
37
+ it('returns the nodes from the root down to the target', () => {
38
+ expect(
39
+ findTreePath(services, byId('card'), 'service')?.map(({ name }) => name),
40
+ ).toEqual([
41
+ 'Billing',
42
+ 'Refunds',
43
+ 'Card refund',
44
+ ]);
45
+ });
46
+
47
+ it('returns a one-node path for a root', () => {
48
+ expect(findTreePath(services, byId('support'), 'service')).toEqual([
49
+ services[1],
50
+ ]);
51
+ });
52
+
53
+ it('returns null when nothing matches, or there is no tree', () => {
54
+ expect(findTreePath(services, byId('missing'), 'service')).toBeNull();
55
+ expect(findTreePath(undefined, byId('card'), 'service')).toBeNull();
56
+ expect(findTreePath([], byId('card'), 'service')).toBeNull();
57
+ });
58
+
59
+ it('stops at the first match, depth first', () => {
60
+ const tree = [
61
+ {
62
+ id: 'a',
63
+ children: [
64
+ {
65
+ id: 'x',
66
+ },
67
+ ],
68
+ },
69
+ {
70
+ id: 'x',
71
+ },
72
+ ];
73
+
74
+ expect(
75
+ findTreePath(tree, (node) => node.id === 'x', 'children')?.map(
76
+ ({ id }) => id,
77
+ ),
78
+ ).toEqual([
79
+ 'a',
80
+ 'x',
81
+ ]);
82
+ });
83
+ });
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Walks a tree depth-first and returns the nodes from a root down to the
3
+ * first node matching `isTarget`, both ends included, or `null` when nothing
4
+ * matches. Children are read from `childrenKey` (e.g. `service` for case
5
+ * service catalogs, whose services nest under `service`).
6
+ *
7
+ * The path is what a breadcrumb, an "A / B / C" label or an ancestor check
8
+ * needs: `path.map(({ name }) => name)`, `path.slice(0, -1)`, and so on.
9
+ */
10
+ export function findTreePath<TNode extends object>(
11
+ nodes: readonly TNode[] | null | undefined,
12
+ isTarget: (node: TNode) => boolean,
13
+ // NoInfer: the node type comes from `nodes` only; inferred from the key
14
+ // literal instead, loosely typed trees narrowed to `{ service: any }`
15
+ childrenKey: NoInfer<keyof TNode>,
16
+ ): TNode[] | null {
17
+ for (const node of nodes ?? []) {
18
+ if (isTarget(node))
19
+ return [
20
+ node,
21
+ ];
22
+ const children = node[childrenKey];
23
+ if (Array.isArray(children)) {
24
+ const path = findTreePath(children as TNode[], isTarget, childrenKey);
25
+ if (path)
26
+ return [
27
+ node,
28
+ ...path,
29
+ ];
30
+ }
31
+ }
32
+ return null;
33
+ }
@@ -1,3 +1,4 @@
1
1
  export * from './displayText';
2
+ export * from './findTreePath';
2
3
  export * from './formatDate';
3
4
  export * from './prettifyDate';