@experteam-mx/ngx-input-number 1.0.3 → 1.3.0

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 +1 @@
1
- {"version":3,"file":"experteam-mx-ngx-input-number.mjs","sources":["../../../projects/ngx-input-number/src/lib/ngx-input-number.service.ts","../../../projects/ngx-input-number/src/lib/ngx-input-number.component.ts","../../../projects/ngx-input-number/src/lib/ngx-input-number.component.html","../../../projects/ngx-input-number/src/lib/ngx-input-number.module.ts","../../../projects/ngx-input-number/src/public-api.ts","../../../projects/ngx-input-number/src/experteam-mx-ngx-input-number.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class NgxInputNumberService {\n\n constructor() { }\n}\n","import { Component, OnInit, Input, AfterViewInit, AfterContentInit, ElementRef, ViewChild } from '@angular/core';\nimport { FormBuilder, Validators, FormArray, FormGroup, FormControl } from \"@angular/forms\";\nimport { createMask } from '@ngneat/input-mask';\n\n@Component({\n selector: 'app-input-number',\n templateUrl: './ngx-input-number.component.html',\n styleUrls: ['./ngx-input-number.component.sass']\n})\nexport class NgxInputNumberComponent implements OnInit {\n\n constructor() { }\n\n @ViewChild('inputElement') inputElement!: ElementRef;\n\n @Input() control!: FormControl\n @Input() negative!: any\n @Input() autofocus: any = false\n @Input() decimals: any\n @Input() max: any\n @Input() idForLabel: any = \"\"\n\n inputMask = createMask({\n allowMinus: true,\n alias: 'numeric',\n numericInput: true,\n inputType: \"number\",\n inputmode: \"numeric\",\n groupSeparator: ',',\n radixPoint : '.',\n digits: 2,\n digitsOptional: false,\n placeholder: '0',\n unmaskAsNumber: true,\n autoUnmask: true,\n })\n\n placeholder = \"0\"\n\n ngAfterViewInit(): void {\n if( this.autofocus ){\n setTimeout(()=>{\n this.inputElement.nativeElement.focus();\n })\n }\n }\n\n ngAfterContentInit(): void {\n }\n\n ngOnInit(): void {\n if( this.negative === false ){\n this.inputMask.allowMinus = false\n }\n if( this.decimals !== undefined ){\n this.inputMask.digits = this.decimals\n if( this.decimals > 0 ){\n this.placeholder += String(this.inputMask.radixPoint)\n }\n for( let x = 0; x < this.decimals; x++ ){\n this.placeholder += \"0\"\n }\n }\n if( this.max !== undefined ){\n this.inputMask.max = this.max\n }\n }\n\n}\n","<input\r\n #inputElement\r\n type=\"text\"\r\n class=\"form-control form-control-sm\"\r\n [class.is-invalid]=\"control.touched && control.invalid\"\r\n [formControl]=\"control\"\r\n [inputMask]=\"inputMask\"\r\n [placeholder]=\"placeholder\"\r\n [id]=\"idForLabel\"\r\n>\r\n","import { NgModule } from '@angular/core';\nimport { FormsModule, ReactiveFormsModule } from \"@angular/forms\";\n\nimport { NgxInputNumberComponent } from './ngx-input-number.component';\nimport { InputMaskModule } from '@ngneat/input-mask';\n\n\n\n@NgModule({\n declarations: [\n NgxInputNumberComponent\n ],\n imports: [\n InputMaskModule,\n FormsModule,\n ReactiveFormsModule,\n ],\n exports: [\n NgxInputNumberComponent\n ]\n})\nexport class NgxInputNumberModule { }\n","/*\n * Public API Surface of ngx-input-number\n */\n\nexport * from './lib/ngx-input-number.service';\nexport * from './lib/ngx-input-number.component';\nexport * from './lib/ngx-input-number.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;MAKa,qBAAqB;IAEhC,iBAAiB;;kHAFN,qBAAqB;sHAArB,qBAAqB,cAFpB,MAAM;2FAEP,qBAAqB;kBAHjC,UAAU;mBAAC;oBACV,UAAU,EAAE,MAAM;iBACnB;;;MCKY,uBAAuB;IAElC;QAMS,cAAS,GAAQ,KAAK,CAAA;QAGtB,eAAU,GAAQ,EAAE,CAAA;QAE7B,cAAS,GAAG,UAAU,CAAC;YACrB,UAAU,EAAE,IAAI;YAChB,KAAK,EAAE,SAAS;YAChB,YAAY,EAAE,IAAI;YAClB,SAAS,EAAE,QAAQ;YACnB,SAAS,EAAE,SAAS;YACpB,cAAc,EAAE,GAAG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;sBAAjB,KAAK;gBACG,QAAQ;sBAAhB,KAAK;gBACG,GAAG;sBAAX,KAAK;gBACG,UAAU;sBAAlB,KAAK;;;MECK,oBAAoB;;iHAApB,oBAAoB;kHAApB,oBAAoB,iBAX7B,uBAAuB,aAGvB,eAAe;QACf,WAAW;QACX,mBAAmB,aAGnB,uBAAuB;kHAGd,oBAAoB,YATtB;YACP,eAAe;YACf,WAAW;YACX,mBAAmB;SACpB;2FAKU,oBAAoB;kBAbhC,QAAQ;mBAAC;oBACR,YAAY,EAAE;wBACZ,uBAAuB;qBACxB;oBACD,OAAO,EAAE;wBACP,eAAe;wBACf,WAAW;wBACX,mBAAmB;qBACpB;oBACD,OAAO,EAAE;wBACP,uBAAuB;qBACxB;iBACF;;;ACpBD;;;;ACAA;;;;;;"}
1
+ {"version":3,"file":"experteam-mx-ngx-input-number.mjs","sources":["../../../projects/ngx-input-number/src/lib/ngx-input-number.service.ts","../../../projects/ngx-input-number/src/lib/ngx-input-number.component.ts","../../../projects/ngx-input-number/src/lib/ngx-input-number.component.html","../../../projects/ngx-input-number/src/lib/ngx-input-number.module.ts","../../../projects/ngx-input-number/src/public-api.ts","../../../projects/ngx-input-number/src/experteam-mx-ngx-input-number.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class NgxInputNumberService {\n\n constructor() { }\n}\n","import { Component, OnInit, Input, OnChanges, AfterViewInit, AfterContentInit, ElementRef, ViewChild, SimpleChanges, ChangeDetectorRef } from '@angular/core';\nimport { FormBuilder, Validators, FormArray, FormGroup, FormControl } from \"@angular/forms\";\nimport { createMask, InputmaskOptions } from '@ngneat/input-mask';\n\n@Component({\n selector: 'app-input-number',\n templateUrl: './ngx-input-number.component.html',\n styleUrls: ['./ngx-input-number.component.sass']\n})\nexport class NgxInputNumberComponent implements OnInit, OnChanges {\n\n constructor(\n private _ChangeDetectorRef: ChangeDetectorRef\n ) { }\n\n @ViewChild('inputElement') inputElement!: ElementRef;\n\n @Input() control!: FormControl\n @Input() negative!: any\n @Input() autofocus: any = false\n @Input() decimals: any\n @Input() max: any\n @Input() idForLabel: any = \"\"\n @Input() addClass: any = \"form-control-sm\"\n\n inputMask: InputmaskOptions<any> = {}\n\n placeholder = \"0\"\n\n loading = false\n\n ngAfterViewInit(): void {\n if( this.autofocus ){\n setTimeout(()=>{\n this.inputElement.nativeElement.focus();\n })\n }\n }\n\n ngAfterContentInit(): void {\n }\n\n render(){\n this._ChangeDetectorRef.detectChanges()\n\n this.inputMask = createMask({\n allowMinus: true,\n alias: 'numeric',\n numericInput: false,\n inputType: \"number\",\n inputmode: \"numeric\",\n groupSeparator: ',',\n radixPoint : '.',\n digits: 2,\n digitsOptional: false,\n placeholder: '0',\n unmaskAsNumber: true,\n autoUnmask: true,\n showMaskOnFocus: false,\n showMaskOnHover: false,\n })\n \n if( this.negative === false ){\n this.inputMask.allowMinus = false\n }\n if( this.decimals !== undefined ){\n this.inputMask.digits = this.decimals\n if( this.decimals > 0 ){\n this.placeholder += String(this.inputMask.radixPoint)\n }\n for( let x = 0; x < this.decimals; x++ ){\n this.placeholder += \"0\"\n }\n }\n if( this.max !== undefined ){\n this.inputMask.max = this.max\n }\n\n this.loading = false\n\n }\n\n ngOnInit(): void {\n this.render()\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n this.loading = true\n\n setTimeout(() => {\n this.render()\n }, 0);\n }\n\n}\n","<input\r\n *ngIf=\"!loading\"\r\n #inputElement\r\n type=\"text\"\r\n class=\"form-control {{ addClass }}\"\r\n [class.is-invalid]=\"control.touched && control.invalid\"\r\n [formControl]=\"control\"\r\n [(inputMask)]=\"inputMask\"\r\n [placeholder]=\"placeholder\"\r\n [id]=\"idForLabel\"\r\n>\r\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common'; \nimport { FormsModule, ReactiveFormsModule } from \"@angular/forms\";\n\nimport { NgxInputNumberComponent } from './ngx-input-number.component';\nimport { InputMaskModule } from '@ngneat/input-mask';\n\n\n\n@NgModule({\n declarations: [\n NgxInputNumberComponent\n ],\n imports: [\n CommonModule,\n InputMaskModule.forRoot({ inputSelector: 'input', isAsync: true }),\n FormsModule,\n ReactiveFormsModule,\n ],\n exports: [\n NgxInputNumberComponent\n ]\n})\nexport class NgxInputNumberModule { }\n","/*\n * Public API Surface of ngx-input-number\n */\n\nexport * from './lib/ngx-input-number.service';\nexport * from './lib/ngx-input-number.component';\nexport * from './lib/ngx-input-number.module';\nexport * from '@ngneat/input-mask';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;MAKa,qBAAqB;IAEhC,iBAAiB;;kHAFN,qBAAqB;sHAArB,qBAAqB,cAFpB,MAAM;2FAEP,qBAAqB;kBAHjC,UAAU;mBAAC;oBACV,UAAU,EAAE,MAAM;iBACnB;;;MCKY,uBAAuB;IAElC,YACU,kBAAqC;QAArC,uBAAkB,GAAlB,kBAAkB,CAAmB;QAOtC,cAAS,GAAQ,KAAK,CAAA;QAGtB,eAAU,GAAQ,EAAE,CAAA;QACpB,aAAQ,GAAQ,iBAAiB,CAAA;QAE1C,cAAS,GAA0B,EAAE,CAAA;QAErC,gBAAW,GAAG,GAAG,CAAA;QAEjB,YAAO,GAAG,KAAK,CAAA;KAhBV;IAkBL,eAAe;QACb,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,UAAU,CAAC;gBACT,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;aACzC,CAAC,CAAA;SACH;KACF;IAED,kBAAkB;KACjB;IAED,MAAM;QACJ,IAAI,CAAC,kBAAkB,CAAC,aAAa,EAAE,CAAA;QAEvC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC;YAC1B,UAAU,EAAE,IAAI;YAChB,KAAK,EAAE,SAAS;YAChB,YAAY,EAAE,KAAK;YACnB,SAAS,EAAE,QAAQ;YACnB,SAAS,EAAE,SAAS;YACpB,cAAc,EAAE,GAAG;YAC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c;gBAEhB,OAAO;sBAAf,KAAK;gBACG,QAAQ;sBAAhB,KAAK;gBACG,SAAS;sBAAjB,KAAK;gBACG,QAAQ;sBAAhB,KAAK;gBACG,GAAG;sBAAX,KAAK;gBACG,UAAU;sBAAlB,KAAK;gBACG,QAAQ;sBAAhB,KAAK;;;MEAK,oBAAoB;;iHAApB,oBAAoB;kHAApB,oBAAoB,iBAZ7B,uBAAuB,aAGvB,YAAY,sBAEZ,WAAW;QACX,mBAAmB,aAGnB,uBAAuB;kHAGd,oBAAoB,YAVtB;YACP,YAAY;YACZ,eAAe,CAAC,OAAO,CAAC,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;YAClE,WAAW;YACX,mBAAmB;SACpB;2FAKU,oBAAoB;kBAdhC,QAAQ;mBAAC;oBACR,YAAY,EAAE;wBACZ,uBAAuB;qBACxB;oBACD,OAAO,EAAE;wBACP,YAAY;wBACZ,eAAe,CAAC,OAAO,CAAC,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;wBAClE,WAAW;wBACX,mBAAmB;qBACpB;oBACD,OAAO,EAAE;wBACP,uBAAuB;qBACxB;iBACF;;;ACtBD;;;;ACAA;;;;;;"}
@@ -1,8 +1,10 @@
1
- import { OnInit, ElementRef } from '@angular/core';
1
+ import { OnInit, OnChanges, ElementRef, SimpleChanges, ChangeDetectorRef } from '@angular/core';
2
2
  import { FormControl } from "@angular/forms";
3
+ import { InputmaskOptions } from '@ngneat/input-mask';
3
4
  import * as i0 from "@angular/core";
4
- export declare class NgxInputNumberComponent implements OnInit {
5
- constructor();
5
+ export declare class NgxInputNumberComponent implements OnInit, OnChanges {
6
+ private _ChangeDetectorRef;
7
+ constructor(_ChangeDetectorRef: ChangeDetectorRef);
6
8
  inputElement: ElementRef;
7
9
  control: FormControl;
8
10
  negative: any;
@@ -10,11 +12,15 @@ export declare class NgxInputNumberComponent implements OnInit {
10
12
  decimals: any;
11
13
  max: any;
12
14
  idForLabel: any;
13
- inputMask: import("@ngneat/input-mask").InputmaskOptions<unknown>;
15
+ addClass: any;
16
+ inputMask: InputmaskOptions<any>;
14
17
  placeholder: string;
18
+ loading: boolean;
15
19
  ngAfterViewInit(): void;
16
20
  ngAfterContentInit(): void;
21
+ render(): void;
17
22
  ngOnInit(): void;
23
+ ngOnChanges(changes: SimpleChanges): void;
18
24
  static ɵfac: i0.ɵɵFactoryDeclaration<NgxInputNumberComponent, never>;
19
- static ɵcmp: i0.ɵɵComponentDeclaration<NgxInputNumberComponent, "app-input-number", never, { "control": "control"; "negative": "negative"; "autofocus": "autofocus"; "decimals": "decimals"; "max": "max"; "idForLabel": "idForLabel"; }, {}, never, never>;
25
+ static ɵcmp: i0.ɵɵComponentDeclaration<NgxInputNumberComponent, "app-input-number", never, { "control": "control"; "negative": "negative"; "autofocus": "autofocus"; "decimals": "decimals"; "max": "max"; "idForLabel": "idForLabel"; "addClass": "addClass"; }, {}, never, never>;
20
26
  }
@@ -1,9 +1,10 @@
1
1
  import * as i0 from "@angular/core";
2
2
  import * as i1 from "./ngx-input-number.component";
3
- import * as i2 from "@ngneat/input-mask";
4
- import * as i3 from "@angular/forms";
3
+ import * as i2 from "@angular/common";
4
+ import * as i3 from "@ngneat/input-mask";
5
+ import * as i4 from "@angular/forms";
5
6
  export declare class NgxInputNumberModule {
6
7
  static ɵfac: i0.ɵɵFactoryDeclaration<NgxInputNumberModule, never>;
7
- static ɵmod: i0.ɵɵNgModuleDeclaration<NgxInputNumberModule, [typeof i1.NgxInputNumberComponent], [typeof i2.InputMaskModule, typeof i3.FormsModule, typeof i3.ReactiveFormsModule], [typeof i1.NgxInputNumberComponent]>;
8
+ static ɵmod: i0.ɵɵNgModuleDeclaration<NgxInputNumberModule, [typeof i1.NgxInputNumberComponent], [typeof i2.CommonModule, typeof i3.InputMaskModule, typeof i4.FormsModule, typeof i4.ReactiveFormsModule], [typeof i1.NgxInputNumberComponent]>;
8
9
  static ɵinj: i0.ɵɵInjectorDeclaration<NgxInputNumberModule>;
9
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@experteam-mx/ngx-input-number",
3
- "version": "1.0.3",
3
+ "version": "1.3.0",
4
4
  "license": "MIT",
5
5
  "peerDependencies": {},
6
6
  "dependencies": {
package/public-api.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './lib/ngx-input-number.service';
2
2
  export * from './lib/ngx-input-number.component';
3
3
  export * from './lib/ngx-input-number.module';
4
+ export * from '@ngneat/input-mask';