From 8f9e905eb3017b648efa8c380eac4b101bd893aa Mon Sep 17 00:00:00 2001 From: steve wirts Date: Fri, 14 Aug 2015 15:29:19 -0400 Subject: [PATCH] friday rollout of bys stuff --- examples/bclys/fin-hypergrid.min.html | 2 +- examples/bclys/index.html | 15 +++++---------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/examples/bclys/fin-hypergrid.min.html b/examples/bclys/fin-hypergrid.min.html index ec182d9c1..29917526e 100644 --- a/examples/bclys/fin-hypergrid.min.html +++ b/examples/bclys/fin-hypergrid.min.html @@ -25,4 +25,4 @@ {{labelAdapter(item)}}
  • \ No newline at end of file +if(!self.resolveProperty("scrollingEnabled")){hoverClassOver="hidden";hoverClassOff="hidden"}self.sbVScroller.classList.remove(hoverClassOver);self.sbVScroller.classList.add(hoverClassOff)}};this.addEventListener("mousedown",function(){self.sbMouseIsDown=true});this.sbVScroller.onUpClick=function(){self.scrollVBy(-1);self.isScrollButtonClick=true};this.sbVScroller.onDownClick=function(){self.scrollVBy(1);self.isScrollButtonClick=true};this.sbVScroller.onUpHold=function(event){event.preventTap();self.scrollVBy(-1);self.isScrollButtonClick=true};this.sbVScroller.onDownHold=function(event){event.preventTap();self.scrollVBy(1);self.isScrollButtonClick=true};this.addEventListener("mousedown",function(){self.sbMouseIsDown=true});document.addEventListener("mouseup",function(e){noop(e);if(!self.sbMouseIsDown){return}self.sbMouseIsDown=false;self.takeFocus();var x=e.x||e.clientX;var y=e.y||e.clientY;var elementAt=self.shadowRoot.elementFromPoint(x,y);self.scrollBarHasMouse=elementAt===self.sbVScroller||elementAt===self.sbHScroller;if(!self.scrollBarHasMouse){var hoverClassOver=self.resolveProperty("scrollbarHoverOver");var hoverClassOff=self.resolveProperty("scrollbarHoverOff");if(!self.resolveProperty("scrollingEnabled")){hoverClassOver="hidden";hoverClassOff="hidden"}self.sbVScroller.classList.remove(hoverClassOver);self.sbHScroller.classList.remove(hoverClassOver);self.sbVScroller.classList.add(hoverClassOff);self.sbHScroller.classList.add(hoverClassOff)}});this.sbHValueHolder={changed:false,getValue:function(){return self.getHScrollValue()},setValue:function(v){self.setHScrollValue(v)}};this.sbVValueHolder={changed:false,getValue:function(){return self.getVScrollValue()},setValue:function(v){self.setVScrollValue(v)}};this.sbHScrollConfig={step:1,page:40,rangeStart:0,rangeStop:0};this.sbVScrollConfig={step:1,page:40,rangeStart:0,rangeStop:0};this.sbHRangeAdapter=this.sbHScroller.createRangeAdapter(this.sbHValueHolder,this.sbHScrollConfig);this.sbVRangeAdapter=this.sbHScroller.createRangeAdapter(this.sbVValueHolder,this.sbVScrollConfig);this.sbHScroller.setRangeAdapter(this.sbHRangeAdapter);this.sbVScroller.setRangeAdapter(this.sbVRangeAdapter)},scrollValueChangedNotification:function(){if(this.hScrollValue===this.sbPrevHScrollValue&&this.vScrollValue===this.sbPrevVScrollValue){return}this.sbHValueHolder.changed=!this.sbHValueHolder.changed;this.sbVValueHolder.changed=!this.sbVValueHolder.changed;this.sbPrevHScrollValue=this.hScrollValue;this.sbPrevVScrollValue=this.vScrollValue;if(this.cellEditor){this.cellEditor.scrollValueChangedNotification()}this.computeCellsBounds()},getValue:function(x,y){return this.getBehavior().getValue(x,y)},setValue:function(x,y,value){this.getBehavior().setValue(x,y,value)},getColumnAlignment:function(c){return this.getBehavior().getColumnAlignment(c)},synchronizeScrollingBoundries:function(){var behavior=this.getBehavior();var numColumns=this.getColumnCount();var numRows=this.getRowCount();var numFixedColumns=this.getFixedColumnCount();var numFixedRows=this.getFixedRowCount();var bounds=this.getBounds();if(!bounds){return}var scrollableHeight=bounds.height()-behavior.getFixedRowsMaxHeight()-5;var scrollableWidth=bounds.width()-200-behavior.getFixedColumnsMaxWidth()-5;var lastPageColumnCount=0;var columnsWidth=0;for(;lastPageColumnCountscrollableWidth){break}}var lastPageRowCount=0;var rowsHeight=0;for(;lastPageRowCountscrollableHeight){break}}this.sbHScrollConfig.rangeStop=Math.max(0,numColumns-numFixedColumns-lastPageColumnCount);this.sbVScrollConfig.rangeStop=Math.max(0,numRows-numFixedRows-lastPageRowCount);this.setVScrollValue(Math.min(this.getVScrollValue(),this.sbVScrollConfig.rangeStop));this.setHScrollValue(Math.min(this.getHScrollValue(),this.sbHScrollConfig.rangeStop));this.computeCellsBounds();this.repaint()},getVisibleRows:function(){return this.getRenderer().getVisibleRows()},getVisibleColumns:function(){return this.getRenderer().getVisibleColumns()},initRenderer:function(){this.renderer=this.shadowRoot.querySelector("fin-hypergrid-renderer");this.renderer.setGrid(this)},getRenderer:function(){return this.renderer},getColumnWidth:function(columnIndex){return this.getBehavior().getColumnWidth(columnIndex)},setColumnWidth:function(columnIndex,columnWidth){this.getBehavior().setColumnWidth(columnIndex,columnWidth)},getColumnEdge:function(c){return this.getBehavior().getColumnEdge(c,this.getRenderer())},getFixedColumnsWidth:function(){return this.getBehavior().getFixedColumnsWidth()},getRowHeight:function(rowIndex){return this.getBehavior().getRowHeight(rowIndex)},setRowHeight:function(rowIndex,rowHeight){this.getBehavior().setRowHeight(rowIndex,rowHeight)},getFixedRowsHeight:function(){return this.getBehavior().getFixedRowsHeight()},getColumnCount:function(){return this.getBehavior().getColumnCount()},getRowCount:function(){return this.getBehavior().getRowCount()},getFixedColumnCount:function(){return this.getBehavior().getFixedColumnCount()},getFixedRowCount:function(){return this.getBehavior().getFixedRowCount()},topLeftClicked:function(mouse){this.getBehavior().topLeftClicked(this,mouse)},rowHeaderClicked:function(mouse){this.getBehavior().rowHeaderClicked(this,mouse)},columnHeaderClicked:function(mouse){this.getBehavior().columnHeaderClicked(this,mouse)},_activateEditor:function(event){var gridCell=event.gridCell;this.activateEditor(gridCell.x,gridCell.y)},activateEditor:function(x,y){var editor=this.getCellEditorAt(x,y);if(editor){event.gridCell={x:x,y:y};this.editAt(editor,event)}},getCellEditorAt:function(x,y){return this.getBehavior().getCellEditorAt(x,y)},toggleHiDPI:function(){if(this.canvas.isHiDPI()){this.removeAttribute("hidpi")}else{this.setAttribute("hidpi",null)}this.canvas.resize()},getHiDPI:function(ctx){if(window.devicePixelRatio&&this.canvas.isHiDPI()){var devicePixelRatio=window.devicePixelRatio||1;var backingStoreRatio=ctx.webkitBackingStorePixelRatio||ctx.mozBackingStorePixelRatio||ctx.msBackingStorePixelRatio||ctx.oBackingStorePixelRatio||ctx.backingStorePixelRatio||1;var ratio=devicePixelRatio/backingStoreRatio;return ratio}else{return 1}},getRenderedWidth:function(colIndex){return this.renderer.getRenderedWidth(colIndex)},getRenderedHeight:function(rowIndex){return this.renderer.getRenderedHeight(rowIndex)},resolveCellEditor:function(name){return this.cellEditors[name]},updateCursor:function(){var translate=this.getBehavior();var cursor=translate.getCursorAt(-1,-1);var hoverCell=this.getHoverCell();if(hoverCell&&hoverCell.x>-1&&hoverCell.y>-1){var x=hoverCell.x+this.getHScrollValue();cursor=translate.getCursorAt(x,hoverCell.y+this.getVScrollValue())}this.beCursor(cursor)},repaintCell:function(x,y){this.getRenderer().repaintCell(x,y)},isDraggingColumn:function(){if(this.renderOverridesCache.dragger){return true}else{return false}},pageUp:function(){var rowNum=this.getRenderer().getPageUpRow();this.setVScrollValue(rowNum)},pageDown:function(){var rowNum=this.getRenderer().getPageDownRow();this.setVScrollValue(rowNum)},pageLeft:function(){console.log("page left")},pageRight:function(){console.log("page right")},getRenderedData:function(){var behavior=this.getBehavior();var renderer=this.getRenderer();var colCount=this.getColumnCount();var rowCount=renderer.getVisibleRows();var headers=[];var result=[];var r,c;for(c=0;c-1;var hasSHIFT=keys.indexOf("SHIFT")>-1;var so,se;if(!hasCTRL&&!hasSHIFT){if(!alreadySelected){model.clear()}model.toggleSelect(ox,oy,ex,ey)}else{if(hasCTRL){model.toggleSelect(ox,oy,ex,ey)}if(hasSHIFT){if(ox===0){so=Math.min(this.lastEdgeSelection[1],oy);se=Math.max(this.lastEdgeSelection[1],oy);model.clear();model.toggleSelect(0,so,ex,se-so)}else{so=Math.min(this.lastEdgeSelection[0],ox);se=Math.max(this.lastEdgeSelection[0],ox);model.clear();model.toggleSelect(so,0,se-so,ey)}}}if(!alreadySelected&&!hasSHIFT){this.lastEdgeSelection=[ox,oy,ex,ey];console.log(this.lastEdgeSelection)}this.repaint()},getSelectedRows:function(){return this.getSelectionModel().getSelectedRows()},getSelectedColumns:function(){return this.getSelectionModel().getSelectedColumns()},getSelections:function(){return this.getSelectionModel().getSelections()},isShowRowNumbers:function(){return this.resolveProperty("showRowNumbers")},isColumnOrRowSelectionMode:function(){return this.getSelectionModel().isColumnOrRowSelectionMode()},isColumnSelectionMode:function(){return this.getSelectionModel().isColumnSelectionMode()},isRowSelectionMode:function(){return this.getSelectionModel().isRowSelectionMode()}})})(); \ No newline at end of file diff --git a/examples/bclys/index.html b/examples/bclys/index.html index a030ed257..e97f3756a 100644 --- a/examples/bclys/index.html +++ b/examples/bclys/index.html @@ -159,16 +159,11 @@ } }); - jsonGrid.addFinEventListener('fin-click', function(e){ - // var headerColCount = jsonGrid.getHeaderColumnCount(); - // var headerRowCount = jsonGrid.getHeaderRowCount(); - // var cell = e.detail.gridCell; - // if(cell.y === 0 && cell.x >= headerColCount) { - // jsonGrid.toggleSelectColumn(cell.x, e.detail.keys); - // } else if(cell.x === -1 && cell.y >= headerRowCount) { - // // -1 is the row numbers column - // jsonGrid.toggleSelectRow(cell.y, e.detail.keys); - // } + jsonGrid.addFinEventListener('fin-mousedown', function(e){ + var cell = e.detail.gridCell; + if(cell.x === 7) { + jsonGrid.toggleSelectRow(cell.y, []); + } }); jsonGrid.addFinEventListener('fin-button-pressed', function(e){