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