@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,516 +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 _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
13
- function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
14
- 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); }
15
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
16
- 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); }; }
17
- 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); }
18
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
19
- 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; } }
20
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
21
- 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); }
22
- var __decorate = this && this.__decorate || function (decorators, target, key, desc) {
23
- var c = arguments.length,
24
- r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
25
- d;
26
- 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;
27
- return c > 3 && r && Object.defineProperty(target, key, r), r;
28
- };
29
- import { Autowired, Component, DragSourceType, Events, KeyCode, ManagedFocusFeature, PositionableFeature, _ } from "@ag-grid-community/core";
30
- import { DropZoneColumnComp } from "./dropZoneColumnComp";
31
- export var BaseDropZonePanel = /*#__PURE__*/function (_Component) {
32
- _inherits(BaseDropZonePanel, _Component);
33
- var _super = _createSuper(BaseDropZonePanel);
34
- function BaseDropZonePanel(horizontal, dropZonePurpose) {
35
- var _this;
36
- _classCallCheck(this, BaseDropZonePanel);
37
- _this = _super.call(this, /* html */"<div class=\"ag-unselectable\" role=\"presentation\"></div>");
38
- _this.horizontal = horizontal;
39
- _this.dropZonePurpose = dropZonePurpose;
40
- _this.state = BaseDropZonePanel.STATE_NOT_DRAGGING;
41
- _this.guiDestroyFunctions = [];
42
- _this.childColumnComponents = [];
43
- _this.resizeEnabled = false;
44
- _this.addElementClasses(_this.getGui());
45
- _this.eColumnDropList = document.createElement('div');
46
- _this.addElementClasses(_this.eColumnDropList, 'list');
47
- _.setAriaRole(_this.eColumnDropList, 'listbox');
48
- return _this;
49
- }
50
- _createClass(BaseDropZonePanel, [{
51
- key: "isHorizontal",
52
- value: function isHorizontal() {
53
- return this.horizontal;
54
- }
55
- }, {
56
- key: "toggleResizable",
57
- value: function toggleResizable(resizable) {
58
- this.positionableFeature.setResizable(resizable ? {
59
- bottom: true
60
- } : false);
61
- this.resizeEnabled = resizable;
62
- }
63
- }, {
64
- key: "setBeans",
65
- value: function setBeans(beans) {
66
- this.beans = beans;
67
- }
68
- }, {
69
- key: "destroy",
70
- value: function destroy() {
71
- this.destroyGui();
72
- _get(_getPrototypeOf(BaseDropZonePanel.prototype), "destroy", this).call(this);
73
- }
74
- }, {
75
- key: "destroyGui",
76
- value: function destroyGui() {
77
- this.guiDestroyFunctions.forEach(function (func) {
78
- return func();
79
- });
80
- this.guiDestroyFunctions.length = 0;
81
- this.childColumnComponents.length = 0;
82
- _.clearElement(this.getGui());
83
- _.clearElement(this.eColumnDropList);
84
- }
85
- }, {
86
- key: "init",
87
- value: function init(params) {
88
- this.params = params;
89
- this.createManagedBean(new ManagedFocusFeature(this.getFocusableElement(), {
90
- handleKeyDown: this.handleKeyDown.bind(this)
91
- }));
92
- this.addManagedListener(this.beans.eventService, Events.EVENT_NEW_COLUMNS_LOADED, this.refreshGui.bind(this));
93
- this.addManagedPropertyListener('functionsReadOnly', this.refreshGui.bind(this));
94
- this.setupDropTarget();
95
- this.positionableFeature = new PositionableFeature(this.getGui(), {
96
- minHeight: 100
97
- });
98
- this.createManagedBean(this.positionableFeature);
99
- // we don't know if this bean will be initialised before columnModel.
100
- // if columnModel first, then below will work
101
- // if columnModel second, then below will put blank in, and then above event gets first when columnModel is set up
102
- this.refreshGui();
103
- _.setAriaLabel(this.eColumnDropList, this.getAriaLabel());
104
- }
105
- }, {
106
- key: "handleKeyDown",
107
- value: function handleKeyDown(e) {
108
- var isVertical = !this.horizontal;
109
- var isNext = e.key === KeyCode.DOWN;
110
- var isPrevious = e.key === KeyCode.UP;
111
- if (!isVertical) {
112
- var isRtl = this.gridOptionsService.is('enableRtl');
113
- isNext = !isRtl && e.key === KeyCode.RIGHT || isRtl && e.key === KeyCode.LEFT;
114
- isPrevious = !isRtl && e.key === KeyCode.LEFT || isRtl && e.key === KeyCode.RIGHT;
115
- }
116
- if (!isNext && !isPrevious) {
117
- return;
118
- }
119
- var el = this.focusService.findNextFocusableElement(this.getFocusableElement(), false, isPrevious);
120
- if (el) {
121
- e.preventDefault();
122
- el.focus();
123
- }
124
- }
125
- }, {
126
- key: "addElementClasses",
127
- value: function addElementClasses(el, suffix) {
128
- suffix = suffix ? "-".concat(suffix) : '';
129
- var direction = this.horizontal ? 'horizontal' : 'vertical';
130
- el.classList.add("ag-column-drop".concat(suffix), "ag-column-drop-".concat(direction).concat(suffix));
131
- }
132
- }, {
133
- key: "setupDropTarget",
134
- value: function setupDropTarget() {
135
- this.dropTarget = {
136
- getContainer: this.getGui.bind(this),
137
- getIconName: this.getIconName.bind(this),
138
- onDragging: this.onDragging.bind(this),
139
- onDragEnter: this.onDragEnter.bind(this),
140
- onDragLeave: this.onDragLeave.bind(this),
141
- onDragStop: this.onDragStop.bind(this),
142
- isInterestedIn: this.isInterestedIn.bind(this)
143
- };
144
- this.beans.dragAndDropService.addDropTarget(this.dropTarget);
145
- }
146
- }, {
147
- key: "isInterestedIn",
148
- value: function isInterestedIn(type) {
149
- // not interested in row drags
150
- return type === DragSourceType.HeaderCell || type === DragSourceType.ToolPanel;
151
- }
152
- }, {
153
- key: "checkInsertIndex",
154
- value: function checkInsertIndex(draggingEvent) {
155
- var newIndex = this.getNewInsertIndex(draggingEvent);
156
- // <0 happens when drag is no a direction we are interested in, eg drag is up/down but in horizontal panel
157
- if (newIndex < 0) {
158
- return false;
159
- }
160
- var changed = newIndex !== this.insertIndex;
161
- if (changed) {
162
- this.insertIndex = newIndex;
163
- }
164
- return changed;
165
- }
166
- }, {
167
- key: "getNewInsertIndex",
168
- value: function getNewInsertIndex(draggingEvent) {
169
- var _this2 = this;
170
- var mouseEvent = draggingEvent.event;
171
- var mouseLocation = this.horizontal ? mouseEvent.clientX : mouseEvent.clientY;
172
- var boundsList = this.childColumnComponents.map(function (col) {
173
- return col.getGui().getBoundingClientRect();
174
- });
175
- // find the non-ghost component we're hovering
176
- var hoveredIndex = boundsList.findIndex(function (rect) {
177
- return _this2.horizontal ? rect.right > mouseLocation && rect.left < mouseLocation : rect.top < mouseLocation && rect.bottom > mouseLocation;
178
- });
179
- // not hovering a non-ghost component
180
- if (hoveredIndex === -1) {
181
- var enableRtl = this.beans.gridOptionsService.is('enableRtl');
182
- // if mouse is below or right of all components then new index should be placed last
183
- var isLast = boundsList.every(function (rect) {
184
- return mouseLocation > (_this2.horizontal ? rect.right : rect.bottom);
185
- });
186
- if (isLast) {
187
- return enableRtl && this.horizontal ? 0 : this.childColumnComponents.length;
188
- }
189
- // if mouse is above or left of all components, new index is first
190
- var isFirst = boundsList.every(function (rect) {
191
- return mouseLocation < (_this2.horizontal ? rect.left : rect.top);
192
- });
193
- if (isFirst) {
194
- return enableRtl && this.horizontal ? this.childColumnComponents.length : 0;
195
- }
196
- // must be hovering a ghost, don't change the index
197
- return this.insertIndex;
198
- }
199
- // if the old index is equal to or less than the index of our new target
200
- // we need to shift right, to insert after rather than before
201
- if (this.insertIndex <= hoveredIndex) {
202
- return hoveredIndex + 1;
203
- }
204
- return hoveredIndex;
205
- }
206
- }, {
207
- key: "checkDragStartedBySelf",
208
- value: function checkDragStartedBySelf(draggingEvent) {
209
- if (this.state !== BaseDropZonePanel.STATE_NOT_DRAGGING) {
210
- return;
211
- }
212
- this.state = BaseDropZonePanel.STATE_REARRANGE_COLUMNS;
213
- this.potentialDndColumns = draggingEvent.dragSource.getDragItem().columns || [];
214
- this.refreshGui();
215
- this.checkInsertIndex(draggingEvent);
216
- this.refreshGui();
217
- }
218
- }, {
219
- key: "onDragging",
220
- value: function onDragging(draggingEvent) {
221
- this.checkDragStartedBySelf(draggingEvent);
222
- if (this.checkInsertIndex(draggingEvent)) {
223
- this.refreshGui();
224
- }
225
- }
226
- }, {
227
- key: "onDragEnter",
228
- value: function onDragEnter(draggingEvent) {
229
- // this will contain all columns that are potential drops
230
- var dragColumns = draggingEvent.dragSource.getDragItem().columns || [];
231
- this.state = BaseDropZonePanel.STATE_NEW_COLUMNS_IN;
232
- // take out columns that are not droppable
233
- var goodDragColumns = dragColumns.filter(this.isColumnDroppable.bind(this));
234
- if (goodDragColumns.length > 0) {
235
- var hideColumnOnExit = this.isRowGroupPanel() && !this.gridOptionsService.is('suppressRowGroupHidesColumns') && !draggingEvent.fromNudge;
236
- if (hideColumnOnExit) {
237
- var dragItem = draggingEvent.dragSource.getDragItem();
238
- var columns = dragItem.columns;
239
- this.setColumnsVisible(columns, false, "uiColumnDragged");
240
- }
241
- this.potentialDndColumns = goodDragColumns;
242
- this.checkInsertIndex(draggingEvent);
243
- this.refreshGui();
244
- }
245
- }
246
- }, {
247
- key: "setColumnsVisible",
248
- value: function setColumnsVisible(columns, visible) {
249
- var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "api";
250
- if (columns) {
251
- var allowedCols = columns.filter(function (c) {
252
- return !c.getColDef().lockVisible;
253
- });
254
- this.colModel.setColumnsVisible(allowedCols, visible, source);
255
- }
256
- }
257
- }, {
258
- key: "isPotentialDndColumns",
259
- value: function isPotentialDndColumns() {
260
- return _.existsAndNotEmpty(this.potentialDndColumns);
261
- }
262
- }, {
263
- key: "isRowGroupPanel",
264
- value: function isRowGroupPanel() {
265
- return this.dropZonePurpose === 'rowGroup';
266
- }
267
- }, {
268
- key: "onDragLeave",
269
- value: function onDragLeave(draggingEvent) {
270
- // if the dragging started from us, we remove the group, however if it started
271
- // some place else, then we don't, as it was only 'asking'
272
- if (this.state === BaseDropZonePanel.STATE_REARRANGE_COLUMNS) {
273
- var columns = draggingEvent.dragSource.getDragItem().columns || [];
274
- this.removeColumns(columns);
275
- }
276
- if (this.isPotentialDndColumns()) {
277
- var showColumnOnExit = this.isRowGroupPanel() && !this.gridOptionsService.is('suppressMakeColumnVisibleAfterUnGroup') && !draggingEvent.fromNudge;
278
- if (showColumnOnExit) {
279
- var dragItem = draggingEvent.dragSource.getDragItem();
280
- this.setColumnsVisible(dragItem.columns, true, "uiColumnDragged");
281
- }
282
- this.potentialDndColumns = [];
283
- this.refreshGui();
284
- }
285
- this.state = BaseDropZonePanel.STATE_NOT_DRAGGING;
286
- }
287
- }, {
288
- key: "onDragStop",
289
- value: function onDragStop() {
290
- if (this.isPotentialDndColumns()) {
291
- var success = false;
292
- if (this.state === BaseDropZonePanel.STATE_NEW_COLUMNS_IN) {
293
- this.addColumns(this.potentialDndColumns);
294
- success = true;
295
- } else {
296
- success = this.rearrangeColumns(this.potentialDndColumns);
297
- }
298
- this.potentialDndColumns = [];
299
- // If the function is passive, then we don't refresh, as we assume the client application
300
- // is going to call setRowGroups / setPivots / setValues at a later point which will then
301
- // cause a refresh. This gives a nice GUI where the ghost stays until the app has caught
302
- // up with the changes. However, if there was no change in the order, then we do need to
303
- // refresh to reset the columns
304
- if (!this.beans.gridOptionsService.is('functionsPassive') || !success) {
305
- this.refreshGui();
306
- }
307
- }
308
- this.state = BaseDropZonePanel.STATE_NOT_DRAGGING;
309
- }
310
- }, {
311
- key: "removeColumns",
312
- value: function removeColumns(columnsToRemove) {
313
- var newColumnList = this.getExistingColumns().filter(function (col) {
314
- return !_.includes(columnsToRemove, col);
315
- });
316
- this.updateColumns(newColumnList);
317
- }
318
- }, {
319
- key: "addColumns",
320
- value: function addColumns(columnsToAdd) {
321
- if (!columnsToAdd) {
322
- return;
323
- }
324
- var newColumnList = this.getExistingColumns().slice();
325
- var colsToAddNoDuplicates = columnsToAdd.filter(function (col) {
326
- return newColumnList.indexOf(col) < 0;
327
- });
328
- _.insertArrayIntoArray(newColumnList, colsToAddNoDuplicates, this.insertIndex);
329
- this.updateColumns(newColumnList);
330
- }
331
- }, {
332
- key: "rearrangeColumns",
333
- value: function rearrangeColumns(columnsToAdd) {
334
- var newColumnList = this.getNonGhostColumns().slice();
335
- _.insertArrayIntoArray(newColumnList, columnsToAdd, this.insertIndex);
336
- if (_.areEqual(newColumnList, this.getExistingColumns())) {
337
- return false;
338
- }
339
- this.updateColumns(newColumnList);
340
- return true;
341
- }
342
- }, {
343
- key: "refreshGui",
344
- value: function refreshGui() {
345
- // we reset the scroll position after the refresh.
346
- // if we don't do this, then the list will always scroll to the top
347
- // each time we refresh it. this is because part of the refresh empties
348
- // out the list which sets scroll to zero. so the user could be just
349
- // reordering the list - we want to prevent the resetting of the scroll.
350
- // this is relevant for vertical display only (as horizontal has no scroll)
351
- var scrollTop = this.eColumnDropList.scrollTop;
352
- var resizeEnabled = this.resizeEnabled;
353
- var focusedIndex = this.getFocusedItem();
354
- var alternateElement = this.focusService.findNextFocusableElement();
355
- if (!alternateElement) {
356
- alternateElement = this.focusService.findNextFocusableElement(undefined, false, true);
357
- }
358
- this.toggleResizable(false);
359
- this.destroyGui();
360
- this.addIconAndTitleToGui();
361
- this.addEmptyMessageToGui();
362
- this.addColumnsToGui();
363
- if (!this.isHorizontal()) {
364
- this.eColumnDropList.scrollTop = scrollTop;
365
- }
366
- if (resizeEnabled) {
367
- this.toggleResizable(resizeEnabled);
368
- }
369
- this.restoreFocus(focusedIndex, alternateElement);
370
- }
371
- }, {
372
- key: "getFocusedItem",
373
- value: function getFocusedItem() {
374
- var eGui = this.getGui();
375
- var activeElement = this.gridOptionsService.getDocument().activeElement;
376
- if (!eGui.contains(activeElement)) {
377
- return -1;
378
- }
379
- var items = Array.from(eGui.querySelectorAll('.ag-column-drop-cell'));
380
- return items.indexOf(activeElement);
381
- }
382
- }, {
383
- key: "restoreFocus",
384
- value: function restoreFocus(index, alternateElement) {
385
- var eGui = this.getGui();
386
- var items = Array.from(eGui.querySelectorAll('.ag-column-drop-cell'));
387
- if (index === -1) {
388
- return;
389
- }
390
- if (items.length === 0) {
391
- alternateElement.focus();
392
- }
393
- var indexToFocus = Math.min(items.length - 1, index);
394
- var el = items[indexToFocus];
395
- if (el) {
396
- el.focus();
397
- }
398
- }
399
- }, {
400
- key: "getNonGhostColumns",
401
- value: function getNonGhostColumns() {
402
- var _this3 = this;
403
- var existingColumns = this.getExistingColumns();
404
- if (this.isPotentialDndColumns()) {
405
- return existingColumns.filter(function (column) {
406
- return !_.includes(_this3.potentialDndColumns, column);
407
- });
408
- }
409
- return existingColumns;
410
- }
411
- }, {
412
- key: "addColumnsToGui",
413
- value: function addColumnsToGui() {
414
- var _this4 = this;
415
- var nonGhostColumns = this.getNonGhostColumns();
416
- var itemsToAddToGui = nonGhostColumns.map(function (column) {
417
- return _this4.createColumnComponent(column, false);
418
- });
419
- if (this.isPotentialDndColumns()) {
420
- var dndColumns = this.potentialDndColumns.map(function (column) {
421
- return _this4.createColumnComponent(column, true);
422
- });
423
- if (this.insertIndex >= itemsToAddToGui.length) {
424
- itemsToAddToGui.push.apply(itemsToAddToGui, _toConsumableArray(dndColumns));
425
- } else {
426
- itemsToAddToGui.splice.apply(itemsToAddToGui, [this.insertIndex, 0].concat(_toConsumableArray(dndColumns)));
427
- }
428
- }
429
- this.appendChild(this.eColumnDropList);
430
- itemsToAddToGui.forEach(function (columnComponent, index) {
431
- if (index > 0) {
432
- _this4.addArrow(_this4.eColumnDropList);
433
- }
434
- _this4.eColumnDropList.appendChild(columnComponent.getGui());
435
- });
436
- this.addAriaLabelsToComponents();
437
- }
438
- }, {
439
- key: "addAriaLabelsToComponents",
440
- value: function addAriaLabelsToComponents() {
441
- var _this5 = this;
442
- this.childColumnComponents.forEach(function (comp, idx) {
443
- var eGui = comp.getGui();
444
- _.setAriaPosInSet(eGui, idx + 1);
445
- _.setAriaSetSize(eGui, _this5.childColumnComponents.length);
446
- });
447
- }
448
- }, {
449
- key: "createColumnComponent",
450
- value: function createColumnComponent(column, ghost) {
451
- var _this6 = this;
452
- var columnComponent = new DropZoneColumnComp(column, this.dropTarget, ghost, this.dropZonePurpose, this.horizontal);
453
- columnComponent.addEventListener(DropZoneColumnComp.EVENT_COLUMN_REMOVE, this.removeColumns.bind(this, [column]));
454
- this.beans.context.createBean(columnComponent);
455
- this.guiDestroyFunctions.push(function () {
456
- return _this6.destroyBean(columnComponent);
457
- });
458
- if (!ghost) {
459
- this.childColumnComponents.push(columnComponent);
460
- }
461
- return columnComponent;
462
- }
463
- }, {
464
- key: "addIconAndTitleToGui",
465
- value: function addIconAndTitleToGui() {
466
- var eGroupIcon = this.params.icon;
467
- var eTitleBar = document.createElement('div');
468
- _.setAriaHidden(eTitleBar, true);
469
- this.addElementClasses(eTitleBar, 'title-bar');
470
- this.addElementClasses(eGroupIcon, 'icon');
471
- this.addOrRemoveCssClass('ag-column-drop-empty', this.isExistingColumnsEmpty());
472
- eTitleBar.appendChild(eGroupIcon);
473
- if (!this.horizontal) {
474
- var eTitle = document.createElement('span');
475
- this.addElementClasses(eTitle, 'title');
476
- eTitle.innerHTML = this.params.title;
477
- eTitleBar.appendChild(eTitle);
478
- }
479
- this.appendChild(eTitleBar);
480
- }
481
- }, {
482
- key: "isExistingColumnsEmpty",
483
- value: function isExistingColumnsEmpty() {
484
- return this.getExistingColumns().length === 0;
485
- }
486
- }, {
487
- key: "addEmptyMessageToGui",
488
- value: function addEmptyMessageToGui() {
489
- if (!this.isExistingColumnsEmpty() || this.isPotentialDndColumns()) {
490
- return;
491
- }
492
- var eMessage = document.createElement('span');
493
- eMessage.innerHTML = this.params.emptyMessage;
494
- this.addElementClasses(eMessage, 'empty-message');
495
- this.eColumnDropList.appendChild(eMessage);
496
- }
497
- }, {
498
- key: "addArrow",
499
- value: function addArrow(eParent) {
500
- // only add the arrows if the layout is horizontal
501
- if (this.horizontal) {
502
- // for RTL it's a left arrow, otherwise it's a right arrow
503
- var enableRtl = this.beans.gridOptionsService.is('enableRtl');
504
- var icon = _.createIconNoSpan(enableRtl ? 'smallLeft' : 'smallRight', this.beans.gridOptionsService);
505
- this.addElementClasses(icon, 'cell-separator');
506
- eParent.appendChild(icon);
507
- }
508
- }
509
- }]);
510
- return BaseDropZonePanel;
511
- }(Component);
512
- BaseDropZonePanel.STATE_NOT_DRAGGING = 'notDragging';
513
- BaseDropZonePanel.STATE_NEW_COLUMNS_IN = 'newColumnsIn';
514
- BaseDropZonePanel.STATE_REARRANGE_COLUMNS = 'rearrangeColumns';
515
- __decorate([Autowired('columnModel')], BaseDropZonePanel.prototype, "colModel", void 0);
516
- __decorate([Autowired('focusService')], BaseDropZonePanel.prototype, "focusService", void 0);
@@ -1,40 +0,0 @@
1
- import { Component, DropTarget, Column, AgEvent } from "@ag-grid-community/core";
2
- import { TDropZone } from "./baseDropZonePanel";
3
- export interface ColumnRemoveEvent extends AgEvent {
4
- }
5
- export declare class DropZoneColumnComp extends Component {
6
- private column;
7
- private dragSourceDropTarget;
8
- private ghost;
9
- private dropZonePurpose;
10
- private horizontal;
11
- static EVENT_COLUMN_REMOVE: string;
12
- private static TEMPLATE;
13
- private readonly dragAndDropService;
14
- private readonly columnModel;
15
- private readonly popupService;
16
- private readonly aggFuncService;
17
- private readonly sortController;
18
- private eText;
19
- private eDragHandle;
20
- private eButton;
21
- private eSortIndicator;
22
- private displayName;
23
- private popupShowing;
24
- constructor(column: Column, dragSourceDropTarget: DropTarget, ghost: boolean, dropZonePurpose: TDropZone, horizontal: boolean);
25
- init(): void;
26
- private setupAria;
27
- private setupTooltip;
28
- setupSort(): void;
29
- private addDragSource;
30
- private createDragItem;
31
- private setupComponents;
32
- private setupRemove;
33
- private getColumnAndAggFuncName;
34
- private setTextValue;
35
- private onShowAggFuncSelection;
36
- private createAggSelect;
37
- private addElementClasses;
38
- private isAggregationZone;
39
- private isGroupingZone;
40
- }