cnhis-design-vue 3.1.16-beta.4 → 3.1.16-beta.7
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/packages/big-table/index.d.ts +1 -429
- package/es/packages/big-table/src/BigTable.vue.d.ts +26 -458
- package/es/packages/big-table/src/BigTable.vue_vue_type_script_setup_true_lang.js +61 -97
- package/es/packages/big-table/style/index.css +1 -2
- package/es/packages/fabric-chart/src/hooks/useLeft.js +8 -4
- package/es/packages/form-config/index.d.ts +23 -9
- package/es/packages/form-config/src/FormConfig.vue.d.ts +23 -9
- package/es/packages/form-config/src/components/FormConfigCreator.vue.d.ts +10 -3
- package/es/packages/form-config/src/components/FormConfigEdit.vue.d.ts +10 -3
- package/es/packages/form-config/src/hooks/useSortable.d.ts +1 -0
- package/es/packages/form-render/index.d.ts +10 -3
- package/es/packages/form-render/src/FormRender.js +7 -3
- package/es/packages/form-render/src/FormRender.vue.d.ts +11 -4
- package/es/packages/form-render/src/components/renderer/cascader.js +2 -2
- package/es/packages/form-render/src/components/renderer/date.d.ts +20 -4
- package/es/packages/form-render/src/components/renderer/date.js +36 -20
- package/es/packages/form-render/src/components/renderer/linebar.js +1 -4
- package/es/packages/form-render/src/components/renderer/select.js +19 -13
- package/es/packages/form-render/src/components/renderer/slider.d.ts +8 -344
- package/es/packages/form-render/src/components/renderer/slider.js +23 -1
- package/es/packages/form-render/src/hooks/useAnchor.js +7 -4
- package/es/packages/form-render/src/hooks/useBusinessBinding.d.ts +5 -2
- package/es/packages/form-render/src/hooks/useBusinessBinding.js +9 -5
- package/es/packages/form-render/src/hooks/useChangeContext.d.ts +4 -2
- package/es/packages/form-render/src/hooks/useChangeContext.js +4 -7
- package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +4 -4
- package/es/packages/form-render/src/hooks/useFormContext.js +1 -1
- package/es/packages/form-render/src/hooks/useFormValidator.js +13 -3
- package/es/packages/form-render/src/hooks/useInitialData.d.ts +1 -1
- package/es/packages/form-render/src/hooks/useInitialData.js +9 -4
- package/es/packages/form-render/src/types/index.d.ts +7 -0
- package/es/packages/form-render/src/utils/business.js +15 -2
- package/es/packages/form-render/src/utils/index.d.ts +1 -1
- package/es/packages/form-render/src/utils/index.js +5 -2
- package/es/packages/form-render/src/utils/schema.d.ts +1 -0
- package/es/packages/form-render/src/utils/schema.js +12 -1
- package/es/packages/index.css +1 -2
- package/es/packages/shortcut-setter/index.d.ts +10 -3
- package/es/packages/shortcut-setter/src/ShortcutSetter.vue.d.ts +10 -3
- package/global.d.ts +8 -8
- package/package.json +1 -1
|
@@ -3616,6 +3616,9 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
3616
3616
|
type: NumberConstructor;
|
|
3617
3617
|
default: number;
|
|
3618
3618
|
};
|
|
3619
|
+
businessFormatter: {
|
|
3620
|
+
type: import("vue").PropType<import("../../../../../es/packages/form-render").FormBusinessFormatter>;
|
|
3621
|
+
};
|
|
3619
3622
|
schema: {
|
|
3620
3623
|
type: import("vue").PropType<import("@formily/json-schema").Stringify<{
|
|
3621
3624
|
[key: symbol]: any;
|
|
@@ -3728,6 +3731,9 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
3728
3731
|
type: NumberConstructor;
|
|
3729
3732
|
default: number;
|
|
3730
3733
|
};
|
|
3734
|
+
businessFormatter: {
|
|
3735
|
+
type: import("vue").PropType<import("../../../../../es/packages/form-render").FormBusinessFormatter>;
|
|
3736
|
+
};
|
|
3731
3737
|
schema: {
|
|
3732
3738
|
type: import("vue").PropType<import("@formily/json-schema").Stringify<{
|
|
3733
3739
|
[key: symbol]: any;
|
|
@@ -3817,9 +3823,7 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
3817
3823
|
}>>;
|
|
3818
3824
|
emit: (event: "formChange", ...args: any[]) => void;
|
|
3819
3825
|
nuiThemeOverrides: import("naive-ui").GlobalThemeOverrides;
|
|
3820
|
-
formModel: import("@formily/core").Form<
|
|
3821
|
-
[x: string]: any;
|
|
3822
|
-
}>;
|
|
3826
|
+
formModel: import("@formily/core").Form<any>;
|
|
3823
3827
|
SchemaField: import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
|
|
3824
3828
|
businessCollector: import("../../../../../es/packages/form-render").BusinessCollector;
|
|
3825
3829
|
formItemDepsCollector: import("../../../../../es/packages/form-render").FormItemDepsCollector;
|
|
@@ -5227,6 +5231,9 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
5227
5231
|
type: NumberConstructor;
|
|
5228
5232
|
default: number;
|
|
5229
5233
|
};
|
|
5234
|
+
businessFormatter: {
|
|
5235
|
+
type: import("vue").PropType<import("../../../../../es/packages/form-render").FormBusinessFormatter>;
|
|
5236
|
+
};
|
|
5230
5237
|
schema: {
|
|
5231
5238
|
type: import("vue").PropType<import("@formily/json-schema").Stringify<{
|
|
5232
5239
|
[key: symbol]: any;
|
|
@@ -29,6 +29,9 @@ declare const FormRender: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
29
29
|
type: NumberConstructor;
|
|
30
30
|
default: number;
|
|
31
31
|
};
|
|
32
|
+
businessFormatter: {
|
|
33
|
+
type: import("vue").PropType<import("./src/types").FormBusinessFormatter>;
|
|
34
|
+
};
|
|
32
35
|
schema: {
|
|
33
36
|
type: import("vue").PropType<import("@formily/json-schema").Stringify<{
|
|
34
37
|
[key: symbol]: any;
|
|
@@ -141,6 +144,9 @@ declare const FormRender: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
141
144
|
type: NumberConstructor;
|
|
142
145
|
default: number;
|
|
143
146
|
};
|
|
147
|
+
businessFormatter: {
|
|
148
|
+
type: import("vue").PropType<import("./src/types").FormBusinessFormatter>;
|
|
149
|
+
};
|
|
144
150
|
schema: {
|
|
145
151
|
type: import("vue").PropType<import("@formily/json-schema").Stringify<{
|
|
146
152
|
[key: symbol]: any;
|
|
@@ -230,9 +236,7 @@ declare const FormRender: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
230
236
|
}>>;
|
|
231
237
|
emit: (event: "formChange", ...args: any[]) => void;
|
|
232
238
|
nuiThemeOverrides: import("naive-ui").GlobalThemeOverrides;
|
|
233
|
-
formModel: import("@formily/core").Form<
|
|
234
|
-
[x: string]: any;
|
|
235
|
-
}>;
|
|
239
|
+
formModel: import("@formily/core").Form<any>;
|
|
236
240
|
SchemaField: import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
|
|
237
241
|
businessCollector: import("./src/hooks").BusinessCollector;
|
|
238
242
|
formItemDepsCollector: import("./src/hooks").FormItemDepsCollector;
|
|
@@ -1640,6 +1644,9 @@ declare const FormRender: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
1640
1644
|
type: NumberConstructor;
|
|
1641
1645
|
default: number;
|
|
1642
1646
|
};
|
|
1647
|
+
businessFormatter: {
|
|
1648
|
+
type: import("vue").PropType<import("./src/types").FormBusinessFormatter>;
|
|
1649
|
+
};
|
|
1643
1650
|
schema: {
|
|
1644
1651
|
type: import("vue").PropType<import("@formily/json-schema").Stringify<{
|
|
1645
1652
|
[key: symbol]: any;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { defineComponent, ref, computed, watch, openBlock, createBlock, unref, withCtx, createElementBlock, createVNode, isRef, Fragment, renderList, createCommentVNode, createElementVNode, normalizeStyle, renderSlot, toDisplayString, nextTick } from 'vue';
|
|
2
2
|
import { createForm, onFieldValueChange, isField } from '@formily/core';
|
|
3
3
|
import { FormProvider, FormConsumer } from '@formily/vue';
|
|
4
|
-
import {
|
|
4
|
+
import { isObject } from '@vue/shared';
|
|
5
|
+
import { cloneDeep, isArray } from 'lodash-es';
|
|
5
6
|
import { NForm, NTabs, NTabPane, NConfigProvider } from 'naive-ui';
|
|
6
7
|
import { FormItemLineBarDepKeyPrepend } from '../../../packages/form-render/src/constants';
|
|
7
8
|
import { useFormRenderLifeCycle } from '../../../packages/form-render/src/hooks/useFormRenderLifeCycle';
|
|
@@ -29,6 +30,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
29
30
|
maxHeight: { type: [Number, String], default: "" },
|
|
30
31
|
anchor: { type: Boolean, default: false },
|
|
31
32
|
parallelism: { type: Number, default: 3 },
|
|
33
|
+
businessFormatter: { type: Function },
|
|
32
34
|
schema: { type: Object },
|
|
33
35
|
components: {
|
|
34
36
|
type: Object,
|
|
@@ -50,14 +52,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
50
52
|
const formModel = createForm({
|
|
51
53
|
initialValues: useInitialData().assignInitialData(props.initialData, props.fieldList),
|
|
52
54
|
effects() {
|
|
53
|
-
onFieldValueChange("*", (field) => {
|
|
55
|
+
onFieldValueChange("*", async (field) => {
|
|
54
56
|
const fieldKey = field.props.name.toString();
|
|
55
57
|
emit("formChange", {
|
|
56
58
|
fieldInstance: field,
|
|
57
59
|
fieldKey,
|
|
58
60
|
fieldName: field.title,
|
|
59
61
|
value: field.value,
|
|
60
|
-
context: changeContextCollector.getContext(fieldKey)
|
|
62
|
+
context: await changeContextCollector.getContext(fieldKey)
|
|
61
63
|
});
|
|
62
64
|
businessCollector.trigger(fieldKey);
|
|
63
65
|
formItemDepsCollector.trigger(fieldKey);
|
|
@@ -101,6 +103,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
101
103
|
return Promise.reject(Array.isArray(err) ? err.reduce(errInfoNormalize, []) : err);
|
|
102
104
|
});
|
|
103
105
|
function errInfoNormalize(result, error) {
|
|
106
|
+
if (!isObject(error))
|
|
107
|
+
return result;
|
|
104
108
|
let hasChildMessage = false;
|
|
105
109
|
if (isArray(error.messages)) {
|
|
106
110
|
error.messages.forEach((message) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="lodash" />
|
|
2
2
|
import { AnyObject } from '../../../../es/src/types';
|
|
3
3
|
import { Component, FunctionalComponent, nextTick, PropType } from 'vue';
|
|
4
|
-
import { FieldItem, FieldVisitor } from './types';
|
|
4
|
+
import { FieldItem, FieldVisitor, FormBusinessFormatter } from './types';
|
|
5
5
|
declare const _default: import("vue").DefineComponent<{
|
|
6
6
|
fieldList: {
|
|
7
7
|
type: PropType<FieldItem[]>;
|
|
@@ -29,6 +29,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
29
29
|
type: NumberConstructor;
|
|
30
30
|
default: number;
|
|
31
31
|
};
|
|
32
|
+
businessFormatter: {
|
|
33
|
+
type: PropType<FormBusinessFormatter>;
|
|
34
|
+
};
|
|
32
35
|
schema: {
|
|
33
36
|
type: PropType<import("@formily/vue").Stringify<{
|
|
34
37
|
[key: symbol]: any;
|
|
@@ -141,6 +144,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
141
144
|
type: NumberConstructor;
|
|
142
145
|
default: number;
|
|
143
146
|
};
|
|
147
|
+
businessFormatter: {
|
|
148
|
+
type: PropType<FormBusinessFormatter>;
|
|
149
|
+
};
|
|
144
150
|
schema: {
|
|
145
151
|
type: PropType<import("@formily/vue").Stringify<{
|
|
146
152
|
[key: symbol]: any;
|
|
@@ -230,9 +236,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
230
236
|
}>>;
|
|
231
237
|
emit: (event: "formChange", ...args: any[]) => void;
|
|
232
238
|
nuiThemeOverrides: import("naive-ui").GlobalThemeOverrides;
|
|
233
|
-
formModel: import("@formily/core").Form<
|
|
234
|
-
[x: string]: any;
|
|
235
|
-
}>;
|
|
239
|
+
formModel: import("@formily/core").Form<any>;
|
|
236
240
|
SchemaField: Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
|
|
237
241
|
businessCollector: import("./hooks").BusinessCollector;
|
|
238
242
|
formItemDepsCollector: import("./hooks").FormItemDepsCollector;
|
|
@@ -1640,6 +1644,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1640
1644
|
type: NumberConstructor;
|
|
1641
1645
|
default: number;
|
|
1642
1646
|
};
|
|
1647
|
+
businessFormatter: {
|
|
1648
|
+
type: PropType<FormBusinessFormatter>;
|
|
1649
|
+
};
|
|
1643
1650
|
schema: {
|
|
1644
1651
|
type: PropType<import("@formily/vue").Stringify<{
|
|
1645
1652
|
[key: symbol]: any;
|
|
@@ -46,7 +46,7 @@ const script = defineComponent({
|
|
|
46
46
|
var _a, _b;
|
|
47
47
|
return (_b = (_a = props.urlConfig) == null ? void 0 : _a.valueKey) != null ? _b : "value";
|
|
48
48
|
});
|
|
49
|
-
const
|
|
49
|
+
const valueRef = computed(() => {
|
|
50
50
|
try {
|
|
51
51
|
const parsed = Array.isArray(props.value) ? props.value : JSON.parse(props.value || "");
|
|
52
52
|
if (!Array.isArray(parsed) || !parsed.length)
|
|
@@ -158,7 +158,7 @@ const script = defineComponent({
|
|
|
158
158
|
"checkStrategy": "child",
|
|
159
159
|
"show": !!show.value,
|
|
160
160
|
"onUpdate:show": updateShow,
|
|
161
|
-
"value":
|
|
161
|
+
"value": valueRef.value,
|
|
162
162
|
"onUpdate:value": updateValue,
|
|
163
163
|
"labelField": labelKey.value,
|
|
164
164
|
"valueField": valueKey.value,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { PropType } from 'vue';
|
|
2
2
|
export declare const DATE: import("vue").DefineComponent<{
|
|
3
3
|
onChange: {};
|
|
4
|
-
value: {
|
|
4
|
+
value: {
|
|
5
|
+
type: StringConstructor;
|
|
6
|
+
};
|
|
5
7
|
validate: {
|
|
6
8
|
type: PropType<Partial<{
|
|
7
9
|
[key: string]: any;
|
|
@@ -16,9 +18,15 @@ export declare const DATE: import("vue").DefineComponent<{
|
|
|
16
18
|
regular_error_tip: string;
|
|
17
19
|
}>>;
|
|
18
20
|
};
|
|
19
|
-
|
|
21
|
+
valueFormat: {
|
|
22
|
+
type: StringConstructor;
|
|
23
|
+
default: string;
|
|
24
|
+
};
|
|
25
|
+
}, () => 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<{
|
|
20
26
|
onChange: {};
|
|
21
|
-
value: {
|
|
27
|
+
value: {
|
|
28
|
+
type: StringConstructor;
|
|
29
|
+
};
|
|
22
30
|
validate: {
|
|
23
31
|
type: PropType<Partial<{
|
|
24
32
|
[key: string]: any;
|
|
@@ -33,4 +41,12 @@ export declare const DATE: import("vue").DefineComponent<{
|
|
|
33
41
|
regular_error_tip: string;
|
|
34
42
|
}>>;
|
|
35
43
|
};
|
|
36
|
-
|
|
44
|
+
valueFormat: {
|
|
45
|
+
type: StringConstructor;
|
|
46
|
+
default: string;
|
|
47
|
+
};
|
|
48
|
+
}>> & {
|
|
49
|
+
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
50
|
+
}, {
|
|
51
|
+
valueFormat: string;
|
|
52
|
+
}>;
|
|
@@ -1,19 +1,29 @@
|
|
|
1
|
-
import { defineComponent, computed, createVNode } from 'vue';
|
|
2
|
-
import { isField } from '@formily/core';
|
|
1
|
+
import { defineComponent, computed, watch, createVNode, mergeProps } from 'vue';
|
|
3
2
|
import { connect, mapProps } from '@formily/vue';
|
|
4
3
|
import { isObject } from '@vueuse/core';
|
|
4
|
+
import { format } from 'date-fns';
|
|
5
5
|
import { NDatePicker } from 'naive-ui';
|
|
6
6
|
import { useCommonInjection } from '../../../../../packages/form-render/src/hooks/useCommonInjection';
|
|
7
|
+
import { assignUpdateValue } from '../../../../../packages/form-render/src/utils';
|
|
7
8
|
|
|
8
9
|
const script = defineComponent({
|
|
9
10
|
props: {
|
|
10
11
|
onChange: {},
|
|
11
|
-
value: {
|
|
12
|
+
value: {
|
|
13
|
+
type: String
|
|
14
|
+
},
|
|
12
15
|
validate: {
|
|
13
16
|
type: Object
|
|
17
|
+
},
|
|
18
|
+
valueFormat: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: "yyyy-MM-dd"
|
|
14
21
|
}
|
|
15
22
|
},
|
|
16
|
-
|
|
23
|
+
emits: ["update:value"],
|
|
24
|
+
setup(props, {
|
|
25
|
+
emit
|
|
26
|
+
}) {
|
|
17
27
|
useCommonInjection().injectValueValidate(() => props.value);
|
|
18
28
|
function minCurrentDate() {
|
|
19
29
|
var _a;
|
|
@@ -56,7 +66,9 @@ const script = defineComponent({
|
|
|
56
66
|
}
|
|
57
67
|
}
|
|
58
68
|
const validateConfig = computed(() => {
|
|
59
|
-
const result = {
|
|
69
|
+
const result = {
|
|
70
|
+
valueFormat: props.valueFormat
|
|
71
|
+
};
|
|
60
72
|
if (isObject(props.validate)) {
|
|
61
73
|
const {
|
|
62
74
|
min_date,
|
|
@@ -69,22 +81,26 @@ const script = defineComponent({
|
|
|
69
81
|
}
|
|
70
82
|
return result;
|
|
71
83
|
});
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
function formatDate(value) {
|
|
85
|
+
if (!value)
|
|
86
|
+
return value;
|
|
87
|
+
return format(new Date(value), props.valueFormat);
|
|
88
|
+
}
|
|
89
|
+
watch(() => props.value, (value) => {
|
|
90
|
+
if (!value || formatDate(value) === value)
|
|
91
|
+
return;
|
|
92
|
+
emit("update:value", formatDate(value));
|
|
93
|
+
});
|
|
94
|
+
const valueRef = computed({
|
|
95
|
+
get: () => formatDate(props.value),
|
|
96
|
+
set: (value) => emit("update:value", value)
|
|
85
97
|
});
|
|
98
|
+
return () => createVNode(NDatePicker, mergeProps(validateConfig.value, {
|
|
99
|
+
"formatted-value": valueRef.value,
|
|
100
|
+
"onUpdate:formatted-value": ($event) => valueRef.value = $event
|
|
101
|
+
}), null);
|
|
86
102
|
}
|
|
87
|
-
|
|
88
|
-
|
|
103
|
+
});
|
|
104
|
+
const DATE = connect(script, mapProps(assignUpdateValue));
|
|
89
105
|
|
|
90
106
|
export { DATE };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref,
|
|
1
|
+
import { defineComponent, ref, inject, createVNode } from 'vue';
|
|
2
2
|
import { connect, mapProps } from '@formily/vue';
|
|
3
3
|
import { NDivider, NCollapseTransition } from 'naive-ui';
|
|
4
4
|
import { useFormField } from '../../../../../packages/form-render';
|
|
@@ -28,9 +28,6 @@ const script = defineComponent({
|
|
|
28
28
|
slots
|
|
29
29
|
}) {
|
|
30
30
|
const _show = ref(props.show);
|
|
31
|
-
onMounted(() => {
|
|
32
|
-
_show.value = props.show;
|
|
33
|
-
});
|
|
34
31
|
function toggleShow() {
|
|
35
32
|
if (props.disabled)
|
|
36
33
|
return;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent,
|
|
1
|
+
import { defineComponent, computed, ref, inject, nextTick, watch, createVNode } from 'vue';
|
|
2
2
|
import { isField } from '@formily/core';
|
|
3
|
-
import {
|
|
3
|
+
import { cloneDeep, isEqual } from 'lodash-es';
|
|
4
4
|
import { useCommonInjection } from '../../../../../packages/form-render/src/hooks/useCommonInjection';
|
|
5
|
-
import {
|
|
5
|
+
import { InjectAsyncQueue, InjectionChangeContextCollector, InjectionFormItemDepsCollector } from '../../constants/index.js';
|
|
6
6
|
import { connect, mapProps } from '@formily/vue';
|
|
7
7
|
import { NSelect } from 'naive-ui';
|
|
8
8
|
import { useFormField } from '../../hooks/useFormField.js';
|
|
@@ -35,6 +35,10 @@ const script = defineComponent({
|
|
|
35
35
|
slots,
|
|
36
36
|
emit
|
|
37
37
|
}) {
|
|
38
|
+
const valueRef = computed({
|
|
39
|
+
get: () => props.value,
|
|
40
|
+
set: (v) => emit("update:value", v)
|
|
41
|
+
});
|
|
38
42
|
const remoteOptions = ref(null);
|
|
39
43
|
const lastSearch = ref("");
|
|
40
44
|
const labelKey = computed(() => {
|
|
@@ -45,11 +49,6 @@ const script = defineComponent({
|
|
|
45
49
|
var _a, _b;
|
|
46
50
|
return (_b = (_a = props.urlConfig) == null ? void 0 : _a.valueKey) != null ? _b : "value";
|
|
47
51
|
});
|
|
48
|
-
const changeContextCollector = inject(InjectionChangeContextCollector);
|
|
49
|
-
function update(v, option) {
|
|
50
|
-
changeContextCollector == null ? void 0 : changeContextCollector.setContext(fieldKey.value, "currentOption", cloneDeep(option));
|
|
51
|
-
emit("update:value", v);
|
|
52
|
-
}
|
|
53
52
|
const {
|
|
54
53
|
field,
|
|
55
54
|
fieldKey
|
|
@@ -102,6 +101,13 @@ const script = defineComponent({
|
|
|
102
101
|
});
|
|
103
102
|
}
|
|
104
103
|
});
|
|
104
|
+
const changeContextCollector = inject(InjectionChangeContextCollector);
|
|
105
|
+
changeContextCollector == null ? void 0 : changeContextCollector.setContext(fieldKey.value, async () => {
|
|
106
|
+
await nextTick();
|
|
107
|
+
return {
|
|
108
|
+
currentOption: cloneDeep(parsedOptions.value.find((option) => option[valueKey.value] === valueRef.value))
|
|
109
|
+
};
|
|
110
|
+
});
|
|
105
111
|
const formItemDepsCollector = inject(InjectionFormItemDepsCollector);
|
|
106
112
|
watch(() => props.urlConfig, (config, oldConfig) => {
|
|
107
113
|
if (isEqual(config, oldConfig))
|
|
@@ -114,7 +120,7 @@ const script = defineComponent({
|
|
|
114
120
|
emit("update:value", null);
|
|
115
121
|
!props.lazyRequest && await fetchData();
|
|
116
122
|
});
|
|
117
|
-
(
|
|
123
|
+
(valueRef.value || !props.lazyRequest) && fetchData();
|
|
118
124
|
}, {
|
|
119
125
|
immediate: true
|
|
120
126
|
});
|
|
@@ -122,8 +128,8 @@ const script = defineComponent({
|
|
|
122
128
|
injectValueValidate,
|
|
123
129
|
injectValueWatchFromEmpty
|
|
124
130
|
} = useCommonInjection();
|
|
125
|
-
injectValueWatchFromEmpty(
|
|
126
|
-
injectValueValidate(
|
|
131
|
+
injectValueWatchFromEmpty(valueRef, fetchData);
|
|
132
|
+
injectValueValidate(valueRef);
|
|
127
133
|
function focusDecorator(onFocus) {
|
|
128
134
|
return (...args) => {
|
|
129
135
|
if (isField(field.value)) {
|
|
@@ -135,8 +141,8 @@ const script = defineComponent({
|
|
|
135
141
|
return () => createVNode(NSelect, {
|
|
136
142
|
"remote": true,
|
|
137
143
|
"filterable": true,
|
|
138
|
-
"value":
|
|
139
|
-
"onUpdate:value":
|
|
144
|
+
"value": valueRef.value,
|
|
145
|
+
"onUpdate:value": ($event) => valueRef.value = $event,
|
|
140
146
|
"labelField": labelKey.value,
|
|
141
147
|
"valueField": valueKey.value,
|
|
142
148
|
"options": parsedOptions.value,
|