@koumoul/vjsf 3.7.0 → 3.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/components/fragments/help-message.vue +29 -37
- package/src/components/node.vue +12 -1
- package/src/components/nodes/textarea.vue +3 -3
- package/src/styles/vjsf.css +6 -0
- package/types/components/fragments/select-item.vue.d.ts +2 -2
- package/types/components/fragments/select-selection.vue.d.ts +2 -2
- package/types/composables/use-get-items.d.ts +1 -1
- package/types/composables/use-node.d.ts +1 -1
- package/types/composables/use-select-node.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koumoul/vjsf",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"description": "Generate forms for the vuetify UI library (vuejs) based on annotated JSON schemas.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "vitest run",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"vuetify": "^3.6.13"
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"@json-layout/core": "~1.4.
|
|
74
|
+
"@json-layout/core": "~1.4.1",
|
|
75
75
|
"@vueuse/core": "^10.5.0",
|
|
76
76
|
"debug": "^4.3.4"
|
|
77
77
|
},
|
|
@@ -1,30 +1,37 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="`vjsf-help-message vjsf-help-message-${node.options.density}`">
|
|
3
|
-
<v-
|
|
3
|
+
<v-menu
|
|
4
|
+
v-model="show"
|
|
5
|
+
:class="`vjsf-help-message-tooltip vjsf-help-message-tooltip-${node.options.density}`"
|
|
6
|
+
location="top end"
|
|
7
|
+
offset="4"
|
|
8
|
+
:close-on-content-click="false"
|
|
9
|
+
>
|
|
10
|
+
<template #activator="{ props }">
|
|
11
|
+
<v-btn
|
|
12
|
+
color="info"
|
|
13
|
+
:class="`vjsf-help-message-toggle`"
|
|
14
|
+
:icon="node.options.icons.infoSymbol"
|
|
15
|
+
density="compact"
|
|
16
|
+
variant="flat"
|
|
17
|
+
:size="node.options.density === 'default' ? 28 : 24"
|
|
18
|
+
:title="show ? '' : node.messages.showHelp"
|
|
19
|
+
v-bind="props"
|
|
20
|
+
/>
|
|
21
|
+
</template>
|
|
4
22
|
<v-alert
|
|
5
|
-
v-show="show"
|
|
6
23
|
color="info"
|
|
24
|
+
:density="node.options.density"
|
|
7
25
|
>
|
|
8
26
|
<div v-html="node.layout.help" />
|
|
9
27
|
</v-alert>
|
|
10
|
-
</v-
|
|
11
|
-
<v-btn
|
|
12
|
-
color="info"
|
|
13
|
-
:class="`vjsf-help-message-toggle vjsf-help-message-toggle-${node.options.density}`"
|
|
14
|
-
:icon="show ? node.options.icons.close : node.options.icons.infoSymbol"
|
|
15
|
-
:border="0"
|
|
16
|
-
:elevation="show ? 0 : 2"
|
|
17
|
-
density="compact"
|
|
18
|
-
:size="node.options.density === 'default' ? 28 : 24"
|
|
19
|
-
:title="show ? '' : node.messages.showHelp"
|
|
20
|
-
@click="show = !show"
|
|
21
|
-
/>
|
|
28
|
+
</v-menu>
|
|
22
29
|
</div>
|
|
23
30
|
</template>
|
|
24
31
|
|
|
25
32
|
<script setup>
|
|
26
|
-
import { VSlideXReverseTransition } from 'vuetify/components/transitions'
|
|
27
33
|
import { VAlert } from 'vuetify/components/VAlert'
|
|
34
|
+
import { VMenu } from 'vuetify/components/VMenu'
|
|
28
35
|
import { VBtn } from 'vuetify/components/VBtn'
|
|
29
36
|
import { ref } from 'vue'
|
|
30
37
|
|
|
@@ -41,34 +48,19 @@ const show = ref(false)
|
|
|
41
48
|
|
|
42
49
|
<style>
|
|
43
50
|
.vjsf-help-message {
|
|
51
|
+
height: 0;
|
|
44
52
|
position: relative;
|
|
53
|
+
width: 100%;
|
|
45
54
|
}
|
|
46
|
-
.vjsf-help-message-
|
|
47
|
-
margin-top: 2px;
|
|
48
|
-
margin-bottom: 2px;
|
|
49
|
-
min-height:24px;
|
|
50
|
-
}
|
|
51
|
-
.vjsf-help-message-comfortable {
|
|
52
|
-
margin-top: 4px;
|
|
53
|
-
margin-bottom: 4px;
|
|
54
|
-
min-height:24px;
|
|
55
|
-
}
|
|
56
|
-
.vjsf-help-message-default {
|
|
57
|
-
margin-top: 6px;
|
|
58
|
-
margin-bottom: 6px;
|
|
59
|
-
min-height:28px;
|
|
60
|
-
}
|
|
61
|
-
.vjsf-help-message-toggle {
|
|
55
|
+
.vjsf-help-message .vjsf-help-message-toggle {
|
|
62
56
|
position: absolute;
|
|
63
57
|
top: 0px;
|
|
64
|
-
right:
|
|
58
|
+
right: -26px;
|
|
65
59
|
z-index: 1;
|
|
66
60
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
.vjsf-help-message-default .v-alert {
|
|
71
|
-
padding-right: 26px;
|
|
61
|
+
|
|
62
|
+
.vjsf-help-message.vjsf-help-message-default .vjsf-help-message-toggle {
|
|
63
|
+
right: -30px;
|
|
72
64
|
}
|
|
73
65
|
|
|
74
66
|
</style>
|
package/src/components/node.vue
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import
|
|
2
|
+
import Debug from 'debug'
|
|
3
|
+
import { computed, onRenderTriggered } from 'vue'
|
|
3
4
|
import { useTheme, useDefaults } from 'vuetify'
|
|
4
5
|
import { VCol } from 'vuetify/components/VGrid'
|
|
5
6
|
import { VDefaultsProvider } from 'vuetify/components/VDefaultsProvider'
|
|
6
7
|
import NodeSlot from './fragments/node-slot.vue'
|
|
7
8
|
import HelpMessage from './fragments/help-message.vue'
|
|
8
9
|
|
|
10
|
+
const debugRender = Debug('vjsf:render')
|
|
11
|
+
|
|
9
12
|
useDefaults({}, 'VjsfNode')
|
|
10
13
|
|
|
11
14
|
const props = defineProps({
|
|
@@ -30,6 +33,13 @@ const beforeAfterClasses = {
|
|
|
30
33
|
|
|
31
34
|
const theme = useTheme()
|
|
32
35
|
|
|
36
|
+
if (debugRender.enabled) {
|
|
37
|
+
debugRender('setup node', props.modelValue.fullKey, props.modelValue.layout.comp)
|
|
38
|
+
onRenderTriggered(() => {
|
|
39
|
+
debugRender('render node', props.modelValue.fullKey, props.modelValue.layout.comp)
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
|
|
33
43
|
const indent = computed(() => {
|
|
34
44
|
if (props.modelValue.parentFullKey === null) return 0
|
|
35
45
|
if (!props.modelValue.options.indent) return 0
|
|
@@ -47,6 +57,7 @@ const nodeClasses = computed(() => {
|
|
|
47
57
|
if (props.modelValue.options.summary) classes += ' vjsf-summary'
|
|
48
58
|
if (theme.current.value.dark) classes += ' vjsf-dark'
|
|
49
59
|
if (indent.value) classes += ' ml-' + indent.value
|
|
60
|
+
if (props.modelValue.layout.help && !props.modelValue.options.summary) classes += ' vjsf-has-help'
|
|
50
61
|
return classes
|
|
51
62
|
})
|
|
52
63
|
|
|
@@ -24,15 +24,15 @@ export default defineComponent({
|
|
|
24
24
|
const textarea = ref(null)
|
|
25
25
|
|
|
26
26
|
const { inputProps, localData, compSlots, options } = useNode(
|
|
27
|
-
toRef(props, 'modelValue'), props.statefulLayout, { layoutPropsMap: ['placeholder'] }
|
|
27
|
+
toRef(props, 'modelValue'), props.statefulLayout, { layoutPropsMap: ['placeholder', 'rows'] }
|
|
28
28
|
)
|
|
29
29
|
|
|
30
|
-
const
|
|
30
|
+
const defaultRows = computed(() => options.value.readOnly && options.value.summary ? 3 : undefined)
|
|
31
31
|
|
|
32
32
|
const fullProps = computed(() => {
|
|
33
33
|
const fullProps = { ...inputProps.value }
|
|
34
34
|
fullProps.ref = textarea
|
|
35
|
-
fullProps.rows = rows.value
|
|
35
|
+
fullProps.rows = fullProps.rows ?? defaultRows.value
|
|
36
36
|
fullProps.modelValue = localData.value
|
|
37
37
|
return fullProps
|
|
38
38
|
})
|
package/src/styles/vjsf.css
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<any, {
|
|
2
2
|
multiple: boolean;
|
|
3
|
-
item: import("
|
|
3
|
+
item: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem;
|
|
4
4
|
itemProps: Record<string, any>;
|
|
5
5
|
$props: {
|
|
6
6
|
readonly multiple?: boolean | undefined;
|
|
7
|
-
readonly item?: import("
|
|
7
|
+
readonly item?: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem | undefined;
|
|
8
8
|
readonly itemProps?: Record<string, any> | undefined;
|
|
9
9
|
};
|
|
10
10
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<any> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<any, {
|
|
2
2
|
multiple: boolean;
|
|
3
|
-
item: import("
|
|
3
|
+
item: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem;
|
|
4
4
|
last: boolean;
|
|
5
5
|
$props: {
|
|
6
6
|
readonly multiple?: boolean | undefined;
|
|
7
|
-
readonly item?: import("
|
|
7
|
+
readonly item?: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem | undefined;
|
|
8
8
|
readonly last?: boolean | undefined;
|
|
9
9
|
};
|
|
10
10
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<any> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export default function _default(nodeRef: import('vue').Ref<import('../types.js').VjsfNode>, statefulLayout: import('../types.js').VjsfStatefulLayout): {
|
|
6
6
|
hasItems: import("vue").ComputedRef<boolean>;
|
|
7
|
-
items: import("vue").Ref<import("
|
|
7
|
+
items: import("vue").Ref<import("../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItems, import("../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItems>;
|
|
8
8
|
loading: import("vue").Ref<boolean, boolean>;
|
|
9
9
|
search: import("vue").Ref<string, string>;
|
|
10
10
|
prepareSelectedItem: (selectedItem: any, itemValue: any) => any;
|
|
@@ -25,7 +25,7 @@ export default function _default(nodeRef: import('vue').Ref<import('../types.js'
|
|
|
25
25
|
compSlots: import("vue").ComputedRef<Record<string, any>>;
|
|
26
26
|
options: import("vue").ComputedRef<Required<import("../types.js").VjsfOptions>>;
|
|
27
27
|
skeleton: import("vue").ComputedRef<import("../../node_modules/@json-layout/core/types/compile/types.js").SkeletonNode>;
|
|
28
|
-
layout: import("vue").ComputedRef<import("
|
|
28
|
+
layout: import("vue").ComputedRef<import("../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").BaseCompObject>;
|
|
29
29
|
data: import("vue").ComputedRef<unknown>;
|
|
30
30
|
children: import("vue").ComputedRef<import("../../node_modules/@json-layout/core/types/state/types.js").StateNode[] | undefined>;
|
|
31
31
|
};
|
|
@@ -18,7 +18,7 @@ export default function _default(nodeRef: import('vue').Ref<import('../types.js'
|
|
|
18
18
|
}>;
|
|
19
19
|
getItems: {
|
|
20
20
|
hasItems: import("vue").ComputedRef<boolean>;
|
|
21
|
-
items: import("vue").Ref<import("
|
|
21
|
+
items: import("vue").Ref<import("../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItems, import("../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItems>;
|
|
22
22
|
loading: import("vue").Ref<boolean, boolean>;
|
|
23
23
|
search: import("vue").Ref<string, string>;
|
|
24
24
|
prepareSelectedItem: (selectedItem: any, itemValue: any) => any;
|