@fastkit/vui 0.8.8 → 0.8.9
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/vui.cjs.js +69 -36
- package/dist/vui.cjs.prod.js +69 -36
- package/dist/vui.css +45 -3
- package/dist/vui.d.ts +27 -42
- package/dist/vui.min.css +1 -1
- package/dist/vui.min.css.map +1 -1
- package/dist/vui.mjs +70 -37
- package/package.json +6 -6
- package/src/components/VOption/VOption.scss +15 -3
- package/src/components/VOption/VOption.tsx +7 -1
- package/src/components/VOptionGroup/VOptionGroup.scss +13 -0
- package/src/components/VSelect/VSelect.scss +14 -0
- package/src/components/VSelect/VSelect.tsx +36 -8
- package/src/composables/form-selector.tsx +26 -17
package/dist/vui.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createPropsOptions, createFormControlSettings, defineSlotsProps, useFormControl, VTooltip, renderSlotOrEmpty, createFormSelectorSettings, createFormControlProps, useFormSelectorControl, resolveVNodeChildOrSlots, createFormSelectorItemSettings, useFormSelectorItemControl, createFormSelectorItemGroupProps, useFormSelectorItemGroupControl, useParentFormNode, VMenu, createTextInputSettings, useTextInputControl, createTextareaSettings, useTextareaControl, createFormSettings, useForm, getDocumentScroller, useVScrollerRef, VScroller, useInjectTheme, VStackRoot, resolveVStackDynamicInput, VueColorSchemePlugin, installVueStackPlugin } from '@fastkit/vue-kit';
|
|
2
2
|
export * from '@fastkit/vue-kit';
|
|
3
3
|
export { VDialog, VMenu, VSnackbar, VTooltip } from '@fastkit/vue-kit';
|
|
4
|
-
import { inject, computed, provide, createVNode, mergeProps, defineComponent, isVNode, ref, watch, onMounted, onBeforeUnmount, cloneVNode, withDirectives, createTextVNode,
|
|
4
|
+
import { inject, computed, provide, createVNode, mergeProps, defineComponent, Fragment, isVNode, ref, watch, onMounted, onBeforeUnmount, cloneVNode, withDirectives, createTextVNode, vShow, onBeforeUpdate, vModelSelect, Transition, reactive } from 'vue';
|
|
5
5
|
import { useRouter, RouterLink, useLink, useRoute } from 'vue-router';
|
|
6
6
|
import { createPropsOptions as createPropsOptions$1, renderSlotOrEmpty as renderSlotOrEmpty$1, defineSlotsProps as defineSlotsProps$1, htmlAttributesPropOptions, navigationableInheritProps, useNavigationable, VLink, isFragment, rawNumberPropType, resolveNumberish, resizeDirectiveArgument, VExpandTransition, LocationService, setDefaultRouterLink } from '@fastkit/vue-utils';
|
|
7
7
|
import { getDocumentScroller as getDocumentScroller$1 } from '@fastkit/vue-scroller';
|
|
@@ -404,19 +404,24 @@ function defineFormSelectorComponent(opts) {
|
|
|
404
404
|
"indeterminate": true,
|
|
405
405
|
"class": "mr-1",
|
|
406
406
|
"size": CONTROL_LOADING_SPINNER_SIZES[this.size || 'md']
|
|
407
|
-
}, null), this.loadingMessageRef]), this.
|
|
408
|
-
const
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
407
|
+
}, null), this.loadingMessageRef]), this.propGroups.map(group => {
|
|
408
|
+
const {
|
|
409
|
+
items
|
|
410
|
+
} = group;
|
|
411
|
+
return createVNode(Fragment, null, [items.map(attrs => {
|
|
412
|
+
const selected = selectorControl.isSelected(attrs.value);
|
|
413
|
+
return itemRenderer({
|
|
414
|
+
selected,
|
|
415
|
+
control: selectorControl,
|
|
416
|
+
attrs: { ...attrs,
|
|
417
|
+
modelValue: selected,
|
|
418
|
+
key: attrs.value
|
|
419
|
+
},
|
|
420
|
+
slots: {
|
|
421
|
+
default: () => attrs.label(this.selectorControl)
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
})]);
|
|
420
425
|
}), renderSlotOrEmpty(this.$slots, 'default')])
|
|
421
426
|
});
|
|
422
427
|
}
|
|
@@ -441,7 +446,7 @@ function useElevation(props, opts = {}) {
|
|
|
441
446
|
};
|
|
442
447
|
}
|
|
443
448
|
|
|
444
|
-
function _isSlot$
|
|
449
|
+
function _isSlot$f(s) {
|
|
445
450
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
446
451
|
}
|
|
447
452
|
|
|
@@ -462,7 +467,7 @@ const VSkeltonLoaderBone = defineComponent({
|
|
|
462
467
|
const TagName = props.tag;
|
|
463
468
|
return createVNode(TagName, mergeProps(ctx.attrs, {
|
|
464
469
|
"class": "v-skelton-loader-bone"
|
|
465
|
-
}), _isSlot$
|
|
470
|
+
}), _isSlot$f(_slot = renderSlotOrEmpty$1(ctx.slots)) ? _slot : {
|
|
466
471
|
default: () => [_slot]
|
|
467
472
|
});
|
|
468
473
|
};
|
|
@@ -1285,7 +1290,7 @@ const VButtonGroup = defineComponent({
|
|
|
1285
1290
|
|
|
1286
1291
|
});
|
|
1287
1292
|
|
|
1288
|
-
function _isSlot$
|
|
1293
|
+
function _isSlot$e(s) {
|
|
1289
1294
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
1290
1295
|
}
|
|
1291
1296
|
|
|
@@ -1534,7 +1539,7 @@ const VPagination = defineComponent({
|
|
|
1534
1539
|
"class": classes,
|
|
1535
1540
|
"to": to,
|
|
1536
1541
|
"key": key
|
|
1537
|
-
}, _isSlot$
|
|
1542
|
+
}, _isSlot$e(children) ? children : {
|
|
1538
1543
|
default: () => [children]
|
|
1539
1544
|
});
|
|
1540
1545
|
} else {
|
|
@@ -1690,7 +1695,7 @@ const VDrawerLayout = defineComponent({
|
|
|
1690
1695
|
|
|
1691
1696
|
});
|
|
1692
1697
|
|
|
1693
|
-
function _isSlot$
|
|
1698
|
+
function _isSlot$d(s) {
|
|
1694
1699
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
1695
1700
|
}
|
|
1696
1701
|
|
|
@@ -1727,7 +1732,7 @@ const VHero = defineComponent({
|
|
|
1727
1732
|
}, {
|
|
1728
1733
|
default: () => [createVNode(HTagName, {
|
|
1729
1734
|
"class": "v-hero__title"
|
|
1730
|
-
}, _isSlot$
|
|
1735
|
+
}, _isSlot$d(_slot = renderSlotOrEmpty$1(ctx.slots, 'default')) ? _slot : {
|
|
1731
1736
|
default: () => [_slot]
|
|
1732
1737
|
}), adornment && createVNode("div", {
|
|
1733
1738
|
"class": "v-hero__adornment"
|
|
@@ -1739,7 +1744,7 @@ const VHero = defineComponent({
|
|
|
1739
1744
|
|
|
1740
1745
|
});
|
|
1741
1746
|
|
|
1742
|
-
function _isSlot$
|
|
1747
|
+
function _isSlot$c(s) {
|
|
1743
1748
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
1744
1749
|
}
|
|
1745
1750
|
|
|
@@ -1780,7 +1785,7 @@ function renderNavigationItemInput(input, extraProps) {
|
|
|
1780
1785
|
} = resolveNavigationItemInput(input);
|
|
1781
1786
|
return createVNode(VNavigationItem, { ...props,
|
|
1782
1787
|
...extraProps
|
|
1783
|
-
}, _isSlot$
|
|
1788
|
+
}, _isSlot$c(label) ? label : {
|
|
1784
1789
|
default: () => [label]
|
|
1785
1790
|
});
|
|
1786
1791
|
}
|
|
@@ -1935,7 +1940,7 @@ const VNavigationItem = defineComponent({
|
|
|
1935
1940
|
"class": ['v-navigation-item', classes.value],
|
|
1936
1941
|
"onClick": onClick,
|
|
1937
1942
|
"onChangeActive": onChangeActive
|
|
1938
|
-
}), _isSlot$
|
|
1943
|
+
}), _isSlot$c(_slot = renderSlotOrEmpty$1(ctx.slots, 'default')) ? _slot : {
|
|
1939
1944
|
default: () => [_slot]
|
|
1940
1945
|
}), _children && createVNode(VExpandTransition, null, {
|
|
1941
1946
|
default: () => [withDirectives(createVNode("div", {
|
|
@@ -2119,7 +2124,7 @@ const VCheckbox = defineComponent({
|
|
|
2119
2124
|
|
|
2120
2125
|
});
|
|
2121
2126
|
|
|
2122
|
-
function _isSlot$
|
|
2127
|
+
function _isSlot$b(s) {
|
|
2123
2128
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
2124
2129
|
}
|
|
2125
2130
|
|
|
@@ -2131,7 +2136,7 @@ const VCheckboxGroup = defineFormSelectorComponent({
|
|
|
2131
2136
|
itemRenderer: ({
|
|
2132
2137
|
attrs,
|
|
2133
2138
|
slots
|
|
2134
|
-
}) => createVNode(VCheckbox, attrs, _isSlot$
|
|
2139
|
+
}) => createVNode(VCheckbox, attrs, _isSlot$b(slots) ? slots : {
|
|
2135
2140
|
default: () => [slots]
|
|
2136
2141
|
})
|
|
2137
2142
|
});
|
|
@@ -2183,7 +2188,7 @@ const VRadio = defineComponent({
|
|
|
2183
2188
|
|
|
2184
2189
|
});
|
|
2185
2190
|
|
|
2186
|
-
function _isSlot$
|
|
2191
|
+
function _isSlot$a(s) {
|
|
2187
2192
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
2188
2193
|
}
|
|
2189
2194
|
|
|
@@ -2194,7 +2199,7 @@ const VRadioGroup = defineFormSelectorComponent({
|
|
|
2194
2199
|
itemRenderer: ({
|
|
2195
2200
|
attrs,
|
|
2196
2201
|
slots
|
|
2197
|
-
}) => createVNode(VRadio, attrs, _isSlot$
|
|
2202
|
+
}) => createVNode(VRadio, attrs, _isSlot$a(slots) ? slots : {
|
|
2198
2203
|
default: () => [slots]
|
|
2199
2204
|
})
|
|
2200
2205
|
});
|
|
@@ -2256,7 +2261,7 @@ const VSwitch = defineComponent({
|
|
|
2256
2261
|
|
|
2257
2262
|
});
|
|
2258
2263
|
|
|
2259
|
-
function _isSlot$
|
|
2264
|
+
function _isSlot$9(s) {
|
|
2260
2265
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
2261
2266
|
}
|
|
2262
2267
|
|
|
@@ -2268,7 +2273,7 @@ const VSwitchGroup = defineFormSelectorComponent({
|
|
|
2268
2273
|
itemRenderer: ({
|
|
2269
2274
|
attrs,
|
|
2270
2275
|
slots
|
|
2271
|
-
}) => createVNode(VSwitch, attrs, _isSlot$
|
|
2276
|
+
}) => createVNode(VSwitch, attrs, _isSlot$9(slots) ? slots : {
|
|
2272
2277
|
default: () => [slots]
|
|
2273
2278
|
})
|
|
2274
2279
|
});
|
|
@@ -2307,10 +2312,13 @@ const VOption = defineComponent({
|
|
|
2307
2312
|
selectorItemControl,
|
|
2308
2313
|
classes
|
|
2309
2314
|
} = this;
|
|
2310
|
-
return createVNode("label", {
|
|
2315
|
+
return createVNode("label", mergeProps({
|
|
2311
2316
|
"class": classes,
|
|
2312
|
-
"onClick": selectorItemControl.handleClickElement
|
|
2313
|
-
|
|
2317
|
+
"onClick": selectorItemControl.handleClickElement,
|
|
2318
|
+
"tabindex": selectorItemControl.tabindex
|
|
2319
|
+
}, {
|
|
2320
|
+
'aria-disabled': selectorItemControl.isDisabled
|
|
2321
|
+
}), [createVNode("span", {
|
|
2314
2322
|
"class": "v-option__label"
|
|
2315
2323
|
}, [renderSlotOrEmpty(this.$slots, 'default')])]);
|
|
2316
2324
|
}
|
|
@@ -2464,6 +2472,10 @@ const VControlField = defineComponent({
|
|
|
2464
2472
|
|
|
2465
2473
|
});
|
|
2466
2474
|
|
|
2475
|
+
function _isSlot$8(s) {
|
|
2476
|
+
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
2477
|
+
}
|
|
2478
|
+
|
|
2467
2479
|
const {
|
|
2468
2480
|
props: props$3,
|
|
2469
2481
|
emits: emits$3
|
|
@@ -2567,18 +2579,29 @@ const VSelect = defineComponent({
|
|
|
2567
2579
|
selectedItems
|
|
2568
2580
|
} = this;
|
|
2569
2581
|
const children = this.$slots.default && this.$slots.default() || [];
|
|
2570
|
-
const
|
|
2571
|
-
|
|
2582
|
+
const propGroups = this.propGroups.map(group => {
|
|
2583
|
+
let _slot;
|
|
2584
|
+
|
|
2585
|
+
return createVNode(VOptionGroup, {
|
|
2586
|
+
"key": group.id,
|
|
2587
|
+
"groupId": group.id,
|
|
2588
|
+
"label": group.label(selectorControl),
|
|
2589
|
+
"disabled": group.disabled
|
|
2590
|
+
}, _isSlot$8(_slot = group.items.map(item => createVNode(VOption, {
|
|
2572
2591
|
"disabled": item.disabled,
|
|
2573
2592
|
"value": item.value,
|
|
2574
2593
|
"key": item.value
|
|
2575
2594
|
}, {
|
|
2576
2595
|
default: () => item.label(selectorControl)
|
|
2596
|
+
}))) ? _slot : {
|
|
2597
|
+
default: () => [_slot]
|
|
2577
2598
|
});
|
|
2578
2599
|
});
|
|
2579
2600
|
return createVNode(VFormControl, {
|
|
2580
2601
|
"nodeControl": nodeControl,
|
|
2581
|
-
"class": ['v-select', this.classes
|
|
2602
|
+
"class": ['v-select', this.classes, {
|
|
2603
|
+
'v-select--multiple': this.multiple
|
|
2604
|
+
}],
|
|
2582
2605
|
"label": this.label,
|
|
2583
2606
|
"hint": this.hint,
|
|
2584
2607
|
"hinttip": this.hinttip,
|
|
@@ -2594,11 +2617,20 @@ const VSelect = defineComponent({
|
|
|
2594
2617
|
"distance": 0,
|
|
2595
2618
|
"alwaysRender": true,
|
|
2596
2619
|
"modelValue": this.menuOpened,
|
|
2597
|
-
"onUpdate:modelValue": $event => this.menuOpened = $event
|
|
2620
|
+
"onUpdate:modelValue": $event => this.menuOpened = $event,
|
|
2621
|
+
"itemElements": body => body.querySelectorAll('.v-option'),
|
|
2622
|
+
"onChoiceItemElement": item => {
|
|
2623
|
+
const ev = new MouseEvent('click', {
|
|
2624
|
+
view: window,
|
|
2625
|
+
bubbles: true,
|
|
2626
|
+
cancelable: true
|
|
2627
|
+
});
|
|
2628
|
+
item.dispatchEvent(ev);
|
|
2629
|
+
}
|
|
2598
2630
|
}, {
|
|
2599
2631
|
default: () => [createVNode("div", {
|
|
2600
2632
|
"class": ['v-select__body', this.classes]
|
|
2601
|
-
}, [children,
|
|
2633
|
+
}, [children, propGroups])],
|
|
2602
2634
|
activator: ({
|
|
2603
2635
|
attrs,
|
|
2604
2636
|
control
|
|
@@ -2611,6 +2643,7 @@ const VSelect = defineComponent({
|
|
|
2611
2643
|
"endAdornment": this.endAdornment,
|
|
2612
2644
|
"size": this.size,
|
|
2613
2645
|
"focused": this.menuOpened,
|
|
2646
|
+
"autoHeight": this.multiple,
|
|
2614
2647
|
"onClick": ev => {
|
|
2615
2648
|
if (this.canOperation && !control.isActive) {
|
|
2616
2649
|
let t = ev.target;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fastkit/vui",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.9",
|
|
4
4
|
"description": "@fastkit/vui",
|
|
5
5
|
"buildOptions": {
|
|
6
6
|
"name": "Vui",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"vue": "^3.2.26"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@fastkit/color-scheme": "0.8.
|
|
36
|
-
"@fastkit/icon-font": "0.8.
|
|
37
|
-
"@fastkit/tiny-logger": "0.8.
|
|
38
|
-
"@fastkit/vite-kit": "0.8.
|
|
39
|
-
"@fastkit/vue-kit": "0.8.
|
|
35
|
+
"@fastkit/color-scheme": "0.8.9",
|
|
36
|
+
"@fastkit/icon-font": "0.8.9",
|
|
37
|
+
"@fastkit/tiny-logger": "0.8.9",
|
|
38
|
+
"@fastkit/vite-kit": "0.8.9",
|
|
39
|
+
"@fastkit/vue-kit": "0.8.9",
|
|
40
40
|
"@tiptap/extension-link": "^2.0.0-beta.36",
|
|
41
41
|
"@tiptap/extension-underline": "^2.0.0-beta.23",
|
|
42
42
|
"@tiptap/extension-text-style": "^2.0.0-beta.23",
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
@use '../../styles/core.scss';
|
|
2
2
|
|
|
3
3
|
.v-option {
|
|
4
|
+
@include core.button-reset();
|
|
5
|
+
|
|
4
6
|
position: relative;
|
|
5
7
|
display: flex;
|
|
6
8
|
width: 100%;
|
|
7
|
-
padding: 0.
|
|
8
|
-
|
|
9
|
-
user-select: none;
|
|
9
|
+
padding: 0.75em 1em;
|
|
10
|
+
// font-size: 0.875em;
|
|
10
11
|
|
|
11
12
|
input {
|
|
12
13
|
@include core.hidden-input-element;
|
|
@@ -58,4 +59,15 @@
|
|
|
58
59
|
&--has-not-value &__label {
|
|
59
60
|
font-style: italic;
|
|
60
61
|
}
|
|
62
|
+
|
|
63
|
+
&[disabled],
|
|
64
|
+
&[tabindex='-1'] {
|
|
65
|
+
color: var(--palette-muted);
|
|
66
|
+
pointer-events: none;
|
|
67
|
+
opacity: 0.4;
|
|
68
|
+
|
|
69
|
+
&::before {
|
|
70
|
+
opacity: 0 !important;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
61
73
|
}
|
|
@@ -42,7 +42,13 @@ export const VOption = defineComponent({
|
|
|
42
42
|
render() {
|
|
43
43
|
const { selectorItemControl, classes } = this;
|
|
44
44
|
return (
|
|
45
|
-
<label
|
|
45
|
+
<label
|
|
46
|
+
class={classes}
|
|
47
|
+
onClick={selectorItemControl.handleClickElement}
|
|
48
|
+
tabindex={selectorItemControl.tabindex}
|
|
49
|
+
{...({
|
|
50
|
+
'aria-disabled': selectorItemControl.isDisabled,
|
|
51
|
+
} as any)}>
|
|
46
52
|
<span class="v-option__label">
|
|
47
53
|
{renderSlotOrEmpty(this.$slots, 'default')}
|
|
48
54
|
</span>
|
|
@@ -1,3 +1,16 @@
|
|
|
1
1
|
.v-option-group {
|
|
2
2
|
display: block;
|
|
3
|
+
|
|
4
|
+
&__label {
|
|
5
|
+
padding: 1em;
|
|
6
|
+
// padding: 0.875em 1em;
|
|
7
|
+
font-size: 0.875em;
|
|
8
|
+
color: var(--palette-caption);
|
|
9
|
+
opacity: 0.6;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&--disabled &__label {
|
|
13
|
+
color: var(--palette-muted);
|
|
14
|
+
opacity: 0.4;
|
|
15
|
+
}
|
|
3
16
|
}
|
|
@@ -58,6 +58,20 @@
|
|
|
58
58
|
white-space: nowrap;
|
|
59
59
|
vertical-align: middle;
|
|
60
60
|
}
|
|
61
|
+
|
|
62
|
+
.v-select--multiple & {
|
|
63
|
+
display: block;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.v-select--multiple &__inner {
|
|
67
|
+
display: block;
|
|
68
|
+
overflow: auto;
|
|
69
|
+
white-space: unset;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&--multiple .v-control-field__body {
|
|
74
|
+
padding: 0.2em 0;
|
|
61
75
|
}
|
|
62
76
|
|
|
63
77
|
&__placeholder {
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
import { VUI_SELECT_SYMBOL, useVui } from '../../injections';
|
|
27
27
|
import { VIcon } from '../VIcon';
|
|
28
28
|
import { VMenu } from '../kits';
|
|
29
|
+
import { VOptionGroup } from '../VOptionGroup';
|
|
29
30
|
import { VOption } from '../VOption';
|
|
30
31
|
import { VButton } from '..';
|
|
31
32
|
|
|
@@ -129,13 +130,24 @@ export const VSelect = defineComponent({
|
|
|
129
130
|
render() {
|
|
130
131
|
const { nodeControl, selectorControl, selectorItems, selectedItems } = this;
|
|
131
132
|
const children = (this.$slots.default && this.$slots.default()) || [];
|
|
132
|
-
const
|
|
133
|
+
const propGroups = this.propGroups.map((group) => {
|
|
133
134
|
return (
|
|
134
|
-
<
|
|
135
|
-
{
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
|
|
135
|
+
<VOptionGroup
|
|
136
|
+
key={group.id}
|
|
137
|
+
groupId={group.id}
|
|
138
|
+
label={group.label(selectorControl)}
|
|
139
|
+
disabled={group.disabled}>
|
|
140
|
+
{group.items.map((item) => (
|
|
141
|
+
<VOption
|
|
142
|
+
disabled={item.disabled}
|
|
143
|
+
value={item.value}
|
|
144
|
+
key={item.value}>
|
|
145
|
+
{{
|
|
146
|
+
default: () => item.label(selectorControl),
|
|
147
|
+
}}
|
|
148
|
+
</VOption>
|
|
149
|
+
))}
|
|
150
|
+
</VOptionGroup>
|
|
139
151
|
);
|
|
140
152
|
});
|
|
141
153
|
|
|
@@ -143,7 +155,13 @@ export const VSelect = defineComponent({
|
|
|
143
155
|
<VFormControl
|
|
144
156
|
nodeControl={nodeControl}
|
|
145
157
|
// focused={this.nodeControl.focused}
|
|
146
|
-
class={[
|
|
158
|
+
class={[
|
|
159
|
+
'v-select',
|
|
160
|
+
this.classes,
|
|
161
|
+
{
|
|
162
|
+
'v-select--multiple': this.multiple,
|
|
163
|
+
},
|
|
164
|
+
]}
|
|
147
165
|
label={this.label}
|
|
148
166
|
hint={this.hint}
|
|
149
167
|
hinttip={this.hinttip}
|
|
@@ -161,6 +179,15 @@ export const VSelect = defineComponent({
|
|
|
161
179
|
distance={0}
|
|
162
180
|
alwaysRender
|
|
163
181
|
v-model={this.menuOpened}
|
|
182
|
+
itemElements={(body) => body.querySelectorAll('.v-option')}
|
|
183
|
+
onChoiceItemElement={(item) => {
|
|
184
|
+
const ev = new MouseEvent('click', {
|
|
185
|
+
view: window,
|
|
186
|
+
bubbles: true,
|
|
187
|
+
cancelable: true,
|
|
188
|
+
});
|
|
189
|
+
item.dispatchEvent(ev);
|
|
190
|
+
}}
|
|
164
191
|
v-slots={{
|
|
165
192
|
activator: ({ attrs, control }) => [
|
|
166
193
|
<VControlField
|
|
@@ -173,6 +200,7 @@ export const VSelect = defineComponent({
|
|
|
173
200
|
// tabindex={this.computedTabindex}
|
|
174
201
|
size={this.size}
|
|
175
202
|
focused={this.menuOpened}
|
|
203
|
+
autoHeight={this.multiple}
|
|
176
204
|
onClick={(ev) => {
|
|
177
205
|
if (this.canOperation && !control.isActive) {
|
|
178
206
|
let t = ev.target as HTMLElement;
|
|
@@ -261,7 +289,7 @@ export const VSelect = defineComponent({
|
|
|
261
289
|
}}>
|
|
262
290
|
<div class={['v-select__body', this.classes]}>
|
|
263
291
|
{children}
|
|
264
|
-
{
|
|
292
|
+
{propGroups}
|
|
265
293
|
</div>
|
|
266
294
|
</VMenu>
|
|
267
295
|
),
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
FormControlSlots,
|
|
9
9
|
useFormSelectorControl,
|
|
10
10
|
FormSelectorControl,
|
|
11
|
-
|
|
11
|
+
ResolvedFormSelectorItem,
|
|
12
12
|
FormNodeControl,
|
|
13
13
|
renderSlotOrEmpty,
|
|
14
14
|
VNodeChildOrSlot,
|
|
@@ -28,7 +28,7 @@ export interface DefineFormSelectorComponentOptions {
|
|
|
28
28
|
itemRenderer: (ctx: {
|
|
29
29
|
control: FormSelectorControl;
|
|
30
30
|
selected: boolean;
|
|
31
|
-
attrs:
|
|
31
|
+
attrs: ResolvedFormSelectorItem & {
|
|
32
32
|
modelValue: boolean;
|
|
33
33
|
key: string | number;
|
|
34
34
|
};
|
|
@@ -70,7 +70,7 @@ export function defineFormSelectorComponent(
|
|
|
70
70
|
});
|
|
71
71
|
const control = useControl(props);
|
|
72
72
|
const vui = useVui();
|
|
73
|
-
const loadingMessageRef = computed(() => {
|
|
73
|
+
const loadingMessageRef = computed<VNodeChild | undefined>(() => {
|
|
74
74
|
const slot = resolveVNodeChildOrSlots(
|
|
75
75
|
props.loadingMessage,
|
|
76
76
|
vui.setting('loadingMessage'),
|
|
@@ -135,20 +135,29 @@ export function defineFormSelectorComponent(
|
|
|
135
135
|
{this.loadingMessageRef}
|
|
136
136
|
</div>
|
|
137
137
|
)}
|
|
138
|
-
{this.
|
|
139
|
-
const
|
|
140
|
-
return
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
138
|
+
{this.propGroups.map((group) => {
|
|
139
|
+
const { items } = group;
|
|
140
|
+
return (
|
|
141
|
+
<>
|
|
142
|
+
{items.map((attrs) => {
|
|
143
|
+
const selected = selectorControl.isSelected(
|
|
144
|
+
attrs.value,
|
|
145
|
+
);
|
|
146
|
+
return itemRenderer({
|
|
147
|
+
selected,
|
|
148
|
+
control: selectorControl,
|
|
149
|
+
attrs: {
|
|
150
|
+
...attrs,
|
|
151
|
+
modelValue: selected,
|
|
152
|
+
key: attrs.value,
|
|
153
|
+
},
|
|
154
|
+
slots: {
|
|
155
|
+
default: () => attrs.label(this.selectorControl),
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
})}
|
|
159
|
+
</>
|
|
160
|
+
);
|
|
152
161
|
})}
|
|
153
162
|
{renderSlotOrEmpty(this.$slots, 'default')}
|
|
154
163
|
</div>
|