@fastkit/vui 0.8.18 → 0.9.0
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/LICENSE +21 -0
- package/README.md +4 -1
- package/dist/vui.cjs.js +73 -31
- package/dist/vui.cjs.prod.js +73 -31
- package/dist/vui.css +6 -0
- package/dist/vui.d.ts +83 -49
- package/dist/vui.min.css +1 -1
- package/dist/vui.min.css.map +1 -1
- package/dist/vui.mjs +74 -34
- package/package.json +19 -8
- package/src/components/VBreadcrumbs/VBreadcrumbs.tsx +1 -1
- package/src/components/VBusyImage/VBusyImage.tsx +3 -3
- package/src/components/VButton/VButton.scss +8 -0
- package/src/components/VButton/VButton.tsx +9 -0
- package/src/components/VDataTable/VDataTable.tsx +9 -5
- package/src/components/VListTile/VListTile.tsx +4 -2
- package/src/components/VNavigation/VNavigation.tsx +13 -4
- package/src/components/VNavigation/VNavigationItem.tsx +25 -7
- package/src/components/VSelect/VSelect.tsx +20 -9
- package/src/service.tsx +7 -2
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
createPropsOptions,
|
|
19
19
|
VNodeChildOrSlot,
|
|
20
20
|
resolveVNodeChildOrSlots,
|
|
21
|
-
|
|
21
|
+
useKeyboard,
|
|
22
22
|
} from '@fastkit/vue-kit';
|
|
23
23
|
import { VFormControl } from '../VFormControl';
|
|
24
24
|
import {
|
|
@@ -40,11 +40,11 @@ import { VOption } from '../VOption';
|
|
|
40
40
|
import { VButton } from '..';
|
|
41
41
|
import { VMenuControl } from '@fastkit/vue-stack';
|
|
42
42
|
|
|
43
|
-
export const ARROW_KEY_TYPES =
|
|
43
|
+
export const ARROW_KEY_TYPES = useKeyboard.Key(['ArrowUp', 'ArrowDown']);
|
|
44
44
|
|
|
45
|
-
export const CHOICE_KEY_TYPES =
|
|
45
|
+
export const CHOICE_KEY_TYPES = useKeyboard.Key(['Enter', ' ']);
|
|
46
46
|
|
|
47
|
-
export const KEYBORD_EVENT_TYPES =
|
|
47
|
+
export const KEYBORD_EVENT_TYPES = useKeyboard.Key([
|
|
48
48
|
...ARROW_KEY_TYPES,
|
|
49
49
|
...CHOICE_KEY_TYPES,
|
|
50
50
|
]);
|
|
@@ -59,12 +59,18 @@ export const VSelect = defineComponent({
|
|
|
59
59
|
...createControlFieldProps(),
|
|
60
60
|
...createControlFieldProviderProps(),
|
|
61
61
|
...createControlProps(),
|
|
62
|
-
...defineSlotsProps<
|
|
62
|
+
...defineSlotsProps<
|
|
63
|
+
FormControlSlots &
|
|
64
|
+
InputBoxSlots & {
|
|
65
|
+
selection: { item: FormSelectorItemControl; index: number };
|
|
66
|
+
}
|
|
67
|
+
>(),
|
|
63
68
|
...createPropsOptions({
|
|
64
69
|
placeholder: String,
|
|
65
70
|
loadingMessage: {} as PropType<VNodeChildOrSlot>,
|
|
66
71
|
failedToLoadItemsMessage: {} as PropType<VNodeChildOrSlot>,
|
|
67
72
|
}),
|
|
73
|
+
closeOnNavigation: Boolean,
|
|
68
74
|
},
|
|
69
75
|
emits,
|
|
70
76
|
setup(props, ctx) {
|
|
@@ -109,6 +115,7 @@ export const VSelect = defineComponent({
|
|
|
109
115
|
};
|
|
110
116
|
|
|
111
117
|
const renderSelections = (selectedItems: FormSelectorItemControl[]) => {
|
|
118
|
+
const selectionSlot = ctx.slots.selection;
|
|
112
119
|
const children: VNodeChild[] = [];
|
|
113
120
|
if (inputControl.itemsLoadFailed) {
|
|
114
121
|
children.push(
|
|
@@ -125,7 +132,10 @@ export const VSelect = defineComponent({
|
|
|
125
132
|
if (index > 0) {
|
|
126
133
|
children.push(vui.selectionSeparator());
|
|
127
134
|
}
|
|
128
|
-
|
|
135
|
+
const child = selectionSlot
|
|
136
|
+
? selectionSlot({ item, index })
|
|
137
|
+
: item.renderDefaultSlot();
|
|
138
|
+
children.push(child);
|
|
129
139
|
});
|
|
130
140
|
} else if (props.placeholder != null) {
|
|
131
141
|
children.push(
|
|
@@ -239,16 +249,16 @@ export const VSelect = defineComponent({
|
|
|
239
249
|
}
|
|
240
250
|
};
|
|
241
251
|
|
|
242
|
-
const
|
|
252
|
+
const keyboardEventHandler = (ev: KeyboardEvent) => {
|
|
243
253
|
if (ARROW_KEY_TYPES.includes(ev.key as any)) return arrowKeyHandler(ev);
|
|
244
254
|
if (CHOICE_KEY_TYPES.includes(ev.key as any)) return choiceKeyHandler(ev);
|
|
245
255
|
};
|
|
246
256
|
|
|
247
|
-
|
|
257
|
+
useKeyboard(
|
|
248
258
|
[
|
|
249
259
|
{
|
|
250
260
|
key: KEYBORD_EVENT_TYPES,
|
|
251
|
-
handler:
|
|
261
|
+
handler: keyboardEventHandler,
|
|
252
262
|
},
|
|
253
263
|
],
|
|
254
264
|
{ autorun: true },
|
|
@@ -317,6 +327,7 @@ export const VSelect = defineComponent({
|
|
|
317
327
|
<VMenu
|
|
318
328
|
width="fit"
|
|
319
329
|
maxWidth="fit"
|
|
330
|
+
closeOnNavigation={this.closeOnNavigation}
|
|
320
331
|
distance={0}
|
|
321
332
|
alwaysRender
|
|
322
333
|
v-model={this.menuOpened}
|
package/src/service.tsx
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
resolveVStackDynamicInput,
|
|
13
13
|
} from '@fastkit/vue-kit';
|
|
14
14
|
import type { Router } from 'vue-router';
|
|
15
|
-
import { RouterLink } from 'vue-router';
|
|
15
|
+
import { RouterLink, useLink, UseLinkOptions } from 'vue-router';
|
|
16
16
|
import { LocationService, setDefaultRouterLink } from '@fastkit/vue-utils';
|
|
17
17
|
import { VForm } from './components/VForm';
|
|
18
18
|
import { VTextField, TextFieldInput } from './components/VTextField';
|
|
@@ -20,6 +20,8 @@ import { VueForm, FormControlHinttipDelay } from '@fastkit/vue-form-control';
|
|
|
20
20
|
import { getDocumentScroller } from '@fastkit/vue-scroller';
|
|
21
21
|
import { ControlSize } from './schemes';
|
|
22
22
|
|
|
23
|
+
export type UseLinkResult = ReturnType<typeof useLink>;
|
|
24
|
+
|
|
23
25
|
export interface VuiFormPromptSettings<
|
|
24
26
|
T extends { [key: string]: any } = { [key: string]: any },
|
|
25
27
|
> extends Partial<VDialogProps> {
|
|
@@ -133,7 +135,8 @@ export type VuiVNodeResolver = () => VNodeChild;
|
|
|
133
135
|
|
|
134
136
|
export interface VuiServiceOptions {
|
|
135
137
|
router: Router;
|
|
136
|
-
RouterLink?:
|
|
138
|
+
RouterLink?: any;
|
|
139
|
+
useLink?: (props: UseLinkOptions) => UseLinkResult;
|
|
137
140
|
colorScheme: VueColorSchemePluginSettings;
|
|
138
141
|
uiSettings: VuiServiceUISettings;
|
|
139
142
|
icons: VuiServiceIconSettings;
|
|
@@ -183,6 +186,7 @@ export class VuiService {
|
|
|
183
186
|
readonly router: Router;
|
|
184
187
|
readonly location: LocationService;
|
|
185
188
|
readonly stack: VueStackService;
|
|
189
|
+
readonly useLink: typeof useLink;
|
|
186
190
|
|
|
187
191
|
get scroller() {
|
|
188
192
|
return getDocumentScroller();
|
|
@@ -207,6 +211,7 @@ export class VuiService {
|
|
|
207
211
|
router: this.router,
|
|
208
212
|
});
|
|
209
213
|
this.stack = stackService;
|
|
214
|
+
this.useLink = options.useLink || useLink;
|
|
210
215
|
}
|
|
211
216
|
|
|
212
217
|
configure(options?: Partial<VuiServiceOptions>) {
|