@v1nt1248/3nclient-lib 0.1.81 → 0.1.83
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/dist/components/ui3n-menu/types.d.ts +3 -0
- package/dist/components/ui3n-menu/ui3n-menu.vue.d.ts +2 -0
- package/dist/style.css +1 -1
- package/dist/ui3n-components.js +3839 -3820
- package/package.json +1 -1
- package/src/components/ui3n-autocomplete/ui3n-autocomplete.vue +34 -14
- package/src/components/ui3n-menu/types.ts +3 -0
- package/src/components/ui3n-menu/ui3n-menu.vue +19 -5
package/package.json
CHANGED
|
@@ -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
|
|
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
|
|
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,
|
|
@@ -244,12 +244,20 @@
|
|
|
244
244
|
|
|
245
245
|
<template>
|
|
246
246
|
<div :class="$style.ui3nAutocomplete">
|
|
247
|
-
<ui3n-menu
|
|
247
|
+
<ui3n-menu
|
|
248
|
+
v-model="isMenuOpen"
|
|
249
|
+
:offset-x="2"
|
|
250
|
+
:offset-y="4"
|
|
251
|
+
position-autoupdate
|
|
252
|
+
:content-border-radius="[0, 0, 8, 8]"
|
|
253
|
+
:disabled="disabled"
|
|
254
|
+
>
|
|
248
255
|
<div ref="activatorEl" :class="$style.trigger">
|
|
249
256
|
<template v-if="chips">
|
|
250
257
|
<template v-for="(item, index) in modelValue" :key="item.id">
|
|
251
258
|
<slot name="chip" :item="item" :index="index">
|
|
252
259
|
<ui3n-chip
|
|
260
|
+
height="32"
|
|
253
261
|
round
|
|
254
262
|
closeable
|
|
255
263
|
@close="onChipClose(item)"
|
|
@@ -283,7 +291,11 @@
|
|
|
283
291
|
</div>
|
|
284
292
|
|
|
285
293
|
<template #menu>
|
|
286
|
-
<div
|
|
294
|
+
<div
|
|
295
|
+
v-if="!isEmpty(filteredItems) || (isEmpty(filteredItems) && noDataText)"
|
|
296
|
+
ref="menuBodyEl"
|
|
297
|
+
:class="$style.body"
|
|
298
|
+
>
|
|
287
299
|
<template v-if="size(filteredItems)">
|
|
288
300
|
<template v-for="(item, index) in filteredItems" :key="item.id">
|
|
289
301
|
<div
|
|
@@ -296,7 +308,10 @@
|
|
|
296
308
|
@click.stop.prevent="onItemClick(item)"
|
|
297
309
|
>
|
|
298
310
|
<slot name="item" :item="item" :index="index" :query="query">
|
|
299
|
-
<
|
|
311
|
+
<div
|
|
312
|
+
v-ui3n-html="markSearch(item[props.itemTitle] as string, query)"
|
|
313
|
+
:class="$style.simpleItem"
|
|
314
|
+
/>
|
|
300
315
|
</slot>
|
|
301
316
|
</div>
|
|
302
317
|
</template>
|
|
@@ -315,7 +330,7 @@
|
|
|
315
330
|
|
|
316
331
|
<style lang="scss" module>
|
|
317
332
|
.ui3nAutocomplete {
|
|
318
|
-
--autocomplete-min-height: var(--spacing-
|
|
333
|
+
--autocomplete-min-height: var(--spacing-l);
|
|
319
334
|
|
|
320
335
|
position: relative;
|
|
321
336
|
width: 100%;
|
|
@@ -349,7 +364,7 @@
|
|
|
349
364
|
flex-grow: 1;
|
|
350
365
|
height: var(--autocomplete-min-height);
|
|
351
366
|
font-size: var(--font-12);
|
|
352
|
-
line-height: var(--
|
|
367
|
+
line-height: var(--autocomplete-min-height);
|
|
353
368
|
font-weight: 400;
|
|
354
369
|
color: var(--color-text-control-primary-default);
|
|
355
370
|
background-color: transparent;
|
|
@@ -362,19 +377,19 @@
|
|
|
362
377
|
|
|
363
378
|
&:hover,
|
|
364
379
|
&:focus {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
&:not(.inputWithError) {
|
|
368
|
-
border: 1px solid var(--color-border-control-accent-focused);
|
|
369
|
-
}
|
|
380
|
+
background-color: var(--color-bg-control-secondary-default);
|
|
381
|
+
}
|
|
370
382
|
|
|
383
|
+
&.inputWithError {
|
|
384
|
+
height: calc(var(--autocomplete-min-height) - 2px);
|
|
385
|
+
padding: 0 calc(var(--spacing-s) - 1px);
|
|
371
386
|
border: 1px solid var(--error-content-default);
|
|
372
387
|
}
|
|
373
388
|
}
|
|
374
389
|
|
|
375
390
|
.body {
|
|
376
391
|
position: relative;
|
|
377
|
-
background-color: var(--color-bg-
|
|
392
|
+
background-color: var(--color-bg-block-primary-default);
|
|
378
393
|
padding: var(--spacing-xs);
|
|
379
394
|
}
|
|
380
395
|
|
|
@@ -404,6 +419,11 @@
|
|
|
404
419
|
}
|
|
405
420
|
}
|
|
406
421
|
|
|
422
|
+
.simpleItem {
|
|
423
|
+
position: relative;
|
|
424
|
+
width: max-content;
|
|
425
|
+
}
|
|
426
|
+
|
|
407
427
|
.noData {
|
|
408
428
|
display: flex;
|
|
409
429
|
min-height: var(--spacing-l);
|
|
@@ -3,8 +3,11 @@ 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;
|
|
9
|
+
contentBorderRadius?: number | number[];
|
|
10
|
+
zIndex?: number;
|
|
8
11
|
closeOnClick?: boolean;
|
|
9
12
|
closeOnClickOutside?: boolean;
|
|
10
13
|
disabled?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { ref, watch } from 'vue';
|
|
2
|
+
import { computed, ref, watch } from 'vue';
|
|
3
3
|
import { autoUpdate, flip, useFloating, offset, shift } from '@floating-ui/vue';
|
|
4
4
|
import { default as vClickOutside } from '../../directives/ui3n-click-outside';
|
|
5
5
|
import type { Ui3nMenuEmits, Ui3nMenuProps, Ui3nMenuSlots } from './types';
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
positionStrategy: 'absolute',
|
|
9
9
|
offsetX: 0,
|
|
10
10
|
offsetY: 0,
|
|
11
|
+
contentBorderRadius: 4,
|
|
12
|
+
zIndex: 1000,
|
|
11
13
|
closeOnClick: true,
|
|
12
14
|
closeOnClickOutside: true,
|
|
13
15
|
disabled: false,
|
|
@@ -20,6 +22,16 @@
|
|
|
20
22
|
const menuContentElement = ref<HTMLDivElement | null>(null);
|
|
21
23
|
const isShow = ref(false);
|
|
22
24
|
|
|
25
|
+
const contentBorderRadiusCss = computed(() => {
|
|
26
|
+
if (typeof props.contentBorderRadius === 'number') {
|
|
27
|
+
return `${props.contentBorderRadius}px`;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const [tl, tr, br, bl] = props.contentBorderRadius;
|
|
31
|
+
return `${tl}px ${tr}px ${br}px ${bl}px`;
|
|
32
|
+
});
|
|
33
|
+
const zIndexCss = computed(() => props.zIndex);
|
|
34
|
+
|
|
23
35
|
const { floatingStyles, isPositioned } = useFloating(
|
|
24
36
|
menuTriggerElement,
|
|
25
37
|
menuContentElement,
|
|
@@ -38,7 +50,7 @@
|
|
|
38
50
|
}),
|
|
39
51
|
shift(),
|
|
40
52
|
],
|
|
41
|
-
whileElementsMounted: props.positionStrategy === 'fixed' ? autoUpdate : undefined,
|
|
53
|
+
whileElementsMounted: props.positionAutoupdate || props.positionStrategy === 'fixed' ? autoUpdate : undefined,
|
|
42
54
|
},
|
|
43
55
|
);
|
|
44
56
|
|
|
@@ -112,6 +124,7 @@
|
|
|
112
124
|
|
|
113
125
|
.ui3nMenu {
|
|
114
126
|
--ui3n-menu-content-bg: var(--color-bg-control-secondary-default);
|
|
127
|
+
--ui3n-menu-content-border-raduis: v-bind(contentBorderRadiusCss);
|
|
115
128
|
|
|
116
129
|
position: relative;
|
|
117
130
|
max-width: max-content;
|
|
@@ -130,9 +143,10 @@
|
|
|
130
143
|
|
|
131
144
|
.ui3nMenuContent {
|
|
132
145
|
position: absolute;
|
|
133
|
-
border-radius:
|
|
146
|
+
border-radius: var(--ui3n-menu-content-border-raduis);
|
|
134
147
|
background-color: var(--ui3n-menu-content-bg);
|
|
135
|
-
z-index:
|
|
136
|
-
|
|
148
|
+
z-index: v-bind(zIndexCss);
|
|
149
|
+
overflow: hidden;
|
|
150
|
+
@include mixins.dropShadow();
|
|
137
151
|
}
|
|
138
152
|
</style>
|