@koumoul/vjsf 3.0.0-beta.36 → 3.0.0-beta.38
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/text-field-menu.vue +1 -1
- package/src/components/nodes/autocomplete.vue +4 -26
- package/src/components/nodes/date-picker.vue +15 -8
- package/src/components/nodes/date-time-picker.vue +79 -5
- package/src/components/nodes/select.vue +4 -26
- package/src/components/nodes/time-picker.vue +38 -1
- package/src/components/vjsf.vue +2 -0
- package/src/composables/use-get-items.js +1 -1
- package/src/utils/props.js +31 -0
- package/src/utils/slots.js +28 -0
- package/types/components/fragments/text-field-menu.vue.d.ts.map +1 -1
- package/types/components/nodes/autocomplete.vue.d.ts.map +1 -1
- package/types/components/nodes/date-time-picker.vue.d.ts +2 -2
- package/types/components/nodes/select.vue.d.ts.map +1 -1
- package/types/components/nodes/time-picker.vue.d.ts +8 -1
- package/types/components/vjsf.vue.d.ts +4 -4
- 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/types/components/nodes/checkbox-group copy.vue.d.ts +0 -27
- package/types/components/nodes/checkbox-group copy.vue.d.ts.map +0 -1
- package/types/components/nodes/radio.vue.d.ts +0 -10
- package/types/components/nodes/radio.vue.d.ts.map +0 -1
- package/types/utils/global-register.d.ts +0 -8
- package/types/utils/global-register.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koumoul/vjsf",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.38",
|
|
4
4
|
"description": "Generate forms for the vuetify UI library (vuejs) based on annotated JSON schemas.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "vitest",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"vuetify": "^3.6.13"
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
|
-
"@json-layout/core": "0.
|
|
79
|
+
"@json-layout/core": "0.30.0",
|
|
80
80
|
"@vueuse/core": "^10.5.0",
|
|
81
81
|
"debug": "^4.3.4",
|
|
82
82
|
"ejs": "^3.1.9"
|
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
import { VAutocomplete } from 'vuetify/components/VAutocomplete'
|
|
3
3
|
import { useDefaults } from 'vuetify'
|
|
4
4
|
import { defineComponent, computed, h } from 'vue'
|
|
5
|
-
import {
|
|
5
|
+
import { getSelectProps, getSelectSlots } from '../../utils/index.js'
|
|
6
6
|
import useGetItems from '../../composables/use-get-items.js'
|
|
7
|
-
import SelectItem from '../fragments/select-item.vue'
|
|
8
|
-
import SelectSelection from '../fragments/select-selection.vue'
|
|
9
7
|
|
|
10
8
|
export default defineComponent({
|
|
11
9
|
props: {
|
|
@@ -22,42 +20,22 @@ export default defineComponent({
|
|
|
22
20
|
},
|
|
23
21
|
setup (props) {
|
|
24
22
|
useDefaults({}, 'VjsfAutocomplete')
|
|
23
|
+
|
|
25
24
|
const getItems = useGetItems(props)
|
|
26
25
|
|
|
27
26
|
const fieldProps = computed(() => {
|
|
28
|
-
const fieldProps =
|
|
29
|
-
if (props.modelValue.options.readOnly) fieldProps.menuProps = { modelValue: false }
|
|
27
|
+
const fieldProps = getSelectProps(props.modelValue, props.statefulLayout)
|
|
30
28
|
fieldProps.noFilter = true
|
|
31
29
|
fieldProps['onUpdate:search'] = (/** @type string */searchValue) => {
|
|
32
30
|
getItems.search.value = searchValue
|
|
33
31
|
}
|
|
34
32
|
fieldProps.items = getItems.items.value
|
|
35
33
|
fieldProps.loading = getItems.loading.value
|
|
36
|
-
fieldProps.clearable = fieldProps.clearable ?? !props.modelValue.skeleton.required
|
|
37
34
|
return fieldProps
|
|
38
35
|
})
|
|
39
36
|
|
|
40
|
-
const fieldSlots = computed(() => {
|
|
41
|
-
const slots = getCompSlots(props.modelValue, props.statefulLayout)
|
|
42
|
-
if (!slots.item) {
|
|
43
|
-
slots.item = (/** @type {any} */ context) => h(SelectItem, {
|
|
44
|
-
multiple: props.modelValue.layout.multiple,
|
|
45
|
-
itemProps: context.props,
|
|
46
|
-
item: context.item.raw
|
|
47
|
-
})
|
|
48
|
-
}
|
|
49
|
-
if (!slots.selection) {
|
|
50
|
-
slots.selection = (/** @type {any} */ context) => h(SelectSelection, {
|
|
51
|
-
multiple: props.modelValue.layout.multiple,
|
|
52
|
-
last: props.modelValue.layout.multiple && context.index === props.modelValue.data.length - 1,
|
|
53
|
-
item: getItems.prepareSelectedItem(context.item.raw, context.item.value)
|
|
54
|
-
})
|
|
55
|
-
}
|
|
56
|
-
return slots
|
|
57
|
-
})
|
|
58
|
-
|
|
59
37
|
// @ts-ignore
|
|
60
|
-
return () => h(VAutocomplete, fieldProps.value,
|
|
38
|
+
return () => h(VAutocomplete, fieldProps.value, getSelectSlots(props.modelValue, props.statefulLayout, getItems))
|
|
61
39
|
}
|
|
62
40
|
})
|
|
63
41
|
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import TextFieldMenu from '../fragments/text-field-menu.vue'
|
|
3
3
|
import { VDatePicker } from 'vuetify/components/VDatePicker'
|
|
4
4
|
import { useDate, useDefaults } from 'vuetify'
|
|
5
|
-
import { computed } from 'vue'
|
|
6
|
-
import { getCompProps, getDateTimeParts } from '../../utils/index.js'
|
|
5
|
+
import { computed, ref } from 'vue'
|
|
6
|
+
import { getCompProps, getDateTimeParts, getDateTimeWithOffset } from '../../utils/index.js'
|
|
7
7
|
|
|
8
8
|
useDefaults({}, 'VjsfDatePicker')
|
|
9
9
|
|
|
@@ -22,25 +22,32 @@ const props = defineProps({
|
|
|
22
22
|
|
|
23
23
|
const vDate = useDate()
|
|
24
24
|
|
|
25
|
+
const menuOpened = ref(false)
|
|
26
|
+
|
|
25
27
|
const datePickerProps = computed(() => {
|
|
26
28
|
const datePickerProps = getCompProps(props.modelValue, true)
|
|
27
29
|
datePickerProps.hideActions = true
|
|
28
30
|
if (props.modelValue.data) datePickerProps.modelValue = new Date(props.modelValue.data)
|
|
31
|
+
datePickerProps['onUpdate:modelValue'] = (/** @type {Date} */value) => {
|
|
32
|
+
if (!value) return
|
|
33
|
+
if (props.modelValue.layout.format === 'date-time') {
|
|
34
|
+
props.statefulLayout.input(props.modelValue, getDateTimeWithOffset(value))
|
|
35
|
+
} else {
|
|
36
|
+
props.statefulLayout.input(props.modelValue, getDateTimeParts(/** @type Date */(/** @type unknown */(value)))[0])
|
|
37
|
+
}
|
|
38
|
+
menuOpened.value = false
|
|
39
|
+
}
|
|
29
40
|
return datePickerProps
|
|
30
41
|
})
|
|
31
42
|
</script>
|
|
32
43
|
|
|
33
44
|
<template>
|
|
34
45
|
<text-field-menu
|
|
46
|
+
v-model:menu-opened="menuOpened"
|
|
35
47
|
:model-value="modelValue"
|
|
36
48
|
:stateful-layout="statefulLayout"
|
|
37
49
|
:formatted-value="modelValue.data && vDate.format(modelValue.data, 'fullDateWithWeekday')"
|
|
38
50
|
>
|
|
39
|
-
<
|
|
40
|
-
<v-date-picker
|
|
41
|
-
v-bind="datePickerProps"
|
|
42
|
-
@update:model-value="value => {statefulLayout.input(modelValue, value && getDateTimeParts(/** @type Date */(/** @type unknown */(value)))[0]); close()}"
|
|
43
|
-
/>
|
|
44
|
-
</template>
|
|
51
|
+
<v-date-picker v-bind="datePickerProps" />
|
|
45
52
|
</text-field-menu>
|
|
46
53
|
</template>
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import
|
|
2
|
+
import TextFieldMenu from '../fragments/text-field-menu.vue'
|
|
3
|
+
import { VDatePicker } from 'vuetify/components/VDatePicker'
|
|
4
|
+
import { VTimePicker } from 'vuetify/labs/VTimePicker'
|
|
5
|
+
import { VTabs, VTab, VTabsWindow, VTabsWindowItem } from 'vuetify/components/VTabs'
|
|
6
|
+
import { VIcon } from 'vuetify/components/VIcon'
|
|
7
|
+
import { VSheet } from 'vuetify/components/VSheet'
|
|
8
|
+
import { useDate, useDefaults } from 'vuetify'
|
|
9
|
+
import { computed, ref, watch } from 'vue'
|
|
10
|
+
import { getCompProps, getDateTimeParts, getLongTime, getDateTimeWithOffset, getShortTime } from '../../utils/index.js'
|
|
3
11
|
|
|
4
|
-
useDefaults({}, '
|
|
12
|
+
useDefaults({}, 'VjsfDatePicker')
|
|
5
13
|
|
|
6
|
-
defineProps({
|
|
14
|
+
const props = defineProps({
|
|
7
15
|
modelValue: {
|
|
8
|
-
/** @type import('vue').PropType<import('../../types.js').
|
|
16
|
+
/** @type import('vue').PropType<import('../../types.js').VjsfDatePickerNode> */
|
|
9
17
|
type: Object,
|
|
10
18
|
required: true
|
|
11
19
|
},
|
|
@@ -16,8 +24,74 @@ defineProps({
|
|
|
16
24
|
}
|
|
17
25
|
})
|
|
18
26
|
|
|
27
|
+
const vDate = useDate()
|
|
28
|
+
|
|
29
|
+
const tab = ref('date')
|
|
30
|
+
const menuOpened = ref(false)
|
|
31
|
+
watch(menuOpened, () => { tab.value = 'date' })
|
|
32
|
+
|
|
33
|
+
const datePickerProps = computed(() => {
|
|
34
|
+
const datePickerProps = getCompProps(props.modelValue, false)
|
|
35
|
+
datePickerProps.hideActions = true
|
|
36
|
+
if (props.modelValue.data) datePickerProps.modelValue = new Date(props.modelValue.data)
|
|
37
|
+
datePickerProps['onUpdate:modelValue'] = (/** @type {Date} */value) => {
|
|
38
|
+
if (!value) return
|
|
39
|
+
|
|
40
|
+
if (props.modelValue.data) {
|
|
41
|
+
// replace date part of current value
|
|
42
|
+
const datePart = value && getDateTimeParts(/** @type Date */(/** @type unknown */(value)))[0]
|
|
43
|
+
props.statefulLayout.input(props.modelValue, datePart + props.modelValue.data.slice(10))
|
|
44
|
+
} else {
|
|
45
|
+
props.statefulLayout.input(props.modelValue, getDateTimeWithOffset(value))
|
|
46
|
+
}
|
|
47
|
+
tab.value = 'time'
|
|
48
|
+
}
|
|
49
|
+
return datePickerProps
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
const timePickerProps = computed(() => {
|
|
53
|
+
const timePickerProps = getCompProps(props.modelValue, false)
|
|
54
|
+
timePickerProps['ampm-in-title'] = true
|
|
55
|
+
if (props.modelValue.data) timePickerProps.modelValue = getShortTime(props.modelValue.data.slice(11))
|
|
56
|
+
timePickerProps['onUpdate:modelValue'] = (/** @type {string} */value) => {
|
|
57
|
+
if (!props.modelValue.data) return
|
|
58
|
+
console.log('set time', value, props.modelValue.data.slice(0, 10), props.modelValue.data.slice(15))
|
|
59
|
+
props.statefulLayout.input(props.modelValue, props.modelValue.data.slice(0, 11) + value + props.modelValue.data.slice(16))
|
|
60
|
+
}
|
|
61
|
+
return timePickerProps
|
|
62
|
+
})
|
|
19
63
|
</script>
|
|
20
64
|
|
|
21
65
|
<template>
|
|
22
|
-
|
|
66
|
+
<text-field-menu
|
|
67
|
+
v-model:menu-opened="menuOpened"
|
|
68
|
+
:model-value="modelValue"
|
|
69
|
+
:stateful-layout="statefulLayout"
|
|
70
|
+
:formatted-value="modelValue.data && vDate.format(modelValue.data, 'fullDateTime')"
|
|
71
|
+
>
|
|
72
|
+
<v-sheet style="width: 328px">
|
|
73
|
+
<v-tabs
|
|
74
|
+
v-model="tab"
|
|
75
|
+
align-tabs="center"
|
|
76
|
+
>
|
|
77
|
+
<v-tab value="date">
|
|
78
|
+
<v-icon>mdi-calendar</v-icon>
|
|
79
|
+
</v-tab>
|
|
80
|
+
<v-tab
|
|
81
|
+
value="time"
|
|
82
|
+
:disabled="!modelValue.data"
|
|
83
|
+
>
|
|
84
|
+
<v-icon>mdi-clock</v-icon>
|
|
85
|
+
</v-tab>
|
|
86
|
+
</v-tabs>
|
|
87
|
+
<v-tabs-window v-model="tab">
|
|
88
|
+
<v-tabs-window-item value="date">
|
|
89
|
+
<v-date-picker v-bind="datePickerProps" />
|
|
90
|
+
</v-tabs-window-item>
|
|
91
|
+
<v-tabs-window-item value="time">
|
|
92
|
+
<v-time-picker v-bind="timePickerProps" />
|
|
93
|
+
</v-tabs-window-item>
|
|
94
|
+
</v-tabs-window>
|
|
95
|
+
</v-sheet>
|
|
96
|
+
</text-field-menu>
|
|
23
97
|
</template>
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { VSelect } from 'vuetify/components/VSelect'
|
|
3
3
|
import { defineComponent, h, computed } from 'vue'
|
|
4
|
-
import {
|
|
4
|
+
import { getSelectProps, getSelectSlots } from '../../utils/index.js'
|
|
5
5
|
import useGetItems from '../../composables/use-get-items.js'
|
|
6
|
-
|
|
7
|
-
import SelectSelection from '../fragments/select-selection.vue'
|
|
6
|
+
|
|
8
7
|
import { useDefaults } from 'vuetify'
|
|
9
8
|
|
|
10
9
|
export default defineComponent({
|
|
@@ -26,35 +25,14 @@ export default defineComponent({
|
|
|
26
25
|
const getItems = useGetItems(props)
|
|
27
26
|
|
|
28
27
|
const fieldProps = computed(() => {
|
|
29
|
-
const fieldProps =
|
|
30
|
-
if (props.modelValue.options.readOnly) fieldProps.menuProps = { modelValue: false }
|
|
28
|
+
const fieldProps = getSelectProps(props.modelValue, props.statefulLayout)
|
|
31
29
|
fieldProps.loading = getItems.loading.value
|
|
32
30
|
fieldProps.items = getItems.items.value
|
|
33
|
-
fieldProps.clearable = fieldProps.clearable ?? !props.modelValue.skeleton.required
|
|
34
31
|
return fieldProps
|
|
35
32
|
})
|
|
36
33
|
|
|
37
|
-
const fieldSlots = computed(() => {
|
|
38
|
-
const slots = getCompSlots(props.modelValue, props.statefulLayout)
|
|
39
|
-
if (!slots.item) {
|
|
40
|
-
slots.item = (/** @type {any} */ context) => h(SelectItem, {
|
|
41
|
-
multiple: props.modelValue.layout.multiple,
|
|
42
|
-
itemProps: context.props,
|
|
43
|
-
item: context.item.raw
|
|
44
|
-
})
|
|
45
|
-
}
|
|
46
|
-
if (!slots.selection) {
|
|
47
|
-
slots.selection = (/** @type {any} */ context) => h(SelectSelection, {
|
|
48
|
-
multiple: props.modelValue.layout.multiple,
|
|
49
|
-
last: props.modelValue.layout.multiple && context.index === props.modelValue.data.length - 1,
|
|
50
|
-
item: getItems.prepareSelectedItem(context.item.raw, context.item.value)
|
|
51
|
-
})
|
|
52
|
-
}
|
|
53
|
-
return slots
|
|
54
|
-
})
|
|
55
|
-
|
|
56
34
|
// @ts-ignore
|
|
57
|
-
return () => h(VSelect, fieldProps.value,
|
|
35
|
+
return () => h(VSelect, fieldProps.value, getSelectSlots(props.modelValue, props.statefulLayout, getItems))
|
|
58
36
|
}
|
|
59
37
|
})
|
|
60
38
|
|
|
@@ -1,7 +1,44 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
+
import TextFieldMenu from '../fragments/text-field-menu.vue'
|
|
3
|
+
import { VTimePicker } from 'vuetify/labs/VTimePicker'
|
|
4
|
+
import { useDate, useDefaults } from 'vuetify'
|
|
5
|
+
import { computed } from 'vue'
|
|
6
|
+
import { getCompProps, getShortTime, getLongTime } from '../../utils/index.js'
|
|
2
7
|
|
|
8
|
+
useDefaults({}, 'VjsfDatePicker')
|
|
9
|
+
|
|
10
|
+
const props = defineProps({
|
|
11
|
+
modelValue: {
|
|
12
|
+
/** @type import('vue').PropType<import('../../types.js').VjsfDatePickerNode> */
|
|
13
|
+
type: Object,
|
|
14
|
+
required: true
|
|
15
|
+
},
|
|
16
|
+
statefulLayout: {
|
|
17
|
+
/** @type import('vue').PropType<import('../../types.js').VjsfStatefulLayout> */
|
|
18
|
+
type: Object,
|
|
19
|
+
required: true
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
const vDate = useDate()
|
|
24
|
+
|
|
25
|
+
const timePickerProps = computed(() => {
|
|
26
|
+
const timePickerProps = getCompProps(props.modelValue, true)
|
|
27
|
+
timePickerProps['ampm-in-title'] = true
|
|
28
|
+
if (props.modelValue.data) timePickerProps.modelValue = getShortTime(props.modelValue.data)
|
|
29
|
+
return timePickerProps
|
|
30
|
+
})
|
|
3
31
|
</script>
|
|
4
32
|
|
|
5
33
|
<template>
|
|
6
|
-
|
|
34
|
+
<text-field-menu
|
|
35
|
+
:model-value="modelValue"
|
|
36
|
+
:stateful-layout="statefulLayout"
|
|
37
|
+
:formatted-value="timePickerProps.modelValue && vDate.format('2010-04-13T' + timePickerProps.modelValue, 'fullTime')"
|
|
38
|
+
>
|
|
39
|
+
<v-time-picker
|
|
40
|
+
v-bind="timePickerProps"
|
|
41
|
+
@update:model-value="value => {statefulLayout.input(modelValue, value && getLongTime(value))}"
|
|
42
|
+
/>
|
|
43
|
+
</text-field-menu>
|
|
7
44
|
</template>
|
package/src/components/vjsf.vue
CHANGED
|
@@ -14,6 +14,7 @@ import NodeSwitch from './nodes/switch.vue'
|
|
|
14
14
|
import NodeNumberField from './nodes/number-field.vue'
|
|
15
15
|
import NodeSlider from './nodes/slider.vue'
|
|
16
16
|
import NodeDatePicker from './nodes/date-picker.vue'
|
|
17
|
+
import NodeTimePicker from './nodes/time-picker.vue'
|
|
17
18
|
import NodeDateTimePicker from './nodes/date-time-picker.vue'
|
|
18
19
|
import NodeColorPicker from './nodes/color-picker.vue'
|
|
19
20
|
import NodeSelect from './nodes/select.vue'
|
|
@@ -42,6 +43,7 @@ const nodeComponents = {
|
|
|
42
43
|
'number-field': NodeNumberField,
|
|
43
44
|
slider: NodeSlider,
|
|
44
45
|
'date-picker': NodeDatePicker,
|
|
46
|
+
'time-picker': NodeTimePicker,
|
|
45
47
|
'date-time-picker': NodeDateTimePicker,
|
|
46
48
|
'color-picker': NodeColorPicker,
|
|
47
49
|
select: NodeSelect,
|
package/src/utils/props.js
CHANGED
|
@@ -100,3 +100,34 @@ export function getCompProps (node, isMainComp = true) {
|
|
|
100
100
|
const fullProps = mergePropsLevels(propsLevels)
|
|
101
101
|
return fullProps
|
|
102
102
|
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* shared between select and autocomplete components
|
|
106
|
+
* @param {import('../types.js').VjsfNode} node
|
|
107
|
+
* @param {import('../types.js').VjsfStatefulLayout} statefulLayout
|
|
108
|
+
* @returns {Record<string, any>}
|
|
109
|
+
*/
|
|
110
|
+
export function getSelectProps (node, statefulLayout) {
|
|
111
|
+
const fullProps = getInputProps(node, statefulLayout, ['multiple'], false)
|
|
112
|
+
if (node.options.readOnly) fullProps.menuProps = { modelValue: false }
|
|
113
|
+
fullProps.clearable = fullProps.clearable ?? !node.skeleton.required
|
|
114
|
+
fullProps.valueComparator = (/** @type {any} */a, /** @type {any} */b) => {
|
|
115
|
+
const aKey = typeof a === 'object' ? statefulLayout.prepareSelectItem(node, a).key : a
|
|
116
|
+
const bKey = typeof b === 'object' ? statefulLayout.prepareSelectItem(node, b).key : b
|
|
117
|
+
return aKey === bKey
|
|
118
|
+
}
|
|
119
|
+
fullProps['onUpdate:modelValue'] = (/** @type string */value) => {
|
|
120
|
+
// fix some weird case where vuetify only keep the title property of an unknown item
|
|
121
|
+
if (Array.isArray(value) && Array.isArray(node.data)) {
|
|
122
|
+
for (let i = 0; i < node.data.length; i++) {
|
|
123
|
+
if (typeof node.data[i] === 'object' && typeof value[i] === 'string') {
|
|
124
|
+
value[i] = node.data[i]
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return statefulLayout.input(node, (Array.isArray(value) && node.layout.separator) ? value.join(/** @type {string} */(node.layout.separator)) : value)
|
|
130
|
+
}
|
|
131
|
+
fullProps.onBlur = () => statefulLayout.blur(node)
|
|
132
|
+
return fullProps
|
|
133
|
+
}
|
package/src/utils/slots.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { h } from 'vue'
|
|
2
2
|
import NodeSlot from '../components/fragments/node-slot.vue'
|
|
3
|
+
import SelectItem from '../components/fragments/select-item.vue'
|
|
4
|
+
import SelectSelection from '../components/fragments/select-selection.vue'
|
|
3
5
|
|
|
4
6
|
// calculate the slots of components
|
|
5
7
|
/**
|
|
@@ -16,3 +18,29 @@ export function getCompSlots (node, statefulLayout) {
|
|
|
16
18
|
}
|
|
17
19
|
return slots
|
|
18
20
|
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* shared between select and autocomplete components
|
|
24
|
+
* @param {import('../types.js').VjsfSelectNode} node
|
|
25
|
+
* @param {import('../types.js').VjsfStatefulLayout} statefulLayout
|
|
26
|
+
* @param {any} getItems
|
|
27
|
+
* @returns {Record<string, any>}
|
|
28
|
+
*/
|
|
29
|
+
export function getSelectSlots (node, statefulLayout, getItems) {
|
|
30
|
+
const slots = getCompSlots(node, statefulLayout)
|
|
31
|
+
if (!slots.item) {
|
|
32
|
+
slots.item = (/** @type {any} */ context) => h(SelectItem, {
|
|
33
|
+
multiple: node.layout.multiple,
|
|
34
|
+
itemProps: context.props,
|
|
35
|
+
item: context.item.raw
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
if (!slots.selection) {
|
|
39
|
+
slots.selection = (/** @type {any} */ context) => h(SelectSelection, {
|
|
40
|
+
multiple: node.layout.multiple,
|
|
41
|
+
last: node.layout.multiple && context.index === node.data.length - 1,
|
|
42
|
+
item: getItems.prepareSelectedItem(context.item.raw, context.item.value)
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
return slots
|
|
46
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-field-menu.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fragments/text-field-menu.vue.js"],"names":[],"mappings":";;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"text-field-menu.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fragments/text-field-menu.vue.js"],"names":[],"mappings":";;;;;;;;;;6BA0IsC,GAAG;;;QACX,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete.vue.d.ts","sourceRoot":"","sources":["../../../src/components/nodes/autocomplete.vue.js"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"autocomplete.vue.d.ts","sourceRoot":"","sources":["../../../src/components/nodes/autocomplete.vue.js"],"names":[],"mappings":";;QAWI,4EAA4E;cAAlE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,cAAc,CAAC;;;;QAKvE,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC;;;;;;;QAL/E,4EAA4E;cAAlE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,cAAc,CAAC;;;;QAKvE,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<{}, {
|
|
2
|
-
modelValue: import("../../types.js").
|
|
2
|
+
modelValue: import("../../types.js").VjsfDatePickerNode;
|
|
3
3
|
statefulLayout: import("../../types.js").VjsfStatefulLayout;
|
|
4
4
|
$props: {
|
|
5
|
-
readonly modelValue?: import("../../types.js").
|
|
5
|
+
readonly modelValue?: import("../../types.js").VjsfDatePickerNode | undefined;
|
|
6
6
|
readonly statefulLayout?: import("../../types.js").VjsfStatefulLayout | undefined;
|
|
7
7
|
};
|
|
8
8
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.vue.d.ts","sourceRoot":"","sources":["../../../src/components/nodes/select.vue.js"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"select.vue.d.ts","sourceRoot":"","sources":["../../../src/components/nodes/select.vue.js"],"names":[],"mappings":";;QAYI,4EAA4E;cAAlE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,cAAc,CAAC;;;;QAKzE,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC;;;;;;;QAL7E,4EAA4E;cAAlE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,cAAc,CAAC;;;;QAKzE,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC"}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<{}, {
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {
|
|
2
|
+
modelValue: import("../../types.js").VjsfDatePickerNode;
|
|
3
|
+
statefulLayout: import("../../types.js").VjsfStatefulLayout;
|
|
4
|
+
$props: {
|
|
5
|
+
readonly modelValue?: import("../../types.js").VjsfDatePickerNode | undefined;
|
|
6
|
+
readonly statefulLayout?: import("../../types.js").VjsfStatefulLayout | undefined;
|
|
7
|
+
};
|
|
8
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
|
|
2
9
|
export default _default;
|
|
3
10
|
//# sourceMappingURL=time-picker.vue.d.ts.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<{}, {
|
|
2
2
|
$emit: ((event: "update:modelValue", data: any) => void) & ((event: "update:state", state: import("../types.js").VjsfStatefulLayout) => void);
|
|
3
|
-
schema: Record<string, any>;
|
|
4
|
-
options: Partial<Omit<import("../types.js").VjsfOptions, "width" | "onData" | "onUpdate" | "onAutofocus" | "vjsfSlots">> | null;
|
|
5
3
|
modelValue: any;
|
|
4
|
+
options: Partial<Omit<import("../types.js").VjsfOptions, "width" | "onData" | "onUpdate" | "onAutofocus" | "vjsfSlots">> | null;
|
|
5
|
+
schema: Record<string, any>;
|
|
6
6
|
precompiledLayout: import("../../../node_modules/@json-layout/core/types/compile/types.js").CompiledLayout;
|
|
7
7
|
$props: {
|
|
8
|
-
readonly schema?: Record<string, any> | undefined;
|
|
9
|
-
readonly options?: Partial<Omit<import("../types.js").VjsfOptions, "width" | "onData" | "onUpdate" | "onAutofocus" | "vjsfSlots">> | null | undefined;
|
|
10
8
|
readonly modelValue?: any;
|
|
9
|
+
readonly options?: Partial<Omit<import("../types.js").VjsfOptions, "width" | "onData" | "onUpdate" | "onAutofocus" | "vjsfSlots">> | null | undefined;
|
|
10
|
+
readonly schema?: Record<string, any> | undefined;
|
|
11
11
|
readonly precompiledLayout?: import("../../../node_modules/@json-layout/core/types/compile/types.js").CompiledLayout | undefined;
|
|
12
12
|
};
|
|
13
13
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
|
package/types/utils/props.d.ts
CHANGED
|
@@ -19,4 +19,11 @@ export function getInputProps(node: import('../types.js').VjsfNode, statefulLayo
|
|
|
19
19
|
* @returns {Record<string, any>}
|
|
20
20
|
*/
|
|
21
21
|
export function getCompProps(node: import('@json-layout/core').StateNode, isMainComp?: boolean): Record<string, any>;
|
|
22
|
+
/**
|
|
23
|
+
* shared between select and autocomplete components
|
|
24
|
+
* @param {import('../types.js').VjsfNode} node
|
|
25
|
+
* @param {import('../types.js').VjsfStatefulLayout} statefulLayout
|
|
26
|
+
* @returns {Record<string, any>}
|
|
27
|
+
*/
|
|
28
|
+
export function getSelectProps(node: import('../types.js').VjsfNode, statefulLayout: import('../types.js').VjsfStatefulLayout): Record<string, any>;
|
|
22
29
|
//# sourceMappingURL=props.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/utils/props.js"],"names":[],"mappings":"AAcA;;;GAGG;AACH,8CAHW,CAAC,OAAO,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC,EAAE,GACjC,OAAO,MAAM,EAAE,GAAG,CAAC,GAAG;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAC,CAqBnD;AAID;;;;;;GAMG;AACH,oCANW,OAAO,aAAa,EAAE,QAAQ,kBAC9B,OAAO,aAAa,EAAE,kBAAkB,iGAGtC,OAAO,MAAM,EAAE,GAAG,CAAC,CAwC/B;AAGD;;;;GAIG;AACH,mCAJW,OAAO,mBAAmB,EAAE,SAAS,eACrC,OAAO,GACL,OAAO,MAAM,EAAE,GAAG,CAAC,CAS/B"}
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/utils/props.js"],"names":[],"mappings":"AAcA;;;GAGG;AACH,8CAHW,CAAC,OAAO,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC,EAAE,GACjC,OAAO,MAAM,EAAE,GAAG,CAAC,GAAG;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAC,CAqBnD;AAID;;;;;;GAMG;AACH,oCANW,OAAO,aAAa,EAAE,QAAQ,kBAC9B,OAAO,aAAa,EAAE,kBAAkB,iGAGtC,OAAO,MAAM,EAAE,GAAG,CAAC,CAwC/B;AAGD;;;;GAIG;AACH,mCAJW,OAAO,mBAAmB,EAAE,SAAS,eACrC,OAAO,GACL,OAAO,MAAM,EAAE,GAAG,CAAC,CAS/B;AAED;;;;;GAKG;AACH,qCAJW,OAAO,aAAa,EAAE,QAAQ,kBAC9B,OAAO,aAAa,EAAE,kBAAkB,GACtC,OAAO,MAAM,EAAE,GAAG,CAAC,CAyB/B"}
|
package/types/utils/slots.d.ts
CHANGED
|
@@ -4,4 +4,12 @@
|
|
|
4
4
|
* @returns {Record<string, any>}
|
|
5
5
|
*/
|
|
6
6
|
export function getCompSlots(node: import('../types.js').VjsfNode, statefulLayout: import('../types.js').VjsfStatefulLayout): Record<string, any>;
|
|
7
|
+
/**
|
|
8
|
+
* shared between select and autocomplete components
|
|
9
|
+
* @param {import('../types.js').VjsfSelectNode} node
|
|
10
|
+
* @param {import('../types.js').VjsfStatefulLayout} statefulLayout
|
|
11
|
+
* @param {any} getItems
|
|
12
|
+
* @returns {Record<string, any>}
|
|
13
|
+
*/
|
|
14
|
+
export function getSelectSlots(node: import('../types.js').VjsfSelectNode, statefulLayout: import('../types.js').VjsfStatefulLayout, getItems: any): Record<string, any>;
|
|
7
15
|
//# sourceMappingURL=slots.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slots.d.ts","sourceRoot":"","sources":["../../src/utils/slots.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"slots.d.ts","sourceRoot":"","sources":["../../src/utils/slots.js"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,mCAJW,OAAO,aAAa,EAAE,QAAQ,kBAC9B,OAAO,aAAa,EAAE,kBAAkB,GACtC,OAAO,MAAM,EAAE,GAAG,CAAC,CAU/B;AAED;;;;;;GAMG;AACH,qCALW,OAAO,aAAa,EAAE,cAAc,kBACpC,OAAO,aAAa,EAAE,kBAAkB,YACxC,GAAG,GACD,OAAO,MAAM,EAAE,GAAG,CAAC,CAmB/B"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<{
|
|
2
|
-
modelValue: {
|
|
3
|
-
/** @type import('vue').PropType<import('../../types.js').VjsfCheckboxGroupNode> */
|
|
4
|
-
type: import('vue').PropType<import('../../types.js').VjsfCheckboxGroupNode>;
|
|
5
|
-
required: true;
|
|
6
|
-
};
|
|
7
|
-
statefulLayout: {
|
|
8
|
-
/** @type import('vue').PropType<import('../../types.js').VjsfStatefulLayout> */
|
|
9
|
-
type: import('vue').PropType<import('../../types.js').VjsfStatefulLayout>;
|
|
10
|
-
required: true;
|
|
11
|
-
};
|
|
12
|
-
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
13
|
-
[key: string]: any;
|
|
14
|
-
}>, any, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
15
|
-
modelValue: {
|
|
16
|
-
/** @type import('vue').PropType<import('../../types.js').VjsfCheckboxGroupNode> */
|
|
17
|
-
type: import('vue').PropType<import('../../types.js').VjsfCheckboxGroupNode>;
|
|
18
|
-
required: true;
|
|
19
|
-
};
|
|
20
|
-
statefulLayout: {
|
|
21
|
-
/** @type import('vue').PropType<import('../../types.js').VjsfStatefulLayout> */
|
|
22
|
-
type: import('vue').PropType<import('../../types.js').VjsfStatefulLayout>;
|
|
23
|
-
required: true;
|
|
24
|
-
};
|
|
25
|
-
}>>, {}, {}>;
|
|
26
|
-
export default _default;
|
|
27
|
-
//# sourceMappingURL=checkbox-group%20copy.vue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox-group copy.vue.d.ts","sourceRoot":"","sources":["../../../src/components/nodes/checkbox-group copy.vue.js"],"names":[],"mappings":";;QAQI,mFAAmF;cAAzE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,qBAAqB,CAAC;;;;QAKhF,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC;;;;;;;QAL7E,mFAAmF;cAAzE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,qBAAqB,CAAC;;;;QAKhF,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<{}, {
|
|
2
|
-
modelValue: import("../../types.js").VjsfSwitchNode;
|
|
3
|
-
statefulLayout: import("../../types.js").VjsfStatefulLayout;
|
|
4
|
-
$props: {
|
|
5
|
-
readonly modelValue?: import("../../types.js").VjsfSwitchNode | undefined;
|
|
6
|
-
readonly statefulLayout?: import("../../types.js").VjsfStatefulLayout | undefined;
|
|
7
|
-
};
|
|
8
|
-
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
|
|
9
|
-
export default _default;
|
|
10
|
-
//# sourceMappingURL=radio.vue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"radio.vue.d.ts","sourceRoot":"","sources":["../../../src/components/nodes/radio.vue.js"],"names":[],"mappings":""}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param {string} name
|
|
3
|
-
* @param {import('vue').Component} component
|
|
4
|
-
*/
|
|
5
|
-
export function registerNodeComponent(name: string, component: import('vue').Component): void;
|
|
6
|
-
/** @type {import('vue').Ref<Record<string, import('vue').Component>>} */
|
|
7
|
-
export const registeredNodeComponents: import('vue').Ref<Record<string, import('vue').Component>>;
|
|
8
|
-
//# sourceMappingURL=global-register.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"global-register.d.ts","sourceRoot":"","sources":["../../src/utils/global-register.js"],"names":[],"mappings":"AAKA;;;GAGG;AACH,4CAHW,MAAM,aACN,OAAO,KAAK,EAAE,SAAS,QAKjC;AAVD,yEAAyE;AACzE,uCADW,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,MAAM,EAAE,OAAO,KAAK,EAAE,SAAS,CAAC,CAAC,CACtB"}
|