@koumoul/vjsf 3.0.0-beta.44 → 3.0.0-beta.46
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 +9 -15
- package/src/components/fragments/selection-group.vue +11 -10
- package/src/components/fragments/text-field-menu.vue +10 -6
- package/src/components/nodes/autocomplete.vue +6 -6
- package/src/components/nodes/checkbox.vue +29 -27
- package/src/components/nodes/color-picker.vue +6 -4
- package/src/components/nodes/combobox.vue +14 -40
- package/src/components/nodes/date-picker.vue +14 -6
- package/src/components/nodes/date-time-picker.vue +14 -11
- package/src/components/nodes/expansion-panels.vue +6 -3
- package/src/components/nodes/file-input.vue +11 -10
- package/src/components/nodes/list.vue +22 -16
- package/src/components/nodes/number-combobox.vue +16 -40
- package/src/components/nodes/number-field.vue +13 -10
- package/src/components/nodes/one-of-select.vue +14 -10
- package/src/components/nodes/radio-group.vue +8 -5
- package/src/components/nodes/select.vue +8 -8
- package/src/components/nodes/slider.vue +30 -30
- package/src/components/nodes/switch.vue +29 -27
- package/src/components/nodes/text-field.vue +6 -6
- package/src/components/nodes/textarea.vue +16 -11
- package/src/components/nodes/time-picker.vue +9 -6
- package/src/composables/use-dnd.js +1 -1
- package/src/composables/use-get-items.js +12 -7
- package/src/composables/use-node.js +136 -0
- package/src/composables/use-select-node.js +67 -0
- package/src/composables/use-vjsf.js +3 -2
- package/src/types.ts +1 -1
- package/types/components/fragments/child-subtitle.vue.d.ts +2 -2
- package/types/components/fragments/help-message.vue.d.ts +2 -2
- package/types/components/fragments/node-slot.vue.d.ts +2 -44
- package/types/components/fragments/node-slot.vue.d.ts.map +1 -1
- package/types/components/fragments/section-header.vue.d.ts +2 -2
- package/types/components/fragments/select-item-icon.vue.d.ts +2 -12
- 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/fragments/selection-group.vue.d.ts +2 -32
- package/types/components/fragments/selection-group.vue.d.ts.map +1 -1
- package/types/components/fragments/text-field-menu.vue.d.ts +2 -2
- package/types/components/fragments/text-field-menu.vue.d.ts.map +1 -1
- package/types/components/node.vue.d.ts +2 -2
- package/types/components/nodes/autocomplete.vue.d.ts +2 -24
- package/types/components/nodes/autocomplete.vue.d.ts.map +1 -1
- package/types/components/nodes/card.vue.d.ts +2 -2
- package/types/components/nodes/checkbox-group.vue.d.ts +2 -24
- package/types/components/nodes/checkbox-group.vue.d.ts.map +1 -1
- package/types/components/nodes/checkbox.vue.d.ts +3 -8
- package/types/components/nodes/color-picker.vue.d.ts +2 -2
- package/types/components/nodes/combobox.vue.d.ts +2 -24
- package/types/components/nodes/combobox.vue.d.ts.map +1 -1
- package/types/components/nodes/date-picker.vue.d.ts +2 -2
- package/types/components/nodes/date-time-picker.vue.d.ts +2 -2
- package/types/components/nodes/expansion-panels.vue.d.ts +2 -2
- package/types/components/nodes/file-input.vue.d.ts +2 -24
- package/types/components/nodes/file-input.vue.d.ts.map +1 -1
- package/types/components/nodes/list.vue.d.ts +2 -2
- package/types/components/nodes/number-combobox.vue.d.ts +2 -24
- package/types/components/nodes/number-combobox.vue.d.ts.map +1 -1
- package/types/components/nodes/number-field.vue.d.ts +2 -24
- package/types/components/nodes/number-field.vue.d.ts.map +1 -1
- package/types/components/nodes/one-of-select.vue.d.ts +2 -2
- package/types/components/nodes/radio-group.vue.d.ts +2 -24
- package/types/components/nodes/radio-group.vue.d.ts.map +1 -1
- package/types/components/nodes/section.vue.d.ts +2 -2
- package/types/components/nodes/select.vue.d.ts +2 -24
- package/types/components/nodes/select.vue.d.ts.map +1 -1
- package/types/components/nodes/slider.vue.d.ts +3 -8
- package/types/components/nodes/stepper.vue.d.ts +2 -2
- package/types/components/nodes/switch-group.vue.d.ts +2 -24
- package/types/components/nodes/switch-group.vue.d.ts.map +1 -1
- package/types/components/nodes/switch.vue.d.ts +3 -8
- package/types/components/nodes/tabs.vue.d.ts +2 -2
- package/types/components/nodes/text-field.vue.d.ts +2 -24
- package/types/components/nodes/text-field.vue.d.ts.map +1 -1
- package/types/components/nodes/textarea.vue.d.ts +2 -24
- package/types/components/nodes/textarea.vue.d.ts.map +1 -1
- package/types/components/nodes/time-picker.vue.d.ts +2 -2
- package/types/components/nodes/vertical-tabs.vue.d.ts +2 -2
- package/types/components/tree.vue.d.ts +2 -2
- package/types/components/vjsf.vue.d.ts +4 -4
- package/types/composables/use-dnd.d.ts +3 -3
- package/types/composables/use-field-props.d.ts +30 -0
- package/types/composables/use-field-props.d.ts.map +1 -0
- package/types/composables/use-field.d.ts +31 -0
- package/types/composables/use-field.d.ts.map +1 -0
- package/types/composables/use-get-items.d.ts +7 -8
- package/types/composables/use-get-items.d.ts.map +1 -1
- package/types/composables/use-node.d.ts +32 -0
- package/types/composables/use-node.d.ts.map +1 -0
- package/types/composables/use-select-field.d.ts +21 -0
- package/types/composables/use-select-field.d.ts.map +1 -0
- package/types/composables/use-select-node.d.ts +27 -0
- package/types/composables/use-select-node.d.ts.map +1 -0
- package/types/composables/use-select-props.d.ts +21 -0
- package/types/composables/use-select-props.d.ts.map +1 -0
- package/types/composables/use-select.d.ts +21 -0
- package/types/composables/use-select.d.ts.map +1 -0
- package/types/composables/use-vjsf.d.ts +2 -2
- package/types/composables/use-vjsf.d.ts.map +1 -1
- package/types/utils/index.d.ts +0 -2
- package/src/utils/index.js +0 -4
- package/src/utils/props.js +0 -136
- package/src/utils/slots.js +0 -46
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {(Record<string, any> | undefined)[]} propsLevels
|
|
3
|
+
* @returns {Record<string, any> & {class: string[]}}
|
|
4
|
+
*/
|
|
5
|
+
export function mergePropsLevels(propsLevels: (Record<string, any> | undefined)[]): Record<string, any> & {
|
|
6
|
+
class: string[];
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* @param {import('vue').Ref<import('../types.js').VjsfNode>} nodeRef
|
|
10
|
+
* @param {import('../types.js').VjsfStatefulLayout} statefulLayout
|
|
11
|
+
* @param {{isMainComp?: boolean, bindData?: boolean, layoutPropsMap?: (string | [string, string])[]}} [opts]
|
|
12
|
+
*/
|
|
13
|
+
export default function _default(nodeRef: import('vue').Ref<import('../types.js').VjsfNode>, statefulLayout: import('../types.js').VjsfStatefulLayout, opts?: {
|
|
14
|
+
isMainComp?: boolean | undefined;
|
|
15
|
+
bindData?: boolean | undefined;
|
|
16
|
+
layoutPropsMap?: (string | [string, string])[] | undefined;
|
|
17
|
+
} | undefined): {
|
|
18
|
+
localData: import("vue").Ref<any, any>;
|
|
19
|
+
inputProps: import("vue").ComputedRef<Record<string, any> & {
|
|
20
|
+
class: string[];
|
|
21
|
+
}>;
|
|
22
|
+
compProps: import("vue").ComputedRef<Record<string, any> & {
|
|
23
|
+
class: string[];
|
|
24
|
+
}>;
|
|
25
|
+
compSlots: import("vue").ComputedRef<Record<string, any>>;
|
|
26
|
+
options: import("vue").ComputedRef<import("../types.js").VjsfOptions>;
|
|
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
|
+
data: import("vue").ComputedRef<unknown>;
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=use-field.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-field.d.ts","sourceRoot":"","sources":["../../src/composables/use-field.js"],"names":[],"mappings":"AAcA;;;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;AAED;;;;GAIG;AACH,0CAJW,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,aAAa,EAAE,QAAQ,CAAC,kBACjD,OAAO,aAAa,EAAE,kBAAkB;;;;;;;eAzBR,MAAM,EAAE;;;eAAR,MAAM,EAAE;;;;;;;EAsHlD"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @param {
|
|
2
|
+
* @param {import('vue').Ref<import('../types.js').VjsfNode>} nodeRef
|
|
3
|
+
* @param {import('../types.js').VjsfStatefulLayout} statefulLayout
|
|
3
4
|
*/
|
|
4
|
-
export default function _default(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
loading: import("vue").Ref<boolean>;
|
|
10
|
-
search: import("vue").Ref<string>;
|
|
5
|
+
export default function _default(nodeRef: import('vue').Ref<import('../types.js').VjsfNode>, statefulLayout: import('../types.js').VjsfStatefulLayout): {
|
|
6
|
+
hasItems: import("vue").ComputedRef<boolean>;
|
|
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
|
+
loading: import("vue").Ref<boolean, boolean>;
|
|
9
|
+
search: import("vue").Ref<string, string>;
|
|
11
10
|
prepareSelectedItem: (selectedItem: any, itemValue: any) => any;
|
|
12
11
|
};
|
|
13
12
|
//# sourceMappingURL=use-get-items.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-get-items.d.ts","sourceRoot":"","sources":["../../src/composables/use-get-items.js"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"use-get-items.d.ts","sourceRoot":"","sources":["../../src/composables/use-get-items.js"],"names":[],"mappings":"AAEA;;;GAGG;AACH,0CAHW,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,aAAa,EAAE,QAAQ,CAAC,kBACjD,OAAO,aAAa,EAAE,kBAAkB;;;;;wCA8BtC,GAAG,aACH,GAAG;EAiBf"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {(Record<string, any> | undefined)[]} propsLevels
|
|
3
|
+
* @returns {Record<string, any> & {class: string[]}}
|
|
4
|
+
*/
|
|
5
|
+
export function mergePropsLevels(propsLevels: (Record<string, any> | undefined)[]): Record<string, any> & {
|
|
6
|
+
class: string[];
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* @param {import('vue').Ref<import('../types.js').VjsfNode>} nodeRef
|
|
10
|
+
* @param {import('../types.js').VjsfStatefulLayout} statefulLayout
|
|
11
|
+
* @param {{isMainComp?: boolean, bindData?: boolean, layoutPropsMap?: (string | [string, string])[]}} [opts]
|
|
12
|
+
*/
|
|
13
|
+
export default function _default(nodeRef: import('vue').Ref<import('../types.js').VjsfNode>, statefulLayout: import('../types.js').VjsfStatefulLayout, opts?: {
|
|
14
|
+
isMainComp?: boolean | undefined;
|
|
15
|
+
bindData?: boolean | undefined;
|
|
16
|
+
layoutPropsMap?: (string | [string, string])[] | undefined;
|
|
17
|
+
} | undefined): {
|
|
18
|
+
localData: import("vue").Ref<any, any>;
|
|
19
|
+
inputProps: import("vue").ComputedRef<Record<string, any> & {
|
|
20
|
+
class: string[];
|
|
21
|
+
}>;
|
|
22
|
+
compProps: import("vue").ComputedRef<Record<string, any> & {
|
|
23
|
+
class: string[];
|
|
24
|
+
}>;
|
|
25
|
+
compSlots: import("vue").ComputedRef<Record<string, any>>;
|
|
26
|
+
options: import("vue").ComputedRef<import("../types.js").VjsfOptions>;
|
|
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
|
+
data: import("vue").ComputedRef<unknown>;
|
|
30
|
+
children: import("vue").ComputedRef<import("../../../node_modules/@json-layout/core/types/state/types.js").StateNode[] | undefined>;
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=use-node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-node.d.ts","sourceRoot":"","sources":["../../src/composables/use-node.js"],"names":[],"mappings":"AAcA;;;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;AAED;;;;GAIG;AACH,0CAJW,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,aAAa,EAAE,QAAQ,CAAC,kBACjD,OAAO,aAAa,EAAE,kBAAkB;;;;;;;eAzBR,MAAM,EAAE;;;eAAR,MAAM,EAAE;;;;;;;;EAuHlD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* specialized use of useFieldProps shared between select and autocomplete components
|
|
3
|
+
* @param {import('vue').Ref<import('../types.js').VjsfSelectNode>} nodeRef
|
|
4
|
+
* @param {import('../types.js').VjsfStatefulLayout} statefulLayout
|
|
5
|
+
*/
|
|
6
|
+
export default function _default(nodeRef: import('vue').Ref<import('../types.js').VjsfSelectNode>, statefulLayout: import('../types.js').VjsfStatefulLayout): {
|
|
7
|
+
localData: import("vue").Ref<any, any>;
|
|
8
|
+
inputProps: import("vue").ComputedRef<Record<string, any> & {
|
|
9
|
+
class: string[];
|
|
10
|
+
}>;
|
|
11
|
+
selectProps: import("vue").ComputedRef<Record<string, any>>;
|
|
12
|
+
compSlots: import("vue").ComputedRef<Record<string, any>>;
|
|
13
|
+
selectSlots: import("vue").ComputedRef<Record<string, any>>;
|
|
14
|
+
getItems: {
|
|
15
|
+
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>;
|
|
16
|
+
loading: import("vue").Ref<boolean, boolean>;
|
|
17
|
+
search: import("vue").Ref<string, string>;
|
|
18
|
+
prepareSelectedItem: (selectedItem: any, itemValue: any) => any;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=use-select-field.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-select-field.d.ts","sourceRoot":"","sources":["../../src/composables/use-select-field.js"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,0CAHW,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,aAAa,EAAE,cAAc,CAAC,kBACvD,OAAO,aAAa,EAAE,kBAAkB;;;;;;;;;;;;;;EA2DlD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* specialized use of useFieldProps shared between select and autocomplete components
|
|
3
|
+
* @param {import('vue').Ref<import('../types.js').VjsfSelectNode>} nodeRef
|
|
4
|
+
* @param {import('../types.js').VjsfStatefulLayout} statefulLayout
|
|
5
|
+
*/
|
|
6
|
+
export default function _default(nodeRef: import('vue').Ref<import('../types.js').VjsfSelectNode>, statefulLayout: import('../types.js').VjsfStatefulLayout): {
|
|
7
|
+
localData: import("vue").Ref<any, any>;
|
|
8
|
+
inputProps: import("vue").ComputedRef<Record<string, any> & {
|
|
9
|
+
class: string[];
|
|
10
|
+
}>;
|
|
11
|
+
selectProps: import("vue").ComputedRef<{
|
|
12
|
+
[x: string]: any;
|
|
13
|
+
class: string[];
|
|
14
|
+
}>;
|
|
15
|
+
compSlots: import("vue").ComputedRef<Record<string, any>>;
|
|
16
|
+
selectSlots: import("vue").ComputedRef<{
|
|
17
|
+
[x: string]: any;
|
|
18
|
+
}>;
|
|
19
|
+
getItems: {
|
|
20
|
+
hasItems: import("vue").ComputedRef<boolean>;
|
|
21
|
+
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>;
|
|
22
|
+
loading: import("vue").Ref<boolean, boolean>;
|
|
23
|
+
search: import("vue").Ref<string, string>;
|
|
24
|
+
prepareSelectedItem: (selectedItem: any, itemValue: any) => any;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=use-select-node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-select-node.d.ts","sourceRoot":"","sources":["../../src/composables/use-select-node.js"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,0CAHW,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,aAAa,EAAE,cAAc,CAAC,kBACvD,OAAO,aAAa,EAAE,kBAAkB;;;;;;;;;;;;;;;;;;;;EAyDlD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* specialized use of useFieldProps shared between select and autocomplete components
|
|
3
|
+
* @param {import('vue').Ref<import('../types.js').VjsfSelectNode>} nodeRef
|
|
4
|
+
* @param {import('../types.js').VjsfStatefulLayout} statefulLayout
|
|
5
|
+
*/
|
|
6
|
+
export default function _default(nodeRef: import('vue').Ref<import('../types.js').VjsfSelectNode>, statefulLayout: import('../types.js').VjsfStatefulLayout): {
|
|
7
|
+
modelValue: import("vue").Ref<unknown, unknown>;
|
|
8
|
+
inputProps: import("vue").ComputedRef<Record<string, any> & {
|
|
9
|
+
class: string[];
|
|
10
|
+
}>;
|
|
11
|
+
selectProps: import("vue").ComputedRef<Record<string, any>>;
|
|
12
|
+
compSlots: import("vue").ComputedRef<Record<string, any>>;
|
|
13
|
+
selectSlots: import("vue").ComputedRef<Record<string, any>>;
|
|
14
|
+
getItems: {
|
|
15
|
+
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>;
|
|
16
|
+
loading: import("vue").Ref<boolean, boolean>;
|
|
17
|
+
search: import("vue").Ref<string, string>;
|
|
18
|
+
prepareSelectedItem: (selectedItem: any, itemValue: any) => any;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=use-select-props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-select-props.d.ts","sourceRoot":"","sources":["../../src/composables/use-select-props.js"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,0CAHW,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,aAAa,EAAE,cAAc,CAAC,kBACvD,OAAO,aAAa,EAAE,kBAAkB;;;;;;;;;;;;;;EA2DlD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* specialized use of useFieldProps shared between select and autocomplete components
|
|
3
|
+
* @param {import('vue').Ref<import('../types.js').VjsfSelectNode>} nodeRef
|
|
4
|
+
* @param {import('../types.js').VjsfStatefulLayout} statefulLayout
|
|
5
|
+
*/
|
|
6
|
+
export default function _default(nodeRef: import('vue').Ref<import('../types.js').VjsfSelectNode>, statefulLayout: import('../types.js').VjsfStatefulLayout): {
|
|
7
|
+
localData: import("vue").Ref<any, any>;
|
|
8
|
+
inputProps: import("vue").ComputedRef<Record<string, any> & {
|
|
9
|
+
class: string[];
|
|
10
|
+
}>;
|
|
11
|
+
selectProps: import("vue").ComputedRef<Record<string, any>>;
|
|
12
|
+
compSlots: import("vue").ComputedRef<Record<string, any>>;
|
|
13
|
+
selectSlots: import("vue").ComputedRef<Record<string, any>>;
|
|
14
|
+
getItems: {
|
|
15
|
+
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>;
|
|
16
|
+
loading: import("vue").Ref<boolean, boolean>;
|
|
17
|
+
search: import("vue").Ref<string, string>;
|
|
18
|
+
prepareSelectedItem: (selectedItem: any, itemValue: any) => any;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=use-select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-select.d.ts","sourceRoot":"","sources":["../../src/composables/use-select.js"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,0CAHW,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,aAAa,EAAE,cAAc,CAAC,kBACvD,OAAO,aAAa,EAAE,kBAAkB;;;;;;;;;;;;;;EA2DlD"}
|
|
@@ -8,8 +8,8 @@ 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("../../../node_modules/@json-layout/core/types/compile/types.js").CompiledLayout> | undefined): {
|
|
12
|
-
el: import("vue").Ref<null>;
|
|
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("../../../node_modules/@json-layout/core/types/compile/types.js").CompiledLayout, import("../../../node_modules/@json-layout/core/types/compile/types.js").CompiledLayout> | undefined): {
|
|
12
|
+
el: import("vue").Ref<null, null>;
|
|
13
13
|
statefulLayout: import("vue").ShallowRef<import("../types.js").VjsfStatefulLayout | null>;
|
|
14
14
|
stateTree: import("vue").ShallowRef<import("../../../node_modules/@json-layout/core/types/state/types.js").StateTree | null>;
|
|
15
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-vjsf.d.ts","sourceRoot":"","sources":["../../src/composables/use-vjsf.js"],"names":[],"mappings":"AAYA;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;;;;
|
|
1
|
+
{"version":3,"file":"use-vjsf.d.ts","sourceRoot":"","sources":["../../src/composables/use-vjsf.js"],"names":[],"mappings":"AAYA;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;;;;EAmIb"}
|
package/types/utils/index.d.ts
CHANGED
package/src/utils/index.js
DELETED
package/src/utils/props.js
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { camelize } from 'vue'
|
|
3
|
-
|
|
4
|
-
// NOTE: in a previous draft we used to have this in options,
|
|
5
|
-
// but it was not very flexible and not very easy to use, user defined props should be managed
|
|
6
|
-
// by a combination of layout.props, layout.getProps and vuetify defaults provider (https://vuetifyjs.com/en/components/defaults-providers/#usage)
|
|
7
|
-
const defaultProps = {
|
|
8
|
-
fieldPropsCompact: {
|
|
9
|
-
hideDetails: 'auto'
|
|
10
|
-
},
|
|
11
|
-
fieldPropsReadOnly: { hideDetails: 'auto', variant: 'plain' },
|
|
12
|
-
fieldPropsSummary: { hideDetails: true }
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @param {(Record<string, any> | undefined)[]} propsLevels
|
|
17
|
-
* @returns {Record<string, any> & {class: string[]}}
|
|
18
|
-
*/
|
|
19
|
-
export function mergePropsLevels (propsLevels) {
|
|
20
|
-
/** @type {Record<string, any> & {class: string[]}} */
|
|
21
|
-
const fullProps = { class: [] }
|
|
22
|
-
for (const propsLevel of propsLevels) {
|
|
23
|
-
if (propsLevel) {
|
|
24
|
-
for (const key of Object.keys(propsLevel)) {
|
|
25
|
-
if (key === 'class') {
|
|
26
|
-
// a small convention for merging/overwriting classes:
|
|
27
|
-
// a class defined as a simple string overwrites the previous ones
|
|
28
|
-
// a class defined as an array is merged with the previous ones
|
|
29
|
-
if (Array.isArray(propsLevel.class)) fullProps.class = fullProps.class.concat(propsLevel.class)
|
|
30
|
-
else fullProps.class = [propsLevel.class]
|
|
31
|
-
} else {
|
|
32
|
-
fullProps[camelize(key)] = propsLevel[key]
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return fullProps
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// calculate the props of a field/input type component (text fields, etc)
|
|
41
|
-
// isMainComp is used to determine if this input component is also the main rendered component or if is mostly a wrapper (date picker, etc.)
|
|
42
|
-
/**
|
|
43
|
-
* @param {import('../types.js').VjsfNode} node
|
|
44
|
-
* @param {import('../types.js').VjsfStatefulLayout} statefulLayout
|
|
45
|
-
* @param {(string | [string, string])[]} [layoutPropsMap]
|
|
46
|
-
* @param {boolean} [isMainComp]
|
|
47
|
-
* @returns {Record<string, any>}
|
|
48
|
-
*/
|
|
49
|
-
export function getInputProps (node, statefulLayout, layoutPropsMap, isMainComp = true) {
|
|
50
|
-
const options = node.options
|
|
51
|
-
/** @type {(Record<string, any> | undefined)[]} */
|
|
52
|
-
const propsLevels = []
|
|
53
|
-
if (options.density === 'compact') propsLevels.push(defaultProps.fieldPropsCompact)
|
|
54
|
-
if (node.options.readOnly) propsLevels.push(defaultProps.fieldPropsReadOnly)
|
|
55
|
-
if (isMainComp && node.props) propsLevels.push(node.props)
|
|
56
|
-
|
|
57
|
-
const fullProps = mergePropsLevels(propsLevels)
|
|
58
|
-
|
|
59
|
-
fullProps.label = node.layout.label
|
|
60
|
-
if (node.error && node.validated) {
|
|
61
|
-
fullProps.errorMessages = node.error
|
|
62
|
-
}
|
|
63
|
-
fullProps.modelValue = (typeof node.data === 'string' && node.layout.separator) ? node.data.split(/** @type {string} */(node.layout.separator)) : node.data
|
|
64
|
-
if (node.options.readOnly) {
|
|
65
|
-
fullProps.disabled = true
|
|
66
|
-
fullProps.class.push('vjsf-input--readonly')
|
|
67
|
-
}
|
|
68
|
-
if (node.autofocus) {
|
|
69
|
-
fullProps.class.push('vjsf-input--autofocus')
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (layoutPropsMap) {
|
|
73
|
-
for (const propMap of layoutPropsMap) {
|
|
74
|
-
if (typeof propMap === 'string') {
|
|
75
|
-
if (propMap in node.layout) fullProps[propMap] = node.layout[propMap]
|
|
76
|
-
} else {
|
|
77
|
-
if (propMap[1] in node.layout) fullProps[propMap[0]] = node.layout[propMap[1]]
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (isMainComp) {
|
|
83
|
-
fullProps['onUpdate:modelValue'] = (/** @type string */value) => {
|
|
84
|
-
return statefulLayout.input(node, (Array.isArray(value) && node.layout.separator) ? value.join(/** @type {string} */(node.layout.separator)) : value)
|
|
85
|
-
}
|
|
86
|
-
fullProps.onBlur = () => statefulLayout.blur(node)
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return fullProps
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// calculate the props of components that are not of the field category
|
|
93
|
-
/**
|
|
94
|
-
* @param {import('@json-layout/core').StateNode} node
|
|
95
|
-
* @param {boolean} isMainComp
|
|
96
|
-
* @returns {Record<string, any>}
|
|
97
|
-
*/
|
|
98
|
-
export function getCompProps (node, isMainComp = true) {
|
|
99
|
-
const options = /** @type import('../types.js').VjsfOptions */(node.options)
|
|
100
|
-
/** @type {(Record<string, any> | undefined)[]} */
|
|
101
|
-
const propsLevels = [{ density: options.density }]
|
|
102
|
-
if (isMainComp) propsLevels.push(node.layout.props)
|
|
103
|
-
const fullProps = mergePropsLevels(propsLevels)
|
|
104
|
-
return fullProps
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* shared between select and autocomplete components
|
|
109
|
-
* @param {import('../types.js').VjsfNode} node
|
|
110
|
-
* @param {import('../types.js').VjsfStatefulLayout} statefulLayout
|
|
111
|
-
* @returns {Record<string, any>}
|
|
112
|
-
*/
|
|
113
|
-
export function getSelectProps (node, statefulLayout) {
|
|
114
|
-
const fullProps = getInputProps(node, statefulLayout, ['multiple'], false)
|
|
115
|
-
if (node.options.readOnly) fullProps.menuProps = { modelValue: false }
|
|
116
|
-
fullProps.clearable = fullProps.clearable ?? !node.skeleton.required
|
|
117
|
-
fullProps.valueComparator = (/** @type {any} */a, /** @type {any} */b) => {
|
|
118
|
-
const aKey = typeof a === 'object' ? statefulLayout.prepareSelectItem(node, a).key : a
|
|
119
|
-
const bKey = typeof b === 'object' ? statefulLayout.prepareSelectItem(node, b).key : b
|
|
120
|
-
return aKey === bKey
|
|
121
|
-
}
|
|
122
|
-
fullProps['onUpdate:modelValue'] = (/** @type string */value) => {
|
|
123
|
-
// fix some weird case where vuetify only keep the title property of an unknown item
|
|
124
|
-
if (Array.isArray(value) && Array.isArray(node.data)) {
|
|
125
|
-
for (let i = 0; i < node.data.length; i++) {
|
|
126
|
-
if (typeof node.data[i] === 'object' && typeof value[i] === 'string') {
|
|
127
|
-
value[i] = node.data[i]
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
return statefulLayout.input(node, (Array.isArray(value) && node.layout.separator) ? value.join(/** @type {string} */(node.layout.separator)) : value)
|
|
133
|
-
}
|
|
134
|
-
fullProps.onBlur = () => statefulLayout.blur(node)
|
|
135
|
-
return fullProps
|
|
136
|
-
}
|
package/src/utils/slots.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { h } from 'vue'
|
|
2
|
-
import NodeSlot from '../components/fragments/node-slot.vue'
|
|
3
|
-
import SelectItem from '../components/fragments/select-item.vue'
|
|
4
|
-
import SelectSelection from '../components/fragments/select-selection.vue'
|
|
5
|
-
|
|
6
|
-
// calculate the slots of components
|
|
7
|
-
/**
|
|
8
|
-
* @param {import('../types.js').VjsfNode} node
|
|
9
|
-
* @param {import('../types.js').VjsfStatefulLayout} statefulLayout
|
|
10
|
-
* @returns {Record<string, any>}
|
|
11
|
-
*/
|
|
12
|
-
export function getCompSlots (node, statefulLayout) {
|
|
13
|
-
if (!node.layout.slots) return {}
|
|
14
|
-
/** @type {Record<string, any>} */
|
|
15
|
-
const slots = {}
|
|
16
|
-
for (const [key, layoutSlot] of Object.entries(node.layout.slots)) {
|
|
17
|
-
slots[key] = () => h(NodeSlot, { layoutSlot, node, statefulLayout })
|
|
18
|
-
}
|
|
19
|
-
return slots
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* shared between select and autocomplete components
|
|
24
|
-
* @param {import('../types.js').VjsfSelectNode} node
|
|
25
|
-
* @param {import('../types.js').VjsfStatefulLayout} statefulLayout
|
|
26
|
-
* @param {any} getItems
|
|
27
|
-
* @returns {Record<string, any>}
|
|
28
|
-
*/
|
|
29
|
-
export function getSelectSlots (node, statefulLayout, getItems) {
|
|
30
|
-
const slots = getCompSlots(node, statefulLayout)
|
|
31
|
-
if (!slots.item) {
|
|
32
|
-
slots.item = (/** @type {any} */ context) => h(SelectItem, {
|
|
33
|
-
multiple: node.layout.multiple,
|
|
34
|
-
itemProps: context.props,
|
|
35
|
-
item: context.item.raw
|
|
36
|
-
})
|
|
37
|
-
}
|
|
38
|
-
if (!slots.selection) {
|
|
39
|
-
slots.selection = (/** @type {any} */ context) => h(SelectSelection, {
|
|
40
|
-
multiple: node.layout.multiple,
|
|
41
|
-
last: node.layout.multiple && context.index === node.data.length - 1,
|
|
42
|
-
item: getItems.prepareSelectedItem(context.item.raw, context.item.value)
|
|
43
|
-
})
|
|
44
|
-
}
|
|
45
|
-
return slots
|
|
46
|
-
}
|