survey-js-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-js-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",
@@ -23,7 +23,7 @@
23
23
  "typings": "./typings/src/entries/js-ui.d.ts",
24
24
  "dependencies": {},
25
25
  "peerDependencies": {
26
- "survey-core": "1.12.1",
26
+ "survey-core": "1.12.2",
27
27
  "@types/react-dom": "*",
28
28
  "@types/react": "*"
29
29
  }
package/survey-js-ui.js CHANGED
@@ -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
  */
@@ -102,9 +102,9 @@ return /******/ (function(modules) { // webpackBootstrap
102
102
  /******/ ({
103
103
 
104
104
  /***/ "./src/entries/js-ui.ts":
105
- /*!*******************************************!*\
106
- !*** ./src/entries/js-ui.ts + 99 modules ***!
107
- \*******************************************/
105
+ /*!********************************************!*\
106
+ !*** ./src/entries/js-ui.ts + 100 modules ***!
107
+ \********************************************/
108
108
  /*! exports provided: useState, useId, useReducer, useEffect, useLayoutEffect, useInsertionEffect, useTransition, useDeferredValue, useSyncExternalStore, startTransition, useRef, useImperativeHandle, useMemo, useCallback, useContext, useDebugValue, version, Children, render, hydrate, unmountComponentAtNode, createPortal, createElement, createContext, createFactory, cloneElement, createRef, Fragment, isValidElement, isFragment, isMemo, findDOMNode, Component, PureComponent, memo, forwardRef, flushSync, unstable_batchedUpdates, StrictMode, Suspense, SuspenseList, lazy, renderSurvey, renderPopupSurvey, preact, 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, settings, surveyLocalization, surveyStrings, Model */
109
109
  /*! ModuleConcatenation bailout: Cannot concat with external {"root":"Survey","commonjs2":"survey-core","commonjs":"survey-core","amd":"survey-core"} (<- Module is not an ECMAScript module) */
110
110
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
@@ -1751,28 +1751,27 @@ var title_content_TitleContent = /** @class */ (function (_super) {
1751
1751
  };
1752
1752
  var spans = [];
1753
1753
  if (element.isRequireTextOnStart) {
1754
- spans.push(this.renderRequireText(element, cssClasses));
1754
+ spans.push(this.renderRequireText(element));
1755
1755
  spans.push(getSpaceSpan("req-sp"));
1756
1756
  }
1757
1757
  var questionNumber = element.no;
1758
1758
  if (questionNumber) {
1759
- var panelNumber = !!cssClasses.panel ? cssClasses.panel.number : undefined;
1760
- spans.push(Rn.createElement("span", { "data-key": "q_num", key: "q_num", className: cssClasses.number || panelNumber, style: { position: "static" }, "aria-hidden": true }, questionNumber));
1759
+ spans.push(Rn.createElement("span", { "data-key": "q_num", key: "q_num", className: element.cssTitleNumber, style: { position: "static" }, "aria-hidden": true }, questionNumber));
1761
1760
  spans.push(getSpaceSpan("num-sp"));
1762
1761
  }
1763
1762
  if (element.isRequireTextBeforeTitle) {
1764
- spans.push(this.renderRequireText(element, cssClasses));
1763
+ spans.push(this.renderRequireText(element));
1765
1764
  spans.push(getSpaceSpan("req-sp"));
1766
1765
  }
1767
1766
  spans.push(reactquestion_element_SurveyElementBase.renderLocString(element.locTitle, null, "q_title"));
1768
1767
  if (element.isRequireTextAfterTitle) {
1769
1768
  spans.push(getSpaceSpan("req-sp"));
1770
- spans.push(this.renderRequireText(element, cssClasses));
1769
+ spans.push(this.renderRequireText(element));
1771
1770
  }
1772
1771
  return spans;
1773
1772
  };
1774
- TitleContent.prototype.renderRequireText = function (element, cssClasses) {
1775
- return (Rn.createElement("span", { "data-key": "req-text", key: "req-text", className: cssClasses.requiredText || cssClasses.panel.requiredText, "aria-hidden": true }, element.requiredText));
1773
+ TitleContent.prototype.renderRequireText = function (element) {
1774
+ return (Rn.createElement("span", { "data-key": "req-text", key: "req-text", className: element.cssRequiredText, "aria-hidden": true }, element.requiredText));
1776
1775
  };
1777
1776
  return TitleContent;
1778
1777
  }(Rn.Component));
@@ -1948,6 +1947,56 @@ ReactElementFactory.Instance.registerElement("sv-character-counter", function (p
1948
1947
  return Rn.createElement(character_counter_CharacterCounterComponent, props);
1949
1948
  });
1950
1949
 
1950
+ // CONCATENATED MODULE: ./packages/survey-react-ui/src/components/text-area.tsx
1951
+ var text_area_extends = (undefined && undefined.__extends) || (function () {
1952
+ var extendStatics = function (d, b) {
1953
+ extendStatics = Object.setPrototypeOf ||
1954
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
1955
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
1956
+ return extendStatics(d, b);
1957
+ };
1958
+ return function (d, b) {
1959
+ if (typeof b !== "function" && b !== null)
1960
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
1961
+ extendStatics(d, b);
1962
+ function __() { this.constructor = d; }
1963
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
1964
+ };
1965
+ })();
1966
+
1967
+
1968
+
1969
+ var text_area_TextAreaComponent = /** @class */ (function (_super) {
1970
+ text_area_extends(TextAreaComponent, _super);
1971
+ function TextAreaComponent(props) {
1972
+ var _this = _super.call(this, props) || this;
1973
+ _this.initialValue = _this.viewModel.getTextValue() || "";
1974
+ return _this;
1975
+ }
1976
+ Object.defineProperty(TextAreaComponent.prototype, "viewModel", {
1977
+ get: function () {
1978
+ return this.props.viewModel;
1979
+ },
1980
+ enumerable: false,
1981
+ configurable: true
1982
+ });
1983
+ TextAreaComponent.prototype.canRender = function () {
1984
+ return !!this.viewModel.question;
1985
+ };
1986
+ TextAreaComponent.prototype.renderElement = function () {
1987
+ var _this = this;
1988
+ return (Rn.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 } }));
1989
+ };
1990
+ TextAreaComponent.prototype.componentWillUnmount = function () {
1991
+ this.viewModel.dispose();
1992
+ };
1993
+ return TextAreaComponent;
1994
+ }(reactquestion_element_SurveyElementBase));
1995
+
1996
+ ReactElementFactory.Instance.registerElement("sv-text-area", function (props) {
1997
+ return Rn.createElement(text_area_TextAreaComponent, props);
1998
+ });
1999
+
1951
2000
  // CONCATENATED MODULE: ./packages/survey-react-ui/src/reactquestion_comment.tsx
1952
2001
  var reactquestion_comment_extends = (undefined && undefined.__extends) || (function () {
1953
2002
  var extendStatics = function (d, b) {
@@ -1974,31 +2023,21 @@ var reactquestion_comment_SurveyQuestionComment = /** @class */ (function (_supe
1974
2023
  function SurveyQuestionComment(props) {
1975
2024
  return _super.call(this, props) || this;
1976
2025
  }
2026
+ SurveyQuestionComment.prototype.renderCharacterCounter = function () {
2027
+ var counter = null;
2028
+ if (!!this.question.getMaxLength()) {
2029
+ counter = preact_module_(character_counter_CharacterCounterComponent, { counter: this.question.characterCounter, remainingCharacterCounter: this.question.cssClasses.remainingCharacterCounter });
2030
+ }
2031
+ return counter;
2032
+ };
1977
2033
  SurveyQuestionComment.prototype.renderElement = function () {
1978
- var _this = this;
1979
- var onBlur = function (e) {
1980
- if (!_this.question.isInputTextUpdate) {
1981
- _this.updateValueOnEvent(e);
1982
- }
1983
- _this.question.onBlur(e);
1984
- };
1985
- var onInput = function (event) {
1986
- if (_this.question.isInputTextUpdate) {
1987
- _this.updateValueOnEvent(event);
1988
- }
1989
- else {
1990
- _this.question.updateElement();
1991
- }
1992
- var newValue = event.target.value;
1993
- _this.question.updateRemainingCharacterCounter(newValue);
1994
- };
1995
- var placeholder = this.question.renderedPlaceholder;
1996
2034
  if (this.question.isReadOnlyRenderDiv()) {
1997
2035
  return preact_module_("div", null, this.question.value);
1998
2036
  }
1999
- var counter = !!this.question.getMaxLength() ? (preact_module_(character_counter_CharacterCounterComponent, { counter: this.question.characterCounter, remainingCharacterCounter: this.question.cssClasses.remainingCharacterCounter })) : null;
2037
+ var counter = this.renderCharacterCounter();
2038
+ var textAreaModel = this.props.question.textAreaModel;
2000
2039
  return (preact_module_(k, null,
2001
- preact_module_("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 } }),
2040
+ preact_module_(text_area_TextAreaComponent, { viewModel: textAreaModel }),
2002
2041
  counter));
2003
2042
  };
2004
2043
  return SurveyQuestionComment;
@@ -2008,61 +2047,22 @@ var reactquestion_comment_SurveyQuestionCommentItem = /** @class */ (function (_
2008
2047
  reactquestion_comment_extends(SurveyQuestionCommentItem, _super);
2009
2048
  function SurveyQuestionCommentItem(props) {
2010
2049
  var _this = _super.call(this, props) || this;
2011
- _this.state = { comment: _this.getComment() || "" };
2050
+ _this.textAreaModel = _this.getTextAreaModel();
2012
2051
  return _this;
2013
2052
  }
2014
- SurveyQuestionCommentItem.prototype.componentDidUpdate = function (prevProps, prevState) {
2015
- _super.prototype.componentDidUpdate.call(this, prevProps, prevState);
2016
- this.updateDomElement();
2017
- };
2018
- SurveyQuestionCommentItem.prototype.componentDidMount = function () {
2019
- _super.prototype.componentDidMount.call(this);
2020
- this.updateDomElement();
2021
- };
2022
- SurveyQuestionCommentItem.prototype.updateDomElement = function () {
2023
- if (!!this.control) {
2024
- var control = this.control;
2025
- var newValue = this.getComment() || "";
2026
- if (!external_root_Survey_commonjs2_survey_core_commonjs_survey_core_amd_survey_core_["Helpers"].isTwoValueEquals(newValue, control.value, false, true, false)) {
2027
- control.value = newValue;
2028
- }
2029
- }
2030
- };
2031
- SurveyQuestionCommentItem.prototype.setControl = function (element) {
2032
- if (!!element) {
2033
- this.control = element;
2034
- }
2035
- };
2036
2053
  SurveyQuestionCommentItem.prototype.canRender = function () {
2037
2054
  return !!this.props.question;
2038
2055
  };
2039
- SurveyQuestionCommentItem.prototype.onCommentChange = function (event) {
2040
- this.props.question.onCommentChange(event);
2041
- };
2042
- SurveyQuestionCommentItem.prototype.onCommentInput = function (event) {
2043
- this.props.question.onCommentInput(event);
2044
- };
2045
- SurveyQuestionCommentItem.prototype.getComment = function () {
2046
- return this.props.question.comment;
2047
- };
2048
- SurveyQuestionCommentItem.prototype.setComment = function (value) {
2049
- this.props.question.comment = value;
2050
- };
2051
- SurveyQuestionCommentItem.prototype.getId = function () {
2052
- return this.props.question.commentId;
2053
- };
2054
- SurveyQuestionCommentItem.prototype.getPlaceholder = function () {
2055
- return this.props.question.renderedCommentPlaceholder;
2056
+ SurveyQuestionCommentItem.prototype.getTextAreaModel = function () {
2057
+ return this.props.question.commentTextAreaModel;
2056
2058
  };
2057
2059
  SurveyQuestionCommentItem.prototype.renderElement = function () {
2058
- var _this = this;
2059
2060
  var question = this.props.question;
2060
- var className = this.props.otherCss || this.cssClasses.comment;
2061
2061
  if (question.isReadOnlyRenderDiv()) {
2062
- var comment = this.getComment() || "";
2062
+ var comment = this.textAreaModel.getTextValue() || "";
2063
2063
  return preact_module_("div", null, comment);
2064
2064
  }
2065
- return (preact_module_("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 } }));
2065
+ return (preact_module_(text_area_TextAreaComponent, { viewModel: this.textAreaModel }));
2066
2066
  };
2067
2067
  return SurveyQuestionCommentItem;
2068
2068
  }(ReactSurveyElement));
@@ -2072,23 +2072,8 @@ var SurveyQuestionOtherValueItem = /** @class */ (function (_super) {
2072
2072
  function SurveyQuestionOtherValueItem() {
2073
2073
  return _super !== null && _super.apply(this, arguments) || this;
2074
2074
  }
2075
- SurveyQuestionOtherValueItem.prototype.onCommentChange = function (event) {
2076
- this.props.question.onOtherValueChange(event);
2077
- };
2078
- SurveyQuestionOtherValueItem.prototype.onCommentInput = function (event) {
2079
- this.props.question.onOtherValueInput(event);
2080
- };
2081
- SurveyQuestionOtherValueItem.prototype.getComment = function () {
2082
- return this.props.question.otherValue;
2083
- };
2084
- SurveyQuestionOtherValueItem.prototype.setComment = function (value) {
2085
- this.props.question.otherValue = value;
2086
- };
2087
- SurveyQuestionOtherValueItem.prototype.getId = function () {
2088
- return this.props.question.otherId;
2089
- };
2090
- SurveyQuestionOtherValueItem.prototype.getPlaceholder = function () {
2091
- return this.props.question.otherPlaceholder;
2075
+ SurveyQuestionOtherValueItem.prototype.getTextAreaModel = function () {
2076
+ return this.props.question.otherTextAreaModel;
2092
2077
  };
2093
2078
  return SurveyQuestionOtherValueItem;
2094
2079
  }(reactquestion_comment_SurveyQuestionCommentItem));
@@ -9397,7 +9382,7 @@ var preact = compat_module_namespaceObject;
9397
9382
 
9398
9383
 
9399
9384
 
9400
- Object(external_root_Survey_commonjs2_survey_core_commonjs_survey_core_amd_survey_core_["checkLibraryVersion"])("" + "1.12.1", "survey-js-ui");
9385
+ Object(external_root_Survey_commonjs2_survey_core_commonjs_survey_core_amd_survey_core_["checkLibraryVersion"])("" + "1.12.2", "survey-js-ui");
9401
9386
 
9402
9387
 
9403
9388
  /***/ }),