@syncfusion/ej2-angular-base
Advanced tools
@@ -0,2 +1,11 @@ | ||
| /*! | ||
| * filename: ej2-angular-base.umd.min.js | ||
| * version : 32.1.24 | ||
| * Copyright Syncfusion Inc. 2001 - 2025. 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"),require("@angular/core")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base","@angular/core"],t):t((e=e||self).ej={},e.ej2Base,e.core)}(this,function(e,E,o){"use strict";function n(n,e){e.forEach(function(t){Object.getOwnPropertyNames(t.prototype).forEach(function(e){(!Object.prototype.hasOwnProperty.call(n.prototype,e)||t.isFormBase&&"constructor"!==e)&&(n.prototype["".concat(e)]=t.prototype["".concat(e)])})})}function t(e,t,n){var i={};if(e&&e.length){for(var r=0,s=e;r<s.length;r++){var a=s[r];!0===n?(t.propCollection["".concat(a)]=new o.EventEmitter(!1),t["".concat(a)]=t.propCollection["".concat(a)]):i["".concat(a)]=new o.EventEmitter(!1)}!0!==n&&t.setProperties(i,!0)}}function i(e,n,t){var i,r=Object.keys(e.registeredTemplate);if(r.length)for(var s=n&&n.filter(function(e){return!/\./g.test(e)}),a=/tab|accordion|toolbar/.test(null==(i=e.getModuleName)?void 0:i.call(e)),o=0,l=s||r;o<l.length;o++){var p=l[o];if(t&&t.length)for(var c=0;c<t.length;c++)if(a)for(var h=0;h<e.registeredTemplate["".concat(p)].length;h++)(g=e.registeredTemplate["".concat(p)][parseInt(h.toString(),10)])&&g===t["".concat(c)]&&(g.destroy(),e.registeredTemplate["".concat(p)].splice(h,1));else for(var g,h=0;h<e.registeredTemplate.template.length;h++)(g=e.registeredTemplate.template[parseInt(h.toString(),10)].rootNodes[0])===t["".concat(c)]&&(u=e.registeredTemplate["".concat(p)])[parseInt(h.toString(),10)].destroy();else if(e.registeredTemplate["".concat(p)])for(var u,f=0,d=e.registeredTemplate["".concat(p)];f<d.length;f++)if(!(u=d[f]).destroyed){if(u._view){var v=u._view.renderer.parentNode(u.rootNodes[0]);if(!E.isNullOrUndefined(v))for(h=0;h<u.rootNodes.length;h++)v.appendChild(u.rootNodes[parseInt(h.toString(),10)])}u.destroy()}a&&t||delete e.registeredTemplate["".concat(p)]}for(var m=0,y=e.tagObjects;m<y.length;m++)!function(t){t.instance&&t.instance.clearTemplate(n&&n.filter(function(e){return!!new RegExp(t.name).test(e)}))}(y[m])}var r=/Ref$/,s=(a.prototype.ngOnInit=function(){this.registeredTemplate={};for(var e=0,t=this.tags;e<t.length;e++){var n=t[e],i=E.getValue("child"+n.substring(0,1).toUpperCase()+n.substring(1),this);i&&this.tagObjects.push({instance:i,name:n})}for(var r=Object.keys(this),s=0;s<r.length;s++){var a=E.getValue(r[parseInt(s.toString(),10)],this);"object"==typeof a&&a&&a.elementRef&&(E.getValue(-1!==r[parseInt(s.toString(),10)].indexOf("Ref")?r[parseInt(s.toString(),10)]:r[parseInt(s.toString(),10)]+"Ref",this)||E.setValue(-1!==r[parseInt(s.toString(),10)].indexOf("Ref")?r[parseInt(s.toString(),10)]:r[parseInt(s.toString(),10)]+"Ref",a,this),!E.getValue("viewContainerRef",this)||E.getValue("_viewContainerRef",a.elementRef.nativeElement)||E.getValue("propName",a.elementRef.nativeElement)||(E.setValue("_viewContainerRef",E.getValue("viewContainerRef",this),a.elementRef.nativeElement),E.setValue("propName",r[parseInt(s.toString(),10)].replace("Ref",""),a.elementRef.nativeElement)))}for(var o=0,l=r=(r=Object.keys(this)).filter(function(e){return/Ref$/i.test(e)});o<l.length;o++){var p=l[o].replace("Ref","");E.setValue(p.replace("_","."),E.getValue(p,this),this.propCollection)}var c=Object.keys(this);if(this.directivePropList){for(var h=0;h<this.directivePropList.length;h++){var g=this.directivePropList[parseInt(h.toString(),10)];-1===c.indexOf(g)||!1!==E.getValue(g,this)&&!E.getValue(g,this)||E.setValue(g,E.getValue(g,this),this.propCollection)}this.hasChanges=!0}this.isInitChanges=!0},a.prototype.registerEvents=function(e){t(e,this,!0)},a.prototype.ngOnChanges=function(e){for(var t=0,n=Object.keys(e);t<n.length;t++){var i=n[t],r=e["".concat(i)];this.propCollection["".concat(i)]=r.currentValue}this.isUpdated=!1,this.hasChanges=!0},a.prototype.clearTemplate=function(e){i(this,e)},a.prototype.getProperties=function(){for(var e=0,t=this.tagObjects;e<t.length;e++){var n=t[e];this.propCollection[n.name]=n.instance.getProperties()}return this.propCollection},a.prototype.isChanged=function(){var e=this.hasChanges;if(!E.isNullOrUndefined(this.propCollection[this.property]))for(var t,n,i=this.propCollection[this.property],r=Object.keys(i[0]),s=0;s<r.length;s++)E.isNullOrUndefined(this.propCollection[r[parseInt(s.toString(),10)]])||(t=E.getValue(r[parseInt(s.toString(),10)],this),n=this.propCollection[this.property][0][r[parseInt(s.toString(),10)]],E.isNullOrUndefined(t))||this.propCollection[r[parseInt(s.toString(),10)]]===t||n===t||(E.setValue(r[parseInt(s.toString(),10)],t,this.propCollection[this.property][0]),E.setValue(r[parseInt(s.toString(),10)],t,this.propCollection),this.hasChanges=!0,this.isUpdated=!1);for(var a=0,o=this.tagObjects;a<o.length;a++)var l=o[a],e=e||l.instance.hasChanges;return e||this.hasChanges},a.prototype.ngAfterContentChecked=function(){if(this.hasChanges=this.isChanged(),this.isInitChanges||this.hasChanges)for(var e=0,t=Object.keys(this).filter(function(e){return r.test(e)});e<t.length;e++){var n=t[e].replace("Ref","");E.setValue(n.replace("_","."),E.getValue(n,this),this.propCollection)}},a.prototype.ngAfterViewChecked=function(){this.isUpdated&&(this.hasChanges=!1)},a.prototype.ngAfterViewInit=function(){this.isInitChanges=!1},a.prototype.ngOnDestroy=function(){this.directivePropList=[]},a);function a(){this.hasChanges=!1,this.propCollection={},this.dataSource={},this.tags=[],this.tagObjects=[]}p.prototype.ngOnInit=function(){this.isInitChanges=!0},p.prototype.ngAfterContentInit=function(){var t=this,n=0;this.list=this.children.map(function(e){return e.dirIndex=n++,e.property=t.propertyName,e}),this.hasChanges=!0},p.prototype.getProperties=function(){for(var e=[],t=0,n=this.list;t<n.length;t++){var i=n[t];e.push(i.getProperties())}return e},p.prototype.isChanged=function(){var t=this,e=!1,n=0,i=!1,r=this.children.map(function(e){return e});if(this.list.length===this.children.length)for(var s=0;s<this.list.length;s++)this.list[parseInt(s.toString(),10)].propCollection.dataSource&&(this.list[parseInt(s.toString(),10)].dataSource&&this.list[parseInt(s.toString(),10)].propCollection.dataSource!==this.list[parseInt(s.toString(),10)].dataSource&&(this.list[parseInt(s.toString(),10)].propCollection.dataSource=this.list[parseInt(s.toString(),10)].dataSource,this.list[parseInt(s.toString(),10)].hasChanges=!0),"series"!==this.list[parseInt(s.toString(),10)].property)&&(i=JSON.stringify(this.list[parseInt(s.toString(),10)].propCollection.dataSource)!==JSON.stringify(r[parseInt(s.toString(),10)].propCollection.dataSource)),i=this.list[parseInt(s.toString(),10)].hasChanges!==r[parseInt(s.toString(),10)].hasChanges;this.hasNewChildren=!(this.list.length===this.children.length&&!i)||null,this.hasNewChildren&&(this.list=this.children.map(function(e){return e.dirIndex=n++,e.property=t.propertyName,e}));for(var a=0,o=this.list;a<o.length;a++)var l=o[a],e=e||l.hasChanges;return!!this.list.length&&e},p.prototype.clearTemplate=function(e){for(var t=this,n=0,i=this.list;n<i.length;n++)i[n].clearTemplate(e&&e.map(function(e){return new RegExp(t.propertyName).test(e)?e.replace(t.propertyName+".",""):e}))},p.prototype.ngAfterContentChecked=function(){this.hasChanges=this.isChanged();for(var e=0;e<this.list.length;e++)E.getValue("childColumns",this.list[parseInt(e.toString(),10)])&&"columns"===E.getValue("property",this.list[parseInt(e.toString(),10)])&&E.setValue("columns",E.getValue("childColumns",this.list[parseInt(e.toString(),10)]).getProperties(),this.list[parseInt(e.toString(),10)].propCollection),this.list[parseInt(e.toString(),10)].isUpdated=!0},p.prototype.ngAfterViewInit=function(){this.isInitChanges=!1},p.prototype.ngOnDestroy=function(){this.list=[]};var l=p;function p(e){this.list=[],this.hasChanges=!1,this.propertyName=e}h.prototype.saveChanges=function(e,t,n){var i;this.isProtectedOnChange||(this.oldProperties["".concat(e)]=n,this.changedProperties["".concat(e)]=t,this.finalUpdate(),i=setTimeout(this.dataBind.bind(this)),this.finalUpdate=function(){clearTimeout(i)})},h.prototype.ngOnInit=function(e){var n=e||this;n.registeredTemplate={},n.ngBoundedEvents={},n.isAngular=!0,n.isFormInit=!0,e&&(this.tags=e.tags),n.tags=this.tags||[],n.complexTemplate=this.complexTemplate||[],n.tagObjects=[],n.ngAttr=this.getAngularAttr(n.element),n.createElement=function(e,t){e=(n.srenderer||E).createElement(e);return void 0!==t&&(e.innerHTML=t.innerHTML||"",void 0!==t.className&&(e.className=t.className),void 0!==t.id&&(e.id=t.id),void 0!==t.styles&&e.setAttribute("style",t.styles),void 0!==n.ngAttr&&e.setAttribute(n.ngAttr,""),void 0!==t.attrs)&&E.attributes(e,t.attrs),e};for(var t=0,i=n.tags;t<i.length;t++){var r=i[t],r={instance:E.getValue("child"+r.substring(0,1).toUpperCase()+r.substring(1),n),name:r};n.tagObjects.push(r)}for(var s=Object.keys(n),a=0;a<s.length;a++){var o=E.getValue(s[parseInt(a.toString(),10)],n);"object"==typeof o&&o&&o.elementRef&&("object"==typeof o&&o&&o.elementRef&&-1!==s[parseInt(a.toString(),10)].indexOf("_")&&-1===s[parseInt(a.toString(),10)].indexOf("Ref")&&E.setValue(s[parseInt(a.toString(),10)]+"Ref",o,n),!n.viewContainerRef||E.getValue("_viewContainerRef",o.elementRef.nativeElement)||E.getValue("propName",o.elementRef.nativeElement)||(E.setValue("_viewContainerRef",n.viewContainerRef,o.elementRef.nativeElement),E.setValue("propName",s[parseInt(a.toString(),10)].replace("Ref",""),o.elementRef.nativeElement)))}for(var l=0,p=s=(s=Object.keys(n)).filter(function(e){return/Ref$/i.test(e)&&/_/i.test(e)});l<p.length;l++){var c=p[l].replace("Ref",""),h={};E.setValue(c.replace("_","."),E.getValue(c,n),h),n.setProperties(h,!0)}},h.prototype.getAngularAttr=function(e){for(var t,n=e.attributes,i=n.length,r=0;r<i;r++)/_ngcontent/g.test(n[parseInt(r.toString(),10)].name)&&(t=n[parseInt(r.toString(),10)].name);return t},h.prototype.ngAfterViewInit=function(e){var t=e||this;/ejs-tab|ejs-accordion/g.test(t.ngEle.nativeElement.outerHTML)&&(t.ngEle.nativeElement.style.visibility="hidden");for(var e=(e=Object.keys(t)).filter(function(e){return/Ref$/i.test(e)}),n="DocumentEditor"===t.getModuleName(),i=0,r=e;i<r.length;i++){var s=r[i].replace("Ref","");E.setValue(s.replace("_","."),E.getValue(s+"Ref",t),t)}function a(e){"undefined"!=typeof window&&e.element&&(e.appendTo(e.element),e.ngEle.nativeElement.style.visibility="")}n||t.getModuleName().includes("btn")?a(t):setTimeout(function(){a(t)})},h.prototype.ngOnDestroy=function(e){var l=e||this;setTimeout(function(){var e;"undefined"!=typeof window&&l.element.classList.contains("e-control")&&(void 0!==l.ngOnFocus&&void 0!==l.ngOnBlur&&((e=l.inputElement||l.element).removeEventListener("focus",l.ngOnFocusBound),e.removeEventListener("blur",l.ngOnBlurBound),l.ngOnFocusBound=null,l.ngOnBlurBound=null),l.destroy(),l.clearTemplate(null),setTimeout(function(){for(var e=0,t=Object.keys(l);e<t.length;e++){var n=t[e],i=l["".concat(n)];if(i&&/object/.test(typeof i)&&0!==Object.keys(i).length)if(/properties|changedProperties|childChangedProperties|oldProperties|moduleLoader/.test(n))for(var r=0,s=Object.keys(l["".concat(n)]);r<s.length;r++){var a=s[r],o=i["".concat(a)];o&&/object/.test(typeof o)&&0!==Object.keys(o).length&&(o.parent||o.parentObj)&&(l["".concat(n)]["".concat(a)]=null)}else(i.parent||i.parentObj)&&(l["".concat(n)]=null)}}))})},h.prototype.clearTemplate=function(e,t){i(this,e,t)},h.prototype.ngAfterContentChecked=function(e){for(var t=e||this,n=0,i=t.tagObjects;n<i.length;n++){var r=i[n];if(!E.isUndefined(r.instance)&&(r.instance.isInitChanges||r.instance.hasChanges||r.instance.hasNewChildren)){var s={};if(r.instance.isInitChanges){var a=void 0,o=((f=E.getValue("instance.list",r))&&f.length&&(a=f[0].directivePropList),!0);if(t.getModuleName&&"gantt"===t.getModuleName()&&(o=!1),a&&o&&-1===a.indexOf(r.instance.propertyName))for(var l=Object.keys(r.instance.list[0].propCollection),p=0;p<r.instance.list.length;p++){r.instance.list["".concat(p)].propCollection[r.instance.propertyName]=[];for(var c={},h=0;h<l.length;h++){var g=l[parseInt(h.toString(),10)];c["".concat(g)]=r.instance.list["".concat(p)].propCollection["".concat(g)]}for(var u=0;u<r.instance.list["".concat(p)].tags.length;u++)!function(e){var t,a,e=r.instance.list["".concat(p)].tags[parseInt(e.toString(),10)],n=E.getValue("child"+e.substring(0,1).toUpperCase()+e.substring(1),r.instance.list["".concat(p)]);n&&(t=r.instance.list["".concat(p)]["child"+e.substring(0,1).toUpperCase()+e.substring(1)],(a=function(e){var t=[];if(e)for(var n=0;n<e.list.length;n++){var i,r=e.list[0].tags[0];r&&(i=E.getValue("child"+r.substring(0,1).toUpperCase()+r.substring(1),e.list[parseInt(n.toString(),10)]))&&(e.list[parseInt(n.toString(),10)].tagObjects.push({instance:i,name:r}),t.push(i))}if(0!==t.length)for(var s=0;s<t.length;s++)a(t[parseInt(s.toString(),10)])})(t),r.instance.list["".concat(p)].tagObjects.push({instance:n,name:e}))}(u);r.instance.list["".concat(p)].propCollection[r.instance.propertyName].push(c)}s[r.name]=r.instance.getProperties(),t.setProperties(s,r.instance.isInitChanges)}else{o=!1;t[r.name].length===r.instance.list.length&&!/diagram|DashboardLayout/.test(t.getModuleName())||(t[r.name]=r.instance.list,o=!0);for(var f,d=0,v=r.instance.list;d<v.length;d++){if((f=v[d]).tags)for(var m=0,y=f.tags;m<y.length;m++){var C=y[m],b=E.getValue("child"+C.substring(0,1).toUpperCase()+C.substring(1),f);b&&f.tagObjects.push({instance:b,name:C})}var O=r.instance.list.indexOf(f),V=E.getValue(r.name,t)["".concat(O)],O=(O=Object.keys(V)).filter(function(e){return/Ref$/i.test(e)});if(V.properties&&0!==Object.keys(V.properties).length)for(var I=0,S=O;I<S.length;I++)g=(g=S[I]).replace(/Ref/,""),V.properties["".concat(g)]=(V.properties["".concat(g)]?V.properties:V.propCollection)["".concat(g)];E.isUndefined(V)||E.isUndefined(V.setProperties)||(/diagram|DashboardLayout/.test(t.getModuleName())?V.setProperties(f.getProperties(),!0):V.setProperties(f.getProperties())),f.isUpdated=!0}(/grid/.test(t.getModuleName())&&o||/chart/.test(t.getModuleName()))&&(s[r.name]=r.instance.getProperties(),t.setProperties(s,r.instance.isInitChanges))}}}},h.prototype.registerEvents=function(e){t(e,this)},h.prototype.twoWaySetter=function(e,t){var n=E.getValue(t,this.properties);n!==e&&(this.saveChanges(t,e,n),E.setValue(t,E.isNullOrUndefined(e)?null:e,this.properties),E.getValue(t+"Change",this).emit(e))},h.prototype.addTwoWay=function(e){for(var n=this,i=this,t=0,r=e;t<r.length;t++)!function(t){E.getValue(t,i),Object.defineProperty(i,t,{get:function(){return E.getValue(t,n.properties)},set:function(e){return n.twoWaySetter(e,t)}}),E.setValue(t+"Change",new o.EventEmitter,i)}(r[t])},h.prototype.addEventListener=function(e,t){var n=E.getValue(e,this);E.isUndefined(n)||(this.ngBoundedEvents["".concat(e)]||(this.ngBoundedEvents["".concat(e)]=new Map),this.ngBoundedEvents["".concat(e)].set(t,n.subscribe(t)))},h.prototype.removeEventListener=function(e,t){var n=E.getValue(e,this);E.isUndefined(n)||this.ngBoundedEvents["".concat(e)].get(t).unsubscribe()},h.prototype.trigger=function(e,t,n){var i=E.getValue(e,this),r=this.isProtectedOnChange,i=(this.isProtectedOnChange=!1,t&&(t.name=e),E.isUndefined(i)||i.next(t),E.getValue("local"+e.charAt(0).toUpperCase()+e.slice(1),this));E.isUndefined(i)||i.call(this,t),this.isProtectedOnChange=r,n&&(this.preventChange=this.isPreventChange,n.call(this,t)),this.isPreventChange=!1};var c=h;function h(){this.isProtectedOnChange=!0,this.isFormInit=!0}u.prototype.propagateChange=function(e){},u.prototype.propagateTouch=function(){},u.prototype.localChange=function(e){e=void 0===e.checked?e.value:e.checked;this.objCheck=E.isObject(e),!0===this.isUpdated&&(this.angularValue=this.oldValue),!0===this.objCheck?(this.duplicateValue=JSON.stringify(e),this.duplicateAngularValue=JSON.stringify(this.angularValue),this.duplicateValue!==this.duplicateAngularValue&&void 0!==this.propagateChange&&void 0!==e&&(this.propagateChange(e),this.angularValue=e)):e!==this.angularValue&&void 0!==this.propagateChange&&void 0!==e&&(this.propagateChange(e),this.angularValue=e),this.cdr.markForCheck()},u.prototype.registerOnChange=function(e){this.propagateChange=e},u.prototype.registerOnTouched=function(e){this.propagateTouch=e},u.prototype.twoWaySetter=function(e,t){var n=this.oldValue||E.getValue(t,this.properties),i=this.inputElement||this.element;i&&n===e&&this.value===e&&(void 0===i.value||""===i.value)||(this.saveChanges(t,e,n),E.setValue(t,E.isNullOrUndefined(e)?null:e,this.properties),E.getValue(t+"Change",this).emit(e))},u.prototype.ngAfterViewInit=function(e){var t=e||this;t.ngOnBlurBound=this.ngOnBlur.bind(this),t.ngOnFocusBound=this.ngOnFocus.bind(this),"undefined"!=typeof window&&(t.getModuleName().includes("dropdowntree")?setTimeout(function(){t.appendTo(t.element)}):t.appendTo(t.element),(e=t.inputElement||t.element).addEventListener("focus",t.ngOnFocusBound),e.addEventListener("blur",t.ngOnBlurBound)),this.isFormInit=!1},u.prototype.setDisabledState=function(e){this.enabled=!e,this.disabled=e},u.prototype.writeValue=function(e){void 0===this.checked?this.value=e:this.ngEle&&("boolean"!=typeof e||/ejs-radiobutton/g.test(this.ngEle.nativeElement.outerHTML)?this.checked=e===this.value:this.checked=e);var t=null==this.angularValue;this.angularValue=e,this.isUpdated=!0,this.preventChange=!this.isFormInit,this.cdr.markForCheck(),null===e&&t&&(this.preventChange=!1)},u.prototype.ngOnFocus=function(e){!0!==this.skipFromEvent&&this.focus.emit(e),this.cdr.markForCheck()},u.prototype.ngOnBlur=function(e){this.propagateTouch(),!0!==this.skipFromEvent&&this.blur.emit(e),this.cdr.markForCheck()},u.isFormBase=!0;var g=u;function u(){}var f=E.getTemplateEngine();function d(r,e){var s,a;return"string"==typeof r||"function"==typeof r&&r.prototype&&r.prototype.CSPTemplate?f(r,e):(s=r.elementRef.nativeElement._viewContainerRef,a=r.elementRef.nativeElement.propName,function(e,t,n){var i=s||t.viewContainerRef,e=i.createEmbeddedView(r,{$implicit:e}),i=(/EJS-MENTION|EJS-DROPDOWNLIST/.test(E.getValue("currentInstance.element.nodeName",i))||/E-TABITEM/.test(E.getValue("element.nativeElement.nodeName",i))&&E.getValue("currentInstance.headerTemplateRef",i)?e.detectChanges():e.markForCheck(),t&&t.registeredTemplate?t.registeredTemplate:E.getValue("currentInstance.registeredTemplate",i));return n=n&&t.registeredTemplate?n:a,void 0===i["".concat(n)]&&(i["".concat(n)]=[]),i["".concat(n)].push(e),e.rootNodes})}E.setTemplateEngine({compile:d}),e.ArrayBase=l,e.ComplexBase=s,e.ComponentBase=c,e.ComponentMixins=function(t){return function(e){n(e,t)}},e.FormBase=g,e.Template=function(a){return function(e,t){var n,i,r,s={set:function(e){void 0!==e&&(E.setValue(r+"Ref",e,this),"string"==typeof e||"function"==typeof e&&e.prototype&&e.prototype.CSPTemplate?this.saveChanges&&(this.saveChanges(r,e,void 0),this.dataBind()):(e.elementRef.nativeElement._viewContainerRef=this.viewContainerRef,e.elementRef.nativeElement.propName=r))},get:(n=r=t,i=a,function(){return E.getValue(n+"Ref",this)||i}),enumerable:!0,configurable:!0};Object.defineProperty(e,t,s)}},e.applyMixins=n,e.clearTemplate=i,e.compile=d,e.registerEvents=t,e.setValue=function(e,t,n){for(var i=e.replace(/\[/g,".").replace(/\]/g,"").split("."),r=n||{},s=0;s<i.length;s++){var a=i[parseInt(s.toString(),10)];s+1===i.length?r["".concat(a)]=void 0===t?{}:t:void 0===r["".concat(a)]&&(r["".concat(a)]={}),r=r["".concat(a)]}return r},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
| //# sourceMappingURL=ej2-angular-base.umd.min.js.map |
@@ -0,2 +1,11 @@ | ||
| /*! | ||
| * filename: ej2-angular-base.min.js | ||
| * version : 32.1.24 | ||
| * Copyright Syncfusion Inc. 2001 - 2025. 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. | ||
| */ | ||
| this.ej=this.ej||{},this.ej.angularbase=function(e,t,n){"use strict";function i(e,t){t.forEach(function(t){Object.getOwnPropertyNames(t.prototype).forEach(function(n){(!Object.prototype.hasOwnProperty.call(e.prototype,n)||t.isFormBase&&"constructor"!==n)&&(e.prototype["".concat(n)]=t.prototype["".concat(n)])})})}function r(e){return function(t){i(t,e)}}function s(e,t,i){var r={};if(e&&e.length){for(var s=0,a=e;s<a.length;s++){var o=a[s];!0===i?(t.propCollection["".concat(o)]=new n.EventEmitter(!1),t["".concat(o)]=t.propCollection["".concat(o)]):r["".concat(o)]=new n.EventEmitter(!1)}!0!==i&&t.setProperties(r,!0)}}function a(e,n,i){var r,s=Object.keys(e.registeredTemplate);if(s.length)for(var a=n&&n.filter(function(e){return!/\./g.test(e)}),o=/tab|accordion|toolbar/.test(null===(r=e.getModuleName)||void 0===r?void 0:r.call(e)),l=0,p=a&&a||s;l<p.length;l++){var c=p[l];if(i&&i.length)for(var h=0;h<i.length;h++)if(o)for(m=0;m<e.registeredTemplate["".concat(c)].length;m++)(g=e.registeredTemplate["".concat(c)][parseInt(m.toString(),10)])&&g===i["".concat(h)]&&(g.destroy(),e.registeredTemplate["".concat(c)].splice(m,1));else for(m=0;m<e.registeredTemplate.template.length;m++){var g=e.registeredTemplate.template[parseInt(m.toString(),10)].rootNodes[0];g===i["".concat(h)]&&(d=e.registeredTemplate["".concat(c)])[parseInt(m.toString(),10)].destroy()}else if(e.registeredTemplate["".concat(c)])for(var u=0,f=e.registeredTemplate["".concat(c)];u<f.length;u++){var d=f[u];if(!d.destroyed){if(d._view){var v=d._view.renderer.parentNode(d.rootNodes[0]);if(!t.isNullOrUndefined(v))for(var m=0;m<d.rootNodes.length;m++)v.appendChild(d.rootNodes[parseInt(m.toString(),10)])}d.destroy()}}o&&i||delete e.registeredTemplate["".concat(c)]}for(var C=0,y=e.tagObjects;C<y.length;C++)!function(e){e.instance&&e.instance.clearTemplate(n&&n.filter(function(t){return!!new RegExp(e.name).test(t)}))}(y[C])}function o(e,t,n){for(var i=e.replace(/\[/g,".").replace(/\]/g,"").split("."),r=n||{},s=0;s<i.length;s++){var a=i[parseInt(s.toString(),10)];s+1===i.length?r["".concat(a)]=void 0===t?{}:t:void 0===r["".concat(a)]&&(r["".concat(a)]={}),r=r["".concat(a)]}return r}function l(e,n){if("string"==typeof e||"function"==typeof e&&e.prototype&&e.prototype.CSPTemplate)return m(e,n);var i=e.elementRef.nativeElement._viewContainerRef,r=e.elementRef.nativeElement.propName;return function(n,s,a){var o={$implicit:n},l=i||s.viewContainerRef,p=l.createEmbeddedView(e,o);/EJS-MENTION|EJS-DROPDOWNLIST/.test(t.getValue("currentInstance.element.nodeName",l))||/E-TABITEM/.test(t.getValue("element.nativeElement.nodeName",l))&&t.getValue("currentInstance.headerTemplateRef",l)?p.detectChanges():p.markForCheck();var c=s&&s.registeredTemplate?s.registeredTemplate:t.getValue("currentInstance.registeredTemplate",l);return a=a&&s.registeredTemplate?a:r,void 0===c["".concat(a)]&&(c["".concat(a)]=[]),c["".concat(a)].push(p),p.rootNodes}}function p(e){return function(t,n){var i={set:c(n),get:h(n,e),enumerable:!0,configurable:!0};Object.defineProperty(t,n,i)}}function c(e){return function(n){void 0!==n&&(t.setValue(e+"Ref",n,this),"string"==typeof n||"function"==typeof n&&n.prototype&&n.prototype.CSPTemplate?this.saveChanges&&(this.saveChanges(e,n,void 0),this.dataBind()):(n.elementRef.nativeElement._viewContainerRef=this.viewContainerRef,n.elementRef.nativeElement.propName=e))}}function h(e,n){return function(){return t.getValue(e+"Ref",this)||n}}var g=/Ref$/,u=function(){function e(){this.hasChanges=!1,this.propCollection={},this.dataSource={},this.tags=[],this.tagObjects=[]}return e.prototype.ngOnInit=function(){this.registeredTemplate={};for(var e=0,n=this.tags;e<n.length;e++){var i=n[e],r=t.getValue("child"+i.substring(0,1).toUpperCase()+i.substring(1),this);r&&this.tagObjects.push({instance:r,name:i})}for(var s=Object.keys(this),a=0;a<s.length;a++){var o=t.getValue(s[parseInt(a.toString(),10)],this);"object"==typeof o&&o&&o.elementRef&&(t.getValue(-1!==s[parseInt(a.toString(),10)].indexOf("Ref")?s[parseInt(a.toString(),10)]:s[parseInt(a.toString(),10)]+"Ref",this)||t.setValue(-1!==s[parseInt(a.toString(),10)].indexOf("Ref")?s[parseInt(a.toString(),10)]:s[parseInt(a.toString(),10)]+"Ref",o,this),!t.getValue("viewContainerRef",this)||t.getValue("_viewContainerRef",o.elementRef.nativeElement)||t.getValue("propName",o.elementRef.nativeElement)||(t.setValue("_viewContainerRef",t.getValue("viewContainerRef",this),o.elementRef.nativeElement),t.setValue("propName",s[parseInt(a.toString(),10)].replace("Ref",""),o.elementRef.nativeElement)))}for(var l=0,p=s=(s=Object.keys(this)).filter(function(e){return/Ref$/i.test(e)});l<p.length;l++){var c=p[l].replace("Ref","");t.setValue(c.replace("_","."),t.getValue(c,this),this.propCollection)}var h=Object.keys(this);if(this.directivePropList){for(var g=0;g<this.directivePropList.length;g++){var u=this.directivePropList[parseInt(g.toString(),10)];-1===h.indexOf(u)||!1!==t.getValue(u,this)&&!t.getValue(u,this)||t.setValue(u,t.getValue(u,this),this.propCollection)}this.hasChanges=!0}this.isInitChanges=!0},e.prototype.registerEvents=function(e){s(e,this,!0)},e.prototype.ngOnChanges=function(e){for(var t=0,n=Object.keys(e);t<n.length;t++){var i=n[t],r=e["".concat(i)];this.propCollection["".concat(i)]=r.currentValue}this.isUpdated=!1,this.hasChanges=!0},e.prototype.clearTemplate=function(e){a(this,e)},e.prototype.getProperties=function(){for(var e=0,t=this.tagObjects;e<t.length;e++){var n=t[e];this.propCollection[n.name]=n.instance.getProperties()}return this.propCollection},e.prototype.isChanged=function(){var e=this.hasChanges;if(!t.isNullOrUndefined(this.propCollection[this.property]))for(var n=this.propCollection[this.property],i=Object.keys(n[0]),r=0;r<i.length;r++)if(!t.isNullOrUndefined(this.propCollection[i[parseInt(r.toString(),10)]])){var s=t.getValue(i[parseInt(r.toString(),10)],this),a=this.propCollection[this.property][0][i[parseInt(r.toString(),10)]];t.isNullOrUndefined(s)||this.propCollection[i[parseInt(r.toString(),10)]]===s||a===s||(t.setValue(i[parseInt(r.toString(),10)],s,this.propCollection[this.property][0]),t.setValue(i[parseInt(r.toString(),10)],s,this.propCollection),this.hasChanges=!0,this.isUpdated=!1)}for(var o=0,l=this.tagObjects;o<l.length;o++){var p=l[o];e=e||p.instance.hasChanges}return e||this.hasChanges},e.prototype.ngAfterContentChecked=function(){if(this.hasChanges=this.isChanged(),this.isInitChanges||this.hasChanges)for(var e=Object.keys(this),n=0,i=e=e.filter(function(e){return g.test(e)});n<i.length;n++){var r=i[n].replace("Ref","");t.setValue(r.replace("_","."),t.getValue(r,this),this.propCollection)}},e.prototype.ngAfterViewChecked=function(){this.isUpdated&&(this.hasChanges=!1)},e.prototype.ngAfterViewInit=function(){this.isInitChanges=!1},e.prototype.ngOnDestroy=function(){this.directivePropList=[]},e}(),f=function(){function e(e){this.list=[],this.hasChanges=!1,this.propertyName=e}return e.prototype.ngOnInit=function(){this.isInitChanges=!0},e.prototype.ngAfterContentInit=function(){var e=this,t=0;this.list=this.children.map(function(n){return n.dirIndex=t++,n.property=e.propertyName,n}),this.hasChanges=!0},e.prototype.getProperties=function(){for(var e=[],t=0,n=this.list;t<n.length;t++){var i=n[t];e.push(i.getProperties())}return e},e.prototype.isChanged=function(){var e=this,t=!1,n=0,i=!1,r=this.children.map(function(e){return e});if(this.list.length===this.children.length)for(var s=0;s<this.list.length;s++)this.list[parseInt(s.toString(),10)].propCollection.dataSource&&(this.list[parseInt(s.toString(),10)].dataSource&&this.list[parseInt(s.toString(),10)].propCollection.dataSource!==this.list[parseInt(s.toString(),10)].dataSource&&(this.list[parseInt(s.toString(),10)].propCollection.dataSource=this.list[parseInt(s.toString(),10)].dataSource,this.list[parseInt(s.toString(),10)].hasChanges=!0),"series"!==this.list[parseInt(s.toString(),10)].property&&(i=JSON.stringify(this.list[parseInt(s.toString(),10)].propCollection.dataSource)!==JSON.stringify(r[parseInt(s.toString(),10)].propCollection.dataSource))),i=this.list[parseInt(s.toString(),10)].hasChanges!==r[parseInt(s.toString(),10)].hasChanges;this.hasNewChildren=!(this.list.length===this.children.length&&!i)||null,this.hasNewChildren&&(this.list=this.children.map(function(t){return t.dirIndex=n++,t.property=e.propertyName,t}));for(var a=0,o=this.list;a<o.length;a++){var l=o[a];t=t||l.hasChanges}return!!this.list.length&&t},e.prototype.clearTemplate=function(e){for(var t=this,n=0,i=this.list;n<i.length;n++)i[n].clearTemplate(e&&e.map(function(e){return new RegExp(t.propertyName).test(e)?e.replace(t.propertyName+".",""):e}))},e.prototype.ngAfterContentChecked=function(){this.hasChanges=this.isChanged();for(var e=0;e<this.list.length;e++)t.getValue("childColumns",this.list[parseInt(e.toString(),10)])&&"columns"===t.getValue("property",this.list[parseInt(e.toString(),10)])&&t.setValue("columns",t.getValue("childColumns",this.list[parseInt(e.toString(),10)]).getProperties(),this.list[parseInt(e.toString(),10)].propCollection),this.list[parseInt(e.toString(),10)].isUpdated=!0},e.prototype.ngAfterViewInit=function(){this.isInitChanges=!1},e.prototype.ngOnDestroy=function(){this.list=[]},e}(),d=function(){function e(){this.isProtectedOnChange=!0,this.isFormInit=!0}return e.prototype.saveChanges=function(e,t,n){if(!this.isProtectedOnChange){this.oldProperties["".concat(e)]=n,this.changedProperties["".concat(e)]=t,this.finalUpdate();var i=setTimeout(this.dataBind.bind(this)),r=function(){clearTimeout(i)};this.finalUpdate=r}},e.prototype.ngOnInit=function(e){var n=e||this;n.registeredTemplate={},n.ngBoundedEvents={},n.isAngular=!0,n.isFormInit=!0,e&&(this.tags=e.tags),n.tags=this.tags||[],n.complexTemplate=this.complexTemplate||[],n.tagObjects=[],n.ngAttr=this.getAngularAttr(n.element),n.createElement=function(e,i){var r=n.srenderer?n.srenderer.createElement(e):t.createElement(e);return void 0===i?r:(r.innerHTML=i.innerHTML?i.innerHTML:"",void 0!==i.className&&(r.className=i.className),void 0!==i.id&&(r.id=i.id),void 0!==i.styles&&r.setAttribute("style",i.styles),void 0!==n.ngAttr&&r.setAttribute(n.ngAttr,""),void 0!==i.attrs&&t.attributes(r,i.attrs),r)};for(var i=0,r=n.tags;i<r.length;i++){var s=r[i],a={instance:t.getValue("child"+s.substring(0,1).toUpperCase()+s.substring(1),n),name:s};n.tagObjects.push(a)}for(var o=Object.keys(n),l=0;l<o.length;l++){var p=t.getValue(o[parseInt(l.toString(),10)],n);"object"==typeof p&&p&&p.elementRef&&("object"==typeof p&&p&&p.elementRef&&-1!==o[parseInt(l.toString(),10)].indexOf("_")&&-1===o[parseInt(l.toString(),10)].indexOf("Ref")&&t.setValue(o[parseInt(l.toString(),10)]+"Ref",p,n),!n.viewContainerRef||t.getValue("_viewContainerRef",p.elementRef.nativeElement)||t.getValue("propName",p.elementRef.nativeElement)||(t.setValue("_viewContainerRef",n.viewContainerRef,p.elementRef.nativeElement),t.setValue("propName",o[parseInt(l.toString(),10)].replace("Ref",""),p.elementRef.nativeElement)))}for(var c=0,h=o=(o=Object.keys(n)).filter(function(e){return/Ref$/i.test(e)&&/_/i.test(e)});c<h.length;c++){var g=h[c].replace("Ref",""),u={};t.setValue(g.replace("_","."),t.getValue(g,n),u),n.setProperties(u,!0)}},e.prototype.getAngularAttr=function(e){for(var t,n=e.attributes,i=n.length,r=0;r<i;r++)/_ngcontent/g.test(n[parseInt(r.toString(),10)].name)&&(t=n[parseInt(r.toString(),10)].name);return t},e.prototype.ngAfterViewInit=function(e){var n=e||this;/ejs-tab|ejs-accordion/g.test(n.ngEle.nativeElement.outerHTML)&&(n.ngEle.nativeElement.style.visibility="hidden");var i=Object.keys(n);i=i.filter(function(e){return/Ref$/i.test(e)});for(var r="DocumentEditor"===n.getModuleName(),s=0,a=i;s<a.length;s++){var o=a[s].replace("Ref","");t.setValue(o.replace("_","."),t.getValue(o+"Ref",n),n)}var l=function(e){"undefined"!=typeof window&&e.element&&(e.appendTo(e.element),e.ngEle.nativeElement.style.visibility="")};r||n.getModuleName().includes("btn")?l(n):setTimeout(function(){l(n)})},e.prototype.ngOnDestroy=function(e){var t=e||this;setTimeout(function(){if("undefined"!=typeof window&&t.element.classList.contains("e-control")){if(void 0!==t.ngOnFocus&&void 0!==t.ngOnBlur){var e=t.inputElement||t.element;e.removeEventListener("focus",t.ngOnFocusBound),e.removeEventListener("blur",t.ngOnBlurBound),t.ngOnFocusBound=null,t.ngOnBlurBound=null}t.destroy(),t.clearTemplate(null),setTimeout(function(){for(var e=0,n=Object.keys(t);e<n.length;e++){var i=n[e],r=t["".concat(i)];if(r&&/object/.test(typeof r)&&0!==Object.keys(r).length)if(/properties|changedProperties|childChangedProperties|oldProperties|moduleLoader/.test(i))for(var s=0,a=Object.keys(t["".concat(i)]);s<a.length;s++){var o=a[s],l=r["".concat(o)];l&&/object/.test(typeof l)&&0!==Object.keys(l).length&&(l.parent||l.parentObj)&&(t["".concat(i)]["".concat(o)]=null)}else(r.parent||r.parentObj)&&(t["".concat(i)]=null)}})}})},e.prototype.clearTemplate=function(e,t){a(this,e,t)},e.prototype.ngAfterContentChecked=function(e){for(var n=e||this,i=0,r=n.tagObjects;i<r.length;i++){var s=r[i];if(!t.isUndefined(s.instance)&&(s.instance.isInitChanges||s.instance.hasChanges||s.instance.hasNewChildren)){var a={};if(s.instance.isInitChanges){var o=void 0;(C=t.getValue("instance.list",s))&&C.length&&(o=C[0].directivePropList);var l=!0;if(n.getModuleName&&"gantt"===n.getModuleName()&&(l=!1),o&&l&&-1===o.indexOf(s.instance.propertyName))for(var p=Object.keys(s.instance.list[0].propCollection),c=0;c<s.instance.list.length;c++){s.instance.list["".concat(c)].propCollection[s.instance.propertyName]=[];for(var h={},g=0;g<p.length;g++){var u=p[parseInt(g.toString(),10)];h["".concat(u)]=s.instance.list["".concat(c)].propCollection["".concat(u)]}for(var f=0;f<s.instance.list["".concat(c)].tags.length;f++)!function(e){var n=s.instance.list["".concat(c)].tags[parseInt(e.toString(),10)],i=t.getValue("child"+n.substring(0,1).toUpperCase()+n.substring(1),s.instance.list["".concat(c)]);if(i){var r=s.instance.list["".concat(c)]["child"+n.substring(0,1).toUpperCase()+n.substring(1)],a=function(e){var n=[];if(e)for(var i=0;i<e.list.length;i++){var r=e.list[0].tags[0];if(r){var s=t.getValue("child"+r.substring(0,1).toUpperCase()+r.substring(1),e.list[parseInt(i.toString(),10)]);s&&(e.list[parseInt(i.toString(),10)].tagObjects.push({instance:s,name:r}),n.push(s))}}if(0!==n.length)for(var o=0;o<n.length;o++)a(n[parseInt(o.toString(),10)])};a(r),s.instance.list["".concat(c)].tagObjects.push({instance:i,name:n})}}(f);s.instance.list["".concat(c)].propCollection[s.instance.propertyName].push(h)}a[s.name]=s.instance.getProperties(),n.setProperties(a,s.instance.isInitChanges)}else{var d=!1;(n[s.name].length!==s.instance.list.length||/diagram|DashboardLayout/.test(n.getModuleName()))&&(n[s.name]=s.instance.list,d=!0);for(var v=0,m=s.instance.list;v<m.length;v++){var C=m[v];if(C.tags)for(var y=0,b=C.tags;y<b.length;y++){var O=b[y],V=t.getValue("child"+O.substring(0,1).toUpperCase()+O.substring(1),C);V&&C.tagObjects.push({instance:V,name:O})}var I=s.instance.list.indexOf(C),S=t.getValue(s.name,n)["".concat(I)],E=Object.keys(S);if(E=E.filter(function(e){return/Ref$/i.test(e)}),S.properties&&0!==Object.keys(S.properties).length)for(var T=0,N=E;T<N.length;T++)u=(u=N[T]).replace(/Ref/,""),S.properties["".concat(u)]=S.properties["".concat(u)]?S.properties["".concat(u)]:S.propCollection["".concat(u)];t.isUndefined(S)||t.isUndefined(S.setProperties)||(/diagram|DashboardLayout/.test(n.getModuleName())?S.setProperties(C.getProperties(),!0):S.setProperties(C.getProperties())),C.isUpdated=!0}(/grid/.test(n.getModuleName())&&d||/chart/.test(n.getModuleName()))&&(a[s.name]=s.instance.getProperties(),n.setProperties(a,s.instance.isInitChanges))}}}},e.prototype.registerEvents=function(e){s(e,this)},e.prototype.twoWaySetter=function(e,n){var i=t.getValue(n,this.properties);i!==e&&(this.saveChanges(n,e,i),t.setValue(n,t.isNullOrUndefined(e)?null:e,this.properties),t.getValue(n+"Change",this).emit(e))},e.prototype.addTwoWay=function(e){for(var i=this,r=this,s=0,a=e;s<a.length;s++)!function(e){t.getValue(e,r),Object.defineProperty(r,e,{get:function(){return t.getValue(e,i.properties)},set:function(t){return i.twoWaySetter(t,e)}}),t.setValue(e+"Change",new n.EventEmitter,r)}(a[s])},e.prototype.addEventListener=function(e,n){var i=t.getValue(e,this);t.isUndefined(i)||(this.ngBoundedEvents["".concat(e)]||(this.ngBoundedEvents["".concat(e)]=new Map),this.ngBoundedEvents["".concat(e)].set(n,i.subscribe(n)))},e.prototype.removeEventListener=function(e,n){var i=t.getValue(e,this);t.isUndefined(i)||this.ngBoundedEvents["".concat(e)].get(n).unsubscribe()},e.prototype.trigger=function(e,n,i){var r=t.getValue(e,this),s=this.isProtectedOnChange;this.isProtectedOnChange=!1,n&&(n.name=e),t.isUndefined(r)||r.next(n);var a=t.getValue("local"+e.charAt(0).toUpperCase()+e.slice(1),this);t.isUndefined(a)||a.call(this,n),this.isProtectedOnChange=s,i&&(this.preventChange=this.isPreventChange,i.call(this,n)),this.isPreventChange=!1},e}(),v=function(){function e(){}return e.prototype.propagateChange=function(e){},e.prototype.propagateTouch=function(){},e.prototype.localChange=function(e){var n=void 0===e.checked?e.value:e.checked;if(this.objCheck=t.isObject(n),!0===this.isUpdated&&(this.angularValue=this.oldValue),!0===this.objCheck)this.duplicateValue=JSON.stringify(n),this.duplicateAngularValue=JSON.stringify(this.angularValue),this.duplicateValue!==this.duplicateAngularValue&&void 0!==this.propagateChange&&void 0!==n&&(this.propagateChange(n),this.angularValue=n);else if(n!==this.angularValue&&void 0!==this.propagateChange&&void 0!==n)if(""!==n&&null!==n)this.propagateChange(n),this.angularValue=n;else{var i=n;this.propagateChange(i),this.angularValue=n}this.cdr.markForCheck()},e.prototype.registerOnChange=function(e){this.propagateChange=e},e.prototype.registerOnTouched=function(e){this.propagateTouch=e},e.prototype.twoWaySetter=function(e,n){var i=this.oldValue||t.getValue(n,this.properties),r=this.inputElement||this.element;(!r||i!==e||this.value!==e||void 0!==r.value&&""!==r.value)&&(this.saveChanges(n,e,i),t.setValue(n,t.isNullOrUndefined(e)?null:e,this.properties),t.getValue(n+"Change",this).emit(e))},e.prototype.ngAfterViewInit=function(e){var t=e||this;if(t.ngOnBlurBound=this.ngOnBlur.bind(this),t.ngOnFocusBound=this.ngOnFocus.bind(this),"undefined"!=typeof window){t.getModuleName().includes("dropdowntree")?setTimeout(function(){t.appendTo(t.element)}):t.appendTo(t.element);var n=t.inputElement||t.element;n.addEventListener("focus",t.ngOnFocusBound),n.addEventListener("blur",t.ngOnBlurBound)}this.isFormInit=!1},e.prototype.setDisabledState=function(e){this.enabled=!e,this.disabled=e},e.prototype.writeValue=function(e){var t=/ejs-radiobutton/g;void 0===this.checked?this.value=e:this.ngEle&&("boolean"==typeof e?t.test(this.ngEle.nativeElement.outerHTML)?this.checked=e===this.value:this.checked=e:this.checked=e===this.value);var n=null==this.angularValue;if(this.angularValue=e,this.isUpdated=!0,this.preventChange=!this.isFormInit,this.cdr.markForCheck(),null===e)return void(n&&(this.preventChange=!1))},e.prototype.ngOnFocus=function(e){!0!==this.skipFromEvent&&this.focus.emit(e),this.cdr.markForCheck()},e.prototype.ngOnBlur=function(e){this.propagateTouch(),!0!==this.skipFromEvent&&this.blur.emit(e),this.cdr.markForCheck()},e.isFormBase=!0,e}(),m=t.getTemplateEngine();return t.setTemplateEngine({compile:l}),e.ArrayBase=f,e.ComplexBase=u,e.ComponentBase=d,e.ComponentMixins=r,e.FormBase=v,e.Template=p,e.applyMixins=i,e.clearTemplate=a,e.compile=l,e.registerEvents=s,e.setValue=o,e}({},ej.base,core),this.ejs=ej; | ||
| //# sourceMappingURL=ej2-angular-base.min.js.map |
@@ -0,1 +1,10 @@ | ||
| /*! | ||
| * filename: index.d.ts | ||
| * version : 32.1.24 | ||
| * Copyright Syncfusion Inc. 2001 - 2025. 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 _angularbase from '@syncfusion/ej2-angular-base'; | ||
@@ -2,0 +11,0 @@ |
+14
-82
| { | ||
| "_from": "@syncfusion/ej2-angular-base@*", | ||
| "_id": "@syncfusion/ej2-angular-base@31.2.0", | ||
| "_inBundle": false, | ||
| "_integrity": "sha512-YSraLbHKs2kU3NAPuZmCL+GWSjGrdc2HQ+pw8SED1577fG+j4XXyO4m5pbw6JP5/fyUP8+c1zhRhXb4keFrbnA==", | ||
| "_location": "/@syncfusion/ej2-angular-base", | ||
| "_phantomChildren": {}, | ||
| "_requested": { | ||
| "type": "range", | ||
| "registry": true, | ||
| "raw": "@syncfusion/ej2-angular-base@*", | ||
| "name": "@syncfusion/ej2-angular-base", | ||
| "escapedName": "@syncfusion%2fej2-angular-base", | ||
| "scope": "@syncfusion", | ||
| "rawSpec": "*", | ||
| "saveSpec": null, | ||
| "fetchSpec": "*" | ||
| }, | ||
| "_requiredBy": [ | ||
| "/", | ||
| "/@syncfusion/ej2-angular-barcode-generator", | ||
| "/@syncfusion/ej2-angular-blockeditor", | ||
| "/@syncfusion/ej2-angular-buttons", | ||
| "/@syncfusion/ej2-angular-calendars", | ||
| "/@syncfusion/ej2-angular-charts", | ||
| "/@syncfusion/ej2-angular-circulargauge", | ||
| "/@syncfusion/ej2-angular-diagrams", | ||
| "/@syncfusion/ej2-angular-documenteditor", | ||
| "/@syncfusion/ej2-angular-dropdowns", | ||
| "/@syncfusion/ej2-angular-filemanager", | ||
| "/@syncfusion/ej2-angular-gantt", | ||
| "/@syncfusion/ej2-angular-grids", | ||
| "/@syncfusion/ej2-angular-heatmap", | ||
| "/@syncfusion/ej2-angular-image-editor", | ||
| "/@syncfusion/ej2-angular-inplace-editor", | ||
| "/@syncfusion/ej2-angular-inputs", | ||
| "/@syncfusion/ej2-angular-interactive-chat", | ||
| "/@syncfusion/ej2-angular-kanban", | ||
| "/@syncfusion/ej2-angular-layouts", | ||
| "/@syncfusion/ej2-angular-lineargauge", | ||
| "/@syncfusion/ej2-angular-lists", | ||
| "/@syncfusion/ej2-angular-maps", | ||
| "/@syncfusion/ej2-angular-multicolumn-combobox", | ||
| "/@syncfusion/ej2-angular-navigations", | ||
| "/@syncfusion/ej2-angular-notifications", | ||
| "/@syncfusion/ej2-angular-pdfviewer", | ||
| "/@syncfusion/ej2-angular-pivotview", | ||
| "/@syncfusion/ej2-angular-popups", | ||
| "/@syncfusion/ej2-angular-progressbar", | ||
| "/@syncfusion/ej2-angular-querybuilder", | ||
| "/@syncfusion/ej2-angular-ribbon", | ||
| "/@syncfusion/ej2-angular-richtexteditor", | ||
| "/@syncfusion/ej2-angular-schedule", | ||
| "/@syncfusion/ej2-angular-splitbuttons", | ||
| "/@syncfusion/ej2-angular-spreadsheet", | ||
| "/@syncfusion/ej2-angular-treegrid", | ||
| "/@syncfusion/ej2-angular-treemap" | ||
| ], | ||
| "_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-development/@syncfusion/ej2-angular-base/-/ej2-angular-base-31.2.0.tgz", | ||
| "_shasum": "4a617960fd7816fb5aae431a22c009b5f953dd78", | ||
| "_spec": "@syncfusion/ej2-angular-base@*", | ||
| "_where": "D:\\SF3992\\WFH\\Nexus\\release", | ||
| "author": { | ||
| "name": "Syncfusion Inc." | ||
| }, | ||
| "bugs": { | ||
| "url": "https://github.com/syncfusion/ej2-angular-ui-components/issues" | ||
| }, | ||
| "bundleDependencies": false, | ||
| "dependencies": { | ||
| "@syncfusion/ej2-base": "~32.1.19", | ||
| "@syncfusion/ej2-icons": "~32.1.19" | ||
| }, | ||
| "deprecated": false, | ||
| "name": "@syncfusion/ej2-angular-base", | ||
| "version": "32.1.24", | ||
| "description": "A common package of Essential JS 2 base Angular libraries, methods and class definitions", | ||
| "devDependencies": {}, | ||
| "homepage": "https://www.syncfusion.com/angular-components", | ||
| "author": "Syncfusion Inc.", | ||
| "license": "SEE LICENSE IN license", | ||
| "main": "./dist/ej2-angular-base.umd.min.js", | ||
| "module": "./index.js", | ||
| "schematics": "./schematics/collection.json", | ||
| "keywords": [ | ||
@@ -87,11 +19,12 @@ "ej2", | ||
| ], | ||
| "license": "SEE LICENSE IN license", | ||
| "main": "./dist/ej2-angular-base.umd.min.js", | ||
| "module": "./index.js", | ||
| "name": "@syncfusion/ej2-angular-base", | ||
| "dependencies": { | ||
| "@syncfusion/ej2-base": "~32.1.24", | ||
| "@syncfusion/ej2-icons": "~32.1.24" | ||
| }, | ||
| "devDependencies": {}, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/syncfusion/ej2-angular-ui-components.git" | ||
| "url": "https://github.com/syncfusion/ej2-angular-ui-components" | ||
| }, | ||
| "schematics": "./schematics/collection.json", | ||
| "homepage": "https://www.syncfusion.com/angular-components", | ||
| "scripts": { | ||
@@ -101,4 +34,3 @@ "postinstall": "node ./postinstall.js" | ||
| "typings": "index.d.ts", | ||
| "version": "32.1.19", | ||
| "sideEffects": true | ||
| } |
+1
-1
@@ -87,3 +87,3 @@ # ej2-angular-base | ||
| © Copyright 2025 Syncfusion<sup>®</sup> Inc. All Rights Reserved. The Syncfusion<sup>®</sup> Essential Studio<sup>®</sup> license and copyright applies to this distribution. | ||
| © Copyright 2026 Syncfusion<sup>®</sup> Inc. All Rights Reserved. The Syncfusion<sup>®</sup> Essential Studio<sup>®</sup> license and copyright applies to this distribution. | ||
| The Syncfusion<sup>®</sup> Essential<sup>®</sup> Studio license and copyright applies to this distribution. |
| :root, | ||
| :root, | ||
@@ -11,2 +9,4 @@ | ||
| /* Font Family */ | ||
@@ -13,0 +13,0 @@ /* Font Sizes */ |
| :root, | ||
| :root, | ||
| /* Font Family */ | ||
@@ -10,0 +10,0 @@ /* Font Sizes */ |
| :root, | ||
| :root, | ||
| /* Font Family */ | ||
@@ -10,0 +10,0 @@ /* Font Sizes */ |
| :root, | ||
| :root, | ||
| /* Font Family */ | ||
@@ -10,0 +10,0 @@ /* Font Sizes */ |
| :root, | ||
| :root, | ||
| /* Font Family */ | ||
@@ -10,0 +10,0 @@ /* border */ |
| import { QueryList, SimpleChanges } from '@angular/core'; | ||
| /** | ||
| * Complex Array Base module | ||
| */ | ||
| export interface IChildChange { | ||
| dirIndex: number; | ||
| change: Object; | ||
| } | ||
| export declare class ComplexBase<T> { | ||
| isUpdated: boolean; | ||
| hasChanges?: boolean; | ||
| dirIndex?: number; | ||
| propCollection?: { | ||
| [key: string]: Object; | ||
| }; | ||
| dataSource?: { | ||
| [key: string]: Object; | ||
| }; | ||
| property?: string; | ||
| tags?: string[]; | ||
| isInitChanges: boolean; | ||
| private tagObjects?; | ||
| private registeredTemplate; | ||
| private componentType; | ||
| directivePropList: any; | ||
| ngOnInit(): void; | ||
| protected registerEvents(eventList: string[]): void; | ||
| ngOnChanges(changes: SimpleChanges): void; | ||
| clearTemplate(templateNames: string[]): void; | ||
| getProperties(): { | ||
| [key: string]: Object; | ||
| }; | ||
| isChanged(): boolean; | ||
| ngAfterContentChecked(): void; | ||
| ngAfterViewChecked(): void; | ||
| ngAfterViewInit(): void; | ||
| ngOnDestroy(): void; | ||
| } | ||
| export declare class ArrayBase<T> { | ||
| isInitChanges: boolean; | ||
| list: T[] & ComplexBase<T>[]; | ||
| children: QueryList<T>; | ||
| hasChanges: boolean; | ||
| private propertyName; | ||
| hasNewChildren: boolean; | ||
| constructor(propertyName: string); | ||
| ngOnInit(): void; | ||
| ngAfterContentInit(): void; | ||
| getProperties(): Object[]; | ||
| isChanged(): boolean; | ||
| clearTemplate(templateNames: string[]): void; | ||
| ngAfterContentChecked(): void; | ||
| ngAfterViewInit(): void; | ||
| ngOnDestroy(): void; | ||
| } |
| /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
| import { QueryList, SimpleChanges, SimpleChange, EmbeddedViewRef } from '@angular/core'; | ||
| import { getValue, setValue, isNullOrUndefined } from '@syncfusion/ej2-base'; | ||
| import { clearTemplate, registerEvents } from './util'; | ||
| const refRegex: RegExp = /Ref$/; | ||
| /** | ||
| * Complex Array Base module | ||
| */ | ||
| export interface IChildChange { | ||
| dirIndex: number; | ||
| change: Object; | ||
| } | ||
| interface Tag { | ||
| hasChanges: boolean; | ||
| getProperties: Function; | ||
| isInitChanges: boolean; | ||
| clearTemplate?: (args: string[]) => void; | ||
| } | ||
| export class ComplexBase<T> { | ||
| public isUpdated: boolean; | ||
| public hasChanges?: boolean = false; | ||
| public dirIndex?: number; | ||
| public propCollection?: { [key: string]: Object } = {}; | ||
| public dataSource?: { [key: string]: Object } = {}; | ||
| public property?: string; | ||
| public tags?: string[] = []; | ||
| public isInitChanges: boolean; | ||
| private tagObjects?: { name: string, instance: Tag }[] = []; | ||
| private registeredTemplate: { [key: string]: EmbeddedViewRef<Object>[] }; | ||
| private componentType: T; | ||
| public directivePropList: any; | ||
| public ngOnInit(): void { | ||
| this.registeredTemplate = {}; | ||
| for (const tag of this.tags) { | ||
| const objInstance: Tag = getValue('child' + tag.substring(0, 1).toUpperCase() + tag.substring(1), this); | ||
| if (objInstance) { | ||
| this.tagObjects.push({ instance: objInstance, name: tag }); | ||
| } | ||
| } | ||
| let templateProperties: string[] = Object.keys(this); | ||
| for (let i: number = 0; i < templateProperties.length; i++) { | ||
| const tempProp: any = getValue(templateProperties[parseInt(i.toString(), 10)], this); | ||
| if (typeof tempProp === 'object' && tempProp && tempProp.elementRef) { | ||
| if (!getValue(templateProperties[parseInt(i.toString(), 10)].indexOf('Ref') !== -1 ? templateProperties[parseInt(i.toString(), 10)] : templateProperties[parseInt(i.toString(), 10)] + 'Ref', this)) { | ||
| setValue(templateProperties[parseInt(i.toString(), 10)].indexOf('Ref') !== -1 ? templateProperties[parseInt(i.toString(), 10)] : templateProperties[parseInt(i.toString(), 10)] + 'Ref', tempProp, this); | ||
| } | ||
| if (getValue('viewContainerRef', this) && !getValue('_viewContainerRef', tempProp.elementRef.nativeElement) && !getValue('propName', tempProp.elementRef.nativeElement)) { | ||
| setValue('_viewContainerRef', getValue('viewContainerRef', this), tempProp.elementRef.nativeElement); | ||
| setValue('propName', templateProperties[parseInt(i.toString(), 10)].replace('Ref', ''), tempProp.elementRef.nativeElement); | ||
| } | ||
| } | ||
| } | ||
| templateProperties = Object.keys(this); | ||
| templateProperties = templateProperties.filter((val: string): boolean => { | ||
| return /Ref$/i.test(val); | ||
| }); | ||
| for (const tempName of templateProperties) { | ||
| const propName: string = tempName.replace('Ref', ''); | ||
| setValue(propName.replace('_', '.'), getValue(propName, this), this.propCollection); | ||
| } | ||
| // Angular 9 compatibility to overcome ngOnchange not get triggered issue | ||
| // To Update properties to "this.propCollection" | ||
| const propList: string[] = Object.keys(this); | ||
| /* istanbul ignore next */ | ||
| if (this.directivePropList) { | ||
| for (let k: number = 0; k < this.directivePropList.length; k++) { | ||
| const dirPropName: string = this.directivePropList[parseInt(k.toString(), 10)]; | ||
| if (propList.indexOf(dirPropName) !== -1 && (getValue(dirPropName, this) === false || getValue(dirPropName, this))) { | ||
| setValue(dirPropName, getValue(dirPropName, this), this.propCollection); | ||
| } | ||
| } | ||
| this.hasChanges = true; | ||
| } | ||
| this.isInitChanges = true; | ||
| } | ||
| protected registerEvents(eventList: string[]): void { | ||
| registerEvents(eventList, this, true); | ||
| } | ||
| public ngOnChanges(changes: SimpleChanges): void { | ||
| for (const propName of Object.keys(changes)) { | ||
| const changedVal: SimpleChange = changes[`${propName}`]; | ||
| this.propCollection[`${propName}`] = changedVal.currentValue; | ||
| } | ||
| this.isUpdated = false; | ||
| this.hasChanges = true; | ||
| } | ||
| /* istanbul ignore next */ | ||
| public clearTemplate(templateNames: string[]): void { | ||
| clearTemplate(this, templateNames); | ||
| } | ||
| public getProperties(): { [key: string]: Object } { | ||
| /* istanbul ignore next */ | ||
| for (const tagObject of this.tagObjects) { | ||
| this.propCollection[tagObject.name] = tagObject.instance.getProperties(); | ||
| } | ||
| return this.propCollection; | ||
| } | ||
| public isChanged(): boolean { | ||
| let result: boolean = this.hasChanges; | ||
| if (!isNullOrUndefined(this.propCollection[this.property])) { | ||
| const tempProps: any = this.propCollection[this.property]; | ||
| const props: string[] = Object.keys(tempProps[0]); | ||
| for (let d: number = 0; d < props.length; d++) { | ||
| if (!isNullOrUndefined(this.propCollection[props[parseInt(d.toString(), 10)]])) { | ||
| const val: any = getValue(props[parseInt(d.toString(), 10)], this); | ||
| const propVal: any = (this.propCollection[this.property] as any)[0][props[parseInt(d.toString(), 10)]]; | ||
| if (!isNullOrUndefined(val) && this.propCollection[props[parseInt(d.toString(), 10)]] !== val | ||
| && propVal !== val) { | ||
| setValue(props[parseInt(d.toString(), 10)], val, (this.propCollection[this.property] as any)[0]); | ||
| setValue(props[parseInt(d.toString(), 10)], val, this.propCollection); | ||
| this.hasChanges = true; | ||
| this.isUpdated = false; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| /* istanbul ignore next */ | ||
| for (const item of this.tagObjects) { | ||
| result = result || item.instance.hasChanges; | ||
| } | ||
| return result || this.hasChanges; | ||
| } | ||
| public ngAfterContentChecked(): void { | ||
| this.hasChanges = this.isChanged(); | ||
| if (this.isInitChanges || this.hasChanges){ | ||
| let templateProperties: string[] = Object.keys(this); | ||
| templateProperties = templateProperties.filter((val: string) => { | ||
| return refRegex.test(val); | ||
| }); | ||
| for (const tempName of templateProperties) { | ||
| const propName: string = tempName.replace('Ref', ''); | ||
| setValue(propName.replace('_', '.'), getValue(propName, this), this.propCollection); | ||
| } | ||
| } | ||
| } | ||
| public ngAfterViewChecked(): void { | ||
| /* istanbul ignore next */ | ||
| if (this.isUpdated) { | ||
| this.hasChanges = false; | ||
| } | ||
| } | ||
| public ngAfterViewInit(): void { | ||
| /* istanbul ignore next */ | ||
| this.isInitChanges = false; | ||
| } | ||
| public ngOnDestroy(): void { | ||
| /* istanbul ignore next */ | ||
| this.directivePropList = []; | ||
| } | ||
| } | ||
| export class ArrayBase<T> { | ||
| public isInitChanges: boolean; | ||
| public list: T[] & ComplexBase<T>[] = []; | ||
| public children: QueryList<T>; | ||
| public hasChanges: boolean = false; | ||
| private propertyName: string; | ||
| public hasNewChildren: boolean; | ||
| constructor(propertyName: string) { | ||
| this.propertyName = propertyName; | ||
| } | ||
| public ngOnInit(): void { | ||
| this.isInitChanges = true; | ||
| } | ||
| public ngAfterContentInit(): void { | ||
| let index: number = 0; | ||
| /* istanbul ignore next */ | ||
| this.list = this.children.map((child: T & ComplexBase<T>) => { | ||
| child.dirIndex = index++; | ||
| child.property = this.propertyName; | ||
| return child; | ||
| }); | ||
| this.hasChanges = true; | ||
| } | ||
| public getProperties(): Object[] { | ||
| const onlyProp: Object[] = []; | ||
| for (const item of this.list) { | ||
| onlyProp.push((<{ getProperties: Function }>item).getProperties()); | ||
| } | ||
| return onlyProp; | ||
| } | ||
| public isChanged(): boolean { | ||
| let result: boolean = false; | ||
| let index: number = 0; | ||
| let isSourceChanged: boolean = false; | ||
| const childrenDataSource: any = this.children.map( | ||
| (child: T & ComplexBase<T>) => { | ||
| return child; | ||
| } | ||
| ); | ||
| /* istanbul ignore next */ | ||
| if (this.list.length === this.children.length) { | ||
| for (let i: number = 0; i < this.list.length; i++) { | ||
| if (this.list[parseInt(i.toString(), 10)].propCollection.dataSource) { | ||
| if (this.list[parseInt(i.toString(), 10)].dataSource && | ||
| this.list[parseInt(i.toString(), 10)].propCollection.dataSource | ||
| !== this.list[parseInt(i.toString(), 10)].dataSource) { | ||
| this.list[parseInt(i.toString(), 10)].propCollection.dataSource = this.list[parseInt(i.toString(), 10)].dataSource; | ||
| this.list[parseInt(i.toString(), 10)].hasChanges = true; | ||
| } | ||
| if (this.list[parseInt(i.toString(), 10)].property !== 'series') { | ||
| isSourceChanged = (JSON.stringify(this.list[parseInt(i.toString(), 10)].propCollection.dataSource) !== | ||
| JSON.stringify(childrenDataSource[parseInt(i.toString(), 10)].propCollection.dataSource)); | ||
| } | ||
| } | ||
| isSourceChanged = this.list[parseInt(i.toString(), 10)].hasChanges | ||
| !== childrenDataSource[parseInt(i.toString(), 10)].hasChanges; | ||
| } | ||
| } | ||
| this.hasNewChildren = (this.list.length !== this.children.length || isSourceChanged) ? true : null; | ||
| if (this.hasNewChildren) { | ||
| this.list = this.children.map((child: T & ComplexBase<T>) => { | ||
| child.dirIndex = index++; | ||
| child.property = this.propertyName; | ||
| return child; | ||
| }); | ||
| } | ||
| /* istanbul ignore end */ | ||
| for (const item of this.list) { | ||
| result = result || (<{ hasChanges: boolean }>item).hasChanges; | ||
| } | ||
| return !!this.list.length && result; | ||
| } | ||
| public clearTemplate(templateNames: string[]): void { | ||
| /* istanbul ignore next */ | ||
| for (const item of this.list) { | ||
| (<{ clearTemplate: Function }>item).clearTemplate(templateNames && templateNames.map((val: string): string => { | ||
| const regExp: RegExpConstructor = RegExp; | ||
| return new regExp(this.propertyName).test(val) ? val.replace(this.propertyName + '.', '') : val; | ||
| })); | ||
| } | ||
| } | ||
| public ngAfterContentChecked(): void { | ||
| this.hasChanges = this.isChanged(); | ||
| for (let i: number = 0; i < this.list.length; i++) { | ||
| if (getValue('childColumns', this.list[parseInt(i.toString(), 10)]) && getValue('property', this.list[parseInt(i.toString(), 10)]) === 'columns') { | ||
| setValue('columns', getValue('childColumns', this.list[parseInt(i.toString(), 10)]).getProperties(), this.list[parseInt(i.toString(), 10)].propCollection); | ||
| } | ||
| this.list[parseInt(i.toString(), 10)].isUpdated = true; | ||
| } | ||
| } | ||
| public ngAfterViewInit(): void { | ||
| this.isInitChanges = false; | ||
| } | ||
| public ngOnDestroy(): void { | ||
| this.list = []; | ||
| } | ||
| } |
| import { ElementRef } from '@angular/core'; | ||
| export interface IComponentBase { | ||
| registerEvents: (eventList: string[]) => void; | ||
| addTwoWay: (propList: string[]) => void; | ||
| } | ||
| export declare class ComponentBase<T> { | ||
| element: HTMLElement; | ||
| tags: string[]; | ||
| private ngAttr; | ||
| private srenderer; | ||
| protected isProtectedOnChange: boolean; | ||
| private isAngular; | ||
| private isFormInit; | ||
| private componentType; | ||
| preventChange: boolean; | ||
| isPreventChange: boolean; | ||
| protected oldProperties: { | ||
| [key: string]: Object; | ||
| }; | ||
| protected changedProperties: { | ||
| [key: string]: Object; | ||
| }; | ||
| protected finalUpdate: Function; | ||
| protected isUpdated: boolean; | ||
| ngEle: ElementRef; | ||
| private tagObjects; | ||
| onPropertyChanged: (newProp: Object, oldProp: Object) => void; | ||
| appendTo: (ele: string | HTMLElement) => void; | ||
| setProperties: (obj: Object, muteOnChange: boolean) => void; | ||
| properties: Object; | ||
| dataBind: Function; | ||
| private createElement; | ||
| protected saveChanges(key: string, newValue: Object, oldValue: Object): void; | ||
| destroy: Function; | ||
| private registeredTemplate; | ||
| private complexTemplate; | ||
| private ngBoundedEvents; | ||
| ngOnInit(isTempRef?: any): void; | ||
| getAngularAttr(ele: Element): string; | ||
| ngAfterViewInit(isTempRef?: any): void; | ||
| ngOnDestroy(isTempRef?: any): void; | ||
| clearTemplate(templateNames?: string[], index?: any): void; | ||
| ngAfterContentChecked(isTempRef?: any): void; | ||
| protected registerEvents(eventList: string[]): void; | ||
| protected twoWaySetter(newVal: Object, prop: string): void; | ||
| protected addTwoWay(propList: string[]): void; | ||
| addEventListener(eventName: string, handler: Function): void; | ||
| removeEventListener(eventName: string, handler: Function): void; | ||
| trigger(eventName: string, eventArgs: Object, success?: Function): void; | ||
| } |
| /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types */ | ||
| /** | ||
| * Angular Component Base Module | ||
| */ | ||
| import { getValue, isUndefined, setValue, isNullOrUndefined, attributes, createElement } from '@syncfusion/ej2-base'; | ||
| import { EventEmitter, EmbeddedViewRef, Renderer2, ElementRef } from '@angular/core'; | ||
| import { clearTemplate, registerEvents } from './util'; | ||
| export interface IComponentBase { | ||
| registerEvents: (eventList: string[]) => void; | ||
| addTwoWay: (propList: string[]) => void; | ||
| } | ||
| interface Tag { | ||
| hasChanges: boolean; | ||
| getProperties?: Function; | ||
| isInitChanges: boolean; | ||
| hasNewChildren: boolean; | ||
| list: TagList[]; | ||
| clearTemplate?: (arg: string[]) => void; | ||
| } | ||
| interface TagList { | ||
| getProperties: Function; | ||
| hasChanges: boolean; | ||
| isUpdated: boolean; | ||
| } | ||
| export class ComponentBase<T> { | ||
| public element: HTMLElement; | ||
| public tags: string[]; | ||
| private ngAttr: string; | ||
| private srenderer: Renderer2; | ||
| protected isProtectedOnChange: boolean = true; | ||
| private isAngular: boolean; | ||
| private isFormInit: boolean = true; | ||
| private componentType: T; | ||
| public preventChange: boolean; | ||
| public isPreventChange: boolean; | ||
| protected oldProperties: { [key: string]: Object }; | ||
| protected changedProperties: { [key: string]: Object }; | ||
| protected finalUpdate: Function; | ||
| protected isUpdated: boolean; | ||
| public ngEle: ElementRef; | ||
| private tagObjects: { name: string, instance: Tag }[]; | ||
| public onPropertyChanged: (newProp: Object, oldProp: Object) => void; | ||
| public appendTo: (ele: string | HTMLElement) => void; | ||
| public setProperties: (obj: Object, muteOnChange: boolean) => void; | ||
| public properties: Object; | ||
| public dataBind: Function; | ||
| private createElement: Function; | ||
| protected saveChanges(key: string, newValue: Object, oldValue: Object): void { | ||
| if (this.isProtectedOnChange) { return; } | ||
| this.oldProperties[`${key}`] = oldValue; | ||
| this.changedProperties[`${key}`] = newValue; | ||
| this.finalUpdate(); | ||
| const changeTime: any = setTimeout(this.dataBind.bind(this)); | ||
| const clearUpdate: Function = () => { | ||
| clearTimeout(changeTime); | ||
| }; | ||
| this.finalUpdate = clearUpdate; | ||
| } | ||
| public destroy: Function; | ||
| private registeredTemplate: { [key: string]: EmbeddedViewRef<Object>[] }; | ||
| private complexTemplate: string[]; | ||
| private ngBoundedEvents: { [key: string]: Map<object, object> }; | ||
| public ngOnInit(isTempRef?: any): void { | ||
| const tempOnThis: any = isTempRef || this; | ||
| tempOnThis.registeredTemplate = {}; | ||
| tempOnThis.ngBoundedEvents = {}; | ||
| tempOnThis.isAngular = true; | ||
| tempOnThis.isFormInit = true; | ||
| /* istanbul ignore next */ | ||
| if (isTempRef) { | ||
| this.tags = isTempRef.tags; | ||
| } | ||
| tempOnThis.tags = this.tags || []; | ||
| tempOnThis.complexTemplate = this.complexTemplate || []; | ||
| tempOnThis.tagObjects = []; | ||
| tempOnThis.ngAttr = this.getAngularAttr(tempOnThis.element); | ||
| /* istanbul ignore next */ | ||
| tempOnThis.createElement = (tagName: string, prop?: | ||
| { id?: string, className?: string, innerHTML?: string, styles?: string, attrs?: { [key: string]: string } }) => { | ||
| const ele: Element = tempOnThis.srenderer ? tempOnThis.srenderer.createElement(tagName) : createElement(tagName); | ||
| if (typeof (prop) === 'undefined') { | ||
| return <HTMLElement>ele; | ||
| } | ||
| ele.innerHTML = (prop.innerHTML ? prop.innerHTML : ''); | ||
| if (prop.className !== undefined) { | ||
| ele.className = prop.className; | ||
| } | ||
| if (prop.id !== undefined) { | ||
| ele.id = prop.id; | ||
| } | ||
| if (prop.styles !== undefined) { | ||
| ele.setAttribute('style', prop.styles); | ||
| } | ||
| if (tempOnThis.ngAttr !== undefined) { | ||
| ele.setAttribute(tempOnThis.ngAttr, ''); | ||
| } | ||
| if (prop.attrs !== undefined) { | ||
| attributes(ele, prop.attrs); | ||
| } | ||
| return <HTMLElement>ele; | ||
| }; | ||
| for (const tag of tempOnThis.tags) { | ||
| const tagObject: { name: string, instance: Tag } = { | ||
| instance: getValue('child' + tag.substring(0, 1).toUpperCase() + tag.substring(1), tempOnThis), | ||
| name: tag | ||
| }; | ||
| tempOnThis.tagObjects.push(tagObject); | ||
| } | ||
| let complexTemplates: string[] = Object.keys(tempOnThis); | ||
| for (let i: number = 0; i < complexTemplates.length; i++) { | ||
| const compProp: any = getValue(complexTemplates[parseInt(i.toString(), 10)], tempOnThis); | ||
| if (typeof compProp === 'object' && compProp && compProp.elementRef) { | ||
| if (typeof compProp === 'object' && compProp && compProp.elementRef && complexTemplates[parseInt(i.toString(), 10)].indexOf('_') !== -1 && complexTemplates[parseInt(i.toString(), 10)].indexOf('Ref') === -1) { | ||
| setValue(complexTemplates[parseInt(i.toString(), 10)] + 'Ref', compProp, tempOnThis); | ||
| } | ||
| if (tempOnThis.viewContainerRef && !getValue('_viewContainerRef', compProp.elementRef.nativeElement) && !getValue('propName', compProp.elementRef.nativeElement)) { | ||
| setValue('_viewContainerRef', tempOnThis.viewContainerRef, compProp.elementRef.nativeElement); | ||
| setValue('propName', complexTemplates[parseInt(i.toString(), 10)].replace('Ref', ''), compProp.elementRef.nativeElement); | ||
| } | ||
| } | ||
| } | ||
| complexTemplates = Object.keys(tempOnThis); | ||
| complexTemplates = complexTemplates.filter((val: string): boolean => { | ||
| return /Ref$/i.test(val) && /_/i.test(val); | ||
| }); | ||
| for (const tempName of complexTemplates) { | ||
| const propName: string = tempName.replace('Ref', ''); | ||
| const val: Object = {}; | ||
| setValue(propName.replace('_', '.'), getValue(propName, tempOnThis), val); | ||
| tempOnThis.setProperties(val, true); | ||
| } | ||
| } | ||
| public getAngularAttr(ele: Element): string { | ||
| const attributes: NamedNodeMap = ele.attributes; | ||
| const length: number = attributes.length; | ||
| let ngAr: string; | ||
| for (let i: number = 0; i < length; i++) { | ||
| /* istanbul ignore next */ | ||
| if (/_ngcontent/g.test(attributes[parseInt(i.toString(), 10)].name)) { | ||
| ngAr = attributes[parseInt(i.toString(), 10)].name; | ||
| } | ||
| } | ||
| return ngAr; | ||
| } | ||
| public ngAfterViewInit(isTempRef?: any): void { | ||
| const tempAfterViewThis: any = isTempRef || this; | ||
| const regExp: RegExp = /ejs-tab|ejs-accordion/g; | ||
| /* istanbul ignore next */ | ||
| if (regExp.test(tempAfterViewThis.ngEle.nativeElement.outerHTML)) { | ||
| tempAfterViewThis.ngEle.nativeElement.style.visibility = 'hidden'; | ||
| } | ||
| /** | ||
| * Root level template properties are not getting rendered, | ||
| * Due to ngonchanges not get triggered. | ||
| * so that we have set template value for root level template properties, | ||
| * for example: refer below syntax | ||
| * ```html | ||
| * <ejs-grid> | ||
| * <e-column></e-column> | ||
| * <ng-template #editSettingsTemplate></ng-template> | ||
| * </ejs-grid> | ||
| * ``` | ||
| */ | ||
| let templateProperties: string[] = Object.keys(tempAfterViewThis); | ||
| templateProperties = templateProperties.filter((val: string): boolean => { | ||
| return /Ref$/i.test(val); | ||
| }); | ||
| const ngtempRef: boolean = tempAfterViewThis.getModuleName() === 'DocumentEditor'; | ||
| for (const tempName of templateProperties) { | ||
| const propName: string = tempName.replace('Ref', ''); | ||
| setValue(propName.replace('_', '.'), getValue(propName + 'Ref', tempAfterViewThis), tempAfterViewThis); | ||
| } | ||
| // Used setTimeout for template binding | ||
| // Refer Link: https://github.com/angular/angular/issues/6005 | ||
| const appendToComponent: any = (tempAfterViewThis: any) => { | ||
| /* istanbul ignore else */ | ||
| if (typeof window !== 'undefined' && tempAfterViewThis.element) { | ||
| tempAfterViewThis.appendTo(tempAfterViewThis.element); | ||
| tempAfterViewThis.ngEle.nativeElement.style.visibility = ''; | ||
| } | ||
| }; | ||
| if (!ngtempRef && !tempAfterViewThis.getModuleName().includes('btn')) { | ||
| setTimeout(() => { | ||
| appendToComponent(tempAfterViewThis); | ||
| }); | ||
| } else { | ||
| appendToComponent(tempAfterViewThis); | ||
| } | ||
| } | ||
| public ngOnDestroy(isTempRef?: any): void { | ||
| const tempOnDestroyThis: any = isTempRef || this; | ||
| /* istanbul ignore else */ | ||
| setTimeout(() => { | ||
| if (typeof window !== 'undefined' && (tempOnDestroyThis.element.classList.contains('e-control'))) { | ||
| if (tempOnDestroyThis.ngOnFocus !== undefined && tempOnDestroyThis.ngOnBlur !== undefined) { | ||
| const ele: HTMLElement = tempOnDestroyThis.inputElement || tempOnDestroyThis.element; | ||
| ele.removeEventListener('focus', tempOnDestroyThis.ngOnFocusBound); | ||
| ele.removeEventListener('blur', tempOnDestroyThis.ngOnBlurBound); | ||
| tempOnDestroyThis.ngOnFocusBound = null; | ||
| tempOnDestroyThis.ngOnBlurBound = null; | ||
| } | ||
| tempOnDestroyThis.destroy(); | ||
| tempOnDestroyThis.clearTemplate(null); | ||
| // removing bounded events and tagobjects from component after destroy | ||
| setTimeout(function (): any { | ||
| for (const key of Object.keys(tempOnDestroyThis)) { | ||
| const value: any = tempOnDestroyThis[`${key}`]; | ||
| if (value && /object/.test(typeof value) && Object.keys(value).length !== 0) { | ||
| if (/properties|changedProperties|childChangedProperties|oldProperties|moduleLoader/.test(key)) { | ||
| for (const propKey of Object.keys(tempOnDestroyThis[`${key}`])) { | ||
| const propValue: any = value[`${propKey}`]; | ||
| if (propValue && /object/.test(typeof propValue) && Object.keys(propValue).length !== 0 && (propValue.parent || propValue.parentObj)) { | ||
| tempOnDestroyThis[`${key}`][`${propKey}`] = null; | ||
| } | ||
| } | ||
| } | ||
| else { | ||
| if (value.parent || value.parentObj) { | ||
| tempOnDestroyThis[`${key}`] = null; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }); | ||
| } | ||
| }); | ||
| } | ||
| public clearTemplate(templateNames?: string[], index?: any): void { | ||
| clearTemplate(this, templateNames, index); | ||
| } | ||
| public ngAfterContentChecked(isTempRef?: any): void { | ||
| const tempAfterContentThis: any = isTempRef || this; | ||
| for (const tagObject of tempAfterContentThis.tagObjects) { | ||
| if (!isUndefined(tagObject.instance) && | ||
| (tagObject.instance.isInitChanges || tagObject.instance.hasChanges || tagObject.instance.hasNewChildren)) { | ||
| const propObj: { [key: string]: Object } = {}; | ||
| if (tagObject.instance.isInitChanges) { | ||
| // For angular 9 compatibility | ||
| // Not able to get complex directive properties reference ni Onint hook | ||
| // So we have constructed property here and used | ||
| let complexDirProps: any; | ||
| const list: any = getValue('instance.list', tagObject); | ||
| if (list && list.length) { | ||
| complexDirProps = list[0].directivePropList; | ||
| } | ||
| let skip: any = true; | ||
| if ((tempAfterContentThis as any).getModuleName && (tempAfterContentThis as any).getModuleName() === 'gantt') { | ||
| skip = false; | ||
| } | ||
| if (complexDirProps && skip && complexDirProps.indexOf(tagObject.instance.propertyName) === -1) { | ||
| const compDirPropList: any = Object.keys(tagObject.instance.list[0].propCollection); | ||
| for (let h: number = 0; h < tagObject.instance.list.length; h++) { | ||
| tagObject.instance.list[`${h}`].propCollection[tagObject.instance.propertyName] = []; | ||
| const obj: any = {}; | ||
| for (let k: number = 0; k < compDirPropList.length; k++) { | ||
| const complexPropName: any = compDirPropList[parseInt(k.toString(), 10)]; | ||
| obj[`${complexPropName}`] = tagObject.instance.list[`${h}`].propCollection[`${complexPropName}`]; | ||
| } | ||
| for (let i: number = 0; i < tagObject.instance.list[`${h}`].tags.length; i++) { | ||
| const tag: any = tagObject.instance.list[`${h}`].tags[parseInt(i.toString(), 10)]; | ||
| const childObj: any = getValue('child' + tag.substring(0, 1).toUpperCase() + tag.substring(1), tagObject.instance.list[`${h}`]); | ||
| if (childObj) { | ||
| const innerchildObj: any = tagObject.instance.list[`${h}`]['child' + tag.substring(0, 1).toUpperCase() + tag.substring(1)]; | ||
| // Update the inner child tag objects | ||
| const updateChildTag: any = (innerchild: any) => { | ||
| const innerLevelTag: any = []; | ||
| if (innerchild) { | ||
| for (let j: number = 0; j < innerchild.list.length; j++) { | ||
| const innerTag: any = innerchild.list[0].tags[0]; | ||
| if (innerTag) { | ||
| const innerchildTag: any = getValue('child' + innerTag.substring(0, 1).toUpperCase() + innerTag.substring(1), innerchild.list[parseInt(j.toString(), 10)]); | ||
| if (innerchildTag) { | ||
| innerchild.list[parseInt(j.toString(), 10)].tagObjects | ||
| .push({ instance: innerchildTag, name: innerTag }); | ||
| innerLevelTag.push(innerchildTag); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| // check for inner level tag | ||
| if (innerLevelTag.length !== 0) { | ||
| for (let l: number = 0; l < innerLevelTag.length; l++) { | ||
| updateChildTag(innerLevelTag[parseInt(l.toString(), 10)]); | ||
| } | ||
| } | ||
| }; | ||
| updateChildTag(innerchildObj); | ||
| tagObject.instance.list[`${h}`].tagObjects.push({ instance: childObj, name: tag }); | ||
| } | ||
| } | ||
| tagObject.instance.list[`${h}`].propCollection[tagObject.instance.propertyName].push(obj); | ||
| } | ||
| } | ||
| // End angular 9 compatibility | ||
| propObj[tagObject.name] = tagObject.instance.getProperties(); | ||
| tempAfterContentThis.setProperties(propObj, tagObject.instance.isInitChanges); | ||
| } else { | ||
| /* istanbul ignore next */ | ||
| let hasDiffLength: boolean = false; | ||
| if ((tempAfterContentThis[tagObject.name].length !== tagObject.instance.list.length) || (/diagram|DashboardLayout/.test(tempAfterContentThis.getModuleName()))) { | ||
| tempAfterContentThis[tagObject.name] = tagObject.instance.list; | ||
| hasDiffLength = true; | ||
| } | ||
| for (const list of tagObject.instance.list) { | ||
| if (list.tags) { | ||
| for (const tag of list.tags) { | ||
| const innerChild: any = getValue('child' + tag.substring(0, 1).toUpperCase() + tag.substring(1), list); | ||
| if (innerChild) { | ||
| list.tagObjects.push({ instance: innerChild, name: tag }); | ||
| } | ||
| } | ||
| } | ||
| const curIndex: number = tagObject.instance.list.indexOf(list); | ||
| const curChild: any = getValue(tagObject.name, tempAfterContentThis)[`${curIndex}`]; | ||
| let complexTemplates: string[] = Object.keys(curChild); | ||
| complexTemplates = complexTemplates.filter((val: string): boolean => { | ||
| return /Ref$/i.test(val); | ||
| }); | ||
| if (curChild.properties && Object.keys(curChild.properties).length !== 0){ | ||
| for (let complexPropName of complexTemplates) { | ||
| complexPropName = complexPropName.replace(/Ref/, ''); | ||
| curChild.properties[`${complexPropName}`] = !curChild.properties[`${complexPropName}`] ? | ||
| curChild.propCollection[`${complexPropName}`] : curChild.properties[`${complexPropName}`]; | ||
| } | ||
| } | ||
| if (!isUndefined(curChild) && !isUndefined(curChild.setProperties)) { | ||
| if (/diagram|DashboardLayout/.test(tempAfterContentThis.getModuleName())) { | ||
| curChild.setProperties(list.getProperties(), true); | ||
| } else { | ||
| curChild.setProperties(list.getProperties()); | ||
| } | ||
| } | ||
| list.isUpdated = true; | ||
| } | ||
| if ((/grid/.test(tempAfterContentThis.getModuleName()) && hasDiffLength) || /chart/.test(tempAfterContentThis.getModuleName())) { | ||
| propObj[tagObject.name] = tagObject.instance.getProperties(); | ||
| tempAfterContentThis.setProperties(propObj, tagObject.instance.isInitChanges); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| protected registerEvents(eventList: string[]): void { | ||
| registerEvents(eventList, this); | ||
| } | ||
| protected twoWaySetter(newVal: Object, prop: string): void { | ||
| const oldVal: Object = getValue(prop, this.properties); | ||
| if (oldVal === newVal) { | ||
| return; | ||
| } | ||
| this.saveChanges(prop, newVal, oldVal); | ||
| setValue(prop, (isNullOrUndefined(newVal) ? null : newVal), this.properties); | ||
| getValue(prop + 'Change', this).emit(newVal); | ||
| } | ||
| protected addTwoWay(propList: string[]): void { | ||
| for (const prop of propList) { | ||
| getValue(prop, this); | ||
| Object.defineProperty(this, prop, { | ||
| get: () => { | ||
| return getValue(prop, this.properties); | ||
| }, | ||
| set: (newVal: Object) => this.twoWaySetter(newVal, prop) | ||
| }); | ||
| setValue(prop + 'Change', new EventEmitter(), this); | ||
| } | ||
| } | ||
| public addEventListener(eventName: string, handler: Function): void { | ||
| const eventObj: EventEmitter<Object> = getValue(eventName, this); | ||
| if (!isUndefined(eventObj)) { | ||
| if (!this.ngBoundedEvents[`${eventName}`]) { | ||
| this.ngBoundedEvents[`${eventName}`] = new Map(); | ||
| } | ||
| this.ngBoundedEvents[`${eventName}`].set(handler, eventObj.subscribe(handler)); | ||
| } | ||
| } | ||
| public removeEventListener(eventName: string, handler: Function): void { | ||
| const eventObj: EventEmitter<Object> = getValue(eventName, this); | ||
| if (!isUndefined(eventObj)) { | ||
| (<EventEmitter<object>>this.ngBoundedEvents[`${eventName}`].get(handler)).unsubscribe(); | ||
| } | ||
| } | ||
| public trigger(eventName: string, eventArgs: Object, success?: Function): void { | ||
| const eventObj: { next: Function } = getValue(eventName, this); | ||
| const prevDetection: boolean = this.isProtectedOnChange; | ||
| this.isProtectedOnChange = false; | ||
| if (eventArgs) { | ||
| (<{ name: string }>eventArgs).name = eventName; | ||
| } | ||
| if (!isUndefined(eventObj)) { | ||
| eventObj.next(eventArgs); | ||
| } | ||
| const localEventObj: Function = getValue('local' + eventName.charAt(0).toUpperCase() + eventName.slice(1), this); | ||
| if (!isUndefined(localEventObj)) { | ||
| localEventObj.call(this, eventArgs); | ||
| } | ||
| this.isProtectedOnChange = prevDetection; | ||
| /* istanbul ignore else */ | ||
| if (success) { | ||
| this.preventChange = this.isPreventChange; | ||
| success.call(this, eventArgs); | ||
| } | ||
| this.isPreventChange = false; | ||
| } | ||
| } |
| import { EventEmitter, ChangeDetectorRef } from '@angular/core'; | ||
| import { ControlValueAccessor } from '@angular/forms'; | ||
| /** | ||
| * Angular Form Base Module | ||
| */ | ||
| export declare class FormBase<T> implements ControlValueAccessor { | ||
| value: T; | ||
| checked: boolean; | ||
| private skipFromEvent; | ||
| static readonly isFormBase: boolean; | ||
| propagateChange(_?: T): void; | ||
| propagateTouch(): void; | ||
| enabled: Object; | ||
| disabled: Object; | ||
| angularValue: T; | ||
| private isFormInit; | ||
| objCheck: boolean; | ||
| duplicateValue: string; | ||
| duplicateAngularValue: string; | ||
| element: HTMLElement; | ||
| inputElement: HTMLInputElement; | ||
| private ngEle; | ||
| appendTo: (ele: string | HTMLElement) => void; | ||
| focus: EventEmitter<Object>; | ||
| blur: EventEmitter<Object>; | ||
| preventChange: boolean; | ||
| isUpdated: boolean; | ||
| oldValue: any; | ||
| cdr: ChangeDetectorRef; | ||
| ngOnBlurBound: () => void; | ||
| ngOnFocusBound: () => void; | ||
| localChange(e: { | ||
| value?: T; | ||
| checked?: T; | ||
| }): void; | ||
| properties: Object; | ||
| saveChanges: Function; | ||
| registerOnChange(registerFunction: (_: T) => void): void; | ||
| registerOnTouched(registerFunction: () => void): void; | ||
| twoWaySetter(newVal: Object, prop: string): void; | ||
| ngAfterViewInit(isTempRef?: any): void; | ||
| setDisabledState(disabled: boolean): void; | ||
| writeValue(value: T): void; | ||
| ngOnFocus(e: Event): void; | ||
| ngOnBlur(e: Event): void; | ||
| } |
| /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types */ | ||
| import { EventEmitter, ElementRef, ChangeDetectorRef } from '@angular/core'; | ||
| import { getValue, setValue, isNullOrUndefined, isObject } from '@syncfusion/ej2-base'; | ||
| import { ControlValueAccessor } from '@angular/forms'; | ||
| /** | ||
| * Angular Form Base Module | ||
| */ | ||
| export class FormBase<T> implements ControlValueAccessor { | ||
| public value: T; | ||
| public checked: boolean; | ||
| private skipFromEvent: boolean; | ||
| static readonly isFormBase: boolean = true; | ||
| public propagateChange(_?: T): void { return; } | ||
| public propagateTouch(): void { return; } | ||
| public enabled: Object; | ||
| public disabled: Object; | ||
| public angularValue: T; | ||
| private isFormInit: boolean; | ||
| public objCheck: boolean; | ||
| public duplicateValue: string; | ||
| public duplicateAngularValue: string; | ||
| public element: HTMLElement; | ||
| public inputElement: HTMLInputElement; | ||
| private ngEle: ElementRef; | ||
| public appendTo: (ele: string | HTMLElement) => void; | ||
| public focus: EventEmitter<Object>; | ||
| public blur: EventEmitter<Object>; | ||
| public preventChange: boolean; | ||
| public isUpdated: boolean; | ||
| public oldValue: any; | ||
| public cdr: ChangeDetectorRef; | ||
| public ngOnBlurBound: () => void; | ||
| public ngOnFocusBound: () => void; | ||
| public localChange(e: { value?: T, checked?: T }): void { | ||
| const value: T | any = (e.checked === undefined ? e.value : e.checked); | ||
| this.objCheck = isObject(value); | ||
| if (this.isUpdated === true) { | ||
| this.angularValue = this.oldValue; | ||
| } | ||
| if (this.objCheck === true) { | ||
| this.duplicateValue = JSON.stringify(value); | ||
| this.duplicateAngularValue = JSON.stringify(this.angularValue); | ||
| if (this.duplicateValue !== this.duplicateAngularValue && this.propagateChange !== undefined && value !== undefined) { | ||
| // Update angular from our control | ||
| this.propagateChange(value); | ||
| this.angularValue = value; | ||
| } | ||
| } else { | ||
| if (value !== this.angularValue && this.propagateChange !== undefined && value !== undefined) { | ||
| // While reset form using reset() method ng-dirty not get updated, so while value is empty just update angularValue only | ||
| if (value !== '' && value !== null) { | ||
| // Update angular from our control | ||
| this.propagateChange(value); | ||
| this.angularValue = value; | ||
| } else { | ||
| const optionalValue: any = value; | ||
| this.propagateChange(optionalValue); | ||
| this.angularValue = value; | ||
| } | ||
| } | ||
| } | ||
| this.cdr.markForCheck(); | ||
| } | ||
| public properties: Object; | ||
| public saveChanges: Function; | ||
| public registerOnChange(registerFunction: (_: T) => void): void { | ||
| this.propagateChange = registerFunction; | ||
| } | ||
| public registerOnTouched(registerFunction: () => void): void { | ||
| this.propagateTouch = registerFunction; | ||
| } | ||
| public twoWaySetter(newVal: Object, prop: string): void { | ||
| const oldVal: Object = this.oldValue || getValue(prop, this.properties); | ||
| const ele: HTMLElement = this.inputElement || this.element; | ||
| if (ele && oldVal === newVal && this.value === newVal && | ||
| ((<HTMLInputElement>ele).value === undefined || (<HTMLInputElement>ele).value === '')) { | ||
| return; | ||
| } | ||
| this.saveChanges(prop, newVal, oldVal); | ||
| setValue(prop, (isNullOrUndefined(newVal) ? null : newVal), this.properties); | ||
| getValue(prop + 'Change', this).emit(newVal); | ||
| } | ||
| public ngAfterViewInit(isTempRef?: any): void { | ||
| const tempFormAfterViewThis: any = isTempRef || this; | ||
| // Used setTimeout for template binding | ||
| // Refer Link: https://github.com/angular/angular/issues/6005 | ||
| // Removed setTimeout, Because we have called markForCheck() method in Angular Template Compiler | ||
| /* istanbul ignore else */ | ||
| tempFormAfterViewThis.ngOnBlurBound = this.ngOnBlur.bind(this); | ||
| tempFormAfterViewThis.ngOnFocusBound = this.ngOnFocus.bind(this); | ||
| if (typeof window !== 'undefined') { | ||
| if ((tempFormAfterViewThis.getModuleName()).includes('dropdowntree')) { | ||
| setTimeout(function (): any { | ||
| tempFormAfterViewThis.appendTo(tempFormAfterViewThis.element); | ||
| }); | ||
| } | ||
| else { | ||
| tempFormAfterViewThis.appendTo(tempFormAfterViewThis.element); | ||
| } | ||
| const ele: HTMLElement = tempFormAfterViewThis.inputElement || tempFormAfterViewThis.element; | ||
| ele.addEventListener('focus', tempFormAfterViewThis.ngOnFocusBound); | ||
| ele.addEventListener('blur', tempFormAfterViewThis.ngOnBlurBound); | ||
| } | ||
| this.isFormInit = false; | ||
| } | ||
| public setDisabledState(disabled: boolean): void { | ||
| this.enabled = !disabled; | ||
| this.disabled = disabled; | ||
| } | ||
| public writeValue(value: T): void { | ||
| const regExp: RegExp = /ejs-radiobutton/g; | ||
| //update control value from angular | ||
| if (this.checked === undefined) { | ||
| this.value = value; | ||
| } else { | ||
| // To resolve boolean type formControl value is not working for radio button control. | ||
| /* istanbul ignore next */ | ||
| if (this.ngEle) { | ||
| if (typeof value === 'boolean') { | ||
| if (regExp.test(this.ngEle.nativeElement.outerHTML)) { | ||
| this.checked = value === this.value; | ||
| } else { | ||
| this.checked = value; | ||
| } | ||
| } else { | ||
| this.checked = value === this.value; | ||
| } | ||
| } | ||
| } | ||
| const isNullValue: boolean = this.angularValue == null; | ||
| this.angularValue = value; | ||
| this.isUpdated = true; | ||
| // When binding Html textbox value to syncfusion textbox, change event triggered dynamically. | ||
| // To prevent change event, trigger change in component side based on `preventChange` value | ||
| this.preventChange = this.isFormInit ? false : true; | ||
| this.cdr.markForCheck(); | ||
| if (value === null) { | ||
| if (isNullValue) { | ||
| this.preventChange = false; | ||
| } | ||
| return; | ||
| } | ||
| } | ||
| public ngOnFocus(e: Event): void { | ||
| /* istanbul ignore else */ | ||
| if (this.skipFromEvent !== true) { | ||
| this.focus.emit(e); | ||
| } | ||
| this.cdr.markForCheck(); | ||
| } | ||
| public ngOnBlur(e: Event): void { | ||
| this.propagateTouch(); | ||
| /* istanbul ignore else */ | ||
| if (this.skipFromEvent !== true) { | ||
| this.blur.emit(e); | ||
| } | ||
| this.cdr.markForCheck(); | ||
| } | ||
| } |
| /** | ||
| * Index | ||
| */ | ||
| export * from './complex-array-base'; | ||
| export * from './component-base'; | ||
| export * from './form-base'; | ||
| export * from './util'; | ||
| export * from './template'; |
| /** | ||
| * Index | ||
| */ | ||
| export * from './complex-array-base'; | ||
| export * from './component-base'; | ||
| export * from './form-base'; | ||
| export * from './util'; | ||
| export * from './template'; |
| import { ElementRef } from '@angular/core'; | ||
| /** | ||
| * Angular Template Compiler | ||
| * | ||
| * @param {AngularElementType} templateEle - The element representing the template. | ||
| * @param {Object} [helper] - Optional helper object. | ||
| * @returns {Function} A function that compiles the template. | ||
| */ | ||
| export declare function compile(templateEle: AngularElementType, helper?: Object): (data: Object | JSON, component?: any, propName?: any) => Object; | ||
| /** | ||
| * Property decorator for angular. | ||
| * | ||
| * @param {Object} [defaultValue] - Default value for the property. | ||
| * @returns {PropertyDecorator} The decorator function. | ||
| */ | ||
| export declare function Template(defaultValue?: Object): PropertyDecorator; | ||
| export interface AngularElementType { | ||
| elementRef: ElementRef; | ||
| } |
| /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
| import { ViewContainerRef, EmbeddedViewRef, ElementRef, TemplateRef } from '@angular/core'; | ||
| import { setTemplateEngine, getTemplateEngine } from '@syncfusion/ej2-base'; | ||
| import { setValue, getValue } from '@syncfusion/ej2-base'; | ||
| const stringCompiler: (template: string | Function, helper?: object) => (data: Object | JSON) => string = getTemplateEngine(); | ||
| /** | ||
| * Angular Template Compiler | ||
| * | ||
| * @param {AngularElementType} templateEle - The element representing the template. | ||
| * @param {Object} [helper] - Optional helper object. | ||
| * @returns {Function} A function that compiles the template. | ||
| */ | ||
| export function compile(templateEle: AngularElementType, helper?: Object): | ||
| (data: Object | JSON, component?: any, propName?: any) => Object { | ||
| if (typeof templateEle === 'string' || (typeof templateEle === 'function' && (templateEle as Function).prototype && (templateEle as Function).prototype.CSPTemplate)) { | ||
| return stringCompiler(templateEle, helper); | ||
| } else { | ||
| const contRef: ViewContainerRef = templateEle.elementRef.nativeElement._viewContainerRef; | ||
| const pName: string = templateEle.elementRef.nativeElement.propName; | ||
| return (data: Object, component?: any, propName?: any): Object => { | ||
| const context: Object = { $implicit: data }; | ||
| /* istanbul ignore next */ | ||
| const conRef: ViewContainerRef = contRef ? contRef : component.viewContainerRef; | ||
| const viewRef: EmbeddedViewRef<Object> = conRef.createEmbeddedView(templateEle as TemplateRef<Object>, context); | ||
| if (/EJS-MENTION|EJS-DROPDOWNLIST/.test(getValue('currentInstance.element.nodeName', conRef)) || | ||
| (/E-TABITEM/.test(getValue('element.nativeElement.nodeName', conRef)) && | ||
| getValue('currentInstance.headerTemplateRef', conRef))) { | ||
| viewRef.detectChanges(); | ||
| } else { | ||
| viewRef.markForCheck(); | ||
| } | ||
| /* istanbul ignore next */ | ||
| const viewCollection: { [key: string]: EmbeddedViewRef<Object>[] } = (component && component.registeredTemplate) ? | ||
| component.registeredTemplate : getValue('currentInstance.registeredTemplate', conRef); | ||
| propName = (propName && component.registeredTemplate) ? propName : pName; | ||
| if (typeof viewCollection[`${propName}`] === 'undefined') { | ||
| viewCollection[`${propName}`] = []; | ||
| } | ||
| viewCollection[`${propName}`].push(viewRef); | ||
| return viewRef.rootNodes; | ||
| }; | ||
| } | ||
| } | ||
| /** | ||
| * Property decorator for angular. | ||
| * | ||
| * @param {Object} [defaultValue] - Default value for the property. | ||
| * @returns {PropertyDecorator} The decorator function. | ||
| */ | ||
| export function Template(defaultValue?: Object): PropertyDecorator { | ||
| return (target: Object, key: string) => { | ||
| const propertyDescriptor: Object = { | ||
| set: setter(key), | ||
| get: getter(key, defaultValue), | ||
| enumerable: true, | ||
| configurable: true | ||
| }; | ||
| Object.defineProperty(target, key, propertyDescriptor); | ||
| }; | ||
| } | ||
| /** | ||
| * Creates a setter function for a given property key. | ||
| * | ||
| * @param {string} key - The property key. | ||
| * @returns {Function} The setter function. | ||
| */ | ||
| function setter(key: string): Function { | ||
| return function (val: any): void { | ||
| if (val === undefined) { return; } | ||
| setValue(key + 'Ref', val, this); | ||
| if (typeof val !== 'string' && !(typeof val === 'function' && (val as Function).prototype && (val as Function).prototype.CSPTemplate)) { | ||
| (val as any).elementRef.nativeElement._viewContainerRef = this.viewContainerRef; | ||
| (val as any).elementRef.nativeElement.propName = key; | ||
| } else { | ||
| if (this.saveChanges) { | ||
| this.saveChanges(key, val, undefined); | ||
| this.dataBind(); | ||
| } | ||
| } | ||
| }; | ||
| } | ||
| /** | ||
| * Returns a getter function for the specified key and default value. | ||
| * | ||
| * @param {string} key - The key for the property. | ||
| * @param {Object} defaultValue - The default value for the property. | ||
| * @returns {Function} The getter function. | ||
| */ | ||
| function getter(key: string, defaultValue: Object): Function { | ||
| return function (): Object { | ||
| /* istanbul ignore next */ | ||
| return getValue(key + 'Ref', this) || defaultValue; | ||
| }; | ||
| } | ||
| export interface AngularElementType { | ||
| elementRef: ElementRef; | ||
| } | ||
| setTemplateEngine({ compile: (compile as any) }); |
| /** | ||
| * Angular Utility Module | ||
| * | ||
| * @param {Function} derivedClass The derived class to which mixins are applied. | ||
| * @param {Function[]} baseClass An array of base classes whose methods are applied as mixins. | ||
| * @returns {void} | ||
| */ | ||
| export declare function applyMixins(derivedClass: any, baseClass: any[]): void; | ||
| /** | ||
| * Decorator function to apply mixins to a derived class. | ||
| * | ||
| * @param {Function[]} baseClass - An array of mixin classes to be applied to the derived class. | ||
| * @returns {ClassDecorator} The decorator function. | ||
| */ | ||
| export declare function ComponentMixins(baseClass: Function[]): ClassDecorator; | ||
| /** | ||
| * Registers events. | ||
| * | ||
| * @private | ||
| * @param {string[]} eventList - The list of events to register. | ||
| * @param {any} obj - The object on which to register the events. | ||
| * @param {boolean} [direct] - Whether to register events directly on the object or not. | ||
| * @returns {void} | ||
| */ | ||
| export declare function registerEvents(eventList: string[], obj: any, direct?: boolean): void; | ||
| /** | ||
| * Clears registered templates. | ||
| * | ||
| * @private | ||
| * @param {any} _this - The context object. | ||
| * @param {string[]} [templateNames] - Optional. An array of template names to clear. | ||
| * @param {any[]} [index] - Optional. An array of indices specifying templates to clear. | ||
| * @returns {void} | ||
| */ | ||
| export declare function clearTemplate(_this: any, templateNames?: string[], index?: any): void; | ||
| /** | ||
| * To set value for the nameSpace in desired object. | ||
| * | ||
| * @param {string} nameSpace - String value to get the inner object. | ||
| * @param {any} value - Value that you need to set. | ||
| * @param {any} object - Object to get the inner object value. | ||
| * @returns {void} | ||
| * @private | ||
| */ | ||
| export declare function setValue(nameSpace: string, value: any, object: any): any; | ||
| export interface PropertyCollectionInfo { | ||
| props: PropertyDetails[]; | ||
| complexProps: PropertyDetails[]; | ||
| colProps: PropertyDetails[]; | ||
| events: PropertyDetails[]; | ||
| propNames: string[]; | ||
| complexPropNames: string[]; | ||
| colPropNames: string[]; | ||
| eventNames: string[]; | ||
| } | ||
| export interface PropertyDetails { | ||
| propertyName: string; | ||
| type: FunctionConstructor | Object; | ||
| defaultValue: Object; | ||
| } |
-177
| /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types */ | ||
| import { EventEmitter } from '@angular/core'; | ||
| import { isNullOrUndefined } from '@syncfusion/ej2-base'; | ||
| /** | ||
| * Angular Utility Module | ||
| * | ||
| * @param {Function} derivedClass The derived class to which mixins are applied. | ||
| * @param {Function[]} baseClass An array of base classes whose methods are applied as mixins. | ||
| * @returns {void} | ||
| */ | ||
| export function applyMixins(derivedClass: any, baseClass: any[]): void { | ||
| baseClass.forEach((baseClass: any) => { | ||
| Object.getOwnPropertyNames(baseClass.prototype).forEach((name: string) => { | ||
| if (!Object.prototype.hasOwnProperty.call(derivedClass.prototype, name) || (baseClass.isFormBase && name !== 'constructor')) { | ||
| derivedClass.prototype[`${name}`] = baseClass.prototype[`${name}`]; | ||
| } | ||
| }); | ||
| }); | ||
| } | ||
| /** | ||
| * Decorator function to apply mixins to a derived class. | ||
| * | ||
| * @param {Function[]} baseClass - An array of mixin classes to be applied to the derived class. | ||
| * @returns {ClassDecorator} The decorator function. | ||
| */ | ||
| export function ComponentMixins(baseClass: Function[]): ClassDecorator { | ||
| return function (derivedClass: Function): void { | ||
| applyMixins(derivedClass, baseClass); | ||
| }; | ||
| } | ||
| /** | ||
| * Registers events. | ||
| * | ||
| * @private | ||
| * @param {string[]} eventList - The list of events to register. | ||
| * @param {any} obj - The object on which to register the events. | ||
| * @param {boolean} [direct] - Whether to register events directly on the object or not. | ||
| * @returns {void} | ||
| */ | ||
| export function registerEvents(eventList: string[], obj: any, direct?: boolean): void { | ||
| const ngEventsEmitter: { [key: string]: Object } = {}; | ||
| if (eventList && eventList.length) { | ||
| for (const event of eventList) { | ||
| if (direct === true) { | ||
| obj.propCollection[`${event}`] = new EventEmitter(false); | ||
| obj[`${event}`] = obj.propCollection[`${event}`]; | ||
| } else { | ||
| ngEventsEmitter[`${event}`] = new EventEmitter(false); | ||
| } | ||
| } | ||
| if (direct !== true) { | ||
| obj.setProperties(ngEventsEmitter, true); | ||
| } | ||
| } | ||
| } | ||
| /** | ||
| * Clears registered templates. | ||
| * | ||
| * @private | ||
| * @param {any} _this - The context object. | ||
| * @param {string[]} [templateNames] - Optional. An array of template names to clear. | ||
| * @param {any[]} [index] - Optional. An array of indices specifying templates to clear. | ||
| * @returns {void} | ||
| */ | ||
| export function clearTemplate(_this: any, templateNames?: string[], index?: any): void { | ||
| const regTemplates: string[] = Object.keys(_this.registeredTemplate); | ||
| if (regTemplates.length) { | ||
| /* istanbul ignore next */ | ||
| const regProperties: string[] = templateNames && templateNames.filter( | ||
| (val: string) => { | ||
| return (/\./g.test(val) ? false : true); | ||
| }); | ||
| const tabaccordionTemp: boolean = /tab|accordion|toolbar/.test(_this.getModuleName?.()); | ||
| for (const registeredTemplate of (regProperties && regProperties || regTemplates)) { | ||
| /* istanbul ignore next */ | ||
| if (index && index.length) { | ||
| for (let e: number = 0; e < index.length; e++) { | ||
| if (tabaccordionTemp) { | ||
| for (let m: number = 0; m < _this.registeredTemplate[`${registeredTemplate}`].length; m++) { | ||
| const value: any = _this.registeredTemplate[`${registeredTemplate}`][parseInt(m.toString(), 10)]; | ||
| if (value && value === index[`${e}`]) { | ||
| value.destroy(); | ||
| _this.registeredTemplate[`${registeredTemplate}`].splice(m, 1); | ||
| } | ||
| } | ||
| } else { | ||
| for (let m: number = 0; m < _this.registeredTemplate.template.length; m++) { | ||
| const value: any = _this.registeredTemplate.template[parseInt(m.toString(), 10)].rootNodes[0]; | ||
| if (value === index[`${e}`]) { | ||
| const rt: any = _this.registeredTemplate[`${registeredTemplate}`]; | ||
| rt[parseInt(m.toString(), 10)].destroy(); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } else { | ||
| if (_this.registeredTemplate[`${registeredTemplate}`]) { | ||
| for (const rt of _this.registeredTemplate[`${registeredTemplate}`]) { | ||
| if (!rt.destroyed) { | ||
| if (rt._view) { | ||
| const pNode: any = rt._view.renderer.parentNode(rt.rootNodes[0]); | ||
| if (!isNullOrUndefined(pNode)) { | ||
| for (let m: number = 0; m < rt.rootNodes.length; m++) { | ||
| pNode.appendChild(rt.rootNodes[parseInt(m.toString(), 10)]); | ||
| } | ||
| } | ||
| } | ||
| rt.destroy(); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| if (!tabaccordionTemp || !index) { | ||
| delete _this.registeredTemplate[`${registeredTemplate}`]; | ||
| } | ||
| } | ||
| } | ||
| for (const tagObject of _this.tagObjects) { | ||
| if (tagObject.instance) { | ||
| /* istanbul ignore next */ | ||
| tagObject.instance.clearTemplate((templateNames && templateNames.filter( | ||
| (val: string) => { | ||
| const regExp: RegExpConstructor = RegExp; | ||
| return (new regExp(tagObject.name).test(val) ? true : false); | ||
| }))); | ||
| } | ||
| } | ||
| } | ||
| /** | ||
| * To set value for the nameSpace in desired object. | ||
| * | ||
| * @param {string} nameSpace - String value to get the inner object. | ||
| * @param {any} value - Value that you need to set. | ||
| * @param {any} object - Object to get the inner object value. | ||
| * @returns {void} | ||
| * @private | ||
| */ | ||
| export function setValue(nameSpace: string, value: any, object: any): any { | ||
| const keys: string[] = nameSpace.replace(/\[/g, '.').replace(/\]/g, '').split('.'); | ||
| /* istanbul ignore next */ | ||
| let fromObj: any = object || {}; | ||
| for (let i: number = 0; i < keys.length; i++) { | ||
| const key: string = keys[parseInt(i.toString(), 10)]; | ||
| if (i + 1 === keys.length) { | ||
| fromObj[`${key}`] = value === undefined ? {} : value; | ||
| } else if (fromObj[`${key}`] === undefined) { | ||
| fromObj[`${key}`] = {}; | ||
| } | ||
| fromObj = fromObj[`${key}`]; | ||
| } | ||
| return fromObj; | ||
| } | ||
| export interface PropertyCollectionInfo { | ||
| props: PropertyDetails[]; | ||
| complexProps: PropertyDetails[]; | ||
| colProps: PropertyDetails[]; | ||
| events: PropertyDetails[]; | ||
| propNames: string[]; | ||
| complexPropNames: string[]; | ||
| colPropNames: string[]; | ||
| eventNames: string[]; | ||
| } | ||
| export interface PropertyDetails { | ||
| propertyName: string; | ||
| type: FunctionConstructor | Object; | ||
| defaultValue: Object; | ||
| } |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
0
-100%631467
-8.88%99
-10.81%6155
-17.48%1
Infinity%