survey-react-ui 1.12.1 → 1.12.2

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-react-ui",
3
- "version": "1.12.1",
3
+ "version": "1.12.2",
4
4
  "description": "survey.js is a JavaScript Survey Library. It is a modern way to add a survey to your website. It uses JSON for survey metadata and results.",
5
5
  "keywords": [
6
6
  "Survey",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "typings": "./typings/src/entries/react-ui.d.ts",
23
23
  "peerDependencies": {
24
- "survey-core": "1.12.1",
24
+ "survey-core": "1.12.2",
25
25
  "react": "^16.5.0 || ^17.0.1 || ^18.2.0",
26
26
  "react-dom": "^16.5.0 || ^17.0.1 || ^18.2.0"
27
27
  }
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - Survey JavaScript library v1.12.1
2
+ * surveyjs - Survey JavaScript library v1.12.2
3
3
  * Copyright (c) 2015-2024 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
5
5
  */
@@ -103,7 +103,7 @@ return /******/ (function(modules) { // webpackBootstrap
103
103
 
104
104
  /***/ "./src/entries/react-ui.ts":
105
105
  /*!**********************************************!*\
106
- !*** ./src/entries/react-ui.ts + 95 modules ***!
106
+ !*** ./src/entries/react-ui.ts + 96 modules ***!
107
107
  \**********************************************/
108
108
  /*! exports provided: Survey, attachKey2click, ReactSurveyElementsWrapper, SurveyNavigationBase, SurveyTimerPanel, SurveyPage, SurveyRow, SurveyPanel, SurveyFlowPanel, SurveyQuestion, SurveyElementErrors, SurveyQuestionAndErrorsCell, ReactSurveyElement, SurveyElementBase, SurveyQuestionElementBase, SurveyQuestionCommentItem, SurveyQuestionComment, SurveyQuestionCheckbox, SurveyQuestionCheckboxItem, SurveyQuestionRanking, SurveyQuestionRankingItem, SurveyQuestionRankingItemContent, RatingItem, RatingItemStar, RatingItemSmiley, RatingDropdownItem, TagboxFilterString, SurveyQuestionOptionItem, SurveyQuestionDropdownBase, SurveyQuestionDropdown, SurveyQuestionTagboxItem, SurveyQuestionTagbox, SurveyQuestionDropdownSelect, SurveyQuestionMatrix, SurveyQuestionMatrixRow, SurveyQuestionMatrixCell, SurveyQuestionHtml, SurveyQuestionFile, SurveyFileChooseButton, SurveyFilePreview, SurveyQuestionMultipleText, SurveyQuestionRadiogroup, SurveyQuestionRadioItem, SurveyQuestionText, SurveyQuestionBoolean, SurveyQuestionBooleanCheckbox, SurveyQuestionBooleanRadio, SurveyQuestionEmpty, SurveyQuestionMatrixDropdownCell, SurveyQuestionMatrixDropdownBase, SurveyQuestionMatrixDropdown, SurveyQuestionMatrixDynamic, SurveyQuestionMatrixDynamicAddButton, SurveyQuestionPanelDynamic, SurveyProgress, SurveyProgressButtons, SurveyProgressToc, SurveyQuestionRating, SurveyQuestionRatingDropdown, SurveyQuestionExpression, PopupSurvey, SurveyWindow, ReactQuestionFactory, ReactElementFactory, SurveyQuestionImagePicker, SurveyQuestionImage, SurveyQuestionSignaturePad, SurveyQuestionButtonGroup, SurveyQuestionCustom, SurveyQuestionComposite, Popup, ListItemContent, ListItemGroup, List, TitleActions, TitleElement, SurveyActionBar, LogoImage, SurveyHeader, SvgIcon, SurveyQuestionMatrixDynamicRemoveButton, SurveyQuestionMatrixDetailButton, SurveyQuestionMatrixDynamicDragDropIcon, SurveyQuestionPanelDynamicAddButton, SurveyQuestionPanelDynamicRemoveButton, SurveyQuestionPanelDynamicPrevButton, SurveyQuestionPanelDynamicNextButton, SurveyQuestionPanelDynamicProgressText, SurveyNavigationButton, QuestionErrorComponent, MatrixRow, Skeleton, NotifierComponent, ComponentsContainer, CharacterCounterComponent, HeaderMobile, HeaderCell, Header, SurveyLocStringViewer, SurveyLocStringEditor, LoadingIndicatorComponent, SvgBundleComponent, SurveyModel, SurveyWindowModel, Model, settings, surveyLocalization, surveyStrings */
109
109
  /*! ModuleConcatenation bailout: Cannot concat with external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"} (<- Module is not an ECMAScript module) */
@@ -1654,28 +1654,27 @@ var title_content_TitleContent = /** @class */ (function (_super) {
1654
1654
  };
1655
1655
  var spans = [];
1656
1656
  if (element.isRequireTextOnStart) {
1657
- spans.push(this.renderRequireText(element, cssClasses));
1657
+ spans.push(this.renderRequireText(element));
1658
1658
  spans.push(getSpaceSpan("req-sp"));
1659
1659
  }
1660
1660
  var questionNumber = element.no;
1661
1661
  if (questionNumber) {
1662
- var panelNumber = !!cssClasses.panel ? cssClasses.panel.number : undefined;
1663
- spans.push(external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", { "data-key": "q_num", key: "q_num", className: cssClasses.number || panelNumber, style: { position: "static" }, "aria-hidden": true }, questionNumber));
1662
+ spans.push(external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", { "data-key": "q_num", key: "q_num", className: element.cssTitleNumber, style: { position: "static" }, "aria-hidden": true }, questionNumber));
1664
1663
  spans.push(getSpaceSpan("num-sp"));
1665
1664
  }
1666
1665
  if (element.isRequireTextBeforeTitle) {
1667
- spans.push(this.renderRequireText(element, cssClasses));
1666
+ spans.push(this.renderRequireText(element));
1668
1667
  spans.push(getSpaceSpan("req-sp"));
1669
1668
  }
1670
1669
  spans.push(reactquestion_element_SurveyElementBase.renderLocString(element.locTitle, null, "q_title"));
1671
1670
  if (element.isRequireTextAfterTitle) {
1672
1671
  spans.push(getSpaceSpan("req-sp"));
1673
- spans.push(this.renderRequireText(element, cssClasses));
1672
+ spans.push(this.renderRequireText(element));
1674
1673
  }
1675
1674
  return spans;
1676
1675
  };
1677
- TitleContent.prototype.renderRequireText = function (element, cssClasses) {
1678
- return (external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", { "data-key": "req-text", key: "req-text", className: cssClasses.requiredText || cssClasses.panel.requiredText, "aria-hidden": true }, element.requiredText));
1676
+ TitleContent.prototype.renderRequireText = function (element) {
1677
+ return (external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", { "data-key": "req-text", key: "req-text", className: element.cssRequiredText, "aria-hidden": true }, element.requiredText));
1679
1678
  };
1680
1679
  return TitleContent;
1681
1680
  }(external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.Component));
@@ -1851,6 +1850,56 @@ ReactElementFactory.Instance.registerElement("sv-character-counter", function (p
1851
1850
  return external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(character_counter_CharacterCounterComponent, props);
1852
1851
  });
1853
1852
 
1853
+ // CONCATENATED MODULE: ./packages/survey-react-ui/src/components/text-area.tsx
1854
+ var text_area_extends = (undefined && undefined.__extends) || (function () {
1855
+ var extendStatics = function (d, b) {
1856
+ extendStatics = Object.setPrototypeOf ||
1857
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
1858
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
1859
+ return extendStatics(d, b);
1860
+ };
1861
+ return function (d, b) {
1862
+ if (typeof b !== "function" && b !== null)
1863
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
1864
+ extendStatics(d, b);
1865
+ function __() { this.constructor = d; }
1866
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
1867
+ };
1868
+ })();
1869
+
1870
+
1871
+
1872
+ var text_area_TextAreaComponent = /** @class */ (function (_super) {
1873
+ text_area_extends(TextAreaComponent, _super);
1874
+ function TextAreaComponent(props) {
1875
+ var _this = _super.call(this, props) || this;
1876
+ _this.initialValue = _this.viewModel.getTextValue() || "";
1877
+ return _this;
1878
+ }
1879
+ Object.defineProperty(TextAreaComponent.prototype, "viewModel", {
1880
+ get: function () {
1881
+ return this.props.viewModel;
1882
+ },
1883
+ enumerable: false,
1884
+ configurable: true
1885
+ });
1886
+ TextAreaComponent.prototype.canRender = function () {
1887
+ return !!this.viewModel.question;
1888
+ };
1889
+ TextAreaComponent.prototype.renderElement = function () {
1890
+ var _this = this;
1891
+ return (external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("textarea", { id: this.viewModel.id, className: this.viewModel.className, ref: function (textarea) { return (_this.viewModel.setElement(textarea)); }, disabled: this.viewModel.isDisabledAttr, readOnly: this.viewModel.isReadOnlyAttr, rows: this.viewModel.rows, cols: this.viewModel.cols, placeholder: this.viewModel.placeholder, maxLength: this.viewModel.maxLength, defaultValue: this.initialValue, onChange: function (event) { _this.viewModel.onTextAreaInput(event); }, onFocus: function (event) { _this.viewModel.onTextAreaFocus(event); }, onBlur: function (event) { _this.viewModel.onTextAreaBlur(event); }, onKeyDown: function (event) { _this.viewModel.onTextAreaKeyDown(event); }, "aria-required": this.viewModel.ariaRequired, "aria-label": this.viewModel.ariaLabel, "aria-labelledby": this.viewModel.ariaLabelledBy, "aria-describedby": this.viewModel.ariaDescribedBy, "aria-invalid": this.viewModel.ariaInvalid, "aria-errormessage": this.viewModel.ariaErrormessage, style: { resize: this.viewModel.question.resizeStyle } }));
1892
+ };
1893
+ TextAreaComponent.prototype.componentWillUnmount = function () {
1894
+ this.viewModel.dispose();
1895
+ };
1896
+ return TextAreaComponent;
1897
+ }(reactquestion_element_SurveyElementBase));
1898
+
1899
+ ReactElementFactory.Instance.registerElement("sv-text-area", function (props) {
1900
+ return external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(text_area_TextAreaComponent, props);
1901
+ });
1902
+
1854
1903
  // CONCATENATED MODULE: ./packages/survey-react-ui/src/reactquestion_comment.tsx
1855
1904
  var reactquestion_comment_extends = (undefined && undefined.__extends) || (function () {
1856
1905
  var extendStatics = function (d, b) {
@@ -1877,31 +1926,21 @@ var reactquestion_comment_SurveyQuestionComment = /** @class */ (function (_supe
1877
1926
  function SurveyQuestionComment(props) {
1878
1927
  return _super.call(this, props) || this;
1879
1928
  }
1929
+ SurveyQuestionComment.prototype.renderCharacterCounter = function () {
1930
+ var counter = null;
1931
+ if (!!this.question.getMaxLength()) {
1932
+ counter = external_root_React_commonjs2_react_commonjs_react_amd_react_["createElement"](character_counter_CharacterCounterComponent, { counter: this.question.characterCounter, remainingCharacterCounter: this.question.cssClasses.remainingCharacterCounter });
1933
+ }
1934
+ return counter;
1935
+ };
1880
1936
  SurveyQuestionComment.prototype.renderElement = function () {
1881
- var _this = this;
1882
- var onBlur = function (e) {
1883
- if (!_this.question.isInputTextUpdate) {
1884
- _this.updateValueOnEvent(e);
1885
- }
1886
- _this.question.onBlur(e);
1887
- };
1888
- var onInput = function (event) {
1889
- if (_this.question.isInputTextUpdate) {
1890
- _this.updateValueOnEvent(event);
1891
- }
1892
- else {
1893
- _this.question.updateElement();
1894
- }
1895
- var newValue = event.target.value;
1896
- _this.question.updateRemainingCharacterCounter(newValue);
1897
- };
1898
- var placeholder = this.question.renderedPlaceholder;
1899
1937
  if (this.question.isReadOnlyRenderDiv()) {
1900
1938
  return external_root_React_commonjs2_react_commonjs_react_amd_react_["createElement"]("div", null, this.question.value);
1901
1939
  }
1902
- var counter = !!this.question.getMaxLength() ? (external_root_React_commonjs2_react_commonjs_react_amd_react_["createElement"](character_counter_CharacterCounterComponent, { counter: this.question.characterCounter, remainingCharacterCounter: this.question.cssClasses.remainingCharacterCounter })) : null;
1940
+ var counter = this.renderCharacterCounter();
1941
+ var textAreaModel = this.props.question.textAreaModel;
1903
1942
  return (external_root_React_commonjs2_react_commonjs_react_amd_react_["createElement"](external_root_React_commonjs2_react_commonjs_react_amd_react_["Fragment"], null,
1904
- external_root_React_commonjs2_react_commonjs_react_amd_react_["createElement"]("textarea", { id: this.question.inputId, className: this.question.className, disabled: this.question.isDisabledAttr, readOnly: this.question.isReadOnlyAttr, ref: function (textarea) { return (_this.setControl(textarea)); }, maxLength: this.question.getMaxLength(), placeholder: placeholder, onFocus: function (event) { _this.question.onFocus(event); }, onBlur: onBlur, onInput: onInput, onKeyDown: function (event) { _this.question.onKeyDown(event); }, cols: this.question.cols, rows: this.question.rows, "aria-required": this.question.a11y_input_ariaRequired, "aria-label": this.question.a11y_input_ariaLabel, "aria-labelledby": this.question.a11y_input_ariaLabelledBy, "aria-describedby": this.question.a11y_input_ariaDescribedBy, "aria-invalid": this.question.a11y_input_ariaInvalid, "aria-errormessage": this.question.a11y_input_ariaErrormessage, style: { resize: this.question.resizeStyle } }),
1943
+ external_root_React_commonjs2_react_commonjs_react_amd_react_["createElement"](text_area_TextAreaComponent, { viewModel: textAreaModel }),
1905
1944
  counter));
1906
1945
  };
1907
1946
  return SurveyQuestionComment;
@@ -1911,61 +1950,22 @@ var reactquestion_comment_SurveyQuestionCommentItem = /** @class */ (function (_
1911
1950
  reactquestion_comment_extends(SurveyQuestionCommentItem, _super);
1912
1951
  function SurveyQuestionCommentItem(props) {
1913
1952
  var _this = _super.call(this, props) || this;
1914
- _this.state = { comment: _this.getComment() || "" };
1953
+ _this.textAreaModel = _this.getTextAreaModel();
1915
1954
  return _this;
1916
1955
  }
1917
- SurveyQuestionCommentItem.prototype.componentDidUpdate = function (prevProps, prevState) {
1918
- _super.prototype.componentDidUpdate.call(this, prevProps, prevState);
1919
- this.updateDomElement();
1920
- };
1921
- SurveyQuestionCommentItem.prototype.componentDidMount = function () {
1922
- _super.prototype.componentDidMount.call(this);
1923
- this.updateDomElement();
1924
- };
1925
- SurveyQuestionCommentItem.prototype.updateDomElement = function () {
1926
- if (!!this.control) {
1927
- var control = this.control;
1928
- var newValue = this.getComment() || "";
1929
- if (!external_root_Survey_commonjs2_survey_core_commonjs_survey_core_amd_survey_core_["Helpers"].isTwoValueEquals(newValue, control.value, false, true, false)) {
1930
- control.value = newValue;
1931
- }
1932
- }
1933
- };
1934
- SurveyQuestionCommentItem.prototype.setControl = function (element) {
1935
- if (!!element) {
1936
- this.control = element;
1937
- }
1938
- };
1939
1956
  SurveyQuestionCommentItem.prototype.canRender = function () {
1940
1957
  return !!this.props.question;
1941
1958
  };
1942
- SurveyQuestionCommentItem.prototype.onCommentChange = function (event) {
1943
- this.props.question.onCommentChange(event);
1944
- };
1945
- SurveyQuestionCommentItem.prototype.onCommentInput = function (event) {
1946
- this.props.question.onCommentInput(event);
1947
- };
1948
- SurveyQuestionCommentItem.prototype.getComment = function () {
1949
- return this.props.question.comment;
1950
- };
1951
- SurveyQuestionCommentItem.prototype.setComment = function (value) {
1952
- this.props.question.comment = value;
1953
- };
1954
- SurveyQuestionCommentItem.prototype.getId = function () {
1955
- return this.props.question.commentId;
1956
- };
1957
- SurveyQuestionCommentItem.prototype.getPlaceholder = function () {
1958
- return this.props.question.renderedCommentPlaceholder;
1959
+ SurveyQuestionCommentItem.prototype.getTextAreaModel = function () {
1960
+ return this.props.question.commentTextAreaModel;
1959
1961
  };
1960
1962
  SurveyQuestionCommentItem.prototype.renderElement = function () {
1961
- var _this = this;
1962
1963
  var question = this.props.question;
1963
- var className = this.props.otherCss || this.cssClasses.comment;
1964
1964
  if (question.isReadOnlyRenderDiv()) {
1965
- var comment = this.getComment() || "";
1965
+ var comment = this.textAreaModel.getTextValue() || "";
1966
1966
  return external_root_React_commonjs2_react_commonjs_react_amd_react_["createElement"]("div", null, comment);
1967
1967
  }
1968
- return (external_root_React_commonjs2_react_commonjs_react_amd_react_["createElement"]("textarea", { id: this.getId(), className: className, ref: function (textarea) { return (_this.setControl(textarea)); }, disabled: this.isDisplayMode, maxLength: question.getOthersMaxLength(), rows: question.commentAreaRows, placeholder: this.getPlaceholder(), onBlur: function (e) { _this.onCommentChange(e); }, onInput: function (e) { return _this.onCommentInput(e); }, "aria-required": question.isRequired || question.a11y_input_ariaRequired, "aria-label": question.ariaLabel || question.a11y_input_ariaLabel, style: { resize: question.resizeStyle } }));
1968
+ return (external_root_React_commonjs2_react_commonjs_react_amd_react_["createElement"](text_area_TextAreaComponent, { viewModel: this.textAreaModel }));
1969
1969
  };
1970
1970
  return SurveyQuestionCommentItem;
1971
1971
  }(ReactSurveyElement));
@@ -1975,23 +1975,8 @@ var SurveyQuestionOtherValueItem = /** @class */ (function (_super) {
1975
1975
  function SurveyQuestionOtherValueItem() {
1976
1976
  return _super !== null && _super.apply(this, arguments) || this;
1977
1977
  }
1978
- SurveyQuestionOtherValueItem.prototype.onCommentChange = function (event) {
1979
- this.props.question.onOtherValueChange(event);
1980
- };
1981
- SurveyQuestionOtherValueItem.prototype.onCommentInput = function (event) {
1982
- this.props.question.onOtherValueInput(event);
1983
- };
1984
- SurveyQuestionOtherValueItem.prototype.getComment = function () {
1985
- return this.props.question.otherValue;
1986
- };
1987
- SurveyQuestionOtherValueItem.prototype.setComment = function (value) {
1988
- this.props.question.otherValue = value;
1989
- };
1990
- SurveyQuestionOtherValueItem.prototype.getId = function () {
1991
- return this.props.question.otherId;
1992
- };
1993
- SurveyQuestionOtherValueItem.prototype.getPlaceholder = function () {
1994
- return this.props.question.otherPlaceholder;
1978
+ SurveyQuestionOtherValueItem.prototype.getTextAreaModel = function () {
1979
+ return this.props.question.otherTextAreaModel;
1995
1980
  };
1996
1981
  return SurveyQuestionOtherValueItem;
1997
1982
  }(reactquestion_comment_SurveyQuestionCommentItem));
@@ -9228,7 +9213,7 @@ ReactElementFactory.Instance.registerElement(external_root_Survey_commonjs2_surv
9228
9213
 
9229
9214
 
9230
9215
 
9231
- Object(external_root_Survey_commonjs2_survey_core_commonjs_survey_core_amd_survey_core_["checkLibraryVersion"])("" + "1.12.1", "survey-react-ui");
9216
+ Object(external_root_Survey_commonjs2_survey_core_commonjs_survey_core_amd_survey_core_["checkLibraryVersion"])("" + "1.12.2", "survey-react-ui");
9232
9217
 
9233
9218
 
9234
9219
  /***/ }),