survey-react 1.9.81 → 1.9.83
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 +168 -137
- package/defaultV2.css.map +1 -1
- package/defaultV2.min.css +2 -2
- package/modern.css +63 -51
- package/modern.css.map +1 -1
- package/modern.min.css +2 -2
- package/package.json +1 -1
- package/survey.css +10 -6
- package/survey.css.map +1 -1
- package/survey.min.css +2 -2
- package/survey.react.d.ts +136 -105
- package/survey.react.js +455 -204
- package/survey.react.js.map +1 -1
- package/survey.react.min.js +3 -3
package/survey.react.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* surveyjs - Survey JavaScript library v1.9.
|
2
|
+
* surveyjs - Survey JavaScript library v1.9.83
|
3
3
|
* Copyright (c) 2015-2023 Devsoft Baltic OÜ - http://surveyjs.io/
|
4
4
|
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
|
5
5
|
*/
|
@@ -2859,6 +2859,8 @@ var Base = /** @class */ (function () {
|
|
2859
2859
|
this.localizableStrings = {};
|
2860
2860
|
}
|
2861
2861
|
this.localizableStrings[name] = locStr;
|
2862
|
+
var prop = this.getPropertyByName(name);
|
2863
|
+
locStr.disableLocalization = prop && prop.isLocalizable === false;
|
2862
2864
|
return locStr;
|
2863
2865
|
};
|
2864
2866
|
Base.prototype.getLocalizableString = function (name) {
|
@@ -5456,6 +5458,7 @@ var defaultStandardCss = {
|
|
5456
5458
|
rating: {
|
5457
5459
|
root: "sv_q_rating",
|
5458
5460
|
item: "sv_q_rating_item",
|
5461
|
+
itemFixedSize: "sv_q_rating_item_fixed",
|
5459
5462
|
selected: "active",
|
5460
5463
|
minText: "sv_q_rating_min_text",
|
5461
5464
|
itemText: "sv_q_rating_item_text",
|
@@ -6017,6 +6020,7 @@ var defaultV2Css = {
|
|
6017
6020
|
itemText: "sd-rating__item-text",
|
6018
6021
|
maxText: "sd-rating__item-text sd-rating__max-text",
|
6019
6022
|
itemDisabled: "sd-rating__item--disabled",
|
6023
|
+
itemFixedSize: "sd-rating__item--fixed-size",
|
6020
6024
|
control: "sd-input sd-dropdown",
|
6021
6025
|
controlValue: "sd-dropdown__value",
|
6022
6026
|
controlDisabled: "sd-input--disabled",
|
@@ -8175,6 +8179,9 @@ var DropdownListModel = /** @class */ (function (_super) {
|
|
8175
8179
|
this.listModel.resetFocusedItem();
|
8176
8180
|
if (this.question.selectedItem && this.question.selectedItem.text.indexOf(newValue) >= 0) {
|
8177
8181
|
this.listModel.focusedItem = this.getAvailableItems().filter(function (item) { return item.id == _this.question.selectedItem.value; })[0];
|
8182
|
+
if (this.listModel.filterString) {
|
8183
|
+
this.listModel.actions.map(function (a) { return a.selectedValue = false; });
|
8184
|
+
}
|
8178
8185
|
return;
|
8179
8186
|
}
|
8180
8187
|
if (!this.listModel.focusedItem || !this.listModel.isItemVisible(this.listModel.focusedItem)) {
|
@@ -8189,6 +8196,7 @@ var DropdownListModel = /** @class */ (function (_super) {
|
|
8189
8196
|
};
|
8190
8197
|
DropdownListModel.prototype.onHidePopup = function () {
|
8191
8198
|
this.resetFilterString();
|
8199
|
+
this.question.suggestedItem = null;
|
8192
8200
|
this.listModel.refresh();
|
8193
8201
|
};
|
8194
8202
|
DropdownListModel.prototype.getAvailableItems = function () {
|
@@ -8331,7 +8339,8 @@ var DropdownListModel = /** @class */ (function (_super) {
|
|
8331
8339
|
});
|
8332
8340
|
Object.defineProperty(DropdownListModel.prototype, "showHintString", {
|
8333
8341
|
get: function () {
|
8334
|
-
return !!this.question.searchEnabled && this.hintStringLC && this.hintStringLC.indexOf(this.inputStringLC) >= 0
|
8342
|
+
return !!this.question.searchEnabled && this.hintStringLC && this.hintStringLC.indexOf(this.inputStringLC) >= 0 ||
|
8343
|
+
!this.question.searchEnabled && this.hintStringLC && !this.question.value;
|
8335
8344
|
},
|
8336
8345
|
enumerable: false,
|
8337
8346
|
configurable: true
|
@@ -8381,6 +8390,8 @@ var DropdownListModel = /** @class */ (function (_super) {
|
|
8381
8390
|
};
|
8382
8391
|
DropdownListModel.prototype.onClick = function (event) {
|
8383
8392
|
this._popupModel.toggleVisibility();
|
8393
|
+
if (this._popupModel.isVisible && this.question.value && this.question instanceof _question_dropdown__WEBPACK_IMPORTED_MODULE_4__["QuestionDropdownModel"])
|
8394
|
+
this.changeSelectionWithKeyboard(false);
|
8384
8395
|
if (this.searchEnabled && !!event && !!event.target) {
|
8385
8396
|
var input = event.target.querySelector("input");
|
8386
8397
|
if (!!input) {
|
@@ -8403,14 +8414,20 @@ var DropdownListModel = /** @class */ (function (_super) {
|
|
8403
8414
|
};
|
8404
8415
|
DropdownListModel.prototype.changeSelectionWithKeyboard = function (reverse) {
|
8405
8416
|
var _a;
|
8417
|
+
var focusedItem = this.listModel.focusedItem;
|
8406
8418
|
if (reverse) {
|
8407
8419
|
this.listModel.focusPrevVisibleItem();
|
8408
8420
|
}
|
8409
8421
|
else {
|
8410
8422
|
this.listModel.focusNextVisibleItem();
|
8411
8423
|
}
|
8424
|
+
if (this.question.value && focusedItem && this.question instanceof _question_dropdown__WEBPACK_IMPORTED_MODULE_4__["QuestionDropdownModel"]) {
|
8425
|
+
focusedItem.selectedValue = false;
|
8426
|
+
this.listModel.focusedItem.selectedValue = !this.listModel.filterString;
|
8427
|
+
this.question.suggestedItem = this.listModel.focusedItem;
|
8428
|
+
}
|
8412
8429
|
this.scrollToFocusedItem();
|
8413
|
-
if (this.question.value && this.question.searchEnabled && this.question instanceof _question_dropdown__WEBPACK_IMPORTED_MODULE_4__["QuestionDropdownModel"]) {
|
8430
|
+
if (this.question.value && !this.listModel.filterString && this.question.searchEnabled && this.question instanceof _question_dropdown__WEBPACK_IMPORTED_MODULE_4__["QuestionDropdownModel"]) {
|
8414
8431
|
this.applyInputString(this.listModel.focusedItem);
|
8415
8432
|
}
|
8416
8433
|
else {
|
@@ -9515,7 +9532,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
9515
9532
|
// import "../../main.scss";
|
9516
9533
|
//import "../../modern.scss";
|
9517
9534
|
var Version;
|
9518
|
-
Version = "" + "1.9.
|
9535
|
+
Version = "" + "1.9.83";
|
9519
9536
|
function checkLibraryVersion(ver, libraryName) {
|
9520
9537
|
if (Version != ver) {
|
9521
9538
|
var str = "survey-core has version '" + Version + "' and " + libraryName
|
@@ -20024,6 +20041,9 @@ var LocalizableString = /** @class */ (function () {
|
|
20024
20041
|
return res;
|
20025
20042
|
};
|
20026
20043
|
LocalizableString.prototype.setLocaleText = function (loc, value) {
|
20044
|
+
if (this.disableLocalization) {
|
20045
|
+
loc = _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName;
|
20046
|
+
}
|
20027
20047
|
if (!this.storeDefaultText && value == this.getLocaleTextWithDefault(loc)) {
|
20028
20048
|
if (!!value || !!loc && loc !== this.defaultLoc)
|
20029
20049
|
return;
|
@@ -20031,7 +20051,7 @@ var LocalizableString = /** @class */ (function () {
|
|
20031
20051
|
var oldValue_1 = this.getValue(dl);
|
20032
20052
|
if (!!dl && !!oldValue_1) {
|
20033
20053
|
this.setValue(dl, value);
|
20034
|
-
this.fireStrChanged(
|
20054
|
+
this.fireStrChanged(dl, oldValue_1);
|
20035
20055
|
}
|
20036
20056
|
return;
|
20037
20057
|
}
|
@@ -20042,11 +20062,9 @@ var LocalizableString = /** @class */ (function () {
|
|
20042
20062
|
!this.getValue(loc) &&
|
20043
20063
|
value == this.getLocaleText(this.defaultLoc))
|
20044
20064
|
return;
|
20045
|
-
var curLoc = this.
|
20065
|
+
var curLoc = this.curLocale;
|
20046
20066
|
if (!loc)
|
20047
20067
|
loc = this.defaultLoc;
|
20048
|
-
if (!curLoc)
|
20049
|
-
curLoc = this.defaultLoc;
|
20050
20068
|
var oldValue = this.onStrChanged && loc === curLoc ? this.pureText : undefined;
|
20051
20069
|
delete this.htmlValues[loc];
|
20052
20070
|
if (!value) {
|
@@ -20066,8 +20084,15 @@ var LocalizableString = /** @class */ (function () {
|
|
20066
20084
|
}
|
20067
20085
|
}
|
20068
20086
|
}
|
20069
|
-
this.fireStrChanged(
|
20087
|
+
this.fireStrChanged(loc, oldValue);
|
20070
20088
|
};
|
20089
|
+
Object.defineProperty(LocalizableString.prototype, "curLocale", {
|
20090
|
+
get: function () {
|
20091
|
+
return !!this.locale ? this.locale : this.defaultLoc;
|
20092
|
+
},
|
20093
|
+
enumerable: false,
|
20094
|
+
configurable: true
|
20095
|
+
});
|
20071
20096
|
LocalizableString.prototype.canRemoveLocValue = function (loc, val) {
|
20072
20097
|
if (_settings__WEBPACK_IMPORTED_MODULE_2__["settings"].storeDuplicatedTranslations)
|
20073
20098
|
return false;
|
@@ -20084,9 +20109,12 @@ var LocalizableString = /** @class */ (function () {
|
|
20084
20109
|
return val == this.getLocaleText(this.defaultLoc);
|
20085
20110
|
}
|
20086
20111
|
};
|
20087
|
-
LocalizableString.prototype.fireStrChanged = function (
|
20112
|
+
LocalizableString.prototype.fireStrChanged = function (loc, oldValue) {
|
20088
20113
|
this.strChanged();
|
20089
|
-
if (
|
20114
|
+
if (!this.onStrChanged)
|
20115
|
+
return;
|
20116
|
+
var value = this.pureText;
|
20117
|
+
if (loc !== this.curLocale || oldValue !== value) {
|
20090
20118
|
this.onStrChanged(oldValue, value);
|
20091
20119
|
}
|
20092
20120
|
};
|
@@ -21871,12 +21899,12 @@ var germanSurveyStrings = {
|
|
21871
21899
|
confirmRemoveFile: "Sind Sie sicher, dass Sie diese Datei löschen möchten: {0}?",
|
21872
21900
|
confirmRemoveAllFiles: "Sind Sie sicher, dass Sie alle Dateien löschen möchten?",
|
21873
21901
|
questionTitlePatternText: "Fragentitel",
|
21874
|
-
modalCancelButtonText: "
|
21902
|
+
modalCancelButtonText: "Abbrechen",
|
21875
21903
|
modalApplyButtonText: "Anwenden",
|
21876
21904
|
filterStringPlaceholder: "Tippe um zu suchen...",
|
21877
|
-
|
21905
|
+
emptyMessage: "Es gibt noch keine Daten.",
|
21878
21906
|
noEntriesText: "Es gibt noch keine Einträge.\nKlicken Sie auf die Schaltfläche unten, um einen neuen Eintrag hinzuzufügen.",
|
21879
|
-
|
21907
|
+
more: "Mehr"
|
21880
21908
|
};
|
21881
21909
|
survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["de"] = germanSurveyStrings;
|
21882
21910
|
survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["de"] = "deutsch";
|
@@ -26356,7 +26384,7 @@ var PageModel = /** @class */ (function (_super) {
|
|
26356
26384
|
/**
|
26357
26385
|
* A caption displayed on a navigation button in the TOC or progress bar. Applies when [`showTOC`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#showTOC) is `true` or when [`showProgressBar`](https://surveyjs.io/form-library/documentation/surveymodel#showProgressBar) is `true` and [`progressBarType`](https://surveyjs.io/form-library/documentation/surveymodel#progressBarType) is `"buttons"`.
|
26358
26386
|
*
|
26359
|
-
* If
|
26387
|
+
* If navigation titles are unspecified, the navigation buttons display page [titles](https://surveyjs.io/form-library/documentation/api-reference/page-model#title) or [names](https://surveyjs.io/form-library/documentation/pagemodel#name).
|
26360
26388
|
*/
|
26361
26389
|
get: function () {
|
26362
26390
|
return this.getLocalizableStringText("navigationTitle");
|
@@ -30150,6 +30178,11 @@ var PopupDropdownViewModel = /** @class */ (function (_super) {
|
|
30150
30178
|
var visualViewport = window.visualViewport;
|
30151
30179
|
document.documentElement.style.setProperty("--sv-popup-overlay-height", visualViewport.height * visualViewport.scale + "px");
|
30152
30180
|
};
|
30181
|
+
_this.resizeWindowCallback = function () {
|
30182
|
+
if (!_this.isOverlay) {
|
30183
|
+
_this.updatePosition(true, false);
|
30184
|
+
}
|
30185
|
+
};
|
30153
30186
|
_this.clientY = 0;
|
30154
30187
|
_this.isTablet = false;
|
30155
30188
|
_this.touchStartEventCallback = function (event) {
|
@@ -30260,6 +30293,7 @@ var PopupDropdownViewModel = /** @class */ (function (_super) {
|
|
30260
30293
|
this.updatePosition(true, false);
|
30261
30294
|
}
|
30262
30295
|
this.switchFocus();
|
30296
|
+
window.addEventListener("resize", this.resizeWindowCallback);
|
30263
30297
|
if (this.shouldCreateResizeCallback) {
|
30264
30298
|
window.visualViewport.addEventListener("resize", this.resizeEventCallback);
|
30265
30299
|
if (this.container) {
|
@@ -30295,6 +30329,7 @@ var PopupDropdownViewModel = /** @class */ (function (_super) {
|
|
30295
30329
|
};
|
30296
30330
|
PopupDropdownViewModel.prototype.updateOnHiding = function () {
|
30297
30331
|
_super.prototype.updateOnHiding.call(this);
|
30332
|
+
window.removeEventListener("resize", this.resizeWindowCallback);
|
30298
30333
|
if (this.shouldCreateResizeCallback) {
|
30299
30334
|
window.visualViewport.removeEventListener("resize", this.resizeEventCallback);
|
30300
30335
|
if (this.container) {
|
@@ -31357,6 +31392,7 @@ var Question = /** @class */ (function (_super) {
|
|
31357
31392
|
Question.prototype.isReadOnlyRenderDiv = function () {
|
31358
31393
|
return this.isReadOnly && _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].readOnlyCommentRenderMode === "div";
|
31359
31394
|
};
|
31395
|
+
Question.prototype.setIsMobile = function (val) { };
|
31360
31396
|
Question.prototype.createLocTitleProperty = function () {
|
31361
31397
|
var _this = this;
|
31362
31398
|
var locTitleValue = _super.prototype.createLocTitleProperty.call(this);
|
@@ -33501,9 +33537,7 @@ var Question = /** @class */ (function (_super) {
|
|
33501
33537
|
}
|
33502
33538
|
};
|
33503
33539
|
Question.prototype.getValidName = function (name) {
|
33504
|
-
|
33505
|
-
return name;
|
33506
|
-
return name.trim().replace(/[\{\}]+/g, "");
|
33540
|
+
return makeNameValid(name);
|
33507
33541
|
};
|
33508
33542
|
//IQuestion
|
33509
33543
|
Question.prototype.updateValueFromSurvey = function (newValue) {
|
@@ -33561,7 +33595,7 @@ var Question = /** @class */ (function (_super) {
|
|
33561
33595
|
*
|
33562
33596
|
* Call this method after you assign new question values in code to ensure that they are acceptable.
|
33563
33597
|
*
|
33564
|
-
* > This method does not remove values that
|
33598
|
+
* > This method does not remove values that fail validation. Call the `validate()` method to validate newly assigned values.
|
33565
33599
|
*
|
33566
33600
|
* @see validate
|
33567
33601
|
*/
|
@@ -33725,7 +33759,9 @@ var Question = /** @class */ (function (_super) {
|
|
33725
33759
|
};
|
33726
33760
|
Question.questionCounter = 100;
|
33727
33761
|
__decorate([
|
33728
|
-
Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: false
|
33762
|
+
Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: false, onSet: function (val, target) {
|
33763
|
+
target.setIsMobile(val);
|
33764
|
+
} })
|
33729
33765
|
], Question.prototype, "isMobile", void 0);
|
33730
33766
|
__decorate([
|
33731
33767
|
Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ localizable: true })
|
@@ -33736,13 +33772,17 @@ var Question = /** @class */ (function (_super) {
|
|
33736
33772
|
return Question;
|
33737
33773
|
}(_survey_element__WEBPACK_IMPORTED_MODULE_2__["SurveyElement"]));
|
33738
33774
|
|
33739
|
-
function
|
33740
|
-
if (
|
33741
|
-
return str
|
33775
|
+
function makeNameValid(str) {
|
33776
|
+
if (!str)
|
33777
|
+
return str;
|
33778
|
+
str = str.trim().replace(/[\{\}]+/g, "");
|
33779
|
+
while (!!str && str[0] === _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].expressionDisableConversionChar) {
|
33780
|
+
str = str.substring(1);
|
33781
|
+
}
|
33742
33782
|
return str;
|
33743
33783
|
}
|
33744
33784
|
_jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("question", [
|
33745
|
-
{ name: "!name", onSettingValue: function (obj, val) { return
|
33785
|
+
{ name: "!name", onSettingValue: function (obj, val) { return makeNameValid(val); } },
|
33746
33786
|
{
|
33747
33787
|
name: "state",
|
33748
33788
|
default: "default",
|
@@ -33817,7 +33857,7 @@ _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("question", [
|
|
33817
33857
|
(!!parent && parent.showQuestionNumbers === "onpanel"));
|
33818
33858
|
},
|
33819
33859
|
},
|
33820
|
-
{ name: "valueName", onSettingValue: function (obj, val) { return
|
33860
|
+
{ name: "valueName", onSettingValue: function (obj, val) { return makeNameValid(val); } },
|
33821
33861
|
"enableIf:condition",
|
33822
33862
|
"defaultValue:value",
|
33823
33863
|
{
|
@@ -37762,9 +37802,6 @@ var QuestionCustomModelBase = /** @class */ (function (_super) {
|
|
37762
37802
|
QuestionCustomModelBase.prototype.getSurveyData = function () {
|
37763
37803
|
return this;
|
37764
37804
|
};
|
37765
|
-
// getSurvey(): ISurvey {
|
37766
|
-
// return this.survey;
|
37767
|
-
// }
|
37768
37805
|
QuestionCustomModelBase.prototype.getTextProcessor = function () {
|
37769
37806
|
return this.textProcessor;
|
37770
37807
|
};
|
@@ -37898,6 +37935,12 @@ var QuestionCustomModel = /** @class */ (function (_super) {
|
|
37898
37935
|
return;
|
37899
37936
|
_super.prototype.setValue.call(this, name, newValue, locNotification, allowNotifyValueChanged);
|
37900
37937
|
};
|
37938
|
+
QuestionCustomModel.prototype.onSetData = function () {
|
37939
|
+
_super.prototype.onSetData.call(this);
|
37940
|
+
if (!!this.survey && !this.isEmpty()) {
|
37941
|
+
this.setValue(this.name, this.value, false, this.allowNotifyValueChanged);
|
37942
|
+
}
|
37943
|
+
};
|
37901
37944
|
QuestionCustomModel.prototype.hasErrors = function (fireCallback, rec) {
|
37902
37945
|
if (fireCallback === void 0) { fireCallback = true; }
|
37903
37946
|
if (rec === void 0) { rec = null; }
|
@@ -38565,7 +38608,7 @@ var QuestionDropdownModel = /** @class */ (function (_super) {
|
|
38565
38608
|
};
|
38566
38609
|
Object.defineProperty(QuestionDropdownModel.prototype, "selectedItemLocText", {
|
38567
38610
|
get: function () {
|
38568
|
-
var item = this.selectedItem;
|
38611
|
+
var item = this.suggestedItem || this.selectedItem;
|
38569
38612
|
return item === null || item === void 0 ? void 0 : item.locText;
|
38570
38613
|
},
|
38571
38614
|
enumerable: false,
|
@@ -38692,6 +38735,9 @@ var QuestionDropdownModel = /** @class */ (function (_super) {
|
|
38692
38735
|
__decorate([
|
38693
38736
|
Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: 25 })
|
38694
38737
|
], QuestionDropdownModel.prototype, "choicesLazyLoadPageSize", void 0);
|
38738
|
+
__decorate([
|
38739
|
+
Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])()
|
38740
|
+
], QuestionDropdownModel.prototype, "suggestedItem", void 0);
|
38695
38741
|
return QuestionDropdownModel;
|
38696
38742
|
}(_question_baseselect__WEBPACK_IMPORTED_MODULE_2__["QuestionSelectBase"]));
|
38697
38743
|
|
@@ -42190,7 +42236,7 @@ var MatrixDropdownTotalCell = /** @class */ (function (_super) {
|
|
42190
42236
|
if (!!this.column.totalExpression)
|
42191
42237
|
return this.column.totalExpression;
|
42192
42238
|
if (this.column.totalType == "none")
|
42193
|
-
return "";
|
42239
|
+
return "''";
|
42194
42240
|
var funName = this.column.totalType + "InArray";
|
42195
42241
|
if (!_functionsfactory__WEBPACK_IMPORTED_MODULE_8__["FunctionFactory"].Instance.hasFunction(funName))
|
42196
42242
|
return "";
|
@@ -44216,12 +44262,17 @@ var QuestionMatrixDropdownModelBase = /** @class */ (function (_super) {
|
|
44216
44262
|
configurable: true
|
44217
44263
|
});
|
44218
44264
|
QuestionMatrixDropdownModelBase.prototype.onRowChanging = function (row, columnName, rowValue) {
|
44219
|
-
if (!this.survey)
|
44265
|
+
if (!this.survey && !this.cellValueChangingCallback)
|
44220
44266
|
return !!rowValue ? rowValue[columnName] : null;
|
44221
44267
|
var options = this.getOnCellValueChangedOptions(row, columnName, rowValue);
|
44222
44268
|
var oldRowValue = this.getRowValueCore(row, this.createNewValue(), true);
|
44223
44269
|
options.oldValue = !!oldRowValue ? oldRowValue[columnName] : null;
|
44224
|
-
this.
|
44270
|
+
if (!!this.cellValueChangingCallback) {
|
44271
|
+
options.value = this.cellValueChangingCallback(row, columnName, options.value, options.oldValue);
|
44272
|
+
}
|
44273
|
+
if (!!this.survey) {
|
44274
|
+
this.survey.matrixCellValueChanging(this, options);
|
44275
|
+
}
|
44225
44276
|
return options.value;
|
44226
44277
|
};
|
44227
44278
|
QuestionMatrixDropdownModelBase.prototype.onRowChanged = function (row, columnName, newRowValue, isDeletingValue) {
|
@@ -48935,6 +48986,13 @@ var QuestionPanelDynamicModel = /** @class */ (function (_super) {
|
|
48935
48986
|
_super.prototype.setValueCore.call(this, newValue);
|
48936
48987
|
}
|
48937
48988
|
};
|
48989
|
+
QuestionPanelDynamicModel.prototype.setIsMobile = function (val) {
|
48990
|
+
(this.panels || []).forEach(function (panel) { return panel.elements.forEach(function (element) {
|
48991
|
+
if (element instanceof _question__WEBPACK_IMPORTED_MODULE_3__["Question"]) {
|
48992
|
+
element.isMobile = val;
|
48993
|
+
}
|
48994
|
+
}); });
|
48995
|
+
};
|
48938
48996
|
Object.defineProperty(QuestionPanelDynamicModel.prototype, "panelCount", {
|
48939
48997
|
/**
|
48940
48998
|
* The number of panels in Dynamic Panel.
|
@@ -50693,13 +50751,14 @@ _questionfactory__WEBPACK_IMPORTED_MODULE_1__["QuestionFactory"].Instance.regist
|
|
50693
50751
|
__webpack_require__.r(__webpack_exports__);
|
50694
50752
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionRankingModel", function() { return QuestionRankingModel; });
|
50695
50753
|
/* harmony import */ var _dragdrop_ranking_choices__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./dragdrop/ranking-choices */ "./src/dragdrop/ranking-choices.ts");
|
50696
|
-
/* harmony import */ var
|
50697
|
-
/* harmony import */ var
|
50698
|
-
/* harmony import */ var
|
50699
|
-
/* harmony import */ var
|
50700
|
-
/* harmony import */ var
|
50701
|
-
/* harmony import */ var
|
50702
|
-
/* harmony import */ var
|
50754
|
+
/* harmony import */ var _itemvalue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./itemvalue */ "./src/itemvalue.ts");
|
50755
|
+
/* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts");
|
50756
|
+
/* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts");
|
50757
|
+
/* harmony import */ var _question_checkbox__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./question_checkbox */ "./src/question_checkbox.ts");
|
50758
|
+
/* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts");
|
50759
|
+
/* harmony import */ var _utils_devices__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils/devices */ "./src/utils/devices.ts");
|
50760
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts");
|
50761
|
+
/* harmony import */ var _src_settings__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../src/settings */ "./src/settings.ts");
|
50703
50762
|
var __extends = (undefined && undefined.__extends) || (function () {
|
50704
50763
|
var extendStatics = function (d, b) {
|
50705
50764
|
extendStatics = Object.setPrototypeOf ||
|
@@ -50729,6 +50788,7 @@ var __decorate = (undefined && undefined.__decorate) || function (decorators, ta
|
|
50729
50788
|
|
50730
50789
|
|
50731
50790
|
|
50791
|
+
|
50732
50792
|
/**
|
50733
50793
|
* A class that describes the Ranking question type.
|
50734
50794
|
*
|
@@ -50826,13 +50886,13 @@ var QuestionRankingModel = /** @class */ (function (_super) {
|
|
50826
50886
|
};
|
50827
50887
|
Object.defineProperty(QuestionRankingModel.prototype, "rootClass", {
|
50828
50888
|
get: function () {
|
50829
|
-
return new
|
50889
|
+
return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_5__["CssClassBuilder"]()
|
50830
50890
|
.append(this.cssClasses.root)
|
50831
|
-
.append(this.cssClasses.rootMobileMod,
|
50891
|
+
.append(this.cssClasses.rootMobileMod, _utils_devices__WEBPACK_IMPORTED_MODULE_6__["IsMobile"])
|
50832
50892
|
.append(this.cssClasses.rootDisabled, this.isReadOnly)
|
50833
50893
|
.append(this.cssClasses.rootDesignMode, !!this.isDesignMode)
|
50834
50894
|
.append(this.cssClasses.itemOnError, this.errors.length > 0)
|
50835
|
-
.append(this.cssClasses.rootDragHandleAreaIcon,
|
50895
|
+
.append(this.cssClasses.rootDragHandleAreaIcon, _src_settings__WEBPACK_IMPORTED_MODULE_8__["settings"].rankingDragHandleArea === "icon")
|
50836
50896
|
.toString();
|
50837
50897
|
},
|
50838
50898
|
enumerable: false,
|
@@ -50841,7 +50901,7 @@ var QuestionRankingModel = /** @class */ (function (_super) {
|
|
50841
50901
|
QuestionRankingModel.prototype.getItemClassCore = function (item, options) {
|
50842
50902
|
var itemIndex = this.rankingChoices.indexOf(item);
|
50843
50903
|
var dropTargetIndex = this.rankingChoices.indexOf(this.currentDropTarget);
|
50844
|
-
return new
|
50904
|
+
return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_5__["CssClassBuilder"]()
|
50845
50905
|
.append(_super.prototype.getItemClassCore.call(this, item, options))
|
50846
50906
|
.append(this.cssClasses.itemGhostMod, this.currentDropTarget === item)
|
50847
50907
|
.append("sv-dragdrop-movedown", itemIndex === dropTargetIndex + 1 && this.dropTargetNodeMove === "down")
|
@@ -50863,7 +50923,7 @@ var QuestionRankingModel = /** @class */ (function (_super) {
|
|
50863
50923
|
configurable: true
|
50864
50924
|
});
|
50865
50925
|
QuestionRankingModel.prototype.getItemIndexClasses = function () {
|
50866
|
-
return new
|
50926
|
+
return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_5__["CssClassBuilder"]()
|
50867
50927
|
.append(this.cssClasses.itemIndex)
|
50868
50928
|
.append(this.cssClasses.itemIndexEmptyMode, this.isEmpty())
|
50869
50929
|
.toString();
|
@@ -50876,7 +50936,7 @@ var QuestionRankingModel = /** @class */ (function (_super) {
|
|
50876
50936
|
this.updateRankingChoices();
|
50877
50937
|
};
|
50878
50938
|
QuestionRankingModel.prototype.isAnswerCorrect = function () {
|
50879
|
-
return
|
50939
|
+
return _helpers__WEBPACK_IMPORTED_MODULE_7__["Helpers"].isArraysEqual(this.value, this.correctAnswer, false);
|
50880
50940
|
};
|
50881
50941
|
QuestionRankingModel.prototype.onSurveyValueChanged = function (newValue) {
|
50882
50942
|
_super.prototype.onSurveyValueChanged.call(this, newValue);
|
@@ -50894,16 +50954,13 @@ var QuestionRankingModel = /** @class */ (function (_super) {
|
|
50894
50954
|
this.value = newValue;
|
50895
50955
|
};
|
50896
50956
|
QuestionRankingModel.prototype.removeFromValueByVisibleChoices = function () {
|
50897
|
-
var _this = this;
|
50898
50957
|
var newValue = this.value.slice();
|
50899
|
-
|
50900
|
-
|
50901
|
-
|
50902
|
-
|
50903
|
-
|
50904
|
-
|
50905
|
-
isValueItemToRemove && newValue.splice(index, 1);
|
50906
|
-
});
|
50958
|
+
var choices = this.visibleChoices;
|
50959
|
+
for (var i = this.value.length - 1; i >= 0; i--) {
|
50960
|
+
if (!_itemvalue__WEBPACK_IMPORTED_MODULE_1__["ItemValue"].getItemByValue(choices, this.value[i])) {
|
50961
|
+
newValue.splice(i, 1);
|
50962
|
+
}
|
50963
|
+
}
|
50907
50964
|
this.value = newValue;
|
50908
50965
|
};
|
50909
50966
|
Object.defineProperty(QuestionRankingModel.prototype, "rankingChoices", {
|
@@ -50941,7 +50998,7 @@ var QuestionRankingModel = /** @class */ (function (_super) {
|
|
50941
50998
|
this.dragDropRankingChoices = new _dragdrop_ranking_choices__WEBPACK_IMPORTED_MODULE_0__["DragDropRankingChoices"](this.survey, null, this.longTap);
|
50942
50999
|
};
|
50943
51000
|
QuestionRankingModel.prototype.isDragStartNodeValid = function (target) {
|
50944
|
-
if (
|
51001
|
+
if (_src_settings__WEBPACK_IMPORTED_MODULE_8__["settings"].rankingDragHandleArea === "icon") {
|
50945
51002
|
return target.classList.contains(this.cssClasses.itemIconHoverMod);
|
50946
51003
|
}
|
50947
51004
|
return true;
|
@@ -50972,13 +51029,13 @@ var QuestionRankingModel = /** @class */ (function (_super) {
|
|
50972
51029
|
return false;
|
50973
51030
|
};
|
50974
51031
|
QuestionRankingModel.prototype.getIconHoverCss = function () {
|
50975
|
-
return new
|
51032
|
+
return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_5__["CssClassBuilder"]()
|
50976
51033
|
.append(this.cssClasses.itemIcon)
|
50977
51034
|
.append(this.cssClasses.itemIconHoverMod)
|
50978
51035
|
.toString();
|
50979
51036
|
};
|
50980
51037
|
QuestionRankingModel.prototype.getIconFocusCss = function () {
|
50981
|
-
return new
|
51038
|
+
return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_5__["CssClassBuilder"]()
|
50982
51039
|
.append(this.cssClasses.itemIcon)
|
50983
51040
|
.append(this.cssClasses.itemIconFocusMod)
|
50984
51041
|
.toString();
|
@@ -51011,15 +51068,15 @@ var QuestionRankingModel = /** @class */ (function (_super) {
|
|
51011
51068
|
configurable: true
|
51012
51069
|
});
|
51013
51070
|
__decorate([
|
51014
|
-
Object(
|
51071
|
+
Object(_jsonobject__WEBPACK_IMPORTED_MODULE_2__["property"])({ defaultValue: null })
|
51015
51072
|
], QuestionRankingModel.prototype, "currentDropTarget", void 0);
|
51016
51073
|
__decorate([
|
51017
|
-
Object(
|
51074
|
+
Object(_jsonobject__WEBPACK_IMPORTED_MODULE_2__["property"])({ defaultValue: null })
|
51018
51075
|
], QuestionRankingModel.prototype, "dropTargetNodeMove", void 0);
|
51019
51076
|
return QuestionRankingModel;
|
51020
|
-
}(
|
51077
|
+
}(_question_checkbox__WEBPACK_IMPORTED_MODULE_4__["QuestionCheckboxModel"]));
|
51021
51078
|
|
51022
|
-
|
51079
|
+
_jsonobject__WEBPACK_IMPORTED_MODULE_2__["Serializer"].addClass("ranking", [
|
51023
51080
|
{ name: "showOtherItem", visible: false, isSerializable: false },
|
51024
51081
|
{ name: "otherText", visible: false, isSerializable: false },
|
51025
51082
|
{ name: "otherErrorText", visible: false, isSerializable: false },
|
@@ -51041,9 +51098,9 @@ _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("ranking", [
|
|
51041
51098
|
], function () {
|
51042
51099
|
return new QuestionRankingModel("");
|
51043
51100
|
}, "checkbox");
|
51044
|
-
|
51101
|
+
_questionfactory__WEBPACK_IMPORTED_MODULE_3__["QuestionFactory"].Instance.registerQuestion("ranking", function (name) {
|
51045
51102
|
var q = new QuestionRankingModel(name);
|
51046
|
-
q.choices =
|
51103
|
+
q.choices = _questionfactory__WEBPACK_IMPORTED_MODULE_3__["QuestionFactory"].DefaultChoices;
|
51047
51104
|
return q;
|
51048
51105
|
});
|
51049
51106
|
|
@@ -51107,8 +51164,13 @@ var RenderedRatingItem = /** @class */ (function (_super) {
|
|
51107
51164
|
var _this = _super.call(this) || this;
|
51108
51165
|
_this.itemValue = itemValue;
|
51109
51166
|
_this.locString = locString;
|
51167
|
+
_this.locText.onStringChanged.add(_this.onStringChangedCallback.bind(_this));
|
51168
|
+
_this.onStringChangedCallback();
|
51110
51169
|
return _this;
|
51111
51170
|
}
|
51171
|
+
RenderedRatingItem.prototype.onStringChangedCallback = function () {
|
51172
|
+
this.text = this.itemValue.text;
|
51173
|
+
};
|
51112
51174
|
Object.defineProperty(RenderedRatingItem.prototype, "value", {
|
51113
51175
|
get: function () {
|
51114
51176
|
return this.itemValue.getPropertyValue("value");
|
@@ -51123,16 +51185,12 @@ var RenderedRatingItem = /** @class */ (function (_super) {
|
|
51123
51185
|
enumerable: false,
|
51124
51186
|
configurable: true
|
51125
51187
|
});
|
51126
|
-
Object.defineProperty(RenderedRatingItem.prototype, "text", {
|
51127
|
-
get: function () {
|
51128
|
-
return this.itemValue.text;
|
51129
|
-
},
|
51130
|
-
enumerable: false,
|
51131
|
-
configurable: true
|
51132
|
-
});
|
51133
51188
|
__decorate([
|
51134
51189
|
Object(_jsonobject__WEBPACK_IMPORTED_MODULE_2__["property"])({ defaultValue: "" })
|
51135
51190
|
], RenderedRatingItem.prototype, "highlight", void 0);
|
51191
|
+
__decorate([
|
51192
|
+
Object(_jsonobject__WEBPACK_IMPORTED_MODULE_2__["property"])({ defaultValue: "" })
|
51193
|
+
], RenderedRatingItem.prototype, "text", void 0);
|
51136
51194
|
return RenderedRatingItem;
|
51137
51195
|
}(_base__WEBPACK_IMPORTED_MODULE_7__["Base"]));
|
51138
51196
|
|
@@ -51145,21 +51203,95 @@ var QuestionRatingModel = /** @class */ (function (_super) {
|
|
51145
51203
|
__extends(QuestionRatingModel, _super);
|
51146
51204
|
function QuestionRatingModel(name) {
|
51147
51205
|
var _this = _super.call(this, name) || this;
|
51206
|
+
_this._syncPropertiesChanging = false;
|
51148
51207
|
_this.createItemValues("rateValues");
|
51149
51208
|
_this.createRenderedRateItems();
|
51150
51209
|
_this.createLocalizableString("ratingOptionsCaption", _this, false, true);
|
51151
|
-
_this.registerFunctionOnPropertiesValueChanged(["
|
51210
|
+
_this.registerFunctionOnPropertiesValueChanged(["rateMin", "rateMax", "rateDisplayMode",
|
51152
51211
|
"minRateDescription", "maxRateDescription", "rateStep", "displayRateDescriptionsAsExtremeItems"], function () { return _this.createRenderedRateItems(); });
|
51212
|
+
_this.registerFunctionOnPropertiesValueChanged(["rateValues"], function () {
|
51213
|
+
_this.autoGenerate = false;
|
51214
|
+
_this.createRenderedRateItems();
|
51215
|
+
});
|
51216
|
+
_this.registerFunctionOnPropertiesValueChanged(["autoGenerate"], function () {
|
51217
|
+
if (!_this.autoGenerate && _this.rateValues.length === 0) {
|
51218
|
+
_this.setPropertyValue("rateValues", _this.visibleRateValues);
|
51219
|
+
}
|
51220
|
+
if (_this.autoGenerate)
|
51221
|
+
_this.updateRateMax();
|
51222
|
+
_this.createRenderedRateItems();
|
51223
|
+
});
|
51153
51224
|
_this.createLocalizableString("minRateDescription", _this, true);
|
51154
51225
|
_this.createLocalizableString("maxRateDescription", _this, true);
|
51226
|
+
_this.initPropertyDependencies();
|
51155
51227
|
return _this;
|
51156
51228
|
}
|
51229
|
+
QuestionRatingModel.prototype.startLoadingFromJson = function (jsonObj) {
|
51230
|
+
_super.prototype.startLoadingFromJson.call(this, jsonObj);
|
51231
|
+
this.jsonObj = jsonObj;
|
51232
|
+
};
|
51157
51233
|
QuestionRatingModel.prototype.endLoadingFromJson = function () {
|
51158
51234
|
_super.prototype.endLoadingFromJson.call(this);
|
51159
51235
|
this.hasMinRateDescription = !!this.minRateDescription;
|
51160
51236
|
this.hasMaxRateDescription = !!this.maxRateDescription;
|
51237
|
+
if (this.jsonObj.rateMin !== undefined && this.jsonObj.rateCount !== undefined && this.jsonObj.rateMax === undefined) {
|
51238
|
+
this.updateRateMax();
|
51239
|
+
}
|
51240
|
+
if (this.jsonObj.rateMax !== undefined && this.jsonObj.rateCount !== undefined && this.jsonObj.rateMin === undefined) {
|
51241
|
+
this.updateRateMin();
|
51242
|
+
}
|
51243
|
+
if (this.jsonObj.autoGenerate === undefined && this.jsonObj.rateValues !== undefined)
|
51244
|
+
this.autoGenerate = !this.jsonObj.rateValues.length;
|
51245
|
+
this.updateRateCount();
|
51161
51246
|
this.createRenderedRateItems();
|
51162
51247
|
};
|
51248
|
+
QuestionRatingModel.prototype.registerSychProperties = function (names, func) {
|
51249
|
+
var _this = this;
|
51250
|
+
this.registerFunctionOnPropertiesValueChanged(names, function () {
|
51251
|
+
if (!_this._syncPropertiesChanging) {
|
51252
|
+
_this._syncPropertiesChanging = true;
|
51253
|
+
func();
|
51254
|
+
_this._syncPropertiesChanging = false;
|
51255
|
+
}
|
51256
|
+
});
|
51257
|
+
};
|
51258
|
+
QuestionRatingModel.prototype.useRateValues = function () {
|
51259
|
+
return !!this.rateValues.length && !this.autoGenerate;
|
51260
|
+
};
|
51261
|
+
QuestionRatingModel.prototype.updateRateMax = function () {
|
51262
|
+
this.rateMax = this.rateMin + this.rateStep * (this.rateCount - 1);
|
51263
|
+
};
|
51264
|
+
QuestionRatingModel.prototype.updateRateMin = function () {
|
51265
|
+
this.rateMin = this.rateMax - this.rateStep * (this.rateCount - 1);
|
51266
|
+
};
|
51267
|
+
QuestionRatingModel.prototype.updateRateCount = function () {
|
51268
|
+
if (this.useRateValues()) {
|
51269
|
+
this.rateCount = this.rateValues.length;
|
51270
|
+
}
|
51271
|
+
else {
|
51272
|
+
this.rateCount = Math.trunc((this.rateMax - this.rateMin) / (this.rateStep || 1)) + 1;
|
51273
|
+
}
|
51274
|
+
};
|
51275
|
+
QuestionRatingModel.prototype.initPropertyDependencies = function () {
|
51276
|
+
var _this = this;
|
51277
|
+
this.registerSychProperties(["rateCount"], function () {
|
51278
|
+
if (!_this.useRateValues()) {
|
51279
|
+
_this.rateMax = _this.rateMin + _this.rateStep * (_this.rateCount - 1);
|
51280
|
+
}
|
51281
|
+
else {
|
51282
|
+
if (_this.rateCount < _this.rateValues.length) {
|
51283
|
+
_this.rateValues.splice(_this.rateCount, _this.rateValues.length - _this.rateCount);
|
51284
|
+
}
|
51285
|
+
else {
|
51286
|
+
for (var i = _this.rateValues.length; i < _this.rateCount; i++)
|
51287
|
+
_this.rateValues.push(new _itemvalue__WEBPACK_IMPORTED_MODULE_0__["ItemValue"](undefined));
|
51288
|
+
}
|
51289
|
+
}
|
51290
|
+
});
|
51291
|
+
this.registerSychProperties(["rateMin", "rateMax", "rateStep", "rateValues"], function () {
|
51292
|
+
_this.updateRateCount();
|
51293
|
+
});
|
51294
|
+
};
|
51163
51295
|
Object.defineProperty(QuestionRatingModel.prototype, "rateValues", {
|
51164
51296
|
/**
|
51165
51297
|
* A list of rate values.
|
@@ -51180,10 +51312,7 @@ var QuestionRatingModel = /** @class */ (function (_super) {
|
|
51180
51312
|
*
|
51181
51313
|
* If you need to specify only the `value` property, you can set the `rateValues` property to an array of numbers, for example, `[ 3, 6, 10 ]`. These values are both saved in survey results and used as display text.
|
51182
51314
|
*
|
51183
|
-
* If you do not specify the `rateValues` property, rate values are generated automatically based upon the `rateMin
|
51184
|
-
* @see rateMin
|
51185
|
-
* @see rateMax
|
51186
|
-
* @see rateStep
|
51315
|
+
* If you do not specify the `rateValues` property, rate values are generated automatically based upon the [`rateMin`](https://surveyjs.io/form-library/documentation/api-reference/rating-scale-question-model#rateMin), [`rateMax`](https://surveyjs.io/form-library/documentation/api-reference/rating-scale-question-model#rateMax), [`rateStep`](https://surveyjs.io/form-library/documentation/api-reference/rating-scale-question-model#rateStep), and [`rateCount`](https://surveyjs.io/form-library/documentation/api-reference/rating-scale-question-model#rateCount) property values.
|
51187
51316
|
*/
|
51188
51317
|
get: function () {
|
51189
51318
|
return this.getPropertyValue("rateValues");
|
@@ -51197,12 +51326,12 @@ var QuestionRatingModel = /** @class */ (function (_super) {
|
|
51197
51326
|
});
|
51198
51327
|
Object.defineProperty(QuestionRatingModel.prototype, "rateMin", {
|
51199
51328
|
/**
|
51200
|
-
* Specifies the first rate value in the generated sequence of rate values. Applies if the `rateValues` array is empty.
|
51329
|
+
* Specifies the first rate value in the generated sequence of rate values. Applies if the [`rateValues`](https://surveyjs.io/form-library/documentation/api-reference/rating-scale-question-model#rateValues) array is empty.
|
51201
51330
|
*
|
51202
51331
|
* Default value: 1
|
51203
|
-
* @see rateValues
|
51204
51332
|
* @see rateMax
|
51205
51333
|
* @see rateStep
|
51334
|
+
* @see rateCount
|
51206
51335
|
*/
|
51207
51336
|
get: function () {
|
51208
51337
|
return this.getPropertyValue("rateMin");
|
@@ -51215,12 +51344,12 @@ var QuestionRatingModel = /** @class */ (function (_super) {
|
|
51215
51344
|
});
|
51216
51345
|
Object.defineProperty(QuestionRatingModel.prototype, "rateMax", {
|
51217
51346
|
/**
|
51218
|
-
* Specifies the last rate value in the generated sequence of rate values. Applies if the `rateValues` array is empty.
|
51347
|
+
* Specifies the last rate value in the generated sequence of rate values. Applies if the [`rateValues`](https://surveyjs.io/form-library/documentation/api-reference/rating-scale-question-model#rateValues) array is empty.
|
51219
51348
|
*
|
51220
51349
|
* Default value: 5
|
51221
|
-
* @see rateValues
|
51222
51350
|
* @see rateMin
|
51223
51351
|
* @see rateStep
|
51352
|
+
* @see rateCount
|
51224
51353
|
*/
|
51225
51354
|
get: function () {
|
51226
51355
|
return this.getPropertyValue("rateMax");
|
@@ -51233,12 +51362,12 @@ var QuestionRatingModel = /** @class */ (function (_super) {
|
|
51233
51362
|
});
|
51234
51363
|
Object.defineProperty(QuestionRatingModel.prototype, "rateStep", {
|
51235
51364
|
/**
|
51236
|
-
* Specifies a step with which to generate rate values. Applies if the `rateValues` array is empty.
|
51365
|
+
* Specifies a step with which to generate rate values. Applies if the [`rateValues`](https://surveyjs.io/form-library/documentation/api-reference/rating-scale-question-model#rateValues) array is empty.
|
51237
51366
|
*
|
51238
51367
|
* Default value: 1
|
51239
|
-
* @see rateValues
|
51240
51368
|
* @see rateMin
|
51241
51369
|
* @see rateMax
|
51370
|
+
* @see rateCount
|
51242
51371
|
*/
|
51243
51372
|
get: function () {
|
51244
51373
|
return this.getPropertyValue("rateStep");
|
@@ -51261,14 +51390,14 @@ var QuestionRatingModel = /** @class */ (function (_super) {
|
|
51261
51390
|
configurable: true
|
51262
51391
|
});
|
51263
51392
|
QuestionRatingModel.prototype.itemValuePropertyChanged = function (item, name, oldValue, newValue) {
|
51264
|
-
if (this.
|
51265
|
-
this.
|
51393
|
+
if (!this.useRateValues() && newValue !== undefined)
|
51394
|
+
this.autoGenerate = false;
|
51266
51395
|
_super.prototype.itemValuePropertyChanged.call(this, item, name, oldValue, newValue);
|
51267
51396
|
};
|
51268
51397
|
QuestionRatingModel.prototype.createRenderedRateItems = function () {
|
51269
51398
|
var _this = this;
|
51270
51399
|
var rateValues = [];
|
51271
|
-
if (this.
|
51400
|
+
if (this.useRateValues()) {
|
51272
51401
|
rateValues = this.rateValues;
|
51273
51402
|
}
|
51274
51403
|
else {
|
@@ -51285,6 +51414,8 @@ var QuestionRatingModel = /** @class */ (function (_super) {
|
|
51285
51414
|
}
|
51286
51415
|
rateValues = res;
|
51287
51416
|
}
|
51417
|
+
if (this.rateType == "smileys" && rateValues.length > 10)
|
51418
|
+
rateValues = rateValues.slice(0, 10);
|
51288
51419
|
this.renderedRateItems = rateValues.map(function (v, i) {
|
51289
51420
|
if (_this.displayRateDescriptionsAsExtremeItems) {
|
51290
51421
|
if (i == 0)
|
@@ -51384,6 +51515,16 @@ var QuestionRatingModel = /** @class */ (function (_super) {
|
|
51384
51515
|
enumerable: false,
|
51385
51516
|
configurable: true
|
51386
51517
|
});
|
51518
|
+
Object.defineProperty(QuestionRatingModel.prototype, "rateType", {
|
51519
|
+
get: function () {
|
51520
|
+
return this.rateDisplayMode;
|
51521
|
+
},
|
51522
|
+
set: function (val) {
|
51523
|
+
this.rateDisplayMode = val;
|
51524
|
+
},
|
51525
|
+
enumerable: false,
|
51526
|
+
configurable: true
|
51527
|
+
});
|
51387
51528
|
Object.defineProperty(QuestionRatingModel.prototype, "isStar", {
|
51388
51529
|
get: function () {
|
51389
51530
|
return this.rateType == "stars";
|
@@ -51410,7 +51551,7 @@ var QuestionRatingModel = /** @class */ (function (_super) {
|
|
51410
51551
|
configurable: true
|
51411
51552
|
});
|
51412
51553
|
QuestionRatingModel.prototype.valueToData = function (val) {
|
51413
|
-
if (this.
|
51554
|
+
if (this.useRateValues()) {
|
51414
51555
|
var item = _itemvalue__WEBPACK_IMPORTED_MODULE_0__["ItemValue"].getItemByValue(this.rateValues, val);
|
51415
51556
|
return !!item ? item.value : val;
|
51416
51557
|
}
|
@@ -51451,10 +51592,10 @@ var QuestionRatingModel = /** @class */ (function (_super) {
|
|
51451
51592
|
QuestionRatingModel.prototype.getItemSmiley = function (item) {
|
51452
51593
|
var icons = ["terrible", "very-poor", "poor", "not-good", "average", "normal", "good", "very-good", "excellent", "perfect"];
|
51453
51594
|
var priority = ["very-good", "not-good", "normal", "good", "average", "excellent", "poor", "perfect", "very-poor", "terrible"];
|
51454
|
-
var count = this.rateValues.length
|
51595
|
+
var count = this.useRateValues() ? this.rateValues.length : this.rateMax - this.rateMin + 1;
|
51455
51596
|
var selectedPriority = priority.slice(0, count);
|
51456
51597
|
var selectedIcons = icons.filter(function (i) { return selectedPriority.indexOf(i) != -1; });
|
51457
|
-
if (this.
|
51598
|
+
if (!this.useRateValues()) {
|
51458
51599
|
return selectedIcons[item.value - this.rateMin];
|
51459
51600
|
}
|
51460
51601
|
else {
|
@@ -51469,7 +51610,7 @@ var QuestionRatingModel = /** @class */ (function (_super) {
|
|
51469
51610
|
if (highlight === void 0) { highlight = "none"; }
|
51470
51611
|
var isSelected = this.value == item.value;
|
51471
51612
|
if (this.isStar) {
|
51472
|
-
if (this.
|
51613
|
+
if (!this.useRateValues()) {
|
51473
51614
|
isSelected = this.value >= item.value;
|
51474
51615
|
}
|
51475
51616
|
else {
|
@@ -51504,6 +51645,13 @@ var QuestionRatingModel = /** @class */ (function (_super) {
|
|
51504
51645
|
itemHoverClass = this.cssClasses.itemSmileyHover;
|
51505
51646
|
itemitemOnErrorClass = this.cssClasses.itemSmileyOnError;
|
51506
51647
|
}
|
51648
|
+
var hasFixedSize = !this.isStar &&
|
51649
|
+
!this.isSmiley &&
|
51650
|
+
(!this.displayRateDescriptionsAsExtremeItems ||
|
51651
|
+
this.useRateValues() && item != this.rateValues[0] && item != this.rateValues[this.rateValues.length - 1] ||
|
51652
|
+
!this.useRateValues() && item.value != this.rateMin && item.value != this.rateMax) &&
|
51653
|
+
item.locText.calculatedText.length <= 2 &&
|
51654
|
+
Number.isInteger(Number(item.locText.calculatedText));
|
51507
51655
|
return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_6__["CssClassBuilder"]()
|
51508
51656
|
.append(itemClass)
|
51509
51657
|
.append(itemSelectedClass, isSelected)
|
@@ -51512,6 +51660,7 @@ var QuestionRatingModel = /** @class */ (function (_super) {
|
|
51512
51660
|
.append(itemHighlightedClass, isHighlighted)
|
51513
51661
|
.append(itemUnhighlightedClass, isUnhighlighted)
|
51514
51662
|
.append(itemitemOnErrorClass, this.errors.length > 0)
|
51663
|
+
.append(this.cssClasses.itemFixedSize, hasFixedSize)
|
51515
51664
|
.toString();
|
51516
51665
|
};
|
51517
51666
|
//methods for mobile view
|
@@ -51628,6 +51777,12 @@ var QuestionRatingModel = /** @class */ (function (_super) {
|
|
51628
51777
|
}
|
51629
51778
|
return classes;
|
51630
51779
|
};
|
51780
|
+
__decorate([
|
51781
|
+
Object(_jsonobject__WEBPACK_IMPORTED_MODULE_2__["property"])({ defaultValue: true })
|
51782
|
+
], QuestionRatingModel.prototype, "autoGenerate", void 0);
|
51783
|
+
__decorate([
|
51784
|
+
Object(_jsonobject__WEBPACK_IMPORTED_MODULE_2__["property"])({ defaultValue: 5 })
|
51785
|
+
], QuestionRatingModel.prototype, "rateCount", void 0);
|
51631
51786
|
__decorate([
|
51632
51787
|
Object(_jsonobject__WEBPACK_IMPORTED_MODULE_2__["propertyArray"])()
|
51633
51788
|
], QuestionRatingModel.prototype, "renderedRateItems", void 0);
|
@@ -51656,8 +51811,8 @@ var QuestionRatingModel = /** @class */ (function (_super) {
|
|
51656
51811
|
})
|
51657
51812
|
], QuestionRatingModel.prototype, "displayMode", void 0);
|
51658
51813
|
__decorate([
|
51659
|
-
Object(_jsonobject__WEBPACK_IMPORTED_MODULE_2__["property"])({ defaultValue: "
|
51660
|
-
], QuestionRatingModel.prototype, "
|
51814
|
+
Object(_jsonobject__WEBPACK_IMPORTED_MODULE_2__["property"])({ defaultValue: "labels" })
|
51815
|
+
], QuestionRatingModel.prototype, "rateDisplayMode", void 0);
|
51661
51816
|
__decorate([
|
51662
51817
|
Object(_jsonobject__WEBPACK_IMPORTED_MODULE_2__["property"])({ defaultValue: "monochrome" })
|
51663
51818
|
], QuestionRatingModel.prototype, "smileysColorMode", void 0);
|
@@ -51666,23 +51821,58 @@ var QuestionRatingModel = /** @class */ (function (_super) {
|
|
51666
51821
|
|
51667
51822
|
_jsonobject__WEBPACK_IMPORTED_MODULE_2__["Serializer"].addClass("rating", [
|
51668
51823
|
{ name: "showCommentArea:switch", layout: "row", visible: true, category: "general" },
|
51824
|
+
{
|
51825
|
+
name: "rateDisplayMode",
|
51826
|
+
alternativeName: "rateType",
|
51827
|
+
default: "labels",
|
51828
|
+
category: "rateValues",
|
51829
|
+
choices: ["labels", "stars", "smileys"],
|
51830
|
+
visibleIndex: 0
|
51831
|
+
},
|
51832
|
+
{
|
51833
|
+
name: "autoGenerate",
|
51834
|
+
displayName: "How to specify rate values?",
|
51835
|
+
category: "rateValues",
|
51836
|
+
default: true,
|
51837
|
+
choices: [{ value: true, text: "Generate" }, { value: false, text: "Enter manually" }],
|
51838
|
+
visibleIndex: 2
|
51839
|
+
},
|
51840
|
+
{
|
51841
|
+
name: "rateCount:number",
|
51842
|
+
default: 5,
|
51843
|
+
category: "rateValues",
|
51844
|
+
visibleIndex: 1
|
51845
|
+
},
|
51669
51846
|
{
|
51670
51847
|
name: "rateValues:itemvalue[]",
|
51671
51848
|
baseValue: function () {
|
51672
51849
|
return _surveyStrings__WEBPACK_IMPORTED_MODULE_5__["surveyLocalization"].getString("choices_Item");
|
51673
51850
|
},
|
51851
|
+
category: "rateValues",
|
51852
|
+
visibleIf: function (obj) {
|
51853
|
+
return !obj.autoGenerate;
|
51854
|
+
},
|
51855
|
+
visibleIndex: 3
|
51674
51856
|
},
|
51675
51857
|
{
|
51676
51858
|
name: "rateMin:number", default: 1,
|
51677
51859
|
onSettingValue: function (obj, val) {
|
51678
51860
|
return val > obj.rateMax - obj.rateStep ? obj.rateMax - obj.rateStep : val;
|
51679
|
-
}
|
51861
|
+
},
|
51862
|
+
visibleIf: function (obj) {
|
51863
|
+
return !!obj.autoGenerate;
|
51864
|
+
},
|
51865
|
+
visibleIndex: 4
|
51680
51866
|
},
|
51681
51867
|
{
|
51682
51868
|
name: "rateMax:number", default: 5,
|
51683
51869
|
onSettingValue: function (obj, val) {
|
51684
51870
|
return val < obj.rateMin + obj.rateStep ? obj.rateMin + obj.rateStep : val;
|
51685
|
-
}
|
51871
|
+
},
|
51872
|
+
visibleIf: function (obj) {
|
51873
|
+
return !!obj.autoGenerate;
|
51874
|
+
},
|
51875
|
+
visibleIndex: 5
|
51686
51876
|
},
|
51687
51877
|
{
|
51688
51878
|
name: "rateStep:number", default: 1, minValue: 0.1,
|
@@ -51692,30 +51882,31 @@ _jsonobject__WEBPACK_IMPORTED_MODULE_2__["Serializer"].addClass("rating", [
|
|
51692
51882
|
if (val > obj.rateMax - obj.rateMin)
|
51693
51883
|
val = obj.rateMax - obj.rateMin;
|
51694
51884
|
return val;
|
51695
|
-
}
|
51885
|
+
},
|
51886
|
+
visibleIf: function (obj) {
|
51887
|
+
return !!obj.autoGenerate;
|
51888
|
+
},
|
51889
|
+
visibleIndex: 6
|
51696
51890
|
},
|
51697
51891
|
{
|
51698
51892
|
name: "minRateDescription",
|
51699
51893
|
alternativeName: "mininumRateDescription",
|
51700
51894
|
serializationProperty: "locMinRateDescription",
|
51895
|
+
visibleIndex: 17
|
51701
51896
|
},
|
51702
51897
|
{
|
51703
51898
|
name: "maxRateDescription",
|
51704
51899
|
alternativeName: "maximumRateDescription",
|
51705
51900
|
serializationProperty: "locMaxRateDescription",
|
51901
|
+
visibleIndex: 18
|
51706
51902
|
},
|
51707
|
-
{ name: "displayRateDescriptionsAsExtremeItems:boolean", default: false },
|
51903
|
+
{ name: "displayRateDescriptionsAsExtremeItems:boolean", default: false, visibleIndex: 19 },
|
51708
51904
|
{
|
51709
51905
|
name: "displayMode",
|
51710
51906
|
default: "auto",
|
51711
51907
|
choices: ["auto", "buttons", "dropdown"],
|
51908
|
+
visibleIndex: 20
|
51712
51909
|
},
|
51713
|
-
{
|
51714
|
-
name: "rateType",
|
51715
|
-
visible: false,
|
51716
|
-
default: "number",
|
51717
|
-
choices: ["numbers", "labels", "stars", "smileys"],
|
51718
|
-
}
|
51719
51910
|
], function () {
|
51720
51911
|
return new QuestionRatingModel("");
|
51721
51912
|
}, "question");
|
@@ -56202,7 +56393,7 @@ var TitleElement = /** @class */ (function (_super) {
|
|
56202
56393
|
};
|
56203
56394
|
}
|
56204
56395
|
var CustomTag = element.titleTagName;
|
56205
|
-
return (react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(CustomTag, { className: element.cssTitle, id: element.ariaTitleId, "aria-label": ariaLabel, tabIndex: element.titleTabIndex, "aria-expanded": element.titleAriaExpanded, role:
|
56396
|
+
return (react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(CustomTag, { className: element.cssTitle, id: element.ariaTitleId, "aria-label": ariaLabel, tabIndex: element.titleTabIndex, "aria-expanded": element.titleAriaExpanded, role: element.titleAriaRole, onClick: onClick, onKeyUp: onKeyUp }, titleContent));
|
56206
56397
|
};
|
56207
56398
|
return TitleElement;
|
56208
56399
|
}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component));
|
@@ -57850,8 +58041,14 @@ var Survey = /** @class */ (function (_super) {
|
|
57850
58041
|
}
|
57851
58042
|
var rootCss = this.survey.getRootCss();
|
57852
58043
|
var cssClasses = this.rootNodeClassName ? this.rootNodeClassName + " " + rootCss : rootCss;
|
57853
|
-
|
57854
|
-
|
58044
|
+
var rootStyle = {
|
58045
|
+
backgroundImage: this.survey.renderBackgroundImage
|
58046
|
+
};
|
58047
|
+
var formStyle = {
|
58048
|
+
backgroundColor: this.survey.renderBackgroundOpacity
|
58049
|
+
};
|
58050
|
+
return (react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { id: this.rootNodeId, ref: this.rootRef, className: cssClasses, style: rootStyle },
|
58051
|
+
react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("form", { onSubmit: onSubmit, style: formStyle },
|
57855
58052
|
customHeader,
|
57856
58053
|
react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: this.css.container },
|
57857
58054
|
header,
|
@@ -57991,9 +58188,7 @@ var Survey = /** @class */ (function (_super) {
|
|
57991
58188
|
};
|
57992
58189
|
//ISurveyCreator
|
57993
58190
|
Survey.prototype.createQuestionElement = function (question) {
|
57994
|
-
return _reactquestion_factory__WEBPACK_IMPORTED_MODULE_6__["ReactQuestionFactory"].Instance.createQuestion(
|
57995
|
-
? question.getTemplate()
|
57996
|
-
: question.getComponentName(), {
|
58191
|
+
return _reactquestion_factory__WEBPACK_IMPORTED_MODULE_6__["ReactQuestionFactory"].Instance.createQuestion(question.isDefaultRendering() ? question.getTemplate() : question.getComponentName(), {
|
57997
58192
|
question: question,
|
57998
58193
|
isDisplayMode: question.isInputReadOnly,
|
57999
58194
|
creator: this,
|
@@ -63791,6 +63986,11 @@ var SurveyElementCore = /** @class */ (function (_super) {
|
|
63791
63986
|
enumerable: false,
|
63792
63987
|
configurable: true
|
63793
63988
|
});
|
63989
|
+
Object.defineProperty(SurveyElementCore.prototype, "titleAriaRole", {
|
63990
|
+
get: function () { return undefined; },
|
63991
|
+
enumerable: false,
|
63992
|
+
configurable: true
|
63993
|
+
});
|
63794
63994
|
Object.defineProperty(SurveyElementCore.prototype, "ariaLabel", {
|
63795
63995
|
get: function () {
|
63796
63996
|
return this.locTitle.renderedHtml;
|
@@ -64149,6 +64349,15 @@ var SurveyElement = /** @class */ (function (_super) {
|
|
64149
64349
|
enumerable: false,
|
64150
64350
|
configurable: true
|
64151
64351
|
});
|
64352
|
+
Object.defineProperty(SurveyElement.prototype, "titleAriaRole", {
|
64353
|
+
get: function () {
|
64354
|
+
if (this.isPage || this.state === "default")
|
64355
|
+
return undefined;
|
64356
|
+
return "button";
|
64357
|
+
},
|
64358
|
+
enumerable: false,
|
64359
|
+
configurable: true
|
64360
|
+
});
|
64152
64361
|
SurveyElement.prototype.setSurveyImpl = function (value, isLight) {
|
64153
64362
|
this.surveyImplValue = value;
|
64154
64363
|
if (!this.surveyImplValue) {
|
@@ -65337,7 +65546,6 @@ var SurveyModel = /** @class */ (function (_super) {
|
|
65337
65546
|
* For information on event handler parameters, refer to descriptions within the interface.
|
65338
65547
|
*
|
65339
65548
|
* [View Demo](https://surveyjs.io/form-library/examples/file-delayed-upload/ (linkStyle))
|
65340
|
-
* @see clearFiles
|
65341
65549
|
* @see onDownloadFile
|
65342
65550
|
* @see onUploadFiles
|
65343
65551
|
*/
|
@@ -65676,6 +65884,7 @@ var SurveyModel = /** @class */ (function (_super) {
|
|
65676
65884
|
_this.createHtmlLocString("completedBeforeHtml", "completingSurveyBefore", htmlCallBack);
|
65677
65885
|
_this.createHtmlLocString("loadingHtml", "loadingSurvey", htmlCallBack);
|
65678
65886
|
_this.createLocalizableString("logo", _this, false);
|
65887
|
+
_this.createLocalizableString("backgroundImage", _this, false);
|
65679
65888
|
_this.createLocalizableString("startSurveyText", _this, false, true);
|
65680
65889
|
_this.createLocalizableString("pagePrevText", _this, false, true);
|
65681
65890
|
_this.createLocalizableString("pageNextText", _this, false, true);
|
@@ -65726,6 +65935,7 @@ var SurveyModel = /** @class */ (function (_super) {
|
|
65726
65935
|
_this.registerPropertyChangedHandlers(["isLoading", "isCompleted", "isCompletedBefore", "mode", "isStartedState", "currentPage"], function () { _this.updateState(); });
|
65727
65936
|
_this.registerPropertyChangedHandlers(["state", "currentPage", "showPreviewBeforeComplete"], function () { _this.onStateAndCurrentPageChanged(); });
|
65728
65937
|
_this.registerPropertyChangedHandlers(["logo", "logoPosition"], function () { _this.updateHasLogo(); });
|
65938
|
+
_this.registerPropertyChangedHandlers(["backgroundImage"], function () { _this.updateRenderBackgroundImage(); });
|
65729
65939
|
_this.onGetQuestionNo.onCallbacksChanged = function () {
|
65730
65940
|
_this.resetVisibleIndexes();
|
65731
65941
|
};
|
@@ -66117,7 +66327,9 @@ var SurveyModel = /** @class */ (function (_super) {
|
|
66117
66327
|
});
|
66118
66328
|
Object.defineProperty(SurveyModel.prototype, "surveyId", {
|
66119
66329
|
/**
|
66120
|
-
*
|
66330
|
+
* The identifier of a survey JSON schema to load from the [SurveyJS Service](https://api.surveyjs.io).
|
66331
|
+
*
|
66332
|
+
* Refer to the following help topic for more information: [Store Survey Results in the SurveyJS Service](https://surveyjs.io/form-library/documentation/handle-survey-results-store#store-survey-results-in-the-surveyjs-service).
|
66121
66333
|
* @see loadSurveyFromService
|
66122
66334
|
* @see onLoadedSurveyFromService
|
66123
66335
|
*/
|
@@ -66132,7 +66344,9 @@ var SurveyModel = /** @class */ (function (_super) {
|
|
66132
66344
|
});
|
66133
66345
|
Object.defineProperty(SurveyModel.prototype, "surveyPostId", {
|
66134
66346
|
/**
|
66135
|
-
*
|
66347
|
+
* An identifier used to save survey results to the [SurveyJS Service](https://api.surveyjs.io).
|
66348
|
+
*
|
66349
|
+
* Refer to the following help topic for more information: [Store Survey Results in the SurveyJS Service](https://surveyjs.io/form-library/documentation/handle-survey-results-store#store-survey-results-in-the-surveyjs-service).
|
66136
66350
|
* @see onComplete
|
66137
66351
|
* @see surveyShowDataSaving
|
66138
66352
|
*/
|
@@ -66147,9 +66361,10 @@ var SurveyModel = /** @class */ (function (_super) {
|
|
66147
66361
|
});
|
66148
66362
|
Object.defineProperty(SurveyModel.prototype, "clientId", {
|
66149
66363
|
/**
|
66150
|
-
*
|
66151
|
-
*
|
66152
|
-
* On the second run,
|
66364
|
+
* A user identifier (e-mail or other unique ID).
|
66365
|
+
*
|
66366
|
+
* If your application works with the [SurveyJS Service](https://api.surveyjs.io), the ID ensures that users do not pass the same survey twice. On the second run, they will see the [Completed Before page](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#completedBeforeHtml).
|
66367
|
+
* @see cookieName
|
66153
66368
|
*/
|
66154
66369
|
get: function () {
|
66155
66370
|
return this.getPropertyValue("clientId", "");
|
@@ -66162,9 +66377,10 @@ var SurveyModel = /** @class */ (function (_super) {
|
|
66162
66377
|
});
|
66163
66378
|
Object.defineProperty(SurveyModel.prototype, "cookieName", {
|
66164
66379
|
/**
|
66165
|
-
*
|
66166
|
-
*
|
66167
|
-
*
|
66380
|
+
* A cookie name used to save information about survey completion.
|
66381
|
+
*
|
66382
|
+
* When this property has a value, the survey creates a cookie with the specified name on completion. This cookie helps ensure that users do not pass the same survey twice. On the second run, they will see the [Completed Before page](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#completedBeforeHtml).
|
66383
|
+
* @see cliendId
|
66168
66384
|
*/
|
66169
66385
|
get: function () {
|
66170
66386
|
return this.getPropertyValue("cookieName", "");
|
@@ -66606,15 +66822,17 @@ var SurveyModel = /** @class */ (function (_super) {
|
|
66606
66822
|
});
|
66607
66823
|
Object.defineProperty(SurveyModel.prototype, "clearInvisibleValues", {
|
66608
66824
|
/**
|
66609
|
-
*
|
66825
|
+
* Specifies when to remove values of invisible questions from [survey results](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#data).
|
66610
66826
|
*
|
66611
|
-
*
|
66827
|
+
* Possible values:
|
66612
66828
|
*
|
66613
|
-
* - `
|
66614
|
-
* - `onHidden` -
|
66615
|
-
* - `onHiddenContainer` -
|
66616
|
-
* - `
|
66617
|
-
*
|
66829
|
+
* - `"onComplete"` (default) - Clears invisible question values when the survey is complete.
|
66830
|
+
* - `"onHidden"` - Clears a question value when the question becomes invisible. If the question is invisible initially, its value is removed on survey completion.
|
66831
|
+
* - `"onHiddenContainer"` - Clears a question value when the question or its containter (page or panel) becomes invisible. If the question is invisible initially, its value is removed on survey completion.
|
66832
|
+
* - `"none"` - Keeps invisible values in survey results.
|
66833
|
+
* - `true` - Equivalent to `"onComplete"`.
|
66834
|
+
* - `false` - Equivalent to `"none"`.
|
66835
|
+
* @see [Conditional Visibility](https://surveyjs.io/form-library/documentation/design-survey/conditional-logic#conditional-visibility)
|
66618
66836
|
* @see onComplete
|
66619
66837
|
*/
|
66620
66838
|
get: function () {
|
@@ -66631,21 +66849,19 @@ var SurveyModel = /** @class */ (function (_super) {
|
|
66631
66849
|
configurable: true
|
66632
66850
|
});
|
66633
66851
|
/**
|
66634
|
-
*
|
66635
|
-
*
|
66636
|
-
*
|
66637
|
-
*
|
66638
|
-
*
|
66639
|
-
* @
|
66640
|
-
* @see Page.clearIncorrectValues
|
66641
|
-
* @see Panel.clearIncorrectValues
|
66852
|
+
* Removes values that cannot be assigned to a question, for example, choices unlisted in the `choices` array.
|
66853
|
+
*
|
66854
|
+
* Call this method after you assign new question values in code to ensure that they are acceptable.
|
66855
|
+
*
|
66856
|
+
* > This method does not remove values that fail validation. Call the [`validate()`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#validate) method to validate newly assigned values.
|
66857
|
+
* @param removeNonExistingRootKeys Pass `true` to remove values that do not correspond to any question or [calculated value](https://surveyjs.io/form-library/documentation/design-survey/conditional-logic#calculated-values).
|
66642
66858
|
*/
|
66643
|
-
SurveyModel.prototype.clearIncorrectValues = function (
|
66644
|
-
if (
|
66859
|
+
SurveyModel.prototype.clearIncorrectValues = function (removeNonExistingRootKeys) {
|
66860
|
+
if (removeNonExistingRootKeys === void 0) { removeNonExistingRootKeys = false; }
|
66645
66861
|
for (var i = 0; i < this.pages.length; i++) {
|
66646
66862
|
this.pages[i].clearIncorrectValues();
|
66647
66863
|
}
|
66648
|
-
if (!
|
66864
|
+
if (!removeNonExistingRootKeys)
|
66649
66865
|
return;
|
66650
66866
|
var data = this.data;
|
66651
66867
|
var hasChanges = false;
|
@@ -66672,7 +66888,7 @@ var SurveyModel = /** @class */ (function (_super) {
|
|
66672
66888
|
};
|
66673
66889
|
Object.defineProperty(SurveyModel.prototype, "keepIncorrectValues", {
|
66674
66890
|
/**
|
66675
|
-
* Specifies whether to keep values that cannot be assigned to questions, for example, choices unlisted in the choices array.
|
66891
|
+
* Specifies whether to keep values that cannot be assigned to questions, for example, choices unlisted in the `choices` array.
|
66676
66892
|
*
|
66677
66893
|
* > This property cannot be specified in the survey JSON schema. Use dot notation to specify it.
|
66678
66894
|
* @see clearIncorrectValues
|
@@ -67019,14 +67235,63 @@ var SurveyModel = /** @class */ (function (_super) {
|
|
67019
67235
|
enumerable: false,
|
67020
67236
|
configurable: true
|
67021
67237
|
});
|
67238
|
+
Object.defineProperty(SurveyModel.prototype, "backgroundImage", {
|
67239
|
+
/**
|
67240
|
+
* An image to display in the background of the survey or form. Accepts a base64 or URL string value.
|
67241
|
+
* @see backgroundOpacity
|
67242
|
+
*/
|
67243
|
+
get: function () {
|
67244
|
+
return this.getLocalizableStringText("backgroundImage");
|
67245
|
+
},
|
67246
|
+
set: function (value) {
|
67247
|
+
this.setLocalizableStringText("backgroundImage", value);
|
67248
|
+
},
|
67249
|
+
enumerable: false,
|
67250
|
+
configurable: true
|
67251
|
+
});
|
67252
|
+
Object.defineProperty(SurveyModel.prototype, "locBackgroundImage", {
|
67253
|
+
get: function () {
|
67254
|
+
return this.getLocalizableString("backgroundImage");
|
67255
|
+
},
|
67256
|
+
enumerable: false,
|
67257
|
+
configurable: true
|
67258
|
+
});
|
67259
|
+
SurveyModel.prototype.updateRenderBackgroundImage = function () {
|
67260
|
+
this.renderBackgroundImage = ["url(", this.getLocalizableString("backgroundImage").renderedHtml, ")"].join("");
|
67261
|
+
};
|
67262
|
+
Object.defineProperty(SurveyModel.prototype, "backgroundOpacity", {
|
67263
|
+
/**
|
67264
|
+
* A value from 0 to 1 that specifies how transparent the survey background should be: 0 makes the background completely transparent, and 1 makes it opaque.
|
67265
|
+
* @see backgroundImage
|
67266
|
+
*/
|
67267
|
+
get: function () {
|
67268
|
+
return this.getPropertyValue("backgroundOpacity");
|
67269
|
+
},
|
67270
|
+
set: function (val) {
|
67271
|
+
this.setPropertyValue("backgroundOpacity", val);
|
67272
|
+
},
|
67273
|
+
enumerable: false,
|
67274
|
+
configurable: true
|
67275
|
+
});
|
67276
|
+
Object.defineProperty(SurveyModel.prototype, "renderBackgroundOpacity", {
|
67277
|
+
get: function () {
|
67278
|
+
var backgroundOpacityProperty = this.getPropertyByName("backgroundOpacity");
|
67279
|
+
if (backgroundOpacityProperty.isDefaultValue(this.backgroundOpacity)) {
|
67280
|
+
return "";
|
67281
|
+
}
|
67282
|
+
var alpha = 1 - this.backgroundOpacity;
|
67283
|
+
return ["rgba(255, 255, 255, ", alpha, ")"].join("");
|
67284
|
+
},
|
67285
|
+
enumerable: false,
|
67286
|
+
configurable: true
|
67287
|
+
});
|
67022
67288
|
Object.defineProperty(SurveyModel.prototype, "completedHtml", {
|
67023
67289
|
/**
|
67024
|
-
*
|
67290
|
+
* HTML content displayed on the [complete page](https://surveyjs.io/form-library/documentation/design-survey/create-a-multi-page-survey#complete-page).
|
67291
|
+
*
|
67292
|
+
* [View Demo](https://surveyjs.io/form-library/examples/modify-survey-navigation-settings/ (linkStyle))
|
67025
67293
|
* @see showCompletedPage
|
67026
67294
|
* @see completedHtmlOnCondition
|
67027
|
-
* @see locale
|
67028
|
-
*
|
67029
|
-
* [View Demo](https://surveyjs.io/form-library/examples/survey-options/ (linkStyle))
|
67030
67295
|
*/
|
67031
67296
|
get: function () {
|
67032
67297
|
return this.getLocalizableStringText("completedHtml");
|
@@ -67046,9 +67311,11 @@ var SurveyModel = /** @class */ (function (_super) {
|
|
67046
67311
|
});
|
67047
67312
|
Object.defineProperty(SurveyModel.prototype, "completedHtmlOnCondition", {
|
67048
67313
|
/**
|
67049
|
-
*
|
67050
|
-
*
|
67051
|
-
*
|
67314
|
+
* An array of objects that allows you to specify different HTML content for the [complete page](https://surveyjs.io/form-library/documentation/design-survey/create-a-multi-page-survey#complete-page).
|
67315
|
+
*
|
67316
|
+
* Each object should include the [`expression`](https://surveyjs.io/form-library/documentation/api-reference/htmlconditionitem#expression) and [`html`](https://surveyjs.io/form-library/documentation/api-reference/htmlconditionitem#html) properties. When `expression` evaluates to `true`, the survey uses the corresponding HTML markup instead of [`completedHtml`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#completedHtml). Refer to the following help topic for more information about expressions: [Expressions](https://surveyjs.io/form-library/documentation/design-survey/conditional-logic#expressions).
|
67317
|
+
*
|
67318
|
+
* [View Demo](https://surveyjs.io/form-library/examples/nps-question/ (linkStyle))
|
67052
67319
|
*/
|
67053
67320
|
get: function () {
|
67054
67321
|
return this.getPropertyValue("completedHtmlOnCondition");
|
@@ -67109,9 +67376,10 @@ var SurveyModel = /** @class */ (function (_super) {
|
|
67109
67376
|
};
|
67110
67377
|
Object.defineProperty(SurveyModel.prototype, "completedBeforeHtml", {
|
67111
67378
|
/**
|
67112
|
-
*
|
67379
|
+
* HTML content displayed to a user who has completed the survey before.
|
67113
67380
|
* @see clientId
|
67114
|
-
* @see
|
67381
|
+
* @see cookieName
|
67382
|
+
* @see processedCompletedBeforeHtml
|
67115
67383
|
*/
|
67116
67384
|
get: function () {
|
67117
67385
|
return this.getLocalizableStringText("completedBeforeHtml");
|
@@ -67131,9 +67399,9 @@ var SurveyModel = /** @class */ (function (_super) {
|
|
67131
67399
|
});
|
67132
67400
|
Object.defineProperty(SurveyModel.prototype, "loadingHtml", {
|
67133
67401
|
/**
|
67134
|
-
*
|
67402
|
+
* HTML content displayed while a survey JSON schema is being loaded from the [SurveyJS Service](https://api.surveyjs.io).
|
67135
67403
|
* @see surveyId
|
67136
|
-
* @see
|
67404
|
+
* @see processedLoadingHtml
|
67137
67405
|
*/
|
67138
67406
|
get: function () {
|
67139
67407
|
return this.getLocalizableStringText("loadingHtml");
|
@@ -67152,10 +67420,6 @@ var SurveyModel = /** @class */ (function (_super) {
|
|
67152
67420
|
configurable: true
|
67153
67421
|
});
|
67154
67422
|
Object.defineProperty(SurveyModel.prototype, "defaultLoadingHtml", {
|
67155
|
-
/**
|
67156
|
-
* Default value for loadingHtml property
|
67157
|
-
* @see loadingHtml
|
67158
|
-
*/
|
67159
67423
|
get: function () {
|
67160
67424
|
return "<h3>" + this.getLocalizationString("loadingSurvey") + "</h3>";
|
67161
67425
|
},
|
@@ -67992,8 +68256,9 @@ var SurveyModel = /** @class */ (function (_super) {
|
|
67992
68256
|
};
|
67993
68257
|
Object.defineProperty(SurveyModel.prototype, "comments", {
|
67994
68258
|
/**
|
67995
|
-
*
|
67996
|
-
* @see
|
68259
|
+
* An object with all comment values.
|
68260
|
+
* @see Question.showCommentArea
|
68261
|
+
* @see storeOthersAsComment
|
67997
68262
|
*/
|
67998
68263
|
get: function () {
|
67999
68264
|
var result = {};
|
@@ -68454,14 +68719,9 @@ var SurveyModel = /** @class */ (function (_super) {
|
|
68454
68719
|
page.updateCustomWidgets();
|
68455
68720
|
};
|
68456
68721
|
SurveyModel.prototype.currentPageChanging = function (newValue, oldValue) {
|
68457
|
-
var options =
|
68458
|
-
|
68459
|
-
|
68460
|
-
allowChanging: true,
|
68461
|
-
allow: true,
|
68462
|
-
isNextPage: this.isNextPage(newValue, oldValue),
|
68463
|
-
isPrevPage: this.isPrevPage(newValue, oldValue),
|
68464
|
-
};
|
68722
|
+
var options = this.createPageChangeEventOptions(newValue, oldValue);
|
68723
|
+
options.allow = true;
|
68724
|
+
options.allowChanging = true;
|
68465
68725
|
this.onCurrentPageChanging.fire(this, options);
|
68466
68726
|
var allow = options.allowChanging && options.allow;
|
68467
68727
|
if (allow) {
|
@@ -68470,26 +68730,22 @@ var SurveyModel = /** @class */ (function (_super) {
|
|
68470
68730
|
return allow;
|
68471
68731
|
};
|
68472
68732
|
SurveyModel.prototype.currentPageChanged = function (newValue, oldValue) {
|
68473
|
-
var
|
68474
|
-
if (isNextPage) {
|
68733
|
+
var options = this.createPageChangeEventOptions(newValue, oldValue);
|
68734
|
+
if (options.isNextPage) {
|
68475
68735
|
oldValue.passed = true;
|
68476
68736
|
}
|
68477
|
-
this.onCurrentPageChanged.fire(this,
|
68737
|
+
this.onCurrentPageChanged.fire(this, options);
|
68738
|
+
};
|
68739
|
+
SurveyModel.prototype.createPageChangeEventOptions = function (newValue, oldValue) {
|
68740
|
+
var diff = !!newValue && !!oldValue ? newValue.visibleIndex - oldValue.visibleIndex : 0;
|
68741
|
+
return {
|
68478
68742
|
oldCurrentPage: oldValue,
|
68479
68743
|
newCurrentPage: newValue,
|
68480
|
-
isNextPage:
|
68481
|
-
isPrevPage:
|
68482
|
-
|
68483
|
-
|
68484
|
-
|
68485
|
-
if (!newValue || !oldValue)
|
68486
|
-
return false;
|
68487
|
-
return newValue.visibleIndex == oldValue.visibleIndex + 1;
|
68488
|
-
};
|
68489
|
-
SurveyModel.prototype.isPrevPage = function (newValue, oldValue) {
|
68490
|
-
if (!newValue || !oldValue)
|
68491
|
-
return false;
|
68492
|
-
return newValue.visibleIndex + 1 == oldValue.visibleIndex;
|
68744
|
+
isNextPage: diff === 1,
|
68745
|
+
isPrevPage: diff === -1,
|
68746
|
+
isGoingForward: diff > 0,
|
68747
|
+
isGoingBackward: diff < 0
|
68748
|
+
};
|
68493
68749
|
};
|
68494
68750
|
/**
|
68495
68751
|
* Returns the progress that a user made while going through the survey.
|
@@ -69034,11 +69290,11 @@ var SurveyModel = /** @class */ (function (_super) {
|
|
69034
69290
|
return true;
|
69035
69291
|
};
|
69036
69292
|
/**
|
69037
|
-
* Completes the survey
|
69038
|
-
*
|
69293
|
+
* Completes the survey if it currently displays the last page and the page contains no validation errors. If both these conditions are met, this method returns `true`; otherwise, `false`.
|
69294
|
+
*
|
69295
|
+
* If you want to complete the survey regardless of the current page and validation errors, use the [`doComplete()`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#completeLastPage) event.
|
69039
69296
|
* @see isCurrentPageValid
|
69040
69297
|
* @see nextPage
|
69041
|
-
* @see doComplete
|
69042
69298
|
*/
|
69043
69299
|
SurveyModel.prototype.completeLastPage = function () {
|
69044
69300
|
var res = this.doCurrentPageComplete(true);
|
@@ -69444,26 +69700,19 @@ var SurveyModel = /** @class */ (function (_super) {
|
|
69444
69700
|
/**
|
69445
69701
|
* Completes the survey.
|
69446
69702
|
*
|
69447
|
-
*
|
69703
|
+
* When you call this method, Form Library performs the following actions:
|
69448
69704
|
*
|
69449
|
-
*
|
69450
|
-
*
|
69451
|
-
*
|
69452
|
-
* -
|
69705
|
+
* 1. Saves a cookie if the [`cookieName`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#cookieName) property is set.
|
69706
|
+
* 1. Switches the survey [`state`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#state) to `"completed"`.
|
69707
|
+
* 1. Raises the [`onComplete`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onComplete) event.
|
69708
|
+
* 1. Navigates the user to a URL specified by the [`navigateToUrl`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#navigateToUrl) or [`navigateToUrlOnCondition`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#navigateToUrlOnCondition) property.
|
69709
|
+
* 1. Calls the [`sendResult()`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#sendResult) method if Form Library works with the [SurveyJS Service](https://api.surveyjs.io/).
|
69453
69710
|
*
|
69454
|
-
*
|
69455
|
-
*
|
69456
|
-
*
|
69457
|
-
*
|
69458
|
-
* @see completeLastPage
|
69459
|
-
* @see onCompleting
|
69460
|
-
* @see cookieName
|
69461
|
-
* @see state
|
69462
|
-
* @see onComplete
|
69711
|
+
* The `doComplete()` method completes the survey regardless of validation errors and the current page. If you need to ensure that survey results are valid and full, call the [`completeLastPage()`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#completeLastPage) method instead.
|
69712
|
+
*
|
69713
|
+
* @param isCompleteOnTrigger For internal use.
|
69714
|
+
* @returns `false` if survey completion is cancelled within the [`onCompleting`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onCompleting) event handler; otherwise, `true`.
|
69463
69715
|
* @see surveyPostId
|
69464
|
-
* @see completeLastPage
|
69465
|
-
* @see navigateToUrl
|
69466
|
-
* @see navigateToUrlOnCondition
|
69467
69716
|
*/
|
69468
69717
|
SurveyModel.prototype.doComplete = function (isCompleteOnTrigger) {
|
69469
69718
|
if (isCompleteOnTrigger === void 0) { isCompleteOnTrigger = false; }
|
@@ -70181,13 +70430,6 @@ var SurveyModel = /** @class */ (function (_super) {
|
|
70181
70430
|
callback: callback,
|
70182
70431
|
});
|
70183
70432
|
};
|
70184
|
-
/**
|
70185
|
-
* Clears files from server.
|
70186
|
-
* @param question question
|
70187
|
-
* @param name question name
|
70188
|
-
* @param value file question value
|
70189
|
-
* @param callback call back function to get the status of the clearing operation
|
70190
|
-
*/
|
70191
70433
|
SurveyModel.prototype.clearFiles = function (question, name, value, fileName, callback) {
|
70192
70434
|
if (this.onClearFiles.isEmpty) {
|
70193
70435
|
!!callback && callback("success", value);
|
@@ -70946,6 +71188,7 @@ var SurveyModel = /** @class */ (function (_super) {
|
|
70946
71188
|
this.isEndLoadingFromJson = null;
|
70947
71189
|
this.updateVisibleIndexes();
|
70948
71190
|
this.updateHasLogo();
|
71191
|
+
this.updateRenderBackgroundImage();
|
70949
71192
|
this.updateCurrentPage();
|
70950
71193
|
this.hasDescription = !!this.description;
|
70951
71194
|
this.setCalculatedWidthModeUpdater();
|
@@ -71423,8 +71666,11 @@ var SurveyModel = /** @class */ (function (_super) {
|
|
71423
71666
|
};
|
71424
71667
|
Object.defineProperty(SurveyModel.prototype, "clearValueOnDisableItems", {
|
71425
71668
|
/**
|
71426
|
-
*
|
71427
|
-
*
|
71669
|
+
* Specifies whether to remove disabled choices from the value in [Dropdown](https://surveyjs.io/form-library/documentation/api-reference/dropdown-menu-model), [Checkboxes](https://surveyjs.io/form-library/documentation/api-reference/checkbox-question-model), and [Radio Button Group](https://surveyjs.io/form-library/documentation/api-reference/radio-button-question-model) questions.
|
71670
|
+
*
|
71671
|
+
* Default value: `false`
|
71672
|
+
*
|
71673
|
+
* > This property cannot be specified in the survey JSON schema. Use dot notation to specify it.
|
71428
71674
|
*/
|
71429
71675
|
get: function () {
|
71430
71676
|
return this.getPropertyValue("clearValueOnDisableItems", false);
|
@@ -72339,6 +72585,9 @@ var SurveyModel = /** @class */ (function (_super) {
|
|
72339
72585
|
__decorate([
|
72340
72586
|
Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])()
|
72341
72587
|
], SurveyModel.prototype, "_isMobile", void 0);
|
72588
|
+
__decorate([
|
72589
|
+
Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])()
|
72590
|
+
], SurveyModel.prototype, "renderBackgroundImage", void 0);
|
72342
72591
|
__decorate([
|
72343
72592
|
Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])()
|
72344
72593
|
], SurveyModel.prototype, "rootCss", void 0);
|
@@ -72584,6 +72833,8 @@ _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("survey", [
|
|
72584
72833
|
choices: ["auto", "static", "responsive"],
|
72585
72834
|
},
|
72586
72835
|
"width",
|
72836
|
+
{ name: "backgroundImage", serializationProperty: "locBackgroundImage", visible: false },
|
72837
|
+
{ name: "backgroundOpacity:number", minValue: 0, maxValue: 1, default: 1, visible: false },
|
72587
72838
|
{ name: "showBrandInfo:boolean", default: false, visible: false }
|
72588
72839
|
]);
|
72589
72840
|
|