Skip to content

Commit

Permalink
fix: fix linkOptions merge error
Browse files Browse the repository at this point in the history
  • Loading branch information
HandsomeButterball committed Mar 14, 2022
1 parent c07b1f6 commit 911ecf9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
5 changes: 2 additions & 3 deletions example/src/app/gantt/gantt.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ import {
GanttItem,
GanttPrintService,
NgxGanttComponent,
GanttSelectedEvent,
GanttLinkLineType
GanttSelectedEvent
} from 'ngx-gantt';
import { of } from 'rxjs';
import { delay } from 'rxjs/operators';
import { delay, startWith } from 'rxjs/operators';
import { ThyNotifyService } from 'ngx-tethys/notify';
import { randomItems, random } from '../helper';

Expand Down
4 changes: 2 additions & 2 deletions packages/gantt/src/gantt-upper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ export abstract class GanttUpper {
@Input() viewOptions: GanttViewOptions = {};

@Input() set linkOptions(options: GanttLinkOptions) {
this._linkOptions = Object.assign(options, this.config.linkOptions);
this._linkOptions = options;
}

get linkOptions() {
return this._linkOptions;
return Object.assign({}, defaultConfig.linkOptions, this.config.linkOptions, this._linkOptions);
}

@Input() disabledLoadOnScroll: boolean;
Expand Down
4 changes: 1 addition & 3 deletions packages/gantt/src/gantt.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ import { coerceCssPixelValue } from '@angular/cdk/coercion';
import { NgxGanttTableComponent } from './table/gantt-table.component';
import { GANTT_ABSTRACT_TOKEN } from './gantt-abstract';
import { defaultColumnWidth } from './components/table/gantt-table.component';
import { defaultConfig, GanttGlobalConfig, GANTT_GLOBAL_CONFIG } from './gantt.config';
import { GanttLinkOptions } from './class/link';
import { GanttGlobalConfig, GANTT_GLOBAL_CONFIG } from './gantt.config';
@Component({
selector: 'ngx-gantt',
templateUrl: './gantt.component.html',
Expand Down Expand Up @@ -84,7 +83,6 @@ export class NgxGanttComponent extends GanttUpper implements OnInit, AfterViewIn

ngOnInit() {
super.onInit();
this.linkOptions = Object.assign({}, defaultConfig.linkOptions, this.config?.linkOptions, this.linkOptions);
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
this.dragContainer.linkDragStarted.pipe(takeUntil(this.ngUnsubscribe$)).subscribe((event: GanttLinkDragEvent) => {
this.linkDragStarted.emit(event);
Expand Down

0 comments on commit 911ecf9

Please sign in to comment.