@koumoul/vjsf 3.20.4 → 3.20.6

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,10 +1,11 @@
1
1
  {
2
2
  "name": "@koumoul/vjsf",
3
- "version": "3.20.4",
3
+ "version": "3.20.6",
4
4
  "description": "Generate forms for the vuetify UI library (vuejs) based on annotated JSON schemas.",
5
5
  "scripts": {
6
- "test": "vitest run",
7
- "test-watch": "vitest",
6
+ "test-tz1": "TZ=Europe/Paris vitest run",
7
+ "test-tz2": "TZ=America/Sao_Paulo vitest run",
8
+ "test-watch": "TZ=Europe/Paris vitest",
8
9
  "build": "vue-tsc",
9
10
  "watch:build": "vue-tsc --watch",
10
11
  "prepublishOnly": "npm run build && cp ../README.md README.md && cp ../LICENSE LICENSE"
@@ -71,7 +72,7 @@
71
72
  "vuetify": "^3.8.12"
72
73
  },
73
74
  "dependencies": {
74
- "@json-layout/core": "~1.15.0",
75
+ "@json-layout/core": "~2.0.0",
75
76
  "@json-layout/vocabulary": "~2.8.0",
76
77
  "@vueuse/core": "^12.5.0",
77
78
  "debug": "^4.3.4"
package/src/compat/v2.js CHANGED
@@ -161,9 +161,8 @@ const processFragment = (schema, getJSONRef, schemaId, processed) => {
161
161
  layout.if = '!summary'
162
162
  }
163
163
 
164
- if (schema.type === 'array' && schema.items && !layout.getItems) {
165
- if (!Array.isArray(schema.items)) {
166
- layout.comp = layout.comp ?? 'list'
164
+ if (schema.type === 'array' && schema.items && !layout.getItems && !Array.isArray(schema.items)) {
165
+ if (!layout.comp || layout.comp === 'list') {
167
166
  if (schema['x-itemTitle']) layout.itemTitle = `data["${schema['x-itemTitle']}"]`
168
167
  else {
169
168
  // vjsf 2 implicitly used a title property as an item title in lists
@@ -23,7 +23,7 @@ defineProps({
23
23
  </script>
24
24
 
25
25
  <template>
26
- <v-card :title="modelValue.layout.title ?? ''">
26
+ <v-card :title="modelValue.layout.title || undefined">
27
27
  <v-container fluid>
28
28
  <section-header
29
29
  :node="modelValue"
@@ -5,7 +5,7 @@ import { VDatePicker } from 'vuetify/components/VDatePicker'
5
5
  import { useDefaults } from 'vuetify'
6
6
  import { computed, ref, toRef, watch } from 'vue'
7
7
  import Debug from 'debug'
8
- import { getDateTimeParts, getDateTimeWithOffset, localeKeyboardFormat } from '../../utils/dates.js'
8
+ import { getDateTime, getDateTimeParts, getDateTimeWithOffset, localeKeyboardFormat } from '../../utils/dates.js'
9
9
  import useNode from '../../composables/use-node.js'
10
10
  import useCompDefaults from '../../composables/use-comp-defaults.js'
11
11
 
@@ -33,7 +33,6 @@ const { compProps, localData } = useNode(toRef(props, 'modelValue'), props.state
33
33
 
34
34
  const updateValue = (/** @type {Date | null} */value) => {
35
35
  if (!value) return
36
-
37
36
  const isoValue = props.modelValue.layout.format === 'date-time'
38
37
  ? getDateTimeWithOffset(value)
39
38
  : getDateTimeParts(/** @type Date */(/** @type unknown */(value)))[0]
@@ -44,11 +43,18 @@ const updateValue = (/** @type {Date | null} */value) => {
44
43
  }
45
44
  }
46
45
 
46
+ const localDateTime = computed(() => {
47
+ if (!localData.value) return null
48
+ return props.modelValue.layout.format === 'date-time'
49
+ ? new Date(/** @type {string} */(localData.value))
50
+ : new Date(getDateTime([localData.value, '00:00:00']))
51
+ })
52
+
47
53
  const datePickerProps = computed(() => {
48
54
  /** @type Record<String, any> */
49
55
  const datePickerProps = { ...datePickerDefaults.value, ...compProps.value }
50
56
  datePickerProps.hideActions = true
51
- if (localData.value) datePickerProps.modelValue = new Date(/** @type {string} */(localData.value))
57
+ if (localDateTime.value) datePickerProps.modelValue = localDateTime.value
52
58
  datePickerProps['onUpdate:modelValue'] = (/** @type {Date} */value) => {
53
59
  updateValue(value)
54
60
  }
@@ -58,9 +64,13 @@ const datePickerProps = computed(() => {
58
64
  /** @type {import('vue').Ref<string | null>} */
59
65
  const formattedValue = ref('')
60
66
  const setFormattedValue = () => {
61
- formattedValue.value = localData.value ? localeKeyboardFormat(props.modelValue.options.locale).format(new Date(localData.value)) : null
67
+ if (localDateTime.value) {
68
+ formattedValue.value = localeKeyboardFormat(props.modelValue.options.locale).format(localDateTime.value)
69
+ } else {
70
+ formattedValue.value = null
71
+ }
62
72
  }
63
- watch(localData, setFormattedValue, { immediate: true })
73
+ watch(localDateTime, setFormattedValue, { immediate: true })
64
74
  const updateFormattedValue = () => {
65
75
  if (formattedValue.value) {
66
76
  const newValue = localeKeyboardFormat(props.modelValue.options.locale).parse(formattedValue.value)
@@ -24,7 +24,7 @@ import useZIndexStack from '../../composables/use-z-index-stack.js'
24
24
 
25
25
  useDefaults({}, 'VjsfList')
26
26
  const vCardProps = useCompDefaults('VjsfList-VCard', { border: true, flat: true, tile: true })
27
- const vEditDialogProps = useCompDefaults('VjsfList-Edit-VDialog', { width: 500 })
27
+ const vEditDialogProps = useCompDefaults('VjsfList-Edit-VDialog', { width: 500, persistent: true })
28
28
  const vEditMenuProps = useCompDefaults('VjsfList-Edit-VMenu', { width: 500 })
29
29
  const theme = useTheme()
30
30
 
@@ -17,6 +17,9 @@
17
17
  .vjsf-input--readonly.v-input--disabled .v-field__clearable {
18
18
  display: none;
19
19
  }
20
+ .vjsf-input--readonly.v-input--disabled.v-number-input .v-field__append-inner {
21
+ display: none;
22
+ }
20
23
  .vjsf-node.vjsf-has-help {
21
24
  padding-right: 28px!important;
22
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"v2.d.ts","sourceRoot":"","sources":["../../src/compat/v2.js"],"names":[],"mappings":"AAuOA;;;;;;GAMG;AACH,kCALW,MAAM,2CAEN,MAAM,0BAoBhB;sBA/PqB,KAAK"}
1
+ {"version":3,"file":"v2.d.ts","sourceRoot":"","sources":["../../src/compat/v2.js"],"names":[],"mappings":"AAsOA;;;;;;GAMG;AACH,kCALW,MAAM,2CAEN,MAAM,0BAoBhB;sBA9PqB,KAAK"}