@koumoul/vjsf 3.20.2 → 3.20.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koumoul/vjsf",
3
- "version": "3.20.2",
3
+ "version": "3.20.3",
4
4
  "description": "Generate forms for the vuetify UI library (vuejs) based on annotated JSON schemas.",
5
5
  "scripts": {
6
6
  "test": "vitest run",
@@ -20,13 +20,17 @@ defineProps({
20
20
  avatarProps: {
21
21
  type: Object,
22
22
  required: true
23
+ },
24
+ cssPrefix: {
25
+ type: String,
26
+ required: true
23
27
  }
24
28
  })
25
29
 
26
30
  </script>
27
31
 
28
32
  <template>
29
- <span class="v-select__selection-text">
33
+ <span :class="cssPrefix + '__selection-text'">
30
34
  <v-select-item-icon
31
35
  v-if="typeof item.icon === 'string'"
32
36
  :icon="item.icon"
@@ -35,7 +39,7 @@ defineProps({
35
39
  {{ item.title ?? item.key ?? item.value }}
36
40
  <span
37
41
  v-if="multiple && !last"
38
- class="v-select__selection-comma"
42
+ :class="cssPrefix + '__selection-comma'"
39
43
  >,</span>
40
44
  </span>
41
45
  </template>
@@ -3,6 +3,7 @@ import { VMenu } from 'vuetify/components/VMenu'
3
3
  import { VTextField } from 'vuetify/components/VTextField'
4
4
  import { computed, ref, toRef } from 'vue'
5
5
  import useField from '../../composables/use-node.js'
6
+ import useZIndexStack from '../../composables/use-z-index-stack.js'
6
7
 
7
8
  const props = defineProps({
8
9
  modelValue: {
@@ -54,12 +55,14 @@ const fieldProps = computed(() => {
54
55
  return fieldProps
55
56
  })
56
57
 
58
+ const zIndex = useZIndexStack(() => props.modelValue.fullKey)
59
+
57
60
  const menuProps = computed(() => {
58
61
  return {
59
62
  ...compProps.value,
60
63
  minWidth: props.minWidth,
61
64
  maxWidth: props.maxWidth,
62
- zIndex: 3000, // vuetify zIndex stacking is buggy (for example https://github.com/vuetifyjs/vuetify/issues/16251)
65
+ zIndex: zIndex.value,
63
66
  closeOnContentClick: false,
64
67
  disabled: true
65
68
  }
@@ -22,7 +22,7 @@ export default defineComponent({
22
22
  useDefaults({}, 'VjsfAutocomplete')
23
23
  const avatarProps = useCompDefaults('VjsfSelectItem-VAvatar', { rounded: false, size: 'small' })
24
24
 
25
- const { getItems, selectProps, selectSlots, localData } = useSelectNode(toRef(props, 'modelValue'), props.statefulLayout, avatarProps.value)
25
+ const { getItems, selectProps, selectSlots, localData } = useSelectNode(toRef(props, 'modelValue'), props.statefulLayout, avatarProps.value, 'v-autocomplete')
26
26
 
27
27
  const fieldProps = computed(() => {
28
28
  const fieldProps = { ...selectProps.value }
@@ -3,6 +3,7 @@ import { defineComponent, h, computed, toRef } from 'vue'
3
3
  import { VCombobox } from 'vuetify/components/VCombobox'
4
4
  import useNode from '../../composables/use-node.js'
5
5
  import useGetItems from '../../composables/use-get-items.js'
6
+ import useZIndexStack from '../../composables/use-z-index-stack.js'
6
7
  import { useDefaults } from 'vuetify'
7
8
 
8
9
  export default defineComponent({
@@ -24,6 +25,7 @@ export default defineComponent({
24
25
  const nodeRef = toRef(props, 'modelValue')
25
26
  const getItems = useGetItems(nodeRef, props.statefulLayout)
26
27
  const { inputProps, compSlots, localData, layout, options } = useNode(nodeRef, props.statefulLayout)
28
+ const zIndex = useZIndexStack(() => props.modelValue.fullKey)
27
29
 
28
30
  const fieldProps = computed(() => {
29
31
  const fieldProps = { ...inputProps.value }
@@ -31,8 +33,7 @@ export default defineComponent({
31
33
  if (options.value.readOnly) {
32
34
  fieldProps.menuProps = { modelValue: false }
33
35
  } else {
34
- // vuetify zIndex stacking is buggy (for example https://github.com/vuetifyjs/vuetify/issues/16251)
35
- fieldProps.menuProps = { zIndex: 3000 }
36
+ fieldProps.menuProps = { zIndex: zIndex.value }
36
37
  }
37
38
  if (getItems.hasItems.value) {
38
39
  fieldProps.items = getItems.items.value
@@ -20,6 +20,7 @@ import { moveDataItem } from '../../utils/arrays.js'
20
20
  import useDnd from '../../composables/use-dnd.js'
21
21
  import useCompDefaults from '../../composables/use-comp-defaults.js'
22
22
  import useClipboard from '../../composables/use-clipboard.js'
23
+ import useZIndexStack from '../../composables/use-z-index-stack.js'
23
24
 
24
25
  useDefaults({}, 'VjsfList')
25
26
  const vCardProps = useCompDefaults('VjsfList-VCard', { border: true, flat: true, tile: true })
@@ -68,6 +69,8 @@ const prepareDrag = (/** @type {number} */index) => {
68
69
  menuOpened.value = -1
69
70
  }
70
71
 
72
+ const zIndex = useZIndexStack(() => props.modelValue.fullKey)
73
+
71
74
  /* manage hovered and edited items */
72
75
  // const editedItem = computed(() => activatedItems.value[fullKey.value])
73
76
  const editedItem = computed(() => {
@@ -296,7 +299,7 @@ const itemBorderColor = computed(() => (/** @type {import('@json-layout/core').S
296
299
  >
297
300
  <v-menu
298
301
  location="bottom end"
299
- z-index="3000"
302
+ :z-index="zIndex"
300
303
  :density="modelValue.options.density"
301
304
  :close-on-content-click="false"
302
305
  :model-value="menuOpened === childIndex"
@@ -317,7 +320,7 @@ const itemBorderColor = computed(() => (/** @type {import('@json-layout/core').S
317
320
  <v-menu
318
321
  v-if="layout.listEditMode === 'menu'"
319
322
  location="start"
320
- z-index="3000"
323
+ :z-index="zIndex"
321
324
  :density="modelValue.options.density"
322
325
  :model-value="editedItem !== undefined"
323
326
  :close-on-content-click="false"
@@ -3,6 +3,7 @@ import { defineComponent, h, computed, toRef } from 'vue'
3
3
  import { VCombobox } from 'vuetify/components/VCombobox'
4
4
  import useNode from '../../composables/use-node.js'
5
5
  import useGetItems from '../../composables/use-get-items.js'
6
+ import useZIndexStack from '../../composables/use-z-index-stack.js'
6
7
  import { useDefaults } from 'vuetify'
7
8
 
8
9
  export default defineComponent({
@@ -24,6 +25,7 @@ export default defineComponent({
24
25
  const nodeRef = toRef(props, 'modelValue')
25
26
  const getItems = useGetItems(nodeRef, props.statefulLayout)
26
27
  const { inputProps, compSlots, localData, layout, options } = useNode(nodeRef, props.statefulLayout, { bindData: false, layoutPropsMap: ['step', 'min', 'max'] })
28
+ const zIndex = useZIndexStack(() => props.modelValue.fullKey)
27
29
 
28
30
  const fieldProps = computed(() => {
29
31
  const fieldProps = { ...inputProps.value }
@@ -32,8 +34,7 @@ export default defineComponent({
32
34
  if (options.value.readOnly) {
33
35
  fieldProps.menuProps = { modelValue: false }
34
36
  } else {
35
- // vuetify zIndex stacking is buggy (for example https://github.com/vuetifyjs/vuetify/issues/16251)
36
- fieldProps.menuProps = { zIndex: 3000 }
37
+ fieldProps.menuProps = { zIndex: zIndex.value }
37
38
  }
38
39
  if (getItems.hasItems.value) {
39
40
  fieldProps.items = getItems.items.value
@@ -5,6 +5,7 @@ import { ref, watch, computed, toRef } from 'vue'
5
5
  import { isSection } from '@json-layout/core/state'
6
6
  import { isCompObject } from '@json-layout/vocabulary'
7
7
  import useNode from '../../composables/use-node.js'
8
+ import useZIndexStack from '../../composables/use-z-index-stack.js'
8
9
  import Node from '../node.vue'
9
10
  import { useDefaults } from 'vuetify'
10
11
 
@@ -26,6 +27,7 @@ const props = defineProps({
26
27
  const { inputProps, localData, skeleton, children } = useNode(
27
28
  toRef(props, 'modelValue'), props.statefulLayout, { bindData: false }
28
29
  )
30
+ const zIndex = useZIndexStack(() => props.modelValue.fullKey)
29
31
 
30
32
  /** @type import('vue').Ref<string | undefined> */
31
33
  const activeChildTree = ref(undefined)
@@ -48,8 +50,7 @@ const fieldProps = computed(() => {
48
50
  const fieldProps = { ...inputProps.value }
49
51
  fieldProps['onUpdate:modelValue'] = onChange
50
52
  if (!props.modelValue.options.readOnly) {
51
- // vuetify zIndex stacking is buggy (for example https://github.com/vuetifyjs/vuetify/issues/16251)
52
- fieldProps.menuProps = { zIndex: 3000 }
53
+ fieldProps.menuProps = { zIndex: zIndex.value }
53
54
  }
54
55
  const items = []
55
56
  for (const childTreePointer of skeleton.value.childrenTrees || []) {
@@ -22,7 +22,7 @@ export default defineComponent({
22
22
  useDefaults({}, 'VjsfSelect')
23
23
  const avatarProps = useCompDefaults('VjsfSelectItem-VAvatar', { rounded: false, size: 'small' })
24
24
 
25
- const { getItems, selectProps, selectSlots, localData } = useSelectNode(toRef(props, 'modelValue'), props.statefulLayout, avatarProps.value)
25
+ const { getItems, selectProps, selectSlots, localData } = useSelectNode(toRef(props, 'modelValue'), props.statefulLayout, avatarProps.value, 'v-select')
26
26
 
27
27
  const fieldProps = computed(() => {
28
28
  const fieldProps = { ...selectProps.value }
@@ -3,18 +3,21 @@ 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
5
  import SelectSelection from '../components/fragments/select-selection.vue'
6
+ import useZIndexStack from './use-z-index-stack.js'
6
7
 
7
8
  /**
8
9
  * specialized use of useFieldProps shared between select and autocomplete components
9
10
  * @param {import('vue').Ref<import('../types.js').VjsfSelectNode>} nodeRef
10
11
  * @param {import('../types.js').VjsfStatefulLayout} statefulLayout
11
12
  * @param {any} avatarProps
13
+ * @param {'v-autocomplete' | 'v-select'} cssPrefix
12
14
  */
13
- export default function (nodeRef, statefulLayout, avatarProps) {
15
+ export default function (nodeRef, statefulLayout, avatarProps, cssPrefix) {
14
16
  const layout = computed(() => nodeRef.value.layout)
15
17
 
16
18
  const { inputProps, options, skeleton, localData, compSlots } = useField(nodeRef, statefulLayout, { layoutPropsMap: ['multiple', 'placeholder'], bindData: false })
17
19
  const getItems = useGetItems(nodeRef, statefulLayout)
20
+ const zIndex = useZIndexStack(() => nodeRef.value.fullKey)
18
21
 
19
22
  const selectProps = computed(() => {
20
23
  const props = { ...inputProps.value }
@@ -22,8 +25,7 @@ export default function (nodeRef, statefulLayout, avatarProps) {
22
25
  if (options.value.readOnly) {
23
26
  props.menuProps = { modelValue: false }
24
27
  } else {
25
- // vuetify zIndex stacking is buggy (for example https://github.com/vuetifyjs/vuetify/issues/16251)
26
- props.menuProps = { zIndex: 3000 }
28
+ props.menuProps = { zIndex: zIndex.value }
27
29
  }
28
30
  props.clearable = props.clearable ?? !skeleton.value.required
29
31
  props.valueComparator = (/** @type {any} */a, /** @type {any} */b) => {
@@ -65,7 +67,8 @@ export default function (nodeRef, statefulLayout, avatarProps) {
65
67
  multiple: layout.value.multiple,
66
68
  last: layout.value.multiple && context.index === nodeRef.value.data.length - 1,
67
69
  item: getItems.prepareSelectedItem(context.item.raw, context.item.value),
68
- avatarProps
70
+ avatarProps,
71
+ cssPrefix
69
72
  })
70
73
  }
71
74
  return slots
@@ -0,0 +1,21 @@
1
+ // vuetify zIndex stacking is buggy (for example https://github.com/vuetifyjs/vuetify/issues/16251)
2
+ // we try to work around this in this composable
3
+
4
+ import { provide, inject, computed } from 'vue'
5
+
6
+ const symbol = Symbol.for('vjsf:z-index-stack')
7
+
8
+ /**
9
+ * @param {() => string} keyGetter
10
+ */
11
+ export default (keyGetter) => {
12
+ return computed(() => {
13
+ const fullKey = keyGetter()
14
+ const currentZIndex = inject(symbol, { zIndex: 3000, fullKey })
15
+ const newZIndex = currentZIndex.zIndex + 10
16
+ if (fullKey.length > currentZIndex.fullKey.length) {
17
+ provide(symbol, { zIndex: newZIndex, fullKey })
18
+ }
19
+ return newZIndex
20
+ })
21
+ }
@@ -3,11 +3,13 @@ declare const _default: import("vue").DefineComponent<{}, {
3
3
  item: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem;
4
4
  avatarProps: Record<string, any>;
5
5
  last: boolean;
6
+ cssPrefix: string;
6
7
  $props: {
7
8
  readonly multiple?: boolean | undefined;
8
9
  readonly item?: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem | undefined;
9
10
  readonly avatarProps?: Record<string, any> | undefined;
10
11
  readonly last?: boolean | undefined;
12
+ readonly cssPrefix?: string | undefined;
11
13
  };
12
14
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
13
15
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"text-field-menu.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fragments/text-field-menu.vue.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;6BA6KsC,GAAG;;;QACX,GAAG"}
1
+ {"version":3,"file":"text-field-menu.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fragments/text-field-menu.vue.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;6BAgLsC,GAAG;;;QACX,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"combobox.vue.d.ts","sourceRoot":"","sources":["../../../src/components/nodes/combobox.vue.js"],"names":[],"mappings":";;QAWM,8EAA8E;cAApE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,gBAAgB,CAAC;;;;QAK3E,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC;;;;;;;QAL7E,8EAA8E;cAApE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,gBAAgB,CAAC;;;;QAK3E,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC"}
1
+ {"version":3,"file":"combobox.vue.d.ts","sourceRoot":"","sources":["../../../src/components/nodes/combobox.vue.js"],"names":[],"mappings":";;QAYM,8EAA8E;cAApE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,gBAAgB,CAAC;;;;QAK3E,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC;;;;;;;QAL7E,8EAA8E;cAApE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,gBAAgB,CAAC;;;;QAK3E,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"number-combobox.vue.d.ts","sourceRoot":"","sources":["../../../src/components/nodes/number-combobox.vue.js"],"names":[],"mappings":";;QAWM,8EAA8E;cAApE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,gBAAgB,CAAC;;;;QAK3E,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC;;;;;;;QAL7E,8EAA8E;cAApE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,gBAAgB,CAAC;;;;QAK3E,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC"}
1
+ {"version":3,"file":"number-combobox.vue.d.ts","sourceRoot":"","sources":["../../../src/components/nodes/number-combobox.vue.js"],"names":[],"mappings":";;QAYM,8EAA8E;cAApE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,gBAAgB,CAAC;;;;QAK3E,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC;;;;;;;QAL7E,8EAA8E;cAApE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,gBAAgB,CAAC;;;;QAK3E,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC"}
@@ -3,8 +3,9 @@
3
3
  * @param {import('vue').Ref<import('../types.js').VjsfSelectNode>} nodeRef
4
4
  * @param {import('../types.js').VjsfStatefulLayout} statefulLayout
5
5
  * @param {any} avatarProps
6
+ * @param {'v-autocomplete' | 'v-select'} cssPrefix
6
7
  */
7
- export default function _default(nodeRef: import('vue').Ref<import('../types.js').VjsfSelectNode>, statefulLayout: import('../types.js').VjsfStatefulLayout, avatarProps: any): {
8
+ export default function _default(nodeRef: import('vue').Ref<import('../types.js').VjsfSelectNode>, statefulLayout: import('../types.js').VjsfStatefulLayout, avatarProps: any, cssPrefix: 'v-autocomplete' | 'v-select'): {
8
9
  localData: import("vue").Ref<any, any>;
9
10
  inputProps: import("vue").ComputedRef<Record<string, any> & {
10
11
  class: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"use-select-node.d.ts","sourceRoot":"","sources":["../../src/composables/use-select-node.js"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,0CAJW,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,aAAa,EAAE,cAAc,CAAC,kBACvD,OAAO,aAAa,EAAE,kBAAkB,eACxC,GAAG;;;;;;;;;;;;;;;;;;;;EAgEb"}
1
+ {"version":3,"file":"use-select-node.d.ts","sourceRoot":"","sources":["../../src/composables/use-select-node.js"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,0CALW,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,aAAa,EAAE,cAAc,CAAC,kBACvD,OAAO,aAAa,EAAE,kBAAkB,eACxC,GAAG,aACH,gBAAgB,GAAG,UAAU;;;;;;;;;;;;;;;;;;;;EAiEvC"}
@@ -0,0 +1,3 @@
1
+ declare function _default(keyGetter: () => string): import("vue").ComputedRef<number>;
2
+ export default _default;
3
+ //# sourceMappingURL=use-z-index-stack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-z-index-stack.d.ts","sourceRoot":"","sources":["../../src/composables/use-z-index-stack.js"],"names":[],"mappings":"AAUe,qCAFJ,MAAM,MAAM,qCAYtB"}