@wx-design/components 1.0.0-alpha.1 → 1.0.0-alpha.11

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": "1.0.0-alpha.1",
3
+ "version": "1.0.0-alpha.11",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -32,15 +32,14 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@vueuse/core": "^10.6.1",
35
- "@vxe-ui/core": "^4.0.16",
35
+ "@vxe-ui/core": "^4.0.20",
36
36
  "classnames": "^2.5.1",
37
37
  "deepmerge": "^4.3.1",
38
38
  "lodash": "^4.17.21",
39
39
  "number-precision": "^1.6.0",
40
40
  "vue": "^3.3.7",
41
- "vuedraggable": "^4.1.0",
42
- "vxe-pc-ui": "4.2.32",
43
- "vxe-table": "4.7.95"
41
+ "vxe-pc-ui": "4.3.22",
42
+ "vxe-table": "4.9.16"
44
43
  },
45
44
  "peerDependencies": {
46
45
  "@element-plus/icons-vue": "2",
@@ -1,4 +1,4 @@
1
- import { Ref } from 'vue'
1
+ import { Ref } from "vue";
2
2
  import {
3
3
  VxeTableDataRow,
4
4
  VxeColumnProps,
@@ -14,6 +14,7 @@ import type {
14
14
  CheckboxProps,
15
15
  SwitchProps,
16
16
  PopoverInstance,
17
+ ImageProps,
17
18
  } from "element-plus";
18
19
  import type { SabHeaderFilterProps } from "./";
19
20
 
@@ -26,7 +27,8 @@ export interface SabColumnSlots<D = VxeTableDataRow> {
26
27
  params: VxeColumnSlotTypes.DefaultSlotParams<D> & {
27
28
  column: SabColumnProps<D>;
28
29
  },
29
- editorProps?: SabCellEditorParams
30
+ editorProps?: SabCellEditorParams,
31
+ column?: SabColumnProps<D>
30
32
  ) => any)
31
33
  | string;
32
34
  /**
@@ -119,7 +121,7 @@ export type SabCellSelectProps<D = VxeTableDataRow> = {
119
121
  }
120
122
  ) => Promise<any[]> | any[];
121
123
  // 只有配置了 dynamicOptions 才有效,聚焦时重新获取数据
122
- revalidateOnFocus?: boolean
124
+ revalidateOnFocus?: boolean;
123
125
  // 动态获取方法的防抖配置
124
126
  dynamicDebounce?: {
125
127
  // 延迟时间, 毫秒,默认300
@@ -171,6 +173,14 @@ export type BooleanEditorProps<D = VxeTableDataRow> = Partial<SwitchProps> &
171
173
  }): void;
172
174
  };
173
175
 
176
+ // 图片类型参数
177
+ export type ImageViewProps<D = VxeTableDataRow> = Partial<ImageProps> & {
178
+ // 在表格内直接展示图片
179
+ showThumb?: boolean
180
+ // 最多显示几张图片,默认3张, -1则不限制
181
+ maxCount?: number
182
+ };
183
+
174
184
  // 单元格编辑器参数
175
185
  export type SabCellEditorParams =
176
186
  | Partial<InputProps>
@@ -180,7 +190,8 @@ export type SabCellEditorParams =
180
190
  | Partial<PopoverProps>
181
191
  | Partial<SabPopoverParams>
182
192
  | Partial<DynamicCellProps>
183
- | Partial<BooleanEditorProps>;
193
+ | Partial<BooleanEditorProps>
194
+ | Partial<ImageViewProps>;
184
195
 
185
196
  // 弹出层配置
186
197
  export type SabPopoverParams = Partial<PopoverProps & DialogProps> & {
@@ -240,16 +251,29 @@ export type SabColumnProps<D = VxeTableDataRow> = VxeColumnProps<D> & {
240
251
  // vxe-table 实例
241
252
  xTable?: VxeTableInstance;
242
253
 
254
+ // vxe-table 表格宽度设置 auto 会是默认自适应内容宽度
255
+ // sab-table 做了处理,把 auto 置为空字符串了
256
+ // 如果不需要置空,请开始这个开关
257
+ enableAutoWidth?: boolean
258
+
243
259
  // 其他
244
- // 不参与批量操作
245
- batchForbidden?: boolean
260
+ // 参与批量操作, 如果单元格支持编辑的话,默认 true,否则false
261
+ enableBatchAction?: boolean;
246
262
  // 不参与动态表头控制
247
- noHeaderSet?: boolean
263
+ noHeaderSet?: boolean;
248
264
  // 参与表格尾部汇总
249
- withSummary?: boolean
265
+ withSummary?: boolean;
250
266
  // 自定义表格尾部数据汇总处理
251
- footerMethod?(column: SabColumnProps<D>, data: D[]): any
267
+ footerMethod?(column: SabColumnProps<D>, data: D[]): any;
252
268
 
253
269
  // 表头分组
254
- children?: SabColumnProps<D>[]
270
+ children?: SabColumnProps<D>[];
271
+
272
+ // 在被单元格渲染前转换数据
273
+ // 测试中,不要滥用,目前只推荐 `Image` 使用
274
+ transformRowDataToCell?(
275
+ scope:
276
+ | VxeColumnSlotTypes.DefaultSlotParams<D>
277
+ | VxeColumnSlotTypes.EditSlotParams<D>
278
+ ): any;
255
279
  };
@@ -1,7 +1,7 @@
1
1
  import type { VxeTableInstance } from "vxe-table";
2
2
  import type { SabColumnProps } from "./column";
3
3
 
4
- type PureColumn = Pick<SabColumnProps, "field" | "title" | "visible" | "fixed">;
4
+ type PureColumn = Pick<SabColumnProps, "field" | "title" | "visible" | "fixed" | "enableBatchAction"> & { __table__seq: number };
5
5
 
6
6
  // 表格配置项存储类型
7
7
  export type SabTableSetConfig = {
@@ -40,4 +40,6 @@ export interface TableSetColumnsProps {
40
40
  initColumns?: PureColumn[];
41
41
  // vxe-table 实例
42
42
  tableRef?: VxeTableInstance;
43
+ // 展示批量操作列
44
+ showBatchActionColumn?: boolean
43
45
  }
@@ -76,6 +76,12 @@ export type SabTableProps<D = VxeTableDataRow> = VxeTableProps<D> & {
76
76
  // 使所有的列都支持排序
77
77
  enableAll?: boolean;
78
78
  };
79
+ // 树形表格配置
80
+ treeConfig?: VxeTablePropTypes.TreeConfig<D> & {
81
+ // 自动将树形结构数据转成扁平结构转给 vxe-table 的 transform 处理,transform: true
82
+ // 需要提供 childrenField 字段
83
+ childTransform?: boolean
84
+ }
79
85
  };
80
86
 
81
87
  // 表格插槽