@progress/kendo-ui
Version:
This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.
1 lines • 4.58 kB
JavaScript
module.exports=function(t){var n={};function o(e){if(n[e])return n[e].exports;var r=n[e]={exports:{},id:e,loaded:!1};return t[e].call(r.exports,r,r.exports,o),r.loaded=!0,r.exports}return o.m=t,o.c=n,o.p="",o(0)}({0:function(e,r,t){e.exports=t(1683)},3:function(e,r){e.exports=function(){throw Error("define cannot be used indirect")}},973:function(e,r){e.exports=require("./range")},1683:function(e,r,t){var n;t(3),t=[t(1684),t(973)],void 0===(r="function"==typeof(n=function(){"use strict";var e=kendo.spreadsheet,r=e.Range,t,v=e.calc.runtime.Formula,y="incompatibleRanges",L="noFillDirection",x=r.FillError=function(e){this.code=e};function p(r){var e=r.length;var t=(e+1)/2,n=r.reduce(function(e,r){return e+r},0)/e;var o=0,i=0;for(var a=0;a<e;a++){var l=a+1-t,u=r[a]-n;o+=l*u;i+=l*l}if(!i)return function(e){return r[e%r.length]};var f=o/i,s=n-f*t;return function(e){return s+f*(e+1)}}function F(u){function f(e){var r=e[1]-e[0];for(var t=2;t<e.length;++t)if(e[t]-e[t-1]!=r)return null;return r}function s(e){return e.map(function(e){return e.number})}var c=[];var h=u.map(function(e){return e.formula||e.value});n(h,function(e,r,t,n){var o,i;if(t=="number"){i=s(n);o=p(i)}else if(t=="string"||t=="formula"||t=="boolean")o=function(e,r){return h[r]};else if(Array.isArray(t))if(n.length==1)o=function(e){return t[(n[0].number+e)%t.length]};else{var a=f(s(n));if(a==null)o=function(e){return n[e%n.length].value};else o=function(e){var r=n[0].number+a*e;return t[r%t.length]}}else if(t!="null"){i=s(n);if(i.length==1)i.push(i[0]+1);i=p(i);o=function(e,r){return h[r].replace(/^(.*[\D0]+)\d+/,"$1"+i(e,r))}}else o=function(){return null};var l={f:o,begin:e,end:r,len:r-e};for(var u=e;u<r;++u)c[u]=l});return function(e,r){var t=c[r];var n=e/h.length|0;var o=e%h.length;var i=n*t.len+o-t.begin;var a=t.f(i,r);var l=d(u[r]);delete l.enable;if(a instanceof v)l.formula=a;else l.value=a;return l}}function d(r){var t={};Object.keys(r||{}).forEach(function(e){t[e]=r[e]});return t}function n(e,r){var t=null,n=0,o=[],i;for(var a=0;a<e.length;++a){i=l(e[a]);o.push(i);if(t!=null&&i.type!==t.type){r(n,a,t.type,o.slice(n,a));n=a}t=i}r(n,a,t.type,o.slice(n,a))}function l(e){if(typeof e=="number")return{type:"number",number:e};if(typeof e=="string"){var r=o(e);if(r)return r;var t=/^(.*\D)(\d+)/.exec(e);if(t){e=e.replace(/^(.*\D)\d+/,"$1-######");return{type:e,match:t,number:parseFloat(t[2])}}return{type:"string"}}if(typeof e=="boolean")return{type:"boolean"};if(e==null)return{type:"null"};if(e instanceof v)return{type:"formula"};window.console.error(e);throw new Error("Cannot fill data")}function u(){var e=kendo.culture();return[e.calendars.standard.days.namesAbbr,e.calendars.standard.days.names,e.calendars.standard.months.namesAbbr,e.calendars.standard.months.names]}function o(e){var r=e.toLowerCase();var t=u();for(var n=0;n<t.length;++n){var o=t[n];for(var i=o.length;--i>=0;){var a=o[i].toLowerCase();if(a==r)return{type:o,number:i,value:e}}}}function R(e){var r=e.length,t=e[0].length;var n=[];for(var o=0;o<t;++o){n[o]=[];for(var i=0;i<r;++i)n[o][i]=e[i][o]}return n}r.prototype._previewFillFrom=function(e,r){var s=this,t=s._sheet;if(typeof e=="string")e=t.range(e);var n=e._ref.toRangeRef().clone().setSheet(t.name());var o=s._ref.toRangeRef().clone().setSheet(t.name());if(n.intersects(o)){if(n.eq(o))return null;o=o.clone();if(n.topLeft.eq(o.topLeft))if(n.width()==o.width()){o.topLeft.row+=n.height();r=0}else if(n.height()==o.height()){o.topLeft.col+=n.width();r=1}else throw new x(y);else if(n.bottomRight.eq(o.bottomRight))if(n.width()==o.width()){o.bottomRight.row-=n.height();r=2}else if(n.height()==o.height()){o.bottomRight.col-=n.width();r=3}else throw new x(y);else throw new x(y);return t.range(o)._previewFillFrom(e,r)}if(r==null)if(n.topLeft.col==o.topLeft.col)r=n.topLeft.row<o.topLeft.row?0:2;else if(n.topLeft.row==o.topLeft.row)r=n.topLeft.col<o.topLeft.col?1:3;else throw new x(L);var i=r&1;var c=r&2;if(i&&n.height()!=o.height()||!i&&n.width()!=o.width())throw new x(y);var a=e._properties(),l;if(!i){a=R(a);l=o.height()}else l=o.width();var h=new Array(a.length);var v=null;for(var p=0;p<a.length;++p){var u=a[p];var d=F(u);var g=h[p]=new Array(l);for(var f=0;f<l;++f){var m=c?-f-1:u.length+f;var w=c?u.length-f%u.length-1:f%u.length;var b=g[c?l-f-1:f]=d(m,w);if(b.value!=null)v=b.value}}if(!i)h=R(h);return{props:h,direction:r,dest:s,hint:v}},r.prototype.fillFrom=function(e,r){var t=this._previewFillFrom(e,r);t.dest._properties(t.props,true);return t.dest}})?n.apply(r,t):n)||(e.exports=r)},1684:function(e,r){e.exports=require("./runtime")}});