survey-react 1.11.9 → 1.11.10

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/survey.react.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - Survey JavaScript library v1.11.9
2
+ * surveyjs - Survey JavaScript library v1.11.10
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
  */
@@ -7142,6 +7142,7 @@ var DragDropCore = /** @class */ (function () {
7142
7142
  this.onGhostPositionChanged = new _base__WEBPACK_IMPORTED_MODULE_0__["EventBase"]();
7143
7143
  this.onDragStart = new _base__WEBPACK_IMPORTED_MODULE_0__["EventBase"]();
7144
7144
  this.onDragEnd = new _base__WEBPACK_IMPORTED_MODULE_0__["EventBase"]();
7145
+ this.onDragClear = new _base__WEBPACK_IMPORTED_MODULE_0__["EventBase"]();
7145
7146
  this.onBeforeDrop = this.onDragStart;
7146
7147
  this.onAfterDrop = this.onDragEnd;
7147
7148
  this.draggedElement = null;
@@ -7201,6 +7202,8 @@ var DragDropCore = /** @class */ (function () {
7201
7202
  var shortcutText = this.getShortcutText(this.draggedElement);
7202
7203
  this.domAdapter.draggedElementShortcut = this.createDraggedElementShortcut(shortcutText, draggedElementNode, event);
7203
7204
  this.onStartDrag(event);
7205
+ var fromElement = this.draggedElement && this.draggedElement.parent;
7206
+ this.onDragStart.fire(this, { fromElement: fromElement, draggedElement: this.draggedElement });
7204
7207
  };
7205
7208
  DragDropCore.prototype.onStartDrag = function (event) {
7206
7209
  };
@@ -7294,7 +7297,6 @@ var DragDropCore = /** @class */ (function () {
7294
7297
  DragDropCore.prototype.drop = function () {
7295
7298
  if (this.allowDropHere) {
7296
7299
  var fromElement = this.draggedElement.parent;
7297
- this.onDragStart.fire(this, { fromElement: fromElement, draggedElement: this.draggedElement });
7298
7300
  var newElement = this.doDrop();
7299
7301
  this.onDragEnd.fire(this, { fromElement: fromElement, draggedElement: newElement, toElement: this.dropTarget });
7300
7302
  }
@@ -7305,6 +7307,7 @@ var DragDropCore = /** @class */ (function () {
7305
7307
  this.draggedElement = null;
7306
7308
  this.isBottom = null;
7307
7309
  this.parentElement = null;
7310
+ this.onDragClear.fire(this, {});
7308
7311
  };
7309
7312
  return DragDropCore;
7310
7313
  }());
@@ -8159,11 +8162,12 @@ __webpack_require__.r(__webpack_exports__);
8159
8162
  /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts");
8160
8163
  /* harmony import */ var _list__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./list */ "./src/list.ts");
8161
8164
  /* harmony import */ var _popup__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./popup */ "./src/popup.ts");
8162
- /* harmony import */ var _question_dropdown__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./question_dropdown */ "./src/question_dropdown.ts");
8163
- /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./settings */ "./src/settings.ts");
8164
- /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts");
8165
- /* harmony import */ var _utils_devices__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./utils/devices */ "./src/utils/devices.ts");
8166
- /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./utils/utils */ "./src/utils/utils.ts");
8165
+ /* harmony import */ var _popup_dropdown_view_model__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./popup-dropdown-view-model */ "./src/popup-dropdown-view-model.ts");
8166
+ /* harmony import */ var _question_dropdown__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./question_dropdown */ "./src/question_dropdown.ts");
8167
+ /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./settings */ "./src/settings.ts");
8168
+ /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts");
8169
+ /* harmony import */ var _utils_devices__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./utils/devices */ "./src/utils/devices.ts");
8170
+ /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./utils/utils */ "./src/utils/utils.ts");
8167
8171
  var __extends = (undefined && undefined.__extends) || (function () {
8168
8172
  var extendStatics = function (d, b) {
8169
8173
  extendStatics = Object.setPrototypeOf ||
@@ -8196,6 +8200,7 @@ var __decorate = (undefined && undefined.__decorate) || function (decorators, ta
8196
8200
 
8197
8201
 
8198
8202
 
8203
+
8199
8204
  var DropdownListModel = /** @class */ (function (_super) {
8200
8205
  __extends(DropdownListModel, _super);
8201
8206
  function DropdownListModel(question, onSelectionChanged) {
@@ -8240,7 +8245,7 @@ var DropdownListModel = /** @class */ (function (_super) {
8240
8245
  configurable: true
8241
8246
  });
8242
8247
  DropdownListModel.prototype.getFocusFirstInputSelector = function () {
8243
- if (_utils_devices__WEBPACK_IMPORTED_MODULE_9__["IsTouch"]) {
8248
+ if (_utils_devices__WEBPACK_IMPORTED_MODULE_10__["IsTouch"]) {
8244
8249
  return this.isValueEmpty(this.question.value) ? this.itemSelector : this.selectedItemSelector;
8245
8250
  }
8246
8251
  else {
@@ -8280,14 +8285,14 @@ var DropdownListModel = /** @class */ (function (_super) {
8280
8285
  var _this = this;
8281
8286
  var isUpdate = (this.itemsSettings.skip + 1) < this.itemsSettings.totalCount;
8282
8287
  if (!this.itemsSettings.skip || isUpdate) {
8283
- if (!!this.filterString && _settings__WEBPACK_IMPORTED_MODULE_7__["settings"].dropdownSearchDelay > 0) {
8288
+ if (!!this.filterString && _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].dropdownSearchDelay > 0) {
8284
8289
  if (!!this.timer) {
8285
8290
  clearTimeout(this.timer);
8286
8291
  this.timer = undefined;
8287
8292
  }
8288
8293
  this.timer = setTimeout(function () {
8289
8294
  _this.loadQuestionChoices(callbackAfterItemsLoaded);
8290
- }, _settings__WEBPACK_IMPORTED_MODULE_7__["settings"].dropdownSearchDelay);
8295
+ }, _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].dropdownSearchDelay);
8291
8296
  }
8292
8297
  else {
8293
8298
  this.loadQuestionChoices(callbackAfterItemsLoaded);
@@ -8297,15 +8302,33 @@ var DropdownListModel = /** @class */ (function (_super) {
8297
8302
  DropdownListModel.prototype.updatePopupFocusFirstInputSelector = function () {
8298
8303
  this._popupModel.focusFirstInputSelector = this.focusFirstInputSelector;
8299
8304
  };
8305
+ DropdownListModel.prototype.getDropdownMenuOptions = function () {
8306
+ var windowWidth = _global_variables_utils__WEBPACK_IMPORTED_MODULE_1__["DomWindowHelper"].getInnerWidth();
8307
+ var windowHeight = _global_variables_utils__WEBPACK_IMPORTED_MODULE_1__["DomWindowHelper"].getInnerHeight();
8308
+ var isTablet = Object(_popup_dropdown_view_model__WEBPACK_IMPORTED_MODULE_6__["calculateIsTablet"])(windowWidth, windowHeight);
8309
+ var menuType = "dropdown";
8310
+ var deviceType = "desktop";
8311
+ if (_utils_devices__WEBPACK_IMPORTED_MODULE_10__["IsTouch"]) {
8312
+ menuType = isTablet ? "popup" : "overlay";
8313
+ deviceType = isTablet ? "tablet" : "mobile";
8314
+ }
8315
+ return {
8316
+ menuType: menuType,
8317
+ deviceType: deviceType,
8318
+ hasTouchScreen: _utils_devices__WEBPACK_IMPORTED_MODULE_10__["IsTouch"],
8319
+ screenHeight: windowHeight,
8320
+ screenWidth: windowWidth
8321
+ };
8322
+ };
8300
8323
  DropdownListModel.prototype.createPopup = function () {
8301
8324
  var _this = this;
8302
8325
  var popupOptions = { verticalPosition: "bottom", horizontalPosition: "center", showPointer: false };
8303
8326
  this._popupModel = new _popup__WEBPACK_IMPORTED_MODULE_5__["PopupModel"]("sv-list", { model: this.listModel }, popupOptions);
8304
- this._popupModel.displayMode = _utils_devices__WEBPACK_IMPORTED_MODULE_9__["IsTouch"] ? "overlay" : "popup";
8327
+ this._popupModel.displayMode = _utils_devices__WEBPACK_IMPORTED_MODULE_10__["IsTouch"] ? "overlay" : "popup";
8305
8328
  this._popupModel.positionMode = "fixed";
8306
8329
  this._popupModel.isFocusedContainer = false;
8307
- this._popupModel.isFocusedContent = _utils_devices__WEBPACK_IMPORTED_MODULE_9__["IsTouch"];
8308
- this._popupModel.setWidthByTarget = !_utils_devices__WEBPACK_IMPORTED_MODULE_9__["IsTouch"];
8330
+ this._popupModel.isFocusedContent = _utils_devices__WEBPACK_IMPORTED_MODULE_10__["IsTouch"];
8331
+ this._popupModel.setWidthByTarget = !_utils_devices__WEBPACK_IMPORTED_MODULE_10__["IsTouch"];
8309
8332
  this._popupModel.locale = this.question.getLocale();
8310
8333
  this.updatePopupFocusFirstInputSelector();
8311
8334
  this.listModel.registerPropertyChangedHandlers(["showFilter"], function () {
@@ -8321,9 +8344,14 @@ var DropdownListModel = /** @class */ (function (_super) {
8321
8344
  _this.resetItemsSettings();
8322
8345
  _this.updateQuestionChoices();
8323
8346
  }
8324
- if (option.isVisible && !!_this.question.onOpenedCallBack) {
8347
+ if (option.isVisible) {
8325
8348
  _this.updatePopupFocusFirstInputSelector();
8326
- _this.question.onOpenedCallBack();
8349
+ var dropdownMenuOptions = _this.getDropdownMenuOptions();
8350
+ _this.question.processOpenDropdownMenu(dropdownMenuOptions);
8351
+ _this._popupModel.updateDisplayMode(dropdownMenuOptions.menuType);
8352
+ if (!!_this.question.onOpenedCallBack) {
8353
+ _this.question.onOpenedCallBack();
8354
+ }
8327
8355
  }
8328
8356
  if (!option.isVisible) {
8329
8357
  _this.onHidePopup();
@@ -8372,7 +8400,7 @@ var DropdownListModel = /** @class */ (function (_super) {
8372
8400
  if (_this.filteredItems)
8373
8401
  return _this.filteredItems.indexOf(item) >= 0;
8374
8402
  var textInLow = item.text.toLocaleLowerCase();
8375
- textInLow = _settings__WEBPACK_IMPORTED_MODULE_7__["settings"].comparator.normalizeTextCallback(textInLow, "filter");
8403
+ textInLow = _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].comparator.normalizeTextCallback(textInLow, "filter");
8376
8404
  var index = textInLow.indexOf(textToSearch.toLocaleLowerCase());
8377
8405
  return _this.question.searchMode == "startsWith" ? index == 0 : index > -1;
8378
8406
  });
@@ -8417,7 +8445,7 @@ var DropdownListModel = /** @class */ (function (_super) {
8417
8445
  model.actions.forEach(function (a) { return a.disableTabStop = true; });
8418
8446
  };
8419
8447
  DropdownListModel.prototype.updateCssClasses = function (popupCssClass, listCssClasses) {
8420
- this.popupModel.cssClass = new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_8__["CssClassBuilder"]().append(popupCssClass).append(this.popupCssClasses).toString();
8448
+ this.popupModel.cssClass = new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_9__["CssClassBuilder"]().append(popupCssClass).append(this.popupCssClasses).toString();
8421
8449
  this.listModel.cssClasses = listCssClasses;
8422
8450
  };
8423
8451
  DropdownListModel.prototype.resetFilterString = function () {
@@ -8618,14 +8646,14 @@ var DropdownListModel = /** @class */ (function (_super) {
8618
8646
  });
8619
8647
  Object.defineProperty(DropdownListModel.prototype, "inputMode", {
8620
8648
  get: function () {
8621
- return _utils_devices__WEBPACK_IMPORTED_MODULE_9__["IsTouch"] ? "none" : "text";
8649
+ return _utils_devices__WEBPACK_IMPORTED_MODULE_10__["IsTouch"] ? "none" : "text";
8622
8650
  },
8623
8651
  enumerable: false,
8624
8652
  configurable: true
8625
8653
  });
8626
8654
  DropdownListModel.prototype.setSearchEnabled = function (newValue) {
8627
- this.listModel.searchEnabled = _utils_devices__WEBPACK_IMPORTED_MODULE_9__["IsTouch"];
8628
- this.listModel.showSearchClearButton = _utils_devices__WEBPACK_IMPORTED_MODULE_9__["IsTouch"];
8655
+ this.listModel.searchEnabled = _utils_devices__WEBPACK_IMPORTED_MODULE_10__["IsTouch"];
8656
+ this.listModel.showSearchClearButton = _utils_devices__WEBPACK_IMPORTED_MODULE_10__["IsTouch"];
8629
8657
  this.searchEnabled = newValue;
8630
8658
  };
8631
8659
  DropdownListModel.prototype.setChoicesLazyLoadEnabled = function (newValue) {
@@ -8736,7 +8764,7 @@ var DropdownListModel = /** @class */ (function (_super) {
8736
8764
  event.stopPropagation();
8737
8765
  }
8738
8766
  else if (this.popupModel.isVisible && (event.keyCode === 13 || event.keyCode === 32 && (!this.question.searchEnabled || !this.inputString))) {
8739
- if (event.keyCode === 13 && this.question.searchEnabled && !this.inputString && this.question instanceof _question_dropdown__WEBPACK_IMPORTED_MODULE_6__["QuestionDropdownModel"] && !this._markdownMode && this.question.value) {
8767
+ if (event.keyCode === 13 && this.question.searchEnabled && !this.inputString && this.question instanceof _question_dropdown__WEBPACK_IMPORTED_MODULE_7__["QuestionDropdownModel"] && !this._markdownMode && this.question.value) {
8740
8768
  this._popupModel.hide();
8741
8769
  this.onClear(event);
8742
8770
  }
@@ -8765,7 +8793,7 @@ var DropdownListModel = /** @class */ (function (_super) {
8765
8793
  if (event.keyCode === 32 && this.question.searchEnabled) {
8766
8794
  return;
8767
8795
  }
8768
- Object(_utils_utils__WEBPACK_IMPORTED_MODULE_10__["doKey2ClickUp"])(event, { processEsc: false, disableTabStop: this.question.isInputReadOnly });
8796
+ Object(_utils_utils__WEBPACK_IMPORTED_MODULE_11__["doKey2ClickUp"])(event, { processEsc: false, disableTabStop: this.question.isInputReadOnly });
8769
8797
  }
8770
8798
  };
8771
8799
  DropdownListModel.prototype.onEscape = function () {
@@ -8780,11 +8808,11 @@ var DropdownListModel = /** @class */ (function (_super) {
8780
8808
  };
8781
8809
  DropdownListModel.prototype.onBlur = function (event) {
8782
8810
  this.focused = false;
8783
- if (this.popupModel.isVisible && _utils_devices__WEBPACK_IMPORTED_MODULE_9__["IsTouch"]) {
8811
+ if (this.popupModel.isVisible && _utils_devices__WEBPACK_IMPORTED_MODULE_10__["IsTouch"]) {
8784
8812
  this._popupModel.show();
8785
8813
  return;
8786
8814
  }
8787
- Object(_utils_utils__WEBPACK_IMPORTED_MODULE_10__["doKey2ClickBlur"])(event);
8815
+ Object(_utils_utils__WEBPACK_IMPORTED_MODULE_11__["doKey2ClickBlur"])(event);
8788
8816
  this._popupModel.hide();
8789
8817
  this.resetFilterString();
8790
8818
  this.inputString = null;
@@ -9960,8 +9988,8 @@ __webpack_require__.r(__webpack_exports__);
9960
9988
 
9961
9989
  var Version;
9962
9990
  var ReleaseDate;
9963
- Version = "" + "1.11.9";
9964
- ReleaseDate = "" + "2024-07-30";
9991
+ Version = "" + "1.11.10";
9992
+ ReleaseDate = "" + "2024-08-06";
9965
9993
  function checkLibraryVersion(ver, libraryName) {
9966
9994
  if (Version != ver) {
9967
9995
  var str = "survey-core has version '" + Version + "' and " + libraryName
@@ -16064,18 +16092,20 @@ var Const = /** @class */ (function (_super) {
16064
16092
  Const.prototype.getCorrectValue = function (value) {
16065
16093
  if (!value || typeof value != "string")
16066
16094
  return value;
16067
- if (this.isBooleanValue(value))
16095
+ if (OperandMaker.isBooleanValue(value))
16068
16096
  return value.toLowerCase() === "true";
16069
16097
  if (value.length > 1 &&
16070
16098
  this.isQuote(value[0]) &&
16071
16099
  this.isQuote(value[value.length - 1]))
16072
16100
  return value.substring(1, value.length - 1);
16073
- if (OperandMaker.isNumeric(value)) {
16074
- if (value.indexOf("0x") == 0)
16075
- return parseInt(value);
16076
- if (value.length > 1 && value[0] == "0" && (value.length < 2 || (value[1] !== "." && value[1] !== ",")))
16077
- return value;
16078
- return parseFloat(value);
16101
+ if (_helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isNumber(value)) {
16102
+ if (value[0] === "0" && value.indexOf("0x") != 0) {
16103
+ var len = value.length;
16104
+ var hasPoint = len > 1 && (value[1] === "." || value[1] === ",");
16105
+ if (!hasPoint && len > 1 || hasPoint && len < 2)
16106
+ return value;
16107
+ }
16108
+ return _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].getNumber(value);
16079
16109
  }
16080
16110
  return value;
16081
16111
  };
@@ -16086,10 +16116,6 @@ var Const = /** @class */ (function (_super) {
16086
16116
  Const.prototype.isQuote = function (ch) {
16087
16117
  return ch == "'" || ch == '"';
16088
16118
  };
16089
- Const.prototype.isBooleanValue = function (value) {
16090
- return (value &&
16091
- (value.toLowerCase() === "true" || value.toLowerCase() === "false"));
16092
- };
16093
16119
  return Const;
16094
16120
  }(Operand));
16095
16121
 
@@ -16247,27 +16273,11 @@ var OperandMaker = /** @class */ (function () {
16247
16273
  };
16248
16274
  OperandMaker.toOperandString = function (value) {
16249
16275
  if (!!value &&
16250
- !OperandMaker.isNumeric(value) &&
16276
+ !_helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isNumber(value) &&
16251
16277
  !OperandMaker.isBooleanValue(value))
16252
16278
  value = "'" + value + "'";
16253
16279
  return value;
16254
16280
  };
16255
- OperandMaker.isSpaceString = function (str) {
16256
- return !!str && !str.replace(" ", "");
16257
- };
16258
- OperandMaker.isNumeric = function (value) {
16259
- if (!!value &&
16260
- (value.indexOf("-") > -1 ||
16261
- value.indexOf("+") > 1 ||
16262
- value.indexOf("*") > -1 ||
16263
- value.indexOf("^") > -1 ||
16264
- value.indexOf("/") > -1 ||
16265
- value.indexOf("%") > -1))
16266
- return false;
16267
- if (OperandMaker.isSpaceString(value))
16268
- return false;
16269
- return _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isNumber(value);
16270
- };
16271
16281
  OperandMaker.isBooleanValue = function (value) {
16272
16282
  return (!!value &&
16273
16283
  (value.toLowerCase() === "true" || value.toLowerCase() === "false"));
@@ -17883,17 +17893,39 @@ var Helpers = /** @class */ (function () {
17883
17893
  return !isNaN(this.getNumber(value));
17884
17894
  };
17885
17895
  Helpers.getNumber = function (value) {
17886
- if (typeof value == "string" &&
17887
- !!value &&
17888
- value.indexOf("0x") == 0 &&
17889
- value.length > 32)
17890
- return NaN;
17896
+ var newValue = Helpers.getNumberCore(value);
17897
+ return _settings__WEBPACK_IMPORTED_MODULE_0__["settings"].parseNumber(value, newValue);
17898
+ };
17899
+ Helpers.getNumberCore = function (value) {
17900
+ if (typeof value == "string") {
17901
+ if (!value.trim())
17902
+ return NaN;
17903
+ if (value.indexOf("0x") == 0) {
17904
+ if (value.length > 32)
17905
+ return NaN;
17906
+ return parseInt(value);
17907
+ }
17908
+ if (Helpers.isStringHasOperator(value))
17909
+ return NaN;
17910
+ }
17891
17911
  value = this.prepareStringToNumber(value);
17892
17912
  var res = parseFloat(value);
17893
17913
  if (isNaN(res) || !isFinite(value))
17894
17914
  return NaN;
17895
17915
  return res;
17896
17916
  };
17917
+ Helpers.isStringHasOperator = function (str) {
17918
+ if (str.lastIndexOf("-") > 0)
17919
+ return false;
17920
+ if (str.lastIndexOf("+") > 0)
17921
+ return false;
17922
+ var operators = "*^/%";
17923
+ for (var i = 0; i < operators.length; i++) {
17924
+ if (str.indexOf(operators[i]) > -1)
17925
+ return true;
17926
+ }
17927
+ return false;
17928
+ };
17897
17929
  Helpers.prepareStringToNumber = function (val) {
17898
17930
  if (typeof val !== "string" || !val)
17899
17931
  return val;
@@ -37196,11 +37228,12 @@ function setStyles() {
37196
37228
  /*!******************************************!*\
37197
37229
  !*** ./src/popup-dropdown-view-model.ts ***!
37198
37230
  \******************************************/
37199
- /*! exports provided: PopupDropdownViewModel */
37231
+ /*! exports provided: calculateIsTablet, PopupDropdownViewModel */
37200
37232
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
37201
37233
 
37202
37234
  "use strict";
37203
37235
  __webpack_require__.r(__webpack_exports__);
37236
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "calculateIsTablet", function() { return calculateIsTablet; });
37204
37237
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PopupDropdownViewModel", function() { return PopupDropdownViewModel; });
37205
37238
  /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts");
37206
37239
  /* harmony import */ var _utils_popup__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils/popup */ "./src/utils/popup.ts");
@@ -37237,6 +37270,13 @@ var __decorate = (undefined && undefined.__decorate) || function (decorators, ta
37237
37270
 
37238
37271
 
37239
37272
 
37273
+ function calculateIsTablet(windowWidth, windowHeight) {
37274
+ var _windowWidth = windowWidth || _global_variables_utils__WEBPACK_IMPORTED_MODULE_6__["DomWindowHelper"].getInnerWidth();
37275
+ var _windowHeight = windowHeight || _global_variables_utils__WEBPACK_IMPORTED_MODULE_6__["DomWindowHelper"].getInnerHeight();
37276
+ var width = Math.min(_windowWidth, _windowHeight);
37277
+ var isTablet = width >= PopupDropdownViewModel.tabletSizeBreakpoint;
37278
+ return isTablet;
37279
+ }
37240
37280
  var PopupDropdownViewModel = /** @class */ (function (_super) {
37241
37281
  __extends(PopupDropdownViewModel, _super);
37242
37282
  function PopupDropdownViewModel(model, targetElement, areaElement) {
@@ -37277,8 +37317,7 @@ var PopupDropdownViewModel = /** @class */ (function (_super) {
37277
37317
  return _this;
37278
37318
  }
37279
37319
  PopupDropdownViewModel.prototype.calculateIsTablet = function (windowWidth, windowHeight) {
37280
- var width = Math.min(windowWidth, windowHeight);
37281
- this.isTablet = width >= PopupDropdownViewModel.tabletSizeBreakpoint;
37320
+ this.isTablet = calculateIsTablet(windowWidth, windowHeight);
37282
37321
  };
37283
37322
  PopupDropdownViewModel.prototype.getAvailableAreaRect = function () {
37284
37323
  if (this.areaElement) {
@@ -37368,10 +37407,11 @@ var PopupDropdownViewModel = /** @class */ (function (_super) {
37368
37407
  return actualHorizontalPosition;
37369
37408
  };
37370
37409
  PopupDropdownViewModel.prototype.getStyleClass = function () {
37410
+ var overlayMode = this.model.overlayDisplayMode;
37371
37411
  return _super.prototype.getStyleClass.call(this)
37372
37412
  .append("sv-popup--dropdown", !this.isOverlay)
37373
- .append("sv-popup--dropdown-overlay", this.isOverlay && this.model.overlayDisplayMode !== "overlay")
37374
- .append("sv-popup--tablet", this.isTablet && this.isOverlay)
37413
+ .append("sv-popup--dropdown-overlay", this.isOverlay && overlayMode !== "plain")
37414
+ .append("sv-popup--tablet", this.isOverlay && (overlayMode == "tablet-dropdown-overlay" || (overlayMode == "auto" && this.isTablet)))
37375
37415
  .append("sv-popup--show-pointer", !this.isOverlay && this.showHeader)
37376
37416
  .append("sv-popup--" + this.popupDirection, !this.isOverlay && (this.showHeader || this.popupDirection == "top" || this.popupDirection == "bottom"));
37377
37417
  };
@@ -37409,7 +37449,7 @@ var PopupDropdownViewModel = /** @class */ (function (_super) {
37409
37449
  this.container.addEventListener("touchstart", this.touchStartEventCallback);
37410
37450
  this.container.addEventListener("touchmove", this.touchMoveEventCallback);
37411
37451
  }
37412
- this.calculateIsTablet(_global_variables_utils__WEBPACK_IMPORTED_MODULE_6__["DomWindowHelper"].getInnerWidth(), _global_variables_utils__WEBPACK_IMPORTED_MODULE_6__["DomWindowHelper"].getInnerHeight());
37452
+ this.calculateIsTablet();
37413
37453
  this.resizeEventCallback();
37414
37454
  }
37415
37455
  _global_variables_utils__WEBPACK_IMPORTED_MODULE_6__["DomWindowHelper"].addEventListener("scroll", this.scrollEventCallBack);
@@ -38654,6 +38694,24 @@ var PopupModel = /** @class */ (function (_super) {
38654
38694
  this.onFooterActionsCreated.fire(this, options);
38655
38695
  return options.actions;
38656
38696
  };
38697
+ PopupModel.prototype.updateDisplayMode = function (menuType) {
38698
+ switch (menuType) {
38699
+ case "dropdown": {
38700
+ this.displayMode = "popup";
38701
+ break;
38702
+ }
38703
+ case "popup": {
38704
+ this.displayMode = "overlay";
38705
+ this.overlayDisplayMode = "tablet-dropdown-overlay";
38706
+ break;
38707
+ }
38708
+ case "overlay": {
38709
+ this.displayMode = "overlay";
38710
+ this.overlayDisplayMode = "dropdown-overlay";
38711
+ break;
38712
+ }
38713
+ }
38714
+ };
38657
38715
  PopupModel.prototype.onHiding = function () {
38658
38716
  this.refreshInnerModel();
38659
38717
  this.onHide();
@@ -41953,6 +42011,9 @@ var Question = /** @class */ (function (_super) {
41953
42011
  Question.prototype.processPopupVisiblilityChanged = function (popupModel, visible) {
41954
42012
  this.survey.processPopupVisiblityChanged(this, popupModel, visible);
41955
42013
  };
42014
+ Question.prototype.processOpenDropdownMenu = function (options) {
42015
+ this.survey.processOpenDropdownMenu(this, options);
42016
+ };
41956
42017
  Question.prototype.onTextKeyDownHandler = function (event) {
41957
42018
  if (event.keyCode === 13) {
41958
42019
  this.survey.questionEditFinishCallback(this, event);
@@ -43096,6 +43157,9 @@ var QuestionSelectBase = /** @class */ (function (_super) {
43096
43157
  _super.prototype.runCondition.call(this, values, properties);
43097
43158
  this.runItemsEnableCondition(values, properties);
43098
43159
  this.runItemsCondition(values, properties);
43160
+ this.choices.forEach(function (item) {
43161
+ item.runConditionCore(values, properties);
43162
+ });
43099
43163
  };
43100
43164
  QuestionSelectBase.prototype.isTextValue = function () {
43101
43165
  return true; //for comments and others
@@ -49256,6 +49320,14 @@ var QuestionFileModelBase = /** @class */ (function (_super) {
49256
49320
  });
49257
49321
  }
49258
49322
  };
49323
+ QuestionFileModelBase.prototype.loadPreview = function (newValue) { };
49324
+ QuestionFileModelBase.prototype.onChangeQuestionValue = function (newValue) {
49325
+ _super.prototype.onChangeQuestionValue.call(this, newValue);
49326
+ this.stateChanged(this.isEmpty() ? "empty" : "loaded");
49327
+ if (!this.isLoadingFromJson) {
49328
+ this.loadPreview(newValue);
49329
+ }
49330
+ };
49259
49331
  __decorate([
49260
49332
  Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])()
49261
49333
  ], QuestionFileModelBase.prototype, "isUploading", void 0);
@@ -49439,6 +49511,15 @@ var QuestionFileModel = /** @class */ (function (_super) {
49439
49511
  _this.fileNavigator.actions = [_this.prevFileAction, _this.fileIndexAction, _this.nextFileAction];
49440
49512
  return _this;
49441
49513
  }
49514
+ Object.defineProperty(QuestionFileModel.prototype, "isFileLoading", {
49515
+ get: function () { return this.isFileLoadingValue; },
49516
+ set: function (val) {
49517
+ this.isFileLoadingValue = val;
49518
+ this.updateIsReady();
49519
+ },
49520
+ enumerable: false,
49521
+ configurable: true
49522
+ });
49442
49523
  Object.defineProperty(QuestionFileModel.prototype, "fileNavigatorVisible", {
49443
49524
  get: function () {
49444
49525
  var isUploading = this.isUploading;
@@ -50039,7 +50120,7 @@ var QuestionFileModel = /** @class */ (function (_super) {
50039
50120
  }
50040
50121
  this.isFileLoading = true;
50041
50122
  this._previewLoader = new FileLoader(this, function (status, loaded) {
50042
- if (status === "loaded") {
50123
+ if (status !== "error") {
50043
50124
  loaded.forEach(function (val) {
50044
50125
  _this.previewValue.push(val);
50045
50126
  });
@@ -50053,15 +50134,6 @@ var QuestionFileModel = /** @class */ (function (_super) {
50053
50134
  }
50054
50135
  this.previewValueChanged();
50055
50136
  };
50056
- Object.defineProperty(QuestionFileModel.prototype, "isFileLoading", {
50057
- get: function () { return this.isFileLoadingValue; },
50058
- set: function (val) {
50059
- this.isFileLoadingValue = val;
50060
- this.updateIsReady();
50061
- },
50062
- enumerable: false,
50063
- configurable: true
50064
- });
50065
50137
  QuestionFileModel.prototype.getIsQuestionReady = function () {
50066
50138
  return _super.prototype.getIsQuestionReady.call(this) && !this.isFileLoading;
50067
50139
  };
@@ -50177,13 +50249,6 @@ var QuestionFileModel = /** @class */ (function (_super) {
50177
50249
  src.value = "";
50178
50250
  this.loadFiles(files);
50179
50251
  };
50180
- QuestionFileModel.prototype.onChangeQuestionValue = function (newValue) {
50181
- _super.prototype.onChangeQuestionValue.call(this, newValue);
50182
- this.stateChanged(this.isEmpty() ? "empty" : "loaded");
50183
- if (!this.isLoadingFromJson) {
50184
- this.loadPreview(newValue);
50185
- }
50186
- };
50187
50252
  QuestionFileModel.prototype.calcCssClasses = function (css) {
50188
50253
  var classes = _super.prototype.calcCssClasses.call(this, css);
50189
50254
  this.actionsContainer.cssClasses = css.actionBar;
@@ -50398,7 +50463,7 @@ var FileLoader = /** @class */ (function () {
50398
50463
  if (!_this.fileQuestion || !_this.callback) {
50399
50464
  return;
50400
50465
  }
50401
- if (status === "success") {
50466
+ if (status !== "error") {
50402
50467
  _this.loaded[index] = {
50403
50468
  content: data,
50404
50469
  name: value.name,
@@ -50406,7 +50471,7 @@ var FileLoader = /** @class */ (function () {
50406
50471
  };
50407
50472
  downloadedCount++;
50408
50473
  if (downloadedCount === files.length) {
50409
- _this.callback("loaded", _this.loaded);
50474
+ _this.callback(status, _this.loaded);
50410
50475
  }
50411
50476
  }
50412
50477
  else {
@@ -51934,8 +51999,8 @@ var QuestionMatrixModel = /** @class */ (function (_super) {
51934
51999
  *
51935
52000
  * Possible values:
51936
52001
  *
51937
- * - "initial" (default) - Preserves the original order of the `rows` array.
51938
- * - "random" - Arranges matrix rows in random order each time the question is displayed.
52002
+ * - `"initial"` (default) - Preserves the original order of the `rows` array.
52003
+ * - `"random"` - Arranges matrix rows in random order each time the question is displayed.
51939
52004
  * @see rows
51940
52005
  */
51941
52006
  get: function () {
@@ -61388,7 +61453,7 @@ var QuestionPanelDynamicModel = /** @class */ (function (_super) {
61388
61453
  var panel = this.createNewPanel();
61389
61454
  this.panelsCore.push(panel);
61390
61455
  if (this.renderMode == "list" && this.panelsState != "default") {
61391
- if (this.panelsState === "expand") {
61456
+ if (this.panelsState === "expanded") {
61392
61457
  panel.expand();
61393
61458
  }
61394
61459
  else {
@@ -65555,6 +65620,28 @@ var QuestionSignaturePadModel = /** @class */ (function (_super) {
65555
65620
  }
65556
65621
  }
65557
65622
  };
65623
+ QuestionSignaturePadModel.prototype.loadPreview = function (newValue) {
65624
+ var _this = this;
65625
+ if (!this.storeDataAsText) {
65626
+ var newValues = !!newValue ? [newValue] : [];
65627
+ if (!!this._previewLoader) {
65628
+ this._previewLoader.dispose();
65629
+ }
65630
+ this.isFileLoading = true;
65631
+ this._previewLoader = new _question_file__WEBPACK_IMPORTED_MODULE_5__["FileLoader"](this, function (status, loaded) {
65632
+ _this.isFileLoading = false;
65633
+ if (loaded && loaded.length > 0 && loaded[0].content && status === "success")
65634
+ _this.fromDataUrl(loaded[0].content);
65635
+ _this._previewLoader.dispose();
65636
+ _this._previewLoader = undefined;
65637
+ });
65638
+ this._previewLoader.load(newValues);
65639
+ }
65640
+ };
65641
+ QuestionSignaturePadModel.prototype.onSurveyLoad = function () {
65642
+ _super.prototype.onSurveyLoad.call(this);
65643
+ this.loadPreview(this.value);
65644
+ };
65558
65645
  QuestionSignaturePadModel.prototype.initSignaturePad = function (el) {
65559
65646
  var _this = this;
65560
65647
  var canvas = el.getElementsByTagName("canvas")[0];
@@ -78442,6 +78529,7 @@ var settings = {
78442
78529
  * const item = new ItemValue("item1");
78443
78530
  * const itemString = item.toJSON(); // Produces { value: "item1", text: "item1" } instead of "item1"
78444
78531
  * ```
78532
+ * @see [settings.parseNumber](https://surveyjs.io/form-library/documentation/api-reference/settings#parseNumber)
78445
78533
  */
78446
78534
  serialization: {
78447
78535
  itemValueSerializeAsObject: false,
@@ -79008,7 +79096,31 @@ var settings = {
79008
79096
  * }
79009
79097
  * ```
79010
79098
  */
79011
- storeUtcDates: false
79099
+ storeUtcDates: false,
79100
+ /**
79101
+ * A function that allows you to define custom parsing rules for numbers represented as string values.
79102
+ *
79103
+ * The following code shows a template that you can use to implement the `parseNumber` function:
79104
+ *
79105
+ * ```js
79106
+ * import { settings } from "survey-core";
79107
+ *
79108
+ * settings.parseNumber = (stringValue, numericValue) => {
79109
+ * if (typeof stringValue !== "string" || !stringValue)
79110
+ * return numericValue;
79111
+ * let parsedNumber = numericValue;
79112
+ * // ...
79113
+ * // Parsing the number according to custom parsing rules
79114
+ * // ...
79115
+ * return parsedNumber;
79116
+ * };
79117
+ * ```
79118
+ * @param stringValue A number represented as a string value.
79119
+ * @param numericValue A number parsed using a default parsing function. `NaN` if the original string is not a number.
79120
+ * @returns A number that results from parsing the string value.
79121
+ * @see [settings.serialization](https://surveyjs.io/form-library/documentation/api-reference/settings#serialization)
79122
+ */
79123
+ parseNumber: function (stringValue, numericValue) { return numericValue; }
79012
79124
  };
79013
79125
 
79014
79126
 
@@ -81758,9 +81870,17 @@ var SurveyModel = /** @class */ (function (_super) {
81758
81870
  */
81759
81871
  _this.onGetExpressionDisplayValue = _this.addEvent();
81760
81872
  /**
81761
- * An event that is raised after the visibility of a popup is changed. This event can be raised for [Single-](https://surveyjs.io/form-library/documentation/api-reference/dropdown-menu-model) and [Multi-Select Dropdown](https://surveyjs.io/form-library/documentation/api-reference/dropdown-tag-box-model) questions and [Rating](https://surveyjs.io/form-library/documentation/api-reference/rating-scale-question-model) questions [rendered as drop-down menus](https://surveyjs.io/form-library/documentation/api-reference/rating-scale-question-model#displayMode).
81873
+ * An event that is raised after the visibility of a popup is changed.
81874
+ *
81875
+ * This event can be raised for [Single-](https://surveyjs.io/form-library/documentation/api-reference/dropdown-menu-model) and [Multi-Select Dropdown](https://surveyjs.io/form-library/documentation/api-reference/dropdown-tag-box-model) questions and [Rating Scale](https://surveyjs.io/form-library/documentation/api-reference/rating-scale-question-model) questions [rendered as drop-down menus](https://surveyjs.io/form-library/documentation/api-reference/rating-scale-question-model#displayMode), and [Multi-Select Matrix](https://surveyjs.io/form-library/documentation/api-reference/matrix-table-with-dropdown-list) questions that contain columns of the `"dropdown"` or `"tagbox"` [`cellType`](https://surveyjs.io/form-library/documentation/api-reference/matrix-table-with-dropdown-list#cellType).
81762
81876
  */
81763
81877
  _this.onPopupVisibleChanged = _this.addEvent();
81878
+ /**
81879
+ * An event that is raised when users open a drop-down menu.
81880
+ *
81881
+ * This event can be raised for [Single-](https://surveyjs.io/form-library/documentation/api-reference/dropdown-menu-model) and [Multi-Select Dropdown](https://surveyjs.io/form-library/documentation/api-reference/dropdown-tag-box-model) questions, [Rating Scale](https://surveyjs.io/form-library/documentation/api-reference/rating-scale-question-model) questions [rendered as drop-down menus](https://surveyjs.io/form-library/documentation/api-reference/rating-scale-question-model#displayMode), and [Multi-Select Matrix](https://surveyjs.io/form-library/documentation/api-reference/matrix-table-with-dropdown-list) questions that contain columns of the `"dropdown"` or `"tagbox"` [`cellType`](https://surveyjs.io/form-library/documentation/api-reference/matrix-table-with-dropdown-list#cellType). Handle this event to change the drop-down menu type for specific questions or device types.
81882
+ */
81883
+ _this.onOpenDropdownMenu = _this.addEvent();
81764
81884
  _this.onElementWrapperComponentName = _this.addEvent();
81765
81885
  _this.onElementWrapperComponentData = _this.addEvent();
81766
81886
  /**
@@ -86913,7 +87033,7 @@ var SurveyModel = /** @class */ (function (_super) {
86913
87033
  */
86914
87034
  SurveyModel.prototype.downloadFile = function (question, questionName, fileValue, callback) {
86915
87035
  if (this.onDownloadFile.isEmpty) {
86916
- !!callback && callback("success", fileValue.content || fileValue);
87036
+ !!callback && callback("skipped", fileValue.content || fileValue);
86917
87037
  }
86918
87038
  this.onDownloadFile.fire(this, {
86919
87039
  question: question,
@@ -89267,6 +89387,11 @@ var SurveyModel = /** @class */ (function (_super) {
89267
89387
  SurveyModel.prototype.processPopupVisiblityChanged = function (question, popup, visible) {
89268
89388
  this.onPopupVisibleChanged.fire(this, { question: question, popup: popup, visible: visible });
89269
89389
  };
89390
+ SurveyModel.prototype.processOpenDropdownMenu = function (question, options) {
89391
+ var newOptions = Object.assign({ question: question }, options);
89392
+ this.onOpenDropdownMenu.fire(this, newOptions);
89393
+ options.menuType = newOptions.menuType;
89394
+ };
89270
89395
  /**
89271
89396
  * Applies a specified theme to the survey.
89272
89397
  *
@@ -90324,7 +90449,7 @@ var TOCModel = /** @class */ (function () {
90324
90449
  };
90325
90450
  this.listModel = createTOCListModel(survey, function () { _this.popupModel.isVisible = false; });
90326
90451
  this.popupModel = new _popup__WEBPACK_IMPORTED_MODULE_5__["PopupModel"]("sv-list", { model: this.listModel });
90327
- this.popupModel.overlayDisplayMode = "overlay";
90452
+ this.popupModel.overlayDisplayMode = "plain";
90328
90453
  this.popupModel.displayMode = new _base__WEBPACK_IMPORTED_MODULE_1__["ComputedUpdater"](function () { return _this.isMobile ? "overlay" : "popup"; });
90329
90454
  if (TOCModel.StickyPosition) {
90330
90455
  survey.onAfterRenderSurvey.add(function (s, o) { return _this.initStickyTOCSubscriptions(o.htmlElement); });
@@ -92828,11 +92953,12 @@ function debounce(func) {
92828
92953
  /*!****************************!*\
92829
92954
  !*** ./src/utils/utils.ts ***!
92830
92955
  \****************************/
92831
- /*! exports provided: unwrap, getRenderedSize, getRenderedStyleSize, doKey2ClickBlur, doKey2ClickUp, doKey2ClickDown, sanitizeEditableContent, Logger, showConfirmDialog, configConfirmDialog, compareArrays, roundTo2Decimals, mergeValues, getElementWidth, isContainerVisible, classesToSelector, compareVersions, confirmAction, confirmActionAsync, detectIEOrEdge, detectIEBrowser, loadFileFromBase64, isMobile, isShadowDOM, getElement, isElementVisible, findScrollableParent, scrollElementByChildId, navigateToUrl, wrapUrlForBackgroundImage, createSvg, getIconNameFromProxy, increaseHeightByContent, getOriginalEvent, preventDefaults, findParentByClassNames, getFirstVisibleChild, chooseFiles */
92956
+ /*! exports provided: getSafeUrl, unwrap, getRenderedSize, getRenderedStyleSize, doKey2ClickBlur, doKey2ClickUp, doKey2ClickDown, sanitizeEditableContent, Logger, showConfirmDialog, configConfirmDialog, compareArrays, roundTo2Decimals, mergeValues, getElementWidth, isContainerVisible, classesToSelector, compareVersions, confirmAction, confirmActionAsync, detectIEOrEdge, detectIEBrowser, loadFileFromBase64, isMobile, isShadowDOM, getElement, isElementVisible, findScrollableParent, scrollElementByChildId, navigateToUrl, wrapUrlForBackgroundImage, createSvg, getIconNameFromProxy, increaseHeightByContent, getOriginalEvent, preventDefaults, findParentByClassNames, getFirstVisibleChild, chooseFiles */
92832
92957
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
92833
92958
 
92834
92959
  "use strict";
92835
92960
  __webpack_require__.r(__webpack_exports__);
92961
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getSafeUrl", function() { return getSafeUrl; });
92836
92962
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "unwrap", function() { return unwrap; });
92837
92963
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getRenderedSize", function() { return getRenderedSize; });
92838
92964
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getRenderedStyleSize", function() { return getRenderedStyleSize; });
@@ -93013,7 +93139,7 @@ function navigateToUrl(url) {
93013
93139
  var location = _global_variables_utils__WEBPACK_IMPORTED_MODULE_3__["DomWindowHelper"].getLocation();
93014
93140
  if (!url || !location)
93015
93141
  return;
93016
- location.href = encodeURIComponent(url);
93142
+ location.href = getSafeUrl(url);
93017
93143
  }
93018
93144
  function wrapUrlForBackgroundImage(url) {
93019
93145
  return !!url ? ["url(", url, ")"].join("") : "";
@@ -93049,6 +93175,13 @@ function createSvg(size, width, height, iconName, svgElem, title) {
93049
93175
  }
93050
93176
  titleElement.textContent = title;
93051
93177
  }
93178
+ function getSafeUrl(url) {
93179
+ if (!url)
93180
+ return url;
93181
+ if (url.toLocaleLowerCase().indexOf("javascript:") > -1)
93182
+ return encodeURIComponent(url);
93183
+ return url;
93184
+ }
93052
93185
  function unwrap(value) {
93053
93186
  if (typeof value !== "function") {
93054
93187
  return value;