@shwfed/nuxt 0.1.28 → 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.d.mts +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -3
- package/dist/runtime/components/app.vue +0 -1
- package/dist/runtime/components/query.d.vue.ts +59 -0
- package/dist/runtime/components/query.vue +130 -0
- package/dist/runtime/components/query.vue.d.ts +59 -0
- 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/calendar/Calendar.d.vue.ts +42 -0
- package/dist/runtime/components/ui/calendar/Calendar.vue +207 -0
- package/dist/runtime/components/ui/calendar/Calendar.vue.d.ts +42 -0
- package/dist/runtime/components/ui/calendar/CalendarCell.d.vue.ts +18 -0
- package/dist/runtime/components/ui/calendar/CalendarCell.vue +23 -0
- package/dist/runtime/components/ui/calendar/CalendarCell.vue.d.ts +18 -0
- package/dist/runtime/components/ui/calendar/CalendarCellTrigger.d.vue.ts +20 -0
- package/dist/runtime/components/ui/calendar/CalendarCellTrigger.vue +38 -0
- package/dist/runtime/components/ui/calendar/CalendarCellTrigger.vue.d.ts +20 -0
- package/dist/runtime/components/ui/calendar/CalendarGrid.d.vue.ts +18 -0
- package/dist/runtime/components/ui/calendar/CalendarGrid.vue +22 -0
- package/dist/runtime/components/ui/calendar/CalendarGrid.vue.d.ts +18 -0
- package/dist/runtime/components/ui/calendar/CalendarGridBody.d.vue.ts +14 -0
- package/dist/runtime/components/ui/calendar/CalendarGridBody.vue +16 -0
- package/dist/runtime/components/ui/calendar/CalendarGridBody.vue.d.ts +14 -0
- package/dist/runtime/components/ui/calendar/CalendarGridHead.d.vue.ts +18 -0
- package/dist/runtime/components/ui/calendar/CalendarGridHead.vue +17 -0
- package/dist/runtime/components/ui/calendar/CalendarGridHead.vue.d.ts +18 -0
- package/dist/runtime/components/ui/calendar/CalendarGridRow.d.vue.ts +18 -0
- package/dist/runtime/components/ui/calendar/CalendarGridRow.vue +22 -0
- package/dist/runtime/components/ui/calendar/CalendarGridRow.vue.d.ts +18 -0
- package/dist/runtime/components/ui/calendar/CalendarHeadCell.d.vue.ts +18 -0
- package/dist/runtime/components/ui/calendar/CalendarHeadCell.vue +22 -0
- package/dist/runtime/components/ui/calendar/CalendarHeadCell.vue.d.ts +18 -0
- package/dist/runtime/components/ui/calendar/CalendarHeader.d.vue.ts +18 -0
- package/dist/runtime/components/ui/calendar/CalendarHeader.vue +22 -0
- package/dist/runtime/components/ui/calendar/CalendarHeader.vue.d.ts +18 -0
- package/dist/runtime/components/ui/calendar/CalendarHeading.d.vue.ts +19 -0
- package/dist/runtime/components/ui/calendar/CalendarHeading.vue +27 -0
- package/dist/runtime/components/ui/calendar/CalendarHeading.vue.d.ts +19 -0
- package/dist/runtime/components/ui/calendar/CalendarNextButton.d.vue.ts +18 -0
- package/dist/runtime/components/ui/calendar/CalendarNextButton.vue +31 -0
- package/dist/runtime/components/ui/calendar/CalendarNextButton.vue.d.ts +18 -0
- package/dist/runtime/components/ui/calendar/CalendarPrevButton.d.vue.ts +18 -0
- package/dist/runtime/components/ui/calendar/CalendarPrevButton.vue +31 -0
- package/dist/runtime/components/ui/calendar/CalendarPrevButton.vue.d.ts +18 -0
- package/dist/runtime/components/ui/calendar/index.d.ts +13 -0
- package/dist/runtime/components/ui/calendar/index.js +12 -0
- package/dist/runtime/components/ui/command/CommandItem.vue +1 -1
- package/dist/runtime/components/ui/field/Field.d.vue.ts +19 -0
- package/dist/runtime/components/ui/field/Field.vue +22 -0
- package/dist/runtime/components/ui/field/Field.vue.d.ts +19 -0
- package/dist/runtime/components/ui/field/FieldContent.d.vue.ts +17 -0
- package/dist/runtime/components/ui/field/FieldContent.vue +18 -0
- package/dist/runtime/components/ui/field/FieldContent.vue.d.ts +17 -0
- package/dist/runtime/components/ui/field/FieldDescription.d.vue.ts +17 -0
- package/dist/runtime/components/ui/field/FieldDescription.vue +20 -0
- package/dist/runtime/components/ui/field/FieldDescription.vue.d.ts +17 -0
- package/dist/runtime/components/ui/field/FieldError.d.vue.ts +20 -0
- package/dist/runtime/components/ui/field/FieldError.vue +51 -0
- package/dist/runtime/components/ui/field/FieldError.vue.d.ts +20 -0
- package/dist/runtime/components/ui/field/FieldGroup.d.vue.ts +17 -0
- package/dist/runtime/components/ui/field/FieldGroup.vue +18 -0
- package/dist/runtime/components/ui/field/FieldGroup.vue.d.ts +17 -0
- package/dist/runtime/components/ui/field/FieldLabel.d.vue.ts +17 -0
- package/dist/runtime/components/ui/field/FieldLabel.vue +21 -0
- package/dist/runtime/components/ui/field/FieldLabel.vue.d.ts +17 -0
- package/dist/runtime/components/ui/field/FieldLegend.d.vue.ts +18 -0
- package/dist/runtime/components/ui/field/FieldLegend.vue +22 -0
- package/dist/runtime/components/ui/field/FieldLegend.vue.d.ts +18 -0
- package/dist/runtime/components/ui/field/FieldSeparator.d.vue.ts +17 -0
- package/dist/runtime/components/ui/field/FieldSeparator.vue +27 -0
- package/dist/runtime/components/ui/field/FieldSeparator.vue.d.ts +17 -0
- package/dist/runtime/components/ui/field/FieldSet.d.vue.ts +17 -0
- package/dist/runtime/components/ui/field/FieldSet.vue +19 -0
- package/dist/runtime/components/ui/field/FieldSet.vue.d.ts +17 -0
- package/dist/runtime/components/ui/field/FieldTitle.d.vue.ts +17 -0
- package/dist/runtime/components/ui/field/FieldTitle.vue +18 -0
- package/dist/runtime/components/ui/field/FieldTitle.vue.d.ts +17 -0
- package/dist/runtime/components/ui/field/index.d.ts +15 -0
- package/dist/runtime/components/ui/field/index.js +52 -0
- package/dist/runtime/components/ui/input/Input.d.vue.ts +14 -0
- package/dist/runtime/components/ui/input/Input.vue +28 -0
- package/dist/runtime/components/ui/input/Input.vue.d.ts +14 -0
- package/dist/runtime/components/ui/input/index.d.ts +1 -0
- package/dist/runtime/components/ui/input/index.js +1 -0
- package/dist/runtime/components/ui/input-group/InputCombobox.d.vue.ts +14 -0
- package/dist/runtime/components/ui/input-group/InputCombobox.vue +84 -0
- package/dist/runtime/components/ui/input-group/InputCombobox.vue.d.ts +14 -0
- package/dist/runtime/components/ui/input-group/InputComboboxInput.d.vue.ts +3 -0
- package/dist/runtime/components/ui/input-group/InputComboboxInput.vue +16 -0
- package/dist/runtime/components/ui/input-group/InputComboboxInput.vue.d.ts +3 -0
- package/dist/runtime/components/ui/input-group/InputGroup.d.vue.ts +17 -0
- package/dist/runtime/components/ui/input-group/InputGroup.vue +31 -0
- package/dist/runtime/components/ui/input-group/InputGroup.vue.d.ts +17 -0
- package/dist/runtime/components/ui/input-group/InputGroupAddon.d.vue.ts +21 -0
- package/dist/runtime/components/ui/input-group/InputGroupAddon.vue +30 -0
- package/dist/runtime/components/ui/input-group/InputGroupAddon.vue.d.ts +21 -0
- package/dist/runtime/components/ui/input-group/InputGroupButton.d.vue.ts +24 -0
- package/dist/runtime/components/ui/input-group/InputGroupButton.vue +20 -0
- package/dist/runtime/components/ui/input-group/InputGroupButton.vue.d.ts +24 -0
- package/dist/runtime/components/ui/input-group/InputGroupInput.d.vue.ts +8 -0
- package/dist/runtime/components/ui/input-group/InputGroupInput.vue +20 -0
- package/dist/runtime/components/ui/input-group/InputGroupInput.vue.d.ts +8 -0
- package/dist/runtime/components/ui/input-group/InputGroupText.d.vue.ts +17 -0
- package/dist/runtime/components/ui/input-group/InputGroupText.vue +17 -0
- package/dist/runtime/components/ui/input-group/InputGroupText.vue.d.ts +17 -0
- package/dist/runtime/components/ui/input-group/InputGroupTextarea.d.vue.ts +7 -0
- package/dist/runtime/components/ui/input-group/InputGroupTextarea.vue +17 -0
- package/dist/runtime/components/ui/input-group/InputGroupTextarea.vue.d.ts +7 -0
- package/dist/runtime/components/ui/input-group/index.d.ts +18 -0
- package/dist/runtime/components/ui/input-group/index.js +42 -0
- package/dist/runtime/components/ui/label/Label.d.vue.ts +18 -0
- package/dist/runtime/components/ui/label/Label.vue +27 -0
- package/dist/runtime/components/ui/label/Label.vue.d.ts +18 -0
- package/dist/runtime/components/ui/label/index.d.ts +1 -0
- package/dist/runtime/components/ui/label/index.js +1 -0
- package/dist/runtime/components/ui/native-select/NativeSelect.d.vue.ts +23 -0
- package/dist/runtime/components/ui/native-select/NativeSelect.vue +45 -0
- package/dist/runtime/components/ui/native-select/NativeSelect.vue.d.ts +23 -0
- package/dist/runtime/components/ui/native-select/NativeSelectOptGroup.d.vue.ts +17 -0
- package/dist/runtime/components/ui/native-select/NativeSelectOptGroup.vue +15 -0
- package/dist/runtime/components/ui/native-select/NativeSelectOptGroup.vue.d.ts +17 -0
- package/dist/runtime/components/ui/native-select/NativeSelectOption.d.vue.ts +17 -0
- package/dist/runtime/components/ui/native-select/NativeSelectOption.vue +15 -0
- package/dist/runtime/components/ui/native-select/NativeSelectOption.vue.d.ts +17 -0
- package/dist/runtime/components/ui/native-select/index.d.ts +3 -0
- package/dist/runtime/components/ui/native-select/index.js +3 -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/Popover.d.vue.ts +21 -0
- package/dist/runtime/components/ui/popover/Popover.vue +20 -0
- package/dist/runtime/components/ui/popover/Popover.vue.d.ts +21 -0
- package/dist/runtime/components/ui/popover/PopoverAnchor.d.vue.ts +14 -0
- package/dist/runtime/components/ui/popover/PopoverAnchor.vue +17 -0
- package/dist/runtime/components/ui/popover/PopoverAnchor.vue.d.ts +14 -0
- package/dist/runtime/components/ui/popover/PopoverContent.d.vue.ts +35 -0
- package/dist/runtime/components/ui/popover/PopoverContent.vue +57 -0
- package/dist/runtime/components/ui/popover/PopoverContent.vue.d.ts +35 -0
- package/dist/runtime/components/ui/popover/PopoverTrigger.d.vue.ts +14 -0
- package/dist/runtime/components/ui/popover/PopoverTrigger.vue +16 -0
- package/dist/runtime/components/ui/popover/PopoverTrigger.vue.d.ts +14 -0
- package/dist/runtime/components/ui/popover/index.d.ts +4 -0
- package/dist/runtime/components/ui/popover/index.js +4 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendar.d.vue.ts +18 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendar.vue +95 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendar.vue.d.ts +18 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendarCell.d.vue.ts +18 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendarCell.vue +23 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendarCell.vue.d.ts +18 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendarCellTrigger.d.vue.ts +20 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendarCellTrigger.vue +40 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendarCellTrigger.vue.d.ts +20 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendarGrid.d.vue.ts +18 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendarGrid.vue +22 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendarGrid.vue.d.ts +18 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendarGridBody.d.vue.ts +14 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendarGridBody.vue +16 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendarGridBody.vue.d.ts +14 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendarGridHead.d.vue.ts +14 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendarGridHead.vue +16 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendarGridHead.vue.d.ts +14 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendarGridRow.d.vue.ts +18 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendarGridRow.vue +22 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendarGridRow.vue.d.ts +18 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendarHeadCell.d.vue.ts +18 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendarHeadCell.vue +22 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendarHeadCell.vue.d.ts +18 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendarHeader.d.vue.ts +18 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendarHeader.vue +22 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendarHeader.vue.d.ts +18 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendarHeading.d.vue.ts +19 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendarHeading.vue +26 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendarHeading.vue.d.ts +19 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendarNextButton.d.vue.ts +18 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendarNextButton.vue +32 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendarNextButton.vue.d.ts +18 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendarPrevButton.d.vue.ts +18 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendarPrevButton.vue +32 -0
- package/dist/runtime/components/ui/range-calendar/RangeCalendarPrevButton.vue.d.ts +18 -0
- package/dist/runtime/components/ui/range-calendar/index.d.ts +12 -0
- package/dist/runtime/components/ui/range-calendar/index.js +12 -0
- package/dist/runtime/components/ui/textarea/Textarea.d.vue.ts +13 -0
- package/dist/runtime/components/ui/textarea/Textarea.vue +22 -0
- package/dist/runtime/components/ui/textarea/Textarea.vue.d.ts +13 -0
- package/dist/runtime/components/ui/textarea/index.d.ts +1 -0
- package/dist/runtime/components/ui/textarea/index.js +1 -0
- package/dist/runtime/components/ui/tooltip/TooltipContent.vue +1 -1
- package/dist/runtime/plugins/cel/env.d.ts +2 -2
- package/dist/runtime/plugins/cel/env.js +5 -7
- package/package.json +2 -1
package/dist/module.d.mts
CHANGED
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -6,9 +6,7 @@ const module$1 = defineNuxtModule({
|
|
|
6
6
|
name: "@shwfed/nuxt",
|
|
7
7
|
configKey: "shwfed"
|
|
8
8
|
},
|
|
9
|
-
defaults: {
|
|
10
|
-
features: []
|
|
11
|
-
},
|
|
9
|
+
defaults: {},
|
|
12
10
|
setup(options, nuxt) {
|
|
13
11
|
const resolver = createResolver(import.meta.url);
|
|
14
12
|
nuxt.options.runtimeConfig.public.shwfed = options;
|
|
@@ -0,0 +1,59 @@
|
|
|
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;
|
|
32
|
+
declare const _default: typeof __VLS_export;
|
|
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
|
+
};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { Icon } from "@iconify/vue";
|
|
3
|
+
import { Field, FieldLabel } from "./ui/field";
|
|
4
|
+
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputCombobox } from "./ui/input-group";
|
|
5
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "./ui/tooltip";
|
|
6
|
+
import { useI18n } from "vue-i18n";
|
|
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({
|
|
16
|
+
fields: { type: Array, required: true }
|
|
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();
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<template>
|
|
33
|
+
<div>
|
|
34
|
+
<Field
|
|
35
|
+
v-for="(field, i) in fields"
|
|
36
|
+
:key="field.path"
|
|
37
|
+
:class="field.class"
|
|
38
|
+
>
|
|
39
|
+
<InputGroup>
|
|
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
|
+
>
|
|
59
|
+
<CommandItem
|
|
60
|
+
v-for="option in group.options"
|
|
61
|
+
:key="option.value"
|
|
62
|
+
:value="option.value"
|
|
63
|
+
>
|
|
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>
|
|
74
|
+
</CommandItem>
|
|
75
|
+
</CommandGroup>
|
|
76
|
+
</InputCombobox>
|
|
77
|
+
<InputGroupAddon v-if="field.icon">
|
|
78
|
+
<Icon
|
|
79
|
+
:icon="field.icon"
|
|
80
|
+
/>
|
|
81
|
+
</InputGroupAddon>
|
|
82
|
+
<InputGroupAddon
|
|
83
|
+
v-if="hasProperty(modelValue, field.path)"
|
|
84
|
+
align="inline-end"
|
|
85
|
+
>
|
|
86
|
+
<Tooltip :delay-duration="800">
|
|
87
|
+
<TooltipTrigger>
|
|
88
|
+
<InputGroupButton as-child>
|
|
89
|
+
<button
|
|
90
|
+
type="button"
|
|
91
|
+
@click="deleteProperty(modelValue, field.path)"
|
|
92
|
+
>
|
|
93
|
+
<Icon
|
|
94
|
+
icon="fluent:dismiss-20-regular"
|
|
95
|
+
/>
|
|
96
|
+
</button>
|
|
97
|
+
</InputGroupButton>
|
|
98
|
+
</TooltipTrigger>
|
|
99
|
+
<TooltipContent>
|
|
100
|
+
{{ t("clear") }}
|
|
101
|
+
</TooltipContent>
|
|
102
|
+
</Tooltip>
|
|
103
|
+
</InputGroupAddon>
|
|
104
|
+
</InputGroup>
|
|
105
|
+
<FieldLabel
|
|
106
|
+
v-if="isCheating"
|
|
107
|
+
class="font-mono"
|
|
108
|
+
>
|
|
109
|
+
{{ field.path }}
|
|
110
|
+
</FieldLabel>
|
|
111
|
+
<FieldLabel v-else>
|
|
112
|
+
{{ t(`${id}-${i}`) }}
|
|
113
|
+
</FieldLabel>
|
|
114
|
+
</Field>
|
|
115
|
+
</div>
|
|
116
|
+
</template>
|
|
117
|
+
|
|
118
|
+
<i18n lang="json">
|
|
119
|
+
{
|
|
120
|
+
"zh": {
|
|
121
|
+
"clear": "清空"
|
|
122
|
+
},
|
|
123
|
+
"ja": {
|
|
124
|
+
"clear": "クリア"
|
|
125
|
+
},
|
|
126
|
+
"en": {
|
|
127
|
+
"clear": "Clear"
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
</i18n>
|
|
@@ -0,0 +1,59 @@
|
|
|
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;
|
|
32
|
+
declare const _default: typeof __VLS_export;
|
|
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;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { CalendarRootProps, DateValue } from 'reka-ui';
|
|
2
|
+
import type { HTMLAttributes } from 'vue';
|
|
3
|
+
import type { LayoutTypes } from '.';
|
|
4
|
+
type __VLS_Props = CalendarRootProps & {
|
|
5
|
+
class?: HTMLAttributes['class'];
|
|
6
|
+
layout?: LayoutTypes;
|
|
7
|
+
yearRange?: DateValue[];
|
|
8
|
+
};
|
|
9
|
+
declare var __VLS_59: {}, __VLS_67: {}, __VLS_69: {
|
|
10
|
+
date: DateValue;
|
|
11
|
+
month: import("@vueuse/core").ReuseTemplateComponent<{
|
|
12
|
+
date: DateValue;
|
|
13
|
+
}, Record<"default", undefined>>;
|
|
14
|
+
year: import("@vueuse/core").ReuseTemplateComponent<{
|
|
15
|
+
date: DateValue;
|
|
16
|
+
}, Record<"default", undefined>>;
|
|
17
|
+
};
|
|
18
|
+
type __VLS_Slots = {} & {
|
|
19
|
+
'calendar-prev-icon'?: (props: typeof __VLS_59) => any;
|
|
20
|
+
} & {
|
|
21
|
+
'calendar-next-icon'?: (props: typeof __VLS_67) => any;
|
|
22
|
+
} & {
|
|
23
|
+
'calendar-heading'?: (props: typeof __VLS_69) => any;
|
|
24
|
+
};
|
|
25
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
26
|
+
"update:modelValue": (date: DateValue | undefined) => any;
|
|
27
|
+
"update:placeholder": (date: DateValue) => any;
|
|
28
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
29
|
+
"onUpdate:modelValue"?: ((date: DateValue | undefined) => any) | undefined;
|
|
30
|
+
"onUpdate:placeholder"?: ((date: DateValue) => any) | undefined;
|
|
31
|
+
}>, {
|
|
32
|
+
modelValue: DateValue | DateValue[];
|
|
33
|
+
layout: "month-and-year" | "month-only" | "year-only";
|
|
34
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
35
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
36
|
+
declare const _default: typeof __VLS_export;
|
|
37
|
+
export default _default;
|
|
38
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
39
|
+
new (): {
|
|
40
|
+
$slots: S;
|
|
41
|
+
};
|
|
42
|
+
};
|