@koumoul/vjsf 3.20.5 → 3.20.7

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.5",
3
+ "version": "3.20.7",
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"
@@ -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)
@@ -25,6 +25,7 @@ import useZIndexStack from '../../composables/use-z-index-stack.js'
25
25
  useDefaults({}, 'VjsfList')
26
26
  const vCardProps = useCompDefaults('VjsfList-VCard', { border: true, flat: true, tile: true })
27
27
  const vEditDialogProps = useCompDefaults('VjsfList-Edit-VDialog', { width: 500, persistent: true })
28
+ const vEditDialogVSheetProps = useCompDefaults('VjsfList-Edit-VDialog-VSheet', {})
28
29
  const vEditMenuProps = useCompDefaults('VjsfList-Edit-VMenu', { width: 500 })
29
30
  const theme = useTheme()
30
31
 
@@ -495,7 +496,7 @@ const itemBorderColor = computed(() => (/** @type {import('@json-layout/core').S
495
496
  :model-value="editedItem !== undefined"
496
497
  v-bind="vEditDialogProps"
497
498
  >
498
- <v-sheet>
499
+ <v-sheet v-bind="vEditDialogVSheetProps">
499
500
  <v-toolbar
500
501
  density="compact"
501
502
  color="surface"