ngx-st-qty-input 18.0.3 → 18.0.5
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.
package/README.md
CHANGED
|
@@ -15,12 +15,14 @@
|
|
|
15
15
|
|
|
16
16
|
The `ngx-st-qty-input` component is a quantity selector with increment/decrement buttons. Features include:
|
|
17
17
|
- Plus/minus buttons for incrementing/decrementing values
|
|
18
|
-
- Direct numeric input
|
|
18
|
+
- Direct numeric input (spinner arrows hidden for cleaner UI)
|
|
19
19
|
- Negative value support (optional)
|
|
20
20
|
- Two-way data binding with model
|
|
21
21
|
- Disabled state support
|
|
22
22
|
- Error state display
|
|
23
23
|
- Change event emission
|
|
24
|
+
- Customizable input width
|
|
25
|
+
- Material Design form field appearance options
|
|
24
26
|
|
|
25
27
|
---
|
|
26
28
|
|
|
@@ -96,6 +98,27 @@ export class AppModule { }
|
|
|
96
98
|
[showError]="hasValidationError"
|
|
97
99
|
```
|
|
98
100
|
|
|
101
|
+
### `appearance`
|
|
102
|
+
- **Type:** `'fill' | 'outline'`
|
|
103
|
+
- **Default:** `'fill'`
|
|
104
|
+
- **Description:** Material Design form field appearance. 'fill' for filled style, 'outline' for outlined style.
|
|
105
|
+
- **Example:**
|
|
106
|
+
```html
|
|
107
|
+
[appearance]="'fill'"
|
|
108
|
+
[appearance]="'outline'"
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### `inputWidth`
|
|
112
|
+
- **Type:** `string`
|
|
113
|
+
- **Default:** `'55px'`
|
|
114
|
+
- **Description:** CSS width value for the input field. Allows customization of the input width by parent components.
|
|
115
|
+
- **Example:**
|
|
116
|
+
```html
|
|
117
|
+
[inputWidth]="'60px'"
|
|
118
|
+
[inputWidth]="'80px'"
|
|
119
|
+
[inputWidth]="'100%'"
|
|
120
|
+
```
|
|
121
|
+
|
|
99
122
|
---
|
|
100
123
|
|
|
101
124
|
## Outputs
|
|
@@ -419,7 +442,89 @@ export class PriceCalculatorComponent {
|
|
|
419
442
|
}
|
|
420
443
|
```
|
|
421
444
|
|
|
422
|
-
### Example 8:
|
|
445
|
+
### Example 8: Customizing Input Width
|
|
446
|
+
|
|
447
|
+
```typescript
|
|
448
|
+
// Component
|
|
449
|
+
@Component({
|
|
450
|
+
selector: 'app-customizable-qty',
|
|
451
|
+
template: `
|
|
452
|
+
<div class="qty-variants">
|
|
453
|
+
<div class="compact">
|
|
454
|
+
<label>Compact (55px):</label>
|
|
455
|
+
<ngx-st-qty-input
|
|
456
|
+
[(qtyModel)]="quantity1"
|
|
457
|
+
[inputWidth]="'55px'">
|
|
458
|
+
</ngx-st-qty-input>
|
|
459
|
+
</div>
|
|
460
|
+
|
|
461
|
+
<div class="medium">
|
|
462
|
+
<label>Medium (80px):</label>
|
|
463
|
+
<ngx-st-qty-input
|
|
464
|
+
[(qtyModel)]="quantity2"
|
|
465
|
+
[inputWidth]="'80px'">
|
|
466
|
+
</ngx-st-qty-input>
|
|
467
|
+
</div>
|
|
468
|
+
|
|
469
|
+
<div class="large">
|
|
470
|
+
<label>Large (120px):</label>
|
|
471
|
+
<ngx-st-qty-input
|
|
472
|
+
[(qtyModel)]="quantity3"
|
|
473
|
+
[inputWidth]="'120px'">
|
|
474
|
+
</ngx-st-qty-input>
|
|
475
|
+
</div>
|
|
476
|
+
|
|
477
|
+
<div class="responsive">
|
|
478
|
+
<label>Full Width:</label>
|
|
479
|
+
<ngx-st-qty-input
|
|
480
|
+
[(qtyModel)]="quantity4"
|
|
481
|
+
[inputWidth]="'100%'">
|
|
482
|
+
</ngx-st-qty-input>
|
|
483
|
+
</div>
|
|
484
|
+
</div>
|
|
485
|
+
`
|
|
486
|
+
})
|
|
487
|
+
export class CustomizableQtyComponent {
|
|
488
|
+
quantity1 = 1;
|
|
489
|
+
quantity2 = 2;
|
|
490
|
+
quantity3 = 3;
|
|
491
|
+
quantity4 = 1;
|
|
492
|
+
}
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
### Example 9: Different Material Appearances
|
|
496
|
+
|
|
497
|
+
```typescript
|
|
498
|
+
// Component
|
|
499
|
+
@Component({
|
|
500
|
+
selector: 'app-appearance-variants',
|
|
501
|
+
template: `
|
|
502
|
+
<div class="appearance-variants">
|
|
503
|
+
<div class="filled">
|
|
504
|
+
<label>Filled Appearance (Default):</label>
|
|
505
|
+
<ngx-st-qty-input
|
|
506
|
+
[(qtyModel)]="quantity1"
|
|
507
|
+
[appearance]="'fill'">
|
|
508
|
+
</ngx-st-qty-input>
|
|
509
|
+
</div>
|
|
510
|
+
|
|
511
|
+
<div class="outlined">
|
|
512
|
+
<label>Outlined Appearance:</label>
|
|
513
|
+
<ngx-st-qty-input
|
|
514
|
+
[(qtyModel)]="quantity2"
|
|
515
|
+
[appearance]="'outline'">
|
|
516
|
+
</ngx-st-qty-input>
|
|
517
|
+
</div>
|
|
518
|
+
</div>
|
|
519
|
+
`
|
|
520
|
+
})
|
|
521
|
+
export class AppearanceVariantsComponent {
|
|
522
|
+
quantity1 = 1;
|
|
523
|
+
quantity2 = 1;
|
|
524
|
+
}
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
### Example 10: With Stock Availability
|
|
423
528
|
|
|
424
529
|
```typescript
|
|
425
530
|
// Component
|
|
@@ -537,6 +642,11 @@ export class StockAwareQtyComponent {
|
|
|
537
642
|
|
|
538
643
|
## Component Behavior
|
|
539
644
|
|
|
645
|
+
### Input Field Design
|
|
646
|
+
- **Spinner Arrows Hidden**: The native HTML number input spinner arrows (up/down) are intentionally hidden for a cleaner UI design. Users should use the dedicated plus/minus buttons instead.
|
|
647
|
+
- **Browser Compatibility**: The hiding of spinner arrows is implemented using CSS that works across all modern browsers (Chrome, Firefox, Safari, Edge).
|
|
648
|
+
- **Clean Aesthetic**: This provides a unified, Material Design-compliant appearance without browser-specific controls.
|
|
649
|
+
|
|
540
650
|
### Increment Button (+)
|
|
541
651
|
- Increases value by 1
|
|
542
652
|
- Emits `newValueEmitter` event
|
|
@@ -13,7 +13,12 @@ export class QtyInputComponent {
|
|
|
13
13
|
this.allowNegative = input(false);
|
|
14
14
|
this.disabled = input(false);
|
|
15
15
|
this.showError = input(false);
|
|
16
|
+
/**
|
|
17
|
+
* When true, displays the input with red border to indicate a validation error
|
|
18
|
+
*/
|
|
19
|
+
this.error = input(false);
|
|
16
20
|
this.appearance = input('fill');
|
|
21
|
+
this.inputWidth = input('55px');
|
|
17
22
|
this.newValueEmitter = output();
|
|
18
23
|
}
|
|
19
24
|
ngOnInit() { }
|
|
@@ -36,10 +41,10 @@ export class QtyInputComponent {
|
|
|
36
41
|
this.newValueEmitter.emit(this.qtyModel());
|
|
37
42
|
}
|
|
38
43
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: QtyInputComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
39
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.14", 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 }, appearance: { classPropertyName: "appearance", publicName: "appearance", 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
|
|
44
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.14", 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 }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, appearance: { classPropertyName: "appearance", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, inputWidth: { classPropertyName: "inputWidth", publicName: "inputWidth", 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\r\n [style.width]=\"inputWidth()\"\r\n [appearance]=\"appearance()\"\r\n [class.field-error]=\"error()\">\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}.st-qty-input input[type=number]::-webkit-outer-spin-button,.st-qty-input input[type=number]::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.st-qty-input input[type=number]{-moz-appearance:textfield}.field-error ::ng-deep .mat-mdc-text-field-wrapper .mat-mdc-form-field-focus-overlay{background-color:#f443360d}.field-error ::ng-deep .mdc-text-field--outlined .mdc-notched-outline .mdc-notched-outline__leading,.field-error ::ng-deep .mdc-text-field--outlined .mdc-notched-outline .mdc-notched-outline__notch,.field-error ::ng-deep .mdc-text-field--outlined .mdc-notched-outline .mdc-notched-outline__trailing,.field-error ::ng-deep .mdc-text-field--filled .mdc-notched-outline .mdc-notched-outline__leading,.field-error ::ng-deep .mdc-text-field--filled .mdc-notched-outline .mdc-notched-outline__notch,.field-error ::ng-deep .mdc-text-field--filled .mdc-notched-outline .mdc-notched-outline__trailing{border-color:#f44336!important;border-width:2px!important}.field-error ::ng-deep .mat-mdc-input-element{color:#f44336}\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 }); }
|
|
40
45
|
}
|
|
41
46
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: QtyInputComponent, decorators: [{
|
|
42
47
|
type: Component,
|
|
43
|
-
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
|
|
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\r\n [style.width]=\"inputWidth()\"\r\n [appearance]=\"appearance()\"\r\n [class.field-error]=\"error()\">\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}.st-qty-input input[type=number]::-webkit-outer-spin-button,.st-qty-input input[type=number]::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.st-qty-input input[type=number]{-moz-appearance:textfield}.field-error ::ng-deep .mat-mdc-text-field-wrapper .mat-mdc-form-field-focus-overlay{background-color:#f443360d}.field-error ::ng-deep .mdc-text-field--outlined .mdc-notched-outline .mdc-notched-outline__leading,.field-error ::ng-deep .mdc-text-field--outlined .mdc-notched-outline .mdc-notched-outline__notch,.field-error ::ng-deep .mdc-text-field--outlined .mdc-notched-outline .mdc-notched-outline__trailing,.field-error ::ng-deep .mdc-text-field--filled .mdc-notched-outline .mdc-notched-outline__leading,.field-error ::ng-deep .mdc-text-field--filled .mdc-notched-outline .mdc-notched-outline__notch,.field-error ::ng-deep .mdc-text-field--filled .mdc-notched-outline .mdc-notched-outline__trailing{border-color:#f44336!important;border-width:2px!important}.field-error ::ng-deep .mat-mdc-input-element{color:#f44336}\n"] }]
|
|
44
49
|
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }] });
|
|
45
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
50
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJ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WJlclwiXHJcbiAgICAgICAgWyhuZ01vZGVsKV09XCJxdHlNb2RlbFwiXHJcbiAgICAgICAgW2Rpc2FibGVkXT1cImRpc2FibGVkKClcIlxyXG4gICAgICAgIFtuZ0NsYXNzXT1cInsgJ3F0eS1pbnB1dC1lcnJvcic6IHNob3dFcnJvcigpIH1cIlxyXG4gICAgICAgIChuZ01vZGVsQ2hhbmdlKT1cInF0eU1vZGVsQ2hhbmdlZCgpXCJcclxuICAgICAgLz5cclxuICAgIDwvbWF0LWZvcm0tZmllbGQ+XHJcbiAgPC9kaXY+XHJcbiAgPGRpdiBjbGFzcz1cImNvbC14cy1hdXRvXCI+XHJcbiAgICA8YnV0dG9uXHJcbiAgICAgIG1hdC1pY29uLWJ1dHRvblxyXG4gICAgICBjb2xvcj1cImFjY2VudFwiXHJcbiAgICAgIChjbGljayk9XCJhZGRDbGlja2VkKCRldmVudClcIlxyXG4gICAgICBbZGlzYWJsZWRdPVwiZGlzYWJsZWQoKVwiXHJcbiAgICA+XHJcbiAgICAgIDxtYXQtaWNvbj5hZGQ8L21hdC1pY29uPlxyXG4gICAgPC9idXR0b24+XHJcbiAgPC9kaXY+XHJcbjwvZGl2PlxyXG4iXX0=
|
|
@@ -19,7 +19,12 @@ class QtyInputComponent {
|
|
|
19
19
|
this.allowNegative = input(false);
|
|
20
20
|
this.disabled = input(false);
|
|
21
21
|
this.showError = input(false);
|
|
22
|
+
/**
|
|
23
|
+
* When true, displays the input with red border to indicate a validation error
|
|
24
|
+
*/
|
|
25
|
+
this.error = input(false);
|
|
22
26
|
this.appearance = input('fill');
|
|
27
|
+
this.inputWidth = input('55px');
|
|
23
28
|
this.newValueEmitter = output();
|
|
24
29
|
}
|
|
25
30
|
ngOnInit() { }
|
|
@@ -42,11 +47,11 @@ class QtyInputComponent {
|
|
|
42
47
|
this.newValueEmitter.emit(this.qtyModel());
|
|
43
48
|
}
|
|
44
49
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: QtyInputComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
45
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.14", 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 }, appearance: { classPropertyName: "appearance", publicName: "appearance", 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
|
|
50
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.14", 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 }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, appearance: { classPropertyName: "appearance", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, inputWidth: { classPropertyName: "inputWidth", publicName: "inputWidth", 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\r\n [style.width]=\"inputWidth()\"\r\n [appearance]=\"appearance()\"\r\n [class.field-error]=\"error()\">\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}.st-qty-input input[type=number]::-webkit-outer-spin-button,.st-qty-input input[type=number]::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.st-qty-input input[type=number]{-moz-appearance:textfield}.field-error ::ng-deep .mat-mdc-text-field-wrapper .mat-mdc-form-field-focus-overlay{background-color:#f443360d}.field-error ::ng-deep .mdc-text-field--outlined .mdc-notched-outline .mdc-notched-outline__leading,.field-error ::ng-deep .mdc-text-field--outlined .mdc-notched-outline .mdc-notched-outline__notch,.field-error ::ng-deep .mdc-text-field--outlined .mdc-notched-outline .mdc-notched-outline__trailing,.field-error ::ng-deep .mdc-text-field--filled .mdc-notched-outline .mdc-notched-outline__leading,.field-error ::ng-deep .mdc-text-field--filled .mdc-notched-outline .mdc-notched-outline__notch,.field-error ::ng-deep .mdc-text-field--filled .mdc-notched-outline .mdc-notched-outline__trailing{border-color:#f44336!important;border-width:2px!important}.field-error ::ng-deep .mat-mdc-input-element{color:#f44336}\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 }); }
|
|
46
51
|
}
|
|
47
52
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: QtyInputComponent, decorators: [{
|
|
48
53
|
type: Component,
|
|
49
|
-
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
|
|
54
|
+
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\r\n [style.width]=\"inputWidth()\"\r\n [appearance]=\"appearance()\"\r\n [class.field-error]=\"error()\">\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}.st-qty-input input[type=number]::-webkit-outer-spin-button,.st-qty-input input[type=number]::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.st-qty-input input[type=number]{-moz-appearance:textfield}.field-error ::ng-deep .mat-mdc-text-field-wrapper .mat-mdc-form-field-focus-overlay{background-color:#f443360d}.field-error ::ng-deep .mdc-text-field--outlined .mdc-notched-outline .mdc-notched-outline__leading,.field-error ::ng-deep .mdc-text-field--outlined .mdc-notched-outline .mdc-notched-outline__notch,.field-error ::ng-deep .mdc-text-field--outlined .mdc-notched-outline .mdc-notched-outline__trailing,.field-error ::ng-deep .mdc-text-field--filled .mdc-notched-outline .mdc-notched-outline__leading,.field-error ::ng-deep .mdc-text-field--filled .mdc-notched-outline .mdc-notched-outline__notch,.field-error ::ng-deep .mdc-text-field--filled .mdc-notched-outline .mdc-notched-outline__trailing{border-color:#f44336!important;border-width:2px!important}.field-error ::ng-deep .mat-mdc-input-element{color:#f44336}\n"] }]
|
|
50
55
|
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }] });
|
|
51
56
|
|
|
52
57
|
class StQtyInputModule {
|
|
@@ -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 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 appearance = input<'fill' | 'outline'>('fill');\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
|
|
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 /**\r\n * When true, displays the input with red border to indicate a validation error\r\n */\r\n error = input<boolean>(false);\r\n\r\n appearance = input<'fill' | 'outline'>('fill');\r\n\r\n inputWidth = input<string>('55px');\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\r\n [style.width]=\"inputWidth()\"\r\n [appearance]=\"appearance()\"\r\n [class.field-error]=\"error()\">\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;AAoB5B,IAAA,WAAA,CAAoB,iBAAoC,EAAA;QAApC,IAAiB,CAAA,iBAAA,GAAjB,iBAAiB,CAAmB;AAnBxD,QAAA,IAAA,CAAA,QAAQ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declare class QtyInputComponent implements OnInit {
|
|
|
6
6
|
allowNegative: import("@angular/core").InputSignal<boolean>;
|
|
7
7
|
disabled: import("@angular/core").InputSignal<boolean>;
|
|
8
8
|
showError: import("@angular/core").InputSignal<boolean>;
|
|
9
|
+
/**
|
|
10
|
+
* When true, displays the input with red border to indicate a validation error
|
|
11
|
+
*/
|
|
12
|
+
error: import("@angular/core").InputSignal<boolean>;
|
|
9
13
|
appearance: import("@angular/core").InputSignal<"fill" | "outline">;
|
|
14
|
+
inputWidth: import("@angular/core").InputSignal<string>;
|
|
10
15
|
newValueEmitter: import("@angular/core").OutputEmitterRef<number>;
|
|
11
16
|
constructor(changeDetectorRef: ChangeDetectorRef);
|
|
12
17
|
ngOnInit(): void;
|
|
@@ -14,5 +19,5 @@ export declare class QtyInputComponent implements OnInit {
|
|
|
14
19
|
addClicked(event: MouseEvent): void;
|
|
15
20
|
qtyModelChanged(): void;
|
|
16
21
|
static ɵfac: i0.ɵɵFactoryDeclaration<QtyInputComponent, never>;
|
|
17
|
-
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; }; "appearance": { "alias": "appearance"; "required": false; "isSignal": true; }; }, { "qtyModel": "qtyModelChange"; "newValueEmitter": "newValueEmitter"; }, never, never, false, never>;
|
|
22
|
+
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; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "appearance": { "alias": "appearance"; "required": false; "isSignal": true; }; "inputWidth": { "alias": "inputWidth"; "required": false; "isSignal": true; }; }, { "qtyModel": "qtyModelChange"; "newValueEmitter": "newValueEmitter"; }, never, never, false, never>;
|
|
18
23
|
}
|