@nuxt/ui 3.1.3 → 3.2.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/.nuxt/ui/avatar.ts +1 -1
- package/.nuxt/ui/card.ts +1 -1
- package/.nuxt/ui/carousel.ts +1 -1
- package/.nuxt/ui/command-palette.ts +1 -0
- package/.nuxt/ui/drawer.ts +1 -1
- package/.nuxt/ui/index.ts +2 -0
- package/.nuxt/ui/input-menu.ts +24 -10
- package/.nuxt/ui/input-tags.ts +310 -0
- package/.nuxt/ui/modal.ts +1 -1
- package/.nuxt/ui/navigation-menu.ts +1 -1
- package/.nuxt/ui/select-menu.ts +11 -6
- package/.nuxt/ui/select.ts +11 -6
- package/.nuxt/ui/table.ts +3 -2
- package/.nuxt/ui/timeline.ts +321 -0
- package/.nuxt/ui/toaster.ts +1 -1
- package/cli/templates.mjs +7 -4
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -2
- package/dist/runtime/components/Alert.vue +0 -1
- package/dist/runtime/components/Avatar.vue +10 -2
- package/dist/runtime/components/Avatar.vue.d.ts +2 -0
- package/dist/runtime/components/Calendar.vue +4 -1
- package/dist/runtime/components/Carousel.vue +1 -2
- package/dist/runtime/components/Checkbox.vue +1 -1
- package/dist/runtime/components/CommandPalette.vue +80 -16
- package/dist/runtime/components/CommandPalette.vue.d.ts +32 -8
- package/dist/runtime/components/ContextMenuContent.vue.d.ts +4 -20
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +4 -20
- package/dist/runtime/components/Form.vue +6 -6
- package/dist/runtime/components/Form.vue.d.ts +12 -11
- package/dist/runtime/components/InputMenu.vue.d.ts +4 -4
- package/dist/runtime/components/InputNumber.vue +3 -2
- package/dist/runtime/components/InputNumber.vue.d.ts +1 -1
- package/dist/runtime/components/InputTags.vue +159 -0
- package/dist/runtime/components/InputTags.vue.d.ts +183 -0
- package/dist/runtime/components/Modal.vue +14 -13
- package/dist/runtime/components/Modal.vue.d.ts +14 -4
- package/dist/runtime/components/NavigationMenu.vue +16 -15
- package/dist/runtime/components/OverlayProvider.vue +2 -2
- package/dist/runtime/components/Pagination.vue +1 -1
- package/dist/runtime/components/Pagination.vue.d.ts +0 -1
- package/dist/runtime/components/PinInput.vue +4 -3
- package/dist/runtime/components/PinInput.vue.d.ts +22 -19
- package/dist/runtime/components/Progress.vue +2 -1
- package/dist/runtime/components/Progress.vue.d.ts +1 -1
- package/dist/runtime/components/RadioGroup.vue +2 -2
- package/dist/runtime/components/Select.vue +23 -4
- package/dist/runtime/components/Select.vue.d.ts +107 -1
- package/dist/runtime/components/SelectMenu.vue +24 -5
- package/dist/runtime/components/SelectMenu.vue.d.ts +105 -1
- package/dist/runtime/components/Slideover.vue +14 -13
- package/dist/runtime/components/Slideover.vue.d.ts +14 -4
- package/dist/runtime/components/Table.vue +7 -1
- package/dist/runtime/components/Table.vue.d.ts +10 -8
- package/dist/runtime/components/Tabs.vue +13 -2
- package/dist/runtime/components/Tabs.vue.d.ts +4 -1
- package/dist/runtime/components/Textarea.vue.d.ts +4 -3
- package/dist/runtime/components/Timeline.vue +92 -0
- package/dist/runtime/components/Timeline.vue.d.ts +70 -0
- package/dist/runtime/components/Toast.vue +4 -5
- package/dist/runtime/components/Tree.vue +3 -2
- package/dist/runtime/components/Tree.vue.d.ts +1 -1
- package/dist/runtime/composables/defineLocale.d.ts +2 -0
- package/dist/runtime/composables/defineLocale.js +4 -0
- package/dist/runtime/composables/defineShortcuts.js +2 -2
- package/dist/runtime/composables/useOverlay.d.ts +2 -1
- package/dist/runtime/composables/useOverlay.js +7 -6
- package/dist/runtime/locale/ar.js +2 -1
- package/dist/runtime/locale/az.js +2 -1
- package/dist/runtime/locale/bg.js +2 -1
- package/dist/runtime/locale/bn.js +2 -1
- package/dist/runtime/locale/ca.js +2 -1
- package/dist/runtime/locale/ckb.js +2 -1
- package/dist/runtime/locale/cs.js +2 -1
- package/dist/runtime/locale/da.js +2 -1
- package/dist/runtime/locale/de.js +2 -1
- package/dist/runtime/locale/el.js +2 -1
- package/dist/runtime/locale/en.js +2 -1
- package/dist/runtime/locale/es.js +2 -1
- package/dist/runtime/locale/et.js +2 -1
- package/dist/runtime/locale/fa_ir.js +2 -1
- package/dist/runtime/locale/fi.js +2 -1
- package/dist/runtime/locale/fr.js +2 -1
- package/dist/runtime/locale/he.js +2 -1
- package/dist/runtime/locale/hi.js +2 -1
- package/dist/runtime/locale/hu.js +2 -1
- package/dist/runtime/locale/hy.js +2 -1
- package/dist/runtime/locale/id.js +2 -1
- package/dist/runtime/locale/index.d.ts +1 -0
- package/dist/runtime/locale/index.js +1 -0
- package/dist/runtime/locale/it.js +2 -1
- package/dist/runtime/locale/ja.js +2 -1
- package/dist/runtime/locale/kk.js +2 -1
- package/dist/runtime/locale/km.js +2 -1
- package/dist/runtime/locale/ko.js +2 -1
- package/dist/runtime/locale/ky.js +2 -1
- package/dist/runtime/locale/lb.d.ts +3 -0
- package/dist/runtime/locale/lb.js +55 -0
- package/dist/runtime/locale/lt.js +2 -1
- package/dist/runtime/locale/mn.js +2 -1
- package/dist/runtime/locale/ms.js +2 -1
- package/dist/runtime/locale/nb_no.js +2 -1
- package/dist/runtime/locale/nl.js +2 -1
- package/dist/runtime/locale/pl.js +2 -1
- package/dist/runtime/locale/pt.js +2 -1
- package/dist/runtime/locale/pt_br.js +2 -1
- package/dist/runtime/locale/ro.js +2 -1
- package/dist/runtime/locale/ru.js +2 -1
- package/dist/runtime/locale/sk.js +2 -1
- package/dist/runtime/locale/sl.js +2 -1
- package/dist/runtime/locale/sv.js +2 -1
- package/dist/runtime/locale/th.js +2 -1
- package/dist/runtime/locale/tj.js +2 -1
- package/dist/runtime/locale/tr.js +2 -1
- package/dist/runtime/locale/ug_cn.js +2 -1
- package/dist/runtime/locale/uk.js +2 -1
- package/dist/runtime/locale/ur.js +2 -1
- package/dist/runtime/locale/uz.js +2 -1
- package/dist/runtime/locale/vi.js +2 -1
- package/dist/runtime/locale/zh_cn.js +2 -1
- package/dist/runtime/locale/zh_tw.js +2 -1
- package/dist/runtime/types/form.d.ts +11 -10
- package/dist/runtime/types/index.d.ts +2 -0
- package/dist/runtime/types/index.js +2 -0
- package/dist/runtime/types/locale.d.ts +1 -0
- package/dist/runtime/types/utils.d.ts +3 -0
- package/dist/shared/{ui.Bix4DSU4.mjs → ui.BPVxSPGY.mjs} +282 -26
- package/dist/unplugin.mjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +28 -29
|
@@ -3,7 +3,7 @@ import type { AppConfig } from '@nuxt/schema';
|
|
|
3
3
|
import theme from '#build/ui/progress';
|
|
4
4
|
import type { ComponentConfig } from '../types/utils';
|
|
5
5
|
type Progress = ComponentConfig<typeof theme, AppConfig, 'progress'>;
|
|
6
|
-
export interface ProgressProps extends Pick<ProgressRootProps, 'getValueLabel' | 'modelValue'> {
|
|
6
|
+
export interface ProgressProps extends Pick<ProgressRootProps, 'getValueLabel' | 'getValueText' | 'modelValue'> {
|
|
7
7
|
/**
|
|
8
8
|
* The element or component this component should render as.
|
|
9
9
|
* @defaultValue 'div'
|
|
@@ -24,10 +24,10 @@ const props = defineProps({
|
|
|
24
24
|
indicator: { type: null, required: false },
|
|
25
25
|
class: { type: null, required: false },
|
|
26
26
|
ui: { type: null, required: false },
|
|
27
|
-
defaultValue: { type:
|
|
27
|
+
defaultValue: { type: null, required: false },
|
|
28
28
|
disabled: { type: Boolean, required: false },
|
|
29
29
|
loop: { type: Boolean, required: false },
|
|
30
|
-
modelValue: { type:
|
|
30
|
+
modelValue: { type: null, required: false },
|
|
31
31
|
name: { type: String, required: false },
|
|
32
32
|
required: { type: Boolean, required: false }
|
|
33
33
|
});
|
|
@@ -3,7 +3,7 @@ import theme from "#build/ui/select";
|
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
|
-
import { computed, toRef } from "vue";
|
|
6
|
+
import { ref, computed, onMounted, toRef } from "vue";
|
|
7
7
|
import { SelectRoot, SelectArrow, SelectTrigger, SelectPortal, SelectContent, SelectLabel, SelectGroup, SelectItem, SelectItemIndicator, SelectItemText, SelectSeparator, useForwardPropsEmits } from "reka-ui";
|
|
8
8
|
import { defu } from "defu";
|
|
9
9
|
import { reactivePick } from "@vueuse/core";
|
|
@@ -36,6 +36,8 @@ const props = defineProps({
|
|
|
36
36
|
modelValue: { type: null, required: false },
|
|
37
37
|
multiple: { type: Boolean, required: false },
|
|
38
38
|
highlight: { type: Boolean, required: false },
|
|
39
|
+
autofocus: { type: Boolean, required: false },
|
|
40
|
+
autofocusDelay: { type: Number, required: false, default: 0 },
|
|
39
41
|
class: { type: null, required: false },
|
|
40
42
|
ui: { type: null, required: false },
|
|
41
43
|
open: { type: Boolean, required: false },
|
|
@@ -79,11 +81,25 @@ const groups = computed(
|
|
|
79
81
|
const items = computed(() => groups.value.flatMap((group) => group));
|
|
80
82
|
function displayValue(value) {
|
|
81
83
|
if (props.multiple && Array.isArray(value)) {
|
|
82
|
-
|
|
84
|
+
const values = value.map((v) => displayValue(v)).filter(Boolean);
|
|
85
|
+
return values?.length ? values.join(", ") : void 0;
|
|
83
86
|
}
|
|
84
87
|
const item = items.value.find((item2) => compare(typeof item2 === "object" ? get(item2, props.valueKey) : item2, value));
|
|
85
88
|
return item && (typeof item === "object" ? get(item, props.labelKey) : item);
|
|
86
89
|
}
|
|
90
|
+
const triggerRef = ref(null);
|
|
91
|
+
function autoFocus() {
|
|
92
|
+
if (props.autofocus) {
|
|
93
|
+
triggerRef.value?.$el?.focus({
|
|
94
|
+
focusVisible: true
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
onMounted(() => {
|
|
99
|
+
setTimeout(() => {
|
|
100
|
+
autoFocus();
|
|
101
|
+
}, props.autofocusDelay);
|
|
102
|
+
});
|
|
87
103
|
function onUpdate(value) {
|
|
88
104
|
const event = new Event("change", { target: { value } });
|
|
89
105
|
emits("change", event);
|
|
@@ -104,6 +120,9 @@ function onUpdateOpen(value) {
|
|
|
104
120
|
function isSelectItem(item) {
|
|
105
121
|
return typeof item === "object" && item !== null;
|
|
106
122
|
}
|
|
123
|
+
defineExpose({
|
|
124
|
+
triggerRef
|
|
125
|
+
});
|
|
107
126
|
</script>
|
|
108
127
|
|
|
109
128
|
<template>
|
|
@@ -118,7 +137,7 @@ function isSelectItem(item) {
|
|
|
118
137
|
@update:model-value="onUpdate"
|
|
119
138
|
@update:open="onUpdateOpen"
|
|
120
139
|
>
|
|
121
|
-
<SelectTrigger :id="id" :class="ui.base({ class: [props.ui?.base, props.class] })" v-bind="{ ...$attrs, ...ariaAttrs }">
|
|
140
|
+
<SelectTrigger :id="id" ref="triggerRef" :class="ui.base({ class: [props.ui?.base, props.class] })" v-bind="{ ...$attrs, ...ariaAttrs }">
|
|
122
141
|
<span v-if="isLeading || !!avatar || !!slots.leading" :class="ui.leading({ class: props.ui?.leading })">
|
|
123
142
|
<slot name="leading" :model-value="modelValue" :open="open" :ui="ui">
|
|
124
143
|
<UIcon v-if="isLeading && leadingIconName" :name="leadingIconName" :class="ui.leadingIcon({ class: props.ui?.leadingIcon })" />
|
|
@@ -128,7 +147,7 @@ function isSelectItem(item) {
|
|
|
128
147
|
|
|
129
148
|
<slot :model-value="modelValue" :open="open">
|
|
130
149
|
<template v-for="displayedModelValue in [displayValue(modelValue)]" :key="displayedModelValue">
|
|
131
|
-
<span v-if="displayedModelValue" :class="ui.value({ class: props.ui?.value })">
|
|
150
|
+
<span v-if="displayedModelValue !== void 0 && displayedModelValue !== null" :class="ui.value({ class: props.ui?.value })">
|
|
132
151
|
{{ displayedModelValue }}
|
|
133
152
|
</span>
|
|
134
153
|
<span v-else :class="ui.placeholder({ class: props.ui?.placeholder })">
|
|
@@ -88,6 +88,8 @@ export interface SelectProps<T extends ArrayOrNested<SelectItem> = ArrayOrNested
|
|
|
88
88
|
multiple?: M & boolean;
|
|
89
89
|
/** Highlight the ring color like a focus state. */
|
|
90
90
|
highlight?: boolean;
|
|
91
|
+
autofocus?: boolean;
|
|
92
|
+
autofocusDelay?: number;
|
|
91
93
|
class?: any;
|
|
92
94
|
ui?: Select['slots'];
|
|
93
95
|
}
|
|
@@ -134,7 +136,111 @@ declare const _default: <T extends ArrayOrNested<SelectItem>, VK extends GetItem
|
|
|
134
136
|
readonly "onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
135
137
|
readonly "onUpdate:modelValue"?: ((payload: GetModelValue<T, VK, M>) => any) | undefined;
|
|
136
138
|
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onFocus" | "onBlur" | "onChange" | "onUpdate:open" | "onUpdate:modelValue"> & SelectProps<T, VK, M> & Partial<{}>> & import("vue").PublicProps;
|
|
137
|
-
expose(exposed: import("vue").ShallowUnwrapRef<{
|
|
139
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{
|
|
140
|
+
triggerRef: import("vue").Ref<({
|
|
141
|
+
$: import("vue").ComponentInternalInstance;
|
|
142
|
+
$data: {};
|
|
143
|
+
$props: {
|
|
144
|
+
readonly disabled?: boolean | undefined;
|
|
145
|
+
readonly reference?: import("reka-ui").ReferenceElement | undefined;
|
|
146
|
+
readonly asChild?: boolean | undefined;
|
|
147
|
+
readonly as?: (import("reka-ui").AsTag | import("vue").Component) | undefined;
|
|
148
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
|
|
149
|
+
$attrs: {
|
|
150
|
+
[x: string]: unknown;
|
|
151
|
+
};
|
|
152
|
+
$refs: {
|
|
153
|
+
[x: string]: unknown;
|
|
154
|
+
};
|
|
155
|
+
$slots: Readonly<{
|
|
156
|
+
[name: string]: import("vue").Slot<any> | undefined;
|
|
157
|
+
}>;
|
|
158
|
+
$root: import("vue").ComponentPublicInstance | null;
|
|
159
|
+
$parent: import("vue").ComponentPublicInstance | null;
|
|
160
|
+
$host: Element | null;
|
|
161
|
+
$emit: (event: string, ...args: any[]) => void;
|
|
162
|
+
$el: any;
|
|
163
|
+
$options: import("vue").ComponentOptionsBase<Readonly<import("reka-ui").SelectTriggerProps> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
|
|
164
|
+
as: import("reka-ui").AsTag | import("vue").Component;
|
|
165
|
+
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & {
|
|
166
|
+
beforeCreate?: (() => void) | (() => void)[];
|
|
167
|
+
created?: (() => void) | (() => void)[];
|
|
168
|
+
beforeMount?: (() => void) | (() => void)[];
|
|
169
|
+
mounted?: (() => void) | (() => void)[];
|
|
170
|
+
beforeUpdate?: (() => void) | (() => void)[];
|
|
171
|
+
updated?: (() => void) | (() => void)[];
|
|
172
|
+
activated?: (() => void) | (() => void)[];
|
|
173
|
+
deactivated?: (() => void) | (() => void)[];
|
|
174
|
+
beforeDestroy?: (() => void) | (() => void)[];
|
|
175
|
+
beforeUnmount?: (() => void) | (() => void)[];
|
|
176
|
+
destroyed?: (() => void) | (() => void)[];
|
|
177
|
+
unmounted?: (() => void) | (() => void)[];
|
|
178
|
+
renderTracked?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
|
|
179
|
+
renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
|
|
180
|
+
errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void)[];
|
|
181
|
+
};
|
|
182
|
+
$forceUpdate: () => void;
|
|
183
|
+
$nextTick: typeof import("vue").nextTick;
|
|
184
|
+
$watch<T_1 extends string | ((...args: any) => any)>(source: T_1, cb: T_1 extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
|
|
185
|
+
} & Readonly<{
|
|
186
|
+
as: import("reka-ui").AsTag | import("vue").Component;
|
|
187
|
+
}> & Omit<Readonly<import("reka-ui").SelectTriggerProps> & Readonly<{}>, "as"> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
|
|
188
|
+
$slots: {
|
|
189
|
+
default?(_: {}): any;
|
|
190
|
+
};
|
|
191
|
+
}) | null, ({
|
|
192
|
+
$: import("vue").ComponentInternalInstance;
|
|
193
|
+
$data: {};
|
|
194
|
+
$props: {
|
|
195
|
+
readonly disabled?: boolean | undefined;
|
|
196
|
+
readonly reference?: import("reka-ui").ReferenceElement | undefined;
|
|
197
|
+
readonly asChild?: boolean | undefined;
|
|
198
|
+
readonly as?: (import("reka-ui").AsTag | import("vue").Component) | undefined;
|
|
199
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
|
|
200
|
+
$attrs: {
|
|
201
|
+
[x: string]: unknown;
|
|
202
|
+
};
|
|
203
|
+
$refs: {
|
|
204
|
+
[x: string]: unknown;
|
|
205
|
+
};
|
|
206
|
+
$slots: Readonly<{
|
|
207
|
+
[name: string]: import("vue").Slot<any> | undefined;
|
|
208
|
+
}>;
|
|
209
|
+
$root: import("vue").ComponentPublicInstance | null;
|
|
210
|
+
$parent: import("vue").ComponentPublicInstance | null;
|
|
211
|
+
$host: Element | null;
|
|
212
|
+
$emit: (event: string, ...args: any[]) => void;
|
|
213
|
+
$el: any;
|
|
214
|
+
$options: import("vue").ComponentOptionsBase<Readonly<import("reka-ui").SelectTriggerProps> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
|
|
215
|
+
as: import("reka-ui").AsTag | import("vue").Component;
|
|
216
|
+
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & {
|
|
217
|
+
beforeCreate?: (() => void) | (() => void)[];
|
|
218
|
+
created?: (() => void) | (() => void)[];
|
|
219
|
+
beforeMount?: (() => void) | (() => void)[];
|
|
220
|
+
mounted?: (() => void) | (() => void)[];
|
|
221
|
+
beforeUpdate?: (() => void) | (() => void)[];
|
|
222
|
+
updated?: (() => void) | (() => void)[];
|
|
223
|
+
activated?: (() => void) | (() => void)[];
|
|
224
|
+
deactivated?: (() => void) | (() => void)[];
|
|
225
|
+
beforeDestroy?: (() => void) | (() => void)[];
|
|
226
|
+
beforeUnmount?: (() => void) | (() => void)[];
|
|
227
|
+
destroyed?: (() => void) | (() => void)[];
|
|
228
|
+
unmounted?: (() => void) | (() => void)[];
|
|
229
|
+
renderTracked?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
|
|
230
|
+
renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
|
|
231
|
+
errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void)[];
|
|
232
|
+
};
|
|
233
|
+
$forceUpdate: () => void;
|
|
234
|
+
$nextTick: typeof import("vue").nextTick;
|
|
235
|
+
$watch<T_1 extends string | ((...args: any) => any)>(source: T_1, cb: T_1 extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
|
|
236
|
+
} & Readonly<{
|
|
237
|
+
as: import("reka-ui").AsTag | import("vue").Component;
|
|
238
|
+
}> & Omit<Readonly<import("reka-ui").SelectTriggerProps> & Readonly<{}>, "as"> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
|
|
239
|
+
$slots: {
|
|
240
|
+
default?(_: {}): any;
|
|
241
|
+
};
|
|
242
|
+
}) | null>;
|
|
243
|
+
}>): void;
|
|
138
244
|
attrs: any;
|
|
139
245
|
slots: SelectSlots<T, VK, M, NestedItem<T>>;
|
|
140
246
|
emit: ((evt: "blur", payload: FocusEvent) => void) & ((evt: "change", payload: Event) => void) & ((evt: "focus", payload: FocusEvent) => void) & ((evt: "update:open", value: boolean) => void) & ((evt: "update:modelValue", payload: GetModelValue<T, VK, M>) => void);
|
|
@@ -3,7 +3,7 @@ import theme from "#build/ui/select-menu";
|
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
|
-
import { computed, toRef, toRaw } from "vue";
|
|
6
|
+
import { ref, computed, onMounted, toRef, toRaw } from "vue";
|
|
7
7
|
import { ComboboxRoot, ComboboxArrow, ComboboxAnchor, ComboboxInput, ComboboxTrigger, ComboboxPortal, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxLabel, ComboboxSeparator, ComboboxItem, ComboboxItemIndicator, FocusScope, useForwardPropsEmits, useFilter } from "reka-ui";
|
|
8
8
|
import { defu } from "defu";
|
|
9
9
|
import { reactivePick, createReusableTemplate } from "@vueuse/core";
|
|
@@ -43,6 +43,8 @@ const props = defineProps({
|
|
|
43
43
|
createItem: { type: [Boolean, String, Object], required: false },
|
|
44
44
|
filterFields: { type: Array, required: false },
|
|
45
45
|
ignoreFilter: { type: Boolean, required: false },
|
|
46
|
+
autofocus: { type: Boolean, required: false },
|
|
47
|
+
autofocusDelay: { type: Number, required: false, default: 0 },
|
|
46
48
|
class: { type: null, required: false },
|
|
47
49
|
ui: { type: null, required: false },
|
|
48
50
|
open: { type: Boolean, required: false },
|
|
@@ -88,7 +90,8 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.selectMenu ||
|
|
|
88
90
|
}));
|
|
89
91
|
function displayValue(value) {
|
|
90
92
|
if (props.multiple && Array.isArray(value)) {
|
|
91
|
-
|
|
93
|
+
const values = value.map((v) => displayValue(v)).filter(Boolean);
|
|
94
|
+
return values?.length ? values.join(", ") : void 0;
|
|
92
95
|
}
|
|
93
96
|
if (!props.valueKey) {
|
|
94
97
|
return value && (typeof value === "object" ? get(value, props.labelKey) : value);
|
|
@@ -129,6 +132,19 @@ const createItem = computed(() => {
|
|
|
129
132
|
return !filteredItems.value.length;
|
|
130
133
|
});
|
|
131
134
|
const createItemPosition = computed(() => typeof props.createItem === "object" ? props.createItem.position : "bottom");
|
|
135
|
+
const triggerRef = ref(null);
|
|
136
|
+
function autoFocus() {
|
|
137
|
+
if (props.autofocus) {
|
|
138
|
+
triggerRef.value?.$el?.focus({
|
|
139
|
+
focusVisible: true
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
onMounted(() => {
|
|
144
|
+
setTimeout(() => {
|
|
145
|
+
autoFocus();
|
|
146
|
+
}, props.autofocusDelay);
|
|
147
|
+
});
|
|
132
148
|
function onUpdate(value) {
|
|
133
149
|
if (toRaw(props.modelValue) === value) {
|
|
134
150
|
return;
|
|
@@ -173,6 +189,9 @@ function onSelect(e, item) {
|
|
|
173
189
|
function isSelectItem(item) {
|
|
174
190
|
return typeof item === "object" && item !== null;
|
|
175
191
|
}
|
|
192
|
+
defineExpose({
|
|
193
|
+
triggerRef
|
|
194
|
+
});
|
|
176
195
|
</script>
|
|
177
196
|
|
|
178
197
|
<template>
|
|
@@ -204,7 +223,7 @@ function isSelectItem(item) {
|
|
|
204
223
|
@update:open="onUpdateOpen"
|
|
205
224
|
>
|
|
206
225
|
<ComboboxAnchor as-child>
|
|
207
|
-
<ComboboxTrigger :class="ui.base({ class: [props.ui?.base, props.class] })" tabindex="0">
|
|
226
|
+
<ComboboxTrigger ref="triggerRef" :class="ui.base({ class: [props.ui?.base, props.class] })" tabindex="0">
|
|
208
227
|
<span v-if="isLeading || !!avatar || !!slots.leading" :class="ui.leading({ class: props.ui?.leading })">
|
|
209
228
|
<slot name="leading" :model-value="modelValue" :open="open" :ui="ui">
|
|
210
229
|
<UIcon v-if="isLeading && leadingIconName" :name="leadingIconName" :class="ui.leadingIcon({ class: props.ui?.leadingIcon })" />
|
|
@@ -214,7 +233,7 @@ function isSelectItem(item) {
|
|
|
214
233
|
|
|
215
234
|
<slot :model-value="modelValue" :open="open">
|
|
216
235
|
<template v-for="displayedModelValue in [displayValue(modelValue)]" :key="displayedModelValue">
|
|
217
|
-
<span v-if="displayedModelValue" :class="ui.value({ class: props.ui?.value })">
|
|
236
|
+
<span v-if="displayedModelValue !== void 0 && displayedModelValue !== null" :class="ui.value({ class: props.ui?.value })">
|
|
218
237
|
{{ displayedModelValue }}
|
|
219
238
|
</span>
|
|
220
239
|
<span v-else :class="ui.placeholder({ class: props.ui?.placeholder })">
|
|
@@ -237,7 +256,7 @@ function isSelectItem(item) {
|
|
|
237
256
|
<slot name="content-top" />
|
|
238
257
|
|
|
239
258
|
<ComboboxInput v-if="!!searchInput" v-model="searchTerm" :display-value="() => searchTerm" as-child>
|
|
240
|
-
<UInput autofocus autocomplete="off" v-bind="searchInputProps" :class="ui.input({ class: props.ui?.input })" />
|
|
259
|
+
<UInput autofocus autocomplete="off" :size="size" v-bind="searchInputProps" :class="ui.input({ class: props.ui?.input })" />
|
|
241
260
|
</ComboboxInput>
|
|
242
261
|
|
|
243
262
|
<ComboboxEmpty :class="ui.empty({ class: props.ui?.empty })">
|
|
@@ -114,6 +114,8 @@ export interface SelectMenuProps<T extends ArrayOrNested<SelectMenuItem> = Array
|
|
|
114
114
|
* @defaultValue false
|
|
115
115
|
*/
|
|
116
116
|
ignoreFilter?: boolean;
|
|
117
|
+
autofocus?: boolean;
|
|
118
|
+
autofocusDelay?: number;
|
|
117
119
|
class?: any;
|
|
118
120
|
ui?: SelectMenu['slots'];
|
|
119
121
|
}
|
|
@@ -182,7 +184,109 @@ declare const _default: <T extends ArrayOrNested<SelectMenuItem>, VK extends Get
|
|
|
182
184
|
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onFocus" | "onBlur" | "onChange" | "onUpdate:open" | "onUpdate:modelValue" | "onHighlight" | "onUpdate:searchTerm" | "onCreate"> & (SelectMenuProps<T, VK, M> & {
|
|
183
185
|
searchTerm?: string;
|
|
184
186
|
}) & Partial<{}>> & import("vue").PublicProps;
|
|
185
|
-
expose(exposed: import("vue").ShallowUnwrapRef<{
|
|
187
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{
|
|
188
|
+
triggerRef: import("vue").Ref<({
|
|
189
|
+
$: import("vue").ComponentInternalInstance;
|
|
190
|
+
$data: {};
|
|
191
|
+
$props: {
|
|
192
|
+
readonly disabled?: boolean | undefined;
|
|
193
|
+
readonly asChild?: boolean | undefined;
|
|
194
|
+
readonly as?: (import("reka-ui").AsTag | import("vue").Component) | undefined;
|
|
195
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
|
|
196
|
+
$attrs: {
|
|
197
|
+
[x: string]: unknown;
|
|
198
|
+
};
|
|
199
|
+
$refs: {
|
|
200
|
+
[x: string]: unknown;
|
|
201
|
+
};
|
|
202
|
+
$slots: Readonly<{
|
|
203
|
+
[name: string]: import("vue").Slot<any> | undefined;
|
|
204
|
+
}>;
|
|
205
|
+
$root: import("vue").ComponentPublicInstance | null;
|
|
206
|
+
$parent: import("vue").ComponentPublicInstance | null;
|
|
207
|
+
$host: Element | null;
|
|
208
|
+
$emit: (event: string, ...args: any[]) => void;
|
|
209
|
+
$el: any;
|
|
210
|
+
$options: import("vue").ComponentOptionsBase<Readonly<import("reka-ui").ComboboxTriggerProps> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
|
|
211
|
+
as: import("reka-ui").AsTag | import("vue").Component;
|
|
212
|
+
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & {
|
|
213
|
+
beforeCreate?: (() => void) | (() => void)[];
|
|
214
|
+
created?: (() => void) | (() => void)[];
|
|
215
|
+
beforeMount?: (() => void) | (() => void)[];
|
|
216
|
+
mounted?: (() => void) | (() => void)[];
|
|
217
|
+
beforeUpdate?: (() => void) | (() => void)[];
|
|
218
|
+
updated?: (() => void) | (() => void)[];
|
|
219
|
+
activated?: (() => void) | (() => void)[];
|
|
220
|
+
deactivated?: (() => void) | (() => void)[];
|
|
221
|
+
beforeDestroy?: (() => void) | (() => void)[];
|
|
222
|
+
beforeUnmount?: (() => void) | (() => void)[];
|
|
223
|
+
destroyed?: (() => void) | (() => void)[];
|
|
224
|
+
unmounted?: (() => void) | (() => void)[];
|
|
225
|
+
renderTracked?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
|
|
226
|
+
renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
|
|
227
|
+
errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void)[];
|
|
228
|
+
};
|
|
229
|
+
$forceUpdate: () => void;
|
|
230
|
+
$nextTick: typeof import("vue").nextTick;
|
|
231
|
+
$watch<T_1 extends string | ((...args: any) => any)>(source: T_1, cb: T_1 extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
|
|
232
|
+
} & Readonly<{
|
|
233
|
+
as: import("reka-ui").AsTag | import("vue").Component;
|
|
234
|
+
}> & Omit<Readonly<import("reka-ui").ComboboxTriggerProps> & Readonly<{}>, "as"> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
|
|
235
|
+
$slots: {
|
|
236
|
+
default?(_: {}): any;
|
|
237
|
+
};
|
|
238
|
+
}) | null, ({
|
|
239
|
+
$: import("vue").ComponentInternalInstance;
|
|
240
|
+
$data: {};
|
|
241
|
+
$props: {
|
|
242
|
+
readonly disabled?: boolean | undefined;
|
|
243
|
+
readonly asChild?: boolean | undefined;
|
|
244
|
+
readonly as?: (import("reka-ui").AsTag | import("vue").Component) | undefined;
|
|
245
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
|
|
246
|
+
$attrs: {
|
|
247
|
+
[x: string]: unknown;
|
|
248
|
+
};
|
|
249
|
+
$refs: {
|
|
250
|
+
[x: string]: unknown;
|
|
251
|
+
};
|
|
252
|
+
$slots: Readonly<{
|
|
253
|
+
[name: string]: import("vue").Slot<any> | undefined;
|
|
254
|
+
}>;
|
|
255
|
+
$root: import("vue").ComponentPublicInstance | null;
|
|
256
|
+
$parent: import("vue").ComponentPublicInstance | null;
|
|
257
|
+
$host: Element | null;
|
|
258
|
+
$emit: (event: string, ...args: any[]) => void;
|
|
259
|
+
$el: any;
|
|
260
|
+
$options: import("vue").ComponentOptionsBase<Readonly<import("reka-ui").ComboboxTriggerProps> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
|
|
261
|
+
as: import("reka-ui").AsTag | import("vue").Component;
|
|
262
|
+
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & {
|
|
263
|
+
beforeCreate?: (() => void) | (() => void)[];
|
|
264
|
+
created?: (() => void) | (() => void)[];
|
|
265
|
+
beforeMount?: (() => void) | (() => void)[];
|
|
266
|
+
mounted?: (() => void) | (() => void)[];
|
|
267
|
+
beforeUpdate?: (() => void) | (() => void)[];
|
|
268
|
+
updated?: (() => void) | (() => void)[];
|
|
269
|
+
activated?: (() => void) | (() => void)[];
|
|
270
|
+
deactivated?: (() => void) | (() => void)[];
|
|
271
|
+
beforeDestroy?: (() => void) | (() => void)[];
|
|
272
|
+
beforeUnmount?: (() => void) | (() => void)[];
|
|
273
|
+
destroyed?: (() => void) | (() => void)[];
|
|
274
|
+
unmounted?: (() => void) | (() => void)[];
|
|
275
|
+
renderTracked?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
|
|
276
|
+
renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
|
|
277
|
+
errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void)[];
|
|
278
|
+
};
|
|
279
|
+
$forceUpdate: () => void;
|
|
280
|
+
$nextTick: typeof import("vue").nextTick;
|
|
281
|
+
$watch<T_1 extends string | ((...args: any) => any)>(source: T_1, cb: T_1 extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
|
|
282
|
+
} & Readonly<{
|
|
283
|
+
as: import("reka-ui").AsTag | import("vue").Component;
|
|
284
|
+
}> & Omit<Readonly<import("reka-ui").ComboboxTriggerProps> & Readonly<{}>, "as"> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
|
|
285
|
+
$slots: {
|
|
286
|
+
default?(_: {}): any;
|
|
287
|
+
};
|
|
288
|
+
}) | null>;
|
|
289
|
+
}>): void;
|
|
186
290
|
attrs: any;
|
|
187
291
|
slots: SelectMenuSlots<T, VK, M, NestedItem<T>>;
|
|
188
292
|
emit: (((evt: "blur", payload: FocusEvent) => void) & ((evt: "change", payload: Event) => void) & ((evt: "focus", payload: FocusEvent) => void) & ((evt: "create", item: string) => void) & ((evt: "update:open", value: boolean) => void) & ((evt: "update:modelValue", payload: GetModelValue<T, VK, M>) => void) & ((evt: "highlight", payload: {
|
|
@@ -40,14 +40,14 @@ const contentEvents = computed(() => {
|
|
|
40
40
|
closeAutoFocus: (e) => e.preventDefault()
|
|
41
41
|
};
|
|
42
42
|
if (!props.dismissible) {
|
|
43
|
-
const events = ["pointerDownOutside", "interactOutside", "escapeKeyDown"
|
|
43
|
+
const events = ["pointerDownOutside", "interactOutside", "escapeKeyDown"];
|
|
44
44
|
return events.reduce((acc, curr) => {
|
|
45
45
|
acc[curr] = (e) => {
|
|
46
46
|
e.preventDefault();
|
|
47
47
|
emits("close:prevent");
|
|
48
48
|
};
|
|
49
49
|
return acc;
|
|
50
|
-
},
|
|
50
|
+
}, defaultEvents);
|
|
51
51
|
}
|
|
52
52
|
return defaultEvents;
|
|
53
53
|
});
|
|
@@ -58,7 +58,7 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.slideover ||
|
|
|
58
58
|
</script>
|
|
59
59
|
|
|
60
60
|
<template>
|
|
61
|
-
<DialogRoot v-slot="{ open }" v-bind="rootProps">
|
|
61
|
+
<DialogRoot v-slot="{ open, close }" v-bind="rootProps">
|
|
62
62
|
<DialogTrigger v-if="!!slots.default" as-child :class="props.class">
|
|
63
63
|
<slot :open="open" />
|
|
64
64
|
</DialogTrigger>
|
|
@@ -88,9 +88,9 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.slideover ||
|
|
|
88
88
|
</DialogDescription>
|
|
89
89
|
</VisuallyHidden>
|
|
90
90
|
|
|
91
|
-
<slot name="content">
|
|
92
|
-
<div v-if="!!slots.header || (title || !!slots.title) || (description || !!slots.description) || (close || !!slots.close)" :class="ui.header({ class: props.ui?.header })">
|
|
93
|
-
<slot name="header">
|
|
91
|
+
<slot name="content" :close="close">
|
|
92
|
+
<div v-if="!!slots.header || (title || !!slots.title) || (description || !!slots.description) || (props.close || !!slots.close)" :class="ui.header({ class: props.ui?.header })">
|
|
93
|
+
<slot name="header" :close="close">
|
|
94
94
|
<div :class="ui.wrapper({ class: props.ui?.wrapper })">
|
|
95
95
|
<DialogTitle v-if="title || !!slots.title" :class="ui.title({ class: props.ui?.title })">
|
|
96
96
|
<slot name="title">
|
|
@@ -105,16 +105,17 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.slideover ||
|
|
|
105
105
|
</DialogDescription>
|
|
106
106
|
</div>
|
|
107
107
|
|
|
108
|
-
<
|
|
109
|
-
|
|
108
|
+
<slot name="actions" />
|
|
109
|
+
|
|
110
|
+
<DialogClose v-if="props.close || !!slots.close" as-child>
|
|
111
|
+
<slot name="close" :close="close" :ui="ui">
|
|
110
112
|
<UButton
|
|
111
|
-
v-if="close"
|
|
113
|
+
v-if="props.close"
|
|
112
114
|
:icon="closeIcon || appConfig.ui.icons.close"
|
|
113
|
-
size="md"
|
|
114
115
|
color="neutral"
|
|
115
116
|
variant="ghost"
|
|
116
117
|
:aria-label="t('slideover.close')"
|
|
117
|
-
v-bind="typeof close === 'object' ? close : {}"
|
|
118
|
+
v-bind="typeof props.close === 'object' ? props.close : {}"
|
|
118
119
|
:class="ui.close({ class: props.ui?.close })"
|
|
119
120
|
/>
|
|
120
121
|
</slot>
|
|
@@ -123,11 +124,11 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.slideover ||
|
|
|
123
124
|
</div>
|
|
124
125
|
|
|
125
126
|
<div :class="ui.body({ class: props.ui?.body })">
|
|
126
|
-
<slot name="body" />
|
|
127
|
+
<slot name="body" :close="close" />
|
|
127
128
|
</div>
|
|
128
129
|
|
|
129
130
|
<div v-if="!!slots.footer" :class="ui.footer({ class: props.ui?.footer })">
|
|
130
|
-
<slot name="footer" />
|
|
131
|
+
<slot name="footer" :close="close" />
|
|
131
132
|
</div>
|
|
132
133
|
</slot>
|
|
133
134
|
</DialogContent>
|
|
@@ -58,17 +58,27 @@ export interface SlideoverSlots {
|
|
|
58
58
|
default(props: {
|
|
59
59
|
open: boolean;
|
|
60
60
|
}): any;
|
|
61
|
-
content(props
|
|
62
|
-
|
|
61
|
+
content(props: {
|
|
62
|
+
close: () => void;
|
|
63
|
+
}): any;
|
|
64
|
+
header(props: {
|
|
65
|
+
close: () => void;
|
|
66
|
+
}): any;
|
|
63
67
|
title(props?: {}): any;
|
|
64
68
|
description(props?: {}): any;
|
|
69
|
+
actions(props?: {}): any;
|
|
65
70
|
close(props: {
|
|
71
|
+
close: () => void;
|
|
66
72
|
ui: {
|
|
67
73
|
[K in keyof Required<Slideover['slots']>]: (props?: Record<string, any>) => string;
|
|
68
74
|
};
|
|
69
75
|
}): any;
|
|
70
|
-
body(props
|
|
71
|
-
|
|
76
|
+
body(props: {
|
|
77
|
+
close: () => void;
|
|
78
|
+
}): any;
|
|
79
|
+
footer(props: {
|
|
80
|
+
close: () => void;
|
|
81
|
+
}): any;
|
|
72
82
|
}
|
|
73
83
|
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<SlideoverProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
74
84
|
"update:open": (value: boolean) => any;
|
|
@@ -82,7 +82,7 @@ const sortingState = defineModel("sorting", { type: Array, ...{ default: [] } })
|
|
|
82
82
|
const groupingState = defineModel("grouping", { type: Array, ...{ default: [] } });
|
|
83
83
|
const expandedState = defineModel("expanded", { type: [Boolean, Object], ...{ default: {} } });
|
|
84
84
|
const paginationState = defineModel("pagination", { type: Object, ...{ default: {} } });
|
|
85
|
-
const tableRef = ref();
|
|
85
|
+
const tableRef = ref(null);
|
|
86
86
|
const tableApi = useVueTable({
|
|
87
87
|
...reactiveOmit(props, "as", "data", "columns", "caption", "sticky", "loading", "loadingColor", "loadingAnimation", "class", "ui"),
|
|
88
88
|
data,
|
|
@@ -217,9 +217,13 @@ defineExpose({
|
|
|
217
217
|
</slot>
|
|
218
218
|
</th>
|
|
219
219
|
</tr>
|
|
220
|
+
|
|
221
|
+
<tr :class="ui.separator({ class: [props.ui?.separator] })" />
|
|
220
222
|
</thead>
|
|
221
223
|
|
|
222
224
|
<tbody :class="ui.tbody({ class: [props.ui?.tbody] })">
|
|
225
|
+
<slot name="body-top" />
|
|
226
|
+
|
|
223
227
|
<template v-if="tableApi.getRowModel().rows?.length">
|
|
224
228
|
<template v-for="row in tableApi.getRowModel().rows" :key="row.id">
|
|
225
229
|
<tr
|
|
@@ -274,6 +278,8 @@ defineExpose({
|
|
|
274
278
|
</slot>
|
|
275
279
|
</td>
|
|
276
280
|
</tr>
|
|
281
|
+
|
|
282
|
+
<slot name="body-bottom" />
|
|
277
283
|
</tbody>
|
|
278
284
|
</table>
|
|
279
285
|
</Primitive>
|
|
@@ -21,12 +21,12 @@ type Table = ComponentConfig<typeof theme, AppConfig, 'table'>;
|
|
|
21
21
|
export type TableRow<T> = Row<T>;
|
|
22
22
|
export type TableData = RowData;
|
|
23
23
|
export type TableColumn<T extends TableData, D = unknown> = ColumnDef<T, D>;
|
|
24
|
-
export interface TableOptions<T extends TableData> extends Omit<CoreOptions<T>, 'data' | 'columns' | 'getCoreRowModel' | 'state' | 'onStateChange' | 'renderFallbackValue'> {
|
|
24
|
+
export interface TableOptions<T extends TableData = TableData> extends Omit<CoreOptions<T>, 'data' | 'columns' | 'getCoreRowModel' | 'state' | 'onStateChange' | 'renderFallbackValue'> {
|
|
25
25
|
state?: CoreOptions<T>['state'];
|
|
26
26
|
onStateChange?: CoreOptions<T>['onStateChange'];
|
|
27
27
|
renderFallbackValue?: CoreOptions<T>['renderFallbackValue'];
|
|
28
28
|
}
|
|
29
|
-
export interface TableProps<T extends TableData> extends TableOptions<T> {
|
|
29
|
+
export interface TableProps<T extends TableData = TableData> extends TableOptions<T> {
|
|
30
30
|
/**
|
|
31
31
|
* The element or component this component should render as.
|
|
32
32
|
* @defaultValue 'div'
|
|
@@ -129,13 +129,15 @@ export interface TableProps<T extends TableData> extends TableOptions<T> {
|
|
|
129
129
|
}
|
|
130
130
|
type DynamicHeaderSlots<T, K = keyof T> = Record<string, (props: HeaderContext<T, unknown>) => any> & Record<`${K extends string ? K : never}-header`, (props: HeaderContext<T, unknown>) => any>;
|
|
131
131
|
type DynamicCellSlots<T, K = keyof T> = Record<string, (props: CellContext<T, unknown>) => any> & Record<`${K extends string ? K : never}-cell`, (props: CellContext<T, unknown>) => any>;
|
|
132
|
-
export type TableSlots<T> = {
|
|
133
|
-
expanded: (props: {
|
|
132
|
+
export type TableSlots<T extends TableData = TableData> = {
|
|
133
|
+
'expanded': (props: {
|
|
134
134
|
row: Row<T>;
|
|
135
135
|
}) => any;
|
|
136
|
-
empty: (props?: {}) => any;
|
|
137
|
-
loading: (props?: {}) => any;
|
|
138
|
-
caption: (props?: {}) => any;
|
|
136
|
+
'empty': (props?: {}) => any;
|
|
137
|
+
'loading': (props?: {}) => any;
|
|
138
|
+
'caption': (props?: {}) => any;
|
|
139
|
+
'body-top': (props?: {}) => any;
|
|
140
|
+
'body-bottom': (props?: {}) => any;
|
|
139
141
|
} & DynamicHeaderSlots<T> & DynamicCellSlots<T>;
|
|
140
142
|
declare const _default: <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_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
141
143
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
@@ -168,7 +170,7 @@ declare const _default: <T extends TableData>(__VLS_props: NonNullable<Awaited<t
|
|
|
168
170
|
pagination?: PaginationState;
|
|
169
171
|
}) & Partial<{}>> & import("vue").PublicProps;
|
|
170
172
|
expose(exposed: import("vue").ShallowUnwrapRef<{
|
|
171
|
-
tableRef: Ref<HTMLTableElement |
|
|
173
|
+
tableRef: Ref<HTMLTableElement | null, HTMLTableElement | null>;
|
|
172
174
|
tableApi: import("@tanstack/table-core").Table<T>;
|
|
173
175
|
}>): void;
|
|
174
176
|
attrs: any;
|
|
@@ -3,7 +3,7 @@ import theme from "#build/ui/tabs";
|
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
|
-
import { computed } from "vue";
|
|
6
|
+
import { ref, computed } from "vue";
|
|
7
7
|
import { TabsRoot, TabsList, TabsIndicator, TabsTrigger, TabsContent, useForwardPropsEmits } from "reka-ui";
|
|
8
8
|
import { reactivePick } from "@vueuse/core";
|
|
9
9
|
import { useAppConfig } from "#imports";
|
|
@@ -37,6 +37,10 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.tabs || {} })
|
|
|
37
37
|
size: props.size,
|
|
38
38
|
orientation: props.orientation
|
|
39
39
|
}));
|
|
40
|
+
const triggersRef = ref([]);
|
|
41
|
+
defineExpose({
|
|
42
|
+
triggersRef
|
|
43
|
+
});
|
|
40
44
|
</script>
|
|
41
45
|
|
|
42
46
|
<template>
|
|
@@ -46,7 +50,14 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.tabs || {} })
|
|
|
46
50
|
|
|
47
51
|
<slot name="list-leading" />
|
|
48
52
|
|
|
49
|
-
<TabsTrigger
|
|
53
|
+
<TabsTrigger
|
|
54
|
+
v-for="(item, index) of items"
|
|
55
|
+
:key="index"
|
|
56
|
+
:ref="(el) => triggersRef[index] = el"
|
|
57
|
+
:value="item.value || String(index)"
|
|
58
|
+
:disabled="item.disabled"
|
|
59
|
+
:class="ui.trigger({ class: [props.ui?.trigger, item.ui?.trigger] })"
|
|
60
|
+
>
|
|
50
61
|
<slot name="leading" :item="item" :index="index">
|
|
51
62
|
<UIcon v-if="item.icon" :name="item.icon" :class="ui.leadingIcon({ class: [props.ui?.leadingIcon, item.ui?.leadingIcon] })" />
|
|
52
63
|
<UAvatar v-else-if="item.avatar" :size="props.ui?.leadingAvatarSize || ui.leadingAvatarSize()" v-bind="item.avatar" :class="ui.leadingAvatar({ class: [props.ui?.leadingAvatar, item.ui?.leadingAvatar] })" />
|