survey-react 1.12.26 → 1.12.28

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.12.26
2
+ * surveyjs - Survey JavaScript library v1.12.28
3
3
  * Copyright (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
5
5
  */
@@ -9963,24 +9963,31 @@ var base_Bindings = /** @class */ (function () {
9963
9963
  return res;
9964
9964
  };
9965
9965
  Bindings.prototype.getJson = function () {
9966
+ var _this = this;
9966
9967
  if (this.isEmpty())
9967
9968
  return undefined;
9968
9969
  var res = {};
9969
- for (var key in this.values) {
9970
- res[key] = this.values[key];
9971
- }
9970
+ this.getNames().forEach(function (key) {
9971
+ if (_this.values[key] !== undefined) {
9972
+ res[key] = _this.values[key];
9973
+ }
9974
+ });
9972
9975
  return res;
9973
9976
  };
9974
9977
  Bindings.prototype.setJson = function (value, isLoading) {
9978
+ var _this = this;
9975
9979
  var oldValue = this.getJson();
9976
9980
  this.values = null;
9977
9981
  if (!!value) {
9978
- this.values = {};
9979
- for (var key in value) {
9980
- this.values[key] = value[key];
9981
- }
9982
+ this.getNames().forEach(function (key) {
9983
+ if (value[key] !== undefined) {
9984
+ if (!_this.values)
9985
+ _this.values = {};
9986
+ _this.values[key] = value[key];
9987
+ }
9988
+ });
9982
9989
  }
9983
- if (!isLoading) {
9990
+ if (!isLoading && !helpers_Helpers.isTwoValueEquals(oldValue, this.values)) {
9984
9991
  this.onChangedJSON(oldValue);
9985
9992
  }
9986
9993
  };
@@ -14833,6 +14840,9 @@ var survey_element_SurveyElement = /** @class */ (function (_super) {
14833
14840
  configurable: true
14834
14841
  });
14835
14842
  SurveyElement.prototype.canHaveFrameStyles = function () {
14843
+ var _a;
14844
+ if (((_a = this.survey) === null || _a === void 0 ? void 0 : _a.currentSingleElement) === this)
14845
+ return true;
14836
14846
  return (this.parent !== undefined && (!this.hasParent || this.parent && this.parent.showPanelAsPage));
14837
14847
  };
14838
14848
  SurveyElement.prototype.getHasFrameV2 = function () {
@@ -18957,7 +18967,7 @@ var TriggerExpressionInfo = /** @class */ (function () {
18957
18967
  this.name = name;
18958
18968
  this.canRun = canRun;
18959
18969
  this.doComplete = doComplete;
18960
- this.runSecondCheck = function (keys) { return false; };
18970
+ this.getSecondRunner = function () { return undefined; };
18961
18971
  }
18962
18972
  return TriggerExpressionInfo;
18963
18973
  }());
@@ -19006,7 +19016,7 @@ var question_Question = /** @class */ (function (_super) {
19006
19016
  _this.finishSetValueOnExpression();
19007
19017
  });
19008
19018
  var setValueIfInfo = _this.addTriggerInfo("setValueIf", function () { return true; }, function () { return _this.runSetValueExpression(); });
19009
- setValueIfInfo.runSecondCheck = function (keys) { return _this.checkExpressionIf(keys); };
19019
+ setValueIfInfo.getSecondRunner = function () { return _this.getSetValueExpressionRunner(); };
19010
19020
  _this.registerPropertyChangedHandlers(["width"], function () {
19011
19021
  _this.updateQuestionCss();
19012
19022
  if (!!_this.parent) {
@@ -19312,13 +19322,21 @@ var question_Question = /** @class */ (function (_super) {
19312
19322
  if (val == this.visible)
19313
19323
  return;
19314
19324
  this.setPropertyValue("visible", val);
19315
- this.onVisibleChanged();
19325
+ this.onVisibleChangedCore();
19316
19326
  this.notifySurveyVisibilityChanged();
19317
19327
  },
19318
19328
  enumerable: false,
19319
19329
  configurable: true
19320
19330
  });
19321
19331
  Question.prototype.onVisibleChanged = function () {
19332
+ var prevVal = this.getPropertyValue("isVisible");
19333
+ this.onVisibleChangedCore();
19334
+ var newVal = this.getPropertyValue("isVisible");
19335
+ if (prevVal !== undefined && prevVal !== newVal) {
19336
+ this.notifySurveyVisibilityChanged();
19337
+ }
19338
+ };
19339
+ Question.prototype.onVisibleChangedCore = function () {
19322
19340
  this.updateIsVisibleProp();
19323
19341
  if (!this.isVisible && this.errors && this.errors.length > 0) {
19324
19342
  this.errors = [];
@@ -19533,11 +19551,9 @@ var question_Question = /** @class */ (function (_super) {
19533
19551
  this.setValueExpressionRunner.run(this.getDataFilteredValues(), this.getDataFilteredProperties());
19534
19552
  }
19535
19553
  };
19536
- Question.prototype.checkExpressionIf = function (keys) {
19554
+ Question.prototype.getSetValueExpressionRunner = function () {
19537
19555
  this.ensureSetValueExpressionRunner();
19538
- if (!this.setValueExpressionRunner)
19539
- return false;
19540
- return this.canExecuteTriggerByKeys(keys, this.setValueExpressionRunner);
19556
+ return this.setValueExpressionRunner;
19541
19557
  };
19542
19558
  Question.prototype.addTriggerInfo = function (name, canRun, doComplete) {
19543
19559
  var info = new TriggerExpressionInfo(name, canRun, doComplete);
@@ -19546,10 +19562,7 @@ var question_Question = /** @class */ (function (_super) {
19546
19562
  };
19547
19563
  Question.prototype.runTriggerInfo = function (info, keys) {
19548
19564
  var expression = this[info.name];
19549
- if (!expression || info.isRunning || !info.canRun()) {
19550
- if (info.runSecondCheck(keys)) {
19551
- info.doComplete();
19552
- }
19565
+ if (!expression && !info.getSecondRunner() || info.isRunning || !info.canRun()) {
19553
19566
  return;
19554
19567
  }
19555
19568
  if (!info.runner) {
@@ -19564,16 +19577,35 @@ var question_Question = /** @class */ (function (_super) {
19564
19577
  else {
19565
19578
  info.runner.expression = expression;
19566
19579
  }
19567
- if (!this.canExecuteTriggerByKeys(keys, info.runner) && !info.runSecondCheck(keys))
19580
+ if (!this.canExecuteTriggerByKeys(keys, info.runner, info.getSecondRunner()))
19568
19581
  return;
19569
19582
  info.isRunning = true;
19570
- info.runner.run(this.getDataFilteredValues(), this.getDataFilteredProperties());
19583
+ if (!expression && info.getSecondRunner()) {
19584
+ info.doComplete();
19585
+ info.isRunning = false;
19586
+ }
19587
+ else {
19588
+ info.runner.run(this.getDataFilteredValues(), this.getDataFilteredProperties());
19589
+ }
19590
+ };
19591
+ Question.prototype.canExecuteTriggerByKeys = function (keys, runner, secondRunner) {
19592
+ if (!runner && !!secondRunner) {
19593
+ runner = secondRunner;
19594
+ secondRunner = undefined;
19595
+ }
19596
+ var run1 = this.canExecuteTriggerByKeysCore(keys, runner);
19597
+ if (run1 === "var")
19598
+ return true;
19599
+ if (!secondRunner)
19600
+ return run1 === "func";
19601
+ var run2 = this.canExecuteTriggerByKeysCore(keys, secondRunner);
19602
+ return run2 !== "";
19571
19603
  };
19572
- Question.prototype.canExecuteTriggerByKeys = function (keys, runner) {
19604
+ Question.prototype.canExecuteTriggerByKeysCore = function (keys, runner) {
19573
19605
  var vars = runner.getVariables();
19574
19606
  if ((!vars || vars.length === 0) && runner.hasFunction())
19575
- return true;
19576
- return new conditionProcessValue_ProcessValue().isAnyKeyChanged(keys, vars);
19607
+ return "func";
19608
+ return new conditionProcessValue_ProcessValue().isAnyKeyChanged(keys, vars) ? "var" : "";
19577
19609
  };
19578
19610
  Question.prototype.runTriggers = function (name, value, keys) {
19579
19611
  var _this = this;
@@ -19950,11 +19982,8 @@ var question_Question = /** @class */ (function (_super) {
19950
19982
  });
19951
19983
  Object.defineProperty(Question.prototype, "renderedCommentPlaceholder", {
19952
19984
  get: function () {
19953
- var _this = this;
19954
- var func = function () {
19955
- return !_this.isReadOnly ? _this.commentPlaceHolder : undefined;
19956
- };
19957
- return this.getPropertyValue("renderedCommentPlaceholder", undefined, func);
19985
+ var _a;
19986
+ return (_a = this.getPropertyValue("renderedCommentPlaceholder")) !== null && _a !== void 0 ? _a : (!this.isReadOnly ? this.commentPlaceHolder : undefined);
19958
19987
  },
19959
19988
  enumerable: false,
19960
19989
  configurable: true
@@ -26545,17 +26574,17 @@ Serializer.addClass("expression", [
26545
26574
  { name: "minimumFractionDigits:number", default: -1 },
26546
26575
  { name: "useGrouping:boolean", default: true },
26547
26576
  { name: "precision:number", default: -1, category: "data" },
26548
- { name: "enableIf", visible: false },
26549
- { name: "isRequired", visible: false },
26550
- { name: "readOnly", visible: false },
26551
- { name: "requiredErrorText", visible: false },
26552
- { name: "resetValueIf", visible: false },
26553
- { name: "setValueIf", visible: false },
26554
- { name: "setValueExpression", visible: false },
26555
- { name: "defaultValueExpression", visible: false },
26556
- { name: "defaultValue", visible: false },
26557
- { name: "correctAnswer", visible: false },
26558
- { name: "requiredIf", visible: false }
26577
+ { name: "enableIf", visible: false, isSerializable: false },
26578
+ { name: "isRequired", visible: false, isSerializable: false },
26579
+ { name: "readOnly", visible: false, isSerializable: false },
26580
+ { name: "requiredErrorText", visible: false, isSerializable: false },
26581
+ { name: "resetValueIf", visible: false, isSerializable: false },
26582
+ { name: "setValueIf", visible: false, isSerializable: false },
26583
+ { name: "setValueExpression", visible: false, isSerializable: false },
26584
+ { name: "defaultValueExpression", visible: false, isSerializable: false },
26585
+ { name: "defaultValue", visible: false, isSerializable: false },
26586
+ { name: "correctAnswer", visible: false, isSerializable: false },
26587
+ { name: "requiredIf", visible: false, isSerializable: false }
26559
26588
  ], function () {
26560
26589
  return new question_expression_QuestionExpressionModel("");
26561
26590
  }, "question");
@@ -39474,7 +39503,7 @@ var page_PageModel = /** @class */ (function (_super) {
39474
39503
  PageModel.prototype.getElementsForRows = function () {
39475
39504
  var _a;
39476
39505
  if (!this.isStartPage) {
39477
- var q = (_a = this.survey) === null || _a === void 0 ? void 0 : _a.currentSingleQuestion;
39506
+ var q = (_a = this.survey) === null || _a === void 0 ? void 0 : _a.currentSingleElement;
39478
39507
  if (!!q) {
39479
39508
  if (q.page === this)
39480
39509
  return [q];
@@ -39512,7 +39541,7 @@ var page_PageModel = /** @class */ (function (_super) {
39512
39541
  });
39513
39542
  Object.defineProperty(PageModel.prototype, "cssTitleNumber", {
39514
39543
  get: function () {
39515
- return this.cssClasses.page.number;
39544
+ return this.isPanel ? this.cssClasses.panel.number : this.cssClasses.page.number;
39516
39545
  },
39517
39546
  enumerable: false,
39518
39547
  configurable: true
@@ -39762,9 +39791,9 @@ var page_PageModel = /** @class */ (function (_super) {
39762
39791
  }
39763
39792
  }
39764
39793
  if (this.randomizeElements(this.areQuestionsRandomized)) {
39765
- var singleQuestion = (_a = this.survey) === null || _a === void 0 ? void 0 : _a.currentSingleQuestion;
39794
+ var singleQuestion = (_a = this.survey) === null || _a === void 0 ? void 0 : _a.currentSingleElement;
39766
39795
  if ((singleQuestion === null || singleQuestion === void 0 ? void 0 : singleQuestion.page) === this) {
39767
- this.survey.currentSingleQuestion = this.getFirstVisibleQuestion();
39796
+ this.survey.currentSingleElement = this.elements[0];
39768
39797
  }
39769
39798
  }
39770
39799
  };
@@ -44099,7 +44128,7 @@ var survey_SurveyModel = /** @class */ (function (_super) {
44099
44128
  if (newPage == this.currentPage)
44100
44129
  return;
44101
44130
  var oldValue = this.currentPage;
44102
- if (!this.isShowingPreview && !this.currentSingleQuestion && !this.currentPageChanging(newPage, oldValue))
44131
+ if (!this.isShowingPreview && !this.currentSingleElement && !this.currentPageChanging(newPage, oldValue))
44103
44132
  return;
44104
44133
  this.setPropertyValue("currentPage", newPage);
44105
44134
  if (!!newPage) {
@@ -44466,9 +44495,9 @@ var survey_SurveyModel = /** @class */ (function (_super) {
44466
44495
  this.onFirstPageIsStartedChanged();
44467
44496
  if (goToFirstPage) {
44468
44497
  this.currentPage = this.firstVisiblePage;
44469
- if (this.currentSingleQuestion) {
44498
+ if (this.currentSingleElement) {
44470
44499
  var questions = this.getSingleQuestions();
44471
- this.currentSingleQuestion = questions.length > 0 ? questions[0] : undefined;
44500
+ this.currentSingleElement = questions.length > 0 ? questions[0] : undefined;
44472
44501
  }
44473
44502
  }
44474
44503
  if (clearData) {
@@ -44517,7 +44546,7 @@ var survey_SurveyModel = /** @class */ (function (_super) {
44517
44546
  if (this.isCurrentPageRendered === true) {
44518
44547
  this.isCurrentPageRendered = false;
44519
44548
  }
44520
- if (!this.currentSingleQuestion) {
44549
+ if (!this.currentSingleElement) {
44521
44550
  var options = this.createPageChangeEventOptions(newValue, oldValue);
44522
44551
  this.onCurrentPageChanged.fire(this, options);
44523
44552
  }
@@ -44764,37 +44793,44 @@ var survey_SurveyModel = /** @class */ (function (_super) {
44764
44793
  * @see completeLastPage
44765
44794
  */
44766
44795
  SurveyModel.prototype.nextPage = function () {
44767
- if (this.currentSingleQuestion)
44796
+ if (this.currentSingleElement)
44768
44797
  return this.performNext();
44769
44798
  if (this.isLastPage)
44770
44799
  return false;
44771
44800
  return this.doCurrentPageComplete(false);
44772
44801
  };
44773
44802
  SurveyModel.prototype.performNext = function () {
44774
- var q = this.currentSingleQuestion;
44803
+ var q = this.currentSingleElement;
44775
44804
  if (!q)
44776
44805
  return this.nextPage();
44777
- if (!q.validate(true))
44806
+ if (this.validationEnabled && !q.validate(true))
44778
44807
  return false;
44779
44808
  var questions = this.getSingleQuestions();
44780
44809
  var index = questions.indexOf(q);
44781
44810
  if (index < 0 || index === questions.length - 1)
44782
44811
  return false;
44783
- var key = {};
44784
- key[q.name] = q.value;
44785
- this.checkTriggers(key, false, false, true, q.name);
44786
- this.currentSingleQuestion = questions[index + 1];
44812
+ var keys = {};
44813
+ if (q.isQuestion) {
44814
+ keys[q.name] = q.value;
44815
+ }
44816
+ else {
44817
+ if (q.isPanel) {
44818
+ keys = q.getValue();
44819
+ }
44820
+ }
44821
+ this.checkTriggers(keys, false, false, true, q.name);
44822
+ this.currentSingleElement = questions[index + 1];
44787
44823
  return true;
44788
44824
  };
44789
44825
  SurveyModel.prototype.performPrevious = function () {
44790
- var q = this.currentSingleQuestion;
44826
+ var q = this.currentSingleElement;
44791
44827
  if (!q)
44792
44828
  return this.prevPage();
44793
44829
  var questions = this.getSingleQuestions();
44794
44830
  var index = questions.indexOf(q);
44795
44831
  if (index === 0)
44796
44832
  return false;
44797
- this.currentSingleQuestion = questions[index - 1];
44833
+ this.currentSingleElement = questions[index - 1];
44798
44834
  return true;
44799
44835
  };
44800
44836
  SurveyModel.prototype.hasErrorsOnNavigate = function (doComplete) {
@@ -45052,8 +45088,8 @@ var survey_SurveyModel = /** @class */ (function (_super) {
45052
45088
  if (!page)
45053
45089
  return true;
45054
45090
  var res = false;
45055
- if (this.currentSingleQuestion) {
45056
- res = !this.currentSingleQuestion.validate(true);
45091
+ if (this.currentSingleElement) {
45092
+ res = !this.currentSingleElement.validate(true);
45057
45093
  }
45058
45094
  else {
45059
45095
  res = !page.validate(true, isFocuseOnFirstError);
@@ -45064,7 +45100,7 @@ var survey_SurveyModel = /** @class */ (function (_super) {
45064
45100
  SurveyModel.prototype.fireValidatedErrorsOnPage = function (page) {
45065
45101
  if (this.onValidatedErrorsOnCurrentPage.isEmpty || !page)
45066
45102
  return;
45067
- var questionsOnPage = page.questions;
45103
+ var questionsOnPage = this.getNestedQuestionsByQuestionArray(page.questions, true);
45068
45104
  var questions = new Array();
45069
45105
  var errors = new Array();
45070
45106
  for (var i = 0; i < questionsOnPage.length; i++) {
@@ -45092,7 +45128,7 @@ var survey_SurveyModel = /** @class */ (function (_super) {
45092
45128
  */
45093
45129
  SurveyModel.prototype.prevPage = function () {
45094
45130
  var _this = this;
45095
- if (this.currentSingleQuestion)
45131
+ if (this.currentSingleElement)
45096
45132
  return this.performPrevious();
45097
45133
  if (this.isFirstPage || this.state === "starting")
45098
45134
  return false;
@@ -45166,7 +45202,7 @@ var survey_SurveyModel = /** @class */ (function (_super) {
45166
45202
  return false;
45167
45203
  }
45168
45204
  this.showPreviewCore();
45169
- return true;
45205
+ return this.isShowingPreview;
45170
45206
  };
45171
45207
  SurveyModel.prototype.showPreviewCore = function () {
45172
45208
  var options = { allowShowPreview: true, allow: true };
@@ -45181,11 +45217,17 @@ var survey_SurveyModel = /** @class */ (function (_super) {
45181
45217
  * @see state
45182
45218
  */
45183
45219
  SurveyModel.prototype.cancelPreview = function (currentPage) {
45220
+ var _a;
45184
45221
  if (currentPage === void 0) { currentPage = null; }
45185
45222
  if (!this.isShowingPreview)
45186
45223
  return;
45187
45224
  this.gotoPageFromPreview = currentPage;
45188
45225
  this.isShowingPreview = false;
45226
+ var page = (_a = this.currentSingleElement) === null || _a === void 0 ? void 0 : _a.page;
45227
+ if (!!page) {
45228
+ page.updateRows();
45229
+ this.currentPage = page;
45230
+ }
45189
45231
  };
45190
45232
  SurveyModel.prototype.cancelPreviewByPage = function (panel) {
45191
45233
  this.cancelPreview(panel);
@@ -45348,6 +45390,9 @@ var survey_SurveyModel = /** @class */ (function (_super) {
45348
45390
  rootPage.setSurveyImpl(this);
45349
45391
  this.pageContainerValue = rootPage;
45350
45392
  this.currentPage = rootPage;
45393
+ if (!!this.currentSingleElementValue) {
45394
+ this.visiblePages.forEach(function (page) { return page.updateRows(); });
45395
+ }
45351
45396
  }
45352
45397
  if (!this.isSinglePage && !this.isShowingPreview) {
45353
45398
  this.disposeContainerPage();
@@ -45375,32 +45420,44 @@ var survey_SurveyModel = /** @class */ (function (_super) {
45375
45420
  SurveyModel.prototype.getSingleQuestions = function () {
45376
45421
  var res = new Array();
45377
45422
  var pages = this.pages;
45378
- for (var i = 0; i < pages.length; i++) {
45423
+ var _loop_3 = function () {
45379
45424
  var p = pages[i];
45380
45425
  if (!p.isStartPage && p.isVisible) {
45381
- p.addQuestionsToList(res, true);
45426
+ var qs_1 = [];
45427
+ //p.addQuestionsToList(qs, true);
45428
+ p.elements.forEach(function (el) { return qs_1.push(el); });
45429
+ qs_1.forEach(function (q) { if (q.isVisible)
45430
+ res.push(q); });
45382
45431
  }
45432
+ };
45433
+ for (var i = 0; i < pages.length; i++) {
45434
+ _loop_3();
45383
45435
  }
45384
45436
  return res;
45385
45437
  };
45386
- Object.defineProperty(SurveyModel.prototype, "currentSingleQuestion", {
45387
- get: function () { return this.currentSingleQuestionValue; },
45438
+ Object.defineProperty(SurveyModel.prototype, "currentSingleElement", {
45439
+ get: function () {
45440
+ return !this.isShowingPreview ? this.currentSingleElementValue : undefined;
45441
+ },
45388
45442
  set: function (val) {
45389
- var oldVal = this.currentSingleQuestion;
45443
+ var _a;
45444
+ var oldVal = this.currentSingleElement;
45390
45445
  if (val !== oldVal && !this.isCompleted) {
45391
- var options = !!val && !!oldVal ? this.createPageChangeEventOptions(val.page, oldVal.page, val, oldVal) : undefined;
45446
+ var valQuestion = (val === null || val === void 0 ? void 0 : val.isQuestion) ? val : undefined;
45447
+ var oldValQuestion = (oldVal === null || oldVal === void 0 ? void 0 : oldVal.isQuestion) ? oldVal : undefined;
45448
+ var page = (_a = val) === null || _a === void 0 ? void 0 : _a.page;
45449
+ var options = !!page && !!oldVal ? this.createPageChangeEventOptions(page, oldVal.page, valQuestion, oldValQuestion) : undefined;
45392
45450
  if (!!options && !this.currentPageChangingFromOptions(options))
45393
45451
  return;
45394
- this.currentSingleQuestionValue = val;
45452
+ this.currentSingleElementValue = val;
45395
45453
  if (!!val) {
45396
- var page = val.page;
45397
45454
  page.updateRows();
45398
45455
  if (page !== this.currentPage) {
45399
45456
  this.currentPage = page;
45400
45457
  }
45401
45458
  else {
45402
- if (this.focusFirstQuestionAutomatic) {
45403
- val.focus();
45459
+ if (!!valQuestion && this.focusFirstQuestionAutomatic) {
45460
+ valQuestion.focus();
45404
45461
  }
45405
45462
  }
45406
45463
  this.updateButtonsVisibility();
@@ -45416,10 +45473,21 @@ var survey_SurveyModel = /** @class */ (function (_super) {
45416
45473
  enumerable: false,
45417
45474
  configurable: true
45418
45475
  });
45476
+ Object.defineProperty(SurveyModel.prototype, "currentSingleQuestion", {
45477
+ get: function () {
45478
+ var res = this.currentSingleElement;
45479
+ return !!res && res.isQuestion ? res : undefined;
45480
+ },
45481
+ set: function (val) {
45482
+ this.currentSingleElement = val;
45483
+ },
45484
+ enumerable: false,
45485
+ configurable: true
45486
+ });
45419
45487
  SurveyModel.prototype.onQuestionsOnPageModeChanged = function (oldValue) {
45420
45488
  if (this.isShowingPreview || this.isDesignMode)
45421
45489
  return;
45422
- this.currentSingleQuestion = undefined;
45490
+ this.currentSingleElement = undefined;
45423
45491
  if (oldValue === "singlePage") {
45424
45492
  this.updatePagesContainer();
45425
45493
  }
@@ -45429,7 +45497,7 @@ var survey_SurveyModel = /** @class */ (function (_super) {
45429
45497
  if (this.isSingleVisibleQuestion) {
45430
45498
  var questions = this.getSingleQuestions();
45431
45499
  if (questions.length > 0) {
45432
- this.currentSingleQuestion = questions[0];
45500
+ this.currentSingleElement = questions[0];
45433
45501
  }
45434
45502
  }
45435
45503
  };
@@ -45521,7 +45589,7 @@ var survey_SurveyModel = /** @class */ (function (_super) {
45521
45589
  this.setPropertyValue("isLastPage", !!curPage && curPage === this.lastVisiblePage);
45522
45590
  var fVal = undefined;
45523
45591
  var lVal = undefined;
45524
- var q = this.currentSingleQuestion;
45592
+ var q = this.currentSingleElement;
45525
45593
  if (!!q) {
45526
45594
  var questions = this.getSingleQuestions();
45527
45595
  var index = questions.indexOf(q);
@@ -46782,6 +46850,9 @@ var survey_SurveyModel = /** @class */ (function (_super) {
46782
46850
  }
46783
46851
  if (!includeNested)
46784
46852
  return res;
46853
+ return this.getNestedQuestionsByQuestionArray(res, visibleOnly);
46854
+ };
46855
+ SurveyModel.prototype.getNestedQuestionsByQuestionArray = function (res, visibleOnly) {
46785
46856
  var res2 = [];
46786
46857
  res.forEach(function (q) {
46787
46858
  res2.push(q);
@@ -47802,10 +47873,10 @@ var survey_SurveyModel = /** @class */ (function (_super) {
47802
47873
  return;
47803
47874
  if (!question.validate(false) && !question.supportGoNextPageError())
47804
47875
  return;
47805
- if (!!this.currentSingleQuestion) {
47806
- var curQuestion_1 = this.currentSingleQuestion;
47876
+ if (!!this.currentSingleElement) {
47877
+ var curQuestion_1 = this.currentSingleElement;
47807
47878
  var goNextQuestion = function () {
47808
- if (curQuestion_1 !== _this.currentSingleQuestion)
47879
+ if (curQuestion_1 !== _this.currentSingleElement)
47809
47880
  return;
47810
47881
  if (!_this.isLastElement) {
47811
47882
  _this.performNext();
@@ -48821,7 +48892,7 @@ var survey_SurveyModel = /** @class */ (function (_super) {
48821
48892
  if (isNeedWaitForPageRendered) {
48822
48893
  this.currentPage = question.page;
48823
48894
  if (this.isSingleVisibleQuestion && !this.isDesignMode) {
48824
- this.currentSingleQuestion = question;
48895
+ this.currentSingleElement = question;
48825
48896
  }
48826
48897
  }
48827
48898
  if (!isNeedWaitForPageRendered) {
@@ -54530,7 +54601,8 @@ var question_matrix_MatrixCells = /** @class */ (function (_super) {
54530
54601
  var rowValues = this.values[row];
54531
54602
  for (var col in rowValues) {
54532
54603
  if (row === this.defaultRowValue || !defaultRow || defaultRow[col] !== rowValues[col]) {
54533
- resRow[col] = rowValues[col];
54604
+ var loc = this.getCellLocCore(row, col);
54605
+ resRow[col] = loc ? loc.getJson() : rowValues[col];
54534
54606
  }
54535
54607
  }
54536
54608
  res[row] = resRow;
@@ -55382,7 +55454,7 @@ var InputElementAdapter = /** @class */ (function () {
55382
55454
  this.inputMaskInstancePropertyChangedHandler = function (sender, options) {
55383
55455
  if (options.name !== "saveMaskedValue") {
55384
55456
  var maskedValue = _this.inputMaskInstance.getMaskedValue(_this.prevUnmaskedValue);
55385
- _this.inputElement.value = maskedValue;
55457
+ _this.setInputValue(maskedValue);
55386
55458
  }
55387
55459
  };
55388
55460
  this.clickHandler = function (event) {
@@ -55393,7 +55465,7 @@ var InputElementAdapter = /** @class */ (function () {
55393
55465
  this.beforeInputHandler = function (event) {
55394
55466
  var args = _this.createArgs(event);
55395
55467
  var result = _this.inputMaskInstance.processInput(args);
55396
- _this.inputElement.value = result.value;
55468
+ _this.setInputValue(result.value);
55397
55469
  _this.inputElement.setSelectionRange(result.caretPosition, result.caretPosition);
55398
55470
  if (!result.cancelPreventDefault) {
55399
55471
  event.preventDefault();
@@ -55401,17 +55473,23 @@ var InputElementAdapter = /** @class */ (function () {
55401
55473
  };
55402
55474
  this.changeHandler = function (event) {
55403
55475
  var result = _this.inputMaskInstance.processInput({ prevValue: "", insertedChars: event.target.value, selectionStart: 0, selectionEnd: 0 });
55404
- _this.inputElement.value = result.value;
55476
+ _this.setInputValue(result.value);
55405
55477
  };
55406
55478
  var _value = value;
55407
55479
  if (_value === null || _value === undefined) {
55408
55480
  _value = "";
55409
55481
  }
55410
- this.inputElement.value = inputMaskInstance.getMaskedValue(_value);
55482
+ this.setInputValue(inputMaskInstance.getMaskedValue(_value));
55411
55483
  this.prevUnmaskedValue = _value;
55412
55484
  inputMaskInstance.onPropertyChanged.add(this.inputMaskInstancePropertyChangedHandler);
55413
55485
  this.addInputEventListener();
55414
55486
  }
55487
+ InputElementAdapter.prototype.setInputValue = function (value) {
55488
+ if (this.inputElement.maxLength >= 0 && this.inputElement.maxLength < value.length) {
55489
+ value = value.slice(0, this.inputElement.maxLength);
55490
+ }
55491
+ this.inputElement.value = value;
55492
+ };
55415
55493
  InputElementAdapter.prototype.createArgs = function (event) {
55416
55494
  var args = {
55417
55495
  insertedChars: event.data,
@@ -72281,7 +72359,7 @@ var mask_datetime_InputMaskDateTime = /** @class */ (function (_super) {
72281
72359
  var maxYear = dateTime.max.getFullYear();
72282
72360
  if (checkOnlyLeapYears) {
72283
72361
  minYear = Math.ceil(minYear / 4) * 4;
72284
- maxYear = Math.floor(minYear / 4) * 4;
72362
+ maxYear = Math.floor(maxYear / 4) * 4;
72285
72363
  if (minYear > maxYear) {
72286
72364
  minYear = undefined;
72287
72365
  maxYear = undefined;
@@ -72445,7 +72523,7 @@ var mask_datetime_InputMaskDateTime = /** @class */ (function (_super) {
72445
72523
  var isoMin, isoMax;
72446
72524
  if (this.hasDatePart) {
72447
72525
  isoMin = this.min || "0001-01-01";
72448
- isoMax = this.max || "9999-12-31";
72526
+ isoMax = this.max || "9996-12-31";
72449
72527
  }
72450
72528
  else {
72451
72529
  isoMin = this.defaultDate + (this.min || "00:00:00");
@@ -72798,9 +72876,9 @@ Serializer.addClass("currencymask", [
72798
72876
 
72799
72877
  var Version;
72800
72878
  var ReleaseDate;
72801
- Version = "" + "1.12.26";
72879
+ Version = "" + "1.12.28";
72802
72880
  settings.version = Version;
72803
- ReleaseDate = "" + "2025-03-03";
72881
+ ReleaseDate = "" + "2025-03-18";
72804
72882
  function checkLibraryVersion(ver, libraryName) {
72805
72883
  if (Version != ver) {
72806
72884
  var str = "survey-core has version '" + Version + "' and " + libraryName
@@ -80840,7 +80918,7 @@ var simplifiedChineseSurveyStrings = {
80840
80918
  selectAllItemText: "选择全部",
80841
80919
  deselectAllItemText: "取消全选",
80842
80920
  progressText: "第 {0} 页, 共 {1} 页",
80843
- indexText: "{1}{0}",
80921
+ indexText: "{0} 页,共 {1}",
80844
80922
  panelDynamicProgressText: "{0} of {1}",
80845
80923
  panelDynamicTabTextFormat: "面板 {面板索引}",
80846
80924
  questionsProgressText: "第 {0}/{1} 题",
@@ -80938,7 +81016,6 @@ var simplifiedChineseSurveyStrings = {
80938
81016
  setupLocale({ localeCode: "zh-cn", strings: simplifiedChineseSurveyStrings, nativeName: "简体中文", englishName: "Simplified Chinese" });
80939
81017
  // The following strings have been translated by a machine translation service
80940
81018
  // Remove those strings that you have corrected manually
80941
- // indexText: "{0} of {1}" => "{1}{0}"
80942
81019
  // panelDynamicTabTextFormat: "Panel {panelIndex}" => "面板 {面板索引}"
80943
81020
  // ratingOptionsCaption: "Select..." => "选择。。。"
80944
81021
  // filePlaceholder: "Drag and drop a file here or click the button below and choose a file to upload." => "将文件拖放到此处或单击下面的按钮并选择要上传的文件。"
@@ -80960,9 +81037,15 @@ setupLocale({ localeCode: "zh-cn", strings: simplifiedChineseSurveyStrings, nati
80960
81037
  // ok: "OK" => "还行"
80961
81038
  // cancel: "Cancel" => "取消"
80962
81039
  // refuseItemText: "Refuse to answer" => "拒绝回答"
80963
- // dontKnowItemText: "Don't know" => "不知道"// savingExceedSize: "Your response exceeds 64KB. Please reduce the size of your file(s) and try again or contact a survey owner." => "您的回复超过 64KB。请减小文件的大小,然后重试或联系调查所有者。"
80964
- // signaturePlaceHolderReadOnly: "No signature" => "无签名"// tabTitlePlaceholder: "New Panel" => "新面板"// deselectAllItemText: "Deselect all" => "取消全选"
81040
+ // dontKnowItemText: "Don't know" => "不知道"
81041
+ // savingExceedSize: "Your response exceeds 64KB. Please reduce the size of your file(s) and try again or contact a survey owner." => "您的回复超过 64KB。请减小文件的大小,然后重试或联系调查所有者。"
81042
+ // signaturePlaceHolderReadOnly: "No signature" => "无签名"
81043
+ // tabTitlePlaceholder: "New Panel" => "新面板"
81044
+ // deselectAllItemText: "Deselect all" => "取消全选"
80965
81045
  // textNoDigitsAllow: "Numbers are not allowed." => "不允许使用数字。"
81046
+ // choices_Choice: "Choice option" => "Choice 选项"
81047
+ // loadingPage: "Loading..." => "装载。。。"
81048
+ // loadingData: "Loading..." => "装载。。。"
80966
81049
 
80967
81050
  // CONCATENATED MODULE: ./packages/survey-core/src/localization/slovak.ts
80968
81051
 
@@ -83050,6 +83133,21 @@ var reactquestion_element_SurveyElementBase = /** @class */ (function (_super) {
83050
83133
  var _this = _super.call(this, props) || this;
83051
83134
  _this._allowComponentUpdate = true;
83052
83135
  _this.prevStateElements = [];
83136
+ _this.propertyValueChangedHandler = function (hash, key, val) {
83137
+ if (hash[key] !== val) {
83138
+ hash[key] = val;
83139
+ if (!_this.canUsePropInState(key))
83140
+ return;
83141
+ if (_this.isRendering)
83142
+ return;
83143
+ _this.changedStatePropNameValue = key;
83144
+ _this.setState(function (state) {
83145
+ var newState = {};
83146
+ newState[key] = val;
83147
+ return newState;
83148
+ });
83149
+ }
83150
+ };
83053
83151
  return _this;
83054
83152
  }
83055
83153
  SurveyElementBase.renderLocString = function (locStr, style, key) {
@@ -83158,6 +83256,9 @@ var reactquestion_element_SurveyElementBase = /** @class */ (function (_super) {
83158
83256
  };
83159
83257
  SurveyElementBase.prototype.unMakeBaseElementsReact = function () {
83160
83258
  var els = this.getStateElements();
83259
+ this.unMakeBaseElementsReactive(els);
83260
+ };
83261
+ SurveyElementBase.prototype.unMakeBaseElementsReactive = function (els) {
83161
83262
  for (var i = 0; i < els.length; i++) {
83162
83263
  this.unMakeBaseElementReact(els[i]);
83163
83264
  }
@@ -83189,6 +83290,9 @@ var reactquestion_element_SurveyElementBase = /** @class */ (function (_super) {
83189
83290
  SurveyElementBase.prototype.canMakeReact = function (stateElement) {
83190
83291
  return !!stateElement && !!stateElement.iteratePropertiesHash;
83191
83292
  };
83293
+ SurveyElementBase.prototype.isCurrentStateElement = function (stateElement) {
83294
+ return !!stateElement && !!stateElement.setPropertyValueCoreHandler && stateElement.setPropertyValueCoreHandler === this.propertyValueChangedHandler;
83295
+ };
83192
83296
  SurveyElementBase.prototype.makeBaseElementReact = function (stateElement) {
83193
83297
  var _this = this;
83194
83298
  if (!this.canMakeReact(stateElement))
@@ -83211,21 +83315,7 @@ var reactquestion_element_SurveyElementBase = /** @class */ (function (_super) {
83211
83315
  };
83212
83316
  }
83213
83317
  });
83214
- stateElement.setPropertyValueCoreHandler = function (hash, key, val) {
83215
- if (hash[key] !== val) {
83216
- hash[key] = val;
83217
- if (!_this.canUsePropInState(key))
83218
- return;
83219
- if (_this.isRendering)
83220
- return;
83221
- _this.changedStatePropNameValue = key;
83222
- _this.setState(function (state) {
83223
- var newState = {};
83224
- newState[key] = val;
83225
- return newState;
83226
- });
83227
- }
83228
- };
83318
+ stateElement.setPropertyValueCoreHandler = this.propertyValueChangedHandler;
83229
83319
  };
83230
83320
  SurveyElementBase.prototype.canUsePropInState = function (key) {
83231
83321
  return true;
@@ -83233,6 +83323,11 @@ var reactquestion_element_SurveyElementBase = /** @class */ (function (_super) {
83233
83323
  SurveyElementBase.prototype.unMakeBaseElementReact = function (stateElement) {
83234
83324
  if (!this.canMakeReact(stateElement))
83235
83325
  return;
83326
+ if (!this.isCurrentStateElement(stateElement)) {
83327
+ // eslint-disable-next-line no-console
83328
+ // console.warn("Looks like the component is bound to another survey element. It is not supported and can lead to issues.");
83329
+ // return;
83330
+ }
83236
83331
  stateElement.setPropertyValueCoreHandler = undefined;
83237
83332
  stateElement.iteratePropertiesHash(function (hash, key) {
83238
83333
  var val = hash[key];
@@ -83636,8 +83731,10 @@ var row_SurveyRow = /** @class */ (function (_super) {
83636
83731
  };
83637
83732
  SurveyRow.prototype.componentWillUnmount = function () {
83638
83733
  _super.prototype.componentWillUnmount.call(this);
83639
- this.row.setRootElement(undefined);
83640
- this.stopLazyRendering();
83734
+ if (this.isCurrentStateElement(this.getStateElement())) {
83735
+ this.row.setRootElement(undefined);
83736
+ this.stopLazyRendering();
83737
+ }
83641
83738
  };
83642
83739
  SurveyRow.prototype.createElement = function (element, elementIndex) {
83643
83740
  var index = elementIndex ? "-" + elementIndex : 0;
@@ -85250,10 +85347,6 @@ var page_SurveyPage = /** @class */ (function (_super) {
85250
85347
  enumerable: false,
85251
85348
  configurable: true
85252
85349
  });
85253
- // shouldComponentUpdate(nextProps: any, nextState: any): boolean {
85254
- // if(!super.shouldComponentUpdate(nextProps, nextState)) return false;
85255
- // return true;
85256
- // }
85257
85350
  SurveyPage.prototype.renderElement = function () {
85258
85351
  var title = this.renderTitle();
85259
85352
  var description = this.renderDescription();