cnhis-design-vue 3.1.19-beta.2 → 3.1.19-beta.4
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 -0
- package/es/components/big-table/index.d.ts +1 -1
- package/es/components/big-table/src/BigTable.vue.d.ts +1 -1
- package/es/components/big-table/src/components/edit-form/edit-date.js +2 -1
- package/es/components/big-table/src/hooks/useEvent2.js +18 -24
- package/es/components/button-print/index.d.ts +1 -1
- package/es/components/button-print/src/ButtonPrint.vue.d.ts +1 -1
- package/es/components/button-print/src/components/IdentityVerification.vue.d.ts +1 -1
- package/es/components/drag-layout/index.d.ts +1 -1
- package/es/components/drag-layout/src/DragLayout.vue.d.ts +1 -1
- package/es/components/fabric-chart/index.d.ts +1 -1
- package/es/components/fabric-chart/src/FabricChart.vue.d.ts +1 -1
- package/es/components/fabric-chart/src/hooks/useCumputedPoint.d.ts +1 -1
- package/es/components/fabric-chart/src/hooks/useCumputedPoint2.js +2 -2
- package/es/components/fabric-chart/src/hooks/useOther2.js +18 -14
- package/es/components/form-config/index.d.ts +10 -3
- package/es/components/form-config/src/FormConfig.vue.d.ts +10 -3
- package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +1 -1
- package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +9 -2
- package/es/components/form-render/index.d.ts +1 -1
- package/es/components/form-render/index2.js +1 -0
- package/es/components/form-render/src/FormRender.js +3 -3
- package/es/components/form-render/src/FormRender.vue.d.ts +1 -1
- package/es/components/form-render/src/components/renderer/cascader.d.ts +9 -2
- package/es/components/form-render/src/components/renderer/cascader.js +39 -5
- package/es/components/form-render/src/components/renderer/index.d.ts +1 -0
- package/es/components/form-render/src/components/renderer/index.js +1 -0
- package/es/components/form-render/src/components/renderer/index2.js +1 -0
- package/es/components/form-render/src/components/renderer/inputGroup.d.ts +1 -1
- package/es/components/form-render/src/components/renderer/search.d.ts +48 -0
- package/es/components/form-render/src/components/renderer/search.js +172 -0
- package/es/components/form-render/src/components/renderer/select.d.ts +3 -3
- package/es/components/form-render/src/components/renderer/select.js +4 -11
- package/es/components/form-render/src/hooks/useFieldListAdaptor2.js +23 -6
- package/es/components/form-render/src/hooks/useFormContext2.js +2 -10
- package/es/components/form-render/src/hooks/useFormRequest.d.ts +10 -0
- package/es/components/form-render/src/hooks/useFormRequest2.js +8 -1
- package/es/components/form-render/src/types/fieldItem.d.ts +16 -4
- package/es/components/form-render/src/utils/index.d.ts +1 -0
- package/es/components/form-render/src/utils/index.js +24 -1
- package/es/components/form-render/src/utils/schema.d.ts +3 -1
- package/es/components/form-render/src/utils/schema.js +1 -1
- package/es/components/form-render/src/utils/schema2.js +9 -1
- package/es/components/form-table/index.d.ts +1 -1
- package/es/components/form-table/src/FormTable.vue.d.ts +1 -1
- package/es/components/form-table/src/components/index.d.ts +1 -1
- package/es/components/form-table/src/components/table-age.vue.d.ts +1 -1
- package/es/components/grid/src/hooks2.js +1 -0
- package/es/components/index.css +1 -1
- package/es/components/info-header/index.d.ts +1 -1
- package/es/components/info-header/src/InfoHeader.vue.d.ts +1 -1
- package/es/components/scale-view/index.d.ts +1 -1
- package/es/components/scale-view/src/ScaleView.vue.d.ts +1 -1
- package/es/components/scale-view/src/hooks/use-component.d.ts +2 -2
- package/es/components/select-label/index.d.ts +4 -4
- package/es/components/select-label/src/LabelFormContent.vue.d.ts +2 -2
- package/es/components/select-label/src/SelectLabel.vue.d.ts +2 -2
- package/es/components/select-person/index.d.ts +1 -1
- package/es/components/select-person/src/SelectPerson.vue.d.ts +1 -1
- package/es/components/shortcut-setter/index.d.ts +9 -2
- package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +9 -2
- package/es/components/steps-wheel/index.d.ts +30 -0
- package/es/components/steps-wheel/src/StepsWheel.js +152 -103
- package/es/components/steps-wheel/src/StepsWheel.vue.d.ts +30 -0
- package/es/components/steps-wheel/style/index.css +1 -1
- package/es/components/time-line/index.d.ts +1 -1
- package/es/components/time-line/src/TimeLine.vue.d.ts +1 -1
- package/package.json +6 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, ref, computed, inject, watch, createVNode } from 'vue';
|
|
2
2
|
import { isField } from '@formily/core';
|
|
3
|
-
import { isEqual } from 'lodash-es';
|
|
3
|
+
import { isEqual, isArray } from 'lodash-es';
|
|
4
4
|
import { useCommonInjection } from '../../hooks/useCommonInjection2.js';
|
|
5
5
|
import { InjectAsyncQueue } from '../../constants/index2.js';
|
|
6
6
|
import '@vueuse/core';
|
|
@@ -38,6 +38,7 @@ import './labelSelect.js';
|
|
|
38
38
|
import './slider.js';
|
|
39
39
|
import './complex.js';
|
|
40
40
|
import './simpleComponent.js';
|
|
41
|
+
import './search.js';
|
|
41
42
|
import { NCascader } from 'naive-ui';
|
|
42
43
|
|
|
43
44
|
const script = defineComponent({
|
|
@@ -48,8 +49,7 @@ const script = defineComponent({
|
|
|
48
49
|
default: () => []
|
|
49
50
|
},
|
|
50
51
|
depth: {
|
|
51
|
-
type: [Number, String]
|
|
52
|
-
required: true
|
|
52
|
+
type: [Number, String]
|
|
53
53
|
},
|
|
54
54
|
urlConfig: {
|
|
55
55
|
type: Object
|
|
@@ -57,6 +57,10 @@ const script = defineComponent({
|
|
|
57
57
|
onFocus: {
|
|
58
58
|
type: Function
|
|
59
59
|
},
|
|
60
|
+
filterable: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
default: false
|
|
63
|
+
},
|
|
60
64
|
onChange: {},
|
|
61
65
|
value: {}
|
|
62
66
|
},
|
|
@@ -100,7 +104,35 @@ const script = defineComponent({
|
|
|
100
104
|
}
|
|
101
105
|
}
|
|
102
106
|
const asyncQueue = inject(InjectAsyncQueue);
|
|
103
|
-
|
|
107
|
+
function fetchData(option) {
|
|
108
|
+
return props.filterable ? fetchFullData() : fetchGradeData(option);
|
|
109
|
+
}
|
|
110
|
+
async function fetchFullData() {
|
|
111
|
+
if (!props.urlConfig || remoteOptions.value)
|
|
112
|
+
return;
|
|
113
|
+
const data = await asyncQueue.addAsync({
|
|
114
|
+
...props.urlConfig,
|
|
115
|
+
params: {
|
|
116
|
+
lvlnr: 1 + ""
|
|
117
|
+
},
|
|
118
|
+
key: title.value
|
|
119
|
+
});
|
|
120
|
+
remoteOptions.value = data.map((item) => optionNormalize(item, 0));
|
|
121
|
+
function optionNormalize(data2, depth) {
|
|
122
|
+
const result = {
|
|
123
|
+
[labelKey.value]: data2[labelKey.value],
|
|
124
|
+
[valueKey.value]: data2[valueKey.value],
|
|
125
|
+
depth: depth + 1,
|
|
126
|
+
isLeaf: true
|
|
127
|
+
};
|
|
128
|
+
if (isArray(data2.children)) {
|
|
129
|
+
result.children = data2.children.map((child) => optionNormalize(child, depth + 1));
|
|
130
|
+
result.isLeaf = !data2.children.length;
|
|
131
|
+
}
|
|
132
|
+
return result;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
async function fetchGradeData(option) {
|
|
104
136
|
if (notNeedToFetchData(props, option))
|
|
105
137
|
return;
|
|
106
138
|
const data = await asyncQueue.addAsync(createRequestParams(deepFor(option), configFor(props), title.value, option));
|
|
@@ -184,9 +216,11 @@ const script = defineComponent({
|
|
|
184
216
|
onFocus == null ? void 0 : onFocus(...args);
|
|
185
217
|
};
|
|
186
218
|
}
|
|
219
|
+
const remote = computed(() => !props.filterable);
|
|
187
220
|
return () => {
|
|
188
221
|
return createVNode(NCascader, {
|
|
189
|
-
"remote":
|
|
222
|
+
"remote": remote.value,
|
|
223
|
+
"filterable": props.filterable,
|
|
190
224
|
"checkStrategy": "child",
|
|
191
225
|
"show": !!show.value,
|
|
192
226
|
"onUpdate:show": updateShow,
|
|
@@ -4,7 +4,7 @@ export declare const INPUT_GROUP: import("vue").DefineComponent<{
|
|
|
4
4
|
[x: symbol]: never;
|
|
5
5
|
}, {
|
|
6
6
|
mergedClsPrefix: import("vue").ComputedRef<string>;
|
|
7
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
7
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
8
8
|
[x: string]: never;
|
|
9
9
|
[x: number]: never;
|
|
10
10
|
[x: symbol]: never;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Func } from '../../../../../../es/shared/types';
|
|
2
|
+
import { FormWordbook } from '../../types';
|
|
3
|
+
import { PropType } from 'vue';
|
|
4
|
+
export declare const SEARCH: import("vue").DefineComponent<{
|
|
5
|
+
value: {
|
|
6
|
+
type: StringConstructor;
|
|
7
|
+
};
|
|
8
|
+
autograph: {
|
|
9
|
+
type: StringConstructor;
|
|
10
|
+
required: true;
|
|
11
|
+
};
|
|
12
|
+
lazyRequest: {
|
|
13
|
+
type: BooleanConstructor;
|
|
14
|
+
default: boolean;
|
|
15
|
+
};
|
|
16
|
+
wordbook: {
|
|
17
|
+
type: PropType<FormWordbook>;
|
|
18
|
+
required: true;
|
|
19
|
+
};
|
|
20
|
+
onFocus: {
|
|
21
|
+
type: PropType<Func<any[], any>>;
|
|
22
|
+
};
|
|
23
|
+
onChange: {};
|
|
24
|
+
}, () => 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<{
|
|
25
|
+
value: {
|
|
26
|
+
type: StringConstructor;
|
|
27
|
+
};
|
|
28
|
+
autograph: {
|
|
29
|
+
type: StringConstructor;
|
|
30
|
+
required: true;
|
|
31
|
+
};
|
|
32
|
+
lazyRequest: {
|
|
33
|
+
type: BooleanConstructor;
|
|
34
|
+
default: boolean;
|
|
35
|
+
};
|
|
36
|
+
wordbook: {
|
|
37
|
+
type: PropType<FormWordbook>;
|
|
38
|
+
required: true;
|
|
39
|
+
};
|
|
40
|
+
onFocus: {
|
|
41
|
+
type: PropType<Func<any[], any>>;
|
|
42
|
+
};
|
|
43
|
+
onChange: {};
|
|
44
|
+
}>> & {
|
|
45
|
+
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
46
|
+
}, {
|
|
47
|
+
lazyRequest: boolean;
|
|
48
|
+
}>;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { defineComponent, computed, ref, inject, nextTick, watch, createVNode } from 'vue';
|
|
2
|
+
import { cloneDeep, isEqual, isString } from 'lodash-es';
|
|
3
|
+
import { useCommonInjection } from '../../hooks/useCommonInjection2.js';
|
|
4
|
+
import { InjectAsyncQueue, InjectionChangeContextCollector } from '../../constants/index2.js';
|
|
5
|
+
import '@vueuse/core';
|
|
6
|
+
import '../../../index2.js';
|
|
7
|
+
import { formRenderLog } from '../../utils/index.js';
|
|
8
|
+
import { useFormRequest } from '../../hooks/useFormRequest2.js';
|
|
9
|
+
import { useFormField } from '../../hooks/useFormField2.js';
|
|
10
|
+
import '../../../../../shared/utils/tapable/SyncHook.js';
|
|
11
|
+
import '../../../../../shared/utils/tapable/SyncBailHook.js';
|
|
12
|
+
import '../../../../../shared/utils/tapable/SyncWaterfallHook.js';
|
|
13
|
+
import '../../../../../shared/utils/tapable/SyncLoopHook.js';
|
|
14
|
+
import '../../../../../shared/utils/tapable/AsyncParallelHook.js';
|
|
15
|
+
import '../../../../../shared/utils/tapable/AsyncParallelBailHook.js';
|
|
16
|
+
import '../../../../../shared/utils/tapable/AsyncSeriesHook.js';
|
|
17
|
+
import '../../../../../shared/utils/tapable/AsyncSeriesBailHook.js';
|
|
18
|
+
import '../../../../../shared/utils/tapable/AsyncSeriesLoopHook.js';
|
|
19
|
+
import '../../../../../shared/utils/tapable/AsyncSeriesWaterfallHook.js';
|
|
20
|
+
import '@formily/core';
|
|
21
|
+
import '@vue/shared';
|
|
22
|
+
import { connect, mapProps } from '@formily/vue';
|
|
23
|
+
import './input.js';
|
|
24
|
+
import './select.js';
|
|
25
|
+
import './formItem.js';
|
|
26
|
+
import './textarea.js';
|
|
27
|
+
import './inputNumber.js';
|
|
28
|
+
import './linebar.js';
|
|
29
|
+
import './inputGroup2.js';
|
|
30
|
+
import './date.js';
|
|
31
|
+
import './cascader.js';
|
|
32
|
+
import './jsonCombination/index.js';
|
|
33
|
+
import './combination.js';
|
|
34
|
+
import './checkbox.js';
|
|
35
|
+
import './switch.js';
|
|
36
|
+
import './radio.js';
|
|
37
|
+
import './labelSelect.js';
|
|
38
|
+
import './slider.js';
|
|
39
|
+
import './complex.js';
|
|
40
|
+
import './simpleComponent.js';
|
|
41
|
+
import { NSelect } from 'naive-ui';
|
|
42
|
+
import { focusDecorator, assignUpdateValue } from '../../utils/schema2.js';
|
|
43
|
+
|
|
44
|
+
const script = defineComponent({
|
|
45
|
+
name: "FormSearch",
|
|
46
|
+
props: {
|
|
47
|
+
value: {
|
|
48
|
+
type: String
|
|
49
|
+
},
|
|
50
|
+
autograph: {
|
|
51
|
+
type: String,
|
|
52
|
+
required: true
|
|
53
|
+
},
|
|
54
|
+
lazyRequest: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default: true
|
|
57
|
+
},
|
|
58
|
+
wordbook: {
|
|
59
|
+
type: Object,
|
|
60
|
+
required: true
|
|
61
|
+
},
|
|
62
|
+
onFocus: {
|
|
63
|
+
type: Function
|
|
64
|
+
},
|
|
65
|
+
onChange: {}
|
|
66
|
+
},
|
|
67
|
+
emits: ["update:value"],
|
|
68
|
+
setup(props, {
|
|
69
|
+
slots,
|
|
70
|
+
emit
|
|
71
|
+
}) {
|
|
72
|
+
const valueRef = computed({
|
|
73
|
+
get: () => props.value,
|
|
74
|
+
set: (v) => emit("update:value", v)
|
|
75
|
+
});
|
|
76
|
+
const remoteOptions = ref(null);
|
|
77
|
+
const lastSearch = ref("");
|
|
78
|
+
const labelKey = computed(() => {
|
|
79
|
+
var _a, _b, _c;
|
|
80
|
+
return (_c = (_b = (_a = props.wordbook) == null ? void 0 : _a.render_key) == null ? void 0 : _b[0]) != null ? _c : "text";
|
|
81
|
+
});
|
|
82
|
+
const valueKey = computed(() => {
|
|
83
|
+
var _a, _b;
|
|
84
|
+
return (_b = (_a = props.wordbook) == null ? void 0 : _a.value_key) != null ? _b : "value";
|
|
85
|
+
});
|
|
86
|
+
const {
|
|
87
|
+
field,
|
|
88
|
+
fieldKey
|
|
89
|
+
} = useFormField();
|
|
90
|
+
const asyncQueue = inject(InjectAsyncQueue);
|
|
91
|
+
const {
|
|
92
|
+
getSearchRequestInfo
|
|
93
|
+
} = useFormRequest();
|
|
94
|
+
async function fetchData(content) {
|
|
95
|
+
lastSearch.value = content || "";
|
|
96
|
+
if (remoteOptions.value)
|
|
97
|
+
return;
|
|
98
|
+
try {
|
|
99
|
+
remoteOptions.value = await asyncQueue.addAsync(createParams(props.wordbook, props.autograph, field.value, fieldKey.value));
|
|
100
|
+
} catch (e) {
|
|
101
|
+
isString(e) && formRenderLog(e);
|
|
102
|
+
}
|
|
103
|
+
function createParams(wordbook, autograph, field2, key2) {
|
|
104
|
+
const params = {
|
|
105
|
+
autograph,
|
|
106
|
+
wordbookId: wordbook.id,
|
|
107
|
+
wordbookType: wordbook.type,
|
|
108
|
+
fieldKeys: wordbook.search_key,
|
|
109
|
+
keyword: "",
|
|
110
|
+
page: 1
|
|
111
|
+
};
|
|
112
|
+
return {
|
|
113
|
+
...getSearchRequestInfo(),
|
|
114
|
+
params,
|
|
115
|
+
key: key2
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
const parsedOptions = computed(() => {
|
|
120
|
+
return remoteOptions.value ? filterOption(remoteOptions.value, lastSearch.value) : [];
|
|
121
|
+
function filterOption(options, searchContent) {
|
|
122
|
+
return options.filter((option) => {
|
|
123
|
+
return !searchContent || String(option[labelKey.value]).includes(searchContent);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
const changeContextCollector = inject(InjectionChangeContextCollector);
|
|
128
|
+
changeContextCollector.setContext(fieldKey.value, async () => {
|
|
129
|
+
await nextTick();
|
|
130
|
+
return {
|
|
131
|
+
currentOption: cloneDeep(getCurrentOption())
|
|
132
|
+
};
|
|
133
|
+
function getCurrentOption() {
|
|
134
|
+
return parsedOptions.value.find((option) => option[valueKey.value] === valueRef.value);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
watch(() => props.wordbook, (wordbook, oldWordbook) => {
|
|
138
|
+
if (isEqual(wordbook, oldWordbook))
|
|
139
|
+
return;
|
|
140
|
+
remoteOptions.value = null;
|
|
141
|
+
if (!wordbook)
|
|
142
|
+
return;
|
|
143
|
+
(valueRef.value || !props.lazyRequest) && fetchData();
|
|
144
|
+
}, {
|
|
145
|
+
immediate: true
|
|
146
|
+
});
|
|
147
|
+
const {
|
|
148
|
+
injectValueValidate,
|
|
149
|
+
injectValueWatchFromEmpty,
|
|
150
|
+
injectValueBindKey
|
|
151
|
+
} = useCommonInjection();
|
|
152
|
+
injectValueWatchFromEmpty(valueRef, fetchData);
|
|
153
|
+
injectValueValidate(valueRef);
|
|
154
|
+
const key = injectValueBindKey(valueRef);
|
|
155
|
+
return () => createVNode(NSelect, {
|
|
156
|
+
"remote": true,
|
|
157
|
+
"filterable": true,
|
|
158
|
+
"key": key.value,
|
|
159
|
+
"value": valueRef.value,
|
|
160
|
+
"onUpdate:value": ($event) => valueRef.value = $event,
|
|
161
|
+
"labelField": labelKey.value,
|
|
162
|
+
"valueField": valueKey.value,
|
|
163
|
+
"options": parsedOptions.value,
|
|
164
|
+
"onSearch": fetchData,
|
|
165
|
+
"onUpdate:show": (show) => show && fetchData(),
|
|
166
|
+
"onFocus": focusDecorator(field, props.onFocus)
|
|
167
|
+
}, slots);
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
const SEARCH = connect(script, mapProps(assignUpdateValue));
|
|
171
|
+
|
|
172
|
+
export { SEARCH };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { AnyObject, Func } from '../../../../../../es/shared/types';
|
|
1
|
+
import { AnyObject, ArrayAble, Func } from '../../../../../../es/shared/types';
|
|
2
2
|
import { UrlConfig } from '../../types';
|
|
3
3
|
import { PropType } from 'vue';
|
|
4
4
|
export declare const SELECT: import("vue").DefineComponent<{
|
|
5
5
|
value: {
|
|
6
|
-
type:
|
|
6
|
+
type: PropType<ArrayAble<string>>;
|
|
7
7
|
};
|
|
8
8
|
lazyRequest: {
|
|
9
9
|
type: BooleanConstructor;
|
|
@@ -22,7 +22,7 @@ export declare const SELECT: import("vue").DefineComponent<{
|
|
|
22
22
|
onChange: {};
|
|
23
23
|
}, () => 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<{
|
|
24
24
|
value: {
|
|
25
|
-
type:
|
|
25
|
+
type: PropType<ArrayAble<string>>;
|
|
26
26
|
};
|
|
27
27
|
lazyRequest: {
|
|
28
28
|
type: BooleanConstructor;
|
|
@@ -36,14 +36,15 @@ import './labelSelect.js';
|
|
|
36
36
|
import './slider.js';
|
|
37
37
|
import './complex.js';
|
|
38
38
|
import './simpleComponent.js';
|
|
39
|
+
import './search.js';
|
|
39
40
|
import { NSelect } from 'naive-ui';
|
|
40
|
-
import { assignUpdateValue, traverseDependKey } from '../../utils/schema2.js';
|
|
41
|
+
import { focusDecorator, assignUpdateValue, traverseDependKey } from '../../utils/schema2.js';
|
|
41
42
|
|
|
42
43
|
const script = defineComponent({
|
|
43
44
|
name: "FormSelect",
|
|
44
45
|
props: {
|
|
45
46
|
value: {
|
|
46
|
-
type: String
|
|
47
|
+
type: [String, Array]
|
|
47
48
|
},
|
|
48
49
|
lazyRequest: {
|
|
49
50
|
type: Boolean,
|
|
@@ -168,14 +169,6 @@ const script = defineComponent({
|
|
|
168
169
|
injectValueWatchFromEmpty(valueRef, fetchData);
|
|
169
170
|
injectValueValidate(valueRef);
|
|
170
171
|
const key = injectValueBindKey(valueRef);
|
|
171
|
-
function focusDecorator(onFocus) {
|
|
172
|
-
return (...args) => {
|
|
173
|
-
if (isField(field.value)) {
|
|
174
|
-
field.value.visited = true;
|
|
175
|
-
}
|
|
176
|
-
return onFocus == null ? void 0 : onFocus(...args);
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
172
|
return () => createVNode(NSelect, {
|
|
180
173
|
"key": key.value,
|
|
181
174
|
"remote": true,
|
|
@@ -187,7 +180,7 @@ const script = defineComponent({
|
|
|
187
180
|
"options": parsedOptions.value,
|
|
188
181
|
"onSearch": fetchData,
|
|
189
182
|
"onUpdate:show": (show) => show && fetchData(),
|
|
190
|
-
"onFocus": focusDecorator(props.onFocus)
|
|
183
|
+
"onFocus": focusDecorator(field, props.onFocus)
|
|
191
184
|
}, slots);
|
|
192
185
|
}
|
|
193
186
|
});
|
|
@@ -59,13 +59,30 @@ function useFieldListAdaptor(collector) {
|
|
|
59
59
|
};
|
|
60
60
|
const createSelectSchema = (item) => {
|
|
61
61
|
const schema = createStandardSchema(item);
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
options: item.option,
|
|
65
|
-
multiple: item.multi_select === "0",
|
|
66
|
-
maxTagCount: parseNumberFromMaybeString(item.multi_select_value)
|
|
67
|
-
});
|
|
62
|
+
item.autograph ? bindAutoGraphProps(schema, item) : bindUrlProps(schema, item);
|
|
63
|
+
bindCommonProps(schema, item);
|
|
68
64
|
return schema;
|
|
65
|
+
function bindCommonProps(schema2, item2) {
|
|
66
|
+
const multiple = item2.multi_select === "0";
|
|
67
|
+
Object.assign(schema2["x-component-props"], {
|
|
68
|
+
multiple,
|
|
69
|
+
maxTagCount: parseNumberFromMaybeString(item2.multi_select_value)
|
|
70
|
+
});
|
|
71
|
+
multiple && (schema2.type = "array");
|
|
72
|
+
}
|
|
73
|
+
function bindAutoGraphProps(schema2, item2) {
|
|
74
|
+
schema2["x-component"] = "SEARCH";
|
|
75
|
+
Object.assign(schema2["x-component-props"], {
|
|
76
|
+
...pick(item2, ["wordbook", "lazyRequest"]),
|
|
77
|
+
autograph: item2.autograph
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
function bindUrlProps(schema2, item2) {
|
|
81
|
+
Object.assign(schema2["x-component-props"], {
|
|
82
|
+
...pick(item2, ["lazyRequest", "urlConfig"]),
|
|
83
|
+
options: item2.option
|
|
84
|
+
});
|
|
85
|
+
}
|
|
69
86
|
};
|
|
70
87
|
const createRadioSchema = (item) => {
|
|
71
88
|
const schema = createStandardSchema(item);
|
|
@@ -6,7 +6,7 @@ import '../../index2.js';
|
|
|
6
6
|
import * as index from '../components/renderer/index2.js';
|
|
7
7
|
import { useFormRenderLifeCycle } from './useFormRenderLifeCycle2.js';
|
|
8
8
|
import { usePresetScope } from './usePresetScope2.js';
|
|
9
|
-
import { injectOrProvide, uuidGenerator } from '../utils/index.js';
|
|
9
|
+
import { injectOrProvide, uuidGenerator, presetRequestHandler } from '../utils/index.js';
|
|
10
10
|
import { InjectionBusinessCollector, InjectionChangeContextCollector, InjectionFormItemDepsCollector, InjectionFormUUID, InjectionAnnotation, InjectAsyncQueue, InjectionSchemaField } from '../constants/index2.js';
|
|
11
11
|
import { useBusinessBinding } from './useBusinessBinding2.js';
|
|
12
12
|
import { useChangeContext } from './useChangeContext2.js';
|
|
@@ -20,15 +20,7 @@ function useFormContext(props, formModel) {
|
|
|
20
20
|
return callLifeCycle("beforeRequest", cloneDeep(args)) || args[1];
|
|
21
21
|
},
|
|
22
22
|
afterRequest(...args) {
|
|
23
|
-
return callLifeCycle("afterRequest", cloneDeep(args)) ||
|
|
24
|
-
function presetHandler(res) {
|
|
25
|
-
if (!isObject(res))
|
|
26
|
-
throw res;
|
|
27
|
-
const { data, success } = res;
|
|
28
|
-
if (!success)
|
|
29
|
-
throw res;
|
|
30
|
-
return data;
|
|
31
|
-
}
|
|
23
|
+
return callLifeCycle("afterRequest", cloneDeep(args)) || presetRequestHandler(args[1]);
|
|
32
24
|
}
|
|
33
25
|
}));
|
|
34
26
|
const SchemaField = injectOrProvide(InjectionSchemaField, () => createSchemaField({
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import { Func, Nullable } from '../../../../../es/shared/types';
|
|
2
|
+
import { FormRequestType } from '../../../../../es/components/form-render';
|
|
2
3
|
declare type RequestInstance = Record<string, Func>;
|
|
4
|
+
declare type SearchRequestInfo = {
|
|
5
|
+
method: FormRequestType;
|
|
6
|
+
url: string;
|
|
7
|
+
};
|
|
3
8
|
export declare function useFormRequest(): {
|
|
4
9
|
getHttpInstance: () => Nullable<RequestInstance>;
|
|
5
10
|
registGlobHttpInstance: (instance: RequestInstance) => void;
|
|
11
|
+
getSearchRequestInfo: () => {
|
|
12
|
+
method: FormRequestType;
|
|
13
|
+
url: string;
|
|
14
|
+
};
|
|
15
|
+
registGlobSearchInfo: (info: SearchRequestInfo) => void;
|
|
6
16
|
};
|
|
7
17
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
let http = null;
|
|
2
|
+
const searchRequestInfo = { method: "post", url: "" };
|
|
2
3
|
function useFormRequest() {
|
|
3
4
|
function getHttpInstance() {
|
|
4
5
|
return http;
|
|
@@ -6,7 +7,13 @@ function useFormRequest() {
|
|
|
6
7
|
function registGlobHttpInstance(instance) {
|
|
7
8
|
http = instance;
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
+
function getSearchRequestInfo() {
|
|
11
|
+
return { ...searchRequestInfo };
|
|
12
|
+
}
|
|
13
|
+
function registGlobSearchInfo(info) {
|
|
14
|
+
Object.assign(searchRequestInfo, info);
|
|
15
|
+
}
|
|
16
|
+
return { getHttpInstance, registGlobHttpInstance, getSearchRequestInfo, registGlobSearchInfo };
|
|
10
17
|
}
|
|
11
18
|
|
|
12
19
|
export { useFormRequest };
|
|
@@ -63,6 +63,15 @@ interface ReactionType {
|
|
|
63
63
|
};
|
|
64
64
|
[key: string]: any;
|
|
65
65
|
}
|
|
66
|
+
export interface FormWordbook {
|
|
67
|
+
level_num?: number;
|
|
68
|
+
id: string;
|
|
69
|
+
name: string;
|
|
70
|
+
render_key: string[];
|
|
71
|
+
search_key: string[];
|
|
72
|
+
type: string;
|
|
73
|
+
value_key: string;
|
|
74
|
+
}
|
|
66
75
|
export declare type FieldItem = {
|
|
67
76
|
/**
|
|
68
77
|
* 字段的key
|
|
@@ -129,11 +138,10 @@ export declare type FieldItem = {
|
|
|
129
138
|
*/
|
|
130
139
|
multi_select_value: number | string;
|
|
131
140
|
/**
|
|
132
|
-
*
|
|
141
|
+
* 1.用于CASCADER控件提供层级参数
|
|
142
|
+
* 2.用于SEARCH控件提供字段信息
|
|
133
143
|
*/
|
|
134
|
-
wordbook:
|
|
135
|
-
level_num: number;
|
|
136
|
-
};
|
|
144
|
+
wordbook: FormWordbook;
|
|
137
145
|
/**
|
|
138
146
|
* switch控件,开启状态参数
|
|
139
147
|
*/
|
|
@@ -155,6 +163,10 @@ export declare type FieldItem = {
|
|
|
155
163
|
* 控件组
|
|
156
164
|
*/
|
|
157
165
|
suffixConfig: ArrayAble<FieldItem>;
|
|
166
|
+
/**
|
|
167
|
+
* 数据源签名
|
|
168
|
+
*/
|
|
169
|
+
autograph: string;
|
|
158
170
|
/**
|
|
159
171
|
* 数据类型
|
|
160
172
|
*/
|
|
@@ -14,3 +14,4 @@ export declare function createSlot(renderer: unknown, props: AnyObject): Record<
|
|
|
14
14
|
default(): any;
|
|
15
15
|
};
|
|
16
16
|
export declare function createInputSlot(props: AnyObject): import("vue").ComputedRef<Record<string, FunctionalComponent<{}, {}>>>;
|
|
17
|
+
export declare function presetRequestHandler(res: unknown): any;
|
|
@@ -88,5 +88,28 @@ function createInputSlot(props) {
|
|
|
88
88
|
return res;
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
|
+
function presetRequestHandler(res) {
|
|
92
|
+
if (!isObject(res))
|
|
93
|
+
throw res;
|
|
94
|
+
return res.result && res.map ? handlerSearch(res) : handlerSelect(res);
|
|
95
|
+
function handlerSelect(res2) {
|
|
96
|
+
const {
|
|
97
|
+
data,
|
|
98
|
+
success
|
|
99
|
+
} = res2;
|
|
100
|
+
if (!success)
|
|
101
|
+
throw res2;
|
|
102
|
+
return data;
|
|
103
|
+
}
|
|
104
|
+
function handlerSearch(res2) {
|
|
105
|
+
const {
|
|
106
|
+
result,
|
|
107
|
+
map
|
|
108
|
+
} = res2;
|
|
109
|
+
if (result !== "SUCCESS")
|
|
110
|
+
throw res2;
|
|
111
|
+
return map.rows;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
91
114
|
|
|
92
|
-
export { arrayed, createInputSlot, createSlot, formRenderLog, injectOrProvide, mergeDeepProperties, parseNumberFromMaybeString, uuidGenerator };
|
|
115
|
+
export { arrayed, createInputSlot, createSlot, formRenderLog, injectOrProvide, mergeDeepProperties, parseNumberFromMaybeString, presetRequestHandler, uuidGenerator };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { AnyObject } from '../../../../../es/shared/types';
|
|
1
|
+
import { AnyObject, Func } from '../../../../../es/shared/types';
|
|
2
2
|
import { GeneralField } from '@formily/core';
|
|
3
3
|
import { ISchema } from '@formily/json-schema/esm/types';
|
|
4
|
+
import { Ref } from 'vue';
|
|
4
5
|
import { DependKeyType, FieldItem } from '../../../../../es/components/form-render';
|
|
5
6
|
export declare function traverseSchema(schema: ISchema, handler: (_s: ISchema) => void): void;
|
|
6
7
|
export declare function fieldKeyEscape(fieldList: FieldItem[]): string;
|
|
@@ -76,3 +77,4 @@ export declare function createObjSchema(properties: Record<string, ISchema>): {
|
|
|
76
77
|
"x-compile-omitted"?: string[] | undefined;
|
|
77
78
|
}>>;
|
|
78
79
|
};
|
|
80
|
+
export declare function focusDecorator(field: Ref<GeneralField>, onFocus?: Func): (...args: unknown[]) => any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { assignUpdateValue, assignValueBindKey, createLinebarId, createObjSchema, dotEscape, fieldKeyEscape, getParentLinebar, traverseDependKey, traverseSchema } from './schema2.js';
|
|
1
|
+
export { assignUpdateValue, assignValueBindKey, createLinebarId, createObjSchema, dotEscape, fieldKeyEscape, focusDecorator, getParentLinebar, traverseDependKey, traverseSchema } from './schema2.js';
|
|
@@ -89,5 +89,13 @@ function assignValueBindKey(props, field) {
|
|
|
89
89
|
function createObjSchema(properties) {
|
|
90
90
|
return { type: "object", properties };
|
|
91
91
|
}
|
|
92
|
+
function focusDecorator(field, onFocus) {
|
|
93
|
+
return (...args) => {
|
|
94
|
+
if (isField(field.value)) {
|
|
95
|
+
field.value.visited = true;
|
|
96
|
+
}
|
|
97
|
+
return onFocus == null ? void 0 : onFocus(...args);
|
|
98
|
+
};
|
|
99
|
+
}
|
|
92
100
|
|
|
93
|
-
export { assignUpdateValue, assignValueBindKey, createLinebarId, createObjSchema, dotEscape, fieldKeyEscape, getParentLinebar, traverseDependKey, traverseSchema };
|
|
101
|
+
export { assignUpdateValue, assignValueBindKey, createLinebarId, createObjSchema, dotEscape, fieldKeyEscape, focusDecorator, getParentLinebar, traverseDependKey, traverseSchema };
|
|
@@ -217,7 +217,7 @@ declare const FormTable: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
217
217
|
[x: symbol]: never;
|
|
218
218
|
}, {
|
|
219
219
|
mergedClsPrefix: import("vue").ComputedRef<string>;
|
|
220
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
220
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
221
221
|
[x: string]: never;
|
|
222
222
|
[x: number]: never;
|
|
223
223
|
[x: symbol]: never;
|
|
@@ -217,7 +217,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
217
217
|
[x: symbol]: never;
|
|
218
218
|
}, {
|
|
219
219
|
mergedClsPrefix: import("vue").ComputedRef<string>;
|
|
220
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
220
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
221
221
|
[x: string]: never;
|
|
222
222
|
[x: number]: never;
|
|
223
223
|
[x: symbol]: never;
|
|
@@ -170,7 +170,7 @@ export declare function useComponents(): {
|
|
|
170
170
|
[x: symbol]: never;
|
|
171
171
|
}, {
|
|
172
172
|
mergedClsPrefix: import("vue").ComputedRef<string>;
|
|
173
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
173
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
174
174
|
[x: string]: never;
|
|
175
175
|
[x: number]: never;
|
|
176
176
|
[x: symbol]: never;
|
|
@@ -170,7 +170,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
170
170
|
[x: symbol]: never;
|
|
171
171
|
}, {
|
|
172
172
|
mergedClsPrefix: import("vue").ComputedRef<string>;
|
|
173
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
173
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
174
174
|
[x: string]: never;
|
|
175
175
|
[x: number]: never;
|
|
176
176
|
[x: symbol]: never;
|