Commit 6250d3b3 authored by Igor Kulikov's avatar Igor Kulikov

take adjustCanvasSize fit value from input parameter

parent e2fbd083
(function (global, factory) { (function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('rxjs/operators'), require('@angular/common')) : typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('rxjs/operators'), require('@angular/cdk/coercion'), require('@angular/common')) :
typeof define === 'function' && define.amd ? define('ngx-flowchart', ['exports', '@angular/core', 'rxjs', 'rxjs/operators', '@angular/common'], factory) : typeof define === 'function' && define.amd ? define('ngx-flowchart', ['exports', '@angular/core', 'rxjs', 'rxjs/operators', '@angular/cdk/coercion', '@angular/common'], factory) :
(global = global || self, factory(global['ngx-flowchart'] = {}, global.ng.core, global.rxjs, global.rxjs.operators, global.ng.common)); (global = global || self, factory(global['ngx-flowchart'] = {}, global.ng.core, global.rxjs, global.rxjs.operators, global.ng.cdk.coercion, global.ng.common));
}(this, (function (exports, core, rxjs, operators, common) { 'use strict'; }(this, (function (exports, core, rxjs, operators, coercion, common) { 'use strict';
/*! ***************************************************************************** /*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved. Copyright (c) Microsoft Corporation. All rights reserved.
...@@ -3318,6 +3318,7 @@ ...@@ -3318,6 +3318,7 @@
this.cd = cd; this.cd = cd;
this.zone = zone; this.zone = zone;
this.modelChanged = new core.EventEmitter(); this.modelChanged = new core.EventEmitter();
this.fitModelSizeByDefaultValue = true;
this.flowchartConstants = FlowchartConstants; this.flowchartConstants = FlowchartConstants;
this.nodesDiffer = this.differs.find([]).create((/** this.nodesDiffer = this.differs.find([]).create((/**
* @param {?} index * @param {?} index
...@@ -3348,6 +3349,23 @@ ...@@ -3348,6 +3349,23 @@
enumerable: true, enumerable: true,
configurable: true configurable: true
}); });
Object.defineProperty(NgxFlowchartComponent.prototype, "fitModelSizeByDefault", {
get: /**
* @return {?}
*/
function () {
return this.fitModelSizeByDefaultValue;
},
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
this.fitModelSizeByDefaultValue = coercion.coerceBooleanProperty(value);
},
enumerable: true,
configurable: true
});
/** /**
* @return {?} * @return {?}
*/ */
...@@ -3419,7 +3437,7 @@ ...@@ -3419,7 +3437,7 @@
event.preventDefault(); event.preventDefault();
}) })
}; };
this.adjustCanvasSize(false); this.adjustCanvasSize(this.fitModelSizeByDefault);
}; };
/** /**
* @return {?} * @return {?}
...@@ -3466,7 +3484,7 @@ ...@@ -3466,7 +3484,7 @@
})); }));
} }
if (nodesChanged_1) { if (nodesChanged_1) {
this.adjustCanvasSize(false); this.adjustCanvasSize(this.fitModelSizeByDefault);
} }
if (nodesChanged_1 || edgesChanged_1) { if (nodesChanged_1 || edgesChanged_1) {
this.cd.detectChanges(); this.cd.detectChanges();
...@@ -3737,6 +3755,7 @@ ...@@ -3737,6 +3755,7 @@
nodeHeight: [{ type: core.Input }], nodeHeight: [{ type: core.Input }],
dropTargetId: [{ type: core.Input }], dropTargetId: [{ type: core.Input }],
modelChanged: [{ type: core.Output }], modelChanged: [{ type: core.Output }],
fitModelSizeByDefault: [{ type: core.Input }],
dragover: [{ type: core.HostListener, args: ['dragover', ['$event'],] }], dragover: [{ type: core.HostListener, args: ['dragover', ['$event'],] }],
drop: [{ type: core.HostListener, args: ['drop', ['$event'],] }], drop: [{ type: core.HostListener, args: ['drop', ['$event'],] }],
mousedown: [{ type: core.HostListener, args: ['mousedown', ['$event'],] }], mousedown: [{ type: core.HostListener, args: ['mousedown', ['$event'],] }],
...@@ -3766,6 +3785,11 @@ ...@@ -3766,6 +3785,11 @@
NgxFlowchartComponent.prototype.dropTargetId; NgxFlowchartComponent.prototype.dropTargetId;
/** @type {?} */ /** @type {?} */
NgxFlowchartComponent.prototype.modelChanged; NgxFlowchartComponent.prototype.modelChanged;
/**
* @type {?}
* @private
*/
NgxFlowchartComponent.prototype.fitModelSizeByDefaultValue;
/** @type {?} */ /** @type {?} */
NgxFlowchartComponent.prototype.callbacks; NgxFlowchartComponent.prototype.callbacks;
/** @type {?} */ /** @type {?} */
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
import { InjectionToken, Injectable, EventEmitter, Component, ChangeDetectionStrategy, ElementRef, IterableDiffers, ChangeDetectorRef, NgZone, HostBinding, Input, Output, HostListener, Directive, Inject, ComponentFactoryResolver, ViewChild, ViewContainerRef, NgModule } from '@angular/core'; import { InjectionToken, Injectable, EventEmitter, Component, ChangeDetectionStrategy, ElementRef, IterableDiffers, ChangeDetectorRef, NgZone, HostBinding, Input, Output, HostListener, Directive, Inject, ComponentFactoryResolver, ViewChild, ViewContainerRef, NgModule } from '@angular/core';
import { Subject, of } from 'rxjs'; import { Subject, of } from 'rxjs';
import { debounceTime } from 'rxjs/operators'; import { debounceTime } from 'rxjs/operators';
import { coerceBooleanProperty } from '@angular/cdk/coercion';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
/** /**
...@@ -2627,6 +2628,7 @@ class NgxFlowchartComponent { ...@@ -2627,6 +2628,7 @@ class NgxFlowchartComponent {
this.cd = cd; this.cd = cd;
this.zone = zone; this.zone = zone;
this.modelChanged = new EventEmitter(); this.modelChanged = new EventEmitter();
this.fitModelSizeByDefaultValue = true;
this.flowchartConstants = FlowchartConstants; this.flowchartConstants = FlowchartConstants;
this.nodesDiffer = this.differs.find([]).create((/** this.nodesDiffer = this.differs.find([]).create((/**
* @param {?} index * @param {?} index
...@@ -2653,6 +2655,19 @@ class NgxFlowchartComponent { ...@@ -2653,6 +2655,19 @@ class NgxFlowchartComponent {
get canvasClass() { get canvasClass() {
return FlowchartConstants.canvasClass; return FlowchartConstants.canvasClass;
} }
/**
* @return {?}
*/
get fitModelSizeByDefault() {
return this.fitModelSizeByDefaultValue;
}
/**
* @param {?} value
* @return {?}
*/
set fitModelSizeByDefault(value) {
this.fitModelSizeByDefaultValue = coerceBooleanProperty(value);
}
/** /**
* @return {?} * @return {?}
*/ */
...@@ -2709,7 +2724,7 @@ class NgxFlowchartComponent { ...@@ -2709,7 +2724,7 @@ class NgxFlowchartComponent {
event.preventDefault(); event.preventDefault();
}) })
}; };
this.adjustCanvasSize(false); this.adjustCanvasSize(this.fitModelSizeByDefault);
} }
/** /**
* @return {?} * @return {?}
...@@ -2753,7 +2768,7 @@ class NgxFlowchartComponent { ...@@ -2753,7 +2768,7 @@ class NgxFlowchartComponent {
})); }));
} }
if (nodesChanged) { if (nodesChanged) {
this.adjustCanvasSize(false); this.adjustCanvasSize(this.fitModelSizeByDefault);
} }
if (nodesChanged || edgesChanged) { if (nodesChanged || edgesChanged) {
this.cd.detectChanges(); this.cd.detectChanges();
...@@ -2952,6 +2967,7 @@ NgxFlowchartComponent.propDecorators = { ...@@ -2952,6 +2967,7 @@ NgxFlowchartComponent.propDecorators = {
nodeHeight: [{ type: Input }], nodeHeight: [{ type: Input }],
dropTargetId: [{ type: Input }], dropTargetId: [{ type: Input }],
modelChanged: [{ type: Output }], modelChanged: [{ type: Output }],
fitModelSizeByDefault: [{ type: Input }],
dragover: [{ type: HostListener, args: ['dragover', ['$event'],] }], dragover: [{ type: HostListener, args: ['dragover', ['$event'],] }],
drop: [{ type: HostListener, args: ['drop', ['$event'],] }], drop: [{ type: HostListener, args: ['drop', ['$event'],] }],
mousedown: [{ type: HostListener, args: ['mousedown', ['$event'],] }], mousedown: [{ type: HostListener, args: ['mousedown', ['$event'],] }],
...@@ -2979,6 +2995,11 @@ if (false) { ...@@ -2979,6 +2995,11 @@ if (false) {
NgxFlowchartComponent.prototype.dropTargetId; NgxFlowchartComponent.prototype.dropTargetId;
/** @type {?} */ /** @type {?} */
NgxFlowchartComponent.prototype.modelChanged; NgxFlowchartComponent.prototype.modelChanged;
/**
* @type {?}
* @private
*/
NgxFlowchartComponent.prototype.fitModelSizeByDefaultValue;
/** @type {?} */ /** @type {?} */
NgxFlowchartComponent.prototype.callbacks; NgxFlowchartComponent.prototype.callbacks;
/** @type {?} */ /** @type {?} */
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -2,6 +2,7 @@ import { __extends, __values, __assign } from 'tslib'; ...@@ -2,6 +2,7 @@ import { __extends, __values, __assign } from 'tslib';
import { InjectionToken, Injectable, EventEmitter, Component, ChangeDetectionStrategy, ElementRef, IterableDiffers, ChangeDetectorRef, NgZone, HostBinding, Input, Output, HostListener, Directive, Inject, ComponentFactoryResolver, ViewChild, ViewContainerRef, NgModule } from '@angular/core'; import { InjectionToken, Injectable, EventEmitter, Component, ChangeDetectionStrategy, ElementRef, IterableDiffers, ChangeDetectorRef, NgZone, HostBinding, Input, Output, HostListener, Directive, Inject, ComponentFactoryResolver, ViewChild, ViewContainerRef, NgModule } from '@angular/core';
import { Subject, of } from 'rxjs'; import { Subject, of } from 'rxjs';
import { debounceTime } from 'rxjs/operators'; import { debounceTime } from 'rxjs/operators';
import { coerceBooleanProperty } from '@angular/cdk/coercion';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
/** /**
...@@ -3121,6 +3122,7 @@ var NgxFlowchartComponent = /** @class */ (function () { ...@@ -3121,6 +3122,7 @@ var NgxFlowchartComponent = /** @class */ (function () {
this.cd = cd; this.cd = cd;
this.zone = zone; this.zone = zone;
this.modelChanged = new EventEmitter(); this.modelChanged = new EventEmitter();
this.fitModelSizeByDefaultValue = true;
this.flowchartConstants = FlowchartConstants; this.flowchartConstants = FlowchartConstants;
this.nodesDiffer = this.differs.find([]).create((/** this.nodesDiffer = this.differs.find([]).create((/**
* @param {?} index * @param {?} index
...@@ -3151,6 +3153,23 @@ var NgxFlowchartComponent = /** @class */ (function () { ...@@ -3151,6 +3153,23 @@ var NgxFlowchartComponent = /** @class */ (function () {
enumerable: true, enumerable: true,
configurable: true configurable: true
}); });
Object.defineProperty(NgxFlowchartComponent.prototype, "fitModelSizeByDefault", {
get: /**
* @return {?}
*/
function () {
return this.fitModelSizeByDefaultValue;
},
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
this.fitModelSizeByDefaultValue = coerceBooleanProperty(value);
},
enumerable: true,
configurable: true
});
/** /**
* @return {?} * @return {?}
*/ */
...@@ -3222,7 +3241,7 @@ var NgxFlowchartComponent = /** @class */ (function () { ...@@ -3222,7 +3241,7 @@ var NgxFlowchartComponent = /** @class */ (function () {
event.preventDefault(); event.preventDefault();
}) })
}; };
this.adjustCanvasSize(false); this.adjustCanvasSize(this.fitModelSizeByDefault);
}; };
/** /**
* @return {?} * @return {?}
...@@ -3269,7 +3288,7 @@ var NgxFlowchartComponent = /** @class */ (function () { ...@@ -3269,7 +3288,7 @@ var NgxFlowchartComponent = /** @class */ (function () {
})); }));
} }
if (nodesChanged_1) { if (nodesChanged_1) {
this.adjustCanvasSize(false); this.adjustCanvasSize(this.fitModelSizeByDefault);
} }
if (nodesChanged_1 || edgesChanged_1) { if (nodesChanged_1 || edgesChanged_1) {
this.cd.detectChanges(); this.cd.detectChanges();
...@@ -3540,6 +3559,7 @@ var NgxFlowchartComponent = /** @class */ (function () { ...@@ -3540,6 +3559,7 @@ var NgxFlowchartComponent = /** @class */ (function () {
nodeHeight: [{ type: Input }], nodeHeight: [{ type: Input }],
dropTargetId: [{ type: Input }], dropTargetId: [{ type: Input }],
modelChanged: [{ type: Output }], modelChanged: [{ type: Output }],
fitModelSizeByDefault: [{ type: Input }],
dragover: [{ type: HostListener, args: ['dragover', ['$event'],] }], dragover: [{ type: HostListener, args: ['dragover', ['$event'],] }],
drop: [{ type: HostListener, args: ['drop', ['$event'],] }], drop: [{ type: HostListener, args: ['drop', ['$event'],] }],
mousedown: [{ type: HostListener, args: ['mousedown', ['$event'],] }], mousedown: [{ type: HostListener, args: ['mousedown', ['$event'],] }],
...@@ -3569,6 +3589,11 @@ if (false) { ...@@ -3569,6 +3589,11 @@ if (false) {
NgxFlowchartComponent.prototype.dropTargetId; NgxFlowchartComponent.prototype.dropTargetId;
/** @type {?} */ /** @type {?} */
NgxFlowchartComponent.prototype.modelChanged; NgxFlowchartComponent.prototype.modelChanged;
/**
* @type {?}
* @private
*/
NgxFlowchartComponent.prototype.fitModelSizeByDefaultValue;
/** @type {?} */ /** @type {?} */
NgxFlowchartComponent.prototype.callbacks; NgxFlowchartComponent.prototype.callbacks;
/** @type {?} */ /** @type {?} */
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -25,6 +25,8 @@ export declare class NgxFlowchartComponent implements OnInit, DoCheck { ...@@ -25,6 +25,8 @@ export declare class NgxFlowchartComponent implements OnInit, DoCheck {
nodeHeight: number; nodeHeight: number;
dropTargetId: string; dropTargetId: string;
modelChanged: EventEmitter<any>; modelChanged: EventEmitter<any>;
private fitModelSizeByDefaultValue;
fitModelSizeByDefault: boolean;
callbacks: FcCallbacks; callbacks: FcCallbacks;
userNodeCallbacks: UserNodeCallbacks; userNodeCallbacks: UserNodeCallbacks;
modelService: FcModelService; modelService: FcModelService;
......
...@@ -19,6 +19,7 @@ import { FcEdgeDrawingService } from './edge-drawing.service'; ...@@ -19,6 +19,7 @@ import { FcEdgeDrawingService } from './edge-drawing.service';
import { FcEdgeDraggingService } from './edge-dragging.service'; import { FcEdgeDraggingService } from './edge-dragging.service';
import { FcMouseOverService } from './mouseover.service'; import { FcMouseOverService } from './mouseover.service';
import { FcRectangleSelectService } from './rectangleselect.service'; import { FcRectangleSelectService } from './rectangleselect.service';
import { coerceBooleanProperty } from '@angular/cdk/coercion';
@Component({ @Component({
selector: 'fc-canvas', selector: 'fc-canvas',
...@@ -63,6 +64,15 @@ export class NgxFlowchartComponent implements OnInit, DoCheck { ...@@ -63,6 +64,15 @@ export class NgxFlowchartComponent implements OnInit, DoCheck {
@Output() @Output()
modelChanged = new EventEmitter(); modelChanged = new EventEmitter();
private fitModelSizeByDefaultValue = true;
get fitModelSizeByDefault(): boolean {
return this.fitModelSizeByDefaultValue;
}
@Input()
set fitModelSizeByDefault(value: boolean) {
this.fitModelSizeByDefaultValue = coerceBooleanProperty(value);
}
callbacks: FcCallbacks; callbacks: FcCallbacks;
userNodeCallbacks: UserNodeCallbacks; userNodeCallbacks: UserNodeCallbacks;
...@@ -158,7 +168,7 @@ export class NgxFlowchartComponent implements OnInit, DoCheck { ...@@ -158,7 +168,7 @@ export class NgxFlowchartComponent implements OnInit, DoCheck {
event.preventDefault(); event.preventDefault();
} }
}; };
this.adjustCanvasSize(false); this.adjustCanvasSize(this.fitModelSizeByDefault);
} }
ngDoCheck(): void { ngDoCheck(): void {
...@@ -184,7 +194,7 @@ export class NgxFlowchartComponent implements OnInit, DoCheck { ...@@ -184,7 +194,7 @@ export class NgxFlowchartComponent implements OnInit, DoCheck {
}); });
} }
if (nodesChanged) { if (nodesChanged) {
this.adjustCanvasSize(false); this.adjustCanvasSize(this.fitModelSizeByDefault);
} }
if (nodesChanged || edgesChanged) { if (nodesChanged || edgesChanged) {
this.cd.detectChanges(); this.cd.detectChanges();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment