@tetacom/ng-components 1.6.19 → 1.6.20
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { HostBinding, ChangeDetectionStrategy, Component, Directive, Input, ContentChild, Optional, Inject, Injectable, HostListener, Host, ViewChild, forwardRef, ElementRef, EventEmitter, Output, TemplateRef, Injector, ViewContainerRef, Pipe, ViewEncapsulation, ChangeDetectorRef, inject, NgModule, input, computed, output, contentChildren, effect, signal, NgZone, model, ContentChildren, SkipSelf, PLATFORM_ID, InjectionToken } from '@angular/core';
|
|
3
3
|
import * as i1$1 from '@angular/common';
|
|
4
4
|
import { NgTemplateOutlet, DOCUMENT, NgClass, AsyncPipe, DatePipe, CommonModule, isPlatformBrowser } from '@angular/common';
|
|
5
5
|
import * as i1 from '@angular/common/http';
|
|
@@ -2374,15 +2374,16 @@ const getPrecision = (a) => {
|
|
|
2374
2374
|
return p;
|
|
2375
2375
|
};
|
|
2376
2376
|
const formatNumber = (value, decimalLength, chunkDelimiter, decimalDelimiter, chunkLength) => {
|
|
2377
|
-
const
|
|
2377
|
+
const numberValue = Number(value);
|
|
2378
|
+
const abs = Math.abs(numberValue);
|
|
2378
2379
|
if (0 < abs && 1 > abs) {
|
|
2379
2380
|
const firstDigitIndex = Math.floor(Math.abs(Math.log10(abs)));
|
|
2380
2381
|
decimalLength += firstDigitIndex;
|
|
2381
2382
|
}
|
|
2382
|
-
const precision = Math.min(getPrecision(
|
|
2383
|
-
const
|
|
2384
|
-
const
|
|
2385
|
-
return (decimalDelimiter ?
|
|
2383
|
+
const precision = Math.min(getPrecision(numberValue), Math.floor(decimalLength));
|
|
2384
|
+
const digitGroupingRegex = '\\d(?=(\\d{' + chunkLength + '})+' + (precision > 0 ? '\\D' : '$') + ')';
|
|
2385
|
+
const formattedNumberString = numberValue.toFixed(precision);
|
|
2386
|
+
return (decimalDelimiter ? formattedNumberString.replace('.', decimalDelimiter) : formattedNumberString).replace(new RegExp(digitGroupingRegex, 'g'), '$&' + chunkDelimiter);
|
|
2386
2387
|
};
|
|
2387
2388
|
const prependZero = (input, length) => ('0'.repeat(length) + input).slice(-length);
|
|
2388
2389
|
|
|
@@ -4050,7 +4051,6 @@ class NumberPipe {
|
|
|
4050
4051
|
if (decimalLength === null) {
|
|
4051
4052
|
return value.toString();
|
|
4052
4053
|
}
|
|
4053
|
-
value = Number(value);
|
|
4054
4054
|
return formatNumber(value, decimalLength, chunkDelimiter, decimalDelimiter, chunkLength);
|
|
4055
4055
|
}
|
|
4056
4056
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: NumberPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
@@ -4305,7 +4305,7 @@ class TextFieldComponent {
|
|
|
4305
4305
|
useExisting: forwardRef(() => TextFieldComponent),
|
|
4306
4306
|
multi: true,
|
|
4307
4307
|
},
|
|
4308
|
-
], viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true }], ngImport: i0, template: "@if (leftIconName) {\n <teta-icon [name]=\"leftIconName\" [palette]=\"'text'\"></teta-icon>\n}\n<input\n #input\n [ngModel]=\"value | tetaNumber: (!onlyNumber
|
|
4308
|
+
], viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true }], ngImport: i0, template: "@if (leftIconName) {\n <teta-icon [name]=\"leftIconName\" [palette]=\"'text'\"></teta-icon>\n}\n<input\n #input\n [ngModel]=\"value | tetaNumber: (!onlyNumber || inputFocused ? null : decimalPart)\"\n [tetaOnlyNumber]=\"onlyNumber\"\n (ngModelChange)=\"value = $event; onChange($event)\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n [ngClass]=\"{ 'color-text-40': disabled }\"\n (focus)=\"inputFocused = true\"\n (blur)=\"inputFocused = false; emitBlur()\"\n (keydown)=\"keyPress($event)\"\n type=\"text\"\n/>\n@if (value && !disabled) {\n <teta-icon\n class=\"close-icon\"\n [name]=\"'closeCircle'\"\n [palette]=\"'text'\"\n (click)=\"value = ''; onChange('')\"\n ></teta-icon>\n}\n", styles: [""], dependencies: [{ kind: "component", type: IconComponent, selector: "teta-icon", inputs: ["name", "size", "palette", "class"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: OnlyNumberDirective, selector: "[tetaOnlyNumber]", inputs: ["tetaOnlyNumber", "allowDecimals", "allowSign", "decimalSeparator", "commaSeparator", "onlyPositive"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: NumberPipe, name: "tetaNumber" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
4309
4309
|
}
|
|
4310
4310
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: TextFieldComponent, decorators: [{
|
|
4311
4311
|
type: Component,
|
|
@@ -4315,7 +4315,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
|
4315
4315
|
useExisting: forwardRef(() => TextFieldComponent),
|
|
4316
4316
|
multi: true,
|
|
4317
4317
|
},
|
|
4318
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, imports: [IconComponent, FormsModule, OnlyNumberDirective, NgClass, NumberPipe], template: "@if (leftIconName) {\n <teta-icon [name]=\"leftIconName\" [palette]=\"'text'\"></teta-icon>\n}\n<input\n #input\n [ngModel]=\"value | tetaNumber: (!onlyNumber
|
|
4318
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, imports: [IconComponent, FormsModule, OnlyNumberDirective, NgClass, NumberPipe], template: "@if (leftIconName) {\n <teta-icon [name]=\"leftIconName\" [palette]=\"'text'\"></teta-icon>\n}\n<input\n #input\n [ngModel]=\"value | tetaNumber: (!onlyNumber || inputFocused ? null : decimalPart)\"\n [tetaOnlyNumber]=\"onlyNumber\"\n (ngModelChange)=\"value = $event; onChange($event)\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n [ngClass]=\"{ 'color-text-40': disabled }\"\n (focus)=\"inputFocused = true\"\n (blur)=\"inputFocused = false; emitBlur()\"\n (keydown)=\"keyPress($event)\"\n type=\"text\"\n/>\n@if (value && !disabled) {\n <teta-icon\n class=\"close-icon\"\n [name]=\"'closeCircle'\"\n [palette]=\"'text'\"\n (click)=\"value = ''; onChange('')\"\n ></teta-icon>\n}\n" }]
|
|
4319
4319
|
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { placeholder: [{
|
|
4320
4320
|
type: Input
|
|
4321
4321
|
}], leftIconName: [{
|