survey-creator-react 3.2.4 → 3.2.5

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.4",
3
+ "version": "3.2.5",
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.4",
71
- "survey-react-ui": "3.2.4",
72
- "survey-creator-core": "3.2.4"
70
+ "survey-core": "3.2.5",
71
+ "survey-react-ui": "3.2.5",
72
+ "survey-creator-core": "3.2.5"
73
73
  },
74
74
  "peerDependenciesMeta": {
75
75
  "ace-builds": {
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * SurveyJS Creator v3.2.4
2
+ * SurveyJS Creator v3.2.5
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
@@ -126,7 +126,7 @@
126
126
  getStateElement() {
127
127
  return this.item;
128
128
  }
129
- render() {
129
+ renderElement() {
130
130
  const item = this.item;
131
131
  return (surveyReactUi.attachKey2click(React__namespace.createElement("div", { role: "tab", id: "tab-" + item.id, "aria-selected": item.active, "aria-controls": "scrollableDiv-" + item.id, className: item.getRootCss(), "data-sv-tooltip": item.hasIcon ? item.tooltip || item.title : undefined, onClick: () => item.doAction() },
132
132
  item.hasTitle ? React__namespace.createElement("span", { className: item.getTitleCss() }, item.title) : null,
@@ -355,7 +355,7 @@
355
355
  this.model.unsubscribeElementChanges();
356
356
  super.componentWillUnmount();
357
357
  }
358
- render() {
358
+ renderElement() {
359
359
  return (React__namespace.createElement("div", { key: "svc-row-" + this.props.row.id, className: this.model.cssClasses },
360
360
  React__namespace.createElement("div", { className: "svc-row__drop-indicator svc-row__drop-indicator--top" }),
361
361
  React__namespace.createElement("div", { className: "svc-row__drop-indicator svc-row__drop-indicator--bottom" }),
@@ -586,8 +586,9 @@
586
586
  React__namespace.createElement("span", null,
587
587
  this.props.text,
588
588
  " "),
589
- React__namespace.createElement("span", { className: "svc-carry-forward-panel__link" },
590
- React__namespace.createElement(ActionButton, { click: () => this.props.onClick(), text: this.props.actionText })))));
589
+ this.props.actionText ?
590
+ React__namespace.createElement("span", { className: "svc-carry-forward-panel__link" },
591
+ React__namespace.createElement(ActionButton, { click: () => this.props.onClick(), text: this.props.actionText })) : null)));
591
592
  }
592
593
  }
593
594
  surveyReactUi.ReactElementFactory.Instance.registerElement("svc-question-banner", (props) => {
@@ -758,7 +759,7 @@
758
759
  getUpdatedModelProps() {
759
760
  return ["question", "componentData"];
760
761
  }
761
- render() {
762
+ renderElement() {
762
763
  return (React__namespace.createElement(React__namespace.Fragment, null,
763
764
  React__namespace.createElement("div", { "data-sv-drop-target-survey-element": this.model.element.name, className: "svc-question__adorner" },
764
765
  React__namespace.createElement("div", { className: " svc-question__content--in-popup svc-question__content" }, this.props.element))));
@@ -778,7 +779,7 @@
778
779
  getStateElement() {
779
780
  return this.model;
780
781
  }
781
- render() {
782
+ renderElement() {
782
783
  const question = this.props.question;
783
784
  const textStyle = this.props.question.textStyle;
784
785
  return (React__namespace.createElement(React__namespace.Fragment, null,
@@ -804,11 +805,18 @@
804
805
  // panes. Chrome-free: no designer adorner, no itemvalue wrappers - the choice texts render
805
806
  // through the survey's string renderer (editable in the target pane, plain in the source one).
806
807
  class TranslationDropdownQuestionComponent extends CreatorModelElement {
808
+ get model() {
809
+ return this.modelValue;
810
+ }
807
811
  createModel(props) {
808
- if (!!this.model) {
809
- this.model.dispose();
812
+ const { question } = props;
813
+ const translation = props.componentData ? props.componentData.translation : undefined;
814
+ if (!this.modelValue) {
815
+ this.modelValue = new surveyCreatorCore.TranslationDropdownViewModel(question, translation);
816
+ }
817
+ else {
818
+ this.modelValue.attachToUI(question, translation);
810
819
  }
811
- this.model = new surveyCreatorCore.TranslationDropdownViewModel(props.question, props.componentData ? props.componentData.translation : undefined);
812
820
  }
813
821
  getUpdatedModelProps() {
814
822
  return ["question", "componentData"];
@@ -816,9 +824,14 @@
816
824
  getStateElement() {
817
825
  return this.model;
818
826
  }
827
+ componentDidMount() {
828
+ super.componentDidMount();
829
+ this.createModel(this.props);
830
+ }
819
831
  componentWillUnmount() {
832
+ var _a;
820
833
  super.componentWillUnmount();
821
- this.model.dispose();
834
+ (_a = this.model) === null || _a === void 0 ? void 0 : _a.detachFromUI();
822
835
  }
823
836
  renderElement() {
824
837
  const question = this.props.question;
@@ -898,7 +911,7 @@
898
911
  renderElement() {
899
912
  if (!this.props.page)
900
913
  return null;
901
- return (surveyReactUi.attachKey2click(React__namespace.createElement("div", { ref: this.rootRef, id: this.props.page.id, "data-sv-drop-target-survey-page": this.model.dropTargetName, className: "svc-page__content " + this.model.css, onClick: (e) => {
914
+ return (surveyReactUi.attachKey2click(React__namespace.createElement("div", { ref: this.rootRef, id: this.props.page.renderedId, "data-sv-drop-target-survey-page": this.model.dropTargetName, className: "svc-page__content " + this.model.css, onClick: (e) => {
902
915
  return this.model.select(this.model, new ReactMouseEvent(e));
903
916
  }, onDoubleClick: e => this.model.dblclick(e.nativeEvent), onMouseLeave: (e) => this.model.hover(e.nativeEvent, e.currentTarget), onMouseOver: (e) => this.model.hover(e.nativeEvent, e.currentTarget) },
904
917
  React__namespace.createElement("div", { className: "svc-question__drop-indicator svc-question__drop-indicator--top" }),
@@ -1002,6 +1015,9 @@
1002
1015
  class LogoImageComponent extends CreatorModelElement {
1003
1016
  constructor(props) {
1004
1017
  super(props);
1018
+ this.reactOnStrChanged = () => {
1019
+ this.setState({ locLogoLinkchanged: !!this.state && this.state.locLogoLink ? this.state.locLogoLink + 1 : 1 });
1020
+ };
1005
1021
  this.rootRef = React__namespace.createRef();
1006
1022
  }
1007
1023
  createModel(props) {
@@ -1017,8 +1033,17 @@
1017
1033
  getStateElement() {
1018
1034
  return this.model;
1019
1035
  }
1036
+ componentDidUpdate(prevProps, prevState) {
1037
+ super.componentDidUpdate(prevProps, prevState);
1038
+ this.model.survey.locLogo.onStringChanged.add(this.reactOnStrChanged);
1039
+ }
1040
+ componentWillUnmount() {
1041
+ super.componentWillUnmount();
1042
+ this.model.survey.locLogo.onStringChanged.remove(this.reactOnStrChanged);
1043
+ }
1020
1044
  componentDidMount() {
1021
1045
  super.componentDidMount();
1046
+ this.model.survey.locLogo.onStringChanged.add(this.reactOnStrChanged);
1022
1047
  this.model.root = this.rootRef.current;
1023
1048
  }
1024
1049
  renderButtons() {
@@ -1041,7 +1066,7 @@
1041
1066
  return React__namespace.createElement("div", { className: "svc-logo-image__loading" },
1042
1067
  React__namespace.createElement(surveyReactUi.LoadingIndicatorComponent, null));
1043
1068
  }
1044
- render() {
1069
+ renderElement() {
1045
1070
  let content = null;
1046
1071
  if (this.model.survey.locLogo.renderedHtml && !this.model.isUploading) {
1047
1072
  content = this.renderImage();
@@ -1107,10 +1132,11 @@
1107
1132
  this.embeddedSurvey.rootElement = this.rootRef.current;
1108
1133
  }
1109
1134
  }
1110
- render() {
1135
+ canRender() {
1136
+ return !!this.embeddedSurvey;
1137
+ }
1138
+ renderElement() {
1111
1139
  const survey = this.embeddedSurvey;
1112
- if (!survey)
1113
- return null;
1114
1140
  return React__namespace.createElement("div", { style: { display: "contents" }, ref: this.rootRef },
1115
1141
  React__namespace.createElement(surveyReactUi.SurveyPage, { survey: survey, page: survey.currentPage, css: survey.css, creator: this.creator }));
1116
1142
  }
@@ -1198,7 +1224,7 @@
1198
1224
  item: action,
1199
1225
  });
1200
1226
  }
1201
- render() {
1227
+ renderElement() {
1202
1228
  this.model.item = this.props.item;
1203
1229
  const button = this.model.allowAdd ? (this.renderButton(this.model.addAction)) : (React__namespace.createElement(React__namespace.Fragment, null,
1204
1230
  " ",
@@ -1293,7 +1319,7 @@
1293
1319
  placeholder,
1294
1320
  controls);
1295
1321
  }
1296
- render() {
1322
+ renderElement() {
1297
1323
  this.model.item = this.props.item;
1298
1324
  const isNew = !this.props.question.isItemInList(this.props.item);
1299
1325
  this.model.isNew = isNew;
@@ -1366,7 +1392,7 @@
1366
1392
  getStateElement() {
1367
1393
  return this.model;
1368
1394
  }
1369
- render() {
1395
+ renderElement() {
1370
1396
  let controls = null;
1371
1397
  if (!!this.model.isSupportCellEditor) {
1372
1398
  controls = React__namespace.createElement("div", { className: "svc-matrix-cell__question-controls" }, surveyReactUi.ReactElementFactory.Instance.createElement("sv-action-bar-item", {
@@ -1395,7 +1421,7 @@
1395
1421
  getStateElement() {
1396
1422
  return this.model;
1397
1423
  }
1398
- render() {
1424
+ renderElement() {
1399
1425
  if (!this.model) {
1400
1426
  return null;
1401
1427
  }
@@ -1443,7 +1469,7 @@
1443
1469
  getStateElement() {
1444
1470
  return this.row;
1445
1471
  }
1446
- render() {
1472
+ renderElement() {
1447
1473
  return (React__namespace.createElement(React__namespace.Fragment, null,
1448
1474
  surveyReactUi.attachKey2click(React__namespace.createElement("tr", { onClick: () => this.row.toggle() },
1449
1475
  React__namespace.createElement("td", { key: 1, style: { paddingLeft: this.row.textMargin }, className: "svd-dark-border-color" },
@@ -1478,7 +1504,7 @@
1478
1504
  getStateElement() {
1479
1505
  return this.item;
1480
1506
  }
1481
- render() {
1507
+ renderElement() {
1482
1508
  const item = this.item;
1483
1509
  const itemComponent = surveyReactUi.ReactElementFactory.Instance.createElement(this.model.itemComponent, {
1484
1510
  item: item,
@@ -1537,7 +1563,7 @@
1537
1563
  getStateElement() {
1538
1564
  return this.model;
1539
1565
  }
1540
- render() {
1566
+ renderElement() {
1541
1567
  const banner = (this.props.isCompact ?
1542
1568
  React__namespace.createElement("span", { className: "svc-toolbox__item-banner", onClick: (event) => {
1543
1569
  event.persist();
@@ -1590,7 +1616,7 @@
1590
1616
  getStateElement() {
1591
1617
  return this.item;
1592
1618
  }
1593
- render() {
1619
+ renderElement() {
1594
1620
  return React__namespace.createElement(React__namespace.Fragment, null,
1595
1621
  React__namespace.createElement(SurveyCreatorToolboxItem, { item: this.item, creator: this.creator, model: this.model, parentModel: this.parentModel, isCompact: this.isCompact }),
1596
1622
  React__namespace.createElement("div", { className: "svc-toolbox__item-submenu-button", onMouseOver: (event) => this.model.onMouseOver(this.item, event), onMouseLeave: (event) => this.model.onMouseLeave(this.item, event) },
@@ -1617,7 +1643,7 @@
1617
1643
  getStateElement() {
1618
1644
  return this.category;
1619
1645
  }
1620
- render() {
1646
+ renderElement() {
1621
1647
  const header = this.renderCategoryHeader();
1622
1648
  const items = this.renderCategoryContent();
1623
1649
  return (React__namespace.createElement("div", { className: this.class, key: this.category.name },
@@ -1665,7 +1691,7 @@
1665
1691
  getStateElement() {
1666
1692
  return this.model;
1667
1693
  }
1668
- render() {
1694
+ renderElement() {
1669
1695
  if (!this.model || !this.model.renderElements)
1670
1696
  return null;
1671
1697
  const items = this.renderItems();
@@ -1689,9 +1715,6 @@
1689
1715
  }
1690
1716
  constructor(props) {
1691
1717
  super(props);
1692
- this.state = {
1693
- filterString: this.model.filterString || ""
1694
- };
1695
1718
  }
1696
1719
  renderElement() {
1697
1720
  if (!this.model.isVisible)
@@ -1708,7 +1731,7 @@
1708
1731
  return (React__namespace.createElement("div", { className: "svc-search" },
1709
1732
  React__namespace.createElement("div", { className: "svc-search__search-icon" },
1710
1733
  React__namespace.createElement(surveyReactUi.SvgIcon, { iconName: "icon-search", size: "auto" })),
1711
- React__namespace.createElement("input", { type: "text", className: "svc-search__input", "aria-label": this.model.filterStringPlaceholder, placeholder: this.model.filterStringPlaceholder, value: this.state.filterString, onChange: onChange, tabIndex: this.model.getTabIndex() }),
1734
+ React__namespace.createElement("input", { type: "text", className: "svc-search__input", "aria-label": this.model.filterStringPlaceholder, placeholder: this.model.filterStringPlaceholder, value: this.model.filterString || "", onChange: onChange, tabIndex: this.model.getTabIndex() }),
1712
1735
  React__namespace.createElement("div", { className: "svc-search__toolbar" },
1713
1736
  React__namespace.createElement("div", { className: "svc-search__toolbar-counter" }, this.model.matchCounterText),
1714
1737
  React__namespace.createElement(surveyReactUi.SurveyActionBar, { model: this.model.searchActionBar }))));
@@ -1774,7 +1797,7 @@
1774
1797
  React__namespace.createElement(SearchComponent, { model: this.toolbox.searchManager }),
1775
1798
  React__namespace.createElement("div", { className: "svc-toolbox__category-separator svc-toolbox__category-separator--search" })));
1776
1799
  }
1777
- render() {
1800
+ renderElement() {
1778
1801
  const search = this.toolbox.showSearch ? this.renderSearch() : null;
1779
1802
  const placeholder = this.toolbox.showPlaceholder ? React__namespace.createElement("div", { className: "svc-toolbox__placeholder" }, this.toolbox.toolboxNoResultsFound) : null;
1780
1803
  return (React__namespace.createElement("div", { ref: this.rootRef, className: this.toolbox.classNames, style: this.toolbox.getRootStyle() },
@@ -1791,46 +1814,6 @@
1791
1814
  });
1792
1815
 
1793
1816
  class SurveyNavigation extends surveyReactUi.SurveyElementBase {
1794
- constructor() {
1795
- super(...arguments);
1796
- this.onPropChangedHandler = (sender, options) => {
1797
- if (this.isRendering)
1798
- return;
1799
- const reactiveProps = [
1800
- "showProgressBar",
1801
- "progressBarType",
1802
- "currentPageValue"
1803
- ];
1804
- if (reactiveProps.indexOf(options.name) < 0)
1805
- return;
1806
- var val = {};
1807
- for (var i = 0; i < reactiveProps.length; i++) {
1808
- var propName = reactiveProps[i];
1809
- val[propName] = this.survey[propName];
1810
- }
1811
- this.setState(val);
1812
- };
1813
- }
1814
- componentDidMount() {
1815
- super.componentDidMount();
1816
- this.setHandler();
1817
- }
1818
- componentDidUpdate(prevProps, prevState) {
1819
- super.componentDidUpdate(prevProps, prevState);
1820
- this.setHandler();
1821
- }
1822
- setHandler() {
1823
- if (!this.survey ||
1824
- this.survey.onPropertyChanged.hasFunc(this.onPropChangedHandler))
1825
- return;
1826
- this.survey.onPropertyChanged.add(this.onPropChangedHandler);
1827
- }
1828
- componentWillUnmount() {
1829
- super.componentWillUnmount();
1830
- if (this.survey) {
1831
- this.survey.onPropertyChanged.remove(this.onPropChangedHandler);
1832
- }
1833
- }
1834
1817
  get survey() {
1835
1818
  return this.props.survey;
1836
1819
  }
@@ -2206,7 +2189,7 @@
2206
2189
  get className() {
2207
2190
  return this.baseModel.className(this.locString.renderedHtml);
2208
2191
  }
2209
- render() {
2192
+ renderElement() {
2210
2193
  if (!this.locString) {
2211
2194
  return null;
2212
2195
  }
@@ -2357,16 +2340,16 @@
2357
2340
  this.denyUpdate = () => {
2358
2341
  this.denyComponentUpdate();
2359
2342
  };
2360
- this.allowUpdate = () => {
2343
+ this.allowUpdateHandler = () => {
2361
2344
  this.allowComponentUpdate();
2362
2345
  };
2363
2346
  this.addDragDropEvents = () => {
2364
2347
  this.creator.onDragStart.add(this.denyUpdate);
2365
- this.creator.onDragClear.add(this.allowUpdate);
2348
+ this.creator.onDragClear.add(this.allowUpdateHandler);
2366
2349
  };
2367
2350
  this.clearDragDropEvents = () => {
2368
2351
  this.creator.onDragStart.remove(this.denyUpdate);
2369
- this.creator.onDragClear.remove(this.allowUpdate);
2352
+ this.creator.onDragClear.remove(this.allowUpdateHandler);
2370
2353
  };
2371
2354
  }
2372
2355
  get model() {
@@ -2382,7 +2365,6 @@
2382
2365
  componentWillUnmount() {
2383
2366
  super.componentWillUnmount();
2384
2367
  this.clearDragDropEvents();
2385
- super.componentWillUnmount();
2386
2368
  }
2387
2369
  getStateElements() {
2388
2370
  return [this.model, this.model.survey, this.model.pagesController];
@@ -2550,6 +2532,7 @@
2550
2532
  return this.props.data;
2551
2533
  }
2552
2534
  componentDidMount() {
2535
+ super.componentDidMount();
2553
2536
  this.model.init(ace.edit(this.aceEditorrRef.current));
2554
2537
  }
2555
2538
  renderElement() {
@@ -2564,6 +2547,33 @@
2564
2547
  return React__namespace.createElement(TabJsonEditorAceComponent, props);
2565
2548
  });
2566
2549
 
2550
+ class TabJsonEditorMonacoComponent extends surveyReactUi.SurveyElementBase {
2551
+ constructor(props) {
2552
+ super(props);
2553
+ this.monacoEditorRef = React__namespace.createRef();
2554
+ }
2555
+ getStateElement() {
2556
+ return this.model;
2557
+ }
2558
+ get model() {
2559
+ return this.props.data;
2560
+ }
2561
+ componentDidMount() {
2562
+ super.componentDidMount();
2563
+ this.model.init(this.monacoEditorRef.current);
2564
+ }
2565
+ renderElement() {
2566
+ const errors = React__namespace.createElement(TabJsonEditorErrorsComponent, { data: this.model });
2567
+ return (React__namespace.createElement("div", { className: "svc-creator-tab__content" },
2568
+ React__namespace.createElement("div", { className: "svc-json-editor-tab__content" },
2569
+ React__namespace.createElement("div", { className: "svc-json-editor-tab__monaco-editor", ref: this.monacoEditorRef }),
2570
+ errors)));
2571
+ }
2572
+ }
2573
+ surveyReactUi.ReactElementFactory.Instance.registerElement("svc-tab-json-editor-monaco", (props) => {
2574
+ return React__namespace.createElement(TabJsonEditorMonacoComponent, props);
2575
+ });
2576
+
2567
2577
  class TabLogicComponent extends surveyReactUi.SurveyElementBase {
2568
2578
  get model() {
2569
2579
  return this.props.data;
@@ -3001,7 +3011,7 @@
3001
3011
  });
3002
3012
 
3003
3013
  let ItemTemplateComponent$1 = class ItemTemplateComponent extends surveyReactUi.SurveyElementBase {
3004
- render() {
3014
+ renderElement() {
3005
3015
  const item = this.props.item;
3006
3016
  return (React__namespace.createElement(React__namespace.Fragment, null,
3007
3017
  React__namespace.createElement(surveyReactUi.SvgIcon, { iconName: item.iconName, size: item.iconSize, className: "svc-json-error__icon" }),
@@ -3120,7 +3130,7 @@
3120
3130
  }
3121
3131
 
3122
3132
  class ItemTemplateComponent extends surveyReactUi.SurveyElementBase {
3123
- render() {
3133
+ renderElement() {
3124
3134
  const item = this.props.item;
3125
3135
  return (React__namespace.createElement("div", { className: "sd-color-swatch-item" },
3126
3136
  React__namespace.createElement("div", { className: "sd-color-swatch-item__label" },
@@ -3221,8 +3231,8 @@
3221
3231
  });
3222
3232
 
3223
3233
  exports.Version = void 0;
3224
- exports.Version = `${"3.2.4"}`;
3225
- surveyCore.checkLibraryVersion(`${"3.2.4"}`, "survey-creator-react");
3234
+ exports.Version = `${"3.2.5"}`;
3235
+ surveyCore.checkLibraryVersion(`${"3.2.5"}`, "survey-creator-react");
3226
3236
 
3227
3237
  Object.defineProperty(exports, "PropertyGridEditorCollection", {
3228
3238
  enumerable: true,
@@ -3319,6 +3329,7 @@
3319
3329
  exports.TabDesignerComponent = TabDesignerComponent;
3320
3330
  exports.TabJsonEditorAceComponent = TabJsonEditorAceComponent;
3321
3331
  exports.TabJsonEditorErrorsComponent = TabJsonEditorErrorsComponent;
3332
+ exports.TabJsonEditorMonacoComponent = TabJsonEditorMonacoComponent;
3322
3333
  exports.TabJsonEditorTextareaComponent = TabJsonEditorTextareaComponent;
3323
3334
  exports.TabLogicComponent = TabLogicComponent;
3324
3335
  exports.TabPreviewSurveyComponent = TabPreviewSurveyComponent;