survey-react-ui 1.10.2 → 1.10.3

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.2",
3
+ "version": "1.10.3",
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": "*",
24
+ "survey-core": "1.10.3",
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.2
2
+ * surveyjs - Survey JavaScript library v1.10.3
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
  */
@@ -164,9 +164,9 @@ function createDropdownActionModelAdvanced(actionOptions, listOptions, popupOpti
164
164
  }, listOptions.allowSelection, listOptions.selectedItem);
165
165
  listModel.locOwner = locOwner;
166
166
  listModel.setOnFilterStringChangedCallback(listOptions.onFilterStringChangedCallback);
167
- var innerPopupModel = new _popup__WEBPACK_IMPORTED_MODULE_4__["PopupModel"]("sv-list", { model: listModel }, popupOptions === null || popupOptions === void 0 ? void 0 : popupOptions.verticalPosition, popupOptions === null || popupOptions === void 0 ? void 0 : popupOptions.horizontalPosition, popupOptions === null || popupOptions === void 0 ? void 0 : popupOptions.showPointer, popupOptions === null || popupOptions === void 0 ? void 0 : popupOptions.isModal, popupOptions === null || popupOptions === void 0 ? void 0 : popupOptions.onCancel, popupOptions === null || popupOptions === void 0 ? void 0 : popupOptions.onApply, popupOptions === null || popupOptions === void 0 ? void 0 : popupOptions.onHide, popupOptions === null || popupOptions === void 0 ? void 0 : popupOptions.onShow, popupOptions === null || popupOptions === void 0 ? void 0 : popupOptions.cssClass, popupOptions === null || popupOptions === void 0 ? void 0 : popupOptions.title, function () {
168
- listModel.dispose();
169
- });
167
+ var options = popupOptions || {};
168
+ options.onDispose = function () { listModel.dispose(); };
169
+ var innerPopupModel = new _popup__WEBPACK_IMPORTED_MODULE_4__["PopupModel"]("sv-list", { model: listModel }, options);
170
170
  innerPopupModel.displayMode = popupOptions === null || popupOptions === void 0 ? void 0 : popupOptions.displayMode;
171
171
  var newActionOptions = Object.assign({}, actionOptions, {
172
172
  component: "sv-action-bar-item-dropdown",
@@ -190,7 +190,6 @@ var BaseAction = /** @class */ (function (_super) {
190
190
  function BaseAction() {
191
191
  var _this = _super !== null && _super.apply(this, arguments) || this;
192
192
  _this.rendredIdValue = BaseAction.getNextRendredId();
193
- _this.iconSize = 24;
194
193
  return _this;
195
194
  }
196
195
  BaseAction.getNextRendredId = function () { return BaseAction.renderedId++; };
@@ -393,7 +392,7 @@ var BaseAction = /** @class */ (function (_super) {
393
392
  Object(_jsonobject__WEBPACK_IMPORTED_MODULE_2__["property"])()
394
393
  ], BaseAction.prototype, "iconName", void 0);
395
394
  __decorate([
396
- Object(_jsonobject__WEBPACK_IMPORTED_MODULE_2__["property"])()
395
+ Object(_jsonobject__WEBPACK_IMPORTED_MODULE_2__["property"])({ defaultValue: 24 })
397
396
  ], BaseAction.prototype, "iconSize", void 0);
398
397
  __decorate([
399
398
  Object(_jsonobject__WEBPACK_IMPORTED_MODULE_2__["property"])()
@@ -1267,6 +1266,8 @@ var Base = /** @class */ (function () {
1267
1266
  * A new value for the property.
1268
1267
  * - `options.oldValue`: `any`\
1269
1268
  * An old value of the property. If the property is an array, `oldValue` contains the same array as `newValue` does.
1269
+ *
1270
+ * If you need to add and remove property change event handlers dynamically, use the [`registerPropertyChangedHandlers`](#registerPropertyChangedHandlers) and [`unregisterPropertyChangedHandlers`](#unregisterPropertyChangedHandlers) methods instead.
1270
1271
  */
1271
1272
  this.onPropertyChanged = this.addEvent();
1272
1273
  /**
@@ -1837,9 +1838,11 @@ var Base = /** @class */ (function () {
1837
1838
  return res;
1838
1839
  };
1839
1840
  /**
1840
- * Registers a function to call when a property value changes.
1841
+ * Registers a single value change handler for one or multiple properties.
1842
+ *
1843
+ * The `registerPropertyChangedHandlers` and [`unregisterPropertyChangedHandlers`](#unregisterPropertyChangedHandlers) methods allow you to manage property change event handlers dynamically. If you only need to attach an event handler without removing it afterwards, you can use the [`onPropertyChanged`](#onPropertyChanged) event instead.
1841
1844
  * @param propertyNames An array of one or multiple property names.
1842
- * @param handler A function to call when one of the listed properties change.
1845
+ * @param handler A function to call when one of the listed properties change. Accepts a new property value as an argument.
1843
1846
  * @param key *(Optional)* A key that identifies the current registration. If a function for one of the properties is already registered with the same key, the function will be overwritten. You can also use the key to subsequently unregister handlers.
1844
1847
  * @see unregisterPropertyChangedHandlers
1845
1848
  */
@@ -3630,7 +3633,7 @@ __webpack_require__.r(__webpack_exports__);
3630
3633
 
3631
3634
 
3632
3635
 
3633
- Object(survey_core__WEBPACK_IMPORTED_MODULE_2__["checkLibraryVersion"])("" + "1.10.2", "survey-react-ui");
3636
+ Object(survey_core__WEBPACK_IMPORTED_MODULE_2__["checkLibraryVersion"])("" + "1.10.3", "survey-react-ui");
3634
3637
 
3635
3638
 
3636
3639
  /***/ }),
@@ -9617,10 +9620,18 @@ var JsonMetadata = /** @class */ (function () {
9617
9620
  return metaClass.getAllProperties();
9618
9621
  };
9619
9622
  JsonMetadata.prototype.getPropertiesByObj = function (obj) {
9620
- if (!obj || !obj.getType)
9623
+ var type = !!obj && !!obj.getType ? obj.getType() : undefined;
9624
+ if (!type)
9621
9625
  return [];
9622
- var props = this.getProperties(obj.getType());
9626
+ var props = this.getProperties(type);
9623
9627
  var dynamicProps = this.getDynamicPropertiesByObj(obj);
9628
+ for (var i = dynamicProps.length - 1; i >= 0; i--) {
9629
+ if (this.findProperty(type, dynamicProps[i].name)) {
9630
+ dynamicProps.splice(i, 1);
9631
+ }
9632
+ }
9633
+ if (dynamicProps.length === 0)
9634
+ return props;
9624
9635
  return [].concat(props).concat(dynamicProps);
9625
9636
  };
9626
9637
  JsonMetadata.prototype.addDynamicPropertiesIntoObj = function (dest, src, props) {
@@ -10331,7 +10342,7 @@ var JsonObject = /** @class */ (function () {
10331
10342
  this.removePosFromObj(value);
10332
10343
  };
10333
10344
  JsonObject.prototype.removePosFromObj = function (obj) {
10334
- if (!obj)
10345
+ if (!obj || typeof obj.getType === "function")
10335
10346
  return;
10336
10347
  if (Array.isArray(obj)) {
10337
10348
  for (var i = 0; i < obj.length; i++) {
@@ -11551,7 +11562,7 @@ var englishStrings = {
11551
11562
  questionsProgressText: "Answered {0}/{1} questions",
11552
11563
  emptySurvey: "The survey doesn't contain any visible elements.",
11553
11564
  completingSurvey: "Thank you for completing the survey",
11554
- completingSurveyBefore: "Our records show that you have already completed this survey.",
11565
+ completingSurveyBefore: "You have already completed this survey.",
11555
11566
  loadingSurvey: "Loading Survey...",
11556
11567
  placeholder: "Select...",
11557
11568
  ratingOptionsCaption: "Select...",
@@ -11601,7 +11612,7 @@ var englishStrings = {
11601
11612
  savingData: "The results are being saved on the server...",
11602
11613
  savingDataError: "An error occurred and we could not save the results.",
11603
11614
  savingDataSuccess: "The results were saved successfully!",
11604
- savingExceedSize: "Your response exceeds 64KB. Please reduce the size of your file(s) and try again or contact a survey owner.",
11615
+ savingExceedSize: "Your response exceeds 64KB. Please reduce the size of your file(s) and try again or contact the survey owner.",
11605
11616
  saveAgainButton: "Try again",
11606
11617
  timerMin: "min",
11607
11618
  timerSec: "sec",
@@ -11687,36 +11698,29 @@ var __decorate = (undefined && undefined.__decorate) || function (decorators, ta
11687
11698
 
11688
11699
  var PopupModel = /** @class */ (function (_super) {
11689
11700
  __extends(PopupModel, _super);
11690
- function PopupModel(contentComponentName, contentComponentData, verticalPosition, horizontalPosition, showPointer, isModal, onCancel, onApply, onHide, onShow, cssClass, title, onDispose) {
11691
- if (verticalPosition === void 0) { verticalPosition = "bottom"; }
11692
- if (horizontalPosition === void 0) { horizontalPosition = "left"; }
11693
- if (showPointer === void 0) { showPointer = true; }
11694
- if (isModal === void 0) { isModal = false; }
11695
- if (onCancel === void 0) { onCancel = function () { }; }
11696
- if (onApply === void 0) { onApply = function () { return true; }; }
11697
- if (onHide === void 0) { onHide = function () { }; }
11698
- if (onShow === void 0) { onShow = function () { }; }
11699
- if (cssClass === void 0) { cssClass = ""; }
11700
- if (title === void 0) { title = ""; }
11701
- if (onDispose === void 0) { onDispose = function () { }; }
11701
+ function PopupModel(contentComponentName, contentComponentData, option1, option2) {
11702
11702
  var _this = _super.call(this) || this;
11703
- _this.onDispose = onDispose;
11704
11703
  _this.focusFirstInputSelector = "";
11704
+ _this.onCancel = function () { };
11705
+ _this.onApply = function () { return true; };
11706
+ _this.onHide = function () { };
11707
+ _this.onShow = function () { };
11708
+ _this.onDispose = function () { };
11705
11709
  _this.onVisibilityChanged = _this.addEvent();
11706
11710
  _this.onFooterActionsCreated = _this.addEvent();
11707
11711
  _this.onRecalculatePosition = _this.addEvent();
11708
11712
  _this.contentComponentName = contentComponentName;
11709
11713
  _this.contentComponentData = contentComponentData;
11710
- _this.verticalPosition = verticalPosition;
11711
- _this.horizontalPosition = horizontalPosition;
11712
- _this.showPointer = showPointer;
11713
- _this.isModal = isModal;
11714
- _this.onCancel = onCancel;
11715
- _this.onApply = onApply;
11716
- _this.onHide = onHide;
11717
- _this.onShow = onShow;
11718
- _this.cssClass = cssClass;
11719
- _this.title = title;
11714
+ if (!!option1 && typeof option1 === "string") {
11715
+ _this.verticalPosition = option1;
11716
+ _this.horizontalPosition = option2;
11717
+ }
11718
+ else if (!!option1) {
11719
+ var popupOptions = option1;
11720
+ for (var key in popupOptions) {
11721
+ _this[key] = popupOptions[key];
11722
+ }
11723
+ }
11720
11724
  return _this;
11721
11725
  }
11722
11726
  PopupModel.prototype.refreshInnerModel = function () {
@@ -11772,7 +11776,7 @@ var PopupModel = /** @class */ (function (_super) {
11772
11776
  Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: "left" })
11773
11777
  ], PopupModel.prototype, "horizontalPosition", void 0);
11774
11778
  __decorate([
11775
- Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: false })
11779
+ Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: true })
11776
11780
  ], PopupModel.prototype, "showPointer", void 0);
11777
11781
  __decorate([
11778
11782
  Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: false })
@@ -11783,18 +11787,6 @@ var PopupModel = /** @class */ (function (_super) {
11783
11787
  __decorate([
11784
11788
  Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: true })
11785
11789
  ], PopupModel.prototype, "isFocusedContainer", void 0);
11786
- __decorate([
11787
- Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: function () { } })
11788
- ], PopupModel.prototype, "onCancel", void 0);
11789
- __decorate([
11790
- Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: function () { return true; } })
11791
- ], PopupModel.prototype, "onApply", void 0);
11792
- __decorate([
11793
- Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: function () { } })
11794
- ], PopupModel.prototype, "onHide", void 0);
11795
- __decorate([
11796
- Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: function () { } })
11797
- ], PopupModel.prototype, "onShow", void 0);
11798
11790
  __decorate([
11799
11791
  Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: "" })
11800
11792
  ], PopupModel.prototype, "cssClass", void 0);
@@ -12086,7 +12078,7 @@ var SurveyQuestionBoolean = /** @class */ (function (_super) {
12086
12078
  react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: cssClasses.sliderGhost, onClick: function (event) { return _this.handleOnLabelClick(event, _this.question.swapOrder); } },
12087
12079
  react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("span", { className: this.question.getLabelCss(this.question.swapOrder) }, this.renderLocString(this.question.locLabelLeft))),
12088
12080
  react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: cssClasses.switch, onClick: this.handleOnSwitchClick },
12089
- react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("span", { className: cssClasses.slider }, this.question.isDeterminated && cssClasses.sliderText ?
12081
+ react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("span", { className: cssClasses.slider, style: { marginLeft: this.question.thumbMargin } }, this.question.isDeterminated && cssClasses.sliderText ?
12090
12082
  react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("span", { className: cssClasses.sliderText }, this.renderLocString(this.question.getCheckedLabel()))
12091
12083
  : null)),
12092
12084
  react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: cssClasses.sliderGhost, onClick: function (event) { return _this.handleOnLabelClick(event, !_this.question.swapOrder); } },
@@ -24444,10 +24436,15 @@ var AnimationUtils = /** @class */ (function () {
24444
24436
  options.onBeforeRunAnimation && options.onBeforeRunAnimation(element);
24445
24437
  }
24446
24438
  };
24439
+ AnimationUtils.prototype.getCssClasses = function (options) {
24440
+ return options.cssClass.replace(/\s+$/, "").split(/\s+/);
24441
+ };
24447
24442
  AnimationUtils.prototype.runAnimation = function (element, options, callback) {
24448
24443
  if (element && options.cssClass) {
24449
24444
  this.reflow(element);
24450
- element.classList.add(options.cssClass);
24445
+ this.getCssClasses(options).forEach(function (cssClass) {
24446
+ element.classList.add(cssClass);
24447
+ });
24451
24448
  this.onAnimationEnd(element, callback, options);
24452
24449
  }
24453
24450
  else {
@@ -24456,7 +24453,9 @@ var AnimationUtils = /** @class */ (function () {
24456
24453
  };
24457
24454
  AnimationUtils.prototype.clearHtmlElement = function (element, options) {
24458
24455
  if (element && options.cssClass) {
24459
- element.classList.remove(options.cssClass);
24456
+ this.getCssClasses(options).forEach(function (cssClass) {
24457
+ element.classList.remove(cssClass);
24458
+ });
24460
24459
  }
24461
24460
  };
24462
24461
  AnimationUtils.prototype.onNextRender = function (callback, runEarly, isCancel) {