@progress/kendo-ui
Version:
This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.
1 lines • 13 kB
JavaScript
module.exports=function(r){var i={};function a(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,a),t.loaded=!0,t.exports}return a.m=r,a.c=i,a.p="",a(0)}({0:function(e,t,r){e.exports=r(1716)},3:function(e,t){e.exports=function(){throw Error("define cannot be used indirect")}},1703:function(e,t){e.exports=require("./calc")},1716:function(e,t,r){var i;r(3),r=[r(1703),r(1717),r(1718)],void 0===(t="function"==typeof(i=function(){"use strict";var e=kendo.util,p=kendo.spreadsheet.calc,f=kendo.dom,c=/^\[(black|green|white|blue|magenta|yellow|cyan|red)\]/i,d=/^\[(<=|>=|<>|<|>|=)(-?[0-9.]+)\]/;function o(i){i=p.InputStream(i);var e=[],t=false,r;while(!i.eof()){var a=l();e.push(a);if(a.cond)t=true}if(!t)if(e.length==1)e[0].cond="num";else if(e.length==2){e[0].cond={op:">=",value:0};e[1].cond={op:"<",value:0}}else if(e.length>=3){e[0].cond={op:">",value:0};e[1].cond={op:"<",value:0};e[2].cond={op:"=",value:0};if(e.length>3){e[3].cond="text";e=e.slice(0,4)}}return e;function n(){var e=i.skip(c);if(e)return e[1].toLowerCase()}function u(){var e=i.skip(d);if(e){var t=parseFloat(e[2]);if(!isNaN(t))return{op:e[1],value:t,custom:true}}}function s(){var e=[],t,r=null;while(!i.eof()&&(t=o())){if(t.type=="date"){if(r&&/^(el)?time$/.test(r.type)&&r.part=="h"&&t.part=="m"&&t.format<3)t.type="time"}else if(/^(el)?time$/.test(t.type)&&t.part=="s")if(r&&r.type=="date"&&r.part=="m"&&r.format<3)r.type="time";if(!/^(?:str|space|fill)$/.test(t.type))r=t;e.push(t)}return e}function f(e){if(e.type!="date"||e.part=="m"&&e.format<3){var t=i.skip(/^\.(0+)/);if(t){e.fraction=t[1].length;if(e.type=="date")e.type="time"}}return e}function o(){var e,t;if(t=i.skip(/^([#0?]+)(?:,([#0?]+))+/))return{type:"digit",sep:true,format:t[1]+t[2],decimal:r};if(t=i.skip(/^[#0?]+/))return{type:"digit",sep:false,format:t[0],decimal:r};if(t=i.skip(/^(e)([+-])/i))return{type:"exp",ch:t[1],sign:t[2]};if(t=i.skip(/^(d{1,4}|m{1,5}|yyyy|yy)/i)){t=t[1].toLowerCase();return f({type:"date",part:t.charAt(0),format:t.length})}if(t=i.skip(/^(hh?|ss?)/i)){t=t[1].toLowerCase();return f({type:"time",part:t.charAt(0),format:t.length})}if(t=i.skip(/^\[(hh?|mm?|ss?)\]/i)){t=t[1].toLowerCase();return f({type:"eltime",part:t.charAt(0),format:t.length})}if(t=i.skip(/^(a[.]?m[.]?\/p[.]?m[.]?|a\/p)/i)){t=t[1].split("/");return{type:"ampm",am:t[0],pm:t[1]}}switch(e=i.next()){case";":return null;case"\\":return{type:"str",value:i.next()};case'"':return{type:"str",value:i.readEscaped(e)};case"@":return{type:"text"};case"_":return{type:"space",value:i.next()};case"*":return{type:"fill",value:i.next()};case".":if(i.lookingAt(/^\s*[#0?]/)){r=true;return{type:"dec"}}return{type:"str",value:"."};case"%":return{type:"percent"};case",":return{type:"comma"}}return{type:"str",value:e}}function l(){r=false;var e=n(),t=u();if(!e&&t)e=n();return{color:e,cond:t,body:s()}}}function n(e){return e.map(t).join(";");function t(e){var t="";if(e.color)t+="["+e.color+"]";if(e.cond)if(!(e.cond=="text"||e.cond=="num"))t+="["+e.cond.op+e.cond.value+"]";t+=e.body.map(i).join("");return t}function r(e,t){if(t.fraction)e+="."+m("",t.fraction,"0");return e}function i(e){if(e.type=="digit")if(e.sep)return e.format.charAt(0)+","+e.format.substr(1);else return e.format;else if(e.type=="exp")return e.ch+e.sign;else if(e.type=="date"||e.type=="time")return r(m("",e.format,e.part),e);else if(e.type=="eltime")return r("["+m("",e.format,e.part)+"]",e);else if(e.type=="ampm")return e.am+"/"+e.pm;else if(e.type=="str")return JSON.stringify(e.value);else if(e.type=="text")return"@";else if(e.type=="space")return"_"+e.value;else if(e.type=="fill")return"*"+e.value;else if(e.type=="dec")return".";else if(e.type=="percent")return"%";else if(e.type=="comma")return","}}function u(e,s){e.forEach(function(e){var t=s;if(e.cond=="text")return;var r=e.body,i=false,a=r.length;while(t!==0&&--a>=0){var n=r[a];if(n.type=="digit"){if(n.decimal){i=true;if(t>0)n.format+=m("",t,"0");else if(t<0){var u=n.format.length;n.format=n.format.substr(0,u+t);t+=u-n.format.length}if(n.format.length===0){r.splice(a,1);while(--a>=0){n=r[a];if(n.type=="digit"&&n.decimal){++a;break}if(n.type=="dec"){r.splice(a,1);break}}}}if(t>0)break}}if(!i&&t>0)r.splice(a+1,0,{type:"dec"},{type:"digit",sep:false,decimal:true,format:m("",t,"0")})})}function g(i){var a=0;return{next:function(){return i[a++]},eof:function(){return a>=i.length},ahead:function(e,t){if(a+e<=i.length){var r=t.apply(null,i.slice(a,a+e));if(r)a+=e;return r}},restart:function(){a=0}}}function i(e){var t=g(e.body);var r=false;var i=false;var l=false;var p=0;var c=/[\$\xA2-\xA5\u058F\u060B\u09F2\u09F3\u09FB\u0AF1\u0BF9\u0E3F\u17DB\u20A0-\u20BD\uA838\uFDFC\uFE69\uFF04\uFFE0\uFFE1\uFFE5\uFFE6]/;var m=0;var a="var intPart, decPart, isNegative, date, time; ";var d=false;var y=0;var n=[],u=[];var s=e.cond;var f="";if(s=="text")f="if (typeof value == 'string' || value instanceof kendo.spreadsheet.CalcError) { ";else if(s=="num")f="if (typeof value == 'number') { ";else if(s){var v=s.op=="="?"==":s.op;f="if (typeof value == 'number' && value "+v+" "+s.value+") { ";if(!s.custom)a+="value = Math.abs(value); "}if(e.color)a+="result.color = "+JSON.stringify(e.color)+"; ";function h(e,t){if(e.type=="digit"&&t.type=="comma"||e.type=="comma"&&e.hidden&&t.type=="comma"){t.hidden=true;m++}}while(!t.eof()){t.ahead(2,h);var o=t.next();if(o.type=="percent")p++;else if(o.type=="digit")if(o.decimal){y+=o.format.length;u.push(o.format)}else{n.push(o.format);if(o.sep)d=true}else if(o.type=="time")i=true;else if(o.type=="date")r=true;else if(o.type=="ampm")l=i=true}if(p>0)a+="value *= "+Math.pow(100,p)+"; ";if(m>0)a+="value /= "+Math.pow(1e3,m)+"; ";if(n.length){a+="intPart = runtime.formatInt(culture, value, "+JSON.stringify(n)+", "+y+", "+d+"); ";a+="isNegative = parseInt(intPart[0]) < 0;"}if(u.length)a+="decPart = runtime.formatDec(value, "+JSON.stringify(u)+", "+y+"); ";if(n.length||u.length)a+="type = 'number'; ";if(r)a+="date = runtime.unpackDate(value); ";if(i)a+="time = runtime.unpackTime(value); ";if(r||i)a+="type = 'date'; ";if(p>0||m>0||n.length||u.length||r||i)if(!f)f="if (typeof value == 'number') { ";t.restart();a+="var matchedCurrency = false;";while(!t.eof()){var o=t.next();if(o.type=="dec")a+="output += culture.numberFormat['.']; ";else if(o.type=="comma"&&!o.hidden)a+="output += ','; ";else if(o.type=="percent"){a+="type = 'percent'; ";a+="output += culture.numberFormat.percent.symbol; "}else if(o.type=="str"){if(c.test(o.value)){a+="type = 'currency'; ";a+="if (isNegative) { output += '-'; matchedCurrency = true; }"}a+="output += "+JSON.stringify(o.value)+"; "}else if(o.type=="text"){a+="type = 'text'; ";a+="output += value; "}else if(o.type=="space"){a+="if (output) result.body.push(output); ";a+="output = ''; ";a+="result.body.push({ type: 'space', value: "+JSON.stringify(o.value)+" }); "}else if(o.type=="fill")a+="output += runtime.fill("+JSON.stringify(o.value)+"); ";else if(o.type=="digit"){a+="if (isNegative && intPart[0] && matchedCurrency) {intPart[0] = intPart[0].replace('-', '');}";a+="output += "+(o.decimal?"decPart":"intPart")+".shift(); "}else if(o.type=="date")a+="output += runtime.date(culture, date, "+JSON.stringify(o.part)+", "+o.format+"); ";else if(o.type=="time")a+="output += runtime.time(time, "+JSON.stringify(o.part)+", "+o.format+", "+l+", "+o.fraction+"); ";else if(o.type=="eltime")a+="output += runtime.eltime(value, "+JSON.stringify(o.part)+", "+o.format+", "+o.fraction+"); ";else if(o.type=="ampm")a+="output += time.hours < 12 ? "+JSON.stringify(o.am)+" : "+JSON.stringify(o.pm)+"; "}a+="if (output) result.body.push(output); ";a+="result.type = type; ";a+="return result; ";if(f)a=f+a+"}";return a}var s=i({cond:"text",body:[{type:"text"}]}),l=e.memoize(function(e){var t=o(e);var r=t.map(i);r.push(s);r=r.join("\n");r="'use strict'; return function(value, culture){ "+"if (!culture) culture = kendo.culture(); "+"var output = '', type = null, result = { body: [] }; "+r+"; return result; };";return new Function("runtime",r)(v)}),t=e.memoize(function(e){var t=o(e);var r,i=false,a=false;for(var n=0;n<t.length;++n){r=t[n];for(var u=0;u<r.body.length;++u)if(/^(?:date|time|ampm)$/.test(r.body[u].type)){i=true;if(r.body[u].type=="ampm")a=true}if(i)break}if(!i)return null;return r.body.map(f).join("");function s(e,t){if(t.fraction)e+=m("",Math.max(t.fraction,3),"f");return e}function f(e){if(e.type=="digit")if(e.sep)return e.format.charAt(0)+","+e.format.substr(1);else return e.format;else if(e.type=="exp")return e.ch+e.sign;else if(e.type=="date"||e.type=="time"){var t=e.part;if(e.type=="date"&&/^m/.test(t))t="M";else if(e.type=="time"&&/^h/.test(t))if(!a)t=t.toUpperCase();return s(m("",e.format,t),e)}else if(e.type=="ampm")return"tt";else if(e.type=="str")return e.value;else if(e.type=="space")return" ";else if(e.type=="dec")return".";else if(e.type=="percent")return"%";else if(e.type=="comma")return",";else return""}}),v={unpackDate:p.runtime.unpackDate,unpackTime:p.runtime.unpackTime,date:function(e,t,r,i){switch(r){case"d":switch(i){case 1:return t.date;case 2:return m(t.date,2,"0");case 3:return e.calendars.standard.days.namesAbbr[t.day];case 4:return e.calendars.standard.days.names[t.day]}break;case"m":switch(i){case 1:return t.month+1;case 2:return m(t.month+1,2,"0");case 3:return e.calendars.standard.months.namesAbbr[t.month];case 4:return e.calendars.standard.months.names[t.month];case 5:return e.calendars.standard.months.names[t.month].charAt(0)}break;case"y":switch(i){case 2:return t.year%100;case 4:return t.year}break}return"##"},time:function(e,t,r,i,a){var n,u;switch(t){case"h":n=m(i?e.hours%12||12:e.hours,r,"0");if(a)u=(e.minutes+(e.seconds+e.milliseconds/1e3)/60)/60;break;case"m":n=m(e.minutes,r,"0");if(a)u=(e.seconds+e.milliseconds/1e3)/60;break;case"s":n=m(e.seconds,r,"0");if(a)u=e.milliseconds/1e3;break}if(u)n+=v.toFixed(u,a).replace(/^0+/,"");return n},eltime:function(e,t,r,i){var a,n;switch(t){case"h":a=e*24;break;case"m":a=e*24*60;break;case"s":a=e*24*60*60;break}if(i)n=a-(a|0);a=m(a|0,r,"0");if(n)a+=v.toFixed(n,i).replace(/^0+/,"");return a},fill:function(e){return e},formatInt:function(l,e,t,r,p){e=v.toFixed(e,r).replace(/\..*$/,"");var c=t[t.length-1];if(r>0&&c[t.length-1]!="0")if(e==="0")e="";else if(e==="-0")e="-";var m=false;var i=e.length-1;var a=[];var n=0,u;function s(e,t){if(p&&n&&n%3===0&&/^[0-9]$/.test(e))u=l.numberFormat[","]+u;if(t&&e==="-"){m=true;e="0"}u=e+u;n++}for(var f=t.length;--f>=0;){var d=t[f];u="";for(var y=d.length;--y>=0;){var o=d.charAt(y);if(i<0){if(o=="0")s("0");else if(o=="?")s(" ")}else{if(e=="0"&&o=="?")s(" ");else if(o=="0")s(e.charAt(i),true);else s(e.charAt(i));i--}}if(f===0)while(i>=0)s(e.charAt(i--));a.unshift(u)}if(m)a[0]="-"+a[0];return a},formatDec:function(e,t,l){e=v.toFixed(e,l);var r=e.indexOf(".");if(r>=0)e=e.substr(r+1).replace(/0+$/,"");else e="";var i=0;var a=[];for(var n=0;n<t.length;++n){var u=t[n];var s="";for(var f=0;f<u.length;++f){var o=u.charAt(f);if(i<e.length)s+=e.charAt(i++);else if(o=="0")s+="0";else if(o=="?")s+=" "}a.push(s)}return a},toFixed:function(e,s){return function e(t,r){if(!isFinite(t))return"#NUM!";if(t<0)return"-"+e(-t);if(s===0)return String(Math.round(t));if(t===Math.round(t)&&!/e/i.test(String(t)))return t.toFixed(s);var i=h(t);var a=i.intpart;var n=i.decpart;if(n.length<=s){while(n.length<s)n+="0";return a+"."+n}if(r)return a+"."+n.substr(0,s);var u=Math.pow(10,s);return e(Math.round(t*u)/u,true)}(Number(e.toFixed(14)))}};function m(e,t,r){e+="";while(e.length<t)e=r+e;return e}function y(e,t,r){e+="";while(e.length<t)e+=r;return e}function h(e){var t=String(e).toLowerCase();var r,i,a;var n=t.indexOf(".");if(n<0){n=t.indexOf("e");if(n<0){r=t;i=""}else{r=t.substr(0,n);i=t.substr(n)}}else{r=t.substr(0,n);i=t.substr(n+1)}if(a=/(\d*)e([-+]?\d+)/.exec(i)){var u=parseInt(a[2],10);if(u>=0){i=y(a[1],u,"0");r+=i.substr(0,u);i=i.substr(u)}else{r=m(r,-u,"0");i=r.substr(u)+a[1];r=r.substr(0,r.length+u)}}return{intpart:r||"0",decpart:i}}function a(e){var t=e.body;var r="";for(var i=0;i<t.length;++i){var a=t[i];if(typeof a=="string")r+=a;else if(a.type=="space")r+=" "}return r}kendo.spreadsheet.formatting={compile:l,parse:o,format:function(e,t,r){var i=l(t)(e,r);var a=f.element("span");a.__dataType=i.type;var n=i.body;if(i.color)a.attr.style={color:i.color};for(var u=0;u<n.length;++u){var s=n[u];if(typeof s=="string")a.children.push(f.text(s));else if(s.type=="space")a.children.push(f.element("span",{style:{visibility:"hidden"}},[f.text(s.value)]))}return a},text:function(e,t,r){var i=l(t)(e,r);return a(i)},textAndColor:function(e,t,r){var i=l(t)(e,r);return{text:a(i),color:i.color,type:i.type}},type:function(e,t){return l(t)(e).type},adjustDecimals:function(e,t){var r=o(e);u(r,t);return n(r)},makeDateFormat:t}})?i.apply(t,r):i)||(e.exports=t)},1717:function(e,t){e.exports=require("../kendo.dom")},1718:function(e,t){e.exports=require("../util/main")}});