@ts-core/angular 13.1.23 → 13.1.24

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.
@@ -3454,6 +3454,15 @@ class WindowFactory {
3454
3454
  }
3455
3455
  }
3456
3456
 
3457
+ var WindowServiceEvent;
3458
+ (function (WindowServiceEvent) {
3459
+ WindowServiceEvent["OPEN_STARTED"] = "OPEN_STARTED";
3460
+ WindowServiceEvent["OPENED"] = "OPENED";
3461
+ WindowServiceEvent["OPEN_FINISHED"] = "OPEN_FINISHED";
3462
+ WindowServiceEvent["CLOSED"] = "CLOSED";
3463
+ WindowServiceEvent["SETTED_ON_TOP"] = "SETTED_ON_TOP";
3464
+ })(WindowServiceEvent || (WindowServiceEvent = {}));
3465
+
3457
3466
  class IWindowContent extends DestroyableContainer {
3458
3467
  // --------------------------------------------------------------------------
3459
3468
  //
@@ -3641,482 +3650,174 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
3641
3650
  args: [{ template: "<p class=\"text m-4 text-center mouse-inactive text-word-wrap-break-word\" [innerHTML]=\"text\"></p>\n\n<div class=\"text-center border-sm-top p-3\">\n\n <button (click)=\"data?.closeClickHandler()\" mat-stroked-button *ngIf=\"data?.isInfo\">\n <span [innerHTML]=\"data?.closeText\"></span>\n </button>\n\n <button class=\"mr-3 me-3\" (click)=\"data?.yesClickHandler()\" color=\"primary\" mat-stroked-button *ngIf=\"data?.isQuestion\">\n <span [innerHTML]=\"data?.yesText\"></span>\n </button>\n\n <button (click)=\"data?.notClickHandler()\" mat-stroked-button *ngIf=\"data?.isQuestion\">\n <span [innerHTML]=\"data?.notText\"></span>\n </button>\n\n</div>" }]
3642
3651
  }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i1$1.LanguageService }]; } });
3643
3652
 
3644
- class WindowElement extends DestroyableContainer {
3653
+ class WindowBase extends DestroyableContainer {
3645
3654
  // --------------------------------------------------------------------------
3646
3655
  //
3647
3656
  // Constructor
3648
3657
  //
3649
3658
  // --------------------------------------------------------------------------
3650
- constructor(element) {
3659
+ constructor() {
3651
3660
  super();
3652
- this.element = element;
3661
+ // --------------------------------------------------------------------------
3662
+ //
3663
+ // Properties
3664
+ //
3665
+ // --------------------------------------------------------------------------
3666
+ this._x = NaN;
3667
+ this._width = NaN;
3668
+ this._y = NaN;
3669
+ this._height = NaN;
3670
+ this.updatePosition = () => this.setPosition();
3653
3671
  }
3654
- // --------------------------------------------------------------------------
3655
- //
3656
- // Private Methods
3657
- //
3658
- // --------------------------------------------------------------------------
3659
- checkWindowParent() {
3660
- let container = this.getContainer();
3661
- if (!_.isNil(container)) {
3662
- ViewUtil.appendChild(container, this.element.nativeElement);
3672
+ setProperties() {
3673
+ let config = this.getConfig();
3674
+ if (!_.isNaN(config.defaultWidth)) {
3675
+ this.width = config.defaultWidth;
3676
+ }
3677
+ if (!_.isNaN(config.defaultHeight)) {
3678
+ this.height = config.defaultHeight;
3663
3679
  }
3664
3680
  }
3665
- getContainer() {
3666
- let item = ViewUtil.parseElement(this.element.nativeElement);
3667
- while (!_.isNil(item) && item.nodeName.toLowerCase() !== 'mat-dialog-container') {
3668
- item = item.parentElement;
3681
+ setPosition() {
3682
+ let config = this.getConfig();
3683
+ switch (config.horizontalAlign) {
3684
+ case WindowAlign.START:
3685
+ this.x = !_.isNaN(this.paddingLeft) ? this.paddingLeft : 0;
3686
+ break;
3687
+ case WindowAlign.END:
3688
+ let value = ViewUtil.getStageWidth() - this.calculateWidth();
3689
+ if (!_.isNaN(this.paddingRight)) {
3690
+ value -= this.paddingRight;
3691
+ }
3692
+ this.x = value;
3693
+ break;
3694
+ default:
3695
+ this.x = (ViewUtil.getStageWidth() - this.calculateWidth()) / 2;
3696
+ break;
3697
+ }
3698
+ switch (config.verticalAlign) {
3699
+ case WindowAlign.START:
3700
+ this.y = !_.isNaN(this.paddingTop) ? this.paddingTop : 0;
3701
+ break;
3702
+ case WindowAlign.END:
3703
+ let value = ViewUtil.getStageHeight() - this.calculateHeight();
3704
+ if (!_.isNaN(this.paddingBottom)) {
3705
+ value -= this.paddingBottom;
3706
+ }
3707
+ this.y = value;
3708
+ break;
3709
+ default:
3710
+ this.y = (ViewUtil.getStageHeight() - this.calculateHeight()) / 2;
3711
+ break;
3669
3712
  }
3670
- return item;
3671
3713
  }
3672
- createChildren() { }
3673
- destroyChildren() { }
3674
- commitWindowProperties() { }
3675
- // --------------------------------------------------------------------------
3676
- //
3677
- // Public Methods
3678
- //
3679
- // --------------------------------------------------------------------------
3680
- ngAfterViewInit() {
3681
- this.createChildren();
3682
- this.checkWindowParent();
3714
+ clearSize() {
3715
+ this._x = NaN;
3716
+ this._y = NaN;
3717
+ this._width = NaN;
3718
+ this._height = NaN;
3683
3719
  }
3684
- destroy() {
3685
- if (this.isDestroyed) {
3720
+ commitSizeProperties() {
3721
+ let width = !_.isNaN(this.width) ? this.width + 'px' : 'auto';
3722
+ let height = !_.isNaN(this.height) ? this.height + 'px' : 'auto';
3723
+ this.getReference().updateSize(width, height);
3724
+ }
3725
+ commitPositionProperties() {
3726
+ if (_.isNaN(this._x) && _.isNaN(this._y)) {
3686
3727
  return;
3687
3728
  }
3688
- super.destroy();
3689
- this.destroyChildren();
3690
- this.element = null;
3691
- this.window = null;
3729
+ let position = {};
3730
+ if (!_.isNaN(this._y)) {
3731
+ position.top = this._y + 'px';
3732
+ }
3733
+ if (!_.isNaN(this._x)) {
3734
+ position.left = this._x + 'px';
3735
+ }
3736
+ this.getReference().updatePosition(position);
3692
3737
  }
3693
3738
  // --------------------------------------------------------------------------
3694
3739
  //
3695
- // Event Handlers
3740
+ // Public Methods
3696
3741
  //
3697
3742
  // --------------------------------------------------------------------------
3698
- clickHandler(event) {
3699
- event.stopPropagation();
3743
+ calculateWidth() {
3744
+ return !_.isNaN(this.width) ? this.width : ViewUtil.getWidth(this.getContainer());
3700
3745
  }
3701
- // --------------------------------------------------------------------------
3702
- //
3703
- // Protected Properties
3704
- //
3705
- // --------------------------------------------------------------------------
3706
- get nativeElement() {
3707
- return this.element ? this.element.nativeElement : null;
3746
+ calculateHeight() {
3747
+ return !_.isNaN(this.height) ? this.height : ViewUtil.getHeight(this.getContainer());
3708
3748
  }
3709
3749
  // --------------------------------------------------------------------------
3710
3750
  //
3711
- // Public Properties
3751
+ // Private Properties
3712
3752
  //
3713
3753
  // --------------------------------------------------------------------------
3714
- get window() {
3715
- return this._window;
3754
+ get width() {
3755
+ return this._width;
3716
3756
  }
3717
- set window(value) {
3718
- if (value === this._window) {
3757
+ set width(value) {
3758
+ value = this.getConfig().parseWidth(value);
3759
+ if (value === this._width) {
3719
3760
  return;
3720
3761
  }
3721
- this._window = value;
3722
- if (this.window) {
3723
- this.commitWindowProperties();
3762
+ this._width = value;
3763
+ this.commitSizeProperties();
3764
+ }
3765
+ get height() {
3766
+ return this._height;
3767
+ }
3768
+ set height(value) {
3769
+ value = this.getConfig().parseHeight(value);
3770
+ if (value === this._height) {
3771
+ return;
3724
3772
  }
3773
+ this._height = value;
3774
+ this.commitSizeProperties();
3725
3775
  }
3726
- }
3727
- WindowElement.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowElement, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
3728
- WindowElement.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: WindowElement, selector: "ng-component", usesInheritance: true, ngImport: i0, template: '', isInline: true });
3729
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowElement, decorators: [{
3730
- type: Component,
3731
- args: [{ template: '' }]
3732
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
3733
-
3734
- class WindowCloseElementComponent extends WindowElement {
3735
3776
  // --------------------------------------------------------------------------
3736
3777
  //
3737
- // Constructor
3778
+ // Public Properties
3738
3779
  //
3739
3780
  // --------------------------------------------------------------------------
3740
- constructor(element) {
3741
- super(element);
3781
+ get x() {
3782
+ return this._x;
3742
3783
  }
3743
- // --------------------------------------------------------------------------
3744
- //
3745
- // Private Methods
3746
- //
3747
- // --------------------------------------------------------------------------
3748
- createChildren() {
3749
- super.createChildren();
3750
- if (!_.isNil(WindowCloseElementComponent.ICON_VALUE)) {
3751
- ViewUtil.setProperty(this.nativeElement, 'innerHTML', WindowCloseElementComponent.ICON_VALUE);
3752
- }
3753
- if (!_.isNil(WindowCloseElementComponent.ICON_CLASS)) {
3754
- ViewUtil.addClasses(this.nativeElement, WindowCloseElementComponent.ICON_CLASS);
3784
+ set x(value) {
3785
+ value = this.getConfig().parseX(value);
3786
+ if (value === this._x) {
3787
+ return;
3755
3788
  }
3756
- ViewUtil.addClass(this.nativeElement, 'mouse-active');
3789
+ this._x = value;
3790
+ this.commitPositionProperties();
3757
3791
  }
3758
- // --------------------------------------------------------------------------
3759
- //
3760
- // Event Handlers
3761
- //
3762
- // --------------------------------------------------------------------------
3763
- clickHandler(event) {
3764
- super.clickHandler(event);
3765
- if (!_.isNil(this.window)) {
3766
- this.window.close();
3792
+ get y() {
3793
+ return this._y;
3794
+ }
3795
+ set y(value) {
3796
+ value = this.getConfig().parseY(value);
3797
+ if (value === this._y) {
3798
+ return;
3767
3799
  }
3800
+ this._y = value;
3801
+ this.commitPositionProperties();
3802
+ }
3803
+ get paddingTop() {
3804
+ return this.getConfig().paddingTop;
3805
+ }
3806
+ get paddingLeft() {
3807
+ return this.getConfig().paddingLeft;
3808
+ }
3809
+ get paddingRight() {
3810
+ return this.getConfig().paddingRight;
3811
+ }
3812
+ get paddingBottom() {
3813
+ return this.getConfig().paddingBottom;
3768
3814
  }
3769
3815
  }
3770
- // --------------------------------------------------------------------------
3771
- //
3772
- // Constants
3773
- //
3774
- // --------------------------------------------------------------------------
3775
- WindowCloseElementComponent.ICON_CLASS = 'fas fa-times';
3776
- WindowCloseElementComponent.ICON_VALUE = null;
3777
- WindowCloseElementComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowCloseElementComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
3778
- WindowCloseElementComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: WindowCloseElementComponent, selector: "vi-window-close-element", usesInheritance: true, ngImport: i0, template: '', isInline: true, styles: [":host{display:block;position:absolute;color:#fff;background-color:#0006;border-radius:50%;padding:8px;font-size:14px;font-weight:700;text-align:center}:host:hover{background-color:#0009}:host.small{font-size:10px;padding:4px}\n"] });
3779
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowCloseElementComponent, decorators: [{
3780
- type: Component,
3781
- args: [{ selector: 'vi-window-close-element', template: '', styles: [":host{display:block;position:absolute;color:#fff;background-color:#0006;border-radius:50%;padding:8px;font-size:14px;font-weight:700;text-align:center}:host:hover{background-color:#0009}:host.small{font-size:10px;padding:4px}\n"] }]
3782
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
3783
3816
 
3784
- class WindowExpandElementComponent extends WindowElement {
3785
- // --------------------------------------------------------------------------
3786
- //
3787
- // Constructor
3788
- //
3789
- // --------------------------------------------------------------------------
3790
- constructor(element) {
3791
- super(element);
3792
- }
3817
+ class WindowImpl extends WindowBase {
3793
3818
  // --------------------------------------------------------------------------
3794
3819
  //
3795
- // Private Methods
3796
- //
3797
- // --------------------------------------------------------------------------
3798
- createChildren() {
3799
- super.createChildren();
3800
- if (!_.isNil(WindowExpandElementComponent.ICON_VALUE)) {
3801
- ViewUtil.setProperty(this.nativeElement, 'innerHTML', WindowExpandElementComponent.ICON_VALUE);
3802
- }
3803
- if (!_.isNil(WindowExpandElementComponent.ICON_CLASS)) {
3804
- ViewUtil.addClasses(this.nativeElement, WindowExpandElementComponent.ICON_CLASS);
3805
- }
3806
- ViewUtil.addClass(this.nativeElement, 'mouse-active');
3807
- }
3808
- // --------------------------------------------------------------------------
3809
- //
3810
- // Event Handlers
3811
- //
3812
- // --------------------------------------------------------------------------
3813
- clickHandler(event) {
3814
- super.clickHandler(event);
3815
- if (!_.isNil(this.window)) {
3816
- this.window.emit(WindowEvent.EXPAND);
3817
- }
3818
- }
3819
- }
3820
- // --------------------------------------------------------------------------
3821
- //
3822
- // Constants
3823
- //
3824
- // --------------------------------------------------------------------------
3825
- WindowExpandElementComponent.ICON_CLASS = 'fas fa-angle-double-up';
3826
- WindowExpandElementComponent.ICON_VALUE = null;
3827
- WindowExpandElementComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowExpandElementComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
3828
- WindowExpandElementComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: WindowExpandElementComponent, selector: "vi-window-expand-element", usesInheritance: true, ngImport: i0, template: '', isInline: true, styles: [":host{display:block;position:absolute;color:#fff;background-color:#0006;border-radius:50%;padding:8px;font-size:14px;font-weight:700;text-align:center}:host:hover{background-color:#0009}:host.small{font-size:10px;padding:4px}\n"] });
3829
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowExpandElementComponent, decorators: [{
3830
- type: Component,
3831
- args: [{ selector: 'vi-window-expand-element', template: '', styles: [":host{display:block;position:absolute;color:#fff;background-color:#0006;border-radius:50%;padding:8px;font-size:14px;font-weight:700;text-align:center}:host:hover{background-color:#0009}:host.small{font-size:10px;padding:4px}\n"] }]
3832
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
3833
-
3834
- class WindowResizeElementComponent extends WindowElement {
3835
- // --------------------------------------------------------------------------
3836
- //
3837
- // Constructor
3838
- //
3839
- // --------------------------------------------------------------------------
3840
- constructor(element) {
3841
- super(element);
3842
- }
3843
- // --------------------------------------------------------------------------
3844
- //
3845
- // Private Methods
3846
- //
3847
- // --------------------------------------------------------------------------
3848
- createChildren() {
3849
- super.createChildren();
3850
- if (!_.isNil(WindowResizeElementComponent.ICON_VALUE)) {
3851
- ViewUtil.setProperty(this.nativeElement, 'innerHTML', WindowResizeElementComponent.ICON_VALUE);
3852
- }
3853
- if (!_.isNil(WindowResizeElementComponent.ICON_CLASS)) {
3854
- ViewUtil.addClasses(this.nativeElement, WindowResizeElementComponent.ICON_CLASS);
3855
- }
3856
- ViewUtil.setStyle(this.nativeElement, 'cursor', 'pointer');
3857
- }
3858
- // --------------------------------------------------------------------------
3859
- //
3860
- // Event Handlers
3861
- //
3862
- // --------------------------------------------------------------------------
3863
- clickHandler(event) {
3864
- super.clickHandler(event);
3865
- if (!_.isNil(this.window)) {
3866
- this.window.emit(WindowEvent.EXPAND);
3867
- }
3868
- }
3869
- }
3870
- // --------------------------------------------------------------------------
3871
- //
3872
- // Constants
3873
- //
3874
- // --------------------------------------------------------------------------
3875
- WindowResizeElementComponent.ICON_CLASS = 'fas fa-arrows-alt';
3876
- WindowResizeElementComponent.ICON_VALUE = null;
3877
- WindowResizeElementComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowResizeElementComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
3878
- WindowResizeElementComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: WindowResizeElementComponent, selector: "vi-window-resize-element", usesInheritance: true, ngImport: i0, template: '', isInline: true, styles: [":host{display:block;position:absolute;color:#fff;background-color:#0006;border-radius:50%;padding:8px;font-size:14px;font-weight:700;text-align:center}:host:hover{background-color:#0009}:host.small{font-size:10px;padding:4px}\n"] });
3879
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowResizeElementComponent, decorators: [{
3880
- type: Component,
3881
- args: [{ selector: 'vi-window-resize-element', template: '', styles: [":host{display:block;position:absolute;color:#fff;background-color:#0006;border-radius:50%;padding:8px;font-size:14px;font-weight:700;text-align:center}:host:hover{background-color:#0009}:host.small{font-size:10px;padding:4px}\n"] }]
3882
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
3883
-
3884
- class WindowMinimizeElementComponent extends WindowElement {
3885
- // --------------------------------------------------------------------------
3886
- //
3887
- // Constructor
3888
- //
3889
- // --------------------------------------------------------------------------
3890
- constructor(element) {
3891
- super(element);
3892
- // --------------------------------------------------------------------------
3893
- //
3894
- // Private Methods
3895
- //
3896
- // --------------------------------------------------------------------------
3897
- this.commitIconProperties = () => {
3898
- let icon = this.window.isMinimized ? WindowMinimizeElementComponent.ICON_MAXIMIZE_VALUE : WindowMinimizeElementComponent.ICON_MINIMIZE_VALUE;
3899
- ViewUtil.setProperty(this.nativeElement, 'innerHTML', icon);
3900
- };
3901
- }
3902
- // --------------------------------------------------------------------------
3903
- //
3904
- // Protected Methods
3905
- //
3906
- // --------------------------------------------------------------------------
3907
- commitWindowProperties() {
3908
- super.commitWindowProperties();
3909
- this.window.events.pipe(takeUntil(this.destroyed)).subscribe(event => {
3910
- if (event === WindowEvent.MINIMIZED_CHANGED) {
3911
- this.commitIconProperties();
3912
- }
3913
- });
3914
- }
3915
- createChildren() {
3916
- super.createChildren();
3917
- if (!_.isNil(WindowMinimizeElementComponent.ICON_MINIMIZE_VALUE)) {
3918
- ViewUtil.setProperty(this.nativeElement, 'innerHTML', WindowMinimizeElementComponent.ICON_MINIMIZE_VALUE);
3919
- }
3920
- if (!_.isNil(WindowMinimizeElementComponent.ICON_CLASS)) {
3921
- ViewUtil.addClasses(this.nativeElement, WindowMinimizeElementComponent.ICON_CLASS);
3922
- }
3923
- ViewUtil.addClass(this.nativeElement, 'mouse-active');
3924
- }
3925
- // --------------------------------------------------------------------------
3926
- //
3927
- // Event Handlers
3928
- //
3929
- // --------------------------------------------------------------------------
3930
- clickHandler(event) {
3931
- super.clickHandler(event);
3932
- if (!_.isNil(this.window)) {
3933
- this.window.isMinimized = !this.window.isMinimized;
3934
- }
3935
- }
3936
- }
3937
- // --------------------------------------------------------------------------
3938
- //
3939
- // Constants
3940
- //
3941
- // --------------------------------------------------------------------------
3942
- WindowMinimizeElementComponent.ICON_CLASS = null;
3943
- WindowMinimizeElementComponent.ICON_MINIMIZE_VALUE = null;
3944
- WindowMinimizeElementComponent.ICON_MAXIMIZE_VALUE = null;
3945
- WindowMinimizeElementComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowMinimizeElementComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
3946
- WindowMinimizeElementComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: WindowMinimizeElementComponent, selector: "vi-window-minimize-element", usesInheritance: true, ngImport: i0, template: '', isInline: true, styles: [":host{display:block;position:absolute;color:#fff;background-color:#0006;border-radius:50%;padding:8px;font-size:14px;font-weight:700;text-align:center}:host:hover{background-color:#0009}:host.small{font-size:10px;padding:4px}\n"] });
3947
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowMinimizeElementComponent, decorators: [{
3948
- type: Component,
3949
- args: [{ selector: 'vi-window-minimize-element', template: '', styles: [":host{display:block;position:absolute;color:#fff;background-color:#0006;border-radius:50%;padding:8px;font-size:14px;font-weight:700;text-align:center}:host:hover{background-color:#0009}:host.small{font-size:10px;padding:4px}\n"] }]
3950
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
3951
-
3952
- class WindowBase extends DestroyableContainer {
3953
- // --------------------------------------------------------------------------
3954
- //
3955
- // Constructor
3956
- //
3957
- // --------------------------------------------------------------------------
3958
- constructor() {
3959
- super();
3960
- // --------------------------------------------------------------------------
3961
- //
3962
- // Properties
3963
- //
3964
- // --------------------------------------------------------------------------
3965
- this._x = NaN;
3966
- this._width = NaN;
3967
- this._y = NaN;
3968
- this._height = NaN;
3969
- this.updatePosition = () => this.setPosition();
3970
- }
3971
- setProperties() {
3972
- let config = this.getConfig();
3973
- if (!_.isNaN(config.defaultWidth)) {
3974
- this.width = config.defaultWidth;
3975
- }
3976
- if (!_.isNaN(config.defaultHeight)) {
3977
- this.height = config.defaultHeight;
3978
- }
3979
- }
3980
- setPosition() {
3981
- let config = this.getConfig();
3982
- switch (config.horizontalAlign) {
3983
- case WindowAlign.START:
3984
- this.x = !_.isNaN(this.paddingLeft) ? this.paddingLeft : 0;
3985
- break;
3986
- case WindowAlign.END:
3987
- let value = ViewUtil.getStageWidth() - this.calculateWidth();
3988
- if (!_.isNaN(this.paddingRight)) {
3989
- value -= this.paddingRight;
3990
- }
3991
- this.x = value;
3992
- break;
3993
- default:
3994
- this.x = (ViewUtil.getStageWidth() - this.calculateWidth()) / 2;
3995
- break;
3996
- }
3997
- switch (config.verticalAlign) {
3998
- case WindowAlign.START:
3999
- this.y = !_.isNaN(this.paddingTop) ? this.paddingTop : 0;
4000
- break;
4001
- case WindowAlign.END:
4002
- let value = ViewUtil.getStageHeight() - this.calculateHeight();
4003
- if (!_.isNaN(this.paddingBottom)) {
4004
- value -= this.paddingBottom;
4005
- }
4006
- this.y = value;
4007
- break;
4008
- default:
4009
- this.y = (ViewUtil.getStageHeight() - this.calculateHeight()) / 2;
4010
- break;
4011
- }
4012
- }
4013
- clearSize() {
4014
- this._x = NaN;
4015
- this._y = NaN;
4016
- this._width = NaN;
4017
- this._height = NaN;
4018
- }
4019
- commitSizeProperties() {
4020
- let width = !_.isNaN(this.width) ? this.width + 'px' : 'auto';
4021
- let height = !_.isNaN(this.height) ? this.height + 'px' : 'auto';
4022
- this.getReference().updateSize(width, height);
4023
- }
4024
- commitPositionProperties() {
4025
- if (_.isNaN(this._x) && _.isNaN(this._y)) {
4026
- return;
4027
- }
4028
- let position = {};
4029
- if (!_.isNaN(this._y)) {
4030
- position.top = this._y + 'px';
4031
- }
4032
- if (!_.isNaN(this._x)) {
4033
- position.left = this._x + 'px';
4034
- }
4035
- this.getReference().updatePosition(position);
4036
- }
4037
- // --------------------------------------------------------------------------
4038
- //
4039
- // Public Methods
4040
- //
4041
- // --------------------------------------------------------------------------
4042
- calculateWidth() {
4043
- return !_.isNaN(this.width) ? this.width : ViewUtil.getWidth(this.getContainer());
4044
- }
4045
- calculateHeight() {
4046
- return !_.isNaN(this.height) ? this.height : ViewUtil.getHeight(this.getContainer());
4047
- }
4048
- // --------------------------------------------------------------------------
4049
- //
4050
- // Private Properties
4051
- //
4052
- // --------------------------------------------------------------------------
4053
- get width() {
4054
- return this._width;
4055
- }
4056
- set width(value) {
4057
- value = this.getConfig().parseWidth(value);
4058
- if (value === this._width) {
4059
- return;
4060
- }
4061
- this._width = value;
4062
- this.commitSizeProperties();
4063
- }
4064
- get height() {
4065
- return this._height;
4066
- }
4067
- set height(value) {
4068
- value = this.getConfig().parseHeight(value);
4069
- if (value === this._height) {
4070
- return;
4071
- }
4072
- this._height = value;
4073
- this.commitSizeProperties();
4074
- }
4075
- // --------------------------------------------------------------------------
4076
- //
4077
- // Public Properties
4078
- //
4079
- // --------------------------------------------------------------------------
4080
- get x() {
4081
- return this._x;
4082
- }
4083
- set x(value) {
4084
- value = this.getConfig().parseX(value);
4085
- if (value === this._x) {
4086
- return;
4087
- }
4088
- this._x = value;
4089
- this.commitPositionProperties();
4090
- }
4091
- get y() {
4092
- return this._y;
4093
- }
4094
- set y(value) {
4095
- value = this.getConfig().parseY(value);
4096
- if (value === this._y) {
4097
- return;
4098
- }
4099
- this._y = value;
4100
- this.commitPositionProperties();
4101
- }
4102
- get paddingTop() {
4103
- return this.getConfig().paddingTop;
4104
- }
4105
- get paddingLeft() {
4106
- return this.getConfig().paddingLeft;
4107
- }
4108
- get paddingRight() {
4109
- return this.getConfig().paddingRight;
4110
- }
4111
- get paddingBottom() {
4112
- return this.getConfig().paddingBottom;
4113
- }
4114
- }
4115
-
4116
- class WindowImpl extends WindowBase {
4117
- // --------------------------------------------------------------------------
4118
- //
4119
- // Constructor
3820
+ // Constructor
4120
3821
  //
4121
3822
  // --------------------------------------------------------------------------
4122
3823
  constructor(properties) {
@@ -4468,516 +4169,446 @@ WindowImpl.BLINK_DELAY = 500;
4468
4169
  WindowImpl.SHAKE_DELAY = 500;
4469
4170
  WindowImpl.RESIZE_DELAY = 200;
4470
4171
 
4471
- class WindowResizeable extends WindowImpl {
4172
+ class BottomSheetImpl extends DestroyableContainer {
4472
4173
  // --------------------------------------------------------------------------
4473
4174
  //
4474
- // Protected Methods
4175
+ // Constructor
4475
4176
  //
4476
4177
  // --------------------------------------------------------------------------
4477
- setProperties() {
4478
- super.setProperties();
4479
- if (!this.config.isResizeable) {
4480
- return;
4481
- }
4482
- ViewUtil.addClass(this.container, 'vi-resizeable');
4483
- if (_.isNil(this.resizeMoveHandlerProxy)) {
4484
- this.resizeMoveHandlerProxy = this.resizeMoveHandler.bind(this);
4485
- }
4486
- let edges = {};
4487
- edges.top = true;
4488
- edges.left = true;
4489
- edges.right = true;
4490
- edges.bottom = true;
4491
- let param = {};
4492
- param.edges = edges;
4493
- this.interactable.resizable(param);
4494
- this.interactable.on('resizemove', this.resizeMoveHandlerProxy);
4178
+ constructor(properties) {
4179
+ super();
4180
+ // --------------------------------------------------------------------------
4181
+ //
4182
+ // Properties
4183
+ //
4184
+ // --------------------------------------------------------------------------
4185
+ this._isBlink = false;
4186
+ this._isDisabled = false;
4187
+ // --------------------------------------------------------------------------
4188
+ //
4189
+ // Protected Methods
4190
+ //
4191
+ // --------------------------------------------------------------------------
4192
+ this.setClosed = () => {
4193
+ this.emit(WindowEvent.CLOSED);
4194
+ this.destroy();
4195
+ };
4196
+ this.setOpened = () => {
4197
+ this.emit(WindowEvent.OPENED);
4198
+ };
4199
+ this.blinkToggle = () => {
4200
+ this.isBlink = !this.isBlink;
4201
+ };
4202
+ this.mouseDownHandlerProxy = (event) => {
4203
+ this.mouseDownHandler(event);
4204
+ };
4205
+ this.mouseClickHandlerProxy = (event) => {
4206
+ this.mouseClickHandler(event);
4207
+ };
4208
+ this.observer = new Subject();
4209
+ this.properties = properties;
4210
+ this.content.window = this;
4211
+ // Have to save for unsubscribe on destroy
4212
+ this._wrapper = this.properties.overlay.hostElement;
4213
+ this._backdrop = this.properties.overlay.backdropElement;
4214
+ this._container = this.properties.overlay.overlayElement;
4215
+ this.setProperties();
4216
+ this.elementsCreate();
4217
+ this.getReference().afterOpened().pipe(takeUntil(this.destroyed)).subscribe(this.setOpened);
4218
+ this.getReference().afterDismissed().pipe(takeUntil(this.destroyed)).subscribe(this.setClosed);
4495
4219
  }
4496
4220
  // --------------------------------------------------------------------------
4497
4221
  //
4498
- // Event Handlers
4222
+ // Elements Methods
4499
4223
  //
4500
4224
  // --------------------------------------------------------------------------
4501
- resizeMoveHandler(event) {
4502
- if (this.isMinimized) {
4503
- return;
4225
+ elementsCreate() {
4226
+ this.elements = new Array();
4227
+ }
4228
+ elementsDestroy() {
4229
+ this.elements.forEach(item => this.elementDestroy(item));
4230
+ this.elements = null;
4231
+ }
4232
+ elementAdd(item) {
4233
+ this.elements.push(item);
4234
+ item.instance.window = this;
4235
+ return item;
4236
+ }
4237
+ elementRemove(item) {
4238
+ ArrayUtil.remove(this.elements, item);
4239
+ this.elementDestroy(item);
4240
+ return item;
4241
+ }
4242
+ elementDestroy(item) {
4243
+ item.instance.window = null;
4244
+ item.destroy();
4245
+ return item;
4246
+ }
4247
+ setProperties() {
4248
+ ViewUtil.addClass(this.container, 'vi-bottom-sheet');
4249
+ ViewUtil.toggleClass(this.container, 'vi-modal', this.config.isModal);
4250
+ this.container.addEventListener('click', this.mouseClickHandlerProxy, true);
4251
+ this.container.addEventListener('mousedown', this.mouseDownHandlerProxy);
4252
+ /*
4253
+ if (!this.config.isModal) {
4254
+ this.container.addEventListener('mousedown', this.mouseDownHandlerProxy);
4504
4255
  }
4505
- let isChanged = event.dx !== 0 || event.dy !== 0;
4506
- if (!isChanged) {
4507
- return;
4256
+ */
4257
+ }
4258
+ commitIsBlinkProperties() { }
4259
+ commitIsDisabledProperties() { }
4260
+ getConfig() {
4261
+ return this.properties.config;
4262
+ }
4263
+ getContainer() {
4264
+ return this.container;
4265
+ }
4266
+ getReference() {
4267
+ return this.properties.reference;
4268
+ }
4269
+ isNeedClickStopPropagation(event) {
4270
+ let element = _.find(this.elements, item => item.location.nativeElement === event.target);
4271
+ if (_.isNil(element)) {
4272
+ return false;
4508
4273
  }
4509
- if (event.dx !== 0) {
4510
- let width = this.getWidth();
4511
- if (_.isNaN(width)) {
4512
- width = this.calculateWidth();
4513
- }
4514
- this.setWidth(width + event.dx, false);
4274
+ element.instance.clickHandler(event);
4275
+ return true;
4276
+ }
4277
+ stopBlinkIfNeed() {
4278
+ this.isBlink = false;
4279
+ if (!this.blinkTimer) {
4280
+ return;
4515
4281
  }
4516
- if (event.dy !== 0) {
4517
- let height = this.getHeight();
4518
- if (_.isNaN(height)) {
4519
- height = this.calculateHeight();
4520
- }
4521
- this.setHeight(height + event.dy, false);
4282
+ clearInterval(this.blinkTimer);
4283
+ this.blinkTimer = null;
4284
+ }
4285
+ // --------------------------------------------------------------------------
4286
+ //
4287
+ // Event Handlers
4288
+ //
4289
+ // --------------------------------------------------------------------------
4290
+ mouseDownHandler(event) {
4291
+ this.setOnTop();
4292
+ }
4293
+ mouseClickHandler(event) {
4294
+ if (this.isNeedClickStopPropagation(event)) {
4295
+ event.stopPropagation();
4522
4296
  }
4523
- this.resizeHandler();
4524
4297
  }
4525
4298
  // --------------------------------------------------------------------------
4526
4299
  //
4527
- // Public Properties
4300
+ // Public Methods
4528
4301
  //
4529
4302
  // --------------------------------------------------------------------------
4303
+ emit(event) {
4304
+ this.observer.next(event);
4305
+ }
4306
+ close() {
4307
+ this.getReference().dismiss();
4308
+ }
4530
4309
  destroy() {
4531
4310
  if (this.isDestroyed) {
4532
4311
  return;
4533
4312
  }
4534
4313
  super.destroy();
4535
- this.resizeMoveHandlerProxy = null;
4536
- if (!_.isNil(this._interactable)) {
4537
- this._interactable.unset();
4538
- this._interactable = null;
4314
+ this.elementsDestroy();
4315
+ this._container.removeEventListener('click', this.mouseClickHandlerProxy, true);
4316
+ this._container.removeEventListener('mousedown', this.mouseDownHandlerProxy);
4317
+ if (!_.isNil(this.content)) {
4318
+ this.content.destroy();
4539
4319
  }
4540
- }
4541
- // --------------------------------------------------------------------------
4542
- //
4543
- // Private Properties
4544
- //
4545
- // --------------------------------------------------------------------------
4546
- get interactable() {
4547
- if (_.isNil(this._interactable)) {
4548
- this._interactable = interact.default(this.container);
4549
- // this._interactable.styleCursor(false);
4320
+ if (!_.isNil(this.observer)) {
4321
+ this.observer.complete();
4322
+ this.observer = null;
4550
4323
  }
4551
- return this._interactable;
4324
+ this.properties = null;
4325
+ this._wrapper = null;
4326
+ this._backdrop = null;
4327
+ this._container = null;
4328
+ clearInterval(this.blinkTimer);
4329
+ this.blinkTimer = null;
4552
4330
  }
4553
- }
4554
-
4555
- class WindowDragable extends WindowResizeable {
4556
- constructor() {
4557
- // --------------------------------------------------------------------------
4558
- //
4559
- // Properties Methods
4560
- //
4561
- // --------------------------------------------------------------------------
4562
- super(...arguments);
4563
- this.isWasDragged = false;
4331
+ blink() {
4332
+ clearInterval(this.blinkTimer);
4333
+ this.blinkTimer = setInterval(this.blinkToggle, WindowImpl.BLINK_DELAY);
4564
4334
  }
4335
+ shake() { }
4336
+ setOnTop() { }
4565
4337
  // --------------------------------------------------------------------------
4566
4338
  //
4567
- // Protected Methods
4339
+ // Size Methods
4568
4340
  //
4569
4341
  // --------------------------------------------------------------------------
4570
- setProperties() {
4571
- super.setProperties();
4572
- if (this.config.isModal) {
4573
- return;
4574
- }
4575
- ViewUtil.addClass(this.container, 'vi-draggable');
4576
- if (!this.config.isContentDragable) {
4577
- return;
4578
- }
4579
- this.dragMoveHandlerProxy = this.dragMoveHandler.bind(this);
4580
- this.dragStartHandlerProxy = this.dragStartHandler.bind(this);
4581
- let param = {};
4582
- // let param = {} as any;
4583
- this.interactable.draggable(param);
4584
- this.interactable.on('dragmove', this.dragMoveHandlerProxy);
4585
- this.interactable.on('dragstart', this.dragStartHandlerProxy);
4342
+ getWidth() {
4343
+ return NaN;
4586
4344
  }
4587
- isNeedClickStopPropagation(event) {
4588
- return this.isWasDragged || super.isNeedClickStopPropagation(event);
4345
+ getHeight() {
4346
+ return NaN;
4589
4347
  }
4348
+ setWidth(value, isNeedNotify = true) { }
4349
+ setHeight(value, isNeedNotify = true) { }
4350
+ setSize(width, height) { }
4590
4351
  // --------------------------------------------------------------------------
4591
4352
  //
4592
- // Event Handlers
4353
+ // Move Methods
4593
4354
  //
4594
4355
  // --------------------------------------------------------------------------
4595
- dragStartHandler(event) {
4596
- this.isWasDragged = true;
4597
- }
4598
- dragMoveHandler(event) {
4599
- let x = this.getX() + event.dx;
4600
- let y = this.getY() + event.dy;
4601
- this.move(x, y);
4356
+ getX() {
4357
+ return NaN;
4602
4358
  }
4603
- mouseClickHandler(event) {
4604
- super.mouseClickHandler(event);
4605
- this.isWasDragged = false;
4359
+ setX(value, isNeedNotify = true) { }
4360
+ getY() {
4361
+ return NaN;
4606
4362
  }
4363
+ setY(value, isNeedNotify = true) { }
4364
+ move(x, y) { }
4607
4365
  // --------------------------------------------------------------------------
4608
4366
  //
4609
- // Public Methods
4367
+ // Private Properties
4610
4368
  //
4611
4369
  // --------------------------------------------------------------------------
4612
- destroy() {
4613
- if (this.isDestroyed) {
4370
+ get reference() {
4371
+ return this.properties.reference;
4372
+ }
4373
+ get isBlink() {
4374
+ return this._isBlink;
4375
+ }
4376
+ set isBlink(value) {
4377
+ if (value === this._isBlink) {
4614
4378
  return;
4615
4379
  }
4616
- super.destroy();
4617
- this.dragMoveHandlerProxy = null;
4618
- this.dragStartHandlerProxy = null;
4380
+ this._isBlink = value;
4381
+ this.commitIsBlinkProperties();
4619
4382
  }
4620
- }
4621
-
4622
- class WindowBaseComponent extends WindowDragable {
4383
+ get isShaking() {
4384
+ return false;
4385
+ }
4386
+ set isShaking(value) { }
4623
4387
  // --------------------------------------------------------------------------
4624
4388
  //
4625
- // Protected Methods
4389
+ // Public Properties
4626
4390
  //
4627
4391
  // --------------------------------------------------------------------------
4628
- elementsCreate() {
4629
- super.elementsCreate();
4630
- if (!(this.content.container instanceof ViewContainerRef)) {
4631
- return;
4632
- }
4633
- if (!this.config.disableClose) {
4634
- this.elementAdd(this.content.container.createComponent(WindowBaseComponent.CLOSE_COMPONENT));
4635
- }
4636
- if (this.config.isResizeable) {
4637
- this.elementAdd(this.content.container.createComponent(WindowBaseComponent.RESIZE_COMPONENT));
4638
- }
4639
- if (this.config.isMinimizable) {
4640
- this.elementAdd(this.content.container.createComponent(WindowBaseComponent.MINIMIZE_COMPONENT));
4641
- }
4642
- if (this.config.isExpandable) {
4643
- this.elementAdd(this.content.container.createComponent(WindowBaseComponent.EXPAND_COMPONENT));
4644
- }
4392
+ get events() {
4393
+ return this.observer.asObservable();
4645
4394
  }
4646
- commitIsBlinkProperties() {
4647
- ViewUtil.toggleClass(this.container, this.blinkClass, this.isBlink);
4395
+ get config() {
4396
+ return this.properties.config;
4648
4397
  }
4649
- commitIsDisabledProperties() {
4650
- ViewUtil.toggleClass(this.container, this.disabledClass, this.isDisabled);
4651
- ViewUtil.toggleClass(this.content.element, this.disabledClass, this.isDisabled);
4652
- ViewUtil.toggleClass(this.content.element.nativeElement.parentElement, this.disabledClass, this.isDisabled);
4398
+ get content() {
4399
+ return !_.isNil(this.reference) ? this.reference.instance : null;
4653
4400
  }
4654
- commitIsShakingProperties() {
4655
- ViewUtil.toggleClasses(this.container, this.shakingClass, this.isShaking);
4401
+ get container() {
4402
+ return this._container;
4656
4403
  }
4657
- commitIsMinimizedProperties() {
4658
- ViewUtil.toggleClass(this.container, this.minimizedClass, this.isMinimized);
4659
- ViewUtil.toggleClass(this.content.element, this.minimizedClass, this.isMinimized);
4660
- ViewUtil.toggleClass(this.content.element.nativeElement.parentElement, this.minimizedClass, this.isMinimized);
4404
+ get wrapper() {
4405
+ return this._wrapper;
4661
4406
  }
4662
- // --------------------------------------------------------------------------
4663
- //
4664
- // Protected Properties
4665
- //
4666
- // --------------------------------------------------------------------------
4667
- get blinkClass() {
4668
- return 'vi-blink';
4407
+ get backdrop() {
4408
+ return this._backdrop;
4669
4409
  }
4670
- get disabledClass() {
4671
- return 'vi-disabled';
4410
+ get isOnTop() {
4411
+ return false;
4672
4412
  }
4673
- get minimizedClass() {
4674
- return 'vi-minimized';
4413
+ set isOnTop(value) { }
4414
+ get isMinimized() {
4415
+ return false;
4675
4416
  }
4676
- get shakingClass() {
4677
- return 'shake-constant shake-horizontal';
4417
+ set isMinimized(value) { }
4418
+ get isDisabled() {
4419
+ return this._isDisabled;
4420
+ }
4421
+ set isDisabled(value) {
4422
+ if (value === this._isDisabled) {
4423
+ return;
4424
+ }
4425
+ this._isDisabled = value;
4426
+ this.commitIsDisabledProperties();
4427
+ this.emit(WindowEvent.DISABLED_CHANGED);
4678
4428
  }
4679
4429
  }
4680
4430
  // --------------------------------------------------------------------------
4681
4431
  //
4682
- // Static Properties
4432
+ // Constants
4683
4433
  //
4684
4434
  // --------------------------------------------------------------------------
4685
- WindowBaseComponent.CLOSE_COMPONENT = WindowCloseElementComponent;
4686
- WindowBaseComponent.EXPAND_COMPONENT = WindowExpandElementComponent;
4687
- WindowBaseComponent.RESIZE_COMPONENT = WindowResizeElementComponent;
4688
- WindowBaseComponent.MINIMIZE_COMPONENT = WindowMinimizeElementComponent;
4435
+ BottomSheetImpl.BLINK_DELAY = 500;
4436
+ BottomSheetImpl.SHAKE_DELAY = 500;
4689
4437
 
4690
- class WindowService extends Destroyable {
4691
- // public topZIndex: number = 1001;
4438
+ class WindowElement extends DestroyableContainer {
4692
4439
  // --------------------------------------------------------------------------
4693
4440
  //
4694
4441
  // Constructor
4695
4442
  //
4696
4443
  // --------------------------------------------------------------------------
4697
- constructor(dialog, language, cookies, sheet) {
4444
+ constructor(element) {
4698
4445
  super();
4699
- this.sheet = sheet;
4700
- this.isNeedCheckPositionAfterOpen = true;
4701
- this.gapX = 25;
4702
- this.gapY = 25;
4703
- this.minWidth = 100;
4704
- this.minHeight = 100;
4705
- this.paddingTop = 25;
4706
- this.paddingLeft = 25;
4707
- this.paddingRight = 25;
4708
- this.paddingBottom = 25;
4709
- this.defaultVerticalAlign = WindowAlign.CENTER;
4710
- this.defaultHorizontalAlign = WindowAlign.CENTER;
4711
- this.topZIndex = WindowService.Z_INDEX_MAX;
4712
- this._windows = new Map();
4713
- this.dialog = dialog;
4714
- this.language = language;
4715
- this.observer = new Subject();
4716
- this.properties = new PropertiesManager(cookies);
4717
- this.factory = new WindowFactory(WindowBaseComponent);
4718
- this.questionComponent = WindowQuestionComponent;
4446
+ this.element = element;
4447
+ }
4448
+ // --------------------------------------------------------------------------
4449
+ //
4450
+ // Private Methods
4451
+ //
4452
+ // --------------------------------------------------------------------------
4453
+ checkWindowParent() {
4454
+ let container = this.getContainer();
4455
+ if (!_.isNil(container)) {
4456
+ ViewUtil.appendChild(container, this.element.nativeElement);
4457
+ }
4719
4458
  }
4459
+ getContainer() {
4460
+ let item = ViewUtil.parseElement(this.element.nativeElement);
4461
+ while (!_.isNil(item) && item.nodeName.toLowerCase() !== 'mat-dialog-container') {
4462
+ item = item.parentElement;
4463
+ }
4464
+ return item;
4465
+ }
4466
+ createChildren() { }
4467
+ destroyChildren() { }
4468
+ commitWindowProperties() { }
4720
4469
  // --------------------------------------------------------------------------
4721
4470
  //
4722
- // Static Methods
4471
+ // Public Methods
4723
4472
  //
4724
4473
  // --------------------------------------------------------------------------
4725
- static getZIndex(window) {
4726
- return !_.isNil(window) && !_.isNil(window.container) ? parseInt(ViewUtil.getStyle(window.container.parentElement, 'zIndex'), 10) : -1;
4474
+ ngAfterViewInit() {
4475
+ this.createChildren();
4476
+ this.checkWindowParent();
4727
4477
  }
4728
- static setZIndex(window, index) {
4729
- if (_.isNil(window)) {
4478
+ destroy() {
4479
+ if (this.isDestroyed) {
4730
4480
  return;
4731
4481
  }
4732
- if (!_.isNil(window.backdrop)) {
4733
- ViewUtil.setStyle(window.backdrop, 'zIndex', index);
4734
- }
4735
- if (!_.isNil(window.wrapper)) {
4736
- ViewUtil.setStyle(window.wrapper, 'zIndex', index);
4737
- }
4482
+ super.destroy();
4483
+ this.destroyChildren();
4484
+ this.element = null;
4485
+ this.window = null;
4738
4486
  }
4739
4487
  // --------------------------------------------------------------------------
4740
4488
  //
4741
- // Private Methods
4489
+ // Event Handlers
4742
4490
  //
4743
4491
  // --------------------------------------------------------------------------
4744
- sortFunction(first, second) {
4745
- return WindowService.getZIndex(first) > WindowService.getZIndex(second) ? -1 : 1;
4746
- }
4747
- updateTop() {
4748
- let zIndex = 0;
4749
- let topWindow = null;
4750
- let windows = [...this.windowsArray, this.sheet.window];
4751
- for (let window of windows) {
4752
- if (_.isNil(window) || _.isNil(window.container)) {
4753
- continue;
4754
- }
4755
- let index = WindowService.getZIndex(window);
4756
- if (zIndex >= index) {
4757
- continue;
4758
- }
4759
- zIndex = index;
4760
- topWindow = window;
4761
- }
4762
- if (_.isNil(topWindow) || topWindow.isOnTop) {
4763
- return;
4764
- }
4765
- topWindow.isOnTop = true;
4766
- this.observer.next(new ObservableData(WindowServiceEvent.SETTED_ON_TOP, topWindow));
4767
- }
4768
- setWindowOnTop(topWindow) {
4769
- let currentIndex = this.topZIndex - 2;
4770
- let windows = [...this.windowsArray, this.sheet.window];
4771
- for (let window of windows) {
4772
- if (_.isNil(window) || _.isNil(window.container)) {
4773
- continue;
4774
- }
4775
- window.isOnTop = window === topWindow;
4776
- let zIndex = window.isOnTop ? this.topZIndex : currentIndex--;
4777
- WindowService.setZIndex(window, zIndex);
4778
- }
4779
- this.windowsArray.sort(this.sortFunction);
4780
- this.observer.next(new ObservableData(WindowServiceEvent.SETTED_ON_TOP, topWindow));
4781
- }
4782
- checkPosition(item) {
4783
- while (this.hasSamePosition(item)) {
4784
- item.move(item.getX() + this.gapX, item.getY() + this.gapY);
4785
- }
4786
- }
4787
- hasSamePosition(itemWindow) {
4788
- let x = itemWindow.getX();
4789
- let y = itemWindow.getY();
4790
- let result = false;
4791
- this.windowsArray.forEach(window => {
4792
- if (window !== itemWindow && x === window.getX() && y === window.getY()) {
4793
- result = true;
4794
- }
4795
- });
4796
- return result;
4492
+ clickHandler(event) {
4493
+ event.stopPropagation();
4797
4494
  }
4798
4495
  // --------------------------------------------------------------------------
4799
4496
  //
4800
- // Setters Methods
4497
+ // Protected Properties
4801
4498
  //
4802
4499
  // --------------------------------------------------------------------------
4803
- add(config, content) {
4804
- this._windows.set(config, content);
4805
- this.observer.next(new ObservableData(WindowServiceEvent.OPENED, content.window));
4806
- }
4807
- remove(config) {
4808
- let window = this._windows.get(config);
4809
- if (!window) {
4810
- return null;
4811
- }
4812
- window.close();
4813
- this._windows.delete(config);
4814
- this.observer.next(new ObservableData(WindowServiceEvent.CLOSED, window.window));
4500
+ get nativeElement() {
4501
+ return this.element ? this.element.nativeElement : null;
4815
4502
  }
4816
- getById(id) {
4817
- let item = _.find(Array.from(this._windows.values()), item => item.config.id === id);
4818
- return !_.isNil(item) ? item.window : null;
4503
+ // --------------------------------------------------------------------------
4504
+ //
4505
+ // Public Properties
4506
+ //
4507
+ // --------------------------------------------------------------------------
4508
+ get window() {
4509
+ return this._window;
4819
4510
  }
4820
- setDefaultProperties(config) {
4821
- if (!config.verticalAlign) {
4822
- config.verticalAlign = this.defaultVerticalAlign;
4823
- }
4824
- if (!config.horizontalAlign) {
4825
- config.horizontalAlign = this.defaultHorizontalAlign;
4826
- }
4827
- if (_.isNaN(config.defaultMinWidth)) {
4828
- config.defaultMinWidth = this.minWidth;
4829
- }
4830
- if (_.isNaN(config.defaultMinHeight)) {
4831
- config.defaultMinHeight = this.minHeight;
4832
- }
4833
- if (_.isNaN(config.paddingTop)) {
4834
- config.paddingTop = this.paddingTop;
4835
- }
4836
- if (_.isNaN(config.paddingLeft)) {
4837
- config.paddingLeft = this.paddingLeft;
4838
- }
4839
- if (_.isNaN(config.paddingRight)) {
4840
- config.paddingRight = this.paddingRight;
4841
- }
4842
- if (_.isNaN(config.paddingBottom)) {
4843
- config.paddingBottom = this.paddingBottom;
4511
+ set window(value) {
4512
+ if (value === this._window) {
4513
+ return;
4844
4514
  }
4845
- if (config.propertiesId) {
4846
- this.properties.load(config.propertiesId, config);
4515
+ this._window = value;
4516
+ if (this.window) {
4517
+ this.commitWindowProperties();
4847
4518
  }
4848
- config.setDefaultProperties();
4849
4519
  }
4520
+ }
4521
+ WindowElement.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowElement, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
4522
+ WindowElement.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: WindowElement, selector: "ng-component", usesInheritance: true, ngImport: i0, template: '', isInline: true });
4523
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowElement, decorators: [{
4524
+ type: Component,
4525
+ args: [{ template: '' }]
4526
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
4527
+
4528
+ class WindowCloseElementComponent extends WindowElement {
4850
4529
  // --------------------------------------------------------------------------
4851
4530
  //
4852
- // Public Methods
4531
+ // Constructor
4853
4532
  //
4854
4533
  // --------------------------------------------------------------------------
4855
- open(component, config) {
4856
- let window = null;
4857
- if (config.id) {
4858
- window = this.getById(config.id);
4859
- if (window) {
4860
- return window.content;
4861
- }
4862
- }
4863
- this.setDefaultProperties(config);
4864
- // let dialog = this.dialog as any;
4865
- // dialog._getOverlayState = config.isModal ? dialog.getOverlayStateModal : dialog.getOverlayStateNonModal;
4866
- let reference = this.dialog.open(component, config);
4867
- window = this.factory.create({ config, reference, overlay: reference._overlayRef });
4868
- this.observer.next(new ObservableData(WindowServiceEvent.OPEN_STARTED, window));
4869
- let subscription = window.events.subscribe(event => {
4870
- switch (event) {
4871
- case WindowEvent.OPENED:
4872
- this.add(config, reference.componentInstance);
4873
- this.setWindowOnTop(window);
4874
- if (this.isNeedCheckPositionAfterOpen) {
4875
- this.checkPosition(window);
4876
- }
4877
- this.observer.next(new ObservableData(WindowServiceEvent.OPEN_FINISHED, window));
4878
- break;
4879
- case WindowEvent.CLOSED:
4880
- subscription.unsubscribe();
4881
- this.remove(config);
4882
- if (window.isOnTop && this.windows.size > 0) {
4883
- this.updateTop();
4884
- }
4885
- break;
4886
- case WindowEvent.RESIZED:
4887
- if (!_.isNil(config.propertiesId)) {
4888
- this.properties.save(config.propertiesId, window);
4889
- }
4890
- break;
4891
- case WindowEvent.SET_ON_TOP:
4892
- this.setWindowOnTop(window);
4893
- break;
4894
- }
4895
- });
4896
- return window.content;
4534
+ constructor(element) {
4535
+ super(element);
4897
4536
  }
4898
- get(value) {
4899
- let id = value.toString();
4900
- if (value instanceof WindowConfig) {
4901
- id = value.id;
4902
- }
4903
- if (!id) {
4904
- return null;
4905
- }
4906
- let window = this.getById(id);
4907
- if (_.isNil(window)) {
4908
- return null;
4537
+ // --------------------------------------------------------------------------
4538
+ //
4539
+ // Private Methods
4540
+ //
4541
+ // --------------------------------------------------------------------------
4542
+ createChildren() {
4543
+ super.createChildren();
4544
+ if (!_.isNil(WindowCloseElementComponent.ICON_VALUE)) {
4545
+ ViewUtil.setProperty(this.nativeElement, 'innerHTML', WindowCloseElementComponent.ICON_VALUE);
4909
4546
  }
4910
- return window.content;
4911
- }
4912
- has(value) {
4913
- return !_.isNil(this.get(value));
4914
- }
4915
- setOnTop(value) {
4916
- let content = this.get(value);
4917
- if (!content) {
4918
- return false;
4547
+ if (!_.isNil(WindowCloseElementComponent.ICON_CLASS)) {
4548
+ ViewUtil.addClasses(this.nativeElement, WindowCloseElementComponent.ICON_CLASS);
4919
4549
  }
4920
- content.window.setOnTop();
4921
- return true;
4922
- }
4923
- removeAll() {
4924
- this.windowsArray.forEach(window => window.close());
4550
+ ViewUtil.addClass(this.nativeElement, 'mouse-active');
4925
4551
  }
4926
- destroy() {
4927
- if (this.isDestroyed) {
4928
- return;
4929
- }
4930
- super.destroy();
4931
- this.removeAll();
4932
- if (!_.isNil(this.observer)) {
4933
- this.observer.complete();
4934
- this.observer = null;
4935
- }
4936
- if (!_.isNil(this.properties)) {
4937
- this.properties.destroy();
4938
- this.properties = null;
4939
- }
4940
- this.factory = null;
4941
- this.questionComponent = null;
4942
- this.dialog = null;
4943
- this.language = null;
4944
- this._windows = null;
4552
+ // --------------------------------------------------------------------------
4553
+ //
4554
+ // Event Handlers
4555
+ //
4556
+ // --------------------------------------------------------------------------
4557
+ clickHandler(event) {
4558
+ super.clickHandler(event);
4559
+ if (!_.isNil(this.window)) {
4560
+ this.window.close();
4561
+ }
4945
4562
  }
4563
+ }
4564
+ // --------------------------------------------------------------------------
4565
+ //
4566
+ // Constants
4567
+ //
4568
+ // --------------------------------------------------------------------------
4569
+ WindowCloseElementComponent.ICON_CLASS = 'fas fa-times';
4570
+ WindowCloseElementComponent.ICON_VALUE = null;
4571
+ WindowCloseElementComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowCloseElementComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
4572
+ WindowCloseElementComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: WindowCloseElementComponent, selector: "vi-window-close-element", usesInheritance: true, ngImport: i0, template: '', isInline: true, styles: [":host{display:block;position:absolute;color:#fff;background-color:#0006;border-radius:50%;padding:8px;font-size:14px;font-weight:700;text-align:center}:host:hover{background-color:#0009}:host.small{font-size:10px;padding:4px}\n"] });
4573
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowCloseElementComponent, decorators: [{
4574
+ type: Component,
4575
+ args: [{ selector: 'vi-window-close-element', template: '', styles: [":host{display:block;position:absolute;color:#fff;background-color:#0006;border-radius:50%;padding:8px;font-size:14px;font-weight:700;text-align:center}:host:hover{background-color:#0009}:host.small{font-size:10px;padding:4px}\n"] }]
4576
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
4577
+
4578
+ class WindowExpandElementComponent extends WindowElement {
4946
4579
  // --------------------------------------------------------------------------
4947
4580
  //
4948
- // Additional Methods
4581
+ // Constructor
4949
4582
  //
4950
4583
  // --------------------------------------------------------------------------
4951
- info(translationId, translation, questionOptions, configOptions) {
4952
- let text = this.language.translate(translationId, translation);
4953
- let config = _.assign(new WindowConfig(true, false, 450), configOptions);
4954
- config.data = new QuestionManager(_.assign(questionOptions, { mode: QuestionMode.INFO, text }));
4955
- return this.open(this.questionComponent, config).config.data;
4956
- }
4957
- question(translationId, translation, questionOptions, configOptions) {
4958
- let text = this.language.translate(translationId, translation);
4959
- let config = _.assign(new WindowConfig(true, false, 450), configOptions);
4960
- config.data = new QuestionManager(_.assign(questionOptions, { mode: QuestionMode.QUESTION, text }));
4961
- return this.open(this.questionComponent, config).config.data;
4584
+ constructor(element) {
4585
+ super(element);
4962
4586
  }
4963
4587
  // --------------------------------------------------------------------------
4964
4588
  //
4965
- // Private Properties
4589
+ // Private Methods
4966
4590
  //
4967
4591
  // --------------------------------------------------------------------------
4968
- get windowsArray() {
4969
- return Array.from(this.windows.values()).map(item => item.window);
4592
+ createChildren() {
4593
+ super.createChildren();
4594
+ if (!_.isNil(WindowExpandElementComponent.ICON_VALUE)) {
4595
+ ViewUtil.setProperty(this.nativeElement, 'innerHTML', WindowExpandElementComponent.ICON_VALUE);
4596
+ }
4597
+ if (!_.isNil(WindowExpandElementComponent.ICON_CLASS)) {
4598
+ ViewUtil.addClasses(this.nativeElement, WindowExpandElementComponent.ICON_CLASS);
4599
+ }
4600
+ ViewUtil.addClass(this.nativeElement, 'mouse-active');
4970
4601
  }
4971
4602
  // --------------------------------------------------------------------------
4972
4603
  //
4973
- // Public Properties
4604
+ // Event Handlers
4974
4605
  //
4975
4606
  // --------------------------------------------------------------------------
4976
- get events() {
4977
- return this.observer.asObservable();
4978
- }
4979
- get windows() {
4980
- return this._windows;
4607
+ clickHandler(event) {
4608
+ super.clickHandler(event);
4609
+ if (!_.isNil(this.window)) {
4610
+ this.window.emit(WindowEvent.EXPAND);
4611
+ }
4981
4612
  }
4982
4613
  }
4983
4614
  // --------------------------------------------------------------------------
@@ -4985,328 +4616,351 @@ class WindowService extends Destroyable {
4985
4616
  // Constants
4986
4617
  //
4987
4618
  // --------------------------------------------------------------------------
4988
- WindowService.Z_INDEX_MAX = 1000;
4989
- WindowService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowService, deps: [{ token: i1.MatDialog }, { token: i1$1.LanguageService }, { token: CookieService }, { token: BottomSheetService }], target: i0.ɵɵFactoryTarget.Injectable });
4990
- WindowServiceprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowService, providedIn: 'root' });
4991
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowService, decorators: [{
4992
- type: Injectable,
4993
- args: [{ providedIn: 'root' }]
4994
- }], ctorParameters: function () { return [{ type: i1.MatDialog }, { type: i1$1.LanguageService }, { type: CookieService }, { type: BottomSheetService }]; } });
4995
- class PropertiesManager extends Destroyable {
4619
+ WindowExpandElementComponent.ICON_CLASS = 'fas fa-angle-double-up';
4620
+ WindowExpandElementComponent.ICON_VALUE = null;
4621
+ WindowExpandElementComponentfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowExpandElementComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
4622
+ WindowExpandElementComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: WindowExpandElementComponent, selector: "vi-window-expand-element", usesInheritance: true, ngImport: i0, template: '', isInline: true, styles: [":host{display:block;position:absolute;color:#fff;background-color:#0006;border-radius:50%;padding:8px;font-size:14px;font-weight:700;text-align:center}:host:hover{background-color:#0009}:host.small{font-size:10px;padding:4px}\n"] });
4623
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowExpandElementComponent, decorators: [{
4624
+ type: Component,
4625
+ args: [{ selector: 'vi-window-expand-element', template: '', styles: [":host{display:block;position:absolute;color:#fff;background-color:#0006;border-radius:50%;padding:8px;font-size:14px;font-weight:700;text-align:center}:host:hover{background-color:#0009}:host.small{font-size:10px;padding:4px}\n"] }]
4626
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
4627
+
4628
+ class WindowResizeElementComponent extends WindowElement {
4996
4629
  // --------------------------------------------------------------------------
4997
4630
  //
4998
4631
  // Constructor
4999
4632
  //
5000
4633
  // --------------------------------------------------------------------------
5001
- constructor(cookies) {
5002
- super();
5003
- this.cookies = cookies;
4634
+ constructor(element) {
4635
+ super(element);
5004
4636
  }
5005
4637
  // --------------------------------------------------------------------------
5006
4638
  //
5007
- // Public Methods
4639
+ // Private Methods
5008
4640
  //
5009
4641
  // --------------------------------------------------------------------------
5010
- load(name, config) {
5011
- let item = this.cookies.getObject(name + 'Window');
5012
- if (!item) {
5013
- return;
5014
- }
5015
- if (item.hasOwnProperty('width')) {
5016
- config.defaultWidth = item.width;
4642
+ createChildren() {
4643
+ super.createChildren();
4644
+ if (!_.isNil(WindowResizeElementComponent.ICON_VALUE)) {
4645
+ ViewUtil.setProperty(this.nativeElement, 'innerHTML', WindowResizeElementComponent.ICON_VALUE);
5017
4646
  }
5018
- if (item.hasOwnProperty('height')) {
5019
- config.defaultHeight = item.height;
4647
+ if (!_.isNil(WindowResizeElementComponent.ICON_CLASS)) {
4648
+ ViewUtil.addClasses(this.nativeElement, WindowResizeElementComponent.ICON_CLASS);
5020
4649
  }
4650
+ ViewUtil.setStyle(this.nativeElement, 'cursor', 'pointer');
5021
4651
  }
5022
- save(name, window) {
5023
- this.cookies.putObject(name + 'Window', {
5024
- width: window.getWidth(),
5025
- height: window.getHeight()
5026
- });
5027
- }
5028
- destroy() {
5029
- if (this.isDestroyed) {
5030
- return;
4652
+ // --------------------------------------------------------------------------
4653
+ //
4654
+ // Event Handlers
4655
+ //
4656
+ // --------------------------------------------------------------------------
4657
+ clickHandler(event) {
4658
+ super.clickHandler(event);
4659
+ if (!_.isNil(this.window)) {
4660
+ this.window.emit(WindowEvent.EXPAND);
5031
4661
  }
5032
- super.destroy();
5033
- this.cookies = null;
5034
4662
  }
5035
4663
  }
5036
- var WindowServiceEvent;
5037
- (function (WindowServiceEvent) {
5038
- WindowServiceEvent["OPEN_STARTED"] = "OPEN_STARTED";
5039
- WindowServiceEvent["OPENED"] = "OPENED";
5040
- WindowServiceEvent["OPEN_FINISHED"] = "OPEN_FINISHED";
5041
- WindowServiceEvent["CLOSED"] = "CLOSED";
5042
- WindowServiceEvent["SETTED_ON_TOP"] = "SETTED_ON_TOP";
5043
- })(WindowServiceEvent || (WindowServiceEvent = {}));
4664
+ // --------------------------------------------------------------------------
4665
+ //
4666
+ // Constants
4667
+ //
4668
+ // --------------------------------------------------------------------------
4669
+ WindowResizeElementComponent.ICON_CLASS = 'fas fa-arrows-alt';
4670
+ WindowResizeElementComponent.ICON_VALUE = null;
4671
+ WindowResizeElementComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowResizeElementComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
4672
+ WindowResizeElementComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: WindowResizeElementComponent, selector: "vi-window-resize-element", usesInheritance: true, ngImport: i0, template: '', isInline: true, styles: [":host{display:block;position:absolute;color:#fff;background-color:#0006;border-radius:50%;padding:8px;font-size:14px;font-weight:700;text-align:center}:host:hover{background-color:#0009}:host.small{font-size:10px;padding:4px}\n"] });
4673
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowResizeElementComponent, decorators: [{
4674
+ type: Component,
4675
+ args: [{ selector: 'vi-window-resize-element', template: '', styles: [":host{display:block;position:absolute;color:#fff;background-color:#0006;border-radius:50%;padding:8px;font-size:14px;font-weight:700;text-align:center}:host:hover{background-color:#0009}:host.small{font-size:10px;padding:4px}\n"] }]
4676
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
5044
4677
 
5045
- class BottomSheetImpl extends DestroyableContainer {
4678
+ class WindowMinimizeElementComponent extends WindowElement {
5046
4679
  // --------------------------------------------------------------------------
5047
4680
  //
5048
- // Constructor
4681
+ // Constructor
5049
4682
  //
5050
4683
  // --------------------------------------------------------------------------
5051
- constructor(properties) {
5052
- super();
5053
- // --------------------------------------------------------------------------
5054
- //
5055
- // Properties
5056
- //
5057
- // --------------------------------------------------------------------------
5058
- this._isBlink = false;
5059
- this._isDisabled = false;
4684
+ constructor(element) {
4685
+ super(element);
5060
4686
  // --------------------------------------------------------------------------
5061
4687
  //
5062
- // Protected Methods
4688
+ // Private Methods
5063
4689
  //
5064
4690
  // --------------------------------------------------------------------------
5065
- this.setClosed = () => {
5066
- this.emit(WindowEvent.CLOSED);
5067
- this.destroy();
5068
- };
5069
- this.setOpened = () => {
5070
- this.emit(WindowEvent.OPENED);
5071
- };
5072
- this.blinkToggle = () => {
5073
- this.isBlink = !this.isBlink;
5074
- };
5075
- this.mouseDownHandlerProxy = (event) => {
5076
- this.mouseDownHandler(event);
5077
- };
5078
- this.mouseClickHandlerProxy = (event) => {
5079
- this.mouseClickHandler(event);
4691
+ this.commitIconProperties = () => {
4692
+ let icon = this.window.isMinimized ? WindowMinimizeElementComponent.ICON_MAXIMIZE_VALUE : WindowMinimizeElementComponent.ICON_MINIMIZE_VALUE;
4693
+ ViewUtil.setProperty(this.nativeElement, 'innerHTML', icon);
5080
4694
  };
5081
- this.observer = new Subject();
5082
- this.properties = properties;
5083
- this.content.window = this;
5084
- // Have to save for unsubscribe on destroy
5085
- this._wrapper = this.properties.overlay.hostElement;
5086
- this._backdrop = this.properties.overlay.backdropElement;
5087
- this._container = this.properties.overlay.overlayElement;
5088
- this.setProperties();
5089
- this.elementsCreate();
5090
- this.getReference().afterOpened().pipe(takeUntil(this.destroyed)).subscribe(this.setOpened);
5091
- this.getReference().afterDismissed().pipe(takeUntil(this.destroyed)).subscribe(this.setClosed);
5092
4695
  }
5093
4696
  // --------------------------------------------------------------------------
5094
4697
  //
5095
- // Elements Methods
4698
+ // Protected Methods
5096
4699
  //
5097
4700
  // --------------------------------------------------------------------------
5098
- elementsCreate() {
5099
- this.elements = new Array();
5100
- }
5101
- elementsDestroy() {
5102
- this.elements.forEach(item => this.elementDestroy(item));
5103
- this.elements = null;
5104
- }
5105
- elementAdd(item) {
5106
- this.elements.push(item);
5107
- item.instance.window = this;
5108
- return item;
5109
- }
5110
- elementRemove(item) {
5111
- ArrayUtil.remove(this.elements, item);
5112
- this.elementDestroy(item);
5113
- return item;
5114
- }
5115
- elementDestroy(item) {
5116
- item.instance.window = null;
5117
- item.destroy();
5118
- return item;
4701
+ commitWindowProperties() {
4702
+ super.commitWindowProperties();
4703
+ this.window.events.pipe(takeUntil(this.destroyed)).subscribe(event => {
4704
+ if (event === WindowEvent.MINIMIZED_CHANGED) {
4705
+ this.commitIconProperties();
4706
+ }
4707
+ });
5119
4708
  }
5120
- setProperties() {
5121
- ViewUtil.addClass(this.container, 'vi-bottom-sheet');
5122
- ViewUtil.toggleClass(this.container, 'vi-modal', this.config.isModal);
5123
- this.container.addEventListener('click', this.mouseClickHandlerProxy, true);
5124
- this.container.addEventListener('mousedown', this.mouseDownHandlerProxy);
5125
- /*
5126
- if (!this.config.isModal) {
5127
- this.container.addEventListener('mousedown', this.mouseDownHandlerProxy);
4709
+ createChildren() {
4710
+ super.createChildren();
4711
+ if (!_.isNil(WindowMinimizeElementComponent.ICON_MINIMIZE_VALUE)) {
4712
+ ViewUtil.setProperty(this.nativeElement, 'innerHTML', WindowMinimizeElementComponent.ICON_MINIMIZE_VALUE);
5128
4713
  }
5129
- */
5130
- }
5131
- commitIsBlinkProperties() { }
5132
- commitIsDisabledProperties() { }
5133
- getConfig() {
5134
- return this.properties.config;
5135
- }
5136
- getContainer() {
5137
- return this.container;
5138
- }
5139
- getReference() {
5140
- return this.properties.reference;
4714
+ if (!_.isNil(WindowMinimizeElementComponent.ICON_CLASS)) {
4715
+ ViewUtil.addClasses(this.nativeElement, WindowMinimizeElementComponent.ICON_CLASS);
4716
+ }
4717
+ ViewUtil.addClass(this.nativeElement, 'mouse-active');
5141
4718
  }
5142
- isNeedClickStopPropagation(event) {
5143
- let element = _.find(this.elements, item => item.location.nativeElement === event.target);
5144
- if (_.isNil(element)) {
5145
- return false;
4719
+ // --------------------------------------------------------------------------
4720
+ //
4721
+ // Event Handlers
4722
+ //
4723
+ // --------------------------------------------------------------------------
4724
+ clickHandler(event) {
4725
+ super.clickHandler(event);
4726
+ if (!_.isNil(this.window)) {
4727
+ this.window.isMinimized = !this.window.isMinimized;
5146
4728
  }
5147
- element.instance.clickHandler(event);
5148
- return true;
5149
4729
  }
5150
- stopBlinkIfNeed() {
5151
- this.isBlink = false;
5152
- if (!this.blinkTimer) {
4730
+ }
4731
+ // --------------------------------------------------------------------------
4732
+ //
4733
+ // Constants
4734
+ //
4735
+ // --------------------------------------------------------------------------
4736
+ WindowMinimizeElementComponent.ICON_CLASS = null;
4737
+ WindowMinimizeElementComponent.ICON_MINIMIZE_VALUE = null;
4738
+ WindowMinimizeElementComponent.ICON_MAXIMIZE_VALUE = null;
4739
+ WindowMinimizeElementComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowMinimizeElementComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
4740
+ WindowMinimizeElementComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: WindowMinimizeElementComponent, selector: "vi-window-minimize-element", usesInheritance: true, ngImport: i0, template: '', isInline: true, styles: [":host{display:block;position:absolute;color:#fff;background-color:#0006;border-radius:50%;padding:8px;font-size:14px;font-weight:700;text-align:center}:host:hover{background-color:#0009}:host.small{font-size:10px;padding:4px}\n"] });
4741
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowMinimizeElementComponent, decorators: [{
4742
+ type: Component,
4743
+ args: [{ selector: 'vi-window-minimize-element', template: '', styles: [":host{display:block;position:absolute;color:#fff;background-color:#0006;border-radius:50%;padding:8px;font-size:14px;font-weight:700;text-align:center}:host:hover{background-color:#0009}:host.small{font-size:10px;padding:4px}\n"] }]
4744
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
4745
+
4746
+ class WindowResizeable extends WindowImpl {
4747
+ // --------------------------------------------------------------------------
4748
+ //
4749
+ // Protected Methods
4750
+ //
4751
+ // --------------------------------------------------------------------------
4752
+ setProperties() {
4753
+ super.setProperties();
4754
+ if (!this.config.isResizeable) {
5153
4755
  return;
5154
4756
  }
5155
- clearInterval(this.blinkTimer);
5156
- this.blinkTimer = null;
4757
+ ViewUtil.addClass(this.container, 'vi-resizeable');
4758
+ if (_.isNil(this.resizeMoveHandlerProxy)) {
4759
+ this.resizeMoveHandlerProxy = this.resizeMoveHandler.bind(this);
4760
+ }
4761
+ let edges = {};
4762
+ edges.top = true;
4763
+ edges.left = true;
4764
+ edges.right = true;
4765
+ edges.bottom = true;
4766
+ let param = {};
4767
+ param.edges = edges;
4768
+ this.interactable.resizable(param);
4769
+ this.interactable.on('resizemove', this.resizeMoveHandlerProxy);
5157
4770
  }
5158
4771
  // --------------------------------------------------------------------------
5159
4772
  //
5160
4773
  // Event Handlers
5161
4774
  //
5162
4775
  // --------------------------------------------------------------------------
5163
- mouseDownHandler(event) {
5164
- this.setOnTop();
5165
- }
5166
- mouseClickHandler(event) {
5167
- if (this.isNeedClickStopPropagation(event)) {
5168
- event.stopPropagation();
4776
+ resizeMoveHandler(event) {
4777
+ if (this.isMinimized) {
4778
+ return;
4779
+ }
4780
+ let isChanged = event.dx !== 0 || event.dy !== 0;
4781
+ if (!isChanged) {
4782
+ return;
4783
+ }
4784
+ if (event.dx !== 0) {
4785
+ let width = this.getWidth();
4786
+ if (_.isNaN(width)) {
4787
+ width = this.calculateWidth();
4788
+ }
4789
+ this.setWidth(width + event.dx, false);
4790
+ }
4791
+ if (event.dy !== 0) {
4792
+ let height = this.getHeight();
4793
+ if (_.isNaN(height)) {
4794
+ height = this.calculateHeight();
4795
+ }
4796
+ this.setHeight(height + event.dy, false);
5169
4797
  }
4798
+ this.resizeHandler();
5170
4799
  }
5171
4800
  // --------------------------------------------------------------------------
5172
4801
  //
5173
- // Public Methods
4802
+ // Public Properties
5174
4803
  //
5175
4804
  // --------------------------------------------------------------------------
5176
- emit(event) {
5177
- this.observer.next(event);
5178
- }
5179
- close() {
5180
- this.getReference().dismiss();
5181
- }
5182
4805
  destroy() {
5183
4806
  if (this.isDestroyed) {
5184
4807
  return;
5185
4808
  }
5186
4809
  super.destroy();
5187
- this.elementsDestroy();
5188
- this._container.removeEventListener('click', this.mouseClickHandlerProxy, true);
5189
- this._container.removeEventListener('mousedown', this.mouseDownHandlerProxy);
5190
- if (!_.isNil(this.content)) {
5191
- this.content.destroy();
5192
- }
5193
- if (!_.isNil(this.observer)) {
5194
- this.observer.complete();
5195
- this.observer = null;
4810
+ this.resizeMoveHandlerProxy = null;
4811
+ if (!_.isNil(this._interactable)) {
4812
+ this._interactable.unset();
4813
+ this._interactable = null;
5196
4814
  }
5197
- this.properties = null;
5198
- this._wrapper = null;
5199
- this._backdrop = null;
5200
- this._container = null;
5201
- clearInterval(this.blinkTimer);
5202
- this.blinkTimer = null;
5203
- }
5204
- blink() {
5205
- clearInterval(this.blinkTimer);
5206
- this.blinkTimer = setInterval(this.blinkToggle, WindowImpl.BLINK_DELAY);
5207
4815
  }
5208
- shake() { }
5209
- setOnTop() { }
5210
4816
  // --------------------------------------------------------------------------
5211
4817
  //
5212
- // Size Methods
4818
+ // Private Properties
5213
4819
  //
5214
4820
  // --------------------------------------------------------------------------
5215
- getWidth() {
5216
- return NaN;
4821
+ get interactable() {
4822
+ if (_.isNil(this._interactable)) {
4823
+ this._interactable = interact.default(this.container);
4824
+ // this._interactable.styleCursor(false);
4825
+ }
4826
+ return this._interactable;
5217
4827
  }
5218
- getHeight() {
5219
- return NaN;
4828
+ }
4829
+
4830
+ class WindowDragable extends WindowResizeable {
4831
+ constructor() {
4832
+ // --------------------------------------------------------------------------
4833
+ //
4834
+ // Properties Methods
4835
+ //
4836
+ // --------------------------------------------------------------------------
4837
+ super(...arguments);
4838
+ this.isWasDragged = false;
5220
4839
  }
5221
- setWidth(value, isNeedNotify = true) { }
5222
- setHeight(value, isNeedNotify = true) { }
5223
- setSize(width, height) { }
5224
4840
  // --------------------------------------------------------------------------
5225
4841
  //
5226
- // Move Methods
4842
+ // Protected Methods
5227
4843
  //
5228
4844
  // --------------------------------------------------------------------------
5229
- getX() {
5230
- return NaN;
4845
+ setProperties() {
4846
+ super.setProperties();
4847
+ if (this.config.isModal) {
4848
+ return;
4849
+ }
4850
+ ViewUtil.addClass(this.container, 'vi-draggable');
4851
+ if (!this.config.isContentDragable) {
4852
+ return;
4853
+ }
4854
+ this.dragMoveHandlerProxy = this.dragMoveHandler.bind(this);
4855
+ this.dragStartHandlerProxy = this.dragStartHandler.bind(this);
4856
+ let param = {};
4857
+ // let param = {} as any;
4858
+ this.interactable.draggable(param);
4859
+ this.interactable.on('dragmove', this.dragMoveHandlerProxy);
4860
+ this.interactable.on('dragstart', this.dragStartHandlerProxy);
5231
4861
  }
5232
- setX(value, isNeedNotify = true) { }
5233
- getY() {
5234
- return NaN;
4862
+ isNeedClickStopPropagation(event) {
4863
+ return this.isWasDragged || super.isNeedClickStopPropagation(event);
5235
4864
  }
5236
- setY(value, isNeedNotify = true) { }
5237
- move(x, y) { }
5238
4865
  // --------------------------------------------------------------------------
5239
4866
  //
5240
- // Private Properties
4867
+ // Event Handlers
5241
4868
  //
5242
4869
  // --------------------------------------------------------------------------
5243
- get reference() {
5244
- return this.properties.reference;
4870
+ dragStartHandler(event) {
4871
+ this.isWasDragged = true;
5245
4872
  }
5246
- get isBlink() {
5247
- return this._isBlink;
4873
+ dragMoveHandler(event) {
4874
+ let x = this.getX() + event.dx;
4875
+ let y = this.getY() + event.dy;
4876
+ this.move(x, y);
5248
4877
  }
5249
- set isBlink(value) {
5250
- if (value === this._isBlink) {
4878
+ mouseClickHandler(event) {
4879
+ super.mouseClickHandler(event);
4880
+ this.isWasDragged = false;
4881
+ }
4882
+ // --------------------------------------------------------------------------
4883
+ //
4884
+ // Public Methods
4885
+ //
4886
+ // --------------------------------------------------------------------------
4887
+ destroy() {
4888
+ if (this.isDestroyed) {
5251
4889
  return;
5252
4890
  }
5253
- this._isBlink = value;
5254
- this.commitIsBlinkProperties();
5255
- }
5256
- get isShaking() {
5257
- return false;
4891
+ super.destroy();
4892
+ this.dragMoveHandlerProxy = null;
4893
+ this.dragStartHandlerProxy = null;
5258
4894
  }
5259
- set isShaking(value) { }
4895
+ }
4896
+
4897
+ class WindowBaseComponent extends WindowDragable {
5260
4898
  // --------------------------------------------------------------------------
5261
4899
  //
5262
- // Public Properties
4900
+ // Protected Methods
5263
4901
  //
5264
4902
  // --------------------------------------------------------------------------
5265
- get events() {
5266
- return this.observer.asObservable();
5267
- }
5268
- get config() {
5269
- return this.properties.config;
5270
- }
5271
- get content() {
5272
- return !_.isNil(this.reference) ? this.reference.instance : null;
4903
+ elementsCreate() {
4904
+ super.elementsCreate();
4905
+ if (!(this.content.container instanceof ViewContainerRef)) {
4906
+ return;
4907
+ }
4908
+ if (!this.config.disableClose) {
4909
+ this.elementAdd(this.content.container.createComponent(WindowBaseComponent.CLOSE_COMPONENT));
4910
+ }
4911
+ if (this.config.isResizeable) {
4912
+ this.elementAdd(this.content.container.createComponent(WindowBaseComponent.RESIZE_COMPONENT));
4913
+ }
4914
+ if (this.config.isMinimizable) {
4915
+ this.elementAdd(this.content.container.createComponent(WindowBaseComponent.MINIMIZE_COMPONENT));
4916
+ }
4917
+ if (this.config.isExpandable) {
4918
+ this.elementAdd(this.content.container.createComponent(WindowBaseComponent.EXPAND_COMPONENT));
4919
+ }
5273
4920
  }
5274
- get container() {
5275
- return this._container;
4921
+ commitIsBlinkProperties() {
4922
+ ViewUtil.toggleClass(this.container, this.blinkClass, this.isBlink);
5276
4923
  }
5277
- get wrapper() {
5278
- return this._wrapper;
4924
+ commitIsDisabledProperties() {
4925
+ ViewUtil.toggleClass(this.container, this.disabledClass, this.isDisabled);
4926
+ ViewUtil.toggleClass(this.content.element, this.disabledClass, this.isDisabled);
4927
+ ViewUtil.toggleClass(this.content.element.nativeElement.parentElement, this.disabledClass, this.isDisabled);
5279
4928
  }
5280
- get backdrop() {
5281
- return this._backdrop;
4929
+ commitIsShakingProperties() {
4930
+ ViewUtil.toggleClasses(this.container, this.shakingClass, this.isShaking);
5282
4931
  }
5283
- get isOnTop() {
5284
- return false;
4932
+ commitIsMinimizedProperties() {
4933
+ ViewUtil.toggleClass(this.container, this.minimizedClass, this.isMinimized);
4934
+ ViewUtil.toggleClass(this.content.element, this.minimizedClass, this.isMinimized);
4935
+ ViewUtil.toggleClass(this.content.element.nativeElement.parentElement, this.minimizedClass, this.isMinimized);
5285
4936
  }
5286
- set isOnTop(value) { }
5287
- get isMinimized() {
5288
- return false;
4937
+ // --------------------------------------------------------------------------
4938
+ //
4939
+ // Protected Properties
4940
+ //
4941
+ // --------------------------------------------------------------------------
4942
+ get blinkClass() {
4943
+ return 'vi-blink';
5289
4944
  }
5290
- set isMinimized(value) { }
5291
- get isDisabled() {
5292
- return this._isDisabled;
4945
+ get disabledClass() {
4946
+ return 'vi-disabled';
5293
4947
  }
5294
- set isDisabled(value) {
5295
- if (value === this._isDisabled) {
5296
- return;
5297
- }
5298
- this._isDisabled = value;
5299
- this.commitIsDisabledProperties();
5300
- this.emit(WindowEvent.DISABLED_CHANGED);
4948
+ get minimizedClass() {
4949
+ return 'vi-minimized';
4950
+ }
4951
+ get shakingClass() {
4952
+ return 'shake-constant shake-horizontal';
5301
4953
  }
5302
4954
  }
5303
4955
  // --------------------------------------------------------------------------
5304
4956
  //
5305
- // Constants
4957
+ // Static Properties
5306
4958
  //
5307
4959
  // --------------------------------------------------------------------------
5308
- BottomSheetImpl.BLINK_DELAY = 500;
5309
- BottomSheetImpl.SHAKE_DELAY = 500;
4960
+ WindowBaseComponent.CLOSE_COMPONENT = WindowCloseElementComponent;
4961
+ WindowBaseComponent.EXPAND_COMPONENT = WindowExpandElementComponent;
4962
+ WindowBaseComponent.RESIZE_COMPONENT = WindowResizeElementComponent;
4963
+ WindowBaseComponent.MINIMIZE_COMPONENT = WindowMinimizeElementComponent;
5310
4964
 
5311
4965
  class BottomSheetBaseComponent extends BottomSheetImpl {
5312
4966
  // --------------------------------------------------------------------------
@@ -6479,455 +6133,802 @@ class ThemeAssetDirective extends Destroyable {
6479
6133
  if (value === this._isBackground) {
6480
6134
  return;
6481
6135
  }
6482
- this._isBackground = value;
6483
- this.setSourceProperties();
6136
+ this._isBackground = value;
6137
+ this.setSourceProperties();
6138
+ }
6139
+ get isBackground() {
6140
+ return this._isBackground;
6141
+ }
6142
+ set isIgnoreTheme(value) {
6143
+ if (value === this._isIgnoreTheme) {
6144
+ return;
6145
+ }
6146
+ this._isIgnoreTheme = value;
6147
+ this.setSourceProperties();
6148
+ }
6149
+ get isIgnoreTheme() {
6150
+ return this._isIgnoreTheme;
6151
+ }
6152
+ get name() {
6153
+ return this._name;
6154
+ }
6155
+ set name(value) {
6156
+ if (value === this._name) {
6157
+ return;
6158
+ }
6159
+ if (!_.isNil(this._name)) {
6160
+ this.removeSourceProperties();
6161
+ }
6162
+ this._name = value;
6163
+ if (!_.isNil(value)) {
6164
+ this.setSourceProperties();
6165
+ }
6166
+ }
6167
+ get extension() {
6168
+ return this._extension;
6169
+ }
6170
+ set extension(value) {
6171
+ if (value === this._extension) {
6172
+ return;
6173
+ }
6174
+ this._extension = value;
6175
+ if (!_.isNil(value)) {
6176
+ this.setSourceProperties();
6177
+ }
6178
+ }
6179
+ }
6180
+ ThemeAssetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ThemeAssetDirective, deps: [{ token: i0.ElementRef }, { token: i1$1.ThemeService }, { token: i1$1.ThemeAssetService }], target: i0.ɵɵFactoryTarget.Directive });
6181
+ ThemeAssetDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: ThemeAssetDirective, inputs: { isSound: "isSound", isVideo: "isVideo", isFile: "isFile", isImage: "isImage", isBackground: "isBackground", isIgnoreTheme: "isIgnoreTheme", name: "name", extension: "extension" }, host: { listeners: { "error": "errorLoadingHandler($event)" } }, usesInheritance: true, ngImport: i0 });
6182
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ThemeAssetDirective, decorators: [{
6183
+ type: Directive
6184
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$1.ThemeService }, { type: i1$1.ThemeAssetService }]; }, propDecorators: { errorLoadingHandler: [{
6185
+ type: HostListener,
6186
+ args: ['error', ['$event']]
6187
+ }], isSound: [{
6188
+ type: Input
6189
+ }], isVideo: [{
6190
+ type: Input
6191
+ }], isFile: [{
6192
+ type: Input
6193
+ }], isImage: [{
6194
+ type: Input
6195
+ }], isBackground: [{
6196
+ type: Input
6197
+ }], isIgnoreTheme: [{
6198
+ type: Input
6199
+ }], name: [{
6200
+ type: Input
6201
+ }], extension: [{
6202
+ type: Input
6203
+ }] } });
6204
+
6205
+ class ThemeAssetBackgroundDirective extends ThemeAssetDirective {
6206
+ // --------------------------------------------------------------------------
6207
+ //
6208
+ // Constructor
6209
+ //
6210
+ // --------------------------------------------------------------------------
6211
+ constructor(element, theme, themeAsset) {
6212
+ super(element, theme, themeAsset);
6213
+ }
6214
+ // --------------------------------------------------------------------------
6215
+ //
6216
+ // Private Methods
6217
+ //
6218
+ // --------------------------------------------------------------------------
6219
+ commitSourceProperties() {
6220
+ let value = 'url(' + this.source + ')';
6221
+ ViewUtil.setStyle(this.element, 'backgroundImage', value);
6222
+ }
6223
+ removeSourceProperties() {
6224
+ ViewUtil.removeStyle(this.element, 'backgroundImage');
6225
+ }
6226
+ }
6227
+ ThemeAssetBackgroundDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ThemeAssetBackgroundDirective, deps: [{ token: i0.ElementRef }, { token: i1$1.ThemeService }, { token: i1$1.ThemeAssetService }], target: i0.ɵɵFactoryTarget.Directive });
6228
+ ThemeAssetBackgroundDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: ThemeAssetBackgroundDirective, selector: "[vi-theme-background]", usesInheritance: true, ngImport: i0 });
6229
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ThemeAssetBackgroundDirective, decorators: [{
6230
+ type: Directive,
6231
+ args: [{
6232
+ selector: '[vi-theme-background]'
6233
+ }]
6234
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$1.ThemeService }, { type: i1$1.ThemeAssetService }]; } });
6235
+
6236
+ class ThemeAssetImageDirective extends ThemeAssetDirective {
6237
+ // --------------------------------------------------------------------------
6238
+ //
6239
+ // Constructor
6240
+ //
6241
+ // --------------------------------------------------------------------------
6242
+ constructor(element, theme, themeAsset) {
6243
+ super(element, theme, themeAsset);
6244
+ }
6245
+ // --------------------------------------------------------------------------
6246
+ //
6247
+ // Private Methods
6248
+ //
6249
+ // --------------------------------------------------------------------------
6250
+ commitSourceProperties() {
6251
+ this.element.src = this.source;
6252
+ }
6253
+ removeSourceProperties() {
6254
+ this.element.src = null;
6255
+ }
6256
+ }
6257
+ ThemeAssetImageDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ThemeAssetImageDirective, deps: [{ token: i0.ElementRef }, { token: i1$1.ThemeService }, { token: i1$1.ThemeAssetService }], target: i0.ɵɵFactoryTarget.Directive });
6258
+ ThemeAssetImageDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: ThemeAssetImageDirective, selector: "[vi-theme-image]", usesInheritance: true, ngImport: i0 });
6259
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ThemeAssetImageDirective, decorators: [{
6260
+ type: Directive,
6261
+ args: [{
6262
+ selector: '[vi-theme-image]'
6263
+ }]
6264
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$1.ThemeService }, { type: i1$1.ThemeAssetService }]; } });
6265
+
6266
+ class ThemeToggleDirective extends Destroyable {
6267
+ // --------------------------------------------------------------------------
6268
+ //
6269
+ // Constructor
6270
+ //
6271
+ // --------------------------------------------------------------------------
6272
+ constructor(theme) {
6273
+ super();
6274
+ this.theme = theme;
6275
+ }
6276
+ // --------------------------------------------------------------------------
6277
+ //
6278
+ // Event Handlers
6279
+ //
6280
+ // --------------------------------------------------------------------------
6281
+ clickHandler(event) {
6282
+ let themes = this.theme.themes.collection;
6283
+ let length = themes.length;
6284
+ if (length < 2) {
6285
+ return;
6286
+ }
6287
+ let index = 0;
6288
+ if (this.theme.theme) {
6289
+ index = themes.indexOf(this.theme.theme);
6290
+ if (index < length - 1) {
6291
+ index++;
6292
+ }
6293
+ else {
6294
+ index = 0;
6295
+ }
6296
+ }
6297
+ this.theme.theme = themes[index];
6298
+ }
6299
+ // --------------------------------------------------------------------------
6300
+ //
6301
+ // Public Methods
6302
+ //
6303
+ // --------------------------------------------------------------------------
6304
+ destroy() {
6305
+ if (this.isDestroyed) {
6306
+ return;
6307
+ }
6308
+ super.destroy();
6309
+ this.theme = null;
6310
+ }
6311
+ }
6312
+ ThemeToggleDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ThemeToggleDirective, deps: [{ token: i1$1.ThemeService }], target: i0.ɵɵFactoryTarget.Directive });
6313
+ ThemeToggleDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: ThemeToggleDirective, selector: "[vi-theme-toggle]", host: { listeners: { "click": "clickHandler($event)" } }, usesInheritance: true, ngImport: i0 });
6314
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ThemeToggleDirective, decorators: [{
6315
+ type: Directive,
6316
+ args: [{
6317
+ selector: '[vi-theme-toggle]'
6318
+ }]
6319
+ }], ctorParameters: function () { return [{ type: i1$1.ThemeService }]; }, propDecorators: { clickHandler: [{
6320
+ type: HostListener,
6321
+ args: ['click', ['$event']]
6322
+ }] } });
6323
+
6324
+ class ThemeStyleDirective extends Destroyable {
6325
+ // --------------------------------------------------------------------------
6326
+ //
6327
+ // Constructor
6328
+ //
6329
+ // --------------------------------------------------------------------------
6330
+ constructor(element, theme) {
6331
+ super();
6332
+ this.theme = theme;
6333
+ this.element = ViewUtil.parseElement(element.nativeElement);
6334
+ this.theme.changed.pipe(takeUntil(this.destroyed)).subscribe(() => this.stylePropertiesAdd());
6335
+ }
6336
+ // --------------------------------------------------------------------------
6337
+ //
6338
+ // Protected Methods
6339
+ //
6340
+ // --------------------------------------------------------------------------
6341
+ commitStyleProperties(name, value) {
6342
+ ViewUtil.setStyle(this.element, name, value, this.flags);
6343
+ }
6344
+ stylePropertiesCheck() {
6345
+ if (this.isNeedStyleAdd()) {
6346
+ this.stylePropertiesAdd();
6347
+ }
6348
+ else if (this.isNeedStyleRemove()) {
6349
+ this.stylePropertiesRemove();
6350
+ }
6351
+ }
6352
+ stylePropertiesRemove() {
6353
+ ViewUtil.removeStyle(this.element, this.styleName);
6354
+ }
6355
+ stylePropertiesAdd() {
6356
+ this.commitStyleProperties(this.styleName, this.theme.getStyle(this.key));
6357
+ }
6358
+ isNeedStyleAdd() {
6359
+ return !_.isNil(this.theme.theme) && !_.isNil(this.styleName);
6360
+ }
6361
+ isNeedStyleRemove() {
6362
+ return !_.isNil(this.styleName);
6363
+ }
6364
+ // --------------------------------------------------------------------------
6365
+ //
6366
+ // Public Methods
6367
+ //
6368
+ // --------------------------------------------------------------------------
6369
+ destroy() {
6370
+ if (this.isDestroyed) {
6371
+ return;
6372
+ }
6373
+ super.destroy();
6374
+ this.key = null;
6375
+ this.theme = null;
6376
+ this.element = null;
6484
6377
  }
6485
- get isBackground() {
6486
- return this._isBackground;
6378
+ // --------------------------------------------------------------------------
6379
+ //
6380
+ // Public Properties
6381
+ //
6382
+ // --------------------------------------------------------------------------
6383
+ get flags() {
6384
+ return this._flags;
6487
6385
  }
6488
- set isIgnoreTheme(value) {
6489
- if (value === this._isIgnoreTheme) {
6386
+ set flags(value) {
6387
+ if (value === this._flags) {
6490
6388
  return;
6491
6389
  }
6492
- this._isIgnoreTheme = value;
6493
- this.setSourceProperties();
6494
- }
6495
- get isIgnoreTheme() {
6496
- return this._isIgnoreTheme;
6390
+ this._flags = value;
6391
+ this.stylePropertiesCheck();
6497
6392
  }
6498
- get name() {
6499
- return this._name;
6393
+ get styleName() {
6394
+ return this._styleName;
6500
6395
  }
6501
- set name(value) {
6502
- if (value === this._name) {
6396
+ set styleName(value) {
6397
+ if (value === this._styleName) {
6503
6398
  return;
6504
6399
  }
6505
- if (!_.isNil(this._name)) {
6506
- this.removeSourceProperties();
6507
- }
6508
- this._name = value;
6509
- if (!_.isNil(value)) {
6510
- this.setSourceProperties();
6511
- }
6400
+ this._styleName = value;
6401
+ this.stylePropertiesCheck();
6512
6402
  }
6513
- get extension() {
6514
- return this._extension;
6403
+ get key() {
6404
+ return this._key;
6515
6405
  }
6516
- set extension(value) {
6517
- if (value === this._extension) {
6406
+ set key(value) {
6407
+ if (value === this._key) {
6518
6408
  return;
6519
6409
  }
6520
- this._extension = value;
6410
+ this._key = value;
6521
6411
  if (!_.isNil(value)) {
6522
- this.setSourceProperties();
6412
+ this.stylePropertiesCheck();
6523
6413
  }
6524
6414
  }
6525
6415
  }
6526
- ThemeAssetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ThemeAssetDirective, deps: [{ token: i0.ElementRef }, { token: i1$1.ThemeService }, { token: i1$1.ThemeAssetService }], target: i0.ɵɵFactoryTarget.Directive });
6527
- ThemeAssetDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: ThemeAssetDirective, inputs: { isSound: "isSound", isVideo: "isVideo", isFile: "isFile", isImage: "isImage", isBackground: "isBackground", isIgnoreTheme: "isIgnoreTheme", name: "name", extension: "extension" }, host: { listeners: { "error": "errorLoadingHandler($event)" } }, usesInheritance: true, ngImport: i0 });
6528
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ThemeAssetDirective, decorators: [{
6529
- type: Directive
6530
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$1.ThemeService }, { type: i1$1.ThemeAssetService }]; }, propDecorators: { errorLoadingHandler: [{
6531
- type: HostListener,
6532
- args: ['error', ['$event']]
6533
- }], isSound: [{
6534
- type: Input
6535
- }], isVideo: [{
6536
- type: Input
6537
- }], isFile: [{
6538
- type: Input
6539
- }], isImage: [{
6540
- type: Input
6541
- }], isBackground: [{
6542
- type: Input
6543
- }], isIgnoreTheme: [{
6544
- type: Input
6545
- }], name: [{
6416
+ ThemeStyleDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ThemeStyleDirective, deps: [{ token: i0.ElementRef }, { token: i1$1.ThemeService }], target: i0.ɵɵFactoryTarget.Directive });
6417
+ ThemeStyleDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: ThemeStyleDirective, selector: "[vi-theme-style]", inputs: { flags: "flags", styleName: "styleName", key: ["vi-theme-style", "key"] }, usesInheritance: true, ngImport: i0 });
6418
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ThemeStyleDirective, decorators: [{
6419
+ type: Directive,
6420
+ args: [{
6421
+ selector: '[vi-theme-style]'
6422
+ }]
6423
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$1.ThemeService }]; }, propDecorators: { flags: [{
6546
6424
  type: Input
6547
- }], extension: [{
6425
+ }], styleName: [{
6548
6426
  type: Input
6427
+ }], key: [{
6428
+ type: Input,
6429
+ args: ['vi-theme-style']
6549
6430
  }] } });
6550
6431
 
6551
- class ThemeAssetBackgroundDirective extends ThemeAssetDirective {
6432
+ class ThemeStyleHoverDirective extends ThemeStyleDirective {
6552
6433
  // --------------------------------------------------------------------------
6553
6434
  //
6554
6435
  // Constructor
6555
6436
  //
6556
6437
  // --------------------------------------------------------------------------
6557
- constructor(element, theme, themeAsset) {
6558
- super(element, theme, themeAsset);
6438
+ constructor(element, theme) {
6439
+ super(element, theme);
6440
+ // --------------------------------------------------------------------------
6441
+ //
6442
+ // Properties
6443
+ //
6444
+ // --------------------------------------------------------------------------
6445
+ this._isHover = false;
6446
+ // --------------------------------------------------------------------------
6447
+ //
6448
+ // Event Handlers
6449
+ //
6450
+ // --------------------------------------------------------------------------
6451
+ this.mouseEnter = (event) => {
6452
+ this.isHover = true;
6453
+ };
6454
+ this.mouseLeave = (event) => {
6455
+ this.isHover = false;
6456
+ };
6457
+ this.flags = RendererStyleFlags2.Important;
6458
+ this.element.addEventListener('mouseenter', this.mouseEnter, false);
6459
+ this.element.addEventListener('mouseleave', this.mouseLeave, false);
6559
6460
  }
6560
6461
  // --------------------------------------------------------------------------
6561
6462
  //
6562
- // Private Methods
6463
+ // Protected Methods
6563
6464
  //
6564
6465
  // --------------------------------------------------------------------------
6565
- commitSourceProperties() {
6566
- let value = 'url(' + this.source + ')';
6567
- ViewUtil.setStyle(this.element, 'backgroundImage', value);
6466
+ isNeedStyleAdd() {
6467
+ return this.isHover && super.isNeedStyleAdd();
6568
6468
  }
6569
- removeSourceProperties() {
6570
- ViewUtil.removeStyle(this.element, 'backgroundImage');
6469
+ isNeedStyleRemove() {
6470
+ return !this.isHover || super.isNeedStyleRemove();
6571
6471
  }
6572
- }
6573
- ThemeAssetBackgroundDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ThemeAssetBackgroundDirective, deps: [{ token: i0.ElementRef }, { token: i1$1.ThemeService }, { token: i1$1.ThemeAssetService }], target: i0.ɵɵFactoryTarget.Directive });
6574
- ThemeAssetBackgroundDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: ThemeAssetBackgroundDirective, selector: "[vi-theme-background]", usesInheritance: true, ngImport: i0 });
6575
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ThemeAssetBackgroundDirective, decorators: [{
6576
- type: Directive,
6577
- args: [{
6578
- selector: '[vi-theme-background]'
6579
- }]
6580
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$1.ThemeService }, { type: i1$1.ThemeAssetService }]; } });
6581
-
6582
- class ThemeAssetImageDirective extends ThemeAssetDirective {
6583
6472
  // --------------------------------------------------------------------------
6584
6473
  //
6585
- // Constructor
6474
+ // Public Methods
6586
6475
  //
6587
6476
  // --------------------------------------------------------------------------
6588
- constructor(element, theme, themeAsset) {
6589
- super(element, theme, themeAsset);
6477
+ destroy() {
6478
+ if (this.isDestroyed) {
6479
+ return;
6480
+ }
6481
+ this.element.removeEventListener('mouseenter', this.mouseEnter, false);
6482
+ this.element.removeEventListener('mouseleave', this.mouseLeave, false);
6483
+ super.destroy();
6590
6484
  }
6591
6485
  // --------------------------------------------------------------------------
6592
6486
  //
6593
- // Private Methods
6487
+ // Public Properties
6594
6488
  //
6595
6489
  // --------------------------------------------------------------------------
6596
- commitSourceProperties() {
6597
- this.element.src = this.source;
6490
+ get isHover() {
6491
+ return this._isHover;
6598
6492
  }
6599
- removeSourceProperties() {
6600
- this.element.src = null;
6493
+ set isHover(value) {
6494
+ if (value === this._isHover) {
6495
+ return;
6496
+ }
6497
+ this._isHover = value;
6498
+ this.stylePropertiesCheck();
6499
+ }
6500
+ get key() {
6501
+ return super.key;
6502
+ }
6503
+ set key(value) {
6504
+ super.key = value;
6505
+ }
6506
+ get styleName() {
6507
+ return super.styleName;
6508
+ }
6509
+ set styleName(value) {
6510
+ super.styleName = value;
6511
+ }
6512
+ get flags() {
6513
+ return super.flags;
6514
+ }
6515
+ set flags(value) {
6516
+ super.flags = value;
6601
6517
  }
6602
6518
  }
6603
- ThemeAssetImageDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ThemeAssetImageDirective, deps: [{ token: i0.ElementRef }, { token: i1$1.ThemeService }, { token: i1$1.ThemeAssetService }], target: i0.ɵɵFactoryTarget.Directive });
6604
- ThemeAssetImageDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: ThemeAssetImageDirective, selector: "[vi-theme-image]", usesInheritance: true, ngImport: i0 });
6605
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ThemeAssetImageDirective, decorators: [{
6519
+ ThemeStyleHoverDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ThemeStyleHoverDirective, deps: [{ token: i0.ElementRef }, { token: i1$1.ThemeService }], target: i0.ɵɵFactoryTarget.Directive });
6520
+ ThemeStyleHoverDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: ThemeStyleHoverDirective, selector: "[vi-theme-style-hover]", inputs: { key: ["vi-theme-style-hover", "key"], styleName: "styleName", flags: "flags" }, usesInheritance: true, ngImport: i0 });
6521
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ThemeStyleHoverDirective, decorators: [{
6606
6522
  type: Directive,
6607
6523
  args: [{
6608
- selector: '[vi-theme-image]'
6524
+ selector: '[vi-theme-style-hover]'
6609
6525
  }]
6610
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$1.ThemeService }, { type: i1$1.ThemeAssetService }]; } });
6526
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$1.ThemeService }]; }, propDecorators: { key: [{
6527
+ type: Input,
6528
+ args: ['vi-theme-style-hover']
6529
+ }], styleName: [{
6530
+ type: Input
6531
+ }], flags: [{
6532
+ type: Input
6533
+ }] } });
6611
6534
 
6612
- class ThemeToggleDirective extends Destroyable {
6535
+ let declarations = [ThemeToggleDirective, ThemeAssetImageDirective, ThemeAssetBackgroundDirective, ThemeStyleDirective, ThemeStyleHoverDirective];
6536
+ class ThemeModule {
6537
+ // --------------------------------------------------------------------------
6538
+ //
6539
+ // Static Methods
6540
+ //
6541
+ // --------------------------------------------------------------------------
6542
+ static forRoot(options) {
6543
+ return {
6544
+ ngModule: ThemeModule,
6545
+ providers: [
6546
+ {
6547
+ provide: THEME_OPTIONS,
6548
+ useValue: options || {}
6549
+ },
6550
+ {
6551
+ provide: ThemeService,
6552
+ deps: [NativeWindowService, CookieService, THEME_OPTIONS],
6553
+ useFactory: themeServiceFactory
6554
+ },
6555
+ {
6556
+ provide: ThemeAssetService,
6557
+ deps: [ThemeService, NativeWindowService],
6558
+ useFactory: themeAssetServiceFactory
6559
+ }
6560
+ ]
6561
+ };
6562
+ }
6563
+ }
6564
+ ThemeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ThemeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
6565
+ ThemeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ThemeModule, declarations: [ThemeToggleDirective, ThemeAssetImageDirective, ThemeAssetBackgroundDirective, ThemeStyleDirective, ThemeStyleHoverDirective], imports: [CookieModule], exports: [ThemeToggleDirective, ThemeAssetImageDirective, ThemeAssetBackgroundDirective, ThemeStyleDirective, ThemeStyleHoverDirective] });
6566
+ ThemeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ThemeModule, imports: [[CookieModule]] });
6567
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ThemeModule, decorators: [{
6568
+ type: NgModule,
6569
+ args: [{
6570
+ imports: [CookieModule],
6571
+ declarations,
6572
+ exports: declarations
6573
+ }]
6574
+ }] });
6575
+ function themeServiceFactory(nativeWindow, cookie, options) {
6576
+ if (!_.isNil(options) && _.isNil(options.service)) {
6577
+ options.service = cookie;
6578
+ }
6579
+ return new ThemeService(options, nativeWindow.document);
6580
+ }
6581
+ function themeAssetServiceFactory(theme) {
6582
+ return new ThemeAssetService(theme);
6583
+ }
6584
+ const THEME_OPTIONS = new InjectionToken(`THEME_OPTIONS`);
6585
+
6586
+ class WindowService extends Destroyable {
6587
+ // public topZIndex: number = 1001;
6613
6588
  // --------------------------------------------------------------------------
6614
6589
  //
6615
- // Constructor
6590
+ // Constructor
6616
6591
  //
6617
6592
  // --------------------------------------------------------------------------
6618
- constructor(theme) {
6593
+ constructor(dialog, language, cookies, sheet) {
6619
6594
  super();
6620
- this.theme = theme;
6595
+ this.sheet = sheet;
6596
+ this.isNeedCheckPositionAfterOpen = true;
6597
+ this.gapX = 25;
6598
+ this.gapY = 25;
6599
+ this.minWidth = 100;
6600
+ this.minHeight = 100;
6601
+ this.paddingTop = 25;
6602
+ this.paddingLeft = 25;
6603
+ this.paddingRight = 25;
6604
+ this.paddingBottom = 25;
6605
+ this.defaultVerticalAlign = WindowAlign.CENTER;
6606
+ this.defaultHorizontalAlign = WindowAlign.CENTER;
6607
+ this.topZIndex = WindowService.Z_INDEX_MAX;
6608
+ this._windows = new Map();
6609
+ this.dialog = dialog;
6610
+ this.language = language;
6611
+ this.observer = new Subject();
6612
+ this.properties = new PropertiesManager(cookies);
6613
+ this.factory = new WindowFactory(WindowBaseComponent);
6614
+ this.questionComponent = WindowQuestionComponent;
6621
6615
  }
6622
6616
  // --------------------------------------------------------------------------
6623
6617
  //
6624
- // Event Handlers
6618
+ // Static Methods
6625
6619
  //
6626
6620
  // --------------------------------------------------------------------------
6627
- clickHandler(event) {
6628
- let themes = this.theme.themes.collection;
6629
- let length = themes.length;
6630
- if (length < 2) {
6621
+ static getZIndex(window) {
6622
+ return !_.isNil(window) && !_.isNil(window.container) ? parseInt(ViewUtil.getStyle(window.container.parentElement, 'zIndex'), 10) : -1;
6623
+ }
6624
+ static setZIndex(window, index) {
6625
+ if (_.isNil(window)) {
6631
6626
  return;
6632
6627
  }
6633
- let index = 0;
6634
- if (this.theme.theme) {
6635
- index = themes.indexOf(this.theme.theme);
6636
- if (index < length - 1) {
6637
- index++;
6638
- }
6639
- else {
6640
- index = 0;
6641
- }
6628
+ if (!_.isNil(window.backdrop)) {
6629
+ ViewUtil.setStyle(window.backdrop, 'zIndex', index);
6630
+ }
6631
+ if (!_.isNil(window.wrapper)) {
6632
+ ViewUtil.setStyle(window.wrapper, 'zIndex', index);
6642
6633
  }
6643
- this.theme.theme = themes[index];
6644
6634
  }
6645
6635
  // --------------------------------------------------------------------------
6646
6636
  //
6647
- // Public Methods
6637
+ // Private Methods
6648
6638
  //
6649
6639
  // --------------------------------------------------------------------------
6650
- destroy() {
6651
- if (this.isDestroyed) {
6640
+ sortFunction(first, second) {
6641
+ return WindowService.getZIndex(first) > WindowService.getZIndex(second) ? -1 : 1;
6642
+ }
6643
+ updateTop() {
6644
+ let zIndex = 0;
6645
+ let topWindow = null;
6646
+ let windows = [...this.windowsArray, this.sheet.window];
6647
+ for (let window of windows) {
6648
+ if (_.isNil(window) || _.isNil(window.container)) {
6649
+ continue;
6650
+ }
6651
+ let index = WindowService.getZIndex(window);
6652
+ if (zIndex >= index) {
6653
+ continue;
6654
+ }
6655
+ zIndex = index;
6656
+ topWindow = window;
6657
+ }
6658
+ if (_.isNil(topWindow) || topWindow.isOnTop) {
6652
6659
  return;
6653
6660
  }
6654
- super.destroy();
6655
- this.theme = null;
6661
+ topWindow.isOnTop = true;
6662
+ this.observer.next(new ObservableData(WindowServiceEvent.SETTED_ON_TOP, topWindow));
6663
+ }
6664
+ setWindowOnTop(topWindow) {
6665
+ let currentIndex = this.topZIndex - 2;
6666
+ let windows = [...this.windowsArray, this.sheet.window];
6667
+ for (let window of windows) {
6668
+ if (_.isNil(window) || _.isNil(window.container)) {
6669
+ continue;
6670
+ }
6671
+ window.isOnTop = window === topWindow;
6672
+ let zIndex = window.isOnTop ? this.topZIndex : currentIndex--;
6673
+ WindowService.setZIndex(window, zIndex);
6674
+ }
6675
+ this.windowsArray.sort(this.sortFunction);
6676
+ this.observer.next(new ObservableData(WindowServiceEvent.SETTED_ON_TOP, topWindow));
6677
+ }
6678
+ checkPosition(item) {
6679
+ while (this.hasSamePosition(item)) {
6680
+ item.move(item.getX() + this.gapX, item.getY() + this.gapY);
6681
+ }
6682
+ }
6683
+ hasSamePosition(itemWindow) {
6684
+ let x = itemWindow.getX();
6685
+ let y = itemWindow.getY();
6686
+ let result = false;
6687
+ this.windowsArray.forEach(window => {
6688
+ if (window !== itemWindow && x === window.getX() && y === window.getY()) {
6689
+ result = true;
6690
+ }
6691
+ });
6692
+ return result;
6656
6693
  }
6657
- }
6658
- ThemeToggleDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ThemeToggleDirective, deps: [{ token: i1$1.ThemeService }], target: i0.ɵɵFactoryTarget.Directive });
6659
- ThemeToggleDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: ThemeToggleDirective, selector: "[vi-theme-toggle]", host: { listeners: { "click": "clickHandler($event)" } }, usesInheritance: true, ngImport: i0 });
6660
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ThemeToggleDirective, decorators: [{
6661
- type: Directive,
6662
- args: [{
6663
- selector: '[vi-theme-toggle]'
6664
- }]
6665
- }], ctorParameters: function () { return [{ type: i1$1.ThemeService }]; }, propDecorators: { clickHandler: [{
6666
- type: HostListener,
6667
- args: ['click', ['$event']]
6668
- }] } });
6669
-
6670
- class ThemeStyleDirective extends Destroyable {
6671
6694
  // --------------------------------------------------------------------------
6672
6695
  //
6673
- // Constructor
6696
+ // Setters Methods
6674
6697
  //
6675
6698
  // --------------------------------------------------------------------------
6676
- constructor(element, theme) {
6677
- super();
6678
- this.theme = theme;
6679
- this.element = ViewUtil.parseElement(element.nativeElement);
6680
- this.theme.changed.pipe(takeUntil(this.destroyed)).subscribe(() => this.stylePropertiesAdd());
6699
+ add(config, content) {
6700
+ this._windows.set(config, content);
6701
+ this.observer.next(new ObservableData(WindowServiceEvent.OPENED, content.window));
6702
+ }
6703
+ remove(config) {
6704
+ let window = this._windows.get(config);
6705
+ if (!window) {
6706
+ return null;
6707
+ }
6708
+ window.close();
6709
+ this._windows.delete(config);
6710
+ this.observer.next(new ObservableData(WindowServiceEvent.CLOSED, window.window));
6711
+ }
6712
+ getById(id) {
6713
+ let item = _.find(Array.from(this._windows.values()), item => item.config.id === id);
6714
+ return !_.isNil(item) ? item.window : null;
6715
+ }
6716
+ setDefaultProperties(config) {
6717
+ if (!config.verticalAlign) {
6718
+ config.verticalAlign = this.defaultVerticalAlign;
6719
+ }
6720
+ if (!config.horizontalAlign) {
6721
+ config.horizontalAlign = this.defaultHorizontalAlign;
6722
+ }
6723
+ if (_.isNaN(config.defaultMinWidth)) {
6724
+ config.defaultMinWidth = this.minWidth;
6725
+ }
6726
+ if (_.isNaN(config.defaultMinHeight)) {
6727
+ config.defaultMinHeight = this.minHeight;
6728
+ }
6729
+ if (_.isNaN(config.paddingTop)) {
6730
+ config.paddingTop = this.paddingTop;
6731
+ }
6732
+ if (_.isNaN(config.paddingLeft)) {
6733
+ config.paddingLeft = this.paddingLeft;
6734
+ }
6735
+ if (_.isNaN(config.paddingRight)) {
6736
+ config.paddingRight = this.paddingRight;
6737
+ }
6738
+ if (_.isNaN(config.paddingBottom)) {
6739
+ config.paddingBottom = this.paddingBottom;
6740
+ }
6741
+ if (config.propertiesId) {
6742
+ this.properties.load(config.propertiesId, config);
6743
+ }
6744
+ config.setDefaultProperties();
6681
6745
  }
6682
6746
  // --------------------------------------------------------------------------
6683
6747
  //
6684
- // Protected Methods
6748
+ // Public Methods
6685
6749
  //
6686
6750
  // --------------------------------------------------------------------------
6687
- commitStyleProperties(name, value) {
6688
- ViewUtil.setStyle(this.element, name, value, this.flags);
6751
+ open(component, config) {
6752
+ let window = null;
6753
+ if (config.id) {
6754
+ window = this.getById(config.id);
6755
+ if (window) {
6756
+ return window.content;
6757
+ }
6758
+ }
6759
+ this.setDefaultProperties(config);
6760
+ // let dialog = this.dialog as any;
6761
+ // dialog._getOverlayState = config.isModal ? dialog.getOverlayStateModal : dialog.getOverlayStateNonModal;
6762
+ let reference = this.dialog.open(component, config);
6763
+ window = this.factory.create({ config, reference, overlay: reference._overlayRef });
6764
+ this.observer.next(new ObservableData(WindowServiceEvent.OPEN_STARTED, window));
6765
+ let subscription = window.events.subscribe(event => {
6766
+ switch (event) {
6767
+ case WindowEvent.OPENED:
6768
+ this.add(config, reference.componentInstance);
6769
+ this.setWindowOnTop(window);
6770
+ if (this.isNeedCheckPositionAfterOpen) {
6771
+ this.checkPosition(window);
6772
+ }
6773
+ this.observer.next(new ObservableData(WindowServiceEvent.OPEN_FINISHED, window));
6774
+ break;
6775
+ case WindowEvent.CLOSED:
6776
+ subscription.unsubscribe();
6777
+ this.remove(config);
6778
+ if (window.isOnTop && this.windows.size > 0) {
6779
+ this.updateTop();
6780
+ }
6781
+ break;
6782
+ case WindowEvent.RESIZED:
6783
+ if (!_.isNil(config.propertiesId)) {
6784
+ this.properties.save(config.propertiesId, window);
6785
+ }
6786
+ break;
6787
+ case WindowEvent.SET_ON_TOP:
6788
+ this.setWindowOnTop(window);
6789
+ break;
6790
+ }
6791
+ });
6792
+ return window.content;
6689
6793
  }
6690
- stylePropertiesCheck() {
6691
- if (this.isNeedStyleAdd()) {
6692
- this.stylePropertiesAdd();
6794
+ get(value) {
6795
+ let id = value.toString();
6796
+ if (value instanceof WindowConfig) {
6797
+ id = value.id;
6693
6798
  }
6694
- else if (this.isNeedStyleRemove()) {
6695
- this.stylePropertiesRemove();
6799
+ if (!id) {
6800
+ return null;
6696
6801
  }
6802
+ let window = this.getById(id);
6803
+ if (_.isNil(window)) {
6804
+ return null;
6805
+ }
6806
+ return window.content;
6697
6807
  }
6698
- stylePropertiesRemove() {
6699
- ViewUtil.removeStyle(this.element, this.styleName);
6700
- }
6701
- stylePropertiesAdd() {
6702
- this.commitStyleProperties(this.styleName, this.theme.getStyle(this.key));
6808
+ has(value) {
6809
+ return !_.isNil(this.get(value));
6703
6810
  }
6704
- isNeedStyleAdd() {
6705
- return !_.isNil(this.theme.theme) && !_.isNil(this.styleName);
6811
+ setOnTop(value) {
6812
+ let content = this.get(value);
6813
+ if (!content) {
6814
+ return false;
6815
+ }
6816
+ content.window.setOnTop();
6817
+ return true;
6706
6818
  }
6707
- isNeedStyleRemove() {
6708
- return !_.isNil(this.styleName);
6819
+ removeAll() {
6820
+ this.windowsArray.forEach(window => window.close());
6709
6821
  }
6710
- // --------------------------------------------------------------------------
6711
- //
6712
- // Public Methods
6713
- //
6714
- // --------------------------------------------------------------------------
6715
6822
  destroy() {
6716
6823
  if (this.isDestroyed) {
6717
6824
  return;
6718
6825
  }
6719
6826
  super.destroy();
6720
- this.key = null;
6721
- this.theme = null;
6722
- this.element = null;
6827
+ this.removeAll();
6828
+ if (!_.isNil(this.observer)) {
6829
+ this.observer.complete();
6830
+ this.observer = null;
6831
+ }
6832
+ if (!_.isNil(this.properties)) {
6833
+ this.properties.destroy();
6834
+ this.properties = null;
6835
+ }
6836
+ this.factory = null;
6837
+ this.questionComponent = null;
6838
+ this.dialog = null;
6839
+ this.language = null;
6840
+ this._windows = null;
6723
6841
  }
6724
6842
  // --------------------------------------------------------------------------
6725
6843
  //
6726
- // Public Properties
6844
+ // Additional Methods
6727
6845
  //
6728
6846
  // --------------------------------------------------------------------------
6729
- get flags() {
6730
- return this._flags;
6731
- }
6732
- set flags(value) {
6733
- if (value === this._flags) {
6734
- return;
6735
- }
6736
- this._flags = value;
6737
- this.stylePropertiesCheck();
6738
- }
6739
- get styleName() {
6740
- return this._styleName;
6741
- }
6742
- set styleName(value) {
6743
- if (value === this._styleName) {
6744
- return;
6745
- }
6746
- this._styleName = value;
6747
- this.stylePropertiesCheck();
6748
- }
6749
- get key() {
6750
- return this._key;
6847
+ info(translationId, translation, questionOptions, configOptions) {
6848
+ let text = this.language.translate(translationId, translation);
6849
+ let config = _.assign(new WindowConfig(true, false, 450), configOptions);
6850
+ config.data = new QuestionManager(_.assign(questionOptions, { mode: QuestionMode.INFO, text }));
6851
+ return this.open(this.questionComponent, config).config.data;
6751
6852
  }
6752
- set key(value) {
6753
- if (value === this._key) {
6754
- return;
6755
- }
6756
- this._key = value;
6757
- if (!_.isNil(value)) {
6758
- this.stylePropertiesCheck();
6759
- }
6853
+ question(translationId, translation, questionOptions, configOptions) {
6854
+ let text = this.language.translate(translationId, translation);
6855
+ let config = _.assign(new WindowConfig(true, false, 450), configOptions);
6856
+ config.data = new QuestionManager(_.assign(questionOptions, { mode: QuestionMode.QUESTION, text }));
6857
+ return this.open(this.questionComponent, config).config.data;
6760
6858
  }
6761
- }
6762
- ThemeStyleDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ThemeStyleDirective, deps: [{ token: i0.ElementRef }, { token: i1$1.ThemeService }], target: i0.ɵɵFactoryTarget.Directive });
6763
- ThemeStyleDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: ThemeStyleDirective, selector: "[vi-theme-style]", inputs: { flags: "flags", styleName: "styleName", key: ["vi-theme-style", "key"] }, usesInheritance: true, ngImport: i0 });
6764
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ThemeStyleDirective, decorators: [{
6765
- type: Directive,
6766
- args: [{
6767
- selector: '[vi-theme-style]'
6768
- }]
6769
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$1.ThemeService }]; }, propDecorators: { flags: [{
6770
- type: Input
6771
- }], styleName: [{
6772
- type: Input
6773
- }], key: [{
6774
- type: Input,
6775
- args: ['vi-theme-style']
6776
- }] } });
6777
-
6778
- class ThemeStyleHoverDirective extends ThemeStyleDirective {
6779
6859
  // --------------------------------------------------------------------------
6780
6860
  //
6781
- // Constructor
6861
+ // Private Properties
6782
6862
  //
6783
6863
  // --------------------------------------------------------------------------
6784
- constructor(element, theme) {
6785
- super(element, theme);
6786
- // --------------------------------------------------------------------------
6787
- //
6788
- // Properties
6789
- //
6790
- // --------------------------------------------------------------------------
6791
- this._isHover = false;
6792
- // --------------------------------------------------------------------------
6793
- //
6794
- // Event Handlers
6795
- //
6796
- // --------------------------------------------------------------------------
6797
- this.mouseEnter = (event) => {
6798
- this.isHover = true;
6799
- };
6800
- this.mouseLeave = (event) => {
6801
- this.isHover = false;
6802
- };
6803
- this.flags = RendererStyleFlags2.Important;
6804
- this.element.addEventListener('mouseenter', this.mouseEnter, false);
6805
- this.element.addEventListener('mouseleave', this.mouseLeave, false);
6864
+ get windowsArray() {
6865
+ return Array.from(this.windows.values()).map(item => item.window);
6806
6866
  }
6807
6867
  // --------------------------------------------------------------------------
6808
6868
  //
6809
- // Protected Methods
6869
+ // Public Properties
6810
6870
  //
6811
6871
  // --------------------------------------------------------------------------
6812
- isNeedStyleAdd() {
6813
- return this.isHover && super.isNeedStyleAdd();
6872
+ get events() {
6873
+ return this.observer.asObservable();
6814
6874
  }
6815
- isNeedStyleRemove() {
6816
- return !this.isHover || super.isNeedStyleRemove();
6875
+ get windows() {
6876
+ return this._windows;
6817
6877
  }
6878
+ }
6879
+ // --------------------------------------------------------------------------
6880
+ //
6881
+ // Constants
6882
+ //
6883
+ // --------------------------------------------------------------------------
6884
+ WindowService.Z_INDEX_MAX = 1000;
6885
+ WindowService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowService, deps: [{ token: i1.MatDialog }, { token: i1$1.LanguageService }, { token: CookieService }, { token: BottomSheetService }], target: i0.ɵɵFactoryTarget.Injectable });
6886
+ WindowService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowService, providedIn: 'root' });
6887
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowService, decorators: [{
6888
+ type: Injectable,
6889
+ args: [{ providedIn: 'root' }]
6890
+ }], ctorParameters: function () { return [{ type: i1.MatDialog }, { type: i1$1.LanguageService }, { type: CookieService }, { type: BottomSheetService }]; } });
6891
+ class PropertiesManager extends Destroyable {
6818
6892
  // --------------------------------------------------------------------------
6819
6893
  //
6820
- // Public Methods
6894
+ // Constructor
6821
6895
  //
6822
6896
  // --------------------------------------------------------------------------
6823
- destroy() {
6824
- if (this.isDestroyed) {
6825
- return;
6826
- }
6827
- this.element.removeEventListener('mouseenter', this.mouseEnter, false);
6828
- this.element.removeEventListener('mouseleave', this.mouseLeave, false);
6829
- super.destroy();
6897
+ constructor(cookies) {
6898
+ super();
6899
+ this.cookies = cookies;
6830
6900
  }
6831
6901
  // --------------------------------------------------------------------------
6832
6902
  //
6833
- // Public Properties
6903
+ // Public Methods
6834
6904
  //
6835
6905
  // --------------------------------------------------------------------------
6836
- get isHover() {
6837
- return this._isHover;
6838
- }
6839
- set isHover(value) {
6840
- if (value === this._isHover) {
6906
+ load(name, config) {
6907
+ let item = this.cookies.getObject(name + 'Window');
6908
+ if (!item) {
6841
6909
  return;
6842
6910
  }
6843
- this._isHover = value;
6844
- this.stylePropertiesCheck();
6845
- }
6846
- get key() {
6847
- return super.key;
6848
- }
6849
- set key(value) {
6850
- super.key = value;
6851
- }
6852
- get styleName() {
6853
- return super.styleName;
6854
- }
6855
- set styleName(value) {
6856
- super.styleName = value;
6857
- }
6858
- get flags() {
6859
- return super.flags;
6860
- }
6861
- set flags(value) {
6862
- super.flags = value;
6911
+ if (item.hasOwnProperty('width')) {
6912
+ config.defaultWidth = item.width;
6913
+ }
6914
+ if (item.hasOwnProperty('height')) {
6915
+ config.defaultHeight = item.height;
6916
+ }
6863
6917
  }
6864
- }
6865
- ThemeStyleHoverDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ThemeStyleHoverDirective, deps: [{ token: i0.ElementRef }, { token: i1$1.ThemeService }], target: i0.ɵɵFactoryTarget.Directive });
6866
- ThemeStyleHoverDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: ThemeStyleHoverDirective, selector: "[vi-theme-style-hover]", inputs: { key: ["vi-theme-style-hover", "key"], styleName: "styleName", flags: "flags" }, usesInheritance: true, ngImport: i0 });
6867
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ThemeStyleHoverDirective, decorators: [{
6868
- type: Directive,
6869
- args: [{
6870
- selector: '[vi-theme-style-hover]'
6871
- }]
6872
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$1.ThemeService }]; }, propDecorators: { key: [{
6873
- type: Input,
6874
- args: ['vi-theme-style-hover']
6875
- }], styleName: [{
6876
- type: Input
6877
- }], flags: [{
6878
- type: Input
6879
- }] } });
6880
-
6881
- let declarations = [ThemeToggleDirective, ThemeAssetImageDirective, ThemeAssetBackgroundDirective, ThemeStyleDirective, ThemeStyleHoverDirective];
6882
- class ThemeModule {
6883
- // --------------------------------------------------------------------------
6884
- //
6885
- // Static Methods
6886
- //
6887
- // --------------------------------------------------------------------------
6888
- static forRoot(options) {
6889
- return {
6890
- ngModule: ThemeModule,
6891
- providers: [
6892
- {
6893
- provide: THEME_OPTIONS,
6894
- useValue: options || {}
6895
- },
6896
- {
6897
- provide: ThemeService,
6898
- deps: [NativeWindowService, CookieService, THEME_OPTIONS],
6899
- useFactory: themeServiceFactory
6900
- },
6901
- {
6902
- provide: ThemeAssetService,
6903
- deps: [ThemeService, NativeWindowService],
6904
- useFactory: themeAssetServiceFactory
6905
- }
6906
- ]
6907
- };
6918
+ save(name, window) {
6919
+ this.cookies.putObject(name + 'Window', {
6920
+ width: window.getWidth(),
6921
+ height: window.getHeight()
6922
+ });
6908
6923
  }
6909
- }
6910
- ThemeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ThemeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
6911
- ThemeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ThemeModule, declarations: [ThemeToggleDirective, ThemeAssetImageDirective, ThemeAssetBackgroundDirective, ThemeStyleDirective, ThemeStyleHoverDirective], imports: [CookieModule], exports: [ThemeToggleDirective, ThemeAssetImageDirective, ThemeAssetBackgroundDirective, ThemeStyleDirective, ThemeStyleHoverDirective] });
6912
- ThemeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ThemeModule, imports: [[CookieModule]] });
6913
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ThemeModule, decorators: [{
6914
- type: NgModule,
6915
- args: [{
6916
- imports: [CookieModule],
6917
- declarations,
6918
- exports: declarations
6919
- }]
6920
- }] });
6921
- function themeServiceFactory(nativeWindow, cookie, options) {
6922
- if (!_.isNil(options) && _.isNil(options.service)) {
6923
- options.service = cookie;
6924
+ destroy() {
6925
+ if (this.isDestroyed) {
6926
+ return;
6927
+ }
6928
+ super.destroy();
6929
+ this.cookies = null;
6924
6930
  }
6925
- return new ThemeService(options, nativeWindow.document);
6926
6931
  }
6927
- function themeAssetServiceFactory(theme) {
6928
- return new ThemeAssetService(theme);
6929
- }
6930
- const THEME_OPTIONS = new InjectionToken(`THEME_OPTIONS`);
6931
6932
 
6932
6933
  class WindowDragAreaDirective extends Destroyable {
6933
6934
  // --------------------------------------------------------------------------