16 lines
2.6 KiB
JavaScript
16 lines
2.6 KiB
JavaScript
/**
|
|
* Copyright 2014 Telerik AD
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
!function(e,define){define(["./kendo.core.min"],e)}(function(){return function(e,t){function n(i){var a,s,u,l,c,d,f,p,h=[],m=i.logic||"and",g=i.filters;for(a=0,s=g.length;s>a;a++)i=g[a],u=i.field,f=i.value,d=i.operator,i.filters?i=n(i):(p=i.ignoreCase,u=u.replace(/\./g,"/"),i=o[d],i&&f!==t&&(l=e.type(f),"string"===l?(c="'{1}'",f=f.replace(/'/g,"''"),p===!0&&(u="tolower("+u+")")):c="date"===l?"datetime'{1:yyyy-MM-ddTHH:mm:ss}'":"{1}",i.length>3?"substringof"!==i?c="{0}({2},"+c+")":(c="{0}("+c+",{2})","doesnotcontain"===d&&(c+=" eq false")):c="{2} {0} "+c,i=r.format(c,i,f,u))),h.push(i);return i=h.join(" "+m+" "),h.length>1&&(i="("+i+")"),i}var r=window.kendo,i=e.extend,o={eq:"eq",neq:"ne",gt:"gt",gte:"ge",lt:"lt",lte:"le",contains:"substringof",doesnotcontain:"substringof",endswith:"endswith",startswith:"startswith"},a={pageSize:e.noop,page:e.noop,filter:function(e,t){t&&(e.$filter=n(t))},sort:function(t,n){var r=e.map(n,function(e){var t=e.field.replace(/\./g,"/");return"desc"===e.dir&&(t+=" desc"),t}).join(",");r&&(t.$orderby=r)},skip:function(e,t){t&&(e.$skip=t)},take:function(e,t){t&&(e.$top=t)}},s={read:{dataType:"jsonp"}};i(!0,r.data,{schemas:{odata:{type:"json",data:function(e){return e.d.results||[e.d]},total:"d.__count"}},transports:{odata:{read:{cache:!0,dataType:"jsonp",jsonp:"$callback"},update:{cache:!0,dataType:"json",contentType:"application/json",type:"PUT"},create:{cache:!0,dataType:"json",contentType:"application/json",type:"POST"},destroy:{cache:!0,dataType:"json",type:"DELETE"},parameterMap:function(e,t){var n,i,o,u;if(e=e||{},t=t||"read",u=(this.options||s)[t],u=u?u.dataType:"json","read"===t){n={$inlinecount:"allpages"},"json"!=u&&(n.$format="json");for(o in e)a[o]?a[o](n,e[o]):n[o]=e[o]}else{if("json"!==u)throw Error("Only json dataType can be used for "+t+" operation.");if("destroy"!==t){for(o in e)i=e[o],"number"==typeof i&&(e[o]=i+"");n=r.stringify(e)}}return n}}}})}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t){t()}); |