survey-angular-ui 2.3.11 → 2.3.13

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
@@ -11,16 +11,16 @@ export declare abstract class BaseAngular<T extends Base = Base> extends Embedde
11
11
  private isModelSubsribed;
12
12
  ngDoCheck(): void;
13
13
  protected onModelChanged(): void;
14
- private setIsRendering;
15
- private getIsRendering;
14
+ private setIsModelRendering;
15
+ private getIsModelRendering;
16
16
  private isDestroyed;
17
17
  ngOnDestroy(): void;
18
- private makeBaseElementAngularCallback?;
19
18
  protected isBaseElementSubsribed(stateElement: Base): boolean;
20
- private getBaseElementCallbacks;
21
19
  private onArrayChangedCallback;
20
+ private onPropertyChangedCallback;
22
21
  private makeBaseElementAngular;
23
22
  private unMakeBaseElementAngular;
23
+ private isUpdatesBlocked;
24
24
  protected update(key?: string): void;
25
25
  private getChangeDetectorRef;
26
26
  protected getPropertiesToUpdateSync(): Array<string>;
@@ -546,6 +546,14 @@
546
546
  this.embeddedView = (_a = this.viewContainerRef) === null || _a === void 0 ? void 0 : _a.createEmbeddedView(this.templateRef);
547
547
  }
548
548
  };
549
+ EmbeddedViewContentComponent.prototype.ngDoCheck = function () {
550
+ var _a;
551
+ (_a = this.embeddedView) === null || _a === void 0 ? void 0 : _a.reattach();
552
+ };
553
+ EmbeddedViewContentComponent.prototype.ngAfterViewChecked = function () {
554
+ var _a;
555
+ (_a = this.embeddedView) === null || _a === void 0 ? void 0 : _a.detach();
556
+ };
549
557
  return EmbeddedViewContentComponent;
550
558
  }());
551
559
  EmbeddedViewContentComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: EmbeddedViewContentComponent, deps: [{ token: i0__namespace.ViewContainerRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
@@ -570,6 +578,10 @@
570
578
  _this.onArrayChangedCallback = function (stateElement, options) {
571
579
  _this.update(options.name);
572
580
  };
581
+ _this.onPropertyChangedCallback = function (stateElement, options) {
582
+ _this.update(options.name);
583
+ };
584
+ _this.isUpdatesBlocked = false;
573
585
  return _this;
574
586
  }
575
587
  Object.defineProperty(BaseAngular.prototype, "surveyModel", {
@@ -580,23 +592,24 @@
580
592
  configurable: true
581
593
  });
582
594
  BaseAngular.prototype.ngDoCheck = function () {
595
+ _super.prototype.ngDoCheck.call(this);
583
596
  if (this.previousModel !== this.getModel()) {
584
597
  this.unMakeBaseElementAngular(this.previousModel);
585
598
  this.makeBaseElementAngular(this.getModel());
586
599
  this.onModelChanged();
587
600
  this.previousModel = this.getModel();
588
601
  }
589
- this.setIsRendering(true);
602
+ this.setIsModelRendering(true);
590
603
  };
591
604
  BaseAngular.prototype.onModelChanged = function () { };
592
- BaseAngular.prototype.setIsRendering = function (val) {
605
+ BaseAngular.prototype.setIsModelRendering = function (val) {
593
606
  var model = this.getModel();
594
607
  if (!!model) {
595
608
  model.isRendering = val;
596
609
  }
597
610
  };
598
- BaseAngular.prototype.getIsRendering = function () {
599
- var model = this.getModel();
611
+ BaseAngular.prototype.getIsModelRendering = function (stateElement) {
612
+ var model = stateElement !== null && stateElement !== void 0 ? stateElement : this.getModel();
600
613
  return !!model && !!model.isRendering;
601
614
  };
602
615
  BaseAngular.prototype.ngOnDestroy = function () {
@@ -605,83 +618,46 @@
605
618
  this.previousModel = undefined;
606
619
  };
607
620
  BaseAngular.prototype.isBaseElementSubsribed = function (stateElement) {
608
- return !!stateElement.__ngImplemented;
609
- };
610
- BaseAngular.prototype.getBaseElementCallbacks = function (stateElement) {
611
621
  var _a;
612
- stateElement.__ngSubscribers = (_a = stateElement.__ngSubscribers) !== null && _a !== void 0 ? _a : [];
613
- return (stateElement.__ngSubscribers);
622
+ return ((_a = stateElement.__ngImplementedCount) !== null && _a !== void 0 ? _a : 0) > 0;
614
623
  };
615
624
  BaseAngular.prototype.makeBaseElementAngular = function (stateElement) {
616
- var _this = this;
617
- this.makeBaseElementAngularCallback = function () {
618
- _this.isModelSubsribed = true;
619
- stateElement.__ngImplemented = true;
620
- stateElement.iteratePropertiesHash(function (hash, key) {
621
- var val = hash[key];
622
- if (Array.isArray(val)) {
623
- var val = val;
624
- stateElement.addOnArrayChangedCallback(val, _this.onArrayChangedCallback);
625
- }
626
- });
627
- stateElement.setPropertyValueCoreHandler = function (hash, key, val) {
628
- if (hash[key] !== val) {
629
- hash[key] = val;
630
- _this.update(key);
631
- }
632
- };
625
+ var _a;
626
+ if (!!stateElement && !this.getIsModelRendering(stateElement)) {
627
+ this.isModelSubsribed = true;
628
+ stateElement.addOnArrayChangedCallback(this.onArrayChangedCallback);
629
+ stateElement.addOnPropertyValueChangedCallback(this.onPropertyChangedCallback);
633
630
  stateElement.enableOnElementRerenderedEvent();
634
- };
635
- if (!!stateElement) {
636
- if (!stateElement.__ngImplemented) {
637
- this.makeBaseElementAngularCallback();
638
- }
639
- else {
640
- this.getBaseElementCallbacks(stateElement).push(this.makeBaseElementAngularCallback);
641
- }
631
+ stateElement.__ngImplementedCount = ((_a = stateElement.__ngImplementedCount) !== null && _a !== void 0 ? _a : 0) + 1;
642
632
  }
643
633
  };
644
634
  BaseAngular.prototype.unMakeBaseElementAngular = function (stateElement) {
645
- var _this = this;
646
- if (!!stateElement) {
647
- if (this.isModelSubsribed) {
648
- this.isModelSubsribed = false;
649
- stateElement.__ngImplemented = false;
650
- stateElement.setPropertyValueCoreHandler = undefined;
651
- stateElement.iteratePropertiesHash(function (hash, key) {
652
- var val = hash[key];
653
- if (Array.isArray(val)) {
654
- var val = val;
655
- stateElement.removeOnArrayChangedCallback(val, _this.onArrayChangedCallback);
656
- }
657
- });
658
- stateElement.disableOnElementRerenderedEvent();
659
- var callbacks = this.getBaseElementCallbacks(stateElement);
660
- var callback = callbacks.shift();
661
- callback && callback();
662
- }
663
- else if (this.makeBaseElementAngularCallback) {
664
- var callbacks = this.getBaseElementCallbacks(stateElement);
665
- var index = callbacks.indexOf(this.makeBaseElementAngularCallback);
666
- if (index > -1) {
667
- callbacks.splice(index, 1);
668
- }
635
+ var _a;
636
+ if (!!stateElement && this.isModelSubsribed) {
637
+ this.isModelSubsribed = false;
638
+ stateElement.removeOnPropertyValueChangedCallback(this.onPropertyChangedCallback);
639
+ stateElement.removeOnArrayChangedCallback(this.onArrayChangedCallback);
640
+ stateElement.disableOnElementRerenderedEvent();
641
+ if (((_a = stateElement.__ngImplementedCount) !== null && _a !== void 0 ? _a : 0) - 1 <= 0) {
642
+ delete stateElement.__ngImplementedCount;
669
643
  }
670
644
  }
671
645
  };
672
646
  BaseAngular.prototype.update = function (key) {
673
647
  var _this = this;
674
- if (this.getIsRendering())
648
+ if (this.getIsModelRendering() || this.isUpdatesBlocked)
675
649
  return;
676
- this.beforeUpdate();
677
650
  if (key && this.getPropertiesToUpdateSync().indexOf(key) > -1) {
651
+ this.beforeUpdate();
678
652
  this.detectChanges();
679
653
  this.afterUpdate(true);
680
654
  }
681
655
  else {
656
+ this.isUpdatesBlocked = true;
682
657
  queueMicrotask(function () {
683
658
  if (!_this.isDestroyed) {
684
- _this.setIsRendering(true);
659
+ _this.isUpdatesBlocked = false;
660
+ _this.beforeUpdate();
685
661
  _this.detectChanges();
686
662
  _this.afterUpdate();
687
663
  }
@@ -701,18 +677,19 @@
701
677
  return true;
702
678
  };
703
679
  BaseAngular.prototype.beforeUpdate = function () {
704
- this.setIsRendering(true);
680
+ this.setIsModelRendering(true);
705
681
  };
706
682
  BaseAngular.prototype.afterUpdate = function (isSync) {
707
683
  if (isSync === void 0) { isSync = false; }
708
- this.setIsRendering(false);
684
+ this.setIsModelRendering(false);
709
685
  var model = this.getModel();
710
686
  if (model && !this.isDestroyed) {
711
687
  model.afterRerender();
712
688
  }
713
689
  };
714
690
  BaseAngular.prototype.ngAfterViewChecked = function () {
715
- this.setIsRendering(false);
691
+ _super.prototype.ngAfterViewChecked.call(this);
692
+ this.setIsModelRendering(false);
716
693
  };
717
694
  return BaseAngular;
718
695
  }(EmbeddedViewContentComponent));
@@ -4561,7 +4538,7 @@
4561
4538
  return PanelDynamicPrevBtn;
4562
4539
  }(PaneldynamicAction));
4563
4540
  PanelDynamicPrevBtn.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PanelDynamicPrevBtn, deps: null, target: i0__namespace.ɵɵFactoryTarget.Component });
4564
- PanelDynamicPrevBtn.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: PanelDynamicPrevBtn, selector: "sv-ng-paneldynamic-prev-btn", usesInheritance: true, ngImport: i0__namespace, template: "<div [attr.title]=\"question.panelPrevText\" (click)=\"prevPanelClick()\" [class]=\"question.getPrevButtonCss()\">\n <svg [iconName]=\"question.cssClasses.progressBtnIcon\" [size]=\"'auto'\" sv-ng-svg-icon></svg>\n</div>\n", components: [{ type: SvgIconComponent, selector: "'[sv-ng-svg-icon]'", inputs: ["size", "width", "height", "iconName", "partCss", "css", "title"] }] });
4541
+ PanelDynamicPrevBtn.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: PanelDynamicPrevBtn, selector: "sv-ng-paneldynamic-prev-btn", usesInheritance: true, ngImport: i0__namespace, template: "<div [attr.title]=\"question.prevPanelText\" (click)=\"prevPanelClick()\" [class]=\"question.getPrevButtonCss()\">\n <svg [iconName]=\"question.cssClasses.progressBtnIcon\" [size]=\"'auto'\" sv-ng-svg-icon></svg>\n</div>\n", components: [{ type: SvgIconComponent, selector: "'[sv-ng-svg-icon]'", inputs: ["size", "width", "height", "iconName", "partCss", "css", "title"] }] });
4565
4542
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PanelDynamicPrevBtn, decorators: [{
4566
4543
  type: i0.Component,
4567
4544
  args: [{