@progress/kendo-ui
Version:
This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.
1 lines • 6.06 kB
JavaScript
module.exports=function(t){function e(o){if(n[o])return n[o].exports;var a=n[o]={exports:{},id:o,loaded:!1};return t[o].call(a.exports,a,a.exports,e),a.loaded=!0,a.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}({0:function(t,e,n){t.exports=n(1051)},3:function(t,e){t.exports=function(){throw Error("define cannot be used indirect")}},1006:function(t,e){t.exports=require("./kendo.core")},1051:function(t,e,n){var o,a,r;!function(s,define){a=[n(1006)],o=s,r="function"==typeof o?o.apply(e,a):o,!(void 0!==r&&(t.exports=r))}(function(){return function(t,e){function n(o,a){var r,s,i,d,p,c,u,l,f=[],y=o.logic||"and",m=o.filters;for(r=0,s=m.length;r<s;r++)o=m[r],i=o.field,u=o.value,c=o.operator,o.filters?o=n(o,a):(l=o.ignoreCase,i=i.replace(/\./g,"/"),o=j[c],a&&(o=x[c]),"isnullorempty"===c?o=h.format("{0} {1} null or {0} {1} ''",i,o):"isnotnullorempty"===c?o=h.format("{0} {1} null and {0} {1} ''",i,o):"isnull"===c||"isnotnull"===c?o=h.format("{0} {1} null",i,o):"isempty"===c||"isnotempty"===c?o=h.format("{0} {1} ''",i,o):o&&u!==e&&(d=t.type(u),"string"===d?(p="'{1}'",u=u.replace(/'/g,"''"),l===!0&&(i="tolower("+i+")")):"date"===d?a?(p="{1:yyyy-MM-ddTHH:mm:ss+00:00}",u=h.timezone.apply(u,"Etc/UTC")):p="datetime'{1:yyyy-MM-ddTHH:mm:ss}'":p="{1}",o.length>3?"substringof"!==o?p="{0}({2},"+p+")":(p="{0}("+p+",{2})","doesnotcontain"===c&&(a?(p="{0}({2},'{1}') eq -1",o="indexof"):p+=" eq false")):p="{2} {0} "+p,o=h.format(p,o,u,i))),f.push(o);return o=f.join(" "+y+" "),f.length>1&&(o="("+o+")"),o}function o(t){for(var e in t)0===e.indexOf("@odata")&&delete t[e]}function a(){return Math.floor(65536*(1+Math.random())).toString(16).substr(1)}function r(t){return t+a()+"-"+a()+"-"+a()}function s(t,e){var n=g+"--"+t;return e&&(n+="--"),n}function i(t,e,n,o){var a=t.options[o].url,r=h.format("{0} ",n);return v(a)?r+a(e):r+a}function d(t,e){var n="";return n+=s(t,!1),n+=g+"Content-Type: application/http",n+=g+"Content-Transfer-Encoding: binary",n+=g+"Content-ID: "+e}function p(t){var e="";return e+=g+"Content-Type: application/json;odata=minimalmetadata",e+=g+"Prefer: return=representation",e+=T+h.stringify(t)}function c(t,e,n,o,a,r){var s,c="";for(s=0;s<t.length;s++)c+=d(e,n),c+=T+i(a,t[s],a.options[o].type,o)+" HTTP/1.1",r||(c+=p(t[s])),c+=g,n++;return c}function u(t,e,n,o,a,r,i){var d="";return d+=l(e,n),d+=c(t,n,o,r,a,i),d+=s(n,!0),d+=g}function l(t,e){var n="";return n+="--"+t+g,n+="Content-Type: multipart/mixed; boundary="+e+g}function f(t,e){var n={},o=r("sf_batch_"),a="",i=0,d=t.options.batch.url,p=r("sf_changeset_");return n.type=t.options.batch.type,n.url=v(d)?d():d,n.headers={"Content-Type":"multipart/mixed; boundary="+o},e.updated.length&&(a+=u(e.updated,o,p,i,t,"update",!1),i+=e.updated.length,p=r("sf_changeset_")),e.destroyed.length&&(a+=u(e.destroyed,o,p,i,t,"destroy",!0),i+=e.destroyed.length,p=r("sf_changeset_")),e.created.length&&(a+=u(e.created,o,p,i,t,"create",!1)),a+=s(o,!0),n.data=a,n}function y(t){var e,n,o,a,r,s,i=t.match(/--changesetresponse_[a-z0-9-]+$/gm),d=0,p=[];for(p.push({models:[],passed:!0}),s=0;s<i.length;s++)a=i[s],a.lastIndexOf("--",a.length-1)?s<i.length-1&&p.push({models:[],passed:!0}):(d=d?t.indexOf(a,d+a.length):t.indexOf(a),e=t.substring(d,t.indexOf("--",d+1)),n=e.match(/^HTTP\/1\.\d (\d{3}) (.*)$/gm).pop(),o=h.parseFloat(n.match(/\d{3}/g).pop()),o>=200&&o<=299?(r=e.match(/\{.*\}/gm),r&&p[p.length-1].models.push(JSON.parse(r[0]))):p[p.length-1].passed=!1);return p}var h=window.kendo,m=t.extend,g="\r\n",T="\r\n\r\n",v=h.isFunction,j={eq:"eq",neq:"ne",gt:"gt",gte:"ge",lt:"lt",lte:"le",contains:"substringof",doesnotcontain:"substringof",endswith:"endswith",startswith:"startswith",isnull:"eq",isnotnull:"ne",isnullorempty:"eq",isnotnullorempty:"ne",isempty:"eq",isnotempty:"ne"},x=m({},j,{contains:"contains"}),b={pageSize:t.noop,page:t.noop,filter:function(t,e,o){e&&(e=n(e,o),e&&(t.$filter=e))},sort:function(e,n){var o=t.map(n,function(t){var e=t.field.replace(/\./g,"/");return"desc"===t.dir&&(e+=" desc"),e}).join(",");o&&(e.$orderby=o)},skip:function(t,e){e&&(t.$skip=e)},take:function(t,e){e&&(t.$top=e)}},E={read:{dataType:"jsonp"}};m(!0,h.data,{schemas:{odata:{type:"json",data:function(t){return t.d.results||[t.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(t,e,n){var o,a,r,s;if(t=t||{},e=e||"read",s=(this.options||E)[e],s=s?s.dataType:"json","read"===e){o={$inlinecount:"allpages"},"json"!=s&&(o.$format="json");for(r in t)b[r]?b[r](o,t[r],n):o[r]=t[r]}else{if("json"!==s)throw Error("Only json dataType can be used for "+e+" operation.");if("destroy"!==e){for(r in t)a=t[r],"number"==typeof a&&(t[r]=a+"");o=h.stringify(t)}}return o}}}}),m(!0,h.data,{schemas:{"odata-v4":{type:"json",data:function(e){if(t.isArray(e)){for(var n=0;n<e.length;n++)o(e[n]);return e}return e=t.extend({},e),o(e),e.value?e.value:[e]},total:function(t){return t["@odata.count"]}}},transports:{"odata-v4":{batch:{type:"POST"},read:{cache:!0,dataType:"json"},update:{cache:!0,dataType:"json",contentType:"application/json;IEEE754Compatible=true",type:"PUT"},create:{cache:!0,dataType:"json",contentType:"application/json;IEEE754Compatible=true",type:"POST"},destroy:{cache:!0,dataType:"json",type:"DELETE"},parameterMap:function(t,e){var n=h.data.transports.odata.parameterMap(t,e,!0);return"read"==e&&(n.$count=!0,delete n.$inlinecount),n},submit:function(e){var n=this,o=f(n,e.data),a=e.data;(a.updated.length||a.destroyed.length||a.created.length)&&t.ajax(m(!0,{},{success:function(t){var n,o=y(t),r=0;a.updated.length&&(n=o[r],n.passed&&e.success(n.models.length?n.models:[],"update"),r++),a.destroyed.length&&(n=o[r],n.passed&&e.success([],"destroy"),r++),a.created.length&&(n=o[r],n.passed&&e.success(n.models,"create"))},error:function(t,n,o){e.error(t,n,o)}},o))}}}})}(window.kendo.jQuery),window.kendo},n(3))}});