@koumoul/vjsf 3.12.1 → 3.13.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koumoul/vjsf",
3
- "version": "3.12.1",
3
+ "version": "3.13.0",
4
4
  "description": "Generate forms for the vuetify UI library (vuejs) based on annotated JSON schemas.",
5
5
  "scripts": {
6
6
  "test": "vitest run",
@@ -71,8 +71,8 @@
71
71
  "vuetify": "^3.6.13"
72
72
  },
73
73
  "dependencies": {
74
- "@json-layout/core": "~1.7.0",
75
- "@json-layout/vocabulary": "~2.1.0",
74
+ "@json-layout/core": "~1.9.0",
75
+ "@json-layout/vocabulary": "~2.2.0",
76
76
  "@vueuse/core": "^12.5.0",
77
77
  "debug": "^4.3.4"
78
78
  },
@@ -1,10 +1,10 @@
1
1
  <script setup>
2
2
  import { watch, computed, ref } from 'vue'
3
3
  import { useDefaults, useTheme } from 'vuetify'
4
- import { VList, VListItem, VListItemAction, VListItemTitle, VListSubheader } from 'vuetify/components/VList'
5
- import { VRow } from 'vuetify/components/VGrid'
4
+ import { VList, VListItem, VListItemAction, VListItemTitle, VListItemSubtitle, VListSubheader } from 'vuetify/components/VList'
5
+ import { VRow, VSpacer } from 'vuetify/components/VGrid'
6
6
  import { VTextField } from 'vuetify/components/VTextField'
7
- import { VSheet } from 'vuetify/components/VSheet'
7
+ import { VCard } from 'vuetify/components/VCard'
8
8
  import { VDivider } from 'vuetify/components/VDivider'
9
9
  import { VIcon } from 'vuetify/components/VIcon'
10
10
  import { VBtn } from 'vuetify/components/VBtn'
@@ -17,7 +17,7 @@ import useDnd from '../../composables/use-dnd.js'
17
17
  import useCompDefaults from '../../composables/use-comp-defaults.js'
18
18
 
19
19
  useDefaults({}, 'VjsfList')
20
- const vSheetProps = useCompDefaults('VjsfList-VSheet', { border: true })
20
+ const vCardProps = useCompDefaults('VjsfList-VCard', { border: true, flat: true, tile: true })
21
21
  const theme = useTheme()
22
22
 
23
23
  const props = defineProps({
@@ -85,6 +85,17 @@ const buttonDensity = computed(() => {
85
85
  return options.value.density
86
86
  })
87
87
 
88
+ const itemTitles = computed(() => {
89
+ const expr = props.modelValue.layout.itemTitle
90
+ if (!expr) return null
91
+ return sortableArray.value.map((child) => props.statefulLayout.evalNodeExpression(props.modelValue, expr, child.data))
92
+ })
93
+ const itemSubtitles = computed(() => {
94
+ const expr = props.modelValue.layout.itemSubtitle
95
+ if (!expr) return null
96
+ return sortableArray.value.map((child) => props.statefulLayout.evalNodeExpression(props.modelValue, expr, child.data))
97
+ })
98
+
88
99
  const pushEmptyItem = () => {
89
100
  const newData = (props.modelValue.data ?? []).concat([undefined])
90
101
  props.statefulLayout.input(props.modelValue, newData)
@@ -156,7 +167,10 @@ const itemBorderColor = computed(() => (/** @type {import('@json-layout/core').S
156
167
  </script>
157
168
 
158
169
  <template>
159
- <v-sheet v-bind="vSheetProps">
170
+ <v-card
171
+ v-bind="vCardProps"
172
+ :loading="modelValue.loading"
173
+ >
160
174
  <v-list class="py-0">
161
175
  <v-list-subheader v-if="modelValue.layout.title">
162
176
  {{ modelValue.layout.title }}
@@ -173,11 +187,23 @@ const itemBorderColor = computed(() => (/** @type {import('@json-layout/core').S
173
187
  class="pa-1 vjsf-list-item"
174
188
  >
175
189
  <v-list-item-title
176
- v-if="modelValue.layout.indexed"
190
+ v-if="itemTitles?.[childIndex]"
191
+ class="pl-4 pt-2"
192
+ >
193
+ {{ itemTitles?.[childIndex] }}
194
+ </v-list-item-title>
195
+ <v-list-item-title
196
+ v-else-if="modelValue.layout.indexed"
177
197
  class="pl-4 pt-2"
178
198
  >
179
199
  {{ child.key }}
180
200
  </v-list-item-title>
201
+ <v-list-item-subtitle
202
+ v-if="itemSubtitles?.[childIndex]"
203
+ class="pl-4 pt-2"
204
+ >
205
+ {{ itemSubtitles?.[childIndex] }}
206
+ </v-list-item-subtitle>
181
207
  <v-row class="ma-0">
182
208
  <node
183
209
  v-for="grandChild of isSection(child) ? child.children : [child]"
@@ -197,6 +223,7 @@ const itemBorderColor = computed(() => (/** @type {import('@json-layout/core').S
197
223
  variant="text"
198
224
  :density="buttonDensity"
199
225
  :icon="statefulLayout.options.icons.edit"
226
+ :disabled="modelValue.loading"
200
227
  />
201
228
  </v-list-item-action>
202
229
  <v-list-item-action
@@ -208,6 +235,7 @@ const itemBorderColor = computed(() => (/** @type {import('@json-layout/core').S
208
235
  variant="flat"
209
236
  color="primary"
210
237
  :density="buttonDensity"
238
+ :disabled="modelValue.loading"
211
239
  @click="statefulLayout.deactivateItem(modelValue)"
212
240
  />
213
241
  </v-list-item-action>
@@ -220,6 +248,7 @@ const itemBorderColor = computed(() => (/** @type {import('@json-layout/core').S
220
248
  variant="flat"
221
249
  color="primary"
222
250
  :density="buttonDensity"
251
+ :disabled="modelValue.loading"
223
252
  v-bind="handleBind(childIndex)"
224
253
  />
225
254
  </v-list-item-action>
@@ -240,6 +269,7 @@ const itemBorderColor = computed(() => (/** @type {import('@json-layout/core').S
240
269
  :icon="statefulLayout.options.icons.menu"
241
270
  variant="plain"
242
271
  slim
272
+ :disabled="modelValue.loading"
243
273
  :density="buttonDensity"
244
274
  />
245
275
  </template>
@@ -361,7 +391,7 @@ const itemBorderColor = computed(() => (/** @type {import('@json-layout/core').S
361
391
  </template>
362
392
  </v-list-item>
363
393
  </v-list>
364
- </v-sheet>
394
+ </v-card>
365
395
  </template>
366
396
 
367
397
  <style>