@koumoul/vjsf 3.20.7 → 3.21.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 +3 -3
- package/src/components/fragments/help-message.vue +5 -1
- package/src/components/fragments/select-item-header.vue +28 -0
- package/src/components/fragments/selection-group.vue +1 -1
- package/src/components/fragments/text-field-menu.vue +2 -2
- package/src/components/nodes/combobox.vue +2 -2
- package/src/components/nodes/list.vue +2 -1
- package/src/components/nodes/number-combobox.vue +2 -2
- package/src/components/nodes/one-of-select.vue +2 -2
- package/src/components/nodes/select.vue +3 -1
- package/src/composables/use-get-items.js +5 -2
- package/src/composables/use-select-node.js +18 -8
- package/src/composables/use-z-index-stack.js +9 -12
- package/src/styles/vjsf.css +2 -2
- package/types/components/fragments/select-item copy.vue.d.ts +14 -0
- package/types/components/fragments/select-item copy.vue.d.ts.map +1 -0
- package/types/components/fragments/select-item-header.vue.d.ts +10 -0
- package/types/components/fragments/select-item-header.vue.d.ts.map +1 -0
- package/types/composables/use-get-items.d.ts.map +1 -1
- package/types/composables/use-select-node.d.ts.map +1 -1
- package/types/composables/use-z-index-stack.d.ts +1 -1
- package/types/composables/use-z-index-stack.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koumoul/vjsf",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.21.0",
|
|
4
4
|
"description": "Generate forms for the vuetify UI library (vuejs) based on annotated JSON schemas.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test-tz1": "TZ=Europe/Paris vitest run",
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
"vuetify": "^3.8.12"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@json-layout/core": "~2.
|
|
76
|
-
"@json-layout/vocabulary": "~2.
|
|
75
|
+
"@json-layout/core": "~2.1.0",
|
|
76
|
+
"@json-layout/vocabulary": "~2.9.0",
|
|
77
77
|
"@vueuse/core": "^12.5.0",
|
|
78
78
|
"debug": "^4.3.4"
|
|
79
79
|
},
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
:class="`vjsf-help-message-tooltip vjsf-help-message-tooltip-${node.options.density}`"
|
|
6
6
|
location="top end"
|
|
7
7
|
offset="4"
|
|
8
|
+
:z-index="zIndex"
|
|
8
9
|
:close-on-content-click="false"
|
|
9
10
|
>
|
|
10
11
|
<template #activator="{ props }">
|
|
@@ -42,8 +43,9 @@ import { VAlert } from 'vuetify/components/VAlert'
|
|
|
42
43
|
import { VMenu } from 'vuetify/components/VMenu'
|
|
43
44
|
import { VBtn } from 'vuetify/components/VBtn'
|
|
44
45
|
import { ref } from 'vue'
|
|
46
|
+
import useZIndexStack from '../../composables/use-z-index-stack.js'
|
|
45
47
|
|
|
46
|
-
defineProps({
|
|
48
|
+
const props = defineProps({
|
|
47
49
|
node: {
|
|
48
50
|
/** @type import('vue').PropType<import('../../types.js').VjsfNode> */
|
|
49
51
|
type: Object,
|
|
@@ -51,6 +53,8 @@ defineProps({
|
|
|
51
53
|
}
|
|
52
54
|
})
|
|
53
55
|
|
|
56
|
+
const zIndex = useZIndexStack(props.node.fullKey)
|
|
57
|
+
|
|
54
58
|
const show = ref(false)
|
|
55
59
|
</script>
|
|
56
60
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
|
|
3
|
+
import { VListSubheader } from 'vuetify/components/VList'
|
|
4
|
+
import VSelectItemIcon from './select-item-icon.vue'
|
|
5
|
+
|
|
6
|
+
defineProps({
|
|
7
|
+
item: {
|
|
8
|
+
/** @type import('vue').PropType<import('@json-layout/vocabulary').SelectItemHeader> */
|
|
9
|
+
type: Object,
|
|
10
|
+
required: true
|
|
11
|
+
},
|
|
12
|
+
avatarProps: {
|
|
13
|
+
type: Object,
|
|
14
|
+
required: true
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<v-list-subheader>
|
|
21
|
+
<v-select-item-icon
|
|
22
|
+
v-if="typeof item.icon === 'string'"
|
|
23
|
+
:icon="item.icon"
|
|
24
|
+
:avatar-props="avatarProps"
|
|
25
|
+
/>
|
|
26
|
+
{{ item.title }}
|
|
27
|
+
</v-list-subheader>
|
|
28
|
+
</template>
|
|
@@ -56,7 +56,7 @@ export default defineComponent({
|
|
|
56
56
|
} else {
|
|
57
57
|
modelValue = localData.value === item.value
|
|
58
58
|
}
|
|
59
|
-
checkboxes.push(h(props.type === 'switch' ? VSwitch : VCheckbox, {
|
|
59
|
+
checkboxes.push(h(/** @type {import('vue').Component} */(props.type === 'switch' ? VSwitch : VCheckbox), {
|
|
60
60
|
label: item.title,
|
|
61
61
|
hideDetails: true,
|
|
62
62
|
key: item.key,
|
|
@@ -55,14 +55,14 @@ const fieldProps = computed(() => {
|
|
|
55
55
|
return fieldProps
|
|
56
56
|
})
|
|
57
57
|
|
|
58
|
-
const zIndex = useZIndexStack(
|
|
58
|
+
const zIndex = useZIndexStack(props.modelValue.fullKey)
|
|
59
59
|
|
|
60
60
|
const menuProps = computed(() => {
|
|
61
61
|
return {
|
|
62
62
|
...compProps.value,
|
|
63
63
|
minWidth: props.minWidth,
|
|
64
64
|
maxWidth: props.maxWidth,
|
|
65
|
-
zIndex
|
|
65
|
+
zIndex,
|
|
66
66
|
closeOnContentClick: false,
|
|
67
67
|
disabled: true
|
|
68
68
|
}
|
|
@@ -25,7 +25,7 @@ export default defineComponent({
|
|
|
25
25
|
const nodeRef = toRef(props, 'modelValue')
|
|
26
26
|
const getItems = useGetItems(nodeRef, props.statefulLayout)
|
|
27
27
|
const { inputProps, compSlots, localData, layout, options } = useNode(nodeRef, props.statefulLayout)
|
|
28
|
-
const zIndex = useZIndexStack(
|
|
28
|
+
const zIndex = useZIndexStack(props.modelValue.fullKey)
|
|
29
29
|
|
|
30
30
|
const fieldProps = computed(() => {
|
|
31
31
|
const fieldProps = { ...inputProps.value }
|
|
@@ -33,7 +33,7 @@ export default defineComponent({
|
|
|
33
33
|
if (options.value.readOnly) {
|
|
34
34
|
fieldProps.menuProps = { modelValue: false }
|
|
35
35
|
} else {
|
|
36
|
-
fieldProps.menuProps = { zIndex
|
|
36
|
+
fieldProps.menuProps = { zIndex }
|
|
37
37
|
}
|
|
38
38
|
if (getItems.hasItems.value) {
|
|
39
39
|
fieldProps.items = getItems.items.value
|
|
@@ -70,7 +70,7 @@ const prepareDrag = (/** @type {number} */index) => {
|
|
|
70
70
|
menuOpened.value = -1
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
const zIndex = useZIndexStack(
|
|
73
|
+
const zIndex = useZIndexStack(props.modelValue.fullKey)
|
|
74
74
|
|
|
75
75
|
/* manage hovered and edited items */
|
|
76
76
|
// const editedItem = computed(() => activatedItems.value[fullKey.value])
|
|
@@ -495,6 +495,7 @@ const itemBorderColor = computed(() => (/** @type {import('@json-layout/core').S
|
|
|
495
495
|
v-if="layout.listEditMode === 'dialog'"
|
|
496
496
|
:model-value="editedItem !== undefined"
|
|
497
497
|
v-bind="vEditDialogProps"
|
|
498
|
+
:z-index="zIndex"
|
|
498
499
|
>
|
|
499
500
|
<v-sheet v-bind="vEditDialogVSheetProps">
|
|
500
501
|
<v-toolbar
|
|
@@ -25,7 +25,7 @@ export default defineComponent({
|
|
|
25
25
|
const nodeRef = toRef(props, 'modelValue')
|
|
26
26
|
const getItems = useGetItems(nodeRef, props.statefulLayout)
|
|
27
27
|
const { inputProps, compSlots, localData, layout, options } = useNode(nodeRef, props.statefulLayout, { bindData: false, layoutPropsMap: ['step', 'min', 'max'] })
|
|
28
|
-
const zIndex = useZIndexStack(
|
|
28
|
+
const zIndex = useZIndexStack(props.modelValue.fullKey)
|
|
29
29
|
|
|
30
30
|
const fieldProps = computed(() => {
|
|
31
31
|
const fieldProps = { ...inputProps.value }
|
|
@@ -34,7 +34,7 @@ export default defineComponent({
|
|
|
34
34
|
if (options.value.readOnly) {
|
|
35
35
|
fieldProps.menuProps = { modelValue: false }
|
|
36
36
|
} else {
|
|
37
|
-
fieldProps.menuProps = { zIndex
|
|
37
|
+
fieldProps.menuProps = { zIndex }
|
|
38
38
|
}
|
|
39
39
|
if (getItems.hasItems.value) {
|
|
40
40
|
fieldProps.items = getItems.items.value
|
|
@@ -27,7 +27,7 @@ const props = defineProps({
|
|
|
27
27
|
const { inputProps, localData, skeleton, children } = useNode(
|
|
28
28
|
toRef(props, 'modelValue'), props.statefulLayout, { bindData: false }
|
|
29
29
|
)
|
|
30
|
-
const zIndex = useZIndexStack(
|
|
30
|
+
const zIndex = useZIndexStack(props.modelValue.fullKey)
|
|
31
31
|
|
|
32
32
|
/** @type import('vue').Ref<string | undefined> */
|
|
33
33
|
const activeChildTree = ref(undefined)
|
|
@@ -50,7 +50,7 @@ const fieldProps = computed(() => {
|
|
|
50
50
|
const fieldProps = { ...inputProps.value }
|
|
51
51
|
fieldProps['onUpdate:modelValue'] = onChange
|
|
52
52
|
if (!props.modelValue.options.readOnly) {
|
|
53
|
-
fieldProps.menuProps = { zIndex
|
|
53
|
+
fieldProps.menuProps = { zIndex }
|
|
54
54
|
}
|
|
55
55
|
const items = []
|
|
56
56
|
for (const childTreePointer of skeleton.value.childrenTrees || []) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { VSelect } from 'vuetify/components/VSelect'
|
|
3
|
-
import { defineComponent, h, computed, toRef } from 'vue'
|
|
3
|
+
import { defineComponent, h, computed, toRef, watch } from 'vue'
|
|
4
4
|
import { useDefaults } from 'vuetify'
|
|
5
5
|
import useSelectNode from '../../composables/use-select-node.js'
|
|
6
6
|
import useCompDefaults from '../../composables/use-comp-defaults.js'
|
|
@@ -32,6 +32,8 @@ export default defineComponent({
|
|
|
32
32
|
return fieldProps
|
|
33
33
|
})
|
|
34
34
|
|
|
35
|
+
watch(() => fieldProps.value.items, () => console.log(fieldProps.value.items))
|
|
36
|
+
|
|
35
37
|
// @ts-ignore
|
|
36
38
|
return () => h(VSelect, fieldProps.value, selectSlots.value)
|
|
37
39
|
}
|
|
@@ -18,8 +18,11 @@ export default function (nodeRef, statefulLayout) {
|
|
|
18
18
|
|
|
19
19
|
const fetchItems = async () => {
|
|
20
20
|
loading.value = true
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
try {
|
|
22
|
+
items.value = await statefulLayout.getItems(nodeRef.value, search.value)
|
|
23
|
+
} finally {
|
|
24
|
+
loading.value = false
|
|
25
|
+
}
|
|
23
26
|
}
|
|
24
27
|
|
|
25
28
|
watch(() => nodeRef.value.itemsCacheKey, (newValue, oldValue) => {
|
|
@@ -2,6 +2,7 @@ import { computed, h } from 'vue'
|
|
|
2
2
|
import useField from './use-node.js'
|
|
3
3
|
import useGetItems from './use-get-items.js'
|
|
4
4
|
import SelectItem from '../components/fragments/select-item.vue'
|
|
5
|
+
import SelectItemHeader from '../components/fragments/select-item-header.vue'
|
|
5
6
|
import SelectSelection from '../components/fragments/select-selection.vue'
|
|
6
7
|
import useZIndexStack from './use-z-index-stack.js'
|
|
7
8
|
|
|
@@ -17,7 +18,7 @@ export default function (nodeRef, statefulLayout, avatarProps, cssPrefix) {
|
|
|
17
18
|
|
|
18
19
|
const { inputProps, options, skeleton, localData, compSlots } = useField(nodeRef, statefulLayout, { layoutPropsMap: ['multiple', 'placeholder'], bindData: false })
|
|
19
20
|
const getItems = useGetItems(nodeRef, statefulLayout)
|
|
20
|
-
const zIndex = useZIndexStack(
|
|
21
|
+
const zIndex = useZIndexStack(nodeRef.value.fullKey)
|
|
21
22
|
|
|
22
23
|
const selectProps = computed(() => {
|
|
23
24
|
const props = { ...inputProps.value }
|
|
@@ -25,7 +26,7 @@ export default function (nodeRef, statefulLayout, avatarProps, cssPrefix) {
|
|
|
25
26
|
if (options.value.readOnly) {
|
|
26
27
|
props.menuProps = { modelValue: false }
|
|
27
28
|
} else {
|
|
28
|
-
props.menuProps = { zIndex
|
|
29
|
+
props.menuProps = { zIndex }
|
|
29
30
|
}
|
|
30
31
|
props.clearable = props.clearable ?? !skeleton.value.required
|
|
31
32
|
props.valueComparator = (/** @type {any} */a, /** @type {any} */b) => {
|
|
@@ -55,12 +56,21 @@ export default function (nodeRef, statefulLayout, avatarProps, cssPrefix) {
|
|
|
55
56
|
const selectSlots = computed(() => {
|
|
56
57
|
const slots = { ...compSlots.value }
|
|
57
58
|
if (!slots.item) {
|
|
58
|
-
slots.item = (/** @type {any} */ context) =>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
slots.item = (/** @type {any} */ context) => {
|
|
60
|
+
if (context.item.raw.header) {
|
|
61
|
+
return h(SelectItemHeader, {
|
|
62
|
+
item: context.item.raw,
|
|
63
|
+
avatarProps
|
|
64
|
+
})
|
|
65
|
+
} else {
|
|
66
|
+
return h(SelectItem, {
|
|
67
|
+
multiple: layout.value.multiple,
|
|
68
|
+
itemProps: context.props,
|
|
69
|
+
item: context.item.raw,
|
|
70
|
+
avatarProps
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
}
|
|
64
74
|
}
|
|
65
75
|
if (!slots.selection) {
|
|
66
76
|
slots.selection = (/** @type {any} */ context) => h(SelectSelection, {
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
// vuetify zIndex stacking is buggy (for example https://github.com/vuetifyjs/vuetify/issues/16251)
|
|
2
2
|
// we try to work around this in this composable
|
|
3
3
|
|
|
4
|
-
import { provide, inject
|
|
4
|
+
import { provide, inject } from 'vue'
|
|
5
5
|
|
|
6
6
|
const symbol = Symbol.for('vjsf:z-index-stack')
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* @param {
|
|
9
|
+
* @param {string} fullKey
|
|
10
10
|
*/
|
|
11
|
-
export default (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
return newZIndex
|
|
20
|
-
})
|
|
11
|
+
export default (fullKey) => {
|
|
12
|
+
const currentZIndex = inject(symbol, { zIndex: 3000, fullKey, initial: true })
|
|
13
|
+
const newZIndex = currentZIndex.zIndex + 10
|
|
14
|
+
if (currentZIndex.initial || fullKey.length > currentZIndex.fullKey.length) {
|
|
15
|
+
provide(symbol, { zIndex: newZIndex, fullKey })
|
|
16
|
+
}
|
|
17
|
+
return newZIndex
|
|
21
18
|
}
|
package/src/styles/vjsf.css
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {
|
|
2
|
+
multiple: boolean;
|
|
3
|
+
itemProps: Record<string, any>;
|
|
4
|
+
item: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem;
|
|
5
|
+
avatarProps: Record<string, any>;
|
|
6
|
+
$props: {
|
|
7
|
+
readonly multiple?: boolean | undefined;
|
|
8
|
+
readonly itemProps?: Record<string, any> | undefined;
|
|
9
|
+
readonly item?: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem | undefined;
|
|
10
|
+
readonly avatarProps?: Record<string, any> | undefined;
|
|
11
|
+
};
|
|
12
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
13
|
+
export default _default;
|
|
14
|
+
//# sourceMappingURL=select-item%20copy.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-item copy.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fragments/select-item copy.vue.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {
|
|
2
|
+
item: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItemHeader;
|
|
3
|
+
avatarProps: Record<string, any>;
|
|
4
|
+
$props: {
|
|
5
|
+
readonly item?: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItemHeader | undefined;
|
|
6
|
+
readonly avatarProps?: Record<string, any> | undefined;
|
|
7
|
+
};
|
|
8
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
9
|
+
export default _default;
|
|
10
|
+
//# sourceMappingURL=select-item-header.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-item-header.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fragments/select-item-header.vue.js"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-get-items.d.ts","sourceRoot":"","sources":["../../src/composables/use-get-items.js"],"names":[],"mappings":"AAEA;;;GAGG;AACH,0CAHW,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,aAAa,EAAE,QAAQ,CAAC,kBACjD,OAAO,aAAa,EAAE,kBAAkB;;;;;
|
|
1
|
+
{"version":3,"file":"use-get-items.d.ts","sourceRoot":"","sources":["../../src/composables/use-get-items.js"],"names":[],"mappings":"AAEA;;;GAGG;AACH,0CAHW,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,aAAa,EAAE,QAAQ,CAAC,kBACjD,OAAO,aAAa,EAAE,kBAAkB;;;;;wCAiCtC,GAAG,aACH,GAAG;EAiBf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-select-node.d.ts","sourceRoot":"","sources":["../../src/composables/use-select-node.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-select-node.d.ts","sourceRoot":"","sources":["../../src/composables/use-select-node.js"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,0CALW,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,aAAa,EAAE,cAAc,CAAC,kBACvD,OAAO,aAAa,EAAE,kBAAkB,eACxC,GAAG,aACH,gBAAgB,GAAG,UAAU;;;;;;;;;;;;;;;;;;;;EA0EvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-z-index-stack.d.ts","sourceRoot":"","sources":["../../src/composables/use-z-index-stack.js"],"names":[],"mappings":"AAUe,
|
|
1
|
+
{"version":3,"file":"use-z-index-stack.d.ts","sourceRoot":"","sources":["../../src/composables/use-z-index-stack.js"],"names":[],"mappings":"AAUe,mCAFJ,MAAM,UAShB"}
|