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