@milaboratories/uikit 2.2.71 → 2.2.73

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": "@milaboratories/uikit",
3
- "version": "2.2.71",
3
+ "version": "2.2.73",
4
4
  "type": "module",
5
5
  "main": "dist/pl-uikit.umd.js",
6
6
  "module": "dist/pl-uikit.js",
@@ -36,7 +36,7 @@
36
36
  "@types/d3": "^7.4.3",
37
37
  "@milaboratories/eslint-config": "^1.0.4",
38
38
  "@milaboratories/helpers": "^1.6.11",
39
- "@platforma-sdk/model": "^1.29.22"
39
+ "@platforma-sdk/model": "^1.30.11"
40
40
  },
41
41
  "scripts": {
42
42
  "dev": "vite",
@@ -131,16 +131,6 @@ const loadedOptionsRef = ref<ListOption<M>[]>([]);
131
131
  const modelOptionRef = ref<ListOptionNormalized<M> | undefined>(); // list of 1 option that is selected or empty, to keep selected label
132
132
 
133
133
  const renderedOptionsRef = computed(() => {
134
- if (model.value && !search.value) {
135
- return modelOptionRef.value
136
- ? [{
137
- ...modelOptionRef.value,
138
- index: 0,
139
- isSelected: true,
140
- isActive: true,
141
- }]
142
- : [];
143
- }
144
134
  return normalizeListOptions(loadedOptionsRef.value).map((opt, index) => ({
145
135
  ...opt,
146
136
  index,
@@ -215,14 +205,12 @@ const setFocusOnInput = () => input.value?.focus();
215
205
 
216
206
  const toggleOpen = () => {
217
207
  data.open = !data.open;
218
- if (!data.open) {
219
- search.value = null;
220
- }
221
- if (data.open) {
222
- search.value = '';
223
- }
224
208
  };
225
209
 
210
+ watch(() => data.open, (v) => {
211
+ search.value = v ? '' : null;
212
+ })
213
+
226
214
  const onInputFocus = () => {
227
215
  data.open = true;
228
216
  };
@@ -298,10 +286,10 @@ watchPostEffect(() => {
298
286
  }
299
287
  });
300
288
 
301
- const searchDebounced = refDebounced(search, 500, { maxWait: 1000 });
289
+ const searchDebounced = refDebounced(search, 300, { maxWait: 1000 });
302
290
 
303
291
  const optionsRequest = useWatchFetch(() => searchDebounced.value, async (v) => {
304
- if (v !== null && !(v === '' && model.value)) { // search is null when dropdown is closed; when search is '' and model is not empty show single selected option in the list;
292
+ if (v !== null) { // search is null when dropdown is closed;
305
293
  return props.optionsSearch(v);
306
294
  }
307
295
  return [];
@@ -63,6 +63,10 @@ const props = defineProps<{
63
63
  * The label to display above the texarea.
64
64
  */
65
65
  label?: string;
66
+ /**
67
+ * Do not scroll to bottom on content change. Default is false (scroll to bottom).
68
+ */
69
+ disableAutoScroll?: boolean;
66
70
  }>();
67
71
 
68
72
  const logState = useLogHandle(props);
@@ -101,7 +105,11 @@ const onClickCopy = () => {
101
105
  }
102
106
  };
103
107
 
104
- const scrollDown = () => {
108
+ const optionallyScrollDown = () => {
109
+ if (props.disableAutoScroll) {
110
+ return;
111
+ }
112
+
105
113
  tapIf(contentRef.value, (el) => {
106
114
  if (isAnchored.value) {
107
115
  el.scrollTo(el.scrollLeft, el.scrollHeight);
@@ -113,7 +121,7 @@ watch(
113
121
  computedValue,
114
122
  () => {
115
123
  requestAnimationFrame(() => {
116
- scrollDown();
124
+ optionallyScrollDown();
117
125
  });
118
126
  },
119
127
  { immediate: true },