@shwfed/nuxt 0.1.29 → 0.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.json +1 -1
- package/dist/runtime/components/query.d.vue.ts +57 -8
- package/dist/runtime/components/query.vue +88 -41
- package/dist/runtime/components/query.vue.d.ts +57 -8
- package/dist/runtime/components/table.d.vue.ts +2 -2
- package/dist/runtime/components/table.vue +105 -15
- package/dist/runtime/components/table.vue.d.ts +2 -2
- package/dist/runtime/components/ui/field/index.js +3 -3
- package/dist/runtime/components/ui/input/Input.d.vue.ts +1 -0
- package/dist/runtime/components/ui/input/Input.vue +3 -2
- package/dist/runtime/components/ui/input/Input.vue.d.ts +1 -0
- package/dist/runtime/components/ui/input-group/InputCombobox.d.vue.ts +2 -1
- package/dist/runtime/components/ui/input-group/InputCombobox.vue +29 -1
- package/dist/runtime/components/ui/input-group/InputCombobox.vue.d.ts +2 -1
- package/dist/runtime/components/ui/input-group/InputGroup.d.vue.ts +1 -1
- package/dist/runtime/components/ui/input-group/InputGroup.vue +4 -0
- package/dist/runtime/components/ui/input-group/InputGroup.vue.d.ts +1 -1
- package/dist/runtime/components/ui/input-group/InputGroupInput.d.vue.ts +1 -0
- package/dist/runtime/components/ui/input-group/InputGroupInput.vue +3 -1
- package/dist/runtime/components/ui/input-group/InputGroupInput.vue.d.ts +1 -0
- package/dist/runtime/components/ui/input-group/index.d.ts +2 -0
- package/dist/runtime/components/ui/input-group/index.js +2 -0
- package/dist/runtime/components/ui/number-field/NumberField.d.vue.ts +25 -0
- package/dist/runtime/components/ui/number-field/NumberField.vue +39 -0
- package/dist/runtime/components/ui/number-field/NumberField.vue.d.ts +25 -0
- package/dist/runtime/components/ui/number-field/NumberFieldContent.d.vue.ts +17 -0
- package/dist/runtime/components/ui/number-field/NumberFieldContent.vue +12 -0
- package/dist/runtime/components/ui/number-field/NumberFieldContent.vue.d.ts +17 -0
- package/dist/runtime/components/ui/number-field/NumberFieldDecrement.d.vue.ts +18 -0
- package/dist/runtime/components/ui/number-field/NumberFieldDecrement.vue +29 -0
- package/dist/runtime/components/ui/number-field/NumberFieldDecrement.vue.d.ts +18 -0
- package/dist/runtime/components/ui/number-field/NumberFieldIncrement.d.vue.ts +18 -0
- package/dist/runtime/components/ui/number-field/NumberFieldIncrement.vue +29 -0
- package/dist/runtime/components/ui/number-field/NumberFieldIncrement.vue.d.ts +18 -0
- package/dist/runtime/components/ui/number-field/NumberFieldInput.d.vue.ts +7 -0
- package/dist/runtime/components/ui/number-field/NumberFieldInput.vue +14 -0
- package/dist/runtime/components/ui/number-field/NumberFieldInput.vue.d.ts +7 -0
- package/dist/runtime/components/ui/number-field/index.d.ts +5 -0
- package/dist/runtime/components/ui/number-field/index.js +5 -0
- package/dist/runtime/components/ui/popover/PopoverContent.vue +1 -1
- package/package.json +2 -1
package/dist/module.json
CHANGED
|
@@ -1,10 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
1
|
+
import { Field } from './ui/field/index.js';
|
|
2
|
+
import type { ClassValue } from 'clsx';
|
|
3
|
+
type Option = Readonly<{
|
|
4
|
+
label: Record<string, string>;
|
|
5
|
+
value: string | number;
|
|
6
|
+
icon?: string;
|
|
7
|
+
}>;
|
|
8
|
+
type OptionsGroup = Readonly<{
|
|
9
|
+
label: Record<string, string>;
|
|
10
|
+
value: string | number;
|
|
11
|
+
options: ReadonlyArray<Option>;
|
|
12
|
+
}>;
|
|
13
|
+
type TextField = Readonly<{
|
|
14
|
+
type: 'string';
|
|
15
|
+
path: string;
|
|
16
|
+
label: Record<string, string>;
|
|
17
|
+
intial?: string;
|
|
18
|
+
icon?: string;
|
|
19
|
+
class?: ClassValue;
|
|
20
|
+
treatEmptyAsDifferentStateFromNull?: boolean;
|
|
21
|
+
}>;
|
|
22
|
+
type SelectField = Readonly<{
|
|
23
|
+
type: 'select';
|
|
24
|
+
path: string;
|
|
25
|
+
label: Record<string, string>;
|
|
26
|
+
intial?: string;
|
|
27
|
+
icon?: string;
|
|
28
|
+
options: ReadonlyArray<OptionsGroup>;
|
|
29
|
+
class?: ClassValue;
|
|
30
|
+
}>;
|
|
31
|
+
type Field = TextField | SelectField;
|
|
9
32
|
declare const _default: typeof __VLS_export;
|
|
10
33
|
export default _default;
|
|
34
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
35
|
+
fields: ReadonlyArray<Field>;
|
|
36
|
+
} & {
|
|
37
|
+
modelValue?: Record<string, unknown>;
|
|
38
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
39
|
+
"update:modelValue": (value: Record<string, unknown>) => any;
|
|
40
|
+
}, string, import("vue").PublicProps, Readonly<{
|
|
41
|
+
fields: ReadonlyArray<Field>;
|
|
42
|
+
} & {
|
|
43
|
+
modelValue?: Record<string, unknown>;
|
|
44
|
+
}> & Readonly<{
|
|
45
|
+
"onUpdate:modelValue"?: ((value: Record<string, unknown>) => any) | undefined;
|
|
46
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
47
|
+
option?: (props: {
|
|
48
|
+
option: Readonly<{
|
|
49
|
+
label: Record<string, string>;
|
|
50
|
+
value: string | number;
|
|
51
|
+
icon?: string;
|
|
52
|
+
}>;
|
|
53
|
+
}) => any;
|
|
54
|
+
}>;
|
|
55
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
56
|
+
new (): {
|
|
57
|
+
$slots: S;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
@@ -1,68 +1,115 @@
|
|
|
1
|
-
<script
|
|
1
|
+
<script>
|
|
2
2
|
import { Icon } from "@iconify/vue";
|
|
3
3
|
import { Field, FieldLabel } from "./ui/field";
|
|
4
|
-
import { InputGroup, InputGroupAddon, InputGroupButton, InputCombobox } from "./ui/input-group";
|
|
5
|
-
import { Tooltip, TooltipContent,
|
|
4
|
+
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputCombobox } from "./ui/input-group";
|
|
5
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "./ui/tooltip";
|
|
6
6
|
import { useI18n } from "vue-i18n";
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
import { deleteProperty, getProperty, hasProperty, setProperty } from "dot-prop";
|
|
8
|
+
import { CommandGroup, CommandItem } from "./ui/command";
|
|
9
|
+
import { useCheating, useId } from "#imports";
|
|
10
|
+
import { defu } from "defu";
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<script setup>
|
|
14
|
+
const id = useId();
|
|
15
|
+
const props = defineProps({
|
|
10
16
|
fields: { type: Array, required: true }
|
|
11
17
|
});
|
|
18
|
+
const { t } = useI18n({
|
|
19
|
+
messages: props.fields.reduce((acc, field, i) => {
|
|
20
|
+
function t2(locales) {
|
|
21
|
+
return Object.fromEntries(Object.entries(locales).map(([locale, message]) => [locale, { [`${id}-${i}`]: message }]));
|
|
22
|
+
}
|
|
23
|
+
return defu(acc, t2(field.label));
|
|
24
|
+
}, {})
|
|
25
|
+
});
|
|
26
|
+
const modelValue = defineModel("modelValue", { type: Object, ...{
|
|
27
|
+
default: () => ({})
|
|
28
|
+
} });
|
|
29
|
+
const isCheating = useCheating();
|
|
12
30
|
</script>
|
|
13
31
|
|
|
14
32
|
<template>
|
|
15
|
-
<div
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
33
|
+
<div>
|
|
34
|
+
<Field
|
|
35
|
+
v-for="(field, i) in fields"
|
|
36
|
+
:key="field.path"
|
|
37
|
+
:class="field.class"
|
|
38
|
+
>
|
|
20
39
|
<InputGroup>
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
40
|
+
<InputGroupInput
|
|
41
|
+
v-if="field.type === 'string'"
|
|
42
|
+
:treat-empty-as-different-state-from-null="field.treatEmptyAsDifferentStateFromNull"
|
|
43
|
+
:model-value="getProperty(modelValue, field.path)"
|
|
44
|
+
@update:model-value="(value) => {
|
|
45
|
+
if (!value && !field.treatEmptyAsDifferentStateFromNull) {
|
|
46
|
+
deleteProperty(modelValue, field.path);
|
|
47
|
+
} else {
|
|
48
|
+
setProperty(modelValue, field.path, value);
|
|
49
|
+
}
|
|
50
|
+
}"
|
|
51
|
+
/>
|
|
52
|
+
<InputCombobox
|
|
53
|
+
v-if="field.type === 'select'"
|
|
54
|
+
>
|
|
55
|
+
<CommandGroup
|
|
56
|
+
v-for="group in field.options"
|
|
57
|
+
:key="group.value"
|
|
58
|
+
>
|
|
33
59
|
<CommandItem
|
|
34
|
-
|
|
60
|
+
v-for="option in group.options"
|
|
61
|
+
:key="option.value"
|
|
62
|
+
:value="option.value"
|
|
35
63
|
>
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
64
|
+
<slot
|
|
65
|
+
name="option"
|
|
66
|
+
:option="option"
|
|
67
|
+
>
|
|
68
|
+
<Icon
|
|
69
|
+
v-if="option.icon"
|
|
70
|
+
:icon="option.icon"
|
|
71
|
+
/>
|
|
72
|
+
<span>{{ option.label }}</span>
|
|
73
|
+
</slot>
|
|
42
74
|
</CommandItem>
|
|
43
75
|
</CommandGroup>
|
|
44
76
|
</InputCombobox>
|
|
77
|
+
<InputGroupAddon v-if="field.icon">
|
|
78
|
+
<Icon
|
|
79
|
+
:icon="field.icon"
|
|
80
|
+
/>
|
|
81
|
+
</InputGroupAddon>
|
|
45
82
|
<InputGroupAddon
|
|
83
|
+
v-if="hasProperty(modelValue, field.path)"
|
|
46
84
|
align="inline-end"
|
|
47
85
|
>
|
|
48
86
|
<Tooltip :delay-duration="800">
|
|
49
|
-
<
|
|
50
|
-
<
|
|
51
|
-
<
|
|
87
|
+
<TooltipTrigger>
|
|
88
|
+
<InputGroupButton as-child>
|
|
89
|
+
<button
|
|
90
|
+
type="button"
|
|
91
|
+
@click="deleteProperty(modelValue, field.path)"
|
|
92
|
+
>
|
|
52
93
|
<Icon
|
|
53
94
|
icon="fluent:dismiss-20-regular"
|
|
54
95
|
/>
|
|
55
|
-
</
|
|
56
|
-
</
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
</
|
|
96
|
+
</button>
|
|
97
|
+
</InputGroupButton>
|
|
98
|
+
</TooltipTrigger>
|
|
99
|
+
<TooltipContent>
|
|
100
|
+
{{ t("clear") }}
|
|
101
|
+
</TooltipContent>
|
|
61
102
|
</Tooltip>
|
|
62
103
|
</InputGroupAddon>
|
|
63
104
|
</InputGroup>
|
|
64
|
-
<FieldLabel
|
|
65
|
-
|
|
105
|
+
<FieldLabel
|
|
106
|
+
v-if="isCheating"
|
|
107
|
+
class="font-mono"
|
|
108
|
+
>
|
|
109
|
+
{{ field.path }}
|
|
110
|
+
</FieldLabel>
|
|
111
|
+
<FieldLabel v-else>
|
|
112
|
+
{{ t(`${id}-${i}`) }}
|
|
66
113
|
</FieldLabel>
|
|
67
114
|
</Field>
|
|
68
115
|
</div>
|
|
@@ -1,10 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
1
|
+
import { Field } from './ui/field/index.js';
|
|
2
|
+
import type { ClassValue } from 'clsx';
|
|
3
|
+
type Option = Readonly<{
|
|
4
|
+
label: Record<string, string>;
|
|
5
|
+
value: string | number;
|
|
6
|
+
icon?: string;
|
|
7
|
+
}>;
|
|
8
|
+
type OptionsGroup = Readonly<{
|
|
9
|
+
label: Record<string, string>;
|
|
10
|
+
value: string | number;
|
|
11
|
+
options: ReadonlyArray<Option>;
|
|
12
|
+
}>;
|
|
13
|
+
type TextField = Readonly<{
|
|
14
|
+
type: 'string';
|
|
15
|
+
path: string;
|
|
16
|
+
label: Record<string, string>;
|
|
17
|
+
intial?: string;
|
|
18
|
+
icon?: string;
|
|
19
|
+
class?: ClassValue;
|
|
20
|
+
treatEmptyAsDifferentStateFromNull?: boolean;
|
|
21
|
+
}>;
|
|
22
|
+
type SelectField = Readonly<{
|
|
23
|
+
type: 'select';
|
|
24
|
+
path: string;
|
|
25
|
+
label: Record<string, string>;
|
|
26
|
+
intial?: string;
|
|
27
|
+
icon?: string;
|
|
28
|
+
options: ReadonlyArray<OptionsGroup>;
|
|
29
|
+
class?: ClassValue;
|
|
30
|
+
}>;
|
|
31
|
+
type Field = TextField | SelectField;
|
|
9
32
|
declare const _default: typeof __VLS_export;
|
|
10
33
|
export default _default;
|
|
34
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
35
|
+
fields: ReadonlyArray<Field>;
|
|
36
|
+
} & {
|
|
37
|
+
modelValue?: Record<string, unknown>;
|
|
38
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
39
|
+
"update:modelValue": (value: Record<string, unknown>) => any;
|
|
40
|
+
}, string, import("vue").PublicProps, Readonly<{
|
|
41
|
+
fields: ReadonlyArray<Field>;
|
|
42
|
+
} & {
|
|
43
|
+
modelValue?: Record<string, unknown>;
|
|
44
|
+
}> & Readonly<{
|
|
45
|
+
"onUpdate:modelValue"?: ((value: Record<string, unknown>) => any) | undefined;
|
|
46
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
47
|
+
option?: (props: {
|
|
48
|
+
option: Readonly<{
|
|
49
|
+
label: Record<string, string>;
|
|
50
|
+
value: string | number;
|
|
51
|
+
icon?: string;
|
|
52
|
+
}>;
|
|
53
|
+
}) => any;
|
|
54
|
+
}>;
|
|
55
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
56
|
+
new (): {
|
|
57
|
+
$slots: S;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
@@ -11,11 +11,11 @@ export type Accessor = string | Readonly<{
|
|
|
11
11
|
}>;
|
|
12
12
|
export type Column = Readonly<{
|
|
13
13
|
id?: string;
|
|
14
|
-
title?: string
|
|
14
|
+
title?: Record<string, string>;
|
|
15
15
|
accessor?: Accessor;
|
|
16
16
|
accessorKey?: string;
|
|
17
17
|
renderer?: Render;
|
|
18
|
-
tooltip?: string
|
|
18
|
+
tooltip?: Record<string, string>;
|
|
19
19
|
size?: number;
|
|
20
20
|
enableSorting?: boolean;
|
|
21
21
|
enableMultiSorting?: boolean;
|
|
@@ -4,12 +4,15 @@ import { useVirtualizer } from "@tanstack/vue-virtual";
|
|
|
4
4
|
import { Icon } from "@iconify/vue";
|
|
5
5
|
import { getProperty } from "dot-prop";
|
|
6
6
|
import { Pagination } from "reka-ui/namespaced";
|
|
7
|
+
import { useI18n } from "vue-i18n";
|
|
7
8
|
import { computed, ref } from "vue";
|
|
8
9
|
import { useNuxtApp } from "#app";
|
|
9
10
|
import { Button } from "./ui/button";
|
|
11
|
+
import { NumberField, NumberFieldInput } from "./ui/number-field";
|
|
10
12
|
import { Tooltip, TooltipContent, TooltipTrigger } from "./ui/tooltip";
|
|
11
13
|
import { useTableRenderers } from "../composables/useTableRenderers";
|
|
12
14
|
import { useCheating } from "#imports";
|
|
15
|
+
import { defu } from "defu";
|
|
13
16
|
</script>
|
|
14
17
|
|
|
15
18
|
<script setup>
|
|
@@ -26,6 +29,23 @@ const props = defineProps({
|
|
|
26
29
|
paginationLeft: { type: String, required: false },
|
|
27
30
|
paginationRight: { type: String, required: false }
|
|
28
31
|
});
|
|
32
|
+
const { t } = useI18n({
|
|
33
|
+
messages: props.columns.reduce((acc, column) => {
|
|
34
|
+
function f(column2) {
|
|
35
|
+
return defu(
|
|
36
|
+
acc,
|
|
37
|
+
Object.fromEntries(
|
|
38
|
+
Object.entries(
|
|
39
|
+
column2.title ?? {}
|
|
40
|
+
).map(([locale, message]) => [locale, { [genColumnId(column2)]: message }])
|
|
41
|
+
),
|
|
42
|
+
column2.tooltip ? Object.fromEntries(Object.entries(column2.tooltip).map(([locale, message]) => [locale, { [`${genColumnId(column2)}-tooltip`]: message }])) : {},
|
|
43
|
+
...column2.columns?.map((column3) => f(column3)) ?? []
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
return f(column);
|
|
47
|
+
}, {})
|
|
48
|
+
});
|
|
29
49
|
const slots = defineSlots();
|
|
30
50
|
const { $dsl } = useNuxtApp();
|
|
31
51
|
const isCheating = useCheating();
|
|
@@ -36,6 +56,8 @@ function genColumnId(column) {
|
|
|
36
56
|
return column.accessor;
|
|
37
57
|
} else if (column.accessor) {
|
|
38
58
|
return column.accessor.read;
|
|
59
|
+
} else if (column.id) {
|
|
60
|
+
return column.id;
|
|
39
61
|
}
|
|
40
62
|
return crypto.randomUUID();
|
|
41
63
|
}
|
|
@@ -43,14 +65,14 @@ function translate(column) {
|
|
|
43
65
|
if (Array.isArray(column.columns) && column.columns.length > 0) {
|
|
44
66
|
return {
|
|
45
67
|
id: column.id ?? genColumnId(column),
|
|
46
|
-
header: column
|
|
68
|
+
header: t(genColumnId(column)),
|
|
47
69
|
columns: column.columns?.map((column2) => translate(column2)) ?? [],
|
|
48
70
|
enableSorting: column.enableSorting ?? false,
|
|
49
71
|
enableMultiSort: column.enableMultiSorting,
|
|
50
72
|
enablePinning: column.enablePinning,
|
|
51
73
|
size: column.size,
|
|
52
74
|
meta: {
|
|
53
|
-
tooltip: column.tooltip,
|
|
75
|
+
tooltip: column.tooltip ? `${genColumnId(column)}-tooltip` : void 0,
|
|
54
76
|
grow: column.grow ?? false
|
|
55
77
|
}
|
|
56
78
|
};
|
|
@@ -59,7 +81,7 @@ function translate(column) {
|
|
|
59
81
|
const options = renderer.parseOptions(column.renderer && typeof column.renderer === "object" && "props" in column.renderer ? column.renderer.props : null);
|
|
60
82
|
return {
|
|
61
83
|
id: column.id ?? genColumnId(column),
|
|
62
|
-
header: (ctx) => renderer.header?.({ ctx, options }) ?? column
|
|
84
|
+
header: (ctx) => renderer.header?.({ ctx, options }) ?? t(genColumnId(column)),
|
|
63
85
|
cell: (ctx) => {
|
|
64
86
|
if (ctx.column.id in slots) {
|
|
65
87
|
return slots[ctx.column.id]?.({ cell: ctx });
|
|
@@ -89,7 +111,7 @@ function translate(column) {
|
|
|
89
111
|
size: column.size,
|
|
90
112
|
columns: column.columns?.map((column2) => translate(column2)) ?? [],
|
|
91
113
|
meta: {
|
|
92
|
-
tooltip: column.tooltip,
|
|
114
|
+
tooltip: column.tooltip ? `${genColumnId(column)}-tooltip` : void 0,
|
|
93
115
|
grow: column.grow ?? false
|
|
94
116
|
},
|
|
95
117
|
...renderer.columnDefOverrides
|
|
@@ -305,19 +327,38 @@ function getSortIcon(column) {
|
|
|
305
327
|
align="center"
|
|
306
328
|
side="top"
|
|
307
329
|
>
|
|
308
|
-
<span v-html="$md.inline`${header.column.
|
|
330
|
+
<span v-html="$md.inline`${t(`${header.column.id}-tooltip`)}`()" />
|
|
309
331
|
</TooltipContent>
|
|
310
332
|
</Tooltip>
|
|
311
333
|
|
|
312
|
-
<
|
|
334
|
+
<Tooltip
|
|
313
335
|
v-if="!header.isPlaceholder && header.column.getCanSort()"
|
|
314
|
-
|
|
315
|
-
size="xs"
|
|
316
|
-
class="absolute hover:bg-transparent right-1 top-1/2 -translate-y-1/2 transform-3d group-hover:opacity-100 opacity-60 transition-opacity duration-180"
|
|
317
|
-
@click="(event) => header.column.getToggleSortingHandler()?.(event)"
|
|
336
|
+
:delay-duration="800"
|
|
318
337
|
>
|
|
319
|
-
<
|
|
320
|
-
|
|
338
|
+
<TooltipTrigger as-child>
|
|
339
|
+
<Button
|
|
340
|
+
variant="ghost"
|
|
341
|
+
size="xs"
|
|
342
|
+
:class="[
|
|
343
|
+
'absolute hover:bg-transparent right-1 top-1/2 -translate-y-1/2 transform-3d transition-opacity duration-180',
|
|
344
|
+
!header.column.getIsSorted() ? 'opacity-30 hover:opacity-60' : 'text-(--primary)/80 hover:text-(--primary)'
|
|
345
|
+
]"
|
|
346
|
+
as-child
|
|
347
|
+
>
|
|
348
|
+
<button
|
|
349
|
+
type="button"
|
|
350
|
+
@click="header.column.getToggleSortingHandler()?.($event)"
|
|
351
|
+
>
|
|
352
|
+
<Icon :icon="getSortIcon(header.column)" />
|
|
353
|
+
</button>
|
|
354
|
+
</Button>
|
|
355
|
+
</TooltipTrigger>
|
|
356
|
+
<TooltipContent>
|
|
357
|
+
{{
|
|
358
|
+
header.column.getIsSorted() ? t(`table-sort-${header.column.getIsSorted()}`) : t("table-sort-unsorted")
|
|
359
|
+
}}
|
|
360
|
+
</TooltipContent>
|
|
361
|
+
</Tooltip>
|
|
321
362
|
|
|
322
363
|
<div
|
|
323
364
|
v-if="!header.isPlaceholder && header.column.getCanResize() && (!header.column.getIsLastColumn('right') || !table.getIsSomeColumnsPinned('right') && !header.column.getIsLastColumn('center'))"
|
|
@@ -437,7 +478,15 @@ function getSortIcon(column) {
|
|
|
437
478
|
|
|
438
479
|
</div>
|
|
439
480
|
<div class="flex items-center gap-4">
|
|
440
|
-
<
|
|
481
|
+
<i18n-t
|
|
482
|
+
keypath="total"
|
|
483
|
+
tag="span"
|
|
484
|
+
class="text-xs"
|
|
485
|
+
>
|
|
486
|
+
<template #count>
|
|
487
|
+
<strong>{{ props.data.length }}</strong>
|
|
488
|
+
</template>
|
|
489
|
+
</i18n-t>
|
|
441
490
|
<Pagination.Root
|
|
442
491
|
show-edges
|
|
443
492
|
:total="props.data.length"
|
|
@@ -480,7 +529,7 @@ function getSortIcon(column) {
|
|
|
480
529
|
v-if="page.type === 'page'"
|
|
481
530
|
:class="[
|
|
482
531
|
'w-7 h-7 flex items-center justify-center rounded text-xs bg-transparent',
|
|
483
|
-
'data-selected:text-(--primary)
|
|
532
|
+
'data-selected:text-(--primary) hover:bg-zinc-100 transition cursor-pointer'
|
|
484
533
|
]"
|
|
485
534
|
:value="page.value"
|
|
486
535
|
>
|
|
@@ -518,7 +567,22 @@ function getSortIcon(column) {
|
|
|
518
567
|
</Pagination.Last>
|
|
519
568
|
</Pagination.List>
|
|
520
569
|
</Pagination.Root>
|
|
521
|
-
<
|
|
570
|
+
<i18n-t
|
|
571
|
+
keypath="goto"
|
|
572
|
+
tag="div"
|
|
573
|
+
class="text-xs flex items-center gap-2"
|
|
574
|
+
>
|
|
575
|
+
<template #page>
|
|
576
|
+
<NumberField
|
|
577
|
+
:model-value="table.getState().pagination.pageIndex + 1"
|
|
578
|
+
:min="1"
|
|
579
|
+
:max="Math.ceil(props.data.length / table.getState().pagination.pageSize)"
|
|
580
|
+
@update:model-value="(value) => table.setPageIndex(value - 1)"
|
|
581
|
+
>
|
|
582
|
+
<NumberFieldInput class="h-6 w-16 text-xs" />
|
|
583
|
+
</NumberField>
|
|
584
|
+
</template>
|
|
585
|
+
</i18n-t>
|
|
522
586
|
</div>
|
|
523
587
|
<div
|
|
524
588
|
:class="[
|
|
@@ -541,3 +605,29 @@ function getSortIcon(column) {
|
|
|
541
605
|
</div>
|
|
542
606
|
</div>
|
|
543
607
|
</template>
|
|
608
|
+
|
|
609
|
+
<i18n lang="json">
|
|
610
|
+
{
|
|
611
|
+
"zh": {
|
|
612
|
+
"total": "共 {count} 条",
|
|
613
|
+
"goto": "前往 {page} 页",
|
|
614
|
+
"table-sort-asc": "升序",
|
|
615
|
+
"table-sort-desc": "降序",
|
|
616
|
+
"table-sort-unsorted": "未排序"
|
|
617
|
+
},
|
|
618
|
+
"ja": {
|
|
619
|
+
"total": "合計 {count} 件",
|
|
620
|
+
"goto": "ページ {page} に移動",
|
|
621
|
+
"table-sort-asc": "昇順",
|
|
622
|
+
"table-sort-desc": "降順",
|
|
623
|
+
"table-sort-unsorted": "未排序"
|
|
624
|
+
},
|
|
625
|
+
"en": {
|
|
626
|
+
"total": "Total {count} items",
|
|
627
|
+
"goto": "Go to page {page}",
|
|
628
|
+
"table-sort-asc": "Ascending",
|
|
629
|
+
"table-sort-desc": "Descending",
|
|
630
|
+
"table-sort-unsorted": "Unsorted"
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
</i18n>
|
|
@@ -11,11 +11,11 @@ export type Accessor = string | Readonly<{
|
|
|
11
11
|
}>;
|
|
12
12
|
export type Column = Readonly<{
|
|
13
13
|
id?: string;
|
|
14
|
-
title?: string
|
|
14
|
+
title?: Record<string, string>;
|
|
15
15
|
accessor?: Accessor;
|
|
16
16
|
accessorKey?: string;
|
|
17
17
|
renderer?: Render;
|
|
18
|
-
tooltip?: string
|
|
18
|
+
tooltip?: Record<string, string>;
|
|
19
19
|
size?: number;
|
|
20
20
|
enableSorting?: boolean;
|
|
21
21
|
enableMultiSorting?: boolean;
|
|
@@ -17,7 +17,7 @@ export const fieldVariants = cva(
|
|
|
17
17
|
],
|
|
18
18
|
floating: [
|
|
19
19
|
"relative *:data-[slot=field-label]:absolute *:data-[slot=field-label]:text-zinc-500",
|
|
20
|
-
"*:data-[slot=field-label]:top-1/2 *:data-[slot=field-label]:-translate-1/2 *:data-[slot=field-label]:transition-all *:data-[slot=field-label]:duration-180",
|
|
20
|
+
"*:data-[slot=field-label]:top-1/2 *:data-[slot=field-label]:-translate-y-1/2 *:data-[slot=field-label]:transition-all *:data-[slot=field-label]:duration-180",
|
|
21
21
|
"*:data-[slot=field-label]:pointer-events-none *:data-[slot=field-label]:select-none *:data-[slot=field-label]:cursor-text",
|
|
22
22
|
"has-data-[value=true]:**:data-[slot=field-label]:top-0",
|
|
23
23
|
"**:data-[slot=field-label]:bg-white",
|
|
@@ -30,8 +30,8 @@ export const fieldVariants = cva(
|
|
|
30
30
|
"has-[[data-slot=input-group-control]:focus]:**:data-[slot=field-label]:text-zinc-700",
|
|
31
31
|
"has-data-[state=open]:**:data-[slot=field-label]:text-zinc-700",
|
|
32
32
|
"has-data-[value=true]:**:data-[slot=field-label]:text-zinc-700",
|
|
33
|
-
"*:data-[slot=field-label]:left-
|
|
34
|
-
"has-[[data-slot=input-group-addon][data-align=inline-start]]:**:data-[slot=field-label]:left-
|
|
33
|
+
"*:data-[slot=field-label]:left-3",
|
|
34
|
+
"has-[[data-slot=input-group-addon][data-align=inline-start]]:**:data-[slot=field-label]:left-7"
|
|
35
35
|
]
|
|
36
36
|
}
|
|
37
37
|
},
|
|
@@ -3,6 +3,7 @@ type __VLS_Props = {
|
|
|
3
3
|
defaultValue?: string | number;
|
|
4
4
|
modelValue?: string | number;
|
|
5
5
|
class?: HTMLAttributes['class'];
|
|
6
|
+
treatEmptyAsDifferentStateFromNull?: boolean;
|
|
6
7
|
};
|
|
7
8
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
8
9
|
"update:modelValue": (payload: string | number) => any;
|
|
@@ -4,7 +4,8 @@ import { cn } from "../../../utils/cn";
|
|
|
4
4
|
const props = defineProps({
|
|
5
5
|
defaultValue: { type: [String, Number], required: false },
|
|
6
6
|
modelValue: { type: [String, Number], required: false },
|
|
7
|
-
class: { type: null, required: false }
|
|
7
|
+
class: { type: null, required: false },
|
|
8
|
+
treatEmptyAsDifferentStateFromNull: { type: Boolean, required: false }
|
|
8
9
|
});
|
|
9
10
|
const emits = defineEmits(["update:modelValue"]);
|
|
10
11
|
const modelValue = useVModel(props, "modelValue", emits, {
|
|
@@ -17,7 +18,7 @@ const modelValue = useVModel(props, "modelValue", emits, {
|
|
|
17
18
|
<input
|
|
18
19
|
v-model="modelValue"
|
|
19
20
|
data-slot="input"
|
|
20
|
-
:data-value="!!modelValue"
|
|
21
|
+
:data-value="!treatEmptyAsDifferentStateFromNull ? !!modelValue : modelValue !== void 0"
|
|
21
22
|
:class="cn(
|
|
22
23
|
'file:text-zinc-700 placeholder:text-zinc-700 border-zinc-200 h-9 w-full min-w-0 rounded border bg-transparent px-3 py-1 text-base transition-colors ease-out duration-180 outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',
|
|
23
24
|
'aria-invalid:border-red-400 hover:border-zinc-300 focus-visible:border-(--primary)',
|
|
@@ -3,6 +3,7 @@ type __VLS_Props = {
|
|
|
3
3
|
defaultValue?: string | number;
|
|
4
4
|
modelValue?: string | number;
|
|
5
5
|
class?: HTMLAttributes['class'];
|
|
6
|
+
treatEmptyAsDifferentStateFromNull?: boolean;
|
|
6
7
|
};
|
|
7
8
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
8
9
|
"update:modelValue": (payload: string | number) => any;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { type PopoverContentProps } from 'reka-ui';
|
|
1
2
|
declare var __VLS_48: {};
|
|
2
3
|
type __VLS_Slots = {} & {
|
|
3
4
|
default?: (props: typeof __VLS_48) => any;
|
|
4
5
|
};
|
|
5
|
-
declare const __VLS_base: import("vue").DefineComponent<
|
|
6
|
+
declare const __VLS_base: import("vue").DefineComponent<PopoverContentProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<PopoverContentProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
7
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
7
8
|
declare const _default: typeof __VLS_export;
|
|
8
9
|
export default _default;
|
|
@@ -4,7 +4,34 @@ import { Command, CommandList, CommandEmpty } from "../command";
|
|
|
4
4
|
import InputComboboxInput from "./InputComboboxInput.vue";
|
|
5
5
|
import { useI18n } from "vue-i18n";
|
|
6
6
|
import { Icon } from "@iconify/vue";
|
|
7
|
+
import { useForwardProps } from "reka-ui";
|
|
8
|
+
import { getInputGroupReference } from ".";
|
|
7
9
|
const { t } = useI18n();
|
|
10
|
+
const props = defineProps({
|
|
11
|
+
forceMount: { type: Boolean, required: false },
|
|
12
|
+
side: { type: null, required: false },
|
|
13
|
+
sideOffset: { type: Number, required: false },
|
|
14
|
+
sideFlip: { type: Boolean, required: false },
|
|
15
|
+
align: { type: null, required: false },
|
|
16
|
+
alignOffset: { type: Number, required: false },
|
|
17
|
+
alignFlip: { type: Boolean, required: false },
|
|
18
|
+
avoidCollisions: { type: Boolean, required: false },
|
|
19
|
+
collisionBoundary: { type: null, required: false },
|
|
20
|
+
collisionPadding: { type: [Number, Object], required: false },
|
|
21
|
+
arrowPadding: { type: Number, required: false },
|
|
22
|
+
hideShiftedArrow: { type: Boolean, required: false },
|
|
23
|
+
sticky: { type: String, required: false },
|
|
24
|
+
hideWhenDetached: { type: Boolean, required: false },
|
|
25
|
+
positionStrategy: { type: String, required: false },
|
|
26
|
+
updatePositionStrategy: { type: String, required: false },
|
|
27
|
+
disableUpdateOnLayoutShift: { type: Boolean, required: false },
|
|
28
|
+
prioritizePosition: { type: Boolean, required: false },
|
|
29
|
+
reference: { type: null, required: false },
|
|
30
|
+
asChild: { type: Boolean, required: false },
|
|
31
|
+
as: { type: null, required: false },
|
|
32
|
+
disableOutsidePointerEvents: { type: Boolean, required: false }
|
|
33
|
+
});
|
|
34
|
+
const forwarded = useForwardProps(props);
|
|
8
35
|
</script>
|
|
9
36
|
|
|
10
37
|
<template>
|
|
@@ -17,7 +44,8 @@ const { t } = useI18n();
|
|
|
17
44
|
<InputComboboxInput />
|
|
18
45
|
</PopoverTrigger>
|
|
19
46
|
<PopoverContent
|
|
20
|
-
|
|
47
|
+
v-bind="forwarded"
|
|
48
|
+
:reference="getInputGroupReference().value ?? void 0"
|
|
21
49
|
:style="{
|
|
22
50
|
minWidth: 'var(--reka-popover-trigger-width)'
|
|
23
51
|
}"
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { type PopoverContentProps } from 'reka-ui';
|
|
1
2
|
declare var __VLS_48: {};
|
|
2
3
|
type __VLS_Slots = {} & {
|
|
3
4
|
default?: (props: typeof __VLS_48) => any;
|
|
4
5
|
};
|
|
5
|
-
declare const __VLS_base: import("vue").DefineComponent<
|
|
6
|
+
declare const __VLS_base: import("vue").DefineComponent<PopoverContentProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<PopoverContentProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
7
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
7
8
|
declare const _default: typeof __VLS_export;
|
|
8
9
|
export default _default;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
+
import { useTemplateRef } from "vue";
|
|
2
3
|
import { cn } from "../../../utils/cn";
|
|
4
|
+
import { setInputGroupReference } from ".";
|
|
3
5
|
const props = defineProps({
|
|
4
6
|
class: { type: null, required: false }
|
|
5
7
|
});
|
|
8
|
+
setInputGroupReference(useTemplateRef("input-group"));
|
|
6
9
|
</script>
|
|
7
10
|
|
|
8
11
|
<template>
|
|
9
12
|
<div
|
|
13
|
+
ref="input-group"
|
|
10
14
|
data-slot="input-group"
|
|
11
15
|
role="group"
|
|
12
16
|
:class="cn(
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { HTMLAttributes } from 'vue';
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
class?: HTMLAttributes['class'];
|
|
4
|
+
treatEmptyAsDifferentStateFromNull?: boolean;
|
|
4
5
|
};
|
|
5
6
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
7
|
declare const _default: typeof __VLS_export;
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import { cn } from "../../../utils/cn";
|
|
3
3
|
import { Input } from "../input";
|
|
4
4
|
const props = defineProps({
|
|
5
|
-
class: { type: null, required: false }
|
|
5
|
+
class: { type: null, required: false },
|
|
6
|
+
treatEmptyAsDifferentStateFromNull: { type: Boolean, required: false }
|
|
6
7
|
});
|
|
7
8
|
</script>
|
|
8
9
|
|
|
@@ -10,6 +11,7 @@ const props = defineProps({
|
|
|
10
11
|
<Input
|
|
11
12
|
ref="input"
|
|
12
13
|
data-slot="input-group-control"
|
|
14
|
+
:treat-empty-as-different-state-from-null="treatEmptyAsDifferentStateFromNull"
|
|
13
15
|
:class="cn(
|
|
14
16
|
'flex-1 rounded-none border-0 bg-transparent shadow-none dark:bg-transparent peer',
|
|
15
17
|
props.class
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { HTMLAttributes } from 'vue';
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
class?: HTMLAttributes['class'];
|
|
4
|
+
treatEmptyAsDifferentStateFromNull?: boolean;
|
|
4
5
|
};
|
|
5
6
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
7
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import type { ShallowRef } from 'vue';
|
|
2
3
|
export { default as InputGroup } from './InputGroup.vue.js';
|
|
3
4
|
export { default as InputGroupAddon } from './InputGroupAddon.vue.js';
|
|
4
5
|
export { default as InputGroupButton } from './InputGroupButton.vue.js';
|
|
@@ -14,3 +15,4 @@ export declare const inputGroupButtonVariants: (props?: ({
|
|
|
14
15
|
size?: "sm" | "xs" | "icon-xs" | "icon-sm" | null | undefined;
|
|
15
16
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
16
17
|
export type InputGroupButtonVariants = VariantProps<typeof inputGroupButtonVariants>;
|
|
18
|
+
export declare const getInputGroupReference: <T extends ShallowRef<HTMLDivElement | null> | null | undefined = ShallowRef<HTMLDivElement | null>>(fallback?: T | undefined) => T extends null ? ShallowRef<HTMLDivElement | null> | null : ShallowRef<HTMLDivElement | null>, setInputGroupReference: (contextValue: ShallowRef<HTMLDivElement | null>) => ShallowRef<HTMLDivElement | null>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { cva } from "class-variance-authority";
|
|
2
|
+
import { createContext } from "reka-ui";
|
|
2
3
|
export { default as InputGroup } from "./InputGroup.vue";
|
|
3
4
|
export { default as InputGroupAddon } from "./InputGroupAddon.vue";
|
|
4
5
|
export { default as InputGroupButton } from "./InputGroupButton.vue";
|
|
@@ -38,3 +39,4 @@ export const inputGroupButtonVariants = cva(
|
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
);
|
|
42
|
+
export const [getInputGroupReference, setInputGroupReference] = createContext("InputGroup");
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { NumberFieldRootProps } from 'reka-ui';
|
|
2
|
+
import type { HTMLAttributes } from 'vue';
|
|
3
|
+
type __VLS_Props = NumberFieldRootProps & {
|
|
4
|
+
class?: HTMLAttributes['class'];
|
|
5
|
+
};
|
|
6
|
+
declare var __VLS_8: {
|
|
7
|
+
modelValue: number | undefined;
|
|
8
|
+
textValue: string;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_Slots = {} & {
|
|
11
|
+
default?: (props: typeof __VLS_8) => any;
|
|
12
|
+
};
|
|
13
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
14
|
+
"update:modelValue": (val: number) => any;
|
|
15
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
16
|
+
"onUpdate:modelValue"?: ((val: number) => any) | undefined;
|
|
17
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
21
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
22
|
+
new (): {
|
|
23
|
+
$slots: S;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { reactiveOmit } from "@vueuse/core";
|
|
3
|
+
import { NumberFieldRoot, useForwardPropsEmits } from "reka-ui";
|
|
4
|
+
import { cn } from "../../../utils/cn";
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
defaultValue: { type: Number, required: false },
|
|
7
|
+
modelValue: { type: [Number, null], required: false },
|
|
8
|
+
min: { type: Number, required: false },
|
|
9
|
+
max: { type: Number, required: false },
|
|
10
|
+
step: { type: Number, required: false },
|
|
11
|
+
stepSnapping: { type: Boolean, required: false },
|
|
12
|
+
focusOnChange: { type: Boolean, required: false },
|
|
13
|
+
formatOptions: { type: null, required: false },
|
|
14
|
+
locale: { type: String, required: false },
|
|
15
|
+
disabled: { type: Boolean, required: false },
|
|
16
|
+
readonly: { type: Boolean, required: false },
|
|
17
|
+
disableWheelChange: { type: Boolean, required: false },
|
|
18
|
+
invertWheelChange: { type: Boolean, required: false },
|
|
19
|
+
id: { type: String, required: false },
|
|
20
|
+
asChild: { type: Boolean, required: false },
|
|
21
|
+
as: { type: null, required: false },
|
|
22
|
+
name: { type: String, required: false },
|
|
23
|
+
required: { type: Boolean, required: false },
|
|
24
|
+
class: { type: null, required: false }
|
|
25
|
+
});
|
|
26
|
+
const emits = defineEmits(["update:modelValue"]);
|
|
27
|
+
const delegatedProps = reactiveOmit(props, "class");
|
|
28
|
+
const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<template>
|
|
32
|
+
<NumberFieldRoot
|
|
33
|
+
v-slot="slotProps"
|
|
34
|
+
v-bind="forwarded"
|
|
35
|
+
:class="cn('grid gap-1.5', props.class)"
|
|
36
|
+
>
|
|
37
|
+
<slot v-bind="slotProps" />
|
|
38
|
+
</NumberFieldRoot>
|
|
39
|
+
</template>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { NumberFieldRootProps } from 'reka-ui';
|
|
2
|
+
import type { HTMLAttributes } from 'vue';
|
|
3
|
+
type __VLS_Props = NumberFieldRootProps & {
|
|
4
|
+
class?: HTMLAttributes['class'];
|
|
5
|
+
};
|
|
6
|
+
declare var __VLS_8: {
|
|
7
|
+
modelValue: number | undefined;
|
|
8
|
+
textValue: string;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_Slots = {} & {
|
|
11
|
+
default?: (props: typeof __VLS_8) => any;
|
|
12
|
+
};
|
|
13
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
14
|
+
"update:modelValue": (val: number) => any;
|
|
15
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
16
|
+
"onUpdate:modelValue"?: ((val: number) => any) | undefined;
|
|
17
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
21
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
22
|
+
new (): {
|
|
23
|
+
$slots: S;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'vue';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
class?: HTMLAttributes['class'];
|
|
4
|
+
};
|
|
5
|
+
declare var __VLS_1: {};
|
|
6
|
+
type __VLS_Slots = {} & {
|
|
7
|
+
default?: (props: typeof __VLS_1) => any;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
13
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
14
|
+
new (): {
|
|
15
|
+
$slots: S;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { cn } from "../../../utils/cn";
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
class: { type: null, required: false }
|
|
5
|
+
});
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<div :class="cn('relative *:data-[slot=input]:has-*:data-[slot=increment]:pr-5 *:data-[slot=input]:has-*:data-[slot=decrement]:pl-5', props.class)">
|
|
10
|
+
<slot />
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'vue';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
class?: HTMLAttributes['class'];
|
|
4
|
+
};
|
|
5
|
+
declare var __VLS_1: {};
|
|
6
|
+
type __VLS_Slots = {} & {
|
|
7
|
+
default?: (props: typeof __VLS_1) => any;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
13
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
14
|
+
new (): {
|
|
15
|
+
$slots: S;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { NumberFieldDecrementProps } from 'reka-ui';
|
|
2
|
+
import type { HTMLAttributes } from 'vue';
|
|
3
|
+
type __VLS_Props = NumberFieldDecrementProps & {
|
|
4
|
+
class?: HTMLAttributes['class'];
|
|
5
|
+
};
|
|
6
|
+
declare var __VLS_8: {};
|
|
7
|
+
type __VLS_Slots = {} & {
|
|
8
|
+
default?: (props: typeof __VLS_8) => any;
|
|
9
|
+
};
|
|
10
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
export default _default;
|
|
14
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
15
|
+
new (): {
|
|
16
|
+
$slots: S;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { reactiveOmit } from "@vueuse/core";
|
|
3
|
+
import { Icon } from "@iconify/vue";
|
|
4
|
+
import { NumberFieldDecrement, useForwardProps } from "reka-ui";
|
|
5
|
+
import { cn } from "../../../utils/cn";
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
disabled: { type: Boolean, required: false },
|
|
8
|
+
asChild: { type: Boolean, required: false },
|
|
9
|
+
as: { type: null, required: false },
|
|
10
|
+
class: { type: null, required: false }
|
|
11
|
+
});
|
|
12
|
+
const delegatedProps = reactiveOmit(props, "class");
|
|
13
|
+
const forwarded = useForwardProps(delegatedProps);
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<NumberFieldDecrement
|
|
18
|
+
data-slot="decrement"
|
|
19
|
+
v-bind="forwarded"
|
|
20
|
+
:class="cn('absolute top-1/2 -translate-y-1/2 left-0 p-3 disabled:cursor-not-allowed disabled:opacity-20', props.class)"
|
|
21
|
+
>
|
|
22
|
+
<slot>
|
|
23
|
+
<Icon
|
|
24
|
+
icon="radix-icons:minus"
|
|
25
|
+
class="size-4"
|
|
26
|
+
/>
|
|
27
|
+
</slot>
|
|
28
|
+
</NumberFieldDecrement>
|
|
29
|
+
</template>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { NumberFieldDecrementProps } from 'reka-ui';
|
|
2
|
+
import type { HTMLAttributes } from 'vue';
|
|
3
|
+
type __VLS_Props = NumberFieldDecrementProps & {
|
|
4
|
+
class?: HTMLAttributes['class'];
|
|
5
|
+
};
|
|
6
|
+
declare var __VLS_8: {};
|
|
7
|
+
type __VLS_Slots = {} & {
|
|
8
|
+
default?: (props: typeof __VLS_8) => any;
|
|
9
|
+
};
|
|
10
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
export default _default;
|
|
14
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
15
|
+
new (): {
|
|
16
|
+
$slots: S;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { NumberFieldIncrementProps } from 'reka-ui';
|
|
2
|
+
import type { HTMLAttributes } from 'vue';
|
|
3
|
+
type __VLS_Props = NumberFieldIncrementProps & {
|
|
4
|
+
class?: HTMLAttributes['class'];
|
|
5
|
+
};
|
|
6
|
+
declare var __VLS_8: {};
|
|
7
|
+
type __VLS_Slots = {} & {
|
|
8
|
+
default?: (props: typeof __VLS_8) => any;
|
|
9
|
+
};
|
|
10
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
export default _default;
|
|
14
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
15
|
+
new (): {
|
|
16
|
+
$slots: S;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { reactiveOmit } from "@vueuse/core";
|
|
3
|
+
import { Icon } from "@iconify/vue";
|
|
4
|
+
import { NumberFieldIncrement, useForwardProps } from "reka-ui";
|
|
5
|
+
import { cn } from "../../../utils/cn";
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
disabled: { type: Boolean, required: false },
|
|
8
|
+
asChild: { type: Boolean, required: false },
|
|
9
|
+
as: { type: null, required: false },
|
|
10
|
+
class: { type: null, required: false }
|
|
11
|
+
});
|
|
12
|
+
const delegatedProps = reactiveOmit(props, "class");
|
|
13
|
+
const forwarded = useForwardProps(delegatedProps);
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<NumberFieldIncrement
|
|
18
|
+
data-slot="increment"
|
|
19
|
+
v-bind="forwarded"
|
|
20
|
+
:class="cn('absolute top-1/2 -translate-y-1/2 right-0 disabled:cursor-not-allowed disabled:opacity-20 p-3', props.class)"
|
|
21
|
+
>
|
|
22
|
+
<slot>
|
|
23
|
+
<Icon
|
|
24
|
+
icon="radix-icons:plus"
|
|
25
|
+
class="size-4"
|
|
26
|
+
/>
|
|
27
|
+
</slot>
|
|
28
|
+
</NumberFieldIncrement>
|
|
29
|
+
</template>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { NumberFieldIncrementProps } from 'reka-ui';
|
|
2
|
+
import type { HTMLAttributes } from 'vue';
|
|
3
|
+
type __VLS_Props = NumberFieldIncrementProps & {
|
|
4
|
+
class?: HTMLAttributes['class'];
|
|
5
|
+
};
|
|
6
|
+
declare var __VLS_8: {};
|
|
7
|
+
type __VLS_Slots = {} & {
|
|
8
|
+
default?: (props: typeof __VLS_8) => any;
|
|
9
|
+
};
|
|
10
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
export default _default;
|
|
14
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
15
|
+
new (): {
|
|
16
|
+
$slots: S;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'vue';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
class?: HTMLAttributes['class'];
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { NumberFieldInput } from "reka-ui";
|
|
3
|
+
import { cn } from "../../../utils/cn";
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
class: { type: null, required: false }
|
|
6
|
+
});
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<NumberFieldInput
|
|
11
|
+
data-slot="input"
|
|
12
|
+
:class="cn('flex h-9 w-full rounded border border-zinc-200 hover:border-zinc-300 focus-visible:border-[color-mix(in_srgb,var(--primary)_60%,white)] bg-transparent py-1 text-sm text-center shadow-sm transition-colors duration-180 placeholder:text-zinc-700 outline-none disabled:cursor-not-allowed disabled:opacity-50', props.class)"
|
|
13
|
+
/>
|
|
14
|
+
</template>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'vue';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
class?: HTMLAttributes['class'];
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as NumberField } from './NumberField.vue.js';
|
|
2
|
+
export { default as NumberFieldContent } from './NumberFieldContent.vue.js';
|
|
3
|
+
export { default as NumberFieldDecrement } from './NumberFieldDecrement.vue.js';
|
|
4
|
+
export { default as NumberFieldIncrement } from './NumberFieldIncrement.vue.js';
|
|
5
|
+
export { default as NumberFieldInput } from './NumberFieldInput.vue.js';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as NumberField } from "./NumberField.vue";
|
|
2
|
+
export { default as NumberFieldContent } from "./NumberFieldContent.vue";
|
|
3
|
+
export { default as NumberFieldDecrement } from "./NumberFieldDecrement.vue";
|
|
4
|
+
export { default as NumberFieldIncrement } from "./NumberFieldIncrement.vue";
|
|
5
|
+
export { default as NumberFieldInput } from "./NumberFieldInput.vue";
|
|
@@ -46,7 +46,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
|
46
46
|
v-bind="{ ...$attrs, ...forwarded }"
|
|
47
47
|
:class="
|
|
48
48
|
cn(
|
|
49
|
-
'bg-white text-zinc-700 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded border border-zinc-200
|
|
49
|
+
'bg-white text-zinc-700 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded border border-zinc-200 shadow-md origin-(--reka-popover-content-transform-origin) outline-hidden',
|
|
50
50
|
props.class
|
|
51
51
|
)
|
|
52
52
|
"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shwfed/nuxt",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.30",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"dot-prop": "^10.1.0",
|
|
54
54
|
"effect": "^3.19.15",
|
|
55
55
|
"markdown-it": "^14.1.0",
|
|
56
|
+
"mutative": "^1.3.0",
|
|
56
57
|
"reka-ui": "^2.7.0",
|
|
57
58
|
"tailwind-merge": "^3.4.0",
|
|
58
59
|
"vue": "^3.5.27",
|