@webitel/ui-sdk 26.8.130 → 26.8.132

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,7 +1,7 @@
1
1
  import { t as e } from "./caseConverters-DGri4uJo.js";
2
2
  import { t } from "./_plugin-vue_export-helper-B3ysoDQm.js";
3
3
  import { d as n } from "./enums-Qt_FgVQw.js";
4
- import { t as r } from "./wt-icon-action-BIO8dR4s.js";
4
+ import { t as r } from "./wt-icon-action-CDlCgzR8.js";
5
5
  import { Fragment as i, computed as a, createElementBlock as o, createVNode as s, defineComponent as c, guardReactiveProps as l, mergeProps as u, normalizeProps as d, openBlock as f, renderList as p, renderSlot as m } from "vue";
6
6
  //#region src/components/wt-action-bar/WtActionBarActionsOrder.ts
7
7
  var h = [
@@ -1,4 +1,4 @@
1
- import "./components-BF21ppoM.js";
1
+ import "./components-EhdFHjjv.js";
2
2
  import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
3
3
  import { T as t, m as n } from "./enums-Qt_FgVQw.js";
4
4
  import { t as r } from "./wt-button-qmvx3hrn.js";
@@ -1,4 +1,4 @@
1
- import { C as e, i as t } from "./components-BF21ppoM.js";
1
+ import { C as e, i as t } from "./components-EhdFHjjv.js";
2
2
  import { t as n } from "./_plugin-vue_export-helper-B3ysoDQm.js";
3
3
  import { t as r } from "./utils-g-eGs-rV.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";
@@ -34,24 +34,7 @@ var u = Object.freeze({
34
34
  action: {
35
35
  type: String,
36
36
  required: !0,
37
- validator: (t) => Object.values([
38
- e.DELETE,
39
- e.EDIT,
40
- e.ADD,
41
- e.HISTORY,
42
- e.DOWNLOAD,
43
- e.REFRESH,
44
- e.SAVE,
45
- e.CANCEL,
46
- e.SAVE_PRESET,
47
- e.APPLY_PRESET,
48
- e.ADD_CONTACT,
49
- e.DOWNLOAD_PDF,
50
- e.CHAT,
51
- e.SORT,
52
- e.UPLOAD,
53
- e.LOGOUT
54
- ]).includes(t)
37
+ validator: (t) => Object.values(e).includes(t)
55
38
  },
56
39
  disabled: {
57
40
  type: Boolean,
@@ -1,6 +1,6 @@
1
- import { n as e } from "./components-BF21ppoM.js";
1
+ import { n as e } from "./components-EhdFHjjv.js";
2
2
  import "./convertDuration-B7EyPh1B.js";
3
- import { i as t, r as n } from "./clients-CK-bThbs.js";
3
+ import { i as t, r as n } from "./clients-BXD-NjhU.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-BF21ppoM.js";
5
- import { a as p, n as m, t as h } from "./clients-CK-bThbs.js";
4
+ import { a as l, o as u, r as d, s as f } from "./components-EhdFHjjv.js";
5
+ import { a as p, n as m, t as h } from "./clients-BXD-NjhU.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, x as D } from "./enums-Qt_FgVQw.js";
7
7
  import { n as ee, t as te } from "./vue-i18n-VBiROMZ4.js";
8
8
  import "./wt-toast-DGtljpcq.js";
@@ -1,4 +1,4 @@
1
- import { w as e } from "./components-BF21ppoM.js";
1
+ import { w as e } from "./components-EhdFHjjv.js";
2
2
  import "./convertDuration-B7EyPh1B.js";
3
3
  import { t } from "./_plugin-vue_export-helper-B3ysoDQm.js";
4
4
  import { m as n } from "./enums-Qt_FgVQw.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-sdk",
3
- "version": "26.8.130",
3
+ "version": "26.8.132",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "npm run docs:dev",
@@ -24,25 +24,7 @@ const props = defineProps({
24
24
  action: {
25
25
  type: String,
26
26
  required: true,
27
- validator: (v) =>
28
- Object.values([
29
- IconAction.DELETE,
30
- IconAction.EDIT,
31
- IconAction.ADD,
32
- IconAction.HISTORY,
33
- IconAction.DOWNLOAD,
34
- IconAction.REFRESH,
35
- IconAction.SAVE,
36
- IconAction.CANCEL,
37
- IconAction.SAVE_PRESET,
38
- IconAction.APPLY_PRESET,
39
- IconAction.ADD_CONTACT,
40
- IconAction.DOWNLOAD_PDF,
41
- IconAction.CHAT,
42
- IconAction.SORT,
43
- IconAction.UPLOAD,
44
- IconAction.LOGOUT,
45
- ]).includes(v),
27
+ validator: (v) => Object.values(IconAction).includes(v),
46
28
  },
47
29
  disabled: {
48
30
  type: Boolean,
@@ -0,0 +1,31 @@
1
+ import { defineStore } from 'pinia';
2
+ import { ref } from 'vue';
3
+
4
+ export const createReactiveNowStore = () => {
5
+ const namespace = 'now';
6
+
7
+ const store = defineStore(namespace, () => {
8
+ const now = ref(Date.now());
9
+ let interval: ReturnType<typeof setInterval> | null = null;
10
+
11
+ const startWatcher = () => {
12
+ if (interval) return;
13
+ interval = setInterval(() => {
14
+ now.value = Date.now();
15
+ }, 1000);
16
+ };
17
+
18
+ const stopWatcher = () => {
19
+ if (interval) clearInterval(interval);
20
+ interval = null;
21
+ };
22
+
23
+ return {
24
+ now,
25
+ startWatcher,
26
+ stopWatcher,
27
+ };
28
+ });
29
+
30
+ return store;
31
+ };
@@ -0,0 +1,53 @@
1
+ import { createPinia, setActivePinia } from 'pinia';
2
+ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
3
+
4
+ import { createReactiveNowStore } from '../ReactiveNowStore';
5
+
6
+ describe('createReactiveNowStore', () => {
7
+ beforeEach(() => {
8
+ setActivePinia(createPinia());
9
+ vi.useFakeTimers();
10
+ });
11
+
12
+ afterEach(() => {
13
+ vi.useRealTimers();
14
+ });
15
+
16
+ it('ticks now every second once started', () => {
17
+ const useNowStore = createReactiveNowStore();
18
+ const store = useNowStore();
19
+
20
+ const initial = store.now;
21
+ store.startWatcher();
22
+
23
+ vi.advanceTimersByTime(3000);
24
+
25
+ expect(store.now).toBeGreaterThan(initial);
26
+ });
27
+
28
+ it('stops ticking once stopped', () => {
29
+ const useNowStore = createReactiveNowStore();
30
+ const store = useNowStore();
31
+
32
+ store.startWatcher();
33
+ store.stopWatcher();
34
+
35
+ const afterStop = store.now;
36
+ vi.advanceTimersByTime(3000);
37
+
38
+ expect(store.now).toBe(afterStop);
39
+ });
40
+
41
+ it('does not stack intervals when started twice', () => {
42
+ const useNowStore = createReactiveNowStore();
43
+ const store = useNowStore();
44
+
45
+ store.startWatcher();
46
+ store.startWatcher();
47
+
48
+ const setIntervalSpy = vi.spyOn(globalThis, 'setInterval');
49
+ store.startWatcher();
50
+
51
+ expect(setIntervalSpy).not.toHaveBeenCalled();
52
+ });
53
+ });