@pepperi/ngx-lib
Version:
Pepperi Angular Components and Services
17 lines (14 loc) • 31.8 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/ngx-lib"),require("@pepperi/ngx-lib/icon"),require("@pepperi/ngx-lib/field-title"),require("@angular/animations"),require("jquery"),require("@ngx-translate/core")):"function"==typeof define&&define.amd?define("@pepperi/ngx-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/ngx-lib","@pepperi/ngx-lib/icon","@pepperi/ngx-lib/field-title","@angular/animations","jquery","@ngx-translate/core"],t):t(((e=e||self)["pepperi-addons"]=e["pepperi-addons"]||{},e["pepperi-addons"]["ngx-lib"]=e["pepperi-addons"]["ngx-lib"]||{},e["pepperi-addons"]["ngx-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-addons"]["ngx-lib"],e["pepperi-addons"]["ngx-lib"].icon,e["pepperi-addons"]["ngx-lib"]["field-title"],e.ng.animations,e.jquery,e.translate)}(this,(function(e,t,n,i,a,r,o,l,s,p,u,c,m,d,f,g,h,y){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */Object.create;function C(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}Object.create;var v=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}();v.ɵfac=function(e){return new(e||v)},v.ɵpipe=t.ɵɵdefinePipe({name:"quantitySelectorNumber",type:v,pure:!0});var x=["QSCont"],E=["QSInput"];function b(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 w(e,n){1&e&&t.ɵɵelementContainer(0)}var S=function(e,t,n){return{caution:e,md:t,xs:n}};function I(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,S,i.isCaution,1!==i.rowSpan,1===i.rowSpan)),t.ɵɵadvance(1),t.ɵɵtextInterpolate1(" ",i.formattedValue," ")}}var M=function(e,t){return{caution:e,"keep-background-on-focus":t}};function T(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 a=t.ɵɵnextContext(4);t.ɵɵproperty("ngClass",t.ɵɵpureFunction2(1,M,a.isCaution&&a.styleClass!==a.STYLE_TYPE.Strong,a.styleClass===a.STYLE_TYPE.Strong))}}function P(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 a=t.ɵɵnextContext(4);t.ɵɵproperty("ngClass",t.ɵɵpureFunction2(1,M,a.isCaution&&a.styleClass!==a.STYLE_TYPE.Strong,a.styleClass===a.STYLE_TYPE.Strong))}}function _(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,_,3,4,"span",20),t.ɵɵelementEnd()),2&e){var i=t.ɵɵnextContext(4);t.ɵɵadvance(1),t.ɵɵproperty("ngForOf",i.messages)}}function O(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,T,3,4,"button",14),t.ɵɵtemplate(5,P,3,4,"button",15),t.ɵɵtemplate(6,k,2,1,"mat-error",2),t.ɵɵelementEnd()}if(2&e){var a=t.ɵɵnextContext(3);t.ɵɵadvance(1),t.ɵɵpropertyInterpolate("name",a.key),t.ɵɵpropertyInterpolate("title",a.formattedValue),t.ɵɵproperty("id",a.key)("formControlName",a.key)("value",a.isFocus?t.ɵɵpipeBind2(3,9,a.value,a.alowDecimal):a.formattedValue)("disabled",a.disabled),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",a.showQsBtn),t.ɵɵadvance(1),t.ɵɵproperty("ngIf",a.showQsBtn),t.ɵɵadvance(1),t.ɵɵproperty("ngIf",(null==a.messages?null:a.messages.length)>0)}}function q(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,w,1,0,"ng-container",7),t.ɵɵtemplate(2,I,2,11,"ng-template",null,8,t.ɵɵtemplateRefExtractor),t.ɵɵtemplate(4,O,7,12,"ng-template",null,9,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){var i=t.ɵɵreference(3),a=t.ɵɵreference(5),r=t.ɵɵnextContext(2);t.ɵɵadvance(1),t.ɵɵproperty("ngIf",r.readonly)("ngIfThen",i)("ngIfElse",a)}}function F(e,n){1&e&&t.ɵɵelementContainer(0)}function R(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,S,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 Q(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 a=t.ɵɵnextContext(3);t.ɵɵproperty("ngIf","2"==a.xAlignment),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("name",a.key),t.ɵɵpropertyInterpolate("title",a.formattedValue),t.ɵɵproperty("id",a.key)("formControlName",a.key)("value",a.isFocus?t.ɵɵpipeBind2(4,9,a.value,a.alowDecimal):a.formattedValue)("disabled",a.disabled),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",(null==a.messages?null:a.messages.length)>0),t.ɵɵadvance(1),t.ɵɵproperty("ngIf","2"!=a.xAlignment)}}function N(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,F,1,0,"ng-container",7),t.ɵɵtemplate(2,R,2,9,"ng-template",null,8,t.ɵɵtemplateRefExtractor),t.ɵɵtemplate(4,Q,7,12,"ng-template",null,9,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){var i=t.ɵɵreference(3),a=t.ɵɵreference(5),r=t.ɵɵnextContext(2);t.ɵɵadvance(1),t.ɵɵproperty("ngIf",r.readonly)("ngIfThen",i)("ngIfElse",a)}}function L(e,n){1&e&&t.ɵɵelementContainer(0)}function D(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 a=t.ɵɵnextContext(3);t.ɵɵclassMapInterpolate1("pepperi-button ",a.styleClass," ellipsis"),t.ɵɵpropertyInterpolate("name",a.key),t.ɵɵproperty("id",a.key)("ngClass",t.ɵɵpureFunction3(12,S,a.isCaution,1!==a.rowSpan,1===a.rowSpan))("title",t.ɵɵpipeBind1(1,8,"QS.ORDER")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,10,"QS.ORDER")," ")}}function K(e,n){1&e&&t.ɵɵelementContainer(0)}function z(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 a=t.ɵɵnextContext(4);t.ɵɵclassMapInterpolate1("pepperi-button ",a.styleClass," ellipsis right-alignment"),t.ɵɵpropertyInterpolate("matBadge",a.formattedValue),t.ɵɵpropertyInterpolate("name",a.key),t.ɵɵproperty("matBadgeSize",a.layoutType===a.LAYOUT_TYPE.PepperiCard&&1===a.rowSpan?"small":"medium")("id",a.key)("ngClass",t.ɵɵpureFunction3(14,S,a.isCaution,1!==a.rowSpan,1===a.rowSpan))("title",t.ɵɵpipeBind1(1,10,"QS.ORDER")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,12,"QS.ORDER")," ")}}function U(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 a=t.ɵɵnextContext(4);t.ɵɵclassMapInterpolate1("pepperi-button ",a.styleClass," ellipsis left-alignment"),t.ɵɵpropertyInterpolate("matBadge",a.formattedValue),t.ɵɵpropertyInterpolate("name",a.key),t.ɵɵproperty("matBadgeSize",a.layoutType===a.LAYOUT_TYPE.PepperiCard&&1===a.rowSpan?"small":"medium")("id",a.key)("ngClass",t.ɵɵpureFunction3(14,S,a.isCaution,1!==a.rowSpan,1===a.rowSpan))("title",t.ɵɵpipeBind1(1,10,"QS.ORDER")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,12,"QS.ORDER")," ")}}function W(e,n){if(1&e&&(t.ɵɵtemplate(0,K,1,0,"ng-container",7),t.ɵɵtemplate(1,z,4,18,"ng-template",null,32,t.ɵɵtemplateRefExtractor),t.ɵɵtemplate(3,U,4,18,"ng-template",null,33,t.ɵɵtemplateRefExtractor)),2&e){var i=t.ɵɵreference(2),a=t.ɵɵreference(4),r=t.ɵɵnextContext(3);t.ɵɵproperty("ngIf","2"==r.xAlignment)("ngIfThen",i)("ngIfElse",a)}}function j(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,L,1,0,"ng-container",7),t.ɵɵtemplate(2,D,4,16,"ng-template",null,29,t.ɵɵtemplateRefExtractor),t.ɵɵtemplate(4,W,5,3,"ng-template",null,30,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){var i=t.ɵɵreference(3),a=t.ɵɵreference(5),r=t.ɵɵnextContext(2);t.ɵɵadvance(1),t.ɵɵproperty("ngIf","0"==r.value)("ngIfThen",i)("ngIfElse",a)}}function G(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 a=t.ɵɵnextContext(2);t.ɵɵadvance(1),t.ɵɵclassMapInterpolate1("pepperi-button ",a.styleClass," ellipsis"),t.ɵɵpropertyInterpolate("name",a.key),t.ɵɵpropertyInterpolate("title",t.ɵɵpipeBind1(2,9,"QS.ORDER")),t.ɵɵproperty("id",a.key)("ngClass",t.ɵɵpureFunction3(13,S,a.isCaution,1!==a.rowSpan,1===a.rowSpan)),t.ɵɵadvance(2),t.ɵɵtextInterpolate2(" ",t.ɵɵpipeBind1(4,11,"QS.ORDER")," (",a.formattedValue,") ")}}var H=function(e,t,n,i,a){return{"pepperi-table-quantity-selector":e,"one-row":t,caution:n,"matrix-qs":i,"zero-quantity":a}};function J(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3,4),t.ɵɵtemplate(2,b,1,5,"pep-field-title",5),t.ɵɵtemplate(3,q,6,3,"ng-container",2),t.ɵɵtemplate(4,N,6,3,"ng-container",2),t.ɵɵtemplate(5,j,6,3,"ng-container",2),t.ɵɵtemplate(6,G,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,H,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 $(e,n){1&e&&t.ɵɵelementContainer(0)}function X(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,$,1,0,"ng-container",37),t.ɵɵelementContainerEnd()),2&e){t.ɵɵnextContext();var i=t.ɵɵreference(2);t.ɵɵadvance(1),t.ɵɵproperty("ngTemplateOutlet",i)}}function Z(e,n){1&e&&t.ɵɵelementContainer(0)}function ee(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,Z,1,0,"ng-container",37),t.ɵɵelementContainerEnd()),2&e){t.ɵɵnextContext();var i=t.ɵɵreference(2);t.ɵɵadvance(1),t.ɵɵproperty("ngTemplateOutlet",i)}}function te(e,n){1&e&&t.ɵɵelementContainer(0)}function ne(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,te,1,0,"ng-container",37),t.ɵɵelementContainerEnd()),2&e){t.ɵɵnextContext();var i=t.ɵɵreference(2);t.ɵɵadvance(1),t.ɵɵproperty("ngTemplateOutlet",i)}}function ie(e,n){1&e&&t.ɵɵelementContainer(0)}function ae(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,ie,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,a){this.cd=e,this.customizationService=n,this.renderer=i,this.element=a,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=m.LAYOUT_TYPE.PepperiForm,this.isActive=!1,this.valueChanged=new t.EventEmitter,this.elementClicked=new t.EventEmitter,this.LAYOUT_TYPE=m.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=m.STYLE_TYPE,this.styleClass=m.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,m.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,n,i=this;this.isEmptyKey&&""!==this.key&&(this.form=this.customizationService.getDefaultFromGroup(this.key,this.value,this.required,this.readonly,this.disabled)),this.isCaution="#FF0000"===this.textColor;var a=this.notificationInfo&&this.notificationInfo.length>0?JSON.parse(this.notificationInfo).Messages:"";if(a&&a.length>0){try{for(var r=C(a),o=r.next();!o.done;o=r.next()){var l=o.value;"Inventory_Limit_Msg"===l.Key?l.Key="MESSAGES.ERROR_INVENTORY_LIMIT":"Case_Quantity_Limit_Msg"===l.Key?l.Key="MESSAGES.ERROR_CASE_QUANTITY_LIMIT":"Min_Quantity_Limit_Msg"===l.Key?l.Key="MESSAGES.ERROR_MIN_QUANTITY_LIMIT":"Max_Quantity_Limit_Msg"===l.Key&&(l.Key="MESSAGES.ERROR_MAX_QUANTITY_LIMIT")}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}this.messages=a,this.form.controls[this.key].setErrors({serverError:"Error"}),setTimeout((function(){i.QSInput&&i.QSInput.nativeElement&&i.QSInput.nativeElement.focus()}),150)}else{var s=this;setTimeout((function(){s.lastFocusField?(s.lastFocusField.focus(),s.lastFocusField=null):s.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===m.LAYOUT_TYPE.PepperiTable?n=h(i).parents(".table-row"):this.layoutType===m.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===m.LAYOUT_TYPE.Editmodal||this.layoutType===m.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(m.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(m.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(x,!0),t.ɵɵviewQuery(E,!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,J,7,15,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵtemplate(3,X,2,1,"ng-container",2),t.ɵɵtemplate(4,ee,2,1,"ng-container",2),t.ɵɵtemplate(5,ne,2,1,"ng-container",2),t.ɵɵtemplate(6,ae,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:[r.NgControlStatusGroup,r.FormGroupDirective,n.NgIf,n.NgClass,f.PepperiFieldTitleComponent,p.MatButton,l.MatFormField,s.MatInput,r.DefaultValueAccessor,r.NgControlStatus,r.FormControlName,l.MatPrefix,c.MatIcon,d.PepperiIconComponent,l.MatSuffix,l.MatError,n.NgForOf,u.MatBadge,n.NgTemplateOutlet],pipes:[v,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 oe=function(e){this.pepperiIconRegistry=e,this.pepperiIconRegistry.registerIcons([d.pepperiIconNumberMinus,d.pepperiIconNumberPlus])};oe.ɵmod=t.ɵɵdefineNgModule({type:oe}),oe.ɵinj=t.ɵɵdefineInjector({factory:function(e){return new(e||oe)(t.ɵɵinject(d.PepperiIconRegistry))},imports:[[n.CommonModule,i.BrowserModule,a.BrowserAnimationsModule,r.ReactiveFormsModule,r.FormsModule,o.MatCommonModule,l.MatFormFieldModule,s.MatInputModule,p.MatButtonModule,u.MatBadgeModule,c.MatIconModule,m.PepperiModule,d.PepperiIconModule,f.PepperiFieldTitleModule]]}),("undefined"==typeof ngJitMode||ngJitMode)&&t.ɵɵsetNgModuleScope(oe,{declarations:[re,v],imports:[n.CommonModule,i.BrowserModule,a.BrowserAnimationsModule,r.ReactiveFormsModule,r.FormsModule,o.MatCommonModule,l.MatFormFieldModule,s.MatInputModule,p.MatButtonModule,u.MatBadgeModule,c.MatIconModule,m.PepperiModule,d.PepperiIconModule,f.PepperiFieldTitleModule],exports:[re]}),e.PepperiQuantitySelectorComponent=re,e.PepperiQuantitySelectorModule=oe,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=pepperi-addons-ngx-lib-quantity-selector.umd.min.js.map