@wx-design/components 0.6.6 → 0.7.1-1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wx-design/components",
3
- "version": "0.6.6",
3
+ "version": "0.7.1-1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
package/types/index.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { VxeTablePropTypes } from 'vxe-table'
2
- import { SabTable } from './table'
2
+ import { SabTable, SabTableSet } from './table'
3
3
  export { SabTable }
4
4
 
5
5
  declare module '@vue/runtime-core' {
6
6
  export interface GlobalComponents {
7
7
  SabTable: typeof SabTable
8
+ SabTableSet: typeof SabTableSet
8
9
  }
9
10
  }
10
11
 
@@ -161,8 +161,8 @@ export type SabColumnProps<D = VxeTableDataRow> = VxeColumnProps<D> & {
161
161
  editable?: boolean;
162
162
  // 自定义插槽
163
163
  slots?: Partial<SabColumnSlots<D>>;
164
- // 是否隐藏列
165
- hidden?: boolean;
164
+ // 是否可见列,默认true
165
+ visible?: boolean;
166
166
  // 筛选控制
167
167
  sabFilter?: {
168
168
  // TODO: 是否自动收集筛选条件
@@ -1,12 +1,15 @@
1
1
 
2
2
  import type { VXEComponent, VxeTableEventProps } from 'vxe-table'
3
3
  import type { SabTableProps, TableSlots } from './table'
4
+ import type { TableSetProps } from './table-set'
4
5
  import type { SabColumnSlots } from './column'
5
6
 
6
7
  export const SabTable: VXEComponent<SabTableProps<any>, VxeTableEventProps<any>, SabColumnSlots<any> & TableSlots>
8
+ export const SabTableSet: VXEComponent<TableSetProps<any>, any>
7
9
 
8
10
  export * from './column'
9
11
  export * from './table'
12
+ export * from './table-set'
10
13
  export * from './toolbar'
11
14
  export * from './hooks'
12
15
  export type * from 'vxe-table'
@@ -0,0 +1,43 @@
1
+ import type { VxeTableInstance } from "vxe-table";
2
+ import type { SabColumnProps } from "./column";
3
+
4
+ type PureColumn = Pick<SabColumnProps, "field" | "title" | "visible" | "fixed">;
5
+
6
+ // 表格配置项存储类型
7
+ export type SabTableSetConfig = {
8
+ // 存储表头排序及显隐控制
9
+ columns?: PureColumn[]
10
+ }
11
+
12
+ export interface TableSetProps {
13
+ // 表名key
14
+ name: string;
15
+ // 是否启用该控件,默认 true
16
+ enabled?: boolean;
17
+ // 列
18
+ columns?: SabColumnProps[];
19
+ // 获取表格配置的方法
20
+ getTableConfig?: (params: {
21
+ // 表名
22
+ name: string;
23
+ }) => SabTableSetConfig;
24
+ // 设置表格配置的方法
25
+ setTableConfig?: (params: {
26
+ // 表名
27
+ name: string;
28
+ // 表格配置项
29
+ config: SabTableSetConfig;
30
+ }) => any;
31
+ // vxe-table 实例
32
+ tableRef?: VxeTableInstance;
33
+ }
34
+
35
+ // ColumnSet 表头设置配置
36
+ export interface TableSetColumnsProps {
37
+ // 表格传入的 columns
38
+ columns?: SabColumnProps[]
39
+ // 初始列表配置
40
+ initColumns?: PureColumn[];
41
+ // vxe-table 实例
42
+ tableRef?: VxeTableInstance;
43
+ }
@@ -1,7 +1,9 @@
1
1
  import { VxeTableProps, VxeTableDataRow, VxeTableInstance } from "vxe-table";
2
- import { SabColumnProps, SabPopoverParams } from "./";
2
+ import { SabColumnProps, SabPopoverParams, TableSetProps } from "./";
3
3
 
4
4
  export type SabTableProps<D = VxeTableDataRow> = VxeTableProps<D> & {
5
+ // 表名,如果你想保存表格的配置,则 name 必传
6
+ name?: string;
5
7
  // 表格 css 类名
6
8
  class?: any;
7
9
  // 外部容器 css 类名
@@ -22,14 +24,8 @@ export type SabTableProps<D = VxeTableDataRow> = VxeTableProps<D> & {
22
24
  autoColumnWidth?: boolean;
23
25
  // 单击是否选中当前行
24
26
  selectWhenClickRow?: boolean;
25
- // 行背景高亮,默认 true
26
- // 如果 false, 那么
27
- // row-config.isCurrent = false
28
- // row-config.isHover = false
29
- // checkbox-config.highlight, 背景为透明
30
- rowBackgroundHighlight?: boolean;
31
- // TODO: 行边框高亮, 默认 true
32
- rowBorderHighlight?: boolean;
27
+ // 表格设置控件配置
28
+ tableSetConfig?: Partial<TableSetProps>;
33
29
  }
34
30
 
35
31
  // 表格插槽
@@ -1,13 +1,13 @@
1
1
  import { VxeTableInstance, VxeTableDataRow } from "vxe-table";
2
2
 
3
- import { SabColumnProps } from "./";
3
+ import { SabColumnProps, TableSetProps } from "./";
4
4
 
5
5
  // 支持的能力
6
- // clearSelect - 清空选择行
7
- // saveSelect - 保存选择行
8
- type ToolbarFeatures = 'clearSelect' | 'saveSelect'
6
+ type ToolbarFeatures = ''
9
7
 
10
8
  export interface ToolbarProps<D = VxeTableDataRow> {
9
+ // 表名
10
+ name?: string;
11
11
  // css 类名
12
12
  class?: any;
13
13
  // vxe-table 实例
@@ -16,7 +16,6 @@ export interface ToolbarProps<D = VxeTableDataRow> {
16
16
  features?: ToolbarFeatures[];
17
17
  // 列配置项
18
18
  columns?: SabColumnProps[];
19
-
20
- // 保存选择行回调
21
- saveSelectRecords?: (rows: D[]) => void;
19
+ // 表格设置控件配置
20
+ tableSetConfig?: Partial<TableSetProps>;
22
21
  }