UNPKG

@progress/kendo-ui

Version:

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

1 lines 9.95 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(1620),e.exports=i(1620)},3:function(e,t){e.exports=function(){throw Error("define cannot be used indirect")}},20:function(e,t){e.exports=require("../kendo.core")},1620:function(e,t,i){var o,r,n;!function(s,define){r=[i(20),i(1621)],o=s,n="function"==typeof o?o.apply(t,r):o,!(void 0!==n&&(e.exports=n))}(function(){!function(e){function t(e,t,i){var o=e.range(t).value();return function(r,n,s){if(s)return!0;var a=(i?e.range(t.row,r):e.range(r,t.col)).value();return null===o?null!==a&&r:n||null!==a?null===a:(o=null,!1)}}var i=e.spreadsheet.RangeRef,o=e.spreadsheet.CellRef,r=e.Class.extend({init:function(e,t,i,o){this.rangeGetter=i,this.prevLeft=function(i){var r=o(this.range(i)),n=this.range(t.prevVisible(r.topLeft[e]));return o(n).topLeft[e]},this.nextRight=function(i){var r=o(this.range(i)),n=this.range(t.nextVisible(r.bottomRight[e]));return o(n).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)}}),n=e.Class.extend({init:function(t){this._sheet=t,this.autoFillCalculator=new e.spreadsheet.AutoFillCalculator(t._grid),this.colEdge=new r("col",this._sheet._grid._columns,this.columnRange.bind(this),this.union.bind(this)),this.rowEdge=new r("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,t,o,r,n){if("autofill"==t)this._sheet.startAutoFill();else if(r&&"range"==t){var s=new i(this._sheet.activeCell().first(),e);this._sheet.select(s,!1,!1),this._sheet.startSelection(n)}else this._sheet.startSelection(n),this.select(e,t,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 r,n,s=this.determineDirection(e),a=this._sheet,l=this._viewPortHeight,c=a._grid._rows,h=a._grid._columns,w=a.currentOriginalSelectionRange(),u=a.select().toRangeRef(),g=a.activeCell(),d=w.topLeft.clone(),f=w.bottomRight.clone(),p=new o(f.row,d.col);switch(this.colEdge.boundary(u.topLeft.row,u.bottomRight.row),this.rowEdge.boundary(u.topLeft.col,u.bottomRight.col),s){case"expand-left":d.col=this.colEdge.prevLeft(d.col),r=d;break;case"shrink-right":d.col=this.colEdge.nextLeft(d.col),r=d;break;case"expand-right":f.col=this.colEdge.nextRight(f.col),r=f;break;case"shrink-left":f.col=this.colEdge.prevRight(f.col),r=f;break;case"expand-up":d.row=this.rowEdge.prevLeft(d.row),r=d;break;case"shrink-down":d.row=this.rowEdge.nextLeft(d.row),r=d;break;case"expand-down":f.row=this.rowEdge.nextRight(f.row),r=f;break;case"shrink-up":f.row=this.rowEdge.prevRight(f.row),r=f;break;case"expand-page-up":d.row=c.prevPage(d.row,l);break;case"shrink-page-up":f.row=c.prevPage(f.row,l);break;case"expand-page-down":f.row=c.nextPage(f.row,l);break;case"shrink-page-down":d.row=c.nextPage(d.row,l);break;case"first-col":d.col=h.firstVisible(),f.col=g.bottomRight.col,r=d;break;case"last-col":f.col=h.lastVisible(),d.col=g.topLeft.col,r=f;break;case"first-row":d.row=c.firstVisible(),f.row=g.bottomRight.row,r=d;break;case"last-row":f.row=c.lastVisible(),d.row=g.topLeft.row,r=f;break;case"last":f.row=c.lastVisible(),f.col=h.lastVisible(),d=g.topLeft,r=f;break;case"first":d.row=c.firstVisible(),d.col=h.firstVisible(),f=g.bottomRight,r=d;break;case"expand-word-right":f.col=h.nextUntil(f.col,t(a,f,!0)),r=f;break;case"shrink-word-right":d.col=h.nextUntil(p.col,t(a,p,!0)),r=d;break;case"expand-word-left":d.col=h.prevUntil(p.col,t(a,p,!0)),r=d;break;case"shrink-word-left":f.col=h.prevUntil(f.col,t(a,f,!0)),r=f;break;case"expand-word-up":d.row=c.prevUntil(d.row,t(a,d,!1)),r=d;break;case"shrink-word-up":f.row=c.prevUntil(f.row,t(a,f,!1)),r=f;break;case"expand-word-down":f.row=c.nextUntil(f.row,t(a,f,!1)),r=f;break;case"shrink-word-down":d.row=c.nextUntil(d.row,t(a,d,!1)),r=d}return n=new i(d,f),this.union(n).intersects(g)?(r&&a.focus(r),void this.updateCurrentSelectionRange(n)):void this.modifySelection(s.replace("shrink","expand"))},moveActiveCell:function(e){var i=this._sheet,r=i.activeCell(),n=r.topLeft,s=r.bottomRight,a=i.originalActiveCell(),l=i._grid._rows,c=i._grid._columns,h=a.row,w=a.col;switch(e){case"left":w=c.prevVisible(n.col);break;case"up":h=l.prevVisible(n.row);break;case"right":w=c.nextVisible(s.col);break;case"down":h=l.nextVisible(s.row);break;case"first-col":w=c.firstVisible();break;case"last-col":w=c.lastVisible();break;case"first-row":h=l.firstVisible();break;case"last-row":h=l.lastVisible();break;case"last":h=l.lastVisible(),w=c.lastVisible();break;case"first":h=l.firstVisible(),w=c.firstVisible();break;case"next-page":h=l.nextPage(s.row,this._viewPortHeight);break;case"prev-page":h=l.prevPage(s.row,this._viewPortHeight);break;case"word-right":w=c.nextUntil(w,t(i,s,!0));break;case"word-left":w=c.prevUntil(w,t(i,s,!0));break;case"word-up":h=l.prevUntil(h,t(i,s,!1));break;case"word-down":h=l.nextUntil(h,t(i,s,!1))}i.select(new o(h,w))},navigateInSelection:function(t){function i(e){r=e.topLeft,n=e.bottomRight}var r,n,s,a,l,c,h,w=this._sheet,u=w.activeCell(),g=u.topLeft,d=w.originalActiveCell(),f=w._grid._rows,p=w._grid._columns,b=d.row,v=d.col,k=!1,_=!1,x=g.col,R=g.row;for(i(w.currentNavigationRange()),a=!1,l=!1;!a&&!l;){switch(c=new o(b,v),h=w.singleCellSelection(),h&&(k=r.eq(c)&&w._sheetRef.topLeft.eq(c),_=n.eq(c)&&w._sheetRef.bottomRight.eq(c),k||(k=p.firstVisible()===v&&f.firstVisible()===b),_||(_=p.lastVisible()===v&&f.lastVisible()===b)),t){case"next":_?(l=!0,e.focusNextElement()):n.eq(c)?(i(w.nextNavigationRange()),b=r.row,v=r.col):(v=p.nextVisible(x),(v==x||v>n.col)&&(v=r.col,s=f.nextVisible(b),b=s==b||s>n.row?r.row:s));break;case"previous":k?(l=!0,this._sheet._workbook._view.element.find(".k-spreadsheet-name-editor .k-input").focus()):r.eq(c)?(i(w.previousNavigationRange()),b=n.row,v=n.col):(v=p.prevVisible(x),(v==x||v<r.col)&&(v=n.col,s=f.prevVisible(b),b=s==b||s<r.row?n.row:s));break;case"lower":n.eq(c)?(i(w.nextNavigationRange()),b=r.row,v=r.col):(b=f.nextVisible(R),(b==R||b>n.row)&&(b=r.row,s=p.nextVisible(v),v=s==v||s>n.col?r.col:s));break;case"upper":r.eq(c)?(i(w.previousNavigationRange()),b=n.row,v=n.col):(b=f.prevVisible(R),(b==R||b<r.row)&&(b=n.row,s=p.prevVisible(v),v=s==v||s<r.col?n.col:s));break;default:throw Error("Unknown entry navigation: "+t)}a=!this.shouldSkip(b,v),x=v,R=b}a&&(w.singleCellSelection()?w.select(new o(b,v)):w.activeCell(new o(b,v)))},extendSelection:function(e,t){var o,r=this._sheet,n=r._grid;return"autofill"===t?void this.resizeAutoFill(e):("range"===t?e=n.normalize(e):"row"===t?e=n.rowRef(e.row).bottomRight:"column"===t&&(e=n.colRef(e.col).bottomRight),o=r.originalActiveCell().toRangeRef(),void this.updateCurrentSelectionRange(new i(o.topLeft,e)))},shouldSkip:function(e,t){var i,r;return!(!this._sheet.isHiddenRow(e)&&!this._sheet.isHiddenColumn(t))||(i=new o(e,t),r=!1,this._sheet.forEachMergedCell(function(e){e.intersects(i)&&!e.collapse().eq(i)&&(r=!0)}),r)},resizeAutoFill:function(e){var t,i,o,r=this._sheet,n=r.select(),s=r._autoFillOrigin,a=this.autoFillCalculator.autoFillDest(n,e),l=this.punch(n,a);l||(o=r.range(a)._previewFillFrom(r.range(s)),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,n=i.topLeft.row==t.topLeft.row,s=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=s?"expand-up":"shrink-up";break;case"down":e=n?"expand-down":"shrink-down";break;case"prev-page":e=s?"expand-page-up":"shrink-page-up";break;case"next-page":e=n?"expand-page-down":"shrink-page-down";break;case"word-left":e=r?"expand-word-left":"shrink-word-left";break;case"word-right":e=o?"expand-word-right":"shrink-word-right";break;case"word-up":e=s?"expand-word-up":"shrink-word-up";break;case"word-down":e=n?"expand-word-down":"shrink-word-down"}return e},updateCurrentSelectionRange:function(e){var t=this._sheet;t.select(t.originalSelect().replaceAt(t.selectionRangeIndex(),e),!1)},punch:function(e,t){var r,n,s;return t.topLeft.eq(e.topLeft)&&(t.bottomRight.row<e.bottomRight.row?(n=this.rowEdge.nextRight(t.bottomRight.row),r=new i(new o(n,e.topLeft.col),e.bottomRight)):t.bottomRight.col<e.bottomRight.col&&(s=this.colEdge.nextRight(t.bottomRight.col),r=new i(new o(e.topLeft.row,s),e.bottomRight))),r}});e.spreadsheet.SheetNavigator=n}(kendo)},i(3))},1621:function(e,t){e.exports=require("./autofillcalculator")}});