@pepperi/lib
Version:
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.0.1.
2 lines • 30.1 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@angular/platform-browser"),require("@angular/platform-browser/animations"),require("@angular/forms"),require("@angular/material/core"),require("@angular/material/form-field"),require("@angular/material/input"),require("@angular/material/button"),require("@angular/material/badge"),require("@angular/material/icon"),require("@pepperi/lib"),require("@pepperi/lib/icon"),require("@pepperi/lib/field-title"),require("@angular/animations"),require("jquery"),require("@ngx-translate/core")):"function"==typeof define&&define.amd?define("@pepperi/lib/quantity-selector",["exports","@angular/core","@angular/common","@angular/platform-browser","@angular/platform-browser/animations","@angular/forms","@angular/material/core","@angular/material/form-field","@angular/material/input","@angular/material/button","@angular/material/badge","@angular/material/icon","@pepperi/lib","@pepperi/lib/icon","@pepperi/lib/field-title","@angular/animations","jquery","@ngx-translate/core"],t):t(((e=e||self).pepperi=e.pepperi||{},e.pepperi.lib=e.pepperi.lib||{},e.pepperi.lib["quantity-selector"]={}),e.ng.core,e.ng.common,e.ng.platformBrowser,e.ng.platformBrowser.animations,e.ng.forms,e.ng.material.core,e.ng.material.formField,e.ng.material.input,e.ng.material.button,e.ng.material.badge,e.ng.material.icon,e.pepperi.lib,e.pepperi.lib.icon,e.pepperi.lib["field-title"],e.ng.animations,e.jquery,e.translate)}(this,(function(e,t,n,i,r,a,o,l,s,p,u,m,c,d,f,g,h,y){"use strict";var C=function(){function e(){}return e.prototype.transform=function(e,t){var n=parseFloat(e);return 0===n?"0":t?n.toString():parseInt(e).toString()},e}();C.ɵfac=function(e){return new(e||C)},C.ɵpipe=t.ɵɵdefinePipe({name:"quantitySelectorNumber",type:C,pure:!0});var v=["QSCont"],x=["QSInput"];function w(e,n){if(1&e&&t.ɵɵelement(0,"pep-field-title",6),2&e){var i=t.ɵɵnextContext(2);t.ɵɵproperty("label",i.label)("required",i.required)("disabled",i.disabled)("showTitle",i.showTitle)("xAlignment",i.xAlignment)}}function b(e,n){1&e&&t.ɵɵelementContainer(0)}var E=function(e,t,n){return{caution:e,md:t,xs:n}};function S(e,n){if(1&e&&(t.ɵɵelementStart(0,"button",10),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){var i=t.ɵɵnextContext(3);t.ɵɵclassMapInterpolate1("pepperi-button ",i.styleClass," ellipsis"),t.ɵɵpropertyInterpolate("title",i.formattedValue),t.ɵɵproperty("id",i.key)("ngClass",t.ɵɵpureFunction3(7,E,i.isCaution,1!==i.rowSpan,1===i.rowSpan)),t.ɵɵadvance(1),t.ɵɵtextInterpolate1(" ",i.formattedValue," ")}}var T=function(e,t){return{caution:e,"keep-background-on-focus":t}};function I(e,n){if(1&e){var i=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",16),t.ɵɵlistener("click",(function(e){return t.ɵɵrestoreView(i),t.ɵɵnextContext(4).decrement(e)})),t.ɵɵelementStart(1,"mat-icon"),t.ɵɵelement(2,"pep-icon",17),t.ɵɵelementEnd(),t.ɵɵelementEnd()}if(2&e){var r=t.ɵɵnextContext(4);t.ɵɵproperty("ngClass",t.ɵɵpureFunction2(1,T,r.isCaution&&r.styleClass!==r.STYLE_TYPE.Strong,r.styleClass===r.STYLE_TYPE.Strong))}}function M(e,n){if(1&e){var i=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",18),t.ɵɵlistener("click",(function(e){return t.ɵɵrestoreView(i),t.ɵɵnextContext(4).increment(e)})),t.ɵɵelementStart(1,"mat-icon"),t.ɵɵelement(2,"pep-icon",19),t.ɵɵelementEnd(),t.ɵɵelementEnd()}if(2&e){var r=t.ɵɵnextContext(4);t.ɵɵproperty("ngClass",t.ɵɵpureFunction2(1,T,r.isCaution&&r.styleClass!==r.STYLE_TYPE.Strong,r.styleClass===r.STYLE_TYPE.Strong))}}function P(e,n){if(1&e&&(t.ɵɵelementStart(0,"span",21),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){var i=n.$implicit;t.ɵɵadvance(1),t.ɵɵtextInterpolate2(" ",t.ɵɵpipeBind1(2,2,i.Key)," : ",i.Value," ")}}function k(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtemplate(1,P,3,4,"span",20),t.ɵɵelementEnd()),2&e){var i=t.ɵɵnextContext(4);t.ɵɵadvance(1),t.ɵɵproperty("ngForOf",i.messages)}}function F(e,n){if(1&e){var i=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-form-field",11),t.ɵɵelementStart(1,"input",12,13),t.ɵɵlistener("keypress",(function(e){return t.ɵɵrestoreView(i),t.ɵɵnextContext(3).onKeyPress(e)}))("click",(function(e){return t.ɵɵrestoreView(i),e.target.setSelectionRange(0,999)}))("blur",(function(e){return t.ɵɵrestoreView(i),t.ɵɵnextContext(3).onBlur(e)}))("focus",(function(e){return t.ɵɵrestoreView(i),t.ɵɵnextContext(3).onFocus(e)})),t.ɵɵpipe(3,"quantitySelectorNumber"),t.ɵɵelementEnd(),t.ɵɵtemplate(4,I,3,4,"button",14),t.ɵɵtemplate(5,M,3,4,"button",15),t.ɵɵtemplate(6,k,2,1,"mat-error",2),t.ɵɵelementEnd()}if(2&e){var r=t.ɵɵnextContext(3);t.ɵɵadvance(1),t.ɵɵpropertyInterpolate("name",r.key),t.ɵɵpropertyInterpolate("title",r.formattedValue),t.ɵɵproperty("id",r.key)("formControlName",r.key)("value",r.isFocus?t.ɵɵpipeBind2(3,9,r.value,r.alowDecimal):r.formattedValue)("disabled",r.disabled),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",r.showQsBtn),t.ɵɵadvance(1),t.ɵɵproperty("ngIf",r.showQsBtn),t.ɵɵadvance(1),t.ɵɵproperty("ngIf",(null==r.messages?null:r.messages.length)>0)}}function _(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,b,1,0,"ng-container",7),t.ɵɵtemplate(2,S,2,11,"ng-template",null,8,t.ɵɵtemplateRefExtractor),t.ɵɵtemplate(4,F,7,12,"ng-template",null,9,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){var i=t.ɵɵreference(3),r=t.ɵɵreference(5),a=t.ɵɵnextContext(2);t.ɵɵadvance(1),t.ɵɵproperty("ngIf",a.readonly)("ngIfThen",i)("ngIfElse",r)}}function q(e,n){1&e&&t.ɵɵelementContainer(0)}function O(e,n){if(1&e&&(t.ɵɵelementStart(0,"button",22),t.ɵɵtext(1," X "),t.ɵɵelementEnd()),2&e){var i=t.ɵɵnextContext(3);t.ɵɵclassMapInterpolate1("pepperi-button ",i.styleClass," disabled"),t.ɵɵproperty("id",i.key)("ngClass",t.ɵɵpureFunction3(5,E,i.isCaution,1!==i.rowSpan,1===i.rowSpan))}}function B(e,n){if(1&e&&t.ɵɵelement(0,"span",27),2&e){var i=t.ɵɵnextContext(4);t.ɵɵpropertyInterpolate("matBadge",i.additionalValue),t.ɵɵproperty("@showHide",i.getAdditionalValue)}}function V(e,n){if(1&e&&(t.ɵɵelementStart(0,"span",21),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){var i=n.$implicit;t.ɵɵadvance(1),t.ɵɵtextInterpolate2(" ",t.ɵɵpipeBind1(2,2,i.Key)," : ",i.Value," ")}}function A(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtemplate(1,V,3,4,"span",20),t.ɵɵelementEnd()),2&e){var i=t.ɵɵnextContext(4);t.ɵɵadvance(1),t.ɵɵproperty("ngForOf",i.messages)}}function Y(e,n){if(1&e&&t.ɵɵelement(0,"span",28),2&e){var i=t.ɵɵnextContext(4);t.ɵɵpropertyInterpolate("matBadge",i.additionalValue),t.ɵɵproperty("@showHide",i.getAdditionalValue)}}function R(e,n){if(1&e){var i=t.ɵɵgetCurrentView();t.ɵɵtemplate(0,B,1,2,"span",23),t.ɵɵelementStart(1,"mat-form-field",24),t.ɵɵlistener("mouseleave",(function(e){t.ɵɵrestoreView(i);var n=t.ɵɵnextContext(3);return n.isFocus?null:n.onMatrixMouseleave(e)})),t.ɵɵelementStart(2,"input",25,13),t.ɵɵlistener("keypress",(function(e){return t.ɵɵrestoreView(i),t.ɵɵnextContext(3).onKeyPress(e)}))("click",(function(e){return t.ɵɵrestoreView(i),t.ɵɵnextContext(3).onMatrixClick(e),e.target.setSelectionRange(0,999)}))("blur",(function(e){return t.ɵɵrestoreView(i),t.ɵɵnextContext(3).onMatrixBlur(e)}))("focus",(function(e){t.ɵɵrestoreView(i);var n=t.ɵɵnextContext(3);return n.onMatrixMouseEnter(e),n.onFocus(e)}))("mouseenter",(function(e){return t.ɵɵrestoreView(i),t.ɵɵnextContext(3).onMatrixMouseEnter(e)})),t.ɵɵpipe(4,"quantitySelectorNumber"),t.ɵɵelementEnd(),t.ɵɵtemplate(5,A,2,1,"mat-error",2),t.ɵɵelementEnd(),t.ɵɵtemplate(6,Y,1,2,"span",26)}if(2&e){var r=t.ɵɵnextContext(3);t.ɵɵproperty("ngIf","2"==r.xAlignment),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("name",r.key),t.ɵɵpropertyInterpolate("title",r.formattedValue),t.ɵɵproperty("id",r.key)("formControlName",r.key)("value",r.isFocus?t.ɵɵpipeBind2(4,9,r.value,r.alowDecimal):r.formattedValue)("disabled",r.disabled),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",(null==r.messages?null:r.messages.length)>0),t.ɵɵadvance(1),t.ɵɵproperty("ngIf","2"!=r.xAlignment)}}function N(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,q,1,0,"ng-container",7),t.ɵɵtemplate(2,O,2,9,"ng-template",null,8,t.ɵɵtemplateRefExtractor),t.ɵɵtemplate(4,R,7,12,"ng-template",null,9,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){var i=t.ɵɵreference(3),r=t.ɵɵreference(5),a=t.ɵɵnextContext(2);t.ɵɵadvance(1),t.ɵɵproperty("ngIf",a.readonly)("ngIfThen",i)("ngIfElse",r)}}function Q(e,n){1&e&&t.ɵɵelementContainer(0)}function L(e,n){if(1&e){var i=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",31),t.ɵɵlistener("click",(function(e){return t.ɵɵrestoreView(i),t.ɵɵnextContext(3).enterChildren(e)})),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd()}if(2&e){var r=t.ɵɵnextContext(3);t.ɵɵclassMapInterpolate1("pepperi-button ",r.styleClass," ellipsis"),t.ɵɵpropertyInterpolate("name",r.key),t.ɵɵproperty("id",r.key)("ngClass",t.ɵɵpureFunction3(12,E,r.isCaution,1!==r.rowSpan,1===r.rowSpan))("title",t.ɵɵpipeBind1(1,8,"FormBuilder_Order")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,10,"FormBuilder_Order")," ")}}function z(e,n){1&e&&t.ɵɵelementContainer(0)}function D(e,n){if(1&e){var i=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",34),t.ɵɵlistener("click",(function(e){return t.ɵɵrestoreView(i),t.ɵɵnextContext(4).enterChildren(e)})),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd()}if(2&e){var r=t.ɵɵnextContext(4);t.ɵɵclassMapInterpolate1("pepperi-button ",r.styleClass," ellipsis right-alignment"),t.ɵɵpropertyInterpolate("matBadge",r.formattedValue),t.ɵɵpropertyInterpolate("name",r.key),t.ɵɵproperty("matBadgeSize",r.layoutType===r.LAYOUT_TYPE.PepperiCard&&1===r.rowSpan?"small":"medium")("id",r.key)("ngClass",t.ɵɵpureFunction3(14,E,r.isCaution,1!==r.rowSpan,1===r.rowSpan))("title",t.ɵɵpipeBind1(1,10,"FormBuilder_Order")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,12,"FormBuilder_Order")," ")}}function W(e,n){if(1&e){var i=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",35),t.ɵɵlistener("click",(function(e){return t.ɵɵrestoreView(i),t.ɵɵnextContext(4).enterChildren(e)})),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd()}if(2&e){var r=t.ɵɵnextContext(4);t.ɵɵclassMapInterpolate1("pepperi-button ",r.styleClass," ellipsis left-alignment"),t.ɵɵpropertyInterpolate("matBadge",r.formattedValue),t.ɵɵpropertyInterpolate("name",r.key),t.ɵɵproperty("matBadgeSize",r.layoutType===r.LAYOUT_TYPE.PepperiCard&&1===r.rowSpan?"small":"medium")("id",r.key)("ngClass",t.ɵɵpureFunction3(14,E,r.isCaution,1!==r.rowSpan,1===r.rowSpan))("title",t.ɵɵpipeBind1(1,10,"FormBuilder_Order")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,12,"FormBuilder_Order")," ")}}function K(e,n){if(1&e&&(t.ɵɵtemplate(0,z,1,0,"ng-container",7),t.ɵɵtemplate(1,D,4,18,"ng-template",null,32,t.ɵɵtemplateRefExtractor),t.ɵɵtemplate(3,W,4,18,"ng-template",null,33,t.ɵɵtemplateRefExtractor)),2&e){var i=t.ɵɵreference(2),r=t.ɵɵreference(4),a=t.ɵɵnextContext(3);t.ɵɵproperty("ngIf","2"==a.xAlignment)("ngIfThen",i)("ngIfElse",r)}}function U(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,Q,1,0,"ng-container",7),t.ɵɵtemplate(2,L,4,16,"ng-template",null,29,t.ɵɵtemplateRefExtractor),t.ɵɵtemplate(4,K,5,3,"ng-template",null,30,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){var i=t.ɵɵreference(3),r=t.ɵɵreference(5),a=t.ɵɵnextContext(2);t.ɵɵadvance(1),t.ɵɵproperty("ngIf","0"==a.value)("ngIfThen",i)("ngIfElse",r)}}function j(e,n){if(1&e){var i=t.ɵɵgetCurrentView();t.ɵɵelementContainerStart(0),t.ɵɵelementStart(1,"button",36),t.ɵɵlistener("click",(function(e){return t.ɵɵrestoreView(i),t.ɵɵnextContext(2).enterPackage(e)})),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd()}if(2&e){var r=t.ɵɵnextContext(2);t.ɵɵadvance(1),t.ɵɵclassMapInterpolate1("pepperi-button ",r.styleClass," ellipsis"),t.ɵɵpropertyInterpolate("name",r.key),t.ɵɵpropertyInterpolate("title",t.ɵɵpipeBind1(2,9,"FormBuilder_Order")),t.ɵɵproperty("id",r.key)("ngClass",t.ɵɵpureFunction3(13,E,r.isCaution,1!==r.rowSpan,1===r.rowSpan)),t.ɵɵadvance(2),t.ɵɵtextInterpolate2(" ",t.ɵɵpipeBind1(4,11,"FormBuilder_Order")," (",r.formattedValue,") ")}}var G=function(e,t,n,i,r){return{"pepperi-table-quantity-selector":e,"one-row":t,caution:n,"matrix-qs":i,"zero-quantity":r}};function H(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3,4),t.ɵɵtemplate(2,w,1,5,"pep-field-title",5),t.ɵɵtemplate(3,_,6,3,"ng-container",2),t.ɵɵtemplate(4,N,6,3,"ng-container",2),t.ɵɵtemplate(5,U,6,3,"ng-container",2),t.ɵɵtemplate(6,j,5,17,"ng-container",2),t.ɵɵelementEnd()),2&e){var i=t.ɵɵnextContext();t.ɵɵclassMapInterpolate1("pepperi-quantity-selector-container ",i.styleClass,""),t.ɵɵproperty("ngClass",t.ɵɵpureFunction5(9,G,i.layoutType===i.LAYOUT_TYPE.PepperiTable,1===i.rowSpan,i.isCaution,"qsForMatrix"===i.type,"0"===i.formattedValue)),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",i.layoutType!==i.LAYOUT_TYPE.PepperiTable&&i.layoutType!==i.LAYOUT_TYPE.PepperiCard),t.ɵɵadvance(1),t.ɵɵproperty("ngIf","qs"==i.type),t.ɵɵadvance(1),t.ɵɵproperty("ngIf","qsForMatrix"==i.type),t.ɵɵadvance(1),t.ɵɵproperty("ngIf","button"==i.type),t.ɵɵadvance(1),t.ɵɵproperty("ngIf","packageButton"==i.type)}}function J(e,n){1&e&&t.ɵɵelementContainer(0)}function $(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,J,1,0,"ng-container",37),t.ɵɵelementContainerEnd()),2&e){t.ɵɵnextContext();var i=t.ɵɵreference(2);t.ɵɵadvance(1),t.ɵɵproperty("ngTemplateOutlet",i)}}function X(e,n){1&e&&t.ɵɵelementContainer(0)}function Z(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,X,1,0,"ng-container",37),t.ɵɵelementContainerEnd()),2&e){t.ɵɵnextContext();var i=t.ɵɵreference(2);t.ɵɵadvance(1),t.ɵɵproperty("ngTemplateOutlet",i)}}function ee(e,n){1&e&&t.ɵɵelementContainer(0)}function te(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,ee,1,0,"ng-container",37),t.ɵɵelementContainerEnd()),2&e){t.ɵɵnextContext();var i=t.ɵɵreference(2);t.ɵɵadvance(1),t.ɵɵproperty("ngTemplateOutlet",i)}}function ne(e,n){1&e&&t.ɵɵelementContainer(0)}function ie(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,ne,1,0,"ng-container",37),t.ɵɵelementContainerEnd()),2&e){t.ɵɵnextContext();var i=t.ɵɵreference(2);t.ɵɵadvance(1),t.ɵɵproperty("ngTemplateOutlet",i)}}var re=function(){function e(e,n,i,r){this.cd=e,this.customizationService=n,this.renderer=i,this.element=r,this.key="",this.value="",this.formattedValue="",this.label="",this.type="qs",this.required=!1,this.disabled=!1,this.readonly=!1,this.textColor="",this.xAlignment="0",this.rowSpan=1,this.alowDecimal=!1,this.additionalValue="",this.controlType="qs",this.form=null,this.showTitle=!0,this.layoutType=c.LAYOUT_TYPE.PepperiForm,this.isActive=!1,this.valueChanged=new t.EventEmitter,this.elementClicked=new t.EventEmitter,this.LAYOUT_TYPE=c.LAYOUT_TYPE,this.standAlone=!1,this.isFocus=!1,this.isMatrixFocus=!1,this.isCaution=!1,this.messages=null,this.showQsBtn=!1,this.sameElementInTheWantedRow=null,this.STYLE_TYPE=c.STYLE_TYPE,this.styleClass=c.STYLE_TYPE.Strong,this.isEmptyKey=!1}return e.prototype.ngOnInit=function(){null===this.form&&(""===this.key&&(this.isEmptyKey=!0),this.standAlone=!0,this.form=this.customizationService.getDefaultFromGroup(this.key,this.value,this.required,this.readonly,this.disabled),this.formattedValue=this.formattedValue||this.value,this.renderer.addClass(this.element.nativeElement,c.CustomizationService.STAND_ALONE_FIELD_CLASS_NAME)),this.setQsView()},e.prototype.ngAfterViewChecked=function(){var e=this;setTimeout((function(){e.setQsView()}),125)},e.prototype.ngOnChanges=function(e){var t=this;if(this.isEmptyKey&&""!==this.key&&(this.form=this.customizationService.getDefaultFromGroup(this.key,this.value,this.required,this.readonly,this.disabled)),this.isCaution="#FF0000"===this.textColor,this.messages=this.notificationInfo&&this.notificationInfo.length>0?JSON.parse(this.notificationInfo).Messages:"",this.messages&&this.messages.length>0){this.form.controls[this.key].setErrors({serverError:"Error"}),setTimeout((function(){t.QSInput&&t.QSInput.nativeElement&&t.QSInput.nativeElement.focus()}),150)}else{var n=this;setTimeout((function(){n.lastFocusField?(n.lastFocusField.focus(),n.lastFocusField=null):n.focusToTheSameElementInTheWantedRow()}),100)}},e.prototype.ngOnDestroy=function(){this.resize&&this.resize.unsubscribe(),this.valueChanged&&this.valueChanged.unsubscribe(),this.elementClicked&&this.elementClicked.unsubscribe()},Object.defineProperty(e.prototype,"getAdditionalValue",{get:function(){return this.additionalValue.length>0?"show":"hide"},enumerable:!1,configurable:!0}),e.prototype.getSameElementInTheWantedRowByClassName=function(e,t){void 0===t&&(t=!0);var n,i=e.target||e.srcElement;return this.layoutType===c.LAYOUT_TYPE.PepperiTable?n=h(i).parents(".table-row"):this.layoutType===c.LAYOUT_TYPE.PepperiCard&&0===(n=h(i).parents(".card-view")).length&&(n=h(i).parents(".line-view")),t?n.is(":last-child")?n.parent().children().first().find("[name="+this.key+"]"):n.next().find("[name="+this.key+"]"):n.is(":first-child")?n.parent().children().last().find("[name="+this.key+"]"):n.prev().find("[name="+this.key+"]")},e.prototype.setSameElementInTheWantedRow=function(e,t){void 0===t&&(t=!0),this.sameElementInTheWantedRow=this.getSameElementInTheWantedRowByClassName(e,t),this.QSInput.nativeElement.blur()},e.prototype.focusToTheSameElementInTheWantedRow=function(){this.sameElementInTheWantedRow&&(this.sameElementInTheWantedRow.is("input")?this.sameElementInTheWantedRow.click().select():(this.sameElementInTheWantedRow.parent().click(),this.sameElementInTheWantedRow.focus()),this.sameElementInTheWantedRow=null)},e.prototype.cleanError=function(){var e=this.form.controls[this.key];this.messages&&this.messages.length>0&&(this.messages=this.notificationInfo=null,e.setErrors(null))},e.prototype.onMatrixMouseEnter=function(e){this.isMatrixFocus=!0},e.prototype.onMatrixMouseleave=function(e){this.isMatrixFocus=!1},e.prototype.onMatrixClick=function(e){this.isFocus=!0,this.QSInput&&this.QSInput.nativeElement&&this.QSInput.nativeElement.focus()},e.prototype.onMatrixBlur=function(e){(!e.relatedTarget||e.relatedTarget.className.indexOf("qs")<0)&&(this.isMatrixFocus=!1),this.onBlur(e)},e.prototype.onFocus=function(e){this.isFocus=!0},e.prototype.onBlur=function(e){this.isFocus=!1,this.cleanError();var t=e.target?e.target.value:e;parseFloat(this.value)!==parseFloat(t)?(this.value=t,this.formattedValue=t,this.customizationService.updateFormFieldValue(this.form,this.key,t),this.changeValue(this.value,e.relatedTarget)):this.focusToTheSameElementInTheWantedRow()},e.prototype.changeValue=function(e,t){void 0===t&&(t=null),this.valueChanged.emit({apiName:this.key,value:e,controlType:this.controlType,lastFocusedField:t})},e.prototype.increment=function(e){if(this.standAlone){var t=parseFloat(this.value);this.value=this.formattedValue=(++t).toString(),this.customizationService.updateFormFieldValue(this.form,this.key,this.value)}this.changeValue("+",null),e.stopPropagation()},e.prototype.decrement=function(e){if(this.standAlone){var t=parseFloat(this.value);this.value=this.formattedValue=(--t).toString(),this.customizationService.updateFormFieldValue(this.form,this.key,this.value)}this.changeValue("-",null),e.stopPropagation()},e.prototype.enterChildren=function(t){this.elementClicked.emit({apiName:e.ENTER_CHILDREN,eventWhich:t.which})},e.prototype.enterPackage=function(t){this.elementClicked.emit({apiName:e.ENTER_PACKAGE,eventWhich:t.which,otherData:this.notificationInfo})},e.prototype.setQsView=function(){this.layoutType===c.LAYOUT_TYPE.Editmodal||this.layoutType===c.LAYOUT_TYPE.PepperiCard&&this.rowSpan<=1?this.showQsBtn=!1:this.QSCont&&this.QSCont.nativeElement&&(this.showQsBtn=this.QSCont.nativeElement.clientWidth>140),this.styleClass=document.documentElement.style.getPropertyValue(c.CustomizationService.STYLE_QS_KEY),this.cd.destroyed||this.cd.detectChanges()},e.prototype.onKeyPress=function(e){var t=String.fromCharCode(e.charCode),n=e;if(13===n.keyCode)return this.setSameElementInTheWantedRow(n,!n.shiftKey),!0;if(65===n.keyCode&&!0===n.ctrlKey||67===n.keyCode&&!0===n.ctrlKey||86===n.keyCode&&!0===n.ctrlKey||88===n.keyCode&&!0===n.ctrlKey)return!0;if(this.alowDecimal){var i=/^\d[\d,]*(\.\d+)?$/;46===n.keyCode?t+="0":44===n.keyCode&&(t+="000"),i.test(e.target.value+t)||n.preventDefault()}else{(i=/[0-9\+\-\ ]/).test(t)||n.preventDefault()}},e}();re.ENTER_CHILDREN="[EnterChildren]",re.ENTER_PACKAGE="[EnterPackage]",re.ɵfac=function(e){return new(e||re)(t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(c.CustomizationService),t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(t.ElementRef))},re.ɵcmp=t.ɵɵdefineComponent({type:re,selectors:[["pep-quantity-selector"]],viewQuery:function(e,n){var i;(1&e&&(t.ɵɵviewQuery(v,!0),t.ɵɵviewQuery(x,!0)),2&e)&&(t.ɵɵqueryRefresh(i=t.ɵɵloadQuery())&&(n.QSCont=i.first),t.ɵɵqueryRefresh(i=t.ɵɵloadQuery())&&(n.QSInput=i.first))},inputs:{key:"key",value:"value",formattedValue:"formattedValue",label:"label",type:"type",required:"required",disabled:"disabled",readonly:"readonly",textColor:"textColor",xAlignment:"xAlignment",rowSpan:"rowSpan",lastFocusField:"lastFocusField",alowDecimal:"alowDecimal",additionalValue:"additionalValue",notificationInfo:"notificationInfo",form:"form",showTitle:"showTitle",layoutType:"layoutType",isActive:"isActive"},outputs:{valueChanged:"valueChanged",elementClicked:"elementClicked"},features:[t.ɵɵNgOnChangesFeature],decls:7,vars:5,consts:[[3,"formGroup"],["pepperiTemplate",""],[4,"ngIf"],[3,"ngClass"],["QSCont",""],[3,"label","required","disabled","showTitle","xAlignment",4,"ngIf"],[3,"label","required","disabled","showTitle","xAlignment"],[4,"ngIf","ngIfThen","ngIfElse"],["readonlyBlock",""],["editableQSBlock",""],["mat-button","","disabled","true",3,"id","ngClass","title"],["appearance","outline"],["type","decimalNumber","inputmode","decimal","matInput","","autocomplete","off",1,"body-lg","ellipsis",3,"name","title","id","formControlName","value","disabled","keypress","click","blur","focus"],["QSInput",""],["mat-button","","matPrefix","","class","pepperi-button icon-button sm weak qs-action",3,"ngClass","click",4,"ngIf"],["mat-button","","matSuffix","","class","pepperi-button icon-button sm weak qs-action",3,"ngClass","click",4,"ngIf"],["mat-button","","matPrefix","",1,"pepperi-button","icon-button","sm","weak","qs-action",3,"ngClass","click"],["name","number_minus"],["mat-button","","matSuffix","",1,"pepperi-button","icon-button","sm","weak","qs-action",3,"ngClass","click"],["name","number_plus"],["class","qs-error body-xs",4,"ngFor","ngForOf"],[1,"qs-error","body-xs"],["mat-button","","disabled","true",3,"id","ngClass"],["class","body-sm additional-value prefix","matBadgePosition","before","matBadgeSize","rowSpan === 1 ? small : medium",3,"matBadge",4,"ngIf"],["appearance","outline",3,"mouseleave"],["type","decimalNumber","inputmode","decimal","matInput","","autocomplete","off",1,"body-sm","ellipsis",3,"name","title","id","formControlName","value","disabled","keypress","click","blur","focus","mouseenter"],["class","body-sm additional-value suffix","matBadgePosition","before","matBadgeSize","rowSpan === 1 ? small : medium",3,"matBadge",4,"ngIf"],["matBadgePosition","before","matBadgeSize","rowSpan === 1 ? small : medium",1,"body-sm","additional-value","prefix",3,"matBadge"],["matBadgePosition","before","matBadgeSize","rowSpan === 1 ? small : medium",1,"body-sm","additional-value","suffix",3,"matBadge"],["regularBlock",""],["withBadgeBlock",""],["mat-button","",3,"name","id","ngClass","title","click"],["leftBadgeBlock",""],["rightBadgeBlock",""],["mat-button","","matBadgePosition","before",3,"matBadge","matBadgeSize","name","id","ngClass","title","click"],["mat-button","","matBadgePosition","after",3,"matBadge","matBadgeSize","name","id","ngClass","title","click"],["mat-button","",3,"name","title","id","ngClass","click"],[4,"ngTemplateOutlet"]],template:function(e,n){1&e&&(t.ɵɵelementContainerStart(0,0),t.ɵɵtemplate(1,H,7,15,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵtemplate(3,$,2,1,"ng-container",2),t.ɵɵtemplate(4,Z,2,1,"ng-container",2),t.ɵɵtemplate(5,te,2,1,"ng-container",2),t.ɵɵtemplate(6,ie,2,1,"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:[a.NgControlStatusGroup,a.FormGroupDirective,n.NgIf,n.NgClass,f.PepperiFieldTitleComponent,p.MatButton,l.MatFormField,s.MatInput,a.DefaultValueAccessor,a.NgControlStatus,a.FormControlName,l.MatPrefix,m.MatIcon,d.PepperiIconComponent,l.MatSuffix,l.MatError,n.NgForOf,u.MatBadge,n.NgTemplateOutlet],pipes:[C,y.TranslatePipe],styles:["[_nghost-%COMP%]{display:-ms-grid;display:grid;height:inherit}.pepperi-quantity-selector-container[_ngcontent-%COMP%]{align-items:center;display:flex;flex-flow:wrap;height:inherit;min-width:2rem;width:100%}.pepperi-quantity-selector-container[_ngcontent-%COMP%] input[_ngcontent-%COMP%]::-webkit-inner-spin-button, .pepperi-quantity-selector-container[_ngcontent-%COMP%] input[_ngcontent-%COMP%]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.pepperi-quantity-selector-container[_ngcontent-%COMP%] input[type=number][_ngcontent-%COMP%]{-moz-appearance:textfield}.pepperi-quantity-selector-container[_ngcontent-%COMP%] .mat-input-element[_ngcontent-%COMP%]{font-weight:var(--pep-font-weight-bold,600);padding:0 .25rem;text-align:center;width:100%}.pepperi-quantity-selector-container[_ngcontent-%COMP%] .mat-form-field[_ngcontent-%COMP%] .mat-form-field-wrapper[_ngcontent-%COMP%] .mat-form-field-subscript-wrapper[_ngcontent-%COMP%]{height:unset}.pepperi-quantity-selector-container[_ngcontent-%COMP%] .pepperi-button[_ngcontent-%COMP%]{width:100%}.pepperi-quantity-selector-container[_ngcontent-%COMP%] .pepperi-button.qs-action[_ngcontent-%COMP%]{height:2rem!important;line-height:2rem;min-width:2rem;width:2rem!important}.pepperi-quantity-selector-container[_ngcontent-%COMP%] .pepperi-button.qs-action[_ngcontent-%COMP%] .mat-icon[_ngcontent-%COMP%]{height:inherit;width:inherit}.pepperi-quantity-selector-container[_ngcontent-%COMP%] .qs-error[_ngcontent-%COMP%]{display:block}.pepperi-quantity-selector-container.matrix-qs[_ngcontent-%COMP%] .additional-value[_ngcontent-%COMP%]{align-self:flex-start;display:flex;height:1.25rem;justify-content:flex-end;top:calc(var(--pep-spacing-xs, .25rem)*-1);transform:unset!important}.pepperi-quantity-selector-container.matrix-qs[_ngcontent-%COMP%] .additional-value.prefix[_ngcontent-%COMP%]{left:calc(var(--pep-spacing-sm, .5rem)*-1)!important}.pepperi-quantity-selector-container.matrix-qs[_ngcontent-%COMP%] .additional-value.suffix[_ngcontent-%COMP%]{right:calc(var(--pep-spacing-sm, .5rem)*-1)!important}.pepperi-quantity-selector-container.matrix-qs[_ngcontent-%COMP%] .additional-value[_ngcontent-%COMP%] .mat-badge-content[_ngcontent-%COMP%]{-ms-text-overflow:ellipsis;border-radius:.625rem;max-width:inherit;min-width:1.5rem;overflow:hidden;padding:0 .5rem;text-overflow:ellipsis;white-space:nowrap;width:-webkit-fit-content!important;width:-moz-fit-content!important;width:fit-content!important;z-index:99}.pepperi-quantity-selector-container.matrix-qs[_ngcontent-%COMP%] .disabled[_ngcontent-%COMP%]{min-width:.5rem;padding:0 .25rem}.pepperi-quantity-selector-container.pepperi-table-quantity-selector[_ngcontent-%COMP%] .pepperi-button[_ngcontent-%COMP%]:not(.qs-action){height:2rem;line-height:2rem}.pepperi-quantity-selector-container.pepperi-table-quantity-selector[_ngcontent-%COMP%] .pepperi-button.qs-action[_ngcontent-%COMP%]{height:1.5rem!important;line-height:1.5rem;min-width:1.5rem;width:1.5rem!important}"],data:{animation:[g.trigger("showHide",[g.state("show",g.style({opacity:1,transform:"scale(1)"})),g.state("hide",g.style({opacity:0,transform:"scale(0)"})),g.transition("show => hide",g.animate("250ms ease-out")),g.transition("hide => show",g.animate("250ms ease-in"))])]},changeDetection:0});var ae=function(e){this.pepperiIconRegistry=e,this.pepperiIconRegistry.registerIcons([d.pepperiIconNumberMinus,d.pepperiIconNumberPlus])};ae.ɵmod=t.ɵɵdefineNgModule({type:ae}),ae.ɵinj=t.ɵɵdefineInjector({factory:function(e){return new(e||ae)(t.ɵɵinject(d.PepperiIconRegistry))},imports:[[n.CommonModule,i.BrowserModule,r.BrowserAnimationsModule,a.ReactiveFormsModule,a.FormsModule,o.MatCommonModule,l.MatFormFieldModule,s.MatInputModule,p.MatButtonModule,u.MatBadgeModule,m.MatIconModule,c.PepperiModule,d.PepperiIconModule,f.PepperiFieldTitleModule]]}),("undefined"==typeof ngJitMode||ngJitMode)&&t.ɵɵsetNgModuleScope(ae,{declarations:[re,C],imports:[n.CommonModule,i.BrowserModule,r.BrowserAnimationsModule,a.ReactiveFormsModule,a.FormsModule,o.MatCommonModule,l.MatFormFieldModule,s.MatInputModule,p.MatButtonModule,u.MatBadgeModule,m.MatIconModule,c.PepperiModule,d.PepperiIconModule,f.PepperiFieldTitleModule],exports:[re]}),e.PepperiQuantitySelectorComponent=re,e.PepperiQuantitySelectorModule=ae,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=pepperi-lib-quantity-selector.umd.min.js.map