@experteam-mx/ngx-input-number 1.3.0 → 1.4.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.
- package/esm2020/lib/di.mjs +3 -0
- package/esm2020/lib/ngx-input-number.component.mjs +23 -13
- package/esm2020/lib/ngx-input-number.module.mjs +15 -2
- package/esm2020/lib/ngx-input-number.service.mjs +27 -5
- package/esm2020/lib/types.mjs +2 -0
- package/fesm2015/experteam-mx-ngx-input-number.mjs +63 -18
- package/fesm2015/experteam-mx-ngx-input-number.mjs.map +1 -1
- package/fesm2020/experteam-mx-ngx-input-number.mjs +61 -18
- package/fesm2020/experteam-mx-ngx-input-number.mjs.map +1 -1
- package/lib/di.d.ts +3 -0
- package/lib/ngx-input-number.component.d.ts +6 -2
- package/lib/ngx-input-number.module.d.ts +3 -0
- package/lib/ngx-input-number.service.d.ts +7 -2
- package/lib/types.d.ts +4 -0
- package/package.json +1 -1
|
@@ -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, 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
|
|
1
|
+
{"version":3,"file":"experteam-mx-ngx-input-number.mjs","sources":["../../../projects/ngx-input-number/src/lib/di.ts","../../../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 { InjectionToken } from '@angular/core';\r\nimport { inputConfigs } from './types';\r\n\r\nexport const INPUT_CONFIG_TOKEN = new InjectionToken<inputConfigs>('INPUT_CONFIG');","import { Injectable, Optional, Inject } from '@angular/core';\nimport { INPUT_CONFIG_TOKEN } from './di';\nimport { inputConfigs } from './types';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class NgxInputNumberService {\n\n groupSeparator = ','\n radixPoint = '.'\n\n constructor(\n @Optional() @Inject(INPUT_CONFIG_TOKEN)\n private readonly config: inputConfigs | null,\n ) {\n if( config != null ){\n this.groupSeparator = config.groupSeparator!\n this.radixPoint = config.radixPoint!\n }\n }\n\n changeParams( config: inputConfigs ){\n if( config.groupSeparator ){\n this.groupSeparator = config.groupSeparator!\n }\n if( config.radixPoint ){\n this.radixPoint = config.radixPoint!\n }\n}\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';\nimport { NgxInputNumberService } from './ngx-input-number.service';\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 private _NgxInputNumberService: NgxInputNumberService,\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 @Input() groupSeparator: any = this._NgxInputNumberService.groupSeparator\n @Input() radixPoint: any = this._NgxInputNumberService.radixPoint\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: this.groupSeparator,\n radixPoint : this.radixPoint,\n digits: 2,\n digitsOptional: false,\n placeholder: '0',\n unmaskAsNumber: true,\n autoUnmask: true,\n showMaskOnFocus: true,\n showMaskOnHover: false,\n onBeforePaste: ( pastedValue: any, opts ) =>{\n return pastedValue.replaceAll( opts.groupSeparator!, \"\" )\n }\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 = '0' + 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 }\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, ModuleWithProviders } 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\nimport { NgxInputNumberService } from './ngx-input-number.service';\nimport { inputConfigs } from './types';\nimport { INPUT_CONFIG_TOKEN } from './di';\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 providers:[\n NgxInputNumberService\n ]\n})\nexport class NgxInputNumberModule {\n static forRoot(config: inputConfigs ): ModuleWithProviders<NgxInputNumberModule> {\n return {\n ngModule: NgxInputNumberModule,\n providers: [{ provide: INPUT_CONFIG_TOKEN, useValue: config }],\n }\n }\n}\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":";;;;;;;;;;AAGO,MAAM,kBAAkB,GAAG,IAAI,cAAc,CAAe,cAAc,CAAC;;MCIrE,qBAAqB;IAKhC,YAEmB,MAA2B;QAA3B,WAAM,GAAN,MAAM,CAAqB;QAL9C,mBAAc,GAAG,GAAG,CAAA;QACpB,eAAU,GAAG,GAAG,CAAA;QAMd,IAAI,MAAM,IAAI,IAAI,EAAE;YAClB,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAe,CAAA;YAC5C,IAAI,CAAC,UAAU,GAAG,MA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qBAAqB;qBACtB;iBACF;;;AC3BD;;;;ACAA;;;;;;"}
|
package/lib/di.d.ts
ADDED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { OnInit, OnChanges, ElementRef, SimpleChanges, ChangeDetectorRef } from '@angular/core';
|
|
2
2
|
import { FormControl } from "@angular/forms";
|
|
3
3
|
import { InputmaskOptions } from '@ngneat/input-mask';
|
|
4
|
+
import { NgxInputNumberService } from './ngx-input-number.service';
|
|
4
5
|
import * as i0 from "@angular/core";
|
|
5
6
|
export declare class NgxInputNumberComponent implements OnInit, OnChanges {
|
|
6
7
|
private _ChangeDetectorRef;
|
|
7
|
-
|
|
8
|
+
private _NgxInputNumberService;
|
|
9
|
+
constructor(_ChangeDetectorRef: ChangeDetectorRef, _NgxInputNumberService: NgxInputNumberService);
|
|
8
10
|
inputElement: ElementRef;
|
|
9
11
|
control: FormControl;
|
|
10
12
|
negative: any;
|
|
@@ -13,6 +15,8 @@ export declare class NgxInputNumberComponent implements OnInit, OnChanges {
|
|
|
13
15
|
max: any;
|
|
14
16
|
idForLabel: any;
|
|
15
17
|
addClass: any;
|
|
18
|
+
groupSeparator: any;
|
|
19
|
+
radixPoint: any;
|
|
16
20
|
inputMask: InputmaskOptions<any>;
|
|
17
21
|
placeholder: string;
|
|
18
22
|
loading: boolean;
|
|
@@ -22,5 +26,5 @@ export declare class NgxInputNumberComponent implements OnInit, OnChanges {
|
|
|
22
26
|
ngOnInit(): void;
|
|
23
27
|
ngOnChanges(changes: SimpleChanges): void;
|
|
24
28
|
static ɵfac: i0.ɵɵFactoryDeclaration<NgxInputNumberComponent, 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>;
|
|
29
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NgxInputNumberComponent, "app-input-number", never, { "control": "control"; "negative": "negative"; "autofocus": "autofocus"; "decimals": "decimals"; "max": "max"; "idForLabel": "idForLabel"; "addClass": "addClass"; "groupSeparator": "groupSeparator"; "radixPoint": "radixPoint"; }, {}, never, never>;
|
|
26
30
|
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { ModuleWithProviders } from '@angular/core';
|
|
2
|
+
import { inputConfigs } from './types';
|
|
1
3
|
import * as i0 from "@angular/core";
|
|
2
4
|
import * as i1 from "./ngx-input-number.component";
|
|
3
5
|
import * as i2 from "@angular/common";
|
|
4
6
|
import * as i3 from "@ngneat/input-mask";
|
|
5
7
|
import * as i4 from "@angular/forms";
|
|
6
8
|
export declare class NgxInputNumberModule {
|
|
9
|
+
static forRoot(config: inputConfigs): ModuleWithProviders<NgxInputNumberModule>;
|
|
7
10
|
static ɵfac: i0.ɵɵFactoryDeclaration<NgxInputNumberModule, never>;
|
|
8
11
|
static ɵmod: i0.ɵɵNgModuleDeclaration<NgxInputNumberModule, [typeof i1.NgxInputNumberComponent], [typeof i2.CommonModule, typeof i3.InputMaskModule, typeof i4.FormsModule, typeof i4.ReactiveFormsModule], [typeof i1.NgxInputNumberComponent]>;
|
|
9
12
|
static ɵinj: i0.ɵɵInjectorDeclaration<NgxInputNumberModule>;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
import { inputConfigs } from './types';
|
|
1
2
|
import * as i0 from "@angular/core";
|
|
2
3
|
export declare class NgxInputNumberService {
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
private readonly config;
|
|
5
|
+
groupSeparator: string;
|
|
6
|
+
radixPoint: string;
|
|
7
|
+
constructor(config: inputConfigs | null);
|
|
8
|
+
changeParams(config: inputConfigs): void;
|
|
9
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgxInputNumberService, [{ optional: true; }]>;
|
|
5
10
|
static ɵprov: i0.ɵɵInjectableDeclaration<NgxInputNumberService>;
|
|
6
11
|
}
|
package/lib/types.d.ts
ADDED