@tmagic/table 1.8.0-manmanyu.8 → 1.8.0
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/es/ActionButton.js +5 -0
- package/dist/es/ActionButton.vue_vue_type_script_lang.js +51 -0
- package/dist/es/ActionPopconfirm.js +5 -0
- package/dist/es/ActionPopconfirm.vue_vue_type_script_setup_true_lang.js +50 -0
- package/dist/es/ActionsColumn.vue_vue_type_script_setup_true_lang.js +112 -51
- package/dist/es/ComponentColumn.vue_vue_type_script_setup_true_lang.js +4 -12
- package/dist/es/ExpandColumn.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/PopoverColumn.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/Table.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/TextColumn.vue_vue_type_script_setup_true_lang.js +3 -5
- package/dist/es/actionHelpers.js +17 -0
- package/dist/es/componentHelpers.js +11 -0
- package/dist/es/formHelpers.js +9 -0
- package/dist/es/style.css +16 -0
- package/dist/style.css +16 -0
- package/dist/tmagic-table.umd.cjs +447 -192
- package/package.json +9 -8
- package/src/ActionButton.vue +73 -0
- package/src/ActionPopconfirm.vue +44 -0
- package/src/ActionsColumn.vue +105 -46
- package/src/ComponentColumn.vue +4 -17
- package/src/TextColumn.vue +2 -8
- package/src/actionHelpers.ts +26 -0
- package/src/componentHelpers.ts +15 -0
- package/src/formHelpers.ts +12 -0
- package/src/schema.ts +49 -2
- package/src/theme/index.scss +19 -0
- package/types/index.d.ts +54 -16
package/types/index.d.ts
CHANGED
|
@@ -1,9 +1,27 @@
|
|
|
1
1
|
import { App } from "vue";
|
|
2
2
|
import { FormConfig, FormValue } from "@tmagic/form";
|
|
3
|
-
|
|
4
3
|
//#region temp/packages/table/src/schema.d.ts
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
export type ColumnActionPlacement = 'auto' | 'auto-start' | 'auto-end' | 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end' | 'right-start' | 'right-end';
|
|
5
|
+
/** 当 type 为 sub-actions 时,更多菜单(Popover)的配置 */
|
|
6
|
+
export interface ColumnSubActionConfig {
|
|
7
|
+
/** Popover 的弹出位置,默认 bottom */
|
|
8
|
+
placement?: ColumnActionPlacement;
|
|
9
|
+
/** Popover 浮层宽度,数字按 px 处理 */
|
|
10
|
+
popoverWidth?: string | number;
|
|
11
|
+
/** 附加到 Popover 浮层上的自定义 class */
|
|
12
|
+
popoverClass?: string;
|
|
13
|
+
/** Popover 关闭后是否销毁内容,默认 false */
|
|
14
|
+
popoverDestroyOnClose?: boolean;
|
|
15
|
+
/** 更多菜单中的子动作配置 */
|
|
16
|
+
items?: ColumnActionConfig[];
|
|
17
|
+
}
|
|
18
|
+
export interface ColumnActionConfig {
|
|
19
|
+
/**
|
|
20
|
+
* 动作类型:
|
|
21
|
+
* - `delete` / `copy` / `edit`:内置语义,`edit` 会进入行内编辑态。
|
|
22
|
+
* - `sub-actions`:点击后以 Popover 形式展开更多菜单,菜单配置通过 `subActionConfig` 提供。
|
|
23
|
+
*/
|
|
24
|
+
type?: 'delete' | 'copy' | 'edit' | 'sub-actions' | string;
|
|
7
25
|
buttonType?: string;
|
|
8
26
|
display?: boolean | ((row: any) => boolean);
|
|
9
27
|
disabled?: boolean | ((row: any) => boolean);
|
|
@@ -12,18 +30,32 @@ interface ColumnActionConfig {
|
|
|
12
30
|
tooltip?: string;
|
|
13
31
|
tooltipPlacement?: string;
|
|
14
32
|
icon?: any;
|
|
33
|
+
/** 为 true 时用 Popconfirm 包裹按钮,点击后需二次确认才会触发 handler */
|
|
34
|
+
popconfirm?: boolean;
|
|
35
|
+
/** Popconfirm 的确认提示文案,支持函数动态生成 */
|
|
36
|
+
confirmText?: string | ((row: any) => string);
|
|
37
|
+
/** Popconfirm 浮层宽度,数字按 px 处理 */
|
|
38
|
+
popconfirmWidth?: string | number;
|
|
39
|
+
/** 当 type 为 sub-actions 时,更多菜单(Popover)的配置 */
|
|
40
|
+
subActionConfig?: ColumnSubActionConfig;
|
|
15
41
|
handler?: (row: any, index: number) => Promise<any> | any;
|
|
16
42
|
before?: (row: any, index: number) => Promise<void> | void;
|
|
17
43
|
after?: (row: any, index: number) => Promise<void> | void;
|
|
18
44
|
action?: (data: {
|
|
19
45
|
data: any;
|
|
20
46
|
index: number;
|
|
21
|
-
}) => Promise<
|
|
47
|
+
}) => Promise<{
|
|
48
|
+
ret: number;
|
|
49
|
+
msg?: string;
|
|
50
|
+
} | void> | {
|
|
51
|
+
ret: number;
|
|
52
|
+
msg?: string;
|
|
53
|
+
} | void;
|
|
22
54
|
cancel?: (data: {
|
|
23
55
|
index: number;
|
|
24
56
|
}) => Promise<void> | void;
|
|
25
57
|
}
|
|
26
|
-
interface ColumnConfig<T = any> {
|
|
58
|
+
export interface ColumnConfig<T = any> {
|
|
27
59
|
pageIndex?: number;
|
|
28
60
|
pageSize?: number;
|
|
29
61
|
form?: FormConfig;
|
|
@@ -70,19 +102,25 @@ interface ColumnConfig<T = any> {
|
|
|
70
102
|
//#region temp/packages/table/src/Table.vue.d.ts
|
|
71
103
|
type __VLS_Props = {
|
|
72
104
|
data: any[];
|
|
73
|
-
columns?: ColumnConfig[];
|
|
105
|
+
columns?: ColumnConfig[];
|
|
106
|
+
/** 合并行或列的计算方法 */
|
|
74
107
|
spanMethod?: (_data: {
|
|
75
108
|
row: any;
|
|
76
109
|
column: any;
|
|
77
110
|
rowIndex: number;
|
|
78
111
|
columnIndex: number;
|
|
79
112
|
}) => [number, number];
|
|
80
|
-
loading?: boolean;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
113
|
+
loading?: boolean;
|
|
114
|
+
/** Table 的最大高度。合法的值为数字或者单位为 px 的高度 */
|
|
115
|
+
bodyHeight?: string | number;
|
|
116
|
+
/** 是否显示表头 */
|
|
117
|
+
showHeader?: boolean;
|
|
118
|
+
/** 空数据时显示的文本内容 */
|
|
119
|
+
emptyText?: string;
|
|
120
|
+
/** 是否默认展开所有行,当 Table 包含展开行存在或者为树形表格时有效 */
|
|
84
121
|
defaultExpandAll?: boolean;
|
|
85
|
-
rowkeyName?: string;
|
|
122
|
+
rowkeyName?: string;
|
|
123
|
+
/** 是否带有纵向边框 */
|
|
86
124
|
border?: boolean;
|
|
87
125
|
};
|
|
88
126
|
declare const __VLS_export: import("@vue/runtime-core").DefineComponent<__VLS_Props, {
|
|
@@ -94,18 +132,18 @@ declare const __VLS_export: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
94
132
|
"sort-change": (...args: any[]) => void;
|
|
95
133
|
"expand-change": (...args: any[]) => void;
|
|
96
134
|
"cell-click": (...args: any[]) => void;
|
|
135
|
+
"select-all": (...args: any[]) => void;
|
|
97
136
|
"after-action": (...args: any[]) => void;
|
|
98
137
|
"after-action-cancel": (...args: any[]) => void;
|
|
99
|
-
"select-all": (...args: any[]) => void;
|
|
100
138
|
"selection-change": (...args: any[]) => void;
|
|
101
139
|
}, string, import("@vue/runtime-core").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
102
140
|
onSelect?: ((...args: any[]) => any) | undefined;
|
|
103
141
|
"onSort-change"?: ((...args: any[]) => any) | undefined;
|
|
104
142
|
"onExpand-change"?: ((...args: any[]) => any) | undefined;
|
|
105
143
|
"onCell-click"?: ((...args: any[]) => any) | undefined;
|
|
144
|
+
"onSelect-all"?: ((...args: any[]) => any) | undefined;
|
|
106
145
|
"onAfter-action"?: ((...args: any[]) => any) | undefined;
|
|
107
146
|
"onAfter-action-cancel"?: ((...args: any[]) => any) | undefined;
|
|
108
|
-
"onSelect-all"?: ((...args: any[]) => any) | undefined;
|
|
109
147
|
"onSelection-change"?: ((...args: any[]) => any) | undefined;
|
|
110
148
|
}>, {
|
|
111
149
|
loading: boolean;
|
|
@@ -117,14 +155,14 @@ declare const __VLS_export: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
117
155
|
declare const _default: typeof __VLS_export;
|
|
118
156
|
//#endregion
|
|
119
157
|
//#region temp/packages/table/src/utils.d.ts
|
|
120
|
-
declare const formatter: (item: ColumnConfig, row: any, data: {
|
|
158
|
+
export declare const formatter: (item: ColumnConfig, row: any, data: {
|
|
121
159
|
index: number;
|
|
122
160
|
}) => any;
|
|
123
|
-
declare const createColumns: (columns: ColumnConfig[]) => ColumnConfig<any>[];
|
|
161
|
+
export declare const createColumns: (columns: ColumnConfig[]) => ColumnConfig<any>[];
|
|
124
162
|
//#endregion
|
|
125
163
|
//#region temp/packages/table/src/index.d.ts
|
|
126
164
|
declare const _default$1: {
|
|
127
165
|
install(app: App): void;
|
|
128
166
|
};
|
|
129
167
|
//#endregion
|
|
130
|
-
export {
|
|
168
|
+
export { _default as MagicTable, _default$1 as default };
|