cnhis-design-vue 3.1.19-beta.3 → 3.1.19-y.0
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/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 +8 -1
- package/es/components/form-config/src/FormConfig.vue.d.ts +8 -1
- package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +8 -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/components/renderer/cascader.js +1 -0
- 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/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/index.css +1 -1
- package/es/components/shortcut-setter/index.d.ts +8 -1
- package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +8 -1
- package/es/components/steps-wheel/index.d.ts +13 -0
- package/es/components/steps-wheel/src/StepsWheel.js +28 -15
- package/es/components/steps-wheel/src/StepsWheel.vue.d.ts +13 -0
- package/es/components/steps-wheel/style/index.css +1 -1
- package/package.json +2 -2
|
@@ -55,7 +55,7 @@ declare const FabricChart: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
55
55
|
getRightInfo: import("vue").ComputedRef<any>;
|
|
56
56
|
propItems: any;
|
|
57
57
|
computedYCell: (type: import("./src/interface").IPointType) => number;
|
|
58
|
-
cumputedX: (value: string | number) => any;
|
|
58
|
+
cumputedX: (value: string | number, setAllCenter?: boolean) => any;
|
|
59
59
|
cumputedY: (type: import("./src/interface").IPointType, scaleValueList: number[], value: string | number) => number;
|
|
60
60
|
getXValue: (pointX: number) => string | undefined;
|
|
61
61
|
getYValue: (type: import("./src/interface").IPointType, pointY: number) => number;
|
|
@@ -56,7 +56,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
56
56
|
getRightInfo: import("vue").ComputedRef<any>;
|
|
57
57
|
propItems: any;
|
|
58
58
|
computedYCell: (type: IPointType) => number;
|
|
59
|
-
cumputedX: (value: string | number) => any;
|
|
59
|
+
cumputedX: (value: string | number, setAllCenter?: boolean) => any;
|
|
60
60
|
cumputedY: (type: IPointType, scaleValueList: number[], value: string | number) => number;
|
|
61
61
|
getXValue: (pointX: number) => string | undefined;
|
|
62
62
|
getYValue: (type: IPointType, pointY: number) => number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IPropItems, IPointType } from '../interface';
|
|
2
2
|
export declare function useCumputedPoint(propItems: IPropItems): {
|
|
3
|
-
cumputedX: (value: number | string) => any;
|
|
3
|
+
cumputedX: (value: number | string, setAllCenter?: boolean) => any;
|
|
4
4
|
cumputedY: (type: IPointType, scaleValueList: number[], value: number | string) => number;
|
|
5
5
|
getXValue: (pointX: number) => string | undefined;
|
|
6
6
|
getYValue: (type: IPointType, pointY: number) => number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function useCumputedPoint(propItems) {
|
|
2
2
|
const { xScaleList, originX, endY, xCellWidth, left, vitalSignsOriginY, painOriginY, canvasWidth } = propItems;
|
|
3
|
-
function cumputedX(value) {
|
|
3
|
+
function cumputedX(value, setAllCenter = false) {
|
|
4
4
|
const time = new Date(value).getTime();
|
|
5
5
|
const [minScale] = xScaleList;
|
|
6
6
|
const maxScale = xScaleList.at(-1);
|
|
@@ -11,7 +11,7 @@ function useCumputedPoint(propItems) {
|
|
|
11
11
|
const index = xScaleList.findIndex((v) => v.end >= time);
|
|
12
12
|
if (index > -1) {
|
|
13
13
|
const item = xScaleList[index];
|
|
14
|
-
if (time === item.start) {
|
|
14
|
+
if (time === item.start && !setAllCenter) {
|
|
15
15
|
return item.left;
|
|
16
16
|
} else {
|
|
17
17
|
return item.center;
|
|
@@ -3,7 +3,7 @@ import { fabric } from '../utils/index.js';
|
|
|
3
3
|
import { defaultStyle } from './useDraw2.js';
|
|
4
4
|
|
|
5
5
|
function useOther(canvas, propItems, cumputedX) {
|
|
6
|
-
const { other, vitalSignsOriginY } = propItems;
|
|
6
|
+
const { other, vitalSignsOriginY, xCellWidth } = propItems;
|
|
7
7
|
function drawOther() {
|
|
8
8
|
if (!(other == null ? void 0 : other.list))
|
|
9
9
|
return false;
|
|
@@ -11,7 +11,7 @@ function useOther(canvas, propItems, cumputedX) {
|
|
|
11
11
|
const otherList = [];
|
|
12
12
|
other.list.forEach((item) => {
|
|
13
13
|
const align = item.align || "vertical";
|
|
14
|
-
const left = cumputedX(item.time);
|
|
14
|
+
const left = cumputedX(item.time, true);
|
|
15
15
|
const obj = otherList.find((v) => v.left == left);
|
|
16
16
|
if (obj) {
|
|
17
17
|
obj[align].push(item);
|
|
@@ -25,7 +25,6 @@ function useOther(canvas, propItems, cumputedX) {
|
|
|
25
25
|
otherList.push(initObj);
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
|
-
let textWidth = 0;
|
|
29
28
|
otherList.forEach((item) => {
|
|
30
29
|
let topY = vitalSignsOriginY.originY;
|
|
31
30
|
let leftX = item.left;
|
|
@@ -33,17 +32,25 @@ function useOther(canvas, propItems, cumputedX) {
|
|
|
33
32
|
item.vertical.forEach((v) => {
|
|
34
33
|
const { commonOptions, value } = getTextData(v);
|
|
35
34
|
topY += (v.baseTop || 0) + textHeight;
|
|
35
|
+
const node = hasNode(item.left, topY);
|
|
36
|
+
if (node) {
|
|
37
|
+
topY += node.height;
|
|
38
|
+
}
|
|
36
39
|
const text = new fabric.Text(value, {
|
|
37
40
|
top: topY,
|
|
38
41
|
left: item.left,
|
|
39
42
|
...commonOptions
|
|
40
43
|
});
|
|
41
44
|
textHeight = text.height || 0;
|
|
42
|
-
|
|
45
|
+
list.push(text);
|
|
43
46
|
});
|
|
44
47
|
item.horizontal.forEach((v, i) => {
|
|
45
48
|
if (i > 0 || item.vertical.length) {
|
|
46
|
-
leftX +=
|
|
49
|
+
leftX += xCellWidth;
|
|
50
|
+
}
|
|
51
|
+
const node = hasNode(leftX, vitalSignsOriginY.originY);
|
|
52
|
+
if (node) {
|
|
53
|
+
leftX += xCellWidth;
|
|
47
54
|
}
|
|
48
55
|
const { commonOptions, value } = getTextData(v);
|
|
49
56
|
const text = new fabric.Text(value, {
|
|
@@ -51,15 +58,11 @@ function useOther(canvas, propItems, cumputedX) {
|
|
|
51
58
|
left: leftX,
|
|
52
59
|
...commonOptions
|
|
53
60
|
});
|
|
54
|
-
|
|
61
|
+
list.push(text);
|
|
55
62
|
});
|
|
56
63
|
});
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
textWidth = text.width || 0;
|
|
60
|
-
}
|
|
61
|
-
list.push(text);
|
|
62
|
-
}
|
|
64
|
+
const group = list.length > 0 ? new fabric.Group([...list], { ...defaultStyle }) : null;
|
|
65
|
+
group && canvas.value.add(group);
|
|
63
66
|
function getTextData(v) {
|
|
64
67
|
return {
|
|
65
68
|
commonOptions: {
|
|
@@ -71,8 +74,9 @@ function useOther(canvas, propItems, cumputedX) {
|
|
|
71
74
|
value: String(v.value.toString().split("").join("\n"))
|
|
72
75
|
};
|
|
73
76
|
}
|
|
74
|
-
|
|
75
|
-
|
|
77
|
+
function hasNode(x, y) {
|
|
78
|
+
return list.find((v) => v.left === x && y >= v.top && y <= v.top + v.height);
|
|
79
|
+
}
|
|
76
80
|
}
|
|
77
81
|
onMounted(() => {
|
|
78
82
|
nextTick(() => {
|
|
@@ -932,7 +932,13 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
932
932
|
multi_select?: import("..").FormCommonState | undefined;
|
|
933
933
|
multi_select_value?: string | number | undefined;
|
|
934
934
|
wordbook?: {
|
|
935
|
-
level_num
|
|
935
|
+
level_num?: number | undefined;
|
|
936
|
+
id: string;
|
|
937
|
+
name: string;
|
|
938
|
+
render_key: string[];
|
|
939
|
+
search_key: string[];
|
|
940
|
+
type: string;
|
|
941
|
+
value_key: string;
|
|
936
942
|
} | undefined;
|
|
937
943
|
open?: {
|
|
938
944
|
value?: any;
|
|
@@ -957,6 +963,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
957
963
|
})[] | undefined;
|
|
958
964
|
} | undefined;
|
|
959
965
|
suffixConfig?: any | any[] | undefined;
|
|
966
|
+
autograph?: string | undefined;
|
|
960
967
|
fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
|
|
961
968
|
content?: string | import("..").FormRenderer | Record<string, import("..").FormRenderer> | undefined;
|
|
962
969
|
lazyRequest?: boolean | undefined;
|
|
@@ -934,7 +934,13 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
934
934
|
multi_select?: import("../..").FormCommonState | undefined;
|
|
935
935
|
multi_select_value?: string | number | undefined;
|
|
936
936
|
wordbook?: {
|
|
937
|
-
level_num
|
|
937
|
+
level_num?: number | undefined;
|
|
938
|
+
id: string;
|
|
939
|
+
name: string;
|
|
940
|
+
render_key: string[];
|
|
941
|
+
search_key: string[];
|
|
942
|
+
type: string;
|
|
943
|
+
value_key: string;
|
|
938
944
|
} | undefined;
|
|
939
945
|
open?: {
|
|
940
946
|
value?: any;
|
|
@@ -959,6 +965,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
959
965
|
})[] | undefined;
|
|
960
966
|
} | undefined;
|
|
961
967
|
suffixConfig?: any | any[] | undefined;
|
|
968
|
+
autograph?: string | undefined;
|
|
962
969
|
fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
|
|
963
970
|
content?: string | import("../..").FormRenderer | Record<string, import("../..").FormRenderer> | undefined;
|
|
964
971
|
lazyRequest?: boolean | undefined;
|
|
@@ -61,7 +61,13 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
61
61
|
multi_select?: import("../../../../../es/components/form-render").FormCommonState | undefined;
|
|
62
62
|
multi_select_value?: string | number | undefined;
|
|
63
63
|
wordbook?: {
|
|
64
|
-
level_num
|
|
64
|
+
level_num?: number | undefined;
|
|
65
|
+
id: string;
|
|
66
|
+
name: string;
|
|
67
|
+
render_key: string[];
|
|
68
|
+
search_key: string[];
|
|
69
|
+
type: string;
|
|
70
|
+
value_key: string;
|
|
65
71
|
} | undefined;
|
|
66
72
|
open?: {
|
|
67
73
|
value?: any;
|
|
@@ -86,6 +92,7 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
86
92
|
})[] | undefined;
|
|
87
93
|
} | undefined;
|
|
88
94
|
suffixConfig?: any | any[] | undefined;
|
|
95
|
+
autograph?: string | undefined;
|
|
89
96
|
fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
|
|
90
97
|
content?: string | import("../../../../../es/components/form-render").FormRenderer | Record<string, import("../../../../../es/components/form-render").FormRenderer> | undefined;
|
|
91
98
|
lazyRequest?: boolean | undefined;
|
|
@@ -37,6 +37,7 @@ import './src/components/renderer/labelSelect.js';
|
|
|
37
37
|
import './src/components/renderer/slider.js';
|
|
38
38
|
import './src/components/renderer/complex.js';
|
|
39
39
|
import './src/components/renderer/simpleComponent.js';
|
|
40
|
+
import './src/components/renderer/search.js';
|
|
40
41
|
|
|
41
42
|
const FormRender = script;
|
|
42
43
|
FormRender.install = function(app) {
|
|
@@ -123,14 +123,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
123
123
|
error.messages.forEach((message) => {
|
|
124
124
|
if (!isObject(message))
|
|
125
125
|
return;
|
|
126
|
-
result.push(...arrayed(message).map(
|
|
126
|
+
result.push(...arrayed(message).map(bindEleInfo));
|
|
127
127
|
hasChildMessage = true;
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
|
-
!hasChildMessage && result.push(
|
|
130
|
+
!hasChildMessage && result.push(bindEleInfo(error));
|
|
131
131
|
return result;
|
|
132
132
|
}
|
|
133
|
-
function
|
|
133
|
+
function bindEleInfo(info) {
|
|
134
134
|
if (info.decoratorElement)
|
|
135
135
|
return info;
|
|
136
136
|
info.title = formModel.query(info.path).get("title");
|
|
@@ -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 };
|