@progress/kendo-ui
Version:
This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.
1 lines • 13.5 kB
JavaScript
module.exports=function(n){var i={};function r(t){if(i[t])return i[t].exports;var e=i[t]={exports:{},id:t,loaded:!1};return n[t].call(e.exports,e,e.exports,r),e.loaded=!0,e.exports}return r.m=n,r.c=i,r.p="",r(0)}({0:function(t,e,n){t.exports=n(1725)},3:function(t,e){t.exports=function(){throw Error("define cannot be used indirect")}},20:function(t,e){t.exports=require("../kendo.core")},1725:function(t,e,n){var i;n(3),n=[n(20)],void 0===(e="function"==typeof(i=function(){"use strict";var t=kendo.spreadsheet,i;function o(t){var e=Math.floor(t/26)-1;return(e>=0?o(e):"")+String.fromCharCode(65+t%26)}function f(t){if(/^[a-z_][a-z0-9_]*$/i.test(t))return t;return"'"+t.replace(/\x27/g,"\\'")+"'"}function u(t,e,n,i){var r="";++e;if(!isFinite(e))e="";else if(i!=null&&!(i&2))e="$"+e;if(!isFinite(n))n="";else{r=o(n);if(i!=null&&!(i&1))r="$"+r}if(t)return f(t)+"!"+r+e;else return r+e}var e=kendo.Class.extend({type:"ref",sheet:"",clone:function(){return this},hasSheet:function(){return this._hasSheet},simplify:function(){return this},setSheet:function(t,e){this.sheet=t;if(e!=null)this._hasSheet=e;return this},absolute:function(){return this},relative:function(){return this},adjust:function(){return this},toString:function(){return this.relative(0,0,3,3).print(0,0)},forEach:function(t,e){t.call(e,this)},map:function(t,e){return t.call(e,this)},intersects:function(t){return this.intersect(t)!==c},isCell:function(){return false},toRow:function(){return this},toColumn:function(){return this},first:function(){return this},lastRange:function(){return this},size:function(){return 1},rangeAt:function(){return this},nextRangeIndex:function(){return 0},previousRangeIndex:function(){return 0},eq:function(t){var e=this;var n=t;if(e===c||n===c)return e===n;if(n instanceof l||n instanceof a&&!(e instanceof l)){e=t;n=this}if(e instanceof l){n=n.simplify();return n instanceof l&&e.row==n.row&&e.col==n.col&&e.sheet==n.sheet}else if(e instanceof a){if(n instanceof a)return n.topLeft.eq(e.topLeft)&&n.bottomRight.eq(e.bottomRight);if(n instanceof h)return n.single()&&e.eq(n.refs[0])}else if(e instanceof h&&n instanceof h){var i=e.refs;var r=n.refs;if(i.length!=r.length)return false;for(var o=0,s=i.length;o<s;o++)if(!i[o].eq(r[o]))return false;return true}return e===n},concat:function(t){return new h([this,t])},replaceAt:function(t,e){return e},forEachColumnIndex:function(t){this.forEachAxisIndex("col",t)},forEachRowIndex:function(t){this.forEachAxisIndex("row",t)},forEachAxisIndex:function(n,t){var i=[];var e=n==="row"?"forEachRow":"forEachColumn";this[e](function(t){var e=t.first()[n];if(i.indexOf(e)===-1)i.push(e)});i.sort(function(t,e){return t>e?1:t<e?-1:0}).forEach(t)},valid:function(){return false},renameSheet:function(t,e){if(this.sheet&&this.sheet.toLowerCase()==t.toLowerCase()){this.sheet=e;return true}}}),c=(e.display=u,new(e.extend({init:function t(){},print:function(){return"#NULL!"},eq:function(t){return t===this},forEach:function(){}}))),n=e.extend({ref:"name",init:function t(e){this.name=e},clone:function(){return new n(this.name).setSheet(this.sheet,this.hasSheet())},print:function(){var t=f(this.name);if(this.hasSheet())t=f(this.sheet)+"!"+t;return t}}),l=e.extend({ref:"cell",init:function t(e,n,i){this.row=e;this.col=n;this.rel=i||0},clone:function(){return new l(this.row,this.col,this.rel).setSheet(this.sheet,this.hasSheet())},intersect:function(t){if(t instanceof l)if(this.eq(t))return this;else return c;return t.intersect(this)},print:function(t,e,n){var i=this.col,r=this.row,o=this.rel,s;if(t==null&&o){var h=this.hasSheet()?f(this.sheet)+"!":"";if(isFinite(i))i=o&1?"C["+i+"]":"C"+(i+1);else i="";if(isFinite(r))r=o&2?"R["+r+"]":"R"+(r+1);else r="";return h+r+i}else{s=this.absolute(t,e);if(n){r=s.row%1048576;i=s.col%16384;if(r<0)r+=1048576;if(i<0)i+=16384;return u(this._hasSheet&&this.sheet,r,i,o)}return s.valid()?u(this._hasSheet&&this.sheet,s.row,s.col,o):"#REF!"}},absolute:function(t,e){var n=this.clone();if(n.rel&3===0)return n;if(n.rel&1)n.col=(n.col+e)%16384;if(n.rel&2)n.row=(n.row+t)%1048576;n.rel=0;return n},toRangeRef:function(){return new a(this,this)},relative:function(t,e,n){if(n==null)n=this.rel;var i=n&2?this.row-t:this.row;var r=n&1?this.col-e:this.col;return new l(i,r,n).setSheet(this.sheet,this.hasSheet())},height:function(){return 1},width:function(){return 1},toString:function(){return u(null,this.row,this.col,3)},isCell:function(){return true},leftColumn:function(){return this},rightColumn:function(){return this},topRow:function(){return this},bottomRow:function(){return this},forEachRow:function(t){t(this.toRangeRef())},forEachColumn:function(t){t(this.toRangeRef())},adjust:function(t,e,n,i,r,o,s){var h=this.absolute(t,e);if(r){if(h.row>=o){if(s<0&&h.row<o-s)return c;h.row+=s}}else if(h.col>=o){if(s<0&&h.col<o-s)return c;h.col+=s}if(n!=null&&i!=null)h=h.relative(n,i,this.rel);return h},valid:function(){if(this.rel)throw new Error("valid() called on relative reference");var t=this.col,e=this.row;return!(isFinite(t)&&t<0||isFinite(e)&&e<0)}}),a=e.extend({ref:"range",init:function t(e,n){if(e._hasSheet&&n._hasSheet&&e.sheet.toLowerCase()!=n.sheet.toLowerCase())this.endSheet=n.sheet;this.topLeft=new l(e.row,e.col,e.rel);this.bottomRight=new l(n.row,n.col,n.rel);this.normalize()},clone:function(){return new a(this.topLeft.clone(),this.bottomRight.clone()).setSheet(this.sheet,this.hasSheet())},_containsRange:function(t){return this._containsCell(t.topLeft)&&this._containsCell(t.bottomRight)},_containsCell:function(t){return t.sheet==this.sheet&&t.row>=this.topLeft.row&&t.col>=this.topLeft.col&&t.row<=this.bottomRight.row&&t.col<=this.bottomRight.col},contains:function(t){if(t instanceof Array){var e=this;return t.some(function(t){return e.contains(t)})}if(t instanceof l)return this._containsCell(t);if(t instanceof a)return this._containsRange(t);return false},_intersectRange:function(t){if(this.sheet!=t.sheet)return c;var e=this.topLeft.col;var n=this.topLeft.row;var i=this.bottomRight.col;var r=this.bottomRight.row;var o=t.topLeft.col;var s=t.topLeft.row;var h=t.bottomRight.col;var f=t.bottomRight.row;if(e<=h&&o<=i&&n<=f&&s<=r)return new a(new l(Math.max(n,s),Math.max(e,o)),new l(Math.min(r,f),Math.min(i,h))).setSheet(this.sheet,this.hasSheet());else return c},intersect:function(t){if(t instanceof l)return this._containsCell(t)?t:c;if(t instanceof a)return this._intersectRange(t).simplify();if(t instanceof h)return t.intersect(this);return c},simplify:function(){if(this.isCell())return new l(this.topLeft.row,this.topLeft.col,this.topLeft.rel).setSheet(this.sheet,this.hasSheet());return this},normalize:function(){var t=this.topLeft,e=this.bottomRight;var n=t.row,i=t.col,r=e.row,o=e.col;var s=t.rel&2,h=t.rel&1;var f=e.rel&2,c=e.rel&1;var u,a=false;if(s===f&&h===c){if(n>r){a=true;u=n;n=r;r=u;u=s;s=f;f=u}if(i>o){a=true;u=i;i=o;o=u;u=h;h=c;c=u}if(a){this.topLeft=new l(n,i,h|s);this.bottomRight=new l(r,o,c|f)}}return this},print:function(t,e,n){if(n||this.absolute(t,e).valid()){var i=this.topLeft.print(t,e,n)+":"+this.bottomRight.print(t,e,n);if(this.hasSheet())i=f(this.sheet)+(this.endSheet?":"+f(this.endSheet):"")+"!"+i;return i}return"#REF!"},absolute:function(t,e){return new a(this.topLeft.absolute(t,e),this.bottomRight.absolute(t,e)).setSheet(this.sheet,this.hasSheet())},relative:function(t,e,n,i){if(i==null)i=n;return new a(this.topLeft.relative(t,e,n),this.bottomRight.relative(t,e,i)).setSheet(this.sheet,this.hasSheet())},height:function(){if(this.topLeft.rel!=this.bottomRight.rel)throw new Error("Mixed relative/absolute references");return this.bottomRight.row-this.topLeft.row+1},width:function(){if(this.topLeft.rel!=this.bottomRight.rel)throw new Error("Mixed relative/absolute references");return this.bottomRight.col-this.topLeft.col+1},collapse:function(){return this.topLeft.toRangeRef()},leftColumn:function(){return new a(this.topLeft,new l(this.bottomRight.row,this.topLeft.col))},rightColumn:function(){return new a(new l(this.topLeft.row,this.bottomRight.col),this.bottomRight)},topRow:function(){return new a(this.topLeft,new l(this.topLeft.row,this.bottomRight.col))},bottomRow:function(){return new a(new l(this.bottomRight.row,this.topLeft.col),this.bottomRight)},toRangeRef:function(){return this},toRow:function(t){t+=Math.max(0,this.topLeft.row);return new a(new l(t,this.topLeft.col),new l(t,this.bottomRight.col)).setSheet(this.sheet,this.hasSheet())},toColumn:function(t){t+=Math.max(0,this.topLeft.col);return new a(new l(this.topLeft.row,t),new l(this.bottomRight.row,t)).setSheet(this.sheet,this.hasSheet())},toCell:function(t,e){t+=Math.max(0,this.topLeft.row);e+=Math.max(0,this.topLeft.col);return new l(t,e,0).setSheet(this.sheet,this.hasSheet())},forEachRow:function(t){var e=this.topLeft.row;var n=this.bottomRight.row;var i=this.topLeft.col;var r=this.bottomRight.col;for(var o=e;o<=n;o++)t(new a(new l(o,i),new l(o,r)))},forEachColumn:function(t){var e=this.topLeft.row;var n=this.bottomRight.row;var i=this.topLeft.col;var r=this.bottomRight.col;for(var o=i;o<=r;o++)t(new a(new l(e,o),new l(n,o)))},intersecting:function(t){return t.filter(function(t){return t.toRangeRef().intersects(this)},this)},union:function(t,e){var n=this.intersecting(t);var i=this.topLeft.row;var r=this.topLeft.col;var o=this.bottomRight.row;var s=this.bottomRight.col;var h=false;n.forEach(function(t){t=t.toRangeRef();if(t.topLeft.row<i){h=true;i=t.topLeft.row}if(t.topLeft.col<r){h=true;r=t.topLeft.col}if(t.bottomRight.row>o){h=true;o=t.bottomRight.row}if(t.bottomRight.col>s){h=true;s=t.bottomRight.col}if(e)e(t)});var f=new a(new l(i,r),new l(o,s));if(h)return f.union(t,e);else return f},resize:function(t){var e=Math.max.bind(Math,0);function n(t){return t||0}var i=this.topLeft.row+n(t.top);var r=this.topLeft.col+n(t.left);var o=this.bottomRight.row+n(t.bottom);var s=this.bottomRight.col+n(t.right);if(r<0&&s<0||i<0&&o<0)return c;else if(i<=o&&r<=s)return new a(new l(e(i),e(r)),new l(e(o),e(s)));else return c},move:function(t,e){return new a(new l(this.topLeft.row+t,this.topLeft.col+e),new l(this.bottomRight.row+t,this.bottomRight.col+e))},first:function(){return this.topLeft.clone().setSheet(this.sheet,this.hasSheet())},isCell:function(){return!this.endSheet&&this.topLeft.eq(this.bottomRight)},toString:function(){return this.topLeft+":"+this.bottomRight},adjust:function(t,e,n,i,r,o,s){var h=this.topLeft.adjust(t,e,n,i,r,o,s);var f=this.bottomRight.adjust(t,e,n,i,r,o,s);if(h===c&&f===c)return c;if(h===c){h=this.topLeft.absolute(t,e);if(r)h.row=o;else h.col=o;if(n!=null&&i!=null)h=h.relative(n,i,this.topLeft.rel)}else if(f===c){f=this.bottomRight.absolute(t,e);if(r)f.row=o-1;else f.col=o-1;if(n!=null&&i!=null)f=f.relative(n,i,this.bottomRight.rel)}return new a(h,f).setSheet(this.sheet,this.hasSheet()).simplify()},valid:function(){return this.topLeft.valid()&&this.bottomRight.valid()}}),h=e.extend({init:function t(e){this.refs=e;this.length=e.length},clone:function(){return new h(this.refs.slice())},intersect:function(t){var e=[];for(var n=0;n<this.length;++n){var i=t.intersect(this.refs[n]);if(i!==c)e.push(i)}if(e.length>0)return new h(e).simplify();return c},simplify:function(){var t=new h(this.refs.reduce(function(t,e){e=e.simplify();if(e!==c)t.push(e);return t},[]));if(t.empty())return c;if(t.single())return t.refs[0];return t},absolute:function(e,n){return new h(this.refs.map(function(t){return t.absolute(e,n)}))},forEach:function(e,n){this.refs.forEach(function(t){if(t instanceof h)t.forEach(e,n);else e.call(n,t)},n)},toRangeRef:function(){return this.refs[0].toRangeRef()},contains:function(e){return this.refs.some(function(t){return t.contains(e)})},map:function(e,n){var i=[];this.forEach(function(t){i.push(e.call(n,t))});return new h(i)},first:function(){return this.refs[0].first()},lastRange:function(){return this.refs[this.length-1]},size:function(){return this.length},single:function(){return this.length==1},empty:function(){return this.length===0},isCell:function(){return this.single()&&this.refs[0].isCell()},rangeAt:function(t){return this.refs[t]},nextRangeIndex:function(t){if(t===this.length-1)return 0;else return t+1},previousRangeIndex:function(t){if(t===0)return this.length-1;else return t-1},concat:function(t){return new h(this.refs.concat([t]))},print:function(e,n,i){return this.refs.map(function(t){return t.print(e,n,i)}).join(",")},replaceAt:function(t,e){var n=this.refs.slice();n.splice(t,1,e);return new h(n)},leftColumn:function(){return this.map(function(t){return t.leftColumn()})},rightColumn:function(){return this.map(function(t){return t.rightColumn()})},topRow:function(){return this.map(function(t){return t.topRow()})},bottomRow:function(){return this.map(function(t){return t.bottomRow()})},forEachRow:function(e){this.forEach(function(t){t.forEachRow(e)})},forEachColumn:function(e){this.forEach(function(t){t.forEachColumn(e)})},adjust:function(e,n,i,r,o,s,h){return this.map(function(t){return t.adjust(e,n,i,r,o,s,h)}).simplify()},toString:function(){return this.refs.map(function(t){return t.toString()}).join(", ")},valid:function(){for(var t=this.refs.length;--t>=0;)if(this.refs[t].valid())return false;return true},renameSheet:function(e,n){this.refs.forEach(function(t){t.renameSheet(e,n)})}});t.NULLREF=c,t.SHEETREF=new a(new l(0,0),new l(Infinity,Infinity)),t.FIRSTREF=new l(0,0),t.Ref=e,t.NameRef=n,t.CellRef=l,t.RangeRef=a,t.UnionRef=h,t.SHEETREF.print=function(){return"#SHEET"}})?i.apply(e,n):i)||(t.exports=e)}});