@v1nt1248/3nclient-lib 0.1.82 → 0.1.84

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
@@ -2,7 +2,7 @@
2
2
  "name": "@v1nt1248/3nclient-lib",
3
3
  "license": "AGPL-3.0-or-later",
4
4
  "author": "v1nt1248",
5
- "version": "0.1.82",
5
+ "version": "0.1.84",
6
6
  "description": "Library for 3NWeb clients",
7
7
  "type": "module",
8
8
  "files": [
@@ -77,7 +77,7 @@
77
77
 
78
78
  return props.returnObject
79
79
  ? !(ids.value as string[]).includes(item.id as string)
80
- : !(ids.value as Array<T[keyof T]>).includes(item as T[keyof T]);
80
+ : !(ids.value as Array<T[keyof T]>).includes(item[props.itemValue]);
81
81
  });
82
82
  }
83
83
 
@@ -88,7 +88,7 @@
88
88
 
89
89
  return props.returnObject
90
90
  ? !(ids.value as string[]).includes(item.id as string)
91
- : !(ids.value as Array<T[keyof T]>).includes(item as T[keyof T]);
91
+ : !(ids.value as Array<T[keyof T]>).includes(item[props.itemValue]);
92
92
  });
93
93
  });
94
94
 
@@ -187,7 +187,7 @@
187
187
  isNewValueValid.value = !props.newValueValidator ? true : props.newValueValidator(query.value);
188
188
  emits('valid:new-value', isNewValueValid.value);
189
189
  if (isNewValueValid.value) {
190
- const item = {
190
+ const item = {
191
191
  id: getRandomId(6),
192
192
  [props.itemTitle]: query.value,
193
193
  [props.itemValue]: query.value,
@@ -248,6 +248,7 @@
248
248
  v-model="isMenuOpen"
249
249
  :offset-x="2"
250
250
  :offset-y="4"
251
+ position-autoupdate
251
252
  :content-border-radius="[0, 0, 8, 8]"
252
253
  :disabled="disabled"
253
254
  >
@@ -290,7 +291,11 @@
290
291
  </div>
291
292
 
292
293
  <template #menu>
293
- <div ref="menuBodyEl" :class="$style.body">
294
+ <div
295
+ v-if="!isEmpty(filteredItems) || (isEmpty(filteredItems) && noDataText)"
296
+ ref="menuBodyEl"
297
+ :class="$style.body"
298
+ >
294
299
  <template v-if="size(filteredItems)">
295
300
  <template v-for="(item, index) in filteredItems" :key="item.id">
296
301
  <div
@@ -303,7 +308,10 @@
303
308
  @click.stop.prevent="onItemClick(item)"
304
309
  >
305
310
  <slot name="item" :item="item" :index="index" :query="query">
306
- <span v-ui3n-html="markSearch(item[props.itemTitle] as string, query)" />
311
+ <div
312
+ v-ui3n-html="markSearch(item[props.itemTitle] as string, query)"
313
+ :class="$style.simpleItem"
314
+ />
307
315
  </slot>
308
316
  </div>
309
317
  </template>
@@ -411,6 +419,11 @@
411
419
  }
412
420
  }
413
421
 
422
+ .simpleItem {
423
+ position: relative;
424
+ width: max-content;
425
+ }
426
+
414
427
  .noData {
415
428
  display: flex;
416
429
  min-height: var(--spacing-l);
@@ -24,14 +24,24 @@ const slots = useSlots();
24
24
  const $css = useCssModule();
25
25
 
26
26
  const height = computed(() => `${props.height}px`);
27
- const iconHeight = computed(() => props.height ? Number(props.height) - 2 : Number(props.height));
28
- const padding = computed(() => `${Math.round(Number(props.height) / 3)}px`);
27
+ const iconHeight = computed(() => Number(props.height) - 4);
28
+
29
29
  const maxWidth = computed(() => `${props.maxWidth}px`);
30
30
  const bgColor = computed(() => props.color);
31
31
  const textSize = computed(() => `${props.textSize}px`);
32
32
  const textColor = computed(() => props.textColor);
33
33
  const hasLeftSlot = computed(() => !!slots.left);
34
34
 
35
+ const padding = computed(() => {
36
+ const padValue = Math.round(Number(props.height) / 3);
37
+
38
+ if (hasLeftSlot.value) {
39
+ return `0 ${padValue}px 0 4px`;
40
+ }
41
+
42
+ return `0 ${padValue}px`;
43
+ });
44
+
35
45
  const mainCssClasses = computed(() => {
36
46
  const val = [$css.ui3nChip];
37
47
 
@@ -76,7 +86,7 @@ function onClick() {
76
86
  position: relative;
77
87
  display: flex;
78
88
  height: v-bind('height');
79
- padding: 0 v-bind('padding');
89
+ padding: v-bind('padding');
80
90
  width: max-content;
81
91
  max-width: v-bind('maxWidth');
82
92
  background-color: v-bind('bgColor');
@@ -3,6 +3,7 @@ import { VNode } from 'vue';
3
3
  export interface Ui3nMenuProps {
4
4
  modelValue?: boolean;
5
5
  positionStrategy?: 'absolute' | 'fixed';
6
+ positionAutoupdate?: boolean;
6
7
  offsetX?: number;
7
8
  offsetY?: number;
8
9
  contentBorderRadius?: number | number[];
@@ -50,7 +50,7 @@
50
50
  }),
51
51
  shift(),
52
52
  ],
53
- whileElementsMounted: props.positionStrategy === 'fixed' ? autoUpdate : undefined,
53
+ whileElementsMounted: props.positionAutoupdate || props.positionStrategy === 'fixed' ? autoUpdate : undefined,
54
54
  },
55
55
  );
56
56