@progress/kendo-ui
Version:
This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.
1 lines • 17.7 kB
JavaScript
module.exports=function(i){var r={};function s(e){if(r[e])return r[e].exports;var t=r[e]={exports:{},id:e,loaded:!1};return i[e].call(t.exports,t,t.exports,s),t.loaded=!0,t.exports}return s.m=i,s.c=r,s.p="",s(0)}({0:function(e,t,i){e.exports=i(1701)},3:function(e,t){e.exports=function(){throw Error("define cannot be used indirect")}},20:function(e,t){e.exports=require("../kendo.core")},957:function(e,t){e.exports=require("../kendo.color")},1701:function(e,t,i){var r;i(3),i=[i(20),i(957),i(1702),i(1703)],void 0===(t="function"==typeof(r=function(){"use strict";var r=kendo.jQuery,s=kendo.util.parseXML,R=kendo.spreadsheet.calc.parseReference,u={greaterThanOrEqual:"greaterThanOrEqualTo",lessThanOrEqual:"lessThanOrEqualTo"},h=null;function e(e,i,r){var t=new FileReader;t.onload=function(e){var t=new JSZip(e.target.result);w(t,i,r)};t.readAsArrayBuffer(e)}var L=["sheetData","row","c"],z=["cols","col"],n=["definedNames","definedName"],j=["sheetData","row","c","f"],$=["mergeCells","mergeCell"],X=["sheetViews","sheetView","pane"],B=["sheetData","row"],N=["sheetViews","sheetView","selection"],p=["sheets","sheet"],F=["sheetData","row","c","is"],l=["t"],a=["si"],H=["sheetData","row","c","v"],m=["bookViews","workbookView"],P=["sheetViews","sheetView"],W=["hyperlinks","hyperlink"],Y=["dataValidations","dataValidation"],Q=["dataValidations","dataValidation","formula1"],G=["dataValidations","dataValidation","formula2"],U=["x14:dataValidations","x14:dataValidation"],J=["x14:dataValidations","x14:dataValidation","xm:sqref"],Z=["x14:dataValidations","x14:dataValidation","x14:formula1","xm:f"],K=["x14:dataValidations","x14:dataValidation","x14:formula2","xm:f"],o=["commentList","comment"],v=["authors","author"],g=["t"];function f(e){if(!/^\//.test(e)){if(!/^xl\//.test(e))e="xl/"+e}else e=e.substr(1);return e}function w(l,a,t){h=a.excelImportErrors=[];var o=M(l);var f=fe(l,"_rels/workbook.xml");var e=ve(l,f.byType.theme[0]);var u=ce(l,e);var F=[];var d=0;A(l,"xl/workbook.xml",{enter:function(e,t){if(this.is(p)){var i=t["r:id"];var r=f.byId[i];var s=t.name;var n=k(l,r);a.options.columnWidth=n.columnWidth||a.options.columnWidth;a.options.rowHeight=n.rowHeight||a.options.rowHeight;F.push({workbook:a,zip:l,strings:o,styles:u,file:r,options:{name:s,rows:Math.max(a.options.rows||0,n.rows),columns:Math.max(a.options.columns||0,n.cols),columnWidth:n.columnWidth,rowHeight:n.rowHeight}})}else if(this.is(m))if(t.activeTab)d=E(t.activeTab)},text:function(e){var t=this.is(n);if(t&&!(O(t["function"])||O(t.vbProcedure))){var i=t.localSheetId;var r=null;if(i!=null)r=F[i].options.name;var s=t.name;if(s!="_xlnm._FilterDatabase"){if(r)s="'"+r.replace(/\'/g,"\\'")+"'!"+s;ae(r,null,function(){a.defineName(s,e,O(t.hidden))},"reading user-defined name: "+s)}}}});var i=new r.Deferred;i.progress(function(e){if(t)t.notify(e)}).then(function(){var e=a.sheets();C(e);a.activeSheet(e[d]);if(t)t.resolve()});b(F,a,i)}function b(n,l,a){var e=(new r.Deferred).resolve();for(var t=0;t<n.length;t++)(function(r,s){e=e.then(function(){var e=l.insertSheet(r.options);e.suspendChanges(true);var t=x(e,r);var i={sheet:e,progress:s/(n.length-1)};t.then(function(){a.notify(i)});return t})})(n[t],t);e.then(function(){a.resolve()})}function x(e,t){var i=new r.Deferred;setTimeout(function(){I(t.zip,t.file,e,t.strings,t.styles);i.resolve()},0);return i}function C(e){for(var t=0;t<e.length;t++)e[t].suspendChanges(false).triggerChange({recalc:true})}function k(e,t){var i,r={rows:0,cols:0};A(e,f(t),{enter:function(e,t){if(e=="dimension"){i=R(t.ref);if(i.bottomRight){r.cols=i.bottomRight.col+1;r.rows=i.bottomRight.row+1}}else if(e==="sheetFormatPr"){if(t.defaultColWidth)r.columnWidth=ee(parseFloat(t.defaultColWidth));if(t.defaultRowHeight)r.rowHeight=te(parseFloat(t.defaultRowHeight))}else if(this.is(B)&&t.r)r.rows=Math.max(r.rows,+t.r);else if(this.is(L)&&t.r){i=R(t.r);r.rows=Math.max(r.rows,i.row+1);r.cols=Math.max(r.cols,i.col+1)}}});return r}function ee(e){var t=7;var i=(256*e+Math.floor(128/t))/256;return i*t}function te(e){return e*(4/3)}function I(t,e,c,s,C){var k={};var p,m,v,g,y,n;var I=c._columns._count;var T=null;var i=e.replace(/worksheets\//,"worksheets/_rels/");var w=fe(t,i);var l,a;var b;var x;var _;var S;var D;var M;var q=[];h=c._workbook.excelImportErrors;e=f(e);A(t,e,{enter:function(u,e,t){var i;if(this.is(j)){if(t)if(e.t=="shared"&&e.si!=null)g=c.range(k[e.si])._get("formula")}else if(this.is(L)){v=null;g=null;p=e.r;y=null;if(p==null){p=R(T);p.col++;p=p.toString()}T=p;m=e.t;var r=e.s;if(r!=null)oe(c,p,C,r)}else if(this.is($))c.range(e.ref).merge();else if(this.is(z)){var s=E(e.min)-1;var n=Math.min(I,E(e.max))-1;var l;if(e.width){l=ee(parseFloat(e.width));if(l!==0)c._columns.values.value(s,n,l)}if(e.hidden==="1"||l===0)for(var a=s;a<=n;a++)c.hideColumn(a);if(e.style!=null)oe(c,new kendo.spreadsheet.RangeRef(new kendo.spreadsheet.CellRef(-Infinity,s),new kendo.spreadsheet.CellRef(+Infinity,n)),C,e.style)}else if(this.is(B)){var o=E(e.r)-1;var f;if(e.ht){f=te(parseFloat(e.ht));if(f!==0)c._rows.values.value(o,o,f)}if(e.hidden==="1"||f===0)c.hideRow(o)}else if(this.is(N)){if(e.activeCell){var F=R(e.activeCell);c.select(F,true)}}else if(this.is(X)){if(e.state&&e.state.indexOf("frozen")>-1){if(e.xSplit)c.frozenColumns(E(e.xSplit));if(e.ySplit)c.frozenRows(E(e.ySplit))}}else if(this.is(P))c.showGridLines(O(e.showGridLines,true));else if(this.is(W)){var d=e["r:id"];var h=w.byId[d];if(h)c.range(e.ref).link(h)}else if(this.is(["autoFilter"])){b=e.ref;if(t)V()}else if(b)if(this.is(["filterColumn"]))x=parseInt(e.colId,10);else if(this.is(["customFilters"])){_=O(e.and)?"and":"or";S=[]}else if(this.is(["customFilter"])){i=se(e.operator,e.val);if(i)S.push({operator:i.operator,value:i.value})}else if(this.is(["dynamicFilter"]))q.push({column:x,filter:new kendo.spreadsheet.DynamicFilter({type:ne(e.type)})});else if(this.is(["top10"]))q.push({column:x,filter:new kendo.spreadsheet.TopFilter({value:le(e.val),type:function(e,t){return e&&t?"topPercent":t?"topNumber":e?"bottomPercent":"bottomNumber"}(O(e.percent),O(e.top))})});else if(this.is(["filters"])){D=O(e.blank);M=[]}else if(this.is(["filter"]))M.push(le(e.val))},leave:function(e,r){if(this.is(j)){if(!g&&r.t=="shared"&&r.si!=null)g=c.range(k[r.si])._get("formula")}else if(this.is(L)){if(g!=null){var t=ae(c,y||p,function(){c.range(y||p).formula(g,n)},"parsing formula");if(t)c.range(y||p).value(g).background("#ffaaaa")}else if(v!=null){var i=c.range(p);if(!i._get("formula")){if(!m||m=="n")v=parseFloat(v);else if(m=="s")v=s[E(v)];else if(m=="b")v=v==="1";else if(m=="d")v=kendo.parseDate(v);if(v!=null)i.value(v)}}}else if(this.is(Y)||this.is(U))(function(){var e=kendo.spreadsheet.calc.parseSqref(r.sqref);var t=r.type.toLowerCase();var i=r.operator;if(/^(?:whole|decimal)$/.test(t))t="number";else if(t=="list")i="list";if(!i&&/^(?:number|date)$/.test(t))i="between";e.forEach(function(e){ae(c,e,function(){c.range(e).validation({type:O(r.showErrorMessage,true)?"reject":"warning",from:l,to:a,dataType:t,comparerType:u[i]||i,allowNulls:O(r.allowBlank),showButton:O(r.showDropDown)||t=="date"||t=="list",messageTemplate:r.error,titleTemplate:r.errorTitle})},"parsing validation")})})();else if(e=="cols")c._columns._refresh();else if(e=="sheetData")c._rows._refresh();else if(e=="autoFilter")V();else if(b)if(e=="customFilters")q.push({column:x,filter:new kendo.spreadsheet.CustomFilter({logic:_,criteria:S})});else if(e=="filters")q.push({column:x,filter:new kendo.spreadsheet.ValueFilter({values:M,blanks:D})})},text:function(e){var t;if(this.is(H)||this.is(F))v=e;else if(t=this.is(j)){g=e;n=t.t=="array";if(n)y=t.ref;else if(t.t=="shared")k[t.si]=p}else if(this.is(Q)||this.is(Z))l=e;else if(this.is(G)||this.is(K))a=e;else if(this.is(J))this.stack[this.stack.length-2].sqref=e}});if(w.byType.comments){var r=ge(e,w.byType.comments[0]);re(t,r,c)}if(w.byType.drawing){var o=ge(e,w.byType.drawing[0]);ie(t,o,c)}function V(){c.range(b).filter(q);b=null}}function T(e){var t=/\.([^.]+)$/.exec(e);if(t&&t[1])return{jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}[t[1].toLowerCase()]}function _(e){var t=/[^/]+$/.exec(e);return t&&t[0]}function ie(l,a,o){var s=["xdr:twoCellAnchor"];var r=["xdr:ext"];var n=["xdr:oneCellAnchor"];var c=["xdr:from"];var p=["xdr:to"];var t=["xdr:row"];var i=["xdr:col"];var m=["xdr:rowOff"];var v=["xdr:colOff"];var g=["xdr:blipFill","a:blip"];var e=a.replace(/drawings\//,"drawings/_rels/");var f=fe(l,e);if(f.byType.image)Object.keys(f.byId).forEach(function(e){var t=ge(a,f.byId[e]);var i=T(t);if(i){var r=l.files[t].asArrayBuffer();var s=_(t);var n=s&&!(kendo.support.browser.msie||kendo.support.browser.edge)?new window.File([r],s,{type:i}):new window.Blob([r],{type:i});f.byId[e]=o._workbook.addImage(n)}});var u,F,d,h;A(l,a,{enter:function(e,t){if(this.is(s)||this.is(n))u={};else if(this.is(c)||this.is(p))F={};else if(this.is(g)){var i=t["r:embed"];u.image=f.byId[i]}else if(this.is(r)){d=y(parseFloat(t.cx));h=y(parseFloat(t.cy))}},leave:function(){if(this.is(c)){u.topLeftCell=new kendo.spreadsheet.CellRef(F.row,F.col);u.offsetX=y(F.colOffset);u.offsetY=y(F.rowOffset)}else if(this.is(p)){u.brCell=new kendo.spreadsheet.CellRef(F.row,F.col);u.brX=y(F.colOffset);u.brY=y(F.rowOffset)}else if(this.is(s)&&u.image){var e=o._columns.sum(0,u.topLeftCell.col-1)+u.offsetX;var t=o._rows.sum(0,u.topLeftCell.row-1)+u.offsetY;var i=o._columns.sum(0,u.brCell.col-1)+u.brX;var r=o._rows.sum(0,u.brCell.row-1)+u.brY;o.addDrawing({topLeftCell:u.topLeftCell,offsetX:u.offsetX,offsetY:u.offsetY,width:d!=null?d:i-e,height:h!=null?h:r-t,image:u.image,opacity:1})}else if(this.is(n)&&u.image)o.addDrawing({topLeftCell:u.topLeftCell,offsetX:u.offsetX,offsetY:u.offsetY,width:d,height:h,image:u.image,opacity:1})},text:function(e){if(this.is(t))F.row=parseFloat(e);else if(this.is(i))F.col=parseFloat(e);else if(this.is(m))F.rowOffset=parseFloat(e);else if(this.is(v))F.colOffset=parseFloat(e)}})}function re(e,t,i){var r=[];var s;var n;A(e,t,{enter:function(e,t){if(this.is(o))n={author:r[t.authorId],ref:t.ref,text:""};else if(this.is(v))s=""},leave:function(){if(this.is(o))i.range(n.ref).comment(n.text);else if(this.is(v))r.push(s)},text:function(e){if(this.is(g))n.text+=e;else if(this.is(v))s+=e}})}function se(e,t){var i={equal:"eq",notEqual:"ne",greaterThan:"gt",greaterThanOrEqual:"gte",lessThan:"lt",lessThanOrEqual:"lte"}[e];t=le(t);if(i&&typeof t=="number")return{operator:i,value:t};if((e=="notEqual"||!e)&&typeof t=="string")return{operator:e?"doesnotmatch":"matches",value:t}}function ne(e){return{Q1:"quarter1",Q2:"quarter2",Q3:"quarter3",Q4:"quarter4",M1:"january",M2:"february",M3:"march",M4:"april",M5:"may",M6:"june",M7:"july",M8:"august",M9:"september",M10:"october",M11:"november",M12:"december"}[e.toUpperCase()]||e}function le(e){var t=parseFloat(e);if(!isNaN(t)&&t==e)return t;return e}function ae(t,i,e,r){try{e();return false}catch(e){var s={context:r,error:String(e)};if(t&&t.name)s.sheet=t.name();else if(t)s.sheet=t;if(i)s.location=String(i);h.push(s);return true}}var S={none:0,thin:1,medium:2,dashed:1,dotted:1,thick:3,double:3,hair:1,mediumDashed:2,dashDot:1,mediumDashDot:2,dashDotDot:1,mediumDashDotDot:2,slantDashDot:1},D={0:"General",1:"0",2:"0.00",3:"#,##0",4:"#,##0.00",9:"0%",10:"0.00%",11:"0.00E+00",12:"# ?/?",13:"# ??/??",14:"mm-dd-yy",15:"d-mmm-yy",16:"d-mmm",17:"mmm-yy",18:"h:mm AM/PM",19:"h:mm:ss AM/PM",20:"h:mm",21:"h:mm:ss",22:"m/d/yy h:mm",37:"#,##0 ;(#,##0)",38:"#,##0 ;[Red](#,##0)",39:"#,##0.00;(#,##0.00)",40:"#,##0.00;[Red](#,##0.00)",45:"mm:ss",46:"[h]:mm:ss",47:"mmss.0",48:"##0.0E+0",49:"@"};function oe(e,t,i,r){var l=e.range(t);var s=i.inlineStyles[r],n,a;if(s.xfId)n=i.namedStyles[s.xfId];if(f("applyBorder","borderId"))d(i.borders[a]);if(f("applyFont","fontId"))F(i.fonts[a]);if(f("applyAlignment","textAlign"))l.textAlign(a);if(f("applyAlignment","verticalAlign"))l.verticalAlign(a);if(f("applyAlignment","indent"))l.indent(a);if(f("applyAlignment","wrapText"))l._property("wrap",a);if(f("applyFill","fillId"))u(i.fills[a]);if(f("applyNumberFormat","numFmtId"))o(i.numFmts[a]||D[a]);function o(e){var t=typeof e=="string"?e:e.formatCode;if(t!=null&&!/^general$/i.test(t)){t=t.replace(/^\[\$-[0-9]+\]/,"");l.format(t)}}function u(e){if(e.type=="solid")l.background(e.color)}function F(e){l.fontFamily(e.name);if(e.size)l._property("fontSize",e.size*4/3);if(e.bold)l.bold(true);if(e.italic)l.italic(true);if(e.underline)l.underline(true);if(e.color)l.color(e.color)}function d(n){function e(e,t){var i=n[e];if(!i)return;var r=S[i.style];if(r===0)return;var s=i.color;if(s==null)s="#000";l._property(t,{size:r,color:s})}e("left","borderLeft");e("top","borderTop");e("right","borderRight");e("bottom","borderBottom")}function f(e,t){var i=s[e];if(i!=null&&!i)return false;a=s[t];if(n&&a==null){i=n[e];if(i!=null&&!i)return false;a=n[t]}return a!=null}}function A(e,t,i){var r=e.files[t];if(r)s(r.asUint8Array(),i)}function M(e){var t=[];var i=null;A(e,"xl/sharedStrings.xml",{leave:function(){if(this.is(a)){t.push(i);i=null}},text:function(e){if(this.is(l)){if(i==null)i="";i+=e}}});return t}function fe(e,t){var s={byId:{},byType:{theme:[]}};A(e,f(t)+".rels",{enter:function(e,t){if(e=="Relationship"){s.byId[t.Id]=t.Target;var i=t.Type.match(/\w+$/)[0];var r=s.byType[i]||[];r.push(t.Target);s.byType[i]=r}}});return s}var q=["borders","border"],V=["fills","fill"],ue=["fonts","font"],Fe=["cellXfs","xf"],de=["cellStyleXfs","xf"],he=["numFmts","numFmt"],d=[c("FF000000"),c("FFFFFFFF"),c("FFFF0000"),c("FF00FF00"),c("FF0000FF"),c("FFFFFF00"),c("FFFF00FF"),c("FF00FFFF"),c("FF000000"),c("FFFFFFFF"),c("FFFF0000"),c("FF00FF00"),c("FF0000FF"),c("FFFFFF00"),c("FFFF00FF"),c("FF00FFFF"),c("FF800000"),c("FF008000"),c("FF000080"),c("FF808000"),c("FF800080"),c("FF008080"),c("FFC0C0C0"),c("FF808080"),c("FF9999FF"),c("FF993366"),c("FFFFFFCC"),c("FFCCFFFF"),c("FF660066"),c("FFFF8080"),c("FF0066CC"),c("FFCCCCFF"),c("FF000080"),c("FFFF00FF"),c("FFFFFF00"),c("FF00FFFF"),c("FF800080"),c("FF800000"),c("FF008080"),c("FF0000FF"),c("FF00CCFF"),c("FFCCFFFF"),c("FFCCFFCC"),c("FFFFFF99"),c("FF99CCFF"),c("FFFF99CC"),c("FFCC99FF"),c("FFFFCC99"),c("FF3366FF"),c("FF33CCCC"),c("FF99CC00"),c("FFFFCC00"),c("FFFF9900"),c("FFFF6600"),c("FF666699"),c("FF969696"),c("FF003366"),c("FF339966"),c("FF003300"),c("FF333300"),c("FF993300"),c("FF993366"),c("FF333399"),c("FF333333"),c("FF000000"),c("FFFFFFFF")];function ce(e,n){var s={fonts:[],numFmts:{},fills:[],borders:[],namedStyles:[],inlineStyles:[]};var l=null;var a=null;var o=null;var f=null;A(e,"xl/styles.xml",{enter:function(e,t,i){if(this.is(he))s.numFmts[t.numFmtId]=t;else if(this.is(ue)){s.fonts.push(l={});if(i)l=null}else if(l){if(e=="sz")l.size=parseFloat(t.val);else if(e=="name")l.name=t.val;else if(e=="b")l.bold=O(t.val,true);else if(e=="i")l.italic=O(t.val,true);else if(e=="u")l.underline=t.val==null||t.val=="single";else if(e=="color")l.color=F(t,null)}else if(this.is(V)){s.fills.push(a={});if(i)a=null}else if(a){if(e=="patternFill")a.type=t.patternType;else if(e=="fgColor"&&a.type==="solid")a.color=F(t,d[0]);else if(e=="bgColor"&&a.type!=="solid")a.color=F(t,d[0])}else if(this.is(q)){s.borders.push(o={});if(i)o=null}else if(o){if(/^(?:left|top|right|bottom)$/.test(e))o[e]={style:t.style||"none"};if(e=="color"){var r=this.stack[this.stack.length-2].$tag;o[r].color=F(t,d[0])}}else if(this.is(de)){f=u(t);s.namedStyles.push(f);if(i)f=null}else if(this.is(Fe)){f=u(t);s.inlineStyles.push(f);if(i)f=null}else if(f)if(e=="alignment"){if(/^(?:left|center|right|justify)$/.test(t.horizontal))f.textAlign=t.horizontal;if(/^(?:top|center|bottom)$/.test(t.vertical))f.verticalAlign=t.vertical;if(t.wrapText!=null)f.wrapText=O(t.wrapText);if(t.indent!=null)f.indent=E(t.indent)}},leave:function(e){if(this.is(ue))l=null;else if(this.is(V))a=null;else if(this.is(q))o=null;else if(e=="xf")f=null}});function u(t){var i={borderId:E(t.borderId),fillId:E(t.fillId),fontId:E(t.fontId),numFmtId:E(t.numFmtId),pivotButton:O(t.pivotButton),quotePrefix:O(t.quotePrefix),xfId:E(t.xfId)};e("applyAlignment");e("applyBorder");e("applyFill");e("applyFont");e("applyNumberFormat");e("applyProtection");function e(e){if(t[e]!=null)i[e]=O(t[e])}return i}function F(e,t){if(e.rgb)return c(e.rgb);else if(e.indexed)return d[E(e.indexed)];else if(e.theme){var i=n.colorScheme[E(e.theme)];if(!i)return t;var r=kendo.parseColor(i);if(e.tint){r=r.toHSL();var s=parseFloat(e.tint);if(s<0)r.l=r.l*(1+s);else r.l=r.l*(1-s)+(100-100*(1-s))}return r.toCssRgba()}}return s}var pe=["a:clrScheme","*","a:srgbClr"],me=["a:clrScheme","*","a:sysClr"];function ve(e,t){var i=[];var r={colorScheme:i};var s=f(t);if(e.files[s]){A(e,s,{enter:function(e,t){if(this.is(me))i.push(c(t.val=="window"?"FFFFFFFF":"FF000000"));else if(this.is(pe))i.push(c("FF"+t.val))}});if(i.length>3){n(i,0,1);n(i,2,3)}}function n(e,t,i){var r=e[t];e[t]=e[i];e[i]=r}return r}function E(e){return e==null?null:parseInt(e,10)}function O(e,t){if(e==null)return t;return e=="true"||e===true||e==1}function c(e){var t=/^([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);return"rgba("+parseInt(t[2],16)+", "+parseInt(t[3],16)+", "+parseInt(t[4],16)+", "+parseInt(t[1],16)/255+")"}function ge(e,t){e=e.split(/\/+/);t=t.split(/\/+/);e.pop();while(t.length){var i=t.shift();if(i==="")e=[];else if(i===".")continue;else if(i==="..")e.pop();else e.push(i)}return e.join("/")}function y(e){return e/9525}kendo.spreadsheet.readExcel=e,kendo.spreadsheet._readSheet=I,kendo.spreadsheet._readStrings=M,kendo.spreadsheet._readStyles=ce,kendo.spreadsheet._readTheme=ve,kendo.spreadsheet._readWorkbook=w})?r.apply(t,i):r)||(e.exports=t)},1702:function(e,t){e.exports=require("../util/parse-xml")},1703:function(e,t){e.exports=require("./calc")}});