rayyy-vue-table-components 1.0.29 → 1.0.31
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.d.ts +2 -2
- package/dist/index.es.js +10566 -12979
- package/dist/index.umd.js +18 -0
- package/dist/rayyy-vue-table-components.css +1 -202
- package/dist/src/components/SearchBar.vue.d.ts +2 -2
- package/dist/src/components/index.d.ts +0 -4
- package/dist/src/global.d.ts +18 -0
- package/dist/src/index.d.ts +13381 -97
- package/dist/src/types/components.d.ts +210 -0
- package/package.json +2 -13
- package/src/components/index.ts +0 -4
- package/src/components/items/FilterBtn.vue +2 -2
- package/src/components/transfer/TransferDialog.vue +2 -2
- package/dist/index.es.js.map +0 -1
- package/dist/index.umd.cjs +0 -13245
- package/dist/index.umd.cjs.map +0 -1
- package/dist/src/components/transfer/TransferDialog.vue.d.ts +0 -24
- package/dist/src/components/transfer/transferItem.vue.d.ts +0 -29
- package/src/utils/tableHelper.ts +0 -8
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { App, DefineComponent, VNode } from 'vue';
|
|
2
|
+
import { TableColumnCtx } from 'element-plus';
|
|
3
|
+
import { SortChangValue, TableColumn } from './index';
|
|
4
|
+
// ==================== BaseTable 組件類型 ====================
|
|
5
|
+
|
|
6
|
+
/** BaseTable 組件 Props 類型 */
|
|
7
|
+
export interface BaseTableProps<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
8
|
+
/** 是否顯示加載狀態 */
|
|
9
|
+
loading?: boolean
|
|
10
|
+
/** 表格數據 */
|
|
11
|
+
data: T[]
|
|
12
|
+
/** 表格列配置 */
|
|
13
|
+
columns: TableColumn<T>[]
|
|
14
|
+
/** 是否顯示選擇列 */
|
|
15
|
+
showSelection?: boolean
|
|
16
|
+
/** 是否顯示匯總行 */
|
|
17
|
+
showSummary?: boolean
|
|
18
|
+
/** 是否顯示溢出提示 */
|
|
19
|
+
showOverFlowTooltip?: boolean
|
|
20
|
+
/** 匯總方法 */
|
|
21
|
+
summaryMethod?: (param: {
|
|
22
|
+
columns: TableColumnCtx<Record<string, unknown>>[];
|
|
23
|
+
data: T[]
|
|
24
|
+
}) => (string | VNode)[]
|
|
25
|
+
/** 行樣式類名 */
|
|
26
|
+
baseTableRowClassName?: (data: { row: T; rowIndex: number }) => string
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** BaseTable 組件 Emits 類型 */
|
|
30
|
+
export interface BaseTableEmits<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
31
|
+
/** 選擇變更事件 */
|
|
32
|
+
'selection-change': (selection: T[]) => void
|
|
33
|
+
/** 當前行變更事件 */
|
|
34
|
+
'current-change': (currentRow: T) => void
|
|
35
|
+
/** 單元格點擊事件 */
|
|
36
|
+
'cell-click': (column: TableColumn<T>, row: T) => void
|
|
37
|
+
/** 列排序變更事件 */
|
|
38
|
+
'column-sort-change': (value: SortChangValue<T>) => void
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** BaseTable 組件實例類型 */
|
|
42
|
+
export interface BaseTableInstance<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
43
|
+
/** 組件 Props */
|
|
44
|
+
$props: BaseTableProps<T>
|
|
45
|
+
/** 組件 Emits */
|
|
46
|
+
$emit: BaseTableEmits<T>
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// ==================== BaseBtn 組件類型 ====================
|
|
50
|
+
|
|
51
|
+
/** BaseBtn 組件 Props 類型 */
|
|
52
|
+
export interface BaseBtnProps {
|
|
53
|
+
/** 按鈕文字 */
|
|
54
|
+
text?: string
|
|
55
|
+
/** 按鈕類型 */
|
|
56
|
+
type?: 'default' | 'primary' | 'success' | 'warning' | 'info' | 'danger'
|
|
57
|
+
/** 按鈕尺寸 */
|
|
58
|
+
size?: 'default' | 'small' | 'large'
|
|
59
|
+
/** 是否為樸素按鈕 */
|
|
60
|
+
plain?: boolean
|
|
61
|
+
/** 自定義 CSS 類名 */
|
|
62
|
+
class?: string
|
|
63
|
+
/** 是否禁用 */
|
|
64
|
+
disabled?: boolean
|
|
65
|
+
/** 是否為文字按鈕 */
|
|
66
|
+
textBtn?: boolean
|
|
67
|
+
/** 圖標 */
|
|
68
|
+
icon?: object
|
|
69
|
+
/** 是否為鏈接按鈕 */
|
|
70
|
+
link?: boolean
|
|
71
|
+
/** 是否填充樣式 */
|
|
72
|
+
isFill?: boolean
|
|
73
|
+
/** 是否顯示加載狀態 */
|
|
74
|
+
loading?: boolean
|
|
75
|
+
/** 測試屬性 */
|
|
76
|
+
dataCy?: string
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** BaseBtn 組件 Emits 類型 */
|
|
80
|
+
export interface BaseBtnEmits {
|
|
81
|
+
/** 點擊事件 */
|
|
82
|
+
(e: 'click', evt: MouseEvent): void
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** BaseBtn 組件實例類型 */
|
|
86
|
+
export interface BaseBtnInstance {
|
|
87
|
+
/** 組件 Props */
|
|
88
|
+
$props: BaseBtnProps
|
|
89
|
+
/** 組件 Emits */
|
|
90
|
+
$emit: BaseBtnEmits
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// ==================== BaseDialog 組件類型 ====================
|
|
94
|
+
|
|
95
|
+
/** BaseDialog 組件 Props 類型 */
|
|
96
|
+
export interface BaseDialogProps {
|
|
97
|
+
/** 是否顯示對話框 */
|
|
98
|
+
modelValue: boolean
|
|
99
|
+
/** 對話框標題 */
|
|
100
|
+
title?: string
|
|
101
|
+
/** 副標題 */
|
|
102
|
+
subTitle?: string
|
|
103
|
+
/** 關閉前回調 */
|
|
104
|
+
beforeClose?: () => void
|
|
105
|
+
/** 自定義寬度 */
|
|
106
|
+
customWidth?: string
|
|
107
|
+
/** 是否為警告對話框 */
|
|
108
|
+
isWaring?: boolean
|
|
109
|
+
/** 是否為主要對話框 */
|
|
110
|
+
isPrimary?: boolean
|
|
111
|
+
/** 內容區域加載狀態 */
|
|
112
|
+
bodyLoading?: boolean
|
|
113
|
+
/** 提交按鈕加載狀態 */
|
|
114
|
+
submitLoading?: boolean
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** BaseDialog 組件 Emits 類型 */
|
|
118
|
+
export interface BaseDialogEmits {
|
|
119
|
+
/** 更新 modelValue */
|
|
120
|
+
(e: 'update:modelValue', data: boolean): void
|
|
121
|
+
/** 提交按鈕點擊事件 */
|
|
122
|
+
(e: 'click:submit'): void
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** BaseDialog 組件實例類型 */
|
|
126
|
+
export interface BaseDialogInstance {
|
|
127
|
+
/** 組件 Props */
|
|
128
|
+
$props: BaseDialogProps
|
|
129
|
+
/** 組件 Emits */
|
|
130
|
+
$emit: BaseDialogEmits
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// ==================== 組件定義類型 ====================
|
|
134
|
+
|
|
135
|
+
/** BaseTable 組件定義 */
|
|
136
|
+
export declare const BaseTable: DefineComponent<
|
|
137
|
+
BaseTableProps<any>,
|
|
138
|
+
{},
|
|
139
|
+
{},
|
|
140
|
+
{},
|
|
141
|
+
{},
|
|
142
|
+
{},
|
|
143
|
+
{},
|
|
144
|
+
BaseTableEmits<any>
|
|
145
|
+
> & {
|
|
146
|
+
/** 安裝方法 */
|
|
147
|
+
install: (app: App) => void
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** BaseBtn 組件定義 */
|
|
151
|
+
export declare const BaseBtn: DefineComponent<
|
|
152
|
+
BaseBtnProps,
|
|
153
|
+
{},
|
|
154
|
+
{},
|
|
155
|
+
{},
|
|
156
|
+
{},
|
|
157
|
+
{},
|
|
158
|
+
{},
|
|
159
|
+
BaseBtnEmits
|
|
160
|
+
> & {
|
|
161
|
+
/** 安裝方法 */
|
|
162
|
+
install: (app: App) => void
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** BaseDialog 組件定義 */
|
|
166
|
+
export declare const BaseDialog: DefineComponent<
|
|
167
|
+
BaseDialogProps,
|
|
168
|
+
{},
|
|
169
|
+
{},
|
|
170
|
+
{},
|
|
171
|
+
{},
|
|
172
|
+
{},
|
|
173
|
+
{},
|
|
174
|
+
BaseDialogEmits
|
|
175
|
+
> & {
|
|
176
|
+
/** 安裝方法 */
|
|
177
|
+
install: (app: App) => void
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// ==================== 插件類型 ====================
|
|
181
|
+
|
|
182
|
+
/** 插件安裝選項 */
|
|
183
|
+
export interface PluginOptions {
|
|
184
|
+
/** 是否自動導入樣式 */
|
|
185
|
+
autoImportStyles?: boolean
|
|
186
|
+
/** 自定義前綴 */
|
|
187
|
+
prefix?: string
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/** 插件實例類型 */
|
|
191
|
+
export interface VueTableComponentsPlugin {
|
|
192
|
+
/** 安裝方法 */
|
|
193
|
+
install: (app: App, options?: PluginOptions) => void
|
|
194
|
+
/** BaseTable 組件 */
|
|
195
|
+
BaseTable: typeof BaseTable
|
|
196
|
+
/** BaseBtn 組件 */
|
|
197
|
+
BaseBtn: typeof BaseBtn
|
|
198
|
+
/** BaseDialog 組件 */
|
|
199
|
+
BaseDialog: typeof BaseDialog
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// ==================== 全局類型擴展 ====================
|
|
203
|
+
|
|
204
|
+
declare module '@vue/runtime-core' {
|
|
205
|
+
export interface GlobalComponents {
|
|
206
|
+
BaseTable: typeof BaseTable
|
|
207
|
+
BaseBtn: typeof BaseBtn
|
|
208
|
+
BaseDialog: typeof BaseDialog
|
|
209
|
+
}
|
|
210
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rayyy-vue-table-components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.31",
|
|
4
4
|
"description": "Vue 3 + Element Plus 表格組件庫",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.umd.js",
|
|
@@ -24,10 +24,6 @@
|
|
|
24
24
|
"./types/components": {
|
|
25
25
|
"types": "./src/types/components.d.ts",
|
|
26
26
|
"import": "./src/types/components.d.ts"
|
|
27
|
-
},
|
|
28
|
-
"./utils": {
|
|
29
|
-
"types": "./src/utils/tableHelper.ts",
|
|
30
|
-
"import": "./src/utils/tableHelper.ts"
|
|
31
27
|
}
|
|
32
28
|
},
|
|
33
29
|
"files": [
|
|
@@ -36,7 +32,6 @@
|
|
|
36
32
|
"src/components/index.ts",
|
|
37
33
|
"src/types/*",
|
|
38
34
|
"src/types/components.d.ts",
|
|
39
|
-
"src/utils/*",
|
|
40
35
|
"README.md"
|
|
41
36
|
],
|
|
42
37
|
"keywords": [
|
|
@@ -80,11 +75,6 @@
|
|
|
80
75
|
"element-plus": "^2.0.0",
|
|
81
76
|
"vue": "^3.0.0"
|
|
82
77
|
},
|
|
83
|
-
"peerDependenciesMeta": {
|
|
84
|
-
"vue": {
|
|
85
|
-
"optional": false
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
78
|
"devDependencies": {
|
|
89
79
|
"@tsconfig/node22": "^22.0.0",
|
|
90
80
|
"@types/jsdom": "^21.1.7",
|
|
@@ -109,7 +99,6 @@
|
|
|
109
99
|
"postcss": "^8.5.3",
|
|
110
100
|
"postcss-import": "^16.1.0",
|
|
111
101
|
"prettier": "3.5.3",
|
|
112
|
-
"rollup-plugin-external-globals": "^0.13.0",
|
|
113
102
|
"sass-embedded": "^1.86.0",
|
|
114
103
|
"start-server-and-test": "^2.0.10",
|
|
115
104
|
"tailwindcss": "^3.4.17",
|
|
@@ -125,6 +114,6 @@
|
|
|
125
114
|
"vue-tsc": "^2.2.8"
|
|
126
115
|
},
|
|
127
116
|
"dependencies": {
|
|
128
|
-
"vuedraggable": "^
|
|
117
|
+
"vuedraggable": "^2.24.3"
|
|
129
118
|
}
|
|
130
119
|
}
|
package/src/components/index.ts
CHANGED
|
@@ -4,8 +4,6 @@ export { default as BaseBtn } from './items/BaseBtn.vue'
|
|
|
4
4
|
export { default as BaseDialog } from './BaseDialog.vue'
|
|
5
5
|
export { default as SortTable } from './tables/SortTable.vue'
|
|
6
6
|
export { default as SearchBar } from './SearchBar.vue'
|
|
7
|
-
export { default as TransferDialog } from './transfer/TransferDialog.vue'
|
|
8
|
-
export { default as TransferItem } from './transfer/transferItem.vue'
|
|
9
7
|
|
|
10
8
|
// 導出組件類型
|
|
11
9
|
export type {
|
|
@@ -28,5 +26,3 @@ export type { default as BaseBtnType } from './items/BaseBtn.vue'
|
|
|
28
26
|
export type { default as BaseDialogType } from './BaseDialog.vue'
|
|
29
27
|
export type { default as SortTableType } from './tables/SortTable.vue'
|
|
30
28
|
export type { default as SearchBarType } from './SearchBar.vue'
|
|
31
|
-
export type { default as TransferDialogType } from './transfer/TransferDialog.vue'
|
|
32
|
-
export type { default as TransferItemType } from './transfer/transferItem.vue'
|
|
@@ -47,7 +47,7 @@ const submitFilter = () => {
|
|
|
47
47
|
</template>
|
|
48
48
|
|
|
49
49
|
<div class="flex justify-between items-center pb-5 font-semibold">
|
|
50
|
-
<div class="text-base
|
|
50
|
+
<div class="text-base">篩選條件</div>
|
|
51
51
|
<div class="text-base text-primary cursor-pointer" @click="resetValue">重置</div>
|
|
52
52
|
</div>
|
|
53
53
|
|
|
@@ -66,7 +66,7 @@ const submitFilter = () => {
|
|
|
66
66
|
.filter-btn {
|
|
67
67
|
@apply text-sky-800;
|
|
68
68
|
p {
|
|
69
|
-
@apply ml-2 font-bold;
|
|
69
|
+
@apply text-black ml-2 font-bold;
|
|
70
70
|
}
|
|
71
71
|
i {
|
|
72
72
|
@apply text-xl;
|
|
@@ -5,8 +5,8 @@ import draggable from 'vuedraggable'
|
|
|
5
5
|
import _ from 'lodash'
|
|
6
6
|
import type { CheckboxValueType } from 'element-plus'
|
|
7
7
|
import BaseDialog from '@/components/BaseDialog.vue'
|
|
8
|
-
import SearchBar from '@/components/SearchBar.vue'
|
|
9
8
|
import TransferItem from '@/components/transfer/transferItem.vue'
|
|
9
|
+
import SearchBar from '@/components/SearchBar.vue'
|
|
10
10
|
|
|
11
11
|
const props = defineProps<{
|
|
12
12
|
modelValue: boolean
|
|
@@ -110,7 +110,7 @@ const resetFilterColumn = () => {
|
|
|
110
110
|
const doFilterColumn = (keyword: string) => {
|
|
111
111
|
if (keyword.length > 0) {
|
|
112
112
|
const cloneList = _.cloneDeep(state.localColumns)
|
|
113
|
-
state.localColumns = cloneList.filter((item
|
|
113
|
+
state.localColumns = cloneList.filter((item) => item.label.includes(keyword))
|
|
114
114
|
} else {
|
|
115
115
|
resetFilterColumn()
|
|
116
116
|
}
|