@zhenliang/sheet 0.1.67 → 0.1.68

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.
@@ -58,13 +58,13 @@ export var sideEffectReducer = {
58
58
  });
59
59
  }
60
60
  });
61
- eventBus.on("row-select", function (value) {
61
+ eventBus.on('row-select', function (value) {
62
62
  dispatch({
63
63
  type: 'selectRow',
64
64
  payload: value
65
65
  });
66
66
  });
67
- eventBus.on("col-select", function (value) {
67
+ eventBus.on('col-select', function (value) {
68
68
  dispatch({
69
69
  type: 'selectCol',
70
70
  payload: value
@@ -330,13 +330,14 @@ export var sideEffectReducer = {
330
330
  var _groupMap$get3, _groupMap$get4;
331
331
  return !(groupMap.get(item.row) && !((_groupMap$get3 = groupMap.get(item.row)) !== null && _groupMap$get3 !== void 0 && _groupMap$get3.isStart) && !((_groupMap$get4 = groupMap.get(item.row)) !== null && _groupMap$get4 !== void 0 && _groupMap$get4.isOpen));
332
332
  }).map(function (item) {
333
- var _data$item$row3, _data$item$row4;
333
+ var _data$item$row3, _data$item$row4, _data$item$row5;
334
334
  return {
335
335
  cell: data === null || data === void 0 || (_data$item$row3 = data[item.row]) === null || _data$item$row3 === void 0 ? void 0 : _data$item$row3[item.col],
336
336
  row: item.row,
337
337
  col: item.col,
338
338
  value: null,
339
- id: data === null || data === void 0 || (_data$item$row4 = data[item.row]) === null || _data$item$row4 === void 0 ? void 0 : _data$item$row4[item.col].id
339
+ key: data === null || data === void 0 || (_data$item$row4 = data[item.row]) === null || _data$item$row4 === void 0 ? void 0 : _data$item$row4[item.col].dataIndex,
340
+ id: data === null || data === void 0 || (_data$item$row5 = data[item.row]) === null || _data$item$row5 === void 0 ? void 0 : _data$item$row5[item.col].id
340
341
  };
341
342
  });
342
343
  if (!changes.length) {
@@ -101,7 +101,8 @@ var Cell = function Cell(props) {
101
101
  row: row,
102
102
  col: col,
103
103
  id: cell.id,
104
- value: value
104
+ value: value,
105
+ key: cell.dataIndex
105
106
  // 没必要format value 已经是legal 的值了
106
107
  // value: cell.dataEditor?.formatter
107
108
  // ? cell.dataEditor.formatter?.(value)
@@ -125,6 +126,7 @@ var Cell = function Cell(props) {
125
126
  col: col,
126
127
  id: cell.id,
127
128
  value: value,
129
+ key: cell.dataIndex,
128
130
  confirm: true
129
131
  });
130
132
  }, [eventBus, valueRef, cell]);
@@ -99,7 +99,7 @@ var Table = function Table(_ref) {
99
99
  col: item.col,
100
100
  row: item.row,
101
101
  id: item.id,
102
- key: columns[item.col - offset].dataIndex,
102
+ key: item.key || columns[item.col - offset].dataIndex,
103
103
  value: item.value
104
104
  };
105
105
  }), extChange === null || extChange === void 0 ? void 0 : extChange.map(function (item) {
@@ -107,7 +107,7 @@ var Table = function Table(_ref) {
107
107
  col: item.col,
108
108
  row: item.row,
109
109
  id: item.id,
110
- key: columns[item.col - offset].dataIndex,
110
+ key: item.key || columns[item.col - offset].dataIndex,
111
111
  value: item.value
112
112
  };
113
113
  }));
@@ -58,6 +58,7 @@ export type CellData = {
58
58
  cell: Cell;
59
59
  row: number;
60
60
  col: number;
61
+ key?: string;
61
62
  value?: string;
62
63
  };
63
64
  export type CellNavigable = (cell?: Cell, row?: number, col?: number) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhenliang/sheet",
3
- "version": "0.1.67",
3
+ "version": "0.1.68",
4
4
  "description": "A react library developed with dumi",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",
@@ -80,4 +80,4 @@
80
80
  "authors": [
81
81
  "fizz.zhou@ap.jll.com"
82
82
  ]
83
- }
83
+ }
package/changes.md DELETED
@@ -1,45 +0,0 @@
1
- ### 为什么要重写
2
-
3
- #### 存在问题
4
-
5
- 1、表格选择逻辑与虚拟列表的冲突
6
- 2、表格的刷新机制: setRefresh(在多人开发的时候不便维护)
7
- 3、回调地狱
8
- 4、无法从 jll-portal 中剥离,有些地方与业务字段耦合
9
-
10
- #### 后果
11
-
12
- 1、新增功能难度大
13
- 2、修改容易出 bug
14
- 3、不利于业务代码优化和重构
15
-
16
- ### 重写后的表格
17
-
18
- #### 优点
19
-
20
- 1、维护性
21
- 2、扩展性
22
- 3、新的功能
23
-
24
- #### 新的 API
25
-
26
- 1、TableProps
27
-
28
- | 表头 | 表头 | 表头 |
29
- | -------------------------------------------- | ----------------------- | ---- |
30
- | className | container 类名 | 无 | |
31
- | | sheetInstance | sheet 对外暴露的一些 API | 选中行,参与回滚等 | |
32
-
33
- | columns | 表格列 | 无 ,必填 |
34
- | dataSource | 数据源 | 无,必填 |
35
- | virtualized |虚拟列表 | false |
36
- | draggable | 列宽可调整 | false |
37
- | rowClassName | 行类名 | 无 |
38
- | rowKey | 唯一标识字段 | key , id |
39
- | scroll | 同 antd table | {y:Math.min(400,row \* 40)} |
40
- | rowSelection | 选中行的配置 | 尚未完全实现 |
41
- | groupConfig | 表格分组 | 表格内部自动支持,对外配置尚未完全实现 |
42
- | onChange | 表格 cell change handler | 无 |
43
- | eventHandler | 自定义事件 handler | Record<string,(value:unknown)=>void> |
44
-
45
- 2、 ColumnProps