@lemon-fe/components 1.2.14 → 1.3.0-alpha.0
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/es/data-grid/cell-editors/date.d.ts +2 -2
- package/es/data-grid/cell-editors/number.d.ts +2 -2
- package/es/data-grid/cell-editors/number.js +1 -4
- package/es/data-grid/cell-editors/row.d.ts +2 -2
- package/es/data-grid/cell-editors/select.d.ts +3 -3
- package/es/data-grid/cell-editors/text.d.ts +2 -2
- package/es/data-grid/cell-editors/utils.d.ts +1 -1
- package/es/data-grid/components/custom-panel/index.d.ts +1 -1
- package/es/data-grid/components/custom-panel/item.d.ts +1 -1
- package/es/data-grid/components/custom-panel/typings.d.ts +1 -1
- package/es/data-grid/index.d.ts +8 -7
- package/es/data-grid/index.js +39 -21
- package/es/data-grid/index.less +1 -1
- package/es/data-grid/locale/en_US.js +3 -1
- package/es/data-grid/locale/zh_CN.js +3 -1
- package/es/data-grid/renderer/actions-renderer.d.ts +1 -1
- package/es/data-grid/renderer/actions.d.ts +1 -1
- package/es/data-grid/renderer/cell-delete-renderer.d.ts +1 -1
- package/es/data-grid/renderer/cell-index-renderer.d.ts +1 -1
- package/es/data-grid/renderer/cell-renderer.d.ts +1 -1
- package/es/data-grid/renderer/detali-cell-renderer.d.ts +1 -1
- package/es/data-grid/renderer/header-renderer.d.ts +1 -1
- package/es/data-grid/renderer/header-renderer.js +0 -1
- package/es/data-grid/typings.d.ts +2 -2
- package/es/data-grid/utils.d.ts +1 -1
- package/es/index.d.ts +4 -3
- package/es/index.js +4 -2
- package/es/select-view/index.d.ts +1 -1
- package/package.json +5 -14
- package/es/data-grid/modules/clipboard/clipboard/clipboardService.d.ts +0 -62
- package/es/data-grid/modules/clipboard/clipboard/clipboardService.js +0 -1007
- package/es/data-grid/modules/clipboard/clipboardModule.d.ts +0 -2
- package/es/data-grid/modules/clipboard/clipboardModule.js +0 -10
- package/es/data-grid/modules/clipboard/main.d.ts +0 -1
- package/es/data-grid/modules/clipboard/main.js +0 -1
- package/es/data-grid/modules/clipboard/version.d.ts +0 -1
- package/es/data-grid/modules/clipboard/version.js +0 -2
- package/es/data-grid/modules/column-tool-panel/columnToolPanel/columnModelItem.d.ts +0 -26
- package/es/data-grid/modules/column-tool-panel/columnToolPanel/columnModelItem.js +0 -94
- package/es/data-grid/modules/column-tool-panel/columnToolPanel/columnToolPanel.d.ts +0 -32
- package/es/data-grid/modules/column-tool-panel/columnToolPanel/columnToolPanel.js +0 -272
- package/es/data-grid/modules/column-tool-panel/columnToolPanel/modelItemUtils.d.ts +0 -16
- package/es/data-grid/modules/column-tool-panel/columnToolPanel/modelItemUtils.js +0 -209
- package/es/data-grid/modules/column-tool-panel/columnToolPanel/pivotModePanel.d.ts +0 -9
- package/es/data-grid/modules/column-tool-panel/columnToolPanel/pivotModePanel.js +0 -68
- package/es/data-grid/modules/column-tool-panel/columnToolPanel/primaryColsHeaderPanel.d.ts +0 -32
- package/es/data-grid/modules/column-tool-panel/columnToolPanel/primaryColsHeaderPanel.js +0 -150
- package/es/data-grid/modules/column-tool-panel/columnToolPanel/primaryColsListPanel.d.ts +0 -44
- package/es/data-grid/modules/column-tool-panel/columnToolPanel/primaryColsListPanel.js +0 -455
- package/es/data-grid/modules/column-tool-panel/columnToolPanel/primaryColsListPanelItemDragFeature.d.ts +0 -26
- package/es/data-grid/modules/column-tool-panel/columnToolPanel/primaryColsListPanelItemDragFeature.js +0 -224
- package/es/data-grid/modules/column-tool-panel/columnToolPanel/primaryColsPanel.d.ts +0 -24
- package/es/data-grid/modules/column-tool-panel/columnToolPanel/primaryColsPanel.js +0 -123
- package/es/data-grid/modules/column-tool-panel/columnToolPanel/toolPanelColumnComp.d.ts +0 -37
- package/es/data-grid/modules/column-tool-panel/columnToolPanel/toolPanelColumnComp.js +0 -314
- package/es/data-grid/modules/column-tool-panel/columnToolPanel/toolPanelColumnGroupComp.d.ts +0 -51
- package/es/data-grid/modules/column-tool-panel/columnToolPanel/toolPanelColumnGroupComp.js +0 -406
- package/es/data-grid/modules/column-tool-panel/columnToolPanel/toolPanelContextMenu.d.ts +0 -24
- package/es/data-grid/modules/column-tool-panel/columnToolPanel/toolPanelContextMenu.js +0 -264
- package/es/data-grid/modules/column-tool-panel/columnsToolPanelModule.d.ts +0 -2
- package/es/data-grid/modules/column-tool-panel/columnsToolPanelModule.js +0 -29
- package/es/data-grid/modules/column-tool-panel/main.d.ts +0 -2
- package/es/data-grid/modules/column-tool-panel/main.js +0 -3
- package/es/data-grid/modules/column-tool-panel/version.d.ts +0 -1
- package/es/data-grid/modules/column-tool-panel/version.js +0 -2
- package/es/data-grid/modules/master-detail/main.d.ts +0 -1
- package/es/data-grid/modules/master-detail/main.js +0 -1
- package/es/data-grid/modules/master-detail/masterDetail/detailCellRenderer.d.ts +0 -14
- package/es/data-grid/modules/master-detail/masterDetail/detailCellRenderer.js +0 -144
- package/es/data-grid/modules/master-detail/masterDetail/detailCellRendererCtrl.d.ts +0 -19
- package/es/data-grid/modules/master-detail/masterDetail/detailCellRendererCtrl.js +0 -203
- package/es/data-grid/modules/master-detail/masterDetailModule.d.ts +0 -2
- package/es/data-grid/modules/master-detail/masterDetailModule.js +0 -18
- package/es/data-grid/modules/master-detail/version.d.ts +0 -1
- package/es/data-grid/modules/master-detail/version.js +0 -2
- package/es/data-grid/modules/menu/main.d.ts +0 -1
- package/es/data-grid/modules/menu/main.js +0 -1
- package/es/data-grid/modules/menu/menu/chartMenuItemMapper.d.ts +0 -13
- package/es/data-grid/modules/menu/menu/chartMenuItemMapper.js +0 -351
- package/es/data-grid/modules/menu/menu/contextMenu.d.ts +0 -13
- package/es/data-grid/modules/menu/menu/contextMenu.js +0 -267
- package/es/data-grid/modules/menu/menu/enterpriseMenu.d.ts +0 -66
- package/es/data-grid/modules/menu/menu/enterpriseMenu.js +0 -592
- package/es/data-grid/modules/menu/menu/menuItemMapper.d.ts +0 -13
- package/es/data-grid/modules/menu/menu/menuItemMapper.js +0 -328
- package/es/data-grid/modules/menu/menuModule.d.ts +0 -2
- package/es/data-grid/modules/menu/menuModule.js +0 -12
- package/es/data-grid/modules/menu/version.d.ts +0 -1
- package/es/data-grid/modules/menu/version.js +0 -2
- package/es/data-grid/modules/row-grouping/main.d.ts +0 -4
- package/es/data-grid/modules/row-grouping/main.js +0 -4
- package/es/data-grid/modules/row-grouping/rowGrouping/aggFuncService.d.ts +0 -23
- package/es/data-grid/modules/row-grouping/rowGrouping/aggFuncService.js +0 -250
- package/es/data-grid/modules/row-grouping/rowGrouping/aggregationStage.d.ts +0 -22
- package/es/data-grid/modules/row-grouping/rowGrouping/aggregationStage.js +0 -285
- package/es/data-grid/modules/row-grouping/rowGrouping/batchRemover.d.ts +0 -12
- package/es/data-grid/modules/row-grouping/rowGrouping/batchRemover.js +0 -77
- package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/baseDropZonePanel.d.ts +0 -75
- package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/baseDropZonePanel.js +0 -516
- package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/dropZoneColumnComp.d.ts +0 -40
- package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/dropZoneColumnComp.js +0 -367
- package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/gridHeaderDropZones.d.ts +0 -11
- package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/gridHeaderDropZones.js +0 -85
- package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/pivotDropZonePanel.d.ts +0 -17
- package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/pivotDropZonePanel.js +0 -139
- package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/rowGroupDropZonePanel.d.ts +0 -15
- package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/rowGroupDropZonePanel.js +0 -105
- package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/valueDropZonePanel.d.ts +0 -15
- package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/valueDropZonePanel.js +0 -105
- package/es/data-grid/modules/row-grouping/rowGrouping/filterAggregatesStage.d.ts +0 -9
- package/es/data-grid/modules/row-grouping/rowGrouping/filterAggregatesStage.js +0 -136
- package/es/data-grid/modules/row-grouping/rowGrouping/groupFilter/groupFilter.d.ts +0 -39
- package/es/data-grid/modules/row-grouping/rowGrouping/groupFilter/groupFilter.js +0 -319
- package/es/data-grid/modules/row-grouping/rowGrouping/groupFilter/groupFloatingFilter.d.ts +0 -23
- package/es/data-grid/modules/row-grouping/rowGrouping/groupFilter/groupFloatingFilter.js +0 -163
- package/es/data-grid/modules/row-grouping/rowGrouping/groupStage.d.ts +0 -48
- package/es/data-grid/modules/row-grouping/rowGrouping/groupStage.js +0 -740
- package/es/data-grid/modules/row-grouping/rowGrouping/pivotColDefService.d.ts +0 -24
- package/es/data-grid/modules/row-grouping/rowGrouping/pivotColDefService.js +0 -396
- package/es/data-grid/modules/row-grouping/rowGrouping/pivotStage.d.ts +0 -19
- package/es/data-grid/modules/row-grouping/rowGrouping/pivotStage.js +0 -182
- package/es/data-grid/modules/row-grouping/rowGroupingModule.d.ts +0 -2
- package/es/data-grid/modules/row-grouping/rowGroupingModule.js +0 -28
- package/es/data-grid/modules/row-grouping/version.d.ts +0 -1
- package/es/data-grid/modules/row-grouping/version.js +0 -2
- package/es/data-grid/modules/side-bar/main.d.ts +0 -2
- package/es/data-grid/modules/side-bar/main.js +0 -2
- package/es/data-grid/modules/side-bar/sideBar/common/toolPanelColDefService.d.ts +0 -11
- package/es/data-grid/modules/side-bar/sideBar/common/toolPanelColDefService.js +0 -216
- package/es/data-grid/modules/side-bar/sideBar/horizontalResizeComp.d.ts +0 -19
- package/es/data-grid/modules/side-bar/sideBar/horizontalResizeComp.js +0 -108
- package/es/data-grid/modules/side-bar/sideBar/sideBarButtonComp.d.ts +0 -16
- package/es/data-grid/modules/side-bar/sideBar/sideBarButtonComp.js +0 -84
- package/es/data-grid/modules/side-bar/sideBar/sideBarButtonsComp.d.ts +0 -18
- package/es/data-grid/modules/side-bar/sideBar/sideBarButtonsComp.js +0 -89
- package/es/data-grid/modules/side-bar/sideBar/sideBarComp.d.ts +0 -28
- package/es/data-grid/modules/side-bar/sideBar/sideBarComp.js +0 -325
- package/es/data-grid/modules/side-bar/sideBar/sideBarDefParser.d.ts +0 -10
- package/es/data-grid/modules/side-bar/sideBar/sideBarDefParser.js +0 -95
- package/es/data-grid/modules/side-bar/sideBar/toolPanelWrapper.d.ts +0 -17
- package/es/data-grid/modules/side-bar/sideBar/toolPanelWrapper.js +0 -103
- package/es/data-grid/modules/side-bar/sideBarModule.d.ts +0 -2
- package/es/data-grid/modules/side-bar/sideBarModule.js +0 -22
- package/es/data-grid/modules/side-bar/version.d.ts +0 -1
- package/es/data-grid/modules/side-bar/version.js +0 -2
|
@@ -1,740 +0,0 @@
|
|
|
1
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
3
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
4
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
5
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
7
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
8
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
10
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
11
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
13
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
14
|
-
var __decorate = this && this.__decorate || function (decorators, target, key, desc) {
|
|
15
|
-
var c = arguments.length,
|
|
16
|
-
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
17
|
-
d;
|
|
18
|
-
if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
19
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
20
|
-
};
|
|
21
|
-
import { _, Autowired, Bean, BeanStub, NumberSequence, PostConstruct, RowNode } from "@ag-grid-community/core";
|
|
22
|
-
import { BatchRemover } from "./batchRemover";
|
|
23
|
-
var GroupStage = /*#__PURE__*/function (_BeanStub) {
|
|
24
|
-
_inherits(GroupStage, _BeanStub);
|
|
25
|
-
var _super = _createSuper(GroupStage);
|
|
26
|
-
function GroupStage() {
|
|
27
|
-
var _this;
|
|
28
|
-
_classCallCheck(this, GroupStage);
|
|
29
|
-
_this = _super.apply(this, arguments);
|
|
30
|
-
// we use a sequence variable so that each time we do a grouping, we don't
|
|
31
|
-
// reuse the ids - otherwise the rowRenderer will confuse rowNodes between redraws
|
|
32
|
-
// when it tries to animate between rows.
|
|
33
|
-
_this.groupIdSequence = new NumberSequence();
|
|
34
|
-
return _this;
|
|
35
|
-
}
|
|
36
|
-
_createClass(GroupStage, [{
|
|
37
|
-
key: "postConstruct",
|
|
38
|
-
value: function postConstruct() {
|
|
39
|
-
this.usingTreeData = this.gridOptionsService.isTreeData();
|
|
40
|
-
if (this.usingTreeData) {
|
|
41
|
-
this.getDataPath = this.gridOptionsService.get('getDataPath');
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}, {
|
|
45
|
-
key: "execute",
|
|
46
|
-
value: function execute(params) {
|
|
47
|
-
var details = this.createGroupingDetails(params);
|
|
48
|
-
if (details.transactions) {
|
|
49
|
-
this.handleTransaction(details);
|
|
50
|
-
} else {
|
|
51
|
-
var afterColsChanged = params.afterColumnsChanged === true;
|
|
52
|
-
this.shotgunResetEverything(details, afterColsChanged);
|
|
53
|
-
}
|
|
54
|
-
this.positionLeafsAndGroups(params.changedPath);
|
|
55
|
-
this.orderGroups(details.rootNode);
|
|
56
|
-
this.selectableService.updateSelectableAfterGrouping(details.rootNode);
|
|
57
|
-
}
|
|
58
|
-
}, {
|
|
59
|
-
key: "positionLeafsAndGroups",
|
|
60
|
-
value: function positionLeafsAndGroups(changedPath) {
|
|
61
|
-
// we don't do group sorting for tree data
|
|
62
|
-
if (this.usingTreeData) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
changedPath.forEachChangedNodeDepthFirst(function (group) {
|
|
66
|
-
if (group.childrenAfterGroup) {
|
|
67
|
-
var leafNodes = [];
|
|
68
|
-
var groupNodes = [];
|
|
69
|
-
var unbalancedNode;
|
|
70
|
-
group.childrenAfterGroup.forEach(function (row) {
|
|
71
|
-
var _a;
|
|
72
|
-
if (!((_a = row.childrenAfterGroup) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
73
|
-
leafNodes.push(row);
|
|
74
|
-
} else {
|
|
75
|
-
if (row.key === '' && !unbalancedNode) {
|
|
76
|
-
unbalancedNode = row;
|
|
77
|
-
} else {
|
|
78
|
-
groupNodes.push(row);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
if (unbalancedNode) {
|
|
83
|
-
groupNodes.push(unbalancedNode);
|
|
84
|
-
}
|
|
85
|
-
group.childrenAfterGroup = [].concat(leafNodes, groupNodes);
|
|
86
|
-
}
|
|
87
|
-
}, false);
|
|
88
|
-
}
|
|
89
|
-
}, {
|
|
90
|
-
key: "createGroupingDetails",
|
|
91
|
-
value: function createGroupingDetails(params) {
|
|
92
|
-
var rowNode = params.rowNode,
|
|
93
|
-
changedPath = params.changedPath,
|
|
94
|
-
rowNodeTransactions = params.rowNodeTransactions,
|
|
95
|
-
rowNodeOrder = params.rowNodeOrder;
|
|
96
|
-
var groupedCols = this.usingTreeData ? null : this.columnModel.getRowGroupColumns();
|
|
97
|
-
var details = {
|
|
98
|
-
// someone complained that the parent attribute was causing some change detection
|
|
99
|
-
// to break is some angular add-on - which i never used. taking the parent out breaks
|
|
100
|
-
// a cyclic dependency, hence this flag got introduced.
|
|
101
|
-
includeParents: !this.gridOptionsService.is('suppressParentsInRowNodes'),
|
|
102
|
-
expandByDefault: this.gridOptionsService.getNum('groupDefaultExpanded'),
|
|
103
|
-
groupedCols: groupedCols,
|
|
104
|
-
rootNode: rowNode,
|
|
105
|
-
pivotMode: this.columnModel.isPivotMode(),
|
|
106
|
-
groupedColCount: this.usingTreeData || !groupedCols ? 0 : groupedCols.length,
|
|
107
|
-
rowNodeOrder: rowNodeOrder,
|
|
108
|
-
transactions: rowNodeTransactions,
|
|
109
|
-
// if no transaction, then it's shotgun, changed path would be 'not active' at this point anyway
|
|
110
|
-
changedPath: changedPath
|
|
111
|
-
};
|
|
112
|
-
return details;
|
|
113
|
-
}
|
|
114
|
-
}, {
|
|
115
|
-
key: "handleTransaction",
|
|
116
|
-
value: function handleTransaction(details) {
|
|
117
|
-
var _this2 = this;
|
|
118
|
-
details.transactions.forEach(function (tran) {
|
|
119
|
-
// we don't allow batch remover for tree data as tree data uses Filler Nodes,
|
|
120
|
-
// and creating/deleting filler nodes needs to be done alongside the node deleting
|
|
121
|
-
// and moving. if we want to Batch Remover working with tree data then would need
|
|
122
|
-
// to consider how Filler Nodes would be impacted (it's possible that it can be easily
|
|
123
|
-
// modified to work, however for now I don't have the brain energy to work it all out).
|
|
124
|
-
var batchRemover = !_this2.usingTreeData ? new BatchRemover() : undefined;
|
|
125
|
-
// the order here of [add, remove, update] needs to be the same as in ClientSideNodeManager,
|
|
126
|
-
// as the order is important when a record with the same id is added and removed in the same
|
|
127
|
-
// transaction.
|
|
128
|
-
if (_.existsAndNotEmpty(tran.remove)) {
|
|
129
|
-
_this2.removeNodes(tran.remove, details, batchRemover);
|
|
130
|
-
}
|
|
131
|
-
if (_.existsAndNotEmpty(tran.update)) {
|
|
132
|
-
_this2.moveNodesInWrongPath(tran.update, details, batchRemover);
|
|
133
|
-
}
|
|
134
|
-
if (_.existsAndNotEmpty(tran.add)) {
|
|
135
|
-
_this2.insertNodes(tran.add, details, false);
|
|
136
|
-
}
|
|
137
|
-
// must flush here, and not allow another transaction to be applied,
|
|
138
|
-
// as each transaction must finish leaving the data in a consistent state.
|
|
139
|
-
if (batchRemover) {
|
|
140
|
-
var parentsWithChildrenRemoved = batchRemover.getAllParents().slice();
|
|
141
|
-
batchRemover.flush();
|
|
142
|
-
_this2.removeEmptyGroups(parentsWithChildrenRemoved, details);
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
if (details.rowNodeOrder) {
|
|
146
|
-
this.sortChildren(details);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
// this is used when doing delta updates, eg Redux, keeps nodes in right order
|
|
150
|
-
}, {
|
|
151
|
-
key: "sortChildren",
|
|
152
|
-
value: function sortChildren(details) {
|
|
153
|
-
details.changedPath.forEachChangedNodeDepthFirst(function (node) {
|
|
154
|
-
if (!node.childrenAfterGroup) {
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
var didSort = _.sortRowNodesByOrder(node.childrenAfterGroup, details.rowNodeOrder);
|
|
158
|
-
if (didSort) {
|
|
159
|
-
details.changedPath.addParentNode(node);
|
|
160
|
-
}
|
|
161
|
-
}, false, true);
|
|
162
|
-
}
|
|
163
|
-
}, {
|
|
164
|
-
key: "orderGroups",
|
|
165
|
-
value: function orderGroups(rootNode) {
|
|
166
|
-
// we don't do group sorting for tree data
|
|
167
|
-
if (this.usingTreeData) {
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
var comparator = this.getInitialGroupOrderComparator();
|
|
171
|
-
if (_.exists(comparator)) {
|
|
172
|
-
recursiveSort(rootNode);
|
|
173
|
-
}
|
|
174
|
-
function recursiveSort(rowNode) {
|
|
175
|
-
var doSort = _.exists(rowNode.childrenAfterGroup) &&
|
|
176
|
-
// we only want to sort groups, so we do not sort leafs (a leaf group has leafs as children)
|
|
177
|
-
!rowNode.leafGroup;
|
|
178
|
-
if (doSort) {
|
|
179
|
-
rowNode.childrenAfterGroup.sort(function (nodeA, nodeB) {
|
|
180
|
-
return comparator({
|
|
181
|
-
nodeA: nodeA,
|
|
182
|
-
nodeB: nodeB
|
|
183
|
-
});
|
|
184
|
-
});
|
|
185
|
-
rowNode.childrenAfterGroup.forEach(function (childNode) {
|
|
186
|
-
return recursiveSort(childNode);
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}, {
|
|
192
|
-
key: "getInitialGroupOrderComparator",
|
|
193
|
-
value: function getInitialGroupOrderComparator() {
|
|
194
|
-
var initialGroupOrderComparator = this.gridOptionsService.getCallback('initialGroupOrderComparator');
|
|
195
|
-
if (initialGroupOrderComparator) {
|
|
196
|
-
return initialGroupOrderComparator;
|
|
197
|
-
}
|
|
198
|
-
// this is the deprecated way, so provide a proxy to make it compatible
|
|
199
|
-
var defaultGroupOrderComparator = this.gridOptionsService.get('defaultGroupOrderComparator');
|
|
200
|
-
if (defaultGroupOrderComparator) {
|
|
201
|
-
return function (params) {
|
|
202
|
-
return defaultGroupOrderComparator(params.nodeA, params.nodeB);
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}, {
|
|
207
|
-
key: "getExistingPathForNode",
|
|
208
|
-
value: function getExistingPathForNode(node, details) {
|
|
209
|
-
var res = [];
|
|
210
|
-
// when doing tree data, the node is part of the path,
|
|
211
|
-
// but when doing grid grouping, the node is not part of the path so we start with the parent.
|
|
212
|
-
var pointer = this.usingTreeData ? node : node.parent;
|
|
213
|
-
while (pointer && pointer !== details.rootNode) {
|
|
214
|
-
res.push({
|
|
215
|
-
key: pointer.key,
|
|
216
|
-
rowGroupColumn: pointer.rowGroupColumn,
|
|
217
|
-
field: pointer.field
|
|
218
|
-
});
|
|
219
|
-
pointer = pointer.parent;
|
|
220
|
-
}
|
|
221
|
-
res.reverse();
|
|
222
|
-
return res;
|
|
223
|
-
}
|
|
224
|
-
}, {
|
|
225
|
-
key: "moveNodesInWrongPath",
|
|
226
|
-
value: function moveNodesInWrongPath(childNodes, details, batchRemover) {
|
|
227
|
-
var _this3 = this;
|
|
228
|
-
childNodes.forEach(function (childNode) {
|
|
229
|
-
// we add node, even if parent has not changed, as the data could have
|
|
230
|
-
// changed, hence aggregations will be wrong
|
|
231
|
-
if (details.changedPath.isActive()) {
|
|
232
|
-
details.changedPath.addParentNode(childNode.parent);
|
|
233
|
-
}
|
|
234
|
-
var infoToKeyMapper = function infoToKeyMapper(item) {
|
|
235
|
-
return item.key;
|
|
236
|
-
};
|
|
237
|
-
var oldPath = _this3.getExistingPathForNode(childNode, details).map(infoToKeyMapper);
|
|
238
|
-
var newPath = _this3.getGroupInfo(childNode, details).map(infoToKeyMapper);
|
|
239
|
-
var nodeInCorrectPath = _.areEqual(oldPath, newPath);
|
|
240
|
-
if (!nodeInCorrectPath) {
|
|
241
|
-
_this3.moveNode(childNode, details, batchRemover);
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
}, {
|
|
246
|
-
key: "moveNode",
|
|
247
|
-
value: function moveNode(childNode, details, batchRemover) {
|
|
248
|
-
this.removeNodesInStages([childNode], details, batchRemover);
|
|
249
|
-
this.insertOneNode(childNode, details, true, batchRemover);
|
|
250
|
-
// hack - if we didn't do this, then renaming a tree item (ie changing rowNode.key) wouldn't get
|
|
251
|
-
// refreshed into the gui.
|
|
252
|
-
// this is needed to kick off the event that rowComp listens to for refresh. this in turn
|
|
253
|
-
// then will get each cell in the row to refresh - which is what we need as we don't know which
|
|
254
|
-
// columns will be displaying the rowNode.key info.
|
|
255
|
-
childNode.setData(childNode.data);
|
|
256
|
-
// we add both old and new parents to changed path, as both will need to be refreshed.
|
|
257
|
-
// we already added the old parent (in calling method), so just add the new parent here
|
|
258
|
-
if (details.changedPath.isActive()) {
|
|
259
|
-
var newParent = childNode.parent;
|
|
260
|
-
details.changedPath.addParentNode(newParent);
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
}, {
|
|
264
|
-
key: "removeNodes",
|
|
265
|
-
value: function removeNodes(leafRowNodes, details, batchRemover) {
|
|
266
|
-
this.removeNodesInStages(leafRowNodes, details, batchRemover);
|
|
267
|
-
if (details.changedPath.isActive()) {
|
|
268
|
-
leafRowNodes.forEach(function (rowNode) {
|
|
269
|
-
return details.changedPath.addParentNode(rowNode.parent);
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
}, {
|
|
274
|
-
key: "removeNodesInStages",
|
|
275
|
-
value: function removeNodesInStages(leafRowNodes, details, batchRemover) {
|
|
276
|
-
this.removeNodesFromParents(leafRowNodes, details, batchRemover);
|
|
277
|
-
if (this.usingTreeData) {
|
|
278
|
-
this.postRemoveCreateFillerNodes(leafRowNodes, details);
|
|
279
|
-
// When not TreeData, then removeEmptyGroups is called just before the BatchRemover is flushed.
|
|
280
|
-
// However for TreeData, there is no BatchRemover, so we have to call removeEmptyGroups here.
|
|
281
|
-
var nodeParents = leafRowNodes.map(function (n) {
|
|
282
|
-
return n.parent;
|
|
283
|
-
});
|
|
284
|
-
this.removeEmptyGroups(nodeParents, details);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
}, {
|
|
288
|
-
key: "forEachParentGroup",
|
|
289
|
-
value: function forEachParentGroup(details, group, callback) {
|
|
290
|
-
var pointer = group;
|
|
291
|
-
while (pointer && pointer !== details.rootNode) {
|
|
292
|
-
callback(pointer);
|
|
293
|
-
pointer = pointer.parent;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
}, {
|
|
297
|
-
key: "removeNodesFromParents",
|
|
298
|
-
value: function removeNodesFromParents(nodesToRemove, details, provided) {
|
|
299
|
-
var _this4 = this;
|
|
300
|
-
// this method can be called with BatchRemover as optional. if it is missed, we created a local version
|
|
301
|
-
// and flush it at the end. if one is provided, we add to the provided one and it gets flushed elsewhere.
|
|
302
|
-
var batchRemoverIsLocal = provided == null;
|
|
303
|
-
var batchRemoverToUse = provided ? provided : new BatchRemover();
|
|
304
|
-
nodesToRemove.forEach(function (nodeToRemove) {
|
|
305
|
-
_this4.removeFromParent(nodeToRemove, batchRemoverToUse);
|
|
306
|
-
// remove from allLeafChildren. we clear down all parents EXCEPT the Root Node, as
|
|
307
|
-
// the ClientSideNodeManager is responsible for the Root Node.
|
|
308
|
-
_this4.forEachParentGroup(details, nodeToRemove.parent, function (parentNode) {
|
|
309
|
-
batchRemoverToUse.removeFromAllLeafChildren(parentNode, nodeToRemove);
|
|
310
|
-
});
|
|
311
|
-
});
|
|
312
|
-
if (batchRemoverIsLocal) {
|
|
313
|
-
batchRemoverToUse.flush();
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
}, {
|
|
317
|
-
key: "postRemoveCreateFillerNodes",
|
|
318
|
-
value: function postRemoveCreateFillerNodes(nodesToRemove, details) {
|
|
319
|
-
var _this5 = this;
|
|
320
|
-
nodesToRemove.forEach(function (nodeToRemove) {
|
|
321
|
-
// if not group, and children are present, need to move children to a group.
|
|
322
|
-
// otherwise if no children, we can just remove without replacing.
|
|
323
|
-
var replaceWithGroup = nodeToRemove.hasChildren();
|
|
324
|
-
if (replaceWithGroup) {
|
|
325
|
-
var oldPath = _this5.getExistingPathForNode(nodeToRemove, details);
|
|
326
|
-
// because we just removed the userGroup, this will always return new support group
|
|
327
|
-
var newGroupNode = _this5.findParentForNode(nodeToRemove, oldPath, details);
|
|
328
|
-
// these properties are the ones that will be incorrect in the newly created group,
|
|
329
|
-
// so copy them from the old childNode
|
|
330
|
-
newGroupNode.expanded = nodeToRemove.expanded;
|
|
331
|
-
newGroupNode.allLeafChildren = nodeToRemove.allLeafChildren;
|
|
332
|
-
newGroupNode.childrenAfterGroup = nodeToRemove.childrenAfterGroup;
|
|
333
|
-
newGroupNode.childrenMapped = nodeToRemove.childrenMapped;
|
|
334
|
-
newGroupNode.updateHasChildren();
|
|
335
|
-
newGroupNode.childrenAfterGroup.forEach(function (rowNode) {
|
|
336
|
-
return rowNode.parent = newGroupNode;
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
});
|
|
340
|
-
}
|
|
341
|
-
}, {
|
|
342
|
-
key: "removeEmptyGroups",
|
|
343
|
-
value: function removeEmptyGroups(possibleEmptyGroups, details) {
|
|
344
|
-
var _this6 = this;
|
|
345
|
-
// we do this multiple times, as when we remove groups, that means the parent of just removed
|
|
346
|
-
// group can then be empty. to get around this, if we remove, then we check everything again for
|
|
347
|
-
// newly emptied groups. the max number of times this will execute is the depth of the group tree.
|
|
348
|
-
var checkAgain = true;
|
|
349
|
-
var groupShouldBeRemoved = function groupShouldBeRemoved(rowNode) {
|
|
350
|
-
// because of the while loop below, it's possible we already moved the node,
|
|
351
|
-
// so double check before trying to remove again.
|
|
352
|
-
var mapKey = _this6.getChildrenMappedKey(rowNode.key, rowNode.rowGroupColumn);
|
|
353
|
-
var parentRowNode = rowNode.parent;
|
|
354
|
-
var groupAlreadyRemoved = parentRowNode && parentRowNode.childrenMapped ? !parentRowNode.childrenMapped[mapKey] : true;
|
|
355
|
-
if (groupAlreadyRemoved) {
|
|
356
|
-
// if not linked, then group was already removed
|
|
357
|
-
return false;
|
|
358
|
-
}
|
|
359
|
-
// if still not removed, then we remove if this group is empty
|
|
360
|
-
return !!rowNode.isEmptyRowGroupNode();
|
|
361
|
-
};
|
|
362
|
-
var _loop = function _loop() {
|
|
363
|
-
checkAgain = false;
|
|
364
|
-
var batchRemover = new BatchRemover();
|
|
365
|
-
possibleEmptyGroups.forEach(function (possibleEmptyGroup) {
|
|
366
|
-
// remove empty groups
|
|
367
|
-
_this6.forEachParentGroup(details, possibleEmptyGroup, function (rowNode) {
|
|
368
|
-
if (groupShouldBeRemoved(rowNode)) {
|
|
369
|
-
checkAgain = true;
|
|
370
|
-
_this6.removeFromParent(rowNode, batchRemover);
|
|
371
|
-
// we remove selection on filler nodes here, as the selection would not be removed
|
|
372
|
-
// from the RowNodeManager, as filler nodes don't exist on the RowNodeManager
|
|
373
|
-
rowNode.setSelectedParams({
|
|
374
|
-
newValue: false,
|
|
375
|
-
source: 'rowGroupChanged'
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
});
|
|
379
|
-
});
|
|
380
|
-
batchRemover.flush();
|
|
381
|
-
};
|
|
382
|
-
while (checkAgain) {
|
|
383
|
-
_loop();
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
// removes the node from the parent by:
|
|
387
|
-
// a) removing from childrenAfterGroup (using batchRemover if present, otherwise immediately)
|
|
388
|
-
// b) removing from childrenMapped (immediately)
|
|
389
|
-
// c) setRowTop(null) - as the rowRenderer uses this to know the RowNode is no longer needed
|
|
390
|
-
// d) setRowIndex(null) - as the rowNode will no longer be displayed.
|
|
391
|
-
}, {
|
|
392
|
-
key: "removeFromParent",
|
|
393
|
-
value: function removeFromParent(child, batchRemover) {
|
|
394
|
-
if (child.parent) {
|
|
395
|
-
if (batchRemover) {
|
|
396
|
-
batchRemover.removeFromChildrenAfterGroup(child.parent, child);
|
|
397
|
-
} else {
|
|
398
|
-
_.removeFromArray(child.parent.childrenAfterGroup, child);
|
|
399
|
-
child.parent.updateHasChildren();
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
var mapKey = this.getChildrenMappedKey(child.key, child.rowGroupColumn);
|
|
403
|
-
if (child.parent && child.parent.childrenMapped) {
|
|
404
|
-
child.parent.childrenMapped[mapKey] = undefined;
|
|
405
|
-
}
|
|
406
|
-
// this is important for transition, see rowComp removeFirstPassFuncs. when doing animation and
|
|
407
|
-
// remove, if rowTop is still present, the rowComp thinks it's just moved position.
|
|
408
|
-
child.setRowTop(null);
|
|
409
|
-
child.setRowIndex(null);
|
|
410
|
-
}
|
|
411
|
-
}, {
|
|
412
|
-
key: "addToParent",
|
|
413
|
-
value: function addToParent(child, parent) {
|
|
414
|
-
var mapKey = this.getChildrenMappedKey(child.key, child.rowGroupColumn);
|
|
415
|
-
if (parent) {
|
|
416
|
-
var children = parent.childrenMapped != null;
|
|
417
|
-
if (children) {
|
|
418
|
-
parent.childrenMapped[mapKey] = child;
|
|
419
|
-
}
|
|
420
|
-
parent.childrenAfterGroup.push(child);
|
|
421
|
-
parent.updateHasChildren();
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
}, {
|
|
425
|
-
key: "areGroupColsEqual",
|
|
426
|
-
value: function areGroupColsEqual(d1, d2) {
|
|
427
|
-
if (d1 == null || d2 == null || d1.pivotMode !== d2.pivotMode) {
|
|
428
|
-
return false;
|
|
429
|
-
}
|
|
430
|
-
return _.areEqual(d1.groupedCols, d2.groupedCols);
|
|
431
|
-
}
|
|
432
|
-
}, {
|
|
433
|
-
key: "checkAllGroupDataAfterColsChanged",
|
|
434
|
-
value: function checkAllGroupDataAfterColsChanged(details) {
|
|
435
|
-
var _this7 = this;
|
|
436
|
-
var recurse = function recurse(rowNodes) {
|
|
437
|
-
if (!rowNodes) {
|
|
438
|
-
return;
|
|
439
|
-
}
|
|
440
|
-
rowNodes.forEach(function (rowNode) {
|
|
441
|
-
var isLeafNode = !_this7.usingTreeData && !rowNode.group;
|
|
442
|
-
if (isLeafNode) {
|
|
443
|
-
return;
|
|
444
|
-
}
|
|
445
|
-
var groupInfo = {
|
|
446
|
-
field: rowNode.field,
|
|
447
|
-
key: rowNode.key,
|
|
448
|
-
rowGroupColumn: rowNode.rowGroupColumn
|
|
449
|
-
};
|
|
450
|
-
_this7.setGroupData(rowNode, groupInfo);
|
|
451
|
-
recurse(rowNode.childrenAfterGroup);
|
|
452
|
-
});
|
|
453
|
-
};
|
|
454
|
-
recurse(details.rootNode.childrenAfterGroup);
|
|
455
|
-
}
|
|
456
|
-
}, {
|
|
457
|
-
key: "shotgunResetEverything",
|
|
458
|
-
value: function shotgunResetEverything(details, afterColumnsChanged) {
|
|
459
|
-
if (this.noChangeInGroupingColumns(details, afterColumnsChanged)) {
|
|
460
|
-
return;
|
|
461
|
-
}
|
|
462
|
-
// groups are about to get disposed, so need to deselect any that are selected
|
|
463
|
-
this.selectionService.filterFromSelection(function (node) {
|
|
464
|
-
return node && !node.group;
|
|
465
|
-
});
|
|
466
|
-
var rootNode = details.rootNode,
|
|
467
|
-
groupedCols = details.groupedCols;
|
|
468
|
-
// because we are not creating the root node each time, we have the logic
|
|
469
|
-
// here to change leafGroup once.
|
|
470
|
-
// we set .leafGroup to false for tree data, as .leafGroup is only used when pivoting, and pivoting
|
|
471
|
-
// isn't allowed with treeData, so the grid never actually use .leafGroup when doing treeData.
|
|
472
|
-
rootNode.leafGroup = this.usingTreeData ? false : groupedCols.length === 0;
|
|
473
|
-
// we are doing everything from scratch, so reset childrenAfterGroup and childrenMapped from the rootNode
|
|
474
|
-
rootNode.childrenAfterGroup = [];
|
|
475
|
-
rootNode.childrenMapped = {};
|
|
476
|
-
rootNode.updateHasChildren();
|
|
477
|
-
var sibling = rootNode.sibling;
|
|
478
|
-
if (sibling) {
|
|
479
|
-
sibling.childrenAfterGroup = rootNode.childrenAfterGroup;
|
|
480
|
-
sibling.childrenMapped = rootNode.childrenMapped;
|
|
481
|
-
}
|
|
482
|
-
this.insertNodes(rootNode.allLeafChildren, details, false);
|
|
483
|
-
}
|
|
484
|
-
}, {
|
|
485
|
-
key: "noChangeInGroupingColumns",
|
|
486
|
-
value: function noChangeInGroupingColumns(details, afterColumnsChanged) {
|
|
487
|
-
var noFurtherProcessingNeeded = false;
|
|
488
|
-
var groupDisplayColumns = this.columnModel.getGroupDisplayColumns();
|
|
489
|
-
var newGroupDisplayColIds = groupDisplayColumns ? groupDisplayColumns.map(function (c) {
|
|
490
|
-
return c.getId();
|
|
491
|
-
}).join('-') : '';
|
|
492
|
-
if (afterColumnsChanged) {
|
|
493
|
-
// we only need to redo grouping if doing normal grouping (ie not tree data)
|
|
494
|
-
// and the group cols have changed.
|
|
495
|
-
noFurtherProcessingNeeded = this.usingTreeData || this.areGroupColsEqual(details, this.oldGroupingDetails);
|
|
496
|
-
// if the group display cols have changed, then we need to update rowNode.groupData
|
|
497
|
-
// (regardless of tree data or row grouping)
|
|
498
|
-
if (this.oldGroupDisplayColIds !== newGroupDisplayColIds) {
|
|
499
|
-
this.checkAllGroupDataAfterColsChanged(details);
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
this.oldGroupingDetails = details;
|
|
503
|
-
this.oldGroupDisplayColIds = newGroupDisplayColIds;
|
|
504
|
-
return noFurtherProcessingNeeded;
|
|
505
|
-
}
|
|
506
|
-
}, {
|
|
507
|
-
key: "insertNodes",
|
|
508
|
-
value: function insertNodes(newRowNodes, details, isMove) {
|
|
509
|
-
var _this8 = this;
|
|
510
|
-
newRowNodes.forEach(function (rowNode) {
|
|
511
|
-
_this8.insertOneNode(rowNode, details, isMove);
|
|
512
|
-
if (details.changedPath.isActive()) {
|
|
513
|
-
details.changedPath.addParentNode(rowNode.parent);
|
|
514
|
-
}
|
|
515
|
-
});
|
|
516
|
-
}
|
|
517
|
-
}, {
|
|
518
|
-
key: "insertOneNode",
|
|
519
|
-
value: function insertOneNode(childNode, details, isMove, batchRemover) {
|
|
520
|
-
var path = this.getGroupInfo(childNode, details);
|
|
521
|
-
var parentGroup = this.findParentForNode(childNode, path, details, batchRemover);
|
|
522
|
-
if (!parentGroup.group) {
|
|
523
|
-
console.warn("AG Grid: duplicate group keys for row data, keys should be unique", [parentGroup.data, childNode.data]);
|
|
524
|
-
}
|
|
525
|
-
if (this.usingTreeData) {
|
|
526
|
-
this.swapGroupWithUserNode(parentGroup, childNode, isMove);
|
|
527
|
-
} else {
|
|
528
|
-
childNode.parent = parentGroup;
|
|
529
|
-
childNode.level = path.length;
|
|
530
|
-
parentGroup.childrenAfterGroup.push(childNode);
|
|
531
|
-
parentGroup.updateHasChildren();
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
}, {
|
|
535
|
-
key: "findParentForNode",
|
|
536
|
-
value: function findParentForNode(childNode, path, details, batchRemover) {
|
|
537
|
-
var _this9 = this;
|
|
538
|
-
var nextNode = details.rootNode;
|
|
539
|
-
path.forEach(function (groupInfo, level) {
|
|
540
|
-
nextNode = _this9.getOrCreateNextNode(nextNode, groupInfo, level, details);
|
|
541
|
-
// node gets added to all group nodes.
|
|
542
|
-
// note: we do not add to rootNode here, as the rootNode is the master list of rowNodes
|
|
543
|
-
if (!(batchRemover === null || batchRemover === void 0 ? void 0 : batchRemover.isRemoveFromAllLeafChildren(nextNode, childNode))) {
|
|
544
|
-
nextNode.allLeafChildren.push(childNode);
|
|
545
|
-
} else {
|
|
546
|
-
// if this node is about to be removed, prevent that
|
|
547
|
-
batchRemover === null || batchRemover === void 0 ? void 0 : batchRemover.preventRemoveFromAllLeafChildren(nextNode, childNode);
|
|
548
|
-
}
|
|
549
|
-
});
|
|
550
|
-
return nextNode;
|
|
551
|
-
}
|
|
552
|
-
}, {
|
|
553
|
-
key: "swapGroupWithUserNode",
|
|
554
|
-
value: function swapGroupWithUserNode(fillerGroup, userGroup, isMove) {
|
|
555
|
-
userGroup.parent = fillerGroup.parent;
|
|
556
|
-
userGroup.key = fillerGroup.key;
|
|
557
|
-
userGroup.field = fillerGroup.field;
|
|
558
|
-
userGroup.groupData = fillerGroup.groupData;
|
|
559
|
-
userGroup.level = fillerGroup.level;
|
|
560
|
-
// AG-3441 - preserve the existing expanded status of the node if we're moving it, so that
|
|
561
|
-
// you can drag a sub tree from one parent to another without changing its expansion
|
|
562
|
-
if (!isMove) {
|
|
563
|
-
userGroup.expanded = fillerGroup.expanded;
|
|
564
|
-
}
|
|
565
|
-
// we set .leafGroup to false for tree data, as .leafGroup is only used when pivoting, and pivoting
|
|
566
|
-
// isn't allowed with treeData, so the grid never actually use .leafGroup when doing treeData.
|
|
567
|
-
userGroup.leafGroup = fillerGroup.leafGroup;
|
|
568
|
-
// always null for userGroups, as row grouping is not allowed when doing tree data
|
|
569
|
-
userGroup.rowGroupIndex = fillerGroup.rowGroupIndex;
|
|
570
|
-
userGroup.allLeafChildren = fillerGroup.allLeafChildren;
|
|
571
|
-
userGroup.childrenAfterGroup = fillerGroup.childrenAfterGroup;
|
|
572
|
-
userGroup.childrenMapped = fillerGroup.childrenMapped;
|
|
573
|
-
userGroup.sibling = fillerGroup.sibling;
|
|
574
|
-
userGroup.updateHasChildren();
|
|
575
|
-
this.removeFromParent(fillerGroup);
|
|
576
|
-
userGroup.childrenAfterGroup.forEach(function (rowNode) {
|
|
577
|
-
return rowNode.parent = userGroup;
|
|
578
|
-
});
|
|
579
|
-
this.addToParent(userGroup, fillerGroup.parent);
|
|
580
|
-
}
|
|
581
|
-
}, {
|
|
582
|
-
key: "getOrCreateNextNode",
|
|
583
|
-
value: function getOrCreateNextNode(parentGroup, groupInfo, level, details) {
|
|
584
|
-
var key = this.getChildrenMappedKey(groupInfo.key, groupInfo.rowGroupColumn);
|
|
585
|
-
var nextNode = parentGroup.childrenMapped ? parentGroup.childrenMapped[key] : undefined;
|
|
586
|
-
if (!nextNode) {
|
|
587
|
-
nextNode = this.createGroup(groupInfo, parentGroup, level, details);
|
|
588
|
-
// attach the new group to the parent
|
|
589
|
-
this.addToParent(nextNode, parentGroup);
|
|
590
|
-
}
|
|
591
|
-
return nextNode;
|
|
592
|
-
}
|
|
593
|
-
}, {
|
|
594
|
-
key: "createGroup",
|
|
595
|
-
value: function createGroup(groupInfo, parent, level, details) {
|
|
596
|
-
var groupNode = new RowNode(this.beans);
|
|
597
|
-
groupNode.group = true;
|
|
598
|
-
groupNode.field = groupInfo.field;
|
|
599
|
-
groupNode.rowGroupColumn = groupInfo.rowGroupColumn;
|
|
600
|
-
this.setGroupData(groupNode, groupInfo);
|
|
601
|
-
// we put 'row-group-' before the group id, so it doesn't clash with standard row id's. we also use 't-' and 'b-'
|
|
602
|
-
// for top pinned and bottom pinned rows.
|
|
603
|
-
groupNode.id = RowNode.ID_PREFIX_ROW_GROUP + this.groupIdSequence.next();
|
|
604
|
-
groupNode.key = groupInfo.key;
|
|
605
|
-
groupNode.level = level;
|
|
606
|
-
groupNode.leafGroup = this.usingTreeData ? false : level === details.groupedColCount - 1;
|
|
607
|
-
groupNode.allLeafChildren = [];
|
|
608
|
-
// why is this done here? we are not updating the children count as we go,
|
|
609
|
-
// i suspect this is updated in the filter stage
|
|
610
|
-
groupNode.setAllChildrenCount(0);
|
|
611
|
-
groupNode.rowGroupIndex = this.usingTreeData ? null : level;
|
|
612
|
-
groupNode.childrenAfterGroup = [];
|
|
613
|
-
groupNode.childrenMapped = {};
|
|
614
|
-
groupNode.updateHasChildren();
|
|
615
|
-
groupNode.parent = details.includeParents ? parent : null;
|
|
616
|
-
this.setExpandedInitialValue(details, groupNode);
|
|
617
|
-
if (this.gridOptionsService.is('groupIncludeFooter')) {
|
|
618
|
-
groupNode.createFooter();
|
|
619
|
-
}
|
|
620
|
-
return groupNode;
|
|
621
|
-
}
|
|
622
|
-
}, {
|
|
623
|
-
key: "setGroupData",
|
|
624
|
-
value: function setGroupData(groupNode, groupInfo) {
|
|
625
|
-
var _this10 = this;
|
|
626
|
-
groupNode.groupData = {};
|
|
627
|
-
var groupDisplayCols = this.columnModel.getGroupDisplayColumns();
|
|
628
|
-
groupDisplayCols.forEach(function (col) {
|
|
629
|
-
// newGroup.rowGroupColumn=null when working off GroupInfo, and we always display the group in the group column
|
|
630
|
-
// if rowGroupColumn is present, then it's grid row grouping and we only include if configuration says so
|
|
631
|
-
var displayGroupForCol = _this10.usingTreeData || (groupNode.rowGroupColumn ? col.isRowGroupDisplayed(groupNode.rowGroupColumn.getId()) : false);
|
|
632
|
-
if (displayGroupForCol) {
|
|
633
|
-
groupNode.groupData[col.getColId()] = groupInfo.key;
|
|
634
|
-
}
|
|
635
|
-
});
|
|
636
|
-
}
|
|
637
|
-
}, {
|
|
638
|
-
key: "getChildrenMappedKey",
|
|
639
|
-
value: function getChildrenMappedKey(key, rowGroupColumn) {
|
|
640
|
-
if (rowGroupColumn) {
|
|
641
|
-
// grouping by columns
|
|
642
|
-
return rowGroupColumn.getId() + '-' + key;
|
|
643
|
-
}
|
|
644
|
-
// tree data - we don't have rowGroupColumns
|
|
645
|
-
return key;
|
|
646
|
-
}
|
|
647
|
-
}, {
|
|
648
|
-
key: "setExpandedInitialValue",
|
|
649
|
-
value: function setExpandedInitialValue(details, groupNode) {
|
|
650
|
-
// if pivoting the leaf group is never expanded as we do not show leaf rows
|
|
651
|
-
if (details.pivotMode && groupNode.leafGroup) {
|
|
652
|
-
groupNode.expanded = false;
|
|
653
|
-
return;
|
|
654
|
-
}
|
|
655
|
-
// use callback if exists
|
|
656
|
-
var userCallback = this.gridOptionsService.getCallback('isGroupOpenByDefault');
|
|
657
|
-
if (userCallback) {
|
|
658
|
-
var params = {
|
|
659
|
-
rowNode: groupNode,
|
|
660
|
-
field: groupNode.field,
|
|
661
|
-
key: groupNode.key,
|
|
662
|
-
level: groupNode.level,
|
|
663
|
-
rowGroupColumn: groupNode.rowGroupColumn
|
|
664
|
-
};
|
|
665
|
-
groupNode.expanded = userCallback(params) == true;
|
|
666
|
-
return;
|
|
667
|
-
}
|
|
668
|
-
// use expandByDefault if exists
|
|
669
|
-
var expandByDefault = details.expandByDefault;
|
|
670
|
-
if (details.expandByDefault === -1) {
|
|
671
|
-
groupNode.expanded = true;
|
|
672
|
-
return;
|
|
673
|
-
}
|
|
674
|
-
// otherwise
|
|
675
|
-
groupNode.expanded = groupNode.level < expandByDefault;
|
|
676
|
-
}
|
|
677
|
-
}, {
|
|
678
|
-
key: "getGroupInfo",
|
|
679
|
-
value: function getGroupInfo(rowNode, details) {
|
|
680
|
-
if (this.usingTreeData) {
|
|
681
|
-
return this.getGroupInfoFromCallback(rowNode);
|
|
682
|
-
}
|
|
683
|
-
return this.getGroupInfoFromGroupColumns(rowNode, details);
|
|
684
|
-
}
|
|
685
|
-
}, {
|
|
686
|
-
key: "getGroupInfoFromCallback",
|
|
687
|
-
value: function getGroupInfoFromCallback(rowNode) {
|
|
688
|
-
var keys = this.getDataPath ? this.getDataPath(rowNode.data) : null;
|
|
689
|
-
if (keys === null || keys === undefined || keys.length === 0) {
|
|
690
|
-
_.doOnce(function () {
|
|
691
|
-
return console.warn("AG Grid: getDataPath() should not return an empty path for data", rowNode.data);
|
|
692
|
-
}, 'groupStage.getGroupInfoFromCallback');
|
|
693
|
-
}
|
|
694
|
-
var groupInfoMapper = function groupInfoMapper(key) {
|
|
695
|
-
return {
|
|
696
|
-
key: key,
|
|
697
|
-
field: null,
|
|
698
|
-
rowGroupColumn: null
|
|
699
|
-
};
|
|
700
|
-
};
|
|
701
|
-
return keys ? keys.map(groupInfoMapper) : [];
|
|
702
|
-
}
|
|
703
|
-
}, {
|
|
704
|
-
key: "getGroupInfoFromGroupColumns",
|
|
705
|
-
value: function getGroupInfoFromGroupColumns(rowNode, details) {
|
|
706
|
-
var _this11 = this;
|
|
707
|
-
var res = [];
|
|
708
|
-
details.groupedCols.forEach(function (groupCol) {
|
|
709
|
-
var key = _this11.valueService.getKeyForNode(groupCol, rowNode);
|
|
710
|
-
var keyExists = key !== null && key !== undefined && key !== '';
|
|
711
|
-
// unbalanced tree and pivot mode don't work together - not because of the grid, it doesn't make
|
|
712
|
-
// mathematical sense as you are building up a cube. so if pivot mode, we put in a blank key where missing.
|
|
713
|
-
// this keeps the tree balanced and hence can be represented as a group.
|
|
714
|
-
var createGroupForEmpty = details.pivotMode || !_this11.gridOptionsService.is('groupAllowUnbalanced');
|
|
715
|
-
if (createGroupForEmpty && !keyExists) {
|
|
716
|
-
key = '';
|
|
717
|
-
keyExists = true;
|
|
718
|
-
}
|
|
719
|
-
if (keyExists) {
|
|
720
|
-
var item = {
|
|
721
|
-
key: key,
|
|
722
|
-
field: groupCol.getColDef().field,
|
|
723
|
-
rowGroupColumn: groupCol
|
|
724
|
-
};
|
|
725
|
-
res.push(item);
|
|
726
|
-
}
|
|
727
|
-
});
|
|
728
|
-
return res;
|
|
729
|
-
}
|
|
730
|
-
}]);
|
|
731
|
-
return GroupStage;
|
|
732
|
-
}(BeanStub);
|
|
733
|
-
__decorate([Autowired('columnModel')], GroupStage.prototype, "columnModel", void 0);
|
|
734
|
-
__decorate([Autowired('selectableService')], GroupStage.prototype, "selectableService", void 0);
|
|
735
|
-
__decorate([Autowired('valueService')], GroupStage.prototype, "valueService", void 0);
|
|
736
|
-
__decorate([Autowired('beans')], GroupStage.prototype, "beans", void 0);
|
|
737
|
-
__decorate([Autowired('selectionService')], GroupStage.prototype, "selectionService", void 0);
|
|
738
|
-
__decorate([PostConstruct], GroupStage.prototype, "postConstruct", null);
|
|
739
|
-
GroupStage = __decorate([Bean('groupStage')], GroupStage);
|
|
740
|
-
export { GroupStage };
|