UNPKG

@progress/kendo-ui

Version:

This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.

1 lines 6.14 kB
module.exports=function(r){var a={};function i(e){if(a[e])return a[e].exports;var t=a[e]={exports:{},id:e,loaded:!1};return r[e].call(t.exports,t,t.exports,i),t.loaded=!0,t.exports}return i.m=r,i.c=a,i.p="",i(0)}({0:function(e,t,r){e.exports=r(1722)},3:function(e,t){e.exports=function(){throw Error("define cannot be used indirect")}},20:function(e,t){e.exports=require("../kendo.core")},1722:function(e,t,r){var a;r(3),r=[r(20)],void 0===(t="function"==typeof(a=function(){var s=window.kendo,r=s.Class.extend({init:function(e){this.list=e},get:function(e){return this.parse(this.list.value(e,e))},set:function(e,t,r){if(r===undefined){r=t;t=e}this.list.value(e,t,r)},parse:function(e){return e},copy:function(e,t,r){this.list.copy(e,t,r)},iterator:function(e,t){return this.list.iterator(e,t)}}),e=r.extend({set:function(e,t,r){this.list.value(e,t,JSON.stringify(r))},parse:function(e){return JSON.parse(e)}}),t=r.extend({init:function(e,t){r.prototype.init.call(this,e);this.formats=t},set:function(e,t,r){if(r instanceof Date){r=s.spreadsheet.dateToNumber(r);if(!this.formats.value(e,t))this.formats.value(e,t,a(s.culture().calendar.patterns.d))}else if(typeof r=="number")r=s.spreadsheet.calc.runtime.limitPrecision(r);this.list.value(e,t,r)}});function a(e){return e.replace(/M/g,"m").replace(/'/g,'"').replace(/tt/,"am/pm")}function i(e){e=e.clone();e.value=e.value.deepClone();return e}function o(){var e=this.map(i);e.clone=o;return e}s.spreadsheet.PropertyBag=s.Class.extend({specs:[{property:r,name:"format",value:null,sortable:true,serializable:true},{property:t,name:"value",value:null,sortable:true,serializable:true,depends:"format"},{property:r,name:"formula",value:null,sortable:true,serializable:true},{property:r,name:"background",value:null,sortable:true,serializable:true},{property:e,name:"vBorders",value:null,sortable:false,serializable:false},{property:e,name:"hBorders",value:null,sortable:false,serializable:false},{property:r,name:"color",value:null,sortable:true,serializable:true},{property:r,name:"fontFamily",value:null,sortable:true,serializable:true},{property:r,name:"underline",value:null,sortable:true,serializable:true},{property:r,name:"fontSize",value:null,sortable:true,serializable:true},{property:r,name:"italic",value:null,sortable:true,serializable:true},{property:r,name:"bold",value:null,sortable:true,serializable:true},{property:r,name:"textAlign",value:null,sortable:true,serializable:true},{property:r,name:"indent",value:null,sortable:true,serializable:true},{property:r,name:"verticalAlign",value:null,sortable:true,serializable:true},{property:r,name:"wrap",value:null,sortable:true,serializable:true},{property:r,name:"validation",value:null,sortable:false,serializable:true},{property:r,name:"enable",value:null,sortable:false,serializable:true},{property:r,name:"link",value:null,sortable:true,serializable:true},{property:r,name:"editor",value:null,sortable:true,serializable:true},{property:r,name:"comment",value:null,sortable:true,serializable:true},{property:r,name:"html",value:null,sortable:true,serializable:true}],init:function(e,t,i){i=i||{};var n=e*t-1;this.rowCount=e;this.columnCount=t;this.cellCount=n;this.properties={};this.lists={};this.specs.forEach(function(e){var t=e.name;var r=i[t];if(r===undefined)r=e.value;this.lists[t]=new s.spreadsheet.SparseRangeList(0,n,r);var a=this.properties[t]=new e.property(this.lists[t],this.lists[e.depends]);a.spec=e},this);this.lists.formula.tree.clone=o;this.lists.validation.tree.clone=o},_resize:function(a,e){var r=this;var i=r.rowCount;var n=a*e-1;function t(e){var t=e/i|0;var r=e%i;return t*a+r}function s(e){e.start=t(e.start);e.end=t(e.end)}Object.keys(r.lists).forEach(function(e){var t=r.lists[e];if(a!=i)t.forEach(s);t.range.end=n});r.rowCount=a;r.columnCount=e;r.cellCount=n},getState:function(){var t={};this.specs.forEach(function(e){t[e.name]=this.lists[e.name].getState()},this);return t},setState:function(t){this.specs.forEach(function(e){this.lists[e.name].setState(t[e.name])},this)},get:function(e,t){if(t===undefined)return this.lists[e];switch(e){case"borderRight":t+=this.rowCount;case"borderLeft":e="vBorders";break;case"borderBottom":t++;case"borderTop":e="hBorders";break}return t>this.cellCount?null:this.properties[e].get(t)},set:function(e,t,r,a){switch(e){case"borderRight":t+=this.rowCount;r+=this.rowCount;case"borderLeft":e="vBorders";break;case"borderBottom":t++;r++;case"borderTop":e="hBorders";break}if(t<=r&&r<=this.cellCount)this.properties[e].set(t,r,a)},fromJSON:function(t,r){for(var e=0;e<this.specs.length;e++){var a=this.specs[e];if(a.serializable)if(r[a.name]!==undefined)this.set(a.name,t,t,r[a.name],false)}["borderLeft","borderRight","borderTop","borderBottom"].forEach(function(e){if(r[e]!==undefined)this.set(e,t,t,r[e])},this)},copy:function(t,r,a){this.specs.forEach(function(e){this.properties[e.name].copy(t,r,a)},this)},iterator:function(e,t,r){var a=this.properties[e];var i=a.iterator(t,r),n=i.at;var s=this.cellCount;i.at=function(e){return e>s?null:a.parse(n.call(i,e))};i.name=e;i.value=a.spec.value;return i},sortable:function(){return this.specs.filter(function(e){return e.sortable}).map(function(e){return this.lists[e.name]},this)},iterators:function(r,a){return this.specs.reduce(function(e,t){if(t.serializable)e.push(this.iterator(t.name,r,a));return e}.bind(this),[])},forEach:function(e,t,p){var r=this.iterators(e,t);var a=this.iterator("hBorders",e,t+1);var c=this.iterator("vBorders",e,t);var f=this.iterator("vBorders",e+this.rowCount,t+this.rowCount);var i,n;function s(e,t,r){var a=t.at(r);if(a!==t.value)i[e]=a}for(n=e;n<=t;n++){i={};for(var o=0;o<r.length;o++){var l=r[o];var u=l.at(n);if(u!==l.value)i[l.name]=u}s("borderLeft",c,n);s("borderRight",f,n+this.rowCount);s("borderTop",a,n);if((n+1)%this.rowCount)s("borderBottom",a,n+1);p(i)}},forEachProperty:function(e){for(var t in this.properties)e(this.properties[t])}}),s.spreadsheet.ALL_PROPERTIES=s.spreadsheet.PropertyBag.prototype.specs.reduce(function(e,t){if(t.serializable)e.push(t.name);return e},["borderTop","borderRight","borderBottom","borderLeft"])})?a.apply(t,r):a)||(e.exports=t)}});