survey-react-ui 1.9.135 → 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.135
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.135", "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
 
@@ -16555,7 +16588,11 @@ var SurveyProgressButtons = /** @class */ (function (_super) {
16555
16588
  react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: this.css.progressButtonsConnector }),
16556
16589
  this.state.canShowItemTitles ? react__WEBPACK_IMPORTED_MODULE_0__["createElement"](react__WEBPACK_IMPORTED_MODULE_0__["Fragment"], null,
16557
16590
  react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: this.css.progressButtonsPageTitle, title: page.renderedNavigationTitle }, page.renderedNavigationTitle),
16558
- react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: this.css.progressButtonsPageDescription, title: page.navigationDescription }, page.navigationDescription)) : null));
16591
+ react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: this.css.progressButtonsPageDescription, title: page.navigationDescription }, page.navigationDescription)) : null,
16592
+ react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: this.css.progressButtonsButton },
16593
+ react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: this.css.progressButtonsButtonBackground }),
16594
+ react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: this.css.progressButtonsButtonContent }),
16595
+ react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("span", null, this.model.getItemNumber(page)))));
16559
16596
  };
16560
16597
  SurveyProgressButtons.prototype.clickScrollButton = function (listContainerElement, isLeftScroll) {
16561
16598
  if (!!listContainerElement) {
@@ -17339,8 +17376,7 @@ var SurveyQuestion = /** @class */ (function (_super) {
17339
17376
  return _this;
17340
17377
  }
17341
17378
  SurveyQuestion.renderQuestionBody = function (creator, question) {
17342
- if (!question.isVisible)
17343
- return null;
17379
+ // if (!question.isVisible) return null;
17344
17380
  var customWidget = question.customWidget;
17345
17381
  if (!customWidget) {
17346
17382
  return creator.createQuestionElement(question);
@@ -17406,13 +17442,12 @@ var SurveyQuestion = /** @class */ (function (_super) {
17406
17442
  SurveyQuestion.prototype.canRender = function () {
17407
17443
  return (_super.prototype.canRender.call(this) &&
17408
17444
  !!this.question &&
17409
- !!this.creator &&
17410
- this.question.isVisible);
17445
+ !!this.creator);
17411
17446
  };
17412
17447
  SurveyQuestion.prototype.renderQuestionContent = function () {
17413
17448
  var question = this.question;
17414
17449
  var contentStyle = {
17415
- display: !this.question.isCollapsed ? "" : "none",
17450
+ display: this.question.renderedIsExpanded ? "" : "none",
17416
17451
  };
17417
17452
  var cssClasses = question.cssClasses;
17418
17453
  var questionRender = this.renderQuestion();
@@ -20300,7 +20335,7 @@ var SurveyQuestionPanelDynamicItem = /** @class */ (function (_super) {
20300
20335
  var separator = this.question.showSeparator(this.index) ?
20301
20336
  (react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("hr", { className: this.question.cssClasses.separator })) : null;
20302
20337
  return (react__WEBPACK_IMPORTED_MODULE_0__["createElement"](react__WEBPACK_IMPORTED_MODULE_0__["Fragment"], null,
20303
- react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: this.question.getPanelWrapperCss() },
20338
+ react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: this.question.getPanelWrapperCss(this.panel) },
20304
20339
  panel,
20305
20340
  removeButton),
20306
20341
  separator));
@@ -21283,7 +21318,7 @@ var SurveyRow = /** @class */ (function (_super) {
21283
21318
  configurable: true
21284
21319
  });
21285
21320
  SurveyRow.prototype.canRender = function () {
21286
- return !!this.row && !!this.survey && !!this.creator && this.row.visible;
21321
+ return !!this.row && !!this.survey && !!this.creator;
21287
21322
  };
21288
21323
  SurveyRow.prototype.renderElementContent = function () {
21289
21324
  var _this = this;
@@ -21304,6 +21339,9 @@ var SurveyRow = /** @class */ (function (_super) {
21304
21339
  var _this = this;
21305
21340
  _super.prototype.componentDidMount.call(this);
21306
21341
  var el = this.rootRef.current;
21342
+ if (this.rootRef.current) {
21343
+ this.row.setRootElement(this.rootRef.current);
21344
+ }
21307
21345
  if (!!el && !this.row.isNeedRender) {
21308
21346
  var rowContainerDiv = el;
21309
21347
  setTimeout(function () {
@@ -21316,6 +21354,8 @@ var SurveyRow = /** @class */ (function (_super) {
21316
21354
  return false;
21317
21355
  if (nextProps.row !== this.row) {
21318
21356
  nextProps.row.isNeedRender = this.row.isNeedRender;
21357
+ nextProps.row.setRootElement(this.rootRef.current);
21358
+ this.row.setRootElement(undefined);
21319
21359
  this.stopLazyRendering();
21320
21360
  }
21321
21361
  this.recalculateCss();
@@ -21327,6 +21367,7 @@ var SurveyRow = /** @class */ (function (_super) {
21327
21367
  };
21328
21368
  SurveyRow.prototype.componentWillUnmount = function () {
21329
21369
  _super.prototype.componentWillUnmount.call(this);
21370
+ this.row.setRootElement(undefined);
21330
21371
  this.stopLazyRendering();
21331
21372
  };
21332
21373
  SurveyRow.prototype.createElement = function (element, elementIndex) {
@@ -22625,7 +22666,9 @@ __webpack_require__.r(__webpack_exports__);
22625
22666
  /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./settings */ "./src/settings.ts");
22626
22667
  /* harmony import */ var _actions_container__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./actions/container */ "./src/actions/container.ts");
22627
22668
  /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts");
22628
- /* 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");
22629
22672
  var __extends = (undefined && undefined.__extends) || (function () {
22630
22673
  var extendStatics = function (d, b) {
22631
22674
  extendStatics = Object.setPrototypeOf ||
@@ -22655,6 +22698,8 @@ var __decorate = (undefined && undefined.__decorate) || function (decorators, ta
22655
22698
 
22656
22699
 
22657
22700
 
22701
+
22702
+
22658
22703
  /**
22659
22704
  * A base class for the [`SurveyElement`](https://surveyjs.io/form-library/documentation/surveyelement) and [`SurveyModel`](https://surveyjs.io/form-library/documentation/surveymodel) classes.
22660
22705
  */
@@ -22839,6 +22884,20 @@ var SurveyElement = /** @class */ (function (_super) {
22839
22884
  _this.isEditableTemplateElement = false;
22840
22885
  _this.isInteractiveDesignElement = true;
22841
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;
22842
22901
  _this.name = name;
22843
22902
  _this.createNewArray("errors");
22844
22903
  _this.createNewArray("titleActions");
@@ -22884,11 +22943,11 @@ var SurveyElement = /** @class */ (function (_super) {
22884
22943
  elLeft = el.getBoundingClientRect().left;
22885
22944
  needScroll = elLeft < 0;
22886
22945
  }
22887
- if (!needScroll && _global_variables_utils__WEBPACK_IMPORTED_MODULE_7__["DomWindowHelper"].isAvailable()) {
22888
- 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();
22889
22948
  needScroll = height > 0 && height < elTop;
22890
22949
  if (!needScroll && checkLeft) {
22891
- var width = _global_variables_utils__WEBPACK_IMPORTED_MODULE_7__["DomWindowHelper"].getInnerWidth();
22950
+ var width = _global_variables_utils__WEBPACK_IMPORTED_MODULE_9__["DomWindowHelper"].getInnerWidth();
22892
22951
  needScroll = width > 0 && width < elLeft;
22893
22952
  }
22894
22953
  }
@@ -22916,7 +22975,7 @@ var SurveyElement = /** @class */ (function (_super) {
22916
22975
  return null;
22917
22976
  };
22918
22977
  SurveyElement.FocusElement = function (elementId) {
22919
- if (!elementId || !_global_variables_utils__WEBPACK_IMPORTED_MODULE_7__["DomDocumentHelper"].isAvailable())
22978
+ if (!elementId || !_global_variables_utils__WEBPACK_IMPORTED_MODULE_9__["DomDocumentHelper"].isAvailable())
22920
22979
  return false;
22921
22980
  var res = SurveyElement.focusElementCore(elementId);
22922
22981
  if (!res) {
@@ -22999,6 +23058,7 @@ var SurveyElement = /** @class */ (function (_super) {
22999
23058
  },
23000
23059
  set: function (val) {
23001
23060
  this.setPropertyValue("state", val);
23061
+ this.renderedIsExpanded = !(this.state === "collapsed" && !this.isDesignMode);
23002
23062
  },
23003
23063
  enumerable: false,
23004
23064
  configurable: true
@@ -23653,7 +23713,7 @@ var SurveyElement = /** @class */ (function (_super) {
23653
23713
  });
23654
23714
  Object.defineProperty(SurveyElement.prototype, "hasParent", {
23655
23715
  get: function () {
23656
- 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);
23657
23717
  },
23658
23718
  enumerable: false,
23659
23719
  configurable: true
@@ -23675,11 +23735,14 @@ var SurveyElement = /** @class */ (function (_super) {
23675
23735
  return this.shouldAddRunnerStyles() && (this.hasParent);
23676
23736
  };
23677
23737
  SurveyElement.prototype.getCssRoot = function (cssClasses) {
23738
+ var isExpanadable = !!this.isCollapsed || !!this.isExpanded;
23678
23739
  return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_6__["CssClassBuilder"]()
23679
23740
  .append(cssClasses.withFrame, this.getHasFrameV2() && !this.isCompact)
23680
23741
  .append(cssClasses.compact, this.isCompact && this.getHasFrameV2())
23681
23742
  .append(cssClasses.collapsed, !!this.isCollapsed)
23682
- .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)
23683
23746
  .append(cssClasses.nested, this.getIsNested())
23684
23747
  .toString();
23685
23748
  };
@@ -23831,12 +23894,12 @@ var SurveyElement = /** @class */ (function (_super) {
23831
23894
  });
23832
23895
  SurveyElement.prototype.isContainsSelection = function (el) {
23833
23896
  var elementWithSelection = undefined;
23834
- var _document = _global_variables_utils__WEBPACK_IMPORTED_MODULE_7__["DomDocumentHelper"].getDocument();
23835
- 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"]) {
23836
23899
  elementWithSelection = _document["selection"].createRange().parentElement();
23837
23900
  }
23838
23901
  else {
23839
- var selection = _global_variables_utils__WEBPACK_IMPORTED_MODULE_7__["DomWindowHelper"].getSelection();
23902
+ var selection = _global_variables_utils__WEBPACK_IMPORTED_MODULE_9__["DomWindowHelper"].getSelection();
23840
23903
  if (!!selection && selection.rangeCount > 0) {
23841
23904
  var range = selection.getRangeAt(0);
23842
23905
  if (range.startOffset !== range.endOffset) {
@@ -23901,6 +23964,84 @@ var SurveyElement = /** @class */ (function (_super) {
23901
23964
  });
23902
23965
  }
23903
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
+ });
23904
24045
  SurveyElement.prototype.dispose = function () {
23905
24046
  _super.prototype.dispose.call(this);
23906
24047
  if (this.titleToolbarValue) {
@@ -23923,6 +24064,9 @@ var SurveyElement = /** @class */ (function (_super) {
23923
24064
  __decorate([
23924
24065
  Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: true })
23925
24066
  ], SurveyElement.prototype, "allowRootStyle", void 0);
24067
+ __decorate([
24068
+ Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])()
24069
+ ], SurveyElement.prototype, "_renderedIsExpanded", void 0);
23926
24070
  return SurveyElement;
23927
24071
  }(SurveyElementCore));
23928
24072
 
@@ -24040,6 +24184,287 @@ surveyLocalization.locales["en"] = _localization_english__WEBPACK_IMPORTED_MODUL
24040
24184
  surveyLocalization.localeNames["en"] = "english";
24041
24185
 
24042
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
+
24043
24468
  /***/ }),
24044
24469
 
24045
24470
  /***/ "./src/utils/cssClassBuilder.ts":
@@ -24285,6 +24710,117 @@ var VerticalResponsivityManager = /** @class */ (function (_super) {
24285
24710
 
24286
24711
 
24287
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
+
24288
24824
  /***/ }),
24289
24825
 
24290
24826
  /***/ "./src/utils/utils.ts":