@ts-core/angular 13.0.49 → 13.0.50

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.
@@ -3335,8 +3335,8 @@ class WindowFactory {
3335
3335
  // Constructor
3336
3336
  //
3337
3337
  // --------------------------------------------------------------------------
3338
- constructor(classType) {
3339
- this.classType = classType;
3338
+ constructor(defaultType) {
3339
+ this.defaultType = defaultType;
3340
3340
  }
3341
3341
  // --------------------------------------------------------------------------
3342
3342
  //
@@ -3344,887 +3344,411 @@ class WindowFactory {
3344
3344
  //
3345
3345
  // --------------------------------------------------------------------------
3346
3346
  create(properties) {
3347
- return new this.classType(properties);
3347
+ let item = null;
3348
+ if (!_.isNil(this.createFunction)) {
3349
+ item = this.createFunction(properties);
3350
+ }
3351
+ if (_.isNil(item)) {
3352
+ item = new this.defaultType(properties);
3353
+ }
3354
+ return item;
3348
3355
  }
3349
3356
  }
3350
3357
 
3351
- class WindowBase extends DestroyableContainer {
3358
+ class IWindowContent extends DestroyableContainer {
3352
3359
  // --------------------------------------------------------------------------
3353
3360
  //
3354
- // Constructor
3361
+ // Constructor
3355
3362
  //
3356
3363
  // --------------------------------------------------------------------------
3357
- constructor() {
3364
+ constructor(container) {
3358
3365
  super();
3359
- // --------------------------------------------------------------------------
3360
- //
3361
- // Properties
3362
- //
3363
- // --------------------------------------------------------------------------
3364
- this._x = NaN;
3365
- this._width = NaN;
3366
- this._y = NaN;
3367
- this._height = NaN;
3368
- this.updatePosition = () => this.setPosition();
3366
+ this.container = container;
3369
3367
  }
3370
- setProperties() {
3371
- let config = this.getConfig();
3372
- if (!_.isNaN(config.defaultWidth)) {
3373
- this.width = config.defaultWidth;
3374
- }
3375
- if (!_.isNaN(config.defaultHeight)) {
3376
- this.height = config.defaultHeight;
3377
- }
3368
+ // --------------------------------------------------------------------------
3369
+ //
3370
+ // Private Methods
3371
+ //
3372
+ // --------------------------------------------------------------------------
3373
+ commitWindowProperties() {
3374
+ this.commitConfigProperties();
3378
3375
  }
3379
- setPosition() {
3380
- let config = this.getConfig();
3381
- switch (config.horizontalAlign) {
3382
- case WindowAlign.START:
3383
- this.x = !_.isNaN(this.paddingLeft) ? this.paddingLeft : 0;
3384
- break;
3385
- case WindowAlign.END:
3386
- let value = ViewUtil.getStageWidth() - this.calculateWidth();
3387
- if (!_.isNaN(this.paddingRight)) {
3388
- value -= this.paddingRight;
3389
- }
3390
- this.x = value;
3391
- break;
3392
- default:
3393
- this.x = (ViewUtil.getStageWidth() - this.calculateWidth()) / 2;
3394
- break;
3376
+ commitConfigProperties() { }
3377
+ // --------------------------------------------------------------------------
3378
+ //
3379
+ // Public Methods
3380
+ //
3381
+ // --------------------------------------------------------------------------
3382
+ ngAfterViewInit() {
3383
+ this.emit(WindowEvent.CONTENT_READY);
3384
+ }
3385
+ ngOnDestroy() {
3386
+ // do nothing, window will destroy content after closing
3387
+ }
3388
+ blink() {
3389
+ if (!_.isNil(this.window)) {
3390
+ this.window.blink();
3395
3391
  }
3396
- switch (config.verticalAlign) {
3397
- case WindowAlign.START:
3398
- this.y = !_.isNaN(this.paddingTop) ? this.paddingTop : 0;
3399
- break;
3400
- case WindowAlign.END:
3401
- let value = ViewUtil.getStageHeight() - this.calculateHeight();
3402
- if (!_.isNaN(this.paddingBottom)) {
3403
- value -= this.paddingBottom;
3404
- }
3405
- this.y = value;
3406
- break;
3407
- default:
3408
- this.y = (ViewUtil.getStageHeight() - this.calculateHeight()) / 2;
3409
- break;
3392
+ }
3393
+ shake() {
3394
+ if (!_.isNil(this.window)) {
3395
+ this.window.shake();
3410
3396
  }
3411
3397
  }
3412
- clearSize() {
3413
- this._x = NaN;
3414
- this._y = NaN;
3415
- this._width = NaN;
3416
- this._height = NaN;
3398
+ emit(event) {
3399
+ if (!_.isNil(this.window)) {
3400
+ this.window.emit(event);
3401
+ }
3417
3402
  }
3418
- commitSizeProperties() {
3419
- let width = !_.isNaN(this.width) ? this.width + 'px' : 'auto';
3420
- let height = !_.isNaN(this.height) ? this.height + 'px' : 'auto';
3421
- this.getReference().updateSize(width, height);
3403
+ close() {
3404
+ if (!_.isNil(this.window)) {
3405
+ this.window.close();
3406
+ }
3422
3407
  }
3423
- commitPositionProperties() {
3424
- if (_.isNaN(this._x) && _.isNaN(this._y)) {
3408
+ destroy() {
3409
+ if (this.isDestroyed) {
3425
3410
  return;
3426
3411
  }
3427
- let position = {};
3428
- if (!_.isNaN(this._y)) {
3429
- position.top = this._y + 'px';
3430
- }
3431
- if (!_.isNaN(this._x)) {
3432
- position.left = this._x + 'px';
3433
- }
3434
- this.getReference().updatePosition(position);
3412
+ super.destroy();
3413
+ this.window = null;
3414
+ this.container = null;
3435
3415
  }
3436
3416
  // --------------------------------------------------------------------------
3437
3417
  //
3438
- // Public Methods
3418
+ // Proxy Public Properties
3439
3419
  //
3440
3420
  // --------------------------------------------------------------------------
3441
- calculateWidth() {
3442
- return !_.isNaN(this.width) ? this.width : ViewUtil.getWidth(this.getContainer());
3421
+ get data() {
3422
+ return !_.isNil(this.config) ? this.config.data : null;
3443
3423
  }
3444
- calculateHeight() {
3445
- return !_.isNaN(this.height) ? this.height : ViewUtil.getHeight(this.getContainer());
3424
+ get isOnTop() {
3425
+ return !_.isNil(this.window) ? this.window.isOnTop : false;
3446
3426
  }
3447
- // --------------------------------------------------------------------------
3448
- //
3449
- // Private Properties
3450
- //
3451
- // --------------------------------------------------------------------------
3452
- get width() {
3453
- return this._width;
3427
+ get isMinimized() {
3428
+ return !_.isNil(this.window) ? this.window.isMinimized : false;
3454
3429
  }
3455
- set width(value) {
3456
- value = this.getConfig().parseWidth(value);
3457
- if (value === this._width) {
3458
- return;
3459
- }
3460
- this._width = value;
3461
- this.commitSizeProperties();
3430
+ get events() {
3431
+ return !_.isNil(this.window) ? this.window.events : null;
3462
3432
  }
3463
- get height() {
3464
- return this._height;
3433
+ get isDisabled() {
3434
+ return !_.isNil(this.window) ? this.window.isDisabled : false;
3465
3435
  }
3466
- set height(value) {
3467
- value = this.getConfig().parseHeight(value);
3468
- if (value === this._height) {
3469
- return;
3436
+ set isDisabled(value) {
3437
+ if (!_.isNil(this.window)) {
3438
+ this.window.isDisabled = value;
3470
3439
  }
3471
- this._height = value;
3472
- this.commitSizeProperties();
3473
3440
  }
3474
3441
  // --------------------------------------------------------------------------
3475
3442
  //
3476
- // Public Properties
3443
+ // Public Properties
3477
3444
  //
3478
3445
  // --------------------------------------------------------------------------
3479
- get x() {
3480
- return this._x;
3481
- }
3482
- set x(value) {
3483
- value = this.getConfig().parseX(value);
3484
- if (value === this._x) {
3485
- return;
3446
+ get element() {
3447
+ if (_.isNil(this.container)) {
3448
+ return null;
3486
3449
  }
3487
- this._x = value;
3488
- this.commitPositionProperties();
3450
+ return this.container instanceof ViewContainerRef ? this.container.element : this.container;
3489
3451
  }
3490
- get y() {
3491
- return this._y;
3452
+ get config() {
3453
+ return !_.isNil(this.window) ? this.window.config : null;
3492
3454
  }
3493
- set y(value) {
3494
- value = this.getConfig().parseY(value);
3495
- if (value === this._y) {
3455
+ get window() {
3456
+ return this._window;
3457
+ }
3458
+ set window(value) {
3459
+ if (value === this._window) {
3496
3460
  return;
3497
3461
  }
3498
- this._y = value;
3499
- this.commitPositionProperties();
3500
- }
3501
- get paddingTop() {
3502
- return this.getConfig().paddingTop;
3503
- }
3504
- get paddingLeft() {
3505
- return this.getConfig().paddingLeft;
3506
- }
3507
- get paddingRight() {
3508
- return this.getConfig().paddingRight;
3462
+ this._window = value;
3463
+ if (!_.isNil(value)) {
3464
+ this.commitWindowProperties();
3465
+ }
3509
3466
  }
3510
- get paddingBottom() {
3511
- return this.getConfig().paddingBottom;
3467
+ }
3468
+ IWindowContent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: IWindowContent, deps: [{ token: WINDOW_CONTENT_CONTAINER, optional: true }], target: i0.ɵɵFactoryTarget.Component });
3469
+ IWindowContent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: IWindowContent, selector: "ng-component", inputs: { isDisabled: "isDisabled", window: "window" }, usesInheritance: true, ngImport: i0, template: '', isInline: true });
3470
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: IWindowContent, decorators: [{
3471
+ type: Component,
3472
+ args: [{ template: '' }]
3473
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
3474
+ type: Optional
3475
+ }, {
3476
+ type: Inject,
3477
+ args: [WINDOW_CONTENT_CONTAINER]
3478
+ }] }]; }, propDecorators: { isDisabled: [{
3479
+ type: Input
3480
+ }], window: [{
3481
+ type: Input
3482
+ }] } });
3483
+ const WINDOW_CONTENT_CONTAINER = new InjectionToken('WINDOW_CONTENT_CONTAINER');
3484
+
3485
+ class WindowQuestionBaseComponent extends IWindowContent {
3486
+ // --------------------------------------------------------------------------
3487
+ //
3488
+ // Protected Methods
3489
+ //
3490
+ // --------------------------------------------------------------------------
3491
+ commitConfigProperties() {
3492
+ super.commitConfigProperties();
3493
+ this.data.closePromise.then(() => {
3494
+ if (!this.isDestroyed) {
3495
+ this.close();
3496
+ }
3497
+ });
3512
3498
  }
3513
3499
  }
3514
3500
 
3515
- class WindowImpl extends WindowBase {
3501
+ class WindowQuestionComponent extends WindowQuestionBaseComponent {
3516
3502
  // --------------------------------------------------------------------------
3517
3503
  //
3518
- // Constructor
3504
+ // Constructor
3519
3505
  //
3520
3506
  // --------------------------------------------------------------------------
3521
- constructor(properties) {
3522
- super();
3523
- // --------------------------------------------------------------------------
3524
- //
3525
- // Properties
3526
- //
3527
- // --------------------------------------------------------------------------
3528
- this._isBlink = false;
3529
- this._isShaking = false;
3530
- this._isOnTop = false;
3531
- this._isDisabled = false;
3532
- this._isMinimized = false;
3533
- this.isOpened = false;
3534
- this.isWasOnTop = false;
3535
- // --------------------------------------------------------------------------
3536
- //
3537
- // Protected Methods
3538
- //
3539
- // --------------------------------------------------------------------------
3540
- this.setClosed = () => {
3541
- this.isOpened = false;
3542
- this.emit(WindowEvent.CLOSED);
3543
- this.destroy();
3544
- };
3545
- this.setOpened = () => {
3546
- this.isOpened = true;
3547
- this.emit(WindowEvent.OPENED);
3548
- };
3549
- this.blinkToggle = () => {
3550
- this.isBlink = !this.isBlink;
3551
- };
3552
- this.stopShaking = () => {
3553
- this.isShaking = false;
3554
- };
3555
- this.emitResize = () => {
3556
- this.emit(WindowEvent.RESIZED);
3557
- };
3558
- this.resizeHandler = () => {
3559
- if (!this.isOpened) {
3560
- return;
3561
- }
3562
- clearTimeout(this.resizeTimer);
3563
- this.resizeTimer = setTimeout(this.emitResize, WindowImpl.RESIZE_DELAY);
3564
- };
3565
- this.mouseDownHandlerProxy = (event) => {
3566
- this.mouseDownHandler(event);
3567
- };
3568
- this.mouseClickHandlerProxy = (event) => {
3569
- this.mouseClickHandler(event);
3570
- };
3571
- this.observer = new Subject();
3572
- this.elements = new Array();
3573
- this.properties = properties;
3574
- this.content.window = this;
3575
- // Have to save for unsubscribe on destroy
3576
- this._wrapper = this.properties.overlay.hostElement;
3577
- this._backdrop = this.properties.overlay.backdropElement;
3578
- this._container = this.properties.overlay.overlayElement;
3579
- this.setProperties();
3580
- this.getReference().afterOpened().pipe(takeUntil$1(this.destroyed)).subscribe(this.setOpened);
3581
- this.getReference().afterClosed().pipe(takeUntil$1(this.destroyed)).subscribe(this.setClosed);
3582
- this.events
3583
- .pipe(filter$1(event => event === WindowEvent.CONTENT_READY), takeUntil$1(this.destroyed))
3584
- .subscribe(this.updatePosition);
3507
+ constructor(container, language) {
3508
+ super(container);
3509
+ this.language = language;
3510
+ ViewUtil.addClasses(container.element, 'd-block');
3585
3511
  }
3586
3512
  // --------------------------------------------------------------------------
3587
3513
  //
3588
- // Elements Methods
3514
+ // Public Methods
3589
3515
  //
3590
3516
  // --------------------------------------------------------------------------
3591
- elementsCreate() {
3592
- this.elements = new Array();
3593
- }
3594
- elementsDestroy() {
3595
- this.elements.forEach(item => this.elementDestroy(item));
3596
- this.elements = null;
3597
- }
3598
- elementAdd(item) {
3599
- this.elements.push(item);
3600
- item.instance.window = this;
3601
- return item;
3602
- }
3603
- elementRemove(item) {
3604
- ArrayUtil.remove(this.elements, item);
3605
- this.elementDestroy(item);
3606
- return item;
3607
- }
3608
- elementDestroy(item) {
3609
- item.instance.window = null;
3610
- item.destroy();
3611
- return item;
3612
- }
3613
- setProperties() {
3614
- super.setProperties();
3615
- ViewUtil.addClass(this.container, 'vi-window');
3616
- ViewUtil.toggleClass(this.container, 'vi-modal', this.config.isModal);
3617
- this.container.addEventListener('click', this.mouseClickHandlerProxy, true);
3618
- if (!this.config.isModal) {
3619
- this.container.addEventListener('mousedown', this.mouseDownHandlerProxy);
3517
+ commitConfigProperties() {
3518
+ super.commitConfigProperties();
3519
+ if (!_.isNil(this.data.text)) {
3520
+ this.text = this.data.text.replace(/(?:\r\n|\r|\n)/g, `<br/>`);
3620
3521
  }
3621
- /*
3622
- if (!this.config.isModal) {
3623
- this.container.addEventListener('click', this.mouseClickHandlerProxy, true);
3624
- this.container.addEventListener('mousedown', this.mouseDownHandlerProxy);
3522
+ if (this.language.isHasTranslation(this.data.options.yesTextId)) {
3523
+ this.data.yesText = this.language.translate(this.data.options.yesTextId);
3625
3524
  }
3626
- */
3627
- this.elementsCreate();
3628
- }
3629
- commitIsBlinkProperties() { }
3630
- commitIsShakingProperties() { }
3631
- commitIsDisabledProperties() { }
3632
- commitIsMinimizedProperties() { }
3633
- getConfig() {
3634
- return this.properties.config;
3635
- }
3636
- getContainer() {
3637
- return this.container;
3638
- }
3639
- getReference() {
3640
- return this.properties.reference;
3641
- }
3642
- isNeedClickStopPropagation(event) {
3643
- // return !this.isWasOnTop;
3644
- if (this.isWasOnTop) {
3645
- return false;
3525
+ if (this.language.isHasTranslation(this.data.options.notTextId)) {
3526
+ this.data.notText = this.language.translate(this.data.options.notTextId);
3646
3527
  }
3647
- let element = _.find(this.elements, item => item.location.nativeElement === event.target);
3648
- if (_.isNil(element)) {
3649
- return false;
3528
+ if (this.language.isHasTranslation(this.data.options.checkTextId)) {
3529
+ this.data.checkText = this.language.translate(this.data.options.checkTextId);
3650
3530
  }
3651
- element.instance.clickHandler(event);
3652
- return true;
3653
- }
3654
- stopBlinkIfNeed() {
3655
- this.isBlink = false;
3656
- if (!this.blinkTimer) {
3657
- return;
3531
+ if (this.language.isHasTranslation(this.data.options.closeTextId)) {
3532
+ this.data.closeText = this.language.translate(this.data.options.closeTextId);
3658
3533
  }
3659
- clearInterval(this.blinkTimer);
3660
- this.blinkTimer = null;
3661
3534
  }
3662
- mouseDownHandler(event) {
3663
- this.setOnTop();
3535
+ }
3536
+ WindowQuestionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowQuestionComponent, deps: [{ token: i0.ViewContainerRef }, { token: i1$1.LanguageService }], target: i0.ɵɵFactoryTarget.Component });
3537
+ WindowQuestionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: WindowQuestionComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, 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>", components: [{ type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
3538
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowQuestionComponent, decorators: [{
3539
+ type: Component,
3540
+ 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>" }]
3541
+ }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i1$1.LanguageService }]; } });
3542
+
3543
+ class WindowElement extends DestroyableContainer {
3544
+ // --------------------------------------------------------------------------
3545
+ //
3546
+ // Constructor
3547
+ //
3548
+ // --------------------------------------------------------------------------
3549
+ constructor(element) {
3550
+ super();
3551
+ this.element = element;
3664
3552
  }
3665
- mouseClickHandler(event) {
3666
- if (this.isNeedClickStopPropagation(event)) {
3667
- event.stopPropagation();
3553
+ // --------------------------------------------------------------------------
3554
+ //
3555
+ // Private Methods
3556
+ //
3557
+ // --------------------------------------------------------------------------
3558
+ checkWindowParent() {
3559
+ let container = this.getContainer();
3560
+ if (!_.isNil(container)) {
3561
+ ViewUtil.appendChild(container, this.element.nativeElement);
3668
3562
  }
3669
- if (!this.isWasOnTop) {
3670
- this.isWasOnTop = true;
3563
+ }
3564
+ getContainer() {
3565
+ let item = ViewUtil.parseElement(this.element.nativeElement);
3566
+ while (!_.isNil(item) && item.nodeName.toLowerCase() !== 'mat-dialog-container') {
3567
+ item = item.parentElement;
3671
3568
  }
3569
+ return item;
3672
3570
  }
3571
+ createChildren() { }
3572
+ destroyChildren() { }
3573
+ commitWindowProperties() { }
3673
3574
  // --------------------------------------------------------------------------
3674
3575
  //
3675
- // Public Methods
3576
+ // Public Methods
3676
3577
  //
3677
3578
  // --------------------------------------------------------------------------
3678
- emit(event) {
3679
- this.observer.next(event);
3680
- }
3681
- close() {
3682
- this.getReference().close();
3579
+ ngAfterViewInit() {
3580
+ this.createChildren();
3581
+ this.checkWindowParent();
3683
3582
  }
3684
3583
  destroy() {
3685
3584
  if (this.isDestroyed) {
3686
3585
  return;
3687
3586
  }
3688
3587
  super.destroy();
3689
- this.elementsDestroy();
3690
- this._container.removeEventListener('click', this.mouseClickHandlerProxy, true);
3691
- this._container.removeEventListener('mousedown', this.mouseDownHandlerProxy);
3692
- if (!_.isNil(this.content)) {
3693
- this.content.destroy();
3694
- }
3695
- if (!_.isNil(this.observer)) {
3696
- this.observer.complete();
3697
- this.observer = null;
3698
- }
3699
- this.properties = null;
3700
- this._wrapper = null;
3701
- this._backdrop = null;
3702
- this._container = null;
3703
- clearInterval(this.blinkTimer);
3704
- this.blinkTimer = null;
3705
- clearInterval(this.shakeTimer);
3706
- this.shakeTimer = null;
3707
- clearTimeout(this.resizeTimer);
3708
- this.resizeTimer = null;
3709
- }
3710
- blink() {
3711
- clearInterval(this.blinkTimer);
3712
- this.blinkTimer = setInterval(this.blinkToggle, WindowImpl.BLINK_DELAY);
3713
- }
3714
- shake() {
3715
- if (this.isShaking) {
3716
- return;
3717
- }
3718
- this.isShaking = true;
3719
- clearInterval(this.shakeTimer);
3720
- this.shakeTimer = setInterval(this.stopShaking, WindowImpl.SHAKE_DELAY);
3721
- }
3722
- setOnTop() {
3723
- this.isWasOnTop = this.isOnTop;
3724
- this.emit(WindowEvent.SET_ON_TOP);
3588
+ this.destroyChildren();
3589
+ this.element = null;
3590
+ this.window = null;
3725
3591
  }
3726
3592
  // --------------------------------------------------------------------------
3727
3593
  //
3728
- // Size Methods
3594
+ // Event Handlers
3729
3595
  //
3730
3596
  // --------------------------------------------------------------------------
3731
- getWidth() {
3732
- return this.width;
3733
- }
3734
- getHeight() {
3735
- return this.height;
3736
- }
3737
- setWidth(value, isNeedNotify = true) {
3738
- this.width = value;
3739
- if (isNeedNotify) {
3740
- this.resizeHandler();
3741
- }
3742
- }
3743
- setHeight(value, isNeedNotify = true) {
3744
- this.height = value;
3745
- if (isNeedNotify) {
3746
- this.resizeHandler();
3747
- }
3748
- }
3749
- setSize(width, height) {
3750
- this.setWidth(width, false);
3751
- this.setHeight(height, false);
3752
- this.resizeHandler();
3597
+ clickHandler(event) {
3598
+ event.stopPropagation();
3753
3599
  }
3754
3600
  // --------------------------------------------------------------------------
3755
3601
  //
3756
- // Move Methods
3602
+ // Protected Properties
3757
3603
  //
3758
3604
  // --------------------------------------------------------------------------
3759
- getX() {
3760
- return this.x;
3761
- }
3762
- setX(value, isNeedNotify = true) {
3763
- this.x = value;
3764
- if (isNeedNotify) {
3765
- this.emit(WindowEvent.MOVED);
3766
- }
3767
- }
3768
- getY() {
3769
- return this.y;
3770
- }
3771
- setY(value, isNeedNotify = true) {
3772
- this.y = value;
3773
- if (isNeedNotify) {
3774
- this.emit(WindowEvent.MOVED);
3775
- }
3776
- }
3777
- move(x, y) {
3778
- this.setX(x, false);
3779
- this.setY(y, false);
3780
- this.emit(WindowEvent.MOVED);
3605
+ get nativeElement() {
3606
+ return this.element ? this.element.nativeElement : null;
3781
3607
  }
3782
3608
  // --------------------------------------------------------------------------
3783
3609
  //
3784
- // Private Properties
3610
+ // Public Properties
3785
3611
  //
3786
3612
  // --------------------------------------------------------------------------
3787
- get isBlink() {
3788
- return this._isBlink;
3613
+ get window() {
3614
+ return this._window;
3789
3615
  }
3790
- set isBlink(value) {
3791
- if (value === this._isBlink) {
3616
+ set window(value) {
3617
+ if (value === this._window) {
3792
3618
  return;
3793
3619
  }
3794
- this._isBlink = value;
3795
- this.commitIsBlinkProperties();
3796
- }
3797
- get isShaking() {
3798
- return this._isShaking;
3799
- }
3800
- set isShaking(value) {
3801
- if (value === this._isShaking) {
3802
- return;
3620
+ this._window = value;
3621
+ if (this.window) {
3622
+ this.commitWindowProperties();
3803
3623
  }
3804
- this._isShaking = value;
3805
- this.commitIsShakingProperties();
3806
3624
  }
3625
+ }
3626
+ WindowElement.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowElement, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
3627
+ WindowElement.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: WindowElement, selector: "ng-component", usesInheritance: true, ngImport: i0, template: '', isInline: true });
3628
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowElement, decorators: [{
3629
+ type: Component,
3630
+ args: [{ template: '' }]
3631
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
3632
+
3633
+ class WindowCloseElementComponent extends WindowElement {
3807
3634
  // --------------------------------------------------------------------------
3808
3635
  //
3809
- // Public Properties
3636
+ // Constructor
3810
3637
  //
3811
3638
  // --------------------------------------------------------------------------
3812
- get events() {
3813
- return this.observer.asObservable();
3814
- }
3815
- get config() {
3816
- return this.properties.config;
3817
- }
3818
- get content() {
3819
- return this.properties.reference ? this.properties.reference.componentInstance : null;
3820
- }
3821
- get container() {
3822
- return this._container;
3823
- }
3824
- get wrapper() {
3825
- return this._wrapper;
3826
- }
3827
- get backdrop() {
3828
- return this._backdrop;
3829
- }
3830
- get isOnTop() {
3831
- return this._isOnTop;
3639
+ constructor(element) {
3640
+ super(element);
3832
3641
  }
3833
- set isOnTop(value) {
3834
- if (value === this._isOnTop) {
3835
- return;
3642
+ // --------------------------------------------------------------------------
3643
+ //
3644
+ // Private Methods
3645
+ //
3646
+ // --------------------------------------------------------------------------
3647
+ createChildren() {
3648
+ super.createChildren();
3649
+ if (!_.isNil(WindowCloseElementComponent.ICON_VALUE)) {
3650
+ ViewUtil.setProperty(this.nativeElement, 'innerHTML', WindowCloseElementComponent.ICON_VALUE);
3836
3651
  }
3837
- this._isOnTop = value;
3838
- clearInterval(this.blinkTimer);
3839
- this.isBlink = false;
3840
- }
3841
- get isMinimized() {
3842
- return this._isMinimized;
3843
- }
3844
- set isMinimized(value) {
3845
- if (value === this._isMinimized) {
3846
- return;
3652
+ if (!_.isNil(WindowCloseElementComponent.ICON_CLASS)) {
3653
+ ViewUtil.addClasses(this.nativeElement, WindowCloseElementComponent.ICON_CLASS);
3847
3654
  }
3848
- this._isMinimized = value;
3849
- this.commitIsMinimizedProperties();
3850
- this.emit(WindowEvent.MINIMIZED_CHANGED);
3851
- this.stopBlinkIfNeed();
3852
- }
3853
- get isDisabled() {
3854
- return this._isDisabled;
3655
+ ViewUtil.addClass(this.nativeElement, 'mouse-active');
3855
3656
  }
3856
- set isDisabled(value) {
3857
- if (value === this._isDisabled) {
3858
- return;
3657
+ // --------------------------------------------------------------------------
3658
+ //
3659
+ // Event Handlers
3660
+ //
3661
+ // --------------------------------------------------------------------------
3662
+ clickHandler(event) {
3663
+ super.clickHandler(event);
3664
+ if (!_.isNil(this.window)) {
3665
+ this.window.close();
3859
3666
  }
3860
- this._isDisabled = value;
3861
- this.commitIsDisabledProperties();
3862
- this.emit(WindowEvent.DISABLED_CHANGED);
3863
3667
  }
3864
3668
  }
3865
3669
  // --------------------------------------------------------------------------
3866
3670
  //
3867
- // Constants
3671
+ // Constants
3868
3672
  //
3869
3673
  // --------------------------------------------------------------------------
3870
- WindowImpl.BLINK_DELAY = 500;
3871
- WindowImpl.SHAKE_DELAY = 500;
3872
- WindowImpl.RESIZE_DELAY = 200;
3674
+ WindowCloseElementComponent.ICON_CLASS = 'fas fa-times';
3675
+ WindowCloseElementComponent.ICON_VALUE = null;
3676
+ WindowCloseElementComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowCloseElementComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
3677
+ 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"] });
3678
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowCloseElementComponent, decorators: [{
3679
+ type: Component,
3680
+ 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"] }]
3681
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
3873
3682
 
3874
- class BottomSheetImpl extends DestroyableContainer {
3683
+ class WindowMinimizeElementComponent extends WindowElement {
3875
3684
  // --------------------------------------------------------------------------
3876
3685
  //
3877
- // Constructor
3686
+ // Constructor
3878
3687
  //
3879
3688
  // --------------------------------------------------------------------------
3880
- constructor(properties) {
3881
- super();
3882
- // --------------------------------------------------------------------------
3883
- //
3884
- // Properties
3885
- //
3886
- // --------------------------------------------------------------------------
3887
- this._isBlink = false;
3888
- this._isDisabled = false;
3689
+ constructor(element) {
3690
+ super(element);
3889
3691
  // --------------------------------------------------------------------------
3890
3692
  //
3891
- // Protected Methods
3693
+ // Private Methods
3892
3694
  //
3893
3695
  // --------------------------------------------------------------------------
3894
- this.setClosed = () => {
3895
- this.emit(WindowEvent.CLOSED);
3896
- this.destroy();
3897
- };
3898
- this.setOpened = () => {
3899
- this.emit(WindowEvent.OPENED);
3900
- };
3901
- this.blinkToggle = () => {
3902
- this.isBlink = !this.isBlink;
3903
- };
3904
- this.mouseDownHandlerProxy = (event) => {
3905
- this.mouseDownHandler(event);
3906
- };
3907
- this.mouseClickHandlerProxy = (event) => {
3908
- this.mouseClickHandler(event);
3696
+ this.commitIconProperties = () => {
3697
+ let icon = this.window.isMinimized ? WindowMinimizeElementComponent.ICON_MAXIMIZE_VALUE : WindowMinimizeElementComponent.ICON_MINIMIZE_VALUE;
3698
+ ViewUtil.setProperty(this.nativeElement, 'innerHTML', icon);
3909
3699
  };
3910
- this.observer = new Subject();
3911
- this.properties = properties;
3912
- this.content.window = this;
3913
- // Have to save for unsubscribe on destroy
3914
- this._wrapper = this.properties.overlay.hostElement;
3915
- this._backdrop = this.properties.overlay.backdropElement;
3916
- this._container = this.properties.overlay.overlayElement;
3917
- this.setProperties();
3918
- this.elementsCreate();
3919
- this.getReference().afterOpened().pipe(takeUntil$1(this.destroyed)).subscribe(this.setOpened);
3920
- this.getReference().afterDismissed().pipe(takeUntil$1(this.destroyed)).subscribe(this.setClosed);
3921
3700
  }
3922
3701
  // --------------------------------------------------------------------------
3923
3702
  //
3924
- // Elements Methods
3703
+ // Protected Methods
3925
3704
  //
3926
3705
  // --------------------------------------------------------------------------
3927
- elementsCreate() {
3928
- this.elements = new Array();
3929
- }
3930
- elementsDestroy() {
3931
- this.elements.forEach(item => this.elementDestroy(item));
3932
- this.elements = null;
3933
- }
3934
- elementAdd(item) {
3935
- this.elements.push(item);
3936
- item.instance.window = this;
3937
- return item;
3938
- }
3939
- elementRemove(item) {
3940
- ArrayUtil.remove(this.elements, item);
3941
- this.elementDestroy(item);
3942
- return item;
3943
- }
3944
- elementDestroy(item) {
3945
- item.instance.window = null;
3946
- item.destroy();
3947
- return item;
3948
- }
3949
- setProperties() {
3950
- ViewUtil.addClass(this.container, 'vi-bottom-sheet');
3951
- ViewUtil.toggleClass(this.container, 'vi-modal', this.config.isModal);
3952
- if (!this.config.isModal) {
3953
- this.container.addEventListener('click', this.mouseClickHandlerProxy, true);
3954
- this.container.addEventListener('mousedown', this.mouseDownHandlerProxy);
3955
- }
3956
- }
3957
- commitIsBlinkProperties() { }
3958
- commitIsDisabledProperties() { }
3959
- getConfig() {
3960
- return this.properties.config;
3961
- }
3962
- getContainer() {
3963
- return this.container;
3964
- }
3965
- getReference() {
3966
- return this.properties.reference;
3706
+ commitWindowProperties() {
3707
+ super.commitWindowProperties();
3708
+ this.window.events.pipe(takeUntil(this.destroyed)).subscribe(event => {
3709
+ if (event === WindowEvent.MINIMIZED_CHANGED) {
3710
+ this.commitIconProperties();
3711
+ }
3712
+ });
3967
3713
  }
3968
- isNeedClickStopPropagation(event) {
3969
- let element = _.find(this.elements, item => item.location.nativeElement === event.target);
3970
- if (_.isNil(element)) {
3971
- return false;
3714
+ createChildren() {
3715
+ super.createChildren();
3716
+ if (!_.isNil(WindowMinimizeElementComponent.ICON_MINIMIZE_VALUE)) {
3717
+ ViewUtil.setProperty(this.nativeElement, 'innerHTML', WindowMinimizeElementComponent.ICON_MINIMIZE_VALUE);
3972
3718
  }
3973
- element.instance.clickHandler(event);
3974
- return true;
3975
- }
3976
- stopBlinkIfNeed() {
3977
- this.isBlink = false;
3978
- if (!this.blinkTimer) {
3979
- return;
3719
+ if (!_.isNil(WindowMinimizeElementComponent.ICON_CLASS)) {
3720
+ ViewUtil.addClasses(this.nativeElement, WindowMinimizeElementComponent.ICON_CLASS);
3980
3721
  }
3981
- clearInterval(this.blinkTimer);
3982
- this.blinkTimer = null;
3722
+ ViewUtil.addClass(this.nativeElement, 'mouse-active');
3983
3723
  }
3984
3724
  // --------------------------------------------------------------------------
3985
3725
  //
3986
- // Event Handlers
3726
+ // Event Handlers
3987
3727
  //
3988
3728
  // --------------------------------------------------------------------------
3989
- mouseDownHandler(event) {
3990
- this.setOnTop();
3991
- }
3992
- mouseClickHandler(event) {
3993
- if (this.isNeedClickStopPropagation(event)) {
3994
- event.stopPropagation();
3995
- }
3996
- }
3997
- // --------------------------------------------------------------------------
3998
- //
3999
- // Public Methods
4000
- //
4001
- // --------------------------------------------------------------------------
4002
- emit(event) {
4003
- this.observer.next(event);
4004
- }
4005
- close() {
4006
- this.getReference().dismiss();
4007
- }
4008
- destroy() {
4009
- if (this.isDestroyed) {
4010
- return;
4011
- }
4012
- super.destroy();
4013
- this.elementsDestroy();
4014
- this._container.removeEventListener('click', this.mouseClickHandlerProxy, true);
4015
- this._container.removeEventListener('mousedown', this.mouseDownHandlerProxy);
4016
- if (!_.isNil(this.content)) {
4017
- this.content.destroy();
4018
- }
4019
- if (!_.isNil(this.observer)) {
4020
- this.observer.complete();
4021
- this.observer = null;
4022
- }
4023
- this.properties = null;
4024
- this._wrapper = null;
4025
- this._backdrop = null;
4026
- this._container = null;
4027
- clearInterval(this.blinkTimer);
4028
- this.blinkTimer = null;
4029
- }
4030
- blink() {
4031
- clearInterval(this.blinkTimer);
4032
- this.blinkTimer = setInterval(this.blinkToggle, WindowImpl.BLINK_DELAY);
4033
- }
4034
- shake() { }
4035
- setOnTop() { }
4036
- // --------------------------------------------------------------------------
4037
- //
4038
- // Size Methods
4039
- //
4040
- // --------------------------------------------------------------------------
4041
- getWidth() {
4042
- return NaN;
4043
- }
4044
- getHeight() {
4045
- return NaN;
4046
- }
4047
- setWidth(value, isNeedNotify = true) { }
4048
- setHeight(value, isNeedNotify = true) { }
4049
- setSize(width, height) { }
4050
- // --------------------------------------------------------------------------
4051
- //
4052
- // Move Methods
4053
- //
4054
- // --------------------------------------------------------------------------
4055
- getX() {
4056
- return NaN;
4057
- }
4058
- setX(value, isNeedNotify = true) { }
4059
- getY() {
4060
- return NaN;
4061
- }
4062
- setY(value, isNeedNotify = true) { }
4063
- move(x, y) { }
4064
- // --------------------------------------------------------------------------
4065
- //
4066
- // Private Properties
4067
- //
4068
- // --------------------------------------------------------------------------
4069
- get reference() {
4070
- return this.properties.reference;
4071
- }
4072
- get isBlink() {
4073
- return this._isBlink;
4074
- }
4075
- set isBlink(value) {
4076
- if (value === this._isBlink) {
4077
- return;
4078
- }
4079
- this._isBlink = value;
4080
- this.commitIsBlinkProperties();
4081
- }
4082
- get isShaking() {
4083
- return false;
4084
- }
4085
- set isShaking(value) { }
4086
- // --------------------------------------------------------------------------
4087
- //
4088
- // Public Properties
4089
- //
4090
- // --------------------------------------------------------------------------
4091
- get events() {
4092
- return this.observer.asObservable();
4093
- }
4094
- get config() {
4095
- return this.properties.config;
4096
- }
4097
- get content() {
4098
- return !_.isNil(this.reference) ? this.reference.instance : null;
4099
- }
4100
- get container() {
4101
- return this._container;
4102
- }
4103
- get wrapper() {
4104
- return this._wrapper;
4105
- }
4106
- get backdrop() {
4107
- return this._backdrop;
4108
- }
4109
- get isOnTop() {
4110
- return false;
4111
- }
4112
- set isOnTop(value) { }
4113
- get isMinimized() {
4114
- return false;
4115
- }
4116
- set isMinimized(value) { }
4117
- get isDisabled() {
4118
- return this._isDisabled;
4119
- }
4120
- set isDisabled(value) {
4121
- if (value === this._isDisabled) {
4122
- return;
3729
+ clickHandler(event) {
3730
+ super.clickHandler(event);
3731
+ if (!_.isNil(this.window)) {
3732
+ this.window.isMinimized = !this.window.isMinimized;
4123
3733
  }
4124
- this._isDisabled = value;
4125
- this.commitIsDisabledProperties();
4126
- this.emit(WindowEvent.DISABLED_CHANGED);
4127
3734
  }
4128
3735
  }
4129
3736
  // --------------------------------------------------------------------------
4130
3737
  //
4131
- // Constants
3738
+ // Constants
4132
3739
  //
4133
3740
  // --------------------------------------------------------------------------
4134
- BottomSheetImpl.BLINK_DELAY = 500;
4135
- BottomSheetImpl.SHAKE_DELAY = 500;
4136
-
4137
- class WindowElement extends DestroyableContainer {
4138
- // --------------------------------------------------------------------------
4139
- //
4140
- // Constructor
4141
- //
4142
- // --------------------------------------------------------------------------
4143
- constructor(element) {
4144
- super();
4145
- this.element = element;
4146
- }
4147
- // --------------------------------------------------------------------------
4148
- //
4149
- // Private Methods
4150
- //
4151
- // --------------------------------------------------------------------------
4152
- checkWindowParent() {
4153
- let container = this.getContainer();
4154
- if (!_.isNil(container)) {
4155
- ViewUtil.appendChild(container, this.element.nativeElement);
4156
- }
4157
- }
4158
- getContainer() {
4159
- let item = ViewUtil.parseElement(this.element.nativeElement);
4160
- while (!_.isNil(item) && item.nodeName.toLowerCase() !== 'mat-dialog-container') {
4161
- item = item.parentElement;
4162
- }
4163
- return item;
4164
- }
4165
- createChildren() { }
4166
- destroyChildren() { }
4167
- commitWindowProperties() { }
4168
- // --------------------------------------------------------------------------
4169
- //
4170
- // Public Methods
4171
- //
4172
- // --------------------------------------------------------------------------
4173
- ngAfterViewInit() {
4174
- this.createChildren();
4175
- this.checkWindowParent();
4176
- }
4177
- destroy() {
4178
- if (this.isDestroyed) {
4179
- return;
4180
- }
4181
- super.destroy();
4182
- this.destroyChildren();
4183
- this.element = null;
4184
- this.window = null;
4185
- }
4186
- // --------------------------------------------------------------------------
4187
- //
4188
- // Event Handlers
4189
- //
4190
- // --------------------------------------------------------------------------
4191
- clickHandler(event) {
4192
- event.stopPropagation();
4193
- }
4194
- // --------------------------------------------------------------------------
4195
- //
4196
- // Protected Properties
4197
- //
4198
- // --------------------------------------------------------------------------
4199
- get nativeElement() {
4200
- return this.element ? this.element.nativeElement : null;
4201
- }
4202
- // --------------------------------------------------------------------------
4203
- //
4204
- // Public Properties
4205
- //
4206
- // --------------------------------------------------------------------------
4207
- get window() {
4208
- return this._window;
4209
- }
4210
- set window(value) {
4211
- if (value === this._window) {
4212
- return;
4213
- }
4214
- this._window = value;
4215
- if (this.window) {
4216
- this.commitWindowProperties();
4217
- }
4218
- }
4219
- }
4220
- WindowElement.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowElement, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
4221
- WindowElement.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: WindowElement, selector: "ng-component", usesInheritance: true, ngImport: i0, template: '', isInline: true });
4222
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowElement, decorators: [{
3741
+ WindowMinimizeElementComponent.ICON_CLASS = null;
3742
+ WindowMinimizeElementComponent.ICON_MINIMIZE_VALUE = null;
3743
+ WindowMinimizeElementComponent.ICON_MAXIMIZE_VALUE = null;
3744
+ WindowMinimizeElementComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowMinimizeElementComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
3745
+ 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"] });
3746
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowMinimizeElementComponent, decorators: [{
4223
3747
  type: Component,
4224
- args: [{ template: '' }]
3748
+ 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"] }]
4225
3749
  }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
4226
3750
 
4227
- class BottomSheetCloseElementComponent extends WindowElement {
3751
+ class WindowResizeElementComponent extends WindowElement {
4228
3752
  // --------------------------------------------------------------------------
4229
3753
  //
4230
3754
  // Constructor
@@ -4240,13 +3764,13 @@ class BottomSheetCloseElementComponent extends WindowElement {
4240
3764
  // --------------------------------------------------------------------------
4241
3765
  createChildren() {
4242
3766
  super.createChildren();
4243
- if (!_.isNil(BottomSheetCloseElementComponent.ICON_VALUE)) {
4244
- ViewUtil.setProperty(this.nativeElement, 'innerHTML', BottomSheetCloseElementComponent.ICON_VALUE);
3767
+ if (!_.isNil(WindowResizeElementComponent.ICON_VALUE)) {
3768
+ ViewUtil.setProperty(this.nativeElement, 'innerHTML', WindowResizeElementComponent.ICON_VALUE);
4245
3769
  }
4246
- if (!_.isNil(BottomSheetCloseElementComponent.ICON_CLASS)) {
4247
- ViewUtil.addClasses(this.nativeElement, BottomSheetCloseElementComponent.ICON_CLASS);
3770
+ if (!_.isNil(WindowResizeElementComponent.ICON_CLASS)) {
3771
+ ViewUtil.addClasses(this.nativeElement, WindowResizeElementComponent.ICON_CLASS);
4248
3772
  }
4249
- ViewUtil.addClass(this.nativeElement, 'mouse-active');
3773
+ ViewUtil.setStyle(this.nativeElement, 'cursor', 'pointer');
4250
3774
  }
4251
3775
  // --------------------------------------------------------------------------
4252
3776
  //
@@ -4256,7 +3780,6 @@ class BottomSheetCloseElementComponent extends WindowElement {
4256
3780
  clickHandler(event) {
4257
3781
  super.clickHandler(event);
4258
3782
  if (!_.isNil(this.window)) {
4259
- this.window.close();
4260
3783
  }
4261
3784
  }
4262
3785
  }
@@ -4265,417 +3788,537 @@ class BottomSheetCloseElementComponent extends WindowElement {
4265
3788
  // Constants
4266
3789
  //
4267
3790
  // --------------------------------------------------------------------------
4268
- BottomSheetCloseElementComponent.ICON_CLASS = 'fas fa-times';
4269
- BottomSheetCloseElementComponent.ICON_VALUE = null;
4270
- BottomSheetCloseElementComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: BottomSheetCloseElementComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
4271
- BottomSheetCloseElementComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: BottomSheetCloseElementComponent, selector: "vi-bottom-sheet-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"] });
4272
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: BottomSheetCloseElementComponent, decorators: [{
4273
- type: Component,
4274
- args: [{ selector: 'vi-bottom-sheet-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"] }]
3791
+ WindowResizeElementComponent.ICON_CLASS = 'fas fa-arrows-alt';
3792
+ WindowResizeElementComponent.ICON_VALUE = null;
3793
+ WindowResizeElementComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowResizeElementComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
3794
+ 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"] });
3795
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowResizeElementComponent, decorators: [{
3796
+ type: Component,
3797
+ 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"] }]
4275
3798
  }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
4276
3799
 
4277
- class BottomSheetBaseComponent extends BottomSheetImpl {
3800
+ class WindowBase extends DestroyableContainer {
4278
3801
  // --------------------------------------------------------------------------
4279
3802
  //
4280
- // Protected Methods
3803
+ // Constructor
4281
3804
  //
4282
3805
  // --------------------------------------------------------------------------
4283
- elementsCreate() {
4284
- super.elementsCreate();
4285
- if (!(this.content.container instanceof ViewContainerRef)) {
4286
- return;
3806
+ constructor() {
3807
+ super();
3808
+ // --------------------------------------------------------------------------
3809
+ //
3810
+ // Properties
3811
+ //
3812
+ // --------------------------------------------------------------------------
3813
+ this._x = NaN;
3814
+ this._width = NaN;
3815
+ this._y = NaN;
3816
+ this._height = NaN;
3817
+ this.updatePosition = () => this.setPosition();
3818
+ }
3819
+ setProperties() {
3820
+ let config = this.getConfig();
3821
+ if (!_.isNaN(config.defaultWidth)) {
3822
+ this.width = config.defaultWidth;
4287
3823
  }
4288
- if (!this.config.disableClose) {
4289
- this.elementAdd(this.content.container.createComponent(BottomSheetBaseComponent.CLOSE_COMPONENT));
3824
+ if (!_.isNaN(config.defaultHeight)) {
3825
+ this.height = config.defaultHeight;
4290
3826
  }
4291
3827
  }
4292
- commitIsBlinkProperties() {
4293
- ViewUtil.toggleClass(this.container, this.blinkClass, this.isBlink);
4294
- }
4295
- commitIsDisabledProperties() {
4296
- ViewUtil.toggleClass(this.container, this.disabledClass, this.isDisabled);
4297
- ViewUtil.toggleClass(this.content.element, this.disabledClass, this.isDisabled);
4298
- ViewUtil.toggleClass(this.content.element.nativeElement.parentElement, this.disabledClass, this.isDisabled);
4299
- }
4300
- commitIsShakingProperties() {
4301
- ViewUtil.toggleClass(this.container, this.shakingClass, this.isShaking);
4302
- }
4303
- // --------------------------------------------------------------------------
4304
- //
4305
- // Protected Properties
4306
- //
4307
- // --------------------------------------------------------------------------
4308
- get blinkClass() {
4309
- return 'vi-blink';
3828
+ setPosition() {
3829
+ let config = this.getConfig();
3830
+ switch (config.horizontalAlign) {
3831
+ case WindowAlign.START:
3832
+ this.x = !_.isNaN(this.paddingLeft) ? this.paddingLeft : 0;
3833
+ break;
3834
+ case WindowAlign.END:
3835
+ let value = ViewUtil.getStageWidth() - this.calculateWidth();
3836
+ if (!_.isNaN(this.paddingRight)) {
3837
+ value -= this.paddingRight;
3838
+ }
3839
+ this.x = value;
3840
+ break;
3841
+ default:
3842
+ this.x = (ViewUtil.getStageWidth() - this.calculateWidth()) / 2;
3843
+ break;
3844
+ }
3845
+ switch (config.verticalAlign) {
3846
+ case WindowAlign.START:
3847
+ this.y = !_.isNaN(this.paddingTop) ? this.paddingTop : 0;
3848
+ break;
3849
+ case WindowAlign.END:
3850
+ let value = ViewUtil.getStageHeight() - this.calculateHeight();
3851
+ if (!_.isNaN(this.paddingBottom)) {
3852
+ value -= this.paddingBottom;
3853
+ }
3854
+ this.y = value;
3855
+ break;
3856
+ default:
3857
+ this.y = (ViewUtil.getStageHeight() - this.calculateHeight()) / 2;
3858
+ break;
3859
+ }
4310
3860
  }
4311
- get disabledClass() {
4312
- return 'vi-disabled';
3861
+ clearSize() {
3862
+ this._x = NaN;
3863
+ this._y = NaN;
3864
+ this._width = NaN;
3865
+ this._height = NaN;
4313
3866
  }
4314
- get minimizedClass() {
4315
- return 'vi-minimized';
3867
+ commitSizeProperties() {
3868
+ let width = !_.isNaN(this.width) ? this.width + 'px' : 'auto';
3869
+ let height = !_.isNaN(this.height) ? this.height + 'px' : 'auto';
3870
+ this.getReference().updateSize(width, height);
4316
3871
  }
4317
- get shakingClass() {
4318
- return 'shake-constant shake-horizontal';
3872
+ commitPositionProperties() {
3873
+ if (_.isNaN(this._x) && _.isNaN(this._y)) {
3874
+ return;
3875
+ }
3876
+ let position = {};
3877
+ if (!_.isNaN(this._y)) {
3878
+ position.top = this._y + 'px';
3879
+ }
3880
+ if (!_.isNaN(this._x)) {
3881
+ position.left = this._x + 'px';
3882
+ }
3883
+ this.getReference().updatePosition(position);
4319
3884
  }
4320
- }
4321
- // --------------------------------------------------------------------------
4322
- //
4323
- // Static Properties
4324
- //
4325
- // --------------------------------------------------------------------------
4326
- BottomSheetBaseComponent.CLOSE_COMPONENT = BottomSheetCloseElementComponent;
4327
-
4328
- class IWindowContent extends DestroyableContainer {
4329
3885
  // --------------------------------------------------------------------------
4330
3886
  //
4331
- // Constructor
3887
+ // Public Methods
4332
3888
  //
4333
3889
  // --------------------------------------------------------------------------
4334
- constructor(container) {
4335
- super();
4336
- this.container = container;
3890
+ calculateWidth() {
3891
+ return !_.isNaN(this.width) ? this.width : ViewUtil.getWidth(this.getContainer());
4337
3892
  }
4338
- // --------------------------------------------------------------------------
4339
- //
4340
- // Private Methods
4341
- //
4342
- // --------------------------------------------------------------------------
4343
- commitWindowProperties() {
4344
- this.commitConfigProperties();
3893
+ calculateHeight() {
3894
+ return !_.isNaN(this.height) ? this.height : ViewUtil.getHeight(this.getContainer());
4345
3895
  }
4346
- commitConfigProperties() { }
4347
3896
  // --------------------------------------------------------------------------
4348
3897
  //
4349
- // Public Methods
3898
+ // Private Properties
4350
3899
  //
4351
3900
  // --------------------------------------------------------------------------
4352
- ngAfterViewInit() {
4353
- this.emit(WindowEvent.CONTENT_READY);
4354
- }
4355
- ngOnDestroy() {
4356
- // do nothing, window will destroy content after closing
4357
- }
4358
- blink() {
4359
- if (!_.isNil(this.window)) {
4360
- this.window.blink();
4361
- }
4362
- }
4363
- shake() {
4364
- if (!_.isNil(this.window)) {
4365
- this.window.shake();
4366
- }
3901
+ get width() {
3902
+ return this._width;
4367
3903
  }
4368
- emit(event) {
4369
- if (!_.isNil(this.window)) {
4370
- this.window.emit(event);
3904
+ set width(value) {
3905
+ value = this.getConfig().parseWidth(value);
3906
+ if (value === this._width) {
3907
+ return;
4371
3908
  }
3909
+ this._width = value;
3910
+ this.commitSizeProperties();
4372
3911
  }
4373
- close() {
4374
- if (!_.isNil(this.window)) {
4375
- this.window.close();
4376
- }
3912
+ get height() {
3913
+ return this._height;
4377
3914
  }
4378
- destroy() {
4379
- if (this.isDestroyed) {
3915
+ set height(value) {
3916
+ value = this.getConfig().parseHeight(value);
3917
+ if (value === this._height) {
4380
3918
  return;
4381
3919
  }
4382
- super.destroy();
4383
- this.window = null;
4384
- this.container = null;
3920
+ this._height = value;
3921
+ this.commitSizeProperties();
4385
3922
  }
4386
3923
  // --------------------------------------------------------------------------
4387
3924
  //
4388
- // Proxy Public Properties
3925
+ // Public Properties
4389
3926
  //
4390
3927
  // --------------------------------------------------------------------------
4391
- get data() {
4392
- return !_.isNil(this.config) ? this.config.data : null;
4393
- }
4394
- get isOnTop() {
4395
- return !_.isNil(this.window) ? this.window.isOnTop : false;
4396
- }
4397
- get isMinimized() {
4398
- return !_.isNil(this.window) ? this.window.isMinimized : false;
3928
+ get x() {
3929
+ return this._x;
4399
3930
  }
4400
- get events() {
4401
- return !_.isNil(this.window) ? this.window.events : null;
3931
+ set x(value) {
3932
+ value = this.getConfig().parseX(value);
3933
+ if (value === this._x) {
3934
+ return;
3935
+ }
3936
+ this._x = value;
3937
+ this.commitPositionProperties();
4402
3938
  }
4403
- get isDisabled() {
4404
- return !_.isNil(this.window) ? this.window.isDisabled : false;
3939
+ get y() {
3940
+ return this._y;
4405
3941
  }
4406
- set isDisabled(value) {
4407
- if (!_.isNil(this.window)) {
4408
- this.window.isDisabled = value;
3942
+ set y(value) {
3943
+ value = this.getConfig().parseY(value);
3944
+ if (value === this._y) {
3945
+ return;
4409
3946
  }
3947
+ this._y = value;
3948
+ this.commitPositionProperties();
4410
3949
  }
4411
- // --------------------------------------------------------------------------
4412
- //
4413
- // Public Properties
4414
- //
4415
- // --------------------------------------------------------------------------
4416
- get element() {
4417
- if (_.isNil(this.container)) {
4418
- return null;
4419
- }
4420
- return this.container instanceof ViewContainerRef ? this.container.element : this.container;
3950
+ get paddingTop() {
3951
+ return this.getConfig().paddingTop;
4421
3952
  }
4422
- get config() {
4423
- return !_.isNil(this.window) ? this.window.config : null;
3953
+ get paddingLeft() {
3954
+ return this.getConfig().paddingLeft;
4424
3955
  }
4425
- get window() {
4426
- return this._window;
3956
+ get paddingRight() {
3957
+ return this.getConfig().paddingRight;
4427
3958
  }
4428
- set window(value) {
4429
- if (value === this._window) {
4430
- return;
4431
- }
4432
- this._window = value;
4433
- if (!_.isNil(value)) {
4434
- this.commitWindowProperties();
4435
- }
3959
+ get paddingBottom() {
3960
+ return this.getConfig().paddingBottom;
4436
3961
  }
4437
3962
  }
4438
- IWindowContent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: IWindowContent, deps: [{ token: WINDOW_CONTENT_CONTAINER, optional: true }], target: i0.ɵɵFactoryTarget.Component });
4439
- IWindowContent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: IWindowContent, selector: "ng-component", inputs: { isDisabled: "isDisabled", window: "window" }, usesInheritance: true, ngImport: i0, template: '', isInline: true });
4440
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: IWindowContent, decorators: [{
4441
- type: Component,
4442
- args: [{ template: '' }]
4443
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
4444
- type: Optional
4445
- }, {
4446
- type: Inject,
4447
- args: [WINDOW_CONTENT_CONTAINER]
4448
- }] }]; }, propDecorators: { isDisabled: [{
4449
- type: Input
4450
- }], window: [{
4451
- type: Input
4452
- }] } });
4453
- const WINDOW_CONTENT_CONTAINER = new InjectionToken('WINDOW_CONTENT_CONTAINER');
4454
3963
 
4455
- class WindowQuestionBaseComponent extends IWindowContent {
3964
+ class WindowImpl extends WindowBase {
4456
3965
  // --------------------------------------------------------------------------
4457
3966
  //
4458
- // Protected Methods
3967
+ // Constructor
4459
3968
  //
4460
3969
  // --------------------------------------------------------------------------
4461
- commitConfigProperties() {
4462
- super.commitConfigProperties();
4463
- this.data.closePromise.then(() => {
4464
- if (!this.isDestroyed) {
4465
- this.close();
3970
+ constructor(properties) {
3971
+ super();
3972
+ // --------------------------------------------------------------------------
3973
+ //
3974
+ // Properties
3975
+ //
3976
+ // --------------------------------------------------------------------------
3977
+ this._isBlink = false;
3978
+ this._isShaking = false;
3979
+ this._isOnTop = false;
3980
+ this._isDisabled = false;
3981
+ this._isMinimized = false;
3982
+ this.isOpened = false;
3983
+ this.isWasOnTop = false;
3984
+ // --------------------------------------------------------------------------
3985
+ //
3986
+ // Protected Methods
3987
+ //
3988
+ // --------------------------------------------------------------------------
3989
+ this.setClosed = () => {
3990
+ this.isOpened = false;
3991
+ this.emit(WindowEvent.CLOSED);
3992
+ this.destroy();
3993
+ };
3994
+ this.setOpened = () => {
3995
+ this.isOpened = true;
3996
+ this.emit(WindowEvent.OPENED);
3997
+ };
3998
+ this.blinkToggle = () => {
3999
+ this.isBlink = !this.isBlink;
4000
+ };
4001
+ this.stopShaking = () => {
4002
+ this.isShaking = false;
4003
+ };
4004
+ this.emitResize = () => {
4005
+ this.emit(WindowEvent.RESIZED);
4006
+ };
4007
+ this.resizeHandler = () => {
4008
+ if (!this.isOpened) {
4009
+ return;
4466
4010
  }
4467
- });
4011
+ clearTimeout(this.resizeTimer);
4012
+ this.resizeTimer = setTimeout(this.emitResize, WindowImpl.RESIZE_DELAY);
4013
+ };
4014
+ this.mouseDownHandlerProxy = (event) => {
4015
+ this.mouseDownHandler(event);
4016
+ };
4017
+ this.mouseClickHandlerProxy = (event) => {
4018
+ this.mouseClickHandler(event);
4019
+ };
4020
+ this.observer = new Subject();
4021
+ this.elements = new Array();
4022
+ this.properties = properties;
4023
+ this.content.window = this;
4024
+ // Have to save for unsubscribe on destroy
4025
+ this._wrapper = this.properties.overlay.hostElement;
4026
+ this._backdrop = this.properties.overlay.backdropElement;
4027
+ this._container = this.properties.overlay.overlayElement;
4028
+ this.setProperties();
4029
+ this.getReference().afterOpened().pipe(takeUntil$1(this.destroyed)).subscribe(this.setOpened);
4030
+ this.getReference().afterClosed().pipe(takeUntil$1(this.destroyed)).subscribe(this.setClosed);
4031
+ this.events
4032
+ .pipe(filter$1(event => event === WindowEvent.CONTENT_READY), takeUntil$1(this.destroyed))
4033
+ .subscribe(this.updatePosition);
4468
4034
  }
4469
- }
4470
-
4471
- class WindowQuestionComponent extends WindowQuestionBaseComponent {
4472
4035
  // --------------------------------------------------------------------------
4473
4036
  //
4474
- // Constructor
4037
+ // Elements Methods
4475
4038
  //
4476
4039
  // --------------------------------------------------------------------------
4477
- constructor(container, language) {
4478
- super(container);
4479
- this.language = language;
4480
- ViewUtil.addClasses(container.element, 'd-block');
4040
+ elementsCreate() {
4041
+ this.elements = new Array();
4042
+ }
4043
+ elementsDestroy() {
4044
+ this.elements.forEach(item => this.elementDestroy(item));
4045
+ this.elements = null;
4046
+ }
4047
+ elementAdd(item) {
4048
+ this.elements.push(item);
4049
+ item.instance.window = this;
4050
+ return item;
4051
+ }
4052
+ elementRemove(item) {
4053
+ ArrayUtil.remove(this.elements, item);
4054
+ this.elementDestroy(item);
4055
+ return item;
4056
+ }
4057
+ elementDestroy(item) {
4058
+ item.instance.window = null;
4059
+ item.destroy();
4060
+ return item;
4061
+ }
4062
+ setProperties() {
4063
+ super.setProperties();
4064
+ ViewUtil.addClass(this.container, 'vi-window');
4065
+ ViewUtil.toggleClass(this.container, 'vi-modal', this.config.isModal);
4066
+ this.container.addEventListener('click', this.mouseClickHandlerProxy, true);
4067
+ if (!this.config.isModal) {
4068
+ this.container.addEventListener('mousedown', this.mouseDownHandlerProxy);
4069
+ }
4070
+ /*
4071
+ if (!this.config.isModal) {
4072
+ this.container.addEventListener('click', this.mouseClickHandlerProxy, true);
4073
+ this.container.addEventListener('mousedown', this.mouseDownHandlerProxy);
4074
+ }
4075
+ */
4076
+ this.elementsCreate();
4077
+ }
4078
+ commitIsBlinkProperties() { }
4079
+ commitIsShakingProperties() { }
4080
+ commitIsDisabledProperties() { }
4081
+ commitIsMinimizedProperties() { }
4082
+ getConfig() {
4083
+ return this.properties.config;
4084
+ }
4085
+ getContainer() {
4086
+ return this.container;
4087
+ }
4088
+ getReference() {
4089
+ return this.properties.reference;
4090
+ }
4091
+ isNeedClickStopPropagation(event) {
4092
+ // return !this.isWasOnTop;
4093
+ if (this.isWasOnTop) {
4094
+ return false;
4095
+ }
4096
+ let element = _.find(this.elements, item => item.location.nativeElement === event.target);
4097
+ if (_.isNil(element)) {
4098
+ return false;
4099
+ }
4100
+ element.instance.clickHandler(event);
4101
+ return true;
4102
+ }
4103
+ stopBlinkIfNeed() {
4104
+ this.isBlink = false;
4105
+ if (!this.blinkTimer) {
4106
+ return;
4107
+ }
4108
+ clearInterval(this.blinkTimer);
4109
+ this.blinkTimer = null;
4110
+ }
4111
+ mouseDownHandler(event) {
4112
+ this.setOnTop();
4113
+ }
4114
+ mouseClickHandler(event) {
4115
+ if (this.isNeedClickStopPropagation(event)) {
4116
+ event.stopPropagation();
4117
+ }
4118
+ if (!this.isWasOnTop) {
4119
+ this.isWasOnTop = true;
4120
+ }
4481
4121
  }
4482
4122
  // --------------------------------------------------------------------------
4483
4123
  //
4484
- // Public Methods
4124
+ // Public Methods
4485
4125
  //
4486
4126
  // --------------------------------------------------------------------------
4487
- commitConfigProperties() {
4488
- super.commitConfigProperties();
4489
- if (!_.isNil(this.data.text)) {
4490
- this.text = this.data.text.replace(/(?:\r\n|\r|\n)/g, `<br/>`);
4491
- }
4492
- if (this.language.isHasTranslation(this.data.options.yesTextId)) {
4493
- this.data.yesText = this.language.translate(this.data.options.yesTextId);
4127
+ emit(event) {
4128
+ this.observer.next(event);
4129
+ }
4130
+ close() {
4131
+ this.getReference().close();
4132
+ }
4133
+ destroy() {
4134
+ if (this.isDestroyed) {
4135
+ return;
4494
4136
  }
4495
- if (this.language.isHasTranslation(this.data.options.notTextId)) {
4496
- this.data.notText = this.language.translate(this.data.options.notTextId);
4137
+ super.destroy();
4138
+ this.elementsDestroy();
4139
+ this._container.removeEventListener('click', this.mouseClickHandlerProxy, true);
4140
+ this._container.removeEventListener('mousedown', this.mouseDownHandlerProxy);
4141
+ if (!_.isNil(this.content)) {
4142
+ this.content.destroy();
4497
4143
  }
4498
- if (this.language.isHasTranslation(this.data.options.checkTextId)) {
4499
- this.data.checkText = this.language.translate(this.data.options.checkTextId);
4144
+ if (!_.isNil(this.observer)) {
4145
+ this.observer.complete();
4146
+ this.observer = null;
4500
4147
  }
4501
- if (this.language.isHasTranslation(this.data.options.closeTextId)) {
4502
- this.data.closeText = this.language.translate(this.data.options.closeTextId);
4148
+ this.properties = null;
4149
+ this._wrapper = null;
4150
+ this._backdrop = null;
4151
+ this._container = null;
4152
+ clearInterval(this.blinkTimer);
4153
+ this.blinkTimer = null;
4154
+ clearInterval(this.shakeTimer);
4155
+ this.shakeTimer = null;
4156
+ clearTimeout(this.resizeTimer);
4157
+ this.resizeTimer = null;
4158
+ }
4159
+ blink() {
4160
+ clearInterval(this.blinkTimer);
4161
+ this.blinkTimer = setInterval(this.blinkToggle, WindowImpl.BLINK_DELAY);
4162
+ }
4163
+ shake() {
4164
+ if (this.isShaking) {
4165
+ return;
4503
4166
  }
4167
+ this.isShaking = true;
4168
+ clearInterval(this.shakeTimer);
4169
+ this.shakeTimer = setInterval(this.stopShaking, WindowImpl.SHAKE_DELAY);
4504
4170
  }
4505
- }
4506
- WindowQuestionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowQuestionComponent, deps: [{ token: i0.ViewContainerRef }, { token: i1$1.LanguageService }], target: i0.ɵɵFactoryTarget.Component });
4507
- WindowQuestionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: WindowQuestionComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, 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>", components: [{ type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
4508
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowQuestionComponent, decorators: [{
4509
- type: Component,
4510
- 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>" }]
4511
- }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i1$1.LanguageService }]; } });
4512
-
4513
- class WindowCloseElementComponent extends WindowElement {
4514
- // --------------------------------------------------------------------------
4515
- //
4516
- // Constructor
4517
- //
4518
- // --------------------------------------------------------------------------
4519
- constructor(element) {
4520
- super(element);
4171
+ setOnTop() {
4172
+ this.isWasOnTop = this.isOnTop;
4173
+ this.emit(WindowEvent.SET_ON_TOP);
4521
4174
  }
4522
4175
  // --------------------------------------------------------------------------
4523
4176
  //
4524
- // Private Methods
4177
+ // Size Methods
4525
4178
  //
4526
4179
  // --------------------------------------------------------------------------
4527
- createChildren() {
4528
- super.createChildren();
4529
- if (!_.isNil(WindowCloseElementComponent.ICON_VALUE)) {
4530
- ViewUtil.setProperty(this.nativeElement, 'innerHTML', WindowCloseElementComponent.ICON_VALUE);
4531
- }
4532
- if (!_.isNil(WindowCloseElementComponent.ICON_CLASS)) {
4533
- ViewUtil.addClasses(this.nativeElement, WindowCloseElementComponent.ICON_CLASS);
4180
+ getWidth() {
4181
+ return this.width;
4182
+ }
4183
+ getHeight() {
4184
+ return this.height;
4185
+ }
4186
+ setWidth(value, isNeedNotify = true) {
4187
+ this.width = value;
4188
+ if (isNeedNotify) {
4189
+ this.resizeHandler();
4534
4190
  }
4535
- ViewUtil.addClass(this.nativeElement, 'mouse-active');
4536
4191
  }
4537
- // --------------------------------------------------------------------------
4538
- //
4539
- // Event Handlers
4540
- //
4541
- // --------------------------------------------------------------------------
4542
- clickHandler(event) {
4543
- super.clickHandler(event);
4544
- if (!_.isNil(this.window)) {
4545
- this.window.close();
4192
+ setHeight(value, isNeedNotify = true) {
4193
+ this.height = value;
4194
+ if (isNeedNotify) {
4195
+ this.resizeHandler();
4546
4196
  }
4547
4197
  }
4548
- }
4549
- // --------------------------------------------------------------------------
4550
- //
4551
- // Constants
4552
- //
4553
- // --------------------------------------------------------------------------
4554
- WindowCloseElementComponent.ICON_CLASS = 'fas fa-times';
4555
- WindowCloseElementComponent.ICON_VALUE = null;
4556
- WindowCloseElementComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowCloseElementComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
4557
- 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"] });
4558
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowCloseElementComponent, decorators: [{
4559
- type: Component,
4560
- 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"] }]
4561
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
4562
-
4563
- class WindowMinimizeElementComponent extends WindowElement {
4564
- // --------------------------------------------------------------------------
4565
- //
4566
- // Constructor
4567
- //
4568
- // --------------------------------------------------------------------------
4569
- constructor(element) {
4570
- super(element);
4571
- // --------------------------------------------------------------------------
4572
- //
4573
- // Private Methods
4574
- //
4575
- // --------------------------------------------------------------------------
4576
- this.commitIconProperties = () => {
4577
- let icon = this.window.isMinimized ? WindowMinimizeElementComponent.ICON_MAXIMIZE_VALUE : WindowMinimizeElementComponent.ICON_MINIMIZE_VALUE;
4578
- ViewUtil.setProperty(this.nativeElement, 'innerHTML', icon);
4579
- };
4198
+ setSize(width, height) {
4199
+ this.setWidth(width, false);
4200
+ this.setHeight(height, false);
4201
+ this.resizeHandler();
4580
4202
  }
4581
4203
  // --------------------------------------------------------------------------
4582
4204
  //
4583
- // Protected Methods
4205
+ // Move Methods
4584
4206
  //
4585
4207
  // --------------------------------------------------------------------------
4586
- commitWindowProperties() {
4587
- super.commitWindowProperties();
4588
- this.window.events.pipe(takeUntil(this.destroyed)).subscribe(event => {
4589
- if (event === WindowEvent.MINIMIZED_CHANGED) {
4590
- this.commitIconProperties();
4591
- }
4592
- });
4208
+ getX() {
4209
+ return this.x;
4593
4210
  }
4594
- createChildren() {
4595
- super.createChildren();
4596
- if (!_.isNil(WindowMinimizeElementComponent.ICON_MINIMIZE_VALUE)) {
4597
- ViewUtil.setProperty(this.nativeElement, 'innerHTML', WindowMinimizeElementComponent.ICON_MINIMIZE_VALUE);
4211
+ setX(value, isNeedNotify = true) {
4212
+ this.x = value;
4213
+ if (isNeedNotify) {
4214
+ this.emit(WindowEvent.MOVED);
4598
4215
  }
4599
- if (!_.isNil(WindowMinimizeElementComponent.ICON_CLASS)) {
4600
- ViewUtil.addClasses(this.nativeElement, WindowMinimizeElementComponent.ICON_CLASS);
4216
+ }
4217
+ getY() {
4218
+ return this.y;
4219
+ }
4220
+ setY(value, isNeedNotify = true) {
4221
+ this.y = value;
4222
+ if (isNeedNotify) {
4223
+ this.emit(WindowEvent.MOVED);
4601
4224
  }
4602
- ViewUtil.addClass(this.nativeElement, 'mouse-active');
4225
+ }
4226
+ move(x, y) {
4227
+ this.setX(x, false);
4228
+ this.setY(y, false);
4229
+ this.emit(WindowEvent.MOVED);
4603
4230
  }
4604
4231
  // --------------------------------------------------------------------------
4605
4232
  //
4606
- // Event Handlers
4233
+ // Private Properties
4607
4234
  //
4608
4235
  // --------------------------------------------------------------------------
4609
- clickHandler(event) {
4610
- super.clickHandler(event);
4611
- if (!_.isNil(this.window)) {
4612
- this.window.isMinimized = !this.window.isMinimized;
4236
+ get isBlink() {
4237
+ return this._isBlink;
4238
+ }
4239
+ set isBlink(value) {
4240
+ if (value === this._isBlink) {
4241
+ return;
4613
4242
  }
4243
+ this._isBlink = value;
4244
+ this.commitIsBlinkProperties();
4614
4245
  }
4615
- }
4616
- // --------------------------------------------------------------------------
4617
- //
4618
- // Constants
4619
- //
4620
- // --------------------------------------------------------------------------
4621
- WindowMinimizeElementComponent.ICON_CLASS = null;
4622
- WindowMinimizeElementComponent.ICON_MINIMIZE_VALUE = null;
4623
- WindowMinimizeElementComponent.ICON_MAXIMIZE_VALUE = null;
4624
- WindowMinimizeElementComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowMinimizeElementComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
4625
- 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"] });
4626
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowMinimizeElementComponent, decorators: [{
4627
- type: Component,
4628
- 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"] }]
4629
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
4630
-
4631
- class WindowResizeElementComponent extends WindowElement {
4632
- // --------------------------------------------------------------------------
4633
- //
4634
- // Constructor
4635
- //
4636
- // --------------------------------------------------------------------------
4637
- constructor(element) {
4638
- super(element);
4246
+ get isShaking() {
4247
+ return this._isShaking;
4248
+ }
4249
+ set isShaking(value) {
4250
+ if (value === this._isShaking) {
4251
+ return;
4252
+ }
4253
+ this._isShaking = value;
4254
+ this.commitIsShakingProperties();
4639
4255
  }
4640
4256
  // --------------------------------------------------------------------------
4641
4257
  //
4642
- // Private Methods
4258
+ // Public Properties
4643
4259
  //
4644
4260
  // --------------------------------------------------------------------------
4645
- createChildren() {
4646
- super.createChildren();
4647
- if (!_.isNil(WindowResizeElementComponent.ICON_VALUE)) {
4648
- ViewUtil.setProperty(this.nativeElement, 'innerHTML', WindowResizeElementComponent.ICON_VALUE);
4261
+ get events() {
4262
+ return this.observer.asObservable();
4263
+ }
4264
+ get config() {
4265
+ return this.properties.config;
4266
+ }
4267
+ get content() {
4268
+ return this.properties.reference ? this.properties.reference.componentInstance : null;
4269
+ }
4270
+ get container() {
4271
+ return this._container;
4272
+ }
4273
+ get wrapper() {
4274
+ return this._wrapper;
4275
+ }
4276
+ get backdrop() {
4277
+ return this._backdrop;
4278
+ }
4279
+ get isOnTop() {
4280
+ return this._isOnTop;
4281
+ }
4282
+ set isOnTop(value) {
4283
+ if (value === this._isOnTop) {
4284
+ return;
4649
4285
  }
4650
- if (!_.isNil(WindowResizeElementComponent.ICON_CLASS)) {
4651
- ViewUtil.addClasses(this.nativeElement, WindowResizeElementComponent.ICON_CLASS);
4286
+ this._isOnTop = value;
4287
+ clearInterval(this.blinkTimer);
4288
+ this.isBlink = false;
4289
+ }
4290
+ get isMinimized() {
4291
+ return this._isMinimized;
4292
+ }
4293
+ set isMinimized(value) {
4294
+ if (value === this._isMinimized) {
4295
+ return;
4652
4296
  }
4653
- ViewUtil.setStyle(this.nativeElement, 'cursor', 'pointer');
4297
+ this._isMinimized = value;
4298
+ this.commitIsMinimizedProperties();
4299
+ this.emit(WindowEvent.MINIMIZED_CHANGED);
4300
+ this.stopBlinkIfNeed();
4654
4301
  }
4655
- // --------------------------------------------------------------------------
4656
- //
4657
- // Event Handlers
4658
- //
4659
- // --------------------------------------------------------------------------
4660
- clickHandler(event) {
4661
- super.clickHandler(event);
4662
- if (!_.isNil(this.window)) {
4302
+ get isDisabled() {
4303
+ return this._isDisabled;
4304
+ }
4305
+ set isDisabled(value) {
4306
+ if (value === this._isDisabled) {
4307
+ return;
4663
4308
  }
4309
+ this._isDisabled = value;
4310
+ this.commitIsDisabledProperties();
4311
+ this.emit(WindowEvent.DISABLED_CHANGED);
4664
4312
  }
4665
4313
  }
4666
4314
  // --------------------------------------------------------------------------
4667
4315
  //
4668
- // Constants
4669
- //
4670
- // --------------------------------------------------------------------------
4671
- WindowResizeElementComponent.ICON_CLASS = 'fas fa-arrows-alt';
4672
- WindowResizeElementComponent.ICON_VALUE = null;
4673
- WindowResizeElementComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowResizeElementComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
4674
- 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"] });
4675
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowResizeElementComponent, decorators: [{
4676
- type: Component,
4677
- 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"] }]
4678
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
4316
+ // Constants
4317
+ //
4318
+ // --------------------------------------------------------------------------
4319
+ WindowImpl.BLINK_DELAY = 500;
4320
+ WindowImpl.SHAKE_DELAY = 500;
4321
+ WindowImpl.RESIZE_DELAY = 200;
4679
4322
 
4680
4323
  class WindowResizeable extends WindowImpl {
4681
4324
  // --------------------------------------------------------------------------
@@ -4916,19 +4559,11 @@ class WindowService extends Destroyable {
4916
4559
  this.language = language;
4917
4560
  this.observer = new Subject();
4918
4561
  this.properties = new PropertiesManager(cookies);
4919
- this.defaultFactory = new WindowFactory(WindowBaseComponent);
4562
+ this.factory = new WindowFactory(WindowBaseComponent);
4920
4563
  this.questionComponent = WindowQuestionComponent;
4921
4564
  }
4922
4565
  // --------------------------------------------------------------------------
4923
4566
  //
4924
- // Protected Methods
4925
- //
4926
- // --------------------------------------------------------------------------
4927
- getFactory(component, config) {
4928
- return this.defaultFactory;
4929
- }
4930
- // --------------------------------------------------------------------------
4931
- //
4932
4567
  // Private Methods
4933
4568
  //
4934
4569
  // --------------------------------------------------------------------------
@@ -5056,7 +4691,7 @@ class WindowService extends Destroyable {
5056
4691
  // let dialog = this.dialog as any;
5057
4692
  // dialog._getOverlayState = config.isModal ? dialog.getOverlayStateModal : dialog.getOverlayStateNonModal;
5058
4693
  let reference = this.dialog.open(component, config);
5059
- window = this.getFactory(component, config).create({ config, reference, overlay: reference._overlayRef });
4694
+ window = this.factory.create({ config, reference, overlay: reference._overlayRef });
5060
4695
  this.observer.next(new ObservableData(WindowServiceEvent.OPEN_STARTED, window));
5061
4696
  let subscription = window.events.subscribe(event => {
5062
4697
  switch (event) {
@@ -5112,121 +4747,485 @@ class WindowService extends Destroyable {
5112
4747
  content.window.setOnTop();
5113
4748
  return true;
5114
4749
  }
5115
- removeAll() {
5116
- this.windowsArray.forEach(window => window.close());
4750
+ removeAll() {
4751
+ this.windowsArray.forEach(window => window.close());
4752
+ }
4753
+ destroy() {
4754
+ if (this.isDestroyed) {
4755
+ return;
4756
+ }
4757
+ super.destroy();
4758
+ this.removeAll();
4759
+ if (!_.isNil(this.observer)) {
4760
+ this.observer.complete();
4761
+ this.observer = null;
4762
+ }
4763
+ if (!_.isNil(this.properties)) {
4764
+ this.properties.destroy();
4765
+ this.properties = null;
4766
+ }
4767
+ this.factory = null;
4768
+ this.questionComponent = null;
4769
+ this.dialog = null;
4770
+ this.language = null;
4771
+ this._windows = null;
4772
+ }
4773
+ // --------------------------------------------------------------------------
4774
+ //
4775
+ // Additional Methods
4776
+ //
4777
+ // --------------------------------------------------------------------------
4778
+ info(translationId, translation, questionOptions, configOptions) {
4779
+ let text = this.language.translate(translationId, translation);
4780
+ let config = _.assign(new WindowConfig(true, false, 450), configOptions);
4781
+ config.data = new QuestionManager(_.assign(questionOptions, { mode: QuestionMode.INFO, text }));
4782
+ return this.open(this.questionComponent, config).config.data;
4783
+ }
4784
+ question(translationId, translation, questionOptions, configOptions) {
4785
+ let text = this.language.translate(translationId, translation);
4786
+ let config = _.assign(new WindowConfig(true, false, 450), configOptions);
4787
+ config.data = new QuestionManager(_.assign(questionOptions, { mode: QuestionMode.QUESTION, text }));
4788
+ return this.open(this.questionComponent, config).config.data;
4789
+ }
4790
+ // --------------------------------------------------------------------------
4791
+ //
4792
+ // Private Properties
4793
+ //
4794
+ // --------------------------------------------------------------------------
4795
+ get windowsArray() {
4796
+ return Array.from(this.windows.values()).map(item => item.window);
4797
+ }
4798
+ // --------------------------------------------------------------------------
4799
+ //
4800
+ // Public Properties
4801
+ //
4802
+ // --------------------------------------------------------------------------
4803
+ get events() {
4804
+ return this.observer.asObservable();
4805
+ }
4806
+ get windows() {
4807
+ return this._windows;
4808
+ }
4809
+ }
4810
+ 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 }], target: i0.ɵɵFactoryTarget.Injectable });
4811
+ WindowService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowService, providedIn: 'root' });
4812
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowService, decorators: [{
4813
+ type: Injectable,
4814
+ args: [{ providedIn: 'root' }]
4815
+ }], ctorParameters: function () { return [{ type: i1.MatDialog }, { type: i1$1.LanguageService }, { type: CookieService }]; } });
4816
+ class PropertiesManager extends Destroyable {
4817
+ // --------------------------------------------------------------------------
4818
+ //
4819
+ // Constructor
4820
+ //
4821
+ // --------------------------------------------------------------------------
4822
+ constructor(cookies) {
4823
+ super();
4824
+ this.cookies = cookies;
4825
+ }
4826
+ // --------------------------------------------------------------------------
4827
+ //
4828
+ // Public Methods
4829
+ //
4830
+ // --------------------------------------------------------------------------
4831
+ load(name, config) {
4832
+ let item = this.cookies.getObject(name + 'Window');
4833
+ if (!item) {
4834
+ return;
4835
+ }
4836
+ if (item.hasOwnProperty('width')) {
4837
+ config.defaultWidth = item.width;
4838
+ }
4839
+ if (item.hasOwnProperty('height')) {
4840
+ config.defaultHeight = item.height;
4841
+ }
4842
+ }
4843
+ save(name, window) {
4844
+ this.cookies.putObject(name + 'Window', {
4845
+ width: window.getWidth(),
4846
+ height: window.getHeight()
4847
+ });
4848
+ }
4849
+ destroy() {
4850
+ if (this.isDestroyed) {
4851
+ return;
4852
+ }
4853
+ super.destroy();
4854
+ this.cookies = null;
4855
+ }
4856
+ }
4857
+ var WindowServiceEvent;
4858
+ (function (WindowServiceEvent) {
4859
+ WindowServiceEvent["OPEN_STARTED"] = "OPEN_STARTED";
4860
+ WindowServiceEvent["OPENED"] = "OPENED";
4861
+ WindowServiceEvent["OPEN_FINISHED"] = "OPEN_FINISHED";
4862
+ WindowServiceEvent["CLOSED"] = "CLOSED";
4863
+ WindowServiceEvent["SETTED_ON_TOP"] = "SETTED_ON_TOP";
4864
+ })(WindowServiceEvent || (WindowServiceEvent = {}));
4865
+
4866
+ class BottomSheetImpl extends DestroyableContainer {
4867
+ // --------------------------------------------------------------------------
4868
+ //
4869
+ // Constructor
4870
+ //
4871
+ // --------------------------------------------------------------------------
4872
+ constructor(properties) {
4873
+ super();
4874
+ // --------------------------------------------------------------------------
4875
+ //
4876
+ // Properties
4877
+ //
4878
+ // --------------------------------------------------------------------------
4879
+ this._isBlink = false;
4880
+ this._isDisabled = false;
4881
+ // --------------------------------------------------------------------------
4882
+ //
4883
+ // Protected Methods
4884
+ //
4885
+ // --------------------------------------------------------------------------
4886
+ this.setClosed = () => {
4887
+ this.emit(WindowEvent.CLOSED);
4888
+ this.destroy();
4889
+ };
4890
+ this.setOpened = () => {
4891
+ this.emit(WindowEvent.OPENED);
4892
+ };
4893
+ this.blinkToggle = () => {
4894
+ this.isBlink = !this.isBlink;
4895
+ };
4896
+ this.mouseDownHandlerProxy = (event) => {
4897
+ this.mouseDownHandler(event);
4898
+ };
4899
+ this.mouseClickHandlerProxy = (event) => {
4900
+ this.mouseClickHandler(event);
4901
+ };
4902
+ this.observer = new Subject();
4903
+ this.properties = properties;
4904
+ this.content.window = this;
4905
+ // Have to save for unsubscribe on destroy
4906
+ this._wrapper = this.properties.overlay.hostElement;
4907
+ this._backdrop = this.properties.overlay.backdropElement;
4908
+ this._container = this.properties.overlay.overlayElement;
4909
+ this.setProperties();
4910
+ this.elementsCreate();
4911
+ this.getReference().afterOpened().pipe(takeUntil$1(this.destroyed)).subscribe(this.setOpened);
4912
+ this.getReference().afterDismissed().pipe(takeUntil$1(this.destroyed)).subscribe(this.setClosed);
4913
+ }
4914
+ // --------------------------------------------------------------------------
4915
+ //
4916
+ // Elements Methods
4917
+ //
4918
+ // --------------------------------------------------------------------------
4919
+ elementsCreate() {
4920
+ this.elements = new Array();
4921
+ }
4922
+ elementsDestroy() {
4923
+ this.elements.forEach(item => this.elementDestroy(item));
4924
+ this.elements = null;
4925
+ }
4926
+ elementAdd(item) {
4927
+ this.elements.push(item);
4928
+ item.instance.window = this;
4929
+ return item;
4930
+ }
4931
+ elementRemove(item) {
4932
+ ArrayUtil.remove(this.elements, item);
4933
+ this.elementDestroy(item);
4934
+ return item;
4935
+ }
4936
+ elementDestroy(item) {
4937
+ item.instance.window = null;
4938
+ item.destroy();
4939
+ return item;
4940
+ }
4941
+ setProperties() {
4942
+ ViewUtil.addClass(this.container, 'vi-bottom-sheet');
4943
+ ViewUtil.toggleClass(this.container, 'vi-modal', this.config.isModal);
4944
+ if (!this.config.isModal) {
4945
+ this.container.addEventListener('click', this.mouseClickHandlerProxy, true);
4946
+ this.container.addEventListener('mousedown', this.mouseDownHandlerProxy);
4947
+ }
4948
+ }
4949
+ commitIsBlinkProperties() { }
4950
+ commitIsDisabledProperties() { }
4951
+ getConfig() {
4952
+ return this.properties.config;
4953
+ }
4954
+ getContainer() {
4955
+ return this.container;
4956
+ }
4957
+ getReference() {
4958
+ return this.properties.reference;
4959
+ }
4960
+ isNeedClickStopPropagation(event) {
4961
+ let element = _.find(this.elements, item => item.location.nativeElement === event.target);
4962
+ if (_.isNil(element)) {
4963
+ return false;
4964
+ }
4965
+ element.instance.clickHandler(event);
4966
+ return true;
4967
+ }
4968
+ stopBlinkIfNeed() {
4969
+ this.isBlink = false;
4970
+ if (!this.blinkTimer) {
4971
+ return;
4972
+ }
4973
+ clearInterval(this.blinkTimer);
4974
+ this.blinkTimer = null;
4975
+ }
4976
+ // --------------------------------------------------------------------------
4977
+ //
4978
+ // Event Handlers
4979
+ //
4980
+ // --------------------------------------------------------------------------
4981
+ mouseDownHandler(event) {
4982
+ this.setOnTop();
4983
+ }
4984
+ mouseClickHandler(event) {
4985
+ if (this.isNeedClickStopPropagation(event)) {
4986
+ event.stopPropagation();
4987
+ }
4988
+ }
4989
+ // --------------------------------------------------------------------------
4990
+ //
4991
+ // Public Methods
4992
+ //
4993
+ // --------------------------------------------------------------------------
4994
+ emit(event) {
4995
+ this.observer.next(event);
4996
+ }
4997
+ close() {
4998
+ this.getReference().dismiss();
5117
4999
  }
5118
5000
  destroy() {
5119
5001
  if (this.isDestroyed) {
5120
5002
  return;
5121
5003
  }
5122
5004
  super.destroy();
5123
- this.removeAll();
5005
+ this.elementsDestroy();
5006
+ this._container.removeEventListener('click', this.mouseClickHandlerProxy, true);
5007
+ this._container.removeEventListener('mousedown', this.mouseDownHandlerProxy);
5008
+ if (!_.isNil(this.content)) {
5009
+ this.content.destroy();
5010
+ }
5124
5011
  if (!_.isNil(this.observer)) {
5125
5012
  this.observer.complete();
5126
5013
  this.observer = null;
5127
5014
  }
5128
- if (!_.isNil(this.properties)) {
5129
- this.properties.destroy();
5130
- this.properties = null;
5131
- }
5132
- this.defaultFactory = null;
5133
- this.questionComponent = null;
5134
- this.dialog = null;
5135
- this.language = null;
5136
- this._windows = null;
5015
+ this.properties = null;
5016
+ this._wrapper = null;
5017
+ this._backdrop = null;
5018
+ this._container = null;
5019
+ clearInterval(this.blinkTimer);
5020
+ this.blinkTimer = null;
5021
+ }
5022
+ blink() {
5023
+ clearInterval(this.blinkTimer);
5024
+ this.blinkTimer = setInterval(this.blinkToggle, WindowImpl.BLINK_DELAY);
5137
5025
  }
5026
+ shake() { }
5027
+ setOnTop() { }
5138
5028
  // --------------------------------------------------------------------------
5139
5029
  //
5140
- // Additional Methods
5030
+ // Size Methods
5141
5031
  //
5142
5032
  // --------------------------------------------------------------------------
5143
- info(translationId, translation, questionOptions, configOptions) {
5144
- let text = this.language.translate(translationId, translation);
5145
- let config = _.assign(new WindowConfig(true, false, 450), configOptions);
5146
- config.data = new QuestionManager(_.assign(questionOptions, { mode: QuestionMode.INFO, text }));
5147
- return this.open(this.questionComponent, config).config.data;
5033
+ getWidth() {
5034
+ return NaN;
5148
5035
  }
5149
- question(translationId, translation, questionOptions, configOptions) {
5150
- let text = this.language.translate(translationId, translation);
5151
- let config = _.assign(new WindowConfig(true, false, 450), configOptions);
5152
- config.data = new QuestionManager(_.assign(questionOptions, { mode: QuestionMode.QUESTION, text }));
5153
- return this.open(this.questionComponent, config).config.data;
5036
+ getHeight() {
5037
+ return NaN;
5154
5038
  }
5039
+ setWidth(value, isNeedNotify = true) { }
5040
+ setHeight(value, isNeedNotify = true) { }
5041
+ setSize(width, height) { }
5155
5042
  // --------------------------------------------------------------------------
5156
5043
  //
5157
- // Private Properties
5044
+ // Move Methods
5158
5045
  //
5159
5046
  // --------------------------------------------------------------------------
5160
- get windowsArray() {
5161
- return Array.from(this.windows.values()).map(item => item.window);
5047
+ getX() {
5048
+ return NaN;
5049
+ }
5050
+ setX(value, isNeedNotify = true) { }
5051
+ getY() {
5052
+ return NaN;
5053
+ }
5054
+ setY(value, isNeedNotify = true) { }
5055
+ move(x, y) { }
5056
+ // --------------------------------------------------------------------------
5057
+ //
5058
+ // Private Properties
5059
+ //
5060
+ // --------------------------------------------------------------------------
5061
+ get reference() {
5062
+ return this.properties.reference;
5063
+ }
5064
+ get isBlink() {
5065
+ return this._isBlink;
5066
+ }
5067
+ set isBlink(value) {
5068
+ if (value === this._isBlink) {
5069
+ return;
5070
+ }
5071
+ this._isBlink = value;
5072
+ this.commitIsBlinkProperties();
5073
+ }
5074
+ get isShaking() {
5075
+ return false;
5162
5076
  }
5077
+ set isShaking(value) { }
5163
5078
  // --------------------------------------------------------------------------
5164
5079
  //
5165
- // Public Properties
5080
+ // Public Properties
5166
5081
  //
5167
5082
  // --------------------------------------------------------------------------
5168
5083
  get events() {
5169
5084
  return this.observer.asObservable();
5170
5085
  }
5171
- get windows() {
5172
- return this._windows;
5086
+ get config() {
5087
+ return this.properties.config;
5088
+ }
5089
+ get content() {
5090
+ return !_.isNil(this.reference) ? this.reference.instance : null;
5091
+ }
5092
+ get container() {
5093
+ return this._container;
5094
+ }
5095
+ get wrapper() {
5096
+ return this._wrapper;
5097
+ }
5098
+ get backdrop() {
5099
+ return this._backdrop;
5100
+ }
5101
+ get isOnTop() {
5102
+ return false;
5103
+ }
5104
+ set isOnTop(value) { }
5105
+ get isMinimized() {
5106
+ return false;
5107
+ }
5108
+ set isMinimized(value) { }
5109
+ get isDisabled() {
5110
+ return this._isDisabled;
5111
+ }
5112
+ set isDisabled(value) {
5113
+ if (value === this._isDisabled) {
5114
+ return;
5115
+ }
5116
+ this._isDisabled = value;
5117
+ this.commitIsDisabledProperties();
5118
+ this.emit(WindowEvent.DISABLED_CHANGED);
5173
5119
  }
5174
5120
  }
5175
- 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 }], target: i0.ɵɵFactoryTarget.Injectable });
5176
- WindowService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowService, providedIn: 'root' });
5177
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WindowService, decorators: [{
5178
- type: Injectable,
5179
- args: [{ providedIn: 'root' }]
5180
- }], ctorParameters: function () { return [{ type: i1.MatDialog }, { type: i1$1.LanguageService }, { type: CookieService }]; } });
5181
- class PropertiesManager extends Destroyable {
5121
+ // --------------------------------------------------------------------------
5122
+ //
5123
+ // Constants
5124
+ //
5125
+ // --------------------------------------------------------------------------
5126
+ BottomSheetImpl.BLINK_DELAY = 500;
5127
+ BottomSheetImpl.SHAKE_DELAY = 500;
5128
+
5129
+ class BottomSheetCloseElementComponent extends WindowElement {
5182
5130
  // --------------------------------------------------------------------------
5183
5131
  //
5184
5132
  // Constructor
5185
5133
  //
5186
5134
  // --------------------------------------------------------------------------
5187
- constructor(cookies) {
5188
- super();
5189
- this.cookies = cookies;
5135
+ constructor(element) {
5136
+ super(element);
5190
5137
  }
5191
5138
  // --------------------------------------------------------------------------
5192
5139
  //
5193
- // Public Methods
5140
+ // Private Methods
5194
5141
  //
5195
5142
  // --------------------------------------------------------------------------
5196
- load(name, config) {
5197
- let item = this.cookies.getObject(name + 'Window');
5198
- if (!item) {
5199
- return;
5200
- }
5201
- if (item.hasOwnProperty('width')) {
5202
- config.defaultWidth = item.width;
5143
+ createChildren() {
5144
+ super.createChildren();
5145
+ if (!_.isNil(BottomSheetCloseElementComponent.ICON_VALUE)) {
5146
+ ViewUtil.setProperty(this.nativeElement, 'innerHTML', BottomSheetCloseElementComponent.ICON_VALUE);
5203
5147
  }
5204
- if (item.hasOwnProperty('height')) {
5205
- config.defaultHeight = item.height;
5148
+ if (!_.isNil(BottomSheetCloseElementComponent.ICON_CLASS)) {
5149
+ ViewUtil.addClasses(this.nativeElement, BottomSheetCloseElementComponent.ICON_CLASS);
5206
5150
  }
5151
+ ViewUtil.addClass(this.nativeElement, 'mouse-active');
5207
5152
  }
5208
- save(name, window) {
5209
- this.cookies.putObject(name + 'Window', {
5210
- width: window.getWidth(),
5211
- height: window.getHeight()
5212
- });
5153
+ // --------------------------------------------------------------------------
5154
+ //
5155
+ // Event Handlers
5156
+ //
5157
+ // --------------------------------------------------------------------------
5158
+ clickHandler(event) {
5159
+ super.clickHandler(event);
5160
+ if (!_.isNil(this.window)) {
5161
+ this.window.close();
5162
+ }
5213
5163
  }
5214
- destroy() {
5215
- if (this.isDestroyed) {
5164
+ }
5165
+ // --------------------------------------------------------------------------
5166
+ //
5167
+ // Constants
5168
+ //
5169
+ // --------------------------------------------------------------------------
5170
+ BottomSheetCloseElementComponent.ICON_CLASS = 'fas fa-times';
5171
+ BottomSheetCloseElementComponent.ICON_VALUE = null;
5172
+ BottomSheetCloseElementComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: BottomSheetCloseElementComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
5173
+ BottomSheetCloseElementComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: BottomSheetCloseElementComponent, selector: "vi-bottom-sheet-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"] });
5174
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: BottomSheetCloseElementComponent, decorators: [{
5175
+ type: Component,
5176
+ args: [{ selector: 'vi-bottom-sheet-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"] }]
5177
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
5178
+
5179
+ class BottomSheetBaseComponent extends BottomSheetImpl {
5180
+ // --------------------------------------------------------------------------
5181
+ //
5182
+ // Protected Methods
5183
+ //
5184
+ // --------------------------------------------------------------------------
5185
+ elementsCreate() {
5186
+ super.elementsCreate();
5187
+ if (!(this.content.container instanceof ViewContainerRef)) {
5216
5188
  return;
5217
5189
  }
5218
- super.destroy();
5219
- this.cookies = null;
5190
+ if (!this.config.disableClose) {
5191
+ this.elementAdd(this.content.container.createComponent(BottomSheetBaseComponent.CLOSE_COMPONENT));
5192
+ }
5193
+ }
5194
+ commitIsBlinkProperties() {
5195
+ ViewUtil.toggleClass(this.container, this.blinkClass, this.isBlink);
5196
+ }
5197
+ commitIsDisabledProperties() {
5198
+ ViewUtil.toggleClass(this.container, this.disabledClass, this.isDisabled);
5199
+ ViewUtil.toggleClass(this.content.element, this.disabledClass, this.isDisabled);
5200
+ ViewUtil.toggleClass(this.content.element.nativeElement.parentElement, this.disabledClass, this.isDisabled);
5201
+ }
5202
+ commitIsShakingProperties() {
5203
+ ViewUtil.toggleClass(this.container, this.shakingClass, this.isShaking);
5204
+ }
5205
+ // --------------------------------------------------------------------------
5206
+ //
5207
+ // Protected Properties
5208
+ //
5209
+ // --------------------------------------------------------------------------
5210
+ get blinkClass() {
5211
+ return 'vi-blink';
5212
+ }
5213
+ get disabledClass() {
5214
+ return 'vi-disabled';
5215
+ }
5216
+ get minimizedClass() {
5217
+ return 'vi-minimized';
5218
+ }
5219
+ get shakingClass() {
5220
+ return 'shake-constant shake-horizontal';
5220
5221
  }
5221
5222
  }
5222
- var WindowServiceEvent;
5223
- (function (WindowServiceEvent) {
5224
- WindowServiceEvent["OPEN_STARTED"] = "OPEN_STARTED";
5225
- WindowServiceEvent["OPENED"] = "OPENED";
5226
- WindowServiceEvent["OPEN_FINISHED"] = "OPEN_FINISHED";
5227
- WindowServiceEvent["CLOSED"] = "CLOSED";
5228
- WindowServiceEvent["SETTED_ON_TOP"] = "SETTED_ON_TOP";
5229
- })(WindowServiceEvent || (WindowServiceEvent = {}));
5223
+ // --------------------------------------------------------------------------
5224
+ //
5225
+ // Static Properties
5226
+ //
5227
+ // --------------------------------------------------------------------------
5228
+ BottomSheetBaseComponent.CLOSE_COMPONENT = BottomSheetCloseElementComponent;
5230
5229
 
5231
5230
  class BottomSheetService extends Destroyable {
5232
5231
  // --------------------------------------------------------------------------
@@ -5239,25 +5238,17 @@ class BottomSheetService extends Destroyable {
5239
5238
  this.dialog = dialog;
5240
5239
  this.language = language;
5241
5240
  this.observer = new Subject();
5242
- this.defaultFactory = new WindowFactory(BottomSheetBaseComponent);
5241
+ this.factory = new WindowFactory(BottomSheetBaseComponent);
5243
5242
  this.questionComponent = WindowQuestionComponent;
5244
5243
  }
5245
5244
  // --------------------------------------------------------------------------
5246
5245
  //
5247
- // Protected Methods
5248
- //
5249
- // --------------------------------------------------------------------------
5250
- getFactory(component, config) {
5251
- return this.defaultFactory;
5252
- }
5253
- // --------------------------------------------------------------------------
5254
- //
5255
5246
  // Public Methods
5256
5247
  //
5257
5248
  // --------------------------------------------------------------------------
5258
5249
  open(component, config) {
5259
5250
  let reference = this.dialog.open(component, config);
5260
- let window = this.getFactory(component, config).create({ config, reference: reference, overlay: reference._overlayRef });
5251
+ let window = this.factory.create({ config, reference: reference, overlay: reference._overlayRef });
5261
5252
  this.observer.next(new ObservableData(WindowServiceEvent.OPEN_STARTED, window));
5262
5253
  let subscription = window.events.subscribe(event => {
5263
5254
  switch (event) {
@@ -5284,7 +5275,7 @@ class BottomSheetService extends Destroyable {
5284
5275
  this.observer.complete();
5285
5276
  this.observer = null;
5286
5277
  }
5287
- this.defaultFactory = null;
5278
+ this.factory = null;
5288
5279
  this.questionComponent = null;
5289
5280
  this.dialog = null;
5290
5281
  this.language = null;