ngx-mask 22.1.0 → 22.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.
- package/fesm2022/ngx-mask.mjs +110 -44
- package/fesm2022/ngx-mask.mjs.map +1 -0
- package/package.json +2 -1
- package/types/ngx-mask.d.ts +32 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ngx-mask",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.2.0",
|
|
4
4
|
"description": "Input masking for modern Angular — Reactive, template-driven and Signal Forms, zoneless and SSR ready. Dates, numbers, separators, custom patterns.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ng2-mask",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"LICENSE",
|
|
20
20
|
"README.md",
|
|
21
21
|
"fesm2022/ngx-mask.mjs",
|
|
22
|
+
"fesm2022/ngx-mask.mjs.map",
|
|
22
23
|
"types",
|
|
23
24
|
"package.json"
|
|
24
25
|
],
|
package/types/ngx-mask.d.ts
CHANGED
|
@@ -138,19 +138,25 @@ declare class NgxMaskApplierService {
|
|
|
138
138
|
protected percentage: (str: string) => boolean;
|
|
139
139
|
getPrecision: (maskExpression: string) => number;
|
|
140
140
|
private checkAndRemoveSuffix;
|
|
141
|
-
protected checkInputPrecision: (inputValue: string, precision: number
|
|
141
|
+
protected checkInputPrecision: (inputValue: string, precision: number) => string;
|
|
142
142
|
protected _stripToDecimal(str: string): string;
|
|
143
143
|
protected _charToRegExpExpression(char: string): string;
|
|
144
144
|
protected _shiftStep(cursor: number): void;
|
|
145
145
|
protected _compareOrIncludes<T>(value: T, comparedValue: T | T[], excludedValue: T): boolean;
|
|
146
146
|
protected _validIP(valuesIP: string[]): boolean;
|
|
147
|
+
/**
|
|
148
|
+
* The single rule for "which decimal marker is active": the configured marker, or — for an
|
|
149
|
+
* array — the first configured marker present in `value` that is not the thousandSeparator,
|
|
150
|
+
* else the first configured marker that is not the thousandSeparator (#1653).
|
|
151
|
+
*/
|
|
152
|
+
protected _activeDecimalMarker(value: string): DecimalMarkerChar;
|
|
147
153
|
protected _splitPercentZero(value: string): string;
|
|
148
154
|
protected _findFirstNonZeroAndDecimalIndex(inputString: string, decimalMarker: '.' | ','): {
|
|
149
155
|
decimalMarkerIndex: number | null;
|
|
150
156
|
nonZeroIndex: number | null;
|
|
151
157
|
};
|
|
152
158
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgxMaskApplierService, never>;
|
|
153
|
-
static ɵprov: _angular_core.ɵɵInjectableDeclaration<
|
|
159
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<any>;
|
|
154
160
|
}
|
|
155
161
|
|
|
156
162
|
declare class NgxMaskService extends NgxMaskApplierService {
|
|
@@ -269,10 +275,10 @@ declare class NgxMaskService extends NgxMaskApplierService {
|
|
|
269
275
|
*/
|
|
270
276
|
currentLocaleDecimalMarker(): string;
|
|
271
277
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgxMaskService, never>;
|
|
272
|
-
static ɵprov: _angular_core.ɵɵInjectableDeclaration<
|
|
278
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<any>;
|
|
273
279
|
}
|
|
274
280
|
|
|
275
|
-
declare class NgxMaskDirective implements ControlValueAccessor, OnChanges, Validator, FormValueControl<string> {
|
|
281
|
+
declare class NgxMaskDirective implements ControlValueAccessor, OnChanges, Validator, FormValueControl<string | number | null | undefined> {
|
|
276
282
|
mask: _angular_core.InputSignal<string | null | undefined>;
|
|
277
283
|
specialCharacters: _angular_core.InputSignal<string[] | readonly string[]>;
|
|
278
284
|
patterns: _angular_core.InputSignal<Record<string, {
|
|
@@ -303,7 +309,19 @@ declare class NgxMaskDirective implements ControlValueAccessor, OnChanges, Valid
|
|
|
303
309
|
keepCharacterPositions: _angular_core.InputSignal<boolean | null>;
|
|
304
310
|
instantPrefix: _angular_core.InputSignal<boolean | null>;
|
|
305
311
|
defaultValueOnBlur: _angular_core.InputSignal<string | null>;
|
|
306
|
-
|
|
312
|
+
/**
|
|
313
|
+
* Signal Forms `FormValueControl` surface. At runtime `FormField` never drives this model
|
|
314
|
+
* when the directive is bound (it prefers the `NG_VALUE_ACCESSOR` provided above, see
|
|
315
|
+
* `_isCvaMode`), but the template type-checker treats any directive owning a `value` model
|
|
316
|
+
* as the field's custom control and checks the bound field's value type against it (#1640).
|
|
317
|
+
* The model therefore accepts exactly what `writeValue()` accepts — `string | number | null |
|
|
318
|
+
* undefined` — so numeric and nullable fields (`signal({ amount: 0 })`,
|
|
319
|
+
* `signal<number | null>(null)`, `signal<string | null>(null)`) compile under
|
|
320
|
+
* `strictTemplates`. Values pushed back into the model are always the unmasked string (see
|
|
321
|
+
* `_propagateToValueModel`), i.e. `value()` / `valueChange` are declared wider than what is
|
|
322
|
+
* emitted.
|
|
323
|
+
*/
|
|
324
|
+
value: _angular_core.ModelSignal<string | number | null | undefined>;
|
|
307
325
|
disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
308
326
|
touched: _angular_core.ModelSignal<boolean>;
|
|
309
327
|
maskFilled: _angular_core.OutputEmitterRef<void>;
|
|
@@ -440,6 +458,15 @@ declare class NgxMaskDirective implements ControlValueAccessor, OnChanges, Valid
|
|
|
440
458
|
private _applyDefaultValueOnBlur;
|
|
441
459
|
onClick(e: Event): void;
|
|
442
460
|
onKeyDown(event: Event): void;
|
|
461
|
+
/**
|
|
462
|
+
* #1641: on layouts whose decimal separator is a comma, the numeric keypad still emits
|
|
463
|
+
* a period, which a separator mask configured with a comma decimal marker rejects. The
|
|
464
|
+
* keypad decimal key (`key: 'Decimal'`, or a `.` from `code: 'NumpadDecimal'`) is
|
|
465
|
+
* therefore turned into the configured marker. Only the keypad key is intercepted: a
|
|
466
|
+
* period typed on the main keyboard keeps its normal behavior (e.g. as a thousand
|
|
467
|
+
* separator). Returns true when the key press was handled.
|
|
468
|
+
*/
|
|
469
|
+
private _insertNumpadDecimalMarker;
|
|
443
470
|
/**
|
|
444
471
|
* Restores the control's pristine/untouched state after a writeValue-driven emission.
|
|
445
472
|
*
|