@ag-grid-enterprise/range-selection
Advanced tools
Comparing version 31.3.2 to 31.3.3
@@ -1524,3 +1524,3 @@ var __defProp = Object.defineProperty; | ||
// enterprise-modules/range-selection/src/version.ts | ||
var VERSION = "31.3.2"; | ||
var VERSION = "31.3.3"; | ||
@@ -1527,0 +1527,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 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.2",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.3",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.3.2", | ||
"version": "31.3.3", | ||
"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.3.2", | ||
"@ag-grid-enterprise/core": "31.3.2" | ||
"@ag-grid-community/core": "31.3.3", | ||
"@ag-grid-enterprise/core": "31.3.3" | ||
}, | ||
@@ -19,0 +19,0 @@ "devDependencies": { |
{ | ||
"name": "@ag-grid-enterprise/range-selection", | ||
"version": "31.3.2", | ||
"version": "31.3.3", | ||
"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.3.2", | ||
"@ag-grid-enterprise/core": "31.3.2" | ||
"@ag-grid-community/core": "31.3.3", | ||
"@ag-grid-enterprise/core": "31.3.3" | ||
}, | ||
@@ -19,0 +19,0 @@ "devDependencies": { |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "31.3.2"; | ||
export declare const VERSION = "31.3.3"; |
{ | ||
"name": "@ag-grid-enterprise/range-selection", | ||
"version": "31.3.2", | ||
"version": "31.3.3", | ||
"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.3.2", | ||
"@ag-grid-enterprise/core": "31.3.2" | ||
"@ag-grid-community/core": "31.3.3", | ||
"@ag-grid-enterprise/core": "31.3.3" | ||
}, | ||
@@ -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
+ Added@ag-grid-community/core@31.3.3(transitive)
+ Added@ag-grid-enterprise/core@31.3.3(transitive)
- Removed@ag-grid-community/core@31.3.2(transitive)
- Removed@ag-grid-enterprise/core@31.3.2(transitive)