survey-react-ui 1.10.5 → 1.10.6

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.5",
3
+ "version": "1.10.6",
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.5",
24
+ "survey-core": "1.10.6",
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.5
2
+ * surveyjs - Survey JavaScript library v1.10.6
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
  */
@@ -105,13 +105,14 @@ return /******/ (function(modules) { // webpackBootstrap
105
105
  /*!*******************************!*\
106
106
  !*** ./src/actions/action.ts ***!
107
107
  \*******************************/
108
- /*! exports provided: createDropdownActionModel, createDropdownActionModelAdvanced, getActionDropdownButtonTarget, BaseAction, Action, ActionDropdownViewModel */
108
+ /*! exports provided: createDropdownActionModel, createDropdownActionModelAdvanced, createPopupModelWithListModel, getActionDropdownButtonTarget, BaseAction, Action, ActionDropdownViewModel */
109
109
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
110
110
 
111
111
  "use strict";
112
112
  __webpack_require__.r(__webpack_exports__);
113
113
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createDropdownActionModel", function() { return createDropdownActionModel; });
114
114
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createDropdownActionModelAdvanced", function() { return createDropdownActionModelAdvanced; });
115
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createPopupModelWithListModel", function() { return createPopupModelWithListModel; });
115
116
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getActionDropdownButtonTarget", function() { return getActionDropdownButtonTarget; });
116
117
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BaseAction", function() { return BaseAction; });
117
118
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Action", function() { return Action; });
@@ -152,36 +153,53 @@ var __decorate = (undefined && undefined.__decorate) || function (decorators, ta
152
153
 
153
154
 
154
155
  function createDropdownActionModel(actionOptions, dropdownOptions, locOwner) {
155
- return createDropdownActionModelAdvanced(actionOptions, dropdownOptions, dropdownOptions, locOwner);
156
+ dropdownOptions.locOwner = locOwner;
157
+ return createDropdownActionModelAdvanced(actionOptions, dropdownOptions, dropdownOptions);
156
158
  }
157
- function createDropdownActionModelAdvanced(actionOptions, listOptions, popupOptions, locOwner) {
158
- var listModel = new _list__WEBPACK_IMPORTED_MODULE_3__["ListModel"](listOptions.items, function (item) {
159
+ function createDropdownActionModelAdvanced(actionOptions, listOptions, popupOptions) {
160
+ var _a;
161
+ var originalSelectionChanged = listOptions.onSelectionChanged;
162
+ listOptions.onSelectionChanged = function (item) {
163
+ var params = [];
164
+ for (var _i = 1; _i < arguments.length; _i++) {
165
+ params[_i - 1] = arguments[_i];
166
+ }
159
167
  if (newAction.hasTitle) {
160
168
  newAction.title = item.title;
161
169
  }
162
- listOptions.onSelectionChanged(item);
163
- innerPopupModel.toggleVisibility();
164
- }, listOptions.allowSelection, listOptions.selectedItem);
165
- listModel.locOwner = locOwner;
166
- listModel.setOnFilterStringChangedCallback(listOptions.onFilterStringChangedCallback);
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
- innerPopupModel.displayMode = popupOptions === null || popupOptions === void 0 ? void 0 : popupOptions.displayMode;
170
+ originalSelectionChanged(item, params);
171
+ };
172
+ var popupModel = createPopupModelWithListModel(listOptions, popupOptions);
171
173
  var newActionOptions = Object.assign({}, actionOptions, {
172
174
  component: "sv-action-bar-item-dropdown",
173
- popupModel: innerPopupModel,
175
+ popupModel: popupModel,
174
176
  action: function (action, isUserAction) {
175
177
  !!(actionOptions.action) && actionOptions.action();
176
- innerPopupModel.isFocusedContent = !isUserAction || listModel.showFilter;
177
- innerPopupModel.toggleVisibility();
178
- listModel.scrollToSelectedItem();
178
+ popupModel.isFocusedContent = popupModel.isFocusedContent || !isUserAction;
179
+ popupModel.show();
179
180
  },
180
181
  });
181
182
  var newAction = new Action(newActionOptions);
182
- newAction.data = listModel;
183
+ newAction.data = (_a = popupModel.contentComponentData) === null || _a === void 0 ? void 0 : _a.model;
183
184
  return newAction;
184
185
  }
186
+ function createPopupModelWithListModel(listOptions, popupOptions) {
187
+ var listModel = new _list__WEBPACK_IMPORTED_MODULE_3__["ListModel"](listOptions);
188
+ listModel.onSelectionChanged = function (item) {
189
+ listOptions.onSelectionChanged(item);
190
+ popupModel.hide();
191
+ };
192
+ var _popupOptions = popupOptions || {};
193
+ _popupOptions.onDispose = function () { listModel.dispose(); };
194
+ var popupModel = new _popup__WEBPACK_IMPORTED_MODULE_4__["PopupModel"]("sv-list", { model: listModel }, _popupOptions);
195
+ popupModel.isFocusedContent = listModel.showFilter;
196
+ popupModel.onShow = function () {
197
+ if (!!_popupOptions.onShow)
198
+ _popupOptions.onShow();
199
+ listModel.scrollToSelectedItem();
200
+ };
201
+ return popupModel;
202
+ }
185
203
  function getActionDropdownButtonTarget(container) {
186
204
  return container === null || container === void 0 ? void 0 : container.previousElementSibling;
187
205
  }
@@ -3638,7 +3656,7 @@ __webpack_require__.r(__webpack_exports__);
3638
3656
 
3639
3657
 
3640
3658
 
3641
- Object(survey_core__WEBPACK_IMPORTED_MODULE_2__["checkLibraryVersion"])("" + "1.10.5", "survey-react-ui");
3659
+ Object(survey_core__WEBPACK_IMPORTED_MODULE_2__["checkLibraryVersion"])("" + "1.10.6", "survey-react-ui");
3642
3660
 
3643
3661
 
3644
3662
  /***/ }),
@@ -10623,8 +10641,28 @@ var ListModel = /** @class */ (function (_super) {
10623
10641
  var level = itemValue.level || 0;
10624
10642
  return (level + 1) * ListModel.INDENT + "px";
10625
10643
  };
10626
- _this.setItems(items);
10627
- _this.selectedItem = selectedItem;
10644
+ if (Object.keys(items).indexOf("items") !== -1) {
10645
+ var options_1 = items;
10646
+ Object.keys(options_1).forEach(function (key) {
10647
+ switch (key) {
10648
+ case "items":
10649
+ _this.setItems(options_1.items);
10650
+ break;
10651
+ case "onFilterStringChangedCallback":
10652
+ _this.setOnFilterStringChangedCallback(options_1.onFilterStringChangedCallback);
10653
+ break;
10654
+ case "onTextSearchCallback":
10655
+ _this.setOnTextSearchCallback(options_1.onTextSearchCallback);
10656
+ break;
10657
+ default:
10658
+ _this[key] = options_1[key];
10659
+ }
10660
+ });
10661
+ }
10662
+ else {
10663
+ _this.setItems(items);
10664
+ _this.selectedItem = selectedItem;
10665
+ }
10628
10666
  return _this;
10629
10667
  }
10630
10668
  ListModel.prototype.hasText = function (item, filterStringInLow) {
@@ -10851,6 +10889,7 @@ var ListModel = /** @class */ (function (_super) {
10851
10889
  };
10852
10890
  ListModel.prototype.addScrollEventListener = function (handler) {
10853
10891
  if (!!handler) {
10892
+ this.removeScrollEventListener();
10854
10893
  this.scrollHandler = handler;
10855
10894
  }
10856
10895
  if (!!this.scrollHandler) {
@@ -11754,13 +11793,6 @@ var PopupModel = /** @class */ (function (_super) {
11754
11793
  }
11755
11794
  this.setPropertyValue("isVisible", value);
11756
11795
  this.onVisibilityChanged.fire(this, { model: this, isVisible: value });
11757
- if (this.isVisible) {
11758
- this.onShow();
11759
- }
11760
- else {
11761
- this.refreshInnerModel();
11762
- this.onHide();
11763
- }
11764
11796
  },
11765
11797
  enumerable: false,
11766
11798
  configurable: true
@@ -11768,6 +11800,14 @@ var PopupModel = /** @class */ (function (_super) {
11768
11800
  PopupModel.prototype.toggleVisibility = function () {
11769
11801
  this.isVisible = !this.isVisible;
11770
11802
  };
11803
+ PopupModel.prototype.show = function () {
11804
+ if (!this.isVisible)
11805
+ this.isVisible = true;
11806
+ };
11807
+ PopupModel.prototype.hide = function () {
11808
+ if (this.isVisible)
11809
+ this.isVisible = false;
11810
+ };
11771
11811
  PopupModel.prototype.recalculatePosition = function (isResetHeight) {
11772
11812
  this.onRecalculatePosition.fire(this, { isResetHeight: isResetHeight });
11773
11813
  };
@@ -11776,6 +11816,10 @@ var PopupModel = /** @class */ (function (_super) {
11776
11816
  this.onFooterActionsCreated.fire(this, options);
11777
11817
  return options.actions;
11778
11818
  };
11819
+ PopupModel.prototype.onHiding = function () {
11820
+ this.refreshInnerModel();
11821
+ this.onHide();
11822
+ };
11779
11823
  PopupModel.prototype.dispose = function () {
11780
11824
  _super.prototype.dispose.call(this);
11781
11825
  this.onDispose();
@@ -19942,6 +19986,8 @@ var SurveyQuestionMatrixDropdownCell = /** @class */ (function (_super) {
19942
19986
  return this.cell.headers;
19943
19987
  };
19944
19988
  SurveyQuestionMatrixDropdownCell.prototype.renderQuestion = function () {
19989
+ if (!this.question.isVisible)
19990
+ return react__WEBPACK_IMPORTED_MODULE_0__["createElement"](react__WEBPACK_IMPORTED_MODULE_0__["Fragment"], null);
19945
19991
  if (!this.cell.isChoice)
19946
19992
  return _reactquestion__WEBPACK_IMPORTED_MODULE_2__["SurveyQuestion"].renderQuestionBody(this.creator, this.question);
19947
19993
  if (this.cell.isOtherChoice)