rayyy-vue-table-components 1.3.14 → 1.3.16
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/README.md +2 -1
- package/dist/index.es.js +2474 -2459
- package/dist/index.umd.js +6 -6
- package/dist/src/components/tables/BaseTable.vue.d.ts +2 -1
- package/dist/src/components/tables/SortTable.vue.d.ts +2 -1
- package/dist/src/components/tables/TitleTable.vue.d.ts +2 -1
- package/dist/src/types/components.d.ts +12 -6
- package/package.json +1 -1
- package/src/components/tables/BaseTable.vue +31 -6
- package/src/components/tables/SortTable.vue +4 -2
- package/src/components/tables/TitleTable.vue +4 -2
- package/src/types/components.d.ts +12 -6
|
@@ -24,7 +24,8 @@ declare const _default: <T extends Record<string, unknown> = Record<string, unkn
|
|
|
24
24
|
row: T;
|
|
25
25
|
rowIndex: number;
|
|
26
26
|
}) => string) | undefined;
|
|
27
|
-
|
|
27
|
+
showCheckBtn?: boolean;
|
|
28
|
+
showEditBtn?: boolean;
|
|
28
29
|
} & Partial<{}>> & import('vue').PublicProps;
|
|
29
30
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
30
31
|
attrs: any;
|
|
@@ -25,7 +25,8 @@ declare const _default: <T extends Record<string, unknown>>(__VLS_props: NonNull
|
|
|
25
25
|
row: T;
|
|
26
26
|
rowIndex: number;
|
|
27
27
|
}) => string;
|
|
28
|
-
|
|
28
|
+
showCheckBtn?: boolean;
|
|
29
|
+
showEditBtn?: boolean;
|
|
29
30
|
} & Partial<{}>> & import('vue').PublicProps;
|
|
30
31
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
31
32
|
attrs: any;
|
|
@@ -24,7 +24,8 @@ declare const _default: <T extends Record<string, unknown>>(__VLS_props: NonNull
|
|
|
24
24
|
columns: TableColumnCtx<Record<string, unknown>>[];
|
|
25
25
|
data: T[];
|
|
26
26
|
}) => (string | VNode)[];
|
|
27
|
-
|
|
27
|
+
showCheckBtn?: boolean;
|
|
28
|
+
showEditBtn?: boolean;
|
|
28
29
|
} & Partial<{}>> & import('vue').PublicProps;
|
|
29
30
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
30
31
|
attrs: any;
|
|
@@ -26,8 +26,10 @@ export interface BaseTableProps<T extends Record<string, unknown> = Record<strin
|
|
|
26
26
|
}) => (string | VNode)[]
|
|
27
27
|
/** 行樣式類名 */
|
|
28
28
|
baseTableRowClassName?: (data: { row: T; rowIndex: number }) => string
|
|
29
|
-
/**
|
|
30
|
-
|
|
29
|
+
/** 是否顯示查看按鈕 */
|
|
30
|
+
showCheckBtn?: boolean
|
|
31
|
+
/** 是否顯示編輯按鈕 */
|
|
32
|
+
showEditBtn?: boolean
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
/** BaseTable 組件 Emits 類型 */
|
|
@@ -79,8 +81,10 @@ export interface SortTableProps<T extends Record<string, unknown> = Record<strin
|
|
|
79
81
|
}) => (string | import('vue').VNode)[]
|
|
80
82
|
/** 行樣式類名 */
|
|
81
83
|
sortTableRowClassName?: (data: { row: T; rowIndex: number }) => string
|
|
82
|
-
/**
|
|
83
|
-
|
|
84
|
+
/** 是否顯示查看按鈕 */
|
|
85
|
+
showCheckBtn?: boolean
|
|
86
|
+
/** 是否顯示編輯按鈕 */
|
|
87
|
+
showEditBtn?: boolean
|
|
84
88
|
}
|
|
85
89
|
|
|
86
90
|
/** SortTable 組件 Emits 類型 */
|
|
@@ -136,8 +140,10 @@ export interface TitleTableProps<T extends Record<string, unknown> = Record<stri
|
|
|
136
140
|
columns: import('element-plus').TableColumnCtx<Record<string, unknown>>[]
|
|
137
141
|
data: T[]
|
|
138
142
|
}) => (string | import('vue').VNode)[]
|
|
139
|
-
/**
|
|
140
|
-
|
|
143
|
+
/** 是否顯示查看按鈕 */
|
|
144
|
+
showCheckBtn?: boolean
|
|
145
|
+
/** 是否顯示編輯按鈕 */
|
|
146
|
+
showEditBtn?: boolean
|
|
141
147
|
}
|
|
142
148
|
|
|
143
149
|
/** TitleTable 組件 Emits 類型 */
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts" generic="T extends Record<string, unknown> = Record<string, unknown>">
|
|
2
2
|
import type { VNode } from 'vue'
|
|
3
|
+
import { computed } from 'vue'
|
|
3
4
|
import type { TableColumnCtx } from 'element-plus'
|
|
4
5
|
import type { SortChangValue, TableColumn } from '@/types'
|
|
5
6
|
|
|
@@ -15,7 +16,8 @@ type Props<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
|
15
16
|
data: T[]
|
|
16
17
|
}) => (string | VNode)[]
|
|
17
18
|
baseTableRowClassName?: (data: { row: T; rowIndex: number }) => string
|
|
18
|
-
|
|
19
|
+
showCheckBtn?: boolean
|
|
20
|
+
showEditBtn?: boolean
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
// 組件屬性默認值
|
|
@@ -25,7 +27,8 @@ const props = withDefaults(defineProps<Props<T>>(), {
|
|
|
25
27
|
showSelection: false,
|
|
26
28
|
showSummary: false,
|
|
27
29
|
showOverFlowTooltip: false,
|
|
28
|
-
|
|
30
|
+
showCheckBtn: false,
|
|
31
|
+
showEditBtn: false,
|
|
29
32
|
summaryMethod: () => [],
|
|
30
33
|
baseTableRowClassName: () => '',
|
|
31
34
|
})
|
|
@@ -62,6 +65,15 @@ const onSortChange = (value: SortChangValue<T>) => {
|
|
|
62
65
|
const handleOperateClick = (value: T, clickType: 'check' | 'edit') => {
|
|
63
66
|
clickType == 'check' ? emit('click:checkRow', value) : emit('click:editRow', value)
|
|
64
67
|
}
|
|
68
|
+
const operatorWidth = computed(() => {
|
|
69
|
+
if (props.showCheckBtn && props.showEditBtn) {
|
|
70
|
+
return 120
|
|
71
|
+
} else if (props.showCheckBtn && !props.showEditBtn) {
|
|
72
|
+
return 60
|
|
73
|
+
} else if (props.showEditBtn && !props.showCheckBtn) {
|
|
74
|
+
return 60
|
|
75
|
+
}
|
|
76
|
+
})
|
|
65
77
|
</script>
|
|
66
78
|
|
|
67
79
|
<template>
|
|
@@ -102,14 +114,27 @@ const handleOperateClick = (value: T, clickType: 'check' | 'edit') => {
|
|
|
102
114
|
</div>
|
|
103
115
|
</template>
|
|
104
116
|
</el-table-column>
|
|
105
|
-
<el-table-column
|
|
117
|
+
<el-table-column
|
|
118
|
+
v-if="props.showCheckBtn || props.showEditBtn"
|
|
119
|
+
:width="operatorWidth"
|
|
120
|
+
align="center"
|
|
121
|
+
fixed="right"
|
|
122
|
+
>
|
|
106
123
|
<template #default="{ row }">
|
|
107
124
|
<div class="flex items-center justify-center">
|
|
108
|
-
<p
|
|
125
|
+
<p
|
|
126
|
+
class="blue-text cursor-pointer font-bold"
|
|
127
|
+
@click="handleOperateClick(row, 'check')"
|
|
128
|
+
v-if="showCheckBtn"
|
|
129
|
+
>
|
|
109
130
|
查看
|
|
110
131
|
</p>
|
|
111
|
-
<el-divider direction="vertical" class="!mx-2" />
|
|
112
|
-
<p
|
|
132
|
+
<el-divider direction="vertical" class="!mx-2" v-if="showCheckBtn && showEditBtn" />
|
|
133
|
+
<p
|
|
134
|
+
class="blue-text cursor-pointer font-bold"
|
|
135
|
+
@click="handleOperateClick(row, 'edit')"
|
|
136
|
+
v-if="showEditBtn"
|
|
137
|
+
>
|
|
113
138
|
编辑
|
|
114
139
|
</p>
|
|
115
140
|
</div>
|
|
@@ -18,7 +18,8 @@ defineProps<{
|
|
|
18
18
|
data: T[]
|
|
19
19
|
}) => (string | VNode)[]
|
|
20
20
|
sortTableRowClassName?: (data: { row: T; rowIndex: number }) => string
|
|
21
|
-
|
|
21
|
+
showCheckBtn?: boolean
|
|
22
|
+
showEditBtn?: boolean
|
|
22
23
|
}>()
|
|
23
24
|
|
|
24
25
|
const emit = defineEmits<{
|
|
@@ -77,7 +78,8 @@ const handleEditClick = (row: T) => {
|
|
|
77
78
|
:summary-method="summaryMethod"
|
|
78
79
|
:show-selection="showSelection"
|
|
79
80
|
:base-table-row-class-name="sortTableRowClassName"
|
|
80
|
-
:show-
|
|
81
|
+
:show-check-btn="showCheckBtn"
|
|
82
|
+
:show-edit-btn="showEditBtn"
|
|
81
83
|
@selection-change="handleSelectionChange"
|
|
82
84
|
@cell-click="handleCellClick"
|
|
83
85
|
@column-sort-change="handleColumnSortChange"
|
|
@@ -20,7 +20,8 @@ defineProps<{
|
|
|
20
20
|
columns: TableColumnCtx<Record<string, unknown>>[]
|
|
21
21
|
data: T[]
|
|
22
22
|
}) => (string | VNode)[]
|
|
23
|
-
|
|
23
|
+
showCheckBtn?: boolean
|
|
24
|
+
showEditBtn?: boolean
|
|
24
25
|
}>()
|
|
25
26
|
|
|
26
27
|
const emit = defineEmits<{
|
|
@@ -83,7 +84,8 @@ const handleEditClick = (row: T) => {
|
|
|
83
84
|
:summary-method="summaryMethod"
|
|
84
85
|
:show-selection="propIsEditable || showSelection"
|
|
85
86
|
:show-over-flow-tooltip="showOverFlowTooltip"
|
|
86
|
-
:show-
|
|
87
|
+
:show-check-btn="showCheckBtn"
|
|
88
|
+
:show-edit-btn="showEditBtn"
|
|
87
89
|
@selection-change="handleSelectionChange"
|
|
88
90
|
@cell-click="handleCellClick"
|
|
89
91
|
@click:checkRow="handleCheckClick"
|
|
@@ -27,8 +27,10 @@ export interface BaseTableProps<T extends Record<string, unknown> = Record<strin
|
|
|
27
27
|
}) => (string | VNode)[]
|
|
28
28
|
/** 行樣式類名 */
|
|
29
29
|
baseTableRowClassName?: (data: { row: T; rowIndex: number }) => string
|
|
30
|
-
/**
|
|
31
|
-
|
|
30
|
+
/** 是否顯示查看按鈕 */
|
|
31
|
+
showCheckBtn?: boolean
|
|
32
|
+
/** 是否顯示編輯按鈕 */
|
|
33
|
+
showEditBtn?: boolean
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
/** BaseTable 組件 Emits 類型 */
|
|
@@ -80,8 +82,10 @@ export interface SortTableProps<T extends Record<string, unknown> = Record<strin
|
|
|
80
82
|
}) => (string | import('vue').VNode)[]
|
|
81
83
|
/** 行樣式類名 */
|
|
82
84
|
sortTableRowClassName?: (data: { row: T; rowIndex: number }) => string
|
|
83
|
-
/**
|
|
84
|
-
|
|
85
|
+
/** 是否顯示查看按鈕 */
|
|
86
|
+
showCheckBtn?: boolean
|
|
87
|
+
/** 是否顯示編輯按鈕 */
|
|
88
|
+
showEditBtn?: boolean
|
|
85
89
|
}
|
|
86
90
|
|
|
87
91
|
/** SortTable 組件 Emits 類型 */
|
|
@@ -137,8 +141,10 @@ export interface TitleTableProps<T extends Record<string, unknown> = Record<stri
|
|
|
137
141
|
columns: import('element-plus').TableColumnCtx<Record<string, unknown>>[]
|
|
138
142
|
data: T[]
|
|
139
143
|
}) => (string | import('vue').VNode)[]
|
|
140
|
-
/**
|
|
141
|
-
|
|
144
|
+
/** 是否顯示查看按鈕 */
|
|
145
|
+
showCheckBtn?: boolean
|
|
146
|
+
/** 是否顯示編輯按鈕 */
|
|
147
|
+
showEditBtn?: boolean
|
|
142
148
|
}
|
|
143
149
|
|
|
144
150
|
/** TitleTable 組件 Emits 類型 */
|