@syncfusion/ej2-data
Advanced tools
Comparing version 1.0.10 to 1.0.11
@@ -11,2 +11,2 @@ /*! | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@syncfusion/ej2-base"));else if("function"==typeof define&&define.amd)define(["@syncfusion/ej2-base"],t);else{var r=t("object"==typeof exports?require("@syncfusion/ej2-base"):e["@syncfusion/ej2-base"]);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(this,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){var n,o;n=[r,t,r(1),r(6),r(7),r(5)],void 0!==(o=function(e,t,r,n,o,a){"use strict";function s(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),s(r),s(n),s(o),s(a)}.apply(t,n))&&(e.exports=o)},function(e,t,r){var n,o;n=[r,t,r(2),r(3),r(5),r(6),r(7)],void 0!==(o=function(e,t,r,n,o,a,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t,r){var i=this;this.dateParse=!0,this.requests=[],e||this.dataSource||(e=[]),r=r||e.adaptor;var u;return e instanceof Array?u={json:e,offline:!0}:"object"==typeof e?(e.json||(e.json=[]),u={url:e.url,insertUrl:e.insertUrl,removeUrl:e.removeUrl,updateUrl:e.updateUrl,crudUrl:e.crudUrl,batchUrl:e.batchUrl,json:e.json,headers:e.headers,accept:e.accept,data:e.data,timeTillExpiration:e.timeTillExpiration,cachingPageSize:e.cachingPageSize,enableCaching:e.enableCaching,requestType:e.requestType,key:e.key,crossDomain:e.crossDomain,jsonp:e.jsonp,dataType:e.dataType,offline:void 0!==e.offline?e.offline:!(e.adaptor instanceof s.RemoteSaveAdaptor)&&!e.url,requiresFormat:e.requiresFormat}):o.DataUtil.throwError("DataManager: Invalid arguments"),void 0!==u.requiresFormat||o.DataUtil.isCors()||(u.requiresFormat=!!n.isNullOrUndefined(u.crossDomain)||u.crossDomain),void 0===u.dataType&&(u.dataType="json"),this.dataSource=u,this.defaultQuery=t,u.url&&u.offline&&!u.json.length?(this.isDataAvailable=!1,this.adaptor=r||new s.ODataAdaptor,this.dataSource.offline=!1,this.ready=this.executeQuery(t||new a.Query),this.ready.then(function(e){i.dataSource.offline=!0,i.isDataAvailable=!0,u.json=e.result,i.adaptor=new s.JsonAdaptor})):this.adaptor=u.offline?new s.JsonAdaptor:new s.ODataAdaptor,!u.jsonp&&this.adaptor instanceof s.ODataAdaptor&&(u.jsonp="callback"),this.adaptor=r||this.adaptor,u.enableCaching&&(this.adaptor=new s.CacheAdaptor(this.adaptor,u.timeTillExpiration,u.cachingPageSize)),this}return e.prototype.setDefaultQuery=function(e){return this.defaultQuery=e,this},e.prototype.executeLocal=function(t){this.defaultQuery||t instanceof a.Query||o.DataUtil.throwError("DataManager - executeLocal() : A query is required to execute"),this.dataSource.json||o.DataUtil.throwError("DataManager - executeLocal() : Json data is required to execute"),t=t||this.defaultQuery;var r=this.adaptor.processQuery(this,t);if(t.subQuery){var s=t.subQuery.fromTable,i=t.subQuery.lookups,u=t.requiresCounts?r.result:r;i&&i instanceof Array&&o.DataUtil.buildHierarchy(t.subQuery.fKey,s,u,i,t.subQuery.key);for(var c=0;c<u.length;c++)u[c][s]instanceof Array&&(u[c]=n.extend({},{},u[c]),u[c][s]=this.adaptor.processResponse(t.subQuery.using(new e(u[c][s].slice(0))).executeLocal(),this,t))}return this.adaptor.processResponse(r,this,t)},e.prototype.executeQuery=function(t,r,n,s){var i=this;"function"==typeof t&&(n,n=r,r=t,t=null),t||(t=this.defaultQuery),t instanceof a.Query||o.DataUtil.throwError("DataManager - executeQuery() : A query is required to execute");var c=new u,l={query:t};if(this.dataSource.offline||void 0===this.dataSource.url)e.nextTick(function(){var r=i.executeLocal(t);l=e.getDeferedArgs(t,r,l),c.resolve(l)});else{var p=this.adaptor.processQuery(this,t);this.makeRequest(p,c,l,t)}return c.promise},e.getDeferedArgs=function(e,t,r){return e.requiresCounts?(r.result=t.result,r.count=t.count):r.result=t,r},e.nextTick=function(e){(window.setImmediate||window.setTimeout)(e,0)},e.prototype.extendRequest=function(e,t,r){return n.extend({},{type:"GET",dataType:this.dataSource.dataType,crossDomain:this.dataSource.crossDomain,jsonp:this.dataSource.jsonp,cache:!0,processData:!1,onSuccess:t,onFailure:r},e)},e.prototype.makeRequest=function(e,t,n,a){var s=this,i=!!a.subQuerySelector,c=function(e){n.error=e,t.reject(n)},l=function(e,r,o,a,s,i,u){n.xhr=o,n.count=r?parseInt(r.toString(),10):0,n.result=e,n.request=a,n.aggregates=i,n.actual=s,n.virtualSelectRecords=u,t.resolve(n)},p=function(e,t){var r=new u,p={parent:n};a.subQuery.isChild=!0;var d=s.adaptor.processQuery(s,a.subQuery,e?s.adaptor.processResponse(e):t),f=s.makeRequest(d,r,p,a.subQuery);return i||r.then(function(t){e&&(o.DataUtil.buildHierarchy(a.subQuery.fKey,a.subQuery.fromTable,e,t,a.subQuery.key),l(e,t.count,t.xhr))},c),f},d=function(e,t){-1===t.httpRequest.getResponseHeader("Content-Type").indexOf("xml")&&s.dateParse&&(e=o.DataUtil.parse.parseJson(e));var r=s.adaptor.processResponse(e,s,a,t.httpRequest,t),n=0,u=null,c=e.virtualSelectRecords;if(a.requiresCounts&&(n=r.count,u=r.aggregates,r=r.result),!a.subQuery)return void l(r,n,t.httpRequest,t.type,e,u,c);i||p(r,t)},f=this.extendRequest(e,d,c),h=new r.Ajax(f);if(h.beforeSend=function(){s.beforeSend(h.httpRequest,h)},f=h.send(),this.requests.push(h),i){var g=void 0,y=a.subQuerySelector.call(this,{query:a.subQuery,parent:a});y&&y.length?(g=Promise.all([f,p(null,y)]),g.then(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e[0],n=s.adaptor.processResponse(r[0],s,a,s.requests[0].httpRequest,s.requests[0]),u=0;a.requiresCounts&&(u=n.count,n=n.result);var c=s.adaptor.processResponse(r[1],s,a.subQuery,s.requests[1].httpRequest,s.requests[1]);u=0,a.subQuery.requiresCounts&&(u=c.count,c=c.result),o.DataUtil.buildHierarchy(a.subQuery.fKey,a.subQuery.fromTable,n,c,a.subQuery.key),i=!1,l(n,u,s.requests[0].httpRequest)})):i=!1}return f},e.prototype.beforeSend=function(e,t){this.adaptor.beforeSend(this,e,t);for(var r,n=this.dataSource.headers,o=0;n&&o<n.length;o++){r=[];for(var a=Object.keys(n[o]),s=0,i=a;s<i.length;s++){var u=i[s];r.push(u),e.setRequestHeader(u,n[o][u])}}},e.prototype.saveChanges=function(e,t,n,o){var s=this;n instanceof a.Query&&(o=n,n=null);var i={url:n,key:t||this.dataSource.key},c=this.adaptor.batchRequest(this,e,i,o);if(this.dataSource.offline)return c;var l=new u,p=new r.Ajax(c);return p.beforeSend=function(){s.beforeSend(p.httpRequest,p)},p.onSuccess=function(t,r){l.resolve(s,[s.adaptor.processResponse(t,s,null,r.httpRequest,r,e)])},p.onFailure=function(e){l.reject([{error:e}])},p.send(),l.promise},e.prototype.insert=function(e,t,r){e=o.DataUtil.parse.replacer(e),t instanceof a.Query&&(r=t,t=null);var n=this.adaptor.insert(this,e,t,r);return this.dataSource.offline?n:this.doAjaxRequest(n)},e.prototype.remove=function(e,t,r,n){"object"==typeof t&&(t=t[e]),r instanceof a.Query&&(n=r,r=null);var o=this.adaptor.remove(this,e,t,r,n);return this.dataSource.offline?o:this.doAjaxRequest(o)},e.prototype.update=function(e,t,r,n){t=o.DataUtil.parse.replacer(t),r instanceof a.Query&&(n=r,r=null);var s=this.adaptor.update(this,e,t,r,n);return this.dataSource.offline?s:this.doAjaxRequest(s)},e.prototype.doAjaxRequest=function(e){var t=this,a=new u;e=n.extend({},{type:"POST",contentType:"application/json; charset=utf-8",processData:!1},e);var s=new r.Ajax(e);return s.beforeSend=function(){t.beforeSend(s.httpRequest,s)},s.onSuccess=function(e,r){try{o.DataUtil.parse.parseJson(e)}catch(t){e=[]}e=t.adaptor.processResponse(o.DataUtil.parse.parseJson(e),t,null,r.httpRequest,r),a.resolve(t,[{record:e,dataManager:t}])},s.onFailure=function(e){a.reject([{error:e}])},s.send(),a.promise},e}();t.DataManager=i;var u=function(){function e(){var e=this;this.promise=new Promise(function(t,r){e.resolve=t,e.reject=r}),this.then=this.promise.then.bind(this.promise),this.catch=this.promise.catch.bind(this.promise)}return e}();t.Deferred=u}.apply(t,n))&&(e.exports=o)},function(t,r){t.exports=e},function(e,t,r){var n,o;n=[r,t,r(4)],void 0!==(o=function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}(r)}.apply(t,n))&&(e.exports=o)},function(e,t,r){var n,o;n=[r,t],void 0!==(o=function(e,t){"use strict";function r(e,t){var r=t;return r.unshift(void 0),new(Function.prototype.bind.apply(e,r))}function n(e){var t,r=new Uint16Array(5);(window.msCrypto||window.crypto).getRandomValues(r);var n="ej2"+w(r),o=function(r){r.source===window&&"string"==typeof r.data&&r.data.length<=32&&r.data===n&&(e(),t())};return window.addEventListener("message",o,!1),window.postMessage(n,"*"),t=function(){window.removeEventListener("message",o)}}function o(e,t){for(var r=t,n=e.split("."),o=0;o<n.length&&!d(r);o++)r=r[n[o]];return r}function a(e,t,r){var n,o,a=e.split("."),s=r||{},i=s,u=a.length;for(n=0;n<u;n++)o=a[n],n+1===u?i[o]=void 0===t?{}:t:p(i[o])&&(i[o]={}),i=i[o];return s}function s(e,t){delete e[t]}function i(e){var t={};return!p(e)&&e.constructor===t.constructor}function u(e,t){return e[t]}function c(e,t){if(!p(t))for(var r=e,n=t,o=Object.keys(t),a=0,s=o;a<s.length;a++){var i=s[a];r[i]=n[i]}}function l(e,t,r,n){var o=e||{},a=arguments.length;n&&(a-=1);for(var s=arguments,u=1;u<a;u++)!function(e){if(!s[e])return"continue";var t=s[e];Object.keys(t).forEach(function(e){var r,a=o[e],s=t[e];n&&i(s)?(r=i(a)?a:{},o[e]=l({},r,s,!0)):o[e]=s})}(u);return o}function p(e){return void 0===e||null===e}function d(e){return void 0===e}function f(e){return e+"_"+U++}function h(e,t){var r,n=this;return function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];var s=o[0],i=function(){return r=null,e.call(n,s)};clearTimeout(r),r=setTimeout(i,t)}}function g(e){for(var t=[],r=Object.keys(e),n=0,o=r;n<o.length;n++){var a=o[n];t.push(encodeURIComponent(a)+"="+encodeURIComponent(""+e[a]))}return t.join("&")}function y(e){var t=Object.prototype.toString;return"[object Array]"===t.call(e)&&"[object Object]"===t.call(e[0])}function v(e,t){var r=e;return r===t||!(r===document||!r)&&v(r.parentNode,t)}function m(e){try{throw new Error(e)}catch(e){throw e.message+"\n"+e.stack}}function b(e,t){var r=document.createElement("div"),n=[].slice.call(document.getElementsByTagName("head")[0].querySelectorAll("link, style")),o="";p(t)&&(t=window.open("","print","height=452,width=1024,tabbar=no")),r.appendChild(e.cloneNode(!0));for(var a=0,s=n.length;a<s;a++)o+=n[a].outerHTML;t.document.write("<!DOCTYPE html> <html><head>"+o+"</head><body>"+r.innerHTML+"<script> (function() { window.ready = true; })(); <\/script></body></html>"),t.document.close(),t.focus();var i=setInterval(function(){t.ready&&(t.print(),t.close(),clearInterval(i))},500);return t}function S(e){var t=e+"";return"auto"===t||-1!==t.indexOf("%")||-1!==t.indexOf("px")?t:t+"px"}function D(e,t){var r="string"==typeof e?document.querySelector(e):e;if(r[C])for(var n=0,o=r[C];n<o.length;n++){var a=o[n];if(a instanceof t)return a}return null}function q(e,t){var r="string"==typeof e?document.querySelector(e):e;r[C]?r[C].push(t):r[C]=[t]}function w(e){for(var t="",r=0;r<5;r++)t+=(r?",":"")+e[r];return t}Object.defineProperty(t,"__esModule",{value:!0});var C="ej2_instances",U=0;t.createInstance=r,t.setImmediate=n,t.getValue=o,t.setValue=a,t.deleteObject=s,t.isObject=i,t.getEnumValue=u,t.merge=c,t.extend=l,t.isNullOrUndefined=p,t.isUndefined=d,t.getUniqueID=f,t.debounce=h,t.queryParams=g,t.isObjectArray=y,t.compareElementParent=v,t.throwError=m,t.print=b,t.formatUnit=S,t.getInstance=D,t.addInstance=q}.apply(t,n))&&(e.exports=o)},function(e,t,r){var n,o;n=[r,t,r(3),r(1),r(6)],void 0!==(o=function(e,t,r,n,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a={GroupGuid:"{271bbba0-1ee7}"},s=function(){function e(){}return e.getValue=function(e,t){return"function"==typeof e?e.call(t||{}):e},e.endsWith=function(e,t){return e.slice(-t.length)===t},e.startsWith=function(e,t){return e.slice(0,t.length)===t},e.fnSort=function(e){return e=e?e.toLowerCase():"ascending","ascending"===e?this.fnAscending:this.fnDescending},e.fnAscending=function(e,t){return null===t||void 0===t?-1:"string"==typeof e?e.localeCompare(t):null===e||void 0===e?1:e-t},e.fnDescending=function(e,t){return null===t||void 0===t?1:"string"==typeof e?-1*e.localeCompare(t):null===e||void 0===e?-1:t-e},e.extractFields=function(e,t){var r={};if(1===t.length)return this.getObject(t[0],e);for(var n=0;n<t.length;n++)r[t[n].replace(".","_")]=this.getObject(t[n],e);return r},e.select=function(e,t){for(var r=[],n=0;n<e.length;n++)r.push(this.extractFields(e[n],t));return r},e.group=function(t,n,o,s,i){s=s||1;var u=t;if(u.GroupGuid===a.GroupGuid){for(var c=this,l=0;l<u.length;l++)!function(e){if(r.isNullOrUndefined(i))u[e].items=c.group(u[e].items,n,o,u.level+1),u[e].count=u[e].items.length;else{var t=-1,a=i.filter(function(t){return t.key===u[e].key});t=i.indexOf(a[0]),u[e].items=c.group(u[e].items,n,o,u.level+1,i[t].items),u[e].count=i[t].count}}(l);return u.childLevels+=1,u}var p={},d=[];d.GroupGuid=a.GroupGuid,d.level=s,d.childLevels=0,d.records=u;for(var f=this,h=0;h<u.length;h++)!function(e){var t=f.getVal(u,e,n);if(!p[t]&&(p[t]={key:t,count:0,items:[],aggregates:{},field:n},d.push(p[t]),!r.isNullOrUndefined(i))){var o=i.filter(function(e){return e.key===p[t].key});p[t].count=o[0].count}p[t].count=r.isNullOrUndefined(i)?p[t].count+=1:p[t].count,p[t].items.push(u[e])}(h);if(o&&o.length)for(var h=0;h<d.length;h++)!function(t){for(var n={},a=void 0,s=o,u=0;u<o.length;u++)if(a=e.aggregates[o[u].type],r.isNullOrUndefined(i))a&&(n[s[u].field+" - "+s[u].type]=a(d[t].items,s[u].field));else{var c=i.filter(function(e){return e.key===d[t].key});a&&(n[s[u].field+" - "+s[u].type]=a(c[0].items,s[u].field))}d[t].aggregates=n}(h);return d},e.buildHierarchy=function(e,t,r,n,o){var a,s,i={};for(n.result&&(n=n.result),n.GroupGuid&&this.throwError("DataManager: Do not have support Grouping in hierarchy"),a=0;a<n.length;a++){var u=this.getObject(e,n[a]);s=i[u]||(i[u]=[]),s.push(n[a])}for(a=0;a<r.length;a++){var u=this.getObject(o||e,r[a]);r[a][t]=i[u]}},e.getFieldList=function(e,t,r){if(void 0===r&&(r=""),void 0===t||null===t)return this.getFieldList(e,[],r);for(var n=e,o=Object.keys(e),a=0,s=o;a<s.length;a++){var i=s[a];"object"!=typeof n[i]||n[i]instanceof Array?t.push(r+i):this.getFieldList(n[i],t,r+i+".")}return t},e.getObject=function(e,t){if(!e)return t;if(-1===e.indexOf("."))return t[e];for(var r=t,n=e.split("."),o=0;o<n.length&&null!=r;o++)r=r[n[o]];return r},e.sort=function(e,t,r){if(e.length<=1)return e;var n=parseInt((e.length/2).toString(),10),o=e.slice(0,n),a=e.slice(n);return o=this.sort(o,t,r),a=this.sort(a,t,r),this.merge(o,a,t,r)},e.merge=function(e,t,r,n){for(var o,a=[];e.length>0||t.length>0;)o=e.length>0&&t.length>0?n?n(this.getVal(e,0,r),this.getVal(t,0,r))<=0?e:t:e[0][r]<e[0][r]?e:t:e.length>0?e:t,a.push(o.shift());return a},e.getVal=function(e,t,r){return r?this.getObject(r,e[t]):e[t]},e.toLowerCase=function(e){return e?"string"==typeof e?e.toLowerCase():e.toString():0===e||!1===e?e.toString():""},e.callAdaptorFunction=function(e,t,r,n){if(t in e){var o=e[t](r,n);this.fnOperators.isnull(o)||(r=o)}return r},e.isPlainObject=function(e){return!!e&&e.constructor===Object},e.isCors=function(){var e=null;try{e=new window.XMLHttpRequest}catch(e){}return!!e&&"withCredentials"in e},e.getGuid=function(e){var t;return(e||"")+"00000000-0000-4000-0000-000000000000".replace(/0/g,function(e,r){if("crypto"in window&&"getRandomValues"in crypto){var n=new Uint8Array(1);window.crypto.getRandomValues(n),t=n[0]%16|0}else t=16*Math.random()|0;return"0123456789abcdef"[19===r?3&t|8:t]})},e.isNull=function(e){return void 0===e||null===e},e.getItemFromComparer=function(t,n,o){var a,s,i,u=0,c="string"==typeof e.getVal(t,0,n);if(t.length)for(;r.isNullOrUndefined(a)&&u<t.length;)a=e.getVal(t,u,n),i=t[u++];for(;u<t.length;u++)s=e.getVal(t,u,n),r.isNullOrUndefined(s)||(c&&(a=+a,s=+s),o(a,s)>0&&(a=s,i=t[u]));return i},e}();s.serverTimezoneOffset=0,s.throwError=function(e){try{throw new Error(e)}catch(e){throw e.message+"\n"+e.stack}},s.aggregates={sum:function(e,t){for(var r,n=0,o="number"!=typeof s.getVal(e,0,t),a=0;a<e.length;a++)r=s.getVal(e,a,t),isNaN(r)||null===r||(o&&(r=+r),n+=r);return n},average:function(e,t){return s.aggregates.sum(e,t)/e.length},min:function(e,t){var r;return"function"==typeof t&&(r=t,t=null),s.getObject(t,s.getItemFromComparer(e,t,r||s.fnAscending))},max:function(e,t){var r;return"function"==typeof t&&(r=t,t=null),s.getObject(t,s.getItemFromComparer(e,t,r||s.fnDescending))},truecount:function(e,t){return new n.DataManager(e).executeLocal((new o.Query).where(t,"equal",!0,!0)).length},falsecount:function(e,t){return new n.DataManager(e).executeLocal((new o.Query).where(t,"equal",!1,!0)).length},count:function(e,t){return e.length}},s.operatorSymbols={"<":"lessthan",">":"greaterthan","<=":"lessthanorequal",">=":"greaterthanorequal","==":"equal","!=":"notequal","*=":"contains","$=":"endswith","^=":"startswith"},s.odBiOperator={"<":" lt ",">":" gt ","<=":" le ",">=":" ge ","==":" eq ","!=":" ne ",lessthan:" lt ",lessthanorequal:" le ",greaterthan:" gt ",greaterthanorequal:" ge ",equal:" eq ",notequal:" ne "},s.odUniOperator={"$=":"endswith","^=":"startswith","*=":"substringof",endswith:"endswith",startswith:"startswith",contains:"substringof"},s.fnOperators={equal:function(e,t,r){return r?s.toLowerCase(e)===s.toLowerCase(t):e===t},notequal:function(e,t,r){return!s.fnOperators.equal(e,t,r)},lessthan:function(e,t,r){return r?s.toLowerCase(e)<s.toLowerCase(t):e<t},greaterthan:function(e,t,r){return r?s.toLowerCase(e)>s.toLowerCase(t):e>t},lessthanorequal:function(e,t,r){return r?s.toLowerCase(e)<=s.toLowerCase(t):e<=t},greaterthanorequal:function(e,t,r){return r?s.toLowerCase(e)>=s.toLowerCase(t):e>=t},contains:function(e,t,n){return n?!r.isNullOrUndefined(e)&&!r.isNullOrUndefined(t)&&-1!==s.toLowerCase(e).indexOf(s.toLowerCase(t)):!r.isNullOrUndefined(e)&&!r.isNullOrUndefined(t)&&-1!==e.toString().indexOf(t)},notnull:function(e){return null!==e},isnull:function(e){return null===e},startswith:function(e,t,r){return r?e&&t&&s.startsWith(e.toLowerCase(),t.toLowerCase()):e&&t&&s.startsWith(e,t)},endswith:function(e,t,r){return r?e&&t&&s.endsWith(e.toLowerCase(),t.toLowerCase()):e&&t&&s.endsWith(e,t)},processSymbols:function(e){var t=s.operatorSymbols[e];if(t){return s.fnOperators[t]}return s.throwError("Query - Process Operator : Invalid operator")},processOperator:function(e){var t=s.fnOperators[e];return t||s.fnOperators.processSymbols(e)}},s.parse={parseJson:function(e){return"string"==typeof e?e=JSON.parse(e,s.parse.jsonReviver):e instanceof Array?s.parse.iterateAndReviveArray(e):"object"==typeof e&&s.parse.iterateAndReviveJson(e),e},iterateAndReviveArray:function(e){for(var t=0;t<e.length;t++)"object"==typeof e[t]?s.parse.iterateAndReviveJson(e[t]):"string"!=typeof e[t]||/^[\s]*\[|^[\s]*\{|\"/g.test(e[t])?e[t]=s.parse.parseJson(e[t]):e[t]=s.parse.jsonReviver("",e[t])},iterateAndReviveJson:function(e){for(var t,r=Object.keys(e),n=0,o=r;n<o.length;n++){var a=o[n];s.startsWith(a,"__")||(t=e[a],"object"==typeof t?t instanceof Array?s.parse.iterateAndReviveArray(t):t&&s.parse.iterateAndReviveJson(t):e[a]=s.parse.jsonReviver(e[a],t))}},jsonReviver:function(e,t){var r=t;if("string"==typeof t){var n=/^\/Date\(([+-]?[0-9]+)([+-][0-9]{4})?\)\/$/.exec(t);if(n)return s.parse.jsonReplacer({value:new Date(parseInt(n[1],10))},!1).value;if(/^(\d{4}\-\d\d\-\d\d([tT][\d:\.]*){1})([zZ]|([+\-])(\d\d):?(\d\d))?$/.test(t)){var o=r.split(/[^0-9]/);t=s.parse.jsonReplacer({value:new Date(parseInt(o[0],10),parseInt(o[1],10)-1,parseInt(o[2],10),parseInt(o[3],10),parseInt(o[4],10),parseInt(o[5],10))},!1).value}}return t},isJson:function(e){return"string"==typeof e[0]?e:s.parse.parseJson(e)},isGuid:function(e){return null!=/[A-Fa-f0-9]{8}(?:-[A-Fa-f0-9]{4}){3}-[A-Fa-f0-9]{12}/i.exec(e)},replacer:function(e){return s.isPlainObject(e)?s.parse.jsonReplacer(e):e instanceof Array?s.parse.arrayReplacer(e):e instanceof Date?s.parse.jsonReplacer({val:e}).val:e},jsonReplacer:function(e,t){void 0===t&&(t=!0);for(var r,n=Object.keys(e),o=0,a=n;o<a.length;o++){var i=a[o];if((r=e[i])instanceof Date){var u=r,c=+u-6e4*u.getTimezoneOffset();e[i]=new Date(c-36e5*s.serverTimezoneOffset),t&&(e[i]=e[i].toJSON())}}return e},arrayReplacer:function(e){for(var t=0;t<e.length;t++)s.isPlainObject(e[t])?e[t]=s.parse.jsonReplacer(e[t]):e[t]instanceof Date&&(e[t]=s.parse.jsonReplacer({date:e[t]}).date);return e}},t.DataUtil=s}.apply(t,n))&&(e.exports=o)},function(e,t,r){var n,o;n=[r,t,r(5)],void 0!==(o=function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e){return this.subQuery=null,this.isChild=!1,this.queries=[],this.key="",this.fKey="","string"==typeof e?this.fromTable=e:e&&e instanceof Array&&(this.lookups=e),this.expands=[],this.sortedColumns=[],this.groupedColumns=[],this.subQuery=null,this.isChild=!1,this.params=[],this}return e.prototype.setKey=function(e){return this.key=e,this},e.prototype.using=function(e){return this.dataManager=e,this},e.prototype.execute=function(e,t,n,o){return e=e||this.dataManager,e?e.executeQuery(this,t,n,o):r.DataUtil.throwError('Query - execute() : dataManager needs to be is set using "using" function or should be passed as argument')},e.prototype.executeLocal=function(e){return e=e||this.dataManager,e?e.executeLocal(this):r.DataUtil.throwError('Query - executeLocal() : dataManager needs to be is set using "using" function or should be passed as argument')},e.prototype.clone=function(){var t=new e;return t.queries=this.queries.slice(0),t.key=this.key,t.isChild=this.isChild,t.dataManager=this.dataManager,t.fromTable=this.fromTable,t.params=this.params.slice(0),t.expands=this.expands.slice(0),t.sortedColumns=this.sortedColumns.slice(0),t.groupedColumns=this.groupedColumns.slice(0),t.subQuerySelector=this.subQuerySelector,t.subQuery=this.subQuery,t.fKey=this.fKey,t.requiresCounts=this.requiresCounts,t},e.prototype.from=function(e){return this.fromTable=e,this},e.prototype.addParams=function(e,t){return"function"==typeof t?this.params.push({key:e,fn:t}):this.params.push({key:e,value:t}),this},e.prototype.expand=function(e){return this.expands="string"==typeof e?[].slice.call([e],0):e.slice(0),this},e.prototype.where=function(e,t,r,n){t=t?t.toLowerCase():null;var a=null;return"string"==typeof e?a=new o(e,t,r,n):e instanceof o&&(a=e),this.queries.push({fn:"onWhere",e:a}),this},e.prototype.search=function(e,t,n,o){"string"==typeof t&&(t=[t]),n=n||"contains";var a=r.DataUtil.fnOperators[n];return this.queries.push({fn:"onSearch",e:{fieldNames:t,operator:n,searchKey:e,ignoreCase:o,comparer:a}}),this},e.prototype.sortBy=function(t,n,o){var a,s,i="ascending";if("string"==typeof t&&r.DataUtil.endsWith(t.toLowerCase()," desc")&&(t=t.replace(/ desc$/i,""),n="descending"),n&&"string"!=typeof n||(i=n?n.toLowerCase():"ascending",n=r.DataUtil.fnSort(n)),o){a=e.filterQueries(this.queries,"onSortBy");for(var u=0;u<a.length;u++)if("string"==typeof(s=a[u].e.fieldName)){if(s===t)return this}else if(s instanceof Array)for(var c=0;c<s.length;c++)if(s[c]===t||t.toLowerCase()===s[c]+" desc")return this}return this.queries.push({fn:"onSortBy",e:{fieldName:t,comparer:n,direction:i}}),this},e.prototype.sortByDesc=function(e){return this.sortBy(e,"descending")},e.prototype.group=function(e){return this.sortBy(e,null,!0),this.queries.push({fn:"onGroup",e:{fieldName:e}}),this},e.prototype.page=function(e,t){return this.queries.push({fn:"onPage",e:{pageIndex:e,pageSize:t}}),this},e.prototype.range=function(e,t){return this.queries.push({fn:"onRange",e:{start:e,end:t}}),this},e.prototype.take=function(e){return this.queries.push({fn:"onTake",e:{nos:e}}),this},e.prototype.skip=function(e){return this.queries.push({fn:"onSkip",e:{nos:e}}),this},e.prototype.select=function(e){return"string"==typeof e&&(e=[].slice.call([e],0)),this.queries.push({fn:"onSelect",e:{fieldNames:e}}),this},e.prototype.hierarchy=function(e,t){return this.subQuerySelector=t,this.subQuery=e,this},e.prototype.foreignKey=function(e){return this.fKey=e,this},e.prototype.requiresCount=function(){return this.requiresCounts=!0,this},e.prototype.aggregate=function(e,t){return this.queries.push({fn:"onAggregates",e:{field:t,type:e}}),this},e.filterQueries=function(e,t){return e.filter(function(e){return e.fn===t})},e.filterQueryLists=function(e,t){for(var r=e.filter(function(e){return-1!==t.indexOf(e.fn)}),n={},o=0;o<r.length;o++)n[r[o].fn]||(n[r[o].fn]=r[o].e);return n},e}();t.Query=n;var o=function(){function e(t,n,o,a){return void 0===a&&(a=!1),this.isComplex=!1,"string"==typeof t?(this.field=t,this.operator=n.toLowerCase(),this.value=o,this.ignoreCase=a,this.isComplex=!1,this.comparer=r.DataUtil.fnOperators.processOperator(this.operator)):(t instanceof e&&o instanceof e||o instanceof Array)&&(this.isComplex=!0,this.condition=n.toLowerCase(),this.predicates=[t],o instanceof Array?[].push.apply(this.predicates,o):this.predicates.push(o)),this}return e.and=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.combinePredicates([].slice.call(t,0),"and")},e.prototype.and=function(t,r,n,o){return e.combine(this,t,r,n,"and",o)},e.or=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.combinePredicates([].slice.call(t,0),"or")},e.prototype.or=function(t,r,n,o){return e.combine(this,t,r,n,"or",o)},e.fromJson=function(e){if(e instanceof Array){for(var t=[],r=0,n=e.length;r<n;r++)t.push(this.fromJSONData(e[r]));return t}var o=e;return this.fromJSONData(o)},e.prototype.validate=function(e){var t,n,o=this.predicates?this.predicates:[];if(!this.isComplex&&this.comparer)return this.comparer.call(this,r.DataUtil.getObject(this.field,e),this.value,this.ignoreCase);t="and"===this.condition;for(var a=0;a<o.length;a++)if(n=o[a].validate(e),t){if(!n)return!1}else if(n)return!0;return t},e.prototype.toJson=function(){var e,t;if(this.isComplex){e=[],t=this.predicates;for(var r=0;r<t.length;r++)e.push(t[r].toJson())}return{isComplex:this.isComplex,field:this.field,operator:this.operator,value:this.value,ignoreCase:this.ignoreCase,condition:this.condition,predicates:e}},e.combinePredicates=function(t,r){if(1===t.length){if(!(t[0]instanceof Array))return t[0];t=t[0]}return new e(t[0],r,t.slice(1))},e.combine=function(t,n,o,a,s,i){return n instanceof e?e[s](t,n):"string"==typeof n?e[s](t,new e(n,o,a,i)):r.DataUtil.throwError("Predicate - "+s+" : invalid arguments")},e.fromJSONData=function(t){for(var r=t.predicates||[],n=r.length,o=[],a=0;a<n;a++)o.push(this.fromJSONData(r[a]));return t.isComplex?new e(o[0],t.condition,o.slice(1)):new e(t.field,t.operator,t.value,t.ignoreCase)},e}();t.Predicate=o}.apply(t,n))&&(e.exports=o)},function(e,t,r){var n,o,a=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();n=[r,t,r(3),r(5),r(6)],void 0!==(o=function(e,t,r,n,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(t){this.options={from:"table",requestType:"json",sortBy:"sorted",select:"select",skip:"skip",group:"group",take:"take",search:"search",count:"requiresCounts",where:"where",aggregates:"aggregates"},this.type=e,this.dataSource=t,this.pvt={}}return e.prototype.processResponse=function(e,t,r,n){return e},e}();t.Adaptor=s;var i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.processQuery=function(e,t){for(var r,n,o=e.dataSource.json.slice(0),a=o.length,s=!0,i={},u=0;u<t.queries.length;u++)n=t.queries[u],r=this[n.fn].call(this,o,n.e,t),"onAggregates"===n.fn?i[n.e.field+" - "+n.e.type]=r:o=void 0!==r?r:o,"onPage"!==n.fn&&"onSkip"!==n.fn&&"onTake"!==n.fn&&"onRange"!==n.fn||(s=!1),s&&(a=o.length);return t.requiresCounts&&(o={result:o,count:a,aggregates:i}),o},t.prototype.batchRequest=function(e,t,r){var n;for(n=0;n<t.addedRecords.length;n++)this.insert(e,t.addedRecords[n]);for(n=0;n<t.changedRecords.length;n++)this.update(e,r.key,t.changedRecords[n]);for(n=0;n<t.deletedRecords.length;n++)this.remove(e,r.key,t.deletedRecords[n]);return t},t.prototype.onWhere=function(e,t){return e&&e.length?e.filter(function(e){if(t)return t.validate(e)}):e},t.prototype.onAggregates=function(e,t){var r=n.DataUtil.aggregates[t.type];return e&&r&&0!==e.length?r(e,t.field):null},t.prototype.onSearch=function(e,t){return e&&e.length?(0===t.fieldNames.length&&n.DataUtil.getFieldList(e[0],t.fieldNames),e.filter(function(e){for(var r=0;r<t.fieldNames.length;r++)if(t.comparer.call(e,n.DataUtil.getObject(t.fieldNames[r],e),t.searchKey,t.ignoreCase))return!0;return!1})):e},t.prototype.onSortBy=function(e,t,r){if(!e||!e.length)return e;var o,a=n.DataUtil.getValue(t.fieldName,r);if(!a)return e.sort(t.comparer);if(a instanceof Array){a=a.slice(0);for(var s=a.length-1;s>=0;s--)a[s]&&(o=t.comparer,n.DataUtil.endsWith(a[s]," desc")&&(o=n.DataUtil.fnSort("descending"),a[s]=a[s].replace(" desc","")),e=n.DataUtil.sort(e,a[s],o));return e}return n.DataUtil.sort(e,a,t.comparer)},t.prototype.onGroup=function(e,t,r){if(!e||!e.length)return e;var a=o.Query.filterQueries(r.queries,"onAggregates"),s=[];if(a.length)for(var i=void 0,u=0;u<a.length;u++)i=a[u].e,s.push({type:i.type,field:n.DataUtil.getValue(i.field,r)});return n.DataUtil.group(e,n.DataUtil.getValue(t.fieldName,r),s)},t.prototype.onPage=function(e,t,r){var o=n.DataUtil.getValue(t.pageSize,r),a=(n.DataUtil.getValue(t.pageIndex,r)-1)*o,s=a+o;return e&&e.length?e.slice(a,s):e},t.prototype.onRange=function(e,t){return e&&e.length?e.slice(n.DataUtil.getValue(t.start),n.DataUtil.getValue(t.end)):e},t.prototype.onTake=function(e,t){return e&&e.length?e.slice(0,n.DataUtil.getValue(t.nos)):e},t.prototype.onSkip=function(e,t){return e&&e.length?e.slice(n.DataUtil.getValue(t.nos)):e},t.prototype.onSelect=function(e,t){return e&&e.length?n.DataUtil.select(e,n.DataUtil.getValue(t.fieldNames)):e},t.prototype.insert=function(e,t){return e.dataSource.json.push(t)},t.prototype.remove=function(e,t,r,n){var o,a=e.dataSource.json;for("object"==typeof r&&(r=r[t]),o=0;o<a.length&&a[o][t]!==r;o++);return o!==a.length?a.splice(o,1):null},t.prototype.update=function(e,t,n,o){var a,s=e.dataSource.json,i=n[t];for(a=0;a<s.length&&s[a][t]!==i;a++);return a<s.length?r.merge(s[a],n):null},t}(s);t.JsonAdaptor=i;var u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.processQuery=function(e,t,r){var a,s,i=this.getQueryRequest(t),u=o.Query.filterQueryLists(t.queries,["onSelect","onPage","onSkip","onTake","onRange"]),c=t.params,l=e.dataSource.url,p=null,d=this.options,f={sorts:[],groups:[],filters:[],searches:[],aggregates:[]};"onPage"in u?(a=u.onPage,s=n.DataUtil.getValue(a.pageIndex,t),p=n.DataUtil.getValue(a.pageSize,t),s=(s-1)*p):"onRange"in u&&(a=u.onRange,s=a.start,p=a.end-a.start);for(var h=0;h<i.sorts.length;h++)a=n.DataUtil.getValue(i.sorts[h].e.fieldName,t),f.sorts.push(n.DataUtil.callAdaptorFunction(this,"onEachSort",{name:a,direction:i.sorts[h].e.direction},t));r&&(a=this.getFiltersFrom(r,t))&&f.filters.push(n.DataUtil.callAdaptorFunction(this,"onEachWhere",a.toJson(),t));for(var h=0;h<i.filters.length;h++){f.filters.push(n.DataUtil.callAdaptorFunction(this,"onEachWhere",i.filters[h].e.toJson(),t));for(var g="object"==typeof f.filters[h]?Object.keys(f.filters[h]):[],y=0,v=g;y<v.length;y++){var m=v[y];n.DataUtil.isNull(f[m])&&delete f[m]}}for(var h=0;h<i.searches.length;h++)a=i.searches[h].e,f.searches.push(n.DataUtil.callAdaptorFunction(this,"onEachSearch",{fields:a.fieldNames,operator:a.operator,key:a.searchKey,ignoreCase:a.ignoreCase},t));for(var h=0;h<i.groups.length;h++)f.groups.push(n.DataUtil.getValue(i.groups[h].e.fieldName,t));for(var h=0;h<i.aggregates.length;h++)a=i.aggregates[h].e,f.aggregates.push({type:a.type,field:n.DataUtil.getValue(a.field,t)});var b={};this.getRequestQuery(d,t,u,f,b),n.DataUtil.callAdaptorFunction(this,"addParams",{dm:e,query:t,params:c,reqParams:b});for(var S=Object.keys(b),D=0,q=S;D<q.length;D++){var m=q[D];(n.DataUtil.isNull(b[m])||""===b[m]||0===b[m].length)&&delete b[m]}d.skip in b&&d.take in b||null===p||(b[d.skip]=n.DataUtil.callAdaptorFunction(this,"onSkip",s,t),b[d.take]=n.DataUtil.callAdaptorFunction(this,"onTake",p,t));var w=this.pvt;return this.pvt={},"json"===this.options.requestType?{data:JSON.stringify(b),url:l,pvtData:w,type:"POST",contentType:"application/json; charset=utf-8"}:(a=this.convertToQueryString(b,t,e),a=(-1!==e.dataSource.url.indexOf("?")?"&":"/")+a,{type:"GET",url:a.length?l.replace(/\/*$/,a):l,pvtData:w})},t.prototype.getRequestQuery=function(e,t,r,o,a){var s=a;s[e.from]=t.fromTable,e.expand&&(s[e.expand]=t.expands),s[e.select]="onSelect"in r?n.DataUtil.callAdaptorFunction(this,"onSelect",n.DataUtil.getValue(r.onSelect.fieldNames,t),t):"",s[e.count]=t.requiresCounts?n.DataUtil.callAdaptorFunction(this,"onCount",t.requiresCounts,t):"",s[e.search]=o.searches.length?n.DataUtil.callAdaptorFunction(this,"onSearch",o.searches,t):"",s[e.skip]="onSkip"in r?n.DataUtil.callAdaptorFunction(this,"onSkip",n.DataUtil.getValue(r.onSkip.nos,t),t):"",s[e.take]="onTake"in r?n.DataUtil.callAdaptorFunction(this,"onTake",n.DataUtil.getValue(r.onTake.nos,t),t):"",s[e.where]=o.filters.length||o.searches.length?n.DataUtil.callAdaptorFunction(this,"onWhere",o.filters,t):"",s[e.sortBy]=o.sorts.length?n.DataUtil.callAdaptorFunction(this,"onSortBy",o.sorts,t):"",s[e.group]=o.groups.length?n.DataUtil.callAdaptorFunction(this,"onGroup",o.groups,t):"",s[e.aggregates]=o.aggregates.length?n.DataUtil.callAdaptorFunction(this,"onAggregates",o.aggregates,t):"",s.param=[]},t.prototype.convertToQueryString=function(e,t,r){return""},t.prototype.processResponse=function(e,t,r,o,a,s){var i=a,u=i.pvtData||{},c=e.groupDs;if(o&&o.getResponseHeader("Content-Type")&&-1!==o.getResponseHeader("Content-Type").indexOf("xml"))return r.requiresCounts?{result:[],count:0}:[];var l=JSON.parse(i.data);if(l&&"batch"===l.action&&e.addedRecords)return s.addedRecords=e.addedRecords,s;e.d&&(e=e.d);var p={};return"count"in e&&(p.count=e.count),p.result=e.result?e.result:e,this.getAggregateResult(u,e,p,c),n.DataUtil.isNull(p.count)?p.result:{result:p.result,count:p.count,aggregates:p.aggregates}},t.prototype.onGroup=function(e){this.pvt.groups=e},t.prototype.onAggregates=function(e){this.pvt.aggregates=e},t.prototype.batchRequest=function(e,t,r){return{type:"POST",url:e.dataSource.batchUrl||e.dataSource.crudUrl||e.dataSource.removeUrl||e.dataSource.url,contentType:"application/json; charset=utf-8",dataType:"json",data:JSON.stringify({changed:t.changedRecords,added:t.addedRecords,deleted:t.deletedRecords,action:"batch",table:r[void 0],key:r[void 0]})}},t.prototype.beforeSend=function(e,t){},t.prototype.insert=function(e,t,r){return{url:e.dataSource.insertUrl||e.dataSource.crudUrl||e.dataSource.url,data:JSON.stringify({value:t,table:r,action:"insert"})}},t.prototype.remove=function(e,t,r,n){return{type:"POST",url:e.dataSource.removeUrl||e.dataSource.crudUrl||e.dataSource.url,data:JSON.stringify({key:r,keyColumn:t,table:n,action:"remove"})}},t.prototype.update=function(e,t,r,n){return{type:"POST",url:e.dataSource.updateUrl||e.dataSource.crudUrl||e.dataSource.url,data:JSON.stringify({value:r,action:"update",keyColumn:t,key:r[t],table:n})}},t.prototype.getFiltersFrom=function(e,t){var r,a=t.fKey,s=a,i=t.key,u=[];"object"!=typeof e[0]&&(s=null);for(var c=0;c<e.length;c++)r="object"==typeof e[0]?n.DataUtil.getObject(i||s,e[c]):e[c],u.push(new o.Predicate(a,"equal",r));return o.Predicate.or(u)},t.prototype.getAggregateResult=function(e,t,o,a){var s=t;if(t&&t.result&&(s=t.result),e&&e.aggregates&&e.aggregates.length){var i=e.aggregates,u=void 0,c=s,l={};t.aggregate&&(c=t.aggregate);for(var p=0;p<i.length;p++)(u=n.DataUtil.aggregates[i[p].type])&&(l[i[p].field+" - "+i[p].type]=u(c,i[p].field));o.aggregates=l}if(e&&e.groups&&e.groups.length){for(var d=e.groups,p=0;p<d.length;p++){r.isNullOrUndefined(a)||(a=n.DataUtil.group(a,d[p])),s=n.DataUtil.group(s,d[p],e.aggregates,null,a)}o.result=s}return o},t.prototype.getQueryRequest=function(e){var t={sorts:[],groups:[],filters:[],searches:[],aggregates:[]};return t.sorts=o.Query.filterQueries(e.queries,"onSortBy"),t.groups=o.Query.filterQueries(e.queries,"onGroup"),t.filters=o.Query.filterQueries(e.queries,"onWhere"),t.searches=o.Query.filterQueries(e.queries,"onSearch"),t.aggregates=o.Query.filterQueries(e.queries,"onAggregates"),t},t}(s);t.UrlAdaptor=u;var c=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.options=r.extend({},t.options,{requestType:"get",accept:"application/json;odata=light;q=1,application/json;odata=verbose;q=0.5",multipartAccept:"multipart/mixed",sortBy:"$orderby",select:"$select",skip:"$skip",take:"$top",count:"$inlinecount",where:"$filter",expand:"$expand",batch:"$batch",changeSet:"--changeset_",batchPre:"batch_",contentId:"Content-Id: ",batchContent:"Content-Type: multipart/mixed; boundary=",changeSetContent:"Content-Type: application/http\nContent-Transfer-Encoding: binary ",batchChangeSetContentType:"Content-Type: application/json; charset=utf-8 "}),t}return a(t,e),t.prototype.onPredicate=function(e,r,o){var a,s,i="",u=e.value,c=typeof u,l=e.field?t.getField(e.field):null;if(u instanceof Date&&(u="datetime'"+n.DataUtil.parse.replacer(u)+"'"),"string"===c&&(u="'"+u+"'",o&&(l="cast("+l+", 'Edm.String')"),n.DataUtil.parse.isGuid(u)&&(s="guid"),e.ignoreCase&&(s||(l="tolower("+l+")"),u=u.toLowerCase())),a=n.DataUtil.odBiOperator[e.operator])return i+=l,i+=a,s&&(i+=s),i+u;if("substringof"===(a=n.DataUtil.odUniOperator[e.operator])){var p=u;u=l,l=p}return i+=a+"(",i+=l+",",s&&(i+=s),i+=u+")"},t.prototype.onComplexPredicate=function(e,t,r){for(var n=[],o=0;o<e.predicates.length;o++)n.push("("+this.onEachWhere(e.predicates[o],t,r)+")");return n.join(" "+e.condition+" ")},t.prototype.onEachWhere=function(e,t,r){return e.isComplex?this.onComplexPredicate(e,t,r):this.onPredicate(e,t,r)},t.prototype.onWhere=function(e){return this.pvt.search&&e.push(this.onEachWhere(this.pvt.search,null,!0)),e.join(" and ")},t.prototype.onEachSearch=function(e){e.fields&&0===e.fields.length&&n.DataUtil.throwError("Query() - Search : oData search requires list of field names to search");for(var t=this.pvt.search||[],r=0;r<e.fields.length;r++)t.push(new o.Predicate(e.fields[r],e.operator,e.key,e.ignoreCase));this.pvt.search=t},t.prototype.onSearch=function(e){return this.pvt.search=o.Predicate.or(this.pvt.search),""},t.prototype.onEachSort=function(e){var r=[];if(e.name instanceof Array)for(var n=0;n<e.name.length;n++)r.push(t.getField(e.name[n])+("descending"===e.direction?" desc":""));else r.push(t.getField(e.name)+("descending"===e.direction?" desc":""));return r.join(",")},t.prototype.onSortBy=function(e){return e.reverse().join(",")},t.prototype.onGroup=function(e){return this.pvt.groups=e,""},t.prototype.onSelect=function(e){for(var r=0;r<e.length;r++)e[r]=t.getField(e[r]);return e.join(",")},t.prototype.onAggregates=function(e){return this.pvt.aggregates=e,""},t.prototype.onCount=function(e){return!0===e?"allpages":""},t.prototype.beforeSend=function(e,t,r){n.DataUtil.endsWith(r.url,this.options.batch)&&"post"===r.type.toLowerCase()?(t.setRequestHeader("Accept",this.options.multipartAccept),t.setRequestHeader("DataServiceVersion","2.0"),t.overrideMimeType("text/plain; charset=x-user-defined")):t.setRequestHeader("Accept",this.options.accept),t.setRequestHeader("DataServiceVersion","2.0"),t.setRequestHeader("MaxDataServiceVersion","2.0")},t.prototype.processResponse=function(e,t,o,a,s,i){if(!r.isNullOrUndefined(e.d)){var u=o&&o.requiresCounts?e.d.results:e.d;if(!r.isNullOrUndefined(u))for(var c=0;c<u.length;c++)r.isNullOrUndefined(u[c].__metadata)||delete u[c].__metadata}var l=s&&s.pvtData,p=this.processBatchResponse(e,o,a,s,i);if(p)return p;var d=a&&s.getResponseHeader("DataServiceVersion"),f=null,h=d&&parseInt(d,10)||2;if(o&&o.requiresCounts){(e.__count||e["odata.count"])&&(f=e.__count||e["odata.count"]),e.d&&(e=e.d),(e.__count||e["odata.count"])&&(f=e.__count||e["odata.count"])}3===h&&e.value&&(e=e.value),e.d&&(e=e.d),h<3&&e.results&&(e=e.results);var g={};return g.count=f,g.result=e,this.getAggregateResult(l,e,g),n.DataUtil.isNull(f)?g.result:{result:g.result,count:g.count,aggregates:g.aggregates}},t.prototype.convertToQueryString=function(e,t,r){var n=[],o=e.table||"";delete e.table,r.dataSource.requiresFormat&&(e.$format="json");for(var a=Object.keys(e),s=0,i=a;s<i.length;s++){var u=i[s];n.push(u+"="+e[u])}return n=n.join("&"),r.dataSource.url&&-1!==r.dataSource.url.indexOf("?")&&!o?n:n.length?o+"?"+n:o||""},t.prototype.insert=function(e,t,r){return{url:e.dataSource.url.replace(/\/*$/,r?"/"+r:""),data:JSON.stringify(t)}},t.prototype.remove=function(e,t,r,n){return{type:"DELETE",url:e.dataSource.url.replace(/\/*$/,n?"/"+n:"")+"("+r+")"}},t.prototype.update=function(e,t,r,n){return{type:"PUT",url:e.dataSource.url.replace(/\/*$/,n?"/"+n:"")+"("+r[t]+")",data:JSON.stringify(r),accept:this.options.accept}},t.prototype.batchRequest=function(e,t,r){var o=r.guid=n.DataUtil.getGuid(this.options.batchPre),a=e.dataSource.url.replace(/\/*$/,"/"+this.options.batch),s={url:r.url,key:r.key,cid:1,cSet:n.DataUtil.getGuid(this.options.changeSet)},i="--"+o+"\n";return i+="Content-Type: multipart/mixed; boundary="+s.cSet.replace("--","")+"\n",this.pvt.changeSet=0,i+=this.generateInsertRequest(t.addedRecords,s),i+=this.generateUpdateRequest(t.changedRecords,s),i+=this.generateDeleteRequest(t.deletedRecords,s),i+=s.cSet+"--\n",i+="--"+o+"--",{type:"POST",url:a,dataType:"json",contentType:"multipart/mixed; charset=UTF-8;boundary="+o,data:i}},t.prototype.generateDeleteRequest=function(e,t){if(!e)return"";var r={method:"DELETE ",url:function(e,t,r){return"("+e[t][r]+")"},data:function(e,t){return""}};return this.generateBodyContent(e,t,r)+"\n"},t.prototype.generateInsertRequest=function(e,t){if(!e)return"";var r={method:"POST ",url:function(e,t,r){return""},data:function(e,t){return JSON.stringify(e[t])+"\n\n"}};return this.generateBodyContent(e,t,r)},t.prototype.generateUpdateRequest=function(e,t){if(!e)return"";var r={method:"PUT ",url:function(e,t,r){return"("+e[t][r]+")"},data:function(e,t){return JSON.stringify(e[t])+"\n\n"}};return this.generateBodyContent(e,t,r)},t.getField=function(e){return e.replace(/\./g,"/")},t.prototype.generateBodyContent=function(e,t,r){for(var n="",o=0;o<e.length;o++)n+="\n"+t.cSet+"\n",n+=this.options.changeSetContent+"\n\n",n+=r.method,n+=t.url+r.url(e,o,t.key)+" HTTP/1.1\n",n+="Accept: "+this.options.accept+"\n",n+="Content-Id: "+this.pvt.changeSet+++"\n",n+=this.options.batchChangeSetContentType+"\n\n",n+=r.data(e,o);return n},t.prototype.processBatchResponse=function(e,t,o,a,s){if(o&&o.getResponseHeader("Content-Type")&&-1!==o.getResponseHeader("Content-Type").indexOf("xml"))return t.requiresCounts?{result:[],count:0}:[];if(a&&this.options.batch&&n.DataUtil.endsWith(a.url,this.options.batch)&&"post"===a.type.toLowerCase()){var i=o.getResponseHeader("Content-Type"),u=void 0,c=void 0;if(i=i.substring(i.indexOf("=batchresponse")+1),e=e.split(i),e.length<2)return{};e=e[1];var l=/(?:\bContent-Type.+boundary=)(changesetresponse.+)/i.exec(e);l&&e.replace(l[0],"");var p=l?l[1]:"";e=e.split(p);for(var d=e.length;d>-1;d--)/\bContent-ID:/i.test(e[d])&&/\bHTTP.+201/.test(e[d])&&(u=parseInt(/\bContent-ID: (\d+)/i.exec(e[d])[1],10),s.addedRecords[u]&&(c=n.DataUtil.parse.parseJson(/^\{.+\}/m.exec(e[d])[0]),r.extend({},s.addedRecords[u],this.processResponse(c))));return s}return null},t}(u);t.ODataAdaptor=c;var l=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.options=r.extend({},t.options,{requestType:"get",accept:"application/json, text/javascript, */*; q=0.01",multipartAccept:"multipart/mixed",sortBy:"$orderby",select:"$select",skip:"$skip",take:"$top",count:"$count",search:"$search",where:"$filter",expand:"$expand",batch:"$batch",changeSet:"--changeset_",batchPre:"batch_",contentId:"Content-Id: ",batchContent:"Content-Type: multipart/mixed; boundary=",changeSetContent:"Content-Type: application/http\nContent-Transfer-Encoding: binary ",batchChangeSetContentType:"Content-Type: application/json; charset=utf-8 "}),t}return a(t,e),t.prototype.onCount=function(e){return!0===e?"true":""},t.prototype.onPredicate=function(t,r){var n="",o=t.value,a=o instanceof Date;return n=e.prototype.onPredicate.call(this,t,r),a&&(n=n.replace(/datetime'(.*)'$/,"$1")),n},t.prototype.onEachSearch=function(e){var t=this.pvt.searches||[];t.push(e.key),this.pvt.searches=t},t.prototype.onSearch=function(e){return this.pvt.searches.join(" OR ")},t.prototype.beforeSend=function(e,t,r){t.setRequestHeader("Accept",this.options.accept)},t.prototype.processResponse=function(t,r,o,a,s,i){var u=s&&s.pvtData,c=e.prototype.processBatchResponse.call(this,t,o,a,s,i);if(c)return c;var l=null;o&&o.requiresCounts&&"@odata.count"in t&&(l=t["@odata.count"]),t=t.value;var p={};return p.count=l,p.result=t,this.getAggregateResult(u,t,p),n.DataUtil.isNull(l)?p.result:{result:p.result,count:l,aggregates:p.aggregates}},t}(c);t.ODataV4Adaptor=l;var p=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.insert=function(e,t,r){return{type:"POST",url:e.dataSource.url,data:JSON.stringify(t)}},t.prototype.remove=function(e,t,r,n){return{type:"DELETE",url:e.dataSource.url+"/"+r,data:JSON.stringify(r)}},t.prototype.update=function(e,t,r,n){return{type:"PUT",url:e.dataSource.url,data:JSON.stringify(r)}},t.prototype.beforeSend=function(e,t,r){t.setRequestHeader("Accept","application/json, text/javascript, */*; q=0.01")},t.prototype.processResponse=function(e,t,r,o,a,s){var i=a&&a.pvtData,u=null,c={};if(a&&"post"!==a.type.toLowerCase()){var l=o&&a.getResponseHeader("DataServiceVersion"),p=l&&parseInt(l,10)||2;r&&r.requiresCounts&&(n.DataUtil.isNull(e.Count)||(u=e.Count)),p<3&&e.Items&&(e=e.Items),c.count=u,c.result=e,this.getAggregateResult(i,e,c)}return c.result=c.result||e,n.DataUtil.isNull(u)?c.result:{result:c.result,count:c.count,aggregates:c.aggregates}},t}(c);t.WebApiAdaptor=p;var d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.processQuery=function(e,t,r){var o=(new u).processQuery(e,t,r),a=n.DataUtil.parse.parseJson(o.data),s={};if(a.param)for(var i=0;i<a.param.length;i++){var c=a.param[i],l=Object.keys(c)[0];s[l]=c[l]}s.value=a;return{data:JSON.stringify(s),url:o.url,pvtData:o.pvtData,type:"POST",contentType:"application/json; charset=utf-8"}},t}(u);t.WebMethodAdaptor=d;var f=function(e){function t(){var t=e.call(this)||this;return r.setValue("beforeSend",u.prototype.beforeSend,t),r.setValue("insert",u.prototype.insert,t),r.setValue("update",u.prototype.update,t),r.setValue("remove",u.prototype.remove,t),t}return a(t,e),t.prototype.batchRequest=function(e,t,r){var n;for(n=0;n<t.addedRecords.length;n++)i.prototype.insert(e,t.addedRecords[n]);for(n=0;n<t.changedRecords.length;n++)i.prototype.update(e,r.key,t.changedRecords[n]);for(n=0;n<t.deletedRecords.length;n++)i.prototype.remove(e,r.key,t.deletedRecords[n]);return{type:"POST",url:e.dataSource.batchUrl||e.dataSource.crudUrl||e.dataSource.url,contentType:"application/json; charset=utf-8",dataType:"json",data:JSON.stringify({changed:t.changedRecords,added:t.addedRecords,deleted:t.deletedRecords,action:"batch",table:r.url,key:r.key})}},t}(i);t.RemoteSaveAdaptor=f;var h=function(e){function t(t,o,a){var s=e.call(this)||this;s.isCrudAction=!1,s.isInsertAction=!1,r.isNullOrUndefined(t)||(s.cacheAdaptor=t),s.pageSize=a,s.guidId=n.DataUtil.getGuid("cacheAdaptor");var i={keys:[],results:[]};window.localStorage.setItem(s.guidId,JSON.stringify(i));var u=s.guidId;return r.isNullOrUndefined(o)||setInterval(function(){var e;e=n.DataUtil.parse.parseJson(window.localStorage.getItem(u));for(var t=[],r=0;r<e.results.length;r++){var a=+new Date,s=+new Date(e.results[r].timeStamp);e.results[r].timeStamp=a-s,a-s>o&&t.push(r)}for(var r=0;r<t.length;r++)e.results.splice(t[r],1),e.keys.splice(t[r],1);window.localStorage.removeItem(u),window.localStorage.setItem(u,JSON.stringify(e))},o),s}return a(t,e),t.prototype.generateKey=function(e,t){var r=this.getQueryRequest(t),n=o.Query.filterQueryLists(t.queries,["onSelect","onPage","onSkip","onTake","onRange"]),a=e;"onPage"in n&&(a+=n.onPage.pageIndex),r.sorts.forEach(function(e){a+=e.e.direction+e.e.fieldName}),r.groups.forEach(function(e){a+=e.e.fieldName}),r.searches.forEach(function(e){a+=e.e.searchKey});for(var s=0;s<r.filters.length;s++){var i=r.filters[s];if(i.e.isComplex){var u=t.clone();u.queries=[];for(var c=0;c<i.e.predicates.length;c++)u.queries.push({fn:"onWhere",e:i.e.predicates[c],filter:t.queries.filter});a+=i.e.condition+this.generateKey(e,u)}else a+=i.e.field+i.e.operator+i.e.value}return a},t.prototype.processQuery=function(e,t,r){var o,a=this.generateKey(e.dataSource.url,t);o=n.DataUtil.parse.parseJson(window.localStorage.getItem(this.guidId));var s=o?o.results[o.keys.indexOf(a)]:null;return null==s||this.isCrudAction||this.isInsertAction?(this.isCrudAction=null,this.isInsertAction=null,this.cacheAdaptor.processQuery.apply(this.cacheAdaptor,[].slice.call(arguments,0))):s},t.prototype.processResponse=function(e,t,r,o,a,s){if(this.isInsertAction||a&&this.cacheAdaptor.options.batch&&n.DataUtil.endsWith(a.url,this.cacheAdaptor.options.batch)&&"post"===a.type.toLowerCase())return this.cacheAdaptor.processResponse(e,t,r,o,a,s);e=this.cacheAdaptor.processResponse.apply(this.cacheAdaptor,[].slice.call(arguments,0));var i=r?this.generateKey(t.dataSource.url,r):t.dataSource.url,u={};u=n.DataUtil.parse.parseJson(window.localStorage.getItem(this.guidId));var c=u.keys.indexOf(i);for(-1!==c&&(u.results.splice(c,1),u.keys.splice(c,1)),u.results[u.keys.push(i)-1]={keys:i,result:e.result,timeStamp:new Date,count:e.count};u.results.length>this.pageSize;)u.results.splice(0,1),u.keys.splice(0,1);return window.localStorage.setItem(this.guidId,JSON.stringify(u)),e},t.prototype.beforeSend=function(e,t,r){n.DataUtil.endsWith(r.url,this.cacheAdaptor.options.batch)&&"post"===r.type.toLowerCase()&&t.setRequestHeader("Accept",this.cacheAdaptor.options.multipartAccept),e.dataSource.crossDomain||t.setRequestHeader("Accept",this.cacheAdaptor.options.accept)},t.prototype.update=function(e,t,r,n){return this.isCrudAction=!0,this.cacheAdaptor.update(e,t,r,n)},t.prototype.insert=function(e,t,r){return this.isInsertAction=!0,this.cacheAdaptor.insert(e,t,r)},t.prototype.remove=function(e,t,r,n){return this.isCrudAction=!0,this.cacheAdaptor.remove(e,t,r,n)},t.prototype.batchRequest=function(e,t,r){return this.cacheAdaptor.batchRequest(e,t,r)},t}(u);t.CacheAdaptor=h}.apply(t,n))&&(e.exports=o)}])}); | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@syncfusion/ej2-base"));else if("function"==typeof define&&define.amd)define(["@syncfusion/ej2-base"],t);else{var r=t("object"==typeof exports?require("@syncfusion/ej2-base"):e["@syncfusion/ej2-base"]);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(this,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){var n,o;n=[r,t,r(1),r(6),r(7),r(5)],void 0!==(o=function(e,t,r,n,o,a){"use strict";function s(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),s(r),s(n),s(o),s(a)}.apply(t,n))&&(e.exports=o)},function(e,t,r){var n,o;n=[r,t,r(2),r(3),r(5),r(6),r(7)],void 0!==(o=function(e,t,r,n,o,a,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t,r){var i=this;this.dateParse=!0,this.requests=[],e||this.dataSource||(e=[]),r=r||e.adaptor;var u;return e instanceof Array?u={json:e,offline:!0}:"object"==typeof e?(e.json||(e.json=[]),u={url:e.url,insertUrl:e.insertUrl,removeUrl:e.removeUrl,updateUrl:e.updateUrl,crudUrl:e.crudUrl,batchUrl:e.batchUrl,json:e.json,headers:e.headers,accept:e.accept,data:e.data,timeTillExpiration:e.timeTillExpiration,cachingPageSize:e.cachingPageSize,enableCaching:e.enableCaching,requestType:e.requestType,key:e.key,crossDomain:e.crossDomain,jsonp:e.jsonp,dataType:e.dataType,offline:void 0!==e.offline?e.offline:!(e.adaptor instanceof s.RemoteSaveAdaptor)&&!e.url,requiresFormat:e.requiresFormat}):o.DataUtil.throwError("DataManager: Invalid arguments"),void 0!==u.requiresFormat||o.DataUtil.isCors()||(u.requiresFormat=!!n.isNullOrUndefined(u.crossDomain)||u.crossDomain),void 0===u.dataType&&(u.dataType="json"),this.dataSource=u,this.defaultQuery=t,u.url&&u.offline&&!u.json.length?(this.isDataAvailable=!1,this.adaptor=r||new s.ODataAdaptor,this.dataSource.offline=!1,this.ready=this.executeQuery(t||new a.Query),this.ready.then(function(e){i.dataSource.offline=!0,i.isDataAvailable=!0,u.json=e.result,i.adaptor=new s.JsonAdaptor})):this.adaptor=u.offline?new s.JsonAdaptor:new s.ODataAdaptor,!u.jsonp&&this.adaptor instanceof s.ODataAdaptor&&(u.jsonp="callback"),this.adaptor=r||this.adaptor,u.enableCaching&&(this.adaptor=new s.CacheAdaptor(this.adaptor,u.timeTillExpiration,u.cachingPageSize)),this}return e.prototype.setDefaultQuery=function(e){return this.defaultQuery=e,this},e.prototype.executeLocal=function(t){this.defaultQuery||t instanceof a.Query||o.DataUtil.throwError("DataManager - executeLocal() : A query is required to execute"),this.dataSource.json||o.DataUtil.throwError("DataManager - executeLocal() : Json data is required to execute"),t=t||this.defaultQuery;var r=this.adaptor.processQuery(this,t);if(t.subQuery){var s=t.subQuery.fromTable,i=t.subQuery.lookups,u=t.requiresCounts?r.result:r;i&&i instanceof Array&&o.DataUtil.buildHierarchy(t.subQuery.fKey,s,u,i,t.subQuery.key);for(var c=0;c<u.length;c++)u[c][s]instanceof Array&&(u[c]=n.extend({},{},u[c]),u[c][s]=this.adaptor.processResponse(t.subQuery.using(new e(u[c][s].slice(0))).executeLocal(),this,t))}return this.adaptor.processResponse(r,this,t)},e.prototype.executeQuery=function(t,r,n,s){var i=this;"function"==typeof t&&(n,n=r,r=t,t=null),t||(t=this.defaultQuery),t instanceof a.Query||o.DataUtil.throwError("DataManager - executeQuery() : A query is required to execute");var c=new u,l={query:t};if(this.dataSource.offline||void 0===this.dataSource.url)e.nextTick(function(){var r=i.executeLocal(t);l=e.getDeferedArgs(t,r,l),c.resolve(l)});else{var p=this.adaptor.processQuery(this,t);this.makeRequest(p,c,l,t)}return c.promise},e.getDeferedArgs=function(e,t,r){return e.requiresCounts?(r.result=t.result,r.count=t.count,r.aggregates=t.aggregates):r.result=t,r},e.nextTick=function(e){(window.setImmediate||window.setTimeout)(e,0)},e.prototype.extendRequest=function(e,t,r){return n.extend({},{type:"GET",dataType:this.dataSource.dataType,crossDomain:this.dataSource.crossDomain,jsonp:this.dataSource.jsonp,cache:!0,processData:!1,onSuccess:t,onFailure:r},e)},e.prototype.makeRequest=function(e,t,n,a){var s=this,i=!!a.subQuerySelector,c=function(e){n.error=e,t.reject(n)},l=function(e,r,o,a,s,i,u){n.xhr=o,n.count=r?parseInt(r.toString(),10):0,n.result=e,n.request=a,n.aggregates=i,n.actual=s,n.virtualSelectRecords=u,t.resolve(n)},p=function(e,t){var r=new u,p={parent:n};a.subQuery.isChild=!0;var d=s.adaptor.processQuery(s,a.subQuery,e?s.adaptor.processResponse(e):t),f=s.makeRequest(d,r,p,a.subQuery);return i||r.then(function(t){e&&(o.DataUtil.buildHierarchy(a.subQuery.fKey,a.subQuery.fromTable,e,t,a.subQuery.key),l(e,t.count,t.xhr))},c),f},d=function(e,t){-1===t.httpRequest.getResponseHeader("Content-Type").indexOf("xml")&&s.dateParse&&(e=o.DataUtil.parse.parseJson(e));var r=s.adaptor.processResponse(e,s,a,t.httpRequest,t),n=0,u=null,c=e.virtualSelectRecords;if(a.requiresCounts&&(n=r.count,u=r.aggregates,r=r.result),!a.subQuery)return void l(r,n,t.httpRequest,t.type,e,u,c);i||p(r,t)},f=this.extendRequest(e,d,c),h=new r.Ajax(f);if(h.beforeSend=function(){s.beforeSend(h.httpRequest,h)},f=h.send(),this.requests.push(h),i){var g=void 0,y=a.subQuerySelector.call(this,{query:a.subQuery,parent:a});y&&y.length?(g=Promise.all([f,p(null,y)]),g.then(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e[0],n=s.adaptor.processResponse(r[0],s,a,s.requests[0].httpRequest,s.requests[0]),u=0;a.requiresCounts&&(u=n.count,n=n.result);var c=s.adaptor.processResponse(r[1],s,a.subQuery,s.requests[1].httpRequest,s.requests[1]);u=0,a.subQuery.requiresCounts&&(u=c.count,c=c.result),o.DataUtil.buildHierarchy(a.subQuery.fKey,a.subQuery.fromTable,n,c,a.subQuery.key),i=!1,l(n,u,s.requests[0].httpRequest)})):i=!1}return f},e.prototype.beforeSend=function(e,t){this.adaptor.beforeSend(this,e,t);for(var r,n=this.dataSource.headers,o=0;n&&o<n.length;o++){r=[];for(var a=Object.keys(n[o]),s=0,i=a;s<i.length;s++){var u=i[s];r.push(u),e.setRequestHeader(u,n[o][u])}}},e.prototype.saveChanges=function(e,t,n,o){var s=this;n instanceof a.Query&&(o=n,n=null);var i={url:n,key:t||this.dataSource.key},c=this.adaptor.batchRequest(this,e,i,o);if(this.dataSource.offline)return c;var l=new u,p=new r.Ajax(c);return p.beforeSend=function(){s.beforeSend(p.httpRequest,p)},p.onSuccess=function(t,r){l.resolve(s,[s.adaptor.processResponse(t,s,null,r.httpRequest,r,e)])},p.onFailure=function(e){l.reject([{error:e}])},p.send(),l.promise},e.prototype.insert=function(e,t,r){e=o.DataUtil.parse.replacer(e),t instanceof a.Query&&(r=t,t=null);var n=this.adaptor.insert(this,e,t,r);return this.dataSource.offline?n:this.doAjaxRequest(n)},e.prototype.remove=function(e,t,r,n){"object"==typeof t&&(t=t[e]),r instanceof a.Query&&(n=r,r=null);var o=this.adaptor.remove(this,e,t,r,n);return this.dataSource.offline?o:this.doAjaxRequest(o)},e.prototype.update=function(e,t,r,n){t=o.DataUtil.parse.replacer(t),r instanceof a.Query&&(n=r,r=null);var s=this.adaptor.update(this,e,t,r,n);return this.dataSource.offline?s:this.doAjaxRequest(s)},e.prototype.doAjaxRequest=function(e){var t=this,a=new u;e=n.extend({},{type:"POST",contentType:"application/json; charset=utf-8",processData:!1},e);var s=new r.Ajax(e);return s.beforeSend=function(){t.beforeSend(s.httpRequest,s)},s.onSuccess=function(e,r){try{o.DataUtil.parse.parseJson(e)}catch(t){e=[]}e=t.adaptor.processResponse(o.DataUtil.parse.parseJson(e),t,null,r.httpRequest,r),a.resolve(t,[{record:e,dataManager:t}])},s.onFailure=function(e){a.reject([{error:e}])},s.send(),a.promise},e}();t.DataManager=i;var u=function(){function e(){var e=this;this.promise=new Promise(function(t,r){e.resolve=t,e.reject=r}),this.then=this.promise.then.bind(this.promise),this.catch=this.promise.catch.bind(this.promise)}return e}();t.Deferred=u}.apply(t,n))&&(e.exports=o)},function(t,r){t.exports=e},function(e,t,r){var n,o;n=[r,t,r(4)],void 0!==(o=function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}(r)}.apply(t,n))&&(e.exports=o)},function(e,t,r){var n,o;n=[r,t],void 0!==(o=function(e,t){"use strict";function r(e,t){var r=t;return r.unshift(void 0),new(Function.prototype.bind.apply(e,r))}function n(e){var t,r=new Uint16Array(5);(window.msCrypto||window.crypto).getRandomValues(r);var n="ej2"+w(r),o=function(r){r.source===window&&"string"==typeof r.data&&r.data.length<=32&&r.data===n&&(e(),t())};return window.addEventListener("message",o,!1),window.postMessage(n,"*"),t=function(){window.removeEventListener("message",o)}}function o(e,t){for(var r=t,n=e.split("."),o=0;o<n.length&&!d(r);o++)r=r[n[o]];return r}function a(e,t,r){var n,o,a=e.split("."),s=r||{},i=s,u=a.length;for(n=0;n<u;n++)o=a[n],n+1===u?i[o]=void 0===t?{}:t:p(i[o])&&(i[o]={}),i=i[o];return s}function s(e,t){delete e[t]}function i(e){var t={};return!p(e)&&e.constructor===t.constructor}function u(e,t){return e[t]}function c(e,t){if(!p(t))for(var r=e,n=t,o=Object.keys(t),a=0,s=o;a<s.length;a++){var i=s[a];r[i]=n[i]}}function l(e,t,r,n){var o=e||{},a=arguments.length;n&&(a-=1);for(var s=arguments,u=1;u<a;u++)!function(e){if(!s[e])return"continue";var t=s[e];Object.keys(t).forEach(function(e){var r,a=o[e],s=t[e];n&&i(s)?(r=i(a)?a:{},o[e]=l({},r,s,!0)):o[e]=s})}(u);return o}function p(e){return void 0===e||null===e}function d(e){return void 0===e}function f(e){return e+"_"+U++}function h(e,t){var r,n=this;return function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];var s=o[0],i=function(){return r=null,e.call(n,s)};clearTimeout(r),r=setTimeout(i,t)}}function g(e){for(var t=[],r=Object.keys(e),n=0,o=r;n<o.length;n++){var a=o[n];t.push(encodeURIComponent(a)+"="+encodeURIComponent(""+e[a]))}return t.join("&")}function y(e){var t=Object.prototype.toString;return"[object Array]"===t.call(e)&&"[object Object]"===t.call(e[0])}function v(e,t){var r=e;return r===t||!(r===document||!r)&&v(r.parentNode,t)}function m(e){try{throw new Error(e)}catch(e){throw e.message+"\n"+e.stack}}function b(e,t){var r=document.createElement("div"),n=[].slice.call(document.getElementsByTagName("head")[0].querySelectorAll("link, style")),o="";p(t)&&(t=window.open("","print","height=452,width=1024,tabbar=no")),r.appendChild(e.cloneNode(!0));for(var a=0,s=n.length;a<s;a++)o+=n[a].outerHTML;t.document.write("<!DOCTYPE html> <html><head>"+o+"</head><body>"+r.innerHTML+"<script> (function() { window.ready = true; })(); <\/script></body></html>"),t.document.close(),t.focus();var i=setInterval(function(){t.ready&&(t.print(),t.close(),clearInterval(i))},500);return t}function S(e){var t=e+"";return"auto"===t||-1!==t.indexOf("%")||-1!==t.indexOf("px")?t:t+"px"}function D(e,t){var r="string"==typeof e?document.querySelector(e):e;if(r[C])for(var n=0,o=r[C];n<o.length;n++){var a=o[n];if(a instanceof t)return a}return null}function q(e,t){var r="string"==typeof e?document.querySelector(e):e;r[C]?r[C].push(t):r[C]=[t]}function w(e){for(var t="",r=0;r<5;r++)t+=(r?",":"")+e[r];return t}Object.defineProperty(t,"__esModule",{value:!0});var C="ej2_instances",U=0;t.createInstance=r,t.setImmediate=n,t.getValue=o,t.setValue=a,t.deleteObject=s,t.isObject=i,t.getEnumValue=u,t.merge=c,t.extend=l,t.isNullOrUndefined=p,t.isUndefined=d,t.getUniqueID=f,t.debounce=h,t.queryParams=g,t.isObjectArray=y,t.compareElementParent=v,t.throwError=m,t.print=b,t.formatUnit=S,t.getInstance=D,t.addInstance=q}.apply(t,n))&&(e.exports=o)},function(e,t,r){var n,o;n=[r,t,r(3),r(1),r(6)],void 0!==(o=function(e,t,r,n,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a={GroupGuid:"{271bbba0-1ee7}"},s=function(){function e(){}return e.getValue=function(e,t){return"function"==typeof e?e.call(t||{}):e},e.endsWith=function(e,t){return e.slice(-t.length)===t},e.startsWith=function(e,t){return e.slice(0,t.length)===t},e.fnSort=function(e){return e=e?e.toLowerCase():"ascending","ascending"===e?this.fnAscending:this.fnDescending},e.fnAscending=function(e,t){return null===t||void 0===t?-1:"string"==typeof e?e.localeCompare(t):null===e||void 0===e?1:e-t},e.fnDescending=function(e,t){return null===t||void 0===t?1:"string"==typeof e?-1*e.localeCompare(t):null===e||void 0===e?-1:t-e},e.extractFields=function(e,t){var r={};if(1===t.length)return this.getObject(t[0],e);for(var n=0;n<t.length;n++)r[t[n].replace(".","_")]=this.getObject(t[n],e);return r},e.select=function(e,t){for(var r=[],n=0;n<e.length;n++)r.push(this.extractFields(e[n],t));return r},e.group=function(t,n,o,s,i){s=s||1;var u=t;if(u.GroupGuid===a.GroupGuid){for(var c=this,l=0;l<u.length;l++)!function(e){if(r.isNullOrUndefined(i))u[e].items=c.group(u[e].items,n,o,u.level+1),u[e].count=u[e].items.length;else{var t=-1,a=i.filter(function(t){return t.key===u[e].key});t=i.indexOf(a[0]),u[e].items=c.group(u[e].items,n,o,u.level+1,i[t].items),u[e].count=i[t].count}}(l);return u.childLevels+=1,u}var p={},d=[];d.GroupGuid=a.GroupGuid,d.level=s,d.childLevels=0,d.records=u;for(var f=this,h=0;h<u.length;h++)!function(e){var t=f.getVal(u,e,n);if(!p[t]&&(p[t]={key:t,count:0,items:[],aggregates:{},field:n},d.push(p[t]),!r.isNullOrUndefined(i))){var o=i.filter(function(e){return e.key===p[t].key});p[t].count=o[0].count}p[t].count=r.isNullOrUndefined(i)?p[t].count+=1:p[t].count,p[t].items.push(u[e])}(h);if(o&&o.length)for(var h=0;h<d.length;h++)!function(t){for(var n={},a=void 0,s=o,u=0;u<o.length;u++)if(a=e.aggregates[o[u].type],r.isNullOrUndefined(i))a&&(n[s[u].field+" - "+s[u].type]=a(d[t].items,s[u].field));else{var c=i.filter(function(e){return e.key===d[t].key});a&&(n[s[u].field+" - "+s[u].type]=a(c[0].items,s[u].field))}d[t].aggregates=n}(h);return d},e.buildHierarchy=function(e,t,r,n,o){var a,s,i={};for(n.result&&(n=n.result),n.GroupGuid&&this.throwError("DataManager: Do not have support Grouping in hierarchy"),a=0;a<n.length;a++){var u=this.getObject(e,n[a]);s=i[u]||(i[u]=[]),s.push(n[a])}for(a=0;a<r.length;a++){var u=this.getObject(o||e,r[a]);r[a][t]=i[u]}},e.getFieldList=function(e,t,r){if(void 0===r&&(r=""),void 0===t||null===t)return this.getFieldList(e,[],r);for(var n=e,o=Object.keys(e),a=0,s=o;a<s.length;a++){var i=s[a];"object"!=typeof n[i]||n[i]instanceof Array?t.push(r+i):this.getFieldList(n[i],t,r+i+".")}return t},e.getObject=function(e,t){if(!e)return t;if(-1===e.indexOf("."))return t[e];for(var r=t,n=e.split("."),o=0;o<n.length&&null!=r;o++)r=r[n[o]];return r},e.sort=function(e,t,r){if(e.length<=1)return e;var n=parseInt((e.length/2).toString(),10),o=e.slice(0,n),a=e.slice(n);return o=this.sort(o,t,r),a=this.sort(a,t,r),this.merge(o,a,t,r)},e.merge=function(e,t,r,n){for(var o,a=[];e.length>0||t.length>0;)o=e.length>0&&t.length>0?n?n(this.getVal(e,0,r),this.getVal(t,0,r))<=0?e:t:e[0][r]<e[0][r]?e:t:e.length>0?e:t,a.push(o.shift());return a},e.getVal=function(e,t,r){return r?this.getObject(r,e[t]):e[t]},e.toLowerCase=function(e){return e?"string"==typeof e?e.toLowerCase():e.toString():0===e||!1===e?e.toString():""},e.callAdaptorFunction=function(e,t,r,n){if(t in e){var o=e[t](r,n);this.fnOperators.isnull(o)||(r=o)}return r},e.isPlainObject=function(e){return!!e&&e.constructor===Object},e.isCors=function(){var e=null;try{e=new window.XMLHttpRequest}catch(e){}return!!e&&"withCredentials"in e},e.getGuid=function(e){var t;return(e||"")+"00000000-0000-4000-0000-000000000000".replace(/0/g,function(e,r){if("crypto"in window&&"getRandomValues"in crypto){var n=new Uint8Array(1);window.crypto.getRandomValues(n),t=n[0]%16|0}else t=16*Math.random()|0;return"0123456789abcdef"[19===r?3&t|8:t]})},e.isNull=function(e){return void 0===e||null===e},e.getItemFromComparer=function(t,n,o){var a,s,i,u=0,c="string"==typeof e.getVal(t,0,n);if(t.length)for(;r.isNullOrUndefined(a)&&u<t.length;)a=e.getVal(t,u,n),i=t[u++];for(;u<t.length;u++)s=e.getVal(t,u,n),r.isNullOrUndefined(s)||(c&&(a=+a,s=+s),o(a,s)>0&&(a=s,i=t[u]));return i},e}();s.serverTimezoneOffset=0,s.throwError=function(e){try{throw new Error(e)}catch(e){throw e.message+"\n"+e.stack}},s.aggregates={sum:function(e,t){for(var r,n=0,o="number"!=typeof s.getVal(e,0,t),a=0;a<e.length;a++)r=s.getVal(e,a,t),isNaN(r)||null===r||(o&&(r=+r),n+=r);return n},average:function(e,t){return s.aggregates.sum(e,t)/e.length},min:function(e,t){var r;return"function"==typeof t&&(r=t,t=null),s.getObject(t,s.getItemFromComparer(e,t,r||s.fnAscending))},max:function(e,t){var r;return"function"==typeof t&&(r=t,t=null),s.getObject(t,s.getItemFromComparer(e,t,r||s.fnDescending))},truecount:function(e,t){return new n.DataManager(e).executeLocal((new o.Query).where(t,"equal",!0,!0)).length},falsecount:function(e,t){return new n.DataManager(e).executeLocal((new o.Query).where(t,"equal",!1,!0)).length},count:function(e,t){return e.length}},s.operatorSymbols={"<":"lessthan",">":"greaterthan","<=":"lessthanorequal",">=":"greaterthanorequal","==":"equal","!=":"notequal","*=":"contains","$=":"endswith","^=":"startswith"},s.odBiOperator={"<":" lt ",">":" gt ","<=":" le ",">=":" ge ","==":" eq ","!=":" ne ",lessthan:" lt ",lessthanorequal:" le ",greaterthan:" gt ",greaterthanorequal:" ge ",equal:" eq ",notequal:" ne "},s.odUniOperator={"$=":"endswith","^=":"startswith","*=":"substringof",endswith:"endswith",startswith:"startswith",contains:"substringof"},s.fnOperators={equal:function(e,t,r){return r?s.toLowerCase(e)===s.toLowerCase(t):e===t},notequal:function(e,t,r){return!s.fnOperators.equal(e,t,r)},lessthan:function(e,t,r){return r?s.toLowerCase(e)<s.toLowerCase(t):e<t},greaterthan:function(e,t,r){return r?s.toLowerCase(e)>s.toLowerCase(t):e>t},lessthanorequal:function(e,t,r){return r?s.toLowerCase(e)<=s.toLowerCase(t):e<=t},greaterthanorequal:function(e,t,r){return r?s.toLowerCase(e)>=s.toLowerCase(t):e>=t},contains:function(e,t,n){return n?!r.isNullOrUndefined(e)&&!r.isNullOrUndefined(t)&&-1!==s.toLowerCase(e).indexOf(s.toLowerCase(t)):!r.isNullOrUndefined(e)&&!r.isNullOrUndefined(t)&&-1!==e.toString().indexOf(t)},notnull:function(e){return null!==e},isnull:function(e){return null===e},startswith:function(e,t,r){return r?e&&t&&s.startsWith(e.toLowerCase(),t.toLowerCase()):e&&t&&s.startsWith(e,t)},endswith:function(e,t,r){return r?e&&t&&s.endsWith(e.toLowerCase(),t.toLowerCase()):e&&t&&s.endsWith(e,t)},processSymbols:function(e){var t=s.operatorSymbols[e];if(t){return s.fnOperators[t]}return s.throwError("Query - Process Operator : Invalid operator")},processOperator:function(e){var t=s.fnOperators[e];return t||s.fnOperators.processSymbols(e)}},s.parse={parseJson:function(e){return"string"==typeof e?e=JSON.parse(e,s.parse.jsonReviver):e instanceof Array?s.parse.iterateAndReviveArray(e):"object"==typeof e&&s.parse.iterateAndReviveJson(e),e},iterateAndReviveArray:function(e){for(var t=0;t<e.length;t++)"object"==typeof e[t]?s.parse.iterateAndReviveJson(e[t]):"string"!=typeof e[t]||/^[\s]*\[|^[\s]*\{|\"/g.test(e[t])?e[t]=s.parse.parseJson(e[t]):e[t]=s.parse.jsonReviver("",e[t])},iterateAndReviveJson:function(e){for(var t,r=Object.keys(e),n=0,o=r;n<o.length;n++){var a=o[n];s.startsWith(a,"__")||(t=e[a],"object"==typeof t?t instanceof Array?s.parse.iterateAndReviveArray(t):t&&s.parse.iterateAndReviveJson(t):e[a]=s.parse.jsonReviver(e[a],t))}},jsonReviver:function(e,t){var r=t;if("string"==typeof t){var n=/^\/Date\(([+-]?[0-9]+)([+-][0-9]{4})?\)\/$/.exec(t);if(n)return s.parse.jsonReplacer({value:new Date(parseInt(n[1],10))},!1).value;if(/^(\d{4}\-\d\d\-\d\d([tT][\d:\.]*){1})([zZ]|([+\-])(\d\d):?(\d\d))?$/.test(t)){var o=r.split(/[^0-9]/);t=s.parse.jsonReplacer({value:new Date(parseInt(o[0],10),parseInt(o[1],10)-1,parseInt(o[2],10),parseInt(o[3],10),parseInt(o[4],10),parseInt(o[5],10))},!1).value}}return t},isJson:function(e){return"string"==typeof e[0]?e:s.parse.parseJson(e)},isGuid:function(e){return null!=/[A-Fa-f0-9]{8}(?:-[A-Fa-f0-9]{4}){3}-[A-Fa-f0-9]{12}/i.exec(e)},replacer:function(e){return s.isPlainObject(e)?s.parse.jsonReplacer(e):e instanceof Array?s.parse.arrayReplacer(e):e instanceof Date?s.parse.jsonReplacer({val:e}).val:e},jsonReplacer:function(e,t){void 0===t&&(t=!0);for(var r,n=Object.keys(e),o=0,a=n;o<a.length;o++){var i=a[o];if((r=e[i])instanceof Date){var u=r,c=+u-6e4*u.getTimezoneOffset();e[i]=new Date(c-36e5*s.serverTimezoneOffset),t&&(e[i]=e[i].toJSON())}}return e},arrayReplacer:function(e){for(var t=0;t<e.length;t++)s.isPlainObject(e[t])?e[t]=s.parse.jsonReplacer(e[t]):e[t]instanceof Date&&(e[t]=s.parse.jsonReplacer({date:e[t]}).date);return e}},t.DataUtil=s}.apply(t,n))&&(e.exports=o)},function(e,t,r){var n,o;n=[r,t,r(5)],void 0!==(o=function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e){return this.subQuery=null,this.isChild=!1,this.queries=[],this.key="",this.fKey="","string"==typeof e?this.fromTable=e:e&&e instanceof Array&&(this.lookups=e),this.expands=[],this.sortedColumns=[],this.groupedColumns=[],this.subQuery=null,this.isChild=!1,this.params=[],this}return e.prototype.setKey=function(e){return this.key=e,this},e.prototype.using=function(e){return this.dataManager=e,this},e.prototype.execute=function(e,t,n,o){return e=e||this.dataManager,e?e.executeQuery(this,t,n,o):r.DataUtil.throwError('Query - execute() : dataManager needs to be is set using "using" function or should be passed as argument')},e.prototype.executeLocal=function(e){return e=e||this.dataManager,e?e.executeLocal(this):r.DataUtil.throwError('Query - executeLocal() : dataManager needs to be is set using "using" function or should be passed as argument')},e.prototype.clone=function(){var t=new e;return t.queries=this.queries.slice(0),t.key=this.key,t.isChild=this.isChild,t.dataManager=this.dataManager,t.fromTable=this.fromTable,t.params=this.params.slice(0),t.expands=this.expands.slice(0),t.sortedColumns=this.sortedColumns.slice(0),t.groupedColumns=this.groupedColumns.slice(0),t.subQuerySelector=this.subQuerySelector,t.subQuery=this.subQuery,t.fKey=this.fKey,t.requiresCounts=this.requiresCounts,t},e.prototype.from=function(e){return this.fromTable=e,this},e.prototype.addParams=function(e,t){return"function"==typeof t?this.params.push({key:e,fn:t}):this.params.push({key:e,value:t}),this},e.prototype.expand=function(e){return this.expands="string"==typeof e?[].slice.call([e],0):e.slice(0),this},e.prototype.where=function(e,t,r,n){t=t?t.toLowerCase():null;var a=null;return"string"==typeof e?a=new o(e,t,r,n):e instanceof o&&(a=e),this.queries.push({fn:"onWhere",e:a}),this},e.prototype.search=function(e,t,n,o){"string"==typeof t&&(t=[t]),n=n||"contains";var a=r.DataUtil.fnOperators[n];return this.queries.push({fn:"onSearch",e:{fieldNames:t,operator:n,searchKey:e,ignoreCase:o,comparer:a}}),this},e.prototype.sortBy=function(t,n,o){var a,s,i="ascending";if("string"==typeof t&&r.DataUtil.endsWith(t.toLowerCase()," desc")&&(t=t.replace(/ desc$/i,""),n="descending"),n&&"string"!=typeof n||(i=n?n.toLowerCase():"ascending",n=r.DataUtil.fnSort(n)),o){a=e.filterQueries(this.queries,"onSortBy");for(var u=0;u<a.length;u++)if("string"==typeof(s=a[u].e.fieldName)){if(s===t)return this}else if(s instanceof Array)for(var c=0;c<s.length;c++)if(s[c]===t||t.toLowerCase()===s[c]+" desc")return this}return this.queries.push({fn:"onSortBy",e:{fieldName:t,comparer:n,direction:i}}),this},e.prototype.sortByDesc=function(e){return this.sortBy(e,"descending")},e.prototype.group=function(e){return this.sortBy(e,null,!0),this.queries.push({fn:"onGroup",e:{fieldName:e}}),this},e.prototype.page=function(e,t){return this.queries.push({fn:"onPage",e:{pageIndex:e,pageSize:t}}),this},e.prototype.range=function(e,t){return this.queries.push({fn:"onRange",e:{start:e,end:t}}),this},e.prototype.take=function(e){return this.queries.push({fn:"onTake",e:{nos:e}}),this},e.prototype.skip=function(e){return this.queries.push({fn:"onSkip",e:{nos:e}}),this},e.prototype.select=function(e){return"string"==typeof e&&(e=[].slice.call([e],0)),this.queries.push({fn:"onSelect",e:{fieldNames:e}}),this},e.prototype.hierarchy=function(e,t){return this.subQuerySelector=t,this.subQuery=e,this},e.prototype.foreignKey=function(e){return this.fKey=e,this},e.prototype.requiresCount=function(){return this.requiresCounts=!0,this},e.prototype.aggregate=function(e,t){return this.queries.push({fn:"onAggregates",e:{field:t,type:e}}),this},e.filterQueries=function(e,t){return e.filter(function(e){return e.fn===t})},e.filterQueryLists=function(e,t){for(var r=e.filter(function(e){return-1!==t.indexOf(e.fn)}),n={},o=0;o<r.length;o++)n[r[o].fn]||(n[r[o].fn]=r[o].e);return n},e}();t.Query=n;var o=function(){function e(t,n,o,a){return void 0===a&&(a=!1),this.isComplex=!1,"string"==typeof t?(this.field=t,this.operator=n.toLowerCase(),this.value=o,this.ignoreCase=a,this.isComplex=!1,this.comparer=r.DataUtil.fnOperators.processOperator(this.operator)):(t instanceof e&&o instanceof e||o instanceof Array)&&(this.isComplex=!0,this.condition=n.toLowerCase(),this.predicates=[t],o instanceof Array?[].push.apply(this.predicates,o):this.predicates.push(o)),this}return e.and=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.combinePredicates([].slice.call(t,0),"and")},e.prototype.and=function(t,r,n,o){return e.combine(this,t,r,n,"and",o)},e.or=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.combinePredicates([].slice.call(t,0),"or")},e.prototype.or=function(t,r,n,o){return e.combine(this,t,r,n,"or",o)},e.fromJson=function(e){if(e instanceof Array){for(var t=[],r=0,n=e.length;r<n;r++)t.push(this.fromJSONData(e[r]));return t}var o=e;return this.fromJSONData(o)},e.prototype.validate=function(e){var t,n,o=this.predicates?this.predicates:[];if(!this.isComplex&&this.comparer)return this.comparer.call(this,r.DataUtil.getObject(this.field,e),this.value,this.ignoreCase);t="and"===this.condition;for(var a=0;a<o.length;a++)if(n=o[a].validate(e),t){if(!n)return!1}else if(n)return!0;return t},e.prototype.toJson=function(){var e,t;if(this.isComplex){e=[],t=this.predicates;for(var r=0;r<t.length;r++)e.push(t[r].toJson())}return{isComplex:this.isComplex,field:this.field,operator:this.operator,value:this.value,ignoreCase:this.ignoreCase,condition:this.condition,predicates:e}},e.combinePredicates=function(t,r){if(1===t.length){if(!(t[0]instanceof Array))return t[0];t=t[0]}return new e(t[0],r,t.slice(1))},e.combine=function(t,n,o,a,s,i){return n instanceof e?e[s](t,n):"string"==typeof n?e[s](t,new e(n,o,a,i)):r.DataUtil.throwError("Predicate - "+s+" : invalid arguments")},e.fromJSONData=function(t){for(var r=t.predicates||[],n=r.length,o=[],a=0;a<n;a++)o.push(this.fromJSONData(r[a]));return t.isComplex?new e(o[0],t.condition,o.slice(1)):new e(t.field,t.operator,t.value,t.ignoreCase)},e}();t.Predicate=o}.apply(t,n))&&(e.exports=o)},function(e,t,r){var n,o,a=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();n=[r,t,r(3),r(5),r(6)],void 0!==(o=function(e,t,r,n,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(t){this.options={from:"table",requestType:"json",sortBy:"sorted",select:"select",skip:"skip",group:"group",take:"take",search:"search",count:"requiresCounts",where:"where",aggregates:"aggregates"},this.type=e,this.dataSource=t,this.pvt={}}return e.prototype.processResponse=function(e,t,r,n){return e},e}();t.Adaptor=s;var i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.processQuery=function(e,t){for(var r,n,o=e.dataSource.json.slice(0),a=o.length,s=!0,i={},u=0;u<t.queries.length;u++)n=t.queries[u],r=this[n.fn].call(this,o,n.e,t),"onAggregates"===n.fn?i[n.e.field+" - "+n.e.type]=r:o=void 0!==r?r:o,"onPage"!==n.fn&&"onSkip"!==n.fn&&"onTake"!==n.fn&&"onRange"!==n.fn||(s=!1),s&&(a=o.length);return t.requiresCounts&&(o={result:o,count:a,aggregates:i}),o},t.prototype.batchRequest=function(e,t,r){var n;for(n=0;n<t.addedRecords.length;n++)this.insert(e,t.addedRecords[n]);for(n=0;n<t.changedRecords.length;n++)this.update(e,r.key,t.changedRecords[n]);for(n=0;n<t.deletedRecords.length;n++)this.remove(e,r.key,t.deletedRecords[n]);return t},t.prototype.onWhere=function(e,t){return e&&e.length?e.filter(function(e){if(t)return t.validate(e)}):e},t.prototype.onAggregates=function(e,t){var r=n.DataUtil.aggregates[t.type];return e&&r&&0!==e.length?r(e,t.field):null},t.prototype.onSearch=function(e,t){return e&&e.length?(0===t.fieldNames.length&&n.DataUtil.getFieldList(e[0],t.fieldNames),e.filter(function(e){for(var r=0;r<t.fieldNames.length;r++)if(t.comparer.call(e,n.DataUtil.getObject(t.fieldNames[r],e),t.searchKey,t.ignoreCase))return!0;return!1})):e},t.prototype.onSortBy=function(e,t,r){if(!e||!e.length)return e;var o,a=n.DataUtil.getValue(t.fieldName,r);if(!a)return e.sort(t.comparer);if(a instanceof Array){a=a.slice(0);for(var s=a.length-1;s>=0;s--)a[s]&&(o=t.comparer,n.DataUtil.endsWith(a[s]," desc")&&(o=n.DataUtil.fnSort("descending"),a[s]=a[s].replace(" desc","")),e=n.DataUtil.sort(e,a[s],o));return e}return n.DataUtil.sort(e,a,t.comparer)},t.prototype.onGroup=function(e,t,r){if(!e||!e.length)return e;var a=o.Query.filterQueries(r.queries,"onAggregates"),s=[];if(a.length)for(var i=void 0,u=0;u<a.length;u++)i=a[u].e,s.push({type:i.type,field:n.DataUtil.getValue(i.field,r)});return n.DataUtil.group(e,n.DataUtil.getValue(t.fieldName,r),s)},t.prototype.onPage=function(e,t,r){var o=n.DataUtil.getValue(t.pageSize,r),a=(n.DataUtil.getValue(t.pageIndex,r)-1)*o,s=a+o;return e&&e.length?e.slice(a,s):e},t.prototype.onRange=function(e,t){return e&&e.length?e.slice(n.DataUtil.getValue(t.start),n.DataUtil.getValue(t.end)):e},t.prototype.onTake=function(e,t){return e&&e.length?e.slice(0,n.DataUtil.getValue(t.nos)):e},t.prototype.onSkip=function(e,t){return e&&e.length?e.slice(n.DataUtil.getValue(t.nos)):e},t.prototype.onSelect=function(e,t){return e&&e.length?n.DataUtil.select(e,n.DataUtil.getValue(t.fieldNames)):e},t.prototype.insert=function(e,t){return e.dataSource.json.push(t)},t.prototype.remove=function(e,t,r,n){var o,a=e.dataSource.json;for("object"==typeof r&&(r=r[t]),o=0;o<a.length&&a[o][t]!==r;o++);return o!==a.length?a.splice(o,1):null},t.prototype.update=function(e,t,n,o){var a,s=e.dataSource.json,i=n[t];for(a=0;a<s.length&&s[a][t]!==i;a++);return a<s.length?r.merge(s[a],n):null},t}(s);t.JsonAdaptor=i;var u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.processQuery=function(e,t,r){var a,s,i=this.getQueryRequest(t),u=o.Query.filterQueryLists(t.queries,["onSelect","onPage","onSkip","onTake","onRange"]),c=t.params,l=e.dataSource.url,p=null,d=this.options,f={sorts:[],groups:[],filters:[],searches:[],aggregates:[]};"onPage"in u?(a=u.onPage,s=n.DataUtil.getValue(a.pageIndex,t),p=n.DataUtil.getValue(a.pageSize,t),s=(s-1)*p):"onRange"in u&&(a=u.onRange,s=a.start,p=a.end-a.start);for(var h=0;h<i.sorts.length;h++)a=n.DataUtil.getValue(i.sorts[h].e.fieldName,t),f.sorts.push(n.DataUtil.callAdaptorFunction(this,"onEachSort",{name:a,direction:i.sorts[h].e.direction},t));r&&(a=this.getFiltersFrom(r,t))&&f.filters.push(n.DataUtil.callAdaptorFunction(this,"onEachWhere",a.toJson(),t));for(var h=0;h<i.filters.length;h++){f.filters.push(n.DataUtil.callAdaptorFunction(this,"onEachWhere",i.filters[h].e.toJson(),t));for(var g="object"==typeof f.filters[h]?Object.keys(f.filters[h]):[],y=0,v=g;y<v.length;y++){var m=v[y];n.DataUtil.isNull(f[m])&&delete f[m]}}for(var h=0;h<i.searches.length;h++)a=i.searches[h].e,f.searches.push(n.DataUtil.callAdaptorFunction(this,"onEachSearch",{fields:a.fieldNames,operator:a.operator,key:a.searchKey,ignoreCase:a.ignoreCase},t));for(var h=0;h<i.groups.length;h++)f.groups.push(n.DataUtil.getValue(i.groups[h].e.fieldName,t));for(var h=0;h<i.aggregates.length;h++)a=i.aggregates[h].e,f.aggregates.push({type:a.type,field:n.DataUtil.getValue(a.field,t)});var b={};this.getRequestQuery(d,t,u,f,b),n.DataUtil.callAdaptorFunction(this,"addParams",{dm:e,query:t,params:c,reqParams:b});for(var S=Object.keys(b),D=0,q=S;D<q.length;D++){var m=q[D];(n.DataUtil.isNull(b[m])||""===b[m]||0===b[m].length)&&delete b[m]}d.skip in b&&d.take in b||null===p||(b[d.skip]=n.DataUtil.callAdaptorFunction(this,"onSkip",s,t),b[d.take]=n.DataUtil.callAdaptorFunction(this,"onTake",p,t));var w=this.pvt;return this.pvt={},"json"===this.options.requestType?{data:JSON.stringify(b),url:l,pvtData:w,type:"POST",contentType:"application/json; charset=utf-8"}:(a=this.convertToQueryString(b,t,e),a=(-1!==e.dataSource.url.indexOf("?")?"&":"/")+a,{type:"GET",url:a.length?l.replace(/\/*$/,a):l,pvtData:w})},t.prototype.getRequestQuery=function(e,t,r,o,a){var s=a;s[e.from]=t.fromTable,e.expand&&(s[e.expand]=t.expands),s[e.select]="onSelect"in r?n.DataUtil.callAdaptorFunction(this,"onSelect",n.DataUtil.getValue(r.onSelect.fieldNames,t),t):"",s[e.count]=t.requiresCounts?n.DataUtil.callAdaptorFunction(this,"onCount",t.requiresCounts,t):"",s[e.search]=o.searches.length?n.DataUtil.callAdaptorFunction(this,"onSearch",o.searches,t):"",s[e.skip]="onSkip"in r?n.DataUtil.callAdaptorFunction(this,"onSkip",n.DataUtil.getValue(r.onSkip.nos,t),t):"",s[e.take]="onTake"in r?n.DataUtil.callAdaptorFunction(this,"onTake",n.DataUtil.getValue(r.onTake.nos,t),t):"",s[e.where]=o.filters.length||o.searches.length?n.DataUtil.callAdaptorFunction(this,"onWhere",o.filters,t):"",s[e.sortBy]=o.sorts.length?n.DataUtil.callAdaptorFunction(this,"onSortBy",o.sorts,t):"",s[e.group]=o.groups.length?n.DataUtil.callAdaptorFunction(this,"onGroup",o.groups,t):"",s[e.aggregates]=o.aggregates.length?n.DataUtil.callAdaptorFunction(this,"onAggregates",o.aggregates,t):"",s.param=[]},t.prototype.convertToQueryString=function(e,t,r){return""},t.prototype.processResponse=function(e,t,r,o,a,s){var i=a,u=i.pvtData||{},c=e.groupDs;if(o&&o.getResponseHeader("Content-Type")&&-1!==o.getResponseHeader("Content-Type").indexOf("xml"))return r.requiresCounts?{result:[],count:0}:[];var l=JSON.parse(i.data);if(l&&"batch"===l.action&&e.addedRecords)return s.addedRecords=e.addedRecords,s;e.d&&(e=e.d);var p={};return"count"in e&&(p.count=e.count),p.result=e.result?e.result:e,this.getAggregateResult(u,e,p,c),n.DataUtil.isNull(p.count)?p.result:{result:p.result,count:p.count,aggregates:p.aggregates}},t.prototype.onGroup=function(e){this.pvt.groups=e},t.prototype.onAggregates=function(e){this.pvt.aggregates=e},t.prototype.batchRequest=function(e,t,r){return{type:"POST",url:e.dataSource.batchUrl||e.dataSource.crudUrl||e.dataSource.removeUrl||e.dataSource.url,contentType:"application/json; charset=utf-8",dataType:"json",data:JSON.stringify({changed:t.changedRecords,added:t.addedRecords,deleted:t.deletedRecords,action:"batch",table:r[void 0],key:r[void 0]})}},t.prototype.beforeSend=function(e,t){},t.prototype.insert=function(e,t,r){return{url:e.dataSource.insertUrl||e.dataSource.crudUrl||e.dataSource.url,data:JSON.stringify({value:t,table:r,action:"insert"})}},t.prototype.remove=function(e,t,r,n){return{type:"POST",url:e.dataSource.removeUrl||e.dataSource.crudUrl||e.dataSource.url,data:JSON.stringify({key:r,keyColumn:t,table:n,action:"remove"})}},t.prototype.update=function(e,t,r,n){return{type:"POST",url:e.dataSource.updateUrl||e.dataSource.crudUrl||e.dataSource.url,data:JSON.stringify({value:r,action:"update",keyColumn:t,key:r[t],table:n})}},t.prototype.getFiltersFrom=function(e,t){var r,a=t.fKey,s=a,i=t.key,u=[];"object"!=typeof e[0]&&(s=null);for(var c=0;c<e.length;c++)r="object"==typeof e[0]?n.DataUtil.getObject(i||s,e[c]):e[c],u.push(new o.Predicate(a,"equal",r));return o.Predicate.or(u)},t.prototype.getAggregateResult=function(e,t,o,a){var s=t;if(t&&t.result&&(s=t.result),e&&e.aggregates&&e.aggregates.length){var i=e.aggregates,u=void 0,c=s,l={};t.aggregate&&(c=t.aggregate);for(var p=0;p<i.length;p++)(u=n.DataUtil.aggregates[i[p].type])&&(l[i[p].field+" - "+i[p].type]=u(c,i[p].field));o.aggregates=l}if(e&&e.groups&&e.groups.length){for(var d=e.groups,p=0;p<d.length;p++){r.isNullOrUndefined(a)||(a=n.DataUtil.group(a,d[p])),s=n.DataUtil.group(s,d[p],e.aggregates,null,a)}o.result=s}return o},t.prototype.getQueryRequest=function(e){var t={sorts:[],groups:[],filters:[],searches:[],aggregates:[]};return t.sorts=o.Query.filterQueries(e.queries,"onSortBy"),t.groups=o.Query.filterQueries(e.queries,"onGroup"),t.filters=o.Query.filterQueries(e.queries,"onWhere"),t.searches=o.Query.filterQueries(e.queries,"onSearch"),t.aggregates=o.Query.filterQueries(e.queries,"onAggregates"),t},t.prototype.addParams=function(e){var t=e.reqParams;e.params.length&&(t.params={});for(var r=0,n=e.params;r<n.length;r++){var o=n[r];if(t[o.key])throw new Error("Query() - addParams: Custom Param is conflicting other request arguments");t[o.key]=o.value,o.fn&&(t[o.key]=o.fn.call(e.query,o.key,e.query,e.dm)),t.params[o.key]=t[o.key]}},t}(s);t.UrlAdaptor=u;var c=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.options=r.extend({},t.options,{requestType:"get",accept:"application/json;odata=light;q=1,application/json;odata=verbose;q=0.5",multipartAccept:"multipart/mixed",sortBy:"$orderby",select:"$select",skip:"$skip",take:"$top",count:"$inlinecount",where:"$filter",expand:"$expand",batch:"$batch",changeSet:"--changeset_",batchPre:"batch_",contentId:"Content-Id: ",batchContent:"Content-Type: multipart/mixed; boundary=",changeSetContent:"Content-Type: application/http\nContent-Transfer-Encoding: binary ",batchChangeSetContentType:"Content-Type: application/json; charset=utf-8 "}),t}return a(t,e),t.prototype.onPredicate=function(e,r,o){var a,s,i="",u=e.value,c=typeof u,l=e.field?t.getField(e.field):null;if(u instanceof Date&&(u="datetime'"+n.DataUtil.parse.replacer(u)+"'"),"string"===c&&(u="'"+u+"'",o&&(l="cast("+l+", 'Edm.String')"),n.DataUtil.parse.isGuid(u)&&(s="guid"),e.ignoreCase&&(s||(l="tolower("+l+")"),u=u.toLowerCase())),a=n.DataUtil.odBiOperator[e.operator])return i+=l,i+=a,s&&(i+=s),i+u;if("substringof"===(a=n.DataUtil.odUniOperator[e.operator])){var p=u;u=l,l=p}return i+=a+"(",i+=l+",",s&&(i+=s),i+=u+")"},t.prototype.onComplexPredicate=function(e,t,r){for(var n=[],o=0;o<e.predicates.length;o++)n.push("("+this.onEachWhere(e.predicates[o],t,r)+")");return n.join(" "+e.condition+" ")},t.prototype.onEachWhere=function(e,t,r){return e.isComplex?this.onComplexPredicate(e,t,r):this.onPredicate(e,t,r)},t.prototype.onWhere=function(e){return this.pvt.search&&e.push(this.onEachWhere(this.pvt.search,null,!0)),e.join(" and ")},t.prototype.onEachSearch=function(e){e.fields&&0===e.fields.length&&n.DataUtil.throwError("Query() - Search : oData search requires list of field names to search");for(var t=this.pvt.search||[],r=0;r<e.fields.length;r++)t.push(new o.Predicate(e.fields[r],e.operator,e.key,e.ignoreCase));this.pvt.search=t},t.prototype.onSearch=function(e){return this.pvt.search=o.Predicate.or(this.pvt.search),""},t.prototype.onEachSort=function(e){var r=[];if(e.name instanceof Array)for(var n=0;n<e.name.length;n++)r.push(t.getField(e.name[n])+("descending"===e.direction?" desc":""));else r.push(t.getField(e.name)+("descending"===e.direction?" desc":""));return r.join(",")},t.prototype.onSortBy=function(e){return e.reverse().join(",")},t.prototype.onGroup=function(e){return this.pvt.groups=e,""},t.prototype.onSelect=function(e){for(var r=0;r<e.length;r++)e[r]=t.getField(e[r]);return e.join(",")},t.prototype.onAggregates=function(e){return this.pvt.aggregates=e,""},t.prototype.onCount=function(e){return!0===e?"allpages":""},t.prototype.beforeSend=function(e,t,r){n.DataUtil.endsWith(r.url,this.options.batch)&&"post"===r.type.toLowerCase()?(t.setRequestHeader("Accept",this.options.multipartAccept),t.setRequestHeader("DataServiceVersion","2.0"),t.overrideMimeType("text/plain; charset=x-user-defined")):t.setRequestHeader("Accept",this.options.accept),t.setRequestHeader("DataServiceVersion","2.0"),t.setRequestHeader("MaxDataServiceVersion","2.0")},t.prototype.processResponse=function(e,t,o,a,s,i){if(!r.isNullOrUndefined(e.d)){var u=o&&o.requiresCounts?e.d.results:e.d;if(!r.isNullOrUndefined(u))for(var c=0;c<u.length;c++)r.isNullOrUndefined(u[c].__metadata)||delete u[c].__metadata}var l=s&&s.pvtData,p=this.processBatchResponse(e,o,a,s,i);if(p)return p;var d=a&&s.getResponseHeader("DataServiceVersion"),f=null,h=d&&parseInt(d,10)||2;if(o&&o.requiresCounts){(e.__count||e["odata.count"])&&(f=e.__count||e["odata.count"]),e.d&&(e=e.d),(e.__count||e["odata.count"])&&(f=e.__count||e["odata.count"])}3===h&&e.value&&(e=e.value),e.d&&(e=e.d),h<3&&e.results&&(e=e.results);var g={};return g.count=f,g.result=e,this.getAggregateResult(l,e,g),n.DataUtil.isNull(f)?g.result:{result:g.result,count:g.count,aggregates:g.aggregates}},t.prototype.convertToQueryString=function(e,t,r){var n=[],o=e.table||"";delete e.table,r.dataSource.requiresFormat&&(e.$format="json");for(var a=Object.keys(e),s=0,i=a;s<i.length;s++){var u=i[s];n.push(u+"="+e[u])}return n=n.join("&"),r.dataSource.url&&-1!==r.dataSource.url.indexOf("?")&&!o?n:n.length?o+"?"+n:o||""},t.prototype.insert=function(e,t,r){return{url:e.dataSource.url.replace(/\/*$/,r?"/"+r:""),data:JSON.stringify(t)}},t.prototype.remove=function(e,t,r,n){return{type:"DELETE",url:e.dataSource.url.replace(/\/*$/,n?"/"+n:"")+"("+r+")"}},t.prototype.update=function(e,t,r,n){return{type:"PUT",url:e.dataSource.url.replace(/\/*$/,n?"/"+n:"")+"("+r[t]+")",data:JSON.stringify(r),accept:this.options.accept}},t.prototype.batchRequest=function(e,t,r){var o=r.guid=n.DataUtil.getGuid(this.options.batchPre),a=e.dataSource.url.replace(/\/*$/,"/"+this.options.batch),s={url:r.url,key:r.key,cid:1,cSet:n.DataUtil.getGuid(this.options.changeSet)},i="--"+o+"\n";return i+="Content-Type: multipart/mixed; boundary="+s.cSet.replace("--","")+"\n",this.pvt.changeSet=0,i+=this.generateInsertRequest(t.addedRecords,s),i+=this.generateUpdateRequest(t.changedRecords,s),i+=this.generateDeleteRequest(t.deletedRecords,s),i+=s.cSet+"--\n",i+="--"+o+"--",{type:"POST",url:a,dataType:"json",contentType:"multipart/mixed; charset=UTF-8;boundary="+o,data:i}},t.prototype.generateDeleteRequest=function(e,t){if(!e)return"";var r={method:"DELETE ",url:function(e,t,r){return"("+e[t][r]+")"},data:function(e,t){return""}};return this.generateBodyContent(e,t,r)+"\n"},t.prototype.generateInsertRequest=function(e,t){if(!e)return"";var r={method:"POST ",url:function(e,t,r){return""},data:function(e,t){return JSON.stringify(e[t])+"\n\n"}};return this.generateBodyContent(e,t,r)},t.prototype.generateUpdateRequest=function(e,t){if(!e)return"";var r={method:"PUT ",url:function(e,t,r){return"("+e[t][r]+")"},data:function(e,t){return JSON.stringify(e[t])+"\n\n"}};return this.generateBodyContent(e,t,r)},t.getField=function(e){return e.replace(/\./g,"/")},t.prototype.generateBodyContent=function(e,t,r){for(var n="",o=0;o<e.length;o++)n+="\n"+t.cSet+"\n",n+=this.options.changeSetContent+"\n\n",n+=r.method,n+=t.url+r.url(e,o,t.key)+" HTTP/1.1\n",n+="Accept: "+this.options.accept+"\n",n+="Content-Id: "+this.pvt.changeSet+++"\n",n+=this.options.batchChangeSetContentType+"\n\n",n+=r.data(e,o);return n},t.prototype.processBatchResponse=function(e,t,o,a,s){if(o&&o.getResponseHeader("Content-Type")&&-1!==o.getResponseHeader("Content-Type").indexOf("xml"))return t.requiresCounts?{result:[],count:0}:[];if(a&&this.options.batch&&n.DataUtil.endsWith(a.url,this.options.batch)&&"post"===a.type.toLowerCase()){var i=o.getResponseHeader("Content-Type"),u=void 0,c=void 0;if(i=i.substring(i.indexOf("=batchresponse")+1),e=e.split(i),e.length<2)return{};e=e[1];var l=/(?:\bContent-Type.+boundary=)(changesetresponse.+)/i.exec(e);l&&e.replace(l[0],"");var p=l?l[1]:"";e=e.split(p);for(var d=e.length;d>-1;d--)/\bContent-ID:/i.test(e[d])&&/\bHTTP.+201/.test(e[d])&&(u=parseInt(/\bContent-ID: (\d+)/i.exec(e[d])[1],10),s.addedRecords[u]&&(c=n.DataUtil.parse.parseJson(/^\{.+\}/m.exec(e[d])[0]),r.extend({},s.addedRecords[u],this.processResponse(c))));return s}return null},t}(u);t.ODataAdaptor=c;var l=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.options=r.extend({},t.options,{requestType:"get",accept:"application/json, text/javascript, */*; q=0.01",multipartAccept:"multipart/mixed",sortBy:"$orderby",select:"$select",skip:"$skip",take:"$top",count:"$count",search:"$search",where:"$filter",expand:"$expand",batch:"$batch",changeSet:"--changeset_",batchPre:"batch_",contentId:"Content-Id: ",batchContent:"Content-Type: multipart/mixed; boundary=",changeSetContent:"Content-Type: application/http\nContent-Transfer-Encoding: binary ",batchChangeSetContentType:"Content-Type: application/json; charset=utf-8 "}),t}return a(t,e),t.prototype.onCount=function(e){return!0===e?"true":""},t.prototype.onPredicate=function(t,r,n){var o="",a=t.value,s=a instanceof Date;return o=e.prototype.onPredicate.call(this,t,r,n),s&&(o=o.replace(/datetime'(.*)'$/,"$1")),o},t.prototype.onEachSearch=function(e){var t=this.pvt.searches||[];t.push(e.key),this.pvt.searches=t},t.prototype.onSearch=function(e){return this.pvt.searches.join(" OR ")},t.prototype.beforeSend=function(e,t,r){t.setRequestHeader("Accept",this.options.accept)},t.prototype.processResponse=function(t,r,o,a,s,i){var u=s&&s.pvtData,c=e.prototype.processBatchResponse.call(this,t,o,a,s,i);if(c)return c;var l=null;o&&o.requiresCounts&&"@odata.count"in t&&(l=t["@odata.count"]),t=t.value;var p={};return p.count=l,p.result=t,this.getAggregateResult(u,t,p),n.DataUtil.isNull(l)?p.result:{result:p.result,count:l,aggregates:p.aggregates}},t}(c);t.ODataV4Adaptor=l;var p=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.insert=function(e,t,r){return{type:"POST",url:e.dataSource.url,data:JSON.stringify(t)}},t.prototype.remove=function(e,t,r,n){return{type:"DELETE",url:e.dataSource.url+"/"+r,data:JSON.stringify(r)}},t.prototype.update=function(e,t,r,n){return{type:"PUT",url:e.dataSource.url,data:JSON.stringify(r)}},t.prototype.beforeSend=function(e,t,r){t.setRequestHeader("Accept","application/json, text/javascript, */*; q=0.01")},t.prototype.processResponse=function(e,t,r,o,a,s){var i=a&&a.pvtData,u=null,c={};if(a&&"post"!==a.type.toLowerCase()){var l=o&&a.getResponseHeader("DataServiceVersion"),p=l&&parseInt(l,10)||2;r&&r.requiresCounts&&(n.DataUtil.isNull(e.Count)||(u=e.Count)),p<3&&e.Items&&(e=e.Items),c.count=u,c.result=e,this.getAggregateResult(i,e,c)}return c.result=c.result||e,n.DataUtil.isNull(u)?c.result:{result:c.result,count:c.count,aggregates:c.aggregates}},t}(c);t.WebApiAdaptor=p;var d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.processQuery=function(e,t,r){var o=(new u).processQuery(e,t,r),a=n.DataUtil.parse.parseJson(o.data),s={};if(a.param)for(var i=0;i<a.param.length;i++){var c=a.param[i],l=Object.keys(c)[0];s[l]=c[l]}s.value=a;return{data:JSON.stringify(s),url:o.url,pvtData:o.pvtData,type:"POST",contentType:"application/json; charset=utf-8"}},t}(u);t.WebMethodAdaptor=d;var f=function(e){function t(){var t=e.call(this)||this;return r.setValue("beforeSend",u.prototype.beforeSend,t),r.setValue("insert",u.prototype.insert,t),r.setValue("update",u.prototype.update,t),r.setValue("remove",u.prototype.remove,t),t}return a(t,e),t.prototype.batchRequest=function(e,t,r){var n;for(n=0;n<t.addedRecords.length;n++)i.prototype.insert(e,t.addedRecords[n]);for(n=0;n<t.changedRecords.length;n++)i.prototype.update(e,r.key,t.changedRecords[n]);for(n=0;n<t.deletedRecords.length;n++)i.prototype.remove(e,r.key,t.deletedRecords[n]);return{type:"POST",url:e.dataSource.batchUrl||e.dataSource.crudUrl||e.dataSource.url,contentType:"application/json; charset=utf-8",dataType:"json",data:JSON.stringify({changed:t.changedRecords,added:t.addedRecords,deleted:t.deletedRecords,action:"batch",table:r.url,key:r.key})}},t}(i);t.RemoteSaveAdaptor=f;var h=function(e){function t(t,o,a){var s=e.call(this)||this;s.isCrudAction=!1,s.isInsertAction=!1,r.isNullOrUndefined(t)||(s.cacheAdaptor=t),s.pageSize=a,s.guidId=n.DataUtil.getGuid("cacheAdaptor");var i={keys:[],results:[]};window.localStorage.setItem(s.guidId,JSON.stringify(i));var u=s.guidId;return r.isNullOrUndefined(o)||setInterval(function(){var e;e=n.DataUtil.parse.parseJson(window.localStorage.getItem(u));for(var t=[],r=0;r<e.results.length;r++){var a=+new Date,s=+new Date(e.results[r].timeStamp);e.results[r].timeStamp=a-s,a-s>o&&t.push(r)}for(var r=0;r<t.length;r++)e.results.splice(t[r],1),e.keys.splice(t[r],1);window.localStorage.removeItem(u),window.localStorage.setItem(u,JSON.stringify(e))},o),s}return a(t,e),t.prototype.generateKey=function(e,t){var r=this.getQueryRequest(t),n=o.Query.filterQueryLists(t.queries,["onSelect","onPage","onSkip","onTake","onRange"]),a=e;"onPage"in n&&(a+=n.onPage.pageIndex),r.sorts.forEach(function(e){a+=e.e.direction+e.e.fieldName}),r.groups.forEach(function(e){a+=e.e.fieldName}),r.searches.forEach(function(e){a+=e.e.searchKey});for(var s=0;s<r.filters.length;s++){var i=r.filters[s];if(i.e.isComplex){var u=t.clone();u.queries=[];for(var c=0;c<i.e.predicates.length;c++)u.queries.push({fn:"onWhere",e:i.e.predicates[c],filter:t.queries.filter});a+=i.e.condition+this.generateKey(e,u)}else a+=i.e.field+i.e.operator+i.e.value}return a},t.prototype.processQuery=function(e,t,r){var o,a=this.generateKey(e.dataSource.url,t);o=n.DataUtil.parse.parseJson(window.localStorage.getItem(this.guidId));var s=o?o.results[o.keys.indexOf(a)]:null;return null==s||this.isCrudAction||this.isInsertAction?(this.isCrudAction=null,this.isInsertAction=null,this.cacheAdaptor.processQuery.apply(this.cacheAdaptor,[].slice.call(arguments,0))):s},t.prototype.processResponse=function(e,t,r,o,a,s){if(this.isInsertAction||a&&this.cacheAdaptor.options.batch&&n.DataUtil.endsWith(a.url,this.cacheAdaptor.options.batch)&&"post"===a.type.toLowerCase())return this.cacheAdaptor.processResponse(e,t,r,o,a,s);e=this.cacheAdaptor.processResponse.apply(this.cacheAdaptor,[].slice.call(arguments,0));var i=r?this.generateKey(t.dataSource.url,r):t.dataSource.url,u={};u=n.DataUtil.parse.parseJson(window.localStorage.getItem(this.guidId));var c=u.keys.indexOf(i);for(-1!==c&&(u.results.splice(c,1),u.keys.splice(c,1)),u.results[u.keys.push(i)-1]={keys:i,result:e.result,timeStamp:new Date,count:e.count};u.results.length>this.pageSize;)u.results.splice(0,1),u.keys.splice(0,1);return window.localStorage.setItem(this.guidId,JSON.stringify(u)),e},t.prototype.beforeSend=function(e,t,r){n.DataUtil.endsWith(r.url,this.cacheAdaptor.options.batch)&&"post"===r.type.toLowerCase()&&t.setRequestHeader("Accept",this.cacheAdaptor.options.multipartAccept),e.dataSource.crossDomain||t.setRequestHeader("Accept",this.cacheAdaptor.options.accept)},t.prototype.update=function(e,t,r,n){return this.isCrudAction=!0,this.cacheAdaptor.update(e,t,r,n)},t.prototype.insert=function(e,t,r){return this.isInsertAction=!0,this.cacheAdaptor.insert(e,t,r)},t.prototype.remove=function(e,t,r,n){return this.isCrudAction=!0,this.cacheAdaptor.remove(e,t,r,n)},t.prototype.batchRequest=function(e,t,r){return this.cacheAdaptor.batchRequest(e,t,r)},t}(u);t.CacheAdaptor=h}.apply(t,n))&&(e.exports=o)}])}); |
@@ -351,3 +351,3 @@ var __extends = (this && this.__extends) || (function () { | ||
xhr.getResponseHeader('Content-Type').indexOf('xml') !== -1) { | ||
return query.requiresCounts ? { result: [], count: 0 } : []; | ||
return (query.requiresCounts ? { result: [], count: 0 } : []); | ||
} | ||
@@ -494,2 +494,19 @@ var d = JSON.parse(requests.data); | ||
}; | ||
UrlAdaptor.prototype.addParams = function (options) { | ||
var req = options.reqParams; | ||
if (options.params.length) { | ||
req.params = {}; | ||
} | ||
for (var _i = 0, _a = options.params; _i < _a.length; _i++) { | ||
var tmp = _a[_i]; | ||
if (req[tmp.key]) { | ||
throw new Error('Query() - addParams: Custom Param is conflicting other request arguments'); | ||
} | ||
req[tmp.key] = tmp.value; | ||
if (tmp.fn) { | ||
req[tmp.key] = tmp.fn.call(options.query, tmp.key, options.query, options.dm); | ||
} | ||
req.params[tmp.key] = req[tmp.key]; | ||
} | ||
}; | ||
return UrlAdaptor; | ||
@@ -816,3 +833,3 @@ }(Adaptor)); | ||
if (xhr && xhr.getResponseHeader('Content-Type') && xhr.getResponseHeader('Content-Type').indexOf('xml') !== -1) { | ||
return query.requiresCounts ? { result: [], count: 0 } : []; | ||
return (query.requiresCounts ? { result: [], count: 0 } : []); | ||
} | ||
@@ -881,7 +898,7 @@ if (request && this.options.batch && DataUtil.endsWith(request.url, this.options.batch) && request.type.toLowerCase() === 'post') { | ||
}; | ||
ODataV4Adaptor.prototype.onPredicate = function (predicate, requiresCast) { | ||
ODataV4Adaptor.prototype.onPredicate = function (predicate, query, requiresCast) { | ||
var returnValue = ''; | ||
var val = predicate.value; | ||
var isDate = val instanceof Date; | ||
returnValue = _super.prototype.onPredicate.call(this, predicate, requiresCast); | ||
returnValue = _super.prototype.onPredicate.call(this, predicate, query, requiresCast); | ||
if (isDate) { | ||
@@ -888,0 +905,0 @@ returnValue = returnValue.replace(/datetime'(.*)'$/, '$1'); |
@@ -148,2 +148,3 @@ import { Ajax } from '@syncfusion/ej2-base'; | ||
args.count = result.count; | ||
args.aggregates = result.aggregates; | ||
} | ||
@@ -150,0 +151,0 @@ else { |
{ | ||
"_args": [ | ||
[ | ||
{ | ||
"raw": "@syncfusion/ej2-data@*", | ||
"scope": "@syncfusion", | ||
"escapedName": "@syncfusion%2fej2-data", | ||
"name": "@syncfusion/ej2-data", | ||
"rawSpec": "*", | ||
"spec": "*", | ||
"type": "range" | ||
}, | ||
"C:\\Users\\ajithr\\Desktop\\ej2-release\\node_modules\\@syncfusion\\ej2" | ||
] | ||
], | ||
"_from": "@syncfusion/ej2-data@*", | ||
"_id": "@syncfusion/ej2-data@1.0.10", | ||
"_inCache": true, | ||
"_location": "/@syncfusion/ej2-data", | ||
"_nodeVersion": "6.11.0", | ||
"_npmUser": { | ||
"name": "ej2", | ||
"email": "pipeline@syncfusion.com" | ||
}, | ||
"_npmVersion": "3.10.10", | ||
"_phantomChildren": {}, | ||
"_requested": { | ||
"raw": "@syncfusion/ej2-data@*", | ||
"scope": "@syncfusion", | ||
"escapedName": "@syncfusion%2fej2-data", | ||
"name": "@syncfusion/ej2-data", | ||
"rawSpec": "*", | ||
"spec": "*", | ||
"type": "range" | ||
}, | ||
"_requiredBy": [ | ||
"/@syncfusion/ej2", | ||
"/@syncfusion/ej2-charts", | ||
"/@syncfusion/ej2-grids", | ||
"/@syncfusion/ej2-lists" | ||
], | ||
"_resolved": "http://syncdeskn6525:8081/repository/ej2-production/@syncfusion/ej2-data/-/ej2-data-1.0.10.tgz", | ||
"_shasum": "86a3acffc70f25bdbfdd467caf117a1feef9eb30", | ||
"_shrinkwrap": null, | ||
"_spec": "@syncfusion/ej2-data@*", | ||
"_where": "C:\\Users\\ajithr\\Desktop\\ej2-release\\node_modules\\@syncfusion\\ej2", | ||
"author": { | ||
"name": "Syncfusion Inc." | ||
}, | ||
"name": "@syncfusion/ej2-data", | ||
"version": "1.0.11", | ||
"description": "Syncfusion TypeScript DataManager", | ||
"author": "Syncfusion Inc.", | ||
"license": "SEE LICENSE IN license", | ||
"module": "dist/es6/index.js", | ||
"dependencies": { | ||
"@syncfusion/ej2-base": "^1.0.10" | ||
"@syncfusion/ej2-base": "^1.0.11" | ||
}, | ||
"description": "Essential JS 2 DataManager", | ||
"devDependencies": { | ||
@@ -60,35 +17,3 @@ "@types/chai": "^3.4.28", | ||
"@types/requirejs": "^2.1.26" | ||
}, | ||
"dist": { | ||
"shasum": "86a3acffc70f25bdbfdd467caf117a1feef9eb30", | ||
"tarball": "http://syncdeskn6525:8081/repository/ej2-production/@syncfusion/ej2-data/-/ej2-data-1.0.10.tgz" | ||
}, | ||
"gitHead": "552668d8688d9aeedb0e4694fc3d00aa59cb2e7d", | ||
"keywords": [ | ||
"ej2", | ||
"syncfusion", | ||
"ej2-data" | ||
], | ||
"license": "SEE LICENSE IN license", | ||
"maintainers": [ | ||
{ | ||
"name": "ej2", | ||
"email": "pipeline@syncfusion.com" | ||
} | ||
], | ||
"module": "dist/es6/index.js", | ||
"name": "@syncfusion/ej2-data", | ||
"optionalDependencies": {}, | ||
"readme": "# Overview\r\n\r\n`@syncfusion/ej2-data` is a data management package to perform data operations such as grouping, sorting in client applications.\r\nIt will act as an abstraction for using local data sources like array of JavaScript objects\r\nand remote data sources like web services returning JSON, JSONP, oData or XML.", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/syncfusion/ej2-data.git" | ||
}, | ||
"readmeFilename": "ReadMe.md", | ||
"scripts": { | ||
"ci-publish": "gulp ci-publish", | ||
"compile": "gulp ci-compile", | ||
"test": "gulp ci-test" | ||
}, | ||
"version": "1.0.10" | ||
} | ||
} |
@@ -5,2 +5,7 @@ # Overview | ||
It will act as an abstraction for using local data sources like array of JavaScript objects | ||
and remote data sources like web services returning JSON, JSONP, oData or XML. | ||
and remote data sources like web services returning JSON, JSONP, oData or XML. | ||
## Changelog | ||
Check the changelog [here](https://github.com/syncfusion/ej2-data/blob/master/CHANGELOG.md) |
@@ -267,2 +267,3 @@ import { Ajax } from '@syncfusion/ej2-base'; | ||
protected getQueryRequest(query: Query): Requests; | ||
private addParams(options); | ||
} | ||
@@ -453,3 +454,3 @@ /** | ||
*/ | ||
onPredicate(predicate: Predicate, requiresCast?: boolean): string; | ||
onPredicate(predicate: Predicate, query: Query | boolean, requiresCast?: boolean): string; | ||
/** | ||
@@ -456,0 +457,0 @@ * Generate query string based on the multiple search criteria from query. |
@@ -351,3 +351,3 @@ var __extends = (this && this.__extends) || (function () { | ||
xhr.getResponseHeader('Content-Type').indexOf('xml') !== -1) { | ||
return query.requiresCounts ? { result: [], count: 0 } : []; | ||
return (query.requiresCounts ? { result: [], count: 0 } : []); | ||
} | ||
@@ -494,2 +494,19 @@ var d = JSON.parse(requests.data); | ||
}; | ||
UrlAdaptor.prototype.addParams = function (options) { | ||
var req = options.reqParams; | ||
if (options.params.length) { | ||
req.params = {}; | ||
} | ||
for (var _i = 0, _a = options.params; _i < _a.length; _i++) { | ||
var tmp = _a[_i]; | ||
if (req[tmp.key]) { | ||
throw new Error('Query() - addParams: Custom Param is conflicting other request arguments'); | ||
} | ||
req[tmp.key] = tmp.value; | ||
if (tmp.fn) { | ||
req[tmp.key] = tmp.fn.call(options.query, tmp.key, options.query, options.dm); | ||
} | ||
req.params[tmp.key] = req[tmp.key]; | ||
} | ||
}; | ||
return UrlAdaptor; | ||
@@ -816,3 +833,3 @@ }(Adaptor)); | ||
if (xhr && xhr.getResponseHeader('Content-Type') && xhr.getResponseHeader('Content-Type').indexOf('xml') !== -1) { | ||
return query.requiresCounts ? { result: [], count: 0 } : []; | ||
return (query.requiresCounts ? { result: [], count: 0 } : []); | ||
} | ||
@@ -881,7 +898,7 @@ if (request && this.options.batch && util_2.DataUtil.endsWith(request.url, this.options.batch) && request.type.toLowerCase() === 'post') { | ||
}; | ||
ODataV4Adaptor.prototype.onPredicate = function (predicate, requiresCast) { | ||
ODataV4Adaptor.prototype.onPredicate = function (predicate, query, requiresCast) { | ||
var returnValue = ''; | ||
var val = predicate.value; | ||
var isDate = val instanceof Date; | ||
returnValue = _super.prototype.onPredicate.call(this, predicate, requiresCast); | ||
returnValue = _super.prototype.onPredicate.call(this, predicate, query, requiresCast); | ||
if (isDate) { | ||
@@ -888,0 +905,0 @@ returnValue = returnValue.replace(/datetime'(.*)'$/, '$1'); |
@@ -146,2 +146,3 @@ define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base/util", "./util", "./query", "./adaptors"], function (require, exports, ej2_base_1, util_1, util_2, query_1, adaptors_1) { | ||
args.count = result.count; | ||
args.aggregates = result.aggregates; | ||
} | ||
@@ -148,0 +149,0 @@ else { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10
719636
31
15716
1
1
Updated@syncfusion/ej2-base@^1.0.11