rayyy-vue-table-components 2.0.51 → 2.0.52
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.es.js +1188 -1143
- package/dist/index.umd.js +2 -2
- package/dist/src/components/index.d.ts +1 -1
- package/dist/src/components/tables/BaseTable.vue.d.ts +13 -1
- package/dist/src/components/tables/SortTable.vue.d.ts +6 -0
- package/dist/src/components/tables/TitleTable.vue.d.ts +6 -0
- package/dist/src/types/components.d.ts +39 -3
- package/package.json +1 -1
- package/src/components/index.ts +3 -0
- package/src/components/tables/BaseTable.vue +17 -1
- package/src/components/tables/SortTable.vue +9 -1
- package/src/components/tables/TitleTable.vue +9 -1
- package/src/types/components.d.ts +39 -3
|
@@ -27,12 +27,18 @@ declare const _default: <T extends Record<string, unknown>>(__VLS_props: NonNull
|
|
|
27
27
|
}) => (string | VNode)[];
|
|
28
28
|
showCheckBtn?: boolean;
|
|
29
29
|
showEditBtn?: boolean;
|
|
30
|
+
showExpand?: boolean;
|
|
31
|
+
preserveExpanded?: boolean;
|
|
30
32
|
} & Partial<{}>> & import('vue').PublicProps;
|
|
31
33
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
32
34
|
attrs: any;
|
|
33
35
|
slots: {
|
|
34
36
|
tableSearch?(_: {}): any;
|
|
35
37
|
editBtn?(_: {}): any;
|
|
38
|
+
expand?(_: {
|
|
39
|
+
row: T;
|
|
40
|
+
$index: number;
|
|
41
|
+
}): any;
|
|
36
42
|
};
|
|
37
43
|
emit: {
|
|
38
44
|
(e: "click:add"): void;
|
|
@@ -28,10 +28,20 @@ export interface BaseTableProps<T extends Record<string, unknown> = Record<strin
|
|
|
28
28
|
}) => (string | VNode)[]
|
|
29
29
|
/** 行樣式類名 */
|
|
30
30
|
baseTableRowClassName?: (data: { row: T; rowIndex: number }) => string
|
|
31
|
+
/** 是否顯示展開列 */
|
|
32
|
+
showExpand?: boolean
|
|
31
33
|
/** 是否顯示查看按鈕 */
|
|
32
34
|
showCheckBtn?: boolean
|
|
33
35
|
/** 是否顯示編輯按鈕 */
|
|
34
36
|
showEditBtn?: boolean
|
|
37
|
+
/** 是否保留展開內容 */
|
|
38
|
+
preserveExpanded?: boolean
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** BaseTable 組件 Slots 類型 */
|
|
42
|
+
export interface BaseTableSlots<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
43
|
+
/** 展開行內容 slot */
|
|
44
|
+
expand?: (props: { row: T; $index: number }) => VNode[]
|
|
35
45
|
}
|
|
36
46
|
|
|
37
47
|
/** BaseTable 組件 Emits 類型 */
|
|
@@ -85,10 +95,22 @@ export interface SortTableProps<T extends Record<string, unknown> = Record<strin
|
|
|
85
95
|
}) => (string | import('vue').VNode)[]
|
|
86
96
|
/** 行樣式類名 */
|
|
87
97
|
sortTableRowClassName?: (data: { row: T; rowIndex: number }) => string
|
|
98
|
+
/** 是否顯示展開列 */
|
|
99
|
+
showExpand?: boolean
|
|
88
100
|
/** 是否顯示查看按鈕 */
|
|
89
101
|
showCheckBtn?: boolean
|
|
90
102
|
/** 是否顯示編輯按鈕 */
|
|
91
103
|
showEditBtn?: boolean
|
|
104
|
+
/** 是否保留展開內容 */
|
|
105
|
+
preserveExpanded?: boolean
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** SortTable 組件 Slots 類型 */
|
|
109
|
+
export interface SortTableSlots<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
110
|
+
/** 第一個按鈕 slot */
|
|
111
|
+
firstButton?: () => VNode[]
|
|
112
|
+
/** 展開行內容 slot */
|
|
113
|
+
expand?: (props: { row: T; $index: number }) => VNode[]
|
|
92
114
|
}
|
|
93
115
|
|
|
94
116
|
/** SortTable 組件 Emits 類型 */
|
|
@@ -148,10 +170,24 @@ export interface TitleTableProps<T extends Record<string, unknown> = Record<stri
|
|
|
148
170
|
columns: import('element-plus').TableColumnCtx<Record<string, unknown>>[]
|
|
149
171
|
data: T[]
|
|
150
172
|
}) => (string | import('vue').VNode)[]
|
|
173
|
+
/** 是否顯示展開列 */
|
|
174
|
+
showExpand?: boolean
|
|
151
175
|
/** 是否顯示查看按鈕 */
|
|
152
176
|
showCheckBtn?: boolean
|
|
153
177
|
/** 是否顯示編輯按鈕 */
|
|
154
178
|
showEditBtn?: boolean
|
|
179
|
+
/** 是否保留展開內容 */
|
|
180
|
+
preserveExpanded?: boolean
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/** TitleTable 組件 Slots 類型 */
|
|
184
|
+
export interface TitleTableSlots<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
185
|
+
/** 搜尋 slot */
|
|
186
|
+
tableSearch?: () => VNode[]
|
|
187
|
+
/** 編輯按鈕 slot */
|
|
188
|
+
editBtn?: () => VNode[]
|
|
189
|
+
/** 展開行內容 slot */
|
|
190
|
+
expand?: (props: { row: T; $index: number }) => VNode[]
|
|
155
191
|
}
|
|
156
192
|
|
|
157
193
|
/** TitleTable 組件 Emits 類型 */
|
|
@@ -662,7 +698,7 @@ export declare const BaseTable: DefineComponent<
|
|
|
662
698
|
{},
|
|
663
699
|
{},
|
|
664
700
|
{},
|
|
665
|
-
|
|
701
|
+
BaseTableSlots<any>,
|
|
666
702
|
BaseTableEmits<any>
|
|
667
703
|
> & {
|
|
668
704
|
/** 安裝方法 */
|
|
@@ -678,7 +714,7 @@ export declare const SortTable: DefineComponent<
|
|
|
678
714
|
{},
|
|
679
715
|
{},
|
|
680
716
|
{},
|
|
681
|
-
|
|
717
|
+
SortTableSlots<any>,
|
|
682
718
|
SortTableEmits<any>
|
|
683
719
|
> & {
|
|
684
720
|
/** 安裝方法 */
|
|
@@ -694,7 +730,7 @@ export declare const TitleTable: DefineComponent<
|
|
|
694
730
|
{},
|
|
695
731
|
{},
|
|
696
732
|
{},
|
|
697
|
-
|
|
733
|
+
TitleTableSlots<any>,
|
|
698
734
|
TitleTableEmits<any>
|
|
699
735
|
> & {
|
|
700
736
|
/** 安裝方法 */
|
package/package.json
CHANGED
package/src/components/index.ts
CHANGED
|
@@ -22,6 +22,7 @@ export type {
|
|
|
22
22
|
BaseTableProps,
|
|
23
23
|
BaseTableEmits,
|
|
24
24
|
BaseTableInstance,
|
|
25
|
+
BaseTableSlots,
|
|
25
26
|
// BaseBtn 組件類型
|
|
26
27
|
BaseBtnProps,
|
|
27
28
|
BaseBtnEmits,
|
|
@@ -42,10 +43,12 @@ export type {
|
|
|
42
43
|
SortTableProps,
|
|
43
44
|
SortTableEmits,
|
|
44
45
|
SortTableInstance,
|
|
46
|
+
SortTableSlots,
|
|
45
47
|
// TitleTable 組件類型
|
|
46
48
|
TitleTableProps,
|
|
47
49
|
TitleTableEmits,
|
|
48
50
|
TitleTableInstance,
|
|
51
|
+
TitleTableSlots,
|
|
49
52
|
// SearchBar 組件類型
|
|
50
53
|
SearchBarProps,
|
|
51
54
|
SearchBarEmits,
|
|
@@ -14,6 +14,7 @@ type Props<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
|
14
14
|
columns: TableColumn<T>[]
|
|
15
15
|
showSelection?: boolean
|
|
16
16
|
showIndex?: boolean
|
|
17
|
+
showExpand?: boolean
|
|
17
18
|
showSummary?: boolean
|
|
18
19
|
showOverFlowTooltip?: boolean
|
|
19
20
|
summaryMethod?: (param: {
|
|
@@ -23,7 +24,8 @@ type Props<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
|
23
24
|
baseTableRowClassName?: (data: { row: T; rowIndex: number }) => string
|
|
24
25
|
showCheckBtn?: boolean
|
|
25
26
|
showEditBtn?: boolean
|
|
26
|
-
|
|
27
|
+
preserveExpanded?: boolean
|
|
28
|
+
locale?: Language
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
// 組件屬性默認值
|
|
@@ -32,10 +34,12 @@ const props = withDefaults(defineProps<Props<T>>(), {
|
|
|
32
34
|
data: () => [],
|
|
33
35
|
showSelection: false,
|
|
34
36
|
showIndex: false,
|
|
37
|
+
showExpand: false,
|
|
35
38
|
showSummary: false,
|
|
36
39
|
showOverFlowTooltip: false,
|
|
37
40
|
showCheckBtn: false,
|
|
38
41
|
showEditBtn: false,
|
|
42
|
+
preserveExpanded: false,
|
|
39
43
|
summaryMethod: () => [],
|
|
40
44
|
baseTableRowClassName: () => '',
|
|
41
45
|
})
|
|
@@ -49,6 +53,10 @@ const emit = defineEmits<{
|
|
|
49
53
|
(e: 'click:editRow', row: T): void
|
|
50
54
|
}>()
|
|
51
55
|
|
|
56
|
+
defineSlots<{
|
|
57
|
+
expand?: (props: { row: T; $index: number }) => VNode[]
|
|
58
|
+
}>()
|
|
59
|
+
|
|
52
60
|
const handleCellClick = (column: TableColumn<T>, row: T) => {
|
|
53
61
|
emit('cell-click', column, row)
|
|
54
62
|
}
|
|
@@ -97,6 +105,7 @@ const operatorWidth = computed(() => {
|
|
|
97
105
|
class="data-table"
|
|
98
106
|
@selection-change="handleSelectionChange"
|
|
99
107
|
@current-change="(currentRow: any) => emit('current-change', currentRow)"
|
|
108
|
+
:preserve-expanded-content="preserveExpanded"
|
|
100
109
|
:sort="() => {}"
|
|
101
110
|
@sort-change="onSortChange"
|
|
102
111
|
>
|
|
@@ -106,6 +115,13 @@ const operatorWidth = computed(() => {
|
|
|
106
115
|
<!-- 索引列 -->
|
|
107
116
|
<el-table-column v-if="showIndex" type="index" width="60" fixed="left" align="center" label="No" />
|
|
108
117
|
|
|
118
|
+
<!-- 展開列 -->
|
|
119
|
+
<el-table-column v-if="showExpand" type="expand">
|
|
120
|
+
<template #default="{ row, $index }">
|
|
121
|
+
<slot name="expand" :row="row" :$index="$index" />
|
|
122
|
+
</template>
|
|
123
|
+
</el-table-column>
|
|
124
|
+
|
|
109
125
|
<!-- 數據列 -->
|
|
110
126
|
<el-table-column v-for="(column, index) in columns" :key="index" v-bind="column">
|
|
111
127
|
<template #default="{ row }">
|
|
@@ -21,6 +21,8 @@ defineProps<{
|
|
|
21
21
|
sortTableRowClassName?: (data: { row: T; rowIndex: number }) => string
|
|
22
22
|
showCheckBtn?: boolean
|
|
23
23
|
showEditBtn?: boolean
|
|
24
|
+
showExpand?: boolean
|
|
25
|
+
preserveExpanded?: boolean
|
|
24
26
|
}>()
|
|
25
27
|
|
|
26
28
|
const emit = defineEmits<{
|
|
@@ -108,15 +110,21 @@ const state = reactive({
|
|
|
108
110
|
:summary-method="summaryMethod"
|
|
109
111
|
:show-selection="showSelection"
|
|
110
112
|
:show-index="showIndex"
|
|
113
|
+
:show-expand="showExpand"
|
|
111
114
|
:base-table-row-class-name="sortTableRowClassName"
|
|
112
115
|
:show-check-btn="showCheckBtn"
|
|
113
116
|
:show-edit-btn="showEditBtn"
|
|
117
|
+
:preserve-expanded="preserveExpanded"
|
|
114
118
|
@selection-change="handleSelectionChange"
|
|
115
119
|
@cell-click="handleCellClick"
|
|
116
120
|
@column-sort-change="handleColumnSortChange"
|
|
117
121
|
@click:checkRow="handleCheckClick"
|
|
118
122
|
@click:editRow="handleEditClick"
|
|
119
|
-
|
|
123
|
+
>
|
|
124
|
+
<template #expand="{ row, $index }" v-if="showExpand">
|
|
125
|
+
<slot name="expand" :row="row" :$index="$index" />
|
|
126
|
+
</template>
|
|
127
|
+
</base-table>
|
|
120
128
|
</div>
|
|
121
129
|
</template>
|
|
122
130
|
|
|
@@ -26,6 +26,8 @@ defineProps<{
|
|
|
26
26
|
}) => (string | VNode)[]
|
|
27
27
|
showCheckBtn?: boolean
|
|
28
28
|
showEditBtn?: boolean
|
|
29
|
+
showExpand?: boolean
|
|
30
|
+
preserveExpanded?: boolean
|
|
29
31
|
}>()
|
|
30
32
|
|
|
31
33
|
const emit = defineEmits<{
|
|
@@ -98,14 +100,20 @@ const handleEditClick = (row: T) => {
|
|
|
98
100
|
:summary-method="summaryMethod"
|
|
99
101
|
:show-selection="propIsEditable || showSelection"
|
|
100
102
|
:show-index="showIndex"
|
|
103
|
+
:show-expand="showExpand"
|
|
101
104
|
:show-over-flow-tooltip="showOverFlowTooltip"
|
|
102
105
|
:show-check-btn="showCheckBtn"
|
|
103
106
|
:show-edit-btn="showEditBtn"
|
|
107
|
+
:preserve-expanded="preserveExpanded"
|
|
104
108
|
@selection-change="handleSelectionChange"
|
|
105
109
|
@cell-click="handleCellClick"
|
|
106
110
|
@click:checkRow="handleCheckClick"
|
|
107
111
|
@click:editRow="handleEditClick"
|
|
108
|
-
|
|
112
|
+
>
|
|
113
|
+
<template #expand="{ row, $index }" v-if="showExpand">
|
|
114
|
+
<slot name="expand" :row="row" :$index="$index" />
|
|
115
|
+
</template>
|
|
116
|
+
</base-table>
|
|
109
117
|
</div>
|
|
110
118
|
</template>
|
|
111
119
|
|
|
@@ -29,10 +29,20 @@ export interface BaseTableProps<T extends Record<string, unknown> = Record<strin
|
|
|
29
29
|
}) => (string | VNode)[]
|
|
30
30
|
/** 行樣式類名 */
|
|
31
31
|
baseTableRowClassName?: (data: { row: T; rowIndex: number }) => string
|
|
32
|
+
/** 是否顯示展開列 */
|
|
33
|
+
showExpand?: boolean
|
|
32
34
|
/** 是否顯示查看按鈕 */
|
|
33
35
|
showCheckBtn?: boolean
|
|
34
36
|
/** 是否顯示編輯按鈕 */
|
|
35
37
|
showEditBtn?: boolean
|
|
38
|
+
/** 是否保留展開內容 */
|
|
39
|
+
preserveExpanded?: boolean
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** BaseTable 組件 Slots 類型 */
|
|
43
|
+
export interface BaseTableSlots<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
44
|
+
/** 展開行內容 slot */
|
|
45
|
+
expand?: (props: { row: T; $index: number }) => VNode[]
|
|
36
46
|
}
|
|
37
47
|
|
|
38
48
|
/** BaseTable 組件 Emits 類型 */
|
|
@@ -86,10 +96,22 @@ export interface SortTableProps<T extends Record<string, unknown> = Record<strin
|
|
|
86
96
|
}) => (string | import('vue').VNode)[]
|
|
87
97
|
/** 行樣式類名 */
|
|
88
98
|
sortTableRowClassName?: (data: { row: T; rowIndex: number }) => string
|
|
99
|
+
/** 是否顯示展開列 */
|
|
100
|
+
showExpand?: boolean
|
|
89
101
|
/** 是否顯示查看按鈕 */
|
|
90
102
|
showCheckBtn?: boolean
|
|
91
103
|
/** 是否顯示編輯按鈕 */
|
|
92
104
|
showEditBtn?: boolean
|
|
105
|
+
/** 是否保留展開內容 */
|
|
106
|
+
preserveExpanded?: boolean
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** SortTable 組件 Slots 類型 */
|
|
110
|
+
export interface SortTableSlots<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
111
|
+
/** 第一個按鈕 slot */
|
|
112
|
+
firstButton?: () => VNode[]
|
|
113
|
+
/** 展開行內容 slot */
|
|
114
|
+
expand?: (props: { row: T; $index: number }) => VNode[]
|
|
93
115
|
}
|
|
94
116
|
|
|
95
117
|
/** SortTable 組件 Emits 類型 */
|
|
@@ -149,10 +171,24 @@ export interface TitleTableProps<T extends Record<string, unknown> = Record<stri
|
|
|
149
171
|
columns: import('element-plus').TableColumnCtx<Record<string, unknown>>[]
|
|
150
172
|
data: T[]
|
|
151
173
|
}) => (string | import('vue').VNode)[]
|
|
174
|
+
/** 是否顯示展開列 */
|
|
175
|
+
showExpand?: boolean
|
|
152
176
|
/** 是否顯示查看按鈕 */
|
|
153
177
|
showCheckBtn?: boolean
|
|
154
178
|
/** 是否顯示編輯按鈕 */
|
|
155
179
|
showEditBtn?: boolean
|
|
180
|
+
/** 是否保留展開內容 */
|
|
181
|
+
preserveExpanded?: boolean
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/** TitleTable 組件 Slots 類型 */
|
|
185
|
+
export interface TitleTableSlots<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
186
|
+
/** 搜尋 slot */
|
|
187
|
+
tableSearch?: () => VNode[]
|
|
188
|
+
/** 編輯按鈕 slot */
|
|
189
|
+
editBtn?: () => VNode[]
|
|
190
|
+
/** 展開行內容 slot */
|
|
191
|
+
expand?: (props: { row: T; $index: number }) => VNode[]
|
|
156
192
|
}
|
|
157
193
|
|
|
158
194
|
/** TitleTable 組件 Emits 類型 */
|
|
@@ -663,7 +699,7 @@ export declare const BaseTable: DefineComponent<
|
|
|
663
699
|
{},
|
|
664
700
|
{},
|
|
665
701
|
{},
|
|
666
|
-
|
|
702
|
+
BaseTableSlots<any>,
|
|
667
703
|
BaseTableEmits<any>
|
|
668
704
|
> & {
|
|
669
705
|
/** 安裝方法 */
|
|
@@ -679,7 +715,7 @@ export declare const SortTable: DefineComponent<
|
|
|
679
715
|
{},
|
|
680
716
|
{},
|
|
681
717
|
{},
|
|
682
|
-
|
|
718
|
+
SortTableSlots<any>,
|
|
683
719
|
SortTableEmits<any>
|
|
684
720
|
> & {
|
|
685
721
|
/** 安裝方法 */
|
|
@@ -695,7 +731,7 @@ export declare const TitleTable: DefineComponent<
|
|
|
695
731
|
{},
|
|
696
732
|
{},
|
|
697
733
|
{},
|
|
698
|
-
|
|
734
|
+
TitleTableSlots<any>,
|
|
699
735
|
TitleTableEmits<any>
|
|
700
736
|
> & {
|
|
701
737
|
/** 安裝方法 */
|