survey-react-ui 2.4.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,9 +6,7 @@
6
6
 
7
7
  [![Build Status](https://dev.azure.com/SurveyJS/SurveyJS%20Integration%20Tests/_apis/build/status/SurveyJS%20Library?branchName=master)](https://dev.azure.com/SurveyJS/SurveyJS%20Integration%20Tests/_build/latest?definitionId=7&branchName=master)
8
8
  [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](LICENSE)
9
- <a href="https://github.com/DevExpress/testcafe">
10
- <img alt="Tested with TestCafe" src="https://img.shields.io/badge/tested%20with-TestCafe-2fa4cf.svg">
11
- </a>
9
+ [![Tested with Playwright](https://img.shields.io/badge/tested%20with-Playwright-2fa4cf.svg)](https://playwright.dev)
12
10
  <a href="https://github.com/surveyjs/survey-library/issues">
13
11
  <img alt="Issues" title="Open Issues" src="https://img.shields.io/github/issues/surveyjs/survey-library.svg">
14
12
  </a>
@@ -1,10 +1,10 @@
1
1
  /*!
2
- * surveyjs - Survey JavaScript library v2.4.0
2
+ * surveyjs - Survey JavaScript library v2.5.0
3
3
  * Copyright (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
5
5
  */
6
6
 
7
- import { SurveyModel, Helpers, createSvg, createPopupViewModel, CssClassBuilder, ActionDropdownViewModel, RendererFactory, doKey2ClickUp, SvgRegistry, settings, createPopupModalViewModel, ScrollViewModel, doKey2ClickBlur, doKey2ClickDown, addIconsToThemeSet, Question, SurveyProgressModel, ProgressButtonsResponsivityManager, PopupSurveyModel, ButtonGroupItemModel, LocalizableString, checkLibraryVersion } from 'survey-core';
7
+ import { SurveyModel, Helpers, createSvg, LocalizableString, createPopupViewModel, CssClassBuilder, ActionDropdownViewModel, RendererFactory, doKey2ClickUp, SvgRegistry, settings, createPopupModalViewModel, ScrollViewModel, doKey2ClickBlur, doKey2ClickDown, addIconsToThemeSet, Question, SurveyProgressModel, ProgressButtonsResponsivityManager, PopupSurveyModel, ButtonGroupItemModel, checkLibraryVersion } from 'survey-core';
8
8
  export { SurveyModel as Model, SurveyModel, SurveyWindowModel, settings, surveyLocalization, surveyStrings } from 'survey-core';
9
9
  import * as React from 'react';
10
10
  import * as ReactDOM from 'react-dom';
@@ -92,7 +92,7 @@ class SurveyElementBase extends React.Component {
92
92
  return ReactElementFactory.Instance.createElement(locStr.renderAs, {
93
93
  locStr: locStr.renderAsData,
94
94
  style: style,
95
- key: key,
95
+ key: key
96
96
  });
97
97
  }
98
98
  static renderQuestionDescription(question) {
@@ -420,6 +420,65 @@ ReactElementFactory.Instance.registerElement("sv-action-bar-separator", (props)
420
420
  return React.createElement(SurveyActionBarSeparator, props);
421
421
  });
422
422
 
423
+ class SurveyLocStringViewer extends React.Component {
424
+ constructor(props) {
425
+ super(props);
426
+ this.onChangedHandler = (sender, options) => {
427
+ if (this.isRendering)
428
+ return;
429
+ this.setState({ changed: !!this.state && this.state.changed ? this.state.changed + 1 : 1 });
430
+ };
431
+ this.rootRef = React.createRef();
432
+ }
433
+ get locStr() {
434
+ return this.props.locStr;
435
+ }
436
+ get style() {
437
+ return this.props.style;
438
+ }
439
+ get textClass() {
440
+ return this.props.textClass;
441
+ }
442
+ componentDidMount() {
443
+ this.reactOnStrChanged();
444
+ }
445
+ componentWillUnmount() {
446
+ if (!this.locStr)
447
+ return;
448
+ this.locStr.onStringChanged.remove(this.onChangedHandler);
449
+ }
450
+ componentDidUpdate(prevProps, prevState) {
451
+ if (!!prevProps.locStr) {
452
+ prevProps.locStr.onStringChanged.remove(this.onChangedHandler);
453
+ }
454
+ this.reactOnStrChanged();
455
+ }
456
+ reactOnStrChanged() {
457
+ if (!this.locStr)
458
+ return;
459
+ this.locStr.onStringChanged.add(this.onChangedHandler);
460
+ }
461
+ render() {
462
+ if (!this.locStr)
463
+ return null;
464
+ this.isRendering = true;
465
+ const strEl = this.renderString();
466
+ this.isRendering = false;
467
+ return strEl;
468
+ }
469
+ renderString() {
470
+ const className = this.locStr.getStringViewerClassName(this.textClass);
471
+ if (this.locStr.hasHtml) {
472
+ let htmlValue = { __html: this.locStr.renderedHtml };
473
+ return React.createElement("span", { ref: this.rootRef, className: className, style: this.style, dangerouslySetInnerHTML: htmlValue });
474
+ }
475
+ return React.createElement("span", { ref: this.rootRef, className: className, style: this.style }, this.locStr.renderedHtml);
476
+ }
477
+ }
478
+ ReactElementFactory.Instance.registerElement(LocalizableString.defaultRenderer, (props) => {
479
+ return React.createElement(SurveyLocStringViewer, props);
480
+ });
481
+
423
482
  class SurveyAction extends SurveyElementBase {
424
483
  constructor(props) {
425
484
  super(props);
@@ -480,8 +539,7 @@ class SurveyActionBarItem extends SurveyElementBase {
480
539
  renderText() {
481
540
  if (!this.item.hasTitle)
482
541
  return null;
483
- const titleClass = this.item.getActionBarItemTitleCss();
484
- return React.createElement("span", { className: titleClass }, this.item.title);
542
+ return React.createElement(SurveyLocStringViewer, { locStr: this.item.locTitle, textClass: this.item.getActionBarItemTitleCss() });
485
543
  }
486
544
  renderButtonContent() {
487
545
  const text = this.renderText();
@@ -1056,7 +1114,7 @@ class PopupModal extends SurveyElementBase {
1056
1114
  PopupModal.modalDescriptors = [];
1057
1115
 
1058
1116
  /*!
1059
- * surveyjs - Survey JavaScript library v2.4.0
1117
+ * surveyjs - Survey JavaScript library v2.5.0
1060
1118
  * Copyright (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
1061
1119
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
1062
1120
  */
@@ -1126,7 +1184,7 @@ var iconsV1 = {
1126
1184
  };
1127
1185
 
1128
1186
  /*!
1129
- * surveyjs - Survey JavaScript library v2.4.0
1187
+ * surveyjs - Survey JavaScript library v2.5.0
1130
1188
  * Copyright (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
1131
1189
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
1132
1190
  */
@@ -1719,8 +1777,10 @@ class SurveyRow extends SurveyElementBase {
1719
1777
  componentWillUnmount() {
1720
1778
  super.componentWillUnmount();
1721
1779
  if (!!this.row) {
1722
- this.row.setRootElement(undefined);
1723
- this.stopLazyRendering();
1780
+ if (!this.row.hasActiveUISubscribers) {
1781
+ this.row.setRootElement(undefined);
1782
+ this.stopLazyRendering();
1783
+ }
1724
1784
  }
1725
1785
  }
1726
1786
  createElement(element, elementIndex) {
@@ -4201,7 +4261,7 @@ class MatrixRow extends SurveyElementBase {
4201
4261
  const model = this.model;
4202
4262
  if (!model.visible)
4203
4263
  return null;
4204
- return (React.createElement("tr", { ref: this.root, className: model.className, "data-sv-drop-target-matrix-row": model.dropTargetId, onPointerDown: (event) => this.onPointerDownHandler(event) }, this.props.children));
4264
+ return (React.createElement("tr", { ref: this.root, className: model.className, "data-sv-drop-target-matrix-row": model.dropTargetId }, this.props.children));
4205
4265
  }
4206
4266
  }
4207
4267
  ReactElementFactory.Instance.registerElement("sv-matrix-row", (props) => {
@@ -4212,8 +4272,11 @@ class SurveyQuestionMatrixDynamicDragDropIcon extends ReactSurveyElement {
4212
4272
  get question() {
4213
4273
  return this.props.item.data.question;
4214
4274
  }
4275
+ get row() {
4276
+ return this.props.item.data.row;
4277
+ }
4215
4278
  renderElement() {
4216
- return React.createElement("div", null, this.renderIcon());
4279
+ return React.createElement("div", { onPointerDown: (event) => { this.question.onPointerDown(event.nativeEvent, this.row); } }, this.renderIcon());
4217
4280
  }
4218
4281
  renderIcon() {
4219
4282
  if (this.question.iconDragElement) {
@@ -5917,62 +5980,6 @@ ReactElementFactory.Instance.registerElement("sv-nav-btn", (props) => {
5917
5980
  return React.createElement(SurveyNavigationButton, props);
5918
5981
  });
5919
5982
 
5920
- class SurveyLocStringViewer extends React.Component {
5921
- constructor(props) {
5922
- super(props);
5923
- this.onChangedHandler = (sender, options) => {
5924
- if (this.isRendering)
5925
- return;
5926
- this.setState({ changed: !!this.state && this.state.changed ? this.state.changed + 1 : 1 });
5927
- };
5928
- this.rootRef = React.createRef();
5929
- }
5930
- get locStr() {
5931
- return this.props.locStr;
5932
- }
5933
- get style() {
5934
- return this.props.style;
5935
- }
5936
- componentDidMount() {
5937
- this.reactOnStrChanged();
5938
- }
5939
- componentWillUnmount() {
5940
- if (!this.locStr)
5941
- return;
5942
- this.locStr.onStringChanged.remove(this.onChangedHandler);
5943
- }
5944
- componentDidUpdate(prevProps, prevState) {
5945
- if (!!prevProps.locStr) {
5946
- prevProps.locStr.onStringChanged.remove(this.onChangedHandler);
5947
- }
5948
- this.reactOnStrChanged();
5949
- }
5950
- reactOnStrChanged() {
5951
- if (!this.locStr)
5952
- return;
5953
- this.locStr.onStringChanged.add(this.onChangedHandler);
5954
- }
5955
- render() {
5956
- if (!this.locStr)
5957
- return null;
5958
- this.isRendering = true;
5959
- const strEl = this.renderString();
5960
- this.isRendering = false;
5961
- return strEl;
5962
- }
5963
- renderString() {
5964
- const className = this.locStr.allowLineBreaks ? "sv-string-viewer sv-string-viewer--multiline" : "sv-string-viewer";
5965
- if (this.locStr.hasHtml) {
5966
- let htmlValue = { __html: this.locStr.renderedHtml };
5967
- return React.createElement("span", { ref: this.rootRef, className: className, style: this.style, dangerouslySetInnerHTML: htmlValue });
5968
- }
5969
- return React.createElement("span", { ref: this.rootRef, className: className, style: this.style }, this.locStr.renderedHtml);
5970
- }
5971
- }
5972
- ReactElementFactory.Instance.registerElement(LocalizableString.defaultRenderer, (props) => {
5973
- return React.createElement(SurveyLocStringViewer, props);
5974
- });
5975
-
5976
5983
  class QuestionErrorComponent extends React.Component {
5977
5984
  render() {
5978
5985
  const error = this.props.error;
@@ -6156,7 +6163,7 @@ ReactElementFactory.Instance.registerElement(LocalizableString.editableRenderer,
6156
6163
  return React.createElement(SurveyLocStringEditor, props);
6157
6164
  });
6158
6165
 
6159
- checkLibraryVersion(`${"2.4.0"}`, "survey-react-ui");
6166
+ checkLibraryVersion(`${"2.5.0"}`, "survey-react-ui");
6160
6167
 
6161
6168
  export { CharacterCounterComponent, ComponentsContainer, Header, HeaderCell, HeaderMobile, List, ListItemContent, ListItemGroup, LoadingIndicatorComponent, LogoImage, MatrixRow, NotifierComponent, Popup, PopupModal, PopupSurvey, QuestionErrorComponent, RatingDropdownItem, RatingItem, RatingItemSmiley, RatingItemStar, ReactElementFactory, ReactQuestionFactory, ReactSurveyElement, ReactSurveyElementsWrapper, Scroll, Skeleton, SliderLabelItem, Survey, SurveyActionBar, SurveyElementBase, SurveyElementErrors, SurveyFileChooseButton, SurveyFileItem, SurveyFilePreview, SurveyFlowPanel, SurveyHeader, SurveyLocStringEditor, SurveyLocStringViewer, SurveyNavigationBase, SurveyNavigationButton, SurveyPage, SurveyPanel, SurveyProgress, SurveyProgressButtons, SurveyProgressToc, SurveyQuestion, SurveyQuestionAndErrorsCell, SurveyQuestionBoolean, SurveyQuestionBooleanCheckbox, SurveyQuestionBooleanRadio, SurveyQuestionButtonGroup, SurveyQuestionButtonGroupDropdown, SurveyQuestionCheckbox, SurveyQuestionCheckboxItem, SurveyQuestionComment, SurveyQuestionCommentItem, SurveyQuestionComposite, SurveyQuestionCustom, SurveyQuestionDropdown, SurveyQuestionDropdownBase, SurveyQuestionDropdownSelect, SurveyQuestionElementBase, SurveyQuestionEmpty, SurveyQuestionExpression, SurveyQuestionFile, SurveyQuestionHtml, SurveyQuestionImage, SurveyQuestionImagePicker, SurveyQuestionMatrix, SurveyQuestionMatrixCell, SurveyQuestionMatrixDetailButton, SurveyQuestionMatrixDropdown, SurveyQuestionMatrixDropdownBase, SurveyQuestionMatrixDropdownCell, SurveyQuestionMatrixDynamic, SurveyQuestionMatrixDynamicAddButton, SurveyQuestionMatrixDynamicDragDropIcon, SurveyQuestionMatrixDynamicRemoveButton, SurveyQuestionMatrixRow, SurveyQuestionMultipleText, SurveyQuestionOptionItem, SurveyQuestionPanelDynamic, SurveyQuestionPanelDynamicAddButton, SurveyQuestionPanelDynamicNextButton, SurveyQuestionPanelDynamicPrevButton, SurveyQuestionPanelDynamicProgressText, SurveyQuestionPanelDynamicRemoveButton, SurveyQuestionRadioItem, SurveyQuestionRadiogroup, SurveyQuestionRanking, SurveyQuestionRankingItem, SurveyQuestionRankingItemContent, SurveyQuestionRating, SurveyQuestionRatingDropdown, SurveyQuestionSignaturePad, SurveyQuestionSlider, SurveyQuestionTagbox, SurveyQuestionTagboxItem, SurveyQuestionText, SurveyRow, SurveyTimerPanel, SurveyWindow, SvgBundleComponent, SvgIcon, TagboxFilterString, TitleActions, TitleElement, attachKey2click };
6162
6169
  //# sourceMappingURL=survey-react-ui.mjs.map