rayyy-vue-table-components 1.3.1 → 1.3.3
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 +3830 -3761
- package/dist/index.umd.js +12 -12
- package/dist/rayyy-vue-table-components.css +1 -1
- package/dist/src/components/index.d.ts +3 -1
- package/dist/src/components/tables/SortTable.vue.d.ts +3 -3
- package/dist/src/components/tables/TitleTable.vue.d.ts +42 -0
- package/dist/src/components/transfer/TransferDialog.vue.d.ts +9 -1
- package/dist/src/index.d.ts +2 -1
- package/dist/src/router/constants.d.ts +2 -2
- package/dist/src/types/components.d.ts +65 -0
- package/package.json +1 -1
- package/src/assets/styles/_components.scss +13 -46
- package/src/components/form/BaseInput.vue +3 -1
- package/src/components/index.ts +6 -0
- package/src/components/transfer/TransferDialog.vue +24 -21
- package/src/types/components.d.ts +65 -0
- /package/dist/src/views/demo/{SortTableDemo.vue.d.ts → TableDemo.vue.d.ts} +0 -0
|
@@ -4,18 +4,20 @@ export { default as BaseInput } from './form/BaseInput.vue';
|
|
|
4
4
|
export { default as BaseDialog } from './items/BaseDialog.vue';
|
|
5
5
|
export { default as BaseMultipleInput } from './form/BaseMultipleInput.vue';
|
|
6
6
|
export { default as SortTable } from './tables/SortTable.vue';
|
|
7
|
+
export { default as TitleTable } from './tables/TitleTable.vue';
|
|
7
8
|
export { default as SearchBar } from './items/SearchBar.vue';
|
|
8
9
|
export { default as TransferDialog } from './transfer/TransferDialog.vue';
|
|
9
10
|
export { default as TransferItem } from './transfer/transferItem.vue';
|
|
10
11
|
export { default as FunctionHeader } from './layout/FunctionHeader.vue';
|
|
11
12
|
export { default as MainPanel } from './layout/MainPanel.vue';
|
|
12
13
|
export { default as SearchableListPanel } from './layout/SearchableListPanel.vue';
|
|
13
|
-
export type { BaseTableProps, BaseTableEmits, BaseTableInstance, BaseBtnProps, BaseBtnEmits, BaseBtnInstance, BaseDialogProps, BaseDialogEmits, BaseDialogInstance, BaseInputProps, BaseInputEmits, BaseInputInstance, SortTableProps, SortTableEmits, SortTableInstance, SearchBarProps, SearchBarEmits, SearchBarInstance, SearchBarSlots, TransferDialogProps, TransferDialogEmits, TransferDialogInstance, TransferItemProps, TransferItemEmits, TransferItemInstance, MainPanelProps, MainPanelEmits, MainPanelInstance, SearchableListPanelProps, SearchableListPanelEmits, SearchableListPanelInstance, SearchableListPanelSlots, FunctionHeaderProps, FunctionHeaderEmits, FunctionHeaderInstance, PluginOptions, VueTableComponentsPlugin } from '../types/components.d';
|
|
14
|
+
export type { BaseTableProps, BaseTableEmits, BaseTableInstance, BaseBtnProps, BaseBtnEmits, BaseBtnInstance, BaseDialogProps, BaseDialogEmits, BaseDialogInstance, BaseInputProps, BaseInputEmits, BaseInputInstance, SortTableProps, SortTableEmits, SortTableInstance, TitleTableProps, TitleTableEmits, TitleTableInstance, SearchBarProps, SearchBarEmits, SearchBarInstance, SearchBarSlots, TransferDialogProps, TransferDialogEmits, TransferDialogInstance, TransferItemProps, TransferItemEmits, TransferItemInstance, MainPanelProps, MainPanelEmits, MainPanelInstance, SearchableListPanelProps, SearchableListPanelEmits, SearchableListPanelInstance, SearchableListPanelSlots, FunctionHeaderProps, FunctionHeaderEmits, FunctionHeaderInstance, PluginOptions, VueTableComponentsPlugin } from '../types/components.d';
|
|
14
15
|
export type { default as BaseTableType } from './tables/BaseTable.vue';
|
|
15
16
|
export type { default as BaseBtnType } from './items/BaseBtn.vue';
|
|
16
17
|
export type { default as BaseInputType } from './form/BaseInput.vue';
|
|
17
18
|
export type { default as BaseDialogType } from './items/BaseDialog.vue';
|
|
18
19
|
export type { default as SortTableType } from './tables/SortTable.vue';
|
|
20
|
+
export type { default as TitleTableType } from './tables/TitleTable.vue';
|
|
19
21
|
export type { default as SearchBarType } from './items/SearchBar.vue';
|
|
20
22
|
export type { default as TransferDialogType } from './transfer/TransferDialog.vue';
|
|
21
23
|
export type { default as TransferItemType } from './transfer/transferItem.vue';
|
|
@@ -3,11 +3,11 @@ import { TableColumnCtx } from 'element-plus';
|
|
|
3
3
|
import { VNode } from 'vue';
|
|
4
4
|
declare const _default: <T extends Record<string, unknown>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
5
5
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
6
|
-
readonly "
|
|
6
|
+
readonly "onClick:cell"?: ((column: TableColumn<T>, row: T) => any) | undefined;
|
|
7
7
|
readonly "onUpdate:selectRow"?: ((value: T[]) => any) | undefined;
|
|
8
|
+
readonly "onOpen:transfer"?: (() => any) | undefined;
|
|
8
9
|
readonly "onClick:columnSort"?: ((data: SortChangValue<T>) => any) | undefined;
|
|
9
|
-
|
|
10
|
-
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onOpen:transfer" | "onUpdate:selectRow" | "onClick:columnSort" | "onClick:cell"> & {
|
|
10
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onClick:cell" | "onUpdate:selectRow" | "onOpen:transfer" | "onClick:columnSort"> & {
|
|
11
11
|
data: T[];
|
|
12
12
|
columns: TableColumn<T>[];
|
|
13
13
|
tableTitle?: string;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { VNode } from 'vue';
|
|
2
|
+
import { TableColumnCtx } from 'element-plus';
|
|
3
|
+
import { TableColumn } from 'src/types';
|
|
4
|
+
declare const _default: <T extends Record<string, unknown>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
5
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
6
|
+
readonly "onClick:add"?: (() => any) | undefined;
|
|
7
|
+
readonly "onClick:edit"?: (() => any) | undefined;
|
|
8
|
+
readonly "onClick:delete"?: (() => any) | undefined;
|
|
9
|
+
readonly "onClick:cell"?: ((column: TableColumn<T>, row: T) => any) | undefined;
|
|
10
|
+
readonly "onUpdate:selectRow"?: ((value: T[]) => any) | undefined;
|
|
11
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onClick:add" | "onClick:edit" | "onClick:delete" | "onClick:cell" | "onUpdate:selectRow"> & {
|
|
12
|
+
data: T[];
|
|
13
|
+
columns: TableColumn<T>[];
|
|
14
|
+
tableTitle?: string;
|
|
15
|
+
showSelection?: boolean;
|
|
16
|
+
loading?: boolean;
|
|
17
|
+
showSummary?: boolean;
|
|
18
|
+
showOverFlowTooltip?: boolean;
|
|
19
|
+
summaryMethod?: (param: {
|
|
20
|
+
columns: TableColumnCtx<Record<string, unknown>>[];
|
|
21
|
+
data: T[];
|
|
22
|
+
}) => (string | VNode)[];
|
|
23
|
+
} & Partial<{}>> & import('vue').PublicProps;
|
|
24
|
+
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
25
|
+
attrs: any;
|
|
26
|
+
slots: {
|
|
27
|
+
tableSearch?(_: {}): any;
|
|
28
|
+
};
|
|
29
|
+
emit: {
|
|
30
|
+
(e: "click:add"): void;
|
|
31
|
+
(e: "click:edit"): void;
|
|
32
|
+
(e: "click:delete"): void;
|
|
33
|
+
(e: "update:selectRow", value: T[]): void;
|
|
34
|
+
(e: "click:cell", column: TableColumn<T>, row: T): void;
|
|
35
|
+
};
|
|
36
|
+
}>) => import('vue').VNode & {
|
|
37
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
38
|
+
};
|
|
39
|
+
export default _default;
|
|
40
|
+
type __VLS_PrettifyLocal<T> = {
|
|
41
|
+
[K in keyof T]: T[K];
|
|
42
|
+
} & {};
|
|
@@ -3,7 +3,11 @@ declare const _default: <T = Record<string, unknown>>(__VLS_props: NonNullable<A
|
|
|
3
3
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
4
4
|
readonly "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
5
5
|
readonly "onUpdate:submit"?: ((data: TableColumn<T>[]) => any) | undefined;
|
|
6
|
-
|
|
6
|
+
readonly "onUpdate:checkChange"?: ((data: {
|
|
7
|
+
columns: TableColumn<T>[];
|
|
8
|
+
checkList: string[];
|
|
9
|
+
}) => any) | undefined;
|
|
10
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onUpdate:modelValue" | "onUpdate:submit" | "onUpdate:checkChange"> & {
|
|
7
11
|
modelValue: boolean;
|
|
8
12
|
columnsValue: TableColumn<T>[];
|
|
9
13
|
transferTitle: string;
|
|
@@ -39,6 +43,10 @@ declare const _default: <T = Record<string, unknown>>(__VLS_props: NonNullable<A
|
|
|
39
43
|
emit: {
|
|
40
44
|
(e: "update:modelValue", value: boolean): void;
|
|
41
45
|
(e: "update:submit", data: TableColumn<T>[]): void;
|
|
46
|
+
(e: "update:checkChange", data: {
|
|
47
|
+
columns: TableColumn<T>[];
|
|
48
|
+
checkList: string[];
|
|
49
|
+
}): void;
|
|
42
50
|
};
|
|
43
51
|
}>) => import('vue').VNode & {
|
|
44
52
|
__ctx?: Awaited<typeof __VLS_setup>;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -4,10 +4,11 @@ import { default as BaseBtn } from './components/items/BaseBtn.vue';
|
|
|
4
4
|
import { default as BaseInput } from './components/form/BaseInput.vue';
|
|
5
5
|
import { default as BaseDialog } from './components/items/BaseDialog.vue';
|
|
6
6
|
import { default as SortTable } from './components/tables/SortTable.vue';
|
|
7
|
+
import { default as TitleTable } from './components/tables/TitleTable.vue';
|
|
7
8
|
import { default as SearchBar } from './components/items/SearchBar.vue';
|
|
8
9
|
export * from './types';
|
|
9
10
|
export * from './utils/tableHelper';
|
|
10
|
-
export { BaseTable, BaseBtn, BaseInput, BaseDialog, SortTable, SearchBar };
|
|
11
|
+
export { BaseTable, BaseBtn, BaseInput, BaseDialog, SortTable, TitleTable, SearchBar };
|
|
11
12
|
export type { BaseTableProps, BaseTableEmits, BaseTableInstance, BaseBtnProps, BaseBtnEmits, BaseBtnInstance, BaseDialogProps, BaseDialogEmits, BaseDialogInstance, PluginOptions, VueTableComponentsPlugin, } from './types/components';
|
|
12
13
|
export * from './components';
|
|
13
14
|
export declare function install(app: App, options?: {
|
|
@@ -12,7 +12,7 @@ export declare const ROUTES: {
|
|
|
12
12
|
readonly BASE_INPUT: "/demo/base-input";
|
|
13
13
|
readonly BASE_DIALOG: "/demo/base-dialog";
|
|
14
14
|
readonly BASE_FORM: "/demo/base-form";
|
|
15
|
-
readonly
|
|
15
|
+
readonly TABLE: "/demo/table";
|
|
16
16
|
readonly SEARCH_BAR: "/demo/search-bar";
|
|
17
17
|
readonly FUNCTION_HEADER: "/demo/function-header";
|
|
18
18
|
readonly MAIN_PANEL: "/demo/main-panel";
|
|
@@ -31,7 +31,7 @@ export declare const ROUTE_NAMES: {
|
|
|
31
31
|
readonly BASE_BTN: "BaseBtn";
|
|
32
32
|
readonly BASE_INPUT: "BaseInput";
|
|
33
33
|
readonly BASE_DIALOG: "BaseDialog";
|
|
34
|
-
readonly
|
|
34
|
+
readonly TABLE: "Table";
|
|
35
35
|
readonly SEARCH_BAR: "SearchBar";
|
|
36
36
|
readonly FUNCTION_HEADER: "FunctionHeader";
|
|
37
37
|
readonly MAIN_PANEL: "MainPanel";
|
|
@@ -92,6 +92,50 @@ export interface SortTableInstance<T extends Record<string, unknown> = Record<st
|
|
|
92
92
|
$emit: SortTableEmits<T>
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
// ==================== TitleTable 組件類型 ====================
|
|
96
|
+
|
|
97
|
+
/** TitleTable 組件 Props 類型 */
|
|
98
|
+
export interface TitleTableProps<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
99
|
+
/** 表格數據 */
|
|
100
|
+
data: T[]
|
|
101
|
+
/** 表格列配置 */
|
|
102
|
+
columns: import('./index').TableColumn<T>[]
|
|
103
|
+
/** 表格標題 */
|
|
104
|
+
tableTitle?: string
|
|
105
|
+
/** 是否顯示選擇列 */
|
|
106
|
+
showSelection?: boolean
|
|
107
|
+
/** 是否顯示加載狀態 */
|
|
108
|
+
loading?: boolean
|
|
109
|
+
/** 是否顯示匯總行 */
|
|
110
|
+
showSummary?: boolean
|
|
111
|
+
/** 是否顯示溢出提示 */
|
|
112
|
+
showOverFlowTooltip?: boolean
|
|
113
|
+
/** 匯總方法 */
|
|
114
|
+
summaryMethod?: (param: { columns: import('element-plus').TableColumnCtx<Record<string, unknown>>[]; data: T[] }) => (string | import('vue').VNode)[]
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** TitleTable 組件 Emits 類型 */
|
|
118
|
+
export interface TitleTableEmits<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
119
|
+
/** 新增按鈕點擊事件 */
|
|
120
|
+
(e: 'click:add'): void
|
|
121
|
+
/** 編輯按鈕點擊事件 */
|
|
122
|
+
(e: 'click:edit'): void
|
|
123
|
+
/** 刪除按鈕點擊事件 */
|
|
124
|
+
(e: 'click:delete'): void
|
|
125
|
+
/** 更新選擇行事件 */
|
|
126
|
+
(e: 'update:selectRow', value: T[]): void
|
|
127
|
+
/** 單元格點擊事件 */
|
|
128
|
+
(e: 'click:cell', column: import('./index').TableColumn<T>, row: T): void
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** TitleTable 組件實例類型 */
|
|
132
|
+
export interface TitleTableInstance<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
133
|
+
/** 組件 Props */
|
|
134
|
+
$props: TitleTableProps<T>
|
|
135
|
+
/** 組件 Emits */
|
|
136
|
+
$emit: TitleTableEmits<T>
|
|
137
|
+
}
|
|
138
|
+
|
|
95
139
|
// ==================== 按鈕相關組件類型 ====================
|
|
96
140
|
|
|
97
141
|
// ==================== BaseBtn 組件類型 ====================
|
|
@@ -197,6 +241,8 @@ export interface TransferDialogEmits<T = Record<string, unknown>> {
|
|
|
197
241
|
(e: 'update:modelValue', value: boolean): void
|
|
198
242
|
/** 提交事件 */
|
|
199
243
|
(e: 'update:submit', data: import('./index').TableColumn<T>[]): void
|
|
244
|
+
/** checkbox 狀態變更事件 */
|
|
245
|
+
(e: 'update:checkChange', data: { columns: import('./index').TableColumn<T>[], checkList: string[] }): void
|
|
200
246
|
}
|
|
201
247
|
|
|
202
248
|
/** TransferDialog 組件實例類型 */
|
|
@@ -496,6 +542,22 @@ export declare const SortTable: DefineComponent<
|
|
|
496
542
|
install: (app: App) => void
|
|
497
543
|
}
|
|
498
544
|
|
|
545
|
+
/** TitleTable 組件定義 */
|
|
546
|
+
export declare const TitleTable: DefineComponent<
|
|
547
|
+
TitleTableProps<any>,
|
|
548
|
+
{},
|
|
549
|
+
{},
|
|
550
|
+
{},
|
|
551
|
+
{},
|
|
552
|
+
{},
|
|
553
|
+
{},
|
|
554
|
+
{},
|
|
555
|
+
TitleTableEmits<any>
|
|
556
|
+
> & {
|
|
557
|
+
/** 安裝方法 */
|
|
558
|
+
install: (app: App) => void
|
|
559
|
+
}
|
|
560
|
+
|
|
499
561
|
/** BaseBtn 組件定義 */
|
|
500
562
|
export declare const BaseBtn: DefineComponent<
|
|
501
563
|
BaseBtnProps,
|
|
@@ -676,6 +738,8 @@ export interface VueTableComponentsPlugin {
|
|
|
676
738
|
BaseTable: typeof BaseTable
|
|
677
739
|
/** SortTable 組件 */
|
|
678
740
|
SortTable: typeof SortTable
|
|
741
|
+
/** TitleTable 組件 */
|
|
742
|
+
TitleTable: typeof TitleTable
|
|
679
743
|
/** BaseBtn 組件 */
|
|
680
744
|
BaseBtn: typeof BaseBtn
|
|
681
745
|
/** BaseDialog 組件 */
|
|
@@ -704,6 +768,7 @@ declare module '@vue/runtime-core' {
|
|
|
704
768
|
export interface GlobalComponents {
|
|
705
769
|
BaseTable: typeof BaseTable
|
|
706
770
|
SortTable: typeof SortTable
|
|
771
|
+
TitleTable: typeof TitleTable
|
|
707
772
|
BaseBtn: typeof BaseBtn
|
|
708
773
|
BaseDialog: typeof BaseDialog
|
|
709
774
|
TransferDialog: typeof TransferDialog
|
package/package.json
CHANGED
|
@@ -19,63 +19,30 @@
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
// ==================== TransferItem 組件樣式 ====================
|
|
23
|
-
.transfer-item-wrapper {
|
|
24
|
-
@apply border-t border-gray-200 px-4 flex items-center justify-between w-full;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.transfer-arrow-wrapper {
|
|
28
|
-
@apply w-28 text-primary-10;
|
|
29
|
-
}
|
|
30
22
|
|
|
31
23
|
// ==================== TransferDialog 組件樣式 ====================
|
|
32
24
|
.transfer-sort-wrapper {
|
|
33
|
-
@apply border border-gray-200
|
|
25
|
+
@apply border-2 border-gray-200 border-solid;
|
|
26
|
+
@apply h-96 overflow-auto;
|
|
34
27
|
}
|
|
35
28
|
|
|
36
29
|
.transfer-active-bg {
|
|
37
|
-
|
|
30
|
+
@apply bg-primary/10;
|
|
38
31
|
}
|
|
39
32
|
|
|
40
33
|
.transfer-active-border {
|
|
41
|
-
@apply border border-
|
|
34
|
+
@apply border rounded border-solid;
|
|
35
|
+
@apply border-blue-10;
|
|
42
36
|
}
|
|
43
37
|
|
|
44
|
-
// ==================== 組件樣式配置 ====================
|
|
45
|
-
.component-styles {
|
|
46
|
-
// SortTable
|
|
47
|
-
.sort-table-container {
|
|
48
|
-
@apply w-full mb-4;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.sort-table-function-bar {
|
|
52
|
-
@apply flex items-center h-12 bg-primary-20 px-1.5 rounded-t justify-end;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.sort-table-settings-btn {
|
|
56
|
-
@apply cursor-pointer text-primary-dark text-xl flex items-center justify-center;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
38
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
.transfer-active-bg {
|
|
66
|
-
background-color: rgba(103, 133, 193, 0.1);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.transfer-active-border {
|
|
70
|
-
@apply border border-primary-10 rounded;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// TransferItem
|
|
74
|
-
.transfer-item-wrapper {
|
|
75
|
-
@apply border-t border-gray-200 px-4 flex items-center justify-between w-full;
|
|
76
|
-
}
|
|
39
|
+
// ==================== TransferItem 組件樣式 ====================
|
|
40
|
+
.transfer-item-wrapper {
|
|
41
|
+
@apply border-t px-4;
|
|
42
|
+
@apply flex items-center justify-between w-full;
|
|
43
|
+
}
|
|
77
44
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
45
|
+
.transfer-arrow-wrapper {
|
|
46
|
+
@apply w-28;
|
|
47
|
+
@apply text-blue-10;
|
|
81
48
|
}
|
|
@@ -48,7 +48,9 @@ const handlerClear = () => {
|
|
|
48
48
|
@clear="handlerClear"
|
|
49
49
|
>
|
|
50
50
|
<template #prefix>
|
|
51
|
-
<
|
|
51
|
+
<div class="text-text-border w-full h-full flex items-center justify-center text-lg">
|
|
52
|
+
<el-icon><Search /></el-icon>
|
|
53
|
+
</div>
|
|
52
54
|
</template>
|
|
53
55
|
</el-input>
|
|
54
56
|
</template>
|
package/src/components/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ export { default as BaseInput } from './form/BaseInput.vue'
|
|
|
5
5
|
export { default as BaseDialog } from './items/BaseDialog.vue'
|
|
6
6
|
export { default as BaseMultipleInput } from './form/BaseMultipleInput.vue'
|
|
7
7
|
export { default as SortTable } from './tables/SortTable.vue'
|
|
8
|
+
export { default as TitleTable } from './tables/TitleTable.vue'
|
|
8
9
|
export { default as SearchBar } from './items/SearchBar.vue'
|
|
9
10
|
export { default as TransferDialog } from './transfer/TransferDialog.vue'
|
|
10
11
|
export { default as TransferItem } from './transfer/transferItem.vue'
|
|
@@ -34,6 +35,10 @@ export type {
|
|
|
34
35
|
SortTableProps,
|
|
35
36
|
SortTableEmits,
|
|
36
37
|
SortTableInstance,
|
|
38
|
+
// TitleTable 組件類型
|
|
39
|
+
TitleTableProps,
|
|
40
|
+
TitleTableEmits,
|
|
41
|
+
TitleTableInstance,
|
|
37
42
|
// SearchBar 組件類型
|
|
38
43
|
SearchBarProps,
|
|
39
44
|
SearchBarEmits,
|
|
@@ -71,6 +76,7 @@ export type { default as BaseBtnType } from './items/BaseBtn.vue'
|
|
|
71
76
|
export type { default as BaseInputType } from './form/BaseInput.vue'
|
|
72
77
|
export type { default as BaseDialogType } from './items/BaseDialog.vue'
|
|
73
78
|
export type { default as SortTableType } from './tables/SortTable.vue'
|
|
79
|
+
export type { default as TitleTableType } from './tables/TitleTable.vue'
|
|
74
80
|
export type { default as SearchBarType } from './items/SearchBar.vue'
|
|
75
81
|
export type { default as TransferDialogType } from './transfer/TransferDialog.vue'
|
|
76
82
|
export type { default as TransferItemType } from './transfer/transferItem.vue'
|
|
@@ -16,6 +16,7 @@ const props = defineProps<{
|
|
|
16
16
|
const emit = defineEmits<{
|
|
17
17
|
(e: 'update:modelValue', value: boolean): void
|
|
18
18
|
(e: 'update:submit', data: TableColumn<T>[]): void
|
|
19
|
+
(e: 'update:checkChange', data: { columns: TableColumn<T>[]; checkList: string[] }): void
|
|
19
20
|
}>()
|
|
20
21
|
|
|
21
22
|
const dialogVisible = computed({
|
|
@@ -81,6 +82,7 @@ watch(
|
|
|
81
82
|
},
|
|
82
83
|
)
|
|
83
84
|
const handlerSubmit = () => {
|
|
85
|
+
console.log('state.localColumns', state.localColumns)
|
|
84
86
|
emit('update:submit', state.localColumns)
|
|
85
87
|
}
|
|
86
88
|
|
|
@@ -94,6 +96,11 @@ const handleCheckChange = (val: CheckboxValueType[]) => {
|
|
|
94
96
|
state.localColumns.forEach((column) => {
|
|
95
97
|
column.checkActive = stringValues.includes(column.prop as string)
|
|
96
98
|
})
|
|
99
|
+
// 即時 emit checkbox 狀態變更
|
|
100
|
+
emit('update:checkChange', {
|
|
101
|
+
columns: state.localColumns,
|
|
102
|
+
checkList: state.checkList,
|
|
103
|
+
})
|
|
97
104
|
}
|
|
98
105
|
|
|
99
106
|
const isAllChecked = computed(() => {
|
|
@@ -121,9 +128,7 @@ const doFilterColumn = (keyword: string) => {
|
|
|
121
128
|
<base-dialog v-model="dialogVisible" :title="transferTitle" @click:submit="handlerSubmit">
|
|
122
129
|
<div class="search-bar">
|
|
123
130
|
<search-bar
|
|
124
|
-
:show-filter="false"
|
|
125
131
|
:show-search="true"
|
|
126
|
-
:full-input="true"
|
|
127
132
|
@update:clear="resetFilterColumn"
|
|
128
133
|
@keydown:enter="doFilterColumn"
|
|
129
134
|
/>
|
|
@@ -142,25 +147,23 @@ const doFilterColumn = (keyword: string) => {
|
|
|
142
147
|
:handle-mousedown="(prop: string) => (state.clickItemProp = prop)"
|
|
143
148
|
>
|
|
144
149
|
<!-- 默認的靜態列表 -->
|
|
145
|
-
<
|
|
146
|
-
<
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
:
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
</template>
|
|
163
|
-
</div>
|
|
150
|
+
<template v-for="(element, index) in state.localColumns" :key="element.prop">
|
|
151
|
+
<transfer-item
|
|
152
|
+
:dialog-modal-visible="dialogVisible"
|
|
153
|
+
:columns-value="element"
|
|
154
|
+
:columns-index="index"
|
|
155
|
+
:columns-len="state.localColumns.length"
|
|
156
|
+
:class="{
|
|
157
|
+
'transfer-active-bg': element.checkActive,
|
|
158
|
+
'transfer-active-border': state.clickItemProp == element.prop,
|
|
159
|
+
}"
|
|
160
|
+
@mousedown="state.clickItemProp = element.prop || ''"
|
|
161
|
+
@update:toTop="handleItemEvents.toTop(index)"
|
|
162
|
+
@update:toBottom="handleItemEvents.toBottom(index)"
|
|
163
|
+
@update:toPre="handleItemEvents.toPre(index)"
|
|
164
|
+
@update:toNext="handleItemEvents.toNext(index)"
|
|
165
|
+
/>
|
|
166
|
+
</template>
|
|
164
167
|
</slot>
|
|
165
168
|
</el-checkbox-group>
|
|
166
169
|
</div>
|
|
@@ -93,6 +93,50 @@ export interface SortTableInstance<T extends Record<string, unknown> = Record<st
|
|
|
93
93
|
$emit: SortTableEmits<T>
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
// ==================== TitleTable 組件類型 ====================
|
|
97
|
+
|
|
98
|
+
/** TitleTable 組件 Props 類型 */
|
|
99
|
+
export interface TitleTableProps<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
100
|
+
/** 表格數據 */
|
|
101
|
+
data: T[]
|
|
102
|
+
/** 表格列配置 */
|
|
103
|
+
columns: import('./index').TableColumn<T>[]
|
|
104
|
+
/** 表格標題 */
|
|
105
|
+
tableTitle?: string
|
|
106
|
+
/** 是否顯示選擇列 */
|
|
107
|
+
showSelection?: boolean
|
|
108
|
+
/** 是否顯示加載狀態 */
|
|
109
|
+
loading?: boolean
|
|
110
|
+
/** 是否顯示匯總行 */
|
|
111
|
+
showSummary?: boolean
|
|
112
|
+
/** 是否顯示溢出提示 */
|
|
113
|
+
showOverFlowTooltip?: boolean
|
|
114
|
+
/** 匯總方法 */
|
|
115
|
+
summaryMethod?: (param: { columns: import('element-plus').TableColumnCtx<Record<string, unknown>>[]; data: T[] }) => (string | import('vue').VNode)[]
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** TitleTable 組件 Emits 類型 */
|
|
119
|
+
export interface TitleTableEmits<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
120
|
+
/** 新增按鈕點擊事件 */
|
|
121
|
+
(e: 'click:add'): void
|
|
122
|
+
/** 編輯按鈕點擊事件 */
|
|
123
|
+
(e: 'click:edit'): void
|
|
124
|
+
/** 刪除按鈕點擊事件 */
|
|
125
|
+
(e: 'click:delete'): void
|
|
126
|
+
/** 更新選擇行事件 */
|
|
127
|
+
(e: 'update:selectRow', value: T[]): void
|
|
128
|
+
/** 單元格點擊事件 */
|
|
129
|
+
(e: 'click:cell', column: import('./index').TableColumn<T>, row: T): void
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** TitleTable 組件實例類型 */
|
|
133
|
+
export interface TitleTableInstance<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
134
|
+
/** 組件 Props */
|
|
135
|
+
$props: TitleTableProps<T>
|
|
136
|
+
/** 組件 Emits */
|
|
137
|
+
$emit: TitleTableEmits<T>
|
|
138
|
+
}
|
|
139
|
+
|
|
96
140
|
// ==================== 按鈕相關組件類型 ====================
|
|
97
141
|
|
|
98
142
|
// ==================== BaseBtn 組件類型 ====================
|
|
@@ -198,6 +242,8 @@ export interface TransferDialogEmits<T = Record<string, unknown>> {
|
|
|
198
242
|
(e: 'update:modelValue', value: boolean): void
|
|
199
243
|
/** 提交事件 */
|
|
200
244
|
(e: 'update:submit', data: import('./index').TableColumn<T>[]): void
|
|
245
|
+
/** checkbox 狀態變更事件 */
|
|
246
|
+
(e: 'update:checkChange', data: { columns: import('./index').TableColumn<T>[], checkList: string[] }): void
|
|
201
247
|
}
|
|
202
248
|
|
|
203
249
|
/** TransferDialog 組件實例類型 */
|
|
@@ -497,6 +543,22 @@ export declare const SortTable: DefineComponent<
|
|
|
497
543
|
install: (app: App) => void
|
|
498
544
|
}
|
|
499
545
|
|
|
546
|
+
/** TitleTable 組件定義 */
|
|
547
|
+
export declare const TitleTable: DefineComponent<
|
|
548
|
+
TitleTableProps<any>,
|
|
549
|
+
{},
|
|
550
|
+
{},
|
|
551
|
+
{},
|
|
552
|
+
{},
|
|
553
|
+
{},
|
|
554
|
+
{},
|
|
555
|
+
{},
|
|
556
|
+
TitleTableEmits<any>
|
|
557
|
+
> & {
|
|
558
|
+
/** 安裝方法 */
|
|
559
|
+
install: (app: App) => void
|
|
560
|
+
}
|
|
561
|
+
|
|
500
562
|
/** BaseBtn 組件定義 */
|
|
501
563
|
export declare const BaseBtn: DefineComponent<
|
|
502
564
|
BaseBtnProps,
|
|
@@ -677,6 +739,8 @@ export interface VueTableComponentsPlugin {
|
|
|
677
739
|
BaseTable: typeof BaseTable
|
|
678
740
|
/** SortTable 組件 */
|
|
679
741
|
SortTable: typeof SortTable
|
|
742
|
+
/** TitleTable 組件 */
|
|
743
|
+
TitleTable: typeof TitleTable
|
|
680
744
|
/** BaseBtn 組件 */
|
|
681
745
|
BaseBtn: typeof BaseBtn
|
|
682
746
|
/** BaseDialog 組件 */
|
|
@@ -705,6 +769,7 @@ declare module '@vue/runtime-core' {
|
|
|
705
769
|
export interface GlobalComponents {
|
|
706
770
|
BaseTable: typeof BaseTable
|
|
707
771
|
SortTable: typeof SortTable
|
|
772
|
+
TitleTable: typeof TitleTable
|
|
708
773
|
BaseBtn: typeof BaseBtn
|
|
709
774
|
BaseDialog: typeof BaseDialog
|
|
710
775
|
TransferDialog: typeof TransferDialog
|
|
File without changes
|