UNPKG

@pepperi/lib

Version:

This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.0.1.

2 lines 11.5 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@angular/forms"),require("@angular/material/core"),require("@angular/material/form-field"),require("@angular/material/checkbox"),require("@angular/material/icon"),require("@pepperi/lib"),require("@pepperi/lib/icon"),require("@pepperi/lib/field-title"),require("@ngx-translate/core"),require("@angular/cdk/bidi")):"function"==typeof define&&define.amd?define("@pepperi/lib/checkbox",["exports","@angular/core","@angular/common","@angular/forms","@angular/material/core","@angular/material/form-field","@angular/material/checkbox","@angular/material/icon","@pepperi/lib","@pepperi/lib/icon","@pepperi/lib/field-title","@ngx-translate/core","@angular/cdk/bidi"],t):t(((e=e||self).pepperi=e.pepperi||{},e.pepperi.lib=e.pepperi.lib||{},e.pepperi.lib.checkbox={}),e.ng.core,e.ng.common,e.ng.forms,e.ng.material.core,e.ng.material.formField,e.ng.material.checkbox,e.ng.material.icon,e.pepperi.lib,e.pepperi.lib.icon,e.pepperi.lib["field-title"],e.translate,e.ng.cdk.bidi)}(this,(function(e,t,n,i,a,r,l,o,p,c,u,d,s){"use strict";function m(e,n){1&e&&t.ɵɵelementContainer(0)}function g(e,n){if(1&e&&(t.ɵɵelementStart(0,"span",10),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){var i=t.ɵɵnextContext(3);t.ɵɵadvance(1),t.ɵɵtextInterpolate(i.label)}}function f(e,n){if(1&e){var i=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",7),t.ɵɵlistener("click",(function(e){return t.ɵɵrestoreView(i),t.ɵɵnextContext(2).toggleChecked(e)})),t.ɵɵpipe(1,"translate"),t.ɵɵpipe(2,"translate"),t.ɵɵelementStart(3,"button",8),t.ɵɵtext(4),t.ɵɵelementEnd(),t.ɵɵtemplate(5,g,2,1,"span",9),t.ɵɵelementEnd()}if(2&e){var a=t.ɵɵnextContext(2);t.ɵɵproperty("title",(a.label.length>0?a.label+": ":"")+("true"==a.value.toLowerCase()||"1"==a.value?t.ɵɵpipeBind1(1,4,"True"):t.ɵɵpipeBind1(2,6,"False"))),t.ɵɵadvance(3),t.ɵɵproperty("id",a.key),t.ɵɵadvance(1),t.ɵɵtextInterpolate1(" ","true"==a.value.toLowerCase()||"1"==a.value?a.additionalValueObject.CheckedText:a.additionalValueObject.UncheckedText," "),t.ɵɵadvance(1),t.ɵɵproperty("ngIf",a.label.length>0&&a.layoutType!==a.LAYOUT_TYPE.PepperiTable)}}function h(e,n){if(1&e&&(t.ɵɵelementStart(0,"span"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){var i=t.ɵɵnextContext(3);t.ɵɵadvance(1),t.ɵɵtextInterpolate(i.label)}}function b(e,n){if(1&e){var i=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-checkbox",11),t.ɵɵlistener("change",(function(e){return t.ɵɵrestoreView(i),t.ɵɵnextContext(2).onMaterialChange(e)})),t.ɵɵpipe(1,"translate"),t.ɵɵpipe(2,"translate"),t.ɵɵtemplate(3,h,2,1,"span",2),t.ɵɵelementEnd()}if(2&e){var a=t.ɵɵnextContext(2);t.ɵɵproperty("name",a.key)("title",(a.label.length>0?a.label+": ":"")+("true"==a.value.toLowerCase()||"1"==a.value?t.ɵɵpipeBind1(1,5,"True"):t.ɵɵpipeBind1(2,7,"False")))("checked","true"==a.value.toLowerCase()||"1"==a.value)("disabled",a.disabled),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",a.label.length>0&&a.layoutType!==a.LAYOUT_TYPE.PepperiTable)}}var y=function(e,t,n,i,a,r,l){return{disable:e,"pepperi-report-checkbox":t,"pepperi-card-checkbox":n,"one-row":i,"no-title":a,"right-alignment pull-right flip":r,"center-alignment":l}};function x(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3),t.ɵɵtemplate(1,m,1,0,"ng-container",4),t.ɵɵtemplate(2,f,6,8,"ng-template",null,5,t.ɵɵtemplateRefExtractor),t.ɵɵtemplate(4,b,4,9,"ng-template",null,6,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()),2&e){var i=t.ɵɵreference(3),a=t.ɵɵreference(5),r=t.ɵɵnextContext();t.ɵɵpropertyInterpolate("dir","2"==r.xAlignment?"rtl":"ltr"),t.ɵɵproperty("ngClass",t.ɵɵpureFunction7(5,y,r.disabled,r.layoutType===r.LAYOUT_TYPE.PepperiTable&&!r.isActive,r.layoutType===r.LAYOUT_TYPE.PepperiCard,1===r.rowSpan,0==r.label.length,"2"==r.xAlignment,"3"==r.xAlignment)),t.ɵɵadvance(1),t.ɵɵproperty("ngIf","booleanText"==r.type)("ngIfThen",i)("ngIfElse",a)}}function v(e,n){1&e&&t.ɵɵelementContainer(0)}function C(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵelement(1,"pep-field-title",12),t.ɵɵtemplate(2,v,1,0,"ng-container",13),t.ɵɵelementContainerEnd()),2&e){var i=t.ɵɵnextContext(),a=t.ɵɵreference(2);t.ɵɵadvance(1),t.ɵɵproperty("label",i.label)("required",i.required)("disabled",i.disabled)("xAlignment",i.xAlignment)("showTitle",!1),t.ɵɵadvance(1),t.ɵɵproperty("ngTemplateOutlet",a)}}function T(e,n){1&e&&t.ɵɵelementContainer(0)}function k(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,T,1,0,"ng-container",13),t.ɵɵelementContainerEnd()),2&e){t.ɵɵnextContext();var i=t.ɵɵreference(2);t.ɵɵadvance(1),t.ɵɵproperty("ngTemplateOutlet",i)}}function I(e,n){1&e&&t.ɵɵelementContainer(0)}function E(e,n){1&e&&t.ɵɵelementContainer(0)}function M(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",18),t.ɵɵpipe(1,"translate"),t.ɵɵelement(2,"pep-icon",19),t.ɵɵelementEnd()),2&e&&t.ɵɵpropertyInterpolate("title",t.ɵɵpipeBind1(1,1,"True"))}function P(e,n){1&e&&(t.ɵɵelementStart(0,"span"),t.ɵɵtext(1," "),t.ɵɵelementEnd())}function A(e,n){if(1&e&&(t.ɵɵtemplate(0,E,1,0,"ng-container",4),t.ɵɵtemplate(1,M,3,3,"ng-template",null,16,t.ɵɵtemplateRefExtractor),t.ɵɵtemplate(3,P,2,0,"ng-template",null,17,t.ɵɵtemplateRefExtractor)),2&e){var i=t.ɵɵreference(2),a=t.ɵɵreference(4),r=t.ɵɵnextContext(2);t.ɵɵproperty("ngIf","true"==r.value.toLowerCase()||"1"==r.value)("ngIfThen",i)("ngIfElse",a)}}function S(e,n){1&e&&t.ɵɵelementContainer(0)}function O(e,n){if(1&e&&t.ɵɵtemplate(0,S,1,0,"ng-container",13),2&e){t.ɵɵnextContext(2);var i=t.ɵɵreference(2);t.ɵɵproperty("ngTemplateOutlet",i)}}function w(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,I,1,0,"ng-container",4),t.ɵɵtemplate(2,A,5,3,"ng-template",null,14,t.ɵɵtemplateRefExtractor),t.ɵɵtemplate(4,O,1,1,"ng-template",null,15,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){var i=t.ɵɵreference(3),a=t.ɵɵreference(5),r=t.ɵɵnextContext();t.ɵɵadvance(1),t.ɵɵproperty("ngIf","ItemHasActiveCampaign"===r.key)("ngIfThen",i)("ngIfElse",a)}}function F(e,n){1&e&&t.ɵɵelementContainer(0)}function Y(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵelement(1,"pep-field-title",12),t.ɵɵtemplate(2,F,1,0,"ng-container",13),t.ɵɵelementContainerEnd()),2&e){var i=t.ɵɵnextContext(),a=t.ɵɵreference(2);t.ɵɵadvance(1),t.ɵɵproperty("label",i.label)("required",i.required)("disabled",i.disabled)("xAlignment",i.xAlignment)("showTitle",!1),t.ɵɵadvance(1),t.ɵɵproperty("ngTemplateOutlet",a)}}var q=function(){function e(e,n,i,a){this.renderer=e,this.customizationService=n,this.translate=i,this.element=a,this.key="",this.value="",this.label="",this.type="checkbox",this.required=!1,this.disabled=!1,this.readonly=!1,this.xAlignment="0",this.rowSpan=1,this.controlType="checkbox",this.form=null,this.isActive=!1,this.showTitle=!0,this.layoutType=p.LAYOUT_TYPE.PepperiForm,this.valueChanged=new t.EventEmitter,this.LAYOUT_TYPE=p.LAYOUT_TYPE,this.standAlone=!1,this.jsonLib=JSON}return e.prototype.ngOnInit=function(){if(null===this.form&&(this.standAlone=!0,this.form=this.customizationService.getDefaultFromGroup(this.key,this.value,this.required,this.readonly,this.disabled,0,"",!0),this.renderer.addClass(this.element.nativeElement,p.CustomizationService.STAND_ALONE_FIELD_CLASS_NAME)),"booleanText"===this.type)try{"string"==typeof this.additionalValue?this.additionalValueObject=JSON.parse(this.additionalValue):this.additionalValueObject=this.additionalValue}catch(e){this.additionalValueObject={CheckedText:this.translate.instant("True"),UncheckedText:this.translate.instant("False")}}},e.prototype.ngOnDestroy=function(){this.valueChanged&&this.valueChanged.unsubscribe()},e.prototype.onMaterialChange=function(e){this.changeValue(e.checked)},e.prototype.toggleChecked=function(e){if(!this.disabled){var t="true"===this.value||"1"===this.value;this.value=(!t).toString(),this.changeValue(this.value)}},e.prototype.changeValue=function(e){this.customizationService.updateFormFieldValue(this.form,this.key,e),this.valueChanged.emit({apiName:this.key,value:e})},e}();q.ɵfac=function(e){return new(e||q)(t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(p.CustomizationService),t.ɵɵdirectiveInject(d.TranslateService),t.ɵɵdirectiveInject(t.ElementRef))},q.ɵcmp=t.ɵɵdefineComponent({type:q,selectors:[["pep-checkbox"]],inputs:{key:"key",value:"value",label:"label",type:"type",required:"required",disabled:"disabled",readonly:"readonly",xAlignment:"xAlignment",rowSpan:"rowSpan",additionalValue:"additionalValue",form:"form",isActive:"isActive",showTitle:"showTitle",layoutType:"layoutType"},outputs:{valueChanged:"valueChanged"},decls:7,vars:5,consts:[[3,"formGroup"],["pepperiTemplate",""],[4,"ngIf"],[1,"pepperi-checkbox-container","pepperi-input",3,"ngClass","dir"],[4,"ngIf","ngIfThen","ngIfElse"],["booleanTextTemplate",""],["regularTemplate",""],[1,"mat-checkbox-layout","body-sm",3,"title","click"],[1,"mat-icon-button","emoji-icon","pull-left","flip",3,"id"],["class","mat-checkbox-label emoji-title",4,"ngIf"],[1,"mat-checkbox-label","emoji-title"],["type","checkbox",1,"body-sm","ellipsis",3,"name","title","checked","disabled","change"],[3,"label","required","disabled","xAlignment","showTitle"],[4,"ngTemplateOutlet"],["itemCampaignBlock",""],["checkboxBlock",""],["trueTemplate",""],["falseTemplate",""],[1,"has-active-campaign",3,"title"],["name","system_bolt"]],template:function(e,n){1&e&&(t.ɵɵelementContainerStart(0,0),t.ɵɵtemplate(1,x,6,13,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵtemplate(3,C,3,6,"ng-container",2),t.ɵɵtemplate(4,k,2,1,"ng-container",2),t.ɵɵtemplate(5,w,6,3,"ng-container",2),t.ɵɵtemplate(6,Y,3,6,"ng-container",2),t.ɵɵelementContainerEnd()),2&e&&(t.ɵɵproperty("formGroup",n.form),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.layoutType===n.LAYOUT_TYPE.PepperiForm),t.ɵɵadvance(1),t.ɵɵproperty("ngIf",n.layoutType===n.LAYOUT_TYPE.PepperiCard),t.ɵɵadvance(1),t.ɵɵproperty("ngIf",n.layoutType===n.LAYOUT_TYPE.PepperiTable),t.ɵɵadvance(1),t.ɵɵproperty("ngIf",n.layoutType===n.LAYOUT_TYPE.Editmodal))},directives:[i.NgControlStatusGroup,i.FormGroupDirective,n.NgIf,n.NgClass,s.Dir,l.MatCheckbox,u.PepperiFieldTitleComponent,n.NgTemplateOutlet,o.MatIcon,c.PepperiIconComponent],pipes:[d.TranslatePipe],styles:["[_nghost-%COMP%]{display:-ms-grid;display:grid;height:inherit}[_nghost-%COMP%] > *[_ngcontent-%COMP%]{-ms-grid-row-align:center;align-self:center}"],changeDetection:0});var _=function(e){this.pepperiIconRegistry=e,this.pepperiIconRegistry.registerIcons([c.pepperiIconSystemBolt])};_.ɵmod=t.ɵɵdefineNgModule({type:_}),_.ɵinj=t.ɵɵdefineInjector({factory:function(e){return new(e||_)(t.ɵɵinject(c.PepperiIconRegistry))},imports:[[n.CommonModule,i.ReactiveFormsModule,i.FormsModule,a.MatCommonModule,r.MatFormFieldModule,l.MatCheckboxModule,o.MatIconModule,p.PepperiModule,c.PepperiIconModule,u.PepperiFieldTitleModule]]}),("undefined"==typeof ngJitMode||ngJitMode)&&t.ɵɵsetNgModuleScope(_,{declarations:[q],imports:[n.CommonModule,i.ReactiveFormsModule,i.FormsModule,a.MatCommonModule,r.MatFormFieldModule,l.MatCheckboxModule,o.MatIconModule,p.PepperiModule,c.PepperiIconModule,u.PepperiFieldTitleModule],exports:[q]}),e.PepperiCheckboxComponent=q,e.PepperiCheckboxModule=_,Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=pepperi-lib-checkbox.umd.min.js.map