@ts-core/angular 13.0.47 → 13.0.48

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.
Files changed (24) hide show
  1. package/bottomSheet/BottomSheetService.d.ts +2 -1
  2. package/bottomSheet/component/BottomSheetBaseComponent.d.ts +0 -2
  3. package/bottomSheet/component/bottom-sheet-close-element/bottom-sheet-close-element.component.d.ts +1 -2
  4. package/esm2020/bottomSheet/BottomSheetImpl.mjs +7 -2
  5. package/esm2020/bottomSheet/BottomSheetService.mjs +12 -4
  6. package/esm2020/bottomSheet/component/BottomSheetBaseComponent.mjs +3 -7
  7. package/esm2020/bottomSheet/component/bottom-sheet-close-element/bottom-sheet-close-element.component.mjs +11 -16
  8. package/esm2020/window/WindowImpl.mjs +29 -3
  9. package/esm2020/window/component/WindowBaseComponent.mjs +10 -47
  10. package/esm2020/window/component/WindowElement.mjs +9 -1
  11. package/esm2020/window/component/window-close-element/window-close-element.component.mjs +11 -16
  12. package/esm2020/window/component/window-minimize-element/window-minimize-element.component.mjs +11 -16
  13. package/esm2020/window/component/window-resize-element/window-resize-element.component.mjs +10 -15
  14. package/fesm2015/ts-core-angular.mjs +102 -114
  15. package/fesm2015/ts-core-angular.mjs.map +1 -1
  16. package/fesm2020/ts-core-angular.mjs +102 -114
  17. package/fesm2020/ts-core-angular.mjs.map +1 -1
  18. package/package.json +1 -1
  19. package/window/WindowImpl.d.ts +2 -0
  20. package/window/component/WindowBaseComponent.d.ts +1 -9
  21. package/window/component/WindowElement.d.ts +2 -1
  22. package/window/component/window-close-element/window-close-element.component.d.ts +1 -2
  23. package/window/component/window-minimize-element/window-minimize-element.component.d.ts +1 -2
  24. package/window/component/window-resize-element/window-resize-element.component.d.ts +1 -2
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, ViewContainerRef, Injectable, Directive, Input, Pipe, NgModule, InjectionToken, EventEmitter, Output, HostListener, ComponentFactoryResolver, Optional, Inject, RendererStyleFlags2, NgModuleFactory } from '@angular/core';
2
+ import { Component, ViewContainerRef, Injectable, Directive, Input, Pipe, NgModule, InjectionToken, EventEmitter, Output, HostListener, Optional, Inject, RendererStyleFlags2, NgModuleFactory } from '@angular/core';
3
3
  import { DestroyableContainer, LoadableEvent, Destroyable, IDestroyable, Loadable, LoadableStatus } from '@ts-core/common';
4
4
  import { PromiseHandler } from '@ts-core/common/promise';
5
5
  import * as _ from 'lodash';
@@ -3589,7 +3589,13 @@ class WindowImpl extends WindowBase {
3589
3589
  // Elements Methods
3590
3590
  //
3591
3591
  // --------------------------------------------------------------------------
3592
- elementsCreate() { }
3592
+ elementsCreate() {
3593
+ this.elements = new Array();
3594
+ }
3595
+ elementsDestroy() {
3596
+ this.elements.forEach(item => this.elementDestroy(item));
3597
+ this.elements = null;
3598
+ }
3593
3599
  elementAdd(item) {
3594
3600
  this.elements.push(item);
3595
3601
  item.instance.window = this;
@@ -3597,6 +3603,10 @@ class WindowImpl extends WindowBase {
3597
3603
  }
3598
3604
  elementRemove(item) {
3599
3605
  ArrayUtil.remove(this.elements, item);
3606
+ this.elementDestroy(item);
3607
+ return item;
3608
+ }
3609
+ elementDestroy(item) {
3600
3610
  item.instance.window = null;
3601
3611
  item.destroy();
3602
3612
  return item;
@@ -3605,10 +3615,16 @@ class WindowImpl extends WindowBase {
3605
3615
  super.setProperties();
3606
3616
  ViewUtil.addClass(this.container, 'vi-window');
3607
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);
3621
+ }
3622
+ /*
3608
3623
  if (!this.config.isModal) {
3609
3624
  this.container.addEventListener('click', this.mouseClickHandlerProxy, true);
3610
3625
  this.container.addEventListener('mousedown', this.mouseDownHandlerProxy);
3611
3626
  }
3627
+ */
3612
3628
  this.elementsCreate();
3613
3629
  }
3614
3630
  commitIsBlinkProperties() { }
@@ -3625,7 +3641,16 @@ class WindowImpl extends WindowBase {
3625
3641
  return this.properties.reference;
3626
3642
  }
3627
3643
  isNeedClickStopPropagation(event) {
3628
- return !this.isWasOnTop;
3644
+ // return !this.isWasOnTop;
3645
+ if (this.isWasOnTop) {
3646
+ return false;
3647
+ }
3648
+ let element = _.find(this.elements, item => item.location.nativeElement === event.target);
3649
+ if (_.isNil(element)) {
3650
+ return false;
3651
+ }
3652
+ element.instance.clickHandler(event);
3653
+ return true;
3629
3654
  }
3630
3655
  stopBlinkIfNeed() {
3631
3656
  this.isBlink = false;
@@ -3662,6 +3687,7 @@ class WindowImpl extends WindowBase {
3662
3687
  return;
3663
3688
  }
3664
3689
  super.destroy();
3690
+ this.elementsDestroy();
3665
3691
  this._container.removeEventListener('click', this.mouseClickHandlerProxy, true);
3666
3692
  this._container.removeEventListener('mousedown', this.mouseDownHandlerProxy);
3667
3693
  if (!_.isNil(this.content)) {
@@ -3941,7 +3967,12 @@ class BottomSheetImpl extends DestroyableContainer {
3941
3967
  return this.properties.reference;
3942
3968
  }
3943
3969
  isNeedClickStopPropagation(event) {
3944
- return this.elements.some(item => item.location.nativeElement === event.target);
3970
+ let element = _.find(this.elements, item => item.location.nativeElement === event.target);
3971
+ if (_.isNil(element)) {
3972
+ return false;
3973
+ }
3974
+ element.instance.clickHandler(event);
3975
+ return true;
3945
3976
  }
3946
3977
  stopBlinkIfNeed() {
3947
3978
  this.isBlink = false;
@@ -4155,6 +4186,14 @@ class WindowElement extends DestroyableContainer {
4155
4186
  }
4156
4187
  // --------------------------------------------------------------------------
4157
4188
  //
4189
+ // Event Handlers
4190
+ //
4191
+ // --------------------------------------------------------------------------
4192
+ clickHandler(event) {
4193
+ event.stopPropagation();
4194
+ }
4195
+ // --------------------------------------------------------------------------
4196
+ //
4158
4197
  // Protected Properties
4159
4198
  //
4160
4199
  // --------------------------------------------------------------------------
@@ -4194,17 +4233,6 @@ class BottomSheetCloseElementComponent extends WindowElement {
4194
4233
  // --------------------------------------------------------------------------
4195
4234
  constructor(element) {
4196
4235
  super(element);
4197
- // --------------------------------------------------------------------------
4198
- //
4199
- // Event Handlers
4200
- //
4201
- // --------------------------------------------------------------------------
4202
- this.mouseClickHandler = (event) => {
4203
- event.stopPropagation();
4204
- if (!_.isNil(this.window)) {
4205
- this.window.close();
4206
- }
4207
- };
4208
4236
  }
4209
4237
  // --------------------------------------------------------------------------
4210
4238
  //
@@ -4220,11 +4248,17 @@ class BottomSheetCloseElementComponent extends WindowElement {
4220
4248
  ViewUtil.addClasses(this.nativeElement, BottomSheetCloseElementComponent.ICON_CLASS);
4221
4249
  }
4222
4250
  ViewUtil.addClass(this.nativeElement, 'mouse-active');
4223
- this.nativeElement.addEventListener('click', this.mouseClickHandler, true);
4224
4251
  }
4225
- destroyChildren() {
4226
- super.destroyChildren();
4227
- this.nativeElement.removeEventListener('click', this.mouseClickHandler, true);
4252
+ // --------------------------------------------------------------------------
4253
+ //
4254
+ // Event Handlers
4255
+ //
4256
+ // --------------------------------------------------------------------------
4257
+ clickHandler(event) {
4258
+ super.clickHandler(event);
4259
+ if (!_.isNil(this.window)) {
4260
+ this.window.close();
4261
+ }
4228
4262
  }
4229
4263
  }
4230
4264
  // --------------------------------------------------------------------------
@@ -4248,11 +4282,11 @@ class BottomSheetBaseComponent extends BottomSheetImpl {
4248
4282
  //
4249
4283
  // --------------------------------------------------------------------------
4250
4284
  elementsCreate() {
4285
+ super.elementsCreate();
4251
4286
  if (!(this.content.container instanceof ViewContainerRef)) {
4252
4287
  return;
4253
4288
  }
4254
4289
  if (!this.config.disableClose) {
4255
- // let factory = this.resolver.resolveComponentFactory(BottomSheetBaseComponent.CLOSE_COMPONENT);
4256
4290
  this.elementAdd(this.content.container.createComponent(BottomSheetBaseComponent.CLOSE_COMPONENT));
4257
4291
  }
4258
4292
  }
@@ -4272,9 +4306,6 @@ class BottomSheetBaseComponent extends BottomSheetImpl {
4272
4306
  // Protected Properties
4273
4307
  //
4274
4308
  // --------------------------------------------------------------------------
4275
- get resolver() {
4276
- return APPLICATION_INJECTOR().get(ComponentFactoryResolver);
4277
- }
4278
4309
  get blinkClass() {
4279
4310
  return 'vi-blink';
4280
4311
  }
@@ -4821,17 +4852,25 @@ class BottomSheetService extends Destroyable {
4821
4852
  this.dialog = dialog;
4822
4853
  this.language = language;
4823
4854
  this.observer = new Subject();
4824
- this.factory = new WindowFactory(BottomSheetBaseComponent);
4855
+ this.defaultFactory = new WindowFactory(BottomSheetBaseComponent);
4825
4856
  this.questionComponent = WindowQuestionComponent;
4826
4857
  }
4827
4858
  // --------------------------------------------------------------------------
4828
4859
  //
4860
+ // Protected Methods
4861
+ //
4862
+ // --------------------------------------------------------------------------
4863
+ getFactory(component, config) {
4864
+ return this.defaultFactory;
4865
+ }
4866
+ // --------------------------------------------------------------------------
4867
+ //
4829
4868
  // Public Methods
4830
4869
  //
4831
4870
  // --------------------------------------------------------------------------
4832
4871
  open(component, config) {
4833
4872
  let reference = this.dialog.open(component, config);
4834
- let window = this.factory.create({ config, reference: reference, overlay: reference._overlayRef });
4873
+ let window = this.getFactory(component, config).create({ config, reference: reference, overlay: reference._overlayRef });
4835
4874
  this.observer.next(new ObservableData(WindowServiceEvent.OPEN_STARTED, window));
4836
4875
  let subscription = window.events.subscribe(event => {
4837
4876
  switch (event) {
@@ -4858,7 +4897,7 @@ class BottomSheetService extends Destroyable {
4858
4897
  this.observer.complete();
4859
4898
  this.observer = null;
4860
4899
  }
4861
- this.factory = null;
4900
+ this.defaultFactory = null;
4862
4901
  this.questionComponent = null;
4863
4902
  this.dialog = null;
4864
4903
  this.language = null;
@@ -6476,17 +6515,6 @@ class WindowCloseElementComponent extends WindowElement {
6476
6515
  // --------------------------------------------------------------------------
6477
6516
  constructor(element) {
6478
6517
  super(element);
6479
- // --------------------------------------------------------------------------
6480
- //
6481
- // Event Handlers
6482
- //
6483
- // --------------------------------------------------------------------------
6484
- this.mouseClickHandler = (event) => {
6485
- event.stopPropagation();
6486
- if (!_.isNil(this.window)) {
6487
- this.window.close();
6488
- }
6489
- };
6490
6518
  }
6491
6519
  // --------------------------------------------------------------------------
6492
6520
  //
@@ -6502,11 +6530,17 @@ class WindowCloseElementComponent extends WindowElement {
6502
6530
  ViewUtil.addClasses(this.nativeElement, WindowCloseElementComponent.ICON_CLASS);
6503
6531
  }
6504
6532
  ViewUtil.addClass(this.nativeElement, 'mouse-active');
6505
- this.nativeElement.addEventListener('click', this.mouseClickHandler, true);
6506
6533
  }
6507
- destroyChildren() {
6508
- super.destroyChildren();
6509
- this.nativeElement.removeEventListener('click', this.mouseClickHandler, true);
6534
+ // --------------------------------------------------------------------------
6535
+ //
6536
+ // Event Handlers
6537
+ //
6538
+ // --------------------------------------------------------------------------
6539
+ clickHandler(event) {
6540
+ super.clickHandler(event);
6541
+ if (!_.isNil(this.window)) {
6542
+ this.window.close();
6543
+ }
6510
6544
  }
6511
6545
  }
6512
6546
  // --------------------------------------------------------------------------
@@ -6531,17 +6565,6 @@ class WindowResizeElementComponent extends WindowElement {
6531
6565
  // --------------------------------------------------------------------------
6532
6566
  constructor(element) {
6533
6567
  super(element);
6534
- // --------------------------------------------------------------------------
6535
- //
6536
- // Event Handlers
6537
- //
6538
- // --------------------------------------------------------------------------
6539
- this.mouseClickHandler = (event) => {
6540
- event.stopPropagation();
6541
- if (!_.isNil(this.window)) {
6542
- this.window.isMinimized = !this.window.isMinimized;
6543
- }
6544
- };
6545
6568
  }
6546
6569
  // --------------------------------------------------------------------------
6547
6570
  //
@@ -6557,10 +6580,16 @@ class WindowResizeElementComponent extends WindowElement {
6557
6580
  ViewUtil.addClasses(this.nativeElement, WindowResizeElementComponent.ICON_CLASS);
6558
6581
  }
6559
6582
  ViewUtil.setStyle(this.nativeElement, 'cursor', 'pointer');
6560
- this.nativeElement.addEventListener('click', this.mouseClickHandler, true);
6561
6583
  }
6562
- destroyChildren() {
6563
- this.nativeElement.removeEventListener('click', this.mouseClickHandler, true);
6584
+ // --------------------------------------------------------------------------
6585
+ //
6586
+ // Event Handlers
6587
+ //
6588
+ // --------------------------------------------------------------------------
6589
+ clickHandler(event) {
6590
+ super.clickHandler(event);
6591
+ if (!_.isNil(this.window)) {
6592
+ }
6564
6593
  }
6565
6594
  }
6566
6595
  // --------------------------------------------------------------------------
@@ -6594,17 +6623,6 @@ class WindowMinimizeElementComponent extends WindowElement {
6594
6623
  let icon = this.window.isMinimized ? WindowMinimizeElementComponent.ICON_MAXIMIZE_VALUE : WindowMinimizeElementComponent.ICON_MINIMIZE_VALUE;
6595
6624
  ViewUtil.setProperty(this.nativeElement, 'innerHTML', icon);
6596
6625
  };
6597
- // --------------------------------------------------------------------------
6598
- //
6599
- // Event Handlers
6600
- //
6601
- // --------------------------------------------------------------------------
6602
- this.mouseClickHandler = (event) => {
6603
- event.stopPropagation();
6604
- if (!_.isNil(this.window)) {
6605
- this.window.isMinimized = !this.window.isMinimized;
6606
- }
6607
- };
6608
6626
  }
6609
6627
  // --------------------------------------------------------------------------
6610
6628
  //
@@ -6628,11 +6646,17 @@ class WindowMinimizeElementComponent extends WindowElement {
6628
6646
  ViewUtil.addClasses(this.nativeElement, WindowMinimizeElementComponent.ICON_CLASS);
6629
6647
  }
6630
6648
  ViewUtil.addClass(this.nativeElement, 'mouse-active');
6631
- this.nativeElement.addEventListener('click', this.mouseClickHandler, true);
6632
6649
  }
6633
- destroyChildren() {
6634
- super.destroyChildren();
6635
- this.nativeElement.removeEventListener('click', this.mouseClickHandler, true);
6650
+ // --------------------------------------------------------------------------
6651
+ //
6652
+ // Event Handlers
6653
+ //
6654
+ // --------------------------------------------------------------------------
6655
+ clickHandler(event) {
6656
+ super.clickHandler(event);
6657
+ if (!_.isNil(this.window)) {
6658
+ this.window.isMinimized = !this.window.isMinimized;
6659
+ }
6636
6660
  }
6637
6661
  }
6638
6662
  // --------------------------------------------------------------------------
@@ -6806,28 +6830,19 @@ class WindowBaseComponent extends WindowDragable {
6806
6830
  // Protected Methods
6807
6831
  //
6808
6832
  // --------------------------------------------------------------------------
6809
- setProperties() {
6810
- super.setProperties();
6811
- this.createWindowComponents();
6812
- }
6813
- createWindowComponents() {
6833
+ elementsCreate() {
6834
+ super.elementsCreate();
6814
6835
  if (!(this.content.container instanceof ViewContainerRef)) {
6815
6836
  return;
6816
6837
  }
6817
- if (!this.config.disableClose && !this.closeWindow) {
6818
- let factory = this.resolver.resolveComponentFactory(WindowBaseComponent.CLOSE_COMPONENT);
6819
- this.closeWindow = this.content.container.createComponent(factory);
6820
- this.closeWindow.instance.window = this;
6838
+ if (!this.config.disableClose) {
6839
+ this.elementAdd(this.content.container.createComponent(WindowBaseComponent.CLOSE_COMPONENT));
6821
6840
  }
6822
- if (this.config.isResizeable && !this.resizedWindow) {
6823
- let factory = this.resolver.resolveComponentFactory(WindowBaseComponent.RESIZE_COMPONENT);
6824
- this.resizedWindow = this.content.container.createComponent(factory);
6825
- this.resizedWindow.instance.window = this;
6841
+ if (this.config.isResizeable) {
6842
+ this.elementAdd(this.content.container.createComponent(WindowBaseComponent.RESIZE_COMPONENT));
6826
6843
  }
6827
- if (this.config.isMinimizable && !this.minimizeWindow) {
6828
- let factory = this.resolver.resolveComponentFactory(WindowBaseComponent.MINIMIZE_COMPONENT);
6829
- this.minimizeWindow = this.content.container.createComponent(factory);
6830
- this.minimizeWindow.instance.window = this;
6844
+ if (this.config.isMinimizable) {
6845
+ this.elementAdd(this.content.container.createComponent(WindowBaseComponent.MINIMIZE_COMPONENT));
6831
6846
  }
6832
6847
  }
6833
6848
  commitIsBlinkProperties() {
@@ -6846,23 +6861,11 @@ class WindowBaseComponent extends WindowDragable {
6846
6861
  ViewUtil.toggleClass(this.content.element, this.minimizedClass, this.isMinimized);
6847
6862
  ViewUtil.toggleClass(this.content.element.nativeElement.parentElement, this.minimizedClass, this.isMinimized);
6848
6863
  }
6849
- isNeedClickStopPropagation(event) {
6850
- if (!super.isNeedClickStopPropagation(event)) {
6851
- return false;
6852
- }
6853
- if (this.closeWindow && this.closeWindow.location.nativeElement === event.target) {
6854
- return false;
6855
- }
6856
- return true;
6857
- }
6858
6864
  // --------------------------------------------------------------------------
6859
6865
  //
6860
6866
  // Protected Properties
6861
6867
  //
6862
6868
  // --------------------------------------------------------------------------
6863
- get resolver() {
6864
- return APPLICATION_INJECTOR().get(ComponentFactoryResolver);
6865
- }
6866
6869
  get blinkClass() {
6867
6870
  return 'vi-blink';
6868
6871
  }
@@ -6875,21 +6878,6 @@ class WindowBaseComponent extends WindowDragable {
6875
6878
  get shakingClass() {
6876
6879
  return 'shake-constant shake-horizontal';
6877
6880
  }
6878
- // --------------------------------------------------------------------------
6879
- //
6880
- // Public Methods
6881
- //
6882
- // --------------------------------------------------------------------------
6883
- destroy() {
6884
- if (this.isDestroyed) {
6885
- return;
6886
- }
6887
- super.destroy();
6888
- // Components will destroy automatically
6889
- this.closeWindow = null;
6890
- this.resizedWindow = null;
6891
- this.minimizeWindow = null;
6892
- }
6893
6881
  }
6894
6882
  // --------------------------------------------------------------------------
6895
6883
  //