survey-react-ui 2.0.0-rc.8 → 2.0.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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - Survey JavaScript library v2.0.0-rc.8
2
+ * surveyjs - Survey JavaScript library v2.0.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
  */
@@ -103,6 +103,21 @@ class SurveyElementBase extends React.Component {
103
103
  super(props);
104
104
  this._allowComponentUpdate = true;
105
105
  this.prevStateElements = [];
106
+ this.propertyValueChangedHandler = (hash, key, val) => {
107
+ if (hash[key] !== val) {
108
+ hash[key] = val;
109
+ if (!this.canUsePropInState(key))
110
+ return;
111
+ if (this.isRendering)
112
+ return;
113
+ this.changedStatePropNameValue = key;
114
+ this.setState((state) => {
115
+ var newState = {};
116
+ newState[key] = val;
117
+ return newState;
118
+ });
119
+ }
120
+ };
106
121
  }
107
122
  componentDidMount() {
108
123
  this.makeBaseElementsReact();
@@ -188,6 +203,9 @@ class SurveyElementBase extends React.Component {
188
203
  }
189
204
  unMakeBaseElementsReact() {
190
205
  var els = this.getStateElements();
206
+ this.unMakeBaseElementsReactive(els);
207
+ }
208
+ unMakeBaseElementsReactive(els) {
191
209
  for (var i = 0; i < els.length; i++) {
192
210
  this.unMakeBaseElementReact(els[i]);
193
211
  }
@@ -214,6 +232,9 @@ class SurveyElementBase extends React.Component {
214
232
  canMakeReact(stateElement) {
215
233
  return !!stateElement && !!stateElement.iteratePropertiesHash;
216
234
  }
235
+ isCurrentStateElement(stateElement) {
236
+ return !!stateElement && !!stateElement.setPropertyValueCoreHandler && stateElement.setPropertyValueCoreHandler === this.propertyValueChangedHandler;
237
+ }
217
238
  makeBaseElementReact(stateElement) {
218
239
  if (!this.canMakeReact(stateElement))
219
240
  return;
@@ -235,21 +256,7 @@ class SurveyElementBase extends React.Component {
235
256
  };
236
257
  }
237
258
  });
238
- stateElement.setPropertyValueCoreHandler = (hash, key, val) => {
239
- if (hash[key] !== val) {
240
- hash[key] = val;
241
- if (!this.canUsePropInState(key))
242
- return;
243
- if (this.isRendering)
244
- return;
245
- this.changedStatePropNameValue = key;
246
- this.setState((state) => {
247
- var newState = {};
248
- newState[key] = val;
249
- return newState;
250
- });
251
- }
252
- };
259
+ stateElement.setPropertyValueCoreHandler = this.propertyValueChangedHandler;
253
260
  }
254
261
  canUsePropInState(key) {
255
262
  return true;
@@ -257,6 +264,7 @@ class SurveyElementBase extends React.Component {
257
264
  unMakeBaseElementReact(stateElement) {
258
265
  if (!this.canMakeReact(stateElement))
259
266
  return;
267
+ if (!this.isCurrentStateElement(stateElement)) ;
260
268
  stateElement.setPropertyValueCoreHandler = undefined;
261
269
  stateElement.iteratePropertiesHash((hash, key) => {
262
270
  var val = hash[key];
@@ -540,8 +548,10 @@ class SurveyRow extends SurveyElementBase {
540
548
  }
541
549
  componentWillUnmount() {
542
550
  super.componentWillUnmount();
543
- this.row.setRootElement(undefined);
544
- this.stopLazyRendering();
551
+ if (this.isCurrentStateElement(this.getStateElement())) {
552
+ this.row.setRootElement(undefined);
553
+ this.stopLazyRendering();
554
+ }
545
555
  }
546
556
  createElement(element, elementIndex) {
547
557
  const index = elementIndex ? "-" + elementIndex : 0;
@@ -690,9 +700,6 @@ class SurveyAction extends SurveyElementBase {
690
700
  getStateElement() {
691
701
  return this.item;
692
702
  }
693
- shouldComponentUpdate(nextProps, nextState) {
694
- return super.shouldComponentUpdate(nextProps, nextState);
695
- }
696
703
  renderElement() {
697
704
  //refactor
698
705
  const itemClass = this.item.getActionRootCss();
@@ -1611,10 +1618,6 @@ class SurveyPage extends SurveyPanelBase {
1611
1618
  get page() {
1612
1619
  return this.panelBase;
1613
1620
  }
1614
- // shouldComponentUpdate(nextProps: any, nextState: any): boolean {
1615
- // if(!super.shouldComponentUpdate(nextProps, nextState)) return false;
1616
- // return true;
1617
- // }
1618
1621
  renderElement() {
1619
1622
  var title = this.renderTitle();
1620
1623
  var description = this.renderDescription();
@@ -1839,7 +1842,7 @@ class PopupModal extends SurveyElementBase {
1839
1842
  PopupModal.modalDescriptors = [];
1840
1843
 
1841
1844
  /*!
1842
- * surveyjs - Survey JavaScript library v2.0.0-rc.8
1845
+ * surveyjs - Survey JavaScript library v2.0.0
1843
1846
  * Copyright (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
1844
1847
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
1845
1848
  */
@@ -1907,7 +1910,7 @@ var iconsV1 = {
1907
1910
  };
1908
1911
 
1909
1912
  /*!
1910
- * surveyjs - Survey JavaScript library v2.0.0-rc.8
1913
+ * surveyjs - Survey JavaScript library v2.0.0
1911
1914
  * Copyright (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
1912
1915
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
1913
1916
  */
@@ -5281,7 +5284,7 @@ class SurveyQuestionImagePicker extends SurveyQuestionElementBase {
5281
5284
  }
5282
5285
  renderElement() {
5283
5286
  var cssClasses = this.question.cssClasses;
5284
- return (React.createElement("fieldset", { className: this.question.getSelectBaseRootCss() },
5287
+ return (React.createElement("fieldset", { className: this.question.getSelectBaseRootCss(), style: this.question.getContainerStyle() },
5285
5288
  React.createElement("legend", { className: "sv-hidden" }, this.question.locTitle.renderedHtml),
5286
5289
  this.question.hasColumns ? this.getColumns(cssClasses) : this.getItems(cssClasses)));
5287
5290
  }
@@ -5963,7 +5966,7 @@ ReactElementFactory.Instance.registerElement(LocalizableString.editableRenderer,
5963
5966
  return React.createElement(SurveyLocStringEditor, props);
5964
5967
  });
5965
5968
 
5966
- checkLibraryVersion(`${"2.0.0-rc.8"}`, "survey-react-ui");
5969
+ checkLibraryVersion(`${"2.0.0"}`, "survey-react-ui");
5967
5970
 
5968
5971
  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, Skeleton, Survey, SurveyActionBar, SurveyElementBase, SurveyElementErrors, SurveyFileChooseButton, SurveyFilePreview, SurveyFlowPanel, SurveyHeader, SurveyLocStringEditor, SurveyLocStringViewer, SurveyNavigationBase, SurveyNavigationButton, SurveyPage, SurveyPanel, SurveyProgress, SurveyProgressButtons, SurveyProgressToc, SurveyQuestion, SurveyQuestionAndErrorsCell, SurveyQuestionBoolean, SurveyQuestionBooleanCheckbox, SurveyQuestionBooleanRadio, SurveyQuestionButtonGroup, 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, SurveyQuestionTagbox, SurveyQuestionTagboxItem, SurveyQuestionText, SurveyRow, SurveyTimerPanel, SurveyWindow, SvgBundleComponent, SvgIcon, TagboxFilterString, TitleActions, TitleElement, attachKey2click };
5969
5972
  //# sourceMappingURL=survey-react-ui.js.map