@byyuurin/ui 0.2.0 → 0.3.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 +20 -20
- package/README.md +5 -3
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -2
- package/dist/runtime/components/Accordion.vue +41 -41
- package/dist/runtime/components/Accordion.vue.d.ts +11 -7
- package/dist/runtime/components/Alert.vue +63 -63
- package/dist/runtime/components/Alert.vue.d.ts +4 -4
- package/dist/runtime/components/App.vue +11 -10
- package/dist/runtime/components/App.vue.d.ts +11 -7
- package/dist/runtime/components/Avatar.vue +29 -29
- package/dist/runtime/components/Avatar.vue.d.ts +4 -3
- package/dist/runtime/components/AvatarGroup.vue +4 -4
- package/dist/runtime/components/AvatarGroup.vue.d.ts +1 -1
- package/dist/runtime/components/Badge.vue +32 -32
- package/dist/runtime/components/Badge.vue.d.ts +2 -2
- package/dist/runtime/components/Breadcrumb.vue +49 -49
- package/dist/runtime/components/Breadcrumb.vue.d.ts +10 -6
- package/dist/runtime/components/Button.vue +52 -51
- package/dist/runtime/components/Button.vue.d.ts +1 -1
- package/dist/runtime/components/Calendar.vue +74 -74
- package/dist/runtime/components/Calendar.vue.d.ts +16 -12
- package/dist/runtime/components/Card.vue +41 -41
- package/dist/runtime/components/Card.vue.d.ts +1 -1
- package/dist/runtime/components/Carousel.vue +66 -66
- package/dist/runtime/components/Carousel.vue.d.ts +14 -10
- package/dist/runtime/components/Checkbox.vue +46 -46
- package/dist/runtime/components/Checkbox.vue.d.ts +4 -3
- package/dist/runtime/components/CheckboxGroup.vue +29 -29
- package/dist/runtime/components/CheckboxGroup.vue.d.ts +11 -7
- package/dist/runtime/components/Chip.vue +15 -15
- package/dist/runtime/components/Chip.vue.d.ts +2 -2
- package/dist/runtime/components/Collapsible.vue +14 -14
- package/dist/runtime/components/Collapsible.vue.d.ts +2 -2
- package/dist/runtime/components/Drawer.vue +76 -76
- package/dist/runtime/components/Drawer.vue.d.ts +6 -6
- package/dist/runtime/components/DropdownMenu.vue +28 -28
- package/dist/runtime/components/DropdownMenu.vue.d.ts +17 -9
- package/dist/runtime/components/DropdownMenuContent.vue +152 -153
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +11 -7
- package/dist/runtime/components/FieldGroup.vue +3 -3
- package/dist/runtime/components/FieldGroup.vue.d.ts +2 -2
- package/dist/runtime/components/Form.vue +9 -9
- package/dist/runtime/components/Form.vue.d.ts +13 -8
- package/dist/runtime/components/FormField.vue +39 -38
- package/dist/runtime/components/FormField.vue.d.ts +7 -2
- package/dist/runtime/components/Icon.vue +2 -2
- package/dist/runtime/components/Icon.vue.d.ts +1 -1
- package/dist/runtime/components/Input.vue +48 -48
- package/dist/runtime/components/Input.vue.d.ts +16 -12
- package/dist/runtime/components/InputNumber.vue +47 -47
- package/dist/runtime/components/InputNumber.vue.d.ts +128 -124
- package/dist/runtime/components/InputTags.vue +54 -53
- package/dist/runtime/components/InputTags.vue.d.ts +16 -11
- package/dist/runtime/components/Kbd.vue +3 -3
- package/dist/runtime/components/Kbd.vue.d.ts +2 -2
- package/dist/runtime/components/Link.vue +26 -25
- package/dist/runtime/components/Link.vue.d.ts +16 -6
- package/dist/runtime/components/LinkBase.vue +3 -3
- package/dist/runtime/components/LinkBase.vue.d.ts +2 -2
- package/dist/runtime/components/Marquee.vue +5 -5
- package/dist/runtime/components/Marquee.vue.d.ts +3 -3
- package/dist/runtime/components/Modal.vue +74 -74
- package/dist/runtime/components/Modal.vue.d.ts +6 -6
- package/dist/runtime/components/NavigationMenu.vue +228 -228
- package/dist/runtime/components/NavigationMenu.vue.d.ts +11 -7
- package/dist/runtime/components/OverlayProvider.vue +9 -9
- package/dist/runtime/components/Pagination.vue +47 -47
- package/dist/runtime/components/Pagination.vue.d.ts +4 -4
- package/dist/runtime/components/PinInput.vue +23 -23
- package/dist/runtime/components/PinInput.vue.d.ts +14 -10
- package/dist/runtime/components/Popover.vue +22 -22
- package/dist/runtime/components/Popover.vue.d.ts +11 -7
- package/dist/runtime/components/Progress.vue +25 -25
- package/dist/runtime/components/Progress.vue.d.ts +2 -2
- package/dist/runtime/components/RadioGroup.vue +50 -50
- package/dist/runtime/components/RadioGroup.vue.d.ts +11 -7
- package/dist/runtime/components/ScrollArea.vue +32 -32
- package/dist/runtime/components/ScrollArea.vue.d.ts +2 -2
- package/dist/runtime/components/Select.vue +299 -148
- package/dist/runtime/components/Select.vue.d.ts +103 -123
- package/dist/runtime/components/Separator.vue +30 -30
- package/dist/runtime/components/Separator.vue.d.ts +2 -2
- package/dist/runtime/components/Skeleton.vue +11 -11
- package/dist/runtime/components/Skeleton.vue.d.ts +2 -2
- package/dist/runtime/components/Slider.vue +25 -25
- package/dist/runtime/components/Slider.vue.d.ts +11 -7
- package/dist/runtime/components/Stepper.vue +116 -0
- package/dist/runtime/components/Stepper.vue.d.ts +83 -0
- package/dist/runtime/components/Switch.vue +30 -30
- package/dist/runtime/components/Switch.vue.d.ts +4 -3
- package/dist/runtime/components/Table.vue +137 -137
- package/dist/runtime/components/Table.vue.d.ts +13 -8
- package/dist/runtime/components/Tabs.vue +74 -74
- package/dist/runtime/components/Tabs.vue.d.ts +12 -8
- package/dist/runtime/components/Textarea.vue +47 -47
- package/dist/runtime/components/Textarea.vue.d.ts +16 -11
- package/dist/runtime/components/Timeline.vue +47 -47
- package/dist/runtime/components/Timeline.vue.d.ts +11 -7
- package/dist/runtime/components/Toast.vue +93 -93
- package/dist/runtime/components/Toast.vue.d.ts +5 -5
- package/dist/runtime/components/ToastProvider.vue +29 -29
- package/dist/runtime/components/ToastProvider.vue.d.ts +3 -3
- package/dist/runtime/components/Tooltip.vue +24 -25
- package/dist/runtime/components/Tooltip.vue.d.ts +2 -2
- package/dist/runtime/components/Tree.vue +241 -0
- package/dist/runtime/components/Tree.vue.d.ts +121 -0
- package/dist/runtime/composables/defineShortcuts.d.ts +1 -0
- package/dist/runtime/composables/defineShortcuts.js +44 -8
- package/dist/runtime/composables/useLocale.d.ts +12 -0
- package/dist/runtime/locale/en.d.ts +6 -0
- package/dist/runtime/locale/en.js +6 -0
- package/dist/runtime/locale/zh_tw.d.ts +6 -0
- package/dist/runtime/locale/zh_tw.js +6 -0
- package/dist/runtime/types/html.d.ts +8 -0
- package/dist/runtime/types/html.js +0 -0
- package/dist/runtime/types/index.d.ts +2 -0
- package/dist/runtime/types/index.js +2 -0
- package/dist/runtime/types/input.d.ts +5 -5
- package/dist/runtime/types/locale.d.ts +6 -0
- package/dist/runtime/types/unocss.d.ts +4 -4
- package/dist/runtime/types/utils.d.ts +3 -3
- package/dist/runtime/utils/index.d.ts +3 -3
- package/dist/runtime/utils/link.d.ts +2 -1
- package/dist/runtime/utils/link.js +40 -29
- package/dist/runtime/vue/components/Icon.vue +2 -2
- package/dist/runtime/vue/components/Icon.vue.d.ts +1 -1
- package/dist/runtime/vue/components/Link.vue +7 -12
- package/dist/runtime/vue/components/Link.vue.d.ts +11 -40
- package/dist/setup.d.mts +1 -1
- package/dist/shared/{ui.CzIlLITK.mjs → ui.9kQouwss.mjs} +5 -3
- package/dist/shared/{ui.DpbffTXs.d.mts → ui.D8Bg1HWt.d.mts} +2 -0
- package/dist/shared/{ui.DLOxhmP0.mjs → ui.DpkP12cX.mjs} +262 -17
- package/dist/unocss.mjs +1 -1
- package/dist/unplugin.d.mts +1 -1
- package/dist/unplugin.mjs +2 -2
- package/dist/vite.d.mts +1 -1
- package/dist/vite.mjs +2 -2
- package/package.json +29 -29
- package/vue-plugin.d.ts +5 -5
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { VariantProps } from '@byyuurin/ui-kit';
|
|
2
|
+
import type { TreeItemProps, TreeItemSelectEvent, TreeItemToggleEvent, TreeRootEmits, TreeRootProps } from 'reka-ui';
|
|
3
|
+
import theme from '#build/ui/tree';
|
|
4
|
+
import type { ComponentBaseProps, ComponentStyler, ComponentUIProps, IconProps } from '../types';
|
|
5
|
+
import type { DynamicSlots, GetItemKeys, StaticSlot } from '../types/utils';
|
|
6
|
+
export interface TreeItem extends ComponentBaseProps {
|
|
7
|
+
icon?: IconProps['name'];
|
|
8
|
+
label?: string;
|
|
9
|
+
trailingIcon?: IconProps['name'];
|
|
10
|
+
defaultExpanded?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
slot?: string;
|
|
13
|
+
children?: TreeItem[];
|
|
14
|
+
onToggle?: (e: TreeItemToggleEvent<TreeItem>) => void;
|
|
15
|
+
onSelect?: (e: TreeItemSelectEvent<TreeItem>) => void;
|
|
16
|
+
ui?: Pick<ComponentUIProps<typeof theme>, 'item' | 'itemWithChildren' | 'link' | 'linkLeadingIcon' | 'linkLabel' | 'linkTrailing' | 'linkTrailingIcon' | 'listWithChildren'>;
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
}
|
|
19
|
+
type ThemeVariants = VariantProps<typeof theme>;
|
|
20
|
+
export interface TreeProps<T extends TreeItem[] = TreeItem[], M extends boolean = false> extends ComponentBaseProps, Pick<TreeRootProps<T>, 'expanded' | 'defaultExpanded' | 'selectionBehavior' | 'propagateSelect' | 'disabled' | 'bubbleSelect'> {
|
|
21
|
+
/**
|
|
22
|
+
* The element or component this component should render as.
|
|
23
|
+
* @default "ul"
|
|
24
|
+
*/
|
|
25
|
+
as?: TreeRootProps<T>['as'] | {
|
|
26
|
+
root?: TreeRootProps<T>['as'];
|
|
27
|
+
link: TreeItemProps<T>['as'];
|
|
28
|
+
};
|
|
29
|
+
/** @default "primary" */
|
|
30
|
+
color?: ThemeVariants['color'];
|
|
31
|
+
/** @default "md" */
|
|
32
|
+
size?: ThemeVariants['size'];
|
|
33
|
+
/** This function is passed the index of each item and should return a unique key for that item */
|
|
34
|
+
getKey?: (val: T[number]) => string;
|
|
35
|
+
/**
|
|
36
|
+
* The key used to get the label from the item.
|
|
37
|
+
* @default "label"
|
|
38
|
+
*/
|
|
39
|
+
labelKey?: GetItemKeys<T>;
|
|
40
|
+
/**
|
|
41
|
+
* The icon displayed on the right side of a parent node.
|
|
42
|
+
* @default app.icons.chevronDown
|
|
43
|
+
*/
|
|
44
|
+
trailingIcon?: IconProps['name'];
|
|
45
|
+
/**
|
|
46
|
+
* The icon displayed when a parent node is expanded.
|
|
47
|
+
* @default app.icons.folderOpen
|
|
48
|
+
*/
|
|
49
|
+
expandedIcon?: IconProps['name'];
|
|
50
|
+
/**
|
|
51
|
+
* The icon displayed when a parent node is collapsed.
|
|
52
|
+
* @default app.icons.folder
|
|
53
|
+
*/
|
|
54
|
+
collapsedIcon?: IconProps['name'];
|
|
55
|
+
items?: T;
|
|
56
|
+
/** The controlled value of the Tree. Can be bind as `v-model`. */
|
|
57
|
+
modelValue?: M extends true ? T[number][] : T[number];
|
|
58
|
+
/** The value of the Tree when initially rendered. Use when you do not need to control the state of the Tree. */
|
|
59
|
+
defaultValue?: M extends true ? T[number][] : T[number];
|
|
60
|
+
/** Whether multiple options can be selected or not. */
|
|
61
|
+
multiple?: M & boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Use nested DOM structure (children inside parents) vs flattened structure (all items at same level).
|
|
64
|
+
* @default true
|
|
65
|
+
*/
|
|
66
|
+
nested?: boolean;
|
|
67
|
+
onSelect?: (e: TreeItemSelectEvent<T[number]>, item: T[number]) => void;
|
|
68
|
+
onToggle?: (e: TreeItemToggleEvent<T[number]>, item: T[number]) => void;
|
|
69
|
+
ui?: ComponentUIProps<typeof theme>;
|
|
70
|
+
}
|
|
71
|
+
export type TreeEmits<T extends TreeItem[] = TreeItem[], M extends boolean = false> = TreeRootEmits<T[number], M>;
|
|
72
|
+
type SlotProps<T extends TreeItem> = StaticSlot<{
|
|
73
|
+
item: T;
|
|
74
|
+
index: number;
|
|
75
|
+
level: number;
|
|
76
|
+
expanded: boolean;
|
|
77
|
+
selected: boolean;
|
|
78
|
+
indeterminate: boolean | undefined;
|
|
79
|
+
handleSelect: () => void;
|
|
80
|
+
handleToggle: () => void;
|
|
81
|
+
ui: ComponentStyler<typeof theme>;
|
|
82
|
+
}>;
|
|
83
|
+
export type TreeSlots<T extends TreeItem[] = TreeItem[]> = {
|
|
84
|
+
'item-wrapper': SlotProps<T[number]>;
|
|
85
|
+
'item': SlotProps<T[number]>;
|
|
86
|
+
'item-leading': SlotProps<T[number]>;
|
|
87
|
+
'item-label': SlotProps<T[number]>;
|
|
88
|
+
'item-trailing': SlotProps<T[number]>;
|
|
89
|
+
} & DynamicSlots<T[number], undefined, {
|
|
90
|
+
index: number;
|
|
91
|
+
level: number;
|
|
92
|
+
expanded: boolean;
|
|
93
|
+
ui: ComponentStyler<typeof theme>;
|
|
94
|
+
selected: boolean;
|
|
95
|
+
indeterminate: boolean | undefined;
|
|
96
|
+
handleSelect: () => void;
|
|
97
|
+
handleToggle: () => void;
|
|
98
|
+
}>;
|
|
99
|
+
declare const _default: typeof __VLS_export;
|
|
100
|
+
export default _default;
|
|
101
|
+
declare const __VLS_export: <T extends TreeItem[], M extends boolean = false>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
102
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<TreeProps<T, M> & {
|
|
103
|
+
"onUpdate:modelValue"?: ((val: M extends true ? T[number][] : T[number]) => any) | undefined;
|
|
104
|
+
"onUpdate:expanded"?: ((val: string[]) => any) | undefined;
|
|
105
|
+
}> & (typeof globalThis extends {
|
|
106
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
107
|
+
} ? P : {});
|
|
108
|
+
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
109
|
+
readonly $el: HTMLElement;
|
|
110
|
+
}>) => void;
|
|
111
|
+
attrs: any;
|
|
112
|
+
slots: TreeSlots<T>;
|
|
113
|
+
emit: ((evt: "update:modelValue", val: M extends true ? T[number][] : T[number]) => void) & ((evt: "update:expanded", val: string[]) => void);
|
|
114
|
+
}>) => import("vue").VNode & {
|
|
115
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
116
|
+
};
|
|
117
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
118
|
+
[K in keyof T]: T[K];
|
|
119
|
+
} : {
|
|
120
|
+
[K in keyof T as K]: T[K];
|
|
121
|
+
}) & {};
|
|
@@ -10,6 +10,7 @@ export interface ShortcutsConfig {
|
|
|
10
10
|
}
|
|
11
11
|
export interface ShortcutsOptions {
|
|
12
12
|
chainDelay?: number;
|
|
13
|
+
layoutIndependent?: boolean;
|
|
13
14
|
}
|
|
14
15
|
export declare function extractShortcuts(items: any[] | any[][]): Record<string, Handler>;
|
|
15
16
|
export declare function defineShortcuts(config: MaybeRef<ShortcutsConfig>, options?: ShortcutsOptions): import("@vueuse/core").Fn;
|
|
@@ -3,7 +3,28 @@ import { computed, ref, toValue } from "vue";
|
|
|
3
3
|
import { useKbd } from "./useKbd.js";
|
|
4
4
|
const chainedShortcutRegex = /^[^-]+.*-.*[^-]+$/;
|
|
5
5
|
const combinedShortcutRegex = /^[^_]+.*_.*[^_]+$/;
|
|
6
|
-
const shiftableKeys =
|
|
6
|
+
const shiftableKeys = ["arrowleft", "arrowright", "arrowup", "arrowright", "tab", "escape", "enter", "backspace"];
|
|
7
|
+
function convertKeyToCode(key) {
|
|
8
|
+
if (/^[a-z]$/i.test(key))
|
|
9
|
+
return `Key${key.toUpperCase()}`;
|
|
10
|
+
if (/^\d$/.test(key))
|
|
11
|
+
return `Digit${key}`;
|
|
12
|
+
if (/^f\d+$/i.test(key))
|
|
13
|
+
return key.toUpperCase();
|
|
14
|
+
const specialKeys = {
|
|
15
|
+
space: "Space",
|
|
16
|
+
enter: "Enter",
|
|
17
|
+
escape: "Escape",
|
|
18
|
+
tab: "Tab",
|
|
19
|
+
backspace: "Backspace",
|
|
20
|
+
delete: "Delete",
|
|
21
|
+
arrowup: "ArrowUp",
|
|
22
|
+
arrowdown: "ArrowDown",
|
|
23
|
+
arrowleft: "ArrowLeft",
|
|
24
|
+
arrowright: "ArrowRight"
|
|
25
|
+
};
|
|
26
|
+
return specialKeys[key.toLowerCase()] || key;
|
|
27
|
+
}
|
|
7
28
|
export function extractShortcuts(items) {
|
|
8
29
|
const shortcuts = {};
|
|
9
30
|
function traverse(items2) {
|
|
@@ -29,6 +50,8 @@ export function defineShortcuts(config, options = {}) {
|
|
|
29
50
|
const debouncedClearChainedInput = useDebounceFn(clearChainedInput, options.chainDelay ?? 800);
|
|
30
51
|
const { macOS } = useKbd();
|
|
31
52
|
const activeElement = useActiveElement();
|
|
53
|
+
const layoutIndependent = options.layoutIndependent ?? false;
|
|
54
|
+
const shiftableCodes = new Set(shiftableKeys.map((k) => convertKeyToCode(k)));
|
|
32
55
|
const usingInput = computed(() => {
|
|
33
56
|
const tagName = activeElement.value?.tagName;
|
|
34
57
|
const contentEditable = activeElement.value?.contentEditable;
|
|
@@ -48,8 +71,13 @@ export function defineShortcuts(config, options = {}) {
|
|
|
48
71
|
console.trace(`[Shortcut] Invalid key: "${key}"`);
|
|
49
72
|
const chained = key.includes("-") && key !== "-" && !key.includes("_");
|
|
50
73
|
if (chained) {
|
|
74
|
+
let shortcutKey = key.toLowerCase();
|
|
75
|
+
if (layoutIndependent) {
|
|
76
|
+
const parts = key.split("-").map((p) => convertKeyToCode(p));
|
|
77
|
+
shortcutKey = parts.join("-");
|
|
78
|
+
}
|
|
51
79
|
shortcut = {
|
|
52
|
-
key:
|
|
80
|
+
key: shortcutKey,
|
|
53
81
|
metaKey: false,
|
|
54
82
|
ctrlKey: false,
|
|
55
83
|
shiftKey: false,
|
|
@@ -57,8 +85,11 @@ export function defineShortcuts(config, options = {}) {
|
|
|
57
85
|
};
|
|
58
86
|
} else {
|
|
59
87
|
const keySplit = key.toLowerCase().split("_").map((k) => k);
|
|
88
|
+
let baseKey = keySplit.filter((k) => !["meta", "command", "ctrl", "shift", "alt", "option"].includes(k)).join("_");
|
|
89
|
+
if (layoutIndependent)
|
|
90
|
+
baseKey = convertKeyToCode(baseKey);
|
|
60
91
|
shortcut = {
|
|
61
|
-
key:
|
|
92
|
+
key: baseKey,
|
|
62
93
|
metaKey: keySplit.includes("meta") || keySplit.includes("command"),
|
|
63
94
|
ctrlKey: keySplit.includes("ctrl"),
|
|
64
95
|
shiftKey: keySplit.includes("shift"),
|
|
@@ -90,10 +121,10 @@ export function defineShortcuts(config, options = {}) {
|
|
|
90
121
|
const onKeyDown = (e) => {
|
|
91
122
|
if (!e.key)
|
|
92
123
|
return;
|
|
93
|
-
const alphabetKey = /^[a-z]{1}$/i.test(e.key);
|
|
94
|
-
const shiftableKey =
|
|
124
|
+
const alphabetKey = layoutIndependent ? /^Key[A-Z]$/i.test(e.code) : /^[a-z]{1}$/i.test(e.key);
|
|
125
|
+
const shiftableKey = layoutIndependent ? shiftableCodes.has(e.code) : shiftableKeys.includes(e.key.toLowerCase());
|
|
95
126
|
let chainedKey;
|
|
96
|
-
chainedInputs.value.push(e.key);
|
|
127
|
+
chainedInputs.value.push(layoutIndependent ? e.code : e.key);
|
|
97
128
|
if (chainedInputs.value.length >= 2) {
|
|
98
129
|
chainedKey = chainedInputs.value.slice(-2).join("-");
|
|
99
130
|
for (const shortcut of shortcuts.value.filter((s) => s.chained)) {
|
|
@@ -108,8 +139,13 @@ export function defineShortcuts(config, options = {}) {
|
|
|
108
139
|
}
|
|
109
140
|
}
|
|
110
141
|
for (const shortcut of shortcuts.value.filter((s) => !s.chained)) {
|
|
111
|
-
if (
|
|
112
|
-
|
|
142
|
+
if (layoutIndependent) {
|
|
143
|
+
if (e.code !== shortcut.key)
|
|
144
|
+
continue;
|
|
145
|
+
} else {
|
|
146
|
+
if (e.key.toLowerCase() !== shortcut.key)
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
113
149
|
if (e.metaKey !== shortcut.metaKey)
|
|
114
150
|
continue;
|
|
115
151
|
if (e.ctrlKey !== shortcut.ctrlKey)
|
|
@@ -26,6 +26,12 @@ declare function _useLocale(): {
|
|
|
26
26
|
modal: {
|
|
27
27
|
close: string;
|
|
28
28
|
};
|
|
29
|
+
select: {
|
|
30
|
+
create: string;
|
|
31
|
+
noData: string;
|
|
32
|
+
noMatch: string;
|
|
33
|
+
search: string;
|
|
34
|
+
};
|
|
29
35
|
table: {
|
|
30
36
|
noData: string;
|
|
31
37
|
};
|
|
@@ -59,6 +65,12 @@ declare function _useLocale(): {
|
|
|
59
65
|
modal: {
|
|
60
66
|
close: string;
|
|
61
67
|
};
|
|
68
|
+
select: {
|
|
69
|
+
create: string;
|
|
70
|
+
noData: string;
|
|
71
|
+
noMatch: string;
|
|
72
|
+
search: string;
|
|
73
|
+
};
|
|
62
74
|
table: {
|
|
63
75
|
noData: string;
|
|
64
76
|
};
|
|
@@ -25,6 +25,12 @@ export default defineLocale({
|
|
|
25
25
|
modal: {
|
|
26
26
|
close: "\u95DC\u9589"
|
|
27
27
|
},
|
|
28
|
+
select: {
|
|
29
|
+
create: "\u5EFA\u7ACB\u300C{label}\u300D",
|
|
30
|
+
noData: "\u6C92\u6709\u8CC7\u6599",
|
|
31
|
+
noMatch: "\u6C92\u6709\u76F8\u7B26\u7684\u8CC7\u6599",
|
|
32
|
+
search: "\u641C\u5C0B\u2026"
|
|
33
|
+
},
|
|
28
34
|
table: {
|
|
29
35
|
noData: "\u6C92\u6709\u8CC7\u6599"
|
|
30
36
|
},
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AnchorHTMLAttributes as VueAnchorHTMLAttributes, ButtonHTMLAttributes as VueButtonHTMLAttributes, FormHTMLAttributes as VueFormHTMLAttributes, ImgHTMLAttributes as VueImgHTMLAttributes, InputHTMLAttributes as VueInputHTMLAttributes, TableHTMLAttributes as VueTableHTMLAttributes, TextareaHTMLAttributes as VueTextareaHTMLAttributes } from 'vue';
|
|
2
|
+
export type AnchorHTMLAttributes = Pick<VueAnchorHTMLAttributes, 'download' | 'href' | 'hreflang' | 'media' | 'ping' | 'rel' | 'target' | 'type' | 'referrerpolicy'>;
|
|
3
|
+
export type ButtonHTMLAttributes = Pick<VueButtonHTMLAttributes, 'autofocus' | 'disabled' | 'form' | 'formaction' | 'formenctype' | 'formmethod' | 'formnovalidate' | 'formtarget' | 'name' | 'type' | 'value'>;
|
|
4
|
+
export type FormHTMLAttributes = Pick<VueFormHTMLAttributes, 'acceptcharset' | 'action' | 'autocomplete' | 'enctype' | 'method' | 'name' | 'novalidate' | 'target'>;
|
|
5
|
+
export type ImgHTMLAttributes = Pick<VueImgHTMLAttributes, 'alt' | 'crossorigin' | 'decoding' | 'height' | 'loading' | 'referrerpolicy' | 'sizes' | 'src' | 'srcset' | 'usemap' | 'width'>;
|
|
6
|
+
export type InputHTMLAttributes = Pick<VueInputHTMLAttributes, 'accept' | 'alt' | 'autocomplete' | 'autofocus' | 'capture' | 'checked' | 'crossorigin' | 'disabled' | 'enterKeyHint' | 'form' | 'formaction' | 'formenctype' | 'formmethod' | 'formnovalidate' | 'formtarget' | 'height' | 'indeterminate' | 'list' | 'max' | 'maxlength' | 'min' | 'minlength' | 'multiple' | 'name' | 'pattern' | 'placeholder' | 'readonly' | 'required' | 'size' | 'src' | 'step' | 'type' | 'value' | 'width'>;
|
|
7
|
+
export type TableHTMLAttributes = Pick<VueTableHTMLAttributes, 'cellpadding' | 'cellspacing' | 'summary' | 'width'>;
|
|
8
|
+
export type TextareaHTMLAttributes = Pick<VueTextareaHTMLAttributes, 'autocomplete' | 'autofocus' | 'cols' | 'dirname' | 'disabled' | 'form' | 'maxlength' | 'minlength' | 'name' | 'placeholder' | 'readonly' | 'required' | 'rows' | 'value' | 'wrap'>;
|
|
File without changes
|
|
@@ -40,6 +40,7 @@ export * from '../components/Select.vue';
|
|
|
40
40
|
export * from '../components/Separator.vue';
|
|
41
41
|
export * from '../components/Skeleton.vue';
|
|
42
42
|
export * from '../components/Slider.vue';
|
|
43
|
+
export * from '../components/Stepper.vue';
|
|
43
44
|
export * from '../components/Switch.vue';
|
|
44
45
|
export * from '../components/Table.vue';
|
|
45
46
|
export * from '../components/Tabs.vue';
|
|
@@ -48,6 +49,7 @@ export * from '../components/Timeline.vue';
|
|
|
48
49
|
export * from '../components/Toast.vue';
|
|
49
50
|
export * from '../components/ToastProvider.vue';
|
|
50
51
|
export * from '../components/Tooltip.vue';
|
|
52
|
+
export * from '../components/Tree.vue';
|
|
51
53
|
export * from './form';
|
|
52
54
|
export * from './locale';
|
|
53
55
|
export * from './style';
|
|
@@ -38,6 +38,7 @@ export * from "../components/Select.vue";
|
|
|
38
38
|
export * from "../components/Separator.vue";
|
|
39
39
|
export * from "../components/Skeleton.vue";
|
|
40
40
|
export * from "../components/Slider.vue";
|
|
41
|
+
export * from "../components/Stepper.vue";
|
|
41
42
|
export * from "../components/Switch.vue";
|
|
42
43
|
export * from "../components/Table.vue";
|
|
43
44
|
export * from "../components/Tabs.vue";
|
|
@@ -46,6 +47,7 @@ export * from "../components/Timeline.vue";
|
|
|
46
47
|
export * from "../components/Toast.vue";
|
|
47
48
|
export * from "../components/ToastProvider.vue";
|
|
48
49
|
export * from "../components/Tooltip.vue";
|
|
50
|
+
export * from "../components/Tree.vue";
|
|
49
51
|
export * from "./form.js";
|
|
50
52
|
export * from "./locale.js";
|
|
51
53
|
export * from "./style.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export interface ModelModifiers {
|
|
2
|
-
string?: boolean;
|
|
3
|
-
number?: boolean;
|
|
4
|
-
trim?: boolean;
|
|
1
|
+
export interface ModelModifiers<T = any> {
|
|
2
|
+
string?: string extends T ? boolean : never;
|
|
3
|
+
number?: number extends T ? boolean : never;
|
|
4
|
+
trim?: string extends T ? boolean : never;
|
|
5
5
|
lazy?: boolean;
|
|
6
|
-
nullable?: boolean;
|
|
6
|
+
nullable?: null extends T ? boolean : never;
|
|
7
7
|
optional?: boolean;
|
|
8
8
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare module '#build/uno-merge' {
|
|
2
|
-
const unoMerge = (code: string) => string
|
|
3
|
-
export { unoMerge }
|
|
4
|
-
}
|
|
1
|
+
declare module '#build/uno-merge' {
|
|
2
|
+
const unoMerge = (code: string) => string
|
|
3
|
+
export { unoMerge }
|
|
4
|
+
}
|
|
@@ -43,9 +43,9 @@ export type ExtractItem<I, S extends string = 'slot'> = Extract<NestedItem<I>, {
|
|
|
43
43
|
[Slot in S]: string;
|
|
44
44
|
}>;
|
|
45
45
|
export type GetItemKeys<I> = keyof Extract<NestedItem<I>, object> | DotPathKeys<Extract<NestedItem<I>, object>>;
|
|
46
|
-
export type GetItemValue<I, VK extends GetItemKeys<I
|
|
47
|
-
export type GetModelValue<T, VK extends GetItemKeys<T
|
|
48
|
-
export interface GetModelValueEmits<T, VK extends GetItemKeys<T
|
|
46
|
+
export type GetItemValue<I, VK extends Nullable<GetItemKeys<I>>, T extends NestedItem<I> = NestedItem<I>> = T extends object ? VK extends undefined | null ? T : VK extends DotPathKeys<T> ? DotPathValue<T, VK> : never : T;
|
|
47
|
+
export type GetModelValue<T, VK extends Nullable<GetItemKeys<T>>, M extends boolean> = M extends true ? GetItemValue<T, VK>[] : GetItemValue<T, VK>;
|
|
48
|
+
export interface GetModelValueEmits<T, VK extends Nullable<GetItemKeys<T>>, M extends boolean> {
|
|
49
49
|
/** Event handler called when the value changes. */
|
|
50
50
|
'update:modelValue': [value: GetModelValue<T, VK, M>];
|
|
51
51
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GetItemKeys, Nullable } from '../types/utils';
|
|
1
|
+
import type { GetItemKeys, MaybeNull, Nullable } from '../types/utils';
|
|
2
2
|
export * from './form';
|
|
3
3
|
export * from './link';
|
|
4
4
|
export * from './vue';
|
|
@@ -7,7 +7,7 @@ export { looseToNumber } from '@vue/shared';
|
|
|
7
7
|
export declare function compare<T>(value?: T, currentValue?: T, comparator?: string | ((a: T, b: T) => boolean)): boolean;
|
|
8
8
|
export declare function isEmpty(value: unknown): boolean;
|
|
9
9
|
export declare function getDisplayValue<T extends Array<any>, V>(items: T, value: Nullable<V>, options?: {
|
|
10
|
-
valueKey?: GetItemKeys<T
|
|
11
|
-
labelKey?: GetItemKeys<T
|
|
10
|
+
valueKey?: MaybeNull<GetItemKeys<T>>;
|
|
11
|
+
labelKey?: MaybeNull<GetItemKeys<T>>;
|
|
12
12
|
}): string | undefined;
|
|
13
13
|
export declare function isArrayOfArray<T>(item: T[] | T[][]): item is T[][];
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { LinkProps } from '../types';
|
|
2
|
+
export declare const linkKeys: readonly ["active", "activeClass", "ariaCurrentValue", "as", "disabled", "download", "exact", "exactActiveClass", "exactHash", "exactQuery", "external", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "href", "hreflang", "inactiveClass", "media", "noPrefetch", "noRel", "onClick", "ping", "prefetch", "prefetchOn", "prefetchedClass", "referrerpolicy", "rel", "replace", "target", "title", "to", "trailingSlash", "type", "viewTransition"];
|
|
2
3
|
export declare function pickLinkProps(link: LinkProps & {
|
|
3
4
|
[key: string]: any;
|
|
4
5
|
}): import("@vueuse/core").ReactivePickReturn<LinkProps & {
|
|
5
6
|
[key: string]: any;
|
|
6
|
-
}, "
|
|
7
|
+
}, "replace" | "disabled" | "title" | "active" | "to" | "type" | "activeClass" | "ariaCurrentValue" | "as" | "download" | "exact" | "exactActiveClass" | "exactHash" | "exactQuery" | "external" | "form" | "formaction" | "formenctype" | "formmethod" | "formnovalidate" | "formtarget" | "href" | "hreflang" | "inactiveClass" | "media" | "noPrefetch" | "noRel" | "onClick" | "ping" | "prefetch" | "prefetchOn" | "prefetchedClass" | "referrerpolicy" | "rel" | "target" | "trailingSlash" | "viewTransition" | `aria-${string}` | `data-${string}`>;
|
|
7
8
|
export declare function isPartiallyEqual(item1: any, item2: any): boolean;
|
|
@@ -1,40 +1,51 @@
|
|
|
1
1
|
import { reactivePick } from "@vueuse/core";
|
|
2
2
|
import { diff, isEqual } from "ohash/utils";
|
|
3
|
+
export const linkKeys = [
|
|
4
|
+
"active",
|
|
5
|
+
"activeClass",
|
|
6
|
+
"ariaCurrentValue",
|
|
7
|
+
"as",
|
|
8
|
+
"disabled",
|
|
9
|
+
"download",
|
|
10
|
+
"exact",
|
|
11
|
+
"exactActiveClass",
|
|
12
|
+
"exactHash",
|
|
13
|
+
"exactQuery",
|
|
14
|
+
"external",
|
|
15
|
+
"form",
|
|
16
|
+
"formaction",
|
|
17
|
+
"formenctype",
|
|
18
|
+
"formmethod",
|
|
19
|
+
"formnovalidate",
|
|
20
|
+
"formtarget",
|
|
21
|
+
"href",
|
|
22
|
+
"hreflang",
|
|
23
|
+
"inactiveClass",
|
|
24
|
+
"media",
|
|
25
|
+
"noPrefetch",
|
|
26
|
+
"noRel",
|
|
27
|
+
"onClick",
|
|
28
|
+
"ping",
|
|
29
|
+
"prefetch",
|
|
30
|
+
"prefetchOn",
|
|
31
|
+
"prefetchedClass",
|
|
32
|
+
"referrerpolicy",
|
|
33
|
+
"rel",
|
|
34
|
+
"replace",
|
|
35
|
+
"target",
|
|
36
|
+
"title",
|
|
37
|
+
"to",
|
|
38
|
+
"trailingSlash",
|
|
39
|
+
"type",
|
|
40
|
+
"viewTransition"
|
|
41
|
+
];
|
|
3
42
|
export function pickLinkProps(link) {
|
|
4
43
|
const keys = Object.keys(link);
|
|
5
44
|
const ariaKeys = keys.filter((key) => key.startsWith("aria-"));
|
|
6
45
|
const dataKeys = keys.filter((key) => key.startsWith("data-"));
|
|
7
|
-
const pickProps = [
|
|
8
|
-
"active",
|
|
9
|
-
"activeClass",
|
|
10
|
-
"ariaCurrentValue",
|
|
11
|
-
"as",
|
|
12
|
-
"disabled",
|
|
13
|
-
"exact",
|
|
14
|
-
"exactActiveClass",
|
|
15
|
-
"exactHash",
|
|
16
|
-
"exactQuery",
|
|
17
|
-
"external",
|
|
18
|
-
"href",
|
|
19
|
-
"download",
|
|
20
|
-
"inactiveClass",
|
|
21
|
-
"noPrefetch",
|
|
22
|
-
"noRel",
|
|
23
|
-
"prefetch",
|
|
24
|
-
"prefetchedClass",
|
|
25
|
-
"rel",
|
|
26
|
-
"replace",
|
|
27
|
-
"target",
|
|
28
|
-
"to",
|
|
29
|
-
"type",
|
|
30
|
-
"title",
|
|
31
|
-
"onClick",
|
|
32
|
-
"title",
|
|
33
|
-
"onClick"
|
|
34
|
-
];
|
|
35
46
|
return reactivePick(
|
|
36
47
|
link,
|
|
37
|
-
...
|
|
48
|
+
...linkKeys,
|
|
38
49
|
...ariaKeys,
|
|
39
50
|
...dataKeys
|
|
40
51
|
);
|
|
@@ -10,6 +10,6 @@ const props = defineProps({
|
|
|
10
10
|
</script>
|
|
11
11
|
|
|
12
12
|
<template>
|
|
13
|
-
<IconifyIcon v-if="typeof props.name === 'string'" :icon="props.name.replace(/^i-/, '')" />
|
|
14
|
-
<component :is="props.name" v-else />
|
|
13
|
+
<IconifyIcon v-if="typeof props.name === 'string'" :icon="props.name.replace(/^i-/, '')" />
|
|
14
|
+
<component :is="props.name" v-else />
|
|
15
15
|
</template>
|
|
@@ -2,6 +2,6 @@ import type { IconProps as NuxtIconProps } from '../../types';
|
|
|
2
2
|
export interface IconProps {
|
|
3
3
|
name: NuxtIconProps['name'];
|
|
4
4
|
}
|
|
5
|
-
declare const __VLS_export: import("vue").DefineComponent<IconProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<IconProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
5
|
declare const _default: typeof __VLS_export;
|
|
7
6
|
export default _default;
|
|
7
|
+
declare const __VLS_export: import("vue").DefineComponent<IconProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<IconProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -16,6 +16,10 @@ import { cv, merge } from "../../utils/style";
|
|
|
16
16
|
defineOptions({ inheritAttrs: false });
|
|
17
17
|
const props = defineProps({
|
|
18
18
|
as: { type: null, required: false, default: "button" },
|
|
19
|
+
href: { type: null, required: false },
|
|
20
|
+
external: { type: Boolean, required: false },
|
|
21
|
+
target: { type: [String, Object, null], required: false },
|
|
22
|
+
rel: { type: [String, Object, null], required: false },
|
|
19
23
|
type: { type: null, required: false, default: "button" },
|
|
20
24
|
label: { type: String, required: false },
|
|
21
25
|
disabled: { type: Boolean, required: false },
|
|
@@ -27,20 +31,11 @@ const props = defineProps({
|
|
|
27
31
|
custom: { type: Boolean, required: false },
|
|
28
32
|
raw: { type: Boolean, required: false },
|
|
29
33
|
class: { type: [Object, String, Number, Boolean, null, Array], required: false, skipCheck: true },
|
|
30
|
-
to: { type: null, required: false },
|
|
31
|
-
href: { type: null, required: false },
|
|
32
|
-
external: { type: Boolean, required: false },
|
|
33
|
-
target: { type: [String, Object], required: false },
|
|
34
|
-
rel: { type: [String, Object], required: false },
|
|
35
|
-
noRel: { type: Boolean, required: false },
|
|
36
|
-
prefetchedClass: { type: String, required: false },
|
|
37
|
-
prefetch: { type: Boolean, required: false },
|
|
38
|
-
prefetchOn: { type: [String, Object], required: false },
|
|
39
|
-
noPrefetch: { type: Boolean, required: false },
|
|
40
34
|
activeClass: { type: String, required: false },
|
|
41
35
|
exactActiveClass: { type: String, required: false },
|
|
42
36
|
ariaCurrentValue: { type: String, required: false, default: "page" },
|
|
43
37
|
viewTransition: { type: Boolean, required: false },
|
|
38
|
+
to: { type: null, required: true },
|
|
44
39
|
replace: { type: Boolean, required: false }
|
|
45
40
|
});
|
|
46
41
|
defineSlots();
|
|
@@ -137,7 +132,7 @@ function resolveLinkClass({ route: route2, isActive, isExactActive } = {}) {
|
|
|
137
132
|
...inheritProps,
|
|
138
133
|
href: to,
|
|
139
134
|
target: isExternal ? '_blank' : void 0,
|
|
140
|
-
active,
|
|
135
|
+
active: active ?? false,
|
|
141
136
|
isExternal
|
|
142
137
|
}"
|
|
143
138
|
>
|
|
@@ -155,7 +150,7 @@ function resolveLinkClass({ route: route2, isActive, isExactActive } = {}) {
|
|
|
155
150
|
}"
|
|
156
151
|
:class="resolveLinkClass()"
|
|
157
152
|
>
|
|
158
|
-
<slot :active="active">
|
|
153
|
+
<slot :active="active ?? false">
|
|
159
154
|
{{ props.label }}
|
|
160
155
|
</slot>
|
|
161
156
|
</LinkBase>
|