survey-react-ui 1.9.123 → 1.9.125

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.9.123",
3
+ "version": "1.9.125",
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",
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * surveyjs - Survey JavaScript library v1.9.123
3
- * Copyright (c) 2015-2023 Devsoft Baltic OÜ - http://surveyjs.io/
2
+ * surveyjs - Survey JavaScript library v1.9.125
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
  */
6
6
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -484,6 +484,13 @@ var Base = /** @class */ (function () {
484
484
  enumerable: false,
485
485
  configurable: true
486
486
  });
487
+ Object.defineProperty(Base.prototype, "isDesignModeV2", {
488
+ get: function () {
489
+ return _settings__WEBPACK_IMPORTED_MODULE_3__["settings"].supportCreatorV2 && this.isDesignMode;
490
+ },
491
+ enumerable: false,
492
+ configurable: true
493
+ });
487
494
  Object.defineProperty(Base.prototype, "inSurvey", {
488
495
  /**
489
496
  * Returns `true` if the object is included in a survey.
@@ -659,6 +666,7 @@ var Base = /** @class */ (function () {
659
666
  Base.prototype.resetPropertyValue = function (name) {
660
667
  var locStr = this.localizableStrings ? this.localizableStrings[name] : undefined;
661
668
  if (locStr) {
669
+ this.setLocalizableStringText(name, undefined);
662
670
  locStr.clear();
663
671
  }
664
672
  else {
@@ -951,8 +959,8 @@ var Base = /** @class */ (function () {
951
959
  Base.prototype.createCustomLocalizableObj = function (name) {
952
960
  var locStr = this.getLocalizableString(name);
953
961
  if (locStr)
954
- return;
955
- this.createLocalizableString(name, this, false, true);
962
+ return locStr;
963
+ return this.createLocalizableString(name, this, false, true);
956
964
  };
957
965
  Base.prototype.getLocale = function () {
958
966
  var locOwner = this.getSurvey();
@@ -1993,7 +2001,7 @@ __webpack_require__.r(__webpack_exports__);
1993
2001
  /*!***************************************!*\
1994
2002
  !*** ./src/entries/react-ui-model.ts ***!
1995
2003
  \***************************************/
1996
- /*! exports provided: Survey, attachKey2click, ReactSurveyElementsWrapper, SurveyNavigationBase, SurveyTimerPanel, SurveyPage, SurveyRow, SurveyPanel, SurveyFlowPanel, SurveyQuestion, SurveyElementErrors, SurveyQuestionAndErrorsCell, ReactSurveyElement, SurveyElementBase, SurveyQuestionElementBase, SurveyQuestionCommentItem, SurveyQuestionComment, SurveyQuestionCheckbox, SurveyQuestionCheckboxItem, SurveyQuestionRanking, SurveyQuestionRankingItem, RatingItem, RatingItemStar, RatingItemSmiley, RatingDropdownItem, TagboxFilterString, SurveyQuestionOptionItem, SurveyQuestionDropdownBase, SurveyQuestionDropdown, SurveyQuestionTagboxItem, SurveyQuestionTagbox, SurveyQuestionDropdownSelect, SurveyQuestionMatrix, SurveyQuestionMatrixRow, 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, List, TitleActions, TitleElement, SurveyActionBar, LogoImage, SurveyHeader, SvgIcon, SurveyQuestionMatrixDynamicRemoveButton, SurveyQuestionMatrixDetailButton, SurveyQuestionMatrixDynamicDragDropIcon, SurveyQuestionPanelDynamicAddButton, SurveyQuestionPanelDynamicRemoveButton, SurveyQuestionPanelDynamicPrevButton, SurveyQuestionPanelDynamicNextButton, SurveyQuestionPanelDynamicProgressText, SurveyNavigationButton, MatrixRow, Skeleton, NotifierComponent, ComponentsContainer, CharacterCounterComponent, HeaderMobile, HeaderCell, Header, SurveyLocStringViewer, SurveyLocStringEditor, LoadingIndicatorComponent, SvgBundleComponent */
2004
+ /*! exports provided: Survey, attachKey2click, ReactSurveyElementsWrapper, SurveyNavigationBase, SurveyTimerPanel, SurveyPage, SurveyRow, SurveyPanel, SurveyFlowPanel, SurveyQuestion, SurveyElementErrors, SurveyQuestionAndErrorsCell, ReactSurveyElement, SurveyElementBase, SurveyQuestionElementBase, SurveyQuestionCommentItem, SurveyQuestionComment, SurveyQuestionCheckbox, SurveyQuestionCheckboxItem, SurveyQuestionRanking, SurveyQuestionRankingItem, 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, List, TitleActions, TitleElement, SurveyActionBar, LogoImage, SurveyHeader, SvgIcon, SurveyQuestionMatrixDynamicRemoveButton, SurveyQuestionMatrixDetailButton, SurveyQuestionMatrixDynamicDragDropIcon, SurveyQuestionPanelDynamicAddButton, SurveyQuestionPanelDynamicRemoveButton, SurveyQuestionPanelDynamicPrevButton, SurveyQuestionPanelDynamicNextButton, SurveyQuestionPanelDynamicProgressText, SurveyNavigationButton, MatrixRow, Skeleton, NotifierComponent, ComponentsContainer, CharacterCounterComponent, HeaderMobile, HeaderCell, Header, SurveyLocStringViewer, SurveyLocStringEditor, LoadingIndicatorComponent, SvgBundleComponent */
1997
2005
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
1998
2006
 
1999
2007
  "use strict";
@@ -2091,6 +2099,8 @@ __webpack_require__.r(__webpack_exports__);
2091
2099
 
2092
2100
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SurveyQuestionMatrixRow", function() { return _react_reactquestion_matrix__WEBPACK_IMPORTED_MODULE_24__["SurveyQuestionMatrixRow"]; });
2093
2101
 
2102
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SurveyQuestionMatrixCell", function() { return _react_reactquestion_matrix__WEBPACK_IMPORTED_MODULE_24__["SurveyQuestionMatrixCell"]; });
2103
+
2094
2104
  /* harmony import */ var _react_reactquestion_html__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ../react/reactquestion_html */ "./src/react/reactquestion_html.tsx");
2095
2105
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SurveyQuestionHtml", function() { return _react_reactquestion_html__WEBPACK_IMPORTED_MODULE_25__["SurveyQuestionHtml"]; });
2096
2106
 
@@ -2365,7 +2375,7 @@ __webpack_require__.r(__webpack_exports__);
2365
2375
  /*!*********************************!*\
2366
2376
  !*** ./src/entries/react-ui.ts ***!
2367
2377
  \*********************************/
2368
- /*! exports provided: Survey, attachKey2click, ReactSurveyElementsWrapper, SurveyNavigationBase, SurveyTimerPanel, SurveyPage, SurveyRow, SurveyPanel, SurveyFlowPanel, SurveyQuestion, SurveyElementErrors, SurveyQuestionAndErrorsCell, ReactSurveyElement, SurveyElementBase, SurveyQuestionElementBase, SurveyQuestionCommentItem, SurveyQuestionComment, SurveyQuestionCheckbox, SurveyQuestionCheckboxItem, SurveyQuestionRanking, SurveyQuestionRankingItem, RatingItem, RatingItemStar, RatingItemSmiley, RatingDropdownItem, TagboxFilterString, SurveyQuestionOptionItem, SurveyQuestionDropdownBase, SurveyQuestionDropdown, SurveyQuestionTagboxItem, SurveyQuestionTagbox, SurveyQuestionDropdownSelect, SurveyQuestionMatrix, SurveyQuestionMatrixRow, 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, List, TitleActions, TitleElement, SurveyActionBar, LogoImage, SurveyHeader, SvgIcon, SurveyQuestionMatrixDynamicRemoveButton, SurveyQuestionMatrixDetailButton, SurveyQuestionMatrixDynamicDragDropIcon, SurveyQuestionPanelDynamicAddButton, SurveyQuestionPanelDynamicRemoveButton, SurveyQuestionPanelDynamicPrevButton, SurveyQuestionPanelDynamicNextButton, SurveyQuestionPanelDynamicProgressText, SurveyNavigationButton, MatrixRow, Skeleton, NotifierComponent, ComponentsContainer, CharacterCounterComponent, HeaderMobile, HeaderCell, Header, SurveyLocStringViewer, SurveyLocStringEditor, LoadingIndicatorComponent, SvgBundleComponent, SurveyModel, SurveyWindowModel, settings, surveyLocalization, surveyStrings, Model, ResponsivityManager, VerticalResponsivityManager, unwrap */
2378
+ /*! exports provided: Survey, attachKey2click, ReactSurveyElementsWrapper, SurveyNavigationBase, SurveyTimerPanel, SurveyPage, SurveyRow, SurveyPanel, SurveyFlowPanel, SurveyQuestion, SurveyElementErrors, SurveyQuestionAndErrorsCell, ReactSurveyElement, SurveyElementBase, SurveyQuestionElementBase, SurveyQuestionCommentItem, SurveyQuestionComment, SurveyQuestionCheckbox, SurveyQuestionCheckboxItem, SurveyQuestionRanking, SurveyQuestionRankingItem, 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, List, TitleActions, TitleElement, SurveyActionBar, LogoImage, SurveyHeader, SvgIcon, SurveyQuestionMatrixDynamicRemoveButton, SurveyQuestionMatrixDetailButton, SurveyQuestionMatrixDynamicDragDropIcon, SurveyQuestionPanelDynamicAddButton, SurveyQuestionPanelDynamicRemoveButton, SurveyQuestionPanelDynamicPrevButton, SurveyQuestionPanelDynamicNextButton, SurveyQuestionPanelDynamicProgressText, SurveyNavigationButton, MatrixRow, Skeleton, NotifierComponent, ComponentsContainer, CharacterCounterComponent, HeaderMobile, HeaderCell, Header, SurveyLocStringViewer, SurveyLocStringEditor, LoadingIndicatorComponent, SvgBundleComponent, SurveyModel, SurveyWindowModel, settings, surveyLocalization, surveyStrings, Model, ResponsivityManager, VerticalResponsivityManager, unwrap */
2369
2379
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
2370
2380
 
2371
2381
  "use strict";
@@ -2439,6 +2449,8 @@ __webpack_require__.r(__webpack_exports__);
2439
2449
 
2440
2450
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SurveyQuestionMatrixRow", function() { return _react_ui_model__WEBPACK_IMPORTED_MODULE_0__["SurveyQuestionMatrixRow"]; });
2441
2451
 
2452
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SurveyQuestionMatrixCell", function() { return _react_ui_model__WEBPACK_IMPORTED_MODULE_0__["SurveyQuestionMatrixCell"]; });
2453
+
2442
2454
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SurveyQuestionHtml", function() { return _react_ui_model__WEBPACK_IMPORTED_MODULE_0__["SurveyQuestionHtml"]; });
2443
2455
 
2444
2456
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SurveyQuestionFile", function() { return _react_ui_model__WEBPACK_IMPORTED_MODULE_0__["SurveyQuestionFile"]; });
@@ -2594,7 +2606,7 @@ __webpack_require__.r(__webpack_exports__);
2594
2606
 
2595
2607
 
2596
2608
 
2597
- Object(survey_core__WEBPACK_IMPORTED_MODULE_2__["checkLibraryVersion"])("" + "1.9.123", "survey-react-ui");
2609
+ Object(survey_core__WEBPACK_IMPORTED_MODULE_2__["checkLibraryVersion"])("" + "1.9.125", "survey-react-ui");
2598
2610
 
2599
2611
 
2600
2612
  /***/ }),
@@ -7478,7 +7490,12 @@ var JsonObjectProperty = /** @class */ (function () {
7478
7490
  return this.isRequiredValue;
7479
7491
  },
7480
7492
  set: function (val) {
7481
- this.isRequiredValue = val;
7493
+ if (val !== this.isRequired) {
7494
+ this.isRequiredValue = val;
7495
+ if (!!this.classInfo) {
7496
+ this.classInfo.resetAllProperties();
7497
+ }
7498
+ }
7482
7499
  },
7483
7500
  enumerable: false,
7484
7501
  configurable: true
@@ -7513,7 +7530,7 @@ var JsonObjectProperty = /** @class */ (function () {
7513
7530
  JsonObjectProperty.prototype.getDefaultValue = function (obj) {
7514
7531
  var result = !!this.defaultValueFunc ? this.defaultValueFunc(obj) : this.defaultValueValue;
7515
7532
  if (!!JsonObjectProperty.getItemValuesDefaultValue &&
7516
- JsonObject.metaData.isDescendantOf(this.className, "itemvalue")) {
7533
+ Serializer.isDescendantOf(this.className, "itemvalue")) {
7517
7534
  result = JsonObjectProperty.getItemValuesDefaultValue(this.defaultValueValue || [], this.className);
7518
7535
  }
7519
7536
  return result;
@@ -7858,7 +7875,8 @@ var CustomPropertiesCollection = /** @class */ (function () {
7858
7875
  if (prop.isLocalizable &&
7859
7876
  prop.serializationProperty &&
7860
7877
  obj.createCustomLocalizableObj) {
7861
- obj.createCustomLocalizableObj(prop.name);
7878
+ var locStr = obj.createCustomLocalizableObj(prop.name);
7879
+ locStr.defaultValue = prop.defaultValue;
7862
7880
  var locDesc = {
7863
7881
  get: function () {
7864
7882
  return obj.getLocalizableString(prop.name);
@@ -7867,7 +7885,7 @@ var CustomPropertiesCollection = /** @class */ (function () {
7867
7885
  Object.defineProperty(obj, prop.serializationProperty, locDesc);
7868
7886
  var desc = {
7869
7887
  get: function () {
7870
- return obj.getLocalizableStringText(prop.name, prop.defaultValue);
7888
+ return obj.getLocalizableStringText(prop.name);
7871
7889
  },
7872
7890
  set: function (v) {
7873
7891
  obj.setLocalizableStringText(prop.name, v);
@@ -7879,7 +7897,7 @@ var CustomPropertiesCollection = /** @class */ (function () {
7879
7897
  var defaultValue = prop.defaultValue;
7880
7898
  var isArrayProp = prop.isArray || prop.type === "multiplevalues";
7881
7899
  if (typeof obj.createNewArray === "function") {
7882
- if (JsonObject.metaData.isDescendantOf(prop.className, "itemvalue")) {
7900
+ if (Serializer.isDescendantOf(prop.className, "itemvalue")) {
7883
7901
  obj.createNewArray(prop.name, function (item) {
7884
7902
  item.locOwner = obj;
7885
7903
  item.ownerPropertyName = prop.name;
@@ -7970,8 +7988,20 @@ var JsonMetadataClass = /** @class */ (function () {
7970
7988
  this.fillAllProperties();
7971
7989
  return this.allProperties;
7972
7990
  };
7991
+ JsonMetadataClass.prototype.getRequiredProperties = function () {
7992
+ if (!!this.requiredProperties)
7993
+ return this.requiredProperties;
7994
+ this.requiredProperties = [];
7995
+ var props = this.getAllProperties();
7996
+ for (var i = 0; i < props.length; i++) {
7997
+ if (props[i].isRequired)
7998
+ this.requiredProperties.push(props[i]);
7999
+ }
8000
+ return this.requiredProperties;
8001
+ };
7973
8002
  JsonMetadataClass.prototype.resetAllProperties = function () {
7974
8003
  this.allProperties = undefined;
8004
+ this.requiredProperties = undefined;
7975
8005
  this.hashProperties = undefined;
7976
8006
  var childClasses = Serializer.getChildrenClasses(this.name);
7977
8007
  for (var i = 0; i < childClasses.length; i++) {
@@ -8241,6 +8271,7 @@ var JsonMetadata = /** @class */ (function () {
8241
8271
  this.classes = {};
8242
8272
  this.alternativeNames = {};
8243
8273
  this.childrenClasses = {};
8274
+ this.dynamicPropsCache = {};
8244
8275
  }
8245
8276
  JsonMetadata.prototype.getObjPropertyValue = function (obj, name) {
8246
8277
  if (this.isObjWrapper(obj)) {
@@ -8353,14 +8384,18 @@ var JsonMetadata = /** @class */ (function () {
8353
8384
  if (dynamicType === void 0) { dynamicType = null; }
8354
8385
  if (!obj || !obj.getType || (!obj.getDynamicType && !dynamicType))
8355
8386
  return [];
8387
+ var objType = obj.getType();
8356
8388
  var dType = !!dynamicType ? dynamicType : obj.getDynamicType();
8357
8389
  if (!dType)
8358
8390
  return [];
8391
+ var cacheType = dType + "-" + objType;
8392
+ if (this.dynamicPropsCache[cacheType])
8393
+ return this.dynamicPropsCache[cacheType];
8359
8394
  var dynamicProps = this.getProperties(dType);
8360
8395
  if (!dynamicProps || dynamicProps.length == 0)
8361
8396
  return [];
8362
8397
  var hash = {};
8363
- var props = this.getProperties(obj.getType());
8398
+ var props = this.getProperties(objType);
8364
8399
  for (var i = 0; i < props.length; i++) {
8365
8400
  hash[props[i].name] = props[i];
8366
8401
  }
@@ -8371,6 +8406,7 @@ var JsonMetadata = /** @class */ (function () {
8371
8406
  res.push(dProp);
8372
8407
  }
8373
8408
  }
8409
+ this.dynamicPropsCache[cacheType] = res;
8374
8410
  return res;
8375
8411
  };
8376
8412
  JsonMetadata.prototype.hasOriginalProperty = function (obj, propName) {
@@ -8480,12 +8516,13 @@ var JsonMetadata = /** @class */ (function () {
8480
8516
  return result;
8481
8517
  };
8482
8518
  JsonMetadata.prototype.getRequiredProperties = function (name) {
8483
- var properties = this.getProperties(name);
8519
+ var metaClass = this.findClass(name);
8520
+ if (!metaClass)
8521
+ return [];
8522
+ var props = metaClass.getRequiredProperties();
8484
8523
  var res = [];
8485
- for (var i = 0; i < properties.length; i++) {
8486
- if (properties[i].isRequired) {
8487
- res.push(properties[i].name);
8488
- }
8524
+ for (var i = 0; i < props.length; i++) {
8525
+ res.push(props[i].name);
8489
8526
  }
8490
8527
  return res;
8491
8528
  };
@@ -8504,6 +8541,7 @@ var JsonMetadata = /** @class */ (function () {
8504
8541
  return null;
8505
8542
  var property = metaDataClass.createProperty(propertyInfo, true);
8506
8543
  if (property) {
8544
+ this.clearDynamicPropsCache(metaDataClass);
8507
8545
  metaDataClass.resetAllProperties();
8508
8546
  }
8509
8547
  return property;
@@ -8514,11 +8552,15 @@ var JsonMetadata = /** @class */ (function () {
8514
8552
  return false;
8515
8553
  var property = metaDataClass.find(propertyName);
8516
8554
  if (property) {
8555
+ this.clearDynamicPropsCache(metaDataClass);
8517
8556
  this.removePropertyFromClass(metaDataClass, property);
8518
8557
  metaDataClass.resetAllProperties();
8519
8558
  CustomPropertiesCollection.removeProperty(metaDataClass.name, propertyName);
8520
8559
  }
8521
8560
  };
8561
+ JsonMetadata.prototype.clearDynamicPropsCache = function (metaDataClass) {
8562
+ this.dynamicPropsCache = {};
8563
+ };
8522
8564
  JsonMetadata.prototype.removePropertyFromClass = function (metaDataClass, property) {
8523
8565
  var index = metaDataClass.properties.indexOf(property);
8524
8566
  if (index < 0)
@@ -8745,7 +8787,7 @@ var JsonUnknownPropertyError = /** @class */ (function (_super) {
8745
8787
  "' is unknown.") || this;
8746
8788
  _this.propertyName = propertyName;
8747
8789
  _this.className = className;
8748
- var properties = JsonObject.metaData.getProperties(className);
8790
+ var properties = Serializer.getProperties(className);
8749
8791
  if (properties) {
8750
8792
  _this.description = "The list of available properties are: ";
8751
8793
  for (var i = 0; i < properties.length; i++) {
@@ -8768,7 +8810,7 @@ var JsonMissingTypeErrorBase = /** @class */ (function (_super) {
8768
8810
  _this.type = type;
8769
8811
  _this.message = message;
8770
8812
  _this.description = "The following types are available: ";
8771
- var types = JsonObject.metaData.getChildrenClasses(baseClassName, true);
8813
+ var types = Serializer.getChildrenClasses(baseClassName, true);
8772
8814
  for (var i = 0; i < types.length; i++) {
8773
8815
  if (i > 0)
8774
8816
  _this.description += ", ";
@@ -8874,9 +8916,9 @@ var JsonObject = /** @class */ (function () {
8874
8916
  var needAddErrors = true;
8875
8917
  if (obj.getType) {
8876
8918
  objType = obj.getType();
8877
- properties = JsonObject.metaData.getProperties(objType);
8919
+ properties = Serializer.getProperties(objType);
8878
8920
  needAddErrors =
8879
- !!objType && !JsonObject.metaData.isDescendantOf(objType, "itemvalue");
8921
+ !!objType && !Serializer.isDescendantOf(objType, "itemvalue");
8880
8922
  }
8881
8923
  if (!properties)
8882
8924
  return;
@@ -8916,7 +8958,7 @@ var JsonObject = /** @class */ (function () {
8916
8958
  if (property != null && !property.className) {
8917
8959
  result[JsonObject.typePropertyName] = property.getObjType(obj.getType());
8918
8960
  }
8919
- this.propertiesToJson(obj, JsonObject.metaData.getProperties(obj.getType()), result, storeDefaults);
8961
+ this.propertiesToJson(obj, Serializer.getProperties(obj.getType()), result, storeDefaults);
8920
8962
  this.propertiesToJson(obj, this.getDynamicProperties(obj), result, storeDefaults);
8921
8963
  return result;
8922
8964
  };
@@ -9034,7 +9076,7 @@ var JsonObject = /** @class */ (function () {
9034
9076
  var result = { newObj: null, error: null };
9035
9077
  var className = this.getClassNameForNewObj(value, property);
9036
9078
  result.newObj = className
9037
- ? JsonObject.metaData.createClass(className, value)
9079
+ ? Serializer.createClass(className, value)
9038
9080
  : null;
9039
9081
  result.error = this.checkNewObjectOnErrors(result.newObj, value, property, className);
9040
9082
  return result;
@@ -9076,16 +9118,18 @@ var JsonObject = /** @class */ (function () {
9076
9118
  JsonObject.prototype.getRequiredError = function (obj, jsonValue) {
9077
9119
  if (!obj.getType || typeof obj.getData === "function")
9078
9120
  return null;
9079
- var className = obj.getType();
9080
- var requiredProperties = JsonObject.metaData.getRequiredProperties(className);
9081
- if (!Array.isArray(requiredProperties))
9121
+ var metaClass = Serializer.findClass(obj.getType());
9122
+ if (!metaClass)
9082
9123
  return null;
9083
- for (var i = 0; i < requiredProperties.length; i++) {
9084
- var prop = Serializer.findProperty(className, requiredProperties[i]);
9085
- if (!prop || !_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(prop.defaultValue))
9124
+ var props = metaClass.getRequiredProperties();
9125
+ if (!Array.isArray(props))
9126
+ return null;
9127
+ for (var i = 0; i < props.length; i++) {
9128
+ var prop = props[i];
9129
+ if (!_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(prop.defaultValue))
9086
9130
  continue;
9087
9131
  if (!jsonValue[prop.name]) {
9088
- return new JsonRequiredPropertyError(prop.name, className);
9132
+ return new JsonRequiredPropertyError(prop.name, obj.getType());
9089
9133
  }
9090
9134
  }
9091
9135
  return null;
@@ -9301,7 +9345,7 @@ var LocalizableString = /** @class */ (function () {
9301
9345
  }
9302
9346
  }
9303
9347
  if (!res)
9304
- res = "";
9348
+ res = this.defaultValue || "";
9305
9349
  return res;
9306
9350
  },
9307
9351
  enumerable: false,
@@ -9799,6 +9843,7 @@ var englishStrings = {
9799
9843
  requiredError: "Response required.",
9800
9844
  requiredErrorInPanel: "Response required: answer at least one question.",
9801
9845
  requiredInAllRowsError: "Response required: answer questions in all rows.",
9846
+ eachRowUniqueError: "Each row must have a unique value.",
9802
9847
  numericError: "The value should be numeric.",
9803
9848
  minError: "The value should not be less than {0}",
9804
9849
  maxError: "The value should not be greater than {0}",
@@ -17154,18 +17199,20 @@ _reactquestion_factory__WEBPACK_IMPORTED_MODULE_2__["ReactQuestionFactory"].Inst
17154
17199
  /*!********************************************!*\
17155
17200
  !*** ./src/react/reactquestion_matrix.tsx ***!
17156
17201
  \********************************************/
17157
- /*! exports provided: SurveyQuestionMatrix, SurveyQuestionMatrixRow */
17202
+ /*! exports provided: SurveyQuestionMatrix, SurveyQuestionMatrixRow, SurveyQuestionMatrixCell */
17158
17203
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
17159
17204
 
17160
17205
  "use strict";
17161
17206
  __webpack_require__.r(__webpack_exports__);
17162
17207
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyQuestionMatrix", function() { return SurveyQuestionMatrix; });
17163
17208
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyQuestionMatrixRow", function() { return SurveyQuestionMatrixRow; });
17209
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyQuestionMatrixCell", function() { return SurveyQuestionMatrixCell; });
17164
17210
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
17165
17211
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
17166
17212
  /* harmony import */ var _reactquestion_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./reactquestion_element */ "./src/react/reactquestion_element.tsx");
17167
17213
  /* harmony import */ var _reactquestion_factory__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./reactquestion_factory */ "./src/react/reactquestion_factory.tsx");
17168
17214
  /* harmony import */ var _reactsurveymodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./reactsurveymodel */ "./src/react/reactsurveymodel.tsx");
17215
+ /* harmony import */ var _element_factory__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./element-factory */ "./src/react/element-factory.tsx");
17169
17216
  var __extends = (undefined && undefined.__extends) || (function () {
17170
17217
  var extendStatics = function (d, b) {
17171
17218
  extendStatics = Object.setPrototypeOf ||
@@ -17185,6 +17232,7 @@ var __extends = (undefined && undefined.__extends) || (function () {
17185
17232
 
17186
17233
 
17187
17234
 
17235
+
17188
17236
  var SurveyQuestionMatrix = /** @class */ (function (_super) {
17189
17237
  __extends(SurveyQuestionMatrix, _super);
17190
17238
  function SurveyQuestionMatrix(props) {
@@ -17254,10 +17302,7 @@ var SurveyQuestionMatrix = /** @class */ (function (_super) {
17254
17302
  var SurveyQuestionMatrixRow = /** @class */ (function (_super) {
17255
17303
  __extends(SurveyQuestionMatrixRow, _super);
17256
17304
  function SurveyQuestionMatrixRow(props) {
17257
- var _this = _super.call(this, props) || this;
17258
- _this.handleOnChange = _this.handleOnChange.bind(_this);
17259
- _this.handleOnMouseDown = _this.handleOnMouseDown.bind(_this);
17260
- return _this;
17305
+ return _super.call(this, props) || this;
17261
17306
  }
17262
17307
  Object.defineProperty(SurveyQuestionMatrixRow.prototype, "question", {
17263
17308
  get: function () {
@@ -17273,13 +17318,6 @@ var SurveyQuestionMatrixRow = /** @class */ (function (_super) {
17273
17318
  enumerable: false,
17274
17319
  configurable: true
17275
17320
  });
17276
- SurveyQuestionMatrixRow.prototype.handleOnChange = function (event) {
17277
- this.row.value = event.target.value;
17278
- this.setState({ value: this.row.value });
17279
- };
17280
- SurveyQuestionMatrixRow.prototype.handleOnMouseDown = function (event) {
17281
- this.question.onMouseDown();
17282
- };
17283
17321
  SurveyQuestionMatrixRow.prototype.wrapCell = function (cell, element, reason) {
17284
17322
  if (!reason) {
17285
17323
  return element;
@@ -17314,33 +17352,35 @@ var SurveyQuestionMatrixRow = /** @class */ (function (_super) {
17314
17352
  var _this = this;
17315
17353
  var tds = [];
17316
17354
  var row = this.row;
17317
- for (var i = 0; i < this.question.visibleColumns.length; i++) {
17355
+ var cellComponent = this.question.cellComponent;
17356
+ var _loop_1 = function () {
17318
17357
  var td = null;
17319
- var column = this.question.visibleColumns[i];
17358
+ var column = this_1.question.visibleColumns[i];
17320
17359
  var key = "value" + i;
17321
- var isChecked = row.value == column.value;
17322
- var itemClass = this.question.getItemClass(row, column);
17323
- var inputId = this.question.inputId + "_" + row.name + "_" + i;
17324
- if (this.question.hasCellText) {
17325
- var getHandler = !this.question.isInputReadOnly
17360
+ var itemClass = this_1.question.getItemClass(row, column);
17361
+ if (this_1.question.hasCellText) {
17362
+ var getHandler = !this_1.question.isInputReadOnly
17326
17363
  ? function (column) { return function () { return _this.cellClick(row, column); }; }
17327
17364
  : null;
17328
- td = (react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("td", { key: key, className: itemClass, onClick: getHandler ? getHandler(column) : function () { } }, this.renderLocString(this.question.getCellDisplayLocText(row.name, column))));
17365
+ td = (react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("td", { key: key, className: itemClass, onClick: getHandler ? getHandler(column) : function () { } }, this_1.renderLocString(this_1.question.getCellDisplayLocText(row.name, column))));
17329
17366
  }
17330
17367
  else {
17331
- var mobileSpan = this.question.isMobile ?
17332
- (react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("span", { className: this.question.cssClasses.cellResponsiveTitle }, this.renderLocString(column.locText)))
17333
- : undefined;
17334
- td = (react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("td", { key: key, "data-responsive-title": column.locText.renderedHtml, className: this.question.cssClasses.cell },
17335
- react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("label", { onMouseDown: this.handleOnMouseDown, className: itemClass },
17336
- react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("input", { id: inputId, type: "radio", className: this.cssClasses.itemValue, name: row.fullName, value: column.value, disabled: this.isDisplayMode, checked: isChecked, onChange: this.handleOnChange, "aria-required": this.question.a11y_input_ariaRequired, "aria-label": this.question.getCellAriaLabel(row.locText.renderedHtml, column.locText.renderedHtml), "aria-invalid": this.question.a11y_input_ariaInvalid, "aria-describedby": this.question.a11y_input_ariaDescribedBy }),
17337
- react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("span", { className: this.question.cssClasses.materialDecorator }, this.question.itemSvgIcon ?
17338
- react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("svg", { className: this.cssClasses.itemDecorator },
17339
- react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("use", { xlinkHref: this.question.itemSvgIcon })) :
17340
- null),
17341
- mobileSpan)));
17368
+ var renderedCell = _element_factory__WEBPACK_IMPORTED_MODULE_4__["ReactElementFactory"].Instance.createElement(cellComponent, {
17369
+ question: this_1.question,
17370
+ row: this_1.row,
17371
+ column: column,
17372
+ columnIndex: i,
17373
+ cssClasses: this_1.cssClasses,
17374
+ isDisplayMode: this_1.isDisplayMode,
17375
+ cellChanged: function () { _this.cellClick(_this.row, column); }
17376
+ });
17377
+ td = (react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("td", { key: key, "data-responsive-title": column.locText.renderedHtml, className: this_1.question.cssClasses.cell }, renderedCell));
17342
17378
  }
17343
17379
  tds.push(td);
17380
+ };
17381
+ var this_1 = this;
17382
+ for (var i = 0; i < this.question.visibleColumns.length; i++) {
17383
+ _loop_1();
17344
17384
  }
17345
17385
  return tds;
17346
17386
  };
@@ -17351,6 +17391,77 @@ var SurveyQuestionMatrixRow = /** @class */ (function (_super) {
17351
17391
  return SurveyQuestionMatrixRow;
17352
17392
  }(_reactquestion_element__WEBPACK_IMPORTED_MODULE_1__["ReactSurveyElement"]));
17353
17393
 
17394
+ var SurveyQuestionMatrixCell = /** @class */ (function (_super) {
17395
+ __extends(SurveyQuestionMatrixCell, _super);
17396
+ function SurveyQuestionMatrixCell(props) {
17397
+ var _this = _super.call(this, props) || this;
17398
+ _this.handleOnMouseDown = _this.handleOnMouseDown.bind(_this);
17399
+ _this.handleOnChange = _this.handleOnChange.bind(_this);
17400
+ return _this;
17401
+ }
17402
+ SurveyQuestionMatrixCell.prototype.handleOnChange = function (event) {
17403
+ if (!!this.props.cellChanged) {
17404
+ this.props.cellChanged();
17405
+ }
17406
+ };
17407
+ SurveyQuestionMatrixCell.prototype.handleOnMouseDown = function (event) {
17408
+ this.question.onMouseDown();
17409
+ };
17410
+ Object.defineProperty(SurveyQuestionMatrixCell.prototype, "question", {
17411
+ get: function () {
17412
+ return this.props.question;
17413
+ },
17414
+ enumerable: false,
17415
+ configurable: true
17416
+ });
17417
+ Object.defineProperty(SurveyQuestionMatrixCell.prototype, "row", {
17418
+ get: function () {
17419
+ return this.props.row;
17420
+ },
17421
+ enumerable: false,
17422
+ configurable: true
17423
+ });
17424
+ Object.defineProperty(SurveyQuestionMatrixCell.prototype, "column", {
17425
+ get: function () {
17426
+ return this.props.column;
17427
+ },
17428
+ enumerable: false,
17429
+ configurable: true
17430
+ });
17431
+ Object.defineProperty(SurveyQuestionMatrixCell.prototype, "columnIndex", {
17432
+ get: function () {
17433
+ return this.props.columnIndex;
17434
+ },
17435
+ enumerable: false,
17436
+ configurable: true
17437
+ });
17438
+ SurveyQuestionMatrixCell.prototype.canRender = function () {
17439
+ return !!this.question && !!this.row;
17440
+ };
17441
+ SurveyQuestionMatrixCell.prototype.renderElement = function () {
17442
+ var isChecked = this.row.value == this.column.value;
17443
+ var inputId = this.question.inputId + "_" + this.row.name + "_" + this.columnIndex;
17444
+ var itemClass = this.question.getItemClass(this.row, this.column);
17445
+ var mobileSpan = this.question.isMobile ?
17446
+ (react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("span", { className: this.question.cssClasses.cellResponsiveTitle }, this.renderLocString(this.column.locText)))
17447
+ : undefined;
17448
+ return (react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("label", { onMouseDown: this.handleOnMouseDown, className: itemClass },
17449
+ this.renderInput(inputId, isChecked),
17450
+ react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("span", { className: this.question.cssClasses.materialDecorator }, this.question.itemSvgIcon ?
17451
+ react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("svg", { className: this.cssClasses.itemDecorator },
17452
+ react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("use", { xlinkHref: this.question.itemSvgIcon })) :
17453
+ null),
17454
+ mobileSpan));
17455
+ };
17456
+ SurveyQuestionMatrixCell.prototype.renderInput = function (inputId, isChecked) {
17457
+ return (react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("input", { id: inputId, type: "radio", className: this.cssClasses.itemValue, name: this.row.fullName, value: this.column.value, disabled: this.isDisplayMode, checked: isChecked, onChange: this.handleOnChange, "aria-required": this.question.a11y_input_ariaRequired, "aria-label": this.question.getCellAriaLabel(this.row.locText.renderedHtml, this.column.locText.renderedHtml), "aria-invalid": this.question.a11y_input_ariaInvalid, "aria-describedby": this.question.a11y_input_ariaDescribedBy }));
17458
+ };
17459
+ return SurveyQuestionMatrixCell;
17460
+ }(_reactquestion_element__WEBPACK_IMPORTED_MODULE_1__["ReactSurveyElement"]));
17461
+
17462
+ _element_factory__WEBPACK_IMPORTED_MODULE_4__["ReactElementFactory"].Instance.registerElement("survey-matrix-cell", function (props) {
17463
+ return react__WEBPACK_IMPORTED_MODULE_0__["createElement"](SurveyQuestionMatrixCell, props);
17464
+ });
17354
17465
  _reactquestion_factory__WEBPACK_IMPORTED_MODULE_2__["ReactQuestionFactory"].Instance.registerQuestion("matrix", function (props) {
17355
17466
  return react__WEBPACK_IMPORTED_MODULE_0__["createElement"](SurveyQuestionMatrix, props);
17356
17467
  });
@@ -19854,7 +19965,7 @@ __webpack_require__.r(__webpack_exports__);
19854
19965
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "settings", function() { return settings; });
19855
19966
  /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils/utils */ "./src/utils/utils.ts");
19856
19967
 
19857
- var document = globalThis.document;
19968
+ var document = typeof globalThis !== "undefined" ? globalThis.document : undefined.document;
19858
19969
  var defaultEnvironment = (!!document ? {
19859
19970
  root: document,
19860
19971
  _rootElement: document.body,
@@ -20032,12 +20143,12 @@ var settings = {
20032
20143
  * import { ItemValue, settings } from "survey-core";
20033
20144
  *
20034
20145
  * // `itemValueSerializeAsObject` example
20035
- * settings.localization.itemValueSerializeAsObject = true;
20146
+ * settings.serialization.itemValueSerializeAsObject = true;
20036
20147
  * const item = new ItemValue(5);
20037
20148
  * const itemString = item.toJSON(); // Produces { value: 5 } instead of 5
20038
20149
  *
20039
20150
  * // `itemValueSerializeDisplayText` example
20040
- * settings.localization.itemValueSerializeDisplayText = true;
20151
+ * settings.serialization.itemValueSerializeDisplayText = true;
20041
20152
  * const item = new ItemValue("item1");
20042
20153
  * const itemString = item.toJSON(); // Produces { value: "item1", text: "item1" } instead of "item1"
20043
20154
  * ```