UNPKG

@cause-911/devextreme

Version:

Run `npm install @cause-911/devextreme --save` to add this library to your project

2 lines 17.4 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("devextreme-angular"),require("@angular/platform-browser"),require("@angular/common"),require("@cause-911/core")):"function"==typeof define&&define.amd?define("@cause-911/devextreme",["exports","@angular/core","devextreme-angular","@angular/platform-browser","@angular/common","@cause-911/core"],e):e(((t=t||self)["cause-911"]=t["cause-911"]||{},t["cause-911"].devextreme={}),t.ng.core,t.devextremeAngular,t.ng.platformBrowser,t.ng.common,t.core$1)}(this,function(t,e,n,o,i,a){"use strict";var s=function(t,e){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function r(t,e){function n(){this.constructor=t}s(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var l=function(t){function a(e,n,o,i,a,s,r,l,c,p){var u=t.call(this,e,n,o,i,a,s,r,l)||this;return u.location=c,u.locationStrategy=p,u.allowPrint=!0,u.hoverStateEnabled=!0,u.rowAlternationEnabled=!0,u.showBorders=!0,u.export={allowExportSelectedData:!1,enabled:!0,fileName:"export"},u.filterRow={visible:!0},u.pager={showPageSizeSelector:!0,showNavigationButtons:!0,showInfo:!0,visible:!0},u.isEditing=!1,s.setHost(u),p.onPopState(function(){u.isEditing&&(u.isEditing=!1,u.instance.cancelEditData())}),u}return r(a,t),a.prototype.ngOnInit=function(){var e=this;t.prototype.ngOnInit.call(this),this.onToolbarPreparing.subscribe(function(t){return e.toolbarPreparing(t)}),this.onInitialized.subscribe(function(t){return e.initialized(t)})},a.prototype.toolbarPreparing=function(t){var e=this,n=t.toolbarOptions.items;this.allowPrint&&n.push({widget:"dxButton",location:"after",options:{icon:"print",onClick:function(n){e.print(t.element)}}})},a.prototype.initialized=function(t){var e=this,n=t.component.option("editing");n.popup.onShowing=function(t){e.location.go(e.location.path()+"#editing"),e.isEditing=!0},n.popup.onHiding=function(t){e.isEditing&&e.location.back(),e.isEditing=!1}},a.prototype.print=function(t){t.classList.add("only-div-to-print"),window.print(),setTimeout(function(){t.classList.remove("only-div-to-print")},1e3)},a.decorators=[{type:e.Component,args:[{selector:"cause-dx-data-grid",template:"<ng-content></ng-content>",providers:[n.NestedOptionHost,i.Location,{provide:i.LocationStrategy,useClass:i.PathLocationStrategy}],styles:[""]}]}],a.ctorParameters=function(){return[{type:e.ElementRef},{type:e.NgZone},{type:n.DxTemplateHost},{type:n.WatcherHelper},{type:n.IterableDifferHelper},{type:n.NestedOptionHost},{type:o.TransferState},{type:e.PlatformRef},{type:i.Location},{type:i.LocationStrategy}]},a.propDecorators={allowPrint:[{type:e.Input}]},a}(n.DxDataGridComponent),c=function(t){function i(e,n,o,i,a,s,r,l){var c=t.call(this,e,n,o,i,a,s,r,l)||this;return c.type="datetime",c.displayFormat="dd/MM/yyyy HH:mm",c.openOnFieldClick=!0,c}return r(i,t),i.prototype.ngOnInit=function(){t.prototype.ngOnInit.call(this)},i.decorators=[{type:e.Component,args:[{selector:"cause-dx-date-box",template:"",styles:[""]}]}],i.ctorParameters=function(){return[{type:e.ElementRef},{type:e.NgZone},{type:n.DxTemplateHost},{type:n.WatcherHelper},{type:n.IterableDifferHelper},{type:n.NestedOptionHost},{type:o.TransferState},{type:e.PlatformRef}]},i}(n.DxDateBoxComponent),p=function(){function t(){this.value="",this.maxChar=225,this.format="text",this.valueChanged=new e.EventEmitter,this.gsm7bitChars="@£$¥èéùìòÇ\\nØø\\rÅåΔ_ΦΓΛΩΠΨΣΘΞÆæßÉ !\\\"#¤%&'()*+,-./0123456789:;<=>?¡ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÑܧ¿abcdefghijklmnopqrstuvwxyzäöñüà",this.gsm7bitCharsExt="\\^{}\\\\\\[~\\]|€",this.gsm7bitRegExp=RegExp("^["+this.gsm7bitChars+"]*$"),this.gsm7bitExtRegExp=RegExp("^["+this.gsm7bitChars+this.gsm7bitCharsExt+"]*$"),this.gsm7bitExtOnlyRegExp=RegExp("^["+this.gsm7bitCharsExt+"]*$"),this.messageLength={GSM7:160,GSM7ext:160,UTF16:70},this.multiMessageLength={GSM7:153,GSM7ext:153,UTF16:67}}return t.prototype.ngOnInit=function(){"sms"===this.format&&(this.maxChar=0)},t.prototype.changed=function(t){this.value=t.value,this.valueChanged.emit(t)},t.prototype.getNumberOfSms=function(){if(!this.value)return 0;var t=this.countSmsChars(this.value),e=this.getCharset(this.value),n=t>this.messageLength[e]?this.multiMessageLength[e]:this.messageLength[e];return Math.ceil(t/n)},t.prototype.getNumberOfChar=function(){return(this.value?this.value.length:0)+"/"+this.maxChar},t.prototype.countSmsChars=function(t){var e=t.length;return"GSM7ext"===this.getCharset(t)&&(e+=this.countGsm7bitExt(t)),e},t.prototype.countGsm7bitExt=function(t){var e,n=this;return function(){var o,i,a;for(a=[],o=0,i=t.length;o<i;o++)null!=(e=t[o]).match(n.gsm7bitExtOnlyRegExp)&&a.push(e);return a}.length},t.prototype.getCharset=function(t){switch(!1){case null==t.match(this.gsm7bitRegExp):return"GSM7";case null==t.match(this.gsm7bitExtRegExp):return"GSM7ext";default:return"UTF16"}},t.decorators=[{type:e.Component,args:[{selector:"cause-dx-text-area-limited",template:'<dx-text-area\n [(value)]="value"\n [maxLength]="maxChar"\n minHeight="50"\n valueChangeEvent="keyup"\n [autoResizeEnabled]="true"\n (onValueChanged)="changed($event)">\n</dx-text-area>\n<div class="limit">\n <span *ngIf="format === \'sms\'">{{\'devextreme.numberOfSms\' | translate}} : {{getNumberOfSms()}}</span>\n <span *ngIf="format === \'text\'">{{\'devextreme.numberOfChar\' | translate}} : {{getNumberOfChar()}}</span>\n</div>\n',styles:[".limit{color:#999;font-size:.8em;text-align:right}"]}]}],t.ctorParameters=function(){return[]},t.propDecorators={textarea:[{type:e.ViewChild,args:[n.DxTextAreaComponent,{static:!1}]}],value:[{type:e.Input}],maxChar:[{type:e.Input}],format:[{type:e.Input}],valueChanged:[{type:e.Output}]},t}(),u=function(){function t(t,n){this.translate=n,this.valueChange=new e.EventEmitter,this.isValid=!0,this.isValidLang={},this.tabs=[],this.selectedIndex=0,this.values=[],this.validation={isRequired:!1},this.config=t.getConfig()}return Object.defineProperty(t.prototype,"isRequired",{get:function(){return this.validation.isRequired},set:function(t){this.validation.isRequired=t,this.validate()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this.values},set:function(t){var e,n;if("string"==typeof t||void 0===t)try{for(var o=function(t){var e="function"==typeof Symbol&&t[Symbol.iterator],n=0;return e?e.call(t):{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}(this.config.languages),i=o.next();!i.done;i=o.next()){var a=i.value,s={};s.languageCode=a,s[this.localizationField]=t||"",this.values.push(s)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}else"object"==typeof t&&(this.values=t)},enumerable:!0,configurable:!0}),t.prototype.ngOnInit=function(){var t=this;this.translate.get(this.config.languages).subscribe(function(e){for(var n in e)e[n]&&(t.isValidLang[n]=!0,t.tabs.push({languageCode:n,text:e[n]}))})},t.prototype.getLocalizationIndex=function(t){var e=this.values.findIndex(function(e){return e.languageCode===t});if(-1===e){var n={};return n.languageCode=t,n[this.localizationField]="",this.values.push(n),this.values.length-1}return e},t.prototype.validate=function(){var t=this,e=!0;this.config.languages.forEach(function(n){var o=t.values.findIndex(function(t){return t.languageCode===n});!t.validation.isRequired||-1!==o&&t.values[o][t.localizationField]?t.isValidLang[n]=!0:(e=!1,t.isValidLang[n]=!1)}),this.isValid=e},t.prototype.onTagChanged=function(t){this.validate()},t.prototype.onValueChanged=function(){this.validate(),this.valueChange.emit(this.values)},t.decorators=[{type:e.Component,args:[{selector:"cause-dx-text-box-multiple-langue",template:'<dx-tab-panel\n [dataSource]="tabs"\n [selectedIndex]="selectedIndex"\n (onSelectionChanged)="onTagChanged($event)">\n <div *dxTemplate="let lang of \'title\'">\n <span [class]="isValidLang[lang.languageCode] ? \'\' : \'text-error\'">{{lang.text}}</span>\n <span *ngIf="!isValidLang[lang.languageCode]" class="icon-error">\n <i class="dx-icon-info"></i>\n </span>\n </div>\n <div *dxTemplate="let lang of \'item\'">\n <div *ngIf="localizationField">\n <dx-text-box\n [placeholder]="lang.text"\n [(value)]="value[getLocalizationIndex(lang.languageCode)][localizationField]"\n valueChangeEvent="keyup"\n (onValueChanged)="onValueChanged()">\n </dx-text-box>\n </div>\n <div *ngIf="!localizationField">\n <dx-text-box\n [placeholder]="lang.text"\n [(value)]="value[lang.languageCode]"\n valueChangeEvent="keyup"\n (onValueChanged)="onValueChanged()">\n </dx-text-box>\n </div>\n </div>\n</dx-tab-panel>\n',styles:[".text-error{color:#d9534f}.icon-error{color:#fff;border-radius:50%;margin-left:.5em;background-color:#d9534f}"]}]}],t.ctorParameters=function(){return[{type:a.CoreService},{type:a.TranslateService}]},t.propDecorators={valueChange:[{type:e.Output}],localizationField:[{type:e.Input}],isRequired:[{type:e.Input,args:["isRequired"]}],value:[{type:e.Input,args:["value"]}]},t}(),h=function(){function t(){}return t.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[]},t.ngInjectableDef=e.ɵɵdefineInjectable({factory:function(){return new t},token:t,providedIn:"root"}),t}(),d=function(){function t(){}return t.prototype.ngOnInit=function(){},t.decorators=[{type:e.Component,args:[{selector:"cause-devextreme",template:"<div>{{'core.noGenericComponentOnThisLibrary' | translate}}</div>"}]}],t.ctorParameters=function(){return[]},t}(),m=function(){function t(n,o){var i;this.zone=n,this.translate=o,this.title="",this.text="",this.showTitle=!1,this.visibleChange=new e.EventEmitter,this.ok=new e.EventEmitter,this.cancel=new e.EventEmitter,this.done=new e.EventEmitter,this.barItems=((i={}).ok={widget:"dxButton",location:"center",visible:!0,options:{text:""},toolbar:"bottom",parent:this,onClick:t.onOkClick},i.cancel={widget:"dxButton",location:"center",visible:!0,options:{text:""},toolbar:"bottom",parent:this,onClick:t.onCancelClick},i.close={widget:"dxButton",location:"center",visible:!0,options:{text:""},toolbar:"bottom",parent:this,onClick:t.onCancelClick},i.save={widget:"dxButton",location:"center",visible:!0,options:{text:""},toolbar:"bottom",parent:this,onClick:t.onOkClick},i.yes={widget:"dxButton",location:"center",visible:!0,options:{text:""},toolbar:"bottom",parent:this,onClick:t.onOkClick},i.no={widget:"dxButton",location:"center",visible:!0,options:{text:""},toolbar:"bottom",parent:this,onClick:t.onCancelClick},i),this.botomToolbarItems=[this.barItems.ok],this.translationKeyParent="devextreme.popupconfirm",this.translationKeys=["buttonsave","buttonok","buttoncancel","buttonyes","buttonno","buttonclose"],this.types={ok:"ok",cancel:"cancel",close:"close",yesno:"yesno",okcancel:"okcancel",okclose:"okclose",savecancel:"savecancel"}}return Object.defineProperty(t.prototype,"type",{set:function(t){switch(t){case this.types.cancel:this.botomToolbarItems=[this.barItems.cancel];break;case this.types.close:this.botomToolbarItems=[this.barItems.close];break;case this.types.yesno:this.botomToolbarItems=[this.barItems.yes,this.barItems.no];break;case this.types.okcancel:this.botomToolbarItems=[this.barItems.ok,this.barItems.cancel];break;case this.types.okclose:this.botomToolbarItems=[this.barItems.ok,this.barItems.close];break;case this.types.savecancel:this.botomToolbarItems=[this.barItems.save,this.barItems.cancel];break;default:this.botomToolbarItems=[this.barItems.ok]}},enumerable:!0,configurable:!0}),t.onOkClick=function(t){t.itemData.parent.ok.emit(),t.itemData.parent.done.emit(!0)},t.onCancelClick=function(t){t.itemData.parent.cancel.emit(),t.itemData.parent.done.emit(!1)},t.prototype.ngOnInit=function(){this.getTranslations()},t.prototype.getTranslations=function(){var t=this,e=this.translationKeys.map(function(e){return[t.translationKeyParent,e].join(".")});this.translate.get(e).subscribe(function(e){t.initBarText(e)})},t.prototype.onVisibleChange=function(){this.visibleChange.emit(this.visible)},t.prototype.initBarText=function(t){this.barItems.ok.options.text=t[[this.translationKeyParent,"buttonok"].join(".")],this.barItems.cancel.options.text=t[[this.translationKeyParent,"buttoncancel"].join(".")],this.barItems.save.options.text=t[[this.translationKeyParent,"buttonsave"].join(".")],this.barItems.yes.options.text=t[[this.translationKeyParent,"buttonyes"].join(".")],this.barItems.no.options.text=t[[this.translationKeyParent,"buttonno"].join(".")],this.barItems.close.options.text=t[[this.translationKeyParent,"buttonclose"].join(".")]},t.prototype.popupHidden=function(){this.visible=!1,this.onVisibleChange()},t.decorators=[{type:e.Component,args:[{selector:"cause-popup-confirm",template:'<div>\n <dx-popup\n class="popup"\n [showTitle]="showTitle"\n [title]="title"\n height="auto"\n width="auto"\n [dragEnabled]="false"\n [showCloseButton]="true"\n [closeOnOutsideClick]="false"\n [(visible)]="visible"\n [toolbarItems]="botomToolbarItems"\n (onHidden)="popupHidden()">\n <div>{{text}}</div>\n <ng-content></ng-content>\n </dx-popup>\n</div>\n',styles:[""]}]}],t.ctorParameters=function(){return[{type:e.NgZone},{type:a.TranslateService}]},t.propDecorators={title:[{type:e.Input}],text:[{type:e.Input}],showTitle:[{type:e.Input}],type:[{type:e.Input}],visible:[{type:e.Input}],visibleChange:[{type:e.Output}],ok:[{type:e.Output}],cancel:[{type:e.Output}],done:[{type:e.Output}]},t}(),g=function(){function t(n,o){var i;this.zone=n,this.translate=o,this.title="",this.visibleChange=new e.EventEmitter,this.popupShown=new e.EventEmitter,this.save=new e.EventEmitter,this.barItems=((i={}).ok={widget:"dxButton",location:"after",visible:!0,options:{text:""},toolbar:"bottom",parent:this,onClick:t.onSaveClick},i.save={widget:"dxButton",location:"after",visible:!0,options:{text:""},toolbar:"bottom",parent:this,onClick:t.onSaveClick},i.cancel={widget:"dxButton",location:"after",visible:!0,options:{text:""},toolbar:"bottom",parent:this,onClick:t.onCancelClick},i),this.botomToolbarItems=[this.barItems.save,this.barItems.cancel],this.translationKeyParent="devextreme.popupedit",this.translationKeys=["buttonsave","buttonok","buttoncancel"],this.types={savecancel:"savecancel",okcancel:"okcancel"}}return Object.defineProperty(t.prototype,"type",{set:function(t){switch(t){case this.types.okcancel:this.botomToolbarItems=[this.barItems.ok,this.barItems.cancel];break;default:this.botomToolbarItems=[this.barItems.save,this.barItems.cancel]}},enumerable:!0,configurable:!0}),t.onSaveClick=function(t){t.itemData.parent.save.emit()},t.onCancelClick=function(t){t.itemData.parent.visible=!1,t.itemData.parent.onVisibleChange()},t.prototype.ngOnInit=function(){this.getTranslations()},t.prototype.getTranslations=function(){var t=this,e=this.translationKeys.map(function(e){return[t.translationKeyParent,e].join(".")});this.translate.get(e).subscribe(function(e){t.initBarText(e)})},t.prototype.onVisibleChange=function(){this.visibleChange.emit(this.visible)},t.prototype.initBarText=function(t){this.barItems.save.options.text=t[[this.translationKeyParent,"buttonsave"].join(".")],this.barItems.ok.options.text=t[[this.translationKeyParent,"buttonok"].join(".")],this.barItems.cancel.options.text=t[[this.translationKeyParent,"buttoncancel"].join(".")]},t.prototype.popupHidden=function(){this.visible=!1,this.onVisibleChange()},t.prototype.onShown=function(t){this.popupShown.emit(t)},t.decorators=[{type:e.Component,args:[{selector:"cause-popup-edit",template:'<div>\n <dx-popup\n class="popup"\n [showTitle]="true"\n [title]="title"\n [dragEnabled]="false"\n [showCloseButton]="true"\n [closeOnOutsideClick]="false"\n [(visible)]="visible"\n [toolbarItems]="botomToolbarItems"\n (onHidden)="popupHidden()"\n (onShown)="onShown($event)"\n >\n <ng-content></ng-content>\n </dx-popup>\n</div>\n',styles:[""]}]}],t.ctorParameters=function(){return[{type:e.NgZone},{type:a.TranslateService}]},t.propDecorators={title:[{type:e.Input}],type:[{type:e.Input}],visible:[{type:e.Input}],visibleChange:[{type:e.Output}],popupShown:[{type:e.Output}],save:[{type:e.Output}]},t}(),b=function(){function t(){}return t.decorators=[{type:e.NgModule,args:[{declarations:[d,l,c,m,g,l,p,u],exports:[d,l,c,m,g,p,u,n.DxDataGridModule],imports:[i.CommonModule,a.CauseCoreModule,n.DxDateBoxModule,n.DxDataGridModule,n.DxPopupModule,n.DxTabPanelModule,n.DxTextBoxModule,n.DxTextAreaModule,n.DxValidatorModule],providers:[n.DxTemplateHost,n.WatcherHelper,n.IterableDifferHelper,n.NestedOptionHost]}]}],t}();t.CauseDataGridComponent=l,t.CauseDateBoxComponent=c,t.CauseDxModule=b,t.CauseTextAreaLimitedComponent=p,t.CauseTextBoxMultipleLangueComponent=u,t.DevextremeComponent=d,t.DevextremeService=h,t.ɵa=m,t.ɵb=g,Object.defineProperty(t,"__esModule",{value:!0})}); //# sourceMappingURL=cause-911-devextreme.umd.min.js.map