@ederzeel/nuxt-schema-form-nightly 0.1.0-29257619.56503a4 → 0.1.0-29323954.0b153f2
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 +2 -1
- package/dist/module.json +1 -1
- package/dist/runtime/components/Array.d.vue.ts +23 -0
- package/dist/runtime/components/Array.vue +33 -42
- package/dist/runtime/components/Array.vue.d.ts +23 -0
- package/dist/runtime/components/Component.d.vue.ts +43 -0
- package/dist/runtime/components/Component.vue +85 -98
- package/dist/runtime/components/Component.vue.d.ts +43 -0
- package/dist/runtime/components/Date.d.vue.ts +17 -0
- package/dist/runtime/components/Date.vue +20 -24
- package/dist/runtime/components/Date.vue.d.ts +17 -0
- package/dist/runtime/components/Form.d.vue.ts +31 -0
- package/dist/runtime/components/Form.vue +32 -45
- package/dist/runtime/components/Form.vue.d.ts +31 -0
- package/dist/runtime/components/InputField.d.vue.ts +18 -0
- package/dist/runtime/components/InputField.vue +10 -11
- package/dist/runtime/components/InputField.vue.d.ts +18 -0
- package/dist/runtime/components/InputNumber.d.vue.ts +20 -0
- package/dist/runtime/components/InputNumber.vue +14 -15
- package/dist/runtime/components/InputNumber.vue.d.ts +20 -0
- package/dist/runtime/components/MultiSelect.d.vue.ts +29 -0
- package/dist/runtime/components/MultiSelect.vue +21 -28
- package/dist/runtime/components/MultiSelect.vue.d.ts +29 -0
- package/dist/runtime/components/Object.d.vue.ts +17 -0
- package/dist/runtime/components/Object.vue +18 -23
- package/dist/runtime/components/Object.vue.d.ts +17 -0
- package/dist/runtime/components/Row.d.vue.ts +16 -0
- package/dist/runtime/components/Row.vue +17 -22
- package/dist/runtime/components/Row.vue.d.ts +16 -0
- package/dist/runtime/components/Select.d.vue.ts +20 -0
- package/dist/runtime/components/Select.vue +14 -17
- package/dist/runtime/components/Select.vue.d.ts +20 -0
- package/dist/runtime/components/Slider.d.vue.ts +20 -0
- package/dist/runtime/components/Slider.vue +12 -13
- package/dist/runtime/components/Slider.vue.d.ts +20 -0
- package/dist/runtime/components/Textarea.d.vue.ts +17 -0
- package/dist/runtime/components/Textarea.vue +9 -10
- package/dist/runtime/components/Textarea.vue.d.ts +17 -0
- package/dist/runtime/components/Toggle.d.vue.ts +17 -0
- package/dist/runtime/components/Toggle.vue +9 -10
- package/dist/runtime/components/Toggle.vue.d.ts +17 -0
- package/dist/runtime/components/array/ArrayObject.d.vue.ts +21 -0
- package/dist/runtime/components/array/ArrayObject.vue +134 -170
- package/dist/runtime/components/array/ArrayObject.vue.d.ts +21 -0
- package/dist/types.d.mts +3 -1
- package/package.json +33 -33
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -13
- package/dist/types.d.ts +0 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
id: string;
|
|
3
|
+
title?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
enum: string[];
|
|
7
|
+
enum_titles?: string[];
|
|
8
|
+
isRequired: boolean;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_ModelProps = {
|
|
11
|
+
modelValue?: string;
|
|
12
|
+
};
|
|
13
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
14
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
15
|
+
"update:modelValue": (value: string) => any;
|
|
16
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
17
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
18
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
id: string;
|
|
3
|
+
title?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
type: string;
|
|
6
|
+
minimum?: number;
|
|
7
|
+
maximum?: number;
|
|
8
|
+
isRequired: boolean;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_ModelProps = {
|
|
11
|
+
modelValue: number;
|
|
12
|
+
};
|
|
13
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
14
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
15
|
+
"update:modelValue": (value: number) => any;
|
|
16
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
17
|
+
"onUpdate:modelValue"?: ((value: number) => any) | undefined;
|
|
18
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
<script
|
|
2
|
-
const props = defineProps
|
|
3
|
-
id:
|
|
4
|
-
title
|
|
5
|
-
description
|
|
6
|
-
type:
|
|
7
|
-
minimum
|
|
8
|
-
maximum
|
|
9
|
-
isRequired:
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const value = defineModel<number>({ required: true, default: 0 })
|
|
1
|
+
<script setup>
|
|
2
|
+
const props = defineProps({
|
|
3
|
+
id: { type: String, required: true },
|
|
4
|
+
title: { type: String, required: false },
|
|
5
|
+
description: { type: String, required: false },
|
|
6
|
+
type: { type: String, required: true },
|
|
7
|
+
minimum: { type: Number, required: false },
|
|
8
|
+
maximum: { type: Number, required: false },
|
|
9
|
+
isRequired: { type: Boolean, required: true }
|
|
10
|
+
});
|
|
11
|
+
const value = defineModel({ type: Number, ...{ required: true, default: 0 } });
|
|
13
12
|
</script>
|
|
14
13
|
|
|
15
14
|
<template>
|
|
16
15
|
<div>
|
|
17
16
|
<UFormField
|
|
18
17
|
:label="props.title || id"
|
|
19
|
-
:hint="!props.isRequired ? 'optional' :
|
|
18
|
+
:hint="!props.isRequired ? 'optional' : void 0"
|
|
20
19
|
:description="props.description"
|
|
21
20
|
:name="props.id"
|
|
22
21
|
>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
id: string;
|
|
3
|
+
title?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
type: string;
|
|
6
|
+
minimum?: number;
|
|
7
|
+
maximum?: number;
|
|
8
|
+
isRequired: boolean;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_ModelProps = {
|
|
11
|
+
modelValue: number;
|
|
12
|
+
};
|
|
13
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
14
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
15
|
+
"update:modelValue": (value: number) => any;
|
|
16
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
17
|
+
"onUpdate:modelValue"?: ((value: number) => any) | undefined;
|
|
18
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
id: string;
|
|
3
|
+
title?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
isRequired: boolean;
|
|
6
|
+
};
|
|
7
|
+
type __VLS_ModelProps = {
|
|
8
|
+
modelValue?: string;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
11
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
|
+
"update:modelValue": (value: string) => any;
|
|
13
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
14
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
15
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
declare const _default: typeof __VLS_export;
|
|
17
|
+
export default _default;
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
<script
|
|
2
|
-
const props = defineProps
|
|
3
|
-
id:
|
|
4
|
-
title
|
|
5
|
-
description
|
|
6
|
-
isRequired:
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const value = defineModel<string>({ default: '' })
|
|
1
|
+
<script setup>
|
|
2
|
+
const props = defineProps({
|
|
3
|
+
id: { type: String, required: true },
|
|
4
|
+
title: { type: String, required: false },
|
|
5
|
+
description: { type: String, required: false },
|
|
6
|
+
isRequired: { type: Boolean, required: true }
|
|
7
|
+
});
|
|
8
|
+
const value = defineModel({ type: String, ...{ default: "" } });
|
|
10
9
|
</script>
|
|
11
10
|
|
|
12
11
|
<template>
|
|
13
12
|
<div>
|
|
14
13
|
<UFormField
|
|
15
14
|
:label="props.title || id"
|
|
16
|
-
:hint="!props.isRequired ? 'optional' :
|
|
15
|
+
:hint="!props.isRequired ? 'optional' : void 0"
|
|
17
16
|
:description="props.description"
|
|
18
17
|
:name="props.id"
|
|
19
18
|
>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
id: string;
|
|
3
|
+
title?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
isRequired: boolean;
|
|
6
|
+
};
|
|
7
|
+
type __VLS_ModelProps = {
|
|
8
|
+
modelValue?: string;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
11
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
|
+
"update:modelValue": (value: string) => any;
|
|
13
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
14
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
15
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
declare const _default: typeof __VLS_export;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
id: string;
|
|
3
|
+
title?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
isRequired: boolean;
|
|
6
|
+
};
|
|
7
|
+
type __VLS_ModelProps = {
|
|
8
|
+
modelValue: boolean;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
11
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
|
+
"update:modelValue": (value: boolean) => any;
|
|
13
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
14
|
+
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
15
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
declare const _default: typeof __VLS_export;
|
|
17
|
+
export default _default;
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
<script
|
|
2
|
-
const props = defineProps
|
|
3
|
-
id:
|
|
4
|
-
title
|
|
5
|
-
description
|
|
6
|
-
isRequired:
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const value = defineModel<boolean>({ required: true })
|
|
1
|
+
<script setup>
|
|
2
|
+
const props = defineProps({
|
|
3
|
+
id: { type: String, required: true },
|
|
4
|
+
title: { type: String, required: false },
|
|
5
|
+
description: { type: String, required: false },
|
|
6
|
+
isRequired: { type: Boolean, required: true }
|
|
7
|
+
});
|
|
8
|
+
const value = defineModel({ type: Boolean, ...{ required: true } });
|
|
10
9
|
</script>
|
|
11
10
|
|
|
12
11
|
<template>
|
|
13
12
|
<div>
|
|
14
13
|
<UFormField
|
|
15
14
|
:label="props.title || id"
|
|
16
|
-
:hint="!props.isRequired ? 'optional' :
|
|
15
|
+
:hint="!props.isRequired ? 'optional' : void 0"
|
|
17
16
|
:description="props.description"
|
|
18
17
|
:name="props.id"
|
|
19
18
|
>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
id: string;
|
|
3
|
+
title?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
isRequired: boolean;
|
|
6
|
+
};
|
|
7
|
+
type __VLS_ModelProps = {
|
|
8
|
+
modelValue: boolean;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
11
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
|
+
"update:modelValue": (value: boolean) => any;
|
|
13
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
14
|
+
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
15
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
declare const _default: typeof __VLS_export;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { TableColumn } from '@nuxt/ui';
|
|
2
|
+
import type { PropertiesType } from '../../types/index.js';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
id: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
jsonSchemaPath: string;
|
|
8
|
+
items: PropertiesType;
|
|
9
|
+
modelValue: Record<string, unknown>[];
|
|
10
|
+
isRequired: boolean;
|
|
11
|
+
minItems?: number;
|
|
12
|
+
maxItems?: number;
|
|
13
|
+
edit?: boolean;
|
|
14
|
+
columns?: TableColumn<{}>[];
|
|
15
|
+
editInline?: boolean;
|
|
16
|
+
required?: string[];
|
|
17
|
+
setHidden?: (value: boolean) => void;
|
|
18
|
+
};
|
|
19
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, any, string, import("vue").PublicProps, any, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
|
+
declare const _default: typeof __VLS_export;
|
|
21
|
+
export default _default;
|
|
@@ -1,213 +1,177 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import { compileSchema } from
|
|
3
|
-
import SComponent from
|
|
4
|
-
import { ref, toRaw, computed, h, resolveComponent } from
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
editInline?: boolean
|
|
25
|
-
required?: string[]
|
|
26
|
-
setHidden?: (value: boolean) => void
|
|
27
|
-
}>()
|
|
28
|
-
const emit = defineEmits(['update:modelValue', 'submit'])
|
|
29
|
-
|
|
1
|
+
<script setup>
|
|
2
|
+
import { compileSchema } from "json-schema-library";
|
|
3
|
+
import SComponent from "../Component.vue";
|
|
4
|
+
import { ref, toRaw, computed, h, resolveComponent } from "vue";
|
|
5
|
+
const UDropdownMenu = resolveComponent("UDropdownMenu");
|
|
6
|
+
const UButton = resolveComponent("UButton");
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
id: { type: String, required: true },
|
|
9
|
+
title: { type: String, required: false },
|
|
10
|
+
description: { type: String, required: false },
|
|
11
|
+
jsonSchemaPath: { type: String, required: true },
|
|
12
|
+
items: { type: Object, required: true },
|
|
13
|
+
modelValue: { type: Array, required: true },
|
|
14
|
+
isRequired: { type: Boolean, required: true },
|
|
15
|
+
minItems: { type: Number, required: false },
|
|
16
|
+
maxItems: { type: Number, required: false },
|
|
17
|
+
edit: { type: Boolean, required: false },
|
|
18
|
+
columns: { type: Array, required: false },
|
|
19
|
+
editInline: { type: Boolean, required: false },
|
|
20
|
+
required: { type: Array, required: false },
|
|
21
|
+
setHidden: { type: Function, required: false }
|
|
22
|
+
});
|
|
23
|
+
const emit = defineEmits(["update:modelValue", "submit"]);
|
|
30
24
|
const massActions = [
|
|
31
25
|
[
|
|
32
26
|
{
|
|
33
|
-
label:
|
|
27
|
+
label: "delete",
|
|
34
28
|
click: () => {
|
|
35
|
-
massRemove()
|
|
36
|
-
selectedRows.value = []
|
|
29
|
+
massRemove();
|
|
30
|
+
selectedRows.value = [];
|
|
37
31
|
}
|
|
38
32
|
}
|
|
39
33
|
]
|
|
40
|
-
]
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
const model = ref<{ index: number; value: Record<string, unknown> | undefined }>({
|
|
34
|
+
];
|
|
35
|
+
const selectedRows = ref([]);
|
|
36
|
+
const schemaObject = ref(compileSchema(props.items));
|
|
37
|
+
const model = ref({
|
|
45
38
|
index: 0,
|
|
46
|
-
value:
|
|
47
|
-
})
|
|
39
|
+
value: void 0
|
|
40
|
+
});
|
|
48
41
|
const expand = ref({
|
|
49
42
|
openedRows: [],
|
|
50
43
|
row: null
|
|
51
|
-
})
|
|
52
|
-
|
|
44
|
+
});
|
|
53
45
|
const values = computed(() => {
|
|
54
46
|
if (props.modelValue.length > 0) {
|
|
55
|
-
return toRaw(props.modelValue).map((x, i) => ({ ...x, __id: i }))
|
|
47
|
+
return toRaw(props.modelValue).map((x, i) => ({ ...x, __id: i }));
|
|
56
48
|
} else if (props.minItems && props.minItems > 0) {
|
|
57
|
-
const template = schemaObject.value.getData()
|
|
58
|
-
return [...Array(props.minItems)].map((_, i) => ({ ...template, __id: i }))
|
|
49
|
+
const template = schemaObject.value.getData();
|
|
50
|
+
return [...Array(props.minItems)].map((_, i) => ({ ...template, __id: i }));
|
|
59
51
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
([key, value]): TableColumn<{}, unknown[]> => {
|
|
68
|
-
if (value.type === 'array') {
|
|
52
|
+
return [];
|
|
53
|
+
});
|
|
54
|
+
const geneateColumnsFromSchema = (items) => {
|
|
55
|
+
if (!items.properties) return [];
|
|
56
|
+
const res = Object.entries(items.properties).map(
|
|
57
|
+
([key, value]) => {
|
|
58
|
+
if (value.type === "array") {
|
|
69
59
|
return {
|
|
70
60
|
header: value.title || key,
|
|
71
61
|
accessorKey: key,
|
|
72
62
|
cell: ({ getValue }) => {
|
|
73
|
-
return getValue().length
|
|
63
|
+
return getValue().length;
|
|
74
64
|
}
|
|
75
|
-
}
|
|
65
|
+
};
|
|
76
66
|
}
|
|
77
67
|
return {
|
|
78
68
|
header: value.title || key,
|
|
79
69
|
accessorKey: key
|
|
80
|
-
}
|
|
70
|
+
};
|
|
81
71
|
}
|
|
82
|
-
)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const columns = computed<TableColumn<{}>[]>(() => {
|
|
88
|
-
const columns = props.columns ? Array.from(props.columns) : geneateColumnsFromSchema(props.items)
|
|
89
|
-
|
|
72
|
+
);
|
|
73
|
+
return res;
|
|
74
|
+
};
|
|
75
|
+
const columns = computed(() => {
|
|
76
|
+
const columns2 = props.columns ? Array.from(props.columns) : geneateColumnsFromSchema(props.items);
|
|
90
77
|
if (props.editInline) {
|
|
91
|
-
|
|
92
|
-
id:
|
|
93
|
-
cell: ({ row }) =>
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
})
|
|
78
|
+
columns2.unshift({
|
|
79
|
+
id: "expand",
|
|
80
|
+
cell: ({ row }) => h(UButton, {
|
|
81
|
+
color: "neutral",
|
|
82
|
+
variant: "ghost",
|
|
83
|
+
icon: "i-lucide-chevron-down",
|
|
84
|
+
square: true,
|
|
85
|
+
"aria-label": "Expand",
|
|
86
|
+
ui: {
|
|
87
|
+
leadingIcon: ["transition-transform", row.getIsExpanded() ? "duration-200 rotate-180" : ""]
|
|
88
|
+
},
|
|
89
|
+
onClick: () => row.toggleExpanded()
|
|
90
|
+
})
|
|
91
|
+
});
|
|
106
92
|
}
|
|
107
|
-
|
|
108
93
|
if (props.edit) {
|
|
109
|
-
|
|
110
|
-
id:
|
|
94
|
+
columns2.push({
|
|
95
|
+
id: "actions",
|
|
111
96
|
cell: ({ row }) => {
|
|
112
97
|
return h(
|
|
113
|
-
|
|
114
|
-
{ class:
|
|
98
|
+
"div",
|
|
99
|
+
{ class: "text-right" },
|
|
115
100
|
h(
|
|
116
101
|
UDropdownMenu,
|
|
117
102
|
{
|
|
118
103
|
content: {
|
|
119
|
-
align:
|
|
104
|
+
align: "end"
|
|
120
105
|
},
|
|
121
106
|
items: getRowItems(row),
|
|
122
|
-
|
|
107
|
+
"aria-label": "Actions dropdown"
|
|
123
108
|
},
|
|
124
|
-
() =>
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
})
|
|
109
|
+
() => h(UButton, {
|
|
110
|
+
icon: "i-lucide-ellipsis-vertical",
|
|
111
|
+
color: "neutral",
|
|
112
|
+
variant: "ghost",
|
|
113
|
+
class: "ml-auto",
|
|
114
|
+
"aria-label": "Actions dropdown"
|
|
115
|
+
})
|
|
132
116
|
)
|
|
133
|
-
)
|
|
117
|
+
);
|
|
134
118
|
}
|
|
135
|
-
})
|
|
119
|
+
});
|
|
136
120
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
function getRowItems(row: Row<{}>) {
|
|
121
|
+
return columns2;
|
|
122
|
+
});
|
|
123
|
+
function getRowItems(row) {
|
|
142
124
|
return [
|
|
143
125
|
{
|
|
144
|
-
label:
|
|
126
|
+
label: "edit",
|
|
145
127
|
onSelect: () => open(row.index)
|
|
146
128
|
},
|
|
147
129
|
{
|
|
148
|
-
label:
|
|
130
|
+
label: "delete",
|
|
149
131
|
onSelect: () => {
|
|
150
|
-
remove(row.index)
|
|
151
|
-
selectedRows.value = []
|
|
132
|
+
remove(row.index);
|
|
133
|
+
selectedRows.value = [];
|
|
152
134
|
}
|
|
153
135
|
}
|
|
154
|
-
]
|
|
136
|
+
];
|
|
155
137
|
}
|
|
156
|
-
|
|
157
138
|
const options = computed(() => {
|
|
158
|
-
let res
|
|
159
|
-
modelValue?: any
|
|
160
|
-
'onUpdate:modelValue'?: (v: any) => void
|
|
161
|
-
expand?: {
|
|
162
|
-
openedRows: any[]
|
|
163
|
-
row: null
|
|
164
|
-
}
|
|
165
|
-
'update:expand'?: (v: any) => void
|
|
166
|
-
} = {}
|
|
167
|
-
|
|
139
|
+
let res = {};
|
|
168
140
|
if (props.edit) {
|
|
169
|
-
res.modelValue = selectedRows.value
|
|
170
|
-
res[
|
|
141
|
+
res.modelValue = selectedRows.value;
|
|
142
|
+
res["onUpdate:modelValue"] = (value) => selectedRows.value = value;
|
|
171
143
|
}
|
|
172
144
|
if (props.editInline) {
|
|
173
|
-
res.expand = expand.value
|
|
174
|
-
res[
|
|
145
|
+
res.expand = expand.value;
|
|
146
|
+
res["update:expand"] = (value) => expand.value = value;
|
|
175
147
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
res[index] = value
|
|
188
|
-
emit('update:modelValue', res)
|
|
189
|
-
}
|
|
190
|
-
|
|
148
|
+
return res;
|
|
149
|
+
});
|
|
150
|
+
const open = (index) => {
|
|
151
|
+
if (props.setHidden) props.setHidden(true);
|
|
152
|
+
model.value = { index, value: JSON.parse(JSON.stringify(values.value[index])) };
|
|
153
|
+
};
|
|
154
|
+
const onInput = (value, index) => {
|
|
155
|
+
const res = JSON.parse(JSON.stringify(props.modelValue));
|
|
156
|
+
res[index] = value;
|
|
157
|
+
emit("update:modelValue", res);
|
|
158
|
+
};
|
|
191
159
|
const add = () => {
|
|
192
|
-
emit(
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
props.modelValue
|
|
197
|
-
|
|
198
|
-
}
|
|
199
|
-
|
|
160
|
+
emit("update:modelValue", [...props.modelValue, schemaObject.value.getData()]);
|
|
161
|
+
};
|
|
162
|
+
const remove = (index) => {
|
|
163
|
+
props.modelValue.splice(index, 1);
|
|
164
|
+
emit("update:modelValue", props.modelValue);
|
|
165
|
+
};
|
|
200
166
|
const massRemove = () => {
|
|
201
|
-
let res = props.modelValue
|
|
202
|
-
for (const index of selectedRows.value.map(x => x.__id)) {
|
|
203
|
-
res.splice(index, 1)
|
|
167
|
+
let res = props.modelValue;
|
|
168
|
+
for (const index of selectedRows.value.map((x) => x.__id)) {
|
|
169
|
+
res.splice(index, 1);
|
|
204
170
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
const setHiddenSelf = (value: boolean) => (hidden.value = value)
|
|
210
|
-
const hidden = ref(false)
|
|
171
|
+
emit("update:modelValue", res);
|
|
172
|
+
};
|
|
173
|
+
const setHiddenSelf = (value) => hidden.value = value;
|
|
174
|
+
const hidden = ref(false);
|
|
211
175
|
</script>
|
|
212
176
|
|
|
213
177
|
<template>
|
|
@@ -241,12 +205,12 @@ const hidden = ref(false)
|
|
|
241
205
|
:id="id.length <= 0 ? `${row.index}` : `${id}[${row.index}]`"
|
|
242
206
|
:model-value="row.original"
|
|
243
207
|
:json-schema-path="
|
|
244
|
-
|
|
245
|
-
|
|
208
|
+
jsonSchemaPath?.length <= 0 ? `properties.${row.index}` : `${jsonSchemaPath}[${row.index}]`
|
|
209
|
+
"
|
|
246
210
|
v-bind="items"
|
|
247
211
|
:isRequired="false"
|
|
248
212
|
class="mt-4"
|
|
249
|
-
@update:model-value="(event
|
|
213
|
+
@update:model-value="(event) => onInput(event, row.index)"
|
|
250
214
|
@submit="() => emit('submit')"
|
|
251
215
|
/>
|
|
252
216
|
</div>
|
|
@@ -259,34 +223,34 @@ const hidden = ref(false)
|
|
|
259
223
|
:id="id.length <= 0 ? `${model.index}` : `${id}[0]`"
|
|
260
224
|
:model-value="model.value"
|
|
261
225
|
:json-schema-path="
|
|
262
|
-
|
|
263
|
-
|
|
226
|
+
jsonSchemaPath?.length <= 0 ? `properties.${model.index}` : `${jsonSchemaPath}[${model.index}]`
|
|
227
|
+
"
|
|
264
228
|
v-bind="items"
|
|
265
229
|
:isRequired="false"
|
|
266
230
|
class="mt-4"
|
|
267
231
|
:setHidden="setHiddenSelf"
|
|
268
|
-
@update:model-value="(event
|
|
232
|
+
@update:model-value="(event) => model.value = event"
|
|
269
233
|
@submit="() => emit('submit')"
|
|
270
234
|
/>
|
|
271
235
|
<div class="mt-4 flex gap-2 justify-end">
|
|
272
236
|
<UButton
|
|
273
237
|
@click="
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
238
|
+
() => {
|
|
239
|
+
if (model.value) onInput(model.value, model.index);
|
|
240
|
+
if (props.setHidden) props.setHidden(false);
|
|
241
|
+
model.value = void 0;
|
|
242
|
+
}
|
|
243
|
+
"
|
|
280
244
|
>Save</UButton
|
|
281
245
|
>
|
|
282
246
|
<UButton
|
|
283
247
|
variant="outline"
|
|
284
248
|
@click="
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
249
|
+
() => {
|
|
250
|
+
if (props.setHidden) props.setHidden(false);
|
|
251
|
+
model.value = void 0;
|
|
252
|
+
}
|
|
253
|
+
"
|
|
290
254
|
>Cancle</UButton
|
|
291
255
|
>
|
|
292
256
|
</div>
|