1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
| import { h } from 'vue';
| import { JVxeDataProps, JVxeTableMethods, JVxeTableProps } from '../types';
| import JVxeSubPopover from '../components/JVxeSubPopover.vue';
| import JVxeDetailsModal from '../components/JVxeDetailsModal.vue';
| import { useToolbar } from '/@/components/jeecg/JVxeTable/src/hooks/useToolbar';
| import { usePagination } from '/@/components/jeecg/JVxeTable/src/hooks/usePagination';
|
| export function useRenderComponents(props: JVxeTableProps, data: JVxeDataProps, methods: JVxeTableMethods, slots) {
| // 渲染 toolbar
| const { renderToolbar } = useToolbar(props, data, methods, slots);
| // 渲染分页器
| const { renderPagination } = usePagination(props, methods);
|
| // 渲染 toolbarAfter 插槽
| function renderToolbarAfterSlot() {
| if (slots['toolbarAfter']) {
| return slots['toolbarAfter']();
| }
| return null;
| }
|
| // 渲染点击时弹出的子表
| function renderSubPopover() {
| if (props.clickRowShowSubForm && slots.subForm) {
| return h(
| JVxeSubPopover,
| {
| ref: 'subPopoverRef',
| },
| {
| subForm: slots.subForm,
| }
| );
| }
| return null;
| }
|
| // 渲染点击时弹出的详细信息
| function renderDetailsModal() {
| if (props.clickRowShowMainForm && slots.mainForm) {
| return h(
| JVxeDetailsModal,
| {
| ref: 'detailsModalRef',
| trigger: methods.trigger,
| },
| {
| mainForm: slots.mainForm,
| }
| );
| }
| }
|
| return {
| renderToolbar,
| renderPagination,
| renderSubPopover,
| renderDetailsModal,
| renderToolbarAfterSlot,
| };
| }
|
|