@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';
@@ -3588,7 +3588,13 @@ class WindowImpl extends WindowBase {
3588
3588
  // Elements Methods
3589
3589
  //
3590
3590
  // --------------------------------------------------------------------------
3591
- elementsCreate() { }
3591
+ elementsCreate() {
3592
+ this.elements = new Array();
3593
+ }
3594
+ elementsDestroy() {
3595
+ this.elements.forEach(item => this.elementDestroy(item));
3596
+ this.elements = null;
3597
+ }
3592
3598
  elementAdd(item) {
3593
3599
  this.elements.push(item);
3594
3600
  item.instance.window = this;
@@ -3596,6 +3602,10 @@ class WindowImpl extends WindowBase {
3596
3602
  }
3597
3603
  elementRemove(item) {
3598
3604
  ArrayUtil.remove(this.elements, item);
3605
+ this.elementDestroy(item);
3606
+ return item;
3607
+ }
3608
+ elementDestroy(item) {
3599
3609
  item.instance.window = null;
3600
3610
  item.destroy();
3601
3611
  return item;
@@ -3604,10 +3614,16 @@ class WindowImpl extends WindowBase {
3604
3614
  super.setProperties();
3605
3615
  ViewUtil.addClass(this.container, 'vi-window');
3606
3616
  ViewUtil.toggleClass(this.container, 'vi-modal', this.config.isModal);
3617
+ this.container.addEventListener('click', this.mouseClickHandlerProxy, true);
3618
+ if (!this.config.isModal) {
3619
+ this.container.addEventListener('mousedown', this.mouseDownHandlerProxy);
3620
+ }
3621
+ /*
3607
3622
  if (!this.config.isModal) {
3608
3623
  this.container.addEventListener('click', this.mouseClickHandlerProxy, true);
3609
3624
  this.container.addEventListener('mousedown', this.mouseDownHandlerProxy);
3610
3625
  }
3626
+ */
3611
3627
  this.elementsCreate();
3612
3628
  }
3613
3629
  commitIsBlinkProperties() { }
@@ -3624,7 +3640,16 @@ class WindowImpl extends WindowBase {
3624
3640
  return this.properties.reference;
3625
3641
  }
3626
3642
  isNeedClickStopPropagation(event) {
3627
- return !this.isWasOnTop;
3643
+ // return !this.isWasOnTop;
3644
+ if (this.isWasOnTop) {
3645
+ return false;
3646
+ }
3647
+ let element = _.find(this.elements, item => item.location.nativeElement === event.target);
3648
+ if (_.isNil(element)) {
3649
+ return false;
3650
+ }
3651
+ element.instance.clickHandler(event);
3652
+ return true;
3628
3653
  }
3629
3654
  stopBlinkIfNeed() {
3630
3655
  this.isBlink = false;
@@ -3661,6 +3686,7 @@ class WindowImpl extends WindowBase {
3661
3686
  return;
3662
3687
  }
3663
3688
  super.destroy();
3689
+ this.elementsDestroy();
3664
3690
  this._container.removeEventListener('click', this.mouseClickHandlerProxy, true);
3665
3691
  this._container.removeEventListener('mousedown', this.mouseDownHandlerProxy);
3666
3692
  if (!_.isNil(this.content)) {
@@ -3940,7 +3966,12 @@ class BottomSheetImpl extends DestroyableContainer {
3940
3966
  return this.properties.reference;
3941
3967
  }
3942
3968
  isNeedClickStopPropagation(event) {
3943
- return this.elements.some(item => item.location.nativeElement === event.target);
3969
+ let element = _.find(this.elements, item => item.location.nativeElement === event.target);
3970
+ if (_.isNil(element)) {
3971
+ return false;
3972
+ }
3973
+ element.instance.clickHandler(event);
3974
+ return true;
3944
3975
  }
3945
3976
  stopBlinkIfNeed() {
3946
3977
  this.isBlink = false;
@@ -4154,6 +4185,14 @@ class WindowElement extends DestroyableContainer {
4154
4185
  }
4155
4186
  // --------------------------------------------------------------------------
4156
4187
  //
4188
+ // Event Handlers
4189
+ //
4190
+ // --------------------------------------------------------------------------
4191
+ clickHandler(event) {
4192
+ event.stopPropagation();
4193
+ }
4194
+ // --------------------------------------------------------------------------
4195
+ //
4157
4196
  // Protected Properties
4158
4197
  //
4159
4198
  // --------------------------------------------------------------------------
@@ -4193,17 +4232,6 @@ class BottomSheetCloseElementComponent extends WindowElement {
4193
4232
  // --------------------------------------------------------------------------
4194
4233
  constructor(element) {
4195
4234
  super(element);
4196
- // --------------------------------------------------------------------------
4197
- //
4198
- // Event Handlers
4199
- //
4200
- // --------------------------------------------------------------------------
4201
- this.mouseClickHandler = (event) => {
4202
- event.stopPropagation();
4203
- if (!_.isNil(this.window)) {
4204
- this.window.close();
4205
- }
4206
- };
4207
4235
  }
4208
4236
  // --------------------------------------------------------------------------
4209
4237
  //
@@ -4219,11 +4247,17 @@ class BottomSheetCloseElementComponent extends WindowElement {
4219
4247
  ViewUtil.addClasses(this.nativeElement, BottomSheetCloseElementComponent.ICON_CLASS);
4220
4248
  }
4221
4249
  ViewUtil.addClass(this.nativeElement, 'mouse-active');
4222
- this.nativeElement.addEventListener('click', this.mouseClickHandler, true);
4223
4250
  }
4224
- destroyChildren() {
4225
- super.destroyChildren();
4226
- this.nativeElement.removeEventListener('click', this.mouseClickHandler, true);
4251
+ // --------------------------------------------------------------------------
4252
+ //
4253
+ // Event Handlers
4254
+ //
4255
+ // --------------------------------------------------------------------------
4256
+ clickHandler(event) {
4257
+ super.clickHandler(event);
4258
+ if (!_.isNil(this.window)) {
4259
+ this.window.close();
4260
+ }
4227
4261
  }
4228
4262
  }
4229
4263
  // --------------------------------------------------------------------------
@@ -4247,11 +4281,11 @@ class BottomSheetBaseComponent extends BottomSheetImpl {
4247
4281
  //
4248
4282
  // --------------------------------------------------------------------------
4249
4283
  elementsCreate() {
4284
+ super.elementsCreate();
4250
4285
  if (!(this.content.container instanceof ViewContainerRef)) {
4251
4286
  return;
4252
4287
  }
4253
4288
  if (!this.config.disableClose) {
4254
- // let factory = this.resolver.resolveComponentFactory(BottomSheetBaseComponent.CLOSE_COMPONENT);
4255
4289
  this.elementAdd(this.content.container.createComponent(BottomSheetBaseComponent.CLOSE_COMPONENT));
4256
4290
  }
4257
4291
  }
@@ -4271,9 +4305,6 @@ class BottomSheetBaseComponent extends BottomSheetImpl {
4271
4305
  // Protected Properties
4272
4306
  //
4273
4307
  // --------------------------------------------------------------------------
4274
- get resolver() {
4275
- return APPLICATION_INJECTOR().get(ComponentFactoryResolver);
4276
- }
4277
4308
  get blinkClass() {
4278
4309
  return 'vi-blink';
4279
4310
  }
@@ -4818,17 +4849,25 @@ class BottomSheetService extends Destroyable {
4818
4849
  this.dialog = dialog;
4819
4850
  this.language = language;
4820
4851
  this.observer = new Subject();
4821
- this.factory = new WindowFactory(BottomSheetBaseComponent);
4852
+ this.defaultFactory = new WindowFactory(BottomSheetBaseComponent);
4822
4853
  this.questionComponent = WindowQuestionComponent;
4823
4854
  }
4824
4855
  // --------------------------------------------------------------------------
4825
4856
  //
4857
+ // Protected Methods
4858
+ //
4859
+ // --------------------------------------------------------------------------
4860
+ getFactory(component, config) {
4861
+ return this.defaultFactory;
4862
+ }
4863
+ // --------------------------------------------------------------------------
4864
+ //
4826
4865
  // Public Methods
4827
4866
  //
4828
4867
  // --------------------------------------------------------------------------
4829
4868
  open(component, config) {
4830
4869
  let reference = this.dialog.open(component, config);
4831
- let window = this.factory.create({ config, reference: reference, overlay: reference._overlayRef });
4870
+ let window = this.getFactory(component, config).create({ config, reference: reference, overlay: reference._overlayRef });
4832
4871
  this.observer.next(new ObservableData(WindowServiceEvent.OPEN_STARTED, window));
4833
4872
  let subscription = window.events.subscribe(event => {
4834
4873
  switch (event) {
@@ -4855,7 +4894,7 @@ class BottomSheetService extends Destroyable {
4855
4894
  this.observer.complete();
4856
4895
  this.observer = null;
4857
4896
  }
4858
- this.factory = null;
4897
+ this.defaultFactory = null;
4859
4898
  this.questionComponent = null;
4860
4899
  this.dialog = null;
4861
4900
  this.language = null;
@@ -6473,17 +6512,6 @@ class WindowCloseElementComponent extends WindowElement {
6473
6512
  // --------------------------------------------------------------------------
6474
6513
  constructor(element) {
6475
6514
  super(element);
6476
- // --------------------------------------------------------------------------
6477
- //
6478
- // Event Handlers
6479
- //
6480
- // --------------------------------------------------------------------------
6481
- this.mouseClickHandler = (event) => {
6482
- event.stopPropagation();
6483
- if (!_.isNil(this.window)) {
6484
- this.window.close();
6485
- }
6486
- };
6487
6515
  }
6488
6516
  // --------------------------------------------------------------------------
6489
6517
  //
@@ -6499,11 +6527,17 @@ class WindowCloseElementComponent extends WindowElement {
6499
6527
  ViewUtil.addClasses(this.nativeElement, WindowCloseElementComponent.ICON_CLASS);
6500
6528
  }
6501
6529
  ViewUtil.addClass(this.nativeElement, 'mouse-active');
6502
- this.nativeElement.addEventListener('click', this.mouseClickHandler, true);
6503
6530
  }
6504
- destroyChildren() {
6505
- super.destroyChildren();
6506
- this.nativeElement.removeEventListener('click', this.mouseClickHandler, true);
6531
+ // --------------------------------------------------------------------------
6532
+ //
6533
+ // Event Handlers
6534
+ //
6535
+ // --------------------------------------------------------------------------
6536
+ clickHandler(event) {
6537
+ super.clickHandler(event);
6538
+ if (!_.isNil(this.window)) {
6539
+ this.window.close();
6540
+ }
6507
6541
  }
6508
6542
  }
6509
6543
  // --------------------------------------------------------------------------
@@ -6528,17 +6562,6 @@ class WindowResizeElementComponent extends WindowElement {
6528
6562
  // --------------------------------------------------------------------------
6529
6563
  constructor(element) {
6530
6564
  super(element);
6531
- // --------------------------------------------------------------------------
6532
- //
6533
- // Event Handlers
6534
- //
6535
- // --------------------------------------------------------------------------
6536
- this.mouseClickHandler = (event) => {
6537
- event.stopPropagation();
6538
- if (!_.isNil(this.window)) {
6539
- this.window.isMinimized = !this.window.isMinimized;
6540
- }
6541
- };
6542
6565
  }
6543
6566
  // --------------------------------------------------------------------------
6544
6567
  //
@@ -6554,10 +6577,16 @@ class WindowResizeElementComponent extends WindowElement {
6554
6577
  ViewUtil.addClasses(this.nativeElement, WindowResizeElementComponent.ICON_CLASS);
6555
6578
  }
6556
6579
  ViewUtil.setStyle(this.nativeElement, 'cursor', 'pointer');
6557
- this.nativeElement.addEventListener('click', this.mouseClickHandler, true);
6558
6580
  }
6559
- destroyChildren() {
6560
- this.nativeElement.removeEventListener('click', this.mouseClickHandler, true);
6581
+ // --------------------------------------------------------------------------
6582
+ //
6583
+ // Event Handlers
6584
+ //
6585
+ // --------------------------------------------------------------------------
6586
+ clickHandler(event) {
6587
+ super.clickHandler(event);
6588
+ if (!_.isNil(this.window)) {
6589
+ }
6561
6590
  }
6562
6591
  }
6563
6592
  // --------------------------------------------------------------------------
@@ -6591,17 +6620,6 @@ class WindowMinimizeElementComponent extends WindowElement {
6591
6620
  let icon = this.window.isMinimized ? WindowMinimizeElementComponent.ICON_MAXIMIZE_VALUE : WindowMinimizeElementComponent.ICON_MINIMIZE_VALUE;
6592
6621
  ViewUtil.setProperty(this.nativeElement, 'innerHTML', icon);
6593
6622
  };
6594
- // --------------------------------------------------------------------------
6595
- //
6596
- // Event Handlers
6597
- //
6598
- // --------------------------------------------------------------------------
6599
- this.mouseClickHandler = (event) => {
6600
- event.stopPropagation();
6601
- if (!_.isNil(this.window)) {
6602
- this.window.isMinimized = !this.window.isMinimized;
6603
- }
6604
- };
6605
6623
  }
6606
6624
  // --------------------------------------------------------------------------
6607
6625
  //
@@ -6625,11 +6643,17 @@ class WindowMinimizeElementComponent extends WindowElement {
6625
6643
  ViewUtil.addClasses(this.nativeElement, WindowMinimizeElementComponent.ICON_CLASS);
6626
6644
  }
6627
6645
  ViewUtil.addClass(this.nativeElement, 'mouse-active');
6628
- this.nativeElement.addEventListener('click', this.mouseClickHandler, true);
6629
6646
  }
6630
- destroyChildren() {
6631
- super.destroyChildren();
6632
- this.nativeElement.removeEventListener('click', this.mouseClickHandler, true);
6647
+ // --------------------------------------------------------------------------
6648
+ //
6649
+ // Event Handlers
6650
+ //
6651
+ // --------------------------------------------------------------------------
6652
+ clickHandler(event) {
6653
+ super.clickHandler(event);
6654
+ if (!_.isNil(this.window)) {
6655
+ this.window.isMinimized = !this.window.isMinimized;
6656
+ }
6633
6657
  }
6634
6658
  }
6635
6659
  // --------------------------------------------------------------------------
@@ -6803,28 +6827,19 @@ class WindowBaseComponent extends WindowDragable {
6803
6827
  // Protected Methods
6804
6828
  //
6805
6829
  // --------------------------------------------------------------------------
6806
- setProperties() {
6807
- super.setProperties();
6808
- this.createWindowComponents();
6809
- }
6810
- createWindowComponents() {
6830
+ elementsCreate() {
6831
+ super.elementsCreate();
6811
6832
  if (!(this.content.container instanceof ViewContainerRef)) {
6812
6833
  return;
6813
6834
  }
6814
- if (!this.config.disableClose && !this.closeWindow) {
6815
- let factory = this.resolver.resolveComponentFactory(WindowBaseComponent.CLOSE_COMPONENT);
6816
- this.closeWindow = this.content.container.createComponent(factory);
6817
- this.closeWindow.instance.window = this;
6835
+ if (!this.config.disableClose) {
6836
+ this.elementAdd(this.content.container.createComponent(WindowBaseComponent.CLOSE_COMPONENT));
6818
6837
  }
6819
- if (this.config.isResizeable && !this.resizedWindow) {
6820
- let factory = this.resolver.resolveComponentFactory(WindowBaseComponent.RESIZE_COMPONENT);
6821
- this.resizedWindow = this.content.container.createComponent(factory);
6822
- this.resizedWindow.instance.window = this;
6838
+ if (this.config.isResizeable) {
6839
+ this.elementAdd(this.content.container.createComponent(WindowBaseComponent.RESIZE_COMPONENT));
6823
6840
  }
6824
- if (this.config.isMinimizable && !this.minimizeWindow) {
6825
- let factory = this.resolver.resolveComponentFactory(WindowBaseComponent.MINIMIZE_COMPONENT);
6826
- this.minimizeWindow = this.content.container.createComponent(factory);
6827
- this.minimizeWindow.instance.window = this;
6841
+ if (this.config.isMinimizable) {
6842
+ this.elementAdd(this.content.container.createComponent(WindowBaseComponent.MINIMIZE_COMPONENT));
6828
6843
  }
6829
6844
  }
6830
6845
  commitIsBlinkProperties() {
@@ -6843,23 +6858,11 @@ class WindowBaseComponent extends WindowDragable {
6843
6858
  ViewUtil.toggleClass(this.content.element, this.minimizedClass, this.isMinimized);
6844
6859
  ViewUtil.toggleClass(this.content.element.nativeElement.parentElement, this.minimizedClass, this.isMinimized);
6845
6860
  }
6846
- isNeedClickStopPropagation(event) {
6847
- if (!super.isNeedClickStopPropagation(event)) {
6848
- return false;
6849
- }
6850
- if (this.closeWindow && this.closeWindow.location.nativeElement === event.target) {
6851
- return false;
6852
- }
6853
- return true;
6854
- }
6855
6861
  // --------------------------------------------------------------------------
6856
6862
  //
6857
6863
  // Protected Properties
6858
6864
  //
6859
6865
  // --------------------------------------------------------------------------
6860
- get resolver() {
6861
- return APPLICATION_INJECTOR().get(ComponentFactoryResolver);
6862
- }
6863
6866
  get blinkClass() {
6864
6867
  return 'vi-blink';
6865
6868
  }
@@ -6872,21 +6875,6 @@ class WindowBaseComponent extends WindowDragable {
6872
6875
  get shakingClass() {
6873
6876
  return 'shake-constant shake-horizontal';
6874
6877
  }
6875
- // --------------------------------------------------------------------------
6876
- //
6877
- // Public Methods
6878
- //
6879
- // --------------------------------------------------------------------------
6880
- destroy() {
6881
- if (this.isDestroyed) {
6882
- return;
6883
- }
6884
- super.destroy();
6885
- // Components will destroy automatically
6886
- this.closeWindow = null;
6887
- this.resizedWindow = null;
6888
- this.minimizeWindow = null;
6889
- }
6890
6878
  }
6891
6879
  // --------------------------------------------------------------------------
6892
6880
  //