survey-react-ui 1.9.129 → 1.9.130

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.129",
3
+ "version": "1.9.130",
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,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - Survey JavaScript library v1.9.129
2
+ * surveyjs - Survey JavaScript library v1.9.130
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
  */
@@ -2625,7 +2625,7 @@ __webpack_require__.r(__webpack_exports__);
2625
2625
 
2626
2626
 
2627
2627
 
2628
- Object(survey_core__WEBPACK_IMPORTED_MODULE_2__["checkLibraryVersion"])("" + "1.9.129", "survey-react-ui");
2628
+ Object(survey_core__WEBPACK_IMPORTED_MODULE_2__["checkLibraryVersion"])("" + "1.9.130", "survey-react-ui");
2629
2629
 
2630
2630
 
2631
2631
  /***/ }),
@@ -7753,14 +7753,21 @@ var JsonObjectProperty = /** @class */ (function () {
7753
7753
  configurable: true
7754
7754
  });
7755
7755
  JsonObjectProperty.prototype.isAvailableInVersion = function (ver) {
7756
- if (!!this.alternativeName)
7756
+ if (!!this.alternativeName || this.oldName)
7757
7757
  return true;
7758
7758
  return this.isAvailableInVersionCore(ver);
7759
7759
  };
7760
7760
  JsonObjectProperty.prototype.getSerializedName = function (ver) {
7761
7761
  if (!this.alternativeName)
7762
7762
  return this.name;
7763
- return this.isAvailableInVersionCore(ver) ? this.name : this.alternativeName;
7763
+ return this.isAvailableInVersionCore(ver) ? this.name : this.alternativeName || this.oldName;
7764
+ };
7765
+ JsonObjectProperty.prototype.getSerializedProperty = function (obj, ver) {
7766
+ if (!this.oldName || this.isAvailableInVersionCore(ver))
7767
+ return this;
7768
+ if (!obj || !obj.getType)
7769
+ return null;
7770
+ return Serializer.findProperty(obj.getType(), this.oldName);
7764
7771
  };
7765
7772
  JsonObjectProperty.prototype.isAvailableInVersionCore = function (ver) {
7766
7773
  if (!ver || !this.version)
@@ -7846,6 +7853,7 @@ var JsonObjectProperty = /** @class */ (function () {
7846
7853
  "isLocalizableValue",
7847
7854
  "className",
7848
7855
  "alternativeName",
7856
+ "oldName",
7849
7857
  "layout",
7850
7858
  "version",
7851
7859
  "classNamePart",
@@ -8297,6 +8305,9 @@ var JsonMetadataClass = /** @class */ (function () {
8297
8305
  if (propInfo.alternativeName) {
8298
8306
  prop.alternativeName = propInfo.alternativeName;
8299
8307
  }
8308
+ if (propInfo.oldName) {
8309
+ prop.oldName = propInfo.oldName;
8310
+ }
8300
8311
  if (propInfo.layout) {
8301
8312
  prop.layout = propInfo.layout;
8302
8313
  }
@@ -8359,11 +8370,11 @@ var JsonMetadata = /** @class */ (function () {
8359
8370
  this.dynamicPropsCache = {};
8360
8371
  }
8361
8372
  JsonMetadata.prototype.getObjPropertyValue = function (obj, name) {
8362
- if (this.isObjWrapper(obj)) {
8373
+ if (this.isObjWrapper(obj) && this.isNeedUseObjWrapper(obj, name)) {
8363
8374
  var orignalObj = obj.getOriginalObj();
8364
- var prop = Serializer.findProperty(orignalObj.getType(), name);
8365
- if (!!prop)
8366
- return this.getObjPropertyValueCore(orignalObj, prop);
8375
+ var prop_1 = Serializer.findProperty(orignalObj.getType(), name);
8376
+ if (!!prop_1)
8377
+ return this.getObjPropertyValueCore(orignalObj, prop_1);
8367
8378
  }
8368
8379
  var prop = Serializer.findProperty(obj.getType(), name);
8369
8380
  if (!prop)
@@ -8400,6 +8411,18 @@ var JsonMetadata = /** @class */ (function () {
8400
8411
  JsonMetadata.prototype.isObjWrapper = function (obj) {
8401
8412
  return !!obj.getOriginalObj && !!obj.getOriginalObj();
8402
8413
  };
8414
+ JsonMetadata.prototype.isNeedUseObjWrapper = function (obj, name) {
8415
+ if (!obj.getDynamicProperties)
8416
+ return true;
8417
+ var props = obj.getDynamicProperties();
8418
+ if (!Array.isArray(props))
8419
+ return false;
8420
+ for (var i = 0; i < props.length; i++) {
8421
+ if (props[i].name === name)
8422
+ return true;
8423
+ }
8424
+ return false;
8425
+ };
8403
8426
  JsonMetadata.prototype.addClass = function (name, properties, creator, parentName) {
8404
8427
  if (creator === void 0) { creator = null; }
8405
8428
  if (parentName === void 0) { parentName = null; }
@@ -9101,6 +9124,14 @@ var JsonObject = /** @class */ (function () {
9101
9124
  return;
9102
9125
  if (options.version && !prop.isAvailableInVersion(options.version))
9103
9126
  return;
9127
+ this.valueToJsonCore(obj, result, prop, options);
9128
+ };
9129
+ JsonObject.prototype.valueToJsonCore = function (obj, result, prop, options) {
9130
+ var serProp = prop.getSerializedProperty(obj, options.version);
9131
+ if (serProp && serProp !== prop) {
9132
+ this.valueToJsonCore(obj, result, serProp, options);
9133
+ return;
9134
+ }
9104
9135
  var value = prop.getSerializableValue(obj);
9105
9136
  if (!options.storeDefaults && prop.isDefaultValueByObj(obj, value))
9106
9137
  return;
@@ -9644,7 +9675,11 @@ var LocalizableString = /** @class */ (function () {
9644
9675
  keys[0] == _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].localization.defaultLocaleName &&
9645
9676
  !_settings__WEBPACK_IMPORTED_MODULE_2__["settings"].serialization.localizableStringSerializeAsObject)
9646
9677
  return this.values[keys[0]];
9647
- return this.values;
9678
+ var res = {};
9679
+ for (var key in this.values) {
9680
+ res[key] = this.values[key];
9681
+ }
9682
+ return res;
9648
9683
  };
9649
9684
  LocalizableString.prototype.setJson = function (value) {
9650
9685
  if (!!this.sharedData) {
@@ -9990,7 +10025,7 @@ var englishStrings = {
9990
10025
  chooseFile: "Choose file(s)...",
9991
10026
  noFileChosen: "No file chosen",
9992
10027
  filePlaceholder: "Drag and drop a file here or click the button below to select a file to upload.",
9993
- confirmDelete: "Do you want to delete the record?",
10028
+ confirmDelete: "Are you sure you want to delete this record?",
9994
10029
  keyDuplicationError: "This value should be unique.",
9995
10030
  addColumn: "Add Column",
9996
10031
  addRow: "Add Row",
@@ -10033,12 +10068,12 @@ var englishStrings = {
10033
10068
  modalApplyButtonText: "Apply",
10034
10069
  filterStringPlaceholder: "Type to search...",
10035
10070
  emptyMessage: "No data to display",
10036
- noEntriesText: "There are no entries yet.\nClick the button below to add a new entry.",
10037
- noEntriesReadonlyText: "There are no entries.",
10071
+ noEntriesText: "No entries yet.\nClick the button below to add a new entry.",
10072
+ noEntriesReadonlyText: "No entries.",
10038
10073
  more: "More",
10039
10074
  tagboxDoneButtonCaption: "OK",
10040
- selectToRankEmptyRankedAreaText: "All choices are ranked",
10041
- selectToRankEmptyUnrankedAreaText: "Drag and drop choices here to rank them",
10075
+ selectToRankEmptyRankedAreaText: "All choices are selected for ranking",
10076
+ selectToRankEmptyUnrankedAreaText: "Drag choices here to rank them",
10042
10077
  ok: "OK",
10043
10078
  cancel: "Cancel",
10044
10079
  };
@@ -10295,14 +10330,14 @@ var SurveyQuestionBoolean = /** @class */ (function (_super) {
10295
10330
  react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("input", { ref: this.checkRef, type: "checkbox", name: this.question.name, value: this.question.booleanValue === null
10296
10331
  ? ""
10297
10332
  : this.question.booleanValue, id: this.question.inputId, className: cssClasses.control, disabled: this.isDisplayMode, checked: this.question.booleanValue || false, onChange: this.handleOnChange, 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-invalid": this.question.a11y_input_ariaInvalid, "aria-describedby": this.question.a11y_input_ariaDescribedBy }),
10298
- react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: cssClasses.sliderGhost, onClick: function (event) { return _this.handleOnLabelClick(event, false); } },
10299
- react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("span", { className: this.question.getLabelCss(false) }, this.renderLocString(this.question.locLabelFalse))),
10333
+ react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: cssClasses.sliderGhost, onClick: function (event) { return _this.handleOnLabelClick(event, _this.question.swapOrder); } },
10334
+ react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("span", { className: this.question.getLabelCss(this.question.swapOrder) }, this.renderLocString(this.question.locLabelLeft))),
10300
10335
  react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: cssClasses.switch, onClick: this.handleOnSwitchClick },
10301
10336
  react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("span", { className: cssClasses.slider }, this.question.isDeterminated && cssClasses.sliderText ?
10302
10337
  react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("span", { className: cssClasses.sliderText }, this.renderLocString(this.question.getCheckedLabel()))
10303
10338
  : null)),
10304
- react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: cssClasses.sliderGhost, onClick: function (event) { return _this.handleOnLabelClick(event, true); } },
10305
- react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("span", { className: this.question.getLabelCss(true) }, this.renderLocString(this.question.locLabelTrue))))));
10339
+ react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: cssClasses.sliderGhost, onClick: function (event) { return _this.handleOnLabelClick(event, !_this.question.swapOrder); } },
10340
+ react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("span", { className: this.question.getLabelCss(!this.question.swapOrder) }, this.renderLocString(this.question.locLabelRight))))));
10306
10341
  };
10307
10342
  return SurveyQuestionBoolean;
10308
10343
  }(_reactquestion_element__WEBPACK_IMPORTED_MODULE_1__["SurveyQuestionElementBase"]));
@@ -10864,7 +10899,7 @@ var SurveyFileChooseButton = /** @class */ (function (_super) {
10864
10899
  });
10865
10900
  SurveyFileChooseButton.prototype.render = function () {
10866
10901
  var _this = this;
10867
- return Object(_reactSurvey__WEBPACK_IMPORTED_MODULE_1__["attachKey2click"])(react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("label", { tabIndex: 0, className: this.question.getChooseFileCss(), htmlFor: this.question.inputId, "aria-label": this.question.chooseButtonText, onClick: function () { return _this.question.chooseFile(); } },
10902
+ return Object(_reactSurvey__WEBPACK_IMPORTED_MODULE_1__["attachKey2click"])(react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("label", { tabIndex: 0, className: this.question.getChooseFileCss(), htmlFor: this.question.inputId, "aria-label": this.question.chooseButtonText, onClick: function (e) { return _this.question.chooseFile(e.nativeEvent); } },
10868
10903
  (!!this.question.cssClasses.chooseFileIconId) ? react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_svg_icon_svg_icon__WEBPACK_IMPORTED_MODULE_3__["SvgIcon"], { title: this.question.chooseButtonText, iconName: this.question.cssClasses.chooseFileIconId, size: "auto" }) : null,
10869
10904
  react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span", null, this.question.chooseButtonText)));
10870
10905
  };
@@ -14389,7 +14424,6 @@ var SurveyPanelBase = /** @class */ (function (_super) {
14389
14424
  __extends(SurveyPanelBase, _super);
14390
14425
  function SurveyPanelBase(props) {
14391
14426
  var _this = _super.call(this, props) || this;
14392
- _this.renderedRowsCache = {};
14393
14427
  _this.rootRef = react__WEBPACK_IMPORTED_MODULE_0__["createRef"]();
14394
14428
  return _this;
14395
14429
  }
@@ -14472,20 +14506,8 @@ var SurveyPanelBase = /** @class */ (function (_super) {
14472
14506
  && this.panelBase.isVisible && !!this.panelBase.survey);
14473
14507
  };
14474
14508
  SurveyPanelBase.prototype.renderRows = function (css) {
14475
- if (this.changedStatePropName !== "rows") {
14476
- this.renderedRowsCache = {};
14477
- }
14478
- var rows = [];
14479
- var questionRows = this.panelBase.rows;
14480
- for (var i = 0; i < questionRows.length; i++) {
14481
- var row = this.renderedRowsCache[questionRows[i].id];
14482
- if (!row) {
14483
- row = this.createRow(questionRows[i], css);
14484
- this.renderedRowsCache[questionRows[i].id] = row;
14485
- }
14486
- rows.push(row);
14487
- }
14488
- return rows;
14509
+ var _this = this;
14510
+ return this.panelBase.rows.map(function (row) { return _this.createRow(row, css); });
14489
14511
  };
14490
14512
  SurveyPanelBase.prototype.createRow = function (row, css) {
14491
14513
  return (react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_row__WEBPACK_IMPORTED_MODULE_2__["SurveyRow"], { key: row.id, row: row, survey: this.survey, creator: this.creator, css: css }));
@@ -14831,7 +14853,9 @@ var SurveyProgressButtons = /** @class */ (function (_super) {
14831
14853
  }, 10);
14832
14854
  };
14833
14855
  SurveyProgressButtons.prototype.componentWillUnmount = function () {
14834
- this.respManager.dispose();
14856
+ if (!!this.respManager) {
14857
+ this.respManager.dispose();
14858
+ }
14835
14859
  _super.prototype.componentWillUnmount.call(this);
14836
14860
  };
14837
14861
  return SurveyProgressButtons;
@@ -17239,8 +17263,8 @@ var SurveyQuestionFile = /** @class */ (function (_super) {
17239
17263
  var clearButtonBottom = this.question.showRemoveButtonBottom ? this.renderClearButton(this.question.cssClasses.removeButtonBottom) : null;
17240
17264
  var fileNavigator = this.question.fileNavigatorVisible ? (react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_components_action_bar_action_bar__WEBPACK_IMPORTED_MODULE_1__["SurveyActionBar"], { model: this.question.fileNavigator })) : null;
17241
17265
  var fileInput = (this.isDisplayMode ?
17242
- react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("input", { type: "file", disabled: this.isDisplayMode, className: !this.isDisplayMode ? this.question.cssClasses.fileInput : this.question.getReadOnlyFileCss(), id: this.question.inputId, ref: function (input) { return (_this.setControl(input)); }, style: !this.isDisplayMode ? {} : { color: "transparent" }, onChange: !this.isDisplayMode ? this.question.doChange : (function () { }), multiple: this.question.allowMultiple, placeholder: this.question.title, accept: this.question.acceptedTypes }) : this.question.hasFileUI ?
17243
- react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("input", { type: "file", disabled: this.isDisplayMode, tabIndex: -1, className: !this.isDisplayMode ? this.question.cssClasses.fileInput : this.question.getReadOnlyFileCss(), id: this.question.inputId, ref: function (input) { return (_this.setControl(input)); }, style: !this.isDisplayMode ? {} : { color: "transparent" }, onChange: !this.isDisplayMode ? this.question.doChange : (function () { }), "aria-required": this.question.ariaRequired, "aria-label": this.question.ariaLabel, "aria-invalid": this.question.ariaInvalid, "aria-describedby": this.question.ariaDescribedBy, multiple: this.question.allowMultiple, title: this.question.inputTitle, accept: this.question.acceptedTypes, capture: this.question.renderCapture }) : null);
17266
+ react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("input", { type: "file", disabled: this.isDisplayMode, className: !this.isDisplayMode ? this.question.cssClasses.fileInput : this.question.getReadOnlyFileCss(), id: this.question.inputId, ref: function (input) { return (_this.setControl(input)); }, style: !this.isDisplayMode ? {} : { color: "transparent" }, multiple: this.question.allowMultiple, placeholder: this.question.title, accept: this.question.acceptedTypes }) : this.question.hasFileUI ?
17267
+ react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("input", { type: "file", disabled: this.isDisplayMode, tabIndex: -1, className: !this.isDisplayMode ? this.question.cssClasses.fileInput : this.question.getReadOnlyFileCss(), id: this.question.inputId, ref: function (input) { return (_this.setControl(input)); }, style: !this.isDisplayMode ? {} : { color: "transparent" }, "aria-required": this.question.ariaRequired, "aria-label": this.question.ariaLabel, "aria-invalid": this.question.ariaInvalid, "aria-describedby": this.question.ariaDescribedBy, multiple: this.question.allowMultiple, title: this.question.inputTitle, accept: this.question.acceptedTypes, capture: this.question.renderCapture }) : null);
17244
17268
  return (react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: this.question.fileRootCss },
17245
17269
  fileInput,
17246
17270
  react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: this.question.cssClasses.dragArea, onDrop: this.question.onDrop, onDragOver: this.question.onDragOver, onDragLeave: this.question.onDragLeave, onDragEnter: this.question.onDragEnter },
@@ -20543,29 +20567,45 @@ var settings = {
20543
20567
  */
20544
20568
  tagboxCloseOnSelect: false,
20545
20569
  /**
20546
- * A property that allows you to display a custom confirm dialog.
20570
+ * A function that activates a browser confirm dialog.
20547
20571
  *
20548
- * Set this property to a function that renders your custom dialog window. This function should return `true` if a user confirms an action or `false` otherwise.
20572
+ * Use the following code to execute this function:
20573
+ *
20574
+ * ```js
20575
+ * import { settings } from "survey-core";
20576
+ *
20577
+ * // `result` contains `true` if the action was confirmed or `false` otherwise
20578
+ * const result = settings.confirmActionFunc("Are you sure?");
20579
+ * ```
20580
+ *
20581
+ * You can redefine the `confirmActionFunc` function if you want to display a custom dialog window. Your function should return `true` if a user confirms an action or `false` otherwise.
20549
20582
  * @param message A message to be displayed in the confirm dialog window.
20550
20583
  */
20551
20584
  confirmActionFunc: function (message) {
20552
20585
  return confirm(message);
20553
20586
  },
20554
20587
  /**
20555
- * A property that allows you to display a custom confirm dialog in async mode or activate the standard browser dialog.
20588
+ * A function that activates a proprietary SurveyJS confirm dialog.
20556
20589
  *
20557
- * To display a custom confirm dialog, set this property to a function that renders it. This function should return `true` to be enabled; otherwise, a survey executes the [`confirmActionFunc`](#confirmActionFunc) function. Pass the dialog result as the `callback` parameter: `true` if a user confirms an action, `false` otherwise.
20558
- *
20559
- * To activate the standard browser dialog, set the `confirmActionAsync` property to a function that returns `false`. With this configuration, a survey falls back to the [`confirmActionFunc`](#confirmActionFunc) function, which renders the standard browser dialog by default.
20590
+ * Use the following code to execute this function:
20560
20591
  *
20561
20592
  * ```js
20562
20593
  * import { settings } from "survey-core";
20563
20594
  *
20564
- * // Display the standard browser dialog
20565
- * settings.confirmActionAsync = () => {
20566
- * return false;
20567
- * }
20595
+ * settings.confirmActionAsync("Are you sure?", (confirmed) => {
20596
+ * if (confirmed) {
20597
+ * // ...
20598
+ * // Proceed with the action
20599
+ * // ...
20600
+ * } else {
20601
+ * // ...
20602
+ * // Cancel the action
20603
+ * // ...
20604
+ * }
20605
+ * });
20568
20606
  * ```
20607
+ *
20608
+ * You can redefine the `confirmActionAsync` function if you want to display a custom dialog window. Your function should return `true` to be enabled; otherwise, a survey executes the [`confirmActionFunc`](#confirmActionFunc) function. Pass the dialog result as the `callback` parameter: `true` if a user confirms an action, `false` otherwise.
20569
20609
  * @param message A message to be displayed in the confirm dialog window.
20570
20610
  * @param callback A callback function that should be called with `true` if a user confirms an action or `false` otherwise.
20571
20611
  */