@ag-grid-enterprise/range-selection
Advanced tools
Comparing version 31.2.1 to 31.3.0
@@ -76,4 +76,4 @@ var __defProp = Object.defineProperty; | ||
this.addManagedListener(this.eventService, import_core.Events.EVENT_COLUMN_PINNED, this.refreshLastRangeStart.bind(this)); | ||
this.ctrlsService.whenReady(() => { | ||
const gridBodyCtrl = this.ctrlsService.getGridBodyCtrl(); | ||
this.ctrlsService.whenReady((p) => { | ||
const gridBodyCtrl = p.gridBodyCtrl; | ||
this.autoScrollService = new import_core.AutoScrollService({ | ||
@@ -86,3 +86,3 @@ scrollContainer: gridBodyCtrl.getBodyViewportElement(), | ||
setHorizontalPosition: (position) => gridBodyCtrl.getScrollFeature().setHorizontalScrollPosition(position), | ||
shouldSkipVerticalScroll: () => !this.gridOptionsService.isDomLayout("normal"), | ||
shouldSkipVerticalScroll: () => !this.gos.isDomLayout("normal"), | ||
shouldSkipHorizontalScroll: () => !gridBodyCtrl.getScrollFeature().isHorizontalScrollShowing() | ||
@@ -153,3 +153,3 @@ }); | ||
setRangeToCell(cell, appendRange = false) { | ||
if (!this.gridOptionsService.get("enableRangeSelection")) { | ||
if (!this.gos.get("enableRangeSelection")) { | ||
return; | ||
@@ -161,3 +161,3 @@ } | ||
} | ||
const suppressMultiRangeSelections = this.gridOptionsService.get("suppressMultiRangeSelection"); | ||
const suppressMultiRangeSelections = this.gos.get("suppressMultiRangeSelection"); | ||
if (suppressMultiRangeSelections || !appendRange || import_core._.missing(this.cellRanges)) { | ||
@@ -261,3 +261,3 @@ this.removeAllCellRanges(true); | ||
setCellRange(params) { | ||
if (!this.gridOptionsService.get("enableRangeSelection")) { | ||
if (!this.gos.get("enableRangeSelection")) { | ||
return; | ||
@@ -307,2 +307,3 @@ } | ||
this.forEachRowInRange(cellRange, (rowPosition) => { | ||
var _a; | ||
const rowNode = this.rowPositionUtils.getRowNode(rowPosition); | ||
@@ -317,3 +318,4 @@ if (!rowNode) { | ||
} | ||
rowNode.setDataValue(column, null, cellEventSource); | ||
const emptyValue = (_a = this.valueService.parseValue(column, rowNode, "", rowNode.getValueFromValueService(column))) != null ? _a : null; | ||
rowNode.setDataValue(column, emptyValue, cellEventSource); | ||
} | ||
@@ -331,2 +333,6 @@ }); | ||
createCellRangeFromCellRangeParams(params) { | ||
return this.createPartialCellRangeFromRangeParams(params, false); | ||
} | ||
// Range service can't normally support a range without columns, but charts can | ||
createPartialCellRangeFromRangeParams(params, allowEmptyColumns) { | ||
let columns; | ||
@@ -347,3 +353,3 @@ let startsOnTheRight = false; | ||
} | ||
if (!columns) { | ||
if (!columns || !allowEmptyColumns && columns.length === 0) { | ||
return; | ||
@@ -367,3 +373,3 @@ } | ||
addCellRange(params) { | ||
if (!this.gridOptionsService.get("enableRangeSelection")) { | ||
if (!this.gos.get("enableRangeSelection")) { | ||
return; | ||
@@ -515,3 +521,3 @@ } | ||
onDragStart(mouseEvent) { | ||
if (!this.gridOptionsService.get("enableRangeSelection")) { | ||
if (!this.gos.get("enableRangeSelection")) { | ||
return; | ||
@@ -521,3 +527,3 @@ } | ||
const isMultiKey = ctrlKey || metaKey; | ||
const allowMulti = !this.gridOptionsService.get("suppressMultiRangeSelection"); | ||
const allowMulti = !this.gos.get("suppressMultiRangeSelection"); | ||
const isMultiSelect = allowMulti ? isMultiKey : false; | ||
@@ -563,3 +569,3 @@ const extendRange = shiftKey && import_core._.existsAndNotEmpty(this.cellRanges); | ||
} | ||
if (this.gridOptionsService.get("suppressMultiRangeSelection")) { | ||
if (this.gos.get("suppressMultiRangeSelection")) { | ||
return; | ||
@@ -570,2 +576,3 @@ } | ||
} | ||
const rowPosUtils = this.rowPositionUtils; | ||
const lastRange = import_core._.last(this.cellRanges); | ||
@@ -584,3 +591,3 @@ const intersectionStartRow = this.getRangeStartRow(lastRange); | ||
} | ||
if (this.rowPositionUtils.before(intersectionEndRow, startRow) || this.rowPositionUtils.before(endRow, intersectionStartRow)) { | ||
if (rowPosUtils.before(intersectionEndRow, startRow) || rowPosUtils.before(endRow, intersectionStartRow)) { | ||
newRanges.push(range); | ||
@@ -590,3 +597,3 @@ return; | ||
const rangeCountBefore = newRanges.length; | ||
if (this.rowPositionUtils.before(startRow, intersectionStartRow)) { | ||
if (rowPosUtils.before(startRow, intersectionStartRow)) { | ||
const top = { | ||
@@ -604,8 +611,8 @@ columns: [...cols], | ||
startColumn: import_core._.includes(intersectCols, lastRange.startColumn) ? lastRange.startColumn : intersectCols[0], | ||
startRow: this.rowPositionUtils.rowMax([__spreadValues({}, intersectionStartRow), __spreadValues({}, startRow)]), | ||
endRow: this.rowPositionUtils.rowMin([__spreadValues({}, intersectionEndRow), __spreadValues({}, endRow)]) | ||
startRow: this.rowMax([__spreadValues({}, intersectionStartRow), __spreadValues({}, startRow)]), | ||
endRow: this.rowMin([__spreadValues({}, intersectionEndRow), __spreadValues({}, endRow)]) | ||
}; | ||
newRanges.push(middle); | ||
} | ||
if (this.rowPositionUtils.before(intersectionEndRow, endRow)) { | ||
if (rowPosUtils.before(intersectionEndRow, endRow)) { | ||
newRanges.push({ | ||
@@ -627,4 +634,22 @@ columns: [...cols], | ||
} | ||
rowMax(rows) { | ||
let max; | ||
rows.forEach((row) => { | ||
if (max === void 0 || this.rowPositionUtils.before(max, row)) { | ||
max = row; | ||
} | ||
}); | ||
return max; | ||
} | ||
rowMin(rows) { | ||
let min; | ||
rows.forEach((row) => { | ||
if (min === void 0 || this.rowPositionUtils.before(row, min)) { | ||
min = row; | ||
} | ||
}); | ||
return min; | ||
} | ||
updateValuesOnMove(eventTarget) { | ||
const cellCtrl = import_core._.getCtrlForEventTarget(this.gridOptionsService, eventTarget, import_core.CellCtrl.DOM_DATA_KEY_CELL_CTRL); | ||
const cellCtrl = import_core._.getCtrlForEventTarget(this.gos, eventTarget, import_core.CellCtrl.DOM_DATA_KEY_CELL_CTRL); | ||
const cell = cellCtrl == null ? void 0 : cellCtrl.getCellPosition(); | ||
@@ -740,2 +765,5 @@ this.cellHasChanged = false; | ||
__decorateClass([ | ||
(0, import_core.Autowired)("valueService") | ||
], RangeService.prototype, "valueService", 2); | ||
__decorateClass([ | ||
import_core.PostConstruct | ||
@@ -824,3 +852,3 @@ ], RangeService.prototype, "init", 1); | ||
this.cellHoverListener = this.addManagedListener( | ||
this.ctrlsService.getGridCtrl().getGui(), | ||
this.ctrlsService.get("gridCtrl").getGui(), | ||
"mousemove", | ||
@@ -1053,3 +1081,3 @@ this.updateValuesOnMove.bind(this) | ||
getFillHandleDirection() { | ||
const direction = this.gridOptionsService.get("fillHandleDirection"); | ||
const direction = this.gos.get("fillHandleDirection"); | ||
if (!direction) { | ||
@@ -1084,3 +1112,3 @@ return "xy"; | ||
const isVertical = this.dragAxis === "y"; | ||
if (this.isReduce && !this.gridOptionsService.get("suppressClearOnFillReduction")) { | ||
if (this.isReduce && !this.gos.get("suppressClearOnFillReduction")) { | ||
const columns = isVertical ? initialRange.columns : initialRange.columns.filter((col) => finalRange.columns.indexOf(col) < 0); | ||
@@ -1144,3 +1172,3 @@ const startRow = isVertical ? this.cellNavigationService.getRowBelow(finalRangeEndRow) : finalRangeStartRow; | ||
initialNonAggregatedValues.push(this.valueService.getValue(col, rowNode, void 0, true)); | ||
initialFormattedValues.push(this.valueFormatterService.formatValue(col, rowNode, currentValue)); | ||
initialFormattedValues.push(this.valueService.formatValue(col, rowNode, currentValue)); | ||
withinInitialRange = updateInitialSet(); | ||
@@ -1163,6 +1191,6 @@ } else { | ||
if (sourceCol && ((_a = sourceCol.getColDef()) == null ? void 0 : _a.useValueFormatterForExport) !== false) { | ||
currentValue = (_b = this.valueFormatterService.formatValue(sourceCol, sourceRowNode, currentValue)) != null ? _b : currentValue; | ||
currentValue = (_b = this.valueService.formatValue(sourceCol, sourceRowNode, currentValue)) != null ? _b : currentValue; | ||
} | ||
if (col.getColDef().useValueParserForImport !== false) { | ||
currentValue = this.valueParserService.parseValue( | ||
currentValue = this.valueService.parseValue( | ||
col, | ||
@@ -1211,3 +1239,3 @@ rowNode, | ||
const { event, values, initialValues, initialNonAggregatedValues, initialFormattedValues, col, rowNode, idx } = params; | ||
const userFillOperation = this.gridOptionsService.getCallback("fillOperation"); | ||
const userFillOperation = this.gos.getCallback("fillOperation"); | ||
const isVertical = this.dragAxis === "y"; | ||
@@ -1451,8 +1479,2 @@ let direction; | ||
], _FillHandle.prototype, "valueService", 2); | ||
__decorateClass([ | ||
(0, import_core3.Autowired)("valueParserService") | ||
], _FillHandle.prototype, "valueParserService", 2); | ||
__decorateClass([ | ||
(0, import_core3.Autowired)("valueFormatterService") | ||
], _FillHandle.prototype, "valueFormatterService", 2); | ||
var FillHandle = _FillHandle; | ||
@@ -1528,3 +1550,3 @@ | ||
// enterprise-modules/range-selection/src/version.ts | ||
var VERSION = "31.2.1"; | ||
var VERSION = "31.3.0"; | ||
@@ -1531,0 +1553,0 @@ // enterprise-modules/range-selection/src/rangeSelectionModule.ts |
@@ -1,1 +0,1 @@ | ||
var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropNames=Object.getOwnPropertyNames,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,e,s)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,__spreadValues=(t,e)=>{for(var s in e||(e={}))__hasOwnProp.call(e,s)&&__defNormalProp(t,s,e[s]);if(__getOwnPropSymbols)for(var s of __getOwnPropSymbols(e))__propIsEnum.call(e,s)&&__defNormalProp(t,s,e[s]);return t},__spreadProps=(t,e)=>__defProps(t,__getOwnPropDescs(e)),__export=(t,e)=>{for(var s in e)__defProp(t,s,{get:e[s],enumerable:!0})},__copyProps=(t,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of __getOwnPropNames(e))!__hasOwnProp.call(t,i)&&i!==s&&__defProp(t,i,{get:()=>e[i],enumerable:!(n=__getOwnPropDesc(e,i))||n.enumerable});return t},__toCommonJS=t=>__copyProps(__defProp({},"__esModule",{value:!0}),t),__decorateClass=(t,e,s,n)=>{for(var i=n>1?void 0:n?__getOwnPropDesc(e,s):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(i=(n?l(e,s,i):l(i))||i);return n&&i&&__defProp(e,s,i),i},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"),import_core=require("@ag-grid-community/core"),RangeService=class extends import_core.BeanStub{constructor(){super(...arguments),this.cellRanges=[],this.bodyScrollListener=this.onBodyScroll.bind(this),this.dragging=!1,this.intersectionRange=!1}init(){this.addManagedListener(this.eventService,import_core.Events.EVENT_NEW_COLUMNS_LOADED,()=>this.onColumnsChanged()),this.addManagedListener(this.eventService,import_core.Events.EVENT_COLUMN_VISIBLE,this.onColumnsChanged.bind(this)),this.addManagedListener(this.eventService,import_core.Events.EVENT_COLUMN_VALUE_CHANGED,this.onColumnsChanged.bind(this)),this.addManagedListener(this.eventService,import_core.Events.EVENT_COLUMN_PIVOT_MODE_CHANGED,()=>this.removeAllCellRanges()),this.addManagedListener(this.eventService,import_core.Events.EVENT_COLUMN_ROW_GROUP_CHANGED,()=>this.removeAllCellRanges()),this.addManagedListener(this.eventService,import_core.Events.EVENT_COLUMN_PIVOT_CHANGED,()=>this.removeAllCellRanges()),this.addManagedListener(this.eventService,import_core.Events.EVENT_COLUMN_GROUP_OPENED,this.refreshLastRangeStart.bind(this)),this.addManagedListener(this.eventService,import_core.Events.EVENT_COLUMN_MOVED,this.refreshLastRangeStart.bind(this)),this.addManagedListener(this.eventService,import_core.Events.EVENT_COLUMN_PINNED,this.refreshLastRangeStart.bind(this)),this.ctrlsService.whenReady(()=>{const t=this.ctrlsService.getGridBodyCtrl();this.autoScrollService=new import_core.AutoScrollService({scrollContainer:t.getBodyViewportElement(),scrollAxis:"xy",getVerticalPosition:()=>t.getScrollFeature().getVScrollPosition().top,setVerticalPosition:e=>t.getScrollFeature().setVerticalScrollPosition(e),getHorizontalPosition:()=>t.getScrollFeature().getHScrollPosition().left,setHorizontalPosition:e=>t.getScrollFeature().setHorizontalScrollPosition(e),shouldSkipVerticalScroll:()=>!this.gridOptionsService.isDomLayout("normal"),shouldSkipHorizontalScroll:()=>!t.getScrollFeature().isHorizontalScrollShowing()})})}onColumnsChanged(){this.refreshLastRangeStart();const t=this.columnModel.getAllDisplayedColumns();this.cellRanges.forEach(s=>{const n=s.columns;s.columns=s.columns.filter(o=>o.isVisible()&&t.indexOf(o)!==-1),!import_core._.areEqual(n,s.columns)&&this.dispatchChangedEvent(!1,!0,s.id)});const e=this.cellRanges.length;this.cellRanges=this.cellRanges.filter(s=>s.columns.length>0),e>this.cellRanges.length&&this.dispatchChangedEvent(!1,!0)}refreshLastRangeStart(){const t=import_core._.last(this.cellRanges);t&&this.refreshRangeStart(t)}isContiguousRange(t){const e=t.columns;if(!e.length)return!1;const s=this.columnModel.getAllDisplayedColumns(),n=e.map(i=>s.indexOf(i)).sort((i,o)=>i-o);return import_core._.last(n)-n[0]+1===e.length}getRangeStartRow(t){return t.startRow&&t.endRow?this.rowPositionUtils.before(t.startRow,t.endRow)?t.startRow:t.endRow:{rowIndex:0,rowPinned:this.pinnedRowModel.getPinnedTopRowCount()>0?"top":null}}getRangeEndRow(t){if(t.startRow&&t.endRow)return this.rowPositionUtils.before(t.startRow,t.endRow)?t.endRow:t.startRow;const e=this.pinnedRowModel.getPinnedBottomRowCount();return e>0?{rowIndex:e-1,rowPinned:"bottom"}:{rowIndex:this.rowModel.getRowCount()-1,rowPinned:null}}setRangeToCell(t,e=!1){if(!this.gridOptionsService.get("enableRangeSelection"))return;const s=this.calculateColumnsBetween(t.column,t.column);if(!s)return;(this.gridOptionsService.get("suppressMultiRangeSelection")||!e||import_core._.missing(this.cellRanges))&&this.removeAllCellRanges(!0);const i={rowIndex:t.rowIndex,rowPinned:t.rowPinned},o={startRow:i,endRow:i,columns:s,startColumn:t.column};this.cellRanges.push(o),this.setNewestRangeStartCell(t),this.onDragStop(),this.dispatchChangedEvent(!0,!0)}extendLatestRangeToCell(t){if(this.isEmpty()||!this.newestRangeStartCell)return;const e=import_core._.last(this.cellRanges);this.updateRangeEnd(e,t)}updateRangeEnd(t,e,s=!1){const n=e.column,i=this.calculateColumnsBetween(t.startColumn,n);!i||this.isLastCellOfRange(t,e)||(t.columns=i,t.endRow={rowIndex:e.rowIndex,rowPinned:e.rowPinned},s||this.dispatchChangedEvent(!0,!0,t.id))}refreshRangeStart(t){const{startColumn:e,columns:s}=t,n=(a,c)=>{const g=t.columns.filter(d=>d!==a);a?(t.startColumn=a,t.columns=c?[a,...g]:[...g,a]):t.columns=g},{left:i,right:o}=this.getRangeEdgeColumns(t);if(e===s[0]&&e!==i){n(i,!0);return}if(e===import_core._.last(s)&&e===o){n(o,!1);return}}getRangeEdgeColumns(t){const e=this.columnModel.getAllDisplayedColumns(),s=t.columns.map(n=>e.indexOf(n)).filter(n=>n>-1).sort((n,i)=>n-i);return{left:e[s[0]],right:e[import_core._.last(s)]}}extendLatestRangeInDirection(t){if(this.isEmpty()||!this.newestRangeStartCell)return;const e=t.key,s=t.ctrlKey||t.metaKey,n=import_core._.last(this.cellRanges),i=this.newestRangeStartCell,o=n.columns[0],l=import_core._.last(n.columns),r=n.endRow.rowIndex,a=n.endRow.rowPinned,g={column:i.column===o?l:o,rowIndex:r,rowPinned:a},d=this.cellNavigationService.getNextCellToFocus(e,g,s);if(d)return this.setCellRange({rowStartIndex:i.rowIndex,rowStartPinned:i.rowPinned,rowEndIndex:d.rowIndex,rowEndPinned:d.rowPinned,columnStart:i.column,columnEnd:d.column}),d}setCellRange(t){this.gridOptionsService.get("enableRangeSelection")&&(this.removeAllCellRanges(!0),this.addCellRange(t))}setCellRanges(t){import_core._.shallowCompare(this.cellRanges,t)||(this.removeAllCellRanges(!0),t.forEach(e=>{e.columns&&e.startRow&&this.setNewestRangeStartCell({rowIndex:e.startRow.rowIndex,rowPinned:e.startRow.rowPinned,column:e.columns[0]}),this.cellRanges.push(e)}),this.dispatchChangedEvent(!1,!0))}setNewestRangeStartCell(t){this.newestRangeStartCell=t}clearCellRangeCellValues(t){let{cellRanges:e}=t;const{cellEventSource:s="rangeService",dispatchWrapperEvents:n,wrapperEventSource:i="deleteKey"}=t;if(n){const o={type:import_core.Events.EVENT_RANGE_DELETE_START,source:i};this.eventService.dispatchEvent(o)}if(e||(e=this.cellRanges),e.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.getGridColumn(o.columns[a]);!c||!c.isCellEditable(r)||r.setDataValue(c,null,s)}})}),n){const o={type:import_core.Events.EVENT_RANGE_DELETE_END,source:i};this.eventService.dispatchEvent(o)}}createCellRangeFromCellRangeParams(t){let e,s=!1;if(t.columns)e=t.columns.map(o=>this.columnModel.getColumnWithValidation(o)).filter(o=>o);else{const o=this.columnModel.getColumnWithValidation(t.columnStart),l=this.columnModel.getColumnWithValidation(t.columnEnd);if(!o||!l)return;e=this.calculateColumnsBetween(o,l),e&&e.length&&(s=e[0]!==o)}if(!e)return;const n=t.rowStartIndex!=null?{rowIndex:t.rowStartIndex,rowPinned:t.rowStartPinned||null}:void 0,i=t.rowEndIndex!=null?{rowIndex:t.rowEndIndex,rowPinned:t.rowEndPinned||null}:void 0;return{startRow:n,endRow:i,columns:e,startColumn:s?import_core._.last(e):e[0]}}addCellRange(t){if(!this.gridOptionsService.get("enableRangeSelection"))return;const e=this.createCellRangeFromCellRangeParams(t);e&&(e.startRow&&this.setNewestRangeStartCell({rowIndex:e.startRow.rowIndex,rowPinned:e.startRow.rowPinned,column:e.startColumn}),this.cellRanges.push(e),this.dispatchChangedEvent(!1,!0,e.id))}getCellRanges(){return this.cellRanges}isEmpty(){return this.cellRanges.length===0}isMoreThanOneCell(){const t=this.cellRanges.length;if(t===0)return!1;if(t>1)return!0;const e=this.cellRanges[0],s=this.getRangeStartRow(e),n=this.getRangeEndRow(e);return s.rowPinned!==n.rowPinned||s.rowIndex!==n.rowIndex||e.columns.length!==1}areAllRangesAbleToMerge(){const t=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=t.get(o),r=n.columns.map(a=>a.getId());if(l){const a=r.filter(c=>l.indexOf(c)===-1);l.push(...a)}else t.set(o,r)})});let s;for(const n of t.values()){const i=n.sort().join();if(s===void 0){s=i;continue}if(s!==i)return!1}return!0}forEachRowInRange(t,e){const s=this.getRangeStartRow(t),n=this.getRangeEndRow(t);let i=s;for(;i&&(e(i),!this.rowPositionUtils.sameRow(i,n));)i=this.cellNavigationService.getRowBelow(i)}removeAllCellRanges(t){this.isEmpty()||(this.onDragStop(),this.cellRanges.length=0,t||this.dispatchChangedEvent(!1,!0))}onBodyScroll(){this.dragging&&this.lastMouseEvent&&this.onDragging(this.lastMouseEvent)}isCellInAnyRange(t){return this.getCellRangeCount(t)>0}isCellInSpecificRange(t,e){const s=e.columns!==null&&import_core._.includes(e.columns,t.column),n=this.isRowInRange(t.rowIndex,t.rowPinned,e);return s&&n}isLastCellOfRange(t,e){const{startRow:s,endRow:n}=t,i=this.rowPositionUtils.before(s,n)?n:s,o=e.rowIndex===i.rowIndex&&e.rowPinned===i.rowPinned,l=t.columns[0],r=import_core._.last(t.columns),a=t.startColumn===l?r:l;return e.column===a&&o}isBottomRightCell(t,e){const s=this.columnModel.getAllDisplayedColumns(),n=t.columns.map(c=>s.indexOf(c)).sort((c,g)=>c-g),{startRow:i,endRow:o}=t,l=this.rowPositionUtils.before(i,o)?o:i,r=s.indexOf(e.column)===import_core._.last(n),a=e.rowIndex===l.rowIndex&&import_core._.makeNull(e.rowPinned)===import_core._.makeNull(l.rowPinned);return r&&a}getCellRangeCount(t){return this.isEmpty()?0:this.cellRanges.filter(e=>this.isCellInSpecificRange(t,e)).length}isRowInRange(t,e,s){const n=this.getRangeStartRow(s),i=this.getRangeEndRow(s),o={rowIndex:t,rowPinned:e||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(t){if(!this.gridOptionsService.get("enableRangeSelection"))return;const{ctrlKey:e,metaKey:s,shiftKey:n}=t,i=e||s,l=!this.gridOptionsService.get("suppressMultiRangeSelection")?i:!1,r=n&&import_core._.existsAndNotEmpty(this.cellRanges);!l&&(!r||import_core._.exists(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=t,this.intersectionRange=l&&this.getCellRangeCount(this.lastCellHovered)>1,r||this.setNewestRangeStartCell(this.lastCellHovered),this.cellRanges.length>0)this.draggingRange=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(t){if(t&&this.dragging||this.gridOptionsService.get("suppressMultiRangeSelection")||this.isEmpty())return;const e=import_core._.last(this.cellRanges),s=this.getRangeStartRow(e),n=this.getRangeEndRow(e),i=[];this.cellRanges.slice(0,-1).forEach(o=>{const l=this.getRangeStartRow(o),r=this.getRangeEndRow(o),a=o.columns,c=a.filter(d=>e.columns.indexOf(d)===-1);if(c.length===a.length){i.push(o);return}if(this.rowPositionUtils.before(n,l)||this.rowPositionUtils.before(r,s)){i.push(o);return}const g=i.length;if(this.rowPositionUtils.before(l,s)){const d={columns:[...a],startColumn:e.startColumn,startRow:__spreadValues({},l),endRow:this.cellNavigationService.getRowAbove(s)};i.push(d)}if(c.length>0){const d={columns:c,startColumn:import_core._.includes(c,e.startColumn)?e.startColumn:c[0],startRow:this.rowPositionUtils.rowMax([__spreadValues({},s),__spreadValues({},l)]),endRow:this.rowPositionUtils.rowMin([__spreadValues({},n),__spreadValues({},r)])};i.push(d)}this.rowPositionUtils.before(n,r)&&i.push({columns:[...a],startColumn:e.startColumn,startRow:this.cellNavigationService.getRowBelow(n),endRow:__spreadValues({},r)}),i.length-g===1&&(i[i.length-1].id=o.id)}),this.cellRanges=i,t&&this.dispatchChangedEvent(!1,!0)}updateValuesOnMove(t){const e=import_core._.getCtrlForEventTarget(this.gridOptionsService,t,import_core.CellCtrl.DOM_DATA_KEY_CELL_CTRL),s=e?.getCellPosition();this.cellHasChanged=!1,!(!s||this.lastCellHovered&&this.cellPositionUtils.equals(s,this.lastCellHovered))&&(this.lastCellHovered&&(this.cellHasChanged=!0),this.lastCellHovered=s)}onDragging(t){if(!this.dragging||!t)return;this.updateValuesOnMove(t.target),this.lastMouseEvent=t;const e=this.lastCellHovered,s=o=>e&&e.rowPinned===o&&this.newestRangeStartCell.rowPinned===o,n=s("top")||s("bottom");if(this.autoScrollService.check(t,n),!this.cellHasChanged)return;const i=this.calculateColumnsBetween(this.newestRangeStartCell.column,e.column);i&&(this.draggingRange.endRow={rowIndex:e.rowIndex,rowPinned:e.rowPinned},this.draggingRange.columns=i,this.dispatchChangedEvent(!1,!1,this.draggingRange.id))}onDragStop(){if(!this.dragging)return;const{id:t}=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,t)}dispatchChangedEvent(t,e,s){const n={type:import_core.Events.EVENT_RANGE_SELECTION_CHANGED,started:t,finished:e,id:s};this.eventService.dispatchEvent(n)}calculateColumnsBetween(t,e){const s=this.columnModel.getAllDisplayedColumns(),n=t===e,i=s.indexOf(t);if(i<0){console.warn(`AG Grid: column ${t.getId()} is not visible`);return}const o=n?i:s.indexOf(e);if(o<0){console.warn(`AG Grid: column ${e.getId()} is not visible`);return}if(n)return[t];const l=Math.min(i,o),r=l===i?o:i,a=[];for(let c=l;c<=r;c++)a.push(s[c]);return a}};__decorateClass([(0,import_core.Autowired)("rowModel")],RangeService.prototype,"rowModel",2),__decorateClass([(0,import_core.Autowired)("dragService")],RangeService.prototype,"dragService",2),__decorateClass([(0,import_core.Autowired)("columnModel")],RangeService.prototype,"columnModel",2),__decorateClass([(0,import_core.Autowired)("cellNavigationService")],RangeService.prototype,"cellNavigationService",2),__decorateClass([(0,import_core.Autowired)("pinnedRowModel")],RangeService.prototype,"pinnedRowModel",2),__decorateClass([(0,import_core.Autowired)("rowPositionUtils")],RangeService.prototype,"rowPositionUtils",2),__decorateClass([(0,import_core.Autowired)("cellPositionUtils")],RangeService.prototype,"cellPositionUtils",2),__decorateClass([(0,import_core.Autowired)("ctrlsService")],RangeService.prototype,"ctrlsService",2),__decorateClass([import_core.PostConstruct],RangeService.prototype,"init",1),RangeService=__decorateClass([(0,import_core.Bean)("rangeService")],RangeService);var 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}init(){this.dragService.addDragSource({dragStartPixels:0,eElement:this.getGui(),onDragStart:this.onDragStart.bind(this),onDragging:t=>{this.dragging=!0,this.rangeService.autoScrollService.check(t),this.changedCalculatedValues&&(this.onDrag(t),this.changedCalculatedValues=!1)},onDragStop:t=>{this.dragging=!1,this.onDragEnd(t),this.clearValues(),this.rangeService.autoScrollService.ensureCleared(),document.body.classList.remove(this.getDraggingCssClass()),this.shouldDestroyOnEndDragging&&this.destroy()}}),this.addManagedListener(this.getGui(),"mousedown",this.preventRangeExtension.bind(this))}isDragging(){return this.dragging}getCellCtrl(){return this.cellCtrl}setCellCtrl(t){this.cellCtrl=t}getCellRange(){return this.cellRange}setCellRange(t){this.cellRange=t}getRangeStartRow(){return this.rangeStartRow}setRangeStartRow(t){this.rangeStartRow=t}getRangeEndRow(){return this.rangeEndRow}setRangeEndRow(t){this.rangeEndRow=t}getLastCellHovered(){return this.lastCellHovered}preventRangeExtension(t){t.stopPropagation()}onDragStart(t){this.cellHoverListener=this.addManagedListener(this.ctrlsService.getGridCtrl().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(t){const e=this.mouseEventService.getCellPositionForEvent(t);!e||this.lastCellHovered&&this.cellPositionUtils.equals(e,this.lastCellHovered)||(this.lastCellHovered=e,this.changedCalculatedValues=!0)}getType(){return this.type}refresh(t){const e=this.getCellCtrl(),s=this.getGui(),n=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))),e!==t||!import_core2._.isVisible(s)){this.setCellCtrl(t);const l=t.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()){import_core2._.setDisplayed(this.getGui(),!1),this.shouldDestroyOnEndDragging=!0;return}this.shouldDestroyOnEndDragging=!1,super.destroy(),this.removeListeners();const t=this.getGui();t.parentElement&&t.parentElement.removeChild(t)}};__decorateClass([(0,import_core2.Autowired)("rowRenderer")],AbstractSelectionHandle.prototype,"rowRenderer",2),__decorateClass([(0,import_core2.Autowired)("dragService")],AbstractSelectionHandle.prototype,"dragService",2),__decorateClass([(0,import_core2.Autowired)("rangeService")],AbstractSelectionHandle.prototype,"rangeService",2),__decorateClass([(0,import_core2.Autowired)("mouseEventService")],AbstractSelectionHandle.prototype,"mouseEventService",2),__decorateClass([(0,import_core2.Autowired)("columnModel")],AbstractSelectionHandle.prototype,"columnModel",2),__decorateClass([(0,import_core2.Autowired)("cellNavigationService")],AbstractSelectionHandle.prototype,"cellNavigationService",2),__decorateClass([(0,import_core2.Autowired)("navigationService")],AbstractSelectionHandle.prototype,"navigationService",2),__decorateClass([(0,import_core2.Autowired)("rowPositionUtils")],AbstractSelectionHandle.prototype,"rowPositionUtils",2),__decorateClass([(0,import_core2.Autowired)("cellPositionUtils")],AbstractSelectionHandle.prototype,"cellPositionUtils",2),__decorateClass([(0,import_core2.Autowired)("ctrlsService")],AbstractSelectionHandle.prototype,"ctrlsService",2),__decorateClass([import_core2.PostConstruct],AbstractSelectionHandle.prototype,"init",1);function findLineByLeastSquares(t){const e=t.length;let s=0;if(e<=1)return t;for(let d=0;d<t.length;d++){const h=t[d],m=h.toString().split("e-");if(m.length>1){s=Math.max(s,parseInt(m[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 d=0;d<e;d++)r=t[d],n+=d,i+=r,l+=d*d,o+=d*r;const a=(e*o-n*i)/(e*l-n*n),c=i/e-a*n/e,g=[];for(let d=0;d<=e;d++)g.push(parseFloat((d*a+c).toFixed(s)));return g}var _FillHandle=class M extends AbstractSelectionHandle{constructor(){super(M.TEMPLATE),this.markedCells=[],this.cellValues=[],this.isUp=!1,this.isLeft=!1,this.isReduce=!1,this.type=import_core3.SelectionHandleType.FILL}updateValuesOnMove(e){super.updateValuesOnMove(e),this.initialXY||(this.initialXY=this.mouseEventService.getNormalisedPosition(e));const{x:s,y:n}=this.initialXY,{x:i,y:o}=this.mouseEventService.getNormalisedPosition(e),l=Math.abs(s-i),r=Math.abs(n-o),a=this.getFillHandleDirection();let c;a==="xy"?c=l>r?"x":"y":c=a,c!==this.dragAxis&&(this.dragAxis=c,this.changedCalculatedValues=!0)}onDrag(e){if(!this.initialPosition){const n=this.getCellCtrl();if(!n)return;this.initialPosition=n.getCellPosition()}const s=this.getLastCellHovered();s&&this.markPathFrom(this.initialPosition,s)}onDragEnd(e){if(this.initialXY=null,!this.markedCells.length)return;const s=this.dragAxis==="x",n=this.getCellRange(),i=n.columns.length,o=this.getRangeStartRow(),l=this.getRangeEndRow();let r;if(!this.isUp&&!this.isLeft)r=this.rangeService.createCellRangeFromCellRangeParams({rowStartIndex:o.rowIndex,rowStartPinned:o.rowPinned,columnStart:n.columns[0],rowEndIndex:s?l.rowIndex:this.lastCellMarked.rowIndex,rowEndPinned:s?l.rowPinned:this.lastCellMarked.rowPinned,columnEnd:s?this.lastCellMarked.column:n.columns[i-1]});else{const a=s?o:this.lastCellMarked;r=this.rangeService.createCellRangeFromCellRangeParams({rowStartIndex:a.rowIndex,rowStartPinned:a.rowPinned,columnStart:s?this.lastCellMarked.column:n.columns[0],rowEndIndex:l.rowIndex,rowEndPinned:l.rowPinned,columnEnd:n.columns[i-1]})}r&&(this.raiseFillStartEvent(),this.handleValueChanged(n,r,e),this.rangeService.setCellRanges([r]),this.raiseFillEndEvent(n,r))}getFillHandleDirection(){const e=this.gridOptionsService.get("fillHandleDirection");return e?e!=="x"&&e!=="y"&&e!=="xy"?(import_core3._.warnOnce("valid values for fillHandleDirection are 'x', 'y' and 'xy'. Default to 'xy'."),"xy"):e:"xy"}raiseFillStartEvent(){const e={type:import_core3.Events.EVENT_FILL_START};this.eventService.dispatchEvent(e)}raiseFillEndEvent(e,s){const n={type:import_core3.Events.EVENT_FILL_END,initialRange:e,finalRange:s};this.eventService.dispatchEvent(n)}handleValueChanged(e,s,n){const i=this.rangeService.getRangeEndRow(e),o=this.rangeService.getRangeStartRow(e),l=this.rangeService.getRangeEndRow(s),r=this.rangeService.getRangeStartRow(s),a=this.dragAxis==="y";if(this.isReduce&&!this.gridOptionsService.get("suppressClearOnFillReduction")){const v=a?e.columns:e.columns.filter(w=>s.columns.indexOf(w)<0),f=a?this.cellNavigationService.getRowBelow(l):r;f&&this.clearCellsInRange(f,i,v);return}const c=[],g=[],d=[],h=[];let m=!0,R=0;const u=()=>{c.length=0,g.length=0,d.length=0,h.length=0,R=0},p=(v,f)=>{let w=this.isUp?i:o,x=!1;for(a&&(m=!0,u());!x&&w;){const S=this.rowPositionUtils.getRowNode(w);if(!S)break;a&&v?P(c,v,S,()=>!this.rowPositionUtils.sameRow(w,this.isUp?o:i)):f&&(m=!0,u(),f.forEach(E=>P(c,E,S,()=>E!==(this.isLeft?e.columns[0]:import_core3._.last(e.columns))))),x=this.rowPositionUtils.sameRow(w,this.isUp?r:l),w=this.isUp?this.cellNavigationService.getRowAbove(w):this.cellNavigationService.getRowBelow(w)}},P=(v,f,w,x)=>{var S,E;let C,_=!1;if(m)C=this.valueService.getValue(f,w),g.push(C),d.push(this.valueService.getValue(f,w,void 0,!0)),h.push(this.valueFormatterService.formatValue(f,w,C)),m=x();else{const{value:V,fromUserFunction:I,sourceCol:y,sourceRowNode:A}=this.processValues({event:n,values:v,initialValues:g,initialNonAggregatedValues:d,initialFormattedValues:h,col:f,rowNode:w,idx:R++});if(C=V,f.isCellEditable(w)){const O=this.valueService.getValue(f,w);I||(y&&((S=y.getColDef())==null?void 0:S.useValueFormatterForExport)!==!1&&(C=(E=this.valueFormatterService.formatValue(y,A,C))!=null?E:C),f.getColDef().useValueParserForImport!==!1&&(C=this.valueParserService.parseValue(f,w,y?C:import_core3._.toStringOrNull(C),O))),!I||O!==C?w.setDataValue(f,C,"rangeService"):_=!0}}_||v.push({value:C,column:f,rowNode:w})};if(a)e.columns.forEach(v=>{p(v)});else{const v=this.isLeft?[...s.columns].reverse():s.columns;p(void 0,v)}}clearCellsInRange(e,s,n){const i={startRow:e,endRow:s,columns:n,startColumn:n[0]};this.rangeService.clearCellRangeCellValues({cellRanges:[i]})}processValues(e){const{event:s,values:n,initialValues:i,initialNonAggregatedValues:o,initialFormattedValues:l,col:r,rowNode:a,idx:c}=e,g=this.gridOptionsService.getCallback("fillOperation"),d=this.dragAxis==="y";let h;if(d?h=this.isUp?"up":"down":h=this.isLeft?"left":"right",g){const R={event:s,values:n.map(({value:p})=>p),initialValues:i,initialNonAggregatedValues:o,initialFormattedValues:l,currentIndex:c,currentCellValue:this.valueService.getValue(r,a),direction:h,column:r,rowNode:a},u=g(R);if(u!==!1)return{value:u,fromUserFunction:!0}}const m=!n.some(({value:R})=>{const u=parseFloat(R);return isNaN(u)||u.toString()!==R.toString()});if(s.altKey||!m){if(m&&i.length===1){const P=this.isUp||this.isLeft?-1:1;return{value:parseFloat(import_core3._.last(n).value)+1*P,fromUserFunction:!1}}const{value:R,column:u,rowNode:p}=n[c%n.length];return{value:R,fromUserFunction:!1,sourceCol:u,sourceRowNode:p}}return{value:import_core3._.last(findLineByLeastSquares(n.map(({value:R})=>Number(R)))),fromUserFunction:!1}}clearValues(){this.clearMarkedPath(),this.clearCellValues(),this.lastCellMarked=void 0,super.clearValues()}clearMarkedPath(){this.markedCells.forEach(e=>{if(!e.isAlive())return;const s=e.getComp();s.addOrRemoveCssClass("ag-selection-fill-top",!1),s.addOrRemoveCssClass("ag-selection-fill-right",!1),s.addOrRemoveCssClass("ag-selection-fill-bottom",!1),s.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,s){if(this.clearMarkedPath(),this.clearCellValues(),this.dragAxis==="y"){if(this.rowPositionUtils.sameRow(s,e))return;const n=this.rowPositionUtils.before(s,e),i=this.getRangeStartRow(),o=this.getRangeEndRow();n&&(s.rowPinned==i.rowPinned&&s.rowIndex>=i.rowIndex||i.rowPinned!=o.rowPinned&&s.rowPinned==o.rowPinned&&s.rowIndex<=o.rowIndex)?(this.reduceVertical(e,s),this.isReduce=!0):(this.extendVertical(e,s,n),this.isReduce=!1)}else{const n=e.column,i=s.column;if(n===i)return;const o=this.columnModel.getAllDisplayedColumns(),l=o.indexOf(n),r=o.indexOf(i);r<=l&&r>=o.indexOf(this.getCellRange().columns[0])?(this.reduceHorizontal(e,s),this.isReduce=!0):(this.extendHorizontal(e,s,r<l),this.isReduce=!1)}this.lastCellMarked=s}extendVertical(e,s,n){const{navigationService:i,rangeService:o}=this;let l=e;do{const r=this.getCellRange(),a=r.columns.length;for(let c=0;c<a;c++){const g=r.columns[c],d={rowIndex:l.rowIndex,rowPinned:l.rowPinned},h=__spreadProps(__spreadValues({},d),{column:g}),m=o.isCellInSpecificRange(h,r),R=this.rowPositionUtils.sameRow(l,e);if(n&&(this.isUp=!0),!R){const u=i.getCellByPosition(h);if(u){this.markedCells.push(u);const p=u.getComp();m||(p.addOrRemoveCssClass("ag-selection-fill-left",c===0),p.addOrRemoveCssClass("ag-selection-fill-right",c===a-1)),p.addOrRemoveCssClass(n?"ag-selection-fill-top":"ag-selection-fill-bottom",this.rowPositionUtils.sameRow(l,s))}}}if(this.rowPositionUtils.sameRow(l,s))break}while(l=n?this.cellNavigationService.getRowAbove(l):this.cellNavigationService.getRowBelow(l))}reduceVertical(e,s){let n=e;do{const i=this.getCellRange(),o=i.columns.length,l=this.rowPositionUtils.sameRow(n,s);for(let r=0;r<o;r++){const a={rowIndex:n.rowIndex,rowPinned:n.rowPinned},c=__spreadProps(__spreadValues({},a),{column:i.columns[r]}),g=this.navigationService.getCellByPosition(c);g&&(this.markedCells.push(g),g.getComp().addOrRemoveCssClass("ag-selection-fill-bottom",this.rowPositionUtils.sameRow(n,s)))}if(l)break}while(n=this.cellNavigationService.getRowAbove(n))}extendHorizontal(e,s,n){const i=this.columnModel.getAllDisplayedColumns(),o=i.indexOf(n?s.column:e.column),l=i.indexOf(n?this.getCellRange().columns[0]:s.column),r=n?0:1,a=i.slice(o+r,l+r),c=this.getRangeStartRow(),g=this.getRangeEndRow();a.forEach(d=>{let h=c,m=!1;do{m=this.rowPositionUtils.sameRow(h,g);const R=this.navigationService.getCellByPosition({rowIndex:h.rowIndex,rowPinned:h.rowPinned,column:d});if(R){this.markedCells.push(R);const u=R.getComp();u.addOrRemoveCssClass("ag-selection-fill-top",this.rowPositionUtils.sameRow(h,c)),u.addOrRemoveCssClass("ag-selection-fill-bottom",this.rowPositionUtils.sameRow(h,g)),n?(this.isLeft=!0,u.addOrRemoveCssClass("ag-selection-fill-left",d===a[0])):u.addOrRemoveCssClass("ag-selection-fill-right",d===import_core3._.last(a))}h=this.cellNavigationService.getRowBelow(h)}while(!m)})}reduceHorizontal(e,s){const n=this.columnModel.getAllDisplayedColumns(),i=n.indexOf(s.column),o=n.indexOf(e.column),l=n.slice(i,o),r=this.getRangeStartRow(),a=this.getRangeEndRow();l.forEach(c=>{let g=r,d=!1;do{d=this.rowPositionUtils.sameRow(g,a);const h=this.navigationService.getCellByPosition({rowIndex:g.rowIndex,rowPinned:g.rowPinned,column:c});h&&(this.markedCells.push(h),h.getComp().addOrRemoveCssClass("ag-selection-fill-right",c===l[0])),g=this.cellNavigationService.getRowBelow(g)}while(!d)})}refresh(e){const s=this.rangeService.getCellRanges()[0];if(!s.startRow||!s.endRow){this.destroy();return}super.refresh(e)}};_FillHandle.TEMPLATE='<div class="ag-fill-handle"></div>',__decorateClass([(0,import_core3.Autowired)("valueService")],_FillHandle.prototype,"valueService",2),__decorateClass([(0,import_core3.Autowired)("valueParserService")],_FillHandle.prototype,"valueParserService",2),__decorateClass([(0,import_core3.Autowired)("valueFormatterService")],_FillHandle.prototype,"valueFormatterService",2);var FillHandle=_FillHandle,import_core4=require("@ag-grid-community/core"),_RangeHandle=class L extends AbstractSelectionHandle{constructor(){super(L.TEMPLATE),this.type=import_core4.SelectionHandleType.RANGE,this.rangeFixed=!1}onDrag(e){const s=this.getLastCellHovered();if(!s)return;const n=this.rangeService.getCellRanges(),i=import_core4._.last(n);this.rangeFixed||(this.fixRangeStartEnd(i),this.rangeFixed=!0),this.endPosition={rowIndex:s.rowIndex,rowPinned:s.rowPinned,column:s.column},n.length===2&&n[0].type===import_core4.CellRangeType.DIMENSION&&i.type===import_core4.CellRangeType.VALUE&&!this.rowPositionUtils.sameRow(this.endPosition,this.rangeService.getRangeEndRow(i))&&this.rangeService.updateRangeEnd(n[0],__spreadProps(__spreadValues({},this.endPosition),{column:n[0].columns[0]}),!0),this.rangeService.extendLatestRangeToCell(this.endPosition)}onDragEnd(e){const s=import_core4._.last(this.rangeService.getCellRanges());this.fixRangeStartEnd(s),this.rangeFixed=!1}fixRangeStartEnd(e){const s=this.rangeService.getRangeStartRow(e),n=this.rangeService.getRangeEndRow(e),i=e.columns[0];e.startRow=s,e.endRow=n,e.startColumn=i}};_RangeHandle.TEMPLATE='<div class="ag-range-handle"></div>';var RangeHandle=_RangeHandle,import_core5=require("@ag-grid-community/core"),SelectionHandleFactory=class extends import_core5.BeanStub{createSelectionHandle(t){return this.createBean(t===import_core5.SelectionHandleType.RANGE?new RangeHandle:new FillHandle)}};SelectionHandleFactory=__decorateClass([(0,import_core5.Bean)("selectionHandleFactory")],SelectionHandleFactory);var VERSION="31.2.1",RangeSelectionModule={version:VERSION,moduleName:import_core6.ModuleNames.RangeSelectionModule,beans:[RangeService,SelectionHandleFactory],agStackComponents:[{componentName:"AgFillHandle",componentClass:FillHandle},{componentName:"AgRangeHandle",componentClass:RangeHandle}],dependantModules:[import_core7.EnterpriseCoreModule]}; | ||
var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropNames=Object.getOwnPropertyNames,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,e,s)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,__spreadValues=(t,e)=>{for(var s in e||(e={}))__hasOwnProp.call(e,s)&&__defNormalProp(t,s,e[s]);if(__getOwnPropSymbols)for(var s of __getOwnPropSymbols(e))__propIsEnum.call(e,s)&&__defNormalProp(t,s,e[s]);return t},__spreadProps=(t,e)=>__defProps(t,__getOwnPropDescs(e)),__export=(t,e)=>{for(var s in e)__defProp(t,s,{get:e[s],enumerable:!0})},__copyProps=(t,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of __getOwnPropNames(e))!__hasOwnProp.call(t,o)&&o!==s&&__defProp(t,o,{get:()=>e[o],enumerable:!(n=__getOwnPropDesc(e,o))||n.enumerable});return t},__toCommonJS=t=>__copyProps(__defProp({},"__esModule",{value:!0}),t),__decorateClass=(t,e,s,n)=>{for(var o=n>1?void 0:n?__getOwnPropDesc(e,s):e,i=t.length-1,l;i>=0;i--)(l=t[i])&&(o=(n?l(e,s,o):l(o))||o);return n&&o&&__defProp(e,s,o),o},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"),import_core=require("@ag-grid-community/core"),RangeService=class extends import_core.BeanStub{constructor(){super(...arguments),this.cellRanges=[],this.bodyScrollListener=this.onBodyScroll.bind(this),this.dragging=!1,this.intersectionRange=!1}init(){this.addManagedListener(this.eventService,import_core.Events.EVENT_NEW_COLUMNS_LOADED,()=>this.onColumnsChanged()),this.addManagedListener(this.eventService,import_core.Events.EVENT_COLUMN_VISIBLE,this.onColumnsChanged.bind(this)),this.addManagedListener(this.eventService,import_core.Events.EVENT_COLUMN_VALUE_CHANGED,this.onColumnsChanged.bind(this)),this.addManagedListener(this.eventService,import_core.Events.EVENT_COLUMN_PIVOT_MODE_CHANGED,()=>this.removeAllCellRanges()),this.addManagedListener(this.eventService,import_core.Events.EVENT_COLUMN_ROW_GROUP_CHANGED,()=>this.removeAllCellRanges()),this.addManagedListener(this.eventService,import_core.Events.EVENT_COLUMN_PIVOT_CHANGED,()=>this.removeAllCellRanges()),this.addManagedListener(this.eventService,import_core.Events.EVENT_COLUMN_GROUP_OPENED,this.refreshLastRangeStart.bind(this)),this.addManagedListener(this.eventService,import_core.Events.EVENT_COLUMN_MOVED,this.refreshLastRangeStart.bind(this)),this.addManagedListener(this.eventService,import_core.Events.EVENT_COLUMN_PINNED,this.refreshLastRangeStart.bind(this)),this.ctrlsService.whenReady(t=>{const e=t.gridBodyCtrl;this.autoScrollService=new import_core.AutoScrollService({scrollContainer:e.getBodyViewportElement(),scrollAxis:"xy",getVerticalPosition:()=>e.getScrollFeature().getVScrollPosition().top,setVerticalPosition:s=>e.getScrollFeature().setVerticalScrollPosition(s),getHorizontalPosition:()=>e.getScrollFeature().getHScrollPosition().left,setHorizontalPosition:s=>e.getScrollFeature().setHorizontalScrollPosition(s),shouldSkipVerticalScroll:()=>!this.gos.isDomLayout("normal"),shouldSkipHorizontalScroll:()=>!e.getScrollFeature().isHorizontalScrollShowing()})})}onColumnsChanged(){this.refreshLastRangeStart();const t=this.columnModel.getAllDisplayedColumns();this.cellRanges.forEach(s=>{const n=s.columns;s.columns=s.columns.filter(i=>i.isVisible()&&t.indexOf(i)!==-1),!import_core._.areEqual(n,s.columns)&&this.dispatchChangedEvent(!1,!0,s.id)});const e=this.cellRanges.length;this.cellRanges=this.cellRanges.filter(s=>s.columns.length>0),e>this.cellRanges.length&&this.dispatchChangedEvent(!1,!0)}refreshLastRangeStart(){const t=import_core._.last(this.cellRanges);t&&this.refreshRangeStart(t)}isContiguousRange(t){const e=t.columns;if(!e.length)return!1;const s=this.columnModel.getAllDisplayedColumns(),n=e.map(o=>s.indexOf(o)).sort((o,i)=>o-i);return import_core._.last(n)-n[0]+1===e.length}getRangeStartRow(t){return t.startRow&&t.endRow?this.rowPositionUtils.before(t.startRow,t.endRow)?t.startRow:t.endRow:{rowIndex:0,rowPinned:this.pinnedRowModel.getPinnedTopRowCount()>0?"top":null}}getRangeEndRow(t){if(t.startRow&&t.endRow)return this.rowPositionUtils.before(t.startRow,t.endRow)?t.endRow:t.startRow;const e=this.pinnedRowModel.getPinnedBottomRowCount();return e>0?{rowIndex:e-1,rowPinned:"bottom"}:{rowIndex:this.rowModel.getRowCount()-1,rowPinned:null}}setRangeToCell(t,e=!1){if(!this.gos.get("enableRangeSelection"))return;const s=this.calculateColumnsBetween(t.column,t.column);if(!s)return;(this.gos.get("suppressMultiRangeSelection")||!e||import_core._.missing(this.cellRanges))&&this.removeAllCellRanges(!0);const o={rowIndex:t.rowIndex,rowPinned:t.rowPinned},i={startRow:o,endRow:o,columns:s,startColumn:t.column};this.cellRanges.push(i),this.setNewestRangeStartCell(t),this.onDragStop(),this.dispatchChangedEvent(!0,!0)}extendLatestRangeToCell(t){if(this.isEmpty()||!this.newestRangeStartCell)return;const e=import_core._.last(this.cellRanges);this.updateRangeEnd(e,t)}updateRangeEnd(t,e,s=!1){const n=e.column,o=this.calculateColumnsBetween(t.startColumn,n);!o||this.isLastCellOfRange(t,e)||(t.columns=o,t.endRow={rowIndex:e.rowIndex,rowPinned:e.rowPinned},s||this.dispatchChangedEvent(!0,!0,t.id))}refreshRangeStart(t){const{startColumn:e,columns:s}=t,n=(a,c)=>{const d=t.columns.filter(g=>g!==a);a?(t.startColumn=a,t.columns=c?[a,...d]:[...d,a]):t.columns=d},{left:o,right:i}=this.getRangeEdgeColumns(t);if(e===s[0]&&e!==o){n(o,!0);return}if(e===import_core._.last(s)&&e===i){n(i,!1);return}}getRangeEdgeColumns(t){const e=this.columnModel.getAllDisplayedColumns(),s=t.columns.map(n=>e.indexOf(n)).filter(n=>n>-1).sort((n,o)=>n-o);return{left:e[s[0]],right:e[import_core._.last(s)]}}extendLatestRangeInDirection(t){if(this.isEmpty()||!this.newestRangeStartCell)return;const e=t.key,s=t.ctrlKey||t.metaKey,n=import_core._.last(this.cellRanges),o=this.newestRangeStartCell,i=n.columns[0],l=import_core._.last(n.columns),r=n.endRow.rowIndex,a=n.endRow.rowPinned,d={column:o.column===i?l:i,rowIndex:r,rowPinned:a},g=this.cellNavigationService.getNextCellToFocus(e,d,s);if(g)return this.setCellRange({rowStartIndex:o.rowIndex,rowStartPinned:o.rowPinned,rowEndIndex:g.rowIndex,rowEndPinned:g.rowPinned,columnStart:o.column,columnEnd:g.column}),g}setCellRange(t){this.gos.get("enableRangeSelection")&&(this.removeAllCellRanges(!0),this.addCellRange(t))}setCellRanges(t){import_core._.shallowCompare(this.cellRanges,t)||(this.removeAllCellRanges(!0),t.forEach(e=>{e.columns&&e.startRow&&this.setNewestRangeStartCell({rowIndex:e.startRow.rowIndex,rowPinned:e.startRow.rowPinned,column:e.columns[0]}),this.cellRanges.push(e)}),this.dispatchChangedEvent(!1,!0))}setNewestRangeStartCell(t){this.newestRangeStartCell=t}clearCellRangeCellValues(t){let{cellRanges:e}=t;const{cellEventSource:s="rangeService",dispatchWrapperEvents:n,wrapperEventSource:o="deleteKey"}=t;if(n){const i={type:import_core.Events.EVENT_RANGE_DELETE_START,source:o};this.eventService.dispatchEvent(i)}if(e||(e=this.cellRanges),e.forEach(i=>{this.forEachRowInRange(i,l=>{var r;const a=this.rowPositionUtils.getRowNode(l);if(a)for(let c=0;c<i.columns.length;c++){const d=this.columnModel.getGridColumn(i.columns[c]);if(!d||!d.isCellEditable(a))continue;const g=(r=this.valueService.parseValue(d,a,"",a.getValueFromValueService(d)))!=null?r:null;a.setDataValue(d,g,s)}})}),n){const i={type:import_core.Events.EVENT_RANGE_DELETE_END,source:o};this.eventService.dispatchEvent(i)}}createCellRangeFromCellRangeParams(t){return this.createPartialCellRangeFromRangeParams(t,!1)}createPartialCellRangeFromRangeParams(t,e){let s,n=!1;if(t.columns)s=t.columns.map(l=>this.columnModel.getColumnWithValidation(l)).filter(l=>l);else{const l=this.columnModel.getColumnWithValidation(t.columnStart),r=this.columnModel.getColumnWithValidation(t.columnEnd);if(!l||!r)return;s=this.calculateColumnsBetween(l,r),s&&s.length&&(n=s[0]!==l)}if(!s||!e&&s.length===0)return;const o=t.rowStartIndex!=null?{rowIndex:t.rowStartIndex,rowPinned:t.rowStartPinned||null}:void 0,i=t.rowEndIndex!=null?{rowIndex:t.rowEndIndex,rowPinned:t.rowEndPinned||null}:void 0;return{startRow:o,endRow:i,columns:s,startColumn:n?import_core._.last(s):s[0]}}addCellRange(t){if(!this.gos.get("enableRangeSelection"))return;const e=this.createCellRangeFromCellRangeParams(t);e&&(e.startRow&&this.setNewestRangeStartCell({rowIndex:e.startRow.rowIndex,rowPinned:e.startRow.rowPinned,column:e.startColumn}),this.cellRanges.push(e),this.dispatchChangedEvent(!1,!0,e.id))}getCellRanges(){return this.cellRanges}isEmpty(){return this.cellRanges.length===0}isMoreThanOneCell(){const t=this.cellRanges.length;if(t===0)return!1;if(t>1)return!0;const e=this.cellRanges[0],s=this.getRangeStartRow(e),n=this.getRangeEndRow(e);return s.rowPinned!==n.rowPinned||s.rowIndex!==n.rowIndex||e.columns.length!==1}areAllRangesAbleToMerge(){const t=new Map;if(this.cellRanges.length<=1)return!0;this.cellRanges.forEach(n=>{this.forEachRowInRange(n,o=>{const i=`${o.rowPinned||"normal"}_${o.rowIndex}`,l=t.get(i),r=n.columns.map(a=>a.getId());if(l){const a=r.filter(c=>l.indexOf(c)===-1);l.push(...a)}else t.set(i,r)})});let s;for(const n of t.values()){const o=n.sort().join();if(s===void 0){s=o;continue}if(s!==o)return!1}return!0}forEachRowInRange(t,e){const s=this.getRangeStartRow(t),n=this.getRangeEndRow(t);let o=s;for(;o&&(e(o),!this.rowPositionUtils.sameRow(o,n));)o=this.cellNavigationService.getRowBelow(o)}removeAllCellRanges(t){this.isEmpty()||(this.onDragStop(),this.cellRanges.length=0,t||this.dispatchChangedEvent(!1,!0))}onBodyScroll(){this.dragging&&this.lastMouseEvent&&this.onDragging(this.lastMouseEvent)}isCellInAnyRange(t){return this.getCellRangeCount(t)>0}isCellInSpecificRange(t,e){const s=e.columns!==null&&import_core._.includes(e.columns,t.column),n=this.isRowInRange(t.rowIndex,t.rowPinned,e);return s&&n}isLastCellOfRange(t,e){const{startRow:s,endRow:n}=t,o=this.rowPositionUtils.before(s,n)?n:s,i=e.rowIndex===o.rowIndex&&e.rowPinned===o.rowPinned,l=t.columns[0],r=import_core._.last(t.columns),a=t.startColumn===l?r:l;return e.column===a&&i}isBottomRightCell(t,e){const s=this.columnModel.getAllDisplayedColumns(),n=t.columns.map(c=>s.indexOf(c)).sort((c,d)=>c-d),{startRow:o,endRow:i}=t,l=this.rowPositionUtils.before(o,i)?i:o,r=s.indexOf(e.column)===import_core._.last(n),a=e.rowIndex===l.rowIndex&&import_core._.makeNull(e.rowPinned)===import_core._.makeNull(l.rowPinned);return r&&a}getCellRangeCount(t){return this.isEmpty()?0:this.cellRanges.filter(e=>this.isCellInSpecificRange(t,e)).length}isRowInRange(t,e,s){const n=this.getRangeStartRow(s),o=this.getRangeEndRow(s),i={rowIndex:t,rowPinned:e||null},l=i.rowIndex===n.rowIndex&&i.rowPinned==n.rowPinned,r=i.rowIndex===o.rowIndex&&i.rowPinned==o.rowPinned;if(l||r)return!0;const a=!this.rowPositionUtils.before(i,n),c=this.rowPositionUtils.before(i,o);return a&&c}getDraggingRange(){return this.draggingRange}onDragStart(t){if(!this.gos.get("enableRangeSelection"))return;const{ctrlKey:e,metaKey:s,shiftKey:n}=t,o=e||s,l=!this.gos.get("suppressMultiRangeSelection")?o:!1,r=n&&import_core._.existsAndNotEmpty(this.cellRanges);!l&&(!r||import_core._.exists(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=t,this.intersectionRange=l&&this.getCellRangeCount(this.lastCellHovered)>1,r||this.setNewestRangeStartCell(this.lastCellHovered),this.cellRanges.length>0)this.draggingRange=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(t){if(t&&this.dragging||this.gos.get("suppressMultiRangeSelection")||this.isEmpty())return;const e=this.rowPositionUtils,s=import_core._.last(this.cellRanges),n=this.getRangeStartRow(s),o=this.getRangeEndRow(s),i=[];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){i.push(l);return}if(e.before(o,r)||e.before(a,n)){i.push(l);return}const g=i.length;if(e.before(r,n)){const h={columns:[...c],startColumn:s.startColumn,startRow:__spreadValues({},r),endRow:this.cellNavigationService.getRowAbove(n)};i.push(h)}if(d.length>0){const h={columns:d,startColumn:import_core._.includes(d,s.startColumn)?s.startColumn:d[0],startRow:this.rowMax([__spreadValues({},n),__spreadValues({},r)]),endRow:this.rowMin([__spreadValues({},o),__spreadValues({},a)])};i.push(h)}e.before(o,a)&&i.push({columns:[...c],startColumn:s.startColumn,startRow:this.cellNavigationService.getRowBelow(o),endRow:__spreadValues({},a)}),i.length-g===1&&(i[i.length-1].id=l.id)}),this.cellRanges=i,t&&this.dispatchChangedEvent(!1,!0)}rowMax(t){let e;return t.forEach(s=>{(e===void 0||this.rowPositionUtils.before(e,s))&&(e=s)}),e}rowMin(t){let e;return t.forEach(s=>{(e===void 0||this.rowPositionUtils.before(s,e))&&(e=s)}),e}updateValuesOnMove(t){const e=import_core._.getCtrlForEventTarget(this.gos,t,import_core.CellCtrl.DOM_DATA_KEY_CELL_CTRL),s=e?.getCellPosition();this.cellHasChanged=!1,!(!s||this.lastCellHovered&&this.cellPositionUtils.equals(s,this.lastCellHovered))&&(this.lastCellHovered&&(this.cellHasChanged=!0),this.lastCellHovered=s)}onDragging(t){if(!this.dragging||!t)return;this.updateValuesOnMove(t.target),this.lastMouseEvent=t;const e=this.lastCellHovered,s=i=>e&&e.rowPinned===i&&this.newestRangeStartCell.rowPinned===i,n=s("top")||s("bottom");if(this.autoScrollService.check(t,n),!this.cellHasChanged)return;const o=this.calculateColumnsBetween(this.newestRangeStartCell.column,e.column);o&&(this.draggingRange.endRow={rowIndex:e.rowIndex,rowPinned:e.rowPinned},this.draggingRange.columns=o,this.dispatchChangedEvent(!1,!1,this.draggingRange.id))}onDragStop(){if(!this.dragging)return;const{id:t}=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,t)}dispatchChangedEvent(t,e,s){const n={type:import_core.Events.EVENT_RANGE_SELECTION_CHANGED,started:t,finished:e,id:s};this.eventService.dispatchEvent(n)}calculateColumnsBetween(t,e){const s=this.columnModel.getAllDisplayedColumns(),n=t===e,o=s.indexOf(t);if(o<0){console.warn(`AG Grid: column ${t.getId()} is not visible`);return}const i=n?o:s.indexOf(e);if(i<0){console.warn(`AG Grid: column ${e.getId()} is not visible`);return}if(n)return[t];const l=Math.min(o,i),r=l===o?i:o,a=[];for(let c=l;c<=r;c++)a.push(s[c]);return a}};__decorateClass([(0,import_core.Autowired)("rowModel")],RangeService.prototype,"rowModel",2),__decorateClass([(0,import_core.Autowired)("dragService")],RangeService.prototype,"dragService",2),__decorateClass([(0,import_core.Autowired)("columnModel")],RangeService.prototype,"columnModel",2),__decorateClass([(0,import_core.Autowired)("cellNavigationService")],RangeService.prototype,"cellNavigationService",2),__decorateClass([(0,import_core.Autowired)("pinnedRowModel")],RangeService.prototype,"pinnedRowModel",2),__decorateClass([(0,import_core.Autowired)("rowPositionUtils")],RangeService.prototype,"rowPositionUtils",2),__decorateClass([(0,import_core.Autowired)("cellPositionUtils")],RangeService.prototype,"cellPositionUtils",2),__decorateClass([(0,import_core.Autowired)("ctrlsService")],RangeService.prototype,"ctrlsService",2),__decorateClass([(0,import_core.Autowired)("valueService")],RangeService.prototype,"valueService",2),__decorateClass([import_core.PostConstruct],RangeService.prototype,"init",1),RangeService=__decorateClass([(0,import_core.Bean)("rangeService")],RangeService);var 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}init(){this.dragService.addDragSource({dragStartPixels:0,eElement:this.getGui(),onDragStart:this.onDragStart.bind(this),onDragging:t=>{this.dragging=!0,this.rangeService.autoScrollService.check(t),this.changedCalculatedValues&&(this.onDrag(t),this.changedCalculatedValues=!1)},onDragStop:t=>{this.dragging=!1,this.onDragEnd(t),this.clearValues(),this.rangeService.autoScrollService.ensureCleared(),document.body.classList.remove(this.getDraggingCssClass()),this.shouldDestroyOnEndDragging&&this.destroy()}}),this.addManagedListener(this.getGui(),"mousedown",this.preventRangeExtension.bind(this))}isDragging(){return this.dragging}getCellCtrl(){return this.cellCtrl}setCellCtrl(t){this.cellCtrl=t}getCellRange(){return this.cellRange}setCellRange(t){this.cellRange=t}getRangeStartRow(){return this.rangeStartRow}setRangeStartRow(t){this.rangeStartRow=t}getRangeEndRow(){return this.rangeEndRow}setRangeEndRow(t){this.rangeEndRow=t}getLastCellHovered(){return this.lastCellHovered}preventRangeExtension(t){t.stopPropagation()}onDragStart(t){this.cellHoverListener=this.addManagedListener(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(t){const e=this.mouseEventService.getCellPositionForEvent(t);!e||this.lastCellHovered&&this.cellPositionUtils.equals(e,this.lastCellHovered)||(this.lastCellHovered=e,this.changedCalculatedValues=!0)}getType(){return this.type}refresh(t){const e=this.getCellCtrl(),s=this.getGui(),n=import_core2._.last(this.rangeService.getCellRanges()),o=n.startRow,i=n.endRow;if(o&&i&&(this.rowPositionUtils.before(i,o)?(this.setRangeStartRow(i),this.setRangeEndRow(o)):(this.setRangeStartRow(o),this.setRangeEndRow(i))),e!==t||!import_core2._.isVisible(s)){this.setCellCtrl(t);const l=t.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()){import_core2._.setDisplayed(this.getGui(),!1),this.shouldDestroyOnEndDragging=!0;return}this.shouldDestroyOnEndDragging=!1,super.destroy(),this.removeListeners();const t=this.getGui();t.parentElement&&t.parentElement.removeChild(t)}};__decorateClass([(0,import_core2.Autowired)("rowRenderer")],AbstractSelectionHandle.prototype,"rowRenderer",2),__decorateClass([(0,import_core2.Autowired)("dragService")],AbstractSelectionHandle.prototype,"dragService",2),__decorateClass([(0,import_core2.Autowired)("rangeService")],AbstractSelectionHandle.prototype,"rangeService",2),__decorateClass([(0,import_core2.Autowired)("mouseEventService")],AbstractSelectionHandle.prototype,"mouseEventService",2),__decorateClass([(0,import_core2.Autowired)("columnModel")],AbstractSelectionHandle.prototype,"columnModel",2),__decorateClass([(0,import_core2.Autowired)("cellNavigationService")],AbstractSelectionHandle.prototype,"cellNavigationService",2),__decorateClass([(0,import_core2.Autowired)("navigationService")],AbstractSelectionHandle.prototype,"navigationService",2),__decorateClass([(0,import_core2.Autowired)("rowPositionUtils")],AbstractSelectionHandle.prototype,"rowPositionUtils",2),__decorateClass([(0,import_core2.Autowired)("cellPositionUtils")],AbstractSelectionHandle.prototype,"cellPositionUtils",2),__decorateClass([(0,import_core2.Autowired)("ctrlsService")],AbstractSelectionHandle.prototype,"ctrlsService",2),__decorateClass([import_core2.PostConstruct],AbstractSelectionHandle.prototype,"init",1);function findLineByLeastSquares(t){const e=t.length;let s=0;if(e<=1)return t;for(let g=0;g<t.length;g++){const h=t[g],m=h.toString().split("e-");if(m.length>1){s=Math.max(s,parseInt(m[1],10));continue}Math.floor(h)!==h&&(s=Math.max(s,h.toString().split(".")[1].length))}let n=0,o=0,i=0,l=0,r=0;for(let g=0;g<e;g++)r=t[g],n+=g,o+=r,l+=g*g,i+=g*r;const a=(e*i-n*o)/(e*l-n*n),c=o/e-a*n/e,d=[];for(let g=0;g<=e;g++)d.push(parseFloat((g*a+c).toFixed(s)));return d}var _FillHandle=class V extends AbstractSelectionHandle{constructor(){super(V.TEMPLATE),this.markedCells=[],this.cellValues=[],this.isUp=!1,this.isLeft=!1,this.isReduce=!1,this.type=import_core3.SelectionHandleType.FILL}updateValuesOnMove(e){super.updateValuesOnMove(e),this.initialXY||(this.initialXY=this.mouseEventService.getNormalisedPosition(e));const{x:s,y:n}=this.initialXY,{x:o,y:i}=this.mouseEventService.getNormalisedPosition(e),l=Math.abs(s-o),r=Math.abs(n-i),a=this.getFillHandleDirection();let c;a==="xy"?c=l>r?"x":"y":c=a,c!==this.dragAxis&&(this.dragAxis=c,this.changedCalculatedValues=!0)}onDrag(e){if(!this.initialPosition){const n=this.getCellCtrl();if(!n)return;this.initialPosition=n.getCellPosition()}const s=this.getLastCellHovered();s&&this.markPathFrom(this.initialPosition,s)}onDragEnd(e){if(this.initialXY=null,!this.markedCells.length)return;const s=this.dragAxis==="x",n=this.getCellRange(),o=n.columns.length,i=this.getRangeStartRow(),l=this.getRangeEndRow();let r;if(!this.isUp&&!this.isLeft)r=this.rangeService.createCellRangeFromCellRangeParams({rowStartIndex:i.rowIndex,rowStartPinned:i.rowPinned,columnStart:n.columns[0],rowEndIndex:s?l.rowIndex:this.lastCellMarked.rowIndex,rowEndPinned:s?l.rowPinned:this.lastCellMarked.rowPinned,columnEnd:s?this.lastCellMarked.column:n.columns[o-1]});else{const a=s?i:this.lastCellMarked;r=this.rangeService.createCellRangeFromCellRangeParams({rowStartIndex:a.rowIndex,rowStartPinned:a.rowPinned,columnStart:s?this.lastCellMarked.column:n.columns[0],rowEndIndex:l.rowIndex,rowEndPinned:l.rowPinned,columnEnd:n.columns[o-1]})}r&&(this.raiseFillStartEvent(),this.handleValueChanged(n,r,e),this.rangeService.setCellRanges([r]),this.raiseFillEndEvent(n,r))}getFillHandleDirection(){const e=this.gos.get("fillHandleDirection");return e?e!=="x"&&e!=="y"&&e!=="xy"?(import_core3._.warnOnce("valid values for fillHandleDirection are 'x', 'y' and 'xy'. Default to 'xy'."),"xy"):e:"xy"}raiseFillStartEvent(){const e={type:import_core3.Events.EVENT_FILL_START};this.eventService.dispatchEvent(e)}raiseFillEndEvent(e,s){const n={type:import_core3.Events.EVENT_FILL_END,initialRange:e,finalRange:s};this.eventService.dispatchEvent(n)}handleValueChanged(e,s,n){const o=this.rangeService.getRangeEndRow(e),i=this.rangeService.getRangeStartRow(e),l=this.rangeService.getRangeEndRow(s),r=this.rangeService.getRangeStartRow(s),a=this.dragAxis==="y";if(this.isReduce&&!this.gos.get("suppressClearOnFillReduction")){const v=a?e.columns:e.columns.filter(w=>s.columns.indexOf(w)<0),f=a?this.cellNavigationService.getRowBelow(l):r;f&&this.clearCellsInRange(f,o,v);return}const c=[],d=[],g=[],h=[];let m=!0,R=0;const u=()=>{c.length=0,d.length=0,g.length=0,h.length=0,R=0},p=(v,f)=>{let w=this.isUp?o:i,x=!1;for(a&&(m=!0,u());!x&&w;){const S=this.rowPositionUtils.getRowNode(w);if(!S)break;a&&v?P(c,v,S,()=>!this.rowPositionUtils.sameRow(w,this.isUp?i:o)):f&&(m=!0,u(),f.forEach(E=>P(c,E,S,()=>E!==(this.isLeft?e.columns[0]:import_core3._.last(e.columns))))),x=this.rowPositionUtils.sameRow(w,this.isUp?r:l),w=this.isUp?this.cellNavigationService.getRowAbove(w):this.cellNavigationService.getRowBelow(w)}},P=(v,f,w,x)=>{var S,E;let C,_=!1;if(m)C=this.valueService.getValue(f,w),d.push(C),g.push(this.valueService.getValue(f,w,void 0,!0)),h.push(this.valueService.formatValue(f,w,C)),m=x();else{const{value:O,fromUserFunction:I,sourceCol:y,sourceRowNode:N}=this.processValues({event:n,values:v,initialValues:d,initialNonAggregatedValues:g,initialFormattedValues:h,col:f,rowNode:w,idx:R++});if(C=O,f.isCellEditable(w)){const M=this.valueService.getValue(f,w);I||(y&&((S=y.getColDef())==null?void 0:S.useValueFormatterForExport)!==!1&&(C=(E=this.valueService.formatValue(y,N,C))!=null?E:C),f.getColDef().useValueParserForImport!==!1&&(C=this.valueService.parseValue(f,w,y?C:import_core3._.toStringOrNull(C),M))),!I||M!==C?w.setDataValue(f,C,"rangeService"):_=!0}}_||v.push({value:C,column:f,rowNode:w})};if(a)e.columns.forEach(v=>{p(v)});else{const v=this.isLeft?[...s.columns].reverse():s.columns;p(void 0,v)}}clearCellsInRange(e,s,n){const o={startRow:e,endRow:s,columns:n,startColumn:n[0]};this.rangeService.clearCellRangeCellValues({cellRanges:[o]})}processValues(e){const{event:s,values:n,initialValues:o,initialNonAggregatedValues:i,initialFormattedValues:l,col:r,rowNode:a,idx:c}=e,d=this.gos.getCallback("fillOperation"),g=this.dragAxis==="y";let h;if(g?h=this.isUp?"up":"down":h=this.isLeft?"left":"right",d){const R={event:s,values:n.map(({value:p})=>p),initialValues:o,initialNonAggregatedValues:i,initialFormattedValues:l,currentIndex:c,currentCellValue:this.valueService.getValue(r,a),direction:h,column:r,rowNode:a},u=d(R);if(u!==!1)return{value:u,fromUserFunction:!0}}const m=!n.some(({value:R})=>{const u=parseFloat(R);return isNaN(u)||u.toString()!==R.toString()});if(s.altKey||!m){if(m&&o.length===1){const P=this.isUp||this.isLeft?-1:1;return{value:parseFloat(import_core3._.last(n).value)+1*P,fromUserFunction:!1}}const{value:R,column:u,rowNode:p}=n[c%n.length];return{value:R,fromUserFunction:!1,sourceCol:u,sourceRowNode:p}}return{value:import_core3._.last(findLineByLeastSquares(n.map(({value:R})=>Number(R)))),fromUserFunction:!1}}clearValues(){this.clearMarkedPath(),this.clearCellValues(),this.lastCellMarked=void 0,super.clearValues()}clearMarkedPath(){this.markedCells.forEach(e=>{if(!e.isAlive())return;const s=e.getComp();s.addOrRemoveCssClass("ag-selection-fill-top",!1),s.addOrRemoveCssClass("ag-selection-fill-right",!1),s.addOrRemoveCssClass("ag-selection-fill-bottom",!1),s.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,s){if(this.clearMarkedPath(),this.clearCellValues(),this.dragAxis==="y"){if(this.rowPositionUtils.sameRow(s,e))return;const n=this.rowPositionUtils.before(s,e),o=this.getRangeStartRow(),i=this.getRangeEndRow();n&&(s.rowPinned==o.rowPinned&&s.rowIndex>=o.rowIndex||o.rowPinned!=i.rowPinned&&s.rowPinned==i.rowPinned&&s.rowIndex<=i.rowIndex)?(this.reduceVertical(e,s),this.isReduce=!0):(this.extendVertical(e,s,n),this.isReduce=!1)}else{const n=e.column,o=s.column;if(n===o)return;const i=this.columnModel.getAllDisplayedColumns(),l=i.indexOf(n),r=i.indexOf(o);r<=l&&r>=i.indexOf(this.getCellRange().columns[0])?(this.reduceHorizontal(e,s),this.isReduce=!0):(this.extendHorizontal(e,s,r<l),this.isReduce=!1)}this.lastCellMarked=s}extendVertical(e,s,n){const{navigationService:o,rangeService:i}=this;let l=e;do{const r=this.getCellRange(),a=r.columns.length;for(let c=0;c<a;c++){const d=r.columns[c],g={rowIndex:l.rowIndex,rowPinned:l.rowPinned},h=__spreadProps(__spreadValues({},g),{column:d}),m=i.isCellInSpecificRange(h,r),R=this.rowPositionUtils.sameRow(l,e);if(n&&(this.isUp=!0),!R){const u=o.getCellByPosition(h);if(u){this.markedCells.push(u);const p=u.getComp();m||(p.addOrRemoveCssClass("ag-selection-fill-left",c===0),p.addOrRemoveCssClass("ag-selection-fill-right",c===a-1)),p.addOrRemoveCssClass(n?"ag-selection-fill-top":"ag-selection-fill-bottom",this.rowPositionUtils.sameRow(l,s))}}}if(this.rowPositionUtils.sameRow(l,s))break}while(l=n?this.cellNavigationService.getRowAbove(l):this.cellNavigationService.getRowBelow(l))}reduceVertical(e,s){let n=e;do{const o=this.getCellRange(),i=o.columns.length,l=this.rowPositionUtils.sameRow(n,s);for(let r=0;r<i;r++){const a={rowIndex:n.rowIndex,rowPinned:n.rowPinned},c=__spreadProps(__spreadValues({},a),{column:o.columns[r]}),d=this.navigationService.getCellByPosition(c);d&&(this.markedCells.push(d),d.getComp().addOrRemoveCssClass("ag-selection-fill-bottom",this.rowPositionUtils.sameRow(n,s)))}if(l)break}while(n=this.cellNavigationService.getRowAbove(n))}extendHorizontal(e,s,n){const o=this.columnModel.getAllDisplayedColumns(),i=o.indexOf(n?s.column:e.column),l=o.indexOf(n?this.getCellRange().columns[0]:s.column),r=n?0:1,a=o.slice(i+r,l+r),c=this.getRangeStartRow(),d=this.getRangeEndRow();a.forEach(g=>{let h=c,m=!1;do{m=this.rowPositionUtils.sameRow(h,d);const R=this.navigationService.getCellByPosition({rowIndex:h.rowIndex,rowPinned:h.rowPinned,column:g});if(R){this.markedCells.push(R);const u=R.getComp();u.addOrRemoveCssClass("ag-selection-fill-top",this.rowPositionUtils.sameRow(h,c)),u.addOrRemoveCssClass("ag-selection-fill-bottom",this.rowPositionUtils.sameRow(h,d)),n?(this.isLeft=!0,u.addOrRemoveCssClass("ag-selection-fill-left",g===a[0])):u.addOrRemoveCssClass("ag-selection-fill-right",g===import_core3._.last(a))}h=this.cellNavigationService.getRowBelow(h)}while(!m)})}reduceHorizontal(e,s){const n=this.columnModel.getAllDisplayedColumns(),o=n.indexOf(s.column),i=n.indexOf(e.column),l=n.slice(o,i),r=this.getRangeStartRow(),a=this.getRangeEndRow();l.forEach(c=>{let d=r,g=!1;do{g=this.rowPositionUtils.sameRow(d,a);const h=this.navigationService.getCellByPosition({rowIndex:d.rowIndex,rowPinned:d.rowPinned,column:c});h&&(this.markedCells.push(h),h.getComp().addOrRemoveCssClass("ag-selection-fill-right",c===l[0])),d=this.cellNavigationService.getRowBelow(d)}while(!g)})}refresh(e){const s=this.rangeService.getCellRanges()[0];if(!s.startRow||!s.endRow){this.destroy();return}super.refresh(e)}};_FillHandle.TEMPLATE='<div class="ag-fill-handle"></div>',__decorateClass([(0,import_core3.Autowired)("valueService")],_FillHandle.prototype,"valueService",2);var FillHandle=_FillHandle,import_core4=require("@ag-grid-community/core"),_RangeHandle=class L extends AbstractSelectionHandle{constructor(){super(L.TEMPLATE),this.type=import_core4.SelectionHandleType.RANGE,this.rangeFixed=!1}onDrag(e){const s=this.getLastCellHovered();if(!s)return;const n=this.rangeService.getCellRanges(),o=import_core4._.last(n);this.rangeFixed||(this.fixRangeStartEnd(o),this.rangeFixed=!0),this.endPosition={rowIndex:s.rowIndex,rowPinned:s.rowPinned,column:s.column},n.length===2&&n[0].type===import_core4.CellRangeType.DIMENSION&&o.type===import_core4.CellRangeType.VALUE&&!this.rowPositionUtils.sameRow(this.endPosition,this.rangeService.getRangeEndRow(o))&&this.rangeService.updateRangeEnd(n[0],__spreadProps(__spreadValues({},this.endPosition),{column:n[0].columns[0]}),!0),this.rangeService.extendLatestRangeToCell(this.endPosition)}onDragEnd(e){const s=import_core4._.last(this.rangeService.getCellRanges());this.fixRangeStartEnd(s),this.rangeFixed=!1}fixRangeStartEnd(e){const s=this.rangeService.getRangeStartRow(e),n=this.rangeService.getRangeEndRow(e),o=e.columns[0];e.startRow=s,e.endRow=n,e.startColumn=o}};_RangeHandle.TEMPLATE='<div class="ag-range-handle"></div>';var RangeHandle=_RangeHandle,import_core5=require("@ag-grid-community/core"),SelectionHandleFactory=class extends import_core5.BeanStub{createSelectionHandle(t){return this.createBean(t===import_core5.SelectionHandleType.RANGE?new RangeHandle:new FillHandle)}};SelectionHandleFactory=__decorateClass([(0,import_core5.Bean)("selectionHandleFactory")],SelectionHandleFactory);var VERSION="31.3.0",RangeSelectionModule={version:VERSION,moduleName:import_core6.ModuleNames.RangeSelectionModule,beans:[RangeService,SelectionHandleFactory],agStackComponents:[{componentName:"AgFillHandle",componentClass:FillHandle},{componentName:"AgRangeHandle",componentClass:RangeHandle}],dependantModules:[import_core7.EnterpriseCoreModule]}; |
{ | ||
"name": "@ag-grid-enterprise/range-selection", | ||
"version": "31.2.1", | ||
"version": "31.3.0", | ||
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue", | ||
@@ -15,4 +15,4 @@ "main": "./dist/package/main.cjs.js", | ||
"dependencies": { | ||
"@ag-grid-community/core": "31.2.1", | ||
"@ag-grid-enterprise/core": "31.2.1" | ||
"@ag-grid-community/core": "31.3.0", | ||
"@ag-grid-enterprise/core": "31.3.0" | ||
}, | ||
@@ -19,0 +19,0 @@ "devDependencies": { |
{ | ||
"name": "@ag-grid-enterprise/range-selection", | ||
"version": "31.2.1", | ||
"version": "31.3.0", | ||
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue", | ||
@@ -15,4 +15,4 @@ "main": "./src/main.js", | ||
"dependencies": { | ||
"@ag-grid-community/core": "31.2.1", | ||
"@ag-grid-enterprise/core": "31.2.1" | ||
"@ag-grid-community/core": "31.3.0", | ||
"@ag-grid-enterprise/core": "31.3.0" | ||
}, | ||
@@ -19,0 +19,0 @@ "devDependencies": { |
@@ -5,4 +5,2 @@ import { SelectionHandleType, CellCtrl } from '@ag-grid-community/core'; | ||
private valueService; | ||
private valueParserService; | ||
private valueFormatterService; | ||
static TEMPLATE: string; | ||
@@ -9,0 +7,0 @@ private initialPosition; |
@@ -1,2 +0,2 @@ | ||
import { CellPosition, CellPositionUtils, Column, IRangeService, CellRangeParams, CellRange, RowPosition, RowPositionUtils, BeanStub, CtrlsService, AutoScrollService, ClearCellRangeParams } from "@ag-grid-community/core"; | ||
import { CellPosition, CellPositionUtils, Column, IRangeService, CellRangeParams, CellRange, RowPosition, RowPositionUtils, BeanStub, CtrlsService, AutoScrollService, ClearCellRangeParams, PartialCellRange } from "@ag-grid-community/core"; | ||
export declare class RangeService extends BeanStub implements IRangeService { | ||
@@ -11,2 +11,3 @@ private rowModel; | ||
ctrlsService: CtrlsService; | ||
private valueService; | ||
private cellRanges; | ||
@@ -26,4 +27,4 @@ private lastMouseEvent; | ||
isContiguousRange(cellRange: CellRange): boolean; | ||
getRangeStartRow(cellRange: CellRange): RowPosition; | ||
getRangeEndRow(cellRange: CellRange): RowPosition; | ||
getRangeStartRow(cellRange: PartialCellRange): RowPosition; | ||
getRangeEndRow(cellRange: PartialCellRange): RowPosition; | ||
setRangeToCell(cell: CellPosition, appendRange?: boolean): void; | ||
@@ -43,2 +44,3 @@ extendLatestRangeToCell(cellPosition: CellPosition): void; | ||
createCellRangeFromCellRangeParams(params: CellRangeParams): CellRange | undefined; | ||
createPartialCellRangeFromRangeParams(params: CellRangeParams, allowEmptyColumns: boolean): PartialCellRange | undefined; | ||
addCellRange(params: CellRangeParams): void; | ||
@@ -61,2 +63,4 @@ getCellRanges(): CellRange[]; | ||
intersectLastRange(fromMouseClick?: boolean): void; | ||
private rowMax; | ||
private rowMin; | ||
private updateValuesOnMove; | ||
@@ -63,0 +67,0 @@ onDragging(mouseEvent: MouseEvent | null): void; |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "31.2.1"; | ||
export declare const VERSION = "31.3.0"; |
{ | ||
"name": "@ag-grid-enterprise/range-selection", | ||
"version": "31.2.1", | ||
"version": "31.3.0", | ||
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue", | ||
@@ -15,4 +15,4 @@ "main": "./dist/package/main.cjs.js", | ||
"dependencies": { | ||
"@ag-grid-community/core": "31.2.1", | ||
"@ag-grid-enterprise/core": "31.2.1" | ||
"@ag-grid-community/core": "31.3.0", | ||
"@ag-grid-enterprise/core": "31.3.0" | ||
}, | ||
@@ -19,0 +19,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
301364
3472
+ Added@ag-grid-community/core@31.3.0(transitive)
+ Added@ag-grid-enterprise/core@31.3.0(transitive)
- Removed@ag-grid-community/core@31.2.1(transitive)
- Removed@ag-grid-enterprise/core@31.2.1(transitive)