@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,24 +0,0 @@
|
|
|
1
|
-
import { BeanStub, ColDef, ColGroupDef } from "@ag-grid-community/core";
|
|
2
|
-
export interface PivotColDefServiceResult {
|
|
3
|
-
pivotColumnGroupDefs: (ColDef | ColGroupDef)[];
|
|
4
|
-
pivotColumnDefs: ColDef[];
|
|
5
|
-
}
|
|
6
|
-
export declare class PivotColDefService extends BeanStub {
|
|
7
|
-
static PIVOT_ROW_TOTAL_PREFIX: string;
|
|
8
|
-
private columnModel;
|
|
9
|
-
createPivotColumnDefs(uniqueValues: any): PivotColDefServiceResult;
|
|
10
|
-
private recursiveBuildGroup;
|
|
11
|
-
private buildMeasureCols;
|
|
12
|
-
private addExpandablePivotGroups;
|
|
13
|
-
private addPivotTotalsToGroups;
|
|
14
|
-
private recursivelyAddPivotTotal;
|
|
15
|
-
private addRowGroupTotals;
|
|
16
|
-
private extractColIdsForValueColumn;
|
|
17
|
-
private createRowGroupTotal;
|
|
18
|
-
private createColDef;
|
|
19
|
-
private sameAggFuncs;
|
|
20
|
-
private headerNameComparator;
|
|
21
|
-
private merge;
|
|
22
|
-
private generateColumnGroupId;
|
|
23
|
-
private generateColumnId;
|
|
24
|
-
}
|
|
@@ -1,396 +0,0 @@
|
|
|
1
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
7
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
8
|
-
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); } }
|
|
9
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
10
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
11
|
-
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); }
|
|
12
|
-
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); }
|
|
13
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
14
|
-
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); }; }
|
|
15
|
-
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); }
|
|
16
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
17
|
-
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; } }
|
|
18
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
19
|
-
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); }
|
|
20
|
-
var __decorate = this && this.__decorate || function (decorators, target, key, desc) {
|
|
21
|
-
var c = arguments.length,
|
|
22
|
-
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
23
|
-
d;
|
|
24
|
-
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;
|
|
25
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
26
|
-
};
|
|
27
|
-
var PivotColDefService_1;
|
|
28
|
-
import { Autowired, Bean, BeanStub, _ } from "@ag-grid-community/core";
|
|
29
|
-
var PivotColDefService = PivotColDefService_1 = /*#__PURE__*/function (_BeanStub) {
|
|
30
|
-
_inherits(PivotColDefService, _BeanStub);
|
|
31
|
-
var _super = _createSuper(PivotColDefService);
|
|
32
|
-
function PivotColDefService() {
|
|
33
|
-
_classCallCheck(this, PivotColDefService);
|
|
34
|
-
return _super.apply(this, arguments);
|
|
35
|
-
}
|
|
36
|
-
_createClass(PivotColDefService, [{
|
|
37
|
-
key: "createPivotColumnDefs",
|
|
38
|
-
value: function createPivotColumnDefs(uniqueValues) {
|
|
39
|
-
// this is passed to the columnModel, to configure the columns and groups we show
|
|
40
|
-
var pivotColumns = this.columnModel.getPivotColumns();
|
|
41
|
-
var valueColumns = this.columnModel.getValueColumns();
|
|
42
|
-
var levelsDeep = pivotColumns.length;
|
|
43
|
-
var pivotColumnGroupDefs = this.recursiveBuildGroup(0, uniqueValues, [], levelsDeep, pivotColumns);
|
|
44
|
-
function extractColDefs(input) {
|
|
45
|
-
var arr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
46
|
-
input.forEach(function (def) {
|
|
47
|
-
if (def.children !== undefined) {
|
|
48
|
-
extractColDefs(def.children, arr);
|
|
49
|
-
} else {
|
|
50
|
-
arr.push(def);
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
return arr;
|
|
54
|
-
}
|
|
55
|
-
var pivotColumnDefs = extractColDefs(pivotColumnGroupDefs);
|
|
56
|
-
// additional columns that contain the aggregated total for each value column per row
|
|
57
|
-
this.addRowGroupTotals(pivotColumnGroupDefs, pivotColumnDefs, valueColumns);
|
|
58
|
-
// additional group columns that contain child totals for each collapsed child column / group
|
|
59
|
-
this.addExpandablePivotGroups(pivotColumnGroupDefs, pivotColumnDefs);
|
|
60
|
-
// additional group columns that contain an aggregated total across all child columns
|
|
61
|
-
this.addPivotTotalsToGroups(pivotColumnGroupDefs, pivotColumnDefs);
|
|
62
|
-
// we clone, so the colDefs in pivotColumnsGroupDefs and pivotColumnDefs are not shared. this is so that
|
|
63
|
-
// any changes the user makes (via processSecondaryColumnDefinitions) don't impact the internal aggregations,
|
|
64
|
-
// as these use the col defs also
|
|
65
|
-
var pivotColumnDefsClone = pivotColumnDefs.map(function (colDef) {
|
|
66
|
-
return _.cloneObject(colDef);
|
|
67
|
-
});
|
|
68
|
-
return {
|
|
69
|
-
pivotColumnGroupDefs: pivotColumnGroupDefs,
|
|
70
|
-
pivotColumnDefs: pivotColumnDefsClone
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
}, {
|
|
74
|
-
key: "recursiveBuildGroup",
|
|
75
|
-
value: function recursiveBuildGroup(index, uniqueValue, pivotKeys, maxDepth, primaryPivotColumns) {
|
|
76
|
-
var _this = this;
|
|
77
|
-
var measureColumns = this.columnModel.getValueColumns();
|
|
78
|
-
if (index >= maxDepth) {
|
|
79
|
-
// Base case - build the measure columns
|
|
80
|
-
return this.buildMeasureCols(pivotKeys);
|
|
81
|
-
}
|
|
82
|
-
// sort by either user provided comparator, or our own one
|
|
83
|
-
var primaryPivotColumnDefs = primaryPivotColumns[index].getColDef();
|
|
84
|
-
var comparator = this.headerNameComparator.bind(this, primaryPivotColumnDefs.pivotComparator);
|
|
85
|
-
// Base case for the compact layout, instead of recursing build the last layer of groups as measure columns instead
|
|
86
|
-
if (measureColumns.length === 1 && this.gridOptionsService.is('removePivotHeaderRowWhenSingleValueColumn') && index === maxDepth - 1) {
|
|
87
|
-
var leafCols = [];
|
|
88
|
-
_.iterateObject(uniqueValue, function (key) {
|
|
89
|
-
var newPivotKeys = [].concat(_toConsumableArray(pivotKeys), [key]);
|
|
90
|
-
leafCols.push(Object.assign(Object.assign({}, _this.createColDef(measureColumns[0], key, newPivotKeys)), {
|
|
91
|
-
columnGroupShow: 'open'
|
|
92
|
-
}));
|
|
93
|
-
});
|
|
94
|
-
leafCols.sort(comparator);
|
|
95
|
-
return leafCols;
|
|
96
|
-
}
|
|
97
|
-
// Recursive case
|
|
98
|
-
var groups = [];
|
|
99
|
-
_.iterateObject(uniqueValue, function (key, value) {
|
|
100
|
-
var newPivotKeys = [].concat(_toConsumableArray(pivotKeys), [key]);
|
|
101
|
-
groups.push({
|
|
102
|
-
children: _this.recursiveBuildGroup(index + 1, value, newPivotKeys, maxDepth, primaryPivotColumns),
|
|
103
|
-
headerName: key,
|
|
104
|
-
pivotKeys: newPivotKeys,
|
|
105
|
-
columnGroupShow: 'open',
|
|
106
|
-
groupId: _this.generateColumnGroupId(newPivotKeys)
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
groups.sort(comparator);
|
|
110
|
-
return groups;
|
|
111
|
-
}
|
|
112
|
-
}, {
|
|
113
|
-
key: "buildMeasureCols",
|
|
114
|
-
value: function buildMeasureCols(pivotKeys) {
|
|
115
|
-
var _this2 = this;
|
|
116
|
-
var measureColumns = this.columnModel.getValueColumns();
|
|
117
|
-
if (measureColumns.length === 0) {
|
|
118
|
-
// if no value columns selected, then we insert one blank column, so the user at least sees columns
|
|
119
|
-
// rendered. otherwise the grid would render with no columns (just empty groups) which would give the
|
|
120
|
-
// impression that the grid is broken
|
|
121
|
-
return [this.createColDef(null, '-', pivotKeys)];
|
|
122
|
-
}
|
|
123
|
-
return measureColumns.map(function (measureCol) {
|
|
124
|
-
var columnName = _this2.columnModel.getDisplayNameForColumn(measureCol, 'header');
|
|
125
|
-
return Object.assign(Object.assign({}, _this2.createColDef(measureCol, columnName, pivotKeys)), {
|
|
126
|
-
columnGroupShow: 'open'
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
}, {
|
|
131
|
-
key: "addExpandablePivotGroups",
|
|
132
|
-
value: function addExpandablePivotGroups(pivotColumnGroupDefs, pivotColumnDefs) {
|
|
133
|
-
var _this3 = this;
|
|
134
|
-
if (this.gridOptionsService.is('suppressExpandablePivotGroups') || this.gridOptionsService.get('pivotColumnGroupTotals')) {
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
var recursivelyAddSubTotals = function recursivelyAddSubTotals(groupDef, currentPivotColumnDefs, acc) {
|
|
138
|
-
var group = groupDef;
|
|
139
|
-
if (group.children) {
|
|
140
|
-
var childAcc = new Map();
|
|
141
|
-
group.children.forEach(function (grp) {
|
|
142
|
-
recursivelyAddSubTotals(grp, currentPivotColumnDefs, childAcc);
|
|
143
|
-
});
|
|
144
|
-
var firstGroup = !group.children.some(function (child) {
|
|
145
|
-
return child.children;
|
|
146
|
-
});
|
|
147
|
-
_this3.columnModel.getValueColumns().forEach(function (valueColumn) {
|
|
148
|
-
var columnName = _this3.columnModel.getDisplayNameForColumn(valueColumn, 'header');
|
|
149
|
-
var totalColDef = _this3.createColDef(valueColumn, columnName, groupDef.pivotKeys);
|
|
150
|
-
totalColDef.pivotTotalColumnIds = childAcc.get(valueColumn.getColId());
|
|
151
|
-
totalColDef.columnGroupShow = 'closed';
|
|
152
|
-
totalColDef.aggFunc = valueColumn.getAggFunc();
|
|
153
|
-
if (!firstGroup) {
|
|
154
|
-
// add total colDef to group and pivot colDefs array
|
|
155
|
-
var children = groupDef.children;
|
|
156
|
-
children.push(totalColDef);
|
|
157
|
-
currentPivotColumnDefs.push(totalColDef);
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
_this3.merge(acc, childAcc);
|
|
161
|
-
} else {
|
|
162
|
-
var def = groupDef;
|
|
163
|
-
// check that value column exists, i.e. aggFunc is supplied
|
|
164
|
-
if (!def.pivotValueColumn) {
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
var pivotValueColId = def.pivotValueColumn.getColId();
|
|
168
|
-
var arr = acc.has(pivotValueColId) ? acc.get(pivotValueColId) : [];
|
|
169
|
-
arr.push(def.colId);
|
|
170
|
-
acc.set(pivotValueColId, arr);
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
pivotColumnGroupDefs.forEach(function (groupDef) {
|
|
174
|
-
recursivelyAddSubTotals(groupDef, pivotColumnDefs, new Map());
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
}, {
|
|
178
|
-
key: "addPivotTotalsToGroups",
|
|
179
|
-
value: function addPivotTotalsToGroups(pivotColumnGroupDefs, pivotColumnDefs) {
|
|
180
|
-
var _this4 = this;
|
|
181
|
-
if (!this.gridOptionsService.get('pivotColumnGroupTotals')) {
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
var insertAfter = this.gridOptionsService.get('pivotColumnGroupTotals') === 'after';
|
|
185
|
-
var valueCols = this.columnModel.getValueColumns();
|
|
186
|
-
var aggFuncs = valueCols.map(function (valueCol) {
|
|
187
|
-
return valueCol.getAggFunc();
|
|
188
|
-
});
|
|
189
|
-
// don't add pivot totals if there is less than 1 aggFunc or they are not all the same
|
|
190
|
-
if (!aggFuncs || aggFuncs.length < 1 || !this.sameAggFuncs(aggFuncs)) {
|
|
191
|
-
// console.warn('AG Grid: aborting adding pivot total columns - value columns require same aggFunc');
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
// arbitrarily select a value column to use as a template for pivot columns
|
|
195
|
-
var valueColumn = valueCols[0];
|
|
196
|
-
pivotColumnGroupDefs.forEach(function (groupDef) {
|
|
197
|
-
_this4.recursivelyAddPivotTotal(groupDef, pivotColumnDefs, valueColumn, insertAfter);
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
}, {
|
|
201
|
-
key: "recursivelyAddPivotTotal",
|
|
202
|
-
value: function recursivelyAddPivotTotal(groupDef, pivotColumnDefs, valueColumn, insertAfter) {
|
|
203
|
-
var _this5 = this;
|
|
204
|
-
var group = groupDef;
|
|
205
|
-
if (!group.children) {
|
|
206
|
-
var def = groupDef;
|
|
207
|
-
return def.colId ? [def.colId] : null;
|
|
208
|
-
}
|
|
209
|
-
var colIds = [];
|
|
210
|
-
// need to recurse children first to obtain colIds used in the aggregation stage
|
|
211
|
-
group.children.forEach(function (grp) {
|
|
212
|
-
var childColIds = _this5.recursivelyAddPivotTotal(grp, pivotColumnDefs, valueColumn, insertAfter);
|
|
213
|
-
if (childColIds) {
|
|
214
|
-
colIds = colIds.concat(childColIds);
|
|
215
|
-
}
|
|
216
|
-
});
|
|
217
|
-
// only add total colDef if there is more than 1 child node
|
|
218
|
-
if (group.children.length > 1) {
|
|
219
|
-
var localeTextFunc = this.localeService.getLocaleTextFunc();
|
|
220
|
-
var headerName = localeTextFunc('pivotColumnGroupTotals', 'Total');
|
|
221
|
-
//create total colDef using an arbitrary value column as a template
|
|
222
|
-
var totalColDef = this.createColDef(valueColumn, headerName, groupDef.pivotKeys, true);
|
|
223
|
-
totalColDef.pivotTotalColumnIds = colIds;
|
|
224
|
-
totalColDef.aggFunc = valueColumn.getAggFunc();
|
|
225
|
-
// add total colDef to group and pivot colDefs array
|
|
226
|
-
var children = groupDef.children;
|
|
227
|
-
insertAfter ? children.push(totalColDef) : children.unshift(totalColDef);
|
|
228
|
-
pivotColumnDefs.push(totalColDef);
|
|
229
|
-
}
|
|
230
|
-
return colIds;
|
|
231
|
-
}
|
|
232
|
-
}, {
|
|
233
|
-
key: "addRowGroupTotals",
|
|
234
|
-
value: function addRowGroupTotals(pivotColumnGroupDefs, pivotColumnDefs, valueColumns) {
|
|
235
|
-
var _this6 = this;
|
|
236
|
-
if (!this.gridOptionsService.get('pivotRowTotals')) {
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
var insertAfter = this.gridOptionsService.get('pivotRowTotals') === 'after';
|
|
240
|
-
// order of row group totals depends on position
|
|
241
|
-
var valueCols = insertAfter ? valueColumns.slice() : valueColumns.slice().reverse();
|
|
242
|
-
var _loop = function _loop() {
|
|
243
|
-
var valueCol = valueCols[i];
|
|
244
|
-
var colIds = [];
|
|
245
|
-
pivotColumnGroupDefs.forEach(function (groupDef) {
|
|
246
|
-
colIds = colIds.concat(_this6.extractColIdsForValueColumn(groupDef, valueCol));
|
|
247
|
-
});
|
|
248
|
-
var withGroup = valueCols.length > 1 || !_this6.gridOptionsService.is('removePivotHeaderRowWhenSingleValueColumn');
|
|
249
|
-
_this6.createRowGroupTotal(pivotColumnGroupDefs, pivotColumnDefs, valueCol, colIds, insertAfter, withGroup);
|
|
250
|
-
};
|
|
251
|
-
for (var i = 0; i < valueCols.length; i++) {
|
|
252
|
-
_loop();
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
}, {
|
|
256
|
-
key: "extractColIdsForValueColumn",
|
|
257
|
-
value: function extractColIdsForValueColumn(groupDef, valueColumn) {
|
|
258
|
-
var _this7 = this;
|
|
259
|
-
var group = groupDef;
|
|
260
|
-
if (!group.children) {
|
|
261
|
-
var colDef = group;
|
|
262
|
-
return colDef.pivotValueColumn === valueColumn && colDef.colId ? [colDef.colId] : [];
|
|
263
|
-
}
|
|
264
|
-
var colIds = [];
|
|
265
|
-
group.children.forEach(function (grp) {
|
|
266
|
-
_this7.extractColIdsForValueColumn(grp, valueColumn);
|
|
267
|
-
var childColIds = _this7.extractColIdsForValueColumn(grp, valueColumn);
|
|
268
|
-
colIds = colIds.concat(childColIds);
|
|
269
|
-
});
|
|
270
|
-
return colIds;
|
|
271
|
-
}
|
|
272
|
-
}, {
|
|
273
|
-
key: "createRowGroupTotal",
|
|
274
|
-
value: function createRowGroupTotal(parentChildren, pivotColumnDefs, valueColumn, colIds, insertAfter, addGroup) {
|
|
275
|
-
var measureColumns = this.columnModel.getValueColumns();
|
|
276
|
-
var colDef;
|
|
277
|
-
if (measureColumns.length === 0) {
|
|
278
|
-
colDef = this.createColDef(null, '-', []);
|
|
279
|
-
} else {
|
|
280
|
-
var columnName = this.columnModel.getDisplayNameForColumn(valueColumn, 'header');
|
|
281
|
-
colDef = this.createColDef(valueColumn, columnName, []);
|
|
282
|
-
colDef.pivotTotalColumnIds = colIds;
|
|
283
|
-
}
|
|
284
|
-
colDef.colId = PivotColDefService_1.PIVOT_ROW_TOTAL_PREFIX + colDef.colId;
|
|
285
|
-
pivotColumnDefs.push(colDef);
|
|
286
|
-
var valueGroup = addGroup ? {
|
|
287
|
-
children: [colDef],
|
|
288
|
-
pivotKeys: [],
|
|
289
|
-
groupId: "".concat(PivotColDefService_1.PIVOT_ROW_TOTAL_PREFIX, "_pivotGroup_").concat(valueColumn.getColId())
|
|
290
|
-
} : colDef;
|
|
291
|
-
insertAfter ? parentChildren.push(valueGroup) : parentChildren.unshift(valueGroup);
|
|
292
|
-
}
|
|
293
|
-
}, {
|
|
294
|
-
key: "createColDef",
|
|
295
|
-
value: function createColDef(valueColumn, headerName, pivotKeys) {
|
|
296
|
-
var totalColumn = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
297
|
-
var colDef = {};
|
|
298
|
-
// This is null when there are no measure columns and we're creating placeholder columns
|
|
299
|
-
if (valueColumn) {
|
|
300
|
-
var colDefToCopy = valueColumn.getColDef();
|
|
301
|
-
Object.assign(colDef, colDefToCopy);
|
|
302
|
-
// even if original column was hidden, we always show the pivot value column, otherwise it would be
|
|
303
|
-
// very confusing for people thinking the pivot is broken
|
|
304
|
-
colDef.hide = false;
|
|
305
|
-
}
|
|
306
|
-
colDef.headerName = headerName;
|
|
307
|
-
colDef.colId = this.generateColumnId(pivotKeys || [], valueColumn && !totalColumn ? valueColumn.getColId() : '');
|
|
308
|
-
// pivot columns repeat over field, so it makes sense to use the unique id instead. For example if you want to
|
|
309
|
-
// assign values to pinned bottom rows using setPinnedBottomRowData the value service will use this colId.
|
|
310
|
-
colDef.field = colDef.colId;
|
|
311
|
-
// this is to support using pinned rows, normally the data will be extracted from the aggData object using the colId
|
|
312
|
-
// however pinned rows still access the data object by field, this prevents values with dots from being treated as complex objects
|
|
313
|
-
colDef.valueGetter = function (params) {
|
|
314
|
-
var _a;
|
|
315
|
-
return (_a = params.data) === null || _a === void 0 ? void 0 : _a[params.colDef.field];
|
|
316
|
-
};
|
|
317
|
-
colDef.pivotKeys = pivotKeys;
|
|
318
|
-
colDef.pivotValueColumn = valueColumn;
|
|
319
|
-
if (colDef.filter === true) {
|
|
320
|
-
colDef.filter = 'agNumberColumnFilter';
|
|
321
|
-
}
|
|
322
|
-
return colDef;
|
|
323
|
-
}
|
|
324
|
-
}, {
|
|
325
|
-
key: "sameAggFuncs",
|
|
326
|
-
value: function sameAggFuncs(aggFuncs) {
|
|
327
|
-
if (aggFuncs.length == 1) {
|
|
328
|
-
return true;
|
|
329
|
-
}
|
|
330
|
-
//check if all aggFunc's match
|
|
331
|
-
for (var i = 1; i < aggFuncs.length; i++) {
|
|
332
|
-
if (aggFuncs[i] !== aggFuncs[0]) {
|
|
333
|
-
return false;
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
return true;
|
|
337
|
-
}
|
|
338
|
-
}, {
|
|
339
|
-
key: "headerNameComparator",
|
|
340
|
-
value: function headerNameComparator(userComparator, a, b) {
|
|
341
|
-
if (userComparator) {
|
|
342
|
-
return userComparator(a.headerName, b.headerName);
|
|
343
|
-
} else {
|
|
344
|
-
if (a.headerName && !b.headerName) {
|
|
345
|
-
return 1;
|
|
346
|
-
} else if (!a.headerName && b.headerName) {
|
|
347
|
-
return -1;
|
|
348
|
-
}
|
|
349
|
-
// slightly naff here - just to satify typescript
|
|
350
|
-
// really should be &&, but if so ts complains
|
|
351
|
-
// the above if/else checks would deal with either being falsy, so at this stage if either are falsy, both are
|
|
352
|
-
// ..still naff though
|
|
353
|
-
if (!a.headerName || !b.headerName) {
|
|
354
|
-
return 0;
|
|
355
|
-
}
|
|
356
|
-
if (a.headerName < b.headerName) {
|
|
357
|
-
return -1;
|
|
358
|
-
}
|
|
359
|
-
if (a.headerName > b.headerName) {
|
|
360
|
-
return 1;
|
|
361
|
-
}
|
|
362
|
-
return 0;
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
}, {
|
|
366
|
-
key: "merge",
|
|
367
|
-
value: function merge(m1, m2) {
|
|
368
|
-
m2.forEach(function (value, key, map) {
|
|
369
|
-
var existingList = m1.has(key) ? m1.get(key) : [];
|
|
370
|
-
var updatedList = [].concat(_toConsumableArray(existingList), _toConsumableArray(value));
|
|
371
|
-
m1.set(key, updatedList);
|
|
372
|
-
});
|
|
373
|
-
}
|
|
374
|
-
}, {
|
|
375
|
-
key: "generateColumnGroupId",
|
|
376
|
-
value: function generateColumnGroupId(pivotKeys) {
|
|
377
|
-
var pivotCols = this.columnModel.getPivotColumns().map(function (col) {
|
|
378
|
-
return col.getColId();
|
|
379
|
-
});
|
|
380
|
-
return "pivotGroup_".concat(pivotCols.join('-'), "_").concat(pivotKeys.join('-'));
|
|
381
|
-
}
|
|
382
|
-
}, {
|
|
383
|
-
key: "generateColumnId",
|
|
384
|
-
value: function generateColumnId(pivotKeys, measureColumnId) {
|
|
385
|
-
var pivotCols = this.columnModel.getPivotColumns().map(function (col) {
|
|
386
|
-
return col.getColId();
|
|
387
|
-
});
|
|
388
|
-
return "pivot_".concat(pivotCols.join('-'), "_").concat(pivotKeys.join('-'), "_").concat(measureColumnId);
|
|
389
|
-
}
|
|
390
|
-
}]);
|
|
391
|
-
return PivotColDefService;
|
|
392
|
-
}(BeanStub);
|
|
393
|
-
PivotColDefService.PIVOT_ROW_TOTAL_PREFIX = 'PivotRowTotal_';
|
|
394
|
-
__decorate([Autowired('columnModel')], PivotColDefService.prototype, "columnModel", void 0);
|
|
395
|
-
PivotColDefService = PivotColDefService_1 = __decorate([Bean('pivotColDefService')], PivotColDefService);
|
|
396
|
-
export { PivotColDefService };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { BeanStub, ColDef, IRowNodeStage, StageExecuteParams } from "@ag-grid-community/core";
|
|
2
|
-
export declare class PivotStage extends BeanStub implements IRowNodeStage {
|
|
3
|
-
private valueService;
|
|
4
|
-
private columnModel;
|
|
5
|
-
private pivotColDefService;
|
|
6
|
-
private uniqueValues;
|
|
7
|
-
private pivotColumnDefs;
|
|
8
|
-
private aggregationColumnsHashLastTime;
|
|
9
|
-
private aggregationFuncsHashLastTime;
|
|
10
|
-
private groupColumnsHashLastTime;
|
|
11
|
-
execute(params: StageExecuteParams): void;
|
|
12
|
-
private executePivotOff;
|
|
13
|
-
private executePivotOn;
|
|
14
|
-
private setUniqueValues;
|
|
15
|
-
private bucketUpRowNodes;
|
|
16
|
-
private bucketRowNode;
|
|
17
|
-
private bucketChildren;
|
|
18
|
-
getPivotColumnDefs(): ColDef[];
|
|
19
|
-
}
|
|
@@ -1,182 +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, _ } from "@ag-grid-community/core";
|
|
22
|
-
var PivotStage = /*#__PURE__*/function (_BeanStub) {
|
|
23
|
-
_inherits(PivotStage, _BeanStub);
|
|
24
|
-
var _super = _createSuper(PivotStage);
|
|
25
|
-
function PivotStage() {
|
|
26
|
-
var _this;
|
|
27
|
-
_classCallCheck(this, PivotStage);
|
|
28
|
-
_this = _super.apply(this, arguments);
|
|
29
|
-
_this.uniqueValues = {};
|
|
30
|
-
return _this;
|
|
31
|
-
}
|
|
32
|
-
_createClass(PivotStage, [{
|
|
33
|
-
key: "execute",
|
|
34
|
-
value: function execute(params) {
|
|
35
|
-
var changedPath = params.changedPath;
|
|
36
|
-
if (this.columnModel.isPivotActive()) {
|
|
37
|
-
this.executePivotOn(changedPath);
|
|
38
|
-
} else {
|
|
39
|
-
this.executePivotOff(changedPath);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}, {
|
|
43
|
-
key: "executePivotOff",
|
|
44
|
-
value: function executePivotOff(changedPath) {
|
|
45
|
-
this.aggregationColumnsHashLastTime = null;
|
|
46
|
-
this.uniqueValues = {};
|
|
47
|
-
if (this.columnModel.isSecondaryColumnsPresent()) {
|
|
48
|
-
this.columnModel.setSecondaryColumns(null, "rowModelUpdated");
|
|
49
|
-
if (changedPath) {
|
|
50
|
-
changedPath.setInactive();
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}, {
|
|
55
|
-
key: "executePivotOn",
|
|
56
|
-
value: function executePivotOn(changedPath) {
|
|
57
|
-
var uniqueValues = this.bucketUpRowNodes(changedPath);
|
|
58
|
-
var uniqueValuesChanged = this.setUniqueValues(uniqueValues);
|
|
59
|
-
var aggregationColumns = this.columnModel.getValueColumns();
|
|
60
|
-
var aggregationColumnsHash = aggregationColumns.map(function (column) {
|
|
61
|
-
return "".concat(column.getId(), "-").concat(column.getColDef().headerName);
|
|
62
|
-
}).join('#');
|
|
63
|
-
var aggregationFuncsHash = aggregationColumns.map(function (column) {
|
|
64
|
-
return column.getAggFunc().toString();
|
|
65
|
-
}).join('#');
|
|
66
|
-
var aggregationColumnsChanged = this.aggregationColumnsHashLastTime !== aggregationColumnsHash;
|
|
67
|
-
var aggregationFuncsChanged = this.aggregationFuncsHashLastTime !== aggregationFuncsHash;
|
|
68
|
-
this.aggregationColumnsHashLastTime = aggregationColumnsHash;
|
|
69
|
-
this.aggregationFuncsHashLastTime = aggregationFuncsHash;
|
|
70
|
-
var groupColumnsHash = this.columnModel.getRowGroupColumns().map(function (column) {
|
|
71
|
-
return column.getId();
|
|
72
|
-
}).join('#');
|
|
73
|
-
var groupColumnsChanged = groupColumnsHash !== this.groupColumnsHashLastTime;
|
|
74
|
-
this.groupColumnsHashLastTime = groupColumnsHash;
|
|
75
|
-
if (uniqueValuesChanged || aggregationColumnsChanged || groupColumnsChanged || aggregationFuncsChanged) {
|
|
76
|
-
var _this$pivotColDefServ = this.pivotColDefService.createPivotColumnDefs(this.uniqueValues),
|
|
77
|
-
pivotColumnGroupDefs = _this$pivotColDefServ.pivotColumnGroupDefs,
|
|
78
|
-
pivotColumnDefs = _this$pivotColDefServ.pivotColumnDefs;
|
|
79
|
-
this.pivotColumnDefs = pivotColumnDefs;
|
|
80
|
-
this.columnModel.setSecondaryColumns(pivotColumnGroupDefs, "rowModelUpdated");
|
|
81
|
-
// because the secondary columns have changed, then the aggregation needs to visit the whole
|
|
82
|
-
// tree again, so we make the changedPath not active, to force aggregation to visit all paths.
|
|
83
|
-
if (changedPath) {
|
|
84
|
-
changedPath.setInactive();
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}, {
|
|
89
|
-
key: "setUniqueValues",
|
|
90
|
-
value: function setUniqueValues(newValues) {
|
|
91
|
-
var json1 = JSON.stringify(newValues);
|
|
92
|
-
var json2 = JSON.stringify(this.uniqueValues);
|
|
93
|
-
var uniqueValuesChanged = json1 !== json2;
|
|
94
|
-
// we only continue the below if the unique values are different, as otherwise
|
|
95
|
-
// the result will be the same as the last time we did it
|
|
96
|
-
if (uniqueValuesChanged) {
|
|
97
|
-
this.uniqueValues = newValues;
|
|
98
|
-
return true;
|
|
99
|
-
} else {
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}, {
|
|
104
|
-
key: "bucketUpRowNodes",
|
|
105
|
-
value: function bucketUpRowNodes(changedPath) {
|
|
106
|
-
var _this2 = this;
|
|
107
|
-
// accessed from inside inner function
|
|
108
|
-
var uniqueValues = {};
|
|
109
|
-
// ensure childrenMapped is cleared, as if a node has been filtered out it should not have mapped children.
|
|
110
|
-
changedPath.forEachChangedNodeDepthFirst(function (node) {
|
|
111
|
-
if (node.leafGroup) {
|
|
112
|
-
node.childrenMapped = null;
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
var recursivelyBucketFilteredChildren = function recursivelyBucketFilteredChildren(node) {
|
|
116
|
-
var _a;
|
|
117
|
-
if (node.leafGroup) {
|
|
118
|
-
_this2.bucketRowNode(node, uniqueValues);
|
|
119
|
-
} else {
|
|
120
|
-
(_a = node.childrenAfterFilter) === null || _a === void 0 ? void 0 : _a.forEach(recursivelyBucketFilteredChildren);
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
changedPath.executeFromRootNode(recursivelyBucketFilteredChildren);
|
|
124
|
-
return uniqueValues;
|
|
125
|
-
}
|
|
126
|
-
}, {
|
|
127
|
-
key: "bucketRowNode",
|
|
128
|
-
value: function bucketRowNode(rowNode, uniqueValues) {
|
|
129
|
-
var pivotColumns = this.columnModel.getPivotColumns();
|
|
130
|
-
if (pivotColumns.length === 0) {
|
|
131
|
-
rowNode.childrenMapped = null;
|
|
132
|
-
} else {
|
|
133
|
-
rowNode.childrenMapped = this.bucketChildren(rowNode.childrenAfterFilter, pivotColumns, 0, uniqueValues);
|
|
134
|
-
}
|
|
135
|
-
if (rowNode.sibling) {
|
|
136
|
-
rowNode.sibling.childrenMapped = rowNode.childrenMapped;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}, {
|
|
140
|
-
key: "bucketChildren",
|
|
141
|
-
value: function bucketChildren(children, pivotColumns, pivotIndex, uniqueValues) {
|
|
142
|
-
var _this3 = this;
|
|
143
|
-
var mappedChildren = {};
|
|
144
|
-
var pivotColumn = pivotColumns[pivotIndex];
|
|
145
|
-
// map the children out based on the pivot column
|
|
146
|
-
children.forEach(function (child) {
|
|
147
|
-
var key = _this3.valueService.getKeyForNode(pivotColumn, child);
|
|
148
|
-
if (_.missing(key)) {
|
|
149
|
-
key = '';
|
|
150
|
-
}
|
|
151
|
-
if (!uniqueValues[key]) {
|
|
152
|
-
uniqueValues[key] = {};
|
|
153
|
-
}
|
|
154
|
-
if (!mappedChildren[key]) {
|
|
155
|
-
mappedChildren[key] = [];
|
|
156
|
-
}
|
|
157
|
-
mappedChildren[key].push(child);
|
|
158
|
-
});
|
|
159
|
-
// if it's the last pivot column, return as is, otherwise go one level further in the map
|
|
160
|
-
if (pivotIndex === pivotColumns.length - 1) {
|
|
161
|
-
return mappedChildren;
|
|
162
|
-
} else {
|
|
163
|
-
var result = {};
|
|
164
|
-
_.iterateObject(mappedChildren, function (key, value) {
|
|
165
|
-
result[key] = _this3.bucketChildren(value, pivotColumns, pivotIndex + 1, uniqueValues[key]);
|
|
166
|
-
});
|
|
167
|
-
return result;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}, {
|
|
171
|
-
key: "getPivotColumnDefs",
|
|
172
|
-
value: function getPivotColumnDefs() {
|
|
173
|
-
return this.pivotColumnDefs;
|
|
174
|
-
}
|
|
175
|
-
}]);
|
|
176
|
-
return PivotStage;
|
|
177
|
-
}(BeanStub);
|
|
178
|
-
__decorate([Autowired('valueService')], PivotStage.prototype, "valueService", void 0);
|
|
179
|
-
__decorate([Autowired('columnModel')], PivotStage.prototype, "columnModel", void 0);
|
|
180
|
-
__decorate([Autowired('pivotColDefService')], PivotStage.prototype, "pivotColDefService", void 0);
|
|
181
|
-
PivotStage = __decorate([Bean('pivotStage')], PivotStage);
|
|
182
|
-
export { PivotStage };
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { ModuleNames } from "@ag-grid-community/core";
|
|
2
|
-
import { AggregationStage } from "./rowGrouping/aggregationStage";
|
|
3
|
-
import { GroupStage } from "./rowGrouping/groupStage";
|
|
4
|
-
import { PivotColDefService } from "./rowGrouping/pivotColDefService";
|
|
5
|
-
import { PivotStage } from "./rowGrouping/pivotStage";
|
|
6
|
-
import { AggFuncService } from "./rowGrouping/aggFuncService";
|
|
7
|
-
import { GridHeaderDropZones } from "./rowGrouping/columnDropZones/gridHeaderDropZones";
|
|
8
|
-
import { FilterAggregatesStage } from "./rowGrouping/filterAggregatesStage";
|
|
9
|
-
import { VERSION } from "./version";
|
|
10
|
-
import { GroupFilter } from "./rowGrouping/groupFilter/groupFilter";
|
|
11
|
-
import { GroupFloatingFilterComp } from "./rowGrouping/groupFilter/groupFloatingFilter";
|
|
12
|
-
export var RowGroupingModule = {
|
|
13
|
-
version: VERSION,
|
|
14
|
-
moduleName: ModuleNames.RowGroupingModule,
|
|
15
|
-
beans: [AggregationStage, FilterAggregatesStage, GroupStage, PivotColDefService, PivotStage, AggFuncService],
|
|
16
|
-
agStackComponents: [{
|
|
17
|
-
componentName: 'AgGridHeaderDropZones',
|
|
18
|
-
componentClass: GridHeaderDropZones
|
|
19
|
-
}],
|
|
20
|
-
userComponents: [{
|
|
21
|
-
componentName: 'agGroupColumnFilter',
|
|
22
|
-
componentClass: GroupFilter
|
|
23
|
-
}, {
|
|
24
|
-
componentName: 'agGroupColumnFloatingFilter',
|
|
25
|
-
componentClass: GroupFloatingFilterComp
|
|
26
|
-
}],
|
|
27
|
-
dependantModules: []
|
|
28
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const VERSION = "29.2.0";
|