@progress/kendo-ui
Version:
This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.
1 lines • 29.9 kB
JavaScript
module.exports=function(e){function t(n){if(i[n])return i[n].exports;var r=i[n]={exports:{},id:n,loaded:!1};return e[n].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(1635),e.exports=i(1635)},3:function(e,t){e.exports=function(){throw Error("define cannot be used indirect")}},20:function(e,t){e.exports=require("../kendo.core")},948:function(e,t){e.exports=require("../kendo.color")},1590:function(e,t){e.exports=require("./runtime")},1618:function(e,t){e.exports=require("./references")},1635:function(e,t,i){var n,r,o;!function(s,define){r=[i(20),i(948),i(1590),i(1636),i(1618)],n=s,o="function"==typeof n?n.apply(t,r):n,!(void 0!==o&&(e.exports=o))}(function(){!function(e){var t,i=e.spreadsheet.RangeRef,n=e.spreadsheet.UnionRef,r=e.spreadsheet.CellRef,o=e.spreadsheet.Range,s=e.Class.extend({init:function(t){this._sheet=t,this.selection=e.spreadsheet.FIRSTREF.toRangeRef(),this.originalSelection=e.spreadsheet.FIRSTREF.toRangeRef(),this._activeCell=e.spreadsheet.FIRSTREF.toRangeRef(),this.originalActiveCell=e.spreadsheet.FIRSTREF},currentSelectionRange:function(){return this.selection.rangeAt(this.selectionRangeIndex).toRangeRef()},currentOriginalNavigationRange:function(){return this.originalSelection.rangeAt(this.selectionRangeIndex).toRangeRef()},currentNavigationRange:function(){return this.singleCellSelection()?this._sheet._sheetRef:this.selection.rangeAt(this.selectionRangeIndex).toRangeRef()},nextNavigationRange:function(){return this.singleCellSelection()||(this.selectionRangeIndex=this.selection.nextRangeIndex(this.selectionRangeIndex)),this.currentNavigationRange()},previousNavigationRange:function(){return this.singleCellSelection()||(this.selectionRangeIndex=this.selection.previousRangeIndex(this.selectionRangeIndex)),this.currentNavigationRange()},activeCell:function(e){return e&&(this.originalActiveCell=e.first(),this._activeCell=this._sheet.unionWithMerged(e.toRangeRef()),this._sheet.focus(e),this._sheet.triggerChange({activeCell:!0,selection:!0})),this._activeCell},select:function(t,n,s,l){var a,h,c,u,f,g,d;if(t){if(t.eq(this.originalSelection))return;if(this._sheet.triggerSelect(new o(t,this._sheet)),this.originalSelection=t,this.selection=n,s!==!1){if(t.isCell())this._sheet.forEachMergedCell(t,function(e){t=e.topLeft}),this.activeCell(t);else{if(t=this.selection.lastRange(),l&&l._sheet===this._sheet&&l.panes[0]){for(a=l.panes,h=0;h<a.length&&(c=a[h],u=c._currentView.rows.values,f=c._currentView.columns.values,g=new i(new r(u.start,f.start),new r(u.end,f.end)),d=t.intersect(g),d===e.spreadsheet.NULLREF);h++);d&&d!==e.spreadsheet.NULLREF&&(t=d)}this.activeCell(t.first())}this.selectionRangeIndex=this.selection.size()-1}else this._sheet.triggerChange({selection:!0})}return this.selection},singleCellSelection:function(){return this._activeCell.eq(this.selection)}}),l=e.Observable.extend({init:function(){e.Observable.prototype.init.call(this),this._reinit.apply(this,arguments)},events:["changing","commandRequest","afterInsertRow","afterDeleteRow","insertRow","insertColumn","deleteRow","deleteColumn","hideRow","hideColumn","unhideRow","unhideColumn","select","dataBinding","dataBound"],_reinit:function(t,i,n,r,o,l,a){a=a||{},this._defaultCellStyle={background:a.background,color:a.color,fontFamily:a.fontFamily,fontSize:a.fontSize,italic:a.italic,bold:a.bold,underline:a.underline,wrap:a.wrap,verticalAlign:a.verticalAlign,textAlign:a.textAlign},this._rows=new e.spreadsheet.Axis(t,n),this._columns=new e.spreadsheet.Axis(i,r),this._filteredRows=new e.spreadsheet.RangeList(0,t-1,(!1)),this._mergedCells=[],this._frozenRows=0,this._frozenColumns=0,this._suspendChanges=!1,this._filter=null,this._showGridLines=!0,this._gridLinesColor=null,this._grid=new e.spreadsheet.Grid(this._rows,this._columns,t,i,o,l),this._sheetRef=this._grid.normalize(e.spreadsheet.SHEETREF),this._properties=new e.spreadsheet.PropertyBag(t,i,this._defaultCellStyle),this._sorter=new e.spreadsheet.Sorter(this._grid,this._properties.sortable()),this._viewSelection=new s(this),this._editSelection=new s(this),this._formulaSelections=[],this._drawings=[]},_selectionState:function(){return this._inEdit?this._editSelection:this._viewSelection},navigator:function(){return this._navigator||(this._navigator=new e.spreadsheet.SheetNavigator(this)),this._navigator},axisManager:function(){return this._axisManager||(this._axisManager=new e.spreadsheet.AxisManager(this)),this._axisManager},_name:function(e){return e?(this._sheetName=e,this):this._sheetName},name:function(){return this._name()},_property:function(e,t,i){return void 0===t?e():(e(t),this.triggerChange(i))},_field:function(e,t,i){return void 0===t?this[e]:(this[e]=t,this.triggerChange(i))},suspendChanges:function(e){return void 0===e?this._suspendChanges:(this._suspendChanges=e,this)},triggerChange:function(e){return this._suspendChanges||this.trigger("change",e),this},triggerSelect:function(e){this.trigger("select",{range:e})},setDataSource:function(t,i){this.dataSourceBinder&&this.dataSourceBinder.destroy(),this.dataSourceBinder=new e.spreadsheet.SheetDataSourceBinder({dataSource:t,sheet:this,columns:i}),this.dataSource=this.dataSourceBinder.dataSource},hideColumn:function(e){if(!this.trigger("hideColumn",{index:e}))return this._property(this._columns.hide.bind(this._columns),e,{layout:!0})},unhideColumn:function(e){if(!this.trigger("unhideColumn",{index:e}))return this._property(this._columns.unhide.bind(this._columns),e,{layout:!0})},isHiddenColumn:function(e){return this._grid._columns.hidden(e)},_copyRange:function(e,t){var i=this._grid,n=i.rowCount,r=i.normalize(e.topLeft),o=i.normalize(e.bottomRight),s=r.col*n+r.row,l=o.col*n+o.row,a=t.col*n+t.row;this._properties.copy(s,l,a)},_saveModifiedFormulas:function(e,i){var n,r=t;return t=e,n=i(),t=r,n},_restoreModifiedFormulas:function(t){var i=this._workbook;t.forEach(function(t){var n,r=i.sheetByName(t.sheet);t instanceof e.spreadsheet.calc.runtime.Formula&&(n=r._grid.cellRefIndex(t),r._properties.set("formula",n,n,t)),t instanceof e.spreadsheet.validation.Validation&&(n=r._grid.cellRefIndex(t),r._properties.set("validation",n,n,t))})},_adjustReferences:function(n,r,o,s){var l,a,h;this._mergedCells=s.reduce(function(e,t){return t=t.adjust(null,null,null,null,"row"==n,r,o),t instanceof i&&e.push(t),e},[]),this._workbook&&(l=this._name(),this._workbook._sheets.forEach(function(e){e._forFormulas(function(e){var i=e.adjust(l,n,r,o);i&&t&&t.push(i)}),e._forValidations(function(e){var i=e.adjust(l,n,r,o);i&&t&&t.push(i)})}),this._workbook.adjustNames(l,"row"==n,r,o)),a=this.select(),a=a.adjust(null,null,null,null,"row"==n,r,o),a!==e.spreadsheet.NULLREF&&this.select(a),h="col"==n?this._columns:this._rows,h.adjust(r,o),"row"==n&&(o<0?this._filteredRows.copy(r-o,this._rows._count-1,r):(this._filteredRows.copy(r,this._rows._count,r+o),this._filteredRows.value(r,r+o-1,!1))),this._drawings.forEach(function(e){e.topLeftCell&&(e.topLeftCell=e.topLeftCell.adjust(null,null,null,null,"row"==n,r,o))})},_forFormulas:function(e){var t=this._properties,i=t.get("formula").values(),n=i.length;i.forEach(function(t,i){e.call(this,t.value,i,n)},this)},_forValidations:function(e){var t=this._properties;t.get("validation").values().forEach(function(t){e.call(this,t.value)},this)},preventInsertRow:function(e,t){var i,n;return this.selectedHeaders().allRows?{reason:"error",type:"insertRowWhenColumnIsSelected"}:(t=t||1,i=this._grid,n=this.range(i.rowCount-t,0,t,i.columnCount),!!n.hasValue()&&{reason:"error",type:"shiftingNonblankCells"})},preventInsertBelowLastRow:function(e,t){return t=t||1,e+t===this._rows._count&&{reason:"error",type:"insertRowBelowLastRow"}},preventInsertColumn:function(e,t){var i,n;return this.selectedHeaders().allCols?{reason:"error",type:"insertColumnWhenRowIsSelected"}:(t=t||1,i=this._grid,n=this.range(0,i.columnCount-t,i.rowCount,t),!!n.hasValue()&&{reason:"error",type:"shiftingNonblankCells"})},preventInsertAfterLastColumn:function(e,t){return t=t||1,e+t===this._columns._count&&{reason:"error",type:"insertColAfterLastCol"}},insertRow:function(e,t){var n=this.preventInsertRow(e);if(n)throw Error("Shifting nonblank cells off the worksheet is not supported!");if(!this.trigger("insertRow",{index:e}))return this.batch(function(){var t,n,s,l,a,h,c=this._grid,u=c.columnCount,f=c.rowCount,g=this.frozenRows();for(e<g&&this.frozenRows(g+1),t=this._mergedCells.slice(),n=0;n<u;n++)s=new i(new r(e,n),new r(e,n)),l=c.normalize(s.topLeft),a=c.normalize(s.bottomRight),h=new i(new r(l.row,l.col),new r(f-2,a.col)),this._copyRange(h,new r(l.row+1,l.col)),new o(s,this).clear({clearAll:!0,keepBorders:!0});this._adjustReferences("row",e,1,t)},{recalc:!0,layout:!0,insertRow:{index:e},ref:new i(new r(e,0),new r(1/0,1/0))}),t||this.trigger("afterInsertRow",{index:e}),this},isEnabledRow:function(e){var t=new i(new r(e,0),new r(e,this._grid.columnCount));return new o(t,this).enable()},deleteRow:function(e,t){if(!this.isEnabledRow(e))return this;if(!this.trigger("deleteRow",{index:e}))return this.batch(function(){var t,n,s,l,a,h,c,u=this._grid,f=u.columnCount,g=this.frozenRows();for(e<g&&this.frozenRows(g-1),t=this._mergedCells.slice(),n=0;n<f;n++)s=new i(new r(e,n),new r(e,n)),new o(s,this).clear({clearAll:!0,keepBorders:!0}),l=u.normalize(s.topLeft),a=u.normalize(s.bottomRight),h=new i(new r(l.row+1,l.col),new r(1/0,a.col)),this._copyRange(h,l),c=u.normalize(h.bottomRight),new o(new i(c,c),this).clear();this._adjustReferences("row",e,-1,t)},{recalc:!0,layout:!0,deleteRow:{index:e},ref:new i(new r(e,0),new r(1/0,1/0))}),t||this.trigger("afterDeleteRow",{index:e}),this},insertColumn:function(e){if(!this.trigger("insertColumn",{index:e}))return this.batch(function(){var t,n,s,l,a,h,c=this._grid,u=c.columnCount,f=this.frozenColumns();for(e<f&&this.frozenColumns(f+1),t=this._mergedCells.slice(),n=u;n>=e&&(s=new i(new r(0,n),new r(1/0,n)),new o(s,this).clear({clearAll:!0,keepBorders:!0}),n!=e);n--)l=c.normalize(s.topLeft),a=c.normalize(s.bottomRight),h=new i(new r(l.row,l.col-1),new r(a.row,a.col-1)),this._copyRange(h,l);this._adjustReferences("col",e,1,t)},{recalc:!0,layout:!0,insertColumn:{index:e},ref:new i(new r(0,e),new r(1/0,1/0))}),this},isEnabledColumn:function(e){var t=new i(new r(0,e),new r(1/0,e));return new o(t,this).enable()},deleteColumn:function(e){if(!this.isEnabledColumn(e))return this;if(!this.trigger("deleteColumn",{index:e}))return this.batch(function(){var t,n,s,l,a,h,c=this._grid,u=c.columnCount,f=this.frozenColumns();for(e<f&&this.frozenColumns(f-1),t=this._mergedCells.slice(),n=e;n<u&&(s=new i(new r(0,n),new r(1/0,n)),new o(s,this).clear({clearAll:!0,keepBorders:!0}),n!=u-1);n++)l=c.normalize(s.topLeft),a=c.normalize(s.bottomRight),h=new i(new r(l.row,l.col+1),new r(a.row,a.col+1)),this._copyRange(h,l);this._adjustReferences("col",e,-1,t)},{recalc:!0,layout:!0,deleteColumn:{index:e},ref:new i(new r(0,e),new r(1/0,1/0))}),this},_filterRow:function(e){this._rows.hide(e),this._filteredRows.value(e,e,!0),this.triggerChange({layout:!0})},hideRow:function(e){if(!this.trigger("hideRow",{index:e}))return this._property(this._rows.hide.bind(this._rows),e,{layout:!0})},unhideRow:function(e){if(!this.trigger("unhideRow",{index:e}))return this._property(this._rows.unhide.bind(this._rows),e,{layout:!0})},isHiddenRow:function(e){return this._grid._rows.hidden(e)},isFilteredRow:function(e){return this._filteredRows.value(e)},columnWidth:function(e,t){return this._property(this._columns.value.bind(this._columns,e,e),t,{layout:!0})},rowHeight:function(e,t){return this._property(this._rows.value.bind(this._rows,e,e),t,{layout:!0})},frozenRows:function(e){return this._field("_frozenRows",e,{layout:!0})},frozenColumns:function(e){return this._field("_frozenColumns",e,{layout:!0})},showGridLines:function(e){return this._field("_showGridLines",e,{layout:!0})},gridLinesColor:function(e){return this._field("_gridLinesColor",e,{layout:!0})},_ref:function(t,n,o,s){var l=null;return t instanceof e.spreadsheet.Ref?t:t instanceof e.spreadsheet.Range?t._ref.toRangeRef():("string"==typeof t?l=e.spreadsheet.calc.parseReference(t):(o||(o=1),s||(s=1),l=new i(new r(t,n),new r(t+o-1,n+s-1))),l)},range:function(e,t,i,n){return new o(this._ref(e,t,i,n),this)},_getMergedCells:function(e){var t=this._grid,i={},n={},r=!1;return this.forEachMergedCell(e,function(o){var s=o.topLeft;t.forEach(o,function(t){s.eq(t)?(i[t.print()]=o,r=!0):e.contains(t)&&(n[t.print()]=s,r=!0)})}),{primary:i,secondary:n,hasMerged:r}},forEachMergedCell:function(e,t){var i=!1;void 0===t&&(t=e,i=!0),this._mergedCells.forEach(function(n){(i||n.intersects(e))&&t(n)})},forEachFilterHeader:function(e,t){var i,n=!1;void 0===t&&(t=e,n=!0),this._filter&&(i=[],this._filter.ref.forEachColumn(function(t){(n||t.intersects(e))&&i.push(t.topLeft)}),this._mergedCells.forEach(function(e){i=i.map(function(t){return e.intersects(t)?e:t})}),i.reduce(function(e,t){return e.indexOf(t)<0&&e.push(t),e},[]).forEach(t))},forEach:function(e,t){function r(e){function n(e){t(a++,l,e)}var r,s,l,a,h,c;for(e instanceof i||(e=e.toRangeRef()),r=o._grid.normalize(e.topLeft),s=o._grid.normalize(e.bottomRight),l=r.col;l<=s.col;l++)a=r.row,h=o._grid.index(a,l),c=o._grid.index(s.row,l),o._properties.forEach(h,c,n)}var o=this;e instanceof i||(e=o._ref(e)),e instanceof n?e.forEach(r):r(e)},startResizing:function(e){this._initialPosition=e,this._resizeInProgress=!0},startAutoFill:function(){this._autoFillInProgress=!0;var e=this.select();this._autoFillOrigin=e,this._autoFillDest=e,this.triggerChange({selection:!0})},updateAutoFill:function(e,t,i,n){this._autoFillDest=e,this._autoFillPunch=t,this._autoFillHint=i,this._autoFillDirection=n,this.triggerChange({selection:!0})},autoFillRef:function(){return this._autoFillDest},autoFillPunch:function(){return this._autoFillPunch},autoFillInProgress:function(){return this._autoFillInProgress},resizingInProgress:function(){return this._resizeInProgress},draggingInProgress:function(){return this._draggingInProgress},completeResizing:function(){var e,t;this._resizeInProgress&&(this._resizeInProgress=!1,e=this.resizeHintPosition(),this._initialPosition&&e?(t=this.resizeHandlePosition(),t.col!==-(1/0)?this.trigger("commandRequest",{command:"ColumnWidthCommand",options:{target:t.col,value:this.columnWidth(t.col)-(this._initialPosition.x-e.x)}}):this.trigger("commandRequest",{command:"RowHeightCommand",options:{target:t.row,value:this.rowHeight(t.row)-(this._initialPosition.y-e.y)}})):this.trigger("change",{resize:!0}))},_renderComment:function(e){var t=e?this.range(e).comment():null;t?this._commentRef&&e.eq(this._commentRef)||(this._commentRef=e,this.trigger("change",{comment:!0})):this._commentRef&&(this._commentRef=null,this.trigger("change",{comment:!0}))},resizeHandlePosition:function(){return this._resizeHandlePosition},resizeHintPosition:function(e){return void 0!==e&&(this._resizeHintPosition=e,this.trigger("change",{resize:!0})),this._resizeHintPosition},removeResizeHandle:function(){this._resizeHandlePosition&&(this._resizeHintPosition=void 0,this._resizeHandlePosition=void 0,this._initialPosition=void 0,this.trigger("change",{resize:!0}))},positionResizeHandle:function(e){this._resizeHandlePosition=e,this.trigger("change",{resize:!0})},startDragging:function(e){this._draggingInProgress=e},completeDragging:function(){var e,t,i,n,o,s,l=this._draggingInProgress;if(l){if(this._draggingInProgress=null,e=l.drawing,e.eq(l.copy))return;e.topLeftCell&&(t=this.drawingBoundingBox(e),i=this._rows.indexVisible(t.top),n=this._columns.indexVisible(t.left),o=new r(i,n),s=this.refBoundingBox(o),e.offsetX=t.left-s.left,e.offsetY=t.top-s.top,e.topLeftCell=o,this.triggerChange({dragging:!0})),this.trigger("commandRequest",{command:"DrawingUpdateCommand",options:{sheet:this,drawing:e,previous:l.copy}})}},startSelection:function(e){this.frozenRows()||this.frozenColumns()?this._currentView=null:e&&e._sheet===this&&(this._currentView=e),this._selectionInProgress=!0},completeSelection:function(){var e,t;this._selectionInProgress&&(this._selectionInProgress=!1,this._resizeHintPosition=void 0,this.trigger("change",{selection:!0})),this._autoFillInProgress&&(this._autoFillInProgress=!1,e=this._autoFillDest,t=this._autoFillOrigin,this._autoFillPunch?this.trigger("commandRequest",{command:"ClearContentCommand",options:{operatingRange:this.range(this._autoFillPunch)}}):e.eq(t)?this.triggerChange({selection:!0}):this.trigger("commandRequest",{command:"AutoFillCommand",options:{operatingRange:this.range(e),origin:this.range(t)}}),this._autoFillDest=null,this._autoFillPunch=null,this._autoFillOrigin=null,this.select(e))},selectionInProgress:function(){return this._selectionInProgress},select:function(e,t){var i,n=this._selectionState();return e&&(e=this._ref(e),e=this._grid.normalize(e),i=this._grid.isAxis(e)?e:this.unionWithMerged(e)),n.select(e,i,t,this._currentView)},originalSelect:function(){return this._selectionState().originalSelection},currentSelectionRange:function(){return this._selectionState().currentSelectionRange()},currentOriginalSelectionRange:function(){return this._selectionState().currentOriginalNavigationRange()},currentNavigationRange:function(){return this._selectionState().currentNavigationRange()},nextNavigationRange:function(){return this._selectionState().nextNavigationRange()},previousNavigationRange:function(){return this._selectionState().previousNavigationRange()},selectionRangeIndex:function(){return this._selectionState().selectionRangeIndex},activeCell:function(e){return this._selectionState().activeCell(e)},originalActiveCell:function(){return this._selectionState().originalActiveCell},singleCellSelection:function(){return this._selectionState().singleCellSelection()},unionWithMerged:function(e){var t=this._mergedCells;return e.map(function(e){return e.toRangeRef().union(t)})},trim:function(e){var t=[],i=this._grid;return this._properties.forEachProperty(function(n){t.push(i.trim(e,n.list))}),this.unionWithMerged(e.topLeft.toRangeRef().union(t))},focus:function(e){if(!e){var t=this._focus;return this._focus=null,t}this._focus=e.toRangeRef()},activeCellSelection:function(){return new o(this._grid.normalize(this.activeCell()),this)},selection:function(){return new o(this._grid.normalize(this._selectionState().selection),this)},selectedHeaders:function(){var e=this.select(),t={},i={},n=!1,r=!1,o=this._grid.rowCount-1,s=this._grid.columnCount-1;return e.forEach(function(e){var l,a,h,c,u,f="partial",g="partial";if(e=e.toRangeRef(),a=e.bottomRight,h=e.topLeft,c=h.col<=0&&a.col>=s,u=h.row<=0&&a.row>=o,u&&(r=!0,g="full"),c&&(n=!0,f="full"),!u)for(l=h.row;l<=a.row;l++)"full"!==t[l]&&(t[l]=f);if(!c)for(l=h.col;l<=a.col;l++)"full"!==i[l]&&(i[l]=g)}),{rows:t,cols:i,allRows:r,allCols:n,all:r&&n}},isInEditMode:function(e){return void 0===e?this._inEdit:(this._inEdit=e,void(e&&(this._editSelection.selection=this._viewSelection.selection.clone(),this._editSelection.originalSelection=this._viewSelection.originalSelection.clone(),this._editSelection._activeCell=this._viewSelection._activeCell.clone(),this._editSelection.originalActiveCell=this._viewSelection.originalActiveCell.clone())))},_setFormulaSelections:function(e){this._formulaSelections=(e||[]).slice(),this.triggerChange({selection:!0})},_viewActiveCell:function(){return this._viewSelection._activeCell.toRangeRef()},toJSON:function(){function t(e){Object.keys(a).forEach(function(t){e[t]===a[t]&&delete e[t]})}var i,n={},r=this._rows.toJSON("height",n),o=this._columns.toJSON("width",{}),s=this._viewSelection,l=[],a=this._defaultCellStyle||{};return this.forEach(e.spreadsheet.SHEETREF,function(i,o,s){if(t(s),0!==Object.keys(s).length){s.link&&l.push({ref:e.spreadsheet.Ref.display(null,i,o),target:s.link});var a=n[i];void 0===a&&(a=r.length,r.push({index:i}),n[i]=a),i=r[a],s.index=o,void 0===i.cells&&(i.cells=[]),s.formula&&(s.formula=s.formula.arrayFormulaRange?{src:""+s.formula,ref:""+s.formula.arrayFormulaRange}:""+s.formula),s.validation&&(s.validation=s.validation.toJSON()),s.color&&(s.color=e.parseColor(s.color).toCss()),s.background&&(s.background=e.parseColor(s.background).toCss()),s.borderTop&&s.borderTop.color&&(s.borderTop.color=e.parseColor(s.borderTop.color).toCss()),s.borderBottom&&s.borderBottom.color&&(s.borderBottom.color=e.parseColor(s.borderBottom.color).toCss()),s.borderRight&&s.borderRight.color&&(s.borderRight.color=e.parseColor(s.borderRight.color).toCss()),s.borderLeft&&s.borderLeft.color&&(s.borderLeft.color=e.parseColor(s.borderLeft.color).toCss()),i.cells.push(s)}}),i={name:this._name(),rows:r,columns:o,selection:""+s.selection,activeCell:""+s.activeCell(),frozenRows:this.frozenRows(),frozenColumns:this.frozenColumns(),showGridLines:this.showGridLines(),gridLinesColor:this.gridLinesColor(),mergedCells:this._mergedCells.map(function(e){return""+e}),hyperlinks:l,defaultCellStyle:a,drawings:this._drawings.map(function(e){return e.toJSON()})},this._sort&&(i.sort={ref:""+this._sort.ref,columns:this._sort.columns.map(function(e){return{index:e.index,ascending:e.ascending}})}),this._filter&&(i.filter={ref:""+this._filter.ref,columns:this._filter.columns.map(function(e){var t=e.filter.toJSON();return t.index=e.index,t})}),i},fromJSON:function(t){this.batch(function(){var i,n,r,o,s,l,h,c,u,f,g,d;if(void 0!==t.name&&this._name(t.name),void 0!==t.frozenColumns&&this.frozenColumns(t.frozenColumns),void 0!==t.frozenRows&&this.frozenRows(t.frozenRows),void 0!==t.columns&&this._columns.fromJSON("width",t.columns),void 0!==t.rows)for(this._rows.fromJSON("height",t.rows),i=0;i<t.rows.length;i++)if(n=t.rows[i],r=n.index,void 0===r&&(r=i),n.cells)for(o=0;o<n.cells.length;o++)s=n.cells[o],l=s.index,void 0===l&&(l=o),s.formula&&(h="string"!=typeof s.formula,c=h?s.formula.src:s.formula,u=this._compileFormula(r,l,c),h&&u.setArrayFormulaRange(e.spreadsheet.calc.parseReference(s.formula.ref)),s.formula=u),s.validation&&(s.validation=this._compileValidation(r,l,s.validation)),this._properties.fromJSON(this._grid.index(r,l),s);t.drawings&&(this._drawings=t.drawings.map(a.fromJSON)),t.selection&&(this._viewSelection.selection=this._viewSelection.originalSelection=this._ref(t.selection)),t.activeCell&&(f=this._ref(t.activeCell),this._viewSelection._activeCell=f.toRangeRef(),this._viewSelection.originalActiveCell=f.first()),t.mergedCells&&t.mergedCells.forEach(function(e){this.range(e).merge()},this),t.sort&&(this._sort={ref:this._ref(t.sort.ref),columns:t.sort.columns.slice(0)}),t.filter&&(g=t.filter.ref,d=void 0===t.filter.columns?[]:t.filter.columns,g?(this._filter={ref:this._ref(g),columns:d.map(function(t){return{index:t.index,filter:e.spreadsheet.Filter.create(t)}})},this._refreshFilter()):e.logToConsole("Dropping filter for sheet '"+t.name+"' due to missing ref")),void 0!==t.showGridLines&&(this._showGridLines=t.showGridLines),this._gridLinesColor=t.gridLinesColor}),this._rows._refresh(),this._columns._refresh()},formula:function(e){return this._properties.get("formula",this._grid.cellRefIndex(e))},validation:function(e){return this._properties.get("validation",this._grid.cellRefIndex(e))},resetFormulas:function(){this._forFormulas(function(e){e.reset()})},resetValidations:function(){this._forValidations(function(e){e.reset()})},recalc:function(e,t){function i(){o--,s!=r||o||t()}var n=this._properties.get("formula").values(),r=n.length,o=0,s=0;if(!r&&t)return t();for(;s<r;)o++,n[s++].value.exec(e,t?i:null)},revalidate:function(e){var t=this;this._forValidations(function(n){var o=new r(n.row,n.col),s=new i(o,o);n.exec(e,t._get(s,"value"),t._get(s,"format"))})},_value:function(e,t,i){var n=this._grid.index(e,t);return void 0===i?this._properties.get("value",n):void this._properties.set("value",n,n,i)},_validation:function(e,t){var i=this._grid.index(e,t);return this._properties.get("validation",i)},_compileValidation:function(t,i,n){return n instanceof e.spreadsheet.validation.Validation?n.clone(this._name(),t,i):(null!=n.from&&(n.from=(n.from+"").replace(/^=/,"")),null!=n.to&&(n.to=(n.to+"").replace(/^=/,"")),e.spreadsheet.validation.compile(this._name(),t,i,n))},_compileFormula:function(t,i,n){return n=n.replace(/^=/,""),n=e.spreadsheet.calc.parseFormula(this._name(),t,i,n),e.spreadsheet.calc.compile(n)},_copyValuesInRange:function(e,t,i,n){var r,o,s,l,a;for(r=e.col;r<=t.col;r++)for(o=this._grid.index(e.row,r),s=this._grid.index(t.row,r),l=o,a=e.row;l<=s;++l,++a)i=i.clone(this._name(),a,r),this._properties.set(n,l,l,i);return i},_set:function(t,i,n){var r,o,s,l=this._grid.normalize(t.topLeft),a=this._grid.normalize(t.bottomRight);if("number"==typeof n&&(n=e.spreadsheet.calc.runtime.limitPrecision(n)),n&&"formula"==i)"string"==typeof n&&(n=this._compileFormula(l.row,l.col,n)),n=this._copyValuesInRange(l,a,n,"formula");else if(n&&"validation"==i)n=this._compileValidation(l.row,l.col,n),n=this._copyValuesInRange(l,a,n,"validation");else for(r=l.col;r<=a.col;r++)o=this._grid.index(l.row,r),s=this._grid.index(a.row,r),this._properties.set(i,o,s,n),"formula"==i&&this._properties.set("value",o,s,null)},_get:function(e,t){var i=this._grid.normalize(e.topLeft),n=this._grid.index(i.row,i.col);return this._properties.get(t,n)},batch:function(e,t){var i=this.suspendChanges();return this.suspendChanges(!0),e.call(this),this.suspendChanges(i).triggerChange(t||{recalc:!0})},_sortBy:function(e,t){var i=null;t.forEach(function(t){i=this._sorter.sortBy(e,t.index,this._properties.get("value"),t.ascending,i)},this),this._sort={ref:e,columns:t},this._refreshFilter(),this.forEach(e,function(e,t,i){var n,r,o=i.formula;o&&(n=e-o.row,0!==n&&(r=n>0?o.row:o.row+n,o.adjust(this.name(),"row",r,n)))}.bind(this)),this.triggerChange({recalc:!0})},_refreshFilter:function(){this._filter&&this._filterBy(this._filter.ref,this._filter.columns)},_filterBy:function(t,i){this.batch(function(){for(var n=t.topLeft.row;n<=t.bottomRight.row;n++)this.isFilteredRow(n)&&(this._filteredRows.value(n,n,!1),this._rows.unhide(n));i.forEach(function(i){var n,r,o,s=t.resize({top:1}).toColumn(i.index),l=[];if(s!==e.spreadsheet.NULLREF)for(this.forEach(s,function(e,t,i){i.row=e,l.push(i)}),i.filter.prepare(l),n=0;n<l.length;n++)r=l[n],o=i.filter.value(r),i.filter.matches(o)===!1&&this._filterRow(r.row)},this),this._filter={ref:t,columns:i}},{recalc:!0,layout:!0,filter:!0})},filterColumn:function(e){var t=this.filter().ref;return e.toRangeRef().topLeft.col-t.topLeft.col},filter:function(){return this._filter},clearFilter:function(e){this._clearFilter(e instanceof Array?e:[e])},_clearFilter:function(e){this._filter&&this.batch(function(){this._filter.columns=this._filter.columns.filter(function(t){return e.indexOf(t.index)<0}),this._refreshFilter()},{recalc:!0,layout:!0,filter:!0})},getAxisState:function(){return{rows:this._rows.getState(),columns:this._columns.getState()}},setAxisState:function(e){this._rows.setState(e.rows),this._columns.setState(e.columns),this.triggerChange({layout:!0})},getState:function(){return{rows:this._rows.getState(),columns:this._columns.getState(),mergedCells:this._mergedCells.map(function(e){return e.clone()}),properties:this._properties.getState()}},setState:function(t){this._rows.setState(t.rows),this._columns.setState(t.columns),this._mergedCells=t.mergedCells,this._properties.setState(t.properties),this.triggerChange(e.spreadsheet.ALL_REASONS)},_merge:function(t){var i,n=this._mergedCells,r=this;return this.batch(function(){i=t.map(function(t){var i,s,l,a,h,c,u;return t instanceof e.spreadsheet.CellRef?t:(i=t.toRangeRef().union(n,function(e){n.splice(n.indexOf(e),1)}),s=new o(i,r),l=s._get("formula"),a=s.value(),h=s.format(),c=s.background(),s.value(null),s.format(null),s.background(null),u=new o(i.collapse(),r),l?u._set("formula",l):u.value(a),u.format(h),u.background(c),n.push(i),i)});var s=r._viewSelection;s.selection=r.unionWithMerged(s.originalSelection),s._activeCell=r.unionWithMerged(s.originalActiveCell)},{activeCell:!0,selection:!0}),i},_useCultureDecimals:function(){return this._workbook&&this._workbook.options.useCultureDecimals},withCultureDecimals:function(t){var i=".";return this._useCultureDecimals()&&(i=e.culture().numberFormat["."]),e.spreadsheet.calc.withDecimalSeparator(i,t)},drawingBoundingBox:function(t){var i=t.offsetX,n=t.offsetY;return t.topLeftCell&&(i+=this._columns.sum(0,t.topLeftCell.col-1),n+=this._rows.sum(0,t.topLeftCell.row-1)),new e.spreadsheet.Rectangle(i,n,t.width,t.height)},refBoundingBox:function(e){return this._grid.rectangle(e.toRangeRef())},addDrawing:function(e,t){return e instanceof a||(e=new a(e)),this._drawings.push(e),t&&(this._activeDrawing=e),this.triggerChange({layout:!0}),e},removeDrawing:function(e){var t=this._drawings.indexOf(e);t>=0&&(this._drawings.splice(t,1),this.triggerChange({layout:!0}))},usesImage:function(e){for(var t=this._drawings.length;--t>=0;)if(this._drawings[t].image===e)return!0;return!1}}),a=e.Class.extend({init:function(e){this.reset(e)},toJSON:function(){return{topLeftCell:""+this.topLeftCell,offsetX:this.offsetX,offsetY:this.offsetY,width:this.width,height:this.height,image:this.image,opacity:this.opacity}},clone:function(){return new a(this)},reset:function(t){var i=t.topLeftCell;"string"==typeof i&&(i=e.spreadsheet.calc.parseReference(i)),this.topLeftCell=i,this.offsetX=t.offsetX||0,this.offsetY=t.offsetY||0,this.width=t.width,this.height=t.height,this.image=t.image,this.opacity=null!=t.opacity?t.opacity:1},eq:function(e){return(!this.topLeftCell&&!e.topLeftCell||this.topLeftCell&&e.topLeftCell&&this.topLeftCell.eq(e.topLeftCell))&&this.offsetX===e.offsetX&&this.offsetY===e.offsetY&&this.width===e.width&&this.height===e.height&&this.image===e.image&&this.opacity===e.opacity}});a.fromJSON=function(e){return new a(e)},e.spreadsheet.Sheet=l,e.spreadsheet.Drawing=a}(kendo)},i(3))},1636:function(e,t){e.exports=require("./validation")}});