cnhis-design-vue 3.1.14-beta.1 → 3.1.14-beta.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/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/field-set/index.d.ts +2509 -5166
- package/es/packages/field-set/src/FieldSet.vue.d.ts +2492 -5169
- package/es/packages/field-set/src/FieldSet.vue_vue_type_script_setup_true_lang.js +334 -11
- 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/package.json +153 -153
- package/es/packages/field-set/src/NewFieldSet.js +0 -4
- package/es/packages/field-set/src/NewFieldSet.vue.d.ts +0 -2607
- package/es/packages/field-set/src/NewFieldSet.vue_vue_type_script_setup_true_lang.js +0 -299
- package/es/packages/field-set/src/OldFieldSet.js +0 -4
- package/es/packages/field-set/src/OldFieldSet.vue.d.ts +0 -2610
- package/es/packages/field-set/src/OldFieldSet.vue_vue_type_script_setup_true_lang.js +0 -330
|
@@ -1,20 +1,343 @@
|
|
|
1
|
-
import { defineComponent, openBlock, createElementBlock,
|
|
2
|
-
import '
|
|
3
|
-
import '
|
|
4
|
-
import script$1 from './OldFieldSet.vue_vue_type_script_setup_true_lang.js';
|
|
5
|
-
import script$2 from './NewFieldSet.vue_vue_type_script_setup_true_lang.js';
|
|
1
|
+
import { defineComponent, ref, computed, reactive, onMounted, openBlock, createElementBlock, createVNode, unref, withCtx, createElementVNode, normalizeClass, createCommentVNode, createBlock, normalizeStyle, toDisplayString, withDirectives, vShow, vModelSelect, vModelText, renderSlot, createTextVNode } from 'vue';
|
|
2
|
+
import { NSpin, NCheckbox, NTooltip, NButton } from 'naive-ui';
|
|
3
|
+
import Draggable from 'vuedraggable';
|
|
6
4
|
|
|
5
|
+
const _hoisted_1 = { class: "fields-set-content" };
|
|
6
|
+
const _hoisted_2 = { class: "fields-table" };
|
|
7
|
+
const _hoisted_3 = /* @__PURE__ */ createElementVNode("span", {
|
|
8
|
+
class: "width-show",
|
|
9
|
+
style: { "width": "4%" }
|
|
10
|
+
}, null, -1);
|
|
11
|
+
const _hoisted_4 = /* @__PURE__ */ createElementVNode("span", { class: "width-large" }, "\u6240\u6709\u5B57\u6BB5", -1);
|
|
12
|
+
const _hoisted_5 = { class: "width-show" };
|
|
13
|
+
const _hoisted_6 = /* @__PURE__ */ createTextVNode(" \u663E\u793A ");
|
|
14
|
+
const _hoisted_7 = { class: "width-show" };
|
|
15
|
+
const _hoisted_8 = /* @__PURE__ */ createTextVNode(" \u6392\u5E8F ");
|
|
16
|
+
const _hoisted_9 = /* @__PURE__ */ createElementVNode("span", { class: "width-showed" }, "\u56FA\u5B9A", -1);
|
|
17
|
+
const _hoisted_10 = /* @__PURE__ */ createElementVNode("span", { class: "width-word" }, "\u81EA\u5B9A\u4E49\u6807\u9898", -1);
|
|
18
|
+
const _hoisted_11 = /* @__PURE__ */ createElementVNode("span", { class: "width-showed" }, "\u5217\u5BBD", -1);
|
|
19
|
+
const _hoisted_12 = ["onClick"];
|
|
20
|
+
const _hoisted_13 = { class: "width-show drag-icon-wrap" };
|
|
21
|
+
const _hoisted_14 = /* @__PURE__ */ createElementVNode("span", {
|
|
22
|
+
class: "iconfont icon-a-menzhenyishengzhanxitongtubiaotuozhuai",
|
|
23
|
+
style: { "color": "#000" }
|
|
24
|
+
}, null, -1);
|
|
25
|
+
const _hoisted_15 = /* @__PURE__ */ createElementVNode("span", null, "\u62D6\u62FD\u8C03\u6574\u987A\u5E8F", -1);
|
|
26
|
+
const _hoisted_16 = /* @__PURE__ */ createElementVNode("span", { style: { "width": "14px", "margin-right": "6px" } }, null, -1);
|
|
27
|
+
const _hoisted_17 = { class: "width-show" };
|
|
28
|
+
const _hoisted_18 = { class: "width-show" };
|
|
29
|
+
const _hoisted_19 = { class: "width-showed" };
|
|
30
|
+
const _hoisted_20 = ["onUpdate:modelValue"];
|
|
31
|
+
const _hoisted_21 = /* @__PURE__ */ createElementVNode("option", { value: "NONE" }, "\u4E0D\u56FA\u5B9A", -1);
|
|
32
|
+
const _hoisted_22 = /* @__PURE__ */ createElementVNode("option", { value: "LEFT" }, "\u5DE6\u56FA\u5B9A", -1);
|
|
33
|
+
const _hoisted_23 = /* @__PURE__ */ createElementVNode("option", { value: "RIGHT" }, "\u53F3\u56FA\u5B9A", -1);
|
|
34
|
+
const _hoisted_24 = [
|
|
35
|
+
_hoisted_21,
|
|
36
|
+
_hoisted_22,
|
|
37
|
+
_hoisted_23
|
|
38
|
+
];
|
|
39
|
+
const _hoisted_25 = { class: "width-word" };
|
|
40
|
+
const _hoisted_26 = ["onUpdate:modelValue"];
|
|
41
|
+
const _hoisted_27 = { class: "width-showed" };
|
|
42
|
+
const _hoisted_28 = ["onUpdate:modelValue"];
|
|
43
|
+
const _hoisted_29 = {
|
|
44
|
+
key: 0,
|
|
45
|
+
class: "check-options"
|
|
46
|
+
};
|
|
47
|
+
const _hoisted_30 = { class: "btn-operate" };
|
|
48
|
+
const _hoisted_31 = /* @__PURE__ */ createTextVNode("\u53D6\u6D88");
|
|
49
|
+
const _hoisted_32 = /* @__PURE__ */ createTextVNode("\u4FDD\u5B58");
|
|
7
50
|
var script = /* @__PURE__ */ defineComponent({
|
|
8
51
|
__name: "FieldSet",
|
|
9
52
|
props: {
|
|
10
|
-
|
|
53
|
+
fields: {
|
|
54
|
+
type: Array,
|
|
55
|
+
default: function() {
|
|
56
|
+
return [];
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
menuSource: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: ""
|
|
62
|
+
},
|
|
63
|
+
drawerDirection: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: "right"
|
|
66
|
+
},
|
|
67
|
+
footerFlag: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
default: true
|
|
70
|
+
},
|
|
71
|
+
type: {
|
|
72
|
+
type: String,
|
|
73
|
+
default: "old"
|
|
74
|
+
}
|
|
11
75
|
},
|
|
12
|
-
|
|
76
|
+
emits: ["onSave", "onClose"],
|
|
77
|
+
setup(__props, { expose, emit }) {
|
|
78
|
+
const props = __props;
|
|
79
|
+
const fieldsMapping = {
|
|
80
|
+
sid: "id",
|
|
81
|
+
columnName: "name",
|
|
82
|
+
isShow: "show",
|
|
83
|
+
isSort: "sort",
|
|
84
|
+
isFixed: "fixedShow",
|
|
85
|
+
colWidth: "columnWidth"
|
|
86
|
+
};
|
|
87
|
+
const settingView = ref(null);
|
|
88
|
+
const realityFields = computed(() => {
|
|
89
|
+
const result = props.fields ? JSON.parse(JSON.stringify(props.fields)) : [];
|
|
90
|
+
if (props.type == "old") {
|
|
91
|
+
Object.keys(fieldsMapping).forEach((key) => {
|
|
92
|
+
result.forEach((item) => {
|
|
93
|
+
if (Reflect.has(item, key)) {
|
|
94
|
+
item[fieldsMapping[key]] = item[key];
|
|
95
|
+
Reflect.deleteProperty(item, key);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
return result;
|
|
101
|
+
});
|
|
102
|
+
const state = reactive({
|
|
103
|
+
spinning: false,
|
|
104
|
+
isCustomSearch: true,
|
|
105
|
+
clickItem: {},
|
|
106
|
+
fields: realityFields.value
|
|
107
|
+
});
|
|
108
|
+
const leftStyle = (ele) => {
|
|
109
|
+
return {
|
|
110
|
+
background: state.clickItem.id === ele.id ? "#f2f2f2" : void 0
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
const showCheckBox = (key) => {
|
|
114
|
+
return state.fields.some((i) => Object.prototype.hasOwnProperty.call(i, key));
|
|
115
|
+
};
|
|
116
|
+
const hideTab = () => {
|
|
117
|
+
var _a, _b;
|
|
118
|
+
if (props.drawerDirection === "right") {
|
|
119
|
+
(_a = settingView.value) == null ? void 0 : _a.style.setProperty("margin", "auto");
|
|
120
|
+
} else {
|
|
121
|
+
(_b = settingView.value) == null ? void 0 : _b.style.setProperty("margin", "auto");
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
const getTableFields = () => {
|
|
125
|
+
if (props.type == "old") {
|
|
126
|
+
let tableFields = [];
|
|
127
|
+
if (state.fields.length > 0) {
|
|
128
|
+
state.fields.forEach((item, i) => {
|
|
129
|
+
tableFields.push({
|
|
130
|
+
id: item.id,
|
|
131
|
+
field: item.name,
|
|
132
|
+
visible: item.show,
|
|
133
|
+
sequence: i,
|
|
134
|
+
sortable: item.sort,
|
|
135
|
+
title: item.alias || item.title,
|
|
136
|
+
fixed: item.fixedWay,
|
|
137
|
+
minWidth: item.columnWidth
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
return tableFields;
|
|
142
|
+
} else {
|
|
143
|
+
return state.fields;
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
const handleFieldSave = () => {
|
|
147
|
+
emit("onSave", { tableFields: getTableFields() });
|
|
148
|
+
};
|
|
149
|
+
const onCancle = () => {
|
|
150
|
+
emit("onClose");
|
|
151
|
+
};
|
|
152
|
+
const calculateCheck = (key) => {
|
|
153
|
+
if (!state.fields.length)
|
|
154
|
+
return false;
|
|
155
|
+
return state.fields.every((i) => {
|
|
156
|
+
if (!Object.prototype.hasOwnProperty.call(i, key))
|
|
157
|
+
return true;
|
|
158
|
+
return i[key];
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
const handleAllCheck = (e, key) => {
|
|
162
|
+
const value = e;
|
|
163
|
+
const data = state.fields.map((i) => {
|
|
164
|
+
if (Object.prototype.hasOwnProperty.call(i, key)) {
|
|
165
|
+
i[key] = value;
|
|
166
|
+
}
|
|
167
|
+
return i;
|
|
168
|
+
});
|
|
169
|
+
state.fields = data;
|
|
170
|
+
};
|
|
171
|
+
const handleFieldClick = (item) => {
|
|
172
|
+
state.clickItem = item;
|
|
173
|
+
};
|
|
174
|
+
onMounted(() => {
|
|
175
|
+
hideTab();
|
|
176
|
+
});
|
|
177
|
+
expose({
|
|
178
|
+
getTableFields
|
|
179
|
+
});
|
|
13
180
|
return (_ctx, _cache) => {
|
|
14
|
-
return openBlock(), createElementBlock(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
181
|
+
return openBlock(), createElementBlock("div", {
|
|
182
|
+
ref_key: "settingView",
|
|
183
|
+
ref: settingView,
|
|
184
|
+
class: "c-field-set"
|
|
185
|
+
}, [
|
|
186
|
+
createVNode(unref(NSpin), {
|
|
187
|
+
show: state.spinning,
|
|
188
|
+
tip: "...",
|
|
189
|
+
style: { "width": "100%", "height": "100%" }
|
|
190
|
+
}, {
|
|
191
|
+
default: withCtx(() => [
|
|
192
|
+
createElementVNode("div", _hoisted_1, [
|
|
193
|
+
createElementVNode("div", _hoisted_2, [
|
|
194
|
+
createElementVNode("div", {
|
|
195
|
+
class: normalizeClass(["setting-title", { "seting-title-api": !state.isCustomSearch }])
|
|
196
|
+
}, [
|
|
197
|
+
_hoisted_3,
|
|
198
|
+
createCommentVNode(" \u5B57\u6BB5\u540D\u79F0 "),
|
|
199
|
+
_hoisted_4,
|
|
200
|
+
createCommentVNode(" \u663E\u793A "),
|
|
201
|
+
createElementVNode("span", _hoisted_5, [
|
|
202
|
+
showCheckBox("show") ? (openBlock(), createBlock(unref(NCheckbox), {
|
|
203
|
+
key: 0,
|
|
204
|
+
checked: calculateCheck("show"),
|
|
205
|
+
"onUpdate:checked": _cache[0] || (_cache[0] = ($event) => handleAllCheck($event, "show"))
|
|
206
|
+
}, null, 8, ["checked"])) : createCommentVNode("v-if", true),
|
|
207
|
+
_hoisted_6
|
|
208
|
+
]),
|
|
209
|
+
createCommentVNode(" \u6392\u5E8F "),
|
|
210
|
+
createElementVNode("span", _hoisted_7, [
|
|
211
|
+
showCheckBox("sort") ? (openBlock(), createBlock(unref(NCheckbox), {
|
|
212
|
+
key: 0,
|
|
213
|
+
checked: calculateCheck("sort"),
|
|
214
|
+
"onUpdate:checked": _cache[1] || (_cache[1] = ($event) => handleAllCheck($event, "sort"))
|
|
215
|
+
}, null, 8, ["checked"])) : createCommentVNode("v-if", true),
|
|
216
|
+
_hoisted_8
|
|
217
|
+
]),
|
|
218
|
+
createCommentVNode(" \u56FA\u5B9A "),
|
|
219
|
+
_hoisted_9,
|
|
220
|
+
createCommentVNode(" \u81EA\u5B9A\u4E49\u6807\u9898 "),
|
|
221
|
+
_hoisted_10,
|
|
222
|
+
createCommentVNode(" \u5217\u5BBD "),
|
|
223
|
+
_hoisted_11
|
|
224
|
+
], 2),
|
|
225
|
+
createElementVNode("div", {
|
|
226
|
+
ref: "setShow",
|
|
227
|
+
class: normalizeClass(["set-show", { "set-show-api": !state.isCustomSearch }])
|
|
228
|
+
}, [
|
|
229
|
+
createVNode(unref(Draggable), {
|
|
230
|
+
list: state.fields,
|
|
231
|
+
animation: "150",
|
|
232
|
+
"item-key": "id",
|
|
233
|
+
tag: "ul"
|
|
234
|
+
}, {
|
|
235
|
+
item: withCtx(({ element }) => [
|
|
236
|
+
createElementVNode("li", {
|
|
237
|
+
class: "left-style",
|
|
238
|
+
style: normalizeStyle(leftStyle(element)),
|
|
239
|
+
onClick: ($event) => handleFieldClick(element)
|
|
240
|
+
}, [
|
|
241
|
+
createElementVNode("span", _hoisted_13, [
|
|
242
|
+
createVNode(unref(NTooltip), { trigger: "hover" }, {
|
|
243
|
+
trigger: withCtx(() => [
|
|
244
|
+
_hoisted_14
|
|
245
|
+
]),
|
|
246
|
+
default: withCtx(() => [
|
|
247
|
+
_hoisted_15
|
|
248
|
+
]),
|
|
249
|
+
_: 1
|
|
250
|
+
})
|
|
251
|
+
]),
|
|
252
|
+
createCommentVNode(" \u5B57\u6BB5\u540D\u79F0 "),
|
|
253
|
+
createElementVNode("span", {
|
|
254
|
+
class: normalizeClass(["width-large title-item", { blue: element.extraField }])
|
|
255
|
+
}, [
|
|
256
|
+
_hoisted_16,
|
|
257
|
+
createElementVNode("span", null, toDisplayString(element.title), 1)
|
|
258
|
+
], 2),
|
|
259
|
+
createCommentVNode(" \u663E\u793A "),
|
|
260
|
+
createElementVNode("span", _hoisted_17, [
|
|
261
|
+
withDirectives(createVNode(unref(NCheckbox), {
|
|
262
|
+
checked: element.show,
|
|
263
|
+
"onUpdate:checked": ($event) => element.show = $event
|
|
264
|
+
}, null, 8, ["checked", "onUpdate:checked"]), [
|
|
265
|
+
[vShow, element.id != "0001"]
|
|
266
|
+
])
|
|
267
|
+
]),
|
|
268
|
+
createCommentVNode(" \u6392\u5E8F "),
|
|
269
|
+
createElementVNode("span", _hoisted_18, [
|
|
270
|
+
withDirectives(createVNode(unref(NCheckbox), {
|
|
271
|
+
checked: element.sort,
|
|
272
|
+
"onUpdate:checked": ($event) => element.sort = $event,
|
|
273
|
+
disabled: element.notParticipatingSort == 1
|
|
274
|
+
}, null, 8, ["checked", "onUpdate:checked", "disabled"]), [
|
|
275
|
+
[vShow, element.id != "0001"]
|
|
276
|
+
])
|
|
277
|
+
]),
|
|
278
|
+
createCommentVNode(" \u56FA\u5B9A "),
|
|
279
|
+
createElementVNode("span", _hoisted_19, [
|
|
280
|
+
withDirectives(createElementVNode("select", {
|
|
281
|
+
"onUpdate:modelValue": ($event) => element.fixedWay = $event,
|
|
282
|
+
class: "is-sort-style"
|
|
283
|
+
}, _hoisted_24, 8, _hoisted_20), [
|
|
284
|
+
[vModelSelect, element.fixedWay]
|
|
285
|
+
])
|
|
286
|
+
]),
|
|
287
|
+
createCommentVNode(" \u81EA\u5B9A\u4E49\u6807\u9898 "),
|
|
288
|
+
createElementVNode("span", _hoisted_25, [
|
|
289
|
+
withDirectives(createElementVNode("input", {
|
|
290
|
+
"onUpdate:modelValue": ($event) => element.alias = $event,
|
|
291
|
+
class: "alias-style"
|
|
292
|
+
}, null, 8, _hoisted_26), [
|
|
293
|
+
[vShow, element.id != "0001"],
|
|
294
|
+
[vModelText, element.alias]
|
|
295
|
+
])
|
|
296
|
+
]),
|
|
297
|
+
createCommentVNode(" \u5217\u5BBD "),
|
|
298
|
+
createElementVNode("span", _hoisted_27, [
|
|
299
|
+
withDirectives(createElementVNode("input", {
|
|
300
|
+
"onUpdate:modelValue": ($event) => element.columnWidth = $event,
|
|
301
|
+
class: "alias-style col-width-style"
|
|
302
|
+
}, null, 8, _hoisted_28), [
|
|
303
|
+
[vModelText, element.columnWidth]
|
|
304
|
+
])
|
|
305
|
+
])
|
|
306
|
+
], 12, _hoisted_12)
|
|
307
|
+
]),
|
|
308
|
+
_: 1
|
|
309
|
+
}, 8, ["list"])
|
|
310
|
+
], 2)
|
|
311
|
+
]),
|
|
312
|
+
props.footerFlag ? (openBlock(), createElementBlock("div", _hoisted_29, [
|
|
313
|
+
createElementVNode("div", _hoisted_30, [
|
|
314
|
+
renderSlot(_ctx.$slots, "footer", {}, () => [
|
|
315
|
+
createVNode(unref(NButton), {
|
|
316
|
+
style: { "margin-right": "8px" },
|
|
317
|
+
onClick: onCancle
|
|
318
|
+
}, {
|
|
319
|
+
default: withCtx(() => [
|
|
320
|
+
_hoisted_31
|
|
321
|
+
]),
|
|
322
|
+
_: 1
|
|
323
|
+
}),
|
|
324
|
+
createVNode(unref(NButton), {
|
|
325
|
+
type: "primary",
|
|
326
|
+
onClick: handleFieldSave
|
|
327
|
+
}, {
|
|
328
|
+
default: withCtx(() => [
|
|
329
|
+
_hoisted_32
|
|
330
|
+
]),
|
|
331
|
+
_: 1
|
|
332
|
+
})
|
|
333
|
+
])
|
|
334
|
+
])
|
|
335
|
+
])) : createCommentVNode("v-if", true)
|
|
336
|
+
])
|
|
337
|
+
]),
|
|
338
|
+
_: 3
|
|
339
|
+
}, 8, ["show"])
|
|
340
|
+
], 512);
|
|
18
341
|
};
|
|
19
342
|
}
|
|
20
343
|
});
|
|
@@ -409,7 +409,7 @@ declare const FormRender: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
409
409
|
}[]>;
|
|
410
410
|
formHeight: import("vue").ComputedRef<any>;
|
|
411
411
|
scrollTo: (id: string) => Promise<void>;
|
|
412
|
-
onScroll: () =>
|
|
412
|
+
onScroll: () => void;
|
|
413
413
|
bindInfo: (info: import("../../../es/src/types").AnyObject) => import("../../../es/src/types").AnyObject;
|
|
414
414
|
queryWidget: (key: string, wrapperElement: HTMLElement, fieldList: import("./src/types").FieldItem[]) => Promise<{
|
|
415
415
|
widgetElement: HTMLInputElement | null | undefined;
|
|
@@ -409,7 +409,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
409
409
|
}[]>;
|
|
410
410
|
formHeight: import("vue").ComputedRef<any>;
|
|
411
411
|
scrollTo: (id: string) => Promise<void>;
|
|
412
|
-
onScroll: () =>
|
|
412
|
+
onScroll: () => void;
|
|
413
413
|
bindInfo: (info: AnyObject) => AnyObject;
|
|
414
414
|
queryWidget: (key: string, wrapperElement: HTMLElement, fieldList: FieldItem[]) => Promise<{
|
|
415
415
|
widgetElement: HTMLInputElement | null | undefined;
|
|
@@ -8,7 +8,7 @@ declare type DependKeyObj = {
|
|
|
8
8
|
declare type UrlConfig = {
|
|
9
9
|
method: FormRequestType;
|
|
10
10
|
nameKey: string;
|
|
11
|
-
dependKey: ArrayAble<string> | ArrayAble<DependKeyObj>;
|
|
11
|
+
dependKey: ArrayAble<string> | Record<string, string> | ArrayAble<DependKeyObj>;
|
|
12
12
|
url: string;
|
|
13
13
|
valueKey: string;
|
|
14
14
|
};
|
|
@@ -17,7 +17,7 @@ export declare const SEARCH_CASCADE: import("vue").DefineComponent<{
|
|
|
17
17
|
type: PropType<AnyObject[]>;
|
|
18
18
|
default: () => never[];
|
|
19
19
|
};
|
|
20
|
-
|
|
20
|
+
depth: {
|
|
21
21
|
type: (NumberConstructor | StringConstructor)[];
|
|
22
22
|
required: true;
|
|
23
23
|
};
|
|
@@ -34,7 +34,7 @@ export declare const SEARCH_CASCADE: import("vue").DefineComponent<{
|
|
|
34
34
|
type: PropType<AnyObject[]>;
|
|
35
35
|
default: () => never[];
|
|
36
36
|
};
|
|
37
|
-
|
|
37
|
+
depth: {
|
|
38
38
|
type: (NumberConstructor | StringConstructor)[];
|
|
39
39
|
required: true;
|
|
40
40
|
};
|
|
@@ -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),
|