survey-angular-ui 2.0.0-rc.9 → 2.0.0

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.
package/base-angular.d.ts CHANGED
@@ -15,6 +15,9 @@ export declare abstract class BaseAngular<T extends Base = Base> extends Embedde
15
15
  private getIsRendering;
16
16
  private isDestroyed;
17
17
  ngOnDestroy(): void;
18
+ private makeBaseElementAngularCallback?;
19
+ protected isBaseElementSubsribed(stateElement: Base): boolean;
20
+ private getBaseElementCallbacks;
18
21
  private makeBaseElementAngular;
19
22
  private unMakeBaseElementAngular;
20
23
  protected update(key?: string): void;
@@ -601,10 +601,18 @@
601
601
  this.unMakeBaseElementAngular(this.getModel());
602
602
  this.previousModel = undefined;
603
603
  };
604
+ BaseAngular.prototype.isBaseElementSubsribed = function (stateElement) {
605
+ return !!stateElement.__ngImplemented;
606
+ };
607
+ BaseAngular.prototype.getBaseElementCallbacks = function (stateElement) {
608
+ var _a;
609
+ stateElement.__ngSubscribers = (_a = stateElement.__ngSubscribers) !== null && _a !== void 0 ? _a : [];
610
+ return (stateElement.__ngSubscribers);
611
+ };
604
612
  BaseAngular.prototype.makeBaseElementAngular = function (stateElement) {
605
613
  var _this = this;
606
- if (!!stateElement && !stateElement.__ngImplemented) {
607
- this.isModelSubsribed = true;
614
+ this.makeBaseElementAngularCallback = function () {
615
+ _this.isModelSubsribed = true;
608
616
  stateElement.__ngImplemented = true;
609
617
  stateElement.iteratePropertiesHash(function (hash, key) {
610
618
  var val = hash[key];
@@ -622,21 +630,41 @@
622
630
  }
623
631
  };
624
632
  stateElement.enableOnElementRerenderedEvent();
633
+ };
634
+ if (!!stateElement) {
635
+ if (!stateElement.__ngImplemented) {
636
+ this.makeBaseElementAngularCallback();
637
+ }
638
+ else {
639
+ this.getBaseElementCallbacks(stateElement).push(this.makeBaseElementAngularCallback);
640
+ }
625
641
  }
626
642
  };
627
643
  BaseAngular.prototype.unMakeBaseElementAngular = function (stateElement) {
628
- if (!!stateElement && this.isModelSubsribed) {
629
- this.isModelSubsribed = false;
630
- stateElement.__ngImplemented = false;
631
- stateElement.setPropertyValueCoreHandler = undefined;
632
- stateElement.iteratePropertiesHash(function (hash, key) {
633
- var val = hash[key];
634
- if (Array.isArray(val)) {
635
- var val = val;
636
- val["onArrayChanged"] = function () { };
644
+ if (!!stateElement) {
645
+ if (this.isModelSubsribed) {
646
+ this.isModelSubsribed = false;
647
+ stateElement.__ngImplemented = false;
648
+ stateElement.setPropertyValueCoreHandler = undefined;
649
+ stateElement.iteratePropertiesHash(function (hash, key) {
650
+ var val = hash[key];
651
+ if (Array.isArray(val)) {
652
+ var val = val;
653
+ val["onArrayChanged"] = function () { };
654
+ }
655
+ });
656
+ stateElement.disableOnElementRerenderedEvent();
657
+ var callbacks = this.getBaseElementCallbacks(stateElement);
658
+ var callback = callbacks.shift();
659
+ callback && callback();
660
+ }
661
+ else if (this.makeBaseElementAngularCallback) {
662
+ var callbacks = this.getBaseElementCallbacks(stateElement);
663
+ var index = callbacks.indexOf(this.makeBaseElementAngularCallback);
664
+ if (index > -1) {
665
+ callbacks.splice(index, 1);
637
666
  }
638
- });
639
- stateElement.disableOnElementRerenderedEvent();
667
+ }
640
668
  }
641
669
  };
642
670
  BaseAngular.prototype.update = function (key) {
@@ -1471,8 +1499,10 @@
1471
1499
  };
1472
1500
  RowComponent.prototype.ngOnDestroy = function () {
1473
1501
  _super.prototype.ngOnDestroy.call(this);
1474
- this.row.setRootElement(undefined);
1475
- this.stopLazyRendering();
1502
+ if (!this.isBaseElementSubsribed(this.row)) {
1503
+ this.row.setRootElement(undefined);
1504
+ this.stopLazyRendering();
1505
+ }
1476
1506
  };
1477
1507
  return RowComponent;
1478
1508
  }(BaseAngular));