@tetacom/ng-components 1.0.5 → 1.0.9

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.
@@ -1163,12 +1163,12 @@ class DropdownBase {
1163
1163
  }
1164
1164
  }
1165
1165
  closeDropdown() {
1166
- if (this._body && this.container.contains(this._body)) {
1166
+ if (this.open && this._body && this.container.contains(this._body)) {
1167
1167
  this._renderer.removeChild(this.container, this._body);
1168
+ this._open = false;
1169
+ this._body = null;
1170
+ this.openChange.emit(this.open);
1168
1171
  }
1169
- this._open = false;
1170
- this._body = null;
1171
- this.openChange.emit(this.open);
1172
1172
  }
1173
1173
  openDropdown() {
1174
1174
  if (this._open || !this._content || this.disabled) {
@@ -2640,7 +2640,7 @@ class OnlyNumberDirective {
2640
2640
  if (this.tetaOnlyNumber === false) {
2641
2641
  return;
2642
2642
  }
2643
- value = value.replace(',', '.');
2643
+ value = value.replace(',', '.').trim();
2644
2644
  let regex = this._integerUnsigned;
2645
2645
  if (!this.allowDecimals && !this.allowSign) {
2646
2646
  regex = this._integerUnsigned;
@@ -2692,7 +2692,8 @@ class OnlyNumberDirective {
2692
2692
  if (value === '-0.0') {
2693
2693
  value = '0.0';
2694
2694
  }
2695
- const valid = new RegExp(regex).test(value);
2695
+ const valid = new RegExp(regex).test(value.toString());
2696
+ console.log(value, valid);
2696
2697
  this._control.control.setValue(valid ? value : (_a = this._previousValue) !== null && _a !== void 0 ? _a : 0);
2697
2698
  }
2698
2699
  }
@@ -4151,9 +4152,8 @@ const getFilterComponent = (item) => filterComponentsMap.has(item.filterType)
4151
4152
  : StringFilterComponent;
4152
4153
 
4153
4154
  class FilterHostComponent {
4154
- constructor(viewContainerRef, componentFactoryResolver) {
4155
+ constructor(viewContainerRef) {
4155
4156
  this.viewContainerRef = viewContainerRef;
4156
- this.componentFactoryResolver = componentFactoryResolver;
4157
4157
  this.filterChanged = new EventEmitter();
4158
4158
  this._alive = true;
4159
4159
  }
@@ -4182,9 +4182,8 @@ class FilterHostComponent {
4182
4182
  if (!FilterComponentBase.isPrototypeOf(this._column.filterComponent)) {
4183
4183
  this._column.filterComponent = getFilterComponent(this._column);
4184
4184
  }
4185
- const compFactory = this.componentFactoryResolver.resolveComponentFactory(this._column.filterComponent);
4186
4185
  this._componentRef =
4187
- this.viewContainerRef.createComponent(compFactory);
4186
+ this.viewContainerRef.createComponent(this._column.filterComponent);
4188
4187
  this._componentRef.instance.column = this._column;
4189
4188
  this._componentRef.instance.state = this._state;
4190
4189
  this._componentRef.instance.filterOptions = this._filterOptions;
@@ -4200,7 +4199,7 @@ class FilterHostComponent {
4200
4199
  this._alive = false;
4201
4200
  }
4202
4201
  }
4203
- 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 });
4202
+ FilterHostComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: FilterHostComponent, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component });
4204
4203
  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 });
4205
4204
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: FilterHostComponent, decorators: [{
4206
4205
  type: Component,
@@ -4210,7 +4209,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
4210
4209
  styles: [],
4211
4210
  changeDetection: ChangeDetectionStrategy.OnPush,
4212
4211
  }]
4213
- }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.ComponentFactoryResolver }]; }, propDecorators: { column: [{
4212
+ }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; }, propDecorators: { column: [{
4214
4213
  type: Input
4215
4214
  }], state: [{
4216
4215
  type: Input
@@ -7662,9 +7661,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
7662
7661
  }] } });
7663
7662
 
7664
7663
  class HeadCellHostComponent {
7665
- constructor(viewContainerRef, componentFactoryResolver) {
7664
+ constructor(viewContainerRef) {
7666
7665
  this.viewContainerRef = viewContainerRef;
7667
- this.componentFactoryResolver = componentFactoryResolver;
7668
7666
  }
7669
7667
  set column(column) {
7670
7668
  this._column = column;
@@ -7679,19 +7677,18 @@ class HeadCellHostComponent {
7679
7677
  if (!HeadCellComponentBase.isPrototypeOf(this.column.headCellComponent)) {
7680
7678
  this.column.headCellComponent = DefaultHeadCellComponent;
7681
7679
  }
7682
- const compFactory = this.componentFactoryResolver.resolveComponentFactory(this.column.headCellComponent);
7683
7680
  this.componentRef =
7684
- this.viewContainerRef.createComponent(compFactory);
7681
+ this.viewContainerRef.createComponent(this.column.headCellComponent);
7685
7682
  this.componentRef.instance.column = this.column;
7686
7683
  this.init = true;
7687
7684
  }
7688
7685
  }
7689
- 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 });
7686
+ HeadCellHostComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: HeadCellHostComponent, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component });
7690
7687
  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 });
7691
7688
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: HeadCellHostComponent, decorators: [{
7692
7689
  type: Component,
7693
7690
  args: [{ selector: 'teta-head-cell-host', template: '', changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:contents}\n"] }]
7694
- }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.ComponentFactoryResolver }]; }, propDecorators: { column: [{
7691
+ }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; }, propDecorators: { column: [{
7695
7692
  type: Input
7696
7693
  }] } });
7697
7694
 
@@ -8740,7 +8737,7 @@ class DateCellComponent extends CellComponentBase {
8740
8737
  super.ngOnInit();
8741
8738
  }
8742
8739
  setValue(value) {
8743
- this.row.data[this.column.name] = value;
8740
+ this.row.data[this.column.name] = value ? new Date(value) : value;
8744
8741
  this.valueChanged();
8745
8742
  }
8746
8743
  startEdit(initiator, type) {
@@ -8757,10 +8754,10 @@ class DateCellComponent extends CellComponentBase {
8757
8754
  }
8758
8755
  }
8759
8756
  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 });
8760
- 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 });
8757
+ 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 });
8761
8758
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: DateCellComponent, decorators: [{
8762
8759
  type: Component,
8763
- 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: [""] }]
8760
+ 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: [""] }]
8764
8761
  }], ctorParameters: function () { return [{ type: TableService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { column: [{
8765
8762
  type: Input
8766
8763
  }], row: [{
@@ -8918,17 +8915,15 @@ const getCellComponent = (column) => cellComponentsMap.has(column.filterType)
8918
8915
  : StringCellComponent;
8919
8916
 
8920
8917
  class CellHostComponent {
8921
- constructor(viewContainerRef, componentFactoryResolver) {
8918
+ constructor(viewContainerRef) {
8922
8919
  this.viewContainerRef = viewContainerRef;
8923
- this.componentFactoryResolver = componentFactoryResolver;
8924
8920
  this._init = false;
8925
8921
  }
8926
8922
  ngOnInit() {
8927
8923
  if (!CellComponentBase.isPrototypeOf(this.column.cellComponent)) {
8928
8924
  this.column.cellComponent = getCellComponent(this.column);
8929
8925
  }
8930
- const compFactory = this.componentFactoryResolver.resolveComponentFactory(this.column.cellComponent);
8931
- this._componentRef = this.viewContainerRef.createComponent(compFactory);
8926
+ this._componentRef = this.viewContainerRef.createComponent(this.column.cellComponent);
8932
8927
  this._componentRef.instance.column = this.column;
8933
8928
  this._componentRef.instance.row = this.row;
8934
8929
  this._componentRef.instance.filterOptions = this.filterOptions;
@@ -8950,12 +8945,12 @@ class CellHostComponent {
8950
8945
  }
8951
8946
  }
8952
8947
  }
8953
- 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 });
8948
+ CellHostComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: CellHostComponent, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component });
8954
8949
  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 });
8955
8950
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: CellHostComponent, decorators: [{
8956
8951
  type: Component,
8957
8952
  args: [{ selector: 'teta-cell-host', template: '', changeDetection: ChangeDetectionStrategy.OnPush, styles: [""] }]
8958
- }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.ComponentFactoryResolver }]; }, propDecorators: { column: [{
8953
+ }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; }, propDecorators: { column: [{
8959
8954
  type: Input
8960
8955
  }], row: [{
8961
8956
  type: Input
@@ -9300,7 +9295,7 @@ class TableComponent {
9300
9295
  this.startEditRowOrCell(coordinates);
9301
9296
  }
9302
9297
  }
9303
- if (!this.isRow(event.target)) {
9298
+ if (!this.eventIsOnRow(event)) {
9304
9299
  this._svc.startEditRow(null);
9305
9300
  }
9306
9301
  }
@@ -9441,27 +9436,20 @@ class TableComponent {
9441
9436
  this._svc.startEditCell(coordinates);
9442
9437
  }
9443
9438
  }
9444
- getCell(element) {
9445
- if (!element.parentElement) {
9446
- return null;
9447
- }
9448
- if (element.tagName.toLowerCase() === 'teta-cell') {
9449
- return element;
9450
- }
9451
- return this.getCell(element.parentElement);
9439
+ getEventCell(event) {
9440
+ return event.composedPath().find((target) => {
9441
+ var _a;
9442
+ return ((_a = target.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'teta-cell';
9443
+ });
9452
9444
  }
9453
- isRow(element) {
9454
- if (!element.parentElement) {
9455
- return false;
9456
- }
9457
- if (this._elementRef.nativeElement.contains(element) &&
9458
- element.getAttribute('data-row')) {
9459
- return true;
9460
- }
9461
- return this.isRow(element.parentElement);
9445
+ eventIsOnRow(event) {
9446
+ const row = event.composedPath().find((target) => {
9447
+ return (target === null || target === void 0 ? void 0 : target.getAttribute) && (target === null || target === void 0 ? void 0 : target.getAttribute('data-row'));
9448
+ });
9449
+ return row && this._elementRef.nativeElement.contains(row);
9462
9450
  }
9463
9451
  getCoordinates(event) {
9464
- const cell = this.getCell(event.target);
9452
+ const cell = this.getEventCell(event);
9465
9453
  if (cell) {
9466
9454
  const rowIndex = cell.getAttribute('data-row');
9467
9455
  const columnName = cell.getAttribute('data-column');
@@ -10795,8 +10783,9 @@ class TetaChart {
10795
10783
  .style('z-index', 1);
10796
10784
  }
10797
10785
  drawAnnotations() {
10786
+ var _a;
10798
10787
  this._chart.selectAll('.annotations').remove();
10799
- const annotations = this._options.annotations.map((annotation) => {
10788
+ const annotations = (_a = this._options.annotations) === null || _a === void 0 ? void 0 : _a.map((annotation) => {
10800
10789
  var _a, _b;
10801
10790
  const x = this._xScales.get(annotation.xAxisIndex);
10802
10791
  const y = this._yScales.get(annotation.yAxisIndex);
@@ -10811,12 +10800,15 @@ class TetaChart {
10811
10800
  className: annotation.className,
10812
10801
  };
10813
10802
  });
10814
- const makeAnnotations = d3annotation.annotation().annotations(annotations);
10803
+ const makeAnnotations = d3annotation
10804
+ .annotation()
10805
+ .annotations(annotations !== null && annotations !== void 0 ? annotations : []);
10815
10806
  this._chart
10816
10807
  .append('g')
10817
10808
  .attr('class', 'annotations')
10818
10809
  .attr('clip-path', `url(#draw-window-${this.uniqId})`)
10819
- .call(makeAnnotations);
10810
+ .call(makeAnnotations)
10811
+ .lower();
10820
10812
  }
10821
10813
  drawPlotLines() {
10822
10814
  this._chart.selectAll('.plotlines').remove();
@@ -12597,6 +12589,64 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
12597
12589
  }]
12598
12590
  }] });
12599
12591
 
12592
+ // import {DragSortItemDirective} from './drag-sort-item.directive';
12593
+ class DragSortContainerDirective {
12594
+ constructor() {
12595
+ this.dragSorted = new EventEmitter();
12596
+ }
12597
+ drop(event) {
12598
+ event.stopPropagation();
12599
+ event.preventDefault();
12600
+ }
12601
+ setDragItem(item) {
12602
+ this._dragItem = item;
12603
+ }
12604
+ getDragItem() {
12605
+ return this._dragItem;
12606
+ }
12607
+ getList() {
12608
+ return this.dragSortList;
12609
+ }
12610
+ setList(list) {
12611
+ this.dragSortList = list;
12612
+ }
12613
+ updateSortOrder(source, target, insertBefore) {
12614
+ if (source === target) {
12615
+ return;
12616
+ }
12617
+ const list = this.getList();
12618
+ const sourceIndex = list.indexOf(source);
12619
+ const targetIndex = list.indexOf(target);
12620
+ if ((insertBefore && sourceIndex + 1 === targetIndex) ||
12621
+ (!insertBefore && sourceIndex === targetIndex + 1)) {
12622
+ return;
12623
+ }
12624
+ const newIndex = list.indexOf(target) + (insertBefore ? 0 : 1);
12625
+ this.dragSorted.emit({
12626
+ list,
12627
+ source,
12628
+ target,
12629
+ newIndex,
12630
+ previousIndex: sourceIndex,
12631
+ });
12632
+ }
12633
+ }
12634
+ DragSortContainerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: DragSortContainerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
12635
+ DragSortContainerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.1", type: DragSortContainerDirective, selector: "[tetaDragSortContainer]", inputs: { dragSortList: "dragSortList" }, outputs: { dragSorted: "dragSorted" }, host: { listeners: { "drop": "drop($event)" } }, ngImport: i0 });
12636
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: DragSortContainerDirective, decorators: [{
12637
+ type: Directive,
12638
+ args: [{
12639
+ selector: '[tetaDragSortContainer]',
12640
+ }]
12641
+ }], ctorParameters: function () { return []; }, propDecorators: { dragSortList: [{
12642
+ type: Input
12643
+ }], dragSorted: [{
12644
+ type: Output
12645
+ }], drop: [{
12646
+ type: HostListener,
12647
+ args: ['drop', ['$event']]
12648
+ }] } });
12649
+
12600
12650
  class DragSortItemDirective {
12601
12651
  constructor(_container, _elementRef, _renderer) {
12602
12652
  this._container = _container;
@@ -12711,66 +12761,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
12711
12761
  args: ['drop', ['$event']]
12712
12762
  }] } });
12713
12763
 
12714
- class DragSortContainerDirective {
12715
- constructor() {
12716
- this.dragSorted = new EventEmitter();
12717
- }
12718
- drop(event) {
12719
- event.stopPropagation();
12720
- event.preventDefault();
12721
- }
12722
- setDragItem(item) {
12723
- this._dragItem = item;
12724
- }
12725
- getDragItem() {
12726
- return this._dragItem;
12727
- }
12728
- getList() {
12729
- return this.dragSortList;
12730
- }
12731
- setList(list) {
12732
- this.dragSortList = list;
12733
- }
12734
- updateSortOrder(source, target, insertBefore) {
12735
- if (source === target) {
12736
- return;
12737
- }
12738
- const list = this.getList();
12739
- const sourceIndex = list.indexOf(source);
12740
- const targetIndex = list.indexOf(target);
12741
- if ((insertBefore && sourceIndex + 1 === targetIndex) ||
12742
- (!insertBefore && sourceIndex === targetIndex + 1)) {
12743
- return;
12744
- }
12745
- const newIndex = list.indexOf(target) + (insertBefore ? 0 : 1);
12746
- this.dragSorted.emit({
12747
- list,
12748
- source,
12749
- target,
12750
- newIndex,
12751
- previousIndex: sourceIndex,
12752
- });
12753
- }
12754
- }
12755
- DragSortContainerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: DragSortContainerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
12756
- DragSortContainerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.1", type: DragSortContainerDirective, selector: "[tetaDragSortContainer]", inputs: { dragSortList: "dragSortList" }, outputs: { dragSorted: "dragSorted" }, host: { listeners: { "drop": "drop($event)" } }, queries: [{ propertyName: "items", predicate: DragSortItemDirective, descendants: true }], ngImport: i0 });
12757
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: DragSortContainerDirective, decorators: [{
12758
- type: Directive,
12759
- args: [{
12760
- selector: '[tetaDragSortContainer]',
12761
- }]
12762
- }], ctorParameters: function () { return []; }, propDecorators: { dragSortList: [{
12763
- type: Input
12764
- }], dragSorted: [{
12765
- type: Output
12766
- }], items: [{
12767
- type: ContentChildren,
12768
- args: [DragSortItemDirective, { descendants: true }]
12769
- }], drop: [{
12770
- type: HostListener,
12771
- args: ['drop', ['$event']]
12772
- }] } });
12773
-
12774
12764
  class DragSortModule {
12775
12765
  }
12776
12766
  DragSortModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: DragSortModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });