@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.
Files changed (145) hide show
  1. package/es/data-grid/cell-editors/date.d.ts +2 -2
  2. package/es/data-grid/cell-editors/number.d.ts +2 -2
  3. package/es/data-grid/cell-editors/number.js +1 -4
  4. package/es/data-grid/cell-editors/row.d.ts +2 -2
  5. package/es/data-grid/cell-editors/select.d.ts +3 -3
  6. package/es/data-grid/cell-editors/text.d.ts +2 -2
  7. package/es/data-grid/cell-editors/utils.d.ts +1 -1
  8. package/es/data-grid/components/custom-panel/index.d.ts +1 -1
  9. package/es/data-grid/components/custom-panel/item.d.ts +1 -1
  10. package/es/data-grid/components/custom-panel/typings.d.ts +1 -1
  11. package/es/data-grid/index.d.ts +8 -7
  12. package/es/data-grid/index.js +39 -21
  13. package/es/data-grid/index.less +1 -1
  14. package/es/data-grid/locale/en_US.js +3 -1
  15. package/es/data-grid/locale/zh_CN.js +3 -1
  16. package/es/data-grid/renderer/actions-renderer.d.ts +1 -1
  17. package/es/data-grid/renderer/actions.d.ts +1 -1
  18. package/es/data-grid/renderer/cell-delete-renderer.d.ts +1 -1
  19. package/es/data-grid/renderer/cell-index-renderer.d.ts +1 -1
  20. package/es/data-grid/renderer/cell-renderer.d.ts +1 -1
  21. package/es/data-grid/renderer/detali-cell-renderer.d.ts +1 -1
  22. package/es/data-grid/renderer/header-renderer.d.ts +1 -1
  23. package/es/data-grid/renderer/header-renderer.js +0 -1
  24. package/es/data-grid/typings.d.ts +2 -2
  25. package/es/data-grid/utils.d.ts +1 -1
  26. package/es/index.d.ts +4 -3
  27. package/es/index.js +4 -2
  28. package/es/select-view/index.d.ts +1 -1
  29. package/package.json +5 -14
  30. package/es/data-grid/modules/clipboard/clipboard/clipboardService.d.ts +0 -62
  31. package/es/data-grid/modules/clipboard/clipboard/clipboardService.js +0 -1007
  32. package/es/data-grid/modules/clipboard/clipboardModule.d.ts +0 -2
  33. package/es/data-grid/modules/clipboard/clipboardModule.js +0 -10
  34. package/es/data-grid/modules/clipboard/main.d.ts +0 -1
  35. package/es/data-grid/modules/clipboard/main.js +0 -1
  36. package/es/data-grid/modules/clipboard/version.d.ts +0 -1
  37. package/es/data-grid/modules/clipboard/version.js +0 -2
  38. package/es/data-grid/modules/column-tool-panel/columnToolPanel/columnModelItem.d.ts +0 -26
  39. package/es/data-grid/modules/column-tool-panel/columnToolPanel/columnModelItem.js +0 -94
  40. package/es/data-grid/modules/column-tool-panel/columnToolPanel/columnToolPanel.d.ts +0 -32
  41. package/es/data-grid/modules/column-tool-panel/columnToolPanel/columnToolPanel.js +0 -272
  42. package/es/data-grid/modules/column-tool-panel/columnToolPanel/modelItemUtils.d.ts +0 -16
  43. package/es/data-grid/modules/column-tool-panel/columnToolPanel/modelItemUtils.js +0 -209
  44. package/es/data-grid/modules/column-tool-panel/columnToolPanel/pivotModePanel.d.ts +0 -9
  45. package/es/data-grid/modules/column-tool-panel/columnToolPanel/pivotModePanel.js +0 -68
  46. package/es/data-grid/modules/column-tool-panel/columnToolPanel/primaryColsHeaderPanel.d.ts +0 -32
  47. package/es/data-grid/modules/column-tool-panel/columnToolPanel/primaryColsHeaderPanel.js +0 -150
  48. package/es/data-grid/modules/column-tool-panel/columnToolPanel/primaryColsListPanel.d.ts +0 -44
  49. package/es/data-grid/modules/column-tool-panel/columnToolPanel/primaryColsListPanel.js +0 -455
  50. package/es/data-grid/modules/column-tool-panel/columnToolPanel/primaryColsListPanelItemDragFeature.d.ts +0 -26
  51. package/es/data-grid/modules/column-tool-panel/columnToolPanel/primaryColsListPanelItemDragFeature.js +0 -224
  52. package/es/data-grid/modules/column-tool-panel/columnToolPanel/primaryColsPanel.d.ts +0 -24
  53. package/es/data-grid/modules/column-tool-panel/columnToolPanel/primaryColsPanel.js +0 -123
  54. package/es/data-grid/modules/column-tool-panel/columnToolPanel/toolPanelColumnComp.d.ts +0 -37
  55. package/es/data-grid/modules/column-tool-panel/columnToolPanel/toolPanelColumnComp.js +0 -314
  56. package/es/data-grid/modules/column-tool-panel/columnToolPanel/toolPanelColumnGroupComp.d.ts +0 -51
  57. package/es/data-grid/modules/column-tool-panel/columnToolPanel/toolPanelColumnGroupComp.js +0 -406
  58. package/es/data-grid/modules/column-tool-panel/columnToolPanel/toolPanelContextMenu.d.ts +0 -24
  59. package/es/data-grid/modules/column-tool-panel/columnToolPanel/toolPanelContextMenu.js +0 -264
  60. package/es/data-grid/modules/column-tool-panel/columnsToolPanelModule.d.ts +0 -2
  61. package/es/data-grid/modules/column-tool-panel/columnsToolPanelModule.js +0 -29
  62. package/es/data-grid/modules/column-tool-panel/main.d.ts +0 -2
  63. package/es/data-grid/modules/column-tool-panel/main.js +0 -3
  64. package/es/data-grid/modules/column-tool-panel/version.d.ts +0 -1
  65. package/es/data-grid/modules/column-tool-panel/version.js +0 -2
  66. package/es/data-grid/modules/master-detail/main.d.ts +0 -1
  67. package/es/data-grid/modules/master-detail/main.js +0 -1
  68. package/es/data-grid/modules/master-detail/masterDetail/detailCellRenderer.d.ts +0 -14
  69. package/es/data-grid/modules/master-detail/masterDetail/detailCellRenderer.js +0 -144
  70. package/es/data-grid/modules/master-detail/masterDetail/detailCellRendererCtrl.d.ts +0 -19
  71. package/es/data-grid/modules/master-detail/masterDetail/detailCellRendererCtrl.js +0 -203
  72. package/es/data-grid/modules/master-detail/masterDetailModule.d.ts +0 -2
  73. package/es/data-grid/modules/master-detail/masterDetailModule.js +0 -18
  74. package/es/data-grid/modules/master-detail/version.d.ts +0 -1
  75. package/es/data-grid/modules/master-detail/version.js +0 -2
  76. package/es/data-grid/modules/menu/main.d.ts +0 -1
  77. package/es/data-grid/modules/menu/main.js +0 -1
  78. package/es/data-grid/modules/menu/menu/chartMenuItemMapper.d.ts +0 -13
  79. package/es/data-grid/modules/menu/menu/chartMenuItemMapper.js +0 -351
  80. package/es/data-grid/modules/menu/menu/contextMenu.d.ts +0 -13
  81. package/es/data-grid/modules/menu/menu/contextMenu.js +0 -267
  82. package/es/data-grid/modules/menu/menu/enterpriseMenu.d.ts +0 -66
  83. package/es/data-grid/modules/menu/menu/enterpriseMenu.js +0 -592
  84. package/es/data-grid/modules/menu/menu/menuItemMapper.d.ts +0 -13
  85. package/es/data-grid/modules/menu/menu/menuItemMapper.js +0 -328
  86. package/es/data-grid/modules/menu/menuModule.d.ts +0 -2
  87. package/es/data-grid/modules/menu/menuModule.js +0 -12
  88. package/es/data-grid/modules/menu/version.d.ts +0 -1
  89. package/es/data-grid/modules/menu/version.js +0 -2
  90. package/es/data-grid/modules/row-grouping/main.d.ts +0 -4
  91. package/es/data-grid/modules/row-grouping/main.js +0 -4
  92. package/es/data-grid/modules/row-grouping/rowGrouping/aggFuncService.d.ts +0 -23
  93. package/es/data-grid/modules/row-grouping/rowGrouping/aggFuncService.js +0 -250
  94. package/es/data-grid/modules/row-grouping/rowGrouping/aggregationStage.d.ts +0 -22
  95. package/es/data-grid/modules/row-grouping/rowGrouping/aggregationStage.js +0 -285
  96. package/es/data-grid/modules/row-grouping/rowGrouping/batchRemover.d.ts +0 -12
  97. package/es/data-grid/modules/row-grouping/rowGrouping/batchRemover.js +0 -77
  98. package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/baseDropZonePanel.d.ts +0 -75
  99. package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/baseDropZonePanel.js +0 -516
  100. package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/dropZoneColumnComp.d.ts +0 -40
  101. package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/dropZoneColumnComp.js +0 -367
  102. package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/gridHeaderDropZones.d.ts +0 -11
  103. package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/gridHeaderDropZones.js +0 -85
  104. package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/pivotDropZonePanel.d.ts +0 -17
  105. package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/pivotDropZonePanel.js +0 -139
  106. package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/rowGroupDropZonePanel.d.ts +0 -15
  107. package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/rowGroupDropZonePanel.js +0 -105
  108. package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/valueDropZonePanel.d.ts +0 -15
  109. package/es/data-grid/modules/row-grouping/rowGrouping/columnDropZones/valueDropZonePanel.js +0 -105
  110. package/es/data-grid/modules/row-grouping/rowGrouping/filterAggregatesStage.d.ts +0 -9
  111. package/es/data-grid/modules/row-grouping/rowGrouping/filterAggregatesStage.js +0 -136
  112. package/es/data-grid/modules/row-grouping/rowGrouping/groupFilter/groupFilter.d.ts +0 -39
  113. package/es/data-grid/modules/row-grouping/rowGrouping/groupFilter/groupFilter.js +0 -319
  114. package/es/data-grid/modules/row-grouping/rowGrouping/groupFilter/groupFloatingFilter.d.ts +0 -23
  115. package/es/data-grid/modules/row-grouping/rowGrouping/groupFilter/groupFloatingFilter.js +0 -163
  116. package/es/data-grid/modules/row-grouping/rowGrouping/groupStage.d.ts +0 -48
  117. package/es/data-grid/modules/row-grouping/rowGrouping/groupStage.js +0 -740
  118. package/es/data-grid/modules/row-grouping/rowGrouping/pivotColDefService.d.ts +0 -24
  119. package/es/data-grid/modules/row-grouping/rowGrouping/pivotColDefService.js +0 -396
  120. package/es/data-grid/modules/row-grouping/rowGrouping/pivotStage.d.ts +0 -19
  121. package/es/data-grid/modules/row-grouping/rowGrouping/pivotStage.js +0 -182
  122. package/es/data-grid/modules/row-grouping/rowGroupingModule.d.ts +0 -2
  123. package/es/data-grid/modules/row-grouping/rowGroupingModule.js +0 -28
  124. package/es/data-grid/modules/row-grouping/version.d.ts +0 -1
  125. package/es/data-grid/modules/row-grouping/version.js +0 -2
  126. package/es/data-grid/modules/side-bar/main.d.ts +0 -2
  127. package/es/data-grid/modules/side-bar/main.js +0 -2
  128. package/es/data-grid/modules/side-bar/sideBar/common/toolPanelColDefService.d.ts +0 -11
  129. package/es/data-grid/modules/side-bar/sideBar/common/toolPanelColDefService.js +0 -216
  130. package/es/data-grid/modules/side-bar/sideBar/horizontalResizeComp.d.ts +0 -19
  131. package/es/data-grid/modules/side-bar/sideBar/horizontalResizeComp.js +0 -108
  132. package/es/data-grid/modules/side-bar/sideBar/sideBarButtonComp.d.ts +0 -16
  133. package/es/data-grid/modules/side-bar/sideBar/sideBarButtonComp.js +0 -84
  134. package/es/data-grid/modules/side-bar/sideBar/sideBarButtonsComp.d.ts +0 -18
  135. package/es/data-grid/modules/side-bar/sideBar/sideBarButtonsComp.js +0 -89
  136. package/es/data-grid/modules/side-bar/sideBar/sideBarComp.d.ts +0 -28
  137. package/es/data-grid/modules/side-bar/sideBar/sideBarComp.js +0 -325
  138. package/es/data-grid/modules/side-bar/sideBar/sideBarDefParser.d.ts +0 -10
  139. package/es/data-grid/modules/side-bar/sideBar/sideBarDefParser.js +0 -95
  140. package/es/data-grid/modules/side-bar/sideBar/toolPanelWrapper.d.ts +0 -17
  141. package/es/data-grid/modules/side-bar/sideBar/toolPanelWrapper.js +0 -103
  142. package/es/data-grid/modules/side-bar/sideBarModule.d.ts +0 -2
  143. package/es/data-grid/modules/side-bar/sideBarModule.js +0 -22
  144. package/es/data-grid/modules/side-bar/version.d.ts +0 -1
  145. package/es/data-grid/modules/side-bar/version.js +0 -2
@@ -1,592 +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, ModuleNames, ModuleRegistry, PostConstruct, AgPromise, TabbedLayout, AgMenuList, AgMenuItemComponent } from '@ag-grid-community/core';
22
- import { PrimaryColsPanel } from "../../column-tool-panel/main";
23
- var EnterpriseMenuFactory = /*#__PURE__*/function (_BeanStub) {
24
- _inherits(EnterpriseMenuFactory, _BeanStub);
25
- var _super = _createSuper(EnterpriseMenuFactory);
26
- function EnterpriseMenuFactory() {
27
- _classCallCheck(this, EnterpriseMenuFactory);
28
- return _super.apply(this, arguments);
29
- }
30
- _createClass(EnterpriseMenuFactory, [{
31
- key: "hideActiveMenu",
32
- value: function hideActiveMenu() {
33
- this.destroyBean(this.activeMenu);
34
- }
35
- }, {
36
- key: "showMenuAfterMouseEvent",
37
- value: function showMenuAfterMouseEvent(column, mouseEvent, defaultTab) {
38
- var _this = this;
39
- this.showMenu(column, function (menu) {
40
- var ePopup = menu.getGui();
41
- _this.popupService.positionPopupUnderMouseEvent({
42
- type: 'columnMenu',
43
- column: column,
44
- mouseEvent: mouseEvent,
45
- ePopup: ePopup
46
- });
47
- if (defaultTab) {
48
- menu.showTab(defaultTab);
49
- }
50
- }, 'columnMenu', defaultTab, undefined, mouseEvent.target);
51
- }
52
- }, {
53
- key: "showMenuAfterButtonClick",
54
- value: function showMenuAfterButtonClick(column, eventSource, containerType, defaultTab, restrictToTabs) {
55
- var _this2 = this;
56
- var multiplier = -1;
57
- var alignSide = 'left';
58
- if (this.gridOptionsService.is('enableRtl')) {
59
- multiplier = 1;
60
- alignSide = 'right';
61
- }
62
- this.showMenu(column, function (menu) {
63
- var ePopup = menu.getGui();
64
- _this2.popupService.positionPopupByComponent({
65
- type: containerType,
66
- column: column,
67
- eventSource: eventSource,
68
- ePopup: ePopup,
69
- alignSide: alignSide,
70
- nudgeX: 9 * multiplier,
71
- nudgeY: -23,
72
- position: 'under',
73
- keepWithinBounds: true,
74
- shouldSetMaxHeight: true
75
- });
76
- if (defaultTab) {
77
- menu.showTab(defaultTab);
78
- }
79
- }, containerType, defaultTab, restrictToTabs, eventSource);
80
- }
81
- }, {
82
- key: "showMenu",
83
- value: function showMenu(column, positionCallback, containerType, defaultTab, restrictToTabs, eventSource) {
84
- var _this3 = this;
85
- var _this$getMenuParams = this.getMenuParams(column, restrictToTabs, eventSource),
86
- menu = _this$getMenuParams.menu,
87
- eMenuGui = _this$getMenuParams.eMenuGui,
88
- currentHeaderPosition = _this$getMenuParams.currentHeaderPosition,
89
- currentColumnIndex = _this$getMenuParams.currentColumnIndex,
90
- anchorToElement = _this$getMenuParams.anchorToElement;
91
- var closedFuncs = [];
92
- closedFuncs.push(this.getClosedCallback(column, menu, currentHeaderPosition, currentColumnIndex, eventSource));
93
- var translate = this.localeService.getLocaleTextFunc();
94
- // need to show filter before positioning, as only after filter
95
- // is visible can we find out what the width of it is
96
- var addPopupRes = this.popupService.addPopup({
97
- modal: true,
98
- eChild: eMenuGui,
99
- closeOnEsc: true,
100
- closedCallback: function closedCallback(e) {
101
- closedFuncs.forEach(function (f) {
102
- return f(e);
103
- });
104
- },
105
- afterGuiAttached: function afterGuiAttached(params) {
106
- return menu.afterGuiAttached(Object.assign({}, {
107
- container: containerType
108
- }, params));
109
- },
110
- // if defaultTab is not present, positionCallback will be called
111
- // after `showTabBasedOnPreviousSelection` is called.
112
- positionCallback: !!defaultTab ? function () {
113
- return positionCallback(menu);
114
- } : undefined,
115
- anchorToElement: anchorToElement,
116
- ariaLabel: translate('ariaLabelColumnMenu', 'Column Menu')
117
- });
118
- // if user starts showing / hiding columns, or otherwise move the underlying column
119
- // for this menu, we want to stop tracking the menu with the column position. otherwise
120
- // the menu would move as the user is using the columns tab inside the menu.
121
- this.addStopAnchoring(addPopupRes === null || addPopupRes === void 0 ? void 0 : addPopupRes.stopAnchoringPromise, column, closedFuncs);
122
- if (!defaultTab) {
123
- menu.showTabBasedOnPreviousSelection();
124
- // reposition the menu because the method above could load
125
- // an element that is bigger than enterpriseMenu header.
126
- positionCallback(menu);
127
- }
128
- menu.addEventListener(EnterpriseMenu.EVENT_TAB_SELECTED, function (event) {
129
- _this3.lastSelectedTab = event.key;
130
- });
131
- column.setMenuVisible(true, 'contextMenu');
132
- this.activeMenu = menu;
133
- menu.addEventListener(BeanStub.EVENT_DESTROYED, function () {
134
- if (_this3.activeMenu === menu) {
135
- _this3.activeMenu = null;
136
- }
137
- });
138
- }
139
- }, {
140
- key: "getClosedCallback",
141
- value: function getClosedCallback(column, menu, headerPosition, columnIndex, eventSource) {
142
- var _this4 = this;
143
- return function (e) {
144
- _this4.destroyBean(menu);
145
- column.setMenuVisible(false, 'contextMenu');
146
- var isKeyboardEvent = e instanceof KeyboardEvent;
147
- if (!isKeyboardEvent || !eventSource) {
148
- return;
149
- }
150
- if (_.isVisible(eventSource)) {
151
- var focusableEl = _this4.focusService.findTabbableParent(eventSource);
152
- if (focusableEl) {
153
- if (column) {
154
- _this4.headerNavigationService.scrollToColumn(column);
155
- }
156
- focusableEl.focus();
157
- }
158
- }
159
- // if the focusEl is no longer in the DOM, we try to focus
160
- // the header that is closest to the previous header position
161
- else if (headerPosition && columnIndex !== -1) {
162
- var allColumns = _this4.columnModel.getAllDisplayedColumns();
163
- var columnToFocus = allColumns[columnIndex] || _.last(allColumns);
164
- if (columnToFocus) {
165
- _this4.focusService.focusHeaderPosition({
166
- headerPosition: {
167
- headerRowIndex: headerPosition.headerRowIndex,
168
- column: columnToFocus
169
- }
170
- });
171
- }
172
- }
173
- };
174
- }
175
- }, {
176
- key: "addStopAnchoring",
177
- value: function addStopAnchoring(stopAnchoringPromise, column, closedFuncsArr) {
178
- if (!stopAnchoringPromise) {
179
- return;
180
- }
181
- stopAnchoringPromise.then(function (stopAnchoringFunc) {
182
- column.addEventListener('leftChanged', stopAnchoringFunc);
183
- column.addEventListener('visibleChanged', stopAnchoringFunc);
184
- closedFuncsArr.push(function () {
185
- column.removeEventListener('leftChanged', stopAnchoringFunc);
186
- column.removeEventListener('visibleChanged', stopAnchoringFunc);
187
- });
188
- });
189
- }
190
- }, {
191
- key: "getMenuParams",
192
- value: function getMenuParams(column, restrictToTabs, eventSource) {
193
- var menu = this.createBean(new EnterpriseMenu(column, this.lastSelectedTab, restrictToTabs));
194
- return {
195
- menu: menu,
196
- eMenuGui: menu.getGui(),
197
- currentHeaderPosition: this.focusService.getFocusedHeader(),
198
- currentColumnIndex: this.columnModel.getAllDisplayedColumns().indexOf(column),
199
- anchorToElement: eventSource || this.ctrlsService.getGridBodyCtrl().getGui()
200
- };
201
- }
202
- }, {
203
- key: "isMenuEnabled",
204
- value: function isMenuEnabled(column) {
205
- return column.getMenuTabs(EnterpriseMenu.TABS_DEFAULT).length > 0;
206
- }
207
- }]);
208
- return EnterpriseMenuFactory;
209
- }(BeanStub);
210
- __decorate([Autowired('popupService')], EnterpriseMenuFactory.prototype, "popupService", void 0);
211
- __decorate([Autowired('focusService')], EnterpriseMenuFactory.prototype, "focusService", void 0);
212
- __decorate([Autowired('headerNavigationService')], EnterpriseMenuFactory.prototype, "headerNavigationService", void 0);
213
- __decorate([Autowired('ctrlsService')], EnterpriseMenuFactory.prototype, "ctrlsService", void 0);
214
- __decorate([Autowired('columnModel')], EnterpriseMenuFactory.prototype, "columnModel", void 0);
215
- EnterpriseMenuFactory = __decorate([Bean('menuFactory')], EnterpriseMenuFactory);
216
- export { EnterpriseMenuFactory };
217
- export var EnterpriseMenu = /*#__PURE__*/function (_BeanStub2) {
218
- _inherits(EnterpriseMenu, _BeanStub2);
219
- var _super2 = _createSuper(EnterpriseMenu);
220
- function EnterpriseMenu(column, initialSelection, restrictTo) {
221
- var _this5;
222
- _classCallCheck(this, EnterpriseMenu);
223
- _this5 = _super2.call(this);
224
- _this5.tabFactories = {};
225
- _this5.includeChecks = {};
226
- _this5.column = column;
227
- _this5.initialSelection = initialSelection;
228
- _this5.tabFactories[EnterpriseMenu.TAB_GENERAL] = _this5.createMainPanel.bind(_assertThisInitialized(_this5));
229
- _this5.tabFactories[EnterpriseMenu.TAB_FILTER] = _this5.createFilterPanel.bind(_assertThisInitialized(_this5));
230
- _this5.tabFactories[EnterpriseMenu.TAB_COLUMNS] = _this5.createColumnsPanel.bind(_assertThisInitialized(_this5));
231
- _this5.includeChecks[EnterpriseMenu.TAB_GENERAL] = function () {
232
- return true;
233
- };
234
- _this5.includeChecks[EnterpriseMenu.TAB_FILTER] = function () {
235
- return _this5.filterManager.isFilterAllowed(column);
236
- };
237
- _this5.includeChecks[EnterpriseMenu.TAB_COLUMNS] = function () {
238
- return true;
239
- };
240
- _this5.restrictTo = restrictTo;
241
- return _this5;
242
- }
243
- _createClass(EnterpriseMenu, [{
244
- key: "init",
245
- value: function init() {
246
- var _this6 = this;
247
- var tabs = this.getTabsToCreate().map(function (name) {
248
- return _this6.createTab(name);
249
- });
250
- this.tabbedLayout = new TabbedLayout({
251
- items: tabs,
252
- cssClass: 'ag-menu',
253
- onActiveItemClicked: this.onHidePopup.bind(this),
254
- onItemClicked: this.onTabItemClicked.bind(this)
255
- });
256
- this.createBean(this.tabbedLayout);
257
- if (this.mainMenuList) {
258
- this.mainMenuList.setParentComponent(this.tabbedLayout);
259
- }
260
- this.addDestroyFunc(function () {
261
- return _this6.destroyBean(_this6.tabbedLayout);
262
- });
263
- }
264
- }, {
265
- key: "getTabsToCreate",
266
- value: function getTabsToCreate() {
267
- var _this7 = this;
268
- if (this.restrictTo) {
269
- return this.restrictTo;
270
- }
271
- return this.column.getMenuTabs(EnterpriseMenu.TABS_DEFAULT).filter(function (tabName) {
272
- return _this7.isValidMenuTabItem(tabName);
273
- }).filter(function (tabName) {
274
- return _this7.isNotSuppressed(tabName);
275
- }).filter(function (tabName) {
276
- return _this7.isModuleLoaded(tabName);
277
- });
278
- }
279
- }, {
280
- key: "isModuleLoaded",
281
- value: function isModuleLoaded(menuTabName) {
282
- if (menuTabName === EnterpriseMenu.TAB_COLUMNS) {
283
- return ModuleRegistry.isRegistered(ModuleNames.ColumnsToolPanelModule);
284
- }
285
- return true;
286
- }
287
- }, {
288
- key: "isValidMenuTabItem",
289
- value: function isValidMenuTabItem(menuTabName) {
290
- var isValid = true;
291
- var itemsToConsider = EnterpriseMenu.TABS_DEFAULT;
292
- if (this.restrictTo != null) {
293
- isValid = this.restrictTo.indexOf(menuTabName) > -1;
294
- itemsToConsider = this.restrictTo;
295
- }
296
- isValid = isValid && EnterpriseMenu.TABS_DEFAULT.indexOf(menuTabName) > -1;
297
- if (!isValid) {
298
- console.warn("AG Grid: Trying to render an invalid menu item '".concat(menuTabName, "'. Check that your 'menuTabs' contains one of [").concat(itemsToConsider, "]"));
299
- }
300
- return isValid;
301
- }
302
- }, {
303
- key: "isNotSuppressed",
304
- value: function isNotSuppressed(menuTabName) {
305
- return this.includeChecks[menuTabName]();
306
- }
307
- }, {
308
- key: "createTab",
309
- value: function createTab(name) {
310
- return this.tabFactories[name]();
311
- }
312
- }, {
313
- key: "showTabBasedOnPreviousSelection",
314
- value: function showTabBasedOnPreviousSelection() {
315
- // show the tab the user was on last time they had a menu open
316
- this.showTab(this.initialSelection);
317
- }
318
- }, {
319
- key: "showTab",
320
- value: function showTab(toShow) {
321
- if (this.tabItemColumns && toShow === EnterpriseMenu.TAB_COLUMNS) {
322
- this.tabbedLayout.showItem(this.tabItemColumns);
323
- } else if (this.tabItemFilter && toShow === EnterpriseMenu.TAB_FILTER) {
324
- this.tabbedLayout.showItem(this.tabItemFilter);
325
- } else if (this.tabItemGeneral && toShow === EnterpriseMenu.TAB_GENERAL) {
326
- this.tabbedLayout.showItem(this.tabItemGeneral);
327
- } else {
328
- this.tabbedLayout.showFirstItem();
329
- }
330
- }
331
- }, {
332
- key: "onTabItemClicked",
333
- value: function onTabItemClicked(event) {
334
- var key = null;
335
- switch (event.item) {
336
- case this.tabItemColumns:
337
- key = EnterpriseMenu.TAB_COLUMNS;
338
- break;
339
- case this.tabItemFilter:
340
- key = EnterpriseMenu.TAB_FILTER;
341
- break;
342
- case this.tabItemGeneral:
343
- key = EnterpriseMenu.TAB_GENERAL;
344
- break;
345
- }
346
- if (key) {
347
- this.activateTab(key);
348
- }
349
- }
350
- }, {
351
- key: "activateTab",
352
- value: function activateTab(tab) {
353
- var ev = {
354
- type: EnterpriseMenu.EVENT_TAB_SELECTED,
355
- key: tab
356
- };
357
- this.dispatchEvent(ev);
358
- }
359
- }, {
360
- key: "getMenuItems",
361
- value: function getMenuItems() {
362
- var defaultMenuOptions = this.getDefaultMenuOptions();
363
- var result;
364
- var userFunc = this.gridOptionsService.getCallback('getMainMenuItems');
365
- if (userFunc) {
366
- result = userFunc({
367
- column: this.column,
368
- defaultItems: defaultMenuOptions
369
- });
370
- } else {
371
- result = defaultMenuOptions;
372
- }
373
- // GUI looks weird when two separators are side by side. this can happen accidentally
374
- // if we remove items from the menu then two separators can edit up adjacent.
375
- _.removeRepeatsFromArray(result, EnterpriseMenu.MENU_ITEM_SEPARATOR);
376
- return result;
377
- }
378
- }, {
379
- key: "getDefaultMenuOptions",
380
- value: function getDefaultMenuOptions() {
381
- var result = [];
382
- var allowPinning = !this.column.getColDef().lockPinned;
383
- var rowGroupCount = this.columnModel.getRowGroupColumns().length;
384
- var doingGrouping = rowGroupCount > 0;
385
- var groupedByThisColumn = this.columnModel.getRowGroupColumns().indexOf(this.column) >= 0;
386
- var allowValue = this.column.isAllowValue();
387
- var allowRowGroup = this.column.isAllowRowGroup();
388
- var isPrimary = this.column.isPrimary();
389
- var pivotModeOn = this.columnModel.isPivotMode();
390
- var isInMemoryRowModel = this.rowModel.getType() === 'clientSide';
391
- var usingTreeData = this.gridOptionsService.isTreeData();
392
- var allowValueAgg =
393
- // if primary, then only allow aggValue if grouping and it's a value columns
394
- isPrimary && doingGrouping && allowValue
395
- // secondary columns can always have aggValue, as it means it's a pivot value column
396
- || !isPrimary;
397
- if (allowPinning) {
398
- result.push('pinSubMenu');
399
- }
400
- if (allowValueAgg) {
401
- result.push('valueAggSubMenu');
402
- }
403
- if (allowPinning || allowValueAgg) {
404
- result.push(EnterpriseMenu.MENU_ITEM_SEPARATOR);
405
- }
406
- result.push('autoSizeThis');
407
- result.push('autoSizeAll');
408
- result.push(EnterpriseMenu.MENU_ITEM_SEPARATOR);
409
- if (allowRowGroup && this.column.isPrimary()) {
410
- if (groupedByThisColumn) {
411
- result.push('rowUnGroup');
412
- } else {
413
- result.push('rowGroup');
414
- }
415
- }
416
- result.push(EnterpriseMenu.MENU_ITEM_SEPARATOR);
417
- result.push('resetColumns');
418
- // only add grouping expand/collapse if grouping in the InMemoryRowModel
419
- // if pivoting, we only have expandable groups if grouping by 2 or more columns
420
- // as the lowest level group is not expandable while pivoting.
421
- // if not pivoting, then any active row group can be expanded.
422
- var allowExpandAndContract = isInMemoryRowModel && (usingTreeData || rowGroupCount > (pivotModeOn ? 1 : 0));
423
- if (allowExpandAndContract) {
424
- result.push('expandAll');
425
- result.push('contractAll');
426
- }
427
- return result;
428
- }
429
- }, {
430
- key: "createMainPanel",
431
- value: function createMainPanel() {
432
- this.mainMenuList = this.createManagedBean(new AgMenuList());
433
- var menuItems = this.getMenuItems();
434
- var menuItemsMapped = this.menuItemMapper.mapWithStockItems(menuItems, this.column);
435
- this.mainMenuList.addMenuItems(menuItemsMapped);
436
- this.mainMenuList.addEventListener(AgMenuItemComponent.EVENT_MENU_ITEM_SELECTED, this.onHidePopup.bind(this));
437
- this.tabItemGeneral = {
438
- title: _.createIconNoSpan('menu', this.gridOptionsService, this.column),
439
- titleLabel: EnterpriseMenu.TAB_GENERAL.replace('MenuTab', ''),
440
- bodyPromise: AgPromise.resolve(this.mainMenuList.getGui()),
441
- name: EnterpriseMenu.TAB_GENERAL
442
- };
443
- return this.tabItemGeneral;
444
- }
445
- }, {
446
- key: "onHidePopup",
447
- value: function onHidePopup(event) {
448
- var keyboardEvent;
449
- if (event && event.event && event.event instanceof KeyboardEvent) {
450
- keyboardEvent = event.event;
451
- }
452
- this.hidePopupFunc(keyboardEvent && {
453
- keyboardEvent: keyboardEvent
454
- });
455
- // this method only gets called when the menu was closed by selection an option
456
- // in this case we highlight the cell that was previously highlighted
457
- var focusedCell = this.focusService.getFocusedCell();
458
- var eDocument = this.gridOptionsService.getDocument();
459
- if (eDocument.activeElement === eDocument.body && focusedCell) {
460
- var rowIndex = focusedCell.rowIndex,
461
- rowPinned = focusedCell.rowPinned,
462
- column = focusedCell.column;
463
- this.focusService.setFocusedCell({
464
- rowIndex: rowIndex,
465
- column: column,
466
- rowPinned: rowPinned,
467
- forceBrowserFocus: true,
468
- preventScrollOnBrowserFocus: true
469
- });
470
- }
471
- }
472
- }, {
473
- key: "createFilterPanel",
474
- value: function createFilterPanel() {
475
- var filterWrapper = this.filterManager.getOrCreateFilterWrapper(this.column, 'COLUMN_MENU');
476
- if (!filterWrapper) {
477
- throw new Error('AG Grid - Unable to instantiate filter');
478
- }
479
- var afterFilterAttachedCallback = function afterFilterAttachedCallback(params) {
480
- if (!(filterWrapper === null || filterWrapper === void 0 ? void 0 : filterWrapper.filterPromise)) {
481
- return;
482
- }
483
- // slightly odd block this - this promise will always have been resolved by the time it gets here, so won't be
484
- // async (_unless_ in react or similar, but if so why not encountered before now?).
485
- // I'd suggest a future improvement would be to remove/replace this promise as this block just wont work if it is
486
- // async and is confusing if you don't have this context
487
- filterWrapper.filterPromise.then(function (filter) {
488
- if (filter && filter.afterGuiAttached) {
489
- filter.afterGuiAttached(params);
490
- }
491
- });
492
- };
493
- // see comment above
494
- var afterDetachedCallback = function afterDetachedCallback() {
495
- var _a;
496
- return (_a = filterWrapper === null || filterWrapper === void 0 ? void 0 : filterWrapper.filterPromise) === null || _a === void 0 ? void 0 : _a.then(function (filter) {
497
- var _a;
498
- return (_a = filter === null || filter === void 0 ? void 0 : filter.afterGuiDetached) === null || _a === void 0 ? void 0 : _a.call(filter);
499
- });
500
- };
501
- this.tabItemFilter = {
502
- title: _.createIconNoSpan('filter', this.gridOptionsService, this.column),
503
- titleLabel: EnterpriseMenu.TAB_FILTER.replace('MenuTab', ''),
504
- bodyPromise: filterWrapper === null || filterWrapper === void 0 ? void 0 : filterWrapper.guiPromise,
505
- afterAttachedCallback: afterFilterAttachedCallback,
506
- afterDetachedCallback: afterDetachedCallback,
507
- name: EnterpriseMenu.TAB_FILTER
508
- };
509
- return this.tabItemFilter;
510
- }
511
- }, {
512
- key: "createColumnsPanel",
513
- value: function createColumnsPanel() {
514
- var eWrapperDiv = document.createElement('div');
515
- eWrapperDiv.classList.add('ag-menu-column-select-wrapper');
516
- var columnSelectPanel = this.createManagedBean(new PrimaryColsPanel());
517
- var columnsMenuParams = this.column.getColDef().columnsMenuParams;
518
- if (!columnsMenuParams) {
519
- columnsMenuParams = {};
520
- }
521
- var _columnsMenuParams = columnsMenuParams,
522
- contractColumnSelection = _columnsMenuParams.contractColumnSelection,
523
- suppressColumnExpandAll = _columnsMenuParams.suppressColumnExpandAll,
524
- suppressColumnFilter = _columnsMenuParams.suppressColumnFilter,
525
- suppressColumnSelectAll = _columnsMenuParams.suppressColumnSelectAll,
526
- suppressSyncLayoutWithGrid = _columnsMenuParams.suppressSyncLayoutWithGrid,
527
- columnLayout = _columnsMenuParams.columnLayout;
528
- columnSelectPanel.init(false, {
529
- suppressColumnMove: false,
530
- suppressValues: false,
531
- suppressPivots: false,
532
- suppressRowGroups: false,
533
- suppressPivotMode: false,
534
- contractColumnSelection: !!contractColumnSelection,
535
- suppressColumnExpandAll: !!suppressColumnExpandAll,
536
- suppressColumnFilter: !!suppressColumnFilter,
537
- suppressColumnSelectAll: !!suppressColumnSelectAll,
538
- suppressSyncLayoutWithGrid: !!columnLayout || !!suppressSyncLayoutWithGrid,
539
- api: this.gridApi,
540
- columnApi: this.columnApi,
541
- context: this.gridOptionsService.context
542
- }, 'columnMenu');
543
- if (columnLayout) {
544
- columnSelectPanel.setColumnLayout(columnLayout);
545
- }
546
- var columnSelectPanelGui = columnSelectPanel.getGui();
547
- columnSelectPanelGui.classList.add('ag-menu-column-select');
548
- eWrapperDiv.appendChild(columnSelectPanelGui);
549
- this.tabItemColumns = {
550
- title: _.createIconNoSpan('columns', this.gridOptionsService, this.column),
551
- titleLabel: EnterpriseMenu.TAB_COLUMNS.replace('MenuTab', ''),
552
- bodyPromise: AgPromise.resolve(eWrapperDiv),
553
- name: EnterpriseMenu.TAB_COLUMNS
554
- };
555
- return this.tabItemColumns;
556
- }
557
- }, {
558
- key: "afterGuiAttached",
559
- value: function afterGuiAttached(params) {
560
- var container = params.container,
561
- hidePopup = params.hidePopup;
562
- this.tabbedLayout.setAfterAttachedParams({
563
- container: container,
564
- hidePopup: hidePopup
565
- });
566
- if (hidePopup) {
567
- this.hidePopupFunc = hidePopup;
568
- this.addDestroyFunc(hidePopup);
569
- }
570
- }
571
- }, {
572
- key: "getGui",
573
- value: function getGui() {
574
- return this.tabbedLayout.getGui();
575
- }
576
- }]);
577
- return EnterpriseMenu;
578
- }(BeanStub);
579
- EnterpriseMenu.EVENT_TAB_SELECTED = 'tabSelected';
580
- EnterpriseMenu.TAB_FILTER = 'filterMenuTab';
581
- EnterpriseMenu.TAB_GENERAL = 'generalMenuTab';
582
- EnterpriseMenu.TAB_COLUMNS = 'columnsMenuTab';
583
- EnterpriseMenu.TABS_DEFAULT = [EnterpriseMenu.TAB_GENERAL, EnterpriseMenu.TAB_FILTER, EnterpriseMenu.TAB_COLUMNS];
584
- EnterpriseMenu.MENU_ITEM_SEPARATOR = 'separator';
585
- __decorate([Autowired('columnModel')], EnterpriseMenu.prototype, "columnModel", void 0);
586
- __decorate([Autowired('filterManager')], EnterpriseMenu.prototype, "filterManager", void 0);
587
- __decorate([Autowired('gridApi')], EnterpriseMenu.prototype, "gridApi", void 0);
588
- __decorate([Autowired('columnApi')], EnterpriseMenu.prototype, "columnApi", void 0);
589
- __decorate([Autowired('menuItemMapper')], EnterpriseMenu.prototype, "menuItemMapper", void 0);
590
- __decorate([Autowired('rowModel')], EnterpriseMenu.prototype, "rowModel", void 0);
591
- __decorate([Autowired('focusService')], EnterpriseMenu.prototype, "focusService", void 0);
592
- __decorate([PostConstruct], EnterpriseMenu.prototype, "init", null);
@@ -1,13 +0,0 @@
1
- import { BeanStub, Column, MenuItemDef } from '@ag-grid-community/core';
2
- export declare class MenuItemMapper extends BeanStub {
3
- private readonly columnModel;
4
- private readonly gridApi;
5
- private readonly clipboardService;
6
- private readonly aggFuncService;
7
- private readonly focusService;
8
- private readonly rowPositionUtils;
9
- private readonly chartMenuItemMapper;
10
- mapWithStockItems(originalList: (MenuItemDef | string)[], column: Column | null): (MenuItemDef | string)[];
11
- private getStockMenuItem;
12
- private createAggregationSubMenu;
13
- }