@experteam-mx/ngx-input-number 1.6.5 → 2.0.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/README.md +24 -24
- package/esm2020/experteam-mx-ngx-input-number.mjs +5 -0
- package/esm2020/lib/di.mjs +3 -0
- package/esm2020/lib/ngx-input-number.component.mjs +148 -0
- package/esm2020/lib/ngx-input-number.module.mjs +47 -0
- package/esm2020/lib/ngx-input-number.service.mjs +63 -0
- package/esm2020/lib/types.mjs +5 -0
- package/esm2020/lib/typesProvider.mjs +30 -0
- package/esm2020/public-api.mjs +9 -0
- package/experteam-mx-ngx-input-number.d.ts +5 -0
- package/fesm2015/experteam-mx-ngx-input-number.mjs +295 -0
- package/fesm2015/experteam-mx-ngx-input-number.mjs.map +1 -0
- package/fesm2020/experteam-mx-ngx-input-number.mjs +293 -0
- package/fesm2020/experteam-mx-ngx-input-number.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/{src/lib/di.ts → lib/di.d.ts} +1 -2
- package/lib/ngx-input-number.component.d.ts +36 -0
- package/lib/ngx-input-number.module.d.ts +13 -0
- package/lib/ngx-input-number.service.d.ts +18 -0
- package/lib/types.d.ts +12 -0
- package/lib/typesProvider.d.ts +19 -0
- package/package.json +28 -8
- package/{src/public-api.ts → public-api.d.ts} +5 -9
- package/.browserslistrc +0 -16
- package/karma.conf.js +0 -44
- package/ng-package.json +0 -11
- package/src/lib/ngx-input-number.component.html +0 -14
- package/src/lib/ngx-input-number.component.sass +0 -11
- package/src/lib/ngx-input-number.component.spec.ts +0 -25
- package/src/lib/ngx-input-number.component.ts +0 -160
- package/src/lib/ngx-input-number.module.ts +0 -38
- package/src/lib/ngx-input-number.service.spec.ts +0 -16
- package/src/lib/ngx-input-number.service.ts +0 -59
- package/src/lib/types.ts +0 -14
- package/src/lib/typesProvider.ts +0 -26
- package/src/test.ts +0 -27
- package/tsconfig.lib.json +0 -27
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -17
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"experteam-mx-ngx-input-number.mjs","sources":["../../../projects/ngx-input-number/src/lib/typesProvider.ts","../../../projects/ngx-input-number/src/lib/di.ts","../../../projects/ngx-input-number/src/lib/types.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 { Injectable, Provider } from '@angular/core';\r\n\r\nexport class inputConfigs {\r\n groupSeparator?: string;\r\n radixPoint?: string;\r\n}\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport abstract class typesProvider {\r\n abstract get config(): inputConfigs;\r\n}\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class defaultTypesProvider extends typesProvider {\r\n get config(): inputConfigs {\r\n // return default config\r\n return {\r\n groupSeparator: \",\",\r\n radixPoint: \".\"\r\n };\r\n }\r\n}\r\n\r\nexport class inputConfigsHelp {\r\n config?: Provider;\r\n}","import { InjectionToken } from '@angular/core';\r\nimport { inputConfigs } from './types';\r\n\r\nexport const INPUT_CONFIG_TOKEN = new InjectionToken<inputConfigs>('INPUT_CONFIG');","import { Provider } from '@angular/core';\r\n\r\nexport class inputConfigs {\r\n groupSeparator?: string;\r\n radixPoint?: string;\r\n lblKeyInvalid?: string;\r\n max?: number;\r\n decimals?: number;\r\n negative?: boolean;\r\n}\r\n\r\nexport class inputConfigsHelp {\r\n config?: Provider;\r\n}","import { Injectable, Optional, Inject, EventEmitter, Output } from '@angular/core';\r\nimport { INPUT_CONFIG_TOKEN } from './di';\r\nimport { inputConfigs } from './types';\r\nimport { BehaviorSubject, Subject } from \"rxjs\";\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class NgxInputNumberService {\r\n\r\n changeEvent = new BehaviorSubject<boolean>(false);\r\n groupSeparator = ','\r\n radixPoint = '.'\r\n lblKeyInvalid = 'Please enter a valid amount'\r\n negative: any = true\r\n max: any = undefined\r\n decimals = 2\r\n\r\n constructor(\r\n @Optional() @Inject(INPUT_CONFIG_TOKEN)\r\n private readonly config: inputConfigs | null,\r\n ) {\r\n if( config != null ){\r\n this.groupSeparator = config.groupSeparator!\r\n this.radixPoint = config.radixPoint!\r\n this.lblKeyInvalid = config.lblKeyInvalid!\r\n this.negative = config.negative!\r\n this.max = config.max!\r\n this.decimals = config.decimals!\r\n }\r\n }\r\n\r\n onChangeParams( config: inputConfigs ){\r\n if( config.groupSeparator ){\r\n this.groupSeparator = config.groupSeparator\r\n }\r\n if( config.radixPoint ){\r\n this.radixPoint = config.radixPoint\r\n }\r\n if( config.lblKeyInvalid ){\r\n this.lblKeyInvalid = config.lblKeyInvalid\r\n }\r\n if( config.negative !== undefined ){\r\n this.negative = config.negative\r\n }\r\n if( config.max ){\r\n this.max = config.max!\r\n }\r\n if( config.decimals ){\r\n this.decimals = config.decimals\r\n }\r\n\r\n this.changeEvent.next( true )\r\n }\r\n\r\n getChangeEvent(){\r\n return this.changeEvent\r\n }\r\n}\r\n","import { Component, OnInit, Input, OnChanges, AfterViewInit, AfterContentInit, ElementRef, ViewChild, SimpleChanges, ChangeDetectorRef } from '@angular/core';\r\nimport { FormBuilder, Validators, FormArray, FormGroup, FormControl } from \"@angular/forms\";\r\nimport { createMask, InputmaskOptions } from '@ngneat/input-mask';\r\n\r\nimport { inputConfigs, typesProvider } from './typesProvider';\r\nimport { NgxInputNumberService } from './ngx-input-number.service';\r\n\r\n@Component({\r\n selector: 'app-input-number',\r\n templateUrl: './ngx-input-number.component.html',\r\n styleUrls: ['./ngx-input-number.component.sass']\r\n})\r\nexport class NgxInputNumberComponent implements OnInit, OnChanges {\r\n\r\n constructor(\r\n private _ChangeDetectorRef: ChangeDetectorRef,\r\n private readonly _typesProvider: typesProvider,\r\n private _NgxInputNumberService: NgxInputNumberService,\r\n ) { }\r\n\r\n @ViewChild('inputElement') inputElement!: ElementRef;\r\n\r\n @Input() control!: FormControl\r\n @Input() negative!: any\r\n @Input() autofocus: any = false\r\n @Input() decimals: any\r\n @Input() max: any\r\n @Input() idForLabel: any = \"\"\r\n @Input() tabIndex: any\r\n @Input() addClass: any = \"form-control-sm\"\r\n @Input() groupSeparator: any\r\n @Input() radixPoint: any\r\n @Input() lblKeyInvalid: any\r\n lblKeyInvalidRender: any\r\n\r\n inputMask: InputmaskOptions<any> = {}\r\n\r\n placeholder = \"0\"\r\n\r\n loading = false\r\n\r\n ngAfterViewInit(): void {\r\n if( this.autofocus ){\r\n setTimeout(()=>{\r\n this.inputElement.nativeElement.focus();\r\n })\r\n }\r\n }\r\n\r\n ngAfterContentInit(): void {\r\n }\r\n\r\n render(){\r\n this._ChangeDetectorRef.detectChanges()\r\n\r\n this.lblKeyInvalidRender = this._NgxInputNumberService.lblKeyInvalid\r\n\r\n this.inputMask = createMask({\r\n allowMinus: this._NgxInputNumberService.negative,\r\n alias: 'numeric',\r\n numericInput: false,\r\n inputType: \"number\",\r\n inputmode: \"numeric\",\r\n groupSeparator: this._NgxInputNumberService.groupSeparator,\r\n radixPoint : this._NgxInputNumberService.radixPoint,\r\n max : this._NgxInputNumberService.max,\r\n digits: this._NgxInputNumberService.decimals,\r\n digitsOptional: false,\r\n placeholder: '0',\r\n unmaskAsNumber: true,\r\n autoUnmask: true,\r\n showMaskOnFocus: false,\r\n showMaskOnHover: false,\r\n onBeforePaste: ( pastedValue: any, opts ) =>{\r\n return pastedValue.replaceAll( opts.groupSeparator!, \"\" )\r\n },\r\n onKeyValidation: ( key, result ) => {\r\n if( !result ){\r\n this.inputElement.nativeElement.classList.add(\"key-invalid\")\r\n setTimeout(\r\n ()=>{\r\n this.inputElement.nativeElement.classList.remove(\"key-invalid\")\r\n },\r\n 1000\r\n )\r\n }\r\n }\r\n })\r\n \r\n if( this.negative !== undefined ){\r\n this.inputMask.allowMinus = this.negative\r\n }\r\n if( this.max !== undefined ){\r\n this.inputMask.max = this.max\r\n }\r\n \r\n if( this.groupSeparator !== undefined ){\r\n this.inputMask.groupSeparator = this.groupSeparator\r\n }\r\n if( this.radixPoint !== undefined ){\r\n this.inputMask.radixPoint = this.radixPoint\r\n }\r\n if( this.lblKeyInvalid !== undefined ){\r\n this.lblKeyInvalidRender = this.lblKeyInvalid\r\n }\r\n\r\n if( this.decimals !== undefined ){\r\n this.inputMask.digits = this.decimals\r\n }\r\n\r\n\r\n\r\n if( this.inputMask.digits! > 0 ){\r\n this.placeholder = '0' + String(this.inputMask.radixPoint)\r\n }\r\n for( let x = 0; x < this.inputMask.digits!; x++ ){\r\n this.placeholder += \"0\"\r\n }\r\n\r\n this.loading = false\r\n\r\n }\r\n\r\n onBlur(value: any){\r\n // if( value != '' && Number( this.inputMask.digits ) > 0 ){\r\n // let valueBlurSplit = String(value).split(\".\")\r\n // let valueString = \"\"\r\n // if( valueBlurSplit.length == 1 ){\r\n // valueString = valueBlurSplit[0] + \".\" + String(\"\").padEnd(Number(this.inputMask.digits), \"0\")\r\n // }else{\r\n // valueString = valueBlurSplit[0] + \".\" + String(valueBlurSplit[1]).padEnd(Number(this.inputMask.digits), \"0\")\r\n // }\r\n // this.control.setValue( parseFloat( valueString ) )\r\n // }\r\n this.control.setValue( value )\r\n }\r\n\r\n ngOnInit(): void {\r\n this._NgxInputNumberService.getChangeEvent().subscribe(\r\n ( configs )=>{\r\n if( configs ){\r\n this.loading = true\r\n\r\n setTimeout(() => {\r\n this.render()\r\n }, 0);\r\n }\r\n }\r\n )\r\n }\r\n\r\n ngOnChanges(changes: SimpleChanges): void {\r\n this.loading = true\r\n\r\n setTimeout(() => {\r\n this.render()\r\n }, 0);\r\n }\r\n\r\n}\r\n","<div class=\"position-relative\">\r\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 [tabindex]=\"tabIndex\"\r\n [(inputMask)]=\"inputMask\"\r\n [id]=\"idForLabel\"\r\n >\r\n <label class=\"lbl-key-invalid position-absolute top-100 end-0 p-2 d-none\" [innerHTML]=\"lblKeyInvalidRender\"></label>\r\n</div>\r\n","import { NgModule, ModuleWithProviders } from '@angular/core';\r\nimport { CommonModule } from '@angular/common'; \r\nimport { FormsModule, ReactiveFormsModule } from \"@angular/forms\";\r\n\r\nimport { NgxInputNumberComponent } from './ngx-input-number.component';\r\nimport { InputMaskModule } from '@ngneat/input-mask';\r\n\r\nimport { inputConfigsHelp, typesProvider, defaultTypesProvider } from './typesProvider';\r\n\r\n@NgModule({\r\n declarations: [\r\n NgxInputNumberComponent\r\n ],\r\n imports: [\r\n CommonModule,\r\n InputMaskModule.forRoot({ inputSelector: 'input', isAsync: true }),\r\n FormsModule,\r\n ReactiveFormsModule,\r\n ],\r\n exports: [\r\n NgxInputNumberComponent\r\n ],\r\n providers:[\r\n ]\r\n})\r\nexport class NgxInputNumberModule {\r\n static forRoot(config: inputConfigsHelp = {} ): ModuleWithProviders<NgxInputNumberModule> {\r\n return {\r\n ngModule: NgxInputNumberModule,\r\n providers: [\r\n config.config || {\r\n provide: typesProvider,\r\n useClass: defaultTypesProvider\r\n }\r\n ],\r\n }\r\n }\r\n}\r\n","/*\r\n * Public API Surface of ngx-input-number\r\n */\r\n\r\nexport * from './lib/typesProvider';\r\nexport * from './lib/ngx-input-number.service';\r\nexport * from './lib/ngx-input-number.component';\r\nexport * from './lib/ngx-input-number.module';\r\nexport * from '@ngneat/input-mask';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.typesProvider","i2.NgxInputNumberService"],"mappings":";;;;;;;;;;;2BAEa,YAAY,CAAA;AAGxB,EAAA;MAGqB,aAAa,CAAA;;0GAAb,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,M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AA,eAAe,CAAC,OAAO,CAAC,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAClE,WAAW;QACX,mBAAmB,CAAA,EAAA,CAAA,CAAA;2FAQV,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAhBhC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE;wBACZ,uBAAuB;AACxB,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,YAAY;AACZ,wBAAA,eAAe,CAAC,OAAO,CAAC,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;wBAClE,WAAW;wBACX,mBAAmB;AACpB,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,uBAAuB;AACxB,qBAAA;AACD,oBAAA,SAAS,EAAC,EACT;AACF,iBAAA,CAAA;;;ACxBD;;AAEG;;ACFH;;AAEG;;;;"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { OnInit, OnChanges, ElementRef, SimpleChanges, ChangeDetectorRef } from '@angular/core';
|
|
2
|
+
import { FormControl } from "@angular/forms";
|
|
3
|
+
import { InputmaskOptions } from '@ngneat/input-mask';
|
|
4
|
+
import { typesProvider } from './typesProvider';
|
|
5
|
+
import { NgxInputNumberService } from './ngx-input-number.service';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
export declare class NgxInputNumberComponent implements OnInit, OnChanges {
|
|
8
|
+
private _ChangeDetectorRef;
|
|
9
|
+
private readonly _typesProvider;
|
|
10
|
+
private _NgxInputNumberService;
|
|
11
|
+
constructor(_ChangeDetectorRef: ChangeDetectorRef, _typesProvider: typesProvider, _NgxInputNumberService: NgxInputNumberService);
|
|
12
|
+
inputElement: ElementRef;
|
|
13
|
+
control: FormControl;
|
|
14
|
+
negative: any;
|
|
15
|
+
autofocus: any;
|
|
16
|
+
decimals: any;
|
|
17
|
+
max: any;
|
|
18
|
+
idForLabel: any;
|
|
19
|
+
tabIndex: any;
|
|
20
|
+
addClass: any;
|
|
21
|
+
groupSeparator: any;
|
|
22
|
+
radixPoint: any;
|
|
23
|
+
lblKeyInvalid: any;
|
|
24
|
+
lblKeyInvalidRender: any;
|
|
25
|
+
inputMask: InputmaskOptions<any>;
|
|
26
|
+
placeholder: string;
|
|
27
|
+
loading: boolean;
|
|
28
|
+
ngAfterViewInit(): void;
|
|
29
|
+
ngAfterContentInit(): void;
|
|
30
|
+
render(): void;
|
|
31
|
+
onBlur(value: any): void;
|
|
32
|
+
ngOnInit(): void;
|
|
33
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
34
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgxInputNumberComponent, never>;
|
|
35
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NgxInputNumberComponent, "app-input-number", never, { "control": "control"; "negative": "negative"; "autofocus": "autofocus"; "decimals": "decimals"; "max": "max"; "idForLabel": "idForLabel"; "tabIndex": "tabIndex"; "addClass": "addClass"; "groupSeparator": "groupSeparator"; "radixPoint": "radixPoint"; "lblKeyInvalid": "lblKeyInvalid"; }, {}, never, never, false, never>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ModuleWithProviders } from '@angular/core';
|
|
2
|
+
import { inputConfigsHelp } from './typesProvider';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
import * as i1 from "./ngx-input-number.component";
|
|
5
|
+
import * as i2 from "@angular/common";
|
|
6
|
+
import * as i3 from "@ngneat/input-mask";
|
|
7
|
+
import * as i4 from "@angular/forms";
|
|
8
|
+
export declare class NgxInputNumberModule {
|
|
9
|
+
static forRoot(config?: inputConfigsHelp): ModuleWithProviders<NgxInputNumberModule>;
|
|
10
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgxInputNumberModule, never>;
|
|
11
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<NgxInputNumberModule, [typeof i1.NgxInputNumberComponent], [typeof i2.CommonModule, typeof i3.InputMaskModule, typeof i4.FormsModule, typeof i4.ReactiveFormsModule], [typeof i1.NgxInputNumberComponent]>;
|
|
12
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<NgxInputNumberModule>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { inputConfigs } from './types';
|
|
2
|
+
import { BehaviorSubject } from "rxjs";
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class NgxInputNumberService {
|
|
5
|
+
private readonly config;
|
|
6
|
+
changeEvent: BehaviorSubject<boolean>;
|
|
7
|
+
groupSeparator: string;
|
|
8
|
+
radixPoint: string;
|
|
9
|
+
lblKeyInvalid: string;
|
|
10
|
+
negative: any;
|
|
11
|
+
max: any;
|
|
12
|
+
decimals: number;
|
|
13
|
+
constructor(config: inputConfigs | null);
|
|
14
|
+
onChangeParams(config: inputConfigs): void;
|
|
15
|
+
getChangeEvent(): BehaviorSubject<boolean>;
|
|
16
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgxInputNumberService, [{ optional: true; }]>;
|
|
17
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NgxInputNumberService>;
|
|
18
|
+
}
|
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Provider } from '@angular/core';
|
|
2
|
+
export declare class inputConfigs {
|
|
3
|
+
groupSeparator?: string;
|
|
4
|
+
radixPoint?: string;
|
|
5
|
+
lblKeyInvalid?: string;
|
|
6
|
+
max?: number;
|
|
7
|
+
decimals?: number;
|
|
8
|
+
negative?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare class inputConfigsHelp {
|
|
11
|
+
config?: Provider;
|
|
12
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Provider } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class inputConfigs {
|
|
4
|
+
groupSeparator?: string;
|
|
5
|
+
radixPoint?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare abstract class typesProvider {
|
|
8
|
+
abstract get config(): inputConfigs;
|
|
9
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<typesProvider, never>;
|
|
10
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<typesProvider>;
|
|
11
|
+
}
|
|
12
|
+
export declare class defaultTypesProvider extends typesProvider {
|
|
13
|
+
get config(): inputConfigs;
|
|
14
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<defaultTypesProvider, never>;
|
|
15
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<defaultTypesProvider>;
|
|
16
|
+
}
|
|
17
|
+
export declare class inputConfigsHelp {
|
|
18
|
+
config?: Provider;
|
|
19
|
+
}
|
package/package.json
CHANGED
|
@@ -1,17 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@experteam-mx/ngx-input-number",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"peerDependencies": {},
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@angular/
|
|
8
|
-
"@angular/
|
|
7
|
+
"@angular/cli": "^15.2.0",
|
|
8
|
+
"@angular/common": "^15.2.0",
|
|
9
|
+
"@angular/core": "^15.2.0",
|
|
9
10
|
"@ngneat/input-mask": "^5.1.0",
|
|
11
|
+
"@popperjs/core": "^2.11.6",
|
|
10
12
|
"bootstrap": "^5.1.3",
|
|
11
13
|
"inputmask": "^5.0.7",
|
|
12
|
-
"tslib": "^2.1.0"
|
|
14
|
+
"tslib": "^2.1.0",
|
|
15
|
+
"zone.js": "^0.12.0"
|
|
13
16
|
},
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
"module": "fesm2015/experteam-mx-ngx-input-number.mjs",
|
|
18
|
+
"es2020": "fesm2020/experteam-mx-ngx-input-number.mjs",
|
|
19
|
+
"esm2020": "esm2020/experteam-mx-ngx-input-number.mjs",
|
|
20
|
+
"fesm2020": "fesm2020/experteam-mx-ngx-input-number.mjs",
|
|
21
|
+
"fesm2015": "fesm2015/experteam-mx-ngx-input-number.mjs",
|
|
22
|
+
"typings": "index.d.ts",
|
|
23
|
+
"exports": {
|
|
24
|
+
"./package.json": {
|
|
25
|
+
"default": "./package.json"
|
|
26
|
+
},
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./index.d.ts",
|
|
29
|
+
"esm2020": "./esm2020/experteam-mx-ngx-input-number.mjs",
|
|
30
|
+
"es2020": "./fesm2020/experteam-mx-ngx-input-number.mjs",
|
|
31
|
+
"es2015": "./fesm2015/experteam-mx-ngx-input-number.mjs",
|
|
32
|
+
"node": "./fesm2015/experteam-mx-ngx-input-number.mjs",
|
|
33
|
+
"default": "./fesm2020/experteam-mx-ngx-input-number.mjs"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"sideEffects": false
|
|
37
|
+
}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export * from '
|
|
6
|
-
export * from './lib/ngx-input-number.service';
|
|
7
|
-
export * from './lib/ngx-input-number.component';
|
|
8
|
-
export * from './lib/ngx-input-number.module';
|
|
9
|
-
export * from '@ngneat/input-mask';
|
|
1
|
+
export * from './lib/typesProvider';
|
|
2
|
+
export * from './lib/ngx-input-number.service';
|
|
3
|
+
export * from './lib/ngx-input-number.component';
|
|
4
|
+
export * from './lib/ngx-input-number.module';
|
|
5
|
+
export * from '@ngneat/input-mask';
|
package/.browserslistrc
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
|
|
2
|
-
# For additional information regarding the format and rule options, please see:
|
|
3
|
-
# https://github.com/browserslist/browserslist#queries
|
|
4
|
-
|
|
5
|
-
# For the full list of supported browsers by the Angular framework, please see:
|
|
6
|
-
# https://angular.io/guide/browser-support
|
|
7
|
-
|
|
8
|
-
# You can see what browsers were selected by your queries by running:
|
|
9
|
-
# npx browserslist
|
|
10
|
-
|
|
11
|
-
last 1 Chrome version
|
|
12
|
-
last 1 Firefox version
|
|
13
|
-
last 2 Edge major versions
|
|
14
|
-
last 2 Safari major versions
|
|
15
|
-
last 2 iOS major versions
|
|
16
|
-
Firefox ESR
|
package/karma.conf.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
// Karma configuration file, see link for more information
|
|
2
|
-
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
|
3
|
-
|
|
4
|
-
module.exports = function (config) {
|
|
5
|
-
config.set({
|
|
6
|
-
basePath: '',
|
|
7
|
-
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
|
8
|
-
plugins: [
|
|
9
|
-
require('karma-jasmine'),
|
|
10
|
-
require('karma-chrome-launcher'),
|
|
11
|
-
require('karma-jasmine-html-reporter'),
|
|
12
|
-
require('karma-coverage'),
|
|
13
|
-
require('@angular-devkit/build-angular/plugins/karma')
|
|
14
|
-
],
|
|
15
|
-
client: {
|
|
16
|
-
jasmine: {
|
|
17
|
-
// you can add configuration options for Jasmine here
|
|
18
|
-
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
|
|
19
|
-
// for example, you can disable the random execution with `random: false`
|
|
20
|
-
// or set a specific seed with `seed: 4321`
|
|
21
|
-
},
|
|
22
|
-
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
|
23
|
-
},
|
|
24
|
-
jasmineHtmlReporter: {
|
|
25
|
-
suppressAll: true // removes the duplicated traces
|
|
26
|
-
},
|
|
27
|
-
coverageReporter: {
|
|
28
|
-
dir: require('path').join(__dirname, '../../coverage/ngx-input-number'),
|
|
29
|
-
subdir: '.',
|
|
30
|
-
reporters: [
|
|
31
|
-
{ type: 'html' },
|
|
32
|
-
{ type: 'text-summary' }
|
|
33
|
-
]
|
|
34
|
-
},
|
|
35
|
-
reporters: ['progress', 'kjhtml'],
|
|
36
|
-
port: 9876,
|
|
37
|
-
colors: true,
|
|
38
|
-
logLevel: config.LOG_INFO,
|
|
39
|
-
autoWatch: true,
|
|
40
|
-
browsers: ['Chrome'],
|
|
41
|
-
singleRun: false,
|
|
42
|
-
restartOnFileChange: true
|
|
43
|
-
});
|
|
44
|
-
};
|
package/ng-package.json
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<div class="position-relative">
|
|
2
|
-
<input
|
|
3
|
-
*ngIf="!loading"
|
|
4
|
-
#inputElement
|
|
5
|
-
type="text"
|
|
6
|
-
class="form-control {{ addClass }}"
|
|
7
|
-
[class.is-invalid]="control.touched && control.invalid"
|
|
8
|
-
[formControl]="control"
|
|
9
|
-
[tabindex]="tabIndex"
|
|
10
|
-
[(inputMask)]="inputMask"
|
|
11
|
-
[id]="idForLabel"
|
|
12
|
-
>
|
|
13
|
-
<label class="lbl-key-invalid position-absolute top-100 end-0 p-2 d-none" [innerHTML]="lblKeyInvalidRender"></label>
|
|
14
|
-
</div>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { NgxInputNumberComponent } from './ngx-input-number.component';
|
|
4
|
-
|
|
5
|
-
describe('NgxInputNumberComponent', () => {
|
|
6
|
-
let component: NgxInputNumberComponent;
|
|
7
|
-
let fixture: ComponentFixture<NgxInputNumberComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
declarations: [ NgxInputNumberComponent ]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
fixture = TestBed.createComponent(NgxInputNumberComponent);
|
|
18
|
-
component = fixture.componentInstance;
|
|
19
|
-
fixture.detectChanges();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('should create', () => {
|
|
23
|
-
expect(component).toBeTruthy();
|
|
24
|
-
});
|
|
25
|
-
});
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import { Component, OnInit, Input, OnChanges, AfterViewInit, AfterContentInit, ElementRef, ViewChild, SimpleChanges, ChangeDetectorRef } from '@angular/core';
|
|
2
|
-
import { FormBuilder, Validators, FormArray, FormGroup, FormControl } from "@angular/forms";
|
|
3
|
-
import { createMask, InputmaskOptions } from '@ngneat/input-mask';
|
|
4
|
-
|
|
5
|
-
import { inputConfigs, typesProvider } from './typesProvider';
|
|
6
|
-
import { NgxInputNumberService } from './ngx-input-number.service';
|
|
7
|
-
|
|
8
|
-
@Component({
|
|
9
|
-
selector: 'app-input-number',
|
|
10
|
-
templateUrl: './ngx-input-number.component.html',
|
|
11
|
-
styleUrls: ['./ngx-input-number.component.sass']
|
|
12
|
-
})
|
|
13
|
-
export class NgxInputNumberComponent implements OnInit, OnChanges {
|
|
14
|
-
|
|
15
|
-
constructor(
|
|
16
|
-
private _ChangeDetectorRef: ChangeDetectorRef,
|
|
17
|
-
private readonly _typesProvider: typesProvider,
|
|
18
|
-
private _NgxInputNumberService: NgxInputNumberService,
|
|
19
|
-
) { }
|
|
20
|
-
|
|
21
|
-
@ViewChild('inputElement') inputElement!: ElementRef;
|
|
22
|
-
|
|
23
|
-
@Input() control!: FormControl
|
|
24
|
-
@Input() negative!: any
|
|
25
|
-
@Input() autofocus: any = false
|
|
26
|
-
@Input() decimals: any
|
|
27
|
-
@Input() max: any
|
|
28
|
-
@Input() idForLabel: any = ""
|
|
29
|
-
@Input() tabIndex: any
|
|
30
|
-
@Input() addClass: any = "form-control-sm"
|
|
31
|
-
@Input() groupSeparator: any
|
|
32
|
-
@Input() radixPoint: any
|
|
33
|
-
@Input() lblKeyInvalid: any
|
|
34
|
-
lblKeyInvalidRender: any
|
|
35
|
-
|
|
36
|
-
inputMask: InputmaskOptions<any> = {}
|
|
37
|
-
|
|
38
|
-
placeholder = "0"
|
|
39
|
-
|
|
40
|
-
loading = false
|
|
41
|
-
|
|
42
|
-
ngAfterViewInit(): void {
|
|
43
|
-
if( this.autofocus ){
|
|
44
|
-
setTimeout(()=>{
|
|
45
|
-
this.inputElement.nativeElement.focus();
|
|
46
|
-
})
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
ngAfterContentInit(): void {
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
render(){
|
|
54
|
-
this._ChangeDetectorRef.detectChanges()
|
|
55
|
-
|
|
56
|
-
this.lblKeyInvalidRender = this._NgxInputNumberService.lblKeyInvalid
|
|
57
|
-
|
|
58
|
-
this.inputMask = createMask({
|
|
59
|
-
allowMinus: this._NgxInputNumberService.negative,
|
|
60
|
-
alias: 'numeric',
|
|
61
|
-
numericInput: false,
|
|
62
|
-
inputType: "number",
|
|
63
|
-
inputmode: "numeric",
|
|
64
|
-
groupSeparator: this._NgxInputNumberService.groupSeparator,
|
|
65
|
-
radixPoint : this._NgxInputNumberService.radixPoint,
|
|
66
|
-
max : this._NgxInputNumberService.max,
|
|
67
|
-
digits: this._NgxInputNumberService.decimals,
|
|
68
|
-
digitsOptional: false,
|
|
69
|
-
placeholder: '0',
|
|
70
|
-
unmaskAsNumber: true,
|
|
71
|
-
autoUnmask: true,
|
|
72
|
-
showMaskOnFocus: false,
|
|
73
|
-
showMaskOnHover: false,
|
|
74
|
-
onBeforePaste: ( pastedValue: any, opts ) =>{
|
|
75
|
-
return pastedValue.replaceAll( opts.groupSeparator!, "" )
|
|
76
|
-
},
|
|
77
|
-
onKeyValidation: ( key, result ) => {
|
|
78
|
-
if( !result ){
|
|
79
|
-
this.inputElement.nativeElement.classList.add("key-invalid")
|
|
80
|
-
setTimeout(
|
|
81
|
-
()=>{
|
|
82
|
-
this.inputElement.nativeElement.classList.remove("key-invalid")
|
|
83
|
-
},
|
|
84
|
-
1000
|
|
85
|
-
)
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
if( this.negative !== undefined ){
|
|
91
|
-
this.inputMask.allowMinus = this.negative
|
|
92
|
-
}
|
|
93
|
-
if( this.max !== undefined ){
|
|
94
|
-
this.inputMask.max = this.max
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if( this.groupSeparator !== undefined ){
|
|
98
|
-
this.inputMask.groupSeparator = this.groupSeparator
|
|
99
|
-
}
|
|
100
|
-
if( this.radixPoint !== undefined ){
|
|
101
|
-
this.inputMask.radixPoint = this.radixPoint
|
|
102
|
-
}
|
|
103
|
-
if( this.lblKeyInvalid !== undefined ){
|
|
104
|
-
this.lblKeyInvalidRender = this.lblKeyInvalid
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if( this.decimals !== undefined ){
|
|
108
|
-
this.inputMask.digits = this.decimals
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if( this.inputMask.digits! > 0 ){
|
|
114
|
-
this.placeholder = '0' + String(this.inputMask.radixPoint)
|
|
115
|
-
}
|
|
116
|
-
for( let x = 0; x < this.inputMask.digits!; x++ ){
|
|
117
|
-
this.placeholder += "0"
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
this.loading = false
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
onBlur(value: any){
|
|
125
|
-
// if( value != '' && Number( this.inputMask.digits ) > 0 ){
|
|
126
|
-
// let valueBlurSplit = String(value).split(".")
|
|
127
|
-
// let valueString = ""
|
|
128
|
-
// if( valueBlurSplit.length == 1 ){
|
|
129
|
-
// valueString = valueBlurSplit[0] + "." + String("").padEnd(Number(this.inputMask.digits), "0")
|
|
130
|
-
// }else{
|
|
131
|
-
// valueString = valueBlurSplit[0] + "." + String(valueBlurSplit[1]).padEnd(Number(this.inputMask.digits), "0")
|
|
132
|
-
// }
|
|
133
|
-
// this.control.setValue( parseFloat( valueString ) )
|
|
134
|
-
// }
|
|
135
|
-
this.control.setValue( value )
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
ngOnInit(): void {
|
|
139
|
-
this._NgxInputNumberService.getChangeEvent().subscribe(
|
|
140
|
-
( configs )=>{
|
|
141
|
-
if( configs ){
|
|
142
|
-
this.loading = true
|
|
143
|
-
|
|
144
|
-
setTimeout(() => {
|
|
145
|
-
this.render()
|
|
146
|
-
}, 0);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
)
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
ngOnChanges(changes: SimpleChanges): void {
|
|
153
|
-
this.loading = true
|
|
154
|
-
|
|
155
|
-
setTimeout(() => {
|
|
156
|
-
this.render()
|
|
157
|
-
}, 0);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { NgModule, ModuleWithProviders } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
|
|
4
|
-
|
|
5
|
-
import { NgxInputNumberComponent } from './ngx-input-number.component';
|
|
6
|
-
import { InputMaskModule } from '@ngneat/input-mask';
|
|
7
|
-
|
|
8
|
-
import { inputConfigsHelp, typesProvider, defaultTypesProvider } from './typesProvider';
|
|
9
|
-
|
|
10
|
-
@NgModule({
|
|
11
|
-
declarations: [
|
|
12
|
-
NgxInputNumberComponent
|
|
13
|
-
],
|
|
14
|
-
imports: [
|
|
15
|
-
CommonModule,
|
|
16
|
-
InputMaskModule.forRoot({ inputSelector: 'input', isAsync: true }),
|
|
17
|
-
FormsModule,
|
|
18
|
-
ReactiveFormsModule,
|
|
19
|
-
],
|
|
20
|
-
exports: [
|
|
21
|
-
NgxInputNumberComponent
|
|
22
|
-
],
|
|
23
|
-
providers:[
|
|
24
|
-
]
|
|
25
|
-
})
|
|
26
|
-
export class NgxInputNumberModule {
|
|
27
|
-
static forRoot(config: inputConfigsHelp = {} ): ModuleWithProviders<NgxInputNumberModule> {
|
|
28
|
-
return {
|
|
29
|
-
ngModule: NgxInputNumberModule,
|
|
30
|
-
providers: [
|
|
31
|
-
config.config || {
|
|
32
|
-
provide: typesProvider,
|
|
33
|
-
useClass: defaultTypesProvider
|
|
34
|
-
}
|
|
35
|
-
],
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { NgxInputNumberService } from './ngx-input-number.service';
|
|
4
|
-
|
|
5
|
-
describe('NgxInputNumberService', () => {
|
|
6
|
-
let service: NgxInputNumberService;
|
|
7
|
-
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
TestBed.configureTestingModule({});
|
|
10
|
-
service = TestBed.inject(NgxInputNumberService);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('should be created', () => {
|
|
14
|
-
expect(service).toBeTruthy();
|
|
15
|
-
});
|
|
16
|
-
});
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { Injectable, Optional, Inject, EventEmitter, Output } from '@angular/core';
|
|
2
|
-
import { INPUT_CONFIG_TOKEN } from './di';
|
|
3
|
-
import { inputConfigs } from './types';
|
|
4
|
-
import { BehaviorSubject, Subject } from "rxjs";
|
|
5
|
-
|
|
6
|
-
@Injectable({
|
|
7
|
-
providedIn: 'root'
|
|
8
|
-
})
|
|
9
|
-
export class NgxInputNumberService {
|
|
10
|
-
|
|
11
|
-
changeEvent = new BehaviorSubject<boolean>(false);
|
|
12
|
-
groupSeparator = ','
|
|
13
|
-
radixPoint = '.'
|
|
14
|
-
lblKeyInvalid = 'Please enter a valid amount'
|
|
15
|
-
negative: any = true
|
|
16
|
-
max: any = undefined
|
|
17
|
-
decimals = 2
|
|
18
|
-
|
|
19
|
-
constructor(
|
|
20
|
-
@Optional() @Inject(INPUT_CONFIG_TOKEN)
|
|
21
|
-
private readonly config: inputConfigs | null,
|
|
22
|
-
) {
|
|
23
|
-
if( config != null ){
|
|
24
|
-
this.groupSeparator = config.groupSeparator!
|
|
25
|
-
this.radixPoint = config.radixPoint!
|
|
26
|
-
this.lblKeyInvalid = config.lblKeyInvalid!
|
|
27
|
-
this.negative = config.negative!
|
|
28
|
-
this.max = config.max!
|
|
29
|
-
this.decimals = config.decimals!
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
onChangeParams( config: inputConfigs ){
|
|
34
|
-
if( config.groupSeparator ){
|
|
35
|
-
this.groupSeparator = config.groupSeparator
|
|
36
|
-
}
|
|
37
|
-
if( config.radixPoint ){
|
|
38
|
-
this.radixPoint = config.radixPoint
|
|
39
|
-
}
|
|
40
|
-
if( config.lblKeyInvalid ){
|
|
41
|
-
this.lblKeyInvalid = config.lblKeyInvalid
|
|
42
|
-
}
|
|
43
|
-
if( config.negative !== undefined ){
|
|
44
|
-
this.negative = config.negative
|
|
45
|
-
}
|
|
46
|
-
if( config.max ){
|
|
47
|
-
this.max = config.max!
|
|
48
|
-
}
|
|
49
|
-
if( config.decimals ){
|
|
50
|
-
this.decimals = config.decimals
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
this.changeEvent.next( true )
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
getChangeEvent(){
|
|
57
|
-
return this.changeEvent
|
|
58
|
-
}
|
|
59
|
-
}
|
package/src/lib/types.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Provider } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
export class inputConfigs {
|
|
4
|
-
groupSeparator?: string;
|
|
5
|
-
radixPoint?: string;
|
|
6
|
-
lblKeyInvalid?: string;
|
|
7
|
-
max?: number;
|
|
8
|
-
decimals?: number;
|
|
9
|
-
negative?: boolean;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export class inputConfigsHelp {
|
|
13
|
-
config?: Provider;
|
|
14
|
-
}
|