@progress/kendo-ui
Version:
This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.
3 lines (2 loc) • 6.15 kB
JavaScript
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(((n="undefined"!=typeof globalThis?globalThis:n||self).kendo=n.kendo||{},n.kendo._globals=n.kendo._globals||{},n.kendo._globals.DataQueryCmnChunk={}))}(this,(function(n){var t=function(n){return null!=n},e=function(n){return null==n},r=function(n){return Array.isArray(n)},u=function(n){return"function"==typeof n},o=function(n){return"string"==typeof n},i=function(n){return!function(n){return e(n)||0===n.trim().length}(n)},c=function(n){return n&&n.getTime},a=function(n){return t(n.filters)};Object.create;Object.create;"function"==typeof SuppressedError&&SuppressedError;var f,s=function(n,t,e){return function(r){return n(r)?t(r):e(r)}},l=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return function(t){return n.reduceRight((function(n,t){return t(n)}),t)}},g=function(n){return new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()))},d=function(n){return c(n.value)},p=(f="",{}),h=/\[(?:(\d+)|['"](.*?)['"])\]|((?:(?!\[.*?\]|\.).)+)/g;p[void 0]=function(n){return n};var v,m,y=function(n,e){var r=n+e;if(p[r])return p[r];var u=[];return n.replace(h,(function(n,e,r,o){u.push(t(e)?e:r||o)})),p[r]=function(n){for(var r=n,o=0;o<u.length;o++)if(r=r[u[o]],!t(r)&&e)return r;return r},p[r]},b=function(n){return function(t){return[n,t]}},w=function(){return null},k=function(n){return function(e){return t(n(e))}},C=function(n){return function(e){return function(n){return t(n)&&r(n)&&n.length>0}(n(e))}},O=function(n,t){return s(n,t,w)},x=function(n,t){return function(e){return n(e).map(t).join("~")}},T=l.apply(void 0,[['"',""],[":","-"]].map((function(n){var t=n[0],e=n[1];return function(n){return n.replace(new RegExp(t,"g"),e)}}))),D=(v=".",function(n){return n.slice(0,n.indexOf(v))}),E=function(n){var t=n.field,e=n.dir,r=void 0===e?"asc":e;return"".concat(t,"-").concat(r)},S=y("take"),N=y("aggregates"),q=y("skip"),I=y("group"),M=y("sort",!0),_=x(M,E),j=x(I,E),A=x(N,(function(n){var t=n.field,e=n.aggregate;return"".concat(t,"-").concat(e)})),L=l((function(n){return"datetime'".concat(n,"'")}),D,T,JSON.stringify,g),W=l(b("page"),(function(n){var t=n.skip,e=n.take;return Math.floor((t||0)/e)+1})),G=l(b("pageSize"),S),H=l(b("group"),j),Q=l(b("sort"),_),R=l(b("aggregate"),A),z=(O(k(q),W),O(k(S),G),O(C(I),H),O(k(N),R),l(O(C(M),Q),(function(n){return Object.assign({},n,{sort:(M(n)||[]).filter((function(n){var t=n.dir;return i(t)}))})})),function(n){var t=n.field,e=n.operator,r=n.value;return"".concat(t,"~").concat(e,"~").concat(r)}),F=(s(d,l(z,(function(n){var t=n.field,e=n.value,r=n.ignoreCase,u=n.operator;return{value:L(e),field:t,ignoreCase:r,operator:u}})),z),function(n,t,e){return t[n]=e,t}),J=function(n){return function(e){var r,u=e[n];return t(u)?u:e[(r=n,r.replace(/(^[A-Z])/g,(function(n,t){return t.toLowerCase()})))]}},K=(J("Member"),J("AggregateMethodName"),J("Value"),function(n){return function(t){return Object.keys(t).reduce(n.bind(null,t),{})}}),U=K((function(n,t,e){return F(e.toLowerCase(),t,n[e])})),V=K((function(n,t,e){return F(e,t,U(n[e]))})),Y=function(n,e){return t(n)?n:e},Z=l((function(n){var t=n.field,e=n.hasSubgroups,r=n.value,u=n.aggregates,o=n.items;return{aggregates:V(u),field:t,items:e?o.map(Z):o,value:r}}),(function(n){return{aggregates:n.Aggregates||n.aggregates,field:n.Member||n.member||n.field,hasSubgroups:n.HasSubgroups||n.hasSubgroups||!1,items:n.Items||n.items,value:Y(n.Key,Y(n.key,n.value))}})),$=function(n){return function(t){return function(e,r,u){return t(e,n(r,u))}}},B=($((function(n){return n})),{or:{concat:function(n,t){return function(e){return n(e)||t(e)}},identity:function(){return!1}},and:{concat:function(n,t){return function(e){return n(e)&&t(e)}},identity:function(){return!0}}}),P={contains:function(n,t){return(n||"").indexOf(t)>=0},doesnotcontain:function(n,t){return-1===(n||"").indexOf(t)},doesnotendwith:function(n,t){return(n||"").indexOf(t,(n||"").length-(t||"").length)<0},doesnotstartwith:function(n,t){return-1===(n||"").lastIndexOf(t,0)},endswith:function(n,t){return(n||"").indexOf(t,(n||"").length-(t||"").length)>=0},eq:function(n,t){return n===t},gt:function(n,t){return n>t},gte:function(n,t){return n>=t},isempty:function(n){return""===n},isnotempty:function(n){return""!==n},isnotnull:function(n){return t(n)},isnull:function(n){return e(n)},lt:function(n,t){return n<t},lte:function(n,t){return n<=t},neq:function(n,t){return n!=t},startswith:function(n,t){return 0===(n||"").lastIndexOf(t,0)}},X=/^\/Date\((.*?)\)\/$/,nn=function(n){var e=n.field,r=n.ignoreCase,i=n.value,a=n.operator;e=t(e)?e:function(n){return n},r=!t(r)||r;var f=function(n,e,r){if(!t(e))return n;var u=n;if(o(e)){var i=X.exec(e);i?e=new Date(+i[1]):u=function(t){var e=n(t);if(null===e)return e;var u="string"==typeof e?e:e+"";return r?u.toLowerCase():u}}return c(e)?function(n){var t=u(n);return c(t)?t.getTime():t}:u}(u(e)?e:y(e,!0),i,r);i=function(n,t){if(null!=n&&o(n)){var e=X.exec(n);if(e)return new Date(+e[1]).getTime();if(t)return n.toLowerCase()}else if(null!=n&&c(n))return n.getTime();return n}(i,r);var s=u(a)?a:P[a];return function(n){return s(f(n),i,r)}},tn=function(n){var e=B[n.logic];return n.filters.filter(t).map((function(n){return a(n)?tn(n):nn(n)})).reduce(e.concat,e.identity)},en=function(n){return n&&0!==n.filters.length?tn(n):function(){return!0}};$((function(n){return n}));!function(n){n.Contains="contains",n.DoesNotContain="doesnotcontain",n.DoesNotEndWith="doesnotendwith",n.DoesNotStartWith="doesnotstartwith",n.EndsWith="endswith",n.EqualTo="eq",n.GreaterThan="gt",n.GreaterThanOrEqual="gte",n.IsEmpty="isempty",n.IsNotEmpty="isnotempty",n.IsNotNull="isnotnull",n.IsNull="isnull",n.LessThan="lt",n.LessThanOrEqual="lte",n.NotEqualTo="neq",n.StartsWith="startswith"}(m||(m={})),n.__meta__={id:"data-query.cmn.chunk",name:"DataQueryCmnChunk",category:"web",description:"A reusable outputed chunk of code",depends:[],hidden:!0,chunk:!0},n.c=en}));
//# sourceMappingURL=kendo.data-query.cmn.chunk.min.js.map