cnhis-design-vue 3.1.29 → 3.1.30-beta.1
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/es/components/field-set/src/FieldSet.js +4 -2
- package/es/components/form-render/index.js +1 -1
- package/es/components/form-render/src/components/renderer/index.js +2 -0
- package/es/components/form-render/src/components/renderer/input.js +3 -5
- package/es/components/form-render/src/components/renderer/levelSearchCascade.js +3 -5
- package/es/components/form-render/src/components/renderer/remoteSearch.d.ts +47 -0
- package/es/components/form-render/src/components/renderer/remoteSearch.js +134 -0
- package/es/components/form-render/src/components/renderer/search.js +3 -6
- package/es/components/form-render/src/components/renderer/select.d.ts +2 -2
- package/es/components/form-render/src/components/renderer/select.js +12 -36
- package/es/components/form-render/src/hooks/useFieldListAdaptor.js +1 -0
- package/es/components/form-render/src/utils/index.d.ts +15 -1
- package/es/components/form-render/src/utils/index.js +32 -2
- package/es/components/index.js +1 -1
- package/es/components/keyboard/src/Keyboard.js +12 -9
- package/package.json +2 -2
|
@@ -398,7 +398,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
398
398
|
withDirectives(createVNode(unref(NInput), {
|
|
399
399
|
value: element.alias,
|
|
400
400
|
"onUpdate:value": ($event) => element.alias = $event,
|
|
401
|
-
style: { width: "90%" }
|
|
401
|
+
style: { width: "90%" },
|
|
402
|
+
clearable: ""
|
|
402
403
|
}, null, 8, ["value", "onUpdate:value"]), [
|
|
403
404
|
[vShow, element.id != "0001"]
|
|
404
405
|
])
|
|
@@ -408,7 +409,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
408
409
|
createVNode(unref(NInputNumber), {
|
|
409
410
|
value: element.columnWidth,
|
|
410
411
|
"onUpdate:value": ($event) => element.columnWidth = $event,
|
|
411
|
-
style: { width: "120px" }
|
|
412
|
+
style: { width: "120px" },
|
|
413
|
+
clearable: ""
|
|
412
414
|
}, null, 8, ["value", "onUpdate:value"])
|
|
413
415
|
])
|
|
414
416
|
], 12, _hoisted_13)) : createCommentVNode("v-if", true)
|
|
@@ -16,7 +16,7 @@ export { useAnchor } from './src/hooks/useAnchor.js';
|
|
|
16
16
|
export { useAutographOptions } from './src/hooks/useAutographOptions.js';
|
|
17
17
|
export { useFormContext } from './src/hooks/useFormContext.js';
|
|
18
18
|
export { useCommonInjection, useSelectOptionProps } from './src/hooks/useCommonInjection.js';
|
|
19
|
-
export { combineExtendKey, createInputSlot, createSlot, formRenderLog, injectOrProvide, isNestedFieldType, isNestedType, mergeDeepProperties, optionMatcher, parseNumberFromMaybeString, presetRequestHandler, splitExtendKey, validateMessageParser } from './src/utils/index.js';
|
|
19
|
+
export { combineExtendKey, createInputSlot, createSlot, createUrlConfigParams, formRenderLog, injectOrProvide, isNestedFieldType, isNestedType, mergeDeepProperties, optionMatcher, parseNumberFromMaybeString, presetRequestHandler, splitExtendKey, validateMessageParser } from './src/utils/index.js';
|
|
20
20
|
export * from '@formily/core';
|
|
21
21
|
export { businessDateParser, isIdCard, isMobile, parseAge2Birthday, parseAge2FromContext, parseBirthday, parseIdCard, transformDateFormat } from './src/utils/business.js';
|
|
22
22
|
export { findNextWidget, queryDecorator, queryInput } from './src/utils/dom.js';
|
|
@@ -11,6 +11,7 @@ import * as labelSelect from './labelSelect.js';
|
|
|
11
11
|
import * as levelSearchCascade from './levelSearchCascade.js';
|
|
12
12
|
import * as index$1 from './lineBar/index.js';
|
|
13
13
|
import * as radio from './radio.js';
|
|
14
|
+
import * as remoteSearch from './remoteSearch.js';
|
|
14
15
|
import * as search from './search.js';
|
|
15
16
|
import * as searchCascade from './searchCascade.js';
|
|
16
17
|
import * as select from './select.js';
|
|
@@ -34,6 +35,7 @@ const modules = Object.assign({
|
|
|
34
35
|
"./levelSearchCascade.tsx": levelSearchCascade,
|
|
35
36
|
"./lineBar/index.ts": index$1,
|
|
36
37
|
"./radio.tsx": radio,
|
|
38
|
+
"./remoteSearch.tsx": remoteSearch,
|
|
37
39
|
"./search.tsx": search,
|
|
38
40
|
"./searchCascade.tsx": searchCascade,
|
|
39
41
|
"./select.tsx": select,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { defineComponent,
|
|
1
|
+
import { defineComponent, createVNode } from 'vue';
|
|
2
|
+
import { useVModel } from '@vueuse/core';
|
|
2
3
|
import { useCommonInjection } from '../../hooks/useCommonInjection.js';
|
|
3
4
|
import { createInputSlot } from '../../utils/index.js';
|
|
4
5
|
import { connect, mapProps } from '@formily/vue';
|
|
@@ -22,10 +23,7 @@ const script = defineComponent({
|
|
|
22
23
|
setup(props, {
|
|
23
24
|
emit
|
|
24
25
|
}) {
|
|
25
|
-
const valueRef =
|
|
26
|
-
get: () => props.value,
|
|
27
|
-
set: (v) => emit("update:value", v)
|
|
28
|
-
});
|
|
26
|
+
const valueRef = useVModel(props, "value", emit);
|
|
29
27
|
const key = useCommonInjection().injectValueBindKey(valueRef);
|
|
30
28
|
const _slots = createInputSlot(props, (v) => {
|
|
31
29
|
return [createVNode("i", {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { defineComponent,
|
|
1
|
+
import { defineComponent, ref, computed, inject, watch, createVNode } from 'vue';
|
|
2
|
+
import { useVModel } from '@vueuse/core';
|
|
2
3
|
import { isEqual, isString, isEmpty, isFunction, omit } from 'lodash-es';
|
|
3
4
|
import '../../../index.js';
|
|
4
5
|
import { InjectionAsyncQueue } from '../../constants/index.js';
|
|
@@ -46,10 +47,7 @@ const script = defineComponent({
|
|
|
46
47
|
setup(props, {
|
|
47
48
|
emit
|
|
48
49
|
}) {
|
|
49
|
-
const valueRef =
|
|
50
|
-
get: () => props.value,
|
|
51
|
-
set: (v) => emit("update:value", v)
|
|
52
|
-
});
|
|
50
|
+
const valueRef = useVModel(props, "value", emit);
|
|
53
51
|
const showRef = ref(false);
|
|
54
52
|
const optionsRef = ref([]);
|
|
55
53
|
const {
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { AnyObject, Func } from '../../../../../../es/shared/types';
|
|
2
|
+
import { PropType } from 'vue';
|
|
3
|
+
import { UrlConfig } from '../../../../../../es/components/form-render';
|
|
4
|
+
export declare const REMOTE_SEARCH: import("vue").DefineComponent<{
|
|
5
|
+
value: {
|
|
6
|
+
type: PropType<String | null>;
|
|
7
|
+
};
|
|
8
|
+
requestCache: {
|
|
9
|
+
type: BooleanConstructor;
|
|
10
|
+
default: boolean;
|
|
11
|
+
};
|
|
12
|
+
options: {
|
|
13
|
+
type: PropType<AnyObject[]>;
|
|
14
|
+
default: () => never[];
|
|
15
|
+
};
|
|
16
|
+
urlConfig: {
|
|
17
|
+
type: PropType<UrlConfig>;
|
|
18
|
+
};
|
|
19
|
+
onFocus: {
|
|
20
|
+
type: PropType<Func<any[], any>>;
|
|
21
|
+
};
|
|
22
|
+
onChange: {};
|
|
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
|
+
value: {
|
|
25
|
+
type: PropType<String | null>;
|
|
26
|
+
};
|
|
27
|
+
requestCache: {
|
|
28
|
+
type: BooleanConstructor;
|
|
29
|
+
default: boolean;
|
|
30
|
+
};
|
|
31
|
+
options: {
|
|
32
|
+
type: PropType<AnyObject[]>;
|
|
33
|
+
default: () => never[];
|
|
34
|
+
};
|
|
35
|
+
urlConfig: {
|
|
36
|
+
type: PropType<UrlConfig>;
|
|
37
|
+
};
|
|
38
|
+
onFocus: {
|
|
39
|
+
type: PropType<Func<any[], any>>;
|
|
40
|
+
};
|
|
41
|
+
onChange: {};
|
|
42
|
+
}>> & {
|
|
43
|
+
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
44
|
+
}, {
|
|
45
|
+
options: AnyObject[];
|
|
46
|
+
requestCache: boolean;
|
|
47
|
+
}>;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { defineComponent, ref, computed, inject, watch, createVNode } from 'vue';
|
|
2
|
+
import { connect, mapProps } from '@formily/vue';
|
|
3
|
+
import { useVModel, useDebounceFn } from '@vueuse/core';
|
|
4
|
+
import { isString, isArray, isEqual } from 'lodash-es';
|
|
5
|
+
import { NSelect } from 'naive-ui';
|
|
6
|
+
import '../../../index.js';
|
|
7
|
+
import { InjectionAsyncQueue, InjectionFormItemDepsCollector } from '../../constants/index.js';
|
|
8
|
+
import { createUrlConfigParams, formRenderLog } from '../../utils/index.js';
|
|
9
|
+
import { useCommonInjection, useSelectOptionProps } from '../../hooks/useCommonInjection.js';
|
|
10
|
+
import { useFormField } from '../../hooks/useFormField.js';
|
|
11
|
+
import { visitedDecorator, assignUpdateValue, assignClearBindVisited } from '../../utils/schema.js';
|
|
12
|
+
|
|
13
|
+
const script = defineComponent({
|
|
14
|
+
name: "FormRemoteSearch",
|
|
15
|
+
props: {
|
|
16
|
+
value: {
|
|
17
|
+
type: String
|
|
18
|
+
},
|
|
19
|
+
requestCache: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: true
|
|
22
|
+
},
|
|
23
|
+
options: {
|
|
24
|
+
type: Array,
|
|
25
|
+
default: () => []
|
|
26
|
+
},
|
|
27
|
+
urlConfig: {
|
|
28
|
+
type: Object
|
|
29
|
+
},
|
|
30
|
+
onFocus: {
|
|
31
|
+
type: Function
|
|
32
|
+
},
|
|
33
|
+
onChange: {}
|
|
34
|
+
},
|
|
35
|
+
emits: ["update:value"],
|
|
36
|
+
setup(props, {
|
|
37
|
+
slots,
|
|
38
|
+
emit
|
|
39
|
+
}) {
|
|
40
|
+
const valueRef = useVModel(props, "value", emit);
|
|
41
|
+
const {
|
|
42
|
+
field,
|
|
43
|
+
fieldKey
|
|
44
|
+
} = useFormField();
|
|
45
|
+
const remoteOptions = ref(null);
|
|
46
|
+
const labelKey = computed(() => {
|
|
47
|
+
var _a, _b;
|
|
48
|
+
return (_b = (_a = props.urlConfig) == null ? void 0 : _a.nameKey) != null ? _b : "text";
|
|
49
|
+
});
|
|
50
|
+
const valueKey = computed(() => {
|
|
51
|
+
var _a, _b;
|
|
52
|
+
return (_b = (_a = props.urlConfig) == null ? void 0 : _a.valueKey) != null ? _b : "value";
|
|
53
|
+
});
|
|
54
|
+
const asyncQueue = inject(InjectionAsyncQueue);
|
|
55
|
+
const fetchData = useDebounceFn(async (content = "", contentType = "label") => {
|
|
56
|
+
if (!props.urlConfig) {
|
|
57
|
+
return remoteOptions.value = null;
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
remoteOptions.value = await asyncQueue.addAsync(await createUrlConfigParams({
|
|
61
|
+
config: {
|
|
62
|
+
...props.urlConfig,
|
|
63
|
+
params: {
|
|
64
|
+
...props.urlConfig.params,
|
|
65
|
+
[contentType === "value" ? valueKey.value : "keyword"]: content
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
cache: props.requestCache,
|
|
69
|
+
field: field.value
|
|
70
|
+
}));
|
|
71
|
+
console.log(remoteOptions.value);
|
|
72
|
+
} catch (e) {
|
|
73
|
+
isString(e) && formRenderLog(e);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
const parsedOptions = computed(() => {
|
|
77
|
+
if (isArray(remoteOptions.value))
|
|
78
|
+
return remoteOptions.value;
|
|
79
|
+
if (isArray(props.options))
|
|
80
|
+
return props.options;
|
|
81
|
+
return [];
|
|
82
|
+
});
|
|
83
|
+
const {
|
|
84
|
+
injectValueValidate,
|
|
85
|
+
injectValueBindKey
|
|
86
|
+
} = useCommonInjection();
|
|
87
|
+
injectValueValidate(valueRef);
|
|
88
|
+
const key = injectValueBindKey(valueRef);
|
|
89
|
+
watch(valueRef, (value) => {
|
|
90
|
+
if (!value || parsedOptions.value.find((option) => option[valueKey.value] === value))
|
|
91
|
+
return;
|
|
92
|
+
return fetchData(value, "value");
|
|
93
|
+
});
|
|
94
|
+
const formItemDepsCollector = inject(InjectionFormItemDepsCollector);
|
|
95
|
+
watch(() => props.urlConfig, (config, oldConfig) => {
|
|
96
|
+
if (isEqual(config, oldConfig))
|
|
97
|
+
return;
|
|
98
|
+
remoteOptions.value = null;
|
|
99
|
+
if (!config)
|
|
100
|
+
return;
|
|
101
|
+
formItemDepsCollector.setDeps(fieldKey.value, config.dependKey || [], async () => {
|
|
102
|
+
remoteOptions.value = null;
|
|
103
|
+
valueRef.value = null;
|
|
104
|
+
});
|
|
105
|
+
valueRef.value && fetchData(valueRef.value, "value");
|
|
106
|
+
}, {
|
|
107
|
+
immediate: true
|
|
108
|
+
});
|
|
109
|
+
const {
|
|
110
|
+
menuProps,
|
|
111
|
+
nodeProps
|
|
112
|
+
} = useSelectOptionProps();
|
|
113
|
+
return () => {
|
|
114
|
+
return createVNode(NSelect, {
|
|
115
|
+
"remote": true,
|
|
116
|
+
"filterable": true,
|
|
117
|
+
"key": key.value,
|
|
118
|
+
"value": valueRef.value,
|
|
119
|
+
"onUpdate:value": ($event) => valueRef.value = $event,
|
|
120
|
+
"labelField": labelKey.value,
|
|
121
|
+
"valueField": valueKey.value,
|
|
122
|
+
"menu-props": menuProps,
|
|
123
|
+
"node-props": nodeProps,
|
|
124
|
+
"onSearch": fetchData,
|
|
125
|
+
"onUpdate:show": (show) => show && fetchData(),
|
|
126
|
+
"options": parsedOptions.value,
|
|
127
|
+
"onFocus": visitedDecorator(field, props.onFocus)
|
|
128
|
+
}, slots);
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
const REMOTE_SEARCH = connect(script, mapProps(assignUpdateValue, assignClearBindVisited));
|
|
133
|
+
|
|
134
|
+
export { REMOTE_SEARCH };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent,
|
|
1
|
+
import { defineComponent, inject, createVNode } from 'vue';
|
|
2
|
+
import { useVModel } from '@vueuse/core';
|
|
2
3
|
import { cloneDeep } from 'lodash-es';
|
|
3
4
|
import { InjectionChangeContextCollector } from '../../constants/index.js';
|
|
4
5
|
import '../../../../../shared/utils/index.js';
|
|
5
6
|
import '../../../index.js';
|
|
6
7
|
import '../../utils/index.js';
|
|
7
8
|
import { useFormField } from '../../hooks/useFormField.js';
|
|
8
|
-
import '@vueuse/core';
|
|
9
9
|
import '../../../../../shared/utils/tapable/SyncHook.js';
|
|
10
10
|
import '../../../../../shared/utils/tapable/SyncBailHook.js';
|
|
11
11
|
import '../../../../../shared/utils/tapable/SyncWaterfallHook.js';
|
|
@@ -58,10 +58,7 @@ const script = defineComponent({
|
|
|
58
58
|
slots,
|
|
59
59
|
emit
|
|
60
60
|
}) {
|
|
61
|
-
const valueRef =
|
|
62
|
-
get: () => props.value,
|
|
63
|
-
set: (v) => emit("update:value", v)
|
|
64
|
-
});
|
|
61
|
+
const valueRef = useVModel(props, "value", emit);
|
|
65
62
|
const {
|
|
66
63
|
field,
|
|
67
64
|
fieldKey
|
|
@@ -3,7 +3,7 @@ import { UrlConfig } from '../../types';
|
|
|
3
3
|
import { PropType } from 'vue';
|
|
4
4
|
export declare const SELECT: import("vue").DefineComponent<{
|
|
5
5
|
value: {
|
|
6
|
-
type: PropType<ArrayAble<string
|
|
6
|
+
type: PropType<ArrayAble<string> | null>;
|
|
7
7
|
};
|
|
8
8
|
lazyRequest: {
|
|
9
9
|
type: BooleanConstructor;
|
|
@@ -26,7 +26,7 @@ export declare const SELECT: import("vue").DefineComponent<{
|
|
|
26
26
|
onChange: {};
|
|
27
27
|
}, () => 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<{
|
|
28
28
|
value: {
|
|
29
|
-
type: PropType<ArrayAble<string
|
|
29
|
+
type: PropType<ArrayAble<string> | null>;
|
|
30
30
|
};
|
|
31
31
|
lazyRequest: {
|
|
32
32
|
type: BooleanConstructor;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { defineComponent,
|
|
2
|
-
import {
|
|
3
|
-
import { useDebounceFn } from '@vueuse/core';
|
|
1
|
+
import { defineComponent, ref, computed, inject, watch, createVNode } from 'vue';
|
|
2
|
+
import { useVModel, useDebounceFn } from '@vueuse/core';
|
|
4
3
|
import { isString, cloneDeep, isEqual } from 'lodash-es';
|
|
5
4
|
import { useCommonInjection, useSelectOptionProps } from '../../hooks/useCommonInjection.js';
|
|
6
5
|
import { InjectionAsyncQueue, InjectionChangeContextCollector, InjectionFormItemDepsCollector } from '../../constants/index.js';
|
|
7
6
|
import '../../../../../shared/utils/index.js';
|
|
8
7
|
import '../../../index.js';
|
|
9
|
-
import { formRenderLog, optionMatcher } from '../../utils/index.js';
|
|
8
|
+
import { createUrlConfigParams, formRenderLog, optionMatcher } from '../../utils/index.js';
|
|
10
9
|
import { useFormField } from '../../hooks/useFormField.js';
|
|
11
10
|
import '../../../../../shared/utils/tapable/SyncHook.js';
|
|
12
11
|
import '../../../../../shared/utils/tapable/SyncBailHook.js';
|
|
@@ -19,11 +18,12 @@ import '../../../../../shared/utils/tapable/AsyncSeriesBailHook.js';
|
|
|
19
18
|
import '../../../../../shared/utils/tapable/AsyncSeriesLoopHook.js';
|
|
20
19
|
import '../../../../../shared/utils/tapable/AsyncSeriesWaterfallHook.js';
|
|
21
20
|
import '../../hooks/useFormValidator.js';
|
|
21
|
+
import '@formily/core';
|
|
22
22
|
import '@vue/shared';
|
|
23
23
|
import { connect, mapProps } from '@formily/vue';
|
|
24
24
|
import './index.js';
|
|
25
25
|
import { NSelect } from 'naive-ui';
|
|
26
|
-
import {
|
|
26
|
+
import { visitedDecorator, assignUpdateValue, assignClearBindVisited } from '../../utils/schema.js';
|
|
27
27
|
|
|
28
28
|
const script = defineComponent({
|
|
29
29
|
name: "FormSelect",
|
|
@@ -56,10 +56,7 @@ const script = defineComponent({
|
|
|
56
56
|
slots,
|
|
57
57
|
emit
|
|
58
58
|
}) {
|
|
59
|
-
const valueRef =
|
|
60
|
-
get: () => props.value,
|
|
61
|
-
set: (v) => emit("update:value", v)
|
|
62
|
-
});
|
|
59
|
+
const valueRef = useVModel(props, "value", emit);
|
|
63
60
|
const remoteOptions = ref(null);
|
|
64
61
|
const lastSearch = ref("");
|
|
65
62
|
const labelKey = computed(() => {
|
|
@@ -77,41 +74,20 @@ const script = defineComponent({
|
|
|
77
74
|
const asyncQueue = inject(InjectionAsyncQueue);
|
|
78
75
|
const fetchData = useDebounceFn(async function(content) {
|
|
79
76
|
lastSearch.value = content || "";
|
|
80
|
-
if (!
|
|
77
|
+
if (!props.urlConfig) {
|
|
81
78
|
return remoteOptions.value = null;
|
|
82
79
|
}
|
|
83
80
|
if (remoteOptions.value && props.requestCache)
|
|
84
81
|
return;
|
|
85
82
|
try {
|
|
86
|
-
remoteOptions.value = await asyncQueue.addAsync(await
|
|
83
|
+
remoteOptions.value = await asyncQueue.addAsync(await createUrlConfigParams({
|
|
84
|
+
config: props.urlConfig,
|
|
85
|
+
cache: props.requestCache,
|
|
86
|
+
field: field.value
|
|
87
|
+
}));
|
|
87
88
|
} catch (e) {
|
|
88
89
|
isString(e) && formRenderLog(e);
|
|
89
90
|
}
|
|
90
|
-
async function createParams(config, field2, key2) {
|
|
91
|
-
const _params = {};
|
|
92
|
-
try {
|
|
93
|
-
traverseDependKey(config.dependKey, (dependKey, valueKey2, required) => {
|
|
94
|
-
const _field = field2.query(dependKey).take();
|
|
95
|
-
if (!isField(_field))
|
|
96
|
-
return;
|
|
97
|
-
if (required && _field.value == null) {
|
|
98
|
-
throw `\u7F3A\u5C11\u5FC5\u987B\u7684\u53C2\u6570=>${dependKey}`;
|
|
99
|
-
}
|
|
100
|
-
_params[valueKey2] = _field.value;
|
|
101
|
-
});
|
|
102
|
-
} catch (e) {
|
|
103
|
-
return Promise.reject(e);
|
|
104
|
-
}
|
|
105
|
-
return {
|
|
106
|
-
...config,
|
|
107
|
-
params: Object.assign({}, config.params, _params),
|
|
108
|
-
key: key2,
|
|
109
|
-
cache: props.requestCache
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
function configFor(target) {
|
|
113
|
-
return target.urlConfig;
|
|
114
|
-
}
|
|
115
91
|
}, 300);
|
|
116
92
|
const parsedOptions = computed(() => {
|
|
117
93
|
if (remoteOptions.value)
|
|
@@ -219,6 +219,7 @@ function useFieldListAdaptor(collector) {
|
|
|
219
219
|
["INPUT", createInputSchema],
|
|
220
220
|
["INPUT_NUMBER", createInputNumberSchema],
|
|
221
221
|
["SELECT", createSelectSchema],
|
|
222
|
+
["REMOTE_SEARCH", createSelectSchema],
|
|
222
223
|
["DATE", createDateSchema],
|
|
223
224
|
["LEVEL_SEARCH_CASCADE", createLevelSearchCascadeSchema],
|
|
224
225
|
["SEARCH_CASCADE", createSearchCascadeSchema],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AnyObject, ArrayAble, Nullable } from '../../../../../es/shared/types';
|
|
2
2
|
import { GeneralField } from '@formily/core';
|
|
3
3
|
import { FunctionalComponent, InjectionKey, VNode } from 'vue';
|
|
4
|
-
import { FieldItem } from '../types';
|
|
4
|
+
import { FieldItem, UrlConfig } from '../types';
|
|
5
5
|
export * from './business';
|
|
6
6
|
export * from './dom';
|
|
7
7
|
export * from './schema';
|
|
@@ -22,3 +22,17 @@ export declare function combineExtendKey(fieldList: FieldItem[], values: AnyObje
|
|
|
22
22
|
export declare function splitExtendKey(fieldList: FieldItem[], values: AnyObject): AnyObject;
|
|
23
23
|
export declare function isNestedType(type?: string): boolean | "" | undefined;
|
|
24
24
|
export declare function isNestedFieldType(field: FieldItem | GeneralField): boolean | "" | undefined;
|
|
25
|
+
export declare function createUrlConfigParams({ config, field, cache }: {
|
|
26
|
+
config: UrlConfig;
|
|
27
|
+
field: GeneralField;
|
|
28
|
+
cache?: boolean;
|
|
29
|
+
}): Promise<{
|
|
30
|
+
params: AnyObject;
|
|
31
|
+
key: string;
|
|
32
|
+
cache: boolean | undefined;
|
|
33
|
+
url: string;
|
|
34
|
+
method?: import("../../../../../es/components/form-render").FormRequestType | undefined;
|
|
35
|
+
nameKey?: string | undefined;
|
|
36
|
+
valueKey?: string | undefined;
|
|
37
|
+
dependKey?: import("../../../../../es/components/form-render").DependKeyType | undefined;
|
|
38
|
+
}>;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { inject, provide, computed, createVNode, Fragment } from 'vue';
|
|
2
2
|
import { arrayed } from '../../../../shared/utils/index.js';
|
|
3
|
-
import { isGeneralField } from '@formily/core';
|
|
3
|
+
import { isGeneralField, isField } from '@formily/core';
|
|
4
4
|
import { Path } from '@formily/path';
|
|
5
5
|
import { isObject } from '@vue/shared';
|
|
6
6
|
import { useMemoize } from '@vueuse/core';
|
|
7
7
|
import { isString, isFunction, omit } from 'lodash-es';
|
|
8
|
+
import '../../index.js';
|
|
8
9
|
import { NESTED_FORM_ITEM_TYPE } from '../constants/index.js';
|
|
9
10
|
import 'date-fns';
|
|
11
|
+
import { traverseDependKey } from './schema.js';
|
|
12
|
+
export { assignClearBindVisited, assignUpdateValue, assignValueBindKey, createLinebarId, createObjSchema, dotEscape, fieldKeyEscape, getParentLinebar, traverseDependKey, traverseSchema, visitedDecorator } from './schema.js';
|
|
10
13
|
|
|
11
14
|
function formRenderLog(message) {
|
|
12
15
|
console.warn(`[FormRender]: ${message}`);
|
|
@@ -197,5 +200,32 @@ function isNestedType(type) {
|
|
|
197
200
|
function isNestedFieldType(field) {
|
|
198
201
|
return isNestedType(isGeneralField(field) ? field.componentType : field.html_type);
|
|
199
202
|
}
|
|
203
|
+
async function createUrlConfigParams({
|
|
204
|
+
config,
|
|
205
|
+
field,
|
|
206
|
+
cache
|
|
207
|
+
}) {
|
|
208
|
+
const _params = {};
|
|
209
|
+
const key = field.props.name.toString();
|
|
210
|
+
try {
|
|
211
|
+
traverseDependKey(config.dependKey || [], (dependKey, valueKey, required) => {
|
|
212
|
+
const _field = field.query(dependKey).take();
|
|
213
|
+
if (!isField(_field))
|
|
214
|
+
return;
|
|
215
|
+
if (required && _field.value == null) {
|
|
216
|
+
throw `\u7F3A\u5C11\u5FC5\u987B\u7684\u53C2\u6570=>${dependKey}`;
|
|
217
|
+
}
|
|
218
|
+
_params[valueKey] = _field.value;
|
|
219
|
+
});
|
|
220
|
+
} catch (e) {
|
|
221
|
+
return Promise.reject(e);
|
|
222
|
+
}
|
|
223
|
+
return {
|
|
224
|
+
...config,
|
|
225
|
+
params: Object.assign({}, config.params, _params),
|
|
226
|
+
key,
|
|
227
|
+
cache
|
|
228
|
+
};
|
|
229
|
+
}
|
|
200
230
|
|
|
201
|
-
export { combineExtendKey, createInputSlot, createSlot, formRenderLog, injectOrProvide, isNestedFieldType, isNestedType, mergeDeepProperties, optionMatcher, parseNumberFromMaybeString, presetRequestHandler, splitExtendKey, validateMessageParser };
|
|
231
|
+
export { combineExtendKey, createInputSlot, createSlot, createUrlConfigParams, formRenderLog, injectOrProvide, isNestedFieldType, isNestedType, mergeDeepProperties, optionMatcher, parseNumberFromMaybeString, presetRequestHandler, splitExtendKey, validateMessageParser };
|
package/es/components/index.js
CHANGED
|
@@ -60,7 +60,7 @@ export { useCommonInjection, useSelectOptionProps } from './form-render/src/hook
|
|
|
60
60
|
export { businessDateParser, isIdCard, isMobile, parseAge2Birthday, parseAge2FromContext, parseBirthday, parseIdCard, transformDateFormat } from './form-render/src/utils/business.js';
|
|
61
61
|
export { findNextWidget, queryDecorator, queryInput } from './form-render/src/utils/dom.js';
|
|
62
62
|
export { assignClearBindVisited, assignUpdateValue, assignValueBindKey, createLinebarId, createObjSchema, dotEscape, fieldKeyEscape, getParentLinebar, traverseDependKey, traverseSchema, visitedDecorator } from './form-render/src/utils/schema.js';
|
|
63
|
-
export { combineExtendKey, createInputSlot, createSlot, formRenderLog, injectOrProvide, isNestedFieldType, isNestedType, mergeDeepProperties, optionMatcher, parseNumberFromMaybeString, presetRequestHandler, splitExtendKey, validateMessageParser } from './form-render/src/utils/index.js';
|
|
63
|
+
export { combineExtendKey, createInputSlot, createSlot, createUrlConfigParams, formRenderLog, injectOrProvide, isNestedFieldType, isNestedType, mergeDeepProperties, optionMatcher, parseNumberFromMaybeString, presetRequestHandler, splitExtendKey, validateMessageParser } from './form-render/src/utils/index.js';
|
|
64
64
|
export * from '@formily/core';
|
|
65
65
|
export { GlobalShortcutProvider, ShortcutManager, useShortcuts } from './shortcut-provider/src/hooks/useShortcuts.js';
|
|
66
66
|
export { useShortcutSignature } from './shortcut-provider/src/hooks/useShortcutSignature.js';
|
|
@@ -28,13 +28,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
28
28
|
props: {
|
|
29
29
|
mode: { type: String, default: "default" }
|
|
30
30
|
},
|
|
31
|
-
emits: [
|
|
31
|
+
emits: [
|
|
32
|
+
"change",
|
|
33
|
+
"keydown"
|
|
34
|
+
],
|
|
32
35
|
setup(__props, { emit }) {
|
|
33
36
|
const props = __props;
|
|
34
37
|
const NUMBERKEYS = "1234567890.";
|
|
35
38
|
const DAYS = [3, 7, 14, 30];
|
|
36
39
|
const ENGLISHKEY = "QWERTYUIOPASDFGHJKLZXCVBNM.";
|
|
37
|
-
const ENGLISHOTHERKEY = ["
|
|
40
|
+
const ENGLISHOTHERKEY = ["Switch", " ", "Undo", "Enter"];
|
|
38
41
|
const ENGLISHKEYS = ENGLISHKEY.split("").concat(ENGLISHOTHERKEY);
|
|
39
42
|
const ENGLISHKEYS_ = ENGLISHKEY.split(".")[0].split("").sort().concat(["."], ENGLISHOTHERKEY);
|
|
40
43
|
const popoverRef = ref(null);
|
|
@@ -54,7 +57,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
54
57
|
function keydown(key) {
|
|
55
58
|
var _a, _b, _c;
|
|
56
59
|
if (props.mode === "default") {
|
|
57
|
-
if (key !== "
|
|
60
|
+
if (key !== "Switch") {
|
|
58
61
|
emit("keydown", key);
|
|
59
62
|
} else {
|
|
60
63
|
englishKeys.value = englishKeys.value[0] === "Q" ? ENGLISHKEYS_.slice() : ENGLISHKEYS.slice();
|
|
@@ -62,11 +65,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
62
65
|
return;
|
|
63
66
|
}
|
|
64
67
|
switch (key) {
|
|
65
|
-
case "
|
|
68
|
+
case "Undo": {
|
|
66
69
|
undo();
|
|
67
70
|
break;
|
|
68
71
|
}
|
|
69
|
-
case "
|
|
72
|
+
case "Enter":
|
|
70
73
|
value.value = +inputValue.value;
|
|
71
74
|
(_a = popoverRef.value) == null ? void 0 : _a.setShow(false);
|
|
72
75
|
emit("change", value.value);
|
|
@@ -131,13 +134,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
131
134
|
default: withCtx(() => [
|
|
132
135
|
createElementVNode("span", {
|
|
133
136
|
class: "opt",
|
|
134
|
-
onClick: _cache[2] || (_cache[2] = ($event) => keydown("
|
|
137
|
+
onClick: _cache[2] || (_cache[2] = ($event) => keydown("Undo"))
|
|
135
138
|
}, [
|
|
136
139
|
createVNode(unref(NIcon), { component: unref(ArrowUndoSharp) }, null, 8, ["component"])
|
|
137
140
|
]),
|
|
138
141
|
createElementVNode("span", {
|
|
139
142
|
class: "opt",
|
|
140
|
-
onClick: _cache[3] || (_cache[3] = ($event) => keydown("
|
|
143
|
+
onClick: _cache[3] || (_cache[3] = ($event) => keydown("Enter"))
|
|
141
144
|
}, "\u786E\u5B9A")
|
|
142
145
|
]),
|
|
143
146
|
_: 1
|
|
@@ -236,11 +239,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
236
239
|
class: normalizeClass(["key" + index]),
|
|
237
240
|
onClick: ($event) => keydown(key)
|
|
238
241
|
}, [
|
|
239
|
-
key === "
|
|
242
|
+
key === "Switch" ? (openBlock(), createBlock(unref(NIcon), {
|
|
240
243
|
key: 0,
|
|
241
244
|
component: unref(GitCompareOutline)
|
|
242
245
|
}, null, 8, ["component"])) : createCommentVNode("v-if", true),
|
|
243
|
-
key === "
|
|
246
|
+
key === "Undo" ? (openBlock(), createBlock(unref(NIcon), {
|
|
244
247
|
key: 1,
|
|
245
248
|
component: unref(ArrowUndoSharp)
|
|
246
249
|
}, null, 8, ["component"])) : createCommentVNode("v-if", true),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cnhis-design-vue",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.30-beta.1",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"module": "./es/components/index.js",
|
|
6
6
|
"main": "./es/components/index.js",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"iOS 7",
|
|
62
62
|
"last 3 iOS versions"
|
|
63
63
|
],
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "e7148e5d2b0211fe5b4fa061d0d26eb56b1866a1"
|
|
65
65
|
}
|