survey-react 1.12.5 → 1.12.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.12.5
2
+ * surveyjs - Survey JavaScript library v1.12.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
  */
@@ -3123,6 +3123,9 @@ var jsonobject_JsonMetadataClass = /** @class */ (function () {
3123
3123
  if (propInfo.readOnly === true) {
3124
3124
  prop.readOnly = true;
3125
3125
  }
3126
+ if (propInfo.availableInMatrixColumn === true) {
3127
+ prop.availableInMatrixColumn = true;
3128
+ }
3126
3129
  if (propInfo.choices) {
3127
3130
  var choicesFunc = typeof propInfo.choices === "function" ? propInfo.choices : null;
3128
3131
  var choicesValue = typeof propInfo.choices !== "function" ? propInfo.choices : null;
@@ -13036,18 +13039,6 @@ var survey_element_SurveyElement = /** @class */ (function (_super) {
13036
13039
  requestAnimationFrame(checkPos_1);
13037
13040
  };
13038
13041
  DomWindowHelper.requestAnimationFrame(checkPos_1);
13039
- // let currPageXOffset = window.pageXOffset;
13040
- // let currPageYOffset = window.pageYOffset;
13041
- // var scrollDone = setInterval(() => {
13042
- // DomWindowHelper.requestAnimationFrame(() => {
13043
- // if (currPageXOffset == window.pageXOffset && currPageYOffset == window.pageYOffset) {
13044
- // clearInterval(scrollDone);
13045
- // doneCallback();
13046
- // }
13047
- // currPageXOffset = window.pageXOffset;
13048
- // currPageYOffset = window.pageYOffset;
13049
- // });
13050
- // }, 25);
13051
13042
  }
13052
13043
  };
13053
13044
  SurveyElement.ScrollElementToTop = function (elementId, scrollIfVisible, scrollIntoViewOptions, doneCallback) {
@@ -13058,12 +13049,17 @@ var survey_element_SurveyElement = /** @class */ (function (_super) {
13058
13049
  return SurveyElement.ScrollElementToViewCore(el, false, scrollIfVisible, scrollIntoViewOptions, doneCallback);
13059
13050
  };
13060
13051
  SurveyElement.ScrollElementToViewCore = function (el, checkLeft, scrollIfVisible, scrollIntoViewOptions, doneCallback) {
13061
- if (!el || !el.scrollIntoView)
13052
+ if (!el || !el.scrollIntoView) {
13053
+ doneCallback && doneCallback();
13062
13054
  return false;
13055
+ }
13063
13056
  var needScroll = SurveyElement.IsNeedScrollIntoView(el, checkLeft, scrollIfVisible);
13064
13057
  if (needScroll) {
13065
13058
  SurveyElement.ScrollIntoView(el, scrollIntoViewOptions, doneCallback);
13066
13059
  }
13060
+ else {
13061
+ doneCallback && doneCallback();
13062
+ }
13067
13063
  return needScroll;
13068
13064
  };
13069
13065
  SurveyElement.GetFirstNonTextElement = function (elements, removeSpaces) {
@@ -13084,22 +13080,22 @@ var survey_element_SurveyElement = /** @class */ (function (_super) {
13084
13080
  }
13085
13081
  return null;
13086
13082
  };
13087
- SurveyElement.FocusElement = function (elementId) {
13083
+ SurveyElement.FocusElement = function (elementId, isTimeOut, containerEl) {
13088
13084
  if (!elementId || !DomDocumentHelper.isAvailable())
13089
13085
  return false;
13090
- var res = SurveyElement.focusElementCore(elementId);
13086
+ var res = !isTimeOut ? SurveyElement.focusElementCore(elementId, containerEl) : false;
13091
13087
  if (!res) {
13092
13088
  setTimeout(function () {
13093
- SurveyElement.focusElementCore(elementId);
13094
- }, 10);
13089
+ SurveyElement.focusElementCore(elementId, containerEl);
13090
+ }, isTimeOut ? 100 : 10);
13095
13091
  }
13096
13092
  return res;
13097
13093
  };
13098
- SurveyElement.focusElementCore = function (elementId) {
13094
+ SurveyElement.focusElementCore = function (elementId, containerEl) {
13099
13095
  var root = settings.environment.root;
13100
- if (!root)
13096
+ if (!root && !containerEl)
13101
13097
  return false;
13102
- var el = root.getElementById(elementId);
13098
+ var el = containerEl ? containerEl.querySelector("#" + CSS.escape(elementId)) : root.getElementById(elementId);
13103
13099
  // https://stackoverflow.com/questions/19669786/check-if-element-is-visible-in-dom
13104
13100
  if (el && !el["disabled"] && el.style.display !== "none" && el.offsetParent !== null) {
13105
13101
  SurveyElement.ScrollElementToViewCore(el, true, false);
@@ -16787,6 +16783,11 @@ var validator_SurveyValidator = /** @class */ (function (_super) {
16787
16783
  _this.createLocalizableString("text", _this, true);
16788
16784
  return _this;
16789
16785
  }
16786
+ Object.defineProperty(SurveyValidator.prototype, "isValidator", {
16787
+ get: function () { return true; },
16788
+ enumerable: false,
16789
+ configurable: true
16790
+ });
16790
16791
  SurveyValidator.prototype.getSurvey = function (live) {
16791
16792
  if (live === void 0) { live = false; }
16792
16793
  return !!this.errorOwner && !!this.errorOwner["getSurvey"]
@@ -19265,6 +19266,7 @@ var question_Question = /** @class */ (function (_super) {
19265
19266
  * @param onError Pass `true` if you want to focus an input field with the first validation error. Default value: `false` (focuses the first input field). Applies to question types with multiple input fields.
19266
19267
  */
19267
19268
  Question.prototype.focus = function (onError, scrollIfVisible) {
19269
+ var _this = this;
19268
19270
  if (onError === void 0) { onError = false; }
19269
19271
  if (this.isDesignMode || !this.isVisible || !this.survey)
19270
19272
  return;
@@ -19274,20 +19276,23 @@ var question_Question = /** @class */ (function (_super) {
19274
19276
  this.survey.focusQuestionByInstance(this, onError);
19275
19277
  }
19276
19278
  else {
19277
- this.focuscore(onError, scrollIfVisible);
19278
- }
19279
- };
19280
- Question.prototype.focuscore = function (onError, scrollIfVisible) {
19281
- if (onError === void 0) { onError = false; }
19282
- if (!!this.survey) {
19283
- this.expandAllParents();
19284
- this.survey.scrollElementToTop(this, this, null, this.id, scrollIfVisible);
19279
+ if (!!this.survey) {
19280
+ this.expandAllParents();
19281
+ var scrollOptions = this.survey["isSmoothScrollEnabled"] ? { behavior: "smooth" } : undefined;
19282
+ this.survey.scrollElementToTop(this, this, null, this.id, scrollIfVisible, scrollOptions, undefined, function () {
19283
+ _this.focusInputElement(onError);
19284
+ });
19285
+ }
19286
+ else {
19287
+ this.focusInputElement(onError);
19288
+ }
19285
19289
  }
19286
- this.focusInputElement(onError);
19287
19290
  };
19288
19291
  Question.prototype.focusInputElement = function (onError) {
19292
+ var _a;
19289
19293
  var id = !onError ? this.getFirstInputElementId() : this.getFirstErrorInputElementId();
19290
- if (survey_element_SurveyElement.FocusElement(id)) {
19294
+ var surveyRoot = (_a = this.survey) === null || _a === void 0 ? void 0 : _a.rootElement;
19295
+ if (survey_element_SurveyElement.FocusElement(id, false, surveyRoot)) {
19291
19296
  this.fireCallback(this.focusCallback);
19292
19297
  }
19293
19298
  };
@@ -20810,9 +20815,12 @@ var question_Question = /** @class */ (function (_super) {
20810
20815
  if (this.isValueEmpty(value) && helpers_Helpers.isNumber(this[propName])) {
20811
20816
  value = 0;
20812
20817
  }
20813
- this[propName] = value;
20818
+ this.updateBindingProp(propName, value);
20814
20819
  }
20815
20820
  };
20821
+ Question.prototype.updateBindingProp = function (propName, value) {
20822
+ this[propName] = value;
20823
+ };
20816
20824
  Question.prototype.getComponentName = function () {
20817
20825
  return RendererFactory.Instance.getRendererByQuestion(this);
20818
20826
  };
@@ -27914,7 +27922,7 @@ var MatrixDropdownRowTextProcessor = /** @class */ (function (_super) {
27914
27922
  textValue.value = this.row.rowIndex;
27915
27923
  return true;
27916
27924
  }
27917
- if (textValue.name == question_matrixdropdownbase_MatrixDropdownRowModelBase.RowValueVariableName) {
27925
+ if ([question_matrixdropdownbase_MatrixDropdownRowModelBase.RowValueVariableName, question_matrixdropdownbase_MatrixDropdownRowModelBase.RowNameVariableName].indexOf(textValue.name) > -1) {
27918
27926
  textValue.isExists = true;
27919
27927
  textValue.value = this.row.rowName;
27920
27928
  return true;
@@ -28148,11 +28156,12 @@ var question_matrixdropdownbase_MatrixDropdownRowModelBase = /** @class */ (func
28148
28156
  MatrixDropdownRowModelBase.prototype.applyRowVariablesToValues = function (res, rowIndex) {
28149
28157
  res[MatrixDropdownRowModelBase.IndexVariableName] = rowIndex;
28150
28158
  res[MatrixDropdownRowModelBase.RowValueVariableName] = this.rowName;
28159
+ res[MatrixDropdownRowModelBase.RowNameVariableName] = this.rowName;
28151
28160
  };
28152
28161
  MatrixDropdownRowModelBase.prototype.runCondition = function (values, properties, rowsVisibleIf) {
28153
- if (!!this.data) {
28154
- values[MatrixDropdownRowModelBase.OwnerVariableName] = this.data.getFilteredData();
28155
- }
28162
+ if (!this.data)
28163
+ return;
28164
+ values[MatrixDropdownRowModelBase.OwnerVariableName] = this.data.getFilteredData();
28156
28165
  var rowIndex = this.rowIndex;
28157
28166
  this.applyRowVariablesToValues(values, rowIndex);
28158
28167
  var newProps = helpers_Helpers.createCopy(properties);
@@ -28563,11 +28572,14 @@ var question_matrixdropdownbase_MatrixDropdownRowModelBase = /** @class */ (func
28563
28572
  };
28564
28573
  Object.defineProperty(MatrixDropdownRowModelBase.prototype, "rowIndex", {
28565
28574
  get: function () {
28566
- return !!this.data ? this.data.getRowIndex(this) + 1 : -1;
28575
+ return this.getRowIndex();
28567
28576
  },
28568
28577
  enumerable: false,
28569
28578
  configurable: true
28570
28579
  });
28580
+ MatrixDropdownRowModelBase.prototype.getRowIndex = function () {
28581
+ return !!this.data ? this.data.getRowIndex(this) + 1 : -1;
28582
+ };
28571
28583
  Object.defineProperty(MatrixDropdownRowModelBase.prototype, "editingObj", {
28572
28584
  get: function () {
28573
28585
  return this.editingObjValue;
@@ -28605,6 +28617,7 @@ var question_matrixdropdownbase_MatrixDropdownRowModelBase = /** @class */ (func
28605
28617
  MatrixDropdownRowModelBase.OwnerVariableName = "self";
28606
28618
  MatrixDropdownRowModelBase.IndexVariableName = "rowIndex";
28607
28619
  MatrixDropdownRowModelBase.RowValueVariableName = "rowValue";
28620
+ MatrixDropdownRowModelBase.RowNameVariableName = "rowName";
28608
28621
  MatrixDropdownRowModelBase.idCounter = 1;
28609
28622
  return MatrixDropdownRowModelBase;
28610
28623
  }());
@@ -29268,9 +29281,9 @@ var question_matrixdropdownbase_QuestionMatrixDropdownModelBase = /** @class */
29268
29281
  return !!question ? question.getConditionJson(operator) : null;
29269
29282
  };
29270
29283
  QuestionMatrixDropdownModelBase.prototype.clearIncorrectValues = function () {
29271
- var rows = this.visibleRows;
29272
- if (!rows)
29284
+ if (!Array.isArray(this.visibleRows))
29273
29285
  return;
29286
+ var rows = this.generatedVisibleRows;
29274
29287
  for (var i = 0; i < rows.length; i++) {
29275
29288
  rows[i].clearIncorrectValues(this.getRowValue(i));
29276
29289
  }
@@ -29675,13 +29688,13 @@ var question_matrixdropdownbase_QuestionMatrixDropdownModelBase = /** @class */
29675
29688
  * @see setRowValue
29676
29689
  */
29677
29690
  QuestionMatrixDropdownModelBase.prototype.getRowValue = function (rowIndex) {
29678
- if (rowIndex < 0)
29691
+ if (rowIndex < 0 || !Array.isArray(this.visibleRows))
29679
29692
  return null;
29680
- var visRows = this.visibleRows;
29681
- if (rowIndex >= visRows.length)
29693
+ var rows = this.generatedVisibleRows;
29694
+ if (rowIndex >= rows.length)
29682
29695
  return null;
29683
29696
  var newValue = this.createNewValue();
29684
- return this.getRowValueCore(visRows[rowIndex], newValue);
29697
+ return this.getRowValueCore(rows[rowIndex], newValue);
29685
29698
  };
29686
29699
  QuestionMatrixDropdownModelBase.prototype.checkIfValueInRowDuplicated = function (checkedRow, cellQuestion) {
29687
29700
  if (!this.generatedVisibleRows)
@@ -30333,9 +30346,9 @@ var question_matrixdropdownbase_QuestionMatrixDropdownModelBase = /** @class */
30333
30346
  return { value: newValue, rowValue: rowValue };
30334
30347
  };
30335
30348
  QuestionMatrixDropdownModelBase.prototype.getRowIndex = function (row) {
30336
- if (!this.generatedVisibleRows)
30349
+ if (!Array.isArray(this.generatedVisibleRows))
30337
30350
  return -1;
30338
- return this.visibleRows.indexOf(row);
30351
+ return this.generatedVisibleRows.indexOf(row);
30339
30352
  };
30340
30353
  QuestionMatrixDropdownModelBase.prototype.getElementsInDesign = function (includeHidden) {
30341
30354
  if (includeHidden === void 0) { includeHidden = false; }
@@ -30733,17 +30746,17 @@ var question_matrixdropdown_QuestionMatrixDropdownModel = /** @class */ (functio
30733
30746
  if (!rows)
30734
30747
  return res;
30735
30748
  for (var i = 0; i < rows.length; i++) {
30736
- var rowValue = rows[i].rowName;
30737
- var val = value[rowValue];
30749
+ var rowName = rows[i].rowName;
30750
+ var val = value[rowName];
30738
30751
  if (!val)
30739
30752
  continue;
30740
30753
  if (keysAsText) {
30741
- var displayRowValue = itemvalue_ItemValue.getTextOrHtmlByValue(this.rows, rowValue);
30754
+ var displayRowValue = itemvalue_ItemValue.getTextOrHtmlByValue(this.rows, rowName);
30742
30755
  if (!!displayRowValue) {
30743
- rowValue = displayRowValue;
30756
+ rowName = displayRowValue;
30744
30757
  }
30745
30758
  }
30746
- res[rowValue] = this.getRowDisplayValue(keysAsText, rows[i], val);
30759
+ res[rowName] = this.getRowDisplayValue(keysAsText, rows[i], val);
30747
30760
  }
30748
30761
  return res;
30749
30762
  };
@@ -30798,11 +30811,11 @@ var question_matrixdropdown_QuestionMatrixDropdownModel = /** @class */ (functio
30798
30811
  }
30799
30812
  _super.prototype.clearGeneratedRows.call(this);
30800
30813
  };
30801
- QuestionMatrixDropdownModel.prototype.getRowValueForCreation = function (val, rowValue) {
30802
- var res = val[rowValue];
30814
+ QuestionMatrixDropdownModel.prototype.getRowValueForCreation = function (val, rowName) {
30815
+ var res = val[rowName];
30803
30816
  if (!res)
30804
30817
  return res;
30805
- var names = this.defaultValuesInRows[rowValue];
30818
+ var names = this.defaultValuesInRows[rowName];
30806
30819
  if (!Array.isArray(names) || names.length === 0)
30807
30820
  return res;
30808
30821
  names.forEach(function (name) {
@@ -30849,8 +30862,8 @@ var question_matrixdropdown_QuestionMatrixDropdownModel = /** @class */ (functio
30849
30862
  val = {};
30850
30863
  for (var i = 0; i < this.rows.length; i++) {
30851
30864
  var row = this.rows[i];
30852
- var rowValue = val[row.value];
30853
- this.updateProgressInfoByRow(res, !!rowValue ? rowValue : {});
30865
+ var rowName = val[row.value];
30866
+ this.updateProgressInfoByRow(res, !!rowName ? rowName : {});
30854
30867
  }
30855
30868
  };
30856
30869
  return QuestionMatrixDropdownModel;
@@ -31684,6 +31697,10 @@ var MatrixDynamicRowModel = /** @class */ (function (_super) {
31684
31697
  _this.buildCells(value);
31685
31698
  return _this;
31686
31699
  }
31700
+ MatrixDynamicRowModel.prototype.getRowIndex = function () {
31701
+ var res = _super.prototype.getRowIndex.call(this);
31702
+ return res > 0 ? res : this.index + 1;
31703
+ };
31687
31704
  Object.defineProperty(MatrixDynamicRowModel.prototype, "rowName", {
31688
31705
  get: function () {
31689
31706
  return this.id;
@@ -31913,6 +31930,7 @@ var question_matrixdynamic_QuestionMatrixDynamicModel = /** @class */ (function
31913
31930
  return this.rowCountValue;
31914
31931
  },
31915
31932
  set: function (val) {
31933
+ val = helpers_Helpers.getNumber(val);
31916
31934
  if (val < 0 || val > settings.matrix.maxRowCount)
31917
31935
  return;
31918
31936
  this.setRowCountValueFromData = false;
@@ -31945,6 +31963,23 @@ var question_matrixdynamic_QuestionMatrixDynamicModel = /** @class */ (function
31945
31963
  enumerable: false,
31946
31964
  configurable: true
31947
31965
  });
31966
+ QuestionMatrixDynamicModel.prototype.updateBindingProp = function (propName, value) {
31967
+ _super.prototype.updateBindingProp.call(this, propName, value);
31968
+ var rows = this.generatedVisibleRows;
31969
+ if (propName !== "rowCount" || !Array.isArray(rows))
31970
+ return;
31971
+ var val = this.getUnbindValue(this.value) || [];
31972
+ if (val.length < rows.length) {
31973
+ var hasValue = false;
31974
+ for (var i = val.length; i < rows.length; i++) {
31975
+ hasValue || (hasValue = !rows[i].isEmpty);
31976
+ val.push(rows[i].value || {});
31977
+ }
31978
+ if (hasValue) {
31979
+ this.value = val;
31980
+ }
31981
+ }
31982
+ };
31948
31983
  QuestionMatrixDynamicModel.prototype.updateProgressInfoByValues = function (res) {
31949
31984
  var val = this.value;
31950
31985
  if (!Array.isArray(val))
@@ -34417,7 +34452,7 @@ var header_Cover = /** @class */ (function (_super) {
34417
34452
  return this.height ? Math.max(this.height, this.actualHeight + 40) + "px" : undefined;
34418
34453
  }
34419
34454
  if (this.survey && this.survey.isMobile) {
34420
- return this.mobileHeight ? Math.max(this.mobileHeight, this.actualHeight + 40) + "px" : undefined;
34455
+ return this.mobileHeight ? Math.max(this.mobileHeight, this.actualHeight) + "px" : undefined;
34421
34456
  }
34422
34457
  return undefined;
34423
34458
  },
@@ -34498,13 +34533,19 @@ var header_Cover = /** @class */ (function (_super) {
34498
34533
  };
34499
34534
  Cover.prototype.processResponsiveness = function (width) {
34500
34535
  if (this.survey && this.survey.rootElement) {
34501
- var logoEl = this.survey.rootElement.querySelectorAll(".sv-header__logo")[0];
34502
- var titleEl = this.survey.rootElement.querySelectorAll(".sv-header__title")[0];
34503
- var descriptionEl = this.survey.rootElement.querySelectorAll(".sv-header__description")[0];
34504
- var logoHeight = logoEl ? logoEl.getBoundingClientRect().height : 0;
34505
- var titleHeight = titleEl ? titleEl.getBoundingClientRect().height : 0;
34506
- var descriptionHeight = descriptionEl ? descriptionEl.getBoundingClientRect().height : 0;
34507
- this.actualHeight = this.calculateActualHeight(logoHeight, titleHeight, descriptionHeight);
34536
+ if (!this.survey.isMobile) {
34537
+ var logoEl = this.survey.rootElement.querySelectorAll(".sv-header__logo")[0];
34538
+ var titleEl = this.survey.rootElement.querySelectorAll(".sv-header__title")[0];
34539
+ var descriptionEl = this.survey.rootElement.querySelectorAll(".sv-header__description")[0];
34540
+ var logoHeight = logoEl ? logoEl.getBoundingClientRect().height : 0;
34541
+ var titleHeight = titleEl ? titleEl.getBoundingClientRect().height : 0;
34542
+ var descriptionHeight = descriptionEl ? descriptionEl.getBoundingClientRect().height : 0;
34543
+ this.actualHeight = this.calculateActualHeight(logoHeight, titleHeight, descriptionHeight);
34544
+ }
34545
+ else {
34546
+ var headerContainer = this.survey.rootElement.querySelectorAll(".sv-header > div")[0];
34547
+ this.actualHeight = headerContainer ? headerContainer.getBoundingClientRect().height : 0;
34548
+ }
34508
34549
  }
34509
34550
  };
34510
34551
  Object.defineProperty(Cover.prototype, "hasBackground", {
@@ -39565,6 +39606,7 @@ var survey_SurveyModel = /** @class */ (function (_super) {
39565
39606
  _this.isNavigationButtonPressed = false;
39566
39607
  _this.mouseDownPage = null;
39567
39608
  _this.isCalculatingProgressText = false;
39609
+ _this.isSmoothScrollEnabled = false;
39568
39610
  /**
39569
39611
  * An event that is raised when the survey's width or height is changed.
39570
39612
  */
@@ -39925,7 +39967,6 @@ var survey_SurveyModel = /** @class */ (function (_super) {
39925
39967
  else {
39926
39968
  this.cssValue = value;
39927
39969
  }
39928
- this.updateCss();
39929
39970
  this.updateElementCss(false);
39930
39971
  };
39931
39972
  Object.defineProperty(SurveyModel.prototype, "cssTitle", {
@@ -40587,7 +40628,7 @@ var survey_SurveyModel = /** @class */ (function (_super) {
40587
40628
  * - `"onValueChanged"` - Triggers validation each time a question value is changed.
40588
40629
  * - `"onComplete"` - Triggers validation when a user clicks the Complete button. If previous pages contain errors, the survey switches to the page with the first error.
40589
40630
  *
40590
- * > The `"onValueChanged"` doesn't work with date input fields because of the way browsers process date values. In most browsers, the value is considered changed as soon as a user starts entering the date in a text input field. This means that a user may only enter the day without having the chance to enter the month and year before validation is triggered. For this reason, date input fields are validated before the survey is switched to the next page or completed.
40631
+ * > In SurveyJS Form Library v1.12.5 and earlier, the `"onValueChanged"` mode doesn't work with date input fields because of the way browsers process date values. In most browsers, the value is considered changed as soon as a user starts entering the date in a text input field. This means that a user may only enter the day without having the chance to enter the month and year before validation is triggered. For this reason, date input fields are validated before the survey is switched to the next page or completed. Starting with v1.12.6, `"onValueChanged"` works for date input fields as well as for input fields of other types.
40591
40632
  *
40592
40633
  * Refer to the following help topic for more information: [Data Validation](https://surveyjs.io/form-library/documentation/data-validation).
40593
40634
  * @see validationEnabled
@@ -44614,7 +44655,7 @@ var survey_SurveyModel = /** @class */ (function (_super) {
44614
44655
  this.onGetMatrixRowActions.fire(this, options);
44615
44656
  return options.actions;
44616
44657
  };
44617
- SurveyModel.prototype.scrollElementToTop = function (element, question, page, id, scrollIfVisible, scrollIntoViewOptions, passedRootElement) {
44658
+ SurveyModel.prototype.scrollElementToTop = function (element, question, page, id, scrollIfVisible, scrollIntoViewOptions, passedRootElement, onScolledCallback) {
44618
44659
  var _this = this;
44619
44660
  var options = {
44620
44661
  element: element,
@@ -44638,11 +44679,12 @@ var survey_SurveyModel = /** @class */ (function (_super) {
44638
44679
  survey_element_SurveyElement.ScrollElementToTop(options.elementId, scrollIfVisible, scrollIntoViewOptions, function () {
44639
44680
  _this.releaseLazyRendering();
44640
44681
  activateLazyRenderingChecks(elementPage_1.id);
44682
+ onScolledCallback && onScolledCallback();
44641
44683
  });
44642
44684
  }, elementsToRenderBefore);
44643
44685
  }
44644
44686
  else {
44645
- survey_element_SurveyElement.ScrollElementToTop(options.elementId, scrollIfVisible, scrollIntoViewOptions);
44687
+ survey_element_SurveyElement.ScrollElementToTop(options.elementId, scrollIfVisible, scrollIntoViewOptions, onScolledCallback);
44646
44688
  }
44647
44689
  }
44648
44690
  };
@@ -46140,11 +46182,13 @@ var survey_SurveyModel = /** @class */ (function (_super) {
46140
46182
  if (!!question.page) {
46141
46183
  this.questionHashesAdded(question);
46142
46184
  }
46143
- if (!this.currentPage) {
46144
- this.updateCurrentPage();
46185
+ if (!this.isLoadingFromJson) {
46186
+ if (!this.currentPage) {
46187
+ this.updateCurrentPage();
46188
+ }
46189
+ this.updateVisibleIndexes();
46190
+ this.setCalculatedWidthModeUpdater();
46145
46191
  }
46146
- this.updateVisibleIndexes();
46147
- this.setCalculatedWidthModeUpdater();
46148
46192
  if (this.canFireAddElement()) {
46149
46193
  this.onQuestionAdded.fire(this, {
46150
46194
  question: question,
@@ -46527,6 +46571,8 @@ var survey_SurveyModel = /** @class */ (function (_super) {
46527
46571
  });
46528
46572
  SurveyModel.prototype.setCalculatedWidthModeUpdater = function () {
46529
46573
  var _this = this;
46574
+ if (this.isLoadingFromJson)
46575
+ return;
46530
46576
  if (this.calculatedWidthModeUpdater)
46531
46577
  this.calculatedWidthModeUpdater.dispose();
46532
46578
  this.calculatedWidthModeUpdater = new ComputedUpdater(function () { return _this.calculateWidthMode(); });
@@ -49950,7 +49996,8 @@ var question_baseselect_QuestionSelectBase = /** @class */ (function (_super) {
49950
49996
  return !this.isDisabledAttr && item.isEnabled;
49951
49997
  };
49952
49998
  QuestionSelectBase.prototype.focusOtherComment = function () {
49953
- survey_element_SurveyElement.FocusElement(this.otherId);
49999
+ var _a;
50000
+ survey_element_SurveyElement.FocusElement(this.otherId, false, (_a = this.survey) === null || _a === void 0 ? void 0 : _a.rootElement);
49954
50001
  };
49955
50002
  QuestionSelectBase.prototype.onValueChanged = function () {
49956
50003
  _super.prototype.onValueChanged.call(this);
@@ -49968,7 +50015,7 @@ var question_baseselect_QuestionSelectBase = /** @class */ (function (_super) {
49968
50015
  *
49969
50016
  * [View Dropdown Demo](https://surveyjs.io/form-library/examples/dropdown-box-with-custom-items/ (linkStyle))
49970
50017
  *
49971
- * [View Ranking Demo](https://surveyjs.io/form-library/examples/dropdown-box-with-custom-items/ (linkStyle))
50018
+ * [View Ranking Demo](https://surveyjs.io/form-library/examples/ranking-with-custom-items/ (linkStyle))
49972
50019
  */
49973
50020
  get: function () {
49974
50021
  return this.getPropertyValue("itemComponent", this.getDefaultItemComponent());
@@ -53719,7 +53766,7 @@ var question_text_QuestionTextModel = /** @class */ (function (_super) {
53719
53766
  return inputMask;
53720
53767
  };
53721
53768
  QuestionTextModel.prototype.isTextValue = function () {
53722
- return ["text", "number", "password"].indexOf(this.inputType) > -1;
53769
+ return this.isDateInputType || ["text", "number", "password"].indexOf(this.inputType) > -1;
53723
53770
  };
53724
53771
  QuestionTextModel.prototype.getType = function () {
53725
53772
  return "text";
@@ -54063,7 +54110,7 @@ var question_text_QuestionTextModel = /** @class */ (function (_super) {
54063
54110
  if (!this.isMinMaxType)
54064
54111
  return true;
54065
54112
  var isValid = !this.isValueLessMin && !this.isValueGreaterMax;
54066
- if (this.inputType === "number" && !!this.survey &&
54113
+ if ((!isValid || this.errors.length > 0) && !!this.survey &&
54067
54114
  (this.survey.isValidateOnValueChanging || this.survey.isValidateOnValueChanged)) {
54068
54115
  this.hasErrors();
54069
54116
  }
@@ -54193,11 +54240,6 @@ var question_text_QuestionTextModel = /** @class */ (function (_super) {
54193
54240
  enumerable: false,
54194
54241
  configurable: true
54195
54242
  });
54196
- QuestionTextModel.prototype.canRunValidators = function (isOnValueChanged) {
54197
- return (this.errors.length > 0 ||
54198
- !isOnValueChanged ||
54199
- this.supportGoNextPageError());
54200
- };
54201
54243
  QuestionTextModel.prototype.setNewValue = function (newValue) {
54202
54244
  newValue = this.correctValueType(newValue);
54203
54245
  if (!!newValue) {
@@ -59004,8 +59046,12 @@ var question_comment_QuestionCommentModel = /** @class */ (function (_super) {
59004
59046
  Object.defineProperty(QuestionCommentModel.prototype, "renderedAllowResize", {
59005
59047
  get: function () {
59006
59048
  var res = this.allowResize;
59007
- var allowResize = res === undefined && this.survey ? this.survey.allowResizeComment : !!res;
59008
- return allowResize && !this.isPreviewStyle && !this.isReadOnlyStyle;
59049
+ if (res === undefined && this.survey) {
59050
+ return this.survey.allowResizeComment;
59051
+ }
59052
+ else {
59053
+ return !!res;
59054
+ }
59009
59055
  },
59010
59056
  enumerable: false,
59011
59057
  configurable: true
@@ -59463,11 +59509,6 @@ var question_file_QuestionFileModelBase = /** @class */ (function (_super) {
59463
59509
  return QuestionFileModelBase;
59464
59510
  }(question_Question));
59465
59511
 
59466
- /**
59467
- * A class that describes the File Upload question type.
59468
- *
59469
- * [View Demo](https://surveyjs.io/form-library/examples/file-upload/ (linkStyle))
59470
- */
59471
59512
  var question_file_QuestionFilePage = /** @class */ (function (_super) {
59472
59513
  question_file_extends(QuestionFilePage, _super);
59473
59514
  function QuestionFilePage(question, index) {
@@ -59494,6 +59535,11 @@ var question_file_QuestionFilePage = /** @class */ (function (_super) {
59494
59535
  return QuestionFilePage;
59495
59536
  }(base_Base));
59496
59537
 
59538
+ /**
59539
+ * A class that describes the File Upload question type.
59540
+ *
59541
+ * [View Demo](https://surveyjs.io/form-library/examples/file-upload/ (linkStyle))
59542
+ */
59497
59543
  var question_file_QuestionFileModel = /** @class */ (function (_super) {
59498
59544
  question_file_extends(QuestionFileModel, _super);
59499
59545
  function QuestionFileModel(name) {
@@ -66491,15 +66537,31 @@ var question_paneldynamic_QuestionPanelDynamicModel = /** @class */ (function (_
66491
66537
  */
66492
66538
  QuestionPanelDynamicModel.prototype.removePanelUI = function (value) {
66493
66539
  var _this = this;
66540
+ var visIndex = this.getVisualPanelIndex(value);
66541
+ if (visIndex < 0 || visIndex >= this.visiblePanelCount)
66542
+ return;
66494
66543
  if (!this.canRemovePanel)
66495
66544
  return;
66545
+ var removePanel = function () {
66546
+ var _a;
66547
+ _this.removePanel(visIndex);
66548
+ var pnlCount = _this.visiblePanelCount;
66549
+ var nextIndex = visIndex >= pnlCount ? pnlCount - 1 : visIndex;
66550
+ var id = pnlCount === 0 ? _this.addButtonId : (nextIndex > -1 ? _this.getPanelRemoveButtonId(_this.visiblePanels[nextIndex]) : "");
66551
+ if (!!id) {
66552
+ survey_element_SurveyElement.FocusElement(id, true, (_a = _this.survey) === null || _a === void 0 ? void 0 : _a.rootElement);
66553
+ }
66554
+ };
66496
66555
  if (this.isRequireConfirmOnDelete(value)) {
66497
- confirmActionAsync(this.confirmDeleteText, function () { _this.removePanel(value); }, undefined, this.getLocale(), this.survey.rootElement);
66556
+ confirmActionAsync(this.confirmDeleteText, function () { removePanel(); }, undefined, this.getLocale(), this.survey.rootElement);
66498
66557
  }
66499
66558
  else {
66500
- this.removePanel(value);
66559
+ removePanel();
66501
66560
  }
66502
66561
  };
66562
+ QuestionPanelDynamicModel.prototype.getPanelRemoveButtonId = function (panel) {
66563
+ return panel.id + "_remove_button";
66564
+ };
66503
66565
  QuestionPanelDynamicModel.prototype.isRequireConfirmOnDelete = function (val) {
66504
66566
  if (!this.confirmDelete)
66505
66567
  return false;
@@ -66640,9 +66702,8 @@ var question_paneldynamic_QuestionPanelDynamicModel = /** @class */ (function (_
66640
66702
  : null;
66641
66703
  };
66642
66704
  QuestionPanelDynamicModel.prototype.addConditionObjectsByContext = function (objects, context) {
66643
- var hasContext = !!context
66644
- ? context === true || this.template.questions.indexOf(context) > -1
66645
- : false;
66705
+ var contextQ = !!(context === null || context === void 0 ? void 0 : context.isValidator) ? context.errorOwner : context;
66706
+ var hasContext = !!context && (context === true || this.template.questions.indexOf(contextQ) > -1);
66646
66707
  var panelObjs = new Array();
66647
66708
  var questions = this.template.questions;
66648
66709
  for (var i = 0; i < questions.length; i++) {
@@ -66995,7 +67056,7 @@ var question_paneldynamic_QuestionPanelDynamicModel = /** @class */ (function (_
66995
67056
  };
66996
67057
  QuestionPanelDynamicModel.prototype.hasErrorInPanels = function (fireCallback, rec) {
66997
67058
  var res = false;
66998
- var panels = this.visiblePanelsCore;
67059
+ var panels = this.visiblePanels;
66999
67060
  var keyValues = [];
67000
67061
  for (var i = 0; i < panels.length; i++) {
67001
67062
  this.setOnCompleteAsyncInPanel(panels[i]);
@@ -70643,8 +70704,8 @@ Serializer.addClass("currencymask", [
70643
70704
 
70644
70705
  var Version;
70645
70706
  var ReleaseDate;
70646
- Version = "" + "1.12.5";
70647
- ReleaseDate = "" + "2024-10-07";
70707
+ Version = "" + "1.12.7";
70708
+ ReleaseDate = "" + "2024-10-23";
70648
70709
  function checkLibraryVersion(ver, libraryName) {
70649
70710
  if (Version != ver) {
70650
70711
  var str = "survey-core has version '" + Version + "' and " + libraryName
@@ -81600,6 +81661,12 @@ var popup_PopupContainer = /** @class */ (function (_super) {
81600
81661
  _this.model.clickOutside(e);
81601
81662
  }, onKeyDown: this.handleKeydown }, container));
81602
81663
  };
81664
+ PopupContainer.prototype.componentDidMount = function () {
81665
+ _super.prototype.componentDidMount.call(this);
81666
+ if (this.model.isVisible) {
81667
+ this.model.updateOnShowing();
81668
+ }
81669
+ };
81603
81670
  return PopupContainer;
81604
81671
  }(reactquestion_element_SurveyElementBase));
81605
81672
 
@@ -81630,12 +81697,26 @@ function showDialog(dialogOptions, rootElement) {
81630
81697
  var popupViewModel = createPopupModalViewModel(dialogOptions, rootElement);
81631
81698
  var onVisibilityChangedCallback = function (_, options) {
81632
81699
  if (!options.isVisible) {
81633
- external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_default.a.unmountComponentAtNode(popupViewModel.container);
81700
+ if (typeof external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_default.a.createRoot == "function") {
81701
+ if (!!root) {
81702
+ root.unmount();
81703
+ }
81704
+ }
81705
+ else {
81706
+ external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_default.a.unmountComponentAtNode(popupViewModel.container);
81707
+ }
81634
81708
  popupViewModel.dispose();
81635
81709
  }
81636
81710
  };
81637
81711
  popupViewModel.onVisibilityChanged.add(onVisibilityChangedCallback);
81638
- external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_default.a.render(external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(popup_PopupContainer, { model: popupViewModel }), popupViewModel.container);
81712
+ var root;
81713
+ if (typeof external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_default.a.createRoot == "function") {
81714
+ root = external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_default.a.createRoot(popupViewModel.container);
81715
+ root.render(external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(popup_PopupContainer, { model: popupViewModel }));
81716
+ }
81717
+ else {
81718
+ external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_default.a.render(external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(popup_PopupContainer, { model: popupViewModel }), popupViewModel.container);
81719
+ }
81639
81720
  popupViewModel.model.isVisible = true;
81640
81721
  return popupViewModel;
81641
81722
  }
@@ -81666,9 +81747,7 @@ var action_bar_item_dropdown_extends = (undefined && undefined.__extends) || (fu
81666
81747
  var action_bar_item_dropdown_SurveyActionBarItemDropdown = /** @class */ (function (_super) {
81667
81748
  action_bar_item_dropdown_extends(SurveyActionBarItemDropdown, _super);
81668
81749
  function SurveyActionBarItemDropdown(props) {
81669
- var _this = _super.call(this, props) || this;
81670
- _this.viewModel = new ActionDropdownViewModel(_this.item);
81671
- return _this;
81750
+ return _super.call(this, props) || this;
81672
81751
  }
81673
81752
  SurveyActionBarItemDropdown.prototype.renderInnerButton = function () {
81674
81753
  var button = _super.prototype.renderInnerButton.call(this);
@@ -81676,6 +81755,9 @@ var action_bar_item_dropdown_SurveyActionBarItemDropdown = /** @class */ (functi
81676
81755
  button,
81677
81756
  external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(popup_Popup, { model: this.item.popupModel, getTarget: getActionDropdownButtonTarget })));
81678
81757
  };
81758
+ SurveyActionBarItemDropdown.prototype.componentDidMount = function () {
81759
+ this.viewModel = new ActionDropdownViewModel(this.item);
81760
+ };
81679
81761
  SurveyActionBarItemDropdown.prototype.componentWillUnmount = function () {
81680
81762
  _super.prototype.componentWillUnmount.call(this);
81681
81763
  this.viewModel.dispose();
@@ -82066,9 +82148,6 @@ var text_area_TextAreaComponent = /** @class */ (function (_super) {
82066
82148
  var _this = this;
82067
82149
  return (external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("textarea", { id: this.viewModel.id, className: this.viewModel.className, ref: function (textarea) { return (_this.viewModel.setElement(textarea)); }, disabled: this.viewModel.isDisabledAttr, readOnly: this.viewModel.isReadOnlyAttr, rows: this.viewModel.rows, cols: this.viewModel.cols, placeholder: this.viewModel.placeholder, maxLength: this.viewModel.maxLength, defaultValue: this.initialValue, onChange: function (event) { _this.viewModel.onTextAreaInput(event); }, onFocus: function (event) { _this.viewModel.onTextAreaFocus(event); }, onBlur: function (event) { _this.viewModel.onTextAreaBlur(event); }, onKeyDown: function (event) { _this.viewModel.onTextAreaKeyDown(event); }, "aria-required": this.viewModel.ariaRequired, "aria-label": this.viewModel.ariaLabel, "aria-labelledby": this.viewModel.ariaLabelledBy, "aria-describedby": this.viewModel.ariaDescribedBy, "aria-invalid": this.viewModel.ariaInvalid, "aria-errormessage": this.viewModel.ariaErrormessage, style: { resize: this.viewModel.question.resizeStyle } }));
82068
82150
  };
82069
- TextAreaComponent.prototype.componentWillUnmount = function () {
82070
- this.viewModel.dispose();
82071
- };
82072
82151
  return TextAreaComponent;
82073
82152
  }(reactquestion_element_SurveyElementBase));
82074
82153
 
@@ -83083,6 +83162,7 @@ var reactSurvey_Survey = /** @class */ (function (_super) {
83083
83162
  if (!!el)
83084
83163
  this.survey.afterRenderSurvey(el);
83085
83164
  this.survey.startTimerFromUI();
83165
+ this.setSurveyEvents();
83086
83166
  }
83087
83167
  };
83088
83168
  Survey.prototype.shouldComponentUpdate = function (nextProps, nextState) {
@@ -83239,7 +83319,6 @@ var reactSurvey_Survey = /** @class */ (function (_super) {
83239
83319
  if (!!newProps.css) {
83240
83320
  this.survey.css = this.css;
83241
83321
  }
83242
- this.setSurveyEvents();
83243
83322
  };
83244
83323
  Survey.prototype.isModelJSONChanged = function (newProps) {
83245
83324
  if (!!newProps["model"]) {
@@ -84543,6 +84622,10 @@ var dropdown_item_SurveyQuestionOptionItem = /** @class */ (function (_super) {
84543
84622
  _super.prototype.componentDidUpdate.call(this, prevProps, prevState);
84544
84623
  this.setupModel();
84545
84624
  };
84625
+ SurveyQuestionOptionItem.prototype.componentDidMount = function () {
84626
+ _super.prototype.componentDidMount.call(this);
84627
+ this.setupModel();
84628
+ };
84546
84629
  SurveyQuestionOptionItem.prototype.componentWillUnmount = function () {
84547
84630
  _super.prototype.componentWillUnmount.call(this);
84548
84631
  if (!!this.item) {
@@ -88991,7 +89074,8 @@ var paneldynamic_remove_btn_SurveyQuestionPanelDynamicRemoveButton = /** @class
88991
89074
  }
88992
89075
  SurveyQuestionPanelDynamicRemoveButton.prototype.renderElement = function () {
88993
89076
  var btnText = this.renderLocString(this.question.locPanelRemoveText);
88994
- return (external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("button", { className: this.question.getPanelRemoveButtonCss(), onClick: this.handleClick, type: "button" },
89077
+ var id = this.question.getPanelRemoveButtonId(this.data.panel);
89078
+ return (external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("button", { id: id, className: this.question.getPanelRemoveButtonCss(), onClick: this.handleClick, type: "button" },
88995
89079
  external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", { className: this.question.cssClasses.buttonRemoveText }, btnText),
88996
89080
  external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", { className: this.question.cssClasses.iconRemove })));
88997
89081
  };