@lemon-fe/kits 1.0.0-44 → 1.0.0-46

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.
@@ -118,7 +118,7 @@ var DataGrid = /*#__PURE__*/function (_Component) {
118
118
 
119
119
  _defineProperty(_assertThisInitialized(_this), "api", new GridApi());
120
120
 
121
- _defineProperty(_assertThisInitialized(_this), "selected", new Selection());
121
+ _defineProperty(_assertThisInitialized(_this), "selected", void 0);
122
122
 
123
123
  _defineProperty(_assertThisInitialized(_this), "columnApi", new ColumnApi());
124
124
 
@@ -283,9 +283,7 @@ var DataGrid = /*#__PURE__*/function (_Component) {
283
283
  _props$rowSelection = _props$rowSelection === void 0 ? {} : _props$rowSelection;
284
284
  var _props$rowSelection$s = _props$rowSelection.selectedRowKeys,
285
285
  selectedRowKeys = _props$rowSelection$s === void 0 ? [] : _props$rowSelection$s;
286
- selectedRowKeys.forEach(function (key) {
287
- _this.selected.set(key, null);
288
- });
286
+ _this.selected = new Selection(selectedRowKeys);
289
287
 
290
288
  _this.syncColRender();
291
289
 
@@ -339,6 +337,9 @@ var DataGrid = /*#__PURE__*/function (_Component) {
339
337
 
340
338
  if (columns !== prevProps.columns) {
341
339
  this.syncColRender();
340
+ this.setState({
341
+ colDefs: this.getColumDefs()
342
+ });
342
343
  }
343
344
 
344
345
  if ((rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) !== ((_prevProps$rowSelecti = prevProps.rowSelection) === null || _prevProps$rowSelecti === void 0 ? void 0 : _prevProps$rowSelecti.selectedRowKeys)) {
@@ -31,6 +31,7 @@ export declare class Selection<T> {
31
31
  private record;
32
32
  private keys;
33
33
  private dirty;
34
+ constructor(keys?: string[]);
34
35
  get(id: string): T | undefined;
35
36
  has(id: string): boolean;
36
37
  set(id: string, data: T): void;
@@ -136,13 +136,20 @@ export var Store = /*#__PURE__*/function () {
136
136
  }();
137
137
  export var Selection = /*#__PURE__*/function () {
138
138
  function Selection() {
139
+ var keys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
140
+
139
141
  _classCallCheck(this, Selection);
140
142
 
141
- _defineProperty(this, "record", new Map());
143
+ _defineProperty(this, "record", void 0);
142
144
 
143
- _defineProperty(this, "keys", []);
145
+ _defineProperty(this, "keys", void 0);
144
146
 
145
147
  _defineProperty(this, "dirty", false);
148
+
149
+ this.record = new Map(keys.map(function (key) {
150
+ return [key, null];
151
+ }));
152
+ this.keys = keys;
146
153
  }
147
154
 
148
155
  _createClass(Selection, [{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/kits",
3
- "version": "1.0.0-44",
3
+ "version": "1.0.0-46",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",