@kdcloudjs/table 1.2.0-canary.12 → 1.2.0-canary.14

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.
@@ -439,7 +439,8 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
439
439
  }, /*#__PURE__*/React.createElement("div", {
440
440
  className: cx(Classes.horizontalScrollLeftSpacer),
441
441
  style: {
442
- width: info.leftLockTotalWidth
442
+ width: info.leftLockTotalWidth,
443
+ display: hasStickyScroll && hasScroll ? 'block' : 'none'
443
444
  }
444
445
  }), /*#__PURE__*/React.createElement("div", {
445
446
  className: cx(Classes.stickyScroll),
@@ -452,7 +453,8 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
452
453
  })), /*#__PURE__*/React.createElement("div", {
453
454
  className: cx(Classes.horizontalScrollRightSpacer),
454
455
  style: {
455
- width: info.rightLockTotalWidth
456
+ width: info.rightLockTotalWidth,
457
+ display: hasStickyScroll && hasScroll ? 'block' : 'none'
456
458
  }
457
459
  }));
458
460
  }
@@ -88,7 +88,7 @@ export function filter() {
88
88
  var colFilterIcon = (_f = (_e = col.features) === null || _e === void 0 ? void 0 : _e.filterIcon) !== null && _f !== void 0 ? _f : filterIcon;
89
89
 
90
90
  var _Filter = /*#__PURE__*/React.createElement(Filter, {
91
- key: "filter",
91
+ key: "".concat(col.code, "_filter"),
92
92
  FilterPanelContent: filterPanel,
93
93
  filterIcon: colFilterIcon,
94
94
  filterModel: inputFiltersMap.get(col.code),
@@ -71,6 +71,11 @@ export function treeMode() {
71
71
  return pipeline.mapDataSource(processDataSource).mapColumns(processColumns);
72
72
 
73
73
  function processDataSource(input) {
74
+ if (pipeline.isSameInputDataSource() && openKeys === pipeline.getFeatureOptions('lastOpenKeys')) {
75
+ return pipeline.getFeatureOptions('lastTreeMode');
76
+ }
77
+
78
+ pipeline.setFeatureOptions('lastOpenKeys', pipeline.getStateAtKey(stateKey));
74
79
  var result = [];
75
80
  dfs(input, 0);
76
81
 
@@ -111,6 +116,7 @@ export function treeMode() {
111
116
  }
112
117
  }
113
118
 
119
+ pipeline.setFeatureOptions('lastTreeMode', result);
114
120
  return result;
115
121
  }
116
122
 
@@ -35,6 +35,7 @@ export declare class TablePipeline {
35
35
  private readonly _rowPropsGetters;
36
36
  private _tableProps;
37
37
  private _dataSource;
38
+ private _isSameInputDataSource;
38
39
  private _columns;
39
40
  private _footerDataSource?;
40
41
  static defaultIndents: TablePipelineIndentsConfig;
@@ -51,6 +52,7 @@ export declare class TablePipeline {
51
52
  appendRowPropsGetter(getter: RowPropsGetter): this;
52
53
  addTableProps(props: React.HTMLAttributes<HTMLTableElement>): void;
53
54
  getDataSource(name?: string): any[];
55
+ isSameInputDataSource(): boolean;
54
56
  getColumns(name?: string): any[];
55
57
  getFooterDataSource(): any[];
56
58
  getStateAtKey<T = any>(stateKey: string, defaultValue?: T): T;
@@ -76,6 +76,11 @@ export var TablePipeline = /*#__PURE__*/function () {
76
76
  return this._snapshots[name].dataSource;
77
77
  }
78
78
  }
79
+ }, {
80
+ key: "isSameInputDataSource",
81
+ value: function isSameInputDataSource() {
82
+ return this._isSameInputDataSource;
83
+ }
79
84
  }, {
80
85
  key: "getColumns",
81
86
  value: function getColumns(name) {
@@ -127,9 +132,12 @@ export var TablePipeline = /*#__PURE__*/function () {
127
132
 
128
133
  if (this._dataSource != null || this._columns != null) {
129
134
  throw new Error('input 不能调用两次');
130
- }
135
+ } // 在 pipeline 中识别本次更新是否有数据变化
136
+
131
137
 
138
+ this._isSameInputDataSource = _input.dataSource === this.ref.current._lastInputDataSource;
132
139
  this._dataSource = _input.dataSource;
140
+ this.ref.current._lastInputDataSource = _input.dataSource;
133
141
  this._columns = _mapInstanceProperty(_context = _input.columns).call(_context, function (col) {
134
142
  return _extends(_extends({}, col), {
135
143
  key: _this.guid()
@@ -488,7 +488,8 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
488
488
  }, /*#__PURE__*/_react.default.createElement("div", {
489
489
  className: (0, _classnames.default)(_styles.Classes.horizontalScrollLeftSpacer),
490
490
  style: {
491
- width: info.leftLockTotalWidth
491
+ width: info.leftLockTotalWidth,
492
+ display: hasStickyScroll && hasScroll ? 'block' : 'none'
492
493
  }
493
494
  }), /*#__PURE__*/_react.default.createElement("div", {
494
495
  className: (0, _classnames.default)(_styles.Classes.stickyScroll),
@@ -501,7 +502,8 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
501
502
  })), /*#__PURE__*/_react.default.createElement("div", {
502
503
  className: (0, _classnames.default)(_styles.Classes.horizontalScrollRightSpacer),
503
504
  style: {
504
- width: info.rightLockTotalWidth
505
+ width: info.rightLockTotalWidth,
506
+ display: hasStickyScroll && hasScroll ? 'block' : 'none'
505
507
  }
506
508
  }));
507
509
  }
@@ -111,7 +111,7 @@ function filter() {
111
111
  var colFilterIcon = (_f = (_e = col.features) === null || _e === void 0 ? void 0 : _e.filterIcon) !== null && _f !== void 0 ? _f : filterIcon;
112
112
 
113
113
  var _Filter = /*#__PURE__*/_react.default.createElement(_filter2.Filter, {
114
- key: "filter",
114
+ key: "".concat(col.code, "_filter"),
115
115
  FilterPanelContent: filterPanel,
116
116
  filterIcon: colFilterIcon,
117
117
  filterModel: inputFiltersMap.get(col.code),
@@ -101,6 +101,11 @@ function treeMode() {
101
101
  return pipeline.mapDataSource(processDataSource).mapColumns(processColumns);
102
102
 
103
103
  function processDataSource(input) {
104
+ if (pipeline.isSameInputDataSource() && openKeys === pipeline.getFeatureOptions('lastOpenKeys')) {
105
+ return pipeline.getFeatureOptions('lastTreeMode');
106
+ }
107
+
108
+ pipeline.setFeatureOptions('lastOpenKeys', pipeline.getStateAtKey(stateKey));
104
109
  var result = [];
105
110
  dfs(input, 0);
106
111
 
@@ -143,6 +148,7 @@ function treeMode() {
143
148
  }
144
149
  }
145
150
 
151
+ pipeline.setFeatureOptions('lastTreeMode', result);
146
152
  return result;
147
153
  }
148
154
 
@@ -35,6 +35,7 @@ export declare class TablePipeline {
35
35
  private readonly _rowPropsGetters;
36
36
  private _tableProps;
37
37
  private _dataSource;
38
+ private _isSameInputDataSource;
38
39
  private _columns;
39
40
  private _footerDataSource?;
40
41
  static defaultIndents: TablePipelineIndentsConfig;
@@ -51,6 +52,7 @@ export declare class TablePipeline {
51
52
  appendRowPropsGetter(getter: RowPropsGetter): this;
52
53
  addTableProps(props: React.HTMLAttributes<HTMLTableElement>): void;
53
54
  getDataSource(name?: string): any[];
55
+ isSameInputDataSource(): boolean;
54
56
  getColumns(name?: string): any[];
55
57
  getFooterDataSource(): any[];
56
58
  getStateAtKey<T = any>(stateKey: string, defaultValue?: T): T;
@@ -92,6 +92,11 @@ var TablePipeline = /*#__PURE__*/function () {
92
92
  return this._snapshots[name].dataSource;
93
93
  }
94
94
  }
95
+ }, {
96
+ key: "isSameInputDataSource",
97
+ value: function isSameInputDataSource() {
98
+ return this._isSameInputDataSource;
99
+ }
95
100
  }, {
96
101
  key: "getColumns",
97
102
  value: function getColumns(name) {
@@ -143,9 +148,12 @@ var TablePipeline = /*#__PURE__*/function () {
143
148
 
144
149
  if (this._dataSource != null || this._columns != null) {
145
150
  throw new Error('input 不能调用两次');
146
- }
151
+ } // 在 pipeline 中识别本次更新是否有数据变化
152
+
147
153
 
154
+ this._isSameInputDataSource = _input.dataSource === this.ref.current._lastInputDataSource;
148
155
  this._dataSource = _input.dataSource;
156
+ this.ref.current._lastInputDataSource = _input.dataSource;
149
157
  this._columns = (0, _map.default)(_context = _input.columns).call(_context, function (col) {
150
158
  return (0, _extends3.default)((0, _extends3.default)({}, col), {
151
159
  key: _this.guid()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kdcloudjs/table",
3
- "version": "1.2.0-canary.12",
3
+ "version": "1.2.0-canary.14",
4
4
  "description": "金蝶 react table 组件",
5
5
  "title": "table",
6
6
  "keywords": [