@experteam-mx/ngx-input-number 1.0.1 → 1.2.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.
@@ -0,0 +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 @Input() addClass: any = \"form-control-sm\"\n\n 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 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 {{ 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 { 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;QACpB,aAAQ,GAAQ,iBAAiB,CAAA;QAE1C,cAAS,GAAG,UAAU,CAAC;YACrB,UAAU,EAAE,IAAI;YAChB,KAAK,EAAE,SA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DDa,uBAAuB;kBALnC,SAAS;+BACE,kBAAkB;0EAQD,YAAY;sBAAtC,SAAS;uBAAC,cAAc;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,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;;;;;;"}
@@ -0,0 +1,21 @@
1
+ import { OnInit, ElementRef } from '@angular/core';
2
+ import { FormControl } from "@angular/forms";
3
+ import * as i0 from "@angular/core";
4
+ export declare class NgxInputNumberComponent implements OnInit {
5
+ constructor();
6
+ inputElement: ElementRef;
7
+ control: FormControl;
8
+ negative: any;
9
+ autofocus: any;
10
+ decimals: any;
11
+ max: any;
12
+ idForLabel: any;
13
+ addClass: any;
14
+ inputMask: import("@ngneat/input-mask").InputmaskOptions<unknown>;
15
+ placeholder: string;
16
+ ngAfterViewInit(): void;
17
+ ngAfterContentInit(): void;
18
+ ngOnInit(): void;
19
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxInputNumberComponent, never>;
20
+ 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>;
21
+ }
@@ -0,0 +1,9 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./ngx-input-number.component";
3
+ import * as i2 from "@ngneat/input-mask";
4
+ import * as i3 from "@angular/forms";
5
+ export declare class NgxInputNumberModule {
6
+ 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 ɵinj: i0.ɵɵInjectorDeclaration<NgxInputNumberModule>;
9
+ }
@@ -0,0 +1,6 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class NgxInputNumberService {
3
+ constructor();
4
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxInputNumberService, never>;
5
+ static ɵprov: i0.ɵɵInjectableDeclaration<NgxInputNumberService>;
6
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@experteam-mx/ngx-input-number",
3
- "version": "1.0.1",
3
+ "version": "1.2.0",
4
4
  "license": "MIT",
5
5
  "peerDependencies": {},
6
6
  "dependencies": {
@@ -11,7 +11,24 @@
11
11
  "inputmask": "^5.0.7",
12
12
  "tslib": "^2.1.0"
13
13
  },
14
- "devDependencies": {
15
- "@types/inputmask": "^5.0.1"
16
- }
17
- }
14
+ "module": "fesm2015/experteam-mx-ngx-input-number.mjs",
15
+ "es2020": "fesm2020/experteam-mx-ngx-input-number.mjs",
16
+ "esm2020": "esm2020/experteam-mx-ngx-input-number.mjs",
17
+ "fesm2020": "fesm2020/experteam-mx-ngx-input-number.mjs",
18
+ "fesm2015": "fesm2015/experteam-mx-ngx-input-number.mjs",
19
+ "typings": "experteam-mx-ngx-input-number.d.ts",
20
+ "exports": {
21
+ "./package.json": {
22
+ "default": "./package.json"
23
+ },
24
+ ".": {
25
+ "types": "./experteam-mx-ngx-input-number.d.ts",
26
+ "esm2020": "./esm2020/experteam-mx-ngx-input-number.mjs",
27
+ "es2020": "./fesm2020/experteam-mx-ngx-input-number.mjs",
28
+ "es2015": "./fesm2015/experteam-mx-ngx-input-number.mjs",
29
+ "node": "./fesm2015/experteam-mx-ngx-input-number.mjs",
30
+ "default": "./fesm2020/experteam-mx-ngx-input-number.mjs"
31
+ }
32
+ },
33
+ "sideEffects": false
34
+ }
@@ -1,7 +1,3 @@
1
- /*
2
- * Public API Surface of ngx-input-number
3
- */
4
-
5
- export * from './lib/ngx-input-number.service';
6
- export * from './lib/ngx-input-number.component';
7
- export * from './lib/ngx-input-number.module';
1
+ export * from './lib/ngx-input-number.service';
2
+ export * from './lib/ngx-input-number.component';
3
+ export * from './lib/ngx-input-number.module';
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,11 +0,0 @@
1
- {
2
- "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
- "dest": "../../dist/ngx-input-number",
4
- "deleteDestPath": false,
5
- "lib": {
6
- "entryFile": "src/public-api.ts"
7
- },
8
- "allowedNonPeerDependencies": [
9
- "."
10
- ]
11
- }
@@ -1,10 +0,0 @@
1
- <input
2
- #inputElement
3
- type="text"
4
- class="form-control form-control-sm"
5
- [class.is-invalid]="control.touched && control.invalid"
6
- [formControl]="control"
7
- [inputMask]="inputMask"
8
- [placeholder]="placeholder"
9
- [id]="idForLabel"
10
- >
@@ -1 +0,0 @@
1
- @import "~bootstrap/scss/bootstrap"
@@ -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,69 +0,0 @@
1
- import { Component, OnInit, Input, AfterViewInit, AfterContentInit, ElementRef, ViewChild } from '@angular/core';
2
- import { FormBuilder, Validators, FormArray, FormGroup, FormControl } from "@angular/forms";
3
- import { createMask } from '@ngneat/input-mask';
4
-
5
- @Component({
6
- selector: 'app-input-number',
7
- templateUrl: './ngx-input-number.component.html',
8
- styleUrls: ['./ngx-input-number.component.sass']
9
- })
10
- export class NgxInputNumberComponent implements OnInit {
11
-
12
- constructor() { }
13
-
14
- @ViewChild('inputElement') inputElement!: ElementRef;
15
-
16
- @Input() control!: FormControl
17
- @Input() negative!: any
18
- @Input() autofocus: any = false
19
- @Input() decimals: any
20
- @Input() max: any
21
- @Input() idForLabel: any = ""
22
-
23
- inputMask = createMask({
24
- allowMinus: true,
25
- alias: 'numeric',
26
- numericInput: true,
27
- inputType: "number",
28
- inputmode: "numeric",
29
- groupSeparator: ',',
30
- radixPoint : '.',
31
- digits: 2,
32
- digitsOptional: false,
33
- placeholder: '0',
34
- unmaskAsNumber: true,
35
- autoUnmask: true,
36
- })
37
-
38
- placeholder = "0"
39
-
40
- ngAfterViewInit(): void {
41
- if( this.autofocus ){
42
- setTimeout(()=>{
43
- this.inputElement.nativeElement.focus();
44
- })
45
- }
46
- }
47
-
48
- ngAfterContentInit(): void {
49
- }
50
-
51
- ngOnInit(): void {
52
- if( this.negative === false ){
53
- this.inputMask.allowMinus = false
54
- }
55
- if( this.decimals !== undefined ){
56
- this.inputMask.digits = this.decimals
57
- if( this.decimals > 0 ){
58
- this.placeholder += String(this.inputMask.radixPoint)
59
- }
60
- for( let x = 0; x < this.decimals; x++ ){
61
- this.placeholder += "0"
62
- }
63
- }
64
- if( this.max !== undefined ){
65
- this.inputMask.max = this.max
66
- }
67
- }
68
-
69
- }
@@ -1,22 +0,0 @@
1
- import { NgModule } from '@angular/core';
2
- import { FormsModule, ReactiveFormsModule } from "@angular/forms";
3
-
4
- import { NgxInputNumberComponent } from './ngx-input-number.component';
5
- import { InputMaskModule } from '@ngneat/input-mask';
6
-
7
-
8
-
9
- @NgModule({
10
- declarations: [
11
- NgxInputNumberComponent
12
- ],
13
- imports: [
14
- InputMaskModule,
15
- FormsModule,
16
- ReactiveFormsModule,
17
- ],
18
- exports: [
19
- NgxInputNumberComponent
20
- ]
21
- })
22
- export class NgxInputNumberModule { }
@@ -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,9 +0,0 @@
1
- import { Injectable } from '@angular/core';
2
-
3
- @Injectable({
4
- providedIn: 'root'
5
- })
6
- export class NgxInputNumberService {
7
-
8
- constructor() { }
9
- }
package/src/test.ts DELETED
@@ -1,27 +0,0 @@
1
- // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2
-
3
- import 'zone.js';
4
- import 'zone.js/testing';
5
- import { getTestBed } from '@angular/core/testing';
6
- import {
7
- BrowserDynamicTestingModule,
8
- platformBrowserDynamicTesting
9
- } from '@angular/platform-browser-dynamic/testing';
10
-
11
- declare const require: {
12
- context(path: string, deep?: boolean, filter?: RegExp): {
13
- <T>(id: string): T;
14
- keys(): string[];
15
- };
16
- };
17
-
18
- // First, initialize the Angular testing environment.
19
- getTestBed().initTestEnvironment(
20
- BrowserDynamicTestingModule,
21
- platformBrowserDynamicTesting(),
22
- );
23
-
24
- // Then we find all the tests.
25
- const context = require.context('./', true, /\.spec\.ts$/);
26
- // And load the modules.
27
- context.keys().map(context);
package/tsconfig.lib.json DELETED
@@ -1,27 +0,0 @@
1
- /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
- {
3
- "extends": "../../tsconfig.json",
4
- "compilerOptions": {
5
- "outDir": "../../out-tsc/lib",
6
- "target": "es2015",
7
- "declaration": true,
8
- "declarationMap": true,
9
- "inlineSources": true,
10
- "types": [],
11
- "lib": [
12
- "dom",
13
- "es2018"
14
- ]
15
- },
16
- "angularCompilerOptions": {
17
- "skipTemplateCodegen": true,
18
- "strictMetadataEmit": true,
19
- "enableResourceInlining": true,
20
- "strictTemplates": false,
21
- "enableIvy": false
22
- },
23
- "exclude": [
24
- "src/test.ts",
25
- "**/*.spec.ts"
26
- ]
27
- }
@@ -1,10 +0,0 @@
1
- /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
- {
3
- "extends": "./tsconfig.lib.json",
4
- "compilerOptions": {
5
- "declarationMap": false
6
- },
7
- "angularCompilerOptions": {
8
- "compilationMode": "partial"
9
- }
10
- }
@@ -1,17 +0,0 @@
1
- /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
- {
3
- "extends": "../../tsconfig.json",
4
- "compilerOptions": {
5
- "outDir": "../../out-tsc/spec",
6
- "types": [
7
- "jasmine"
8
- ]
9
- },
10
- "files": [
11
- "src/test.ts"
12
- ],
13
- "include": [
14
- "**/*.spec.ts",
15
- "**/*.d.ts"
16
- ]
17
- }