UNPKG

@progress/kendo-ui

Version:

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

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