@webitel/ui-sdk 26.6.44 → 26.6.46

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.
@@ -0,0 +1,134 @@
1
+ import { t as e } from "./wt-icon-pxO7IjwV.js";
2
+ import { c as t, d as n, u as r } from "./enums-pbYAJNeb.js";
3
+ import { computed as i, createBlock as a, createCommentVNode as o, createElementVNode as s, createTextVNode as c, defineComponent as l, inject as u, mergeProps as d, normalizeClass as f, openBlock as p, ref as m, renderSlot as h, resolveComponent as g, toDisplayString as _, toRef as v, unref as y, useAttrs as b, watch as x, withCtx as S, withModifiers as C } from "vue";
4
+ //#endregion
5
+ //#region src/components/wt-badge-new/wt-badge.vue
6
+ var w = /* @__PURE__ */ l({
7
+ __name: "wt-badge",
8
+ props: {
9
+ value: { default: "" },
10
+ severity: { default: null },
11
+ size: { default: t.MD }
12
+ },
13
+ setup(e) {
14
+ let t = e;
15
+ return (e, n) => {
16
+ let r = g("p-badge");
17
+ return p(), a(r, {
18
+ value: t.value,
19
+ class: f([[t.size && `p-badge--${t.size}`, t.severity && `p-badge--${t.severity}`], "wt-badge typo-caption"])
20
+ }, {
21
+ default: S(() => [h(e.$slots, "default")], void 0, !0),
22
+ _: 3
23
+ }, 8, ["value", "class"]);
24
+ };
25
+ }
26
+ }), T = { class: "wt-button__contents" }, E = /* @__PURE__ */ l({
27
+ __name: "wt-button",
28
+ props: {
29
+ color: { default: n.PRIMARY },
30
+ disabled: {
31
+ type: Boolean,
32
+ default: !1
33
+ },
34
+ loading: {
35
+ type: Boolean,
36
+ default: !1
37
+ },
38
+ size: { default: t.MD },
39
+ wide: {
40
+ type: Boolean,
41
+ default: !1
42
+ },
43
+ widthByContent: {
44
+ type: Boolean,
45
+ default: !1
46
+ },
47
+ icon: { default: "" },
48
+ iconPrefix: { default: "" },
49
+ badge: {},
50
+ badgeSeverity: {},
51
+ badgeAbsolutePosition: { type: Boolean },
52
+ variant: { default: r.ACTIVE }
53
+ },
54
+ emits: ["click"],
55
+ setup(n, { emit: r }) {
56
+ let l = {
57
+ [t.XS]: "extra-small",
58
+ [t.SM]: "small",
59
+ [t.MD]: "medium"
60
+ }, E = {
61
+ [t.XS]: "sm",
62
+ [t.SM]: "sm",
63
+ [t.MD]: "md"
64
+ }, D = n, O = r, k = b(), A = m(!1), j = i(() => ({ "wt-badge--absolute": D.badgeAbsolutePosition })), M = v(u("darkMode")), N = i(() => M.value ? "on-dark" : "on-light");
65
+ return x(() => D.loading, (e) => {
66
+ e ? A.value = !0 : setTimeout(() => {
67
+ A.value = e;
68
+ }, 1e3);
69
+ }, { immediate: !0 }), (r, i) => {
70
+ let u = g("wt-loader"), m = g("p-button");
71
+ return p(), a(m, d(y(k), {
72
+ class: [{
73
+ "p-button--width-by-content": n.widthByContent || n.icon,
74
+ "p-button--wide": n.wide,
75
+ "p-button--with-badge": D.badge,
76
+ "p-button--loading": A.value,
77
+ "p-button--icon": n.icon,
78
+ [`p-button--size-${n.size}`]: !0,
79
+ [`p-button--icon-${n.variant} p-button--icon-${n.size}`]: n.icon
80
+ }, "wt-button typo-button typo-button"],
81
+ disabled: n.disabled,
82
+ loading: A.value,
83
+ severity: n.color,
84
+ size: l[n.size],
85
+ variant: n.variant
86
+ }, { onClick: i[0] ||= C((e) => O("click", e), ["prevent"]) }), {
87
+ default: S(() => [A.value ? (p(), a(u, {
88
+ key: 0,
89
+ color: N.value,
90
+ size: "sm"
91
+ }, null, 8, ["color"])) : o("", !0), s("div", T, [
92
+ n.icon ? o("", !0) : h(r.$slots, "default", { key: 0 }, () => [i[1] ||= c(" no content provided", -1)]),
93
+ D.badge ? (p(), a(w, {
94
+ key: 1,
95
+ value: D.badge,
96
+ severity: D.badgeSeverity,
97
+ class: f(j.value),
98
+ size: y(t).MD
99
+ }, {
100
+ default: S(() => [h(r.$slots, "badge", {}, () => [c(_(D.badge), 1)])]),
101
+ _: 3
102
+ }, 8, [
103
+ "value",
104
+ "severity",
105
+ "class",
106
+ "size"
107
+ ])) : o("", !0),
108
+ n.icon ? (p(), a(e, {
109
+ key: 2,
110
+ class: f({ "wt-button__icon--hidden": A.value }),
111
+ icon: n.icon,
112
+ "icon-prefix": n.iconPrefix,
113
+ size: E[n.size]
114
+ }, null, 8, [
115
+ "class",
116
+ "icon",
117
+ "icon-prefix",
118
+ "size"
119
+ ])) : o("", !0)
120
+ ])], void 0, !0),
121
+ _: 3
122
+ }, 16, [
123
+ "class",
124
+ "disabled",
125
+ "loading",
126
+ "severity",
127
+ "size",
128
+ "variant"
129
+ ]);
130
+ };
131
+ }
132
+ });
133
+ //#endregion
134
+ export { w as n, E as t };
@@ -1,9 +1,9 @@
1
1
  import { t as e } from "./chunk-CY3AvKd6.js";
2
2
  import { n as t, t as n } from "./dist-BYiYpK00.js";
3
- import "./components-C0M-1soD.js";
3
+ import "./components-gi3TmScp.js";
4
4
  import { t as r } from "./_plugin-vue_export-helper-B3ysoDQm.js";
5
5
  import { c as i } from "./enums-pbYAJNeb.js";
6
- import { t as a } from "./wt-button-DENbrKdy.js";
6
+ import { t as a } from "./wt-button-BJmzJIU6.js";
7
7
  import "./sortQueryAdapters-CyYXvnDN.js";
8
8
  import { t as o } from "./isObject-Dgs_L5xI.js";
9
9
  import { a as s, i as c, n as l, o as u, r as d, s as f } from "./debounce-DrmECuJ2.js";
@@ -1,4 +1,4 @@
1
- import { c as e, i as t } from "./components-C0M-1soD.js";
1
+ import { c as e, i as t } from "./components-gi3TmScp.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,7 +1,7 @@
1
1
  import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
2
2
  import { c as t } from "./enums-pbYAJNeb.js";
3
3
  import { t as n } from "./useExpansion-DVdIpoOn.js";
4
- import "./composables-C5OKo5yW.js";
4
+ import "./composables-BJtyGE9D.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-B8Px6VcD.js";
3
- import { a as n, o as r } from "./composables-C5OKo5yW.js";
3
+ import { a as n, o as r } from "./composables-BJtyGE9D.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.js
6
6
  var j = () => {
@@ -1,7 +1,7 @@
1
1
  import { t as e } from "./wt-icon-pxO7IjwV.js";
2
2
  import { t } from "./_plugin-vue_export-helper-B3ysoDQm.js";
3
3
  import { c as n } from "./enums-pbYAJNeb.js";
4
- import { t as r } from "./wt-button-DENbrKdy.js";
4
+ import { t as r } from "./wt-button-BJmzJIU6.js";
5
5
  import { n as i, t as a } from "./useVidstackSrc-DfNrFbOO.js";
6
6
  import { t as o } from "./wt-popover-CJZH3wMl.js";
7
7
  import { t as s } from "./wt-slider-BS3SoGht.js";
@@ -1,4 +1,4 @@
1
- import { n as e } from "./components-C0M-1soD.js";
1
+ import { n as e } from "./components-gi3TmScp.js";
2
2
  import { t } from "./vue-i18n-B8Px6VcD.js";
3
3
  import { n, r } from "./clients-aQCH0OHp.js";
4
4
  import { createBlock as i, createTextVNode as a, createVNode as o, defineComponent as s, inject 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,7 +1,7 @@
1
1
  import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
2
2
  import { t } from "./vue-i18n-B8Px6VcD.js";
3
3
  import { n, t as r } from "./sortQueryAdapters-CyYXvnDN.js";
4
- import { t as i } from "./composables-C5OKo5yW.js";
4
+ import { t as i } from "./composables-BJtyGE9D.js";
5
5
  import { Fragment as ee, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createSlots as u, createTextVNode as d, createVNode as f, defineComponent as p, nextTick as m, normalizeStyle as h, onMounted as g, onUnmounted as _, openBlock as v, ref as y, renderList as b, renderSlot as x, resolveComponent as S, resolveDirective as C, toDisplayString as w, useSlots as T, useTemplateRef as E, withCtx as D, withDirectives as O, withModifiers as k } from "vue";
6
6
  //#region src/components/wt-table/wt-table.vue?vue&type=script&setup=true&lang.ts
7
7
  var A = { class: "wt-table__th__content typo-body-1-bold" }, j = { class: "wt-table__td__actions" }, M = 10, N = /*#__PURE__*/ e(/* @__PURE__ */ p({
@@ -1,4 +1,4 @@
1
- import { a as e, o as t, r as n, s as r } from "./components-C0M-1soD.js";
1
+ import { a as e, o as t, r as n, s as r } from "./components-gi3TmScp.js";
2
2
  import { t as i } from "./enums-pbYAJNeb.js";
3
3
  import { t as a } from "./vue-i18n-B8Px6VcD.js";
4
4
  import { t as o } from "./clients-aQCH0OHp.js";
@@ -1,7 +1,7 @@
1
- import { l as e } from "./components-C0M-1soD.js";
1
+ import { l as e } from "./components-gi3TmScp.js";
2
2
  import { t } from "./_plugin-vue_export-helper-B3ysoDQm.js";
3
3
  import { c as n } from "./enums-pbYAJNeb.js";
4
- import "./wt-button-DENbrKdy.js";
4
+ import "./wt-button-BJmzJIU6.js";
5
5
  import { t as r } from "./wt-icon-btn-CjjI4cgE.js";
6
6
  import { $ as i, A as a, B as o, C as s, F as c, G as l, H as u, I as d, J as f, K as p, L as m, M as h, N as g, O as ee, P as te, Q as _, R as ne, T as re, U as v, W as ie, X as ae, Y as oe, Z as y, _ as b, a as se, at as ce, b as le, c as ue, d as de, et as x, f as fe, g as pe, h as me, i as S, it as he, k as ge, l as C, m as _e, n as w, nt as ve, o as T, p as E, q as D, r as O, rt as k, st as ye, t as be, tt as xe, u as Se, v as A, w as j, x as Ce, y as we, z as Te } from "./vidstack-BGSTndAW-CyKM_CM4.js";
7
7
  import { _ as Ee, a as De, c as Oe, f as ke, g as Ae, h as je, i as Me, l as Ne, n as Pe, r as Fe, s as Ie, t as Le, u as Re, v as ze, x as Be, y as Ve } from "./useVidstackSrc-DfNrFbOO.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-sdk",
3
- "version": "26.6.44",
3
+ "version": "26.6.46",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "npm run docs:dev",
@@ -1,7 +1,12 @@
1
1
  import { reactive, ref, watch } from 'vue';
2
2
  import { useI18n } from 'vue-i18n';
3
3
  import debounce from '../../../../scripts/debounce';
4
- import { dedupeByKey, isOptionSelected, toArray } from './useSelectUtils';
4
+ import {
5
+ dedupeByKey,
6
+ filterOptionsBySearchValue,
7
+ isOptionSelected,
8
+ toArray,
9
+ } from './useSelectUtils';
5
10
 
6
11
  export const useSelectOptions = ({
7
12
  selected,
@@ -62,7 +67,10 @@ export const useSelectOptions = ({
62
67
  // when optionValue is used PrimeVue passes the extracted primitive instead of the full object
63
68
  if (optionValue?.value && typeof option !== 'object') {
64
69
  const foundOption = (
65
- filteredOptions.value as Record<string, unknown>[]
70
+ [
71
+ ...filteredOptions.value,
72
+ ...selectedOptionsCache.value,
73
+ ] as Record<string, unknown>[]
66
74
  ).find((o) => o[optionValue.value] === option);
67
75
  return foundOption ? getOptionLabel(foundOption) : String(option);
68
76
  }
@@ -76,6 +84,9 @@ export const useSelectOptions = ({
76
84
  return option[defaultOptionLabel] || option;
77
85
  };
78
86
 
87
+ const filterBySearch = (opts, value) =>
88
+ filterOptionsBySearchValue(opts, value, getOptionLabel);
89
+
79
90
  // Cache of full option objects for currently selected values,
80
91
  // so they can be preserved in filteredOptions after filtering
81
92
  const selectedOptionsCache = ref([]);
@@ -111,9 +122,7 @@ export const useSelectOptions = ({
111
122
  page,
112
123
  });
113
124
  const matchingCached = search
114
- ? selectedOptionsCache.value.filter((option) =>
115
- getOptionLabel(option).toLowerCase().includes(search.toLowerCase()),
116
- )
125
+ ? filterBySearch(selectedOptionsCache.value, search)
117
126
  : selectedOptionsCache.value;
118
127
  const baseOptions =
119
128
  searchParams.page === 1
@@ -142,9 +151,7 @@ export const useSelectOptions = ({
142
151
  const filterOptions = (value) => {
143
152
  filterText.value = value;
144
153
  if (!searchMethod.value) {
145
- const matchingOptions = options.value.filter((option) =>
146
- getOptionLabel(option).toLowerCase().includes(value.toLowerCase()),
147
- );
154
+ const matchingOptions = filterBySearch(options.value, value);
148
155
  filteredOptions.value = sortOptions(
149
156
  dedupeByKey(
150
157
  [
@@ -169,7 +176,7 @@ export const useSelectOptions = ({
169
176
  filteredOptions.value = sortOptions(
170
177
  dedupeByKey(
171
178
  [
172
- ...missingSelected,
179
+ ...filterBySearch(missingSelected, filterText.value),
173
180
  ...filteredOptions.value,
174
181
  ],
175
182
  dataKey.value,
@@ -40,3 +40,9 @@ export const dedupeByKey = (items: unknown[], key: string): unknown[] => {
40
40
  ...seen.values(),
41
41
  ];
42
42
  };
43
+
44
+ export const filterOptionsBySearchValue = (options, value, getOptionLabel) => {
45
+ return options.filter((option) =>
46
+ getOptionLabel(option).toLowerCase().includes(value.toLowerCase()),
47
+ );
48
+ };
@@ -53,8 +53,7 @@
53
53
 
54
54
  <script lang="ts" setup>
55
55
  import type { ButtonProps } from 'primevue';
56
- import { computed, inject, ref, useAttrs, watch } from 'vue';
57
- import { useStore } from 'vuex';
56
+ import { computed, inject, ref, toRef, useAttrs, watch } from 'vue';
58
57
 
59
58
  import { ButtonColor, ButtonVariant, ComponentSize } from '../../enums';
60
59
  import WtBadge from '../wt-badge-new/wt-badge.vue';
@@ -111,28 +110,7 @@ const badgeClass = computed(() => ({
111
110
  'wt-badge--absolute': props.badgeAbsolutePosition,
112
111
  }));
113
112
 
114
- // @Ler24
115
- // Compatibility mode for Vuex (old mode) and when there is no Vuex in project (new mode)
116
- let store = null;
117
- try {
118
- store = useStore();
119
- } catch {
120
- store = null;
121
- }
122
-
123
- const injectDarkMode = inject('darkMode');
124
-
125
- const darkMode = computed(() => {
126
- if (injectDarkMode?.value) {
127
- return injectDarkMode.value;
128
- }
129
-
130
- if (store?.getters) {
131
- return store.getters['appearance/DARK_MODE'] ?? false;
132
- }
133
-
134
- return false;
135
- });
113
+ const darkMode = toRef(inject<boolean>('darkMode'));
136
114
 
137
115
  /**
138
116
  * @author: @Opelsandr Palonnyi
@@ -1,7 +1,6 @@
1
1
  import deepmerge from 'deepmerge';
2
- import { computed, inject } from 'vue';
2
+ import { computed, inject, toRef } from 'vue';
3
3
  import { useI18n } from 'vue-i18n';
4
- import { useStore } from 'vuex';
5
4
 
6
5
  import { EmptyCause } from '../../../enums/index';
7
6
  import { isEmpty } from '../../../scripts/index.js';
@@ -14,7 +13,6 @@ export const useTableEmpty = (
14
13
  { dataList, filters, error, isLoading },
15
14
  overrides = {},
16
15
  ) => {
17
- const store = useStore();
18
16
  const { t } = useI18n();
19
17
 
20
18
  // use computed, so that at locale change, texts will be updated too
@@ -62,17 +60,7 @@ export const useTableEmpty = (
62
60
 
63
61
  const merged = computed(() => deepmerge(defaults.value, overrides));
64
62
 
65
- let darkMode = computed(() => false);
66
-
67
- try {
68
- darkMode = inject('darkMode');
69
- } catch {
70
- try {
71
- darkMode = computed(() => store.getters['appearance/DARK_MODE']);
72
- } catch {
73
- console.warn('"darkMode" value not found, using "false" as default');
74
- }
75
- }
63
+ const darkMode = toRef(inject('darkMode'));
76
64
 
77
65
  const emptyState = computed(() => {
78
66
  return !isLoading?.value && !error?.value && !dataList?.value?.length;
@@ -1,3 +1,4 @@
1
1
  export declare const toArray: (value: any) => any[];
2
2
  export declare const isOptionSelected: (option: any, selectedArray: any, dataKey: any) => any;
3
3
  export declare const dedupeByKey: (items: unknown[], key: string) => unknown[];
4
+ export declare const filterOptionsBySearchValue: (options: any, value: any, getOptionLabel: any) => any;