@tetacom/ng-components 1.6.19 → 1.6.21

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 { Component, ChangeDetectionStrategy, HostBinding, Directive, Optional, Inject, ContentChild, Input, Injectable, Host, HostListener, 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';
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';
@@ -1566,7 +1566,8 @@ class DynamicComponentService {
1566
1566
  const componentRef = componentFactory.create(injector);
1567
1567
  for (const key in context) {
1568
1568
  if (Object.prototype.hasOwnProperty.call(context, key)) {
1569
- componentRef.instance[key] = context[key];
1569
+ // componentRef.instance[key] = context[key];
1570
+ componentRef.setInput(key, context[key]);
1570
1571
  }
1571
1572
  }
1572
1573
  const componentNativeEl = componentRef.location.nativeElement;
@@ -2374,15 +2375,16 @@ const getPrecision = (a) => {
2374
2375
  return p;
2375
2376
  };
2376
2377
  const formatNumber = (value, decimalLength, chunkDelimiter, decimalDelimiter, chunkLength) => {
2377
- const abs = Math.abs(value);
2378
+ const numberValue = Number(value);
2379
+ const abs = Math.abs(numberValue);
2378
2380
  if (0 < abs && 1 > abs) {
2379
2381
  const firstDigitIndex = Math.floor(Math.abs(Math.log10(abs)));
2380
2382
  decimalLength += firstDigitIndex;
2381
2383
  }
2382
- const precision = Math.min(getPrecision(value), Math.floor(decimalLength));
2383
- const result = '\\d(?=(\\d{' + chunkLength + '})+' + (precision > 0 ? '\\D' : '$') + ')';
2384
- const num = value.toFixed(precision);
2385
- return (decimalDelimiter ? num.replace('.', decimalDelimiter) : num).replace(new RegExp(result, 'g'), '$&' + chunkDelimiter);
2384
+ const precision = Math.min(getPrecision(numberValue), Math.floor(decimalLength));
2385
+ const digitGroupingRegex = '\\d(?=(\\d{' + chunkLength + '})+' + (precision > 0 ? '\\D' : '$') + ')';
2386
+ const formattedNumberString = numberValue.toFixed(precision);
2387
+ return (decimalDelimiter ? formattedNumberString.replace('.', decimalDelimiter) : formattedNumberString).replace(new RegExp(digitGroupingRegex, 'g'), '$&' + chunkDelimiter);
2386
2388
  };
2387
2389
  const prependZero = (input, length) => ('0'.repeat(length) + input).slice(-length);
2388
2390
 
@@ -4050,7 +4052,6 @@ class NumberPipe {
4050
4052
  if (decimalLength === null) {
4051
4053
  return value.toString();
4052
4054
  }
4053
- value = Number(value);
4054
4055
  return formatNumber(value, decimalLength, chunkDelimiter, decimalDelimiter, chunkLength);
4055
4056
  }
4056
4057
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: NumberPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
@@ -4305,7 +4306,7 @@ class TextFieldComponent {
4305
4306
  useExisting: forwardRef(() => TextFieldComponent),
4306
4307
  multi: true,
4307
4308
  },
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 ? null : inputFocused ? 1000 : 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
+ ], 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
4310
  }
4310
4311
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: TextFieldComponent, decorators: [{
4311
4312
  type: Component,
@@ -4315,7 +4316,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
4315
4316
  useExisting: forwardRef(() => TextFieldComponent),
4316
4317
  multi: true,
4317
4318
  },
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 ? null : inputFocused ? 1000 : 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
+ ], 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
4320
  }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { placeholder: [{
4320
4321
  type: Input
4321
4322
  }], leftIconName: [{