@koumoul/vjsf 3.0.0-alpha.1 → 3.0.0-alpha.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.
Files changed (41) hide show
  1. package/package.json +8 -8
  2. package/src/compat/v2.js +1 -4
  3. package/src/compile/index.js +1 -1
  4. package/src/compile/v-jsf-compiled.vue.ejs +14 -52
  5. package/src/components/nodes/combobox.vue +1 -1
  6. package/src/components/nodes/list.vue +171 -88
  7. package/src/components/nodes/markdown.vue +218 -5
  8. package/src/components/nodes/number-field.vue +1 -1
  9. package/src/components/nodes/stepper.vue +98 -0
  10. package/src/components/nodes/text-field.vue +1 -1
  11. package/src/components/nodes/textarea.vue +1 -1
  12. package/src/components/options.js +22 -1
  13. package/src/components/types.ts +4 -0
  14. package/src/components/vjsf.vue +21 -104
  15. package/src/composables/use-dnd.js +54 -0
  16. package/src/composables/use-vjsf.js +119 -0
  17. package/src/styles/vjsf.css +10 -0
  18. package/src/utils/arrays.js +15 -0
  19. package/src/utils/props.js +16 -5
  20. package/types/compat/v2.d.ts.map +1 -1
  21. package/types/components/fragments/select-item.vue.d.ts +2 -2
  22. package/types/components/fragments/select-selection.vue.d.ts +2 -2
  23. package/types/components/nodes/markdown.vue.d.ts.map +1 -1
  24. package/types/components/nodes/stepper.vue.d.ts +10 -0
  25. package/types/components/nodes/stepper.vue.d.ts.map +1 -0
  26. package/types/components/options.d.ts +1 -0
  27. package/types/components/options.d.ts.map +1 -1
  28. package/types/components/tree.vue.d.ts +2 -2
  29. package/types/components/types.d.ts +5 -1
  30. package/types/components/types.d.ts.map +1 -1
  31. package/types/components/vjsf.vue.d.ts +5 -6
  32. package/types/components/vjsf.vue.d.ts.map +1 -1
  33. package/types/composables/use-dnd.d.ts +21 -0
  34. package/types/composables/use-dnd.d.ts.map +1 -0
  35. package/types/composables/use-vjsf.d.ts +17 -0
  36. package/types/composables/use-vjsf.d.ts.map +1 -0
  37. package/types/utils/arrays.d.ts +9 -0
  38. package/types/utils/arrays.d.ts.map +1 -0
  39. package/types/utils/props.d.ts +4 -2
  40. package/types/utils/props.d.ts.map +1 -1
  41. package/src/utils/clone.js +0 -3
@@ -0,0 +1,119 @@
1
+ import { StatefulLayout } from '@json-layout/core'
2
+ import { inject, toRaw, shallowRef, computed, ref, watch, useSlots } from 'vue'
3
+ import { useElementSize } from '@vueuse/core'
4
+ import { getFullOptions } from '../components/options.js'
5
+
6
+ export const emits = {
7
+ /**
8
+ * @arg {any} data
9
+ */
10
+ 'update:modelValue': (data) => true,
11
+ /**
12
+ * @arg {StatefulLayout} state
13
+ */
14
+ 'update:state': (state) => true
15
+ }
16
+
17
+ /**
18
+ * @param {import('vue').Ref<Object>} schema
19
+ * @param {import('vue').Ref<any>} modelValue
20
+ * @param {import('vue').Ref<import("../components/types.js").PartialVjsfOptions>} options
21
+ * @param {any} emit
22
+ * @param {typeof import('@json-layout/core').compile} [compile]
23
+ * @param {import('vue').Ref<import('@json-layout/core').CompiledLayout>} [precompiledLayout]
24
+ */
25
+ export const useVjsf = (schema, modelValue, options, emit, compile, precompiledLayout) => {
26
+ const el = ref(null)
27
+ const { width } = useElementSize(el)
28
+
29
+ /** @type import('vue').ShallowRef<StatefulLayout | null> */
30
+ const statefulLayout = shallowRef(null)
31
+ /** @type import('vue').ShallowRef<import('@json-layout/core').StateTree | null> */
32
+ const stateTree = shallowRef(null)
33
+
34
+ // cf https://github.com/vuetifyjs/vuetify/blob/master/packages/vuetify/src/composables/form.ts
35
+ const form = inject(Symbol.for('vuetify:form'))
36
+ if (form) {
37
+ form.register({
38
+ id: 'vjsf', // TODO: a unique random id ?
39
+ validate: () => {
40
+ statefulLayout.value?.validate()
41
+ return statefulLayout.value?.errors
42
+ },
43
+ reset: () => statefulLayout.value?.resetValidation(), // TODO: also empty the data ?
44
+ resetValidation: () => statefulLayout.value?.resetValidation()
45
+ })
46
+ }
47
+
48
+ const slots = useSlots()
49
+
50
+ const fullOptions = computed(() => getFullOptions(options.value, form, width.value, slots))
51
+
52
+ const compiledLayout = computed(() => {
53
+ if (precompiledLayout?.value) return precompiledLayout?.value
54
+ if (!compile) throw new Error('compile function is not available')
55
+ const compiledLayout = compile(schema.value, fullOptions.value)
56
+ return compiledLayout
57
+ })
58
+
59
+ const onStatefulLayoutUpdate = () => {
60
+ if (!statefulLayout.value) return
61
+ stateTree.value = statefulLayout.value.stateTree
62
+ emit('update:modelValue', statefulLayout.value.data)
63
+ emit('update:state', statefulLayout.value)
64
+ if (form) {
65
+ // cf https://vuetifyjs.com/en/components/forms/#validation-state
66
+ if (statefulLayout.value.valid) form.update('vjsf', true, [])
67
+ else if (statefulLayout.value.hasHiddenError) form.update('vjsf', null, [])
68
+ else form.update('vjsf', false, [])
69
+ }
70
+ }
71
+
72
+ const initStatefulLayout = () => {
73
+ if (!width.value) return
74
+ const _statefulLayout = new StatefulLayout(
75
+ toRaw(compiledLayout.value),
76
+ toRaw(compiledLayout.value.skeletonTree),
77
+ toRaw(fullOptions.value),
78
+ toRaw(modelValue.value)
79
+ )
80
+ statefulLayout.value = _statefulLayout
81
+ onStatefulLayoutUpdate()
82
+ _statefulLayout.events.on('update', () => {
83
+ onStatefulLayoutUpdate()
84
+ })
85
+ emit('update:state', _statefulLayout)
86
+ _statefulLayout.events.on('autofocus', () => {
87
+ if (!el.value) return
88
+ // @ts-ignore
89
+ const autofocusNodeElement = el.value.querySelector('.vjsf-input--autofocus')
90
+ if (autofocusNodeElement) {
91
+ const autofocusInputElement = autofocusNodeElement.querySelector('input') ?? autofocusNodeElement.querySelector('textarea:not([style*="display: none"]')
92
+ if (autofocusInputElement) autofocusInputElement.focus()
93
+ }
94
+ })
95
+ }
96
+
97
+ watch(fullOptions, (newOptions) => {
98
+ // in case of runtime compilation the watch on compiledLayout will be triggered
99
+ if (!precompiledLayout) return
100
+
101
+ if (statefulLayout.value) {
102
+ statefulLayout.value.options = newOptions
103
+ } else {
104
+ initStatefulLayout()
105
+ }
106
+ })
107
+
108
+ // case where data is updated from outside
109
+ watch(modelValue, (newData) => {
110
+ if (statefulLayout.value && statefulLayout.value.data !== newData) statefulLayout.value.data = toRaw(newData)
111
+ })
112
+
113
+ // case where schema is updated from outside
114
+ watch(compiledLayout, (newCompiledLayout) => {
115
+ initStatefulLayout()
116
+ }, { immediate: true })
117
+
118
+ return { el, statefulLayout, stateTree }
119
+ }
@@ -0,0 +1,10 @@
1
+ /* override vuetify styles to manage readOnly fields more usable than the default disabled fields */
2
+ .vjsf-input--readonly.v-input--disabled.v-text-field .v-field--disabled input {
3
+ pointer-events: auto;
4
+ }
5
+ .vjsf-input--readonly.v-input--disabled .v-field--disabled,
6
+ .vjsf-input--readonly.v-input--disabled .v-input__details,
7
+ .vjsf-input--readonly.v-input--disabled .v-input__append,
8
+ .vjsf-input--readonly.v-input--disabled .v-input__prepend {
9
+ opacity: inherit;
10
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @template T
3
+ * @param {T[]} array
4
+ * @param {number} fromIndex
5
+ * @param {number} toIndex
6
+ * @return {T[]}
7
+ */
8
+ export function moveArrayItem (array, fromIndex, toIndex) {
9
+ if (fromIndex === toIndex || fromIndex === -1 || toIndex === -1) return array
10
+ const newArray = [...array]
11
+ const element = newArray[fromIndex]
12
+ newArray.splice(fromIndex, 1)
13
+ newArray.splice(toIndex, 0, element)
14
+ return newArray
15
+ }
@@ -3,15 +3,23 @@ import { camelize } from 'vue'
3
3
 
4
4
  /**
5
5
  * @param {(Record<string, any> | undefined)[]} propsLevels
6
- * @returns Record<string, any>
6
+ * @returns {Record<string, any> & {class: string[]}}
7
7
  */
8
8
  export function mergePropsLevels (propsLevels) {
9
- /** @type Record<string, any> */
10
- const fullProps = {}
9
+ /** @type {Record<string, any> & {class: string[]}} */
10
+ const fullProps = { class: [] }
11
11
  for (const propsLevel of propsLevels) {
12
12
  if (propsLevel) {
13
13
  for (const key of Object.keys(propsLevel)) {
14
- fullProps[camelize(key)] = propsLevel[key]
14
+ if (key === 'class') {
15
+ // a small convention for merging/overwriting classes:
16
+ // a class defined as a simple string overwrites the previous ones
17
+ // a class defined as an array is merged with the previous ones
18
+ if (Array.isArray(propsLevel.class)) fullProps.class = fullProps.class.concat(propsLevel.class)
19
+ else fullProps.class = [propsLevel.class]
20
+ } else {
21
+ fullProps[camelize(key)] = propsLevel[key]
22
+ }
15
23
  }
16
24
  }
17
25
  }
@@ -49,7 +57,10 @@ export function getInputProps (node, statefulLayout, layoutPropsMap, isMainComp
49
57
  fullProps.modelValue = node.data
50
58
  if (node.options.readOnly) {
51
59
  fullProps.disabled = true
52
- fullProps.class = 'vjsf-input--readonly'
60
+ fullProps.class.push('vjsf-input--readonly')
61
+ }
62
+ if (node.autofocus) {
63
+ fullProps.class.push('vjsf-input--autofocus')
53
64
  }
54
65
 
55
66
  if (layoutPropsMap) {
@@ -1 +1 @@
1
- {"version":3,"file":"v2.d.ts","sourceRoot":"","sources":["../../src/compat/v2.js"],"names":[],"mappings":"AAiGA;;;;;;GAMG;AACH,kCALW,MAAM,+CAEN,MAAM,0BAkBhB;sBAvHqB,KAAK"}
1
+ {"version":3,"file":"v2.d.ts","sourceRoot":"","sources":["../../src/compat/v2.js"],"names":[],"mappings":"AA8FA;;;;;;GAMG;AACH,kCALW,MAAM,+CAEN,MAAM,0BAkBhB;sBApHqB,KAAK"}
@@ -1,11 +1,11 @@
1
1
  declare const _default: import("vue").DefineComponent<{}, {
2
2
  multiple: boolean;
3
3
  itemProps: Record<string, any>;
4
- item: import("../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem;
4
+ item: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem;
5
5
  $props: {
6
6
  readonly multiple?: boolean | undefined;
7
7
  readonly itemProps?: Record<string, any> | undefined;
8
- readonly item?: import("../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem | 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").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
11
11
  export default _default;
@@ -1,10 +1,10 @@
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;
3
+ item: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem;
4
4
  last: boolean;
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;
7
+ readonly item?: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem | undefined;
8
8
  readonly last?: boolean | undefined;
9
9
  };
10
10
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
@@ -1 +1 @@
1
- {"version":3,"file":"markdown.vue.d.ts","sourceRoot":"","sources":["../../../src/components/nodes/markdown.vue.js"],"names":[],"mappings":";;QAUM,2EAA2E;cAAjE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,aAAa,EAAE,gBAAgB,CAAC;;;;QAKxE,+EAA+E;cAArE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,mBAAmB,EAAE,cAAc,CAAC;;;;;;;QAL5E,2EAA2E;cAAjE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,aAAa,EAAE,gBAAgB,CAAC;;;;QAKxE,+EAA+E;cAArE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,mBAAmB,EAAE,cAAc,CAAC"}
1
+ {"version":3,"file":"markdown.vue.d.ts","sourceRoot":"","sources":["../../../src/components/nodes/markdown.vue.js"],"names":[],"mappings":";;QAWM,2EAA2E;cAAjE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,aAAa,EAAE,gBAAgB,CAAC;;;;QAKxE,+EAA+E;cAArE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,mBAAmB,EAAE,cAAc,CAAC;;;;;;;QAL5E,2EAA2E;cAAjE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,aAAa,EAAE,gBAAgB,CAAC;;;;QAKxE,+EAA+E;cAArE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,mBAAmB,EAAE,cAAc,CAAC"}
@@ -0,0 +1,10 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {
2
+ modelValue: import("../types.js").VjsfStepperNode;
3
+ statefulLayout: import("@json-layout/core").StatefulLayout;
4
+ $props: {
5
+ readonly modelValue?: import("../types.js").VjsfStepperNode | undefined;
6
+ readonly statefulLayout?: import("@json-layout/core").StatefulLayout | undefined;
7
+ };
8
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
9
+ export default _default;
10
+ //# sourceMappingURL=stepper.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stepper.vue.d.ts","sourceRoot":"","sources":["../../../src/components/nodes/stepper.vue.js"],"names":[],"mappings":""}
@@ -1,3 +1,4 @@
1
1
  /** @type import("./types.js").PartialVjsfOptions */
2
2
  export const defaultOptions: import("./types.js").PartialVjsfOptions;
3
+ export function getFullOptions(options: Partial<import("./types.js").VjsfOptions>, form: any, width: number, slots: import("vue").Slots): import("./types.js").VjsfOptions;
3
4
  //# sourceMappingURL=options.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/components/options.js"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,6BADU,OAAO,YAAY,EAAE,kBAAkB,CAwBhD"}
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/components/options.js"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,6BADU,OAAO,YAAY,EAAE,kBAAkB,CAyBhD;AAUM,wCANI,QAAQ,OAAO,YAAY,EAAE,WAAW,CAAC,QACzC,GAAG,SACH,MAAM,SACN,OAAO,KAAK,EAAE,KAAK,oCAa7B"}
@@ -1,8 +1,8 @@
1
1
  declare const _default: import("vue").DefineComponent<{}, {
2
- modelValue: import("../../node_modules/@json-layout/core/types/state/types.js").StateTree;
2
+ modelValue: import("../../../node_modules/@json-layout/core/types/state/types.js").StateTree;
3
3
  statefulLayout: import("@json-layout/core").StatefulLayout;
4
4
  $props: {
5
- readonly modelValue?: import("../../node_modules/@json-layout/core/types/state/types.js").StateTree | undefined;
5
+ readonly modelValue?: import("../../../node_modules/@json-layout/core/types/state/types.js").StateTree | undefined;
6
6
  readonly statefulLayout?: import("@json-layout/core").StatefulLayout | undefined;
7
7
  };
8
8
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
@@ -1,4 +1,4 @@
1
- import { StatefulLayoutOptions, StateNode, CheckboxNode, ColorPickerNode, DatePickerNode, DateTimePickerNode, TabsNode, ExpansionPanelsNode, ListNode, NumberFieldNode, OneOfSelectNode, SectionNode, SelectNode, SliderNode, SwitchNode, TextFieldNode, TextareaNode, VerticalTabsNode, ComboboxNode, CompileOptions } from '@json-layout/core';
1
+ import { StatefulLayoutOptions, StateNode, CheckboxNode, ColorPickerNode, DatePickerNode, DateTimePickerNode, TabsNode, ExpansionPanelsNode, ListNode, NumberFieldNode, OneOfSelectNode, SectionNode, SelectNode, SliderNode, SwitchNode, TextFieldNode, TextareaNode, VerticalTabsNode, StepperNode, ComboboxNode, CompileOptions } from '@json-layout/core';
2
2
  export type Density = 'default' | 'comfortable' | 'compact';
3
3
  export type VjsfOptions = StatefulLayoutOptions & CompileOptions & {
4
4
  density: Density;
@@ -16,6 +16,7 @@ export type VjsfOptions = StatefulLayoutOptions & CompileOptions & {
16
16
  switchPropsReadOnly: Record<string, unknown>;
17
17
  errorAlertProps: Record<string, unknown>;
18
18
  vjsfSlots: Record<string, () => unknown>;
19
+ easyMDEOptions: Record<string, unknown>;
19
20
  };
20
21
  export type PartialVjsfOptions = Partial<Omit<VjsfOptions, 'width'>>;
21
22
  export type VjsfNode = Omit<StateNode, 'options'> & {
@@ -69,6 +70,9 @@ export type VjsfTextareaNode = Omit<TextareaNode, 'options'> & {
69
70
  export type VjsfVerticalTabsNode = Omit<VerticalTabsNode, 'options'> & {
70
71
  options: VjsfOptions;
71
72
  };
73
+ export type VjsfStepperNode = Omit<StepperNode, 'options'> & {
74
+ options: VjsfOptions;
75
+ };
72
76
  export type VjsfComboboxNode = Omit<ComboboxNode, 'options'> & {
73
77
  options: VjsfOptions;
74
78
  };
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/components/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,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,YAAY,EACZ,cAAc,EACf,MAAM,mBAAmB,CAAA;AAE1B,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAAA;AAE3D,MAAM,MAAM,WAAW,GAAG,qBAAqB,GAAG,cAAc,GAAG;IACjE,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC,MAAM,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EAAE,SAAS,CAAC,GAAG;IAAC,OAAO,EAAE,WAAW,CAAA;CAAC,CAAA;AACjF,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,GAAG;IAAC,OAAO,EAAE,WAAW,CAAA;CAAC,CAAA;AACvF,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,GAAG;IAAC,OAAO,EAAE,WAAW,CAAA;CAAC,CAAA;AACrF,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC,GAAG;IAAC,OAAO,EAAE,WAAW,CAAA;CAAC,CAAA;AAC7F,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,GAAG;IAAC,OAAO,EAAE,WAAW,CAAA;CAAC,CAAA;AAEnF,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,GAAG;IAAC,OAAO,EAAE,WAAW,CAAA;CAAC,CAAA"}
@@ -1,16 +1,15 @@
1
1
  declare const _default: import("vue").DefineComponent<{}, {
2
- $emit: ((event: "update:modelValue", data: any) => void) & ((event: "update:state", state: StatefulLayout) => void);
2
+ $emit: ((event: "update:modelValue", data: any) => void) & ((event: "update:state", state: import("@json-layout/core").StatefulLayout) => void);
3
3
  options: Partial<Omit<import("./types.js").VjsfOptions, "width">>;
4
- modelValue: string | number | boolean | Record<string, any>;
4
+ modelValue: any;
5
5
  schema: Record<string, any>;
6
- precompiledLayout: import("../../node_modules/@json-layout/core/types/compile/types.js").CompiledLayout;
6
+ precompiledLayout: import("../../../node_modules/@json-layout/core/types/compile/types.js").CompiledLayout;
7
7
  $props: {
8
8
  readonly options?: Partial<Omit<import("./types.js").VjsfOptions, "width">> | undefined;
9
- readonly modelValue?: string | number | boolean | Record<string, any> | undefined;
9
+ readonly modelValue?: any;
10
10
  readonly schema?: Record<string, any> | undefined;
11
- readonly precompiledLayout?: import("../../node_modules/@json-layout/core/types/compile/types.js").CompiledLayout | undefined;
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").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
14
14
  export default _default;
15
- import { StatefulLayout } from '@json-layout/core';
16
15
  //# sourceMappingURL=vjsf.vue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vjsf.vue.d.ts","sourceRoot":"","sources":["../../src/components/vjsf.vue.js"],"names":[],"mappings":";;;;;;;;;;;;;;+BAIwC,mBAAmB"}
1
+ {"version":3,"file":"vjsf.vue.d.ts","sourceRoot":"","sources":["../../src/components/vjsf.vue.js"],"names":[],"mappings":""}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @template T
3
+ * @param {T[]} array
4
+ * @param {() => void} callback
5
+ * @returns
6
+ */
7
+ export default function useDnd<T>(array: T[], callback: () => void): {
8
+ activeDnd: import("vue").ComputedRef<boolean>;
9
+ sortableArray: import("vue").ShallowRef<T[]>;
10
+ draggable: import("vue").Ref<number>;
11
+ itemBind: (itemIndex: number) => {
12
+ onDragstart: () => void;
13
+ onDragover: () => void;
14
+ onDragend: () => void;
15
+ };
16
+ handleBind: (itemIndex: number) => {
17
+ onMouseover(): void;
18
+ onMouseout(): void;
19
+ };
20
+ };
21
+ //# sourceMappingURL=use-dnd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-dnd.d.ts","sourceRoot":"","sources":["../../src/composables/use-dnd.js"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wDAHW,MAAM,IAAI;;;;0BAiBU,MAAM;;;;;4BAcJ,MAAM;;;;EAgBtC"}
@@ -0,0 +1,17 @@
1
+ export const emits: {
2
+ /**
3
+ * @arg {any} data
4
+ */
5
+ 'update:modelValue': (data: any) => boolean;
6
+ /**
7
+ * @arg {StatefulLayout} state
8
+ */
9
+ 'update:state': (state: StatefulLayout) => boolean;
10
+ };
11
+ export function useVjsf(schema: import('vue').Ref<Object>, modelValue: import('vue').Ref<any>, options: import('vue').Ref<import("../components/types.js").PartialVjsfOptions>, emit: any, compile?: typeof import("@json-layout/core").compile | undefined, precompiledLayout?: import("vue").Ref<import("../../../node_modules/@json-layout/core/types/compile/types.js").CompiledLayout> | undefined): {
12
+ el: import("vue").Ref<null>;
13
+ statefulLayout: import("vue").ShallowRef<StatefulLayout | null>;
14
+ stateTree: import("vue").ShallowRef<import("../../../node_modules/@json-layout/core/types/state/types.js").StateTree | null>;
15
+ };
16
+ import { StatefulLayout } from '@json-layout/core';
17
+ //# sourceMappingURL=use-vjsf.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-vjsf.d.ts","sourceRoot":"","sources":["../../src/composables/use-vjsf.js"],"names":[],"mappings":"AAKA;IACE;;MAEE;gCADO,GAAG;IAGZ;;MAEE;4BADO,cAAc;EAGxB;AAUM,gCAPI,OAAO,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,cACzB,OAAO,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,WACtB,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,wBAAwB,EAAE,kBAAkB,CAAC,QACtE,GAAG;;;;EAkGb;+BAtH8B,mBAAmB"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @template T
3
+ * @param {T[]} array
4
+ * @param {number} fromIndex
5
+ * @param {number} toIndex
6
+ * @return {T[]}
7
+ */
8
+ export function moveArrayItem<T>(array: T[], fromIndex: number, toIndex: number): T[];
9
+ //# sourceMappingURL=arrays.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arrays.d.ts","sourceRoot":"","sources":["../../src/utils/arrays.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wDAJW,MAAM,WACN,MAAM,OAUhB"}
@@ -1,8 +1,10 @@
1
1
  /**
2
2
  * @param {(Record<string, any> | undefined)[]} propsLevels
3
- * @returns Record<string, any>
3
+ * @returns {Record<string, any> & {class: string[]}}
4
4
  */
5
- export function mergePropsLevels(propsLevels: (Record<string, any> | undefined)[]): Record<string, any>;
5
+ export function mergePropsLevels(propsLevels: (Record<string, any> | undefined)[]): Record<string, any> & {
6
+ class: string[];
7
+ };
6
8
  /**
7
9
  * @param {import('@json-layout/core').StateNode} node
8
10
  * @param {import('@json-layout/core').StatefulLayout} statefulLayout
@@ -1 +1 @@
1
- {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/utils/props.js"],"names":[],"mappings":"AAGA;;;GAGG;AACH,8CAHW,CAAC,OAAO,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC,EAAE,uBAc7C;AAID;;;;;;GAMG;AACH,oCANW,OAAO,mBAAmB,EAAE,SAAS,kBACrC,OAAO,mBAAmB,EAAE,cAAc,2EAE1C,OAAO,GACL,OAAO,MAAM,EAAE,GAAG,CAAC,CAwC/B;AAGD;;;;;GAKG;AACH,mCALW,OAAO,mBAAmB,EAAE,SAAS,QACrC,MAAM,eACN,OAAO,GACL,OAAO,MAAM,EAAE,GAAG,CAAC,CAY/B"}
1
+ {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/utils/props.js"],"names":[],"mappings":"AAGA;;;GAGG;AACH,8CAHW,CAAC,OAAO,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC,EAAE,GACjC,OAAO,MAAM,EAAE,GAAG,CAAC,GAAG;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAC,CAqBnD;AAID;;;;;;GAMG;AACH,oCANW,OAAO,mBAAmB,EAAE,SAAS,kBACrC,OAAO,mBAAmB,EAAE,cAAc,2EAE1C,OAAO,GACL,OAAO,MAAM,EAAE,GAAG,CAAC,CA2C/B;AAGD;;;;;GAKG;AACH,mCALW,OAAO,mBAAmB,EAAE,SAAS,QACrC,MAAM,eACN,OAAO,GACL,OAAO,MAAM,EAAE,GAAG,CAAC,CAY/B"}
@@ -1,3 +0,0 @@
1
- import rfdc from 'rfdc'
2
-
3
- export default rfdc()