cnhis-design-vue 3.1.14-beta.0 → 3.1.14-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/es/packages/annotation-edit/index.d.ts +17 -0
- package/es/packages/annotation-edit/index.js +10 -0
- package/es/packages/annotation-edit/src/AnnotationEdit.d.ts +16 -0
- package/es/packages/annotation-edit/src/AnnotationEdit.js +119 -0
- package/es/packages/annotation-edit/style/index.css +15 -0
- package/es/packages/big-table/index.d.ts +2 -9
- package/es/packages/big-table/src/BigTable.vue.d.ts +30 -18
- package/es/packages/big-table/src/BigTable.vue_vue_type_script_setup_true_lang.js +53 -25
- package/es/packages/big-table/src/bigTableEmits.js +1 -1
- package/es/packages/big-table/src/components/edit-form/edit-separate.vue.d.ts +25 -8
- package/es/packages/big-table/src/components/edit-form/edit-separate.vue_vue_type_script_setup_true_lang.js +29 -9
- package/es/packages/big-table/src/components/separate.vue.d.ts +3 -4
- package/es/packages/big-table/src/components/separate.vue_vue_type_script_setup_true_lang.js +7 -3
- package/es/packages/big-table/src/hooks/useColumnConfigAdaptor.js +8 -4
- package/es/packages/big-table/src/hooks/useEdit.d.ts +25 -7
- package/es/packages/big-table/src/hooks/useSeparateRow.d.ts +1 -1
- package/es/packages/big-table/src/hooks/useSeparateRow.js +14 -10
- package/es/packages/big-table/src/utils.js +3 -3
- package/es/packages/big-table/style/index.css +15 -2
- package/es/packages/button-print/index.d.ts +1 -0
- package/es/packages/button-print/index.js +1 -0
- package/es/packages/button-print/src/ButtonPrint.vue_vue_type_script_setup_true_lang.js +5 -1
- package/es/packages/button-print/src/utils/index.d.ts +1 -0
- package/es/packages/button-print/src/utils/index.js +1 -0
- package/es/packages/button-print/src/utils/print.d.ts +1 -1
- package/es/packages/button-print/src/utils/print.js +1 -1
- package/es/packages/fabric-chart/index.d.ts +7 -2
- package/es/packages/fabric-chart/src/FabricChart.vue.d.ts +8 -3
- package/es/packages/fabric-chart/src/FabricChart.vue_vue_type_script_setup_true_lang.js +41 -9
- package/es/packages/fabric-chart/src/hooks/index.d.ts +1 -1
- package/es/packages/fabric-chart/src/hooks/index.js +2 -2
- package/es/packages/fabric-chart/src/hooks/useCenter.js +54 -33
- package/es/packages/fabric-chart/src/hooks/useDraw.js +1 -0
- package/es/packages/fabric-chart/src/hooks/useEvent.d.ts +6 -0
- package/es/packages/fabric-chart/src/hooks/useEvent.js +68 -1
- package/es/packages/fabric-chart/src/hooks/useLeft.js +14 -14
- package/es/packages/fabric-chart/src/hooks/useRight.js +2 -13
- package/es/packages/fabric-chart/src/hooks/useTop.js +10 -20
- package/es/packages/fabric-chart/src/interface.d.ts +7 -0
- package/es/packages/form-render/index.d.ts +1 -1
- package/es/packages/form-render/src/FormRender.vue.d.ts +1 -1
- package/es/packages/form-render/src/components/renderer/cascader.d.ts +3 -3
- package/es/packages/form-render/src/components/renderer/cascader.js +41 -52
- package/es/packages/form-render/src/components/renderer/formItem.js +8 -92
- package/es/packages/form-render/src/components/renderer/input.js +5 -16
- package/es/packages/form-render/src/components/renderer/inputNumber.d.ts +12 -0
- package/es/packages/form-render/src/components/renderer/inputNumber.js +11 -4
- package/es/packages/form-render/src/components/renderer/select.js +16 -10
- package/es/packages/form-render/src/components/renderer/simpleComponent.d.ts +15 -2
- package/es/packages/form-render/src/components/renderer/simpleComponent.js +16 -15
- package/es/packages/form-render/src/hooks/useAnchor.d.ts +1 -1
- package/es/packages/form-render/src/hooks/useAnchor.js +3 -3
- package/es/packages/form-render/src/hooks/useAsyncQueue.js +1 -1
- package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +11 -7
- package/es/packages/form-render/src/hooks/useFormItemDeps.d.ts +2 -2
- package/es/packages/form-render/src/hooks/useFormItemDeps.js +5 -6
- package/es/packages/form-render/src/types/fieldItem.d.ts +2 -1
- package/es/packages/form-render/src/utils/index.d.ts +9 -2
- package/es/packages/form-render/src/utils/index.js +43 -14
- package/es/packages/form-render/style/index.css +17 -15
- package/es/packages/index.css +32 -17
- package/es/packages/index.d.ts +1 -0
- package/es/packages/index.js +1 -0
- package/es/packages/info-header/index.d.ts +1375 -358
- package/es/packages/info-header/src/HiddenContent.vue.d.ts +689 -178
- package/es/packages/info-header/src/HiddenContent.vue_vue_type_script_setup_true_lang.js +11 -13
- package/es/packages/info-header/src/InfoEllipsis.js +4 -0
- package/es/packages/info-header/src/InfoEllipsis.vue.d.ts +833 -0
- package/es/packages/info-header/src/InfoEllipsis.vue_vue_type_script_setup_true_lang.js +41 -0
- package/es/packages/info-header/src/InfoHeader.vue.d.ts +1375 -358
- package/es/packages/info-header/src/InfoHeader.vue_vue_type_script_setup_true_lang.js +9 -13
- package/es/{packages/info-header/src → src/components/SlotRender}/SlotRender.d.ts +3 -5
- package/es/{packages/info-header/src → src/components/SlotRender}/SlotRender.js +9 -9
- package/es/src/components/SlotRender/index.d.ts +2 -0
- package/es/src/components/SlotRender/index.js +2 -0
- package/global.d.ts +8 -8
- package/package.json +2 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defineComponent, ref, inject, computed, watch, createVNode } from 'vue';
|
|
2
2
|
import { isField } from '@formily/core';
|
|
3
|
-
import {
|
|
3
|
+
import { isEqual } from 'lodash-es';
|
|
4
4
|
import { InjectAsyncQueue } from '../../constants/index.js';
|
|
5
|
-
import { assignUpdateValue,
|
|
5
|
+
import { assignUpdateValue, traverseDependKey } from '../../utils/index.js';
|
|
6
6
|
import { connect, mapProps } from '@formily/vue';
|
|
7
7
|
import { NCascader } from 'naive-ui';
|
|
8
8
|
import { useFormField } from '../../hooks/useFormField.js';
|
|
@@ -14,7 +14,7 @@ const script = defineComponent({
|
|
|
14
14
|
type: Array,
|
|
15
15
|
default: () => []
|
|
16
16
|
},
|
|
17
|
-
|
|
17
|
+
depth: {
|
|
18
18
|
type: [Number, String],
|
|
19
19
|
required: true
|
|
20
20
|
},
|
|
@@ -32,59 +32,41 @@ const script = defineComponent({
|
|
|
32
32
|
slots,
|
|
33
33
|
emit
|
|
34
34
|
}) {
|
|
35
|
-
const
|
|
35
|
+
const remoteOptions = ref(null);
|
|
36
36
|
const asyncQueue = inject(InjectAsyncQueue);
|
|
37
37
|
const {
|
|
38
38
|
field,
|
|
39
39
|
title
|
|
40
40
|
} = useFormField();
|
|
41
41
|
async function fetchData(option) {
|
|
42
|
-
if (!option &&
|
|
42
|
+
if (!option && remoteOptions.value)
|
|
43
43
|
return;
|
|
44
|
-
|
|
45
|
-
if (!config)
|
|
44
|
+
if (!configFor(props))
|
|
46
45
|
return;
|
|
47
|
-
if (
|
|
48
|
-
formRenderLog(`invalid urlConfig (${config}) in CASCADER => ${title.value}`, "warn");
|
|
46
|
+
if (deepFor(option) + 1 >= deepFor(props))
|
|
49
47
|
return;
|
|
50
|
-
|
|
51
|
-
if (
|
|
52
|
-
return;
|
|
53
|
-
let data = await asyncQueue.addAsync({
|
|
54
|
-
...createRequestParams(deepFor(option), config, option),
|
|
55
|
-
key: title.value
|
|
56
|
-
});
|
|
57
|
-
if (!Array.isArray(data)) {
|
|
58
|
-
data = [];
|
|
59
|
-
}
|
|
60
|
-
if (!data.length && isObject(option)) {
|
|
48
|
+
const data = await asyncQueue.addAsync(createRequestParams(deepFor(option), configFor(props), title.value, option));
|
|
49
|
+
if (!data.length && option) {
|
|
61
50
|
option.isLeaf = true;
|
|
62
51
|
updateValue(null, null, getOptionChain(option));
|
|
63
52
|
show.value = false;
|
|
64
53
|
return;
|
|
65
54
|
}
|
|
66
55
|
const result = data.map((item) => optionNormalize(item, deepFor(option)));
|
|
67
|
-
option ? option.children = result :
|
|
68
|
-
function
|
|
69
|
-
var _a;
|
|
70
|
-
return (_a = option2 == null ? void 0 : option2.depth) != null ? _a : -1;
|
|
71
|
-
}
|
|
72
|
-
function createRequestParams(deep, config2, option2) {
|
|
56
|
+
option ? option.children = result : remoteOptions.value = result;
|
|
57
|
+
function createRequestParams(deep, config, key, option2) {
|
|
73
58
|
const params = {
|
|
74
59
|
lvlnr: deep + 1 + ""
|
|
75
60
|
};
|
|
76
|
-
if (option2 &&
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
params[key] = option2[valueKey.value];
|
|
80
|
-
} else if (isObject(key)) {
|
|
81
|
-
params[key.paramName] = option2[key.paramValue];
|
|
82
|
-
}
|
|
61
|
+
if (option2 && config.dependKey) {
|
|
62
|
+
traverseDependKey(config.dependKey, (dependKey, valueKey2) => {
|
|
63
|
+
params[valueKey2] = option2[dependKey];
|
|
83
64
|
});
|
|
84
65
|
}
|
|
85
66
|
return {
|
|
86
67
|
params,
|
|
87
|
-
...
|
|
68
|
+
...config,
|
|
69
|
+
key
|
|
88
70
|
};
|
|
89
71
|
}
|
|
90
72
|
function getOptionChain(option2) {
|
|
@@ -96,30 +78,39 @@ const script = defineComponent({
|
|
|
96
78
|
}
|
|
97
79
|
return result2;
|
|
98
80
|
}
|
|
99
|
-
function optionNormalize(data2,
|
|
81
|
+
function optionNormalize(data2, depth) {
|
|
100
82
|
return {
|
|
101
83
|
[labelKey.value]: data2[labelKey.value],
|
|
102
84
|
[valueKey.value]: data2[valueKey.value],
|
|
103
|
-
depth:
|
|
85
|
+
depth: depth + 1,
|
|
104
86
|
parent: option,
|
|
105
|
-
isLeaf:
|
|
87
|
+
isLeaf: depth + 2 >= deepFor(props)
|
|
106
88
|
};
|
|
107
89
|
}
|
|
90
|
+
function configFor(target) {
|
|
91
|
+
return target.urlConfig;
|
|
92
|
+
}
|
|
93
|
+
function deepFor(target) {
|
|
94
|
+
var _a;
|
|
95
|
+
return (_a = target == null ? void 0 : target.depth) != null ? _a : -1;
|
|
96
|
+
}
|
|
108
97
|
}
|
|
109
|
-
const
|
|
110
|
-
return
|
|
98
|
+
const parsedOptions = computed(() => {
|
|
99
|
+
return remoteOptions.value || props.options || [];
|
|
111
100
|
});
|
|
112
101
|
watch(() => props.value, (n, o) => {
|
|
113
102
|
var _a, _b;
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
if (isField(field.value) && field.value.visited) {
|
|
118
|
-
(_b = (_a = field.value).validate) == null ? void 0 : _b.call(_a);
|
|
119
|
-
}
|
|
103
|
+
n != null && o == null && fetchData();
|
|
104
|
+
isField(field.value) && field.value.visited && ((_b = (_a = field.value).validate) == null ? void 0 : _b.call(_a));
|
|
120
105
|
}, {
|
|
121
106
|
immediate: true
|
|
122
107
|
});
|
|
108
|
+
watch(() => props.urlConfig, async (config, oldConfig) => {
|
|
109
|
+
if (isEqual(config, oldConfig))
|
|
110
|
+
return;
|
|
111
|
+
remoteOptions.value = null;
|
|
112
|
+
await fetchData();
|
|
113
|
+
});
|
|
123
114
|
const labelKey = computed(() => {
|
|
124
115
|
var _a, _b;
|
|
125
116
|
return (_b = (_a = props.urlConfig) == null ? void 0 : _a.nameKey) != null ? _b : "text";
|
|
@@ -131,13 +122,11 @@ const script = defineComponent({
|
|
|
131
122
|
const _value = computed(() => {
|
|
132
123
|
try {
|
|
133
124
|
const parsed = Array.isArray(props.value) ? props.value : JSON.parse(props.value || "");
|
|
134
|
-
if (Array.isArray(parsed))
|
|
135
|
-
return
|
|
136
|
-
|
|
137
|
-
return [];
|
|
138
|
-
}
|
|
125
|
+
if (!Array.isArray(parsed) || !parsed.length)
|
|
126
|
+
return null;
|
|
127
|
+
return parsed.map((option) => option[labelKey.value]).join(" / ");
|
|
139
128
|
} catch (e) {
|
|
140
|
-
return
|
|
129
|
+
return null;
|
|
141
130
|
}
|
|
142
131
|
});
|
|
143
132
|
function updateValue(_, __, options) {
|
|
@@ -172,7 +161,7 @@ const script = defineComponent({
|
|
|
172
161
|
"remote": true,
|
|
173
162
|
"labelField": labelKey.value,
|
|
174
163
|
"valueField": valueKey.value,
|
|
175
|
-
"options":
|
|
164
|
+
"options": parsedOptions.value,
|
|
176
165
|
"checkStrategy": "child",
|
|
177
166
|
"onLoad": fetchData,
|
|
178
167
|
"onFocus": focusDecorator(props.onFocus),
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent, inject, computed,
|
|
1
|
+
import { defineComponent, inject, computed, createVNode } from 'vue';
|
|
2
2
|
import { isVoidField } from '@formily/core';
|
|
3
3
|
import { connect, mapProps } from '@formily/vue';
|
|
4
|
-
import { FileTrayFull, FileTray } from '@vicons/ionicons5';
|
|
5
4
|
import { isBoolean } from 'lodash-es';
|
|
6
|
-
import { NFormItem
|
|
5
|
+
import { NFormItem } from 'naive-ui';
|
|
6
|
+
import AnnotationEdit from '../../../../../packages/annotation-edit';
|
|
7
7
|
import { InjectionAnnotation } from '../../../../../packages/form-render/src/constants';
|
|
8
8
|
|
|
9
9
|
const script = defineComponent({
|
|
@@ -27,96 +27,12 @@ const script = defineComponent({
|
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
-
function renderTextarea() {
|
|
31
|
-
return createVNode(NInput, {
|
|
32
|
-
"type": "textarea",
|
|
33
|
-
"value": annotationContent.value,
|
|
34
|
-
"onUpdate:value": ($event) => annotationContent.value = $event
|
|
35
|
-
}, null);
|
|
36
|
-
}
|
|
37
|
-
const __showPopper = ref(false);
|
|
38
|
-
const showPopper = computed({
|
|
39
|
-
get() {
|
|
40
|
-
return __showPopper.value;
|
|
41
|
-
},
|
|
42
|
-
async set(value) {
|
|
43
|
-
__showPopper.value = value;
|
|
44
|
-
if (!value && isEdit.value) {
|
|
45
|
-
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
46
|
-
isEdit.value = false;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
const isEdit = ref(false);
|
|
51
|
-
let clickTimer;
|
|
52
|
-
function iconClick() {
|
|
53
|
-
clearTimeout(clickTimer);
|
|
54
|
-
if (showPopper.value && isEdit.value) {
|
|
55
|
-
showPopper.value = false;
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
clickTimer = setTimeout(() => {
|
|
59
|
-
if (!annotationContent.value) {
|
|
60
|
-
isEdit.value = showPopper.value = true;
|
|
61
|
-
}
|
|
62
|
-
}, 200);
|
|
63
|
-
}
|
|
64
|
-
function iconDbClick() {
|
|
65
|
-
clearTimeout(clickTimer);
|
|
66
|
-
if (!annotationContent.value)
|
|
67
|
-
return;
|
|
68
|
-
showPopper.value = true;
|
|
69
|
-
isEdit.value = true;
|
|
70
|
-
}
|
|
71
|
-
function iconMouseenter() {
|
|
72
|
-
if (!annotationContent.value)
|
|
73
|
-
return;
|
|
74
|
-
showPopper.value = true;
|
|
75
|
-
}
|
|
76
|
-
function iconMouseleave() {
|
|
77
|
-
if (!annotationContent.value || isEdit.value)
|
|
78
|
-
return;
|
|
79
|
-
showPopper.value = false;
|
|
80
|
-
}
|
|
81
30
|
function renderAnnotation() {
|
|
82
|
-
return createVNode(
|
|
83
|
-
"class":
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
"--icon-right": "-5"
|
|
88
|
-
},
|
|
89
|
-
"form-item-hover-show": !annotationContent.value && !isEdit.value
|
|
90
|
-
}, [createVNode(NPopover, {
|
|
91
|
-
"style": {
|
|
92
|
-
maxWidth: "200px",
|
|
93
|
-
wordBreak: "break-all"
|
|
94
|
-
},
|
|
95
|
-
"show": showPopper.value,
|
|
96
|
-
"onUpdate:show": ($event) => showPopper.value = $event,
|
|
97
|
-
"trigger": "manual",
|
|
98
|
-
"duration": 100
|
|
99
|
-
}, {
|
|
100
|
-
default: renderDefault,
|
|
101
|
-
trigger: renderTrigger
|
|
102
|
-
})]);
|
|
103
|
-
function renderText() {
|
|
104
|
-
return createVNode("span", null, [annotationContent.value]);
|
|
105
|
-
}
|
|
106
|
-
function renderDefault() {
|
|
107
|
-
return createVNode("div", null, [isEdit.value ? renderTextarea() : renderText()]);
|
|
108
|
-
}
|
|
109
|
-
function renderTrigger() {
|
|
110
|
-
return createVNode("div", {
|
|
111
|
-
"class": "form-render__formItemLabel--icon",
|
|
112
|
-
"onMouseleave": iconMouseleave,
|
|
113
|
-
"onMouseenter": iconMouseenter,
|
|
114
|
-
"onDblclick": iconDbClick,
|
|
115
|
-
"onClick": iconClick
|
|
116
|
-
}, [createVNode(NIcon, {
|
|
117
|
-
"component": annotationContent.value ? FileTrayFull : FileTray
|
|
118
|
-
}, null)]);
|
|
119
|
-
}
|
|
31
|
+
return createVNode(AnnotationEdit, {
|
|
32
|
+
"class": "form-render__formItemLabel--annotation",
|
|
33
|
+
"modelValue": annotationContent.value,
|
|
34
|
+
"onUpdate:modelValue": ($event) => annotationContent.value = $event
|
|
35
|
+
}, null);
|
|
120
36
|
}
|
|
121
37
|
const showAnnotation = computed(() => {
|
|
122
38
|
return annotation.value && (!isBoolean(props.annotation) || props.annotation);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent,
|
|
2
|
-
import {
|
|
1
|
+
import { defineComponent, createVNode } from 'vue';
|
|
2
|
+
import { createInputSlot, assignUpdateValue } from '../../utils/index.js';
|
|
3
3
|
import { connect, mapProps } from '@formily/vue';
|
|
4
4
|
import { NInput } from 'naive-ui';
|
|
5
5
|
|
|
@@ -13,21 +13,10 @@ const script = defineComponent({
|
|
|
13
13
|
type: String
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
|
-
setup(props
|
|
17
|
-
|
|
18
|
-
}) {
|
|
19
|
-
const _slots = computed(() => {
|
|
20
|
-
const res = {};
|
|
21
|
-
if (props.prefix) {
|
|
22
|
-
res.prefix = () => createVNode(Fragment, null, [createSlot(props.prefix, props).default()]);
|
|
23
|
-
}
|
|
24
|
-
if (props.suffix) {
|
|
25
|
-
res.suffix = () => createVNode(Fragment, null, [createSlot(props.suffix, props).default()]);
|
|
26
|
-
}
|
|
27
|
-
return res;
|
|
28
|
-
});
|
|
16
|
+
setup(props) {
|
|
17
|
+
const _slots = createInputSlot(props);
|
|
29
18
|
return () => {
|
|
30
|
-
return createVNode(NInput,
|
|
19
|
+
return createVNode(NInput, null, _slots.value);
|
|
31
20
|
};
|
|
32
21
|
}
|
|
33
22
|
});
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
export declare const INPUT_NUMBER: import("vue").DefineComponent<{
|
|
2
2
|
onChange: {};
|
|
3
|
+
prefix: {
|
|
4
|
+
type: StringConstructor;
|
|
5
|
+
};
|
|
6
|
+
suffix: {
|
|
7
|
+
type: StringConstructor;
|
|
8
|
+
};
|
|
3
9
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
4
10
|
onChange: {};
|
|
11
|
+
prefix: {
|
|
12
|
+
type: StringConstructor;
|
|
13
|
+
};
|
|
14
|
+
suffix: {
|
|
15
|
+
type: StringConstructor;
|
|
16
|
+
};
|
|
5
17
|
}>>, {}>;
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import { defineComponent, createVNode } from 'vue';
|
|
2
|
-
import { assignUpdateValue } from '../../utils/index.js';
|
|
2
|
+
import { createInputSlot, assignUpdateValue } from '../../utils/index.js';
|
|
3
3
|
import { connect, mapProps } from '@formily/vue';
|
|
4
4
|
import { NInputNumber } from 'naive-ui';
|
|
5
5
|
|
|
6
6
|
const script = defineComponent({
|
|
7
7
|
props: {
|
|
8
|
-
onChange: {}
|
|
8
|
+
onChange: {},
|
|
9
|
+
prefix: {
|
|
10
|
+
type: String
|
|
11
|
+
},
|
|
12
|
+
suffix: {
|
|
13
|
+
type: String
|
|
14
|
+
}
|
|
9
15
|
},
|
|
10
|
-
setup(
|
|
16
|
+
setup(props) {
|
|
17
|
+
const _slots = createInputSlot(props);
|
|
11
18
|
return () => {
|
|
12
|
-
return createVNode(NInputNumber, null,
|
|
19
|
+
return createVNode(NInputNumber, null, _slots.value);
|
|
13
20
|
};
|
|
14
21
|
}
|
|
15
22
|
});
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { defineComponent, ref, inject, computed,
|
|
1
|
+
import { defineComponent, ref, watch, inject, computed, nextTick, createVNode } from 'vue';
|
|
2
2
|
import { isField } from '@formily/core';
|
|
3
|
-
import { cloneDeep } from 'lodash-es';
|
|
3
|
+
import { isEqual, cloneDeep } from 'lodash-es';
|
|
4
4
|
import { InjectAsyncQueue, InjectionFormItemDepsCollector, InjectionChangeContextCollector } from '../../constants/index.js';
|
|
5
|
-
import { assignUpdateValue,
|
|
6
|
-
import { isObject } from '@vueuse/core';
|
|
5
|
+
import { assignUpdateValue, traverseDependKey } from '../../utils/index.js';
|
|
7
6
|
import { connect, mapProps } from '@formily/vue';
|
|
8
7
|
import { NSelect } from 'naive-ui';
|
|
9
8
|
import { useFormField } from '../../hooks/useFormField.js';
|
|
@@ -32,6 +31,7 @@ const script = defineComponent({
|
|
|
32
31
|
emit
|
|
33
32
|
}) {
|
|
34
33
|
const remoteOptions = ref(null);
|
|
34
|
+
watch(remoteOptions, (o) => console.log("remoteOption", o));
|
|
35
35
|
const lastSearch = ref("");
|
|
36
36
|
const asyncQueue = inject(InjectAsyncQueue);
|
|
37
37
|
const {
|
|
@@ -52,10 +52,6 @@ const script = defineComponent({
|
|
|
52
52
|
if (!config) {
|
|
53
53
|
return remoteOptions.value = null;
|
|
54
54
|
}
|
|
55
|
-
if (!isObject(config)) {
|
|
56
|
-
formRenderLog(`invalid urlConfig (${config}) in SELECT => ${title.value}`, "warn");
|
|
57
|
-
return remoteOptions.value = null;
|
|
58
|
-
}
|
|
59
55
|
try {
|
|
60
56
|
remoteOptions.value = await asyncQueue.addAsync({
|
|
61
57
|
...createParams(config, field.value),
|
|
@@ -65,9 +61,16 @@ const script = defineComponent({
|
|
|
65
61
|
remoteOptions.value = null;
|
|
66
62
|
}
|
|
67
63
|
function createParams(config2, field2) {
|
|
64
|
+
const _params = {};
|
|
65
|
+
traverseDependKey(config2.dependKey, (dependKey, valueKey2) => {
|
|
66
|
+
const _field = field2.query(dependKey).take();
|
|
67
|
+
if (isField(_field)) {
|
|
68
|
+
_params[valueKey2] = _field.value;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
68
71
|
return {
|
|
69
72
|
...config2,
|
|
70
|
-
params: Object.assign({}, config2.params,
|
|
73
|
+
params: Object.assign({}, config2.params, _params)
|
|
71
74
|
};
|
|
72
75
|
}
|
|
73
76
|
}
|
|
@@ -79,13 +82,16 @@ const script = defineComponent({
|
|
|
79
82
|
return filterOption(props.options, lastSearch.value);
|
|
80
83
|
});
|
|
81
84
|
const formItemDepsCollector = inject(InjectionFormItemDepsCollector);
|
|
82
|
-
watch(() => props.urlConfig, (config) => {
|
|
85
|
+
watch(() => props.urlConfig, (config, oldConfig) => {
|
|
86
|
+
if (isEqual(config, oldConfig))
|
|
87
|
+
return;
|
|
83
88
|
remoteOptions.value = null;
|
|
84
89
|
config && formItemDepsCollector.setDeps(fieldKey.value, config.dependKey || [], async () => {
|
|
85
90
|
remoteOptions.value = null;
|
|
86
91
|
await nextTick();
|
|
87
92
|
props.value != null && await fetchData();
|
|
88
93
|
});
|
|
94
|
+
config && fetchData();
|
|
89
95
|
}, {
|
|
90
96
|
immediate: true
|
|
91
97
|
});
|
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
export declare const TEXT:
|
|
2
|
-
|
|
1
|
+
export declare const TEXT: {
|
|
2
|
+
(props: any): JSX.Element;
|
|
3
|
+
props: {
|
|
4
|
+
content: {};
|
|
5
|
+
fieldItem: {};
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
export declare const BUTTON: {
|
|
9
|
+
(props: any): JSX.Element;
|
|
10
|
+
props: {
|
|
11
|
+
onClick: {};
|
|
12
|
+
fieldItem: {};
|
|
13
|
+
content: {};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { createVNode
|
|
1
|
+
import { createVNode } from 'vue';
|
|
2
2
|
import { connect, mapProps } from '@formily/vue';
|
|
3
3
|
import { isFunction } from 'lodash-es';
|
|
4
4
|
import { NButton } from 'naive-ui';
|
|
5
5
|
import { createSlot } from '../../../../../packages/form-render/src/utils';
|
|
6
6
|
|
|
7
|
-
function _isSlot(s) {
|
|
8
|
-
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
9
|
-
}
|
|
10
7
|
function createPropFor(props) {
|
|
11
8
|
return (property) => {
|
|
12
9
|
var _a;
|
|
@@ -14,9 +11,12 @@ function createPropFor(props) {
|
|
|
14
11
|
};
|
|
15
12
|
}
|
|
16
13
|
const textScript = (props) => {
|
|
17
|
-
var _a, _b
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
var _a, _b;
|
|
15
|
+
return createVNode("div", null, [(_b = (_a = createSlot(props.content, props)).default) == null ? void 0 : _b.call(_a)]);
|
|
16
|
+
};
|
|
17
|
+
textScript.props = {
|
|
18
|
+
content: {},
|
|
19
|
+
fieldItem: {}
|
|
20
20
|
};
|
|
21
21
|
const TEXT = connect(textScript, mapProps((props) => {
|
|
22
22
|
var _a;
|
|
@@ -26,19 +26,20 @@ const TEXT = connect(textScript, mapProps((props) => {
|
|
|
26
26
|
};
|
|
27
27
|
}));
|
|
28
28
|
const buttonScript = (props) => {
|
|
29
|
-
var _a;
|
|
30
|
-
let _slot;
|
|
31
29
|
const propFor = createPropFor(props);
|
|
32
30
|
function onClick() {
|
|
33
|
-
var
|
|
34
|
-
const cb = propFor("onClick") || ((
|
|
31
|
+
var _a;
|
|
32
|
+
const cb = propFor("onClick") || ((_a = propFor("componentProps")) == null ? void 0 : _a.onClick);
|
|
35
33
|
return () => isFunction(cb) && cb(props.fieldItem);
|
|
36
34
|
}
|
|
37
|
-
return createVNode(NButton,
|
|
35
|
+
return createVNode(NButton, {
|
|
38
36
|
"onClick": onClick()
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
}, createSlot(props.content, props));
|
|
38
|
+
};
|
|
39
|
+
buttonScript.props = {
|
|
40
|
+
onClick: {},
|
|
41
|
+
fieldItem: {},
|
|
42
|
+
content: {}
|
|
42
43
|
};
|
|
43
44
|
const BUTTON = connect(buttonScript, mapProps((props) => {
|
|
44
45
|
var _a;
|
|
@@ -3,7 +3,7 @@ import { ISchema } from '@formily/json-schema/esm/types';
|
|
|
3
3
|
import { FormItemDepsCollector } from '../../../../../es/packages/form-render';
|
|
4
4
|
export declare function useAnchor(props: Readonly<AnyObject>, collector: FormItemDepsCollector): {
|
|
5
5
|
currentAnchor: import("vue").WritableComputedRef<string>;
|
|
6
|
-
onScroll: () =>
|
|
6
|
+
onScroll: () => void;
|
|
7
7
|
formHeight: import("vue").ComputedRef<any>;
|
|
8
8
|
anchorIdList: import("vue").Ref<{
|
|
9
9
|
name: string;
|
|
@@ -3,7 +3,7 @@ import { useDebounceFn } from '@vueuse/core';
|
|
|
3
3
|
import { isNumber } from 'lodash-es';
|
|
4
4
|
import { ref, computed, watch, nextTick } from 'vue';
|
|
5
5
|
import { FormItemLineBarDepKeyPrepend } from '../../../../packages/form-render/src/constants';
|
|
6
|
-
import {
|
|
6
|
+
import { createLinebarId, traverseSchema } from '../../../../packages/form-render/src/utils';
|
|
7
7
|
|
|
8
8
|
function useAnchor(props, collector) {
|
|
9
9
|
const __currentAnchor = ref("");
|
|
@@ -44,13 +44,13 @@ function useAnchor(props, collector) {
|
|
|
44
44
|
scrollLock = false;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
const onScroll = useDebounceFn(
|
|
47
|
+
const onScroll = useDebounceFn(function() {
|
|
48
48
|
var _a;
|
|
49
49
|
if (scrollLock || !scrollbarRef.value)
|
|
50
50
|
return;
|
|
51
51
|
const { scrollTop, clientHeight } = scrollbarRef.value;
|
|
52
52
|
const result = anchorIdList.value.find((anchor) => {
|
|
53
|
-
const node = scrollbarRef.value.querySelector(`#${anchor.name}`);
|
|
53
|
+
const node = scrollbarRef.value.querySelector(`#${createLinebarId(anchor.name)}`);
|
|
54
54
|
if (!node)
|
|
55
55
|
return;
|
|
56
56
|
return node.offsetTop >= scrollTop || node.offsetTop < scrollTop && node.clientHeight + node.offsetTop > scrollTop + clientHeight;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isObject } from '@vueuse/core';
|
|
2
|
-
import {
|
|
2
|
+
import { pick } from 'lodash-es';
|
|
3
3
|
import { useFormValidator, useTypeNormalize } from '../../../../packages/form-render';
|
|
4
|
-
import {
|
|
4
|
+
import { fieldKeyEscape, arrayed, createLinebarId, transformDateFormat } from '../utils/index.js';
|
|
5
5
|
|
|
6
6
|
function useFieldListAdaptor(collector, uuid) {
|
|
7
7
|
const { createValidatorSchema } = useFormValidator();
|
|
@@ -80,7 +80,7 @@ function useFieldListAdaptor(collector, uuid) {
|
|
|
80
80
|
const schema = createStandardSchema(item);
|
|
81
81
|
Object.assign(schema["x-component-props"], {
|
|
82
82
|
urlConfig: item.urlConfig,
|
|
83
|
-
|
|
83
|
+
depth: (_a = item.wordbook) == null ? void 0 : _a.level_num,
|
|
84
84
|
options: item.option
|
|
85
85
|
});
|
|
86
86
|
return schema;
|
|
@@ -108,7 +108,9 @@ function useFieldListAdaptor(collector, uuid) {
|
|
|
108
108
|
Object.assign(schema["x-component-props"], {
|
|
109
109
|
precision: decimal_length || (validate == null ? void 0 : validate.decimal_length),
|
|
110
110
|
max: validate == null ? void 0 : validate.max_value,
|
|
111
|
-
min: validate == null ? void 0 : validate.min_value
|
|
111
|
+
min: validate == null ? void 0 : validate.min_value,
|
|
112
|
+
prefix: item.prefix,
|
|
113
|
+
suffix: item.suffix
|
|
112
114
|
});
|
|
113
115
|
return schema;
|
|
114
116
|
};
|
|
@@ -174,13 +176,15 @@ function useFieldListAdaptor(collector, uuid) {
|
|
|
174
176
|
return creator(item);
|
|
175
177
|
};
|
|
176
178
|
const createWidgetCombinationSchema = (item) => {
|
|
179
|
+
if (!item.suffixConfig)
|
|
180
|
+
return createWidgetSchema(item);
|
|
177
181
|
const suffixList = arrayed(item.suffixConfig);
|
|
178
182
|
const fieldList = [{ ...item, suffixConfig: void 0 }].concat(suffixList.map((suffix) => {
|
|
179
183
|
return { ...suffix, is_show: item.is_show, alias: " " };
|
|
180
184
|
}));
|
|
181
185
|
return {
|
|
182
186
|
type: "void",
|
|
183
|
-
name: fieldList
|
|
187
|
+
name: fieldKeyEscape(fieldList),
|
|
184
188
|
title: item.alias || item.name,
|
|
185
189
|
"x-component": "INPUT_GROUP",
|
|
186
190
|
"x-component-props": { span: item.elem_width },
|
|
@@ -211,8 +215,8 @@ function useFieldListAdaptor(collector, uuid) {
|
|
|
211
215
|
return schema;
|
|
212
216
|
}
|
|
213
217
|
function createFieldName(fieldItem) {
|
|
214
|
-
if (
|
|
215
|
-
return [fieldItem
|
|
218
|
+
if (fieldItem.suffixConfig) {
|
|
219
|
+
return fieldKeyEscape([fieldItem, ...arrayed(fieldItem.suffixConfig)]);
|
|
216
220
|
}
|
|
217
221
|
return fieldItem.val_key;
|
|
218
222
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Func } from '../../../../../es/src/types';
|
|
1
|
+
import { ArrayAble, Func } from '../../../../../es/src/types';
|
|
2
2
|
export declare class FormItemDepsCollector {
|
|
3
3
|
private readonly collector;
|
|
4
|
-
setDeps(key: string,
|
|
4
|
+
setDeps(key: string, dependKeys: ArrayAble<string> | Record<string, string> | ArrayAble<Record<'paramName' | 'paramValue', string>>, callback: Func): void;
|
|
5
5
|
trigger(dependKey: string, payload?: any): void;
|
|
6
6
|
}
|
|
7
7
|
export declare function useFormItemDeps(): {
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { isFunction } from 'lodash-es';
|
|
2
|
-
import {
|
|
2
|
+
import { traverseDependKey } from '../../../../packages/form-render/src/utils';
|
|
3
3
|
|
|
4
4
|
class FormItemDepsCollector {
|
|
5
5
|
constructor() {
|
|
6
6
|
this.collector = /* @__PURE__ */ new Map();
|
|
7
7
|
}
|
|
8
|
-
setDeps(key,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const map = this.collector.get(dependKey2) || /* @__PURE__ */ new Map();
|
|
8
|
+
setDeps(key, dependKeys, callback) {
|
|
9
|
+
traverseDependKey(dependKeys, (dependKey) => {
|
|
10
|
+
const map = this.collector.get(dependKey) || /* @__PURE__ */ new Map();
|
|
12
11
|
map.set(key, callback);
|
|
13
|
-
this.collector.set(
|
|
12
|
+
this.collector.set(dependKey, map);
|
|
14
13
|
});
|
|
15
14
|
}
|
|
16
15
|
trigger(dependKey, payload) {
|
|
@@ -64,11 +64,12 @@ export declare type FieldItem = {
|
|
|
64
64
|
urlConfig: Partial<{
|
|
65
65
|
url: string;
|
|
66
66
|
method: 'post' | 'get' | 'put' | 'patch' | 'delete';
|
|
67
|
-
dependKey: string | string[]
|
|
67
|
+
dependKey: string | string[] | Record<string, string>;
|
|
68
68
|
params: AnyObject;
|
|
69
69
|
nameKey: string;
|
|
70
70
|
valueKey: string;
|
|
71
71
|
}>;
|
|
72
|
+
suffixConfig: FieldItem[] | FieldItem;
|
|
72
73
|
fieldType: 'string' | 'object' | 'array' | 'number' | 'void' | 'boolean' | 'datetime';
|
|
73
74
|
content: string | FormRenderer | Record<string, FormRenderer>;
|
|
74
75
|
properties: FieldItem[];
|