Socket
Socket
Sign inDemoInstall

@ag-grid-enterprise/range-selection

Package Overview
Dependencies
2
Maintainers
3
Versions
62
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 26.0.0 to 26.1.0

20

dist/cjs/rangeSelection/fillHandle.js

@@ -210,2 +210,3 @@ "use strict";

var currentValue;
var skipValue = false;
if (withinInitialRange) {

@@ -219,6 +220,14 @@ currentValue = _this.valueService.getValue(col, rowNode);

if (col.isCellEditable(rowNode)) {
rowNode.setDataValue(col, currentValue);
var cellValue = _this.valueService.getValue(col, rowNode);
if (cellValue !== currentValue) {
rowNode.setDataValue(col, currentValue);
}
else {
skipValue = true;
}
}
}
currentValues.push(currentValue);
if (!skipValue) {
currentValues.push(currentValue);
}
};

@@ -236,3 +245,2 @@ if (isVertical) {

FillHandle.prototype.clearCellsInRange = function (startRow, endRow, columns) {
var _this = this;
var currentRow = startRow;

@@ -248,3 +256,3 @@ var finished = false;

if (col.isCellEditable(rowNode)) {
_this.valueService.setValue(rowNode, col, null);
rowNode.setDataValue(col, null);
}

@@ -283,4 +291,4 @@ });

direction: direction,
column: isVertical ? col : undefined,
rowNode: !isVertical ? rowNode : undefined // only present if left / right
column: col,
rowNode: rowNode
});

@@ -287,0 +295,0 @@ if (userResult !== false) {

@@ -1,4 +0,3 @@

import { CellPosition, CellPositionUtils, Column, GridOptionsWrapper, IRangeService, CellRangeParams, CellRange, RowPosition, RowPositionUtils, BeanStub, GridBodyCtrl, CtrlsService } from "@ag-grid-community/core";
import { CellPosition, CellPositionUtils, Column, IRangeService, CellRangeParams, CellRange, RowPosition, RowPositionUtils, BeanStub, CtrlsService, AutoScrollService } from "@ag-grid-community/core";
export declare class RangeService extends BeanStub implements IRangeService {
private loggerFactory;
private rowModel;

@@ -59,17 +58,1 @@ private columnModel;

}
declare class AutoScrollService {
private tickingInterval;
private tickLeft;
private tickRight;
private tickUp;
private tickDown;
private gridBodyCtrl;
private gridOptionsWrapper;
private tickCount;
constructor(gridBodyCtrl: GridBodyCtrl, gridOptionsWrapper: GridOptionsWrapper);
check(mouseEvent: MouseEvent, skipVerticalScroll?: boolean): void;
private ensureTickingStarted;
private doTick;
ensureCleared(): void;
}
export {};

@@ -51,3 +51,12 @@ "use strict";

var gridBodyCon = _this.ctrlsService.getGridBodyCtrl();
_this.autoScrollService = new AutoScrollService(gridBodyCon, _this.gridOptionsWrapper);
_this.autoScrollService = new core_1.AutoScrollService({
scrollContainer: gridBodyCon.getBodyViewportElement(),
scrollAxis: 'xy',
getVerticalPosition: function () { return gridBodyCon.getScrollFeature().getVScrollPosition().top; },
setVerticalPosition: function (position) { return gridBodyCon.getScrollFeature().setVerticalScrollPosition(position); },
getHorizontalPosition: function () { return gridBodyCon.getScrollFeature().getHScrollPosition().left; },
setHorizontalPosition: function (position) { return gridBodyCon.getScrollFeature().setHorizontalScrollPosition(position); },
shouldSkipVerticalScroll: function () { return _this.gridOptionsWrapper.getDomLayout() !== core_1.Constants.DOM_LAYOUT_NORMAL; },
shouldSkipHorizontalScroll: function () { return gridBodyCon.getScrollFeature().isHorizontalScrollShowing(); }
});
});

@@ -537,5 +546,2 @@ };

__decorate([
core_1.Autowired('loggerFactory')
], RangeService.prototype, "loggerFactory", void 0);
__decorate([
core_1.Autowired('rowModel')

@@ -579,60 +585,2 @@ ], RangeService.prototype, "rowModel", void 0);

exports.RangeService = RangeService;
var AutoScrollService = /** @class */ (function () {
function AutoScrollService(gridBodyCtrl, gridOptionsWrapper) {
this.tickingInterval = null;
this.gridBodyCtrl = gridBodyCtrl;
this.gridOptionsWrapper = gridOptionsWrapper;
}
AutoScrollService.prototype.check = function (mouseEvent, skipVerticalScroll) {
if (skipVerticalScroll === void 0) { skipVerticalScroll = false; }
var rect = this.gridBodyCtrl.getBodyClientRect();
skipVerticalScroll = skipVerticalScroll || this.gridOptionsWrapper.getDomLayout() !== core_1.Constants.DOM_LAYOUT_NORMAL;
// we don't do ticking if grid is auto height unless we have a horizontal scroller
if (skipVerticalScroll && !this.gridBodyCtrl.getScrollFeature().isHorizontalScrollShowing()) {
return;
}
this.tickLeft = mouseEvent.clientX < (rect.left + 20);
this.tickRight = mouseEvent.clientX > (rect.right - 20);
this.tickUp = mouseEvent.clientY < (rect.top + 20) && !skipVerticalScroll;
this.tickDown = mouseEvent.clientY > (rect.bottom - 20) && !skipVerticalScroll;
if (this.tickLeft || this.tickRight || this.tickUp || this.tickDown) {
this.ensureTickingStarted();
}
else {
this.ensureCleared();
}
};
AutoScrollService.prototype.ensureTickingStarted = function () {
if (this.tickingInterval === null) {
this.tickingInterval = window.setInterval(this.doTick.bind(this), 100);
this.tickCount = 0;
}
};
AutoScrollService.prototype.doTick = function () {
this.tickCount++;
var vScrollPosition = this.gridBodyCtrl.getScrollFeature().getVScrollPosition();
var hScrollPosition = this.gridBodyCtrl.getScrollFeature().getHScrollPosition();
var tickAmount;
tickAmount = this.tickCount > 20 ? 200 : (this.tickCount > 10 ? 80 : 40);
if (this.tickUp) {
this.gridBodyCtrl.getScrollFeature().setVerticalScrollPosition(vScrollPosition.top - tickAmount);
}
if (this.tickDown) {
this.gridBodyCtrl.getScrollFeature().setVerticalScrollPosition(vScrollPosition.top + tickAmount);
}
if (this.tickLeft) {
this.gridBodyCtrl.getScrollFeature().setHorizontalScrollPosition(hScrollPosition.left - tickAmount);
}
if (this.tickRight) {
this.gridBodyCtrl.getScrollFeature().setHorizontalScrollPosition(hScrollPosition.left + tickAmount);
}
};
AutoScrollService.prototype.ensureCleared = function () {
if (this.tickingInterval) {
window.clearInterval(this.tickingInterval);
this.tickingInterval = null;
}
};
return AutoScrollService;
}());
//# sourceMappingURL=rangeService.js.map

@@ -208,2 +208,3 @@ var __extends = (this && this.__extends) || (function () {

var currentValue;
var skipValue = false;
if (withinInitialRange) {

@@ -217,6 +218,14 @@ currentValue = _this.valueService.getValue(col, rowNode);

if (col.isCellEditable(rowNode)) {
rowNode.setDataValue(col, currentValue);
var cellValue = _this.valueService.getValue(col, rowNode);
if (cellValue !== currentValue) {
rowNode.setDataValue(col, currentValue);
}
else {
skipValue = true;
}
}
}
currentValues.push(currentValue);
if (!skipValue) {
currentValues.push(currentValue);
}
};

@@ -234,3 +243,2 @@ if (isVertical) {

FillHandle.prototype.clearCellsInRange = function (startRow, endRow, columns) {
var _this = this;
var currentRow = startRow;

@@ -246,3 +254,3 @@ var finished = false;

if (col.isCellEditable(rowNode)) {
_this.valueService.setValue(rowNode, col, null);
rowNode.setDataValue(col, null);
}

@@ -281,4 +289,4 @@ });

direction: direction,
column: isVertical ? col : undefined,
rowNode: !isVertical ? rowNode : undefined // only present if left / right
column: col,
rowNode: rowNode
});

@@ -285,0 +293,0 @@ if (userResult !== false) {

@@ -1,4 +0,3 @@

import { CellPosition, CellPositionUtils, Column, GridOptionsWrapper, IRangeService, CellRangeParams, CellRange, RowPosition, RowPositionUtils, BeanStub, GridBodyCtrl, CtrlsService } from "@ag-grid-community/core";
import { CellPosition, CellPositionUtils, Column, IRangeService, CellRangeParams, CellRange, RowPosition, RowPositionUtils, BeanStub, CtrlsService, AutoScrollService } from "@ag-grid-community/core";
export declare class RangeService extends BeanStub implements IRangeService {
private loggerFactory;
private rowModel;

@@ -59,17 +58,1 @@ private columnModel;

}
declare class AutoScrollService {
private tickingInterval;
private tickLeft;
private tickRight;
private tickUp;
private tickDown;
private gridBodyCtrl;
private gridOptionsWrapper;
private tickCount;
constructor(gridBodyCtrl: GridBodyCtrl, gridOptionsWrapper: GridOptionsWrapper);
check(mouseEvent: MouseEvent, skipVerticalScroll?: boolean): void;
private ensureTickingStarted;
private doTick;
ensureCleared(): void;
}
export {};

@@ -27,3 +27,3 @@ var __extends = (this && this.__extends) || (function () {

};
import { Autowired, Bean, Constants, Events, PostConstruct, BeanStub, _ } from "@ag-grid-community/core";
import { Autowired, Bean, Constants, Events, PostConstruct, BeanStub, AutoScrollService, _ } from "@ag-grid-community/core";
var RangeService = /** @class */ (function (_super) {

@@ -50,3 +50,12 @@ __extends(RangeService, _super);

var gridBodyCon = _this.ctrlsService.getGridBodyCtrl();
_this.autoScrollService = new AutoScrollService(gridBodyCon, _this.gridOptionsWrapper);
_this.autoScrollService = new AutoScrollService({
scrollContainer: gridBodyCon.getBodyViewportElement(),
scrollAxis: 'xy',
getVerticalPosition: function () { return gridBodyCon.getScrollFeature().getVScrollPosition().top; },
setVerticalPosition: function (position) { return gridBodyCon.getScrollFeature().setVerticalScrollPosition(position); },
getHorizontalPosition: function () { return gridBodyCon.getScrollFeature().getHScrollPosition().left; },
setHorizontalPosition: function (position) { return gridBodyCon.getScrollFeature().setHorizontalScrollPosition(position); },
shouldSkipVerticalScroll: function () { return _this.gridOptionsWrapper.getDomLayout() !== Constants.DOM_LAYOUT_NORMAL; },
shouldSkipHorizontalScroll: function () { return gridBodyCon.getScrollFeature().isHorizontalScrollShowing(); }
});
});

@@ -536,5 +545,2 @@ };

__decorate([
Autowired('loggerFactory')
], RangeService.prototype, "loggerFactory", void 0);
__decorate([
Autowired('rowModel')

@@ -578,59 +584,1 @@ ], RangeService.prototype, "rowModel", void 0);

export { RangeService };
var AutoScrollService = /** @class */ (function () {
function AutoScrollService(gridBodyCtrl, gridOptionsWrapper) {
this.tickingInterval = null;
this.gridBodyCtrl = gridBodyCtrl;
this.gridOptionsWrapper = gridOptionsWrapper;
}
AutoScrollService.prototype.check = function (mouseEvent, skipVerticalScroll) {
if (skipVerticalScroll === void 0) { skipVerticalScroll = false; }
var rect = this.gridBodyCtrl.getBodyClientRect();
skipVerticalScroll = skipVerticalScroll || this.gridOptionsWrapper.getDomLayout() !== Constants.DOM_LAYOUT_NORMAL;
// we don't do ticking if grid is auto height unless we have a horizontal scroller
if (skipVerticalScroll && !this.gridBodyCtrl.getScrollFeature().isHorizontalScrollShowing()) {
return;
}
this.tickLeft = mouseEvent.clientX < (rect.left + 20);
this.tickRight = mouseEvent.clientX > (rect.right - 20);
this.tickUp = mouseEvent.clientY < (rect.top + 20) && !skipVerticalScroll;
this.tickDown = mouseEvent.clientY > (rect.bottom - 20) && !skipVerticalScroll;
if (this.tickLeft || this.tickRight || this.tickUp || this.tickDown) {
this.ensureTickingStarted();
}
else {
this.ensureCleared();
}
};
AutoScrollService.prototype.ensureTickingStarted = function () {
if (this.tickingInterval === null) {
this.tickingInterval = window.setInterval(this.doTick.bind(this), 100);
this.tickCount = 0;
}
};
AutoScrollService.prototype.doTick = function () {
this.tickCount++;
var vScrollPosition = this.gridBodyCtrl.getScrollFeature().getVScrollPosition();
var hScrollPosition = this.gridBodyCtrl.getScrollFeature().getHScrollPosition();
var tickAmount;
tickAmount = this.tickCount > 20 ? 200 : (this.tickCount > 10 ? 80 : 40);
if (this.tickUp) {
this.gridBodyCtrl.getScrollFeature().setVerticalScrollPosition(vScrollPosition.top - tickAmount);
}
if (this.tickDown) {
this.gridBodyCtrl.getScrollFeature().setVerticalScrollPosition(vScrollPosition.top + tickAmount);
}
if (this.tickLeft) {
this.gridBodyCtrl.getScrollFeature().setHorizontalScrollPosition(hScrollPosition.left - tickAmount);
}
if (this.tickRight) {
this.gridBodyCtrl.getScrollFeature().setHorizontalScrollPosition(hScrollPosition.left + tickAmount);
}
};
AutoScrollService.prototype.ensureCleared = function () {
if (this.tickingInterval) {
window.clearInterval(this.tickingInterval);
this.tickingInterval = null;
}
};
return AutoScrollService;
}());
/**
* @ag-grid-enterprise/range-selection - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components * @version v26.0.0
* @ag-grid-enterprise/range-selection - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components * @version v26.1.0
* @link http://www.ag-grid.com/

@@ -8,6 +8,6 @@ ' * @license Commercial

/**
* @ag-grid-enterprise/range-selection - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components * @version v26.0.0
* @ag-grid-enterprise/range-selection - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components * @version v26.1.0
* @link http://www.ag-grid.com/
' * @license Commercial
*/
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("@ag-grid-community/core"),n=require("@ag-grid-enterprise/core"),i=(e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)},function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}),o=function(e,t,n,i){var o,r=arguments.length,s=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(s=(r<3?o(s):r>3?o(t,n,s):o(t,n))||s);return r>3&&s&&Object.defineProperty(t,n,s),s},r=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var i=Array(e),o=0;for(t=0;t<n;t++)for(var r=arguments[t],s=0,l=r.length;s<l;s++,o++)i[o]=r[s];return i},s=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.cellRanges=[],t.bodyScrollListener=t.onBodyScroll.bind(t),t.dragging=!1,t}return i(n,e),n.prototype.init=function(){var e=this;this.addManagedListener(this.eventService,t.Events.EVENT_NEW_COLUMNS_LOADED,(function(){return e.removeAllCellRanges()})),this.addManagedListener(this.eventService,t.Events.EVENT_COLUMN_PIVOT_MODE_CHANGED,(function(){return e.removeAllCellRanges()})),this.addManagedListener(this.eventService,t.Events.EVENT_COLUMN_ROW_GROUP_CHANGED,(function(){return e.removeAllCellRanges()})),this.addManagedListener(this.eventService,t.Events.EVENT_COLUMN_PIVOT_CHANGED,(function(){return e.removeAllCellRanges()})),this.addManagedListener(this.eventService,t.Events.EVENT_COLUMN_GROUP_OPENED,this.refreshLastRangeStart.bind(this)),this.addManagedListener(this.eventService,t.Events.EVENT_COLUMN_MOVED,this.refreshLastRangeStart.bind(this)),this.addManagedListener(this.eventService,t.Events.EVENT_COLUMN_PINNED,this.refreshLastRangeStart.bind(this)),this.addManagedListener(this.eventService,t.Events.EVENT_COLUMN_VISIBLE,this.onColumnVisibleChange.bind(this)),this.ctrlsService.whenReady((function(){var t=e.ctrlsService.getGridBodyCtrl();e.autoScrollService=new l(t,e.gridOptionsWrapper)}))},n.prototype.onColumnVisibleChange=function(){var e=this;this.refreshLastRangeStart(),this.cellRanges.forEach((function(n){var i=n.columns;n.columns=n.columns.filter((function(e){return e.isVisible()})),!t._.areEqual(i,n.columns)&&e.dispatchChangedEvent(!1,!0,n.id)}))},n.prototype.refreshLastRangeStart=function(){var e=t._.last(this.cellRanges);e&&this.refreshRangeStart(e)},n.prototype.isContiguousRange=function(e){var n=e.columns;if(!n.length)return!1;var i=this.columnModel.getAllDisplayedColumns(),o=n.map((function(e){return i.indexOf(e)})).sort((function(e,t){return e-t}));return t._.last(o)-o[0]+1===n.length},n.prototype.getRangeStartRow=function(e){return e.startRow&&e.endRow?this.rowPositionUtils.before(e.startRow,e.endRow)?e.startRow:e.endRow:{rowIndex:0,rowPinned:this.pinnedRowModel.getPinnedTopRowCount()>0?t.Constants.PINNED_TOP:null}},n.prototype.getRangeEndRow=function(e){if(e.startRow&&e.endRow)return this.rowPositionUtils.before(e.startRow,e.endRow)?e.endRow:e.startRow;var n=this.pinnedRowModel.getPinnedBottomRowCount();return n>0?{rowIndex:n-1,rowPinned:t.Constants.PINNED_BOTTOM}:{rowIndex:this.rowModel.getRowCount()-1,rowPinned:null}},n.prototype.setRangeToCell=function(e,n){if(void 0===n&&(n=!1),this.gridOptionsWrapper.isEnableRangeSelection()){var i=this.calculateColumnsBetween(e.column,e.column);if(i){(this.gridOptionsWrapper.isSuppressMultiRangeSelection()||!n||t._.missing(this.cellRanges))&&this.removeAllCellRanges(!0);for(var o,r={rowIndex:e.rowIndex,rowPinned:e.rowPinned},s=0;s<this.cellRanges.length;s++){var l=this.cellRanges[s];if(l.columns&&1===l.columns.length&&l.columns[0]===e.column&&this.rowPositionUtils.sameRow(r,l.startRow)&&this.rowPositionUtils.sameRow(r,l.endRow)){o=l;break}}o?t._.last(this.cellRanges)!==o&&(t._.removeFromArray(this.cellRanges,o),this.cellRanges.push(o)):(o={startRow:r,endRow:r,columns:i,startColumn:e.column},this.cellRanges.push(o)),this.newestRangeStartCell=e,this.onDragStop(),this.dispatchChangedEvent(!0,!0,o.id)}}},n.prototype.extendLatestRangeToCell=function(e){if(!this.isEmpty()&&this.newestRangeStartCell){var n=t._.last(this.cellRanges);this.updateRangeEnd(n,e)}},n.prototype.updateRangeEnd=function(e,t,n){void 0===n&&(n=!1);var i=t.column,o=this.calculateColumnsBetween(e.startColumn,i);o&&!this.isLastCellOfRange(e,t)&&(e.columns=o,e.endRow={rowIndex:t.rowIndex,rowPinned:t.rowPinned},n||this.dispatchChangedEvent(!0,!0,e.id))},n.prototype.refreshRangeStart=function(e){var n=e.startColumn,i=e.columns,o=function(t,n){var i=e.columns.filter((function(e){return e!==t}));t?(e.startColumn=t,e.columns=n?r([t],i):r(i,[t])):e.columns=i},s=this.getRangeEdgeColumns(e),l=s.left,a=s.right;n===i[0]&&n!==l?o(l,!0):n===t._.last(i)&&n===a&&o(a,!1)},n.prototype.getRangeEdgeColumns=function(e){var n=this.columnModel.getAllDisplayedColumns(),i=e.columns.map((function(e){return n.indexOf(e)})).filter((function(e){return e>-1})).sort((function(e,t){return e-t}));return{left:n[i[0]],right:n[t._.last(i)]}},n.prototype.extendLatestRangeInDirection=function(e){if(!this.isEmpty()&&this.newestRangeStartCell){var n=t._.last(this.cellRanges),i=this.newestRangeStartCell,o=n.columns[0],r=t._.last(n.columns),s=n.endRow.rowIndex,l=n.endRow.rowPinned,a={column:i.column===o?r:o,rowIndex:s,rowPinned:l},c=this.cellNavigationService.getNextCellToFocus(e,a);if(c)return this.setCellRange({rowStartIndex:i.rowIndex,rowStartPinned:i.rowPinned,rowEndIndex:c.rowIndex,rowEndPinned:c.rowPinned,columnStart:i.column,columnEnd:c.column}),c}},n.prototype.setCellRange=function(e){this.gridOptionsWrapper.isEnableRangeSelection()&&(this.removeAllCellRanges(!0),this.addCellRange(e))},n.prototype.setCellRanges=function(e){var n=this;t._.shallowCompare(this.cellRanges,e)||(this.removeAllCellRanges(!0),e.forEach((function(e){e.columns&&e.startRow&&(n.newestRangeStartCell={rowIndex:e.startRow.rowIndex,rowPinned:e.startRow.rowPinned,column:e.columns[0]}),n.cellRanges.push(e)})),this.dispatchChangedEvent(!1,!0))},n.prototype.createCellRangeFromCellRangeParams=function(e){var t,n=this;if(e.columns)t=e.columns.map((function(e){return n.columnModel.getColumnWithValidation(e)})).filter((function(e){return e}));else{var i=this.columnModel.getColumnWithValidation(e.columnStart),o=this.columnModel.getColumnWithValidation(e.columnEnd);if(!i||!o)return;t=this.calculateColumnsBetween(i,o)}if(t)return{startRow:null!=e.rowStartIndex?{rowIndex:e.rowStartIndex,rowPinned:e.rowStartPinned||null}:void 0,endRow:null!=e.rowEndIndex?{rowIndex:e.rowEndIndex,rowPinned:e.rowEndPinned||null}:void 0,columns:t,startColumn:t[0]}},n.prototype.addCellRange=function(e){if(this.gridOptionsWrapper.isEnableRangeSelection()){var t=this.createCellRangeFromCellRangeParams(e);t&&(this.cellRanges.push(t),this.dispatchChangedEvent(!1,!0,t.id))}},n.prototype.getCellRanges=function(){return this.cellRanges},n.prototype.isEmpty=function(){return 0===this.cellRanges.length},n.prototype.isMoreThanOneCell=function(){if(0===this.cellRanges.length)return!1;if(this.cellRanges.length>1)return!0;var e=this.cellRanges[0],t=this.getRangeStartRow(e),n=this.getRangeEndRow(e);return t.rowPinned!==n.rowPinned||t.rowIndex!==n.rowIndex||1!==e.columns.length},n.prototype.removeAllCellRanges=function(e){this.isEmpty()||(this.onDragStop(),this.cellRanges.length=0,e||this.dispatchChangedEvent(!1,!0))},n.prototype.onBodyScroll=function(){this.onDragging(this.lastMouseEvent)},n.prototype.isCellInAnyRange=function(e){return this.getCellRangeCount(e)>0},n.prototype.isCellInSpecificRange=function(e,n){var i=null!==n.columns&&t._.includes(n.columns,e.column),o=this.isRowInRange(e.rowIndex,e.rowPinned,n);return i&&o},n.prototype.isLastCellOfRange=function(e,n){var i=e.startRow,o=e.endRow,r=this.rowPositionUtils.before(i,o)?o:i,s=n.rowIndex===r.rowIndex&&n.rowPinned===r.rowPinned,l=e.columns[0],a=t._.last(e.columns),c=e.startColumn===l?a:l;return n.column===c&&s},n.prototype.isBottomRightCell=function(e,n){var i=this.columnModel.getAllDisplayedColumns(),o=e.columns.map((function(e){return i.indexOf(e)})).sort((function(e,t){return e-t})),r=e.startRow,s=e.endRow,l=this.rowPositionUtils.before(r,s)?s:r,a=i.indexOf(n.column)===t._.last(o),c=n.rowIndex===l.rowIndex&&t._.makeNull(n.rowPinned)===t._.makeNull(l.rowPinned);return a&&c},n.prototype.getCellRangeCount=function(e){var t=this;return this.isEmpty()?0:this.cellRanges.filter((function(n){return t.isCellInSpecificRange(e,n)})).length},n.prototype.isRowInRange=function(e,t,n){var i=this.getRangeStartRow(n),o=this.getRangeEndRow(n),r={rowIndex:e,rowPinned:t||null},s=r.rowIndex===i.rowIndex&&r.rowPinned==i.rowPinned,l=r.rowIndex===o.rowIndex&&r.rowPinned==o.rowPinned;if(s||l)return!0;var a=!this.rowPositionUtils.before(r,i),c=this.rowPositionUtils.before(r,o);return a&&c},n.prototype.getDraggingRange=function(){return this.draggingRange},n.prototype.onDragStart=function(e){if(this.gridOptionsWrapper.isEnableRangeSelection()){var n=e.ctrlKey,i=e.metaKey,o=e.shiftKey,r=n||i,s=!!!this.gridOptionsWrapper.isSuppressMultiRangeSelection()&&r,l=this.mouseEventService.getCellPositionForEvent(e),a=o&&t._.existsAndNotEmpty(this.cellRanges);if(!t._.missing(l)){if(s||a&&!t._.exists(t._.last(this.cellRanges).type)||this.removeAllCellRanges(!0),this.dragging=!0,this.draggingCell=l,this.lastMouseEvent=e,a||(this.newestRangeStartCell=l),this.cellRanges.length>0)this.draggingRange=t._.last(this.cellRanges);else{var c={rowIndex:l.rowIndex,rowPinned:l.rowPinned};this.draggingRange={startRow:c,endRow:c,columns:[l.column],startColumn:this.newestRangeStartCell.column},this.cellRanges.push(this.draggingRange)}this.ctrlsService.getGridBodyCtrl().addScrollEventListener(this.bodyScrollListener),this.dispatchChangedEvent(!0,!1,this.draggingRange.id)}}},n.prototype.onDragging=function(e){var t=this;if(this.dragging&&e){this.lastMouseEvent=e;var n=this.mouseEventService.getCellPositionForEvent(e),i=function(e){return n&&n.rowPinned===e&&t.newestRangeStartCell.rowPinned===e},o=i("top")||i("bottom");if(this.autoScrollService.check(e,o),n&&this.draggingCell&&!this.cellPositionUtils.equals(this.draggingCell,n)){var r=this.calculateColumnsBetween(this.newestRangeStartCell.column,n.column);r&&(this.draggingCell=n,this.draggingRange.endRow={rowIndex:n.rowIndex,rowPinned:n.rowPinned},this.draggingRange.columns=r,this.dispatchChangedEvent(!1,!1,this.draggingRange.id))}}},n.prototype.onDragStop=function(){if(this.dragging){var e=this.draggingRange.id;this.autoScrollService.ensureCleared(),this.ctrlsService.getGridBodyCtrl().removeScrollEventListener(this.bodyScrollListener),this.lastMouseEvent=null,this.dragging=!1,this.draggingRange=void 0,this.draggingCell=void 0,this.dispatchChangedEvent(!1,!0,e)}},n.prototype.dispatchChangedEvent=function(e,n,i){var o=Object.freeze({type:t.Events.EVENT_RANGE_SELECTION_CHANGED,api:this.gridApi,columnApi:this.columnApi,started:e,finished:n,id:i});this.eventService.dispatchEvent(o)},n.prototype.calculateColumnsBetween=function(e,t){var n=this.columnModel.getAllDisplayedColumns(),i=e===t,o=n.indexOf(e);if(o<0)console.warn("AG Grid: column "+e.getId()+" is not visible");else{var r=i?o:n.indexOf(t);if(!(r<0)){if(i)return[e];for(var s=Math.min(o,r),l=s===o?r:o,a=[],c=s;c<=l;c++)a.push(n[c]);return a}console.warn("AG Grid: column "+t.getId()+" is not visible")}},o([t.Autowired("loggerFactory")],n.prototype,"loggerFactory",void 0),o([t.Autowired("rowModel")],n.prototype,"rowModel",void 0),o([t.Autowired("columnModel")],n.prototype,"columnModel",void 0),o([t.Autowired("mouseEventService")],n.prototype,"mouseEventService",void 0),o([t.Autowired("columnApi")],n.prototype,"columnApi",void 0),o([t.Autowired("gridApi")],n.prototype,"gridApi",void 0),o([t.Autowired("cellNavigationService")],n.prototype,"cellNavigationService",void 0),o([t.Autowired("pinnedRowModel")],n.prototype,"pinnedRowModel",void 0),o([t.Autowired("rowPositionUtils")],n.prototype,"rowPositionUtils",void 0),o([t.Autowired("cellPositionUtils")],n.prototype,"cellPositionUtils",void 0),o([t.Autowired("ctrlsService")],n.prototype,"ctrlsService",void 0),o([t.PostConstruct],n.prototype,"init",null),n=o([t.Bean("rangeService")],n)}(t.BeanStub),l=function(){function e(e,t){this.tickingInterval=null,this.gridBodyCtrl=e,this.gridOptionsWrapper=t}return e.prototype.check=function(e,n){void 0===n&&(n=!1);var i=this.gridBodyCtrl.getBodyClientRect();(n=n||this.gridOptionsWrapper.getDomLayout()!==t.Constants.DOM_LAYOUT_NORMAL)&&!this.gridBodyCtrl.getScrollFeature().isHorizontalScrollShowing()||(this.tickLeft=e.clientX<i.left+20,this.tickRight=e.clientX>i.right-20,this.tickUp=e.clientY<i.top+20&&!n,this.tickDown=e.clientY>i.bottom-20&&!n,this.tickLeft||this.tickRight||this.tickUp||this.tickDown?this.ensureTickingStarted():this.ensureCleared())},e.prototype.ensureTickingStarted=function(){null===this.tickingInterval&&(this.tickingInterval=window.setInterval(this.doTick.bind(this),100),this.tickCount=0)},e.prototype.doTick=function(){this.tickCount++;var e,t=this.gridBodyCtrl.getScrollFeature().getVScrollPosition(),n=this.gridBodyCtrl.getScrollFeature().getHScrollPosition();e=this.tickCount>20?200:this.tickCount>10?80:40,this.tickUp&&this.gridBodyCtrl.getScrollFeature().setVerticalScrollPosition(t.top-e),this.tickDown&&this.gridBodyCtrl.getScrollFeature().setVerticalScrollPosition(t.top+e),this.tickLeft&&this.gridBodyCtrl.getScrollFeature().setHorizontalScrollPosition(n.left-e),this.tickRight&&this.gridBodyCtrl.getScrollFeature().setHorizontalScrollPosition(n.left+e)},e.prototype.ensureCleared=function(){this.tickingInterval&&(window.clearInterval(this.tickingInterval),this.tickingInterval=null)},e}(),a=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),c=function(e,t,n,i){var o,r=arguments.length,s=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(s=(r<3?o(s):r>3?o(t,n,s):o(t,n))||s);return r>3&&s&&Object.defineProperty(t,n,s),s},d=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.changedCalculatedValues=!1,t.dragging=!1,t.shouldDestroyOnEndDragging=!1,t}return a(n,e),n.prototype.init=function(){var e=this;this.dragService.addDragSource({dragStartPixels:0,eElement:this.getGui(),onDragStart:this.onDragStart.bind(this),onDragging:function(t){e.dragging=!0,e.rangeService.autoScrollService.check(t),e.changedCalculatedValues&&(e.onDrag(t),e.changedCalculatedValues=!1)},onDragStop:function(n){e.dragging=!1,e.onDragEnd(n),e.clearValues(),e.rangeService.autoScrollService.ensureCleared(),t._.removeCssClass(document.body,e.getDraggingCssClass()),e.shouldDestroyOnEndDragging&&e.destroy()}}),this.addManagedListener(this.getGui(),"mousedown",this.preventRangeExtension.bind(this))},n.prototype.isDragging=function(){return this.dragging},n.prototype.getCellCtrl=function(){return this.cellCtrl},n.prototype.setCellCtrl=function(e){this.cellCtrl=e},n.prototype.getCellRange=function(){return this.cellRange},n.prototype.setCellRange=function(e){this.cellRange=e},n.prototype.getRangeStartRow=function(){return this.rangeStartRow},n.prototype.setRangeStartRow=function(e){this.rangeStartRow=e},n.prototype.getRangeEndRow=function(){return this.rangeEndRow},n.prototype.setRangeEndRow=function(e){this.rangeEndRow=e},n.prototype.getLastCellHovered=function(){return this.lastCellHovered},n.prototype.preventRangeExtension=function(e){e.preventDefault(),e.stopPropagation()},n.prototype.onDragStart=function(e){this.cellHoverListener=this.addManagedListener(this.ctrlsService.getGridCtrl().getGui(),"mousemove",this.updateValuesOnMove.bind(this)),t._.addCssClass(document.body,this.getDraggingCssClass())},n.prototype.getDraggingCssClass=function(){return"ag-dragging-"+(this.type===t.SelectionHandleType.FILL?"fill":"range")+"-handle"},n.prototype.updateValuesOnMove=function(e){var t=this.mouseEventService.getCellPositionForEvent(e);t!==this.lastCellHovered&&(this.lastCellHovered=t,this.changedCalculatedValues=!0)},n.prototype.getType=function(){return this.type},n.prototype.refresh=function(e){var n=this,i=this.getCellCtrl(),o=this.getGui(),r=t._.last(this.rangeService.getCellRanges()),s=r.startRow,l=r.endRow;s&&l&&(this.rowPositionUtils.before(l,s)?(this.setRangeStartRow(l),this.setRangeEndRow(s)):(this.setRangeStartRow(s),this.setRangeEndRow(l)));i===e&&t._.isVisible(o)||(this.setCellCtrl(e),window.setTimeout((function(){n.isAlive()&&e.appendChild(o)}),1)),this.setCellRange(r)},n.prototype.clearValues=function(){this.lastCellHovered=void 0,this.removeListeners()},n.prototype.removeListeners=function(){this.cellHoverListener&&(this.cellHoverListener(),this.cellHoverListener=void 0)},n.prototype.destroy=function(){if(!this.shouldDestroyOnEndDragging&&this.isDragging())return t._.setDisplayed(this.getGui(),!1),void(this.shouldDestroyOnEndDragging=!0);this.shouldDestroyOnEndDragging=!1,e.prototype.destroy.call(this),this.removeListeners();var n=this.getGui();n.parentElement&&n.parentElement.removeChild(n)},c([t.Autowired("rowRenderer")],n.prototype,"rowRenderer",void 0),c([t.Autowired("dragService")],n.prototype,"dragService",void 0),c([t.Autowired("rangeService")],n.prototype,"rangeService",void 0),c([t.Autowired("mouseEventService")],n.prototype,"mouseEventService",void 0),c([t.Autowired("columnModel")],n.prototype,"columnModel",void 0),c([t.Autowired("cellNavigationService")],n.prototype,"cellNavigationService",void 0),c([t.Autowired("navigationService")],n.prototype,"navigationService",void 0),c([t.Autowired("rowPositionUtils")],n.prototype,"rowPositionUtils",void 0),c([t.Autowired("ctrlsService")],n.prototype,"ctrlsService",void 0),c([t.PostConstruct],n.prototype,"init",null),n}(t.Component),g=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),u=function(){return(u=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},h=function(e,t,n,i){var o,r=arguments.length,s=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(s=(r<3?o(s):r>3?o(t,n,s):o(t,n))||s);return r>3&&s&&Object.defineProperty(t,n,s),s},p=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var i=Array(e),o=0;for(t=0;t<n;t++)for(var r=arguments[t],s=0,l=r.length;s<l;s++,o++)i[o]=r[s];return i},v=function(e){function n(){var i=e.call(this,n.TEMPLATE)||this;return i.markedCells=[],i.cellValues=[],i.isUp=!1,i.isLeft=!1,i.isReduce=!1,i.type=t.SelectionHandleType.FILL,i}return g(n,e),n.prototype.updateValuesOnMove=function(t){e.prototype.updateValuesOnMove.call(this,t),this.initialXY||(this.initialXY=this.mouseEventService.getNormalisedPosition(t));var n,i=this.initialXY,o=i.x,r=i.y,s=this.mouseEventService.getNormalisedPosition(t),l=s.x,a=s.y,c=Math.abs(o-l),d=Math.abs(r-a),g=this.gridOptionsWrapper.getFillHandleDirection();(n="xy"===g?c>d?"x":"y":g)!==this.dragAxis&&(this.dragAxis=n,this.changedCalculatedValues=!0)},n.prototype.onDrag=function(e){if(!this.initialPosition){var t=this.getCellCtrl();if(!t)return;this.initialPosition=t.getCellPosition()}var n=this.getLastCellHovered();n&&this.markPathFrom(this.initialPosition,n)},n.prototype.onDragEnd=function(e){if(this.initialXY=null,this.markedCells.length){var t,n="x"===this.dragAxis,i=this.getCellRange(),o=i.columns.length,r=this.getRangeStartRow(),s=this.getRangeEndRow();if(this.isUp||this.isLeft){var l=n?r:this.lastCellMarked;t=this.rangeService.createCellRangeFromCellRangeParams({rowStartIndex:l.rowIndex,rowStartPinned:l.rowPinned,columnStart:n?this.lastCellMarked.column:i.columns[0],rowEndIndex:s.rowIndex,rowEndPinned:s.rowPinned,columnEnd:i.columns[o-1]})}else t=this.rangeService.createCellRangeFromCellRangeParams({rowStartIndex:r.rowIndex,rowStartPinned:r.rowPinned,columnStart:i.columns[0],rowEndIndex:n?s.rowIndex:this.lastCellMarked.rowIndex,rowEndPinned:n?s.rowPinned:this.lastCellMarked.rowPinned,columnEnd:n?this.lastCellMarked.column:i.columns[o-1]});t&&(this.raiseFillStartEvent(),this.handleValueChanged(i,t,e),this.rangeService.setCellRanges([t]),this.raiseFillEndEvent(i,t))}},n.prototype.raiseFillStartEvent=function(){var e={type:t.Events.EVENT_FILL_START,columnApi:this.gridOptionsWrapper.getColumnApi(),api:this.gridOptionsWrapper.getApi()};this.eventService.dispatchEvent(e)},n.prototype.raiseFillEndEvent=function(e,n){var i={type:t.Events.EVENT_FILL_END,columnApi:this.gridOptionsWrapper.getColumnApi(),api:this.gridOptionsWrapper.getApi(),initialRange:e,finalRange:n};this.eventService.dispatchEvent(i)},n.prototype.handleValueChanged=function(e,n,i){var o=this,r=this.rangeService.getRangeEndRow(e),s=this.rangeService.getRangeStartRow(e),l=this.rangeService.getRangeEndRow(n),a=this.rangeService.getRangeStartRow(n),c="y"===this.dragAxis;if(!this.isReduce||this.gridOptionsWrapper.isSuppressClearOnFillReduction()){var d=!0,g=[],u=[],h=0,v=function(){g.length=0,u.length=0,h=0},f=function(n,i){var u=o.isUp?r:s,h=!1;c&&(d=!0,v());for(var p=function(){var p=o.rowPositionUtils.getRowNode(u);if(!p)return"break";c&&n?w(g,n,p,(function(){return!o.rowPositionUtils.sameRow(u,o.isUp?s:r)})):i&&(d=!0,v(),i.forEach((function(n){return w(g,n,p,(function(){return n!==(o.isLeft?e.columns[0]:t._.last(e.columns))}))}))),h=o.rowPositionUtils.sameRow(u,o.isUp?a:l),u=o.isUp?o.cellNavigationService.getRowAbove(u):o.cellNavigationService.getRowBelow(u)};!h&&u;){if("break"===p())break}},w=function(e,t,n,r){var s;d?(s=o.valueService.getValue(t,n),u.push(s),d=r()):(s=o.processValues(i,e,u,t,n,h++),t.isCellEditable(n)&&n.setDataValue(t,s)),e.push(s)};if(c)e.columns.forEach((function(e){f(e)}));else{R=this.isLeft?p(n.columns).reverse():n.columns;f(void 0,R)}}else{var R=c?e.columns:e.columns.filter((function(e){return n.columns.indexOf(e)<0})),m=c?this.cellNavigationService.getRowBelow(l):a;m&&this.clearCellsInRange(m,r,R)}},n.prototype.clearCellsInRange=function(e,t,n){for(var i=this,o=e,r=!1,s=function(){var e=l.rowPositionUtils.getRowNode(o);if(!e)return"break";n.forEach((function(t){t.isCellEditable(e)&&i.valueService.setValue(e,t,null)})),r=l.rowPositionUtils.sameRow(o,t),o=l.cellNavigationService.getRowBelow(o)},l=this;!r&&o;){if("break"===s())break}},n.prototype.processValues=function(e,n,i,o,r,s){var l,a=this.gridOptionsWrapper.getFillOperation(),c="y"===this.dragAxis;if(l=c?this.isUp?"up":"down":this.isLeft?"left":"right",a){var d=a({event:e,values:n,initialValues:i,currentIndex:s,currentCellValue:this.valueService.getValue(o,r),api:this.gridOptionsWrapper.getApi(),columnApi:this.gridOptionsWrapper.getColumnApi(),context:this.gridOptionsWrapper.getContext(),direction:l,column:c?o:void 0,rowNode:c?void 0:r});if(!1!==d)return d}var g=!n.some((function(e){var t=parseFloat(e);return isNaN(t)||t.toString()!==e.toString()}));if(e.altKey||!g){if(g&&1===i.length){var u=this.isUp||this.isLeft?-1:1;return parseFloat(t._.last(n))+1*u}return n[s%n.length]}return t._.last(t._.findLineByLeastSquares(n.map(Number)))},n.prototype.clearValues=function(){this.clearMarkedPath(),this.clearCellValues(),this.lastCellMarked=void 0,e.prototype.clearValues.call(this)},n.prototype.clearMarkedPath=function(){this.markedCells.forEach((function(e){var t=e.getComp();t.addOrRemoveCssClass("ag-selection-fill-top",!1),t.addOrRemoveCssClass("ag-selection-fill-right",!1),t.addOrRemoveCssClass("ag-selection-fill-bottom",!1),t.addOrRemoveCssClass("ag-selection-fill-left",!1)})),this.markedCells.length=0,this.isUp=!1,this.isLeft=!1,this.isReduce=!1},n.prototype.clearCellValues=function(){this.cellValues.length=0},n.prototype.markPathFrom=function(e,t){if(this.clearMarkedPath(),this.clearCellValues(),"y"===this.dragAxis){if(this.rowPositionUtils.sameRow(t,e))return;var n=this.rowPositionUtils.before(t,e),i=this.getRangeStartRow(),o=this.getRangeEndRow();n&&(t.rowPinned==i.rowPinned&&t.rowIndex>=i.rowIndex||i.rowPinned!=o.rowPinned&&t.rowPinned==o.rowPinned&&t.rowIndex<=o.rowIndex)?(this.reduceVertical(e,t),this.isReduce=!0):(this.extendVertical(e,t,n),this.isReduce=!1)}else{var r=e.column,s=t.column;if(r===s)return;var l=this.columnModel.getAllDisplayedColumns(),a=l.indexOf(r),c=l.indexOf(s);c<=a&&c>=l.indexOf(this.getCellRange().columns[0])?(this.reduceHorizontal(e,t),this.isReduce=!0):(this.extendHorizontal(e,t,c<a),this.isReduce=!1)}this.lastCellMarked=t},n.prototype.extendVertical=function(e,t,n){var i=this.navigationService,o=this.rangeService,r=e;do{for(var s=this.getCellRange(),l=s.columns.length,a=0;a<l;a++){var c=s.columns[a],d={rowIndex:r.rowIndex,rowPinned:r.rowPinned},g=u(u({},d),{column:c}),h=o.isCellInSpecificRange(g,s),p=this.rowPositionUtils.sameRow(r,e);if(n&&(this.isUp=!0),!p){var v=i.getCellByPosition(g);if(v){this.markedCells.push(v);var f=v.getComp();h||(f.addOrRemoveCssClass("ag-selection-fill-left",0===a),f.addOrRemoveCssClass("ag-selection-fill-right",a===l-1)),f.addOrRemoveCssClass(n?"ag-selection-fill-top":"ag-selection-fill-bottom",this.rowPositionUtils.sameRow(r,t))}}}if(this.rowPositionUtils.sameRow(r,t))break}while(r=n?this.cellNavigationService.getRowAbove(r):this.cellNavigationService.getRowBelow(r))},n.prototype.reduceVertical=function(e,t){var n=e;do{for(var i=this.getCellRange(),o=i.columns.length,r=this.rowPositionUtils.sameRow(n,t),s=0;s<o;s++){var l={rowIndex:n.rowIndex,rowPinned:n.rowPinned},a=u(u({},l),{column:i.columns[s]}),c=this.navigationService.getCellByPosition(a);if(c)this.markedCells.push(c),c.getComp().addOrRemoveCssClass("ag-selection-fill-bottom",this.rowPositionUtils.sameRow(n,t))}if(r)break}while(n=this.cellNavigationService.getRowAbove(n))},n.prototype.extendHorizontal=function(e,n,i){var o=this,r=this.columnModel.getAllDisplayedColumns(),s=r.indexOf(i?n.column:e.column),l=r.indexOf(i?this.getCellRange().columns[0]:n.column),a=i?0:1,c=r.slice(s+a,l+a),d=this.getRangeStartRow(),g=this.getRangeEndRow();c.forEach((function(e){var n=d,r=!1;do{r=o.rowPositionUtils.sameRow(n,g);var s=o.navigationService.getCellByPosition({rowIndex:n.rowIndex,rowPinned:n.rowPinned,column:e});if(s){o.markedCells.push(s);var l=s.getComp();l.addOrRemoveCssClass("ag-selection-fill-top",o.rowPositionUtils.sameRow(n,d)),l.addOrRemoveCssClass("ag-selection-fill-bottom",o.rowPositionUtils.sameRow(n,g)),i?(o.isLeft=!0,l.addOrRemoveCssClass("ag-selection-fill-left",e===c[0])):l.addOrRemoveCssClass("ag-selection-fill-right",e===t._.last(c))}n=o.cellNavigationService.getRowBelow(n)}while(!r)}))},n.prototype.reduceHorizontal=function(e,t){var n=this,i=this.columnModel.getAllDisplayedColumns(),o=i.indexOf(t.column),r=i.indexOf(e.column),s=i.slice(o,r),l=this.getRangeStartRow(),a=this.getRangeEndRow();s.forEach((function(e){var t=l,i=!1;do{i=n.rowPositionUtils.sameRow(t,a);var o=n.navigationService.getCellByPosition({rowIndex:t.rowIndex,rowPinned:t.rowPinned,column:e});if(o)n.markedCells.push(o),o.getComp().addOrRemoveCssClass("ag-selection-fill-right",e===s[0]);t=n.cellNavigationService.getRowBelow(t)}while(!i)}))},n.prototype.refresh=function(t){var n=this.rangeService.getCellRanges()[0];n.startRow&&n.endRow?e.prototype.refresh.call(this,t):this.destroy()},n.TEMPLATE='<div class="ag-fill-handle"></div>',h([t.Autowired("valueService")],n.prototype,"valueService",void 0),n}(d),f=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),w=function(){return(w=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},R=function(e){function n(){var i=e.call(this,n.TEMPLATE)||this;return i.type=t.SelectionHandleType.RANGE,i.rangeFixed=!1,i}return f(n,e),n.prototype.onDrag=function(e){var n=this.getLastCellHovered();if(n){var i=this.rangeService.getCellRanges(),o=t._.last(i);if(this.rangeFixed||(this.fixRangeStartEnd(o),this.rangeFixed=!0),this.endPosition={rowIndex:n.rowIndex,rowPinned:n.rowPinned,column:n.column},2===i.length&&i[0].type===t.CellRangeType.DIMENSION&&o.type===t.CellRangeType.VALUE)!this.rowPositionUtils.sameRow(this.endPosition,this.rangeService.getRangeEndRow(o))&&this.rangeService.updateRangeEnd(i[0],w(w({},this.endPosition),{column:i[0].columns[0]}),!0);this.rangeService.extendLatestRangeToCell(this.endPosition)}},n.prototype.onDragEnd=function(e){var n=t._.last(this.rangeService.getCellRanges());this.fixRangeStartEnd(n),this.rangeFixed=!1},n.prototype.fixRangeStartEnd=function(e){var t=this.rangeService.getRangeStartRow(e),n=this.rangeService.getRangeEndRow(e),i=e.columns[0];e.startRow=t,e.endRow=n,e.startColumn=i},n.TEMPLATE='<div class="ag-range-handle"></div>',n}(d),m=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),C=function(e,t,n,i){var o,r=arguments.length,s=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(s=(r<3?o(s):r>3?o(t,n,s):o(t,n))||s);return r>3&&s&&Object.defineProperty(t,n,s),s},y=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return m(n,e),n.prototype.createSelectionHandle=function(e){return this.createBean(e===t.SelectionHandleType.RANGE?new R:new v)},n=C([t.Bean("selectionHandleFactory")],n)}(t.BeanStub),S={moduleName:t.ModuleNames.RangeSelectionModule,beans:[s,y],agStackComponents:[{componentName:"AgFillHandle",componentClass:v},{componentName:"AgRangeHandle",componentClass:R}],dependantModules:[n.EnterpriseCoreModule]};exports.RangeSelectionModule=S;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("@ag-grid-community/core"),n=require("@ag-grid-enterprise/core"),o=(e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)},function(t,n){function o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}),i=function(e,t,n,o){var i,r=arguments.length,s=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,o);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(s=(r<3?i(s):r>3?i(t,n,s):i(t,n))||s);return r>3&&s&&Object.defineProperty(t,n,s),s},r=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),i=0;for(t=0;t<n;t++)for(var r=arguments[t],s=0,l=r.length;s<l;s++,i++)o[i]=r[s];return o},s=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.cellRanges=[],t.bodyScrollListener=t.onBodyScroll.bind(t),t.dragging=!1,t}return o(n,e),n.prototype.init=function(){var e=this;this.addManagedListener(this.eventService,t.Events.EVENT_NEW_COLUMNS_LOADED,(function(){return e.removeAllCellRanges()})),this.addManagedListener(this.eventService,t.Events.EVENT_COLUMN_PIVOT_MODE_CHANGED,(function(){return e.removeAllCellRanges()})),this.addManagedListener(this.eventService,t.Events.EVENT_COLUMN_ROW_GROUP_CHANGED,(function(){return e.removeAllCellRanges()})),this.addManagedListener(this.eventService,t.Events.EVENT_COLUMN_PIVOT_CHANGED,(function(){return e.removeAllCellRanges()})),this.addManagedListener(this.eventService,t.Events.EVENT_COLUMN_GROUP_OPENED,this.refreshLastRangeStart.bind(this)),this.addManagedListener(this.eventService,t.Events.EVENT_COLUMN_MOVED,this.refreshLastRangeStart.bind(this)),this.addManagedListener(this.eventService,t.Events.EVENT_COLUMN_PINNED,this.refreshLastRangeStart.bind(this)),this.addManagedListener(this.eventService,t.Events.EVENT_COLUMN_VISIBLE,this.onColumnVisibleChange.bind(this)),this.ctrlsService.whenReady((function(){var n=e.ctrlsService.getGridBodyCtrl();e.autoScrollService=new t.AutoScrollService({scrollContainer:n.getBodyViewportElement(),scrollAxis:"xy",getVerticalPosition:function(){return n.getScrollFeature().getVScrollPosition().top},setVerticalPosition:function(e){return n.getScrollFeature().setVerticalScrollPosition(e)},getHorizontalPosition:function(){return n.getScrollFeature().getHScrollPosition().left},setHorizontalPosition:function(e){return n.getScrollFeature().setHorizontalScrollPosition(e)},shouldSkipVerticalScroll:function(){return e.gridOptionsWrapper.getDomLayout()!==t.Constants.DOM_LAYOUT_NORMAL},shouldSkipHorizontalScroll:function(){return n.getScrollFeature().isHorizontalScrollShowing()}})}))},n.prototype.onColumnVisibleChange=function(){var e=this;this.refreshLastRangeStart(),this.cellRanges.forEach((function(n){var o=n.columns;n.columns=n.columns.filter((function(e){return e.isVisible()})),!t._.areEqual(o,n.columns)&&e.dispatchChangedEvent(!1,!0,n.id)}))},n.prototype.refreshLastRangeStart=function(){var e=t._.last(this.cellRanges);e&&this.refreshRangeStart(e)},n.prototype.isContiguousRange=function(e){var n=e.columns;if(!n.length)return!1;var o=this.columnModel.getAllDisplayedColumns(),i=n.map((function(e){return o.indexOf(e)})).sort((function(e,t){return e-t}));return t._.last(i)-i[0]+1===n.length},n.prototype.getRangeStartRow=function(e){return e.startRow&&e.endRow?this.rowPositionUtils.before(e.startRow,e.endRow)?e.startRow:e.endRow:{rowIndex:0,rowPinned:this.pinnedRowModel.getPinnedTopRowCount()>0?t.Constants.PINNED_TOP:null}},n.prototype.getRangeEndRow=function(e){if(e.startRow&&e.endRow)return this.rowPositionUtils.before(e.startRow,e.endRow)?e.endRow:e.startRow;var n=this.pinnedRowModel.getPinnedBottomRowCount();return n>0?{rowIndex:n-1,rowPinned:t.Constants.PINNED_BOTTOM}:{rowIndex:this.rowModel.getRowCount()-1,rowPinned:null}},n.prototype.setRangeToCell=function(e,n){if(void 0===n&&(n=!1),this.gridOptionsWrapper.isEnableRangeSelection()){var o=this.calculateColumnsBetween(e.column,e.column);if(o){(this.gridOptionsWrapper.isSuppressMultiRangeSelection()||!n||t._.missing(this.cellRanges))&&this.removeAllCellRanges(!0);for(var i,r={rowIndex:e.rowIndex,rowPinned:e.rowPinned},s=0;s<this.cellRanges.length;s++){var l=this.cellRanges[s];if(l.columns&&1===l.columns.length&&l.columns[0]===e.column&&this.rowPositionUtils.sameRow(r,l.startRow)&&this.rowPositionUtils.sameRow(r,l.endRow)){i=l;break}}i?t._.last(this.cellRanges)!==i&&(t._.removeFromArray(this.cellRanges,i),this.cellRanges.push(i)):(i={startRow:r,endRow:r,columns:o,startColumn:e.column},this.cellRanges.push(i)),this.newestRangeStartCell=e,this.onDragStop(),this.dispatchChangedEvent(!0,!0,i.id)}}},n.prototype.extendLatestRangeToCell=function(e){if(!this.isEmpty()&&this.newestRangeStartCell){var n=t._.last(this.cellRanges);this.updateRangeEnd(n,e)}},n.prototype.updateRangeEnd=function(e,t,n){void 0===n&&(n=!1);var o=t.column,i=this.calculateColumnsBetween(e.startColumn,o);i&&!this.isLastCellOfRange(e,t)&&(e.columns=i,e.endRow={rowIndex:t.rowIndex,rowPinned:t.rowPinned},n||this.dispatchChangedEvent(!0,!0,e.id))},n.prototype.refreshRangeStart=function(e){var n=e.startColumn,o=e.columns,i=function(t,n){var o=e.columns.filter((function(e){return e!==t}));t?(e.startColumn=t,e.columns=n?r([t],o):r(o,[t])):e.columns=o},s=this.getRangeEdgeColumns(e),l=s.left,a=s.right;n===o[0]&&n!==l?i(l,!0):n===t._.last(o)&&n===a&&i(a,!1)},n.prototype.getRangeEdgeColumns=function(e){var n=this.columnModel.getAllDisplayedColumns(),o=e.columns.map((function(e){return n.indexOf(e)})).filter((function(e){return e>-1})).sort((function(e,t){return e-t}));return{left:n[o[0]],right:n[t._.last(o)]}},n.prototype.extendLatestRangeInDirection=function(e){if(!this.isEmpty()&&this.newestRangeStartCell){var n=t._.last(this.cellRanges),o=this.newestRangeStartCell,i=n.columns[0],r=t._.last(n.columns),s=n.endRow.rowIndex,l=n.endRow.rowPinned,a={column:o.column===i?r:i,rowIndex:s,rowPinned:l},c=this.cellNavigationService.getNextCellToFocus(e,a);if(c)return this.setCellRange({rowStartIndex:o.rowIndex,rowStartPinned:o.rowPinned,rowEndIndex:c.rowIndex,rowEndPinned:c.rowPinned,columnStart:o.column,columnEnd:c.column}),c}},n.prototype.setCellRange=function(e){this.gridOptionsWrapper.isEnableRangeSelection()&&(this.removeAllCellRanges(!0),this.addCellRange(e))},n.prototype.setCellRanges=function(e){var n=this;t._.shallowCompare(this.cellRanges,e)||(this.removeAllCellRanges(!0),e.forEach((function(e){e.columns&&e.startRow&&(n.newestRangeStartCell={rowIndex:e.startRow.rowIndex,rowPinned:e.startRow.rowPinned,column:e.columns[0]}),n.cellRanges.push(e)})),this.dispatchChangedEvent(!1,!0))},n.prototype.createCellRangeFromCellRangeParams=function(e){var t,n=this;if(e.columns)t=e.columns.map((function(e){return n.columnModel.getColumnWithValidation(e)})).filter((function(e){return e}));else{var o=this.columnModel.getColumnWithValidation(e.columnStart),i=this.columnModel.getColumnWithValidation(e.columnEnd);if(!o||!i)return;t=this.calculateColumnsBetween(o,i)}if(t)return{startRow:null!=e.rowStartIndex?{rowIndex:e.rowStartIndex,rowPinned:e.rowStartPinned||null}:void 0,endRow:null!=e.rowEndIndex?{rowIndex:e.rowEndIndex,rowPinned:e.rowEndPinned||null}:void 0,columns:t,startColumn:t[0]}},n.prototype.addCellRange=function(e){if(this.gridOptionsWrapper.isEnableRangeSelection()){var t=this.createCellRangeFromCellRangeParams(e);t&&(this.cellRanges.push(t),this.dispatchChangedEvent(!1,!0,t.id))}},n.prototype.getCellRanges=function(){return this.cellRanges},n.prototype.isEmpty=function(){return 0===this.cellRanges.length},n.prototype.isMoreThanOneCell=function(){if(0===this.cellRanges.length)return!1;if(this.cellRanges.length>1)return!0;var e=this.cellRanges[0],t=this.getRangeStartRow(e),n=this.getRangeEndRow(e);return t.rowPinned!==n.rowPinned||t.rowIndex!==n.rowIndex||1!==e.columns.length},n.prototype.removeAllCellRanges=function(e){this.isEmpty()||(this.onDragStop(),this.cellRanges.length=0,e||this.dispatchChangedEvent(!1,!0))},n.prototype.onBodyScroll=function(){this.onDragging(this.lastMouseEvent)},n.prototype.isCellInAnyRange=function(e){return this.getCellRangeCount(e)>0},n.prototype.isCellInSpecificRange=function(e,n){var o=null!==n.columns&&t._.includes(n.columns,e.column),i=this.isRowInRange(e.rowIndex,e.rowPinned,n);return o&&i},n.prototype.isLastCellOfRange=function(e,n){var o=e.startRow,i=e.endRow,r=this.rowPositionUtils.before(o,i)?i:o,s=n.rowIndex===r.rowIndex&&n.rowPinned===r.rowPinned,l=e.columns[0],a=t._.last(e.columns),c=e.startColumn===l?a:l;return n.column===c&&s},n.prototype.isBottomRightCell=function(e,n){var o=this.columnModel.getAllDisplayedColumns(),i=e.columns.map((function(e){return o.indexOf(e)})).sort((function(e,t){return e-t})),r=e.startRow,s=e.endRow,l=this.rowPositionUtils.before(r,s)?s:r,a=o.indexOf(n.column)===t._.last(i),c=n.rowIndex===l.rowIndex&&t._.makeNull(n.rowPinned)===t._.makeNull(l.rowPinned);return a&&c},n.prototype.getCellRangeCount=function(e){var t=this;return this.isEmpty()?0:this.cellRanges.filter((function(n){return t.isCellInSpecificRange(e,n)})).length},n.prototype.isRowInRange=function(e,t,n){var o=this.getRangeStartRow(n),i=this.getRangeEndRow(n),r={rowIndex:e,rowPinned:t||null},s=r.rowIndex===o.rowIndex&&r.rowPinned==o.rowPinned,l=r.rowIndex===i.rowIndex&&r.rowPinned==i.rowPinned;if(s||l)return!0;var a=!this.rowPositionUtils.before(r,o),c=this.rowPositionUtils.before(r,i);return a&&c},n.prototype.getDraggingRange=function(){return this.draggingRange},n.prototype.onDragStart=function(e){if(this.gridOptionsWrapper.isEnableRangeSelection()){var n=e.ctrlKey,o=e.metaKey,i=e.shiftKey,r=n||o,s=!!!this.gridOptionsWrapper.isSuppressMultiRangeSelection()&&r,l=this.mouseEventService.getCellPositionForEvent(e),a=i&&t._.existsAndNotEmpty(this.cellRanges);if(!t._.missing(l)){if(s||a&&!t._.exists(t._.last(this.cellRanges).type)||this.removeAllCellRanges(!0),this.dragging=!0,this.draggingCell=l,this.lastMouseEvent=e,a||(this.newestRangeStartCell=l),this.cellRanges.length>0)this.draggingRange=t._.last(this.cellRanges);else{var c={rowIndex:l.rowIndex,rowPinned:l.rowPinned};this.draggingRange={startRow:c,endRow:c,columns:[l.column],startColumn:this.newestRangeStartCell.column},this.cellRanges.push(this.draggingRange)}this.ctrlsService.getGridBodyCtrl().addScrollEventListener(this.bodyScrollListener),this.dispatchChangedEvent(!0,!1,this.draggingRange.id)}}},n.prototype.onDragging=function(e){var t=this;if(this.dragging&&e){this.lastMouseEvent=e;var n=this.mouseEventService.getCellPositionForEvent(e),o=function(e){return n&&n.rowPinned===e&&t.newestRangeStartCell.rowPinned===e},i=o("top")||o("bottom");if(this.autoScrollService.check(e,i),n&&this.draggingCell&&!this.cellPositionUtils.equals(this.draggingCell,n)){var r=this.calculateColumnsBetween(this.newestRangeStartCell.column,n.column);r&&(this.draggingCell=n,this.draggingRange.endRow={rowIndex:n.rowIndex,rowPinned:n.rowPinned},this.draggingRange.columns=r,this.dispatchChangedEvent(!1,!1,this.draggingRange.id))}}},n.prototype.onDragStop=function(){if(this.dragging){var e=this.draggingRange.id;this.autoScrollService.ensureCleared(),this.ctrlsService.getGridBodyCtrl().removeScrollEventListener(this.bodyScrollListener),this.lastMouseEvent=null,this.dragging=!1,this.draggingRange=void 0,this.draggingCell=void 0,this.dispatchChangedEvent(!1,!0,e)}},n.prototype.dispatchChangedEvent=function(e,n,o){var i=Object.freeze({type:t.Events.EVENT_RANGE_SELECTION_CHANGED,api:this.gridApi,columnApi:this.columnApi,started:e,finished:n,id:o});this.eventService.dispatchEvent(i)},n.prototype.calculateColumnsBetween=function(e,t){var n=this.columnModel.getAllDisplayedColumns(),o=e===t,i=n.indexOf(e);if(i<0)console.warn("AG Grid: column "+e.getId()+" is not visible");else{var r=o?i:n.indexOf(t);if(!(r<0)){if(o)return[e];for(var s=Math.min(i,r),l=s===i?r:i,a=[],c=s;c<=l;c++)a.push(n[c]);return a}console.warn("AG Grid: column "+t.getId()+" is not visible")}},i([t.Autowired("rowModel")],n.prototype,"rowModel",void 0),i([t.Autowired("columnModel")],n.prototype,"columnModel",void 0),i([t.Autowired("mouseEventService")],n.prototype,"mouseEventService",void 0),i([t.Autowired("columnApi")],n.prototype,"columnApi",void 0),i([t.Autowired("gridApi")],n.prototype,"gridApi",void 0),i([t.Autowired("cellNavigationService")],n.prototype,"cellNavigationService",void 0),i([t.Autowired("pinnedRowModel")],n.prototype,"pinnedRowModel",void 0),i([t.Autowired("rowPositionUtils")],n.prototype,"rowPositionUtils",void 0),i([t.Autowired("cellPositionUtils")],n.prototype,"cellPositionUtils",void 0),i([t.Autowired("ctrlsService")],n.prototype,"ctrlsService",void 0),i([t.PostConstruct],n.prototype,"init",null),n=i([t.Bean("rangeService")],n)}(t.BeanStub),l=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),a=function(e,t,n,o){var i,r=arguments.length,s=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,o);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(s=(r<3?i(s):r>3?i(t,n,s):i(t,n))||s);return r>3&&s&&Object.defineProperty(t,n,s),s},c=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.changedCalculatedValues=!1,t.dragging=!1,t.shouldDestroyOnEndDragging=!1,t}return l(n,e),n.prototype.init=function(){var e=this;this.dragService.addDragSource({dragStartPixels:0,eElement:this.getGui(),onDragStart:this.onDragStart.bind(this),onDragging:function(t){e.dragging=!0,e.rangeService.autoScrollService.check(t),e.changedCalculatedValues&&(e.onDrag(t),e.changedCalculatedValues=!1)},onDragStop:function(n){e.dragging=!1,e.onDragEnd(n),e.clearValues(),e.rangeService.autoScrollService.ensureCleared(),t._.removeCssClass(document.body,e.getDraggingCssClass()),e.shouldDestroyOnEndDragging&&e.destroy()}}),this.addManagedListener(this.getGui(),"mousedown",this.preventRangeExtension.bind(this))},n.prototype.isDragging=function(){return this.dragging},n.prototype.getCellCtrl=function(){return this.cellCtrl},n.prototype.setCellCtrl=function(e){this.cellCtrl=e},n.prototype.getCellRange=function(){return this.cellRange},n.prototype.setCellRange=function(e){this.cellRange=e},n.prototype.getRangeStartRow=function(){return this.rangeStartRow},n.prototype.setRangeStartRow=function(e){this.rangeStartRow=e},n.prototype.getRangeEndRow=function(){return this.rangeEndRow},n.prototype.setRangeEndRow=function(e){this.rangeEndRow=e},n.prototype.getLastCellHovered=function(){return this.lastCellHovered},n.prototype.preventRangeExtension=function(e){e.preventDefault(),e.stopPropagation()},n.prototype.onDragStart=function(e){this.cellHoverListener=this.addManagedListener(this.ctrlsService.getGridCtrl().getGui(),"mousemove",this.updateValuesOnMove.bind(this)),t._.addCssClass(document.body,this.getDraggingCssClass())},n.prototype.getDraggingCssClass=function(){return"ag-dragging-"+(this.type===t.SelectionHandleType.FILL?"fill":"range")+"-handle"},n.prototype.updateValuesOnMove=function(e){var t=this.mouseEventService.getCellPositionForEvent(e);t!==this.lastCellHovered&&(this.lastCellHovered=t,this.changedCalculatedValues=!0)},n.prototype.getType=function(){return this.type},n.prototype.refresh=function(e){var n=this,o=this.getCellCtrl(),i=this.getGui(),r=t._.last(this.rangeService.getCellRanges()),s=r.startRow,l=r.endRow;s&&l&&(this.rowPositionUtils.before(l,s)?(this.setRangeStartRow(l),this.setRangeEndRow(s)):(this.setRangeStartRow(s),this.setRangeEndRow(l)));o===e&&t._.isVisible(i)||(this.setCellCtrl(e),window.setTimeout((function(){n.isAlive()&&e.appendChild(i)}),1)),this.setCellRange(r)},n.prototype.clearValues=function(){this.lastCellHovered=void 0,this.removeListeners()},n.prototype.removeListeners=function(){this.cellHoverListener&&(this.cellHoverListener(),this.cellHoverListener=void 0)},n.prototype.destroy=function(){if(!this.shouldDestroyOnEndDragging&&this.isDragging())return t._.setDisplayed(this.getGui(),!1),void(this.shouldDestroyOnEndDragging=!0);this.shouldDestroyOnEndDragging=!1,e.prototype.destroy.call(this),this.removeListeners();var n=this.getGui();n.parentElement&&n.parentElement.removeChild(n)},a([t.Autowired("rowRenderer")],n.prototype,"rowRenderer",void 0),a([t.Autowired("dragService")],n.prototype,"dragService",void 0),a([t.Autowired("rangeService")],n.prototype,"rangeService",void 0),a([t.Autowired("mouseEventService")],n.prototype,"mouseEventService",void 0),a([t.Autowired("columnModel")],n.prototype,"columnModel",void 0),a([t.Autowired("cellNavigationService")],n.prototype,"cellNavigationService",void 0),a([t.Autowired("navigationService")],n.prototype,"navigationService",void 0),a([t.Autowired("rowPositionUtils")],n.prototype,"rowPositionUtils",void 0),a([t.Autowired("ctrlsService")],n.prototype,"ctrlsService",void 0),a([t.PostConstruct],n.prototype,"init",null),n}(t.Component),u=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),d=function(){return(d=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},g=function(e,t,n,o){var i,r=arguments.length,s=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,o);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(s=(r<3?i(s):r>3?i(t,n,s):i(t,n))||s);return r>3&&s&&Object.defineProperty(t,n,s),s},h=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),i=0;for(t=0;t<n;t++)for(var r=arguments[t],s=0,l=r.length;s<l;s++,i++)o[i]=r[s];return o},p=function(e){function n(){var o=e.call(this,n.TEMPLATE)||this;return o.markedCells=[],o.cellValues=[],o.isUp=!1,o.isLeft=!1,o.isReduce=!1,o.type=t.SelectionHandleType.FILL,o}return u(n,e),n.prototype.updateValuesOnMove=function(t){e.prototype.updateValuesOnMove.call(this,t),this.initialXY||(this.initialXY=this.mouseEventService.getNormalisedPosition(t));var n,o=this.initialXY,i=o.x,r=o.y,s=this.mouseEventService.getNormalisedPosition(t),l=s.x,a=s.y,c=Math.abs(i-l),u=Math.abs(r-a),d=this.gridOptionsWrapper.getFillHandleDirection();(n="xy"===d?c>u?"x":"y":d)!==this.dragAxis&&(this.dragAxis=n,this.changedCalculatedValues=!0)},n.prototype.onDrag=function(e){if(!this.initialPosition){var t=this.getCellCtrl();if(!t)return;this.initialPosition=t.getCellPosition()}var n=this.getLastCellHovered();n&&this.markPathFrom(this.initialPosition,n)},n.prototype.onDragEnd=function(e){if(this.initialXY=null,this.markedCells.length){var t,n="x"===this.dragAxis,o=this.getCellRange(),i=o.columns.length,r=this.getRangeStartRow(),s=this.getRangeEndRow();if(this.isUp||this.isLeft){var l=n?r:this.lastCellMarked;t=this.rangeService.createCellRangeFromCellRangeParams({rowStartIndex:l.rowIndex,rowStartPinned:l.rowPinned,columnStart:n?this.lastCellMarked.column:o.columns[0],rowEndIndex:s.rowIndex,rowEndPinned:s.rowPinned,columnEnd:o.columns[i-1]})}else t=this.rangeService.createCellRangeFromCellRangeParams({rowStartIndex:r.rowIndex,rowStartPinned:r.rowPinned,columnStart:o.columns[0],rowEndIndex:n?s.rowIndex:this.lastCellMarked.rowIndex,rowEndPinned:n?s.rowPinned:this.lastCellMarked.rowPinned,columnEnd:n?this.lastCellMarked.column:o.columns[i-1]});t&&(this.raiseFillStartEvent(),this.handleValueChanged(o,t,e),this.rangeService.setCellRanges([t]),this.raiseFillEndEvent(o,t))}},n.prototype.raiseFillStartEvent=function(){var e={type:t.Events.EVENT_FILL_START,columnApi:this.gridOptionsWrapper.getColumnApi(),api:this.gridOptionsWrapper.getApi()};this.eventService.dispatchEvent(e)},n.prototype.raiseFillEndEvent=function(e,n){var o={type:t.Events.EVENT_FILL_END,columnApi:this.gridOptionsWrapper.getColumnApi(),api:this.gridOptionsWrapper.getApi(),initialRange:e,finalRange:n};this.eventService.dispatchEvent(o)},n.prototype.handleValueChanged=function(e,n,o){var i=this,r=this.rangeService.getRangeEndRow(e),s=this.rangeService.getRangeStartRow(e),l=this.rangeService.getRangeEndRow(n),a=this.rangeService.getRangeStartRow(n),c="y"===this.dragAxis;if(!this.isReduce||this.gridOptionsWrapper.isSuppressClearOnFillReduction()){var u=!0,d=[],g=[],p=0,v=function(){d.length=0,g.length=0,p=0},f=function(n,o){var g=i.isUp?r:s,h=!1;c&&(u=!0,v());for(var p=function(){var p=i.rowPositionUtils.getRowNode(g);if(!p)return"break";c&&n?w(d,n,p,(function(){return!i.rowPositionUtils.sameRow(g,i.isUp?s:r)})):o&&(u=!0,v(),o.forEach((function(n){return w(d,n,p,(function(){return n!==(i.isLeft?e.columns[0]:t._.last(e.columns))}))}))),h=i.rowPositionUtils.sameRow(g,i.isUp?a:l),g=i.isUp?i.cellNavigationService.getRowAbove(g):i.cellNavigationService.getRowBelow(g)};!h&&g;){if("break"===p())break}},w=function(e,t,n,r){var s,l=!1;u?(s=i.valueService.getValue(t,n),g.push(s),u=r()):(s=i.processValues(o,e,g,t,n,p++),t.isCellEditable(n)&&(i.valueService.getValue(t,n)!==s?n.setDataValue(t,s):l=!0));l||e.push(s)};if(c)e.columns.forEach((function(e){f(e)}));else{R=this.isLeft?h(n.columns).reverse():n.columns;f(void 0,R)}}else{var R=c?e.columns:e.columns.filter((function(e){return n.columns.indexOf(e)<0})),m=c?this.cellNavigationService.getRowBelow(l):a;m&&this.clearCellsInRange(m,r,R)}},n.prototype.clearCellsInRange=function(e,t,n){for(var o=e,i=!1,r=function(){var e=s.rowPositionUtils.getRowNode(o);if(!e)return"break";n.forEach((function(t){t.isCellEditable(e)&&e.setDataValue(t,null)})),i=s.rowPositionUtils.sameRow(o,t),o=s.cellNavigationService.getRowBelow(o)},s=this;!i&&o;){if("break"===r())break}},n.prototype.processValues=function(e,n,o,i,r,s){var l,a=this.gridOptionsWrapper.getFillOperation();if(l="y"===this.dragAxis?this.isUp?"up":"down":this.isLeft?"left":"right",a){var c=a({event:e,values:n,initialValues:o,currentIndex:s,currentCellValue:this.valueService.getValue(i,r),api:this.gridOptionsWrapper.getApi(),columnApi:this.gridOptionsWrapper.getColumnApi(),context:this.gridOptionsWrapper.getContext(),direction:l,column:i,rowNode:r});if(!1!==c)return c}var u=!n.some((function(e){var t=parseFloat(e);return isNaN(t)||t.toString()!==e.toString()}));if(e.altKey||!u){if(u&&1===o.length){var d=this.isUp||this.isLeft?-1:1;return parseFloat(t._.last(n))+1*d}return n[s%n.length]}return t._.last(t._.findLineByLeastSquares(n.map(Number)))},n.prototype.clearValues=function(){this.clearMarkedPath(),this.clearCellValues(),this.lastCellMarked=void 0,e.prototype.clearValues.call(this)},n.prototype.clearMarkedPath=function(){this.markedCells.forEach((function(e){var t=e.getComp();t.addOrRemoveCssClass("ag-selection-fill-top",!1),t.addOrRemoveCssClass("ag-selection-fill-right",!1),t.addOrRemoveCssClass("ag-selection-fill-bottom",!1),t.addOrRemoveCssClass("ag-selection-fill-left",!1)})),this.markedCells.length=0,this.isUp=!1,this.isLeft=!1,this.isReduce=!1},n.prototype.clearCellValues=function(){this.cellValues.length=0},n.prototype.markPathFrom=function(e,t){if(this.clearMarkedPath(),this.clearCellValues(),"y"===this.dragAxis){if(this.rowPositionUtils.sameRow(t,e))return;var n=this.rowPositionUtils.before(t,e),o=this.getRangeStartRow(),i=this.getRangeEndRow();n&&(t.rowPinned==o.rowPinned&&t.rowIndex>=o.rowIndex||o.rowPinned!=i.rowPinned&&t.rowPinned==i.rowPinned&&t.rowIndex<=i.rowIndex)?(this.reduceVertical(e,t),this.isReduce=!0):(this.extendVertical(e,t,n),this.isReduce=!1)}else{var r=e.column,s=t.column;if(r===s)return;var l=this.columnModel.getAllDisplayedColumns(),a=l.indexOf(r),c=l.indexOf(s);c<=a&&c>=l.indexOf(this.getCellRange().columns[0])?(this.reduceHorizontal(e,t),this.isReduce=!0):(this.extendHorizontal(e,t,c<a),this.isReduce=!1)}this.lastCellMarked=t},n.prototype.extendVertical=function(e,t,n){var o=this.navigationService,i=this.rangeService,r=e;do{for(var s=this.getCellRange(),l=s.columns.length,a=0;a<l;a++){var c=s.columns[a],u={rowIndex:r.rowIndex,rowPinned:r.rowPinned},g=d(d({},u),{column:c}),h=i.isCellInSpecificRange(g,s),p=this.rowPositionUtils.sameRow(r,e);if(n&&(this.isUp=!0),!p){var v=o.getCellByPosition(g);if(v){this.markedCells.push(v);var f=v.getComp();h||(f.addOrRemoveCssClass("ag-selection-fill-left",0===a),f.addOrRemoveCssClass("ag-selection-fill-right",a===l-1)),f.addOrRemoveCssClass(n?"ag-selection-fill-top":"ag-selection-fill-bottom",this.rowPositionUtils.sameRow(r,t))}}}if(this.rowPositionUtils.sameRow(r,t))break}while(r=n?this.cellNavigationService.getRowAbove(r):this.cellNavigationService.getRowBelow(r))},n.prototype.reduceVertical=function(e,t){var n=e;do{for(var o=this.getCellRange(),i=o.columns.length,r=this.rowPositionUtils.sameRow(n,t),s=0;s<i;s++){var l={rowIndex:n.rowIndex,rowPinned:n.rowPinned},a=d(d({},l),{column:o.columns[s]}),c=this.navigationService.getCellByPosition(a);if(c)this.markedCells.push(c),c.getComp().addOrRemoveCssClass("ag-selection-fill-bottom",this.rowPositionUtils.sameRow(n,t))}if(r)break}while(n=this.cellNavigationService.getRowAbove(n))},n.prototype.extendHorizontal=function(e,n,o){var i=this,r=this.columnModel.getAllDisplayedColumns(),s=r.indexOf(o?n.column:e.column),l=r.indexOf(o?this.getCellRange().columns[0]:n.column),a=o?0:1,c=r.slice(s+a,l+a),u=this.getRangeStartRow(),d=this.getRangeEndRow();c.forEach((function(e){var n=u,r=!1;do{r=i.rowPositionUtils.sameRow(n,d);var s=i.navigationService.getCellByPosition({rowIndex:n.rowIndex,rowPinned:n.rowPinned,column:e});if(s){i.markedCells.push(s);var l=s.getComp();l.addOrRemoveCssClass("ag-selection-fill-top",i.rowPositionUtils.sameRow(n,u)),l.addOrRemoveCssClass("ag-selection-fill-bottom",i.rowPositionUtils.sameRow(n,d)),o?(i.isLeft=!0,l.addOrRemoveCssClass("ag-selection-fill-left",e===c[0])):l.addOrRemoveCssClass("ag-selection-fill-right",e===t._.last(c))}n=i.cellNavigationService.getRowBelow(n)}while(!r)}))},n.prototype.reduceHorizontal=function(e,t){var n=this,o=this.columnModel.getAllDisplayedColumns(),i=o.indexOf(t.column),r=o.indexOf(e.column),s=o.slice(i,r),l=this.getRangeStartRow(),a=this.getRangeEndRow();s.forEach((function(e){var t=l,o=!1;do{o=n.rowPositionUtils.sameRow(t,a);var i=n.navigationService.getCellByPosition({rowIndex:t.rowIndex,rowPinned:t.rowPinned,column:e});if(i)n.markedCells.push(i),i.getComp().addOrRemoveCssClass("ag-selection-fill-right",e===s[0]);t=n.cellNavigationService.getRowBelow(t)}while(!o)}))},n.prototype.refresh=function(t){var n=this.rangeService.getCellRanges()[0];n.startRow&&n.endRow?e.prototype.refresh.call(this,t):this.destroy()},n.TEMPLATE='<div class="ag-fill-handle"></div>',g([t.Autowired("valueService")],n.prototype,"valueService",void 0),n}(c),v=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),f=function(){return(f=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},w=function(e){function n(){var o=e.call(this,n.TEMPLATE)||this;return o.type=t.SelectionHandleType.RANGE,o.rangeFixed=!1,o}return v(n,e),n.prototype.onDrag=function(e){var n=this.getLastCellHovered();if(n){var o=this.rangeService.getCellRanges(),i=t._.last(o);if(this.rangeFixed||(this.fixRangeStartEnd(i),this.rangeFixed=!0),this.endPosition={rowIndex:n.rowIndex,rowPinned:n.rowPinned,column:n.column},2===o.length&&o[0].type===t.CellRangeType.DIMENSION&&i.type===t.CellRangeType.VALUE)!this.rowPositionUtils.sameRow(this.endPosition,this.rangeService.getRangeEndRow(i))&&this.rangeService.updateRangeEnd(o[0],f(f({},this.endPosition),{column:o[0].columns[0]}),!0);this.rangeService.extendLatestRangeToCell(this.endPosition)}},n.prototype.onDragEnd=function(e){var n=t._.last(this.rangeService.getCellRanges());this.fixRangeStartEnd(n),this.rangeFixed=!1},n.prototype.fixRangeStartEnd=function(e){var t=this.rangeService.getRangeStartRow(e),n=this.rangeService.getRangeEndRow(e),o=e.columns[0];e.startRow=t,e.endRow=n,e.startColumn=o},n.TEMPLATE='<div class="ag-range-handle"></div>',n}(c),R=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),m=function(e,t,n,o){var i,r=arguments.length,s=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,o);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(s=(r<3?i(s):r>3?i(t,n,s):i(t,n))||s);return r>3&&s&&Object.defineProperty(t,n,s),s},C=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return R(n,e),n.prototype.createSelectionHandle=function(e){return this.createBean(e===t.SelectionHandleType.RANGE?new w:new p)},n=m([t.Bean("selectionHandleFactory")],n)}(t.BeanStub),y={moduleName:t.ModuleNames.RangeSelectionModule,beans:[s,C],agStackComponents:[{componentName:"AgFillHandle",componentClass:p},{componentName:"AgRangeHandle",componentClass:w}],dependantModules:[n.EnterpriseCoreModule]};exports.RangeSelectionModule=y;
/**
* @ag-grid-enterprise/range-selection - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components * @version v26.0.0
* @ag-grid-enterprise/range-selection - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components * @version v26.1.0
* @link http://www.ag-grid.com/

@@ -8,6 +8,6 @@ ' * @license Commercial

/**
* @ag-grid-enterprise/range-selection - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components * @version v26.0.0
* @ag-grid-enterprise/range-selection - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components * @version v26.1.0
* @link http://www.ag-grid.com/
' * @license Commercial
*/
import{Events as e,_ as t,Constants as n,Autowired as i,PostConstruct as o,Bean as r,BeanStub as s,SelectionHandleType as l,Component as a,CellRangeType as c,ModuleNames as g}from"@ag-grid-community/core";import{EnterpriseCoreModule as d}from"@ag-grid-enterprise/core";var u,h=(u=function(e,t){return(u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}u(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),p=function(e,t,n,i){var o,r=arguments.length,s=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(s=(r<3?o(s):r>3?o(t,n,s):o(t,n))||s);return r>3&&s&&Object.defineProperty(t,n,s),s},f=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var i=Array(e),o=0;for(t=0;t<n;t++)for(var r=arguments[t],s=0,l=r.length;s<l;s++,o++)i[o]=r[s];return i},v=function(s){function l(){var e=null!==s&&s.apply(this,arguments)||this;return e.cellRanges=[],e.bodyScrollListener=e.onBodyScroll.bind(e),e.dragging=!1,e}return h(l,s),l.prototype.init=function(){var t=this;this.addManagedListener(this.eventService,e.EVENT_NEW_COLUMNS_LOADED,(function(){return t.removeAllCellRanges()})),this.addManagedListener(this.eventService,e.EVENT_COLUMN_PIVOT_MODE_CHANGED,(function(){return t.removeAllCellRanges()})),this.addManagedListener(this.eventService,e.EVENT_COLUMN_ROW_GROUP_CHANGED,(function(){return t.removeAllCellRanges()})),this.addManagedListener(this.eventService,e.EVENT_COLUMN_PIVOT_CHANGED,(function(){return t.removeAllCellRanges()})),this.addManagedListener(this.eventService,e.EVENT_COLUMN_GROUP_OPENED,this.refreshLastRangeStart.bind(this)),this.addManagedListener(this.eventService,e.EVENT_COLUMN_MOVED,this.refreshLastRangeStart.bind(this)),this.addManagedListener(this.eventService,e.EVENT_COLUMN_PINNED,this.refreshLastRangeStart.bind(this)),this.addManagedListener(this.eventService,e.EVENT_COLUMN_VISIBLE,this.onColumnVisibleChange.bind(this)),this.ctrlsService.whenReady((function(){var e=t.ctrlsService.getGridBodyCtrl();t.autoScrollService=new w(e,t.gridOptionsWrapper)}))},l.prototype.onColumnVisibleChange=function(){var e=this;this.refreshLastRangeStart(),this.cellRanges.forEach((function(n){var i=n.columns;n.columns=n.columns.filter((function(e){return e.isVisible()})),!t.areEqual(i,n.columns)&&e.dispatchChangedEvent(!1,!0,n.id)}))},l.prototype.refreshLastRangeStart=function(){var e=t.last(this.cellRanges);e&&this.refreshRangeStart(e)},l.prototype.isContiguousRange=function(e){var n=e.columns;if(!n.length)return!1;var i=this.columnModel.getAllDisplayedColumns(),o=n.map((function(e){return i.indexOf(e)})).sort((function(e,t){return e-t}));return t.last(o)-o[0]+1===n.length},l.prototype.getRangeStartRow=function(e){return e.startRow&&e.endRow?this.rowPositionUtils.before(e.startRow,e.endRow)?e.startRow:e.endRow:{rowIndex:0,rowPinned:this.pinnedRowModel.getPinnedTopRowCount()>0?n.PINNED_TOP:null}},l.prototype.getRangeEndRow=function(e){if(e.startRow&&e.endRow)return this.rowPositionUtils.before(e.startRow,e.endRow)?e.endRow:e.startRow;var t=this.pinnedRowModel.getPinnedBottomRowCount();return t>0?{rowIndex:t-1,rowPinned:n.PINNED_BOTTOM}:{rowIndex:this.rowModel.getRowCount()-1,rowPinned:null}},l.prototype.setRangeToCell=function(e,n){if(void 0===n&&(n=!1),this.gridOptionsWrapper.isEnableRangeSelection()){var i=this.calculateColumnsBetween(e.column,e.column);if(i){(this.gridOptionsWrapper.isSuppressMultiRangeSelection()||!n||t.missing(this.cellRanges))&&this.removeAllCellRanges(!0);for(var o,r={rowIndex:e.rowIndex,rowPinned:e.rowPinned},s=0;s<this.cellRanges.length;s++){var l=this.cellRanges[s];if(l.columns&&1===l.columns.length&&l.columns[0]===e.column&&this.rowPositionUtils.sameRow(r,l.startRow)&&this.rowPositionUtils.sameRow(r,l.endRow)){o=l;break}}o?t.last(this.cellRanges)!==o&&(t.removeFromArray(this.cellRanges,o),this.cellRanges.push(o)):(o={startRow:r,endRow:r,columns:i,startColumn:e.column},this.cellRanges.push(o)),this.newestRangeStartCell=e,this.onDragStop(),this.dispatchChangedEvent(!0,!0,o.id)}}},l.prototype.extendLatestRangeToCell=function(e){if(!this.isEmpty()&&this.newestRangeStartCell){var n=t.last(this.cellRanges);this.updateRangeEnd(n,e)}},l.prototype.updateRangeEnd=function(e,t,n){void 0===n&&(n=!1);var i=t.column,o=this.calculateColumnsBetween(e.startColumn,i);o&&!this.isLastCellOfRange(e,t)&&(e.columns=o,e.endRow={rowIndex:t.rowIndex,rowPinned:t.rowPinned},n||this.dispatchChangedEvent(!0,!0,e.id))},l.prototype.refreshRangeStart=function(e){var n=e.startColumn,i=e.columns,o=function(t,n){var i=e.columns.filter((function(e){return e!==t}));t?(e.startColumn=t,e.columns=n?f([t],i):f(i,[t])):e.columns=i},r=this.getRangeEdgeColumns(e),s=r.left,l=r.right;n===i[0]&&n!==s?o(s,!0):n===t.last(i)&&n===l&&o(l,!1)},l.prototype.getRangeEdgeColumns=function(e){var n=this.columnModel.getAllDisplayedColumns(),i=e.columns.map((function(e){return n.indexOf(e)})).filter((function(e){return e>-1})).sort((function(e,t){return e-t}));return{left:n[i[0]],right:n[t.last(i)]}},l.prototype.extendLatestRangeInDirection=function(e){if(!this.isEmpty()&&this.newestRangeStartCell){var n=t.last(this.cellRanges),i=this.newestRangeStartCell,o=n.columns[0],r=t.last(n.columns),s=n.endRow.rowIndex,l=n.endRow.rowPinned,a={column:i.column===o?r:o,rowIndex:s,rowPinned:l},c=this.cellNavigationService.getNextCellToFocus(e,a);if(c)return this.setCellRange({rowStartIndex:i.rowIndex,rowStartPinned:i.rowPinned,rowEndIndex:c.rowIndex,rowEndPinned:c.rowPinned,columnStart:i.column,columnEnd:c.column}),c}},l.prototype.setCellRange=function(e){this.gridOptionsWrapper.isEnableRangeSelection()&&(this.removeAllCellRanges(!0),this.addCellRange(e))},l.prototype.setCellRanges=function(e){var n=this;t.shallowCompare(this.cellRanges,e)||(this.removeAllCellRanges(!0),e.forEach((function(e){e.columns&&e.startRow&&(n.newestRangeStartCell={rowIndex:e.startRow.rowIndex,rowPinned:e.startRow.rowPinned,column:e.columns[0]}),n.cellRanges.push(e)})),this.dispatchChangedEvent(!1,!0))},l.prototype.createCellRangeFromCellRangeParams=function(e){var t,n=this;if(e.columns)t=e.columns.map((function(e){return n.columnModel.getColumnWithValidation(e)})).filter((function(e){return e}));else{var i=this.columnModel.getColumnWithValidation(e.columnStart),o=this.columnModel.getColumnWithValidation(e.columnEnd);if(!i||!o)return;t=this.calculateColumnsBetween(i,o)}if(t)return{startRow:null!=e.rowStartIndex?{rowIndex:e.rowStartIndex,rowPinned:e.rowStartPinned||null}:void 0,endRow:null!=e.rowEndIndex?{rowIndex:e.rowEndIndex,rowPinned:e.rowEndPinned||null}:void 0,columns:t,startColumn:t[0]}},l.prototype.addCellRange=function(e){if(this.gridOptionsWrapper.isEnableRangeSelection()){var t=this.createCellRangeFromCellRangeParams(e);t&&(this.cellRanges.push(t),this.dispatchChangedEvent(!1,!0,t.id))}},l.prototype.getCellRanges=function(){return this.cellRanges},l.prototype.isEmpty=function(){return 0===this.cellRanges.length},l.prototype.isMoreThanOneCell=function(){if(0===this.cellRanges.length)return!1;if(this.cellRanges.length>1)return!0;var e=this.cellRanges[0],t=this.getRangeStartRow(e),n=this.getRangeEndRow(e);return t.rowPinned!==n.rowPinned||t.rowIndex!==n.rowIndex||1!==e.columns.length},l.prototype.removeAllCellRanges=function(e){this.isEmpty()||(this.onDragStop(),this.cellRanges.length=0,e||this.dispatchChangedEvent(!1,!0))},l.prototype.onBodyScroll=function(){this.onDragging(this.lastMouseEvent)},l.prototype.isCellInAnyRange=function(e){return this.getCellRangeCount(e)>0},l.prototype.isCellInSpecificRange=function(e,n){var i=null!==n.columns&&t.includes(n.columns,e.column),o=this.isRowInRange(e.rowIndex,e.rowPinned,n);return i&&o},l.prototype.isLastCellOfRange=function(e,n){var i=e.startRow,o=e.endRow,r=this.rowPositionUtils.before(i,o)?o:i,s=n.rowIndex===r.rowIndex&&n.rowPinned===r.rowPinned,l=e.columns[0],a=t.last(e.columns),c=e.startColumn===l?a:l;return n.column===c&&s},l.prototype.isBottomRightCell=function(e,n){var i=this.columnModel.getAllDisplayedColumns(),o=e.columns.map((function(e){return i.indexOf(e)})).sort((function(e,t){return e-t})),r=e.startRow,s=e.endRow,l=this.rowPositionUtils.before(r,s)?s:r,a=i.indexOf(n.column)===t.last(o),c=n.rowIndex===l.rowIndex&&t.makeNull(n.rowPinned)===t.makeNull(l.rowPinned);return a&&c},l.prototype.getCellRangeCount=function(e){var t=this;return this.isEmpty()?0:this.cellRanges.filter((function(n){return t.isCellInSpecificRange(e,n)})).length},l.prototype.isRowInRange=function(e,t,n){var i=this.getRangeStartRow(n),o=this.getRangeEndRow(n),r={rowIndex:e,rowPinned:t||null},s=r.rowIndex===i.rowIndex&&r.rowPinned==i.rowPinned,l=r.rowIndex===o.rowIndex&&r.rowPinned==o.rowPinned;if(s||l)return!0;var a=!this.rowPositionUtils.before(r,i),c=this.rowPositionUtils.before(r,o);return a&&c},l.prototype.getDraggingRange=function(){return this.draggingRange},l.prototype.onDragStart=function(e){if(this.gridOptionsWrapper.isEnableRangeSelection()){var n=e.ctrlKey,i=e.metaKey,o=e.shiftKey,r=n||i,s=!!!this.gridOptionsWrapper.isSuppressMultiRangeSelection()&&r,l=this.mouseEventService.getCellPositionForEvent(e),a=o&&t.existsAndNotEmpty(this.cellRanges);if(!t.missing(l)){if(s||a&&!t.exists(t.last(this.cellRanges).type)||this.removeAllCellRanges(!0),this.dragging=!0,this.draggingCell=l,this.lastMouseEvent=e,a||(this.newestRangeStartCell=l),this.cellRanges.length>0)this.draggingRange=t.last(this.cellRanges);else{var c={rowIndex:l.rowIndex,rowPinned:l.rowPinned};this.draggingRange={startRow:c,endRow:c,columns:[l.column],startColumn:this.newestRangeStartCell.column},this.cellRanges.push(this.draggingRange)}this.ctrlsService.getGridBodyCtrl().addScrollEventListener(this.bodyScrollListener),this.dispatchChangedEvent(!0,!1,this.draggingRange.id)}}},l.prototype.onDragging=function(e){var t=this;if(this.dragging&&e){this.lastMouseEvent=e;var n=this.mouseEventService.getCellPositionForEvent(e),i=function(e){return n&&n.rowPinned===e&&t.newestRangeStartCell.rowPinned===e},o=i("top")||i("bottom");if(this.autoScrollService.check(e,o),n&&this.draggingCell&&!this.cellPositionUtils.equals(this.draggingCell,n)){var r=this.calculateColumnsBetween(this.newestRangeStartCell.column,n.column);r&&(this.draggingCell=n,this.draggingRange.endRow={rowIndex:n.rowIndex,rowPinned:n.rowPinned},this.draggingRange.columns=r,this.dispatchChangedEvent(!1,!1,this.draggingRange.id))}}},l.prototype.onDragStop=function(){if(this.dragging){var e=this.draggingRange.id;this.autoScrollService.ensureCleared(),this.ctrlsService.getGridBodyCtrl().removeScrollEventListener(this.bodyScrollListener),this.lastMouseEvent=null,this.dragging=!1,this.draggingRange=void 0,this.draggingCell=void 0,this.dispatchChangedEvent(!1,!0,e)}},l.prototype.dispatchChangedEvent=function(t,n,i){var o=Object.freeze({type:e.EVENT_RANGE_SELECTION_CHANGED,api:this.gridApi,columnApi:this.columnApi,started:t,finished:n,id:i});this.eventService.dispatchEvent(o)},l.prototype.calculateColumnsBetween=function(e,t){var n=this.columnModel.getAllDisplayedColumns(),i=e===t,o=n.indexOf(e);if(o<0)console.warn("AG Grid: column "+e.getId()+" is not visible");else{var r=i?o:n.indexOf(t);if(!(r<0)){if(i)return[e];for(var s=Math.min(o,r),l=s===o?r:o,a=[],c=s;c<=l;c++)a.push(n[c]);return a}console.warn("AG Grid: column "+t.getId()+" is not visible")}},p([i("loggerFactory")],l.prototype,"loggerFactory",void 0),p([i("rowModel")],l.prototype,"rowModel",void 0),p([i("columnModel")],l.prototype,"columnModel",void 0),p([i("mouseEventService")],l.prototype,"mouseEventService",void 0),p([i("columnApi")],l.prototype,"columnApi",void 0),p([i("gridApi")],l.prototype,"gridApi",void 0),p([i("cellNavigationService")],l.prototype,"cellNavigationService",void 0),p([i("pinnedRowModel")],l.prototype,"pinnedRowModel",void 0),p([i("rowPositionUtils")],l.prototype,"rowPositionUtils",void 0),p([i("cellPositionUtils")],l.prototype,"cellPositionUtils",void 0),p([i("ctrlsService")],l.prototype,"ctrlsService",void 0),p([o],l.prototype,"init",null),l=p([r("rangeService")],l)}(s),w=function(){function e(e,t){this.tickingInterval=null,this.gridBodyCtrl=e,this.gridOptionsWrapper=t}return e.prototype.check=function(e,t){void 0===t&&(t=!1);var i=this.gridBodyCtrl.getBodyClientRect();(t=t||this.gridOptionsWrapper.getDomLayout()!==n.DOM_LAYOUT_NORMAL)&&!this.gridBodyCtrl.getScrollFeature().isHorizontalScrollShowing()||(this.tickLeft=e.clientX<i.left+20,this.tickRight=e.clientX>i.right-20,this.tickUp=e.clientY<i.top+20&&!t,this.tickDown=e.clientY>i.bottom-20&&!t,this.tickLeft||this.tickRight||this.tickUp||this.tickDown?this.ensureTickingStarted():this.ensureCleared())},e.prototype.ensureTickingStarted=function(){null===this.tickingInterval&&(this.tickingInterval=window.setInterval(this.doTick.bind(this),100),this.tickCount=0)},e.prototype.doTick=function(){this.tickCount++;var e,t=this.gridBodyCtrl.getScrollFeature().getVScrollPosition(),n=this.gridBodyCtrl.getScrollFeature().getHScrollPosition();e=this.tickCount>20?200:this.tickCount>10?80:40,this.tickUp&&this.gridBodyCtrl.getScrollFeature().setVerticalScrollPosition(t.top-e),this.tickDown&&this.gridBodyCtrl.getScrollFeature().setVerticalScrollPosition(t.top+e),this.tickLeft&&this.gridBodyCtrl.getScrollFeature().setHorizontalScrollPosition(n.left-e),this.tickRight&&this.gridBodyCtrl.getScrollFeature().setHorizontalScrollPosition(n.left+e)},e.prototype.ensureCleared=function(){this.tickingInterval&&(window.clearInterval(this.tickingInterval),this.tickingInterval=null)},e}(),R=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),m=function(e,t,n,i){var o,r=arguments.length,s=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(s=(r<3?o(s):r>3?o(t,n,s):o(t,n))||s);return r>3&&s&&Object.defineProperty(t,n,s),s},C=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.changedCalculatedValues=!1,t.dragging=!1,t.shouldDestroyOnEndDragging=!1,t}return R(n,e),n.prototype.init=function(){var e=this;this.dragService.addDragSource({dragStartPixels:0,eElement:this.getGui(),onDragStart:this.onDragStart.bind(this),onDragging:function(t){e.dragging=!0,e.rangeService.autoScrollService.check(t),e.changedCalculatedValues&&(e.onDrag(t),e.changedCalculatedValues=!1)},onDragStop:function(n){e.dragging=!1,e.onDragEnd(n),e.clearValues(),e.rangeService.autoScrollService.ensureCleared(),t.removeCssClass(document.body,e.getDraggingCssClass()),e.shouldDestroyOnEndDragging&&e.destroy()}}),this.addManagedListener(this.getGui(),"mousedown",this.preventRangeExtension.bind(this))},n.prototype.isDragging=function(){return this.dragging},n.prototype.getCellCtrl=function(){return this.cellCtrl},n.prototype.setCellCtrl=function(e){this.cellCtrl=e},n.prototype.getCellRange=function(){return this.cellRange},n.prototype.setCellRange=function(e){this.cellRange=e},n.prototype.getRangeStartRow=function(){return this.rangeStartRow},n.prototype.setRangeStartRow=function(e){this.rangeStartRow=e},n.prototype.getRangeEndRow=function(){return this.rangeEndRow},n.prototype.setRangeEndRow=function(e){this.rangeEndRow=e},n.prototype.getLastCellHovered=function(){return this.lastCellHovered},n.prototype.preventRangeExtension=function(e){e.preventDefault(),e.stopPropagation()},n.prototype.onDragStart=function(e){this.cellHoverListener=this.addManagedListener(this.ctrlsService.getGridCtrl().getGui(),"mousemove",this.updateValuesOnMove.bind(this)),t.addCssClass(document.body,this.getDraggingCssClass())},n.prototype.getDraggingCssClass=function(){return"ag-dragging-"+(this.type===l.FILL?"fill":"range")+"-handle"},n.prototype.updateValuesOnMove=function(e){var t=this.mouseEventService.getCellPositionForEvent(e);t!==this.lastCellHovered&&(this.lastCellHovered=t,this.changedCalculatedValues=!0)},n.prototype.getType=function(){return this.type},n.prototype.refresh=function(e){var n=this,i=this.getCellCtrl(),o=this.getGui(),r=t.last(this.rangeService.getCellRanges()),s=r.startRow,l=r.endRow;s&&l&&(this.rowPositionUtils.before(l,s)?(this.setRangeStartRow(l),this.setRangeEndRow(s)):(this.setRangeStartRow(s),this.setRangeEndRow(l)));i===e&&t.isVisible(o)||(this.setCellCtrl(e),window.setTimeout((function(){n.isAlive()&&e.appendChild(o)}),1)),this.setCellRange(r)},n.prototype.clearValues=function(){this.lastCellHovered=void 0,this.removeListeners()},n.prototype.removeListeners=function(){this.cellHoverListener&&(this.cellHoverListener(),this.cellHoverListener=void 0)},n.prototype.destroy=function(){if(!this.shouldDestroyOnEndDragging&&this.isDragging())return t.setDisplayed(this.getGui(),!1),void(this.shouldDestroyOnEndDragging=!0);this.shouldDestroyOnEndDragging=!1,e.prototype.destroy.call(this),this.removeListeners();var n=this.getGui();n.parentElement&&n.parentElement.removeChild(n)},m([i("rowRenderer")],n.prototype,"rowRenderer",void 0),m([i("dragService")],n.prototype,"dragService",void 0),m([i("rangeService")],n.prototype,"rangeService",void 0),m([i("mouseEventService")],n.prototype,"mouseEventService",void 0),m([i("columnModel")],n.prototype,"columnModel",void 0),m([i("cellNavigationService")],n.prototype,"cellNavigationService",void 0),m([i("navigationService")],n.prototype,"navigationService",void 0),m([i("rowPositionUtils")],n.prototype,"rowPositionUtils",void 0),m([i("ctrlsService")],n.prototype,"ctrlsService",void 0),m([o],n.prototype,"init",null),n}(a),y=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),S=function(){return(S=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},P=function(e,t,n,i){var o,r=arguments.length,s=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(s=(r<3?o(s):r>3?o(t,n,s):o(t,n))||s);return r>3&&s&&Object.defineProperty(t,n,s),s},E=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var i=Array(e),o=0;for(t=0;t<n;t++)for(var r=arguments[t],s=0,l=r.length;s<l;s++,o++)i[o]=r[s];return i},O=function(n){function o(){var e=n.call(this,o.TEMPLATE)||this;return e.markedCells=[],e.cellValues=[],e.isUp=!1,e.isLeft=!1,e.isReduce=!1,e.type=l.FILL,e}return y(o,n),o.prototype.updateValuesOnMove=function(e){n.prototype.updateValuesOnMove.call(this,e),this.initialXY||(this.initialXY=this.mouseEventService.getNormalisedPosition(e));var t,i=this.initialXY,o=i.x,r=i.y,s=this.mouseEventService.getNormalisedPosition(e),l=s.x,a=s.y,c=Math.abs(o-l),g=Math.abs(r-a),d=this.gridOptionsWrapper.getFillHandleDirection();(t="xy"===d?c>g?"x":"y":d)!==this.dragAxis&&(this.dragAxis=t,this.changedCalculatedValues=!0)},o.prototype.onDrag=function(e){if(!this.initialPosition){var t=this.getCellCtrl();if(!t)return;this.initialPosition=t.getCellPosition()}var n=this.getLastCellHovered();n&&this.markPathFrom(this.initialPosition,n)},o.prototype.onDragEnd=function(e){if(this.initialXY=null,this.markedCells.length){var t,n="x"===this.dragAxis,i=this.getCellRange(),o=i.columns.length,r=this.getRangeStartRow(),s=this.getRangeEndRow();if(this.isUp||this.isLeft){var l=n?r:this.lastCellMarked;t=this.rangeService.createCellRangeFromCellRangeParams({rowStartIndex:l.rowIndex,rowStartPinned:l.rowPinned,columnStart:n?this.lastCellMarked.column:i.columns[0],rowEndIndex:s.rowIndex,rowEndPinned:s.rowPinned,columnEnd:i.columns[o-1]})}else t=this.rangeService.createCellRangeFromCellRangeParams({rowStartIndex:r.rowIndex,rowStartPinned:r.rowPinned,columnStart:i.columns[0],rowEndIndex:n?s.rowIndex:this.lastCellMarked.rowIndex,rowEndPinned:n?s.rowPinned:this.lastCellMarked.rowPinned,columnEnd:n?this.lastCellMarked.column:i.columns[o-1]});t&&(this.raiseFillStartEvent(),this.handleValueChanged(i,t,e),this.rangeService.setCellRanges([t]),this.raiseFillEndEvent(i,t))}},o.prototype.raiseFillStartEvent=function(){var t={type:e.EVENT_FILL_START,columnApi:this.gridOptionsWrapper.getColumnApi(),api:this.gridOptionsWrapper.getApi()};this.eventService.dispatchEvent(t)},o.prototype.raiseFillEndEvent=function(t,n){var i={type:e.EVENT_FILL_END,columnApi:this.gridOptionsWrapper.getColumnApi(),api:this.gridOptionsWrapper.getApi(),initialRange:t,finalRange:n};this.eventService.dispatchEvent(i)},o.prototype.handleValueChanged=function(e,n,i){var o=this,r=this.rangeService.getRangeEndRow(e),s=this.rangeService.getRangeStartRow(e),l=this.rangeService.getRangeEndRow(n),a=this.rangeService.getRangeStartRow(n),c="y"===this.dragAxis;if(!this.isReduce||this.gridOptionsWrapper.isSuppressClearOnFillReduction()){var g=!0,d=[],u=[],h=0,p=function(){d.length=0,u.length=0,h=0},f=function(n,i){var u=o.isUp?r:s,h=!1;c&&(g=!0,p());for(var f=function(){var f=o.rowPositionUtils.getRowNode(u);if(!f)return"break";c&&n?v(d,n,f,(function(){return!o.rowPositionUtils.sameRow(u,o.isUp?s:r)})):i&&(g=!0,p(),i.forEach((function(n){return v(d,n,f,(function(){return n!==(o.isLeft?e.columns[0]:t.last(e.columns))}))}))),h=o.rowPositionUtils.sameRow(u,o.isUp?a:l),u=o.isUp?o.cellNavigationService.getRowAbove(u):o.cellNavigationService.getRowBelow(u)};!h&&u;){if("break"===f())break}},v=function(e,t,n,r){var s;g?(s=o.valueService.getValue(t,n),u.push(s),g=r()):(s=o.processValues(i,e,u,t,n,h++),t.isCellEditable(n)&&n.setDataValue(t,s)),e.push(s)};if(c)e.columns.forEach((function(e){f(e)}));else{w=this.isLeft?E(n.columns).reverse():n.columns;f(void 0,w)}}else{var w=c?e.columns:e.columns.filter((function(e){return n.columns.indexOf(e)<0})),R=c?this.cellNavigationService.getRowBelow(l):a;R&&this.clearCellsInRange(R,r,w)}},o.prototype.clearCellsInRange=function(e,t,n){for(var i=this,o=e,r=!1,s=function(){var e=l.rowPositionUtils.getRowNode(o);if(!e)return"break";n.forEach((function(t){t.isCellEditable(e)&&i.valueService.setValue(e,t,null)})),r=l.rowPositionUtils.sameRow(o,t),o=l.cellNavigationService.getRowBelow(o)},l=this;!r&&o;){if("break"===s())break}},o.prototype.processValues=function(e,n,i,o,r,s){var l,a=this.gridOptionsWrapper.getFillOperation(),c="y"===this.dragAxis;if(l=c?this.isUp?"up":"down":this.isLeft?"left":"right",a){var g=a({event:e,values:n,initialValues:i,currentIndex:s,currentCellValue:this.valueService.getValue(o,r),api:this.gridOptionsWrapper.getApi(),columnApi:this.gridOptionsWrapper.getColumnApi(),context:this.gridOptionsWrapper.getContext(),direction:l,column:c?o:void 0,rowNode:c?void 0:r});if(!1!==g)return g}var d=!n.some((function(e){var t=parseFloat(e);return isNaN(t)||t.toString()!==e.toString()}));if(e.altKey||!d){if(d&&1===i.length){var u=this.isUp||this.isLeft?-1:1;return parseFloat(t.last(n))+1*u}return n[s%n.length]}return t.last(t.findLineByLeastSquares(n.map(Number)))},o.prototype.clearValues=function(){this.clearMarkedPath(),this.clearCellValues(),this.lastCellMarked=void 0,n.prototype.clearValues.call(this)},o.prototype.clearMarkedPath=function(){this.markedCells.forEach((function(e){var t=e.getComp();t.addOrRemoveCssClass("ag-selection-fill-top",!1),t.addOrRemoveCssClass("ag-selection-fill-right",!1),t.addOrRemoveCssClass("ag-selection-fill-bottom",!1),t.addOrRemoveCssClass("ag-selection-fill-left",!1)})),this.markedCells.length=0,this.isUp=!1,this.isLeft=!1,this.isReduce=!1},o.prototype.clearCellValues=function(){this.cellValues.length=0},o.prototype.markPathFrom=function(e,t){if(this.clearMarkedPath(),this.clearCellValues(),"y"===this.dragAxis){if(this.rowPositionUtils.sameRow(t,e))return;var n=this.rowPositionUtils.before(t,e),i=this.getRangeStartRow(),o=this.getRangeEndRow();n&&(t.rowPinned==i.rowPinned&&t.rowIndex>=i.rowIndex||i.rowPinned!=o.rowPinned&&t.rowPinned==o.rowPinned&&t.rowIndex<=o.rowIndex)?(this.reduceVertical(e,t),this.isReduce=!0):(this.extendVertical(e,t,n),this.isReduce=!1)}else{var r=e.column,s=t.column;if(r===s)return;var l=this.columnModel.getAllDisplayedColumns(),a=l.indexOf(r),c=l.indexOf(s);c<=a&&c>=l.indexOf(this.getCellRange().columns[0])?(this.reduceHorizontal(e,t),this.isReduce=!0):(this.extendHorizontal(e,t,c<a),this.isReduce=!1)}this.lastCellMarked=t},o.prototype.extendVertical=function(e,t,n){var i=this.navigationService,o=this.rangeService,r=e;do{for(var s=this.getCellRange(),l=s.columns.length,a=0;a<l;a++){var c=s.columns[a],g={rowIndex:r.rowIndex,rowPinned:r.rowPinned},d=S(S({},g),{column:c}),u=o.isCellInSpecificRange(d,s),h=this.rowPositionUtils.sameRow(r,e);if(n&&(this.isUp=!0),!h){var p=i.getCellByPosition(d);if(p){this.markedCells.push(p);var f=p.getComp();u||(f.addOrRemoveCssClass("ag-selection-fill-left",0===a),f.addOrRemoveCssClass("ag-selection-fill-right",a===l-1)),f.addOrRemoveCssClass(n?"ag-selection-fill-top":"ag-selection-fill-bottom",this.rowPositionUtils.sameRow(r,t))}}}if(this.rowPositionUtils.sameRow(r,t))break}while(r=n?this.cellNavigationService.getRowAbove(r):this.cellNavigationService.getRowBelow(r))},o.prototype.reduceVertical=function(e,t){var n=e;do{for(var i=this.getCellRange(),o=i.columns.length,r=this.rowPositionUtils.sameRow(n,t),s=0;s<o;s++){var l={rowIndex:n.rowIndex,rowPinned:n.rowPinned},a=S(S({},l),{column:i.columns[s]}),c=this.navigationService.getCellByPosition(a);if(c)this.markedCells.push(c),c.getComp().addOrRemoveCssClass("ag-selection-fill-bottom",this.rowPositionUtils.sameRow(n,t))}if(r)break}while(n=this.cellNavigationService.getRowAbove(n))},o.prototype.extendHorizontal=function(e,n,i){var o=this,r=this.columnModel.getAllDisplayedColumns(),s=r.indexOf(i?n.column:e.column),l=r.indexOf(i?this.getCellRange().columns[0]:n.column),a=i?0:1,c=r.slice(s+a,l+a),g=this.getRangeStartRow(),d=this.getRangeEndRow();c.forEach((function(e){var n=g,r=!1;do{r=o.rowPositionUtils.sameRow(n,d);var s=o.navigationService.getCellByPosition({rowIndex:n.rowIndex,rowPinned:n.rowPinned,column:e});if(s){o.markedCells.push(s);var l=s.getComp();l.addOrRemoveCssClass("ag-selection-fill-top",o.rowPositionUtils.sameRow(n,g)),l.addOrRemoveCssClass("ag-selection-fill-bottom",o.rowPositionUtils.sameRow(n,d)),i?(o.isLeft=!0,l.addOrRemoveCssClass("ag-selection-fill-left",e===c[0])):l.addOrRemoveCssClass("ag-selection-fill-right",e===t.last(c))}n=o.cellNavigationService.getRowBelow(n)}while(!r)}))},o.prototype.reduceHorizontal=function(e,t){var n=this,i=this.columnModel.getAllDisplayedColumns(),o=i.indexOf(t.column),r=i.indexOf(e.column),s=i.slice(o,r),l=this.getRangeStartRow(),a=this.getRangeEndRow();s.forEach((function(e){var t=l,i=!1;do{i=n.rowPositionUtils.sameRow(t,a);var o=n.navigationService.getCellByPosition({rowIndex:t.rowIndex,rowPinned:t.rowPinned,column:e});if(o)n.markedCells.push(o),o.getComp().addOrRemoveCssClass("ag-selection-fill-right",e===s[0]);t=n.cellNavigationService.getRowBelow(t)}while(!i)}))},o.prototype.refresh=function(e){var t=this.rangeService.getCellRanges()[0];t.startRow&&t.endRow?n.prototype.refresh.call(this,e):this.destroy()},o.TEMPLATE='<div class="ag-fill-handle"></div>',P([i("valueService")],o.prototype,"valueService",void 0),o}(C),x=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),I=function(){return(I=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},b=function(e){function n(){var t=e.call(this,n.TEMPLATE)||this;return t.type=l.RANGE,t.rangeFixed=!1,t}return x(n,e),n.prototype.onDrag=function(e){var n=this.getLastCellHovered();if(n){var i=this.rangeService.getCellRanges(),o=t.last(i);if(this.rangeFixed||(this.fixRangeStartEnd(o),this.rangeFixed=!0),this.endPosition={rowIndex:n.rowIndex,rowPinned:n.rowPinned,column:n.column},2===i.length&&i[0].type===c.DIMENSION&&o.type===c.VALUE)!this.rowPositionUtils.sameRow(this.endPosition,this.rangeService.getRangeEndRow(o))&&this.rangeService.updateRangeEnd(i[0],I(I({},this.endPosition),{column:i[0].columns[0]}),!0);this.rangeService.extendLatestRangeToCell(this.endPosition)}},n.prototype.onDragEnd=function(e){var n=t.last(this.rangeService.getCellRanges());this.fixRangeStartEnd(n),this.rangeFixed=!1},n.prototype.fixRangeStartEnd=function(e){var t=this.rangeService.getRangeStartRow(e),n=this.rangeService.getRangeEndRow(e),i=e.columns[0];e.startRow=t,e.endRow=n,e.startColumn=i},n.TEMPLATE='<div class="ag-range-handle"></div>',n}(C),L=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),M=function(e,t,n,i){var o,r=arguments.length,s=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(s=(r<3?o(s):r>3?o(t,n,s):o(t,n))||s);return r>3&&s&&Object.defineProperty(t,n,s),s},_=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return L(t,e),t.prototype.createSelectionHandle=function(e){return this.createBean(e===l.RANGE?new b:new O)},t=M([r("selectionHandleFactory")],t)}(s),A={moduleName:g.RangeSelectionModule,beans:[v,_],agStackComponents:[{componentName:"AgFillHandle",componentClass:O},{componentName:"AgRangeHandle",componentClass:b}],dependantModules:[d]};export{A as RangeSelectionModule};
import{Events as e,AutoScrollService as t,Constants as n,_ as o,Autowired as i,PostConstruct as r,Bean as s,BeanStub as l,SelectionHandleType as a,Component as c,CellRangeType as g,ModuleNames as d}from"@ag-grid-community/core";import{EnterpriseCoreModule as u}from"@ag-grid-enterprise/core";var h,p=(h=function(e,t){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}h(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),f=function(e,t,n,o){var i,r=arguments.length,s=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,o);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(s=(r<3?i(s):r>3?i(t,n,s):i(t,n))||s);return r>3&&s&&Object.defineProperty(t,n,s),s},v=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),i=0;for(t=0;t<n;t++)for(var r=arguments[t],s=0,l=r.length;s<l;s++,i++)o[i]=r[s];return o},w=function(l){function a(){var e=null!==l&&l.apply(this,arguments)||this;return e.cellRanges=[],e.bodyScrollListener=e.onBodyScroll.bind(e),e.dragging=!1,e}return p(a,l),a.prototype.init=function(){var o=this;this.addManagedListener(this.eventService,e.EVENT_NEW_COLUMNS_LOADED,(function(){return o.removeAllCellRanges()})),this.addManagedListener(this.eventService,e.EVENT_COLUMN_PIVOT_MODE_CHANGED,(function(){return o.removeAllCellRanges()})),this.addManagedListener(this.eventService,e.EVENT_COLUMN_ROW_GROUP_CHANGED,(function(){return o.removeAllCellRanges()})),this.addManagedListener(this.eventService,e.EVENT_COLUMN_PIVOT_CHANGED,(function(){return o.removeAllCellRanges()})),this.addManagedListener(this.eventService,e.EVENT_COLUMN_GROUP_OPENED,this.refreshLastRangeStart.bind(this)),this.addManagedListener(this.eventService,e.EVENT_COLUMN_MOVED,this.refreshLastRangeStart.bind(this)),this.addManagedListener(this.eventService,e.EVENT_COLUMN_PINNED,this.refreshLastRangeStart.bind(this)),this.addManagedListener(this.eventService,e.EVENT_COLUMN_VISIBLE,this.onColumnVisibleChange.bind(this)),this.ctrlsService.whenReady((function(){var e=o.ctrlsService.getGridBodyCtrl();o.autoScrollService=new t({scrollContainer:e.getBodyViewportElement(),scrollAxis:"xy",getVerticalPosition:function(){return e.getScrollFeature().getVScrollPosition().top},setVerticalPosition:function(t){return e.getScrollFeature().setVerticalScrollPosition(t)},getHorizontalPosition:function(){return e.getScrollFeature().getHScrollPosition().left},setHorizontalPosition:function(t){return e.getScrollFeature().setHorizontalScrollPosition(t)},shouldSkipVerticalScroll:function(){return o.gridOptionsWrapper.getDomLayout()!==n.DOM_LAYOUT_NORMAL},shouldSkipHorizontalScroll:function(){return e.getScrollFeature().isHorizontalScrollShowing()}})}))},a.prototype.onColumnVisibleChange=function(){var e=this;this.refreshLastRangeStart(),this.cellRanges.forEach((function(t){var n=t.columns;t.columns=t.columns.filter((function(e){return e.isVisible()})),!o.areEqual(n,t.columns)&&e.dispatchChangedEvent(!1,!0,t.id)}))},a.prototype.refreshLastRangeStart=function(){var e=o.last(this.cellRanges);e&&this.refreshRangeStart(e)},a.prototype.isContiguousRange=function(e){var t=e.columns;if(!t.length)return!1;var n=this.columnModel.getAllDisplayedColumns(),i=t.map((function(e){return n.indexOf(e)})).sort((function(e,t){return e-t}));return o.last(i)-i[0]+1===t.length},a.prototype.getRangeStartRow=function(e){return e.startRow&&e.endRow?this.rowPositionUtils.before(e.startRow,e.endRow)?e.startRow:e.endRow:{rowIndex:0,rowPinned:this.pinnedRowModel.getPinnedTopRowCount()>0?n.PINNED_TOP:null}},a.prototype.getRangeEndRow=function(e){if(e.startRow&&e.endRow)return this.rowPositionUtils.before(e.startRow,e.endRow)?e.endRow:e.startRow;var t=this.pinnedRowModel.getPinnedBottomRowCount();return t>0?{rowIndex:t-1,rowPinned:n.PINNED_BOTTOM}:{rowIndex:this.rowModel.getRowCount()-1,rowPinned:null}},a.prototype.setRangeToCell=function(e,t){if(void 0===t&&(t=!1),this.gridOptionsWrapper.isEnableRangeSelection()){var n=this.calculateColumnsBetween(e.column,e.column);if(n){(this.gridOptionsWrapper.isSuppressMultiRangeSelection()||!t||o.missing(this.cellRanges))&&this.removeAllCellRanges(!0);for(var i,r={rowIndex:e.rowIndex,rowPinned:e.rowPinned},s=0;s<this.cellRanges.length;s++){var l=this.cellRanges[s];if(l.columns&&1===l.columns.length&&l.columns[0]===e.column&&this.rowPositionUtils.sameRow(r,l.startRow)&&this.rowPositionUtils.sameRow(r,l.endRow)){i=l;break}}i?o.last(this.cellRanges)!==i&&(o.removeFromArray(this.cellRanges,i),this.cellRanges.push(i)):(i={startRow:r,endRow:r,columns:n,startColumn:e.column},this.cellRanges.push(i)),this.newestRangeStartCell=e,this.onDragStop(),this.dispatchChangedEvent(!0,!0,i.id)}}},a.prototype.extendLatestRangeToCell=function(e){if(!this.isEmpty()&&this.newestRangeStartCell){var t=o.last(this.cellRanges);this.updateRangeEnd(t,e)}},a.prototype.updateRangeEnd=function(e,t,n){void 0===n&&(n=!1);var o=t.column,i=this.calculateColumnsBetween(e.startColumn,o);i&&!this.isLastCellOfRange(e,t)&&(e.columns=i,e.endRow={rowIndex:t.rowIndex,rowPinned:t.rowPinned},n||this.dispatchChangedEvent(!0,!0,e.id))},a.prototype.refreshRangeStart=function(e){var t=e.startColumn,n=e.columns,i=function(t,n){var o=e.columns.filter((function(e){return e!==t}));t?(e.startColumn=t,e.columns=n?v([t],o):v(o,[t])):e.columns=o},r=this.getRangeEdgeColumns(e),s=r.left,l=r.right;t===n[0]&&t!==s?i(s,!0):t===o.last(n)&&t===l&&i(l,!1)},a.prototype.getRangeEdgeColumns=function(e){var t=this.columnModel.getAllDisplayedColumns(),n=e.columns.map((function(e){return t.indexOf(e)})).filter((function(e){return e>-1})).sort((function(e,t){return e-t}));return{left:t[n[0]],right:t[o.last(n)]}},a.prototype.extendLatestRangeInDirection=function(e){if(!this.isEmpty()&&this.newestRangeStartCell){var t=o.last(this.cellRanges),n=this.newestRangeStartCell,i=t.columns[0],r=o.last(t.columns),s=t.endRow.rowIndex,l=t.endRow.rowPinned,a={column:n.column===i?r:i,rowIndex:s,rowPinned:l},c=this.cellNavigationService.getNextCellToFocus(e,a);if(c)return this.setCellRange({rowStartIndex:n.rowIndex,rowStartPinned:n.rowPinned,rowEndIndex:c.rowIndex,rowEndPinned:c.rowPinned,columnStart:n.column,columnEnd:c.column}),c}},a.prototype.setCellRange=function(e){this.gridOptionsWrapper.isEnableRangeSelection()&&(this.removeAllCellRanges(!0),this.addCellRange(e))},a.prototype.setCellRanges=function(e){var t=this;o.shallowCompare(this.cellRanges,e)||(this.removeAllCellRanges(!0),e.forEach((function(e){e.columns&&e.startRow&&(t.newestRangeStartCell={rowIndex:e.startRow.rowIndex,rowPinned:e.startRow.rowPinned,column:e.columns[0]}),t.cellRanges.push(e)})),this.dispatchChangedEvent(!1,!0))},a.prototype.createCellRangeFromCellRangeParams=function(e){var t,n=this;if(e.columns)t=e.columns.map((function(e){return n.columnModel.getColumnWithValidation(e)})).filter((function(e){return e}));else{var o=this.columnModel.getColumnWithValidation(e.columnStart),i=this.columnModel.getColumnWithValidation(e.columnEnd);if(!o||!i)return;t=this.calculateColumnsBetween(o,i)}if(t)return{startRow:null!=e.rowStartIndex?{rowIndex:e.rowStartIndex,rowPinned:e.rowStartPinned||null}:void 0,endRow:null!=e.rowEndIndex?{rowIndex:e.rowEndIndex,rowPinned:e.rowEndPinned||null}:void 0,columns:t,startColumn:t[0]}},a.prototype.addCellRange=function(e){if(this.gridOptionsWrapper.isEnableRangeSelection()){var t=this.createCellRangeFromCellRangeParams(e);t&&(this.cellRanges.push(t),this.dispatchChangedEvent(!1,!0,t.id))}},a.prototype.getCellRanges=function(){return this.cellRanges},a.prototype.isEmpty=function(){return 0===this.cellRanges.length},a.prototype.isMoreThanOneCell=function(){if(0===this.cellRanges.length)return!1;if(this.cellRanges.length>1)return!0;var e=this.cellRanges[0],t=this.getRangeStartRow(e),n=this.getRangeEndRow(e);return t.rowPinned!==n.rowPinned||t.rowIndex!==n.rowIndex||1!==e.columns.length},a.prototype.removeAllCellRanges=function(e){this.isEmpty()||(this.onDragStop(),this.cellRanges.length=0,e||this.dispatchChangedEvent(!1,!0))},a.prototype.onBodyScroll=function(){this.onDragging(this.lastMouseEvent)},a.prototype.isCellInAnyRange=function(e){return this.getCellRangeCount(e)>0},a.prototype.isCellInSpecificRange=function(e,t){var n=null!==t.columns&&o.includes(t.columns,e.column),i=this.isRowInRange(e.rowIndex,e.rowPinned,t);return n&&i},a.prototype.isLastCellOfRange=function(e,t){var n=e.startRow,i=e.endRow,r=this.rowPositionUtils.before(n,i)?i:n,s=t.rowIndex===r.rowIndex&&t.rowPinned===r.rowPinned,l=e.columns[0],a=o.last(e.columns),c=e.startColumn===l?a:l;return t.column===c&&s},a.prototype.isBottomRightCell=function(e,t){var n=this.columnModel.getAllDisplayedColumns(),i=e.columns.map((function(e){return n.indexOf(e)})).sort((function(e,t){return e-t})),r=e.startRow,s=e.endRow,l=this.rowPositionUtils.before(r,s)?s:r,a=n.indexOf(t.column)===o.last(i),c=t.rowIndex===l.rowIndex&&o.makeNull(t.rowPinned)===o.makeNull(l.rowPinned);return a&&c},a.prototype.getCellRangeCount=function(e){var t=this;return this.isEmpty()?0:this.cellRanges.filter((function(n){return t.isCellInSpecificRange(e,n)})).length},a.prototype.isRowInRange=function(e,t,n){var o=this.getRangeStartRow(n),i=this.getRangeEndRow(n),r={rowIndex:e,rowPinned:t||null},s=r.rowIndex===o.rowIndex&&r.rowPinned==o.rowPinned,l=r.rowIndex===i.rowIndex&&r.rowPinned==i.rowPinned;if(s||l)return!0;var a=!this.rowPositionUtils.before(r,o),c=this.rowPositionUtils.before(r,i);return a&&c},a.prototype.getDraggingRange=function(){return this.draggingRange},a.prototype.onDragStart=function(e){if(this.gridOptionsWrapper.isEnableRangeSelection()){var t=e.ctrlKey,n=e.metaKey,i=e.shiftKey,r=t||n,s=!!!this.gridOptionsWrapper.isSuppressMultiRangeSelection()&&r,l=this.mouseEventService.getCellPositionForEvent(e),a=i&&o.existsAndNotEmpty(this.cellRanges);if(!o.missing(l)){if(s||a&&!o.exists(o.last(this.cellRanges).type)||this.removeAllCellRanges(!0),this.dragging=!0,this.draggingCell=l,this.lastMouseEvent=e,a||(this.newestRangeStartCell=l),this.cellRanges.length>0)this.draggingRange=o.last(this.cellRanges);else{var c={rowIndex:l.rowIndex,rowPinned:l.rowPinned};this.draggingRange={startRow:c,endRow:c,columns:[l.column],startColumn:this.newestRangeStartCell.column},this.cellRanges.push(this.draggingRange)}this.ctrlsService.getGridBodyCtrl().addScrollEventListener(this.bodyScrollListener),this.dispatchChangedEvent(!0,!1,this.draggingRange.id)}}},a.prototype.onDragging=function(e){var t=this;if(this.dragging&&e){this.lastMouseEvent=e;var n=this.mouseEventService.getCellPositionForEvent(e),o=function(e){return n&&n.rowPinned===e&&t.newestRangeStartCell.rowPinned===e},i=o("top")||o("bottom");if(this.autoScrollService.check(e,i),n&&this.draggingCell&&!this.cellPositionUtils.equals(this.draggingCell,n)){var r=this.calculateColumnsBetween(this.newestRangeStartCell.column,n.column);r&&(this.draggingCell=n,this.draggingRange.endRow={rowIndex:n.rowIndex,rowPinned:n.rowPinned},this.draggingRange.columns=r,this.dispatchChangedEvent(!1,!1,this.draggingRange.id))}}},a.prototype.onDragStop=function(){if(this.dragging){var e=this.draggingRange.id;this.autoScrollService.ensureCleared(),this.ctrlsService.getGridBodyCtrl().removeScrollEventListener(this.bodyScrollListener),this.lastMouseEvent=null,this.dragging=!1,this.draggingRange=void 0,this.draggingCell=void 0,this.dispatchChangedEvent(!1,!0,e)}},a.prototype.dispatchChangedEvent=function(t,n,o){var i=Object.freeze({type:e.EVENT_RANGE_SELECTION_CHANGED,api:this.gridApi,columnApi:this.columnApi,started:t,finished:n,id:o});this.eventService.dispatchEvent(i)},a.prototype.calculateColumnsBetween=function(e,t){var n=this.columnModel.getAllDisplayedColumns(),o=e===t,i=n.indexOf(e);if(i<0)console.warn("AG Grid: column "+e.getId()+" is not visible");else{var r=o?i:n.indexOf(t);if(!(r<0)){if(o)return[e];for(var s=Math.min(i,r),l=s===i?r:i,a=[],c=s;c<=l;c++)a.push(n[c]);return a}console.warn("AG Grid: column "+t.getId()+" is not visible")}},f([i("rowModel")],a.prototype,"rowModel",void 0),f([i("columnModel")],a.prototype,"columnModel",void 0),f([i("mouseEventService")],a.prototype,"mouseEventService",void 0),f([i("columnApi")],a.prototype,"columnApi",void 0),f([i("gridApi")],a.prototype,"gridApi",void 0),f([i("cellNavigationService")],a.prototype,"cellNavigationService",void 0),f([i("pinnedRowModel")],a.prototype,"pinnedRowModel",void 0),f([i("rowPositionUtils")],a.prototype,"rowPositionUtils",void 0),f([i("cellPositionUtils")],a.prototype,"cellPositionUtils",void 0),f([i("ctrlsService")],a.prototype,"ctrlsService",void 0),f([r],a.prototype,"init",null),a=f([s("rangeService")],a)}(l),R=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),m=function(e,t,n,o){var i,r=arguments.length,s=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,o);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(s=(r<3?i(s):r>3?i(t,n,s):i(t,n))||s);return r>3&&s&&Object.defineProperty(t,n,s),s},C=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.changedCalculatedValues=!1,t.dragging=!1,t.shouldDestroyOnEndDragging=!1,t}return R(t,e),t.prototype.init=function(){var e=this;this.dragService.addDragSource({dragStartPixels:0,eElement:this.getGui(),onDragStart:this.onDragStart.bind(this),onDragging:function(t){e.dragging=!0,e.rangeService.autoScrollService.check(t),e.changedCalculatedValues&&(e.onDrag(t),e.changedCalculatedValues=!1)},onDragStop:function(t){e.dragging=!1,e.onDragEnd(t),e.clearValues(),e.rangeService.autoScrollService.ensureCleared(),o.removeCssClass(document.body,e.getDraggingCssClass()),e.shouldDestroyOnEndDragging&&e.destroy()}}),this.addManagedListener(this.getGui(),"mousedown",this.preventRangeExtension.bind(this))},t.prototype.isDragging=function(){return this.dragging},t.prototype.getCellCtrl=function(){return this.cellCtrl},t.prototype.setCellCtrl=function(e){this.cellCtrl=e},t.prototype.getCellRange=function(){return this.cellRange},t.prototype.setCellRange=function(e){this.cellRange=e},t.prototype.getRangeStartRow=function(){return this.rangeStartRow},t.prototype.setRangeStartRow=function(e){this.rangeStartRow=e},t.prototype.getRangeEndRow=function(){return this.rangeEndRow},t.prototype.setRangeEndRow=function(e){this.rangeEndRow=e},t.prototype.getLastCellHovered=function(){return this.lastCellHovered},t.prototype.preventRangeExtension=function(e){e.preventDefault(),e.stopPropagation()},t.prototype.onDragStart=function(e){this.cellHoverListener=this.addManagedListener(this.ctrlsService.getGridCtrl().getGui(),"mousemove",this.updateValuesOnMove.bind(this)),o.addCssClass(document.body,this.getDraggingCssClass())},t.prototype.getDraggingCssClass=function(){return"ag-dragging-"+(this.type===a.FILL?"fill":"range")+"-handle"},t.prototype.updateValuesOnMove=function(e){var t=this.mouseEventService.getCellPositionForEvent(e);t!==this.lastCellHovered&&(this.lastCellHovered=t,this.changedCalculatedValues=!0)},t.prototype.getType=function(){return this.type},t.prototype.refresh=function(e){var t=this,n=this.getCellCtrl(),i=this.getGui(),r=o.last(this.rangeService.getCellRanges()),s=r.startRow,l=r.endRow;s&&l&&(this.rowPositionUtils.before(l,s)?(this.setRangeStartRow(l),this.setRangeEndRow(s)):(this.setRangeStartRow(s),this.setRangeEndRow(l)));n===e&&o.isVisible(i)||(this.setCellCtrl(e),window.setTimeout((function(){t.isAlive()&&e.appendChild(i)}),1)),this.setCellRange(r)},t.prototype.clearValues=function(){this.lastCellHovered=void 0,this.removeListeners()},t.prototype.removeListeners=function(){this.cellHoverListener&&(this.cellHoverListener(),this.cellHoverListener=void 0)},t.prototype.destroy=function(){if(!this.shouldDestroyOnEndDragging&&this.isDragging())return o.setDisplayed(this.getGui(),!1),void(this.shouldDestroyOnEndDragging=!0);this.shouldDestroyOnEndDragging=!1,e.prototype.destroy.call(this),this.removeListeners();var t=this.getGui();t.parentElement&&t.parentElement.removeChild(t)},m([i("rowRenderer")],t.prototype,"rowRenderer",void 0),m([i("dragService")],t.prototype,"dragService",void 0),m([i("rangeService")],t.prototype,"rangeService",void 0),m([i("mouseEventService")],t.prototype,"mouseEventService",void 0),m([i("columnModel")],t.prototype,"columnModel",void 0),m([i("cellNavigationService")],t.prototype,"cellNavigationService",void 0),m([i("navigationService")],t.prototype,"navigationService",void 0),m([i("rowPositionUtils")],t.prototype,"rowPositionUtils",void 0),m([i("ctrlsService")],t.prototype,"ctrlsService",void 0),m([r],t.prototype,"init",null),t}(c),y=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),S=function(){return(S=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},P=function(e,t,n,o){var i,r=arguments.length,s=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,o);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(s=(r<3?i(s):r>3?i(t,n,s):i(t,n))||s);return r>3&&s&&Object.defineProperty(t,n,s),s},E=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),i=0;for(t=0;t<n;t++)for(var r=arguments[t],s=0,l=r.length;s<l;s++,i++)o[i]=r[s];return o},O=function(t){function n(){var e=t.call(this,n.TEMPLATE)||this;return e.markedCells=[],e.cellValues=[],e.isUp=!1,e.isLeft=!1,e.isReduce=!1,e.type=a.FILL,e}return y(n,t),n.prototype.updateValuesOnMove=function(e){t.prototype.updateValuesOnMove.call(this,e),this.initialXY||(this.initialXY=this.mouseEventService.getNormalisedPosition(e));var n,o=this.initialXY,i=o.x,r=o.y,s=this.mouseEventService.getNormalisedPosition(e),l=s.x,a=s.y,c=Math.abs(i-l),g=Math.abs(r-a),d=this.gridOptionsWrapper.getFillHandleDirection();(n="xy"===d?c>g?"x":"y":d)!==this.dragAxis&&(this.dragAxis=n,this.changedCalculatedValues=!0)},n.prototype.onDrag=function(e){if(!this.initialPosition){var t=this.getCellCtrl();if(!t)return;this.initialPosition=t.getCellPosition()}var n=this.getLastCellHovered();n&&this.markPathFrom(this.initialPosition,n)},n.prototype.onDragEnd=function(e){if(this.initialXY=null,this.markedCells.length){var t,n="x"===this.dragAxis,o=this.getCellRange(),i=o.columns.length,r=this.getRangeStartRow(),s=this.getRangeEndRow();if(this.isUp||this.isLeft){var l=n?r:this.lastCellMarked;t=this.rangeService.createCellRangeFromCellRangeParams({rowStartIndex:l.rowIndex,rowStartPinned:l.rowPinned,columnStart:n?this.lastCellMarked.column:o.columns[0],rowEndIndex:s.rowIndex,rowEndPinned:s.rowPinned,columnEnd:o.columns[i-1]})}else t=this.rangeService.createCellRangeFromCellRangeParams({rowStartIndex:r.rowIndex,rowStartPinned:r.rowPinned,columnStart:o.columns[0],rowEndIndex:n?s.rowIndex:this.lastCellMarked.rowIndex,rowEndPinned:n?s.rowPinned:this.lastCellMarked.rowPinned,columnEnd:n?this.lastCellMarked.column:o.columns[i-1]});t&&(this.raiseFillStartEvent(),this.handleValueChanged(o,t,e),this.rangeService.setCellRanges([t]),this.raiseFillEndEvent(o,t))}},n.prototype.raiseFillStartEvent=function(){var t={type:e.EVENT_FILL_START,columnApi:this.gridOptionsWrapper.getColumnApi(),api:this.gridOptionsWrapper.getApi()};this.eventService.dispatchEvent(t)},n.prototype.raiseFillEndEvent=function(t,n){var o={type:e.EVENT_FILL_END,columnApi:this.gridOptionsWrapper.getColumnApi(),api:this.gridOptionsWrapper.getApi(),initialRange:t,finalRange:n};this.eventService.dispatchEvent(o)},n.prototype.handleValueChanged=function(e,t,n){var i=this,r=this.rangeService.getRangeEndRow(e),s=this.rangeService.getRangeStartRow(e),l=this.rangeService.getRangeEndRow(t),a=this.rangeService.getRangeStartRow(t),c="y"===this.dragAxis;if(!this.isReduce||this.gridOptionsWrapper.isSuppressClearOnFillReduction()){var g=!0,d=[],u=[],h=0,p=function(){d.length=0,u.length=0,h=0},f=function(t,n){var u=i.isUp?r:s,h=!1;c&&(g=!0,p());for(var f=function(){var f=i.rowPositionUtils.getRowNode(u);if(!f)return"break";c&&t?v(d,t,f,(function(){return!i.rowPositionUtils.sameRow(u,i.isUp?s:r)})):n&&(g=!0,p(),n.forEach((function(t){return v(d,t,f,(function(){return t!==(i.isLeft?e.columns[0]:o.last(e.columns))}))}))),h=i.rowPositionUtils.sameRow(u,i.isUp?a:l),u=i.isUp?i.cellNavigationService.getRowAbove(u):i.cellNavigationService.getRowBelow(u)};!h&&u;){if("break"===f())break}},v=function(e,t,o,r){var s,l=!1;g?(s=i.valueService.getValue(t,o),u.push(s),g=r()):(s=i.processValues(n,e,u,t,o,h++),t.isCellEditable(o)&&(i.valueService.getValue(t,o)!==s?o.setDataValue(t,s):l=!0));l||e.push(s)};if(c)e.columns.forEach((function(e){f(e)}));else{w=this.isLeft?E(t.columns).reverse():t.columns;f(void 0,w)}}else{var w=c?e.columns:e.columns.filter((function(e){return t.columns.indexOf(e)<0})),R=c?this.cellNavigationService.getRowBelow(l):a;R&&this.clearCellsInRange(R,r,w)}},n.prototype.clearCellsInRange=function(e,t,n){for(var o=e,i=!1,r=function(){var e=s.rowPositionUtils.getRowNode(o);if(!e)return"break";n.forEach((function(t){t.isCellEditable(e)&&e.setDataValue(t,null)})),i=s.rowPositionUtils.sameRow(o,t),o=s.cellNavigationService.getRowBelow(o)},s=this;!i&&o;){if("break"===r())break}},n.prototype.processValues=function(e,t,n,i,r,s){var l,a=this.gridOptionsWrapper.getFillOperation();if(l="y"===this.dragAxis?this.isUp?"up":"down":this.isLeft?"left":"right",a){var c=a({event:e,values:t,initialValues:n,currentIndex:s,currentCellValue:this.valueService.getValue(i,r),api:this.gridOptionsWrapper.getApi(),columnApi:this.gridOptionsWrapper.getColumnApi(),context:this.gridOptionsWrapper.getContext(),direction:l,column:i,rowNode:r});if(!1!==c)return c}var g=!t.some((function(e){var t=parseFloat(e);return isNaN(t)||t.toString()!==e.toString()}));if(e.altKey||!g){if(g&&1===n.length){var d=this.isUp||this.isLeft?-1:1;return parseFloat(o.last(t))+1*d}return t[s%t.length]}return o.last(o.findLineByLeastSquares(t.map(Number)))},n.prototype.clearValues=function(){this.clearMarkedPath(),this.clearCellValues(),this.lastCellMarked=void 0,t.prototype.clearValues.call(this)},n.prototype.clearMarkedPath=function(){this.markedCells.forEach((function(e){var t=e.getComp();t.addOrRemoveCssClass("ag-selection-fill-top",!1),t.addOrRemoveCssClass("ag-selection-fill-right",!1),t.addOrRemoveCssClass("ag-selection-fill-bottom",!1),t.addOrRemoveCssClass("ag-selection-fill-left",!1)})),this.markedCells.length=0,this.isUp=!1,this.isLeft=!1,this.isReduce=!1},n.prototype.clearCellValues=function(){this.cellValues.length=0},n.prototype.markPathFrom=function(e,t){if(this.clearMarkedPath(),this.clearCellValues(),"y"===this.dragAxis){if(this.rowPositionUtils.sameRow(t,e))return;var n=this.rowPositionUtils.before(t,e),o=this.getRangeStartRow(),i=this.getRangeEndRow();n&&(t.rowPinned==o.rowPinned&&t.rowIndex>=o.rowIndex||o.rowPinned!=i.rowPinned&&t.rowPinned==i.rowPinned&&t.rowIndex<=i.rowIndex)?(this.reduceVertical(e,t),this.isReduce=!0):(this.extendVertical(e,t,n),this.isReduce=!1)}else{var r=e.column,s=t.column;if(r===s)return;var l=this.columnModel.getAllDisplayedColumns(),a=l.indexOf(r),c=l.indexOf(s);c<=a&&c>=l.indexOf(this.getCellRange().columns[0])?(this.reduceHorizontal(e,t),this.isReduce=!0):(this.extendHorizontal(e,t,c<a),this.isReduce=!1)}this.lastCellMarked=t},n.prototype.extendVertical=function(e,t,n){var o=this.navigationService,i=this.rangeService,r=e;do{for(var s=this.getCellRange(),l=s.columns.length,a=0;a<l;a++){var c=s.columns[a],g={rowIndex:r.rowIndex,rowPinned:r.rowPinned},d=S(S({},g),{column:c}),u=i.isCellInSpecificRange(d,s),h=this.rowPositionUtils.sameRow(r,e);if(n&&(this.isUp=!0),!h){var p=o.getCellByPosition(d);if(p){this.markedCells.push(p);var f=p.getComp();u||(f.addOrRemoveCssClass("ag-selection-fill-left",0===a),f.addOrRemoveCssClass("ag-selection-fill-right",a===l-1)),f.addOrRemoveCssClass(n?"ag-selection-fill-top":"ag-selection-fill-bottom",this.rowPositionUtils.sameRow(r,t))}}}if(this.rowPositionUtils.sameRow(r,t))break}while(r=n?this.cellNavigationService.getRowAbove(r):this.cellNavigationService.getRowBelow(r))},n.prototype.reduceVertical=function(e,t){var n=e;do{for(var o=this.getCellRange(),i=o.columns.length,r=this.rowPositionUtils.sameRow(n,t),s=0;s<i;s++){var l={rowIndex:n.rowIndex,rowPinned:n.rowPinned},a=S(S({},l),{column:o.columns[s]}),c=this.navigationService.getCellByPosition(a);if(c)this.markedCells.push(c),c.getComp().addOrRemoveCssClass("ag-selection-fill-bottom",this.rowPositionUtils.sameRow(n,t))}if(r)break}while(n=this.cellNavigationService.getRowAbove(n))},n.prototype.extendHorizontal=function(e,t,n){var i=this,r=this.columnModel.getAllDisplayedColumns(),s=r.indexOf(n?t.column:e.column),l=r.indexOf(n?this.getCellRange().columns[0]:t.column),a=n?0:1,c=r.slice(s+a,l+a),g=this.getRangeStartRow(),d=this.getRangeEndRow();c.forEach((function(e){var t=g,r=!1;do{r=i.rowPositionUtils.sameRow(t,d);var s=i.navigationService.getCellByPosition({rowIndex:t.rowIndex,rowPinned:t.rowPinned,column:e});if(s){i.markedCells.push(s);var l=s.getComp();l.addOrRemoveCssClass("ag-selection-fill-top",i.rowPositionUtils.sameRow(t,g)),l.addOrRemoveCssClass("ag-selection-fill-bottom",i.rowPositionUtils.sameRow(t,d)),n?(i.isLeft=!0,l.addOrRemoveCssClass("ag-selection-fill-left",e===c[0])):l.addOrRemoveCssClass("ag-selection-fill-right",e===o.last(c))}t=i.cellNavigationService.getRowBelow(t)}while(!r)}))},n.prototype.reduceHorizontal=function(e,t){var n=this,o=this.columnModel.getAllDisplayedColumns(),i=o.indexOf(t.column),r=o.indexOf(e.column),s=o.slice(i,r),l=this.getRangeStartRow(),a=this.getRangeEndRow();s.forEach((function(e){var t=l,o=!1;do{o=n.rowPositionUtils.sameRow(t,a);var i=n.navigationService.getCellByPosition({rowIndex:t.rowIndex,rowPinned:t.rowPinned,column:e});if(i)n.markedCells.push(i),i.getComp().addOrRemoveCssClass("ag-selection-fill-right",e===s[0]);t=n.cellNavigationService.getRowBelow(t)}while(!o)}))},n.prototype.refresh=function(e){var n=this.rangeService.getCellRanges()[0];n.startRow&&n.endRow?t.prototype.refresh.call(this,e):this.destroy()},n.TEMPLATE='<div class="ag-fill-handle"></div>',P([i("valueService")],n.prototype,"valueService",void 0),n}(C),x=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),I=function(){return(I=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},b=function(e){function t(){var n=e.call(this,t.TEMPLATE)||this;return n.type=a.RANGE,n.rangeFixed=!1,n}return x(t,e),t.prototype.onDrag=function(e){var t=this.getLastCellHovered();if(t){var n=this.rangeService.getCellRanges(),i=o.last(n);if(this.rangeFixed||(this.fixRangeStartEnd(i),this.rangeFixed=!0),this.endPosition={rowIndex:t.rowIndex,rowPinned:t.rowPinned,column:t.column},2===n.length&&n[0].type===g.DIMENSION&&i.type===g.VALUE)!this.rowPositionUtils.sameRow(this.endPosition,this.rangeService.getRangeEndRow(i))&&this.rangeService.updateRangeEnd(n[0],I(I({},this.endPosition),{column:n[0].columns[0]}),!0);this.rangeService.extendLatestRangeToCell(this.endPosition)}},t.prototype.onDragEnd=function(e){var t=o.last(this.rangeService.getCellRanges());this.fixRangeStartEnd(t),this.rangeFixed=!1},t.prototype.fixRangeStartEnd=function(e){var t=this.rangeService.getRangeStartRow(e),n=this.rangeService.getRangeEndRow(e),o=e.columns[0];e.startRow=t,e.endRow=n,e.startColumn=o},t.TEMPLATE='<div class="ag-range-handle"></div>',t}(C),M=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),_=function(e,t,n,o){var i,r=arguments.length,s=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,o);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(s=(r<3?i(s):r>3?i(t,n,s):i(t,n))||s);return r>3&&s&&Object.defineProperty(t,n,s),s},A=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return M(t,e),t.prototype.createSelectionHandle=function(e){return this.createBean(e===a.RANGE?new b:new O)},t=_([s("selectionHandleFactory")],t)}(l),L={moduleName:d.RangeSelectionModule,beans:[w,A],agStackComponents:[{componentName:"AgFillHandle",componentClass:O},{componentName:"AgRangeHandle",componentClass:b}],dependantModules:[u]};export{L as RangeSelectionModule};
{
"name": "@ag-grid-enterprise/range-selection",
"version": "26.0.0",
"version": "26.1.0",
"description": "Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components",

@@ -45,4 +45,4 @@ "main": "./dist/cjs/main.js",

"dependencies": {
"@ag-grid-community/core": "~26.0.0",
"@ag-grid-enterprise/core": "~26.0.0"
"@ag-grid-community/core": "~26.1.0",
"@ag-grid-enterprise/core": "~26.1.0"
},

@@ -49,0 +49,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc