cnhis-design-vue 3.1.25-beta.5 → 3.1.25-beta.6
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/README.md +123 -123
- package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
- package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +1 -0
- package/es/components/bpmn-workflow/types/ModelingModule.d.ts +1 -0
- package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +1 -0
- package/es/components/fabric-chart/src/utils/index.d.ts +6823 -0
- package/es/components/form-render/index.js +2 -0
- package/es/components/form-render/src/components/renderer/checkbox.d.ts +66 -2
- package/es/components/form-render/src/components/renderer/checkbox.js +47 -9
- package/es/components/form-render/src/components/renderer/radio.d.ts +60 -0
- package/es/components/form-render/src/components/renderer/radio.js +39 -13
- package/es/components/form-render/src/components/renderer/search.d.ts +5 -5
- package/es/components/form-render/src/components/renderer/search.js +14 -61
- package/es/components/form-render/src/hooks/index.d.ts +2 -0
- package/es/components/form-render/src/hooks/index.js +2 -0
- package/es/components/form-render/src/hooks/useAutographOptions.d.ts +17 -0
- package/es/components/form-render/src/hooks/useAutographOptions.js +70 -0
- package/es/components/form-render/src/hooks/useFieldListAdaptor.js +12 -11
- package/es/components/index.js +2 -0
- package/es/shared/assets/img/failure.js +1 -1
- package/es/shared/assets/img/icon-asc.js +1 -1
- package/es/shared/assets/img/icon-desc.js +1 -1
- package/es/shared/assets/img/no-permission.js +1 -1
- package/es/shared/assets/img/nodata.js +1 -1
- package/es/shared/assets/img/notfound.js +1 -1
- package/es/shared/assets/img/qr.js +1 -1
- package/es/shared/assets/img/success.js +1 -1
- package/es/shared/assets/img/video.js +1 -1
- package/es/shared/assets/img/video_default_cover.js +1 -1
- package/es/shared/assets/img/video_hover.js +1 -1
- package/es/shared/assets/img/video_play_hover.js +1 -1
- package/es/shared/assets/img/xb_big.js +1 -1
- package/es/shared/assets/img/xb_small.js +1 -1
- package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +86 -0
- package/es/shared/utils/tapable/index.d.ts +139 -0
- package/package.json +2 -2
|
@@ -13,7 +13,9 @@ export { BusinessCollector, useBusinessBinding } from './src/hooks/useBusinessBi
|
|
|
13
13
|
export { ContextCollector, useChangeContext } from './src/hooks/useChangeContext.js';
|
|
14
14
|
export { FormItemDepsCollector, useFormItemDeps } from './src/hooks/useFormItemDeps.js';
|
|
15
15
|
export { useAnchor } from './src/hooks/useAnchor.js';
|
|
16
|
+
export { useAutographOptions } from './src/hooks/useAutographOptions.js';
|
|
16
17
|
export { useFormContext } from './src/hooks/useFormContext.js';
|
|
18
|
+
export { useCommonInjection, useSelectOptionProps } from './src/hooks/useCommonInjection.js';
|
|
17
19
|
export * from '@formily/core';
|
|
18
20
|
|
|
19
21
|
const FormRender = script;
|
|
@@ -1,26 +1,90 @@
|
|
|
1
1
|
import { AnyObject } from '../../../../../../es/shared/types';
|
|
2
2
|
import { PropType } from 'vue';
|
|
3
3
|
export declare const CHECKBOX: import("vue").DefineComponent<{
|
|
4
|
+
value: {};
|
|
4
5
|
options: {
|
|
5
6
|
type: PropType<AnyObject[]>;
|
|
6
7
|
default: () => never[];
|
|
7
8
|
};
|
|
9
|
+
autograph: {
|
|
10
|
+
type: StringConstructor;
|
|
11
|
+
};
|
|
12
|
+
lazyRequest: {
|
|
13
|
+
type: BooleanConstructor;
|
|
14
|
+
default: boolean;
|
|
15
|
+
};
|
|
16
|
+
requestCache: {
|
|
17
|
+
type: BooleanConstructor;
|
|
18
|
+
default: boolean;
|
|
19
|
+
};
|
|
20
|
+
wordbook: {
|
|
21
|
+
type: PropType<Partial<{
|
|
22
|
+
level_num: number;
|
|
23
|
+
id: string;
|
|
24
|
+
name: string;
|
|
25
|
+
render_key: string[];
|
|
26
|
+
search_key: string[];
|
|
27
|
+
primary_key: string;
|
|
28
|
+
type: string;
|
|
29
|
+
value_key: string;
|
|
30
|
+
level_key: string;
|
|
31
|
+
link_key: string;
|
|
32
|
+
link_key_split: string;
|
|
33
|
+
show_key: string[];
|
|
34
|
+
conObj: AnyObject[];
|
|
35
|
+
conObjFirstLevel: AnyObject[];
|
|
36
|
+
}>>;
|
|
37
|
+
};
|
|
8
38
|
vertical: {
|
|
9
39
|
type: BooleanConstructor;
|
|
10
40
|
default: boolean;
|
|
11
41
|
};
|
|
12
42
|
onChange: {};
|
|
13
|
-
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
43
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:value"[], "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
44
|
+
value: {};
|
|
14
45
|
options: {
|
|
15
46
|
type: PropType<AnyObject[]>;
|
|
16
47
|
default: () => never[];
|
|
17
48
|
};
|
|
49
|
+
autograph: {
|
|
50
|
+
type: StringConstructor;
|
|
51
|
+
};
|
|
52
|
+
lazyRequest: {
|
|
53
|
+
type: BooleanConstructor;
|
|
54
|
+
default: boolean;
|
|
55
|
+
};
|
|
56
|
+
requestCache: {
|
|
57
|
+
type: BooleanConstructor;
|
|
58
|
+
default: boolean;
|
|
59
|
+
};
|
|
60
|
+
wordbook: {
|
|
61
|
+
type: PropType<Partial<{
|
|
62
|
+
level_num: number;
|
|
63
|
+
id: string;
|
|
64
|
+
name: string;
|
|
65
|
+
render_key: string[];
|
|
66
|
+
search_key: string[];
|
|
67
|
+
primary_key: string;
|
|
68
|
+
type: string;
|
|
69
|
+
value_key: string;
|
|
70
|
+
level_key: string;
|
|
71
|
+
link_key: string;
|
|
72
|
+
link_key_split: string;
|
|
73
|
+
show_key: string[];
|
|
74
|
+
conObj: AnyObject[];
|
|
75
|
+
conObjFirstLevel: AnyObject[];
|
|
76
|
+
}>>;
|
|
77
|
+
};
|
|
18
78
|
vertical: {
|
|
19
79
|
type: BooleanConstructor;
|
|
20
80
|
default: boolean;
|
|
21
81
|
};
|
|
22
82
|
onChange: {};
|
|
23
|
-
}
|
|
83
|
+
}>> & {
|
|
84
|
+
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
85
|
+
}, {
|
|
24
86
|
options: AnyObject[];
|
|
25
87
|
vertical: boolean;
|
|
88
|
+
lazyRequest: boolean;
|
|
89
|
+
requestCache: boolean;
|
|
26
90
|
}>;
|
|
@@ -1,34 +1,72 @@
|
|
|
1
|
-
import { defineComponent, createVNode } from 'vue';
|
|
1
|
+
import { defineComponent, computed, createVNode } from 'vue';
|
|
2
|
+
import '../../../index.js';
|
|
2
3
|
import '../../utils/index.js';
|
|
3
4
|
import { connect, mapProps } from '@formily/vue';
|
|
4
5
|
import { NCheckboxGroup, NSpace, NCheckbox } from 'naive-ui';
|
|
5
|
-
import {
|
|
6
|
+
import { useAutographOptions } from '../../hooks/useAutographOptions.js';
|
|
7
|
+
import { assignUpdateValue } from '../../utils/schema.js';
|
|
8
|
+
import { useCommonInjection } from '../../hooks/useCommonInjection.js';
|
|
6
9
|
|
|
7
10
|
const script = defineComponent({
|
|
8
11
|
name: "FormCheckbox",
|
|
9
12
|
props: {
|
|
13
|
+
value: {},
|
|
10
14
|
options: {
|
|
11
15
|
type: Array,
|
|
12
16
|
default: () => []
|
|
13
17
|
},
|
|
18
|
+
autograph: {
|
|
19
|
+
type: String
|
|
20
|
+
},
|
|
21
|
+
lazyRequest: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: false
|
|
24
|
+
},
|
|
25
|
+
requestCache: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: true
|
|
28
|
+
},
|
|
29
|
+
wordbook: {
|
|
30
|
+
type: Object
|
|
31
|
+
},
|
|
14
32
|
vertical: {
|
|
15
33
|
type: Boolean,
|
|
16
34
|
default: false
|
|
17
35
|
},
|
|
18
36
|
onChange: {}
|
|
19
37
|
},
|
|
20
|
-
|
|
21
|
-
|
|
38
|
+
emits: ["update:value"],
|
|
39
|
+
setup(props, {
|
|
40
|
+
emit
|
|
41
|
+
}) {
|
|
42
|
+
const valueRef = computed({
|
|
43
|
+
get: () => props.value,
|
|
44
|
+
set: (v) => emit("update:value", v)
|
|
45
|
+
});
|
|
46
|
+
const {
|
|
47
|
+
labelKey,
|
|
48
|
+
valueKey,
|
|
49
|
+
options
|
|
50
|
+
} = useAutographOptions(props, valueRef);
|
|
51
|
+
const {
|
|
52
|
+
injectValueBindKey
|
|
53
|
+
} = useCommonInjection();
|
|
54
|
+
const key = injectValueBindKey(valueRef);
|
|
55
|
+
return () => createVNode(NCheckboxGroup, {
|
|
56
|
+
"key": key.value,
|
|
57
|
+
"value": valueRef.value,
|
|
58
|
+
"onUpdate:value": ($event) => valueRef.value = $event
|
|
59
|
+
}, {
|
|
22
60
|
default: () => [createVNode(NSpace, {
|
|
23
61
|
"vertical": props.vertical
|
|
24
62
|
}, {
|
|
25
63
|
default: () => {
|
|
26
64
|
var _a;
|
|
27
|
-
return [(_a =
|
|
28
|
-
"key": option.value,
|
|
29
|
-
"value": option.value
|
|
65
|
+
return [(_a = options.value) == null ? void 0 : _a.map((option) => createVNode(NCheckbox, {
|
|
66
|
+
"key": option[valueKey.value],
|
|
67
|
+
"value": option[valueKey.value]
|
|
30
68
|
}, {
|
|
31
|
-
default: () => [option.
|
|
69
|
+
default: () => [option[labelKey.value]]
|
|
32
70
|
}))];
|
|
33
71
|
}
|
|
34
72
|
})]
|
|
@@ -37,6 +75,6 @@ const script = defineComponent({
|
|
|
37
75
|
});
|
|
38
76
|
const CHECKBOX = connect(script, mapProps({
|
|
39
77
|
dataSource: "options"
|
|
40
|
-
}, assignUpdateValue
|
|
78
|
+
}, assignUpdateValue));
|
|
41
79
|
|
|
42
80
|
export { CHECKBOX };
|
|
@@ -8,6 +8,35 @@ export declare const RADIO: import("vue").DefineComponent<{
|
|
|
8
8
|
type: PropType<AnyObject[]>;
|
|
9
9
|
default: () => never[];
|
|
10
10
|
};
|
|
11
|
+
autograph: {
|
|
12
|
+
type: StringConstructor;
|
|
13
|
+
};
|
|
14
|
+
lazyRequest: {
|
|
15
|
+
type: BooleanConstructor;
|
|
16
|
+
default: boolean;
|
|
17
|
+
};
|
|
18
|
+
requestCache: {
|
|
19
|
+
type: BooleanConstructor;
|
|
20
|
+
default: boolean;
|
|
21
|
+
};
|
|
22
|
+
wordbook: {
|
|
23
|
+
type: PropType<Partial<{
|
|
24
|
+
level_num: number;
|
|
25
|
+
id: string;
|
|
26
|
+
name: string;
|
|
27
|
+
render_key: string[];
|
|
28
|
+
search_key: string[];
|
|
29
|
+
primary_key: string;
|
|
30
|
+
type: string;
|
|
31
|
+
value_key: string;
|
|
32
|
+
level_key: string;
|
|
33
|
+
link_key: string;
|
|
34
|
+
link_key_split: string;
|
|
35
|
+
show_key: string[];
|
|
36
|
+
conObj: AnyObject[];
|
|
37
|
+
conObjFirstLevel: AnyObject[];
|
|
38
|
+
}>>;
|
|
39
|
+
};
|
|
11
40
|
vertical: {
|
|
12
41
|
type: BooleanConstructor;
|
|
13
42
|
default: boolean;
|
|
@@ -21,6 +50,35 @@ export declare const RADIO: import("vue").DefineComponent<{
|
|
|
21
50
|
type: PropType<AnyObject[]>;
|
|
22
51
|
default: () => never[];
|
|
23
52
|
};
|
|
53
|
+
autograph: {
|
|
54
|
+
type: StringConstructor;
|
|
55
|
+
};
|
|
56
|
+
lazyRequest: {
|
|
57
|
+
type: BooleanConstructor;
|
|
58
|
+
default: boolean;
|
|
59
|
+
};
|
|
60
|
+
requestCache: {
|
|
61
|
+
type: BooleanConstructor;
|
|
62
|
+
default: boolean;
|
|
63
|
+
};
|
|
64
|
+
wordbook: {
|
|
65
|
+
type: PropType<Partial<{
|
|
66
|
+
level_num: number;
|
|
67
|
+
id: string;
|
|
68
|
+
name: string;
|
|
69
|
+
render_key: string[];
|
|
70
|
+
search_key: string[];
|
|
71
|
+
primary_key: string;
|
|
72
|
+
type: string;
|
|
73
|
+
value_key: string;
|
|
74
|
+
level_key: string;
|
|
75
|
+
link_key: string;
|
|
76
|
+
link_key_split: string;
|
|
77
|
+
show_key: string[];
|
|
78
|
+
conObj: AnyObject[];
|
|
79
|
+
conObjFirstLevel: AnyObject[];
|
|
80
|
+
}>>;
|
|
81
|
+
};
|
|
24
82
|
vertical: {
|
|
25
83
|
type: BooleanConstructor;
|
|
26
84
|
default: boolean;
|
|
@@ -31,4 +89,6 @@ export declare const RADIO: import("vue").DefineComponent<{
|
|
|
31
89
|
}, {
|
|
32
90
|
options: AnyObject[];
|
|
33
91
|
vertical: boolean;
|
|
92
|
+
lazyRequest: boolean;
|
|
93
|
+
requestCache: boolean;
|
|
34
94
|
}>;
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import { defineComponent, computed, createVNode } from 'vue';
|
|
1
|
+
import { defineComponent, computed, createVNode, isVNode } from 'vue';
|
|
2
2
|
import { connect, mapProps } from '@formily/vue';
|
|
3
3
|
import { isNumber } from 'lodash-es';
|
|
4
4
|
import { NRadioGroup, NSpace, NRadio } from 'naive-ui';
|
|
5
|
+
import '../../../index.js';
|
|
5
6
|
import '../../utils/index.js';
|
|
6
|
-
import {
|
|
7
|
+
import { useAutographOptions } from '../../hooks/useAutographOptions.js';
|
|
8
|
+
import { assignUpdateValue } from '../../utils/schema.js';
|
|
9
|
+
import { useCommonInjection } from '../../hooks/useCommonInjection.js';
|
|
7
10
|
|
|
11
|
+
function _isSlot(s) {
|
|
12
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
13
|
+
}
|
|
8
14
|
const script = defineComponent({
|
|
9
15
|
props: {
|
|
10
16
|
value: {
|
|
@@ -14,6 +20,20 @@ const script = defineComponent({
|
|
|
14
20
|
type: Array,
|
|
15
21
|
default: () => []
|
|
16
22
|
},
|
|
23
|
+
autograph: {
|
|
24
|
+
type: String
|
|
25
|
+
},
|
|
26
|
+
lazyRequest: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: false
|
|
29
|
+
},
|
|
30
|
+
requestCache: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: true
|
|
33
|
+
},
|
|
34
|
+
wordbook: {
|
|
35
|
+
type: Object
|
|
36
|
+
},
|
|
17
37
|
vertical: {
|
|
18
38
|
type: Boolean,
|
|
19
39
|
default: false
|
|
@@ -37,24 +57,30 @@ const script = defineComponent({
|
|
|
37
57
|
emit("update:value", v);
|
|
38
58
|
}
|
|
39
59
|
});
|
|
60
|
+
const {
|
|
61
|
+
labelKey,
|
|
62
|
+
valueKey,
|
|
63
|
+
options
|
|
64
|
+
} = useAutographOptions(props, valueRef);
|
|
65
|
+
const {
|
|
66
|
+
injectValueBindKey
|
|
67
|
+
} = useCommonInjection();
|
|
68
|
+
const key = injectValueBindKey(valueRef);
|
|
40
69
|
return () => {
|
|
70
|
+
let _slot;
|
|
41
71
|
return createVNode(NRadioGroup, {
|
|
72
|
+
"key": key.value,
|
|
42
73
|
"value": valueRef.value,
|
|
43
74
|
"onUpdate:value": ($event) => valueRef.value = $event
|
|
44
75
|
}, {
|
|
45
76
|
default: () => [createVNode(NSpace, {
|
|
46
77
|
"vertical": props.vertical
|
|
78
|
+
}, _isSlot(_slot = options.value.map((option) => createVNode(NRadio, {
|
|
79
|
+
"value": option[valueKey.value]
|
|
47
80
|
}, {
|
|
48
|
-
default: () =>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return createVNode(NRadio, {
|
|
52
|
-
"value": option.value
|
|
53
|
-
}, {
|
|
54
|
-
default: () => [option.text]
|
|
55
|
-
});
|
|
56
|
-
})];
|
|
57
|
-
}
|
|
81
|
+
default: () => [option[labelKey.value]]
|
|
82
|
+
}))) ? _slot : {
|
|
83
|
+
default: () => [_slot]
|
|
58
84
|
})]
|
|
59
85
|
});
|
|
60
86
|
};
|
|
@@ -62,6 +88,6 @@ const script = defineComponent({
|
|
|
62
88
|
});
|
|
63
89
|
const RADIO = connect(script, mapProps({
|
|
64
90
|
dataSource: "options"
|
|
65
|
-
}, assignUpdateValue
|
|
91
|
+
}, assignUpdateValue));
|
|
66
92
|
|
|
67
93
|
export { RADIO };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Func } from '../../../../../../es/shared/types';
|
|
2
2
|
import { PropType } from 'vue';
|
|
3
3
|
export declare const SEARCH: import("vue").DefineComponent<{
|
|
4
4
|
value: {
|
|
@@ -30,8 +30,8 @@ export declare const SEARCH: import("vue").DefineComponent<{
|
|
|
30
30
|
link_key: string;
|
|
31
31
|
link_key_split: string;
|
|
32
32
|
show_key: string[];
|
|
33
|
-
conObj: AnyObject[];
|
|
34
|
-
conObjFirstLevel: AnyObject[];
|
|
33
|
+
conObj: import("../../../../../../es/shared/types").AnyObject[];
|
|
34
|
+
conObjFirstLevel: import("../../../../../../es/shared/types").AnyObject[];
|
|
35
35
|
}>>;
|
|
36
36
|
required: true;
|
|
37
37
|
};
|
|
@@ -69,8 +69,8 @@ export declare const SEARCH: import("vue").DefineComponent<{
|
|
|
69
69
|
link_key: string;
|
|
70
70
|
link_key_split: string;
|
|
71
71
|
show_key: string[];
|
|
72
|
-
conObj: AnyObject[];
|
|
73
|
-
conObjFirstLevel: AnyObject[];
|
|
72
|
+
conObj: import("../../../../../../es/shared/types").AnyObject[];
|
|
73
|
+
conObjFirstLevel: import("../../../../../../es/shared/types").AnyObject[];
|
|
74
74
|
}>>;
|
|
75
75
|
required: true;
|
|
76
76
|
};
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { defineComponent, computed,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { useCommonInjection, useSelectOptionProps } from '../../hooks/useCommonInjection.js';
|
|
5
|
-
import { InjectAsyncQueue, InjectionChangeContextCollector } from '../../constants/index.js';
|
|
1
|
+
import { defineComponent, computed, inject, createVNode } from 'vue';
|
|
2
|
+
import { cloneDeep } from 'lodash-es';
|
|
3
|
+
import { InjectionChangeContextCollector } from '../../constants/index.js';
|
|
6
4
|
import '../../../../../shared/utils/index.js';
|
|
7
5
|
import '../../../index.js';
|
|
8
|
-
import
|
|
9
|
-
import { useFormRequest } from '../../hooks/useFormRequest.js';
|
|
6
|
+
import '../../utils/index.js';
|
|
10
7
|
import { useFormField } from '../../hooks/useFormField.js';
|
|
8
|
+
import '@vueuse/core';
|
|
11
9
|
import '../../../../../shared/utils/tapable/SyncHook.js';
|
|
12
10
|
import '../../../../../shared/utils/tapable/SyncBailHook.js';
|
|
13
11
|
import '../../../../../shared/utils/tapable/SyncWaterfallHook.js';
|
|
@@ -20,9 +18,11 @@ import '../../../../../shared/utils/tapable/AsyncSeriesLoopHook.js';
|
|
|
20
18
|
import '../../../../../shared/utils/tapable/AsyncSeriesWaterfallHook.js';
|
|
21
19
|
import '../../hooks/useFormValidator.js';
|
|
22
20
|
import '@formily/core';
|
|
21
|
+
import { useAutographOptions } from '../../hooks/useAutographOptions.js';
|
|
23
22
|
import '@vue/shared';
|
|
24
23
|
import { connect, mapProps } from '@formily/vue';
|
|
25
24
|
import './index.js';
|
|
25
|
+
import { useCommonInjection, useSelectOptionProps } from '../../hooks/useCommonInjection.js';
|
|
26
26
|
import { NSelect } from 'naive-ui';
|
|
27
27
|
import { visitedDecorator, assignUpdateValue, assignClearBindVisited } from '../../utils/schema.js';
|
|
28
28
|
|
|
@@ -62,72 +62,25 @@ const script = defineComponent({
|
|
|
62
62
|
get: () => props.value,
|
|
63
63
|
set: (v) => emit("update:value", v)
|
|
64
64
|
});
|
|
65
|
-
const remoteOptions = ref(null);
|
|
66
|
-
const lastSearch = ref("");
|
|
67
|
-
const labelKey = computed(() => {
|
|
68
|
-
var _a, _b, _c;
|
|
69
|
-
return (_c = (_b = (_a = props.wordbook) == null ? void 0 : _a.render_key) == null ? void 0 : _b[0]) != null ? _c : "text";
|
|
70
|
-
});
|
|
71
|
-
const valueKey = computed(() => {
|
|
72
|
-
var _a, _b;
|
|
73
|
-
return (_b = (_a = props.wordbook) == null ? void 0 : _a.value_key) != null ? _b : "value";
|
|
74
|
-
});
|
|
75
65
|
const {
|
|
76
66
|
field,
|
|
77
67
|
fieldKey
|
|
78
68
|
} = useFormField();
|
|
79
|
-
const asyncQueue = inject(InjectAsyncQueue);
|
|
80
69
|
const {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return;
|
|
87
|
-
try {
|
|
88
|
-
remoteOptions.value = await asyncQueue.addAsync(createParams(props.wordbook, props.autograph, field.value, fieldKey.value));
|
|
89
|
-
} catch (e) {
|
|
90
|
-
isString(e) && formRenderLog(e);
|
|
91
|
-
}
|
|
92
|
-
function createParams(wordbook, autograph, field2, key2) {
|
|
93
|
-
const params = {
|
|
94
|
-
autograph,
|
|
95
|
-
wordbookId: wordbook.id,
|
|
96
|
-
wordbookType: wordbook.type,
|
|
97
|
-
fieldKeys: wordbook.search_key,
|
|
98
|
-
keyword: "",
|
|
99
|
-
page: 1
|
|
100
|
-
};
|
|
101
|
-
return {
|
|
102
|
-
...getSearchRequestInfo(),
|
|
103
|
-
params,
|
|
104
|
-
key: key2,
|
|
105
|
-
cache: props.requestCache
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
}, 300);
|
|
109
|
-
const parsedOptions = computed(() => {
|
|
110
|
-
return remoteOptions.value ? optionMatcher(remoteOptions.value, lastSearch.value, labelKey.value) : [];
|
|
111
|
-
});
|
|
70
|
+
fetchData,
|
|
71
|
+
labelKey,
|
|
72
|
+
valueKey,
|
|
73
|
+
options
|
|
74
|
+
} = useAutographOptions(props, valueRef);
|
|
112
75
|
const changeContextCollector = inject(InjectionChangeContextCollector);
|
|
113
76
|
changeContextCollector.setContext(fieldKey.value, (v) => {
|
|
114
77
|
return {
|
|
115
78
|
currentOption: cloneDeep(getCurrentOption(v))
|
|
116
79
|
};
|
|
117
80
|
function getCurrentOption(v2) {
|
|
118
|
-
return
|
|
81
|
+
return options.value.find((option) => option[valueKey.value] === v2);
|
|
119
82
|
}
|
|
120
83
|
});
|
|
121
|
-
watch(() => props.wordbook, (wordbook, oldWordbook) => {
|
|
122
|
-
if (isEqual(wordbook, oldWordbook))
|
|
123
|
-
return;
|
|
124
|
-
remoteOptions.value = null;
|
|
125
|
-
if (!wordbook)
|
|
126
|
-
return;
|
|
127
|
-
(valueRef.value || !props.lazyRequest) && fetchData();
|
|
128
|
-
}, {
|
|
129
|
-
immediate: true
|
|
130
|
-
});
|
|
131
84
|
const {
|
|
132
85
|
injectValueValidate,
|
|
133
86
|
injectValueWatchFromEmpty,
|
|
@@ -150,7 +103,7 @@ const script = defineComponent({
|
|
|
150
103
|
"node-props": nodeProps,
|
|
151
104
|
"labelField": labelKey.value,
|
|
152
105
|
"valueField": valueKey.value,
|
|
153
|
-
"options":
|
|
106
|
+
"options": options.value,
|
|
154
107
|
"onSearch": fetchData,
|
|
155
108
|
"onUpdate:show": (show) => show && fetchData(),
|
|
156
109
|
"onFocus": visitedDecorator(field, props.onFocus)
|
|
@@ -10,4 +10,6 @@ export * from './useBusinessBinding';
|
|
|
10
10
|
export * from './useChangeContext';
|
|
11
11
|
export * from './useFormItemDeps';
|
|
12
12
|
export * from './useAnchor';
|
|
13
|
+
export * from './useAutographOptions';
|
|
13
14
|
export * from './useFormContext';
|
|
15
|
+
export * from './useCommonInjection';
|
|
@@ -10,4 +10,6 @@ export { BusinessCollector, useBusinessBinding } from './useBusinessBinding.js';
|
|
|
10
10
|
export { ContextCollector, useChangeContext } from './useChangeContext.js';
|
|
11
11
|
export { FormItemDepsCollector, useFormItemDeps } from './useFormItemDeps.js';
|
|
12
12
|
export { useAnchor } from './useAnchor.js';
|
|
13
|
+
export { useAutographOptions } from './useAutographOptions.js';
|
|
13
14
|
export { useFormContext } from './useFormContext.js';
|
|
15
|
+
export { useCommonInjection, useSelectOptionProps } from './useCommonInjection.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AnyObject } from '../../../../../es/shared/types';
|
|
2
|
+
import { Ref } from 'vue';
|
|
3
|
+
import { FormWordbook } from '../../../../../es/components/form-render';
|
|
4
|
+
export declare function useAutographOptions(props: {
|
|
5
|
+
requestCache?: boolean;
|
|
6
|
+
wordbook?: FormWordbook;
|
|
7
|
+
autograph?: string;
|
|
8
|
+
lazyRequest?: boolean;
|
|
9
|
+
options?: AnyObject[];
|
|
10
|
+
}, valueRef: Ref): {
|
|
11
|
+
valueRef: Ref<any>;
|
|
12
|
+
options: import("vue").ComputedRef<AnyObject[]>;
|
|
13
|
+
fetchData: (content?: string) => Promise<void>;
|
|
14
|
+
labelKey: import("vue").ComputedRef<string>;
|
|
15
|
+
valueKey: import("vue").ComputedRef<string>;
|
|
16
|
+
lastSearch: Ref<string>;
|
|
17
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { useDebounceFn } from '@vueuse/core';
|
|
2
|
+
import { isString, isEqual } from 'lodash-es';
|
|
3
|
+
import { getCurrentInstance, inject, computed, ref, watch } from 'vue';
|
|
4
|
+
import '../../index.js';
|
|
5
|
+
import { InjectAsyncQueue } from '../constants/index.js';
|
|
6
|
+
import { formRenderLog, optionMatcher } from '../utils/index.js';
|
|
7
|
+
import { useFormField } from './useFormField.js';
|
|
8
|
+
import { useFormRequest } from './useFormRequest.js';
|
|
9
|
+
|
|
10
|
+
function useAutographOptions(props, valueRef) {
|
|
11
|
+
if (!getCurrentInstance())
|
|
12
|
+
throw new Error("can't use this hook out of setup environment");
|
|
13
|
+
const asyncQueue = inject(InjectAsyncQueue);
|
|
14
|
+
const labelKey = computed(() => {
|
|
15
|
+
var _a, _b, _c;
|
|
16
|
+
return (_c = (_b = (_a = props.wordbook) == null ? void 0 : _a.render_key) == null ? void 0 : _b[0]) != null ? _c : "text";
|
|
17
|
+
});
|
|
18
|
+
const valueKey = computed(() => {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
return (_b = (_a = props.wordbook) == null ? void 0 : _a.value_key) != null ? _b : "value";
|
|
21
|
+
});
|
|
22
|
+
const remoteOptions = ref(null);
|
|
23
|
+
const lastSearch = ref("");
|
|
24
|
+
const { field, fieldKey } = useFormField();
|
|
25
|
+
const { getSearchRequestInfo } = useFormRequest();
|
|
26
|
+
const fetchData = useDebounceFn(async function(content) {
|
|
27
|
+
if (!props.autograph || !props.wordbook)
|
|
28
|
+
return;
|
|
29
|
+
lastSearch.value = content || "";
|
|
30
|
+
if (remoteOptions.value && props.requestCache)
|
|
31
|
+
return;
|
|
32
|
+
try {
|
|
33
|
+
remoteOptions.value = await asyncQueue.addAsync(
|
|
34
|
+
createParams(props.wordbook, props.autograph, field.value, fieldKey.value)
|
|
35
|
+
);
|
|
36
|
+
} catch (e) {
|
|
37
|
+
isString(e) && formRenderLog(e);
|
|
38
|
+
}
|
|
39
|
+
function createParams(wordbook, autograph, field2, key) {
|
|
40
|
+
const params = {
|
|
41
|
+
autograph,
|
|
42
|
+
wordbookId: wordbook.id,
|
|
43
|
+
wordbookType: wordbook.type,
|
|
44
|
+
fieldKeys: wordbook.search_key,
|
|
45
|
+
keyword: "",
|
|
46
|
+
page: 1
|
|
47
|
+
};
|
|
48
|
+
return { ...getSearchRequestInfo(), params, key, cache: props.requestCache };
|
|
49
|
+
}
|
|
50
|
+
}, 300);
|
|
51
|
+
const options = computed(() => {
|
|
52
|
+
var _a;
|
|
53
|
+
return remoteOptions.value ? optionMatcher(remoteOptions.value, lastSearch.value, labelKey.value) : (_a = props.options) != null ? _a : [];
|
|
54
|
+
});
|
|
55
|
+
watch(
|
|
56
|
+
() => props.wordbook,
|
|
57
|
+
(wordbook, oldWordbook) => {
|
|
58
|
+
if (isEqual(wordbook, oldWordbook))
|
|
59
|
+
return;
|
|
60
|
+
remoteOptions.value = null;
|
|
61
|
+
if (!wordbook)
|
|
62
|
+
return;
|
|
63
|
+
(valueRef.value || !props.lazyRequest) && fetchData();
|
|
64
|
+
},
|
|
65
|
+
{ immediate: true }
|
|
66
|
+
);
|
|
67
|
+
return { valueRef, options, fetchData, labelKey, valueKey, lastSearch };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export { useAutographOptions };
|
|
@@ -7,6 +7,16 @@ import { fieldKeyEscape, createLinebarId } from '../utils/schema.js';
|
|
|
7
7
|
import { transformDateFormat } from '../utils/business.js';
|
|
8
8
|
import { useFormValidator } from './useFormValidator.js';
|
|
9
9
|
|
|
10
|
+
function bindAutoGraphProps(schema, item) {
|
|
11
|
+
Object.assign(schema["x-component-props"], {
|
|
12
|
+
...pick(item, ["wordbook", "autograph"])
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
function bindUrlProps(schema, item) {
|
|
16
|
+
Object.assign(schema["x-component-props"], {
|
|
17
|
+
...pick(item, ["urlConfig"])
|
|
18
|
+
});
|
|
19
|
+
}
|
|
10
20
|
function useFieldListAdaptor(collector) {
|
|
11
21
|
const { createValidatorSchema } = useFormValidator();
|
|
12
22
|
const createStandardSchema = (item) => {
|
|
@@ -63,6 +73,7 @@ function useFieldListAdaptor(collector) {
|
|
|
63
73
|
if (item.urlConfig) {
|
|
64
74
|
bindUrlProps(schema, item);
|
|
65
75
|
} else if (item.autograph) {
|
|
76
|
+
schema["x-component"] = "SEARCH";
|
|
66
77
|
bindAutoGraphProps(schema, item);
|
|
67
78
|
}
|
|
68
79
|
bindCommonProps(schema, item);
|
|
@@ -77,17 +88,6 @@ function useFieldListAdaptor(collector) {
|
|
|
77
88
|
});
|
|
78
89
|
multiple && (schema2.type = "array");
|
|
79
90
|
}
|
|
80
|
-
function bindAutoGraphProps(schema2, item2) {
|
|
81
|
-
schema2["x-component"] = "SEARCH";
|
|
82
|
-
Object.assign(schema2["x-component-props"], {
|
|
83
|
-
...pick(item2, ["wordbook", "autograph"])
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
function bindUrlProps(schema2, item2) {
|
|
87
|
-
Object.assign(schema2["x-component-props"], {
|
|
88
|
-
...pick(item2, ["urlConfig"])
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
91
|
};
|
|
92
92
|
const createRadioSchema = (item) => {
|
|
93
93
|
const schema = createStandardSchema(item);
|
|
@@ -95,6 +95,7 @@ function useFieldListAdaptor(collector) {
|
|
|
95
95
|
options: item.option,
|
|
96
96
|
vertical: item.__vertical
|
|
97
97
|
});
|
|
98
|
+
bindAutoGraphProps(schema, item);
|
|
98
99
|
return schema;
|
|
99
100
|
};
|
|
100
101
|
const createDateSchema = (item) => {
|
package/es/components/index.js
CHANGED
|
@@ -52,7 +52,9 @@ export { BusinessCollector, useBusinessBinding } from './form-render/src/hooks/u
|
|
|
52
52
|
export { ContextCollector, useChangeContext } from './form-render/src/hooks/useChangeContext.js';
|
|
53
53
|
export { FormItemDepsCollector, useFormItemDeps } from './form-render/src/hooks/useFormItemDeps.js';
|
|
54
54
|
export { useAnchor } from './form-render/src/hooks/useAnchor.js';
|
|
55
|
+
export { useAutographOptions } from './form-render/src/hooks/useAutographOptions.js';
|
|
55
56
|
export { useFormContext } from './form-render/src/hooks/useFormContext.js';
|
|
57
|
+
export { useCommonInjection, useSelectOptionProps } from './form-render/src/hooks/useCommonInjection.js';
|
|
56
58
|
export * from '@formily/core';
|
|
57
59
|
export { GlobalShortcutProvider, ShortcutManager, useShortcuts } from './shortcut-provider/src/hooks/useShortcuts.js';
|
|
58
60
|
export { useShortcutSignature } from './shortcut-provider/src/hooks/useShortcutSignature.js';
|