yc-pro-components 0.0.42 → 0.0.44
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/es/component.mjs +2 -0
- package/es/components/check-card/index.d.ts +61 -61
- package/es/components/check-card/src/index.vue.d.ts +4 -4
- package/es/components/check-card-group/index.d.ts +43 -43
- package/es/components/check-card-group/src/index.vue.d.ts +3 -3
- package/es/components/date-picker/index.d.ts +20 -20
- package/es/components/date-picker/src/index.vue.d.ts +12 -12
- package/es/components/dialog/index.d.ts +26 -26
- package/es/components/dialog/src/index.vue.d.ts +2 -2
- package/es/components/dialog-form/index.d.ts +31 -31
- package/es/components/dialog-form/src/index.vue.d.ts +9 -9
- package/es/components/display-item/index.d.ts +41 -41
- package/es/components/display-item/src/index.vue.d.ts +22 -22
- package/es/components/drawer-form/index.d.ts +65 -65
- package/es/components/drawer-form/src/index.vue.d.ts +15 -15
- package/es/components/form/index.d.ts +45 -45
- package/es/components/form/src/form-content.vue.d.ts +20 -20
- package/es/components/form/src/index.vue.d.ts +17 -17
- package/es/components/form-item/index.d.ts +48 -48
- package/es/components/form-item/src/index.vue.d.ts +14 -14
- package/es/components/header/index.d.ts +19 -19
- package/es/components/header/src/index.vue.d.ts +1 -1
- package/es/components/index.d.ts +1 -0
- package/es/components/index.mjs +4 -0
- package/es/components/input-tag/index.d.ts +15 -15
- package/es/components/input-tag/src/index.vue.d.ts +3 -3
- package/es/components/layout/index.d.ts +50 -50
- package/es/components/layout/src/index.vue.d.ts +11 -11
- package/es/components/page/index.d.ts +4166 -2538
- package/es/components/page/src/index.vue.d.ts +712 -137
- package/es/components/page/src/index.vue2.mjs +120 -31
- package/es/components/pagination/index.d.ts +42 -42
- package/es/components/pagination/src/index.vue.d.ts +3 -3
- package/es/components/radio/index.d.ts +35 -35
- package/es/components/radio/src/index.vue.d.ts +27 -27
- package/es/components/render/index.d.ts +3 -3
- package/es/components/render/src/index.vue.d.ts +1 -1
- package/es/components/search/index.d.ts +154 -154
- package/es/components/search/src/index.vue.d.ts +50 -50
- package/es/components/sidebar/index.d.ts +15 -15
- package/es/components/sidebar/src/index.vue.d.ts +5 -5
- package/es/components/steps-form/index.d.ts +23 -23
- package/es/components/steps-form/src/index.vue.d.ts +2 -2
- package/es/components/table/src/table-column.vue.d.ts +37 -37
- package/es/components/utils/index.d.ts +2 -2
- package/es/components/virtual-table/index.d.ts +646 -0
- package/es/components/virtual-table/index.mjs +8 -0
- package/es/components/virtual-table/src/index.vue.d.ts +139 -0
- package/es/components/virtual-table/src/index.vue.mjs +6 -0
- package/es/components/virtual-table/src/index.vue2.mjs +327 -0
- package/es/components/virtual-table/src/type.d.ts +295 -0
- package/es/components/virtual-table/src/type.mjs +1 -0
- package/es/components/virtual-table/src/use-column-adapter.d.ts +40 -0
- package/es/components/virtual-table/src/use-column-adapter.mjs +137 -0
- package/es/components/virtual-table/src/use-virtual-scroll.d.ts +35 -0
- package/es/components/virtual-table/src/use-virtual-scroll.mjs +71 -0
- package/es/components/virtual-table/src/use-virtual-selection.d.ts +40 -0
- package/es/components/virtual-table/src/use-virtual-selection.mjs +112 -0
- package/es/components/virtual-table/src/virtual-table-action-bar.d.ts +11 -0
- package/es/components/virtual-table/src/virtual-table-action-bar.mjs +121 -0
- package/es/components/virtual-table/src/virtual-table-cell-renderer.d.ts +16 -0
- package/es/components/virtual-table/src/virtual-table-cell-renderer.mjs +170 -0
- package/es/components/virtual-table/src/virtual-table-header-renderer.d.ts +10 -0
- package/es/components/virtual-table/src/virtual-table-header-renderer.mjs +51 -0
- package/es/components/virtual-table/style/css.d.ts +3 -0
- package/es/components/virtual-table/style/css.mjs +1 -0
- package/es/components/virtual-table/style/index.d.ts +12 -0
- package/es/components/virtual-table/style/index.mjs +1 -0
- package/es/components/yc-dialog/index.d.ts +24 -24
- package/es/components/yc-download-dialog/index.d.ts +19 -19
- package/es/components/yc-download-dialog/src/index.vue.d.ts +1 -1
- package/es/components/yc-form-container-header/index.d.ts +12 -12
- package/es/components/yc-more-actions/index.d.ts +46 -46
- package/es/components/yc-more-actions/src/index.vue.d.ts +3 -3
- package/es/components/yc-plus-page/src/index.vue.d.ts +2445 -1430
- package/es/components/yc-plus-page/src/index.vue.mjs +1 -1
- package/es/components/yc-plus-page/src/type.d.ts +8 -2
- package/es/components/yc-segmented/index.d.ts +2 -2
- package/es/components/yc-segmented/src/index.d.ts +2 -2
- package/es/components/yc-select-v2/src/index.vue.d.ts +3 -3
- package/es/components/yc-status-dialog/src/index.vue.d.ts +1 -1
- package/es/components/yc-tabs-with-filter/index.d.ts +16 -16
- package/es/components/yc-text/src/index.vue.d.ts +2 -2
- package/es/hooks/usePlusFormReset.d.ts +238 -238
- package/es/index.css +20 -1
- package/es/index.d.ts +1 -0
- package/es/index.mjs +4 -0
- package/es/yc-components/index.d.ts +1 -0
- package/index.css +111 -6
- package/index.js +1141 -149
- package/index.min.css +2 -1
- package/index.min.js +13 -10
- package/index.min.mjs +13 -10
- package/index.mjs +1139 -151
- package/lib/component.js +42 -40
- package/lib/components/check-card/index.d.ts +61 -61
- package/lib/components/check-card/src/index.vue.d.ts +4 -4
- package/lib/components/check-card-group/index.d.ts +43 -43
- package/lib/components/check-card-group/src/index.vue.d.ts +3 -3
- package/lib/components/date-picker/index.d.ts +20 -20
- package/lib/components/date-picker/src/index.vue.d.ts +12 -12
- package/lib/components/dialog/index.d.ts +26 -26
- package/lib/components/dialog/src/index.vue.d.ts +2 -2
- package/lib/components/dialog-form/index.d.ts +31 -31
- package/lib/components/dialog-form/src/index.vue.d.ts +9 -9
- package/lib/components/display-item/index.d.ts +41 -41
- package/lib/components/display-item/src/index.vue.d.ts +22 -22
- package/lib/components/drawer-form/index.d.ts +65 -65
- package/lib/components/drawer-form/src/index.vue.d.ts +15 -15
- package/lib/components/form/index.d.ts +45 -45
- package/lib/components/form/src/form-content.vue.d.ts +20 -20
- package/lib/components/form/src/index.vue.d.ts +17 -17
- package/lib/components/form-item/index.d.ts +48 -48
- package/lib/components/form-item/src/index.vue.d.ts +14 -14
- package/lib/components/header/index.d.ts +19 -19
- package/lib/components/header/src/index.vue.d.ts +1 -1
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +98 -90
- package/lib/components/input-tag/index.d.ts +15 -15
- package/lib/components/input-tag/src/index.vue.d.ts +3 -3
- package/lib/components/layout/index.d.ts +50 -50
- package/lib/components/layout/src/index.vue.d.ts +11 -11
- package/lib/components/page/index.d.ts +4166 -2538
- package/lib/components/page/src/index.vue.d.ts +712 -137
- package/lib/components/page/src/index.vue2.js +125 -36
- package/lib/components/pagination/index.d.ts +42 -42
- package/lib/components/pagination/src/index.vue.d.ts +3 -3
- package/lib/components/radio/index.d.ts +35 -35
- package/lib/components/radio/src/index.vue.d.ts +27 -27
- package/lib/components/render/index.d.ts +3 -3
- package/lib/components/render/src/index.vue.d.ts +1 -1
- package/lib/components/search/index.d.ts +154 -154
- package/lib/components/search/src/index.vue.d.ts +50 -50
- package/lib/components/sidebar/index.d.ts +15 -15
- package/lib/components/sidebar/src/index.vue.d.ts +5 -5
- package/lib/components/steps-form/index.d.ts +23 -23
- package/lib/components/steps-form/src/index.vue.d.ts +2 -2
- package/lib/components/table/src/table-column.vue.d.ts +37 -37
- package/lib/components/utils/index.d.ts +2 -2
- package/lib/components/virtual-table/index.d.ts +646 -0
- package/lib/components/virtual-table/index.js +13 -0
- package/lib/components/virtual-table/src/index.vue.d.ts +139 -0
- package/lib/components/virtual-table/src/index.vue.js +10 -0
- package/lib/components/virtual-table/src/index.vue2.js +331 -0
- package/lib/components/virtual-table/src/type.d.ts +295 -0
- package/lib/components/virtual-table/src/type.js +2 -0
- package/lib/components/virtual-table/src/use-column-adapter.d.ts +40 -0
- package/lib/components/virtual-table/src/use-column-adapter.js +139 -0
- package/lib/components/virtual-table/src/use-virtual-scroll.d.ts +35 -0
- package/lib/components/virtual-table/src/use-virtual-scroll.js +73 -0
- package/lib/components/virtual-table/src/use-virtual-selection.d.ts +40 -0
- package/lib/components/virtual-table/src/use-virtual-selection.js +114 -0
- package/lib/components/virtual-table/src/virtual-table-action-bar.d.ts +11 -0
- package/lib/components/virtual-table/src/virtual-table-action-bar.js +123 -0
- package/lib/components/virtual-table/src/virtual-table-cell-renderer.d.ts +16 -0
- package/lib/components/virtual-table/src/virtual-table-cell-renderer.js +172 -0
- package/lib/components/virtual-table/src/virtual-table-header-renderer.d.ts +10 -0
- package/lib/components/virtual-table/src/virtual-table-header-renderer.js +53 -0
- package/lib/components/virtual-table/style/css.d.ts +3 -0
- package/lib/components/virtual-table/style/css.js +2 -0
- package/lib/components/virtual-table/style/index.d.ts +12 -0
- package/lib/components/virtual-table/style/index.js +2 -0
- package/lib/components/yc-dialog/index.d.ts +24 -24
- package/lib/components/yc-download-dialog/index.d.ts +19 -19
- package/lib/components/yc-download-dialog/src/index.vue.d.ts +1 -1
- package/lib/components/yc-form-container-header/index.d.ts +12 -12
- package/lib/components/yc-more-actions/index.d.ts +46 -46
- package/lib/components/yc-more-actions/src/index.vue.d.ts +3 -3
- package/lib/components/yc-plus-page/src/index.vue.d.ts +2445 -1430
- package/lib/components/yc-plus-page/src/index.vue.js +1 -1
- package/lib/components/yc-plus-page/src/type.d.ts +8 -2
- package/lib/components/yc-segmented/index.d.ts +2 -2
- package/lib/components/yc-segmented/src/index.d.ts +2 -2
- package/lib/components/yc-select-v2/src/index.vue.d.ts +3 -3
- package/lib/components/yc-status-dialog/src/index.vue.d.ts +1 -1
- package/lib/components/yc-tabs-with-filter/index.d.ts +16 -16
- package/lib/components/yc-text/src/index.vue.d.ts +2 -2
- package/lib/hooks/usePlusFormReset.d.ts +238 -238
- package/lib/index.css +20 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +143 -135
- package/lib/yc-components/index.d.ts +1 -0
- package/locale/en.js +1 -1
- package/locale/en.min.js +1 -1
- package/locale/en.min.mjs +1 -1
- package/locale/en.mjs +1 -1
- package/locale/ja.js +1 -1
- package/locale/ja.min.js +1 -1
- package/locale/ja.min.mjs +1 -1
- package/locale/ja.mjs +1 -1
- package/locale/ko.js +1 -1
- package/locale/ko.min.js +1 -1
- package/locale/ko.min.mjs +1 -1
- package/locale/ko.mjs +1 -1
- package/locale/zh-cn.js +1 -1
- package/locale/zh-cn.min.js +1 -1
- package/locale/zh-cn.min.mjs +1 -1
- package/locale/zh-cn.mjs +1 -1
- package/locale/zh-tw.js +1 -1
- package/locale/zh-tw.min.js +1 -1
- package/locale/zh-tw.min.mjs +1 -1
- package/locale/zh-tw.mjs +1 -1
- package/package.json +1 -1
- package/theme-chalk/index.css +1 -1
- package/theme-chalk/plus-virtual-table.css +1 -0
- package/theme-chalk/src/index.scss +3 -0
- package/theme-chalk/src/virtual-table.scss +128 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { TableV2Instance } from 'element-plus';
|
|
2
|
+
import { DefineComponent, ComputedRef, ShallowRef, ComponentOptionsMixin, PublicProps, ExtractPropTypes, PropType } from 'vue';
|
|
3
|
+
import { ButtonsCallBackParams, ActionBarProps } from 'yc-pro-components/es/components/table';
|
|
4
|
+
import { PlusVirtualTableProps, VirtualTableColumn } from './type';
|
|
5
|
+
import { PageInfo, RecordType, PlusColumn } from 'yc-pro-components/es/types';
|
|
6
|
+
import { PlusPaginationProps } from 'yc-pro-components/es/components/pagination';
|
|
7
|
+
|
|
8
|
+
declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<PlusVirtualTableProps>, {
|
|
9
|
+
columns: () => never[];
|
|
10
|
+
tableData: () => never[];
|
|
11
|
+
data: () => never[];
|
|
12
|
+
pagination: boolean;
|
|
13
|
+
actionBar: boolean;
|
|
14
|
+
hasIndexColumn: boolean;
|
|
15
|
+
isSelection: boolean;
|
|
16
|
+
loadingStatus: boolean;
|
|
17
|
+
rowKey: string;
|
|
18
|
+
defaultSize: string;
|
|
19
|
+
rowHeight: number;
|
|
20
|
+
headerHeight: number;
|
|
21
|
+
fixed: boolean;
|
|
22
|
+
defaultColumnWidth: number;
|
|
23
|
+
columnsEmptyText: string;
|
|
24
|
+
scrollbarAlwaysOn: boolean;
|
|
25
|
+
titleBar: boolean;
|
|
26
|
+
selectionColumnWidth: number;
|
|
27
|
+
indexColumnWidth: number;
|
|
28
|
+
stripe: boolean;
|
|
29
|
+
border: boolean;
|
|
30
|
+
}>, {
|
|
31
|
+
getSelectionRows: () => RecordType[];
|
|
32
|
+
clearSelection: () => void;
|
|
33
|
+
toggleRowSelection: (row: RecordType, selected?: boolean | undefined) => void;
|
|
34
|
+
toggleAllSelection: (selected?: boolean | undefined) => void;
|
|
35
|
+
scrollToRow: (rowIndex: number) => void;
|
|
36
|
+
data: ComputedRef<RecordType[]>;
|
|
37
|
+
tableRef: ShallowRef< TableV2Instance | null>;
|
|
38
|
+
}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
39
|
+
paginationChange: (pageInfo: PageInfo) => void;
|
|
40
|
+
clickAction: (data: ButtonsCallBackParams) => void;
|
|
41
|
+
"selection-change": (selection: RecordType[]) => void;
|
|
42
|
+
select: (selection: RecordType[], row: RecordType) => void;
|
|
43
|
+
"select-all": (selection: RecordType[]) => void;
|
|
44
|
+
refresh: () => void;
|
|
45
|
+
"row-click": (rowData: RecordType, rowIndex: number) => void;
|
|
46
|
+
"sort-change": (data: {
|
|
47
|
+
column: VirtualTableColumn;
|
|
48
|
+
prop: string;
|
|
49
|
+
order: string | null;
|
|
50
|
+
}) => void;
|
|
51
|
+
}, string, PublicProps, Readonly< ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<PlusVirtualTableProps>, {
|
|
52
|
+
columns: () => never[];
|
|
53
|
+
tableData: () => never[];
|
|
54
|
+
data: () => never[];
|
|
55
|
+
pagination: boolean;
|
|
56
|
+
actionBar: boolean;
|
|
57
|
+
hasIndexColumn: boolean;
|
|
58
|
+
isSelection: boolean;
|
|
59
|
+
loadingStatus: boolean;
|
|
60
|
+
rowKey: string;
|
|
61
|
+
defaultSize: string;
|
|
62
|
+
rowHeight: number;
|
|
63
|
+
headerHeight: number;
|
|
64
|
+
fixed: boolean;
|
|
65
|
+
defaultColumnWidth: number;
|
|
66
|
+
columnsEmptyText: string;
|
|
67
|
+
scrollbarAlwaysOn: boolean;
|
|
68
|
+
titleBar: boolean;
|
|
69
|
+
selectionColumnWidth: number;
|
|
70
|
+
indexColumnWidth: number;
|
|
71
|
+
stripe: boolean;
|
|
72
|
+
border: boolean;
|
|
73
|
+
}>>> & {
|
|
74
|
+
onSelect?: ((selection: RecordType[], row: RecordType) => any) | undefined;
|
|
75
|
+
onClickAction?: ((data: ButtonsCallBackParams) => any) | undefined;
|
|
76
|
+
"onSelect-all"?: ((selection: RecordType[]) => any) | undefined;
|
|
77
|
+
"onSelection-change"?: ((selection: RecordType[]) => any) | undefined;
|
|
78
|
+
"onSort-change"?: ((data: {
|
|
79
|
+
column: VirtualTableColumn;
|
|
80
|
+
prop: string;
|
|
81
|
+
order: string | null;
|
|
82
|
+
}) => any) | undefined;
|
|
83
|
+
"onRow-click"?: ((rowData: RecordType, rowIndex: number) => any) | undefined;
|
|
84
|
+
onRefresh?: (() => any) | undefined;
|
|
85
|
+
onPaginationChange?: ((pageInfo: PageInfo) => any) | undefined;
|
|
86
|
+
}, {
|
|
87
|
+
fixed: boolean;
|
|
88
|
+
data: RecordType[];
|
|
89
|
+
columns: PlusColumn[];
|
|
90
|
+
border: boolean;
|
|
91
|
+
rowKey: string;
|
|
92
|
+
actionBar: false | Partial< ActionBarProps>;
|
|
93
|
+
stripe: boolean;
|
|
94
|
+
scrollbarAlwaysOn: boolean;
|
|
95
|
+
titleBar: boolean | {
|
|
96
|
+
title?: string | undefined;
|
|
97
|
+
refresh?: boolean | undefined;
|
|
98
|
+
};
|
|
99
|
+
defaultSize: "" | "default" | "small" | "large";
|
|
100
|
+
tableData: RecordType[];
|
|
101
|
+
pagination: false | Partial<PlusPaginationProps>;
|
|
102
|
+
hasIndexColumn: boolean;
|
|
103
|
+
isSelection: boolean;
|
|
104
|
+
loadingStatus: boolean;
|
|
105
|
+
columnsEmptyText: string;
|
|
106
|
+
headerHeight: number;
|
|
107
|
+
rowHeight: number;
|
|
108
|
+
defaultColumnWidth: number;
|
|
109
|
+
selectionColumnWidth: number;
|
|
110
|
+
indexColumnWidth: number;
|
|
111
|
+
}, {}>, {
|
|
112
|
+
title?(_: {}): any;
|
|
113
|
+
toolbar?(_: {}): any;
|
|
114
|
+
"pagination-left"?(_: {}): any;
|
|
115
|
+
"pagination-right"?(_: {}): any;
|
|
116
|
+
}>;
|
|
117
|
+
export default _default;
|
|
118
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
119
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
120
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
121
|
+
type: PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
122
|
+
} : {
|
|
123
|
+
type: PropType<T[K]>;
|
|
124
|
+
required: true;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
type __VLS_WithDefaults<P, D> = {
|
|
128
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
129
|
+
default: D[K];
|
|
130
|
+
}> : P[K];
|
|
131
|
+
};
|
|
132
|
+
type __VLS_Prettify<T> = {
|
|
133
|
+
[K in keyof T]: T[K];
|
|
134
|
+
} & {};
|
|
135
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
136
|
+
new (): {
|
|
137
|
+
$slots: S;
|
|
138
|
+
};
|
|
139
|
+
};
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import { defineComponent, computed, reactive, watch, toRefs, openBlock, createElementBlock, normalizeClass, createCommentVNode, createElementVNode, renderSlot, toDisplayString, createBlock, unref, withCtx, createVNode, withDirectives, normalizeStyle, Fragment, mergeProps, isRef, createSlots } from 'vue';
|
|
2
|
+
import { ElIcon, ElAutoResizer, ElTableV2, vLoading } from 'element-plus';
|
|
3
|
+
import { Refresh } from '@element-plus/icons-vue';
|
|
4
|
+
import { PlusPagination } from '../../pagination/index.mjs';
|
|
5
|
+
import { DefaultPageInfo } from '../../../constants/page.mjs';
|
|
6
|
+
import { useColumnAdapter } from './use-column-adapter.mjs';
|
|
7
|
+
import { useVirtualSelection } from './use-virtual-selection.mjs';
|
|
8
|
+
import { useVirtualScroll } from './use-virtual-scroll.mjs';
|
|
9
|
+
|
|
10
|
+
const _hoisted_1 = {
|
|
11
|
+
key: 0,
|
|
12
|
+
class: "plus-virtual-table__title-bar"
|
|
13
|
+
};
|
|
14
|
+
const _hoisted_2 = { class: "plus-virtual-table__title-bar__left" };
|
|
15
|
+
const _hoisted_3 = {
|
|
16
|
+
key: 0,
|
|
17
|
+
class: "plus-virtual-table__title-bar__text"
|
|
18
|
+
};
|
|
19
|
+
const _hoisted_4 = { class: "plus-virtual-table__title-bar__right" };
|
|
20
|
+
var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
21
|
+
...{
|
|
22
|
+
name: "PlusVirtualTable",
|
|
23
|
+
inheritAttrs: false
|
|
24
|
+
},
|
|
25
|
+
__name: "index",
|
|
26
|
+
props: {
|
|
27
|
+
columns: { default: () => [] },
|
|
28
|
+
tableData: { default: () => [] },
|
|
29
|
+
data: { default: () => [] },
|
|
30
|
+
pagination: { type: [Boolean, Object], default: false },
|
|
31
|
+
actionBar: { type: [Boolean, Object], default: false },
|
|
32
|
+
hasIndexColumn: { type: Boolean, default: false },
|
|
33
|
+
isSelection: { type: Boolean, default: false },
|
|
34
|
+
loadingStatus: { type: Boolean, default: false },
|
|
35
|
+
height: {},
|
|
36
|
+
width: {},
|
|
37
|
+
headerCellStyle: {},
|
|
38
|
+
rowKey: { default: "id" },
|
|
39
|
+
defaultSize: { default: "default" },
|
|
40
|
+
rowHeight: { default: 50 },
|
|
41
|
+
headerHeight: { default: 50 },
|
|
42
|
+
fixed: { type: Boolean, default: true },
|
|
43
|
+
defaultColumnWidth: { default: 150 },
|
|
44
|
+
columnsEmptyText: { default: "-" },
|
|
45
|
+
rowClass: {},
|
|
46
|
+
rowStyle: {},
|
|
47
|
+
scrollbarAlwaysOn: { type: Boolean, default: true },
|
|
48
|
+
titleBar: { type: [Boolean, Object], default: false },
|
|
49
|
+
selectionColumnWidth: { default: 50 },
|
|
50
|
+
indexColumnWidth: { default: 60 },
|
|
51
|
+
stripe: { type: Boolean, default: false },
|
|
52
|
+
border: { type: Boolean, default: false }
|
|
53
|
+
},
|
|
54
|
+
emits: ["paginationChange", "clickAction", "selection-change", "select", "select-all", "refresh", "row-click", "sort-change"],
|
|
55
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
56
|
+
var _a;
|
|
57
|
+
const props = __props;
|
|
58
|
+
const emit = __emit;
|
|
59
|
+
const tableData = computed(() => {
|
|
60
|
+
var _a2;
|
|
61
|
+
return ((_a2 = props.tableData) == null ? void 0 : _a2.length) ? props.tableData : props.data;
|
|
62
|
+
});
|
|
63
|
+
const state = reactive({
|
|
64
|
+
subPageInfo: {
|
|
65
|
+
...((_a = props.pagination) == null ? void 0 : _a.modelValue) || DefaultPageInfo
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
watch(
|
|
69
|
+
() => {
|
|
70
|
+
var _a2;
|
|
71
|
+
return (_a2 = props.pagination) == null ? void 0 : _a2.modelValue;
|
|
72
|
+
},
|
|
73
|
+
(newVal) => {
|
|
74
|
+
if (newVal) {
|
|
75
|
+
Object.assign(state.subPageInfo, newVal);
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
{ deep: true }
|
|
79
|
+
);
|
|
80
|
+
const {
|
|
81
|
+
tableRef,
|
|
82
|
+
wrapperRef,
|
|
83
|
+
scrollToRow,
|
|
84
|
+
useAutoResizer,
|
|
85
|
+
containerStyle,
|
|
86
|
+
rowHeight,
|
|
87
|
+
headerHeight,
|
|
88
|
+
containerWidth
|
|
89
|
+
} = useVirtualScroll({
|
|
90
|
+
height: () => props.height,
|
|
91
|
+
width: () => props.width,
|
|
92
|
+
rowHeight: () => props.rowHeight,
|
|
93
|
+
headerHeight: () => props.headerHeight
|
|
94
|
+
});
|
|
95
|
+
const selectionComposable = useVirtualSelection({
|
|
96
|
+
rowKey: () => props.rowKey,
|
|
97
|
+
data: () => tableData.value,
|
|
98
|
+
onSelectionChange: (selection) => {
|
|
99
|
+
emit("selection-change", selection);
|
|
100
|
+
},
|
|
101
|
+
onSelect: (selection, row) => {
|
|
102
|
+
emit("select", selection, row);
|
|
103
|
+
},
|
|
104
|
+
onSelectAll: (selection) => {
|
|
105
|
+
emit("select-all", selection);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
const { virtualColumns } = useColumnAdapter({
|
|
109
|
+
columns: () => props.columns,
|
|
110
|
+
isSelection: () => props.isSelection,
|
|
111
|
+
hasIndexColumn: () => props.hasIndexColumn,
|
|
112
|
+
actionBar: () => props.actionBar,
|
|
113
|
+
rowKey: () => props.rowKey,
|
|
114
|
+
defaultColumnWidth: () => props.defaultColumnWidth,
|
|
115
|
+
columnsEmptyText: () => props.columnsEmptyText,
|
|
116
|
+
containerWidth: () => containerWidth.value,
|
|
117
|
+
pageInfo: () => {
|
|
118
|
+
if (!props.pagination) return void 0;
|
|
119
|
+
return state.subPageInfo;
|
|
120
|
+
},
|
|
121
|
+
selectionColumnWidth: () => props.selectionColumnWidth,
|
|
122
|
+
indexColumnWidth: () => props.indexColumnWidth,
|
|
123
|
+
selectionCellRenderer: () => selectionComposable.selectionCellRenderer,
|
|
124
|
+
selectionHeaderRenderer: () => selectionComposable.selectionHeaderRenderer,
|
|
125
|
+
onClickAction: (params) => {
|
|
126
|
+
emit("clickAction", params);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
const showTitleBar = computed(() => !!props.titleBar);
|
|
130
|
+
const titleBarConfig = computed(() => {
|
|
131
|
+
if (typeof props.titleBar === "object") {
|
|
132
|
+
return props.titleBar;
|
|
133
|
+
}
|
|
134
|
+
return { refresh: false };
|
|
135
|
+
});
|
|
136
|
+
const fixedWidth = computed(() => {
|
|
137
|
+
const w = props.width;
|
|
138
|
+
if (typeof w === "number") return w;
|
|
139
|
+
if (typeof w === "string") return parseInt(w, 10) || 700;
|
|
140
|
+
return 700;
|
|
141
|
+
});
|
|
142
|
+
const fixedHeight = computed(() => {
|
|
143
|
+
const h = props.height;
|
|
144
|
+
if (typeof h === "number") return h;
|
|
145
|
+
if (typeof h === "string") return parseInt(h, 10) || 400;
|
|
146
|
+
return 400;
|
|
147
|
+
});
|
|
148
|
+
const rowEventHandlers = computed(() => ({
|
|
149
|
+
onClick: (params) => {
|
|
150
|
+
emit("row-click", params.rowData, params.rowIndex);
|
|
151
|
+
}
|
|
152
|
+
}));
|
|
153
|
+
const wrapperClass = computed(() => [
|
|
154
|
+
"plus-virtual-table",
|
|
155
|
+
{
|
|
156
|
+
"plus-virtual-table--striped": props.stripe,
|
|
157
|
+
"plus-virtual-table--border": props.border
|
|
158
|
+
}
|
|
159
|
+
]);
|
|
160
|
+
const mergedRowClass = computed(() => {
|
|
161
|
+
return (params) => {
|
|
162
|
+
const classes = [];
|
|
163
|
+
if (props.stripe && params.rowIndex % 2 === 1) {
|
|
164
|
+
classes.push("plus-virtual-table__row--striped");
|
|
165
|
+
}
|
|
166
|
+
const userClass = props.rowClass;
|
|
167
|
+
if (typeof userClass === "string") {
|
|
168
|
+
classes.push(userClass);
|
|
169
|
+
} else if (typeof userClass === "function") {
|
|
170
|
+
const result = userClass(params);
|
|
171
|
+
if (result) classes.push(result);
|
|
172
|
+
}
|
|
173
|
+
return classes.join(" ");
|
|
174
|
+
};
|
|
175
|
+
});
|
|
176
|
+
const headerClass = computed(() => "plus-virtual-table__header");
|
|
177
|
+
const handlePaginationChange = () => {
|
|
178
|
+
emit("paginationChange", { ...state.subPageInfo });
|
|
179
|
+
};
|
|
180
|
+
const handleRefresh = () => {
|
|
181
|
+
emit("refresh");
|
|
182
|
+
};
|
|
183
|
+
const { subPageInfo } = toRefs(state);
|
|
184
|
+
__expose({
|
|
185
|
+
getSelectionRows: selectionComposable.getSelectionRows,
|
|
186
|
+
clearSelection: selectionComposable.clearSelection,
|
|
187
|
+
toggleRowSelection: selectionComposable.toggleRowSelection,
|
|
188
|
+
toggleAllSelection: selectionComposable.toggleAllSelection,
|
|
189
|
+
scrollToRow,
|
|
190
|
+
data: tableData,
|
|
191
|
+
tableRef
|
|
192
|
+
});
|
|
193
|
+
return (_ctx, _cache) => {
|
|
194
|
+
return openBlock(), createElementBlock(
|
|
195
|
+
"div",
|
|
196
|
+
{
|
|
197
|
+
ref_key: "wrapperRef",
|
|
198
|
+
ref: wrapperRef,
|
|
199
|
+
class: normalizeClass(wrapperClass.value)
|
|
200
|
+
},
|
|
201
|
+
[
|
|
202
|
+
createCommentVNode(" \u6807\u9898\u680F\uFF08\u7B80\u5316\u7248\uFF09 "),
|
|
203
|
+
showTitleBar.value ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
204
|
+
createElementVNode("div", _hoisted_2, [
|
|
205
|
+
renderSlot(_ctx.$slots, "title", {}, () => [
|
|
206
|
+
titleBarConfig.value.title ? (openBlock(), createElementBlock(
|
|
207
|
+
"span",
|
|
208
|
+
_hoisted_3,
|
|
209
|
+
toDisplayString(titleBarConfig.value.title),
|
|
210
|
+
1
|
|
211
|
+
/* TEXT */
|
|
212
|
+
)) : createCommentVNode("v-if", true)
|
|
213
|
+
])
|
|
214
|
+
]),
|
|
215
|
+
createElementVNode("div", _hoisted_4, [
|
|
216
|
+
renderSlot(_ctx.$slots, "toolbar"),
|
|
217
|
+
titleBarConfig.value.refresh ? (openBlock(), createBlock(unref(ElIcon), {
|
|
218
|
+
key: 0,
|
|
219
|
+
class: "plus-virtual-table__title-bar__refresh",
|
|
220
|
+
size: 16,
|
|
221
|
+
onClick: handleRefresh
|
|
222
|
+
}, {
|
|
223
|
+
default: withCtx(() => [
|
|
224
|
+
createVNode(unref(Refresh))
|
|
225
|
+
]),
|
|
226
|
+
_: 1
|
|
227
|
+
/* STABLE */
|
|
228
|
+
})) : createCommentVNode("v-if", true)
|
|
229
|
+
])
|
|
230
|
+
])) : createCommentVNode("v-if", true),
|
|
231
|
+
createCommentVNode(" \u8868\u683C\u4E3B\u4F53 "),
|
|
232
|
+
withDirectives((openBlock(), createElementBlock(
|
|
233
|
+
"div",
|
|
234
|
+
{
|
|
235
|
+
class: "plus-virtual-table__body",
|
|
236
|
+
style: normalizeStyle(unref(containerStyle))
|
|
237
|
+
},
|
|
238
|
+
[
|
|
239
|
+
createCommentVNode(" \u81EA\u9002\u5E94\u6A21\u5F0F\uFF1A\u4F7F\u7528 AutoResizer \u81EA\u52A8\u83B7\u53D6\u7236\u5BB9\u5668\u5C3A\u5BF8 "),
|
|
240
|
+
unref(useAutoResizer) ? (openBlock(), createBlock(unref(ElAutoResizer), { key: 0 }, {
|
|
241
|
+
default: withCtx(({ height: autoHeight, width: autoWidth }) => [
|
|
242
|
+
createVNode(unref(ElTableV2), {
|
|
243
|
+
ref_key: "tableRef",
|
|
244
|
+
ref: tableRef,
|
|
245
|
+
columns: unref(virtualColumns),
|
|
246
|
+
data: tableData.value,
|
|
247
|
+
width: autoWidth,
|
|
248
|
+
height: autoHeight,
|
|
249
|
+
fixed: _ctx.fixed,
|
|
250
|
+
"row-key": _ctx.rowKey,
|
|
251
|
+
"row-height": unref(rowHeight),
|
|
252
|
+
"header-height": unref(headerHeight),
|
|
253
|
+
"row-class": mergedRowClass.value,
|
|
254
|
+
"row-event-handlers": rowEventHandlers.value,
|
|
255
|
+
"scrollbar-always-on": _ctx.scrollbarAlwaysOn,
|
|
256
|
+
"header-class": headerClass.value
|
|
257
|
+
}, null, 8, ["columns", "data", "width", "height", "fixed", "row-key", "row-height", "header-height", "row-class", "row-event-handlers", "scrollbar-always-on", "header-class"])
|
|
258
|
+
]),
|
|
259
|
+
_: 1
|
|
260
|
+
/* STABLE */
|
|
261
|
+
})) : (openBlock(), createElementBlock(
|
|
262
|
+
Fragment,
|
|
263
|
+
{ key: 1 },
|
|
264
|
+
[
|
|
265
|
+
createCommentVNode(" \u56FA\u5B9A\u5C3A\u5BF8\u6A21\u5F0F\uFF1A\u76F4\u63A5\u4F7F\u7528\u6307\u5B9A\u7684\u5BBD\u9AD8 "),
|
|
266
|
+
createVNode(unref(ElTableV2), {
|
|
267
|
+
ref_key: "tableRef",
|
|
268
|
+
ref: tableRef,
|
|
269
|
+
columns: unref(virtualColumns),
|
|
270
|
+
data: tableData.value,
|
|
271
|
+
width: fixedWidth.value,
|
|
272
|
+
height: fixedHeight.value,
|
|
273
|
+
fixed: _ctx.fixed,
|
|
274
|
+
"row-key": _ctx.rowKey,
|
|
275
|
+
"row-height": unref(rowHeight),
|
|
276
|
+
"header-height": unref(headerHeight),
|
|
277
|
+
"row-class": mergedRowClass.value,
|
|
278
|
+
"row-event-handlers": rowEventHandlers.value,
|
|
279
|
+
"scrollbar-always-on": _ctx.scrollbarAlwaysOn,
|
|
280
|
+
"header-class": headerClass.value
|
|
281
|
+
}, null, 8, ["columns", "data", "width", "height", "fixed", "row-key", "row-height", "header-height", "row-class", "row-event-handlers", "scrollbar-always-on", "header-class"])
|
|
282
|
+
],
|
|
283
|
+
2112
|
|
284
|
+
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
285
|
+
))
|
|
286
|
+
],
|
|
287
|
+
4
|
|
288
|
+
/* STYLE */
|
|
289
|
+
)), [
|
|
290
|
+
[unref(vLoading), _ctx.loadingStatus]
|
|
291
|
+
]),
|
|
292
|
+
createCommentVNode(" \u5206\u9875 "),
|
|
293
|
+
_ctx.pagination ? (openBlock(), createBlock(unref(PlusPagination), mergeProps({
|
|
294
|
+
key: 1,
|
|
295
|
+
modelValue: unref(subPageInfo),
|
|
296
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(subPageInfo) ? subPageInfo.value = $event : null)
|
|
297
|
+
}, _ctx.pagination, {
|
|
298
|
+
class: "plus-virtual-table__pagination",
|
|
299
|
+
onChange: handlePaginationChange
|
|
300
|
+
}), createSlots({
|
|
301
|
+
_: 2
|
|
302
|
+
/* DYNAMIC */
|
|
303
|
+
}, [
|
|
304
|
+
_ctx.$slots["pagination-left"] ? {
|
|
305
|
+
name: "pagination-left",
|
|
306
|
+
fn: withCtx(() => [
|
|
307
|
+
renderSlot(_ctx.$slots, "pagination-left")
|
|
308
|
+
]),
|
|
309
|
+
key: "0"
|
|
310
|
+
} : void 0,
|
|
311
|
+
_ctx.$slots["pagination-right"] ? {
|
|
312
|
+
name: "pagination-right",
|
|
313
|
+
fn: withCtx(() => [
|
|
314
|
+
renderSlot(_ctx.$slots, "pagination-right")
|
|
315
|
+
]),
|
|
316
|
+
key: "1"
|
|
317
|
+
} : void 0
|
|
318
|
+
]), 1040, ["modelValue"])) : createCommentVNode("v-if", true)
|
|
319
|
+
],
|
|
320
|
+
2
|
|
321
|
+
/* CLASS */
|
|
322
|
+
);
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
export { _sfc_main as default };
|