@koumoul/vjsf 3.15.1 → 3.15.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 +3 -3
- package/src/compat/v2.js +17 -1
- package/src/components/fragments/child-subtitle.vue +1 -1
- package/src/components/nodes/expansion-panels.vue +1 -1
- package/src/components/nodes/list.vue +2 -1
- package/src/components/nodes/one-of-select.vue +1 -1
- package/src/components/nodes/stepper.vue +1 -1
- package/src/components/nodes/tabs.vue +1 -1
- package/src/components/nodes/vertical-tabs.vue +1 -1
- package/src/components/vjsf.vue +2 -1
- package/src/composables/use-vjsf.js +5 -3
- package/types/compat/v2.d.ts.map +1 -1
- package/types/components/fragments/child-subtitle.vue.d.ts +2 -2
- package/types/components/fragments/select-item.vue.d.ts +2 -2
- package/types/components/fragments/select-selection.vue.d.ts +2 -2
- package/types/components/tree.vue.d.ts +2 -2
- package/types/components/vjsf.vue.d.ts +2 -2
- package/types/composables/use-get-items.d.ts +1 -1
- package/types/composables/use-node.d.ts +3 -3
- package/types/composables/use-select-node.d.ts +1 -1
- package/types/composables/use-vjsf.d.ts +2 -2
- package/types/composables/use-vjsf.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koumoul/vjsf",
|
|
3
|
-
"version": "3.15.
|
|
3
|
+
"version": "3.15.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",
|
|
@@ -71,8 +71,8 @@
|
|
|
71
71
|
"vuetify": "^3.6.13"
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"@json-layout/core": "~1.10.
|
|
75
|
-
"@json-layout/vocabulary": "~2.3.
|
|
74
|
+
"@json-layout/core": "~1.10.4",
|
|
75
|
+
"@json-layout/vocabulary": "~2.3.3",
|
|
76
76
|
"@vueuse/core": "^12.5.0",
|
|
77
77
|
"debug": "^4.3.4"
|
|
78
78
|
},
|
package/src/compat/v2.js
CHANGED
|
@@ -96,7 +96,23 @@ const processFragment = (schema, getJSONRef, schemaId, processed) => {
|
|
|
96
96
|
if (display === 'checkbox' && schema.type !== 'boolean') display = 'checkbox-group'
|
|
97
97
|
if (display === 'switch' && schema.type !== 'boolean') display = 'switch-group'
|
|
98
98
|
if (display === 'hidden') display = 'none'
|
|
99
|
-
|
|
99
|
+
if (schema.allOf && schema.properties) {
|
|
100
|
+
const children = []
|
|
101
|
+
for (const key of Object.keys(schema.properties)) {
|
|
102
|
+
children.push(key)
|
|
103
|
+
}
|
|
104
|
+
const allOfChild = {
|
|
105
|
+
comp: display,
|
|
106
|
+
children: /** @type string[] */([])
|
|
107
|
+
}
|
|
108
|
+
for (let i = 0; i < schema.allOf.length; i++) {
|
|
109
|
+
allOfChild.children.push('$allOf-' + i)
|
|
110
|
+
}
|
|
111
|
+
children.push(allOfChild)
|
|
112
|
+
layout.children = children
|
|
113
|
+
} else {
|
|
114
|
+
layout.comp = display
|
|
115
|
+
}
|
|
100
116
|
delete schema['x-display']
|
|
101
117
|
}
|
|
102
118
|
|
|
@@ -3,7 +3,7 @@ import { toRef } from 'vue'
|
|
|
3
3
|
import { VExpansionPanels, VExpansionPanel, VExpansionPanelTitle, VExpansionPanelText } from 'vuetify/components/VExpansionPanel'
|
|
4
4
|
import { VContainer, VRow } from 'vuetify/components/VGrid'
|
|
5
5
|
import { VIcon } from 'vuetify/components/VIcon'
|
|
6
|
-
import { isSection } from '@json-layout/core'
|
|
6
|
+
import { isSection } from '@json-layout/core/state'
|
|
7
7
|
import Node from '../node.vue'
|
|
8
8
|
import SectionHeader from '../fragments/section-header.vue'
|
|
9
9
|
import ChildSubtitle from '../fragments/child-subtitle.vue'
|
|
@@ -10,7 +10,8 @@ import { VIcon } from 'vuetify/components/VIcon'
|
|
|
10
10
|
import { VBtn } from 'vuetify/components/VBtn'
|
|
11
11
|
import { VMenu } from 'vuetify/components/VMenu'
|
|
12
12
|
import { VForm } from 'vuetify/components/VForm'
|
|
13
|
-
import { isSection,
|
|
13
|
+
import { isSection, getRegexp } from '@json-layout/core/state'
|
|
14
|
+
import { clone } from '@json-layout/core/utils/clone'
|
|
14
15
|
import Node from '../node.vue'
|
|
15
16
|
import { moveDataItem } from '../../utils/arrays.js'
|
|
16
17
|
import useDnd from '../../composables/use-dnd.js'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { VRow, VCol } from 'vuetify/components/VGrid'
|
|
3
3
|
import { VSelect } from 'vuetify/components/VSelect'
|
|
4
4
|
import { ref, watch, computed, toRef } from 'vue'
|
|
5
|
-
import { isSection } from '@json-layout/core'
|
|
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
8
|
import Node from '../node.vue'
|
|
@@ -4,7 +4,7 @@ import { VStepper, VStepperHeader, VStepperItem, VStepperWindow, VStepperWindowI
|
|
|
4
4
|
import { VContainer, VRow, VSpacer } from 'vuetify/components/VGrid'
|
|
5
5
|
import { VBtn } from 'vuetify/components/VBtn'
|
|
6
6
|
import { VDivider } from 'vuetify/components/VDivider'
|
|
7
|
-
import { isSection } from '@json-layout/core'
|
|
7
|
+
import { isSection } from '@json-layout/core/state'
|
|
8
8
|
import Node from '../node.vue'
|
|
9
9
|
import SectionHeader from '../fragments/section-header.vue'
|
|
10
10
|
import ChildSubtitle from '../fragments/child-subtitle.vue'
|
|
@@ -6,7 +6,7 @@ import { VSheet } from 'vuetify/components/VSheet'
|
|
|
6
6
|
import { VWindow, VWindowItem } from 'vuetify/components/VWindow'
|
|
7
7
|
import { useDefaults } from 'vuetify'
|
|
8
8
|
import { ref } from 'vue'
|
|
9
|
-
import { isSection } from '@json-layout/core'
|
|
9
|
+
import { isSection } from '@json-layout/core/state'
|
|
10
10
|
import Node from '../node.vue'
|
|
11
11
|
import SectionHeader from '../fragments/section-header.vue'
|
|
12
12
|
import ChildSubtitle from '../fragments/child-subtitle.vue'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { isSection } from '@json-layout/core'
|
|
2
|
+
import { isSection } from '@json-layout/core/state'
|
|
3
3
|
import { VTabs, VTab } from 'vuetify/components/VTabs'
|
|
4
4
|
import { VContainer, VRow } from 'vuetify/components/VGrid'
|
|
5
5
|
import { VIcon } from 'vuetify/components/VIcon'
|
package/src/components/vjsf.vue
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed } from 'vue'
|
|
3
3
|
|
|
4
|
-
import { compile } from '@json-layout/core'
|
|
4
|
+
import { compile, produceCompileOptions } from '@json-layout/core/compile'
|
|
5
5
|
import Tree from './tree.vue'
|
|
6
6
|
import { useVjsf, emits } from '../composables/use-vjsf.js'
|
|
7
7
|
import '../styles/vjsf.css'
|
|
@@ -93,6 +93,7 @@ const { el, statefulLayout, stateTree } = useVjsf(
|
|
|
93
93
|
nodeComponents,
|
|
94
94
|
emit,
|
|
95
95
|
compile,
|
|
96
|
+
produceCompileOptions,
|
|
96
97
|
computed(() => props.precompiledLayout)
|
|
97
98
|
)
|
|
98
99
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useDefaults, useLocale } from 'vuetify'
|
|
2
|
-
import { StatefulLayout
|
|
2
|
+
import { StatefulLayout } from '@json-layout/core/state'
|
|
3
3
|
import { inject, toRaw, shallowRef, computed, ref, watch, useSlots, getCurrentInstance, nextTick } from 'vue'
|
|
4
4
|
import { useElementSize } from '@vueuse/core'
|
|
5
5
|
import { getFullOptions } from '../options.js'
|
|
@@ -28,10 +28,11 @@ export const emits = {
|
|
|
28
28
|
* @param {import('vue').Ref<import("../types.js").PartialVjsfOptions | null>} options
|
|
29
29
|
* @param {Record<string, import('vue').Component>} nodeComponents
|
|
30
30
|
* @param {any} emit
|
|
31
|
-
* @param {typeof import('@json-layout/core').compile} [compile]
|
|
31
|
+
* @param {typeof import('@json-layout/core/compile').compile} [compile]
|
|
32
|
+
* @param {typeof import('@json-layout/core/compile').produceCompileOptions} [produceCompileOptions]
|
|
32
33
|
* @param {import('vue').Ref<import('@json-layout/core').CompiledLayout>} [precompiledLayout]
|
|
33
34
|
*/
|
|
34
|
-
export const useVjsf = (schema, modelValue, options, nodeComponents, emit, compile, precompiledLayout) => {
|
|
35
|
+
export const useVjsf = (schema, modelValue, options, nodeComponents, emit, compile, produceCompileOptions, precompiledLayout) => {
|
|
35
36
|
const el = ref(null)
|
|
36
37
|
|
|
37
38
|
useDefaults({}, 'Vjsf')
|
|
@@ -114,6 +115,7 @@ export const useVjsf = (schema, modelValue, options, nodeComponents, emit, compi
|
|
|
114
115
|
const compileOptions = ref({})
|
|
115
116
|
watch(fullOptions, (newOptions) => {
|
|
116
117
|
if (precompiledLayout?.value) return
|
|
118
|
+
if (!produceCompileOptions) throw new Error('produceCompileOptions function is not available')
|
|
117
119
|
const newCompileOptions = produceCompileOptions(compileOptions.value, newOptions)
|
|
118
120
|
if (newCompileOptions !== compileOptions.value) {
|
|
119
121
|
debug('new compileOptions', newCompileOptions)
|
package/types/compat/v2.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v2.d.ts","sourceRoot":"","sources":["../../src/compat/v2.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"v2.d.ts","sourceRoot":"","sources":["../../src/compat/v2.js"],"names":[],"mappings":"AA4NA;;;;;;GAMG;AACH,kCALW,MAAM,2CAEN,MAAM,0BAoBhB;sBApPqB,KAAK"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<{}, {
|
|
2
|
-
modelValue: import("
|
|
2
|
+
modelValue: import("../../../../node_modules/@json-layout/core/types/state/types.js").StateNode;
|
|
3
3
|
$props: {
|
|
4
|
-
modelValue?: import("
|
|
4
|
+
modelValue?: import("../../../../node_modules/@json-layout/core/types/state/types.js").StateNode | undefined;
|
|
5
5
|
};
|
|
6
6
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
7
7
|
export default _default;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<{}, {
|
|
2
2
|
multiple: boolean;
|
|
3
|
-
item: import("
|
|
3
|
+
item: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem;
|
|
4
4
|
avatarProps: Record<string, any>;
|
|
5
5
|
itemProps: Record<string, any>;
|
|
6
6
|
$props: {
|
|
7
7
|
readonly multiple?: boolean | undefined;
|
|
8
|
-
readonly item?: import("
|
|
8
|
+
readonly item?: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem | undefined;
|
|
9
9
|
readonly avatarProps?: Record<string, any> | undefined;
|
|
10
10
|
readonly itemProps?: Record<string, any> | undefined;
|
|
11
11
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<{}, {
|
|
2
2
|
multiple: boolean;
|
|
3
|
-
item: import("
|
|
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
6
|
$props: {
|
|
7
7
|
readonly multiple?: boolean | undefined;
|
|
8
|
-
readonly item?: import("
|
|
8
|
+
readonly item?: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem | undefined;
|
|
9
9
|
readonly avatarProps?: Record<string, any> | undefined;
|
|
10
10
|
readonly last?: boolean | undefined;
|
|
11
11
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<{}, {
|
|
2
|
-
modelValue: import("
|
|
2
|
+
modelValue: import("../../../node_modules/@json-layout/core/types/state/types.js").StateTree;
|
|
3
3
|
statefulLayout: import("../types.js").VjsfStatefulLayout;
|
|
4
4
|
$props: {
|
|
5
|
-
readonly modelValue?: import("
|
|
5
|
+
readonly modelValue?: import("../../../node_modules/@json-layout/core/types/state/types.js").StateTree | undefined;
|
|
6
6
|
readonly statefulLayout?: import("../types.js").VjsfStatefulLayout | undefined;
|
|
7
7
|
};
|
|
8
8
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -3,12 +3,12 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
3
3
|
options: import("../types.js").PartialVjsfOptions | null;
|
|
4
4
|
modelValue: any;
|
|
5
5
|
schema: Record<string, any>;
|
|
6
|
-
precompiledLayout: import("
|
|
6
|
+
precompiledLayout: import("../../../node_modules/@json-layout/core/types/compile/types.js").CompiledLayout;
|
|
7
7
|
$props: {
|
|
8
8
|
readonly options?: import("../types.js").PartialVjsfOptions | null | undefined;
|
|
9
9
|
readonly modelValue?: any;
|
|
10
10
|
readonly schema?: Record<string, any> | undefined;
|
|
11
|
-
readonly precompiledLayout?: import("
|
|
11
|
+
readonly precompiledLayout?: import("../../../node_modules/@json-layout/core/types/compile/types.js").CompiledLayout | undefined;
|
|
12
12
|
};
|
|
13
13
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
14
14
|
export default _default;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export default function _default(nodeRef: import('vue').Ref<import('../types.js').VjsfNode>, statefulLayout: import('../types.js').VjsfStatefulLayout): {
|
|
6
6
|
hasItems: import("vue").ComputedRef<boolean>;
|
|
7
|
-
items: import("vue").Ref<import("
|
|
7
|
+
items: import("vue").Ref<import("../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItems, import("../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItems>;
|
|
8
8
|
loading: import("vue").Ref<boolean, boolean>;
|
|
9
9
|
search: import("vue").Ref<string, string>;
|
|
10
10
|
prepareSelectedItem: (selectedItem: any, itemValue: any) => any;
|
|
@@ -24,9 +24,9 @@ export default function _default(nodeRef: import('vue').Ref<import('../types.js'
|
|
|
24
24
|
}>;
|
|
25
25
|
compSlots: import("vue").ComputedRef<Record<string, any>>;
|
|
26
26
|
options: import("vue").ComputedRef<Required<import("../types.js").VjsfOptions>>;
|
|
27
|
-
skeleton: import("vue").ComputedRef<import("
|
|
28
|
-
layout: import("vue").ComputedRef<import("
|
|
27
|
+
skeleton: import("vue").ComputedRef<import("../../../node_modules/@json-layout/core/types/compile/types.js").SkeletonNode>;
|
|
28
|
+
layout: import("vue").ComputedRef<import("../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").BaseCompObject>;
|
|
29
29
|
data: import("vue").ComputedRef<unknown>;
|
|
30
|
-
children: import("vue").ComputedRef<import("
|
|
30
|
+
children: import("vue").ComputedRef<import("../../../node_modules/@json-layout/core/types/state/types.js").StateNode[] | undefined>;
|
|
31
31
|
};
|
|
32
32
|
//# sourceMappingURL=use-node.d.ts.map
|
|
@@ -19,7 +19,7 @@ export default function _default(nodeRef: import('vue').Ref<import('../types.js'
|
|
|
19
19
|
}>;
|
|
20
20
|
getItems: {
|
|
21
21
|
hasItems: import("vue").ComputedRef<boolean>;
|
|
22
|
-
items: import("vue").Ref<import("
|
|
22
|
+
items: import("vue").Ref<import("../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItems, import("../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItems>;
|
|
23
23
|
loading: import("vue").Ref<boolean, boolean>;
|
|
24
24
|
search: import("vue").Ref<string, string>;
|
|
25
25
|
prepareSelectedItem: (selectedItem: any, itemValue: any) => any;
|
|
@@ -8,9 +8,9 @@ export const emits: {
|
|
|
8
8
|
*/
|
|
9
9
|
'update:state': (state: import('../types.js').VjsfStatefulLayout) => boolean;
|
|
10
10
|
};
|
|
11
|
-
export function useVjsf(schema: import('vue').Ref<Object>, modelValue: import('vue').Ref<any>, options: import('vue').Ref<import("../types.js").PartialVjsfOptions | null>, nodeComponents: Record<string, import('vue').Component>, emit: any, compile?: typeof import("@json-layout/core").compile | undefined, precompiledLayout?: import("vue").Ref<import("
|
|
11
|
+
export function useVjsf(schema: import('vue').Ref<Object>, modelValue: import('vue').Ref<any>, options: import('vue').Ref<import("../types.js").PartialVjsfOptions | null>, nodeComponents: Record<string, import('vue').Component>, emit: any, compile?: typeof import("@json-layout/core").compile | undefined, produceCompileOptions?: ((draft: import("../../../node_modules/@json-layout/core/types/compile/types.js").PartialCompileOptions, newOptions: import("../../../node_modules/@json-layout/core/types/compile/types.js").PartialCompileOptions) => import("../../../node_modules/@json-layout/core/types/compile/types.js").PartialCompileOptions) | undefined, precompiledLayout?: import("vue").Ref<import("../../../node_modules/@json-layout/core/types/compile/types.js").CompiledLayout, import("../../../node_modules/@json-layout/core/types/compile/types.js").CompiledLayout> | undefined): {
|
|
12
12
|
el: import("vue").Ref<null, null>;
|
|
13
13
|
statefulLayout: import("vue").ShallowRef<import("../types.js").VjsfStatefulLayout | null, import("../types.js").VjsfStatefulLayout | null>;
|
|
14
|
-
stateTree: import("vue").ShallowRef<import("
|
|
14
|
+
stateTree: import("vue").ShallowRef<import("../../../node_modules/@json-layout/core/types/state/types.js").StateTree | null, import("../../../node_modules/@json-layout/core/types/state/types.js").StateTree | null>;
|
|
15
15
|
};
|
|
16
16
|
//# sourceMappingURL=use-vjsf.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-vjsf.d.ts","sourceRoot":"","sources":["../../src/composables/use-vjsf.js"],"names":[],"mappings":"AAaA;IACE;;MAEE;gCADO,GAAG;IAGZ;;MAEE;4BADO,OAAO,aAAa,EAAE,kBAAkB;EAGlD;
|
|
1
|
+
{"version":3,"file":"use-vjsf.d.ts","sourceRoot":"","sources":["../../src/composables/use-vjsf.js"],"names":[],"mappings":"AAaA;IACE;;MAEE;gCADO,GAAG;IAGZ;;MAEE;4BADO,OAAO,aAAa,EAAE,kBAAkB;EAGlD;AAYM,gCATI,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;;;;EAgJb"}
|