@tetacom/ng-components 1.0.6 → 1.0.7

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.
@@ -1151,12 +1151,12 @@ class DropdownBase {
1151
1151
  }
1152
1152
  }
1153
1153
  closeDropdown() {
1154
- if (this._body && this.container.contains(this._body)) {
1154
+ if (this.open && this._body && this.container.contains(this._body)) {
1155
1155
  this._renderer.removeChild(this.container, this._body);
1156
+ this._open = false;
1157
+ this._body = null;
1158
+ this.openChange.emit(this.open);
1156
1159
  }
1157
- this._open = false;
1158
- this._body = null;
1159
- this.openChange.emit(this.open);
1160
1160
  }
1161
1161
  openDropdown() {
1162
1162
  if (this._open || !this._content || this.disabled) {
@@ -4122,9 +4122,8 @@ const getFilterComponent = (item) => filterComponentsMap.has(item.filterType)
4122
4122
  : StringFilterComponent;
4123
4123
 
4124
4124
  class FilterHostComponent {
4125
- constructor(viewContainerRef, componentFactoryResolver) {
4125
+ constructor(viewContainerRef) {
4126
4126
  this.viewContainerRef = viewContainerRef;
4127
- this.componentFactoryResolver = componentFactoryResolver;
4128
4127
  this.filterChanged = new EventEmitter();
4129
4128
  this._alive = true;
4130
4129
  }
@@ -4153,9 +4152,8 @@ class FilterHostComponent {
4153
4152
  if (!FilterComponentBase.isPrototypeOf(this._column.filterComponent)) {
4154
4153
  this._column.filterComponent = getFilterComponent(this._column);
4155
4154
  }
4156
- const compFactory = this.componentFactoryResolver.resolveComponentFactory(this._column.filterComponent);
4157
4155
  this._componentRef =
4158
- this.viewContainerRef.createComponent(compFactory);
4156
+ this.viewContainerRef.createComponent(this._column.filterComponent);
4159
4157
  this._componentRef.instance.column = this._column;
4160
4158
  this._componentRef.instance.state = this._state;
4161
4159
  this._componentRef.instance.filterOptions = this._filterOptions;
@@ -4171,7 +4169,7 @@ class FilterHostComponent {
4171
4169
  this._alive = false;
4172
4170
  }
4173
4171
  }
4174
- FilterHostComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: FilterHostComponent, deps: [{ token: i0.ViewContainerRef }, { token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Component });
4172
+ FilterHostComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: FilterHostComponent, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component });
4175
4173
  FilterHostComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: FilterHostComponent, selector: "teta-filter-host", inputs: { column: "column", state: "state", filterOptions: "filterOptions" }, outputs: { filterChanged: "filterChanged" }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
4176
4174
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: FilterHostComponent, decorators: [{
4177
4175
  type: Component,
@@ -4181,7 +4179,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
4181
4179
  styles: [],
4182
4180
  changeDetection: ChangeDetectionStrategy.OnPush,
4183
4181
  }]
4184
- }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.ComponentFactoryResolver }]; }, propDecorators: { column: [{
4182
+ }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; }, propDecorators: { column: [{
4185
4183
  type: Input
4186
4184
  }], state: [{
4187
4185
  type: Input
@@ -7608,9 +7606,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
7608
7606
  }] } });
7609
7607
 
7610
7608
  class HeadCellHostComponent {
7611
- constructor(viewContainerRef, componentFactoryResolver) {
7609
+ constructor(viewContainerRef) {
7612
7610
  this.viewContainerRef = viewContainerRef;
7613
- this.componentFactoryResolver = componentFactoryResolver;
7614
7611
  }
7615
7612
  set column(column) {
7616
7613
  this._column = column;
@@ -7625,19 +7622,18 @@ class HeadCellHostComponent {
7625
7622
  if (!HeadCellComponentBase.isPrototypeOf(this.column.headCellComponent)) {
7626
7623
  this.column.headCellComponent = DefaultHeadCellComponent;
7627
7624
  }
7628
- const compFactory = this.componentFactoryResolver.resolveComponentFactory(this.column.headCellComponent);
7629
7625
  this.componentRef =
7630
- this.viewContainerRef.createComponent(compFactory);
7626
+ this.viewContainerRef.createComponent(this.column.headCellComponent);
7631
7627
  this.componentRef.instance.column = this.column;
7632
7628
  this.init = true;
7633
7629
  }
7634
7630
  }
7635
- HeadCellHostComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: HeadCellHostComponent, deps: [{ token: i0.ViewContainerRef }, { token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Component });
7631
+ HeadCellHostComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: HeadCellHostComponent, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component });
7636
7632
  HeadCellHostComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: HeadCellHostComponent, selector: "teta-head-cell-host", inputs: { column: "column" }, ngImport: i0, template: '', isInline: true, styles: [":host{display:contents}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
7637
7633
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: HeadCellHostComponent, decorators: [{
7638
7634
  type: Component,
7639
7635
  args: [{ selector: 'teta-head-cell-host', template: '', changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:contents}\n"] }]
7640
- }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.ComponentFactoryResolver }]; }, propDecorators: { column: [{
7636
+ }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; }, propDecorators: { column: [{
7641
7637
  type: Input
7642
7638
  }] } });
7643
7639
 
@@ -8678,7 +8674,7 @@ class DateCellComponent extends CellComponentBase {
8678
8674
  super.ngOnInit();
8679
8675
  }
8680
8676
  setValue(value) {
8681
- this.row.data[this.column.name] = value;
8677
+ this.row.data[this.column.name] = value ? new Date(value) : value;
8682
8678
  this.valueChanged();
8683
8679
  }
8684
8680
  startEdit(initiator, type) {
@@ -8694,10 +8690,10 @@ class DateCellComponent extends CellComponentBase {
8694
8690
  }
8695
8691
  }
8696
8692
  DateCellComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: DateCellComponent, deps: [{ token: TableService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
8697
- DateCellComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: DateCellComponent, selector: "teta-date-cell", inputs: { column: "column", row: "row" }, viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<span [style.display]=\"edit ? 'none' : 'block'\" class=\"cell-text\">\n {{row.data[column.name] | date : 'dd.MM.yyyy'}}\n</span>\n<teta-date-picker class=\"datepicker-table\" #input\n *ngIf=\"edit\"\n [appendToBody]=\"false\"\n [showTime]=\"false\"\n [ngModel]=\"row.data[column.name]\"\n (ngModelChange)=\"setValue($event)\"\n></teta-date-picker>\n", styles: [""], components: [{ type: DatePickerComponent, selector: "teta-date-picker", inputs: ["disabled", "invalid", "firstDayOfWeek", "disabledDates", "disabledPeriods", "disabledDays", "minDate", "maxDate", "minYearDate", "maxYearDate", "appendToBody", "showTime", "format"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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"] }], pipes: { "date": i2.DatePipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
8693
+ DateCellComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: DateCellComponent, selector: "teta-date-cell", inputs: { column: "column", row: "row" }, viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<span [style.display]=\"edit ? 'none' : 'block'\" class=\"cell-text\">\n {{row.data[column.name] | date : 'dd.MM.yyyy'}}\n</span>\n<teta-date-picker class=\"datepicker-table\"\n #input\n *ngIf=\"edit\"\n [appendToBody]=\"false\"\n [showTime]=\"false\"\n [ngModel]=\"row.data[column.name]\"\n (ngModelChange)=\"setValue($event)\"\n></teta-date-picker>\n", styles: [""], components: [{ type: DatePickerComponent, selector: "teta-date-picker", inputs: ["disabled", "invalid", "firstDayOfWeek", "disabledDates", "disabledPeriods", "disabledDays", "minDate", "maxDate", "minYearDate", "maxYearDate", "appendToBody", "showTime", "format"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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"] }], pipes: { "date": i2.DatePipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
8698
8694
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: DateCellComponent, decorators: [{
8699
8695
  type: Component,
8700
- args: [{ selector: 'teta-date-cell', changeDetection: ChangeDetectionStrategy.OnPush, template: "<span [style.display]=\"edit ? 'none' : 'block'\" class=\"cell-text\">\n {{row.data[column.name] | date : 'dd.MM.yyyy'}}\n</span>\n<teta-date-picker class=\"datepicker-table\" #input\n *ngIf=\"edit\"\n [appendToBody]=\"false\"\n [showTime]=\"false\"\n [ngModel]=\"row.data[column.name]\"\n (ngModelChange)=\"setValue($event)\"\n></teta-date-picker>\n", styles: [""] }]
8696
+ args: [{ selector: 'teta-date-cell', changeDetection: ChangeDetectionStrategy.OnPush, template: "<span [style.display]=\"edit ? 'none' : 'block'\" class=\"cell-text\">\n {{row.data[column.name] | date : 'dd.MM.yyyy'}}\n</span>\n<teta-date-picker class=\"datepicker-table\"\n #input\n *ngIf=\"edit\"\n [appendToBody]=\"false\"\n [showTime]=\"false\"\n [ngModel]=\"row.data[column.name]\"\n (ngModelChange)=\"setValue($event)\"\n></teta-date-picker>\n", styles: [""] }]
8701
8697
  }], ctorParameters: function () { return [{ type: TableService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { column: [{
8702
8698
  type: Input
8703
8699
  }], row: [{
@@ -8853,17 +8849,15 @@ const getCellComponent = (column) => cellComponentsMap.has(column.filterType)
8853
8849
  : StringCellComponent;
8854
8850
 
8855
8851
  class CellHostComponent {
8856
- constructor(viewContainerRef, componentFactoryResolver) {
8852
+ constructor(viewContainerRef) {
8857
8853
  this.viewContainerRef = viewContainerRef;
8858
- this.componentFactoryResolver = componentFactoryResolver;
8859
8854
  this._init = false;
8860
8855
  }
8861
8856
  ngOnInit() {
8862
8857
  if (!CellComponentBase.isPrototypeOf(this.column.cellComponent)) {
8863
8858
  this.column.cellComponent = getCellComponent(this.column);
8864
8859
  }
8865
- const compFactory = this.componentFactoryResolver.resolveComponentFactory(this.column.cellComponent);
8866
- this._componentRef = this.viewContainerRef.createComponent(compFactory);
8860
+ this._componentRef = this.viewContainerRef.createComponent(this.column.cellComponent);
8867
8861
  this._componentRef.instance.column = this.column;
8868
8862
  this._componentRef.instance.row = this.row;
8869
8863
  this._componentRef.instance.filterOptions = this.filterOptions;
@@ -8885,12 +8879,12 @@ class CellHostComponent {
8885
8879
  }
8886
8880
  }
8887
8881
  }
8888
- CellHostComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: CellHostComponent, deps: [{ token: i0.ViewContainerRef }, { token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Component });
8882
+ CellHostComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: CellHostComponent, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component });
8889
8883
  CellHostComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: CellHostComponent, selector: "teta-cell-host", inputs: { column: "column", row: "row", filterOptions: "filterOptions", dict: "dict" }, usesOnChanges: true, ngImport: i0, template: '', isInline: true, styles: [""], changeDetection: i0.ChangeDetectionStrategy.OnPush });
8890
8884
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: CellHostComponent, decorators: [{
8891
8885
  type: Component,
8892
8886
  args: [{ selector: 'teta-cell-host', template: '', changeDetection: ChangeDetectionStrategy.OnPush, styles: [""] }]
8893
- }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.ComponentFactoryResolver }]; }, propDecorators: { column: [{
8887
+ }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; }, propDecorators: { column: [{
8894
8888
  type: Input
8895
8889
  }], row: [{
8896
8890
  type: Input
@@ -9226,7 +9220,7 @@ class TableComponent {
9226
9220
  this.startEditRowOrCell(coordinates);
9227
9221
  }
9228
9222
  }
9229
- if (!this.isRow(event.target)) {
9223
+ if (!this.eventIsOnRow(event)) {
9230
9224
  this._svc.startEditRow(null);
9231
9225
  }
9232
9226
  }
@@ -9364,27 +9358,19 @@ class TableComponent {
9364
9358
  this._svc.startEditCell(coordinates);
9365
9359
  }
9366
9360
  }
9367
- getCell(element) {
9368
- if (!element.parentElement) {
9369
- return null;
9370
- }
9371
- if (element.tagName.toLowerCase() === 'teta-cell') {
9372
- return element;
9373
- }
9374
- return this.getCell(element.parentElement);
9361
+ getEventCell(event) {
9362
+ return event.composedPath().find((target) => {
9363
+ return target.tagName?.toLowerCase() === 'teta-cell';
9364
+ });
9375
9365
  }
9376
- isRow(element) {
9377
- if (!element.parentElement) {
9378
- return false;
9379
- }
9380
- if (this._elementRef.nativeElement.contains(element) &&
9381
- element.getAttribute('data-row')) {
9382
- return true;
9383
- }
9384
- return this.isRow(element.parentElement);
9366
+ eventIsOnRow(event) {
9367
+ const row = event.composedPath().find((target) => {
9368
+ return target?.getAttribute && target?.getAttribute('data-row');
9369
+ });
9370
+ return row && this._elementRef.nativeElement.contains(row);
9385
9371
  }
9386
9372
  getCoordinates(event) {
9387
- const cell = this.getCell(event.target);
9373
+ const cell = this.getEventCell(event);
9388
9374
  if (cell) {
9389
9375
  const rowIndex = cell.getAttribute('data-row');
9390
9376
  const columnName = cell.getAttribute('data-column');
@@ -11244,7 +11230,7 @@ class TetaChart {
11244
11230
  }
11245
11231
  drawChart() {
11246
11232
  const series = this._options.series?.filter((_) => _.visible);
11247
- this._chart.selectAll('.series').remove();
11233
+ this._chart.selectAll('.chart-container').remove();
11248
11234
  if (!series || series.length < 1) {
11249
11235
  d3.select(this._container.nativeElement)
11250
11236
  .select('canvas')