@skyux/autonumeric 5.0.2 → 5.5.0-alpha.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 +4 -69
- package/bundles/skyux-autonumeric.umd.js +19 -24
- package/documentation.json +95 -68
- package/esm2015/index.js +7 -0
- package/esm2015/index.js.map +1 -0
- package/esm2015/lib/modules/autonumeric/autonumeric-options-provider.js +24 -0
- package/esm2015/lib/modules/autonumeric/autonumeric-options-provider.js.map +1 -0
- package/esm2015/lib/modules/autonumeric/autonumeric-options.js +2 -0
- package/esm2015/lib/modules/autonumeric/autonumeric-options.js.map +1 -0
- package/esm2015/lib/modules/autonumeric/autonumeric.directive.js +171 -0
- package/esm2015/lib/modules/autonumeric/autonumeric.directive.js.map +1 -0
- package/esm2015/lib/modules/autonumeric/autonumeric.module.js +19 -0
- package/esm2015/lib/modules/autonumeric/autonumeric.module.js.map +1 -0
- package/esm2015/skyux-autonumeric.js +2 -2
- package/esm2015/skyux-autonumeric.js.map +1 -0
- package/fesm2015/skyux-autonumeric.js +16 -21
- package/fesm2015/skyux-autonumeric.js.map +1 -1
- package/index.d.ts +4 -0
- package/{modules → lib/modules}/autonumeric/autonumeric-options-provider.d.ts +0 -0
- package/{modules → lib/modules}/autonumeric/autonumeric-options.d.ts +0 -0
- package/{modules → lib/modules}/autonumeric/autonumeric.directive.d.ts +2 -3
- package/{modules → lib/modules}/autonumeric/autonumeric.module.d.ts +0 -0
- package/package.json +4 -4
- package/skyux-autonumeric.d.ts +1 -1
- package/LICENSE +0 -21
- package/bundles/skyux-autonumeric.umd.js.map +0 -1
- package/esm2015/modules/autonumeric/autonumeric-options-provider.js +0 -24
- package/esm2015/modules/autonumeric/autonumeric-options.js +0 -2
- package/esm2015/modules/autonumeric/autonumeric.directive.js +0 -175
- package/esm2015/modules/autonumeric/autonumeric.module.js +0 -19
- package/esm2015/public-api.js +0 -7
- package/public-api.d.ts +0 -4
package/README.md
CHANGED
|
@@ -1,72 +1,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# autonumeric
|
|
2
2
|
|
|
3
|
-
[
|
|
4
|
-

|
|
5
|
-
[](https://codecov.io/gh/blackbaud/skyux-autonumeric/branch/master)
|
|
3
|
+
This library was generated with [Nx](https://nx.dev).
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
## Running unit tests
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
<input
|
|
13
|
-
type="text"
|
|
14
|
-
skyAutonumeric
|
|
15
|
-
>
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
To use a [predefined set of options](https://github.com/autoNumeric/autoNumeric#predefined-options):
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
<input
|
|
22
|
-
type="text"
|
|
23
|
-
skyAutonumeric="dollar"
|
|
24
|
-
/>
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
To use a [custom set of options](https://github.com/autoNumeric/autoNumeric#options):
|
|
28
|
-
|
|
29
|
-
```
|
|
30
|
-
<input
|
|
31
|
-
type="text"
|
|
32
|
-
[skyAutonumeric]="{ decimalPlaces: 5 }"
|
|
33
|
-
/>
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
### Global Configuration
|
|
37
|
-
|
|
38
|
-
To configure all `skyAutonumeric` instances in your SPA the same way, create a class that extends the base class `SkyAutonumericOptionsProvider` and supply it in the module providers.
|
|
39
|
-
|
|
40
|
-
**my-autonumeric-options-provider.ts**
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
export class MyAutonumericOptionsProvider extends SkyAutonumericOptionsProvider {
|
|
44
|
-
constructor() {
|
|
45
|
-
super();
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
public getConfig(): SkyAutonumericOptions {
|
|
49
|
-
return {
|
|
50
|
-
decimalPlaces: 5
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
**app.module.ts**
|
|
57
|
-
|
|
58
|
-
```
|
|
59
|
-
providers: [
|
|
60
|
-
{
|
|
61
|
-
provide: SkyAutonumericOptionsProvider,
|
|
62
|
-
useClass: MyAutonumericOptionsProvider
|
|
63
|
-
}
|
|
64
|
-
]
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
## Install dependencies and view the example
|
|
68
|
-
|
|
69
|
-
```
|
|
70
|
-
skyux install
|
|
71
|
-
skyux serve
|
|
72
|
-
```
|
|
7
|
+
Run `nx test autonumeric` to execute the unit tests.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@skyux/autonumeric', ['exports', '@angular/core', '@angular/common', '@angular/forms', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.skyux = global.skyux || {}, global.skyux.autonumeric = {}), global.ng.core, global.ng.common, global.ng.forms, global.
|
|
5
|
-
})(this, (function (exports, i0, common, forms, rxjs, operators
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('autonumeric'), require('rxjs'), require('rxjs/operators')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@skyux/autonumeric', ['exports', '@angular/core', '@angular/common', '@angular/forms', 'autonumeric', 'rxjs', 'rxjs/operators'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.skyux = global.skyux || {}, global.skyux.autonumeric = {}), global.ng.core, global.ng.common, global.ng.forms, global.AutoNumeric, global.rxjs, global.rxjs.operators));
|
|
5
|
+
})(this, (function (exports, i0, common, forms, AutoNumeric, rxjs, operators) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
};
|
|
44
44
|
return SkyAutonumericOptionsProvider;
|
|
45
45
|
}());
|
|
46
|
-
SkyAutonumericOptionsProvider.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
|
47
|
-
SkyAutonumericOptionsProvider.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.
|
|
48
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
|
46
|
+
SkyAutonumericOptionsProvider.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAutonumericOptionsProvider, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
47
|
+
SkyAutonumericOptionsProvider.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAutonumericOptionsProvider, providedIn: 'root' });
|
|
48
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAutonumericOptionsProvider, decorators: [{
|
|
49
49
|
type: i0.Injectable,
|
|
50
50
|
args: [{
|
|
51
51
|
providedIn: 'root',
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
this.onChange = function (_) { };
|
|
81
81
|
/* istanbul ignore next */
|
|
82
82
|
this.onTouched = function () { };
|
|
83
|
-
this.
|
|
83
|
+
this.autonumericInstance = new AutoNumeric__default["default"](this.elementRef.nativeElement);
|
|
84
84
|
}
|
|
85
85
|
Object.defineProperty(SkyAutonumericDirective.prototype, "skyAutonumeric", {
|
|
86
86
|
/**
|
|
@@ -137,8 +137,7 @@
|
|
|
137
137
|
this.control.markAsPristine();
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
-
|
|
141
|
-
if (isNumber) {
|
|
140
|
+
if (typeof value === 'number') {
|
|
142
141
|
this.autonumericInstance.set(value);
|
|
143
142
|
}
|
|
144
143
|
else {
|
|
@@ -171,10 +170,9 @@
|
|
|
171
170
|
};
|
|
172
171
|
SkyAutonumericDirective.prototype.getNumericValue = function () {
|
|
173
172
|
var inputValue = this.getInputValue();
|
|
174
|
-
|
|
173
|
+
return inputValue && !this.isInputValueTheCurrencySymbol(inputValue)
|
|
175
174
|
? this.autonumericInstance.getNumber()
|
|
176
175
|
: undefined;
|
|
177
|
-
return numericValue;
|
|
178
176
|
};
|
|
179
177
|
/**
|
|
180
178
|
* Due to AutoNumeric's hover logic - when AutoNumeric has a currency symbol the value
|
|
@@ -186,20 +184,17 @@
|
|
|
186
184
|
var _a, _b;
|
|
187
185
|
/* istanbul ignore next */
|
|
188
186
|
var currencySymbol = ((_b = (_a = this.autonumericOptions) === null || _a === void 0 ? void 0 : _a.currencySymbol) !== null && _b !== void 0 ? _b : '').trim();
|
|
189
|
-
return currencySymbol && inputValue === currencySymbol;
|
|
187
|
+
return !!currencySymbol && inputValue === currencySymbol;
|
|
190
188
|
};
|
|
191
189
|
SkyAutonumericDirective.prototype.getInputValue = function () {
|
|
192
190
|
return this.elementRef.nativeElement.value;
|
|
193
191
|
};
|
|
194
|
-
SkyAutonumericDirective.prototype.createAutonumericInstance = function () {
|
|
195
|
-
this.autonumericInstance = new AutoNumeric__default["default"](this.elementRef.nativeElement);
|
|
196
|
-
};
|
|
197
192
|
SkyAutonumericDirective.prototype.updateAutonumericInstance = function () {
|
|
198
193
|
this.autonumericInstance.update(this.autonumericOptions);
|
|
199
194
|
};
|
|
200
195
|
SkyAutonumericDirective.prototype.mergeOptions = function (value) {
|
|
201
196
|
var globalOptions = this.globalConfig.getConfig();
|
|
202
|
-
var newOptions
|
|
197
|
+
var newOptions;
|
|
203
198
|
if (typeof value === 'string') {
|
|
204
199
|
var predefinedOptions = AutoNumeric__default["default"].getPredefinedOptions();
|
|
205
200
|
newOptions = predefinedOptions[value];
|
|
@@ -211,9 +206,9 @@
|
|
|
211
206
|
};
|
|
212
207
|
return SkyAutonumericDirective;
|
|
213
208
|
}());
|
|
214
|
-
SkyAutonumericDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
|
215
|
-
SkyAutonumericDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.
|
|
216
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
|
209
|
+
SkyAutonumericDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAutonumericDirective, deps: [{ token: i0__namespace.ElementRef }, { token: SkyAutonumericOptionsProvider }, { token: i0__namespace.Renderer2 }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
210
|
+
SkyAutonumericDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: SkyAutonumericDirective, selector: "input[skyAutonumeric]", inputs: { skyAutonumeric: "skyAutonumeric" }, host: { listeners: { "blur": "onBlur()" } }, providers: [SKY_AUTONUMERIC_VALUE_ACCESSOR, SKY_AUTONUMERIC_VALIDATOR], ngImport: i0__namespace });
|
|
211
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAutonumericDirective, decorators: [{
|
|
217
212
|
type: i0.Directive,
|
|
218
213
|
args: [{
|
|
219
214
|
selector: 'input[skyAutonumeric]',
|
|
@@ -231,10 +226,10 @@
|
|
|
231
226
|
}
|
|
232
227
|
return SkyAutonumericModule;
|
|
233
228
|
}());
|
|
234
|
-
SkyAutonumericModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
|
235
|
-
SkyAutonumericModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.
|
|
236
|
-
SkyAutonumericModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.
|
|
237
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
|
229
|
+
SkyAutonumericModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAutonumericModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
230
|
+
SkyAutonumericModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAutonumericModule, declarations: [SkyAutonumericDirective], imports: [common.CommonModule, forms.FormsModule, forms.ReactiveFormsModule], exports: [SkyAutonumericDirective] });
|
|
231
|
+
SkyAutonumericModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAutonumericModule, imports: [[common.CommonModule, forms.FormsModule, forms.ReactiveFormsModule]] });
|
|
232
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAutonumericModule, decorators: [{
|
|
238
233
|
type: i0.NgModule,
|
|
239
234
|
args: [{
|
|
240
235
|
declarations: [SkyAutonumericDirective],
|