survey-react-ui 1.9.136 → 1.9.138

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.138
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.138", "survey-react-ui");
3591
3593
 
3592
3594
 
3593
3595
  /***/ }),
@@ -11923,9 +11925,14 @@ var SurveyQuestionBooleanRadio = /** @class */ (function (_super) {
11923
11925
  SurveyQuestionBooleanRadio.prototype.renderElement = function () {
11924
11926
  var cssClasses = this.question.cssClasses;
11925
11927
  return (react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: cssClasses.rootRadio },
11926
- react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("fieldset", { role: "presentation", className: cssClasses.radioFieldset },
11927
- this.renderRadioItem(false, this.question.locLabelFalse),
11928
- this.renderRadioItem(true, this.question.locLabelTrue))));
11928
+ react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("fieldset", { role: "presentation", className: cssClasses.radioFieldset }, !this.question.swapOrder ?
11929
+ (react__WEBPACK_IMPORTED_MODULE_0__["createElement"](react__WEBPACK_IMPORTED_MODULE_0__["Fragment"], null,
11930
+ this.renderRadioItem(false, this.question.locLabelFalse),
11931
+ this.renderRadioItem(true, this.question.locLabelTrue)))
11932
+ :
11933
+ (react__WEBPACK_IMPORTED_MODULE_0__["createElement"](react__WEBPACK_IMPORTED_MODULE_0__["Fragment"], null,
11934
+ this.renderRadioItem(true, this.question.locLabelTrue),
11935
+ this.renderRadioItem(false, this.question.locLabelFalse))))));
11929
11936
  };
11930
11937
  return SurveyQuestionBooleanRadio;
11931
11938
  }(_boolean__WEBPACK_IMPORTED_MODULE_3__["SurveyQuestionBoolean"]));
@@ -13961,18 +13968,18 @@ var PopupContainer = /** @class */ (function (_super) {
13961
13968
  }
13962
13969
  this.prevIsVisible = this.model.isVisible;
13963
13970
  };
13964
- PopupContainer.prototype.renderContainer = function (PopupBaseViewModel) {
13971
+ PopupContainer.prototype.renderContainer = function (popupBaseViewModel) {
13965
13972
  var _this = this;
13966
- var headerPopup = PopupBaseViewModel.showHeader ? this.renderHeaderPopup(PopupBaseViewModel) : null;
13967
- var headerContent = !!PopupBaseViewModel.title ? this.renderHeaderContent() : null;
13973
+ var headerPopup = popupBaseViewModel.showHeader ? this.renderHeaderPopup(popupBaseViewModel) : null;
13974
+ var headerContent = !!popupBaseViewModel.title ? this.renderHeaderContent() : null;
13968
13975
  var content = this.renderContent();
13969
- var footerContent = PopupBaseViewModel.showFooter ? this.renderFooter(this.model) : null;
13976
+ var footerContent = popupBaseViewModel.showFooter ? this.renderFooter(this.model) : null;
13970
13977
  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,
13978
+ left: popupBaseViewModel.left,
13979
+ top: popupBaseViewModel.top,
13980
+ height: popupBaseViewModel.height,
13981
+ width: popupBaseViewModel.width,
13982
+ minWidth: popupBaseViewModel.minWidth,
13976
13983
  }, onClick: function (ev) {
13977
13984
  _this.clickInside(ev);
13978
13985
  } },
@@ -14036,11 +14043,14 @@ function showModal(componentName, data, onApply, onCancel, cssClass, title, disp
14036
14043
  return showDialog(options);
14037
14044
  }
14038
14045
  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
14046
  var popupViewModel = Object(survey_core__WEBPACK_IMPORTED_MODULE_2__["createPopupModalViewModel"])(dialogOptions, rootElement);
14047
+ var onVisibilityChangedCallback = function (_, options) {
14048
+ if (!options.isVisible) {
14049
+ react_dom__WEBPACK_IMPORTED_MODULE_0___default.a.unmountComponentAtNode(popupViewModel.container);
14050
+ popupViewModel.dispose();
14051
+ }
14052
+ };
14053
+ popupViewModel.onVisibilityChanged.add(onVisibilityChangedCallback);
14044
14054
  react_dom__WEBPACK_IMPORTED_MODULE_0___default.a.render(react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(PopupContainer, { model: popupViewModel }), popupViewModel.container);
14045
14055
  popupViewModel.model.isVisible = true;
14046
14056
  return popupViewModel;
@@ -15472,6 +15482,7 @@ var SurveyRowElement = /** @class */ (function (_super) {
15472
15482
  function SurveyRowElement(props) {
15473
15483
  var _this = _super.call(this, props) || this;
15474
15484
  _this.element.cssClasses;
15485
+ _this.rootRef = react__WEBPACK_IMPORTED_MODULE_0__["createRef"]();
15475
15486
  return _this;
15476
15487
  }
15477
15488
  SurveyRowElement.prototype.getStateElement = function () {
@@ -15519,9 +15530,27 @@ var SurveyRowElement = /** @class */ (function (_super) {
15519
15530
  enumerable: false,
15520
15531
  configurable: true
15521
15532
  });
15533
+ SurveyRowElement.prototype.componentDidMount = function () {
15534
+ _super.prototype.componentDidMount.call(this);
15535
+ if (this.rootRef.current) {
15536
+ (this.element).setWrapperElement(this.rootRef.current);
15537
+ }
15538
+ };
15539
+ SurveyRowElement.prototype.componentWillUnmount = function () {
15540
+ _super.prototype.componentWillUnmount.call(this);
15541
+ this.element.setWrapperElement(undefined);
15542
+ };
15522
15543
  SurveyRowElement.prototype.shouldComponentUpdate = function (nextProps, nextState) {
15523
15544
  if (!_super.prototype.shouldComponentUpdate.call(this, nextProps, nextState))
15524
15545
  return false;
15546
+ if (nextProps.element !== this.element) {
15547
+ if (nextProps.element) {
15548
+ nextProps.element.setWrapperElement(this.rootRef.current);
15549
+ }
15550
+ if (this.element) {
15551
+ this.element.setWrapperElement(undefined);
15552
+ }
15553
+ }
15525
15554
  this.element.cssClasses;
15526
15555
  return true;
15527
15556
  };
@@ -15535,7 +15564,7 @@ var SurveyRowElement = /** @class */ (function (_super) {
15535
15564
  el.focusIn();
15536
15565
  }
15537
15566
  };
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, })));
15567
+ 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
15568
  };
15540
15569
  SurveyRowElement.prototype.createElement = function (element, elementIndex) {
15541
15570
  var index = elementIndex ? "-" + elementIndex : 0;
@@ -16078,6 +16107,10 @@ var SurveyPage = /** @class */ (function (_super) {
16078
16107
  enumerable: false,
16079
16108
  configurable: true
16080
16109
  });
16110
+ // shouldComponentUpdate(nextProps: any, nextState: any): boolean {
16111
+ // if(!super.shouldComponentUpdate(nextProps, nextState)) return false;
16112
+ // return true;
16113
+ // }
16081
16114
  SurveyPage.prototype.renderElement = function () {
16082
16115
  var title = this.renderTitle();
16083
16116
  var description = this.renderDescription();
@@ -16218,13 +16251,15 @@ var SurveyPanelBase = /** @class */ (function (_super) {
16218
16251
  }
16219
16252
  }
16220
16253
  };
16254
+ SurveyPanelBase.prototype.getIsVisible = function () {
16255
+ return this.panelBase.isVisible;
16256
+ };
16221
16257
  SurveyPanelBase.prototype.canRender = function () {
16222
- return (_super.prototype.canRender.call(this) && !!this.survey && !!this.panelBase
16223
- && this.panelBase.isVisible && !!this.panelBase.survey);
16258
+ return (_super.prototype.canRender.call(this) && !!this.survey && !!this.panelBase && !!this.panelBase.survey && this.getIsVisible());
16224
16259
  };
16225
16260
  SurveyPanelBase.prototype.renderRows = function (css) {
16226
16261
  var _this = this;
16227
- return this.panelBase.rows.map(function (row) { return _this.createRow(row, css); });
16262
+ return this.panelBase.visibleRows.map(function (row) { return _this.createRow(row, css); });
16228
16263
  };
16229
16264
  SurveyPanelBase.prototype.createRow = function (row, css) {
16230
16265
  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 +16335,11 @@ var SurveyPanel = /** @class */ (function (_super) {
16300
16335
  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
16336
  var style = {
16302
16337
  paddingLeft: this.panel.innerPaddingLeft,
16303
- display: !this.panel.isCollapsed ? undefined : "none",
16338
+ display: this.panel.renderedIsExpanded ? undefined : "none",
16304
16339
  };
16305
16340
  var content = null;
16306
- if (!this.panel.isCollapsed || this.hasBeenExpanded) {
16307
- this.hasBeenExpanded = true;
16341
+ if (this.panel.renderedIsExpanded) {
16342
+ // this.hasBeenExpanded = true;
16308
16343
  var rows = this.renderRows(this.panelBase.cssClasses);
16309
16344
  var className = this.panelBase.cssClasses.panel.content;
16310
16345
  content = this.renderContent(style, rows, className);
@@ -16356,6 +16391,9 @@ var SurveyPanel = /** @class */ (function (_super) {
16356
16391
  return null;
16357
16392
  return react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_components_action_bar_action_bar__WEBPACK_IMPORTED_MODULE_6__["SurveyActionBar"], { model: footerToolbar });
16358
16393
  };
16394
+ SurveyPanel.prototype.getIsVisible = function () {
16395
+ return this.panelBase.getIsContentVisible();
16396
+ };
16359
16397
  return SurveyPanel;
16360
16398
  }(_panel_base__WEBPACK_IMPORTED_MODULE_4__["SurveyPanelBase"]));
16361
16399
 
@@ -17343,8 +17381,7 @@ var SurveyQuestion = /** @class */ (function (_super) {
17343
17381
  return _this;
17344
17382
  }
17345
17383
  SurveyQuestion.renderQuestionBody = function (creator, question) {
17346
- if (!question.isVisible)
17347
- return null;
17384
+ // if (!question.isVisible) return null;
17348
17385
  var customWidget = question.customWidget;
17349
17386
  if (!customWidget) {
17350
17387
  return creator.createQuestionElement(question);
@@ -17410,13 +17447,12 @@ var SurveyQuestion = /** @class */ (function (_super) {
17410
17447
  SurveyQuestion.prototype.canRender = function () {
17411
17448
  return (_super.prototype.canRender.call(this) &&
17412
17449
  !!this.question &&
17413
- !!this.creator &&
17414
- this.question.isVisible);
17450
+ !!this.creator);
17415
17451
  };
17416
17452
  SurveyQuestion.prototype.renderQuestionContent = function () {
17417
17453
  var question = this.question;
17418
17454
  var contentStyle = {
17419
- display: !this.question.isCollapsed ? "" : "none",
17455
+ display: this.question.renderedIsExpanded ? "" : "none",
17420
17456
  };
17421
17457
  var cssClasses = question.cssClasses;
17422
17458
  var questionRender = this.renderQuestion();
@@ -21287,7 +21323,7 @@ var SurveyRow = /** @class */ (function (_super) {
21287
21323
  configurable: true
21288
21324
  });
21289
21325
  SurveyRow.prototype.canRender = function () {
21290
- return !!this.row && !!this.survey && !!this.creator && this.row.visible;
21326
+ return !!this.row && !!this.survey && !!this.creator;
21291
21327
  };
21292
21328
  SurveyRow.prototype.renderElementContent = function () {
21293
21329
  var _this = this;
@@ -21308,6 +21344,9 @@ var SurveyRow = /** @class */ (function (_super) {
21308
21344
  var _this = this;
21309
21345
  _super.prototype.componentDidMount.call(this);
21310
21346
  var el = this.rootRef.current;
21347
+ if (this.rootRef.current) {
21348
+ this.row.setRootElement(this.rootRef.current);
21349
+ }
21311
21350
  if (!!el && !this.row.isNeedRender) {
21312
21351
  var rowContainerDiv = el;
21313
21352
  setTimeout(function () {
@@ -21320,6 +21359,8 @@ var SurveyRow = /** @class */ (function (_super) {
21320
21359
  return false;
21321
21360
  if (nextProps.row !== this.row) {
21322
21361
  nextProps.row.isNeedRender = this.row.isNeedRender;
21362
+ nextProps.row.setRootElement(this.rootRef.current);
21363
+ this.row.setRootElement(undefined);
21323
21364
  this.stopLazyRendering();
21324
21365
  }
21325
21366
  this.recalculateCss();
@@ -21331,6 +21372,7 @@ var SurveyRow = /** @class */ (function (_super) {
21331
21372
  };
21332
21373
  SurveyRow.prototype.componentWillUnmount = function () {
21333
21374
  _super.prototype.componentWillUnmount.call(this);
21375
+ this.row.setRootElement(undefined);
21334
21376
  this.stopLazyRendering();
21335
21377
  };
21336
21378
  SurveyRow.prototype.createElement = function (element, elementIndex) {
@@ -22629,7 +22671,9 @@ __webpack_require__.r(__webpack_exports__);
22629
22671
  /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./settings */ "./src/settings.ts");
22630
22672
  /* harmony import */ var _actions_container__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./actions/container */ "./src/actions/container.ts");
22631
22673
  /* 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");
22674
+ /* harmony import */ var _utils_animation__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./utils/animation */ "./src/utils/animation.ts");
22675
+ /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./utils/utils */ "./src/utils/utils.ts");
22676
+ /* harmony import */ var _global_variables_utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./global_variables_utils */ "./src/global_variables_utils.ts");
22633
22677
  var __extends = (undefined && undefined.__extends) || (function () {
22634
22678
  var extendStatics = function (d, b) {
22635
22679
  extendStatics = Object.setPrototypeOf ||
@@ -22659,6 +22703,8 @@ var __decorate = (undefined && undefined.__decorate) || function (decorators, ta
22659
22703
 
22660
22704
 
22661
22705
 
22706
+
22707
+
22662
22708
  /**
22663
22709
  * A base class for the [`SurveyElement`](https://surveyjs.io/form-library/documentation/surveyelement) and [`SurveyModel`](https://surveyjs.io/form-library/documentation/surveymodel) classes.
22664
22710
  */
@@ -22843,6 +22889,20 @@ var SurveyElement = /** @class */ (function (_super) {
22843
22889
  _this.isEditableTemplateElement = false;
22844
22890
  _this.isInteractiveDesignElement = true;
22845
22891
  _this.isSingleInRow = true;
22892
+ _this._renderedIsExpanded = true;
22893
+ _this._isAnimatingCollapseExpand = false;
22894
+ _this.animationCollapsed = new _utils_animation__WEBPACK_IMPORTED_MODULE_7__["AnimationBoolean"](_this.getExpandCollapseAnimationOptions(), function (val) {
22895
+ _this._renderedIsExpanded = val;
22896
+ if (_this.animationAllowed) {
22897
+ if (val) {
22898
+ _this.isAnimatingCollapseExpand = true;
22899
+ }
22900
+ else {
22901
+ _this.updateElementCss(false);
22902
+ }
22903
+ }
22904
+ }, function () { return _this.renderedIsExpanded; });
22905
+ _this.animationAllowedValue = true;
22846
22906
  _this.name = name;
22847
22907
  _this.createNewArray("errors");
22848
22908
  _this.createNewArray("titleActions");
@@ -22888,11 +22948,11 @@ var SurveyElement = /** @class */ (function (_super) {
22888
22948
  elLeft = el.getBoundingClientRect().left;
22889
22949
  needScroll = elLeft < 0;
22890
22950
  }
22891
- if (!needScroll && _global_variables_utils__WEBPACK_IMPORTED_MODULE_7__["DomWindowHelper"].isAvailable()) {
22892
- var height = _global_variables_utils__WEBPACK_IMPORTED_MODULE_7__["DomWindowHelper"].getInnerHeight();
22951
+ if (!needScroll && _global_variables_utils__WEBPACK_IMPORTED_MODULE_9__["DomWindowHelper"].isAvailable()) {
22952
+ var height = _global_variables_utils__WEBPACK_IMPORTED_MODULE_9__["DomWindowHelper"].getInnerHeight();
22893
22953
  needScroll = height > 0 && height < elTop;
22894
22954
  if (!needScroll && checkLeft) {
22895
- var width = _global_variables_utils__WEBPACK_IMPORTED_MODULE_7__["DomWindowHelper"].getInnerWidth();
22955
+ var width = _global_variables_utils__WEBPACK_IMPORTED_MODULE_9__["DomWindowHelper"].getInnerWidth();
22896
22956
  needScroll = width > 0 && width < elLeft;
22897
22957
  }
22898
22958
  }
@@ -22920,7 +22980,7 @@ var SurveyElement = /** @class */ (function (_super) {
22920
22980
  return null;
22921
22981
  };
22922
22982
  SurveyElement.FocusElement = function (elementId) {
22923
- if (!elementId || !_global_variables_utils__WEBPACK_IMPORTED_MODULE_7__["DomDocumentHelper"].isAvailable())
22983
+ if (!elementId || !_global_variables_utils__WEBPACK_IMPORTED_MODULE_9__["DomDocumentHelper"].isAvailable())
22924
22984
  return false;
22925
22985
  var res = SurveyElement.focusElementCore(elementId);
22926
22986
  if (!res) {
@@ -23003,6 +23063,7 @@ var SurveyElement = /** @class */ (function (_super) {
23003
23063
  },
23004
23064
  set: function (val) {
23005
23065
  this.setPropertyValue("state", val);
23066
+ this.renderedIsExpanded = !(this.state === "collapsed" && !this.isDesignMode);
23006
23067
  },
23007
23068
  enumerable: false,
23008
23069
  configurable: true
@@ -23657,7 +23718,7 @@ var SurveyElement = /** @class */ (function (_super) {
23657
23718
  });
23658
23719
  Object.defineProperty(SurveyElement.prototype, "hasParent", {
23659
23720
  get: function () {
23660
- return (this.parent && !this.parent.isPage && (!this.parent.originalPage || this.survey.isShowingPreview)) || (this.parent === undefined);
23721
+ return (this.parent && !this.parent.isPage && (!this.parent.originalPage)) || (this.parent === undefined);
23661
23722
  },
23662
23723
  enumerable: false,
23663
23724
  configurable: true
@@ -23679,11 +23740,14 @@ var SurveyElement = /** @class */ (function (_super) {
23679
23740
  return this.shouldAddRunnerStyles() && (this.hasParent);
23680
23741
  };
23681
23742
  SurveyElement.prototype.getCssRoot = function (cssClasses) {
23743
+ var isExpanadable = !!this.isCollapsed || !!this.isExpanded;
23682
23744
  return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_6__["CssClassBuilder"]()
23683
23745
  .append(cssClasses.withFrame, this.getHasFrameV2() && !this.isCompact)
23684
23746
  .append(cssClasses.compact, this.isCompact && this.getHasFrameV2())
23685
23747
  .append(cssClasses.collapsed, !!this.isCollapsed)
23686
- .append(cssClasses.expanded, !!this.isExpanded)
23748
+ .append(cssClasses.expandableAnimating, isExpanadable && this.isAnimatingCollapseExpand)
23749
+ .append(cssClasses.expanded, !!this.isExpanded && this.renderedIsExpanded)
23750
+ .append(cssClasses.expandable, isExpanadable)
23687
23751
  .append(cssClasses.nested, this.getIsNested())
23688
23752
  .toString();
23689
23753
  };
@@ -23835,12 +23899,12 @@ var SurveyElement = /** @class */ (function (_super) {
23835
23899
  });
23836
23900
  SurveyElement.prototype.isContainsSelection = function (el) {
23837
23901
  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"]) {
23902
+ var _document = _global_variables_utils__WEBPACK_IMPORTED_MODULE_9__["DomDocumentHelper"].getDocument();
23903
+ if (_global_variables_utils__WEBPACK_IMPORTED_MODULE_9__["DomDocumentHelper"].isAvailable() && !!_document && _document["selection"]) {
23840
23904
  elementWithSelection = _document["selection"].createRange().parentElement();
23841
23905
  }
23842
23906
  else {
23843
- var selection = _global_variables_utils__WEBPACK_IMPORTED_MODULE_7__["DomWindowHelper"].getSelection();
23907
+ var selection = _global_variables_utils__WEBPACK_IMPORTED_MODULE_9__["DomWindowHelper"].getSelection();
23844
23908
  if (!!selection && selection.rangeCount > 0) {
23845
23909
  var range = selection.getRangeAt(0);
23846
23910
  if (range.startOffset !== range.endOffset) {
@@ -23905,6 +23969,84 @@ var SurveyElement = /** @class */ (function (_super) {
23905
23969
  });
23906
23970
  }
23907
23971
  };
23972
+ SurveyElement.prototype.setWrapperElement = function (element) {
23973
+ this.wrapperElement = element;
23974
+ };
23975
+ SurveyElement.prototype.getWrapperElement = function () {
23976
+ return this.wrapperElement;
23977
+ };
23978
+ Object.defineProperty(SurveyElement.prototype, "isAnimatingCollapseExpand", {
23979
+ get: function () {
23980
+ return this._isAnimatingCollapseExpand || this._renderedIsExpanded != this.isExpanded;
23981
+ },
23982
+ set: function (val) {
23983
+ if (val !== this._isAnimatingCollapseExpand) {
23984
+ this._isAnimatingCollapseExpand = val;
23985
+ this.updateElementCss(false);
23986
+ }
23987
+ },
23988
+ enumerable: false,
23989
+ configurable: true
23990
+ });
23991
+ SurveyElement.prototype.getExpandCollapseAnimationOptions = function () {
23992
+ var _this = this;
23993
+ var beforeRunAnimation = function (el) {
23994
+ _this.isAnimatingCollapseExpand = true;
23995
+ el.style.setProperty("--animation-height", el.offsetHeight + "px");
23996
+ };
23997
+ var afterRunAnimation = function (el) {
23998
+ _this.isAnimatingCollapseExpand = false;
23999
+ };
24000
+ return {
24001
+ getEnterOptions: function () {
24002
+ var cssClasses = _this.isPanel ? _this.cssClasses.panel : _this.cssClasses;
24003
+ return {
24004
+ cssClass: cssClasses.contentFadeIn,
24005
+ onBeforeRunAnimation: beforeRunAnimation,
24006
+ onAfterRunAnimation: afterRunAnimation,
24007
+ };
24008
+ },
24009
+ getLeaveOptions: function () {
24010
+ var cssClasses = _this.isPanel ? _this.cssClasses.panel : _this.cssClasses;
24011
+ return { cssClass: cssClasses.contentFadeOut,
24012
+ onBeforeRunAnimation: beforeRunAnimation,
24013
+ onAfterRunAnimation: afterRunAnimation
24014
+ };
24015
+ },
24016
+ getAnimatedElement: function () {
24017
+ var _a;
24018
+ var cssClasses = _this.isPanel ? _this.cssClasses.panel : _this.cssClasses;
24019
+ if (cssClasses.content) {
24020
+ var selector = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_8__["classesToSelector"])(cssClasses.content);
24021
+ if (selector) {
24022
+ return (_a = _this.getWrapperElement()) === null || _a === void 0 ? void 0 : _a.querySelector(selector);
24023
+ }
24024
+ }
24025
+ return undefined;
24026
+ },
24027
+ isAnimationEnabled: function () { return _settings__WEBPACK_IMPORTED_MODULE_4__["settings"].animationEnabled && _this.animationAllowed && !_this.isDesignMode; }
24028
+ };
24029
+ };
24030
+ Object.defineProperty(SurveyElement.prototype, "renderedIsExpanded", {
24031
+ get: function () {
24032
+ return !!this._renderedIsExpanded;
24033
+ },
24034
+ set: function (val) {
24035
+ this.animationCollapsed.sync(val);
24036
+ },
24037
+ enumerable: false,
24038
+ configurable: true
24039
+ });
24040
+ Object.defineProperty(SurveyElement.prototype, "animationAllowed", {
24041
+ get: function () {
24042
+ return !this.isLoadingFromJson && !this.isDisposed && !!this.survey && this.animationAllowedValue;
24043
+ },
24044
+ set: function (val) {
24045
+ this.animationAllowedValue = val;
24046
+ },
24047
+ enumerable: false,
24048
+ configurable: true
24049
+ });
23908
24050
  SurveyElement.prototype.dispose = function () {
23909
24051
  _super.prototype.dispose.call(this);
23910
24052
  if (this.titleToolbarValue) {
@@ -23927,6 +24069,9 @@ var SurveyElement = /** @class */ (function (_super) {
23927
24069
  __decorate([
23928
24070
  Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: true })
23929
24071
  ], SurveyElement.prototype, "allowRootStyle", void 0);
24072
+ __decorate([
24073
+ Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])()
24074
+ ], SurveyElement.prototype, "_renderedIsExpanded", void 0);
23930
24075
  return SurveyElement;
23931
24076
  }(SurveyElementCore));
23932
24077
 
@@ -24044,6 +24189,290 @@ surveyLocalization.locales["en"] = _localization_english__WEBPACK_IMPORTED_MODUL
24044
24189
  surveyLocalization.localeNames["en"] = "english";
24045
24190
 
24046
24191
 
24192
+ /***/ }),
24193
+
24194
+ /***/ "./src/utils/animation.ts":
24195
+ /*!********************************!*\
24196
+ !*** ./src/utils/animation.ts ***!
24197
+ \********************************/
24198
+ /*! exports provided: AnimationUtils, AnimationPropertyUtils, AnimationGroupUtils, AnimationBoolean, AnimationGroup */
24199
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
24200
+
24201
+ "use strict";
24202
+ __webpack_require__.r(__webpack_exports__);
24203
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AnimationUtils", function() { return AnimationUtils; });
24204
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AnimationPropertyUtils", function() { return AnimationPropertyUtils; });
24205
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AnimationGroupUtils", function() { return AnimationGroupUtils; });
24206
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AnimationBoolean", function() { return AnimationBoolean; });
24207
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AnimationGroup", function() { return AnimationGroup; });
24208
+ /* harmony import */ var _global_variables_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../global_variables_utils */ "./src/global_variables_utils.ts");
24209
+ /* harmony import */ var _taskmanager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./taskmanager */ "./src/utils/taskmanager.ts");
24210
+ var __extends = (undefined && undefined.__extends) || (function () {
24211
+ var extendStatics = function (d, b) {
24212
+ extendStatics = Object.setPrototypeOf ||
24213
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
24214
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
24215
+ return extendStatics(d, b);
24216
+ };
24217
+ return function (d, b) {
24218
+ if (typeof b !== "function" && b !== null)
24219
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
24220
+ extendStatics(d, b);
24221
+ function __() { this.constructor = d; }
24222
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
24223
+ };
24224
+ })();
24225
+
24226
+
24227
+ var AnimationUtils = /** @class */ (function () {
24228
+ function AnimationUtils() {
24229
+ this.cancelQueue = [];
24230
+ }
24231
+ AnimationUtils.prototype.getMsFromRule = function (value) {
24232
+ if (value === "auto")
24233
+ return 0;
24234
+ return Number(value.slice(0, -1).replace(",", ".")) * 1000;
24235
+ };
24236
+ AnimationUtils.prototype.getAnimationsCount = function (element) {
24237
+ var animationName = "";
24238
+ if (getComputedStyle) {
24239
+ animationName = getComputedStyle(element).animationName;
24240
+ }
24241
+ return (animationName && animationName != "none" ? animationName.split(", ").length : 0);
24242
+ };
24243
+ AnimationUtils.prototype.getAnimationDuration = function (element) {
24244
+ var style = getComputedStyle(element);
24245
+ var delays = style["animationDelay"].split(", ");
24246
+ var durations = style["animationDuration"].split(", ");
24247
+ var duration = 0;
24248
+ for (var i = 0; i < Math.max(durations.length, delays.length); i++) {
24249
+ duration = Math.max(duration, this.getMsFromRule(durations[i % durations.length]) + this.getMsFromRule(delays[i % delays.length]));
24250
+ }
24251
+ return duration;
24252
+ };
24253
+ AnimationUtils.prototype.onAnimationEnd = function (element, callback, options) {
24254
+ var _this = this;
24255
+ var cancelTimeout;
24256
+ var animationsCount = this.getAnimationsCount(element);
24257
+ var onEndCallback = function (isCancel) {
24258
+ if (isCancel === void 0) { isCancel = true; }
24259
+ options.onAfterRunAnimation && options.onAfterRunAnimation(element);
24260
+ callback(isCancel);
24261
+ clearTimeout(cancelTimeout);
24262
+ _this.cancelQueue.splice(_this.cancelQueue.indexOf(onEndCallback), 1);
24263
+ element.removeEventListener("animationend", onAnimationEndCallback);
24264
+ };
24265
+ var onAnimationEndCallback = function (event) {
24266
+ if (event.target == event.currentTarget && --animationsCount <= 0) {
24267
+ onEndCallback(false);
24268
+ }
24269
+ };
24270
+ if (animationsCount > 0) {
24271
+ element.addEventListener("animationend", onAnimationEndCallback);
24272
+ this.cancelQueue.push(onEndCallback);
24273
+ cancelTimeout = setTimeout(function () {
24274
+ onEndCallback(false);
24275
+ }, this.getAnimationDuration(element) + 10);
24276
+ }
24277
+ else {
24278
+ callback(true);
24279
+ }
24280
+ };
24281
+ AnimationUtils.prototype.beforeAnimationRun = function (element, options) {
24282
+ if (element) {
24283
+ options.onBeforeRunAnimation && options.onBeforeRunAnimation(element);
24284
+ }
24285
+ };
24286
+ AnimationUtils.prototype.runLeaveAnimation = function (element, options, callback) {
24287
+ if (element && options.cssClass) {
24288
+ element.classList.add(options.cssClass);
24289
+ var onAnimationEndCallback = function (isCancel) {
24290
+ callback();
24291
+ if (isCancel) {
24292
+ element.classList.remove(options.cssClass);
24293
+ }
24294
+ else {
24295
+ _global_variables_utils__WEBPACK_IMPORTED_MODULE_0__["DomWindowHelper"].requestAnimationFrame(function () {
24296
+ _global_variables_utils__WEBPACK_IMPORTED_MODULE_0__["DomWindowHelper"].requestAnimationFrame(function () {
24297
+ element.classList.remove(options.cssClass);
24298
+ });
24299
+ });
24300
+ }
24301
+ };
24302
+ this.onAnimationEnd(element, onAnimationEndCallback, options);
24303
+ }
24304
+ else {
24305
+ callback();
24306
+ }
24307
+ };
24308
+ AnimationUtils.prototype.runEnterAnimation = function (element, options) {
24309
+ if (element && options.cssClass) {
24310
+ element.classList.add(options.cssClass);
24311
+ this.onAnimationEnd(element, function () {
24312
+ element.classList.remove(options.cssClass);
24313
+ }, options);
24314
+ }
24315
+ };
24316
+ AnimationUtils.prototype.cancel = function () {
24317
+ var cancelQueue = [].concat(this.cancelQueue);
24318
+ cancelQueue.forEach(function (callback) { return callback(); });
24319
+ this.cancelQueue = [];
24320
+ };
24321
+ return AnimationUtils;
24322
+ }());
24323
+
24324
+ var AnimationPropertyUtils = /** @class */ (function (_super) {
24325
+ __extends(AnimationPropertyUtils, _super);
24326
+ function AnimationPropertyUtils() {
24327
+ return _super !== null && _super.apply(this, arguments) || this;
24328
+ }
24329
+ AnimationPropertyUtils.prototype.onEnter = function (getElement, options) {
24330
+ var _this = this;
24331
+ var callback = function () {
24332
+ var element = getElement();
24333
+ _this.beforeAnimationRun(element, options);
24334
+ _this.runEnterAnimation(element, options);
24335
+ };
24336
+ _global_variables_utils__WEBPACK_IMPORTED_MODULE_0__["DomWindowHelper"].requestAnimationFrame(function () {
24337
+ if (getElement()) {
24338
+ callback();
24339
+ }
24340
+ else {
24341
+ _global_variables_utils__WEBPACK_IMPORTED_MODULE_0__["DomWindowHelper"].requestAnimationFrame(callback);
24342
+ }
24343
+ });
24344
+ };
24345
+ AnimationPropertyUtils.prototype.onLeave = function (getElement, callback, options) {
24346
+ var element = getElement();
24347
+ this.beforeAnimationRun(element, options);
24348
+ this.runLeaveAnimation(element, options, callback);
24349
+ };
24350
+ return AnimationPropertyUtils;
24351
+ }(AnimationUtils));
24352
+
24353
+ var AnimationGroupUtils = /** @class */ (function (_super) {
24354
+ __extends(AnimationGroupUtils, _super);
24355
+ function AnimationGroupUtils() {
24356
+ return _super !== null && _super.apply(this, arguments) || this;
24357
+ }
24358
+ AnimationGroupUtils.prototype.onEnter = function (getElement, getOptions, elements) {
24359
+ var _this = this;
24360
+ if (elements.length == 0)
24361
+ return;
24362
+ _global_variables_utils__WEBPACK_IMPORTED_MODULE_0__["DomWindowHelper"].requestAnimationFrame(function () {
24363
+ var callback = function () {
24364
+ elements.forEach(function (el) {
24365
+ _this.beforeAnimationRun(getElement(el), getOptions(el));
24366
+ });
24367
+ elements.forEach(function (el) {
24368
+ _this.runEnterAnimation(getElement(el), getOptions(el));
24369
+ });
24370
+ };
24371
+ if (!getElement(elements[0])) {
24372
+ _global_variables_utils__WEBPACK_IMPORTED_MODULE_0__["DomWindowHelper"].requestAnimationFrame(callback);
24373
+ }
24374
+ else {
24375
+ callback();
24376
+ }
24377
+ });
24378
+ };
24379
+ AnimationGroupUtils.prototype.onLeave = function (getElement, callback, getOptions, elements) {
24380
+ var _this = this;
24381
+ elements.forEach(function (el) {
24382
+ _this.beforeAnimationRun(getElement(el), getOptions(el));
24383
+ });
24384
+ var counter = elements.length;
24385
+ var onEndCallback = function () {
24386
+ if (--counter <= 0) {
24387
+ callback();
24388
+ }
24389
+ };
24390
+ elements.forEach(function (el) {
24391
+ _this.runLeaveAnimation(getElement(el), getOptions(el), onEndCallback);
24392
+ });
24393
+ };
24394
+ return AnimationGroupUtils;
24395
+ }(AnimationUtils));
24396
+
24397
+ var AnimationProperty = /** @class */ (function () {
24398
+ function AnimationProperty(animationOptions, update, getCurrentValue) {
24399
+ var _this = this;
24400
+ this.animationOptions = animationOptions;
24401
+ this.update = update;
24402
+ this.getCurrentValue = getCurrentValue;
24403
+ this._debouncedSync = Object(_taskmanager__WEBPACK_IMPORTED_MODULE_1__["debounce"])(function (newValue) {
24404
+ _this.animation.cancel();
24405
+ _this._sync(newValue);
24406
+ });
24407
+ }
24408
+ AnimationProperty.prototype.sync = function (newValue) {
24409
+ if (this.animationOptions.isAnimationEnabled()) {
24410
+ this._debouncedSync.run(newValue);
24411
+ }
24412
+ else {
24413
+ this.update(newValue);
24414
+ }
24415
+ };
24416
+ AnimationProperty.prototype.cancel = function () {
24417
+ this.animation.cancel();
24418
+ this._debouncedSync.cancel();
24419
+ };
24420
+ return AnimationProperty;
24421
+ }());
24422
+ var AnimationBoolean = /** @class */ (function (_super) {
24423
+ __extends(AnimationBoolean, _super);
24424
+ function AnimationBoolean() {
24425
+ var _this = _super !== null && _super.apply(this, arguments) || this;
24426
+ _this.animation = new AnimationPropertyUtils();
24427
+ return _this;
24428
+ }
24429
+ AnimationBoolean.prototype._sync = function (newValue) {
24430
+ var _this = this;
24431
+ if (newValue !== this.getCurrentValue()) {
24432
+ if (newValue) {
24433
+ this.update(newValue);
24434
+ this.animation.onEnter(function () { return _this.animationOptions.getAnimatedElement(); }, this.animationOptions.getEnterOptions());
24435
+ }
24436
+ else {
24437
+ this.animation.onLeave(function () { return _this.animationOptions.getAnimatedElement(); }, function () {
24438
+ _this.update(newValue);
24439
+ }, this.animationOptions.getLeaveOptions());
24440
+ }
24441
+ }
24442
+ else {
24443
+ this.update(newValue);
24444
+ }
24445
+ };
24446
+ return AnimationBoolean;
24447
+ }(AnimationProperty));
24448
+
24449
+ var AnimationGroup = /** @class */ (function (_super) {
24450
+ __extends(AnimationGroup, _super);
24451
+ function AnimationGroup() {
24452
+ var _this = _super !== null && _super.apply(this, arguments) || this;
24453
+ _this.animation = new AnimationGroupUtils();
24454
+ return _this;
24455
+ }
24456
+ AnimationGroup.prototype._sync = function (newValue) {
24457
+ var _this = this;
24458
+ var oldValue = this.getCurrentValue();
24459
+ var itemsToAdd = newValue.filter(function (el) { return oldValue.indexOf(el) < 0; });
24460
+ var deletedItems = oldValue.filter(function (el) { return newValue.indexOf(el) < 0; });
24461
+ this.animation.onEnter(function (el) { return _this.animationOptions.getAnimatedElement(el); }, function (el) { return _this.animationOptions.getEnterOptions(el); }, itemsToAdd);
24462
+ if (itemsToAdd.length == 0 && (deletedItems === null || deletedItems === void 0 ? void 0 : deletedItems.length) > 0) {
24463
+ this.animation.onLeave(function (el) { return _this.animationOptions.getAnimatedElement(el); }, function () {
24464
+ _this.update(newValue);
24465
+ }, function (el) { return _this.animationOptions.getLeaveOptions(el); }, deletedItems);
24466
+ }
24467
+ else {
24468
+ this.update(newValue);
24469
+ }
24470
+ };
24471
+ return AnimationGroup;
24472
+ }(AnimationProperty));
24473
+
24474
+
24475
+
24047
24476
  /***/ }),
24048
24477
 
24049
24478
  /***/ "./src/utils/cssClassBuilder.ts":
@@ -24289,6 +24718,117 @@ var VerticalResponsivityManager = /** @class */ (function (_super) {
24289
24718
 
24290
24719
 
24291
24720
 
24721
+ /***/ }),
24722
+
24723
+ /***/ "./src/utils/taskmanager.ts":
24724
+ /*!**********************************!*\
24725
+ !*** ./src/utils/taskmanager.ts ***!
24726
+ \**********************************/
24727
+ /*! exports provided: Task, TaskManger, debounce */
24728
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
24729
+
24730
+ "use strict";
24731
+ __webpack_require__.r(__webpack_exports__);
24732
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Task", function() { return Task; });
24733
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TaskManger", function() { return TaskManger; });
24734
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "debounce", function() { return debounce; });
24735
+ var Task = /** @class */ (function () {
24736
+ function Task(func, isMultiple) {
24737
+ var _this = this;
24738
+ if (isMultiple === void 0) { isMultiple = false; }
24739
+ this.func = func;
24740
+ this.isMultiple = isMultiple;
24741
+ this._isCompleted = false;
24742
+ this.execute = function () {
24743
+ if (!_this._isCompleted) {
24744
+ _this.func();
24745
+ _this._isCompleted = !_this.isMultiple;
24746
+ }
24747
+ };
24748
+ }
24749
+ Task.prototype.discard = function () {
24750
+ this._isCompleted = true;
24751
+ };
24752
+ Object.defineProperty(Task.prototype, "isCompleted", {
24753
+ get: function () {
24754
+ return this._isCompleted;
24755
+ },
24756
+ enumerable: false,
24757
+ configurable: true
24758
+ });
24759
+ return Task;
24760
+ }());
24761
+
24762
+ var TaskManger = /** @class */ (function () {
24763
+ function TaskManger(interval) {
24764
+ if (interval === void 0) { interval = 100; }
24765
+ this.interval = interval;
24766
+ setTimeout(TaskManger.Instance().tick, interval);
24767
+ }
24768
+ // dispose
24769
+ TaskManger.Instance = function () {
24770
+ if (!TaskManger.instance) {
24771
+ TaskManger.instance = new TaskManger();
24772
+ }
24773
+ return TaskManger.instance;
24774
+ };
24775
+ TaskManger.prototype.tick = function () {
24776
+ try {
24777
+ var newTasks = [];
24778
+ for (var i = 0; i < TaskManger.tasks.length; i++) {
24779
+ var task = TaskManger.tasks[i];
24780
+ task.execute();
24781
+ if (!task.isCompleted) {
24782
+ newTasks.push(task);
24783
+ }
24784
+ else {
24785
+ if (typeof task.dispose === "function") {
24786
+ task.dispose();
24787
+ }
24788
+ }
24789
+ }
24790
+ TaskManger.tasks = newTasks;
24791
+ }
24792
+ finally {
24793
+ setTimeout(TaskManger.Instance().tick, this.interval);
24794
+ }
24795
+ };
24796
+ TaskManger.schedule = function (task) {
24797
+ TaskManger.tasks.push(task);
24798
+ };
24799
+ TaskManger.instance = undefined;
24800
+ TaskManger.tasks = [];
24801
+ return TaskManger;
24802
+ }());
24803
+
24804
+ function debounce(func) {
24805
+ var _this = this;
24806
+ var isSheduled = false;
24807
+ var isCanceled = false;
24808
+ var funcArgs;
24809
+ return { run: (function () {
24810
+ var args = [];
24811
+ for (var _i = 0; _i < arguments.length; _i++) {
24812
+ args[_i] = arguments[_i];
24813
+ }
24814
+ isCanceled = false;
24815
+ funcArgs = args;
24816
+ if (!isSheduled) {
24817
+ isSheduled = true;
24818
+ queueMicrotask(function () {
24819
+ if (!isCanceled) {
24820
+ func.apply(_this, funcArgs);
24821
+ }
24822
+ isCanceled = false;
24823
+ isSheduled = false;
24824
+ });
24825
+ }
24826
+ }), cancel: function () {
24827
+ isCanceled = true;
24828
+ } };
24829
+ }
24830
+
24831
+
24292
24832
  /***/ }),
24293
24833
 
24294
24834
  /***/ "./src/utils/utils.ts":