@webitel/ui-sdk 24.6.34 → 24.6.36

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-sdk",
3
- "version": "24.6.34",
3
+ "version": "24.6.36",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vite",
@@ -1,9 +1,11 @@
1
1
  <template>
2
2
  <wt-search-bar
3
- class="filter-search"
4
3
  :search-mode="multisearch && filterName"
5
4
  :search-mode-options="multisearch && searchModeOpts"
5
+ :hint="multisearch && currentSearchMode.hint"
6
6
  :value="localValue"
7
+ :v="multisearch && currentSearchMode.v"
8
+ class="filter-search"
7
9
  @input="localValue = $event"
8
10
  @search="setValue({ name: filterName, value: localValue })"
9
11
  @update:search-mode="changeMode"
@@ -36,7 +38,6 @@ const props = defineProps({
36
38
 
37
39
  const store = useStore();
38
40
 
39
-
40
41
  function getValue(filter) {
41
42
  return store.getters[`${props.namespace}/GET_FILTER`](filter);
42
43
  }
@@ -47,18 +48,22 @@ function setValue(payload) {
47
48
 
48
49
  const filterName = ref(props.multisearch ? props.searchModeOpts[0].value : props.name);
49
50
 
51
+ const currentSearchMode = computed(
52
+ () => props.searchModeOpts.find(({ value }) => value === filterName.value)
53
+ );
54
+
50
55
  const filterValue = computed(() => getValue(filterName.value));
51
56
 
52
57
  const localValue = ref(filterValue.value);
53
58
 
54
- async function changeMode({ value }) {
55
- await setValue({ name: filterName.value, value: '' });
59
+ async function changeMode({ value }, { clearValue = true } = {}) {
60
+ if (clearValue) await setValue({ name: filterName.value, value: '' });
56
61
  filterName.value = value;
57
62
  }
58
63
 
59
64
  function restoreSearchMode() {
60
65
  const mode = props.searchModeOpts.find(({ value }) => !!getValue(value));
61
- if (mode) changeMode({ value: mode.value });
66
+ if (mode) changeMode({ value: mode.value }, { clearValue: false });
62
67
  }
63
68
 
64
69
  function subscribe(payload) {
@@ -75,6 +80,6 @@ watch(() => filterValue.value, () => {
75
80
  });
76
81
  </script>
77
82
 
78
- <style scoped lang="scss">
83
+ <style lang="scss" scoped>
79
84
 
80
85
  </style>