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
package/survey.core.js CHANGED
@@ -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
  */
@@ -619,11 +619,11 @@ var Version;
619
619
  var ReleaseDate;
620
620
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
621
621
  //@ts-ignore
622
- Version = "".concat("2.3.3");
622
+ Version = "".concat("2.3.4");
623
623
  _src_settings__WEBPACK_IMPORTED_MODULE_1__.settings.version = Version;
624
624
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
625
625
  //@ts-ignore
626
- ReleaseDate = "".concat("2025-08-19");
626
+ ReleaseDate = "".concat("2025-08-26");
627
627
  function checkLibraryVersion(ver, libraryName) {
628
628
  if (Version != ver) {
629
629
  var str = "survey-core has version '" + Version + "' and " + libraryName
@@ -3524,14 +3524,9 @@ var Base = /** @class */ (function () {
3524
3524
  return;
3525
3525
  if (!!info.canRun && !info.canRun(this))
3526
3526
  return;
3527
- if (!info.runner) {
3528
- info.runner = this.createExpressionRunner(expression);
3529
- info.runner.onRunComplete = function (res) {
3530
- info.onExecute(_this, res);
3531
- };
3532
- }
3533
- info.runner.expression = expression;
3534
- info.runner.runContext(this.getValueGetterContext(), properties);
3527
+ this.runExpressionByProperty(propName, properties, function (res) {
3528
+ info.onExecute(_this, res);
3529
+ });
3535
3530
  };
3536
3531
  Base.prototype.doBeforeAsynRun = function (id) {
3537
3532
  if (!this.asynExpressionHash)
@@ -3565,6 +3560,51 @@ var Base = /** @class */ (function () {
3565
3560
  res.onAfterAsyncRun = function (id) { _this.doAfterAsynRun(id); };
3566
3561
  return res;
3567
3562
  };
3563
+ Base.prototype.getExpressionFromSurvey = function (propName) {
3564
+ var expression = this[propName];
3565
+ if (!expression)
3566
+ return "";
3567
+ var survey = this.getSurvey();
3568
+ return !!survey ? survey.beforeExpressionRunning(this, propName, expression) : expression;
3569
+ };
3570
+ Base.prototype.runExpressionByProperty = function (propName, properties, onExecute, canRun) {
3571
+ if (!this[propName])
3572
+ return false;
3573
+ var expression = this.getExpressionFromSurvey(propName);
3574
+ if (!!expression) {
3575
+ var info_1 = this.getExpressionInfoByProperty(propName, expression);
3576
+ var runner = info_1.runner;
3577
+ if (!info_1.isRunning && (!canRun || canRun(runner))) {
3578
+ info_1.isRunning = true;
3579
+ runner.onRunComplete = function (value) {
3580
+ onExecute(value);
3581
+ info_1.isRunning = false;
3582
+ };
3583
+ runner.runContext(this.getValueGetterContext(), properties);
3584
+ }
3585
+ }
3586
+ return true;
3587
+ };
3588
+ Base.prototype.getExpressionByProperty = function (propName) {
3589
+ var expression = this.getExpressionFromSurvey(propName);
3590
+ if (!expression)
3591
+ return null;
3592
+ return this.getExpressionInfoByProperty(propName, expression).runner;
3593
+ };
3594
+ Base.prototype.getExpressionInfoByProperty = function (propName, expression) {
3595
+ if (!this.runExpressionHash) {
3596
+ this.runExpressionHash = {};
3597
+ }
3598
+ var info = this.runExpressionHash[propName];
3599
+ if (!info) {
3600
+ info = { runner: this.createExpressionRunner(expression) };
3601
+ this.runExpressionHash[propName] = info;
3602
+ }
3603
+ else {
3604
+ info.runner.expression = expression;
3605
+ }
3606
+ return info;
3607
+ };
3568
3608
  /**
3569
3609
  * Registers a single value change handler for one or multiple properties.
3570
3610
  *
@@ -4090,8 +4130,7 @@ __webpack_require__.r(__webpack_exports__);
4090
4130
  /* harmony export */ });
4091
4131
  /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts");
4092
4132
  /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./base */ "./src/base.ts");
4093
- /* harmony import */ var _conditions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./conditions */ "./src/conditions.ts");
4094
- /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts");
4133
+ /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts");
4095
4134
  var __extends = (undefined && undefined.__extends) || (function () {
4096
4135
  var extendStatics = function (d, b) {
4097
4136
  extendStatics = Object.setPrototypeOf ||
@@ -4110,7 +4149,6 @@ var __extends = (undefined && undefined.__extends) || (function () {
4110
4149
 
4111
4150
 
4112
4151
 
4113
-
4114
4152
  /**
4115
4153
  * The calculated value is a way to define the variable in Survey Creator.
4116
4154
  * It has two main properties: name and expression. Based on expression the value read-only property is automatically calculated.
@@ -4244,9 +4282,8 @@ var CalculatedValue = /** @class */ (function (_super) {
4244
4282
  this.runExpression(this.data.getFilteredProperties());
4245
4283
  };
4246
4284
  CalculatedValue.prototype.runExpressionCore = function (calculatedValues, properties) {
4247
- if (!this.canRunExpression)
4285
+ if (!this.canRunExpression || !this.ensureExpression())
4248
4286
  return;
4249
- this.ensureExpression();
4250
4287
  this.locCalculation();
4251
4288
  if (!!calculatedValues) {
4252
4289
  this.runDependentExpressions(calculatedValues, properties);
@@ -4266,22 +4303,27 @@ var CalculatedValue = /** @class */ (function (_super) {
4266
4303
  };
4267
4304
  CalculatedValue.prototype.ensureExpression = function () {
4268
4305
  var _this = this;
4306
+ var expression = this.getExpressionFromSurvey("expression");
4307
+ if (!expression)
4308
+ return false;
4269
4309
  if (!!this.expressionRunner) {
4270
- this.expressionRunner.expression = this.expression;
4271
- return;
4310
+ this.expressionRunner.expression = expression;
4272
4311
  }
4273
- this.expressionRunner = new _conditions__WEBPACK_IMPORTED_MODULE_2__.ExpressionRunner(this.expression);
4274
- this.expressionRunner.onRunComplete = function (newValue) {
4275
- if (!_helpers__WEBPACK_IMPORTED_MODULE_0__.Helpers.isTwoValueEquals(newValue, _this.value, false, true, false)) {
4276
- _this.setValue(newValue);
4277
- }
4278
- _this.unlocCalculation();
4279
- };
4312
+ else {
4313
+ this.expressionRunner = this.createExpressionRunner(expression);
4314
+ this.expressionRunner.onRunComplete = function (newValue) {
4315
+ if (!_helpers__WEBPACK_IMPORTED_MODULE_0__.Helpers.isTwoValueEquals(newValue, _this.value, false, true, false)) {
4316
+ _this.setValue(newValue);
4317
+ }
4318
+ _this.unlocCalculation();
4319
+ };
4320
+ }
4321
+ return true;
4280
4322
  };
4281
4323
  return CalculatedValue;
4282
4324
  }(_base__WEBPACK_IMPORTED_MODULE_1__.Base));
4283
4325
 
4284
- _jsonobject__WEBPACK_IMPORTED_MODULE_3__.Serializer.addClass("calculatedvalue", [
4326
+ _jsonobject__WEBPACK_IMPORTED_MODULE_2__.Serializer.addClass("calculatedvalue", [
4285
4327
  { name: "!name", isUnique: true },
4286
4328
  "expression:expression",
4287
4329
  "includeIntoResult:boolean",
@@ -9921,9 +9963,10 @@ var ExpressionItem = /** @class */ (function (_super) {
9921
9963
  return "expressionitem";
9922
9964
  };
9923
9965
  ExpressionItem.prototype.runCondition = function (properties) {
9924
- if (!this.expression)
9966
+ var expression = this.getExpressionFromSurvey("expression");
9967
+ if (!expression)
9925
9968
  return false;
9926
- return new _conditions__WEBPACK_IMPORTED_MODULE_2__.ConditionRunner(this.expression).runContext(this.getValueGetterContext(), properties);
9969
+ return new _conditions__WEBPACK_IMPORTED_MODULE_2__.ConditionRunner(expression).runContext(this.getValueGetterContext(), properties);
9927
9970
  };
9928
9971
  Object.defineProperty(ExpressionItem.prototype, "expression", {
9929
9972
  /**
@@ -16334,19 +16377,21 @@ var ItemValue = /** @class */ (function (_super) {
16334
16377
  return this.getEnableConditionRunner();
16335
16378
  };
16336
16379
  ItemValue.prototype.getVisibleConditionRunner = function () {
16337
- if (!this.visibleIf)
16380
+ var expression = this.getExpressionFromSurvey("visibleIf");
16381
+ if (!expression)
16338
16382
  return null;
16339
16383
  if (!this.visibleConditionRunner)
16340
- this.visibleConditionRunner = new _conditions__WEBPACK_IMPORTED_MODULE_3__.ConditionRunner(this.visibleIf);
16341
- this.visibleConditionRunner.expression = this.visibleIf;
16384
+ this.visibleConditionRunner = new _conditions__WEBPACK_IMPORTED_MODULE_3__.ConditionRunner(expression);
16385
+ this.visibleConditionRunner.expression = expression;
16342
16386
  return this.visibleConditionRunner;
16343
16387
  };
16344
16388
  ItemValue.prototype.getEnableConditionRunner = function () {
16345
- if (!this.enableIf)
16389
+ var expression = this.getExpressionFromSurvey("enableIf");
16390
+ if (!expression)
16346
16391
  return null;
16347
16392
  if (!this.enableConditionRunner)
16348
- this.enableConditionRunner = new _conditions__WEBPACK_IMPORTED_MODULE_3__.ConditionRunner(this.enableIf);
16349
- this.enableConditionRunner.expression = this.enableIf;
16393
+ this.enableConditionRunner = new _conditions__WEBPACK_IMPORTED_MODULE_3__.ConditionRunner(expression);
16394
+ this.enableConditionRunner.expression = expression;
16350
16395
  return this.enableConditionRunner;
16351
16396
  };
16352
16397
  Object.defineProperty(ItemValue.prototype, "selected", {
@@ -20194,7 +20239,6 @@ var QuestionMatrixBaseModel = /** @class */ (function (_super) {
20194
20239
  this.onRowsChanged();
20195
20240
  }
20196
20241
  };
20197
- QuestionMatrixBaseModel.prototype.isRowsFiltered = function () { return !!this.filteredRows; };
20198
20242
  QuestionMatrixBaseModel.prototype.clearGeneratedRows = function () {
20199
20243
  this.generatedVisibleRows = null;
20200
20244
  };
@@ -20202,20 +20246,14 @@ var QuestionMatrixBaseModel = /** @class */ (function (_super) {
20202
20246
  QuestionMatrixBaseModel.prototype.runConditionsForRows = function (properties) {
20203
20247
  var showInvisibile = !!this.survey && this.survey.areInvisibleElementsShowing;
20204
20248
  var runner = !showInvisibile ? this.createRowsVisibleIfRunner() : null;
20205
- this.filteredRows = [];
20206
- var hasChanged = _itemvalue__WEBPACK_IMPORTED_MODULE_0__.ItemValue.runConditionsForItems(this.rows, this.filteredRows, runner, properties, !showInvisibile);
20249
+ var hasChanged = _itemvalue__WEBPACK_IMPORTED_MODULE_0__.ItemValue.runConditionsForItems(this.rows, undefined, runner, properties, !showInvisibile);
20207
20250
  _itemvalue__WEBPACK_IMPORTED_MODULE_0__.ItemValue.runEnabledConditionsForItems(this.rows, undefined, properties);
20208
- if (this.filteredRows.length === this.rows.length) {
20209
- this.filteredRows = null;
20210
- if (!!this.generatedVisibleRows && this.generatedVisibleRows.length !== this.rows.length) {
20211
- this.generatedVisibleRows = null;
20212
- }
20213
- }
20214
20251
  return hasChanged;
20215
20252
  };
20216
20253
  QuestionMatrixBaseModel.prototype.runConditionsForColumns = function (properties) {
20217
20254
  var useColumnsExpression = !!this.survey && !this.survey.areInvisibleElementsShowing;
20218
- var runner = useColumnsExpression && !!this.columnsVisibleIf ? new _conditions__WEBPACK_IMPORTED_MODULE_3__.ConditionRunner(this.columnsVisibleIf) : null;
20255
+ var expression = this.getExpressionFromSurvey("columnsVisibleIf");
20256
+ var runner = useColumnsExpression && !!expression ? new _conditions__WEBPACK_IMPORTED_MODULE_3__.ConditionRunner(expression) : null;
20219
20257
  return _itemvalue__WEBPACK_IMPORTED_MODULE_0__.ItemValue.runConditionsForItems(this.columns, undefined, runner, properties, this.shouldRunColumnExpression());
20220
20258
  };
20221
20259
  QuestionMatrixBaseModel.prototype.clearInvisibleColumnValues = function () { };
@@ -27837,15 +27875,6 @@ var __extends = (undefined && undefined.__extends) || (function () {
27837
27875
 
27838
27876
 
27839
27877
 
27840
- var TriggerExpressionInfo = /** @class */ (function () {
27841
- function TriggerExpressionInfo(name, canRun, doComplete) {
27842
- this.name = name;
27843
- this.canRun = canRun;
27844
- this.doComplete = doComplete;
27845
- this.getSecondRunner = function () { return undefined; };
27846
- }
27847
- return TriggerExpressionInfo;
27848
- }());
27849
27878
  var QuestionValueGetterContext = /** @class */ (function () {
27850
27879
  function QuestionValueGetterContext(question, isUnwrapped) {
27851
27880
  this.question = question;
@@ -27976,6 +28005,7 @@ var Question = /** @class */ (function (_super) {
27976
28005
  var _this = _super.call(this, name) || this;
27977
28006
  _this.customWidgetData = { isNeedRender: true };
27978
28007
  _this.hasCssErrorCallback = function () { return false; };
28008
+ _this.triggersInfo = [];
27979
28009
  _this.isReadyValue = true;
27980
28010
  _this.dependedQuestions = [];
27981
28011
  /**
@@ -27991,7 +28021,6 @@ var Question = /** @class */ (function (_super) {
27991
28021
  * Indicates the previous ready state.
27992
28022
  */
27993
28023
  _this.onReadyChanged = _this.addEvent();
27994
- _this.triggersInfo = [];
27995
28024
  _this.isRunningValidatorsValue = false;
27996
28025
  _this.isValueChangedInSurvey = false;
27997
28026
  _this.allowNotifyValueChanged = true;
@@ -28009,13 +28038,7 @@ var Question = /** @class */ (function (_super) {
28009
28038
  _this.createLocalizableString("requiredErrorText", _this);
28010
28039
  _this.createLocalizableString("commentPlaceholder", _this);
28011
28040
  _this.createLocalizableString("defaultDisplayValue", _this);
28012
- _this.addTriggerInfo("resetValueIf", function () { return !_this.isEmpty(); }, function () {
28013
- _this.startSetValueOnExpression();
28014
- _this.updateValueWithDefaultsOrClear();
28015
- _this.finishSetValueOnExpression();
28016
- });
28017
- var setValueIfInfo = _this.addTriggerInfo("setValueIf", function () { return true; }, function () { return _this.runSetValueExpression(); });
28018
- setValueIfInfo.getSecondRunner = function () { return _this.getSetValueExpressionRunner(); };
28041
+ _this.addTriggersInfo();
28019
28042
  _this.registerPropertyChangedHandlers(["width"], function () {
28020
28043
  _this.updateQuestionCss();
28021
28044
  if (!!_this.parent) {
@@ -28607,63 +28630,15 @@ var Question = /** @class */ (function (_super) {
28607
28630
  requiredAnsweredQuestionCount: !this.isEmpty() && this.isRequired ? 1 : 0,
28608
28631
  };
28609
28632
  };
28610
- Question.prototype.ensureSetValueExpressionRunner = function () {
28633
+ Question.prototype.runTriggerInfo = function (info, keys, properties) {
28611
28634
  var _this = this;
28612
- if (!this.setValueExpressionRunner) {
28613
- this.setValueExpressionRunner = this.createExpressionRunner(this.setValueExpression);
28614
- this.setValueExpressionRunner.onRunComplete = function (res) {
28615
- _this.runExpressionSetValue(res);
28616
- };
28617
- }
28618
- else {
28619
- this.setValueExpressionRunner.expression = this.setValueExpression;
28620
- }
28621
- };
28622
- Question.prototype.runSetValueExpression = function () {
28623
- if (!this.setValueExpression) {
28624
- this.clearValue();
28625
- }
28626
- else {
28627
- this.ensureSetValueExpressionRunner();
28628
- this.setValueExpressionRunner.runContext(this.getValueGetterContext(), this.getDataFilteredProperties());
28629
- }
28630
- };
28631
- Question.prototype.getSetValueExpressionRunner = function () {
28632
- this.ensureSetValueExpressionRunner();
28633
- return this.setValueExpressionRunner;
28634
- };
28635
- Question.prototype.addTriggerInfo = function (name, canRun, doComplete) {
28636
- var info = new TriggerExpressionInfo(name, canRun, doComplete);
28637
- this.triggersInfo.push(info);
28638
- return info;
28639
- };
28640
- Question.prototype.runTriggerInfo = function (info, keys) {
28641
- var expression = this[info.name];
28642
- if (!expression && !info.getSecondRunner() || info.isRunning || !info.canRun()) {
28643
- return;
28644
- }
28645
- if (!info.runner) {
28646
- info.runner = this.createExpressionRunner(expression);
28647
- info.runner.onRunComplete = function (res) {
28648
- if (res === true) {
28649
- info.doComplete();
28650
- }
28651
- info.isRunning = false;
28652
- };
28653
- }
28654
- else {
28655
- info.runner.expression = expression;
28656
- }
28657
- if (!this.canExecuteTriggerByKeys(keys, info.runner, info.getSecondRunner()))
28658
- return;
28659
- info.isRunning = true;
28660
- if (!expression && info.getSecondRunner()) {
28661
- info.doComplete();
28662
- info.isRunning = false;
28663
- }
28664
- else {
28665
- info.runner.runContext(this.getValueGetterContext(), this.getDataFilteredProperties());
28666
- }
28635
+ this.runExpressionByProperty(info.name, properties, function (value) {
28636
+ info.doComplete(value, properties);
28637
+ }, function (runner) {
28638
+ if (!info.canRun())
28639
+ return false;
28640
+ return !keys || _this.canExecuteTriggerByKeys(keys, runner, _this.getExpressionByProperty(info.secondName));
28641
+ });
28667
28642
  };
28668
28643
  Question.prototype.canExecuteTriggerByKeys = function (keys, runner, secondRunner) {
28669
28644
  if (!runner && !!secondRunner) {
@@ -28692,6 +28667,48 @@ var Question = /** @class */ (function (_super) {
28692
28667
  Question.prototype.getValueGetterContext = function (isUnwrapped) {
28693
28668
  return new QuestionValueGetterContext(this, isUnwrapped);
28694
28669
  };
28670
+ Question.prototype.addTriggersInfo = function () {
28671
+ var _this = this;
28672
+ this.addTriggerInfo({
28673
+ name: "resetValueIf",
28674
+ canRun: function () { return !_this.isEmpty(); },
28675
+ doComplete: function (res, properties) {
28676
+ if (res === true) {
28677
+ _this.startSetValueOnExpression();
28678
+ _this.updateValueWithDefaultsOrClear();
28679
+ _this.finishSetValueOnExpression();
28680
+ }
28681
+ }
28682
+ });
28683
+ this.addTriggerInfo({
28684
+ name: "setValueIf",
28685
+ secondName: "setValueExpression",
28686
+ canRun: function () { return true; },
28687
+ doComplete: function (res, properties) {
28688
+ if (res) {
28689
+ if (!_this.setValueExpression) {
28690
+ _this.clearValue();
28691
+ }
28692
+ else {
28693
+ var info = {
28694
+ name: "setValueExpression",
28695
+ canRun: function () { return true; },
28696
+ doComplete: function (res, properties) { return _this.runExpressionSetValue(res); }
28697
+ };
28698
+ _this.runTriggerInfo(info, undefined, properties);
28699
+ }
28700
+ }
28701
+ }
28702
+ });
28703
+ this.addTriggerInfo({
28704
+ name: "setValueExpression",
28705
+ canRun: function () { return !_this.setValueIf; },
28706
+ doComplete: function (res, properties) { return _this.runExpressionSetValue(res); }
28707
+ });
28708
+ };
28709
+ Question.prototype.addTriggerInfo = function (info) {
28710
+ this.triggersInfo.push(info);
28711
+ };
28695
28712
  Question.prototype.runTriggers = function (name, value, keys) {
28696
28713
  var _this = this;
28697
28714
  if (this.isSettingQuestionValue || (this.parentQuestion && this.parentQuestion.getValueName() === name))
@@ -28700,8 +28717,9 @@ var Question = /** @class */ (function (_super) {
28700
28717
  keys = {};
28701
28718
  keys[name] = value;
28702
28719
  }
28720
+ var properties = this.getDataFilteredProperties();
28703
28721
  this.triggersInfo.forEach(function (info) {
28704
- _this.runTriggerInfo(info, keys);
28722
+ _this.runTriggerInfo(info, keys, properties);
28705
28723
  });
28706
28724
  };
28707
28725
  Question.prototype.runConditions = function () {
@@ -28839,7 +28857,7 @@ var Question = /** @class */ (function (_super) {
28839
28857
  this.resetSingleInputCore();
28840
28858
  };
28841
28859
  Question.prototype.resetSingleInputCore = function () {
28842
- var prev = this.singleInputQuestion;
28860
+ var prev = this.getPropertyValue("singleInputQuestion");
28843
28861
  this.resetPropertyValue("singleInputQuestion");
28844
28862
  if (!!prev) {
28845
28863
  this.onSingleInputChanged();
@@ -30285,8 +30303,7 @@ var Question = /** @class */ (function (_super) {
30285
30303
  properties["question"] = this;
30286
30304
  this.runConditionCore(properties);
30287
30305
  if (!this.isValueChangedDirectly && (!this.isClearValueOnHidden || this.isVisibleInSurvey)) {
30288
- this.defaultValueRunner = this.getDefaultRunner(this.defaultValueRunner, this.defaultValueExpression);
30289
- this.runDefaultValueExpression(this.defaultValueRunner, properties);
30306
+ this.runDefaultValueExpression(properties);
30290
30307
  }
30291
30308
  };
30292
30309
  Object.defineProperty(Question.prototype, "isInDesignMode", {
@@ -30929,15 +30946,6 @@ var Question = /** @class */ (function (_super) {
30929
30946
  Question.prototype.isDefaultValueEmpty = function () {
30930
30947
  return !this.defaultValueExpression && this.isValueEmpty(this.defaultValue, !this.allowSpaceAsAnswer);
30931
30948
  };
30932
- Question.prototype.getDefaultRunner = function (runner, expression) {
30933
- if (!runner && !!expression) {
30934
- runner = this.createExpressionRunner(expression);
30935
- }
30936
- if (!!runner) {
30937
- runner.expression = expression;
30938
- }
30939
- return runner;
30940
- };
30941
30949
  Question.prototype.setDefaultValue = function () {
30942
30950
  var _this = this;
30943
30951
  this.setDefaultValueCore(function (val) {
@@ -30950,9 +30958,14 @@ var Question = /** @class */ (function (_super) {
30950
30958
  Question.prototype.setDefaultIntoValue = function (val) {
30951
30959
  this.value = val;
30952
30960
  };
30953
- Question.prototype.setDefaultValueCore = function (func) {
30954
- this.defaultValueRunner = this.getDefaultRunner(this.defaultValueRunner, this.defaultValueExpression);
30955
- this.setValueAndRunExpression(this.defaultValueRunner, this.getUnbindValue(this.defaultValue), function (val) { return func(val); });
30961
+ Question.prototype.setDefaultValueCore = function (setFunc) {
30962
+ var _this = this;
30963
+ var func = function (val) {
30964
+ _this.runExpressionSetValueCore(val, setFunc);
30965
+ };
30966
+ if (!this.runDefaultValueExpression(undefined, func)) {
30967
+ func(this.getUnbindValue(this.defaultValue));
30968
+ }
30956
30969
  };
30957
30970
  Question.prototype.updateValueWithDefaultsOrClear = function () {
30958
30971
  if (this.isDesignMode || this.isLoadingFromJson)
@@ -30967,16 +30980,6 @@ var Question = /** @class */ (function (_super) {
30967
30980
  Question.prototype.isValueExpression = function (val) {
30968
30981
  return !!val && typeof val == "string" && val.length > 0 && val[0] == "=";
30969
30982
  };
30970
- Question.prototype.setValueAndRunExpression = function (runner, defaultValue, setFunc, properties) {
30971
- var _this = this;
30972
- if (properties === void 0) { properties = null; }
30973
- var func = function (val) {
30974
- _this.runExpressionSetValueCore(val, setFunc);
30975
- };
30976
- if (!this.runDefaultValueExpression(runner, properties, func)) {
30977
- func(defaultValue);
30978
- }
30979
- };
30980
30983
  Question.prototype.convertFuncValuetoQuestionValue = function (val) {
30981
30984
  return _helpers__WEBPACK_IMPORTED_MODULE_0__.Helpers.convertValToQuestionVal(val);
30982
30985
  };
@@ -31001,10 +31004,10 @@ var Question = /** @class */ (function (_super) {
31001
31004
  var _a;
31002
31005
  (_a = this.survey) === null || _a === void 0 ? void 0 : _a.finishSetValueOnExpression();
31003
31006
  };
31004
- Question.prototype.runDefaultValueExpression = function (runner, properties, setFunc) {
31007
+ Question.prototype.runDefaultValueExpression = function (properties, setFunc) {
31005
31008
  var _this = this;
31006
31009
  if (properties === void 0) { properties = null; }
31007
- if (!runner || !this.data)
31010
+ if (!this.data)
31008
31011
  return false;
31009
31012
  if (!setFunc) {
31010
31013
  setFunc = function (val) {
@@ -31015,17 +31018,13 @@ var Question = /** @class */ (function (_super) {
31015
31018
  properties = this.defaultValueExpression ? this.data.getFilteredProperties() : {};
31016
31019
  properties["question"] = this;
31017
31020
  }
31018
- if (!!runner && runner.canRun) {
31019
- runner.onRunComplete = function (res) {
31020
- if (res == undefined)
31021
- res = _this.defaultValue;
31022
- _this.isChangingViaDefaultValue = true;
31023
- setFunc(res);
31024
- _this.isChangingViaDefaultValue = false;
31025
- };
31026
- runner.runContext(this.getValueGetterContext(), properties);
31027
- }
31028
- return true;
31021
+ return this.runExpressionByProperty("defaultValueExpression", properties, function (res) {
31022
+ if (res == undefined)
31023
+ res = _this.defaultValue;
31024
+ _this.isChangingViaDefaultValue = true;
31025
+ setFunc(res);
31026
+ _this.isChangingViaDefaultValue = false;
31027
+ });
31029
31028
  };
31030
31029
  Object.defineProperty(Question.prototype, "comment", {
31031
31030
  /**
@@ -33172,22 +33171,24 @@ var QuestionSelectBase = /** @class */ (function (_super) {
33172
33171
  return [];
33173
33172
  };
33174
33173
  QuestionSelectBase.prototype.setConditionalChoicesRunner = function () {
33175
- if (this.choicesVisibleIf) {
33174
+ var expression = this.getExpressionFromSurvey("choicesVisibleIf");
33175
+ if (expression) {
33176
33176
  if (!this.conditionChoicesVisibleIfRunner) {
33177
- this.conditionChoicesVisibleIfRunner = new _conditions__WEBPACK_IMPORTED_MODULE_8__.ConditionRunner(this.choicesVisibleIf);
33177
+ this.conditionChoicesVisibleIfRunner = new _conditions__WEBPACK_IMPORTED_MODULE_8__.ConditionRunner(expression);
33178
33178
  }
33179
- this.conditionChoicesVisibleIfRunner.expression = this.choicesVisibleIf;
33179
+ this.conditionChoicesVisibleIfRunner.expression = expression;
33180
33180
  }
33181
33181
  else {
33182
33182
  this.conditionChoicesVisibleIfRunner = null;
33183
33183
  }
33184
33184
  };
33185
33185
  QuestionSelectBase.prototype.setConditionalEnableChoicesRunner = function () {
33186
- if (this.choicesEnableIf) {
33186
+ var expression = this.getExpressionFromSurvey("choicesEnableIf");
33187
+ if (expression) {
33187
33188
  if (!this.conditionChoicesEnableIfRunner) {
33188
- this.conditionChoicesEnableIfRunner = new _conditions__WEBPACK_IMPORTED_MODULE_8__.ConditionRunner(this.choicesEnableIf);
33189
+ this.conditionChoicesEnableIfRunner = new _conditions__WEBPACK_IMPORTED_MODULE_8__.ConditionRunner(expression);
33189
33190
  }
33190
- this.conditionChoicesEnableIfRunner.expression = this.choicesEnableIf;
33191
+ this.conditionChoicesEnableIfRunner.expression = expression;
33191
33192
  }
33192
33193
  else {
33193
33194
  this.conditionChoicesEnableIfRunner = null;
@@ -34346,10 +34347,10 @@ var QuestionSelectBase = /** @class */ (function (_super) {
34346
34347
  }
34347
34348
  };
34348
34349
  QuestionSelectBase.prototype.getStoreOthersAsComment = function () {
34349
- if (this.checkHasChoicesComments())
34350
- return true;
34351
34350
  if (this.showCommentArea)
34352
34351
  return false;
34352
+ if (this.checkHasChoicesComments())
34353
+ return true;
34353
34354
  return (this.storeOthersAsComment === true ||
34354
34355
  (this.storeOthersAsComment == "default" &&
34355
34356
  (this.survey != null ? this.survey.storeOthersAsComment : true)) ||
@@ -37797,11 +37798,24 @@ var QuestionCustomModelBase = /** @class */ (function (_super) {
37797
37798
  this.initElement(this.getElement());
37798
37799
  this.isSettingValOnLoading = false;
37799
37800
  };
37801
+ QuestionCustomModelBase.prototype.onCustomQuestionLoaded = function () {
37802
+ if (!this.isLoadedCalled && !!this.customQuestion && !!this.survey) {
37803
+ this.customQuestion.onLoaded(this);
37804
+ this.isLoadedCalled = true;
37805
+ }
37806
+ };
37800
37807
  QuestionCustomModelBase.prototype.onSurveyLoad = function () {
37801
37808
  _super.prototype.onSurveyLoad.call(this);
37809
+ this.isLoadedCalled = false;
37802
37810
  if (!!this.getElement()) {
37803
37811
  this.getElement().onSurveyLoad();
37804
- this.customQuestion.onLoaded(this);
37812
+ }
37813
+ this.onCustomQuestionLoaded();
37814
+ };
37815
+ QuestionCustomModelBase.prototype.setSurveyCore = function (value) {
37816
+ _super.prototype.setSurveyCore.call(this, value);
37817
+ if (this.isLoadedCalled === false && value) {
37818
+ this.onCustomQuestionLoaded();
37805
37819
  }
37806
37820
  };
37807
37821
  QuestionCustomModelBase.prototype.afterRenderQuestionElement = function (el) {
@@ -39339,11 +39353,6 @@ var QuestionExpressionModel = /** @class */ (function (_super) {
39339
39353
  function QuestionExpressionModel(name) {
39340
39354
  var _this = _super.call(this, name) || this;
39341
39355
  _this.createLocalizableString("format", _this);
39342
- _this.registerPropertyChangedHandlers(["expression"], function () {
39343
- if (_this.expressionRunner) {
39344
- _this.expressionRunner = _this.createRunner();
39345
- }
39346
- });
39347
39356
  _this.registerPropertyChangedHandlers(["format", "currency", "displayStyle"], function () {
39348
39357
  _this.updateFormatedValue();
39349
39358
  });
@@ -39398,22 +39407,19 @@ var QuestionExpressionModel = /** @class */ (function (_super) {
39398
39407
  configurable: true
39399
39408
  });
39400
39409
  QuestionExpressionModel.prototype.locCalculation = function () {
39401
- this.expressionIsRunning = true;
39410
+ this.isExecutionLocked = true;
39402
39411
  };
39403
39412
  QuestionExpressionModel.prototype.unlocCalculation = function () {
39404
- this.expressionIsRunning = false;
39413
+ this.isExecutionLocked = false;
39405
39414
  };
39406
39415
  QuestionExpressionModel.prototype.runConditionCore = function (properties) {
39416
+ var _this = this;
39407
39417
  _super.prototype.runConditionCore.call(this, properties);
39408
- if (!this.expression ||
39409
- this.expressionIsRunning ||
39410
- (!this.runIfReadOnly && this.isReadOnly))
39418
+ if (this.isExecutionLocked || !this.runIfReadOnly && this.isReadOnly)
39411
39419
  return;
39412
- this.locCalculation();
39413
- if (!this.expressionRunner) {
39414
- this.expressionRunner = this.createRunner();
39415
- }
39416
- this.expressionRunner.runContext(this.getValueGetterContext(), properties);
39420
+ this.runExpressionByProperty("expression", properties, function (val) {
39421
+ _this.value = _this.roundValue(val);
39422
+ });
39417
39423
  };
39418
39424
  QuestionExpressionModel.prototype.canCollectErrors = function () {
39419
39425
  return true;
@@ -39421,15 +39427,6 @@ var QuestionExpressionModel = /** @class */ (function (_super) {
39421
39427
  QuestionExpressionModel.prototype.hasRequiredError = function () {
39422
39428
  return false;
39423
39429
  };
39424
- QuestionExpressionModel.prototype.createRunner = function () {
39425
- var _this = this;
39426
- var res = this.createExpressionRunner(this.expression);
39427
- res.onRunComplete = function (newValue) {
39428
- _this.value = _this.roundValue(newValue);
39429
- _this.unlocCalculation();
39430
- };
39431
- return res;
39432
- };
39433
39430
  Object.defineProperty(QuestionExpressionModel.prototype, "maximumFractionDigits", {
39434
39431
  /**
39435
39432
  * 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.
@@ -42628,6 +42625,11 @@ var MatrixRowModel = /** @class */ (function (_super) {
42628
42625
  enumerable: false,
42629
42626
  configurable: true
42630
42627
  });
42628
+ Object.defineProperty(MatrixRowModel.prototype, "isVisible", {
42629
+ get: function () { return this.item.isVisible; },
42630
+ enumerable: false,
42631
+ configurable: true
42632
+ });
42631
42633
  Object.defineProperty(MatrixRowModel.prototype, "value", {
42632
42634
  get: function () {
42633
42635
  return this.getPropertyValue("value");
@@ -42909,7 +42911,7 @@ var MatrixValueGetterContext = /** @class */ (function (_super) {
42909
42911
  MatrixValueGetterContext.prototype.getRootObj = function () { return this.question.data; };
42910
42912
  MatrixValueGetterContext.prototype.updateValueByItem = function (name, res) {
42911
42913
  var _a;
42912
- var rows = this.question.visibleRows;
42914
+ var rows = this.question.getMatrixRows();
42913
42915
  name = name.toLocaleLowerCase();
42914
42916
  for (var i = 0; i < rows.length; i++) {
42915
42917
  var row = rows[i];
@@ -43238,20 +43240,21 @@ var QuestionMatrixModel = /** @class */ (function (_super) {
43238
43240
  _super.prototype.runConditionCore.call(this, properties);
43239
43241
  };
43240
43242
  QuestionMatrixModel.prototype.createRowsVisibleIfRunner = function () {
43241
- return !!this.rowsVisibleIf ? new _conditions__WEBPACK_IMPORTED_MODULE_12__.ConditionRunner(this.rowsVisibleIf) : null;
43243
+ var expression = this.getExpressionFromSurvey("rowsVisibleIf");
43244
+ return !!expression ? new _conditions__WEBPACK_IMPORTED_MODULE_12__.ConditionRunner(expression) : null;
43242
43245
  };
43243
43246
  QuestionMatrixModel.prototype.onRowsChanged = function () {
43244
43247
  this.clearGeneratedRows();
43245
43248
  _super.prototype.onRowsChanged.call(this);
43246
43249
  };
43247
- QuestionMatrixModel.prototype.getVisibleRows = function () {
43250
+ QuestionMatrixModel.prototype.getMatrixRows = function () {
43248
43251
  if (!!this.generatedVisibleRows)
43249
43252
  return this.generatedVisibleRows;
43250
43253
  var result = new Array();
43251
43254
  var val = this.value;
43252
43255
  if (!val)
43253
43256
  val = {};
43254
- var rows = this.filteredRows || this.rows;
43257
+ var rows = this.rows;
43255
43258
  for (var i = 0; i < rows.length; i++) {
43256
43259
  var row = rows[i];
43257
43260
  if (this.isValueEmpty(row.value))
@@ -43262,6 +43265,15 @@ var QuestionMatrixModel = /** @class */ (function (_super) {
43262
43265
  this.generatedVisibleRows = result;
43263
43266
  return result;
43264
43267
  };
43268
+ QuestionMatrixModel.prototype.getVisibleRows = function () {
43269
+ var rows = [];
43270
+ this.getMatrixRows().forEach(function (row) {
43271
+ if (row.isVisible) {
43272
+ rows.push(row);
43273
+ }
43274
+ });
43275
+ return rows;
43276
+ };
43265
43277
  QuestionMatrixModel.prototype.getRowByName = function (name) {
43266
43278
  var rows = this.visibleRows;
43267
43279
  for (var i = 0; i < rows.length; i++) {
@@ -44398,6 +44410,9 @@ var MatrixRowGetterContext = /** @class */ (function (_super) {
44398
44410
  if (name === setVar.rowIndex.toLocaleLowerCase()) {
44399
44411
  return this.row.rowIndex;
44400
44412
  }
44413
+ if (name === setVar.visibleRowIndex.toLocaleLowerCase()) {
44414
+ return this.getQuestionData().visibleRows.indexOf(this.row) + 1;
44415
+ }
44401
44416
  if ([setVar.item, setVar.rowName.toLocaleLowerCase(), setVar.rowValue.toLocaleLowerCase()].indexOf(name) > -1) {
44402
44417
  return this.row.rowName;
44403
44418
  }
@@ -45948,23 +45963,24 @@ var QuestionMatrixDropdownModelBase = /** @class */ (function (_super) {
45948
45963
  QuestionMatrixDropdownModelBase.prototype.runCellsCondition = function (properties) {
45949
45964
  if (this.isDesignMode)
45950
45965
  return;
45966
+ var rowsVisibleIf = this.getExpressionFromSurvey("rowsVisibleIf");
45951
45967
  var rows = this.generatedVisibleRows;
45952
45968
  if (!!rows) {
45953
45969
  for (var i = 0; i < rows.length; i++) {
45954
- rows[i].runCondition(properties, this.rowsVisibleIf);
45970
+ rows[i].runCondition(properties, rowsVisibleIf);
45955
45971
  }
45956
45972
  }
45957
45973
  this.checkColumnsVisibility();
45958
45974
  this.checkColumnsRenderedRequired();
45959
45975
  };
45960
45976
  QuestionMatrixDropdownModelBase.prototype.runConditionsForColumns = function (properties) {
45961
- var _this = this;
45977
+ var expression = this.getExpressionFromSurvey("columnsVisibleIf");
45962
45978
  this.columns.forEach(function (column) {
45963
- if (!_this.columnsVisibleIf) {
45979
+ if (!expression) {
45964
45980
  column.isColumnsVisibleIf = true;
45965
45981
  }
45966
45982
  else {
45967
- var condition = new _conditions__WEBPACK_IMPORTED_MODULE_15__.ConditionRunner(_this.columnsVisibleIf);
45983
+ var condition = new _conditions__WEBPACK_IMPORTED_MODULE_15__.ConditionRunner(expression);
45968
45984
  column.isColumnsVisibleIf = condition.runContext(column.getValueGetterContext(), properties) === true;
45969
45985
  }
45970
45986
  });
@@ -46178,6 +46194,7 @@ var QuestionMatrixDropdownModelBase = /** @class */ (function (_super) {
46178
46194
  * The template can contain the following placeholders:
46179
46195
  *
46180
46196
  * - `{rowIndex}` - A row index within the collection of all rows. Starts with 1.
46197
+ * - `{visibleRowIndex}` - A row index within the collection of visible rows. Starts with 1.
46181
46198
  * - `{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.
46182
46199
  * - `{rowTitle}` - A row title (the `text` property within objects in the `rows` array).
46183
46200
  * - `{row.columnname}` - The value of a cell in the same row.
@@ -47202,7 +47219,7 @@ var QuestionMatrixDropdownModelBase = /** @class */ (function (_super) {
47202
47219
  }
47203
47220
  };
47204
47221
  QuestionMatrixDropdownModelBase.prototype.isRowsFiltered = function () {
47205
- return _super.prototype.isRowsFiltered.call(this) || (this.visibleRows !== this.generatedVisibleRows);
47222
+ return this.visibleRows !== this.generatedVisibleRows;
47206
47223
  };
47207
47224
  QuestionMatrixDropdownModelBase.prototype.getQuestionFromArray = function (name, index) {
47208
47225
  if (index >= this.visibleRows.length)
@@ -47277,7 +47294,9 @@ var QuestionMatrixDropdownModelBase = /** @class */ (function (_super) {
47277
47294
  _jsonobject__WEBPACK_IMPORTED_MODULE_0__.Serializer.addClass("matrixdropdownbase", [
47278
47295
  {
47279
47296
  name: "columns:matrixdropdowncolumns",
47280
- className: "matrixdropdowncolumn", isArray: true
47297
+ uniqueProperty: "name",
47298
+ className: "matrixdropdowncolumn",
47299
+ isArray: true
47281
47300
  },
47282
47301
  {
47283
47302
  name: "columnLayout",
@@ -54590,14 +54609,12 @@ var QuestionPanelDynamicModel = /** @class */ (function (_super) {
54590
54609
  return;
54591
54610
  this.prepareValueForPanelCreating();
54592
54611
  var panels = [];
54593
- var panel;
54594
54612
  if (this.useTemplatePanel) {
54595
- panel = new QuestionPanelDynamicItem(this, this.template);
54613
+ new QuestionPanelDynamicItem(this, this.template);
54596
54614
  panels.push(this.template);
54597
54615
  }
54598
54616
  else {
54599
54617
  for (var i = 0; i < this.panelCount; i++) {
54600
- panel = this.createNewPanel();
54601
54618
  panels.push(this.createNewPanel());
54602
54619
  }
54603
54620
  }
@@ -55440,14 +55457,8 @@ var QuestionPanelDynamicModel = /** @class */ (function (_super) {
55440
55457
  new _jsonobject__WEBPACK_IMPORTED_MODULE_5__.JsonObject().toObject(json, panel);
55441
55458
  panel.renderWidth = "100%";
55442
55459
  panel.updateCustomWidgets();
55460
+ panel.questions.forEach(function (q) { return q.setParentQuestion(_this); });
55443
55461
  new QuestionPanelDynamicItem(this, panel);
55444
- if (!this.isDesignMode && !this.isReadOnly && !this.isValueEmpty(panel.getValue())) {
55445
- this.runPanelsCondition([panel], this.getDataFilteredProperties());
55446
- }
55447
- var questions = panel.questions;
55448
- for (var i = 0; i < questions.length; i++) {
55449
- questions[i].setParentQuestion(this);
55450
- }
55451
55462
  if (this.wasRendered) {
55452
55463
  panel.onFirstRendering();
55453
55464
  panel.locStrsChanged();
@@ -59833,24 +59844,13 @@ var QuestionSliderModel = /** @class */ (function (_super) {
59833
59844
  QuestionSliderModel.prototype.runConditionCore = function (properties) {
59834
59845
  var _this = this;
59835
59846
  _super.prototype.runConditionCore.call(this, properties);
59836
- this.runMinMaxCondition(this.maxValueExpression, properties, function (value) {
59847
+ this.runExpressionByProperty("maxValueExpression", properties, function (value) {
59837
59848
  _this.max = value !== null && value !== void 0 ? value : _this.renderedMax;
59838
59849
  });
59839
- this.runMinMaxCondition(this.minValueExpression, properties, function (value) {
59850
+ this.runExpressionByProperty("minValueExpression", properties, function (value) {
59840
59851
  _this.min = value !== null && value !== void 0 ? value : _this.renderedMin;
59841
59852
  });
59842
59853
  };
59843
- QuestionSliderModel.prototype.runMinMaxCondition = function (expression, properties, setter) {
59844
- if (!expression)
59845
- return;
59846
- var runner = this.getDefaultRunner(this.defaultExpressionRunner, expression);
59847
- if (!!runner && runner.canRun) {
59848
- runner.onRunComplete = function (res) {
59849
- setter(res);
59850
- };
59851
- runner.runContext(this.getValueGetterContext(), properties);
59852
- }
59853
- };
59854
59854
  QuestionSliderModel.prototype.initPropertyDependencies = function () {
59855
59855
  var _this = this;
59856
59856
  // this.registerSychProperties(["segmentCount"],
@@ -61200,20 +61200,31 @@ var QuestionTextModel = /** @class */ (function (_super) {
61200
61200
  QuestionTextModel.prototype.setRenderedMinMax = function (properties) {
61201
61201
  var _this = this;
61202
61202
  if (properties === void 0) { properties = null; }
61203
- this.minValueRunner = this.getDefaultRunner(this.minValueRunner, this.minValueExpression);
61204
- this.setValueAndRunExpression(this.minValueRunner, this.min, function (val) {
61203
+ var setProp = function (name, val) {
61204
+ _this.setPropertyValue(name, _this.convertFuncValuetoQuestionValue(val));
61205
+ };
61206
+ var setMin = function (val) {
61205
61207
  if (!val && _this.isDateInputType && !!_settings__WEBPACK_IMPORTED_MODULE_6__.settings.minDate) {
61206
61208
  val = _settings__WEBPACK_IMPORTED_MODULE_6__.settings.minDate;
61207
61209
  }
61208
- _this.setPropertyValue("renderedMin", val);
61209
- }, properties);
61210
- this.maxValueRunner = this.getDefaultRunner(this.maxValueRunner, this.maxValueExpression);
61211
- this.setValueAndRunExpression(this.maxValueRunner, this.max, function (val) {
61210
+ setProp("renderedMin", val);
61211
+ };
61212
+ var setMax = function (val) {
61212
61213
  if (!val && _this.isDateInputType) {
61213
61214
  val = !!_settings__WEBPACK_IMPORTED_MODULE_6__.settings.maxDate ? _settings__WEBPACK_IMPORTED_MODULE_6__.settings.maxDate : "2999-12-31";
61214
61215
  }
61215
- _this.setPropertyValue("renderedMax", val);
61216
- }, properties);
61216
+ setProp("renderedMax", val);
61217
+ };
61218
+ if (!this.runExpressionByProperty("minValueExpression", properties, function (val) {
61219
+ setMin(val);
61220
+ })) {
61221
+ setMin(this.min);
61222
+ }
61223
+ if (!this.runExpressionByProperty("maxValueExpression", properties, function (val) {
61224
+ setMax(val);
61225
+ })) {
61226
+ setMax(this.max);
61227
+ }
61217
61228
  };
61218
61229
  Object.defineProperty(QuestionTextModel.prototype, "step", {
61219
61230
  /**
@@ -62799,6 +62810,7 @@ var settings = {
62799
62810
  row: "row",
62800
62811
  totalRow: "totalRow",
62801
62812
  rowIndex: "rowIndex",
62813
+ visibleRowIndex: "visibleRowIndex",
62802
62814
  rowValue: "rowValue",
62803
62815
  rowName: "rowName",
62804
62816
  rowTitle: "rowTitle",
@@ -65677,6 +65689,10 @@ var SurveyModel = /** @class */ (function (_super) {
65677
65689
  */
65678
65690
  _this.onDragDropAllow = _this.addEvent();
65679
65691
  _this.onMatrixRowDragOver = _this.addEvent();
65692
+ /**
65693
+ * 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.
65694
+ */
65695
+ _this.onExpressionRunning = _this.addEvent();
65680
65696
  /**
65681
65697
  * An event this is raised before a survey element (usually page) is scrolled to the top. Use this event to cancel the scroll operation.
65682
65698
  */
@@ -67744,6 +67760,11 @@ var SurveyModel = /** @class */ (function (_super) {
67744
67760
  };
67745
67761
  return exp.runContext(this.getValueGetterContext(), properties) || onCompleteRes;
67746
67762
  };
67763
+ SurveyModel.prototype.beforeExpressionRunning = function (obj, propertyName, expression) {
67764
+ var opt = { element: obj, propertyName: propertyName, expression: expression, allow: true };
67765
+ this.onExpressionRunning.fire(this, opt);
67766
+ return opt.allow ? opt.expression : "";
67767
+ };
67747
67768
  Object.defineProperty(SurveyModel.prototype, "isSettingValueOnExpression", {
67748
67769
  get: function () { return this.setValueOnExpressionCounter > 0; },
67749
67770
  enumerable: false,
@@ -74578,8 +74599,8 @@ _jsonobject__WEBPACK_IMPORTED_MODULE_1__.Serializer.addClass("survey", [
74578
74599
  dependsOn: ["showTOC"],
74579
74600
  visibleIf: function (survey) { return !!survey && survey.showTOC; }
74580
74601
  },
74581
- { name: "readOnly:boolean", default: false },
74582
- { name: "mode", default: "edit", choices: ["edit", "display"], visible: false },
74602
+ { name: "readOnly:boolean" },
74603
+ { name: "mode", visible: false, isSerializable: false },
74583
74604
  { name: "storeOthersAsComment:boolean", default: true },
74584
74605
  { name: "maxTextLength:number", default: 0, minValue: 0 },
74585
74606
  { name: "maxCommentLength:number", default: 0, minValue: 0, alternativeName: "maxOthersLength" },
@@ -75818,10 +75839,9 @@ __webpack_require__.r(__webpack_exports__);
75818
75839
  /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts");
75819
75840
  /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./base */ "./src/base.ts");
75820
75841
  /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts");
75821
- /* harmony import */ var _conditions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./conditions */ "./src/conditions.ts");
75822
- /* harmony import */ var _expressions_expressions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./expressions/expressions */ "./src/expressions/expressions.ts");
75823
- /* harmony import */ var _conditionProcessValue__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./conditionProcessValue */ "./src/conditionProcessValue.ts");
75824
- /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./settings */ "./src/settings.ts");
75842
+ /* harmony import */ var _expressions_expressions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./expressions/expressions */ "./src/expressions/expressions.ts");
75843
+ /* harmony import */ var _conditionProcessValue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./conditionProcessValue */ "./src/conditionProcessValue.ts");
75844
+ /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./settings */ "./src/settings.ts");
75825
75845
  var __extends = (undefined && undefined.__extends) || (function () {
75826
75846
  var extendStatics = function (d, b) {
75827
75847
  extendStatics = Object.setPrototypeOf ||
@@ -75843,7 +75863,6 @@ var __extends = (undefined && undefined.__extends) || (function () {
75843
75863
 
75844
75864
 
75845
75865
 
75846
-
75847
75866
  /**
75848
75867
  * A base class for all triggers.
75849
75868
  * A trigger calls a method when the expression change the result: from false to true or from true to false.
@@ -75854,10 +75873,6 @@ var Trigger = /** @class */ (function (_super) {
75854
75873
  function Trigger() {
75855
75874
  var _this = _super.call(this) || this;
75856
75875
  _this.idValue = (Trigger.idCounter++);
75857
- _this.registerPropertyChangedHandlers(["operator", "value", "name"], function () {
75858
- _this.oldPropertiesChanged();
75859
- });
75860
- _this.registerPropertyChangedHandlers(["expression"], function () { _this.onExpressionChanged(); });
75861
75876
  return _this;
75862
75877
  }
75863
75878
  Object.defineProperty(Trigger, "operators", {
@@ -75911,7 +75926,7 @@ var Trigger = /** @class */ (function (_super) {
75911
75926
  };
75912
75927
  Trigger.prototype.toString = function () {
75913
75928
  var res = this.getType().replace("trigger", "");
75914
- var exp = !!this.expression ? this.expression : this.buildExpression();
75929
+ var exp = this.expression;
75915
75930
  if (exp) {
75916
75931
  res += ", " + exp;
75917
75932
  }
@@ -75961,7 +75976,7 @@ var Trigger = /** @class */ (function (_super) {
75961
75976
  });
75962
75977
  Object.defineProperty(Trigger.prototype, "expression", {
75963
75978
  get: function () {
75964
- return this.getPropertyValue("expression", "");
75979
+ return this.getPropertyValue("expression", this.buildExpression());
75965
75980
  },
75966
75981
  set: function (val) {
75967
75982
  this.setPropertyValue("expression", val);
@@ -75976,23 +75991,24 @@ var Trigger = /** @class */ (function (_super) {
75976
75991
  return false;
75977
75992
  };
75978
75993
  Trigger.prototype.checkExpression = function (options) {
75994
+ var _this = this;
75979
75995
  this.isExecutingOnNextPage = options.isOnNextPage;
75980
75996
  this.isExecutingOnNavigation = options.isOnNavigation || options.isOnNextPage;
75981
75997
  if (!this.canBeExecuted(options.isOnNextPage))
75982
75998
  return;
75983
75999
  if (options.isOnComplete && !this.canBeExecutedOnComplete())
75984
76000
  return;
75985
- if (!this.isCheckRequired(options.keys))
75986
- return;
75987
76001
  var keys = Object.keys(options.keys);
75988
76002
  if (Array.isArray(keys) && !this.canBeExecuteOnKeysChange(keys))
75989
76003
  return;
75990
- if (!!this.conditionRunner) {
75991
- this.perform(options.properties || null);
75992
- }
75993
- else {
75994
- if (this.canSuccessOnEmptyExpression()) {
75995
- this.triggerResult(true, options.properties || null);
76004
+ var props = options.properties || null;
76005
+ if (!this.runExpressionByProperty("expression", props, function (val) {
76006
+ _this.triggerResult(val === true, props);
76007
+ }, function (runner) {
76008
+ return _this.isCheckRequired(runner, options.keys);
76009
+ })) {
76010
+ if (this.isCheckRequired(null, options.keys) && this.canSuccessOnEmptyExpression()) {
76011
+ this.triggerResult(true, props);
75996
76012
  }
75997
76013
  }
75998
76014
  };
@@ -76014,13 +76030,6 @@ var Trigger = /** @class */ (function (_super) {
76014
76030
  enumerable: false,
76015
76031
  configurable: true
76016
76032
  });
76017
- Trigger.prototype.perform = function (properties) {
76018
- var _this = this;
76019
- this.conditionRunner.onRunComplete = function (res) {
76020
- _this.triggerResult(res, properties);
76021
- };
76022
- this.conditionRunner.runContext(this.getValueGetterContext(), properties);
76023
- };
76024
76033
  Trigger.prototype.triggerResult = function (res, properties) {
76025
76034
  if (res) {
76026
76035
  this.onSuccess(properties);
@@ -76033,16 +76042,6 @@ var Trigger = /** @class */ (function (_super) {
76033
76042
  Trigger.prototype.onSuccess = function (properties) { };
76034
76043
  Trigger.prototype.onFailure = function () { };
76035
76044
  Trigger.prototype.onSuccessExecuted = function () { };
76036
- Trigger.prototype.endLoadingFromJson = function () {
76037
- _super.prototype.endLoadingFromJson.call(this);
76038
- this.oldPropertiesChanged();
76039
- };
76040
- Trigger.prototype.oldPropertiesChanged = function () {
76041
- this.onExpressionChanged();
76042
- };
76043
- Trigger.prototype.onExpressionChanged = function () {
76044
- this.conditionRunner = null;
76045
- };
76046
76045
  Trigger.prototype.buildExpression = function () {
76047
76046
  if (!this.name)
76048
76047
  return "";
@@ -76053,22 +76052,21 @@ var Trigger = /** @class */ (function (_super) {
76053
76052
  "} " +
76054
76053
  this.operator +
76055
76054
  " " +
76056
- _expressions_expressions__WEBPACK_IMPORTED_MODULE_4__.OperandMaker.toOperandString(this.value));
76055
+ _expressions_expressions__WEBPACK_IMPORTED_MODULE_3__.OperandMaker.toOperandString(this.value));
76057
76056
  };
76058
- Trigger.prototype.isCheckRequired = function (keys) {
76057
+ Trigger.prototype.isCheckRequired = function (runner, keys) {
76059
76058
  if (!keys)
76060
76059
  return false;
76061
- this.createConditionRunner();
76062
- if (this.conditionRunner && this.conditionRunner.hasFunction() === true)
76060
+ if ((runner === null || runner === void 0 ? void 0 : runner.hasFunction()) === true)
76063
76061
  return true;
76064
- return new _conditionProcessValue__WEBPACK_IMPORTED_MODULE_5__.ValueGetter().isAnyKeyChanged(keys, this.getUsedVariables());
76062
+ return new _conditionProcessValue__WEBPACK_IMPORTED_MODULE_4__.ValueGetter().isAnyKeyChanged(keys, this.getUsedVariables(runner));
76065
76063
  };
76066
- Trigger.prototype.getUsedVariables = function () {
76067
- if (!this.conditionRunner)
76064
+ Trigger.prototype.getUsedVariables = function (runner) {
76065
+ if (!runner)
76068
76066
  return [];
76069
- var res = this.conditionRunner.getVariables();
76067
+ var res = runner.getVariables();
76070
76068
  if (Array.isArray(res)) {
76071
- var unw = _settings__WEBPACK_IMPORTED_MODULE_6__.settings.expressionVariables.unwrapPostfix;
76069
+ var unw = _settings__WEBPACK_IMPORTED_MODULE_5__.settings.expressionVariables.unwrapPostfix;
76072
76070
  for (var i = res.length - 1; i >= 0; i--) {
76073
76071
  var s = res[i];
76074
76072
  if (s.endsWith(unw)) {
@@ -76078,17 +76076,6 @@ var Trigger = /** @class */ (function (_super) {
76078
76076
  }
76079
76077
  return res;
76080
76078
  };
76081
- Trigger.prototype.createConditionRunner = function () {
76082
- if (!!this.conditionRunner)
76083
- return;
76084
- var expression = this.expression;
76085
- if (!expression) {
76086
- expression = this.buildExpression();
76087
- }
76088
- if (!expression)
76089
- return;
76090
- this.conditionRunner = new _conditions__WEBPACK_IMPORTED_MODULE_3__.ConditionRunner(expression);
76091
- };
76092
76079
  Object.defineProperty(Trigger.prototype, "isRequireValue", {
76093
76080
  get: function () {
76094
76081
  return this.operator !== "empty" && this.operator != "notempty";
@@ -76193,7 +76180,7 @@ var SurveyTriggerComplete = /** @class */ (function (_super) {
76193
76180
  configurable: true
76194
76181
  });
76195
76182
  SurveyTriggerComplete.prototype.isRealExecution = function () {
76196
- return !_settings__WEBPACK_IMPORTED_MODULE_6__.settings.triggers.executeCompleteOnValueChanged === this.isExecutingOnNavigation;
76183
+ return !_settings__WEBPACK_IMPORTED_MODULE_5__.settings.triggers.executeCompleteOnValueChanged === this.isExecutingOnNavigation;
76197
76184
  };
76198
76185
  SurveyTriggerComplete.prototype.onSuccess = function (properties) {
76199
76186
  if (!this.owner)
@@ -76304,7 +76291,7 @@ var SurveyTriggerSkip = /** @class */ (function (_super) {
76304
76291
  configurable: true
76305
76292
  });
76306
76293
  SurveyTriggerSkip.prototype.canBeExecuted = function (isOnNextPage) {
76307
- return isOnNextPage === !_settings__WEBPACK_IMPORTED_MODULE_6__.settings.triggers.executeSkipOnValueChanged;
76294
+ return isOnNextPage === !_settings__WEBPACK_IMPORTED_MODULE_5__.settings.triggers.executeSkipOnValueChanged;
76308
76295
  };
76309
76296
  SurveyTriggerSkip.prototype.onSuccess = function (properties) {
76310
76297
  if (!this.gotoName || !this.owner)
@@ -76350,15 +76337,11 @@ var SurveyTriggerRunExpression = /** @class */ (function (_super) {
76350
76337
  };
76351
76338
  SurveyTriggerRunExpression.prototype.onSuccess = function (properties) {
76352
76339
  var _this = this;
76353
- if (!this.owner || !this.runExpression)
76340
+ if (!this.owner)
76354
76341
  return;
76355
- var expression = new _conditions__WEBPACK_IMPORTED_MODULE_3__.ExpressionRunner(this.runExpression);
76356
- if (expression.canRun) {
76357
- expression.onRunComplete = function (res) {
76358
- _this.onCompleteRunExpression(res);
76359
- };
76360
- expression.runContext(this.getValueGetterContext(), properties);
76361
- }
76342
+ this.runExpressionByProperty("runExpression", properties, function (res) {
76343
+ _this.onCompleteRunExpression(res);
76344
+ });
76362
76345
  };
76363
76346
  SurveyTriggerRunExpression.prototype.onCompleteRunExpression = function (newValue) {
76364
76347
  if (!!this.setToName && newValue !== undefined) {
@@ -76423,8 +76406,8 @@ var SurveyTriggerCopyValue = /** @class */ (function (_super) {
76423
76406
  this.owner.copyTriggerValue(this.setToName, this.fromName, this.copyDisplayValue);
76424
76407
  };
76425
76408
  SurveyTriggerCopyValue.prototype.canSuccessOnEmptyExpression = function () { return true; };
76426
- SurveyTriggerCopyValue.prototype.getUsedVariables = function () {
76427
- var res = _super.prototype.getUsedVariables.call(this);
76409
+ SurveyTriggerCopyValue.prototype.getUsedVariables = function (runner) {
76410
+ var res = _super.prototype.getUsedVariables.call(this, runner);
76428
76411
  if (res.length === 0 && !!this.fromName) {
76429
76412
  res.push(this.fromName);
76430
76413
  }
@@ -79504,13 +79487,14 @@ var ExpressionValidator = /** @class */ (function (_super) {
79504
79487
  return this.getLocalizationFormatString("invalidExpression", this.expression);
79505
79488
  };
79506
79489
  ExpressionValidator.prototype.ensureConditionRunner = function (reNew) {
79507
- if (!this.expression)
79490
+ var expression = this.getExpressionFromSurvey("expression");
79491
+ if (!expression)
79508
79492
  return false;
79509
79493
  if (reNew || !this.conditionRunner) {
79510
- this.conditionRunner = new _conditions__WEBPACK_IMPORTED_MODULE_3__.ConditionRunner(this.expression);
79494
+ this.conditionRunner = new _conditions__WEBPACK_IMPORTED_MODULE_3__.ConditionRunner(expression);
79511
79495
  }
79512
79496
  else {
79513
- this.conditionRunner.expression = this.expression;
79497
+ this.conditionRunner.expression = expression;
79514
79498
  }
79515
79499
  return true;
79516
79500
  };