@fastkit/vui 0.16.79 → 0.16.81
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.d.ts +465 -686
- package/dist/vui.mjs +680 -652
- package/dist/vui.mjs.map +1 -1
- package/package.json +23 -23
- package/src/components/VCheckbox/VCheckbox.tsx +36 -29
- package/src/components/VForm/VForm.tsx +12 -24
- package/src/components/VFormControl/VFormControl.tsx +7 -4
- package/src/components/VFormGroup/VFormGroup.tsx +45 -0
- package/src/components/VFormGroup/index.ts +1 -0
- package/src/components/VOption/VOption.tsx +12 -18
- package/src/components/VOptionGroup/VOptionGroup.tsx +13 -14
- package/src/components/VRadio/VRadio.tsx +25 -28
- package/src/components/VSelect/VSelect.tsx +185 -174
- package/src/components/VSwitch/VSwitch.tsx +36 -33
- package/src/components/VTextField/VTextField.tsx +54 -44
- package/src/components/VTextarea/VTextarea.tsx +53 -47
- package/src/components/index.ts +1 -0
- package/src/composables/form-selector.tsx +80 -77
- package/src/injections.ts +1 -0
- package/src/plugin.tsx +18 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fastkit/vui",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.81",
|
|
4
4
|
"description": "A simple, extensible UI kit for Vue applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fastkit",
|
|
@@ -44,31 +44,31 @@
|
|
|
44
44
|
"src"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@fastkit/
|
|
48
|
-
"@fastkit/
|
|
47
|
+
"@fastkit/color-scheme": "1.0.14",
|
|
48
|
+
"@fastkit/dom": "0.1.7",
|
|
49
|
+
"@fastkit/helpers": "0.13.7",
|
|
50
|
+
"@fastkit/color-scheme-gen": "0.13.14",
|
|
49
51
|
"@fastkit/icon-font": "1.0.9",
|
|
50
|
-
"@fastkit/
|
|
52
|
+
"@fastkit/media-match-gen": "0.13.14",
|
|
51
53
|
"@fastkit/media-match": "1.0.9",
|
|
52
|
-
"@fastkit/rules": "0.13.
|
|
53
|
-
"@fastkit/
|
|
54
|
-
"@fastkit/
|
|
55
|
-
"@fastkit/vue-action": "0.2.
|
|
56
|
-
"@fastkit/vue-
|
|
57
|
-
"@fastkit/vue-click-outside": "0.1.
|
|
58
|
-
"@fastkit/vue-
|
|
59
|
-
"@fastkit/vue-color-scheme": "0.14.
|
|
60
|
-
"@fastkit/vue-
|
|
61
|
-
"@fastkit/
|
|
62
|
-
"@fastkit/vue-
|
|
63
|
-
"@fastkit/vue-
|
|
64
|
-
"@fastkit/vue-
|
|
65
|
-
"@fastkit/vue-
|
|
66
|
-
"@fastkit/vue-scroller": "0.14.15",
|
|
67
|
-
"@fastkit/vue-resize": "0.1.13",
|
|
54
|
+
"@fastkit/rules": "0.13.8",
|
|
55
|
+
"@fastkit/tiny-logger": "0.13.7",
|
|
56
|
+
"@fastkit/vue-app-layout": "0.14.17",
|
|
57
|
+
"@fastkit/vue-action": "0.2.15",
|
|
58
|
+
"@fastkit/vue-body-scroll-lock": "0.1.14",
|
|
59
|
+
"@fastkit/vue-click-outside": "0.1.15",
|
|
60
|
+
"@fastkit/vue-form-control": "0.17.0",
|
|
61
|
+
"@fastkit/vue-color-scheme": "0.14.14",
|
|
62
|
+
"@fastkit/vue-keyboard": "0.1.7",
|
|
63
|
+
"@fastkit/vue-loading": "0.14.15",
|
|
64
|
+
"@fastkit/vue-location": "0.1.21",
|
|
65
|
+
"@fastkit/vue-media-match": "0.13.14",
|
|
66
|
+
"@fastkit/vue-resize": "0.1.14",
|
|
67
|
+
"@fastkit/vue-scroller": "0.14.16",
|
|
68
68
|
"@fastkit/stylebase": "0.13.1",
|
|
69
|
-
"@fastkit/vue-stack": "0.15.
|
|
70
|
-
"@fastkit/vue-
|
|
71
|
-
"@fastkit/vue-
|
|
69
|
+
"@fastkit/vue-stack": "0.15.36",
|
|
70
|
+
"@fastkit/vue-transitions": "0.1.15",
|
|
71
|
+
"@fastkit/vue-utils": "0.14.12"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
74
|
"vue": "^3.3.0",
|
|
@@ -26,37 +26,44 @@ export const VCheckbox = defineComponent({
|
|
|
26
26
|
nodeType: VUI_CHECKBOX_SYMBOL,
|
|
27
27
|
parentNodeType: VUI_CHECKBOX_GROUP_SYMBOL,
|
|
28
28
|
});
|
|
29
|
+
|
|
29
30
|
const control = useControl(props);
|
|
30
31
|
const isIndeterminate = computed(() => props.indeterminate);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const classes = computed(() => [
|
|
33
|
+
'v-checkbox',
|
|
34
|
+
{
|
|
35
|
+
'v-checkbox--selected': nodeControl.selected,
|
|
36
|
+
'v-checkbox--indeterminate': isIndeterminate.value,
|
|
37
|
+
},
|
|
38
|
+
control.classes.value,
|
|
39
|
+
]);
|
|
40
|
+
const api = nodeControl.extend({
|
|
41
|
+
get isIndeterminate() {
|
|
42
|
+
return isIndeterminate.value;
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
ctx.expose({
|
|
47
|
+
control: api,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const slots = {
|
|
51
|
+
input: () => nodeControl.createInputElement({ type: 'checkbox' }),
|
|
52
|
+
faux: () => <span class="v-checkbox__faux"></span>,
|
|
53
|
+
label: () => ctx.slots.default?.(),
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
return () => {
|
|
57
|
+
return (
|
|
58
|
+
<VCheckable
|
|
59
|
+
class={classes.value}
|
|
60
|
+
checked={nodeControl.selected || isIndeterminate.value}
|
|
61
|
+
invalid={nodeControl.invalid}
|
|
62
|
+
disabled={nodeControl.isDisabled}
|
|
63
|
+
readonly={nodeControl.isReadonly}
|
|
64
|
+
v-slots={slots}
|
|
65
|
+
/>
|
|
66
|
+
);
|
|
35
67
|
};
|
|
36
|
-
},
|
|
37
|
-
render() {
|
|
38
|
-
const { selectorItemControl, isIndeterminate } = this;
|
|
39
|
-
return (
|
|
40
|
-
<VCheckable
|
|
41
|
-
class={[
|
|
42
|
-
'v-checkbox',
|
|
43
|
-
{
|
|
44
|
-
'v-checkbox--selected': selectorItemControl.selected,
|
|
45
|
-
'v-checkbox--indeterminate': isIndeterminate,
|
|
46
|
-
},
|
|
47
|
-
this.classes,
|
|
48
|
-
]}
|
|
49
|
-
checked={this.selected || isIndeterminate}
|
|
50
|
-
invalid={this.invalid}
|
|
51
|
-
disabled={this.isDisabled}
|
|
52
|
-
readonly={this.isReadonly}
|
|
53
|
-
v-slots={{
|
|
54
|
-
input: () =>
|
|
55
|
-
selectorItemControl.createInputElement({ type: 'checkbox' }),
|
|
56
|
-
faux: () => <span class="v-checkbox__faux"></span>,
|
|
57
|
-
label: () => this.$slots.default?.(),
|
|
58
|
-
}}
|
|
59
|
-
/>
|
|
60
|
-
);
|
|
61
68
|
},
|
|
62
69
|
});
|
|
@@ -5,9 +5,8 @@ import {
|
|
|
5
5
|
useForm,
|
|
6
6
|
} from '@fastkit/vue-form-control';
|
|
7
7
|
import { DefineSlotsType, defineSlots } from '@fastkit/vue-utils';
|
|
8
|
-
import { getDocumentScroller } from '@fastkit/vue-scroller';
|
|
9
8
|
import { createControlProps, useControl } from '../../composables';
|
|
10
|
-
import { VUI_FORM_SYMBOL
|
|
9
|
+
import { VUI_FORM_SYMBOL } from '../../injections';
|
|
11
10
|
|
|
12
11
|
const { props, emits } = createFormSettings({
|
|
13
12
|
nodeType: VUI_FORM_SYMBOL,
|
|
@@ -24,7 +23,6 @@ export function createVFormProps() {
|
|
|
24
23
|
...props,
|
|
25
24
|
...createControlProps(),
|
|
26
25
|
...formSlots(),
|
|
27
|
-
// disableAutoScroll: Boolean,
|
|
28
26
|
};
|
|
29
27
|
}
|
|
30
28
|
|
|
@@ -34,15 +32,8 @@ export const VForm = defineComponent({
|
|
|
34
32
|
emits,
|
|
35
33
|
slots: formSlots,
|
|
36
34
|
setup(props, ctx) {
|
|
37
|
-
const vui = useVui();
|
|
38
35
|
const nodeControl = useForm(props, ctx as any, {
|
|
39
36
|
nodeType: VUI_FORM_SYMBOL,
|
|
40
|
-
scrollToElement: (el) => {
|
|
41
|
-
const scroller = getDocumentScroller();
|
|
42
|
-
return scroller.toElement(el, {
|
|
43
|
-
offset: vui.getAutoScrollToElementOffsetTop(),
|
|
44
|
-
});
|
|
45
|
-
},
|
|
46
37
|
});
|
|
47
38
|
const classes = computed(() => {
|
|
48
39
|
return [
|
|
@@ -59,21 +50,18 @@ export const VForm = defineComponent({
|
|
|
59
50
|
});
|
|
60
51
|
useControl(props);
|
|
61
52
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
render() {
|
|
68
|
-
const { form } = this;
|
|
69
|
-
return (
|
|
53
|
+
ctx.expose({
|
|
54
|
+
control: nodeControl,
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
return () => (
|
|
70
58
|
<form
|
|
71
|
-
ref={
|
|
72
|
-
class={
|
|
73
|
-
action={
|
|
74
|
-
spellcheck={
|
|
75
|
-
onSubmit={
|
|
76
|
-
{
|
|
59
|
+
ref={nodeControl.formRef()}
|
|
60
|
+
class={classes.value}
|
|
61
|
+
action={nodeControl.nativeAction}
|
|
62
|
+
spellcheck={nodeControl.spellcheck}
|
|
63
|
+
onSubmit={nodeControl.handleSubmit}>
|
|
64
|
+
{ctx.slots.default?.(nodeControl)}
|
|
77
65
|
</form>
|
|
78
66
|
);
|
|
79
67
|
},
|
|
@@ -78,11 +78,14 @@ export const VFormControl = defineComponent({
|
|
|
78
78
|
return hinttipDelay;
|
|
79
79
|
});
|
|
80
80
|
|
|
81
|
-
ctx.expose(
|
|
81
|
+
ctx.expose({
|
|
82
|
+
control,
|
|
83
|
+
});
|
|
82
84
|
|
|
83
85
|
const colorProvider = useVuiColorProvider();
|
|
84
86
|
|
|
85
87
|
const classes = computed(() => [
|
|
88
|
+
'v-form-control',
|
|
86
89
|
{
|
|
87
90
|
'v-form-control--validating': control.validating,
|
|
88
91
|
'v-form-control--pending': control.pending,
|
|
@@ -121,7 +124,7 @@ export const VFormControl = defineComponent({
|
|
|
121
124
|
const _hinttipDelay = hinttipDelay.value;
|
|
122
125
|
|
|
123
126
|
return (
|
|
124
|
-
<div class={
|
|
127
|
+
<div class={classes.value}>
|
|
125
128
|
{label && (
|
|
126
129
|
<label class="v-form-control__label" onClick={handleClick}>
|
|
127
130
|
{label}
|
|
@@ -136,11 +139,11 @@ export const VFormControl = defineComponent({
|
|
|
136
139
|
: undefined
|
|
137
140
|
}
|
|
138
141
|
v-slots={{
|
|
139
|
-
activator: (
|
|
142
|
+
activator: (tooltip) => (
|
|
140
143
|
<a
|
|
141
144
|
class="v-form-control__label__hinttip"
|
|
142
145
|
href="javascript:void(0)"
|
|
143
|
-
{...
|
|
146
|
+
{...tooltip.attrs}>
|
|
144
147
|
{hinttip.tip}
|
|
145
148
|
</a>
|
|
146
149
|
),
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { defineComponent } from 'vue';
|
|
2
|
+
import {
|
|
3
|
+
FormGroupControl,
|
|
4
|
+
createFormGroupSettings,
|
|
5
|
+
useFormGroup,
|
|
6
|
+
} from '@fastkit/vue-form-control';
|
|
7
|
+
import { DefineSlotsType, defineSlots } from '@fastkit/vue-utils';
|
|
8
|
+
import { createControlProps, useControl } from '../../composables';
|
|
9
|
+
import { VUI_FORM_GROUP_SYMBOL } from '../../injections';
|
|
10
|
+
|
|
11
|
+
const { props, emits } = createFormGroupSettings();
|
|
12
|
+
|
|
13
|
+
export type VFormGroupSlots = DefineSlotsType<{
|
|
14
|
+
default?: (form: FormGroupControl) => any;
|
|
15
|
+
}>;
|
|
16
|
+
|
|
17
|
+
export const formGroupSlots = defineSlots<VFormGroupSlots>();
|
|
18
|
+
|
|
19
|
+
export function createVFormGroupProps() {
|
|
20
|
+
return {
|
|
21
|
+
...props,
|
|
22
|
+
...createControlProps(),
|
|
23
|
+
...formGroupSlots(),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const VFormGroup = defineComponent({
|
|
28
|
+
name: 'VFormGroup',
|
|
29
|
+
inheritAttrs: false,
|
|
30
|
+
props: createVFormGroupProps(),
|
|
31
|
+
emits,
|
|
32
|
+
slots: formGroupSlots,
|
|
33
|
+
setup(props, ctx) {
|
|
34
|
+
const nodeControl = useFormGroup(props, ctx as any, {
|
|
35
|
+
nodeType: VUI_FORM_GROUP_SYMBOL,
|
|
36
|
+
});
|
|
37
|
+
useControl(props);
|
|
38
|
+
|
|
39
|
+
ctx.expose({
|
|
40
|
+
control: nodeControl,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
return () => ctx.slots.default?.(nodeControl);
|
|
44
|
+
},
|
|
45
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './VFormGroup';
|
|
@@ -33,24 +33,18 @@ export const VOption = defineComponent({
|
|
|
33
33
|
control.classes.value,
|
|
34
34
|
];
|
|
35
35
|
});
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
|
|
37
|
+
return () => {
|
|
38
|
+
return (
|
|
39
|
+
<label
|
|
40
|
+
class={classes.value}
|
|
41
|
+
onClick={nodeControl.handleClickElement}
|
|
42
|
+
tabindex={nodeControl.tabindex}
|
|
43
|
+
data-value={nodeControl.propValue}
|
|
44
|
+
aria-disabled={nodeControl.isDisabled}>
|
|
45
|
+
<span class="v-option__label">{ctx.slots.default?.()}</span>
|
|
46
|
+
</label>
|
|
47
|
+
);
|
|
39
48
|
};
|
|
40
49
|
},
|
|
41
|
-
render() {
|
|
42
|
-
const { selectorItemControl, classes } = this;
|
|
43
|
-
return (
|
|
44
|
-
<label
|
|
45
|
-
class={classes}
|
|
46
|
-
onClick={selectorItemControl.handleClickElement}
|
|
47
|
-
tabindex={selectorItemControl.tabindex}
|
|
48
|
-
data-value={selectorItemControl.propValue}
|
|
49
|
-
{...({
|
|
50
|
-
'aria-disabled': selectorItemControl.isDisabled,
|
|
51
|
-
} as any)}>
|
|
52
|
-
<span class="v-option__label">{this.$slots.default?.()}</span>
|
|
53
|
-
</label>
|
|
54
|
-
);
|
|
55
|
-
},
|
|
56
50
|
});
|
|
@@ -41,20 +41,19 @@ export const VOptionGroup = defineComponent({
|
|
|
41
41
|
},
|
|
42
42
|
];
|
|
43
43
|
});
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
|
|
45
|
+
ctx.expose({
|
|
46
|
+
control: groupControl,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
return () => {
|
|
50
|
+
const label = labelSlot.value?.(groupControl);
|
|
51
|
+
return (
|
|
52
|
+
<div class={classes}>
|
|
53
|
+
{!!label && <div class="v-option-group__label">{label}</div>}
|
|
54
|
+
{ctx.slots.default?.()}
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
48
57
|
};
|
|
49
58
|
},
|
|
50
|
-
render() {
|
|
51
|
-
const { labelSlot, classes, groupControl } = this;
|
|
52
|
-
const label = labelSlot ? labelSlot(groupControl) : undefined;
|
|
53
|
-
return (
|
|
54
|
-
<div class={classes}>
|
|
55
|
-
{!!label && <div class="v-option-group__label">{label}</div>}
|
|
56
|
-
{this.$slots.default?.()}
|
|
57
|
-
</div>
|
|
58
|
-
);
|
|
59
|
-
},
|
|
60
59
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './VRadio.scss';
|
|
2
|
-
import { defineComponent } from 'vue';
|
|
2
|
+
import { defineComponent, computed } from 'vue';
|
|
3
3
|
import {
|
|
4
4
|
createFormSelectorItemSettings,
|
|
5
5
|
useFormSelectorItemControl,
|
|
@@ -23,33 +23,30 @@ export const VRadio = defineComponent({
|
|
|
23
23
|
parentNodeType: VUI_RADIO_GROUP_SYMBOL,
|
|
24
24
|
});
|
|
25
25
|
const control = useControl(props);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
const classes = computed(() => [
|
|
27
|
+
'v-radio',
|
|
28
|
+
{
|
|
29
|
+
'v-radio--selected': nodeControl.selected,
|
|
30
|
+
},
|
|
31
|
+
control.classes.value,
|
|
32
|
+
]);
|
|
33
|
+
const slots = {
|
|
34
|
+
input: () => nodeControl.createInputElement({ type: 'radio' }),
|
|
35
|
+
faux: () => <span class="v-radio__faux"></span>,
|
|
36
|
+
label: () => ctx.slots.default?.(),
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
return () => {
|
|
40
|
+
return (
|
|
41
|
+
<VCheckable
|
|
42
|
+
class={classes.value}
|
|
43
|
+
checked={nodeControl.selected}
|
|
44
|
+
invalid={nodeControl.invalid}
|
|
45
|
+
disabled={nodeControl.isDisabled}
|
|
46
|
+
readonly={nodeControl.isReadonly}
|
|
47
|
+
v-slots={slots}
|
|
48
|
+
/>
|
|
49
|
+
);
|
|
29
50
|
};
|
|
30
|
-
},
|
|
31
|
-
render() {
|
|
32
|
-
const { selectorItemControl } = this;
|
|
33
|
-
return (
|
|
34
|
-
<VCheckable
|
|
35
|
-
class={[
|
|
36
|
-
'v-radio',
|
|
37
|
-
{
|
|
38
|
-
'v-radio--selected': selectorItemControl.selected,
|
|
39
|
-
},
|
|
40
|
-
this.classes,
|
|
41
|
-
]}
|
|
42
|
-
checked={this.selected}
|
|
43
|
-
invalid={this.invalid}
|
|
44
|
-
disabled={this.isDisabled}
|
|
45
|
-
readonly={this.isReadonly}
|
|
46
|
-
v-slots={{
|
|
47
|
-
input: () =>
|
|
48
|
-
selectorItemControl.createInputElement({ type: 'radio' }),
|
|
49
|
-
faux: () => <span class="v-radio__faux"></span>,
|
|
50
|
-
label: () => this.$slots.default?.(),
|
|
51
|
-
}}
|
|
52
|
-
/>
|
|
53
|
-
);
|
|
54
51
|
},
|
|
55
52
|
});
|