Socket
Socket
Sign inDemoInstall

@syncfusion/ej2-data

Package Overview
Dependencies
Maintainers
2
Versions
166
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@syncfusion/ej2-data - npm Package Compare versions

Comparing version 1.0.11 to 1.0.14

dist/ej2-data.umd.js

4

dist/ej2-data.umd.min.js
/*!
* filename: ej2-data.umd.min.js
* version : 1.0.10
* version : 1.0.14
* Copyright Syncfusion Inc. 2001 - 2017. All rights reserved.

@@ -11,2 +11,2 @@ * Use of this code is subject to the terms of our license.

!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)}])});
!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(4),r(5),r(3)],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(2),r(3),r(4),r(5)],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(2),r(1),r(4)],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(3)],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(2),r(3),r(4)],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 S={};this.getRequestQuery(d,t,u,f,S),n.DataUtil.callAdaptorFunction(this,"addParams",{dm:e,query:t,params:c,reqParams:S});for(var b=Object.keys(S),D=0,q=b;D<q.length;D++){var m=q[D];(n.DataUtil.isNull(S[m])||""===S[m]||0===S[m].length)&&delete S[m]}d.skip in S&&d.take in S||null===p||(S[d.skip]=n.DataUtil.callAdaptorFunction(this,"onSkip",s,t),S[d.take]=n.DataUtil.callAdaptorFunction(this,"onTake",p,t));var C=this.pvt;return this.pvt={},"json"===this.options.requestType?{data:JSON.stringify(S),url:l,pvtData:C,type:"POST",contentType:"application/json; charset=utf-8"}:(a=this.convertToQueryString(S,t,e),a=(-1!==e.dataSource.url.indexOf("?")?"&":"/")+a,{type:"GET",url:a.length?l.replace(/\/*$/,a):l,pvtData:C})},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)}])});

@@ -11,3 +11,3 @@ var __extends = (this && this.__extends) || (function () {

})();
import { merge, extend, isNullOrUndefined, setValue } from '@syncfusion/ej2-base/util';
import { merge, extend, isNullOrUndefined, setValue } from '@syncfusion/ej2-base';
import { DataUtil } from './util';

@@ -14,0 +14,0 @@ import { Query, Predicate } from './query';

import { Ajax } from '@syncfusion/ej2-base';
import { extend, isNullOrUndefined } from '@syncfusion/ej2-base/util';
import { extend, isNullOrUndefined } from '@syncfusion/ej2-base';
import { DataUtil } from './util';

@@ -4,0 +4,0 @@ import { Query } from './query';

@@ -1,2 +0,2 @@

import { isNullOrUndefined } from '@syncfusion/ej2-base/util';
import { isNullOrUndefined } from '@syncfusion/ej2-base';
import { DataManager } from './manager';

@@ -3,0 +3,0 @@ import { Query } from './query';

{
"name": "@syncfusion/ej2-data",
"version": "1.0.11",
"description": "Syncfusion TypeScript DataManager",
"version": "1.0.14",
"description": "Essential JS 2 DataManager",
"author": "Syncfusion Inc.",

@@ -9,3 +9,3 @@ "license": "SEE LICENSE IN license",

"dependencies": {
"@syncfusion/ej2-base": "^1.0.11"
"@syncfusion/ej2-base": "^1.0.14"
},

@@ -12,0 +12,0 @@ "devDependencies": {

@@ -11,3 +11,3 @@ var __extends = (this && this.__extends) || (function () {

})();
define(["require", "exports", "@syncfusion/ej2-base/util", "./util", "./query"], function (require, exports, util_1, util_2, query_1) {
define(["require", "exports", "@syncfusion/ej2-base", "./util", "./query"], function (require, exports, ej2_base_1, util_1, query_1) {
"use strict";

@@ -101,3 +101,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

JsonAdaptor.prototype.onAggregates = function (ds, e) {
var fn = util_2.DataUtil.aggregates[e.type];
var fn = util_1.DataUtil.aggregates[e.type];
if (!ds || !fn || ds.length === 0) {

@@ -113,7 +113,7 @@ return null;

if (e.fieldNames.length === 0) {
util_2.DataUtil.getFieldList(ds[0], e.fieldNames);
util_1.DataUtil.getFieldList(ds[0], e.fieldNames);
}
return ds.filter(function (obj) {
for (var j = 0; j < e.fieldNames.length; j++) {
if (e.comparer.call(obj, util_2.DataUtil.getObject(e.fieldNames[j], obj), e.searchKey, e.ignoreCase)) {
if (e.comparer.call(obj, util_1.DataUtil.getObject(e.fieldNames[j], obj), e.searchKey, e.ignoreCase)) {
return true;

@@ -130,3 +130,3 @@ }

var fnCompare;
var field = util_2.DataUtil.getValue(e.fieldName, query);
var field = util_1.DataUtil.getValue(e.fieldName, query);
if (!field) {

@@ -142,11 +142,11 @@ return ds.sort(e.comparer);

fnCompare = e.comparer;
if (util_2.DataUtil.endsWith(field[i], ' desc')) {
fnCompare = util_2.DataUtil.fnSort('descending');
if (util_1.DataUtil.endsWith(field[i], ' desc')) {
fnCompare = util_1.DataUtil.fnSort('descending');
field[i] = field[i].replace(' desc', '');
}
ds = util_2.DataUtil.sort(ds, field[i], fnCompare);
ds = util_1.DataUtil.sort(ds, field[i], fnCompare);
}
return ds;
}
return util_2.DataUtil.sort(ds, field, e.comparer);
return util_1.DataUtil.sort(ds, field, e.comparer);
};

@@ -163,10 +163,10 @@ JsonAdaptor.prototype.onGroup = function (ds, e, query) {

tmp = aggQuery[i].e;
agg.push({ type: tmp.type, field: util_2.DataUtil.getValue(tmp.field, query) });
agg.push({ type: tmp.type, field: util_1.DataUtil.getValue(tmp.field, query) });
}
}
return util_2.DataUtil.group(ds, util_2.DataUtil.getValue(e.fieldName, query), agg);
return util_1.DataUtil.group(ds, util_1.DataUtil.getValue(e.fieldName, query), agg);
};
JsonAdaptor.prototype.onPage = function (ds, e, query) {
var size = util_2.DataUtil.getValue(e.pageSize, query);
var start = (util_2.DataUtil.getValue(e.pageIndex, query) - 1) * size;
var size = util_1.DataUtil.getValue(e.pageSize, query);
var start = (util_1.DataUtil.getValue(e.pageIndex, query) - 1) * size;
var end = start + size;

@@ -182,3 +182,3 @@ if (!ds || !ds.length) {

}
return ds.slice(util_2.DataUtil.getValue(e.start), util_2.DataUtil.getValue(e.end));
return ds.slice(util_1.DataUtil.getValue(e.start), util_1.DataUtil.getValue(e.end));
};

@@ -189,3 +189,3 @@ JsonAdaptor.prototype.onTake = function (ds, e) {

}
return ds.slice(0, util_2.DataUtil.getValue(e.nos));
return ds.slice(0, util_1.DataUtil.getValue(e.nos));
};

@@ -196,3 +196,3 @@ JsonAdaptor.prototype.onSkip = function (ds, e) {

}
return ds.slice(util_2.DataUtil.getValue(e.nos));
return ds.slice(util_1.DataUtil.getValue(e.nos));
};

@@ -203,3 +203,3 @@ JsonAdaptor.prototype.onSelect = function (ds, e) {

}
return util_2.DataUtil.select(ds, util_2.DataUtil.getValue(e.fieldNames));
return util_1.DataUtil.select(ds, util_1.DataUtil.getValue(e.fieldNames));
};

@@ -231,3 +231,3 @@ JsonAdaptor.prototype.insert = function (dm, data) {

}
return i < ds.length ? util_1.merge(ds[i], value) : null;
return i < ds.length ? ej2_base_1.merge(ds[i], value) : null;
};

@@ -254,4 +254,4 @@ return JsonAdaptor;

temp = singles.onPage;
skip = util_2.DataUtil.getValue(temp.pageIndex, query);
take = util_2.DataUtil.getValue(temp.pageSize, query);
skip = util_1.DataUtil.getValue(temp.pageIndex, query);
take = util_1.DataUtil.getValue(temp.pageSize, query);
skip = (skip - 1) * take;

@@ -265,4 +265,4 @@ }

for (var i = 0; i < queries.sorts.length; i++) {
temp = util_2.DataUtil.getValue(queries.sorts[i].e.fieldName, query);
request.sorts.push(util_2.DataUtil.callAdaptorFunction(this, 'onEachSort', { name: temp, direction: queries.sorts[i].e.direction }, query));
temp = util_1.DataUtil.getValue(queries.sorts[i].e.fieldName, query);
request.sorts.push(util_1.DataUtil.callAdaptorFunction(this, 'onEachSort', { name: temp, direction: queries.sorts[i].e.direction }, query));
}

@@ -272,11 +272,11 @@ if (hierarchyFilters) {

if (temp) {
request.filters.push(util_2.DataUtil.callAdaptorFunction(this, 'onEachWhere', temp.toJson(), query));
request.filters.push(util_1.DataUtil.callAdaptorFunction(this, 'onEachWhere', temp.toJson(), query));
}
}
for (var i = 0; i < queries.filters.length; i++) {
request.filters.push(util_2.DataUtil.callAdaptorFunction(this, 'onEachWhere', queries.filters[i].e.toJson(), query));
request.filters.push(util_1.DataUtil.callAdaptorFunction(this, 'onEachWhere', queries.filters[i].e.toJson(), query));
var keys_1 = typeof request.filters[i] === 'object' ? Object.keys(request.filters[i]) : [];
for (var _i = 0, keys_2 = keys_1; _i < keys_2.length; _i++) {
var prop = keys_2[_i];
if (util_2.DataUtil.isNull((request)[prop])) {
if (util_1.DataUtil.isNull((request)[prop])) {
delete request[prop];

@@ -288,3 +288,3 @@ }

temp = queries.searches[i].e;
request.searches.push(util_2.DataUtil.callAdaptorFunction(this, 'onEachSearch', {
request.searches.push(util_1.DataUtil.callAdaptorFunction(this, 'onEachSearch', {
fields: temp.fieldNames,

@@ -297,15 +297,15 @@ operator: temp.operator,

for (var i = 0; i < queries.groups.length; i++) {
request.groups.push(util_2.DataUtil.getValue(queries.groups[i].e.fieldName, query));
request.groups.push(util_1.DataUtil.getValue(queries.groups[i].e.fieldName, query));
}
for (var i = 0; i < queries.aggregates.length; i++) {
temp = queries.aggregates[i].e;
request.aggregates.push({ type: temp.type, field: util_2.DataUtil.getValue(temp.field, query) });
request.aggregates.push({ type: temp.type, field: util_1.DataUtil.getValue(temp.field, query) });
}
var req = {};
this.getRequestQuery(options, query, singles, request, req);
util_2.DataUtil.callAdaptorFunction(this, 'addParams', { dm: dm, query: query, params: params, reqParams: req });
util_1.DataUtil.callAdaptorFunction(this, 'addParams', { dm: dm, query: query, params: params, reqParams: req });
var keys = Object.keys(req);
for (var _a = 0, keys_3 = keys; _a < keys_3.length; _a++) {
var prop = keys_3[_a];
if (util_2.DataUtil.isNull(req[prop]) || req[prop] === '' || req[prop].length === 0) {
if (util_1.DataUtil.isNull(req[prop]) || req[prop] === '' || req[prop].length === 0) {
delete req[prop];

@@ -315,4 +315,4 @@ }

if (!(options.skip in req && options.take in req) && take !== null) {
req[options.skip] = util_2.DataUtil.callAdaptorFunction(this, 'onSkip', skip, query);
req[options.take] = util_2.DataUtil.callAdaptorFunction(this, 'onTake', take, query);
req[options.skip] = util_1.DataUtil.callAdaptorFunction(this, 'onSkip', skip, query);
req[options.take] = util_1.DataUtil.callAdaptorFunction(this, 'onTake', take, query);
}

@@ -344,15 +344,15 @@ var p = this.pvt;

req[options.select] = 'onSelect' in singles ?
util_2.DataUtil.callAdaptorFunction(this, 'onSelect', util_2.DataUtil.getValue(singles.onSelect.fieldNames, query), query) : '';
req[options.count] = query.requiresCounts ? util_2.DataUtil.callAdaptorFunction(this, 'onCount', query.requiresCounts, query) : '';
req[options.search] = request.searches.length ? util_2.DataUtil.callAdaptorFunction(this, 'onSearch', request.searches, query) : '';
util_1.DataUtil.callAdaptorFunction(this, 'onSelect', util_1.DataUtil.getValue(singles.onSelect.fieldNames, query), query) : '';
req[options.count] = query.requiresCounts ? util_1.DataUtil.callAdaptorFunction(this, 'onCount', query.requiresCounts, query) : '';
req[options.search] = request.searches.length ? util_1.DataUtil.callAdaptorFunction(this, 'onSearch', request.searches, query) : '';
req[options.skip] = 'onSkip' in singles ?
util_2.DataUtil.callAdaptorFunction(this, 'onSkip', util_2.DataUtil.getValue(singles.onSkip.nos, query), query) : '';
util_1.DataUtil.callAdaptorFunction(this, 'onSkip', util_1.DataUtil.getValue(singles.onSkip.nos, query), query) : '';
req[options.take] = 'onTake' in singles ?
util_2.DataUtil.callAdaptorFunction(this, 'onTake', util_2.DataUtil.getValue(singles.onTake.nos, query), query) : '';
util_1.DataUtil.callAdaptorFunction(this, 'onTake', util_1.DataUtil.getValue(singles.onTake.nos, query), query) : '';
req[options.where] = request.filters.length || request.searches.length ?
util_2.DataUtil.callAdaptorFunction(this, 'onWhere', request.filters, query) : '';
req[options.sortBy] = request.sorts.length ? util_2.DataUtil.callAdaptorFunction(this, 'onSortBy', request.sorts, query) : '';
req[options.group] = request.groups.length ? util_2.DataUtil.callAdaptorFunction(this, 'onGroup', request.groups, query) : '';
util_1.DataUtil.callAdaptorFunction(this, 'onWhere', request.filters, query) : '';
req[options.sortBy] = request.sorts.length ? util_1.DataUtil.callAdaptorFunction(this, 'onSortBy', request.sorts, query) : '';
req[options.group] = request.groups.length ? util_1.DataUtil.callAdaptorFunction(this, 'onGroup', request.groups, query) : '';
req[options.aggregates] = request.aggregates.length ?
util_2.DataUtil.callAdaptorFunction(this, 'onAggregates', request.aggregates, query) : '';
util_1.DataUtil.callAdaptorFunction(this, 'onAggregates', request.aggregates, query) : '';
req[param] = [];

@@ -385,3 +385,3 @@ };

this.getAggregateResult(pvt, data, args, groupDs);
return util_2.DataUtil.isNull(args.count) ? args.result : { result: args.result, count: args.count, aggregates: args.aggregates };
return util_1.DataUtil.isNull(args.count) ? args.result : { result: args.result, count: args.count, aggregates: args.aggregates };
};

@@ -460,3 +460,3 @@ UrlAdaptor.prototype.onGroup = function (e) {

if (typeof data[0] === 'object') {
value = util_2.DataUtil.getObject(pKey || prop, data[i]);
value = util_1.DataUtil.getObject(pKey || prop, data[i]);
}

@@ -484,3 +484,3 @@ else {

for (var i = 0; i < agg.length; i++) {
fn = util_2.DataUtil.aggregates[agg[i].type];
fn = util_1.DataUtil.aggregates[agg[i].type];
if (fn) {

@@ -496,6 +496,6 @@ res[agg[i].field + ' - ' + agg[i].type] = fn(aggregateData, agg[i].field);

var level = null;
if (!util_1.isNullOrUndefined(groupDs)) {
groupDs = util_2.DataUtil.group(groupDs, groups[i]);
if (!ej2_base_1.isNullOrUndefined(groupDs)) {
groupDs = util_1.DataUtil.group(groupDs, groups[i]);
}
pData = util_2.DataUtil.group(pData, groups[i], pvt.aggregates, level, groupDs);
pData = util_1.DataUtil.group(pData, groups[i], pvt.aggregates, level, groupDs);
}

@@ -539,3 +539,3 @@ args.result = pData;

var _this = _super !== null && _super.apply(this, arguments) || this;
_this.options = util_1.extend({}, _this.options, {
_this.options = ej2_base_1.extend({}, _this.options, {
requestType: 'get',

@@ -569,3 +569,3 @@ accept: 'application/json;odata=light;q=1,application/json;odata=verbose;q=0.5',

if (val instanceof Date) {
val = 'datetime\'' + util_2.DataUtil.parse.replacer(val) + '\'';
val = 'datetime\'' + util_1.DataUtil.parse.replacer(val) + '\'';
}

@@ -577,3 +577,3 @@ if (type === 'string') {

}
if (util_2.DataUtil.parse.isGuid(val)) {
if (util_1.DataUtil.parse.isGuid(val)) {
guid = 'guid';

@@ -588,3 +588,3 @@ }

}
operator = util_2.DataUtil.odBiOperator[predicate.operator];
operator = util_1.DataUtil.odBiOperator[predicate.operator];
if (operator) {

@@ -598,3 +598,3 @@ returnValue += field;

}
operator = util_2.DataUtil.odUniOperator[predicate.operator];
operator = util_1.DataUtil.odUniOperator[predicate.operator];
if (operator === 'substringof') {

@@ -631,3 +631,3 @@ var temp = val;

if (e.fields && e.fields.length === 0) {
util_2.DataUtil.throwError('Query() - Search : oData search requires list of field names to search');
util_1.DataUtil.throwError('Query() - Search : oData search requires list of field names to search');
}

@@ -677,3 +677,3 @@ var filter = this.pvt.search || [];

ODataAdaptor.prototype.beforeSend = function (dm, request, settings) {
if (util_2.DataUtil.endsWith(settings.url, this.options.batch) && settings.type.toLowerCase() === 'post') {
if (util_1.DataUtil.endsWith(settings.url, this.options.batch) && settings.type.toLowerCase() === 'post') {
request.setRequestHeader('Accept', this.options.multipartAccept);

@@ -691,8 +691,8 @@ request.setRequestHeader('DataServiceVersion', '2.0');

var pvtData = 'pvtData';
if (!util_1.isNullOrUndefined(data.d)) {
if (!ej2_base_1.isNullOrUndefined(data.d)) {
var dataCopy = (query && query.requiresCounts) ? data.d.results : data.d;
var metaData = '__metadata';
if (!util_1.isNullOrUndefined(dataCopy)) {
if (!ej2_base_1.isNullOrUndefined(dataCopy)) {
for (var i = 0; i < dataCopy.length; i++) {
if (!util_1.isNullOrUndefined(dataCopy[i][metaData])) {
if (!ej2_base_1.isNullOrUndefined(dataCopy[i][metaData])) {
delete dataCopy[i][metaData];

@@ -736,3 +736,3 @@ }

this.getAggregateResult(pvt, data, args);
return util_2.DataUtil.isNull(count) ? args.result : { result: args.result, count: args.count, aggregates: args.aggregates };
return util_1.DataUtil.isNull(count) ? args.result : { result: args.result, count: args.count, aggregates: args.aggregates };
};

@@ -780,3 +780,3 @@ ODataAdaptor.prototype.convertToQueryString = function (request, query, dm) {

ODataAdaptor.prototype.batchRequest = function (dm, changes, e) {
var initialGuid = e.guid = util_2.DataUtil.getGuid(this.options.batchPre);
var initialGuid = e.guid = util_1.DataUtil.getGuid(this.options.batchPre);
var url = dm.dataSource.url.replace(/\/*$/, '/' + this.options.batch);

@@ -787,3 +787,3 @@ var args = {

cid: 1,
cSet: util_2.DataUtil.getGuid(this.options.changeSet)
cSet: util_1.DataUtil.getGuid(this.options.changeSet)
};

@@ -866,3 +866,3 @@ var req = '--' + initialGuid + '\n';

}
if (request && this.options.batch && util_2.DataUtil.endsWith(request.url, this.options.batch) && request.type.toLowerCase() === 'post') {
if (request && this.options.batch && util_1.DataUtil.endsWith(request.url, this.options.batch) && request.type.toLowerCase() === 'post') {
var guid = xhr.getResponseHeader('Content-Type');

@@ -889,4 +889,4 @@ var cIdx = void 0;

if (changes.addedRecords[cIdx]) {
jsonObj = util_2.DataUtil.parse.parseJson(/^\{.+\}/m.exec(data[i])[0]);
util_1.extend({}, changes.addedRecords[cIdx], this.processResponse(jsonObj));
jsonObj = util_1.DataUtil.parse.parseJson(/^\{.+\}/m.exec(data[i])[0]);
ej2_base_1.extend({}, changes.addedRecords[cIdx], this.processResponse(jsonObj));
}

@@ -905,3 +905,3 @@ }

var _this = _super !== null && _super.apply(this, arguments) || this;
_this.options = util_1.extend({}, _this.options, {
_this.options = ej2_base_1.extend({}, _this.options, {
requestType: 'get',

@@ -971,3 +971,3 @@ accept: 'application/json, text/javascript, */*; q=0.01',

this.getAggregateResult(pvt, data, args);
return util_2.DataUtil.isNull(count) ? args.result : { result: args.result, count: count, aggregates: args.aggregates };
return util_1.DataUtil.isNull(count) ? args.result : { result: args.result, count: count, aggregates: args.aggregates };
};

@@ -1015,3 +1015,3 @@ return ODataV4Adaptor;

if (query && query.requiresCounts) {
if (!util_2.DataUtil.isNull(data.Count)) {
if (!util_1.DataUtil.isNull(data.Count)) {
count = data.Count;

@@ -1028,3 +1028,3 @@ }

args.result = args.result || data;
return util_2.DataUtil.isNull(count) ? args.result : { result: args.result, count: args.count, aggregates: args.aggregates };
return util_1.DataUtil.isNull(count) ? args.result : { result: args.result, count: args.count, aggregates: args.aggregates };
};

@@ -1042,3 +1042,3 @@ return WebApiAdaptor;

var getData = 'data';
var data = util_2.DataUtil.parse.parseJson(obj[getData]);
var data = util_1.DataUtil.parse.parseJson(obj[getData]);
var result = {};

@@ -1071,6 +1071,6 @@ var value = 'value';

var _this = _super.call(this) || this;
util_1.setValue('beforeSend', UrlAdaptor.prototype.beforeSend, _this);
util_1.setValue('insert', UrlAdaptor.prototype.insert, _this);
util_1.setValue('update', UrlAdaptor.prototype.update, _this);
util_1.setValue('remove', UrlAdaptor.prototype.remove, _this);
ej2_base_1.setValue('beforeSend', UrlAdaptor.prototype.beforeSend, _this);
ej2_base_1.setValue('insert', UrlAdaptor.prototype.insert, _this);
ej2_base_1.setValue('update', UrlAdaptor.prototype.update, _this);
ej2_base_1.setValue('remove', UrlAdaptor.prototype.remove, _this);
return _this;

@@ -1113,14 +1113,14 @@ }

_this.isInsertAction = false;
if (!util_1.isNullOrUndefined(adaptor)) {
if (!ej2_base_1.isNullOrUndefined(adaptor)) {
_this.cacheAdaptor = adaptor;
}
_this.pageSize = pageSize;
_this.guidId = util_2.DataUtil.getGuid('cacheAdaptor');
_this.guidId = util_1.DataUtil.getGuid('cacheAdaptor');
var obj = { keys: [], results: [] };
window.localStorage.setItem(_this.guidId, JSON.stringify(obj));
var guid = _this.guidId;
if (!util_1.isNullOrUndefined(timeStamp)) {
if (!ej2_base_1.isNullOrUndefined(timeStamp)) {
setInterval(function () {
var data;
data = util_2.DataUtil.parse.parseJson(window.localStorage.getItem(guid));
data = util_1.DataUtil.parse.parseJson(window.localStorage.getItem(guid));
var forDel = [];

@@ -1181,3 +1181,3 @@ for (var i = 0; i < data.results.length; i++) {

var cachedItems;
cachedItems = util_2.DataUtil.parse.parseJson(window.localStorage.getItem(this.guidId));
cachedItems = util_1.DataUtil.parse.parseJson(window.localStorage.getItem(this.guidId));
var data = cachedItems ? cachedItems.results[cachedItems.keys.indexOf(key)] : null;

@@ -1193,3 +1193,3 @@ if (data != null && !this.isCrudAction && !this.isInsertAction) {

if (this.isInsertAction || (request && this.cacheAdaptor.options.batch &&
util_2.DataUtil.endsWith(request.url, this.cacheAdaptor.options.batch) && request.type.toLowerCase() === 'post')) {
util_1.DataUtil.endsWith(request.url, this.cacheAdaptor.options.batch) && request.type.toLowerCase() === 'post')) {
return this.cacheAdaptor.processResponse(data, ds, query, xhr, request, changes);

@@ -1200,3 +1200,3 @@ }

var obj = {};
obj = util_2.DataUtil.parse.parseJson(window.localStorage.getItem(this.guidId));
obj = util_1.DataUtil.parse.parseJson(window.localStorage.getItem(this.guidId));
var index = obj.keys.indexOf(key);

@@ -1216,3 +1216,3 @@ if (index !== -1) {

CacheAdaptor.prototype.beforeSend = function (dm, request, settings) {
if (util_2.DataUtil.endsWith(settings.url, this.cacheAdaptor.options.batch) && settings.type.toLowerCase() === 'post') {
if (util_1.DataUtil.endsWith(settings.url, this.cacheAdaptor.options.batch) && settings.type.toLowerCase() === 'post') {
request.setRequestHeader('Accept', this.cacheAdaptor.options.multipartAccept);

@@ -1219,0 +1219,0 @@ }

@@ -1,2 +0,2 @@

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) {
define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "./util", "./query", "./adaptors"], function (require, exports, ej2_base_1, ej2_base_2, util_1, query_1, adaptors_1) {
"use strict";

@@ -49,6 +49,6 @@ Object.defineProperty(exports, "__esModule", { value: true });

else {
util_2.DataUtil.throwError('DataManager: Invalid arguments');
util_1.DataUtil.throwError('DataManager: Invalid arguments');
}
if (data.requiresFormat === undefined && !util_2.DataUtil.isCors()) {
data.requiresFormat = util_1.isNullOrUndefined(data.crossDomain) ? true : data.crossDomain;
if (data.requiresFormat === undefined && !util_1.DataUtil.isCors()) {
data.requiresFormat = ej2_base_2.isNullOrUndefined(data.crossDomain) ? true : data.crossDomain;
}

@@ -90,6 +90,6 @@ if (data.dataType === undefined) {

if (!this.defaultQuery && !(query instanceof query_1.Query)) {
util_2.DataUtil.throwError('DataManager - executeLocal() : A query is required to execute');
util_1.DataUtil.throwError('DataManager - executeLocal() : A query is required to execute');
}
if (!this.dataSource.json) {
util_2.DataUtil.throwError('DataManager - executeLocal() : Json data is required to execute');
util_1.DataUtil.throwError('DataManager - executeLocal() : Json data is required to execute');
}

@@ -104,7 +104,7 @@ query = query || this.defaultQuery;

if (lookup && lookup instanceof Array) {
util_2.DataUtil.buildHierarchy(query.subQuery.fKey, from, res, lookup, query.subQuery.key);
util_1.DataUtil.buildHierarchy(query.subQuery.fKey, from, res, lookup, query.subQuery.key);
}
for (var j = 0; j < res.length; j++) {
if (res[j][from] instanceof Array) {
res[j] = util_1.extend({}, {}, res[j]);
res[j] = ej2_base_2.extend({}, {}, res[j]);
res[j][from] = this.adaptor.processResponse(query.subQuery.using(new DataManager(res[j][from].slice(0))).executeLocal(), this, query);

@@ -128,3 +128,3 @@ }

if (!(query instanceof query_1.Query)) {
util_2.DataUtil.throwError('DataManager - executeQuery() : A query is required to execute');
util_1.DataUtil.throwError('DataManager - executeQuery() : A query is required to execute');
}

@@ -161,3 +161,3 @@ var deffered = new Deferred();

DataManager.prototype.extendRequest = function (url, fnSuccess, fnFail) {
return util_1.extend({}, {
return ej2_base_2.extend({}, {
type: 'GET',

@@ -199,3 +199,3 @@ dataType: this.dataSource.dataType,

if (data) {
util_2.DataUtil.buildHierarchy(query.subQuery.fKey, query.subQuery.fromTable, data, subData, query.subQuery.key);
util_1.DataUtil.buildHierarchy(query.subQuery.fKey, query.subQuery.fromTable, data, subData, query.subQuery.key);
process(data, subData.count, subData.xhr);

@@ -209,3 +209,3 @@ }

if (request.httpRequest.getResponseHeader('Content-Type').indexOf('xml') === -1 && _this.dateParse) {
data = util_2.DataUtil.parse.parseJson(data);
data = util_1.DataUtil.parse.parseJson(data);
}

@@ -260,3 +260,3 @@ var result = _this.adaptor.processResponse(data, _this, query, request.httpRequest, request);

}
util_2.DataUtil.buildHierarchy(query.subQuery.fKey, query.subQuery.fromTable, pResult, cResult, query.subQuery.key);
util_1.DataUtil.buildHierarchy(query.subQuery.fKey, query.subQuery.fromTable, pResult, cResult, query.subQuery.key);
isSelector = false;

@@ -315,3 +315,3 @@ process(pResult, count, _this.requests[0].httpRequest);

DataManager.prototype.insert = function (data, tableName, query) {
data = util_2.DataUtil.parse.replacer(data);
data = util_1.DataUtil.parse.replacer(data);
if (tableName instanceof query_1.Query) {

@@ -342,3 +342,3 @@ query = tableName;

DataManager.prototype.update = function (keyField, value, tableName, query) {
value = util_2.DataUtil.parse.replacer(value);
value = util_1.DataUtil.parse.replacer(value);
if (tableName instanceof query_1.Query) {

@@ -357,3 +357,3 @@ query = tableName;

var defer = new Deferred();
res = util_1.extend({}, {
res = ej2_base_2.extend({}, {
type: 'POST',

@@ -369,3 +369,3 @@ contentType: 'application/json; charset=utf-8',

try {
util_2.DataUtil.parse.parseJson(record);
util_1.DataUtil.parse.parseJson(record);
}

@@ -375,3 +375,3 @@ catch (e) {

}
record = _this.adaptor.processResponse(util_2.DataUtil.parse.parseJson(record), _this, null, request.httpRequest, request);
record = _this.adaptor.processResponse(util_1.DataUtil.parse.parseJson(record), _this, null, request.httpRequest, request);
defer.resolve(_this, [{ record: record, dataManager: _this }]);

@@ -378,0 +378,0 @@ };

@@ -1,2 +0,2 @@

define(["require", "exports", "@syncfusion/ej2-base/util", "./manager", "./query"], function (require, exports, util_1, manager_1, query_1) {
define(["require", "exports", "@syncfusion/ej2-base", "./manager", "./query"], function (require, exports, ej2_base_1, manager_1, query_1) {
"use strict";

@@ -74,3 +74,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

var _loop_1 = function (j) {
if (!util_1.isNullOrUndefined(groupDs)) {
if (!ej2_base_1.isNullOrUndefined(groupDs)) {
var indx = -1;

@@ -111,3 +111,3 @@ var temp = groupDs.filter(function (e) { return e.key === jsonData[j].key; });

groupedArray.push(grouped[val]);
if (!util_1.isNullOrUndefined(groupDs)) {
if (!ej2_base_1.isNullOrUndefined(groupDs)) {
var tempObj = groupDs.filter(function (e) { return e.key === grouped[val].key; });

@@ -117,3 +117,3 @@ grouped[val].count = tempObj[0].count;

}
grouped[val].count = !util_1.isNullOrUndefined(groupDs) ? grouped[val].count : grouped[val].count += 1;
grouped[val].count = !ej2_base_1.isNullOrUndefined(groupDs) ? grouped[val].count : grouped[val].count += 1;
grouped[val].items.push(jsonData[i]);

@@ -132,3 +132,3 @@ };

fn = DataUtil.aggregates[aggregates[j].type];
if (!util_1.isNullOrUndefined(groupDs)) {
if (!ej2_base_1.isNullOrUndefined(groupDs)) {
var temp = groupDs.filter(function (e) { return e.key === groupedArray[i].key; });

@@ -293,3 +293,3 @@ if (fn) {

if (array.length) {
while (util_1.isNullOrUndefined(keyVal) && i < array.length) {
while (ej2_base_1.isNullOrUndefined(keyVal) && i < array.length) {
keyVal = DataUtil.getVal(array, i, field);

@@ -301,3 +301,3 @@ key = array[i++];

current = DataUtil.getVal(array, i, field);
if (util_1.isNullOrUndefined(current)) {
if (ej2_base_1.isNullOrUndefined(current)) {
continue;

@@ -441,6 +441,6 @@ }

if (ignoreCase) {
return !util_1.isNullOrUndefined(actual) && !util_1.isNullOrUndefined(expected) &&
return !ej2_base_1.isNullOrUndefined(actual) && !ej2_base_1.isNullOrUndefined(expected) &&
DataUtil.toLowerCase(actual).indexOf(DataUtil.toLowerCase(expected)) !== -1;
}
return !util_1.isNullOrUndefined(actual) && !util_1.isNullOrUndefined(expected) &&
return !ej2_base_1.isNullOrUndefined(actual) && !ej2_base_1.isNullOrUndefined(expected) &&
actual.toString().indexOf(expected) !== -1;

@@ -447,0 +447,0 @@ },

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc