Socket
Socket
Sign inDemoInstall

@ag-grid-enterprise/range-selection

Package Overview
Dependencies
Maintainers
0
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ag-grid-enterprise/range-selection - npm Package Compare versions

Comparing version 32.1.0 to 32.2.0

81

dist/package/main.cjs.js

@@ -79,3 +79,3 @@ var __defProp = Object.defineProperty;

});
this.ctrlsService.whenReady((p) => {
this.ctrlsService.whenReady(this, (p) => {
const gridBodyCtrl = p.gridBodyCtrl;

@@ -89,3 +89,3 @@ this.autoScrollService = new import_core.AutoScrollService({

setHorizontalPosition: (position) => gridBodyCtrl.getScrollFeature().setHorizontalScrollPosition(position),
shouldSkipVerticalScroll: () => !this.gos.isDomLayout("normal"),
shouldSkipVerticalScroll: () => !(0, import_core._isDomLayout)(this.gos, "normal"),
shouldSkipHorizontalScroll: () => !gridBodyCtrl.getScrollFeature().isHorizontalScrollShowing()

@@ -156,3 +156,3 @@ });

setRangeToCell(cell, appendRange = false) {
if (!this.gos.get("enableRangeSelection")) {
if (!(0, import_core._isCellSelectionEnabled)(this.gos)) {
return;

@@ -164,3 +164,3 @@ }

}
const suppressMultiRangeSelections = this.gos.get("suppressMultiRangeSelection");
const suppressMultiRangeSelections = (0, import_core._getSuppressMultiRanges)(this.gos);
if (suppressMultiRangeSelections || !appendRange || (0, import_core._missing)(this.cellRanges)) {

@@ -264,3 +264,3 @@ this.removeAllCellRanges(true);

setCellRange(params) {
if (!this.gos.get("enableRangeSelection")) {
if (!(0, import_core._isCellSelectionEnabled)(this.gos)) {
return;

@@ -296,2 +296,6 @@ }

this.eventService.dispatchEvent({
type: "cellSelectionDeleteStart",
source: wrapperEventSource
});
this.eventService.dispatchEvent({
type: "rangeDeleteStart",

@@ -315,3 +319,3 @@ source: wrapperEventSource

}
const emptyValue = this.valueService.parseValue(column, rowNode, "", rowNode.getValueFromValueService(column)) ?? null;
const emptyValue = this.valueService.getDeleteValue(column, rowNode);
rowNode.setDataValue(column, emptyValue, cellEventSource);

@@ -323,2 +327,6 @@ }

this.eventService.dispatchEvent({
type: "cellSelectionDeleteEnd",
source: wrapperEventSource
});
this.eventService.dispatchEvent({
type: "rangeDeleteEnd",

@@ -368,5 +376,9 @@ source: wrapperEventSource

addCellRange(params) {
if (!this.gos.get("enableRangeSelection")) {
const gos = this.gos;
if (!(0, import_core._isCellSelectionEnabled)(gos)) {
return;
}
if ((0, import_core._isUsingNewSelectionAPI)(gos) && (0, import_core._getSuppressMultiRanges)(gos) && this.cellRanges.length > 0) {
return (0, import_core._warnOnce)("cannot add multiple ranges when `selection.suppressMultiRanges = true`");
}
const newRange = this.createCellRangeFromCellRangeParams(params);

@@ -516,3 +528,3 @@ if (newRange) {

onDragStart(mouseEvent) {
if (!this.gos.get("enableRangeSelection")) {
if (!(0, import_core._isCellSelectionEnabled)(this.gos)) {
return;

@@ -522,3 +534,3 @@ }

const isMultiKey = ctrlKey || metaKey;
const allowMulti = !this.gos.get("suppressMultiRangeSelection");
const allowMulti = !(0, import_core._getSuppressMultiRanges)(this.gos);
const isMultiSelect = allowMulti ? isMultiKey : false;

@@ -564,3 +576,3 @@ const extendRange = shiftKey && (0, import_core._existsAndNotEmpty)(this.cellRanges);

}
if (this.gos.get("suppressMultiRangeSelection")) {
if ((0, import_core._getSuppressMultiRanges)(this.gos)) {
return;

@@ -650,2 +662,6 @@ }

}
if (cellCtrl?.isEditing()) {
this.dragService.cancelDrag(eventTarget);
return;
}
if (this.lastCellHovered) {

@@ -702,2 +718,8 @@ this.cellHasChanged = true;

this.eventService.dispatchEvent({
type: "cellSelectionChanged",
started,
finished,
id
});
this.eventService.dispatchEvent({
type: "rangeSelectionChanged",

@@ -775,8 +797,11 @@ started,

this.onDragEnd(e);
this.clearValues();
this.rangeService.autoScrollService.ensureCleared();
document.body.classList.remove(this.getDraggingCssClass());
this.clearDragProperties();
if (this.shouldDestroyOnEndDragging) {
this.destroy();
}
},
onDragCancel: () => {
this.dragging = false;
this.onDragCancel();
this.clearDragProperties();
}

@@ -836,2 +861,7 @@ });

}
clearDragProperties() {
this.clearValues();
this.rangeService.autoScrollService.ensureCleared();
document.body.classList.remove(this.getDraggingCssClass());
}
getType() {

@@ -1031,4 +1061,11 @@ return this.type;

}
onDragCancel() {
this.initialXY = null;
if (!this.markedCells.length) {
return;
}
this.clearMarkedPath();
}
getFillHandleDirection() {
const direction = this.gos.get("fillHandleDirection");
const direction = (0, import_core3._getFillHandle)(this.gos)?.direction;
if (!direction) {

@@ -1049,3 +1086,3 @@ return "xy";

const isVertical = this.dragAxis === "y";
if (this.isReduce && !this.gos.get("suppressClearOnFillReduction")) {
if (this.isReduce && !(0, import_core3._getFillHandle)(this.gos)?.suppressClearOnFillReduction) {
const columns = isVertical ? initialRange.columns : initialRange.columns.filter((col) => finalRange.columns.indexOf(col) < 0);

@@ -1178,3 +1215,3 @@ const startRow = isVertical ? this.cellNavigationService.getRowBelow(finalRangeEndRow) : finalRangeStartRow;

const { event, values, initialValues, initialNonAggregatedValues, initialFormattedValues, col, rowNode, idx } = params;
const userFillOperation = this.gos.getCallback("fillOperation");
const userFillOperation = (0, import_core3._getFillHandle)(this.gos)?.setFillValue;
const isVertical = this.dragAxis === "y";

@@ -1188,3 +1225,3 @@ let direction;

if (userFillOperation) {
const params2 = {
const params2 = this.gos.addGridCommonParams({
event,

@@ -1200,3 +1237,3 @@ values: values.map(({ value }) => value),

rowNode
};
});
const userResult = userFillOperation(params2);

@@ -1477,2 +1514,5 @@ if (userResult !== false) {

}
onDragCancel() {
this.rangeFixed = false;
}
fixRangeStartEnd(cellRange) {

@@ -1500,3 +1540,3 @@ const startRow = this.rangeService.getRangeStartRow(cellRange);

// enterprise-modules/range-selection/src/version.ts
var VERSION = "32.1.0";
var VERSION = "32.2.0";

@@ -1516,3 +1556,4 @@ // enterprise-modules/range-selection/src/rangeSelectionModule.ts

addCellRange,
clearRangeSelection
clearRangeSelection,
clearCellSelection: clearRangeSelection
},

@@ -1519,0 +1560,0 @@ dependantModules: [RangeSelectionCoreModule]

@@ -1,1 +0,1 @@

var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(e,t)=>{for(var s in t)__defProp(e,s,{get:t[s],enumerable:!0})},__copyProps=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of __getOwnPropNames(t))!__hasOwnProp.call(e,i)&&i!==s&&__defProp(e,i,{get:()=>t[i],enumerable:!(n=__getOwnPropDesc(t,i))||n.enumerable});return e},__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),main_exports={};__export(main_exports,{RangeSelectionModule:()=>RangeSelectionModule}),module.exports=__toCommonJS(main_exports);var import_core6=require("@ag-grid-community/core"),import_core7=require("@ag-grid-enterprise/core");function getCellRanges(e){return e.rangeService?.getCellRanges()??null}function addCellRange(e,t){e.rangeService?.addCellRange(t)}function clearRangeSelection(e){e.rangeService?.removeAllCellRanges()}var import_core=require("@ag-grid-community/core"),RangeService=class extends import_core.BeanStub{constructor(){super(...arguments),this.beanName="rangeService",this.cellRanges=[],this.bodyScrollListener=this.onBodyScroll.bind(this),this.dragging=!1,this.intersectionRange=!1}wireBeans(e){this.rowModel=e.rowModel,this.dragService=e.dragService,this.columnModel=e.columnModel,this.visibleColsService=e.visibleColsService,this.cellNavigationService=e.cellNavigationService,this.pinnedRowModel=e.pinnedRowModel,this.rowPositionUtils=e.rowPositionUtils,this.cellPositionUtils=e.cellPositionUtils,this.ctrlsService=e.ctrlsService,this.valueService=e.valueService}postConstruct(){const e=this.onColumnsChanged.bind(this),t=()=>this.removeAllCellRanges(),s=this.refreshLastRangeStart.bind(this);this.addManagedEventListeners({newColumnsLoaded:e,columnVisible:e,columnValueChanged:e,columnPivotModeChanged:t,columnRowGroupChanged:t,columnPivotChanged:t,columnGroupOpened:s,columnMoved:s,columnPinned:s}),this.ctrlsService.whenReady(n=>{const i=n.gridBodyCtrl;this.autoScrollService=new import_core.AutoScrollService({scrollContainer:i.getBodyViewportElement(),scrollAxis:"xy",getVerticalPosition:()=>i.getScrollFeature().getVScrollPosition().top,setVerticalPosition:o=>i.getScrollFeature().setVerticalScrollPosition(o),getHorizontalPosition:()=>i.getScrollFeature().getHScrollPosition().left,setHorizontalPosition:o=>i.getScrollFeature().setHorizontalScrollPosition(o),shouldSkipVerticalScroll:()=>!this.gos.isDomLayout("normal"),shouldSkipHorizontalScroll:()=>!i.getScrollFeature().isHorizontalScrollShowing()})})}onColumnsChanged(){this.refreshLastRangeStart();const e=this.visibleColsService.getAllCols();this.cellRanges.forEach(s=>{const n=s.columns;s.columns=s.columns.filter(o=>o.isVisible()&&e.indexOf(o)!==-1),!(0,import_core._areEqual)(n,s.columns)&&this.dispatchChangedEvent(!1,!0,s.id)});const t=this.cellRanges.length;this.cellRanges=this.cellRanges.filter(s=>s.columns.length>0),t>this.cellRanges.length&&this.dispatchChangedEvent(!1,!0)}refreshLastRangeStart(){const e=(0,import_core._last)(this.cellRanges);e&&this.refreshRangeStart(e)}isContiguousRange(e){const t=e.columns;if(!t.length)return!1;const s=this.visibleColsService.getAllCols(),n=t.map(i=>s.indexOf(i)).sort((i,o)=>i-o);return(0,import_core._last)(n)-n[0]+1===t.length}getRangeStartRow(e){return e.startRow&&e.endRow?this.rowPositionUtils.before(e.startRow,e.endRow)?e.startRow:e.endRow:{rowIndex:0,rowPinned:this.pinnedRowModel.getPinnedTopRowCount()>0?"top":null}}getRangeEndRow(e){if(e.startRow&&e.endRow)return this.rowPositionUtils.before(e.startRow,e.endRow)?e.endRow:e.startRow;const t=this.pinnedRowModel.getPinnedBottomRowCount();return t>0?{rowIndex:t-1,rowPinned:"bottom"}:{rowIndex:this.rowModel.getRowCount()-1,rowPinned:null}}setRangeToCell(e,t=!1){if(!this.gos.get("enableRangeSelection"))return;const s=this.calculateColumnsBetween(e.column,e.column);if(!s)return;(this.gos.get("suppressMultiRangeSelection")||!t||(0,import_core._missing)(this.cellRanges))&&this.removeAllCellRanges(!0);const i={rowIndex:e.rowIndex,rowPinned:e.rowPinned},o={startRow:i,endRow:i,columns:s,startColumn:e.column};this.cellRanges.push(o),this.setNewestRangeStartCell(e),this.onDragStop(),this.dispatchChangedEvent(!0,!0)}extendLatestRangeToCell(e){if(this.isEmpty()||!this.newestRangeStartCell)return;const t=(0,import_core._last)(this.cellRanges);this.updateRangeEnd(t,e)}updateRangeEnd(e,t,s=!1){const n=t.column,i=this.calculateColumnsBetween(e.startColumn,n);!i||this.isLastCellOfRange(e,t)||(e.columns=i,e.endRow={rowIndex:t.rowIndex,rowPinned:t.rowPinned},s||this.dispatchChangedEvent(!0,!0,e.id))}refreshRangeStart(e){const{startColumn:t,columns:s}=e,n=(a,c)=>{const d=e.columns.filter(g=>g!==a);a?(e.startColumn=a,e.columns=c?[a,...d]:[...d,a]):e.columns=d},{left:i,right:o}=this.getRangeEdgeColumns(e);if(t===s[0]&&t!==i){n(i,!0);return}if(t===(0,import_core._last)(s)&&t===o){n(o,!1);return}}getRangeEdgeColumns(e){const t=this.visibleColsService.getAllCols(),s=e.columns.map(n=>t.indexOf(n)).filter(n=>n>-1).sort((n,i)=>n-i);return{left:t[s[0]],right:t[(0,import_core._last)(s)]}}extendLatestRangeInDirection(e){if(this.isEmpty()||!this.newestRangeStartCell)return;const t=e.key,s=e.ctrlKey||e.metaKey,n=(0,import_core._last)(this.cellRanges),i=this.newestRangeStartCell,o=n.columns[0],l=(0,import_core._last)(n.columns),r=n.endRow.rowIndex,a=n.endRow.rowPinned,d={column:i.column===o?l:o,rowIndex:r,rowPinned:a},g=this.cellNavigationService.getNextCellToFocus(t,d,s);if(g)return this.setCellRange({rowStartIndex:i.rowIndex,rowStartPinned:i.rowPinned,rowEndIndex:g.rowIndex,rowEndPinned:g.rowPinned,columnStart:i.column,columnEnd:g.column}),g}setCellRange(e){this.gos.get("enableRangeSelection")&&(this.removeAllCellRanges(!0),this.addCellRange(e))}setCellRanges(e){(0,import_core._shallowCompare)(this.cellRanges,e)||(this.removeAllCellRanges(!0),e.forEach(t=>{t.columns&&t.startRow&&this.setNewestRangeStartCell({rowIndex:t.startRow.rowIndex,rowPinned:t.startRow.rowPinned,column:t.columns[0]}),this.cellRanges.push(t)}),this.dispatchChangedEvent(!1,!0))}setNewestRangeStartCell(e){this.newestRangeStartCell=e}clearCellRangeCellValues(e){let{cellRanges:t}=e;const{cellEventSource:s="rangeService",dispatchWrapperEvents:n,wrapperEventSource:i="deleteKey"}=e;n&&this.eventService.dispatchEvent({type:"rangeDeleteStart",source:i}),t||(t=this.cellRanges),t.forEach(o=>{this.forEachRowInRange(o,l=>{const r=this.rowPositionUtils.getRowNode(l);if(r)for(let a=0;a<o.columns.length;a++){const c=this.columnModel.getCol(o.columns[a]);if(!c||!c.isCellEditable(r))continue;const d=this.valueService.parseValue(c,r,"",r.getValueFromValueService(c))??null;r.setDataValue(c,d,s)}})}),n&&this.eventService.dispatchEvent({type:"rangeDeleteEnd",source:i})}createCellRangeFromCellRangeParams(e){return this.createPartialCellRangeFromRangeParams(e,!1)}createPartialCellRangeFromRangeParams(e,t){let s,n=!1;if(e.columns)s=e.columns.map(l=>this.columnModel.getCol(l)).filter(l=>l);else{const l=this.columnModel.getCol(e.columnStart),r=this.columnModel.getCol(e.columnEnd);if(!l||!r)return;s=this.calculateColumnsBetween(l,r),s&&s.length&&(n=s[0]!==l)}if(!s||!t&&s.length===0)return;const i=e.rowStartIndex!=null?{rowIndex:e.rowStartIndex,rowPinned:e.rowStartPinned||null}:void 0,o=e.rowEndIndex!=null?{rowIndex:e.rowEndIndex,rowPinned:e.rowEndPinned||null}:void 0;return{startRow:i,endRow:o,columns:s,startColumn:n?(0,import_core._last)(s):s[0]}}addCellRange(e){if(!this.gos.get("enableRangeSelection"))return;const t=this.createCellRangeFromCellRangeParams(e);t&&(t.startRow&&this.setNewestRangeStartCell({rowIndex:t.startRow.rowIndex,rowPinned:t.startRow.rowPinned,column:t.startColumn}),this.cellRanges.push(t),this.dispatchChangedEvent(!1,!0,t.id))}getCellRanges(){return this.cellRanges}isEmpty(){return this.cellRanges.length===0}isMoreThanOneCell(){const e=this.cellRanges.length;if(e===0)return!1;if(e>1)return!0;const t=this.cellRanges[0],s=this.getRangeStartRow(t),n=this.getRangeEndRow(t);return s.rowPinned!==n.rowPinned||s.rowIndex!==n.rowIndex||t.columns.length!==1}areAllRangesAbleToMerge(){const e=new Map;if(this.cellRanges.length<=1)return!0;this.cellRanges.forEach(n=>{this.forEachRowInRange(n,i=>{const o=`${i.rowPinned||"normal"}_${i.rowIndex}`,l=e.get(o),r=n.columns.map(a=>a.getId());if(l){const a=r.filter(c=>l.indexOf(c)===-1);l.push(...a)}else e.set(o,r)})});let s;for(const n of e.values()){const i=n.sort().join();if(s===void 0){s=i;continue}if(s!==i)return!1}return!0}forEachRowInRange(e,t){const s=this.getRangeStartRow(e),n=this.getRangeEndRow(e);let i=s;for(;i&&(t(i),!this.rowPositionUtils.sameRow(i,n));)i=this.cellNavigationService.getRowBelow(i)}removeAllCellRanges(e){this.isEmpty()||(this.onDragStop(),this.cellRanges.length=0,e||this.dispatchChangedEvent(!1,!0))}onBodyScroll(){this.dragging&&this.lastMouseEvent&&this.onDragging(this.lastMouseEvent)}isCellInAnyRange(e){return this.getCellRangeCount(e)>0}isCellInSpecificRange(e,t){const s=t.columns!==null&&(0,import_core._includes)(t.columns,e.column),n=this.isRowInRange(e.rowIndex,e.rowPinned,t);return s&&n}isLastCellOfRange(e,t){const{startRow:s,endRow:n}=e,i=this.rowPositionUtils.before(s,n)?n:s,o=t.rowIndex===i.rowIndex&&t.rowPinned===i.rowPinned,l=e.columns[0],r=(0,import_core._last)(e.columns),a=e.startColumn===l?r:l;return t.column===a&&o}isBottomRightCell(e,t){const s=this.visibleColsService.getAllCols(),n=e.columns.map(c=>s.indexOf(c)).sort((c,d)=>c-d),{startRow:i,endRow:o}=e,l=this.rowPositionUtils.before(i,o)?o:i,r=s.indexOf(t.column)===(0,import_core._last)(n),a=t.rowIndex===l.rowIndex&&(0,import_core._makeNull)(t.rowPinned)===(0,import_core._makeNull)(l.rowPinned);return r&&a}getCellRangeCount(e){return this.isEmpty()?0:this.cellRanges.filter(t=>this.isCellInSpecificRange(e,t)).length}isRowInRange(e,t,s){const n=this.getRangeStartRow(s),i=this.getRangeEndRow(s),o={rowIndex:e,rowPinned:t||null},l=o.rowIndex===n.rowIndex&&o.rowPinned==n.rowPinned,r=o.rowIndex===i.rowIndex&&o.rowPinned==i.rowPinned;if(l||r)return!0;const a=!this.rowPositionUtils.before(o,n),c=this.rowPositionUtils.before(o,i);return a&&c}getDraggingRange(){return this.draggingRange}onDragStart(e){if(!this.gos.get("enableRangeSelection"))return;const{ctrlKey:t,metaKey:s,shiftKey:n}=e,i=t||s,l=!this.gos.get("suppressMultiRangeSelection")?i:!1,r=n&&(0,import_core._existsAndNotEmpty)(this.cellRanges);!l&&(!r||(0,import_core._exists)((0,import_core._last)(this.cellRanges).type))&&this.removeAllCellRanges(!0);const a=this.dragService.getStartTarget();if(a&&this.updateValuesOnMove(a),!!this.lastCellHovered){if(this.dragging=!0,this.lastMouseEvent=e,this.intersectionRange=l&&this.getCellRangeCount(this.lastCellHovered)>1,r||this.setNewestRangeStartCell(this.lastCellHovered),this.cellRanges.length>0)this.draggingRange=(0,import_core._last)(this.cellRanges);else{const c={rowIndex:this.lastCellHovered.rowIndex,rowPinned:this.lastCellHovered.rowPinned};this.draggingRange={startRow:c,endRow:c,columns:[this.lastCellHovered.column],startColumn:this.newestRangeStartCell.column},this.cellRanges.push(this.draggingRange)}this.ctrlsService.getGridBodyCtrl().addScrollEventListener(this.bodyScrollListener),this.dispatchChangedEvent(!0,!1,this.draggingRange.id)}}intersectLastRange(e){if(e&&this.dragging||this.gos.get("suppressMultiRangeSelection")||this.isEmpty())return;const t=this.rowPositionUtils,s=(0,import_core._last)(this.cellRanges),n=this.getRangeStartRow(s),i=this.getRangeEndRow(s),o=[];this.cellRanges.slice(0,-1).forEach(l=>{const r=this.getRangeStartRow(l),a=this.getRangeEndRow(l),c=l.columns,d=c.filter(h=>s.columns.indexOf(h)===-1);if(d.length===c.length){o.push(l);return}if(t.before(i,r)||t.before(a,n)){o.push(l);return}const g=o.length;if(t.before(r,n)){const h={columns:[...c],startColumn:s.startColumn,startRow:{...r},endRow:this.cellNavigationService.getRowAbove(n)};o.push(h)}if(d.length>0){const h={columns:d,startColumn:(0,import_core._includes)(d,s.startColumn)?s.startColumn:d[0],startRow:this.rowMax([{...n},{...r}]),endRow:this.rowMin([{...i},{...a}])};o.push(h)}t.before(i,a)&&o.push({columns:[...c],startColumn:s.startColumn,startRow:this.cellNavigationService.getRowBelow(i),endRow:{...a}}),o.length-g===1&&(o[o.length-1].id=l.id)}),this.cellRanges=o,e&&this.dispatchChangedEvent(!1,!0)}rowMax(e){let t;return e.forEach(s=>{(t===void 0||this.rowPositionUtils.before(t,s))&&(t=s)}),t}rowMin(e){let t;return e.forEach(s=>{(t===void 0||this.rowPositionUtils.before(s,t))&&(t=s)}),t}updateValuesOnMove(e){const s=(0,import_core._getCtrlForEventTarget)(this.gos,e,import_core.CellCtrl.DOM_DATA_KEY_CELL_CTRL)?.getCellPosition();this.cellHasChanged=!1,!(!s||this.lastCellHovered&&this.cellPositionUtils.equals(s,this.lastCellHovered))&&(this.lastCellHovered&&(this.cellHasChanged=!0),this.lastCellHovered=s)}onDragging(e){if(!this.dragging||!e)return;this.updateValuesOnMove(e.target),this.lastMouseEvent=e;const t=this.lastCellHovered,s=o=>t&&t.rowPinned===o&&this.newestRangeStartCell.rowPinned===o,n=s("top")||s("bottom");if(this.autoScrollService.check(e,n),!this.cellHasChanged)return;const i=this.calculateColumnsBetween(this.newestRangeStartCell.column,t.column);i&&(this.draggingRange.endRow={rowIndex:t.rowIndex,rowPinned:t.rowPinned},this.draggingRange.columns=i,this.dispatchChangedEvent(!1,!1,this.draggingRange.id))}onDragStop(){if(!this.dragging)return;const{id:e}=this.draggingRange;this.autoScrollService.ensureCleared(),this.ctrlsService.getGridBodyCtrl().removeScrollEventListener(this.bodyScrollListener),this.lastMouseEvent=null,this.dragging=!1,this.draggingRange=void 0,this.lastCellHovered=void 0,this.intersectionRange&&(this.intersectionRange=!1,this.intersectLastRange()),this.dispatchChangedEvent(!1,!0,e)}dispatchChangedEvent(e,t,s){this.eventService.dispatchEvent({type:"rangeSelectionChanged",started:e,finished:t,id:s})}calculateColumnsBetween(e,t){const s=this.visibleColsService.getAllCols(),n=e===t,i=s.indexOf(e),o=d=>(0,import_core._warnOnce)(`column ${d.getId()} is not visible`);if(i<0){o(e);return}const l=n?i:s.indexOf(t);if(l<0){o(t);return}if(n)return[e];const r=Math.min(i,l),a=r===i?l:i,c=[];for(let d=r;d<=a;d++)c.push(s[d]);return c}},import_core5=require("@ag-grid-community/core"),import_core3=require("@ag-grid-community/core"),import_core2=require("@ag-grid-community/core"),AbstractSelectionHandle=class extends import_core2.Component{constructor(){super(...arguments),this.changedCalculatedValues=!1,this.dragging=!1,this.shouldDestroyOnEndDragging=!1}wireBeans(e){this.dragService=e.dragService,this.rangeService=e.rangeService,this.mouseEventService=e.mouseEventService,this.rowPositionUtils=e.rowPositionUtils,this.cellPositionUtils=e.cellPositionUtils,this.ctrlsService=e.ctrlsService}postConstruct(){this.dragService.addDragSource({dragStartPixels:0,eElement:this.getGui(),onDragStart:this.onDragStart.bind(this),onDragging:e=>{this.dragging=!0,this.rangeService.autoScrollService.check(e),this.changedCalculatedValues&&(this.onDrag(e),this.changedCalculatedValues=!1)},onDragStop:e=>{this.dragging=!1,this.onDragEnd(e),this.clearValues(),this.rangeService.autoScrollService.ensureCleared(),document.body.classList.remove(this.getDraggingCssClass()),this.shouldDestroyOnEndDragging&&this.destroy()}}),this.addManagedElementListeners(this.getGui(),{mousedown:this.preventRangeExtension.bind(this)})}isDragging(){return this.dragging}getCellCtrl(){return this.cellCtrl}setCellCtrl(e){this.cellCtrl=e}getCellRange(){return this.cellRange}setCellRange(e){this.cellRange=e}getRangeStartRow(){return this.rangeStartRow}setRangeStartRow(e){this.rangeStartRow=e}getRangeEndRow(){return this.rangeEndRow}setRangeEndRow(e){this.rangeEndRow=e}getLastCellHovered(){return this.lastCellHovered}preventRangeExtension(e){e.stopPropagation()}onDragStart(e){[this.cellHoverListener]=this.addManagedElementListeners(this.ctrlsService.get("gridCtrl").getGui(),{mousemove:this.updateValuesOnMove.bind(this)}),document.body.classList.add(this.getDraggingCssClass())}getDraggingCssClass(){return`ag-dragging-${this.type===import_core2.SelectionHandleType.FILL?"fill":"range"}-handle`}updateValuesOnMove(e){const t=this.mouseEventService.getCellPositionForEvent(e);!t||this.lastCellHovered&&this.cellPositionUtils.equals(t,this.lastCellHovered)||(this.lastCellHovered=t,this.changedCalculatedValues=!0)}getType(){return this.type}refresh(e){const t=this.getCellCtrl(),s=this.getGui(),n=(0,import_core2._last)(this.rangeService.getCellRanges()),i=n.startRow,o=n.endRow;if(i&&o&&(this.rowPositionUtils.before(o,i)?(this.setRangeStartRow(o),this.setRangeEndRow(i)):(this.setRangeStartRow(i),this.setRangeEndRow(o))),t!==e||!(0,import_core2._isVisible)(s)){this.setCellCtrl(e);const l=e.getComp().getParentOfValue();l&&l.appendChild(s)}this.setCellRange(n)}clearValues(){this.lastCellHovered=void 0,this.removeListeners()}removeListeners(){this.cellHoverListener&&(this.cellHoverListener(),this.cellHoverListener=void 0)}destroy(){if(!this.shouldDestroyOnEndDragging&&this.isDragging()){(0,import_core2._setDisplayed)(this.getGui(),!1),this.shouldDestroyOnEndDragging=!0;return}this.shouldDestroyOnEndDragging=!1,super.destroy(),this.removeListeners();const e=this.getGui();e.parentElement&&e.parentElement.removeChild(e)}};function findLineByLeastSquares(e){const t=e.length;let s=0;if(t<=1)return e;for(let g=0;g<e.length;g++){const h=e[g],u=h.toString().split("e-");if(u.length>1){s=Math.max(s,parseInt(u[1],10));continue}Math.floor(h)!==h&&(s=Math.max(s,h.toString().split(".")[1].length))}let n=0,i=0,o=0,l=0,r=0;for(let g=0;g<t;g++)r=e[g],n+=g,i+=r,l+=g*g,o+=g*r;const a=(t*o-n*i)/(t*l-n*n),c=i/t-a*n/t,d=[];for(let g=0;g<=t;g++)d.push(parseFloat((g*a+c).toFixed(s)));return d}var AgFillHandle=class extends AbstractSelectionHandle{constructor(){super('<div class="ag-fill-handle"></div>'),this.markedCells=[],this.cellValues=[],this.isUp=!1,this.isLeft=!1,this.isReduce=!1,this.type=import_core3.SelectionHandleType.FILL}wireBeans(e){super.wireBeans(e),this.valueService=e.valueService,this.navigationService=e.navigationService,this.cellNavigationService=e.cellNavigationService,this.visibleColsService=e.visibleColsService}updateValuesOnMove(e){super.updateValuesOnMove(e),this.initialXY||(this.initialXY=this.mouseEventService.getNormalisedPosition(e));const{x:t,y:s}=this.initialXY,{x:n,y:i}=this.mouseEventService.getNormalisedPosition(e),o=Math.abs(t-n),l=Math.abs(s-i),r=this.getFillHandleDirection();let a;r==="xy"?a=o>l?"x":"y":a=r,a!==this.dragAxis&&(this.dragAxis=a,this.changedCalculatedValues=!0)}onDrag(e){if(!this.initialPosition){const s=this.getCellCtrl();if(!s)return;this.initialPosition=s.getCellPosition()}const t=this.getLastCellHovered();t&&this.markPathFrom(this.initialPosition,t)}onDragEnd(e){if(this.initialXY=null,!this.markedCells.length)return;const t=this.dragAxis==="x",s=this.getCellRange(),n=s.columns.length,i=this.getRangeStartRow(),o=this.getRangeEndRow();let l;if(!this.isUp&&!this.isLeft)l=this.rangeService.createCellRangeFromCellRangeParams({rowStartIndex:i.rowIndex,rowStartPinned:i.rowPinned,columnStart:s.columns[0],rowEndIndex:t?o.rowIndex:this.lastCellMarked.rowIndex,rowEndPinned:t?o.rowPinned:this.lastCellMarked.rowPinned,columnEnd:t?this.lastCellMarked.column:s.columns[n-1]});else{const r=t?i:this.lastCellMarked;l=this.rangeService.createCellRangeFromCellRangeParams({rowStartIndex:r.rowIndex,rowStartPinned:r.rowPinned,columnStart:t?this.lastCellMarked.column:s.columns[0],rowEndIndex:o.rowIndex,rowEndPinned:o.rowPinned,columnEnd:s.columns[n-1]})}l&&(this.eventService.dispatchEvent({type:"fillStart"}),this.handleValueChanged(s,l,e),this.rangeService.setCellRanges([l]),this.eventService.dispatchEvent({type:"fillEnd",initialRange:s,finalRange:l}))}getFillHandleDirection(){const e=this.gos.get("fillHandleDirection");return e?e!=="x"&&e!=="y"&&e!=="xy"?((0,import_core3._warnOnce)("valid values for fillHandleDirection are 'x', 'y' and 'xy'. Default to 'xy'."),"xy"):e:"xy"}handleValueChanged(e,t,s){const n=this.rangeService.getRangeEndRow(e),i=this.rangeService.getRangeStartRow(e),o=this.rangeService.getRangeEndRow(t),l=this.rangeService.getRangeStartRow(t),r=this.dragAxis==="y";if(this.isReduce&&!this.gos.get("suppressClearOnFillReduction")){const m=r?e.columns:e.columns.filter(R=>t.columns.indexOf(R)<0),f=r?this.cellNavigationService.getRowBelow(o):l;f&&this.clearCellsInRange(f,n,m);return}const a=[],c=[],d=[],g=[];let h=!0,u=0;const w=()=>{a.length=0,c.length=0,d.length=0,g.length=0,u=0},v=(m,f)=>{let R=this.isUp?n:i,x=!1;for(r&&(h=!0,w());!x&&R;){const C=this.rowPositionUtils.getRowNode(R);if(!C)break;r&&m?p(a,m,C,()=>!this.rowPositionUtils.sameRow(R,this.isUp?i:n)):f&&(h=!0,w(),f.forEach(S=>p(a,S,C,()=>S!==(this.isLeft?e.columns[0]:(0,import_core3._last)(e.columns))))),x=this.rowPositionUtils.sameRow(R,this.isUp?l:o),R=this.isUp?this.cellNavigationService.getRowAbove(R):this.cellNavigationService.getRowBelow(R)}},p=(m,f,R,x)=>{let C,S=!1;if(h)C=this.valueService.getValue(f,R),c.push(C),d.push(this.valueService.getValue(f,R,void 0,!0)),g.push(this.valueService.formatValue(f,R,C)),h=x();else{const{value:I,fromUserFunction:E,sourceCol:P,sourceRowNode:M}=this.processValues({event:s,values:m,initialValues:c,initialNonAggregatedValues:d,initialFormattedValues:g,col:f,rowNode:R,idx:u++});if(C=I,f.isCellEditable(R)){const y=this.valueService.getValue(f,R);E||(P&&P.getColDef()?.useValueFormatterForExport!==!1&&(C=this.valueService.formatValue(P,M,C)??C),f.getColDef().useValueParserForImport!==!1&&(C=this.valueService.parseValue(f,R,P?C:(0,import_core3._toStringOrNull)(C),y))),!E||y!==C?R.setDataValue(f,C,"rangeService"):S=!0}}S||m.push({value:C,column:f,rowNode:R})};if(r)e.columns.forEach(m=>{v(m)});else{const m=this.isLeft?[...t.columns].reverse():t.columns;v(void 0,m)}}clearCellsInRange(e,t,s){const n={startRow:e,endRow:t,columns:s,startColumn:s[0]};this.rangeService.clearCellRangeCellValues({cellRanges:[n]})}processValues(e){const{event:t,values:s,initialValues:n,initialNonAggregatedValues:i,initialFormattedValues:o,col:l,rowNode:r,idx:a}=e,c=this.gos.getCallback("fillOperation"),d=this.dragAxis==="y";let g;if(d?g=this.isUp?"up":"down":g=this.isLeft?"left":"right",c){const u={event:t,values:s.map(({value:v})=>v),initialValues:n,initialNonAggregatedValues:i,initialFormattedValues:o,currentIndex:a,currentCellValue:this.valueService.getValue(l,r),direction:g,column:l,rowNode:r},w=c(u);if(w!==!1)return{value:w,fromUserFunction:!0}}const h=!s.some(({value:u})=>{const w=parseFloat(u);return isNaN(w)||w.toString()!==u.toString()});if(t.altKey||!h){if(h&&n.length===1){const p=this.isUp||this.isLeft?-1:1;return{value:parseFloat((0,import_core3._last)(s).value)+1*p,fromUserFunction:!1}}const{value:u,column:w,rowNode:v}=s[a%s.length];return{value:u,fromUserFunction:!1,sourceCol:w,sourceRowNode:v}}return{value:(0,import_core3._last)(findLineByLeastSquares(s.map(({value:u})=>Number(u)))),fromUserFunction:!1}}clearValues(){this.clearMarkedPath(),this.clearCellValues(),this.lastCellMarked=void 0,super.clearValues()}clearMarkedPath(){this.markedCells.forEach(e=>{if(!e.isAlive())return;const 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}clearCellValues(){this.cellValues.length=0}markPathFrom(e,t){if(this.clearMarkedPath(),this.clearCellValues(),this.dragAxis==="y"){if(this.rowPositionUtils.sameRow(t,e))return;const s=this.rowPositionUtils.before(t,e),n=this.getRangeStartRow(),i=this.getRangeEndRow();s&&(t.rowPinned==n.rowPinned&&t.rowIndex>=n.rowIndex||n.rowPinned!=i.rowPinned&&t.rowPinned==i.rowPinned&&t.rowIndex<=i.rowIndex)?(this.reduceVertical(e,t),this.isReduce=!0):(this.extendVertical(e,t,s),this.isReduce=!1)}else{const s=e.column,n=t.column;if(s===n)return;const i=this.visibleColsService.getAllCols(),o=i.indexOf(s),l=i.indexOf(n);l<=o&&l>=i.indexOf(this.getCellRange().columns[0])?(this.reduceHorizontal(e,t),this.isReduce=!0):(this.extendHorizontal(e,t,l<o),this.isReduce=!1)}this.lastCellMarked=t}extendVertical(e,t,s){const{navigationService:n,rangeService:i}=this;let o=e;do{const l=this.getCellRange(),r=l.columns.length;for(let a=0;a<r;a++){const c=l.columns[a],g={...{rowIndex:o.rowIndex,rowPinned:o.rowPinned},column:c},h=i.isCellInSpecificRange(g,l),u=this.rowPositionUtils.sameRow(o,e);if(s&&(this.isUp=!0),!u){const w=n.getCellByPosition(g);if(w){this.markedCells.push(w);const v=w.getComp();h||(v.addOrRemoveCssClass("ag-selection-fill-left",a===0),v.addOrRemoveCssClass("ag-selection-fill-right",a===r-1)),v.addOrRemoveCssClass(s?"ag-selection-fill-top":"ag-selection-fill-bottom",this.rowPositionUtils.sameRow(o,t))}}}if(this.rowPositionUtils.sameRow(o,t))break}while(o=s?this.cellNavigationService.getRowAbove(o):this.cellNavigationService.getRowBelow(o))}reduceVertical(e,t){let s=e;do{const n=this.getCellRange(),i=n.columns.length,o=this.rowPositionUtils.sameRow(s,t);for(let l=0;l<i;l++){const a={...{rowIndex:s.rowIndex,rowPinned:s.rowPinned},column:n.columns[l]},c=this.navigationService.getCellByPosition(a);c&&(this.markedCells.push(c),c.getComp().addOrRemoveCssClass("ag-selection-fill-bottom",this.rowPositionUtils.sameRow(s,t)))}if(o)break}while(s=this.cellNavigationService.getRowAbove(s))}extendHorizontal(e,t,s){const n=this.visibleColsService.getAllCols(),i=n.indexOf(s?t.column:e.column),o=n.indexOf(s?this.getCellRange().columns[0]:t.column),l=s?0:1,r=n.slice(i+l,o+l),a=this.getRangeStartRow(),c=this.getRangeEndRow();r.forEach(d=>{let g=a,h=!1;do{h=this.rowPositionUtils.sameRow(g,c);const u=this.navigationService.getCellByPosition({rowIndex:g.rowIndex,rowPinned:g.rowPinned,column:d});if(u){this.markedCells.push(u);const w=u.getComp();w.addOrRemoveCssClass("ag-selection-fill-top",this.rowPositionUtils.sameRow(g,a)),w.addOrRemoveCssClass("ag-selection-fill-bottom",this.rowPositionUtils.sameRow(g,c)),s?(this.isLeft=!0,w.addOrRemoveCssClass("ag-selection-fill-left",d===r[0])):w.addOrRemoveCssClass("ag-selection-fill-right",d===(0,import_core3._last)(r))}g=this.cellNavigationService.getRowBelow(g)}while(!h)})}reduceHorizontal(e,t){const s=this.visibleColsService.getAllCols(),n=s.indexOf(t.column),i=s.indexOf(e.column),o=s.slice(n,i),l=this.getRangeStartRow(),r=this.getRangeEndRow();o.forEach(a=>{let c=l,d=!1;do{d=this.rowPositionUtils.sameRow(c,r);const g=this.navigationService.getCellByPosition({rowIndex:c.rowIndex,rowPinned:c.rowPinned,column:a});g&&(this.markedCells.push(g),g.getComp().addOrRemoveCssClass("ag-selection-fill-right",a===o[0])),c=this.cellNavigationService.getRowBelow(c)}while(!d)})}refresh(e){const t=this.rangeService.getCellRanges()[0];if(!t.startRow||!t.endRow){this.destroy();return}super.refresh(e)}},import_core4=require("@ag-grid-community/core"),AgRangeHandle=class extends AbstractSelectionHandle{constructor(){super('<div class="ag-range-handle"></div>'),this.type=import_core4.SelectionHandleType.RANGE,this.rangeFixed=!1}onDrag(e){const t=this.getLastCellHovered();if(!t)return;const s=this.rangeService.getCellRanges(),n=(0,import_core4._last)(s);this.rangeFixed||(this.fixRangeStartEnd(n),this.rangeFixed=!0),this.endPosition={rowIndex:t.rowIndex,rowPinned:t.rowPinned,column:t.column},s.length===2&&s[0].type===import_core4.CellRangeType.DIMENSION&&n.type===import_core4.CellRangeType.VALUE&&!this.rowPositionUtils.sameRow(this.endPosition,this.rangeService.getRangeEndRow(n))&&this.rangeService.updateRangeEnd(s[0],{...this.endPosition,column:s[0].columns[0]},!0),this.rangeService.extendLatestRangeToCell(this.endPosition)}onDragEnd(e){const t=(0,import_core4._last)(this.rangeService.getCellRanges());this.fixRangeStartEnd(t),this.rangeFixed=!1}fixRangeStartEnd(e){const t=this.rangeService.getRangeStartRow(e),s=this.rangeService.getRangeEndRow(e),n=e.columns[0];e.startRow=t,e.endRow=s,e.startColumn=n}},SelectionHandleFactory=class extends import_core5.BeanStub{constructor(){super(...arguments),this.beanName="selectionHandleFactory"}createSelectionHandle(e){return this.createBean(e===import_core5.SelectionHandleType.RANGE?new AgRangeHandle:new AgFillHandle)}},VERSION="32.1.0",RangeSelectionCoreModule=(0,import_core6._defineModule)({version:VERSION,moduleName:`${import_core6.ModuleNames.RangeSelectionModule}-core`,beans:[RangeService,SelectionHandleFactory],dependantModules:[import_core7.EnterpriseCoreModule]}),RangeSelectionApiModule=(0,import_core6._defineModule)({version:VERSION,moduleName:`${import_core6.ModuleNames.RangeSelectionModule}-api`,apiFunctions:{getCellRanges,addCellRange,clearRangeSelection},dependantModules:[RangeSelectionCoreModule]}),RangeSelectionModule=(0,import_core6._defineModule)({version:VERSION,moduleName:import_core6.ModuleNames.RangeSelectionModule,dependantModules:[RangeSelectionCoreModule,RangeSelectionApiModule]});
var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(e,t)=>{for(var s in t)__defProp(e,s,{get:t[s],enumerable:!0})},__copyProps=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of __getOwnPropNames(t))!__hasOwnProp.call(e,n)&&n!==s&&__defProp(e,n,{get:()=>t[n],enumerable:!(i=__getOwnPropDesc(t,n))||i.enumerable});return e},__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),main_exports={};__export(main_exports,{RangeSelectionModule:()=>RangeSelectionModule}),module.exports=__toCommonJS(main_exports);var import_core6=require("@ag-grid-community/core"),import_core7=require("@ag-grid-enterprise/core");function getCellRanges(e){return e.rangeService?.getCellRanges()??null}function addCellRange(e,t){e.rangeService?.addCellRange(t)}function clearRangeSelection(e){e.rangeService?.removeAllCellRanges()}var import_core=require("@ag-grid-community/core"),RangeService=class extends import_core.BeanStub{constructor(){super(...arguments),this.beanName="rangeService",this.cellRanges=[],this.bodyScrollListener=this.onBodyScroll.bind(this),this.dragging=!1,this.intersectionRange=!1}wireBeans(e){this.rowModel=e.rowModel,this.dragService=e.dragService,this.columnModel=e.columnModel,this.visibleColsService=e.visibleColsService,this.cellNavigationService=e.cellNavigationService,this.pinnedRowModel=e.pinnedRowModel,this.rowPositionUtils=e.rowPositionUtils,this.cellPositionUtils=e.cellPositionUtils,this.ctrlsService=e.ctrlsService,this.valueService=e.valueService}postConstruct(){const e=this.onColumnsChanged.bind(this),t=()=>this.removeAllCellRanges(),s=this.refreshLastRangeStart.bind(this);this.addManagedEventListeners({newColumnsLoaded:e,columnVisible:e,columnValueChanged:e,columnPivotModeChanged:t,columnRowGroupChanged:t,columnPivotChanged:t,columnGroupOpened:s,columnMoved:s,columnPinned:s}),this.ctrlsService.whenReady(this,i=>{const n=i.gridBodyCtrl;this.autoScrollService=new import_core.AutoScrollService({scrollContainer:n.getBodyViewportElement(),scrollAxis:"xy",getVerticalPosition:()=>n.getScrollFeature().getVScrollPosition().top,setVerticalPosition:o=>n.getScrollFeature().setVerticalScrollPosition(o),getHorizontalPosition:()=>n.getScrollFeature().getHScrollPosition().left,setHorizontalPosition:o=>n.getScrollFeature().setHorizontalScrollPosition(o),shouldSkipVerticalScroll:()=>!(0,import_core._isDomLayout)(this.gos,"normal"),shouldSkipHorizontalScroll:()=>!n.getScrollFeature().isHorizontalScrollShowing()})})}onColumnsChanged(){this.refreshLastRangeStart();const e=this.visibleColsService.getAllCols();this.cellRanges.forEach(s=>{const i=s.columns;s.columns=s.columns.filter(o=>o.isVisible()&&e.indexOf(o)!==-1),!(0,import_core._areEqual)(i,s.columns)&&this.dispatchChangedEvent(!1,!0,s.id)});const t=this.cellRanges.length;this.cellRanges=this.cellRanges.filter(s=>s.columns.length>0),t>this.cellRanges.length&&this.dispatchChangedEvent(!1,!0)}refreshLastRangeStart(){const e=(0,import_core._last)(this.cellRanges);e&&this.refreshRangeStart(e)}isContiguousRange(e){const t=e.columns;if(!t.length)return!1;const s=this.visibleColsService.getAllCols(),i=t.map(n=>s.indexOf(n)).sort((n,o)=>n-o);return(0,import_core._last)(i)-i[0]+1===t.length}getRangeStartRow(e){return e.startRow&&e.endRow?this.rowPositionUtils.before(e.startRow,e.endRow)?e.startRow:e.endRow:{rowIndex:0,rowPinned:this.pinnedRowModel.getPinnedTopRowCount()>0?"top":null}}getRangeEndRow(e){if(e.startRow&&e.endRow)return this.rowPositionUtils.before(e.startRow,e.endRow)?e.endRow:e.startRow;const t=this.pinnedRowModel.getPinnedBottomRowCount();return t>0?{rowIndex:t-1,rowPinned:"bottom"}:{rowIndex:this.rowModel.getRowCount()-1,rowPinned:null}}setRangeToCell(e,t=!1){if(!(0,import_core._isCellSelectionEnabled)(this.gos))return;const s=this.calculateColumnsBetween(e.column,e.column);if(!s)return;((0,import_core._getSuppressMultiRanges)(this.gos)||!t||(0,import_core._missing)(this.cellRanges))&&this.removeAllCellRanges(!0);const n={rowIndex:e.rowIndex,rowPinned:e.rowPinned},o={startRow:n,endRow:n,columns:s,startColumn:e.column};this.cellRanges.push(o),this.setNewestRangeStartCell(e),this.onDragStop(),this.dispatchChangedEvent(!0,!0)}extendLatestRangeToCell(e){if(this.isEmpty()||!this.newestRangeStartCell)return;const t=(0,import_core._last)(this.cellRanges);this.updateRangeEnd(t,e)}updateRangeEnd(e,t,s=!1){const i=t.column,n=this.calculateColumnsBetween(e.startColumn,i);!n||this.isLastCellOfRange(e,t)||(e.columns=n,e.endRow={rowIndex:t.rowIndex,rowPinned:t.rowPinned},s||this.dispatchChangedEvent(!0,!0,e.id))}refreshRangeStart(e){const{startColumn:t,columns:s}=e,i=(r,c)=>{const d=e.columns.filter(g=>g!==r);r?(e.startColumn=r,e.columns=c?[r,...d]:[...d,r]):e.columns=d},{left:n,right:o}=this.getRangeEdgeColumns(e);if(t===s[0]&&t!==n){i(n,!0);return}if(t===(0,import_core._last)(s)&&t===o){i(o,!1);return}}getRangeEdgeColumns(e){const t=this.visibleColsService.getAllCols(),s=e.columns.map(i=>t.indexOf(i)).filter(i=>i>-1).sort((i,n)=>i-n);return{left:t[s[0]],right:t[(0,import_core._last)(s)]}}extendLatestRangeInDirection(e){if(this.isEmpty()||!this.newestRangeStartCell)return;const t=e.key,s=e.ctrlKey||e.metaKey,i=(0,import_core._last)(this.cellRanges),n=this.newestRangeStartCell,o=i.columns[0],l=(0,import_core._last)(i.columns),a=i.endRow.rowIndex,r=i.endRow.rowPinned,d={column:n.column===o?l:o,rowIndex:a,rowPinned:r},g=this.cellNavigationService.getNextCellToFocus(t,d,s);if(g)return this.setCellRange({rowStartIndex:n.rowIndex,rowStartPinned:n.rowPinned,rowEndIndex:g.rowIndex,rowEndPinned:g.rowPinned,columnStart:n.column,columnEnd:g.column}),g}setCellRange(e){(0,import_core._isCellSelectionEnabled)(this.gos)&&(this.removeAllCellRanges(!0),this.addCellRange(e))}setCellRanges(e){(0,import_core._shallowCompare)(this.cellRanges,e)||(this.removeAllCellRanges(!0),e.forEach(t=>{t.columns&&t.startRow&&this.setNewestRangeStartCell({rowIndex:t.startRow.rowIndex,rowPinned:t.startRow.rowPinned,column:t.columns[0]}),this.cellRanges.push(t)}),this.dispatchChangedEvent(!1,!0))}setNewestRangeStartCell(e){this.newestRangeStartCell=e}clearCellRangeCellValues(e){let{cellRanges:t}=e;const{cellEventSource:s="rangeService",dispatchWrapperEvents:i,wrapperEventSource:n="deleteKey"}=e;i&&(this.eventService.dispatchEvent({type:"cellSelectionDeleteStart",source:n}),this.eventService.dispatchEvent({type:"rangeDeleteStart",source:n})),t||(t=this.cellRanges),t.forEach(o=>{this.forEachRowInRange(o,l=>{const a=this.rowPositionUtils.getRowNode(l);if(a)for(let r=0;r<o.columns.length;r++){const c=this.columnModel.getCol(o.columns[r]);if(!c||!c.isCellEditable(a))continue;const d=this.valueService.getDeleteValue(c,a);a.setDataValue(c,d,s)}})}),i&&(this.eventService.dispatchEvent({type:"cellSelectionDeleteEnd",source:n}),this.eventService.dispatchEvent({type:"rangeDeleteEnd",source:n}))}createCellRangeFromCellRangeParams(e){return this.createPartialCellRangeFromRangeParams(e,!1)}createPartialCellRangeFromRangeParams(e,t){let s,i=!1;if(e.columns)s=e.columns.map(l=>this.columnModel.getCol(l)).filter(l=>l);else{const l=this.columnModel.getCol(e.columnStart),a=this.columnModel.getCol(e.columnEnd);if(!l||!a)return;s=this.calculateColumnsBetween(l,a),s&&s.length&&(i=s[0]!==l)}if(!s||!t&&s.length===0)return;const n=e.rowStartIndex!=null?{rowIndex:e.rowStartIndex,rowPinned:e.rowStartPinned||null}:void 0,o=e.rowEndIndex!=null?{rowIndex:e.rowEndIndex,rowPinned:e.rowEndPinned||null}:void 0;return{startRow:n,endRow:o,columns:s,startColumn:i?(0,import_core._last)(s):s[0]}}addCellRange(e){const t=this.gos;if(!(0,import_core._isCellSelectionEnabled)(t))return;if((0,import_core._isUsingNewSelectionAPI)(t)&&(0,import_core._getSuppressMultiRanges)(t)&&this.cellRanges.length>0)return(0,import_core._warnOnce)("cannot add multiple ranges when `selection.suppressMultiRanges = true`");const s=this.createCellRangeFromCellRangeParams(e);s&&(s.startRow&&this.setNewestRangeStartCell({rowIndex:s.startRow.rowIndex,rowPinned:s.startRow.rowPinned,column:s.startColumn}),this.cellRanges.push(s),this.dispatchChangedEvent(!1,!0,s.id))}getCellRanges(){return this.cellRanges}isEmpty(){return this.cellRanges.length===0}isMoreThanOneCell(){const e=this.cellRanges.length;if(e===0)return!1;if(e>1)return!0;const t=this.cellRanges[0],s=this.getRangeStartRow(t),i=this.getRangeEndRow(t);return s.rowPinned!==i.rowPinned||s.rowIndex!==i.rowIndex||t.columns.length!==1}areAllRangesAbleToMerge(){const e=new Map;if(this.cellRanges.length<=1)return!0;this.cellRanges.forEach(i=>{this.forEachRowInRange(i,n=>{const o=`${n.rowPinned||"normal"}_${n.rowIndex}`,l=e.get(o),a=i.columns.map(r=>r.getId());if(l){const r=a.filter(c=>l.indexOf(c)===-1);l.push(...r)}else e.set(o,a)})});let s;for(const i of e.values()){const n=i.sort().join();if(s===void 0){s=n;continue}if(s!==n)return!1}return!0}forEachRowInRange(e,t){const s=this.getRangeStartRow(e),i=this.getRangeEndRow(e);let n=s;for(;n&&(t(n),!this.rowPositionUtils.sameRow(n,i));)n=this.cellNavigationService.getRowBelow(n)}removeAllCellRanges(e){this.isEmpty()||(this.onDragStop(),this.cellRanges.length=0,e||this.dispatchChangedEvent(!1,!0))}onBodyScroll(){this.dragging&&this.lastMouseEvent&&this.onDragging(this.lastMouseEvent)}isCellInAnyRange(e){return this.getCellRangeCount(e)>0}isCellInSpecificRange(e,t){const s=t.columns!==null&&(0,import_core._includes)(t.columns,e.column),i=this.isRowInRange(e.rowIndex,e.rowPinned,t);return s&&i}isLastCellOfRange(e,t){const{startRow:s,endRow:i}=e,n=this.rowPositionUtils.before(s,i)?i:s,o=t.rowIndex===n.rowIndex&&t.rowPinned===n.rowPinned,l=e.columns[0],a=(0,import_core._last)(e.columns),r=e.startColumn===l?a:l;return t.column===r&&o}isBottomRightCell(e,t){const s=this.visibleColsService.getAllCols(),i=e.columns.map(c=>s.indexOf(c)).sort((c,d)=>c-d),{startRow:n,endRow:o}=e,l=this.rowPositionUtils.before(n,o)?o:n,a=s.indexOf(t.column)===(0,import_core._last)(i),r=t.rowIndex===l.rowIndex&&(0,import_core._makeNull)(t.rowPinned)===(0,import_core._makeNull)(l.rowPinned);return a&&r}getCellRangeCount(e){return this.isEmpty()?0:this.cellRanges.filter(t=>this.isCellInSpecificRange(e,t)).length}isRowInRange(e,t,s){const i=this.getRangeStartRow(s),n=this.getRangeEndRow(s),o={rowIndex:e,rowPinned:t||null},l=o.rowIndex===i.rowIndex&&o.rowPinned==i.rowPinned,a=o.rowIndex===n.rowIndex&&o.rowPinned==n.rowPinned;if(l||a)return!0;const r=!this.rowPositionUtils.before(o,i),c=this.rowPositionUtils.before(o,n);return r&&c}getDraggingRange(){return this.draggingRange}onDragStart(e){if(!(0,import_core._isCellSelectionEnabled)(this.gos))return;const{ctrlKey:t,metaKey:s,shiftKey:i}=e,n=t||s,l=!(0,import_core._getSuppressMultiRanges)(this.gos)?n:!1,a=i&&(0,import_core._existsAndNotEmpty)(this.cellRanges);!l&&(!a||(0,import_core._exists)((0,import_core._last)(this.cellRanges).type))&&this.removeAllCellRanges(!0);const r=this.dragService.getStartTarget();if(r&&this.updateValuesOnMove(r),!!this.lastCellHovered){if(this.dragging=!0,this.lastMouseEvent=e,this.intersectionRange=l&&this.getCellRangeCount(this.lastCellHovered)>1,a||this.setNewestRangeStartCell(this.lastCellHovered),this.cellRanges.length>0)this.draggingRange=(0,import_core._last)(this.cellRanges);else{const c={rowIndex:this.lastCellHovered.rowIndex,rowPinned:this.lastCellHovered.rowPinned};this.draggingRange={startRow:c,endRow:c,columns:[this.lastCellHovered.column],startColumn:this.newestRangeStartCell.column},this.cellRanges.push(this.draggingRange)}this.ctrlsService.getGridBodyCtrl().addScrollEventListener(this.bodyScrollListener),this.dispatchChangedEvent(!0,!1,this.draggingRange.id)}}intersectLastRange(e){if(e&&this.dragging||(0,import_core._getSuppressMultiRanges)(this.gos)||this.isEmpty())return;const t=this.rowPositionUtils,s=(0,import_core._last)(this.cellRanges),i=this.getRangeStartRow(s),n=this.getRangeEndRow(s),o=[];this.cellRanges.slice(0,-1).forEach(l=>{const a=this.getRangeStartRow(l),r=this.getRangeEndRow(l),c=l.columns,d=c.filter(h=>s.columns.indexOf(h)===-1);if(d.length===c.length){o.push(l);return}if(t.before(n,a)||t.before(r,i)){o.push(l);return}const g=o.length;if(t.before(a,i)){const h={columns:[...c],startColumn:s.startColumn,startRow:{...a},endRow:this.cellNavigationService.getRowAbove(i)};o.push(h)}if(d.length>0){const h={columns:d,startColumn:(0,import_core._includes)(d,s.startColumn)?s.startColumn:d[0],startRow:this.rowMax([{...i},{...a}]),endRow:this.rowMin([{...n},{...r}])};o.push(h)}t.before(n,r)&&o.push({columns:[...c],startColumn:s.startColumn,startRow:this.cellNavigationService.getRowBelow(n),endRow:{...r}}),o.length-g===1&&(o[o.length-1].id=l.id)}),this.cellRanges=o,e&&this.dispatchChangedEvent(!1,!0)}rowMax(e){let t;return e.forEach(s=>{(t===void 0||this.rowPositionUtils.before(t,s))&&(t=s)}),t}rowMin(e){let t;return e.forEach(s=>{(t===void 0||this.rowPositionUtils.before(s,t))&&(t=s)}),t}updateValuesOnMove(e){const t=(0,import_core._getCtrlForEventTarget)(this.gos,e,import_core.CellCtrl.DOM_DATA_KEY_CELL_CTRL),s=t?.getCellPosition();if(this.cellHasChanged=!1,!(!s||this.lastCellHovered&&this.cellPositionUtils.equals(s,this.lastCellHovered))){if(t?.isEditing()){this.dragService.cancelDrag(e);return}this.lastCellHovered&&(this.cellHasChanged=!0),this.lastCellHovered=s}}onDragging(e){if(!this.dragging||!e)return;this.updateValuesOnMove(e.target),this.lastMouseEvent=e;const t=this.lastCellHovered,s=o=>t&&t.rowPinned===o&&this.newestRangeStartCell.rowPinned===o,i=s("top")||s("bottom");if(this.autoScrollService.check(e,i),!this.cellHasChanged)return;const n=this.calculateColumnsBetween(this.newestRangeStartCell.column,t.column);n&&(this.draggingRange.endRow={rowIndex:t.rowIndex,rowPinned:t.rowPinned},this.draggingRange.columns=n,this.dispatchChangedEvent(!1,!1,this.draggingRange.id))}onDragStop(){if(!this.dragging)return;const{id:e}=this.draggingRange;this.autoScrollService.ensureCleared(),this.ctrlsService.getGridBodyCtrl().removeScrollEventListener(this.bodyScrollListener),this.lastMouseEvent=null,this.dragging=!1,this.draggingRange=void 0,this.lastCellHovered=void 0,this.intersectionRange&&(this.intersectionRange=!1,this.intersectLastRange()),this.dispatchChangedEvent(!1,!0,e)}dispatchChangedEvent(e,t,s){this.eventService.dispatchEvent({type:"cellSelectionChanged",started:e,finished:t,id:s}),this.eventService.dispatchEvent({type:"rangeSelectionChanged",started:e,finished:t,id:s})}calculateColumnsBetween(e,t){const s=this.visibleColsService.getAllCols(),i=e===t,n=s.indexOf(e),o=d=>(0,import_core._warnOnce)(`column ${d.getId()} is not visible`);if(n<0){o(e);return}const l=i?n:s.indexOf(t);if(l<0){o(t);return}if(i)return[e];const a=Math.min(n,l),r=a===n?l:n,c=[];for(let d=a;d<=r;d++)c.push(s[d]);return c}},import_core5=require("@ag-grid-community/core"),import_core3=require("@ag-grid-community/core"),import_core2=require("@ag-grid-community/core"),AbstractSelectionHandle=class extends import_core2.Component{constructor(){super(...arguments),this.changedCalculatedValues=!1,this.dragging=!1,this.shouldDestroyOnEndDragging=!1}wireBeans(e){this.dragService=e.dragService,this.rangeService=e.rangeService,this.mouseEventService=e.mouseEventService,this.rowPositionUtils=e.rowPositionUtils,this.cellPositionUtils=e.cellPositionUtils,this.ctrlsService=e.ctrlsService}postConstruct(){this.dragService.addDragSource({dragStartPixels:0,eElement:this.getGui(),onDragStart:this.onDragStart.bind(this),onDragging:e=>{this.dragging=!0,this.rangeService.autoScrollService.check(e),this.changedCalculatedValues&&(this.onDrag(e),this.changedCalculatedValues=!1)},onDragStop:e=>{this.dragging=!1,this.onDragEnd(e),this.clearDragProperties(),this.shouldDestroyOnEndDragging&&this.destroy()},onDragCancel:()=>{this.dragging=!1,this.onDragCancel(),this.clearDragProperties()}}),this.addManagedElementListeners(this.getGui(),{mousedown:this.preventRangeExtension.bind(this)})}isDragging(){return this.dragging}getCellCtrl(){return this.cellCtrl}setCellCtrl(e){this.cellCtrl=e}getCellRange(){return this.cellRange}setCellRange(e){this.cellRange=e}getRangeStartRow(){return this.rangeStartRow}setRangeStartRow(e){this.rangeStartRow=e}getRangeEndRow(){return this.rangeEndRow}setRangeEndRow(e){this.rangeEndRow=e}getLastCellHovered(){return this.lastCellHovered}preventRangeExtension(e){e.stopPropagation()}onDragStart(e){[this.cellHoverListener]=this.addManagedElementListeners(this.ctrlsService.get("gridCtrl").getGui(),{mousemove:this.updateValuesOnMove.bind(this)}),document.body.classList.add(this.getDraggingCssClass())}getDraggingCssClass(){return`ag-dragging-${this.type===import_core2.SelectionHandleType.FILL?"fill":"range"}-handle`}updateValuesOnMove(e){const t=this.mouseEventService.getCellPositionForEvent(e);!t||this.lastCellHovered&&this.cellPositionUtils.equals(t,this.lastCellHovered)||(this.lastCellHovered=t,this.changedCalculatedValues=!0)}clearDragProperties(){this.clearValues(),this.rangeService.autoScrollService.ensureCleared(),document.body.classList.remove(this.getDraggingCssClass())}getType(){return this.type}refresh(e){const t=this.getCellCtrl(),s=this.getGui(),i=(0,import_core2._last)(this.rangeService.getCellRanges()),n=i.startRow,o=i.endRow;if(n&&o&&(this.rowPositionUtils.before(o,n)?(this.setRangeStartRow(o),this.setRangeEndRow(n)):(this.setRangeStartRow(n),this.setRangeEndRow(o))),t!==e||!(0,import_core2._isVisible)(s)){this.setCellCtrl(e);const l=e.getComp().getParentOfValue();l&&l.appendChild(s)}this.setCellRange(i)}clearValues(){this.lastCellHovered=void 0,this.removeListeners()}removeListeners(){this.cellHoverListener&&(this.cellHoverListener(),this.cellHoverListener=void 0)}destroy(){if(!this.shouldDestroyOnEndDragging&&this.isDragging()){(0,import_core2._setDisplayed)(this.getGui(),!1),this.shouldDestroyOnEndDragging=!0;return}this.shouldDestroyOnEndDragging=!1,super.destroy(),this.removeListeners();const e=this.getGui();e.parentElement&&e.parentElement.removeChild(e)}};function findLineByLeastSquares(e){const t=e.length;let s=0;if(t<=1)return e;for(let g=0;g<e.length;g++){const h=e[g],u=h.toString().split("e-");if(u.length>1){s=Math.max(s,parseInt(u[1],10));continue}Math.floor(h)!==h&&(s=Math.max(s,h.toString().split(".")[1].length))}let i=0,n=0,o=0,l=0,a=0;for(let g=0;g<t;g++)a=e[g],i+=g,n+=a,l+=g*g,o+=g*a;const r=(t*o-i*n)/(t*l-i*i),c=n/t-r*i/t,d=[];for(let g=0;g<=t;g++)d.push(parseFloat((g*r+c).toFixed(s)));return d}var AgFillHandle=class extends AbstractSelectionHandle{constructor(){super('<div class="ag-fill-handle"></div>'),this.markedCells=[],this.cellValues=[],this.isUp=!1,this.isLeft=!1,this.isReduce=!1,this.type=import_core3.SelectionHandleType.FILL}wireBeans(e){super.wireBeans(e),this.valueService=e.valueService,this.navigationService=e.navigationService,this.cellNavigationService=e.cellNavigationService,this.visibleColsService=e.visibleColsService}updateValuesOnMove(e){super.updateValuesOnMove(e),this.initialXY||(this.initialXY=this.mouseEventService.getNormalisedPosition(e));const{x:t,y:s}=this.initialXY,{x:i,y:n}=this.mouseEventService.getNormalisedPosition(e),o=Math.abs(t-i),l=Math.abs(s-n),a=this.getFillHandleDirection();let r;a==="xy"?r=o>l?"x":"y":r=a,r!==this.dragAxis&&(this.dragAxis=r,this.changedCalculatedValues=!0)}onDrag(e){if(!this.initialPosition){const s=this.getCellCtrl();if(!s)return;this.initialPosition=s.getCellPosition()}const t=this.getLastCellHovered();t&&this.markPathFrom(this.initialPosition,t)}onDragEnd(e){if(this.initialXY=null,!this.markedCells.length)return;const t=this.dragAxis==="x",s=this.getCellRange(),i=s.columns.length,n=this.getRangeStartRow(),o=this.getRangeEndRow();let l;if(!this.isUp&&!this.isLeft)l=this.rangeService.createCellRangeFromCellRangeParams({rowStartIndex:n.rowIndex,rowStartPinned:n.rowPinned,columnStart:s.columns[0],rowEndIndex:t?o.rowIndex:this.lastCellMarked.rowIndex,rowEndPinned:t?o.rowPinned:this.lastCellMarked.rowPinned,columnEnd:t?this.lastCellMarked.column:s.columns[i-1]});else{const a=t?n:this.lastCellMarked;l=this.rangeService.createCellRangeFromCellRangeParams({rowStartIndex:a.rowIndex,rowStartPinned:a.rowPinned,columnStart:t?this.lastCellMarked.column:s.columns[0],rowEndIndex:o.rowIndex,rowEndPinned:o.rowPinned,columnEnd:s.columns[i-1]})}l&&(this.eventService.dispatchEvent({type:"fillStart"}),this.handleValueChanged(s,l,e),this.rangeService.setCellRanges([l]),this.eventService.dispatchEvent({type:"fillEnd",initialRange:s,finalRange:l}))}onDragCancel(){this.initialXY=null,this.markedCells.length&&this.clearMarkedPath()}getFillHandleDirection(){const e=(0,import_core3._getFillHandle)(this.gos)?.direction;return e?e!=="x"&&e!=="y"&&e!=="xy"?((0,import_core3._warnOnce)("valid values for fillHandleDirection are 'x', 'y' and 'xy'. Default to 'xy'."),"xy"):e:"xy"}handleValueChanged(e,t,s){const i=this.rangeService.getRangeEndRow(e),n=this.rangeService.getRangeStartRow(e),o=this.rangeService.getRangeEndRow(t),l=this.rangeService.getRangeStartRow(t),a=this.dragAxis==="y";if(this.isReduce&&!(0,import_core3._getFillHandle)(this.gos)?.suppressClearOnFillReduction){const m=a?e.columns:e.columns.filter(R=>t.columns.indexOf(R)<0),f=a?this.cellNavigationService.getRowBelow(o):l;f&&this.clearCellsInRange(f,i,m);return}const r=[],c=[],d=[],g=[];let h=!0,u=0;const w=()=>{r.length=0,c.length=0,d.length=0,g.length=0,u=0},v=(m,f)=>{let R=this.isUp?i:n,x=!1;for(a&&(h=!0,w());!x&&R;){const C=this.rowPositionUtils.getRowNode(R);if(!C)break;a&&m?p(r,m,C,()=>!this.rowPositionUtils.sameRow(R,this.isUp?n:i)):f&&(h=!0,w(),f.forEach(S=>p(r,S,C,()=>S!==(this.isLeft?e.columns[0]:(0,import_core3._last)(e.columns))))),x=this.rowPositionUtils.sameRow(R,this.isUp?l:o),R=this.isUp?this.cellNavigationService.getRowAbove(R):this.cellNavigationService.getRowBelow(R)}},p=(m,f,R,x)=>{let C,S=!1;if(h)C=this.valueService.getValue(f,R),c.push(C),d.push(this.valueService.getValue(f,R,void 0,!0)),g.push(this.valueService.formatValue(f,R,C)),h=x();else{const{value:I,fromUserFunction:E,sourceCol:P,sourceRowNode:_}=this.processValues({event:s,values:m,initialValues:c,initialNonAggregatedValues:d,initialFormattedValues:g,col:f,rowNode:R,idx:u++});if(C=I,f.isCellEditable(R)){const y=this.valueService.getValue(f,R);E||(P&&P.getColDef()?.useValueFormatterForExport!==!1&&(C=this.valueService.formatValue(P,_,C)??C),f.getColDef().useValueParserForImport!==!1&&(C=this.valueService.parseValue(f,R,P?C:(0,import_core3._toStringOrNull)(C),y))),!E||y!==C?R.setDataValue(f,C,"rangeService"):S=!0}}S||m.push({value:C,column:f,rowNode:R})};if(a)e.columns.forEach(m=>{v(m)});else{const m=this.isLeft?[...t.columns].reverse():t.columns;v(void 0,m)}}clearCellsInRange(e,t,s){const i={startRow:e,endRow:t,columns:s,startColumn:s[0]};this.rangeService.clearCellRangeCellValues({cellRanges:[i]})}processValues(e){const{event:t,values:s,initialValues:i,initialNonAggregatedValues:n,initialFormattedValues:o,col:l,rowNode:a,idx:r}=e,c=(0,import_core3._getFillHandle)(this.gos)?.setFillValue,d=this.dragAxis==="y";let g;if(d?g=this.isUp?"up":"down":g=this.isLeft?"left":"right",c){const u=this.gos.addGridCommonParams({event:t,values:s.map(({value:v})=>v),initialValues:i,initialNonAggregatedValues:n,initialFormattedValues:o,currentIndex:r,currentCellValue:this.valueService.getValue(l,a),direction:g,column:l,rowNode:a}),w=c(u);if(w!==!1)return{value:w,fromUserFunction:!0}}const h=!s.some(({value:u})=>{const w=parseFloat(u);return isNaN(w)||w.toString()!==u.toString()});if(t.altKey||!h){if(h&&i.length===1){const p=this.isUp||this.isLeft?-1:1;return{value:parseFloat((0,import_core3._last)(s).value)+1*p,fromUserFunction:!1}}const{value:u,column:w,rowNode:v}=s[r%s.length];return{value:u,fromUserFunction:!1,sourceCol:w,sourceRowNode:v}}return{value:(0,import_core3._last)(findLineByLeastSquares(s.map(({value:u})=>Number(u)))),fromUserFunction:!1}}clearValues(){this.clearMarkedPath(),this.clearCellValues(),this.lastCellMarked=void 0,super.clearValues()}clearMarkedPath(){this.markedCells.forEach(e=>{if(!e.isAlive())return;const 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}clearCellValues(){this.cellValues.length=0}markPathFrom(e,t){if(this.clearMarkedPath(),this.clearCellValues(),this.dragAxis==="y"){if(this.rowPositionUtils.sameRow(t,e))return;const s=this.rowPositionUtils.before(t,e),i=this.getRangeStartRow(),n=this.getRangeEndRow();s&&(t.rowPinned==i.rowPinned&&t.rowIndex>=i.rowIndex||i.rowPinned!=n.rowPinned&&t.rowPinned==n.rowPinned&&t.rowIndex<=n.rowIndex)?(this.reduceVertical(e,t),this.isReduce=!0):(this.extendVertical(e,t,s),this.isReduce=!1)}else{const s=e.column,i=t.column;if(s===i)return;const n=this.visibleColsService.getAllCols(),o=n.indexOf(s),l=n.indexOf(i);l<=o&&l>=n.indexOf(this.getCellRange().columns[0])?(this.reduceHorizontal(e,t),this.isReduce=!0):(this.extendHorizontal(e,t,l<o),this.isReduce=!1)}this.lastCellMarked=t}extendVertical(e,t,s){const{navigationService:i,rangeService:n}=this;let o=e;do{const l=this.getCellRange(),a=l.columns.length;for(let r=0;r<a;r++){const c=l.columns[r],g={...{rowIndex:o.rowIndex,rowPinned:o.rowPinned},column:c},h=n.isCellInSpecificRange(g,l),u=this.rowPositionUtils.sameRow(o,e);if(s&&(this.isUp=!0),!u){const w=i.getCellByPosition(g);if(w){this.markedCells.push(w);const v=w.getComp();h||(v.addOrRemoveCssClass("ag-selection-fill-left",r===0),v.addOrRemoveCssClass("ag-selection-fill-right",r===a-1)),v.addOrRemoveCssClass(s?"ag-selection-fill-top":"ag-selection-fill-bottom",this.rowPositionUtils.sameRow(o,t))}}}if(this.rowPositionUtils.sameRow(o,t))break}while(o=s?this.cellNavigationService.getRowAbove(o):this.cellNavigationService.getRowBelow(o))}reduceVertical(e,t){let s=e;do{const i=this.getCellRange(),n=i.columns.length,o=this.rowPositionUtils.sameRow(s,t);for(let l=0;l<n;l++){const r={...{rowIndex:s.rowIndex,rowPinned:s.rowPinned},column:i.columns[l]},c=this.navigationService.getCellByPosition(r);c&&(this.markedCells.push(c),c.getComp().addOrRemoveCssClass("ag-selection-fill-bottom",this.rowPositionUtils.sameRow(s,t)))}if(o)break}while(s=this.cellNavigationService.getRowAbove(s))}extendHorizontal(e,t,s){const i=this.visibleColsService.getAllCols(),n=i.indexOf(s?t.column:e.column),o=i.indexOf(s?this.getCellRange().columns[0]:t.column),l=s?0:1,a=i.slice(n+l,o+l),r=this.getRangeStartRow(),c=this.getRangeEndRow();a.forEach(d=>{let g=r,h=!1;do{h=this.rowPositionUtils.sameRow(g,c);const u=this.navigationService.getCellByPosition({rowIndex:g.rowIndex,rowPinned:g.rowPinned,column:d});if(u){this.markedCells.push(u);const w=u.getComp();w.addOrRemoveCssClass("ag-selection-fill-top",this.rowPositionUtils.sameRow(g,r)),w.addOrRemoveCssClass("ag-selection-fill-bottom",this.rowPositionUtils.sameRow(g,c)),s?(this.isLeft=!0,w.addOrRemoveCssClass("ag-selection-fill-left",d===a[0])):w.addOrRemoveCssClass("ag-selection-fill-right",d===(0,import_core3._last)(a))}g=this.cellNavigationService.getRowBelow(g)}while(!h)})}reduceHorizontal(e,t){const s=this.visibleColsService.getAllCols(),i=s.indexOf(t.column),n=s.indexOf(e.column),o=s.slice(i,n),l=this.getRangeStartRow(),a=this.getRangeEndRow();o.forEach(r=>{let c=l,d=!1;do{d=this.rowPositionUtils.sameRow(c,a);const g=this.navigationService.getCellByPosition({rowIndex:c.rowIndex,rowPinned:c.rowPinned,column:r});g&&(this.markedCells.push(g),g.getComp().addOrRemoveCssClass("ag-selection-fill-right",r===o[0])),c=this.cellNavigationService.getRowBelow(c)}while(!d)})}refresh(e){const t=this.rangeService.getCellRanges()[0];if(!t.startRow||!t.endRow){this.destroy();return}super.refresh(e)}},import_core4=require("@ag-grid-community/core"),AgRangeHandle=class extends AbstractSelectionHandle{constructor(){super('<div class="ag-range-handle"></div>'),this.type=import_core4.SelectionHandleType.RANGE,this.rangeFixed=!1}onDrag(e){const t=this.getLastCellHovered();if(!t)return;const s=this.rangeService.getCellRanges(),i=(0,import_core4._last)(s);this.rangeFixed||(this.fixRangeStartEnd(i),this.rangeFixed=!0),this.endPosition={rowIndex:t.rowIndex,rowPinned:t.rowPinned,column:t.column},s.length===2&&s[0].type===import_core4.CellRangeType.DIMENSION&&i.type===import_core4.CellRangeType.VALUE&&!this.rowPositionUtils.sameRow(this.endPosition,this.rangeService.getRangeEndRow(i))&&this.rangeService.updateRangeEnd(s[0],{...this.endPosition,column:s[0].columns[0]},!0),this.rangeService.extendLatestRangeToCell(this.endPosition)}onDragEnd(e){const t=(0,import_core4._last)(this.rangeService.getCellRanges());this.fixRangeStartEnd(t),this.rangeFixed=!1}onDragCancel(){this.rangeFixed=!1}fixRangeStartEnd(e){const t=this.rangeService.getRangeStartRow(e),s=this.rangeService.getRangeEndRow(e),i=e.columns[0];e.startRow=t,e.endRow=s,e.startColumn=i}},SelectionHandleFactory=class extends import_core5.BeanStub{constructor(){super(...arguments),this.beanName="selectionHandleFactory"}createSelectionHandle(e){return this.createBean(e===import_core5.SelectionHandleType.RANGE?new AgRangeHandle:new AgFillHandle)}},VERSION="32.2.0",RangeSelectionCoreModule=(0,import_core6._defineModule)({version:VERSION,moduleName:`${import_core6.ModuleNames.RangeSelectionModule}-core`,beans:[RangeService,SelectionHandleFactory],dependantModules:[import_core7.EnterpriseCoreModule]}),RangeSelectionApiModule=(0,import_core6._defineModule)({version:VERSION,moduleName:`${import_core6.ModuleNames.RangeSelectionModule}-api`,apiFunctions:{getCellRanges,addCellRange,clearRangeSelection,clearCellSelection:clearRangeSelection},dependantModules:[RangeSelectionCoreModule]}),RangeSelectionModule=(0,import_core6._defineModule)({version:VERSION,moduleName:import_core6.ModuleNames.RangeSelectionModule,dependantModules:[RangeSelectionCoreModule,RangeSelectionApiModule]});
{
"name": "@ag-grid-enterprise/range-selection",
"version": "32.1.0",
"version": "32.2.0",
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue",

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

"dependencies": {
"@ag-grid-community/core": "32.1.0",
"@ag-grid-enterprise/core": "32.1.0"
"@ag-grid-community/core": "32.2.0",
"@ag-grid-enterprise/core": "32.2.0"
},

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

{
"name": "@ag-grid-enterprise/range-selection",
"version": "32.1.0",
"version": "32.2.0",
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue",

@@ -16,4 +16,4 @@ "main": "./src/main.js",

"dependencies": {
"@ag-grid-community/core": "32.1.0",
"@ag-grid-enterprise/core": "32.1.0"
"@ag-grid-community/core": "32.2.0",
"@ag-grid-enterprise/core": "32.2.0"
},

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

@@ -25,2 +25,3 @@ import type { BeanCollection, CellCtrl, CellPosition, CellPositionUtils, CellRange, CtrlsService, DragService, ISelectionHandle, MouseEventService, RowPosition, RowPositionUtils } from '@ag-grid-community/core';

protected abstract onDragEnd(e: MouseEvent | Touch): void;
protected abstract onDragCancel(): void;
protected isDragging(): boolean;

@@ -40,2 +41,3 @@ protected getCellCtrl(): CellCtrl | undefined;

protected updateValuesOnMove(e: MouseEvent): void;
private clearDragProperties;
getType(): SelectionHandleType;

@@ -42,0 +44,0 @@ refresh(cellCtrl: CellCtrl): void;

@@ -24,2 +24,3 @@ import type { BeanCollection, CellCtrl } from '@ag-grid-community/core';

protected onDragEnd(e: MouseEvent): void;
protected onDragCancel(): void;
private getFillHandleDirection;

@@ -26,0 +27,0 @@ private handleValueChanged;

@@ -10,3 +10,4 @@ import { SelectionHandleType } from '@ag-grid-community/core';

protected onDragEnd(e: MouseEvent): void;
protected onDragCancel(): void;
private fixRangeStartEnd;
}

@@ -1,1 +0,1 @@

export declare const VERSION = "32.1.0";
export declare const VERSION = "32.2.0";
{
"name": "@ag-grid-enterprise/range-selection",
"version": "32.1.0",
"version": "32.2.0",
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue",

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

"dependencies": {
"@ag-grid-community/core": "32.1.0",
"@ag-grid-enterprise/core": "32.1.0"
"@ag-grid-community/core": "32.2.0",
"@ag-grid-enterprise/core": "32.2.0"
},

@@ -20,0 +20,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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc