@webitel/ui-datalist 1.1.12 → 1.1.14

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-datalist",
3
- "version": "1.1.12",
3
+ "version": "1.1.14",
4
4
  "description": "Toolkit for building data lists in webitel ui system",
5
5
  "scripts": {
6
6
  "make-all": "npm version patch --git-tag-version false && ( npm run lint:fix || true) && (npm run build:types || true) && npm run utils:publish",
@@ -74,7 +74,7 @@ const restoreLocalSearchValue = (searchMode: string) => {
74
74
  };
75
75
 
76
76
  const hasSearchModes = computed(() => {
77
- return props.searchModeOptions && props.searchModeOptions.length > 0;
77
+ return props.searchModeOptions && props.searchModeOptions.length > 1;
78
78
  });
79
79
 
80
80
  const currentSearchName = computed(() => {
@@ -94,7 +94,9 @@ const inputValue = (value: string) => {
94
94
  name: currentSearchName.value,
95
95
  });
96
96
  }
97
- return;
97
+ if (hasSearchModes.value) {
98
+ searchMode.value = props.searchModeOptions[0].value;
99
+ }
98
100
  }
99
101
  };
100
102
 
@@ -127,12 +129,12 @@ const updateSearchMode = (
127
129
  };
128
130
 
129
131
  const initialize = () => {
130
- if (hasSearchModes.value) {
131
- if (!searchMode.value) {
132
- searchMode.value = props.searchModeOptions[0].value;
133
- }
134
- restoreLocalSearchValue(searchMode.value);
132
+ if (!hasSearchModes.value) return;
133
+
134
+ if (!searchMode.value) {
135
+ searchMode.value = props.searchModeOptions[0].value;
135
136
  }
137
+ restoreLocalSearchValue(searchMode.value);
136
138
  };
137
139
  /**
138
140
  * @description
@@ -154,19 +156,24 @@ watch(
154
156
  const searchModes = [
155
157
  defaultSearchName,
156
158
  ];
157
- if (hasSearchModes.value) {
159
+ if (hasSearchModes.value && !searchMode.value) {
158
160
  searchMode.value =
159
161
  props.searchModeOptions?.map((option) => option.value)[0] || '';
160
162
  }
161
163
 
162
164
  for (const mode of searchModes) {
163
165
  if (hasFilter(mode)) {
164
- searchMode.value = mode;
166
+ if (hasSearchModes.value) {
167
+ searchMode.value = mode;
168
+ }
165
169
  restoreLocalSearchValue(mode);
166
170
  break;
167
171
  }
168
172
  }
169
173
  },
174
+ {
175
+ immediate: true,
176
+ },
170
177
  );
171
178
  </script>
172
179