survey-react 1.11.6 → 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.6
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
  */
@@ -2298,6 +2298,8 @@ var Base = /** @class */ (function () {
2298
2298
  if (!prop || prop.isCustom && this.isCreating)
2299
2299
  return undefined;
2300
2300
  var dValue = prop.defaultValue;
2301
+ if (!!prop.defaultValueFunc)
2302
+ return dValue;
2301
2303
  if (!this.isPropertyEmpty(dValue) && !Array.isArray(dValue))
2302
2304
  return dValue;
2303
2305
  var locStr = this.localizableStrings ? this.localizableStrings[name] : undefined;
@@ -9953,8 +9955,8 @@ __webpack_require__.r(__webpack_exports__);
9953
9955
 
9954
9956
  var Version;
9955
9957
  var ReleaseDate;
9956
- Version = "" + "1.11.6";
9957
- ReleaseDate = "" + "2024-07-10";
9958
+ Version = "" + "1.11.7";
9959
+ ReleaseDate = "" + "2024-07-16";
9958
9960
  function checkLibraryVersion(ver, libraryName) {
9959
9961
  if (Version != ver) {
9960
9962
  var str = "survey-core has version '" + Version + "' and " + libraryName
@@ -19785,7 +19787,7 @@ var JsonObjectProperty = /** @class */ (function () {
19785
19787
  }
19786
19788
  if (this.isLocalizable)
19787
19789
  return value === null || value === undefined;
19788
- return ((value === false && (this.type == "boolean" || this.type == "switch")) ||
19790
+ return ((value === false && (this.type == "boolean" || this.type == "switch") && !this.defaultValueFunc) ||
19789
19791
  value === "" || _helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(value));
19790
19792
  };
19791
19793
  JsonObjectProperty.prototype.getSerializableValue = function (obj) {
@@ -30799,6 +30801,10 @@ var InputElementAdapter = /** @class */ (function () {
30799
30801
  event.preventDefault();
30800
30802
  }
30801
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
+ };
30802
30808
  var _value = value;
30803
30809
  if (_value === null || _value === undefined) {
30804
30810
  _value = "";
@@ -30832,6 +30838,7 @@ var InputElementAdapter = /** @class */ (function () {
30832
30838
  this.inputElement.addEventListener("beforeinput", this.beforeInputHandler);
30833
30839
  this.inputElement.addEventListener("click", this.clickHandler);
30834
30840
  this.inputElement.addEventListener("focus", this.clickHandler);
30841
+ this.inputElement.addEventListener("change", this.changeHandler);
30835
30842
  }
30836
30843
  };
30837
30844
  InputElementAdapter.prototype.removeInputEventListener = function () {
@@ -30839,6 +30846,7 @@ var InputElementAdapter = /** @class */ (function () {
30839
30846
  this.inputElement.removeEventListener("beforeinput", this.beforeInputHandler);
30840
30847
  this.inputElement.removeEventListener("click", this.clickHandler);
30841
30848
  this.inputElement.removeEventListener("focus", this.clickHandler);
30849
+ this.inputElement.removeEventListener("change", this.changeHandler);
30842
30850
  }
30843
30851
  };
30844
30852
  InputElementAdapter.prototype.dispose = function () {
@@ -32932,6 +32940,12 @@ var PageModel = /** @class */ (function (_super) {
32932
32940
  enumerable: false,
32933
32941
  configurable: true
32934
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
+ };
32935
32949
  PageModel.prototype.onNumChanged = function (value) { };
32936
32950
  PageModel.prototype.onVisibleChanged = function () {
32937
32951
  if (this.isRandomizing)
@@ -34017,6 +34031,23 @@ var PanelModelBase = /** @class */ (function (_super) {
34017
34031
  this.parent.validateContainerOnly();
34018
34032
  }
34019
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
+ };
34020
34051
  PanelModelBase.prototype.hasErrorsInPanels = function (rec) {
34021
34052
  var errors = [];
34022
34053
  this.hasRequiredError(rec, errors);
@@ -39426,8 +39457,12 @@ var Question = /** @class */ (function (_super) {
39426
39457
  Object.defineProperty(Question.prototype, "titleWidth", {
39427
39458
  get: function () {
39428
39459
  if (this.getTitleLocation() === "left") {
39429
- if (!!this.parent)
39430
- 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
+ }
39431
39466
  }
39432
39467
  return undefined;
39433
39468
  },
@@ -40569,14 +40604,23 @@ var Question = /** @class */ (function (_super) {
40569
40604
  Question.prototype.getFilteredName = function () { return this.getValueName(); };
40570
40605
  Object.defineProperty(Question.prototype, "valueForSurvey", {
40571
40606
  get: function () {
40572
- if (!!this.valueToDataCallback) {
40573
- return this.valueToDataCallback(this.value);
40574
- }
40575
- return this.value;
40607
+ return this.valueForSurveyCore(this.value);
40576
40608
  },
40577
40609
  enumerable: false,
40578
40610
  configurable: true
40579
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
+ };
40580
40624
  /**
40581
40625
  * Sets the question's `value` and `comment` properties to `undefined`.
40582
40626
  * @see value
@@ -41398,6 +41442,9 @@ var Question = /** @class */ (function (_super) {
41398
41442
  this.updateQuestionCss();
41399
41443
  }
41400
41444
  this.isOldAnswered = undefined;
41445
+ if (this.parent) {
41446
+ this.parent.onQuestionValueChanged(this);
41447
+ }
41401
41448
  };
41402
41449
  Question.prototype.checkIsValueCorrect = function (val) {
41403
41450
  var res = this.isValueEmpty(val, !this.allowSpaceAsAnswer) || this.isNewValueCorrect(val);
@@ -41483,9 +41530,7 @@ var Question = /** @class */ (function (_super) {
41483
41530
  var _this = this;
41484
41531
  if (clearData === void 0) { clearData = false; }
41485
41532
  newValue = this.getUnbindValue(newValue);
41486
- if (!!this.valueFromDataCallback) {
41487
- newValue = this.valueFromDataCallback(newValue);
41488
- }
41533
+ newValue = this.valueFromDataCore(newValue);
41489
41534
  if (!this.checkIsValueCorrect(newValue))
41490
41535
  return;
41491
41536
  var isEmpty = this.isValueEmpty(newValue);
@@ -44672,6 +44717,8 @@ _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("selectbase", [
44672
44717
  return !obj.choicesFromQuestion;
44673
44718
  },
44674
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" },
44675
44722
  { name: "separateSpecialChoices:boolean", visible: false },
44676
44723
  { name: "showOtherItem:boolean", alternativeName: "hasOther" },
44677
44724
  { name: "showNoneItem:boolean", alternativeName: "hasNone" },
@@ -44731,8 +44778,7 @@ _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("selectbase", [
44731
44778
  default: "default",
44732
44779
  choices: ["default", true, false],
44733
44780
  visible: false,
44734
- },
44735
- // { name: "itemComponent", visible: false }
44781
+ }
44736
44782
  ], null, "question");
44737
44783
  _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("checkboxbase", [
44738
44784
  {
@@ -46389,7 +46435,7 @@ var QuestionCommentModel = /** @class */ (function (_super) {
46389
46435
  * @see allowResize
46390
46436
  */
46391
46437
  get: function () {
46392
- return this.getPropertyValue("autoGrow") || (this.survey && this.survey.autoGrowComment);
46438
+ return this.getPropertyValue("autoGrow");
46393
46439
  },
46394
46440
  set: function (val) {
46395
46441
  this.setPropertyValue("autoGrow", val);
@@ -46397,9 +46443,16 @@ var QuestionCommentModel = /** @class */ (function (_super) {
46397
46443
  enumerable: false,
46398
46444
  configurable: true
46399
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
+ });
46400
46454
  Object.defineProperty(QuestionCommentModel.prototype, "allowResize", {
46401
46455
  /**
46402
- * Specifies whether to display a resize handle for the comment area.
46403
46456
  *
46404
46457
  * Default value: `true` (inherited from `SurveyModel`'s [`allowResizeComment`](https://surveyjs.io/form-library/documentation/surveymodel#allowResizeComment) property)
46405
46458
  * @see autoGrow
@@ -46415,7 +46468,9 @@ var QuestionCommentModel = /** @class */ (function (_super) {
46415
46468
  });
46416
46469
  Object.defineProperty(QuestionCommentModel.prototype, "renderedAllowResize", {
46417
46470
  get: function () {
46418
- 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;
46419
46474
  },
46420
46475
  enumerable: false,
46421
46476
  configurable: true
@@ -46438,7 +46493,7 @@ var QuestionCommentModel = /** @class */ (function (_super) {
46438
46493
  };
46439
46494
  QuestionCommentModel.prototype.updateElement = function () {
46440
46495
  var _this = this;
46441
- if (this.element && this.autoGrow) {
46496
+ if (this.element && this.renderedAutoGrow) {
46442
46497
  setTimeout(function () { return Object(_utils_utils__WEBPACK_IMPORTED_MODULE_3__["increaseHeightByContent"])(_this.element); }, 1);
46443
46498
  }
46444
46499
  };
@@ -46499,8 +46554,8 @@ _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("comment", [
46499
46554
  default: "default",
46500
46555
  choices: ["default", "onBlur", "onTyping"],
46501
46556
  },
46502
- { name: "autoGrow:boolean" },
46503
- { name: "allowResize:boolean", default: true },
46557
+ { name: "autoGrow:boolean", defaultFunc: function () { return undefined; } },
46558
+ { name: "allowResize:boolean", defaultFunc: function () { return undefined; } },
46504
46559
  { name: "acceptCarriageReturn:boolean", default: true, visible: false }
46505
46560
  ], function () {
46506
46561
  return new QuestionCommentModel("");
@@ -47028,6 +47083,9 @@ var QuestionCustomModelBase = /** @class */ (function (_super) {
47028
47083
  QuestionCustomModelBase.prototype.validateContainerOnly = function () {
47029
47084
  // do nothing
47030
47085
  };
47086
+ QuestionCustomModelBase.prototype.onQuestionValueChanged = function (el) {
47087
+ // do nothing
47088
+ };
47031
47089
  QuestionCustomModelBase.prototype.getQuestionErrorLocation = function () {
47032
47090
  return this.getErrorLocation();
47033
47091
  };
@@ -53648,6 +53706,9 @@ var QuestionMatrixDropdownModelBase = /** @class */ (function (_super) {
53648
53706
  enumerable: false,
53649
53707
  configurable: true
53650
53708
  });
53709
+ QuestionMatrixDropdownModelBase.prototype.isSelectCellType = function () {
53710
+ return _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].isDescendantOf(this.cellType, "selectbase");
53711
+ };
53651
53712
  QuestionMatrixDropdownModelBase.prototype.updateColumnsCellType = function () {
53652
53713
  for (var i = 0; i < this.columns.length; i++) {
53653
53714
  this.columns[i].defaultCellTypeChanged();
@@ -53802,13 +53863,17 @@ var QuestionMatrixDropdownModelBase = /** @class */ (function (_super) {
53802
53863
  break;
53803
53864
  columnName = path[i] + columnName;
53804
53865
  }
53866
+ var question = undefined;
53805
53867
  var column = this.getColumnByName(columnName);
53806
- if (!column)
53807
- return null;
53808
- var question = column.createCellQuestion(null);
53809
- if (!question)
53810
- return null;
53811
- 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;
53812
53877
  };
53813
53878
  QuestionMatrixDropdownModelBase.prototype.clearIncorrectValues = function () {
53814
53879
  var rows = this.visibleRows;
@@ -54287,7 +54352,11 @@ var QuestionMatrixDropdownModelBase = /** @class */ (function (_super) {
54287
54352
  return questionPlainData;
54288
54353
  };
54289
54354
  QuestionMatrixDropdownModelBase.prototype.addConditionObjectsByContext = function (objects, context) {
54290
- 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;
54291
54360
  var hasContext = context === true || hasColumnContext;
54292
54361
  var rowsIndeces = this.getConditionObjectsRowIndeces();
54293
54362
  if (hasContext) {
@@ -54303,13 +54372,13 @@ var QuestionMatrixDropdownModelBase = /** @class */ (function (_super) {
54303
54372
  var dot = hasQuestionPrefix && index === -1 ? "." : "";
54304
54373
  var prefixName = (hasQuestionPrefix ? this.getValueName() : "") + dot + rowName + ".";
54305
54374
  var prefixTitle = (hasQuestionPrefix ? this.processedTitle : "") + dot + rowText + ".";
54306
- for (var j = 0; j < this.columns.length; j++) {
54307
- var column = this.columns[j];
54308
- 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)
54309
54378
  continue;
54310
54379
  var obj = {
54311
- name: prefixName + column.name,
54312
- text: prefixTitle + column.fullTitle,
54380
+ name: prefixName + rowElement.name,
54381
+ text: prefixTitle + rowElement.fullTitle,
54313
54382
  question: this
54314
54383
  };
54315
54384
  if (index === -1 && context === true) {
@@ -54376,9 +54445,11 @@ var QuestionMatrixDropdownModelBase = /** @class */ (function (_super) {
54376
54445
  var col = this.columns[i];
54377
54446
  if (!col.templateQuestion.hasInput)
54378
54447
  continue;
54448
+ var hasValue = !_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(rowValue[col.name]);
54449
+ if (!hasValue && !!col.templateQuestion.visibleIf)
54450
+ continue;
54379
54451
  res.questionCount += 1;
54380
54452
  res.requiredQuestionCount += col.isRequired;
54381
- var hasValue = !_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(rowValue[col.name]);
54382
54453
  res.answeredQuestionCount += hasValue ? 1 : 0;
54383
54454
  res.requiredAnsweredQuestionCount += hasValue && col.isRequired ? 1 : 0;
54384
54455
  }
@@ -55016,6 +55087,7 @@ _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("matrixdropdownb
55016
55087
  { name: "horizontalScroll:boolean", visible: false, },
55017
55088
  {
55018
55089
  name: "choices:itemvalue[]", uniqueProperty: "value",
55090
+ visibleIf: function (obj) { return obj.isSelectCellType(); }
55019
55091
  },
55020
55092
  { name: "placeholder", alternativeName: "optionsCaption", serializationProperty: "locPlaceholder" },
55021
55093
  {
@@ -59640,6 +59712,9 @@ var QuestionMultipleTextModel = /** @class */ (function (_super) {
59640
59712
  QuestionMultipleTextModel.prototype.validateContainerOnly = function () {
59641
59713
  // do nothing
59642
59714
  };
59715
+ QuestionMultipleTextModel.prototype.onQuestionValueChanged = function (el) {
59716
+ // do nothing
59717
+ };
59643
59718
  QuestionMultipleTextModel.prototype.getItemLabelCss = function (item) {
59644
59719
  return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_7__["CssClassBuilder"]()
59645
59720
  .append(this.cssClasses.itemLabel)
@@ -63074,7 +63149,7 @@ var QuestionRankingModel = /** @class */ (function (_super) {
63074
63149
  _this.domNode = null;
63075
63150
  _this.onVisibleChoicesChanged = function () {
63076
63151
  _super.prototype.onVisibleChoicesChanged.call(_this);
63077
- if (_this.carryForwardStartUnranked && !_this.isValueSetByUser && !_this.selectToRankEnabled) {
63152
+ if (_this.carryForwardStartUnranked && !_this.isValueSetByUser && !_this.selectToRankEnabled && !_this.defaultValue) {
63078
63153
  _this.value = [];
63079
63154
  }
63080
63155
  // ranking question with only one choice doesn't make sense
@@ -66379,6 +66454,24 @@ var QuestionTextModel = /** @class */ (function (_super) {
66379
66454
  this._inputValue = this.maskInstance.getMaskedValue(this.value);
66380
66455
  }
66381
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
+ };
66382
66475
  QuestionTextModel.prototype.onCheckForErrors = function (errors, isOnValueChanged) {
66383
66476
  var _this = this;
66384
66477
  _super.prototype.onCheckForErrors.call(this, errors, isOnValueChanged);
@@ -66450,11 +66543,14 @@ var QuestionTextModel = /** @class */ (function (_super) {
66450
66543
  });
66451
66544
  Object.defineProperty(QuestionTextModel.prototype, "isDateInputType", {
66452
66545
  get: function () {
66453
- return this.inputType === "date" || this.inputType === "datetime-local";
66546
+ return this.inputType === "date" || this.isDateTimeLocaleType();
66454
66547
  },
66455
66548
  enumerable: false,
66456
66549
  configurable: true
66457
66550
  });
66551
+ QuestionTextModel.prototype.isDateTimeLocaleType = function () {
66552
+ return this.inputType === "datetime-local";
66553
+ };
66458
66554
  QuestionTextModel.prototype.getCalculatedMinMax = function (minMax) {
66459
66555
  if (this.isValueEmpty(minMax))
66460
66556
  return minMax;
@@ -66506,11 +66602,10 @@ var QuestionTextModel = /** @class */ (function (_super) {
66506
66602
  return this.maskTypeIsEmpty ? _super.prototype.getIsInputTextUpdate.call(this) : false;
66507
66603
  };
66508
66604
  QuestionTextModel.prototype.supportGoNextPageAutomatic = function () {
66509
- return !this.getIsInputTextUpdate() &&
66510
- ["date", "datetime-local"].indexOf(this.inputType) < 0;
66605
+ return !this.getIsInputTextUpdate() && !this.isDateInputType;
66511
66606
  };
66512
66607
  QuestionTextModel.prototype.supportGoNextPageError = function () {
66513
- return ["date", "datetime-local"].indexOf(this.inputType) < 0;
66608
+ return !this.isDateInputType;
66514
66609
  };
66515
66610
  Object.defineProperty(QuestionTextModel.prototype, "dataList", {
66516
66611
  /**
@@ -66551,9 +66646,13 @@ var QuestionTextModel = /** @class */ (function (_super) {
66551
66646
  QuestionTextModel.prototype.correctValueType = function (newValue) {
66552
66647
  if (!newValue)
66553
66648
  return newValue;
66554
- if (this.inputType == "number" || this.inputType == "range") {
66649
+ if (this.inputType === "number" || this.inputType === "range") {
66555
66650
  return _helpers__WEBPACK_IMPORTED_MODULE_3__["Helpers"].isNumber(newValue) ? _helpers__WEBPACK_IMPORTED_MODULE_3__["Helpers"].getNumber(newValue) : "";
66556
66651
  }
66652
+ if (this.inputType === "month") {
66653
+ var d = new Date(newValue);
66654
+ return d.getFullYear() + "-" + (d.getMonth() + 1);
66655
+ }
66557
66656
  return newValue;
66558
66657
  };
66559
66658
  QuestionTextModel.prototype.hasPlaceholder = function () {
@@ -74723,7 +74822,8 @@ __webpack_require__.r(__webpack_exports__);
74723
74822
  /* harmony import */ var _reactquestion_factory__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./reactquestion_factory */ "./src/react/reactquestion_factory.tsx");
74724
74823
  /* harmony import */ var _components_loading_indicator__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./components/loading-indicator */ "./src/react/components/loading-indicator.tsx");
74725
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");
74726
- /* 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");
74727
74827
  var __extends = (undefined && undefined.__extends) || (function () {
74728
74828
  var extendStatics = function (d, b) {
74729
74829
  extendStatics = Object.setPrototypeOf ||
@@ -74747,6 +74847,8 @@ var __extends = (undefined && undefined.__extends) || (function () {
74747
74847
 
74748
74848
 
74749
74849
 
74850
+
74851
+ // import { ReactElementFactory, SurveyFileChooseButton } from "../entries/react-ui-model";
74750
74852
  var SurveyQuestionFile = /** @class */ (function (_super) {
74751
74853
  __extends(SurveyQuestionFile, _super);
74752
74854
  function SurveyQuestionFile(props) {
@@ -74804,7 +74906,7 @@ var SurveyQuestionFile = /** @class */ (function (_super) {
74804
74906
  noFileChosen)));
74805
74907
  };
74806
74908
  SurveyQuestionFile.prototype.renderChooseButton = function () {
74807
- 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 } });
74808
74910
  };
74809
74911
  SurveyQuestionFile.prototype.renderClearButton = function (className) {
74810
74912
  return !this.question.isUploading ? (react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("button", { type: "button", onClick: this.question.doClean, className: className },
@@ -74812,7 +74914,7 @@ var SurveyQuestionFile = /** @class */ (function (_super) {
74812
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;
74813
74915
  };
74814
74916
  SurveyQuestionFile.prototype.renderPreview = function () {
74815
- 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 });
74816
74918
  };
74817
74919
  SurveyQuestionFile.prototype.renderLoadingIndicator = function () {
74818
74920
  return react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: this.question.cssClasses.loadingIndicator },
@@ -78543,7 +78645,8 @@ var settings = {
78543
78645
  "a": /[a-zA-Z]/,
78544
78646
  "#": /[a-zA-Z0-9]/
78545
78647
  }
78546
- }
78648
+ },
78649
+ storeUtcDates: false
78547
78650
  };
78548
78651
 
78549
78652
 
@@ -84265,7 +84368,9 @@ var SurveyModel = /** @class */ (function (_super) {
84265
84368
  });
84266
84369
  SurveyModel.prototype.updateActivePage = function () {
84267
84370
  var newPage = this.isShowStartingPage ? this.startedPage : this.currentPage;
84268
- this.setPropertyValue("activePage", newPage);
84371
+ if (newPage !== this.activePage) {
84372
+ this.setPropertyValue("activePage", newPage);
84373
+ }
84269
84374
  };
84270
84375
  SurveyModel.prototype.onStateAndCurrentPageChanged = function () {
84271
84376
  this.updateActivePage();
@@ -85484,7 +85589,7 @@ var SurveyModel = /** @class */ (function (_super) {
85484
85589
  if (this.isFirstPage || !this.showPrevButton || this.state !== "running")
85485
85590
  return false;
85486
85591
  var page = this.visiblePages[this.currentPageNo - 1];
85487
- return this.getPageMaxTimeToFinish(page) <= 0;
85592
+ return page && page.getMaxTimeToFinish() <= 0;
85488
85593
  };
85489
85594
  SurveyModel.prototype.calcIsShowNextButton = function () {
85490
85595
  return this.state === "running" && !this.isLastPage && !this.canBeCompletedByTrigger;
@@ -87138,19 +87243,19 @@ var SurveyModel = /** @class */ (function (_super) {
87138
87243
  this.onLoadingSurveyFromService();
87139
87244
  if (clientId) {
87140
87245
  this.createSurveyService().getSurveyJsonAndIsCompleted(this.surveyId, this.clientId, function (success, json, isCompleted, response) {
87141
- self.isLoading = false;
87142
87246
  if (success) {
87143
87247
  self.isCompletedBefore = isCompleted == "completed";
87144
87248
  self.loadSurveyFromServiceJson(json);
87145
87249
  }
87250
+ self.isLoading = false;
87146
87251
  });
87147
87252
  }
87148
87253
  else {
87149
87254
  this.createSurveyService().loadSurvey(this.surveyId, function (success, result, response) {
87150
- self.isLoading = false;
87151
87255
  if (success) {
87152
87256
  self.loadSurveyFromServiceJson(result);
87153
87257
  }
87258
+ self.isLoading = false;
87154
87259
  });
87155
87260
  }
87156
87261
  };
@@ -88254,7 +88359,7 @@ var SurveyModel = /** @class */ (function (_super) {
88254
88359
  return { spent: 0, limit: 0 };
88255
88360
  var pageSpent = page.timeSpent;
88256
88361
  var surveySpent = this.timeSpent;
88257
- var pageLimitSec = this.getPageMaxTimeToFinish(page);
88362
+ var pageLimitSec = page.getMaxTimeToFinish();
88258
88363
  var surveyLimit = this.maxTimeToFinish;
88259
88364
  if (this.showTimerPanelMode == "page") {
88260
88365
  return { spent: pageSpent, limit: pageLimitSec };
@@ -88283,7 +88388,7 @@ var SurveyModel = /** @class */ (function (_super) {
88283
88388
  return "";
88284
88389
  var pageSpent = this.getDisplayTime(page.timeSpent);
88285
88390
  var surveySpent = this.getDisplayTime(this.timeSpent);
88286
- var pageLimitSec = this.getPageMaxTimeToFinish(page);
88391
+ var pageLimitSec = page.getMaxTimeToFinish();
88287
88392
  var pageLimit = this.getDisplayTime(pageLimitSec);
88288
88393
  var surveyLimit = this.getDisplayTime(this.maxTimeToFinish);
88289
88394
  if (this.showTimerPanelMode == "page")
@@ -88304,7 +88409,7 @@ var SurveyModel = /** @class */ (function (_super) {
88304
88409
  return "";
88305
88410
  };
88306
88411
  SurveyModel.prototype.getTimerInfoPageText = function (page, pageSpent, pageLimit) {
88307
- return this.getPageMaxTimeToFinish(page) > 0
88412
+ return !!page && page.getMaxTimeToFinish() > 0
88308
88413
  ? this.getLocalizationFormatString("timerLimitPage", pageSpent, pageLimit)
88309
88414
  : this.getLocalizationFormatString("timerSpentPage", pageSpent, pageLimit);
88310
88415
  };
@@ -88429,20 +88534,14 @@ var SurveyModel = /** @class */ (function (_super) {
88429
88534
  enumerable: false,
88430
88535
  configurable: true
88431
88536
  });
88432
- SurveyModel.prototype.getPageMaxTimeToFinish = function (page) {
88433
- if (!page || page.maxTimeToFinish < 0)
88434
- return 0;
88435
- return page.maxTimeToFinish > 0
88436
- ? page.maxTimeToFinish
88437
- : this.maxTimeToFinishPage;
88438
- };
88439
88537
  SurveyModel.prototype.doTimer = function (page) {
88440
88538
  this.onTimer.fire(this, {});
88441
- if (this.maxTimeToFinish > 0 && this.maxTimeToFinish == this.timeSpent) {
88539
+ if (this.maxTimeToFinish > 0 && this.maxTimeToFinish <= this.timeSpent) {
88540
+ this.timeSpent = this.maxTimeToFinish;
88442
88541
  this.completeLastPage();
88443
88542
  }
88444
88543
  if (page) {
88445
- var pageLimit = this.getPageMaxTimeToFinish(page);
88544
+ var pageLimit = page.getMaxTimeToFinish();
88446
88545
  if (pageLimit > 0 && pageLimit == page.timeSpent) {
88447
88546
  if (this.isLastPage) {
88448
88547
  this.completeLastPage();
@@ -88825,10 +88924,21 @@ var SurveyModel = /** @class */ (function (_super) {
88825
88924
  this.disposeCallback();
88826
88925
  }
88827
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
+ };
88828
88939
  SurveyModel.prototype.onScroll = function () {
88829
88940
  if (!!this.rootElement) {
88830
- var topStickyContainer = this.rootElement.querySelector(".sv-components-container-center");
88831
- if (!!topStickyContainer && topStickyContainer.getBoundingClientRect().y <= this.rootElement.getBoundingClientRect().y) {
88941
+ if (this._isElementShouldBeSticky(".sv-components-container-center")) {
88832
88942
  this.rootElement.classList && this.rootElement.classList.add("sv-root--sticky-top");
88833
88943
  }
88834
88944
  else {
@@ -89571,7 +89681,7 @@ var SurveyTimerModel = /** @class */ (function (_super) {
89571
89681
  this.survey.onCurrentPageChanged.add(function () {
89572
89682
  _this.update();
89573
89683
  });
89574
- this.timerFunc = function () { _this.doTimer(); };
89684
+ this.timerFunc = function (sender, options) { _this.doTimer(options.seconds); };
89575
89685
  this.setIsRunning(true);
89576
89686
  this.update();
89577
89687
  _surveytimer__WEBPACK_IMPORTED_MODULE_1__["SurveyTimer"].instance.start(this.timerFunc);
@@ -89596,12 +89706,16 @@ var SurveyTimerModel = /** @class */ (function (_super) {
89596
89706
  this.updateText();
89597
89707
  this.updateProgress();
89598
89708
  };
89599
- SurveyTimerModel.prototype.doTimer = function () {
89709
+ SurveyTimerModel.prototype.doTimer = function (seconds) {
89600
89710
  var page = this.survey.currentPage;
89601
89711
  if (page) {
89602
- 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;
89603
89717
  }
89604
- this.spent = this.spent + 1;
89718
+ this.spent = this.spent + seconds;
89605
89719
  this.update();
89606
89720
  if (this.onTimer) {
89607
89721
  this.onTimer(page);
@@ -89887,13 +90001,14 @@ var surveyTimerFunctions = {
89887
90001
  else {
89888
90002
  return setTimeout(func, delay);
89889
90003
  }
89890
- }
90004
+ },
90005
+ now: function () { return Date.now(); }
89891
90006
  };
89892
90007
  var SurveyTimer = /** @class */ (function () {
89893
90008
  function SurveyTimer() {
89894
90009
  this.listenerCounter = 0;
89895
90010
  this.timerId = -1;
89896
- this.onTimer = new _base__WEBPACK_IMPORTED_MODULE_0__["Event"]();
90011
+ this.onTimer = new _base__WEBPACK_IMPORTED_MODULE_0__["EventBase"]();
89897
90012
  }
89898
90013
  Object.defineProperty(SurveyTimer, "instance", {
89899
90014
  get: function () {
@@ -89911,6 +90026,7 @@ var SurveyTimer = /** @class */ (function () {
89911
90026
  if (func) {
89912
90027
  this.onTimer.add(func);
89913
90028
  }
90029
+ this.prevTimeInMs = surveyTimerFunctions.now();
89914
90030
  if (this.timerId < 0) {
89915
90031
  this.timerId = surveyTimerFunctions.setTimeout(function () {
89916
90032
  _this.doTimer();
@@ -89936,8 +90052,14 @@ var SurveyTimer = /** @class */ (function () {
89936
90052
  }
89937
90053
  if (this.timerId < 0)
89938
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
+ }
89939
90061
  var prevItem = this.timerId;
89940
- this.onTimer.fire(this, {});
90062
+ this.onTimer.fire(this, { seconds: seconds });
89941
90063
  //We have to check that we have the same timerId
89942
90064
  //It could be changed during events execution and it will lead to double timer events
89943
90065
  if (prevItem !== this.timerId)
@@ -92477,7 +92599,7 @@ function navigateToUrl(url) {
92477
92599
  var location = _global_variables_utils__WEBPACK_IMPORTED_MODULE_3__["DomWindowHelper"].getLocation();
92478
92600
  if (!url || !location)
92479
92601
  return;
92480
- location.href = url;
92602
+ location.href = encodeURIComponent(url);
92481
92603
  }
92482
92604
  function wrapUrlForBackgroundImage(url) {
92483
92605
  return !!url ? ["url(", url, ")"].join("") : "";