@xn-lib/component 0.1.31 → 0.1.34

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.
@@ -0,0 +1,262 @@
1
+ import type { TableInst } from '../types';
2
+ declare var __VLS_24: string | undefined, __VLS_25: any, __VLS_27: {}, __VLS_37: {}, __VLS_55: `modal-${string}`, __VLS_56: {
3
+ data: any;
4
+ close: () => void;
5
+ confirm: () => Promise<void>;
6
+ };
7
+ type __VLS_Slots = {} & {
8
+ [K in NonNullable<typeof __VLS_24>]?: (props: typeof __VLS_25) => any;
9
+ } & {
10
+ [K in NonNullable<typeof __VLS_55>]?: (props: typeof __VLS_56) => any;
11
+ } & {
12
+ default?: (props: typeof __VLS_27) => any;
13
+ } & {
14
+ empty?: (props: typeof __VLS_37) => any;
15
+ };
16
+ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
17
+ readonly data: {
18
+ readonly type: import("vue").PropType<any[]>;
19
+ readonly default: () => never[];
20
+ };
21
+ readonly columns: {
22
+ readonly type: import("vue").PropType<import("../types").TableColumn[]>;
23
+ readonly default: () => never[];
24
+ };
25
+ readonly showPagination: {
26
+ readonly type: import("vue").PropType<boolean | import("../types").PaginationConfig>;
27
+ readonly default: true;
28
+ };
29
+ readonly pageSize: {
30
+ readonly type: NumberConstructor;
31
+ readonly default: 20;
32
+ };
33
+ readonly pageSizes: {
34
+ readonly type: import("vue").PropType<number[]>;
35
+ readonly default: () => number[];
36
+ };
37
+ readonly currentPage: {
38
+ readonly type: NumberConstructor;
39
+ readonly default: 1;
40
+ };
41
+ readonly total: {
42
+ readonly type: NumberConstructor;
43
+ readonly default: 0;
44
+ };
45
+ readonly selection: {
46
+ readonly type: import("vue").PropType<boolean | import("../types").SelectionConfig>;
47
+ readonly default: false;
48
+ };
49
+ readonly searchConfig: {
50
+ readonly type: import("vue").PropType<import("../types").SearchConfig[]>;
51
+ readonly default: () => never[];
52
+ };
53
+ readonly toolbar: {
54
+ readonly type: import("vue").PropType<import("../types").ToolbarConfig>;
55
+ readonly default: () => {
56
+ left: never[];
57
+ right: never[];
58
+ };
59
+ };
60
+ readonly tableConfig: {
61
+ readonly type: import("vue").PropType<import("../types").TableConfig>;
62
+ readonly default: () => {};
63
+ };
64
+ readonly request: {
65
+ readonly type: import("vue").PropType<import("../types").RequestConfig>;
66
+ readonly default: undefined;
67
+ };
68
+ readonly loading: {
69
+ readonly type: BooleanConstructor;
70
+ readonly default: false;
71
+ };
72
+ readonly selectedKeys: {
73
+ readonly type: import("vue").PropType<any[]>;
74
+ readonly default: undefined;
75
+ };
76
+ readonly selectedRows: {
77
+ readonly type: import("vue").PropType<any[]>;
78
+ readonly default: undefined;
79
+ };
80
+ readonly virtual: {
81
+ readonly type: BooleanConstructor;
82
+ readonly default: false;
83
+ };
84
+ readonly rowKey: {
85
+ readonly type: import("vue").PropType<string | ((row: any) => string | number)>;
86
+ readonly default: "id";
87
+ };
88
+ readonly height: {
89
+ readonly type: import("vue").PropType<number | string>;
90
+ readonly default: undefined;
91
+ };
92
+ readonly maxHeight: {
93
+ readonly type: import("vue").PropType<number | string>;
94
+ readonly default: undefined;
95
+ };
96
+ readonly showSearch: {
97
+ readonly type: BooleanConstructor;
98
+ readonly default: true;
99
+ };
100
+ readonly showToolbar: {
101
+ readonly type: BooleanConstructor;
102
+ readonly default: true;
103
+ };
104
+ readonly emptyText: {
105
+ readonly type: StringConstructor;
106
+ readonly default: "暂无数据";
107
+ };
108
+ readonly modals: {
109
+ readonly type: import("vue").PropType<import("../types").ModalConfig[]>;
110
+ readonly default: () => never[];
111
+ };
112
+ }>, TableInst, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
113
+ search: (params: Record<string, any>) => any;
114
+ reset: () => any;
115
+ "selection-change": (selection: any[]) => any;
116
+ "page-change": (page: number) => any;
117
+ "size-change": (size: number) => any;
118
+ "request-success": (data: any) => any;
119
+ "request-error": (error: any) => any;
120
+ "update:selectedKeys": (keys: any[]) => any;
121
+ "update:selectedRows": (rows: any[]) => any;
122
+ "modal-confirm": (key: string, data?: any) => any;
123
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
124
+ readonly data: {
125
+ readonly type: import("vue").PropType<any[]>;
126
+ readonly default: () => never[];
127
+ };
128
+ readonly columns: {
129
+ readonly type: import("vue").PropType<import("../types").TableColumn[]>;
130
+ readonly default: () => never[];
131
+ };
132
+ readonly showPagination: {
133
+ readonly type: import("vue").PropType<boolean | import("../types").PaginationConfig>;
134
+ readonly default: true;
135
+ };
136
+ readonly pageSize: {
137
+ readonly type: NumberConstructor;
138
+ readonly default: 20;
139
+ };
140
+ readonly pageSizes: {
141
+ readonly type: import("vue").PropType<number[]>;
142
+ readonly default: () => number[];
143
+ };
144
+ readonly currentPage: {
145
+ readonly type: NumberConstructor;
146
+ readonly default: 1;
147
+ };
148
+ readonly total: {
149
+ readonly type: NumberConstructor;
150
+ readonly default: 0;
151
+ };
152
+ readonly selection: {
153
+ readonly type: import("vue").PropType<boolean | import("../types").SelectionConfig>;
154
+ readonly default: false;
155
+ };
156
+ readonly searchConfig: {
157
+ readonly type: import("vue").PropType<import("../types").SearchConfig[]>;
158
+ readonly default: () => never[];
159
+ };
160
+ readonly toolbar: {
161
+ readonly type: import("vue").PropType<import("../types").ToolbarConfig>;
162
+ readonly default: () => {
163
+ left: never[];
164
+ right: never[];
165
+ };
166
+ };
167
+ readonly tableConfig: {
168
+ readonly type: import("vue").PropType<import("../types").TableConfig>;
169
+ readonly default: () => {};
170
+ };
171
+ readonly request: {
172
+ readonly type: import("vue").PropType<import("../types").RequestConfig>;
173
+ readonly default: undefined;
174
+ };
175
+ readonly loading: {
176
+ readonly type: BooleanConstructor;
177
+ readonly default: false;
178
+ };
179
+ readonly selectedKeys: {
180
+ readonly type: import("vue").PropType<any[]>;
181
+ readonly default: undefined;
182
+ };
183
+ readonly selectedRows: {
184
+ readonly type: import("vue").PropType<any[]>;
185
+ readonly default: undefined;
186
+ };
187
+ readonly virtual: {
188
+ readonly type: BooleanConstructor;
189
+ readonly default: false;
190
+ };
191
+ readonly rowKey: {
192
+ readonly type: import("vue").PropType<string | ((row: any) => string | number)>;
193
+ readonly default: "id";
194
+ };
195
+ readonly height: {
196
+ readonly type: import("vue").PropType<number | string>;
197
+ readonly default: undefined;
198
+ };
199
+ readonly maxHeight: {
200
+ readonly type: import("vue").PropType<number | string>;
201
+ readonly default: undefined;
202
+ };
203
+ readonly showSearch: {
204
+ readonly type: BooleanConstructor;
205
+ readonly default: true;
206
+ };
207
+ readonly showToolbar: {
208
+ readonly type: BooleanConstructor;
209
+ readonly default: true;
210
+ };
211
+ readonly emptyText: {
212
+ readonly type: StringConstructor;
213
+ readonly default: "暂无数据";
214
+ };
215
+ readonly modals: {
216
+ readonly type: import("vue").PropType<import("../types").ModalConfig[]>;
217
+ readonly default: () => never[];
218
+ };
219
+ }>> & Readonly<{
220
+ onSearch?: ((params: Record<string, any>) => any) | undefined;
221
+ onReset?: (() => any) | undefined;
222
+ "onSelection-change"?: ((selection: any[]) => any) | undefined;
223
+ "onPage-change"?: ((page: number) => any) | undefined;
224
+ "onSize-change"?: ((size: number) => any) | undefined;
225
+ "onRequest-success"?: ((data: any) => any) | undefined;
226
+ "onRequest-error"?: ((error: any) => any) | undefined;
227
+ "onUpdate:selectedKeys"?: ((keys: any[]) => any) | undefined;
228
+ "onUpdate:selectedRows"?: ((rows: any[]) => any) | undefined;
229
+ "onModal-confirm"?: ((key: string, data?: any) => any) | undefined;
230
+ }>, {
231
+ readonly data: any[];
232
+ readonly height: string | number;
233
+ readonly maxHeight: string | number;
234
+ readonly columns: import("../types").TableColumn[];
235
+ readonly loading: boolean;
236
+ readonly emptyText: string;
237
+ readonly virtual: boolean;
238
+ readonly rowKey: string | ((row: any) => string | number);
239
+ readonly selection: boolean | import("../types").SelectionConfig;
240
+ readonly toolbar: import("../types").ToolbarConfig;
241
+ readonly currentPage: number;
242
+ readonly pageSize: number;
243
+ readonly total: number;
244
+ readonly pageSizes: number[];
245
+ readonly showPagination: boolean | import("../types").PaginationConfig;
246
+ readonly searchConfig: import("../types").SearchConfig[];
247
+ readonly tableConfig: import("../types").TableConfig;
248
+ readonly request: import("../types").RequestConfig;
249
+ readonly selectedKeys: any[];
250
+ readonly selectedRows: any[];
251
+ readonly showSearch: boolean;
252
+ readonly showToolbar: boolean;
253
+ readonly modals: import("../types").ModalConfig[];
254
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
255
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
256
+ declare const _default: typeof __VLS_export;
257
+ export default _default;
258
+ type __VLS_WithSlots<T, S> = T & {
259
+ new (): {
260
+ $slots: S;
261
+ };
262
+ };
@@ -0,0 +1,100 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue';
2
+ import type { TableColumn, PaginationConfig, SelectionConfig, SearchConfig, ToolbarConfig, TableConfig, RequestConfig, ModalConfig } from '../types';
3
+ export declare const tableProps: {
4
+ readonly data: {
5
+ readonly type: PropType<any[]>;
6
+ readonly default: () => never[];
7
+ };
8
+ readonly columns: {
9
+ readonly type: PropType<TableColumn[]>;
10
+ readonly default: () => never[];
11
+ };
12
+ readonly showPagination: {
13
+ readonly type: PropType<boolean | PaginationConfig>;
14
+ readonly default: true;
15
+ };
16
+ readonly pageSize: {
17
+ readonly type: NumberConstructor;
18
+ readonly default: 20;
19
+ };
20
+ readonly pageSizes: {
21
+ readonly type: PropType<number[]>;
22
+ readonly default: () => number[];
23
+ };
24
+ readonly currentPage: {
25
+ readonly type: NumberConstructor;
26
+ readonly default: 1;
27
+ };
28
+ readonly total: {
29
+ readonly type: NumberConstructor;
30
+ readonly default: 0;
31
+ };
32
+ readonly selection: {
33
+ readonly type: PropType<boolean | SelectionConfig>;
34
+ readonly default: false;
35
+ };
36
+ readonly searchConfig: {
37
+ readonly type: PropType<SearchConfig[]>;
38
+ readonly default: () => never[];
39
+ };
40
+ readonly toolbar: {
41
+ readonly type: PropType<ToolbarConfig>;
42
+ readonly default: () => {
43
+ left: never[];
44
+ right: never[];
45
+ };
46
+ };
47
+ readonly tableConfig: {
48
+ readonly type: PropType<TableConfig>;
49
+ readonly default: () => {};
50
+ };
51
+ readonly request: {
52
+ readonly type: PropType<RequestConfig>;
53
+ readonly default: undefined;
54
+ };
55
+ readonly loading: {
56
+ readonly type: BooleanConstructor;
57
+ readonly default: false;
58
+ };
59
+ readonly selectedKeys: {
60
+ readonly type: PropType<any[]>;
61
+ readonly default: undefined;
62
+ };
63
+ readonly selectedRows: {
64
+ readonly type: PropType<any[]>;
65
+ readonly default: undefined;
66
+ };
67
+ readonly virtual: {
68
+ readonly type: BooleanConstructor;
69
+ readonly default: false;
70
+ };
71
+ readonly rowKey: {
72
+ readonly type: PropType<string | ((row: any) => string | number)>;
73
+ readonly default: "id";
74
+ };
75
+ readonly height: {
76
+ readonly type: PropType<number | string>;
77
+ readonly default: undefined;
78
+ };
79
+ readonly maxHeight: {
80
+ readonly type: PropType<number | string>;
81
+ readonly default: undefined;
82
+ };
83
+ readonly showSearch: {
84
+ readonly type: BooleanConstructor;
85
+ readonly default: true;
86
+ };
87
+ readonly showToolbar: {
88
+ readonly type: BooleanConstructor;
89
+ readonly default: true;
90
+ };
91
+ readonly emptyText: {
92
+ readonly type: StringConstructor;
93
+ readonly default: "暂无数据";
94
+ };
95
+ readonly modals: {
96
+ readonly type: PropType<ModalConfig[]>;
97
+ readonly default: () => never[];
98
+ };
99
+ };
100
+ export type TableProps = ExtractPropTypes<typeof tableProps>;
@@ -3,6 +3,7 @@ export * from './tag';
3
3
  export * from './transfer';
4
4
  export * from './virtual-list';
5
5
  export * from './editable-textarea';
6
+ export * from './table';
6
7
  export type DefaultType = 'success' | 'info' | 'warning' | 'danger' | 'primary' | 'default';
7
8
  export type DefaultSize = 'small' | 'default' | 'large';
8
9
  export type Option = {
@@ -0,0 +1,322 @@
1
+ import { TableAlign, TableFixed, TableSize, ButtonType, SearchType, SelectionType } from '@xn-lib/core';
2
+ import { ColumnCls, ColumnStyle } from 'element-plus';
3
+ export type VNode = any;
4
+ export type Component = any;
5
+ export type AlignType = typeof TableAlign.Left.value | typeof TableAlign.Center.value | typeof TableAlign.Right.value;
6
+ export type FixedType = boolean | typeof TableFixed.Left.value | typeof TableFixed.Right.value;
7
+ export type SizeType = typeof TableSize.Large.value | typeof TableSize.Default.value | typeof TableSize.Small.value;
8
+ export type ButtonTypeValue = typeof ButtonType.Primary.value | typeof ButtonType.Success.value | typeof ButtonType.Warning.value | typeof ButtonType.Danger.value | typeof ButtonType.Info.value | typeof ButtonType.Text.value;
9
+ export type SearchTypeValue = typeof SearchType.Input.value | typeof SearchType.Select.value | typeof SearchType.Date.value | typeof SearchType.DateRange.value | typeof SearchType.DateTimeRange.value | typeof SearchType.Cascader.value | typeof SearchType.Custom.value;
10
+ export type SelectionTypeValue = typeof SelectionType.Single.value | typeof SelectionType.Multiple.value;
11
+ export interface ConfirmConfig {
12
+ /** 确认消息 */
13
+ message: string;
14
+ /** 确认标题 */
15
+ title?: string;
16
+ /** 消息类型 */
17
+ type?: 'success' | 'warning' | 'info' | 'error';
18
+ /** 确认按钮文本 */
19
+ confirmText?: string;
20
+ /** 取消按钮文本 */
21
+ cancelText?: string;
22
+ }
23
+ export interface ActionItem {
24
+ /** 唯一标识 */
25
+ key: string;
26
+ /** 按钮文本 */
27
+ label: string;
28
+ /** 按钮样式 */
29
+ type?: 'primary' | 'success' | 'warning' | 'danger' | 'info';
30
+ /** 图标 */
31
+ icon?: string | Component;
32
+ /** 是否显示,返回 false 则隐藏 */
33
+ show?: boolean | ((row: any) => boolean);
34
+ /** 是否禁用 */
35
+ disabled?: boolean | ((row: any) => boolean);
36
+ /** 二次确认配置,字符串时为确认消息 */
37
+ confirm?: string | ConfirmConfig;
38
+ /** 关联弹窗项 key,点击时自动打开对应弹窗/抽屉 */
39
+ modal?: string;
40
+ /** 点击回调(若无 modal 则必填,有 modal 时可选) */
41
+ onClick?: (row: any) => void;
42
+ }
43
+ export interface ModalFormConfig {
44
+ /** 校验规则,支持函数动态返回 */
45
+ rules?: Record<string, any[]> | ((data?: any) => Record<string, any[]>);
46
+ /** label 宽度 */
47
+ labelWidth?: string | number;
48
+ /** label 位置 */
49
+ labelPosition?: 'left' | 'right' | 'top';
50
+ /** 表单尺寸 */
51
+ size?: 'large' | 'default' | 'small';
52
+ /** 是否禁用 */
53
+ disabled?: boolean;
54
+ /** 其他 el-form 属性 */
55
+ [key: string]: any;
56
+ }
57
+ export interface ModalConfig {
58
+ /** 唯一标识 */
59
+ key: string;
60
+ /** 类型 */
61
+ type?: 'dialog' | 'drawer';
62
+ /** 标题,支持字符串或函数(接收 data 返回标题) */
63
+ title?: string | ((data?: any) => string);
64
+ /** 宽度 */
65
+ width?: string | number;
66
+ /** drawer 方向 */
67
+ placement?: 'left' | 'right' | 'top' | 'bottom';
68
+ /** 是否在关闭时销毁 */
69
+ destroyOnClose?: boolean;
70
+ /** 点击遮罩关闭 */
71
+ closeOnClickModal?: boolean;
72
+ /** ESC 关闭 */
73
+ closeOnPressEscape?: boolean;
74
+ /** 是否追加到 body */
75
+ appendToBody?: boolean;
76
+ /** 是否显示底部按钮,默认 true */
77
+ showFooter?: boolean;
78
+ /** 取消按钮文本,默认 '取消' */
79
+ cancelText?: string;
80
+ /** 确定按钮文本,默认 '确定' */
81
+ confirmText?: string;
82
+ /** 表单配置,有值时自动包裹 el-form 并校验 */
83
+ form?: ModalFormConfig;
84
+ /** 确定回调,返回 false 阻止关闭,支持异步 */
85
+ onOk?: (data?: any) => boolean | Promise<boolean | void> | void;
86
+ /** 取消回调,返回 false 阻止关闭,支持异步 */
87
+ onCancel?: (data?: any) => boolean | Promise<boolean | void> | void;
88
+ /** 内容组件,接收 { data, close, confirm } props */
89
+ component?: Component;
90
+ /** 其他 el-dialog / el-drawer 属性 */
91
+ [key: string]: any;
92
+ }
93
+ export interface TableColumn {
94
+ /** 唯一标识,必填 */
95
+ key: string;
96
+ /** 列标题 */
97
+ label: string;
98
+ /** 宽度 */
99
+ width?: number | string;
100
+ /** 最小宽度 */
101
+ minWidth?: number | string;
102
+ /** 对齐方式 */
103
+ align?: AlignType;
104
+ /** 是否固定列 */
105
+ fixed?: FixedType;
106
+ /** 是否可排序 */
107
+ sortable?: boolean;
108
+ /** 是否可调整宽度 */
109
+ resizable?: boolean;
110
+ /** 是否显示 */
111
+ show?: boolean;
112
+ /** 是否渲染为可点击链接样式 */
113
+ link?: boolean;
114
+ /** 点击回调(link 为 true 或有 onClick 时生效) */
115
+ onClick?: (row: any, index: number) => void;
116
+ /** 操作项配置(简化操作列配置,自动渲染按钮组) */
117
+ actions?: ActionItem[];
118
+ /** 自定义渲染 */
119
+ render?: (row: any, column: TableColumn, $index: number) => VNode | string;
120
+ /** slot 名称(用于自定义列) */
121
+ slot?: string;
122
+ /** 其他 el-table-column 属性 */
123
+ [key: string]: any;
124
+ }
125
+ export interface PaginationConfig {
126
+ /** 是否显示 */
127
+ enabled?: boolean;
128
+ /** 当前页码 */
129
+ current?: number;
130
+ /** 每页条数 */
131
+ pageSize?: number;
132
+ /** 可选的每页条数 */
133
+ pageSizes?: number[];
134
+ /** 总数 */
135
+ total?: number;
136
+ /** 是否显示总数 */
137
+ showTotal?: boolean;
138
+ /** 是否显示跳转 */
139
+ showJumper?: boolean;
140
+ /** 布局 */
141
+ layout?: string;
142
+ /** 背景色 */
143
+ background?: boolean;
144
+ }
145
+ export interface SelectionConfig {
146
+ /** 是否启用选择 */
147
+ enabled?: boolean;
148
+ /** 选择类型 */
149
+ type?: 'single' | 'multiple';
150
+ /** 行唯一键 */
151
+ rowKey?: string;
152
+ /** 是否支持跨页选择 */
153
+ reserve?: boolean;
154
+ /** 初始选中的行 */
155
+ defaultSelected?: any[];
156
+ /** 选择模式:'key' | 'full' - key 只存储 key,full 存储整行数据 */
157
+ mode?: 'key' | 'full';
158
+ /** 严格模式:点击行是否自动切换选择 */
159
+ strict?: boolean;
160
+ /** 判断行是否可选,返回 false 则禁用该行的 checkbox */
161
+ selectable?: (row: any, index: number) => boolean;
162
+ }
163
+ export interface SearchConfig {
164
+ /** 唯一标识 */
165
+ key: string;
166
+ /** 类型 */
167
+ type?: SearchTypeValue;
168
+ /** 标签 */
169
+ label?: string;
170
+ /** 占位符 */
171
+ placeholder?: string;
172
+ /** 默认值 */
173
+ defaultValue?: any;
174
+ /** 是否显示 */
175
+ show?: boolean;
176
+ /** 宽度 */
177
+ width?: number | string;
178
+ /** 下拉选项(select 用) */
179
+ options?: Record<string, any>[];
180
+ /** 选项中 label 字段名 */
181
+ labelKey?: string;
182
+ /** 选项中 value 字段名 */
183
+ valueKey?: string;
184
+ /** 级联数据(cascader 用) */
185
+ optionsHandler?: (value: any) => any[];
186
+ /** 其他 el-input / el-select 属性 */
187
+ attrs?: Record<string, any>;
188
+ /** 日期格式(date/daterange/datetimerange 时有效) */
189
+ format?: string;
190
+ /** 值变化事件 */
191
+ onChange?: (value: any) => void;
192
+ /** 自定义渲染(type=custom 时) */
193
+ render?: (config: SearchConfig, model: Record<string, any>, setModel: (key: string, value: any) => void) => VNode;
194
+ }
195
+ export interface DropdownItem {
196
+ /** 唯一标识 */
197
+ key: string;
198
+ /** 菜单项文本 */
199
+ label: string;
200
+ /** 是否禁用 */
201
+ disabled?: boolean;
202
+ /** 是否需要选中数据才可用 */
203
+ requireSelection?: boolean;
204
+ /** 二次确认配置,字符串时为确认消息 */
205
+ confirm?: string | ConfirmConfig;
206
+ /** 关联弹窗 key,点击时自动打开对应弹窗 */
207
+ modal?: string;
208
+ /** 点击事件 */
209
+ onClick?: (selection: any[]) => void;
210
+ /** 自定义渲染 */
211
+ render?: (selection: any[], disabled: boolean, onClick: () => void) => VNode;
212
+ /** 分割线 */
213
+ divided?: boolean;
214
+ }
215
+ export interface ToolbarButton {
216
+ /** 唯一标识 */
217
+ key: string;
218
+ /** 按钮文本 */
219
+ label: string;
220
+ /** 按钮类型:button 普通按钮 | dropdown 下拉按钮 */
221
+ buttonType?: 'button' | 'dropdown';
222
+ /** 按钮样式类型(button 时有效) */
223
+ type?: ButtonTypeValue;
224
+ /** 图标 */
225
+ icon?: string | Component;
226
+ /** 是否禁用 */
227
+ disabled?: boolean;
228
+ /** 是否需要选中数据才可用 */
229
+ requireSelection?: boolean;
230
+ /** 二次确认配置,字符串时为确认消息 */
231
+ confirm?: string | ConfirmConfig;
232
+ /** 关联弹窗 key,点击时自动打开对应弹窗 */
233
+ modal?: string;
234
+ /** 点击事件 */
235
+ onClick?: (selection: any[]) => void;
236
+ /** 自定义渲染 */
237
+ render?: (selection: any[], disabled: boolean, onClick: () => void) => VNode;
238
+ /** 下拉菜单配置(buttonType=dropdown 时有效) */
239
+ dropdown?: DropdownItem[];
240
+ /** 下拉菜单触发方式 */
241
+ dropdownTrigger?: 'hover' | 'click';
242
+ }
243
+ export interface ToolbarConfig {
244
+ /** 左侧区域 */
245
+ left?: ToolbarButton[];
246
+ /** 右侧区域 */
247
+ right?: ToolbarButton[];
248
+ }
249
+ export interface TableConfig {
250
+ /** 高度 */
251
+ height?: number | string;
252
+ /** 最大高度 */
253
+ maxHeight?: number | string;
254
+ /** 斑马纹 */
255
+ stripe?: boolean;
256
+ /** 边框 */
257
+ border?: boolean;
258
+ /** 尺寸 */
259
+ size?: SizeType;
260
+ /** 是否显示表头 */
261
+ showHeader?: boolean;
262
+ /** 高亮当前行 */
263
+ highlightCurrentRow?: boolean;
264
+ /** 行类名 */
265
+ rowClassName?: ColumnCls<any> | undefined;
266
+ /** 行样式 */
267
+ rowStyle?: ColumnStyle<any> | undefined;
268
+ /** 空数据文本 */
269
+ emptyText?: string;
270
+ /** 滚动 */
271
+ scroll?: {
272
+ x?: number;
273
+ y?: number;
274
+ };
275
+ /** 其他 el-table 属性 */
276
+ [key: string]: any;
277
+ }
278
+ export interface RequestConfig {
279
+ /** 请求函数,接收分页和搜索参数,返回数据 */
280
+ api: (params: Record<string, any>) => Promise<any>;
281
+ /** 是否自动加载(默认 true) */
282
+ autoLoad?: boolean;
283
+ /** 是否在搜索/重置/分页时自动请求(默认 true) */
284
+ autoRequest?: boolean;
285
+ }
286
+ export interface TableEmits {
287
+ 'update:selectedKeys': [keys: any[]];
288
+ 'update:selectedRows': [rows: any[]];
289
+ 'page-change': [page: number];
290
+ 'size-change': [size: number];
291
+ 'search': [params: Record<string, any>];
292
+ 'reset': [];
293
+ 'selection-change': [selection: any[]];
294
+ 'request-success': [data: any];
295
+ 'request-error': [error: any];
296
+ }
297
+ export interface TableInst {
298
+ /** 获取表格实例 */
299
+ getTable: () => any;
300
+ /** 获取已选中的 keys */
301
+ getSelectedKeys: () => any[];
302
+ /** 获取已选中的行数据 */
303
+ getSelectedRows: () => any[];
304
+ /** 设置选中状态 */
305
+ setSelected: (keys: any[]) => void;
306
+ /** 清空选择 */
307
+ clearSelection: () => void;
308
+ /** 重新加载 */
309
+ reload: () => void;
310
+ /** 发起请求 */
311
+ load: () => Promise<any>;
312
+ /** 重置搜索 */
313
+ resetSearch: () => void;
314
+ /** 获取搜索参数 */
315
+ getSearchParams: () => Record<string, any>;
316
+ /** 动态设置搜索表单值 */
317
+ setSearchFields: (fields: Record<string, any>) => void;
318
+ /** 打开指定交互项 */
319
+ openModal: (key: string, data?: any) => void;
320
+ /** 关闭指定交互项 */
321
+ closeModal: (key: string) => void;
322
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@xn-lib/component",
4
- "version": "0.1.31",
4
+ "version": "0.1.34",
5
5
  "description": "",
6
6
  "main": "./dist/index.umd.js",
7
7
  "module": "./dist/index.mjs",