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.26 kB
module.exports=function(t){function e(a){if(n[a])return n[a].exports;var o=n[a]={exports:{},id:a,loaded:!1};return t[a].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}({0:function(t,e,n){t.exports=n(1103)},3:function(t,e){t.exports=function(){throw Error("define cannot be used indirect")}},1049:function(t,e){t.exports=require("./kendo.core")},1103:function(t,e,n){var a,o,r;!function(s,define){o=[n(1049)],a=s,r="function"==typeof a?a.apply(e,o):a,!(void 0!==r&&(t.exports=r))}(function(){return function(t,e){function n(a,o){var r,s,i,d,p,c,u,l,f=[],y=a.logic||"and",g=a.filters;for(r=0,s=g.length;r<s;r++)a=g[r],i=a.field,u=a.value,c=a.operator,a.filters?a=n(a,o):(l=a.ignoreCase,i=i.replace(/\./g,"/"),a=j[c],o&&(a=b[c]),"isnullorempty"===c?a=h.format("{0} {1} null or {0} {1} ''",i,a):"isnotnullorempty"===c?a=h.format("{0} {1} null and {0} {1} ''",i,a):"isnull"===c||"isnotnull"===c?a=h.format("{0} {1} null",i,a):"isempty"===c||"isnotempty"===c?a=h.format("{0} {1} ''",i,a):a&&u!==e&&(d=t.type(u),"string"===d?(p="'{1}'",u=u.replace(/'/g,"''"),l===!0&&(i="tolower("+i+")")):"date"===d?o?(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}",a.length>3?"substringof"!==a?p="{0}({2},"+p+")":(p="{0}("+p+",{2})","doesnotcontain"===c&&(o?(p="{0}({2},'{1}') eq -1",a="indexof"):p+=" eq false")):p="{2} {0} "+p,a=h.format(p,a,u,i))),f.push(a);return a=f.join(" "+y+" "),f.length>1&&(a="("+a+")"),a}function a(t){for(var e in t)0===e.indexOf("@odata")&&delete t[e]}function o(){return Math.floor(65536*(1+Math.random())).toString(16).substr(1)}function r(t){return t+o()+"-"+o()+"-"+o()}function s(t,e){var n=m+"--"+t;return e&&(n+="--"),n}function i(t,e,n,a){var o=t.options[a].url,r=h.format("{0} ",n);return v(o)?r+o(e):r+o}function d(t,e){var n="";return n+=s(t,!1),n+=m+"Content-Type: application/http",n+=m+"Content-Transfer-Encoding: binary",n+=m+"Content-ID: "+e}function p(t){var e="";return e+=m+"Content-Type: application/json;odata=minimalmetadata",e+=m+"Prefer: return=representation",e+=T+h.stringify(t)}function c(t,e,n,a,o,r){var s,c="";for(s=0;s<t.length;s++)c+=d(e,n),c+=T+i(o,t[s],o.options[a].type,a)+" HTTP/1.1",r||(c+=p(t[s])),c+=m,n++;return c}function u(t,e,n,a,o,r,i){var d="";return d+=l(e,n),d+=c(t,n,a,r,o,i),d+=s(n,!0),d+=m}function l(t,e){var n="";return n+="--"+t+m,n+="Content-Type: multipart/mixed; boundary="+e+m}function f(t,e){var n=g({},t.options.batch),a=r("sf_batch_"),o="",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=g(n.headers||{},{"Content-Type":"multipart/mixed; boundary="+a}),e.updated.length&&(o+=u(e.updated,a,p,i,t,"update",!1),i+=e.updated.length,p=r("sf_changeset_")),e.destroyed.length&&(o+=u(e.destroyed,a,p,i,t,"destroy",!0),i+=e.destroyed.length,p=r("sf_changeset_")),e.created.length&&(o+=u(e.created,a,p,i,t,"create",!1)),o+=s(a,!0),n.data=o,n}function y(t){var e,n,a,o,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++)o=i[s],o.lastIndexOf("--",o.length-1)?s<i.length-1&&p.push({models:[],passed:!0}):(d=d?t.indexOf(o,d+o.length):t.indexOf(o),e=t.substring(d,t.indexOf("--",d+1)),n=e.match(/^HTTP\/1\.\d (\d{3}) (.*)$/gm).pop(),a=h.parseFloat(n.match(/\d{3}/g).pop()),a>=200&&a<=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,g=t.extend,m="\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"},b=g({},j,{contains:"contains"}),x={pageSize:t.noop,page:t.noop,filter:function(t,e,a){e&&(e=n(e,a),e&&(t.$filter=e))},sort:function(e,n){var a=t.map(n,function(t){var e=t.field.replace(/\./g,"/");return"desc"===t.dir&&(e+=" desc"),e}).join(",");a&&(e.$orderby=a)},skip:function(t,e){e&&(t.$skip=e)},take:function(t,e){e&&(t.$top=e)}},E={read:{dataType:"jsonp"}};g(!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 a,o,r,s;if(t=t||{},e=e||"read",s=(this.options||E)[e],s=s?s.dataType:"json","read"===e){a={$inlinecount:"allpages"},"json"!=s&&(a.$format="json");for(r in t)x[r]?x[r](a,t[r],n):a[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)o=t[r],"number"==typeof o&&(t[r]=o+"");a=h.stringify(t)}}return a}}}}),g(!0,h.data,{schemas:{"odata-v4":{type:"json",data:function(e){if(t.isArray(e)){for(var n=0;n<e.length;n++)a(e[n]);return e}return e=t.extend({},e),a(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&&n.$filter&&(n.$filter=n.$filter.replace(/('[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}')/gi,function(t){return t.substring(1,t.length-1)})),n},submit:function(e){var n=this,a=f(n,e.data),o=e.data;(o.updated.length||o.destroyed.length||o.created.length)&&t.ajax(g(!0,{},{success:function(t){var n,a=y(t),r=0;o.updated.length&&(n=a[r],n.passed&&e.success(n.models.length?n.models:[],"update"),r++),o.destroyed.length&&(n=a[r],n.passed&&e.success([],"destroy"),r++),o.created.length&&(n=a[r],n.passed&&e.success(n.models,"create"))},error:function(t,n,a){e.error(t,n,a)}},a))}}}})}(window.kendo.jQuery),window.kendo},n(3))}});