@tetacom/ng-components 1.0.7 → 1.0.11

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.
@@ -240,7 +240,14 @@ class IconSpriteDirective {
240
240
  this.bypassInterceptors = true;
241
241
  }
242
242
  ngOnInit() {
243
- this._iconService.addSprite(this.tetaIconSprite, this.bypassInterceptors);
243
+ if (typeof this.tetaIconSprite === 'string') {
244
+ this._iconService.addSprite(this.tetaIconSprite, this.bypassInterceptors);
245
+ }
246
+ if (this.tetaIconSprite instanceof Array && this.tetaIconSprite?.length) {
247
+ this.tetaIconSprite.forEach((sprite) => {
248
+ this._iconService.addSprite(sprite, this.bypassInterceptors);
249
+ });
250
+ }
244
251
  }
245
252
  }
246
253
  IconSpriteDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: IconSpriteDirective, deps: [{ token: IconService }], target: i0.ɵɵFactoryTarget.Directive });
@@ -2620,7 +2627,7 @@ class OnlyNumberDirective {
2620
2627
  if (this.tetaOnlyNumber === false) {
2621
2628
  return;
2622
2629
  }
2623
- value = value.replace(',', '.');
2630
+ value = value.replace(',', '.').trim();
2624
2631
  let regex = this._integerUnsigned;
2625
2632
  if (!this.allowDecimals && !this.allowSign) {
2626
2633
  regex = this._integerUnsigned;
@@ -2672,7 +2679,7 @@ class OnlyNumberDirective {
2672
2679
  if (value === '-0.0') {
2673
2680
  value = '0.0';
2674
2681
  }
2675
- const valid = new RegExp(regex).test(value);
2682
+ const valid = new RegExp(regex).test(value.toString());
2676
2683
  this._control.control.setValue(valid ? value : this._previousValue ?? 0);
2677
2684
  }
2678
2685
  }
@@ -3531,6 +3538,7 @@ class TextFieldComponent {
3531
3538
  this.placeholder = '';
3532
3539
  this.disabled = false;
3533
3540
  this.onlyNumber = false;
3541
+ this.tabindex = 0;
3534
3542
  this.textField = true;
3535
3543
  this.value = '';
3536
3544
  }
@@ -3542,6 +3550,9 @@ class TextFieldComponent {
3542
3550
  this.input.nativeElement.blur();
3543
3551
  }
3544
3552
  }
3553
+ emitBlur() {
3554
+ this.onTouched();
3555
+ }
3545
3556
  registerOnChange(fn) {
3546
3557
  this.onChange = fn;
3547
3558
  }
@@ -3556,17 +3567,19 @@ class TextFieldComponent {
3556
3567
  this.value = input;
3557
3568
  this._cdr.detectChanges();
3558
3569
  }
3559
- onChange(input) { }
3560
- onTouched(input) { }
3570
+ onChange(input) {
3571
+ }
3572
+ onTouched() {
3573
+ }
3561
3574
  }
3562
3575
  TextFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: TextFieldComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
3563
- TextFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: TextFieldComponent, selector: "teta-text-field", inputs: { placeholder: "placeholder", leftIconName: "leftIconName", disabled: "disabled", onlyNumber: "onlyNumber", invalid: "invalid" }, host: { listeners: { "click": "onFocus()" }, properties: { "class.text-field_disabled": "this.disabled", "class.text-field_invalid": "this.invalid", "class.text-field": "this.textField" } }, providers: [
3576
+ TextFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: TextFieldComponent, selector: "teta-text-field", inputs: { placeholder: "placeholder", leftIconName: "leftIconName", disabled: "disabled", onlyNumber: "onlyNumber", invalid: "invalid" }, host: { listeners: { "click": "onFocus()" }, properties: { "class.text-field_disabled": "this.disabled", "class.text-field_invalid": "this.invalid", "attr.tabindex": "this.tabindex", "class.text-field": "this.textField" } }, providers: [
3564
3577
  {
3565
3578
  provide: NG_VALUE_ACCESSOR,
3566
3579
  useExisting: forwardRef(() => TextFieldComponent),
3567
3580
  multi: true,
3568
3581
  },
3569
- ], viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true }], ngImport: i0, template: "<teta-icon *ngIf=\"leftIconName\" [name]=\"leftIconName\"></teta-icon>\n<input\n #input\n [ngModel]=\"value\"\n [tetaOnlyNumber]=\"onlyNumber\"\n (ngModelChange)=\"value = $event; onChange($event);\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n (keydown)=\"keyPress($event)\"\n autocomplete=\"off\"\n type=\"text\"\n/>\n<teta-icon\n *ngIf=\"value && !disabled\"\n class=\"close-icon\"\n [name]=\"'closeCircle'\"\n (click)=\"value = ''; onChange('');\"\n></teta-icon>\n", styles: [""], components: [{ type: IconComponent, selector: "teta-icon", inputs: ["name", "size", "palette", "class"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: OnlyNumberDirective, selector: "[tetaOnlyNumber]", inputs: ["tetaOnlyNumber", "allowDecimals", "allowSign", "decimalSeparator", "commaSeparator"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3582
+ ], viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true }], ngImport: i0, template: "<teta-icon *ngIf=\"leftIconName\" [name]=\"leftIconName\"></teta-icon>\n<input\n #input\n [ngModel]=\"value\"\n [tetaOnlyNumber]=\"onlyNumber\"\n (ngModelChange)=\"value = $event; onChange($event);\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n (blur)=\"emitBlur()\"\n (keydown)=\"keyPress($event)\"\n autocomplete=\"off\"\n type=\"text\"\n/>\n<teta-icon\n *ngIf=\"value && !disabled\"\n class=\"close-icon\"\n [name]=\"'closeCircle'\"\n (click)=\"value = ''; onChange('');\"\n></teta-icon>\n", styles: [""], components: [{ type: IconComponent, selector: "teta-icon", inputs: ["name", "size", "palette", "class"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: OnlyNumberDirective, selector: "[tetaOnlyNumber]", inputs: ["tetaOnlyNumber", "allowDecimals", "allowSign", "decimalSeparator", "commaSeparator"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3570
3583
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: TextFieldComponent, decorators: [{
3571
3584
  type: Component,
3572
3585
  args: [{ selector: 'teta-text-field', providers: [
@@ -3575,7 +3588,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
3575
3588
  useExisting: forwardRef(() => TextFieldComponent),
3576
3589
  multi: true,
3577
3590
  },
3578
- ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<teta-icon *ngIf=\"leftIconName\" [name]=\"leftIconName\"></teta-icon>\n<input\n #input\n [ngModel]=\"value\"\n [tetaOnlyNumber]=\"onlyNumber\"\n (ngModelChange)=\"value = $event; onChange($event);\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n (keydown)=\"keyPress($event)\"\n autocomplete=\"off\"\n type=\"text\"\n/>\n<teta-icon\n *ngIf=\"value && !disabled\"\n class=\"close-icon\"\n [name]=\"'closeCircle'\"\n (click)=\"value = ''; onChange('');\"\n></teta-icon>\n", styles: [""] }]
3591
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<teta-icon *ngIf=\"leftIconName\" [name]=\"leftIconName\"></teta-icon>\n<input\n #input\n [ngModel]=\"value\"\n [tetaOnlyNumber]=\"onlyNumber\"\n (ngModelChange)=\"value = $event; onChange($event);\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n (blur)=\"emitBlur()\"\n (keydown)=\"keyPress($event)\"\n autocomplete=\"off\"\n type=\"text\"\n/>\n<teta-icon\n *ngIf=\"value && !disabled\"\n class=\"close-icon\"\n [name]=\"'closeCircle'\"\n (click)=\"value = ''; onChange('');\"\n></teta-icon>\n", styles: [""] }]
3579
3592
  }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { placeholder: [{
3580
3593
  type: Input
3581
3594
  }], leftIconName: [{
@@ -3595,6 +3608,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
3595
3608
  }], input: [{
3596
3609
  type: ViewChild,
3597
3610
  args: ['input', { static: false }]
3611
+ }], tabindex: [{
3612
+ type: HostBinding,
3613
+ args: ['attr.tabindex']
3598
3614
  }], textField: [{
3599
3615
  type: HostBinding,
3600
3616
  args: ['class.text-field']
@@ -10717,12 +10733,15 @@ class TetaChart {
10717
10733
  className: annotation.className,
10718
10734
  };
10719
10735
  });
10720
- const makeAnnotations = d3annotation.annotation().annotations(annotations ?? []);
10736
+ const makeAnnotations = d3annotation
10737
+ .annotation()
10738
+ .annotations(annotations ?? []);
10721
10739
  this._chart
10722
10740
  .append('g')
10723
10741
  .attr('class', 'annotations')
10724
10742
  .attr('clip-path', `url(#draw-window-${this.uniqId})`)
10725
- .call(makeAnnotations);
10743
+ .call(makeAnnotations)
10744
+ .lower();
10726
10745
  }
10727
10746
  drawPlotLines() {
10728
10747
  this._chart.selectAll('.plotlines').remove();
@@ -10918,7 +10937,12 @@ class TetaChart {
10918
10937
  .attr('x', (d) => x(d.from))
10919
10938
  .attr('y', 0)
10920
10939
  .attr('width', (d) => Math.abs(x(d.to) - x(d.from)))
10921
- .attr('fill', (d) => d.color)
10940
+ .attr('fill', (d) => {
10941
+ if (d.image) {
10942
+ return `url(#${d.image})`;
10943
+ }
10944
+ return d.color;
10945
+ })
10922
10946
  .style('opacity', (d) => d.opacity ?? 1)
10923
10947
  .attr('height', plotBandHeight > 0 ? plotBandHeight : 0)
10924
10948
  .attr('transform', `translate(0, ${this._options.bounds.top})`);
@@ -11158,7 +11182,12 @@ class TetaChart {
11158
11182
  .attr('x', 0)
11159
11183
  .attr('y', (d) => y(d.from))
11160
11184
  .attr('width', (d) => plotBandWidth)
11161
- .attr('fill', (d) => d.color)
11185
+ .attr('fill', (d) => {
11186
+ if (d.image) {
11187
+ return `url(#${d.image})`;
11188
+ }
11189
+ return d.color;
11190
+ })
11162
11191
  .style('opacity', (d) => d.opacity ?? 1)
11163
11192
  .attr('height', (d) => Math.abs(y(d.to) - y(d.from)))
11164
11193
  .attr('cursor', (d) => (d.draggable ? 'move' : 'default'));
@@ -11230,7 +11259,7 @@ class TetaChart {
11230
11259
  }
11231
11260
  drawChart() {
11232
11261
  const series = this._options.series?.filter((_) => _.visible);
11233
- this._chart.selectAll('.chart-container').remove();
11262
+ this._chart.selectAll('.series').remove();
11234
11263
  if (!series || series.length < 1) {
11235
11264
  d3.select(this._container.nativeElement)
11236
11265
  .select('canvas')
@@ -12061,6 +12090,7 @@ class PlotBand {
12061
12090
  this.to = options?.to;
12062
12091
  this.label = options?.label;
12063
12092
  this.color = options?.color || '#59AE501A';
12093
+ this.image = options?.image;
12064
12094
  this.showGrabbers =
12065
12095
  options?.showGrabbers != null ? options.showGrabbers : true;
12066
12096
  this.draggable = options?.draggable != null ? options?.draggable : false;