@koumoul/vjsf 3.0.0-beta.8 → 3.0.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/README.md +21 -0
- package/package.json +13 -20
- package/src/compat/v2.js +126 -27
- package/src/components/fragments/child-subtitle.vue +25 -0
- package/src/components/fragments/help-message.vue +33 -8
- package/src/components/fragments/section-header.vue +9 -7
- package/src/components/fragments/select-item-icon.vue +2 -2
- package/src/components/fragments/select-item.vue +2 -1
- package/src/components/fragments/select-selection.vue +2 -1
- package/src/components/fragments/selection-group.vue +105 -0
- package/src/components/fragments/text-field-menu.vue +16 -7
- package/src/components/node.vue +58 -41
- package/src/components/nodes/autocomplete.vue +14 -60
- package/src/components/nodes/card.vue +39 -0
- package/src/components/nodes/checkbox-group.vue +39 -0
- package/src/components/nodes/checkbox.vue +31 -26
- package/src/components/nodes/color-picker.vue +10 -5
- package/src/components/nodes/combobox.vue +17 -40
- package/src/components/nodes/date-picker.vue +30 -13
- package/src/components/nodes/date-time-picker.vue +83 -3
- package/src/components/nodes/expansion-panels.vue +17 -9
- package/src/components/nodes/file-input.vue +15 -11
- package/src/components/nodes/list.vue +246 -112
- package/src/components/nodes/number-combobox.vue +18 -39
- package/src/components/nodes/number-field.vue +17 -11
- package/src/components/nodes/one-of-select.vue +53 -27
- package/src/components/nodes/radio-group.vue +58 -0
- package/src/components/nodes/section.vue +4 -1
- package/src/components/nodes/select.vue +15 -54
- package/src/components/nodes/slider.vue +32 -29
- package/src/components/nodes/stepper.vue +10 -2
- package/src/components/nodes/switch-group.vue +39 -0
- package/src/components/nodes/switch.vue +31 -26
- package/src/components/nodes/tabs.vue +20 -8
- package/src/components/nodes/text-field.vue +10 -7
- package/src/components/nodes/textarea.vue +20 -12
- package/src/components/nodes/time-picker.vue +41 -1
- package/src/components/nodes/vertical-tabs.vue +16 -6
- package/src/components/tree.vue +1 -1
- package/src/components/vjsf.vue +11 -1
- package/src/composables/use-comp-defaults.js +19 -0
- package/src/composables/use-dnd.js +2 -1
- package/src/composables/use-get-items.js +53 -0
- package/src/composables/use-node.js +136 -0
- package/src/composables/use-select-node.js +67 -0
- package/src/composables/use-vjsf.js +74 -42
- package/src/index.js +5 -2
- package/src/options.js +67 -0
- package/src/types.ts +64 -33
- package/src/utils/arrays.js +37 -6
- package/types/compat/v2.d.ts.map +1 -1
- package/types/compile/index.d.ts +2 -2
- package/types/compile/index.d.ts.map +1 -1
- package/types/compile/options.d.ts +3 -2
- package/types/compile/options.d.ts.map +1 -1
- package/types/components/fragments/child-subtitle.vue.d.ts +8 -0
- package/types/components/fragments/child-subtitle.vue.d.ts.map +1 -0
- package/types/components/fragments/help-message.vue.d.ts +2 -2
- package/types/components/fragments/node-slot.vue.d.ts +2 -44
- package/types/components/fragments/node-slot.vue.d.ts.map +1 -1
- package/types/components/fragments/section-header.vue.d.ts +4 -2
- package/types/components/fragments/select-item-icon.vue.d.ts +2 -12
- package/types/components/fragments/select-item.vue.d.ts +2 -2
- package/types/components/fragments/select-selection.vue.d.ts +2 -2
- package/types/components/fragments/selection-group.vue.d.ts +5 -0
- package/types/components/fragments/selection-group.vue.d.ts.map +1 -0
- package/types/components/fragments/text-field-menu.vue.d.ts +2 -2
- package/types/components/fragments/text-field-menu.vue.d.ts.map +1 -1
- package/types/components/node.vue.d.ts +2 -2
- package/types/components/nodes/autocomplete.vue.d.ts +2 -24
- package/types/components/nodes/autocomplete.vue.d.ts.map +1 -1
- package/types/components/nodes/card.vue.d.ts +10 -0
- package/types/components/nodes/card.vue.d.ts.map +1 -0
- package/types/components/nodes/checkbox-group.vue.d.ts +5 -0
- package/types/components/nodes/checkbox-group.vue.d.ts.map +1 -0
- package/types/components/nodes/checkbox.vue.d.ts +3 -8
- package/types/components/nodes/color-picker.vue.d.ts +2 -2
- package/types/components/nodes/combobox.vue.d.ts +2 -24
- package/types/components/nodes/combobox.vue.d.ts.map +1 -1
- package/types/components/nodes/date-picker.vue.d.ts +2 -2
- package/types/components/nodes/date-time-picker.vue.d.ts +4 -4
- package/types/components/nodes/expansion-panels.vue.d.ts +2 -2
- package/types/components/nodes/file-input.vue.d.ts +2 -24
- package/types/components/nodes/file-input.vue.d.ts.map +1 -1
- package/types/components/nodes/list.vue.d.ts +2 -2
- package/types/components/nodes/number-combobox.vue.d.ts +2 -24
- package/types/components/nodes/number-combobox.vue.d.ts.map +1 -1
- package/types/components/nodes/number-field.vue.d.ts +2 -24
- package/types/components/nodes/number-field.vue.d.ts.map +1 -1
- package/types/components/nodes/one-of-select.vue.d.ts +2 -2
- package/types/components/nodes/radio-group.vue.d.ts +5 -0
- package/types/components/nodes/radio-group.vue.d.ts.map +1 -0
- package/types/components/nodes/section.vue.d.ts +2 -2
- package/types/components/nodes/select.vue.d.ts +2 -24
- package/types/components/nodes/select.vue.d.ts.map +1 -1
- package/types/components/nodes/slider.vue.d.ts +3 -8
- package/types/components/nodes/stepper.vue.d.ts +2 -2
- package/types/components/nodes/switch-group.vue.d.ts +5 -0
- package/types/components/nodes/switch-group.vue.d.ts.map +1 -0
- package/types/components/nodes/switch.vue.d.ts +3 -8
- package/types/components/nodes/tabs.vue.d.ts +2 -2
- package/types/components/nodes/text-field.vue.d.ts +2 -24
- package/types/components/nodes/text-field.vue.d.ts.map +1 -1
- package/types/components/nodes/textarea.vue.d.ts +2 -24
- package/types/components/nodes/textarea.vue.d.ts.map +1 -1
- package/types/components/nodes/time-picker.vue.d.ts +8 -1
- package/types/components/nodes/vertical-tabs.vue.d.ts +2 -2
- package/types/components/options.d.ts +1 -1
- package/types/components/options.d.ts.map +1 -1
- package/types/components/tree.vue.d.ts +2 -2
- package/types/components/vjsf.vue.d.ts +4 -4
- package/types/composables/use-comp-defaults.d.ts +8 -0
- package/types/composables/use-comp-defaults.d.ts.map +1 -0
- package/types/composables/use-dnd.d.ts +3 -3
- package/types/composables/use-dnd.d.ts.map +1 -1
- package/types/composables/use-field-props.d.ts +30 -0
- package/types/composables/use-field-props.d.ts.map +1 -0
- package/types/composables/use-field.d.ts +31 -0
- package/types/composables/use-field.d.ts.map +1 -0
- package/types/composables/use-get-items.d.ts +12 -0
- package/types/composables/use-get-items.d.ts.map +1 -0
- package/types/composables/use-node.d.ts +32 -0
- package/types/composables/use-node.d.ts.map +1 -0
- package/types/composables/use-select-field.d.ts +21 -0
- package/types/composables/use-select-field.d.ts.map +1 -0
- package/types/composables/use-select-node.d.ts +27 -0
- package/types/composables/use-select-node.d.ts.map +1 -0
- package/types/composables/use-select-props.d.ts +21 -0
- package/types/composables/use-select-props.d.ts.map +1 -0
- package/types/composables/use-select.d.ts +21 -0
- package/types/composables/use-select.d.ts.map +1 -0
- package/types/composables/use-vjsf.d.ts +2 -2
- package/types/composables/use-vjsf.d.ts.map +1 -1
- package/types/iconsets/default-aliases.d.ts +10 -0
- package/types/iconsets/default-aliases.d.ts.map +1 -0
- package/types/iconsets/mdi-svg.d.ts +3 -0
- package/types/iconsets/mdi-svg.d.ts.map +1 -0
- package/types/iconsets/mdi.d.ts +3 -0
- package/types/iconsets/mdi.d.ts.map +1 -0
- package/types/index.d.ts +5 -2
- package/types/index.d.ts.map +1 -1
- package/types/options.d.ts +9 -0
- package/types/options.d.ts.map +1 -0
- package/types/types.d.ts +65 -33
- package/types/types.d.ts.map +1 -1
- package/types/utils/arrays.d.ts +17 -4
- package/types/utils/arrays.d.ts.map +1 -1
- package/types/utils/index.d.ts +0 -3
- package/types/utils/props.d.ts +7 -0
- package/types/utils/props.d.ts.map +1 -1
- package/types/utils/slots.d.ts +8 -0
- package/types/utils/slots.d.ts.map +1 -1
- package/src/compile/index.js +0 -65
- package/src/compile/options.js +0 -19
- package/src/compile/v-jsf-compiled.vue.ejs +0 -61
- package/src/components/options.js +0 -27
- package/src/utils/global-register.js +0 -13
- package/src/utils/index.js +0 -5
- package/src/utils/props.js +0 -107
- package/src/utils/slots.js +0 -18
- package/types/utils/global-register.d.ts +0 -8
- package/types/utils/global-register.d.ts.map +0 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { defineComponent, h, computed } from 'vue'
|
|
3
|
-
import { VTextField } from 'vuetify/components'
|
|
4
|
-
import
|
|
2
|
+
import { defineComponent, h, computed, toRef } from 'vue'
|
|
3
|
+
import { VTextField } from 'vuetify/components/VTextField'
|
|
4
|
+
import useNode from '../../composables/use-node.js'
|
|
5
|
+
import { useDefaults } from 'vuetify'
|
|
5
6
|
|
|
6
7
|
export default defineComponent({
|
|
7
8
|
props: {
|
|
@@ -17,16 +18,21 @@ export default defineComponent({
|
|
|
17
18
|
}
|
|
18
19
|
},
|
|
19
20
|
setup (props) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
useDefaults({}, 'VjsfNumberField')
|
|
22
|
+
|
|
23
|
+
const { inputProps, localData, compSlots } = useNode(
|
|
24
|
+
toRef(props, 'modelValue'), props.statefulLayout, { layoutPropsMap: ['step', 'min', 'max', 'placeholder'], bindData: false }
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
const fullProps = computed(() => {
|
|
28
|
+
const fullProps = { ...inputProps.value }
|
|
29
|
+
fullProps.type = 'number'
|
|
30
|
+
fullProps['onUpdate:modelValue'] = (/** @type string */value) => props.statefulLayout.input(props.modelValue, value && Number(value))
|
|
31
|
+
fullProps.modelValue = localData.value
|
|
32
|
+
return fullProps
|
|
25
33
|
})
|
|
26
|
-
const fieldSlots = computed(() => getCompSlots(props.modelValue, props.statefulLayout))
|
|
27
34
|
|
|
28
|
-
|
|
29
|
-
return () => h(VTextField, fieldProps.value, fieldSlots.value)
|
|
35
|
+
return () => h(VTextField, fullProps.value, compSlots.value)
|
|
30
36
|
}
|
|
31
37
|
})
|
|
32
38
|
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { VRow, VCol } from 'vuetify/components/VGrid'
|
|
3
|
+
import { VSelect } from 'vuetify/components/VSelect'
|
|
4
|
+
import { ref, watch, computed, toRef } from 'vue'
|
|
4
5
|
import { isSection } from '@json-layout/core'
|
|
6
|
+
import { isCompObject } from '@json-layout/vocabulary'
|
|
7
|
+
import useNode from '../../composables/use-node.js'
|
|
5
8
|
import Node from '../node.vue'
|
|
9
|
+
import { useDefaults } from 'vuetify'
|
|
10
|
+
|
|
11
|
+
useDefaults({}, 'VjsfOneOfSelect')
|
|
6
12
|
|
|
7
13
|
const props = defineProps({
|
|
8
14
|
modelValue: {
|
|
@@ -17,40 +23,60 @@ const props = defineProps({
|
|
|
17
23
|
}
|
|
18
24
|
})
|
|
19
25
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
const { inputProps, localData, skeleton, children } = useNode(
|
|
27
|
+
toRef(props, 'modelValue'), props.statefulLayout, { bindData: false }
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
/** @type import('vue').Ref<string | undefined> */
|
|
31
|
+
const activeChildTree = ref(undefined)
|
|
32
|
+
watch(() => children.value?.[0]?.key, () => {
|
|
33
|
+
if (props.modelValue.children?.length === 1) {
|
|
34
|
+
if (typeof props.modelValue.children[0].key === 'number') {
|
|
35
|
+
activeChildTree.value = skeleton.value.childrenTrees?.[props.modelValue.children[0].key]
|
|
36
|
+
}
|
|
26
37
|
} else {
|
|
27
38
|
activeChildTree.value = undefined
|
|
28
39
|
}
|
|
29
40
|
}, { immediate: true })
|
|
30
41
|
|
|
31
|
-
const onChange = (/** @type
|
|
32
|
-
if (!
|
|
33
|
-
props.statefulLayout.activateItem(props.modelValue,
|
|
42
|
+
const onChange = (/** @type {string} */childTree) => {
|
|
43
|
+
if (!skeleton.value.childrenTrees) return
|
|
44
|
+
props.statefulLayout.activateItem(props.modelValue, skeleton.value.childrenTrees.indexOf(childTree))
|
|
34
45
|
}
|
|
35
46
|
|
|
47
|
+
const fieldProps = computed(() => {
|
|
48
|
+
const fieldProps = { ...inputProps.value }
|
|
49
|
+
fieldProps['onUpdate:modelValue'] = onChange
|
|
50
|
+
const items = []
|
|
51
|
+
for (const childTreePointer of skeleton.value.childrenTrees || []) {
|
|
52
|
+
const childTree = props.statefulLayout.compiledLayout.skeletonTrees[childTreePointer]
|
|
53
|
+
const childLayout = props.statefulLayout.compiledLayout.normalizedLayouts[childTree.root]
|
|
54
|
+
if (!isCompObject(childLayout) || !childLayout.if || !!props.statefulLayout.evalNodeExpression(props.modelValue, childLayout.if, localData.value)) {
|
|
55
|
+
items.push(childTree)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
fieldProps.items = items
|
|
59
|
+
fieldProps.itemTitle = 'title'
|
|
60
|
+
fieldProps.itemValue = (/** @type {import('@json-layout/core').SkeletonTree} */childTree) => childTree.root
|
|
61
|
+
return fieldProps
|
|
62
|
+
})
|
|
36
63
|
</script>
|
|
37
64
|
|
|
38
65
|
<template>
|
|
39
|
-
<v-
|
|
40
|
-
v-if="modelValue.skeleton.childrenTrees"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
/>
|
|
66
|
+
<v-row>
|
|
67
|
+
<v-col v-if="modelValue.skeleton.childrenTrees">
|
|
68
|
+
<v-select
|
|
69
|
+
v-bind="fieldProps"
|
|
70
|
+
:model-value="activeChildTree"
|
|
71
|
+
/>
|
|
72
|
+
</v-col>
|
|
73
|
+
<template v-if="modelValue.children?.[0]">
|
|
74
|
+
<node
|
|
75
|
+
v-for="grandChild of isSection(modelValue.children?.[0]) ? modelValue.children?.[0].children : modelValue.children"
|
|
76
|
+
:key="grandChild.fullKey"
|
|
77
|
+
:model-value="/** @type import('../../types.js').VjsfNode */(grandChild)"
|
|
78
|
+
:stateful-layout="statefulLayout"
|
|
79
|
+
/>
|
|
80
|
+
</template>
|
|
55
81
|
</v-row>
|
|
56
82
|
</template>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { VRadio } from 'vuetify/components/VRadio'
|
|
3
|
+
import { VRadioGroup } from 'vuetify/components/VRadioGroup'
|
|
4
|
+
import { VSkeletonLoader } from 'vuetify/components/VSkeletonLoader'
|
|
5
|
+
import { defineComponent, h, computed, toRef } from 'vue'
|
|
6
|
+
import useNode from '../../composables/use-node.js'
|
|
7
|
+
import useGetItems from '../../composables/use-get-items.js'
|
|
8
|
+
import { useDefaults } from 'vuetify'
|
|
9
|
+
|
|
10
|
+
export default defineComponent({
|
|
11
|
+
props: {
|
|
12
|
+
modelValue: {
|
|
13
|
+
/** @type import('vue').PropType<import('../../types.js').VjsfRadioGroupNode> */
|
|
14
|
+
type: Object,
|
|
15
|
+
required: true
|
|
16
|
+
},
|
|
17
|
+
statefulLayout: {
|
|
18
|
+
/** @type import('vue').PropType<import('../../types.js').VjsfStatefulLayout> */
|
|
19
|
+
type: Object,
|
|
20
|
+
required: true
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
setup (props) {
|
|
24
|
+
useDefaults({}, 'VjsfRadioGroup')
|
|
25
|
+
|
|
26
|
+
const nodeRef = toRef(props, 'modelValue')
|
|
27
|
+
const getItems = useGetItems(nodeRef, props.statefulLayout)
|
|
28
|
+
const { inputProps, compSlots, localData } = useNode(nodeRef, props.statefulLayout)
|
|
29
|
+
|
|
30
|
+
const fieldProps = computed(() => {
|
|
31
|
+
const fieldProps = { ...inputProps.value }
|
|
32
|
+
fieldProps.modelValue = localData.value
|
|
33
|
+
return fieldProps
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
const fieldSlots = computed(() => {
|
|
37
|
+
const slots = { ...compSlots.value }
|
|
38
|
+
/** @type {import('vue').VNode[]} */
|
|
39
|
+
const children = []
|
|
40
|
+
if (getItems.loading.value) {
|
|
41
|
+
children.push(h(VSkeletonLoader, { type: 'chip' }))
|
|
42
|
+
} else {
|
|
43
|
+
for (const item of getItems.items.value) {
|
|
44
|
+
children.push(h(VRadio, { label: item.title, value: item.value }))
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
slots.default = () => children
|
|
48
|
+
return slots
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
// @ts-ignore
|
|
52
|
+
return () => {
|
|
53
|
+
return h(VRadioGroup, fieldProps.value, fieldSlots.value)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
</script>
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { VRow } from 'vuetify/components'
|
|
2
|
+
import { VRow } from 'vuetify/components/VGrid'
|
|
3
3
|
import Node from '../node.vue'
|
|
4
4
|
import SectionHeader from '../fragments/section-header.vue'
|
|
5
|
+
import { useDefaults } from 'vuetify'
|
|
6
|
+
|
|
7
|
+
useDefaults({}, 'VjsfSection')
|
|
5
8
|
|
|
6
9
|
defineProps({
|
|
7
10
|
modelValue: {
|
|
@@ -1,77 +1,38 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { VSelect } from 'vuetify/components'
|
|
3
|
-
import { defineComponent, h, computed,
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
import
|
|
2
|
+
import { VSelect } from 'vuetify/components/VSelect'
|
|
3
|
+
import { defineComponent, h, computed, toRef } from 'vue'
|
|
4
|
+
import useSelectNode from '../../composables/use-select-node.js'
|
|
5
|
+
|
|
6
|
+
import { useDefaults } from 'vuetify'
|
|
7
7
|
|
|
8
8
|
export default defineComponent({
|
|
9
9
|
props: {
|
|
10
10
|
modelValue: {
|
|
11
|
-
|
|
11
|
+
/** @type import('vue').PropType<import('../../types.js').VjsfSelectNode> */
|
|
12
12
|
type: Object,
|
|
13
13
|
required: true
|
|
14
14
|
},
|
|
15
15
|
statefulLayout: {
|
|
16
|
-
|
|
16
|
+
/** @type import('vue').PropType<import('../../types.js').VjsfStatefulLayout> */
|
|
17
17
|
type: Object,
|
|
18
18
|
required: true
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
setup (props) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const loading = ref(false)
|
|
22
|
+
useDefaults({}, 'VjsfSelect')
|
|
23
|
+
|
|
24
|
+
const { getItems, selectProps, selectSlots, localData } = useSelectNode(toRef(props, 'modelValue'), props.statefulLayout)
|
|
26
25
|
|
|
27
26
|
const fieldProps = computed(() => {
|
|
28
|
-
const fieldProps =
|
|
29
|
-
|
|
30
|
-
fieldProps.
|
|
31
|
-
fieldProps.
|
|
32
|
-
fieldProps['onUpdate:menu'] = refresh
|
|
27
|
+
const fieldProps = { ...selectProps.value }
|
|
28
|
+
fieldProps.loading = getItems.loading.value
|
|
29
|
+
fieldProps.items = getItems.items.value
|
|
30
|
+
fieldProps.modelValue = localData.value
|
|
33
31
|
return fieldProps
|
|
34
32
|
})
|
|
35
33
|
|
|
36
|
-
/** @type import('@json-layout/core').StateTree | null */
|
|
37
|
-
let lastStateTree = null
|
|
38
|
-
/** @type Record<string, any> | null */
|
|
39
|
-
let lastContext = null
|
|
40
|
-
|
|
41
|
-
const refresh = async () => {
|
|
42
|
-
if (props.statefulLayout.stateTree === lastStateTree && props.statefulLayout.options.context === lastContext) return
|
|
43
|
-
lastStateTree = props.statefulLayout.stateTree
|
|
44
|
-
lastContext = props.statefulLayout.options.context ?? null
|
|
45
|
-
loading.value = true
|
|
46
|
-
items.value = await props.statefulLayout.getItems(props.modelValue)
|
|
47
|
-
loading.value = false
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (!props.modelValue.layout.items) {
|
|
51
|
-
refresh()
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const fieldSlots = computed(() => {
|
|
55
|
-
const slots = getCompSlots(props.modelValue, props.statefulLayout)
|
|
56
|
-
if (!slots.item) {
|
|
57
|
-
slots.item = (/** @type {any} */ context) => h(SelectItem, {
|
|
58
|
-
multiple: props.modelValue.layout.multiple,
|
|
59
|
-
itemProps: context.props,
|
|
60
|
-
item: context.item.raw
|
|
61
|
-
})
|
|
62
|
-
}
|
|
63
|
-
if (!slots.selection) {
|
|
64
|
-
slots.selection = (/** @type {any} */ context) => h(SelectSelection, {
|
|
65
|
-
multiple: props.modelValue.layout.multiple,
|
|
66
|
-
last: props.modelValue.layout.multiple && context.index === props.modelValue.data.length - 1,
|
|
67
|
-
item: context.item.raw
|
|
68
|
-
})
|
|
69
|
-
}
|
|
70
|
-
return slots
|
|
71
|
-
})
|
|
72
|
-
|
|
73
34
|
// @ts-ignore
|
|
74
|
-
return () => h(VSelect, fieldProps.value,
|
|
35
|
+
return () => h(VSelect, fieldProps.value, selectSlots.value)
|
|
75
36
|
}
|
|
76
37
|
})
|
|
77
38
|
|
|
@@ -1,34 +1,37 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import { VSlider } from 'vuetify/components'
|
|
3
|
-
import { computed } from 'vue'
|
|
4
|
-
import
|
|
1
|
+
<script>
|
|
2
|
+
import { VSlider } from 'vuetify/components/VSlider'
|
|
3
|
+
import { defineComponent, computed, toRef, h } from 'vue'
|
|
4
|
+
import useNode from '../../composables/use-node.js'
|
|
5
|
+
import { useDefaults } from 'vuetify'
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
export default defineComponent({
|
|
8
|
+
props: {
|
|
9
|
+
modelValue: {
|
|
10
|
+
/** @type import('vue').PropType<import('../../types.js').VjsfSliderNode> */
|
|
11
|
+
type: Object,
|
|
12
|
+
required: true
|
|
13
|
+
},
|
|
14
|
+
statefulLayout: {
|
|
15
|
+
/** @type import('vue').PropType<import('../../types.js').VjsfStatefulLayout> */
|
|
16
|
+
type: Object,
|
|
17
|
+
required: true
|
|
18
|
+
}
|
|
11
19
|
},
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
setup (props) {
|
|
21
|
+
useDefaults({}, 'VjsfSlider')
|
|
22
|
+
|
|
23
|
+
const { inputProps, localData, compSlots } = useNode(
|
|
24
|
+
toRef(props, 'modelValue'), props.statefulLayout, { layoutPropsMap: ['step', 'min', 'max'] }
|
|
25
|
+
)
|
|
18
26
|
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
const fullProps = computed(() => {
|
|
28
|
+
const fullProps = { ...inputProps.value }
|
|
29
|
+
fullProps.modelValue = localData.value
|
|
30
|
+
fullProps['onUpdate:modelValue'] = (/** @type string */value) => props.statefulLayout.input(props.modelValue, value && Number(value))
|
|
31
|
+
return fullProps
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
return () => h(VSlider, fullProps.value, compSlots.value)
|
|
35
|
+
}
|
|
25
36
|
})
|
|
26
37
|
</script>
|
|
27
|
-
|
|
28
|
-
<template>
|
|
29
|
-
<v-slider
|
|
30
|
-
type="number"
|
|
31
|
-
v-bind="fieldProps"
|
|
32
|
-
@update:model-value="value => statefulLayout.input(modelValue, value && Number(value))"
|
|
33
|
-
/>
|
|
34
|
-
</template>
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { ref, computed } from 'vue'
|
|
3
|
-
import { VStepper, VStepperHeader, VStepperItem, VStepperWindow, VStepperWindowItem, VStepperActions
|
|
3
|
+
import { VStepper, VStepperHeader, VStepperItem, VStepperWindow, VStepperWindowItem, VStepperActions } from 'vuetify/components/VStepper'
|
|
4
|
+
import { VContainer, VRow, VSpacer } from 'vuetify/components/VGrid'
|
|
5
|
+
import { VBtn } from 'vuetify/components/VBtn'
|
|
6
|
+
import { VDivider } from 'vuetify/components/VDivider'
|
|
4
7
|
import { isSection } from '@json-layout/core'
|
|
5
8
|
import Node from '../node.vue'
|
|
6
9
|
import SectionHeader from '../fragments/section-header.vue'
|
|
10
|
+
import ChildSubtitle from '../fragments/child-subtitle.vue'
|
|
11
|
+
import { useDefaults } from 'vuetify'
|
|
12
|
+
|
|
13
|
+
useDefaults({}, 'VjsfStepper')
|
|
7
14
|
|
|
8
15
|
const props = defineProps({
|
|
9
16
|
modelValue: {
|
|
@@ -59,7 +66,8 @@ const goNext = () => {
|
|
|
59
66
|
fluid
|
|
60
67
|
class="pa-0"
|
|
61
68
|
>
|
|
62
|
-
<
|
|
69
|
+
<child-subtitle :model-value="child" />
|
|
70
|
+
<v-row :dense="modelValue.options?.density === 'compact' || modelValue.options?.density === 'comfortable'">
|
|
63
71
|
<node
|
|
64
72
|
v-for="grandChild of isSection(child) ? child.children : [child]"
|
|
65
73
|
:key="grandChild.fullKey"
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { useDefaults } from 'vuetify'
|
|
3
|
+
import SelectionGroup from '../fragments/selection-group.vue'
|
|
4
|
+
import { defineComponent, h } from 'vue'
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
props: {
|
|
8
|
+
modelValue: {
|
|
9
|
+
/** @type import('vue').PropType<import('../../types.js').VjsfCheckboxGroupNode> */
|
|
10
|
+
type: Object,
|
|
11
|
+
required: true
|
|
12
|
+
},
|
|
13
|
+
statefulLayout: {
|
|
14
|
+
/** @type import('vue').PropType<import('../../types.js').VjsfStatefulLayout> */
|
|
15
|
+
type: Object,
|
|
16
|
+
required: true
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
setup (props) {
|
|
20
|
+
useDefaults({}, 'VjsfSwitchGroup')
|
|
21
|
+
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
return () => {
|
|
24
|
+
return h(SelectionGroup, {
|
|
25
|
+
modelValue: props.modelValue,
|
|
26
|
+
statefulLayout: props.statefulLayout,
|
|
27
|
+
type: 'switch'
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<style>
|
|
36
|
+
.vjsf-node-checkbox-group .v-selection-control-group .v-checkbox .v-selection-control {
|
|
37
|
+
min-height: auto;
|
|
38
|
+
}
|
|
39
|
+
</style>
|
|
@@ -1,32 +1,37 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
<script>
|
|
2
|
+
import { defineComponent, h, computed, toRef } from 'vue'
|
|
3
|
+
import { VSwitch } from 'vuetify/components/VSwitch'
|
|
4
|
+
import useNode from '../../composables/use-node.js'
|
|
5
|
+
import { useDefaults } from 'vuetify'
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
export default defineComponent({
|
|
8
|
+
props: {
|
|
9
|
+
modelValue: {
|
|
10
|
+
/** @type import('vue').PropType<import('../../types.js').VjsfSwitchNode> */
|
|
11
|
+
type: Object,
|
|
12
|
+
required: true
|
|
13
|
+
},
|
|
14
|
+
statefulLayout: {
|
|
15
|
+
/** @type import('vue').PropType<import('../../types.js').VjsfStatefulLayout> */
|
|
16
|
+
type: Object,
|
|
17
|
+
required: true
|
|
18
|
+
}
|
|
11
19
|
},
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
20
|
+
setup (props) {
|
|
21
|
+
useDefaults({}, 'VjsfSwitch')
|
|
22
|
+
|
|
23
|
+
const { inputProps, localData, compSlots } = useNode(toRef(props, 'modelValue'), props.statefulLayout)
|
|
24
|
+
|
|
25
|
+
const fullProps = computed(() => {
|
|
26
|
+
const fullProps = { ...inputProps.value }
|
|
27
|
+
// it is not very common to show an error below checkboxes and switches and without hide-details=auto they take a lot of space
|
|
28
|
+
if (!('hideDetails' in inputProps)) fullProps.hideDetails = 'auto'
|
|
29
|
+
fullProps.modelValue = localData.value
|
|
30
|
+
return fullProps
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
return () => h(VSwitch, fullProps.value, compSlots.value)
|
|
16
34
|
}
|
|
17
35
|
})
|
|
18
36
|
|
|
19
|
-
const fieldProps = computed(() => {
|
|
20
|
-
const inputProps = getInputProps(props.modelValue, props.statefulLayout)
|
|
21
|
-
// it is not very common to show an error below checkboxes and switches and without hide-details=auto they take a lot of space
|
|
22
|
-
if (!('hideDetails' in inputProps)) inputProps.hideDetails = 'auto'
|
|
23
|
-
return inputProps
|
|
24
|
-
})
|
|
25
37
|
</script>
|
|
26
|
-
|
|
27
|
-
<template>
|
|
28
|
-
<v-switch
|
|
29
|
-
v-bind="fieldProps"
|
|
30
|
-
@update:model-value="value => statefulLayout.input(modelValue, value)"
|
|
31
|
-
/>
|
|
32
|
-
</template>
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { VTabs, VTab
|
|
2
|
+
import { VTabs, VTab } from 'vuetify/components/VTabs'
|
|
3
|
+
import { VContainer, VRow } from 'vuetify/components/VGrid'
|
|
4
|
+
import { VIcon } from 'vuetify/components/VIcon'
|
|
5
|
+
import { VSheet } from 'vuetify/components/VSheet'
|
|
6
|
+
import { VWindow, VWindowItem } from 'vuetify/components/VWindow'
|
|
7
|
+
import { useDefaults } from 'vuetify'
|
|
3
8
|
import { ref } from 'vue'
|
|
4
9
|
import { isSection } from '@json-layout/core'
|
|
5
10
|
import Node from '../node.vue'
|
|
6
11
|
import SectionHeader from '../fragments/section-header.vue'
|
|
12
|
+
import ChildSubtitle from '../fragments/child-subtitle.vue'
|
|
13
|
+
import useCompDefaults from '../../composables/use-comp-defaults.js'
|
|
14
|
+
|
|
15
|
+
useDefaults({}, 'VjsfTabs')
|
|
16
|
+
const vSheetProps = useCompDefaults('VjsfTabs-VSheet', { border: true })
|
|
7
17
|
|
|
8
18
|
defineProps({
|
|
9
19
|
modelValue: {
|
|
@@ -23,21 +33,22 @@ const tab = ref(0)
|
|
|
23
33
|
|
|
24
34
|
<template>
|
|
25
35
|
<section-header :node="modelValue" />
|
|
26
|
-
<v-sheet
|
|
27
|
-
<v-tabs
|
|
36
|
+
<v-sheet v-bind="vSheetProps">
|
|
37
|
+
<v-tabs
|
|
38
|
+
v-model="tab"
|
|
39
|
+
direction="horizontal"
|
|
40
|
+
>
|
|
28
41
|
<v-tab
|
|
29
42
|
v-for="(child, i) of modelValue.children"
|
|
30
43
|
:key="child.key"
|
|
31
44
|
:value="i"
|
|
32
|
-
:density="modelValue.options.density"
|
|
33
45
|
:color="child.validated && (child.error || child.childError) ? 'error' : undefined"
|
|
34
46
|
>
|
|
35
47
|
<v-icon
|
|
36
48
|
v-if="child.validated && (child.error || child.childError)"
|
|
37
49
|
color="error"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
</v-icon>
|
|
50
|
+
:icon="statefulLayout.options.icons.alert"
|
|
51
|
+
/>
|
|
41
52
|
{{ child.layout.title ?? child.layout.label }}
|
|
42
53
|
</v-tab>
|
|
43
54
|
</v-tabs>
|
|
@@ -48,7 +59,8 @@ const tab = ref(0)
|
|
|
48
59
|
:value="i"
|
|
49
60
|
>
|
|
50
61
|
<v-container fluid>
|
|
51
|
-
<
|
|
62
|
+
<child-subtitle :model-value="child" />
|
|
63
|
+
<v-row :dense="modelValue.options?.density === 'compact' || modelValue.options?.density === 'comfortable'">
|
|
52
64
|
<node
|
|
53
65
|
v-for="grandChild of isSection(child) ? child.children : [child]"
|
|
54
66
|
:key="grandChild.fullKey"
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { defineComponent, h,
|
|
3
|
-
import { VTextField } from 'vuetify/components'
|
|
4
|
-
import
|
|
2
|
+
import { defineComponent, h, toRef } from 'vue'
|
|
3
|
+
import { VTextField } from 'vuetify/components/VTextField'
|
|
4
|
+
import useNode from '../../composables/use-node.js'
|
|
5
|
+
import { useDefaults } from 'vuetify'
|
|
5
6
|
|
|
6
7
|
export default defineComponent({
|
|
7
8
|
props: {
|
|
@@ -17,11 +18,13 @@ export default defineComponent({
|
|
|
17
18
|
}
|
|
18
19
|
},
|
|
19
20
|
setup (props) {
|
|
20
|
-
|
|
21
|
-
const fieldSlots = computed(() => getCompSlots(props.modelValue, props.statefulLayout))
|
|
21
|
+
useDefaults({}, 'VjsfTextField')
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
const { inputProps, localData, compSlots } = useNode(
|
|
24
|
+
toRef(props, 'modelValue'), props.statefulLayout, { layoutPropsMap: ['placeholder'] }
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
return () => h(VTextField, { ...inputProps.value, modelValue: localData.value }, compSlots.value)
|
|
25
28
|
}
|
|
26
29
|
})
|
|
27
30
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { defineComponent, h, computed, ref, watch } from 'vue'
|
|
3
|
-
import { VTextarea } from 'vuetify/components'
|
|
4
|
-
import
|
|
2
|
+
import { defineComponent, h, computed, ref, watch, toRef } from 'vue'
|
|
3
|
+
import { VTextarea } from 'vuetify/components/VTextarea'
|
|
4
|
+
import useNode from '../../composables/use-node.js'
|
|
5
|
+
import { useDefaults } from 'vuetify'
|
|
5
6
|
|
|
6
7
|
export default defineComponent({
|
|
7
8
|
props: {
|
|
@@ -17,25 +18,32 @@ export default defineComponent({
|
|
|
17
18
|
}
|
|
18
19
|
},
|
|
19
20
|
setup (props) {
|
|
21
|
+
useDefaults({}, 'VjsfTextArea')
|
|
22
|
+
|
|
20
23
|
/** @type {import('vue').Ref<null | HTMLElement>} */
|
|
21
24
|
const textarea = ref(null)
|
|
22
25
|
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
const { inputProps, localData, compSlots, options } = useNode(
|
|
27
|
+
toRef(props, 'modelValue'), props.statefulLayout, { layoutPropsMap: ['placeholder'] }
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
const rows = computed(() => options.value.readOnly && options.value.summary ? 3 : undefined)
|
|
31
|
+
|
|
32
|
+
const fullProps = computed(() => {
|
|
33
|
+
const fullProps = { ...inputProps.value }
|
|
34
|
+
fullProps.ref = textarea
|
|
35
|
+
fullProps.rows = rows.value
|
|
36
|
+
fullProps.modelValue = localData.value
|
|
37
|
+
return fullProps
|
|
28
38
|
})
|
|
29
|
-
const fieldSlots = computed(() => getCompSlots(props.modelValue, props.statefulLayout))
|
|
30
39
|
|
|
31
|
-
watch(() =>
|
|
40
|
+
watch(() => options.value.readOnly, (readOnly) => {
|
|
32
41
|
if (readOnly && textarea.value) {
|
|
33
42
|
textarea.value.scrollTop = 0
|
|
34
43
|
}
|
|
35
44
|
})
|
|
36
45
|
|
|
37
|
-
|
|
38
|
-
return () => h(VTextarea, fieldProps.value, fieldSlots.value)
|
|
46
|
+
return () => h(VTextarea, fullProps.value, compSlots.value)
|
|
39
47
|
}
|
|
40
48
|
})
|
|
41
49
|
|