@shwfed/nuxt 0.7.9 → 0.7.10
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/app.d.vue.ts +7 -56
- package/dist/runtime/components/app.vue +17 -404
- package/dist/runtime/components/app.vue.d.ts +7 -56
- package/dist/runtime/components/fields.d.vue.ts +154 -132
- package/dist/runtime/components/fields.vue +30 -295
- package/dist/runtime/components/fields.vue.d.ts +154 -132
- package/dist/runtime/components/table.d.vue.ts +63 -59
- package/dist/runtime/components/table.vue +52 -617
- package/dist/runtime/components/table.vue.d.ts +63 -59
- package/dist/runtime/components/ui/app/App.d.vue.ts +86 -0
- package/dist/runtime/components/ui/app/App.vue +414 -0
- package/dist/runtime/components/ui/app/App.vue.d.ts +86 -0
- package/dist/runtime/components/ui/checkbox/Checkbox.vue +6 -2
- package/dist/runtime/components/ui/expression-editor/ExpressionEditor.d.vue.ts +30 -0
- package/dist/runtime/components/ui/expression-editor/ExpressionEditor.vue +87 -0
- package/dist/runtime/components/ui/expression-editor/ExpressionEditor.vue.d.ts +30 -0
- package/dist/runtime/components/ui/expression-editor/index.d.ts +1 -0
- package/dist/runtime/components/ui/expression-editor/index.js +1 -0
- package/dist/runtime/components/ui/field/FieldContent.vue +1 -1
- package/dist/runtime/components/ui/field/FieldError.vue +2 -2
- package/dist/runtime/components/ui/fields/Fields.d.vue.ts +376 -0
- package/dist/runtime/components/ui/fields/Fields.vue +441 -0
- package/dist/runtime/components/ui/fields/Fields.vue.d.ts +376 -0
- package/dist/runtime/components/ui/fields-configurator/FieldsConfiguratorDialog.d.vue.ts +163 -0
- package/dist/runtime/components/ui/fields-configurator/FieldsConfiguratorDialog.vue +363 -0
- package/dist/runtime/components/ui/fields-configurator/FieldsConfiguratorDialog.vue.d.ts +163 -0
- package/dist/runtime/components/ui/input/Input.d.vue.ts +1 -0
- package/dist/runtime/components/ui/input/Input.vue +2 -0
- package/dist/runtime/components/ui/input/Input.vue.d.ts +1 -0
- package/dist/runtime/components/ui/input-group/InputGroupAddon.vue +4 -1
- package/dist/runtime/components/ui/input-group/InputGroupCombobox.d.vue.ts +8 -3
- package/dist/runtime/components/ui/input-group/InputGroupCombobox.vue +8 -3
- package/dist/runtime/components/ui/input-group/InputGroupCombobox.vue.d.ts +8 -3
- package/dist/runtime/components/ui/input-group/InputGroupComboboxInput.d.vue.ts +8 -1
- package/dist/runtime/components/ui/input-group/InputGroupComboboxInput.vue +10 -1
- package/dist/runtime/components/ui/input-group/InputGroupComboboxInput.vue.d.ts +8 -1
- package/dist/runtime/components/ui/input-group/InputGroupNumberField.d.vue.ts +5 -2
- package/dist/runtime/components/ui/input-group/InputGroupNumberField.vue +9 -3
- package/dist/runtime/components/ui/input-group/InputGroupNumberField.vue.d.ts +5 -2
- package/dist/runtime/components/ui/input-group/index.js +1 -1
- package/dist/runtime/components/ui/locale/Locale.d.vue.ts +20 -0
- package/dist/runtime/components/ui/locale/Locale.vue +291 -0
- package/dist/runtime/components/ui/locale/Locale.vue.d.ts +20 -0
- package/dist/runtime/components/ui/locale/index.d.ts +1 -0
- package/dist/runtime/components/ui/locale/index.js +1 -0
- package/dist/runtime/components/ui/native-select/NativeSelectOption.d.vue.ts +1 -0
- package/dist/runtime/components/ui/native-select/NativeSelectOption.vue +4 -1
- package/dist/runtime/components/ui/native-select/NativeSelectOption.vue.d.ts +1 -0
- package/dist/runtime/components/ui/number-field/NumberFieldInput.vue +1 -1
- package/dist/runtime/components/ui/switch/Switch.vue +1 -1
- package/dist/runtime/components/ui/table/Table.d.vue.ts +81 -0
- package/dist/runtime/components/ui/table/Table.vue +792 -0
- package/dist/runtime/components/ui/table/Table.vue.d.ts +81 -0
- package/dist/runtime/components/ui/table/schema.d.ts +48 -0
- package/dist/runtime/components/ui/table/schema.js +126 -0
- package/dist/runtime/components/ui/table-configurator/TableConfiguratorDialog.d.vue.ts +62 -0
- package/dist/runtime/components/ui/table-configurator/TableConfiguratorDialog.vue +2233 -0
- package/dist/runtime/components/ui/table-configurator/TableConfiguratorDialog.vue.d.ts +62 -0
- package/dist/runtime/components/ui/table-configurator/menu.d.ts +37 -0
- package/dist/runtime/components/ui/table-configurator/menu.js +227 -0
- package/dist/runtime/components/ui/tabs/Tabs.d.vue.ts +24 -0
- package/dist/runtime/components/ui/tabs/Tabs.vue +30 -0
- package/dist/runtime/components/ui/tabs/Tabs.vue.d.ts +24 -0
- package/dist/runtime/components/ui/tabs/TabsContent.d.vue.ts +18 -0
- package/dist/runtime/components/ui/tabs/TabsContent.vue +23 -0
- package/dist/runtime/components/ui/tabs/TabsContent.vue.d.ts +18 -0
- package/dist/runtime/components/ui/tabs/TabsList.d.vue.ts +18 -0
- package/dist/runtime/components/ui/tabs/TabsList.vue +25 -0
- package/dist/runtime/components/ui/tabs/TabsList.vue.d.ts +18 -0
- package/dist/runtime/components/ui/tabs/TabsTrigger.d.vue.ts +18 -0
- package/dist/runtime/components/ui/tabs/TabsTrigger.vue +27 -0
- package/dist/runtime/components/ui/tabs/TabsTrigger.vue.d.ts +18 -0
- package/dist/runtime/components/ui/tabs/index.d.ts +4 -0
- package/dist/runtime/components/ui/tabs/index.js +4 -0
- package/dist/runtime/components/ui/textarea/Textarea.d.vue.ts +1 -0
- package/dist/runtime/components/ui/textarea/Textarea.vue +3 -1
- package/dist/runtime/components/ui/textarea/Textarea.vue.d.ts +1 -0
- package/dist/runtime/components/ui/toggle/Toggle.d.vue.ts +34 -0
- package/dist/runtime/components/ui/toggle/Toggle.vue +32 -0
- package/dist/runtime/components/ui/toggle/Toggle.vue.d.ts +34 -0
- package/dist/runtime/components/ui/toggle/index.d.ts +7 -0
- package/dist/runtime/components/ui/toggle/index.js +22 -0
- package/dist/runtime/composables/useTableRenderers.d.ts +2 -1
- package/dist/runtime/composables/useTableRenderers.js +2 -1
- package/dist/runtime/style.css +1 -1
- package/dist/runtime/table-renderers/builtins.js +213 -98
- package/dist/runtime/table-renderers/registry.d.ts +1 -0
- package/dist/runtime/table-renderers/registry.js +3 -0
- package/dist/runtime/utils/coders.d.ts +27 -2
- package/dist/runtime/utils/coders.js +27 -2
- package/package.json +3 -1
- /package/dist/runtime/components/{logo.d.vue.ts → ui/logo/Logo.d.vue.ts} +0 -0
- /package/dist/runtime/components/{logo.vue → ui/logo/Logo.vue} +0 -0
- /package/dist/runtime/components/{logo.vue.d.ts → ui/logo/Logo.vue.d.ts} +0 -0
|
@@ -2,7 +2,15 @@
|
|
|
2
2
|
import { cn } from "../../../utils/cn";
|
|
3
3
|
import { ListboxFilter } from "reka-ui";
|
|
4
4
|
import { useCommand } from "../command";
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
invalid: { type: Boolean, required: false }
|
|
7
|
+
});
|
|
8
|
+
const emits = defineEmits(["blur"]);
|
|
5
9
|
const { filterState } = useCommand();
|
|
10
|
+
function handleBlur(event) {
|
|
11
|
+
filterState.search = "";
|
|
12
|
+
emits("blur", event);
|
|
13
|
+
}
|
|
6
14
|
</script>
|
|
7
15
|
|
|
8
16
|
<template>
|
|
@@ -10,9 +18,10 @@ const { filterState } = useCommand();
|
|
|
10
18
|
v-model="filterState.search"
|
|
11
19
|
data-slot="input-group-control"
|
|
12
20
|
:data-value="!!filterState.search"
|
|
21
|
+
:aria-invalid="props.invalid ? 'true' : void 0"
|
|
13
22
|
:class="cn(
|
|
14
23
|
'flex-1 px-2 rounded-none border-none bg-transparent shadow-none dark:bg-transparent peer outline-none disabled:cursor-not-allowed disabled:text-zinc-600 disabled:opacity-100'
|
|
15
24
|
)"
|
|
16
|
-
@blur="
|
|
25
|
+
@blur="handleBlur"
|
|
17
26
|
/>
|
|
18
27
|
</template>
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
invalid?: boolean;
|
|
3
|
+
};
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
5
|
+
blur: (...args: any[]) => void;
|
|
6
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
7
|
+
onBlur?: ((...args: any[]) => any) | undefined;
|
|
8
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
2
9
|
declare const _default: typeof __VLS_export;
|
|
3
10
|
export default _default;
|
|
@@ -2,11 +2,14 @@ import type { NumberFieldRootProps } from 'reka-ui';
|
|
|
2
2
|
import type { HTMLAttributes } from 'vue';
|
|
3
3
|
type __VLS_Props = NumberFieldRootProps & {
|
|
4
4
|
class?: HTMLAttributes['class'];
|
|
5
|
+
invalid?: boolean;
|
|
5
6
|
};
|
|
6
7
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
7
|
-
"update:modelValue": (
|
|
8
|
+
"update:modelValue": (...args: any[]) => void;
|
|
9
|
+
blur: (...args: any[]) => void;
|
|
8
10
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
9
|
-
"onUpdate:modelValue"?: ((
|
|
11
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
12
|
+
onBlur?: ((...args: any[]) => any) | undefined;
|
|
10
13
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
14
|
declare const _default: typeof __VLS_export;
|
|
12
15
|
export default _default;
|
|
@@ -22,10 +22,14 @@ const props = defineProps({
|
|
|
22
22
|
as: { type: null, required: false },
|
|
23
23
|
name: { type: String, required: false },
|
|
24
24
|
required: { type: Boolean, required: false },
|
|
25
|
-
class: { type: null, required: false }
|
|
25
|
+
class: { type: null, required: false },
|
|
26
|
+
invalid: { type: Boolean, required: false }
|
|
26
27
|
});
|
|
27
|
-
const emits = defineEmits([
|
|
28
|
-
|
|
28
|
+
const emits = defineEmits([
|
|
29
|
+
"update:modelValue",
|
|
30
|
+
"blur"
|
|
31
|
+
]);
|
|
32
|
+
const delegatedProps = reactiveOmit(props, "class", "invalid");
|
|
29
33
|
</script>
|
|
30
34
|
|
|
31
35
|
<template>
|
|
@@ -37,9 +41,11 @@ const delegatedProps = reactiveOmit(props, "class");
|
|
|
37
41
|
<NumberFieldInput
|
|
38
42
|
data-slot="input-group-control"
|
|
39
43
|
:data-value="typeof delegatedProps.modelValue === 'number'"
|
|
44
|
+
:aria-invalid="props.invalid ? 'true' : void 0"
|
|
40
45
|
:class="cn(
|
|
41
46
|
'flex-1 px-2 py-1 rounded-none w-full text-sm text-zinc-700 border-0 bg-transparent shadow-none dark:bg-transparent outline-none peer disabled:cursor-not-allowed disabled:text-zinc-600 disabled:opacity-100'
|
|
42
47
|
)"
|
|
48
|
+
@blur="emits('blur', $event)"
|
|
43
49
|
/>
|
|
44
50
|
</NumberField>
|
|
45
51
|
</template>
|
|
@@ -2,11 +2,14 @@ import type { NumberFieldRootProps } from 'reka-ui';
|
|
|
2
2
|
import type { HTMLAttributes } from 'vue';
|
|
3
3
|
type __VLS_Props = NumberFieldRootProps & {
|
|
4
4
|
class?: HTMLAttributes['class'];
|
|
5
|
+
invalid?: boolean;
|
|
5
6
|
};
|
|
6
7
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
7
|
-
"update:modelValue": (
|
|
8
|
+
"update:modelValue": (...args: any[]) => void;
|
|
9
|
+
blur: (...args: any[]) => void;
|
|
8
10
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
9
|
-
"onUpdate:modelValue"?: ((
|
|
11
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
12
|
+
onBlur?: ((...args: any[]) => any) | undefined;
|
|
10
13
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
14
|
declare const _default: typeof __VLS_export;
|
|
12
15
|
export default _default;
|
|
@@ -31,7 +31,7 @@ export const inputGroupButtonVariants = cva(
|
|
|
31
31
|
size: {
|
|
32
32
|
"xs": "h-6 gap-1 px-2 rounded-sm [&>svg:not([class*='size-'])]:size-3.5 has-[>svg]:px-2",
|
|
33
33
|
"sm": "h-8 px-2.5 gap-1.5 rounded-md has-[>svg]:px-2.5",
|
|
34
|
-
"icon-xs": "size-6 rounded-
|
|
34
|
+
"icon-xs": "size-6 rounded-xs p-0 has-[>svg]:p-0",
|
|
35
35
|
"icon-sm": "size-8 p-0 has-[>svg]:p-0"
|
|
36
36
|
}
|
|
37
37
|
},
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'vue';
|
|
2
|
+
import { type LocaleValue } from '../../../utils/coders.js';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
modelValue?: LocaleValue;
|
|
5
|
+
class?: HTMLAttributes['class'];
|
|
6
|
+
multiline?: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
9
|
+
"update:modelValue": (args_0: readonly {
|
|
10
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
11
|
+
message: string;
|
|
12
|
+
}[]) => any;
|
|
13
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
14
|
+
"onUpdate:modelValue"?: ((args_0: readonly {
|
|
15
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
16
|
+
message: string;
|
|
17
|
+
}[]) => any) | undefined;
|
|
18
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useVModel } from "@vueuse/core";
|
|
3
|
+
import { Icon } from "@iconify/vue";
|
|
4
|
+
import { computed } from "vue";
|
|
5
|
+
import { useI18n } from "vue-i18n";
|
|
6
|
+
import { cn } from "../../../utils/cn";
|
|
7
|
+
import { supportedLocales } from "../../../utils/coders";
|
|
8
|
+
import { Button } from "../button";
|
|
9
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "../dropdown-menu";
|
|
10
|
+
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupTextarea } from "../input-group";
|
|
11
|
+
defineOptions({
|
|
12
|
+
inheritAttrs: false
|
|
13
|
+
});
|
|
14
|
+
const props = defineProps({
|
|
15
|
+
modelValue: { type: null, required: false },
|
|
16
|
+
class: { type: null, required: false },
|
|
17
|
+
multiline: { type: Boolean, required: false }
|
|
18
|
+
});
|
|
19
|
+
const emits = defineEmits(["update:modelValue"]);
|
|
20
|
+
const modelValue = useVModel(props, "modelValue", emits, {
|
|
21
|
+
passive: true,
|
|
22
|
+
defaultValue: createDefaultLocaleValue()
|
|
23
|
+
});
|
|
24
|
+
const { t } = useI18n();
|
|
25
|
+
const locales = computed(
|
|
26
|
+
() => [...modelValue.value ?? createDefaultLocaleValue()].sort((left, right) => {
|
|
27
|
+
if (left.locale === "zh") {
|
|
28
|
+
return -1;
|
|
29
|
+
}
|
|
30
|
+
if (right.locale === "zh") {
|
|
31
|
+
return 1;
|
|
32
|
+
}
|
|
33
|
+
return 0;
|
|
34
|
+
})
|
|
35
|
+
);
|
|
36
|
+
const hasRemainingLocales = computed(() => locales.value.length < supportedLocales.length);
|
|
37
|
+
const localeLabels = {
|
|
38
|
+
zh: "\u4E2D\u6587",
|
|
39
|
+
ja: "\u65E5\u672C\u8A9E",
|
|
40
|
+
en: "English",
|
|
41
|
+
ko: "\uD55C\uAD6D\uC5B4"
|
|
42
|
+
};
|
|
43
|
+
function createDefaultLocaleValue() {
|
|
44
|
+
return [{ locale: "zh", message: "" }];
|
|
45
|
+
}
|
|
46
|
+
function localeIcon(locale) {
|
|
47
|
+
return `circle-flags:lang-${locale}`;
|
|
48
|
+
}
|
|
49
|
+
function localeLabel(locale) {
|
|
50
|
+
return localeLabels[locale];
|
|
51
|
+
}
|
|
52
|
+
function availableLocales(index) {
|
|
53
|
+
const currentLocale = locales.value[index]?.locale;
|
|
54
|
+
return supportedLocales.filter((locale) => locale !== currentLocale && !locales.value.some((item) => item.locale === locale));
|
|
55
|
+
}
|
|
56
|
+
function updateMessage(index, message) {
|
|
57
|
+
modelValue.value = locales.value.map((item, itemIndex) => {
|
|
58
|
+
if (itemIndex !== index) {
|
|
59
|
+
return item;
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
locale: item.locale,
|
|
63
|
+
message: String(message)
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function updateLocale(index, locale) {
|
|
68
|
+
const currentItem = locales.value[index];
|
|
69
|
+
if (!currentItem || currentItem.locale === "zh" && locale !== "zh") {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
modelValue.value = locales.value.map((item, itemIndex) => {
|
|
73
|
+
if (itemIndex !== index) {
|
|
74
|
+
return item;
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
locale,
|
|
78
|
+
message: item.message
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function removeLocale(index) {
|
|
83
|
+
const currentItem = locales.value[index];
|
|
84
|
+
if (!currentItem || currentItem.locale === "zh") {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
modelValue.value = locales.value.filter((_, itemIndex) => itemIndex !== index);
|
|
88
|
+
}
|
|
89
|
+
function addLocale() {
|
|
90
|
+
const locale = supportedLocales.find((candidate) => !locales.value.some((item) => item.locale === candidate));
|
|
91
|
+
if (!locale) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const nextValue = [...locales.value];
|
|
95
|
+
nextValue.push({
|
|
96
|
+
locale,
|
|
97
|
+
message: ""
|
|
98
|
+
});
|
|
99
|
+
modelValue.value = nextValue;
|
|
100
|
+
}
|
|
101
|
+
function handleMessageUpdate(index, value) {
|
|
102
|
+
updateMessage(index, value);
|
|
103
|
+
}
|
|
104
|
+
</script>
|
|
105
|
+
|
|
106
|
+
<template>
|
|
107
|
+
<div
|
|
108
|
+
v-bind="$attrs"
|
|
109
|
+
data-slot="locale"
|
|
110
|
+
:class="cn('flex flex-col gap-2', props.class)"
|
|
111
|
+
>
|
|
112
|
+
<InputGroup
|
|
113
|
+
v-for="(item, index) in locales"
|
|
114
|
+
:key="item.locale"
|
|
115
|
+
data-slot="locale-row"
|
|
116
|
+
:data-locale="item.locale"
|
|
117
|
+
>
|
|
118
|
+
<InputGroupAddon
|
|
119
|
+
v-if="props.multiline"
|
|
120
|
+
align="block-start"
|
|
121
|
+
class="border-b border-zinc-200"
|
|
122
|
+
>
|
|
123
|
+
<div class="flex w-full items-center justify-between gap-3">
|
|
124
|
+
<DropdownMenu v-if="item.locale !== 'zh' && availableLocales(index).length > 0">
|
|
125
|
+
<DropdownMenuTrigger as-child>
|
|
126
|
+
<InputGroupButton
|
|
127
|
+
size="sm"
|
|
128
|
+
as-child
|
|
129
|
+
>
|
|
130
|
+
<button
|
|
131
|
+
type="button"
|
|
132
|
+
data-slot="locale-trigger"
|
|
133
|
+
class="text-zinc-500 transition-colors hover:text-zinc-700"
|
|
134
|
+
:aria-label="t('select-locale', { locale: localeLabel(item.locale) })"
|
|
135
|
+
>
|
|
136
|
+
<Icon :icon="localeIcon(item.locale)" />
|
|
137
|
+
<span>{{ localeLabel(item.locale) }}</span>
|
|
138
|
+
</button>
|
|
139
|
+
</InputGroupButton>
|
|
140
|
+
</DropdownMenuTrigger>
|
|
141
|
+
<DropdownMenuContent align="start">
|
|
142
|
+
<DropdownMenuItem
|
|
143
|
+
v-for="locale in availableLocales(index)"
|
|
144
|
+
:key="locale"
|
|
145
|
+
data-slot="locale-option"
|
|
146
|
+
:data-locale-option="locale"
|
|
147
|
+
@select="updateLocale(index, locale)"
|
|
148
|
+
>
|
|
149
|
+
<Icon :icon="localeIcon(locale)" />
|
|
150
|
+
<span>{{ localeLabel(locale) }}</span>
|
|
151
|
+
</DropdownMenuItem>
|
|
152
|
+
</DropdownMenuContent>
|
|
153
|
+
</DropdownMenu>
|
|
154
|
+
|
|
155
|
+
<span
|
|
156
|
+
v-else
|
|
157
|
+
data-slot="locale-icon"
|
|
158
|
+
class="flex items-center gap-2 text-zinc-500"
|
|
159
|
+
>
|
|
160
|
+
<Icon :icon="localeIcon(item.locale)" />
|
|
161
|
+
<span>{{ localeLabel(item.locale) }}</span>
|
|
162
|
+
</span>
|
|
163
|
+
|
|
164
|
+
<InputGroupButton
|
|
165
|
+
variant="destructive"
|
|
166
|
+
size="icon-xs"
|
|
167
|
+
as-child
|
|
168
|
+
>
|
|
169
|
+
<button
|
|
170
|
+
type="button"
|
|
171
|
+
data-slot="locale-delete"
|
|
172
|
+
:disabled="item.locale === 'zh'"
|
|
173
|
+
:aria-label="t('delete-locale', { locale: localeLabel(item.locale) })"
|
|
174
|
+
@click="removeLocale(index)"
|
|
175
|
+
>
|
|
176
|
+
<Icon icon="fluent:delete-20-regular" />
|
|
177
|
+
</button>
|
|
178
|
+
</InputGroupButton>
|
|
179
|
+
</div>
|
|
180
|
+
</InputGroupAddon>
|
|
181
|
+
|
|
182
|
+
<InputGroupAddon v-else>
|
|
183
|
+
<DropdownMenu v-if="item.locale !== 'zh' && availableLocales(index).length > 0">
|
|
184
|
+
<DropdownMenuTrigger as-child>
|
|
185
|
+
<InputGroupButton
|
|
186
|
+
size="icon-sm"
|
|
187
|
+
as-child
|
|
188
|
+
>
|
|
189
|
+
<button
|
|
190
|
+
type="button"
|
|
191
|
+
data-slot="locale-trigger"
|
|
192
|
+
class="text-zinc-500 transition-colors hover:text-zinc-700 [&_svg:not([class*='size-'])]:size-3.5"
|
|
193
|
+
:aria-label="t('select-locale', { locale: localeLabel(item.locale) })"
|
|
194
|
+
>
|
|
195
|
+
<Icon :icon="localeIcon(item.locale)" />
|
|
196
|
+
</button>
|
|
197
|
+
</InputGroupButton>
|
|
198
|
+
</DropdownMenuTrigger>
|
|
199
|
+
<DropdownMenuContent align="start">
|
|
200
|
+
<DropdownMenuItem
|
|
201
|
+
v-for="locale in availableLocales(index)"
|
|
202
|
+
:key="locale"
|
|
203
|
+
data-slot="locale-option"
|
|
204
|
+
:data-locale-option="locale"
|
|
205
|
+
@select="updateLocale(index, locale)"
|
|
206
|
+
>
|
|
207
|
+
<Icon :icon="localeIcon(locale)" />
|
|
208
|
+
<span>{{ localeLabel(locale) }}</span>
|
|
209
|
+
</DropdownMenuItem>
|
|
210
|
+
</DropdownMenuContent>
|
|
211
|
+
</DropdownMenu>
|
|
212
|
+
<span
|
|
213
|
+
v-else
|
|
214
|
+
data-slot="locale-icon"
|
|
215
|
+
class="-ml-[0.45rem] flex size-8 items-center justify-center text-zinc-500"
|
|
216
|
+
>
|
|
217
|
+
<Icon :icon="localeIcon(item.locale)" />
|
|
218
|
+
</span>
|
|
219
|
+
</InputGroupAddon>
|
|
220
|
+
|
|
221
|
+
<InputGroupInput
|
|
222
|
+
v-if="!props.multiline"
|
|
223
|
+
data-slot="locale-input"
|
|
224
|
+
:model-value="item.message"
|
|
225
|
+
:placeholder="localeLabel(item.locale)"
|
|
226
|
+
@update:model-value="handleMessageUpdate(index, $event)"
|
|
227
|
+
/>
|
|
228
|
+
|
|
229
|
+
<InputGroupTextarea
|
|
230
|
+
v-else
|
|
231
|
+
data-slot="locale-textarea"
|
|
232
|
+
class="min-h-32"
|
|
233
|
+
:model-value="item.message"
|
|
234
|
+
:placeholder="localeLabel(item.locale)"
|
|
235
|
+
@update:model-value="handleMessageUpdate(index, $event)"
|
|
236
|
+
/>
|
|
237
|
+
|
|
238
|
+
<InputGroupAddon
|
|
239
|
+
v-if="!props.multiline"
|
|
240
|
+
align="inline-end"
|
|
241
|
+
>
|
|
242
|
+
<InputGroupButton
|
|
243
|
+
variant="destructive"
|
|
244
|
+
size="icon-xs"
|
|
245
|
+
as-child
|
|
246
|
+
>
|
|
247
|
+
<button
|
|
248
|
+
type="button"
|
|
249
|
+
data-slot="locale-delete"
|
|
250
|
+
:disabled="item.locale === 'zh'"
|
|
251
|
+
:aria-label="t('delete-locale', { locale: localeLabel(item.locale) })"
|
|
252
|
+
@click="removeLocale(index)"
|
|
253
|
+
>
|
|
254
|
+
<Icon icon="fluent:delete-20-regular" />
|
|
255
|
+
</button>
|
|
256
|
+
</InputGroupButton>
|
|
257
|
+
</InputGroupAddon>
|
|
258
|
+
</InputGroup>
|
|
259
|
+
|
|
260
|
+
<Button
|
|
261
|
+
type="button"
|
|
262
|
+
data-slot="locale-add"
|
|
263
|
+
class="w-full justify-center"
|
|
264
|
+
:disabled="!hasRemainingLocales"
|
|
265
|
+
@click="addLocale"
|
|
266
|
+
>
|
|
267
|
+
<Icon icon="fluent:add-20-regular" />
|
|
268
|
+
<span>{{ t("add-language") }}</span>
|
|
269
|
+
</Button>
|
|
270
|
+
</div>
|
|
271
|
+
</template>
|
|
272
|
+
|
|
273
|
+
<i18n lang="json">
|
|
274
|
+
{
|
|
275
|
+
"zh": {
|
|
276
|
+
"add-language": "新增语言",
|
|
277
|
+
"select-locale": "选择语言:{locale}",
|
|
278
|
+
"delete-locale": "删除语言:{locale}"
|
|
279
|
+
},
|
|
280
|
+
"ja": {
|
|
281
|
+
"add-language": "言語を追加",
|
|
282
|
+
"select-locale": "言語を選択: {locale}",
|
|
283
|
+
"delete-locale": "言語を削除: {locale}"
|
|
284
|
+
},
|
|
285
|
+
"en": {
|
|
286
|
+
"add-language": "Add language",
|
|
287
|
+
"select-locale": "Select language: {locale}",
|
|
288
|
+
"delete-locale": "Delete language: {locale}"
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
</i18n>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'vue';
|
|
2
|
+
import { type LocaleValue } from '../../../utils/coders.js';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
modelValue?: LocaleValue;
|
|
5
|
+
class?: HTMLAttributes['class'];
|
|
6
|
+
multiline?: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
9
|
+
"update:modelValue": (args_0: readonly {
|
|
10
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
11
|
+
message: string;
|
|
12
|
+
}[]) => any;
|
|
13
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
14
|
+
"onUpdate:modelValue"?: ((args_0: readonly {
|
|
15
|
+
locale: "zh" | "ja" | "en" | "ko";
|
|
16
|
+
message: string;
|
|
17
|
+
}[]) => any) | undefined;
|
|
18
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Locale } from './Locale.vue.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Locale } from "./Locale.vue";
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { cn } from "../../../utils/cn";
|
|
3
3
|
const props = defineProps({
|
|
4
|
-
class: { type: null, required: false }
|
|
4
|
+
class: { type: null, required: false },
|
|
5
|
+
value: { type: [String, Number], required: false }
|
|
5
6
|
});
|
|
6
7
|
</script>
|
|
7
8
|
|
|
8
9
|
<template>
|
|
9
10
|
<option
|
|
10
11
|
data-slot="native-select-option"
|
|
12
|
+
:value="props.value"
|
|
13
|
+
v-bind="$attrs"
|
|
11
14
|
:class="cn('bg-white text-zinc-700', props.class)"
|
|
12
15
|
>
|
|
13
16
|
<slot />
|
|
@@ -9,6 +9,6 @@ const props = defineProps({
|
|
|
9
9
|
<template>
|
|
10
10
|
<NumberFieldInput
|
|
11
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-
|
|
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 px-3 py-1 text-sm text-center shadow-xs transition-colors duration-180 placeholder:text-zinc-700 outline-none disabled:cursor-not-allowed disabled:opacity-50', props.class)"
|
|
13
13
|
/>
|
|
14
14
|
</template>
|
|
@@ -29,7 +29,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
|
29
29
|
data-slot="switch"
|
|
30
30
|
v-bind="forwarded"
|
|
31
31
|
:class="cn(
|
|
32
|
-
'peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-zinc-200 focus-visible:border-(--primary) dark:data-[state=unchecked]:bg-zinc-200/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none disabled:cursor-not-allowed disabled:opacity-50',
|
|
32
|
+
'peer data-[state=checked]:bg-(--primary) data-[state=unchecked]:bg-zinc-200 focus-visible:border-(--primary) dark:data-[state=unchecked]:bg-zinc-200/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none disabled:cursor-not-allowed disabled:opacity-50',
|
|
33
33
|
props.class
|
|
34
34
|
)"
|
|
35
35
|
>
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { type CellContext, type TableOptions } from '@tanstack/vue-table';
|
|
2
|
+
import { Effect } from 'effect';
|
|
3
|
+
import { type TableConfig } from './schema.js';
|
|
4
|
+
export type { Accessor, Column, Expression, Markdown, Render, TableConfig } from './schema.js';
|
|
5
|
+
export { AccessorC, ColumnC, RenderC, TableConfigC } from './schema.js';
|
|
6
|
+
declare module '@tanstack/vue-table' {
|
|
7
|
+
interface ColumnMeta<TData extends import('@tanstack/vue-table').RowData, TValue> {
|
|
8
|
+
tooltip?: string;
|
|
9
|
+
grow?: boolean;
|
|
10
|
+
accessor?: import('./schema').Accessor;
|
|
11
|
+
__types?: [TData, TValue];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
declare const _default: typeof __VLS_export;
|
|
15
|
+
export default _default;
|
|
16
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
17
|
+
config: Effect.Effect<TableConfig>;
|
|
18
|
+
data: Array<unknown>;
|
|
19
|
+
rowCount?: number;
|
|
20
|
+
}, import("@tanstack/table-core").Table<unknown>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
21
|
+
"update:config": (args_0: Readonly<{
|
|
22
|
+
getRowId?: import("./schema.js").Expression;
|
|
23
|
+
getSubRows?: import("./schema.js").Expression;
|
|
24
|
+
enableRowSelection?: import("./schema.js").Expression;
|
|
25
|
+
enableMultiRowSelection?: import("./schema.js").Expression;
|
|
26
|
+
columns: readonly Readonly<{
|
|
27
|
+
id?: string;
|
|
28
|
+
title?: import("../../../utils/coders.js").LocaleValue;
|
|
29
|
+
accessor?: import("./schema.js").Accessor;
|
|
30
|
+
renderer?: import("./schema.js").Render;
|
|
31
|
+
tooltip?: import("../../../utils/coders.js").LocaleValue;
|
|
32
|
+
size?: number;
|
|
33
|
+
enableSorting?: boolean;
|
|
34
|
+
enableMultiSorting?: boolean;
|
|
35
|
+
enablePinning?: boolean;
|
|
36
|
+
columns?: readonly Readonly</*elided*/ any>[];
|
|
37
|
+
grow?: boolean;
|
|
38
|
+
}>[];
|
|
39
|
+
cellStyles?: import("./schema.js").Expression;
|
|
40
|
+
props?: Omit<TableOptions<unknown>, "columns" | "data" | "getRowId" | "getCoreRowModel">;
|
|
41
|
+
paginationLeft?: import("./schema.js").Markdown;
|
|
42
|
+
paginationRight?: import("./schema.js").Markdown;
|
|
43
|
+
}>) => any;
|
|
44
|
+
}, string, import("vue").PublicProps, Readonly<{
|
|
45
|
+
config: Effect.Effect<TableConfig>;
|
|
46
|
+
data: Array<unknown>;
|
|
47
|
+
rowCount?: number;
|
|
48
|
+
}> & Readonly<{
|
|
49
|
+
"onUpdate:config"?: ((args_0: Readonly<{
|
|
50
|
+
getRowId?: import("./schema.js").Expression;
|
|
51
|
+
getSubRows?: import("./schema.js").Expression;
|
|
52
|
+
enableRowSelection?: import("./schema.js").Expression;
|
|
53
|
+
enableMultiRowSelection?: import("./schema.js").Expression;
|
|
54
|
+
columns: readonly Readonly<{
|
|
55
|
+
id?: string;
|
|
56
|
+
title?: import("../../../utils/coders.js").LocaleValue;
|
|
57
|
+
accessor?: import("./schema.js").Accessor;
|
|
58
|
+
renderer?: import("./schema.js").Render;
|
|
59
|
+
tooltip?: import("../../../utils/coders.js").LocaleValue;
|
|
60
|
+
size?: number;
|
|
61
|
+
enableSorting?: boolean;
|
|
62
|
+
enableMultiSorting?: boolean;
|
|
63
|
+
enablePinning?: boolean;
|
|
64
|
+
columns?: readonly Readonly</*elided*/ any>[];
|
|
65
|
+
grow?: boolean;
|
|
66
|
+
}>[];
|
|
67
|
+
cellStyles?: import("./schema.js").Expression;
|
|
68
|
+
props?: Omit<TableOptions<unknown>, "columns" | "data" | "getRowId" | "getCoreRowModel">;
|
|
69
|
+
paginationLeft?: import("./schema.js").Markdown;
|
|
70
|
+
paginationRight?: import("./schema.js").Markdown;
|
|
71
|
+
}>) => any) | undefined;
|
|
72
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
73
|
+
[key: string]: (props: Readonly<{
|
|
74
|
+
cell: CellContext<unknown, unknown>;
|
|
75
|
+
}>) => void;
|
|
76
|
+
}>;
|
|
77
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
78
|
+
new (): {
|
|
79
|
+
$slots: S;
|
|
80
|
+
};
|
|
81
|
+
};
|