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.14 to 1.0.19

dist/ej2-data.umd.min.js.map

6

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

@@ -11,2 +11,4 @@ * 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(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)}])});
!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),h=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),h},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)},h=this.extendRequest(e,d,c),f=new r.Ajax(h);if(f.beforeSend=function(){s.beforeSend(f.httpRequest,f)},h=f.send(),this.requests.push(f),i){var g=void 0,y=a.subQuerySelector.call(this,{query:a.subQuery,parent:a});y&&y.length?(g=Promise.all([h,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 h},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,n){e=o.DataUtil.parse.replacer(e),t instanceof a.Query&&(r=t,t=null);var s=this.adaptor.insert(this,e,t,r,n);return this.dataSource.offline?s:this.doAjaxRequest(s)},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,!this.dataSource.offline),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 h=this,f=0;f<u.length;f++)!function(e){var t=h.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])}(f);if(o&&o.length)for(var f=0;f<d.length;f++)!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}(f);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.odv4UniOperator={"$=":"endswith","^=":"startswith","*=":"contains",endswith:"endswith",startswith:"startswith",contains:"contains"},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,t){return s.isPlainObject(e)?s.parse.jsonReplacer(e,t):e instanceof Array?s.parse.arrayReplacer(e):e instanceof Date?s.parse.jsonReplacer({val:e},t).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,n,o,a){return r.isNullOrUndefined(a)?e.dataSource.json.push(t):e.dataSource.json.splice(a,0,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,h={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 f=0;f<i.sorts.length;f++)a=n.DataUtil.getValue(i.sorts[f].e.fieldName,t),h.sorts.push(n.DataUtil.callAdaptorFunction(this,"onEachSort",{name:a,direction:i.sorts[f].e.direction},t));r&&(a=this.getFiltersFrom(r,t))&&h.filters.push(n.DataUtil.callAdaptorFunction(this,"onEachWhere",a.toJson(),t));for(var f=0;f<i.filters.length;f++){h.filters.push(n.DataUtil.callAdaptorFunction(this,"onEachWhere",i.filters[f].e.toJson(),t));for(var g="object"==typeof h.filters[f]?Object.keys(h.filters[f]):[],y=0,v=g;y<v.length;y++){var m=v[y];n.DataUtil.isNull(h[m])&&delete h[m]}}for(var f=0;f<i.searches.length;f++)a=i.searches[f].e,h.searches.push(n.DataUtil.callAdaptorFunction(this,"onEachSearch",{fields:a.fieldNames,operator:a.operator,key:a.searchKey,ignoreCase:a.ignoreCase},t));for(var f=0;f<i.groups.length;f++)h.groups.push(n.DataUtil.getValue(i.groups[f].e.fieldName,t));for(var f=0;f<i.aggregates.length;f++)a=i.aggregates[f].e,h.aggregates.push({type:a.type,field:n.DataUtil.getValue(a.field,t)});var S={};this.getRequestQuery(d,t,u,h,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=e.call(this)||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.getModuleName=r.getValue("getModulename",t),t}return a(t,e),t.prototype.onPredicate=function(e,o,a){var s,i,u="",c=e.value,l=typeof c,p=e.field?t.getField(e.field):null;if(c instanceof Date&&(c="datetime'"+n.DataUtil.parse.replacer(c)+"'"),"string"===l&&(c="'"+c+"'",a&&(p="cast("+p+", 'Edm.String')"),n.DataUtil.parse.isGuid(c)&&(i="guid"),e.ignoreCase&&(i||(p="tolower("+p+")"),c=c.toLowerCase())),s=n.DataUtil.odBiOperator[e.operator])return u+=p,u+=s,i&&(u+=i),u+c;if(r.isNullOrUndefined(this.getModuleName)?s=n.DataUtil.odUniOperator[e.operator]:"ODataV4Adaptor"===this.getModuleName()&&(s=n.DataUtil.odv4UniOperator[e.operator]),"substringof"===s){var d=c;c=p,p=d}return u+=s+"(",u+=p+",",i&&(u+=i),u+=c+")"},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"),h=null,f=d&&parseInt(d,10)||2;if(o&&o.requiresCounts){(e.__count||e["odata.count"])&&(h=e.__count||e["odata.count"]),e.d&&(e=e.d),(e.__count||e["odata.count"])&&(h=e.__count||e["odata.count"])}3===f&&e.value&&(e=e.value),e.d&&(e=e.d),f<3&&e.results&&(e=e.results);var g={};return g.count=h,g.result=e,this.getAggregateResult(l,e,g),n.DataUtil.isNull(h)?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.getModulename=function(){return"ODataV4Adaptor"},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 h=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=h;var f=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=f}.apply(t,n))&&(e.exports=o)}])});
//# sourceMappingURL=ej2-data.umd.min.js.map

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

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

@@ -197,4 +197,9 @@ import { Query, Predicate } from './query';

};
JsonAdaptor.prototype.insert = function (dm, data) {
return dm.dataSource.json.push(data);
JsonAdaptor.prototype.insert = function (dm, data, tableName, query, position) {
if (isNullOrUndefined(position)) {
return dm.dataSource.json.push(data);
}
else {
return dm.dataSource.json.splice(position, 0, data);
}
};

@@ -518,3 +523,3 @@ JsonAdaptor.prototype.remove = function (dm, keyField, value, tableName) {

function ODataAdaptor() {
var _this = _super !== null && _super.apply(this, arguments) || this;
var _this = _super.call(this) || this;
_this.options = extend({}, _this.options, {

@@ -539,2 +544,3 @@ requestType: 'get',

});
_this.getModuleName = getValue('getModulename', _this);
return _this;

@@ -576,3 +582,10 @@ }

}
operator = DataUtil.odUniOperator[predicate.operator];
if (!isNullOrUndefined(this.getModuleName)) {
if (this.getModuleName() === 'ODataV4Adaptor') {
operator = DataUtil.odv4UniOperator[predicate.operator];
}
}
else {
operator = DataUtil.odUniOperator[predicate.operator];
}
if (operator === 'substringof') {

@@ -897,2 +910,6 @@ var temp = val;

}
ODataV4Adaptor.prototype.getModulename = function () {
return 'ODataV4Adaptor';
};
;
ODataV4Adaptor.prototype.onCount = function (e) {

@@ -899,0 +916,0 @@ return e === true ? 'true' : '';

@@ -308,3 +308,3 @@ import { Ajax } from '@syncfusion/ej2-base';

};
DataManager.prototype.insert = function (data, tableName, query) {
DataManager.prototype.insert = function (data, tableName, query, position) {
data = DataUtil.parse.replacer(data);

@@ -315,3 +315,3 @@ if (tableName instanceof Query) {

}
var req = this.adaptor.insert(this, data, tableName, query);
var req = this.adaptor.insert(this, data, tableName, query, position);
if (this.dataSource.offline) {

@@ -337,3 +337,3 @@ return req;

DataManager.prototype.update = function (keyField, value, tableName, query) {
value = DataUtil.parse.replacer(value);
value = DataUtil.parse.replacer(value, !this.dataSource.offline);
if (tableName instanceof Query) {

@@ -340,0 +340,0 @@ query = tableName;

@@ -400,2 +400,10 @@ import { isNullOrUndefined } from '@syncfusion/ej2-base';

};
DataUtil.odv4UniOperator = {
'$=': 'endswith',
'^=': 'startswith',
'*=': 'contains',
'endswith': 'endswith',
'startswith': 'startswith',
'contains': 'contains'
};
DataUtil.fnOperators = {

@@ -534,3 +542,5 @@ equal: function (actual, expected, ignoreCase) {

var arr = dupValue.split(/[^0-9]/);
value = DataUtil.parse.jsonReplacer({ value: new Date(parseInt(arr[0], 10), parseInt(arr[1], 10) - 1, parseInt(arr[2], 10), parseInt(arr[3], 10), parseInt(arr[4], 10), parseInt(arr[5], 10)) }, false).value;
value = DataUtil.parse.jsonReplacer({
value: new Date(parseInt(arr[0], 10), parseInt(arr[1], 10) - 1, parseInt(arr[2], 10), parseInt(arr[3], 10), parseInt(arr[4], 10), parseInt(arr[5], 10))
}, false).value;
}

@@ -551,5 +561,5 @@ }

},
replacer: function (value) {
replacer: function (value, stringify) {
if (DataUtil.isPlainObject(value)) {
return DataUtil.parse.jsonReplacer(value);
return DataUtil.parse.jsonReplacer(value, stringify);
}

@@ -560,3 +570,3 @@ if (value instanceof Array) {

if (value instanceof Date) {
return DataUtil.parse.jsonReplacer({ val: value }).val;
return DataUtil.parse.jsonReplacer({ val: value }, stringify).val;
}

@@ -563,0 +573,0 @@ return value;

{
"name": "@syncfusion/ej2-data",
"version": "1.0.14",
"version": "1.0.19",
"description": "Essential JS 2 DataManager",

@@ -9,3 +9,3 @@ "author": "Syncfusion Inc.",

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

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

@@ -154,4 +154,5 @@ import { Ajax } from '@syncfusion/ej2-base';

* @param {Object} data
* @param {number}  position
*/
insert(dm: DataManager, data: Object): Object;
insert(dm: DataManager, data: Object, tableName?: string, query?: Query, position?: number): Object;
/**

@@ -275,3 +276,5 @@ * Remove the data from the dataSource based on the key field value.

export declare class ODataAdaptor extends UrlAdaptor {
private getModuleName;
protected options: RemoteOptions;
constructor();
/**

@@ -443,2 +446,6 @@ * Generate request string based on the filter criteria from query.

export declare class ODataV4Adaptor extends ODataAdaptor {
/**
* @hidden
*/
protected getModulename(): string;
protected options: RemoteOptions;

@@ -445,0 +452,0 @@ /**

@@ -196,4 +196,9 @@ var __extends = (this && this.__extends) || (function () {

};
JsonAdaptor.prototype.insert = function (dm, data) {
return dm.dataSource.json.push(data);
JsonAdaptor.prototype.insert = function (dm, data, tableName, query, position) {
if (ej2_base_1.isNullOrUndefined(position)) {
return dm.dataSource.json.push(data);
}
else {
return dm.dataSource.json.splice(position, 0, data);
}
};

@@ -517,3 +522,3 @@ JsonAdaptor.prototype.remove = function (dm, keyField, value, tableName) {

function ODataAdaptor() {
var _this = _super !== null && _super.apply(this, arguments) || this;
var _this = _super.call(this) || this;
_this.options = ej2_base_1.extend({}, _this.options, {

@@ -538,2 +543,3 @@ requestType: 'get',

});
_this.getModuleName = ej2_base_1.getValue('getModulename', _this);
return _this;

@@ -575,3 +581,10 @@ }

}
operator = util_1.DataUtil.odUniOperator[predicate.operator];
if (!ej2_base_1.isNullOrUndefined(this.getModuleName)) {
if (this.getModuleName() === 'ODataV4Adaptor') {
operator = util_1.DataUtil.odv4UniOperator[predicate.operator];
}
}
else {
operator = util_1.DataUtil.odUniOperator[predicate.operator];
}
if (operator === 'substringof') {

@@ -896,2 +909,6 @@ var temp = val;

}
ODataV4Adaptor.prototype.getModulename = function () {
return 'ODataV4Adaptor';
};
;
ODataV4Adaptor.prototype.onCount = function (e) {

@@ -898,0 +915,0 @@ return e === true ? 'true' : '';

@@ -68,3 +68,3 @@ import { Ajax } from '@syncfusion/ej2-base';

*/
insert(data: Object, tableName?: string | Query, query?: Query): Object | Promise<Object>;
insert(data: Object, tableName?: string | Query, query?: Query, position?: number): Object | Promise<Object>;
/**

@@ -71,0 +71,0 @@ * Removes data from the table with the given key.

@@ -306,3 +306,3 @@ 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) {

};
DataManager.prototype.insert = function (data, tableName, query) {
DataManager.prototype.insert = function (data, tableName, query, position) {
data = util_1.DataUtil.parse.replacer(data);

@@ -313,3 +313,3 @@ if (tableName instanceof query_1.Query) {

}
var req = this.adaptor.insert(this, data, tableName, query);
var req = this.adaptor.insert(this, data, tableName, query, position);
if (this.dataSource.offline) {

@@ -335,3 +335,3 @@ return req;

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

@@ -338,0 +338,0 @@ query = tableName;

@@ -130,2 +130,9 @@ /**

};
/**
* Specifies the Object with filter operators which will be used for ODataV4 filter query generation.
* It will be used for string type filter query.
*/
static odv4UniOperator: {
[key: string]: string;
};
static fnOperators: Operators;

@@ -132,0 +139,0 @@ /**

@@ -399,2 +399,10 @@ define(["require", "exports", "@syncfusion/ej2-base", "./manager", "./query"], function (require, exports, ej2_base_1, manager_1, query_1) {

};
DataUtil.odv4UniOperator = {
'$=': 'endswith',
'^=': 'startswith',
'*=': 'contains',
'endswith': 'endswith',
'startswith': 'startswith',
'contains': 'contains'
};
DataUtil.fnOperators = {

@@ -533,3 +541,5 @@ equal: function (actual, expected, ignoreCase) {

var arr = dupValue.split(/[^0-9]/);
value = DataUtil.parse.jsonReplacer({ value: new Date(parseInt(arr[0], 10), parseInt(arr[1], 10) - 1, parseInt(arr[2], 10), parseInt(arr[3], 10), parseInt(arr[4], 10), parseInt(arr[5], 10)) }, false).value;
value = DataUtil.parse.jsonReplacer({
value: new Date(parseInt(arr[0], 10), parseInt(arr[1], 10) - 1, parseInt(arr[2], 10), parseInt(arr[3], 10), parseInt(arr[4], 10), parseInt(arr[5], 10))
}, false).value;
}

@@ -550,5 +560,5 @@ }

},
replacer: function (value) {
replacer: function (value, stringify) {
if (DataUtil.isPlainObject(value)) {
return DataUtil.parse.jsonReplacer(value);
return DataUtil.parse.jsonReplacer(value, stringify);
}

@@ -559,3 +569,3 @@ if (value instanceof Array) {

if (value instanceof Date) {
return DataUtil.parse.jsonReplacer({ val: value }).val;
return DataUtil.parse.jsonReplacer({ val: value }, stringify).val;
}

@@ -562,0 +572,0 @@ return value;

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