survey-core 2.3.3 → 2.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm/i18n/arabic.mjs +1 -1
- package/fesm/i18n/basque.mjs +1 -1
- package/fesm/i18n/bulgarian.mjs +1 -1
- package/fesm/i18n/burmese.mjs +1 -1
- package/fesm/i18n/catalan.mjs +1 -1
- package/fesm/i18n/croatian.mjs +1 -1
- package/fesm/i18n/czech.mjs +1 -1
- package/fesm/i18n/danish.mjs +1 -1
- package/fesm/i18n/dutch.mjs +1 -1
- package/fesm/i18n/english.mjs +1 -1
- package/fesm/i18n/estonian.mjs +1 -1
- package/fesm/i18n/finnish.mjs +1 -1
- package/fesm/i18n/french.mjs +1 -1
- package/fesm/i18n/georgian.mjs +1 -1
- package/fesm/i18n/german.mjs +1 -1
- package/fesm/i18n/greek.mjs +1 -1
- package/fesm/i18n/haitian-creole.mjs +1 -1
- package/fesm/i18n/hebrew.mjs +1 -1
- package/fesm/i18n/hindi.mjs +1 -1
- package/fesm/i18n/hungarian.mjs +1 -1
- package/fesm/i18n/icelandic.mjs +1 -1
- package/fesm/i18n/index.mjs +1 -1
- package/fesm/i18n/indonesian.mjs +1 -1
- package/fesm/i18n/italian.mjs +1 -1
- package/fesm/i18n/japanese.mjs +1 -1
- package/fesm/i18n/kazakh.mjs +1 -1
- package/fesm/i18n/korean.mjs +1 -1
- package/fesm/i18n/latvian.mjs +1 -1
- package/fesm/i18n/lithuanian.mjs +1 -1
- package/fesm/i18n/macedonian.mjs +1 -1
- package/fesm/i18n/malay.mjs +1 -1
- package/fesm/i18n/nl-BE.mjs +1 -1
- package/fesm/i18n/norwegian.mjs +1 -1
- package/fesm/i18n/persian.mjs +1 -1
- package/fesm/i18n/philippines.mjs +1 -1
- package/fesm/i18n/polish.mjs +1 -1
- package/fesm/i18n/portuguese-br.mjs +1 -1
- package/fesm/i18n/portuguese.mjs +1 -1
- package/fesm/i18n/romanian.mjs +1 -1
- package/fesm/i18n/russian.mjs +1 -1
- package/fesm/i18n/serbian.mjs +1 -1
- package/fesm/i18n/simplified-chinese.mjs +1 -1
- package/fesm/i18n/slovak.mjs +1 -1
- package/fesm/i18n/slovenian.mjs +1 -1
- package/fesm/i18n/spanish.mjs +1 -1
- package/fesm/i18n/swahili.mjs +1 -1
- package/fesm/i18n/swedish.mjs +1 -1
- package/fesm/i18n/tajik.mjs +1 -1
- package/fesm/i18n/telugu.mjs +1 -1
- package/fesm/i18n/thai.mjs +1 -1
- package/fesm/i18n/traditional-chinese.mjs +1 -1
- package/fesm/i18n/turkish.mjs +1 -1
- package/fesm/i18n/ukrainian.mjs +1 -1
- package/fesm/i18n/urdu.mjs +1 -1
- package/fesm/i18n/vietnamese.mjs +1 -1
- package/fesm/i18n/welsh.mjs +1 -1
- package/fesm/icons/iconsV1.mjs +1 -1
- package/fesm/icons/iconsV2.mjs +1 -1
- package/fesm/survey-core.mjs +412 -340
- package/fesm/survey-core.mjs.map +1 -1
- package/fesm/survey.i18n.mjs +1 -1
- package/fesm/themes/index.mjs +1 -1
- package/i18n/arabic.js +1 -1
- package/i18n/arabic.min.js.LICENSE.txt +1 -1
- package/i18n/basque.js +1 -1
- package/i18n/basque.min.js.LICENSE.txt +1 -1
- package/i18n/bulgarian.js +1 -1
- package/i18n/bulgarian.min.js.LICENSE.txt +1 -1
- package/i18n/burmese.js +1 -1
- package/i18n/burmese.min.js.LICENSE.txt +1 -1
- package/i18n/catalan.js +1 -1
- package/i18n/catalan.min.js.LICENSE.txt +1 -1
- package/i18n/croatian.js +1 -1
- package/i18n/croatian.min.js.LICENSE.txt +1 -1
- package/i18n/czech.js +1 -1
- package/i18n/czech.min.js.LICENSE.txt +1 -1
- package/i18n/danish.js +1 -1
- package/i18n/danish.min.js.LICENSE.txt +1 -1
- package/i18n/dutch.js +1 -1
- package/i18n/dutch.min.js.LICENSE.txt +1 -1
- package/i18n/english.js +1 -1
- package/i18n/english.min.js.LICENSE.txt +1 -1
- package/i18n/estonian.js +1 -1
- package/i18n/estonian.min.js.LICENSE.txt +1 -1
- package/i18n/finnish.js +1 -1
- package/i18n/finnish.min.js.LICENSE.txt +1 -1
- package/i18n/french.js +1 -1
- package/i18n/french.min.js.LICENSE.txt +1 -1
- package/i18n/georgian.js +1 -1
- package/i18n/georgian.min.js.LICENSE.txt +1 -1
- package/i18n/german.js +1 -1
- package/i18n/german.min.js.LICENSE.txt +1 -1
- package/i18n/greek.js +1 -1
- package/i18n/greek.min.js.LICENSE.txt +1 -1
- package/i18n/haitian-creole.js +1 -1
- package/i18n/haitian-creole.min.js.LICENSE.txt +1 -1
- package/i18n/hebrew.js +1 -1
- package/i18n/hebrew.min.js.LICENSE.txt +1 -1
- package/i18n/hindi.js +1 -1
- package/i18n/hindi.min.js.LICENSE.txt +1 -1
- package/i18n/hungarian.js +1 -1
- package/i18n/hungarian.min.js.LICENSE.txt +1 -1
- package/i18n/icelandic.js +1 -1
- package/i18n/icelandic.min.js.LICENSE.txt +1 -1
- package/i18n/index.js +1 -1
- package/i18n/index.min.js.LICENSE.txt +1 -1
- package/i18n/indonesian.js +1 -1
- package/i18n/indonesian.min.js.LICENSE.txt +1 -1
- package/i18n/italian.js +1 -1
- package/i18n/italian.min.js.LICENSE.txt +1 -1
- package/i18n/japanese.js +1 -1
- package/i18n/japanese.min.js.LICENSE.txt +1 -1
- package/i18n/kazakh.js +1 -1
- package/i18n/kazakh.min.js.LICENSE.txt +1 -1
- package/i18n/korean.js +1 -1
- package/i18n/korean.min.js.LICENSE.txt +1 -1
- package/i18n/latvian.js +1 -1
- package/i18n/latvian.min.js.LICENSE.txt +1 -1
- package/i18n/lithuanian.js +1 -1
- package/i18n/lithuanian.min.js.LICENSE.txt +1 -1
- package/i18n/macedonian.js +1 -1
- package/i18n/macedonian.min.js.LICENSE.txt +1 -1
- package/i18n/malay.js +1 -1
- package/i18n/malay.min.js.LICENSE.txt +1 -1
- package/i18n/nl-BE.js +1 -1
- package/i18n/nl-BE.min.js.LICENSE.txt +1 -1
- package/i18n/norwegian.js +1 -1
- package/i18n/norwegian.min.js.LICENSE.txt +1 -1
- package/i18n/persian.js +1 -1
- package/i18n/persian.min.js.LICENSE.txt +1 -1
- package/i18n/philippines.js +1 -1
- package/i18n/philippines.min.js.LICENSE.txt +1 -1
- package/i18n/polish.js +1 -1
- package/i18n/polish.min.js.LICENSE.txt +1 -1
- package/i18n/portuguese-br.js +1 -1
- package/i18n/portuguese-br.min.js.LICENSE.txt +1 -1
- package/i18n/portuguese.js +1 -1
- package/i18n/portuguese.min.js.LICENSE.txt +1 -1
- package/i18n/romanian.js +1 -1
- package/i18n/romanian.min.js.LICENSE.txt +1 -1
- package/i18n/russian.js +1 -1
- package/i18n/russian.min.js.LICENSE.txt +1 -1
- package/i18n/serbian.js +1 -1
- package/i18n/serbian.min.js.LICENSE.txt +1 -1
- package/i18n/simplified-chinese.js +1 -1
- package/i18n/simplified-chinese.min.js.LICENSE.txt +1 -1
- package/i18n/slovak.js +1 -1
- package/i18n/slovak.min.js.LICENSE.txt +1 -1
- package/i18n/slovenian.js +1 -1
- package/i18n/slovenian.min.js.LICENSE.txt +1 -1
- package/i18n/spanish.js +1 -1
- package/i18n/spanish.min.js.LICENSE.txt +1 -1
- package/i18n/swahili.js +1 -1
- package/i18n/swahili.min.js.LICENSE.txt +1 -1
- package/i18n/swedish.js +1 -1
- package/i18n/swedish.min.js.LICENSE.txt +1 -1
- package/i18n/tajik.js +1 -1
- package/i18n/tajik.min.js.LICENSE.txt +1 -1
- package/i18n/telugu.js +1 -1
- package/i18n/telugu.min.js.LICENSE.txt +1 -1
- package/i18n/thai.js +1 -1
- package/i18n/thai.min.js.LICENSE.txt +1 -1
- package/i18n/traditional-chinese.js +1 -1
- package/i18n/traditional-chinese.min.js.LICENSE.txt +1 -1
- package/i18n/turkish.js +1 -1
- package/i18n/turkish.min.js.LICENSE.txt +1 -1
- package/i18n/ukrainian.js +1 -1
- package/i18n/ukrainian.min.js.LICENSE.txt +1 -1
- package/i18n/urdu.js +1 -1
- package/i18n/urdu.min.js.LICENSE.txt +1 -1
- package/i18n/vietnamese.js +1 -1
- package/i18n/vietnamese.min.js.LICENSE.txt +1 -1
- package/i18n/welsh.js +1 -1
- package/i18n/welsh.min.js.LICENSE.txt +1 -1
- package/icons/iconsV1.js +1 -1
- package/icons/iconsV1.min.js.LICENSE.txt +1 -1
- package/icons/iconsV2.js +1 -1
- package/icons/iconsV2.min.js.LICENSE.txt +1 -1
- package/package.json +1 -1
- package/survey-core.css +1 -1
- package/survey-core.fontless.css +1 -1
- package/survey-core.fontless.min.css +1 -1
- package/survey-core.min.css +1 -1
- package/survey.core.js +431 -360
- package/survey.core.js.map +1 -1
- package/survey.core.min.js +1 -1
- package/survey.core.min.js.LICENSE.txt +1 -1
- package/survey.i18n.js +1 -1
- package/survey.i18n.min.js.LICENSE.txt +1 -1
- package/themes/borderless-dark-panelless.js +1 -1
- package/themes/borderless-dark-panelless.min.js.LICENSE.txt +1 -1
- package/themes/borderless-dark.js +1 -1
- package/themes/borderless-dark.min.js.LICENSE.txt +1 -1
- package/themes/borderless-light-panelless.js +1 -1
- package/themes/borderless-light-panelless.min.js.LICENSE.txt +1 -1
- package/themes/borderless-light.js +1 -1
- package/themes/borderless-light.min.js.LICENSE.txt +1 -1
- package/themes/contrast-dark-panelless.js +1 -1
- package/themes/contrast-dark-panelless.min.js.LICENSE.txt +1 -1
- package/themes/contrast-dark.js +1 -1
- package/themes/contrast-dark.min.js.LICENSE.txt +1 -1
- package/themes/contrast-light-panelless.js +1 -1
- package/themes/contrast-light-panelless.min.js.LICENSE.txt +1 -1
- package/themes/contrast-light.js +1 -1
- package/themes/contrast-light.min.js.LICENSE.txt +1 -1
- package/themes/default-dark-panelless.js +1 -1
- package/themes/default-dark-panelless.min.js.LICENSE.txt +1 -1
- package/themes/default-dark.js +1 -1
- package/themes/default-dark.min.js.LICENSE.txt +1 -1
- package/themes/default-light-panelless.js +1 -1
- package/themes/default-light-panelless.min.js.LICENSE.txt +1 -1
- package/themes/default-light.js +1 -1
- package/themes/default-light.min.js.LICENSE.txt +1 -1
- package/themes/doubleborder-dark-panelless.js +1 -1
- package/themes/doubleborder-dark-panelless.min.js.LICENSE.txt +1 -1
- package/themes/doubleborder-dark.js +1 -1
- package/themes/doubleborder-dark.min.js.LICENSE.txt +1 -1
- package/themes/doubleborder-light-panelles.js +1 -1
- package/themes/doubleborder-light-panelles.min.js.LICENSE.txt +1 -1
- package/themes/doubleborder-light.js +1 -1
- package/themes/doubleborder-light.min.js.LICENSE.txt +1 -1
- package/themes/flat-dark-panelless.js +1 -1
- package/themes/flat-dark-panelless.min.js.LICENSE.txt +1 -1
- package/themes/flat-dark.js +1 -1
- package/themes/flat-dark.min.js.LICENSE.txt +1 -1
- package/themes/flat-light-panelless.js +1 -1
- package/themes/flat-light-panelless.min.js.LICENSE.txt +1 -1
- package/themes/flat-light.js +1 -1
- package/themes/flat-light.min.js.LICENSE.txt +1 -1
- package/themes/index.js +1 -1
- package/themes/index.min.js.LICENSE.txt +1 -1
- package/themes/layered-dark-panelless.js +1 -1
- package/themes/layered-dark-panelless.min.js.LICENSE.txt +1 -1
- package/themes/layered-dark.js +1 -1
- package/themes/layered-dark.min.js.LICENSE.txt +1 -1
- package/themes/layered-light-panelless.js +1 -1
- package/themes/layered-light-panelless.min.js.LICENSE.txt +1 -1
- package/themes/layered-light.js +1 -1
- package/themes/layered-light.min.js.LICENSE.txt +1 -1
- package/themes/plain-dark-panelless.js +1 -1
- package/themes/plain-dark-panelless.min.js.LICENSE.txt +1 -1
- package/themes/plain-dark.js +1 -1
- package/themes/plain-dark.min.js.LICENSE.txt +1 -1
- package/themes/plain-light-panelless.js +1 -1
- package/themes/plain-light-panelless.min.js.LICENSE.txt +1 -1
- package/themes/plain-light.js +1 -1
- package/themes/plain-light.min.js.LICENSE.txt +1 -1
- package/themes/sharp-dark-panelless.js +1 -1
- package/themes/sharp-dark-panelless.min.js.LICENSE.txt +1 -1
- package/themes/sharp-dark.js +1 -1
- package/themes/sharp-dark.min.js.LICENSE.txt +1 -1
- package/themes/sharp-light-panelless.js +1 -1
- package/themes/sharp-light-panelless.min.js.LICENSE.txt +1 -1
- package/themes/sharp-light.js +1 -1
- package/themes/sharp-light.min.js.LICENSE.txt +1 -1
- package/themes/solid-dark-panelless.js +1 -1
- package/themes/solid-dark-panelless.min.js.LICENSE.txt +1 -1
- package/themes/solid-dark.js +1 -1
- package/themes/solid-dark.min.js.LICENSE.txt +1 -1
- package/themes/solid-light-panelless.js +1 -1
- package/themes/solid-light-panelless.min.js.LICENSE.txt +1 -1
- package/themes/solid-light.js +1 -1
- package/themes/solid-light.min.js.LICENSE.txt +1 -1
- package/themes/three-dimensional-dark-panelless.js +1 -1
- package/themes/three-dimensional-dark-panelless.min.js.LICENSE.txt +1 -1
- package/themes/three-dimensional-dark.js +1 -1
- package/themes/three-dimensional-dark.min.js.LICENSE.txt +1 -1
- package/themes/three-dimensional-light-panelless.js +1 -1
- package/themes/three-dimensional-light-panelless.min.js.LICENSE.txt +1 -1
- package/themes/three-dimensional-light.js +1 -1
- package/themes/three-dimensional-light.min.js.LICENSE.txt +1 -1
- package/typings/src/base-interfaces.d.ts +3 -2
- package/typings/src/base.d.ts +5 -0
- package/typings/src/conditionProcessValue.d.ts +5 -0
- package/typings/src/conditions.d.ts +1 -1
- package/typings/src/martixBase.d.ts +0 -3
- package/typings/src/question.d.ts +11 -10
- package/typings/src/question_custom.d.ts +4 -1
- package/typings/src/question_expression.d.ts +1 -3
- package/typings/src/question_matrix.d.ts +2 -0
- package/typings/src/question_matrixdropdownbase.d.ts +4 -0
- package/typings/src/question_matrixdropdowncolumn.d.ts +1 -0
- package/typings/src/question_matrixdynamic.d.ts +1 -0
- package/typings/src/question_paneldynamic.d.ts +2 -0
- package/typings/src/question_slider.d.ts +2 -2
- package/typings/src/question_text.d.ts +0 -2
- package/typings/src/settings.d.ts +1 -0
- package/typings/src/survey-events-api.d.ts +19 -0
- package/typings/src/survey.d.ts +8 -3
- package/typings/src/trigger.d.ts +4 -8
package/fesm/survey-core.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* surveyjs - Survey JavaScript library v2.3.
|
|
2
|
+
* surveyjs - Survey JavaScript library v2.3.5
|
|
3
3
|
* Copyright (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
|
|
4
4
|
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
|
|
5
5
|
*/
|
|
@@ -3084,6 +3084,16 @@ class VariableGetterContext extends ValueGetterContextCore {
|
|
|
3084
3084
|
return undefined;
|
|
3085
3085
|
}
|
|
3086
3086
|
}
|
|
3087
|
+
class VariableGetterContextEx extends VariableGetterContext {
|
|
3088
|
+
constructor(variables, second) {
|
|
3089
|
+
super(variables);
|
|
3090
|
+
this.second = second;
|
|
3091
|
+
}
|
|
3092
|
+
getValue(path, isRoot, index, createObjects) {
|
|
3093
|
+
const res = super.getValue(path, isRoot, index, createObjects);
|
|
3094
|
+
return !this.second || (res === null || res === void 0 ? void 0 : res.isFound) ? res : this.second.getValue(path, isRoot, index, createObjects);
|
|
3095
|
+
}
|
|
3096
|
+
}
|
|
3087
3097
|
class ProcessValue {
|
|
3088
3098
|
constructor(context) {
|
|
3089
3099
|
this.properties = null;
|
|
@@ -3310,15 +3320,15 @@ function convertToNumber(val) {
|
|
|
3310
3320
|
return Helpers.isNumber(val) ? Helpers.getNumber(val) : undefined;
|
|
3311
3321
|
return val;
|
|
3312
3322
|
}
|
|
3313
|
-
function processItemInArray(item, name, res, func, needToConvert, condition) {
|
|
3323
|
+
function processItemInArray(item, name, res, func, needToConvert, condition, properties) {
|
|
3314
3324
|
if (!item || Helpers.isValueEmpty(item[name]))
|
|
3315
3325
|
return res;
|
|
3316
|
-
if (condition && !condition.runValues(item))
|
|
3326
|
+
if (condition && !condition.runValues(item, properties))
|
|
3317
3327
|
return res;
|
|
3318
3328
|
const val = needToConvert ? convertToNumber(item[name]) : 1;
|
|
3319
3329
|
return func(res, val);
|
|
3320
3330
|
}
|
|
3321
|
-
function calcInArray(params, originalParams, func, needToConvert = true) {
|
|
3331
|
+
function calcInArray(properties, params, originalParams, func, needToConvert = true) {
|
|
3322
3332
|
var v = getInArrayParams(params, originalParams);
|
|
3323
3333
|
if (!v)
|
|
3324
3334
|
return undefined;
|
|
@@ -3329,18 +3339,26 @@ function calcInArray(params, originalParams, func, needToConvert = true) {
|
|
|
3329
3339
|
var res = undefined;
|
|
3330
3340
|
if (Array.isArray(v.data)) {
|
|
3331
3341
|
for (var i = 0; i < v.data.length; i++) {
|
|
3332
|
-
res = processItemInArray(v.data[i], v.name, res, func, needToConvert, condition);
|
|
3342
|
+
res = processItemInArray(v.data[i], v.name, res, func, needToConvert, condition, properties);
|
|
3333
3343
|
}
|
|
3334
3344
|
}
|
|
3335
3345
|
else {
|
|
3336
3346
|
for (var key in v.data) {
|
|
3337
|
-
res = processItemInArray(v.data[key], v.name, res, func, needToConvert, condition);
|
|
3347
|
+
res = processItemInArray(v.data[key], v.name, res, func, needToConvert, condition, properties);
|
|
3338
3348
|
}
|
|
3339
3349
|
}
|
|
3340
3350
|
return res;
|
|
3341
3351
|
}
|
|
3352
|
+
function getProperties(self) {
|
|
3353
|
+
var _a;
|
|
3354
|
+
return {
|
|
3355
|
+
survey: self.survey,
|
|
3356
|
+
question: self.question,
|
|
3357
|
+
context: (_a = self.survey) === null || _a === void 0 ? void 0 : _a.getValueGetterContext()
|
|
3358
|
+
};
|
|
3359
|
+
}
|
|
3342
3360
|
function sumInArray(params, originalParams) {
|
|
3343
|
-
var res = calcInArray(params, originalParams, function (res, val) {
|
|
3361
|
+
var res = calcInArray(getProperties(this), params, originalParams, function (res, val) {
|
|
3344
3362
|
if (res == undefined)
|
|
3345
3363
|
res = 0;
|
|
3346
3364
|
if (val == undefined || val == null)
|
|
@@ -3351,7 +3369,7 @@ function sumInArray(params, originalParams) {
|
|
|
3351
3369
|
}
|
|
3352
3370
|
FunctionFactory.Instance.register("sumInArray", sumInArray);
|
|
3353
3371
|
function minInArray(params, originalParams) {
|
|
3354
|
-
return calcInArray(params, originalParams, function (res, val) {
|
|
3372
|
+
return calcInArray(getProperties(this), params, originalParams, function (res, val) {
|
|
3355
3373
|
if (res == undefined)
|
|
3356
3374
|
return val;
|
|
3357
3375
|
if (val == undefined || val == null)
|
|
@@ -3361,7 +3379,7 @@ function minInArray(params, originalParams) {
|
|
|
3361
3379
|
}
|
|
3362
3380
|
FunctionFactory.Instance.register("minInArray", minInArray);
|
|
3363
3381
|
function maxInArray(params, originalParams) {
|
|
3364
|
-
return calcInArray(params, originalParams, function (res, val) {
|
|
3382
|
+
return calcInArray(getProperties(this), params, originalParams, function (res, val) {
|
|
3365
3383
|
if (res == undefined)
|
|
3366
3384
|
return val;
|
|
3367
3385
|
if (val == undefined || val == null)
|
|
@@ -3371,7 +3389,7 @@ function maxInArray(params, originalParams) {
|
|
|
3371
3389
|
}
|
|
3372
3390
|
FunctionFactory.Instance.register("maxInArray", maxInArray);
|
|
3373
3391
|
function countInArray(params, originalParams) {
|
|
3374
|
-
var res = calcInArray(params, originalParams, function (res, val) {
|
|
3392
|
+
var res = calcInArray(getProperties(this), params, originalParams, function (res, val) {
|
|
3375
3393
|
if (res == undefined)
|
|
3376
3394
|
res = 0;
|
|
3377
3395
|
if (val == undefined || val == null)
|
|
@@ -3382,10 +3400,12 @@ function countInArray(params, originalParams) {
|
|
|
3382
3400
|
}
|
|
3383
3401
|
FunctionFactory.Instance.register("countInArray", countInArray);
|
|
3384
3402
|
function avgInArray(params, originalParams) {
|
|
3385
|
-
|
|
3403
|
+
const properties = getProperties(this);
|
|
3404
|
+
const funcCall = (name) => FunctionFactory.Instance.run(name, params, properties, originalParams);
|
|
3405
|
+
const count = funcCall("countInArray");
|
|
3386
3406
|
if (count == 0)
|
|
3387
3407
|
return 0;
|
|
3388
|
-
return sumInArray
|
|
3408
|
+
return funcCall("sumInArray") / count;
|
|
3389
3409
|
}
|
|
3390
3410
|
FunctionFactory.Instance.register("avgInArray", avgInArray);
|
|
3391
3411
|
function iif(params) {
|
|
@@ -7414,8 +7434,8 @@ class ExpressionExecutor {
|
|
|
7414
7434
|
canRun() {
|
|
7415
7435
|
return !!this.operand;
|
|
7416
7436
|
}
|
|
7417
|
-
run(values, properties
|
|
7418
|
-
return this.runContext(new
|
|
7437
|
+
run(values, properties, id) {
|
|
7438
|
+
return this.runContext(new VariableGetterContextEx(values, properties === null || properties === void 0 ? void 0 : properties.context), properties, id);
|
|
7419
7439
|
}
|
|
7420
7440
|
runContext(context, properties = null, id) {
|
|
7421
7441
|
if (!this.operand) {
|
|
@@ -7477,8 +7497,8 @@ class ExpressionRunnerBase {
|
|
|
7477
7497
|
}
|
|
7478
7498
|
ExpressionRunnerBase.IdRunnerCounter = 1;
|
|
7479
7499
|
class ConditionRunner extends ExpressionRunnerBase {
|
|
7480
|
-
runValues(values, properties
|
|
7481
|
-
return this.runContext(new
|
|
7500
|
+
runValues(values, properties) {
|
|
7501
|
+
return this.runContext(new VariableGetterContextEx(values, properties === null || properties === void 0 ? void 0 : properties.context), properties);
|
|
7482
7502
|
}
|
|
7483
7503
|
runContext(context, properties) {
|
|
7484
7504
|
return this.runContextCore(context, properties) == true;
|
|
@@ -7490,8 +7510,8 @@ class ConditionRunner extends ExpressionRunnerBase {
|
|
|
7490
7510
|
}
|
|
7491
7511
|
}
|
|
7492
7512
|
class ExpressionRunner extends ExpressionRunnerBase {
|
|
7493
|
-
runValues(values, properties
|
|
7494
|
-
return this.runContext(new
|
|
7513
|
+
runValues(values, properties) {
|
|
7514
|
+
return this.runContext(new VariableGetterContextEx(values, properties === null || properties === void 0 ? void 0 : properties.context), properties);
|
|
7495
7515
|
}
|
|
7496
7516
|
runContext(context, properties) {
|
|
7497
7517
|
return this.runContextCore(context, properties);
|
|
@@ -8228,14 +8248,9 @@ class Base {
|
|
|
8228
8248
|
return;
|
|
8229
8249
|
if (!!info.canRun && !info.canRun(this))
|
|
8230
8250
|
return;
|
|
8231
|
-
|
|
8232
|
-
info.
|
|
8233
|
-
|
|
8234
|
-
info.onExecute(this, res);
|
|
8235
|
-
};
|
|
8236
|
-
}
|
|
8237
|
-
info.runner.expression = expression;
|
|
8238
|
-
info.runner.runContext(this.getValueGetterContext(), properties);
|
|
8251
|
+
this.runExpressionByProperty(propName, properties, (res) => {
|
|
8252
|
+
info.onExecute(this, res);
|
|
8253
|
+
});
|
|
8239
8254
|
}
|
|
8240
8255
|
doBeforeAsynRun(id) {
|
|
8241
8256
|
if (!this.asynExpressionHash)
|
|
@@ -8264,6 +8279,51 @@ class Base {
|
|
|
8264
8279
|
res.onAfterAsyncRun = (id) => { this.doAfterAsynRun(id); };
|
|
8265
8280
|
return res;
|
|
8266
8281
|
}
|
|
8282
|
+
getExpressionFromSurvey(propName) {
|
|
8283
|
+
let expression = this[propName];
|
|
8284
|
+
if (!expression)
|
|
8285
|
+
return "";
|
|
8286
|
+
const survey = this.getSurvey();
|
|
8287
|
+
return !!survey ? survey.beforeExpressionRunning(this, propName, expression) : expression;
|
|
8288
|
+
}
|
|
8289
|
+
runExpressionByProperty(propName, properties, onExecute, canRun) {
|
|
8290
|
+
if (!this[propName])
|
|
8291
|
+
return false;
|
|
8292
|
+
const expression = this.getExpressionFromSurvey(propName);
|
|
8293
|
+
if (!!expression) {
|
|
8294
|
+
const info = this.getExpressionInfoByProperty(propName, expression);
|
|
8295
|
+
const runner = info.runner;
|
|
8296
|
+
if (!info.isRunning && (!canRun || canRun(runner))) {
|
|
8297
|
+
info.isRunning = true;
|
|
8298
|
+
runner.onRunComplete = (value) => {
|
|
8299
|
+
onExecute(value);
|
|
8300
|
+
info.isRunning = false;
|
|
8301
|
+
};
|
|
8302
|
+
runner.runContext(this.getValueGetterContext(), properties);
|
|
8303
|
+
}
|
|
8304
|
+
}
|
|
8305
|
+
return true;
|
|
8306
|
+
}
|
|
8307
|
+
getExpressionByProperty(propName) {
|
|
8308
|
+
const expression = this.getExpressionFromSurvey(propName);
|
|
8309
|
+
if (!expression)
|
|
8310
|
+
return null;
|
|
8311
|
+
return this.getExpressionInfoByProperty(propName, expression).runner;
|
|
8312
|
+
}
|
|
8313
|
+
getExpressionInfoByProperty(propName, expression) {
|
|
8314
|
+
if (!this.runExpressionHash) {
|
|
8315
|
+
this.runExpressionHash = {};
|
|
8316
|
+
}
|
|
8317
|
+
let info = this.runExpressionHash[propName];
|
|
8318
|
+
if (!info) {
|
|
8319
|
+
info = { runner: this.createExpressionRunner(expression) };
|
|
8320
|
+
this.runExpressionHash[propName] = info;
|
|
8321
|
+
}
|
|
8322
|
+
else {
|
|
8323
|
+
info.runner.expression = expression;
|
|
8324
|
+
}
|
|
8325
|
+
return info;
|
|
8326
|
+
}
|
|
8267
8327
|
/**
|
|
8268
8328
|
* Registers a single value change handler for one or multiple properties.
|
|
8269
8329
|
*
|
|
@@ -14195,6 +14255,7 @@ var settings = {
|
|
|
14195
14255
|
row: "row",
|
|
14196
14256
|
totalRow: "totalRow",
|
|
14197
14257
|
rowIndex: "rowIndex",
|
|
14258
|
+
visibleRowIndex: "visibleRowIndex",
|
|
14198
14259
|
rowValue: "rowValue",
|
|
14199
14260
|
rowName: "rowName",
|
|
14200
14261
|
rowTitle: "rowTitle",
|
|
@@ -15091,12 +15152,11 @@ class ExpressionValidator extends SurveyValidator {
|
|
|
15091
15152
|
return this.isRunningValue;
|
|
15092
15153
|
}
|
|
15093
15154
|
validate(value, name = null, properties = null) {
|
|
15094
|
-
if (!this.expression)
|
|
15095
|
-
return null;
|
|
15096
15155
|
if (!!this.conditionRunner) {
|
|
15097
15156
|
this.conditionRunner.onRunComplete = null;
|
|
15098
15157
|
}
|
|
15099
|
-
this.ensureConditionRunner(true)
|
|
15158
|
+
if (!this.ensureConditionRunner(true))
|
|
15159
|
+
return null;
|
|
15100
15160
|
this.conditionRunner.onRunComplete = (res) => {
|
|
15101
15161
|
this.isRunningValue = false;
|
|
15102
15162
|
if (!!this.onAsyncCompleted) {
|
|
@@ -15120,13 +15180,14 @@ class ExpressionValidator extends SurveyValidator {
|
|
|
15120
15180
|
return this.getLocalizationFormatString("invalidExpression", this.expression);
|
|
15121
15181
|
}
|
|
15122
15182
|
ensureConditionRunner(reNew) {
|
|
15123
|
-
|
|
15183
|
+
const expression = this.getExpressionFromSurvey("expression");
|
|
15184
|
+
if (!expression)
|
|
15124
15185
|
return false;
|
|
15125
15186
|
if (reNew || !this.conditionRunner) {
|
|
15126
|
-
this.conditionRunner = new ConditionRunner(
|
|
15187
|
+
this.conditionRunner = new ConditionRunner(expression);
|
|
15127
15188
|
}
|
|
15128
15189
|
else {
|
|
15129
|
-
this.conditionRunner.expression =
|
|
15190
|
+
this.conditionRunner.expression = expression;
|
|
15130
15191
|
}
|
|
15131
15192
|
return true;
|
|
15132
15193
|
}
|
|
@@ -15479,14 +15540,6 @@ class TextAreaModel {
|
|
|
15479
15540
|
}
|
|
15480
15541
|
}
|
|
15481
15542
|
|
|
15482
|
-
class TriggerExpressionInfo {
|
|
15483
|
-
constructor(name, canRun, doComplete) {
|
|
15484
|
-
this.name = name;
|
|
15485
|
-
this.canRun = canRun;
|
|
15486
|
-
this.doComplete = doComplete;
|
|
15487
|
-
this.getSecondRunner = () => undefined;
|
|
15488
|
-
}
|
|
15489
|
-
}
|
|
15490
15543
|
class QuestionValueGetterContext {
|
|
15491
15544
|
constructor(question, isUnwrapped) {
|
|
15492
15545
|
this.question = question;
|
|
@@ -15569,11 +15622,13 @@ class QuestionItemValueGetterContext extends ValueGetterContextCore {
|
|
|
15569
15622
|
return res;
|
|
15570
15623
|
}
|
|
15571
15624
|
fillQuestions(qs, q, res) {
|
|
15572
|
-
|
|
15573
|
-
|
|
15574
|
-
|
|
15575
|
-
|
|
15576
|
-
|
|
15625
|
+
if (Array.isArray(qs)) {
|
|
15626
|
+
qs.forEach((question) => {
|
|
15627
|
+
if (question !== q) {
|
|
15628
|
+
res.push(question);
|
|
15629
|
+
}
|
|
15630
|
+
});
|
|
15631
|
+
}
|
|
15577
15632
|
}
|
|
15578
15633
|
getRootObj() { return this.getQuestionData(); }
|
|
15579
15634
|
}
|
|
@@ -15641,6 +15696,7 @@ class Question extends SurveyElement {
|
|
|
15641
15696
|
super(name);
|
|
15642
15697
|
this.customWidgetData = { isNeedRender: true };
|
|
15643
15698
|
this.hasCssErrorCallback = () => false;
|
|
15699
|
+
this.triggersInfo = [];
|
|
15644
15700
|
this.isReadyValue = true;
|
|
15645
15701
|
this.dependedQuestions = [];
|
|
15646
15702
|
/**
|
|
@@ -15656,7 +15712,6 @@ class Question extends SurveyElement {
|
|
|
15656
15712
|
* Indicates the previous ready state.
|
|
15657
15713
|
*/
|
|
15658
15714
|
this.onReadyChanged = this.addEvent();
|
|
15659
|
-
this.triggersInfo = [];
|
|
15660
15715
|
this.isRunningValidatorsValue = false;
|
|
15661
15716
|
this.isValueChangedInSurvey = false;
|
|
15662
15717
|
this.allowNotifyValueChanged = true;
|
|
@@ -15674,13 +15729,7 @@ class Question extends SurveyElement {
|
|
|
15674
15729
|
this.createLocalizableString("requiredErrorText", this);
|
|
15675
15730
|
this.createLocalizableString("commentPlaceholder", this);
|
|
15676
15731
|
this.createLocalizableString("defaultDisplayValue", this);
|
|
15677
|
-
this.
|
|
15678
|
-
this.startSetValueOnExpression();
|
|
15679
|
-
this.updateValueWithDefaultsOrClear();
|
|
15680
|
-
this.finishSetValueOnExpression();
|
|
15681
|
-
});
|
|
15682
|
-
const setValueIfInfo = this.addTriggerInfo("setValueIf", () => true, () => this.runSetValueExpression());
|
|
15683
|
-
setValueIfInfo.getSecondRunner = () => this.getSetValueExpressionRunner();
|
|
15732
|
+
this.addTriggersInfo();
|
|
15684
15733
|
this.registerPropertyChangedHandlers(["width"], () => {
|
|
15685
15734
|
this.updateQuestionCss();
|
|
15686
15735
|
if (!!this.parent) {
|
|
@@ -16147,62 +16196,14 @@ class Question extends SurveyElement {
|
|
|
16147
16196
|
requiredAnsweredQuestionCount: !this.isEmpty() && this.isRequired ? 1 : 0,
|
|
16148
16197
|
};
|
|
16149
16198
|
}
|
|
16150
|
-
|
|
16151
|
-
|
|
16152
|
-
|
|
16153
|
-
|
|
16154
|
-
|
|
16155
|
-
|
|
16156
|
-
|
|
16157
|
-
|
|
16158
|
-
this.setValueExpressionRunner.expression = this.setValueExpression;
|
|
16159
|
-
}
|
|
16160
|
-
}
|
|
16161
|
-
runSetValueExpression() {
|
|
16162
|
-
if (!this.setValueExpression) {
|
|
16163
|
-
this.clearValue();
|
|
16164
|
-
}
|
|
16165
|
-
else {
|
|
16166
|
-
this.ensureSetValueExpressionRunner();
|
|
16167
|
-
this.setValueExpressionRunner.runContext(this.getValueGetterContext(), this.getDataFilteredProperties());
|
|
16168
|
-
}
|
|
16169
|
-
}
|
|
16170
|
-
getSetValueExpressionRunner() {
|
|
16171
|
-
this.ensureSetValueExpressionRunner();
|
|
16172
|
-
return this.setValueExpressionRunner;
|
|
16173
|
-
}
|
|
16174
|
-
addTriggerInfo(name, canRun, doComplete) {
|
|
16175
|
-
const info = new TriggerExpressionInfo(name, canRun, doComplete);
|
|
16176
|
-
this.triggersInfo.push(info);
|
|
16177
|
-
return info;
|
|
16178
|
-
}
|
|
16179
|
-
runTriggerInfo(info, keys) {
|
|
16180
|
-
const expression = this[info.name];
|
|
16181
|
-
if (!expression && !info.getSecondRunner() || info.isRunning || !info.canRun()) {
|
|
16182
|
-
return;
|
|
16183
|
-
}
|
|
16184
|
-
if (!info.runner) {
|
|
16185
|
-
info.runner = this.createExpressionRunner(expression);
|
|
16186
|
-
info.runner.onRunComplete = (res) => {
|
|
16187
|
-
if (res === true) {
|
|
16188
|
-
info.doComplete();
|
|
16189
|
-
}
|
|
16190
|
-
info.isRunning = false;
|
|
16191
|
-
};
|
|
16192
|
-
}
|
|
16193
|
-
else {
|
|
16194
|
-
info.runner.expression = expression;
|
|
16195
|
-
}
|
|
16196
|
-
if (!this.canExecuteTriggerByKeys(keys, info.runner, info.getSecondRunner()))
|
|
16197
|
-
return;
|
|
16198
|
-
info.isRunning = true;
|
|
16199
|
-
if (!expression && info.getSecondRunner()) {
|
|
16200
|
-
info.doComplete();
|
|
16201
|
-
info.isRunning = false;
|
|
16202
|
-
}
|
|
16203
|
-
else {
|
|
16204
|
-
info.runner.runContext(this.getValueGetterContext(), this.getDataFilteredProperties());
|
|
16205
|
-
}
|
|
16199
|
+
runTriggerInfo(info, keys, properties) {
|
|
16200
|
+
this.runExpressionByProperty(info.name, properties, (value) => {
|
|
16201
|
+
info.doComplete(value, properties);
|
|
16202
|
+
}, (runner) => {
|
|
16203
|
+
if (!info.canRun())
|
|
16204
|
+
return false;
|
|
16205
|
+
return !keys || this.canExecuteTriggerByKeys(keys, runner, this.getExpressionByProperty(info.secondName));
|
|
16206
|
+
});
|
|
16206
16207
|
}
|
|
16207
16208
|
canExecuteTriggerByKeys(keys, runner, secondRunner) {
|
|
16208
16209
|
if (!runner && !!secondRunner) {
|
|
@@ -16231,6 +16232,47 @@ class Question extends SurveyElement {
|
|
|
16231
16232
|
getValueGetterContext(isUnwrapped) {
|
|
16232
16233
|
return new QuestionValueGetterContext(this, isUnwrapped);
|
|
16233
16234
|
}
|
|
16235
|
+
addTriggersInfo() {
|
|
16236
|
+
this.addTriggerInfo({
|
|
16237
|
+
name: "resetValueIf",
|
|
16238
|
+
canRun: () => !this.isEmpty(),
|
|
16239
|
+
doComplete: (res, properties) => {
|
|
16240
|
+
if (res === true) {
|
|
16241
|
+
this.startSetValueOnExpression();
|
|
16242
|
+
this.updateValueWithDefaultsOrClear();
|
|
16243
|
+
this.finishSetValueOnExpression();
|
|
16244
|
+
}
|
|
16245
|
+
}
|
|
16246
|
+
});
|
|
16247
|
+
this.addTriggerInfo({
|
|
16248
|
+
name: "setValueIf",
|
|
16249
|
+
secondName: "setValueExpression",
|
|
16250
|
+
canRun: () => true,
|
|
16251
|
+
doComplete: (res, properties) => {
|
|
16252
|
+
if (res) {
|
|
16253
|
+
if (!this.setValueExpression) {
|
|
16254
|
+
this.clearValue();
|
|
16255
|
+
}
|
|
16256
|
+
else {
|
|
16257
|
+
const info = {
|
|
16258
|
+
name: "setValueExpression",
|
|
16259
|
+
canRun: () => true,
|
|
16260
|
+
doComplete: (res, properties) => this.runExpressionSetValue(res)
|
|
16261
|
+
};
|
|
16262
|
+
this.runTriggerInfo(info, undefined, properties);
|
|
16263
|
+
}
|
|
16264
|
+
}
|
|
16265
|
+
}
|
|
16266
|
+
});
|
|
16267
|
+
this.addTriggerInfo({
|
|
16268
|
+
name: "setValueExpression",
|
|
16269
|
+
canRun: () => !this.setValueIf,
|
|
16270
|
+
doComplete: (res, properties) => this.runExpressionSetValue(res)
|
|
16271
|
+
});
|
|
16272
|
+
}
|
|
16273
|
+
addTriggerInfo(info) {
|
|
16274
|
+
this.triggersInfo.push(info);
|
|
16275
|
+
}
|
|
16234
16276
|
runTriggers(name, value, keys) {
|
|
16235
16277
|
if (this.isSettingQuestionValue || (this.parentQuestion && this.parentQuestion.getValueName() === name))
|
|
16236
16278
|
return;
|
|
@@ -16238,8 +16280,9 @@ class Question extends SurveyElement {
|
|
|
16238
16280
|
keys = {};
|
|
16239
16281
|
keys[name] = value;
|
|
16240
16282
|
}
|
|
16283
|
+
const properties = this.getDataFilteredProperties();
|
|
16241
16284
|
this.triggersInfo.forEach(info => {
|
|
16242
|
-
this.runTriggerInfo(info, keys);
|
|
16285
|
+
this.runTriggerInfo(info, keys, properties);
|
|
16243
16286
|
});
|
|
16244
16287
|
}
|
|
16245
16288
|
runConditions() {
|
|
@@ -16351,7 +16394,7 @@ class Question extends SurveyElement {
|
|
|
16351
16394
|
this.resetSingleInputCore();
|
|
16352
16395
|
}
|
|
16353
16396
|
resetSingleInputCore() {
|
|
16354
|
-
const prev = this.singleInputQuestion;
|
|
16397
|
+
const prev = this.getPropertyValue("singleInputQuestion");
|
|
16355
16398
|
this.resetPropertyValue("singleInputQuestion");
|
|
16356
16399
|
if (!!prev) {
|
|
16357
16400
|
this.onSingleInputChanged();
|
|
@@ -17506,8 +17549,7 @@ class Question extends SurveyElement {
|
|
|
17506
17549
|
properties["question"] = this;
|
|
17507
17550
|
this.runConditionCore(properties);
|
|
17508
17551
|
if (!this.isValueChangedDirectly && (!this.isClearValueOnHidden || this.isVisibleInSurvey)) {
|
|
17509
|
-
this.
|
|
17510
|
-
this.runDefaultValueExpression(this.defaultValueRunner, properties);
|
|
17552
|
+
this.runDefaultValueExpression(properties);
|
|
17511
17553
|
}
|
|
17512
17554
|
}
|
|
17513
17555
|
get isInDesignMode() {
|
|
@@ -18041,15 +18083,6 @@ class Question extends SurveyElement {
|
|
|
18041
18083
|
isDefaultValueEmpty() {
|
|
18042
18084
|
return !this.defaultValueExpression && this.isValueEmpty(this.defaultValue, !this.allowSpaceAsAnswer);
|
|
18043
18085
|
}
|
|
18044
|
-
getDefaultRunner(runner, expression) {
|
|
18045
|
-
if (!runner && !!expression) {
|
|
18046
|
-
runner = this.createExpressionRunner(expression);
|
|
18047
|
-
}
|
|
18048
|
-
if (!!runner) {
|
|
18049
|
-
runner.expression = expression;
|
|
18050
|
-
}
|
|
18051
|
-
return runner;
|
|
18052
|
-
}
|
|
18053
18086
|
setDefaultValue() {
|
|
18054
18087
|
this.setDefaultValueCore((val) => {
|
|
18055
18088
|
val = this.convertToCorrectValue(val);
|
|
@@ -18061,9 +18094,13 @@ class Question extends SurveyElement {
|
|
|
18061
18094
|
setDefaultIntoValue(val) {
|
|
18062
18095
|
this.value = val;
|
|
18063
18096
|
}
|
|
18064
|
-
setDefaultValueCore(
|
|
18065
|
-
|
|
18066
|
-
|
|
18097
|
+
setDefaultValueCore(setFunc) {
|
|
18098
|
+
const func = (val) => {
|
|
18099
|
+
this.runExpressionSetValueCore(val, setFunc);
|
|
18100
|
+
};
|
|
18101
|
+
if (!this.runDefaultValueExpression(undefined, func)) {
|
|
18102
|
+
func(this.getUnbindValue(this.defaultValue));
|
|
18103
|
+
}
|
|
18067
18104
|
}
|
|
18068
18105
|
updateValueWithDefaultsOrClear() {
|
|
18069
18106
|
if (this.isDesignMode || this.isLoadingFromJson)
|
|
@@ -18078,14 +18115,6 @@ class Question extends SurveyElement {
|
|
|
18078
18115
|
isValueExpression(val) {
|
|
18079
18116
|
return !!val && typeof val == "string" && val.length > 0 && val[0] == "=";
|
|
18080
18117
|
}
|
|
18081
|
-
setValueAndRunExpression(runner, defaultValue, setFunc, properties = null) {
|
|
18082
|
-
const func = (val) => {
|
|
18083
|
-
this.runExpressionSetValueCore(val, setFunc);
|
|
18084
|
-
};
|
|
18085
|
-
if (!this.runDefaultValueExpression(runner, properties, func)) {
|
|
18086
|
-
func(defaultValue);
|
|
18087
|
-
}
|
|
18088
|
-
}
|
|
18089
18118
|
convertFuncValuetoQuestionValue(val) {
|
|
18090
18119
|
return Helpers.convertValToQuestionVal(val);
|
|
18091
18120
|
}
|
|
@@ -18109,8 +18138,8 @@ class Question extends SurveyElement {
|
|
|
18109
18138
|
var _a;
|
|
18110
18139
|
(_a = this.survey) === null || _a === void 0 ? void 0 : _a.finishSetValueOnExpression();
|
|
18111
18140
|
}
|
|
18112
|
-
runDefaultValueExpression(
|
|
18113
|
-
if (!
|
|
18141
|
+
runDefaultValueExpression(properties = null, setFunc) {
|
|
18142
|
+
if (!this.data)
|
|
18114
18143
|
return false;
|
|
18115
18144
|
if (!setFunc) {
|
|
18116
18145
|
setFunc = (val) => {
|
|
@@ -18121,17 +18150,13 @@ class Question extends SurveyElement {
|
|
|
18121
18150
|
properties = this.defaultValueExpression ? this.data.getFilteredProperties() : {};
|
|
18122
18151
|
properties["question"] = this;
|
|
18123
18152
|
}
|
|
18124
|
-
|
|
18125
|
-
|
|
18126
|
-
|
|
18127
|
-
|
|
18128
|
-
|
|
18129
|
-
|
|
18130
|
-
|
|
18131
|
-
};
|
|
18132
|
-
runner.runContext(this.getValueGetterContext(), properties);
|
|
18133
|
-
}
|
|
18134
|
-
return true;
|
|
18153
|
+
return this.runExpressionByProperty("defaultValueExpression", properties, (res) => {
|
|
18154
|
+
if (res == undefined)
|
|
18155
|
+
res = this.defaultValue;
|
|
18156
|
+
this.isChangingViaDefaultValue = true;
|
|
18157
|
+
setFunc(res);
|
|
18158
|
+
this.isChangingViaDefaultValue = false;
|
|
18159
|
+
});
|
|
18135
18160
|
}
|
|
18136
18161
|
/**
|
|
18137
18162
|
* A comment to the selected question value. Enable the `showCommentArea` property to allow users to leave comments.
|
|
@@ -18411,10 +18436,14 @@ class Question extends SurveyElement {
|
|
|
18411
18436
|
}
|
|
18412
18437
|
}
|
|
18413
18438
|
setNewValue(newValue) {
|
|
18439
|
+
if (this.survey) {
|
|
18440
|
+
newValue = this.survey.questionValueChanging(this, newValue);
|
|
18441
|
+
}
|
|
18414
18442
|
if (this.isNewValueEqualsToValue(newValue))
|
|
18415
18443
|
return;
|
|
18416
18444
|
if (!this.checkIsValueCorrect(newValue))
|
|
18417
18445
|
return;
|
|
18446
|
+
const oldValue = this.getUnbindValue(this.value);
|
|
18418
18447
|
this.isOldAnswered = this.isAnswered;
|
|
18419
18448
|
this.isSettingQuestionValue = true;
|
|
18420
18449
|
this.setNewValueInData(newValue);
|
|
@@ -18427,7 +18456,11 @@ class Question extends SurveyElement {
|
|
|
18427
18456
|
if (this.parent) {
|
|
18428
18457
|
this.parent.onQuestionValueChanged(this);
|
|
18429
18458
|
}
|
|
18459
|
+
if (this.survey) {
|
|
18460
|
+
this.survey.questionValueChanged(this, oldValue);
|
|
18461
|
+
}
|
|
18430
18462
|
}
|
|
18463
|
+
getValueChangingOptions(childQuestion) { return undefined; }
|
|
18431
18464
|
checkIsValueCorrect(val) {
|
|
18432
18465
|
const res = this.isValueEmpty(val, !this.allowSpaceAsAnswer) || this.isNewValueCorrect(val);
|
|
18433
18466
|
if (!res) {
|
|
@@ -19458,19 +19491,21 @@ class ItemValue extends BaseAction {
|
|
|
19458
19491
|
return this.getEnableConditionRunner();
|
|
19459
19492
|
}
|
|
19460
19493
|
getVisibleConditionRunner() {
|
|
19461
|
-
|
|
19494
|
+
const expression = this.getExpressionFromSurvey("visibleIf");
|
|
19495
|
+
if (!expression)
|
|
19462
19496
|
return null;
|
|
19463
19497
|
if (!this.visibleConditionRunner)
|
|
19464
|
-
this.visibleConditionRunner = new ConditionRunner(
|
|
19465
|
-
this.visibleConditionRunner.expression =
|
|
19498
|
+
this.visibleConditionRunner = new ConditionRunner(expression);
|
|
19499
|
+
this.visibleConditionRunner.expression = expression;
|
|
19466
19500
|
return this.visibleConditionRunner;
|
|
19467
19501
|
}
|
|
19468
19502
|
getEnableConditionRunner() {
|
|
19469
|
-
|
|
19503
|
+
const expression = this.getExpressionFromSurvey("enableIf");
|
|
19504
|
+
if (!expression)
|
|
19470
19505
|
return null;
|
|
19471
19506
|
if (!this.enableConditionRunner)
|
|
19472
|
-
this.enableConditionRunner = new ConditionRunner(
|
|
19473
|
-
this.enableConditionRunner.expression =
|
|
19507
|
+
this.enableConditionRunner = new ConditionRunner(expression);
|
|
19508
|
+
this.enableConditionRunner.expression = expression;
|
|
19474
19509
|
return this.enableConditionRunner;
|
|
19475
19510
|
}
|
|
19476
19511
|
get selected() {
|
|
@@ -19668,9 +19703,8 @@ class CalculatedValue extends Base {
|
|
|
19668
19703
|
this.runExpression(this.data.getFilteredProperties());
|
|
19669
19704
|
}
|
|
19670
19705
|
runExpressionCore(calculatedValues, properties) {
|
|
19671
|
-
if (!this.canRunExpression)
|
|
19706
|
+
if (!this.canRunExpression || !this.ensureExpression())
|
|
19672
19707
|
return;
|
|
19673
|
-
this.ensureExpression();
|
|
19674
19708
|
this.locCalculation();
|
|
19675
19709
|
if (!!calculatedValues) {
|
|
19676
19710
|
this.runDependentExpressions(calculatedValues, properties);
|
|
@@ -19689,17 +19723,22 @@ class CalculatedValue extends Base {
|
|
|
19689
19723
|
}
|
|
19690
19724
|
}
|
|
19691
19725
|
ensureExpression() {
|
|
19726
|
+
const expression = this.getExpressionFromSurvey("expression");
|
|
19727
|
+
if (!expression)
|
|
19728
|
+
return false;
|
|
19692
19729
|
if (!!this.expressionRunner) {
|
|
19693
|
-
this.expressionRunner.expression =
|
|
19694
|
-
return;
|
|
19730
|
+
this.expressionRunner.expression = expression;
|
|
19695
19731
|
}
|
|
19696
|
-
|
|
19697
|
-
|
|
19698
|
-
|
|
19699
|
-
|
|
19700
|
-
|
|
19701
|
-
|
|
19702
|
-
|
|
19732
|
+
else {
|
|
19733
|
+
this.expressionRunner = this.createExpressionRunner(expression);
|
|
19734
|
+
this.expressionRunner.onRunComplete = newValue => {
|
|
19735
|
+
if (!Helpers.isTwoValueEquals(newValue, this.value, false, true, false)) {
|
|
19736
|
+
this.setValue(newValue);
|
|
19737
|
+
}
|
|
19738
|
+
this.unlocCalculation();
|
|
19739
|
+
};
|
|
19740
|
+
}
|
|
19741
|
+
return true;
|
|
19703
19742
|
}
|
|
19704
19743
|
}
|
|
19705
19744
|
Serializer.addClass("calculatedvalue", [
|
|
@@ -19722,9 +19761,10 @@ class ExpressionItem extends Base {
|
|
|
19722
19761
|
return "expressionitem";
|
|
19723
19762
|
}
|
|
19724
19763
|
runCondition(properties) {
|
|
19725
|
-
|
|
19764
|
+
const expression = this.getExpressionFromSurvey("expression");
|
|
19765
|
+
if (!expression)
|
|
19726
19766
|
return false;
|
|
19727
|
-
return new ConditionRunner(
|
|
19767
|
+
return new ConditionRunner(expression).runContext(this.getValueGetterContext(), properties);
|
|
19728
19768
|
}
|
|
19729
19769
|
/**
|
|
19730
19770
|
* The expression property. If this expression returns true, then survey will use html property to show on complete page.
|
|
@@ -20715,7 +20755,6 @@ class QuestionMatrixBaseModel extends Question {
|
|
|
20715
20755
|
this.onRowsChanged();
|
|
20716
20756
|
}
|
|
20717
20757
|
}
|
|
20718
|
-
isRowsFiltered() { return !!this.filteredRows; }
|
|
20719
20758
|
clearGeneratedRows() {
|
|
20720
20759
|
this.generatedVisibleRows = null;
|
|
20721
20760
|
}
|
|
@@ -20723,20 +20762,14 @@ class QuestionMatrixBaseModel extends Question {
|
|
|
20723
20762
|
runConditionsForRows(properties) {
|
|
20724
20763
|
const showInvisibile = !!this.survey && this.survey.areInvisibleElementsShowing;
|
|
20725
20764
|
const runner = !showInvisibile ? this.createRowsVisibleIfRunner() : null;
|
|
20726
|
-
this.
|
|
20727
|
-
const hasChanged = ItemValue.runConditionsForItems(this.rows, this.filteredRows, runner, properties, !showInvisibile);
|
|
20765
|
+
const hasChanged = ItemValue.runConditionsForItems(this.rows, undefined, runner, properties, !showInvisibile);
|
|
20728
20766
|
ItemValue.runEnabledConditionsForItems(this.rows, undefined, properties);
|
|
20729
|
-
if (this.filteredRows.length === this.rows.length) {
|
|
20730
|
-
this.filteredRows = null;
|
|
20731
|
-
if (!!this.generatedVisibleRows && this.generatedVisibleRows.length !== this.rows.length) {
|
|
20732
|
-
this.generatedVisibleRows = null;
|
|
20733
|
-
}
|
|
20734
|
-
}
|
|
20735
20767
|
return hasChanged;
|
|
20736
20768
|
}
|
|
20737
20769
|
runConditionsForColumns(properties) {
|
|
20738
20770
|
const useColumnsExpression = !!this.survey && !this.survey.areInvisibleElementsShowing;
|
|
20739
|
-
const
|
|
20771
|
+
const expression = this.getExpressionFromSurvey("columnsVisibleIf");
|
|
20772
|
+
const runner = useColumnsExpression && !!expression ? new ConditionRunner(expression) : null;
|
|
20740
20773
|
return ItemValue.runConditionsForItems(this.columns, undefined, runner, properties, this.shouldRunColumnExpression());
|
|
20741
20774
|
}
|
|
20742
20775
|
clearInvisibleColumnValues() { }
|
|
@@ -21275,11 +21308,24 @@ class QuestionCustomModelBase extends Question {
|
|
|
21275
21308
|
this.initElement(this.getElement());
|
|
21276
21309
|
this.isSettingValOnLoading = false;
|
|
21277
21310
|
}
|
|
21311
|
+
onCustomQuestionLoaded() {
|
|
21312
|
+
if (!this.isLoadedCalled && !!this.customQuestion && !!this.survey) {
|
|
21313
|
+
this.customQuestion.onLoaded(this);
|
|
21314
|
+
this.isLoadedCalled = true;
|
|
21315
|
+
}
|
|
21316
|
+
}
|
|
21278
21317
|
onSurveyLoad() {
|
|
21279
21318
|
super.onSurveyLoad();
|
|
21319
|
+
this.isLoadedCalled = false;
|
|
21280
21320
|
if (!!this.getElement()) {
|
|
21281
21321
|
this.getElement().onSurveyLoad();
|
|
21282
|
-
|
|
21322
|
+
}
|
|
21323
|
+
this.onCustomQuestionLoaded();
|
|
21324
|
+
}
|
|
21325
|
+
setSurveyCore(value) {
|
|
21326
|
+
super.setSurveyCore(value);
|
|
21327
|
+
if (this.isLoadedCalled === false && value) {
|
|
21328
|
+
this.onCustomQuestionLoaded();
|
|
21283
21329
|
}
|
|
21284
21330
|
}
|
|
21285
21331
|
afterRenderQuestionElement(el) {
|
|
@@ -21922,6 +21968,9 @@ class QuestionCompositeModel extends QuestionCustomModelBase {
|
|
|
21922
21968
|
super.setValue(name, newValue, locNotification, allowNotifyValueChanged);
|
|
21923
21969
|
this.settingNewValue = false;
|
|
21924
21970
|
this.runPanelTriggers(settings.expressionVariables.composite + "." + name, newValue);
|
|
21971
|
+
if (this.isEditingSurveyElement) {
|
|
21972
|
+
this.runCondition(this.getFilteredProperties());
|
|
21973
|
+
}
|
|
21925
21974
|
}
|
|
21926
21975
|
setComment(name, newValue, locNotification) {
|
|
21927
21976
|
let val = this.getUnbindValue(this.value);
|
|
@@ -22177,11 +22226,6 @@ class QuestionExpressionModel extends Question {
|
|
|
22177
22226
|
constructor(name) {
|
|
22178
22227
|
super(name);
|
|
22179
22228
|
this.createLocalizableString("format", this);
|
|
22180
|
-
this.registerPropertyChangedHandlers(["expression"], () => {
|
|
22181
|
-
if (this.expressionRunner) {
|
|
22182
|
-
this.expressionRunner = this.createRunner();
|
|
22183
|
-
}
|
|
22184
|
-
});
|
|
22185
22229
|
this.registerPropertyChangedHandlers(["format", "currency", "displayStyle"], () => {
|
|
22186
22230
|
this.updateFormatedValue();
|
|
22187
22231
|
});
|
|
@@ -22219,22 +22263,18 @@ class QuestionExpressionModel extends Question {
|
|
|
22219
22263
|
this.setPropertyValue("expression", val);
|
|
22220
22264
|
}
|
|
22221
22265
|
locCalculation() {
|
|
22222
|
-
this.
|
|
22266
|
+
this.isExecutionLocked = true;
|
|
22223
22267
|
}
|
|
22224
22268
|
unlocCalculation() {
|
|
22225
|
-
this.
|
|
22269
|
+
this.isExecutionLocked = false;
|
|
22226
22270
|
}
|
|
22227
22271
|
runConditionCore(properties) {
|
|
22228
22272
|
super.runConditionCore(properties);
|
|
22229
|
-
if (!this.
|
|
22230
|
-
this.expressionIsRunning ||
|
|
22231
|
-
(!this.runIfReadOnly && this.isReadOnly))
|
|
22273
|
+
if (this.isExecutionLocked || !this.runIfReadOnly && this.isReadOnly)
|
|
22232
22274
|
return;
|
|
22233
|
-
this.
|
|
22234
|
-
|
|
22235
|
-
|
|
22236
|
-
}
|
|
22237
|
-
this.expressionRunner.runContext(this.getValueGetterContext(), properties);
|
|
22275
|
+
this.runExpressionByProperty("expression", properties, (val) => {
|
|
22276
|
+
this.value = this.roundValue(val);
|
|
22277
|
+
});
|
|
22238
22278
|
}
|
|
22239
22279
|
canCollectErrors() {
|
|
22240
22280
|
return true;
|
|
@@ -22242,14 +22282,6 @@ class QuestionExpressionModel extends Question {
|
|
|
22242
22282
|
hasRequiredError() {
|
|
22243
22283
|
return false;
|
|
22244
22284
|
}
|
|
22245
|
-
createRunner() {
|
|
22246
|
-
const res = this.createExpressionRunner(this.expression);
|
|
22247
|
-
res.onRunComplete = (newValue) => {
|
|
22248
|
-
this.value = this.roundValue(newValue);
|
|
22249
|
-
this.unlocCalculation();
|
|
22250
|
-
};
|
|
22251
|
-
return res;
|
|
22252
|
-
}
|
|
22253
22285
|
/**
|
|
22254
22286
|
* The maximum number of fraction digits. Applies only if the `displayStyle` property is not `"none"`. Accepts values in the range from -1 to 20, where -1 disables the property.
|
|
22255
22287
|
*
|
|
@@ -22721,6 +22753,7 @@ var matrixDropdownColumnTypes = {
|
|
|
22721
22753
|
},
|
|
22722
22754
|
expression: {},
|
|
22723
22755
|
rating: {},
|
|
22756
|
+
slider: {}
|
|
22724
22757
|
};
|
|
22725
22758
|
/**
|
|
22726
22759
|
* An auxiliary class that describes a column in a [Multi-Select Matrix](https://surveyjs.io/form-library/documentation/api-reference/matrix-table-with-dropdown-list) or [Dynamic Matrix](https://surveyjs.io/form-library/documentation/api-reference/dynamic-matrix-table-question-model).
|
|
@@ -22817,6 +22850,7 @@ class MatrixDropdownColumn extends Base {
|
|
|
22817
22850
|
* - [`"boolean"`](https://surveyjs.io/form-library/documentation/api-reference/boolean-question-model)
|
|
22818
22851
|
* - [`"expression"`](https://surveyjs.io/form-library/documentation/api-reference/expression-model)
|
|
22819
22852
|
* - [`"rating"`](https://surveyjs.io/form-library/documentation/api-reference/rating-scale-question-model)
|
|
22853
|
+
* - [`"slider"`](https://surveyjs.io/form-library/documentation/api-reference/questionslidermodel)
|
|
22820
22854
|
* - `"default"` (default) - Inherits the input type from the [`cellType`](https://surveyjs.io/form-library/documentation/api-reference/matrix-table-with-dropdown-list#cellType) property specified for the parent matrix.
|
|
22821
22855
|
*
|
|
22822
22856
|
* The input types are based upon standalone question types. Depending on the selected input type, the matrix column can have additional configuration properties inherited from the corresponding question type. For instance, Dropdown, Checkboxes, Radio Button Group, and Tag Box columns can specify the [`choices`](https://surveyjs.io/form-library/documentation/api-reference/radio-button-question-model#choices) array, similar to the question types upon which they are based. Refer to the API Reference of these question types for a full list of available properties.
|
|
@@ -24883,6 +24917,9 @@ class MatrixRowGetterContext extends QuestionItemValueGetterContext {
|
|
|
24883
24917
|
if (name === setVar.rowIndex.toLocaleLowerCase()) {
|
|
24884
24918
|
return this.row.rowIndex;
|
|
24885
24919
|
}
|
|
24920
|
+
if (name === setVar.visibleRowIndex.toLocaleLowerCase()) {
|
|
24921
|
+
return this.getQuestionData().visibleRows.indexOf(this.row) + 1;
|
|
24922
|
+
}
|
|
24886
24923
|
if ([setVar.item, setVar.rowName.toLocaleLowerCase(), setVar.rowValue.toLocaleLowerCase()].indexOf(name) > -1) {
|
|
24887
24924
|
return this.row.rowName;
|
|
24888
24925
|
}
|
|
@@ -25860,9 +25897,19 @@ class QuestionMatrixDropdownModelBase extends QuestionMatrixBaseModel {
|
|
|
25860
25897
|
this.clearVisibleRows();
|
|
25861
25898
|
this.resetRenderedTable();
|
|
25862
25899
|
super.onRowsChanged();
|
|
25900
|
+
this.updateRowsVisibleIndexes();
|
|
25901
|
+
}
|
|
25902
|
+
updateRowsVisibleIndexes() {
|
|
25863
25903
|
const rows = this.visibleRows;
|
|
25904
|
+
if (!Array.isArray(rows))
|
|
25905
|
+
return;
|
|
25906
|
+
const vriName = settings.expressionVariables.visibleRowIndex;
|
|
25907
|
+
const keys = {};
|
|
25908
|
+
keys[vriName] = 0;
|
|
25864
25909
|
for (let i = 0; i < rows.length; i++) {
|
|
25865
25910
|
rows[i].visibleIndex = i;
|
|
25911
|
+
keys[vriName] = i + 1;
|
|
25912
|
+
rows[i].runTriggers(vriName, i + 1, keys);
|
|
25866
25913
|
}
|
|
25867
25914
|
}
|
|
25868
25915
|
onStartRowAddingRemoving() {
|
|
@@ -25985,6 +26032,7 @@ class QuestionMatrixDropdownModelBase extends QuestionMatrixBaseModel {
|
|
|
25985
26032
|
* - [`"boolean"`](https://surveyjs.io/form-library/documentation/api-reference/boolean-question-model)
|
|
25986
26033
|
* - [`"expression"`](https://surveyjs.io/form-library/documentation/api-reference/expression-model)
|
|
25987
26034
|
* - [`"rating"`](https://surveyjs.io/form-library/documentation/api-reference/rating-scale-question-model)
|
|
26035
|
+
* - [`"slider"`](https://surveyjs.io/form-library/documentation/api-reference/questionslidermodel)
|
|
25988
26036
|
*
|
|
25989
26037
|
* Default value: `"dropdown"` (inherited from [`settings.matrix.defaultCellType`](https://surveyjs.io/form-library/documentation/settings#matrixDefaultCellType))
|
|
25990
26038
|
*
|
|
@@ -26227,22 +26275,24 @@ class QuestionMatrixDropdownModelBase extends QuestionMatrixBaseModel {
|
|
|
26227
26275
|
runCellsCondition(properties) {
|
|
26228
26276
|
if (this.isDesignMode)
|
|
26229
26277
|
return;
|
|
26278
|
+
const rowsVisibleIf = this.getExpressionFromSurvey("rowsVisibleIf");
|
|
26230
26279
|
const rows = this.generatedVisibleRows;
|
|
26231
26280
|
if (!!rows) {
|
|
26232
26281
|
for (var i = 0; i < rows.length; i++) {
|
|
26233
|
-
rows[i].runCondition(properties,
|
|
26282
|
+
rows[i].runCondition(properties, rowsVisibleIf);
|
|
26234
26283
|
}
|
|
26235
26284
|
}
|
|
26236
26285
|
this.checkColumnsVisibility();
|
|
26237
26286
|
this.checkColumnsRenderedRequired();
|
|
26238
26287
|
}
|
|
26239
26288
|
runConditionsForColumns(properties) {
|
|
26289
|
+
const expression = this.getExpressionFromSurvey("columnsVisibleIf");
|
|
26240
26290
|
this.columns.forEach(column => {
|
|
26241
|
-
if (!
|
|
26291
|
+
if (!expression) {
|
|
26242
26292
|
column.isColumnsVisibleIf = true;
|
|
26243
26293
|
}
|
|
26244
26294
|
else {
|
|
26245
|
-
const condition = new ConditionRunner(
|
|
26295
|
+
const condition = new ConditionRunner(expression);
|
|
26246
26296
|
column.isColumnsVisibleIf = condition.runContext(column.getValueGetterContext(), properties) === true;
|
|
26247
26297
|
}
|
|
26248
26298
|
});
|
|
@@ -26431,6 +26481,7 @@ class QuestionMatrixDropdownModelBase extends QuestionMatrixBaseModel {
|
|
|
26431
26481
|
* The template can contain the following placeholders:
|
|
26432
26482
|
*
|
|
26433
26483
|
* - `{rowIndex}` - A row index within the collection of all rows. Starts with 1.
|
|
26484
|
+
* - `{visibleRowIndex}` - A row index within the collection of visible rows. Starts with 1.
|
|
26434
26485
|
* - `{rowName}` - A row name (the `value` property within objects in the [`rows`](#rows) array). Use this placeholder if you need to distinguish between matrix rows.
|
|
26435
26486
|
* - `{rowTitle}` - A row title (the `text` property within objects in the `rows` array).
|
|
26436
26487
|
* - `{row.columnname}` - The value of a cell in the same row.
|
|
@@ -26496,6 +26547,7 @@ class QuestionMatrixDropdownModelBase extends QuestionMatrixBaseModel {
|
|
|
26496
26547
|
return this.visibleRowsArray;
|
|
26497
26548
|
this.generateVisibleRowsIfNeeded();
|
|
26498
26549
|
this.visibleRowsArray = this.getVisibleFromGenerated(this.generatedVisibleRows);
|
|
26550
|
+
this.updateRowsVisibleIndexes();
|
|
26499
26551
|
return this.visibleRowsArray;
|
|
26500
26552
|
}
|
|
26501
26553
|
get allRows() {
|
|
@@ -27252,8 +27304,10 @@ class QuestionMatrixDropdownModelBase extends QuestionMatrixBaseModel {
|
|
|
27252
27304
|
if (this.isObject(rowValue) && Object.keys(rowValue).length === 0) {
|
|
27253
27305
|
newValue = this.deleteRowValue(newValue, row);
|
|
27254
27306
|
}
|
|
27307
|
+
newValue = this.correctValueForMinMaxRows(newValue);
|
|
27255
27308
|
return { value: newValue, rowValue: rowValue };
|
|
27256
27309
|
}
|
|
27310
|
+
correctValueForMinMaxRows(newValue) { return newValue; }
|
|
27257
27311
|
getRowIndex(row) {
|
|
27258
27312
|
if (!Array.isArray(this.generatedVisibleRows))
|
|
27259
27313
|
return -1;
|
|
@@ -27407,7 +27461,7 @@ class QuestionMatrixDropdownModelBase extends QuestionMatrixBaseModel {
|
|
|
27407
27461
|
}
|
|
27408
27462
|
}
|
|
27409
27463
|
isRowsFiltered() {
|
|
27410
|
-
return
|
|
27464
|
+
return this.visibleRows !== this.generatedVisibleRows;
|
|
27411
27465
|
}
|
|
27412
27466
|
getQuestionFromArray(name, index) {
|
|
27413
27467
|
if (index >= this.visibleRows.length)
|
|
@@ -27476,7 +27530,9 @@ class QuestionMatrixDropdownModelBase extends QuestionMatrixBaseModel {
|
|
|
27476
27530
|
Serializer.addClass("matrixdropdownbase", [
|
|
27477
27531
|
{
|
|
27478
27532
|
name: "columns:matrixdropdowncolumns",
|
|
27479
|
-
|
|
27533
|
+
uniqueProperty: "name",
|
|
27534
|
+
className: "matrixdropdowncolumn",
|
|
27535
|
+
isArray: true
|
|
27480
27536
|
},
|
|
27481
27537
|
{
|
|
27482
27538
|
name: "columnLayout",
|
|
@@ -28700,6 +28756,9 @@ class QuestionMatrixDynamicModel extends QuestionMatrixDropdownModelBase {
|
|
|
28700
28756
|
valueFromData(val) {
|
|
28701
28757
|
if (this.minRowCount < 1 || this.isEmpty())
|
|
28702
28758
|
return super.valueFromData(val);
|
|
28759
|
+
return this.correctValueForMinMaxRows(val);
|
|
28760
|
+
}
|
|
28761
|
+
correctValueForMinMaxRows(val) {
|
|
28703
28762
|
if (!Array.isArray(val))
|
|
28704
28763
|
val = [];
|
|
28705
28764
|
for (var i = val.length; i < this.minRowCount; i++)
|
|
@@ -29230,9 +29289,12 @@ class QuestionMatrixDynamicModel extends QuestionMatrixDropdownModelBase {
|
|
|
29230
29289
|
this.onEndRowRemoving(row);
|
|
29231
29290
|
}
|
|
29232
29291
|
removeRowCore(index) {
|
|
29233
|
-
var row = this.
|
|
29234
|
-
? this.
|
|
29292
|
+
var row = this.visibleRows
|
|
29293
|
+
? this.visibleRows[index]
|
|
29235
29294
|
: null;
|
|
29295
|
+
index = this.generatedVisibleRows.indexOf(row);
|
|
29296
|
+
if (index < 0)
|
|
29297
|
+
return;
|
|
29236
29298
|
if (this.generatedVisibleRows && index < this.generatedVisibleRows.length) {
|
|
29237
29299
|
this.generatedVisibleRows.splice(index, 1);
|
|
29238
29300
|
}
|
|
@@ -35552,6 +35614,10 @@ class SurveyModel extends SurveyElementCore {
|
|
|
35552
35614
|
*/
|
|
35553
35615
|
this.onDragDropAllow = this.addEvent();
|
|
35554
35616
|
this.onMatrixRowDragOver = this.addEvent();
|
|
35617
|
+
/**
|
|
35618
|
+
* An event that is raised when an [expression](https://surveyjs.io/form-library/documentation/design-survey/conditional-logic#expressions) is about to be evaluated. Use this event to intercept or cancel the evaluation.
|
|
35619
|
+
*/
|
|
35620
|
+
this.onExpressionRunning = this.addEvent();
|
|
35555
35621
|
/**
|
|
35556
35622
|
* An event this is raised before a survey element (usually page) is scrolled to the top. Use this event to cancel the scroll operation.
|
|
35557
35623
|
*/
|
|
@@ -37173,6 +37239,11 @@ class SurveyModel extends SurveyElementCore {
|
|
|
37173
37239
|
};
|
|
37174
37240
|
return exp.runContext(this.getValueGetterContext(), properties) || onCompleteRes;
|
|
37175
37241
|
}
|
|
37242
|
+
beforeExpressionRunning(obj, propertyName, expression) {
|
|
37243
|
+
const opt = { element: obj, propertyName: propertyName, expression: expression, allow: true };
|
|
37244
|
+
this.onExpressionRunning.fire(this, opt);
|
|
37245
|
+
return opt.allow ? opt.expression : "";
|
|
37246
|
+
}
|
|
37176
37247
|
get isSettingValueOnExpression() { return this.setValueOnExpressionCounter > 0; }
|
|
37177
37248
|
startSetValueOnExpression() {
|
|
37178
37249
|
this.setValueOnExpressionCounter++;
|
|
@@ -40408,14 +40479,6 @@ class SurveyModel extends SurveyElementCore {
|
|
|
40408
40479
|
this.onDynamicPanelRemoving.fire(this, options);
|
|
40409
40480
|
return options.allow;
|
|
40410
40481
|
}
|
|
40411
|
-
dynamicPanelItemValueChanged(question, options) {
|
|
40412
|
-
options.question = question;
|
|
40413
|
-
this.onDynamicPanelValueChanged.fire(this, options);
|
|
40414
|
-
}
|
|
40415
|
-
dynamicPanelItemValueChanging(question, options) {
|
|
40416
|
-
options.question = question;
|
|
40417
|
-
this.onDynamicPanelValueChanging.fire(this, options);
|
|
40418
|
-
}
|
|
40419
40482
|
dynamicPanelGetTabTitle(question, options) {
|
|
40420
40483
|
options.question = question;
|
|
40421
40484
|
this.onGetDynamicPanelTabTitle.fire(this, options);
|
|
@@ -41176,15 +41239,14 @@ class SurveyModel extends SurveyElementCore {
|
|
|
41176
41239
|
}
|
|
41177
41240
|
}
|
|
41178
41241
|
runConditionOnValueChanged(name, value) {
|
|
41242
|
+
if (!this.questionTriggersKeys) {
|
|
41243
|
+
this.questionTriggersKeys = {};
|
|
41244
|
+
}
|
|
41245
|
+
this.questionTriggersKeys[name] = value;
|
|
41179
41246
|
if (this.isRunningConditions) {
|
|
41180
|
-
if (this.questionTriggersKeys) {
|
|
41181
|
-
this.questionTriggersKeys[name] = value;
|
|
41182
|
-
}
|
|
41183
41247
|
this.isValueChangedOnRunningCondition = true;
|
|
41184
41248
|
}
|
|
41185
41249
|
else {
|
|
41186
|
-
this.questionTriggersKeys = {};
|
|
41187
|
-
this.questionTriggersKeys[name] = value;
|
|
41188
41250
|
this.runConditions();
|
|
41189
41251
|
this.runQuestionsTriggers(name, value);
|
|
41190
41252
|
this.questionTriggersKeys = undefined;
|
|
@@ -41625,6 +41687,35 @@ class SurveyModel extends SurveyElementCore {
|
|
|
41625
41687
|
locNotification = this.getLocNotification(locNotification, newValue, oldValue);
|
|
41626
41688
|
this.updateOnSetValue(name, newValue, oldValue, locNotification, allowNotifyValueChanged, questionName);
|
|
41627
41689
|
}
|
|
41690
|
+
questionValueChanging(question, newValue) {
|
|
41691
|
+
const q = question;
|
|
41692
|
+
const parentQ = q.parentQuestion;
|
|
41693
|
+
if (!parentQ)
|
|
41694
|
+
return newValue;
|
|
41695
|
+
if (parentQ.isDescendantOf("paneldynamic") && !this.onDynamicPanelValueChanging.isEmpty) {
|
|
41696
|
+
const options = parentQ.getValueChangingOptions(q);
|
|
41697
|
+
if (options) {
|
|
41698
|
+
options.value = newValue;
|
|
41699
|
+
this.onDynamicPanelValueChanging.fire(this, options);
|
|
41700
|
+
return options.value;
|
|
41701
|
+
}
|
|
41702
|
+
}
|
|
41703
|
+
return newValue;
|
|
41704
|
+
}
|
|
41705
|
+
questionValueChanged(question, oldValue) {
|
|
41706
|
+
const q = question;
|
|
41707
|
+
const parentQ = q.parentQuestion;
|
|
41708
|
+
if (!!parentQ) {
|
|
41709
|
+
if (parentQ.isDescendantOf("paneldynamic") && !this.onDynamicPanelValueChanged.isEmpty) {
|
|
41710
|
+
const options = parentQ.getValueChangingOptions(q);
|
|
41711
|
+
if (options) {
|
|
41712
|
+
options.value = q.value;
|
|
41713
|
+
options.oldValue = oldValue;
|
|
41714
|
+
this.onDynamicPanelValueChanged.fire(this, options);
|
|
41715
|
+
}
|
|
41716
|
+
}
|
|
41717
|
+
}
|
|
41718
|
+
}
|
|
41628
41719
|
isValueEmpyOnSetValue(name, val) {
|
|
41629
41720
|
if (!this.isValueEmpty(val, false))
|
|
41630
41721
|
return false;
|
|
@@ -43323,8 +43414,8 @@ Serializer.addClass("survey", [
|
|
|
43323
43414
|
dependsOn: ["showTOC"],
|
|
43324
43415
|
visibleIf: (survey) => { return !!survey && survey.showTOC; }
|
|
43325
43416
|
},
|
|
43326
|
-
{ name: "readOnly:boolean"
|
|
43327
|
-
{ name: "mode",
|
|
43417
|
+
{ name: "readOnly:boolean" },
|
|
43418
|
+
{ name: "mode", visible: false, isSerializable: false },
|
|
43328
43419
|
{ name: "storeOthersAsComment:boolean", default: true },
|
|
43329
43420
|
{ name: "maxTextLength:number", default: 0, minValue: 0 },
|
|
43330
43421
|
{ name: "maxCommentLength:number", default: 0, minValue: 0, alternativeName: "maxOthersLength" },
|
|
@@ -44081,22 +44172,24 @@ class QuestionSelectBase extends Question {
|
|
|
44081
44172
|
return [];
|
|
44082
44173
|
}
|
|
44083
44174
|
setConditionalChoicesRunner() {
|
|
44084
|
-
|
|
44175
|
+
const expression = this.getExpressionFromSurvey("choicesVisibleIf");
|
|
44176
|
+
if (expression) {
|
|
44085
44177
|
if (!this.conditionChoicesVisibleIfRunner) {
|
|
44086
|
-
this.conditionChoicesVisibleIfRunner = new ConditionRunner(
|
|
44178
|
+
this.conditionChoicesVisibleIfRunner = new ConditionRunner(expression);
|
|
44087
44179
|
}
|
|
44088
|
-
this.conditionChoicesVisibleIfRunner.expression =
|
|
44180
|
+
this.conditionChoicesVisibleIfRunner.expression = expression;
|
|
44089
44181
|
}
|
|
44090
44182
|
else {
|
|
44091
44183
|
this.conditionChoicesVisibleIfRunner = null;
|
|
44092
44184
|
}
|
|
44093
44185
|
}
|
|
44094
44186
|
setConditionalEnableChoicesRunner() {
|
|
44095
|
-
|
|
44187
|
+
const expression = this.getExpressionFromSurvey("choicesEnableIf");
|
|
44188
|
+
if (expression) {
|
|
44096
44189
|
if (!this.conditionChoicesEnableIfRunner) {
|
|
44097
|
-
this.conditionChoicesEnableIfRunner = new ConditionRunner(
|
|
44190
|
+
this.conditionChoicesEnableIfRunner = new ConditionRunner(expression);
|
|
44098
44191
|
}
|
|
44099
|
-
this.conditionChoicesEnableIfRunner.expression =
|
|
44192
|
+
this.conditionChoicesEnableIfRunner.expression = expression;
|
|
44100
44193
|
}
|
|
44101
44194
|
else {
|
|
44102
44195
|
this.conditionChoicesEnableIfRunner = null;
|
|
@@ -45101,10 +45194,10 @@ class QuestionSelectBase extends Question {
|
|
|
45101
45194
|
}
|
|
45102
45195
|
}
|
|
45103
45196
|
getStoreOthersAsComment() {
|
|
45104
|
-
if (this.checkHasChoicesComments())
|
|
45105
|
-
return true;
|
|
45106
45197
|
if (this.showCommentArea)
|
|
45107
45198
|
return false;
|
|
45199
|
+
if (this.checkHasChoicesComments())
|
|
45200
|
+
return true;
|
|
45108
45201
|
return (this.storeOthersAsComment === true ||
|
|
45109
45202
|
(this.storeOthersAsComment == "default" &&
|
|
45110
45203
|
(this.survey != null ? this.survey.storeOthersAsComment : true)) ||
|
|
@@ -47256,6 +47349,7 @@ class MatrixRowModel extends Base {
|
|
|
47256
47349
|
get locText() {
|
|
47257
47350
|
return this.item.locText;
|
|
47258
47351
|
}
|
|
47352
|
+
get isVisible() { return this.item.isVisible; }
|
|
47259
47353
|
get value() {
|
|
47260
47354
|
return this.getPropertyValue("value");
|
|
47261
47355
|
}
|
|
@@ -47483,7 +47577,7 @@ class MatrixValueGetterContext extends ValueGetterContextCore {
|
|
|
47483
47577
|
getRootObj() { return this.question.data; }
|
|
47484
47578
|
updateValueByItem(name, res) {
|
|
47485
47579
|
var _a;
|
|
47486
|
-
const rows = this.question.
|
|
47580
|
+
const rows = this.question.getMatrixRows();
|
|
47487
47581
|
name = name.toLocaleLowerCase();
|
|
47488
47582
|
for (let i = 0; i < rows.length; i++) {
|
|
47489
47583
|
const row = rows[i];
|
|
@@ -47740,20 +47834,21 @@ class QuestionMatrixModel extends QuestionMatrixBaseModel {
|
|
|
47740
47834
|
super.runConditionCore(properties);
|
|
47741
47835
|
}
|
|
47742
47836
|
createRowsVisibleIfRunner() {
|
|
47743
|
-
|
|
47837
|
+
const expression = this.getExpressionFromSurvey("rowsVisibleIf");
|
|
47838
|
+
return !!expression ? new ConditionRunner(expression) : null;
|
|
47744
47839
|
}
|
|
47745
47840
|
onRowsChanged() {
|
|
47746
47841
|
this.clearGeneratedRows();
|
|
47747
47842
|
super.onRowsChanged();
|
|
47748
47843
|
}
|
|
47749
|
-
|
|
47844
|
+
getMatrixRows() {
|
|
47750
47845
|
if (!!this.generatedVisibleRows)
|
|
47751
47846
|
return this.generatedVisibleRows;
|
|
47752
47847
|
const result = new Array();
|
|
47753
47848
|
let val = this.value;
|
|
47754
47849
|
if (!val)
|
|
47755
47850
|
val = {};
|
|
47756
|
-
const rows = this.
|
|
47851
|
+
const rows = this.rows;
|
|
47757
47852
|
for (let i = 0; i < rows.length; i++) {
|
|
47758
47853
|
const row = rows[i];
|
|
47759
47854
|
if (this.isValueEmpty(row.value))
|
|
@@ -47764,6 +47859,15 @@ class QuestionMatrixModel extends QuestionMatrixBaseModel {
|
|
|
47764
47859
|
this.generatedVisibleRows = result;
|
|
47765
47860
|
return result;
|
|
47766
47861
|
}
|
|
47862
|
+
getVisibleRows() {
|
|
47863
|
+
const rows = [];
|
|
47864
|
+
this.getMatrixRows().forEach(row => {
|
|
47865
|
+
if (row.isVisible) {
|
|
47866
|
+
rows.push(row);
|
|
47867
|
+
}
|
|
47868
|
+
});
|
|
47869
|
+
return rows;
|
|
47870
|
+
}
|
|
47767
47871
|
getRowByName(name) {
|
|
47768
47872
|
const rows = this.visibleRows;
|
|
47769
47873
|
for (let i = 0; i < rows.length; i++) {
|
|
@@ -49000,20 +49104,31 @@ class QuestionTextModel extends QuestionTextBase {
|
|
|
49000
49104
|
return this.isDateInputType ? this.createDate(minMax) : minMax;
|
|
49001
49105
|
}
|
|
49002
49106
|
setRenderedMinMax(properties = null) {
|
|
49003
|
-
|
|
49004
|
-
|
|
49107
|
+
const setProp = (name, val) => {
|
|
49108
|
+
this.setPropertyValue(name, this.convertFuncValuetoQuestionValue(val));
|
|
49109
|
+
};
|
|
49110
|
+
const setMin = (val) => {
|
|
49005
49111
|
if (!val && this.isDateInputType && !!settings.minDate) {
|
|
49006
49112
|
val = settings.minDate;
|
|
49007
49113
|
}
|
|
49008
|
-
|
|
49009
|
-
}
|
|
49010
|
-
|
|
49011
|
-
this.setValueAndRunExpression(this.maxValueRunner, this.max, (val) => {
|
|
49114
|
+
setProp("renderedMin", val);
|
|
49115
|
+
};
|
|
49116
|
+
const setMax = (val) => {
|
|
49012
49117
|
if (!val && this.isDateInputType) {
|
|
49013
49118
|
val = !!settings.maxDate ? settings.maxDate : "2999-12-31";
|
|
49014
49119
|
}
|
|
49015
|
-
|
|
49016
|
-
}
|
|
49120
|
+
setProp("renderedMax", val);
|
|
49121
|
+
};
|
|
49122
|
+
if (!this.runExpressionByProperty("minValueExpression", properties, (val) => {
|
|
49123
|
+
setMin(val);
|
|
49124
|
+
})) {
|
|
49125
|
+
setMin(this.min);
|
|
49126
|
+
}
|
|
49127
|
+
if (!this.runExpressionByProperty("maxValueExpression", properties, (val) => {
|
|
49128
|
+
setMax(val);
|
|
49129
|
+
})) {
|
|
49130
|
+
setMax(this.max);
|
|
49131
|
+
}
|
|
49017
49132
|
}
|
|
49018
49133
|
/**
|
|
49019
49134
|
* A value passed on to the [`step`](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/step) attribute of the underlying `<input>` element.
|
|
@@ -56240,6 +56355,8 @@ class QuestionSliderModel extends Question {
|
|
|
56240
56355
|
this.handleRangeOnChange = (event) => {
|
|
56241
56356
|
if (!this.isRangeMoving)
|
|
56242
56357
|
return;
|
|
56358
|
+
if (!this.isAllowToChange())
|
|
56359
|
+
return;
|
|
56243
56360
|
const { renderedMax: max, renderedMin: min, renderedValue, ensureMaxRangeBorders, ensureMinRangeBorders } = this;
|
|
56244
56361
|
const inputNode = event.target;
|
|
56245
56362
|
const diff = this.oldInputValue - +inputNode.value;
|
|
@@ -56325,7 +56442,7 @@ class QuestionSliderModel extends Question {
|
|
|
56325
56442
|
input.style.setProperty("--sjs-range-slider-range-input-thumb-position", "absolute");
|
|
56326
56443
|
};
|
|
56327
56444
|
this.setSliderValue = (newValue) => {
|
|
56328
|
-
if (
|
|
56445
|
+
if (this.isAllowToChange()) {
|
|
56329
56446
|
let result;
|
|
56330
56447
|
if (this.sliderType === "single") {
|
|
56331
56448
|
result = Array.isArray(newValue) ? newValue[0] : newValue;
|
|
@@ -56385,6 +56502,8 @@ class QuestionSliderModel extends Question {
|
|
|
56385
56502
|
refreshInputRange();
|
|
56386
56503
|
};
|
|
56387
56504
|
this.handleOnChange = (event, inputNumber) => {
|
|
56505
|
+
if (!this.isAllowToChange())
|
|
56506
|
+
return;
|
|
56388
56507
|
if (this.oldValue === null)
|
|
56389
56508
|
return; // Firefox raise one more OnChange after PointerUp and break the value
|
|
56390
56509
|
const { allowSwap, ensureMaxRangeBorders, ensureMinRangeBorders, renderedValue } = this;
|
|
@@ -56594,24 +56713,13 @@ class QuestionSliderModel extends Question {
|
|
|
56594
56713
|
}
|
|
56595
56714
|
runConditionCore(properties) {
|
|
56596
56715
|
super.runConditionCore(properties);
|
|
56597
|
-
this.
|
|
56716
|
+
this.runExpressionByProperty("maxValueExpression", properties, (value) => {
|
|
56598
56717
|
this.max = value !== null && value !== void 0 ? value : this.renderedMax;
|
|
56599
56718
|
});
|
|
56600
|
-
this.
|
|
56719
|
+
this.runExpressionByProperty("minValueExpression", properties, (value) => {
|
|
56601
56720
|
this.min = value !== null && value !== void 0 ? value : this.renderedMin;
|
|
56602
56721
|
});
|
|
56603
56722
|
}
|
|
56604
|
-
runMinMaxCondition(expression, properties, setter) {
|
|
56605
|
-
if (!expression)
|
|
56606
|
-
return;
|
|
56607
|
-
const runner = this.getDefaultRunner(this.defaultExpressionRunner, expression);
|
|
56608
|
-
if (!!runner && runner.canRun) {
|
|
56609
|
-
runner.onRunComplete = (res) => {
|
|
56610
|
-
setter(res);
|
|
56611
|
-
};
|
|
56612
|
-
runner.runContext(this.getValueGetterContext(), properties);
|
|
56613
|
-
}
|
|
56614
|
-
}
|
|
56615
56723
|
initPropertyDependencies() {
|
|
56616
56724
|
// this.registerSychProperties(["segmentCount"],
|
|
56617
56725
|
// () => {
|
|
@@ -56716,6 +56824,9 @@ class QuestionSliderModel extends Question {
|
|
|
56716
56824
|
}
|
|
56717
56825
|
return value;
|
|
56718
56826
|
}
|
|
56827
|
+
isAllowToChange() {
|
|
56828
|
+
return !this.isReadOnly && !this.isDisabledAttr && !this.isPreviewStyle && !this.isDisabledStyle;
|
|
56829
|
+
}
|
|
56719
56830
|
}
|
|
56720
56831
|
__decorate([
|
|
56721
56832
|
property({ defaultValue: "single" })
|
|
@@ -60564,7 +60675,6 @@ class QuestionPanelDynamicModel extends Question {
|
|
|
60564
60675
|
}
|
|
60565
60676
|
else {
|
|
60566
60677
|
for (var i = 0; i < this.panelCount; i++) {
|
|
60567
|
-
this.createNewPanel();
|
|
60568
60678
|
panels.push(this.createNewPanel());
|
|
60569
60679
|
}
|
|
60570
60680
|
}
|
|
@@ -61364,14 +61474,8 @@ class QuestionPanelDynamicModel extends Question {
|
|
|
61364
61474
|
new JsonObject().toObject(json, panel);
|
|
61365
61475
|
panel.renderWidth = "100%";
|
|
61366
61476
|
panel.updateCustomWidgets();
|
|
61477
|
+
panel.questions.forEach(q => q.setParentQuestion(this));
|
|
61367
61478
|
new QuestionPanelDynamicItem(this, panel);
|
|
61368
|
-
if (!this.isDesignMode && !this.isReadOnly && !this.isValueEmpty(panel.getValue())) {
|
|
61369
|
-
this.runPanelsCondition([panel], this.getDataFilteredProperties());
|
|
61370
|
-
}
|
|
61371
|
-
var questions = panel.questions;
|
|
61372
|
-
for (var i = 0; i < questions.length; i++) {
|
|
61373
|
-
questions[i].setParentQuestion(this);
|
|
61374
|
-
}
|
|
61375
61479
|
if (this.wasRendered) {
|
|
61376
61480
|
panel.onFirstRendering();
|
|
61377
61481
|
panel.locStrsChanged();
|
|
@@ -61479,6 +61583,22 @@ class QuestionPanelDynamicModel extends Question {
|
|
|
61479
61583
|
isNewValueCorrect(val) {
|
|
61480
61584
|
return Array.isArray(val);
|
|
61481
61585
|
}
|
|
61586
|
+
getValueChangingOptions(childQuestion) {
|
|
61587
|
+
let pnl = childQuestion.parent;
|
|
61588
|
+
while (pnl.parent) {
|
|
61589
|
+
pnl = pnl.parent;
|
|
61590
|
+
}
|
|
61591
|
+
const panel = pnl;
|
|
61592
|
+
const panelIndex = this.panels.indexOf(panel);
|
|
61593
|
+
return {
|
|
61594
|
+
question: this,
|
|
61595
|
+
panel: panel,
|
|
61596
|
+
name: childQuestion.name,
|
|
61597
|
+
panelIndex: panelIndex,
|
|
61598
|
+
panelData: this.getPanelItemDataByIndex(panelIndex),
|
|
61599
|
+
oldValue: childQuestion.value
|
|
61600
|
+
};
|
|
61601
|
+
}
|
|
61482
61602
|
//IQuestionPanelDynamicData
|
|
61483
61603
|
getItemIndex(item) {
|
|
61484
61604
|
var res = this.items.indexOf(item);
|
|
@@ -61493,8 +61613,10 @@ class QuestionPanelDynamicModel extends Question {
|
|
|
61493
61613
|
return visPanels.length;
|
|
61494
61614
|
}
|
|
61495
61615
|
getPanelItemData(item) {
|
|
61496
|
-
|
|
61497
|
-
|
|
61616
|
+
return this.getPanelItemDataByIndex(this.items.indexOf(item));
|
|
61617
|
+
}
|
|
61618
|
+
getPanelItemDataByIndex(index) {
|
|
61619
|
+
const items = this.items;
|
|
61498
61620
|
var qValue = this.value;
|
|
61499
61621
|
if (index < 0 && Array.isArray(qValue) && qValue.length > items.length) {
|
|
61500
61622
|
index = items.length;
|
|
@@ -61527,7 +61649,7 @@ class QuestionPanelDynamicModel extends Question {
|
|
|
61527
61649
|
}
|
|
61528
61650
|
if (!qValue[index])
|
|
61529
61651
|
qValue[index] = {};
|
|
61530
|
-
|
|
61652
|
+
qValue[index][name];
|
|
61531
61653
|
if (!this.isValueEmpty(val)) {
|
|
61532
61654
|
qValue[index][name] = val;
|
|
61533
61655
|
}
|
|
@@ -61537,22 +61659,8 @@ class QuestionPanelDynamicModel extends Question {
|
|
|
61537
61659
|
if (index >= 0 && index < this.panelsCore.length) {
|
|
61538
61660
|
this.changingValueQuestion = this.panelsCore[index].getQuestionByValueName(name);
|
|
61539
61661
|
}
|
|
61540
|
-
const options = {
|
|
61541
|
-
panel: item.panel,
|
|
61542
|
-
name: name,
|
|
61543
|
-
panelIndex: index,
|
|
61544
|
-
panelData: qValue[index],
|
|
61545
|
-
value: val,
|
|
61546
|
-
oldValue: oldVal
|
|
61547
|
-
};
|
|
61548
|
-
if (this.survey) {
|
|
61549
|
-
this.survey.dynamicPanelItemValueChanging(this, options);
|
|
61550
|
-
}
|
|
61551
61662
|
this.value = qValue;
|
|
61552
61663
|
this.changingValueQuestion = null;
|
|
61553
|
-
if (this.survey) {
|
|
61554
|
-
this.survey.dynamicPanelItemValueChanged(this, options);
|
|
61555
|
-
}
|
|
61556
61664
|
this.isSetPanelItemData[name]--;
|
|
61557
61665
|
if (this.isSetPanelItemData[name] - 1) {
|
|
61558
61666
|
delete this.isSetPanelItemData[name];
|
|
@@ -62094,10 +62202,6 @@ class Trigger extends Base {
|
|
|
62094
62202
|
constructor() {
|
|
62095
62203
|
super();
|
|
62096
62204
|
this.idValue = (Trigger.idCounter++);
|
|
62097
|
-
this.registerPropertyChangedHandlers(["operator", "value", "name"], () => {
|
|
62098
|
-
this.oldPropertiesChanged();
|
|
62099
|
-
});
|
|
62100
|
-
this.registerPropertyChangedHandlers(["expression"], () => { this.onExpressionChanged(); });
|
|
62101
62205
|
}
|
|
62102
62206
|
get id() { return this.idValue; }
|
|
62103
62207
|
getType() {
|
|
@@ -62105,7 +62209,7 @@ class Trigger extends Base {
|
|
|
62105
62209
|
}
|
|
62106
62210
|
toString() {
|
|
62107
62211
|
var res = this.getType().replace("trigger", "");
|
|
62108
|
-
var exp =
|
|
62212
|
+
var exp = this.expression;
|
|
62109
62213
|
if (exp) {
|
|
62110
62214
|
res += ", " + exp;
|
|
62111
62215
|
}
|
|
@@ -62138,7 +62242,7 @@ class Trigger extends Base {
|
|
|
62138
62242
|
this.setPropertyValue("name", val);
|
|
62139
62243
|
}
|
|
62140
62244
|
get expression() {
|
|
62141
|
-
return this.getPropertyValue("expression",
|
|
62245
|
+
return this.getPropertyValue("expression", this.buildExpression());
|
|
62142
62246
|
}
|
|
62143
62247
|
set expression(val) {
|
|
62144
62248
|
this.setPropertyValue("expression", val);
|
|
@@ -62156,17 +62260,17 @@ class Trigger extends Base {
|
|
|
62156
62260
|
return;
|
|
62157
62261
|
if (options.isOnComplete && !this.canBeExecutedOnComplete())
|
|
62158
62262
|
return;
|
|
62159
|
-
if (!this.isCheckRequired(options.keys))
|
|
62160
|
-
return;
|
|
62161
62263
|
const keys = Object.keys(options.keys);
|
|
62162
62264
|
if (Array.isArray(keys) && !this.canBeExecuteOnKeysChange(keys))
|
|
62163
62265
|
return;
|
|
62164
|
-
|
|
62165
|
-
|
|
62166
|
-
|
|
62167
|
-
|
|
62168
|
-
|
|
62169
|
-
|
|
62266
|
+
const props = options.properties || null;
|
|
62267
|
+
if (!this.runExpressionByProperty("expression", props, (val) => {
|
|
62268
|
+
this.triggerResult(val === true, props);
|
|
62269
|
+
}, (runner) => {
|
|
62270
|
+
return this.isCheckRequired(runner, options.keys);
|
|
62271
|
+
})) {
|
|
62272
|
+
if (this.isCheckRequired(null, options.keys) && this.canSuccessOnEmptyExpression()) {
|
|
62273
|
+
this.triggerResult(true, props);
|
|
62170
62274
|
}
|
|
62171
62275
|
}
|
|
62172
62276
|
}
|
|
@@ -62184,12 +62288,6 @@ class Trigger extends Base {
|
|
|
62184
62288
|
}
|
|
62185
62289
|
}
|
|
62186
62290
|
get requireValidQuestion() { return false; }
|
|
62187
|
-
perform(properties) {
|
|
62188
|
-
this.conditionRunner.onRunComplete = (res) => {
|
|
62189
|
-
this.triggerResult(res, properties);
|
|
62190
|
-
};
|
|
62191
|
-
this.conditionRunner.runContext(this.getValueGetterContext(), properties);
|
|
62192
|
-
}
|
|
62193
62291
|
triggerResult(res, properties) {
|
|
62194
62292
|
if (res) {
|
|
62195
62293
|
this.onSuccess(properties);
|
|
@@ -62202,16 +62300,6 @@ class Trigger extends Base {
|
|
|
62202
62300
|
onSuccess(properties) { }
|
|
62203
62301
|
onFailure() { }
|
|
62204
62302
|
onSuccessExecuted() { }
|
|
62205
|
-
endLoadingFromJson() {
|
|
62206
|
-
super.endLoadingFromJson();
|
|
62207
|
-
this.oldPropertiesChanged();
|
|
62208
|
-
}
|
|
62209
|
-
oldPropertiesChanged() {
|
|
62210
|
-
this.onExpressionChanged();
|
|
62211
|
-
}
|
|
62212
|
-
onExpressionChanged() {
|
|
62213
|
-
this.conditionRunner = null;
|
|
62214
|
-
}
|
|
62215
62303
|
buildExpression() {
|
|
62216
62304
|
if (!this.name)
|
|
62217
62305
|
return "";
|
|
@@ -62224,18 +62312,17 @@ class Trigger extends Base {
|
|
|
62224
62312
|
" " +
|
|
62225
62313
|
OperandMaker.toOperandString(this.value));
|
|
62226
62314
|
}
|
|
62227
|
-
isCheckRequired(keys) {
|
|
62315
|
+
isCheckRequired(runner, keys) {
|
|
62228
62316
|
if (!keys)
|
|
62229
62317
|
return false;
|
|
62230
|
-
|
|
62231
|
-
if (this.conditionRunner && this.conditionRunner.hasFunction() === true)
|
|
62318
|
+
if ((runner === null || runner === void 0 ? void 0 : runner.hasFunction()) === true)
|
|
62232
62319
|
return true;
|
|
62233
|
-
return new ValueGetter().isAnyKeyChanged(keys, this.getUsedVariables());
|
|
62320
|
+
return new ValueGetter().isAnyKeyChanged(keys, this.getUsedVariables(runner));
|
|
62234
62321
|
}
|
|
62235
|
-
getUsedVariables() {
|
|
62236
|
-
if (!
|
|
62322
|
+
getUsedVariables(runner) {
|
|
62323
|
+
if (!runner)
|
|
62237
62324
|
return [];
|
|
62238
|
-
const res =
|
|
62325
|
+
const res = runner.getVariables();
|
|
62239
62326
|
if (Array.isArray(res)) {
|
|
62240
62327
|
const unw = settings.expressionVariables.unwrapPostfix;
|
|
62241
62328
|
for (let i = res.length - 1; i >= 0; i--) {
|
|
@@ -62247,17 +62334,6 @@ class Trigger extends Base {
|
|
|
62247
62334
|
}
|
|
62248
62335
|
return res;
|
|
62249
62336
|
}
|
|
62250
|
-
createConditionRunner() {
|
|
62251
|
-
if (!!this.conditionRunner)
|
|
62252
|
-
return;
|
|
62253
|
-
var expression = this.expression;
|
|
62254
|
-
if (!expression) {
|
|
62255
|
-
expression = this.buildExpression();
|
|
62256
|
-
}
|
|
62257
|
-
if (!expression)
|
|
62258
|
-
return;
|
|
62259
|
-
this.conditionRunner = new ConditionRunner(expression);
|
|
62260
|
-
}
|
|
62261
62337
|
get isRequireValue() {
|
|
62262
62338
|
return this.operator !== "empty" && this.operator != "notempty";
|
|
62263
62339
|
}
|
|
@@ -62457,15 +62533,11 @@ class SurveyTriggerRunExpression extends SurveyTrigger {
|
|
|
62457
62533
|
return !isOnNextPage;
|
|
62458
62534
|
}
|
|
62459
62535
|
onSuccess(properties) {
|
|
62460
|
-
if (!this.owner
|
|
62536
|
+
if (!this.owner)
|
|
62461
62537
|
return;
|
|
62462
|
-
|
|
62463
|
-
|
|
62464
|
-
|
|
62465
|
-
this.onCompleteRunExpression(res);
|
|
62466
|
-
};
|
|
62467
|
-
expression.runContext(this.getValueGetterContext(), properties);
|
|
62468
|
-
}
|
|
62538
|
+
this.runExpressionByProperty("runExpression", properties, (res) => {
|
|
62539
|
+
this.onCompleteRunExpression(res);
|
|
62540
|
+
});
|
|
62469
62541
|
}
|
|
62470
62542
|
onCompleteRunExpression(newValue) {
|
|
62471
62543
|
if (!!this.setToName && newValue !== undefined) {
|
|
@@ -62515,8 +62587,8 @@ class SurveyTriggerCopyValue extends SurveyTrigger {
|
|
|
62515
62587
|
this.owner.copyTriggerValue(this.setToName, this.fromName, this.copyDisplayValue);
|
|
62516
62588
|
}
|
|
62517
62589
|
canSuccessOnEmptyExpression() { return true; }
|
|
62518
|
-
getUsedVariables() {
|
|
62519
|
-
const res = super.getUsedVariables();
|
|
62590
|
+
getUsedVariables(runner) {
|
|
62591
|
+
const res = super.getUsedVariables(runner);
|
|
62520
62592
|
if (res.length === 0 && !!this.fromName) {
|
|
62521
62593
|
res.push(this.fromName);
|
|
62522
62594
|
}
|
|
@@ -65232,11 +65304,11 @@ var Version;
|
|
|
65232
65304
|
var ReleaseDate;
|
|
65233
65305
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
65234
65306
|
//@ts-ignore
|
|
65235
|
-
Version = `${"2.3.
|
|
65307
|
+
Version = `${"2.3.5"}`;
|
|
65236
65308
|
settings.version = Version;
|
|
65237
65309
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
65238
65310
|
//@ts-ignore
|
|
65239
|
-
ReleaseDate = `${"2025-
|
|
65311
|
+
ReleaseDate = `${"2025-09-02"}`;
|
|
65240
65312
|
function checkLibraryVersion(ver, libraryName) {
|
|
65241
65313
|
if (Version != ver) {
|
|
65242
65314
|
const str = "survey-core has version '" + Version + "' and " + libraryName
|