@progress/kendo-ui
Version:
This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.
1 lines • 6.43 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(1507),t.exports=r(1507)},3:function(t,e){t.exports=function(){throw Error("define cannot be used indirect")}},5:function(t,e){t.exports=require("../kendo.data")},19:function(t,e){t.exports=require("../kendo.core")},1507:function(t,e,r){var n,a,i;!function(o,define){a=[r(19),r(5)],n=o,i="function"==typeof n?n.apply(e,a):n,!(void 0!==i&&(t.exports=i))}(function(){!function(t){function e(t){var e=t.getMonth()+1;return e>=1&&e<=3?1:e>=4&&e<=6?2:e>=7&&e<=9?3:4}function r(e,r){if(e instanceof Date){var n=t.date.today();return n.setFullYear(n.getFullYear()+r),n.getFullYear()===e.getFullYear()}return!1}function n(e,r){if(e instanceof Date){var n=t.date.firstDayOfMonth(t.date.today());return n.setMonth(n.getMonth()+r,1),n.getTime()===t.date.firstDayOfMonth(e).getTime()}return!1}function a(e,r){var n,a;return r instanceof Date&&(n=t.date.dayOfWeek(t.date.getDate(e),1),a=t.date.dayOfWeek(t.date.getDate(r),1),n.getTime()===a.getTime())}if(!(t.support.browser.msie&&t.support.browser.version<9)){var i=t.spreadsheet.Filter=t.Class.extend({prepare:function(){},value:function(t){return t.value},matches:function(){throw Error("The 'matches' method is not implemented.")},toJSON:function(){throw Error("The 'toJSON' method is not implemented.")}});i.create=function(e){var r,n=e.filter;if(!n)throw Error("Filter type not specified.");if(r=t.spreadsheet[n.charAt(0).toUpperCase()+n.substring(1)+"Filter"],!r)throw Error("Filter type not recognized.");return new r(e)},t.spreadsheet.ValueFilter=i.extend({_values:[],_dates:[],_blanks:!1,init:function(t){void 0!==t.values&&(this._values=t.values),void 0!==t.blanks&&(this._blanks=t.blanks),void 0!==t.dates&&(this._dates=t.dates)},value:function(e){var r,n=e.value;return this._dates.length>0&&e.format&&"number"==typeof n&&(r=t.spreadsheet.formatting.type(n,e.format),"date"===r&&(n=t.spreadsheet.numberToDate(n))),n},matches:function(t){return null===t||void 0===t?this._blanks:t instanceof Date?this._dates.some(function(e){return!(e.year!==t.getFullYear()||void 0!==e.month&&e.month!==t.getMonth()||void 0!==e.day&&e.day!==t.getDate()||void 0!==e.hours&&e.hours!==t.getHours()||void 0!==e.minutes&&e.minutes!==t.getMinutes()||void 0!==e.seconds&&e.seconds!==t.getSeconds())}):this._values.indexOf(t)>=0},toJSON:function(){return{filter:"value",blanks:this._blanks,values:this._values.slice(0)}}}),t.spreadsheet.CustomFilter=i.extend({_logic:"and",init:function(e){if(void 0!==e.logic&&(this._logic=e.logic),void 0===e.criteria)throw Error("Must specify criteria.");this._criteria=e.criteria;var r=t.data.Query.filterExpr({logic:this._logic,filters:this._criteria}).expression;this._matches=Function("d","return "+r)},matches:function(t){return null!==t&&this._matches(t)},value:function(e){var r=e.value,n=this._criteria[0].value,a=n instanceof Date?"date":typeof n,i=typeof r;return e.format&&(i=t.spreadsheet.formatting.type(r,e.format)),i!=a?"string"==a&&(e.format&&(r=t.spreadsheet.formatting.text(r,e.format)),r+=""):"date"==i&&(r=t.spreadsheet.numberToDate(r)),r},toJSON:function(){return{filter:"custom",logic:this._logic,criteria:this._criteria}}}),t.spreadsheet.TopFilter=i.extend({init:function(t){this._type=t.type,this._value=t.value,this._values=[]},prepare:function(t){var e,r=t.map(this.value).sort().filter(function(t,e,r){return 0===e||t!==r[e-1]});r.sort("topNumber"===this._type||"topPercent"==this._type?function(t,e){return e-t}:function(t,e){return t-e}),e=this._value,"topPercent"!==this._type&&"bottomPercent"!==this._type||(e=r.length*e/100>>0),this._values=r.slice(0,e)},matches:function(t){return this._values.indexOf(t)>=0},toJSON:function(){return{filter:"top",type:this._type,value:this._value}}}),t.spreadsheet.DynamicFilter=i.extend({init:function(t){if(this._type=t.type,this._predicate=this[t.type],"function"!=typeof this._predicate)throw Error("DynamicFilter type '"+t.type+"' not recognized.")},value:function(e){var r,n=e.value;return e.format&&(r=t.spreadsheet.formatting.type(n,e.format),"date"===r&&(n=t.spreadsheet.numberToDate(n))),n},prepare:function(t){var e,r,n=0,a=0;for(e=0;e<t.length;e++)r=this.value(t[e]),"number"==typeof r&&(n+=r,a++);this._average=a>0?n/a:0},matches:function(t){return this._predicate(t)},aboveAverage:function(e){return e instanceof Date&&(e=t.spreadsheet.dateToNumber(e)),"number"==typeof e&&e>this._average},belowAverage:function(e){return e instanceof Date&&(e=t.spreadsheet.dateToNumber(e)),"number"==typeof e&&e<this._average},tomorrow:function(e){if(e instanceof Date){var r=t.date.addDays(t.date.today(),1);return t.date.getDate(e).getTime()===r.getTime()}return!1},today:function(e){return e instanceof Date&&t.date.isToday(e)},yesterday:function(e){if(e instanceof Date){var r=t.date.addDays(t.date.today(),-1);return t.date.getDate(e).getTime()===r.getTime()}return!1},nextWeek:function(e){return a(t.date.addDays(t.date.today(),7),e)},thisWeek:function(e){return a(t.date.today(),e)},lastWeek:function(e){return a(t.date.addDays(t.date.today(),-7),e)},nextMonth:function(t){return n(t,1)},thisMonth:function(t){return n(t,0)},lastMonth:function(t){return n(t,-1)},nextQuarter:function(r){var n,a;return r instanceof Date&&(n=t.date.today(),a=e(r)-e(n),1===a&&n.getFullYear()===r.getFullYear()||a==-3&&n.getFullYear()+1===r.getFullYear())},thisQuarter:function(r){var n,a;return r instanceof Date&&(n=t.date.today(),a=e(r)-e(n),0===a&&n.getFullYear()===r.getFullYear())},lastQuarter:function(r){var n,a;return r instanceof Date&&(n=t.date.today(),a=e(n)-e(r),1===a&&n.getFullYear()===r.getFullYear()||a==-3&&n.getFullYear()-1===r.getFullYear())},nextYear:function(t){return r(t,1)},thisYear:function(t){return r(t,0)},lastYear:function(t){return r(t,-1)},yearToDate:function(e){if(e instanceof Date){var r=t.date.today();return e.getFullYear()===r.getFullYear()&&e<=r}return!1},toJSON:function(){return{filter:"dynamic",type:this._type}}}),[1,2,3,4].forEach(function(r){t.spreadsheet.DynamicFilter.prototype["quarter"+r]=function(t){return t instanceof Date&&e(t)===r}}),t.cultures["en-US"].calendar.months.names.forEach(function(e,r){t.spreadsheet.DynamicFilter.prototype[e.toLowerCase()]=function(t){return t instanceof Date&&t.getMonth()===r}})}}(kendo)},r(3))}});