` element with a non-editable question value within it.
*
* - `textRenderMode`: `"input"` (default) | `"div"`\
* Specifies how to render the input field of [Text](https://surveyjs.io/form-library/documentation/api-reference/text-entry-question-model) questions in [read-only](https://surveyjs.io/form-library/documentation/api-reference/text-entry-question-model#readOnly) mode: as a disabled `
` element with a non-editable question value within it.
*/
readOnly: {
enableValidation: false,
commentRenderMode: "textarea",
textRenderMode: "input"
},
//#region readOnly section, Obsolete properties
get readOnlyCommentRenderMode() { return this.readOnly.commentRenderMode; },
set readOnlyCommentRenderMode(val) { this.readOnly.commentRenderMode = val; },
get readOnlyTextRenderMode() { return this.readOnly.textRenderMode; },
set readOnlyTextRenderMode(val) { this.readOnly.textRenderMode = val; },
//#endregion
/**
* An object with properties that configure question numbering.
*
* Nested properties:
*
* - `includeQuestionsWithHiddenNumber`: `boolean`\
* Specifies whether to number questions whose [`hideNumber`](https://surveyjs.io/form-library/documentation/api-reference/question#hideNumber) property is enabled. Default value: `false`.
*
* - `includeQuestionsWithHiddenTitle`: `boolean`\
* Specifies whether to number questions whose [`titleLocation`](https://surveyjs.io/form-library/documentation/api-reference/question#titleLocation) property is set to `"hidden"`. Default value: `false`.
*/
numbering: {
includeQuestionsWithHiddenNumber: false,
includeQuestionsWithHiddenTitle: false
},
//#region numbering section, Obsolete properties
get setQuestionVisibleIndexForHiddenTitle() { return this.numbering.includeQuestionsWithHiddenTitle; },
set setQuestionVisibleIndexForHiddenTitle(val) { this.numbering.includeQuestionsWithHiddenTitle = val; },
get setQuestionVisibleIndexForHiddenNumber() { return this.numbering.includeQuestionsWithHiddenNumber; },
set setQuestionVisibleIndexForHiddenNumber(val) { this.numbering.includeQuestionsWithHiddenNumber = val; },
//#endregion
/**
* Specifies an action to perform when users press the Enter key within a survey.
*
* Possible values:
*
* - `"moveToNextEditor"` - Moves focus to the next editor.
* - `"loseFocus"` - Removes focus from the current editor.
* - `"default"` - Behaves as a standard `
` element.
*/
enterKeyAction: "default",
/**
* An object that configures string comparison.
*
* Nested properties:
*
* - `trimStrings`: `boolean`\
* Specifies whether to remove whitespace from both ends of a string before the comparison. Default value: `true`.
*
* - `caseSensitive`: `boolean`\
* Specifies whether to differentiate between capital and lower-case letters. Default value: `false`.
*/
comparator: {
trimStrings: true,
caseSensitive: false,
normalizeTextCallback: function (str, reason) { return str; }
},
expressionDisableConversionChar: "#",
get commentPrefix() { return settings.commentSuffix; },
set commentPrefix(val) { settings.commentSuffix = val; },
/**
* A suffix added to the name of the property that stores comments.
*
* Default value: "-Comment"
*
* You can specify this setting for an individual survey: [`commentSuffix`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#commentSuffix).
*/
commentSuffix: "-Comment",
/**
* A separator used in a shorthand notation that specifies a value and display text for an [`ItemValue`](https://surveyjs.io/form-library/documentation/api-reference/itemvalue) object: `"value|text"`.
*
* Default value: `"|"`
* @see [settings.choicesSeparator](https://surveyjs.io/form-library/documentation/api-reference/settings#choicesSeparator)
*/
itemValueSeparator: "|",
/**
* A maximum number of rate values in a [Rating](https://surveyjs.io/form-library/documentation/api-reference/rating-scale-question-model) question.
*
* Default value: 20
*/
ratingMaximumRateValueCount: 20,
/**
* Specifies whether to close the drop-down menu of a [Multi-Select Dropdown (Tag Box)](https://surveyjs.io/form-library/examples/how-to-create-multiselect-tag-box/) question after a user selects a value.
*
* This setting applies to all Multi-Select Dropdown questions on a web page. You can use the [`closeOnSelect`](https://surveyjs.io/form-library/documentation/api-reference/dropdown-tag-box-model#closeOnSelect) property to specify the same setting for an individual Multi-Select Dropdown question.
*/
tagboxCloseOnSelect: false,
/**
* A time interval in milliseconds between the last entered character and the beginning of search in [Single-](https://surveyjs.io/form-library/examples/create-dropdown-menu-in-javascript/) and [Multi-Select Dropdown](https://surveyjs.io/form-library/examples/how-to-create-multiselect-tag-box/) questions. Applies only to questions with the [`choicesLazyLoadEnabled`](https://surveyjs.io/form-library/documentation/api-reference/dropdown-menu-model#choicesLazyLoadEnabled) property set to `true`.
*
* Default value: 500
*
* [View Demo](https://surveyjs.io/form-library/examples/lazy-loading-dropdown/ (linkStyle))
*/
dropdownSearchDelay: 500,
/**
* A function that activates a browser confirm dialog.
*
* Use the following code to execute this function:
*
* ```js
* import { settings } from "survey-core";
*
* // `result` contains `true` if the action was confirmed or `false` otherwise
* const result = settings.confirmActionFunc("Are you sure?");
* ```
*
* You can redefine the `confirmActionFunc` function if you want to display a custom dialog window. Your function should return `true` if a user confirms an action or `false` otherwise.
* @param message A message to be displayed in the confirm dialog window.
*/
confirmActionFunc: function (message) {
return confirm(message);
},
/**
* A function that activates a proprietary SurveyJS confirm dialog.
*
* Use the following code to execute this function:
*
* ```js
* import { settings } from "survey-core";
*
* settings.confirmActionAsync("Are you sure?", (confirmed) => {
* if (confirmed) {
* // ...
* // Proceed with the action
* // ...
* } else {
* // ...
* // Cancel the action
* // ...
* }
* });
* ```
*
* You can redefine the `confirmActionAsync` function if you want to display a custom dialog window. Your function should return `true` to be enabled; otherwise, a survey executes the [`confirmActionFunc`](#confirmActionFunc) function. Pass the dialog result as the `callback` parameter: `true` if a user confirms an action, `false` otherwise.
* @param message A message to be displayed in the confirm dialog window.
* @param callback A callback function that should be called with `true` if a user confirms an action or `false` otherwise.
*/
confirmActionAsync: function (message, callback, applyTitle, locale, rootElement) {
return Object(_utils_utils__WEBPACK_IMPORTED_MODULE_1__["showConfirmDialog"])(message, callback, applyTitle, locale, rootElement);
},
/**
* A minimum width value for all survey elements.
*
* Default value: `"300px"`
*
* You can override this setting for individual elements: [`minWidth`](https://surveyjs.io/form-library/documentation/api-reference/surveyelement#minWidth).
*/
minWidth: "300px",
/**
* A maximum width value for all survey elements.
*
* Default value: `"100%"`
*
* You can override this setting for individual elements: [`maxWidth`](https://surveyjs.io/form-library/documentation/api-reference/surveyelement#maxWidth).
*/
maxWidth: "100%",
/**
* Specifies how many times surveys can re-evaluate expressions when a question value changes. This limit helps avoid recursions in expressions.
*
* Default value: 10
*/
maxConditionRunCountOnValueChanged: 10,
/**
* An object that configures notifications.
*
* Nested properties:
*
* - `lifetime`: `number`\
* Specifies a time period during which a notification is displayed; measured in milliseconds.
*/
notifications: {
lifetime: 2000
},
/**
* Specifies how many milliseconds a survey should wait before it automatically switches to the next page. Applies only when [auto-advance](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#goNextPageAutomatic) is enabled.
*
* Default value: 300
*/
autoAdvanceDelay: 300,
/**
* Specifies the direction in which to lay out Checkbox and Radiogroup items. This setting affects the resulting UI when items are arranged in [more than one column](https://surveyjs.io/form-library/documentation/api-reference/checkbox-question-model#colCount).
*
* Possible values:
*
* - `"row"` (default) - Items fill the current row, then move on to the next row.
* - `"column"` - Items fill the current column, then move on to the next column.
*/
showItemsInOrder: "default",
/**
* A value to save in survey results when respondents select the "None" choice item.
*
* Default value: `"none"`
*/
noneItemValue: "none",
/**
* A value to save in survey results when respondents select the "Refuse to answer" choice item.
*
* Default value: `"refused"`
*/
refuseItemValue: "refused",
/**
* A value to save in survey results when respondents select the "Don't know" choice item.
*
* Default value: `"dontknow"`
*/
dontKnowItemValue: "dontknow",
/**
* An object whose properties specify the order of the special choice items ("None", "Other", "Select All", "Refuse to answer", "Don't know") in select-based questions.
*
* Default value: `{ selectAllItem: [-1], noneItem: [1], otherItem: [2], dontKnowItem: [3], otherItem: [4] }`
*
* Use this object to reorder special choices. Each property accepts an array of integer numbers. Negative numbers place a special choice item above regular choice items, positive numbers place it below them. For instance, the code below specifies the following order of choices: None, Select All, regular choices, Other.
*
* ```js
* import { settings } from "survey-core";
*
* settings.specialChoicesOrder.noneItem = [-2];
* settings.specialChoicesOrder.selectAllItem = [-1];
* settings.specialChoicesOrder.otherItem = [1];
* ```
*
* If you want to duplicate a special choice item above and below other choices, add two numbers to the corresponding array:
*
* ```js
* settings.specialChoicesOrder.selectAllItem = [-1, 3] // Displays Select All above and below other choices
* ```
*/
specialChoicesOrder: {
selectAllItem: [-1],
noneItem: [1],
refuseItem: [2],
dontKnowItem: [3],
otherItem: [4]
},
/**
* One or several characters used to separate choice options in a list.
*
* Default value: `", "`
* @see [settings.itemValueSeparator](https://surveyjs.io/form-library/documentation/api-reference/settings#itemValueSeparator)
*/
choicesSeparator: ", ",
/**
* A list of supported validators by question type.
*/
supportedValidators: {
question: ["expression"],
comment: ["text", "regex"],
text: ["numeric", "text", "regex", "email"],
checkbox: ["answercount"],
imagepicker: ["answercount"],
},
/**
* Specifies a minimum date that users can enter into a [Text](https://surveyjs.io/form-library/documentation/api-reference/text-entry-question-model) question with [`inputType`](https://surveyjs.io/form-library/documentation/api-reference/text-entry-question-model#inputType) set to `"date"` or `"datetime-local"`. Set this property to a string with the folllowing format: `"yyyy-mm-dd"`.
*/
minDate: "",
/**
* Specifies a maximum date that users can enter into a [Text](https://surveyjs.io/form-library/documentation/api-reference/text-entry-question-model) question with [`inputType`](https://surveyjs.io/form-library/documentation/api-reference/text-entry-question-model#inputType) set to `"date"` or `"datetime-local"`. Set this property to a string with the folllowing format: `"yyyy-mm-dd"`.
*/
maxDate: "",
showModal: undefined,
showDialog: undefined,
supportCreatorV2: false,
showDefaultItemsInCreatorV2: true,
/**
* An object that specifies icon replacements. Object keys are built-in icon names. To use a custom icon, assign its name to the key of the icon you want to replace:
*
* ```js
* import { settings } from "survey-core";
*
* settings.customIcons["icon-redo"] = "custom-redo-icon";
* ```
*
* For more information about icons in SurveyJS, refer to the following help topic: [UI Icons](https://surveyjs.io/form-library/documentation/icons).
*/
customIcons: {},
/**
* Specifies which part of a choice item responds to a drag gesture in Ranking questions.
*
* Possible values:
*
* - `"entireItem"` (default) - Users can use the entire choice item as a drag handle.
* - `"icon"` - Users can only use the choice item icon as a drag handle.
*/
rankingDragHandleArea: "entireItem",
environment: defaultEnvironment,
/**
* Allows you to hide the maximum length indicator in text input questions.
*
* If you specify a question's [`maxLength`](https://surveyjs.io/form-library/documentation/api-reference/text-entry-question-model#maxLength) property or a survey's [`maxTextLength`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#maxTextLength) property, text input questions indicate the number of entered characters and the character limit. Assign `false` to the `settings.showMaxLengthIndicator` property if you want to hide this indicator.
*
* Default value: `true`
*/
showMaxLengthIndicator: true,
/**
* Specifies whether to animate survey elements.
*
* Default value: `true`
*/
animationEnabled: true,
/**
* An object that specifies heading levels (`
`, ``, etc.) to use when rendering survey, page, panel, and question titles.
*
* Default value: `{ survey: "h3", page: "h4", panel: "h4", question: "h5" }`
*
* If you want to modify heading levels for individual titles, handle `SurveyModel`'s [`onGetTitleTagName`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onGetTitleTagName) event.
*/
titleTags: {
survey: "h3",
page: "h4",
panel: "h4",
question: "h5",
},
questions: {
inputTypes: [
"color",
"date",
"datetime-local",
"email",
"month",
"number",
"password",
"range",
"tel",
"text",
"time",
"url",
"week",
],
dataList: [
"",
"name",
"honorific-prefix",
"given-name",
"additional-name",
"family-name",
"honorific-suffix",
"nickname",
"organization-title",
"username",
"new-password",
"current-password",
"organization",
"street-address",
"address-line1",
"address-line2",
"address-line3",
"address-level4",
"address-level3",
"address-level2",
"address-level1",
"country",
"country-name",
"postal-code",
"cc-name",
"cc-given-name",
"cc-additional-name",
"cc-family-name",
"cc-number",
"cc-exp",
"cc-exp-month",
"cc-exp-year",
"cc-csc",
"cc-type",
"transaction-currency",
"transaction-amount",
"language",
"bday",
"bday-day",
"bday-month",
"bday-year",
"sex",
"url",
"photo",
"tel",
"tel-country-code",
"tel-national",
"tel-area-code",
"tel-local",
"tel-local-prefix",
"tel-local-suffix",
"tel-extension",
"email",
"impp",
]
},
legacyProgressBarView: false,
/**
* An object with properties that configure input masks.
*
* Nested properties:
*
* - `patternPlaceholderChar`: `string`\
* A symbol used as a placeholder for characters to be entered in [pattern masks](https://surveyjs.io/form-library/documentation/api-reference/inputmaskpattern). Default value: `"_"`.
*
* - `patternEscapeChar`: `string`\
* A symbol used to insert literal representations of special characters in [pattern masks](https://surveyjs.io/form-library/documentation/api-reference/inputmaskpattern). Default value: `"\\"`.
*
* - `patternDefinitions`: `<{ [key: string]: RegExp }>`\
* An object that maps placeholder symbols to regular expressions in [pattern masks](https://surveyjs.io/form-library/documentation/api-reference/inputmaskpattern). Default value: `{ "9": /[0-9]/, "a": /[a-zA-Z]/, "#": /[a-zA-Z0-9]/ }`.
*/
maskSettings: {
patternPlaceholderChar: "_",
patternEscapeChar: "\\",
patternDefinitions: {
"9": /[0-9]/,
"a": /[a-zA-Z]/,
"#": /[a-zA-Z0-9]/
}
},
/**
* Specifies whether to store date-time values in the following format: `"YYYY-MM-DDThh:mm:ss.sssZ"`. Applies only to form fields with [`inputType`](https://surveyjs.io/form-library/documentation/api-reference/text-entry-question-model#inputType) set to `"datetime-local"`.
*
* Default value: `false`
*
* If you enable this setting, date-time values are converted from local time to UTC when they are saved to the survey's [`data`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#data) object, while the question values remain in local time. Therefore, when you specify default values using a question's [`defaultValue`](https://surveyjs.io/form-library/documentation/api-reference/text-entry-question-model#defaultValue) property, you need to use local time, but if you specify them using the `data` object, use a UTC date-time value in the following format: `"YYYY-MM-DDThh:mm:ss.sssZ"`.
*
* ```js
* const surveyJson = {
* "elements": [{
* "name": "datetime",
* "type": "text",
* "title": "Select a date and time",
* "inputType": "datetime-local",
* "defaultValue": "2024-07-16T12:15:00" // Local date-time value
* }]
* }
* ```
*
* ```js
* import { Model } from "survey-core";
* const surveyJson = { ... }
* const survey = new Model(surveyJson);
*
* survey.data = {
* datetime: "2024-07-16T12:15:00.000Z" // UTC date-time value
* }
* ```
*/
storeUtcDates: false
};
/***/ }),
/***/ "./src/stylesmanager.ts":
/*!******************************!*\
!*** ./src/stylesmanager.ts ***!
\******************************/
/*! exports provided: modernThemeColors, defaultThemeColors, orangeThemeColors, darkblueThemeColors, darkroseThemeColors, stoneThemeColors, winterThemeColors, winterstoneThemeColors, StylesManager */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "modernThemeColors", function() { return modernThemeColors; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultThemeColors", function() { return defaultThemeColors; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "orangeThemeColors", function() { return orangeThemeColors; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "darkblueThemeColors", function() { return darkblueThemeColors; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "darkroseThemeColors", function() { return darkroseThemeColors; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "stoneThemeColors", function() { return stoneThemeColors; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "winterThemeColors", function() { return winterThemeColors; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "winterstoneThemeColors", function() { return winterstoneThemeColors; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StylesManager", function() { return StylesManager; });
/* harmony import */ var _defaultCss_defaultV2Css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./defaultCss/defaultV2Css */ "./src/defaultCss/defaultV2Css.ts");
/* harmony import */ var _global_variables_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./global_variables_utils */ "./src/global_variables_utils.ts");
/* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./settings */ "./src/settings.ts");
/* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils/utils */ "./src/utils/utils.ts");
var modernThemeColors = {
"$main-color": "#1ab394",
"$add-button-color": "#1948b3",
"$remove-button-color": "#ff1800",
"$disable-color": "#dbdbdb",
"$progress-text-color": "#9d9d9d",
"$disabled-label-color": "rgba(64, 64, 64, 0.5)",
"$slider-color": "white",
"$disabled-slider-color": "#cfcfcf",
"$error-color": "#d52901",
"$text-color": "#404040",
"$light-text-color": "#fff",
"$checkmark-color": "#fff",
"$progress-buttons-color": "#8dd9ca",
"$inputs-background-color": "transparent",
"$main-hover-color": "#9f9f9f",
"$body-container-background-color": "#f4f4f4",
"$text-border-color": "#d4d4d4",
"$disabled-text-color": "rgba(64, 64, 64, 0.5)",
"$border-color": "rgb(64, 64, 64, 0.5)",
"$header-background-color": "#e7e7e7",
"$answer-background-color": "rgba(26, 179, 148, 0.2)",
"$error-background-color": "rgba(213, 41, 1, 0.2)",
"$radio-checked-color": "#404040",
"$clean-button-color": "#1948b3",
"$body-background-color": "#ffffff",
"$foreground-light": "#909090",
"$font-family": "Raleway",
};
var defaultThemeColors = {
"$header-background-color": "#e7e7e7",
"$body-container-background-color": "#f4f4f4",
"$main-color": "#1ab394",
"$main-hover-color": "#0aa384",
"$body-background-color": "white",
"$inputs-background-color": "white",
"$text-color": "#6d7072",
"$text-input-color": "#6d7072",
"$header-color": "#6d7072",
"$border-color": "#e7e7e7",
"$error-color": "#ed5565",
"$error-background-color": "#fcdfe2",
"$progress-text-color": "#9d9d9d",
"$disable-color": "#dbdbdb",
"$disabled-label-color": "rgba(64, 64, 64, 0.5)",
"$slider-color": "white",
"$disabled-switch-color": "#9f9f9f",
"$disabled-slider-color": "#cfcfcf",
"$foreground-light": "#909090",
"$foreground-disabled": "#161616",
"$background-dim": "#f3f3f3",
"$progress-buttons-color": "#8dd9ca",
"$progress-buttons-line-color": "#d4d4d4"
};
var orangeThemeColors = {
"$header-background-color": "#4a4a4a",
"$body-container-background-color": "#f8f8f8",
"$main-color": "#f78119",
"$main-hover-color": "#e77109",
"$body-background-color": "white",
"$inputs-background-color": "white",
"$text-color": "#4a4a4a",
"$text-input-color": "#4a4a4a",
"$header-color": "#f78119",
"$border-color": "#e7e7e7",
"$error-color": "#ed5565",
"$error-background-color": "#fcdfe2",
"$progress-text-color": "#9d9d9d",
"$disable-color": "#dbdbdb",
"$disabled-label-color": "rgba(64, 64, 64, 0.5)",
"$slider-color": "white",
"$disabled-switch-color": "#9f9f9f",
"$disabled-slider-color": "#cfcfcf",
"$foreground-light": "#909090",
"$foreground-disabled": "#161616",
"$background-dim": "#f3f3f3",
"$progress-buttons-color": "#f7b781",
"$progress-buttons-line-color": "#d4d4d4"
};
var darkblueThemeColors = {
"$header-background-color": "#d9d8dd",
"$body-container-background-color": "#f6f7f2",
"$main-color": "#3c4f6d",
"$main-hover-color": "#2c3f5d",
"$body-background-color": "white",
"$inputs-background-color": "white",
"$text-color": "#4a4a4a",
"$text-input-color": "#4a4a4a",
"$header-color": "#6d7072",
"$border-color": "#e7e7e7",
"$error-color": "#ed5565",
"$error-background-color": "#fcdfe2",
"$progress-text-color": "#9d9d9d",
"$disable-color": "#dbdbdb",
"$disabled-label-color": "rgba(64, 64, 64, 0.5)",
"$slider-color": "white",
"$disabled-switch-color": "#9f9f9f",
"$disabled-slider-color": "#cfcfcf",
"$foreground-light": "#909090",
"$foreground-disabled": "#161616",
"$background-dim": "#f3f3f3",
"$progress-buttons-color": "#839ec9",
"$progress-buttons-line-color": "#d4d4d4"
};
var darkroseThemeColors = {
"$header-background-color": "#ddd2ce",
"$body-container-background-color": "#f7efed",
"$main-color": "#68656e",
"$main-hover-color": "#58555e",
"$body-background-color": "white",
"$inputs-background-color": "white",
"$text-color": "#4a4a4a",
"$text-input-color": "#4a4a4a",
"$header-color": "#6d7072",
"$border-color": "#e7e7e7",
"$error-color": "#ed5565",
"$error-background-color": "#fcdfe2",
"$progress-text-color": "#9d9d9d",
"$disable-color": "#dbdbdb",
"$disabled-label-color": "rgba(64, 64, 64, 0.5)",
"$slider-color": "white",
"$disabled-switch-color": "#9f9f9f",
"$disabled-slider-color": "#cfcfcf",
"$foreground-light": "#909090",
"$foreground-disabled": "#161616",
"$background-dim": "#f3f3f3",
"$progress-buttons-color": "#c6bed4",
"$progress-buttons-line-color": "#d4d4d4"
};
var stoneThemeColors = {
"$header-background-color": "#cdccd2",
"$body-container-background-color": "#efedf4",
"$main-color": "#0f0f33",
"$main-hover-color": "#191955",
"$body-background-color": "white",
"$inputs-background-color": "white",
"$text-color": "#0f0f33",
"$text-input-color": "#0f0f33",
"$header-color": "#0f0f33",
"$border-color": "#e7e7e7",
"$error-color": "#ed5565",
"$error-background-color": "#fcdfe2",
"$progress-text-color": "#9d9d9d",
"$disable-color": "#dbdbdb",
"$disabled-label-color": "rgba(64, 64, 64, 0.5)",
"$slider-color": "white",
"$disabled-switch-color": "#9f9f9f",
"$disabled-slider-color": "#cfcfcf",
"$foreground-light": "#909090",
"$foreground-disabled": "#161616",
"$background-dim": "#f3f3f3",
"$progress-buttons-color": "#747491",
"$progress-buttons-line-color": "#d4d4d4"
};
var winterThemeColors = {
"$header-background-color": "#82b8da",
"$body-container-background-color": "#dae1e7",
"$main-color": "#3c3b40",
"$main-hover-color": "#1e1d20",
"$body-background-color": "white",
"$inputs-background-color": "white",
"$text-color": "#000",
"$text-input-color": "#000",
"$header-color": "#000",
"$border-color": "#e7e7e7",
"$error-color": "#ed5565",
"$error-background-color": "#fcdfe2",
"$disable-color": "#dbdbdb",
"$progress-text-color": "#9d9d9d",
"$disabled-label-color": "rgba(64, 64, 64, 0.5)",
"$slider-color": "white",
"$disabled-switch-color": "#9f9f9f",
"$disabled-slider-color": "#cfcfcf",
"$foreground-light": "#909090",
"$foreground-disabled": "#161616",
"$background-dim": "#f3f3f3",
"$progress-buttons-color": "#d1c9f5",
"$progress-buttons-line-color": "#d4d4d4"
};
var winterstoneThemeColors = {
"$header-background-color": "#323232",
"$body-container-background-color": "#f8f8f8",
"$main-color": "#5ac8fa",
"$main-hover-color": "#06a1e7",
"$body-background-color": "white",
"$inputs-background-color": "white",
"$text-color": "#000",
"$text-input-color": "#000",
"$header-color": "#000",
"$border-color": "#e7e7e7",
"$error-color": "#ed5565",
"$error-background-color": "#fcdfe2",
"$disable-color": "#dbdbdb",
"$progress-text-color": "#9d9d9d",
"$disabled-label-color": "rgba(64, 64, 64, 0.5)",
"$slider-color": "white",
"$disabled-switch-color": "#9f9f9f",
"$disabled-slider-color": "#cfcfcf",
"$foreground-light": "#909090",
"$foreground-disabled": "#161616",
"$background-dim": "#f3f3f3",
"$progress-buttons-color": "#acdcf2",
"$progress-buttons-line-color": "#d4d4d4"
};
function setCssVariables(vars, element) {
Object.keys(vars || {}).forEach(function (sassVarName) {
var name = sassVarName.substring(1);
element.style.setProperty("--" + name, vars[sassVarName]);
});
}
var StylesManager = /** @class */ (function () {
function StylesManager() {
StylesManager.autoApplyTheme();
}
StylesManager.autoApplyTheme = function () {
if (_defaultCss_defaultV2Css__WEBPACK_IMPORTED_MODULE_0__["surveyCss"].currentType === "bootstrap" || _defaultCss_defaultV2Css__WEBPACK_IMPORTED_MODULE_0__["surveyCss"].currentType === "bootstrapmaterial") {
return;
}
var includedThemeCss = StylesManager.getIncludedThemeCss();
if (includedThemeCss.length === 1) {
StylesManager.applyTheme(includedThemeCss[0].name);
}
};
StylesManager.getAvailableThemes = function () {
var themeMapper = _defaultCss_defaultV2Css__WEBPACK_IMPORTED_MODULE_0__["surveyCss"].getAvailableThemes()
.filter(function (themeName) { return ["defaultV2", "default", "modern"].indexOf(themeName) !== -1; })
.map(function (themeName) { return { name: themeName, theme: _defaultCss_defaultV2Css__WEBPACK_IMPORTED_MODULE_0__["surveyCss"][themeName] }; });
return themeMapper;
};
StylesManager.getIncludedThemeCss = function () {
if (typeof _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].environment === "undefined")
return [];
var rootElement = _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].environment.rootElement;
var themeMapper = StylesManager.getAvailableThemes();
var element = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_3__["isShadowDOM"])(rootElement) ? rootElement.host : rootElement;
if (!!element) {
var styles_1 = getComputedStyle(element);
if (styles_1.length) {
return themeMapper.filter(function (item) { return item.theme.variables && styles_1.getPropertyValue(item.theme.variables.themeMark); });
}
}
return [];
};
StylesManager.findSheet = function (styleSheetId) {
if (typeof _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].environment === "undefined")
return null;
var styleSheets = _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].environment.root.styleSheets;
for (var i = 0; i < styleSheets.length; i++) {
if (!!styleSheets[i].ownerNode && styleSheets[i].ownerNode["id"] === styleSheetId) {
return styleSheets[i];
}
}
return null;
};
StylesManager.createSheet = function (styleSheetId) {
var stylesSheetsMountContainer = _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].environment.stylesSheetsMountContainer;
var style = _global_variables_utils__WEBPACK_IMPORTED_MODULE_1__["DomDocumentHelper"].createElement("style");
style.id = styleSheetId;
// Add a media (and/or media query) here if you'd like!
// style.setAttribute("media", "screen")
// style.setAttribute("media", "only screen and (max-width : 1024px)")
style.appendChild(new Text(""));
Object(_utils_utils__WEBPACK_IMPORTED_MODULE_3__["getElement"])(stylesSheetsMountContainer).appendChild(style);
if (!!StylesManager.Logger) {
StylesManager.Logger.log("style sheet " + styleSheetId + " created");
}
return style.sheet;
};
StylesManager.applyTheme = function (themeName, themeSelector) {
if (themeName === void 0) { themeName = "default"; }
if (typeof _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].environment === "undefined")
return;
var rootElement = _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].environment.rootElement;
var element = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_3__["isShadowDOM"])(rootElement) ? rootElement.host : rootElement;
_defaultCss_defaultV2Css__WEBPACK_IMPORTED_MODULE_0__["surveyCss"].currentType = themeName;
if (StylesManager.Enabled) {
if (themeName !== "bootstrap" && themeName !== "bootstrapmaterial") {
setCssVariables(StylesManager.ThemeColors[themeName], element);
if (!!StylesManager.Logger) {
StylesManager.Logger.log("apply theme " + themeName + " completed");
}
return;
}
var themeCss_1 = StylesManager.ThemeCss[themeName];
if (!themeCss_1) {
_defaultCss_defaultV2Css__WEBPACK_IMPORTED_MODULE_0__["surveyCss"].currentType = "defaultV2";
return;
}
StylesManager.insertStylesRulesIntoDocument();
var currentThemeSelector_1 = themeSelector || StylesManager.ThemeSelector[themeName] || StylesManager.ThemeSelector["default"];
var styleSheetId = (themeName + currentThemeSelector_1).trim();
var sheet_1 = StylesManager.findSheet(styleSheetId);
if (!sheet_1) {
sheet_1 = StylesManager.createSheet(styleSheetId);
var themeColors_1 = StylesManager.ThemeColors[themeName] || StylesManager.ThemeColors["default"];
Object.keys(themeCss_1).forEach(function (selector) {
var cssRuleText = themeCss_1[selector];
Object.keys(themeColors_1 || {}).forEach(function (colorVariableName) { return (cssRuleText = cssRuleText.replace(new RegExp("\\" + colorVariableName, "g"), themeColors_1[colorVariableName])); });
try {
if (selector.indexOf("body") === 0) {
sheet_1.insertRule(selector + " { " + cssRuleText + " }", 0);
}
else {
sheet_1.insertRule(currentThemeSelector_1 + selector + " { " + cssRuleText + " }", 0);
}
}
catch (e) { }
});
}
}
if (!!StylesManager.Logger) {
StylesManager.Logger.log("apply theme " + themeName + " completed");
}
};
StylesManager.insertStylesRulesIntoDocument = function () {
if (StylesManager.Enabled) {
var sheet_2 = StylesManager.findSheet(StylesManager.SurveyJSStylesSheetId);
if (!sheet_2) {
sheet_2 = StylesManager.createSheet(StylesManager.SurveyJSStylesSheetId);
}
if (Object.keys(StylesManager.Styles).length) {
Object.keys(StylesManager.Styles).forEach(function (selector) {
try {
sheet_2.insertRule(selector + " { " + StylesManager.Styles[selector] + " }", 0);
}
catch (e) { }
});
}
if (Object.keys(StylesManager.Media).length) {
Object.keys(StylesManager.Media).forEach(function (selector) {
try {
sheet_2.insertRule(StylesManager.Media[selector].media +
" { " +
selector +
" { " +
StylesManager.Media[selector].style +
" } }", 0);
}
catch (e) { }
});
}
}
};
StylesManager.SurveyJSStylesSheetId = "surveyjs-styles";
StylesManager.Styles = {};
StylesManager.Media = {};
StylesManager.ThemeColors = {
"modern": modernThemeColors,
"default": defaultThemeColors,
"orange": orangeThemeColors,
"darkblue": darkblueThemeColors,
"darkrose": darkroseThemeColors,
"stone": stoneThemeColors,
"winter": winterThemeColors,
"winterstone": winterstoneThemeColors,
};
StylesManager.ThemeCss = {};
StylesManager.ThemeSelector = {
"default": ".sv_main ",
"modern": ".sv-root-modern "
};
StylesManager.Enabled = true;
return StylesManager;
}());
/***/ }),
/***/ "./src/survey-element.ts":
/*!*******************************!*\
!*** ./src/survey-element.ts ***!
\*******************************/
/*! exports provided: SurveyElementCore, DragTypeOverMeEnum, SurveyElement */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyElementCore", function() { return SurveyElementCore; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DragTypeOverMeEnum", function() { return DragTypeOverMeEnum; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyElement", function() { return SurveyElement; });
/* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts");
/* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./base */ "./src/base.ts");
/* harmony import */ var _actions_adaptive_container__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./actions/adaptive-container */ "./src/actions/adaptive-container.ts");
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts");
/* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./settings */ "./src/settings.ts");
/* harmony import */ var _actions_container__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./actions/container */ "./src/actions/container.ts");
/* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts");
/* harmony import */ var _utils_animation__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./utils/animation */ "./src/utils/animation.ts");
/* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./utils/utils */ "./src/utils/utils.ts");
/* harmony import */ var _global_variables_utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./global_variables_utils */ "./src/global_variables_utils.ts");
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
/**
* A base class for the [`SurveyElement`](https://surveyjs.io/form-library/documentation/surveyelement) and [`SurveyModel`](https://surveyjs.io/form-library/documentation/surveymodel) classes.
*/
var SurveyElementCore = /** @class */ (function (_super) {
__extends(SurveyElementCore, _super);
function SurveyElementCore() {
var _this = _super.call(this) || this;
_this.createLocTitleProperty();
return _this;
}
SurveyElementCore.prototype.createLocTitleProperty = function () {
return this.createLocalizableString("title", this, true);
};
Object.defineProperty(SurveyElementCore.prototype, "isPage", {
/**
* Returns `true` if the survey element is a page.
* @see Base.getType
*/
get: function () { return false; },
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElementCore.prototype, "isPanel", {
/**
* Returns `true` if the survey element is a panel.
* @see Base.getType
*/
get: function () { return false; },
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElementCore.prototype, "isQuestion", {
/**
* Returns `true` if the survey element is a question.
* @see Base.getType
*/
get: function () { return false; },
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElementCore.prototype, "isSurvey", {
/**
* Returns `true` if the element is a survey.
* @see Base.getType
*/
get: function () { return false; },
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElementCore.prototype, "title", {
/**
* A title for the survey element. If `title` is undefined, the `name` property value is displayed instead.
*
* Empty pages and panels do not display their titles or names.
*
* @see [Configure Question Titles](https://surveyjs.io/form-library/documentation/design-survey-question-titles)
*/
get: function () {
return this.getLocalizableStringText("title", this.getDefaultTitleValue());
},
set: function (val) {
this.setLocalizableStringText("title", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElementCore.prototype, "locTitle", {
get: function () {
return this.getLocalizableString("title");
},
enumerable: false,
configurable: true
});
SurveyElementCore.prototype.getDefaultTitleValue = function () { return undefined; };
SurveyElementCore.prototype.updateDescriptionVisibility = function (newDescription) {
var showPlaceholder = false;
if (this.isDesignMode) {
var property_1 = _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].findProperty(this.getType(), "description");
showPlaceholder = !!(property_1 === null || property_1 === void 0 ? void 0 : property_1.placeholder);
}
this.hasDescription = !!newDescription || (showPlaceholder && this.isDesignMode);
};
Object.defineProperty(SurveyElementCore.prototype, "locDescription", {
get: function () {
return this.getLocalizableString("description");
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElementCore.prototype, "titleTagName", {
get: function () {
var titleTagName = this.getDefaultTitleTagName();
var survey = this.getSurvey();
return !!survey ? survey.getElementTitleTagName(this, titleTagName) : titleTagName;
},
enumerable: false,
configurable: true
});
SurveyElementCore.prototype.getDefaultTitleTagName = function () {
return _settings__WEBPACK_IMPORTED_MODULE_4__["settings"].titleTags[this.getType()];
};
Object.defineProperty(SurveyElementCore.prototype, "hasTitle", {
get: function () { return this.title.length > 0; },
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElementCore.prototype, "hasTitleActions", {
get: function () { return false; },
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElementCore.prototype, "hasTitleEvents", {
get: function () {
return this.hasTitleActions;
},
enumerable: false,
configurable: true
});
SurveyElementCore.prototype.getTitleToolbar = function () { return null; };
SurveyElementCore.prototype.getTitleOwner = function () { return undefined; };
Object.defineProperty(SurveyElementCore.prototype, "isTitleOwner", {
get: function () { return !!this.getTitleOwner(); },
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElementCore.prototype, "isTitleRenderedAsString", {
get: function () { return this.getIsTitleRenderedAsString(); },
enumerable: false,
configurable: true
});
SurveyElementCore.prototype.toggleState = function () { return undefined; };
Object.defineProperty(SurveyElementCore.prototype, "cssClasses", {
get: function () { return {}; },
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElementCore.prototype, "cssTitle", {
get: function () { return ""; },
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElementCore.prototype, "ariaTitleId", {
get: function () { return undefined; },
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElementCore.prototype, "ariaDescriptionId", {
get: function () { return undefined; },
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElementCore.prototype, "titleTabIndex", {
get: function () { return undefined; },
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElementCore.prototype, "titleAriaExpanded", {
get: function () { return undefined; },
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElementCore.prototype, "titleAriaRole", {
get: function () { return undefined; },
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElementCore.prototype, "ariaLabel", {
get: function () {
return this.locTitle.renderedHtml;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElementCore.prototype, "titleAriaLabel", {
get: function () {
return this.ariaLabel;
},
enumerable: false,
configurable: true
});
SurveyElementCore.prototype.getIsTitleRenderedAsString = function () { return !this.isTitleOwner; };
__decorate([
Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])()
], SurveyElementCore.prototype, "hasDescription", void 0);
__decorate([
Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({
localizable: true,
onSet: function (newDescription, self) {
self.updateDescriptionVisibility(newDescription);
}
})
], SurveyElementCore.prototype, "description", void 0);
return SurveyElementCore;
}(_base__WEBPACK_IMPORTED_MODULE_1__["Base"]));
// TODO: rename
var DragTypeOverMeEnum;
(function (DragTypeOverMeEnum) {
DragTypeOverMeEnum[DragTypeOverMeEnum["InsideEmptyPanel"] = 1] = "InsideEmptyPanel";
DragTypeOverMeEnum[DragTypeOverMeEnum["MultilineRight"] = 2] = "MultilineRight";
DragTypeOverMeEnum[DragTypeOverMeEnum["MultilineLeft"] = 3] = "MultilineLeft";
DragTypeOverMeEnum[DragTypeOverMeEnum["Top"] = 4] = "Top";
DragTypeOverMeEnum[DragTypeOverMeEnum["Right"] = 5] = "Right";
DragTypeOverMeEnum[DragTypeOverMeEnum["Bottom"] = 6] = "Bottom";
DragTypeOverMeEnum[DragTypeOverMeEnum["Left"] = 7] = "Left";
})(DragTypeOverMeEnum || (DragTypeOverMeEnum = {}));
/**
* A base class for all survey elements.
*/
var SurveyElement = /** @class */ (function (_super) {
__extends(SurveyElement, _super);
function SurveyElement(name) {
var _this = _super.call(this) || this;
_this.selectedElementInDesignValue = _this;
_this.disableDesignActions = SurveyElement.CreateDisabledDesignElements;
_this.parentQuestionValue = null;
_this.isContentElement = false;
_this.isEditableTemplateElement = false;
_this.isInteractiveDesignElement = true;
_this.isSingleInRow = true;
_this._renderedIsExpanded = true;
_this._isAnimatingCollapseExpand = false;
_this.animationCollapsed = new _utils_animation__WEBPACK_IMPORTED_MODULE_7__["AnimationBoolean"](_this.getExpandCollapseAnimationOptions(), function (val) {
_this._renderedIsExpanded = val;
if (_this.animationAllowed) {
if (val) {
_this.isAnimatingCollapseExpand = true;
}
else {
_this.updateElementCss(false);
}
}
}, function () { return _this.renderedIsExpanded; });
_this.name = name;
_this.createNewArray("errors");
_this.createNewArray("titleActions");
_this.registerPropertyChangedHandlers(["isReadOnly"], function () { _this.onReadOnlyChanged(); });
_this.registerPropertyChangedHandlers(["errors"], function () { _this.updateVisibleErrors(); });
_this.registerPropertyChangedHandlers(["isSingleInRow"], function () { _this.updateElementCss(false); });
_this.registerPropertyChangedHandlers(["minWidth", "maxWidth", "renderWidth", "allowRootStyle", "parent"], function () { _this.updateRootStyle(); });
return _this;
}
SurveyElement.getProgressInfoByElements = function (children, isRequired) {
var info = _base__WEBPACK_IMPORTED_MODULE_1__["Base"].createProgressInfo();
for (var i = 0; i < children.length; i++) {
if (!children[i].isVisible)
continue;
var childInfo = children[i].getProgressInfo();
info.questionCount += childInfo.questionCount;
info.answeredQuestionCount += childInfo.answeredQuestionCount;
info.requiredQuestionCount += childInfo.requiredQuestionCount;
info.requiredAnsweredQuestionCount +=
childInfo.requiredAnsweredQuestionCount;
}
if (isRequired && info.questionCount > 0) {
if (info.requiredQuestionCount == 0)
info.requiredQuestionCount = 1;
if (info.answeredQuestionCount > 0)
info.requiredAnsweredQuestionCount = 1;
}
return info;
};
SurveyElement.ScrollElementToTop = function (elementId, scrollIfVisible, scrollIntoViewOptions) {
var root = _settings__WEBPACK_IMPORTED_MODULE_4__["settings"].environment.root;
if (!elementId || typeof root === "undefined")
return false;
var el = root.getElementById(elementId);
return SurveyElement.ScrollElementToViewCore(el, false, scrollIfVisible, scrollIntoViewOptions);
};
SurveyElement.ScrollElementToViewCore = function (el, checkLeft, scrollIfVisible, scrollIntoViewOptions) {
if (!el || !el.scrollIntoView)
return false;
var elTop = scrollIfVisible ? -1 : el.getBoundingClientRect().top;
var needScroll = elTop < 0;
var elLeft = -1;
if (!needScroll && checkLeft) {
elLeft = el.getBoundingClientRect().left;
needScroll = elLeft < 0;
}
if (!needScroll && _global_variables_utils__WEBPACK_IMPORTED_MODULE_9__["DomWindowHelper"].isAvailable()) {
var height = _global_variables_utils__WEBPACK_IMPORTED_MODULE_9__["DomWindowHelper"].getInnerHeight();
needScroll = height > 0 && height < elTop;
if (!needScroll && checkLeft) {
var width = _global_variables_utils__WEBPACK_IMPORTED_MODULE_9__["DomWindowHelper"].getInnerWidth();
needScroll = width > 0 && width < elLeft;
}
}
if (needScroll) {
el.scrollIntoView(scrollIntoViewOptions);
}
return needScroll;
};
SurveyElement.GetFirstNonTextElement = function (elements, removeSpaces) {
if (removeSpaces === void 0) { removeSpaces = false; }
if (!elements || !elements.length || elements.length == 0)
return null;
if (removeSpaces) {
var tEl = elements[0];
if (tEl.nodeName === "#text")
tEl.data = "";
tEl = elements[elements.length - 1];
if (tEl.nodeName === "#text")
tEl.data = "";
}
for (var i = 0; i < elements.length; i++) {
if (elements[i].nodeName != "#text" && elements[i].nodeName != "#comment")
return elements[i];
}
return null;
};
SurveyElement.FocusElement = function (elementId) {
if (!elementId || !_global_variables_utils__WEBPACK_IMPORTED_MODULE_9__["DomDocumentHelper"].isAvailable())
return false;
var res = SurveyElement.focusElementCore(elementId);
if (!res) {
setTimeout(function () {
SurveyElement.focusElementCore(elementId);
}, 10);
}
return res;
};
SurveyElement.focusElementCore = function (elementId) {
var root = _settings__WEBPACK_IMPORTED_MODULE_4__["settings"].environment.root;
if (!root)
return false;
var el = root.getElementById(elementId);
// https://stackoverflow.com/questions/19669786/check-if-element-is-visible-in-dom
if (el && !el["disabled"] && el.style.display !== "none" && el.offsetParent !== null) {
SurveyElement.ScrollElementToViewCore(el, true, false);
el.focus();
return true;
}
return false;
};
Object.defineProperty(SurveyElement.prototype, "colSpan", {
get: function () {
return this.getPropertyValue("colSpan", 1);
},
set: function (val) {
this.setPropertyValue("colSpan", val);
},
enumerable: false,
configurable: true
});
SurveyElement.prototype.onPropertyValueChanged = function (name, oldValue, newValue) {
_super.prototype.onPropertyValueChanged.call(this, name, oldValue, newValue);
if (name === "state") {
this.updateElementCss(false);
this.notifyStateChanged(oldValue);
if (this.stateChangedCallback)
this.stateChangedCallback();
}
};
SurveyElement.prototype.getSkeletonComponentNameCore = function () {
if (this.survey) {
return this.survey.getSkeletonComponentName(this);
}
return "";
};
Object.defineProperty(SurveyElement.prototype, "parentQuestion", {
/**
* A Dynamic Panel, Dynamic Matrix, or Dropdown Matrix that includes the current question.
*
* This property is `null` for standalone questions.
*/
get: function () {
return this.parentQuestionValue;
},
enumerable: false,
configurable: true
});
SurveyElement.prototype.setParentQuestion = function (val) {
this.parentQuestionValue = val;
this.onParentQuestionChanged();
};
SurveyElement.prototype.onParentQuestionChanged = function () { };
Object.defineProperty(SurveyElement.prototype, "skeletonComponentName", {
get: function () {
return this.getSkeletonComponentNameCore();
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElement.prototype, "state", {
/**
* Gets and sets the survey element's expand state.
*
* Possible values:
*
* - `"default"` (default) - The survey element is displayed in full and cannot be collapsed in the UI.
* - `"expanded"` - The survey element is displayed in full and can be collapsed in the UI.
* - `"collapsed"` - The survey element displays only `title` and `description` and can be expanded in the UI.
*
* @see toggleState
* @see collapse
* @see expand
* @see isCollapsed
* @see isExpanded
*/
get: function () {
return this.getPropertyValue("state");
},
set: function (val) {
this.setPropertyValue("state", val);
this.renderedIsExpanded = !(this.state === "collapsed" && !this.isDesignMode);
},
enumerable: false,
configurable: true
});
SurveyElement.prototype.notifyStateChanged = function (prevState) {
if (this.survey) {
this.survey.elementContentVisibilityChanged(this);
}
};
Object.defineProperty(SurveyElement.prototype, "isCollapsed", {
/**
* Returns `true` if the survey element is collapsed.
* @see state
* @see toggleState
* @see collapse
* @see expand
* @see isExpanded
*/
get: function () {
return this.state === "collapsed" && !this.isDesignMode;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElement.prototype, "isExpanded", {
/**
* Returns `true` if the survey element is expanded.
* @see state
* @see toggleState
* @see collapse
* @see expand
* @see isCollapsed
*/
get: function () {
return this.state === "expanded";
},
enumerable: false,
configurable: true
});
/**
* Collapses the survey element.
*
* In collapsed state, the element displays only `title` and `description`.
* @see title
* @see description
* @see state
* @see toggleState
* @see expand
* @see isCollapsed
* @see isExpanded
*/
SurveyElement.prototype.collapse = function () {
if (this.isDesignMode)
return;
this.state = "collapsed";
};
/**
* Expands the survey element.
* @see state
* @see toggleState
* @see collapse
* @see isCollapsed
* @see isExpanded
*/
SurveyElement.prototype.expand = function () {
this.state = "expanded";
};
/**
* Toggles the survey element's `state` between collapsed and expanded.
* @see state
* @see collapse
* @see expand
* @see isCollapsed
* @see isExpanded
*/
SurveyElement.prototype.toggleState = function () {
if (this.isCollapsed) {
this.expand();
return true;
}
if (this.isExpanded) {
this.collapse();
return false;
}
return true;
};
Object.defineProperty(SurveyElement.prototype, "hasStateButton", {
get: function () {
return this.isExpanded || this.isCollapsed;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElement.prototype, "shortcutText", {
get: function () {
return this.title || this.name;
},
enumerable: false,
configurable: true
});
SurveyElement.prototype.getTitleToolbar = function () {
if (!this.titleToolbarValue) {
this.titleToolbarValue = this.createActionContainer(true);
this.titleToolbarValue.containerCss = (this.isPanel ? this.cssClasses.panel.titleBar : this.cssClasses.titleBar) || "sv-action-title-bar";
this.titleToolbarValue.setItems(this.getTitleActions());
}
return this.titleToolbarValue;
};
SurveyElement.prototype.createActionContainer = function (allowAdaptiveActions) {
var actionContainer = allowAdaptiveActions ? new _actions_adaptive_container__WEBPACK_IMPORTED_MODULE_2__["AdaptiveActionContainer"]() : new _actions_container__WEBPACK_IMPORTED_MODULE_5__["ActionContainer"]();
if (this.survey && !!this.survey.getCss().actionBar) {
actionContainer.cssClasses = this.survey.getCss().actionBar;
}
return actionContainer;
};
Object.defineProperty(SurveyElement.prototype, "titleActions", {
get: function () {
return this.getPropertyValue("titleActions");
},
enumerable: false,
configurable: true
});
SurveyElement.prototype.getTitleActions = function () {
if (!this.isTitleActionRequested) {
this.updateTitleActions();
this.isTitleActionRequested = true;
}
return this.titleActions;
};
SurveyElement.prototype.getDefaultTitleActions = function () {
return [];
};
SurveyElement.prototype.updateTitleActions = function () {
var actions = this.getDefaultTitleActions();
if (!!this.survey) {
actions = this.survey.getUpdatedElementTitleActions(this, actions);
}
this.setPropertyValue("titleActions", actions);
};
Object.defineProperty(SurveyElement.prototype, "hasTitleActions", {
get: function () {
return this.getTitleActions().length > 0;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElement.prototype, "hasTitleEvents", {
get: function () {
return this.state !== undefined && this.state !== "default";
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElement.prototype, "titleTabIndex", {
get: function () {
return !this.isPage && this.state !== "default" ? 0 : undefined;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElement.prototype, "titleAriaExpanded", {
get: function () {
if (this.isPage || this.state === "default")
return undefined;
return this.state === "expanded" ? "true" : "false";
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElement.prototype, "titleAriaRole", {
get: function () {
if (this.isPage || this.state === "default")
return undefined;
return "button";
},
enumerable: false,
configurable: true
});
SurveyElement.prototype.setSurveyImpl = function (value, isLight) {
this.surveyImplValue = value;
if (!this.surveyImplValue) {
this.setSurveyCore(null);
this.surveyDataValue = null;
}
else {
this.surveyDataValue = this.surveyImplValue.getSurveyData();
this.setSurveyCore(this.surveyImplValue.getSurvey());
this.textProcessorValue = this.surveyImplValue.getTextProcessor();
this.onSetData();
}
if (!!this.survey) {
this.updateDescriptionVisibility(this.description);
this.clearCssClasses();
}
};
SurveyElement.prototype.canRunConditions = function () {
return _super.prototype.canRunConditions.call(this) && !!this.data;
};
SurveyElement.prototype.getDataFilteredValues = function () {
return !!this.data ? this.data.getFilteredValues() : {};
};
SurveyElement.prototype.getDataFilteredProperties = function () {
var props = !!this.data ? this.data.getFilteredProperties() : {};
props.question = this;
return props;
};
Object.defineProperty(SurveyElement.prototype, "surveyImpl", {
get: function () {
return this.surveyImplValue;
},
enumerable: false,
configurable: true
});
/* You shouldn't use this method ever */
SurveyElement.prototype.__setData = function (data) {
if (_settings__WEBPACK_IMPORTED_MODULE_4__["settings"].supportCreatorV2) {
this.surveyDataValue = data;
}
};
Object.defineProperty(SurveyElement.prototype, "data", {
get: function () {
return this.surveyDataValue;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElement.prototype, "survey", {
/**
* Returns the survey object.
*/
get: function () {
return this.getSurvey();
},
enumerable: false,
configurable: true
});
SurveyElement.prototype.getSurvey = function (live) {
if (live === void 0) { live = false; }
if (!!this.surveyValue)
return this.surveyValue;
if (!!this.surveyImplValue) {
this.setSurveyCore(this.surveyImplValue.getSurvey());
}
return this.surveyValue;
};
SurveyElement.prototype.setSurveyCore = function (value) {
this.surveyValue = value;
if (!!this.surveyChangedCallback) {
this.surveyChangedCallback();
}
};
Object.defineProperty(SurveyElement.prototype, "isInternal", {
get: function () {
return this.isContentElement;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElement.prototype, "areInvisibleElementsShowing", {
get: function () {
return (!!this.survey &&
this.survey.areInvisibleElementsShowing &&
!this.isContentElement);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElement.prototype, "isVisible", {
get: function () {
return true;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElement.prototype, "isReadOnly", {
/**
* Returns `true` if the survey element or its parent element is read-only.
*
* If you want to switch a survey element to the read-only state based on a condition, specify the [`enableIf`](https://surveyjs.io/form-library/documentation/question#enableIf) property. Refer to the following help topic for information: [Conditional Visibility](https://surveyjs.io/form-library/documentation/design-survey-conditional-logic#conditional-visibility).
* @see readOnly
*/
get: function () {
return this.readOnly;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElement.prototype, "readOnly", {
/**
* Makes the survey element read-only.
*
* If you want to switch a survey element to the read-only state based on a condition, specify the [`enableIf`](https://surveyjs.io/form-library/documentation/question#enableIf) property. Refer to the following help topic for information: [Conditional Visibility](https://surveyjs.io/form-library/documentation/design-survey-conditional-logic#conditional-visibility).
* @see isReadOnly
*/
get: function () {
return this.getPropertyValue("readOnly");
},
set: function (val) {
if (this.readOnly == val)
return;
this.setPropertyValue("readOnly", val);
if (!this.isLoadingFromJson) {
this.setPropertyValue("isReadOnly", this.isReadOnly);
}
},
enumerable: false,
configurable: true
});
SurveyElement.prototype.onReadOnlyChanged = function () {
if (!!this.readOnlyChangedCallback) {
this.readOnlyChangedCallback();
}
};
Object.defineProperty(SurveyElement.prototype, "css", {
get: function () {
return !!this.survey ? this.survey.getCss() : {};
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElement.prototype, "cssClassesValue", {
get: function () {
return this.getPropertyValueWithoutDefault("cssClassesValue");
},
set: function (val) {
this.setPropertyValue("cssClassesValue", val);
},
enumerable: false,
configurable: true
});
SurveyElement.prototype.ensureCssClassesValue = function () {
if (!this.cssClassesValue) {
this.cssClassesValue = this.calcCssClasses(this.css);
this.updateElementCssCore(this.cssClassesValue);
}
};
Object.defineProperty(SurveyElement.prototype, "cssClasses", {
/**
* Returns an object in which keys are UI elements and values are CSS classes applied to them.
*
* Use the following events of the [`SurveyModel`](https://surveyjs.io/form-library/documentation/surveymodel) object to override CSS classes:
*
* - [`onUpdateQuestionCssClasses`](https://surveyjs.io/form-library/documentation/surveymodel#onUpdateQuestionCssClasses)
* - [`onUpdatePanelCssClasses`](https://surveyjs.io/form-library/documentation/surveymodel#onUpdatePanelCssClasses)
* - [`onUpdatePageCssClasses`](https://surveyjs.io/form-library/documentation/surveymodel#onUpdatePageCssClasses)
* - [`onUpdateChoiceItemCss`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onUpdateChoiceItemCss)
*/
get: function () {
var _dummy = this.cssClassesValue;
if (!this.survey)
return this.calcCssClasses(this.css);
this.ensureCssClassesValue();
return this.cssClassesValue;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElement.prototype, "cssTitleNumber", {
get: function () {
var css = this.cssClasses;
if (css.number)
return css.number;
return css.panel ? css.panel.number : undefined;
},
enumerable: false,
configurable: true
});
SurveyElement.prototype.calcCssClasses = function (css) { return undefined; };
SurveyElement.prototype.updateElementCssCore = function (cssClasses) { };
Object.defineProperty(SurveyElement.prototype, "cssError", {
get: function () { return ""; },
enumerable: false,
configurable: true
});
SurveyElement.prototype.updateElementCss = function (reNew) {
this.clearCssClasses();
};
SurveyElement.prototype.clearCssClasses = function () {
this.cssClassesValue = undefined;
};
SurveyElement.prototype.getIsLoadingFromJson = function () {
if (_super.prototype.getIsLoadingFromJson.call(this))
return true;
return this.surveyValue ? this.surveyValue.isLoadingFromJson : false;
};
Object.defineProperty(SurveyElement.prototype, "name", {
/**
* A survey element identifier.
*
* > Question names must be unique.
*/
get: function () {
return this.getPropertyValue("name", "");
},
set: function (val) {
var oldValue = this.name;
this.setPropertyValue("name", this.getValidName(val));
if (!this.isLoadingFromJson && !!oldValue) {
this.onNameChanged(oldValue);
}
},
enumerable: false,
configurable: true
});
SurveyElement.prototype.getValidName = function (name) {
return name;
};
SurveyElement.prototype.onNameChanged = function (oldValue) { };
SurveyElement.prototype.updateBindingValue = function (valueName, value) {
if (!!this.data &&
!this.isTwoValueEquals(value, this.data.getValue(valueName))) {
this.data.setValue(valueName, value, false);
}
};
Object.defineProperty(SurveyElement.prototype, "errors", {
/**
* Validation errors. Call the `validate()` method to validate survey element data.
* @see validate
*/
get: function () {
return this.getPropertyValue("errors");
},
set: function (val) {
this.setPropertyValue("errors", val);
},
enumerable: false,
configurable: true
});
SurveyElement.prototype.updateVisibleErrors = function () {
var counter = 0;
for (var i = 0; i < this.errors.length; i++) {
if (this.errors[i].visible)
counter++;
}
this.hasVisibleErrors = counter > 0;
};
Object.defineProperty(SurveyElement.prototype, "containsErrors", {
/**
* Returns `true` if the survey element or its child elements have validation errors.
*
* This property contains the result of the most recent validation. This result may be outdated. Call the `validate` method to get an up-to-date value.
* @see errors
*/
get: function () {
return this.getPropertyValue("containsErrors", false);
},
enumerable: false,
configurable: true
});
SurveyElement.prototype.updateContainsErrors = function () {
this.setPropertyValue("containsErrors", this.getContainsErrors());
};
SurveyElement.prototype.getContainsErrors = function () {
return this.errors.length > 0;
};
Object.defineProperty(SurveyElement.prototype, "selectedElementInDesign", {
get: function () {
return this.selectedElementInDesignValue;
},
set: function (val) {
this.selectedElementInDesignValue = val;
},
enumerable: false,
configurable: true
});
SurveyElement.prototype.updateCustomWidgets = function () { };
SurveyElement.prototype.onSurveyLoad = function () { };
Object.defineProperty(SurveyElement.prototype, "wasRendered", {
get: function () { return !!this.wasRenderedValue; },
enumerable: false,
configurable: true
});
SurveyElement.prototype.onFirstRendering = function () {
this.wasRenderedValue = true;
this.ensureCssClassesValue();
};
SurveyElement.prototype.endLoadingFromJson = function () {
_super.prototype.endLoadingFromJson.call(this);
if (!this.survey) {
this.onSurveyLoad();
}
this.updateDescriptionVisibility(this.description);
};
SurveyElement.prototype.setVisibleIndex = function (index) {
return 0;
};
SurveyElement.prototype.delete = function (doDispose) { };
/**
* Returns the survey's [locale](https://surveyjs.io/form-library/documentation/surveymodel#locale).
*
* If a default locale is used, this method returns an empty string. To get the applied locale in this case, use the following code:
*
* ```js
* import { surveyLocalization } from 'survey-core';
* const defaultLocale = surveyLocalization.defaultLocale;
* ```
*
* @see [Localization & Globalization](https://surveyjs.io/form-library/documentation/localization)
*/
SurveyElement.prototype.getLocale = function () {
return this.survey
? this.survey.getLocale()
: this.locOwner
? this.locOwner.getLocale()
: "";
};
SurveyElement.prototype.getMarkdownHtml = function (text, name) {
return this.survey
? this.survey.getSurveyMarkdownHtml(this, text, name)
: this.locOwner
? this.locOwner.getMarkdownHtml(text, name)
: undefined;
};
SurveyElement.prototype.getRenderer = function (name) {
return this.survey && typeof this.survey.getRendererForString === "function"
? this.survey.getRendererForString(this, name)
: this.locOwner && typeof this.locOwner.getRenderer === "function"
? this.locOwner.getRenderer(name)
: null;
};
SurveyElement.prototype.getRendererContext = function (locStr) {
return this.survey && typeof this.survey.getRendererContextForString === "function"
? this.survey.getRendererContextForString(this, locStr)
: this.locOwner && typeof this.locOwner.getRendererContext === "function"
? this.locOwner.getRendererContext(locStr)
: locStr;
};
SurveyElement.prototype.getProcessedText = function (text) {
if (this.isLoadingFromJson)
return text;
if (this.textProcessor)
return this.textProcessor.processText(text, this.getUseDisplayValuesInDynamicTexts());
if (this.locOwner)
return this.locOwner.getProcessedText(text);
return text;
};
SurveyElement.prototype.getUseDisplayValuesInDynamicTexts = function () { return true; };
SurveyElement.prototype.removeSelfFromList = function (list) {
if (!list || !Array.isArray(list))
return;
var index = list.indexOf(this);
if (index > -1) {
list.splice(index, 1);
}
};
Object.defineProperty(SurveyElement.prototype, "textProcessor", {
get: function () {
return this.textProcessorValue;
},
enumerable: false,
configurable: true
});
SurveyElement.prototype.getProcessedHtml = function (html) {
if (!html || !this.textProcessor)
return html;
return this.textProcessor.processText(html, true);
};
SurveyElement.prototype.onSetData = function () { };
Object.defineProperty(SurveyElement.prototype, "parent", {
get: function () {
return this.getPropertyValue("parent", null);
},
set: function (val) {
this.setPropertyValue("parent", val);
},
enumerable: false,
configurable: true
});
SurveyElement.prototype.getPage = function (parent) {
while (parent && parent.parent)
parent = parent.parent;
if (parent && parent.getType() == "page")
return parent;
return null;
};
SurveyElement.prototype.moveToBase = function (parent, container, insertBefore) {
if (insertBefore === void 0) { insertBefore = null; }
if (!container)
return false;
parent.removeElement(this);
var index = -1;
if (_helpers__WEBPACK_IMPORTED_MODULE_3__["Helpers"].isNumber(insertBefore)) {
index = parseInt(insertBefore);
}
if (index == -1 && !!insertBefore && !!insertBefore.getType) {
index = container.indexOf(insertBefore);
}
container.addElement(this, index);
return true;
};
SurveyElement.prototype.setPage = function (parent, newPage) {
var oldPage = this.getPage(parent);
//fix for the creator v1: https://github.com/surveyjs/survey-creator/issues/1744
if (typeof newPage === "string") {
var survey = this.getSurvey();
survey.pages.forEach(function (page) {
if (newPage === page.name)
newPage = page;
});
}
if (oldPage === newPage)
return;
if (parent)
parent.removeElement(this);
if (newPage) {
newPage.addElement(this, -1);
}
};
SurveyElement.prototype.getSearchableLocKeys = function (keys) {
keys.push("title");
keys.push("description");
};
Object.defineProperty(SurveyElement.prototype, "isDefaultV2Theme", {
get: function () {
return this.survey && this.survey.getCss().root == "sd-root-modern";
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElement.prototype, "hasParent", {
get: function () {
return (this.parent && !this.parent.isPage && (!this.parent.originalPage)) || (this.parent === undefined);
},
enumerable: false,
configurable: true
});
SurveyElement.prototype.shouldAddRunnerStyles = function () {
return !this.isDesignMode && this.isDefaultV2Theme;
};
Object.defineProperty(SurveyElement.prototype, "isCompact", {
get: function () {
return this.survey && this.survey["isCompact"];
},
enumerable: false,
configurable: true
});
SurveyElement.prototype.canHaveFrameStyles = function () {
return (this.parent !== undefined && (!this.hasParent || this.parent && this.parent.showPanelAsPage));
};
SurveyElement.prototype.getHasFrameV2 = function () {
return this.shouldAddRunnerStyles() && this.canHaveFrameStyles();
};
SurveyElement.prototype.getIsNested = function () {
return this.shouldAddRunnerStyles() && !this.canHaveFrameStyles();
};
SurveyElement.prototype.getCssRoot = function (cssClasses) {
var isExpanadable = !!this.isCollapsed || !!this.isExpanded;
return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_6__["CssClassBuilder"]()
.append(cssClasses.withFrame, this.getHasFrameV2() && !this.isCompact)
.append(cssClasses.compact, this.isCompact && this.getHasFrameV2())
.append(cssClasses.collapsed, !!this.isCollapsed)
.append(cssClasses.expandableAnimating, isExpanadable && this.isAnimatingCollapseExpand)
.append(cssClasses.expanded, !!this.isExpanded && this.renderedIsExpanded)
.append(cssClasses.expandable, isExpanadable)
.append(cssClasses.nested, this.getIsNested())
.toString();
};
Object.defineProperty(SurveyElement.prototype, "width", {
/**
* Sets survey element width in CSS values.
*
* Default value: ""
* @see minWidth
* @see maxWidth
*/
get: function () {
return this.getPropertyValue("width", "");
},
set: function (val) {
this.setPropertyValue("width", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElement.prototype, "minWidth", {
/**
* Gets or sets minimum survey element width in CSS values.
*
* Default value: "300px" (taken from [`settings.minWidth`](https://surveyjs.io/form-library/documentation/settings#minWidth))
* @see maxWidth
* @see renderWidth
* @see width
*/
get: function () {
return this.getPropertyValue("minWidth");
},
set: function (val) {
this.setPropertyValue("minWidth", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElement.prototype, "maxWidth", {
/**
* Gets or sets maximum survey element width in CSS values.
*
* Default value: "100%" (taken from [`settings.maxWidth`](https://surveyjs.io/form-library/documentation/settings#maxWidth))
* @see minWidth
* @see renderWidth
* @see width
*/
get: function () {
return this.getPropertyValue("maxWidth");
},
set: function (val) {
this.setPropertyValue("maxWidth", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElement.prototype, "renderWidth", {
/**
* Returns a calculated width of the rendered survey element in CSS values.
* @see width
* @see minWidth
* @see maxWidth
*/
get: function () {
return this.getPropertyValue("renderWidth", "");
},
set: function (val) {
this.setPropertyValue("renderWidth", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElement.prototype, "indent", {
/**
* Increases or decreases an indent of survey element content from the left edge. Accepts positive integer values and 0. Does not apply in the Default V2 theme.
* @see rightIndent
*/
get: function () {
return this.getPropertyValue("indent");
},
set: function (val) {
this.setPropertyValue("indent", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElement.prototype, "rightIndent", {
/**
* Increases or decreases an indent of survey element content from the right edge. Accepts positive integer values and 0. Does not apply in the Default V2 theme.
* @see indent
*/
get: function () {
return this.getPropertyValue("rightIndent", 0);
},
set: function (val) {
this.setPropertyValue("rightIndent", val);
},
enumerable: false,
configurable: true
});
SurveyElement.prototype.getRootStyle = function () {
var style = {};
if (!!this.paddingLeft) {
style["--sv-element-add-padding-left"] = this.paddingLeft;
}
if (!!this.paddingRight) {
style["--sv-element-add-padding-right"] = this.paddingRight;
}
return style;
};
Object.defineProperty(SurveyElement.prototype, "paddingLeft", {
get: function () {
return this.getPropertyValue("paddingLeft", "");
},
set: function (val) {
this.setPropertyValue("paddingLeft", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElement.prototype, "paddingRight", {
get: function () {
return this.getPropertyValue("paddingRight", "");
},
set: function (val) {
this.setPropertyValue("paddingRight", val);
},
enumerable: false,
configurable: true
});
SurveyElement.prototype.updateRootStyle = function () {
var style = {};
var _width;
if (!!this.parent) {
var columns = this.parent.getColumsForElement(this);
_width = columns.reduce(function (sum, col) { return col.effectiveWidth + sum; }, 0);
if (!!_width && _width !== 100) {
style["flexGrow"] = 0;
style["flexShrink"] = 0;
style["flexBasis"] = _width + "%";
style["minWidth"] = undefined;
style["maxWidth"] = undefined;
}
}
if (Object.keys(style).length == 0) {
var minWidth = this.minWidth;
if (minWidth != "auto")
minWidth = "min(100%, " + minWidth + ")";
if (this.allowRootStyle && this.renderWidth) {
// style["width"] = this.renderWidth;
style["flexGrow"] = 1;
style["flexShrink"] = 1;
style["flexBasis"] = this.renderWidth;
style["minWidth"] = minWidth;
style["maxWidth"] = this.maxWidth;
}
}
this.rootStyle = style;
};
SurveyElement.prototype.isContainsSelection = function (el) {
var elementWithSelection = undefined;
var _document = _global_variables_utils__WEBPACK_IMPORTED_MODULE_9__["DomDocumentHelper"].getDocument();
if (_global_variables_utils__WEBPACK_IMPORTED_MODULE_9__["DomDocumentHelper"].isAvailable() && !!_document && _document["selection"]) {
elementWithSelection = _document["selection"].createRange().parentElement();
}
else {
var selection = _global_variables_utils__WEBPACK_IMPORTED_MODULE_9__["DomWindowHelper"].getSelection();
if (!!selection && selection.rangeCount > 0) {
var range = selection.getRangeAt(0);
if (range.startOffset !== range.endOffset) {
elementWithSelection = range.startContainer.parentNode;
}
}
}
return elementWithSelection == el;
};
Object.defineProperty(SurveyElement.prototype, "clickTitleFunction", {
get: function () {
var _this = this;
if (this.needClickTitleFunction()) {
return function (event) {
if (!!event && _this.isContainsSelection(event.target)) {
return;
}
return _this.processTitleClick();
};
}
return undefined;
},
enumerable: false,
configurable: true
});
SurveyElement.prototype.needClickTitleFunction = function () {
return this.state !== "default";
};
SurveyElement.prototype.processTitleClick = function () {
if (this.state !== "default") {
this.toggleState();
}
};
Object.defineProperty(SurveyElement.prototype, "hasAdditionalTitleToolbar", {
get: function () {
return false;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElement.prototype, "additionalTitleToolbar", {
get: function () {
return this.getAdditionalTitleToolbar();
},
enumerable: false,
configurable: true
});
SurveyElement.prototype.getAdditionalTitleToolbar = function () {
return null;
};
SurveyElement.prototype.getCssTitle = function (cssClasses) {
var isExpandable = this.state !== "default";
var numInlineLimit = 4;
return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_6__["CssClassBuilder"]()
.append(cssClasses.title)
.append(cssClasses.titleNumInline, (this.no || "").length > numInlineLimit || isExpandable)
.append(cssClasses.titleExpandable, isExpandable)
.append(cssClasses.titleExpanded, this.isExpanded)
.append(cssClasses.titleCollapsed, this.isCollapsed)
.append(cssClasses.titleDisabled, this.isDisabledStyle)
.append(cssClasses.titleReadOnly, this.isReadOnly)
.append(cssClasses.titleOnError, this.containsErrors).toString();
};
Object.defineProperty(SurveyElement.prototype, "isDisabledStyle", {
get: function () {
return this.getIsDisableAndReadOnlyStyles(false)[1];
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElement.prototype, "isReadOnlyStyle", {
get: function () {
return this.getIsDisableAndReadOnlyStyles(false)[0];
},
enumerable: false,
configurable: true
});
SurveyElement.prototype.getIsDisableAndReadOnlyStyles = function (itemReadOnly) {
var isPreview = this.isPreviewStyle;
var isReadOnly = itemReadOnly || this.isReadOnly;
var isReadOnlyStyle = isReadOnly && !isPreview;
var isDisableStyle = !this.isDefaultV2Theme && (isReadOnly || isPreview);
return [isReadOnlyStyle, isDisableStyle];
};
Object.defineProperty(SurveyElement.prototype, "isPreviewStyle", {
get: function () {
return !!this.survey && this.survey.state === "preview";
},
enumerable: false,
configurable: true
});
SurveyElement.prototype.localeChanged = function () {
_super.prototype.localeChanged.call(this);
this.updateDescriptionVisibility(this.description);
if (this.errors.length > 0) {
this.errors.forEach(function (err) {
err.updateText();
});
}
};
SurveyElement.prototype.setWrapperElement = function (element) {
this.wrapperElement = element;
};
SurveyElement.prototype.getWrapperElement = function () {
return this.wrapperElement;
};
Object.defineProperty(SurveyElement.prototype, "isAnimatingCollapseExpand", {
get: function () {
return this._isAnimatingCollapseExpand || this._renderedIsExpanded != this.isExpanded;
},
set: function (val) {
if (val !== this._isAnimatingCollapseExpand) {
this._isAnimatingCollapseExpand = val;
this.updateElementCss(false);
}
},
enumerable: false,
configurable: true
});
SurveyElement.prototype.onElementExpanded = function (elementIsRendered) {
};
SurveyElement.prototype.getExpandCollapseAnimationOptions = function () {
var _this = this;
var beforeRunAnimation = function (el) {
_this.isAnimatingCollapseExpand = true;
el.style.setProperty("--animation-height", el.offsetHeight + "px");
};
var afterRunAnimation = function (el) {
_this.isAnimatingCollapseExpand = false;
};
return {
getRerenderEvent: function () { return _this.onElementRerendered; },
getEnterOptions: function () {
var cssClasses = _this.isPanel ? _this.cssClasses.panel : _this.cssClasses;
return {
cssClass: cssClasses.contentFadeIn,
onBeforeRunAnimation: beforeRunAnimation,
onAfterRunAnimation: function (el) {
afterRunAnimation(el);
_this.onElementExpanded(true);
},
};
},
getLeaveOptions: function () {
var cssClasses = _this.isPanel ? _this.cssClasses.panel : _this.cssClasses;
return {
cssClass: cssClasses.contentFadeOut,
onBeforeRunAnimation: beforeRunAnimation,
onAfterRunAnimation: afterRunAnimation
};
},
getAnimatedElement: function () {
var _a;
var cssClasses = _this.isPanel ? _this.cssClasses.panel : _this.cssClasses;
if (cssClasses.content) {
var selector = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_8__["classesToSelector"])(cssClasses.content);
if (selector) {
return (_a = _this.getWrapperElement()) === null || _a === void 0 ? void 0 : _a.querySelector(":scope " + selector);
}
}
return undefined;
},
isAnimationEnabled: function () { return _this.isExpandCollapseAnimationEnabled; }
};
};
Object.defineProperty(SurveyElement.prototype, "isExpandCollapseAnimationEnabled", {
get: function () {
return this.animationAllowed && !this.isDesignMode;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyElement.prototype, "renderedIsExpanded", {
get: function () {
return !!this._renderedIsExpanded;
},
set: function (val) {
var oldValue = this._renderedIsExpanded;
this.animationCollapsed.sync(val);
if (!this.isExpandCollapseAnimationEnabled && !oldValue && this.renderedIsExpanded) {
this.onElementExpanded(false);
}
},
enumerable: false,
configurable: true
});
SurveyElement.prototype.getIsAnimationAllowed = function () {
return _super.prototype.getIsAnimationAllowed.call(this) && !!this.survey && !this.survey["isEndLoadingFromJson"];
};
SurveyElement.prototype.dispose = function () {
_super.prototype.dispose.call(this);
if (this.titleToolbarValue) {
this.titleToolbarValue.dispose();
}
};
SurveyElement.CreateDisabledDesignElements = false;
__decorate([
Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: null })
], SurveyElement.prototype, "dragTypeOverMe", void 0);
__decorate([
Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: false })
], SurveyElement.prototype, "isDragMe", void 0);
__decorate([
Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({
onSet: function (newValue, target) {
target.colSpan = newValue;
}
})
], SurveyElement.prototype, "effectiveColSpan", void 0);
__decorate([
Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: false })
], SurveyElement.prototype, "hasVisibleErrors", void 0);
__decorate([
Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: true })
], SurveyElement.prototype, "isSingleInRow", void 0);
__decorate([
Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: true })
], SurveyElement.prototype, "allowRootStyle", void 0);
__decorate([
Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])()
], SurveyElement.prototype, "rootStyle", void 0);
__decorate([
Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])()
], SurveyElement.prototype, "_renderedIsExpanded", void 0);
return SurveyElement;
}(SurveyElementCore));
/***/ }),
/***/ "./src/survey-error.ts":
/*!*****************************!*\
!*** ./src/survey-error.ts ***!
\*****************************/
/*! exports provided: SurveyError */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyError", function() { return SurveyError; });
/* harmony import */ var _localizablestring__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./localizablestring */ "./src/localizablestring.ts");
/* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts");
var SurveyError = /** @class */ (function () {
function SurveyError(text, errorOwner) {
if (text === void 0) { text = null; }
if (errorOwner === void 0) { errorOwner = null; }
this.text = text;
this.errorOwner = errorOwner;
this.visible = true;
this.onUpdateErrorTextCallback = undefined;
}
SurveyError.prototype.equals = function (error) {
if (!error || !error.getErrorType)
return false;
if (this.getErrorType() !== error.getErrorType())
return false;
return this.text === error.text && this.visible === error.visible;
};
Object.defineProperty(SurveyError.prototype, "locText", {
get: function () {
if (!this.locTextValue) {
this.locTextValue = new _localizablestring__WEBPACK_IMPORTED_MODULE_0__["LocalizableString"](this.errorOwner, true);
this.locTextValue.storeDefaultText = true;
this.locTextValue.text = this.getText();
}
return this.locTextValue;
},
enumerable: false,
configurable: true
});
SurveyError.prototype.getText = function () {
var res = this.text;
if (!res)
res = this.getDefaultText();
if (!!this.errorOwner) {
res = this.errorOwner.getErrorCustomText(res, this);
}
return res;
};
SurveyError.prototype.getErrorType = function () {
return "base";
};
SurveyError.prototype.getDefaultText = function () {
return "";
};
SurveyError.prototype.getLocale = function () {
return !!this.errorOwner ? this.errorOwner.getLocale() : "";
};
SurveyError.prototype.getLocalizationString = function (locStrName) {
return _surveyStrings__WEBPACK_IMPORTED_MODULE_1__["surveyLocalization"].getString(locStrName, this.getLocale());
};
SurveyError.prototype.updateText = function () {
if (this.onUpdateErrorTextCallback) {
this.onUpdateErrorTextCallback(this);
}
this.locText.text = this.getText();
};
return SurveyError;
}());
/***/ }),
/***/ "./src/survey-events-api.ts":
/*!**********************************!*\
!*** ./src/survey-events-api.ts ***!
\**********************************/
/*! no exports provided */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/***/ }),
/***/ "./src/survey.ts":
/*!***********************!*\
!*** ./src/survey.ts ***!
\***********************/
/*! exports provided: SurveyModel */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyModel", function() { return SurveyModel; });
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts");
/* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts");
/* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./base */ "./src/base.ts");
/* harmony import */ var _survey_element__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./survey-element */ "./src/survey-element.ts");
/* harmony import */ var _defaultCss_defaultV2Css__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./defaultCss/defaultV2Css */ "./src/defaultCss/defaultV2Css.ts");
/* harmony import */ var _textPreProcessor__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./textPreProcessor */ "./src/textPreProcessor.ts");
/* harmony import */ var _conditionProcessValue__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./conditionProcessValue */ "./src/conditionProcessValue.ts");
/* harmony import */ var _dxSurveyService__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./dxSurveyService */ "./src/dxSurveyService.ts");
/* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts");
/* harmony import */ var _error__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./error */ "./src/error.ts");
/* harmony import */ var _localizablestring__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./localizablestring */ "./src/localizablestring.ts");
/* harmony import */ var _stylesmanager__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./stylesmanager */ "./src/stylesmanager.ts");
/* harmony import */ var _surveyTimerModel__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./surveyTimerModel */ "./src/surveyTimerModel.ts");
/* harmony import */ var _conditions__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./conditions */ "./src/conditions.ts");
/* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./settings */ "./src/settings.ts");
/* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./utils/utils */ "./src/utils/utils.ts");
/* harmony import */ var _actions_action__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./actions/action */ "./src/actions/action.ts");
/* harmony import */ var _actions_container__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./actions/container */ "./src/actions/container.ts");
/* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts");
/* harmony import */ var _notifier__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./notifier */ "./src/notifier.ts");
/* harmony import */ var _header__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./header */ "./src/header.ts");
/* harmony import */ var _surveytimer__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./surveytimer */ "./src/surveytimer.ts");
/* harmony import */ var _surveyTaskManager__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./surveyTaskManager */ "./src/surveyTaskManager.ts");
/* harmony import */ var _progress_buttons__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./progress-buttons */ "./src/progress-buttons.ts");
/* harmony import */ var _surveyToc__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./surveyToc */ "./src/surveyToc.ts");
/* harmony import */ var _global_variables_utils__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./global_variables_utils */ "./src/global_variables_utils.ts");
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
/**
* The `SurveyModel` object contains properties and methods that allow you to control the survey and access its elements.
*
* [View Demo](https://surveyjs.io/form-library/examples/nps-question/ (linkStyle))
*/
var SurveyModel = /** @class */ (function (_super) {
__extends(SurveyModel, _super);
//#endregion
function SurveyModel(jsonObj, renderedElement) {
if (jsonObj === void 0) { jsonObj = null; }
if (renderedElement === void 0) { renderedElement = null; }
var _this = _super.call(this) || this;
_this.valuesHash = {};
_this.variablesHash = {};
//#region Event declarations
/**
* An event that is raised after a [trigger](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#triggers) is executed.
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* [Conditional Survey Logic (Triggers)](https://surveyjs.io/form-library/documentation/design-survey/conditional-logic#conditional-survey-logic-triggers (linkStyle)).
* @see triggers
* @see runTriggers
*/
_this.onTriggerExecuted = _this.addEvent();
/**
* An event that is raised before the survey is completed. Use this event to prevent survey completion.
* @see onComplete
* @see doComplete
* @see allowCompleteSurveyAutomatic
*/
_this.onCompleting = _this.addEvent();
/**
* An event that is raised after the survey is completed. Use this event to send survey results to the server.
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* For an example of how to use the methods described above, refer to the following help topic: [Store Survey Results in Your Own Database](https://surveyjs.io/form-library/documentation/handle-survey-results-store#store-survey-results-in-your-own-database).
*
* > Do not disable the [`showCompletedPage`](https://surveyjs.io/form-library/documentation/surveymodel#showCompletedPage) property if you call one of the `options.showSave...` methods. This is required because the UI that indicates data saving progress is integrated into the complete page. If you hide the complete page, the UI also becomes invisible.
* @see onPartialSend
* @see doComplete
* @see allowCompleteSurveyAutomatic
*/
_this.onComplete = _this.addEvent();
/**
* An event that is raised before the survey displays a [preview of given answers](https://surveyjs.io/form-library/documentation/design-survey/create-a-multi-page-survey#preview-page). Use this event to cancel the preview.
* @see showPreviewBeforeComplete
* @see showPreview
* @see cancelPreview
*/
_this.onShowingPreview = _this.addEvent();
/**
* An event that is raised before the survey navigates to a specified URL. Use this event to change the URL or cancel the navigation.
* @see navigateToUrl
* @see navigateToUrlOnCondition
*/
_this.onNavigateToUrl = _this.addEvent();
/**
* An event that is raised when the survey [`state`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#state) changes to `"running"`.
* @see firstPageIsStarted
*/
_this.onStarted = _this.addEvent();
/**
* An event that is raised to save incomplete survey results. Enable the [`sendResultOnPageNext`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#sendResultOnPageNext) property for this event to occur.
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* Alternatively, you can handle the [`onCurrentPageChanged`](#onCurrentPageChanged) and [`onValueChanged`](#onValueChanged) events, as shown in the following demo: [Continue an Incomplete Survey](https://surveyjs.io/form-library/examples/survey-editprevious/).
*/
_this.onPartialSend = _this.addEvent();
/**
* An event that is raised before the current page is switched.
*
* @see currentPageNo
* @see nextPage
* @see prevPage
**/
_this.onCurrentPageChanging = _this.addEvent();
/**
* An event that is raised after the current page is switched.
*
* @see currentPageNo
* @see nextPage
* @see prevPage
*/
_this.onCurrentPageChanged = _this.addEvent();
/**
* An event that is raised before a question value is changed.
* @see setValue
*/
_this.onValueChanging = _this.addEvent();
/**
* An event that is raised after a question value is changed.
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* To handle value changes in matrix cells or panels within a [Dynamic Panel](https://surveyjs.io/form-library/documentation/api-reference/dynamic-panel-model), use the [`onMatrixCellValueChanged`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onMatrixCellValueChanged) or [`onDynamicPanelItemValueChanged`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onDynamicPanelItemValueChanged) event.
* @see setValue
*/
_this.onValueChanged = _this.addEvent();
/**
* An event that is raised after a [variable](https://surveyjs.io/form-library/documentation/design-survey/conditional-logic#variables) or [calculated value](https://surveyjs.io/form-library/documentation/design-survey/conditional-logic#calculated-values) is changed.
*
* @see setVariable
* @see calculatedValues
*/
_this.onVariableChanged = _this.addEvent();
/**
* An event that is raised after question visibility is changed.
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* Refer to the following help topic for information on how to implement conditional visibility: [Conditional Visibility](https://surveyjs.io/form-library/documentation/design-survey/conditional-logic#conditional-visibility).
*/
_this.onQuestionVisibleChanged = _this.addEvent();
_this.onVisibleChanged = _this.onQuestionVisibleChanged;
/**
* An event that is raised after page visibility is changed.
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* Refer to the following help topic for information on how to implement conditional visibility: [Conditional Visibility](https://surveyjs.io/form-library/documentation/design-survey/conditional-logic#conditional-visibility).
*/
_this.onPageVisibleChanged = _this.addEvent();
/**
* An event that is raised after panel visibility is changed.
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* Refer to the following help topic for information on how to implement conditional visibility: [Conditional Visibility](https://surveyjs.io/form-library/documentation/design-survey/conditional-logic#conditional-visibility).
*/
_this.onPanelVisibleChanged = _this.addEvent();
/**
* An event that is raised when the survey creates any new object derived from [`Question`](https://surveyjs.io/form-library/documentation/api-reference/question).
*
* In a survey, complex elements ([Dynamic Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdynamic/), [Multiple Text](https://surveyjs.io/form-library/examples/questiontype-multipletext/), and [Dynamic Panel](https://surveyjs.io/form-library/examples/questiontype-paneldynamic/)) are composed of questions. Use this event to customize any question regardless of which survey element it belongs to.
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* To use this event for questions loaded from JSON, create an empty survey model, add an event handler, and only then populate the model from the JSON object:
*
* ```js
* import { Model } from "survey-core";
*
* const surveyJson = {
* // ...
* };
* // Create an empty model
* const survey = new Model();
* // Add an event handler
* survey.onQuestionCreated.add((sender, options) => {
* //...
* });
* // Load the survey JSON schema
* survey.fromJSON(surveyJson);
* ```
* @see onQuestionAdded
*/
_this.onQuestionCreated = _this.addEvent();
/**
* An event that is raised when a new question is added to a panel or page.
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* To use this event for questions loaded from JSON, create an empty survey model, add an event handler, and only then populate the model from the JSON object:
*
* ```js
* import { Model } from "survey-core";
*
* const surveyJson = {
* // ...
* };
* // Create an empty model
* const survey = new Model();
* // Add an event handler
* survey.onQuestionAdded.add((sender, options) => {
* //...
* });
* // Load the survey JSON schema
* survey.fromJSON(surveyJson);
* ```
* @see onQuestionCreated
*/
_this.onQuestionAdded = _this.addEvent();
/**
* An event that is raised after a question is deleted from the survey.
*/
_this.onQuestionRemoved = _this.addEvent();
/**
* An event that is raised when a new panel is added to a page.
*/
_this.onPanelAdded = _this.addEvent();
/**
* An event that is raised after a panel is deleted from the survey.
*/
_this.onPanelRemoved = _this.addEvent();
/**
* An event that is raised when a new page is added to the survey.
* @see PanelModel
*/
_this.onPageAdded = _this.addEvent();
/**
* An event that is raised when a question value is being validated. Use this event to specify a custom error message.
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* [View Demo](https://surveyjs.io/form-library/examples/add-custom-input-validation/ (linkStyle))
* @see onServerValidateQuestions
* @see onValidatePanel
* @see onMatrixCellValidate
* @see onSettingQuestionErrors
*/
_this.onValidateQuestion = _this.addEvent();
/**
* An event that is raised before errors are assigned to a question. Use this event to add/remove/modify errors.
* @see onValidateQuestion
*/
_this.onSettingQuestionErrors = _this.addEvent();
/**
* Use this event to validate data on your server.
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* [View Demo](https://surveyjs.io/form-library/examples/javascript-server-side-form-validation/ (linkStyle))
* @see onValidateQuestion
* @see onValidatePanel
* @see isValidatingOnServer
*/
_this.onServerValidateQuestions = _this.addEvent();
/**
* An event that is raised when a panel is being validated. Use this event to specify a custom error message.
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* [View Demo](https://surveyjs.io/form-library/examples/add-custom-input-validation/ (linkStyle))
* @see onValidateQuestion
* @see onServerValidateQuestions
*/
_this.onValidatePanel = _this.addEvent();
/**
* An event that is raised to change default error messages.
*/
_this.onErrorCustomText = _this.addEvent();
/**
* An event that is raised when the [current page](#currentPage) is being validated. Handle this event to be notified of current page validation.
*/
_this.onValidatedErrorsOnCurrentPage = _this.addEvent();
/**
* An event that is raised when the survey processes HTML content. Handle this event to modify HTML content before displaying.
* @see completedHtml
* @see loadingHtml
* @see QuestionHtmlModel.html
*/
_this.onProcessHtml = _this.addEvent();
/**
* Use this event to change a question's display text.
*/
_this.onGetQuestionDisplayValue = _this.addEvent();
/**
* An event that is raised before the survey displays a question title. Handle this event to modify question titles.
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* If you want to modify question numbers, handle the [`onGetQuestionNo`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onGetQuestionNo) event.
* @see requiredText
*/
_this.onGetQuestionTitle = _this.addEvent();
/**
* An event that is raised when the survey calculates heading levels (``, ``, etc.) for a survey, page, panel, and question title. Handle this event to change the heading level of individual titles.
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* If you want to specify heading levels for all titles, use the [`titleTags`](https://surveyjs.io/form-library/documentation/api-reference/settings#titleTags) object in [global settings](https://surveyjs.io/form-library/documentation/api-reference/settings).
*
* [View Demo](https://surveyjs.io/form-library/examples/survey-titletagnames/ (linkStyle))
* @see onGetQuestionTitle
* @see onGetQuestionNo
*/
_this.onGetTitleTagName = _this.addEvent();
/**
* An event that is raised before the survey calculates a question number. Handle this event to modify question numbers.
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* If you want to hide question numbers, disable the [`showQuestionNumbers`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#showQuestionNumbers) property.
* @see onGetQuestionTitle
* @see questionStartIndex
*/
_this.onGetQuestionNo = _this.addEvent();
/**
* An event that is raised before the survey displays progress text. Handle this event to change the progress text in code.
* @see showProgressBar
* @see progressBarType
*/
_this.onProgressText = _this.addEvent();
/**
* An event that is raised to convert Markdown content to HTML.
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* [View Demo](https://surveyjs.io/form-library/examples/edit-survey-questions-markdown/ (linkStyle))
*/
_this.onTextMarkdown = _this.addEvent();
_this.onTextRenderAs = _this.addEvent();
/**
* An event that is raised after a request to save survey results on [SurveyJS Service](https://api.surveyjs.io/) has been completed. Use this event to find out if the results have been saved successfully.
*/
_this.onSendResult = _this.addEvent();
/**
* An event that is raised when the [`getResult(resultId, questionName)`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#getResult) method is called. Use this event to obtain answers to an individual question from [SurveyJS Service](https://api.surveyjs.io/).
* @see getResult
*/
_this.onGetResult = _this.addEvent();
/**
* An event that is raised when Survey Creator opens a dialog window for users to select files.
* @see onUploadFile
* @see uploadFiles
*/
_this.onOpenFileChooser = _this.addEvent();
/**
* An event that is raised when a File Upload or Signature Pad question starts to upload a file. Applies only if [`storeDataAsText`](https://surveyjs.io/form-library/documentation/api-reference/file-model#storeDataAsText) is `false`. Use this event to upload files to your server.
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* [View Demo](https://surveyjs.io/form-library/examples/file-upload/ (linkStyle))
* @see uploadFiles
* @see onDownloadFile
* @see onClearFiles
*/
_this.onUploadFiles = _this.addEvent();
/**
* An event that is raised when a File Upload question starts to download a file. Use this event to implement file preview when your server stores only file names.
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* [View Demo](https://surveyjs.io/form-library/examples/store-file-names-in-survey-results/ (linkStyle))
* @see downloadFile
* @see onClearFiles
* @see onUploadFiles
*/
_this.onDownloadFile = _this.addEvent();
/**
* An event that is raised when users clear files in a [File Upload](https://surveyjs.io/form-library/documentation/api-reference/file-model) question or clear signature in a [Signature Pad](https://surveyjs.io/form-library/documentation/api-reference/signature-pad-model) question. Use this event to delete files from your server.
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* [View Demo](https://surveyjs.io/form-library/examples/file-delayed-upload/ (linkStyle))
* @see clearFiles
* @see onDownloadFile
* @see onUploadFiles
*/
_this.onClearFiles = _this.addEvent();
/**
* An event that is raised after choices are loaded from a server but before they are assigned to a choice-based question, such as [Dropdown](https://surveyjs.io/form-library/documentation/api-reference/dropdown-menu-model) or [Checkboxes](https://surveyjs.io/form-library/documentation/api-reference/checkbox-question-model). Handle this event if you need to modify the loaded choices.
*/
_this.onLoadChoicesFromServer = _this.addEvent();
/**
* An event that is raised after a survey JSON schema is loaded from the [SurveyJS Service](https://api.surveyjs.io). Use this event to modify the loaded schema.
* @see surveyId
* @see clientId
* @see loadSurveyFromService
*/
_this.onLoadedSurveyFromService = _this.addEvent();
/**
* An event that is raised when the survey processes [dynamic texts](https://surveyjs.io/form-library/documentation/design-survey/conditional-logic#dynamic-texts) and any text in curly brackets. Use this event, for instance, to substitute parameters in a RESTful URL with real values when you [load choices by URL](https://surveyjs.io/form-library/documentation/api-reference/checkbox-question-model#choicesByUrl).
*/
_this.onProcessTextValue = _this.addEvent();
/**
* An event that is raised before rendering a question. Use it to override default question CSS classes.
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* [View Demo](https://surveyjs.io/form-library/examples/customize-survey-with-css/ (linkStyle))
* @see css
*/
_this.onUpdateQuestionCssClasses = _this.addEvent();
/**
* An event that is raised before rendering a standalone panel and panels within [Dynamic Panel](https://surveyjs.io/form-library/examples/duplicate-group-of-fields-in-form/). Use it to override default panel CSS classes.
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* [View Demo](https://surveyjs.io/form-library/examples/customize-survey-with-css/ (linkStyle))
* @see css
*/
_this.onUpdatePanelCssClasses = _this.addEvent();
/**
* An event that is raised before rendering a page. Use it to override default page CSS classes.
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* [View Demo](https://surveyjs.io/form-library/examples/customize-survey-with-css/ (linkStyle))
* @see css
*/
_this.onUpdatePageCssClasses = _this.addEvent();
/**
* An event that is raised before rendering a choice item in Radio Button Group and Checkboxes questions. Use it to override default CSS classes applied to choice items.
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* [View Demo](https://surveyjs.io/form-library/examples/customize-survey-with-css/ (linkStyle))
* @see css
*/
_this.onUpdateChoiceItemCss = _this.addEvent();
/**
* An event that is raised after the survey is rendered to the DOM. Use this event to modify survey markup.
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* [View Demo](https://surveyjs.io/form-library/examples/survey-animation/ (linkStyle))
*/
_this.onAfterRenderSurvey = _this.addEvent();
_this.onAfterRenderHeader = _this.addEvent();
/**
* An event that is raised after a page is rendered to the DOM. Use it to modify page markup.
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* [View Demo](https://surveyjs.io/form-library/examples/survey-afterrender/ (linkStyle))
*/
_this.onAfterRenderPage = _this.addEvent();
/**
* An event that is raised after a question is rendered to the DOM. Use it to modify question markup.
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* [View Demo](https://surveyjs.io/form-library/examples/survey-afterrender/ (linkStyle))
*/
_this.onAfterRenderQuestion = _this.addEvent();
/**
* An event that is raised after a question with a single input field is rendered to the DOM. Use it to modify question markup.
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* > This event is not raised for questions without input fields ([HTML](https://surveyjs.io/form-library/documentation/questionhtmlmodel), [Image](https://surveyjs.io/form-library/documentation/questionimagemodel)) or questions with multiple input fields ([Matrix](https://surveyjs.io/form-library/documentation/questionmatrixmodel), [Multiple Text](https://surveyjs.io/form-library/documentation/questionmultipletextmodel)).
*/
_this.onAfterRenderQuestionInput = _this.addEvent();
/**
* An event that is raised after a panel is rendered to the DOM. Use it to modify panel markup.
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* > This event is raised for static [Panels](https://surveyjs.io/form-library/examples/set-properties-on-multiple-questions-using-panel/) as well as panels within a [Dynamic Panel](https://surveyjs.io/form-library/examples/duplicate-group-of-fields-in-form/).
*/
_this.onAfterRenderPanel = _this.addEvent();
/**
* An event that is raised when an element (input field, checkbox, radio button) within a question gets focus.
* @see onFocusInPanel
* @see focusFirstQuestionAutomatic
* @see focusQuestion
*/
_this.onFocusInQuestion = _this.addEvent();
/**
* An event that is raised when an element within a panel gets focus.
* @see onFocusInQuestion
* @see focusFirstQuestionAutomatic
* @see focusQuestion
*/
_this.onFocusInPanel = _this.addEvent();
/**
* An event that is raised before a [choice item](https://surveyjs.io/form-library/documentation/api-reference/questionselectbase#choices) is displayed. Use this event to change the visibility of individual choice items in [Checkboxes](https://surveyjs.io/form-library/documentation/api-reference/checkbox-question-model), [Dropdown](https://surveyjs.io/form-library/documentation/api-reference/dropdown-menu-model), [Radio Button Group](https://surveyjs.io/form-library/documentation/api-reference/radio-button-question-model), and other similar question types.
*/
_this.onShowingChoiceItem = _this.addEvent();
/**
* Use this event to load choice items in [Dropdown](https://surveyjs.io/form-library/documentation/questiondropdownmodel) and [Tag Box](https://surveyjs.io/form-library/documentation/questiontagboxmodel) questions on demand.
*
* This event is raised only for those questions that have the [`choicesLazyLoadEnabled`](https://surveyjs.io/form-library/documentation/questiondropdownmodel#choicesLazyLoadEnabled) property set to `true`.
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* [View Demo](https://surveyjs.io/form-library/examples/lazy-loading-dropdown/ (linkStyle))
*/
_this.onChoicesLazyLoad = _this.addEvent();
/**
* An event that is raised each time a search string in a [Dropdown](https://surveyjs.io/form-library/documentation/api-reference/dropdown-menu-model) or [Tag Box](https://surveyjs.io/form-library/documentation/api-reference/dropdown-tag-box-model) question changes. Use this event to implement custom filtering of choice options.
* @see [QuestionDropdownModel.searchEnabled](https://surveyjs.io/form-library/documentation/api-reference/dropdown-menu-model#searchEnabled)
* @see [QuestionDropdownModel.searchMode](https://surveyjs.io/form-library/documentation/api-reference/dropdown-menu-model#searchMode)
*/
_this.onChoicesSearch = _this.addEvent();
/**
* Use this event to load a display text for the [default choice item](https://surveyjs.io/form-library/documentation/questiondropdownmodel#defaultValue) in [Dropdown](https://surveyjs.io/form-library/documentation/questiondropdownmodel) and [Tag Box](https://surveyjs.io/form-library/documentation/questiontagboxmodel) questions.
*
* If you load choices from a server (use [`choicesByUrl`](https://surveyjs.io/form-library/documentation/questiondropdownmodel#choicesByUrl) or [`onChoicesLazyLoad`](https://surveyjs.io/form-library/documentation/surveymodel#onChoicesLazyLoad)), display texts become available only when data is loaded, which does not happen until a user opens the drop-down menu. However, a display text for a default choice item is required before that. In this case, you can load data individually for the default item within the `onGetChoiceDisplayValue` event handler.
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* [View Demo](https://surveyjs.io/form-library/examples/lazy-loading-dropdown/ (linkStyle))
*/
_this.onGetChoiceDisplayValue = _this.addEvent();
/**
* An event that is raised after a new row is added to a [Dynamic Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdynamic/).
*/
_this.onMatrixRowAdded = _this.addEvent();
/**
* An event that is raised before a new row is added to a [Dynamic Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdynamic/).
*/
_this.onMatrixRowAdding = _this.addEvent();
/**
* This event is obsolete. Use the [`onMatrixRowAdding`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onMatrixRowAdding) event instead.
*/
_this.onMatrixBeforeRowAdded = _this.onMatrixRowAdding;
/**
* An event that is raised before a row is deleted from a [Dynamic Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdynamic/). You can cancel row deletion and clear row data instead.
* @see onMatrixRenderRemoveButton
*/
_this.onMatrixRowRemoving = _this.addEvent();
/**
* An event that is raised after a row is deleted from a [Dynamic Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdynamic/).
* @see onMatrixRenderRemoveButton
*/
_this.onMatrixRowRemoved = _this.addEvent();
/**
* An event that is raised before rendering the Remove button in a row of a [Dynamic Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdynamic/). Use this event to hide the Remove button for individual matrix rows.
* @see onMatrixRowRemoving
* @see onMatrixRowRemoved
*/
_this.onMatrixRenderRemoveButton = _this.addEvent();
/**
* This event is obsolete. Use the [`onMatrixRenderRemoveButton`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onMatrixRenderRemoveButton) event instead.
*/
_this.onMatrixAllowRemoveRow = _this.onMatrixRenderRemoveButton;
/**
* An event that is raised after the visibility of an [expandable detail section](https://surveyjs.io/form-library/examples/add-expandable-details-section-under-matrix-rows/) is changed. This event can be raised for [Multi-Select](https://surveyjs.io/form-library/documentation/api-reference/matrix-table-with-dropdown-list) and [Dynamic Matrix](https://surveyjs.io/form-library/documentation/api-reference/dynamic-matrix-table-question-model) questions.
*/
_this.onMatrixDetailPanelVisibleChanged = _this.addEvent();
/**
* An event that is raised before a cell in a [Multi-Select Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdropdown/) or [Dynamic Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdynamic/) is created. Use this event to change the type of individual matrix cells.
* @see onAfterRenderMatrixCell
*/
_this.onMatrixCellCreating = _this.addEvent();
/**
* An event that is raised after a cell in a [Multi-Select Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdropdown/) or [Dynamic Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdynamic/) is created.
* @see onAfterRenderMatrixCell
*/
_this.onMatrixCellCreated = _this.addEvent();
/**
* An event that is raised for every matrix cell after it is rendered to the DOM.
* @see onMatrixCellCreated
*/
_this.onAfterRenderMatrixCell = _this.addEvent();
/**
* This event is obsolete. Use the [`onAfterRenderMatrixCell`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onAfterRenderMatrixCell) event instead.
*/
_this.onMatrixAfterCellRender = _this.onAfterRenderMatrixCell;
/**
* An event that is raised after a cell value is changed in a [Multi-Select Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdropdown/) or [Dynamic Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdynamic/).
* @see onMatrixRowAdding
*/
_this.onMatrixCellValueChanged = _this.addEvent();
/**
* An event that is raised before a cell value is changed in a [Multi-Select Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdropdown/) or [Dynamic Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdynamic/). Use this event to change the cell value.
* @see onMatrixRowAdding
*/
_this.onMatrixCellValueChanging = _this.addEvent();
/**
* An event that is raised for [Multi-Select Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdropdown/) and [Dynamic Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdynamic/) questions when they validate a cell value. Use this event to display a custom error message based on a condition.
* @see onMatrixRowAdding
*/
_this.onMatrixCellValidate = _this.addEvent();
/**
* An event that is raised after a new column is added to a [Multi-Select Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdropdown/) or [Dynamic Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdynamic/).
*/
_this.onMatrixColumnAdded = _this.addEvent();
/**
* An event that is raised on adding a new item in Multiple Text question.
*/
_this.onMultipleTextItemAdded = _this.addEvent();
/**
* An event that is raised after a new panel is added to a [Dynamic Panel](https://surveyjs.io/form-library/examples/questiontype-paneldynamic/) question.
*/
_this.onDynamicPanelAdded = _this.addEvent();
/**
* An event that is raised after a panel is deleted from a [Dynamic Panel](https://surveyjs.io/form-library/examples/questiontype-paneldynamic/) question.
*/
_this.onDynamicPanelRemoved = _this.addEvent();
/**
* An event that is raised before a panel is deleted from a [Dynamic Panel](https://surveyjs.io/form-library/examples/questiontype-paneldynamic/) question. Use this event to cancel the deletion.
*/
_this.onDynamicPanelRemoving = _this.addEvent();
/**
* An event that is raised every second while the timer is running.
*
* Use the [`timeSpent`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#timeSpent) property to find out how many seconds have elapsed.
* @see maxTimeToFinish
* @see maxTimeToFinishPage
* @see showTimerPanel
* @see startTimer
*/
_this.onTimer = _this.addEvent();
_this.onTimerPanelInfoText = _this.addEvent();
/**
* An event that is raised after an item value is changed in a panel within a [Dynamic Panel](https://surveyjs.io/form-library/examples/questiontype-paneldynamic/) question.
*/
_this.onDynamicPanelItemValueChanged = _this.addEvent();
/**
* An event that is raised before a [Dynamic Panel](https://surveyjs.io/form-library/examples/questiontype-paneldynamic/) renders [tab titles](https://surveyjs.io/form-library/documentation/api-reference/dynamic-panel-model#templateTabTitle). Use this event to change individual tab titles.
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* [View Demo](https://surveyjs.io/form-library/examples/tabbed-interface-for-duplicate-group-option/ (linkStyle))
*/
_this.onGetDynamicPanelTabTitle = _this.addEvent();
/**
* An event that is raised after the current panel is changed in a [Dynamic Panel](https://surveyjs.io/form-library/examples/questiontype-paneldynamic/) question.
*/
_this.onDynamicPanelCurrentIndexChanged = _this.addEvent();
/**
* An event that is raised to define whether a question answer is correct. Applies only to [quiz surveys](https://surveyjs.io/form-library/documentation/design-survey/create-a-quiz).
*/
_this.onIsAnswerCorrect = _this.addEvent();
/**
* An event that is raised when users drag and drop survey elements while designing the survey in [Survey Creator](https://surveyjs.io/survey-creator/documentation/overview). Use this event to control drag and drop operations.
* @see isDesignMode
*/
_this.onDragDropAllow = _this.addEvent();
/**
* An event this is raised before a survey element (usually page) is scrolled to the top. Use this event to cancel the scroll operation.
*/
_this.onScrollingElementToTop = _this.addEvent();
_this.onLocaleChangedEvent = _this.addEvent();
/**
* An event that allows you to add, delete, or modify actions in a question title.
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* [View Demo](https://surveyjs.io/form-library/examples/survey-titleactions/ (linkStyle))
* @see [IAction](https://surveyjs.io/form-library/documentation/api-reference/iaction)
*/
_this.onGetQuestionTitleActions = _this.addEvent();
/**
* An event that allows you to add, delete, or modify actions in a panel title.
* @see [IAction](https://surveyjs.io/form-library/documentation/api-reference/iaction)
*/
_this.onGetPanelTitleActions = _this.addEvent();
/**
* An event that allows you to add, delete, or modify actions in a page title.
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* [View Demo](https://surveyjs.io/form-library/examples/modify-titles-of-survey-elements/ (linkStyle))
* @see [IAction](https://surveyjs.io/form-library/documentation/api-reference/iaction)
*/
_this.onGetPageTitleActions = _this.addEvent();
/**
* An event that allows you to add, delete, or modify actions in the footer of a [Panel](https://surveyjs.io/form-library/documentation/panelmodel).
* @see [IAction](https://surveyjs.io/form-library/documentation/api-reference/iaction)
*/
_this.onGetPanelFooterActions = _this.addEvent();
/**
* An event that allows you to add, delete, or modify actions in rows of a [Dynamic Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdynamic/).
*
* For information on event handler parameters, refer to descriptions within the interface.
*
* [View Demo](https://surveyjs.io/form-library/examples/employee-information-form/ (linkStyle))
* @see [IAction](https://surveyjs.io/form-library/documentation/api-reference/iaction)
*/
_this.onGetMatrixRowActions = _this.addEvent();
/**
* An event that is raised after a survey element is [expanded or collapsed](https://surveyjs.io/form-library/documentation/api-reference/question#state).
*/
_this.onElementContentVisibilityChanged = _this.addEvent();
/**
* An event that is raised before an [Expression](https://surveyjs.io/form-library/documentation/api-reference/expression-model) question displays a value. Use this event to override the display value.
*/
_this.onGetExpressionDisplayValue = _this.addEvent();
/**
* An event that is raised after the visibility of a popup is changed. This event can be raised for [Single-](https://surveyjs.io/form-library/documentation/api-reference/dropdown-menu-model) and [Multi-Select Dropdown](https://surveyjs.io/form-library/documentation/api-reference/dropdown-tag-box-model) questions and [Rating](https://surveyjs.io/form-library/documentation/api-reference/rating-scale-question-model) questions [rendered as drop-down menus](https://surveyjs.io/form-library/documentation/api-reference/rating-scale-question-model#displayMode).
*/
_this.onPopupVisibleChanged = _this.addEvent();
_this.onElementWrapperComponentName = _this.addEvent();
_this.onElementWrapperComponentData = _this.addEvent();
/**
* A list of errors in a survey JSON schema.
* @see ensureUniqueNames
*/
_this.jsonErrors = null;
_this.cssValue = null;
/**
* Specifies whether to hide validation errors thrown by the Required validation in the UI.
*
* [Built-In Client-Side Validators](https://surveyjs.io/form-library/documentation/data-validation#built-in-client-side-validators (linkStyle))
* @see validationEnabled
* @see validationAllowSwitchPages
*/
_this.hideRequiredErrors = false;
//#endregion
_this.cssVariables = {};
_this._isMobile = false;
_this._isCompact = false;
_this._isDesignMode = false;
/**
* Specifies whether data validation is enabled.
*
* Default value: `true`
* @see checkErrorsMode
* @see hideRequiredErrors
*/
_this.validationEnabled = true;
/**
* Specifies whether respondents can switch the current page even if it contains validation errors.
*
* Default value: `false`
* @see checkErrorsMode
*/
_this.validationAllowSwitchPages = false;
/**
* Specifies whether respondents can end a survey with validation errors.
*
* Default value: `false`
* @see checkErrorsMode
*/
_this.validationAllowComplete = false;
_this.isNavigationButtonPressed = false;
_this.mouseDownPage = null;
_this.isCalculatingProgressText = false;
_this.isCurrentPageRendering = true;
_this.isCurrentPageRendered = undefined;
_this.isTriggerIsRunning = false;
_this.triggerValues = null;
_this.triggerKeys = null;
_this.conditionValues = null;
_this.isValueChangedOnRunningCondition = false;
_this.conditionRunnerCounter = 0;
_this.conditionUpdateVisibleIndexes = false;
_this.conditionNotifyElementsOnAnyValueOrVariableChanged = false;
_this.isEndLoadingFromJson = null;
_this.questionHashes = {
names: {},
namesInsensitive: {},
valueNames: {},
valueNamesInsensitive: {},
};
_this.needRenderIcons = true;
_this.skippedPages = [];
_this.skeletonComponentName = "sv-skeleton";
_this.taskManager = new _surveyTaskManager__WEBPACK_IMPORTED_MODULE_22__["SurveyTaskManagerModel"]();
_this.questionErrorComponent = "sv-question-error";
if (_global_variables_utils__WEBPACK_IMPORTED_MODULE_25__["DomDocumentHelper"].isAvailable()) {
SurveyModel.stylesManager = new _stylesmanager__WEBPACK_IMPORTED_MODULE_11__["StylesManager"]();
}
var htmlCallBack = function (str) { return "" + str + "
"; };
_this.createHtmlLocString("completedHtml", "completingSurvey", htmlCallBack);
_this.createHtmlLocString("completedBeforeHtml", "completingSurveyBefore", htmlCallBack, "completed-before");
_this.createHtmlLocString("loadingHtml", "loadingSurvey", htmlCallBack, "loading");
_this.createLocalizableString("emptySurveyText", _this, true, "emptySurvey");
_this.createLocalizableString("logo", _this, false);
_this.createLocalizableString("startSurveyText", _this, false, true);
_this.createLocalizableString("pagePrevText", _this, false, true);
_this.createLocalizableString("pageNextText", _this, false, true);
_this.createLocalizableString("completeText", _this, false, true);
_this.createLocalizableString("previewText", _this, false, true);
_this.createLocalizableString("editText", _this, false, true);
_this.createLocalizableString("questionTitleTemplate", _this, true);
_this.timerModelValue = new _surveyTimerModel__WEBPACK_IMPORTED_MODULE_12__["SurveyTimerModel"](_this);
_this.timerModelValue.onTimer = function (page) {
_this.doTimer(page);
};
_this.createNewArray("pages", function (value) {
_this.doOnPageAdded(value);
}, function (value) {
_this.doOnPageRemoved(value);
});
_this.createNewArray("triggers", function (value) {
value.setOwner(_this);
});
_this.createNewArray("calculatedValues", function (value) {
value.setOwner(_this);
});
_this.createNewArray("completedHtmlOnCondition", function (value) {
value.locOwner = _this;
});
_this.createNewArray("navigateToUrlOnCondition", function (value) {
value.locOwner = _this;
});
_this.registerPropertyChangedHandlers(["locale"], function () {
_this.onSurveyLocaleChanged();
});
_this.registerPropertyChangedHandlers(["firstPageIsStarted"], function () {
_this.onFirstPageIsStartedChanged();
});
_this.registerPropertyChangedHandlers(["mode"], function () {
_this.onModeChanged();
});
_this.registerPropertyChangedHandlers(["progressBarType"], function () {
_this.updateProgressText();
});
_this.registerPropertyChangedHandlers(["questionStartIndex", "requiredText", "questionTitlePattern"], function () {
_this.resetVisibleIndexes();
});
_this.registerPropertyChangedHandlers(["isLoading", "isCompleted", "isCompletedBefore", "mode", "isStartedState", "currentPage", "isShowingPreview"], function () { _this.updateState(); });
_this.registerPropertyChangedHandlers(["state", "currentPage", "showPreviewBeforeComplete"], function () { _this.onStateAndCurrentPageChanged(); });
_this.registerPropertyChangedHandlers(["logo", "logoPosition"], function () { _this.updateHasLogo(); });
_this.registerPropertyChangedHandlers(["backgroundImage"], function () { _this.updateRenderBackgroundImage(); });
_this.registerPropertyChangedHandlers(["renderBackgroundImage", "backgroundOpacity", "backgroundImageFit", "fitToContainer", "backgroundImageAttachment"], function () {
_this.updateBackgroundImageStyle();
});
_this.registerPropertyChangedHandlers(["showPrevButton", "showCompleteButton"], function () { _this.updateButtonsVisibility(); });
_this.onGetQuestionNo.onCallbacksChanged = function () {
_this.resetVisibleIndexes();
};
_this.onProgressText.onCallbacksChanged = function () {
_this.updateProgressText();
};
_this.onTextMarkdown.onCallbacksChanged = function () {
_this.locStrsChanged();
};
_this.onProcessHtml.onCallbacksChanged = function () {
_this.locStrsChanged();
};
_this.onGetQuestionTitle.onCallbacksChanged = function () {
_this.locStrsChanged();
};
_this.onUpdatePageCssClasses.onCallbacksChanged = function () {
_this.currentPage && _this.currentPage.updateElementCss();
};
_this.onUpdatePanelCssClasses.onCallbacksChanged = function () {
_this.currentPage && _this.currentPage.updateElementCss();
};
_this.onUpdateQuestionCssClasses.onCallbacksChanged = function () {
_this.currentPage && _this.currentPage.updateElementCss();
};
_this.onShowingChoiceItem.onCallbacksChanged = function () {
_this.rebuildQuestionChoices();
};
_this.navigationBarValue = _this.createNavigationBar();
_this.navigationBar.locOwner = _this;
_this.onBeforeCreating();
if (jsonObj) {
if (typeof jsonObj === "string" || jsonObj instanceof String) {
jsonObj = JSON.parse(jsonObj);
}
if (jsonObj && jsonObj.clientId) {
_this.clientId = jsonObj.clientId;
}
_this.fromJSON(jsonObj);
if (_this.surveyId) {
_this.loadSurveyFromService(_this.surveyId, _this.clientId);
}
}
_this.onCreating();
if (!!renderedElement) {
_this.render(renderedElement);
}
_this.updateCss();
_this.setCalculatedWidthModeUpdater();
_this.notifier = new _notifier__WEBPACK_IMPORTED_MODULE_19__["Notifier"](_this.css.saveData);
_this.notifier.addAction(_this.createTryAgainAction(), "error");
_this.onPopupVisibleChanged.add(function (_, opt) {
if (opt.visible) {
_this.onScrollCallback = function () {
opt.popup.hide();
};
}
else {
_this.onScrollCallback = undefined;
}
});
_this.progressBarValue = new _progress_buttons__WEBPACK_IMPORTED_MODULE_23__["ProgressButtons"](_this);
_this.layoutElements.push({
id: "timerpanel",
template: "survey-timerpanel",
component: "sv-timerpanel",
data: _this.timerModel
});
_this.layoutElements.push({
id: "progress-buttons",
component: "sv-progress-buttons",
data: _this.progressBar,
processResponsiveness: function (width) { return _this.progressBar.processResponsiveness && _this.progressBar.processResponsiveness(width); }
});
_this.layoutElements.push({
id: "progress-questions",
component: "sv-progress-questions",
data: _this
});
_this.layoutElements.push({
id: "progress-pages",
component: "sv-progress-pages",
data: _this
});
_this.layoutElements.push({
id: "progress-correctquestions",
component: "sv-progress-correctquestions",
data: _this
});
_this.layoutElements.push({
id: "progress-requiredquestions",
component: "sv-progress-requiredquestions",
data: _this
});
var tocModel = new _surveyToc__WEBPACK_IMPORTED_MODULE_24__["TOCModel"](_this);
_this.addLayoutElement({
id: "toc-navigation",
component: "sv-navigation-toc",
data: tocModel,
processResponsiveness: function (width) { return tocModel.updateStickyTOCSize(_this.rootElement); }
});
_this.layoutElements.push({
id: "buttons-navigation",
component: "sv-action-bar",
data: _this.navigationBar
});
_this.locTitle.onStringChanged.add(function () { return _this.titleIsEmpty = _this.locTitle.isEmpty; });
return _this;
}
Object.defineProperty(SurveyModel, "cssType", {
get: function () {
return _defaultCss_defaultV2Css__WEBPACK_IMPORTED_MODULE_4__["surveyCss"].currentType;
},
set: function (value) {
_stylesmanager__WEBPACK_IMPORTED_MODULE_11__["StylesManager"].applyTheme(value);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "platformName", {
get: function () {
return SurveyModel.platform;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "commentSuffix", {
/**
* A suffix added to the name of the property that stores comments.
*
* Default value: "-Comment"
*
* Many question types allow respondents to leave comments. To enable this functionality, set a question's [`showCommentArea`](https://surveyjs.io/form-library/documentation/api-reference/checkbox-question-model#showCommentArea) property to `true`. Comment values are saved in a separate property. The property name is composed of the question `name` and `commentSuffix`.
*
* Respondents can also leave comments when they select "Other" in choice-based questions, such as Dropdown or Checkboxes. The property name for the comment value is composed according to the same rules. However, you can use the question `name` as a key to store the comment value instead. Disable the [`storeOthersAsComment`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#storeOthersAsComment) property in this case.
*
* [View Demo](https://surveyjs.io/form-library/examples/create-checkboxes-question-in-javascript/ (linkStyle))
*/
get: function () {
return _settings__WEBPACK_IMPORTED_MODULE_14__["settings"].commentSuffix;
},
set: function (val) {
_settings__WEBPACK_IMPORTED_MODULE_14__["settings"].commentSuffix = val;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "commentPrefix", {
get: function () {
return this.commentSuffix;
},
set: function (val) {
this.commentSuffix = val;
},
enumerable: false,
configurable: true
});
SurveyModel.prototype.processClosedPopup = function (question, popupModel) {
throw new Error("Method not implemented.");
};
SurveyModel.prototype.createTryAgainAction = function () {
var _this = this;
return {
id: "save-again",
title: this.getLocalizationString("saveAgainButton"),
action: function () {
if (_this.isCompleted) {
_this.saveDataOnComplete();
}
else {
_this.doComplete();
}
}
};
};
SurveyModel.prototype.createHtmlLocString = function (name, locName, func, reason) {
var _this = this;
var res = this.createLocalizableString(name, this, false, locName);
res.onGetLocalizationTextCallback = func;
if (reason) {
res.onGetTextCallback = function (str) { return _this.processHtml(str, reason); };
}
};
SurveyModel.prototype.getType = function () {
return "survey";
};
SurveyModel.prototype.onPropertyValueChanged = function (name, oldValue, newValue) {
if (name === "questionsOnPageMode") {
this.onQuestionsOnPageModeChanged(oldValue);
}
};
Object.defineProperty(SurveyModel.prototype, "pages", {
/**
* Returns an array of all pages in the survey.
*
* To get an array of only visible pages, use the [`visiblePages`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#visiblePages) array.
* @see PageModel
*/
get: function () {
return this.getPropertyValue("pages");
},
enumerable: false,
configurable: true
});
SurveyModel.prototype.render = function (element) {
if (element === void 0) { element = null; }
if (this.renderCallback) {
this.renderCallback();
}
};
SurveyModel.prototype.updateSurvey = function (newProps, oldProps) {
var _loop_1 = function () {
if (key == "model" || key == "children")
return "continue";
if (key.indexOf("on") == 0 && this_1[key] && this_1[key].add) {
var funcBody_1 = newProps[key];
var func = function (sender, options) {
funcBody_1(sender, options);
};
this_1[key].add(func);
}
else {
this_1[key] = newProps[key];
}
};
var this_1 = this;
for (var key in newProps) {
_loop_1();
}
if (newProps && newProps.data)
this.onValueChanged.add(function (sender, options) {
newProps.data[options.name] = options.value;
});
};
SurveyModel.prototype.getCss = function () {
return this.css;
};
SurveyModel.prototype.updateCompletedPageCss = function () {
this.containerCss = this.css.container;
this.completedCss = new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_18__["CssClassBuilder"]().append(this.css.body)
.append(this.css.completedPage).toString(); // for completed page
this.completedBeforeCss = new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_18__["CssClassBuilder"]()
.append(this.css.body)
.append(this.css.completedBeforePage)
.toString();
this.loadingBodyCss = new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_18__["CssClassBuilder"]()
.append(this.css.body)
.append(this.css.bodyLoading)
.toString();
};
SurveyModel.prototype.updateCss = function () {
this.rootCss = this.getRootCss();
this.updateNavigationCss();
this.updateCompletedPageCss();
this.updateWrapperFormCss();
};
Object.defineProperty(SurveyModel.prototype, "css", {
/**
* Gets or sets an object in which keys are UI elements and values are CSS classes applied to them.
*
* [View Demo](https://surveyjs.io/form-library/examples/customize-survey-with-css/ (linkStyle))
*/
get: function () {
if (!this.cssValue) {
this.cssValue = {};
this.copyCssClasses(this.cssValue, _defaultCss_defaultV2Css__WEBPACK_IMPORTED_MODULE_4__["surveyCss"].getCss());
}
return this.cssValue;
},
set: function (value) {
this.setCss(value);
},
enumerable: false,
configurable: true
});
SurveyModel.prototype.setCss = function (value, needMerge) {
if (needMerge === void 0) { needMerge = true; }
if (needMerge) {
this.mergeValues(value, this.css);
}
else {
this.cssValue = value;
}
this.updateCss();
this.updateElementCss(false);
};
Object.defineProperty(SurveyModel.prototype, "cssTitle", {
get: function () {
return this.css.title;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "cssNavigationComplete", {
get: function () {
return this.getNavigationCss(this.cssSurveyNavigationButton, this.css.navigation.complete);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "cssNavigationPreview", {
get: function () {
return this.getNavigationCss(this.cssSurveyNavigationButton, this.css.navigation.preview);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "cssNavigationEdit", {
get: function () {
return this.getNavigationCss(this.css.navigationButton, this.css.navigation.edit);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "cssNavigationPrev", {
get: function () {
return this.getNavigationCss(this.cssSurveyNavigationButton, this.css.navigation.prev);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "cssNavigationStart", {
get: function () {
return this.getNavigationCss(this.cssSurveyNavigationButton, this.css.navigation.start);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "cssNavigationNext", {
get: function () {
return this.getNavigationCss(this.cssSurveyNavigationButton, this.css.navigation.next);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "cssSurveyNavigationButton", {
get: function () {
return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_18__["CssClassBuilder"]().append(this.css.navigationButton).append(this.css.bodyNavigationButton).toString();
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "bodyCss", {
get: function () {
return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_18__["CssClassBuilder"]().append(this.css.body)
.append(this.css.bodyWithTimer, this.showTimerPanel != "none" && this.state === "running")
.append(this.css.body + "--" + this.calculatedWidthMode).toString();
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "bodyContainerCss", {
get: function () {
return this.css.bodyContainer;
},
enumerable: false,
configurable: true
});
SurveyModel.prototype.insertAdvancedHeader = function (advHeader) {
advHeader.survey = this;
this.layoutElements.push({
id: "advanced-header",
container: "header",
component: "sv-header",
index: -100,
data: advHeader,
processResponsiveness: function (width) { return advHeader.processResponsiveness(width); }
});
};
SurveyModel.prototype.getNavigationCss = function (main, btn) {
return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_18__["CssClassBuilder"]().append(main)
.append(btn).toString();
};
Object.defineProperty(SurveyModel.prototype, "lazyRendering", {
/**
* Specifies whether to enable lazy rendering.
*
* In default mode, a survey renders the entire current page. With lazy rendering, the survey renders the page gradually as a user scrolls it. This helps reduce survey startup time and optimizes large surveys for low-end devices.
*
* Default value: `false`
*
* [View Demo](https://surveyjs.io/form-library/examples/survey-lazy/ (linkStyle))
* @see [settings.lazyRender](https://surveyjs.io/form-library/documentation/api-reference/settings#lazyRender)
*/
get: function () {
return this.lazyRenderingValue === true;
},
set: function (val) {
if (this.lazyRendering === val)
return;
this.lazyRenderingValue = val;
var page = this.currentPage;
if (!!page) {
page.updateRows();
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "isLazyRendering", {
get: function () {
return this.lazyRendering || _settings__WEBPACK_IMPORTED_MODULE_14__["settings"].lazyRender.enabled;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "lazyRenderingFirstBatchSize", {
get: function () {
return this.lazyRenderingFirstBatchSizeValue || _settings__WEBPACK_IMPORTED_MODULE_14__["settings"].lazyRender.firstBatchSize;
},
set: function (val) {
this.lazyRenderingFirstBatchSizeValue = val;
},
enumerable: false,
configurable: true
});
SurveyModel.prototype.updateLazyRenderingRowsOnRemovingElements = function () {
if (!this.isLazyRendering)
return;
var page = this.currentPage;
if (!!page) {
Object(_utils_utils__WEBPACK_IMPORTED_MODULE_15__["scrollElementByChildId"])(page.id);
}
};
Object.defineProperty(SurveyModel.prototype, "triggers", {
/**
* A list of triggers in the survey.
*
* [Conditional Survey Logic (Triggers)](https://surveyjs.io/form-library/documentation/design-survey/conditional-logic#conditional-survey-logic-triggers (linkStyle))
* @see runTriggers
* @see onTriggerExecuted
*/
get: function () {
return this.getPropertyValue("triggers");
},
set: function (val) {
this.setPropertyValue("triggers", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "calculatedValues", {
/**
* An array of [calculated values](https://surveyjs.io/form-library/documentation/design-survey-conditional-logic#calculated-values).
*/
get: function () {
return this.getPropertyValue("calculatedValues");
},
set: function (val) {
this.setPropertyValue("calculatedValues", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "surveyId", {
/**
* The identifier of a survey JSON schema to load from [SurveyJS Service](https://api.surveyjs.io).
*
* 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).
* @see loadSurveyFromService
* @see onLoadedSurveyFromService
*/
get: function () {
return this.getPropertyValue("surveyId", "");
},
set: function (val) {
this.setPropertyValue("surveyId", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "surveyPostId", {
/**
* An identifier used to save survey results to [SurveyJS Service](https://api.surveyjs.io).
*
* 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).
* @see onComplete
* @see surveyShowDataSaving
*/
get: function () {
return this.getPropertyValue("surveyPostId", "");
},
set: function (val) {
this.setPropertyValue("surveyPostId", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "clientId", {
/**
* A user identifier (e-mail or other unique ID).
*
* If your application works with [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).
* @see cookieName
*/
get: function () {
return this.getPropertyValue("clientId", "");
},
set: function (val) {
this.setPropertyValue("clientId", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "cookieName", {
/**
* A cookie name used to save information about survey completion.
*
* 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).
* @see clientId
*/
get: function () {
return this.getPropertyValue("cookieName", "");
},
set: function (val) {
this.setPropertyValue("cookieName", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "sendResultOnPageNext", {
/**
* Specifies whether to save survey results when respondents switch between pages. Handle the [`onPartialSend`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onPartialSend) event to implement the save operation.
*
* Alternatively, you can handle the [`onCurrentPageChanged`](#onCurrentPageChanged) and [`onValueChanged`](#onValueChanged) events, as shown in the following demo: [Continue an Incomplete Survey](https://surveyjs.io/form-library/examples/survey-editprevious/).
*/
get: function () {
return this.getPropertyValue("sendResultOnPageNext");
},
set: function (val) {
this.setPropertyValue("sendResultOnPageNext", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "surveyShowDataSaving", {
/**
* Specifies whether to show progress when the survey sends data to [SurveyJS Service](https://api.surveyjs.io).
*
* [View Demo](https://surveyjs.io/form-library/examples/save-survey-results-and-load-surveys-from-surveyjs-service/ (linkStyle))
* @see surveyPostId
*/
get: function () {
return this.getPropertyValue("surveyShowDataSaving");
},
set: function (val) {
this.setPropertyValue("surveyShowDataSaving", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "focusFirstQuestionAutomatic", {
/**
* Specifies whether to focus the first question on the page on survey startup or when users switch between pages.
*
* Default value: `false` in v1.9.114 and later, `true` in earlier versions
* @see focusOnFirstError
* @see focusFirstQuestion
* @see focusQuestion
*/
get: function () {
return this.getPropertyValue("focusFirstQuestionAutomatic");
},
set: function (val) {
this.setPropertyValue("focusFirstQuestionAutomatic", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "focusOnFirstError", {
/**
* Specifies whether to focus the first question with a validation error on the current page.
*
* Default value: `true`
* @see validate
* @see focusFirstQuestionAutomatic
*/
get: function () {
return this.getPropertyValue("focusOnFirstError");
},
set: function (val) {
this.setPropertyValue("focusOnFirstError", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "showNavigationButtons", {
/**
* Gets or sets the position of the Start, Next, Previous, and Complete navigation buttons and controls their visibility.
*
* Possible values:
*
* - `"bottom"` (default) - Displays the navigation buttons below survey content.
* - `"top"` - Displays the navigation buttons above survey content.
* - `"both"` - Displays the navigation buttons above and below survey content.
* - `"none"` - Hides the navigation buttons. This setting may be useful if you [implement custom external navigation](https://surveyjs.io/form-library/examples/external-form-navigation-system/).
* @see goNextPageAutomatic
* @see showPrevButton
* @see showCompleteButton
*/
get: function () {
return this.getPropertyValue("showNavigationButtons");
},
set: function (val) {
if (val === true || val === undefined) {
val = "bottom";
}
if (val === false) {
val = "none";
}
this.setPropertyValue("showNavigationButtons", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "showPrevButton", {
/**
* Specifies whether to display the Previous button. Set this property to `false` if respondents should not move backward along the survey.
* @see showNavigationButtons
* @see showCompleteButton
*/
get: function () {
return this.getPropertyValue("showPrevButton");
},
set: function (val) {
this.setPropertyValue("showPrevButton", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "showCompleteButton", {
/**
* Specifies whether to display the Complete button. Set this property to `false` if respondents should not complete the survey.
* @see showNavigationButtons
* @see showPrevButton
*/
get: function () {
return this.getPropertyValue("showCompleteButton", true);
},
set: function (val) {
this.setPropertyValue("showCompleteButton", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "showTOC", {
/**
* Gets or sets the visibility of the table of contents.
*
* Default value: `false`
*
* [View Demo](https://surveyjs.io/form-library/examples/toc-feature/ (linkStyle))
* @see tocLocation
*/
get: function () {
return this.getPropertyValue("showTOC");
},
set: function (val) {
this.setPropertyValue("showTOC", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "tocLocation", {
/**
* Gets or sets the position of the table of contents. Applies only when the table of contents is visible.
*
* Possible values:
*
* - `"left"` (default)
* - `"right"`
*
* [View Demo](https://surveyjs.io/form-library/examples/toc-feature/ (linkStyle))
* @see showTOC
*/
get: function () {
return this.getPropertyValue("tocLocation");
},
set: function (val) {
this.setPropertyValue("tocLocation", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "showTitle", {
/**
* Specifies whether to display the [survey title](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#title).
*
* [View Demo](https://surveyjs.io/form-library/examples/brand-your-survey-header/ (linkStyle))
* @see title
*/
get: function () {
return this.getPropertyValue("showTitle");
},
set: function (val) {
this.setPropertyValue("showTitle", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "showPageTitles", {
/**
* Specifies whether to display [page titles](https://surveyjs.io/form-library/documentation/api-reference/page-model#title).
*/
get: function () {
return this.getPropertyValue("showPageTitles");
},
set: function (val) {
this.setPropertyValue("showPageTitles", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "showCompletedPage", {
/**
* Specifies whether to show the [complete page](https://surveyjs.io/form-library/documentation/design-survey/create-a-multi-page-survey#complete-page).
* @see onComplete
* @see navigateToUrl
*/
get: function () {
return this.getPropertyValue("showCompletedPage");
},
set: function (val) {
this.setPropertyValue("showCompletedPage", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "navigateToUrl", {
/**
* A URL to which respondents should be navigated after survey completion.
* @see onNavigateToUrl
* @see navigateToUrlOnCondition
*/
get: function () {
return this.getPropertyValue("navigateToUrl");
},
set: function (val) {
this.setPropertyValue("navigateToUrl", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "navigateToUrlOnCondition", {
/**
* An array of objects that allows you to navigate respondents to different URLs after survey completion.
*
* Each object should include the [`expression`](https://surveyjs.io/form-library/documentation/api-reference/urlconditionitem#url) and [`url`](https://surveyjs.io/form-library/documentation/api-reference/urlconditionitem#expression) properties. When `expression` evaluates to `true`, the survey navigates to the corresponding `url`. Refer to the following help topic for more information about expressions: [Expressions](https://surveyjs.io/form-library/documentation/design-survey/conditional-logic#expressions).
* @see onNavigateToUrl
* @see navigateToUrl
*/
get: function () {
return this.getPropertyValue("navigateToUrlOnCondition");
},
set: function (val) {
this.setPropertyValue("navigateToUrlOnCondition", val);
},
enumerable: false,
configurable: true
});
SurveyModel.prototype.getNavigateToUrl = function () {
var item = this.getExpressionItemOnRunCondition(this.navigateToUrlOnCondition);
var url = !!item ? item.url : this.navigateToUrl;
if (!!url) {
url = this.processText(url, false);
}
return url;
};
SurveyModel.prototype.navigateTo = function () {
var url = this.getNavigateToUrl();
var options = { url: url, allow: true };
this.onNavigateToUrl.fire(this, options);
if (!options.url || !options.allow)
return;
Object(_utils_utils__WEBPACK_IMPORTED_MODULE_15__["navigateToUrl"])(options.url);
};
Object.defineProperty(SurveyModel.prototype, "requiredText", {
/**
* Specifies one or multiple characters that designate required questions.
*
* Default value: `*`
*
* [View Demo](https://surveyjs.io/form-library/examples/modify-question-title/ (linkStyle))
*/
get: function () {
return this.getPropertyValue("requiredText", "*");
},
set: function (val) {
this.setPropertyValue("requiredText", val);
},
enumerable: false,
configurable: true
});
SurveyModel.prototype.beforeSettingQuestionErrors = function (question, errors) {
this.makeRequiredErrorsInvisible(errors);
this.onSettingQuestionErrors.fire(this, {
question: question,
errors: errors,
});
};
SurveyModel.prototype.beforeSettingPanelErrors = function (question, errors) {
this.makeRequiredErrorsInvisible(errors);
};
SurveyModel.prototype.makeRequiredErrorsInvisible = function (errors) {
if (!this.hideRequiredErrors)
return;
for (var i = 0; i < errors.length; i++) {
var erType = errors[i].getErrorType();
if (erType == "required" || erType == "requireoneanswer") {
errors[i].visible = false;
}
}
};
Object.defineProperty(SurveyModel.prototype, "questionStartIndex", {
/**
* Specifies the initial number or letter from which to start question numbering.
*
* [Question Numbers](https://surveyjs.io/form-library/documentation/design-survey/configure-question-titles#question-numbers (linkStyle))
*/
get: function () {
return this.getPropertyValue("questionStartIndex", "");
},
set: function (val) {
this.setPropertyValue("questionStartIndex", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "storeOthersAsComment", {
/**
* Specifies whether to store the "Other" option response in a separate property.
*
* Default value: `true`
*
* Respondents can leave comments when they select "Other" in choice-based questions, such as Dropdown or Checkboxes. Comment values are saved in a separate property. The property name is composed of the question `name` and [`commentSuffix`](#commentSuffix). However, you can use the question `name` as a key to store the comment value instead. Disable the `storeOthersAsComment` property in this case.
* @see maxOthersLength
*/
get: function () {
return this.getPropertyValue("storeOthersAsComment");
},
set: function (val) {
this.setPropertyValue("storeOthersAsComment", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "maxTextLength", {
/**
* Specifies the maximum text length in textual questions ([Single-Line Input](https://surveyjs.io/form-library/examples/text-entry-question/), [Long Text](https://surveyjs.io/form-library/examples/add-open-ended-question-to-a-form/), [Multiple Textboxes](https://surveyjs.io/form-library/examples/multiple-text-box-question/)), measured in characters.
*
* Default value: 0 (unlimited)
*
* You can override this setting for individual questions if you specify their [`maxLength`](https://surveyjs.io/form-library/documentation/api-reference/text-entry-question-model#maxLength) property.
* @see maxOthersLength
*/
get: function () {
return this.getPropertyValue("maxTextLength");
},
set: function (val) {
this.setPropertyValue("maxTextLength", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "maxOthersLength", {
/**
* Specifies the maximum text length for question comments. Applies to questions with the [`showCommentArea`](https://surveyjs.io/form-library/documentation/api-reference/question#showCommentArea) or [`showOtherItem`](https://surveyjs.io/form-library/documentation/api-reference/question#showOtherItem) property set to `true`.
*
* Default value: 0 (unlimited)
* @see maxTextLength
*/
get: function () {
return this.getPropertyValue("maxOthersLength");
},
set: function (val) {
this.setPropertyValue("maxOthersLength", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "goNextPageAutomatic", {
/**
* Specifies whether the survey switches to the next page automatically after a user answers all questions on the current page.
*
* Default value: `false`
*
* If you enable this property, the survey is also completed automatically. Set the [`allowCompleteSurveyAutomatic`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#allowCompleteSurveyAutomatic) property to `false` if you want to disable this behavior.
*
* > If any of the following questions is answered last, the survey does not switch to the next page: Checkboxes, Yes/No (Boolean) (rendered as Checkbox), Long Text, Signature, Image Picker (with Multi Select), File Upload, Single-Select Matrix (not all rows are answered), Dynamic Matrix, Dynamic Panel.
*
* [View Demo](https://surveyjs.io/form-library/examples/automatically-move-to-next-page-if-answer-selected/ (linkStyle))
* @see [`settings.autoAdvanceDelay`](https://surveyjs.io/form-library/documentation/api-reference/settings#autoAdvanceDelay)
*/
get: function () {
return this.getPropertyValue("goNextPageAutomatic");
},
set: function (val) {
this.setPropertyValue("goNextPageAutomatic", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "allowCompleteSurveyAutomatic", {
/**
* Specifies whether to complete the survey automatically after a user answers all questions on the last page. Applies only if the [`goNextPageAutomatic`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#goNextPageAutomatic) property is `true`.
*
* Default value: `true`
* @see [`settings.autoAdvanceDelay`](https://surveyjs.io/form-library/documentation/api-reference/settings#autoAdvanceDelay)
*/
get: function () {
return this.getPropertyValue("allowCompleteSurveyAutomatic");
},
set: function (val) {
this.setPropertyValue("allowCompleteSurveyAutomatic", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "checkErrorsMode", {
/**
* Specifies when the survey validates answers.
*
* Possible values:
*
* - `"onNextPage"` (default) - Triggers validation before the survey is switched to the next page or completed.
* - `"onValueChanged"` - Triggers validation each time a question value is changed.
* - `"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.
*
* > 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.
*
* Refer to the following help topic for more information: [Data Validation](https://surveyjs.io/form-library/documentation/data-validation).
* @see validationEnabled
* @see validationAllowSwitchPages
* @see validationAllowComplete
* @see validate
*/
get: function () {
return this.getPropertyValue("checkErrorsMode");
},
set: function (val) {
this.setPropertyValue("checkErrorsMode", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "autoGrowComment", {
/**
* Specifies whether to increase the height of [Long Text](https://surveyjs.io/form-library/examples/add-open-ended-question-to-a-form/) questions and other text areas to accommodate multi-line text content.
*
* Default value: `false`
*
* You can override this property for individual Long Text questions: [`autoGrow`](https://surveyjs.io/form-library/documentation/api-reference/comment-field-model#autoGrow).
* @see allowResizeComment
* @see commentAreaRows
*/
get: function () {
return this.getPropertyValue("autoGrowComment");
},
set: function (val) {
this.setPropertyValue("autoGrowComment", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "allowResizeComment", {
/**
* Specifies whether to display a resize handle for [Long Text](https://surveyjs.io/form-library/examples/add-open-ended-question-to-a-form/) questions and other text areas intended for multi-line text content.
*
* Default value: `true`
*
* You can override this property for individual Long Text questions: [`allowResize`](https://surveyjs.io/form-library/documentation/api-reference/comment-field-model#allowResize).
* @see autoGrowComment
* @see commentAreaRows
*/
get: function () {
return this.getPropertyValue("allowResizeComment");
},
set: function (val) {
this.setPropertyValue("allowResizeComment", val);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SurveyModel.prototype, "commentAreaRows", {
/**
* Specifies the visible height of comment areas, measured in lines. Applies to the questions with the [`showCommentArea`](https://surveyjs.io/form-library/documentation/api-reference/question#showCommentArea) or [`showOtherItem`](https://surveyjs.io/form-library/documentation/api-reference/question#showOtherItem) property enabled.
*
* Default value: 2
*
* The value of this property is passed on to the `rows` attribute of the underlying `