@ag-grid-enterprise/viewport-row-model
Advanced tools
Comparing version 32.1.0 to 32.2.0
@@ -31,3 +31,3 @@ var __defProp = Object.defineProperty; | ||
// enterprise-modules/viewport-row-model/src/version.ts | ||
var VERSION = "32.1.0"; | ||
var VERSION = "32.2.0"; | ||
@@ -57,7 +57,7 @@ // enterprise-modules/viewport-row-model/src/viewportRowModel/viewportRowModel.ts | ||
postConstruct() { | ||
this.rowHeight = this.gos.getRowHeightAsNumber(); | ||
this.rowHeight = (0, import_core._getRowHeightAsNumber)(this.gos); | ||
this.addManagedEventListeners({ viewportChanged: this.onViewportChanged.bind(this) }); | ||
this.addManagedPropertyListener("viewportDatasource", () => this.updateDatasource()); | ||
this.addManagedPropertyListener("rowHeight", () => { | ||
this.rowHeight = this.gos.getRowHeightAsNumber(); | ||
this.rowHeight = (0, import_core._getRowHeightAsNumber)(this.gos); | ||
this.updateRowHeights(); | ||
@@ -64,0 +64,0 @@ }); |
@@ -1,1 +0,1 @@ | ||
var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(e,t)=>{for(var o in t)__defProp(e,o,{get:t[o],enumerable:!0})},__copyProps=(e,t,o,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of __getOwnPropNames(t))!__hasOwnProp.call(e,r)&&r!==o&&__defProp(e,r,{get:()=>t[r],enumerable:!(s=__getOwnPropDesc(t,r))||s.enumerable});return e},__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),main_exports={};__export(main_exports,{ViewportRowModelModule:()=>ViewportRowModelModule}),module.exports=__toCommonJS(main_exports);var import_core2=require("@ag-grid-community/core"),import_core3=require("@ag-grid-enterprise/core"),VERSION="32.1.0",import_core=require("@ag-grid-community/core"),ViewportRowModel=class extends import_core.BeanStub{constructor(){super(...arguments),this.beanName="rowModel",this.firstRow=-1,this.lastRow=-1,this.rowCount=-1,this.rowNodesByIndex={}}wireBeans(e){this.rowRenderer=e.rowRenderer,this.focusService=e.focusService,this.beans=e}ensureRowHeightsValid(e,t,o,s){return!1}postConstruct(){this.rowHeight=this.gos.getRowHeightAsNumber(),this.addManagedEventListeners({viewportChanged:this.onViewportChanged.bind(this)}),this.addManagedPropertyListener("viewportDatasource",()=>this.updateDatasource()),this.addManagedPropertyListener("rowHeight",()=>{this.rowHeight=this.gos.getRowHeightAsNumber(),this.updateRowHeights()})}start(){this.updateDatasource()}isLastRowIndexKnown(){return!0}destroy(){this.destroyDatasource(),super.destroy()}destroyDatasource(){this.viewportDatasource&&(this.viewportDatasource.destroy&&this.viewportDatasource.destroy(),this.rowRenderer.datasourceChanged(),this.firstRow=-1,this.lastRow=-1)}updateDatasource(){const e=this.gos.get("viewportDatasource");e&&this.setViewportDatasource(e)}getViewportRowModelPageSize(){return this.gos.get("viewportRowModelPageSize")}getViewportRowModelBufferSize(){return this.gos.get("viewportRowModelBufferSize")}calculateFirstRow(e){const t=this.getViewportRowModelBufferSize(),o=this.getViewportRowModelPageSize(),s=e-t;return s<0?0:Math.floor(s/o)*o}calculateLastRow(e){if(e===-1)return e;const t=this.getViewportRowModelBufferSize(),o=this.getViewportRowModelPageSize(),s=e+t,r=Math.ceil(s/o)*o,i=this.rowCount-1;return Math.min(r,i)}onViewportChanged(e){const t=this.calculateFirstRow(e.firstRow),o=this.calculateLastRow(e.lastRow);(this.firstRow!==t||this.lastRow!==o)&&(this.firstRow=t,this.lastRow=o,this.purgeRowsNotInViewport(),this.viewportDatasource&&this.viewportDatasource.setViewportRange(this.firstRow,this.lastRow))}purgeRowsNotInViewport(){Object.keys(this.rowNodesByIndex).forEach(e=>{const t=parseInt(e,10);if(t<this.firstRow||t>this.lastRow){if(this.isRowFocused(t))return;delete this.rowNodesByIndex[t]}})}isRowFocused(e){const t=this.focusService.getFocusCellToUseAfterRefresh();return!t||t.rowPinned!=null?!1:t.rowIndex===e}setViewportDatasource(e){this.destroyDatasource(),this.viewportDatasource=e,this.rowCount=-1,e.init?e.init({setRowCount:this.setRowCount.bind(this),setRowData:this.setRowData.bind(this),getRow:this.getRow.bind(this)}):(0,import_core._warnOnce)("viewport is missing init method.")}getType(){return"viewport"}getRow(e){return this.rowNodesByIndex[e]||(this.rowNodesByIndex[e]=this.createBlankRowNode(e)),this.rowNodesByIndex[e]}getRowNode(e){let t;return this.forEachNode(o=>{o.id===e&&(t=o)}),t}getRowCount(){return this.rowCount===-1?0:this.rowCount}getRowIndexAtPixel(e){return this.rowHeight!==0?Math.floor(e/this.rowHeight):0}getRowBounds(e){return{rowHeight:this.rowHeight,rowTop:this.rowHeight*e}}updateRowHeights(){this.forEachNode(e=>{e.setRowHeight(this.rowHeight),e.setRowTop(this.rowHeight*e.rowIndex)}),this.eventService.dispatchEvent({type:"modelUpdated",newData:!1,newPage:!1,keepRenderedRows:!0,animate:!1})}getTopLevelRowCount(){return this.getRowCount()}getTopLevelRowDisplayedIndex(e){return e}isEmpty(){return this.rowCount>0}isRowsToRender(){return this.rowCount>0}getNodesInRangeForSelection(e,t){const o=e.rowIndex,s=t.rowIndex,r=o<this.firstRow||o>this.lastRow,i=s<this.firstRow||s>this.lastRow;if(r||i)return[];const a=[],w=o<=s?o:s,d=o<=s?s:o;for(let n=w;n<=d;n++)a.push(this.rowNodesByIndex[n]);return a}forEachNode(e){let t=0;Object.keys(this.rowNodesByIndex).forEach(o=>{const s=parseInt(o,10),r=this.rowNodesByIndex[s];e(r,t),t++})}setRowData(e){(0,import_core._iterateObject)(e,(t,o)=>{const s=parseInt(t,10);if(s>=this.firstRow&&s<=this.lastRow){let r=this.rowNodesByIndex[s];(0,import_core._missing)(r)&&(r=this.createBlankRowNode(s),this.rowNodesByIndex[s]=r),r.setDataAndId(o,s.toString())}})}createBlankRowNode(e){const t=new import_core.RowNode(this.beans);return t.setRowHeight(this.rowHeight),t.setRowTop(this.rowHeight*e),t.setRowIndex(e),t}setRowCount(e,t=!1){e!==this.rowCount&&(this.rowCount=e,this.eventService.dispatchEventOnce({type:"rowCountReady"}),this.eventService.dispatchEvent({type:"modelUpdated",newData:!1,newPage:!1,keepRenderedRows:t,animate:!1}))}isRowPresent(e){return!!this.getRowNode(e.id)}},ViewportRowModelModule=(0,import_core2._defineModule)({version:VERSION,moduleName:import_core2.ModuleNames.ViewportRowModelModule,rowModel:"viewport",beans:[ViewportRowModel],dependantModules:[import_core3.EnterpriseCoreModule]}); | ||
var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(e,t)=>{for(var o in t)__defProp(e,o,{get:t[o],enumerable:!0})},__copyProps=(e,t,o,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of __getOwnPropNames(t))!__hasOwnProp.call(e,r)&&r!==o&&__defProp(e,r,{get:()=>t[r],enumerable:!(s=__getOwnPropDesc(t,r))||s.enumerable});return e},__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),main_exports={};__export(main_exports,{ViewportRowModelModule:()=>ViewportRowModelModule}),module.exports=__toCommonJS(main_exports);var import_core2=require("@ag-grid-community/core"),import_core3=require("@ag-grid-enterprise/core"),VERSION="32.2.0",import_core=require("@ag-grid-community/core"),ViewportRowModel=class extends import_core.BeanStub{constructor(){super(...arguments),this.beanName="rowModel",this.firstRow=-1,this.lastRow=-1,this.rowCount=-1,this.rowNodesByIndex={}}wireBeans(e){this.rowRenderer=e.rowRenderer,this.focusService=e.focusService,this.beans=e}ensureRowHeightsValid(e,t,o,s){return!1}postConstruct(){this.rowHeight=(0,import_core._getRowHeightAsNumber)(this.gos),this.addManagedEventListeners({viewportChanged:this.onViewportChanged.bind(this)}),this.addManagedPropertyListener("viewportDatasource",()=>this.updateDatasource()),this.addManagedPropertyListener("rowHeight",()=>{this.rowHeight=(0,import_core._getRowHeightAsNumber)(this.gos),this.updateRowHeights()})}start(){this.updateDatasource()}isLastRowIndexKnown(){return!0}destroy(){this.destroyDatasource(),super.destroy()}destroyDatasource(){this.viewportDatasource&&(this.viewportDatasource.destroy&&this.viewportDatasource.destroy(),this.rowRenderer.datasourceChanged(),this.firstRow=-1,this.lastRow=-1)}updateDatasource(){const e=this.gos.get("viewportDatasource");e&&this.setViewportDatasource(e)}getViewportRowModelPageSize(){return this.gos.get("viewportRowModelPageSize")}getViewportRowModelBufferSize(){return this.gos.get("viewportRowModelBufferSize")}calculateFirstRow(e){const t=this.getViewportRowModelBufferSize(),o=this.getViewportRowModelPageSize(),s=e-t;return s<0?0:Math.floor(s/o)*o}calculateLastRow(e){if(e===-1)return e;const t=this.getViewportRowModelBufferSize(),o=this.getViewportRowModelPageSize(),s=e+t,r=Math.ceil(s/o)*o,i=this.rowCount-1;return Math.min(r,i)}onViewportChanged(e){const t=this.calculateFirstRow(e.firstRow),o=this.calculateLastRow(e.lastRow);(this.firstRow!==t||this.lastRow!==o)&&(this.firstRow=t,this.lastRow=o,this.purgeRowsNotInViewport(),this.viewportDatasource&&this.viewportDatasource.setViewportRange(this.firstRow,this.lastRow))}purgeRowsNotInViewport(){Object.keys(this.rowNodesByIndex).forEach(e=>{const t=parseInt(e,10);if(t<this.firstRow||t>this.lastRow){if(this.isRowFocused(t))return;delete this.rowNodesByIndex[t]}})}isRowFocused(e){const t=this.focusService.getFocusCellToUseAfterRefresh();return!t||t.rowPinned!=null?!1:t.rowIndex===e}setViewportDatasource(e){this.destroyDatasource(),this.viewportDatasource=e,this.rowCount=-1,e.init?e.init({setRowCount:this.setRowCount.bind(this),setRowData:this.setRowData.bind(this),getRow:this.getRow.bind(this)}):(0,import_core._warnOnce)("viewport is missing init method.")}getType(){return"viewport"}getRow(e){return this.rowNodesByIndex[e]||(this.rowNodesByIndex[e]=this.createBlankRowNode(e)),this.rowNodesByIndex[e]}getRowNode(e){let t;return this.forEachNode(o=>{o.id===e&&(t=o)}),t}getRowCount(){return this.rowCount===-1?0:this.rowCount}getRowIndexAtPixel(e){return this.rowHeight!==0?Math.floor(e/this.rowHeight):0}getRowBounds(e){return{rowHeight:this.rowHeight,rowTop:this.rowHeight*e}}updateRowHeights(){this.forEachNode(e=>{e.setRowHeight(this.rowHeight),e.setRowTop(this.rowHeight*e.rowIndex)}),this.eventService.dispatchEvent({type:"modelUpdated",newData:!1,newPage:!1,keepRenderedRows:!0,animate:!1})}getTopLevelRowCount(){return this.getRowCount()}getTopLevelRowDisplayedIndex(e){return e}isEmpty(){return this.rowCount>0}isRowsToRender(){return this.rowCount>0}getNodesInRangeForSelection(e,t){const o=e.rowIndex,s=t.rowIndex,r=o<this.firstRow||o>this.lastRow,i=s<this.firstRow||s>this.lastRow;if(r||i)return[];const a=[],w=o<=s?o:s,d=o<=s?s:o;for(let n=w;n<=d;n++)a.push(this.rowNodesByIndex[n]);return a}forEachNode(e){let t=0;Object.keys(this.rowNodesByIndex).forEach(o=>{const s=parseInt(o,10),r=this.rowNodesByIndex[s];e(r,t),t++})}setRowData(e){(0,import_core._iterateObject)(e,(t,o)=>{const s=parseInt(t,10);if(s>=this.firstRow&&s<=this.lastRow){let r=this.rowNodesByIndex[s];(0,import_core._missing)(r)&&(r=this.createBlankRowNode(s),this.rowNodesByIndex[s]=r),r.setDataAndId(o,s.toString())}})}createBlankRowNode(e){const t=new import_core.RowNode(this.beans);return t.setRowHeight(this.rowHeight),t.setRowTop(this.rowHeight*e),t.setRowIndex(e),t}setRowCount(e,t=!1){e!==this.rowCount&&(this.rowCount=e,this.eventService.dispatchEventOnce({type:"rowCountReady"}),this.eventService.dispatchEvent({type:"modelUpdated",newData:!1,newPage:!1,keepRenderedRows:t,animate:!1}))}isRowPresent(e){return!!this.getRowNode(e.id)}},ViewportRowModelModule=(0,import_core2._defineModule)({version:VERSION,moduleName:import_core2.ModuleNames.ViewportRowModelModule,rowModel:"viewport",beans:[ViewportRowModel],dependantModules:[import_core3.EnterpriseCoreModule]}); |
{ | ||
"name": "@ag-grid-enterprise/viewport-row-model", | ||
"version": "32.1.0", | ||
"version": "32.2.0", | ||
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue", | ||
@@ -16,4 +16,4 @@ "main": "./dist/package/main.cjs.js", | ||
"dependencies": { | ||
"@ag-grid-community/core": "32.1.0", | ||
"@ag-grid-enterprise/core": "32.1.0" | ||
"@ag-grid-community/core": "32.2.0", | ||
"@ag-grid-enterprise/core": "32.2.0" | ||
}, | ||
@@ -20,0 +20,0 @@ "devDependencies": { |
{ | ||
"name": "@ag-grid-enterprise/viewport-row-model", | ||
"version": "32.1.0", | ||
"version": "32.2.0", | ||
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue", | ||
@@ -16,4 +16,4 @@ "main": "./src/main.js", | ||
"dependencies": { | ||
"@ag-grid-community/core": "32.1.0", | ||
"@ag-grid-enterprise/core": "32.1.0" | ||
"@ag-grid-community/core": "32.2.0", | ||
"@ag-grid-enterprise/core": "32.2.0" | ||
}, | ||
@@ -20,0 +20,0 @@ "devDependencies": { |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "32.1.0"; | ||
export declare const VERSION = "32.2.0"; |
{ | ||
"name": "@ag-grid-enterprise/viewport-row-model", | ||
"version": "32.1.0", | ||
"version": "32.2.0", | ||
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue", | ||
@@ -16,4 +16,4 @@ "main": "./dist/package/main.cjs.js", | ||
"dependencies": { | ||
"@ag-grid-community/core": "32.1.0", | ||
"@ag-grid-enterprise/core": "32.1.0" | ||
"@ag-grid-community/core": "32.2.0", | ||
"@ag-grid-enterprise/core": "32.2.0" | ||
}, | ||
@@ -20,0 +20,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
181377
+ Added@ag-grid-community/core@32.2.0(transitive)
+ Added@ag-grid-enterprise/core@32.2.0(transitive)
+ Addedag-charts-types@10.2.0(transitive)
- Removed@ag-grid-community/core@32.1.0(transitive)
- Removed@ag-grid-enterprise/core@32.1.0(transitive)
- Removedag-charts-types@10.1.0(transitive)