survey-core 2.3.3 → 2.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (290) 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 +412 -340
  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 +431 -360
  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 +3 -2
  273. package/typings/src/base.d.ts +5 -0
  274. package/typings/src/conditionProcessValue.d.ts +5 -0
  275. package/typings/src/conditions.d.ts +1 -1
  276. package/typings/src/martixBase.d.ts +0 -3
  277. package/typings/src/question.d.ts +11 -10
  278. package/typings/src/question_custom.d.ts +4 -1
  279. package/typings/src/question_expression.d.ts +1 -3
  280. package/typings/src/question_matrix.d.ts +2 -0
  281. package/typings/src/question_matrixdropdownbase.d.ts +4 -0
  282. package/typings/src/question_matrixdropdowncolumn.d.ts +1 -0
  283. package/typings/src/question_matrixdynamic.d.ts +1 -0
  284. package/typings/src/question_paneldynamic.d.ts +2 -0
  285. package/typings/src/question_slider.d.ts +2 -2
  286. package/typings/src/question_text.d.ts +0 -2
  287. package/typings/src/settings.d.ts +1 -0
  288. package/typings/src/survey-events-api.d.ts +19 -0
  289. package/typings/src/survey.d.ts +8 -3
  290. 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.5
3
3
  * Copyright (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
5
5
  */
@@ -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.5");
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-09-02");
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",
@@ -5145,7 +5187,8 @@ __webpack_require__.r(__webpack_exports__);
5145
5187
  /* harmony export */ ProcessValue: () => (/* binding */ ProcessValue),
5146
5188
  /* harmony export */ ValueGetter: () => (/* binding */ ValueGetter),
5147
5189
  /* harmony export */ ValueGetterContextCore: () => (/* binding */ ValueGetterContextCore),
5148
- /* harmony export */ VariableGetterContext: () => (/* binding */ VariableGetterContext)
5190
+ /* harmony export */ VariableGetterContext: () => (/* binding */ VariableGetterContext),
5191
+ /* harmony export */ VariableGetterContextEx: () => (/* binding */ VariableGetterContextEx)
5149
5192
  /* harmony export */ });
5150
5193
  /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts");
5151
5194
  var __extends = (undefined && undefined.__extends) || (function () {
@@ -5405,6 +5448,20 @@ var VariableGetterContext = /** @class */ (function (_super) {
5405
5448
  return VariableGetterContext;
5406
5449
  }(ValueGetterContextCore));
5407
5450
 
5451
+ var VariableGetterContextEx = /** @class */ (function (_super) {
5452
+ __extends(VariableGetterContextEx, _super);
5453
+ function VariableGetterContextEx(variables, second) {
5454
+ var _this = _super.call(this, variables) || this;
5455
+ _this.second = second;
5456
+ return _this;
5457
+ }
5458
+ VariableGetterContextEx.prototype.getValue = function (path, isRoot, index, createObjects) {
5459
+ var res = _super.prototype.getValue.call(this, path, isRoot, index, createObjects);
5460
+ return !this.second || (res === null || res === void 0 ? void 0 : res.isFound) ? res : this.second.getValue(path, isRoot, index, createObjects);
5461
+ };
5462
+ return VariableGetterContextEx;
5463
+ }(VariableGetterContext));
5464
+
5408
5465
  var ProcessValue = /** @class */ (function () {
5409
5466
  function ProcessValue(context) {
5410
5467
  this.properties = null;
@@ -5626,8 +5683,7 @@ var ExpressionExecutor = /** @class */ (function () {
5626
5683
  return !!this.operand;
5627
5684
  };
5628
5685
  ExpressionExecutor.prototype.run = function (values, properties, id) {
5629
- if (properties === void 0) { properties = null; }
5630
- return this.runContext(new _conditionProcessValue__WEBPACK_IMPORTED_MODULE_0__.VariableGetterContext(values), properties, id);
5686
+ return this.runContext(new _conditionProcessValue__WEBPACK_IMPORTED_MODULE_0__.VariableGetterContextEx(values, properties === null || properties === void 0 ? void 0 : properties.context), properties, id);
5631
5687
  };
5632
5688
  ExpressionExecutor.prototype.runContext = function (context, properties, id) {
5633
5689
  if (properties === void 0) { properties = null; }
@@ -5708,8 +5764,7 @@ var ConditionRunner = /** @class */ (function (_super) {
5708
5764
  return _super !== null && _super.apply(this, arguments) || this;
5709
5765
  }
5710
5766
  ConditionRunner.prototype.runValues = function (values, properties) {
5711
- if (properties === void 0) { properties = null; }
5712
- return this.runContext(new _conditionProcessValue__WEBPACK_IMPORTED_MODULE_0__.VariableGetterContext(values), properties);
5767
+ return this.runContext(new _conditionProcessValue__WEBPACK_IMPORTED_MODULE_0__.VariableGetterContextEx(values, properties === null || properties === void 0 ? void 0 : properties.context), properties);
5713
5768
  };
5714
5769
  ConditionRunner.prototype.runContext = function (context, properties) {
5715
5770
  return this.runContextCore(context, properties) == true;
@@ -5728,8 +5783,7 @@ var ExpressionRunner = /** @class */ (function (_super) {
5728
5783
  return _super !== null && _super.apply(this, arguments) || this;
5729
5784
  }
5730
5785
  ExpressionRunner.prototype.runValues = function (values, properties) {
5731
- if (properties === void 0) { properties = null; }
5732
- return this.runContext(new _conditionProcessValue__WEBPACK_IMPORTED_MODULE_0__.VariableGetterContext(values), properties);
5786
+ return this.runContext(new _conditionProcessValue__WEBPACK_IMPORTED_MODULE_0__.VariableGetterContextEx(values, properties === null || properties === void 0 ? void 0 : properties.context), properties);
5733
5787
  };
5734
5788
  ExpressionRunner.prototype.runContext = function (context, properties) {
5735
5789
  return this.runContextCore(context, properties);
@@ -9921,9 +9975,10 @@ var ExpressionItem = /** @class */ (function (_super) {
9921
9975
  return "expressionitem";
9922
9976
  };
9923
9977
  ExpressionItem.prototype.runCondition = function (properties) {
9924
- if (!this.expression)
9978
+ var expression = this.getExpressionFromSurvey("expression");
9979
+ if (!expression)
9925
9980
  return false;
9926
- return new _conditions__WEBPACK_IMPORTED_MODULE_2__.ConditionRunner(this.expression).runContext(this.getValueGetterContext(), properties);
9981
+ return new _conditions__WEBPACK_IMPORTED_MODULE_2__.ConditionRunner(expression).runContext(this.getValueGetterContext(), properties);
9927
9982
  };
9928
9983
  Object.defineProperty(ExpressionItem.prototype, "expression", {
9929
9984
  /**
@@ -14264,15 +14319,15 @@ function convertToNumber(val) {
14264
14319
  return _helpers__WEBPACK_IMPORTED_MODULE_0__.Helpers.isNumber(val) ? _helpers__WEBPACK_IMPORTED_MODULE_0__.Helpers.getNumber(val) : undefined;
14265
14320
  return val;
14266
14321
  }
14267
- function processItemInArray(item, name, res, func, needToConvert, condition) {
14322
+ function processItemInArray(item, name, res, func, needToConvert, condition, properties) {
14268
14323
  if (!item || _helpers__WEBPACK_IMPORTED_MODULE_0__.Helpers.isValueEmpty(item[name]))
14269
14324
  return res;
14270
- if (condition && !condition.runValues(item))
14325
+ if (condition && !condition.runValues(item, properties))
14271
14326
  return res;
14272
14327
  var val = needToConvert ? convertToNumber(item[name]) : 1;
14273
14328
  return func(res, val);
14274
14329
  }
14275
- function calcInArray(params, originalParams, func, needToConvert) {
14330
+ function calcInArray(properties, params, originalParams, func, needToConvert) {
14276
14331
  if (needToConvert === void 0) { needToConvert = true; }
14277
14332
  var v = getInArrayParams(params, originalParams);
14278
14333
  if (!v)
@@ -14284,18 +14339,26 @@ function calcInArray(params, originalParams, func, needToConvert) {
14284
14339
  var res = undefined;
14285
14340
  if (Array.isArray(v.data)) {
14286
14341
  for (var i = 0; i < v.data.length; i++) {
14287
- res = processItemInArray(v.data[i], v.name, res, func, needToConvert, condition);
14342
+ res = processItemInArray(v.data[i], v.name, res, func, needToConvert, condition, properties);
14288
14343
  }
14289
14344
  }
14290
14345
  else {
14291
14346
  for (var key in v.data) {
14292
- res = processItemInArray(v.data[key], v.name, res, func, needToConvert, condition);
14347
+ res = processItemInArray(v.data[key], v.name, res, func, needToConvert, condition, properties);
14293
14348
  }
14294
14349
  }
14295
14350
  return res;
14296
14351
  }
14352
+ function getProperties(self) {
14353
+ var _a;
14354
+ return {
14355
+ survey: self.survey,
14356
+ question: self.question,
14357
+ context: (_a = self.survey) === null || _a === void 0 ? void 0 : _a.getValueGetterContext()
14358
+ };
14359
+ }
14297
14360
  function sumInArray(params, originalParams) {
14298
- var res = calcInArray(params, originalParams, function (res, val) {
14361
+ var res = calcInArray(getProperties(this), params, originalParams, function (res, val) {
14299
14362
  if (res == undefined)
14300
14363
  res = 0;
14301
14364
  if (val == undefined || val == null)
@@ -14306,7 +14369,7 @@ function sumInArray(params, originalParams) {
14306
14369
  }
14307
14370
  FunctionFactory.Instance.register("sumInArray", sumInArray);
14308
14371
  function minInArray(params, originalParams) {
14309
- return calcInArray(params, originalParams, function (res, val) {
14372
+ return calcInArray(getProperties(this), params, originalParams, function (res, val) {
14310
14373
  if (res == undefined)
14311
14374
  return val;
14312
14375
  if (val == undefined || val == null)
@@ -14316,7 +14379,7 @@ function minInArray(params, originalParams) {
14316
14379
  }
14317
14380
  FunctionFactory.Instance.register("minInArray", minInArray);
14318
14381
  function maxInArray(params, originalParams) {
14319
- return calcInArray(params, originalParams, function (res, val) {
14382
+ return calcInArray(getProperties(this), params, originalParams, function (res, val) {
14320
14383
  if (res == undefined)
14321
14384
  return val;
14322
14385
  if (val == undefined || val == null)
@@ -14326,7 +14389,7 @@ function maxInArray(params, originalParams) {
14326
14389
  }
14327
14390
  FunctionFactory.Instance.register("maxInArray", maxInArray);
14328
14391
  function countInArray(params, originalParams) {
14329
- var res = calcInArray(params, originalParams, function (res, val) {
14392
+ var res = calcInArray(getProperties(this), params, originalParams, function (res, val) {
14330
14393
  if (res == undefined)
14331
14394
  res = 0;
14332
14395
  if (val == undefined || val == null)
@@ -14337,10 +14400,12 @@ function countInArray(params, originalParams) {
14337
14400
  }
14338
14401
  FunctionFactory.Instance.register("countInArray", countInArray);
14339
14402
  function avgInArray(params, originalParams) {
14340
- var count = countInArray(params, originalParams);
14403
+ var properties = getProperties(this);
14404
+ var funcCall = function (name) { return FunctionFactory.Instance.run(name, params, properties, originalParams); };
14405
+ var count = funcCall("countInArray");
14341
14406
  if (count == 0)
14342
14407
  return 0;
14343
- return sumInArray(params, originalParams) / count;
14408
+ return funcCall("sumInArray") / count;
14344
14409
  }
14345
14410
  FunctionFactory.Instance.register("avgInArray", avgInArray);
14346
14411
  function iif(params) {
@@ -16334,19 +16399,21 @@ var ItemValue = /** @class */ (function (_super) {
16334
16399
  return this.getEnableConditionRunner();
16335
16400
  };
16336
16401
  ItemValue.prototype.getVisibleConditionRunner = function () {
16337
- if (!this.visibleIf)
16402
+ var expression = this.getExpressionFromSurvey("visibleIf");
16403
+ if (!expression)
16338
16404
  return null;
16339
16405
  if (!this.visibleConditionRunner)
16340
- this.visibleConditionRunner = new _conditions__WEBPACK_IMPORTED_MODULE_3__.ConditionRunner(this.visibleIf);
16341
- this.visibleConditionRunner.expression = this.visibleIf;
16406
+ this.visibleConditionRunner = new _conditions__WEBPACK_IMPORTED_MODULE_3__.ConditionRunner(expression);
16407
+ this.visibleConditionRunner.expression = expression;
16342
16408
  return this.visibleConditionRunner;
16343
16409
  };
16344
16410
  ItemValue.prototype.getEnableConditionRunner = function () {
16345
- if (!this.enableIf)
16411
+ var expression = this.getExpressionFromSurvey("enableIf");
16412
+ if (!expression)
16346
16413
  return null;
16347
16414
  if (!this.enableConditionRunner)
16348
- this.enableConditionRunner = new _conditions__WEBPACK_IMPORTED_MODULE_3__.ConditionRunner(this.enableIf);
16349
- this.enableConditionRunner.expression = this.enableIf;
16415
+ this.enableConditionRunner = new _conditions__WEBPACK_IMPORTED_MODULE_3__.ConditionRunner(expression);
16416
+ this.enableConditionRunner.expression = expression;
16350
16417
  return this.enableConditionRunner;
16351
16418
  };
16352
16419
  Object.defineProperty(ItemValue.prototype, "selected", {
@@ -20194,7 +20261,6 @@ var QuestionMatrixBaseModel = /** @class */ (function (_super) {
20194
20261
  this.onRowsChanged();
20195
20262
  }
20196
20263
  };
20197
- QuestionMatrixBaseModel.prototype.isRowsFiltered = function () { return !!this.filteredRows; };
20198
20264
  QuestionMatrixBaseModel.prototype.clearGeneratedRows = function () {
20199
20265
  this.generatedVisibleRows = null;
20200
20266
  };
@@ -20202,20 +20268,14 @@ var QuestionMatrixBaseModel = /** @class */ (function (_super) {
20202
20268
  QuestionMatrixBaseModel.prototype.runConditionsForRows = function (properties) {
20203
20269
  var showInvisibile = !!this.survey && this.survey.areInvisibleElementsShowing;
20204
20270
  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);
20271
+ var hasChanged = _itemvalue__WEBPACK_IMPORTED_MODULE_0__.ItemValue.runConditionsForItems(this.rows, undefined, runner, properties, !showInvisibile);
20207
20272
  _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
20273
  return hasChanged;
20215
20274
  };
20216
20275
  QuestionMatrixBaseModel.prototype.runConditionsForColumns = function (properties) {
20217
20276
  var useColumnsExpression = !!this.survey && !this.survey.areInvisibleElementsShowing;
20218
- var runner = useColumnsExpression && !!this.columnsVisibleIf ? new _conditions__WEBPACK_IMPORTED_MODULE_3__.ConditionRunner(this.columnsVisibleIf) : null;
20277
+ var expression = this.getExpressionFromSurvey("columnsVisibleIf");
20278
+ var runner = useColumnsExpression && !!expression ? new _conditions__WEBPACK_IMPORTED_MODULE_3__.ConditionRunner(expression) : null;
20219
20279
  return _itemvalue__WEBPACK_IMPORTED_MODULE_0__.ItemValue.runConditionsForItems(this.columns, undefined, runner, properties, this.shouldRunColumnExpression());
20220
20280
  };
20221
20281
  QuestionMatrixBaseModel.prototype.clearInvisibleColumnValues = function () { };
@@ -27837,15 +27897,6 @@ var __extends = (undefined && undefined.__extends) || (function () {
27837
27897
 
27838
27898
 
27839
27899
 
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
27900
  var QuestionValueGetterContext = /** @class */ (function () {
27850
27901
  function QuestionValueGetterContext(question, isUnwrapped) {
27851
27902
  this.question = question;
@@ -27934,11 +27985,13 @@ var QuestionItemValueGetterContext = /** @class */ (function (_super) {
27934
27985
  return res;
27935
27986
  };
27936
27987
  QuestionItemValueGetterContext.prototype.fillQuestions = function (qs, q, res) {
27937
- qs.forEach(function (question) {
27938
- if (question !== q) {
27939
- res.push(question);
27940
- }
27941
- });
27988
+ if (Array.isArray(qs)) {
27989
+ qs.forEach(function (question) {
27990
+ if (question !== q) {
27991
+ res.push(question);
27992
+ }
27993
+ });
27994
+ }
27942
27995
  };
27943
27996
  QuestionItemValueGetterContext.prototype.getRootObj = function () { return this.getQuestionData(); };
27944
27997
  return QuestionItemValueGetterContext;
@@ -27976,6 +28029,7 @@ var Question = /** @class */ (function (_super) {
27976
28029
  var _this = _super.call(this, name) || this;
27977
28030
  _this.customWidgetData = { isNeedRender: true };
27978
28031
  _this.hasCssErrorCallback = function () { return false; };
28032
+ _this.triggersInfo = [];
27979
28033
  _this.isReadyValue = true;
27980
28034
  _this.dependedQuestions = [];
27981
28035
  /**
@@ -27991,7 +28045,6 @@ var Question = /** @class */ (function (_super) {
27991
28045
  * Indicates the previous ready state.
27992
28046
  */
27993
28047
  _this.onReadyChanged = _this.addEvent();
27994
- _this.triggersInfo = [];
27995
28048
  _this.isRunningValidatorsValue = false;
27996
28049
  _this.isValueChangedInSurvey = false;
27997
28050
  _this.allowNotifyValueChanged = true;
@@ -28009,13 +28062,7 @@ var Question = /** @class */ (function (_super) {
28009
28062
  _this.createLocalizableString("requiredErrorText", _this);
28010
28063
  _this.createLocalizableString("commentPlaceholder", _this);
28011
28064
  _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(); };
28065
+ _this.addTriggersInfo();
28019
28066
  _this.registerPropertyChangedHandlers(["width"], function () {
28020
28067
  _this.updateQuestionCss();
28021
28068
  if (!!_this.parent) {
@@ -28607,63 +28654,15 @@ var Question = /** @class */ (function (_super) {
28607
28654
  requiredAnsweredQuestionCount: !this.isEmpty() && this.isRequired ? 1 : 0,
28608
28655
  };
28609
28656
  };
28610
- Question.prototype.ensureSetValueExpressionRunner = function () {
28657
+ Question.prototype.runTriggerInfo = function (info, keys, properties) {
28611
28658
  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
- }
28659
+ this.runExpressionByProperty(info.name, properties, function (value) {
28660
+ info.doComplete(value, properties);
28661
+ }, function (runner) {
28662
+ if (!info.canRun())
28663
+ return false;
28664
+ return !keys || _this.canExecuteTriggerByKeys(keys, runner, _this.getExpressionByProperty(info.secondName));
28665
+ });
28667
28666
  };
28668
28667
  Question.prototype.canExecuteTriggerByKeys = function (keys, runner, secondRunner) {
28669
28668
  if (!runner && !!secondRunner) {
@@ -28692,6 +28691,48 @@ var Question = /** @class */ (function (_super) {
28692
28691
  Question.prototype.getValueGetterContext = function (isUnwrapped) {
28693
28692
  return new QuestionValueGetterContext(this, isUnwrapped);
28694
28693
  };
28694
+ Question.prototype.addTriggersInfo = function () {
28695
+ var _this = this;
28696
+ this.addTriggerInfo({
28697
+ name: "resetValueIf",
28698
+ canRun: function () { return !_this.isEmpty(); },
28699
+ doComplete: function (res, properties) {
28700
+ if (res === true) {
28701
+ _this.startSetValueOnExpression();
28702
+ _this.updateValueWithDefaultsOrClear();
28703
+ _this.finishSetValueOnExpression();
28704
+ }
28705
+ }
28706
+ });
28707
+ this.addTriggerInfo({
28708
+ name: "setValueIf",
28709
+ secondName: "setValueExpression",
28710
+ canRun: function () { return true; },
28711
+ doComplete: function (res, properties) {
28712
+ if (res) {
28713
+ if (!_this.setValueExpression) {
28714
+ _this.clearValue();
28715
+ }
28716
+ else {
28717
+ var info = {
28718
+ name: "setValueExpression",
28719
+ canRun: function () { return true; },
28720
+ doComplete: function (res, properties) { return _this.runExpressionSetValue(res); }
28721
+ };
28722
+ _this.runTriggerInfo(info, undefined, properties);
28723
+ }
28724
+ }
28725
+ }
28726
+ });
28727
+ this.addTriggerInfo({
28728
+ name: "setValueExpression",
28729
+ canRun: function () { return !_this.setValueIf; },
28730
+ doComplete: function (res, properties) { return _this.runExpressionSetValue(res); }
28731
+ });
28732
+ };
28733
+ Question.prototype.addTriggerInfo = function (info) {
28734
+ this.triggersInfo.push(info);
28735
+ };
28695
28736
  Question.prototype.runTriggers = function (name, value, keys) {
28696
28737
  var _this = this;
28697
28738
  if (this.isSettingQuestionValue || (this.parentQuestion && this.parentQuestion.getValueName() === name))
@@ -28700,8 +28741,9 @@ var Question = /** @class */ (function (_super) {
28700
28741
  keys = {};
28701
28742
  keys[name] = value;
28702
28743
  }
28744
+ var properties = this.getDataFilteredProperties();
28703
28745
  this.triggersInfo.forEach(function (info) {
28704
- _this.runTriggerInfo(info, keys);
28746
+ _this.runTriggerInfo(info, keys, properties);
28705
28747
  });
28706
28748
  };
28707
28749
  Question.prototype.runConditions = function () {
@@ -28839,7 +28881,7 @@ var Question = /** @class */ (function (_super) {
28839
28881
  this.resetSingleInputCore();
28840
28882
  };
28841
28883
  Question.prototype.resetSingleInputCore = function () {
28842
- var prev = this.singleInputQuestion;
28884
+ var prev = this.getPropertyValue("singleInputQuestion");
28843
28885
  this.resetPropertyValue("singleInputQuestion");
28844
28886
  if (!!prev) {
28845
28887
  this.onSingleInputChanged();
@@ -30285,8 +30327,7 @@ var Question = /** @class */ (function (_super) {
30285
30327
  properties["question"] = this;
30286
30328
  this.runConditionCore(properties);
30287
30329
  if (!this.isValueChangedDirectly && (!this.isClearValueOnHidden || this.isVisibleInSurvey)) {
30288
- this.defaultValueRunner = this.getDefaultRunner(this.defaultValueRunner, this.defaultValueExpression);
30289
- this.runDefaultValueExpression(this.defaultValueRunner, properties);
30330
+ this.runDefaultValueExpression(properties);
30290
30331
  }
30291
30332
  };
30292
30333
  Object.defineProperty(Question.prototype, "isInDesignMode", {
@@ -30929,15 +30970,6 @@ var Question = /** @class */ (function (_super) {
30929
30970
  Question.prototype.isDefaultValueEmpty = function () {
30930
30971
  return !this.defaultValueExpression && this.isValueEmpty(this.defaultValue, !this.allowSpaceAsAnswer);
30931
30972
  };
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
30973
  Question.prototype.setDefaultValue = function () {
30942
30974
  var _this = this;
30943
30975
  this.setDefaultValueCore(function (val) {
@@ -30950,9 +30982,14 @@ var Question = /** @class */ (function (_super) {
30950
30982
  Question.prototype.setDefaultIntoValue = function (val) {
30951
30983
  this.value = val;
30952
30984
  };
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); });
30985
+ Question.prototype.setDefaultValueCore = function (setFunc) {
30986
+ var _this = this;
30987
+ var func = function (val) {
30988
+ _this.runExpressionSetValueCore(val, setFunc);
30989
+ };
30990
+ if (!this.runDefaultValueExpression(undefined, func)) {
30991
+ func(this.getUnbindValue(this.defaultValue));
30992
+ }
30956
30993
  };
30957
30994
  Question.prototype.updateValueWithDefaultsOrClear = function () {
30958
30995
  if (this.isDesignMode || this.isLoadingFromJson)
@@ -30967,16 +31004,6 @@ var Question = /** @class */ (function (_super) {
30967
31004
  Question.prototype.isValueExpression = function (val) {
30968
31005
  return !!val && typeof val == "string" && val.length > 0 && val[0] == "=";
30969
31006
  };
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
31007
  Question.prototype.convertFuncValuetoQuestionValue = function (val) {
30981
31008
  return _helpers__WEBPACK_IMPORTED_MODULE_0__.Helpers.convertValToQuestionVal(val);
30982
31009
  };
@@ -31001,10 +31028,10 @@ var Question = /** @class */ (function (_super) {
31001
31028
  var _a;
31002
31029
  (_a = this.survey) === null || _a === void 0 ? void 0 : _a.finishSetValueOnExpression();
31003
31030
  };
31004
- Question.prototype.runDefaultValueExpression = function (runner, properties, setFunc) {
31031
+ Question.prototype.runDefaultValueExpression = function (properties, setFunc) {
31005
31032
  var _this = this;
31006
31033
  if (properties === void 0) { properties = null; }
31007
- if (!runner || !this.data)
31034
+ if (!this.data)
31008
31035
  return false;
31009
31036
  if (!setFunc) {
31010
31037
  setFunc = function (val) {
@@ -31015,17 +31042,13 @@ var Question = /** @class */ (function (_super) {
31015
31042
  properties = this.defaultValueExpression ? this.data.getFilteredProperties() : {};
31016
31043
  properties["question"] = this;
31017
31044
  }
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;
31045
+ return this.runExpressionByProperty("defaultValueExpression", properties, function (res) {
31046
+ if (res == undefined)
31047
+ res = _this.defaultValue;
31048
+ _this.isChangingViaDefaultValue = true;
31049
+ setFunc(res);
31050
+ _this.isChangingViaDefaultValue = false;
31051
+ });
31029
31052
  };
31030
31053
  Object.defineProperty(Question.prototype, "comment", {
31031
31054
  /**
@@ -31348,10 +31371,14 @@ var Question = /** @class */ (function (_super) {
31348
31371
  }
31349
31372
  };
31350
31373
  Question.prototype.setNewValue = function (newValue) {
31374
+ if (this.survey) {
31375
+ newValue = this.survey.questionValueChanging(this, newValue);
31376
+ }
31351
31377
  if (this.isNewValueEqualsToValue(newValue))
31352
31378
  return;
31353
31379
  if (!this.checkIsValueCorrect(newValue))
31354
31380
  return;
31381
+ var oldValue = this.getUnbindValue(this.value);
31355
31382
  this.isOldAnswered = this.isAnswered;
31356
31383
  this.isSettingQuestionValue = true;
31357
31384
  this.setNewValueInData(newValue);
@@ -31364,7 +31391,11 @@ var Question = /** @class */ (function (_super) {
31364
31391
  if (this.parent) {
31365
31392
  this.parent.onQuestionValueChanged(this);
31366
31393
  }
31394
+ if (this.survey) {
31395
+ this.survey.questionValueChanged(this, oldValue);
31396
+ }
31367
31397
  };
31398
+ Question.prototype.getValueChangingOptions = function (childQuestion) { return undefined; };
31368
31399
  Question.prototype.checkIsValueCorrect = function (val) {
31369
31400
  var res = this.isValueEmpty(val, !this.allowSpaceAsAnswer) || this.isNewValueCorrect(val);
31370
31401
  if (!res) {
@@ -33172,22 +33203,24 @@ var QuestionSelectBase = /** @class */ (function (_super) {
33172
33203
  return [];
33173
33204
  };
33174
33205
  QuestionSelectBase.prototype.setConditionalChoicesRunner = function () {
33175
- if (this.choicesVisibleIf) {
33206
+ var expression = this.getExpressionFromSurvey("choicesVisibleIf");
33207
+ if (expression) {
33176
33208
  if (!this.conditionChoicesVisibleIfRunner) {
33177
- this.conditionChoicesVisibleIfRunner = new _conditions__WEBPACK_IMPORTED_MODULE_8__.ConditionRunner(this.choicesVisibleIf);
33209
+ this.conditionChoicesVisibleIfRunner = new _conditions__WEBPACK_IMPORTED_MODULE_8__.ConditionRunner(expression);
33178
33210
  }
33179
- this.conditionChoicesVisibleIfRunner.expression = this.choicesVisibleIf;
33211
+ this.conditionChoicesVisibleIfRunner.expression = expression;
33180
33212
  }
33181
33213
  else {
33182
33214
  this.conditionChoicesVisibleIfRunner = null;
33183
33215
  }
33184
33216
  };
33185
33217
  QuestionSelectBase.prototype.setConditionalEnableChoicesRunner = function () {
33186
- if (this.choicesEnableIf) {
33218
+ var expression = this.getExpressionFromSurvey("choicesEnableIf");
33219
+ if (expression) {
33187
33220
  if (!this.conditionChoicesEnableIfRunner) {
33188
- this.conditionChoicesEnableIfRunner = new _conditions__WEBPACK_IMPORTED_MODULE_8__.ConditionRunner(this.choicesEnableIf);
33221
+ this.conditionChoicesEnableIfRunner = new _conditions__WEBPACK_IMPORTED_MODULE_8__.ConditionRunner(expression);
33189
33222
  }
33190
- this.conditionChoicesEnableIfRunner.expression = this.choicesEnableIf;
33223
+ this.conditionChoicesEnableIfRunner.expression = expression;
33191
33224
  }
33192
33225
  else {
33193
33226
  this.conditionChoicesEnableIfRunner = null;
@@ -34346,10 +34379,10 @@ var QuestionSelectBase = /** @class */ (function (_super) {
34346
34379
  }
34347
34380
  };
34348
34381
  QuestionSelectBase.prototype.getStoreOthersAsComment = function () {
34349
- if (this.checkHasChoicesComments())
34350
- return true;
34351
34382
  if (this.showCommentArea)
34352
34383
  return false;
34384
+ if (this.checkHasChoicesComments())
34385
+ return true;
34353
34386
  return (this.storeOthersAsComment === true ||
34354
34387
  (this.storeOthersAsComment == "default" &&
34355
34388
  (this.survey != null ? this.survey.storeOthersAsComment : true)) ||
@@ -37797,11 +37830,24 @@ var QuestionCustomModelBase = /** @class */ (function (_super) {
37797
37830
  this.initElement(this.getElement());
37798
37831
  this.isSettingValOnLoading = false;
37799
37832
  };
37833
+ QuestionCustomModelBase.prototype.onCustomQuestionLoaded = function () {
37834
+ if (!this.isLoadedCalled && !!this.customQuestion && !!this.survey) {
37835
+ this.customQuestion.onLoaded(this);
37836
+ this.isLoadedCalled = true;
37837
+ }
37838
+ };
37800
37839
  QuestionCustomModelBase.prototype.onSurveyLoad = function () {
37801
37840
  _super.prototype.onSurveyLoad.call(this);
37841
+ this.isLoadedCalled = false;
37802
37842
  if (!!this.getElement()) {
37803
37843
  this.getElement().onSurveyLoad();
37804
- this.customQuestion.onLoaded(this);
37844
+ }
37845
+ this.onCustomQuestionLoaded();
37846
+ };
37847
+ QuestionCustomModelBase.prototype.setSurveyCore = function (value) {
37848
+ _super.prototype.setSurveyCore.call(this, value);
37849
+ if (this.isLoadedCalled === false && value) {
37850
+ this.onCustomQuestionLoaded();
37805
37851
  }
37806
37852
  };
37807
37853
  QuestionCustomModelBase.prototype.afterRenderQuestionElement = function (el) {
@@ -38495,6 +38541,9 @@ var QuestionCompositeModel = /** @class */ (function (_super) {
38495
38541
  _super.prototype.setValue.call(this, name, newValue, locNotification, allowNotifyValueChanged);
38496
38542
  this.settingNewValue = false;
38497
38543
  this.runPanelTriggers(_settings__WEBPACK_IMPORTED_MODULE_8__.settings.expressionVariables.composite + "." + name, newValue);
38544
+ if (this.isEditingSurveyElement) {
38545
+ this.runCondition(this.getFilteredProperties());
38546
+ }
38498
38547
  };
38499
38548
  QuestionCompositeModel.prototype.setComment = function (name, newValue, locNotification) {
38500
38549
  var val = this.getUnbindValue(this.value);
@@ -39339,11 +39388,6 @@ var QuestionExpressionModel = /** @class */ (function (_super) {
39339
39388
  function QuestionExpressionModel(name) {
39340
39389
  var _this = _super.call(this, name) || this;
39341
39390
  _this.createLocalizableString("format", _this);
39342
- _this.registerPropertyChangedHandlers(["expression"], function () {
39343
- if (_this.expressionRunner) {
39344
- _this.expressionRunner = _this.createRunner();
39345
- }
39346
- });
39347
39391
  _this.registerPropertyChangedHandlers(["format", "currency", "displayStyle"], function () {
39348
39392
  _this.updateFormatedValue();
39349
39393
  });
@@ -39398,22 +39442,19 @@ var QuestionExpressionModel = /** @class */ (function (_super) {
39398
39442
  configurable: true
39399
39443
  });
39400
39444
  QuestionExpressionModel.prototype.locCalculation = function () {
39401
- this.expressionIsRunning = true;
39445
+ this.isExecutionLocked = true;
39402
39446
  };
39403
39447
  QuestionExpressionModel.prototype.unlocCalculation = function () {
39404
- this.expressionIsRunning = false;
39448
+ this.isExecutionLocked = false;
39405
39449
  };
39406
39450
  QuestionExpressionModel.prototype.runConditionCore = function (properties) {
39451
+ var _this = this;
39407
39452
  _super.prototype.runConditionCore.call(this, properties);
39408
- if (!this.expression ||
39409
- this.expressionIsRunning ||
39410
- (!this.runIfReadOnly && this.isReadOnly))
39453
+ if (this.isExecutionLocked || !this.runIfReadOnly && this.isReadOnly)
39411
39454
  return;
39412
- this.locCalculation();
39413
- if (!this.expressionRunner) {
39414
- this.expressionRunner = this.createRunner();
39415
- }
39416
- this.expressionRunner.runContext(this.getValueGetterContext(), properties);
39455
+ this.runExpressionByProperty("expression", properties, function (val) {
39456
+ _this.value = _this.roundValue(val);
39457
+ });
39417
39458
  };
39418
39459
  QuestionExpressionModel.prototype.canCollectErrors = function () {
39419
39460
  return true;
@@ -39421,15 +39462,6 @@ var QuestionExpressionModel = /** @class */ (function (_super) {
39421
39462
  QuestionExpressionModel.prototype.hasRequiredError = function () {
39422
39463
  return false;
39423
39464
  };
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
39465
  Object.defineProperty(QuestionExpressionModel.prototype, "maximumFractionDigits", {
39434
39466
  /**
39435
39467
  * 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 +42660,11 @@ var MatrixRowModel = /** @class */ (function (_super) {
42628
42660
  enumerable: false,
42629
42661
  configurable: true
42630
42662
  });
42663
+ Object.defineProperty(MatrixRowModel.prototype, "isVisible", {
42664
+ get: function () { return this.item.isVisible; },
42665
+ enumerable: false,
42666
+ configurable: true
42667
+ });
42631
42668
  Object.defineProperty(MatrixRowModel.prototype, "value", {
42632
42669
  get: function () {
42633
42670
  return this.getPropertyValue("value");
@@ -42909,7 +42946,7 @@ var MatrixValueGetterContext = /** @class */ (function (_super) {
42909
42946
  MatrixValueGetterContext.prototype.getRootObj = function () { return this.question.data; };
42910
42947
  MatrixValueGetterContext.prototype.updateValueByItem = function (name, res) {
42911
42948
  var _a;
42912
- var rows = this.question.visibleRows;
42949
+ var rows = this.question.getMatrixRows();
42913
42950
  name = name.toLocaleLowerCase();
42914
42951
  for (var i = 0; i < rows.length; i++) {
42915
42952
  var row = rows[i];
@@ -43238,20 +43275,21 @@ var QuestionMatrixModel = /** @class */ (function (_super) {
43238
43275
  _super.prototype.runConditionCore.call(this, properties);
43239
43276
  };
43240
43277
  QuestionMatrixModel.prototype.createRowsVisibleIfRunner = function () {
43241
- return !!this.rowsVisibleIf ? new _conditions__WEBPACK_IMPORTED_MODULE_12__.ConditionRunner(this.rowsVisibleIf) : null;
43278
+ var expression = this.getExpressionFromSurvey("rowsVisibleIf");
43279
+ return !!expression ? new _conditions__WEBPACK_IMPORTED_MODULE_12__.ConditionRunner(expression) : null;
43242
43280
  };
43243
43281
  QuestionMatrixModel.prototype.onRowsChanged = function () {
43244
43282
  this.clearGeneratedRows();
43245
43283
  _super.prototype.onRowsChanged.call(this);
43246
43284
  };
43247
- QuestionMatrixModel.prototype.getVisibleRows = function () {
43285
+ QuestionMatrixModel.prototype.getMatrixRows = function () {
43248
43286
  if (!!this.generatedVisibleRows)
43249
43287
  return this.generatedVisibleRows;
43250
43288
  var result = new Array();
43251
43289
  var val = this.value;
43252
43290
  if (!val)
43253
43291
  val = {};
43254
- var rows = this.filteredRows || this.rows;
43292
+ var rows = this.rows;
43255
43293
  for (var i = 0; i < rows.length; i++) {
43256
43294
  var row = rows[i];
43257
43295
  if (this.isValueEmpty(row.value))
@@ -43262,6 +43300,15 @@ var QuestionMatrixModel = /** @class */ (function (_super) {
43262
43300
  this.generatedVisibleRows = result;
43263
43301
  return result;
43264
43302
  };
43303
+ QuestionMatrixModel.prototype.getVisibleRows = function () {
43304
+ var rows = [];
43305
+ this.getMatrixRows().forEach(function (row) {
43306
+ if (row.isVisible) {
43307
+ rows.push(row);
43308
+ }
43309
+ });
43310
+ return rows;
43311
+ };
43265
43312
  QuestionMatrixModel.prototype.getRowByName = function (name) {
43266
43313
  var rows = this.visibleRows;
43267
43314
  for (var i = 0; i < rows.length; i++) {
@@ -44398,6 +44445,9 @@ var MatrixRowGetterContext = /** @class */ (function (_super) {
44398
44445
  if (name === setVar.rowIndex.toLocaleLowerCase()) {
44399
44446
  return this.row.rowIndex;
44400
44447
  }
44448
+ if (name === setVar.visibleRowIndex.toLocaleLowerCase()) {
44449
+ return this.getQuestionData().visibleRows.indexOf(this.row) + 1;
44450
+ }
44401
44451
  if ([setVar.item, setVar.rowName.toLocaleLowerCase(), setVar.rowValue.toLocaleLowerCase()].indexOf(name) > -1) {
44402
44452
  return this.row.rowName;
44403
44453
  }
@@ -45543,9 +45593,19 @@ var QuestionMatrixDropdownModelBase = /** @class */ (function (_super) {
45543
45593
  this.clearVisibleRows();
45544
45594
  this.resetRenderedTable();
45545
45595
  _super.prototype.onRowsChanged.call(this);
45596
+ this.updateRowsVisibleIndexes();
45597
+ };
45598
+ QuestionMatrixDropdownModelBase.prototype.updateRowsVisibleIndexes = function () {
45546
45599
  var rows = this.visibleRows;
45600
+ if (!Array.isArray(rows))
45601
+ return;
45602
+ var vriName = _settings__WEBPACK_IMPORTED_MODULE_10__.settings.expressionVariables.visibleRowIndex;
45603
+ var keys = {};
45604
+ keys[vriName] = 0;
45547
45605
  for (var i = 0; i < rows.length; i++) {
45548
45606
  rows[i].visibleIndex = i;
45607
+ keys[vriName] = i + 1;
45608
+ rows[i].runTriggers(vriName, i + 1, keys);
45549
45609
  }
45550
45610
  };
45551
45611
  QuestionMatrixDropdownModelBase.prototype.onStartRowAddingRemoving = function () {
@@ -45681,6 +45741,7 @@ var QuestionMatrixDropdownModelBase = /** @class */ (function (_super) {
45681
45741
  * - [`"boolean"`](https://surveyjs.io/form-library/documentation/api-reference/boolean-question-model)
45682
45742
  * - [`"expression"`](https://surveyjs.io/form-library/documentation/api-reference/expression-model)
45683
45743
  * - [`"rating"`](https://surveyjs.io/form-library/documentation/api-reference/rating-scale-question-model)
45744
+ * - [`"slider"`](https://surveyjs.io/form-library/documentation/api-reference/questionslidermodel)
45684
45745
  *
45685
45746
  * Default value: `"dropdown"` (inherited from [`settings.matrix.defaultCellType`](https://surveyjs.io/form-library/documentation/settings#matrixDefaultCellType))
45686
45747
  *
@@ -45948,23 +46009,24 @@ var QuestionMatrixDropdownModelBase = /** @class */ (function (_super) {
45948
46009
  QuestionMatrixDropdownModelBase.prototype.runCellsCondition = function (properties) {
45949
46010
  if (this.isDesignMode)
45950
46011
  return;
46012
+ var rowsVisibleIf = this.getExpressionFromSurvey("rowsVisibleIf");
45951
46013
  var rows = this.generatedVisibleRows;
45952
46014
  if (!!rows) {
45953
46015
  for (var i = 0; i < rows.length; i++) {
45954
- rows[i].runCondition(properties, this.rowsVisibleIf);
46016
+ rows[i].runCondition(properties, rowsVisibleIf);
45955
46017
  }
45956
46018
  }
45957
46019
  this.checkColumnsVisibility();
45958
46020
  this.checkColumnsRenderedRequired();
45959
46021
  };
45960
46022
  QuestionMatrixDropdownModelBase.prototype.runConditionsForColumns = function (properties) {
45961
- var _this = this;
46023
+ var expression = this.getExpressionFromSurvey("columnsVisibleIf");
45962
46024
  this.columns.forEach(function (column) {
45963
- if (!_this.columnsVisibleIf) {
46025
+ if (!expression) {
45964
46026
  column.isColumnsVisibleIf = true;
45965
46027
  }
45966
46028
  else {
45967
- var condition = new _conditions__WEBPACK_IMPORTED_MODULE_15__.ConditionRunner(_this.columnsVisibleIf);
46029
+ var condition = new _conditions__WEBPACK_IMPORTED_MODULE_15__.ConditionRunner(expression);
45968
46030
  column.isColumnsVisibleIf = condition.runContext(column.getValueGetterContext(), properties) === true;
45969
46031
  }
45970
46032
  });
@@ -46178,6 +46240,7 @@ var QuestionMatrixDropdownModelBase = /** @class */ (function (_super) {
46178
46240
  * The template can contain the following placeholders:
46179
46241
  *
46180
46242
  * - `{rowIndex}` - A row index within the collection of all rows. Starts with 1.
46243
+ * - `{visibleRowIndex}` - A row index within the collection of visible rows. Starts with 1.
46181
46244
  * - `{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
46245
  * - `{rowTitle}` - A row title (the `text` property within objects in the `rows` array).
46183
46246
  * - `{row.columnname}` - The value of a cell in the same row.
@@ -46254,6 +46317,7 @@ var QuestionMatrixDropdownModelBase = /** @class */ (function (_super) {
46254
46317
  return this.visibleRowsArray;
46255
46318
  this.generateVisibleRowsIfNeeded();
46256
46319
  this.visibleRowsArray = this.getVisibleFromGenerated(this.generatedVisibleRows);
46320
+ this.updateRowsVisibleIndexes();
46257
46321
  return this.visibleRowsArray;
46258
46322
  };
46259
46323
  Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "allRows", {
@@ -47045,8 +47109,10 @@ var QuestionMatrixDropdownModelBase = /** @class */ (function (_super) {
47045
47109
  if (this.isObject(rowValue) && Object.keys(rowValue).length === 0) {
47046
47110
  newValue = this.deleteRowValue(newValue, row);
47047
47111
  }
47112
+ newValue = this.correctValueForMinMaxRows(newValue);
47048
47113
  return { value: newValue, rowValue: rowValue };
47049
47114
  };
47115
+ QuestionMatrixDropdownModelBase.prototype.correctValueForMinMaxRows = function (newValue) { return newValue; };
47050
47116
  QuestionMatrixDropdownModelBase.prototype.getRowIndex = function (row) {
47051
47117
  if (!Array.isArray(this.generatedVisibleRows))
47052
47118
  return -1;
@@ -47202,7 +47268,7 @@ var QuestionMatrixDropdownModelBase = /** @class */ (function (_super) {
47202
47268
  }
47203
47269
  };
47204
47270
  QuestionMatrixDropdownModelBase.prototype.isRowsFiltered = function () {
47205
- return _super.prototype.isRowsFiltered.call(this) || (this.visibleRows !== this.generatedVisibleRows);
47271
+ return this.visibleRows !== this.generatedVisibleRows;
47206
47272
  };
47207
47273
  QuestionMatrixDropdownModelBase.prototype.getQuestionFromArray = function (name, index) {
47208
47274
  if (index >= this.visibleRows.length)
@@ -47277,7 +47343,9 @@ var QuestionMatrixDropdownModelBase = /** @class */ (function (_super) {
47277
47343
  _jsonobject__WEBPACK_IMPORTED_MODULE_0__.Serializer.addClass("matrixdropdownbase", [
47278
47344
  {
47279
47345
  name: "columns:matrixdropdowncolumns",
47280
- className: "matrixdropdowncolumn", isArray: true
47346
+ uniqueProperty: "name",
47347
+ className: "matrixdropdowncolumn",
47348
+ isArray: true
47281
47349
  },
47282
47350
  {
47283
47351
  name: "columnLayout",
@@ -47431,6 +47499,7 @@ var matrixDropdownColumnTypes = {
47431
47499
  },
47432
47500
  expression: {},
47433
47501
  rating: {},
47502
+ slider: {}
47434
47503
  };
47435
47504
  /**
47436
47505
  * An auxiliary class that describes a column in a [Multi-Select Matrix](https://surveyjs.io/form-library/documentation/api-reference/matrix-table-with-dropdown-list) or [Dynamic Matrix](https://surveyjs.io/form-library/documentation/api-reference/dynamic-matrix-table-question-model).
@@ -47540,6 +47609,7 @@ var MatrixDropdownColumn = /** @class */ (function (_super) {
47540
47609
  * - [`"boolean"`](https://surveyjs.io/form-library/documentation/api-reference/boolean-question-model)
47541
47610
  * - [`"expression"`](https://surveyjs.io/form-library/documentation/api-reference/expression-model)
47542
47611
  * - [`"rating"`](https://surveyjs.io/form-library/documentation/api-reference/rating-scale-question-model)
47612
+ * - [`"slider"`](https://surveyjs.io/form-library/documentation/api-reference/questionslidermodel)
47543
47613
  * - `"default"` (default) - Inherits the input type from the [`cellType`](https://surveyjs.io/form-library/documentation/api-reference/matrix-table-with-dropdown-list#cellType) property specified for the parent matrix.
47544
47614
  *
47545
47615
  * The input types are based upon standalone question types. Depending on the selected input type, the matrix column can have additional configuration properties inherited from the corresponding question type. For instance, Dropdown, Checkboxes, Radio Button Group, and Tag Box columns can specify the [`choices`](https://surveyjs.io/form-library/documentation/api-reference/radio-button-question-model#choices) array, similar to the question types upon which they are based. Refer to the API Reference of these question types for a full list of available properties.
@@ -50202,6 +50272,9 @@ var QuestionMatrixDynamicModel = /** @class */ (function (_super) {
50202
50272
  QuestionMatrixDynamicModel.prototype.valueFromData = function (val) {
50203
50273
  if (this.minRowCount < 1 || this.isEmpty())
50204
50274
  return _super.prototype.valueFromData.call(this, val);
50275
+ return this.correctValueForMinMaxRows(val);
50276
+ };
50277
+ QuestionMatrixDynamicModel.prototype.correctValueForMinMaxRows = function (val) {
50205
50278
  if (!Array.isArray(val))
50206
50279
  val = [];
50207
50280
  for (var i = val.length; i < this.minRowCount; i++)
@@ -50794,9 +50867,12 @@ var QuestionMatrixDynamicModel = /** @class */ (function (_super) {
50794
50867
  this.onEndRowRemoving(row);
50795
50868
  };
50796
50869
  QuestionMatrixDynamicModel.prototype.removeRowCore = function (index) {
50797
- var row = this.generatedVisibleRows
50798
- ? this.generatedVisibleRows[index]
50870
+ var row = this.visibleRows
50871
+ ? this.visibleRows[index]
50799
50872
  : null;
50873
+ index = this.generatedVisibleRows.indexOf(row);
50874
+ if (index < 0)
50875
+ return;
50800
50876
  if (this.generatedVisibleRows && index < this.generatedVisibleRows.length) {
50801
50877
  this.generatedVisibleRows.splice(index, 1);
50802
50878
  }
@@ -54590,14 +54666,12 @@ var QuestionPanelDynamicModel = /** @class */ (function (_super) {
54590
54666
  return;
54591
54667
  this.prepareValueForPanelCreating();
54592
54668
  var panels = [];
54593
- var panel;
54594
54669
  if (this.useTemplatePanel) {
54595
- panel = new QuestionPanelDynamicItem(this, this.template);
54670
+ new QuestionPanelDynamicItem(this, this.template);
54596
54671
  panels.push(this.template);
54597
54672
  }
54598
54673
  else {
54599
54674
  for (var i = 0; i < this.panelCount; i++) {
54600
- panel = this.createNewPanel();
54601
54675
  panels.push(this.createNewPanel());
54602
54676
  }
54603
54677
  }
@@ -55440,14 +55514,8 @@ var QuestionPanelDynamicModel = /** @class */ (function (_super) {
55440
55514
  new _jsonobject__WEBPACK_IMPORTED_MODULE_5__.JsonObject().toObject(json, panel);
55441
55515
  panel.renderWidth = "100%";
55442
55516
  panel.updateCustomWidgets();
55517
+ panel.questions.forEach(function (q) { return q.setParentQuestion(_this); });
55443
55518
  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
55519
  if (this.wasRendered) {
55452
55520
  panel.onFirstRendering();
55453
55521
  panel.locStrsChanged();
@@ -55556,6 +55624,22 @@ var QuestionPanelDynamicModel = /** @class */ (function (_super) {
55556
55624
  QuestionPanelDynamicModel.prototype.isNewValueCorrect = function (val) {
55557
55625
  return Array.isArray(val);
55558
55626
  };
55627
+ QuestionPanelDynamicModel.prototype.getValueChangingOptions = function (childQuestion) {
55628
+ var pnl = childQuestion.parent;
55629
+ while (pnl.parent) {
55630
+ pnl = pnl.parent;
55631
+ }
55632
+ var panel = pnl;
55633
+ var panelIndex = this.panels.indexOf(panel);
55634
+ return {
55635
+ question: this,
55636
+ panel: panel,
55637
+ name: childQuestion.name,
55638
+ panelIndex: panelIndex,
55639
+ panelData: this.getPanelItemDataByIndex(panelIndex),
55640
+ oldValue: childQuestion.value
55641
+ };
55642
+ };
55559
55643
  //IQuestionPanelDynamicData
55560
55644
  QuestionPanelDynamicModel.prototype.getItemIndex = function (item) {
55561
55645
  var res = this.items.indexOf(item);
@@ -55570,8 +55654,10 @@ var QuestionPanelDynamicModel = /** @class */ (function (_super) {
55570
55654
  return visPanels.length;
55571
55655
  };
55572
55656
  QuestionPanelDynamicModel.prototype.getPanelItemData = function (item) {
55657
+ return this.getPanelItemDataByIndex(this.items.indexOf(item));
55658
+ };
55659
+ QuestionPanelDynamicModel.prototype.getPanelItemDataByIndex = function (index) {
55573
55660
  var items = this.items;
55574
- var index = items.indexOf(item);
55575
55661
  var qValue = this.value;
55576
55662
  if (index < 0 && Array.isArray(qValue) && qValue.length > items.length) {
55577
55663
  index = items.length;
@@ -55614,22 +55700,8 @@ var QuestionPanelDynamicModel = /** @class */ (function (_super) {
55614
55700
  if (index >= 0 && index < this.panelsCore.length) {
55615
55701
  this.changingValueQuestion = this.panelsCore[index].getQuestionByValueName(name);
55616
55702
  }
55617
- var options = {
55618
- panel: item.panel,
55619
- name: name,
55620
- panelIndex: index,
55621
- panelData: qValue[index],
55622
- value: val,
55623
- oldValue: oldVal
55624
- };
55625
- if (this.survey) {
55626
- this.survey.dynamicPanelItemValueChanging(this, options);
55627
- }
55628
55703
  this.value = qValue;
55629
55704
  this.changingValueQuestion = null;
55630
- if (this.survey) {
55631
- this.survey.dynamicPanelItemValueChanged(this, options);
55632
- }
55633
55705
  this.isSetPanelItemData[name]--;
55634
55706
  if (this.isSetPanelItemData[name] - 1) {
55635
55707
  delete this.isSetPanelItemData[name];
@@ -59317,6 +59389,8 @@ var QuestionSliderModel = /** @class */ (function (_super) {
59317
59389
  _this.handleRangeOnChange = function (event) {
59318
59390
  if (!_this.isRangeMoving)
59319
59391
  return;
59392
+ if (!_this.isAllowToChange())
59393
+ return;
59320
59394
  var _a = _this, max = _a.renderedMax, min = _a.renderedMin, renderedValue = _a.renderedValue, ensureMaxRangeBorders = _a.ensureMaxRangeBorders, ensureMinRangeBorders = _a.ensureMinRangeBorders;
59321
59395
  var inputNode = event.target;
59322
59396
  var diff = _this.oldInputValue - +inputNode.value;
@@ -59402,7 +59476,7 @@ var QuestionSliderModel = /** @class */ (function (_super) {
59402
59476
  input.style.setProperty("--sjs-range-slider-range-input-thumb-position", "absolute");
59403
59477
  };
59404
59478
  _this.setSliderValue = function (newValue) {
59405
- if (!_this.isReadOnly && !_this.isDisabledAttr && !_this.isPreviewStyle && !_this.isDisabledStyle) {
59479
+ if (_this.isAllowToChange()) {
59406
59480
  var result = void 0;
59407
59481
  if (_this.sliderType === "single") {
59408
59482
  result = Array.isArray(newValue) ? newValue[0] : newValue;
@@ -59462,6 +59536,8 @@ var QuestionSliderModel = /** @class */ (function (_super) {
59462
59536
  refreshInputRange();
59463
59537
  };
59464
59538
  _this.handleOnChange = function (event, inputNumber) {
59539
+ if (!_this.isAllowToChange())
59540
+ return;
59465
59541
  if (_this.oldValue === null)
59466
59542
  return; // Firefox raise one more OnChange after PointerUp and break the value
59467
59543
  var _a = _this, allowSwap = _a.allowSwap, ensureMaxRangeBorders = _a.ensureMaxRangeBorders, ensureMinRangeBorders = _a.ensureMinRangeBorders, renderedValue = _a.renderedValue;
@@ -59833,24 +59909,13 @@ var QuestionSliderModel = /** @class */ (function (_super) {
59833
59909
  QuestionSliderModel.prototype.runConditionCore = function (properties) {
59834
59910
  var _this = this;
59835
59911
  _super.prototype.runConditionCore.call(this, properties);
59836
- this.runMinMaxCondition(this.maxValueExpression, properties, function (value) {
59912
+ this.runExpressionByProperty("maxValueExpression", properties, function (value) {
59837
59913
  _this.max = value !== null && value !== void 0 ? value : _this.renderedMax;
59838
59914
  });
59839
- this.runMinMaxCondition(this.minValueExpression, properties, function (value) {
59915
+ this.runExpressionByProperty("minValueExpression", properties, function (value) {
59840
59916
  _this.min = value !== null && value !== void 0 ? value : _this.renderedMin;
59841
59917
  });
59842
59918
  };
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
59919
  QuestionSliderModel.prototype.initPropertyDependencies = function () {
59855
59920
  var _this = this;
59856
59921
  // this.registerSychProperties(["segmentCount"],
@@ -59958,6 +60023,9 @@ var QuestionSliderModel = /** @class */ (function (_super) {
59958
60023
  }
59959
60024
  return value;
59960
60025
  };
60026
+ QuestionSliderModel.prototype.isAllowToChange = function () {
60027
+ return !this.isReadOnly && !this.isDisabledAttr && !this.isPreviewStyle && !this.isDisabledStyle;
60028
+ };
59961
60029
  __decorate([
59962
60030
  (0,_jsonobject__WEBPACK_IMPORTED_MODULE_5__.property)({ defaultValue: "single" })
59963
60031
  ], QuestionSliderModel.prototype, "sliderType", void 0);
@@ -61200,20 +61268,31 @@ var QuestionTextModel = /** @class */ (function (_super) {
61200
61268
  QuestionTextModel.prototype.setRenderedMinMax = function (properties) {
61201
61269
  var _this = this;
61202
61270
  if (properties === void 0) { properties = null; }
61203
- this.minValueRunner = this.getDefaultRunner(this.minValueRunner, this.minValueExpression);
61204
- this.setValueAndRunExpression(this.minValueRunner, this.min, function (val) {
61271
+ var setProp = function (name, val) {
61272
+ _this.setPropertyValue(name, _this.convertFuncValuetoQuestionValue(val));
61273
+ };
61274
+ var setMin = function (val) {
61205
61275
  if (!val && _this.isDateInputType && !!_settings__WEBPACK_IMPORTED_MODULE_6__.settings.minDate) {
61206
61276
  val = _settings__WEBPACK_IMPORTED_MODULE_6__.settings.minDate;
61207
61277
  }
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) {
61278
+ setProp("renderedMin", val);
61279
+ };
61280
+ var setMax = function (val) {
61212
61281
  if (!val && _this.isDateInputType) {
61213
61282
  val = !!_settings__WEBPACK_IMPORTED_MODULE_6__.settings.maxDate ? _settings__WEBPACK_IMPORTED_MODULE_6__.settings.maxDate : "2999-12-31";
61214
61283
  }
61215
- _this.setPropertyValue("renderedMax", val);
61216
- }, properties);
61284
+ setProp("renderedMax", val);
61285
+ };
61286
+ if (!this.runExpressionByProperty("minValueExpression", properties, function (val) {
61287
+ setMin(val);
61288
+ })) {
61289
+ setMin(this.min);
61290
+ }
61291
+ if (!this.runExpressionByProperty("maxValueExpression", properties, function (val) {
61292
+ setMax(val);
61293
+ })) {
61294
+ setMax(this.max);
61295
+ }
61217
61296
  };
61218
61297
  Object.defineProperty(QuestionTextModel.prototype, "step", {
61219
61298
  /**
@@ -62799,6 +62878,7 @@ var settings = {
62799
62878
  row: "row",
62800
62879
  totalRow: "totalRow",
62801
62880
  rowIndex: "rowIndex",
62881
+ visibleRowIndex: "visibleRowIndex",
62802
62882
  rowValue: "rowValue",
62803
62883
  rowName: "rowName",
62804
62884
  rowTitle: "rowTitle",
@@ -65677,6 +65757,10 @@ var SurveyModel = /** @class */ (function (_super) {
65677
65757
  */
65678
65758
  _this.onDragDropAllow = _this.addEvent();
65679
65759
  _this.onMatrixRowDragOver = _this.addEvent();
65760
+ /**
65761
+ * 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.
65762
+ */
65763
+ _this.onExpressionRunning = _this.addEvent();
65680
65764
  /**
65681
65765
  * 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
65766
  */
@@ -67744,6 +67828,11 @@ var SurveyModel = /** @class */ (function (_super) {
67744
67828
  };
67745
67829
  return exp.runContext(this.getValueGetterContext(), properties) || onCompleteRes;
67746
67830
  };
67831
+ SurveyModel.prototype.beforeExpressionRunning = function (obj, propertyName, expression) {
67832
+ var opt = { element: obj, propertyName: propertyName, expression: expression, allow: true };
67833
+ this.onExpressionRunning.fire(this, opt);
67834
+ return opt.allow ? opt.expression : "";
67835
+ };
67747
67836
  Object.defineProperty(SurveyModel.prototype, "isSettingValueOnExpression", {
67748
67837
  get: function () { return this.setValueOnExpressionCounter > 0; },
67749
67838
  enumerable: false,
@@ -71503,14 +71592,6 @@ var SurveyModel = /** @class */ (function (_super) {
71503
71592
  this.onDynamicPanelRemoving.fire(this, options);
71504
71593
  return options.allow;
71505
71594
  };
71506
- SurveyModel.prototype.dynamicPanelItemValueChanged = function (question, options) {
71507
- options.question = question;
71508
- this.onDynamicPanelValueChanged.fire(this, options);
71509
- };
71510
- SurveyModel.prototype.dynamicPanelItemValueChanging = function (question, options) {
71511
- options.question = question;
71512
- this.onDynamicPanelValueChanging.fire(this, options);
71513
- };
71514
71595
  SurveyModel.prototype.dynamicPanelGetTabTitle = function (question, options) {
71515
71596
  options.question = question;
71516
71597
  this.onGetDynamicPanelTabTitle.fire(this, options);
@@ -72297,15 +72378,14 @@ var SurveyModel = /** @class */ (function (_super) {
72297
72378
  }
72298
72379
  };
72299
72380
  SurveyModel.prototype.runConditionOnValueChanged = function (name, value) {
72381
+ if (!this.questionTriggersKeys) {
72382
+ this.questionTriggersKeys = {};
72383
+ }
72384
+ this.questionTriggersKeys[name] = value;
72300
72385
  if (this.isRunningConditions) {
72301
- if (this.questionTriggersKeys) {
72302
- this.questionTriggersKeys[name] = value;
72303
- }
72304
72386
  this.isValueChangedOnRunningCondition = true;
72305
72387
  }
72306
72388
  else {
72307
- this.questionTriggersKeys = {};
72308
- this.questionTriggersKeys[name] = value;
72309
72389
  this.runConditions();
72310
72390
  this.runQuestionsTriggers(name, value);
72311
72391
  this.questionTriggersKeys = undefined;
@@ -72755,6 +72835,35 @@ var SurveyModel = /** @class */ (function (_super) {
72755
72835
  locNotification = this.getLocNotification(locNotification, newValue, oldValue);
72756
72836
  this.updateOnSetValue(name, newValue, oldValue, locNotification, allowNotifyValueChanged, questionName);
72757
72837
  };
72838
+ SurveyModel.prototype.questionValueChanging = function (question, newValue) {
72839
+ var q = question;
72840
+ var parentQ = q.parentQuestion;
72841
+ if (!parentQ)
72842
+ return newValue;
72843
+ if (parentQ.isDescendantOf("paneldynamic") && !this.onDynamicPanelValueChanging.isEmpty) {
72844
+ var options = parentQ.getValueChangingOptions(q);
72845
+ if (options) {
72846
+ options.value = newValue;
72847
+ this.onDynamicPanelValueChanging.fire(this, options);
72848
+ return options.value;
72849
+ }
72850
+ }
72851
+ return newValue;
72852
+ };
72853
+ SurveyModel.prototype.questionValueChanged = function (question, oldValue) {
72854
+ var q = question;
72855
+ var parentQ = q.parentQuestion;
72856
+ if (!!parentQ) {
72857
+ if (parentQ.isDescendantOf("paneldynamic") && !this.onDynamicPanelValueChanged.isEmpty) {
72858
+ var options = parentQ.getValueChangingOptions(q);
72859
+ if (options) {
72860
+ options.value = q.value;
72861
+ options.oldValue = oldValue;
72862
+ this.onDynamicPanelValueChanged.fire(this, options);
72863
+ }
72864
+ }
72865
+ }
72866
+ };
72758
72867
  SurveyModel.prototype.isValueEmpyOnSetValue = function (name, val) {
72759
72868
  if (!this.isValueEmpty(val, false))
72760
72869
  return false;
@@ -74578,8 +74687,8 @@ _jsonobject__WEBPACK_IMPORTED_MODULE_1__.Serializer.addClass("survey", [
74578
74687
  dependsOn: ["showTOC"],
74579
74688
  visibleIf: function (survey) { return !!survey && survey.showTOC; }
74580
74689
  },
74581
- { name: "readOnly:boolean", default: false },
74582
- { name: "mode", default: "edit", choices: ["edit", "display"], visible: false },
74690
+ { name: "readOnly:boolean" },
74691
+ { name: "mode", visible: false, isSerializable: false },
74583
74692
  { name: "storeOthersAsComment:boolean", default: true },
74584
74693
  { name: "maxTextLength:number", default: 0, minValue: 0 },
74585
74694
  { name: "maxCommentLength:number", default: 0, minValue: 0, alternativeName: "maxOthersLength" },
@@ -75818,10 +75927,9 @@ __webpack_require__.r(__webpack_exports__);
75818
75927
  /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts");
75819
75928
  /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./base */ "./src/base.ts");
75820
75929
  /* 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");
75930
+ /* harmony import */ var _expressions_expressions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./expressions/expressions */ "./src/expressions/expressions.ts");
75931
+ /* harmony import */ var _conditionProcessValue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./conditionProcessValue */ "./src/conditionProcessValue.ts");
75932
+ /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./settings */ "./src/settings.ts");
75825
75933
  var __extends = (undefined && undefined.__extends) || (function () {
75826
75934
  var extendStatics = function (d, b) {
75827
75935
  extendStatics = Object.setPrototypeOf ||
@@ -75843,7 +75951,6 @@ var __extends = (undefined && undefined.__extends) || (function () {
75843
75951
 
75844
75952
 
75845
75953
 
75846
-
75847
75954
  /**
75848
75955
  * A base class for all triggers.
75849
75956
  * A trigger calls a method when the expression change the result: from false to true or from true to false.
@@ -75854,10 +75961,6 @@ var Trigger = /** @class */ (function (_super) {
75854
75961
  function Trigger() {
75855
75962
  var _this = _super.call(this) || this;
75856
75963
  _this.idValue = (Trigger.idCounter++);
75857
- _this.registerPropertyChangedHandlers(["operator", "value", "name"], function () {
75858
- _this.oldPropertiesChanged();
75859
- });
75860
- _this.registerPropertyChangedHandlers(["expression"], function () { _this.onExpressionChanged(); });
75861
75964
  return _this;
75862
75965
  }
75863
75966
  Object.defineProperty(Trigger, "operators", {
@@ -75911,7 +76014,7 @@ var Trigger = /** @class */ (function (_super) {
75911
76014
  };
75912
76015
  Trigger.prototype.toString = function () {
75913
76016
  var res = this.getType().replace("trigger", "");
75914
- var exp = !!this.expression ? this.expression : this.buildExpression();
76017
+ var exp = this.expression;
75915
76018
  if (exp) {
75916
76019
  res += ", " + exp;
75917
76020
  }
@@ -75961,7 +76064,7 @@ var Trigger = /** @class */ (function (_super) {
75961
76064
  });
75962
76065
  Object.defineProperty(Trigger.prototype, "expression", {
75963
76066
  get: function () {
75964
- return this.getPropertyValue("expression", "");
76067
+ return this.getPropertyValue("expression", this.buildExpression());
75965
76068
  },
75966
76069
  set: function (val) {
75967
76070
  this.setPropertyValue("expression", val);
@@ -75976,23 +76079,24 @@ var Trigger = /** @class */ (function (_super) {
75976
76079
  return false;
75977
76080
  };
75978
76081
  Trigger.prototype.checkExpression = function (options) {
76082
+ var _this = this;
75979
76083
  this.isExecutingOnNextPage = options.isOnNextPage;
75980
76084
  this.isExecutingOnNavigation = options.isOnNavigation || options.isOnNextPage;
75981
76085
  if (!this.canBeExecuted(options.isOnNextPage))
75982
76086
  return;
75983
76087
  if (options.isOnComplete && !this.canBeExecutedOnComplete())
75984
76088
  return;
75985
- if (!this.isCheckRequired(options.keys))
75986
- return;
75987
76089
  var keys = Object.keys(options.keys);
75988
76090
  if (Array.isArray(keys) && !this.canBeExecuteOnKeysChange(keys))
75989
76091
  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);
76092
+ var props = options.properties || null;
76093
+ if (!this.runExpressionByProperty("expression", props, function (val) {
76094
+ _this.triggerResult(val === true, props);
76095
+ }, function (runner) {
76096
+ return _this.isCheckRequired(runner, options.keys);
76097
+ })) {
76098
+ if (this.isCheckRequired(null, options.keys) && this.canSuccessOnEmptyExpression()) {
76099
+ this.triggerResult(true, props);
75996
76100
  }
75997
76101
  }
75998
76102
  };
@@ -76014,13 +76118,6 @@ var Trigger = /** @class */ (function (_super) {
76014
76118
  enumerable: false,
76015
76119
  configurable: true
76016
76120
  });
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
76121
  Trigger.prototype.triggerResult = function (res, properties) {
76025
76122
  if (res) {
76026
76123
  this.onSuccess(properties);
@@ -76033,16 +76130,6 @@ var Trigger = /** @class */ (function (_super) {
76033
76130
  Trigger.prototype.onSuccess = function (properties) { };
76034
76131
  Trigger.prototype.onFailure = function () { };
76035
76132
  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
76133
  Trigger.prototype.buildExpression = function () {
76047
76134
  if (!this.name)
76048
76135
  return "";
@@ -76053,22 +76140,21 @@ var Trigger = /** @class */ (function (_super) {
76053
76140
  "} " +
76054
76141
  this.operator +
76055
76142
  " " +
76056
- _expressions_expressions__WEBPACK_IMPORTED_MODULE_4__.OperandMaker.toOperandString(this.value));
76143
+ _expressions_expressions__WEBPACK_IMPORTED_MODULE_3__.OperandMaker.toOperandString(this.value));
76057
76144
  };
76058
- Trigger.prototype.isCheckRequired = function (keys) {
76145
+ Trigger.prototype.isCheckRequired = function (runner, keys) {
76059
76146
  if (!keys)
76060
76147
  return false;
76061
- this.createConditionRunner();
76062
- if (this.conditionRunner && this.conditionRunner.hasFunction() === true)
76148
+ if ((runner === null || runner === void 0 ? void 0 : runner.hasFunction()) === true)
76063
76149
  return true;
76064
- return new _conditionProcessValue__WEBPACK_IMPORTED_MODULE_5__.ValueGetter().isAnyKeyChanged(keys, this.getUsedVariables());
76150
+ return new _conditionProcessValue__WEBPACK_IMPORTED_MODULE_4__.ValueGetter().isAnyKeyChanged(keys, this.getUsedVariables(runner));
76065
76151
  };
76066
- Trigger.prototype.getUsedVariables = function () {
76067
- if (!this.conditionRunner)
76152
+ Trigger.prototype.getUsedVariables = function (runner) {
76153
+ if (!runner)
76068
76154
  return [];
76069
- var res = this.conditionRunner.getVariables();
76155
+ var res = runner.getVariables();
76070
76156
  if (Array.isArray(res)) {
76071
- var unw = _settings__WEBPACK_IMPORTED_MODULE_6__.settings.expressionVariables.unwrapPostfix;
76157
+ var unw = _settings__WEBPACK_IMPORTED_MODULE_5__.settings.expressionVariables.unwrapPostfix;
76072
76158
  for (var i = res.length - 1; i >= 0; i--) {
76073
76159
  var s = res[i];
76074
76160
  if (s.endsWith(unw)) {
@@ -76078,17 +76164,6 @@ var Trigger = /** @class */ (function (_super) {
76078
76164
  }
76079
76165
  return res;
76080
76166
  };
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
76167
  Object.defineProperty(Trigger.prototype, "isRequireValue", {
76093
76168
  get: function () {
76094
76169
  return this.operator !== "empty" && this.operator != "notempty";
@@ -76193,7 +76268,7 @@ var SurveyTriggerComplete = /** @class */ (function (_super) {
76193
76268
  configurable: true
76194
76269
  });
76195
76270
  SurveyTriggerComplete.prototype.isRealExecution = function () {
76196
- return !_settings__WEBPACK_IMPORTED_MODULE_6__.settings.triggers.executeCompleteOnValueChanged === this.isExecutingOnNavigation;
76271
+ return !_settings__WEBPACK_IMPORTED_MODULE_5__.settings.triggers.executeCompleteOnValueChanged === this.isExecutingOnNavigation;
76197
76272
  };
76198
76273
  SurveyTriggerComplete.prototype.onSuccess = function (properties) {
76199
76274
  if (!this.owner)
@@ -76304,7 +76379,7 @@ var SurveyTriggerSkip = /** @class */ (function (_super) {
76304
76379
  configurable: true
76305
76380
  });
76306
76381
  SurveyTriggerSkip.prototype.canBeExecuted = function (isOnNextPage) {
76307
- return isOnNextPage === !_settings__WEBPACK_IMPORTED_MODULE_6__.settings.triggers.executeSkipOnValueChanged;
76382
+ return isOnNextPage === !_settings__WEBPACK_IMPORTED_MODULE_5__.settings.triggers.executeSkipOnValueChanged;
76308
76383
  };
76309
76384
  SurveyTriggerSkip.prototype.onSuccess = function (properties) {
76310
76385
  if (!this.gotoName || !this.owner)
@@ -76350,15 +76425,11 @@ var SurveyTriggerRunExpression = /** @class */ (function (_super) {
76350
76425
  };
76351
76426
  SurveyTriggerRunExpression.prototype.onSuccess = function (properties) {
76352
76427
  var _this = this;
76353
- if (!this.owner || !this.runExpression)
76428
+ if (!this.owner)
76354
76429
  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
- }
76430
+ this.runExpressionByProperty("runExpression", properties, function (res) {
76431
+ _this.onCompleteRunExpression(res);
76432
+ });
76362
76433
  };
76363
76434
  SurveyTriggerRunExpression.prototype.onCompleteRunExpression = function (newValue) {
76364
76435
  if (!!this.setToName && newValue !== undefined) {
@@ -76423,8 +76494,8 @@ var SurveyTriggerCopyValue = /** @class */ (function (_super) {
76423
76494
  this.owner.copyTriggerValue(this.setToName, this.fromName, this.copyDisplayValue);
76424
76495
  };
76425
76496
  SurveyTriggerCopyValue.prototype.canSuccessOnEmptyExpression = function () { return true; };
76426
- SurveyTriggerCopyValue.prototype.getUsedVariables = function () {
76427
- var res = _super.prototype.getUsedVariables.call(this);
76497
+ SurveyTriggerCopyValue.prototype.getUsedVariables = function (runner) {
76498
+ var res = _super.prototype.getUsedVariables.call(this, runner);
76428
76499
  if (res.length === 0 && !!this.fromName) {
76429
76500
  res.push(this.fromName);
76430
76501
  }
@@ -79475,12 +79546,11 @@ var ExpressionValidator = /** @class */ (function (_super) {
79475
79546
  var _this = this;
79476
79547
  if (name === void 0) { name = null; }
79477
79548
  if (properties === void 0) { properties = null; }
79478
- if (!this.expression)
79479
- return null;
79480
79549
  if (!!this.conditionRunner) {
79481
79550
  this.conditionRunner.onRunComplete = null;
79482
79551
  }
79483
- this.ensureConditionRunner(true);
79552
+ if (!this.ensureConditionRunner(true))
79553
+ return null;
79484
79554
  this.conditionRunner.onRunComplete = function (res) {
79485
79555
  _this.isRunningValue = false;
79486
79556
  if (!!_this.onAsyncCompleted) {
@@ -79504,13 +79574,14 @@ var ExpressionValidator = /** @class */ (function (_super) {
79504
79574
  return this.getLocalizationFormatString("invalidExpression", this.expression);
79505
79575
  };
79506
79576
  ExpressionValidator.prototype.ensureConditionRunner = function (reNew) {
79507
- if (!this.expression)
79577
+ var expression = this.getExpressionFromSurvey("expression");
79578
+ if (!expression)
79508
79579
  return false;
79509
79580
  if (reNew || !this.conditionRunner) {
79510
- this.conditionRunner = new _conditions__WEBPACK_IMPORTED_MODULE_3__.ConditionRunner(this.expression);
79581
+ this.conditionRunner = new _conditions__WEBPACK_IMPORTED_MODULE_3__.ConditionRunner(expression);
79511
79582
  }
79512
79583
  else {
79513
- this.conditionRunner.expression = this.expression;
79584
+ this.conditionRunner.expression = expression;
79514
79585
  }
79515
79586
  return true;
79516
79587
  };