survey-creator-react 3.2.1 → 3.2.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "survey-creator-react",
3
- "version": "3.2.1",
3
+ "version": "3.2.3",
4
4
  "description": "Embeddable SurveyJS drag-and-drop form builder for JSON-based forms in React. Create dynamic surveys, polls, quizzes, and other forms, configure conditional logic and validation, and customize the editor UI.",
5
5
  "author": "DevSoft Baltic OU <info@devsoftbaltic.com>",
6
6
  "homepage": "https://surveyjs.io/",
@@ -67,9 +67,9 @@
67
67
  "ace-builds": "^1.4.12",
68
68
  "react": "^16.5.0 || ^17.0.1 || ^18.1.0 || ^19.0.0",
69
69
  "react-dom": "^16.5.0 || ^17.0.1 || ^18.1.0 || ^19.0.0",
70
- "survey-core": "3.2.1",
71
- "survey-react-ui": "3.2.1",
72
- "survey-creator-core": "3.2.1"
70
+ "survey-core": "3.2.3",
71
+ "survey-react-ui": "3.2.3",
72
+ "survey-creator-core": "3.2.3"
73
73
  },
74
74
  "peerDependenciesMeta": {
75
75
  "ace-builds": {
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * SurveyJS Creator v3.2.1
2
+ * SurveyJS Creator v3.2.3
3
3
  * (c) 2015-2026 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * Github: https://github.com/surveyjs/survey-creator
5
5
  * License: https://surveyjs.io/Licenses#SurveyCreator
@@ -685,6 +685,9 @@
685
685
 
686
686
  class QuestionRatingAdornerComponent extends CreatorModelElement {
687
687
  createModel(props) {
688
+ if (this.modelValue && !this.modelValue.isDisposed) {
689
+ this.modelValue.dispose();
690
+ }
688
691
  this.modelValue = this.createQuestionViewModel(props);
689
692
  }
690
693
  createQuestionViewModel(props) {
@@ -702,6 +705,19 @@
702
705
  getStateElement() {
703
706
  return this.model;
704
707
  }
708
+ componentDidMount() {
709
+ // React StrictMode mounts the same component again after
710
+ // componentWillUnmount disposed its model.
711
+ if (this.modelValue.isDisposed) {
712
+ this.createModel(this.props);
713
+ this.forceUpdate();
714
+ }
715
+ super.componentDidMount();
716
+ }
717
+ componentWillUnmount() {
718
+ super.componentWillUnmount();
719
+ this.modelValue.dispose();
720
+ }
705
721
  renderElement() {
706
722
  const model = this.ratingModel;
707
723
  return (React__namespace.createElement(React__namespace.Fragment, null,
@@ -901,12 +917,16 @@
901
917
  }
902
918
  renderContent() {
903
919
  if (!this.model.needRenderContent) {
904
- return React__namespace.createElement("div", { className: "svc-page__loading-content" },
920
+ return React__namespace.createElement("div", { className: this.model.loadingContentCss },
905
921
  React__namespace.createElement(surveyReactUi.LoadingIndicatorComponent, null));
906
922
  }
907
923
  return (React__namespace.createElement(PageElementContent, { page: this.props.page, survey: this.props.survey, creator: this.props.creator }));
908
924
  }
909
925
  renderHeader() {
926
+ // The loading placeholder renders no header and no footer: reading their action containers builds them
927
+ // (and fires onElementGetActions / onPageGetFooterActions) for every page, rendered or not.
928
+ if (!this.model.needRenderContent)
929
+ return null;
910
930
  const actions = (React__namespace.createElement("div", { className: "svc-page__content-actions" },
911
931
  React__namespace.createElement(surveyReactUi.SurveyActionBar, { model: this.model.actionContainer }),
912
932
  (this.model.topActionContainer.hasActions ? React__namespace.createElement(surveyReactUi.SurveyActionBar, { model: this.model.topActionContainer }) : null)));
@@ -918,6 +938,8 @@
918
938
  actions));
919
939
  }
920
940
  renderFooter() {
941
+ if (!this.model.needRenderContent)
942
+ return null;
921
943
  return React__namespace.createElement(surveyReactUi.SurveyActionBar, { model: this.model.footerActionsBar });
922
944
  }
923
945
  }
@@ -1138,6 +1160,9 @@
1138
1160
  this.rootRef = React__namespace.createRef();
1139
1161
  }
1140
1162
  createModel(props) {
1163
+ if (this.model && !this.model.isDisposed) {
1164
+ this.model.dispose();
1165
+ }
1141
1166
  this.model = new surveyCreatorCore.ItemValueWrapperViewModel(props.componentData.creator, props.question, props.item);
1142
1167
  }
1143
1168
  getUpdatedModelProps() {
@@ -1154,12 +1179,19 @@
1154
1179
  }
1155
1180
  }
1156
1181
  componentDidMount() {
1182
+ // React StrictMode mounts the same component again after
1183
+ // componentWillUnmount disposed its model.
1184
+ if (this.model.isDisposed) {
1185
+ this.createModel(this.props);
1186
+ this.forceUpdate();
1187
+ }
1157
1188
  super.componentDidMount();
1158
1189
  this.props.item.setRootElement(this.rootRef.current);
1159
1190
  }
1160
1191
  componentWillUnmount() {
1161
1192
  super.componentWillUnmount();
1162
1193
  this.props.item.setRootElement(undefined);
1194
+ this.model.dispose();
1163
1195
  }
1164
1196
  renderButton(action) {
1165
1197
  return surveyReactUi.ReactElementFactory.Instance.createElement("sv-action-bar-item", {
@@ -1218,6 +1250,9 @@
1218
1250
  this.rootRef = React__namespace.createRef();
1219
1251
  }
1220
1252
  createModel(props) {
1253
+ if (this.model && !this.model.isDisposed) {
1254
+ this.model.dispose();
1255
+ }
1221
1256
  this.model = new surveyCreatorCore.ImageItemValueWrapperViewModel(props.componentData.creator, props.question, props.item, null, null);
1222
1257
  }
1223
1258
  getUpdatedModelProps() {
@@ -1230,6 +1265,12 @@
1230
1265
  return this.props.question;
1231
1266
  }
1232
1267
  componentDidMount() {
1268
+ // React StrictMode mounts the same component again after
1269
+ // componentWillUnmount disposed its model.
1270
+ if (this.model.isDisposed) {
1271
+ this.createModel(this.props);
1272
+ this.forceUpdate();
1273
+ }
1233
1274
  super.componentDidMount();
1234
1275
  this.model.itemsRoot = this.rootRef.current;
1235
1276
  }
@@ -1237,6 +1278,10 @@
1237
1278
  super.componentDidUpdate(prevProps, prevState);
1238
1279
  this.model.itemsRoot = this.rootRef.current;
1239
1280
  }
1281
+ componentWillUnmount() {
1282
+ super.componentWillUnmount();
1283
+ this.model.dispose();
1284
+ }
1240
1285
  renderLoadingIndicator() {
1241
1286
  return React__namespace.createElement("div", { className: "svc-image-item-value__loading" },
1242
1287
  React__namespace.createElement(surveyReactUi.LoadingIndicatorComponent, null));
@@ -2439,7 +2484,7 @@
2439
2484
  clearCallback(page) {
2440
2485
  if (!page)
2441
2486
  return;
2442
- page.unRegisterFunctionOnPropertyValueChanged("name");
2487
+ page.unRegisterFunctionOnPropertyValueChanged("name", this.id);
2443
2488
  }
2444
2489
  componentDidUpdate(prevProps, prevState) {
2445
2490
  if (prevProps.page !== this.props.page) {
@@ -2485,7 +2530,7 @@
2485
2530
  const errors = React__namespace.createElement(TabJsonEditorErrorsComponent, { data: this.model });
2486
2531
  return (React__namespace.createElement("div", { className: "svc-creator-tab__content" },
2487
2532
  React__namespace.createElement("div", { className: "svc-json-editor-tab__content" },
2488
- React__namespace.createElement("textarea", { ref: input => (setControl(input)), className: "svc-json-editor-tab__content-area", value: this.model.text, onChange: (e) => (this.model.text = e.target.value), onKeyDown: (e) => this.model.checkKey(e, e), disabled: this.model.readOnly, "aria-label": this.model.ariaLabel }),
2533
+ React__namespace.createElement("textarea", { ref: input => (setControl(input)), className: "svc-json-editor-tab__content-area", value: this.model.text, onChange: (e) => this.model.onTextInput(e.target.value), onKeyDown: (e) => this.model.checkKey(e, e), disabled: this.model.readOnly, "aria-label": this.model.ariaLabel }),
2489
2534
  errors)));
2490
2535
  }
2491
2536
  }
@@ -3176,8 +3221,8 @@
3176
3221
  });
3177
3222
 
3178
3223
  exports.Version = void 0;
3179
- exports.Version = `${"3.2.1"}`;
3180
- surveyCore.checkLibraryVersion(`${"3.2.1"}`, "survey-creator-react");
3224
+ exports.Version = `${"3.2.3"}`;
3225
+ surveyCore.checkLibraryVersion(`${"3.2.3"}`, "survey-creator-react");
3181
3226
 
3182
3227
  Object.defineProperty(exports, "PropertyGridEditorCollection", {
3183
3228
  enumerable: true,