survey-creator-react 1.12.5 → 1.12.6

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": "1.12.5",
3
+ "version": "1.12.6",
4
4
  "description": "Use SurveyJS Creator to create or edit JSON for SurveyJS Form Library.",
5
5
  "keywords": [
6
6
  "Survey",
@@ -29,9 +29,9 @@
29
29
  "ace-builds": "^1.4.12",
30
30
  "react": "^16.5.0 || ^17.0.1 || ^18.1.0",
31
31
  "react-dom": "^16.5.0 || ^17.0.1 || ^18.1.0",
32
- "survey-core": "1.12.5",
33
- "survey-react-ui": "1.12.5",
34
- "survey-creator-core": "1.12.5"
32
+ "survey-core": "1.12.6",
33
+ "survey-react-ui": "1.12.6",
34
+ "survey-creator-core": "1.12.6"
35
35
  },
36
36
  "peerDependenciesMeta": {
37
37
  "ace-builds": {
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * SurveyJS Creator React v1.12.5
2
+ * SurveyJS Creator React v1.12.6
3
3
  * (c) 2015-2024 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * Github: https://github.com/surveyjs/survey-creator
5
5
  * License: https://surveyjs.io/Licenses#SurveyCreator
@@ -196,9 +196,6 @@ var ImageItemValueAdornerComponent = /** @class */ (function (_super) {
196
196
  };
197
197
  ImageItemValueAdornerComponent.prototype.render = function () {
198
198
  var _this = this;
199
- // if (this.model.question.isDragged) {
200
- // return null;
201
- // }
202
199
  this.model.item = this.props.item;
203
200
  var isNew = !this.props.question.isItemInList(this.props.item);
204
201
  this.model.isNew = isNew;
@@ -309,9 +306,6 @@ var ItemValueAdornerComponent = /** @class */ (function (_super) {
309
306
  };
310
307
  ItemValueAdornerComponent.prototype.render = function () {
311
308
  var _this = this;
312
- // if (this.model.question.isDragged) {
313
- // return null;
314
- // }
315
309
  this.model.item = this.props.item;
316
310
  var button = this.model.allowAdd ? ((0,survey_react_ui__WEBPACK_IMPORTED_MODULE_3__.attachKey2click)(react__WEBPACK_IMPORTED_MODULE_2__.createElement("span", { className: "svc-item-value-controls__button svc-item-value-controls__add", "aria-label": this.model.tooltip, onClick: function () {
317
311
  _this.model.add(_this.model);
@@ -1744,9 +1738,6 @@ var CellQuestionAdornerComponent = /** @class */ (function (_super) {
1744
1738
  return ["question", "componentData"];
1745
1739
  };
1746
1740
  CellQuestionAdornerComponent.prototype.render = function () {
1747
- if (this.model.isDragged) {
1748
- return null;
1749
- }
1750
1741
  return (react__WEBPACK_IMPORTED_MODULE_1__.createElement(react__WEBPACK_IMPORTED_MODULE_1__.Fragment, null,
1751
1742
  react__WEBPACK_IMPORTED_MODULE_1__.createElement("div", { "data-sv-drop-target-survey-element": this.model.element.name, className: "svc-question__adorner" },
1752
1743
  react__WEBPACK_IMPORTED_MODULE_1__.createElement("div", { className: " svc-question__content--in-popup svc-question__content" }, this.props.element))));
@@ -1799,9 +1790,6 @@ var CellQuestionDropdownAdornerComponent = /** @class */ (function (_super) {
1799
1790
  return this.model;
1800
1791
  };
1801
1792
  CellQuestionDropdownAdornerComponent.prototype.render = function () {
1802
- if (this.model.isDragged) {
1803
- return null;
1804
- }
1805
1793
  var question = this.props.question;
1806
1794
  var textStyle = this.props.question.textStyle;
1807
1795
  return (react__WEBPACK_IMPORTED_MODULE_2__.createElement(react__WEBPACK_IMPORTED_MODULE_2__.Fragment, null,
@@ -1862,16 +1850,12 @@ var CreatorSurveyPageComponent = /** @class */ (function (_super) {
1862
1850
  }
1863
1851
  CreatorSurveyPageComponent.prototype.createModel = function (props) {
1864
1852
  if (this.model) {
1865
- this.model.dispose();
1853
+ this.model.attachToUI(props.page, this.rootRef.current);
1866
1854
  }
1867
1855
  this.model = new survey_creator_core__WEBPACK_IMPORTED_MODULE_4__.PageAdorner(props.creator, props.page);
1868
1856
  };
1869
1857
  CreatorSurveyPageComponent.prototype.componentDidUpdate = function (prevProps, prevState) {
1870
- var _a;
1871
1858
  _super.prototype.componentDidUpdate.call(this, prevProps, prevState);
1872
- if (!!((_a = this.rootRef) === null || _a === void 0 ? void 0 : _a.current)) {
1873
- this.model.rootElement = this.rootRef.current;
1874
- }
1875
1859
  };
1876
1860
  CreatorSurveyPageComponent.prototype.getUpdatedModelProps = function () {
1877
1861
  return ["creator", "page"];
@@ -1881,13 +1865,11 @@ var CreatorSurveyPageComponent = /** @class */ (function (_super) {
1881
1865
  };
1882
1866
  CreatorSurveyPageComponent.prototype.componentDidMount = function () {
1883
1867
  _super.prototype.componentDidMount.call(this);
1884
- if (!!this.rootRef.current) {
1885
- this.model.rootElement = this.rootRef.current;
1886
- }
1868
+ this.model.attachToUI(this.props.page, this.rootRef.current);
1887
1869
  };
1888
1870
  CreatorSurveyPageComponent.prototype.componentWillUnmount = function () {
1889
1871
  _super.prototype.componentWillUnmount.call(this);
1890
- this.model.dispose();
1872
+ this.model.detachFromUI();
1891
1873
  };
1892
1874
  CreatorSurveyPageComponent.prototype.canRender = function () {
1893
1875
  return (!!this.model &&
@@ -1899,9 +1881,11 @@ var CreatorSurveyPageComponent = /** @class */ (function (_super) {
1899
1881
  var _this = this;
1900
1882
  if (!this.props.page)
1901
1883
  return null;
1902
- return ((0,survey_react_ui__WEBPACK_IMPORTED_MODULE_2__.attachKey2click)(react__WEBPACK_IMPORTED_MODULE_1__.createElement("div", { ref: this.rootRef, className: "svc-page__content " + this.model.css, id: this.props.page.id, onClick: function (e) {
1884
+ return ((0,survey_react_ui__WEBPACK_IMPORTED_MODULE_2__.attachKey2click)(react__WEBPACK_IMPORTED_MODULE_1__.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: function (e) {
1903
1885
  return _this.model.select(_this.model, new _events__WEBPACK_IMPORTED_MODULE_5__.ReactMouseEvent(e));
1904
1886
  }, onDoubleClick: function (e) { return _this.model.dblclick(e.nativeEvent); }, onMouseLeave: function (e) { return _this.model.hover(e.nativeEvent, e.currentTarget); }, onMouseOver: function (e) { return _this.model.hover(e.nativeEvent, e.currentTarget); } },
1887
+ react__WEBPACK_IMPORTED_MODULE_1__.createElement("div", { className: "svc-question__drop-indicator svc-question__drop-indicator--top" }),
1888
+ react__WEBPACK_IMPORTED_MODULE_1__.createElement("div", { className: "svc-question__drop-indicator svc-question__drop-indicator--bottom" }),
1905
1889
  this.renderHeader(),
1906
1890
  this.renderContent(),
1907
1891
  this.renderPlaceholder(),
@@ -1918,8 +1902,15 @@ var CreatorSurveyPageComponent = /** @class */ (function (_super) {
1918
1902
  return (react__WEBPACK_IMPORTED_MODULE_1__.createElement(survey_react_ui__WEBPACK_IMPORTED_MODULE_2__.SurveyPage, { page: this.props.page, survey: this.props.survey, creator: this.props.creator, css: this.model.css }));
1919
1903
  };
1920
1904
  CreatorSurveyPageComponent.prototype.renderHeader = function () {
1921
- return (react__WEBPACK_IMPORTED_MODULE_1__.createElement("div", { className: "svc-page__content-actions" },
1905
+ var _this = this;
1906
+ var actions = (react__WEBPACK_IMPORTED_MODULE_1__.createElement("div", { className: "svc-page__content-actions" },
1922
1907
  react__WEBPACK_IMPORTED_MODULE_1__.createElement(survey_react_ui__WEBPACK_IMPORTED_MODULE_2__.SurveyActionBar, { model: this.model.actionContainer })));
1908
+ if (this.model.isGhost || !this.model.allowDragging) {
1909
+ return actions;
1910
+ }
1911
+ return (react__WEBPACK_IMPORTED_MODULE_1__.createElement("div", { className: "svc-question__drag-area", onPointerDown: function (event) { return _this.model.onPointerDown(event); } },
1912
+ react__WEBPACK_IMPORTED_MODULE_1__.createElement(survey_react_ui__WEBPACK_IMPORTED_MODULE_2__.SvgIcon, { className: "svc-question__drag-element", size: 24, iconName: "icon-drag-area-indicator_24x16" }),
1913
+ actions));
1923
1914
  };
1924
1915
  CreatorSurveyPageComponent.prototype.renderFooter = function () {
1925
1916
  return react__WEBPACK_IMPORTED_MODULE_1__.createElement(survey_react_ui__WEBPACK_IMPORTED_MODULE_2__.SurveyActionBar, { model: this.model.footerActionsBar });
@@ -2031,10 +2022,12 @@ var QuestionAdornerComponent = /** @class */ (function (_super) {
2031
2022
  return _this;
2032
2023
  }
2033
2024
  QuestionAdornerComponent.prototype.createModel = function (props) {
2034
- if (this.modelValue) {
2035
- this.modelValue.dispose();
2025
+ if (this.model) {
2026
+ this.model.attachToUI(props.question, this.rootRef.current);
2027
+ }
2028
+ else {
2029
+ this.modelValue = this.createQuestionViewModel(props);
2036
2030
  }
2037
- this.modelValue = this.createQuestionViewModel(props);
2038
2031
  };
2039
2032
  QuestionAdornerComponent.prototype.createQuestionViewModel = function (props) {
2040
2033
  return new survey_creator_core__WEBPACK_IMPORTED_MODULE_1__.QuestionAdornerViewModel(props.componentData, props.question, null);
@@ -2052,9 +2045,6 @@ var QuestionAdornerComponent = /** @class */ (function (_super) {
2052
2045
  QuestionAdornerComponent.prototype.getStateElement = function () {
2053
2046
  return this.model;
2054
2047
  };
2055
- QuestionAdornerComponent.prototype.canRender = function () {
2056
- return _super.prototype.canRender.call(this) && !this.model.isDragged;
2057
- };
2058
2048
  QuestionAdornerComponent.prototype.renderElement = function () {
2059
2049
  var _this = this;
2060
2050
  var allowInteractions = this.model.element
@@ -2111,14 +2101,7 @@ var QuestionAdornerComponent = /** @class */ (function (_super) {
2111
2101
  };
2112
2102
  QuestionAdornerComponent.prototype.componentDidMount = function () {
2113
2103
  _super.prototype.componentDidMount.call(this);
2114
- this.model.rootElement = this.rootRef.current;
2115
- };
2116
- QuestionAdornerComponent.prototype.componentDidUpdate = function (prevProps, prevState) {
2117
- var _a;
2118
- _super.prototype.componentDidUpdate.call(this, prevProps, prevState);
2119
- if (((_a = this.rootRef) === null || _a === void 0 ? void 0 : _a.current) && this.modelValue) {
2120
- this.modelValue.rootElement = this.rootRef.current;
2121
- }
2104
+ this.model.attachToUI(this.props.question, this.rootRef.current);
2122
2105
  };
2123
2106
  QuestionAdornerComponent.prototype.renderElementPlaceholder = function () {
2124
2107
  if (!this.model.isEmptyElement) {
@@ -2129,9 +2112,8 @@ var QuestionAdornerComponent = /** @class */ (function (_super) {
2129
2112
  react__WEBPACK_IMPORTED_MODULE_2__.createElement("div", { className: "svc-panel__placeholder" }, this.model.placeholderText))));
2130
2113
  };
2131
2114
  QuestionAdornerComponent.prototype.componentWillUnmount = function () {
2132
- if (this.model) {
2133
- this.model.dispose();
2134
- }
2115
+ _super.prototype.componentWillUnmount.call(this);
2116
+ this.model.detachFromUI();
2135
2117
  };
2136
2118
  return QuestionAdornerComponent;
2137
2119
  }(_ModelElement__WEBPACK_IMPORTED_MODULE_5__.CreatorModelElement));
@@ -2688,12 +2670,13 @@ var SurveyQuestionBooleanSwitch = /** @class */ (function (_super) {
2688
2670
  }
2689
2671
  SurveyQuestionBooleanSwitch.prototype.renderElement = function () {
2690
2672
  var _this = this;
2673
+ var button = (0,survey_react_ui__WEBPACK_IMPORTED_MODULE_3__.attachKey2click)(react__WEBPACK_IMPORTED_MODULE_1__.createElement("div", { className: "spg-boolean-switch__button" + (this.questionBase.value ? " spg-boolean-switch__button--checked" : ""), tabIndex: 0, role: "checkbox", "aria-required": this.questionBase.ariaRequired, "aria-label": this.questionBase.ariaLabel, "aria-invalid": this.questionBase.ariaInvalid, "aria-errormessage": this.questionBase.ariaErrormessage },
2674
+ react__WEBPACK_IMPORTED_MODULE_1__.createElement("div", { className: "spg-boolean-switch__thumb" },
2675
+ react__WEBPACK_IMPORTED_MODULE_1__.createElement("div", { className: "spg-boolean-switch__thumb-circle spg-boolean-switch__thumb--left" })),
2676
+ react__WEBPACK_IMPORTED_MODULE_1__.createElement("div", { className: "spg-boolean-switch__thumb" },
2677
+ react__WEBPACK_IMPORTED_MODULE_1__.createElement("div", { className: "spg-boolean-switch__thumb-circle spg-boolean-switch__thumb--right" }))), this.questionBase, { processEsc: false });
2691
2678
  return (react__WEBPACK_IMPORTED_MODULE_1__.createElement("div", { className: "spg-boolean-switch", onClick: function () { return _this.questionBase.value = !_this.questionBase.value; } },
2692
- react__WEBPACK_IMPORTED_MODULE_1__.createElement("div", { className: "spg-boolean-switch__button" + (this.questionBase.value ? " spg-boolean-switch__button--checked" : ""), tabIndex: 0, role: "checkbox", "aria-required": this.questionBase.ariaRequired, "aria-label": this.questionBase.ariaLabel, "aria-invalid": this.questionBase.ariaInvalid, "aria-errormessage": this.questionBase.ariaErrormessage },
2693
- react__WEBPACK_IMPORTED_MODULE_1__.createElement("div", { className: "spg-boolean-switch__thumb" },
2694
- react__WEBPACK_IMPORTED_MODULE_1__.createElement("div", { className: "spg-boolean-switch__thumb-circle spg-boolean-switch__thumb--left" })),
2695
- react__WEBPACK_IMPORTED_MODULE_1__.createElement("div", { className: "spg-boolean-switch__thumb" },
2696
- react__WEBPACK_IMPORTED_MODULE_1__.createElement("div", { className: "spg-boolean-switch__thumb-circle spg-boolean-switch__thumb--right" }))),
2679
+ button,
2697
2680
  react__WEBPACK_IMPORTED_MODULE_1__.createElement("div", { className: "spg-boolean-switch__caption" },
2698
2681
  react__WEBPACK_IMPORTED_MODULE_1__.createElement("div", { className: "spg-boolean-switch__title" }, survey_react_ui__WEBPACK_IMPORTED_MODULE_3__.SurveyElementBase.renderLocString(this.questionBase.locTitle)))));
2699
2682
  };
@@ -5459,7 +5442,7 @@ __webpack_require__.r(__webpack_exports__);
5459
5442
  /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_64__ = __webpack_require__(/*! survey-core */ "survey-core");
5460
5443
  /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_64___default = /*#__PURE__*/__webpack_require__.n(survey_core__WEBPACK_IMPORTED_MODULE_64__);
5461
5444
  var Version;
5462
- Version = "".concat("1.12.5");
5445
+ Version = "".concat("1.12.6");
5463
5446
  // import "@survey/creator/survey-creator-core.css";
5464
5447
 
5465
5448
 
@@ -5533,7 +5516,7 @@ Version = "".concat("1.12.5");
5533
5516
 
5534
5517
 
5535
5518
 
5536
- (0,survey_core__WEBPACK_IMPORTED_MODULE_64__.checkLibraryVersion)("".concat("1.12.5"), "survey-creator-react");
5519
+ (0,survey_core__WEBPACK_IMPORTED_MODULE_64__.checkLibraryVersion)("".concat("1.12.6"), "survey-creator-react");
5537
5520
 
5538
5521
  })();
5539
5522