@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,83 @@
|
|
|
1
|
+
import type { VariantProps } from '@byyuurin/ui-kit';
|
|
2
|
+
import type { StepperRootEmits, StepperRootProps } from 'reka-ui';
|
|
3
|
+
import theme from '#build/ui/stepper';
|
|
4
|
+
import type { ComponentBaseProps, ComponentUIProps, IconProps } from '../types';
|
|
5
|
+
import type { DynamicSlots, StaticSlot } from '../types/utils';
|
|
6
|
+
export interface StepperItem extends ComponentBaseProps {
|
|
7
|
+
slot?: string;
|
|
8
|
+
value?: string | number;
|
|
9
|
+
title?: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
icon?: IconProps['name'];
|
|
12
|
+
content?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
ui?: Pick<ComponentUIProps<typeof theme>, 'item' | 'container' | 'trigger' | 'indicator' | 'icon' | 'separator' | 'wrapper' | 'title' | 'description'>;
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}
|
|
17
|
+
type ThemeVariants = VariantProps<typeof theme>;
|
|
18
|
+
export interface StepperProps<T extends StepperItem = StepperItem> extends ComponentBaseProps, Pick<StepperRootProps, 'linear'> {
|
|
19
|
+
/**
|
|
20
|
+
* The element or component this component should render as.
|
|
21
|
+
* @default "div"
|
|
22
|
+
*/
|
|
23
|
+
as?: StepperRootProps['as'];
|
|
24
|
+
items?: T[];
|
|
25
|
+
/** @default "md" */
|
|
26
|
+
size?: ThemeVariants['size'];
|
|
27
|
+
/** @default "primary" */
|
|
28
|
+
color?: ThemeVariants['color'];
|
|
29
|
+
/** @default "horizontal" */
|
|
30
|
+
orientation?: ThemeVariants['orientation'];
|
|
31
|
+
defaultValue?: string | number;
|
|
32
|
+
modelValue?: string | number;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
ui?: ComponentUIProps<typeof theme>;
|
|
35
|
+
}
|
|
36
|
+
export type StepperEmits<T extends StepperItem = StepperItem> = Omit<StepperRootEmits, 'update:modelValue'> & {
|
|
37
|
+
next: [value: T];
|
|
38
|
+
prev: [value: T];
|
|
39
|
+
};
|
|
40
|
+
export type StepperSlots<T extends StepperItem = StepperItem> = {
|
|
41
|
+
indicator: StaticSlot<{
|
|
42
|
+
item: T;
|
|
43
|
+
ui: ComponentUIProps<typeof theme>;
|
|
44
|
+
}>;
|
|
45
|
+
title: StaticSlot<{
|
|
46
|
+
item: T;
|
|
47
|
+
}>;
|
|
48
|
+
description: StaticSlot<{
|
|
49
|
+
item: T;
|
|
50
|
+
}>;
|
|
51
|
+
content: StaticSlot<{
|
|
52
|
+
item: T;
|
|
53
|
+
}>;
|
|
54
|
+
} & DynamicSlots<T>;
|
|
55
|
+
declare const _default: typeof __VLS_export;
|
|
56
|
+
export default _default;
|
|
57
|
+
declare const __VLS_export: <T extends StepperItem>(__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<{
|
|
58
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<(StepperProps<T> & {
|
|
59
|
+
modelValue?: string | number;
|
|
60
|
+
}) & {
|
|
61
|
+
onPrev?: ((value: T) => any) | undefined;
|
|
62
|
+
onNext?: ((value: T) => any) | undefined;
|
|
63
|
+
"onUpdate:modelValue"?: ((value: string | number | undefined) => any) | undefined;
|
|
64
|
+
}> & (typeof globalThis extends {
|
|
65
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
66
|
+
} ? P : {});
|
|
67
|
+
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
68
|
+
next(): void;
|
|
69
|
+
prev(): void;
|
|
70
|
+
hasNext: import("vue").ComputedRef<boolean>;
|
|
71
|
+
hasPrev: import("vue").ComputedRef<boolean>;
|
|
72
|
+
}>) => void;
|
|
73
|
+
attrs: any;
|
|
74
|
+
slots: StepperSlots<T>;
|
|
75
|
+
emit: (((evt: "prev", value: T) => void) & ((evt: "next", value: T) => void)) & ((evt: "update:modelValue", value: string | number | undefined) => void);
|
|
76
|
+
}>) => import("vue").VNode & {
|
|
77
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
78
|
+
};
|
|
79
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
80
|
+
[K in keyof T]: T[K];
|
|
81
|
+
} : {
|
|
82
|
+
[K in keyof T as K]: T[K];
|
|
83
|
+
}) & {};
|
|
@@ -58,34 +58,34 @@ function onUpdate(value) {
|
|
|
58
58
|
</script>
|
|
59
59
|
|
|
60
60
|
<template>
|
|
61
|
-
<Primitive :as="props.as" :class="ui.root({ class: [props.ui?.root, props.class] })" data-part="root">
|
|
62
|
-
<div :class="ui.container({ class: props.ui?.container })" data-part="container">
|
|
63
|
-
<SwitchRoot
|
|
64
|
-
v-bind="{ id, ...rootProps, ...ariaAttrs, name }"
|
|
65
|
-
v-model="modelValue"
|
|
66
|
-
:disabled="disabled || props.loading"
|
|
67
|
-
:class="ui.base({ class: props.ui?.base })"
|
|
68
|
-
data-part="base"
|
|
69
|
-
@update:model-value="onUpdate"
|
|
70
|
-
>
|
|
71
|
-
<SwitchThumb :class="ui.thumb({ class: props.ui?.thumb })" data-part="thumb">
|
|
72
|
-
<Icon v-if="props.loading" :name="props.loadingIcon || appConfig.ui.icons.loading" :class="ui.icon({ class: props.ui?.icon, checked: true, unchecked: true })" data-part="icon" />
|
|
73
|
-
<template v-else>
|
|
74
|
-
<Icon v-if="props.checkedIcon" :name="props.checkedIcon" :class="ui.icon({ class: props.ui?.icon, checked: true })" data-part="icon" />
|
|
75
|
-
<Icon v-if="props.uncheckedIcon" :name="props.uncheckedIcon" :class="ui.icon({ class: props.ui?.icon, unchecked: true })" data-part="icon" />
|
|
76
|
-
</template>
|
|
77
|
-
</SwitchThumb>
|
|
78
|
-
</SwitchRoot>
|
|
79
|
-
</div>
|
|
80
|
-
<div v-if="props.label || !!slots.label || (props.description || !!slots.description)" :class="ui.wrapper({ class: props.ui?.wrapper })" data-part="wrapper">
|
|
81
|
-
<Label v-if="props.label || !!slots.label" :for="id" :class="ui.label({ class: props.ui?.label })" data-part="label">
|
|
82
|
-
<slot name="label" :label="props.label">{{ props.label }}</slot>
|
|
83
|
-
</Label>
|
|
84
|
-
<p v-if="props.description || !!slots.description" :class="ui.description({ class: props.ui?.description })" data-part="description">
|
|
85
|
-
<slot name="description" :description="props.description">
|
|
86
|
-
{{ props.description }}
|
|
87
|
-
</slot>
|
|
88
|
-
</p>
|
|
89
|
-
</div>
|
|
90
|
-
</Primitive>
|
|
61
|
+
<Primitive :as="props.as" :class="ui.root({ class: [props.ui?.root, props.class] })" data-part="root">
|
|
62
|
+
<div :class="ui.container({ class: props.ui?.container })" data-part="container">
|
|
63
|
+
<SwitchRoot
|
|
64
|
+
v-bind="{ id, ...rootProps, ...ariaAttrs, name }"
|
|
65
|
+
v-model="modelValue"
|
|
66
|
+
:disabled="disabled || props.loading"
|
|
67
|
+
:class="ui.base({ class: props.ui?.base })"
|
|
68
|
+
data-part="base"
|
|
69
|
+
@update:model-value="onUpdate"
|
|
70
|
+
>
|
|
71
|
+
<SwitchThumb :class="ui.thumb({ class: props.ui?.thumb })" data-part="thumb">
|
|
72
|
+
<Icon v-if="props.loading" :name="props.loadingIcon || appConfig.ui.icons.loading" :class="ui.icon({ class: props.ui?.icon, checked: true, unchecked: true })" data-part="icon" />
|
|
73
|
+
<template v-else>
|
|
74
|
+
<Icon v-if="props.checkedIcon" :name="props.checkedIcon" :class="ui.icon({ class: props.ui?.icon, checked: true })" data-part="icon" />
|
|
75
|
+
<Icon v-if="props.uncheckedIcon" :name="props.uncheckedIcon" :class="ui.icon({ class: props.ui?.icon, unchecked: true })" data-part="icon" />
|
|
76
|
+
</template>
|
|
77
|
+
</SwitchThumb>
|
|
78
|
+
</SwitchRoot>
|
|
79
|
+
</div>
|
|
80
|
+
<div v-if="props.label || !!slots.label || (props.description || !!slots.description)" :class="ui.wrapper({ class: props.ui?.wrapper })" data-part="wrapper">
|
|
81
|
+
<Label v-if="props.label || !!slots.label" :for="id" :class="ui.label({ class: props.ui?.label })" data-part="label">
|
|
82
|
+
<slot name="label" :label="props.label">{{ props.label }}</slot>
|
|
83
|
+
</Label>
|
|
84
|
+
<p v-if="props.description || !!slots.description" :class="ui.description({ class: props.ui?.description })" data-part="description">
|
|
85
|
+
<slot name="description" :description="props.description">
|
|
86
|
+
{{ props.description }}
|
|
87
|
+
</slot>
|
|
88
|
+
</p>
|
|
89
|
+
</div>
|
|
90
|
+
</Primitive>
|
|
91
91
|
</template>
|
|
@@ -2,9 +2,10 @@ import type { VariantProps } from '@byyuurin/ui-kit';
|
|
|
2
2
|
import type { SwitchRootProps } from 'reka-ui';
|
|
3
3
|
import theme from '#build/ui/switch';
|
|
4
4
|
import type { ComponentBaseProps, ComponentUIProps, IconProps } from '../types';
|
|
5
|
+
import type { ButtonHTMLAttributes } from '../types/html';
|
|
5
6
|
import type { StaticSlot } from '../types/utils';
|
|
6
7
|
type ThemeVariants = VariantProps<typeof theme>;
|
|
7
|
-
export interface SwitchProps extends ComponentBaseProps, Pick<SwitchRootProps, 'disabled' | 'id' | 'name' | 'required' | 'value' | 'defaultValue'> {
|
|
8
|
+
export interface SwitchProps extends ComponentBaseProps, Pick<SwitchRootProps, 'disabled' | 'id' | 'name' | 'required' | 'value' | 'defaultValue'>, /** @vue-ignore */ Omit<ButtonHTMLAttributes, 'type' | 'disabled' | 'value' | 'name'> {
|
|
8
9
|
/**
|
|
9
10
|
* The element or component this component should render as.
|
|
10
11
|
* @default "div"
|
|
@@ -42,6 +43,8 @@ export interface SwitchSlots {
|
|
|
42
43
|
description?: string;
|
|
43
44
|
}>;
|
|
44
45
|
}
|
|
46
|
+
declare const _default: typeof __VLS_export;
|
|
47
|
+
export default _default;
|
|
45
48
|
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<SwitchProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
46
49
|
change: (event: Event) => any;
|
|
47
50
|
"update:modelValue": (value: boolean) => any;
|
|
@@ -49,8 +52,6 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<Switch
|
|
|
49
52
|
onChange?: ((event: Event) => any) | undefined;
|
|
50
53
|
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
51
54
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, SwitchSlots>;
|
|
52
|
-
declare const _default: typeof __VLS_export;
|
|
53
|
-
export default _default;
|
|
54
55
|
type __VLS_WithSlots<T, S> = T & {
|
|
55
56
|
new (): {
|
|
56
57
|
$slots: S;
|
|
@@ -297,178 +297,178 @@ defineExpose({
|
|
|
297
297
|
</script>
|
|
298
298
|
|
|
299
299
|
<template>
|
|
300
|
-
<DefineRowTemplate v-slot="{ row, style }">
|
|
301
|
-
<tr
|
|
302
|
-
:role="props.onSelect ? 'button' : void 0"
|
|
303
|
-
:tabindex="props.onSelect ? 0 : void 0"
|
|
300
|
+
<DefineRowTemplate v-slot="{ row, style }">
|
|
301
|
+
<tr
|
|
302
|
+
:role="props.onSelect ? 'button' : void 0"
|
|
303
|
+
:tabindex="props.onSelect ? 0 : void 0"
|
|
304
304
|
:class="ui.tr({
|
|
305
305
|
class: [
|
|
306
306
|
props.ui?.tr,
|
|
307
307
|
resolveValue(tableApi.options.meta?.class?.tr, row)
|
|
308
308
|
]
|
|
309
|
-
})"
|
|
310
|
-
:data-selected="row.getIsSelected()"
|
|
311
|
-
:data-selectable="!!props.onSelect || !!props.onHover || !!props.onContextmenu"
|
|
312
|
-
:data-expanded="row.getIsExpanded()"
|
|
313
|
-
data-part="tr"
|
|
314
|
-
:style="[resolveValue(tableApi.options.meta?.style?.tr, row), style]"
|
|
315
|
-
@click="onRowSelect($event, row)"
|
|
316
|
-
@pointerenter="onRowHover($event, row)"
|
|
317
|
-
@pointerleave="onRowHover($event, null)"
|
|
318
|
-
@contextmenu="onRowContextmenu($event, row)"
|
|
319
|
-
>
|
|
320
|
-
<td
|
|
321
|
-
v-for="cell in row.getVisibleCells()"
|
|
322
|
-
:key="cell.id"
|
|
323
|
-
:colspan="resolveValue(cell.column.columnDef.meta?.colspan?.td, cell)"
|
|
324
|
-
:rowspan="resolveValue(cell.column.columnDef.meta?.rowspan?.td, cell)"
|
|
309
|
+
})"
|
|
310
|
+
:data-selected="row.getIsSelected()"
|
|
311
|
+
:data-selectable="!!props.onSelect || !!props.onHover || !!props.onContextmenu"
|
|
312
|
+
:data-expanded="row.getIsExpanded()"
|
|
313
|
+
data-part="tr"
|
|
314
|
+
:style="[resolveValue(tableApi.options.meta?.style?.tr, row), style]"
|
|
315
|
+
@click="onRowSelect($event, row)"
|
|
316
|
+
@pointerenter="onRowHover($event, row)"
|
|
317
|
+
@pointerleave="onRowHover($event, null)"
|
|
318
|
+
@contextmenu="onRowContextmenu($event, row)"
|
|
319
|
+
>
|
|
320
|
+
<td
|
|
321
|
+
v-for="cell in row.getVisibleCells()"
|
|
322
|
+
:key="cell.id"
|
|
323
|
+
:colspan="resolveValue(cell.column.columnDef.meta?.colspan?.td, cell)"
|
|
324
|
+
:rowspan="resolveValue(cell.column.columnDef.meta?.rowspan?.td, cell)"
|
|
325
325
|
:class="ui.td({
|
|
326
326
|
class: [
|
|
327
327
|
props.ui?.td,
|
|
328
328
|
resolveValue(cell.column.columnDef.meta?.class?.td, cell)
|
|
329
329
|
],
|
|
330
330
|
pinned: !!cell.column.getIsPinned()
|
|
331
|
-
})"
|
|
332
|
-
:data-pinned="cell.column.getIsPinned()"
|
|
333
|
-
data-part="td"
|
|
331
|
+
})"
|
|
332
|
+
:data-pinned="cell.column.getIsPinned()"
|
|
333
|
+
data-part="td"
|
|
334
334
|
:style="[
|
|
335
335
|
getColumnStyles(cell.column),
|
|
336
336
|
resolveValue(cell.column.columnDef.meta?.style?.td, cell)
|
|
337
|
-
]"
|
|
338
|
-
>
|
|
339
|
-
<slot :name="`${cell.column.id}-cell`" v-bind="cell.getContext()">
|
|
340
|
-
<FlexRender :render="cell.column.columnDef.cell" :props="cell.getContext()" />
|
|
341
|
-
</slot>
|
|
342
|
-
</td>
|
|
343
|
-
</tr>
|
|
344
|
-
|
|
345
|
-
<tr v-if="row.getIsExpanded()" :class="ui.tr({ class: props.ui?.tr })" data-part="tr">
|
|
346
|
-
<td :colspan="row.getAllCells().length" :class="ui.td({ class: props.ui?.td })" data-part="td">
|
|
347
|
-
<slot name="expanded" :row="row"></slot>
|
|
348
|
-
</td>
|
|
349
|
-
</tr>
|
|
350
|
-
</DefineRowTemplate>
|
|
351
|
-
|
|
352
|
-
<DefineTableTemplate>
|
|
353
|
-
<table ref="tableRef" :class="ui.base({ class: props.ui?.base })" data-part="base">
|
|
354
|
-
<caption v-if="caption || !!slots.caption" :class="ui.caption({ class: [props.ui?.caption] })" data-part="caption">
|
|
355
|
-
<slot name="caption">
|
|
356
|
-
{{ caption }}
|
|
357
|
-
</slot>
|
|
358
|
-
</caption>
|
|
359
|
-
|
|
360
|
-
<thead :class="ui.thead({ class: [props.ui?.thead] })" data-part="thead">
|
|
361
|
-
<tr v-for="headerGroup in tableApi.getHeaderGroups()" :key="headerGroup.id" :class="ui.tr({ class: [props.ui?.tr] })" data-part="tr">
|
|
362
|
-
<th
|
|
363
|
-
v-for="header in headerGroup.headers"
|
|
364
|
-
:key="header.id"
|
|
365
|
-
:data-pinned="header.column.getIsPinned()"
|
|
366
|
-
:scope="header.colSpan > 1 ? 'colgroup' : 'col'"
|
|
367
|
-
:colspan="header.colSpan > 1 ? header.colSpan : void 0"
|
|
368
|
-
:rowspan="header.rowSpan > 1 ? header.rowSpan : void 0"
|
|
337
|
+
]"
|
|
338
|
+
>
|
|
339
|
+
<slot :name="`${cell.column.id}-cell`" v-bind="cell.getContext()">
|
|
340
|
+
<FlexRender :render="cell.column.columnDef.cell" :props="cell.getContext()" />
|
|
341
|
+
</slot>
|
|
342
|
+
</td>
|
|
343
|
+
</tr>
|
|
344
|
+
|
|
345
|
+
<tr v-if="row.getIsExpanded()" :class="ui.tr({ class: props.ui?.tr })" data-part="tr">
|
|
346
|
+
<td :colspan="row.getAllCells().length" :class="ui.td({ class: props.ui?.td })" data-part="td">
|
|
347
|
+
<slot name="expanded" :row="row"></slot>
|
|
348
|
+
</td>
|
|
349
|
+
</tr>
|
|
350
|
+
</DefineRowTemplate>
|
|
351
|
+
|
|
352
|
+
<DefineTableTemplate>
|
|
353
|
+
<table ref="tableRef" :class="ui.base({ class: props.ui?.base })" data-part="base">
|
|
354
|
+
<caption v-if="caption || !!slots.caption" :class="ui.caption({ class: [props.ui?.caption] })" data-part="caption">
|
|
355
|
+
<slot name="caption">
|
|
356
|
+
{{ caption }}
|
|
357
|
+
</slot>
|
|
358
|
+
</caption>
|
|
359
|
+
|
|
360
|
+
<thead :class="ui.thead({ class: [props.ui?.thead] })" data-part="thead">
|
|
361
|
+
<tr v-for="headerGroup in tableApi.getHeaderGroups()" :key="headerGroup.id" :class="ui.tr({ class: [props.ui?.tr] })" data-part="tr">
|
|
362
|
+
<th
|
|
363
|
+
v-for="header in headerGroup.headers"
|
|
364
|
+
:key="header.id"
|
|
365
|
+
:data-pinned="header.column.getIsPinned()"
|
|
366
|
+
:scope="header.colSpan > 1 ? 'colgroup' : 'col'"
|
|
367
|
+
:colspan="header.colSpan > 1 ? header.colSpan : void 0"
|
|
368
|
+
:rowspan="header.rowSpan > 1 ? header.rowSpan : void 0"
|
|
369
369
|
:class="ui.th({
|
|
370
370
|
class: [
|
|
371
371
|
props.ui?.th,
|
|
372
372
|
resolveValue(header.column.columnDef.meta?.class?.th, header)
|
|
373
373
|
],
|
|
374
374
|
pinned: !!header.column.getIsPinned()
|
|
375
|
-
})"
|
|
376
|
-
data-part="th"
|
|
375
|
+
})"
|
|
376
|
+
data-part="th"
|
|
377
377
|
:style="[
|
|
378
378
|
getColumnStyles(header.column),
|
|
379
379
|
resolveValue(header.column.columnDef.meta?.style?.th, header)
|
|
380
|
-
]"
|
|
381
|
-
>
|
|
382
|
-
<slot :name="`${header.id}-header`" v-bind="header.getContext()">
|
|
383
|
-
<FlexRender v-if="!header.isPlaceholder" :render="header.column.columnDef.header" :props="header.getContext()" />
|
|
384
|
-
</slot>
|
|
385
|
-
</th>
|
|
386
|
-
</tr>
|
|
387
|
-
|
|
388
|
-
<tr :class="ui.separator({ class: [props.ui?.separator] })" data-part="separator"></tr>
|
|
389
|
-
</thead>
|
|
390
|
-
|
|
391
|
-
<tbody :class="ui.tbody({ class: [props.ui?.tbody] })" data-part="tbody">
|
|
392
|
-
<slot name="body-top"></slot>
|
|
393
|
-
|
|
394
|
-
<template v-if="rows.length">
|
|
395
|
-
<template v-if="virtualizer">
|
|
396
|
-
<template v-for="(virtualRow, index) in virtualizer.getVirtualItems()" :key="rows[virtualRow.index]?.id">
|
|
397
|
-
<ReuseRowTemplate
|
|
398
|
-
:row="rows[virtualRow.index]"
|
|
380
|
+
]"
|
|
381
|
+
>
|
|
382
|
+
<slot :name="`${header.id}-header`" v-bind="header.getContext()">
|
|
383
|
+
<FlexRender v-if="!header.isPlaceholder" :render="header.column.columnDef.header" :props="header.getContext()" />
|
|
384
|
+
</slot>
|
|
385
|
+
</th>
|
|
386
|
+
</tr>
|
|
387
|
+
|
|
388
|
+
<tr :class="ui.separator({ class: [props.ui?.separator] })" data-part="separator"></tr>
|
|
389
|
+
</thead>
|
|
390
|
+
|
|
391
|
+
<tbody :class="ui.tbody({ class: [props.ui?.tbody] })" data-part="tbody">
|
|
392
|
+
<slot name="body-top"></slot>
|
|
393
|
+
|
|
394
|
+
<template v-if="rows.length">
|
|
395
|
+
<template v-if="virtualizer">
|
|
396
|
+
<template v-for="(virtualRow, index) in virtualizer.getVirtualItems()" :key="rows[virtualRow.index]?.id">
|
|
397
|
+
<ReuseRowTemplate
|
|
398
|
+
:row="rows[virtualRow.index]"
|
|
399
399
|
:style="{
|
|
400
400
|
height: `${virtualRow.size}px`,
|
|
401
401
|
transform: `translateY(${virtualRow.start - index * virtualRow.size}px)`
|
|
402
|
-
}"
|
|
403
|
-
/>
|
|
404
|
-
</template>
|
|
405
|
-
</template>
|
|
406
|
-
|
|
407
|
-
<template v-else>
|
|
408
|
-
<ReuseRowTemplate v-for="row in rows" :key="row.id" :row="row" />
|
|
409
|
-
</template>
|
|
410
|
-
</template>
|
|
411
|
-
|
|
412
|
-
<tr v-else-if="props.loading && !!slots.loading">
|
|
413
|
-
<td :colspan="tableApi.getAllLeafColumns().length" :class="ui.loading({ class: props.ui?.loading })" data-part="loading">
|
|
414
|
-
<slot name="loading"></slot>
|
|
415
|
-
</td>
|
|
416
|
-
</tr>
|
|
417
|
-
|
|
418
|
-
<tr v-else>
|
|
419
|
-
<td :colspan="tableApi.getAllLeafColumns().length" :class="ui.empty({ class: props.ui?.empty })" data-part="empty">
|
|
420
|
-
<slot name="empty">
|
|
421
|
-
{{ props.empty || t("table.noData") }}
|
|
422
|
-
</slot>
|
|
423
|
-
</td>
|
|
424
|
-
</tr>
|
|
425
|
-
|
|
426
|
-
<slot name="body-bottom"></slot>
|
|
427
|
-
</tbody>
|
|
428
|
-
|
|
429
|
-
<tfoot
|
|
430
|
-
v-if="hasFooter"
|
|
431
|
-
:class="ui.tfoot({ class: props.ui?.tfoot })"
|
|
432
|
-
data-part="tfoot"
|
|
402
|
+
}"
|
|
403
|
+
/>
|
|
404
|
+
</template>
|
|
405
|
+
</template>
|
|
406
|
+
|
|
407
|
+
<template v-else>
|
|
408
|
+
<ReuseRowTemplate v-for="row in rows" :key="row.id" :row="row" />
|
|
409
|
+
</template>
|
|
410
|
+
</template>
|
|
411
|
+
|
|
412
|
+
<tr v-else-if="props.loading && !!slots.loading">
|
|
413
|
+
<td :colspan="tableApi.getAllLeafColumns().length" :class="ui.loading({ class: props.ui?.loading })" data-part="loading">
|
|
414
|
+
<slot name="loading"></slot>
|
|
415
|
+
</td>
|
|
416
|
+
</tr>
|
|
417
|
+
|
|
418
|
+
<tr v-else>
|
|
419
|
+
<td :colspan="tableApi.getAllLeafColumns().length" :class="ui.empty({ class: props.ui?.empty })" data-part="empty">
|
|
420
|
+
<slot name="empty">
|
|
421
|
+
{{ props.empty || t("table.noData") }}
|
|
422
|
+
</slot>
|
|
423
|
+
</td>
|
|
424
|
+
</tr>
|
|
425
|
+
|
|
426
|
+
<slot name="body-bottom"></slot>
|
|
427
|
+
</tbody>
|
|
428
|
+
|
|
429
|
+
<tfoot
|
|
430
|
+
v-if="hasFooter"
|
|
431
|
+
:class="ui.tfoot({ class: props.ui?.tfoot })"
|
|
432
|
+
data-part="tfoot"
|
|
433
433
|
:style="virtualizer ? {
|
|
434
434
|
transform: `translateY(${virtualizer.getTotalSize() - virtualizer.getVirtualItems().length * virtualizerProps.estimateSize}px)`
|
|
435
|
-
} : void 0"
|
|
436
|
-
>
|
|
437
|
-
<tr :class="ui.separator({ class: props.ui?.separator })" data-part="separator"></tr>
|
|
438
|
-
|
|
439
|
-
<tr v-for="footerGroup in tableApi.getFooterGroups()" :key="footerGroup.id" :class="ui.tr({ class: props.ui?.tr })" data-part="tr">
|
|
440
|
-
<th
|
|
441
|
-
v-for="header in footerGroup.headers"
|
|
442
|
-
:key="header.id"
|
|
443
|
-
:data-pinned="header.column.getIsPinned()"
|
|
444
|
-
:colspan="header.colSpan > 1 ? header.colSpan : void 0"
|
|
445
|
-
:rowspan="header.rowSpan > 1 ? header.rowSpan : void 0"
|
|
435
|
+
} : void 0"
|
|
436
|
+
>
|
|
437
|
+
<tr :class="ui.separator({ class: props.ui?.separator })" data-part="separator"></tr>
|
|
438
|
+
|
|
439
|
+
<tr v-for="footerGroup in tableApi.getFooterGroups()" :key="footerGroup.id" :class="ui.tr({ class: props.ui?.tr })" data-part="tr">
|
|
440
|
+
<th
|
|
441
|
+
v-for="header in footerGroup.headers"
|
|
442
|
+
:key="header.id"
|
|
443
|
+
:data-pinned="header.column.getIsPinned()"
|
|
444
|
+
:colspan="header.colSpan > 1 ? header.colSpan : void 0"
|
|
445
|
+
:rowspan="header.rowSpan > 1 ? header.rowSpan : void 0"
|
|
446
446
|
:class="ui.th({
|
|
447
447
|
class: [
|
|
448
448
|
props.ui?.th,
|
|
449
449
|
resolveValue(header.column.columnDef.meta?.class?.th, header)
|
|
450
450
|
],
|
|
451
451
|
pinned: !!header.column.getIsPinned()
|
|
452
|
-
})"
|
|
453
|
-
data-part="th"
|
|
452
|
+
})"
|
|
453
|
+
data-part="th"
|
|
454
454
|
:style="[
|
|
455
455
|
getColumnStyles(header.column),
|
|
456
456
|
resolveValue(header.column.columnDef.meta?.style?.th, header)
|
|
457
|
-
]"
|
|
458
|
-
>
|
|
459
|
-
<slot :name="`${header.id}-footer`" v-bind="header.getContext()">
|
|
460
|
-
<FlexRender v-if="!header.isPlaceholder" :render="header.column.columnDef.footer" :props="header.getContext()" />
|
|
461
|
-
</slot>
|
|
462
|
-
</th>
|
|
463
|
-
</tr>
|
|
464
|
-
</tfoot>
|
|
465
|
-
</table>
|
|
466
|
-
</DefineTableTemplate>
|
|
467
|
-
|
|
468
|
-
<Primitive ref="rootRef" :as="props.as" v-bind="$attrs" :class="ui.root({ class: [props.ui?.root, props.class] })" data-part="root">
|
|
469
|
-
<div v-if="virtualizer" :style="{ height: `${virtualizer.getTotalSize()}px` }">
|
|
470
|
-
<ReuseTableTemplate />
|
|
471
|
-
</div>
|
|
472
|
-
<ReuseTableTemplate v-else />
|
|
473
|
-
</Primitive>
|
|
457
|
+
]"
|
|
458
|
+
>
|
|
459
|
+
<slot :name="`${header.id}-footer`" v-bind="header.getContext()">
|
|
460
|
+
<FlexRender v-if="!header.isPlaceholder" :render="header.column.columnDef.footer" :props="header.getContext()" />
|
|
461
|
+
</slot>
|
|
462
|
+
</th>
|
|
463
|
+
</tr>
|
|
464
|
+
</tfoot>
|
|
465
|
+
</table>
|
|
466
|
+
</DefineTableTemplate>
|
|
467
|
+
|
|
468
|
+
<Primitive ref="rootRef" :as="props.as" v-bind="$attrs" :class="ui.root({ class: [props.ui?.root, props.class] })" data-part="root">
|
|
469
|
+
<div v-if="virtualizer" :style="{ height: `${virtualizer.getTotalSize()}px` }">
|
|
470
|
+
<ReuseTableTemplate />
|
|
471
|
+
</div>
|
|
472
|
+
<ReuseTableTemplate v-else />
|
|
473
|
+
</Primitive>
|
|
474
474
|
</template>
|
|
@@ -6,6 +6,7 @@ import type { PrimitiveProps } from 'reka-ui';
|
|
|
6
6
|
import type { WatchOptions } from 'vue';
|
|
7
7
|
import theme from '#build/ui/table';
|
|
8
8
|
import type { ComponentBaseProps, ComponentUIProps } from '../types';
|
|
9
|
+
import type { TableHTMLAttributes } from '../types/html';
|
|
9
10
|
import type { MaybeNull, StaticSlot } from '../types/utils';
|
|
10
11
|
declare module '@tanstack/table-core' {
|
|
11
12
|
interface ColumnMeta<TData extends RowData, TValue> {
|
|
@@ -42,7 +43,7 @@ export interface TableOptions<T extends TableData = TableData> extends Omit<Core
|
|
|
42
43
|
renderFallbackValue?: CoreOptions<T>['renderFallbackValue'];
|
|
43
44
|
}
|
|
44
45
|
type ThemeVariants = VariantProps<typeof theme>;
|
|
45
|
-
export interface TableProps<T extends TableData = TableData> extends ComponentBaseProps, TableOptions<T
|
|
46
|
+
export interface TableProps<T extends TableData = TableData> extends ComponentBaseProps, TableOptions<T>, /** @vue-ignore */ TableHTMLAttributes {
|
|
46
47
|
/**
|
|
47
48
|
* The element or component this component should render as.
|
|
48
49
|
* @default "div"
|
|
@@ -186,8 +187,10 @@ export type TableSlots<T> = {
|
|
|
186
187
|
'body-top': StaticSlot;
|
|
187
188
|
'body-bottom': StaticSlot;
|
|
188
189
|
} & DynamicHeaderSlots<T> & DynamicFooterSlots<T> & DynamicCellSlots<T>;
|
|
189
|
-
declare const
|
|
190
|
-
|
|
190
|
+
declare const _default: typeof __VLS_export;
|
|
191
|
+
export default _default;
|
|
192
|
+
declare const __VLS_export: <T extends TableData>(__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<{
|
|
193
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<(TableProps<T> & {
|
|
191
194
|
globalFilter?: string;
|
|
192
195
|
columnFilters?: ColumnFiltersState;
|
|
193
196
|
columnOrder?: ColumnOrderState;
|
|
@@ -215,7 +218,9 @@ declare const __VLS_export: <T extends TableData>(__VLS_props: NonNullable<Await
|
|
|
215
218
|
"onUpdate:grouping"?: ((value: GroupingState | undefined) => any) | undefined;
|
|
216
219
|
"onUpdate:expanded"?: ((value: ExpandedState | undefined) => any) | undefined;
|
|
217
220
|
"onUpdate:pagination"?: ((value: PaginationState | undefined) => any) | undefined;
|
|
218
|
-
}> &
|
|
221
|
+
}> & (typeof globalThis extends {
|
|
222
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
223
|
+
} ? P : {});
|
|
219
224
|
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
220
225
|
readonly $el: any;
|
|
221
226
|
tableRef: import("vue").ShallowRef<MaybeNull<HTMLTableElement>, MaybeNull<HTMLTableElement>>;
|
|
@@ -227,8 +232,8 @@ declare const __VLS_export: <T extends TableData>(__VLS_props: NonNullable<Await
|
|
|
227
232
|
}>) => import("vue").VNode & {
|
|
228
233
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
229
234
|
};
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
235
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
236
|
+
[K in keyof T]: T[K];
|
|
237
|
+
} : {
|
|
233
238
|
[K in keyof T as K]: T[K];
|
|
234
|
-
} & {};
|
|
239
|
+
}) & {};
|