@lemon-fe/components 1.5.7-alpha.5 → 1.5.7-alpha.7

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.
@@ -800,21 +800,28 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
800
800
  value: function componentWillUnmount() {
801
801
  if (this.isReady) {
802
802
  // 解决agGrid部分内存泄漏
803
-
803
+ var api = this.api;
804
+ setTimeout(function () {
805
+ // 由于下面代码是hack,所以需要捕获边界可能异常,防止崩溃
806
+ try {
807
+ api.setRowData([]);
808
+ api.setColumnDefs([]);
809
+ api.destroy();
810
+ var context = api.__getContext();
811
+ var gridOptionsService = context.getBean('gridOptionsService');
812
+ for (var field in gridOptionsService.gridOptions) {
813
+ delete gridOptionsService.gridOptions[field];
814
+ }
815
+ var userComponentFactory = context.getBean('userComponentFactory');
816
+ userComponentFactory.frameworkComponentWrapper.parent = null;
817
+ var eventService = context.getBean('eventService');
818
+ eventService.allAsyncListeners.clear();
819
+ eventService.globalAsyncListeners.clear();
820
+ } catch (err) {
821
+ console.error('DataGrid unmount error', err);
822
+ }
823
+ }, 0);
804
824
  this.dataSource = [];
805
- this.api.setRowData([]);
806
- this.api.setColumnDefs([]);
807
- this.api.destroy();
808
- var context = this.api.__getContext();
809
- var gridOptionsService = context.getBean('gridOptionsService');
810
- for (var field in gridOptionsService.gridOptions) {
811
- delete gridOptionsService.gridOptions[field];
812
- }
813
- var userComponentFactory = context.getBean('userComponentFactory');
814
- userComponentFactory.frameworkComponentWrapper.parent = null;
815
- var eventService = context.getBean('eventService');
816
- eventService.allAsyncListeners.clear();
817
- eventService.globalAsyncListeners.clear();
818
825
  this.api = new GridApi();
819
826
  this.columnApi = new ColumnApi();
820
827
  }
@@ -106,6 +106,7 @@ export default function SiderTree(props) {
106
106
  var roots = [];
107
107
  mData.forEach(function (item) {
108
108
  var node = _objectSpread(_objectSpread({}, item), {}, {
109
+ children: [],
109
110
  data: item
110
111
  });
111
112
  nodesIndex.set(item.key, node);
@@ -126,7 +127,6 @@ export default function SiderTree(props) {
126
127
  if (node.parent !== undefined) {
127
128
  var parentNode = nodesIndex.get(node.parent);
128
129
  if (parentNode && (matchedNodes.has(parentNode) || filterKeepParents)) {
129
- parentNode.children = parentNode.children || [];
130
130
  parentNode.children.push(node);
131
131
  collectAncestors(parentNode);
132
132
  } else {
@@ -138,7 +138,6 @@ export default function SiderTree(props) {
138
138
  };
139
139
  var collectChildren = function collectChildren(node) {
140
140
  var children = childrenIndex.get(node.key) || [];
141
- node.children = node.children || [];
142
141
  children.forEach(function (child) {
143
142
  if (addedNodes.has(child.key)) {
144
143
  return;
@@ -9,7 +9,7 @@ export interface TreeData<T = string | number> extends Omit<DataNode, 'children'
9
9
 
10
10
  export type TreeNode<T> = Omit<TreeData<T>, 'title'> & {
11
11
  title?: ReactNode;
12
- children?: TreeNode<T>[];
12
+ children: TreeNode<T>[];
13
13
  data: TreeData<T>;
14
14
  };
15
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/components",
3
- "version": "1.5.7-alpha.5",
3
+ "version": "1.5.7-alpha.7",
4
4
  "description": "> TODO: description",
5
5
  "homepage": "",
6
6
  "license": "MIT",
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "registry": "https://registry.npmjs.org"
60
60
  },
61
- "gitHead": "6171749dce121811f94a7d5d0c7e0c6782c5e4d5"
61
+ "gitHead": "101f32c5a6fd110b97e30e4e7f68631a02fd9151"
62
62
  }