@elementplus-kit/uikit 1.0.1 → 1.0.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/components/button/index.ts +4 -0
- package/components/button/src/constants.ts +50 -0
- package/components/button/src/index.ts +91 -0
- package/components/dictLabel/index.ts +4 -0
- package/components/dictLabel/src/index.vue +21 -0
- package/components/form/src/index.ts +18 -3
- package/components/form/style/index.scss +5 -0
- package/components/{index.js → index.ts} +6 -0
- package/components/search/index.ts +2 -2
- package/components/search/src/{index.vue → index-/346/272/220.vue} +67 -64
- package/components/search/src/index.tsx +172 -0
- package/components/search/style/index.scss +93 -0
- package/components/{table2 → table}/src/TableColumn.ts +1 -1
- package/components/table/src/index.ts +245 -7
- package/components/table/src/tableDictLabel.vue +21 -0
- package/components/table2/src/index.ts +7 -205
- package/components/{table → table2}/src/types.ts +39 -39
- package/components/table2/style/index.scss +0 -0
- package/components//346/250/241/346/235/277/index.tsx +57 -0
- package/components//346/250/241/346/235/277/ttt.ts +3 -2
- package/components//346/250/241/346/235/277/ttt.vue +18 -0
- package/package.json +2 -2
- /package/components/{table → button}/style/index.scss +0 -0
- /package/components/{table2 → table}/src/constants.ts +0 -0
- /package/components/{table2 → table}/src/index2.ts +0 -0
- /package/components/{table2 → table}/src/index3.ts +0 -0
- /package/components/{table2 → table}/src/tableaa.ts +0 -0
- /package/components/{table2 → table}/src/type.ts +0 -0
- /package/components/{table2 → table}/type/index.scss +0 -0
- /package/components/{table → table2}/src/config.ts +0 -0
- /package/components/{table → table2}/src/render.ts +0 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
.search-btn {
|
|
2
|
+
margin-right: 20px;
|
|
3
|
+
margin-left: auto;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.c-search {
|
|
7
|
+
position: relative;
|
|
8
|
+
height: 50px;
|
|
9
|
+
|
|
10
|
+
.c-search-simple {
|
|
11
|
+
display: flex;
|
|
12
|
+
justify-content: space-between;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.c-search-simple-btn {
|
|
16
|
+
display: flex;
|
|
17
|
+
margin-left: auto;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.c-search-simple-icon {
|
|
21
|
+
display: flex;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
align-items: center;
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
height: 32px;
|
|
26
|
+
width: 32px;
|
|
27
|
+
margin-right: 10px;
|
|
28
|
+
border-radius: 4px;
|
|
29
|
+
background-color: #409eff;
|
|
30
|
+
transition: all 0.2s;
|
|
31
|
+
|
|
32
|
+
&:hover {
|
|
33
|
+
background-color: rgb(121, 187, 255);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&:active {
|
|
37
|
+
background-color: rgb(51, 126, 204);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.c-search-icon {
|
|
42
|
+
// 添加鼠标悬停效果
|
|
43
|
+
color: #fff;
|
|
44
|
+
transition: all 0.2s;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.icon-rotate {
|
|
48
|
+
background-color: rgb(51, 126, 204);
|
|
49
|
+
.c-search-icon {
|
|
50
|
+
transform: rotate(180deg);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.c-search-form {
|
|
55
|
+
width: 100%;
|
|
56
|
+
position: absolute;
|
|
57
|
+
top: 50px;
|
|
58
|
+
left: 0;
|
|
59
|
+
overflow: hidden;
|
|
60
|
+
z-index: 10;
|
|
61
|
+
background-color: #fff;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* 下拉动画效果 */
|
|
66
|
+
.search-form-transition {
|
|
67
|
+
&-enter-active,
|
|
68
|
+
&-leave-active {
|
|
69
|
+
transition: all 0.3s ease;
|
|
70
|
+
/* 动画过渡时间和缓动函数 */
|
|
71
|
+
overflow: hidden;
|
|
72
|
+
max-height: 500px;
|
|
73
|
+
/* 确保足够大的最大高度以容纳内容 */
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&-enter-from {
|
|
77
|
+
max-height: 0;
|
|
78
|
+
/* 入场开始时高度为0 */
|
|
79
|
+
opacity: 0;
|
|
80
|
+
/* 可以添加透明度效果增强视觉体验 */
|
|
81
|
+
padding-top: 0;
|
|
82
|
+
padding-bottom: 0;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&-leave-to {
|
|
86
|
+
max-height: 0;
|
|
87
|
+
/* 出场结束时高度为0 */
|
|
88
|
+
opacity: 0;
|
|
89
|
+
/* 可以添加透明度效果增强视觉体验 */
|
|
90
|
+
padding-top: 0;
|
|
91
|
+
padding-bottom: 0;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -1,12 +1,250 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
defineComponent,
|
|
3
|
+
h,
|
|
4
|
+
getCurrentInstance,
|
|
5
|
+
type ExtractPropTypes,
|
|
6
|
+
} from "vue";
|
|
7
|
+
import { ElTable, ElTableColumn } from "element-plus";
|
|
8
|
+
import TableDictLabel from "./tableDictLabel.vue";
|
|
9
|
+
import {
|
|
10
|
+
defaultAttrs,
|
|
11
|
+
tableSlots,
|
|
12
|
+
tablecolumnSlots,
|
|
13
|
+
selectionColumn,
|
|
14
|
+
indexColumn,
|
|
15
|
+
} from "./constants.ts";
|
|
16
|
+
import { isArray, isObject, isFunction } from "lodash-es";
|
|
17
|
+
const propsAttrs = {
|
|
18
|
+
module: {
|
|
19
|
+
type: Object,
|
|
20
|
+
default: () => {},
|
|
21
|
+
},
|
|
22
|
+
params: {
|
|
23
|
+
// 额外业务全局参数
|
|
24
|
+
type: Object,
|
|
25
|
+
default: () => {},
|
|
26
|
+
},
|
|
27
|
+
// isRadio: { // 是否为单选框
|
|
28
|
+
// type: Boolean,
|
|
29
|
+
// default: false,
|
|
30
|
+
// },
|
|
31
|
+
// isCheckbox: { // 是否为复选框
|
|
32
|
+
// type: Boolean,
|
|
33
|
+
// default: false,
|
|
34
|
+
// },
|
|
35
|
+
columns: {
|
|
36
|
+
// 列数据
|
|
37
|
+
type: Array,
|
|
38
|
+
default: () => [],
|
|
39
|
+
},
|
|
40
|
+
showSelection: {
|
|
41
|
+
// 是否显示选择列
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: false,
|
|
44
|
+
},
|
|
45
|
+
showIndex: {
|
|
46
|
+
// 是否显示索引列
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false,
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export type PropsAttrs = ExtractPropTypes<typeof propsAttrs>;
|
|
3
53
|
|
|
4
54
|
export default defineComponent({
|
|
5
|
-
props:
|
|
6
|
-
emits:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
55
|
+
props: propsAttrs,
|
|
56
|
+
// emits: eventList,
|
|
57
|
+
|
|
58
|
+
// attrs, emit会继承, slots需要设置
|
|
59
|
+
setup(props: PropsAttrs, { attrs, emit, slots, expose }) {
|
|
60
|
+
// 暴露elTable组件上的方法
|
|
61
|
+
const vm = getCurrentInstance(); // 获取虚拟DOM实例
|
|
62
|
+
const cTableFnRef = (el) => {
|
|
63
|
+
if (!el) return;
|
|
64
|
+
vm.exposed = el; // 设置暴露对象
|
|
65
|
+
vm.exposeProxy = el; // 设置代理暴露对象
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// 暴露方法
|
|
69
|
+
// expose({
|
|
70
|
+
// // tableRef,
|
|
71
|
+
// });
|
|
72
|
+
|
|
73
|
+
// // 属性处理
|
|
74
|
+
// const getAttrs = () => {
|
|
75
|
+
// const obj = {
|
|
76
|
+
// ...defaultAttrs, // 设置默认值
|
|
77
|
+
// };
|
|
78
|
+
// return obj;
|
|
79
|
+
// };
|
|
80
|
+
// // 事件处理
|
|
81
|
+
// const getEvents = () => {
|
|
82
|
+
// const obj = {
|
|
83
|
+
// ...defaultAttrs, // 设置默认值
|
|
84
|
+
// };
|
|
85
|
+
// return obj;
|
|
86
|
+
// };
|
|
87
|
+
|
|
88
|
+
// // 处理列数据-数组
|
|
89
|
+
// const getArrayColumn = () => {
|
|
90
|
+
// // 递归处理数据
|
|
91
|
+
// const list = [];
|
|
92
|
+
|
|
93
|
+
// const columnsRecursion = (columns, list) => {
|
|
94
|
+
// columns?.map((item) => {
|
|
95
|
+
// const { children, ...p } = item;
|
|
96
|
+
// // 递归处理子列
|
|
97
|
+
// if (isArray(item.children)) {
|
|
98
|
+
// item.children = c(item.children, list);
|
|
99
|
+
// }
|
|
100
|
+
// list.push(p);
|
|
101
|
+
// });
|
|
102
|
+
// };
|
|
103
|
+
// columnsRecursion(props.columns, list);
|
|
104
|
+
// return list;
|
|
105
|
+
// };
|
|
106
|
+
|
|
107
|
+
// 渲染表格列
|
|
108
|
+
const renderTableColumn = () => {
|
|
109
|
+
const list = [];
|
|
110
|
+
// 处理多选与序号列
|
|
111
|
+
if (props.showSelection) {
|
|
112
|
+
list.push(
|
|
113
|
+
h(ElTableColumn, {
|
|
114
|
+
type: "selection",
|
|
115
|
+
width: 50,
|
|
116
|
+
align: "center",
|
|
117
|
+
})
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
if (props.showIndex) {
|
|
121
|
+
list.push(
|
|
122
|
+
h(ElTableColumn, {
|
|
123
|
+
label: "序号",
|
|
124
|
+
type: "index",
|
|
125
|
+
width: 60,
|
|
126
|
+
align: "center",
|
|
127
|
+
})
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// 列递归渲染
|
|
132
|
+
const rColumn = (columns, list) => {
|
|
133
|
+
columns.map((item) => {
|
|
134
|
+
const { children, ...p } = item;
|
|
135
|
+
// 处理 vIf
|
|
136
|
+
if (
|
|
137
|
+
isFunction(item.vIf) &&
|
|
138
|
+
item.vIf(props.params) !== undefined &&
|
|
139
|
+
item.vIf(props.params)
|
|
140
|
+
) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// 处理多级表头
|
|
145
|
+
const listSub = [];
|
|
146
|
+
if (children?.length) {
|
|
147
|
+
rColumn(children, listSub);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// 处理插槽
|
|
151
|
+
const itemSlot = {};
|
|
152
|
+
// column 自带插槽
|
|
153
|
+
tablecolumnSlots.map((name) => {
|
|
154
|
+
const slotName = `${item.prop}.${name}`;
|
|
155
|
+
if (slots[slotName]) {
|
|
156
|
+
itemSlot[name] = slots[slotName];
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
// column 列插槽
|
|
161
|
+
if (slots[item.prop]) {
|
|
162
|
+
itemSlot["default"] = slots[item.prop];
|
|
163
|
+
} else if (isFunction(item.render)) {
|
|
164
|
+
// column render 渲染函数
|
|
165
|
+
itemSlot["default"] = item.render;
|
|
166
|
+
} else if (isArray(item.options)) {
|
|
167
|
+
// column 字典数组
|
|
168
|
+
itemSlot["default"] = (scope: any) =>
|
|
169
|
+
h(TableDictLabel, {
|
|
170
|
+
options: item.options,
|
|
171
|
+
value: scope.row[item.prop],
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// 赋值 有插槽
|
|
176
|
+
if (Object.keys(itemSlot).length) {
|
|
177
|
+
const getColumnContent = () => {
|
|
178
|
+
let content = undefined;
|
|
179
|
+
if (listSub.length) {
|
|
180
|
+
content = { ...itemSlot, default: () => listSub };
|
|
181
|
+
} else {
|
|
182
|
+
content = { ...itemSlot };
|
|
183
|
+
}
|
|
184
|
+
return content;
|
|
185
|
+
};
|
|
186
|
+
list.push(
|
|
187
|
+
h(
|
|
188
|
+
ElTableColumn,
|
|
189
|
+
{ ...p, class: "c-table-column" },
|
|
190
|
+
getColumnContent()
|
|
191
|
+
)
|
|
192
|
+
);
|
|
193
|
+
} else {
|
|
194
|
+
const getColumnContent = () => {
|
|
195
|
+
let content = undefined;
|
|
196
|
+
if (listSub.length) {
|
|
197
|
+
content = { default: () => listSub };
|
|
198
|
+
}
|
|
199
|
+
return content;
|
|
200
|
+
};
|
|
201
|
+
// 无插槽
|
|
202
|
+
list.push(
|
|
203
|
+
h(
|
|
204
|
+
ElTableColumn,
|
|
205
|
+
{ ...p, class: "c-table-column" },
|
|
206
|
+
getColumnContent()
|
|
207
|
+
)
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
};
|
|
212
|
+
rColumn(props.columns, list);
|
|
213
|
+
return list;
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
// 插槽处理
|
|
217
|
+
const getSlots = () => {
|
|
218
|
+
const obj = {};
|
|
219
|
+
tableSlots.map((name) => {
|
|
220
|
+
if (slots[name]) {
|
|
221
|
+
obj[name] = slots[name];
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
return obj;
|
|
10
225
|
};
|
|
226
|
+
// 渲染表格组件
|
|
227
|
+
const renderTable = () => {
|
|
228
|
+
// getColumnList();
|
|
229
|
+
// console.log("props", props);
|
|
230
|
+
// console.log("attrs", attrs);
|
|
231
|
+
// 先拼接好子数据不然会重复执行多次
|
|
232
|
+
const columnList = renderTableColumn();
|
|
233
|
+
return h(
|
|
234
|
+
ElTable,
|
|
235
|
+
{
|
|
236
|
+
ref: cTableFnRef,
|
|
237
|
+
...attrs,
|
|
238
|
+
class: "c-table",
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
default: () => columnList,
|
|
242
|
+
...getSlots(),
|
|
243
|
+
}
|
|
244
|
+
);
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
// 返回渲染函数
|
|
248
|
+
return () => renderTable();
|
|
11
249
|
},
|
|
12
250
|
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
{{ label }}
|
|
3
|
+
</template>
|
|
4
|
+
<script setup lang="ts">
|
|
5
|
+
import { computed, PropType } from 'vue'
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
options: {
|
|
8
|
+
type: Array,
|
|
9
|
+
default: () => []
|
|
10
|
+
},
|
|
11
|
+
value: {
|
|
12
|
+
type: String as PropType<any>,
|
|
13
|
+
default: ''
|
|
14
|
+
},
|
|
15
|
+
})
|
|
16
|
+
const label = computed(() => {
|
|
17
|
+
// 处理value为数字的情况 后端字典都是字符串
|
|
18
|
+
const item = props.options?.find((item) => item.value == props.value.toString());
|
|
19
|
+
return item?.label || props.value;
|
|
20
|
+
});
|
|
21
|
+
</script>
|
|
@@ -1,210 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
h,
|
|
4
|
-
getCurrentInstance,
|
|
5
|
-
type ExtractPropTypes,
|
|
6
|
-
} from "vue";
|
|
7
|
-
import { ElTable, ElTableColumn } from "element-plus";
|
|
8
|
-
import {
|
|
9
|
-
defaultAttrs,
|
|
10
|
-
tableSlots,
|
|
11
|
-
tablecolumnSlots,
|
|
12
|
-
selectionColumn,
|
|
13
|
-
indexColumn,
|
|
14
|
-
} from "./constants.ts";
|
|
15
|
-
import { isArray, isObject } from "lodash-es";
|
|
16
|
-
const propsAttrs = {
|
|
17
|
-
module: {
|
|
18
|
-
// 公共参数用于业务判断
|
|
19
|
-
type: Object,
|
|
20
|
-
default: () => {},
|
|
21
|
-
},
|
|
22
|
-
// isRadio: { // 是否为单选框
|
|
23
|
-
// type: Boolean,
|
|
24
|
-
// default: false,
|
|
25
|
-
// },
|
|
26
|
-
// isCheckbox: { // 是否为复选框
|
|
27
|
-
// type: Boolean,
|
|
28
|
-
// default: false,
|
|
29
|
-
// },
|
|
30
|
-
columns: {
|
|
31
|
-
// 列数据
|
|
32
|
-
type: Array,
|
|
33
|
-
default: () => [],
|
|
34
|
-
},
|
|
35
|
-
showSelection: {
|
|
36
|
-
// 是否显示选择列
|
|
37
|
-
type: Boolean,
|
|
38
|
-
default: false,
|
|
39
|
-
},
|
|
40
|
-
showIndex: {
|
|
41
|
-
// 是否显示索引列
|
|
42
|
-
type: Boolean,
|
|
43
|
-
default: false,
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export type PropsAttrs = ExtractPropTypes<typeof propsAttrs>;
|
|
1
|
+
import { defineComponent } from "vue";
|
|
2
|
+
import render from "./render.ts";
|
|
48
3
|
|
|
49
4
|
export default defineComponent({
|
|
50
|
-
props:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
// 暴露elTable组件上的方法
|
|
56
|
-
const vm = getCurrentInstance(); // 获取虚拟DOM实例
|
|
57
|
-
const cTableFnRef = (el) => {
|
|
58
|
-
if (!el) return;
|
|
59
|
-
vm.exposed = el; // 设置暴露对象
|
|
60
|
-
vm.exposeProxy = el; // 设置代理暴露对象
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
// 暴露方法
|
|
64
|
-
expose({
|
|
65
|
-
// tableRef,
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
// 属性处理
|
|
69
|
-
const getAttrs = () => {
|
|
70
|
-
const obj = {
|
|
71
|
-
...defaultAttrs, // 设置默认值
|
|
72
|
-
};
|
|
73
|
-
return obj;
|
|
74
|
-
};
|
|
75
|
-
// 事件处理
|
|
76
|
-
const getEvents = () => {
|
|
77
|
-
const obj = {
|
|
78
|
-
...defaultAttrs, // 设置默认值
|
|
79
|
-
};
|
|
80
|
-
return obj;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
// 处理列数据-数组
|
|
84
|
-
const getArrayColumn = () => {
|
|
85
|
-
console.log("adsadsd");
|
|
86
|
-
// 递归处理数据
|
|
87
|
-
const list = [];
|
|
88
|
-
|
|
89
|
-
const c = (columns, list) => {
|
|
90
|
-
columns?.map((item) => {
|
|
91
|
-
const { children, ...p } = item;
|
|
92
|
-
// 递归处理子列
|
|
93
|
-
if (isArray(item.children)) {
|
|
94
|
-
item.children = c(item.children, list);
|
|
95
|
-
}
|
|
96
|
-
list.push(p);
|
|
97
|
-
});
|
|
98
|
-
};
|
|
99
|
-
c(props.columns, list);
|
|
100
|
-
console.log("🚀 ~ gggggggg:", list);
|
|
101
|
-
return list;
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
// 渲染表格列
|
|
105
|
-
const renderTableColumn = () => {
|
|
106
|
-
const list = [];
|
|
107
|
-
// 处理多选与序号列
|
|
108
|
-
if (props.showSelection) {
|
|
109
|
-
list.push(
|
|
110
|
-
h(ElTableColumn, {
|
|
111
|
-
type: "selection",
|
|
112
|
-
width: 55,
|
|
113
|
-
})
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
if (props.showIndex) {
|
|
117
|
-
list.push(
|
|
118
|
-
h(ElTableColumn, {
|
|
119
|
-
label: "序号",
|
|
120
|
-
type: "index",
|
|
121
|
-
width: 55,
|
|
122
|
-
})
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// 列递归渲染
|
|
127
|
-
const rColumn = (columns, list) => {
|
|
128
|
-
columns.map((item) => {
|
|
129
|
-
const { children, ...p } = item;
|
|
130
|
-
|
|
131
|
-
// 处理多级表头
|
|
132
|
-
const listSub = [];
|
|
133
|
-
if (children?.length) {
|
|
134
|
-
rColumn(children, listSub);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// 处理插槽
|
|
138
|
-
const itemSlot = {};
|
|
139
|
-
// column 自带插槽
|
|
140
|
-
tablecolumnSlots.map((name) => {
|
|
141
|
-
const slotName = `${item.prop}.${name}`;
|
|
142
|
-
if (slots[slotName]) {
|
|
143
|
-
itemSlot[name] = slots[slotName];
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
// column 列插槽
|
|
148
|
-
if (slots[item.prop]) {
|
|
149
|
-
itemSlot["default"] = slots[item.prop];
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// 赋值
|
|
153
|
-
if (Object.keys(itemSlot).length) {
|
|
154
|
-
list.push(
|
|
155
|
-
h(
|
|
156
|
-
ElTableColumn,
|
|
157
|
-
{ ...p, class: "c-table-column" },
|
|
158
|
-
listSub.length
|
|
159
|
-
? { ...itemSlot, default: () => listSub }
|
|
160
|
-
: { ...itemSlot }
|
|
161
|
-
)
|
|
162
|
-
);
|
|
163
|
-
} else {
|
|
164
|
-
list.push(
|
|
165
|
-
h(
|
|
166
|
-
ElTableColumn,
|
|
167
|
-
{ ...p, class: "c-table-column" },
|
|
168
|
-
listSub.length ? { default: () => listSub } : undefined
|
|
169
|
-
)
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
};
|
|
174
|
-
rColumn(props.columns, list);
|
|
175
|
-
return list;
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
// 插槽处理
|
|
179
|
-
const getSlots = () => {
|
|
180
|
-
const obj = {};
|
|
181
|
-
tableSlots.map((name) => {
|
|
182
|
-
if (slots[name]) {
|
|
183
|
-
obj[name] = slots[name];
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
return obj;
|
|
187
|
-
};
|
|
188
|
-
// 渲染表格组件
|
|
189
|
-
const renderTable = () => {
|
|
190
|
-
// getColumnList();
|
|
191
|
-
console.log("props", props);
|
|
192
|
-
console.log("attrs", attrs);
|
|
193
|
-
return h(
|
|
194
|
-
ElTable,
|
|
195
|
-
{
|
|
196
|
-
ref: cTableFnRef,
|
|
197
|
-
...attrs,
|
|
198
|
-
class: "c-table",
|
|
199
|
-
},
|
|
200
|
-
{
|
|
201
|
-
default: () => renderTableColumn(),
|
|
202
|
-
...getSlots(),
|
|
203
|
-
}
|
|
204
|
-
);
|
|
5
|
+
props: ["schema", "data"],
|
|
6
|
+
emits: [],
|
|
7
|
+
setup(props: any, { attrs, emit, slots, expose }) {
|
|
8
|
+
return () => {
|
|
9
|
+
return render(props.schema, props.data, emit, slots);
|
|
205
10
|
};
|
|
206
|
-
|
|
207
|
-
// 返回渲染函数
|
|
208
|
-
return () => renderTable();
|
|
209
11
|
},
|
|
210
12
|
});
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
export interface FormItemListItem {
|
|
2
|
-
type: string
|
|
3
|
-
label?: string
|
|
4
|
-
prop: string
|
|
5
|
-
required?: Boolean
|
|
6
|
-
vIf?: boolean | ((item: FormItemListItem) => boolean)
|
|
7
|
-
dictType?: string
|
|
8
|
-
options?: Array<Object>
|
|
9
|
-
col?: Number
|
|
10
|
-
formItem?: Object
|
|
11
|
-
attrs?: Object
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface FormItemList {
|
|
15
|
-
module: Object
|
|
16
|
-
formOpsions: FormItemListItem[]
|
|
17
|
-
readonly: boolean
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export type formType =
|
|
21
|
-
| 'input'
|
|
22
|
-
| 'textarea'
|
|
23
|
-
| 'input-number'
|
|
24
|
-
| 'select'
|
|
25
|
-
| 'select-v2'
|
|
26
|
-
| 'cascader'
|
|
27
|
-
| 'tree-select'
|
|
28
|
-
| 'radio'
|
|
29
|
-
| 'checkbox'
|
|
30
|
-
| 'time-select'
|
|
31
|
-
| 'date-picker'
|
|
32
|
-
| 'time-picker'
|
|
33
|
-
| 'rate'
|
|
34
|
-
| 'color-picker'
|
|
35
|
-
| 'slider'
|
|
36
|
-
| 'switch'
|
|
37
|
-
| 'text'
|
|
38
|
-
| 'html'
|
|
39
|
-
| 'slot'
|
|
1
|
+
export interface FormItemListItem {
|
|
2
|
+
type: string
|
|
3
|
+
label?: string
|
|
4
|
+
prop: string
|
|
5
|
+
required?: Boolean
|
|
6
|
+
vIf?: boolean | ((item: FormItemListItem) => boolean)
|
|
7
|
+
dictType?: string
|
|
8
|
+
options?: Array<Object>
|
|
9
|
+
col?: Number
|
|
10
|
+
formItem?: Object
|
|
11
|
+
attrs?: Object
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface FormItemList {
|
|
15
|
+
module: Object
|
|
16
|
+
formOpsions: FormItemListItem[]
|
|
17
|
+
readonly: boolean
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type formType =
|
|
21
|
+
| 'input'
|
|
22
|
+
| 'textarea'
|
|
23
|
+
| 'input-number'
|
|
24
|
+
| 'select'
|
|
25
|
+
| 'select-v2'
|
|
26
|
+
| 'cascader'
|
|
27
|
+
| 'tree-select'
|
|
28
|
+
| 'radio'
|
|
29
|
+
| 'checkbox'
|
|
30
|
+
| 'time-select'
|
|
31
|
+
| 'date-picker'
|
|
32
|
+
| 'time-picker'
|
|
33
|
+
| 'rate'
|
|
34
|
+
| 'color-picker'
|
|
35
|
+
| 'slider'
|
|
36
|
+
| 'switch'
|
|
37
|
+
| 'text'
|
|
38
|
+
| 'html'
|
|
39
|
+
| 'slot'
|
|
File without changes
|