@koumoul/vjsf 3.0.0-beta.21 → 3.0.0-beta.24

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.
Files changed (40) hide show
  1. package/README.md +21 -0
  2. package/package.json +5 -4
  3. package/src/compat/v2.js +59 -15
  4. package/src/components/fragments/select-item-icon.vue +1 -1
  5. package/src/components/fragments/select-selection.vue +2 -1
  6. package/src/components/fragments/selection-group.vue +101 -0
  7. package/src/components/fragments/text-field-menu.vue +4 -0
  8. package/src/components/nodes/autocomplete.vue +9 -35
  9. package/src/components/nodes/checkbox-group.vue +36 -0
  10. package/src/components/nodes/list.vue +1 -1
  11. package/src/components/nodes/one-of-select.vue +10 -2
  12. package/src/components/nodes/radio-group.vue +50 -0
  13. package/src/components/nodes/select.vue +7 -27
  14. package/src/components/nodes/switch-group.vue +36 -0
  15. package/src/components/vjsf.vue +6 -0
  16. package/src/composables/use-get-items.js +48 -0
  17. package/src/composables/use-vjsf.js +0 -1
  18. package/src/types.ts +6 -0
  19. package/types/compat/v2.d.ts.map +1 -1
  20. package/types/components/fragments/select-item.vue.d.ts +2 -2
  21. package/types/components/fragments/selection-group.vue.d.ts +35 -0
  22. package/types/components/fragments/selection-group.vue.d.ts.map +1 -0
  23. package/types/components/fragments/text-field-menu.vue.d.ts.map +1 -1
  24. package/types/components/nodes/autocomplete.vue.d.ts.map +1 -1
  25. package/types/components/nodes/checkbox-group copy.vue.d.ts +27 -0
  26. package/types/components/nodes/checkbox-group copy.vue.d.ts.map +1 -0
  27. package/types/components/nodes/checkbox-group.vue.d.ts +27 -0
  28. package/types/components/nodes/checkbox-group.vue.d.ts.map +1 -0
  29. package/types/components/nodes/radio-group.vue.d.ts +27 -0
  30. package/types/components/nodes/radio-group.vue.d.ts.map +1 -0
  31. package/types/components/nodes/radio.vue.d.ts +10 -0
  32. package/types/components/nodes/radio.vue.d.ts.map +1 -0
  33. package/types/components/nodes/select.vue.d.ts.map +1 -1
  34. package/types/components/nodes/switch-group.vue.d.ts +27 -0
  35. package/types/components/nodes/switch-group.vue.d.ts.map +1 -0
  36. package/types/composables/use-get-items.d.ts +13 -0
  37. package/types/composables/use-get-items.d.ts.map +1 -0
  38. package/types/composables/use-vjsf.d.ts.map +1 -1
  39. package/types/types.d.ts +10 -1
  40. package/types/types.d.ts.map +1 -1
package/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # VJSF
2
+
3
+ *vuetify-json-schema-form* - *@koumoul/vjsf on npm*
4
+
5
+ Easily create beautiful forms that output valid data.
6
+
7
+ Based on [Vue.js](https://vuejs.org/) / [Vuetify](https://vuetifyjs.com/) / [JSON Schema](https://json-schema.org/) / [JSON Layout](https://github.com/json-layout/json-layout).
8
+
9
+ See [the documentation](https://koumoul-dev.github.io/vuetify-jsonschema-form/latest/).
10
+
11
+ See [the documentation for deprecated v2](https://koumoul-dev.github.io/vuetify-jsonschema-form/2.x/).
12
+
13
+ ![](doc/static/vjsf.gif)
14
+
15
+ ## Bug reports
16
+
17
+ Bug reports are created using github issues. The examples in the documentation include codepen links, as much as possible please save a duplicate codepen with the minimal schema/config to reproduce your problem.
18
+
19
+ ## Contribute
20
+
21
+ See [CONTRIBUTE.md](./CONTRIBUTE.md).
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@koumoul/vjsf",
3
- "version": "3.0.0-beta.21",
3
+ "version": "3.0.0-beta.24",
4
4
  "description": "Generate forms for the vuetify UI library (vuejs) based on annotated JSON schemas.",
5
5
  "scripts": {
6
6
  "test": "vitest",
7
7
  "build": "vue-tsc",
8
- "watch:build": "vue-tsc --watch"
8
+ "watch:build": "vue-tsc --watch",
9
+ "prepublishOnly": "cp ../README.md README.md && cp ../LICENSE LICENSE"
9
10
  },
10
11
  "author": "Alban Mouton <alban.mouton@gmail.com>",
11
12
  "license": "MIT",
@@ -72,10 +73,10 @@
72
73
  },
73
74
  "peerDependencies": {
74
75
  "vue": "^3.4.3",
75
- "vuetify": "^3.4.9"
76
+ "vuetify": "^3.6.8"
76
77
  },
77
78
  "dependencies": {
78
- "@json-layout/core": "0.16.4",
79
+ "@json-layout/core": "0.21.0",
79
80
  "@vueuse/core": "^10.5.0",
80
81
  "debug": "^4.3.4",
81
82
  "ejs": "^3.1.9"
package/src/compat/v2.js CHANGED
@@ -6,23 +6,57 @@ import { isPartialGetItemsObj } from '@json-layout/vocabulary'
6
6
  // @ts-ignore
7
7
  const Ajv = /** @type {typeof ajvModule.default} */ (ajvModule)
8
8
 
9
+ const expressionKeyMappings = {
10
+ modelRoot: 'rootData',
11
+ root: 'rootData',
12
+ model: 'data',
13
+ value: 'data'
14
+ }
15
+
16
+ /**
17
+ * @param {string} expression
18
+ * @returns {string}
19
+ */
20
+ const prefixExpression = (expression) => {
21
+ // looks like a simple expression missing the data. prefix
22
+ if (expression.match(/^[a-z.]*$/i) && !['data', 'context', 'rootData', 'parent'].some(key => expression.startsWith(key + '.'))) {
23
+ return 'rootData.' + expression
24
+ }
25
+ return expression
26
+ }
27
+
9
28
  /**
10
29
  *
11
30
  * @param {string} expression
12
- * @returns {{type: 'js-eval' | undefined, expr: string, pure: boolean}}
31
+ * @param {'js-eval' | 'js-tpl'} [type]
32
+ * @returns {{type: 'js-eval' | 'js-tpl', expr: string, pure: boolean}}
13
33
  */
14
- const fiexEvalExpression = (expression) => {
34
+ const fixExpression = (expression, type = 'js-eval') => {
15
35
  let expr = expression
16
36
  let pure = true
17
- if (expr.includes('rootData')) {
37
+
38
+ if (expr.includes('parent.value')) {
18
39
  pure = false
40
+ expr = expr.replace(/parent\.value/g, 'parent.data')
19
41
  }
20
- if (expr.includes('parent.value')) {
42
+
43
+ for (const [key, value] of Object.entries(expressionKeyMappings)) {
44
+ expr = expr.replace(new RegExp(`${key}\\.`, 'g'), value + '.')
45
+ }
46
+ if (type === 'js-eval') {
47
+ expr = prefixExpression(expr)
48
+ }
49
+ if (type === 'js-tpl') {
50
+ for (const expressionMatch of expr.matchAll(/\{(.*?)\}/g)) {
51
+ if (expressionMatch[1] !== 'q') expr = expr.replace(expressionMatch[0], '${' + prefixExpression(expressionMatch[1]) + '}')
52
+ }
53
+ }
54
+
55
+ if (expr.includes('rootData')) {
21
56
  pure = false
22
- expr = expr.replace(/parent\.value/g, 'parentData')
23
57
  }
24
58
 
25
- return { type: 'js-eval', expr, pure }
59
+ return { type, expr, pure }
26
60
  }
27
61
 
28
62
  const processFragment = (/** @type {import("ajv").SchemaObject} */schema) => {
@@ -42,7 +76,11 @@ const processFragment = (/** @type {import("ajv").SchemaObject} */schema) => {
42
76
  }
43
77
 
44
78
  if (schema['x-display']) {
45
- layout.comp = schema['x-display']
79
+ let display = schema['x-display']
80
+ if (display === 'radio') display = 'radio-group'
81
+ if (display === 'checkbox' && schema.type !== 'boolean') display = 'checkbox-group'
82
+ if (display === 'switch' && schema.type !== 'boolean') display = 'switch-group'
83
+ layout.comp = display
46
84
  delete schema['x-display']
47
85
  }
48
86
 
@@ -57,23 +95,20 @@ const processFragment = (/** @type {import("ajv").SchemaObject} */schema) => {
57
95
  }
58
96
 
59
97
  if (schema['x-fromData']) {
60
- layout.comp = 'select'
61
- layout.getItems = fiexEvalExpression(schema['x-fromData'])
98
+ layout.comp = layout.comp ?? 'select'
99
+ layout.getItems = fixExpression(schema['x-fromData'])
62
100
  delete schema['x-fromData']
63
101
  }
64
102
 
65
103
  if (schema['x-if']) {
66
- layout.if = fiexEvalExpression(schema['x-if'])
104
+ layout.if = fixExpression(schema['x-if'])
67
105
  delete schema['x-if']
68
106
  }
69
107
 
70
108
  if (schema['x-fromUrl']) {
71
109
  /** @type string */
72
- let url = schema['x-fromUrl']
73
- for (const expressionMatch of url.matchAll(/\{(.*?)\}/g)) {
74
- if (expressionMatch[1] !== 'q') url = url.replace(expressionMatch[0], '$' + expressionMatch[0])
75
- }
76
- layout.getItems = { url }
110
+ const url = schema['x-fromUrl']
111
+ layout.getItems = { url: fixExpression(url, 'js-tpl') }
77
112
  delete schema['x-fromUrl']
78
113
  }
79
114
  if (layout.getItems && isPartialGetItemsObj(layout.getItems)) {
@@ -132,6 +167,15 @@ const processFragment = (/** @type {import("ajv").SchemaObject} */schema) => {
132
167
  processFragment(schema.items)
133
168
  }
134
169
  }
170
+ if (schema.dependencies) {
171
+ for (const key of Object.keys(schema.dependencies)) {
172
+ processFragment(schema.dependencies[key])
173
+ }
174
+ }
175
+ if (schema.if) {
176
+ if (schema.then) processFragment(schema.then)
177
+ if (schema.else) processFragment(schema.else)
178
+ }
135
179
  }
136
180
 
137
181
  /**
@@ -20,7 +20,7 @@ export default defineComponent({
20
20
  } else if (isSVG.value) {
21
21
  return h('div', { innerHTML: props.icon.replace('<svg ', '<svg class="v-icon__svg" '), class: 'v-icon' })
22
22
  } else {
23
- return h(VIcon, null, props.icon)
23
+ return h(VIcon, null, () => props.icon)
24
24
  }
25
25
  }
26
26
  }
@@ -18,6 +18,7 @@ defineProps({
18
18
  required: true
19
19
  }
20
20
  })
21
+
21
22
  </script>
22
23
 
23
24
  <template>
@@ -26,7 +27,7 @@ defineProps({
26
27
  v-if="item.icon"
27
28
  :icon="item.icon"
28
29
  />
29
- {{ item.title }}
30
+ {{ item.title ?? item.key ?? item.value }}
30
31
  <span
31
32
  v-if="multiple && !last"
32
33
  class="v-select__selection-comma"
@@ -0,0 +1,101 @@
1
+ <script>
2
+ import { VInput, VLabel, VCheckbox, VSwitch, VSkeletonLoader } from 'vuetify/components'
3
+ import { defineComponent, h, computed } from 'vue'
4
+ import { getInputProps, getCompSlots } from '../../utils/index.js'
5
+ import useGetItems from '../../composables/use-get-items.js'
6
+
7
+ export default defineComponent({
8
+ props: {
9
+ modelValue: {
10
+ /** @type import('vue').PropType<import('../../types.js').VjsfCheckboxGroupNode> */
11
+ type: Object,
12
+ required: true
13
+ },
14
+ statefulLayout: {
15
+ /** @type import('vue').PropType<import('../../types.js').VjsfStatefulLayout> */
16
+ type: Object,
17
+ required: true
18
+ },
19
+ type: {
20
+ type: String,
21
+ required: true
22
+ }
23
+ },
24
+ setup (props) {
25
+ const getItems = useGetItems(props)
26
+
27
+ const fieldProps = computed(() => {
28
+ const fieldProps = getInputProps(props.modelValue, props.statefulLayout)
29
+ fieldProps.class.push('v-radio-group') // reuse some styles from radio-group
30
+ fieldProps.class.push('vjsf-selection-group')
31
+ return fieldProps
32
+ })
33
+
34
+ const fieldSlots = computed(() => {
35
+ const slots = getCompSlots(props.modelValue, props.statefulLayout)
36
+
37
+ if (!slots.default) {
38
+ slots.default = () => {
39
+ /** @type {import('vue').VNode[]} */
40
+ const children = [h(VLabel, { text: fieldProps.value.label })]
41
+ if (getItems.loading.value) {
42
+ children.push(h(VSkeletonLoader, { type: 'chip' }))
43
+ } else {
44
+ /** @type {import('vue').VNode[]} */
45
+ const checkboxes = []
46
+ for (const item of getItems.items.value) {
47
+ let modelValue = false
48
+ if (props.modelValue.layout.multiple) {
49
+ modelValue = props.modelValue.data?.includes(item.value)
50
+ } else {
51
+ modelValue = props.modelValue.data === item.value
52
+ }
53
+ checkboxes.push(h(props.type === 'switch' ? VSwitch : VCheckbox, {
54
+ label: item.title,
55
+ hideDetails: true,
56
+ density: props.modelValue.options?.density,
57
+ key: item.key,
58
+ modelValue,
59
+ onClick: () => {
60
+ let newValue
61
+ if (props.modelValue.layout.multiple) {
62
+ newValue = props.modelValue.data ? [...props.modelValue.data] : []
63
+ if (newValue.includes(item.value)) {
64
+ newValue = newValue.filter((/** @type {any} */v) => v !== item.value)
65
+ } else {
66
+ newValue.push(item.value)
67
+ }
68
+ } else {
69
+ if (props.modelValue.data === item.value) {
70
+ newValue = undefined
71
+ } else {
72
+ newValue = item.value
73
+ }
74
+ }
75
+ props.statefulLayout.input(props.modelValue, newValue)
76
+ }
77
+ }))
78
+ }
79
+ children.push(h('div', { class: 'v-selection-control-group' }, checkboxes))
80
+ }
81
+ return children
82
+ }
83
+ }
84
+
85
+ return slots
86
+ })
87
+
88
+ // @ts-ignore
89
+ return () => {
90
+ return h(VInput, fieldProps.value, fieldSlots.value)
91
+ }
92
+ }
93
+ })
94
+
95
+ </script>
96
+
97
+ <style>
98
+ .vjsf-selection-group .v-selection-control-group>.v-input .v-selection-control {
99
+ min-height: auto;
100
+ }
101
+ </style>
@@ -24,6 +24,10 @@ const props = defineProps({
24
24
  const fieldProps = computed(() => {
25
25
  const fieldProps = getInputProps(props.modelValue, props.statefulLayout, [], false)
26
26
  fieldProps.readonly = true
27
+ fieldProps.clearable = fieldProps.clearable ?? !props.modelValue.skeleton.required
28
+ fieldProps['onClick:clear'] = () => {
29
+ props.statefulLayout.input(props.modelValue, null)
30
+ }
27
31
  return fieldProps
28
32
  })
29
33
 
@@ -1,7 +1,8 @@
1
1
  <script>
2
2
  import { VAutocomplete } from 'vuetify/components'
3
- import { defineComponent, computed, ref, shallowRef, h } from 'vue'
3
+ import { defineComponent, computed, h } from 'vue'
4
4
  import { getInputProps, getCompSlots } from '../../utils/index.js'
5
+ import useGetItems from '../../composables/use-get-items.js'
5
6
  import SelectItem from '../fragments/select-item.vue'
6
7
  import SelectSelection from '../fragments/select-selection.vue'
7
8
 
@@ -13,54 +14,27 @@ export default defineComponent({
13
14
  required: true
14
15
  },
15
16
  statefulLayout: {
16
- /** @type import('vue').PropType<import('../../types.js').VjsfStatefulLayout> */
17
+ /** @type import('vue').PropType<import('../../types.js').VjsfStatefulLayout> */
17
18
  type: Object,
18
19
  required: true
19
20
  }
20
21
  },
21
22
  setup (props) {
22
- /** @type import('vue').ShallowRef<import('@json-layout/vocabulary').SelectItems> */
23
- const items = shallowRef([])
24
- /** @type import('vue').Ref<boolean> */
25
- const loading = ref(false)
26
- /** @type import('vue').Ref<string> */
27
- const search = ref('')
23
+ const getItems = useGetItems(props)
28
24
 
29
25
  const fieldProps = computed(() => {
30
26
  const fieldProps = getInputProps(props.modelValue, props.statefulLayout, ['multiple'])
31
27
  if (props.modelValue.options.readOnly) fieldProps.menuProps = { modelValue: false }
32
28
  fieldProps.noFilter = true
33
29
  fieldProps['onUpdate:search'] = (/** @type string */searchValue) => {
34
- search.value = searchValue
35
- refresh()
30
+ getItems.search.value = searchValue
36
31
  }
37
- fieldProps['onUpdate:menu'] = refresh
38
- fieldProps.items = items.value
39
- fieldProps.loading = loading.value
32
+ fieldProps.items = getItems.items.value
33
+ fieldProps.loading = getItems.loading.value
34
+ fieldProps.clearable = fieldProps.clearable ?? !props.modelValue.skeleton.required
40
35
  return fieldProps
41
36
  })
42
37
 
43
- /** @type import('@json-layout/core').StateTree | null */
44
- let lastStateTree = null
45
- /** @type Record<string, any> | null */
46
- let lastContext = null
47
- /** @type string */
48
- let lastSearch = ''
49
-
50
- const refresh = async () => {
51
- if (props.statefulLayout.stateTree === lastStateTree && props.statefulLayout.options.context === lastContext && search.value === lastSearch) return
52
- loading.value = true
53
- items.value = await props.statefulLayout.getItems(props.modelValue, search.value)
54
- lastStateTree = props.statefulLayout.stateTree
55
- lastContext = props.statefulLayout.options.context ?? null
56
- lastSearch = search.value
57
- loading.value = false
58
- }
59
-
60
- if (!props.modelValue.layout.items) {
61
- refresh()
62
- }
63
-
64
38
  const fieldSlots = computed(() => {
65
39
  const slots = getCompSlots(props.modelValue, props.statefulLayout)
66
40
  if (!slots.item) {
@@ -74,7 +48,7 @@ export default defineComponent({
74
48
  slots.selection = (/** @type {any} */ context) => h(SelectSelection, {
75
49
  multiple: props.modelValue.layout.multiple,
76
50
  last: props.modelValue.layout.multiple && context.index === props.modelValue.data.length - 1,
77
- item: context.item.raw
51
+ item: getItems.prepareSelectedItem(context.item.raw, context.item.value)
78
52
  })
79
53
  }
80
54
  return slots
@@ -0,0 +1,36 @@
1
+ <script>
2
+ import SelectionGroup from '../fragments/selection-group.vue'
3
+ import { defineComponent, h } from 'vue'
4
+
5
+ export default defineComponent({
6
+ props: {
7
+ modelValue: {
8
+ /** @type import('vue').PropType<import('../../types.js').VjsfCheckboxGroupNode> */
9
+ type: Object,
10
+ required: true
11
+ },
12
+ statefulLayout: {
13
+ /** @type import('vue').PropType<import('../../types.js').VjsfStatefulLayout> */
14
+ type: Object,
15
+ required: true
16
+ }
17
+ },
18
+ setup (props) {
19
+ // @ts-ignore
20
+ return () => {
21
+ return h(SelectionGroup, {
22
+ modelValue: props.modelValue,
23
+ statefulLayout: props.statefulLayout,
24
+ type: 'checkbox'
25
+ })
26
+ }
27
+ }
28
+ })
29
+
30
+ </script>
31
+
32
+ <style>
33
+ .vjsf-node-checkbox-group .v-selection-control-group .v-checkbox .v-selection-control {
34
+ min-height: auto;
35
+ }
36
+ </style>
@@ -142,7 +142,7 @@ const itemBorderColor = computed(() => (/** @type {import('@json-layout/core').S
142
142
  />
143
143
  <v-btn
144
144
  v-else
145
- :title="modelValue.messages.edit"
145
+ :title="modelValue.messages.close"
146
146
  icon="mdi-close"
147
147
  variant="flat"
148
148
  color="primary"
@@ -2,7 +2,8 @@
2
2
  import { VSelect, VRow, VCol } from 'vuetify/components'
3
3
  import { shallowRef, watch, computed, h } from 'vue'
4
4
  import { isSection } from '@json-layout/core'
5
- import { getInputProps, getCompSlots } from '../../utils/index.js'
5
+ import { isCompObject } from '@json-layout/vocabulary'
6
+ import { getInputProps } from '../../utils/index.js'
6
7
  import Node from '../node.vue'
7
8
 
8
9
  const props = defineProps({
@@ -39,7 +40,14 @@ const fieldProps = computed(() => {
39
40
  fieldProps.modelValue = activeChildTree.value
40
41
  fieldProps['onUpdate:modelValue'] = onChange
41
42
  fieldProps.returnObject = true
42
- fieldProps.items = props.modelValue.skeleton.childrenTrees
43
+ const items = []
44
+ for (const childTree of props.modelValue.skeleton.childrenTrees || []) {
45
+ const childLayout = props.statefulLayout.compiledLayout.normalizedLayouts[childTree.root.pointer]
46
+ if (!isCompObject(childLayout) || !childLayout.if || !!props.statefulLayout.evalNodeExpression(props.modelValue, childLayout.if, props.modelValue.data)) {
47
+ items.push(childTree)
48
+ }
49
+ }
50
+ fieldProps.items = items
43
51
  fieldProps.itemTitle = 'title'
44
52
  return fieldProps
45
53
  })
@@ -0,0 +1,50 @@
1
+ <script>
2
+ import { VRadioGroup, VRadio, VSkeletonLoader } from 'vuetify/components'
3
+ import { defineComponent, h, computed } from 'vue'
4
+ import { getInputProps, getCompSlots } from '../../utils/index.js'
5
+ import useGetItems from '../../composables/use-get-items.js'
6
+
7
+ export default defineComponent({
8
+ props: {
9
+ modelValue: {
10
+ /** @type import('vue').PropType<import('../../types.js').VjsfRadioGroupNode> */
11
+ type: Object,
12
+ required: true
13
+ },
14
+ statefulLayout: {
15
+ /** @type import('vue').PropType<import('../../types.js').VjsfStatefulLayout> */
16
+ type: Object,
17
+ required: true
18
+ }
19
+ },
20
+ setup (props) {
21
+ const getItems = useGetItems(props)
22
+
23
+ const fieldProps = computed(() => {
24
+ const fieldProps = getInputProps(props.modelValue, props.statefulLayout)
25
+ return fieldProps
26
+ })
27
+
28
+ const fieldSlots = computed(() => {
29
+ const slots = getCompSlots(props.modelValue, props.statefulLayout)
30
+ /** @type {import('vue').VNode[]} */
31
+ const children = []
32
+ if (getItems.loading.value) {
33
+ children.push(h(VSkeletonLoader, { type: 'chip' }))
34
+ } else {
35
+ for (const item of getItems.items.value) {
36
+ children.push(h(VRadio, { label: item.title, value: item.value }))
37
+ }
38
+ }
39
+ slots.default = () => children
40
+ return slots
41
+ })
42
+
43
+ // @ts-ignore
44
+ return () => {
45
+ return h(VRadioGroup, fieldProps.value, fieldSlots.value)
46
+ }
47
+ }
48
+ })
49
+
50
+ </script>
@@ -1,7 +1,8 @@
1
1
  <script>
2
2
  import { VSelect } from 'vuetify/components'
3
- import { defineComponent, h, computed, ref, shallowRef } from 'vue'
3
+ import { defineComponent, h, computed } from 'vue'
4
4
  import { getInputProps, getCompSlots } from '../../utils/index.js'
5
+ import useGetItems from '../../composables/use-get-items.js'
5
6
  import SelectItem from '../fragments/select-item.vue'
6
7
  import SelectSelection from '../fragments/select-selection.vue'
7
8
 
@@ -19,38 +20,17 @@ export default defineComponent({
19
20
  }
20
21
  },
21
22
  setup (props) {
22
- /** @type import('vue').Ref<import('@json-layout/vocabulary').SelectItems> */
23
- const items = shallowRef([])
24
- /** @type import('vue').Ref<boolean> */
25
- const loading = ref(false)
23
+ const getItems = useGetItems(props)
26
24
 
27
25
  const fieldProps = computed(() => {
28
26
  const fieldProps = getInputProps(props.modelValue, props.statefulLayout, ['multiple'])
29
27
  if (props.modelValue.options.readOnly) fieldProps.menuProps = { modelValue: false }
30
- fieldProps.loading = loading.value
31
- fieldProps.items = items.value
32
- fieldProps['onUpdate:menu'] = refresh
28
+ fieldProps.loading = getItems.loading.value
29
+ fieldProps.items = getItems.items.value
30
+ fieldProps.clearable = fieldProps.clearable ?? !props.modelValue.skeleton.required
33
31
  return fieldProps
34
32
  })
35
33
 
36
- /** @type import('@json-layout/core').StateTree | null */
37
- let lastStateTree = null
38
- /** @type Record<string, any> | null */
39
- let lastContext = null
40
-
41
- const refresh = async () => {
42
- if (props.statefulLayout.stateTree === lastStateTree && props.statefulLayout.options.context === lastContext) return
43
- lastStateTree = props.statefulLayout.stateTree
44
- lastContext = props.statefulLayout.options.context ?? null
45
- loading.value = true
46
- items.value = await props.statefulLayout.getItems(props.modelValue)
47
- loading.value = false
48
- }
49
-
50
- if (!props.modelValue.layout.items) {
51
- refresh()
52
- }
53
-
54
34
  const fieldSlots = computed(() => {
55
35
  const slots = getCompSlots(props.modelValue, props.statefulLayout)
56
36
  if (!slots.item) {
@@ -64,7 +44,7 @@ export default defineComponent({
64
44
  slots.selection = (/** @type {any} */ context) => h(SelectSelection, {
65
45
  multiple: props.modelValue.layout.multiple,
66
46
  last: props.modelValue.layout.multiple && context.index === props.modelValue.data.length - 1,
67
- item: context.item.raw
47
+ item: getItems.prepareSelectedItem(context.item.raw, context.item.value)
68
48
  })
69
49
  }
70
50
  return slots
@@ -0,0 +1,36 @@
1
+ <script>
2
+ import SelectionGroup from '../fragments/selection-group.vue'
3
+ import { defineComponent, h } from 'vue'
4
+
5
+ export default defineComponent({
6
+ props: {
7
+ modelValue: {
8
+ /** @type import('vue').PropType<import('../../types.js').VjsfCheckboxGroupNode> */
9
+ type: Object,
10
+ required: true
11
+ },
12
+ statefulLayout: {
13
+ /** @type import('vue').PropType<import('../../types.js').VjsfStatefulLayout> */
14
+ type: Object,
15
+ required: true
16
+ }
17
+ },
18
+ setup (props) {
19
+ // @ts-ignore
20
+ return () => {
21
+ return h(SelectionGroup, {
22
+ modelValue: props.modelValue,
23
+ statefulLayout: props.statefulLayout,
24
+ type: 'switch'
25
+ })
26
+ }
27
+ }
28
+ })
29
+
30
+ </script>
31
+
32
+ <style>
33
+ .vjsf-node-checkbox-group .v-selection-control-group .v-checkbox .v-selection-control {
34
+ min-height: auto;
35
+ }
36
+ </style>
@@ -18,6 +18,9 @@ import NodeDateTimePicker from './nodes/date-time-picker.vue'
18
18
  import NodeColorPicker from './nodes/color-picker.vue'
19
19
  import NodeSelect from './nodes/select.vue'
20
20
  import NodeAutocomplete from './nodes/autocomplete.vue'
21
+ import NodeRadioGroup from './nodes/radio-group.vue'
22
+ import NodeCheckboxGroup from './nodes/checkbox-group.vue'
23
+ import NodeSwitchGroup from './nodes/switch-group.vue'
21
24
  import NodeOneOfSelect from './nodes/one-of-select.vue'
22
25
  import NodeTabs from './nodes/tabs.vue'
23
26
  import NodeVerticalTabs from './nodes/vertical-tabs.vue'
@@ -42,6 +45,9 @@ const nodeComponents = {
42
45
  'color-picker': NodeColorPicker,
43
46
  select: NodeSelect,
44
47
  autocomplete: NodeAutocomplete,
48
+ 'radio-group': NodeRadioGroup,
49
+ 'checkbox-group': NodeCheckboxGroup,
50
+ 'switch-group': NodeSwitchGroup,
45
51
  'one-of-select': NodeOneOfSelect,
46
52
  tabs: NodeTabs,
47
53
  'vertical-tabs': NodeVerticalTabs,
@@ -0,0 +1,48 @@
1
+ import { watch, shallowRef, ref, computed } from 'vue'
2
+
3
+ /**
4
+ * @param {{modelValue: import('@json-layout/core').StateNode, statefulLayout: import('../types.js').VjsfStatefulLayout}} props
5
+ */
6
+ export default function (props) {
7
+ /** @type import('vue').Ref<import('@json-layout/vocabulary').SelectItems> */
8
+ const items = shallowRef([])
9
+ /** @type import('vue').Ref<boolean> */
10
+ const loading = ref(false)
11
+ /** @type import('vue').Ref<string> */
12
+ const search = ref('')
13
+
14
+ const fetchItems = async () => {
15
+ loading.value = true
16
+ items.value = await props.statefulLayout.getItems(props.modelValue, search.value)
17
+ loading.value = false
18
+ }
19
+
20
+ watch(() => props.modelValue.itemsCacheKey, (newValue, oldValue) => {
21
+ if (newValue === oldValue) return
22
+ fetchItems()
23
+ }, { immediate: true })
24
+
25
+ watch(search, () => {
26
+ fetchItems()
27
+ })
28
+
29
+ /**
30
+ * @param {any} selectedItem
31
+ * @param {any} itemValue
32
+ */
33
+ const prepareSelectedItem = (selectedItem, itemValue) => {
34
+ let item = selectedItem
35
+ // item and value are the same when the selection is not found in items list
36
+ if (selectedItem === itemValue) {
37
+ try {
38
+ item = props.statefulLayout.prepareSelectItem(props.modelValue, selectedItem)
39
+ if (item.value === undefined) item.value = itemValue
40
+ } catch (e) {
41
+ item = { value: itemValue }
42
+ }
43
+ }
44
+ return item
45
+ }
46
+
47
+ return { items, loading, search, prepareSelectedItem }
48
+ }
@@ -62,7 +62,6 @@ export const useVjsf = (schema, modelValue, options, nodeComponents, emit, compi
62
62
  watch(fullOptions, (newOptions) => {
63
63
  if (precompiledLayout?.value) return
64
64
  const newCompileOptions = produceCompileOptions(compileOptions.value, newOptions)
65
- console.log('compile options', newOptions, newCompileOptions)
66
65
  if (newCompileOptions !== compileOptions.value) compileOptions.value = newCompileOptions
67
66
  }, { immediate: true })
68
67
 
package/src/types.ts CHANGED
@@ -17,6 +17,9 @@ import {
17
17
  OneOfSelectNode,
18
18
  SectionNode,
19
19
  SelectNode,
20
+ RadioGroupNode,
21
+ CheckboxGroupNode,
22
+ SwitchGroupNode,
20
23
  SliderNode,
21
24
  SwitchNode,
22
25
  TextFieldNode,
@@ -68,6 +71,9 @@ export type VjsfNumberFieldNode = Omit<NumberFieldNode, 'options'> & {options: V
68
71
  export type VjsfOneOfSelectNode = Omit<OneOfSelectNode, 'options'> & {options: VjsfOptions}
69
72
  export type VjsfSectionNode = Omit<SectionNode, 'options'> & {options: VjsfOptions}
70
73
  export type VjsfSelectNode = Omit<SelectNode, 'options'> & {options: VjsfOptions}
74
+ export type VjsfRadioGroupNode = Omit<RadioGroupNode, 'options'> & {options: VjsfOptions}
75
+ export type VjsfCheckboxGroupNode = Omit<CheckboxGroupNode, 'options'> & {options: VjsfOptions}
76
+ export type VjsfSwitchGroupNode = Omit<SwitchGroupNode, 'options'> & {options: VjsfOptions}
71
77
  export type VjsfSliderNode = Omit<SliderNode, 'options'> & {options: VjsfOptions}
72
78
  export type VjsfSwitchNode = Omit<SwitchNode, 'options'> & {options: VjsfOptions}
73
79
  export type VjsfTextFieldNode = Omit<TextFieldNode, 'options'> & {options: VjsfOptions}
@@ -1 +1 @@
1
- {"version":3,"file":"v2.d.ts","sourceRoot":"","sources":["../../src/compat/v2.js"],"names":[],"mappings":"AAwIA;;;;;;GAMG;AACH,kCALW,MAAM,+CAEN,MAAM,0BAkBhB;sBA9JqB,KAAK"}
1
+ {"version":3,"file":"v2.d.ts","sourceRoot":"","sources":["../../src/compat/v2.js"],"names":[],"mappings":"AAoLA;;;;;;GAMG;AACH,kCALW,MAAM,+CAEN,MAAM,0BAkBhB;sBA1MqB,KAAK"}
@@ -1,11 +1,11 @@
1
1
  declare const _default: import("vue").DefineComponent<{}, {
2
2
  multiple: boolean;
3
- item: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem;
4
3
  itemProps: Record<string, any>;
4
+ item: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem;
5
5
  $props: {
6
6
  readonly multiple?: boolean | undefined;
7
- readonly item?: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem | undefined;
8
7
  readonly itemProps?: Record<string, any> | undefined;
8
+ readonly item?: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem | undefined;
9
9
  };
10
10
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
11
11
  export default _default;
@@ -0,0 +1,35 @@
1
+ declare const _default: import("vue").DefineComponent<{
2
+ modelValue: {
3
+ /** @type import('vue').PropType<import('../../types.js').VjsfCheckboxGroupNode> */
4
+ type: import('vue').PropType<import('../../types.js').VjsfCheckboxGroupNode>;
5
+ required: true;
6
+ };
7
+ statefulLayout: {
8
+ /** @type import('vue').PropType<import('../../types.js').VjsfStatefulLayout> */
9
+ type: import('vue').PropType<import('../../types.js').VjsfStatefulLayout>;
10
+ required: true;
11
+ };
12
+ type: {
13
+ type: StringConstructor;
14
+ required: true;
15
+ };
16
+ }, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
17
+ [key: string]: any;
18
+ }>, any, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
19
+ modelValue: {
20
+ /** @type import('vue').PropType<import('../../types.js').VjsfCheckboxGroupNode> */
21
+ type: import('vue').PropType<import('../../types.js').VjsfCheckboxGroupNode>;
22
+ required: true;
23
+ };
24
+ statefulLayout: {
25
+ /** @type import('vue').PropType<import('../../types.js').VjsfStatefulLayout> */
26
+ type: import('vue').PropType<import('../../types.js').VjsfStatefulLayout>;
27
+ required: true;
28
+ };
29
+ type: {
30
+ type: StringConstructor;
31
+ required: true;
32
+ };
33
+ }>>, {}, {}>;
34
+ export default _default;
35
+ //# sourceMappingURL=selection-group.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selection-group.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fragments/selection-group.vue.js"],"names":[],"mappings":";;QAUM,mFAAmF;cAAzE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,qBAAqB,CAAC;;;;QAKhF,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC;;;;;;;;;;;QAL7E,mFAAmF;cAAzE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,qBAAqB,CAAC;;;;QAKhF,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"text-field-menu.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fragments/text-field-menu.vue.js"],"names":[],"mappings":";;;;;;;;;;6BAkIsC,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":";;;;;;;;;;6BAsIsC,GAAG;;;QACX,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"autocomplete.vue.d.ts","sourceRoot":"","sources":["../../../src/components/nodes/autocomplete.vue.js"],"names":[],"mappings":";;QAWI,4EAA4E;cAAlE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,cAAc,CAAC;;;;QAKzE,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC;;;;;;;QAL7E,4EAA4E;cAAlE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,cAAc,CAAC;;;;QAKzE,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC"}
1
+ {"version":3,"file":"autocomplete.vue.d.ts","sourceRoot":"","sources":["../../../src/components/nodes/autocomplete.vue.js"],"names":[],"mappings":";;QAYI,4EAA4E;cAAlE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,cAAc,CAAC;;;;QAKvE,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC;;;;;;;QAL/E,4EAA4E;cAAlE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,cAAc,CAAC;;;;QAKvE,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC"}
@@ -0,0 +1,27 @@
1
+ declare const _default: import("vue").DefineComponent<{
2
+ modelValue: {
3
+ /** @type import('vue').PropType<import('../../types.js').VjsfCheckboxGroupNode> */
4
+ type: import('vue').PropType<import('../../types.js').VjsfCheckboxGroupNode>;
5
+ required: true;
6
+ };
7
+ statefulLayout: {
8
+ /** @type import('vue').PropType<import('../../types.js').VjsfStatefulLayout> */
9
+ type: import('vue').PropType<import('../../types.js').VjsfStatefulLayout>;
10
+ required: true;
11
+ };
12
+ }, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
13
+ [key: string]: any;
14
+ }>, any, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
15
+ modelValue: {
16
+ /** @type import('vue').PropType<import('../../types.js').VjsfCheckboxGroupNode> */
17
+ type: import('vue').PropType<import('../../types.js').VjsfCheckboxGroupNode>;
18
+ required: true;
19
+ };
20
+ statefulLayout: {
21
+ /** @type import('vue').PropType<import('../../types.js').VjsfStatefulLayout> */
22
+ type: import('vue').PropType<import('../../types.js').VjsfStatefulLayout>;
23
+ required: true;
24
+ };
25
+ }>>, {}, {}>;
26
+ export default _default;
27
+ //# sourceMappingURL=checkbox-group%20copy.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox-group copy.vue.d.ts","sourceRoot":"","sources":["../../../src/components/nodes/checkbox-group copy.vue.js"],"names":[],"mappings":";;QAQI,mFAAmF;cAAzE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,qBAAqB,CAAC;;;;QAKhF,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC;;;;;;;QAL7E,mFAAmF;cAAzE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,qBAAqB,CAAC;;;;QAKhF,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC"}
@@ -0,0 +1,27 @@
1
+ declare const _default: import("vue").DefineComponent<{
2
+ modelValue: {
3
+ /** @type import('vue').PropType<import('../../types.js').VjsfCheckboxGroupNode> */
4
+ type: import('vue').PropType<import('../../types.js').VjsfCheckboxGroupNode>;
5
+ required: true;
6
+ };
7
+ statefulLayout: {
8
+ /** @type import('vue').PropType<import('../../types.js').VjsfStatefulLayout> */
9
+ type: import('vue').PropType<import('../../types.js').VjsfStatefulLayout>;
10
+ required: true;
11
+ };
12
+ }, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
13
+ [key: string]: any;
14
+ }>, any, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
15
+ modelValue: {
16
+ /** @type import('vue').PropType<import('../../types.js').VjsfCheckboxGroupNode> */
17
+ type: import('vue').PropType<import('../../types.js').VjsfCheckboxGroupNode>;
18
+ required: true;
19
+ };
20
+ statefulLayout: {
21
+ /** @type import('vue').PropType<import('../../types.js').VjsfStatefulLayout> */
22
+ type: import('vue').PropType<import('../../types.js').VjsfStatefulLayout>;
23
+ required: true;
24
+ };
25
+ }>>, {}, {}>;
26
+ export default _default;
27
+ //# sourceMappingURL=checkbox-group.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox-group.vue.d.ts","sourceRoot":"","sources":["../../../src/components/nodes/checkbox-group.vue.js"],"names":[],"mappings":";;QAQI,mFAAmF;cAAzE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,qBAAqB,CAAC;;;;QAKhF,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC;;;;;;;QAL7E,mFAAmF;cAAzE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,qBAAqB,CAAC;;;;QAKhF,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC"}
@@ -0,0 +1,27 @@
1
+ declare const _default: import("vue").DefineComponent<{
2
+ modelValue: {
3
+ /** @type import('vue').PropType<import('../../types.js').VjsfRadioGroupNode> */
4
+ type: import('vue').PropType<import('../../types.js').VjsfRadioGroupNode>;
5
+ required: true;
6
+ };
7
+ statefulLayout: {
8
+ /** @type import('vue').PropType<import('../../types.js').VjsfStatefulLayout> */
9
+ type: import('vue').PropType<import('../../types.js').VjsfStatefulLayout>;
10
+ required: true;
11
+ };
12
+ }, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
13
+ [key: string]: any;
14
+ }>, any, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
15
+ modelValue: {
16
+ /** @type import('vue').PropType<import('../../types.js').VjsfRadioGroupNode> */
17
+ type: import('vue').PropType<import('../../types.js').VjsfRadioGroupNode>;
18
+ required: true;
19
+ };
20
+ statefulLayout: {
21
+ /** @type import('vue').PropType<import('../../types.js').VjsfStatefulLayout> */
22
+ type: import('vue').PropType<import('../../types.js').VjsfStatefulLayout>;
23
+ required: true;
24
+ };
25
+ }>>, {}, {}>;
26
+ export default _default;
27
+ //# sourceMappingURL=radio-group.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radio-group.vue.d.ts","sourceRoot":"","sources":["../../../src/components/nodes/radio-group.vue.js"],"names":[],"mappings":";;QAUM,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC;;;;QAK7E,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC;;;;;;;QAL7E,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC;;;;QAK7E,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC"}
@@ -0,0 +1,10 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {
2
+ modelValue: import("../../types.js").VjsfSwitchNode;
3
+ statefulLayout: import("../../types.js").VjsfStatefulLayout;
4
+ $props: {
5
+ readonly modelValue?: import("../../types.js").VjsfSwitchNode | undefined;
6
+ readonly statefulLayout?: import("../../types.js").VjsfStatefulLayout | undefined;
7
+ };
8
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
9
+ export default _default;
10
+ //# sourceMappingURL=radio.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radio.vue.d.ts","sourceRoot":"","sources":["../../../src/components/nodes/radio.vue.js"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"select.vue.d.ts","sourceRoot":"","sources":["../../../src/components/nodes/select.vue.js"],"names":[],"mappings":";;QAWI,4EAA4E;cAAlE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,cAAc,CAAC;;;;QAKzE,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC;;;;;;;QAL7E,4EAA4E;cAAlE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,cAAc,CAAC;;;;QAKzE,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC"}
1
+ {"version":3,"file":"select.vue.d.ts","sourceRoot":"","sources":["../../../src/components/nodes/select.vue.js"],"names":[],"mappings":";;QAYI,4EAA4E;cAAlE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,cAAc,CAAC;;;;QAKzE,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC;;;;;;;QAL7E,4EAA4E;cAAlE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,cAAc,CAAC;;;;QAKzE,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC"}
@@ -0,0 +1,27 @@
1
+ declare const _default: import("vue").DefineComponent<{
2
+ modelValue: {
3
+ /** @type import('vue').PropType<import('../../types.js').VjsfCheckboxGroupNode> */
4
+ type: import('vue').PropType<import('../../types.js').VjsfCheckboxGroupNode>;
5
+ required: true;
6
+ };
7
+ statefulLayout: {
8
+ /** @type import('vue').PropType<import('../../types.js').VjsfStatefulLayout> */
9
+ type: import('vue').PropType<import('../../types.js').VjsfStatefulLayout>;
10
+ required: true;
11
+ };
12
+ }, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
13
+ [key: string]: any;
14
+ }>, any, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
15
+ modelValue: {
16
+ /** @type import('vue').PropType<import('../../types.js').VjsfCheckboxGroupNode> */
17
+ type: import('vue').PropType<import('../../types.js').VjsfCheckboxGroupNode>;
18
+ required: true;
19
+ };
20
+ statefulLayout: {
21
+ /** @type import('vue').PropType<import('../../types.js').VjsfStatefulLayout> */
22
+ type: import('vue').PropType<import('../../types.js').VjsfStatefulLayout>;
23
+ required: true;
24
+ };
25
+ }>>, {}, {}>;
26
+ export default _default;
27
+ //# sourceMappingURL=switch-group.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch-group.vue.d.ts","sourceRoot":"","sources":["../../../src/components/nodes/switch-group.vue.js"],"names":[],"mappings":";;QAQI,mFAAmF;cAAzE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,qBAAqB,CAAC;;;;QAKhF,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC;;;;;;;QAL7E,mFAAmF;cAAzE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,qBAAqB,CAAC;;;;QAKhF,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @param {{modelValue: import('@json-layout/core').StateNode, statefulLayout: import('../types.js').VjsfStatefulLayout}} props
3
+ */
4
+ export default function _default(props: {
5
+ modelValue: import('@json-layout/core').StateNode;
6
+ statefulLayout: import('../types.js').VjsfStatefulLayout;
7
+ }): {
8
+ items: import("vue").Ref<import("../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItems>;
9
+ loading: import("vue").Ref<boolean>;
10
+ search: import("vue").Ref<string>;
11
+ prepareSelectedItem: (selectedItem: any, itemValue: any) => any;
12
+ };
13
+ //# sourceMappingURL=use-get-items.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-get-items.d.ts","sourceRoot":"","sources":["../../src/composables/use-get-items.js"],"names":[],"mappings":"AAEA;;GAEG;AACH,wCAFW;IAAC,UAAU,EAAE,OAAO,mBAAmB,EAAE,SAAS,CAAC;IAAC,cAAc,EAAE,OAAO,aAAa,EAAE,kBAAkB,CAAA;CAAC;;;;wCA0B3G,GAAG,aACH,GAAG;EAiBf"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-vjsf.d.ts","sourceRoot":"","sources":["../../src/composables/use-vjsf.js"],"names":[],"mappings":"AASA;IACE;;MAEE;gCADO,GAAG;IAGZ;;MAEE;4BADO,OAAO,aAAa,EAAE,kBAAkB;EAGlD;AAWM,gCARI,OAAO,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,cACzB,OAAO,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,WACtB,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,aAAa,EAAE,kBAAkB,GAAG,IAAI,CAAC,kBAClE,OAAO,MAAM,EAAE,OAAO,KAAK,EAAE,SAAS,CAAC,QACvC,GAAG;;;;EAuHb"}
1
+ {"version":3,"file":"use-vjsf.d.ts","sourceRoot":"","sources":["../../src/composables/use-vjsf.js"],"names":[],"mappings":"AASA;IACE;;MAEE;gCADO,GAAG;IAGZ;;MAEE;4BADO,OAAO,aAAa,EAAE,kBAAkB;EAGlD;AAWM,gCARI,OAAO,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,cACzB,OAAO,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,WACtB,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,aAAa,EAAE,kBAAkB,GAAG,IAAI,CAAC,kBAClE,OAAO,MAAM,EAAE,OAAO,KAAK,EAAE,SAAS,CAAC,QACvC,GAAG;;;;EAsHb"}
package/types/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Component } from 'vue';
2
2
  import { ComponentInfo } from '@json-layout/vocabulary';
3
- import { StatefulLayout, StatefulLayoutOptions, StateNode, CheckboxNode, ColorPickerNode, DatePickerNode, DateTimePickerNode, TabsNode, ExpansionPanelsNode, ListNode, NumberFieldNode, OneOfSelectNode, SectionNode, SelectNode, SliderNode, SwitchNode, TextFieldNode, TextareaNode, VerticalTabsNode, StepperNode, ComboboxNode, FileInputNode, CompileOptions } from '@json-layout/core';
3
+ import { StatefulLayout, StatefulLayoutOptions, StateNode, CheckboxNode, ColorPickerNode, DatePickerNode, DateTimePickerNode, TabsNode, ExpansionPanelsNode, ListNode, NumberFieldNode, OneOfSelectNode, SectionNode, SelectNode, RadioGroupNode, CheckboxGroupNode, SwitchGroupNode, SliderNode, SwitchNode, TextFieldNode, TextareaNode, VerticalTabsNode, StepperNode, ComboboxNode, FileInputNode, CompileOptions } from '@json-layout/core';
4
4
  export type Density = 'default' | 'comfortable' | 'compact';
5
5
  export type Plugin = {
6
6
  info: ComponentInfo;
@@ -57,6 +57,15 @@ export type VjsfSectionNode = Omit<SectionNode, 'options'> & {
57
57
  export type VjsfSelectNode = Omit<SelectNode, 'options'> & {
58
58
  options: VjsfOptions;
59
59
  };
60
+ export type VjsfRadioGroupNode = Omit<RadioGroupNode, 'options'> & {
61
+ options: VjsfOptions;
62
+ };
63
+ export type VjsfCheckboxGroupNode = Omit<CheckboxGroupNode, 'options'> & {
64
+ options: VjsfOptions;
65
+ };
66
+ export type VjsfSwitchGroupNode = Omit<SwitchGroupNode, 'options'> & {
67
+ options: VjsfOptions;
68
+ };
60
69
  export type VjsfSliderNode = Omit<SliderNode, 'options'> & {
61
70
  options: VjsfOptions;
62
71
  };
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAE/B,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAEvD,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,SAAS,EACT,YAAY,EACZ,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,QAAQ,EACR,mBAAmB,EACnB,QAAQ,EACR,eAAe,EACf,eAAe,EACf,WAAW,EACX,UAAU,EACV,UAAU,EACV,UAAU,EACV,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,aAAa,EACb,cAAc,E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