ngx-st-qty-input 17.0.2 → 17.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, Component,
|
|
1
|
+
import { ChangeDetectionStrategy, Component, ViewEncapsulation, input, output, model, } from '@angular/core';
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
3
|
import * as i1 from "@angular/common";
|
|
4
4
|
import * as i2 from "@angular/forms";
|
|
@@ -9,45 +9,36 @@ import * as i6 from "@angular/material/icon";
|
|
|
9
9
|
export class QtyInputComponent {
|
|
10
10
|
constructor(changeDetectorRef) {
|
|
11
11
|
this.changeDetectorRef = changeDetectorRef;
|
|
12
|
-
this.
|
|
13
|
-
this.
|
|
14
|
-
this.
|
|
15
|
-
this.
|
|
12
|
+
this.qtyModel = model.required();
|
|
13
|
+
this.allowNegative = input(false);
|
|
14
|
+
this.disabled = input(false);
|
|
15
|
+
this.showError = input(false);
|
|
16
|
+
this.newValueEmitter = output();
|
|
16
17
|
}
|
|
17
18
|
ngOnInit() { }
|
|
18
19
|
removeClicked(event) {
|
|
19
20
|
event.stopImmediatePropagation();
|
|
20
|
-
this.qtyModel
|
|
21
|
-
this.newValueEmitter.emit(this.qtyModel);
|
|
21
|
+
this.qtyModel.update(val => val - 1);
|
|
22
|
+
this.newValueEmitter.emit(this.qtyModel());
|
|
22
23
|
this.changeDetectorRef.markForCheck();
|
|
23
24
|
}
|
|
24
25
|
addClicked(event) {
|
|
25
26
|
event.stopImmediatePropagation();
|
|
26
|
-
this.qtyModel
|
|
27
|
-
this.newValueEmitter.emit(this.qtyModel);
|
|
27
|
+
this.qtyModel.update(val => val + 1);
|
|
28
|
+
this.newValueEmitter.emit(this.qtyModel());
|
|
28
29
|
this.changeDetectorRef.markForCheck();
|
|
29
30
|
}
|
|
30
31
|
qtyModelChanged() {
|
|
31
|
-
if (!this.allowNegative && this.qtyModel < 0) {
|
|
32
|
-
this.qtyModel
|
|
32
|
+
if (!this.allowNegative() && this.qtyModel() < 0) {
|
|
33
|
+
this.qtyModel.set(0);
|
|
33
34
|
}
|
|
34
|
-
this.newValueEmitter.emit(this.qtyModel);
|
|
35
|
+
this.newValueEmitter.emit(this.qtyModel());
|
|
35
36
|
}
|
|
36
37
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: QtyInputComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
37
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
38
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: QtyInputComponent, selector: "ngx-st-qty-input", inputs: { qtyModel: { classPropertyName: "qtyModel", publicName: "qtyModel", isSignal: true, isRequired: true, transformFunction: null }, allowNegative: { classPropertyName: "allowNegative", publicName: "allowNegative", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, showError: { classPropertyName: "showError", publicName: "showError", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { qtyModel: "qtyModelChange", newValueEmitter: "newValueEmitter" }, ngImport: i0, template: "<div class=\"row align-items-center st-qty-input\">\r\n <div class=\"col-xs-auto\">\r\n <button\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"removeClicked($event)\"\r\n [disabled]=\"(!allowNegative() && qtyModel() === 0) || disabled()\"\r\n >\r\n <mat-icon>remove</mat-icon>\r\n </button>\r\n </div>\r\n <div class=\"col\">\r\n <mat-form-field style=\"width: 55px; margin-bottom: -15px\">\r\n <input\r\n matInput\r\n type=\"number\"\r\n [(ngModel)]=\"qtyModel\"\r\n [disabled]=\"disabled()\"\r\n [ngClass]=\"{ 'qty-input-error': showError() }\"\r\n (ngModelChange)=\"qtyModelChanged()\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-xs-auto\">\r\n <button\r\n mat-icon-button\r\n color=\"accent\"\r\n (click)=\"addClicked($event)\"\r\n [disabled]=\"disabled()\"\r\n >\r\n <mat-icon>add</mat-icon>\r\n </button>\r\n </div>\r\n</div>\r\n", styles: [".st-qty-input{min-width:120px;flex-wrap:nowrap!important}.st-qty-input .qty-input-error{color:red;font-weight:700}.st-qty-input .col-auto,.st-qty-input .col{padding:0}.st-qty-input mat-form-field input{text-align:right}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i5.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "component", type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
38
39
|
}
|
|
39
40
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: QtyInputComponent, decorators: [{
|
|
40
41
|
type: Component,
|
|
41
|
-
args: [{ selector: 'ngx-st-qty-input', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<div class=\"row align-items-center st-qty-input\">\r\n <div class=\"col-xs-auto\">\r\n <button\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"removeClicked($event)\"\r\n [disabled]=\"(!allowNegative && qtyModel === 0) || disabled\"\r\n >\r\n <mat-icon>remove</mat-icon>\r\n </button>\r\n </div>\r\n <div class=\"col\">\r\n <mat-form-field style=\"width: 55px; margin-bottom: -15px\">\r\n <input\r\n matInput\r\n type=\"number\"\r\n [(ngModel)]=\"qtyModel\"\r\n [disabled]=\"disabled\"\r\n [ngClass]=\"{ 'qty-input-error': showError }\"\r\n (ngModelChange)=\"qtyModelChanged()\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-xs-auto\">\r\n <button\r\n mat-icon-button\r\n color=\"accent\"\r\n (click)=\"addClicked($event)\"\r\n [disabled]=\"disabled\"\r\n >\r\n <mat-icon>add</mat-icon>\r\n </button>\r\n </div>\r\n</div>\r\n", styles: [".st-qty-input{min-width:120px;flex-wrap:nowrap!important}.st-qty-input .qty-input-error{color:red;font-weight:700}.st-qty-input .col-auto,.st-qty-input .col{padding:0}.st-qty-input mat-form-field input{text-align:right}\n"] }]
|
|
42
|
-
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }]
|
|
43
|
-
|
|
44
|
-
}], allowNegative: [{
|
|
45
|
-
type: Input
|
|
46
|
-
}], disabled: [{
|
|
47
|
-
type: Input
|
|
48
|
-
}], showError: [{
|
|
49
|
-
type: Input
|
|
50
|
-
}], newValueEmitter: [{
|
|
51
|
-
type: Output
|
|
52
|
-
}] } });
|
|
53
|
-
//# sour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bGxvd05lZ2F0aXZlICYmIHF0eU1vZGVsID09PSAwKSB8fCBkaXNhYmxlZFwiXHJcbiAgICA+XHJcbiAgICAgIDxtYXQtaWNvbj5yZW1vdmU8L21hdC1pY29uPlxyXG4gICAgPC9idXR0b24+XHJcbiAgPC9kaXY+XHJcbiAgPGRpdiBjbGFzcz1cImNvbFwiPlxyXG4gICAgPG1hdC1mb3JtLWZpZWxkIHN0eWxlPVwid2lkdGg6IDU1cHg7IG1hcmdpbi1ib3R0b206IC0xNXB4XCI+XHJcbiAgICAgIDxpbnB1dFxyXG4gICAgICAgIG1hdElucHV0XHJcbiAgICAgICAgdHlwZT1cIm51bWJlclwiXHJcbiAgICAgICAgWyhuZ01vZGVsKV09XCJxdHlNb2RlbFwiXHJcbiAgICAgICAgW2Rpc2FibGVkXT1cImRpc2FibGVkXCJcclxuICAgICAgICBbbmdDbGFzc109XCJ7ICdxdHktaW5wdXQtZXJyb3InOiBzaG93RXJyb3IgfVwiXHJcbiAgICAgICAgKG5nTW9kZWxDaGFuZ2UpPVwicXR5TW9kZWxDaGFuZ2VkKClcIlxyXG4gICAgICAvPlxyXG4gICAgPC9tYXQtZm9ybS1maWVsZD5cclxuICA8L2Rpdj5cclxuICA8ZGl2IGNsYXNzPVwiY29sLXhzLWF1dG9cIj5cclxuICAgIDxidXR0b25cclxuICAgICAgbWF0LWljb24tYnV0dG9uXHJcbiAgICAgIGNvbG9yPVwiYWNjZW50XCJcclxuICAgICAgKGNsaWNrKT1cImFkZENsaWNrZWQoJGV2ZW50KVwiXHJcbiAgICAgIFtkaXNhYmxlZF09XCJkaXNhYmxlZFwiXHJcbiAgICA+XHJcbiAgICAgIDxtYXQtaWNvbj5hZGQ8L21hdC1pY29uPlxyXG4gICAgPC9idXR0b24+XHJcbiAgPC9kaXY+XHJcbjwvZGl2PlxyXG4iXX0=
|
|
42
|
+
args: [{ selector: 'ngx-st-qty-input', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<div class=\"row align-items-center st-qty-input\">\r\n <div class=\"col-xs-auto\">\r\n <button\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"removeClicked($event)\"\r\n [disabled]=\"(!allowNegative() && qtyModel() === 0) || disabled()\"\r\n >\r\n <mat-icon>remove</mat-icon>\r\n </button>\r\n </div>\r\n <div class=\"col\">\r\n <mat-form-field style=\"width: 55px; margin-bottom: -15px\">\r\n <input\r\n matInput\r\n type=\"number\"\r\n [(ngModel)]=\"qtyModel\"\r\n [disabled]=\"disabled()\"\r\n [ngClass]=\"{ 'qty-input-error': showError() }\"\r\n (ngModelChange)=\"qtyModelChanged()\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-xs-auto\">\r\n <button\r\n mat-icon-button\r\n color=\"accent\"\r\n (click)=\"addClicked($event)\"\r\n [disabled]=\"disabled()\"\r\n >\r\n <mat-icon>add</mat-icon>\r\n </button>\r\n </div>\r\n</div>\r\n", styles: [".st-qty-input{min-width:120px;flex-wrap:nowrap!important}.st-qty-input .qty-input-error{color:red;font-weight:700}.st-qty-input .col-auto,.st-qty-input .col{padding:0}.st-qty-input mat-form-field input{text-align:right}\n"] }]
|
|
43
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }] });
|
|
44
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicXR5LWlucHV0LmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL25neC1zdC1xdHktaW5wdXQvc3JjL2xpYi9jb21wb25lbnRzL3F0eS1pbnB1dC9xdHktaW5wdXQuY29tcG9uZW50LnRzIiwiLi4vLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvbmd4LXN0LXF0eS1pbnB1dC9zcmMvbGliL2NvbXBvbmVudHMvcXR5LWlucHV0L3F0eS1pbnB1dC5jb21wb25lbnQuaHRtbCJdLCJ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ZT1cIndpZHRoOiA1NXB4OyBtYXJnaW4tYm90dG9tOiAtMTVweFwiPlxyXG4gICAgICA8aW5wdXRcclxuICAgICAgICBtYXRJbnB1dFxyXG4gICAgICAgIHR5cGU9XCJudW1iZXJcIlxyXG4gICAgICAgIFsobmdNb2RlbCldPVwicXR5TW9kZWxcIlxyXG4gICAgICAgIFtkaXNhYmxlZF09XCJkaXNhYmxlZCgpXCJcclxuICAgICAgICBbbmdDbGFzc109XCJ7ICdxdHktaW5wdXQtZXJyb3InOiBzaG93RXJyb3IoKSB9XCJcclxuICAgICAgICAobmdNb2RlbENoYW5nZSk9XCJxdHlNb2RlbENoYW5nZWQoKVwiXHJcbiAgICAgIC8+XHJcbiAgICA8L21hdC1mb3JtLWZpZWxkPlxyXG4gIDwvZGl2PlxyXG4gIDxkaXYgY2xhc3M9XCJjb2wteHMtYXV0b1wiPlxyXG4gICAgPGJ1dHRvblxyXG4gICAgICBtYXQtaWNvbi1idXR0b25cclxuICAgICAgY29sb3I9XCJhY2NlbnRcIlxyXG4gICAgICAoY2xpY2spPVwiYWRkQ2xpY2tlZCgkZXZlbnQpXCJcclxuICAgICAgW2Rpc2FibGVkXT1cImRpc2FibGVkKClcIlxyXG4gICAgPlxyXG4gICAgICA8bWF0LWljb24+YWRkPC9tYXQtaWNvbj5cclxuICAgIDwvYnV0dG9uPlxyXG4gIDwvZGl2PlxyXG48L2Rpdj5cclxuIl19
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { model, input, output, Component, ChangeDetectionStrategy, ViewEncapsulation, NgModule } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
5
5
|
import * as i2 from '@angular/forms';
|
|
@@ -15,47 +15,38 @@ import { MatIconModule } from '@angular/material/icon';
|
|
|
15
15
|
class QtyInputComponent {
|
|
16
16
|
constructor(changeDetectorRef) {
|
|
17
17
|
this.changeDetectorRef = changeDetectorRef;
|
|
18
|
-
this.
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
21
|
-
this.
|
|
18
|
+
this.qtyModel = model.required();
|
|
19
|
+
this.allowNegative = input(false);
|
|
20
|
+
this.disabled = input(false);
|
|
21
|
+
this.showError = input(false);
|
|
22
|
+
this.newValueEmitter = output();
|
|
22
23
|
}
|
|
23
24
|
ngOnInit() { }
|
|
24
25
|
removeClicked(event) {
|
|
25
26
|
event.stopImmediatePropagation();
|
|
26
|
-
this.qtyModel
|
|
27
|
-
this.newValueEmitter.emit(this.qtyModel);
|
|
27
|
+
this.qtyModel.update(val => val - 1);
|
|
28
|
+
this.newValueEmitter.emit(this.qtyModel());
|
|
28
29
|
this.changeDetectorRef.markForCheck();
|
|
29
30
|
}
|
|
30
31
|
addClicked(event) {
|
|
31
32
|
event.stopImmediatePropagation();
|
|
32
|
-
this.qtyModel
|
|
33
|
-
this.newValueEmitter.emit(this.qtyModel);
|
|
33
|
+
this.qtyModel.update(val => val + 1);
|
|
34
|
+
this.newValueEmitter.emit(this.qtyModel());
|
|
34
35
|
this.changeDetectorRef.markForCheck();
|
|
35
36
|
}
|
|
36
37
|
qtyModelChanged() {
|
|
37
|
-
if (!this.allowNegative && this.qtyModel < 0) {
|
|
38
|
-
this.qtyModel
|
|
38
|
+
if (!this.allowNegative() && this.qtyModel() < 0) {
|
|
39
|
+
this.qtyModel.set(0);
|
|
39
40
|
}
|
|
40
|
-
this.newValueEmitter.emit(this.qtyModel);
|
|
41
|
+
this.newValueEmitter.emit(this.qtyModel());
|
|
41
42
|
}
|
|
42
43
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: QtyInputComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
43
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
44
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: QtyInputComponent, selector: "ngx-st-qty-input", inputs: { qtyModel: { classPropertyName: "qtyModel", publicName: "qtyModel", isSignal: true, isRequired: true, transformFunction: null }, allowNegative: { classPropertyName: "allowNegative", publicName: "allowNegative", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, showError: { classPropertyName: "showError", publicName: "showError", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { qtyModel: "qtyModelChange", newValueEmitter: "newValueEmitter" }, ngImport: i0, template: "<div class=\"row align-items-center st-qty-input\">\r\n <div class=\"col-xs-auto\">\r\n <button\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"removeClicked($event)\"\r\n [disabled]=\"(!allowNegative() && qtyModel() === 0) || disabled()\"\r\n >\r\n <mat-icon>remove</mat-icon>\r\n </button>\r\n </div>\r\n <div class=\"col\">\r\n <mat-form-field style=\"width: 55px; margin-bottom: -15px\">\r\n <input\r\n matInput\r\n type=\"number\"\r\n [(ngModel)]=\"qtyModel\"\r\n [disabled]=\"disabled()\"\r\n [ngClass]=\"{ 'qty-input-error': showError() }\"\r\n (ngModelChange)=\"qtyModelChanged()\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-xs-auto\">\r\n <button\r\n mat-icon-button\r\n color=\"accent\"\r\n (click)=\"addClicked($event)\"\r\n [disabled]=\"disabled()\"\r\n >\r\n <mat-icon>add</mat-icon>\r\n </button>\r\n </div>\r\n</div>\r\n", styles: [".st-qty-input{min-width:120px;flex-wrap:nowrap!important}.st-qty-input .qty-input-error{color:red;font-weight:700}.st-qty-input .col-auto,.st-qty-input .col{padding:0}.st-qty-input mat-form-field input{text-align:right}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i5.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "component", type: i1$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
44
45
|
}
|
|
45
46
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: QtyInputComponent, decorators: [{
|
|
46
47
|
type: Component,
|
|
47
|
-
args: [{ selector: 'ngx-st-qty-input', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<div class=\"row align-items-center st-qty-input\">\r\n <div class=\"col-xs-auto\">\r\n <button\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"removeClicked($event)\"\r\n [disabled]=\"(!allowNegative && qtyModel === 0) || disabled\"\r\n >\r\n <mat-icon>remove</mat-icon>\r\n </button>\r\n </div>\r\n <div class=\"col\">\r\n <mat-form-field style=\"width: 55px; margin-bottom: -15px\">\r\n <input\r\n matInput\r\n type=\"number\"\r\n [(ngModel)]=\"qtyModel\"\r\n [disabled]=\"disabled\"\r\n [ngClass]=\"{ 'qty-input-error': showError }\"\r\n (ngModelChange)=\"qtyModelChanged()\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-xs-auto\">\r\n <button\r\n mat-icon-button\r\n color=\"accent\"\r\n (click)=\"addClicked($event)\"\r\n [disabled]=\"disabled\"\r\n >\r\n <mat-icon>add</mat-icon>\r\n </button>\r\n </div>\r\n</div>\r\n", styles: [".st-qty-input{min-width:120px;flex-wrap:nowrap!important}.st-qty-input .qty-input-error{color:red;font-weight:700}.st-qty-input .col-auto,.st-qty-input .col{padding:0}.st-qty-input mat-form-field input{text-align:right}\n"] }]
|
|
48
|
-
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }]
|
|
49
|
-
type: Input
|
|
50
|
-
}], allowNegative: [{
|
|
51
|
-
type: Input
|
|
52
|
-
}], disabled: [{
|
|
53
|
-
type: Input
|
|
54
|
-
}], showError: [{
|
|
55
|
-
type: Input
|
|
56
|
-
}], newValueEmitter: [{
|
|
57
|
-
type: Output
|
|
58
|
-
}] } });
|
|
48
|
+
args: [{ selector: 'ngx-st-qty-input', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<div class=\"row align-items-center st-qty-input\">\r\n <div class=\"col-xs-auto\">\r\n <button\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"removeClicked($event)\"\r\n [disabled]=\"(!allowNegative() && qtyModel() === 0) || disabled()\"\r\n >\r\n <mat-icon>remove</mat-icon>\r\n </button>\r\n </div>\r\n <div class=\"col\">\r\n <mat-form-field style=\"width: 55px; margin-bottom: -15px\">\r\n <input\r\n matInput\r\n type=\"number\"\r\n [(ngModel)]=\"qtyModel\"\r\n [disabled]=\"disabled()\"\r\n [ngClass]=\"{ 'qty-input-error': showError() }\"\r\n (ngModelChange)=\"qtyModelChanged()\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-xs-auto\">\r\n <button\r\n mat-icon-button\r\n color=\"accent\"\r\n (click)=\"addClicked($event)\"\r\n [disabled]=\"disabled()\"\r\n >\r\n <mat-icon>add</mat-icon>\r\n </button>\r\n </div>\r\n</div>\r\n", styles: [".st-qty-input{min-width:120px;flex-wrap:nowrap!important}.st-qty-input .qty-input-error{color:red;font-weight:700}.st-qty-input .col-auto,.st-qty-input .col{padding:0}.st-qty-input mat-form-field input{text-align:right}\n"] }]
|
|
49
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }] });
|
|
59
50
|
|
|
60
51
|
class StQtyInputModule {
|
|
61
52
|
constructor(matIconRegistry) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngx-st-qty-input.mjs","sources":["../../../projects/ngx-st-qty-input/src/lib/components/qty-input/qty-input.component.ts","../../../projects/ngx-st-qty-input/src/lib/components/qty-input/qty-input.component.html","../../../projects/ngx-st-qty-input/src/lib/ngx-st-qty-input.module.ts","../../../projects/ngx-st-qty-input/src/public-api.ts","../../../projects/ngx-st-qty-input/src/ngx-st-qty-input.ts"],"sourcesContent":["import {\r\n ChangeDetectionStrategy,\r\n ChangeDetectorRef,\r\n Component,\r\n
|
|
1
|
+
{"version":3,"file":"ngx-st-qty-input.mjs","sources":["../../../projects/ngx-st-qty-input/src/lib/components/qty-input/qty-input.component.ts","../../../projects/ngx-st-qty-input/src/lib/components/qty-input/qty-input.component.html","../../../projects/ngx-st-qty-input/src/lib/ngx-st-qty-input.module.ts","../../../projects/ngx-st-qty-input/src/public-api.ts","../../../projects/ngx-st-qty-input/src/ngx-st-qty-input.ts"],"sourcesContent":["import {\r\n ChangeDetectionStrategy,\r\n ChangeDetectorRef,\r\n Component,\r\n OnInit,\r\n ViewEncapsulation,\r\n input,\r\n output,\r\n model,\r\n} from '@angular/core';\r\n\r\n@Component({\r\n selector: 'ngx-st-qty-input',\r\n templateUrl: './qty-input.component.html',\r\n styleUrls: ['./qty-input.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n encapsulation: ViewEncapsulation.None,\r\n})\r\nexport class QtyInputComponent implements OnInit {\r\n qtyModel = model.required<number>();\r\n\r\n allowNegative = input<boolean>(false);\r\n\r\n disabled = input<boolean>(false);\r\n\r\n showError = input(false);\r\n\r\n newValueEmitter = output<number>();\r\n\r\n constructor(private changeDetectorRef: ChangeDetectorRef) {}\r\n\r\n ngOnInit(): void {}\r\n\r\n removeClicked(event: MouseEvent) {\r\n event.stopImmediatePropagation();\r\n\r\n this.qtyModel.update(val => val - 1);\r\n this.newValueEmitter.emit(this.qtyModel());\r\n this.changeDetectorRef.markForCheck();\r\n }\r\n\r\n addClicked(event: MouseEvent) {\r\n event.stopImmediatePropagation();\r\n\r\n this.qtyModel.update(val => val + 1);\r\n this.newValueEmitter.emit(this.qtyModel());\r\n this.changeDetectorRef.markForCheck();\r\n }\r\n\r\n qtyModelChanged() {\r\n if (!this.allowNegative() && this.qtyModel() < 0) {\r\n this.qtyModel.set(0);\r\n }\r\n\r\n this.newValueEmitter.emit(this.qtyModel());\r\n }\r\n}\r\n","<div class=\"row align-items-center st-qty-input\">\r\n <div class=\"col-xs-auto\">\r\n <button\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"removeClicked($event)\"\r\n [disabled]=\"(!allowNegative() && qtyModel() === 0) || disabled()\"\r\n >\r\n <mat-icon>remove</mat-icon>\r\n </button>\r\n </div>\r\n <div class=\"col\">\r\n <mat-form-field style=\"width: 55px; margin-bottom: -15px\">\r\n <input\r\n matInput\r\n type=\"number\"\r\n [(ngModel)]=\"qtyModel\"\r\n [disabled]=\"disabled()\"\r\n [ngClass]=\"{ 'qty-input-error': showError() }\"\r\n (ngModelChange)=\"qtyModelChanged()\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-xs-auto\">\r\n <button\r\n mat-icon-button\r\n color=\"accent\"\r\n (click)=\"addClicked($event)\"\r\n [disabled]=\"disabled()\"\r\n >\r\n <mat-icon>add</mat-icon>\r\n </button>\r\n </div>\r\n</div>\r\n","import { NgModule } from '@angular/core';\r\nimport { QtyInputComponent } from './components/qty-input/qty-input.component';\r\nimport { CommonModule } from '@angular/common';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { MatIconModule, MatIconRegistry } from '@angular/material/icon';\r\n\r\n@NgModule({\r\n declarations: [QtyInputComponent],\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n MatButtonModule,\r\n MatInputModule,\r\n MatIconModule,\r\n ],\r\n exports: [QtyInputComponent],\r\n})\r\nexport class StQtyInputModule {\r\n constructor(private matIconRegistry: MatIconRegistry) {\r\n this.matIconRegistry.setDefaultFontSetClass('material-symbols-outlined');\r\n }\r\n}\r\n","/*\r\n * Public API Surface of ngx-st-qty-input\r\n */\r\n\r\nexport * from './lib/components/qty-input/qty-input.component';\r\nexport * from './lib/ngx-st-qty-input.module';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i6","i1"],"mappings":";;;;;;;;;;;;;;MAkBa,iBAAiB,CAAA;AAW5B,IAAA,WAAA,CAAoB,iBAAoC,EAAA;QAApC,IAAiB,CAAA,iBAAA,GAAjB,iBAAiB;AAVrC,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAC,QAAQ,EAAU;AAEnC,QAAA,IAAA,CAAA,aAAa,GAAG,KAAK,CAAU,KAAK,CAAC;AAErC,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAU,KAAK,CAAC;AAEhC,QAAA,IAAA,CAAA,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC;QAExB,IAAe,CAAA,eAAA,GAAG,MAAM,EAAU;;AAIlC,IAAA,QAAQ;AAER,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,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,YATzB,YAAY;YACZ,WAAW;YACX,mBAAmB;YACnB,eAAe;YACf,cAAc;YACd,aAAa,CAAA,EAAA,CAAA,CAAA;;4FAIJ,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAZ5B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,YAAY,EAAE,CAAC,iBAAiB,CAAC;AACjC,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,WAAW;wBACX,mBAAmB;wBACnB,eAAe;wBACf,cAAc;wBACd,aAAa;AACd,qBAAA;oBACD,OAAO,EAAE,CAAC,iBAAiB,CAAC;AAC7B,iBAAA;;;ACnBD;;AAEG;;ACFH;;AAEG;;;;"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { ChangeDetectorRef,
|
|
1
|
+
import { ChangeDetectorRef, OnInit } from '@angular/core';
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
3
|
export declare class QtyInputComponent implements OnInit {
|
|
4
4
|
private changeDetectorRef;
|
|
5
|
-
qtyModel: number
|
|
6
|
-
allowNegative: boolean
|
|
7
|
-
disabled: boolean
|
|
8
|
-
showError: boolean
|
|
9
|
-
newValueEmitter:
|
|
5
|
+
qtyModel: import("@angular/core").ModelSignal<number>;
|
|
6
|
+
allowNegative: import("@angular/core").InputSignal<boolean>;
|
|
7
|
+
disabled: import("@angular/core").InputSignal<boolean>;
|
|
8
|
+
showError: import("@angular/core").InputSignal<boolean>;
|
|
9
|
+
newValueEmitter: import("@angular/core").OutputEmitterRef<number>;
|
|
10
10
|
constructor(changeDetectorRef: ChangeDetectorRef);
|
|
11
11
|
ngOnInit(): void;
|
|
12
12
|
removeClicked(event: MouseEvent): void;
|
|
13
13
|
addClicked(event: MouseEvent): void;
|
|
14
14
|
qtyModelChanged(): void;
|
|
15
15
|
static ɵfac: i0.ɵɵFactoryDeclaration<QtyInputComponent, never>;
|
|
16
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<QtyInputComponent, "ngx-st-qty-input", never, { "qtyModel": { "alias": "qtyModel"; "required":
|
|
16
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<QtyInputComponent, "ngx-st-qty-input", never, { "qtyModel": { "alias": "qtyModel"; "required": true; "isSignal": true; }; "allowNegative": { "alias": "allowNegative"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "showError": { "alias": "showError"; "required": false; "isSignal": true; }; }, { "qtyModel": "qtyModelChange"; "newValueEmitter": "newValueEmitter"; }, never, never, false, never>;
|
|
17
17
|
}
|