survey-react 1.11.5 → 1.11.7

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.5
2
+ * surveyjs - Survey JavaScript library v1.11.7
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
  */
@@ -1147,6 +1147,23 @@ var Action = /** @class */ (function (_super) {
1147
1147
  this.locTooltipChanged();
1148
1148
  this.locStrChangedInPopupModel();
1149
1149
  };
1150
+ Action.prototype.doAction = function (args) {
1151
+ var evt = !!args.originalEvent ? args.originalEvent : args;
1152
+ this.action(this, evt.isTrusted);
1153
+ evt.preventDefault();
1154
+ evt.stopPropagation();
1155
+ return true;
1156
+ };
1157
+ Action.prototype.doMouseDown = function () {
1158
+ this.isMouseDown = true;
1159
+ };
1160
+ Action.prototype.doFocus = function (args) {
1161
+ if (!!this.onFocus) {
1162
+ var evt = !!args.originalEvent ? args.originalEvent : args;
1163
+ this.onFocus(this.isMouseDown, evt);
1164
+ }
1165
+ this.isMouseDown = false;
1166
+ };
1150
1167
  Action.prototype.locStrChangedInPopupModel = function () {
1151
1168
  if (!this.popupModel || !this.popupModel.contentComponentData || !this.popupModel.contentComponentData.model)
1152
1169
  return;
@@ -1227,6 +1244,9 @@ var Action = /** @class */ (function (_super) {
1227
1244
  __decorate([
1228
1245
  Object(_jsonobject__WEBPACK_IMPORTED_MODULE_2__["property"])()
1229
1246
  ], Action.prototype, "action", void 0);
1247
+ __decorate([
1248
+ Object(_jsonobject__WEBPACK_IMPORTED_MODULE_2__["property"])()
1249
+ ], Action.prototype, "onFocus", void 0);
1230
1250
  __decorate([
1231
1251
  Object(_jsonobject__WEBPACK_IMPORTED_MODULE_2__["property"])()
1232
1252
  ], Action.prototype, "_component", void 0);
@@ -2278,6 +2298,8 @@ var Base = /** @class */ (function () {
2278
2298
  if (!prop || prop.isCustom && this.isCreating)
2279
2299
  return undefined;
2280
2300
  var dValue = prop.defaultValue;
2301
+ if (!!prop.defaultValueFunc)
2302
+ return dValue;
2281
2303
  if (!this.isPropertyEmpty(dValue) && !Array.isArray(dValue))
2282
2304
  return dValue;
2283
2305
  var locStr = this.localizableStrings ? this.localizableStrings[name] : undefined;
@@ -5616,6 +5638,7 @@ var defaultV2Css = {
5616
5638
  titleExpanded: "sd-element__title--expanded",
5617
5639
  titleCollapsed: "sd-element__title--collapsed",
5618
5640
  titleDisabled: "sd-element__title--disabled",
5641
+ titleHidden: "sd-element__title--hidden",
5619
5642
  titleOnExpand: "sd-panel__title--expanded",
5620
5643
  titleOnError: "sd-panel__title--error",
5621
5644
  titleBar: "sd-action-title-bar",
@@ -8184,7 +8207,6 @@ var DropdownListModel = /** @class */ (function (_super) {
8184
8207
  _this.selectedItemSelector = ".sv-list__item--selected";
8185
8208
  _this.itemSelector = ".sv-list__item";
8186
8209
  _this.itemsSettings = { skip: 0, take: 0, totalCount: 0, items: [] };
8187
- _this.isRunningLoadQuestionChoices = false;
8188
8210
  _this.popupCssClasses = "sv-single-select-list";
8189
8211
  _this.listModelFilterStringChanged = function (newValue) {
8190
8212
  if (_this.filterString !== newValue) {
@@ -8235,14 +8257,12 @@ var DropdownListModel = /** @class */ (function (_super) {
8235
8257
  };
8236
8258
  DropdownListModel.prototype.loadQuestionChoices = function (callbackAfterItemsLoaded) {
8237
8259
  var _this = this;
8238
- this.isRunningLoadQuestionChoices = true;
8239
8260
  this.question.survey.loadQuestionChoices({
8240
8261
  question: this.question,
8241
8262
  filter: this.filterString,
8242
8263
  skip: this.itemsSettings.skip,
8243
8264
  take: this.itemsSettings.take,
8244
8265
  setItems: function (items, totalCount) {
8245
- _this.isRunningLoadQuestionChoices = false;
8246
8266
  _this.setItems(items || [], totalCount || 0);
8247
8267
  _this.popupRecalculatePosition(_this.itemsSettings.skip === _this.itemsSettings.take);
8248
8268
  if (!!callbackAfterItemsLoaded) {
@@ -8254,8 +8274,6 @@ var DropdownListModel = /** @class */ (function (_super) {
8254
8274
  };
8255
8275
  DropdownListModel.prototype.updateQuestionChoices = function (callbackAfterItemsLoaded) {
8256
8276
  var _this = this;
8257
- if (this.isRunningLoadQuestionChoices)
8258
- return;
8259
8277
  var isUpdate = (this.itemsSettings.skip + 1) < this.itemsSettings.totalCount;
8260
8278
  if (!this.itemsSettings.skip || isUpdate) {
8261
8279
  if (!!this.filterString && _settings__WEBPACK_IMPORTED_MODULE_7__["settings"].dropdownSearchDelay > 0) {
@@ -9937,8 +9955,8 @@ __webpack_require__.r(__webpack_exports__);
9937
9955
 
9938
9956
  var Version;
9939
9957
  var ReleaseDate;
9940
- Version = "" + "1.11.5";
9941
- ReleaseDate = "" + "2024-07-03";
9958
+ Version = "" + "1.11.7";
9959
+ ReleaseDate = "" + "2024-07-16";
9942
9960
  function checkLibraryVersion(ver, libraryName) {
9943
9961
  if (Version != ver) {
9944
9962
  var str = "survey-core has version '" + Version + "' and " + libraryName
@@ -19769,7 +19787,7 @@ var JsonObjectProperty = /** @class */ (function () {
19769
19787
  }
19770
19788
  if (this.isLocalizable)
19771
19789
  return value === null || value === undefined;
19772
- return ((value === false && (this.type == "boolean" || this.type == "switch")) ||
19790
+ return ((value === false && (this.type == "boolean" || this.type == "switch") && !this.defaultValueFunc) ||
19773
19791
  value === "" || _helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(value));
19774
19792
  };
19775
19793
  JsonObjectProperty.prototype.getSerializableValue = function (obj) {
@@ -21233,7 +21251,7 @@ var JsonObject = /** @class */ (function () {
21233
21251
  JsonObject.prototype.toJsonObjectCore = function (obj, property, options) {
21234
21252
  if (!obj || !obj.getType)
21235
21253
  return obj;
21236
- if (typeof obj.getData === "function")
21254
+ if (!obj.isSurvey && typeof obj.getData === "function")
21237
21255
  return obj.getData();
21238
21256
  var result = {};
21239
21257
  if (property != null && !property.className) {
@@ -23817,7 +23835,7 @@ var dutchSurveyStrings = {
23817
23835
  choices_Item: "onderwerp",
23818
23836
  matrix_column: "Kolom",
23819
23837
  matrix_row: "Rij",
23820
- multipletext_itemname: "Sms",
23838
+ multipletext_itemname: "Tekst",
23821
23839
  savingData: "De resultaten worden bewaard op de server...",
23822
23840
  savingDataError: "Er was een probleem en we konden de resultaten niet bewaren.",
23823
23841
  savingDataSuccess: "De resultaten werden succesvol bewaard!",
@@ -30783,6 +30801,10 @@ var InputElementAdapter = /** @class */ (function () {
30783
30801
  event.preventDefault();
30784
30802
  }
30785
30803
  };
30804
+ this.changeHandler = function (event) {
30805
+ var result = _this.inputMaskInstance.processInput({ prevValue: "", insertedChars: event.target.value, selectionStart: 0, selectionEnd: 0 });
30806
+ _this.inputElement.value = result.value;
30807
+ };
30786
30808
  var _value = value;
30787
30809
  if (_value === null || _value === undefined) {
30788
30810
  _value = "";
@@ -30816,6 +30838,7 @@ var InputElementAdapter = /** @class */ (function () {
30816
30838
  this.inputElement.addEventListener("beforeinput", this.beforeInputHandler);
30817
30839
  this.inputElement.addEventListener("click", this.clickHandler);
30818
30840
  this.inputElement.addEventListener("focus", this.clickHandler);
30841
+ this.inputElement.addEventListener("change", this.changeHandler);
30819
30842
  }
30820
30843
  };
30821
30844
  InputElementAdapter.prototype.removeInputEventListener = function () {
@@ -30823,6 +30846,7 @@ var InputElementAdapter = /** @class */ (function () {
30823
30846
  this.inputElement.removeEventListener("beforeinput", this.beforeInputHandler);
30824
30847
  this.inputElement.removeEventListener("click", this.clickHandler);
30825
30848
  this.inputElement.removeEventListener("focus", this.clickHandler);
30849
+ this.inputElement.removeEventListener("change", this.changeHandler);
30826
30850
  }
30827
30851
  };
30828
30852
  InputElementAdapter.prototype.dispose = function () {
@@ -31942,6 +31966,8 @@ var InputMaskNumeric = /** @class */ (function (_super) {
31942
31966
  InputMaskNumeric.prototype.validateNumber = function (number, matchWholeMask) {
31943
31967
  var min = this.min || Number.MIN_SAFE_INTEGER;
31944
31968
  var max = this.max || Number.MAX_SAFE_INTEGER;
31969
+ if (this.numericalCompositionIsEmpty(number))
31970
+ return true;
31945
31971
  if (this.min !== undefined || this.max !== undefined) {
31946
31972
  var value = this.convertNumber(number);
31947
31973
  if (Number.isNaN(value)) {
@@ -32914,6 +32940,12 @@ var PageModel = /** @class */ (function (_super) {
32914
32940
  enumerable: false,
32915
32941
  configurable: true
32916
32942
  });
32943
+ PageModel.prototype.getMaxTimeToFinish = function () {
32944
+ if (this.maxTimeToFinish !== 0)
32945
+ return this.maxTimeToFinish;
32946
+ var res = !!this.survey ? this.survey.maxTimeToFinishPage : 0;
32947
+ return res > 0 ? res : 0;
32948
+ };
32917
32949
  PageModel.prototype.onNumChanged = function (value) { };
32918
32950
  PageModel.prototype.onVisibleChanged = function () {
32919
32951
  if (this.isRandomizing)
@@ -33999,6 +34031,23 @@ var PanelModelBase = /** @class */ (function (_super) {
33999
34031
  this.parent.validateContainerOnly();
34000
34032
  }
34001
34033
  };
34034
+ PanelModelBase.prototype.onQuestionValueChanged = function (el) {
34035
+ var index = this.questions.indexOf(el);
34036
+ if (index < 0)
34037
+ return;
34038
+ var dif = 5;
34039
+ var max = this.questions.length - 1;
34040
+ var start = index - dif > 0 ? index - dif : 0;
34041
+ var end = index + dif < max ? index + dif : max;
34042
+ for (var i = start; i <= end; i++) {
34043
+ if (i === index)
34044
+ continue;
34045
+ var q = this.questions[i];
34046
+ if (q.errors.length > 0 && q.validate(false)) {
34047
+ q.validate(true);
34048
+ }
34049
+ }
34050
+ };
34002
34051
  PanelModelBase.prototype.hasErrorsInPanels = function (rec) {
34003
34052
  var errors = [];
34004
34053
  this.hasRequiredError(rec, errors);
@@ -35186,7 +35235,7 @@ var PanelModel = /** @class */ (function (_super) {
35186
35235
  var _this = this;
35187
35236
  var locTitleValue = _super.prototype.createLocTitleProperty.call(this);
35188
35237
  locTitleValue.onGetTextCallback = function (text) {
35189
- if (!text && (_this.state !== "default")) {
35238
+ if (!text && (_this.state !== "default" || (_this.isDesignMode && _this.isDefaultV2Theme))) {
35190
35239
  text = _this.name;
35191
35240
  }
35192
35241
  return text;
@@ -35349,7 +35398,10 @@ var PanelModel = /** @class */ (function (_super) {
35349
35398
  };
35350
35399
  Object.defineProperty(PanelModel.prototype, "cssTitle", {
35351
35400
  get: function () {
35352
- return this.getCssTitle(this.cssClasses.panel);
35401
+ return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_9__["CssClassBuilder"]()
35402
+ .append(this.getCssTitle(this.cssClasses.panel))
35403
+ .append(this.cssClasses.panel.titleHidden, !this.title && this.isDesignMode)
35404
+ .toString();
35353
35405
  },
35354
35406
  enumerable: false,
35355
35407
  configurable: true
@@ -39405,8 +39457,12 @@ var Question = /** @class */ (function (_super) {
39405
39457
  Object.defineProperty(Question.prototype, "titleWidth", {
39406
39458
  get: function () {
39407
39459
  if (this.getTitleLocation() === "left") {
39408
- if (!!this.parent)
39409
- return this.parent.getQuestionTitleWidth();
39460
+ if (!!this.parent) {
39461
+ var width = this.parent.getQuestionTitleWidth();
39462
+ if (width && !isNaN(width))
39463
+ width = width + "px";
39464
+ return width;
39465
+ }
39410
39466
  }
39411
39467
  return undefined;
39412
39468
  },
@@ -40548,14 +40604,23 @@ var Question = /** @class */ (function (_super) {
40548
40604
  Question.prototype.getFilteredName = function () { return this.getValueName(); };
40549
40605
  Object.defineProperty(Question.prototype, "valueForSurvey", {
40550
40606
  get: function () {
40551
- if (!!this.valueToDataCallback) {
40552
- return this.valueToDataCallback(this.value);
40553
- }
40554
- return this.value;
40607
+ return this.valueForSurveyCore(this.value);
40555
40608
  },
40556
40609
  enumerable: false,
40557
40610
  configurable: true
40558
40611
  });
40612
+ Question.prototype.valueForSurveyCore = function (val) {
40613
+ if (!!this.valueToDataCallback) {
40614
+ return this.valueToDataCallback(val);
40615
+ }
40616
+ return val;
40617
+ };
40618
+ Question.prototype.valueFromDataCore = function (val) {
40619
+ if (!!this.valueFromDataCallback) {
40620
+ return this.valueFromDataCallback(val);
40621
+ }
40622
+ return val;
40623
+ };
40559
40624
  /**
40560
40625
  * Sets the question's `value` and `comment` properties to `undefined`.
40561
40626
  * @see value
@@ -41377,6 +41442,9 @@ var Question = /** @class */ (function (_super) {
41377
41442
  this.updateQuestionCss();
41378
41443
  }
41379
41444
  this.isOldAnswered = undefined;
41445
+ if (this.parent) {
41446
+ this.parent.onQuestionValueChanged(this);
41447
+ }
41380
41448
  };
41381
41449
  Question.prototype.checkIsValueCorrect = function (val) {
41382
41450
  var res = this.isValueEmpty(val, !this.allowSpaceAsAnswer) || this.isNewValueCorrect(val);
@@ -41462,9 +41530,7 @@ var Question = /** @class */ (function (_super) {
41462
41530
  var _this = this;
41463
41531
  if (clearData === void 0) { clearData = false; }
41464
41532
  newValue = this.getUnbindValue(newValue);
41465
- if (!!this.valueFromDataCallback) {
41466
- newValue = this.valueFromDataCallback(newValue);
41467
- }
41533
+ newValue = this.valueFromDataCore(newValue);
41468
41534
  if (!this.checkIsValueCorrect(newValue))
41469
41535
  return;
41470
41536
  var isEmpty = this.isValueEmpty(newValue);
@@ -44651,6 +44717,8 @@ _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("selectbase", [
44651
44717
  return !obj.choicesFromQuestion;
44652
44718
  },
44653
44719
  },
44720
+ { name: "defaultValue:value", visibleIf: function (obj) { return !obj.choicesFromQuestion; }, dependsOn: "choicesFromQuestion" },
44721
+ { name: "correctAnswer:value", visibleIf: function (obj) { return !obj.choicesFromQuestion; }, dependsOn: "choicesFromQuestion" },
44654
44722
  { name: "separateSpecialChoices:boolean", visible: false },
44655
44723
  { name: "showOtherItem:boolean", alternativeName: "hasOther" },
44656
44724
  { name: "showNoneItem:boolean", alternativeName: "hasNone" },
@@ -44710,8 +44778,7 @@ _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("selectbase", [
44710
44778
  default: "default",
44711
44779
  choices: ["default", true, false],
44712
44780
  visible: false,
44713
- },
44714
- // { name: "itemComponent", visible: false }
44781
+ }
44715
44782
  ], null, "question");
44716
44783
  _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("checkboxbase", [
44717
44784
  {
@@ -46368,7 +46435,7 @@ var QuestionCommentModel = /** @class */ (function (_super) {
46368
46435
  * @see allowResize
46369
46436
  */
46370
46437
  get: function () {
46371
- return this.getPropertyValue("autoGrow") || (this.survey && this.survey.autoGrowComment);
46438
+ return this.getPropertyValue("autoGrow");
46372
46439
  },
46373
46440
  set: function (val) {
46374
46441
  this.setPropertyValue("autoGrow", val);
@@ -46376,9 +46443,16 @@ var QuestionCommentModel = /** @class */ (function (_super) {
46376
46443
  enumerable: false,
46377
46444
  configurable: true
46378
46445
  });
46446
+ Object.defineProperty(QuestionCommentModel.prototype, "renderedAutoGrow", {
46447
+ get: function () {
46448
+ var autoGrow = this.autoGrow;
46449
+ return autoGrow === undefined && this.survey ? this.survey.autoGrowComment : !!autoGrow;
46450
+ },
46451
+ enumerable: false,
46452
+ configurable: true
46453
+ });
46379
46454
  Object.defineProperty(QuestionCommentModel.prototype, "allowResize", {
46380
46455
  /**
46381
- * Specifies whether to display a resize handle for the comment area.
46382
46456
  *
46383
46457
  * Default value: `true` (inherited from `SurveyModel`'s [`allowResizeComment`](https://surveyjs.io/form-library/documentation/surveymodel#allowResizeComment) property)
46384
46458
  * @see autoGrow
@@ -46394,7 +46468,9 @@ var QuestionCommentModel = /** @class */ (function (_super) {
46394
46468
  });
46395
46469
  Object.defineProperty(QuestionCommentModel.prototype, "renderedAllowResize", {
46396
46470
  get: function () {
46397
- return this.allowResize && (this.survey && this.survey.allowResizeComment) && !this.isPreviewStyle && !this.isReadOnlyStyle;
46471
+ var res = this.allowResize;
46472
+ var allowResize = res === undefined && this.survey ? this.survey.allowResizeComment : !!res;
46473
+ return allowResize && !this.isPreviewStyle && !this.isReadOnlyStyle;
46398
46474
  },
46399
46475
  enumerable: false,
46400
46476
  configurable: true
@@ -46417,7 +46493,7 @@ var QuestionCommentModel = /** @class */ (function (_super) {
46417
46493
  };
46418
46494
  QuestionCommentModel.prototype.updateElement = function () {
46419
46495
  var _this = this;
46420
- if (this.element && this.autoGrow) {
46496
+ if (this.element && this.renderedAutoGrow) {
46421
46497
  setTimeout(function () { return Object(_utils_utils__WEBPACK_IMPORTED_MODULE_3__["increaseHeightByContent"])(_this.element); }, 1);
46422
46498
  }
46423
46499
  };
@@ -46478,8 +46554,8 @@ _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("comment", [
46478
46554
  default: "default",
46479
46555
  choices: ["default", "onBlur", "onTyping"],
46480
46556
  },
46481
- { name: "autoGrow:boolean" },
46482
- { name: "allowResize:boolean", default: true },
46557
+ { name: "autoGrow:boolean", defaultFunc: function () { return undefined; } },
46558
+ { name: "allowResize:boolean", defaultFunc: function () { return undefined; } },
46483
46559
  { name: "acceptCarriageReturn:boolean", default: true, visible: false }
46484
46560
  ], function () {
46485
46561
  return new QuestionCommentModel("");
@@ -47007,6 +47083,9 @@ var QuestionCustomModelBase = /** @class */ (function (_super) {
47007
47083
  QuestionCustomModelBase.prototype.validateContainerOnly = function () {
47008
47084
  // do nothing
47009
47085
  };
47086
+ QuestionCustomModelBase.prototype.onQuestionValueChanged = function (el) {
47087
+ // do nothing
47088
+ };
47010
47089
  QuestionCustomModelBase.prototype.getQuestionErrorLocation = function () {
47011
47090
  return this.getErrorLocation();
47012
47091
  };
@@ -53627,6 +53706,9 @@ var QuestionMatrixDropdownModelBase = /** @class */ (function (_super) {
53627
53706
  enumerable: false,
53628
53707
  configurable: true
53629
53708
  });
53709
+ QuestionMatrixDropdownModelBase.prototype.isSelectCellType = function () {
53710
+ return _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].isDescendantOf(this.cellType, "selectbase");
53711
+ };
53630
53712
  QuestionMatrixDropdownModelBase.prototype.updateColumnsCellType = function () {
53631
53713
  for (var i = 0; i < this.columns.length; i++) {
53632
53714
  this.columns[i].defaultCellTypeChanged();
@@ -53781,13 +53863,17 @@ var QuestionMatrixDropdownModelBase = /** @class */ (function (_super) {
53781
53863
  break;
53782
53864
  columnName = path[i] + columnName;
53783
53865
  }
53866
+ var question = undefined;
53784
53867
  var column = this.getColumnByName(columnName);
53785
- if (!column)
53786
- return null;
53787
- var question = column.createCellQuestion(null);
53788
- if (!question)
53789
- return null;
53790
- return question.getConditionJson(operator);
53868
+ if (!!column) {
53869
+ question = column.createCellQuestion(null);
53870
+ }
53871
+ else {
53872
+ if (this.detailPanelMode !== "none") {
53873
+ question = this.detailPanel.getQuestionByName(columnName);
53874
+ }
53875
+ }
53876
+ return !!question ? question.getConditionJson(operator) : null;
53791
53877
  };
53792
53878
  QuestionMatrixDropdownModelBase.prototype.clearIncorrectValues = function () {
53793
53879
  var rows = this.visibleRows;
@@ -54266,7 +54352,11 @@ var QuestionMatrixDropdownModelBase = /** @class */ (function (_super) {
54266
54352
  return questionPlainData;
54267
54353
  };
54268
54354
  QuestionMatrixDropdownModelBase.prototype.addConditionObjectsByContext = function (objects, context) {
54269
- var hasColumnContext = !!context && this.columns.indexOf(context) > -1;
54355
+ var rowElements = [].concat(this.columns);
54356
+ if (this.detailPanelMode !== "none") {
54357
+ rowElements = rowElements.concat(this.detailPanel.questions);
54358
+ }
54359
+ var hasColumnContext = !!context && rowElements.indexOf(context) > -1;
54270
54360
  var hasContext = context === true || hasColumnContext;
54271
54361
  var rowsIndeces = this.getConditionObjectsRowIndeces();
54272
54362
  if (hasContext) {
@@ -54282,13 +54372,13 @@ var QuestionMatrixDropdownModelBase = /** @class */ (function (_super) {
54282
54372
  var dot = hasQuestionPrefix && index === -1 ? "." : "";
54283
54373
  var prefixName = (hasQuestionPrefix ? this.getValueName() : "") + dot + rowName + ".";
54284
54374
  var prefixTitle = (hasQuestionPrefix ? this.processedTitle : "") + dot + rowText + ".";
54285
- for (var j = 0; j < this.columns.length; j++) {
54286
- var column = this.columns[j];
54287
- if (index === -1 && context === column)
54375
+ for (var j = 0; j < rowElements.length; j++) {
54376
+ var rowElement = rowElements[j];
54377
+ if (index === -1 && context === rowElement)
54288
54378
  continue;
54289
54379
  var obj = {
54290
- name: prefixName + column.name,
54291
- text: prefixTitle + column.fullTitle,
54380
+ name: prefixName + rowElement.name,
54381
+ text: prefixTitle + rowElement.fullTitle,
54292
54382
  question: this
54293
54383
  };
54294
54384
  if (index === -1 && context === true) {
@@ -54355,9 +54445,11 @@ var QuestionMatrixDropdownModelBase = /** @class */ (function (_super) {
54355
54445
  var col = this.columns[i];
54356
54446
  if (!col.templateQuestion.hasInput)
54357
54447
  continue;
54448
+ var hasValue = !_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(rowValue[col.name]);
54449
+ if (!hasValue && !!col.templateQuestion.visibleIf)
54450
+ continue;
54358
54451
  res.questionCount += 1;
54359
54452
  res.requiredQuestionCount += col.isRequired;
54360
- var hasValue = !_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(rowValue[col.name]);
54361
54453
  res.answeredQuestionCount += hasValue ? 1 : 0;
54362
54454
  res.requiredAnsweredQuestionCount += hasValue && col.isRequired ? 1 : 0;
54363
54455
  }
@@ -54564,14 +54656,17 @@ var QuestionMatrixDropdownModelBase = /** @class */ (function (_super) {
54564
54656
  var _this = this;
54565
54657
  duplicatedRows.forEach(function (row) {
54566
54658
  var question = row.getQuestionByName(columnName);
54567
- if (!question && _this.detailPanel.getQuestionByName(columnName)) {
54659
+ var inDetailPanel = _this.detailPanel.getQuestionByName(columnName);
54660
+ if (!question && inDetailPanel) {
54568
54661
  row.showDetailPanel();
54569
54662
  if (row.detailPanel) {
54570
54663
  question = row.detailPanel.getQuestionByName(columnName);
54571
54664
  }
54572
54665
  }
54573
54666
  if (question) {
54574
- row.showDetailPanel();
54667
+ if (inDetailPanel) {
54668
+ row.showDetailPanel();
54669
+ }
54575
54670
  _this.addDuplicationError(question);
54576
54671
  }
54577
54672
  });
@@ -54992,6 +55087,7 @@ _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("matrixdropdownb
54992
55087
  { name: "horizontalScroll:boolean", visible: false, },
54993
55088
  {
54994
55089
  name: "choices:itemvalue[]", uniqueProperty: "value",
55090
+ visibleIf: function (obj) { return obj.isSelectCellType(); }
54995
55091
  },
54996
55092
  { name: "placeholder", alternativeName: "optionsCaption", serializationProperty: "locPlaceholder" },
54997
55093
  {
@@ -59616,6 +59712,9 @@ var QuestionMultipleTextModel = /** @class */ (function (_super) {
59616
59712
  QuestionMultipleTextModel.prototype.validateContainerOnly = function () {
59617
59713
  // do nothing
59618
59714
  };
59715
+ QuestionMultipleTextModel.prototype.onQuestionValueChanged = function (el) {
59716
+ // do nothing
59717
+ };
59619
59718
  QuestionMultipleTextModel.prototype.getItemLabelCss = function (item) {
59620
59719
  return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_7__["CssClassBuilder"]()
59621
59720
  .append(this.cssClasses.itemLabel)
@@ -61673,9 +61772,10 @@ var QuestionPanelDynamicModel = /** @class */ (function (_super) {
61673
61772
  }
61674
61773
  return -1;
61675
61774
  };
61676
- QuestionPanelDynamicModel.prototype.getPanelIndexById = function (id) {
61677
- for (var i = 0; i < this.panelsCore.length; i++) {
61678
- if (this.panelsCore[i].id === id)
61775
+ QuestionPanelDynamicModel.prototype.getPanelVisibleIndexById = function (id) {
61776
+ var visPanels = this.visiblePanelsCore;
61777
+ for (var i = 0; i < visPanels.length; i++) {
61778
+ if (visPanels[i].id === id)
61679
61779
  return i;
61680
61780
  }
61681
61781
  return -1;
@@ -62590,14 +62690,14 @@ var QuestionPanelDynamicModel = /** @class */ (function (_super) {
62590
62690
  return options.title;
62591
62691
  };
62592
62692
  locTitle.sharedData = this.locTemplateTabTitle;
62593
- var isActive = this.getPanelIndexById(panel.id) === this.currentIndex;
62693
+ var isActive = this.getPanelVisibleIndexById(panel.id) === this.currentIndex;
62594
62694
  var newItem = new _actions_action__WEBPACK_IMPORTED_MODULE_11__["Action"]({
62595
62695
  id: panel.id,
62596
62696
  pressed: isActive,
62597
62697
  locTitle: locTitle,
62598
62698
  disableHide: isActive,
62599
62699
  action: function () {
62600
- _this.currentIndex = _this.getPanelIndexById(newItem.id);
62700
+ _this.currentIndex = _this.getPanelVisibleIndexById(newItem.id);
62601
62701
  }
62602
62702
  });
62603
62703
  return newItem;
@@ -63049,7 +63149,7 @@ var QuestionRankingModel = /** @class */ (function (_super) {
63049
63149
  _this.domNode = null;
63050
63150
  _this.onVisibleChoicesChanged = function () {
63051
63151
  _super.prototype.onVisibleChoicesChanged.call(_this);
63052
- if (_this.carryForwardStartUnranked && !_this.isValueSetByUser && !_this.selectToRankEnabled) {
63152
+ if (_this.carryForwardStartUnranked && !_this.isValueSetByUser && !_this.selectToRankEnabled && !_this.defaultValue) {
63053
63153
  _this.value = [];
63054
63154
  }
63055
63155
  // ranking question with only one choice doesn't make sense
@@ -63274,6 +63374,7 @@ var QuestionRankingModel = /** @class */ (function (_super) {
63274
63374
  QuestionRankingModel.prototype.onSurveyLoad = function () {
63275
63375
  this.blockAnimations();
63276
63376
  _super.prototype.onSurveyLoad.call(this);
63377
+ this.updateRankingChoices();
63277
63378
  this.releaseAnimations();
63278
63379
  };
63279
63380
  QuestionRankingModel.prototype.addToValueByVisibleChoices = function () {
@@ -66353,6 +66454,24 @@ var QuestionTextModel = /** @class */ (function (_super) {
66353
66454
  this._inputValue = this.maskInstance.getMaskedValue(this.value);
66354
66455
  }
66355
66456
  };
66457
+ QuestionTextModel.prototype.hasToConvertToUTC = function (val) {
66458
+ return _settings__WEBPACK_IMPORTED_MODULE_6__["settings"].storeUtcDates && this.isDateTimeLocaleType() && !!val;
66459
+ };
66460
+ QuestionTextModel.prototype.valueForSurveyCore = function (val) {
66461
+ if (this.hasToConvertToUTC(val)) {
66462
+ val = new Date(val).toISOString();
66463
+ }
66464
+ return _super.prototype.valueForSurveyCore.call(this, val);
66465
+ };
66466
+ QuestionTextModel.prototype.valueFromDataCore = function (val) {
66467
+ if (this.hasToConvertToUTC(val)) {
66468
+ var d = new Date(val);
66469
+ var locale_d = new Date(d.getTime() - d.getTimezoneOffset() * 60 * 1000);
66470
+ var res = locale_d.toISOString();
66471
+ val = res.substring(0, res.length - 2);
66472
+ }
66473
+ return _super.prototype.valueFromDataCore.call(this, val);
66474
+ };
66356
66475
  QuestionTextModel.prototype.onCheckForErrors = function (errors, isOnValueChanged) {
66357
66476
  var _this = this;
66358
66477
  _super.prototype.onCheckForErrors.call(this, errors, isOnValueChanged);
@@ -66424,11 +66543,14 @@ var QuestionTextModel = /** @class */ (function (_super) {
66424
66543
  });
66425
66544
  Object.defineProperty(QuestionTextModel.prototype, "isDateInputType", {
66426
66545
  get: function () {
66427
- return this.inputType === "date" || this.inputType === "datetime-local";
66546
+ return this.inputType === "date" || this.isDateTimeLocaleType();
66428
66547
  },
66429
66548
  enumerable: false,
66430
66549
  configurable: true
66431
66550
  });
66551
+ QuestionTextModel.prototype.isDateTimeLocaleType = function () {
66552
+ return this.inputType === "datetime-local";
66553
+ };
66432
66554
  QuestionTextModel.prototype.getCalculatedMinMax = function (minMax) {
66433
66555
  if (this.isValueEmpty(minMax))
66434
66556
  return minMax;
@@ -66480,11 +66602,10 @@ var QuestionTextModel = /** @class */ (function (_super) {
66480
66602
  return this.maskTypeIsEmpty ? _super.prototype.getIsInputTextUpdate.call(this) : false;
66481
66603
  };
66482
66604
  QuestionTextModel.prototype.supportGoNextPageAutomatic = function () {
66483
- return !this.getIsInputTextUpdate() &&
66484
- ["date", "datetime-local"].indexOf(this.inputType) < 0;
66605
+ return !this.getIsInputTextUpdate() && !this.isDateInputType;
66485
66606
  };
66486
66607
  QuestionTextModel.prototype.supportGoNextPageError = function () {
66487
- return ["date", "datetime-local"].indexOf(this.inputType) < 0;
66608
+ return !this.isDateInputType;
66488
66609
  };
66489
66610
  Object.defineProperty(QuestionTextModel.prototype, "dataList", {
66490
66611
  /**
@@ -66525,9 +66646,13 @@ var QuestionTextModel = /** @class */ (function (_super) {
66525
66646
  QuestionTextModel.prototype.correctValueType = function (newValue) {
66526
66647
  if (!newValue)
66527
66648
  return newValue;
66528
- if (this.inputType == "number" || this.inputType == "range") {
66649
+ if (this.inputType === "number" || this.inputType === "range") {
66529
66650
  return _helpers__WEBPACK_IMPORTED_MODULE_3__["Helpers"].isNumber(newValue) ? _helpers__WEBPACK_IMPORTED_MODULE_3__["Helpers"].getNumber(newValue) : "";
66530
66651
  }
66652
+ if (this.inputType === "month") {
66653
+ var d = new Date(newValue);
66654
+ return d.getFullYear() + "-" + (d.getMonth() + 1);
66655
+ }
66531
66656
  return newValue;
66532
66657
  };
66533
66658
  QuestionTextModel.prototype.hasPlaceholder = function () {
@@ -67740,7 +67865,7 @@ var SurveyActionBarItem = /** @class */ (function (_super) {
67740
67865
  var title = this.item.tooltip || this.item.title;
67741
67866
  var buttonContent = this.renderButtonContent();
67742
67867
  var tabIndex = this.item.disableTabStop ? -1 : undefined;
67743
- var button = Object(_reactSurvey__WEBPACK_IMPORTED_MODULE_3__["attachKey2click"])(react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button", { className: className, type: "button", disabled: this.item.disabled, onClick: function (args) { return _this.item.action(_this.item, _this.item.getIsTrusted(args)); }, title: title, tabIndex: tabIndex, "aria-checked": this.item.ariaChecked, "aria-expanded": this.item.ariaExpanded, role: this.item.ariaRole }, buttonContent), this.item, { processEsc: false });
67868
+ var button = Object(_reactSurvey__WEBPACK_IMPORTED_MODULE_3__["attachKey2click"])(react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button", { className: className, type: "button", disabled: this.item.disabled, onMouseDown: function () { return _this.item.doMouseDown(); }, onFocus: function (args) { return _this.item.doFocus(args); }, onClick: function (args) { return _this.item.doAction(args); }, title: title, tabIndex: tabIndex, "aria-checked": this.item.ariaChecked, "aria-expanded": this.item.ariaExpanded, role: this.item.ariaRole }, buttonContent), this.item, { processEsc: false });
67744
67869
  return button;
67745
67870
  };
67746
67871
  return SurveyActionBarItem;
@@ -72967,7 +73092,7 @@ function attachKey2click(element, viewModel, options) {
72967
73092
  return false;
72968
73093
  },
72969
73094
  onKeyDown: function (evt) { return Object(survey_core__WEBPACK_IMPORTED_MODULE_1__["doKey2ClickDown"])(evt, options); },
72970
- onBlur: function (evt) { return Object(survey_core__WEBPACK_IMPORTED_MODULE_1__["doKey2ClickBlur"])(evt); }
73095
+ onBlur: function (evt) { return Object(survey_core__WEBPACK_IMPORTED_MODULE_1__["doKey2ClickBlur"])(evt); },
72971
73096
  });
72972
73097
  }
72973
73098
 
@@ -74697,7 +74822,8 @@ __webpack_require__.r(__webpack_exports__);
74697
74822
  /* harmony import */ var _reactquestion_factory__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./reactquestion_factory */ "./src/react/reactquestion_factory.tsx");
74698
74823
  /* harmony import */ var _components_loading_indicator__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./components/loading-indicator */ "./src/react/components/loading-indicator.tsx");
74699
74824
  /* harmony import */ var _components_action_bar_action_bar_item__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./components/action-bar/action-bar-item */ "./src/react/components/action-bar/action-bar-item.tsx");
74700
- /* harmony import */ var _entries_react_ui_model__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../entries/react-ui-model */ "./src/entries/react-ui-model.ts");
74825
+ /* harmony import */ var _element_factory__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./element-factory */ "./src/react/element-factory.tsx");
74826
+ /* harmony import */ var _components_file_file_choose_button__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./components/file/file-choose-button */ "./src/react/components/file/file-choose-button.tsx");
74701
74827
  var __extends = (undefined && undefined.__extends) || (function () {
74702
74828
  var extendStatics = function (d, b) {
74703
74829
  extendStatics = Object.setPrototypeOf ||
@@ -74721,6 +74847,8 @@ var __extends = (undefined && undefined.__extends) || (function () {
74721
74847
 
74722
74848
 
74723
74849
 
74850
+
74851
+ // import { ReactElementFactory, SurveyFileChooseButton } from "../entries/react-ui-model";
74724
74852
  var SurveyQuestionFile = /** @class */ (function (_super) {
74725
74853
  __extends(SurveyQuestionFile, _super);
74726
74854
  function SurveyQuestionFile(props) {
@@ -74778,7 +74906,7 @@ var SurveyQuestionFile = /** @class */ (function (_super) {
74778
74906
  noFileChosen)));
74779
74907
  };
74780
74908
  SurveyQuestionFile.prototype.renderChooseButton = function () {
74781
- return react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_entries_react_ui_model__WEBPACK_IMPORTED_MODULE_7__["SurveyFileChooseButton"], { data: { question: this.question } });
74909
+ return react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_components_file_file_choose_button__WEBPACK_IMPORTED_MODULE_8__["SurveyFileChooseButton"], { data: { question: this.question } });
74782
74910
  };
74783
74911
  SurveyQuestionFile.prototype.renderClearButton = function (className) {
74784
74912
  return !this.question.isUploading ? (react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("button", { type: "button", onClick: this.question.doClean, className: className },
@@ -74786,7 +74914,7 @@ var SurveyQuestionFile = /** @class */ (function (_super) {
74786
74914
  (!!this.question.cssClasses.removeButtonIconId) ? react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_components_svg_icon_svg_icon__WEBPACK_IMPORTED_MODULE_2__["SvgIcon"], { iconName: this.question.cssClasses.removeButtonIconId, size: "auto", title: this.question.clearButtonCaption }) : null)) : null;
74787
74915
  };
74788
74916
  SurveyQuestionFile.prototype.renderPreview = function () {
74789
- return _entries_react_ui_model__WEBPACK_IMPORTED_MODULE_7__["ReactElementFactory"].Instance.createElement("sv-file-preview", { question: this.question });
74917
+ return _element_factory__WEBPACK_IMPORTED_MODULE_7__["ReactElementFactory"].Instance.createElement("sv-file-preview", { question: this.question });
74790
74918
  };
74791
74919
  SurveyQuestionFile.prototype.renderLoadingIndicator = function () {
74792
74920
  return react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: this.question.cssClasses.loadingIndicator },
@@ -78517,7 +78645,8 @@ var settings = {
78517
78645
  "a": /[a-zA-Z]/,
78518
78646
  "#": /[a-zA-Z0-9]/
78519
78647
  }
78520
- }
78648
+ },
78649
+ storeUtcDates: false
78521
78650
  };
78522
78651
 
78523
78652
 
@@ -78984,6 +79113,42 @@ var SurveyElementCore = /** @class */ (function (_super) {
78984
79113
  SurveyElementCore.prototype.createLocTitleProperty = function () {
78985
79114
  return this.createLocalizableString("title", this, true);
78986
79115
  };
79116
+ Object.defineProperty(SurveyElementCore.prototype, "isPage", {
79117
+ /**
79118
+ * Returns `true` if the survey element is a page.
79119
+ * @see Base.getType
79120
+ */
79121
+ get: function () { return false; },
79122
+ enumerable: false,
79123
+ configurable: true
79124
+ });
79125
+ Object.defineProperty(SurveyElementCore.prototype, "isPanel", {
79126
+ /**
79127
+ * Returns `true` if the survey element is a panel.
79128
+ * @see Base.getType
79129
+ */
79130
+ get: function () { return false; },
79131
+ enumerable: false,
79132
+ configurable: true
79133
+ });
79134
+ Object.defineProperty(SurveyElementCore.prototype, "isQuestion", {
79135
+ /**
79136
+ * Returns `true` if the survey element is a question.
79137
+ * @see Base.getType
79138
+ */
79139
+ get: function () { return false; },
79140
+ enumerable: false,
79141
+ configurable: true
79142
+ });
79143
+ Object.defineProperty(SurveyElementCore.prototype, "isSurvey", {
79144
+ /**
79145
+ * Returns `true` if the element is a survey.
79146
+ * @see Base.getType
79147
+ */
79148
+ get: function () { return false; },
79149
+ enumerable: false,
79150
+ configurable: true
79151
+ });
78987
79152
  Object.defineProperty(SurveyElementCore.prototype, "title", {
78988
79153
  /**
78989
79154
  * A title for the survey element. If `title` is undefined, the `name` property value is displayed instead.
@@ -79815,39 +79980,6 @@ var SurveyElement = /** @class */ (function (_super) {
79815
79980
  SurveyElement.prototype.setVisibleIndex = function (index) {
79816
79981
  return 0;
79817
79982
  };
79818
- Object.defineProperty(SurveyElement.prototype, "isPage", {
79819
- /**
79820
- * Returns `true` if the survey element is a page.
79821
- * @see Base.getType
79822
- */
79823
- get: function () {
79824
- return false;
79825
- },
79826
- enumerable: false,
79827
- configurable: true
79828
- });
79829
- Object.defineProperty(SurveyElement.prototype, "isPanel", {
79830
- /**
79831
- * Returns `true` if the survey element is a panel.
79832
- * @see Base.getType
79833
- */
79834
- get: function () {
79835
- return false;
79836
- },
79837
- enumerable: false,
79838
- configurable: true
79839
- });
79840
- Object.defineProperty(SurveyElement.prototype, "isQuestion", {
79841
- /**
79842
- * Returns `true` if the survey element is a question.
79843
- * @see Base.getType
79844
- */
79845
- get: function () {
79846
- return false;
79847
- },
79848
- enumerable: false,
79849
- configurable: true
79850
- });
79851
79983
  SurveyElement.prototype.delete = function (doDispose) { };
79852
79984
  /**
79853
79985
  * Returns the survey's [locale](https://surveyjs.io/form-library/documentation/surveymodel#locale).
@@ -83733,6 +83865,30 @@ var SurveyModel = /** @class */ (function (_super) {
83733
83865
  this.runConditions();
83734
83866
  this.updateAllQuestionsValue(clearData);
83735
83867
  };
83868
+ Object.defineProperty(SurveyModel.prototype, "isSurvey", {
83869
+ get: function () { return true; },
83870
+ enumerable: false,
83871
+ configurable: true
83872
+ });
83873
+ /**
83874
+ * Returns an object with survey results.
83875
+ *
83876
+ * If you want to get a survey results object that mirrors the survey structure, call the `getData()` method with an object that has the `includePages` and `includePanels` properties enabled. Without this object, the `getData()` method returns the [`data`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#data) property value.
83877
+ *
83878
+ * ```js
83879
+ * import { Model } from "survey-core";
83880
+ *
83881
+ * const surveyJson = { ... };
83882
+ * const survey = new Model(surveyJson);
83883
+ * survey.getData({ includePages: true, includePanels: true });
83884
+ * ```
83885
+ */
83886
+ SurveyModel.prototype.getData = function (options) {
83887
+ var opt = options || { includePages: false, includePanels: false };
83888
+ if (!opt.includePages && !opt.includePanels)
83889
+ return this.data;
83890
+ return this.getStructuredData(!!opt.includePages, !opt.includePanels ? (opt.includePages ? 1 : 0) : -1);
83891
+ };
83736
83892
  SurveyModel.prototype.getStructuredData = function (includePages, level) {
83737
83893
  if (includePages === void 0) { includePages = true; }
83738
83894
  if (level === void 0) { level = -1; }
@@ -84212,7 +84368,9 @@ var SurveyModel = /** @class */ (function (_super) {
84212
84368
  });
84213
84369
  SurveyModel.prototype.updateActivePage = function () {
84214
84370
  var newPage = this.isShowStartingPage ? this.startedPage : this.currentPage;
84215
- this.setPropertyValue("activePage", newPage);
84371
+ if (newPage !== this.activePage) {
84372
+ this.setPropertyValue("activePage", newPage);
84373
+ }
84216
84374
  };
84217
84375
  SurveyModel.prototype.onStateAndCurrentPageChanged = function () {
84218
84376
  this.updateActivePage();
@@ -85431,7 +85589,7 @@ var SurveyModel = /** @class */ (function (_super) {
85431
85589
  if (this.isFirstPage || !this.showPrevButton || this.state !== "running")
85432
85590
  return false;
85433
85591
  var page = this.visiblePages[this.currentPageNo - 1];
85434
- return this.getPageMaxTimeToFinish(page) <= 0;
85592
+ return page && page.getMaxTimeToFinish() <= 0;
85435
85593
  };
85436
85594
  SurveyModel.prototype.calcIsShowNextButton = function () {
85437
85595
  return this.state === "running" && !this.isLastPage && !this.canBeCompletedByTrigger;
@@ -87085,19 +87243,19 @@ var SurveyModel = /** @class */ (function (_super) {
87085
87243
  this.onLoadingSurveyFromService();
87086
87244
  if (clientId) {
87087
87245
  this.createSurveyService().getSurveyJsonAndIsCompleted(this.surveyId, this.clientId, function (success, json, isCompleted, response) {
87088
- self.isLoading = false;
87089
87246
  if (success) {
87090
87247
  self.isCompletedBefore = isCompleted == "completed";
87091
87248
  self.loadSurveyFromServiceJson(json);
87092
87249
  }
87250
+ self.isLoading = false;
87093
87251
  });
87094
87252
  }
87095
87253
  else {
87096
87254
  this.createSurveyService().loadSurvey(this.surveyId, function (success, result, response) {
87097
- self.isLoading = false;
87098
87255
  if (success) {
87099
87256
  self.loadSurveyFromServiceJson(result);
87100
87257
  }
87258
+ self.isLoading = false;
87101
87259
  });
87102
87260
  }
87103
87261
  };
@@ -88201,7 +88359,7 @@ var SurveyModel = /** @class */ (function (_super) {
88201
88359
  return { spent: 0, limit: 0 };
88202
88360
  var pageSpent = page.timeSpent;
88203
88361
  var surveySpent = this.timeSpent;
88204
- var pageLimitSec = this.getPageMaxTimeToFinish(page);
88362
+ var pageLimitSec = page.getMaxTimeToFinish();
88205
88363
  var surveyLimit = this.maxTimeToFinish;
88206
88364
  if (this.showTimerPanelMode == "page") {
88207
88365
  return { spent: pageSpent, limit: pageLimitSec };
@@ -88230,7 +88388,7 @@ var SurveyModel = /** @class */ (function (_super) {
88230
88388
  return "";
88231
88389
  var pageSpent = this.getDisplayTime(page.timeSpent);
88232
88390
  var surveySpent = this.getDisplayTime(this.timeSpent);
88233
- var pageLimitSec = this.getPageMaxTimeToFinish(page);
88391
+ var pageLimitSec = page.getMaxTimeToFinish();
88234
88392
  var pageLimit = this.getDisplayTime(pageLimitSec);
88235
88393
  var surveyLimit = this.getDisplayTime(this.maxTimeToFinish);
88236
88394
  if (this.showTimerPanelMode == "page")
@@ -88251,7 +88409,7 @@ var SurveyModel = /** @class */ (function (_super) {
88251
88409
  return "";
88252
88410
  };
88253
88411
  SurveyModel.prototype.getTimerInfoPageText = function (page, pageSpent, pageLimit) {
88254
- return this.getPageMaxTimeToFinish(page) > 0
88412
+ return !!page && page.getMaxTimeToFinish() > 0
88255
88413
  ? this.getLocalizationFormatString("timerLimitPage", pageSpent, pageLimit)
88256
88414
  : this.getLocalizationFormatString("timerSpentPage", pageSpent, pageLimit);
88257
88415
  };
@@ -88376,20 +88534,14 @@ var SurveyModel = /** @class */ (function (_super) {
88376
88534
  enumerable: false,
88377
88535
  configurable: true
88378
88536
  });
88379
- SurveyModel.prototype.getPageMaxTimeToFinish = function (page) {
88380
- if (!page || page.maxTimeToFinish < 0)
88381
- return 0;
88382
- return page.maxTimeToFinish > 0
88383
- ? page.maxTimeToFinish
88384
- : this.maxTimeToFinishPage;
88385
- };
88386
88537
  SurveyModel.prototype.doTimer = function (page) {
88387
88538
  this.onTimer.fire(this, {});
88388
- if (this.maxTimeToFinish > 0 && this.maxTimeToFinish == this.timeSpent) {
88539
+ if (this.maxTimeToFinish > 0 && this.maxTimeToFinish <= this.timeSpent) {
88540
+ this.timeSpent = this.maxTimeToFinish;
88389
88541
  this.completeLastPage();
88390
88542
  }
88391
88543
  if (page) {
88392
- var pageLimit = this.getPageMaxTimeToFinish(page);
88544
+ var pageLimit = page.getMaxTimeToFinish();
88393
88545
  if (pageLimit > 0 && pageLimit == page.timeSpent) {
88394
88546
  if (this.isLastPage) {
88395
88547
  this.completeLastPage();
@@ -88772,10 +88924,21 @@ var SurveyModel = /** @class */ (function (_super) {
88772
88924
  this.disposeCallback();
88773
88925
  }
88774
88926
  };
88927
+ // private _lastScrollTop = 0;
88928
+ SurveyModel.prototype._isElementShouldBeSticky = function (selector) {
88929
+ if (!selector)
88930
+ return false;
88931
+ var topStickyContainer = this.rootElement.querySelector(selector);
88932
+ if (!!topStickyContainer) {
88933
+ // const scrollDirection = this.rootElement.scrollTop > this._lastScrollTop ? "down" : "up";
88934
+ // this._lastScrollTop = this.rootElement.scrollTop;
88935
+ return this.rootElement.scrollTop > 0 && topStickyContainer.getBoundingClientRect().y <= this.rootElement.getBoundingClientRect().y;
88936
+ }
88937
+ return false;
88938
+ };
88775
88939
  SurveyModel.prototype.onScroll = function () {
88776
88940
  if (!!this.rootElement) {
88777
- var topStickyContainer = this.rootElement.querySelector(".sv-components-container-center");
88778
- if (!!topStickyContainer && topStickyContainer.getBoundingClientRect().y <= this.rootElement.getBoundingClientRect().y) {
88941
+ if (this._isElementShouldBeSticky(".sv-components-container-center")) {
88779
88942
  this.rootElement.classList && this.rootElement.classList.add("sv-root--sticky-top");
88780
88943
  }
88781
88944
  else {
@@ -89518,7 +89681,7 @@ var SurveyTimerModel = /** @class */ (function (_super) {
89518
89681
  this.survey.onCurrentPageChanged.add(function () {
89519
89682
  _this.update();
89520
89683
  });
89521
- this.timerFunc = function () { _this.doTimer(); };
89684
+ this.timerFunc = function (sender, options) { _this.doTimer(options.seconds); };
89522
89685
  this.setIsRunning(true);
89523
89686
  this.update();
89524
89687
  _surveytimer__WEBPACK_IMPORTED_MODULE_1__["SurveyTimer"].instance.start(this.timerFunc);
@@ -89543,12 +89706,16 @@ var SurveyTimerModel = /** @class */ (function (_super) {
89543
89706
  this.updateText();
89544
89707
  this.updateProgress();
89545
89708
  };
89546
- SurveyTimerModel.prototype.doTimer = function () {
89709
+ SurveyTimerModel.prototype.doTimer = function (seconds) {
89547
89710
  var page = this.survey.currentPage;
89548
89711
  if (page) {
89549
- page.timeSpent = page.timeSpent + 1;
89712
+ var pageMaxTime = page.getMaxTimeToFinish();
89713
+ if (pageMaxTime > 0 && pageMaxTime < page.timeSpent + seconds) {
89714
+ seconds = pageMaxTime - page.timeSpent;
89715
+ }
89716
+ page.timeSpent = page.timeSpent + seconds;
89550
89717
  }
89551
- this.spent = this.spent + 1;
89718
+ this.spent = this.spent + seconds;
89552
89719
  this.update();
89553
89720
  if (this.onTimer) {
89554
89721
  this.onTimer(page);
@@ -89834,13 +90001,14 @@ var surveyTimerFunctions = {
89834
90001
  else {
89835
90002
  return setTimeout(func, delay);
89836
90003
  }
89837
- }
90004
+ },
90005
+ now: function () { return Date.now(); }
89838
90006
  };
89839
90007
  var SurveyTimer = /** @class */ (function () {
89840
90008
  function SurveyTimer() {
89841
90009
  this.listenerCounter = 0;
89842
90010
  this.timerId = -1;
89843
- this.onTimer = new _base__WEBPACK_IMPORTED_MODULE_0__["Event"]();
90011
+ this.onTimer = new _base__WEBPACK_IMPORTED_MODULE_0__["EventBase"]();
89844
90012
  }
89845
90013
  Object.defineProperty(SurveyTimer, "instance", {
89846
90014
  get: function () {
@@ -89858,6 +90026,7 @@ var SurveyTimer = /** @class */ (function () {
89858
90026
  if (func) {
89859
90027
  this.onTimer.add(func);
89860
90028
  }
90029
+ this.prevTimeInMs = surveyTimerFunctions.now();
89861
90030
  if (this.timerId < 0) {
89862
90031
  this.timerId = surveyTimerFunctions.setTimeout(function () {
89863
90032
  _this.doTimer();
@@ -89883,8 +90052,14 @@ var SurveyTimer = /** @class */ (function () {
89883
90052
  }
89884
90053
  if (this.timerId < 0)
89885
90054
  return;
90055
+ var newTimer = surveyTimerFunctions.now();
90056
+ var seconds = Math.floor((newTimer - this.prevTimeInMs) / 1000);
90057
+ this.prevTimeInMs = newTimer;
90058
+ if (seconds < 0) {
90059
+ seconds = 1;
90060
+ }
89886
90061
  var prevItem = this.timerId;
89887
- this.onTimer.fire(this, {});
90062
+ this.onTimer.fire(this, { seconds: seconds });
89888
90063
  //We have to check that we have the same timerId
89889
90064
  //It could be changed during events execution and it will lead to double timer events
89890
90065
  if (prevItem !== this.timerId)
@@ -92424,7 +92599,7 @@ function navigateToUrl(url) {
92424
92599
  var location = _global_variables_utils__WEBPACK_IMPORTED_MODULE_3__["DomWindowHelper"].getLocation();
92425
92600
  if (!url || !location)
92426
92601
  return;
92427
- location.href = url;
92602
+ location.href = encodeURIComponent(url);
92428
92603
  }
92429
92604
  function wrapUrlForBackgroundImage(url) {
92430
92605
  return !!url ? ["url(", url, ")"].join("") : "";