@ag-grid-enterprise/range-selection
Advanced tools
Comparing version 31.2.0 to 31.2.1
@@ -1502,3 +1502,3 @@ var __defProp = Object.defineProperty; | ||
// enterprise-modules/range-selection/src/version.ts | ||
var VERSION = "31.2.0"; | ||
var VERSION = "31.2.1"; | ||
@@ -1505,0 +1505,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.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]}; | ||
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]}; |
{ | ||
"name": "@ag-grid-enterprise/range-selection", | ||
"version": "31.2.0", | ||
"version": "31.2.1", | ||
"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.0", | ||
"@ag-grid-enterprise/core": "31.2.0" | ||
"@ag-grid-community/core": "31.2.1", | ||
"@ag-grid-enterprise/core": "31.2.1" | ||
}, | ||
@@ -19,0 +19,0 @@ "devDependencies": { |
{ | ||
"name": "@ag-grid-enterprise/range-selection", | ||
"version": "31.2.0", | ||
"version": "31.2.1", | ||
"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.0", | ||
"@ag-grid-enterprise/core": "31.2.0" | ||
"@ag-grid-community/core": "31.2.1", | ||
"@ag-grid-enterprise/core": "31.2.1" | ||
}, | ||
@@ -19,0 +19,0 @@ "devDependencies": { |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "31.2.0"; | ||
export declare const VERSION = "31.2.1"; |
{ | ||
"name": "@ag-grid-enterprise/range-selection", | ||
"version": "31.2.0", | ||
"version": "31.2.1", | ||
"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.0", | ||
"@ag-grid-enterprise/core": "31.2.0" | ||
"@ag-grid-community/core": "31.2.1", | ||
"@ag-grid-enterprise/core": "31.2.1" | ||
}, | ||
@@ -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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
+ Added@ag-grid-community/core@31.2.1(transitive)
+ Added@ag-grid-enterprise/core@31.2.1(transitive)
- Removed@ag-grid-community/core@31.2.0(transitive)
- Removed@ag-grid-enterprise/core@31.2.0(transitive)