survey-react-ui 1.9.136 → 1.9.137

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - Survey JavaScript library v1.9.136
2
+ * surveyjs - Survey JavaScript library v1.9.137
3
3
  * Copyright (c) 2015-2024 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
5
5
  */
@@ -1641,6 +1641,8 @@ var Base = /** @class */ (function () {
1641
1641
  * @param val A new value for the property.
1642
1642
  */
1643
1643
  Base.prototype.setPropertyValue = function (name, val) {
1644
+ if (name) {
1645
+ }
1644
1646
  if (!this.isLoadingFromJson) {
1645
1647
  var prop = this.getPropertyByName(name);
1646
1648
  if (!!prop) {
@@ -1702,7 +1704,7 @@ var Base = /** @class */ (function () {
1702
1704
  return;
1703
1705
  for (var i = 0; i < this.onPropChangeFunctions.length; i++) {
1704
1706
  if (this.onPropChangeFunctions[i].name == name)
1705
- this.onPropChangeFunctions[i].func(newValue);
1707
+ this.onPropChangeFunctions[i].func(newValue, arrayChanges);
1706
1708
  }
1707
1709
  };
1708
1710
  Base.prototype.onBindingChanged = function (oldValue, newValue) {
@@ -3587,7 +3589,7 @@ __webpack_require__.r(__webpack_exports__);
3587
3589
 
3588
3590
 
3589
3591
 
3590
- Object(survey_core__WEBPACK_IMPORTED_MODULE_2__["checkLibraryVersion"])("" + "1.9.136", "survey-react-ui");
3592
+ Object(survey_core__WEBPACK_IMPORTED_MODULE_2__["checkLibraryVersion"])("" + "1.9.137", "survey-react-ui");
3591
3593
 
3592
3594
 
3593
3595
  /***/ }),
@@ -13961,18 +13963,18 @@ var PopupContainer = /** @class */ (function (_super) {
13961
13963
  }
13962
13964
  this.prevIsVisible = this.model.isVisible;
13963
13965
  };
13964
- PopupContainer.prototype.renderContainer = function (PopupBaseViewModel) {
13966
+ PopupContainer.prototype.renderContainer = function (popupBaseViewModel) {
13965
13967
  var _this = this;
13966
- var headerPopup = PopupBaseViewModel.showHeader ? this.renderHeaderPopup(PopupBaseViewModel) : null;
13967
- var headerContent = !!PopupBaseViewModel.title ? this.renderHeaderContent() : null;
13968
+ var headerPopup = popupBaseViewModel.showHeader ? this.renderHeaderPopup(popupBaseViewModel) : null;
13969
+ var headerContent = !!popupBaseViewModel.title ? this.renderHeaderContent() : null;
13968
13970
  var content = this.renderContent();
13969
- var footerContent = PopupBaseViewModel.showFooter ? this.renderFooter(this.model) : null;
13971
+ var footerContent = popupBaseViewModel.showFooter ? this.renderFooter(this.model) : null;
13970
13972
  return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("div", { className: "sv-popup__container", style: {
13971
- left: PopupBaseViewModel.left,
13972
- top: PopupBaseViewModel.top,
13973
- height: PopupBaseViewModel.height,
13974
- width: PopupBaseViewModel.width,
13975
- minWidth: PopupBaseViewModel.minWidth,
13973
+ left: popupBaseViewModel.left,
13974
+ top: popupBaseViewModel.top,
13975
+ height: popupBaseViewModel.height,
13976
+ width: popupBaseViewModel.width,
13977
+ minWidth: popupBaseViewModel.minWidth,
13976
13978
  }, onClick: function (ev) {
13977
13979
  _this.clickInside(ev);
13978
13980
  } },
@@ -14036,11 +14038,14 @@ function showModal(componentName, data, onApply, onCancel, cssClass, title, disp
14036
14038
  return showDialog(options);
14037
14039
  }
14038
14040
  function showDialog(dialogOptions, rootElement) {
14039
- dialogOptions.onHide = function () {
14040
- react_dom__WEBPACK_IMPORTED_MODULE_0___default.a.unmountComponentAtNode(popupViewModel.container);
14041
- popupViewModel.dispose();
14042
- };
14043
14041
  var popupViewModel = Object(survey_core__WEBPACK_IMPORTED_MODULE_2__["createPopupModalViewModel"])(dialogOptions, rootElement);
14042
+ var onVisibilityChangedCallback = function (_, options) {
14043
+ if (!options.isVisible) {
14044
+ react_dom__WEBPACK_IMPORTED_MODULE_0___default.a.unmountComponentAtNode(popupViewModel.container);
14045
+ popupViewModel.dispose();
14046
+ }
14047
+ };
14048
+ popupViewModel.onVisibilityChanged.add(onVisibilityChangedCallback);
14044
14049
  react_dom__WEBPACK_IMPORTED_MODULE_0___default.a.render(react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(PopupContainer, { model: popupViewModel }), popupViewModel.container);
14045
14050
  popupViewModel.model.isVisible = true;
14046
14051
  return popupViewModel;
@@ -15472,6 +15477,7 @@ var SurveyRowElement = /** @class */ (function (_super) {
15472
15477
  function SurveyRowElement(props) {
15473
15478
  var _this = _super.call(this, props) || this;
15474
15479
  _this.element.cssClasses;
15480
+ _this.rootRef = react__WEBPACK_IMPORTED_MODULE_0__["createRef"]();
15475
15481
  return _this;
15476
15482
  }
15477
15483
  SurveyRowElement.prototype.getStateElement = function () {
@@ -15519,9 +15525,27 @@ var SurveyRowElement = /** @class */ (function (_super) {
15519
15525
  enumerable: false,
15520
15526
  configurable: true
15521
15527
  });
15528
+ SurveyRowElement.prototype.componentDidMount = function () {
15529
+ _super.prototype.componentDidMount.call(this);
15530
+ if (this.rootRef.current) {
15531
+ (this.element).setWrapperElement(this.rootRef.current);
15532
+ }
15533
+ };
15534
+ SurveyRowElement.prototype.componentWillUnmount = function () {
15535
+ _super.prototype.componentWillUnmount.call(this);
15536
+ this.element.setWrapperElement(undefined);
15537
+ };
15522
15538
  SurveyRowElement.prototype.shouldComponentUpdate = function (nextProps, nextState) {
15523
15539
  if (!_super.prototype.shouldComponentUpdate.call(this, nextProps, nextState))
15524
15540
  return false;
15541
+ if (nextProps.element !== this.element) {
15542
+ if (nextProps.element) {
15543
+ nextProps.element.setWrapperElement(this.rootRef.current);
15544
+ }
15545
+ if (this.element) {
15546
+ this.element.setWrapperElement(undefined);
15547
+ }
15548
+ }
15525
15549
  this.element.cssClasses;
15526
15550
  return true;
15527
15551
  };
@@ -15535,7 +15559,7 @@ var SurveyRowElement = /** @class */ (function (_super) {
15535
15559
  el.focusIn();
15536
15560
  }
15537
15561
  };
15538
- return (react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: css.questionWrapper, style: element.rootStyle, "data-key": innerElement.key, key: innerElement.key, onFocus: focusIn }, this.row.isNeedRender ? innerElement : _element_factory__WEBPACK_IMPORTED_MODULE_2__["ReactElementFactory"].Instance.createElement(element.skeletonComponentName, { element: element, css: this.css, })));
15562
+ return (react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: css.questionWrapper, style: element.rootStyle, "data-key": innerElement.key, key: innerElement.key, onFocus: focusIn, ref: this.rootRef }, this.row.isNeedRender ? innerElement : _element_factory__WEBPACK_IMPORTED_MODULE_2__["ReactElementFactory"].Instance.createElement(element.skeletonComponentName, { element: element, css: this.css, })));
15539
15563
  };
15540
15564
  SurveyRowElement.prototype.createElement = function (element, elementIndex) {
15541
15565
  var index = elementIndex ? "-" + elementIndex : 0;
@@ -16078,6 +16102,10 @@ var SurveyPage = /** @class */ (function (_super) {
16078
16102
  enumerable: false,
16079
16103
  configurable: true
16080
16104
  });
16105
+ // shouldComponentUpdate(nextProps: any, nextState: any): boolean {
16106
+ // if(!super.shouldComponentUpdate(nextProps, nextState)) return false;
16107
+ // return true;
16108
+ // }
16081
16109
  SurveyPage.prototype.renderElement = function () {
16082
16110
  var title = this.renderTitle();
16083
16111
  var description = this.renderDescription();
@@ -16218,13 +16246,15 @@ var SurveyPanelBase = /** @class */ (function (_super) {
16218
16246
  }
16219
16247
  }
16220
16248
  };
16249
+ SurveyPanelBase.prototype.getIsVisible = function () {
16250
+ return this.panelBase.isVisible;
16251
+ };
16221
16252
  SurveyPanelBase.prototype.canRender = function () {
16222
- return (_super.prototype.canRender.call(this) && !!this.survey && !!this.panelBase
16223
- && this.panelBase.isVisible && !!this.panelBase.survey);
16253
+ return (_super.prototype.canRender.call(this) && !!this.survey && !!this.panelBase && !!this.panelBase.survey && this.getIsVisible());
16224
16254
  };
16225
16255
  SurveyPanelBase.prototype.renderRows = function (css) {
16226
16256
  var _this = this;
16227
- return this.panelBase.rows.map(function (row) { return _this.createRow(row, css); });
16257
+ return this.panelBase.visibleRows.map(function (row) { return _this.createRow(row, css); });
16228
16258
  };
16229
16259
  SurveyPanelBase.prototype.createRow = function (row, css) {
16230
16260
  return (react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_row__WEBPACK_IMPORTED_MODULE_2__["SurveyRow"], { key: row.id, row: row, survey: this.survey, creator: this.creator, css: css }));
@@ -16300,11 +16330,11 @@ var SurveyPanel = /** @class */ (function (_super) {
16300
16330
  var errors = (react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_reactquestion__WEBPACK_IMPORTED_MODULE_1__["SurveyElementErrors"], { element: this.panelBase, cssClasses: this.panelBase.cssClasses, creator: this.creator }));
16301
16331
  var style = {
16302
16332
  paddingLeft: this.panel.innerPaddingLeft,
16303
- display: !this.panel.isCollapsed ? undefined : "none",
16333
+ display: this.panel.renderedIsExpanded ? undefined : "none",
16304
16334
  };
16305
16335
  var content = null;
16306
- if (!this.panel.isCollapsed || this.hasBeenExpanded) {
16307
- this.hasBeenExpanded = true;
16336
+ if (this.panel.renderedIsExpanded) {
16337
+ // this.hasBeenExpanded = true;
16308
16338
  var rows = this.renderRows(this.panelBase.cssClasses);
16309
16339
  var className = this.panelBase.cssClasses.panel.content;
16310
16340
  content = this.renderContent(style, rows, className);
@@ -16356,6 +16386,9 @@ var SurveyPanel = /** @class */ (function (_super) {
16356
16386
  return null;
16357
16387
  return react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_components_action_bar_action_bar__WEBPACK_IMPORTED_MODULE_6__["SurveyActionBar"], { model: footerToolbar });
16358
16388
  };
16389
+ SurveyPanel.prototype.getIsVisible = function () {
16390
+ return this.panelBase.getIsContentVisible();
16391
+ };
16359
16392
  return SurveyPanel;
16360
16393
  }(_panel_base__WEBPACK_IMPORTED_MODULE_4__["SurveyPanelBase"]));
16361
16394
 
@@ -17343,8 +17376,7 @@ var SurveyQuestion = /** @class */ (function (_super) {
17343
17376
  return _this;
17344
17377
  }
17345
17378
  SurveyQuestion.renderQuestionBody = function (creator, question) {
17346
- if (!question.isVisible)
17347
- return null;
17379
+ // if (!question.isVisible) return null;
17348
17380
  var customWidget = question.customWidget;
17349
17381
  if (!customWidget) {
17350
17382
  return creator.createQuestionElement(question);
@@ -17410,13 +17442,12 @@ var SurveyQuestion = /** @class */ (function (_super) {
17410
17442
  SurveyQuestion.prototype.canRender = function () {
17411
17443
  return (_super.prototype.canRender.call(this) &&
17412
17444
  !!this.question &&
17413
- !!this.creator &&
17414
- this.question.isVisible);
17445
+ !!this.creator);
17415
17446
  };
17416
17447
  SurveyQuestion.prototype.renderQuestionContent = function () {
17417
17448
  var question = this.question;
17418
17449
  var contentStyle = {
17419
- display: !this.question.isCollapsed ? "" : "none",
17450
+ display: this.question.renderedIsExpanded ? "" : "none",
17420
17451
  };
17421
17452
  var cssClasses = question.cssClasses;
17422
17453
  var questionRender = this.renderQuestion();
@@ -21287,7 +21318,7 @@ var SurveyRow = /** @class */ (function (_super) {
21287
21318
  configurable: true
21288
21319
  });
21289
21320
  SurveyRow.prototype.canRender = function () {
21290
- return !!this.row && !!this.survey && !!this.creator && this.row.visible;
21321
+ return !!this.row && !!this.survey && !!this.creator;
21291
21322
  };
21292
21323
  SurveyRow.prototype.renderElementContent = function () {
21293
21324
  var _this = this;
@@ -21308,6 +21339,9 @@ var SurveyRow = /** @class */ (function (_super) {
21308
21339
  var _this = this;
21309
21340
  _super.prototype.componentDidMount.call(this);
21310
21341
  var el = this.rootRef.current;
21342
+ if (this.rootRef.current) {
21343
+ this.row.setRootElement(this.rootRef.current);
21344
+ }
21311
21345
  if (!!el && !this.row.isNeedRender) {
21312
21346
  var rowContainerDiv = el;
21313
21347
  setTimeout(function () {
@@ -21320,6 +21354,8 @@ var SurveyRow = /** @class */ (function (_super) {
21320
21354
  return false;
21321
21355
  if (nextProps.row !== this.row) {
21322
21356
  nextProps.row.isNeedRender = this.row.isNeedRender;
21357
+ nextProps.row.setRootElement(this.rootRef.current);
21358
+ this.row.setRootElement(undefined);
21323
21359
  this.stopLazyRendering();
21324
21360
  }
21325
21361
  this.recalculateCss();
@@ -21331,6 +21367,7 @@ var SurveyRow = /** @class */ (function (_super) {
21331
21367
  };
21332
21368
  SurveyRow.prototype.componentWillUnmount = function () {
21333
21369
  _super.prototype.componentWillUnmount.call(this);
21370
+ this.row.setRootElement(undefined);
21334
21371
  this.stopLazyRendering();
21335
21372
  };
21336
21373
  SurveyRow.prototype.createElement = function (element, elementIndex) {
@@ -22629,7 +22666,9 @@ __webpack_require__.r(__webpack_exports__);
22629
22666
  /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./settings */ "./src/settings.ts");
22630
22667
  /* harmony import */ var _actions_container__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./actions/container */ "./src/actions/container.ts");
22631
22668
  /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts");
22632
- /* harmony import */ var _global_variables_utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./global_variables_utils */ "./src/global_variables_utils.ts");
22669
+ /* harmony import */ var _utils_animation__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./utils/animation */ "./src/utils/animation.ts");
22670
+ /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./utils/utils */ "./src/utils/utils.ts");
22671
+ /* harmony import */ var _global_variables_utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./global_variables_utils */ "./src/global_variables_utils.ts");
22633
22672
  var __extends = (undefined && undefined.__extends) || (function () {
22634
22673
  var extendStatics = function (d, b) {
22635
22674
  extendStatics = Object.setPrototypeOf ||
@@ -22659,6 +22698,8 @@ var __decorate = (undefined && undefined.__decorate) || function (decorators, ta
22659
22698
 
22660
22699
 
22661
22700
 
22701
+
22702
+
22662
22703
  /**
22663
22704
  * A base class for the [`SurveyElement`](https://surveyjs.io/form-library/documentation/surveyelement) and [`SurveyModel`](https://surveyjs.io/form-library/documentation/surveymodel) classes.
22664
22705
  */
@@ -22843,6 +22884,20 @@ var SurveyElement = /** @class */ (function (_super) {
22843
22884
  _this.isEditableTemplateElement = false;
22844
22885
  _this.isInteractiveDesignElement = true;
22845
22886
  _this.isSingleInRow = true;
22887
+ _this._renderedIsExpanded = true;
22888
+ _this._isAnimatingCollapseExpand = false;
22889
+ _this.animationCollapsed = new _utils_animation__WEBPACK_IMPORTED_MODULE_7__["AnimationBoolean"](_this.getExpandCollapseAnimationOptions(), function (val) {
22890
+ _this._renderedIsExpanded = val;
22891
+ if (_this.animationAllowed) {
22892
+ if (val) {
22893
+ _this.isAnimatingCollapseExpand = true;
22894
+ }
22895
+ else {
22896
+ _this.updateElementCss(false);
22897
+ }
22898
+ }
22899
+ }, function () { return _this.renderedIsExpanded; });
22900
+ _this.animationAllowedValue = true;
22846
22901
  _this.name = name;
22847
22902
  _this.createNewArray("errors");
22848
22903
  _this.createNewArray("titleActions");
@@ -22888,11 +22943,11 @@ var SurveyElement = /** @class */ (function (_super) {
22888
22943
  elLeft = el.getBoundingClientRect().left;
22889
22944
  needScroll = elLeft < 0;
22890
22945
  }
22891
- if (!needScroll && _global_variables_utils__WEBPACK_IMPORTED_MODULE_7__["DomWindowHelper"].isAvailable()) {
22892
- var height = _global_variables_utils__WEBPACK_IMPORTED_MODULE_7__["DomWindowHelper"].getInnerHeight();
22946
+ if (!needScroll && _global_variables_utils__WEBPACK_IMPORTED_MODULE_9__["DomWindowHelper"].isAvailable()) {
22947
+ var height = _global_variables_utils__WEBPACK_IMPORTED_MODULE_9__["DomWindowHelper"].getInnerHeight();
22893
22948
  needScroll = height > 0 && height < elTop;
22894
22949
  if (!needScroll && checkLeft) {
22895
- var width = _global_variables_utils__WEBPACK_IMPORTED_MODULE_7__["DomWindowHelper"].getInnerWidth();
22950
+ var width = _global_variables_utils__WEBPACK_IMPORTED_MODULE_9__["DomWindowHelper"].getInnerWidth();
22896
22951
  needScroll = width > 0 && width < elLeft;
22897
22952
  }
22898
22953
  }
@@ -22920,7 +22975,7 @@ var SurveyElement = /** @class */ (function (_super) {
22920
22975
  return null;
22921
22976
  };
22922
22977
  SurveyElement.FocusElement = function (elementId) {
22923
- if (!elementId || !_global_variables_utils__WEBPACK_IMPORTED_MODULE_7__["DomDocumentHelper"].isAvailable())
22978
+ if (!elementId || !_global_variables_utils__WEBPACK_IMPORTED_MODULE_9__["DomDocumentHelper"].isAvailable())
22924
22979
  return false;
22925
22980
  var res = SurveyElement.focusElementCore(elementId);
22926
22981
  if (!res) {
@@ -23003,6 +23058,7 @@ var SurveyElement = /** @class */ (function (_super) {
23003
23058
  },
23004
23059
  set: function (val) {
23005
23060
  this.setPropertyValue("state", val);
23061
+ this.renderedIsExpanded = !(this.state === "collapsed" && !this.isDesignMode);
23006
23062
  },
23007
23063
  enumerable: false,
23008
23064
  configurable: true
@@ -23657,7 +23713,7 @@ var SurveyElement = /** @class */ (function (_super) {
23657
23713
  });
23658
23714
  Object.defineProperty(SurveyElement.prototype, "hasParent", {
23659
23715
  get: function () {
23660
- return (this.parent && !this.parent.isPage && (!this.parent.originalPage || this.survey.isShowingPreview)) || (this.parent === undefined);
23716
+ return (this.parent && !this.parent.isPage && (!this.parent.originalPage)) || (this.parent === undefined);
23661
23717
  },
23662
23718
  enumerable: false,
23663
23719
  configurable: true
@@ -23679,11 +23735,14 @@ var SurveyElement = /** @class */ (function (_super) {
23679
23735
  return this.shouldAddRunnerStyles() && (this.hasParent);
23680
23736
  };
23681
23737
  SurveyElement.prototype.getCssRoot = function (cssClasses) {
23738
+ var isExpanadable = !!this.isCollapsed || !!this.isExpanded;
23682
23739
  return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_6__["CssClassBuilder"]()
23683
23740
  .append(cssClasses.withFrame, this.getHasFrameV2() && !this.isCompact)
23684
23741
  .append(cssClasses.compact, this.isCompact && this.getHasFrameV2())
23685
23742
  .append(cssClasses.collapsed, !!this.isCollapsed)
23686
- .append(cssClasses.expanded, !!this.isExpanded)
23743
+ .append(cssClasses.expandableAnimating, isExpanadable && this.isAnimatingCollapseExpand)
23744
+ .append(cssClasses.expanded, !!this.isExpanded && this.renderedIsExpanded)
23745
+ .append(cssClasses.expandable, isExpanadable)
23687
23746
  .append(cssClasses.nested, this.getIsNested())
23688
23747
  .toString();
23689
23748
  };
@@ -23835,12 +23894,12 @@ var SurveyElement = /** @class */ (function (_super) {
23835
23894
  });
23836
23895
  SurveyElement.prototype.isContainsSelection = function (el) {
23837
23896
  var elementWithSelection = undefined;
23838
- var _document = _global_variables_utils__WEBPACK_IMPORTED_MODULE_7__["DomDocumentHelper"].getDocument();
23839
- if (_global_variables_utils__WEBPACK_IMPORTED_MODULE_7__["DomDocumentHelper"].isAvailable() && !!_document && _document["selection"]) {
23897
+ var _document = _global_variables_utils__WEBPACK_IMPORTED_MODULE_9__["DomDocumentHelper"].getDocument();
23898
+ if (_global_variables_utils__WEBPACK_IMPORTED_MODULE_9__["DomDocumentHelper"].isAvailable() && !!_document && _document["selection"]) {
23840
23899
  elementWithSelection = _document["selection"].createRange().parentElement();
23841
23900
  }
23842
23901
  else {
23843
- var selection = _global_variables_utils__WEBPACK_IMPORTED_MODULE_7__["DomWindowHelper"].getSelection();
23902
+ var selection = _global_variables_utils__WEBPACK_IMPORTED_MODULE_9__["DomWindowHelper"].getSelection();
23844
23903
  if (!!selection && selection.rangeCount > 0) {
23845
23904
  var range = selection.getRangeAt(0);
23846
23905
  if (range.startOffset !== range.endOffset) {
@@ -23905,6 +23964,84 @@ var SurveyElement = /** @class */ (function (_super) {
23905
23964
  });
23906
23965
  }
23907
23966
  };
23967
+ SurveyElement.prototype.setWrapperElement = function (element) {
23968
+ this.wrapperElement = element;
23969
+ };
23970
+ SurveyElement.prototype.getWrapperElement = function () {
23971
+ return this.wrapperElement;
23972
+ };
23973
+ Object.defineProperty(SurveyElement.prototype, "isAnimatingCollapseExpand", {
23974
+ get: function () {
23975
+ return this._isAnimatingCollapseExpand || this._renderedIsExpanded != this.isExpanded;
23976
+ },
23977
+ set: function (val) {
23978
+ if (val !== this._isAnimatingCollapseExpand) {
23979
+ this._isAnimatingCollapseExpand = val;
23980
+ this.updateElementCss(false);
23981
+ }
23982
+ },
23983
+ enumerable: false,
23984
+ configurable: true
23985
+ });
23986
+ SurveyElement.prototype.getExpandCollapseAnimationOptions = function () {
23987
+ var _this = this;
23988
+ var beforeRunAnimation = function (el) {
23989
+ _this.isAnimatingCollapseExpand = true;
23990
+ el.style.setProperty("--animation-height", el.offsetHeight + "px");
23991
+ };
23992
+ var afterRunAnimation = function (el) {
23993
+ _this.isAnimatingCollapseExpand = false;
23994
+ };
23995
+ return {
23996
+ getEnterOptions: function () {
23997
+ var cssClasses = _this.isPanel ? _this.cssClasses.panel : _this.cssClasses;
23998
+ return {
23999
+ cssClass: cssClasses.contentFadeIn,
24000
+ onBeforeRunAnimation: beforeRunAnimation,
24001
+ onAfterRunAnimation: afterRunAnimation,
24002
+ };
24003
+ },
24004
+ getLeaveOptions: function () {
24005
+ var cssClasses = _this.isPanel ? _this.cssClasses.panel : _this.cssClasses;
24006
+ return { cssClass: cssClasses.contentFadeOut,
24007
+ onBeforeRunAnimation: beforeRunAnimation,
24008
+ onAfterRunAnimation: afterRunAnimation
24009
+ };
24010
+ },
24011
+ getAnimatedElement: function () {
24012
+ var _a;
24013
+ var cssClasses = _this.isPanel ? _this.cssClasses.panel : _this.cssClasses;
24014
+ if (cssClasses.content) {
24015
+ var selector = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_8__["classesToSelector"])(cssClasses.content);
24016
+ if (selector) {
24017
+ return (_a = _this.getWrapperElement()) === null || _a === void 0 ? void 0 : _a.querySelector(selector);
24018
+ }
24019
+ }
24020
+ return undefined;
24021
+ },
24022
+ isAnimationEnabled: function () { return _settings__WEBPACK_IMPORTED_MODULE_4__["settings"].animationEnabled && _this.animationAllowed && !_this.isDesignMode; }
24023
+ };
24024
+ };
24025
+ Object.defineProperty(SurveyElement.prototype, "renderedIsExpanded", {
24026
+ get: function () {
24027
+ return !!this._renderedIsExpanded;
24028
+ },
24029
+ set: function (val) {
24030
+ this.animationCollapsed.sync(val);
24031
+ },
24032
+ enumerable: false,
24033
+ configurable: true
24034
+ });
24035
+ Object.defineProperty(SurveyElement.prototype, "animationAllowed", {
24036
+ get: function () {
24037
+ return !this.isLoadingFromJson && !this.isDisposed && !!this.survey && this.animationAllowedValue;
24038
+ },
24039
+ set: function (val) {
24040
+ this.animationAllowedValue = val;
24041
+ },
24042
+ enumerable: false,
24043
+ configurable: true
24044
+ });
23908
24045
  SurveyElement.prototype.dispose = function () {
23909
24046
  _super.prototype.dispose.call(this);
23910
24047
  if (this.titleToolbarValue) {
@@ -23927,6 +24064,9 @@ var SurveyElement = /** @class */ (function (_super) {
23927
24064
  __decorate([
23928
24065
  Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: true })
23929
24066
  ], SurveyElement.prototype, "allowRootStyle", void 0);
24067
+ __decorate([
24068
+ Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])()
24069
+ ], SurveyElement.prototype, "_renderedIsExpanded", void 0);
23930
24070
  return SurveyElement;
23931
24071
  }(SurveyElementCore));
23932
24072
 
@@ -24044,6 +24184,287 @@ surveyLocalization.locales["en"] = _localization_english__WEBPACK_IMPORTED_MODUL
24044
24184
  surveyLocalization.localeNames["en"] = "english";
24045
24185
 
24046
24186
 
24187
+ /***/ }),
24188
+
24189
+ /***/ "./src/utils/animation.ts":
24190
+ /*!********************************!*\
24191
+ !*** ./src/utils/animation.ts ***!
24192
+ \********************************/
24193
+ /*! exports provided: AnimationUtils, AnimationPropertyUtils, AnimationGroupUtils, AnimationBoolean, AnimationGroup */
24194
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
24195
+
24196
+ "use strict";
24197
+ __webpack_require__.r(__webpack_exports__);
24198
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AnimationUtils", function() { return AnimationUtils; });
24199
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AnimationPropertyUtils", function() { return AnimationPropertyUtils; });
24200
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AnimationGroupUtils", function() { return AnimationGroupUtils; });
24201
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AnimationBoolean", function() { return AnimationBoolean; });
24202
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AnimationGroup", function() { return AnimationGroup; });
24203
+ /* harmony import */ var _taskmanager__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./taskmanager */ "./src/utils/taskmanager.ts");
24204
+ var __extends = (undefined && undefined.__extends) || (function () {
24205
+ var extendStatics = function (d, b) {
24206
+ extendStatics = Object.setPrototypeOf ||
24207
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
24208
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
24209
+ return extendStatics(d, b);
24210
+ };
24211
+ return function (d, b) {
24212
+ if (typeof b !== "function" && b !== null)
24213
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
24214
+ extendStatics(d, b);
24215
+ function __() { this.constructor = d; }
24216
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
24217
+ };
24218
+ })();
24219
+
24220
+ var AnimationUtils = /** @class */ (function () {
24221
+ function AnimationUtils() {
24222
+ this.cancelQueue = [];
24223
+ }
24224
+ AnimationUtils.prototype.getMsFromRule = function (value) {
24225
+ if (value === "auto")
24226
+ return 0;
24227
+ return Number(value.slice(0, -1).replace(",", ".")) * 1000;
24228
+ };
24229
+ AnimationUtils.prototype.getAnimationsCount = function (element) {
24230
+ var animationName = "";
24231
+ if (getComputedStyle) {
24232
+ animationName = getComputedStyle(element).animationName;
24233
+ }
24234
+ return (animationName && animationName != "none" ? animationName.split(", ").length : 0);
24235
+ };
24236
+ AnimationUtils.prototype.getAnimationDuration = function (element) {
24237
+ var style = getComputedStyle(element);
24238
+ var delays = style["animationDelay"].split(", ");
24239
+ var durations = style["animationDuration"].split(", ");
24240
+ var duration = 0;
24241
+ for (var i = 0; i < Math.max(durations.length, delays.length); i++) {
24242
+ duration = Math.max(duration, this.getMsFromRule(durations[i % durations.length]) + this.getMsFromRule(delays[i % delays.length]));
24243
+ }
24244
+ return duration;
24245
+ };
24246
+ AnimationUtils.prototype.onAnimationEnd = function (element, callback, options) {
24247
+ var _this = this;
24248
+ var cancelTimeout;
24249
+ var animationsCount = this.getAnimationsCount(element);
24250
+ var onEndCallback = function (isCancel) {
24251
+ if (isCancel === void 0) { isCancel = true; }
24252
+ options.onAfterRunAnimation && options.onAfterRunAnimation(element);
24253
+ callback(isCancel);
24254
+ clearTimeout(cancelTimeout);
24255
+ _this.cancelQueue.splice(_this.cancelQueue.indexOf(onEndCallback), 1);
24256
+ element.removeEventListener("animationend", onAnimationEndCallback);
24257
+ };
24258
+ var onAnimationEndCallback = function (event) {
24259
+ if (event.target == event.currentTarget && --animationsCount <= 0) {
24260
+ onEndCallback(false);
24261
+ }
24262
+ };
24263
+ if (animationsCount > 0) {
24264
+ element.addEventListener("animationend", onAnimationEndCallback);
24265
+ this.cancelQueue.push(onEndCallback);
24266
+ cancelTimeout = setTimeout(function () {
24267
+ onEndCallback(false);
24268
+ }, this.getAnimationDuration(element) + 10);
24269
+ }
24270
+ else {
24271
+ callback(true);
24272
+ }
24273
+ };
24274
+ AnimationUtils.prototype.beforeAnimationRun = function (element, options) {
24275
+ if (element) {
24276
+ options.onBeforeRunAnimation && options.onBeforeRunAnimation(element);
24277
+ }
24278
+ };
24279
+ AnimationUtils.prototype.runLeaveAnimation = function (element, options, callback) {
24280
+ if (element && options.cssClass) {
24281
+ element.classList.add(options.cssClass);
24282
+ var onAnimationEndCallback = function (isCancel) {
24283
+ callback();
24284
+ if (isCancel) {
24285
+ element.classList.remove(options.cssClass);
24286
+ }
24287
+ else {
24288
+ requestAnimationFrame(function () {
24289
+ requestAnimationFrame(function () {
24290
+ element.classList.remove(options.cssClass);
24291
+ });
24292
+ });
24293
+ }
24294
+ };
24295
+ this.onAnimationEnd(element, onAnimationEndCallback, options);
24296
+ }
24297
+ else {
24298
+ callback();
24299
+ }
24300
+ };
24301
+ AnimationUtils.prototype.runEnterAnimation = function (element, options) {
24302
+ if (element && options.cssClass) {
24303
+ element.classList.add(options.cssClass);
24304
+ this.onAnimationEnd(element, function () {
24305
+ element.classList.remove(options.cssClass);
24306
+ }, options);
24307
+ }
24308
+ };
24309
+ AnimationUtils.prototype.cancel = function () {
24310
+ this.cancelQueue.forEach(function (func) { return func(); });
24311
+ this.cancelQueue = [];
24312
+ };
24313
+ return AnimationUtils;
24314
+ }());
24315
+
24316
+ var AnimationPropertyUtils = /** @class */ (function (_super) {
24317
+ __extends(AnimationPropertyUtils, _super);
24318
+ function AnimationPropertyUtils() {
24319
+ return _super !== null && _super.apply(this, arguments) || this;
24320
+ }
24321
+ AnimationPropertyUtils.prototype.onEnter = function (getElement, options) {
24322
+ var _this = this;
24323
+ var callback = function () {
24324
+ var element = getElement();
24325
+ _this.beforeAnimationRun(element, options);
24326
+ _this.runEnterAnimation(element, options);
24327
+ };
24328
+ requestAnimationFrame(function () {
24329
+ if (getElement()) {
24330
+ callback();
24331
+ }
24332
+ else {
24333
+ requestAnimationFrame(callback);
24334
+ }
24335
+ });
24336
+ };
24337
+ AnimationPropertyUtils.prototype.onLeave = function (getElement, callback, options) {
24338
+ var element = getElement();
24339
+ this.beforeAnimationRun(element, options);
24340
+ this.runLeaveAnimation(element, options, callback);
24341
+ };
24342
+ return AnimationPropertyUtils;
24343
+ }(AnimationUtils));
24344
+
24345
+ var AnimationGroupUtils = /** @class */ (function (_super) {
24346
+ __extends(AnimationGroupUtils, _super);
24347
+ function AnimationGroupUtils() {
24348
+ return _super !== null && _super.apply(this, arguments) || this;
24349
+ }
24350
+ AnimationGroupUtils.prototype.onEnter = function (getElement, getOptions, elements) {
24351
+ var _this = this;
24352
+ if (elements.length == 0)
24353
+ return;
24354
+ requestAnimationFrame(function () {
24355
+ var callback = function () {
24356
+ elements.forEach(function (el) {
24357
+ _this.beforeAnimationRun(getElement(el), getOptions(el));
24358
+ });
24359
+ elements.forEach(function (el) {
24360
+ _this.runEnterAnimation(getElement(el), getOptions(el));
24361
+ });
24362
+ };
24363
+ if (!getElement(elements[0])) {
24364
+ requestAnimationFrame(callback);
24365
+ }
24366
+ else {
24367
+ callback();
24368
+ }
24369
+ });
24370
+ };
24371
+ AnimationGroupUtils.prototype.onLeave = function (getElement, callback, getOptions, elements) {
24372
+ var _this = this;
24373
+ elements.forEach(function (el) {
24374
+ _this.beforeAnimationRun(getElement(el), getOptions(el));
24375
+ });
24376
+ var counter = elements.length;
24377
+ var onEndCallback = function () {
24378
+ if (--counter <= 0) {
24379
+ callback();
24380
+ }
24381
+ };
24382
+ elements.forEach(function (el) {
24383
+ _this.runLeaveAnimation(getElement(el), getOptions(el), onEndCallback);
24384
+ });
24385
+ };
24386
+ return AnimationGroupUtils;
24387
+ }(AnimationUtils));
24388
+
24389
+ var AnimationProperty = /** @class */ (function () {
24390
+ function AnimationProperty(animationOptions, update, getCurrentValue) {
24391
+ var _this = this;
24392
+ this.animationOptions = animationOptions;
24393
+ this.update = update;
24394
+ this.getCurrentValue = getCurrentValue;
24395
+ this._debouncedSync = Object(_taskmanager__WEBPACK_IMPORTED_MODULE_0__["debounce"])(function (newValue) {
24396
+ _this.animation.cancel();
24397
+ _this._sync(newValue);
24398
+ });
24399
+ }
24400
+ AnimationProperty.prototype.sync = function (newValue) {
24401
+ if (this.animationOptions.isAnimationEnabled()) {
24402
+ this._debouncedSync.run(newValue);
24403
+ }
24404
+ else {
24405
+ this.update(newValue);
24406
+ }
24407
+ };
24408
+ AnimationProperty.prototype.cancel = function () {
24409
+ this.animation.cancel();
24410
+ this._debouncedSync.cancel();
24411
+ };
24412
+ return AnimationProperty;
24413
+ }());
24414
+ var AnimationBoolean = /** @class */ (function (_super) {
24415
+ __extends(AnimationBoolean, _super);
24416
+ function AnimationBoolean() {
24417
+ var _this = _super !== null && _super.apply(this, arguments) || this;
24418
+ _this.animation = new AnimationPropertyUtils();
24419
+ return _this;
24420
+ }
24421
+ AnimationBoolean.prototype._sync = function (newValue) {
24422
+ var _this = this;
24423
+ if (newValue !== this.getCurrentValue()) {
24424
+ if (newValue) {
24425
+ this.update(newValue);
24426
+ this.animation.onEnter(function () { return _this.animationOptions.getAnimatedElement(); }, this.animationOptions.getEnterOptions());
24427
+ }
24428
+ else {
24429
+ this.animation.onLeave(function () { return _this.animationOptions.getAnimatedElement(); }, function () {
24430
+ _this.update(newValue);
24431
+ }, this.animationOptions.getLeaveOptions());
24432
+ }
24433
+ }
24434
+ else {
24435
+ this.update(newValue);
24436
+ }
24437
+ };
24438
+ return AnimationBoolean;
24439
+ }(AnimationProperty));
24440
+
24441
+ var AnimationGroup = /** @class */ (function (_super) {
24442
+ __extends(AnimationGroup, _super);
24443
+ function AnimationGroup() {
24444
+ var _this = _super !== null && _super.apply(this, arguments) || this;
24445
+ _this.animation = new AnimationGroupUtils();
24446
+ return _this;
24447
+ }
24448
+ AnimationGroup.prototype._sync = function (newValue) {
24449
+ var _this = this;
24450
+ var oldValue = this.getCurrentValue();
24451
+ var itemsToAdd = newValue.filter(function (el) { return oldValue.indexOf(el) < 0; });
24452
+ var deletedItems = oldValue.filter(function (el) { return newValue.indexOf(el) < 0; });
24453
+ this.animation.onEnter(function (el) { return _this.animationOptions.getAnimatedElement(el); }, function (el) { return _this.animationOptions.getEnterOptions(el); }, itemsToAdd);
24454
+ if (itemsToAdd.length == 0 && (deletedItems === null || deletedItems === void 0 ? void 0 : deletedItems.length) > 0) {
24455
+ this.animation.onLeave(function (el) { return _this.animationOptions.getAnimatedElement(el); }, function () {
24456
+ _this.update(newValue);
24457
+ }, function (el) { return _this.animationOptions.getLeaveOptions(el); }, deletedItems);
24458
+ }
24459
+ else {
24460
+ this.update(newValue);
24461
+ }
24462
+ };
24463
+ return AnimationGroup;
24464
+ }(AnimationProperty));
24465
+
24466
+
24467
+
24047
24468
  /***/ }),
24048
24469
 
24049
24470
  /***/ "./src/utils/cssClassBuilder.ts":
@@ -24289,6 +24710,117 @@ var VerticalResponsivityManager = /** @class */ (function (_super) {
24289
24710
 
24290
24711
 
24291
24712
 
24713
+ /***/ }),
24714
+
24715
+ /***/ "./src/utils/taskmanager.ts":
24716
+ /*!**********************************!*\
24717
+ !*** ./src/utils/taskmanager.ts ***!
24718
+ \**********************************/
24719
+ /*! exports provided: Task, TaskManger, debounce */
24720
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
24721
+
24722
+ "use strict";
24723
+ __webpack_require__.r(__webpack_exports__);
24724
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Task", function() { return Task; });
24725
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TaskManger", function() { return TaskManger; });
24726
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "debounce", function() { return debounce; });
24727
+ var Task = /** @class */ (function () {
24728
+ function Task(func, isMultiple) {
24729
+ var _this = this;
24730
+ if (isMultiple === void 0) { isMultiple = false; }
24731
+ this.func = func;
24732
+ this.isMultiple = isMultiple;
24733
+ this._isCompleted = false;
24734
+ this.execute = function () {
24735
+ if (!_this._isCompleted) {
24736
+ _this.func();
24737
+ _this._isCompleted = !_this.isMultiple;
24738
+ }
24739
+ };
24740
+ }
24741
+ Task.prototype.discard = function () {
24742
+ this._isCompleted = true;
24743
+ };
24744
+ Object.defineProperty(Task.prototype, "isCompleted", {
24745
+ get: function () {
24746
+ return this._isCompleted;
24747
+ },
24748
+ enumerable: false,
24749
+ configurable: true
24750
+ });
24751
+ return Task;
24752
+ }());
24753
+
24754
+ var TaskManger = /** @class */ (function () {
24755
+ function TaskManger(interval) {
24756
+ if (interval === void 0) { interval = 100; }
24757
+ this.interval = interval;
24758
+ setTimeout(TaskManger.Instance().tick, interval);
24759
+ }
24760
+ // dispose
24761
+ TaskManger.Instance = function () {
24762
+ if (!TaskManger.instance) {
24763
+ TaskManger.instance = new TaskManger();
24764
+ }
24765
+ return TaskManger.instance;
24766
+ };
24767
+ TaskManger.prototype.tick = function () {
24768
+ try {
24769
+ var newTasks = [];
24770
+ for (var i = 0; i < TaskManger.tasks.length; i++) {
24771
+ var task = TaskManger.tasks[i];
24772
+ task.execute();
24773
+ if (!task.isCompleted) {
24774
+ newTasks.push(task);
24775
+ }
24776
+ else {
24777
+ if (typeof task.dispose === "function") {
24778
+ task.dispose();
24779
+ }
24780
+ }
24781
+ }
24782
+ TaskManger.tasks = newTasks;
24783
+ }
24784
+ finally {
24785
+ setTimeout(TaskManger.Instance().tick, this.interval);
24786
+ }
24787
+ };
24788
+ TaskManger.schedule = function (task) {
24789
+ TaskManger.tasks.push(task);
24790
+ };
24791
+ TaskManger.instance = undefined;
24792
+ TaskManger.tasks = [];
24793
+ return TaskManger;
24794
+ }());
24795
+
24796
+ function debounce(func) {
24797
+ var _this = this;
24798
+ var isSheduled = false;
24799
+ var isCanceled = false;
24800
+ var funcArgs;
24801
+ return { run: (function () {
24802
+ var args = [];
24803
+ for (var _i = 0; _i < arguments.length; _i++) {
24804
+ args[_i] = arguments[_i];
24805
+ }
24806
+ isCanceled = false;
24807
+ funcArgs = args;
24808
+ if (!isSheduled) {
24809
+ isSheduled = true;
24810
+ queueMicrotask(function () {
24811
+ if (!isCanceled) {
24812
+ func.apply(_this, funcArgs);
24813
+ }
24814
+ isCanceled = false;
24815
+ isSheduled = false;
24816
+ });
24817
+ }
24818
+ }), cancel: function () {
24819
+ isCanceled = true;
24820
+ } };
24821
+ }
24822
+
24823
+
24292
24824
  /***/ }),
24293
24825
 
24294
24826
  /***/ "./src/utils/utils.ts":