survey-react 1.12.6 → 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/defaultV2.css CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - Survey JavaScript library v1.12.6
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
  */
package/defaultV2.min.css CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - Survey JavaScript library v1.12.6
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
  */
package/modern.css CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - Survey JavaScript library v1.12.6
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
  */
package/modern.min.css CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - Survey JavaScript library v1.12.6
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
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "survey-react",
3
- "version": "1.12.6",
3
+ "version": "1.12.7",
4
4
  "description": "survey.js is a JavaScript Survey Library. It is a modern way to add a survey to your website. It uses JSON for survey metadata and results.",
5
5
  "keywords": [
6
6
  "Survey",
package/survey.css CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - Survey JavaScript library v1.12.6
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
  */
package/survey.min.css CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - Survey JavaScript library v1.12.6
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
  */
package/survey.react.d.ts CHANGED
@@ -4972,7 +4972,7 @@ declare module "packages/survey-core/src/question_baseselect" {
4972
4972
  *
4973
4973
  * [View Dropdown Demo](https://surveyjs.io/form-library/examples/dropdown-box-with-custom-items/ (linkStyle))
4974
4974
  *
4975
- * [View Ranking Demo](https://surveyjs.io/form-library/examples/dropdown-box-with-custom-items/ (linkStyle))
4975
+ * [View Ranking Demo](https://surveyjs.io/form-library/examples/ranking-with-custom-items/ (linkStyle))
4976
4976
  */
4977
4977
  get itemComponent(): string;
4978
4978
  set itemComponent(value: string);
@@ -7065,6 +7065,7 @@ declare module "packages/survey-core/src/question_paneldynamic" {
7065
7065
  * @see addPanelUI
7066
7066
  */
7067
7067
  removePanelUI(value: any): void;
7068
+ getPanelRemoveButtonId(panel: PanelModel): string;
7068
7069
  isRequireConfirmOnDelete(val: any): boolean;
7069
7070
  /**
7070
7071
  * Switches Dynamic Panel to the next panel. Returns `true` in case of success, or `false` if `displayMode` is `"list"` or the current panel contains validation errors.
@@ -10699,7 +10700,7 @@ declare module "packages/survey-core/src/survey" {
10699
10700
  * - `"onValueChanged"` - Triggers validation each time a question value is changed.
10700
10701
  * - `"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.
10701
10702
  *
10702
- * > 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.
10703
+ * > 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.
10703
10704
  *
10704
10705
  * Refer to the following help topic for more information: [Data Validation](https://surveyjs.io/form-library/documentation/data-validation).
10705
10706
  * @see validationEnabled
@@ -12671,7 +12672,7 @@ declare module "packages/survey-core/src/survey-element" {
12671
12672
  static ScrollElementToTop(elementId: string, scrollIfVisible?: boolean, scrollIntoViewOptions?: ScrollIntoViewOptions, doneCallback?: () => void): boolean;
12672
12673
  static ScrollElementToViewCore(el: HTMLElement, checkLeft: boolean, scrollIfVisible?: boolean, scrollIntoViewOptions?: ScrollIntoViewOptions, doneCallback?: () => void): boolean;
12673
12674
  static GetFirstNonTextElement(elements: any, removeSpaces?: boolean): any;
12674
- static FocusElement(elementId: string): boolean;
12675
+ static FocusElement(elementId: string, isTimeOut?: boolean, containerEl?: HTMLElement): boolean;
12675
12676
  private static focusElementCore;
12676
12677
  static CreateDisabledDesignElements: boolean;
12677
12678
  disableDesignActions: boolean;
package/survey.react.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - Survey JavaScript library v1.12.6
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
  */
@@ -13080,22 +13080,22 @@ var survey_element_SurveyElement = /** @class */ (function (_super) {
13080
13080
  }
13081
13081
  return null;
13082
13082
  };
13083
- SurveyElement.FocusElement = function (elementId) {
13083
+ SurveyElement.FocusElement = function (elementId, isTimeOut, containerEl) {
13084
13084
  if (!elementId || !DomDocumentHelper.isAvailable())
13085
13085
  return false;
13086
- var res = SurveyElement.focusElementCore(elementId);
13086
+ var res = !isTimeOut ? SurveyElement.focusElementCore(elementId, containerEl) : false;
13087
13087
  if (!res) {
13088
13088
  setTimeout(function () {
13089
- SurveyElement.focusElementCore(elementId);
13090
- }, 10);
13089
+ SurveyElement.focusElementCore(elementId, containerEl);
13090
+ }, isTimeOut ? 100 : 10);
13091
13091
  }
13092
13092
  return res;
13093
13093
  };
13094
- SurveyElement.focusElementCore = function (elementId) {
13094
+ SurveyElement.focusElementCore = function (elementId, containerEl) {
13095
13095
  var root = settings.environment.root;
13096
- if (!root)
13096
+ if (!root && !containerEl)
13097
13097
  return false;
13098
- var el = root.getElementById(elementId);
13098
+ var el = containerEl ? containerEl.querySelector("#" + CSS.escape(elementId)) : root.getElementById(elementId);
13099
13099
  // https://stackoverflow.com/questions/19669786/check-if-element-is-visible-in-dom
13100
13100
  if (el && !el["disabled"] && el.style.display !== "none" && el.offsetParent !== null) {
13101
13101
  SurveyElement.ScrollElementToViewCore(el, true, false);
@@ -19289,8 +19289,10 @@ var question_Question = /** @class */ (function (_super) {
19289
19289
  }
19290
19290
  };
19291
19291
  Question.prototype.focusInputElement = function (onError) {
19292
+ var _a;
19292
19293
  var id = !onError ? this.getFirstInputElementId() : this.getFirstErrorInputElementId();
19293
- 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)) {
19294
19296
  this.fireCallback(this.focusCallback);
19295
19297
  }
19296
19298
  };
@@ -39965,7 +39967,6 @@ var survey_SurveyModel = /** @class */ (function (_super) {
39965
39967
  else {
39966
39968
  this.cssValue = value;
39967
39969
  }
39968
- this.updateCss();
39969
39970
  this.updateElementCss(false);
39970
39971
  };
39971
39972
  Object.defineProperty(SurveyModel.prototype, "cssTitle", {
@@ -40627,7 +40628,7 @@ var survey_SurveyModel = /** @class */ (function (_super) {
40627
40628
  * - `"onValueChanged"` - Triggers validation each time a question value is changed.
40628
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.
40629
40630
  *
40630
- * > 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.
40631
40632
  *
40632
40633
  * Refer to the following help topic for more information: [Data Validation](https://surveyjs.io/form-library/documentation/data-validation).
40633
40634
  * @see validationEnabled
@@ -46181,11 +46182,13 @@ var survey_SurveyModel = /** @class */ (function (_super) {
46181
46182
  if (!!question.page) {
46182
46183
  this.questionHashesAdded(question);
46183
46184
  }
46184
- if (!this.currentPage) {
46185
- this.updateCurrentPage();
46185
+ if (!this.isLoadingFromJson) {
46186
+ if (!this.currentPage) {
46187
+ this.updateCurrentPage();
46188
+ }
46189
+ this.updateVisibleIndexes();
46190
+ this.setCalculatedWidthModeUpdater();
46186
46191
  }
46187
- this.updateVisibleIndexes();
46188
- this.setCalculatedWidthModeUpdater();
46189
46192
  if (this.canFireAddElement()) {
46190
46193
  this.onQuestionAdded.fire(this, {
46191
46194
  question: question,
@@ -46568,6 +46571,8 @@ var survey_SurveyModel = /** @class */ (function (_super) {
46568
46571
  });
46569
46572
  SurveyModel.prototype.setCalculatedWidthModeUpdater = function () {
46570
46573
  var _this = this;
46574
+ if (this.isLoadingFromJson)
46575
+ return;
46571
46576
  if (this.calculatedWidthModeUpdater)
46572
46577
  this.calculatedWidthModeUpdater.dispose();
46573
46578
  this.calculatedWidthModeUpdater = new ComputedUpdater(function () { return _this.calculateWidthMode(); });
@@ -49991,7 +49996,8 @@ var question_baseselect_QuestionSelectBase = /** @class */ (function (_super) {
49991
49996
  return !this.isDisabledAttr && item.isEnabled;
49992
49997
  };
49993
49998
  QuestionSelectBase.prototype.focusOtherComment = function () {
49994
- 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);
49995
50001
  };
49996
50002
  QuestionSelectBase.prototype.onValueChanged = function () {
49997
50003
  _super.prototype.onValueChanged.call(this);
@@ -50009,7 +50015,7 @@ var question_baseselect_QuestionSelectBase = /** @class */ (function (_super) {
50009
50015
  *
50010
50016
  * [View Dropdown Demo](https://surveyjs.io/form-library/examples/dropdown-box-with-custom-items/ (linkStyle))
50011
50017
  *
50012
- * [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))
50013
50019
  */
50014
50020
  get: function () {
50015
50021
  return this.getPropertyValue("itemComponent", this.getDefaultItemComponent());
@@ -66531,15 +66537,31 @@ var question_paneldynamic_QuestionPanelDynamicModel = /** @class */ (function (_
66531
66537
  */
66532
66538
  QuestionPanelDynamicModel.prototype.removePanelUI = function (value) {
66533
66539
  var _this = this;
66540
+ var visIndex = this.getVisualPanelIndex(value);
66541
+ if (visIndex < 0 || visIndex >= this.visiblePanelCount)
66542
+ return;
66534
66543
  if (!this.canRemovePanel)
66535
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
+ };
66536
66555
  if (this.isRequireConfirmOnDelete(value)) {
66537
- 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);
66538
66557
  }
66539
66558
  else {
66540
- this.removePanel(value);
66559
+ removePanel();
66541
66560
  }
66542
66561
  };
66562
+ QuestionPanelDynamicModel.prototype.getPanelRemoveButtonId = function (panel) {
66563
+ return panel.id + "_remove_button";
66564
+ };
66543
66565
  QuestionPanelDynamicModel.prototype.isRequireConfirmOnDelete = function (val) {
66544
66566
  if (!this.confirmDelete)
66545
66567
  return false;
@@ -67034,7 +67056,7 @@ var question_paneldynamic_QuestionPanelDynamicModel = /** @class */ (function (_
67034
67056
  };
67035
67057
  QuestionPanelDynamicModel.prototype.hasErrorInPanels = function (fireCallback, rec) {
67036
67058
  var res = false;
67037
- var panels = this.visiblePanelsCore;
67059
+ var panels = this.visiblePanels;
67038
67060
  var keyValues = [];
67039
67061
  for (var i = 0; i < panels.length; i++) {
67040
67062
  this.setOnCompleteAsyncInPanel(panels[i]);
@@ -70682,8 +70704,8 @@ Serializer.addClass("currencymask", [
70682
70704
 
70683
70705
  var Version;
70684
70706
  var ReleaseDate;
70685
- Version = "" + "1.12.6";
70686
- ReleaseDate = "" + "2024-10-15";
70707
+ Version = "" + "1.12.7";
70708
+ ReleaseDate = "" + "2024-10-23";
70687
70709
  function checkLibraryVersion(ver, libraryName) {
70688
70710
  if (Version != ver) {
70689
70711
  var str = "survey-core has version '" + Version + "' and " + libraryName
@@ -89052,7 +89074,8 @@ var paneldynamic_remove_btn_SurveyQuestionPanelDynamicRemoveButton = /** @class
89052
89074
  }
89053
89075
  SurveyQuestionPanelDynamicRemoveButton.prototype.renderElement = function () {
89054
89076
  var btnText = this.renderLocString(this.question.locPanelRemoveText);
89055
- 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" },
89056
89079
  external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", { className: this.question.cssClasses.buttonRemoveText }, btnText),
89057
89080
  external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", { className: this.question.cssClasses.iconRemove })));
89058
89081
  };