survey-core 2.3.3 → 2.3.4

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.
Files changed (285) hide show
  1. package/fesm/i18n/arabic.mjs +1 -1
  2. package/fesm/i18n/basque.mjs +1 -1
  3. package/fesm/i18n/bulgarian.mjs +1 -1
  4. package/fesm/i18n/burmese.mjs +1 -1
  5. package/fesm/i18n/catalan.mjs +1 -1
  6. package/fesm/i18n/croatian.mjs +1 -1
  7. package/fesm/i18n/czech.mjs +1 -1
  8. package/fesm/i18n/danish.mjs +1 -1
  9. package/fesm/i18n/dutch.mjs +1 -1
  10. package/fesm/i18n/english.mjs +1 -1
  11. package/fesm/i18n/estonian.mjs +1 -1
  12. package/fesm/i18n/finnish.mjs +1 -1
  13. package/fesm/i18n/french.mjs +1 -1
  14. package/fesm/i18n/georgian.mjs +1 -1
  15. package/fesm/i18n/german.mjs +1 -1
  16. package/fesm/i18n/greek.mjs +1 -1
  17. package/fesm/i18n/haitian-creole.mjs +1 -1
  18. package/fesm/i18n/hebrew.mjs +1 -1
  19. package/fesm/i18n/hindi.mjs +1 -1
  20. package/fesm/i18n/hungarian.mjs +1 -1
  21. package/fesm/i18n/icelandic.mjs +1 -1
  22. package/fesm/i18n/index.mjs +1 -1
  23. package/fesm/i18n/indonesian.mjs +1 -1
  24. package/fesm/i18n/italian.mjs +1 -1
  25. package/fesm/i18n/japanese.mjs +1 -1
  26. package/fesm/i18n/kazakh.mjs +1 -1
  27. package/fesm/i18n/korean.mjs +1 -1
  28. package/fesm/i18n/latvian.mjs +1 -1
  29. package/fesm/i18n/lithuanian.mjs +1 -1
  30. package/fesm/i18n/macedonian.mjs +1 -1
  31. package/fesm/i18n/malay.mjs +1 -1
  32. package/fesm/i18n/nl-BE.mjs +1 -1
  33. package/fesm/i18n/norwegian.mjs +1 -1
  34. package/fesm/i18n/persian.mjs +1 -1
  35. package/fesm/i18n/philippines.mjs +1 -1
  36. package/fesm/i18n/polish.mjs +1 -1
  37. package/fesm/i18n/portuguese-br.mjs +1 -1
  38. package/fesm/i18n/portuguese.mjs +1 -1
  39. package/fesm/i18n/romanian.mjs +1 -1
  40. package/fesm/i18n/russian.mjs +1 -1
  41. package/fesm/i18n/serbian.mjs +1 -1
  42. package/fesm/i18n/simplified-chinese.mjs +1 -1
  43. package/fesm/i18n/slovak.mjs +1 -1
  44. package/fesm/i18n/slovenian.mjs +1 -1
  45. package/fesm/i18n/spanish.mjs +1 -1
  46. package/fesm/i18n/swahili.mjs +1 -1
  47. package/fesm/i18n/swedish.mjs +1 -1
  48. package/fesm/i18n/tajik.mjs +1 -1
  49. package/fesm/i18n/telugu.mjs +1 -1
  50. package/fesm/i18n/thai.mjs +1 -1
  51. package/fesm/i18n/traditional-chinese.mjs +1 -1
  52. package/fesm/i18n/turkish.mjs +1 -1
  53. package/fesm/i18n/ukrainian.mjs +1 -1
  54. package/fesm/i18n/urdu.mjs +1 -1
  55. package/fesm/i18n/vietnamese.mjs +1 -1
  56. package/fesm/i18n/welsh.mjs +1 -1
  57. package/fesm/icons/iconsV1.mjs +1 -1
  58. package/fesm/icons/iconsV2.mjs +1 -1
  59. package/fesm/survey-core.mjs +269 -282
  60. package/fesm/survey-core.mjs.map +1 -1
  61. package/fesm/survey.i18n.mjs +1 -1
  62. package/fesm/themes/index.mjs +1 -1
  63. package/i18n/arabic.js +1 -1
  64. package/i18n/arabic.min.js.LICENSE.txt +1 -1
  65. package/i18n/basque.js +1 -1
  66. package/i18n/basque.min.js.LICENSE.txt +1 -1
  67. package/i18n/bulgarian.js +1 -1
  68. package/i18n/bulgarian.min.js.LICENSE.txt +1 -1
  69. package/i18n/burmese.js +1 -1
  70. package/i18n/burmese.min.js.LICENSE.txt +1 -1
  71. package/i18n/catalan.js +1 -1
  72. package/i18n/catalan.min.js.LICENSE.txt +1 -1
  73. package/i18n/croatian.js +1 -1
  74. package/i18n/croatian.min.js.LICENSE.txt +1 -1
  75. package/i18n/czech.js +1 -1
  76. package/i18n/czech.min.js.LICENSE.txt +1 -1
  77. package/i18n/danish.js +1 -1
  78. package/i18n/danish.min.js.LICENSE.txt +1 -1
  79. package/i18n/dutch.js +1 -1
  80. package/i18n/dutch.min.js.LICENSE.txt +1 -1
  81. package/i18n/english.js +1 -1
  82. package/i18n/english.min.js.LICENSE.txt +1 -1
  83. package/i18n/estonian.js +1 -1
  84. package/i18n/estonian.min.js.LICENSE.txt +1 -1
  85. package/i18n/finnish.js +1 -1
  86. package/i18n/finnish.min.js.LICENSE.txt +1 -1
  87. package/i18n/french.js +1 -1
  88. package/i18n/french.min.js.LICENSE.txt +1 -1
  89. package/i18n/georgian.js +1 -1
  90. package/i18n/georgian.min.js.LICENSE.txt +1 -1
  91. package/i18n/german.js +1 -1
  92. package/i18n/german.min.js.LICENSE.txt +1 -1
  93. package/i18n/greek.js +1 -1
  94. package/i18n/greek.min.js.LICENSE.txt +1 -1
  95. package/i18n/haitian-creole.js +1 -1
  96. package/i18n/haitian-creole.min.js.LICENSE.txt +1 -1
  97. package/i18n/hebrew.js +1 -1
  98. package/i18n/hebrew.min.js.LICENSE.txt +1 -1
  99. package/i18n/hindi.js +1 -1
  100. package/i18n/hindi.min.js.LICENSE.txt +1 -1
  101. package/i18n/hungarian.js +1 -1
  102. package/i18n/hungarian.min.js.LICENSE.txt +1 -1
  103. package/i18n/icelandic.js +1 -1
  104. package/i18n/icelandic.min.js.LICENSE.txt +1 -1
  105. package/i18n/index.js +1 -1
  106. package/i18n/index.min.js.LICENSE.txt +1 -1
  107. package/i18n/indonesian.js +1 -1
  108. package/i18n/indonesian.min.js.LICENSE.txt +1 -1
  109. package/i18n/italian.js +1 -1
  110. package/i18n/italian.min.js.LICENSE.txt +1 -1
  111. package/i18n/japanese.js +1 -1
  112. package/i18n/japanese.min.js.LICENSE.txt +1 -1
  113. package/i18n/kazakh.js +1 -1
  114. package/i18n/kazakh.min.js.LICENSE.txt +1 -1
  115. package/i18n/korean.js +1 -1
  116. package/i18n/korean.min.js.LICENSE.txt +1 -1
  117. package/i18n/latvian.js +1 -1
  118. package/i18n/latvian.min.js.LICENSE.txt +1 -1
  119. package/i18n/lithuanian.js +1 -1
  120. package/i18n/lithuanian.min.js.LICENSE.txt +1 -1
  121. package/i18n/macedonian.js +1 -1
  122. package/i18n/macedonian.min.js.LICENSE.txt +1 -1
  123. package/i18n/malay.js +1 -1
  124. package/i18n/malay.min.js.LICENSE.txt +1 -1
  125. package/i18n/nl-BE.js +1 -1
  126. package/i18n/nl-BE.min.js.LICENSE.txt +1 -1
  127. package/i18n/norwegian.js +1 -1
  128. package/i18n/norwegian.min.js.LICENSE.txt +1 -1
  129. package/i18n/persian.js +1 -1
  130. package/i18n/persian.min.js.LICENSE.txt +1 -1
  131. package/i18n/philippines.js +1 -1
  132. package/i18n/philippines.min.js.LICENSE.txt +1 -1
  133. package/i18n/polish.js +1 -1
  134. package/i18n/polish.min.js.LICENSE.txt +1 -1
  135. package/i18n/portuguese-br.js +1 -1
  136. package/i18n/portuguese-br.min.js.LICENSE.txt +1 -1
  137. package/i18n/portuguese.js +1 -1
  138. package/i18n/portuguese.min.js.LICENSE.txt +1 -1
  139. package/i18n/romanian.js +1 -1
  140. package/i18n/romanian.min.js.LICENSE.txt +1 -1
  141. package/i18n/russian.js +1 -1
  142. package/i18n/russian.min.js.LICENSE.txt +1 -1
  143. package/i18n/serbian.js +1 -1
  144. package/i18n/serbian.min.js.LICENSE.txt +1 -1
  145. package/i18n/simplified-chinese.js +1 -1
  146. package/i18n/simplified-chinese.min.js.LICENSE.txt +1 -1
  147. package/i18n/slovak.js +1 -1
  148. package/i18n/slovak.min.js.LICENSE.txt +1 -1
  149. package/i18n/slovenian.js +1 -1
  150. package/i18n/slovenian.min.js.LICENSE.txt +1 -1
  151. package/i18n/spanish.js +1 -1
  152. package/i18n/spanish.min.js.LICENSE.txt +1 -1
  153. package/i18n/swahili.js +1 -1
  154. package/i18n/swahili.min.js.LICENSE.txt +1 -1
  155. package/i18n/swedish.js +1 -1
  156. package/i18n/swedish.min.js.LICENSE.txt +1 -1
  157. package/i18n/tajik.js +1 -1
  158. package/i18n/tajik.min.js.LICENSE.txt +1 -1
  159. package/i18n/telugu.js +1 -1
  160. package/i18n/telugu.min.js.LICENSE.txt +1 -1
  161. package/i18n/thai.js +1 -1
  162. package/i18n/thai.min.js.LICENSE.txt +1 -1
  163. package/i18n/traditional-chinese.js +1 -1
  164. package/i18n/traditional-chinese.min.js.LICENSE.txt +1 -1
  165. package/i18n/turkish.js +1 -1
  166. package/i18n/turkish.min.js.LICENSE.txt +1 -1
  167. package/i18n/ukrainian.js +1 -1
  168. package/i18n/ukrainian.min.js.LICENSE.txt +1 -1
  169. package/i18n/urdu.js +1 -1
  170. package/i18n/urdu.min.js.LICENSE.txt +1 -1
  171. package/i18n/vietnamese.js +1 -1
  172. package/i18n/vietnamese.min.js.LICENSE.txt +1 -1
  173. package/i18n/welsh.js +1 -1
  174. package/i18n/welsh.min.js.LICENSE.txt +1 -1
  175. package/icons/iconsV1.js +1 -1
  176. package/icons/iconsV1.min.js.LICENSE.txt +1 -1
  177. package/icons/iconsV2.js +1 -1
  178. package/icons/iconsV2.min.js.LICENSE.txt +1 -1
  179. package/package.json +1 -1
  180. package/survey-core.css +1 -1
  181. package/survey-core.fontless.css +1 -1
  182. package/survey-core.fontless.min.css +1 -1
  183. package/survey-core.min.css +1 -1
  184. package/survey.core.js +287 -303
  185. package/survey.core.js.map +1 -1
  186. package/survey.core.min.js +1 -1
  187. package/survey.core.min.js.LICENSE.txt +1 -1
  188. package/survey.i18n.js +1 -1
  189. package/survey.i18n.min.js.LICENSE.txt +1 -1
  190. package/themes/borderless-dark-panelless.js +1 -1
  191. package/themes/borderless-dark-panelless.min.js.LICENSE.txt +1 -1
  192. package/themes/borderless-dark.js +1 -1
  193. package/themes/borderless-dark.min.js.LICENSE.txt +1 -1
  194. package/themes/borderless-light-panelless.js +1 -1
  195. package/themes/borderless-light-panelless.min.js.LICENSE.txt +1 -1
  196. package/themes/borderless-light.js +1 -1
  197. package/themes/borderless-light.min.js.LICENSE.txt +1 -1
  198. package/themes/contrast-dark-panelless.js +1 -1
  199. package/themes/contrast-dark-panelless.min.js.LICENSE.txt +1 -1
  200. package/themes/contrast-dark.js +1 -1
  201. package/themes/contrast-dark.min.js.LICENSE.txt +1 -1
  202. package/themes/contrast-light-panelless.js +1 -1
  203. package/themes/contrast-light-panelless.min.js.LICENSE.txt +1 -1
  204. package/themes/contrast-light.js +1 -1
  205. package/themes/contrast-light.min.js.LICENSE.txt +1 -1
  206. package/themes/default-dark-panelless.js +1 -1
  207. package/themes/default-dark-panelless.min.js.LICENSE.txt +1 -1
  208. package/themes/default-dark.js +1 -1
  209. package/themes/default-dark.min.js.LICENSE.txt +1 -1
  210. package/themes/default-light-panelless.js +1 -1
  211. package/themes/default-light-panelless.min.js.LICENSE.txt +1 -1
  212. package/themes/default-light.js +1 -1
  213. package/themes/default-light.min.js.LICENSE.txt +1 -1
  214. package/themes/doubleborder-dark-panelless.js +1 -1
  215. package/themes/doubleborder-dark-panelless.min.js.LICENSE.txt +1 -1
  216. package/themes/doubleborder-dark.js +1 -1
  217. package/themes/doubleborder-dark.min.js.LICENSE.txt +1 -1
  218. package/themes/doubleborder-light-panelles.js +1 -1
  219. package/themes/doubleborder-light-panelles.min.js.LICENSE.txt +1 -1
  220. package/themes/doubleborder-light.js +1 -1
  221. package/themes/doubleborder-light.min.js.LICENSE.txt +1 -1
  222. package/themes/flat-dark-panelless.js +1 -1
  223. package/themes/flat-dark-panelless.min.js.LICENSE.txt +1 -1
  224. package/themes/flat-dark.js +1 -1
  225. package/themes/flat-dark.min.js.LICENSE.txt +1 -1
  226. package/themes/flat-light-panelless.js +1 -1
  227. package/themes/flat-light-panelless.min.js.LICENSE.txt +1 -1
  228. package/themes/flat-light.js +1 -1
  229. package/themes/flat-light.min.js.LICENSE.txt +1 -1
  230. package/themes/index.js +1 -1
  231. package/themes/index.min.js.LICENSE.txt +1 -1
  232. package/themes/layered-dark-panelless.js +1 -1
  233. package/themes/layered-dark-panelless.min.js.LICENSE.txt +1 -1
  234. package/themes/layered-dark.js +1 -1
  235. package/themes/layered-dark.min.js.LICENSE.txt +1 -1
  236. package/themes/layered-light-panelless.js +1 -1
  237. package/themes/layered-light-panelless.min.js.LICENSE.txt +1 -1
  238. package/themes/layered-light.js +1 -1
  239. package/themes/layered-light.min.js.LICENSE.txt +1 -1
  240. package/themes/plain-dark-panelless.js +1 -1
  241. package/themes/plain-dark-panelless.min.js.LICENSE.txt +1 -1
  242. package/themes/plain-dark.js +1 -1
  243. package/themes/plain-dark.min.js.LICENSE.txt +1 -1
  244. package/themes/plain-light-panelless.js +1 -1
  245. package/themes/plain-light-panelless.min.js.LICENSE.txt +1 -1
  246. package/themes/plain-light.js +1 -1
  247. package/themes/plain-light.min.js.LICENSE.txt +1 -1
  248. package/themes/sharp-dark-panelless.js +1 -1
  249. package/themes/sharp-dark-panelless.min.js.LICENSE.txt +1 -1
  250. package/themes/sharp-dark.js +1 -1
  251. package/themes/sharp-dark.min.js.LICENSE.txt +1 -1
  252. package/themes/sharp-light-panelless.js +1 -1
  253. package/themes/sharp-light-panelless.min.js.LICENSE.txt +1 -1
  254. package/themes/sharp-light.js +1 -1
  255. package/themes/sharp-light.min.js.LICENSE.txt +1 -1
  256. package/themes/solid-dark-panelless.js +1 -1
  257. package/themes/solid-dark-panelless.min.js.LICENSE.txt +1 -1
  258. package/themes/solid-dark.js +1 -1
  259. package/themes/solid-dark.min.js.LICENSE.txt +1 -1
  260. package/themes/solid-light-panelless.js +1 -1
  261. package/themes/solid-light-panelless.min.js.LICENSE.txt +1 -1
  262. package/themes/solid-light.js +1 -1
  263. package/themes/solid-light.min.js.LICENSE.txt +1 -1
  264. package/themes/three-dimensional-dark-panelless.js +1 -1
  265. package/themes/three-dimensional-dark-panelless.min.js.LICENSE.txt +1 -1
  266. package/themes/three-dimensional-dark.js +1 -1
  267. package/themes/three-dimensional-dark.min.js.LICENSE.txt +1 -1
  268. package/themes/three-dimensional-light-panelless.js +1 -1
  269. package/themes/three-dimensional-light-panelless.min.js.LICENSE.txt +1 -1
  270. package/themes/three-dimensional-light.js +1 -1
  271. package/themes/three-dimensional-light.min.js.LICENSE.txt +1 -1
  272. package/typings/src/base-interfaces.d.ts +1 -0
  273. package/typings/src/base.d.ts +5 -0
  274. package/typings/src/martixBase.d.ts +0 -3
  275. package/typings/src/question.d.ts +10 -10
  276. package/typings/src/question_custom.d.ts +4 -1
  277. package/typings/src/question_expression.d.ts +1 -3
  278. package/typings/src/question_matrix.d.ts +2 -0
  279. package/typings/src/question_matrixdropdownbase.d.ts +1 -0
  280. package/typings/src/question_slider.d.ts +0 -1
  281. package/typings/src/question_text.d.ts +0 -2
  282. package/typings/src/settings.d.ts +1 -0
  283. package/typings/src/survey-events-api.d.ts +19 -0
  284. package/typings/src/survey.d.ts +6 -1
  285. package/typings/src/trigger.d.ts +4 -8
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - Survey JavaScript library v2.3.3
2
+ * surveyjs - Survey JavaScript library v2.3.4
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
  */
@@ -8228,14 +8228,9 @@ class Base {
8228
8228
  return;
8229
8229
  if (!!info.canRun && !info.canRun(this))
8230
8230
  return;
8231
- if (!info.runner) {
8232
- info.runner = this.createExpressionRunner(expression);
8233
- info.runner.onRunComplete = (res) => {
8234
- info.onExecute(this, res);
8235
- };
8236
- }
8237
- info.runner.expression = expression;
8238
- info.runner.runContext(this.getValueGetterContext(), properties);
8231
+ this.runExpressionByProperty(propName, properties, (res) => {
8232
+ info.onExecute(this, res);
8233
+ });
8239
8234
  }
8240
8235
  doBeforeAsynRun(id) {
8241
8236
  if (!this.asynExpressionHash)
@@ -8264,6 +8259,51 @@ class Base {
8264
8259
  res.onAfterAsyncRun = (id) => { this.doAfterAsynRun(id); };
8265
8260
  return res;
8266
8261
  }
8262
+ getExpressionFromSurvey(propName) {
8263
+ let expression = this[propName];
8264
+ if (!expression)
8265
+ return "";
8266
+ const survey = this.getSurvey();
8267
+ return !!survey ? survey.beforeExpressionRunning(this, propName, expression) : expression;
8268
+ }
8269
+ runExpressionByProperty(propName, properties, onExecute, canRun) {
8270
+ if (!this[propName])
8271
+ return false;
8272
+ const expression = this.getExpressionFromSurvey(propName);
8273
+ if (!!expression) {
8274
+ const info = this.getExpressionInfoByProperty(propName, expression);
8275
+ const runner = info.runner;
8276
+ if (!info.isRunning && (!canRun || canRun(runner))) {
8277
+ info.isRunning = true;
8278
+ runner.onRunComplete = (value) => {
8279
+ onExecute(value);
8280
+ info.isRunning = false;
8281
+ };
8282
+ runner.runContext(this.getValueGetterContext(), properties);
8283
+ }
8284
+ }
8285
+ return true;
8286
+ }
8287
+ getExpressionByProperty(propName) {
8288
+ const expression = this.getExpressionFromSurvey(propName);
8289
+ if (!expression)
8290
+ return null;
8291
+ return this.getExpressionInfoByProperty(propName, expression).runner;
8292
+ }
8293
+ getExpressionInfoByProperty(propName, expression) {
8294
+ if (!this.runExpressionHash) {
8295
+ this.runExpressionHash = {};
8296
+ }
8297
+ let info = this.runExpressionHash[propName];
8298
+ if (!info) {
8299
+ info = { runner: this.createExpressionRunner(expression) };
8300
+ this.runExpressionHash[propName] = info;
8301
+ }
8302
+ else {
8303
+ info.runner.expression = expression;
8304
+ }
8305
+ return info;
8306
+ }
8267
8307
  /**
8268
8308
  * Registers a single value change handler for one or multiple properties.
8269
8309
  *
@@ -14195,6 +14235,7 @@ var settings = {
14195
14235
  row: "row",
14196
14236
  totalRow: "totalRow",
14197
14237
  rowIndex: "rowIndex",
14238
+ visibleRowIndex: "visibleRowIndex",
14198
14239
  rowValue: "rowValue",
14199
14240
  rowName: "rowName",
14200
14241
  rowTitle: "rowTitle",
@@ -15120,13 +15161,14 @@ class ExpressionValidator extends SurveyValidator {
15120
15161
  return this.getLocalizationFormatString("invalidExpression", this.expression);
15121
15162
  }
15122
15163
  ensureConditionRunner(reNew) {
15123
- if (!this.expression)
15164
+ const expression = this.getExpressionFromSurvey("expression");
15165
+ if (!expression)
15124
15166
  return false;
15125
15167
  if (reNew || !this.conditionRunner) {
15126
- this.conditionRunner = new ConditionRunner(this.expression);
15168
+ this.conditionRunner = new ConditionRunner(expression);
15127
15169
  }
15128
15170
  else {
15129
- this.conditionRunner.expression = this.expression;
15171
+ this.conditionRunner.expression = expression;
15130
15172
  }
15131
15173
  return true;
15132
15174
  }
@@ -15479,14 +15521,6 @@ class TextAreaModel {
15479
15521
  }
15480
15522
  }
15481
15523
 
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
15524
  class QuestionValueGetterContext {
15491
15525
  constructor(question, isUnwrapped) {
15492
15526
  this.question = question;
@@ -15641,6 +15675,7 @@ class Question extends SurveyElement {
15641
15675
  super(name);
15642
15676
  this.customWidgetData = { isNeedRender: true };
15643
15677
  this.hasCssErrorCallback = () => false;
15678
+ this.triggersInfo = [];
15644
15679
  this.isReadyValue = true;
15645
15680
  this.dependedQuestions = [];
15646
15681
  /**
@@ -15656,7 +15691,6 @@ class Question extends SurveyElement {
15656
15691
  * Indicates the previous ready state.
15657
15692
  */
15658
15693
  this.onReadyChanged = this.addEvent();
15659
- this.triggersInfo = [];
15660
15694
  this.isRunningValidatorsValue = false;
15661
15695
  this.isValueChangedInSurvey = false;
15662
15696
  this.allowNotifyValueChanged = true;
@@ -15674,13 +15708,7 @@ class Question extends SurveyElement {
15674
15708
  this.createLocalizableString("requiredErrorText", this);
15675
15709
  this.createLocalizableString("commentPlaceholder", this);
15676
15710
  this.createLocalizableString("defaultDisplayValue", this);
15677
- this.addTriggerInfo("resetValueIf", () => !this.isEmpty(), () => {
15678
- this.startSetValueOnExpression();
15679
- this.updateValueWithDefaultsOrClear();
15680
- this.finishSetValueOnExpression();
15681
- });
15682
- const setValueIfInfo = this.addTriggerInfo("setValueIf", () => true, () => this.runSetValueExpression());
15683
- setValueIfInfo.getSecondRunner = () => this.getSetValueExpressionRunner();
15711
+ this.addTriggersInfo();
15684
15712
  this.registerPropertyChangedHandlers(["width"], () => {
15685
15713
  this.updateQuestionCss();
15686
15714
  if (!!this.parent) {
@@ -16147,62 +16175,14 @@ class Question extends SurveyElement {
16147
16175
  requiredAnsweredQuestionCount: !this.isEmpty() && this.isRequired ? 1 : 0,
16148
16176
  };
16149
16177
  }
16150
- ensureSetValueExpressionRunner() {
16151
- if (!this.setValueExpressionRunner) {
16152
- this.setValueExpressionRunner = this.createExpressionRunner(this.setValueExpression);
16153
- this.setValueExpressionRunner.onRunComplete = (res) => {
16154
- this.runExpressionSetValue(res);
16155
- };
16156
- }
16157
- else {
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
- }
16178
+ runTriggerInfo(info, keys, properties) {
16179
+ this.runExpressionByProperty(info.name, properties, (value) => {
16180
+ info.doComplete(value, properties);
16181
+ }, (runner) => {
16182
+ if (!info.canRun())
16183
+ return false;
16184
+ return !keys || this.canExecuteTriggerByKeys(keys, runner, this.getExpressionByProperty(info.secondName));
16185
+ });
16206
16186
  }
16207
16187
  canExecuteTriggerByKeys(keys, runner, secondRunner) {
16208
16188
  if (!runner && !!secondRunner) {
@@ -16231,6 +16211,47 @@ class Question extends SurveyElement {
16231
16211
  getValueGetterContext(isUnwrapped) {
16232
16212
  return new QuestionValueGetterContext(this, isUnwrapped);
16233
16213
  }
16214
+ addTriggersInfo() {
16215
+ this.addTriggerInfo({
16216
+ name: "resetValueIf",
16217
+ canRun: () => !this.isEmpty(),
16218
+ doComplete: (res, properties) => {
16219
+ if (res === true) {
16220
+ this.startSetValueOnExpression();
16221
+ this.updateValueWithDefaultsOrClear();
16222
+ this.finishSetValueOnExpression();
16223
+ }
16224
+ }
16225
+ });
16226
+ this.addTriggerInfo({
16227
+ name: "setValueIf",
16228
+ secondName: "setValueExpression",
16229
+ canRun: () => true,
16230
+ doComplete: (res, properties) => {
16231
+ if (res) {
16232
+ if (!this.setValueExpression) {
16233
+ this.clearValue();
16234
+ }
16235
+ else {
16236
+ const info = {
16237
+ name: "setValueExpression",
16238
+ canRun: () => true,
16239
+ doComplete: (res, properties) => this.runExpressionSetValue(res)
16240
+ };
16241
+ this.runTriggerInfo(info, undefined, properties);
16242
+ }
16243
+ }
16244
+ }
16245
+ });
16246
+ this.addTriggerInfo({
16247
+ name: "setValueExpression",
16248
+ canRun: () => !this.setValueIf,
16249
+ doComplete: (res, properties) => this.runExpressionSetValue(res)
16250
+ });
16251
+ }
16252
+ addTriggerInfo(info) {
16253
+ this.triggersInfo.push(info);
16254
+ }
16234
16255
  runTriggers(name, value, keys) {
16235
16256
  if (this.isSettingQuestionValue || (this.parentQuestion && this.parentQuestion.getValueName() === name))
16236
16257
  return;
@@ -16238,8 +16259,9 @@ class Question extends SurveyElement {
16238
16259
  keys = {};
16239
16260
  keys[name] = value;
16240
16261
  }
16262
+ const properties = this.getDataFilteredProperties();
16241
16263
  this.triggersInfo.forEach(info => {
16242
- this.runTriggerInfo(info, keys);
16264
+ this.runTriggerInfo(info, keys, properties);
16243
16265
  });
16244
16266
  }
16245
16267
  runConditions() {
@@ -16351,7 +16373,7 @@ class Question extends SurveyElement {
16351
16373
  this.resetSingleInputCore();
16352
16374
  }
16353
16375
  resetSingleInputCore() {
16354
- const prev = this.singleInputQuestion;
16376
+ const prev = this.getPropertyValue("singleInputQuestion");
16355
16377
  this.resetPropertyValue("singleInputQuestion");
16356
16378
  if (!!prev) {
16357
16379
  this.onSingleInputChanged();
@@ -17506,8 +17528,7 @@ class Question extends SurveyElement {
17506
17528
  properties["question"] = this;
17507
17529
  this.runConditionCore(properties);
17508
17530
  if (!this.isValueChangedDirectly && (!this.isClearValueOnHidden || this.isVisibleInSurvey)) {
17509
- this.defaultValueRunner = this.getDefaultRunner(this.defaultValueRunner, this.defaultValueExpression);
17510
- this.runDefaultValueExpression(this.defaultValueRunner, properties);
17531
+ this.runDefaultValueExpression(properties);
17511
17532
  }
17512
17533
  }
17513
17534
  get isInDesignMode() {
@@ -18041,15 +18062,6 @@ class Question extends SurveyElement {
18041
18062
  isDefaultValueEmpty() {
18042
18063
  return !this.defaultValueExpression && this.isValueEmpty(this.defaultValue, !this.allowSpaceAsAnswer);
18043
18064
  }
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
18065
  setDefaultValue() {
18054
18066
  this.setDefaultValueCore((val) => {
18055
18067
  val = this.convertToCorrectValue(val);
@@ -18061,9 +18073,13 @@ class Question extends SurveyElement {
18061
18073
  setDefaultIntoValue(val) {
18062
18074
  this.value = val;
18063
18075
  }
18064
- setDefaultValueCore(func) {
18065
- this.defaultValueRunner = this.getDefaultRunner(this.defaultValueRunner, this.defaultValueExpression);
18066
- this.setValueAndRunExpression(this.defaultValueRunner, this.getUnbindValue(this.defaultValue), (val) => func(val));
18076
+ setDefaultValueCore(setFunc) {
18077
+ const func = (val) => {
18078
+ this.runExpressionSetValueCore(val, setFunc);
18079
+ };
18080
+ if (!this.runDefaultValueExpression(undefined, func)) {
18081
+ func(this.getUnbindValue(this.defaultValue));
18082
+ }
18067
18083
  }
18068
18084
  updateValueWithDefaultsOrClear() {
18069
18085
  if (this.isDesignMode || this.isLoadingFromJson)
@@ -18078,14 +18094,6 @@ class Question extends SurveyElement {
18078
18094
  isValueExpression(val) {
18079
18095
  return !!val && typeof val == "string" && val.length > 0 && val[0] == "=";
18080
18096
  }
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
18097
  convertFuncValuetoQuestionValue(val) {
18090
18098
  return Helpers.convertValToQuestionVal(val);
18091
18099
  }
@@ -18109,8 +18117,8 @@ class Question extends SurveyElement {
18109
18117
  var _a;
18110
18118
  (_a = this.survey) === null || _a === void 0 ? void 0 : _a.finishSetValueOnExpression();
18111
18119
  }
18112
- runDefaultValueExpression(runner, properties = null, setFunc) {
18113
- if (!runner || !this.data)
18120
+ runDefaultValueExpression(properties = null, setFunc) {
18121
+ if (!this.data)
18114
18122
  return false;
18115
18123
  if (!setFunc) {
18116
18124
  setFunc = (val) => {
@@ -18121,17 +18129,13 @@ class Question extends SurveyElement {
18121
18129
  properties = this.defaultValueExpression ? this.data.getFilteredProperties() : {};
18122
18130
  properties["question"] = this;
18123
18131
  }
18124
- if (!!runner && runner.canRun) {
18125
- runner.onRunComplete = (res) => {
18126
- if (res == undefined)
18127
- res = this.defaultValue;
18128
- this.isChangingViaDefaultValue = true;
18129
- setFunc(res);
18130
- this.isChangingViaDefaultValue = false;
18131
- };
18132
- runner.runContext(this.getValueGetterContext(), properties);
18133
- }
18134
- return true;
18132
+ return this.runExpressionByProperty("defaultValueExpression", properties, (res) => {
18133
+ if (res == undefined)
18134
+ res = this.defaultValue;
18135
+ this.isChangingViaDefaultValue = true;
18136
+ setFunc(res);
18137
+ this.isChangingViaDefaultValue = false;
18138
+ });
18135
18139
  }
18136
18140
  /**
18137
18141
  * A comment to the selected question value. Enable the `showCommentArea` property to allow users to leave comments.
@@ -19458,19 +19462,21 @@ class ItemValue extends BaseAction {
19458
19462
  return this.getEnableConditionRunner();
19459
19463
  }
19460
19464
  getVisibleConditionRunner() {
19461
- if (!this.visibleIf)
19465
+ const expression = this.getExpressionFromSurvey("visibleIf");
19466
+ if (!expression)
19462
19467
  return null;
19463
19468
  if (!this.visibleConditionRunner)
19464
- this.visibleConditionRunner = new ConditionRunner(this.visibleIf);
19465
- this.visibleConditionRunner.expression = this.visibleIf;
19469
+ this.visibleConditionRunner = new ConditionRunner(expression);
19470
+ this.visibleConditionRunner.expression = expression;
19466
19471
  return this.visibleConditionRunner;
19467
19472
  }
19468
19473
  getEnableConditionRunner() {
19469
- if (!this.enableIf)
19474
+ const expression = this.getExpressionFromSurvey("enableIf");
19475
+ if (!expression)
19470
19476
  return null;
19471
19477
  if (!this.enableConditionRunner)
19472
- this.enableConditionRunner = new ConditionRunner(this.enableIf);
19473
- this.enableConditionRunner.expression = this.enableIf;
19478
+ this.enableConditionRunner = new ConditionRunner(expression);
19479
+ this.enableConditionRunner.expression = expression;
19474
19480
  return this.enableConditionRunner;
19475
19481
  }
19476
19482
  get selected() {
@@ -19668,9 +19674,8 @@ class CalculatedValue extends Base {
19668
19674
  this.runExpression(this.data.getFilteredProperties());
19669
19675
  }
19670
19676
  runExpressionCore(calculatedValues, properties) {
19671
- if (!this.canRunExpression)
19677
+ if (!this.canRunExpression || !this.ensureExpression())
19672
19678
  return;
19673
- this.ensureExpression();
19674
19679
  this.locCalculation();
19675
19680
  if (!!calculatedValues) {
19676
19681
  this.runDependentExpressions(calculatedValues, properties);
@@ -19689,17 +19694,22 @@ class CalculatedValue extends Base {
19689
19694
  }
19690
19695
  }
19691
19696
  ensureExpression() {
19697
+ const expression = this.getExpressionFromSurvey("expression");
19698
+ if (!expression)
19699
+ return false;
19692
19700
  if (!!this.expressionRunner) {
19693
- this.expressionRunner.expression = this.expression;
19694
- return;
19701
+ this.expressionRunner.expression = expression;
19695
19702
  }
19696
- this.expressionRunner = new ExpressionRunner(this.expression);
19697
- this.expressionRunner.onRunComplete = newValue => {
19698
- if (!Helpers.isTwoValueEquals(newValue, this.value, false, true, false)) {
19699
- this.setValue(newValue);
19700
- }
19701
- this.unlocCalculation();
19702
- };
19703
+ else {
19704
+ this.expressionRunner = this.createExpressionRunner(expression);
19705
+ this.expressionRunner.onRunComplete = newValue => {
19706
+ if (!Helpers.isTwoValueEquals(newValue, this.value, false, true, false)) {
19707
+ this.setValue(newValue);
19708
+ }
19709
+ this.unlocCalculation();
19710
+ };
19711
+ }
19712
+ return true;
19703
19713
  }
19704
19714
  }
19705
19715
  Serializer.addClass("calculatedvalue", [
@@ -19722,9 +19732,10 @@ class ExpressionItem extends Base {
19722
19732
  return "expressionitem";
19723
19733
  }
19724
19734
  runCondition(properties) {
19725
- if (!this.expression)
19735
+ const expression = this.getExpressionFromSurvey("expression");
19736
+ if (!expression)
19726
19737
  return false;
19727
- return new ConditionRunner(this.expression).runContext(this.getValueGetterContext(), properties);
19738
+ return new ConditionRunner(expression).runContext(this.getValueGetterContext(), properties);
19728
19739
  }
19729
19740
  /**
19730
19741
  * The expression property. If this expression returns true, then survey will use html property to show on complete page.
@@ -20715,7 +20726,6 @@ class QuestionMatrixBaseModel extends Question {
20715
20726
  this.onRowsChanged();
20716
20727
  }
20717
20728
  }
20718
- isRowsFiltered() { return !!this.filteredRows; }
20719
20729
  clearGeneratedRows() {
20720
20730
  this.generatedVisibleRows = null;
20721
20731
  }
@@ -20723,20 +20733,14 @@ class QuestionMatrixBaseModel extends Question {
20723
20733
  runConditionsForRows(properties) {
20724
20734
  const showInvisibile = !!this.survey && this.survey.areInvisibleElementsShowing;
20725
20735
  const runner = !showInvisibile ? this.createRowsVisibleIfRunner() : null;
20726
- this.filteredRows = [];
20727
- const hasChanged = ItemValue.runConditionsForItems(this.rows, this.filteredRows, runner, properties, !showInvisibile);
20736
+ const hasChanged = ItemValue.runConditionsForItems(this.rows, undefined, runner, properties, !showInvisibile);
20728
20737
  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
20738
  return hasChanged;
20736
20739
  }
20737
20740
  runConditionsForColumns(properties) {
20738
20741
  const useColumnsExpression = !!this.survey && !this.survey.areInvisibleElementsShowing;
20739
- const runner = useColumnsExpression && !!this.columnsVisibleIf ? new ConditionRunner(this.columnsVisibleIf) : null;
20742
+ const expression = this.getExpressionFromSurvey("columnsVisibleIf");
20743
+ const runner = useColumnsExpression && !!expression ? new ConditionRunner(expression) : null;
20740
20744
  return ItemValue.runConditionsForItems(this.columns, undefined, runner, properties, this.shouldRunColumnExpression());
20741
20745
  }
20742
20746
  clearInvisibleColumnValues() { }
@@ -21275,11 +21279,24 @@ class QuestionCustomModelBase extends Question {
21275
21279
  this.initElement(this.getElement());
21276
21280
  this.isSettingValOnLoading = false;
21277
21281
  }
21282
+ onCustomQuestionLoaded() {
21283
+ if (!this.isLoadedCalled && !!this.customQuestion && !!this.survey) {
21284
+ this.customQuestion.onLoaded(this);
21285
+ this.isLoadedCalled = true;
21286
+ }
21287
+ }
21278
21288
  onSurveyLoad() {
21279
21289
  super.onSurveyLoad();
21290
+ this.isLoadedCalled = false;
21280
21291
  if (!!this.getElement()) {
21281
21292
  this.getElement().onSurveyLoad();
21282
- this.customQuestion.onLoaded(this);
21293
+ }
21294
+ this.onCustomQuestionLoaded();
21295
+ }
21296
+ setSurveyCore(value) {
21297
+ super.setSurveyCore(value);
21298
+ if (this.isLoadedCalled === false && value) {
21299
+ this.onCustomQuestionLoaded();
21283
21300
  }
21284
21301
  }
21285
21302
  afterRenderQuestionElement(el) {
@@ -22177,11 +22194,6 @@ class QuestionExpressionModel extends Question {
22177
22194
  constructor(name) {
22178
22195
  super(name);
22179
22196
  this.createLocalizableString("format", this);
22180
- this.registerPropertyChangedHandlers(["expression"], () => {
22181
- if (this.expressionRunner) {
22182
- this.expressionRunner = this.createRunner();
22183
- }
22184
- });
22185
22197
  this.registerPropertyChangedHandlers(["format", "currency", "displayStyle"], () => {
22186
22198
  this.updateFormatedValue();
22187
22199
  });
@@ -22219,22 +22231,18 @@ class QuestionExpressionModel extends Question {
22219
22231
  this.setPropertyValue("expression", val);
22220
22232
  }
22221
22233
  locCalculation() {
22222
- this.expressionIsRunning = true;
22234
+ this.isExecutionLocked = true;
22223
22235
  }
22224
22236
  unlocCalculation() {
22225
- this.expressionIsRunning = false;
22237
+ this.isExecutionLocked = false;
22226
22238
  }
22227
22239
  runConditionCore(properties) {
22228
22240
  super.runConditionCore(properties);
22229
- if (!this.expression ||
22230
- this.expressionIsRunning ||
22231
- (!this.runIfReadOnly && this.isReadOnly))
22241
+ if (this.isExecutionLocked || !this.runIfReadOnly && this.isReadOnly)
22232
22242
  return;
22233
- this.locCalculation();
22234
- if (!this.expressionRunner) {
22235
- this.expressionRunner = this.createRunner();
22236
- }
22237
- this.expressionRunner.runContext(this.getValueGetterContext(), properties);
22243
+ this.runExpressionByProperty("expression", properties, (val) => {
22244
+ this.value = this.roundValue(val);
22245
+ });
22238
22246
  }
22239
22247
  canCollectErrors() {
22240
22248
  return true;
@@ -22242,14 +22250,6 @@ class QuestionExpressionModel extends Question {
22242
22250
  hasRequiredError() {
22243
22251
  return false;
22244
22252
  }
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
22253
  /**
22254
22254
  * 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
22255
  *
@@ -24883,6 +24883,9 @@ class MatrixRowGetterContext extends QuestionItemValueGetterContext {
24883
24883
  if (name === setVar.rowIndex.toLocaleLowerCase()) {
24884
24884
  return this.row.rowIndex;
24885
24885
  }
24886
+ if (name === setVar.visibleRowIndex.toLocaleLowerCase()) {
24887
+ return this.getQuestionData().visibleRows.indexOf(this.row) + 1;
24888
+ }
24886
24889
  if ([setVar.item, setVar.rowName.toLocaleLowerCase(), setVar.rowValue.toLocaleLowerCase()].indexOf(name) > -1) {
24887
24890
  return this.row.rowName;
24888
24891
  }
@@ -26227,22 +26230,24 @@ class QuestionMatrixDropdownModelBase extends QuestionMatrixBaseModel {
26227
26230
  runCellsCondition(properties) {
26228
26231
  if (this.isDesignMode)
26229
26232
  return;
26233
+ const rowsVisibleIf = this.getExpressionFromSurvey("rowsVisibleIf");
26230
26234
  const rows = this.generatedVisibleRows;
26231
26235
  if (!!rows) {
26232
26236
  for (var i = 0; i < rows.length; i++) {
26233
- rows[i].runCondition(properties, this.rowsVisibleIf);
26237
+ rows[i].runCondition(properties, rowsVisibleIf);
26234
26238
  }
26235
26239
  }
26236
26240
  this.checkColumnsVisibility();
26237
26241
  this.checkColumnsRenderedRequired();
26238
26242
  }
26239
26243
  runConditionsForColumns(properties) {
26244
+ const expression = this.getExpressionFromSurvey("columnsVisibleIf");
26240
26245
  this.columns.forEach(column => {
26241
- if (!this.columnsVisibleIf) {
26246
+ if (!expression) {
26242
26247
  column.isColumnsVisibleIf = true;
26243
26248
  }
26244
26249
  else {
26245
- const condition = new ConditionRunner(this.columnsVisibleIf);
26250
+ const condition = new ConditionRunner(expression);
26246
26251
  column.isColumnsVisibleIf = condition.runContext(column.getValueGetterContext(), properties) === true;
26247
26252
  }
26248
26253
  });
@@ -26431,6 +26436,7 @@ class QuestionMatrixDropdownModelBase extends QuestionMatrixBaseModel {
26431
26436
  * The template can contain the following placeholders:
26432
26437
  *
26433
26438
  * - `{rowIndex}` - A row index within the collection of all rows. Starts with 1.
26439
+ * - `{visibleRowIndex}` - A row index within the collection of visible rows. Starts with 1.
26434
26440
  * - `{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
26441
  * - `{rowTitle}` - A row title (the `text` property within objects in the `rows` array).
26436
26442
  * - `{row.columnname}` - The value of a cell in the same row.
@@ -27407,7 +27413,7 @@ class QuestionMatrixDropdownModelBase extends QuestionMatrixBaseModel {
27407
27413
  }
27408
27414
  }
27409
27415
  isRowsFiltered() {
27410
- return super.isRowsFiltered() || (this.visibleRows !== this.generatedVisibleRows);
27416
+ return this.visibleRows !== this.generatedVisibleRows;
27411
27417
  }
27412
27418
  getQuestionFromArray(name, index) {
27413
27419
  if (index >= this.visibleRows.length)
@@ -27476,7 +27482,9 @@ class QuestionMatrixDropdownModelBase extends QuestionMatrixBaseModel {
27476
27482
  Serializer.addClass("matrixdropdownbase", [
27477
27483
  {
27478
27484
  name: "columns:matrixdropdowncolumns",
27479
- className: "matrixdropdowncolumn", isArray: true
27485
+ uniqueProperty: "name",
27486
+ className: "matrixdropdowncolumn",
27487
+ isArray: true
27480
27488
  },
27481
27489
  {
27482
27490
  name: "columnLayout",
@@ -35552,6 +35560,10 @@ class SurveyModel extends SurveyElementCore {
35552
35560
  */
35553
35561
  this.onDragDropAllow = this.addEvent();
35554
35562
  this.onMatrixRowDragOver = this.addEvent();
35563
+ /**
35564
+ * 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.
35565
+ */
35566
+ this.onExpressionRunning = this.addEvent();
35555
35567
  /**
35556
35568
  * 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
35569
  */
@@ -37173,6 +37185,11 @@ class SurveyModel extends SurveyElementCore {
37173
37185
  };
37174
37186
  return exp.runContext(this.getValueGetterContext(), properties) || onCompleteRes;
37175
37187
  }
37188
+ beforeExpressionRunning(obj, propertyName, expression) {
37189
+ const opt = { element: obj, propertyName: propertyName, expression: expression, allow: true };
37190
+ this.onExpressionRunning.fire(this, opt);
37191
+ return opt.allow ? opt.expression : "";
37192
+ }
37176
37193
  get isSettingValueOnExpression() { return this.setValueOnExpressionCounter > 0; }
37177
37194
  startSetValueOnExpression() {
37178
37195
  this.setValueOnExpressionCounter++;
@@ -43323,8 +43340,8 @@ Serializer.addClass("survey", [
43323
43340
  dependsOn: ["showTOC"],
43324
43341
  visibleIf: (survey) => { return !!survey && survey.showTOC; }
43325
43342
  },
43326
- { name: "readOnly:boolean", default: false },
43327
- { name: "mode", default: "edit", choices: ["edit", "display"], visible: false },
43343
+ { name: "readOnly:boolean" },
43344
+ { name: "mode", visible: false, isSerializable: false },
43328
43345
  { name: "storeOthersAsComment:boolean", default: true },
43329
43346
  { name: "maxTextLength:number", default: 0, minValue: 0 },
43330
43347
  { name: "maxCommentLength:number", default: 0, minValue: 0, alternativeName: "maxOthersLength" },
@@ -44081,22 +44098,24 @@ class QuestionSelectBase extends Question {
44081
44098
  return [];
44082
44099
  }
44083
44100
  setConditionalChoicesRunner() {
44084
- if (this.choicesVisibleIf) {
44101
+ const expression = this.getExpressionFromSurvey("choicesVisibleIf");
44102
+ if (expression) {
44085
44103
  if (!this.conditionChoicesVisibleIfRunner) {
44086
- this.conditionChoicesVisibleIfRunner = new ConditionRunner(this.choicesVisibleIf);
44104
+ this.conditionChoicesVisibleIfRunner = new ConditionRunner(expression);
44087
44105
  }
44088
- this.conditionChoicesVisibleIfRunner.expression = this.choicesVisibleIf;
44106
+ this.conditionChoicesVisibleIfRunner.expression = expression;
44089
44107
  }
44090
44108
  else {
44091
44109
  this.conditionChoicesVisibleIfRunner = null;
44092
44110
  }
44093
44111
  }
44094
44112
  setConditionalEnableChoicesRunner() {
44095
- if (this.choicesEnableIf) {
44113
+ const expression = this.getExpressionFromSurvey("choicesEnableIf");
44114
+ if (expression) {
44096
44115
  if (!this.conditionChoicesEnableIfRunner) {
44097
- this.conditionChoicesEnableIfRunner = new ConditionRunner(this.choicesEnableIf);
44116
+ this.conditionChoicesEnableIfRunner = new ConditionRunner(expression);
44098
44117
  }
44099
- this.conditionChoicesEnableIfRunner.expression = this.choicesEnableIf;
44118
+ this.conditionChoicesEnableIfRunner.expression = expression;
44100
44119
  }
44101
44120
  else {
44102
44121
  this.conditionChoicesEnableIfRunner = null;
@@ -45101,10 +45120,10 @@ class QuestionSelectBase extends Question {
45101
45120
  }
45102
45121
  }
45103
45122
  getStoreOthersAsComment() {
45104
- if (this.checkHasChoicesComments())
45105
- return true;
45106
45123
  if (this.showCommentArea)
45107
45124
  return false;
45125
+ if (this.checkHasChoicesComments())
45126
+ return true;
45108
45127
  return (this.storeOthersAsComment === true ||
45109
45128
  (this.storeOthersAsComment == "default" &&
45110
45129
  (this.survey != null ? this.survey.storeOthersAsComment : true)) ||
@@ -47256,6 +47275,7 @@ class MatrixRowModel extends Base {
47256
47275
  get locText() {
47257
47276
  return this.item.locText;
47258
47277
  }
47278
+ get isVisible() { return this.item.isVisible; }
47259
47279
  get value() {
47260
47280
  return this.getPropertyValue("value");
47261
47281
  }
@@ -47483,7 +47503,7 @@ class MatrixValueGetterContext extends ValueGetterContextCore {
47483
47503
  getRootObj() { return this.question.data; }
47484
47504
  updateValueByItem(name, res) {
47485
47505
  var _a;
47486
- const rows = this.question.visibleRows;
47506
+ const rows = this.question.getMatrixRows();
47487
47507
  name = name.toLocaleLowerCase();
47488
47508
  for (let i = 0; i < rows.length; i++) {
47489
47509
  const row = rows[i];
@@ -47740,20 +47760,21 @@ class QuestionMatrixModel extends QuestionMatrixBaseModel {
47740
47760
  super.runConditionCore(properties);
47741
47761
  }
47742
47762
  createRowsVisibleIfRunner() {
47743
- return !!this.rowsVisibleIf ? new ConditionRunner(this.rowsVisibleIf) : null;
47763
+ const expression = this.getExpressionFromSurvey("rowsVisibleIf");
47764
+ return !!expression ? new ConditionRunner(expression) : null;
47744
47765
  }
47745
47766
  onRowsChanged() {
47746
47767
  this.clearGeneratedRows();
47747
47768
  super.onRowsChanged();
47748
47769
  }
47749
- getVisibleRows() {
47770
+ getMatrixRows() {
47750
47771
  if (!!this.generatedVisibleRows)
47751
47772
  return this.generatedVisibleRows;
47752
47773
  const result = new Array();
47753
47774
  let val = this.value;
47754
47775
  if (!val)
47755
47776
  val = {};
47756
- const rows = this.filteredRows || this.rows;
47777
+ const rows = this.rows;
47757
47778
  for (let i = 0; i < rows.length; i++) {
47758
47779
  const row = rows[i];
47759
47780
  if (this.isValueEmpty(row.value))
@@ -47764,6 +47785,15 @@ class QuestionMatrixModel extends QuestionMatrixBaseModel {
47764
47785
  this.generatedVisibleRows = result;
47765
47786
  return result;
47766
47787
  }
47788
+ getVisibleRows() {
47789
+ const rows = [];
47790
+ this.getMatrixRows().forEach(row => {
47791
+ if (row.isVisible) {
47792
+ rows.push(row);
47793
+ }
47794
+ });
47795
+ return rows;
47796
+ }
47767
47797
  getRowByName(name) {
47768
47798
  const rows = this.visibleRows;
47769
47799
  for (let i = 0; i < rows.length; i++) {
@@ -49000,20 +49030,31 @@ class QuestionTextModel extends QuestionTextBase {
49000
49030
  return this.isDateInputType ? this.createDate(minMax) : minMax;
49001
49031
  }
49002
49032
  setRenderedMinMax(properties = null) {
49003
- this.minValueRunner = this.getDefaultRunner(this.minValueRunner, this.minValueExpression);
49004
- this.setValueAndRunExpression(this.minValueRunner, this.min, (val) => {
49033
+ const setProp = (name, val) => {
49034
+ this.setPropertyValue(name, this.convertFuncValuetoQuestionValue(val));
49035
+ };
49036
+ const setMin = (val) => {
49005
49037
  if (!val && this.isDateInputType && !!settings.minDate) {
49006
49038
  val = settings.minDate;
49007
49039
  }
49008
- this.setPropertyValue("renderedMin", val);
49009
- }, properties);
49010
- this.maxValueRunner = this.getDefaultRunner(this.maxValueRunner, this.maxValueExpression);
49011
- this.setValueAndRunExpression(this.maxValueRunner, this.max, (val) => {
49040
+ setProp("renderedMin", val);
49041
+ };
49042
+ const setMax = (val) => {
49012
49043
  if (!val && this.isDateInputType) {
49013
49044
  val = !!settings.maxDate ? settings.maxDate : "2999-12-31";
49014
49045
  }
49015
- this.setPropertyValue("renderedMax", val);
49016
- }, properties);
49046
+ setProp("renderedMax", val);
49047
+ };
49048
+ if (!this.runExpressionByProperty("minValueExpression", properties, (val) => {
49049
+ setMin(val);
49050
+ })) {
49051
+ setMin(this.min);
49052
+ }
49053
+ if (!this.runExpressionByProperty("maxValueExpression", properties, (val) => {
49054
+ setMax(val);
49055
+ })) {
49056
+ setMax(this.max);
49057
+ }
49017
49058
  }
49018
49059
  /**
49019
49060
  * A value passed on to the [`step`](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/step) attribute of the underlying `<input>` element.
@@ -56594,24 +56635,13 @@ class QuestionSliderModel extends Question {
56594
56635
  }
56595
56636
  runConditionCore(properties) {
56596
56637
  super.runConditionCore(properties);
56597
- this.runMinMaxCondition(this.maxValueExpression, properties, (value) => {
56638
+ this.runExpressionByProperty("maxValueExpression", properties, (value) => {
56598
56639
  this.max = value !== null && value !== void 0 ? value : this.renderedMax;
56599
56640
  });
56600
- this.runMinMaxCondition(this.minValueExpression, properties, (value) => {
56641
+ this.runExpressionByProperty("minValueExpression", properties, (value) => {
56601
56642
  this.min = value !== null && value !== void 0 ? value : this.renderedMin;
56602
56643
  });
56603
56644
  }
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
56645
  initPropertyDependencies() {
56616
56646
  // this.registerSychProperties(["segmentCount"],
56617
56647
  // () => {
@@ -60564,7 +60594,6 @@ class QuestionPanelDynamicModel extends Question {
60564
60594
  }
60565
60595
  else {
60566
60596
  for (var i = 0; i < this.panelCount; i++) {
60567
- this.createNewPanel();
60568
60597
  panels.push(this.createNewPanel());
60569
60598
  }
60570
60599
  }
@@ -61364,14 +61393,8 @@ class QuestionPanelDynamicModel extends Question {
61364
61393
  new JsonObject().toObject(json, panel);
61365
61394
  panel.renderWidth = "100%";
61366
61395
  panel.updateCustomWidgets();
61396
+ panel.questions.forEach(q => q.setParentQuestion(this));
61367
61397
  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
61398
  if (this.wasRendered) {
61376
61399
  panel.onFirstRendering();
61377
61400
  panel.locStrsChanged();
@@ -62094,10 +62117,6 @@ class Trigger extends Base {
62094
62117
  constructor() {
62095
62118
  super();
62096
62119
  this.idValue = (Trigger.idCounter++);
62097
- this.registerPropertyChangedHandlers(["operator", "value", "name"], () => {
62098
- this.oldPropertiesChanged();
62099
- });
62100
- this.registerPropertyChangedHandlers(["expression"], () => { this.onExpressionChanged(); });
62101
62120
  }
62102
62121
  get id() { return this.idValue; }
62103
62122
  getType() {
@@ -62105,7 +62124,7 @@ class Trigger extends Base {
62105
62124
  }
62106
62125
  toString() {
62107
62126
  var res = this.getType().replace("trigger", "");
62108
- var exp = !!this.expression ? this.expression : this.buildExpression();
62127
+ var exp = this.expression;
62109
62128
  if (exp) {
62110
62129
  res += ", " + exp;
62111
62130
  }
@@ -62138,7 +62157,7 @@ class Trigger extends Base {
62138
62157
  this.setPropertyValue("name", val);
62139
62158
  }
62140
62159
  get expression() {
62141
- return this.getPropertyValue("expression", "");
62160
+ return this.getPropertyValue("expression", this.buildExpression());
62142
62161
  }
62143
62162
  set expression(val) {
62144
62163
  this.setPropertyValue("expression", val);
@@ -62156,17 +62175,17 @@ class Trigger extends Base {
62156
62175
  return;
62157
62176
  if (options.isOnComplete && !this.canBeExecutedOnComplete())
62158
62177
  return;
62159
- if (!this.isCheckRequired(options.keys))
62160
- return;
62161
62178
  const keys = Object.keys(options.keys);
62162
62179
  if (Array.isArray(keys) && !this.canBeExecuteOnKeysChange(keys))
62163
62180
  return;
62164
- if (!!this.conditionRunner) {
62165
- this.perform(options.properties || null);
62166
- }
62167
- else {
62168
- if (this.canSuccessOnEmptyExpression()) {
62169
- this.triggerResult(true, options.properties || null);
62181
+ const props = options.properties || null;
62182
+ if (!this.runExpressionByProperty("expression", props, (val) => {
62183
+ this.triggerResult(val === true, props);
62184
+ }, (runner) => {
62185
+ return this.isCheckRequired(runner, options.keys);
62186
+ })) {
62187
+ if (this.isCheckRequired(null, options.keys) && this.canSuccessOnEmptyExpression()) {
62188
+ this.triggerResult(true, props);
62170
62189
  }
62171
62190
  }
62172
62191
  }
@@ -62184,12 +62203,6 @@ class Trigger extends Base {
62184
62203
  }
62185
62204
  }
62186
62205
  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
62206
  triggerResult(res, properties) {
62194
62207
  if (res) {
62195
62208
  this.onSuccess(properties);
@@ -62202,16 +62215,6 @@ class Trigger extends Base {
62202
62215
  onSuccess(properties) { }
62203
62216
  onFailure() { }
62204
62217
  onSuccessExecuted() { }
62205
- endLoadingFromJson() {
62206
- super.endLoadingFromJson();
62207
- this.oldPropertiesChanged();
62208
- }
62209
- oldPropertiesChanged() {
62210
- this.onExpressionChanged();
62211
- }
62212
- onExpressionChanged() {
62213
- this.conditionRunner = null;
62214
- }
62215
62218
  buildExpression() {
62216
62219
  if (!this.name)
62217
62220
  return "";
@@ -62224,18 +62227,17 @@ class Trigger extends Base {
62224
62227
  " " +
62225
62228
  OperandMaker.toOperandString(this.value));
62226
62229
  }
62227
- isCheckRequired(keys) {
62230
+ isCheckRequired(runner, keys) {
62228
62231
  if (!keys)
62229
62232
  return false;
62230
- this.createConditionRunner();
62231
- if (this.conditionRunner && this.conditionRunner.hasFunction() === true)
62233
+ if ((runner === null || runner === void 0 ? void 0 : runner.hasFunction()) === true)
62232
62234
  return true;
62233
- return new ValueGetter().isAnyKeyChanged(keys, this.getUsedVariables());
62235
+ return new ValueGetter().isAnyKeyChanged(keys, this.getUsedVariables(runner));
62234
62236
  }
62235
- getUsedVariables() {
62236
- if (!this.conditionRunner)
62237
+ getUsedVariables(runner) {
62238
+ if (!runner)
62237
62239
  return [];
62238
- const res = this.conditionRunner.getVariables();
62240
+ const res = runner.getVariables();
62239
62241
  if (Array.isArray(res)) {
62240
62242
  const unw = settings.expressionVariables.unwrapPostfix;
62241
62243
  for (let i = res.length - 1; i >= 0; i--) {
@@ -62247,17 +62249,6 @@ class Trigger extends Base {
62247
62249
  }
62248
62250
  return res;
62249
62251
  }
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
62252
  get isRequireValue() {
62262
62253
  return this.operator !== "empty" && this.operator != "notempty";
62263
62254
  }
@@ -62457,15 +62448,11 @@ class SurveyTriggerRunExpression extends SurveyTrigger {
62457
62448
  return !isOnNextPage;
62458
62449
  }
62459
62450
  onSuccess(properties) {
62460
- if (!this.owner || !this.runExpression)
62451
+ if (!this.owner)
62461
62452
  return;
62462
- var expression = new ExpressionRunner(this.runExpression);
62463
- if (expression.canRun) {
62464
- expression.onRunComplete = (res) => {
62465
- this.onCompleteRunExpression(res);
62466
- };
62467
- expression.runContext(this.getValueGetterContext(), properties);
62468
- }
62453
+ this.runExpressionByProperty("runExpression", properties, (res) => {
62454
+ this.onCompleteRunExpression(res);
62455
+ });
62469
62456
  }
62470
62457
  onCompleteRunExpression(newValue) {
62471
62458
  if (!!this.setToName && newValue !== undefined) {
@@ -62515,8 +62502,8 @@ class SurveyTriggerCopyValue extends SurveyTrigger {
62515
62502
  this.owner.copyTriggerValue(this.setToName, this.fromName, this.copyDisplayValue);
62516
62503
  }
62517
62504
  canSuccessOnEmptyExpression() { return true; }
62518
- getUsedVariables() {
62519
- const res = super.getUsedVariables();
62505
+ getUsedVariables(runner) {
62506
+ const res = super.getUsedVariables(runner);
62520
62507
  if (res.length === 0 && !!this.fromName) {
62521
62508
  res.push(this.fromName);
62522
62509
  }
@@ -65232,11 +65219,11 @@ var Version;
65232
65219
  var ReleaseDate;
65233
65220
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
65234
65221
  //@ts-ignore
65235
- Version = `${"2.3.3"}`;
65222
+ Version = `${"2.3.4"}`;
65236
65223
  settings.version = Version;
65237
65224
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
65238
65225
  //@ts-ignore
65239
- ReleaseDate = `${"2025-08-19"}`;
65226
+ ReleaseDate = `${"2025-08-26"}`;
65240
65227
  function checkLibraryVersion(ver, libraryName) {
65241
65228
  if (Version != ver) {
65242
65229
  const str = "survey-core has version '" + Version + "' and " + libraryName