UNPKG

@progress/kendo-ui

Version:

This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.

1 lines 8.48 kB
module.exports=function(e){function t(o){if(i[o])return i[o].exports;var r=i[o]={exports:{},id:o,loaded:!1};return e[o].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var i={};return t.m=e,t.c=i,t.p="",t(0)}({0:function(e,t,i){i(1518),e.exports=i(1518)},3:function(e,t){e.exports=function(){throw Error("define cannot be used indirect")}},19:function(e,t){e.exports=require("../kendo.core")},1518:function(e,t,i){var o,r,s;!function(n,define){r=[i(19),i(1519)],o=n,s="function"==typeof o?o.apply(t,r):o,!(void 0!==s&&(e.exports=s))}(function(){!function(e){var t,i,o,r;e.support.browser.msie&&e.support.browser.version<9||(t=e.spreadsheet.RangeRef,i=e.spreadsheet.CellRef,o=e.Class.extend({init:function(e,t,i,o){this.rangeGetter=i,this.prevLeft=function(i){var r=o(this.range(i)),s=this.range(t.prevVisible(r.topLeft[e]));return o(s).topLeft[e]},this.nextRight=function(i){var r=o(this.range(i)),s=this.range(t.nextVisible(r.bottomRight[e]));return o(s).bottomRight[e]},this.nextLeft=function(i){var r=o(this.range(i));return t.nextVisible(r.bottomRight[e])},this.prevRight=function(i){var r=o(this.range(i));return t.prevVisible(r.topLeft[e])}},boundary:function(e,t){this.top=e,this.bottom=t},range:function(e){return this.rangeGetter(e,this.top,this.bottom)}}),r=e.Class.extend({init:function(t){this._sheet=t,this.columns=this._sheet._grid._columns,this.autoFillCalculator=new e.spreadsheet.AutoFillCalculator(t._grid),this.colEdge=new o("col",this._sheet._grid._columns,this.columnRange.bind(this),this.union.bind(this)),this.rowEdge=new o("row",this._sheet._grid._rows,this.rowRange.bind(this),this.union.bind(this))},height:function(e){this._viewPortHeight=e},union:function(e){return this._sheet.unionWithMerged(e)},columnRange:function(e,t,i){return this._sheet._ref(t,e,i-t,1)},rowRange:function(e,t,i){return this._sheet._ref(e,t,1,i-t)},selectionIncludesMergedCells:function(){return this._sheet.select().contains(this._sheet._mergedCells)},setSelectionValue:function(e){var t=this._sheet.selection();setTimeout(function(){t.value(e())})},selectAll:function(){this._sheet.select(this._sheet._sheetRef)},select:function(e,t,i){e=this.refForMode(e,t),i&&(e=this._sheet.select().concat(e)),this._sheet.select(e)},refForMode:function(e,t){var i=this._sheet._grid;switch(t){case"range":e=i.normalize(e);break;case"row":e=i.rowRef(e.row);break;case"column":e=i.colRef(e.col);break;case"sheet":e=this._sheet._sheetRef}return e},startSelection:function(e,i,o,r){if("autofill"==i)this._sheet.startAutoFill();else if(r&&"range"==i){var s=new t(this._sheet.activeCell().first(),e);this._sheet.select(s,!1,!1),this._sheet.startSelection()}else this._sheet.startSelection(),this.select(e,i,o)},completeSelection:function(){this._sheet.completeSelection()},selectForContextMenu:function(e,t){var i=this._sheet;i._activeDrawing=null,i.select().contains(this.refForMode(e,t))||this.select(e,t)},selectDrawingForContextMenu:function(e){var t=this._sheet;t._activeDrawing=e,t.triggerChange({selection:!0})},modifySelection:function(e){var i,o,r=this.determineDirection(e),s=this._sheet,n=this._viewPortHeight,a=s._grid._rows,l=s._grid._columns,c=s.currentOriginalSelectionRange(),h=s.select().toRangeRef(),g=s.activeCell(),u=c.topLeft.clone(),f=c.bottomRight.clone();switch(this.colEdge.boundary(h.topLeft.row,h.bottomRight.row),this.rowEdge.boundary(h.topLeft.col,h.bottomRight.col),r){case"expand-left":u.col=this.colEdge.prevLeft(u.col),i=u;break;case"shrink-right":u.col=this.colEdge.nextLeft(u.col),i=u;break;case"expand-right":f.col=this.colEdge.nextRight(f.col),i=f;break;case"shrink-left":f.col=this.colEdge.prevRight(f.col),i=f;break;case"expand-up":u.row=this.rowEdge.prevLeft(u.row),i=u;break;case"shrink-down":u.row=this.rowEdge.nextLeft(u.row),i=u;break;case"expand-down":f.row=this.rowEdge.nextRight(f.row),i=f;break;case"shrink-up":f.row=this.rowEdge.prevRight(f.row),i=f;break;case"expand-page-up":u.row=a.prevPage(u.row,n);break;case"shrink-page-up":f.row=a.prevPage(f.row,n);break;case"expand-page-down":f.row=a.nextPage(f.row,n);break;case"shrink-page-down":u.row=a.nextPage(u.row,n);break;case"first-col":u.col=l.firstVisible(),f.col=g.bottomRight.col,i=u;break;case"last-col":f.col=l.lastVisible(),u.col=g.topLeft.col,i=f;break;case"first-row":u.row=a.firstVisible(),f.row=g.bottomRight.row,i=u;break;case"last-row":f.row=a.lastVisible(),u.row=g.topLeft.row,i=f;break;case"last":f.row=a.lastVisible(),f.col=l.lastVisible(),u=g.topLeft,i=f;break;case"first":u.row=a.firstVisible(),u.col=l.firstVisible(),f=g.bottomRight,i=u}return o=new t(u,f),this.union(o).intersects(g)?(i&&s.focus(i),void this.updateCurrentSelectionRange(o)):void this.modifySelection(r.replace("shrink","expand"))},moveActiveCell:function(e){var t=this._sheet,o=t.activeCell(),r=o.topLeft,s=o.bottomRight,n=t.originalActiveCell(),a=t._grid._rows,l=t._grid._columns,c=n.row,h=n.col;switch(e){case"left":h=l.prevVisible(r.col);break;case"up":c=a.prevVisible(r.row);break;case"right":h=l.nextVisible(s.col);break;case"down":c=a.nextVisible(s.row);break;case"first-col":h=l.firstVisible();break;case"last-col":h=l.lastVisible();break;case"first-row":c=a.firstVisible();break;case"last-row":c=a.lastVisible();break;case"last":c=a.lastVisible(),h=l.lastVisible();break;case"first":c=a.firstVisible(),h=l.firstVisible();break;case"next-page":c=a.nextPage(s.row,this._viewPortHeight);break;case"prev-page":c=a.prevPage(s.row,this._viewPortHeight)}t.select(new i(c,h))},navigateInSelection:function(e){function t(e){o=e.topLeft,r=e.bottomRight}var o,r,s,n,a,l=this._sheet,c=l.activeCell(),h=c.topLeft,g=l.originalActiveCell(),u=l._grid._rows,f=l._grid._columns,w=g.row,p=g.col,b=h.col,d=h.row;for(t(l.currentNavigationRange()),n=!1;!n;){switch(a=new i(w,p),e){case"next":r.eq(a)?(t(l.nextNavigationRange()),w=o.row,p=o.col):(p=f.nextVisible(b),(p==b||p>r.col)&&(p=o.col,s=u.nextVisible(w),w=s==w||s>r.row?o.row:s));break;case"previous":o.eq(a)?(t(l.previousNavigationRange()),w=r.row,p=r.col):(p=f.prevVisible(b),(p==b||p<o.col)&&(p=r.col,s=u.prevVisible(w),w=s==w||s<o.row?r.row:s));break;case"lower":r.eq(a)?(t(l.nextNavigationRange()),w=o.row,p=o.col):(w=u.nextVisible(d),(w==d||w>r.row)&&(w=o.row,s=f.nextVisible(p),p=s==p||s>r.col?o.col:s));break;case"upper":o.eq(a)?(t(l.previousNavigationRange()),w=r.row,p=r.col):(w=u.prevVisible(d),(w==d||w<o.row)&&(w=r.row,s=f.prevVisible(p),p=s==p||s<o.col?r.col:s));break;default:throw Error("Unknown entry navigation: "+e)}n=!this.shouldSkip(w,p),b=p,d=w}l.singleCellSelection()?l.select(new i(w,p)):l.activeCell(new i(w,p))},extendSelection:function(e,i){var o,r=this._sheet,s=r._grid;return"autofill"===i?void this.resizeAutoFill(e):("range"===i?e=s.normalize(e):"row"===i?e=s.rowRef(e.row).bottomRight:"column"===i&&(e=s.colRef(e.col).bottomRight),o=r.originalActiveCell().toRangeRef(),void this.updateCurrentSelectionRange(new t(o.topLeft,e)))},shouldSkip:function(e,t){var o,r;return!(!this._sheet.isHiddenRow(e)&&!this._sheet.isHiddenColumn(t))||(o=new i(e,t),r=!1,this._sheet.forEachMergedCell(function(e){e.intersects(o)&&!e.collapse().eq(o)&&(r=!0)}),r)},resizeAutoFill:function(e){var t,i,o,r=this._sheet,s=r.select(),n=r._autoFillOrigin,a=this.autoFillCalculator.autoFillDest(s,e),l=this.punch(s,a);l||(o=r.range(a)._previewFillFrom(r.range(n)),o&&(i=o.direction,t=o.hint)),r.updateAutoFill(a,l,t,i)},determineDirection:function(e){var t=this._sheet.currentSelectionRange(),i=this._sheet.activeCell(),o=i.topLeft.col==t.topLeft.col,r=i.bottomRight.col==t.bottomRight.col,s=i.topLeft.row==t.topLeft.row,n=i.bottomRight.row==t.bottomRight.row;switch(e){case"left":e=r?"expand-left":"shrink-left";break;case"right":e=o?"expand-right":"shrink-right";break;case"up":e=n?"expand-up":"shrink-up";break;case"down":e=s?"expand-down":"shrink-down";break;case"prev-page":e=n?"expand-page-up":"shrink-page-up";break;case"next-page":e=s?"expand-page-down":"shrink-page-down"}return e},updateCurrentSelectionRange:function(e){var t=this._sheet;t.select(t.originalSelect().replaceAt(t.selectionRangeIndex(),e),!1)},punch:function(e,o){var r,s,n;return o.topLeft.eq(e.topLeft)&&(o.bottomRight.row<e.bottomRight.row?(s=this.rowEdge.nextRight(o.bottomRight.row),r=new t(new i(s,e.topLeft.col),e.bottomRight)):o.bottomRight.col<e.bottomRight.col&&(n=this.colEdge.nextRight(o.bottomRight.col),r=new t(new i(e.topLeft.row,n),e.bottomRight))),r}}),e.spreadsheet.SheetNavigator=r)}(kendo)},i(3))},1519:function(e,t){e.exports=require("./autofillcalculator")}});