Socket
Socket
Sign inDemoInstall

@syncfusion/ej2-data

Package Overview
Dependencies
Maintainers
2
Versions
167
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 16.2.45 to 16.2.46

src/global.js

13

CHANGELOG.md

@@ -9,2 +9,15 @@ # Changelog

- `ODataV4` - Added preference header information while performing CRUD operations.
- `ODataV4` - Changed update type from `PUT` to `PATCH` and provided option to change type.
#### Breaking Changes
- To conform `ODataV4` standard, now update operation uses `PATCH` type instead of `PUT`. It can be changed using `updateType` option of the `ODataV4Adaptor`.
## 16.2.45 (2018-07-17)
### DataManager
#### Bug Fixes
- Predicate and shows type error with date object.

@@ -11,0 +24,0 @@

11

dist/ej2-data.umd.min.js

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@syncfusion/ej2-base")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base"],t):t(e.ej={},e.ej2Base)}(this,function(e,t){"use strict";var r=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,r,n){return(e=e||this.dataManager)?e.executeQuery(this,t,r,n):a.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.executeLocal(this):a.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.isCountRequired=this.isCountRequired,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,o,a){t=t?t.toLowerCase():null;var s=null;return"string"==typeof e?s=new n(e,t,r,o,a):e instanceof n&&(s=e),this.queries.push({fn:"onWhere",e:s}),this},e.prototype.search=function(e,t,r,n,o){"string"==typeof t&&(t=[t]),r=r||"contains";var s=a.fnOperators[r];return this.queries.push({fn:"onSearch",e:{fieldNames:t,operator:r,searchKey:e,ignoreCase:n,ignoreAccent:o,comparer:s}}),this},e.prototype.sortBy=function(t,r,n){var o,s,i="ascending";if("string"==typeof t&&a.endsWith(t.toLowerCase()," desc")&&(t=t.replace(/ desc$/i,""),r="descending"),r&&"string"!=typeof r||(i=r?r.toLowerCase():"ascending",r=a.fnSort(r)),n){o=e.filterQueries(this.queries,"onSortBy");for(var u=0;u<o.length;u++)if("string"==typeof(s=o[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:r,direction:i}}),this},e.prototype.sortByDesc=function(e){return this.sortBy(e,"descending")},e.prototype.group=function(e,t,r){return this.sortBy(e,null,!0),this.queries.push({fn:"onGroup",e:{fieldName:e,comparer:t||null,format:r||null}}),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.isCountRequired=!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}(),n=function(){function e(t,r,n,o,s){return void 0===o&&(o=!1),this.ignoreAccent=!1,this.isComplex=!1,"string"==typeof t?(this.field=t,this.operator=r.toLowerCase(),this.value=n,this.ignoreCase=o,this.ignoreAccent=s,this.isComplex=!1,this.comparer=a.fnOperators.processOperator(this.operator)):(t instanceof e&&n instanceof e||n instanceof Array)&&(this.isComplex=!0,this.condition=r.toLowerCase(),this.predicates=[t],n instanceof Array?[].push.apply(this.predicates,n):this.predicates.push(n)),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,a){return e.combine(this,t,r,n,"and",o,a)},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,a){return e.combine(this,t,r,n,"or",o,a)},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,r,n=this.predicates?this.predicates:[];if(!this.isComplex&&this.comparer)return this.comparer.call(this,a.getObject(this.field,e),this.value,this.ignoreCase,this.ignoreAccent);t="and"===this.condition;for(var o=0;o<n.length;o++)if(r=n[o].validate(e),t){if(!r)return!1}else if(r)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,ignoreAccent:this.ignoreAccent,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,r,n,o,s,i,u){return r instanceof e?e[s](t,r):"string"==typeof r?e[s](t,new e(r,n,o,i,u)):a.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,t.ignoreAccent)},e}(),o={GroupGuid:"{271bbba0-1ee7}"},a=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(t){return"ascending"===(t=t?e.toLowerCase(t):"ascending")?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){for(var r={},n=0;n<t.length;n++)r=this.setValue(t[n],this.getObject(t[n],e),r);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(r,n,a,s,i,u){s=s||1;var c=r;if(c.GroupGuid===o.GroupGuid){for(var l=function(e){if(t.isNullOrUndefined(i))c[e].items=p.group(c[e].items,n,a,c.level+1,null,u),c[e].count=c[e].items.length;else{var r=-1,o=i.filter(function(t){return t.key===c[e].key});r=i.indexOf(o[0]),c[e].items=p.group(c[e].items,n,a,c.level+1,i[r].items,u),c[e].count=i[r].count}},p=this,d=0;d<c.length;d++)l(d);return c.childLevels+=1,c}var h={},f=[];f.GroupGuid=o.GroupGuid,f.level=s,f.childLevels=0,f.records=c;for(var g=function(e){var r=y.getVal(c,e,n);if(t.isNullOrUndefined(u)||(r=u(r,n)),!h[r]&&(h[r]={key:r,count:0,items:[],aggregates:{},field:n},f.push(h[r]),!t.isNullOrUndefined(i))){var o=i.filter(function(e){return e.key===h[r].key});h[r].count=o[0].count}h[r].count=t.isNullOrUndefined(i)?h[r].count+=1:h[r].count,h[r].items.push(c[e])},y=this,v=0;v<c.length;v++)g(v);if(a&&a.length){var m=function(r){for(var n={},o=void 0,s=a,u=0;u<a.length;u++)if(o=e.aggregates[a[u].type],t.isNullOrUndefined(i))o&&(n[s[u].field+" - "+s[u].type]=o(f[r].items,s[u].field));else{var c=i.filter(function(e){return e.key===f[r].key});o&&(n[s[u].field+" - "+s[u].type]=o(c[0].items,s[u].field))}f[r].aggregates=n};for(v=0;v<f.length;v++)m(v)}return c.length&&f||c},e.buildHierarchy=function(e,t,r,n,o){var a,s={};for(n.result&&(n=n.result),n.GroupGuid&&this.throwError("DataManager: Do not have support Grouping in hierarchy"),a=0;a<n.length;a++){(s[i=this.getObject(e,n[a])]||(s[i]=[])).push(n[a])}for(a=0;a<r.length;a++){var i=this.getObject(o||e,r[a]);r[a][t]=s[i]}},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=0,a=Object.keys(e);o<a.length;o++){var s=a[o];"object"!=typeof n[s]||n[s]instanceof Array?t.push(r+s):this.getFieldList(n[s],t,r+s+".")}return t},e.getObject=function(e,t){if(!e)return t;if(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.setValue=function(e,r,n){var o,a,s=e.toString().split("."),i=n||{},u=i,c=s.length;for(o=0;o<c;o++)a=s[o],o+1===c?u[a]=void 0===r?void 0:r:t.isNullOrUndefined(u[a])&&(u[a]={}),u=u[a];return i},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.ignoreDiacritics=function(t){if("string"!=typeof t)return t;return t.split("").map(function(t){return t in e.diacritics?e.diacritics[t]:t}).join("")},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,r,n,o){if(r in e){var a=e[r](n,o);t.isNullOrUndefined(a)||(n=a)}return n},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(r,n,o){var a,s,i,u=0,c="string"==typeof e.getVal(r,0,n);if(r.length)for(;t.isNullOrUndefined(a)&&u<r.length;)a=e.getVal(r,u,n),i=r[u++];for(;u<r.length;u++)s=e.getVal(r,u,n),t.isNullOrUndefined(s)||(c&&(a=+a,s=+s),o(a,s)>0&&(a=s,i=r[u]));return i},e.distinct=function(r,n,o){o=!t.isNullOrUndefined(o)&&o;var a,s=[],i={};return r.forEach(function(t,u){(a=e.getVal(r,u,n))in i||(s.push(o?r[u]:a),i[a]=1)}),s},e.serverTimezoneOffset=null,e.throwError=function(e){try{throw new Error(e)}catch(e){throw e.message+"\n"+e.stack}},e.aggregates={sum:function(t,r){for(var n,o=0,a="number"!=typeof e.getVal(t,0,r),s=0;s<t.length;s++)n=e.getVal(t,s,r),isNaN(n)||null===n||(a&&(n=+n),o+=n);return o},average:function(t,r){return e.aggregates.sum(t,r)/t.length},min:function(t,r){var n;return"function"==typeof r&&(n=r,r=null),e.getObject(r,e.getItemFromComparer(t,r,n||e.fnAscending))},max:function(t,r){var n;return"function"==typeof r&&(n=r,r=null),e.getObject(r,e.getItemFromComparer(t,r,n||e.fnDescending))},truecount:function(e,t){return new y(e).executeLocal((new r).where(t,"equal",!0,!0)).length},falsecount:function(e,t){return new y(e).executeLocal((new r).where(t,"equal",!1,!0)).length},count:function(e,t){return e.length}},e.operatorSymbols={"<":"lessthan",">":"greaterthan","<=":"lessthanorequal",">=":"greaterthanorequal","==":"equal","!=":"notequal","*=":"contains","$=":"endswith","^=":"startswith"},e.odBiOperator={"<":" lt ",">":" gt ","<=":" le ",">=":" ge ","==":" eq ","!=":" ne ",lessthan:" lt ",lessthanorequal:" le ",greaterthan:" gt ",greaterthanorequal:" ge ",equal:" eq ",notequal:" ne "},e.odUniOperator={"$=":"endswith","^=":"startswith","*=":"substringof",endswith:"endswith",startswith:"startswith",contains:"substringof"},e.odv4UniOperator={"$=":"endswith","^=":"startswith","*=":"contains",endswith:"endswith",startswith:"startswith",contains:"contains"},e.diacritics={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"},e.fnOperators={equal:function(t,r,n,o){return o&&(t=e.ignoreDiacritics(t),r=e.ignoreDiacritics(r)),n?e.toLowerCase(t)===e.toLowerCase(r):t===r},notequal:function(t,r,n,o){return o&&(t=e.ignoreDiacritics(t),r=e.ignoreDiacritics(r)),!e.fnOperators.equal(t,r,n)},lessthan:function(t,r,n){return n?e.toLowerCase(t)<e.toLowerCase(r):t<r},greaterthan:function(t,r,n){return n?e.toLowerCase(t)>e.toLowerCase(r):t>r},lessthanorequal:function(t,r,n){return n?e.toLowerCase(t)<=e.toLowerCase(r):t<=r},greaterthanorequal:function(t,r,n){return n?e.toLowerCase(t)>=e.toLowerCase(r):t>=r},contains:function(r,n,o,a){return a&&(r=e.ignoreDiacritics(r),n=e.ignoreDiacritics(n)),o?!t.isNullOrUndefined(r)&&!t.isNullOrUndefined(n)&&-1!==e.toLowerCase(r).indexOf(e.toLowerCase(n)):!t.isNullOrUndefined(r)&&!t.isNullOrUndefined(n)&&-1!==r.toString().indexOf(n)},notnull:function(e){return null!==e},isnull:function(e){return null===e},startswith:function(t,r,n,o){return o&&(t=e.ignoreDiacritics(t),r=e.ignoreDiacritics(r)),n?t&&r&&e.startsWith(e.toLowerCase(t),e.toLowerCase(r)):t&&r&&e.startsWith(t,r)},endswith:function(t,r,n,o){return o&&(t=e.ignoreDiacritics(t),r=e.ignoreDiacritics(r)),n?t&&r&&e.endsWith(e.toLowerCase(t),e.toLowerCase(r)):t&&r&&e.endsWith(t,r)},processSymbols:function(t){var r=e.operatorSymbols[t];if(r){return e.fnOperators[r]}return e.throwError("Query - Process Operator : Invalid operator")},processOperator:function(t){var r=e.fnOperators[t];return r||e.fnOperators.processSymbols(t)}},e.parse={parseJson:function(t){return"string"==typeof t?t=JSON.parse(t,e.parse.jsonReviver):t instanceof Array?e.parse.iterateAndReviveArray(t):"object"==typeof t&&e.parse.iterateAndReviveJson(t),t},iterateAndReviveArray:function(t){for(var r=0;r<t.length;r++)"object"==typeof t[r]?e.parse.iterateAndReviveJson(t[r]):"string"!=typeof t[r]||/^[\s]*\[|^[\s]*\{|\"/g.test(t[r])?t[r]=e.parse.parseJson(t[r]):t[r]=e.parse.jsonReviver("",t[r])},iterateAndReviveJson:function(t){for(var r,n=0,o=Object.keys(t);n<o.length;n++){var a=o[n];e.startsWith(a,"__")||("object"==typeof(r=t[a])?r instanceof Array?e.parse.iterateAndReviveArray(r):r&&e.parse.iterateAndReviveJson(r):t[a]=e.parse.jsonReviver(t[a],r))}},jsonReviver:function(t,r){var n=r;if("string"==typeof r){var o=/^\/Date\(([+-]?[0-9]+)([+-][0-9]{4})?\)\/$/.exec(r);if(o)return e.dateParse.toTimeZone(new Date(parseInt(o[1],10)),e.serverTimezoneOffset,!0);if(/^(\d{4}\-\d\d\-\d\d([tT][\d:\.]*){1})([zZ]|([+\-])(\d\d):?(\d\d))?$/.test(r)){var a=n.split(/[^0-9]/);r=e.dateParse.toTimeZone(new Date(parseInt(a[0],10),parseInt(a[1],10)-1,parseInt(a[2],10),parseInt(a[3],10),parseInt(a[4],10),parseInt(a[5],10)),e.serverTimezoneOffset,!0)}}return r},isJson:function(t){return"string"==typeof t[0]?t:e.parse.parseJson(t)},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(t,r){return e.isPlainObject(t)?e.parse.jsonReplacer(t,r):t instanceof Array?e.parse.arrayReplacer(t):t instanceof Date?e.parse.jsonReplacer({val:t},r).val:t},jsonReplacer:function(t,r){for(var n,o=0,a=Object.keys(t);o<a.length;o++){var s=a[o];if((n=t[s])instanceof Date){var i=n;t[s]=e.dateParse.toTimeZone(e.dateParse.addSelfOffset(i),e.serverTimezoneOffset).toJSON()}}return t},arrayReplacer:function(t){for(var r=0;r<t.length;r++)e.isPlainObject(t[r])?t[r]=e.parse.jsonReplacer(t[r]):t[r]instanceof Date&&(t[r]=e.parse.jsonReplacer({date:t[r]}).date);return t}},e.dateParse={addSelfOffset:function(e){return new Date(+e-6e4*e.getTimezoneOffset())},toUTC:function(e){return new Date(+e+6e4*e.getTimezoneOffset())},toTimeZone:function(t,r,n){if(null===r)return t;var o=n?e.dateParse.toUTC(t):t;return new Date(+o-36e5*r)}},e}(),s=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)}}(),i=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}(),u=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return s(n,e),n.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++)r=this[(n=t.queries[u]).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.isCountRequired&&(o={result:o,count:a,aggregates:i}),o},n.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},n.prototype.onWhere=function(e,t){return e&&e.length?e.filter(function(e){if(t)return t.validate(e)}):e},n.prototype.onAggregates=function(e,t){var r=a.aggregates[t.type];return e&&r&&0!==e.length?r(e,t.field):null},n.prototype.onSearch=function(e,t){return e&&e.length?(0===t.fieldNames.length&&a.getFieldList(e[0],t.fieldNames),e.filter(function(e){for(var r=0;r<t.fieldNames.length;r++)if(t.comparer.call(e,a.getObject(t.fieldNames[r],e),t.searchKey,t.ignoreCase,t.ignoreAccent))return!0;return!1})):e},n.prototype.onSortBy=function(e,t,r){if(!e||!e.length)return e;var n,o=a.getValue(t.fieldName,r);if(!o)return e.sort(t.comparer);if(o instanceof Array){for(var s=(o=o.slice(0)).length-1;s>=0;s--)o[s]&&(n=t.comparer,a.endsWith(o[s]," desc")&&(n=a.fnSort("descending"),o[s]=o[s].replace(" desc","")),e=a.sort(e,o[s],n));return e}return a.sort(e,o,t.comparer)},n.prototype.onGroup=function(e,t,n){if(!e||!e.length)return e;var o=r.filterQueries(n.queries,"onAggregates"),s=[];if(o.length)for(var i=void 0,u=0;u<o.length;u++)i=o[u].e,s.push({type:i.type,field:a.getValue(i.field,n)});return a.group(e,a.getValue(t.fieldName,n),s,null,null,t.comparer)},n.prototype.onPage=function(e,t,r){var n=a.getValue(t.pageSize,r),o=(a.getValue(t.pageIndex,r)-1)*n,s=o+n;return e&&e.length?e.slice(o,s):e},n.prototype.onRange=function(e,t){return e&&e.length?e.slice(a.getValue(t.start),a.getValue(t.end)):e},n.prototype.onTake=function(e,t){return e&&e.length?e.slice(0,a.getValue(t.nos)):e},n.prototype.onSkip=function(e,t){return e&&e.length?e.slice(a.getValue(t.nos)):e},n.prototype.onSelect=function(e,t){return e&&e.length?a.select(e,a.getValue(t.fieldNames)):e},n.prototype.insert=function(e,r,n,o,a){return t.isNullOrUndefined(a)?e.dataSource.json.push(r):e.dataSource.json.splice(a,0,r)},n.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},n.prototype.update=function(e,r,n,o){var a,s=e.dataSource.json,i=n[r];for(a=0;a<s.length&&s[a][r]!==i;a++);return a<s.length?t.merge(s[a],n):null},n}(i),c=function(e){function o(){return null!==e&&e.apply(this,arguments)||this}return s(o,e),o.prototype.processQuery=function(e,t,n){var o,s,i=this.getQueryRequest(t),u=r.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?(o=u.onPage,s=((s=a.getValue(o.pageIndex,t))-1)*(p=a.getValue(o.pageSize,t))):"onRange"in u&&(s=(o=u.onRange).start,p=o.end-o.start);for(var f=0;f<i.sorts.length;f++)o=a.getValue(i.sorts[f].e.fieldName,t),h.sorts.push(a.callAdaptorFunction(this,"onEachSort",{name:o,direction:i.sorts[f].e.direction},t));n&&(o=this.getFiltersFrom(n,t))&&h.filters.push(a.callAdaptorFunction(this,"onEachWhere",o.toJson(),t));for(f=0;f<i.filters.length;f++){h.filters.push(a.callAdaptorFunction(this,"onEachWhere",i.filters[f].e.toJson(),t));for(var g=0,y="object"==typeof h.filters[f]?Object.keys(h.filters[f]):[];g<y.length;g++){var v=y[g];a.isNull(h[v])&&delete h[v]}}for(f=0;f<i.searches.length;f++)o=i.searches[f].e,h.searches.push(a.callAdaptorFunction(this,"onEachSearch",{fields:o.fieldNames,operator:o.operator,key:o.searchKey,ignoreCase:o.ignoreCase},t));for(f=0;f<i.groups.length;f++)h.groups.push(a.getValue(i.groups[f].e.fieldName,t));for(f=0;f<i.aggregates.length;f++)o=i.aggregates[f].e,h.aggregates.push({type:o.type,field:a.getValue(o.field,t)});var m={};this.getRequestQuery(d,t,u,h,m),a.callAdaptorFunction(this,"addParams",{dm:e,query:t,params:c,reqParams:m});for(var S=0,b=Object.keys(m);S<b.length;S++){v=b[S];(a.isNull(m[v])||""===m[v]||0===m[v].length)&&delete m[v]}d.skip in m&&d.take in m||null===p||(m[d.skip]=a.callAdaptorFunction(this,"onSkip",s,t),m[d.take]=a.callAdaptorFunction(this,"onTake",p,t));var O=this.pvt;return this.pvt={},"json"===this.options.requestType?{data:JSON.stringify(m),url:l,pvtData:O,type:"POST",contentType:"application/json; charset=utf-8"}:(o=this.convertToQueryString(m,t,e),o=(-1!==e.dataSource.url.indexOf("?")?"&":"/")+o,{type:"GET",url:o.length?l.replace(/\/*$/,o):l,pvtData:O})},o.prototype.getRequestQuery=function(e,t,r,n,o){var s=o;s[e.from]=t.fromTable,e.expand&&(s[e.expand]=t.expands),s[e.select]="onSelect"in r?a.callAdaptorFunction(this,"onSelect",a.getValue(r.onSelect.fieldNames,t),t):"",s[e.count]=t.isCountRequired?a.callAdaptorFunction(this,"onCount",t.isCountRequired,t):"",s[e.search]=n.searches.length?a.callAdaptorFunction(this,"onSearch",n.searches,t):"",s[e.skip]="onSkip"in r?a.callAdaptorFunction(this,"onSkip",a.getValue(r.onSkip.nos,t),t):"",s[e.take]="onTake"in r?a.callAdaptorFunction(this,"onTake",a.getValue(r.onTake.nos,t),t):"",s[e.where]=n.filters.length||n.searches.length?a.callAdaptorFunction(this,"onWhere",n.filters,t):"",s[e.sortBy]=n.sorts.length?a.callAdaptorFunction(this,"onSortBy",n.sorts,t):"",s[e.group]=n.groups.length?a.callAdaptorFunction(this,"onGroup",n.groups,t):"",s[e.aggregates]=n.aggregates.length?a.callAdaptorFunction(this,"onAggregates",n.aggregates,t):"",s.param=[]},o.prototype.convertToQueryString=function(e,t,r){return""},o.prototype.processResponse=function(e,t,r,n,o,s){var i=o,u=i.pvtData||{},c=e.groupDs;if(n&&n.getResponseHeader("Content-Type")&&-1!==n.getResponseHeader("Content-Type").indexOf("xml"))return r.isCountRequired?{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,r),a.isNull(p.count)?p.result:{result:p.result,count:p.count,aggregates:p.aggregates}},o.prototype.onGroup=function(e){return this.pvt.groups=e,e},o.prototype.onAggregates=function(e){this.pvt.aggregates=e},o.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]})}},o.prototype.beforeSend=function(e,t){},o.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"})}},o.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"})}},o.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})}},o.prototype.getFiltersFrom=function(e,t){var r,o=t.fKey,s=o,i=t.key,u=[];"object"!=typeof e[0]&&(s=null);for(var c=0;c<e.length;c++)r="object"==typeof e[0]?a.getObject(i||s,e[c]):e[c],u.push(new n(o,"equal",r));return n.or(u)},o.prototype.getAggregateResult=function(e,n,o,s,i){var u=n;if(n&&n.result&&(u=n.result),e&&e.aggregates&&e.aggregates.length){var c=e.aggregates,l=void 0,p=u,d={};n.aggregate&&(p=n.aggregate);for(var h=0;h<c.length;h++)(l=a.aggregates[c[h].type])&&(d[c[h].field+" - "+c[h].type]=l(p,c[h].field));o.aggregates=d}if(e&&e.groups&&e.groups.length){var f=e.groups;for(h=0;h<f.length;h++){t.isNullOrUndefined(s)||(s=a.group(s,f[h]));var g=r.filterQueries(i.queries,"onGroup")[h].e;u=a.group(u,f[h],e.aggregates,null,s,g.comparer)}o.result=u}return o},o.prototype.getQueryRequest=function(e){var t={sorts:[],groups:[],filters:[],searches:[],aggregates:[]};return t.sorts=r.filterQueries(e.queries,"onSortBy"),t.groups=r.filterQueries(e.queries,"onGroup"),t.filters=r.filterQueries(e.queries,"onWhere"),t.searches=r.filterQueries(e.queries,"onSearch"),t.aggregates=r.filterQueries(e.queries,"onAggregates"),t},o.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]}},o}(i),l=function(e){function r(){var r=e.call(this)||this;return r.options=t.extend({},r.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 "}),r.getModuleName=t.getValue("getModulename",r),r}return s(r,e),r.prototype.onPredicate=function(e,n,o){var s,i,u="",c=e.value,l=typeof c,p=e.field?r.getField(e.field):null;if(c instanceof Date&&(c="datetime'"+a.parse.replacer(c)+"'"),"string"===l&&(c="'"+c+"'",o&&(p="cast("+p+", 'Edm.String')"),a.parse.isGuid(c)&&(i="guid"),e.ignoreCase&&(i||(p="tolower("+p+")"),c=c.toLowerCase())),s=a.odBiOperator[e.operator])return u+=p,u+=s,i&&(u+=i),u+c;if(t.isNullOrUndefined(this.getModuleName)?s=a.odUniOperator[e.operator]:"ODataV4Adaptor"===this.getModuleName()&&(s=a.odv4UniOperator[e.operator]),"substringof"===s){var d=c;c=p,p=d}return u+=s+"(",u+=p+",",i&&(u+=i),u+=c+")"},r.prototype.addParams=function(t){e.prototype.addParams.call(this,t),delete t.reqParams.params},r.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+" ")},r.prototype.onEachWhere=function(e,t,r){return e.isComplex?this.onComplexPredicate(e,t,r):this.onPredicate(e,t,r)},r.prototype.onWhere=function(e){return this.pvt.search&&e.push(this.onEachWhere(this.pvt.search,null,!0)),e.join(" and ")},r.prototype.onEachSearch=function(e){e.fields&&0===e.fields.length&&a.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 n(e.fields[r],e.operator,e.key,e.ignoreCase));this.pvt.search=t},r.prototype.onSearch=function(e){return this.pvt.search=n.or(this.pvt.search),""},r.prototype.onEachSort=function(e){var t=[];if(e.name instanceof Array)for(var n=0;n<e.name.length;n++)t.push(r.getField(e.name[n])+("descending"===e.direction?" desc":""));else t.push(r.getField(e.name)+("descending"===e.direction?" desc":""));return t.join(",")},r.prototype.onSortBy=function(e){return e.reverse().join(",")},r.prototype.onGroup=function(e){return this.pvt.groups=e,[]},r.prototype.onSelect=function(e){for(var t=0;t<e.length;t++)e[t]=r.getField(e[t]);return e.join(",")},r.prototype.onAggregates=function(e){return this.pvt.aggregates=e,""},r.prototype.onCount=function(e){return!0===e?"allpages":""},r.prototype.beforeSend=function(e,t,r){a.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")},r.prototype.processResponse=function(e,r,n,o,s,i){if(!t.isNullOrUndefined(e.d)){var u=n&&n.isCountRequired?e.d.results:e.d;if(!t.isNullOrUndefined(u))for(var c=0;c<u.length;c++)t.isNullOrUndefined(u[c].__metadata)||delete u[c].__metadata}var l=s&&s.pvtData,p=this.processBatchResponse(e,n,o,s,i);if(p)return p;var d=o&&s.getResponseHeader("DataServiceVersion"),h=null,f=d&&parseInt(d,10)||2;if(n&&n.isCountRequired){var g="__count";(e[g]||e["odata.count"])&&(h=e[g]||e["odata.count"]),e.d&&(e=e.d),(e[g]||e["odata.count"])&&(h=e[g]||e["odata.count"])}3===f&&e.value&&(e=e.value),e.d&&(e=e.d),f<3&&e.results&&(e=e.results);var y={};return y.count=h,y.result=e,this.getAggregateResult(l,e,y,null,n),a.isNull(h)?y.result:{result:y.result,count:y.count,aggregates:y.aggregates}},r.prototype.convertToQueryString=function(e,t,r){var n=[],o=e.table||"";delete e.table,r.dataSource.requiresFormat&&(e.$format="json");for(var a=0,s=Object.keys(e);a<s.length;a++){var i=s[a];n.push(i+"="+e[i])}return n=n.join("&"),r.dataSource.url&&-1!==r.dataSource.url.indexOf("?")&&!o?n:n.length?o+"?"+n:o||""},r.prototype.insert=function(e,t,r){return{url:e.dataSource.url.replace(/\/*$/,r?"/"+r:""),data:JSON.stringify(t)}},r.prototype.remove=function(e,t,r,n){return{type:"DELETE",url:e.dataSource.url.replace(/\/*$/,n?"/"+n:"")+"("+r+")"}},r.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}},r.prototype.batchRequest=function(e,t,r){var n=r.guid=a.getGuid(this.options.batchPre),o=e.dataSource.url.replace(/\/*$/,"/"+this.options.batch),s={url:r.url,key:r.key,cid:1,cSet:a.getGuid(this.options.changeSet)},i="--"+n+"\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+="--"+n+"--",{type:"POST",url:o,dataType:"json",contentType:"multipart/mixed; charset=UTF-8;boundary="+n,data:i}},r.prototype.generateDeleteRequest=function(e,t){if(!e)return"";return this.generateBodyContent(e,t,{method:"DELETE ",url:function(e,t,r){return"("+e[t][r]+")"},data:function(e,t){return""}})+"\n"},r.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)},r.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)},r.getField=function(e){return e.replace(/\./g,"/")},r.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},r.prototype.processBatchResponse=function(e,r,n,o,s){if(n&&n.getResponseHeader("Content-Type")&&-1!==n.getResponseHeader("Content-Type").indexOf("xml"))return r.isCountRequired?{result:[],count:0}:[];if(o&&this.options.batch&&a.endsWith(o.url,this.options.batch)&&"post"===o.type.toLowerCase()){var i=n.getResponseHeader("Content-Type"),u=void 0,c=void 0,l=e+"";if(i=i.substring(i.indexOf("=batchresponse")+1),(l=l.split(i)).length<2)return{};l=l[1];var p=/(?:\bContent-Type.+boundary=)(changesetresponse.+)/i.exec(l);p&&l.replace(p[0],"");for(var d=p?p[1]:"",h=(l=l.split(d)).length;h>-1;h--)/\bContent-ID:/i.test(l[h])&&/\bHTTP.+201/.test(l[h])&&(u=parseInt(/\bContent-ID: (\d+)/i.exec(l[h])[1],10),s.addedRecords[u]&&(c=a.parse.parseJson(/^\{.+\}/m.exec(l[h])[0]),t.extend({},s.addedRecords[u],this.processResponse(c))));return s}return null},r}(c),p=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.options=t.extend({},r.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 "}),r}return s(r,e),r.prototype.getModulename=function(){return"ODataV4Adaptor"},r.prototype.onCount=function(e){return!0===e?"true":""},r.prototype.onPredicate=function(t,r,n){var o="",a=t.value instanceof Date;return o=e.prototype.onPredicate.call(this,t,r,n),a&&(o=o.replace(/datetime'(.*)'$/,"$1")),o},r.prototype.onEachSearch=function(e){var t=this.pvt.searches||[];t.push(e.key),this.pvt.searches=t},r.prototype.onSearch=function(e){return this.pvt.searches.join(" OR ")},r.prototype.beforeSend=function(e,t,r){t.setRequestHeader("Accept",this.options.accept)},r.prototype.processResponse=function(t,r,n,o,s,i){var u=s&&s.pvtData,c=e.prototype.processBatchResponse.call(this,t,n,o,s,i);if(c)return c;var l=null;n&&n.isCountRequired&&"@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,null,n),a.isNull(l)?p.result:{result:p.result,count:l,aggregates:p.aggregates}},r}(l),d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return s(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,n,o,s){var i=o&&o.pvtData,u=null,c={};if(o&&"post"!==o.type.toLowerCase()){var l=n&&o.getResponseHeader("DataServiceVersion"),p=l&&parseInt(l,10)||2;r&&r.isCountRequired&&(a.isNull(e.Count)||(u=e.Count)),p<3&&e.Items&&(e=e.Items),c.count=u,c.result=e,this.getAggregateResult(i,e,c,null,r)}return c.result=c.result||e,a.isNull(u)?c.result:{result:c.result,count:c.count,aggregates:c.aggregates}},t}(l),h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return s(t,e),t.prototype.processQuery=function(e,t,r){var n=(new c).processQuery(e,t,r),o=a.parse.parseJson(n.data),s={};if(o.param)for(var i=0;i<o.param.length;i++){var u=o.param[i],l=Object.keys(u)[0];s[l]=u[l]}s.value=o;return{data:JSON.stringify(s),url:n.url,pvtData:n.pvtData,type:"POST",contentType:"application/json; charset=utf-8"}},t}(c),f=function(e){function r(){var r=e.call(this)||this;return t.setValue("beforeSend",c.prototype.beforeSend,r),r}return s(r,e),r.prototype.insert=function(t,r,n){return e.prototype.insert.call(this,t,r,null,null,0),{url:t.dataSource.insertUrl||t.dataSource.crudUrl||t.dataSource.url,data:JSON.stringify({value:r,table:n,action:"insert"})}},r.prototype.remove=function(t,r,n,o){return e.prototype.remove.call(this,t,r,n),{type:"POST",url:t.dataSource.removeUrl||t.dataSource.crudUrl||t.dataSource.url,data:JSON.stringify({key:n,keyColumn:r,table:o,action:"remove"})}},r.prototype.update=function(t,r,n,o){return e.prototype.update.call(this,t,r,n),{type:"POST",url:t.dataSource.updateUrl||t.dataSource.crudUrl||t.dataSource.url,data:JSON.stringify({value:n,action:"update",keyColumn:r,key:n[r],table:o})}},r.prototype.batchRequest=function(e,t,r){var n;for(n=0;n<t.addedRecords.length;n++)u.prototype.insert(e,t.addedRecords[n]);for(n=0;n<t.changedRecords.length;n++)u.prototype.update(e,r.key,t.changedRecords[n]);for(n=0;n<t.deletedRecords.length;n++)u.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})}},r}(u),g=function(e){function n(r,n,o){var s=e.call(this)||this;s.isCrudAction=!1,s.isInsertAction=!1,t.isNullOrUndefined(r)||(s.cacheAdaptor=r),s.pageSize=o,s.guidId=a.getGuid("cacheAdaptor");window.localStorage.setItem(s.guidId,JSON.stringify({keys:[],results:[]}));var i=s.guidId;return t.isNullOrUndefined(n)||setInterval(function(){var e;e=a.parse.parseJson(window.localStorage.getItem(i));for(var t=[],r=0;r<e.results.length;r++){var o=+new Date,s=+new Date(e.results[r].timeStamp);e.results[r].timeStamp=o-s,o-s>n&&t.push(r)}for(r=0;r<t.length;r++)e.results.splice(t[r],1),e.keys.splice(t[r],1);window.localStorage.removeItem(i),window.localStorage.setItem(i,JSON.stringify(e))},n),s}return s(n,e),n.prototype.generateKey=function(e,t){var n=this.getQueryRequest(t),o=r.filterQueryLists(t.queries,["onSelect","onPage","onSkip","onTake","onRange"]),a=e;"onPage"in o&&(a+=o.onPage.pageIndex),n.sorts.forEach(function(e){a+=e.e.direction+e.e.fieldName}),n.groups.forEach(function(e){a+=e.e.fieldName}),n.searches.forEach(function(e){a+=e.e.searchKey});for(var s=0;s<n.filters.length;s++){var i=n.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},n.prototype.processQuery=function(e,t,r){var n,o=this.generateKey(e.dataSource.url,t),s=(n=a.parse.parseJson(window.localStorage.getItem(this.guidId)))?n.results[n.keys.indexOf(o)]: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},n.prototype.processResponse=function(e,t,r,n,o,s){if(this.isInsertAction||o&&this.cacheAdaptor.options.batch&&a.endsWith(o.url,this.cacheAdaptor.options.batch)&&"post"===o.type.toLowerCase())return this.cacheAdaptor.processResponse(e,t,r,n,o,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={},c=(u=a.parse.parseJson(window.localStorage.getItem(this.guidId))).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},n.prototype.beforeSend=function(e,t,r){a.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)},n.prototype.update=function(e,t,r,n){return this.isCrudAction=!0,this.cacheAdaptor.update(e,t,r,n)},n.prototype.insert=function(e,t,r){return this.isInsertAction=!0,this.cacheAdaptor.insert(e,t,r)},n.prototype.remove=function(e,t,r,n){return this.isCrudAction=!0,this.cacheAdaptor.remove(e,t,r,n)},n.prototype.batchRequest=function(e,t,r){return this.cacheAdaptor.batchRequest(e,t,r)},n}(c),y=function(){function e(e,n,o){var s=this;this.dateParse=!0,this.requests=[],e||this.dataSource||(e=[]),o=o||e.adaptor;var i;return e instanceof Array?i={json:e,offline:!0}:"object"==typeof e?(e.json||(e.json=[]),i={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 f)&&!e.url,requiresFormat:e.requiresFormat}):a.throwError("DataManager: Invalid arguments"),void 0!==i.requiresFormat||a.isCors()||(i.requiresFormat=!!t.isNullOrUndefined(i.crossDomain)||i.crossDomain),void 0===i.dataType&&(i.dataType="json"),this.dataSource=i,this.defaultQuery=n,i.url&&i.offline&&!i.json.length?(this.isDataAvailable=!1,this.adaptor=o||new l,this.dataSource.offline=!1,this.ready=this.executeQuery(n||new r),this.ready.then(function(e){s.dataSource.offline=!0,s.isDataAvailable=!0,i.json=e.result,s.adaptor=new u})):this.adaptor=i.offline?new u:new l,!i.jsonp&&this.adaptor instanceof l&&(i.jsonp="callback"),this.adaptor=o||this.adaptor,i.enableCaching&&(this.adaptor=new g(this.adaptor,i.timeTillExpiration,i.cachingPageSize)),this}return e.prototype.setDefaultQuery=function(e){return this.defaultQuery=e,this},e.prototype.executeLocal=function(n){this.defaultQuery||n instanceof r||a.throwError("DataManager - executeLocal() : A query is required to execute"),this.dataSource.json||a.throwError("DataManager - executeLocal() : Json data is required to execute"),n=n||this.defaultQuery;var o=this.adaptor.processQuery(this,n);if(n.subQuery){var s=n.subQuery.fromTable,i=n.subQuery.lookups,u=n.isCountRequired?o.result:o;i&&i instanceof Array&&a.buildHierarchy(n.subQuery.fKey,s,u,i,n.subQuery.key);for(var c=0;c<u.length;c++)u[c][s]instanceof Array&&(u[c]=t.extend({},{},u[c]),u[c][s]=this.adaptor.processResponse(n.subQuery.using(new e(u[c][s].slice(0))).executeLocal(),this,n))}return this.adaptor.processResponse(o,this,n)},e.prototype.executeQuery=function(t,n,o,s){var i=this;"function"==typeof t&&(s=o,o=n,n=t,t=null),t||(t=this.defaultQuery),t instanceof r||a.throwError("DataManager - executeQuery() : A query is required to execute");var u=new v,c={query:t};if(this.dataSource.offline||void 0===this.dataSource.url)e.nextTick(function(){var r=i.executeLocal(t);c=e.getDeferedArgs(t,r,c),u.resolve(c)});else{var l=this.adaptor.processQuery(this,t);this.makeRequest(l,u,c,t)}return(n||o)&&u.promise.then(n,o),s&&u.promise.then(s,s),u.promise},e.getDeferedArgs=function(e,t,r){return e.isCountRequired?(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,r,n){return t.extend({},{type:"GET",dataType:this.dataSource.dataType,crossDomain:this.dataSource.crossDomain,jsonp:this.dataSource.jsonp,cache:!0,processData:!1,onSuccess:r,onFailure:n},e)},e.prototype.makeRequest=function(e,r,n,o){var s=this,i=!!o.subQuerySelector,u=function(e){n.error=e,r.reject(n)},c=function(e,t,o,a,s,i,u){n.xhr=o,n.count=t?parseInt(t.toString(),10):0,n.result=e,n.request=a,n.aggregates=i,n.actual=s,n.virtualSelectRecords=u,r.resolve(n)},l=function(e,t){var r=new v,l={parent:n};o.subQuery.isChild=!0;var p=s.adaptor.processQuery(s,o.subQuery,e?s.adaptor.processResponse(e):t),d=s.makeRequest(p,r,l,o.subQuery);return i||r.then(function(t){e&&(a.buildHierarchy(o.subQuery.fKey,o.subQuery.fromTable,e,t,o.subQuery.key),c(e,t.count,t.xhr))},u),d},p=this.extendRequest(e,function(e,t){-1===t.httpRequest.getResponseHeader("Content-Type").indexOf("xml")&&s.dateParse&&(e=a.parse.parseJson(e));var r=s.adaptor.processResponse(e,s,o,t.httpRequest,t),n=0,u=null,p=e.virtualSelectRecords;o.isCountRequired&&(n=r.count,u=r.aggregates,r=r.result),o.subQuery?i||l(r,t):c(r,n,t.httpRequest,t.type,e,u,p)},u),d=new t.Ajax(p);if(d.beforeSend=function(){s.beforeSend(d.httpRequest,d)},(p=d.send()).catch(function(e){return!0}),this.requests.push(d),i){var h=o.subQuerySelector.call(this,{query:o.subQuery,parent:o});h&&h.length?Promise.all([p,l(null,h)]).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,o,s.requests[0].httpRequest,s.requests[0]),u=0;o.isCountRequired&&(u=n.count,n=n.result);var l=s.adaptor.processResponse(r[1],s,o.subQuery,s.requests[1].httpRequest,s.requests[1]);u=0,o.subQuery.isCountRequired&&(u=l.count,l=l.result),a.buildHierarchy(o.subQuery.fKey,o.subQuery.fromTable,n,l,o.subQuery.key),i=!1,c(n,u,s.requests[0].httpRequest)}):i=!1}return p},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=0,s=Object.keys(n[o]);a<s.length;a++){var i=s[a];r.push(i),e.setRequestHeader(i,n[o][i])}}},e.prototype.saveChanges=function(e,n,o,s){var i=this;o instanceof r&&(s=o,o=null);var u={url:o,key:n||this.dataSource.key},c=this.adaptor.batchRequest(this,e,u,s);if(this.dataSource.offline)return c;var l=new v,p=new t.Ajax(c);return p.beforeSend=function(){i.beforeSend(p.httpRequest,p)},p.onSuccess=function(t,r){l.resolve(i.adaptor.processResponse(a.parse.parseJson(t),i,null,r.httpRequest,r,e))},p.onFailure=function(e){l.reject([{error:e}])},p.send().catch(function(e){return!0}),l.promise},e.prototype.insert=function(e,t,n,o){t instanceof r&&(n=t,t=null);var a=this.adaptor.insert(this,e,t,n,o);return this.dataSource.offline?a:this.doAjaxRequest(a)},e.prototype.remove=function(e,t,n,o){"object"==typeof t&&(t=t[e]),n instanceof r&&(o=n,n=null);var a=this.adaptor.remove(this,e,t,n,o);return this.dataSource.offline?a:this.doAjaxRequest(a)},e.prototype.update=function(e,t,n,o){n instanceof r&&(o=n,n=null);var a=this.adaptor.update(this,e,t,n,o);return this.dataSource.offline?a:this.doAjaxRequest(a)},e.prototype.doAjaxRequest=function(e){var r=this,n=new v;e=t.extend({},{type:"POST",contentType:"application/json; charset=utf-8",processData:!1},e);var o=new t.Ajax(e);return o.beforeSend=function(){r.beforeSend(o.httpRequest,o)},o.onSuccess=function(e,t){try{a.parse.parseJson(e)}catch(t){e=[]}e=r.adaptor.processResponse(a.parse.parseJson(e),r,null,t.httpRequest,t),n.resolve(e)},o.onFailure=function(e){n.reject([{error:e}])},o.send().catch(function(e){return!0}),n.promise},e}(),v=function(){return function(){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)}}();e.DataManager=y,e.Deferred=v,e.Query=r,e.Predicate=n,e.Adaptor=i,e.JsonAdaptor=u,e.UrlAdaptor=c,e.ODataAdaptor=l,e.ODataV4Adaptor=p,e.WebApiAdaptor=d,e.WebMethodAdaptor=h,e.RemoteSaveAdaptor=f,e.CacheAdaptor=g,e.DataUtil=a,Object.defineProperty(e,"__esModule",{value:!0})});
/*!
* filename: ej2-data.umd.min.js
* version : 16.2.46
* Copyright Syncfusion Inc. 2001 - 2018. All rights reserved.
* Use of this code is subject to the terms of our license.
* A copy of the current license can be obtained at any time by e-mailing
* licensing@syncfusion.com. Any infringement will be prosecuted under
* applicable laws.
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@syncfusion/ej2-base")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base"],t):t(e.ej={},e.ej2Base)}(this,function(e,t){"use strict";var r=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,r,n){return(e=e||this.dataManager)?e.executeQuery(this,t,r,n):a.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.executeLocal(this):a.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.isCountRequired=this.isCountRequired,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,o,a){t=t?t.toLowerCase():null;var s=null;return"string"==typeof e?s=new n(e,t,r,o,a):e instanceof n&&(s=e),this.queries.push({fn:"onWhere",e:s}),this},e.prototype.search=function(e,t,r,n,o){"string"==typeof t&&(t=[t]),r=r||"contains";var s=a.fnOperators[r];return this.queries.push({fn:"onSearch",e:{fieldNames:t,operator:r,searchKey:e,ignoreCase:n,ignoreAccent:o,comparer:s}}),this},e.prototype.sortBy=function(t,r,n){var o,s,i="ascending";if("string"==typeof t&&a.endsWith(t.toLowerCase()," desc")&&(t=t.replace(/ desc$/i,""),r="descending"),r&&"string"!=typeof r||(i=r?r.toLowerCase():"ascending",r=a.fnSort(r)),n){o=e.filterQueries(this.queries,"onSortBy");for(var u=0;u<o.length;u++)if("string"==typeof(s=o[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:r,direction:i}}),this},e.prototype.sortByDesc=function(e){return this.sortBy(e,"descending")},e.prototype.group=function(e,t,r){return this.sortBy(e,null,!0),this.queries.push({fn:"onGroup",e:{fieldName:e,comparer:t||null,format:r||null}}),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.isCountRequired=!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}(),n=function(){function e(t,r,n,o,s){return void 0===o&&(o=!1),this.ignoreAccent=!1,this.isComplex=!1,"string"==typeof t?(this.field=t,this.operator=r.toLowerCase(),this.value=n,this.ignoreCase=o,this.ignoreAccent=s,this.isComplex=!1,this.comparer=a.fnOperators.processOperator(this.operator)):(t instanceof e&&n instanceof e||n instanceof Array)&&(this.isComplex=!0,this.condition=r.toLowerCase(),this.predicates=[t],n instanceof Array?[].push.apply(this.predicates,n):this.predicates.push(n)),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,a){return e.combine(this,t,r,n,"and",o,a)},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,a){return e.combine(this,t,r,n,"or",o,a)},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,r,n=this.predicates?this.predicates:[];if(!this.isComplex&&this.comparer)return this.comparer.call(this,a.getObject(this.field,e),this.value,this.ignoreCase,this.ignoreAccent);t="and"===this.condition;for(var o=0;o<n.length;o++)if(r=n[o].validate(e),t){if(!r)return!1}else if(r)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,ignoreAccent:this.ignoreAccent,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,r,n,o,s,i,u){return r instanceof e?e[s](t,r):"string"==typeof r?e[s](t,new e(r,n,o,i,u)):a.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,t.ignoreAccent)},e}(),o={GroupGuid:"{271bbba0-1ee7}"},a=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(t){return"ascending"===(t=t?e.toLowerCase(t):"ascending")?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){for(var r={},n=0;n<t.length;n++)r=this.setValue(t[n],this.getObject(t[n],e),r);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(r,n,a,s,i,u){s=s||1;var c=r;if(c.GroupGuid===o.GroupGuid){for(var p=function(e){if(t.isNullOrUndefined(i))c[e].items=l.group(c[e].items,n,a,c.level+1,null,u),c[e].count=c[e].items.length;else{var r=-1,o=i.filter(function(t){return t.key===c[e].key});r=i.indexOf(o[0]),c[e].items=l.group(c[e].items,n,a,c.level+1,i[r].items,u),c[e].count=i[r].count}},l=this,d=0;d<c.length;d++)p(d);return c.childLevels+=1,c}var h={},f=[];f.GroupGuid=o.GroupGuid,f.level=s,f.childLevels=0,f.records=c;for(var g=function(e){var r=y.getVal(c,e,n);if(t.isNullOrUndefined(u)||(r=u(r,n)),!h[r]&&(h[r]={key:r,count:0,items:[],aggregates:{},field:n},f.push(h[r]),!t.isNullOrUndefined(i))){var o=i.filter(function(e){return e.key===h[r].key});h[r].count=o[0].count}h[r].count=t.isNullOrUndefined(i)?h[r].count+=1:h[r].count,h[r].items.push(c[e])},y=this,v=0;v<c.length;v++)g(v);if(a&&a.length){var m=function(r){for(var n={},o=void 0,s=a,u=0;u<a.length;u++)if(o=e.aggregates[a[u].type],t.isNullOrUndefined(i))o&&(n[s[u].field+" - "+s[u].type]=o(f[r].items,s[u].field));else{var c=i.filter(function(e){return e.key===f[r].key});o&&(n[s[u].field+" - "+s[u].type]=o(c[0].items,s[u].field))}f[r].aggregates=n};for(v=0;v<f.length;v++)m(v)}return c.length&&f||c},e.buildHierarchy=function(e,t,r,n,o){var a,s={};for(n.result&&(n=n.result),n.GroupGuid&&this.throwError("DataManager: Do not have support Grouping in hierarchy"),a=0;a<n.length;a++){(s[i=this.getObject(e,n[a])]||(s[i]=[])).push(n[a])}for(a=0;a<r.length;a++){var i=this.getObject(o||e,r[a]);r[a][t]=s[i]}},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=0,a=Object.keys(e);o<a.length;o++){var s=a[o];"object"!=typeof n[s]||n[s]instanceof Array?t.push(r+s):this.getFieldList(n[s],t,r+s+".")}return t},e.getObject=function(e,t){if(!e)return t;if(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.setValue=function(e,r,n){var o,a,s=e.toString().split("."),i=n||{},u=i,c=s.length;for(o=0;o<c;o++)a=s[o],o+1===c?u[a]=void 0===r?void 0:r:t.isNullOrUndefined(u[a])&&(u[a]={}),u=u[a];return i},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.ignoreDiacritics=function(t){if("string"!=typeof t)return t;return t.split("").map(function(t){return t in e.diacritics?e.diacritics[t]:t}).join("")},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,r,n,o){if(r in e){var a=e[r](n,o);t.isNullOrUndefined(a)||(n=a)}return n},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(r,n,o){var a,s,i,u=0,c="string"==typeof e.getVal(r,0,n);if(r.length)for(;t.isNullOrUndefined(a)&&u<r.length;)a=e.getVal(r,u,n),i=r[u++];for(;u<r.length;u++)s=e.getVal(r,u,n),t.isNullOrUndefined(s)||(c&&(a=+a,s=+s),o(a,s)>0&&(a=s,i=r[u]));return i},e.distinct=function(r,n,o){o=!t.isNullOrUndefined(o)&&o;var a,s=[],i={};return r.forEach(function(t,u){(a=e.getVal(r,u,n))in i||(s.push(o?r[u]:a),i[a]=1)}),s},e.serverTimezoneOffset=null,e.throwError=function(e){try{throw new Error(e)}catch(e){throw e.message+"\n"+e.stack}},e.aggregates={sum:function(t,r){for(var n,o=0,a="number"!=typeof e.getVal(t,0,r),s=0;s<t.length;s++)n=e.getVal(t,s,r),isNaN(n)||null===n||(a&&(n=+n),o+=n);return o},average:function(t,r){return e.aggregates.sum(t,r)/t.length},min:function(t,r){var n;return"function"==typeof r&&(n=r,r=null),e.getObject(r,e.getItemFromComparer(t,r,n||e.fnAscending))},max:function(t,r){var n;return"function"==typeof r&&(n=r,r=null),e.getObject(r,e.getItemFromComparer(t,r,n||e.fnDescending))},truecount:function(e,t){return new y(e).executeLocal((new r).where(t,"equal",!0,!0)).length},falsecount:function(e,t){return new y(e).executeLocal((new r).where(t,"equal",!1,!0)).length},count:function(e,t){return e.length}},e.operatorSymbols={"<":"lessthan",">":"greaterthan","<=":"lessthanorequal",">=":"greaterthanorequal","==":"equal","!=":"notequal","*=":"contains","$=":"endswith","^=":"startswith"},e.odBiOperator={"<":" lt ",">":" gt ","<=":" le ",">=":" ge ","==":" eq ","!=":" ne ",lessthan:" lt ",lessthanorequal:" le ",greaterthan:" gt ",greaterthanorequal:" ge ",equal:" eq ",notequal:" ne "},e.odUniOperator={"$=":"endswith","^=":"startswith","*=":"substringof",endswith:"endswith",startswith:"startswith",contains:"substringof"},e.odv4UniOperator={"$=":"endswith","^=":"startswith","*=":"contains",endswith:"endswith",startswith:"startswith",contains:"contains"},e.diacritics={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"},e.fnOperators={equal:function(t,r,n,o){return o&&(t=e.ignoreDiacritics(t),r=e.ignoreDiacritics(r)),n?e.toLowerCase(t)===e.toLowerCase(r):t===r},notequal:function(t,r,n,o){return o&&(t=e.ignoreDiacritics(t),r=e.ignoreDiacritics(r)),!e.fnOperators.equal(t,r,n)},lessthan:function(t,r,n){return n?e.toLowerCase(t)<e.toLowerCase(r):t<r},greaterthan:function(t,r,n){return n?e.toLowerCase(t)>e.toLowerCase(r):t>r},lessthanorequal:function(t,r,n){return n?e.toLowerCase(t)<=e.toLowerCase(r):t<=r},greaterthanorequal:function(t,r,n){return n?e.toLowerCase(t)>=e.toLowerCase(r):t>=r},contains:function(r,n,o,a){return a&&(r=e.ignoreDiacritics(r),n=e.ignoreDiacritics(n)),o?!t.isNullOrUndefined(r)&&!t.isNullOrUndefined(n)&&-1!==e.toLowerCase(r).indexOf(e.toLowerCase(n)):!t.isNullOrUndefined(r)&&!t.isNullOrUndefined(n)&&-1!==r.toString().indexOf(n)},notnull:function(e){return null!==e},isnull:function(e){return null===e},startswith:function(t,r,n,o){return o&&(t=e.ignoreDiacritics(t),r=e.ignoreDiacritics(r)),n?t&&r&&e.startsWith(e.toLowerCase(t),e.toLowerCase(r)):t&&r&&e.startsWith(t,r)},endswith:function(t,r,n,o){return o&&(t=e.ignoreDiacritics(t),r=e.ignoreDiacritics(r)),n?t&&r&&e.endsWith(e.toLowerCase(t),e.toLowerCase(r)):t&&r&&e.endsWith(t,r)},processSymbols:function(t){var r=e.operatorSymbols[t];if(r){return e.fnOperators[r]}return e.throwError("Query - Process Operator : Invalid operator")},processOperator:function(t){var r=e.fnOperators[t];return r||e.fnOperators.processSymbols(t)}},e.parse={parseJson:function(t){return"string"==typeof t?t=JSON.parse(t,e.parse.jsonReviver):t instanceof Array?e.parse.iterateAndReviveArray(t):"object"==typeof t&&e.parse.iterateAndReviveJson(t),t},iterateAndReviveArray:function(t){for(var r=0;r<t.length;r++)"object"==typeof t[r]?e.parse.iterateAndReviveJson(t[r]):"string"!=typeof t[r]||/^[\s]*\[|^[\s]*\{|\"/g.test(t[r])?t[r]=e.parse.parseJson(t[r]):t[r]=e.parse.jsonReviver("",t[r])},iterateAndReviveJson:function(t){for(var r,n=0,o=Object.keys(t);n<o.length;n++){var a=o[n];e.startsWith(a,"__")||("object"==typeof(r=t[a])?r instanceof Array?e.parse.iterateAndReviveArray(r):r&&e.parse.iterateAndReviveJson(r):t[a]=e.parse.jsonReviver(t[a],r))}},jsonReviver:function(t,r){var n=r;if("string"==typeof r){var o=/^\/Date\(([+-]?[0-9]+)([+-][0-9]{4})?\)\/$/.exec(r);if(o)return e.dateParse.toTimeZone(new Date(parseInt(o[1],10)),e.serverTimezoneOffset,!0);if(/^(\d{4}\-\d\d\-\d\d([tT][\d:\.]*){1})([zZ]|([+\-])(\d\d):?(\d\d))?$/.test(r)){var a=n.split(/[^0-9]/);r=e.dateParse.toTimeZone(new Date(parseInt(a[0],10),parseInt(a[1],10)-1,parseInt(a[2],10),parseInt(a[3],10),parseInt(a[4],10),parseInt(a[5],10)),e.serverTimezoneOffset,!0)}}return r},isJson:function(t){return"string"==typeof t[0]?t:e.parse.parseJson(t)},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(t,r){return e.isPlainObject(t)?e.parse.jsonReplacer(t,r):t instanceof Array?e.parse.arrayReplacer(t):t instanceof Date?e.parse.jsonReplacer({val:t},r).val:t},jsonReplacer:function(t,r){for(var n,o=0,a=Object.keys(t);o<a.length;o++){var s=a[o];if((n=t[s])instanceof Date){var i=n;t[s]=e.dateParse.toTimeZone(e.dateParse.addSelfOffset(i),e.serverTimezoneOffset).toJSON()}}return t},arrayReplacer:function(t){for(var r=0;r<t.length;r++)e.isPlainObject(t[r])?t[r]=e.parse.jsonReplacer(t[r]):t[r]instanceof Date&&(t[r]=e.parse.jsonReplacer({date:t[r]}).date);return t}},e.dateParse={addSelfOffset:function(e){return new Date(+e-6e4*e.getTimezoneOffset())},toUTC:function(e){return new Date(+e+6e4*e.getTimezoneOffset())},toTimeZone:function(t,r,n){if(null===r)return t;var o=n?e.dateParse.toUTC(t):t;return new Date(+o-36e5*r)}},e}(),s=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)}}(),i=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}(),u=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return s(n,e),n.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++)r=this[(n=t.queries[u]).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.isCountRequired&&(o={result:o,count:a,aggregates:i}),o},n.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},n.prototype.onWhere=function(e,t){return e&&e.length?e.filter(function(e){if(t)return t.validate(e)}):e},n.prototype.onAggregates=function(e,t){var r=a.aggregates[t.type];return e&&r&&0!==e.length?r(e,t.field):null},n.prototype.onSearch=function(e,t){return e&&e.length?(0===t.fieldNames.length&&a.getFieldList(e[0],t.fieldNames),e.filter(function(e){for(var r=0;r<t.fieldNames.length;r++)if(t.comparer.call(e,a.getObject(t.fieldNames[r],e),t.searchKey,t.ignoreCase,t.ignoreAccent))return!0;return!1})):e},n.prototype.onSortBy=function(e,t,r){if(!e||!e.length)return e;var n,o=a.getValue(t.fieldName,r);if(!o)return e.sort(t.comparer);if(o instanceof Array){for(var s=(o=o.slice(0)).length-1;s>=0;s--)o[s]&&(n=t.comparer,a.endsWith(o[s]," desc")&&(n=a.fnSort("descending"),o[s]=o[s].replace(" desc","")),e=a.sort(e,o[s],n));return e}return a.sort(e,o,t.comparer)},n.prototype.onGroup=function(e,t,n){if(!e||!e.length)return e;var o=r.filterQueries(n.queries,"onAggregates"),s=[];if(o.length)for(var i=void 0,u=0;u<o.length;u++)i=o[u].e,s.push({type:i.type,field:a.getValue(i.field,n)});return a.group(e,a.getValue(t.fieldName,n),s,null,null,t.comparer)},n.prototype.onPage=function(e,t,r){var n=a.getValue(t.pageSize,r),o=(a.getValue(t.pageIndex,r)-1)*n,s=o+n;return e&&e.length?e.slice(o,s):e},n.prototype.onRange=function(e,t){return e&&e.length?e.slice(a.getValue(t.start),a.getValue(t.end)):e},n.prototype.onTake=function(e,t){return e&&e.length?e.slice(0,a.getValue(t.nos)):e},n.prototype.onSkip=function(e,t){return e&&e.length?e.slice(a.getValue(t.nos)):e},n.prototype.onSelect=function(e,t){return e&&e.length?a.select(e,a.getValue(t.fieldNames)):e},n.prototype.insert=function(e,r,n,o,a){return t.isNullOrUndefined(a)?e.dataSource.json.push(r):e.dataSource.json.splice(a,0,r)},n.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},n.prototype.update=function(e,r,n,o){var a,s=e.dataSource.json,i=n[r];for(a=0;a<s.length&&s[a][r]!==i;a++);return a<s.length?t.merge(s[a],n):null},n}(i),c=function(e){function o(){return null!==e&&e.apply(this,arguments)||this}return s(o,e),o.prototype.processQuery=function(e,t,n){var o,s,i=this.getQueryRequest(t),u=r.filterQueryLists(t.queries,["onSelect","onPage","onSkip","onTake","onRange"]),c=t.params,p=e.dataSource.url,l=null,d=this.options,h={sorts:[],groups:[],filters:[],searches:[],aggregates:[]};"onPage"in u?(o=u.onPage,s=((s=a.getValue(o.pageIndex,t))-1)*(l=a.getValue(o.pageSize,t))):"onRange"in u&&(s=(o=u.onRange).start,l=o.end-o.start);for(var f=0;f<i.sorts.length;f++)o=a.getValue(i.sorts[f].e.fieldName,t),h.sorts.push(a.callAdaptorFunction(this,"onEachSort",{name:o,direction:i.sorts[f].e.direction},t));n&&(o=this.getFiltersFrom(n,t))&&h.filters.push(a.callAdaptorFunction(this,"onEachWhere",o.toJson(),t));for(f=0;f<i.filters.length;f++){h.filters.push(a.callAdaptorFunction(this,"onEachWhere",i.filters[f].e.toJson(),t));for(var g=0,y="object"==typeof h.filters[f]?Object.keys(h.filters[f]):[];g<y.length;g++){var v=y[g];a.isNull(h[v])&&delete h[v]}}for(f=0;f<i.searches.length;f++)o=i.searches[f].e,h.searches.push(a.callAdaptorFunction(this,"onEachSearch",{fields:o.fieldNames,operator:o.operator,key:o.searchKey,ignoreCase:o.ignoreCase},t));for(f=0;f<i.groups.length;f++)h.groups.push(a.getValue(i.groups[f].e.fieldName,t));for(f=0;f<i.aggregates.length;f++)o=i.aggregates[f].e,h.aggregates.push({type:o.type,field:a.getValue(o.field,t)});var m={};this.getRequestQuery(d,t,u,h,m),a.callAdaptorFunction(this,"addParams",{dm:e,query:t,params:c,reqParams:m});for(var S=0,b=Object.keys(m);S<b.length;S++){v=b[S];(a.isNull(m[v])||""===m[v]||0===m[v].length)&&delete m[v]}d.skip in m&&d.take in m||null===l||(m[d.skip]=a.callAdaptorFunction(this,"onSkip",s,t),m[d.take]=a.callAdaptorFunction(this,"onTake",l,t));var O=this.pvt;return this.pvt={},"json"===this.options.requestType?{data:JSON.stringify(m),url:p,pvtData:O,type:"POST",contentType:"application/json; charset=utf-8"}:(o=this.convertToQueryString(m,t,e),o=(-1!==e.dataSource.url.indexOf("?")?"&":"/")+o,{type:"GET",url:o.length?p.replace(/\/*$/,o):p,pvtData:O})},o.prototype.getRequestQuery=function(e,t,r,n,o){var s=o;s[e.from]=t.fromTable,e.expand&&(s[e.expand]=t.expands),s[e.select]="onSelect"in r?a.callAdaptorFunction(this,"onSelect",a.getValue(r.onSelect.fieldNames,t),t):"",s[e.count]=t.isCountRequired?a.callAdaptorFunction(this,"onCount",t.isCountRequired,t):"",s[e.search]=n.searches.length?a.callAdaptorFunction(this,"onSearch",n.searches,t):"",s[e.skip]="onSkip"in r?a.callAdaptorFunction(this,"onSkip",a.getValue(r.onSkip.nos,t),t):"",s[e.take]="onTake"in r?a.callAdaptorFunction(this,"onTake",a.getValue(r.onTake.nos,t),t):"",s[e.where]=n.filters.length||n.searches.length?a.callAdaptorFunction(this,"onWhere",n.filters,t):"",s[e.sortBy]=n.sorts.length?a.callAdaptorFunction(this,"onSortBy",n.sorts,t):"",s[e.group]=n.groups.length?a.callAdaptorFunction(this,"onGroup",n.groups,t):"",s[e.aggregates]=n.aggregates.length?a.callAdaptorFunction(this,"onAggregates",n.aggregates,t):"",s.param=[]},o.prototype.convertToQueryString=function(e,t,r){return""},o.prototype.processResponse=function(e,t,r,n,o,s){var i=o,u=i.pvtData||{},c=e.groupDs;if(n&&n.getResponseHeader("Content-Type")&&-1!==n.getResponseHeader("Content-Type").indexOf("xml"))return r.isCountRequired?{result:[],count:0}:[];var p=JSON.parse(i.data);if(p&&"batch"===p.action&&e.addedRecords)return s.addedRecords=e.addedRecords,s;e.d&&(e=e.d);var l={};return"count"in e&&(l.count=e.count),l.result=e.result?e.result:e,this.getAggregateResult(u,e,l,c,r),a.isNull(l.count)?l.result:{result:l.result,count:l.count,aggregates:l.aggregates}},o.prototype.onGroup=function(e){return this.pvt.groups=e,e},o.prototype.onAggregates=function(e){this.pvt.aggregates=e},o.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]})}},o.prototype.beforeSend=function(e,t){},o.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"})}},o.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"})}},o.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})}},o.prototype.getFiltersFrom=function(e,t){var r,o=t.fKey,s=o,i=t.key,u=[];"object"!=typeof e[0]&&(s=null);for(var c=0;c<e.length;c++)r="object"==typeof e[0]?a.getObject(i||s,e[c]):e[c],u.push(new n(o,"equal",r));return n.or(u)},o.prototype.getAggregateResult=function(e,n,o,s,i){var u=n;if(n&&n.result&&(u=n.result),e&&e.aggregates&&e.aggregates.length){var c=e.aggregates,p=void 0,l=u,d={};n.aggregate&&(l=n.aggregate);for(var h=0;h<c.length;h++)(p=a.aggregates[c[h].type])&&(d[c[h].field+" - "+c[h].type]=p(l,c[h].field));o.aggregates=d}if(e&&e.groups&&e.groups.length){var f=e.groups;for(h=0;h<f.length;h++){t.isNullOrUndefined(s)||(s=a.group(s,f[h]));var g=r.filterQueries(i.queries,"onGroup")[h].e;u=a.group(u,f[h],e.aggregates,null,s,g.comparer)}o.result=u}return o},o.prototype.getQueryRequest=function(e){var t={sorts:[],groups:[],filters:[],searches:[],aggregates:[]};return t.sorts=r.filterQueries(e.queries,"onSortBy"),t.groups=r.filterQueries(e.queries,"onGroup"),t.filters=r.filterQueries(e.queries,"onWhere"),t.searches=r.filterQueries(e.queries,"onSearch"),t.aggregates=r.filterQueries(e.queries,"onAggregates"),t},o.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]}},o}(i),p=function(e){function r(r){var n=e.call(this)||this;return n.options=t.extend({},n.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 ",updateType:"PUT"}),n.getModuleName=t.getValue("getModulename",n),t.extend(n.options,r||{}),n}return s(r,e),r.prototype.onPredicate=function(e,n,o){var s,i,u="",c=e.value,p=typeof c,l=e.field?r.getField(e.field):null;if(c instanceof Date&&(c="datetime'"+a.parse.replacer(c)+"'"),"string"===p&&(c="'"+c+"'",o&&(l="cast("+l+", 'Edm.String')"),a.parse.isGuid(c)&&(i="guid"),e.ignoreCase&&(i||(l="tolower("+l+")"),c=c.toLowerCase())),s=a.odBiOperator[e.operator])return u+=l,u+=s,i&&(u+=i),u+c;if(t.isNullOrUndefined(this.getModuleName)?s=a.odUniOperator[e.operator]:"ODataV4Adaptor"===this.getModuleName()&&(s=a.odv4UniOperator[e.operator]),"substringof"===s){var d=c;c=l,l=d}return u+=s+"(",u+=l+",",i&&(u+=i),u+=c+")"},r.prototype.addParams=function(t){e.prototype.addParams.call(this,t),delete t.reqParams.params},r.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+" ")},r.prototype.onEachWhere=function(e,t,r){return e.isComplex?this.onComplexPredicate(e,t,r):this.onPredicate(e,t,r)},r.prototype.onWhere=function(e){return this.pvt.search&&e.push(this.onEachWhere(this.pvt.search,null,!0)),e.join(" and ")},r.prototype.onEachSearch=function(e){e.fields&&0===e.fields.length&&a.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 n(e.fields[r],e.operator,e.key,e.ignoreCase));this.pvt.search=t},r.prototype.onSearch=function(e){return this.pvt.search=n.or(this.pvt.search),""},r.prototype.onEachSort=function(e){var t=[];if(e.name instanceof Array)for(var n=0;n<e.name.length;n++)t.push(r.getField(e.name[n])+("descending"===e.direction?" desc":""));else t.push(r.getField(e.name)+("descending"===e.direction?" desc":""));return t.join(",")},r.prototype.onSortBy=function(e){return e.reverse().join(",")},r.prototype.onGroup=function(e){return this.pvt.groups=e,[]},r.prototype.onSelect=function(e){for(var t=0;t<e.length;t++)e[t]=r.getField(e[t]);return e.join(",")},r.prototype.onAggregates=function(e){return this.pvt.aggregates=e,""},r.prototype.onCount=function(e){return!0===e?"allpages":""},r.prototype.beforeSend=function(e,t,r){a.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")},r.prototype.processResponse=function(e,r,n,o,s,i){if(!t.isNullOrUndefined(e.d)){var u=n&&n.isCountRequired?e.d.results:e.d;if(!t.isNullOrUndefined(u))for(var c=0;c<u.length;c++)t.isNullOrUndefined(u[c].__metadata)||delete u[c].__metadata}var p=s&&s.pvtData,l=this.processBatchResponse(e,n,o,s,i);if(l)return l;var d=o&&s.getResponseHeader("DataServiceVersion"),h=null,f=d&&parseInt(d,10)||2;if(n&&n.isCountRequired){var g="__count";(e[g]||e["odata.count"])&&(h=e[g]||e["odata.count"]),e.d&&(e=e.d),(e[g]||e["odata.count"])&&(h=e[g]||e["odata.count"])}3===f&&e.value&&(e=e.value),e.d&&(e=e.d),f<3&&e.results&&(e=e.results);var y={};return y.count=h,y.result=e,this.getAggregateResult(p,e,y,null,n),a.isNull(h)?y.result:{result:y.result,count:y.count,aggregates:y.aggregates}},r.prototype.convertToQueryString=function(e,t,r){var n=[],o=e.table||"";delete e.table,r.dataSource.requiresFormat&&(e.$format="json");for(var a=0,s=Object.keys(e);a<s.length;a++){var i=s[a];n.push(i+"="+e[i])}return n=n.join("&"),r.dataSource.url&&-1!==r.dataSource.url.indexOf("?")&&!o?n:n.length?o+"?"+n:o||""},r.prototype.insert=function(e,t,r){return{url:e.dataSource.url.replace(/\/*$/,r?"/"+r:""),data:JSON.stringify(t)}},r.prototype.remove=function(e,t,r,n){return{type:"DELETE",url:e.dataSource.url.replace(/\/*$/,n?"/"+n:"")+"("+r+")"}},r.prototype.update=function(e,t,r,n){return{type:this.options.updateType,url:e.dataSource.url.replace(/\/*$/,n?"/"+n:"")+"("+r[t]+")",data:JSON.stringify(r),accept:this.options.accept}},r.prototype.batchRequest=function(e,t,r){var n=r.guid=a.getGuid(this.options.batchPre),o=e.dataSource.url.replace(/\/*$/,"/"+this.options.batch),s={url:r.url,key:r.key,cid:1,cSet:a.getGuid(this.options.changeSet)},i="--"+n+"\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+="--"+n+"--",{type:"POST",url:o,dataType:"json",contentType:"multipart/mixed; charset=UTF-8;boundary="+n,data:i}},r.prototype.generateDeleteRequest=function(e,t){if(!e)return"";return this.generateBodyContent(e,t,{method:"DELETE ",url:function(e,t,r){return"("+e[t][r]+")"},data:function(e,t){return""}})+"\n"},r.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)},r.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)},r.getField=function(e){return e.replace(/\./g,"/")},r.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},r.prototype.processBatchResponse=function(e,r,n,o,s){if(n&&n.getResponseHeader("Content-Type")&&-1!==n.getResponseHeader("Content-Type").indexOf("xml"))return r.isCountRequired?{result:[],count:0}:[];if(o&&this.options.batch&&a.endsWith(o.url,this.options.batch)&&"post"===o.type.toLowerCase()){var i=n.getResponseHeader("Content-Type"),u=void 0,c=void 0,p=e+"";if(i=i.substring(i.indexOf("=batchresponse")+1),(p=p.split(i)).length<2)return{};p=p[1];var l=/(?:\bContent-Type.+boundary=)(changesetresponse.+)/i.exec(p);l&&p.replace(l[0],"");for(var d=l?l[1]:"",h=(p=p.split(d)).length;h>-1;h--)/\bContent-ID:/i.test(p[h])&&/\bHTTP.+201/.test(p[h])&&(u=parseInt(/\bContent-ID: (\d+)/i.exec(p[h])[1],10),s.addedRecords[u]&&(c=a.parse.parseJson(/^\{.+\}/m.exec(p[h])[0]),t.extend({},s.addedRecords[u],this.processResponse(c))));return s}return null},r}(c),l=function(e){function r(r){var n=e.call(this,r)||this;return n.options=t.extend({},n.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 ",updateType:"PATCH"}),t.getValue("getModulename",n.getModulename()),t.extend(n.options,r||{}),n}return s(r,e),r.prototype.getModulename=function(){return"ODataV4Adaptor"},r.prototype.onCount=function(e){return!0===e?"true":""},r.prototype.onPredicate=function(t,r,n){var o="",a=t.value instanceof Date;return o=e.prototype.onPredicate.call(this,t,r,n),a&&(o=o.replace(/datetime'(.*)'$/,"$1")),o},r.prototype.onEachSearch=function(e){var t=this.pvt.searches||[];t.push(e.key),this.pvt.searches=t},r.prototype.onSearch=function(e){return this.pvt.searches.join(" OR ")},r.prototype.beforeSend=function(e,t,r){"POST"!==r.type&&"PUT"!==r.type&&"PATCH"!==r.type||t.setRequestHeader("Prefer","return=representation"),t.setRequestHeader("Accept",this.options.accept)},r.prototype.processResponse=function(t,r,n,o,s,i){var u=s&&s.pvtData,c=e.prototype.processBatchResponse.call(this,t,n,o,s,i);if(c)return c;var p=null;n&&n.isCountRequired&&"@odata.count"in t&&(p=t["@odata.count"]),t=t.value;var l={};return l.count=p,l.result=t,this.getAggregateResult(u,t,l,null,n),a.isNull(p)?l.result:{result:l.result,count:p,aggregates:l.aggregates}},r}(p),d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return s(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,n,o,s){var i=o&&o.pvtData,u=null,c={};if(o&&"post"!==o.type.toLowerCase()){var p=n&&o.getResponseHeader("DataServiceVersion"),l=p&&parseInt(p,10)||2;r&&r.isCountRequired&&(a.isNull(e.Count)||(u=e.Count)),l<3&&e.Items&&(e=e.Items),c.count=u,c.result=e,this.getAggregateResult(i,e,c,null,r)}return c.result=c.result||e,a.isNull(u)?c.result:{result:c.result,count:c.count,aggregates:c.aggregates}},t}(p),h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return s(t,e),t.prototype.processQuery=function(e,t,r){var n=(new c).processQuery(e,t,r),o=a.parse.parseJson(n.data),s={};if(o.param)for(var i=0;i<o.param.length;i++){var u=o.param[i],p=Object.keys(u)[0];s[p]=u[p]}s.value=o;return{data:JSON.stringify(s),url:n.url,pvtData:n.pvtData,type:"POST",contentType:"application/json; charset=utf-8"}},t}(c),f=function(e){function r(){var r=e.call(this)||this;return t.setValue("beforeSend",c.prototype.beforeSend,r),r}return s(r,e),r.prototype.insert=function(t,r,n){return e.prototype.insert.call(this,t,r,null,null,0),{url:t.dataSource.insertUrl||t.dataSource.crudUrl||t.dataSource.url,data:JSON.stringify({value:r,table:n,action:"insert"})}},r.prototype.remove=function(t,r,n,o){return e.prototype.remove.call(this,t,r,n),{type:"POST",url:t.dataSource.removeUrl||t.dataSource.crudUrl||t.dataSource.url,data:JSON.stringify({key:n,keyColumn:r,table:o,action:"remove"})}},r.prototype.update=function(t,r,n,o){return e.prototype.update.call(this,t,r,n),{type:"POST",url:t.dataSource.updateUrl||t.dataSource.crudUrl||t.dataSource.url,data:JSON.stringify({value:n,action:"update",keyColumn:r,key:n[r],table:o})}},r.prototype.batchRequest=function(e,t,r){var n;for(n=0;n<t.addedRecords.length;n++)u.prototype.insert(e,t.addedRecords[n]);for(n=0;n<t.changedRecords.length;n++)u.prototype.update(e,r.key,t.changedRecords[n]);for(n=0;n<t.deletedRecords.length;n++)u.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})}},r}(u),g=function(e){function n(r,n,o){var s=e.call(this)||this;s.isCrudAction=!1,s.isInsertAction=!1,t.isNullOrUndefined(r)||(s.cacheAdaptor=r),s.pageSize=o,s.guidId=a.getGuid("cacheAdaptor");window.localStorage.setItem(s.guidId,JSON.stringify({keys:[],results:[]}));var i=s.guidId;return t.isNullOrUndefined(n)||setInterval(function(){var e;e=a.parse.parseJson(window.localStorage.getItem(i));for(var t=[],r=0;r<e.results.length;r++){var o=+new Date,s=+new Date(e.results[r].timeStamp);e.results[r].timeStamp=o-s,o-s>n&&t.push(r)}for(r=0;r<t.length;r++)e.results.splice(t[r],1),e.keys.splice(t[r],1);window.localStorage.removeItem(i),window.localStorage.setItem(i,JSON.stringify(e))},n),s}return s(n,e),n.prototype.generateKey=function(e,t){var n=this.getQueryRequest(t),o=r.filterQueryLists(t.queries,["onSelect","onPage","onSkip","onTake","onRange"]),a=e;"onPage"in o&&(a+=o.onPage.pageIndex),n.sorts.forEach(function(e){a+=e.e.direction+e.e.fieldName}),n.groups.forEach(function(e){a+=e.e.fieldName}),n.searches.forEach(function(e){a+=e.e.searchKey});for(var s=0;s<n.filters.length;s++){var i=n.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},n.prototype.processQuery=function(e,t,r){var n,o=this.generateKey(e.dataSource.url,t),s=(n=a.parse.parseJson(window.localStorage.getItem(this.guidId)))?n.results[n.keys.indexOf(o)]: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},n.prototype.processResponse=function(e,t,r,n,o,s){if(this.isInsertAction||o&&this.cacheAdaptor.options.batch&&a.endsWith(o.url,this.cacheAdaptor.options.batch)&&"post"===o.type.toLowerCase())return this.cacheAdaptor.processResponse(e,t,r,n,o,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={},c=(u=a.parse.parseJson(window.localStorage.getItem(this.guidId))).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},n.prototype.beforeSend=function(e,t,r){a.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)},n.prototype.update=function(e,t,r,n){return this.isCrudAction=!0,this.cacheAdaptor.update(e,t,r,n)},n.prototype.insert=function(e,t,r){return this.isInsertAction=!0,this.cacheAdaptor.insert(e,t,r)},n.prototype.remove=function(e,t,r,n){return this.isCrudAction=!0,this.cacheAdaptor.remove(e,t,r,n)},n.prototype.batchRequest=function(e,t,r){return this.cacheAdaptor.batchRequest(e,t,r)},n}(c),y=function(){function e(e,n,o){var s=this;this.dateParse=!0,this.requests=[],e||this.dataSource||(e=[]),o=o||e.adaptor;var i;return e instanceof Array?i={json:e,offline:!0}:"object"==typeof e?(e.json||(e.json=[]),i={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 f)&&!e.url,requiresFormat:e.requiresFormat}):a.throwError("DataManager: Invalid arguments"),void 0!==i.requiresFormat||a.isCors()||(i.requiresFormat=!!t.isNullOrUndefined(i.crossDomain)||i.crossDomain),void 0===i.dataType&&(i.dataType="json"),this.dataSource=i,this.defaultQuery=n,i.url&&i.offline&&!i.json.length?(this.isDataAvailable=!1,this.adaptor=o||new p,this.dataSource.offline=!1,this.ready=this.executeQuery(n||new r),this.ready.then(function(e){s.dataSource.offline=!0,s.isDataAvailable=!0,i.json=e.result,s.adaptor=new u})):this.adaptor=i.offline?new u:new p,!i.jsonp&&this.adaptor instanceof p&&(i.jsonp="callback"),this.adaptor=o||this.adaptor,i.enableCaching&&(this.adaptor=new g(this.adaptor,i.timeTillExpiration,i.cachingPageSize)),this}return e.prototype.setDefaultQuery=function(e){return this.defaultQuery=e,this},e.prototype.executeLocal=function(n){this.defaultQuery||n instanceof r||a.throwError("DataManager - executeLocal() : A query is required to execute"),this.dataSource.json||a.throwError("DataManager - executeLocal() : Json data is required to execute"),n=n||this.defaultQuery;var o=this.adaptor.processQuery(this,n);if(n.subQuery){var s=n.subQuery.fromTable,i=n.subQuery.lookups,u=n.isCountRequired?o.result:o;i&&i instanceof Array&&a.buildHierarchy(n.subQuery.fKey,s,u,i,n.subQuery.key);for(var c=0;c<u.length;c++)u[c][s]instanceof Array&&(u[c]=t.extend({},{},u[c]),u[c][s]=this.adaptor.processResponse(n.subQuery.using(new e(u[c][s].slice(0))).executeLocal(),this,n))}return this.adaptor.processResponse(o,this,n)},e.prototype.executeQuery=function(t,n,o,s){var i=this;"function"==typeof t&&(s=o,o=n,n=t,t=null),t||(t=this.defaultQuery),t instanceof r||a.throwError("DataManager - executeQuery() : A query is required to execute");var u=new v,c={query:t};if(this.dataSource.offline||void 0===this.dataSource.url)e.nextTick(function(){var r=i.executeLocal(t);c=e.getDeferedArgs(t,r,c),u.resolve(c)});else{var p=this.adaptor.processQuery(this,t);this.makeRequest(p,u,c,t)}return(n||o)&&u.promise.then(n,o),s&&u.promise.then(s,s),u.promise},e.getDeferedArgs=function(e,t,r){return e.isCountRequired?(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,r,n){return t.extend({},{type:"GET",dataType:this.dataSource.dataType,crossDomain:this.dataSource.crossDomain,jsonp:this.dataSource.jsonp,cache:!0,processData:!1,onSuccess:r,onFailure:n},e)},e.prototype.makeRequest=function(e,r,n,o){var s=this,i=!!o.subQuerySelector,u=function(e){n.error=e,r.reject(n)},c=function(e,t,o,a,s,i,u){n.xhr=o,n.count=t?parseInt(t.toString(),10):0,n.result=e,n.request=a,n.aggregates=i,n.actual=s,n.virtualSelectRecords=u,r.resolve(n)},p=function(e,t){var r=new v,p={parent:n};o.subQuery.isChild=!0;var l=s.adaptor.processQuery(s,o.subQuery,e?s.adaptor.processResponse(e):t),d=s.makeRequest(l,r,p,o.subQuery);return i||r.then(function(t){e&&(a.buildHierarchy(o.subQuery.fKey,o.subQuery.fromTable,e,t,o.subQuery.key),c(e,t.count,t.xhr))},u),d},l=this.extendRequest(e,function(e,t){-1===t.httpRequest.getResponseHeader("Content-Type").indexOf("xml")&&s.dateParse&&(e=a.parse.parseJson(e));var r=s.adaptor.processResponse(e,s,o,t.httpRequest,t),n=0,u=null,l=e.virtualSelectRecords;o.isCountRequired&&(n=r.count,u=r.aggregates,r=r.result),o.subQuery?i||p(r,t):c(r,n,t.httpRequest,t.type,e,u,l)},u),d=new t.Ajax(l);if(d.beforeSend=function(){s.beforeSend(d.httpRequest,d)},(l=d.send()).catch(function(e){return!0}),this.requests.push(d),i){var h=o.subQuerySelector.call(this,{query:o.subQuery,parent:o});h&&h.length?Promise.all([l,p(null,h)]).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,o,s.requests[0].httpRequest,s.requests[0]),u=0;o.isCountRequired&&(u=n.count,n=n.result);var p=s.adaptor.processResponse(r[1],s,o.subQuery,s.requests[1].httpRequest,s.requests[1]);u=0,o.subQuery.isCountRequired&&(u=p.count,p=p.result),a.buildHierarchy(o.subQuery.fKey,o.subQuery.fromTable,n,p,o.subQuery.key),i=!1,c(n,u,s.requests[0].httpRequest)}):i=!1}return l},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=0,s=Object.keys(n[o]);a<s.length;a++){var i=s[a];r.push(i),e.setRequestHeader(i,n[o][i])}}},e.prototype.saveChanges=function(e,n,o,s){var i=this;o instanceof r&&(s=o,o=null);var u={url:o,key:n||this.dataSource.key},c=this.adaptor.batchRequest(this,e,u,s);if(this.dataSource.offline)return c;var p=new v,l=new t.Ajax(c);return l.beforeSend=function(){i.beforeSend(l.httpRequest,l)},l.onSuccess=function(t,r){p.resolve(i.adaptor.processResponse(a.parse.parseJson(t),i,null,r.httpRequest,r,e))},l.onFailure=function(e){p.reject([{error:e}])},l.send().catch(function(e){return!0}),p.promise},e.prototype.insert=function(e,t,n,o){t instanceof r&&(n=t,t=null);var a=this.adaptor.insert(this,e,t,n,o);return this.dataSource.offline?a:this.doAjaxRequest(a)},e.prototype.remove=function(e,t,n,o){"object"==typeof t&&(t=t[e]),n instanceof r&&(o=n,n=null);var a=this.adaptor.remove(this,e,t,n,o);return this.dataSource.offline?a:this.doAjaxRequest(a)},e.prototype.update=function(e,t,n,o){n instanceof r&&(o=n,n=null);var a=this.adaptor.update(this,e,t,n,o);return this.dataSource.offline?a:this.doAjaxRequest(a)},e.prototype.doAjaxRequest=function(e){var r=this,n=new v;e=t.extend({},{type:"POST",contentType:"application/json; charset=utf-8",processData:!1},e);var o=new t.Ajax(e);return o.beforeSend=function(){r.beforeSend(o.httpRequest,o)},o.onSuccess=function(e,t){try{a.parse.parseJson(e)}catch(t){e=[]}e=r.adaptor.processResponse(a.parse.parseJson(e),r,null,t.httpRequest,t),n.resolve(e)},o.onFailure=function(e){n.reject([{error:e}])},o.send().catch(function(e){return!0}),n.promise},e}(),v=function(){return function(){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)}}();e.DataManager=y,e.Deferred=v,e.Query=r,e.Predicate=n,e.Adaptor=i,e.JsonAdaptor=u,e.UrlAdaptor=c,e.ODataAdaptor=p,e.ODataV4Adaptor=l,e.WebApiAdaptor=d,e.WebMethodAdaptor=h,e.RemoteSaveAdaptor=f,e.CacheAdaptor=g,e.DataUtil=a,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=ej2-data.umd.min.js.map

@@ -0,1 +1,10 @@

/*!
* filename: index.d.ts
* version : 16.2.46
* Copyright Syncfusion Inc. 2001 - 2018. All rights reserved.
* Use of this code is subject to the terms of our license.
* A copy of the current license can be obtained at any time by e-mailing
* licensing@syncfusion.com. Any infringement will be prosecuted under
* applicable laws.
*/
import * as _data from '@syncfusion/ej2-data';

@@ -2,0 +11,0 @@ import * as _base from '@syncfusion/ej2-base';

12

index.js

@@ -1,8 +0,4 @@

define(["require", "exports", "./src/index"], function (require, exports, index_1) {
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(index_1);
});
/**
* index
*/
export * from './src/index';
{
"name": "@syncfusion/ej2-data",
"version": "16.2.45",
"version": "16.2.46",
"description": "Essential JS 2 DataManager",

@@ -8,6 +8,6 @@ "author": "Syncfusion Inc.",

"main": "./dist/ej2-data.umd.min.js",
"module": "./dist/es6/ej2-data.es5.js",
"module": "./index.js",
"es2015": "./dist/es6/ej2-data.es2015.js",
"dependencies": {
"@syncfusion/ej2-base": "~16.2.45"
"@syncfusion/ej2-base": "~16.2.46"
},

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

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

protected options: RemoteOptions;
constructor();
constructor(props?: RemoteOptions);
/**

@@ -465,2 +465,3 @@ * Generate request string based on the filter criteria from query.

protected options: RemoteOptions;
constructor(props?: RemoteOptions);
/**

@@ -774,2 +775,3 @@ * Returns the query string which requests total count from the data source.

batchChangeSetContentType?: string;
updateType?: string;
}

@@ -1,11 +0,7 @@

define(["require", "exports", "./manager", "./query", "./adaptors", "./util"], function (require, exports, manager_1, query_1, adaptors_1, util_1) {
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(manager_1);
__export(query_1);
__export(adaptors_1);
__export(util_1);
});
/**
* Data modules
*/
export * from './manager';
export * from './query';
export * from './adaptors';
export * from './util';

@@ -1,393 +0,462 @@

define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "./util", "./query", "./adaptors"], function (require, exports, ej2_base_1, ej2_base_2, util_1, query_1, adaptors_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var DataManager = (function () {
function DataManager(dataSource, query, adaptor) {
var _this = this;
this.dateParse = true;
this.requests = [];
if (!dataSource && !this.dataSource) {
dataSource = [];
import { Ajax } from '@syncfusion/ej2-base';
import { extend, isNullOrUndefined } from '@syncfusion/ej2-base';
import { DataUtil } from './util';
import { Query } from './query';
import { ODataAdaptor, JsonAdaptor, CacheAdaptor, RemoteSaveAdaptor } from './adaptors';
/**
* DataManager is used to manage and manipulate relational data.
*/
var DataManager = /** @class */ (function () {
/**
* Constructor for DataManager class
* @param {DataOptions|JSON[]} dataSource?
* @param {Query} query?
* @param {AdaptorOptions|string} adaptor?
* @hidden
*/
function DataManager(dataSource, query, adaptor) {
var _this = this;
/** @hidden */
this.dateParse = true;
this.requests = [];
if (!dataSource && !this.dataSource) {
dataSource = [];
}
adaptor = adaptor || dataSource.adaptor;
var data;
if (dataSource instanceof Array) {
data = {
json: dataSource,
offline: true
};
}
else if (typeof dataSource === 'object') {
if (!dataSource.json) {
dataSource.json = [];
}
adaptor = adaptor || dataSource.adaptor;
var data;
if (dataSource instanceof Array) {
data = {
json: dataSource,
offline: true
};
data = {
url: dataSource.url,
insertUrl: dataSource.insertUrl,
removeUrl: dataSource.removeUrl,
updateUrl: dataSource.updateUrl,
crudUrl: dataSource.crudUrl,
batchUrl: dataSource.batchUrl,
json: dataSource.json,
headers: dataSource.headers,
accept: dataSource.accept,
data: dataSource.data,
timeTillExpiration: dataSource.timeTillExpiration,
cachingPageSize: dataSource.cachingPageSize,
enableCaching: dataSource.enableCaching,
requestType: dataSource.requestType,
key: dataSource.key,
crossDomain: dataSource.crossDomain,
jsonp: dataSource.jsonp,
dataType: dataSource.dataType,
offline: dataSource.offline !== undefined ? dataSource.offline
: dataSource.adaptor instanceof RemoteSaveAdaptor ? false : dataSource.url ? false : true,
requiresFormat: dataSource.requiresFormat
};
}
else {
DataUtil.throwError('DataManager: Invalid arguments');
}
if (data.requiresFormat === undefined && !DataUtil.isCors()) {
data.requiresFormat = isNullOrUndefined(data.crossDomain) ? true : data.crossDomain;
}
if (data.dataType === undefined) {
data.dataType = 'json';
}
this.dataSource = data;
this.defaultQuery = query;
if (data.url && data.offline && !data.json.length) {
this.isDataAvailable = false;
this.adaptor = adaptor || new ODataAdaptor();
this.dataSource.offline = false;
this.ready = this.executeQuery(query || new Query());
this.ready.then(function (e) {
_this.dataSource.offline = true;
_this.isDataAvailable = true;
data.json = e.result;
_this.adaptor = new JsonAdaptor();
});
}
else {
this.adaptor = data.offline ? new JsonAdaptor() : new ODataAdaptor();
}
if (!data.jsonp && this.adaptor instanceof ODataAdaptor) {
data.jsonp = 'callback';
}
this.adaptor = adaptor || this.adaptor;
if (data.enableCaching) {
this.adaptor = new CacheAdaptor(this.adaptor, data.timeTillExpiration, data.cachingPageSize);
}
return this;
}
/**
* Overrides DataManager's default query with given query.
* @param {Query} query - Defines the new default query.
*/
DataManager.prototype.setDefaultQuery = function (query) {
this.defaultQuery = query;
return this;
};
/**
* Executes the given query with local data source.
* @param {Query} query - Defines the query to retrieve data.
*/
DataManager.prototype.executeLocal = function (query) {
if (!this.defaultQuery && !(query instanceof Query)) {
DataUtil.throwError('DataManager - executeLocal() : A query is required to execute');
}
if (!this.dataSource.json) {
DataUtil.throwError('DataManager - executeLocal() : Json data is required to execute');
}
query = query || this.defaultQuery;
var result = this.adaptor.processQuery(this, query);
if (query.subQuery) {
var from = query.subQuery.fromTable;
var lookup = query.subQuery.lookups;
var res = query.isCountRequired ? result.result :
result;
if (lookup && lookup instanceof Array) {
DataUtil.buildHierarchy(query.subQuery.fKey, from, res, lookup, query.subQuery.key);
}
else if (typeof dataSource === 'object') {
if (!dataSource.json) {
dataSource.json = [];
for (var j = 0; j < res.length; j++) {
if (res[j][from] instanceof Array) {
res[j] = extend({}, {}, res[j]);
res[j][from] = this.adaptor.processResponse(query.subQuery.using(new DataManager(res[j][from].slice(0))).executeLocal(), this, query);
}
data = {
url: dataSource.url,
insertUrl: dataSource.insertUrl,
removeUrl: dataSource.removeUrl,
updateUrl: dataSource.updateUrl,
crudUrl: dataSource.crudUrl,
batchUrl: dataSource.batchUrl,
json: dataSource.json,
headers: dataSource.headers,
accept: dataSource.accept,
data: dataSource.data,
timeTillExpiration: dataSource.timeTillExpiration,
cachingPageSize: dataSource.cachingPageSize,
enableCaching: dataSource.enableCaching,
requestType: dataSource.requestType,
key: dataSource.key,
crossDomain: dataSource.crossDomain,
jsonp: dataSource.jsonp,
dataType: dataSource.dataType,
offline: dataSource.offline !== undefined ? dataSource.offline
: dataSource.adaptor instanceof adaptors_1.RemoteSaveAdaptor ? false : dataSource.url ? false : true,
requiresFormat: dataSource.requiresFormat
};
}
else {
util_1.DataUtil.throwError('DataManager: Invalid arguments');
}
if (data.requiresFormat === undefined && !util_1.DataUtil.isCors()) {
data.requiresFormat = ej2_base_2.isNullOrUndefined(data.crossDomain) ? true : data.crossDomain;
}
if (data.dataType === undefined) {
data.dataType = 'json';
}
this.dataSource = data;
this.defaultQuery = query;
if (data.url && data.offline && !data.json.length) {
this.isDataAvailable = false;
this.adaptor = adaptor || new adaptors_1.ODataAdaptor();
this.dataSource.offline = false;
this.ready = this.executeQuery(query || new query_1.Query());
this.ready.then(function (e) {
_this.dataSource.offline = true;
_this.isDataAvailable = true;
data.json = e.result;
_this.adaptor = new adaptors_1.JsonAdaptor();
});
}
else {
this.adaptor = data.offline ? new adaptors_1.JsonAdaptor() : new adaptors_1.ODataAdaptor();
}
if (!data.jsonp && this.adaptor instanceof adaptors_1.ODataAdaptor) {
data.jsonp = 'callback';
}
this.adaptor = adaptor || this.adaptor;
if (data.enableCaching) {
this.adaptor = new adaptors_1.CacheAdaptor(this.adaptor, data.timeTillExpiration, data.cachingPageSize);
}
return this;
}
DataManager.prototype.setDefaultQuery = function (query) {
this.defaultQuery = query;
return this;
return this.adaptor.processResponse(result, this, query);
};
/**
* Executes the given query with either local or remote data source.
* It will be executed as asynchronously and returns Promise object which will be resolved or rejected after action completed.
* @param {Query|Function} query - Defines the query to retrieve data.
* @param {Function} done - Defines the callback function and triggers when the Promise is resolved.
* @param {Function} fail - Defines the callback function and triggers when the Promise is rejected.
* @param {Function} always - Defines the callback function and triggers when the Promise is resolved or rejected.
*/
DataManager.prototype.executeQuery = function (query, done, fail, always) {
var _this = this;
if (typeof query === 'function') {
always = fail;
fail = done;
done = query;
query = null;
}
if (!query) {
query = this.defaultQuery;
}
if (!(query instanceof Query)) {
DataUtil.throwError('DataManager - executeQuery() : A query is required to execute');
}
var deffered = new Deferred();
var args = { query: query };
if (!this.dataSource.offline && this.dataSource.url !== undefined) {
var result = this.adaptor.processQuery(this, query);
this.makeRequest(result, deffered, args, query);
}
else {
DataManager.nextTick(function () {
var res = _this.executeLocal(query);
args = DataManager.getDeferedArgs(query, res, args);
deffered.resolve(args);
});
}
if (done || fail) {
deffered.promise.then(done, fail);
}
if (always) {
deffered.promise.then(always, always);
}
return deffered.promise;
};
DataManager.getDeferedArgs = function (query, result, args) {
if (query.isCountRequired) {
args.result = result.result;
args.count = result.count;
args.aggregates = result.aggregates;
}
else {
args.result = result;
}
return args;
};
DataManager.nextTick = function (fn) {
(window.setImmediate || window.setTimeout)(fn, 0);
};
DataManager.prototype.extendRequest = function (url, fnSuccess, fnFail) {
return extend({}, {
type: 'GET',
dataType: this.dataSource.dataType,
crossDomain: this.dataSource.crossDomain,
jsonp: this.dataSource.jsonp,
cache: true,
processData: false,
onSuccess: fnSuccess,
onFailure: fnFail
}, url);
};
DataManager.prototype.makeRequest = function (url, deffered, args, query) {
var _this = this;
var isSelector = !!query.subQuerySelector;
var fnFail = function (e) {
args.error = e;
deffered.reject(args);
};
DataManager.prototype.executeLocal = function (query) {
if (!this.defaultQuery && !(query instanceof query_1.Query)) {
util_1.DataUtil.throwError('DataManager - executeLocal() : A query is required to execute');
}
if (!this.dataSource.json) {
util_1.DataUtil.throwError('DataManager - executeLocal() : Json data is required to execute');
}
query = query || this.defaultQuery;
var result = this.adaptor.processQuery(this, query);
if (query.subQuery) {
var from = query.subQuery.fromTable;
var lookup = query.subQuery.lookups;
var res = query.isCountRequired ? result.result :
result;
if (lookup && lookup instanceof Array) {
util_1.DataUtil.buildHierarchy(query.subQuery.fKey, from, res, lookup, query.subQuery.key);
}
for (var j = 0; j < res.length; j++) {
if (res[j][from] instanceof Array) {
res[j] = ej2_base_2.extend({}, {}, res[j]);
res[j][from] = this.adaptor.processResponse(query.subQuery.using(new DataManager(res[j][from].slice(0))).executeLocal(), this, query);
var process = function (data, count, xhr, request, actual, aggregates, virtualSelectRecords) {
args.xhr = xhr;
args.count = count ? parseInt(count.toString(), 10) : 0;
args.result = data;
args.request = request;
args.aggregates = aggregates;
args.actual = actual;
args.virtualSelectRecords = virtualSelectRecords;
deffered.resolve(args);
};
var fnQueryChild = function (data, selector) {
var subDeffer = new Deferred();
var childArgs = { parent: args };
query.subQuery.isChild = true;
var subUrl = _this.adaptor.processQuery(_this, query.subQuery, data ? _this.adaptor.processResponse(data) : selector);
var childReq = _this.makeRequest(subUrl, subDeffer, childArgs, query.subQuery);
if (!isSelector) {
subDeffer.then(function (subData) {
if (data) {
DataUtil.buildHierarchy(query.subQuery.fKey, query.subQuery.fromTable, data, subData, query.subQuery.key);
process(data, subData.count, subData.xhr);
}
}
}, fnFail);
}
return this.adaptor.processResponse(result, this, query);
return childReq;
};
DataManager.prototype.executeQuery = function (query, done, fail, always) {
var _this = this;
if (typeof query === 'function') {
always = fail;
fail = done;
done = query;
query = null;
var fnSuccess = function (data, request) {
if (request.httpRequest.getResponseHeader('Content-Type').indexOf('xml') === -1 && _this.dateParse) {
data = DataUtil.parse.parseJson(data);
}
if (!query) {
query = this.defaultQuery;
var result = _this.adaptor.processResponse(data, _this, query, request.httpRequest, request);
var count = 0;
var aggregates = null;
var virtualSelectRecords = 'virtualSelectRecords';
var virtualRecords = data[virtualSelectRecords];
if (query.isCountRequired) {
count = result.count;
aggregates = result.aggregates;
result = result.result;
}
if (!(query instanceof query_1.Query)) {
util_1.DataUtil.throwError('DataManager - executeQuery() : A query is required to execute');
if (!query.subQuery) {
process(result, count, request.httpRequest, request.type, data, aggregates, virtualRecords);
return;
}
var deffered = new Deferred();
var args = { query: query };
if (!this.dataSource.offline && this.dataSource.url !== undefined) {
var result = this.adaptor.processQuery(this, query);
this.makeRequest(result, deffered, args, query);
if (!isSelector) {
fnQueryChild(result, request);
}
else {
DataManager.nextTick(function () {
var res = _this.executeLocal(query);
args = DataManager.getDeferedArgs(query, res, args);
deffered.resolve(args);
};
var req = this.extendRequest(url, fnSuccess, fnFail);
var ajax = new Ajax(req);
ajax.beforeSend = function () {
_this.beforeSend(ajax.httpRequest, ajax);
};
req = ajax.send();
req.catch(function (e) { return true; }); // to handle failure remote requests.
this.requests.push(ajax);
if (isSelector) {
var promise = void 0;
var res = query.subQuerySelector.call(this, { query: query.subQuery, parent: query });
if (res && res.length) {
promise = Promise.all([req, fnQueryChild(null, res)]);
promise.then(function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var result = args[0];
var pResult = _this.adaptor.processResponse(result[0], _this, query, _this.requests[0].httpRequest, _this.requests[0]);
var count = 0;
if (query.isCountRequired) {
count = pResult.count;
pResult = pResult.result;
}
var cResult = _this.adaptor.processResponse(result[1], _this, query.subQuery, _this.requests[1].httpRequest, _this.requests[1]);
count = 0;
if (query.subQuery.isCountRequired) {
count = cResult.count;
cResult = cResult.result;
}
DataUtil.buildHierarchy(query.subQuery.fKey, query.subQuery.fromTable, pResult, cResult, query.subQuery.key);
isSelector = false;
process(pResult, count, _this.requests[0].httpRequest);
});
}
if (done || fail) {
deffered.promise.then(done, fail);
else {
isSelector = false;
}
if (always) {
deffered.promise.then(always, always);
}
return req;
};
DataManager.prototype.beforeSend = function (request, settings) {
this.adaptor.beforeSend(this, request, settings);
var headers = this.dataSource.headers;
var props;
for (var i = 0; headers && i < headers.length; i++) {
props = [];
var keys = Object.keys(headers[i]);
for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
var prop = keys_1[_i];
props.push(prop);
request.setRequestHeader(prop, headers[i][prop]);
}
return deffered.promise;
}
};
/**
* Save bulk changes to the given table name.
* User can add a new record, edit an existing record, and delete a record at the same time.
* If the datasource from remote, then updated in a single post.
* @param {Object} changes - Defines the CrudOptions.
* @param {string} key - Defines the column field.
* @param {string|Query} tableName - Defines the table name.
* @param {Query} query - Sets default query for the DataManager.
*/
DataManager.prototype.saveChanges = function (changes, key, tableName, query) {
var _this = this;
if (tableName instanceof Query) {
query = tableName;
tableName = null;
}
var args = {
url: tableName,
key: key || this.dataSource.key
};
DataManager.getDeferedArgs = function (query, result, args) {
if (query.isCountRequired) {
args.result = result.result;
args.count = result.count;
args.aggregates = result.aggregates;
}
else {
args.result = result;
}
return args;
var req = this.adaptor.batchRequest(this, changes, args, query);
if (this.dataSource.offline) {
return req;
}
var deff = new Deferred();
var ajax = new Ajax(req);
ajax.beforeSend = function () {
_this.beforeSend(ajax.httpRequest, ajax);
};
DataManager.nextTick = function (fn) {
(window.setImmediate || window.setTimeout)(fn, 0);
ajax.onSuccess = function (data, request) {
deff.resolve(_this.adaptor.processResponse(DataUtil.parse.parseJson(data), _this, null, request.httpRequest, request, changes));
};
DataManager.prototype.extendRequest = function (url, fnSuccess, fnFail) {
return ej2_base_2.extend({}, {
type: 'GET',
dataType: this.dataSource.dataType,
crossDomain: this.dataSource.crossDomain,
jsonp: this.dataSource.jsonp,
cache: true,
processData: false,
onSuccess: fnSuccess,
onFailure: fnFail
}, url);
ajax.onFailure = function (e) {
deff.reject([{ error: e }]);
};
DataManager.prototype.makeRequest = function (url, deffered, args, query) {
var _this = this;
var isSelector = !!query.subQuerySelector;
var fnFail = function (e) {
args.error = e;
deffered.reject(args);
};
var process = function (data, count, xhr, request, actual, aggregates, virtualSelectRecords) {
args.xhr = xhr;
args.count = count ? parseInt(count.toString(), 10) : 0;
args.result = data;
args.request = request;
args.aggregates = aggregates;
args.actual = actual;
args.virtualSelectRecords = virtualSelectRecords;
deffered.resolve(args);
};
var fnQueryChild = function (data, selector) {
var subDeffer = new Deferred();
var childArgs = { parent: args };
query.subQuery.isChild = true;
var subUrl = _this.adaptor.processQuery(_this, query.subQuery, data ? _this.adaptor.processResponse(data) : selector);
var childReq = _this.makeRequest(subUrl, subDeffer, childArgs, query.subQuery);
if (!isSelector) {
subDeffer.then(function (subData) {
if (data) {
util_1.DataUtil.buildHierarchy(query.subQuery.fKey, query.subQuery.fromTable, data, subData, query.subQuery.key);
process(data, subData.count, subData.xhr);
}
}, fnFail);
}
return childReq;
};
var fnSuccess = function (data, request) {
if (request.httpRequest.getResponseHeader('Content-Type').indexOf('xml') === -1 && _this.dateParse) {
data = util_1.DataUtil.parse.parseJson(data);
}
var result = _this.adaptor.processResponse(data, _this, query, request.httpRequest, request);
var count = 0;
var aggregates = null;
var virtualSelectRecords = 'virtualSelectRecords';
var virtualRecords = data[virtualSelectRecords];
if (query.isCountRequired) {
count = result.count;
aggregates = result.aggregates;
result = result.result;
}
if (!query.subQuery) {
process(result, count, request.httpRequest, request.type, data, aggregates, virtualRecords);
return;
}
if (!isSelector) {
fnQueryChild(result, request);
}
};
var req = this.extendRequest(url, fnSuccess, fnFail);
var ajax = new ej2_base_1.Ajax(req);
ajax.beforeSend = function () {
_this.beforeSend(ajax.httpRequest, ajax);
};
req = ajax.send();
req.catch(function (e) { return true; });
this.requests.push(ajax);
if (isSelector) {
var promise = void 0;
var res = query.subQuerySelector.call(this, { query: query.subQuery, parent: query });
if (res && res.length) {
promise = Promise.all([req, fnQueryChild(null, res)]);
promise.then(function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var result = args[0];
var pResult = _this.adaptor.processResponse(result[0], _this, query, _this.requests[0].httpRequest, _this.requests[0]);
var count = 0;
if (query.isCountRequired) {
count = pResult.count;
pResult = pResult.result;
}
var cResult = _this.adaptor.processResponse(result[1], _this, query.subQuery, _this.requests[1].httpRequest, _this.requests[1]);
count = 0;
if (query.subQuery.isCountRequired) {
count = cResult.count;
cResult = cResult.result;
}
util_1.DataUtil.buildHierarchy(query.subQuery.fKey, query.subQuery.fromTable, pResult, cResult, query.subQuery.key);
isSelector = false;
process(pResult, count, _this.requests[0].httpRequest);
});
}
else {
isSelector = false;
}
}
ajax.send().catch(function (e) { return true; }); // to handle the failure requests.
return deff.promise;
};
/**
* Inserts new record in the given table.
* @param {Object} data - Defines the data to insert.
* @param {string|Query} tableName - Defines the table name.
* @param {Query} query - Sets default query for the DataManager.
*/
DataManager.prototype.insert = function (data, tableName, query, position) {
if (tableName instanceof Query) {
query = tableName;
tableName = null;
}
var req = this.adaptor.insert(this, data, tableName, query, position);
if (this.dataSource.offline) {
return req;
}
return this.doAjaxRequest(req);
};
/**
* Removes data from the table with the given key.
* @param {string} keyField - Defines the column field.
* @param {Object} value - Defines the value to find the data in the specified column.
* @param {string|Query} tableName - Defines the table name
* @param {Query} query - Sets default query for the DataManager.
*/
DataManager.prototype.remove = function (keyField, value, tableName, query) {
if (typeof value === 'object') {
value = value[keyField];
}
if (tableName instanceof Query) {
query = tableName;
tableName = null;
}
var res = this.adaptor.remove(this, keyField, value, tableName, query);
if (this.dataSource.offline) {
return res;
}
return this.doAjaxRequest(res);
};
/**
* Updates existing record in the given table.
* @param {string} keyField - Defines the column field.
* @param {Object} value - Defines the value to find the data in the specified column.
* @param {string|Query} tableName - Defines the table name
* @param {Query} query - Sets default query for the DataManager.
*/
DataManager.prototype.update = function (keyField, value, tableName, query) {
if (tableName instanceof Query) {
query = tableName;
tableName = null;
}
var res = this.adaptor.update(this, keyField, value, tableName, query);
if (this.dataSource.offline) {
return res;
}
return this.doAjaxRequest(res);
};
DataManager.prototype.doAjaxRequest = function (res) {
var _this = this;
var defer = new Deferred();
res = extend({}, {
type: 'POST',
contentType: 'application/json; charset=utf-8',
processData: false
}, res);
var ajax = new Ajax(res);
ajax.beforeSend = function () {
_this.beforeSend(ajax.httpRequest, ajax);
};
DataManager.prototype.beforeSend = function (request, settings) {
this.adaptor.beforeSend(this, request, settings);
var headers = this.dataSource.headers;
var props;
for (var i = 0; headers && i < headers.length; i++) {
props = [];
var keys = Object.keys(headers[i]);
for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
var prop = keys_1[_i];
props.push(prop);
request.setRequestHeader(prop, headers[i][prop]);
}
ajax.onSuccess = function (record, request) {
try {
DataUtil.parse.parseJson(record);
}
};
DataManager.prototype.saveChanges = function (changes, key, tableName, query) {
var _this = this;
if (tableName instanceof query_1.Query) {
query = tableName;
tableName = null;
catch (e) {
record = [];
}
var args = {
url: tableName,
key: key || this.dataSource.key
};
var req = this.adaptor.batchRequest(this, changes, args, query);
if (this.dataSource.offline) {
return req;
}
var deff = new Deferred();
var ajax = new ej2_base_1.Ajax(req);
ajax.beforeSend = function () {
_this.beforeSend(ajax.httpRequest, ajax);
};
ajax.onSuccess = function (data, request) {
deff.resolve(_this.adaptor.processResponse(util_1.DataUtil.parse.parseJson(data), _this, null, request.httpRequest, request, changes));
};
ajax.onFailure = function (e) {
deff.reject([{ error: e }]);
};
ajax.send().catch(function (e) { return true; });
return deff.promise;
record = _this.adaptor.processResponse(DataUtil.parse.parseJson(record), _this, null, request.httpRequest, request);
defer.resolve(record);
};
DataManager.prototype.insert = function (data, tableName, query, position) {
if (tableName instanceof query_1.Query) {
query = tableName;
tableName = null;
}
var req = this.adaptor.insert(this, data, tableName, query, position);
if (this.dataSource.offline) {
return req;
}
return this.doAjaxRequest(req);
ajax.onFailure = function (e) {
defer.reject([{ error: e }]);
};
DataManager.prototype.remove = function (keyField, value, tableName, query) {
if (typeof value === 'object') {
value = value[keyField];
}
if (tableName instanceof query_1.Query) {
query = tableName;
tableName = null;
}
var res = this.adaptor.remove(this, keyField, value, tableName, query);
if (this.dataSource.offline) {
return res;
}
return this.doAjaxRequest(res);
};
DataManager.prototype.update = function (keyField, value, tableName, query) {
if (tableName instanceof query_1.Query) {
query = tableName;
tableName = null;
}
var res = this.adaptor.update(this, keyField, value, tableName, query);
if (this.dataSource.offline) {
return res;
}
return this.doAjaxRequest(res);
};
DataManager.prototype.doAjaxRequest = function (res) {
var _this = this;
var defer = new Deferred();
res = ej2_base_2.extend({}, {
type: 'POST',
contentType: 'application/json; charset=utf-8',
processData: false
}, res);
var ajax = new ej2_base_1.Ajax(res);
ajax.beforeSend = function () {
_this.beforeSend(ajax.httpRequest, ajax);
};
ajax.onSuccess = function (record, request) {
try {
util_1.DataUtil.parse.parseJson(record);
}
catch (e) {
record = [];
}
record = _this.adaptor.processResponse(util_1.DataUtil.parse.parseJson(record), _this, null, request.httpRequest, request);
defer.resolve(record);
};
ajax.onFailure = function (e) {
defer.reject([{ error: e }]);
};
ajax.send().catch(function (e) { return true; });
return defer.promise;
};
return DataManager;
}());
exports.DataManager = DataManager;
var Deferred = (function () {
function Deferred() {
var _this = this;
this.promise = new Promise(function (resolve, reject) {
_this.resolve = resolve;
_this.reject = reject;
});
this.then = this.promise.then.bind(this.promise);
this.catch = this.promise.catch.bind(this.promise);
}
return Deferred;
}());
exports.Deferred = Deferred;
});
ajax.send().catch(function (e) { return true; }); // to handle the failure requests.
return defer.promise;
};
return DataManager;
}());
export { DataManager };
/**
* Deferred is used to handle asynchronous operation.
*/
var Deferred = /** @class */ (function () {
function Deferred() {
var _this = this;
/**
* Promise is an object that represents a value that may not be available yet, but will be resolved at some point in the future.
*/
this.promise = new Promise(function (resolve, reject) {
_this.resolve = resolve;
_this.reject = reject;
});
/**
* Defines the callback function triggers when the Deferred object is resolved.
*/
this.then = this.promise.then.bind(this.promise);
/**
* Defines the callback function triggers when the Deferred object is rejected.
*/
this.catch = this.promise.catch.bind(this.promise);
}
return Deferred;
}());
export { Deferred };

@@ -1,400 +0,582 @@

define(["require", "exports", "./util"], function (require, exports, util_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Query = (function () {
function Query(from) {
this.subQuery = null;
this.isChild = false;
this.queries = [];
this.key = '';
this.fKey = '';
if (typeof from === 'string') {
this.fromTable = from;
import { DataUtil } from './util';
/**
* Query class is used to build query which is used by the DataManager to communicate with datasource.
*/
var Query = /** @class */ (function () {
/**
* Constructor for Query class.
* @param {string|string[]} from?
* @hidden
*/
function Query(from) {
/** @hidden */
this.subQuery = null;
/** @hidden */
this.isChild = false;
this.queries = [];
this.key = '';
this.fKey = '';
if (typeof from === 'string') {
this.fromTable = from;
}
else if (from && from instanceof Array) {
this.lookups = from;
}
this.expands = [];
this.sortedColumns = [];
this.groupedColumns = [];
this.subQuery = null;
this.isChild = false;
this.params = [];
return this;
}
/**
* Sets the primary key.
* @param {string} field - Defines the column field.
*/
Query.prototype.setKey = function (field) {
this.key = field;
return this;
};
/**
* Sets default DataManager to execute query.
* @param {DataManager} dataManager - Defines the DataManager.
*/
Query.prototype.using = function (dataManager) {
this.dataManager = dataManager;
return this;
};
/**
* Executes query with the given DataManager.
* @param {DataManager} dataManager - Defines the DataManager.
* @param {Function} done - Defines the success callback.
* @param {Function} fail - Defines the failure callback.
* @param {Function} always - Defines the callback which will be invoked on either success or failure.
*
* <pre>
* let dataManager: DataManager = new DataManager([{ ID: '10' }, { ID: '2' }, { ID: '1' }, { ID: '20' }]);
* let query: Query = new Query();
* query.sortBy('ID', (x: string, y: string): number => { return parseInt(x, 10) - parseInt(y, 10) });
* let promise: Promise< Object > = query.execute(dataManager);
* promise.then((e: { result: Object }) => { });
* </pre>
*/
Query.prototype.execute = function (dataManager, done, fail, always) {
dataManager = dataManager || this.dataManager;
if (dataManager) {
return dataManager.executeQuery(this, done, fail, always);
}
return DataUtil.throwError('Query - execute() : dataManager needs to be is set using "using" function or should be passed as argument');
};
/**
* Executes query with the local datasource.
* @param {DataManager} dataManager - Defines the DataManager.
*/
Query.prototype.executeLocal = function (dataManager) {
dataManager = dataManager || this.dataManager;
if (dataManager) {
return dataManager.executeLocal(this);
}
return DataUtil.throwError('Query - executeLocal() : dataManager needs to be is set using "using" function or should be passed as argument');
};
/**
* Creates deep copy of the Query object.
*/
Query.prototype.clone = function () {
var cloned = new Query();
cloned.queries = this.queries.slice(0);
cloned.key = this.key;
cloned.isChild = this.isChild;
cloned.dataManager = this.dataManager;
cloned.fromTable = this.fromTable;
cloned.params = this.params.slice(0);
cloned.expands = this.expands.slice(0);
cloned.sortedColumns = this.sortedColumns.slice(0);
cloned.groupedColumns = this.groupedColumns.slice(0);
cloned.subQuerySelector = this.subQuerySelector;
cloned.subQuery = this.subQuery;
cloned.fKey = this.fKey;
cloned.isCountRequired = this.isCountRequired;
return cloned;
};
/**
* Specifies the name of table to retrieve data in query execution.
* @param {string} tableName - Defines the table name.
*/
Query.prototype.from = function (tableName) {
this.fromTable = tableName;
return this;
};
/**
* Adds additional parameter which will be sent along with the request which will be generated while DataManager execute.
* @param {string} key - Defines the key of additional parameter.
* @param {Function|string} value - Defines the value for the key.
*/
Query.prototype.addParams = function (key, value) {
if (typeof value === 'function') {
this.params.push({ key: key, fn: value });
}
else {
this.params.push({ key: key, value: value });
}
return this;
};
/**
* Expands the related table.
* @param {string|Object[]} tables
*/
Query.prototype.expand = function (tables) {
if (typeof tables === 'string') {
this.expands = [].slice.call([tables], 0);
}
else {
this.expands = tables.slice(0);
}
return this;
};
/**
* Filter data with given filter criteria.
* @param {string|Predicate} fieldName - Defines the column field or Predicate.
* @param {string} operator - Defines the operator how to filter data.
* @param {string|number|boolean} value - Defines the values to match with data.
* @param {boolean} ignoreCase - If ignore case set to false, then filter data with exact match or else
* filter data with case insensitive.
*/
Query.prototype.where = function (fieldName, operator, value, ignoreCase, ignoreAccent) {
operator = operator ? (operator).toLowerCase() : null;
var predicate = null;
if (typeof fieldName === 'string') {
predicate = new Predicate(fieldName, operator, value, ignoreCase, ignoreAccent);
}
else if (fieldName instanceof Predicate) {
predicate = fieldName;
}
this.queries.push({
fn: 'onWhere',
e: predicate
});
return this;
};
/**
* Search data with given search criteria.
* @param {string|number|boolean} searchKey - Defines the search key.
* @param {string|string[]} fieldNames - Defines the collection of column fields.
* @param {string} operator - Defines the operator how to search data.
* @param {boolean} ignoreCase - If ignore case set to false, then filter data with exact match or else
* filter data with case insensitive.
*/
Query.prototype.search = function (searchKey, fieldNames, operator, ignoreCase, ignoreAccent) {
if (typeof fieldNames === 'string') {
fieldNames = [fieldNames];
}
operator = operator || 'contains';
var comparer = DataUtil.fnOperators[operator];
this.queries.push({
fn: 'onSearch',
e: {
fieldNames: fieldNames,
operator: operator,
searchKey: searchKey,
ignoreCase: ignoreCase,
ignoreAccent: ignoreAccent,
comparer: comparer
}
else if (from && from instanceof Array) {
this.lookups = from;
}
this.expands = [];
this.sortedColumns = [];
this.groupedColumns = [];
this.subQuery = null;
this.isChild = false;
this.params = [];
return this;
});
return this;
};
/**
* Sort the data with given sort criteria.
* By default, sort direction is ascending.
* @param {string|string[]} fieldName - Defines the single or collection of column fields.
* @param {string|Function} comparer - Defines the sort direction or custom sort comparer function.
*/
Query.prototype.sortBy = function (fieldName, comparer, isFromGroup) {
var order = 'ascending';
var sorts;
var temp;
if (typeof fieldName === 'string' && DataUtil.endsWith(fieldName.toLowerCase(), ' desc')) {
fieldName = fieldName.replace(/ desc$/i, '');
comparer = 'descending';
}
Query.prototype.setKey = function (field) {
this.key = field;
return this;
};
Query.prototype.using = function (dataManager) {
this.dataManager = dataManager;
return this;
};
Query.prototype.execute = function (dataManager, done, fail, always) {
dataManager = dataManager || this.dataManager;
if (dataManager) {
return dataManager.executeQuery(this, done, fail, always);
}
return util_1.DataUtil.throwError('Query - execute() : dataManager needs to be is set using "using" function or should be passed as argument');
};
Query.prototype.executeLocal = function (dataManager) {
dataManager = dataManager || this.dataManager;
if (dataManager) {
return dataManager.executeLocal(this);
}
return util_1.DataUtil.throwError('Query - executeLocal() : dataManager needs to be is set using "using" function or should be passed as argument');
};
Query.prototype.clone = function () {
var cloned = new Query();
cloned.queries = this.queries.slice(0);
cloned.key = this.key;
cloned.isChild = this.isChild;
cloned.dataManager = this.dataManager;
cloned.fromTable = this.fromTable;
cloned.params = this.params.slice(0);
cloned.expands = this.expands.slice(0);
cloned.sortedColumns = this.sortedColumns.slice(0);
cloned.groupedColumns = this.groupedColumns.slice(0);
cloned.subQuerySelector = this.subQuerySelector;
cloned.subQuery = this.subQuery;
cloned.fKey = this.fKey;
cloned.isCountRequired = this.isCountRequired;
return cloned;
};
Query.prototype.from = function (tableName) {
this.fromTable = tableName;
return this;
};
Query.prototype.addParams = function (key, value) {
if (typeof value === 'function') {
this.params.push({ key: key, fn: value });
}
else {
this.params.push({ key: key, value: value });
}
return this;
};
Query.prototype.expand = function (tables) {
if (typeof tables === 'string') {
this.expands = [].slice.call([tables], 0);
}
else {
this.expands = tables.slice(0);
}
return this;
};
Query.prototype.where = function (fieldName, operator, value, ignoreCase, ignoreAccent) {
operator = operator ? (operator).toLowerCase() : null;
var predicate = null;
if (typeof fieldName === 'string') {
predicate = new Predicate(fieldName, operator, value, ignoreCase, ignoreAccent);
}
else if (fieldName instanceof Predicate) {
predicate = fieldName;
}
this.queries.push({
fn: 'onWhere',
e: predicate
});
return this;
};
Query.prototype.search = function (searchKey, fieldNames, operator, ignoreCase, ignoreAccent) {
if (typeof fieldNames === 'string') {
fieldNames = [fieldNames];
}
operator = operator || 'contains';
var comparer = util_1.DataUtil.fnOperators[operator];
this.queries.push({
fn: 'onSearch',
e: {
fieldNames: fieldNames,
operator: operator,
searchKey: searchKey,
ignoreCase: ignoreCase,
ignoreAccent: ignoreAccent,
comparer: comparer
if (!comparer || typeof comparer === 'string') {
order = comparer ? comparer.toLowerCase() : 'ascending';
comparer = DataUtil.fnSort(comparer);
}
if (isFromGroup) {
sorts = Query.filterQueries(this.queries, 'onSortBy');
for (var i = 0; i < sorts.length; i++) {
temp = sorts[i].e.fieldName;
if (typeof temp === 'string') {
if (temp === fieldName) {
return this;
}
}
});
return this;
};
Query.prototype.sortBy = function (fieldName, comparer, isFromGroup) {
var order = 'ascending';
var sorts;
var temp;
if (typeof fieldName === 'string' && util_1.DataUtil.endsWith(fieldName.toLowerCase(), ' desc')) {
fieldName = fieldName.replace(/ desc$/i, '');
comparer = 'descending';
}
if (!comparer || typeof comparer === 'string') {
order = comparer ? comparer.toLowerCase() : 'ascending';
comparer = util_1.DataUtil.fnSort(comparer);
}
if (isFromGroup) {
sorts = Query.filterQueries(this.queries, 'onSortBy');
for (var i = 0; i < sorts.length; i++) {
temp = sorts[i].e.fieldName;
if (typeof temp === 'string') {
if (temp === fieldName) {
else if (temp instanceof Array) {
for (var j = 0; j < temp.length; j++) {
if (temp[j] === fieldName || fieldName.toLowerCase() === temp[j] + ' desc') {
return this;
}
}
else if (temp instanceof Array) {
for (var j = 0; j < temp.length; j++) {
if (temp[j] === fieldName || fieldName.toLowerCase() === temp[j] + ' desc') {
return this;
}
}
}
}
}
this.queries.push({
fn: 'onSortBy',
e: {
fieldName: fieldName,
comparer: comparer,
direction: order
}
});
return this;
};
Query.prototype.sortByDesc = function (fieldName) {
return this.sortBy(fieldName, 'descending');
};
Query.prototype.group = function (fieldName, fn, format) {
this.sortBy(fieldName, null, true);
this.queries.push({
fn: 'onGroup',
e: {
fieldName: fieldName,
comparer: fn ? fn : null,
format: format ? format : null
}
});
return this;
};
Query.prototype.page = function (pageIndex, pageSize) {
this.queries.push({
fn: 'onPage',
e: {
pageIndex: pageIndex,
pageSize: pageSize
}
});
return this;
};
Query.prototype.range = function (start, end) {
this.queries.push({
fn: 'onRange',
e: {
start: start,
end: end
}
});
return this;
};
Query.prototype.take = function (nos) {
this.queries.push({
fn: 'onTake',
e: {
nos: nos
}
});
return this;
};
Query.prototype.skip = function (nos) {
this.queries.push({
fn: 'onSkip',
e: { nos: nos }
});
return this;
};
Query.prototype.select = function (fieldNames) {
if (typeof fieldNames === 'string') {
fieldNames = [].slice.call([fieldNames], 0);
}
this.queries.push({
fn: 'onSortBy',
e: {
fieldName: fieldName,
comparer: comparer,
direction: order
}
this.queries.push({
fn: 'onSelect',
e: { fieldNames: fieldNames }
});
return this;
};
Query.prototype.hierarchy = function (query, selectorFn) {
this.subQuerySelector = selectorFn;
this.subQuery = query;
return this;
};
Query.prototype.foreignKey = function (key) {
this.fKey = key;
return this;
};
Query.prototype.requiresCount = function () {
this.isCountRequired = true;
return this;
};
Query.prototype.aggregate = function (type, field) {
this.queries.push({
fn: 'onAggregates',
e: { field: field, type: type }
});
return this;
};
Query.filterQueries = function (queries, name) {
return queries.filter(function (q) {
return q.fn === name;
});
};
Query.filterQueryLists = function (queries, singles) {
var filtered = queries.filter(function (q) {
return singles.indexOf(q.fn) !== -1;
});
var res = {};
for (var i = 0; i < filtered.length; i++) {
if (!res[filtered[i].fn]) {
res[filtered[i].fn] = filtered[i].e;
}
});
return this;
};
/**
* Sorts data in descending order.
* @param {string} fieldName - Defines the column field.
*/
Query.prototype.sortByDesc = function (fieldName) {
return this.sortBy(fieldName, 'descending');
};
/**
* Groups data with the given field name.
* @param {string} fieldName - Defines the column field.
*/
Query.prototype.group = function (fieldName, fn, format) {
this.sortBy(fieldName, null, true);
this.queries.push({
fn: 'onGroup',
e: {
fieldName: fieldName,
comparer: fn ? fn : null,
format: format ? format : null
}
return res;
};
return Query;
}());
exports.Query = Query;
var Predicate = (function () {
function Predicate(field, operator, value, ignoreCase, ignoreAccent) {
if (ignoreCase === void 0) { ignoreCase = false; }
this.ignoreAccent = false;
this.isComplex = false;
if (typeof field === 'string') {
this.field = field;
this.operator = operator.toLowerCase();
this.value = value;
this.ignoreCase = ignoreCase;
this.ignoreAccent = ignoreAccent;
this.isComplex = false;
this.comparer = util_1.DataUtil.fnOperators.processOperator(this.operator);
});
return this;
};
/**
* Gets data based on the given page index and size.
* @param {number} pageIndex - Defines the current page index.
* @param {number} pageSize - Defines the no of records per page.
*/
Query.prototype.page = function (pageIndex, pageSize) {
this.queries.push({
fn: 'onPage',
e: {
pageIndex: pageIndex,
pageSize: pageSize
}
else if (field instanceof Predicate && value instanceof Predicate || value instanceof Array) {
this.isComplex = true;
this.condition = operator.toLowerCase();
this.predicates = [field];
if (value instanceof Array) {
[].push.apply(this.predicates, value);
}
else {
this.predicates.push(value);
}
});
return this;
};
/**
* Gets data based on the given start and end index.
* @param {number} start - Defines the start index of the datasource.
* @param {number} end - Defines the end index of the datasource.
*/
Query.prototype.range = function (start, end) {
this.queries.push({
fn: 'onRange',
e: {
start: start,
end: end
}
return this;
});
return this;
};
/**
* Gets data from the top of the data source based on given number of records count.
* @param {number} nos - Defines the no of records to retrieve from datasource.
*/
Query.prototype.take = function (nos) {
this.queries.push({
fn: 'onTake',
e: {
nos: nos
}
});
return this;
};
/**
* Skips data with given number of records count from the top of the data source.
* @param {number} nos - Defines the no of records skip in the datasource.
*/
Query.prototype.skip = function (nos) {
this.queries.push({
fn: 'onSkip',
e: { nos: nos }
});
return this;
};
/**
* Selects specified columns from the data source.
* @param {string|string[]} fieldNames - Defines the collection of column fields.
*/
Query.prototype.select = function (fieldNames) {
if (typeof fieldNames === 'string') {
fieldNames = [].slice.call([fieldNames], 0);
}
Predicate.and = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
this.queries.push({
fn: 'onSelect',
e: { fieldNames: fieldNames }
});
return this;
};
/**
* Gets the records in hierarchical relationship from two tables. It requires the foreign key to relate two tables.
* @param {Query} query - Defines the query to relate two tables.
* @param {Function} selectorFn - Defines the custom function to select records.
*/
Query.prototype.hierarchy = function (query, selectorFn) {
this.subQuerySelector = selectorFn;
this.subQuery = query;
return this;
};
/**
* Sets the foreign key which is used to get data from the related table.
* @param {string} key - Defines the foreign key.
*/
Query.prototype.foreignKey = function (key) {
this.fKey = key;
return this;
};
/**
* It is used to get total number of records in the DataManager execution result.
*/
Query.prototype.requiresCount = function () {
this.isCountRequired = true;
return this;
};
//type - sum, avg, min, max
/**
* Aggregate the data with given type and field name.
* @param {string} type - Defines the aggregate type.
* @param {string} field - Defines the column field to aggregate.
*/
Query.prototype.aggregate = function (type, field) {
this.queries.push({
fn: 'onAggregates',
e: { field: field, type: type }
});
return this;
};
/**
* Pass array of filterColumn query for performing filter operation.
* @param {QueryOptions[]} queries
* @param {string} name
* @hidden
*/
Query.filterQueries = function (queries, name) {
return queries.filter(function (q) {
return q.fn === name;
});
};
/**
* To get the list of queries which is already filtered in current data source.
* @param {Object[]} queries
* @param {string[]} singles
* @hidden
*/
Query.filterQueryLists = function (queries, singles) {
var filtered = queries.filter(function (q) {
return singles.indexOf(q.fn) !== -1;
});
var res = {};
for (var i = 0; i < filtered.length; i++) {
if (!res[filtered[i].fn]) {
res[filtered[i].fn] = filtered[i].e;
}
return Predicate.combinePredicates([].slice.call(args, 0), 'and');
};
Predicate.prototype.and = function (field, operator, value, ignoreCase, ignoreAccent) {
return Predicate.combine(this, field, operator, value, 'and', ignoreCase, ignoreAccent);
};
Predicate.or = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return res;
};
return Query;
}());
export { Query };
/**
* Predicate class is used to generate complex filter criteria.
* This will be used by DataManager to perform multiple filtering operation.
*/
var Predicate = /** @class */ (function () {
/**
* Constructor for Predicate class.
* @param {string|Predicate} field
* @param {string} operator
* @param {string|number|boolean|Predicate|Predicate[]} value
* @param {boolean=false} ignoreCase
* @hidden
*/
function Predicate(field, operator, value, ignoreCase, ignoreAccent) {
if (ignoreCase === void 0) { ignoreCase = false; }
/** @hidden */
this.ignoreAccent = false;
/** @hidden */
this.isComplex = false;
if (typeof field === 'string') {
this.field = field;
this.operator = operator.toLowerCase();
this.value = value;
this.ignoreCase = ignoreCase;
this.ignoreAccent = ignoreAccent;
this.isComplex = false;
this.comparer = DataUtil.fnOperators.processOperator(this.operator);
}
else if (field instanceof Predicate && value instanceof Predicate || value instanceof Array) {
this.isComplex = true;
this.condition = operator.toLowerCase();
this.predicates = [field];
if (value instanceof Array) {
[].push.apply(this.predicates, value);
}
return Predicate.combinePredicates([].slice.call(args, 0), 'or');
};
Predicate.prototype.or = function (field, operator, value, ignoreCase, ignoreAccent) {
return Predicate.combine(this, field, operator, value, 'or', ignoreCase, ignoreAccent);
};
Predicate.fromJson = function (json) {
if (json instanceof Array) {
var res = [];
for (var i = 0, len = json.length; i < len; i++) {
res.push(this.fromJSONData(json[i]));
}
return res;
else {
this.predicates.push(value);
}
var pred = json;
return this.fromJSONData(pred);
};
Predicate.prototype.validate = function (record) {
var predicate = this.predicates ? this.predicates : [];
var isAnd;
var ret;
if (!this.isComplex && this.comparer) {
return this.comparer.call(this, util_1.DataUtil.getObject(this.field, record), this.value, this.ignoreCase, this.ignoreAccent);
}
return this;
}
/**
* Adds n-number of new predicates on existing predicate with “and” condition.
* @param {Object[]} args - Defines the collection of predicates.
*/
Predicate.and = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return Predicate.combinePredicates([].slice.call(args, 0), 'and');
};
/**
* Adds new predicate on existing predicate with “and” condition.
* @param {string} field - Defines the column field.
* @param {string} operator - Defines the operator how to filter data.
* @param {string} value - Defines the values to match with data.
* @param {boolean} ignoreCase? - If ignore case set to false, then filter data with exact match or else
* filter data with case insensitive.
*/
Predicate.prototype.and = function (field, operator, value, ignoreCase, ignoreAccent) {
return Predicate.combine(this, field, operator, value, 'and', ignoreCase, ignoreAccent);
};
/**
* Adds n-number of new predicates on existing predicate with “or” condition.
* @param {Object[]} args - Defines the collection of predicates.
*/
Predicate.or = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return Predicate.combinePredicates([].slice.call(args, 0), 'or');
};
/**
* Adds new predicate on existing predicate with “or” condition.
* @param {string} field - Defines the column field.
* @param {string} operator - Defines the operator how to filter data.
* @param {string} value - Defines the values to match with data.
* @param {boolean} ignoreCase? - If ignore case set to false, then filter data with exact match or else
* filter data with case insensitive.
*/
Predicate.prototype.or = function (field, operator, value, ignoreCase, ignoreAccent) {
return Predicate.combine(this, field, operator, value, 'or', ignoreCase, ignoreAccent);
};
/**
* Converts plain JavaScript object to Predicate object.
* @param {Predicate[]|Predicate} json - Defines single or collection of Predicate.
*/
Predicate.fromJson = function (json) {
if (json instanceof Array) {
var res = [];
for (var i = 0, len = json.length; i < len; i++) {
res.push(this.fromJSONData(json[i]));
}
isAnd = this.condition === 'and';
for (var i = 0; i < predicate.length; i++) {
ret = predicate[i].validate(record);
if (isAnd) {
if (!ret) {
return false;
}
return res;
}
var pred = json;
return this.fromJSONData(pred);
};
/**
* Validate the record based on the predicates.
* @param {Object} record - Defines the datasource record.
*/
Predicate.prototype.validate = function (record) {
var predicate = this.predicates ? this.predicates : [];
var isAnd;
var ret;
if (!this.isComplex && this.comparer) {
return this.comparer.call(this, DataUtil.getObject(this.field, record), this.value, this.ignoreCase, this.ignoreAccent);
}
isAnd = this.condition === 'and';
for (var i = 0; i < predicate.length; i++) {
ret = predicate[i].validate(record);
if (isAnd) {
if (!ret) {
return false;
}
else {
if (ret) {
return true;
}
}
}
return isAnd;
};
Predicate.prototype.toJson = function () {
var predicates;
var p;
if (this.isComplex) {
predicates = [];
p = this.predicates;
for (var i = 0; i < p.length; i++) {
predicates.push(p[i].toJson());
else {
if (ret) {
return true;
}
}
return {
isComplex: this.isComplex,
field: this.field,
operator: this.operator,
value: this.value,
ignoreCase: this.ignoreCase,
ignoreAccent: this.ignoreAccent,
condition: this.condition,
predicates: predicates
};
};
Predicate.combinePredicates = function (predicates, operator) {
if (predicates.length === 1) {
if (!(predicates[0] instanceof Array)) {
return predicates[0];
}
predicates = predicates[0];
}
return isAnd;
};
/**
* Converts predicates to plain JavaScript.
* This method is uses Json stringify when serializing Predicate object.
*/
Predicate.prototype.toJson = function () {
var predicates;
var p;
if (this.isComplex) {
predicates = [];
p = this.predicates;
for (var i = 0; i < p.length; i++) {
predicates.push(p[i].toJson());
}
return new Predicate(predicates[0], operator, predicates.slice(1));
}
return {
isComplex: this.isComplex,
field: this.field,
operator: this.operator,
value: this.value,
ignoreCase: this.ignoreCase,
ignoreAccent: this.ignoreAccent,
condition: this.condition,
predicates: predicates
};
Predicate.combine = function (pred, field, operator, value, condition, ignoreCase, ignoreAccent) {
if (field instanceof Predicate) {
return Predicate[condition](pred, field);
};
Predicate.combinePredicates = function (predicates, operator) {
if (predicates.length === 1) {
if (!(predicates[0] instanceof Array)) {
return predicates[0];
}
if (typeof field === 'string') {
return Predicate[condition](pred, new Predicate(field, operator, value, ignoreCase, ignoreAccent));
}
return util_1.DataUtil.throwError('Predicate - ' + condition + ' : invalid arguments');
};
Predicate.fromJSONData = function (json) {
var preds = json.predicates || [];
var len = preds.length;
var predicates = [];
var result;
for (var i = 0; i < len; i++) {
predicates.push(this.fromJSONData(preds[i]));
}
if (!json.isComplex) {
result = new Predicate(json.field, json.operator, json.value, json.ignoreCase, json.ignoreAccent);
}
else {
result = new Predicate(predicates[0], json.condition, predicates.slice(1));
}
return result;
};
return Predicate;
}());
exports.Predicate = Predicate;
});
predicates = predicates[0];
}
return new Predicate(predicates[0], operator, predicates.slice(1));
};
Predicate.combine = function (pred, field, operator, value, condition, ignoreCase, ignoreAccent) {
if (field instanceof Predicate) {
return Predicate[condition](pred, field);
}
if (typeof field === 'string') {
return Predicate[condition](pred, new Predicate(field, operator, value, ignoreCase, ignoreAccent));
}
return DataUtil.throwError('Predicate - ' + condition + ' : invalid arguments');
};
Predicate.fromJSONData = function (json) {
var preds = json.predicates || [];
var len = preds.length;
var predicates = [];
var result;
for (var i = 0; i < len; i++) {
predicates.push(this.fromJSONData(preds[i]));
}
if (!json.isComplex) {
result = new Predicate(json.field, json.operator, json.value, json.ignoreCase, json.ignoreAccent);
}
else {
result = new Predicate(predicates[0], json.condition, predicates.slice(1));
}
return result;
};
return Predicate;
}());
export { Predicate };

@@ -1,1516 +0,1833 @@

define(["require", "exports", "@syncfusion/ej2-base", "./manager", "./query"], function (require, exports, ej2_base_1, manager_1, query_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var consts = { GroupGuid: '{271bbba0-1ee7}' };
var DataUtil = (function () {
function DataUtil() {
import { isNullOrUndefined } from '@syncfusion/ej2-base';
import { DataManager } from './manager';
import { Query } from './query';
var consts = { GroupGuid: '{271bbba0-1ee7}' };
/**
* Data manager common utility methods.
* @hidden
*/
var DataUtil = /** @class */ (function () {
function DataUtil() {
}
/**
* Returns the value by invoking the provided parameter function.
* If the paramater is not of type function then it will be returned as it is.
* @param {Function|string|string[]|number} value
* @param {Object} inst?
* @hidden
*/
DataUtil.getValue = function (value, inst) {
if (typeof value === 'function') {
return value.call(inst || {});
}
DataUtil.getValue = function (value, inst) {
if (typeof value === 'function') {
return value.call(inst || {});
return value;
};
/**
* Returns true if the input string ends with given string.
* @param {string} input
* @param {string} substr
*/
DataUtil.endsWith = function (input, substr) {
return input.slice(-substr.length) === substr;
};
/**
* Returns true if the input string starts with given string.
* @param {string} str
* @param {string} startstr
*/
DataUtil.startsWith = function (input, start) {
return input.slice(0, start.length) === start;
};
/**
* To return the sorting function based on the string.
* @param {string} order
* @hidden
*/
DataUtil.fnSort = function (order) {
order = order ? DataUtil.toLowerCase(order) : 'ascending';
if (order === 'ascending') {
return this.fnAscending;
}
return this.fnDescending;
};
/**
* Comparer function which is used to sort the data in ascending order.
* @param {string|number} x
* @param {string|number} y
* @returns number
*/
DataUtil.fnAscending = function (x, y) {
if (y === null || y === undefined) {
return -1;
}
if (typeof x === 'string') {
return x.localeCompare(y);
}
if (x === null || x === undefined) {
return 1;
}
return x - y;
};
/**
* Comparer function which is used to sort the data in descending order.
* @param {string|number} x
* @param {string|number} y
* @returns number
*/
DataUtil.fnDescending = function (x, y) {
if (y === null || y === undefined) {
return 1;
}
if (typeof x === 'string') {
return x.localeCompare(y) * -1;
}
if (x === null || x === undefined) {
return -1;
}
return y - x;
};
DataUtil.extractFields = function (obj, fields) {
var newObj = {};
for (var i = 0; i < fields.length; i++) {
newObj = this.setValue(fields[i], this.getObject(fields[i], obj), newObj);
}
return newObj;
};
/**
* Select objects by given fields from jsonArray.
* @param {Object[]} jsonArray
* @param {string[]} fields
*/
DataUtil.select = function (jsonArray, fields) {
var newData = [];
for (var i = 0; i < jsonArray.length; i++) {
newData.push(this.extractFields(jsonArray[i], fields));
}
return newData;
};
/**
* Group the input data based on the field name.
* It also performs aggregation of the grouped records based on the aggregates paramater.
* @param {Object[]} jsonArray
* @param {string} field?
* @param {Object[]} agg?
* @param {number} level?
* @param {Object[]} groupDs?
*/
DataUtil.group = function (jsonArray, field, aggregates, level, groupDs, format) {
level = level || 1;
var jsonData = jsonArray;
var guid = 'GroupGuid';
if (jsonData.GroupGuid === consts[guid]) {
var _loop_1 = function (j) {
if (!isNullOrUndefined(groupDs)) {
var indx = -1;
var temp = groupDs.filter(function (e) { return e.key === jsonData[j].key; });
indx = groupDs.indexOf(temp[0]);
jsonData[j].items = this_1.group(jsonData[j].items, field, aggregates, jsonData.level + 1, groupDs[indx].items, format);
jsonData[j].count = groupDs[indx].count;
}
else {
jsonData[j].items = this_1.group(jsonData[j].items, field, aggregates, jsonData.level + 1, null, format);
jsonData[j].count = jsonData[j].items.length;
}
};
var this_1 = this;
for (var j = 0; j < jsonData.length; j++) {
_loop_1(j);
}
return value;
};
DataUtil.endsWith = function (input, substr) {
return input.slice(-substr.length) === substr;
};
DataUtil.startsWith = function (input, start) {
return input.slice(0, start.length) === start;
};
DataUtil.fnSort = function (order) {
order = order ? DataUtil.toLowerCase(order) : 'ascending';
if (order === 'ascending') {
return this.fnAscending;
jsonData.childLevels += 1;
return jsonData;
}
var grouped = {};
var groupedArray = [];
groupedArray.GroupGuid = consts[guid];
groupedArray.level = level;
groupedArray.childLevels = 0;
groupedArray.records = jsonData;
var _loop_2 = function (i) {
var val = this_2.getVal(jsonData, i, field);
if (!isNullOrUndefined(format)) {
val = format(val, field);
}
return this.fnDescending;
};
DataUtil.fnAscending = function (x, y) {
if (y === null || y === undefined) {
return -1;
if (!grouped[val]) {
grouped[val] = {
key: val,
count: 0,
items: [],
aggregates: {},
field: field
};
groupedArray.push(grouped[val]);
if (!isNullOrUndefined(groupDs)) {
var tempObj = groupDs.filter(function (e) { return e.key === grouped[val].key; });
grouped[val].count = tempObj[0].count;
}
}
if (typeof x === 'string') {
return x.localeCompare(y);
}
if (x === null || x === undefined) {
return 1;
}
return x - y;
grouped[val].count = !isNullOrUndefined(groupDs) ? grouped[val].count : grouped[val].count += 1;
grouped[val].items.push(jsonData[i]);
};
DataUtil.fnDescending = function (x, y) {
if (y === null || y === undefined) {
return 1;
}
if (typeof x === 'string') {
return x.localeCompare(y) * -1;
}
if (x === null || x === undefined) {
return -1;
}
return y - x;
};
DataUtil.extractFields = function (obj, fields) {
var newObj = {};
for (var i = 0; i < fields.length; i++) {
newObj = this.setValue(fields[i], this.getObject(fields[i], obj), newObj);
}
return newObj;
};
DataUtil.select = function (jsonArray, fields) {
var newData = [];
for (var i = 0; i < jsonArray.length; i++) {
newData.push(this.extractFields(jsonArray[i], fields));
}
return newData;
};
DataUtil.group = function (jsonArray, field, aggregates, level, groupDs, format) {
level = level || 1;
var jsonData = jsonArray;
var guid = 'GroupGuid';
if (jsonData.GroupGuid === consts[guid]) {
var _loop_1 = function (j) {
if (!ej2_base_1.isNullOrUndefined(groupDs)) {
var indx = -1;
var temp = groupDs.filter(function (e) { return e.key === jsonData[j].key; });
indx = groupDs.indexOf(temp[0]);
jsonData[j].items = this_1.group(jsonData[j].items, field, aggregates, jsonData.level + 1, groupDs[indx].items, format);
jsonData[j].count = groupDs[indx].count;
var this_2 = this;
for (var i = 0; i < jsonData.length; i++) {
_loop_2(i);
}
if (aggregates && aggregates.length) {
var _loop_3 = function (i) {
var res = {};
var fn = void 0;
var aggs = aggregates;
for (var j = 0; j < aggregates.length; j++) {
fn = DataUtil.aggregates[aggregates[j].type];
if (!isNullOrUndefined(groupDs)) {
var temp = groupDs.filter(function (e) { return e.key === groupedArray[i].key; });
if (fn) {
res[aggs[j].field + ' - ' + aggs[j].type] = fn(temp[0].items, aggs[j].field);
}
}
else {
jsonData[j].items = this_1.group(jsonData[j].items, field, aggregates, jsonData.level + 1, null, format);
jsonData[j].count = jsonData[j].items.length;
if (fn) {
res[aggs[j].field + ' - ' + aggs[j].type] = fn(groupedArray[i].items, aggs[j].field);
}
}
};
var this_1 = this;
for (var j = 0; j < jsonData.length; j++) {
_loop_1(j);
}
jsonData.childLevels += 1;
return jsonData;
}
var grouped = {};
var groupedArray = [];
groupedArray.GroupGuid = consts[guid];
groupedArray.level = level;
groupedArray.childLevels = 0;
groupedArray.records = jsonData;
var _loop_2 = function (i) {
var val = this_2.getVal(jsonData, i, field);
if (!ej2_base_1.isNullOrUndefined(format)) {
val = format(val, field);
}
if (!grouped[val]) {
grouped[val] = {
key: val,
count: 0,
items: [],
aggregates: {},
field: field
};
groupedArray.push(grouped[val]);
if (!ej2_base_1.isNullOrUndefined(groupDs)) {
var tempObj = groupDs.filter(function (e) { return e.key === grouped[val].key; });
grouped[val].count = tempObj[0].count;
}
}
grouped[val].count = !ej2_base_1.isNullOrUndefined(groupDs) ? grouped[val].count : grouped[val].count += 1;
grouped[val].items.push(jsonData[i]);
groupedArray[i].aggregates = res;
};
var this_2 = this;
for (var i = 0; i < jsonData.length; i++) {
_loop_2(i);
for (var i = 0; i < groupedArray.length; i++) {
_loop_3(i);
}
if (aggregates && aggregates.length) {
var _loop_3 = function (i) {
var res = {};
var fn = void 0;
var aggs = aggregates;
for (var j = 0; j < aggregates.length; j++) {
fn = DataUtil.aggregates[aggregates[j].type];
if (!ej2_base_1.isNullOrUndefined(groupDs)) {
var temp = groupDs.filter(function (e) { return e.key === groupedArray[i].key; });
if (fn) {
res[aggs[j].field + ' - ' + aggs[j].type] = fn(temp[0].items, aggs[j].field);
}
}
else {
if (fn) {
res[aggs[j].field + ' - ' + aggs[j].type] = fn(groupedArray[i].items, aggs[j].field);
}
}
}
groupedArray[i].aggregates = res;
};
for (var i = 0; i < groupedArray.length; i++) {
_loop_3(i);
}
}
return jsonData.length && groupedArray || jsonData;
};
/**
* It is used to categorize the multiple items based on a specific field in jsonArray.
* The hierarchical queries are commonly required when you use foreign key binding.
* @param {string} fKey
* @param {string} from
* @param {Object[]} source
* @param {Group} lookup?
* @param {string} pKey?
* @hidden
*/
DataUtil.buildHierarchy = function (fKey, from, source, lookup, pKey) {
var i;
var grp = {};
var temp;
if (lookup.result) {
lookup = lookup.result;
}
if (lookup.GroupGuid) {
this.throwError('DataManager: Do not have support Grouping in hierarchy');
}
for (i = 0; i < lookup.length; i++) {
var fKeyData = this.getObject(fKey, lookup[i]);
temp = grp[fKeyData] || (grp[fKeyData] = []);
temp.push(lookup[i]);
}
for (i = 0; i < source.length; i++) {
var fKeyData = this.getObject(pKey || fKey, source[i]);
source[i][from] = grp[fKeyData];
}
};
/**
* The method used to get the field names which started with specified characters.
* @param {Object} obj
* @param {string[]} fields?
* @param {string} prefix?
* @hidden
*/
DataUtil.getFieldList = function (obj, fields, prefix) {
if (prefix === undefined) {
prefix = '';
}
if (fields === undefined || fields === null) {
return this.getFieldList(obj, [], prefix);
}
var copyObj = obj;
var keys = Object.keys(obj);
for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
var prop = keys_1[_i];
if (typeof copyObj[prop] === 'object' && !(copyObj[prop] instanceof Array)) {
this.getFieldList(copyObj[prop], fields, prefix + prop + '.');
}
return jsonData.length && groupedArray || jsonData;
};
DataUtil.buildHierarchy = function (fKey, from, source, lookup, pKey) {
var i;
var grp = {};
var temp;
if (lookup.result) {
lookup = lookup.result;
else {
fields.push(prefix + prop);
}
if (lookup.GroupGuid) {
this.throwError('DataManager: Do not have support Grouping in hierarchy');
}
return fields;
};
/**
* Gets the value of the property in the given object.
* The complex object can be accessed by providing the field names concatenated with dot(.).
* @param {string} nameSpace - The name of the property to be accessed.
* @param {Object} from - Defines the source object.
*/
DataUtil.getObject = function (nameSpace, from) {
if (!nameSpace) {
return from;
}
if (!from) {
return undefined;
}
if (nameSpace.indexOf('.') === -1) {
return from[nameSpace];
}
var value = from;
var splits = nameSpace.split('.');
for (var i = 0; i < splits.length; i++) {
if (value == null) {
break;
}
for (i = 0; i < lookup.length; i++) {
var fKeyData = this.getObject(fKey, lookup[i]);
temp = grp[fKeyData] || (grp[fKeyData] = []);
temp.push(lookup[i]);
value = value[splits[i]];
}
return value;
};
/**
* To set value for the nameSpace in desired object.
* @param {string} nameSpace - String value to the get the inner object.
* @param {Object} value - Value that you need to set.
* @param {Object} obj - Object to get the inner object value.
* @return { [key: string]: Object; } | Object
* @hidden
*/
DataUtil.setValue = function (nameSpace, value, obj) {
var keys = nameSpace.toString().split('.');
var start = obj || {};
var fromObj = start;
var i;
var length = keys.length;
var key;
for (i = 0; i < length; i++) {
key = keys[i];
if (i + 1 === length) {
fromObj[key] = value === undefined ? undefined : value;
}
for (i = 0; i < source.length; i++) {
var fKeyData = this.getObject(pKey || fKey, source[i]);
source[i][from] = grp[fKeyData];
else if (isNullOrUndefined(fromObj[key])) {
fromObj[key] = {};
}
};
DataUtil.getFieldList = function (obj, fields, prefix) {
if (prefix === undefined) {
prefix = '';
}
if (fields === undefined || fields === null) {
return this.getFieldList(obj, [], prefix);
}
var copyObj = obj;
var keys = Object.keys(obj);
for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
var prop = keys_1[_i];
if (typeof copyObj[prop] === 'object' && !(copyObj[prop] instanceof Array)) {
this.getFieldList(copyObj[prop], fields, prefix + prop + '.');
fromObj = fromObj[key];
}
return start;
};
/**
* Sort the given data based on the field and comparer.
* @param {Object[]} ds - Defines the input data.
* @param {string} field - Defines the field to be sorted.
* @param {Function} comparer - Defines the comparer function used to sort the records.
*/
DataUtil.sort = function (ds, field, comparer) {
if (ds.length <= 1) {
return ds;
}
var middle = parseInt((ds.length / 2).toString(), 10);
var left = ds.slice(0, middle);
var right = ds.slice(middle);
left = this.sort(left, field, comparer);
right = this.sort(right, field, comparer);
return this.merge(left, right, field, comparer);
};
DataUtil.ignoreDiacritics = function (value) {
if (typeof value !== 'string') {
return value;
}
var result = value.split('');
var newValue = result.map(function (temp) { return temp in DataUtil.diacritics ? DataUtil.diacritics[temp] : temp; });
return newValue.join('');
};
DataUtil.merge = function (left, right, fieldName, comparer) {
var result = [];
var current;
while (left.length > 0 || right.length > 0) {
if (left.length > 0 && right.length > 0) {
if (comparer) {
current = comparer(this.getVal(left, 0, fieldName), this.getVal(right, 0, fieldName)) <= 0 ? left : right;
}
else {
fields.push(prefix + prop);
current = left[0][fieldName] < left[0][fieldName] ? left : right;
}
}
return fields;
};
DataUtil.getObject = function (nameSpace, from) {
if (!nameSpace) {
return from;
else {
current = left.length > 0 ? left : right;
}
if (!from) {
return undefined;
result.push(current.shift());
}
return result;
};
DataUtil.getVal = function (array, index, field) {
return field ? this.getObject(field, array[index]) : array[index];
};
DataUtil.toLowerCase = function (val) {
return val ? typeof val === 'string' ? val.toLowerCase() : val.toString() : (val === 0 || val === false) ? val.toString() : '';
};
/**
* To perform the filter operation with specified adaptor and returns the result.
* @param {Object} adaptor
* @param {string} fnName
* @param {Object} param1?
* @param {Object} param2?
* @hidden
*/
DataUtil.callAdaptorFunction = function (adaptor, fnName, param1, param2) {
if (fnName in adaptor) {
var res = adaptor[fnName](param1, param2);
if (!isNullOrUndefined(res)) {
param1 = res;
}
if (nameSpace.indexOf('.') === -1) {
return from[nameSpace];
}
return param1;
};
/**
* Checks wheather the given input is a plain object or not.
* @param {Object|Object[]} obj
*/
DataUtil.isPlainObject = function (obj) {
return (!!obj) && (obj.constructor === Object);
};
/**
* Returns true when the browser cross origin request.
*/
DataUtil.isCors = function () {
var xhr = null;
var request = 'XMLHttpRequest';
try {
xhr = new window[request]();
}
catch (e) {
// No exception handling
}
return !!xhr && ('withCredentials' in xhr);
};
/**
* Generate random GUID value which will be prefixed with the given value.
* @param {string} prefix
*/
DataUtil.getGuid = function (prefix) {
var hexs = '0123456789abcdef';
var rand;
return (prefix || '') + '00000000-0000-4000-0000-000000000000'.replace(/0/g, function (val, i) {
if ('crypto' in window && 'getRandomValues' in crypto) {
var arr = new Uint8Array(1);
window.crypto.getRandomValues(arr);
rand = arr[0] % 16 | 0;
}
var value = from;
var splits = nameSpace.split('.');
for (var i = 0; i < splits.length; i++) {
if (value == null) {
break;
}
value = value[splits[i]];
else {
rand = Math.random() * 16 | 0;
}
return value;
};
DataUtil.setValue = function (nameSpace, value, obj) {
var keys = nameSpace.toString().split('.');
var start = obj || {};
var fromObj = start;
var i;
var length = keys.length;
var key;
for (i = 0; i < length; i++) {
key = keys[i];
if (i + 1 === length) {
fromObj[key] = value === undefined ? undefined : value;
}
else if (ej2_base_1.isNullOrUndefined(fromObj[key])) {
fromObj[key] = {};
}
fromObj = fromObj[key];
return hexs[i === 19 ? rand & 0x3 | 0x8 : rand];
});
};
/**
* Checks wheather the given value is null or not.
* @param {string|Object} val
* @returns boolean
*/
DataUtil.isNull = function (val) {
return val === undefined || val === null;
};
/**
* To get the required items from collection of objects.
* @param {Object[]} array
* @param {string} field
* @param {Function} comparer
* @returns Object
* @hidden
*/
DataUtil.getItemFromComparer = function (array, field, comparer) {
var keyVal;
var current;
var key;
var i = 0;
var castRequired = typeof DataUtil.getVal(array, 0, field) === 'string';
if (array.length) {
while (isNullOrUndefined(keyVal) && i < array.length) {
keyVal = DataUtil.getVal(array, i, field);
key = array[i++];
}
return start;
};
DataUtil.sort = function (ds, field, comparer) {
if (ds.length <= 1) {
return ds;
}
for (; i < array.length; i++) {
current = DataUtil.getVal(array, i, field);
if (isNullOrUndefined(current)) {
continue;
}
var middle = parseInt((ds.length / 2).toString(), 10);
var left = ds.slice(0, middle);
var right = ds.slice(middle);
left = this.sort(left, field, comparer);
right = this.sort(right, field, comparer);
return this.merge(left, right, field, comparer);
};
DataUtil.ignoreDiacritics = function (value) {
if (typeof value !== 'string') {
return value;
if (castRequired) {
keyVal = +keyVal;
current = +current;
}
var result = value.split('');
var newValue = result.map(function (temp) { return temp in DataUtil.diacritics ? DataUtil.diacritics[temp] : temp; });
return newValue.join('');
};
DataUtil.merge = function (left, right, fieldName, comparer) {
var result = [];
var current;
while (left.length > 0 || right.length > 0) {
if (left.length > 0 && right.length > 0) {
if (comparer) {
current = comparer(this.getVal(left, 0, fieldName), this.getVal(right, 0, fieldName)) <= 0 ? left : right;
if (comparer(keyVal, current) > 0) {
keyVal = current;
key = array[i];
}
}
return key;
};
/**
* To get distinct values of Array or Array of Objects.
* @param {Object[]} json
* @param {string} field
* @param {boolean} requiresCompleteRecord
* @returns Object[]
* * distinct array of objects is return when requiresCompleteRecord set as true.
* @hidden
*/
DataUtil.distinct = function (json, fieldName, requiresCompleteRecord) {
requiresCompleteRecord = isNullOrUndefined(requiresCompleteRecord) ? false : requiresCompleteRecord;
var result = [];
var val;
var tmp = {};
json.forEach(function (data, index) {
val = DataUtil.getVal(json, index, fieldName);
if (!(val in tmp)) {
result.push(!requiresCompleteRecord ? val : json[index]);
tmp[val] = 1;
}
});
return result;
};
/**
* Specifies the value which will be used to adjust the date value to server timezone.
* @default null
*/
DataUtil.serverTimezoneOffset = null;
/**
* Throw error with the given string as message.
* @param {string} er
*/
DataUtil.throwError = function (error) {
try {
throw new Error(error);
}
catch (e) {
throw e.message + '\n' + e.stack;
}
};
DataUtil.aggregates = {
/**
* Calculate sum of the given field in the data.
* @param {Object[]} ds
* @param {string} field
*/
sum: function (ds, field) {
var result = 0;
var val;
var castRequired = typeof DataUtil.getVal(ds, 0, field) !== 'number';
for (var i = 0; i < ds.length; i++) {
val = DataUtil.getVal(ds, i, field);
if (!isNaN(val) && val !== null) {
if (castRequired) {
val = +val;
}
else {
current = left[0][fieldName] < left[0][fieldName] ? left : right;
}
result += val;
}
else {
current = left.length > 0 ? left : right;
}
result.push(current.shift());
}
return result;
};
DataUtil.getVal = function (array, index, field) {
return field ? this.getObject(field, array[index]) : array[index];
};
DataUtil.toLowerCase = function (val) {
return val ? typeof val === 'string' ? val.toLowerCase() : val.toString() : (val === 0 || val === false) ? val.toString() : '';
};
DataUtil.callAdaptorFunction = function (adaptor, fnName, param1, param2) {
if (fnName in adaptor) {
var res = adaptor[fnName](param1, param2);
if (!ej2_base_1.isNullOrUndefined(res)) {
param1 = res;
}
},
/**
* Calculate average value of the given field in the data.
* @param {Object[]} ds
* @param {string} field
*/
average: function (ds, field) {
return DataUtil.aggregates.sum(ds, field) / ds.length;
},
/**
* Returns the min value of the data based on the field.
* @param {Object[]} ds
* @param {string|Function} field
*/
min: function (ds, field) {
var comparer;
if (typeof field === 'function') {
comparer = field;
field = null;
}
return param1;
};
DataUtil.isPlainObject = function (obj) {
return (!!obj) && (obj.constructor === Object);
};
DataUtil.isCors = function () {
var xhr = null;
var request = 'XMLHttpRequest';
try {
xhr = new window[request]();
return DataUtil.getObject(field, DataUtil.getItemFromComparer(ds, field, comparer || DataUtil.fnAscending));
},
/**
* Returns the max value of the data based on the field.
* @param {Object[]} ds
* @param {string} field
* @returns number
*/
max: function (ds, field) {
var comparer;
if (typeof field === 'function') {
comparer = field;
field = null;
}
catch (e) {
return DataUtil.getObject(field, DataUtil.getItemFromComparer(ds, field, comparer || DataUtil.fnDescending));
},
/**
* Returns the total number of true value present in the data based on the given boolean field name.
* @param {Object[]} ds
* @param {string} field
*/
truecount: function (ds, field) {
return new DataManager(ds).executeLocal(new Query().where(field, 'equal', true, true)).length;
},
/**
* Returns the total number of false value present in the data based on the given boolean field name.
* @param {Object[]} ds
* @param {string} field
*/
falsecount: function (ds, field) {
return new DataManager(ds).executeLocal(new Query().where(field, 'equal', false, true)).length;
},
/**
* Returns the length of the given data.
* @param {Object[]} ds
* @param {string} field?
* @returns number
*/
count: function (ds, field) {
return ds.length;
}
};
/**
* Specifies the Object with filter operators.
*/
DataUtil.operatorSymbols = {
'<': 'lessthan',
'>': 'greaterthan',
'<=': 'lessthanorequal',
'>=': 'greaterthanorequal',
'==': 'equal',
'!=': 'notequal',
'*=': 'contains',
'$=': 'endswith',
'^=': 'startswith'
};
/**
* Specifies the Object with filter operators which will be used for OData filter query generation.
* * It will be used for date/number type filter query.
*/
DataUtil.odBiOperator = {
'<': ' lt ',
'>': ' gt ',
'<=': ' le ',
'>=': ' ge ',
'==': ' eq ',
'!=': ' ne ',
'lessthan': ' lt ',
'lessthanorequal': ' le ',
'greaterthan': ' gt ',
'greaterthanorequal': ' ge ',
'equal': ' eq ',
'notequal': ' ne '
};
/**
* Specifies the Object with filter operators which will be used for OData filter query generation.
* It will be used for string type filter query.
*/
DataUtil.odUniOperator = {
'$=': 'endswith',
'^=': 'startswith',
'*=': 'substringof',
'endswith': 'endswith',
'startswith': 'startswith',
'contains': 'substringof'
};
/**
* Specifies the Object with filter operators which will be used for ODataV4 filter query generation.
* It will be used for string type filter query.
*/
DataUtil.odv4UniOperator = {
'$=': 'endswith',
'^=': 'startswith',
'*=': 'contains',
'endswith': 'endswith',
'startswith': 'startswith',
'contains': 'contains'
};
DataUtil.diacritics = {
'\u24B6': 'A',
'\uFF21': 'A',
'\u00C0': 'A',
'\u00C1': 'A',
'\u00C2': 'A',
'\u1EA6': 'A',
'\u1EA4': 'A',
'\u1EAA': 'A',
'\u1EA8': 'A',
'\u00C3': 'A',
'\u0100': 'A',
'\u0102': 'A',
'\u1EB0': 'A',
'\u1EAE': 'A',
'\u1EB4': 'A',
'\u1EB2': 'A',
'\u0226': 'A',
'\u01E0': 'A',
'\u00C4': 'A',
'\u01DE': 'A',
'\u1EA2': 'A',
'\u00C5': 'A',
'\u01FA': 'A',
'\u01CD': 'A',
'\u0200': 'A',
'\u0202': 'A',
'\u1EA0': 'A',
'\u1EAC': 'A',
'\u1EB6': 'A',
'\u1E00': 'A',
'\u0104': 'A',
'\u023A': 'A',
'\u2C6F': 'A',
'\uA732': 'AA',
'\u00C6': 'AE',
'\u01FC': 'AE',
'\u01E2': 'AE',
'\uA734': 'AO',
'\uA736': 'AU',
'\uA738': 'AV',
'\uA73A': 'AV',
'\uA73C': 'AY',
'\u24B7': 'B',
'\uFF22': 'B',
'\u1E02': 'B',
'\u1E04': 'B',
'\u1E06': 'B',
'\u0243': 'B',
'\u0182': 'B',
'\u0181': 'B',
'\u24B8': 'C',
'\uFF23': 'C',
'\u0106': 'C',
'\u0108': 'C',
'\u010A': 'C',
'\u010C': 'C',
'\u00C7': 'C',
'\u1E08': 'C',
'\u0187': 'C',
'\u023B': 'C',
'\uA73E': 'C',
'\u24B9': 'D',
'\uFF24': 'D',
'\u1E0A': 'D',
'\u010E': 'D',
'\u1E0C': 'D',
'\u1E10': 'D',
'\u1E12': 'D',
'\u1E0E': 'D',
'\u0110': 'D',
'\u018B': 'D',
'\u018A': 'D',
'\u0189': 'D',
'\uA779': 'D',
'\u01F1': 'DZ',
'\u01C4': 'DZ',
'\u01F2': 'Dz',
'\u01C5': 'Dz',
'\u24BA': 'E',
'\uFF25': 'E',
'\u00C8': 'E',
'\u00C9': 'E',
'\u00CA': 'E',
'\u1EC0': 'E',
'\u1EBE': 'E',
'\u1EC4': 'E',
'\u1EC2': 'E',
'\u1EBC': 'E',
'\u0112': 'E',
'\u1E14': 'E',
'\u1E16': 'E',
'\u0114': 'E',
'\u0116': 'E',
'\u00CB': 'E',
'\u1EBA': 'E',
'\u011A': 'E',
'\u0204': 'E',
'\u0206': 'E',
'\u1EB8': 'E',
'\u1EC6': 'E',
'\u0228': 'E',
'\u1E1C': 'E',
'\u0118': 'E',
'\u1E18': 'E',
'\u1E1A': 'E',
'\u0190': 'E',
'\u018E': 'E',
'\u24BB': 'F',
'\uFF26': 'F',
'\u1E1E': 'F',
'\u0191': 'F',
'\uA77B': 'F',
'\u24BC': 'G',
'\uFF27': 'G',
'\u01F4': 'G',
'\u011C': 'G',
'\u1E20': 'G',
'\u011E': 'G',
'\u0120': 'G',
'\u01E6': 'G',
'\u0122': 'G',
'\u01E4': 'G',
'\u0193': 'G',
'\uA7A0': 'G',
'\uA77D': 'G',
'\uA77E': 'G',
'\u24BD': 'H',
'\uFF28': 'H',
'\u0124': 'H',
'\u1E22': 'H',
'\u1E26': 'H',
'\u021E': 'H',
'\u1E24': 'H',
'\u1E28': 'H',
'\u1E2A': 'H',
'\u0126': 'H',
'\u2C67': 'H',
'\u2C75': 'H',
'\uA78D': 'H',
'\u24BE': 'I',
'\uFF29': 'I',
'\u00CC': 'I',
'\u00CD': 'I',
'\u00CE': 'I',
'\u0128': 'I',
'\u012A': 'I',
'\u012C': 'I',
'\u0130': 'I',
'\u00CF': 'I',
'\u1E2E': 'I',
'\u1EC8': 'I',
'\u01CF': 'I',
'\u0208': 'I',
'\u020A': 'I',
'\u1ECA': 'I',
'\u012E': 'I',
'\u1E2C': 'I',
'\u0197': 'I',
'\u24BF': 'J',
'\uFF2A': 'J',
'\u0134': 'J',
'\u0248': 'J',
'\u24C0': 'K',
'\uFF2B': 'K',
'\u1E30': 'K',
'\u01E8': 'K',
'\u1E32': 'K',
'\u0136': 'K',
'\u1E34': 'K',
'\u0198': 'K',
'\u2C69': 'K',
'\uA740': 'K',
'\uA742': 'K',
'\uA744': 'K',
'\uA7A2': 'K',
'\u24C1': 'L',
'\uFF2C': 'L',
'\u013F': 'L',
'\u0139': 'L',
'\u013D': 'L',
'\u1E36': 'L',
'\u1E38': 'L',
'\u013B': 'L',
'\u1E3C': 'L',
'\u1E3A': 'L',
'\u0141': 'L',
'\u023D': 'L',
'\u2C62': 'L',
'\u2C60': 'L',
'\uA748': 'L',
'\uA746': 'L',
'\uA780': 'L',
'\u01C7': 'LJ',
'\u01C8': 'Lj',
'\u24C2': 'M',
'\uFF2D': 'M',
'\u1E3E': 'M',
'\u1E40': 'M',
'\u1E42': 'M',
'\u2C6E': 'M',
'\u019C': 'M',
'\u24C3': 'N',
'\uFF2E': 'N',
'\u01F8': 'N',
'\u0143': 'N',
'\u00D1': 'N',
'\u1E44': 'N',
'\u0147': 'N',
'\u1E46': 'N',
'\u0145': 'N',
'\u1E4A': 'N',
'\u1E48': 'N',
'\u0220': 'N',
'\u019D': 'N',
'\uA790': 'N',
'\uA7A4': 'N',
'\u01CA': 'NJ',
'\u01CB': 'Nj',
'\u24C4': 'O',
'\uFF2F': 'O',
'\u00D2': 'O',
'\u00D3': 'O',
'\u00D4': 'O',
'\u1ED2': 'O',
'\u1ED0': 'O',
'\u1ED6': 'O',
'\u1ED4': 'O',
'\u00D5': 'O',
'\u1E4C': 'O',
'\u022C': 'O',
'\u1E4E': 'O',
'\u014C': 'O',
'\u1E50': 'O',
'\u1E52': 'O',
'\u014E': 'O',
'\u022E': 'O',
'\u0230': 'O',
'\u00D6': 'O',
'\u022A': 'O',
'\u1ECE': 'O',
'\u0150': 'O',
'\u01D1': 'O',
'\u020C': 'O',
'\u020E': 'O',
'\u01A0': 'O',
'\u1EDC': 'O',
'\u1EDA': 'O',
'\u1EE0': 'O',
'\u1EDE': 'O',
'\u1EE2': 'O',
'\u1ECC': 'O',
'\u1ED8': 'O',
'\u01EA': 'O',
'\u01EC': 'O',
'\u00D8': 'O',
'\u01FE': 'O',
'\u0186': 'O',
'\u019F': 'O',
'\uA74A': 'O',
'\uA74C': 'O',
'\u01A2': 'OI',
'\uA74E': 'OO',
'\u0222': 'OU',
'\u24C5': 'P',
'\uFF30': 'P',
'\u1E54': 'P',
'\u1E56': 'P',
'\u01A4': 'P',
'\u2C63': 'P',
'\uA750': 'P',
'\uA752': 'P',
'\uA754': 'P',
'\u24C6': 'Q',
'\uFF31': 'Q',
'\uA756': 'Q',
'\uA758': 'Q',
'\u024A': 'Q',
'\u24C7': 'R',
'\uFF32': 'R',
'\u0154': 'R',
'\u1E58': 'R',
'\u0158': 'R',
'\u0210': 'R',
'\u0212': 'R',
'\u1E5A': 'R',
'\u1E5C': 'R',
'\u0156': 'R',
'\u1E5E': 'R',
'\u024C': 'R',
'\u2C64': 'R',
'\uA75A': 'R',
'\uA7A6': 'R',
'\uA782': 'R',
'\u24C8': 'S',
'\uFF33': 'S',
'\u1E9E': 'S',
'\u015A': 'S',
'\u1E64': 'S',
'\u015C': 'S',
'\u1E60': 'S',
'\u0160': 'S',
'\u1E66': 'S',
'\u1E62': 'S',
'\u1E68': 'S',
'\u0218': 'S',
'\u015E': 'S',
'\u2C7E': 'S',
'\uA7A8': 'S',
'\uA784': 'S',
'\u24C9': 'T',
'\uFF34': 'T',
'\u1E6A': 'T',
'\u0164': 'T',
'\u1E6C': 'T',
'\u021A': 'T',
'\u0162': 'T',
'\u1E70': 'T',
'\u1E6E': 'T',
'\u0166': 'T',
'\u01AC': 'T',
'\u01AE': 'T',
'\u023E': 'T',
'\uA786': 'T',
'\uA728': 'TZ',
'\u24CA': 'U',
'\uFF35': 'U',
'\u00D9': 'U',
'\u00DA': 'U',
'\u00DB': 'U',
'\u0168': 'U',
'\u1E78': 'U',
'\u016A': 'U',
'\u1E7A': 'U',
'\u016C': 'U',
'\u00DC': 'U',
'\u01DB': 'U',
'\u01D7': 'U',
'\u01D5': 'U',
'\u01D9': 'U',
'\u1EE6': 'U',
'\u016E': 'U',
'\u0170': 'U',
'\u01D3': 'U',
'\u0214': 'U',
'\u0216': 'U',
'\u01AF': 'U',
'\u1EEA': 'U',
'\u1EE8': 'U',
'\u1EEE': 'U',
'\u1EEC': 'U',
'\u1EF0': 'U',
'\u1EE4': 'U',
'\u1E72': 'U',
'\u0172': 'U',
'\u1E76': 'U',
'\u1E74': 'U',
'\u0244': 'U',
'\u24CB': 'V',
'\uFF36': 'V',
'\u1E7C': 'V',
'\u1E7E': 'V',
'\u01B2': 'V',
'\uA75E': 'V',
'\u0245': 'V',
'\uA760': 'VY',
'\u24CC': 'W',
'\uFF37': 'W',
'\u1E80': 'W',
'\u1E82': 'W',
'\u0174': 'W',
'\u1E86': 'W',
'\u1E84': 'W',
'\u1E88': 'W',
'\u2C72': 'W',
'\u24CD': 'X',
'\uFF38': 'X',
'\u1E8A': 'X',
'\u1E8C': 'X',
'\u24CE': 'Y',
'\uFF39': 'Y',
'\u1EF2': 'Y',
'\u00DD': 'Y',
'\u0176': 'Y',
'\u1EF8': 'Y',
'\u0232': 'Y',
'\u1E8E': 'Y',
'\u0178': 'Y',
'\u1EF6': 'Y',
'\u1EF4': 'Y',
'\u01B3': 'Y',
'\u024E': 'Y',
'\u1EFE': 'Y',
'\u24CF': 'Z',
'\uFF3A': 'Z',
'\u0179': 'Z',
'\u1E90': 'Z',
'\u017B': 'Z',
'\u017D': 'Z',
'\u1E92': 'Z',
'\u1E94': 'Z',
'\u01B5': 'Z',
'\u0224': 'Z',
'\u2C7F': 'Z',
'\u2C6B': 'Z',
'\uA762': 'Z',
'\u24D0': 'a',
'\uFF41': 'a',
'\u1E9A': 'a',
'\u00E0': 'a',
'\u00E1': 'a',
'\u00E2': 'a',
'\u1EA7': 'a',
'\u1EA5': 'a',
'\u1EAB': 'a',
'\u1EA9': 'a',
'\u00E3': 'a',
'\u0101': 'a',
'\u0103': 'a',
'\u1EB1': 'a',
'\u1EAF': 'a',
'\u1EB5': 'a',
'\u1EB3': 'a',
'\u0227': 'a',
'\u01E1': 'a',
'\u00E4': 'a',
'\u01DF': 'a',
'\u1EA3': 'a',
'\u00E5': 'a',
'\u01FB': 'a',
'\u01CE': 'a',
'\u0201': 'a',
'\u0203': 'a',
'\u1EA1': 'a',
'\u1EAD': 'a',
'\u1EB7': 'a',
'\u1E01': 'a',
'\u0105': 'a',
'\u2C65': 'a',
'\u0250': 'a',
'\uA733': 'aa',
'\u00E6': 'ae',
'\u01FD': 'ae',
'\u01E3': 'ae',
'\uA735': 'ao',
'\uA737': 'au',
'\uA739': 'av',
'\uA73B': 'av',
'\uA73D': 'ay',
'\u24D1': 'b',
'\uFF42': 'b',
'\u1E03': 'b',
'\u1E05': 'b',
'\u1E07': 'b',
'\u0180': 'b',
'\u0183': 'b',
'\u0253': 'b',
'\u24D2': 'c',
'\uFF43': 'c',
'\u0107': 'c',
'\u0109': 'c',
'\u010B': 'c',
'\u010D': 'c',
'\u00E7': 'c',
'\u1E09': 'c',
'\u0188': 'c',
'\u023C': 'c',
'\uA73F': 'c',
'\u2184': 'c',
'\u24D3': 'd',
'\uFF44': 'd',
'\u1E0B': 'd',
'\u010F': 'd',
'\u1E0D': 'd',
'\u1E11': 'd',
'\u1E13': 'd',
'\u1E0F': 'd',
'\u0111': 'd',
'\u018C': 'd',
'\u0256': 'd',
'\u0257': 'd',
'\uA77A': 'd',
'\u01F3': 'dz',
'\u01C6': 'dz',
'\u24D4': 'e',
'\uFF45': 'e',
'\u00E8': 'e',
'\u00E9': 'e',
'\u00EA': 'e',
'\u1EC1': 'e',
'\u1EBF': 'e',
'\u1EC5': 'e',
'\u1EC3': 'e',
'\u1EBD': 'e',
'\u0113': 'e',
'\u1E15': 'e',
'\u1E17': 'e',
'\u0115': 'e',
'\u0117': 'e',
'\u00EB': 'e',
'\u1EBB': 'e',
'\u011B': 'e',
'\u0205': 'e',
'\u0207': 'e',
'\u1EB9': 'e',
'\u1EC7': 'e',
'\u0229': 'e',
'\u1E1D': 'e',
'\u0119': 'e',
'\u1E19': 'e',
'\u1E1B': 'e',
'\u0247': 'e',
'\u025B': 'e',
'\u01DD': 'e',
'\u24D5': 'f',
'\uFF46': 'f',
'\u1E1F': 'f',
'\u0192': 'f',
'\uA77C': 'f',
'\u24D6': 'g',
'\uFF47': 'g',
'\u01F5': 'g',
'\u011D': 'g',
'\u1E21': 'g',
'\u011F': 'g',
'\u0121': 'g',
'\u01E7': 'g',
'\u0123': 'g',
'\u01E5': 'g',
'\u0260': 'g',
'\uA7A1': 'g',
'\u1D79': 'g',
'\uA77F': 'g',
'\u24D7': 'h',
'\uFF48': 'h',
'\u0125': 'h',
'\u1E23': 'h',
'\u1E27': 'h',
'\u021F': 'h',
'\u1E25': 'h',
'\u1E29': 'h',
'\u1E2B': 'h',
'\u1E96': 'h',
'\u0127': 'h',
'\u2C68': 'h',
'\u2C76': 'h',
'\u0265': 'h',
'\u0195': 'hv',
'\u24D8': 'i',
'\uFF49': 'i',
'\u00EC': 'i',
'\u00ED': 'i',
'\u00EE': 'i',
'\u0129': 'i',
'\u012B': 'i',
'\u012D': 'i',
'\u00EF': 'i',
'\u1E2F': 'i',
'\u1EC9': 'i',
'\u01D0': 'i',
'\u0209': 'i',
'\u020B': 'i',
'\u1ECB': 'i',
'\u012F': 'i',
'\u1E2D': 'i',
'\u0268': 'i',
'\u0131': 'i',
'\u24D9': 'j',
'\uFF4A': 'j',
'\u0135': 'j',
'\u01F0': 'j',
'\u0249': 'j',
'\u24DA': 'k',
'\uFF4B': 'k',
'\u1E31': 'k',
'\u01E9': 'k',
'\u1E33': 'k',
'\u0137': 'k',
'\u1E35': 'k',
'\u0199': 'k',
'\u2C6A': 'k',
'\uA741': 'k',
'\uA743': 'k',
'\uA745': 'k',
'\uA7A3': 'k',
'\u24DB': 'l',
'\uFF4C': 'l',
'\u0140': 'l',
'\u013A': 'l',
'\u013E': 'l',
'\u1E37': 'l',
'\u1E39': 'l',
'\u013C': 'l',
'\u1E3D': 'l',
'\u1E3B': 'l',
'\u017F': 'l',
'\u0142': 'l',
'\u019A': 'l',
'\u026B': 'l',
'\u2C61': 'l',
'\uA749': 'l',
'\uA781': 'l',
'\uA747': 'l',
'\u01C9': 'lj',
'\u24DC': 'm',
'\uFF4D': 'm',
'\u1E3F': 'm',
'\u1E41': 'm',
'\u1E43': 'm',
'\u0271': 'm',
'\u026F': 'm',
'\u24DD': 'n',
'\uFF4E': 'n',
'\u01F9': 'n',
'\u0144': 'n',
'\u00F1': 'n',
'\u1E45': 'n',
'\u0148': 'n',
'\u1E47': 'n',
'\u0146': 'n',
'\u1E4B': 'n',
'\u1E49': 'n',
'\u019E': 'n',
'\u0272': 'n',
'\u0149': 'n',
'\uA791': 'n',
'\uA7A5': 'n',
'\u01CC': 'nj',
'\u24DE': 'o',
'\uFF4F': 'o',
'\u00F2': 'o',
'\u00F3': 'o',
'\u00F4': 'o',
'\u1ED3': 'o',
'\u1ED1': 'o',
'\u1ED7': 'o',
'\u1ED5': 'o',
'\u00F5': 'o',
'\u1E4D': 'o',
'\u022D': 'o',
'\u1E4F': 'o',
'\u014D': 'o',
'\u1E51': 'o',
'\u1E53': 'o',
'\u014F': 'o',
'\u022F': 'o',
'\u0231': 'o',
'\u00F6': 'o',
'\u022B': 'o',
'\u1ECF': 'o',
'\u0151': 'o',
'\u01D2': 'o',
'\u020D': 'o',
'\u020F': 'o',
'\u01A1': 'o',
'\u1EDD': 'o',
'\u1EDB': 'o',
'\u1EE1': 'o',
'\u1EDF': 'o',
'\u1EE3': 'o',
'\u1ECD': 'o',
'\u1ED9': 'o',
'\u01EB': 'o',
'\u01ED': 'o',
'\u00F8': 'o',
'\u01FF': 'o',
'\u0254': 'o',
'\uA74B': 'o',
'\uA74D': 'o',
'\u0275': 'o',
'\u01A3': 'oi',
'\u0223': 'ou',
'\uA74F': 'oo',
'\u24DF': 'p',
'\uFF50': 'p',
'\u1E55': 'p',
'\u1E57': 'p',
'\u01A5': 'p',
'\u1D7D': 'p',
'\uA751': 'p',
'\uA753': 'p',
'\uA755': 'p',
'\u24E0': 'q',
'\uFF51': 'q',
'\u024B': 'q',
'\uA757': 'q',
'\uA759': 'q',
'\u24E1': 'r',
'\uFF52': 'r',
'\u0155': 'r',
'\u1E59': 'r',
'\u0159': 'r',
'\u0211': 'r',
'\u0213': 'r',
'\u1E5B': 'r',
'\u1E5D': 'r',
'\u0157': 'r',
'\u1E5F': 'r',
'\u024D': 'r',
'\u027D': 'r',
'\uA75B': 'r',
'\uA7A7': 'r',
'\uA783': 'r',
'\u24E2': 's',
'\uFF53': 's',
'\u00DF': 's',
'\u015B': 's',
'\u1E65': 's',
'\u015D': 's',
'\u1E61': 's',
'\u0161': 's',
'\u1E67': 's',
'\u1E63': 's',
'\u1E69': 's',
'\u0219': 's',
'\u015F': 's',
'\u023F': 's',
'\uA7A9': 's',
'\uA785': 's',
'\u1E9B': 's',
'\u24E3': 't',
'\uFF54': 't',
'\u1E6B': 't',
'\u1E97': 't',
'\u0165': 't',
'\u1E6D': 't',
'\u021B': 't',
'\u0163': 't',
'\u1E71': 't',
'\u1E6F': 't',
'\u0167': 't',
'\u01AD': 't',
'\u0288': 't',
'\u2C66': 't',
'\uA787': 't',
'\uA729': 'tz',
'\u24E4': 'u',
'\uFF55': 'u',
'\u00F9': 'u',
'\u00FA': 'u',
'\u00FB': 'u',
'\u0169': 'u',
'\u1E79': 'u',
'\u016B': 'u',
'\u1E7B': 'u',
'\u016D': 'u',
'\u00FC': 'u',
'\u01DC': 'u',
'\u01D8': 'u',
'\u01D6': 'u',
'\u01DA': 'u',
'\u1EE7': 'u',
'\u016F': 'u',
'\u0171': 'u',
'\u01D4': 'u',
'\u0215': 'u',
'\u0217': 'u',
'\u01B0': 'u',
'\u1EEB': 'u',
'\u1EE9': 'u',
'\u1EEF': 'u',
'\u1EED': 'u',
'\u1EF1': 'u',
'\u1EE5': 'u',
'\u1E73': 'u',
'\u0173': 'u',
'\u1E77': 'u',
'\u1E75': 'u',
'\u0289': 'u',
'\u24E5': 'v',
'\uFF56': 'v',
'\u1E7D': 'v',
'\u1E7F': 'v',
'\u028B': 'v',
'\uA75F': 'v',
'\u028C': 'v',
'\uA761': 'vy',
'\u24E6': 'w',
'\uFF57': 'w',
'\u1E81': 'w',
'\u1E83': 'w',
'\u0175': 'w',
'\u1E87': 'w',
'\u1E85': 'w',
'\u1E98': 'w',
'\u1E89': 'w',
'\u2C73': 'w',
'\u24E7': 'x',
'\uFF58': 'x',
'\u1E8B': 'x',
'\u1E8D': 'x',
'\u24E8': 'y',
'\uFF59': 'y',
'\u1EF3': 'y',
'\u00FD': 'y',
'\u0177': 'y',
'\u1EF9': 'y',
'\u0233': 'y',
'\u1E8F': 'y',
'\u00FF': 'y',
'\u1EF7': 'y',
'\u1E99': 'y',
'\u1EF5': 'y',
'\u01B4': 'y',
'\u024F': 'y',
'\u1EFF': 'y',
'\u24E9': 'z',
'\uFF5A': 'z',
'\u017A': 'z',
'\u1E91': 'z',
'\u017C': 'z',
'\u017E': 'z',
'\u1E93': 'z',
'\u1E95': 'z',
'\u01B6': 'z',
'\u0225': 'z',
'\u0240': 'z',
'\u2C6C': 'z',
'\uA763': 'z',
'\u0386': '\u0391',
'\u0388': '\u0395',
'\u0389': '\u0397',
'\u038A': '\u0399',
'\u03AA': '\u0399',
'\u038C': '\u039F',
'\u038E': '\u03A5',
'\u03AB': '\u03A5',
'\u038F': '\u03A9',
'\u03AC': '\u03B1',
'\u03AD': '\u03B5',
'\u03AE': '\u03B7',
'\u03AF': '\u03B9',
'\u03CA': '\u03B9',
'\u0390': '\u03B9',
'\u03CC': '\u03BF',
'\u03CD': '\u03C5',
'\u03CB': '\u03C5',
'\u03B0': '\u03C5',
'\u03C9': '\u03C9',
'\u03C2': '\u03C3'
};
DataUtil.fnOperators = {
/**
* Returns true when the actual input is equal to the given input.
* @param {string|number|boolean} actual
* @param {string|number|boolean} expected
* @param {boolean} ignoreCase?
* @param {boolean} ignoreAccent?
*/
equal: function (actual, expected, ignoreCase, ignoreAccent) {
if (ignoreAccent) {
actual = DataUtil.ignoreDiacritics(actual);
expected = DataUtil.ignoreDiacritics(expected);
}
return !!xhr && ('withCredentials' in xhr);
};
DataUtil.getGuid = function (prefix) {
var hexs = '0123456789abcdef';
var rand;
return (prefix || '') + '00000000-0000-4000-0000-000000000000'.replace(/0/g, function (val, i) {
if ('crypto' in window && 'getRandomValues' in crypto) {
var arr = new Uint8Array(1);
window.crypto.getRandomValues(arr);
rand = arr[0] % 16 | 0;
}
else {
rand = Math.random() * 16 | 0;
}
return hexs[i === 19 ? rand & 0x3 | 0x8 : rand];
});
};
DataUtil.isNull = function (val) {
return val === undefined || val === null;
};
DataUtil.getItemFromComparer = function (array, field, comparer) {
var keyVal;
var current;
var key;
var i = 0;
var castRequired = typeof DataUtil.getVal(array, 0, field) === 'string';
if (array.length) {
while (ej2_base_1.isNullOrUndefined(keyVal) && i < array.length) {
keyVal = DataUtil.getVal(array, i, field);
key = array[i++];
}
if (ignoreCase) {
return DataUtil.toLowerCase(actual) === DataUtil.toLowerCase(expected);
}
for (; i < array.length; i++) {
current = DataUtil.getVal(array, i, field);
if (ej2_base_1.isNullOrUndefined(current)) {
continue;
}
if (castRequired) {
keyVal = +keyVal;
current = +current;
}
if (comparer(keyVal, current) > 0) {
keyVal = current;
key = array[i];
}
return actual === expected;
},
/**
* Returns true when the actual input is not equal to the given input.
* @param {string|number|boolean} actual
* @param {string|number|boolean} expected
* @param {boolean} ignoreCase?
*/
notequal: function (actual, expected, ignoreCase, ignoreAccent) {
if (ignoreAccent) {
actual = DataUtil.ignoreDiacritics(actual);
expected = DataUtil.ignoreDiacritics(expected);
}
return key;
};
DataUtil.distinct = function (json, fieldName, requiresCompleteRecord) {
requiresCompleteRecord = ej2_base_1.isNullOrUndefined(requiresCompleteRecord) ? false : requiresCompleteRecord;
var result = [];
var val;
var tmp = {};
json.forEach(function (data, index) {
val = DataUtil.getVal(json, index, fieldName);
if (!(val in tmp)) {
result.push(!requiresCompleteRecord ? val : json[index]);
tmp[val] = 1;
}
});
return result;
};
DataUtil.serverTimezoneOffset = null;
DataUtil.throwError = function (error) {
try {
throw new Error(error);
return !DataUtil.fnOperators.equal(actual, expected, ignoreCase);
},
/**
* Returns true when the actual input is less than to the given input.
* @param {string|number|boolean} actual
* @param {string|number|boolean} expected
* @param {boolean} ignoreCase?
*/
lessthan: function (actual, expected, ignoreCase) {
if (ignoreCase) {
return DataUtil.toLowerCase(actual) < DataUtil.toLowerCase(expected);
}
catch (e) {
throw e.message + '\n' + e.stack;
return actual < expected;
},
/**
* Returns true when the actual input is greater than to the given input.
* @param {string|number|boolean} actual
* @param {string|number|boolean} expected
* @param {boolean} ignoreCase?
*/
greaterthan: function (actual, expected, ignoreCase) {
if (ignoreCase) {
return DataUtil.toLowerCase(actual) > DataUtil.toLowerCase(expected);
}
};
DataUtil.aggregates = {
sum: function (ds, field) {
var result = 0;
var val;
var castRequired = typeof DataUtil.getVal(ds, 0, field) !== 'number';
for (var i = 0; i < ds.length; i++) {
val = DataUtil.getVal(ds, i, field);
if (!isNaN(val) && val !== null) {
if (castRequired) {
val = +val;
}
result += val;
}
}
return result;
},
average: function (ds, field) {
return DataUtil.aggregates.sum(ds, field) / ds.length;
},
min: function (ds, field) {
var comparer;
if (typeof field === 'function') {
comparer = field;
field = null;
}
return DataUtil.getObject(field, DataUtil.getItemFromComparer(ds, field, comparer || DataUtil.fnAscending));
},
max: function (ds, field) {
var comparer;
if (typeof field === 'function') {
comparer = field;
field = null;
}
return DataUtil.getObject(field, DataUtil.getItemFromComparer(ds, field, comparer || DataUtil.fnDescending));
},
truecount: function (ds, field) {
return new manager_1.DataManager(ds).executeLocal(new query_1.Query().where(field, 'equal', true, true)).length;
},
falsecount: function (ds, field) {
return new manager_1.DataManager(ds).executeLocal(new query_1.Query().where(field, 'equal', false, true)).length;
},
count: function (ds, field) {
return ds.length;
return actual > expected;
},
/**
* Returns true when the actual input is less than or equal to the given input.
* @param {string|number|boolean} actual
* @param {string|number|boolean} expected
* @param {boolean} ignoreCase?
*/
lessthanorequal: function (actual, expected, ignoreCase) {
if (ignoreCase) {
return DataUtil.toLowerCase(actual) <= DataUtil.toLowerCase(expected);
}
};
DataUtil.operatorSymbols = {
'<': 'lessthan',
'>': 'greaterthan',
'<=': 'lessthanorequal',
'>=': 'greaterthanorequal',
'==': 'equal',
'!=': 'notequal',
'*=': 'contains',
'$=': 'endswith',
'^=': 'startswith'
};
DataUtil.odBiOperator = {
'<': ' lt ',
'>': ' gt ',
'<=': ' le ',
'>=': ' ge ',
'==': ' eq ',
'!=': ' ne ',
'lessthan': ' lt ',
'lessthanorequal': ' le ',
'greaterthan': ' gt ',
'greaterthanorequal': ' ge ',
'equal': ' eq ',
'notequal': ' ne '
};
DataUtil.odUniOperator = {
'$=': 'endswith',
'^=': 'startswith',
'*=': 'substringof',
'endswith': 'endswith',
'startswith': 'startswith',
'contains': 'substringof'
};
DataUtil.odv4UniOperator = {
'$=': 'endswith',
'^=': 'startswith',
'*=': 'contains',
'endswith': 'endswith',
'startswith': 'startswith',
'contains': 'contains'
};
DataUtil.diacritics = {
'\u24B6': 'A',
'\uFF21': 'A',
'\u00C0': 'A',
'\u00C1': 'A',
'\u00C2': 'A',
'\u1EA6': 'A',
'\u1EA4': 'A',
'\u1EAA': 'A',
'\u1EA8': 'A',
'\u00C3': 'A',
'\u0100': 'A',
'\u0102': 'A',
'\u1EB0': 'A',
'\u1EAE': 'A',
'\u1EB4': 'A',
'\u1EB2': 'A',
'\u0226': 'A',
'\u01E0': 'A',
'\u00C4': 'A',
'\u01DE': 'A',
'\u1EA2': 'A',
'\u00C5': 'A',
'\u01FA': 'A',
'\u01CD': 'A',
'\u0200': 'A',
'\u0202': 'A',
'\u1EA0': 'A',
'\u1EAC': 'A',
'\u1EB6': 'A',
'\u1E00': 'A',
'\u0104': 'A',
'\u023A': 'A',
'\u2C6F': 'A',
'\uA732': 'AA',
'\u00C6': 'AE',
'\u01FC': 'AE',
'\u01E2': 'AE',
'\uA734': 'AO',
'\uA736': 'AU',
'\uA738': 'AV',
'\uA73A': 'AV',
'\uA73C': 'AY',
'\u24B7': 'B',
'\uFF22': 'B',
'\u1E02': 'B',
'\u1E04': 'B',
'\u1E06': 'B',
'\u0243': 'B',
'\u0182': 'B',
'\u0181': 'B',
'\u24B8': 'C',
'\uFF23': 'C',
'\u0106': 'C',
'\u0108': 'C',
'\u010A': 'C',
'\u010C': 'C',
'\u00C7': 'C',
'\u1E08': 'C',
'\u0187': 'C',
'\u023B': 'C',
'\uA73E': 'C',
'\u24B9': 'D',
'\uFF24': 'D',
'\u1E0A': 'D',
'\u010E': 'D',
'\u1E0C': 'D',
'\u1E10': 'D',
'\u1E12': 'D',
'\u1E0E': 'D',
'\u0110': 'D',
'\u018B': 'D',
'\u018A': 'D',
'\u0189': 'D',
'\uA779': 'D',
'\u01F1': 'DZ',
'\u01C4': 'DZ',
'\u01F2': 'Dz',
'\u01C5': 'Dz',
'\u24BA': 'E',
'\uFF25': 'E',
'\u00C8': 'E',
'\u00C9': 'E',
'\u00CA': 'E',
'\u1EC0': 'E',
'\u1EBE': 'E',
'\u1EC4': 'E',
'\u1EC2': 'E',
'\u1EBC': 'E',
'\u0112': 'E',
'\u1E14': 'E',
'\u1E16': 'E',
'\u0114': 'E',
'\u0116': 'E',
'\u00CB': 'E',
'\u1EBA': 'E',
'\u011A': 'E',
'\u0204': 'E',
'\u0206': 'E',
'\u1EB8': 'E',
'\u1EC6': 'E',
'\u0228': 'E',
'\u1E1C': 'E',
'\u0118': 'E',
'\u1E18': 'E',
'\u1E1A': 'E',
'\u0190': 'E',
'\u018E': 'E',
'\u24BB': 'F',
'\uFF26': 'F',
'\u1E1E': 'F',
'\u0191': 'F',
'\uA77B': 'F',
'\u24BC': 'G',
'\uFF27': 'G',
'\u01F4': 'G',
'\u011C': 'G',
'\u1E20': 'G',
'\u011E': 'G',
'\u0120': 'G',
'\u01E6': 'G',
'\u0122': 'G',
'\u01E4': 'G',
'\u0193': 'G',
'\uA7A0': 'G',
'\uA77D': 'G',
'\uA77E': 'G',
'\u24BD': 'H',
'\uFF28': 'H',
'\u0124': 'H',
'\u1E22': 'H',
'\u1E26': 'H',
'\u021E': 'H',
'\u1E24': 'H',
'\u1E28': 'H',
'\u1E2A': 'H',
'\u0126': 'H',
'\u2C67': 'H',
'\u2C75': 'H',
'\uA78D': 'H',
'\u24BE': 'I',
'\uFF29': 'I',
'\u00CC': 'I',
'\u00CD': 'I',
'\u00CE': 'I',
'\u0128': 'I',
'\u012A': 'I',
'\u012C': 'I',
'\u0130': 'I',
'\u00CF': 'I',
'\u1E2E': 'I',
'\u1EC8': 'I',
'\u01CF': 'I',
'\u0208': 'I',
'\u020A': 'I',
'\u1ECA': 'I',
'\u012E': 'I',
'\u1E2C': 'I',
'\u0197': 'I',
'\u24BF': 'J',
'\uFF2A': 'J',
'\u0134': 'J',
'\u0248': 'J',
'\u24C0': 'K',
'\uFF2B': 'K',
'\u1E30': 'K',
'\u01E8': 'K',
'\u1E32': 'K',
'\u0136': 'K',
'\u1E34': 'K',
'\u0198': 'K',
'\u2C69': 'K',
'\uA740': 'K',
'\uA742': 'K',
'\uA744': 'K',
'\uA7A2': 'K',
'\u24C1': 'L',
'\uFF2C': 'L',
'\u013F': 'L',
'\u0139': 'L',
'\u013D': 'L',
'\u1E36': 'L',
'\u1E38': 'L',
'\u013B': 'L',
'\u1E3C': 'L',
'\u1E3A': 'L',
'\u0141': 'L',
'\u023D': 'L',
'\u2C62': 'L',
'\u2C60': 'L',
'\uA748': 'L',
'\uA746': 'L',
'\uA780': 'L',
'\u01C7': 'LJ',
'\u01C8': 'Lj',
'\u24C2': 'M',
'\uFF2D': 'M',
'\u1E3E': 'M',
'\u1E40': 'M',
'\u1E42': 'M',
'\u2C6E': 'M',
'\u019C': 'M',
'\u24C3': 'N',
'\uFF2E': 'N',
'\u01F8': 'N',
'\u0143': 'N',
'\u00D1': 'N',
'\u1E44': 'N',
'\u0147': 'N',
'\u1E46': 'N',
'\u0145': 'N',
'\u1E4A': 'N',
'\u1E48': 'N',
'\u0220': 'N',
'\u019D': 'N',
'\uA790': 'N',
'\uA7A4': 'N',
'\u01CA': 'NJ',
'\u01CB': 'Nj',
'\u24C4': 'O',
'\uFF2F': 'O',
'\u00D2': 'O',
'\u00D3': 'O',
'\u00D4': 'O',
'\u1ED2': 'O',
'\u1ED0': 'O',
'\u1ED6': 'O',
'\u1ED4': 'O',
'\u00D5': 'O',
'\u1E4C': 'O',
'\u022C': 'O',
'\u1E4E': 'O',
'\u014C': 'O',
'\u1E50': 'O',
'\u1E52': 'O',
'\u014E': 'O',
'\u022E': 'O',
'\u0230': 'O',
'\u00D6': 'O',
'\u022A': 'O',
'\u1ECE': 'O',
'\u0150': 'O',
'\u01D1': 'O',
'\u020C': 'O',
'\u020E': 'O',
'\u01A0': 'O',
'\u1EDC': 'O',
'\u1EDA': 'O',
'\u1EE0': 'O',
'\u1EDE': 'O',
'\u1EE2': 'O',
'\u1ECC': 'O',
'\u1ED8': 'O',
'\u01EA': 'O',
'\u01EC': 'O',
'\u00D8': 'O',
'\u01FE': 'O',
'\u0186': 'O',
'\u019F': 'O',
'\uA74A': 'O',
'\uA74C': 'O',
'\u01A2': 'OI',
'\uA74E': 'OO',
'\u0222': 'OU',
'\u24C5': 'P',
'\uFF30': 'P',
'\u1E54': 'P',
'\u1E56': 'P',
'\u01A4': 'P',
'\u2C63': 'P',
'\uA750': 'P',
'\uA752': 'P',
'\uA754': 'P',
'\u24C6': 'Q',
'\uFF31': 'Q',
'\uA756': 'Q',
'\uA758': 'Q',
'\u024A': 'Q',
'\u24C7': 'R',
'\uFF32': 'R',
'\u0154': 'R',
'\u1E58': 'R',
'\u0158': 'R',
'\u0210': 'R',
'\u0212': 'R',
'\u1E5A': 'R',
'\u1E5C': 'R',
'\u0156': 'R',
'\u1E5E': 'R',
'\u024C': 'R',
'\u2C64': 'R',
'\uA75A': 'R',
'\uA7A6': 'R',
'\uA782': 'R',
'\u24C8': 'S',
'\uFF33': 'S',
'\u1E9E': 'S',
'\u015A': 'S',
'\u1E64': 'S',
'\u015C': 'S',
'\u1E60': 'S',
'\u0160': 'S',
'\u1E66': 'S',
'\u1E62': 'S',
'\u1E68': 'S',
'\u0218': 'S',
'\u015E': 'S',
'\u2C7E': 'S',
'\uA7A8': 'S',
'\uA784': 'S',
'\u24C9': 'T',
'\uFF34': 'T',
'\u1E6A': 'T',
'\u0164': 'T',
'\u1E6C': 'T',
'\u021A': 'T',
'\u0162': 'T',
'\u1E70': 'T',
'\u1E6E': 'T',
'\u0166': 'T',
'\u01AC': 'T',
'\u01AE': 'T',
'\u023E': 'T',
'\uA786': 'T',
'\uA728': 'TZ',
'\u24CA': 'U',
'\uFF35': 'U',
'\u00D9': 'U',
'\u00DA': 'U',
'\u00DB': 'U',
'\u0168': 'U',
'\u1E78': 'U',
'\u016A': 'U',
'\u1E7A': 'U',
'\u016C': 'U',
'\u00DC': 'U',
'\u01DB': 'U',
'\u01D7': 'U',
'\u01D5': 'U',
'\u01D9': 'U',
'\u1EE6': 'U',
'\u016E': 'U',
'\u0170': 'U',
'\u01D3': 'U',
'\u0214': 'U',
'\u0216': 'U',
'\u01AF': 'U',
'\u1EEA': 'U',
'\u1EE8': 'U',
'\u1EEE': 'U',
'\u1EEC': 'U',
'\u1EF0': 'U',
'\u1EE4': 'U',
'\u1E72': 'U',
'\u0172': 'U',
'\u1E76': 'U',
'\u1E74': 'U',
'\u0244': 'U',
'\u24CB': 'V',
'\uFF36': 'V',
'\u1E7C': 'V',
'\u1E7E': 'V',
'\u01B2': 'V',
'\uA75E': 'V',
'\u0245': 'V',
'\uA760': 'VY',
'\u24CC': 'W',
'\uFF37': 'W',
'\u1E80': 'W',
'\u1E82': 'W',
'\u0174': 'W',
'\u1E86': 'W',
'\u1E84': 'W',
'\u1E88': 'W',
'\u2C72': 'W',
'\u24CD': 'X',
'\uFF38': 'X',
'\u1E8A': 'X',
'\u1E8C': 'X',
'\u24CE': 'Y',
'\uFF39': 'Y',
'\u1EF2': 'Y',
'\u00DD': 'Y',
'\u0176': 'Y',
'\u1EF8': 'Y',
'\u0232': 'Y',
'\u1E8E': 'Y',
'\u0178': 'Y',
'\u1EF6': 'Y',
'\u1EF4': 'Y',
'\u01B3': 'Y',
'\u024E': 'Y',
'\u1EFE': 'Y',
'\u24CF': 'Z',
'\uFF3A': 'Z',
'\u0179': 'Z',
'\u1E90': 'Z',
'\u017B': 'Z',
'\u017D': 'Z',
'\u1E92': 'Z',
'\u1E94': 'Z',
'\u01B5': 'Z',
'\u0224': 'Z',
'\u2C7F': 'Z',
'\u2C6B': 'Z',
'\uA762': 'Z',
'\u24D0': 'a',
'\uFF41': 'a',
'\u1E9A': 'a',
'\u00E0': 'a',
'\u00E1': 'a',
'\u00E2': 'a',
'\u1EA7': 'a',
'\u1EA5': 'a',
'\u1EAB': 'a',
'\u1EA9': 'a',
'\u00E3': 'a',
'\u0101': 'a',
'\u0103': 'a',
'\u1EB1': 'a',
'\u1EAF': 'a',
'\u1EB5': 'a',
'\u1EB3': 'a',
'\u0227': 'a',
'\u01E1': 'a',
'\u00E4': 'a',
'\u01DF': 'a',
'\u1EA3': 'a',
'\u00E5': 'a',
'\u01FB': 'a',
'\u01CE': 'a',
'\u0201': 'a',
'\u0203': 'a',
'\u1EA1': 'a',
'\u1EAD': 'a',
'\u1EB7': 'a',
'\u1E01': 'a',
'\u0105': 'a',
'\u2C65': 'a',
'\u0250': 'a',
'\uA733': 'aa',
'\u00E6': 'ae',
'\u01FD': 'ae',
'\u01E3': 'ae',
'\uA735': 'ao',
'\uA737': 'au',
'\uA739': 'av',
'\uA73B': 'av',
'\uA73D': 'ay',
'\u24D1': 'b',
'\uFF42': 'b',
'\u1E03': 'b',
'\u1E05': 'b',
'\u1E07': 'b',
'\u0180': 'b',
'\u0183': 'b',
'\u0253': 'b',
'\u24D2': 'c',
'\uFF43': 'c',
'\u0107': 'c',
'\u0109': 'c',
'\u010B': 'c',
'\u010D': 'c',
'\u00E7': 'c',
'\u1E09': 'c',
'\u0188': 'c',
'\u023C': 'c',
'\uA73F': 'c',
'\u2184': 'c',
'\u24D3': 'd',
'\uFF44': 'd',
'\u1E0B': 'd',
'\u010F': 'd',
'\u1E0D': 'd',
'\u1E11': 'd',
'\u1E13': 'd',
'\u1E0F': 'd',
'\u0111': 'd',
'\u018C': 'd',
'\u0256': 'd',
'\u0257': 'd',
'\uA77A': 'd',
'\u01F3': 'dz',
'\u01C6': 'dz',
'\u24D4': 'e',
'\uFF45': 'e',
'\u00E8': 'e',
'\u00E9': 'e',
'\u00EA': 'e',
'\u1EC1': 'e',
'\u1EBF': 'e',
'\u1EC5': 'e',
'\u1EC3': 'e',
'\u1EBD': 'e',
'\u0113': 'e',
'\u1E15': 'e',
'\u1E17': 'e',
'\u0115': 'e',
'\u0117': 'e',
'\u00EB': 'e',
'\u1EBB': 'e',
'\u011B': 'e',
'\u0205': 'e',
'\u0207': 'e',
'\u1EB9': 'e',
'\u1EC7': 'e',
'\u0229': 'e',
'\u1E1D': 'e',
'\u0119': 'e',
'\u1E19': 'e',
'\u1E1B': 'e',
'\u0247': 'e',
'\u025B': 'e',
'\u01DD': 'e',
'\u24D5': 'f',
'\uFF46': 'f',
'\u1E1F': 'f',
'\u0192': 'f',
'\uA77C': 'f',
'\u24D6': 'g',
'\uFF47': 'g',
'\u01F5': 'g',
'\u011D': 'g',
'\u1E21': 'g',
'\u011F': 'g',
'\u0121': 'g',
'\u01E7': 'g',
'\u0123': 'g',
'\u01E5': 'g',
'\u0260': 'g',
'\uA7A1': 'g',
'\u1D79': 'g',
'\uA77F': 'g',
'\u24D7': 'h',
'\uFF48': 'h',
'\u0125': 'h',
'\u1E23': 'h',
'\u1E27': 'h',
'\u021F': 'h',
'\u1E25': 'h',
'\u1E29': 'h',
'\u1E2B': 'h',
'\u1E96': 'h',
'\u0127': 'h',
'\u2C68': 'h',
'\u2C76': 'h',
'\u0265': 'h',
'\u0195': 'hv',
'\u24D8': 'i',
'\uFF49': 'i',
'\u00EC': 'i',
'\u00ED': 'i',
'\u00EE': 'i',
'\u0129': 'i',
'\u012B': 'i',
'\u012D': 'i',
'\u00EF': 'i',
'\u1E2F': 'i',
'\u1EC9': 'i',
'\u01D0': 'i',
'\u0209': 'i',
'\u020B': 'i',
'\u1ECB': 'i',
'\u012F': 'i',
'\u1E2D': 'i',
'\u0268': 'i',
'\u0131': 'i',
'\u24D9': 'j',
'\uFF4A': 'j',
'\u0135': 'j',
'\u01F0': 'j',
'\u0249': 'j',
'\u24DA': 'k',
'\uFF4B': 'k',
'\u1E31': 'k',
'\u01E9': 'k',
'\u1E33': 'k',
'\u0137': 'k',
'\u1E35': 'k',
'\u0199': 'k',
'\u2C6A': 'k',
'\uA741': 'k',
'\uA743': 'k',
'\uA745': 'k',
'\uA7A3': 'k',
'\u24DB': 'l',
'\uFF4C': 'l',
'\u0140': 'l',
'\u013A': 'l',
'\u013E': 'l',
'\u1E37': 'l',
'\u1E39': 'l',
'\u013C': 'l',
'\u1E3D': 'l',
'\u1E3B': 'l',
'\u017F': 'l',
'\u0142': 'l',
'\u019A': 'l',
'\u026B': 'l',
'\u2C61': 'l',
'\uA749': 'l',
'\uA781': 'l',
'\uA747': 'l',
'\u01C9': 'lj',
'\u24DC': 'm',
'\uFF4D': 'm',
'\u1E3F': 'm',
'\u1E41': 'm',
'\u1E43': 'm',
'\u0271': 'm',
'\u026F': 'm',
'\u24DD': 'n',
'\uFF4E': 'n',
'\u01F9': 'n',
'\u0144': 'n',
'\u00F1': 'n',
'\u1E45': 'n',
'\u0148': 'n',
'\u1E47': 'n',
'\u0146': 'n',
'\u1E4B': 'n',
'\u1E49': 'n',
'\u019E': 'n',
'\u0272': 'n',
'\u0149': 'n',
'\uA791': 'n',
'\uA7A5': 'n',
'\u01CC': 'nj',
'\u24DE': 'o',
'\uFF4F': 'o',
'\u00F2': 'o',
'\u00F3': 'o',
'\u00F4': 'o',
'\u1ED3': 'o',
'\u1ED1': 'o',
'\u1ED7': 'o',
'\u1ED5': 'o',
'\u00F5': 'o',
'\u1E4D': 'o',
'\u022D': 'o',
'\u1E4F': 'o',
'\u014D': 'o',
'\u1E51': 'o',
'\u1E53': 'o',
'\u014F': 'o',
'\u022F': 'o',
'\u0231': 'o',
'\u00F6': 'o',
'\u022B': 'o',
'\u1ECF': 'o',
'\u0151': 'o',
'\u01D2': 'o',
'\u020D': 'o',
'\u020F': 'o',
'\u01A1': 'o',
'\u1EDD': 'o',
'\u1EDB': 'o',
'\u1EE1': 'o',
'\u1EDF': 'o',
'\u1EE3': 'o',
'\u1ECD': 'o',
'\u1ED9': 'o',
'\u01EB': 'o',
'\u01ED': 'o',
'\u00F8': 'o',
'\u01FF': 'o',
'\u0254': 'o',
'\uA74B': 'o',
'\uA74D': 'o',
'\u0275': 'o',
'\u01A3': 'oi',
'\u0223': 'ou',
'\uA74F': 'oo',
'\u24DF': 'p',
'\uFF50': 'p',
'\u1E55': 'p',
'\u1E57': 'p',
'\u01A5': 'p',
'\u1D7D': 'p',
'\uA751': 'p',
'\uA753': 'p',
'\uA755': 'p',
'\u24E0': 'q',
'\uFF51': 'q',
'\u024B': 'q',
'\uA757': 'q',
'\uA759': 'q',
'\u24E1': 'r',
'\uFF52': 'r',
'\u0155': 'r',
'\u1E59': 'r',
'\u0159': 'r',
'\u0211': 'r',
'\u0213': 'r',
'\u1E5B': 'r',
'\u1E5D': 'r',
'\u0157': 'r',
'\u1E5F': 'r',
'\u024D': 'r',
'\u027D': 'r',
'\uA75B': 'r',
'\uA7A7': 'r',
'\uA783': 'r',
'\u24E2': 's',
'\uFF53': 's',
'\u00DF': 's',
'\u015B': 's',
'\u1E65': 's',
'\u015D': 's',
'\u1E61': 's',
'\u0161': 's',
'\u1E67': 's',
'\u1E63': 's',
'\u1E69': 's',
'\u0219': 's',
'\u015F': 's',
'\u023F': 's',
'\uA7A9': 's',
'\uA785': 's',
'\u1E9B': 's',
'\u24E3': 't',
'\uFF54': 't',
'\u1E6B': 't',
'\u1E97': 't',
'\u0165': 't',
'\u1E6D': 't',
'\u021B': 't',
'\u0163': 't',
'\u1E71': 't',
'\u1E6F': 't',
'\u0167': 't',
'\u01AD': 't',
'\u0288': 't',
'\u2C66': 't',
'\uA787': 't',
'\uA729': 'tz',
'\u24E4': 'u',
'\uFF55': 'u',
'\u00F9': 'u',
'\u00FA': 'u',
'\u00FB': 'u',
'\u0169': 'u',
'\u1E79': 'u',
'\u016B': 'u',
'\u1E7B': 'u',
'\u016D': 'u',
'\u00FC': 'u',
'\u01DC': 'u',
'\u01D8': 'u',
'\u01D6': 'u',
'\u01DA': 'u',
'\u1EE7': 'u',
'\u016F': 'u',
'\u0171': 'u',
'\u01D4': 'u',
'\u0215': 'u',
'\u0217': 'u',
'\u01B0': 'u',
'\u1EEB': 'u',
'\u1EE9': 'u',
'\u1EEF': 'u',
'\u1EED': 'u',
'\u1EF1': 'u',
'\u1EE5': 'u',
'\u1E73': 'u',
'\u0173': 'u',
'\u1E77': 'u',
'\u1E75': 'u',
'\u0289': 'u',
'\u24E5': 'v',
'\uFF56': 'v',
'\u1E7D': 'v',
'\u1E7F': 'v',
'\u028B': 'v',
'\uA75F': 'v',
'\u028C': 'v',
'\uA761': 'vy',
'\u24E6': 'w',
'\uFF57': 'w',
'\u1E81': 'w',
'\u1E83': 'w',
'\u0175': 'w',
'\u1E87': 'w',
'\u1E85': 'w',
'\u1E98': 'w',
'\u1E89': 'w',
'\u2C73': 'w',
'\u24E7': 'x',
'\uFF58': 'x',
'\u1E8B': 'x',
'\u1E8D': 'x',
'\u24E8': 'y',
'\uFF59': 'y',
'\u1EF3': 'y',
'\u00FD': 'y',
'\u0177': 'y',
'\u1EF9': 'y',
'\u0233': 'y',
'\u1E8F': 'y',
'\u00FF': 'y',
'\u1EF7': 'y',
'\u1E99': 'y',
'\u1EF5': 'y',
'\u01B4': 'y',
'\u024F': 'y',
'\u1EFF': 'y',
'\u24E9': 'z',
'\uFF5A': 'z',
'\u017A': 'z',
'\u1E91': 'z',
'\u017C': 'z',
'\u017E': 'z',
'\u1E93': 'z',
'\u1E95': 'z',
'\u01B6': 'z',
'\u0225': 'z',
'\u0240': 'z',
'\u2C6C': 'z',
'\uA763': 'z',
'\u0386': '\u0391',
'\u0388': '\u0395',
'\u0389': '\u0397',
'\u038A': '\u0399',
'\u03AA': '\u0399',
'\u038C': '\u039F',
'\u038E': '\u03A5',
'\u03AB': '\u03A5',
'\u038F': '\u03A9',
'\u03AC': '\u03B1',
'\u03AD': '\u03B5',
'\u03AE': '\u03B7',
'\u03AF': '\u03B9',
'\u03CA': '\u03B9',
'\u0390': '\u03B9',
'\u03CC': '\u03BF',
'\u03CD': '\u03C5',
'\u03CB': '\u03C5',
'\u03B0': '\u03C5',
'\u03C9': '\u03C9',
'\u03C2': '\u03C3'
};
DataUtil.fnOperators = {
equal: function (actual, expected, ignoreCase, ignoreAccent) {
if (ignoreAccent) {
actual = DataUtil.ignoreDiacritics(actual);
expected = DataUtil.ignoreDiacritics(expected);
return actual <= expected;
},
/**
* Returns true when the actual input is greater than or equal to the given input.
* @param {string|number|boolean} actual
* @param {string|number|boolean} expected
* @param {boolean} ignoreCase?
*/
greaterthanorequal: function (actual, expected, ignoreCase) {
if (ignoreCase) {
return DataUtil.toLowerCase(actual) >= DataUtil.toLowerCase(expected);
}
return actual >= expected;
},
/**
* Returns true when the actual input contains the given string.
* @param {string|number} actual
* @param {string|number} expected
* @param {boolean} ignoreCase?
*/
contains: function (actual, expected, ignoreCase, ignoreAccent) {
if (ignoreAccent) {
actual = DataUtil.ignoreDiacritics(actual);
expected = DataUtil.ignoreDiacritics(expected);
}
if (ignoreCase) {
return !isNullOrUndefined(actual) && !isNullOrUndefined(expected) &&
DataUtil.toLowerCase(actual).indexOf(DataUtil.toLowerCase(expected)) !== -1;
}
return !isNullOrUndefined(actual) && !isNullOrUndefined(expected) &&
actual.toString().indexOf(expected) !== -1;
},
/**
* Returns true when the given input value is not null.
* @param {string|number} actual
* @returns boolean
*/
notnull: function (actual) {
return actual !== null;
},
/**
* Returns true when the given input value is null.
* @param {string|number} actual
* @returns boolean
*/
isnull: function (actual) {
return actual === null;
},
/**
* Returns true when the actual input starts with the given string
* @param {string} actual
* @param {string} expected
* @param {boolean} ignoreCase?
*/
startswith: function (actual, expected, ignoreCase, ignoreAccent) {
if (ignoreAccent) {
actual = DataUtil.ignoreDiacritics(actual);
expected = DataUtil.ignoreDiacritics(expected);
}
if (ignoreCase) {
return actual && expected && DataUtil.startsWith(DataUtil.toLowerCase(actual), DataUtil.toLowerCase(expected));
}
return actual && expected && DataUtil.startsWith(actual, expected);
},
/**
* Returns true when the actual input ends with the given string.
* @param {string} actual
* @param {string} expected
* @param {boolean} ignoreCase?
*/
endswith: function (actual, expected, ignoreCase, ignoreAccent) {
if (ignoreAccent) {
actual = DataUtil.ignoreDiacritics(actual);
expected = DataUtil.ignoreDiacritics(expected);
}
if (ignoreCase) {
return actual && expected && DataUtil.endsWith(DataUtil.toLowerCase(actual), DataUtil.toLowerCase(expected));
}
return actual && expected && DataUtil.endsWith(actual, expected);
},
/**
* It will return the filter operator based on the filter symbol.
* @param {string} operator
* @hidden
*/
processSymbols: function (operator) {
var fnName = DataUtil.operatorSymbols[operator];
if (fnName) {
var fn = DataUtil.fnOperators[fnName];
return fn;
}
return DataUtil.throwError('Query - Process Operator : Invalid operator');
},
/**
* It will return the valid filter operator based on the specified operators.
* @param {string} operator
* @hidden
*/
processOperator: function (operator) {
var fn = DataUtil.fnOperators[operator];
if (fn) {
return fn;
}
return DataUtil.fnOperators.processSymbols(operator);
}
};
/**
* To perform the parse operation on JSON data, like convert to string from JSON or convert to JSON from string.
*/
DataUtil.parse = {
/**
* Parse the given string to the plain JavaScript object.
* @param {string|Object|Object[]} jsonText
*/
parseJson: function (jsonText) {
if (typeof jsonText === 'string') {
jsonText = JSON.parse(jsonText, DataUtil.parse.jsonReviver);
}
else if (jsonText instanceof Array) {
DataUtil.parse.iterateAndReviveArray(jsonText);
}
else if (typeof jsonText === 'object') {
DataUtil.parse.iterateAndReviveJson(jsonText);
}
return jsonText;
},
/**
* It will perform on array of values.
* @param {string[]|Object[]} array
* @hidden
*/
iterateAndReviveArray: function (array) {
for (var i = 0; i < array.length; i++) {
if (typeof array[i] === 'object') {
DataUtil.parse.iterateAndReviveJson(array[i]);
}
if (ignoreCase) {
return DataUtil.toLowerCase(actual) === DataUtil.toLowerCase(expected);
else if (typeof array[i] === 'string' && !/^[\s]*\[|^[\s]*\{|\"/g.test(array[i])) {
array[i] = DataUtil.parse.jsonReviver('', array[i]);
}
return actual === expected;
},
notequal: function (actual, expected, ignoreCase, ignoreAccent) {
if (ignoreAccent) {
actual = DataUtil.ignoreDiacritics(actual);
expected = DataUtil.ignoreDiacritics(expected);
else {
array[i] = DataUtil.parse.parseJson(array[i]);
}
return !DataUtil.fnOperators.equal(actual, expected, ignoreCase);
},
lessthan: function (actual, expected, ignoreCase) {
if (ignoreCase) {
return DataUtil.toLowerCase(actual) < DataUtil.toLowerCase(expected);
}
return actual < expected;
},
greaterthan: function (actual, expected, ignoreCase) {
if (ignoreCase) {
return DataUtil.toLowerCase(actual) > DataUtil.toLowerCase(expected);
}
return actual > expected;
},
lessthanorequal: function (actual, expected, ignoreCase) {
if (ignoreCase) {
return DataUtil.toLowerCase(actual) <= DataUtil.toLowerCase(expected);
}
return actual <= expected;
},
greaterthanorequal: function (actual, expected, ignoreCase) {
if (ignoreCase) {
return DataUtil.toLowerCase(actual) >= DataUtil.toLowerCase(expected);
}
return actual >= expected;
},
contains: function (actual, expected, ignoreCase, ignoreAccent) {
if (ignoreAccent) {
actual = DataUtil.ignoreDiacritics(actual);
expected = DataUtil.ignoreDiacritics(expected);
}
if (ignoreCase) {
return !ej2_base_1.isNullOrUndefined(actual) && !ej2_base_1.isNullOrUndefined(expected) &&
DataUtil.toLowerCase(actual).indexOf(DataUtil.toLowerCase(expected)) !== -1;
}
return !ej2_base_1.isNullOrUndefined(actual) && !ej2_base_1.isNullOrUndefined(expected) &&
actual.toString().indexOf(expected) !== -1;
},
notnull: function (actual) {
return actual !== null;
},
isnull: function (actual) {
return actual === null;
},
startswith: function (actual, expected, ignoreCase, ignoreAccent) {
if (ignoreAccent) {
actual = DataUtil.ignoreDiacritics(actual);
expected = DataUtil.ignoreDiacritics(expected);
}
if (ignoreCase) {
return actual && expected && DataUtil.startsWith(DataUtil.toLowerCase(actual), DataUtil.toLowerCase(expected));
}
return actual && expected && DataUtil.startsWith(actual, expected);
},
endswith: function (actual, expected, ignoreCase, ignoreAccent) {
if (ignoreAccent) {
actual = DataUtil.ignoreDiacritics(actual);
expected = DataUtil.ignoreDiacritics(expected);
}
if (ignoreCase) {
return actual && expected && DataUtil.endsWith(DataUtil.toLowerCase(actual), DataUtil.toLowerCase(expected));
}
return actual && expected && DataUtil.endsWith(actual, expected);
},
processSymbols: function (operator) {
var fnName = DataUtil.operatorSymbols[operator];
if (fnName) {
var fn = DataUtil.fnOperators[fnName];
return fn;
}
return DataUtil.throwError('Query - Process Operator : Invalid operator');
},
processOperator: function (operator) {
var fn = DataUtil.fnOperators[operator];
if (fn) {
return fn;
}
return DataUtil.fnOperators.processSymbols(operator);
}
};
DataUtil.parse = {
parseJson: function (jsonText) {
if (typeof jsonText === 'string') {
jsonText = JSON.parse(jsonText, DataUtil.parse.jsonReviver);
},
/**
* It will perform on JSON values
* @param {JSON} json
* @hidden
*/
iterateAndReviveJson: function (json) {
var value;
var keys = Object.keys(json);
for (var _i = 0, keys_2 = keys; _i < keys_2.length; _i++) {
var prop = keys_2[_i];
if (DataUtil.startsWith(prop, '__')) {
continue;
}
else if (jsonText instanceof Array) {
DataUtil.parse.iterateAndReviveArray(jsonText);
}
else if (typeof jsonText === 'object') {
DataUtil.parse.iterateAndReviveJson(jsonText);
}
return jsonText;
},
iterateAndReviveArray: function (array) {
for (var i = 0; i < array.length; i++) {
if (typeof array[i] === 'object') {
DataUtil.parse.iterateAndReviveJson(array[i]);
value = json[prop];
if (typeof value === 'object') {
if (value instanceof Array) {
DataUtil.parse.iterateAndReviveArray(value);
}
else if (typeof array[i] === 'string' && !/^[\s]*\[|^[\s]*\{|\"/g.test(array[i])) {
array[i] = DataUtil.parse.jsonReviver('', array[i]);
else if (value) {
DataUtil.parse.iterateAndReviveJson(value);
}
else {
array[i] = DataUtil.parse.parseJson(array[i]);
}
}
},
iterateAndReviveJson: function (json) {
var value;
var keys = Object.keys(json);
for (var _i = 0, keys_2 = keys; _i < keys_2.length; _i++) {
var prop = keys_2[_i];
if (DataUtil.startsWith(prop, '__')) {
continue;
}
value = json[prop];
if (typeof value === 'object') {
if (value instanceof Array) {
DataUtil.parse.iterateAndReviveArray(value);
}
else if (value) {
DataUtil.parse.iterateAndReviveJson(value);
}
}
else {
json[prop] = DataUtil.parse.jsonReviver(json[prop], value);
}
else {
json[prop] = DataUtil.parse.jsonReviver(json[prop], value);
}
},
jsonReviver: function (field, value) {
var dupValue = value;
if (typeof value === 'string') {
var ms = /^\/Date\(([+-]?[0-9]+)([+-][0-9]{4})?\)\/$/.exec(value);
if (ms) {
return DataUtil.dateParse.toTimeZone(new Date(parseInt(ms[1], 10)), DataUtil.serverTimezoneOffset, true);
}
else if (/^(\d{4}\-\d\d\-\d\d([tT][\d:\.]*){1})([zZ]|([+\-])(\d\d):?(\d\d))?$/.test(value)) {
var arr = dupValue.split(/[^0-9]/);
value = DataUtil.dateParse
.toTimeZone(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)), DataUtil.serverTimezoneOffset, true);
}
}
},
/**
* It will perform on JSON values
* @param {string} field
* @param {string|Date} value
* @hidden
*/
jsonReviver: function (field, value) {
var dupValue = value;
if (typeof value === 'string') {
var ms = /^\/Date\(([+-]?[0-9]+)([+-][0-9]{4})?\)\/$/.exec(value);
if (ms) {
return DataUtil.dateParse.toTimeZone(new Date(parseInt(ms[1], 10)), DataUtil.serverTimezoneOffset, true);
}
return value;
},
isJson: function (jsonData) {
if (typeof jsonData[0] === 'string') {
return jsonData;
else if (/^(\d{4}\-\d\d\-\d\d([tT][\d:\.]*){1})([zZ]|([+\-])(\d\d):?(\d\d))?$/.test(value)) {
var arr = dupValue.split(/[^0-9]/);
value = DataUtil.dateParse
.toTimeZone(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)), DataUtil.serverTimezoneOffset, true);
}
return DataUtil.parse.parseJson(jsonData);
},
isGuid: function (value) {
var regex = /[A-Fa-f0-9]{8}(?:-[A-Fa-f0-9]{4}){3}-[A-Fa-f0-9]{12}/i;
var match = regex.exec(value);
return match != null;
},
replacer: function (value, stringify) {
if (DataUtil.isPlainObject(value)) {
return DataUtil.parse.jsonReplacer(value, stringify);
}
return value;
},
/**
* Check wheather the given value is JSON or not.
* @param {Object[]} jsonData
*/
isJson: function (jsonData) {
if (typeof jsonData[0] === 'string') {
return jsonData;
}
return DataUtil.parse.parseJson(jsonData);
},
/**
* Checks wheather the given value is GUID or not.
* @param {string} value
*/
isGuid: function (value) {
var regex = /[A-Fa-f0-9]{8}(?:-[A-Fa-f0-9]{4}){3}-[A-Fa-f0-9]{12}/i;
var match = regex.exec(value);
return match != null;
},
/**
* The method used to replace the value based on the type.
* @param {Object} value
* @param {boolean} stringify
* @hidden
*/
replacer: function (value, stringify) {
if (DataUtil.isPlainObject(value)) {
return DataUtil.parse.jsonReplacer(value, stringify);
}
if (value instanceof Array) {
return DataUtil.parse.arrayReplacer(value);
}
if (value instanceof Date) {
return DataUtil.parse.jsonReplacer({ val: value }, stringify).val;
}
return value;
},
/**
* It will replace the JSON value.
* @param {string} key
* @param {Object} val
* @hidden
*/
jsonReplacer: function (val, stringify) {
var value;
var keys = Object.keys(val);
for (var _i = 0, keys_3 = keys; _i < keys_3.length; _i++) {
var prop = keys_3[_i];
value = val[prop];
if (!(value instanceof Date)) {
continue;
}
if (value instanceof Array) {
return DataUtil.parse.arrayReplacer(value);
var d = value;
val[prop] = DataUtil.dateParse.toTimeZone(DataUtil.dateParse.addSelfOffset(d), DataUtil.serverTimezoneOffset).toJSON();
}
return val;
},
/**
* It will replace the Array of value.
* @param {string} key
* @param {Object[]} val
* @hidden
*/
arrayReplacer: function (val) {
for (var i = 0; i < val.length; i++) {
if (DataUtil.isPlainObject(val[i])) {
val[i] = DataUtil.parse.jsonReplacer(val[i]);
}
if (value instanceof Date) {
return DataUtil.parse.jsonReplacer({ val: value }, stringify).val;
else if (val[i] instanceof Date) {
val[i] = DataUtil.parse.jsonReplacer({ date: val[i] }).date;
}
return value;
},
jsonReplacer: function (val, stringify) {
var value;
var keys = Object.keys(val);
for (var _i = 0, keys_3 = keys; _i < keys_3.length; _i++) {
var prop = keys_3[_i];
value = val[prop];
if (!(value instanceof Date)) {
continue;
}
var d = value;
val[prop] = DataUtil.dateParse.toTimeZone(DataUtil.dateParse.addSelfOffset(d), DataUtil.serverTimezoneOffset).toJSON();
}
return val;
},
arrayReplacer: function (val) {
for (var i = 0; i < val.length; i++) {
if (DataUtil.isPlainObject(val[i])) {
val[i] = DataUtil.parse.jsonReplacer(val[i]);
}
else if (val[i] instanceof Date) {
val[i] = DataUtil.parse.jsonReplacer({ date: val[i] }).date;
}
}
return val;
}
};
DataUtil.dateParse = {
addSelfOffset: function (input) {
return new Date(+input - (input.getTimezoneOffset() * 60000));
},
toUTC: function (input) {
return new Date(+input + (input.getTimezoneOffset() * 60000));
},
toTimeZone: function (input, offset, utc) {
if (offset === null) {
return input;
}
var unix = utc ? DataUtil.dateParse.toUTC(input) : input;
return new Date(+unix - (offset * 3600000));
return val;
}
};
/**
* @hidden
*/
DataUtil.dateParse = {
addSelfOffset: function (input) {
return new Date(+input - (input.getTimezoneOffset() * 60000));
},
toUTC: function (input) {
return new Date(+input + (input.getTimezoneOffset() * 60000));
},
toTimeZone: function (input, offset, utc) {
if (offset === null) {
return input;
}
};
return DataUtil;
}());
exports.DataUtil = DataUtil;
});
var unix = utc ? DataUtil.dateParse.toUTC(input) : input;
return new Date(+unix - (offset * 3600000));
}
};
return DataUtil;
}());
export { DataUtil };

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

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

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc