survey-react-ui 1.10.3 → 1.10.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "survey-react-ui",
3
- "version": "1.10.3",
3
+ "version": "1.10.5",
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": "survey-react-ui.d.ts",
23
23
  "peerDependencies": {
24
- "survey-core": "1.10.3",
24
+ "survey-core": "1.10.5",
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.10.3
2
+ * surveyjs - Survey JavaScript library v1.10.5
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
  */
@@ -2401,13 +2401,18 @@ var ProcessValue = /** @class */ (function () {
2401
2401
  };
2402
2402
  ProcessValue.prototype.isAnyKeyChanged = function (keys, usedNames) {
2403
2403
  for (var i = 0; i < usedNames.length; i++) {
2404
- var name = usedNames[i];
2405
- if (keys.hasOwnProperty(name))
2404
+ var name_1 = usedNames[i];
2405
+ if (!name_1)
2406
+ continue;
2407
+ var lowerName = name_1.toLowerCase();
2408
+ if (keys.hasOwnProperty(name_1))
2409
+ return true;
2410
+ if (name_1 !== lowerName && keys.hasOwnProperty(lowerName))
2406
2411
  return true;
2407
- var firstName = this.getFirstName(name);
2412
+ var firstName = this.getFirstName(name_1);
2408
2413
  if (!keys.hasOwnProperty(firstName))
2409
2414
  continue;
2410
- if (name === firstName)
2415
+ if (name_1 === firstName)
2411
2416
  return true;
2412
2417
  var keyValue = keys[firstName];
2413
2418
  if (keyValue == undefined)
@@ -2417,9 +2422,9 @@ var ProcessValue = /** @class */ (function () {
2417
2422
  return true;
2418
2423
  var v = {};
2419
2424
  v[firstName] = keyValue["oldValue"];
2420
- var oldValue = this.getValue(name, v);
2425
+ var oldValue = this.getValue(name_1, v);
2421
2426
  v[firstName] = keyValue["newValue"];
2422
- var newValue = this.getValue(name, v);
2427
+ var newValue = this.getValue(name_1, v);
2423
2428
  if (!_helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isTwoValueEquals(oldValue, newValue, false, false, false))
2424
2429
  return true;
2425
2430
  }
@@ -3633,7 +3638,7 @@ __webpack_require__.r(__webpack_exports__);
3633
3638
 
3634
3639
 
3635
3640
 
3636
- Object(survey_core__WEBPACK_IMPORTED_MODULE_2__["checkLibraryVersion"])("" + "1.10.3", "survey-react-ui");
3641
+ Object(survey_core__WEBPACK_IMPORTED_MODULE_2__["checkLibraryVersion"])("" + "1.10.5", "survey-react-ui");
3637
3642
 
3638
3643
 
3639
3644
  /***/ }),
@@ -7435,6 +7440,8 @@ __webpack_require__.r(__webpack_exports__);
7435
7440
  /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts");
7436
7441
  /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./settings */ "./src/settings.ts");
7437
7442
  /* harmony import */ var _console_warnings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./console-warnings */ "./src/console-warnings.ts");
7443
+ /* harmony import */ var _conditions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./conditions */ "./src/conditions.ts");
7444
+
7438
7445
 
7439
7446
 
7440
7447
 
@@ -7557,7 +7564,7 @@ function avg(params) {
7557
7564
  }
7558
7565
  FunctionFactory.Instance.register("avg", avg);
7559
7566
  function getInArrayParams(params) {
7560
- if (params.length != 2)
7567
+ if (params.length < 2 || params.length > 3)
7561
7568
  return null;
7562
7569
  var arr = params[0];
7563
7570
  if (!arr)
@@ -7567,16 +7574,22 @@ function getInArrayParams(params) {
7567
7574
  var name = params[1];
7568
7575
  if (typeof name !== "string" && !(name instanceof String))
7569
7576
  return null;
7570
- return { data: arr, name: name };
7577
+ var expression = params.length === 3 ? params[2] : undefined;
7578
+ if (typeof expression !== "string" && !(expression instanceof String)) {
7579
+ expression = undefined;
7580
+ }
7581
+ return { data: arr, name: name, expression: expression };
7571
7582
  }
7572
7583
  function convertToNumber(val) {
7573
7584
  if (typeof val === "string")
7574
7585
  return _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isNumber(val) ? _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].getNumber(val) : undefined;
7575
7586
  return val;
7576
7587
  }
7577
- function processItemInArray(item, name, res, func, needToConvert) {
7588
+ function processItemInArray(item, name, res, func, needToConvert, condition) {
7578
7589
  if (!item || _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isValueEmpty(item[name]))
7579
7590
  return res;
7591
+ if (condition && !condition.run(item))
7592
+ return res;
7580
7593
  var val = needToConvert ? convertToNumber(item[name]) : 1;
7581
7594
  return func(res, val);
7582
7595
  }
@@ -7585,15 +7598,19 @@ function calcInArray(params, func, needToConvert) {
7585
7598
  var v = getInArrayParams(params);
7586
7599
  if (!v)
7587
7600
  return undefined;
7601
+ var condition = !!v.expression ? new _conditions__WEBPACK_IMPORTED_MODULE_3__["ConditionRunner"](v.expression) : undefined;
7602
+ if (condition && condition.isAsync) {
7603
+ condition = undefined;
7604
+ }
7588
7605
  var res = undefined;
7589
7606
  if (Array.isArray(v.data)) {
7590
7607
  for (var i = 0; i < v.data.length; i++) {
7591
- res = processItemInArray(v.data[i], v.name, res, func, needToConvert);
7608
+ res = processItemInArray(v.data[i], v.name, res, func, needToConvert, condition);
7592
7609
  }
7593
7610
  }
7594
7611
  else {
7595
7612
  for (var key in v.data) {
7596
- res = processItemInArray(v.data[key], v.name, res, func, needToConvert);
7613
+ res = processItemInArray(v.data[key], v.name, res, func, needToConvert, condition);
7597
7614
  }
7598
7615
  }
7599
7616
  return res;
@@ -15211,9 +15228,6 @@ var SurveyQuestionDropdownBase = /** @class */ (function (_super) {
15211
15228
  this.renderReadOnlyElement());
15212
15229
  }
15213
15230
  else {
15214
- if (!this.question["dropdownListModel"]) {
15215
- this.question["dropdownListModel"] = new survey_core__WEBPACK_IMPORTED_MODULE_1__["DropdownListModel"](this.question);
15216
- }
15217
15231
  selectElement = react__WEBPACK_IMPORTED_MODULE_0__["createElement"](react__WEBPACK_IMPORTED_MODULE_0__["Fragment"], null,
15218
15232
  this.renderInput(this.question["dropdownListModel"]),
15219
15233
  react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_components_popup_popup__WEBPACK_IMPORTED_MODULE_2__["Popup"], { model: (_b = (_a = this.question) === null || _a === void 0 ? void 0 : _a.dropdownListModel) === null || _b === void 0 ? void 0 : _b.popupModel }));
@@ -20520,7 +20534,7 @@ var SurveyQuestionRadiogroup = /** @class */ (function (_super) {
20520
20534
  var clearButton = null;
20521
20535
  if (this.question.showClearButtonInContent) {
20522
20536
  clearButton = (react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", null,
20523
- react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("input", { type: "button", className: this.question.cssClasses.clearButton, onClick: function () { return _this.question.clearValue(); }, value: this.question.clearButtonCaption })));
20537
+ react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("input", { type: "button", className: this.question.cssClasses.clearButton, onClick: function () { return _this.question.clearValue(true); }, value: this.question.clearButtonCaption })));
20524
20538
  }
20525
20539
  return (react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("fieldset", { className: this.question.getSelectBaseRootCss(), ref: function (fieldset) { return (_this.setControl(fieldset)); }, role: this.question.a11y_input_ariaRole, "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 },
20526
20540
  this.question.hasColumns
@@ -21583,7 +21597,7 @@ var SurveyQuestionSignaturePad = /** @class */ (function (_super) {
21583
21597
  return null;
21584
21598
  var cssClasses = this.question.cssClasses;
21585
21599
  return react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: cssClasses.controls },
21586
- react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("button", { type: "button", className: cssClasses.clearButton, title: this.question.clearButtonCaption, onClick: function () { return _this.question.clearValue(); } }, this.question.cssClasses.clearButtonIconId ? react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_components_svg_icon_svg_icon__WEBPACK_IMPORTED_MODULE_3__["SvgIcon"], { iconName: this.question.cssClasses.clearButtonIconId, size: "auto" }) : react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("span", null, "\u2716")));
21600
+ react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("button", { type: "button", className: cssClasses.clearButton, title: this.question.clearButtonCaption, onClick: function () { return _this.question.clearValue(true); } }, this.question.cssClasses.clearButtonIconId ? react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_components_svg_icon_svg_icon__WEBPACK_IMPORTED_MODULE_3__["SvgIcon"], { iconName: this.question.cssClasses.clearButtonIconId, size: "auto" }) : react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("span", null, "\u2716")));
21587
21601
  };
21588
21602
  return SurveyQuestionSignaturePad;
21589
21603
  }(_reactquestion_element__WEBPACK_IMPORTED_MODULE_1__["SurveyQuestionElementBase"]));
@@ -22434,6 +22448,7 @@ var settings = {
22434
22448
  * A separator used in a shorthand notation that specifies a value and display text for an [`ItemValue`](https://surveyjs.io/form-library/documentation/api-reference/itemvalue) object: `"value|text"`.
22435
22449
  *
22436
22450
  * Default value: `"|"`
22451
+ * @see [settings.choicesSeparator](https://surveyjs.io/form-library/documentation/api-reference/settings#choicesSeparator)
22437
22452
  */
22438
22453
  itemValueSeparator: "|",
22439
22454
  /**
@@ -22588,6 +22603,13 @@ var settings = {
22588
22603
  dontKnowItem: [3],
22589
22604
  otherItem: [4]
22590
22605
  },
22606
+ /**
22607
+ * One or several characters used to separate choice options in a list.
22608
+ *
22609
+ * Default value: `", "`
22610
+ * @see [settings.itemValueSeparator](https://surveyjs.io/form-library/documentation/api-reference/settings#itemValueSeparator)
22611
+ */
22612
+ choicesSeparator: ", ",
22591
22613
  /**
22592
22614
  * A list of supported validators by question type.
22593
22615
  */
@@ -24185,7 +24207,7 @@ var SurveyElement = /** @class */ (function (_super) {
24185
24207
  configurable: true
24186
24208
  });
24187
24209
  SurveyElement.prototype.getIsAnimationAllowed = function () {
24188
- return _super.prototype.getIsAnimationAllowed.call(this) && !!this.survey;
24210
+ return _super.prototype.getIsAnimationAllowed.call(this) && !!this.survey && !this.survey["isEndLoadingFromJson"];
24189
24211
  };
24190
24212
  SurveyElement.prototype.dispose = function () {
24191
24213
  _super.prototype.dispose.call(this);