119 lines
9.9 KiB
JavaScript
119 lines
9.9 KiB
JavaScript
|
import { Subject } from 'rxjs';
|
||
|
/**
|
||
|
* Dynamic Dialog instance.
|
||
|
* @group Components
|
||
|
*/
|
||
|
export class DynamicDialogRef {
|
||
|
constructor() { }
|
||
|
/**
|
||
|
* Closes dialog.
|
||
|
* @group Method
|
||
|
*/
|
||
|
close(result) {
|
||
|
this._onClose.next(result);
|
||
|
setTimeout(() => {
|
||
|
this._onClose.complete();
|
||
|
}, 1000);
|
||
|
}
|
||
|
/**
|
||
|
* Destroys the dialog instance.
|
||
|
* @group Method
|
||
|
*/
|
||
|
destroy() {
|
||
|
this._onDestroy.next(null);
|
||
|
}
|
||
|
/**
|
||
|
* Callback to invoke on drag start.
|
||
|
* @param {MouseEvent} event - Mouse event.
|
||
|
* @group Method
|
||
|
*/
|
||
|
dragStart(event) {
|
||
|
this._onDragStart.next(event);
|
||
|
}
|
||
|
/**
|
||
|
* Callback to invoke on drag end.
|
||
|
* @param {MouseEvent} event - Mouse event.
|
||
|
* @group Method
|
||
|
*/
|
||
|
dragEnd(event) {
|
||
|
this._onDragEnd.next(event);
|
||
|
}
|
||
|
/**
|
||
|
* Callback to invoke on resize start.
|
||
|
* @param {MouseEvent} event - Mouse event.
|
||
|
* @group Method
|
||
|
*/
|
||
|
resizeInit(event) {
|
||
|
this._onResizeInit.next(event);
|
||
|
}
|
||
|
/**
|
||
|
* Callback to invoke on resize start.
|
||
|
* @param {MouseEvent} event - Mouse event.
|
||
|
* @group Method
|
||
|
*/
|
||
|
resizeEnd(event) {
|
||
|
this._onResizeEnd.next(event);
|
||
|
}
|
||
|
/**
|
||
|
* Callback to invoke on dialog is maximized.
|
||
|
* @param {*} value - Size value.
|
||
|
* @group Method
|
||
|
*/
|
||
|
maximize(value) {
|
||
|
this._onMaximize.next(value);
|
||
|
}
|
||
|
_onClose = new Subject();
|
||
|
/**
|
||
|
* Event triggered on dialog is closed.
|
||
|
* @group Events
|
||
|
*/
|
||
|
onClose = this._onClose.asObservable();
|
||
|
_onDestroy = new Subject();
|
||
|
/**
|
||
|
* Event triggered on dialog instance is destroyed.
|
||
|
* @group Events
|
||
|
*/
|
||
|
onDestroy = this._onDestroy.asObservable();
|
||
|
_onDragStart = new Subject();
|
||
|
/**
|
||
|
* Event triggered on drag start.
|
||
|
* @param {MouseEvent} event - Mouse event.
|
||
|
* @group Events
|
||
|
*/
|
||
|
onDragStart = this._onDragStart.asObservable();
|
||
|
_onDragEnd = new Subject();
|
||
|
/**
|
||
|
* Event triggered on drag end.
|
||
|
* @param {MouseEvent} event - Mouse event.
|
||
|
* @group Events
|
||
|
*/
|
||
|
onDragEnd = this._onDragEnd.asObservable();
|
||
|
_onResizeInit = new Subject();
|
||
|
/**
|
||
|
* Event triggered on resize start.
|
||
|
* @param {MouseEvent} event - Mouse event.
|
||
|
* @group Events
|
||
|
*/
|
||
|
onResizeInit = this._onResizeInit.asObservable();
|
||
|
_onResizeEnd = new Subject();
|
||
|
/**
|
||
|
* Event triggered on resize end.
|
||
|
* @param {MouseEvent} event - Mouse event.
|
||
|
* @group Events
|
||
|
*/
|
||
|
onResizeEnd = this._onResizeEnd.asObservable();
|
||
|
_onMaximize = new Subject();
|
||
|
/**
|
||
|
* Event triggered on dialog is maximized.
|
||
|
* @param {*} value - Size value.
|
||
|
* @group Events
|
||
|
*/
|
||
|
onMaximize = this._onMaximize.asObservable();
|
||
|
/**
|
||
|
* Event triggered on child component load.
|
||
|
* @param {*} value - Chi.
|
||
|
* @group Events
|
||
|
*/
|
||
|
onChildComponentLoaded = new Subject();
|
||
|
}
|
||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZHluYW1pY2RpYWxvZy1yZWYuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvYXBwL2NvbXBvbmVudHMvZHluYW1pY2RpYWxvZy9keW5hbWljZGlhbG9nLXJlZi50cyJdLCJuYW1lcyI6W10s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ICAgICAgICB0aGlzLl9vbkRyYWdTdGFydC5uZXh0KGV2ZW50KTtcbiAgICB9XG4gICAgLyoqXG4gICAgICogQ2FsbGJhY2sgdG8gaW52b2tlIG9uIGRyYWcgZW5kLlxuICAgICAqIEBwYXJhbSB7TW91c2VFdmVudH0gZXZlbnQgLSBNb3VzZSBldmVudC5cbiAgICAgKiBAZ3JvdXAgTWV0aG9kXG4gICAgICovXG4gICAgZHJhZ0VuZChldmVudDogTW91c2VFdmVudCkge1xuICAgICAgICB0aGlzLl9vbkRyYWdFbmQubmV4dChldmVudCk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIENhbGxiYWNrIHRvIGludm9rZSBvbiByZXNpemUgc3RhcnQuXG4gICAgICogQHBhcmFtIHtNb3VzZUV2ZW50fSBldmVudCAtIE1vdXNlIGV2ZW50LlxuICAgICAqIEBncm91cCBNZXRob2RcbiAgICAgKi9cbiAgICByZXNpemVJbml0KGV2ZW50OiBNb3VzZUV2ZW50KSB7XG4gICAgICAgIHRoaXMuX29uUmVzaXplSW5pdC5uZXh0KGV2ZW50KTtcbiAgICB9XG4gICAgL
|