cnhis-design-vue 3.1.13-beta.0 → 3.1.13-beta.3
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/src/BigTable.vue.d.ts +6 -16
- package/es/packages/big-table/src/BigTable.vue_vue_type_script_setup_true_lang.js +1 -1
- package/es/packages/fabric-chart/src/hooks/useCenter.js +9 -8
- package/es/packages/fabric-chart/src/hooks/useDraw.js +5 -1
- package/es/packages/fabric-chart/src/hooks/useShadow.js +1 -1
- package/es/packages/fabric-chart/src/hooks/useTop.js +6 -4
- package/es/packages/form-render/src/components/renderer/cascader.d.ts +7 -1
- package/es/packages/form-render/src/components/renderer/cascader.js +65 -53
- package/es/packages/form-render/src/components/renderer/input.js +3 -3
- package/es/packages/form-render/src/components/renderer/select.d.ts +7 -5
- package/es/packages/form-render/src/components/renderer/select.js +35 -40
- package/es/packages/form-render/src/components/renderer/simpleComponent.js +2 -15
- package/es/packages/form-render/src/utils/index.d.ts +5 -2
- package/es/packages/form-render/src/utils/index.js +16 -2
- package/es/packages/index.css +11 -0
- package/es/packages/index.d.ts +4 -1
- package/es/packages/index.js +9 -1
- package/es/packages/shortcut-provider/index.d.ts +17 -0
- package/es/packages/shortcut-provider/index.js +13 -0
- package/es/packages/shortcut-provider/src/ShortcutProvider.js +4 -0
- package/es/packages/shortcut-provider/src/ShortcutProvider.vue.d.ts +15 -0
- package/es/packages/shortcut-provider/src/ShortcutProvider.vue_vue_type_script_setup_true_lang.js +32 -0
- package/es/packages/shortcut-provider/src/constants/index.d.ts +7 -0
- package/es/packages/shortcut-provider/src/constants/index.js +8 -0
- package/es/packages/shortcut-provider/src/hooks/index.d.ts +2 -0
- package/es/packages/shortcut-provider/src/hooks/index.js +2 -0
- package/es/packages/shortcut-provider/src/hooks/useShortcutSignature.d.ts +4 -0
- package/es/packages/shortcut-provider/src/hooks/useShortcutSignature.js +12 -0
- package/es/packages/shortcut-provider/src/hooks/useShortcuts.d.ts +30 -0
- package/es/packages/shortcut-provider/src/hooks/useShortcuts.js +157 -0
- package/es/packages/shortcut-provider/src/types/index.d.ts +30 -0
- package/es/packages/shortcut-provider/src/types/index.js +1 -0
- package/es/packages/shortcut-provider/src/utils/index.d.ts +7 -0
- package/es/packages/shortcut-provider/src/utils/index.js +49 -0
- package/es/packages/shortcut-provider/style/index.css +3 -0
- package/es/packages/shortcut-setter/constant/index.d.ts +4 -0
- package/es/packages/shortcut-setter/constant/index.js +7 -0
- package/es/packages/shortcut-setter/index.d.ts +4258 -0
- package/es/packages/shortcut-setter/index.js +11 -0
- package/es/packages/shortcut-setter/src/ShortcutSetter.js +4 -0
- package/es/packages/shortcut-setter/src/ShortcutSetter.vue.d.ts +4258 -0
- package/es/packages/shortcut-setter/src/ShortcutSetter.vue_vue_type_script_setup_true_lang.js +38 -0
- package/es/packages/shortcut-setter/src/ShortcutSetterItem.js +4 -0
- package/es/packages/shortcut-setter/src/ShortcutSetterItem.vue.d.ts +4238 -0
- package/es/packages/shortcut-setter/src/ShortcutSetterItem.vue_vue_type_script_setup_true_lang.js +125 -0
- package/es/packages/shortcut-setter/style/index.css +8 -0
- package/es/src/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1115,14 +1115,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1115
1115
|
textColorTextDisabledWarning: string;
|
|
1116
1116
|
textColorGhostWarning: string;
|
|
1117
1117
|
textColorGhostHoverWarning: string;
|
|
1118
|
-
/**
|
|
1119
|
-
* 初始化props
|
|
1120
|
-
* @param {*} unionItem
|
|
1121
|
-
* @param {*} row
|
|
1122
|
-
* @param {*} column
|
|
1123
|
-
* @param {*} $rowIndex
|
|
1124
|
-
* @returns
|
|
1125
|
-
*/
|
|
1126
1118
|
textColorGhostPressedWarning: string;
|
|
1127
1119
|
textColorGhostFocusWarning: string;
|
|
1128
1120
|
textColorGhostDisabledWarning: string;
|
|
@@ -1181,7 +1173,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1181
1173
|
}, any>>;
|
|
1182
1174
|
readonly themeOverrides: import("vue").PropType<import("naive-ui/es/_mixins/use-theme").ExtractThemeOverrides<import("naive-ui/es/_mixins").Theme<"Button", {
|
|
1183
1175
|
heightTiny: string;
|
|
1184
|
-
heightSmall: string;
|
|
1176
|
+
heightSmall: string; /**
|
|
1177
|
+
* 单个form提交失败
|
|
1178
|
+
* @param {*} obj
|
|
1179
|
+
*/
|
|
1185
1180
|
heightMedium: string;
|
|
1186
1181
|
heightLarge: string;
|
|
1187
1182
|
borderRadiusTiny: string;
|
|
@@ -1192,10 +1187,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1192
1187
|
fontSizeSmall: string;
|
|
1193
1188
|
fontSizeMedium: string;
|
|
1194
1189
|
fontSizeLarge: string;
|
|
1195
|
-
opacityDisabled: string;
|
|
1196
|
-
* 避免每次点击都查询
|
|
1197
|
-
* 初始化查一次 行编辑 表单search用
|
|
1198
|
-
*/
|
|
1190
|
+
opacityDisabled: string;
|
|
1199
1191
|
colorOpacitySecondary: string;
|
|
1200
1192
|
colorOpacitySecondaryHover: string;
|
|
1201
1193
|
colorOpacitySecondaryPressed: string;
|
|
@@ -1218,9 +1210,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1218
1210
|
textColorHover: string;
|
|
1219
1211
|
textColorPressed: string;
|
|
1220
1212
|
textColorFocus: string;
|
|
1221
|
-
textColorDisabled: string;
|
|
1222
|
-
* tsx渲染表格
|
|
1223
|
-
*/
|
|
1213
|
+
textColorDisabled: string;
|
|
1224
1214
|
textColorText: string;
|
|
1225
1215
|
textColorTextHover: string;
|
|
1226
1216
|
textColorTextPressed: string;
|
|
@@ -349,7 +349,7 @@ var script = /* @__PURE__ */ defineComponent({
|
|
|
349
349
|
state.editConfig = Object.assign(state.editConfig, editConfig);
|
|
350
350
|
state.rowConfig.height = 48;
|
|
351
351
|
}
|
|
352
|
-
state.rowConfig
|
|
352
|
+
state.rowConfig = Object.assign(state.rowConfig, rowConfig);
|
|
353
353
|
state.rowConfig.keyField = handleRowId.value;
|
|
354
354
|
if (selectType) {
|
|
355
355
|
isBatchSelect = 1;
|
|
@@ -95,13 +95,15 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
|
|
|
95
95
|
if (itemPrev && points1.length === 1) {
|
|
96
96
|
const point = getPoint(itemPrev);
|
|
97
97
|
points1.unshift(point);
|
|
98
|
-
points2.unshift(point);
|
|
99
98
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
99
|
+
if (itemNext && itemNext2) {
|
|
100
|
+
const pointNext = getPoint(itemNext);
|
|
101
|
+
const pointNext2 = getPoint(itemNext2);
|
|
102
|
+
if (pointNext.x === pointNext2.x && pointNext.y === pointNext2.y) {
|
|
103
|
+
points1.push(pointNext);
|
|
104
|
+
}
|
|
105
|
+
} else {
|
|
106
|
+
data.push({ points1, points2 });
|
|
105
107
|
}
|
|
106
108
|
} else {
|
|
107
109
|
if (points1.length && points2.length) {
|
|
@@ -116,8 +118,7 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
|
|
|
116
118
|
const newData = data.reduce((pre, cur) => {
|
|
117
119
|
const arr1 = cur.points1.map((v) => [v.x, v.y]);
|
|
118
120
|
const arr2 = cur.points2.map((v) => [v.x, v.y]);
|
|
119
|
-
|
|
120
|
-
return pre.concat([[...arr1, ...newArr2.reverse()]]);
|
|
121
|
+
return pre.concat([[...arr1, ...arr2.reverse()]]);
|
|
121
122
|
}, []);
|
|
122
123
|
const { createShadowLines } = useShadow();
|
|
123
124
|
newData.forEach((item) => {
|
|
@@ -46,7 +46,11 @@ function drawTextGroup(rectStyle, fontStyle, groupStyle) {
|
|
|
46
46
|
});
|
|
47
47
|
const texts = new fabric.Text(String(fontStyle.value), {
|
|
48
48
|
...defaultTextStyle,
|
|
49
|
-
...fontStyle
|
|
49
|
+
...fontStyle,
|
|
50
|
+
...fontStyle.textAlign == "left" ? {
|
|
51
|
+
originX: "left",
|
|
52
|
+
left: -(rectStyle.width / 2)
|
|
53
|
+
} : {}
|
|
50
54
|
});
|
|
51
55
|
return new fabric.Group([rect, texts], {
|
|
52
56
|
...groupStyle
|
|
@@ -101,7 +101,7 @@ function useShadow() {
|
|
|
101
101
|
let counter = 0;
|
|
102
102
|
let xinters;
|
|
103
103
|
let p1, p2;
|
|
104
|
-
|
|
104
|
+
const pointCount = polygonPoints.length;
|
|
105
105
|
p1 = polygonPoints[0];
|
|
106
106
|
for (let i = 1; i <= pointCount; i++) {
|
|
107
107
|
p2 = polygonPoints[i % pointCount];
|
|
@@ -35,7 +35,7 @@ function useTop(canvas, propItems) {
|
|
|
35
35
|
}
|
|
36
36
|
if (item.key == "xScalevalue") {
|
|
37
37
|
drawDay(list, topY);
|
|
38
|
-
drawTime(list, topY);
|
|
38
|
+
drawTime(item, list, topY);
|
|
39
39
|
} else {
|
|
40
40
|
propItems[`${item.key}Height`] && drawDate(item, list, topY);
|
|
41
41
|
}
|
|
@@ -44,7 +44,7 @@ function useTop(canvas, propItems) {
|
|
|
44
44
|
group && group.sendToBack();
|
|
45
45
|
group && canvas.value.add(group);
|
|
46
46
|
}
|
|
47
|
-
function drawTime(list, topY) {
|
|
47
|
+
function drawTime(item, list, topY) {
|
|
48
48
|
var _a;
|
|
49
49
|
const dayHeight = top.xScalevalue.show ? top.dayHeight || 0 : 0;
|
|
50
50
|
const height = xScalevalueHeight - dayHeight;
|
|
@@ -55,7 +55,8 @@ function useTop(canvas, propItems) {
|
|
|
55
55
|
}, {
|
|
56
56
|
value: top.xScalevalue.title,
|
|
57
57
|
...defaultTextStyle,
|
|
58
|
-
...((_a = top.date) == null ? void 0 : _a.style) || {}
|
|
58
|
+
...((_a = top.date) == null ? void 0 : _a.style) || {},
|
|
59
|
+
...item.titleStyle || {}
|
|
59
60
|
}, {
|
|
60
61
|
left: iconsWidth,
|
|
61
62
|
top: topY
|
|
@@ -115,7 +116,8 @@ function useTop(canvas, propItems) {
|
|
|
115
116
|
}, {
|
|
116
117
|
value: item.title,
|
|
117
118
|
...defaultTextStyle,
|
|
118
|
-
...(item == null ? void 0 : item.style) || {}
|
|
119
|
+
...(item == null ? void 0 : item.style) || {},
|
|
120
|
+
...item.titleStyle || {}
|
|
119
121
|
}, {
|
|
120
122
|
left: iconsWidth,
|
|
121
123
|
top: topY
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyObject, ArrayAble } from '../../../../../../es/src/types';
|
|
1
|
+
import { AnyObject, ArrayAble, Func } from '../../../../../../es/src/types';
|
|
2
2
|
import { FormRequestType } from '../../types';
|
|
3
3
|
import { PropType } from 'vue';
|
|
4
4
|
declare type DependKeyObj = {
|
|
@@ -24,6 +24,9 @@ export declare const SEARCH_CASCADE: import("vue").DefineComponent<{
|
|
|
24
24
|
urlConfig: {
|
|
25
25
|
type: PropType<UrlConfig>;
|
|
26
26
|
};
|
|
27
|
+
onFocus: {
|
|
28
|
+
type: PropType<Func<any[], any>>;
|
|
29
|
+
};
|
|
27
30
|
onChange: {};
|
|
28
31
|
value: {};
|
|
29
32
|
}, () => 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<{
|
|
@@ -38,6 +41,9 @@ export declare const SEARCH_CASCADE: import("vue").DefineComponent<{
|
|
|
38
41
|
urlConfig: {
|
|
39
42
|
type: PropType<UrlConfig>;
|
|
40
43
|
};
|
|
44
|
+
onFocus: {
|
|
45
|
+
type: PropType<Func<any[], any>>;
|
|
46
|
+
};
|
|
41
47
|
onChange: {};
|
|
42
48
|
value: {};
|
|
43
49
|
}>> & {
|
|
@@ -21,6 +21,9 @@ const script = defineComponent({
|
|
|
21
21
|
urlConfig: {
|
|
22
22
|
type: Object
|
|
23
23
|
},
|
|
24
|
+
onFocus: {
|
|
25
|
+
type: Function
|
|
26
|
+
},
|
|
24
27
|
onChange: {},
|
|
25
28
|
value: {}
|
|
26
29
|
},
|
|
@@ -30,15 +33,12 @@ const script = defineComponent({
|
|
|
30
33
|
emit
|
|
31
34
|
}) {
|
|
32
35
|
const _options = ref(null);
|
|
33
|
-
const {
|
|
34
|
-
title
|
|
35
|
-
} = useFormField();
|
|
36
36
|
const asyncQueue = inject(InjectAsyncQueue);
|
|
37
37
|
const {
|
|
38
|
-
field
|
|
38
|
+
field,
|
|
39
|
+
title
|
|
39
40
|
} = useFormField();
|
|
40
41
|
async function fetchData(option) {
|
|
41
|
-
var _a;
|
|
42
42
|
if (!option && _options.value)
|
|
43
43
|
return;
|
|
44
44
|
const config = props.urlConfig;
|
|
@@ -48,56 +48,63 @@ const script = defineComponent({
|
|
|
48
48
|
formRenderLog(`invalid urlConfig (${config}) in CASCADER => ${title.value}`, "warn");
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
|
-
if ((option
|
|
51
|
+
if (deepFor(option) + 1 >= props.deep)
|
|
52
52
|
return;
|
|
53
|
-
const parentDepth = (_a = option == null ? void 0 : option.depth) != null ? _a : -1;
|
|
54
|
-
const params = {
|
|
55
|
-
lvlnr: parentDepth + 1 + ""
|
|
56
|
-
};
|
|
57
|
-
if (option) {
|
|
58
|
-
if (!config.dependKey) {
|
|
59
|
-
formRenderLog(`invalid urlConfig.dependKey ${config.dependKey} in CASCADER => ${title.value}`, "warn");
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
arrayed(config.dependKey).forEach((key) => {
|
|
63
|
-
if (isString(key)) {
|
|
64
|
-
params[key] = option[valueKey.value];
|
|
65
|
-
} else if (isObject(key)) {
|
|
66
|
-
params[key.paramName] = option[key.paramValue];
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
53
|
let data = await asyncQueue.addAsync({
|
|
71
|
-
...config,
|
|
72
|
-
key: title.value
|
|
73
|
-
params
|
|
54
|
+
...createRequestParams(deepFor(option), config, option),
|
|
55
|
+
key: title.value
|
|
74
56
|
});
|
|
75
57
|
if (!Array.isArray(data)) {
|
|
76
58
|
data = [];
|
|
77
59
|
}
|
|
78
60
|
if (!data.length && isObject(option)) {
|
|
79
61
|
option.isLeaf = true;
|
|
80
|
-
|
|
81
|
-
|
|
62
|
+
updateValue(null, null, getOptionChain(option));
|
|
63
|
+
show.value = false;
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const result = data.map((item) => optionNormalize(item, deepFor(option)));
|
|
67
|
+
option ? option.children = result : _options.value = result;
|
|
68
|
+
function deepFor(option2) {
|
|
69
|
+
var _a;
|
|
70
|
+
return (_a = option2 == null ? void 0 : option2.depth) != null ? _a : -1;
|
|
71
|
+
}
|
|
72
|
+
function createRequestParams(deep, config2, option2) {
|
|
73
|
+
const params = {
|
|
74
|
+
lvlnr: deep + 1 + ""
|
|
75
|
+
};
|
|
76
|
+
if (option2 && config2.dependKey) {
|
|
77
|
+
arrayed(config2.dependKey).forEach((key) => {
|
|
78
|
+
if (isString(key)) {
|
|
79
|
+
params[key] = option2[valueKey.value];
|
|
80
|
+
} else if (isObject(key)) {
|
|
81
|
+
params[key.paramName] = option2[key.paramValue];
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
params,
|
|
87
|
+
...config2
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function getOptionChain(option2) {
|
|
91
|
+
let currentOption = option2;
|
|
92
|
+
const result2 = [option2];
|
|
82
93
|
while (currentOption.parent) {
|
|
83
94
|
result2.unshift(currentOption.parent);
|
|
84
95
|
currentOption = currentOption.parent;
|
|
85
96
|
}
|
|
86
|
-
|
|
87
|
-
show.value = false;
|
|
88
|
-
return;
|
|
97
|
+
return result2;
|
|
89
98
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
[labelKey.value]:
|
|
93
|
-
[valueKey.value]:
|
|
94
|
-
depth:
|
|
99
|
+
function optionNormalize(data2, deep) {
|
|
100
|
+
return {
|
|
101
|
+
[labelKey.value]: data2[labelKey.value],
|
|
102
|
+
[valueKey.value]: data2[valueKey.value],
|
|
103
|
+
depth: deep + 1,
|
|
95
104
|
parent: option,
|
|
96
|
-
isLeaf:
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
}, []);
|
|
100
|
-
option ? option.children = result : _options.value = result;
|
|
105
|
+
isLeaf: deep + 2 >= props.deep
|
|
106
|
+
};
|
|
107
|
+
}
|
|
101
108
|
}
|
|
102
109
|
const renderOptions = computed(() => {
|
|
103
110
|
return _options.value || props.options || [];
|
|
@@ -134,23 +141,28 @@ const script = defineComponent({
|
|
|
134
141
|
}
|
|
135
142
|
});
|
|
136
143
|
function updateValue(_, __, options) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
+
emit("update:value", options.map(optionSimplify));
|
|
145
|
+
function optionSimplify(option) {
|
|
146
|
+
return {
|
|
147
|
+
...option,
|
|
148
|
+
label: option[labelKey.value],
|
|
149
|
+
children: void 0,
|
|
150
|
+
parent: void 0
|
|
151
|
+
};
|
|
152
|
+
}
|
|
144
153
|
}
|
|
145
154
|
const show = ref(false);
|
|
146
155
|
function updateShow(v) {
|
|
147
156
|
show.value = !!v;
|
|
148
157
|
v && fetchData();
|
|
149
158
|
}
|
|
150
|
-
function onFocus
|
|
151
|
-
|
|
152
|
-
field.value
|
|
153
|
-
|
|
159
|
+
function focusDecorator(onFocus) {
|
|
160
|
+
return (...args) => {
|
|
161
|
+
if (isField(field.value)) {
|
|
162
|
+
field.value.visited = true;
|
|
163
|
+
}
|
|
164
|
+
onFocus == null ? void 0 : onFocus(...args);
|
|
165
|
+
};
|
|
154
166
|
}
|
|
155
167
|
return () => {
|
|
156
168
|
return createVNode(NCascader, {
|
|
@@ -163,7 +175,7 @@ const script = defineComponent({
|
|
|
163
175
|
"options": renderOptions.value,
|
|
164
176
|
"checkStrategy": "child",
|
|
165
177
|
"onLoad": fetchData,
|
|
166
|
-
"onFocus": onFocus,
|
|
178
|
+
"onFocus": focusDecorator(props.onFocus),
|
|
167
179
|
"onUpdate:show": updateShow
|
|
168
180
|
}, slots);
|
|
169
181
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, computed, createVNode, Fragment } from 'vue';
|
|
2
|
-
import { assignUpdateValue } from '../../utils/index.js';
|
|
2
|
+
import { createSlot, assignUpdateValue } from '../../utils/index.js';
|
|
3
3
|
import { connect, mapProps } from '@formily/vue';
|
|
4
4
|
import { NInput } from 'naive-ui';
|
|
5
5
|
|
|
@@ -19,10 +19,10 @@ const script = defineComponent({
|
|
|
19
19
|
const _slots = computed(() => {
|
|
20
20
|
const res = {};
|
|
21
21
|
if (props.prefix) {
|
|
22
|
-
res.prefix = () => createVNode(Fragment, null, [props.prefix]);
|
|
22
|
+
res.prefix = () => createVNode(Fragment, null, [createSlot(props.prefix, props).default()]);
|
|
23
23
|
}
|
|
24
24
|
if (props.suffix) {
|
|
25
|
-
res.suffix = () => createVNode(Fragment, null, [props.suffix]);
|
|
25
|
+
res.suffix = () => createVNode(Fragment, null, [createSlot(props.suffix, props).default()]);
|
|
26
26
|
}
|
|
27
27
|
return res;
|
|
28
28
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyObject } from '../../../../../../es/src/types';
|
|
1
|
+
import { AnyObject, Func } from '../../../../../../es/src/types';
|
|
2
2
|
import { FormRequestType } from '../../types';
|
|
3
3
|
import { PropType } from 'vue';
|
|
4
4
|
declare type UrlConfig = {
|
|
@@ -20,9 +20,10 @@ export declare const SELECT: import("vue").DefineComponent<{
|
|
|
20
20
|
urlConfig: {
|
|
21
21
|
type: PropType<UrlConfig>;
|
|
22
22
|
};
|
|
23
|
-
|
|
24
|
-
type:
|
|
23
|
+
onFocus: {
|
|
24
|
+
type: PropType<Func<any[], any>>;
|
|
25
25
|
};
|
|
26
|
+
onChange: {};
|
|
26
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<{
|
|
27
28
|
value: {
|
|
28
29
|
type: StringConstructor;
|
|
@@ -34,9 +35,10 @@ export declare const SELECT: import("vue").DefineComponent<{
|
|
|
34
35
|
urlConfig: {
|
|
35
36
|
type: PropType<UrlConfig>;
|
|
36
37
|
};
|
|
37
|
-
|
|
38
|
-
type:
|
|
38
|
+
onFocus: {
|
|
39
|
+
type: PropType<Func<any[], any>>;
|
|
39
40
|
};
|
|
41
|
+
onChange: {};
|
|
40
42
|
}>> & {
|
|
41
43
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
42
44
|
}, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref, inject, computed, watch, createVNode } from 'vue';
|
|
1
|
+
import { defineComponent, ref, inject, computed, watch, nextTick, createVNode } from 'vue';
|
|
2
2
|
import { isField } from '@formily/core';
|
|
3
3
|
import { cloneDeep } from 'lodash-es';
|
|
4
4
|
import { InjectAsyncQueue, InjectionFormItemDepsCollector, InjectionChangeContextCollector } from '../../constants/index.js';
|
|
@@ -21,17 +21,17 @@ const script = defineComponent({
|
|
|
21
21
|
urlConfig: {
|
|
22
22
|
type: Object
|
|
23
23
|
},
|
|
24
|
-
|
|
24
|
+
onFocus: {
|
|
25
25
|
type: Function
|
|
26
|
-
}
|
|
26
|
+
},
|
|
27
|
+
onChange: {}
|
|
27
28
|
},
|
|
28
29
|
emits: ["update:value"],
|
|
29
30
|
setup(props, {
|
|
30
31
|
slots,
|
|
31
32
|
emit
|
|
32
33
|
}) {
|
|
33
|
-
const
|
|
34
|
-
let cachedOptions = null;
|
|
34
|
+
const remoteOptions = ref(null);
|
|
35
35
|
const lastSearch = ref("");
|
|
36
36
|
const asyncQueue = inject(InjectAsyncQueue);
|
|
37
37
|
const {
|
|
@@ -45,54 +45,46 @@ const script = defineComponent({
|
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
async function fetchData(content) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
} else {
|
|
52
|
-
lastSearch.value = content || "";
|
|
53
|
-
}
|
|
48
|
+
lastSearch.value = content || "";
|
|
49
|
+
if (remoteOptions.value)
|
|
50
|
+
return;
|
|
54
51
|
const config = props.urlConfig;
|
|
55
52
|
if (!config) {
|
|
56
|
-
return
|
|
53
|
+
return remoteOptions.value = null;
|
|
57
54
|
}
|
|
58
55
|
if (!isObject(config)) {
|
|
59
56
|
formRenderLog(`invalid urlConfig (${config}) in SELECT => ${title.value}`, "warn");
|
|
60
|
-
return
|
|
61
|
-
}
|
|
62
|
-
if (cachedOptions) {
|
|
63
|
-
return _options.value = filterOption(cachedOptions, content);
|
|
57
|
+
return remoteOptions.value = null;
|
|
64
58
|
}
|
|
65
59
|
try {
|
|
66
|
-
|
|
67
|
-
...config,
|
|
68
|
-
key: title.value
|
|
69
|
-
params: Object.assign({}, config.params, generateUrlParams(field.value, config.dependKey))
|
|
60
|
+
remoteOptions.value = await asyncQueue.addAsync({
|
|
61
|
+
...createParams(config, field.value),
|
|
62
|
+
key: title.value
|
|
70
63
|
});
|
|
71
|
-
_options.value = data.reduce((res, d) => {
|
|
72
|
-
var _a;
|
|
73
|
-
if (((_a = d[labelKey.value]) == null ? void 0 : _a.includes(content)) || !content) {
|
|
74
|
-
res.push(d);
|
|
75
|
-
}
|
|
76
|
-
return res;
|
|
77
|
-
}, []);
|
|
78
|
-
cachedOptions = _options.value;
|
|
79
64
|
} catch (e) {
|
|
80
|
-
|
|
65
|
+
remoteOptions.value = null;
|
|
66
|
+
}
|
|
67
|
+
function createParams(config2, field2) {
|
|
68
|
+
return {
|
|
69
|
+
...config2,
|
|
70
|
+
params: Object.assign({}, config2.params, generateUrlParams(field2, config2.dependKey))
|
|
71
|
+
};
|
|
81
72
|
}
|
|
82
73
|
}
|
|
83
74
|
const parsedOptions = computed(() => {
|
|
84
|
-
if (
|
|
85
|
-
return
|
|
75
|
+
if (remoteOptions.value)
|
|
76
|
+
return filterOption(remoteOptions.value, lastSearch.value);
|
|
86
77
|
if (!Array.isArray(props.options))
|
|
87
78
|
return [];
|
|
88
79
|
return filterOption(props.options, lastSearch.value);
|
|
89
80
|
});
|
|
90
81
|
const formItemDepsCollector = inject(InjectionFormItemDepsCollector);
|
|
91
82
|
watch(() => props.urlConfig, (config) => {
|
|
92
|
-
|
|
93
|
-
config && formItemDepsCollector.setDeps(fieldKey.value, config.dependKey || [], () => {
|
|
94
|
-
|
|
95
|
-
|
|
83
|
+
remoteOptions.value = null;
|
|
84
|
+
config && formItemDepsCollector.setDeps(fieldKey.value, config.dependKey || [], async () => {
|
|
85
|
+
remoteOptions.value = null;
|
|
86
|
+
await nextTick();
|
|
87
|
+
props.value != null && await fetchData();
|
|
96
88
|
});
|
|
97
89
|
}, {
|
|
98
90
|
immediate: true
|
|
@@ -121,10 +113,13 @@ const script = defineComponent({
|
|
|
121
113
|
var _a, _b;
|
|
122
114
|
return (_b = (_a = props.urlConfig) == null ? void 0 : _a.valueKey) != null ? _b : "value";
|
|
123
115
|
});
|
|
124
|
-
function onFocus
|
|
125
|
-
|
|
126
|
-
field.value
|
|
127
|
-
|
|
116
|
+
function focusDecorator(onFocus) {
|
|
117
|
+
return (...args) => {
|
|
118
|
+
if (isField(field.value)) {
|
|
119
|
+
field.value.visited = true;
|
|
120
|
+
}
|
|
121
|
+
return onFocus == null ? void 0 : onFocus(...args);
|
|
122
|
+
};
|
|
128
123
|
}
|
|
129
124
|
return () => createVNode(NSelect, {
|
|
130
125
|
"value": props.value,
|
|
@@ -135,7 +130,7 @@ const script = defineComponent({
|
|
|
135
130
|
"valueField": valueKey.value,
|
|
136
131
|
"onSearch": fetchData,
|
|
137
132
|
"onUpdate:show": (show) => show && fetchData(),
|
|
138
|
-
"onFocus": onFocus,
|
|
133
|
+
"onFocus": focusDecorator(props.onFocus),
|
|
139
134
|
"options": parsedOptions.value
|
|
140
135
|
}, slots);
|
|
141
136
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { createVNode, mergeProps, isVNode } from 'vue';
|
|
2
2
|
import { connect, mapProps } from '@formily/vue';
|
|
3
|
-
import {
|
|
3
|
+
import { isFunction } from 'lodash-es';
|
|
4
4
|
import { NButton } from 'naive-ui';
|
|
5
|
+
import { createSlot } from '../../../../../packages/form-render/src/utils';
|
|
5
6
|
|
|
6
7
|
function _isSlot(s) {
|
|
7
8
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
@@ -12,20 +13,6 @@ function createPropFor(props) {
|
|
|
12
13
|
return (_a = props.fieldItem) == null ? void 0 : _a[property];
|
|
13
14
|
};
|
|
14
15
|
}
|
|
15
|
-
function createSlot(renderer, props) {
|
|
16
|
-
if (isObject(renderer)) {
|
|
17
|
-
const result = {};
|
|
18
|
-
Object.entries(renderer).forEach(([key, renderer2]) => {
|
|
19
|
-
isFunction(renderer2) && (result[key] = () => renderer2(props));
|
|
20
|
-
});
|
|
21
|
-
return result;
|
|
22
|
-
}
|
|
23
|
-
return {
|
|
24
|
-
default() {
|
|
25
|
-
return isFunction(renderer) ? renderer(props) : renderer;
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
16
|
const textScript = (props) => {
|
|
30
17
|
var _a, _b, _c;
|
|
31
18
|
const propFor = createPropFor(props);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AnyObject } from '../../../../../es/src/types';
|
|
1
|
+
import { AnyObject, ArrayAble } from '../../../../../es/src/types';
|
|
2
2
|
import { ISchema } from '@formily/json-schema/esm/types';
|
|
3
3
|
import { GeneralField } from '@formily/core';
|
|
4
|
-
import { InjectionKey } from 'vue';
|
|
4
|
+
import { InjectionKey, VNode } from 'vue';
|
|
5
5
|
import { AgeContext, IdCardParseInfo } from '../types';
|
|
6
6
|
export declare function formRenderLog(message: string, type?: keyof Console): void;
|
|
7
7
|
export declare function arrayed<T>(maybeArray: T): T extends Array<any> ? T : [T];
|
|
@@ -17,3 +17,6 @@ export declare function injectOrProvide<T>(key: InjectionKey<T>, creator: () =>
|
|
|
17
17
|
export declare function generateUrlParams(field: GeneralField, dependKeys?: string | string[]): AnyObject;
|
|
18
18
|
export declare function traverseSchema(schema: ISchema, handler: (_s: ISchema) => void): void;
|
|
19
19
|
export declare function uuidGenerator(): string;
|
|
20
|
+
export declare function createSlot(renderer: unknown, props: any): Record<string, () => ArrayAble<VNode>> | {
|
|
21
|
+
default(): any;
|
|
22
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isObject } from 'lodash-es';
|
|
1
|
+
import { isObject, isFunction } from 'lodash-es';
|
|
2
2
|
import { FIELD_SEX_VALUE } from '../constants/index.js';
|
|
3
3
|
import { isField } from '@formily/core';
|
|
4
4
|
import differenceInDays from '../../../../node_modules/date-fns/esm/differenceInDays/index.js';
|
|
@@ -95,5 +95,19 @@ function uuidGenerator() {
|
|
|
95
95
|
return v.toString(16);
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
|
+
function createSlot(renderer, props) {
|
|
99
|
+
if (isObject(renderer) && !isFunction(renderer)) {
|
|
100
|
+
const result = {};
|
|
101
|
+
Object.entries(renderer).forEach(([key, renderer2]) => {
|
|
102
|
+
isFunction(renderer2) && (result[key] = () => renderer2(props));
|
|
103
|
+
});
|
|
104
|
+
return result;
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
default() {
|
|
108
|
+
return isFunction(renderer) ? renderer(props) : renderer;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
}
|
|
98
112
|
|
|
99
|
-
export { arrayed, assignUpdateValue, formRenderLog, generateUrlParams, injectOrProvide, isIdCard, isMobile, parseBirthday, parseIdCard, transformDateFormat, traverseSchema, uuidGenerator };
|
|
113
|
+
export { arrayed, assignUpdateValue, createSlot, formRenderLog, generateUrlParams, injectOrProvide, isIdCard, isMobile, parseBirthday, parseIdCard, transformDateFormat, traverseSchema, uuidGenerator };
|
package/es/packages/index.css
CHANGED
|
@@ -2775,3 +2775,14 @@ body > .vxe-table--tooltip-wrapper {
|
|
|
2775
2775
|
.c-fabric-chart-popup-menu > li.no-click:hover {
|
|
2776
2776
|
background: #fff;
|
|
2777
2777
|
}
|
|
2778
|
+
.shortcut-provider {
|
|
2779
|
+
outline: none;
|
|
2780
|
+
}
|
|
2781
|
+
.shortcut-setter-item__wrapper {
|
|
2782
|
+
display: flex;
|
|
2783
|
+
}
|
|
2784
|
+
.shortcut-setter-item__operation {
|
|
2785
|
+
margin-left: 12px;
|
|
2786
|
+
display: flex;
|
|
2787
|
+
gap: 12px;
|
|
2788
|
+
}
|
package/es/packages/index.d.ts
CHANGED
|
@@ -16,9 +16,12 @@ import CBpmnWorkflow from './bpmn-workflow';
|
|
|
16
16
|
import Editor from './editor';
|
|
17
17
|
import CFormRender from './form-render';
|
|
18
18
|
import CFabricChart from './fabric-chart';
|
|
19
|
+
import CShortcutProvider from './shortcut-provider';
|
|
20
|
+
import CShortcutSetter from './shortcut-setter';
|
|
19
21
|
export * from './form-render';
|
|
22
|
+
export * from './shortcut-provider';
|
|
20
23
|
declare function install(app: App): void;
|
|
21
|
-
export { CGrid, CBigTable, CFieldSet, CDragLayout, CButtonPrint, CSelectPerson, CSelectLabel, CLabelFormContent, CScaleView, CMap, CVodChunkUpload, CRadio, CCheckbox, CSelect, CDatetime, CFormTable, CInfoHeader, CTimeLine, CBpmnWorkflow, Editor, CFormRender, CFabricChart };
|
|
24
|
+
export { CGrid, CBigTable, CFieldSet, CDragLayout, CButtonPrint, CSelectPerson, CSelectLabel, CLabelFormContent, CScaleView, CMap, CVodChunkUpload, CRadio, CCheckbox, CSelect, CDatetime, CFormTable, CInfoHeader, CTimeLine, CBpmnWorkflow, Editor, CFormRender, CFabricChart, CShortcutProvider, CShortcutSetter };
|
|
22
25
|
declare const _default: {
|
|
23
26
|
install: typeof install;
|
|
24
27
|
};
|