@elementplus-kit/uikit 1.4.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +1 -0
- package/dist/index.mjs +1079 -0
- package/dist/index.umd.js +1 -0
- package/package.json +14 -4
- package/aaaindex.ts +0 -55
- package/build.log +0 -0
- package/components/button/index.ts +0 -4
- package/components/button/src/constants.ts +0 -50
- package/components/button/src/index.ts +0 -264
- package/components/button/style/index.scss +0 -3
- package/components/config.ts +0 -4
- package/components/dialog/index.ts +0 -6
- package/components/dialog/src/constants.ts +0 -3
- package/components/dialog/src/index.ts +0 -54
- package/components/dialog/style/index.scss +0 -18
- package/components/dictLabel/index.ts +0 -4
- package/components/dictLabel/src/index.vue +0 -21
- package/components/drawer/index.ts +0 -4
- package/components/drawer/src/constants.ts +0 -3
- package/components/drawer/src/index.ts +0 -53
- package/components/drawer/style/index.scss +0 -18
- package/components/form/index.ts +0 -4
- package/components/form/src/FormItem.ts +0 -397
- package/components/form/src/constants.ts +0 -161
- package/components/form/src/index.ts +0 -207
- package/components/form/src/types.ts +0 -39
- package/components/form/src/utils.ts +0 -4
- package/components/form/style/index.scss +0 -5
- package/components/pagination/index.ts +0 -4
- package/components/pagination/src/constants.ts +0 -5
- package/components/pagination/src/index.ts +0 -50
- package/components/search/index.ts +0 -4
- package/components/search/src/index.tsx +0 -276
- package/components/search/style/index.scss +0 -101
- package/components/table/index.ts +0 -4
- package/components/table/src/TableColumn.ts +0 -116
- package/components/table/src/constants.ts +0 -42
- package/components/table/src/index.ts +0 -250
- package/components/table/src/index2.ts +0 -219
- package/components/table/src/index3.ts +0 -233
- package/components/table/src/tableDictLabel.vue +0 -21
- package/components/table/src/tableaa.ts +0 -71
- package/components/table/src/type.ts +0 -0
- package/components/table/type/index.scss +0 -0
- package/components/table2/index.ts +0 -4
- package/components/table2/src/config.ts +0 -5
- package/components/table2/src/index.ts +0 -12
- package/components/table2/src/render.ts +0 -136
- package/components/table2/src/types.ts +0 -39
- package/components/table2/style/index.scss +0 -0
- package/components//346/250/241/346/235/277/index.tsx +0 -57
- package/components//346/250/241/346/235/277/ttt.ts +0 -66
- package/components//346/250/241/346/235/277/ttt.vue +0 -18
- package/index.ts +0 -2
- package/vite.config.ts +0 -26
- package//345/205/266/344/273/226/core/dialog/elementPlus/dialogWarp.vue +0 -151
- package//345/205/266/344/273/226/core/dialog/index.ts +0 -10
- package//345/205/266/344/273/226/core/form/elementPlus/elementWarp.ts +0 -15
- package//345/205/266/344/273/226/core/form/elementPlus/elementWarp.vue +0 -16
- package//345/205/266/344/273/226/core/form/elementPlus/formRender.ts +0 -55
- package//345/205/266/344/273/226/core/form/index.ts +0 -10
- package//345/205/266/344/273/226/core/table/config.ts +0 -5
- package//345/205/266/344/273/226/core/table/render.ts +0 -91
- package//345/205/266/344/273/226/core/table/warp.ts +0 -11
- package//345/205/266/344/273/226/core/utils/fetch.ts +0 -58
- package//345/205/266/344/273/226/useMessage.ts +0 -95
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
defineComponent,
|
|
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
|
-
import TableColumn from "./TableColumn.vue"
|
|
17
|
-
const propsAttrs = {
|
|
18
|
-
module: {
|
|
19
|
-
// 公共参数用于业务判断
|
|
20
|
-
type: Object,
|
|
21
|
-
default: () => {},
|
|
22
|
-
},
|
|
23
|
-
// isRadio: { // 是否为单选框
|
|
24
|
-
// type: Boolean,
|
|
25
|
-
// default: false,
|
|
26
|
-
// },
|
|
27
|
-
// isCheckbox: { // 是否为复选框
|
|
28
|
-
// type: Boolean,
|
|
29
|
-
// default: false,
|
|
30
|
-
// },
|
|
31
|
-
columns: {
|
|
32
|
-
// 列数据
|
|
33
|
-
type: Array,
|
|
34
|
-
default: () => [],
|
|
35
|
-
},
|
|
36
|
-
showSelection: {
|
|
37
|
-
// 是否显示选择列
|
|
38
|
-
type: Boolean,
|
|
39
|
-
default: false,
|
|
40
|
-
},
|
|
41
|
-
showIndex: {
|
|
42
|
-
// 是否显示索引列
|
|
43
|
-
type: Boolean,
|
|
44
|
-
default: false,
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export type PropsAttrs = ExtractPropTypes<typeof propsAttrs>;
|
|
49
|
-
|
|
50
|
-
export default defineComponent({
|
|
51
|
-
props: propsAttrs,
|
|
52
|
-
// emits: eventList,
|
|
53
|
-
|
|
54
|
-
// attrs, emit会继承, slots需要设置
|
|
55
|
-
setup(props: PropsAttrs, { attrs, emit, slots, expose }) {
|
|
56
|
-
provide("tableContext", {
|
|
57
|
-
tableSlots: slots,
|
|
58
|
-
events: (eProp, ...args: any) => {
|
|
59
|
-
emit(eProp, ...args);
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
// 暴露elTable组件上的方法
|
|
63
|
-
const vm = getCurrentInstance(); // 获取虚拟DOM实例
|
|
64
|
-
const cTableFnRef = (el) => {
|
|
65
|
-
if (!el) return;
|
|
66
|
-
vm.exposed = el; // 设置暴露对象
|
|
67
|
-
vm.exposeProxy = el; // 设置代理暴露对象
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
// 暴露方法
|
|
71
|
-
expose({
|
|
72
|
-
// tableRef,
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
// 属性处理
|
|
76
|
-
const getAttrs = () => {
|
|
77
|
-
const obj = {
|
|
78
|
-
...defaultAttrs, // 设置默认值
|
|
79
|
-
};
|
|
80
|
-
return obj;
|
|
81
|
-
};
|
|
82
|
-
// 事件处理
|
|
83
|
-
const getEvents = () => {
|
|
84
|
-
const obj = {
|
|
85
|
-
...defaultAttrs, // 设置默认值
|
|
86
|
-
};
|
|
87
|
-
return obj;
|
|
88
|
-
};
|
|
89
|
-
// 插槽处理
|
|
90
|
-
const getSlots = () => {
|
|
91
|
-
const obj = {};
|
|
92
|
-
tableSlots.map((name) => {
|
|
93
|
-
if (slots[name]) {
|
|
94
|
-
obj[name] = slots[name];
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
return obj;
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
// // 处理列数据-数组
|
|
101
|
-
// const getArrayColumn = () => {
|
|
102
|
-
// console.log("adsadsd");
|
|
103
|
-
// // 递归处理数据
|
|
104
|
-
// const list = [];
|
|
105
|
-
|
|
106
|
-
// const c = (columns, list) => {
|
|
107
|
-
// columns?.map((item) => {
|
|
108
|
-
// const { children, ...p } = item;
|
|
109
|
-
// // 递归处理子列
|
|
110
|
-
// if (isArray(item.children)) {
|
|
111
|
-
// item.children = c(item.children, list);
|
|
112
|
-
// }
|
|
113
|
-
// list.push(p);
|
|
114
|
-
// });
|
|
115
|
-
// };
|
|
116
|
-
// c(props.columns, list);
|
|
117
|
-
// console.log("🚀 ~ gggggggg:", list);
|
|
118
|
-
// return list;
|
|
119
|
-
// };
|
|
120
|
-
|
|
121
|
-
// // 渲染表格列
|
|
122
|
-
// const renderTableColumn = () => {
|
|
123
|
-
// const list = [];
|
|
124
|
-
// // 处理多选与序号列
|
|
125
|
-
// if (props.showSelection) {
|
|
126
|
-
// list.push(
|
|
127
|
-
// h(ElTableColumn, {
|
|
128
|
-
// type: "selection",
|
|
129
|
-
// width: 55,
|
|
130
|
-
// })
|
|
131
|
-
// );
|
|
132
|
-
// }
|
|
133
|
-
// if (props.showIndex) {
|
|
134
|
-
// list.push(
|
|
135
|
-
// h(ElTableColumn, {
|
|
136
|
-
// label: "序号",
|
|
137
|
-
// type: "index",
|
|
138
|
-
// width: 55,
|
|
139
|
-
// })
|
|
140
|
-
// );
|
|
141
|
-
// }
|
|
142
|
-
|
|
143
|
-
// // 列递归渲染
|
|
144
|
-
// const rColumn = (columns, list) => {
|
|
145
|
-
// columns.map((item) => {
|
|
146
|
-
// const { children, ...p } = item;
|
|
147
|
-
|
|
148
|
-
// // 处理多级表头
|
|
149
|
-
// const listSub = [];
|
|
150
|
-
// if (children?.length) {
|
|
151
|
-
// rColumn(children, listSub);
|
|
152
|
-
// }
|
|
153
|
-
|
|
154
|
-
// // 处理插槽
|
|
155
|
-
// const itemSlot = {};
|
|
156
|
-
// // column 自带插槽
|
|
157
|
-
// tablecolumnSlots.map((name) => {
|
|
158
|
-
// const slotName = `${item.prop}.${name}`;
|
|
159
|
-
// if (slots[slotName]) {
|
|
160
|
-
// itemSlot[name] = slots[slotName];
|
|
161
|
-
// }
|
|
162
|
-
// });
|
|
163
|
-
|
|
164
|
-
// // column 列插槽
|
|
165
|
-
// if (slots[item.prop]) {
|
|
166
|
-
// itemSlot["default"] = slots[item.prop];
|
|
167
|
-
// }
|
|
168
|
-
|
|
169
|
-
// // 赋值
|
|
170
|
-
// if (Object.keys(itemSlot).length) {
|
|
171
|
-
// list.push(
|
|
172
|
-
// h(
|
|
173
|
-
// ElTableColumn,
|
|
174
|
-
// { ...p, class: "c-table-column" },
|
|
175
|
-
// listSub.length
|
|
176
|
-
// ? { ...itemSlot, default: () => listSub }
|
|
177
|
-
// : { ...itemSlot }
|
|
178
|
-
// )
|
|
179
|
-
// );
|
|
180
|
-
// } else {
|
|
181
|
-
// list.push(
|
|
182
|
-
// h(
|
|
183
|
-
// ElTableColumn,
|
|
184
|
-
// { ...p, class: "c-table-column" },
|
|
185
|
-
// listSub.length ? { default: () => listSub } : undefined
|
|
186
|
-
// )
|
|
187
|
-
// );
|
|
188
|
-
// }
|
|
189
|
-
// });
|
|
190
|
-
// };
|
|
191
|
-
// rColumn(props.columns, list);
|
|
192
|
-
// return list;
|
|
193
|
-
// };
|
|
194
|
-
|
|
195
|
-
const renderTableColumn = () => {
|
|
196
|
-
const list = []
|
|
197
|
-
const rTableColumn = (columnsList, list) => {
|
|
198
|
-
|
|
199
|
-
}
|
|
200
|
-
columns.map((item) => {
|
|
201
|
-
|
|
202
|
-
const { children, ...p } = item;
|
|
203
|
-
// 递归处理子列
|
|
204
|
-
if (isArray(item.children)) {
|
|
205
|
-
item.children = renderTableColumn(item.children);
|
|
206
|
-
}
|
|
207
|
-
})
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
TableColumn
|
|
211
|
-
// 渲染表格组件
|
|
212
|
-
const renderTable = () => {
|
|
213
|
-
// getColumnList();
|
|
214
|
-
console.log("props", props);
|
|
215
|
-
console.log("attrs", attrs);
|
|
216
|
-
return h(
|
|
217
|
-
ElTable,
|
|
218
|
-
{
|
|
219
|
-
ref: cTableFnRef,
|
|
220
|
-
...attrs,
|
|
221
|
-
class: "c-table",
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
default: () => renderTableColumn(),
|
|
225
|
-
...getSlots(),
|
|
226
|
-
}
|
|
227
|
-
);
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
// 返回渲染函数
|
|
231
|
-
return () => renderTable();
|
|
232
|
-
},
|
|
233
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
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,71 +0,0 @@
|
|
|
1
|
-
// import { ref, h, computed, toRefs, type ExtractPropTypes } from "vue";
|
|
2
|
-
// import { ElTable, ElTableColumn } from "element-plus";
|
|
3
|
-
// import { defaultAttrs } from "./constants.ts";
|
|
4
|
-
|
|
5
|
-
// const propsAttrs = {};
|
|
6
|
-
|
|
7
|
-
// export type PropsAttrs = ExtractPropTypes<typeof propsAttrs>;
|
|
8
|
-
|
|
9
|
-
// export default {
|
|
10
|
-
// // props: propsAttrs,
|
|
11
|
-
// // emits: eventList,
|
|
12
|
-
|
|
13
|
-
// // attrs, emit会继承, slots需要设置
|
|
14
|
-
// setup(props: PropsAttrs, { attrs, emit, slots, expose }) {
|
|
15
|
-
// // const drawerRef = ref();
|
|
16
|
-
|
|
17
|
-
// // 暴露方法
|
|
18
|
-
// // expose({
|
|
19
|
-
// // drawerRef,
|
|
20
|
-
// // });
|
|
21
|
-
|
|
22
|
-
// // 属性处理
|
|
23
|
-
// const getTAttrs = () => {
|
|
24
|
-
// const obj = {
|
|
25
|
-
// ...defaultAttrs, // 设置默认值
|
|
26
|
-
// };
|
|
27
|
-
// return obj;
|
|
28
|
-
// };
|
|
29
|
-
// // 事件处理
|
|
30
|
-
// const getEvents = () => {
|
|
31
|
-
// const obj = {
|
|
32
|
-
// ...defaultAttrs, // 设置默认值
|
|
33
|
-
// };
|
|
34
|
-
// return obj;
|
|
35
|
-
// };
|
|
36
|
-
// // 插槽处理
|
|
37
|
-
// const getSlots = () => {
|
|
38
|
-
// const obj = {
|
|
39
|
-
// ...defaultAttrs, // 设置默认值
|
|
40
|
-
// };
|
|
41
|
-
// return obj;
|
|
42
|
-
// };
|
|
43
|
-
// const renderTableColumn = () => {
|
|
44
|
-
// return h(
|
|
45
|
-
// ElTableColumn,
|
|
46
|
-
// {
|
|
47
|
-
// // ref: drawerRef,
|
|
48
|
-
// ...getAttrs(),
|
|
49
|
-
// class: "c-drawer",
|
|
50
|
-
// },
|
|
51
|
-
// slots
|
|
52
|
-
// );
|
|
53
|
-
// };
|
|
54
|
-
|
|
55
|
-
// // 渲染表格组件
|
|
56
|
-
// const renderTable = () => {
|
|
57
|
-
// return h(
|
|
58
|
-
// ElTable,
|
|
59
|
-
// {
|
|
60
|
-
// // ref: drawerRef,
|
|
61
|
-
// ...getAttrs(),
|
|
62
|
-
// class: "c-drawer",
|
|
63
|
-
// },
|
|
64
|
-
// slots
|
|
65
|
-
// );
|
|
66
|
-
// };
|
|
67
|
-
|
|
68
|
-
// // 返回渲染函数
|
|
69
|
-
// return () => renderTable();
|
|
70
|
-
// },
|
|
71
|
-
// };
|
|
File without changes
|
|
File without changes
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { defineComponent } from "vue";
|
|
2
|
-
import render from "./render.ts";
|
|
3
|
-
|
|
4
|
-
export default defineComponent({
|
|
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);
|
|
10
|
-
};
|
|
11
|
-
},
|
|
12
|
-
});
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { h } from "vue";
|
|
2
|
-
import { ElTable, ElTableColumn } from "element-plus";
|
|
3
|
-
import _ from "lodash-es";
|
|
4
|
-
import { TABLE_CONFIG } from "./config.ts";
|
|
5
|
-
|
|
6
|
-
function render(schema: any, data: any, emit: any, slots: any) {
|
|
7
|
-
const renderSlots = {
|
|
8
|
-
default: () => {
|
|
9
|
-
return buildSlots(schema, slots);
|
|
10
|
-
},
|
|
11
|
-
};
|
|
12
|
-
return h(ElTable, { data, class: "c-table" }, renderSlots);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function buildSlots(schema: any, slots: any) {
|
|
16
|
-
const children: any[] = [];
|
|
17
|
-
// 渲染表格列子组件
|
|
18
|
-
if (_.isObject(schema)) {
|
|
19
|
-
let columnsKeys = Object.keys(schema);
|
|
20
|
-
columnsKeys.forEach((columnKey) => {
|
|
21
|
-
let colSchema = schema[columnKey];
|
|
22
|
-
let colSlots = slots[columnKey];
|
|
23
|
-
// 如果有列表头插槽
|
|
24
|
-
if (slots[`${columnKey}.header`]) {
|
|
25
|
-
let props = buildColumnProps(columnKey, colSchema);
|
|
26
|
-
let headerSlot = {
|
|
27
|
-
header: (scope: any) => {
|
|
28
|
-
// 调用插槽函数才能传参
|
|
29
|
-
return slots[`${columnKey}.header`](scope);
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
if (slots[columnKey]) {
|
|
33
|
-
headerSlot.default = (scope: any) => {
|
|
34
|
-
return [slots[columnKey](scope)];
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
children.push(h(ElTableColumn, props, headerSlot));
|
|
38
|
-
} else {
|
|
39
|
-
children.push(buildColumns(columnKey, colSchema, colSlots, slots));
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// 额外插槽处理
|
|
45
|
-
// 增加插槽式操作栏 判断是否有操作列名称的插槽
|
|
46
|
-
if (slots[TABLE_CONFIG.OPERATION_SLOT_NAME]) {
|
|
47
|
-
// 如果有列表头插槽
|
|
48
|
-
let scopeProp = { label: TABLE_CONFIG.OPERATION_COL_LABEL };
|
|
49
|
-
|
|
50
|
-
if (slots[`${TABLE_CONFIG.OPERATION_SLOT_NAME}.header`]) {
|
|
51
|
-
let headerSlot = {
|
|
52
|
-
header: (scope: any) => {
|
|
53
|
-
// 调用插槽函数才能传参
|
|
54
|
-
return slots[`${TABLE_CONFIG.OPERATION_SLOT_NAME}.header`](scope);
|
|
55
|
-
},
|
|
56
|
-
default: (scope: any) => {
|
|
57
|
-
return [slots[TABLE_CONFIG.OPERATION_SLOT_NAME](scope)];
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
children.push(h(ElTableColumn, scopeProp, headerSlot));
|
|
61
|
-
} else {
|
|
62
|
-
let scopeSlots = {
|
|
63
|
-
default: (scope: any) => {
|
|
64
|
-
return [slots[TABLE_CONFIG.OPERATION_SLOT_NAME](scope)];
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
children.push(h(ElTableColumn, scopeProp, scopeSlots));
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return children;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function buildColumns(
|
|
74
|
-
columnKey: any,
|
|
75
|
-
option: any,
|
|
76
|
-
slots: any,
|
|
77
|
-
globalSlots: any
|
|
78
|
-
) {
|
|
79
|
-
// 组装props
|
|
80
|
-
let props = buildColumnProps(columnKey, option);
|
|
81
|
-
// 过滤出 children 多级表头配置 消除vue警告
|
|
82
|
-
delete props[TABLE_CONFIG.CHILDREN_SLOT_KEY];
|
|
83
|
-
|
|
84
|
-
let renderSlotsArr = [];
|
|
85
|
-
// 多级表头组合
|
|
86
|
-
if (
|
|
87
|
-
option[TABLE_CONFIG.CHILDREN_SLOT_KEY] &&
|
|
88
|
-
_.isObject(option[TABLE_CONFIG.CHILDREN_SLOT_KEY])
|
|
89
|
-
) {
|
|
90
|
-
let scopeOption = option[TABLE_CONFIG.CHILDREN_SLOT_KEY];
|
|
91
|
-
if (_.isObject(scopeOption)) {
|
|
92
|
-
let columnsKeys = Object.keys(scopeOption);
|
|
93
|
-
columnsKeys.forEach((columnKey) => {
|
|
94
|
-
let colSchema = scopeOption[columnKey];
|
|
95
|
-
let colSlots = globalSlots[columnKey];
|
|
96
|
-
renderSlotsArr.push(
|
|
97
|
-
buildColumns(columnKey, colSchema, colSlots, globalSlots)
|
|
98
|
-
);
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
let renderSlots = () => [];
|
|
104
|
-
|
|
105
|
-
if (slots) {
|
|
106
|
-
renderSlots = {
|
|
107
|
-
default: (scope) => {
|
|
108
|
-
return [...renderSlotsArr, slots(scope)];
|
|
109
|
-
},
|
|
110
|
-
};
|
|
111
|
-
} else {
|
|
112
|
-
renderSlots = {
|
|
113
|
-
default: () => {
|
|
114
|
-
return [...renderSlotsArr];
|
|
115
|
-
},
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
return h(ElTableColumn, props, renderSlots);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
function buildColumnProps(key: string, option: any) {
|
|
123
|
-
if (_.isString(option)) {
|
|
124
|
-
return {
|
|
125
|
-
prop: key,
|
|
126
|
-
label: option,
|
|
127
|
-
};
|
|
128
|
-
} else if (_.isObject(option)) {
|
|
129
|
-
return {
|
|
130
|
-
prop: key,
|
|
131
|
-
...option,
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
export default render;
|
|
@@ -1,39 +0,0 @@
|
|
|
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
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ref,
|
|
3
|
-
computed,
|
|
4
|
-
defineComponent,
|
|
5
|
-
} from "vue";
|
|
6
|
-
|
|
7
|
-
// import { CForm, CDrawer } from "@elementplus-kit/uikit";
|
|
8
|
-
// import '../style/index.scss';
|
|
9
|
-
|
|
10
|
-
export default defineComponent({
|
|
11
|
-
props: {
|
|
12
|
-
// modelValue: {
|
|
13
|
-
// type: Object,
|
|
14
|
-
// default: {}
|
|
15
|
-
// },
|
|
16
|
-
// formOptions: {
|
|
17
|
-
// type: Array,
|
|
18
|
-
// default: () => []
|
|
19
|
-
// },
|
|
20
|
-
// isDrawer: {
|
|
21
|
-
// type: Boolean,
|
|
22
|
-
// default: false
|
|
23
|
-
// },
|
|
24
|
-
},
|
|
25
|
-
// emits: ['update:modelValue', 'search', 'reset', 'close'],
|
|
26
|
-
|
|
27
|
-
setup(props, { emit, slots, attrs, expose }) {
|
|
28
|
-
// 自己的 slot
|
|
29
|
-
// const slotsList = ["active", "btn-left", "btn-right"];
|
|
30
|
-
// console.log('slots', slots);
|
|
31
|
-
// console.log('attrs', attrs);
|
|
32
|
-
// 解析 attrs 中的事件
|
|
33
|
-
// const getEvent = () => {
|
|
34
|
-
// let formObj: any = {};
|
|
35
|
-
// Object.keys(attrs)?.forEach((name) => {
|
|
36
|
-
// if (name.indexOf("on") === 0) {
|
|
37
|
-
// formObj[name] = attrs[name];
|
|
38
|
-
// }
|
|
39
|
-
// })
|
|
40
|
-
// return formObj
|
|
41
|
-
// };
|
|
42
|
-
|
|
43
|
-
// 解析插槽
|
|
44
|
-
// const getSlot = () => {
|
|
45
|
-
// let formObj = {};
|
|
46
|
-
// Object.keys(slots).forEach((key) => {
|
|
47
|
-
// if (!slotsList.includes(key)) {
|
|
48
|
-
// formObj[key] = slots[key];
|
|
49
|
-
// }
|
|
50
|
-
// });
|
|
51
|
-
// return formObj
|
|
52
|
-
// };
|
|
53
|
-
return () => (
|
|
54
|
-
<div className="xxxxxxx">xxxxxxx</div>
|
|
55
|
-
)
|
|
56
|
-
},
|
|
57
|
-
})
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ref,
|
|
3
|
-
h,
|
|
4
|
-
computed,
|
|
5
|
-
toRefs,
|
|
6
|
-
getCurrentInstance,
|
|
7
|
-
provide,
|
|
8
|
-
defineComponent,
|
|
9
|
-
type ExtractPropTypes,
|
|
10
|
-
type PropType,
|
|
11
|
-
} from 'vue'
|
|
12
|
-
import { ElConfigProvider, ElForm, ElRow, ElCol } from 'element-plus'
|
|
13
|
-
import zhCn from 'element-plus/es/locale/lang/zh-cn'
|
|
14
|
-
import { get, has, isArray, isBoolean, isFunction, isNumber } from 'lodash-es'
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const propsAttrs = {
|
|
18
|
-
// 表单数据
|
|
19
|
-
model: { type: Object, default: () => ({}) },
|
|
20
|
-
// 表单项
|
|
21
|
-
formOptions: { type: Array, default: () => [] },
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export type PropsAttrs = ExtractPropTypes<typeof propsAttrs>
|
|
25
|
-
|
|
26
|
-
export default defineComponent({
|
|
27
|
-
props: propsAttrs,
|
|
28
|
-
emits: [...getEmits()],
|
|
29
|
-
setup(props: PropsAttrs, { attrs: $attrs, emit, slots, expose }) {
|
|
30
|
-
|
|
31
|
-
// 暴露方法
|
|
32
|
-
expose({
|
|
33
|
-
optionsRef,
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
// 解构props
|
|
37
|
-
const { model, formOptions, readonly, gutter, col } = toRefs(props)
|
|
38
|
-
|
|
39
|
-
// 渲染表单
|
|
40
|
-
const renderForm = () => {
|
|
41
|
-
return h(
|
|
42
|
-
ElConfigProvider,
|
|
43
|
-
{
|
|
44
|
-
locale: zhCn,
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
default: () =>
|
|
48
|
-
h(
|
|
49
|
-
ElForm,
|
|
50
|
-
{
|
|
51
|
-
ref: cFormFnRef,
|
|
52
|
-
...$attrs,
|
|
53
|
-
class: allReadonly.value ? 'isReadonly c-form' : 'c-form', // 放在 $attrs 后面可自动合并 放在 $attrs 前面会被 $attrs.class 覆盖, h函数渲染的是标签就会覆盖 是组件就会合并不用管顺序
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
default: () => renderRow(),
|
|
57
|
-
},
|
|
58
|
-
),
|
|
59
|
-
},
|
|
60
|
-
)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// 返回渲染函数
|
|
64
|
-
return () => renderForm()
|
|
65
|
-
},
|
|
66
|
-
})
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="xxx">
|
|
3
|
-
|
|
4
|
-
</div>
|
|
5
|
-
</template>
|
|
6
|
-
<script setup lang="ts">
|
|
7
|
-
import { ref, computed, useAttrs, useSlots, defineModel } from 'vue'
|
|
8
|
-
import { ArrowUpBold } from '@element-plus/icons-vue'
|
|
9
|
-
const props = defineProps({
|
|
10
|
-
formOptions: {
|
|
11
|
-
type: Array,
|
|
12
|
-
default: () => []
|
|
13
|
-
},
|
|
14
|
-
})
|
|
15
|
-
const emit = defineEmits(['search', 'reset', 'close'])
|
|
16
|
-
|
|
17
|
-
</script>
|
|
18
|
-
<style scoped lang="scss"></style>
|
package/index.ts
DELETED