survey-core 1.9.115 → 1.9.116

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 (229) hide show
  1. package/defaultV2.css +119 -85
  2. package/defaultV2.css.map +1 -1
  3. package/defaultV2.fontless.css +119 -85
  4. package/defaultV2.fontless.css.map +1 -1
  5. package/defaultV2.fontless.min.css +2 -2
  6. package/defaultV2.min.css +2 -2
  7. package/i18n/arabic.js +1 -1
  8. package/i18n/arabic.min.js +1 -1
  9. package/i18n/basque.js +1 -1
  10. package/i18n/basque.min.js +1 -1
  11. package/i18n/bulgarian.js +1 -1
  12. package/i18n/bulgarian.min.js +1 -1
  13. package/i18n/catalan.js +1 -1
  14. package/i18n/catalan.min.js +1 -1
  15. package/i18n/croatian.js +1 -1
  16. package/i18n/croatian.min.js +1 -1
  17. package/i18n/czech.js +1 -1
  18. package/i18n/czech.min.js +1 -1
  19. package/i18n/danish.js +1 -1
  20. package/i18n/danish.min.js +1 -1
  21. package/i18n/dutch.js +1 -1
  22. package/i18n/dutch.min.js +1 -1
  23. package/i18n/english.js +1 -1
  24. package/i18n/english.min.js +1 -1
  25. package/i18n/estonian.js +1 -1
  26. package/i18n/estonian.min.js +1 -1
  27. package/i18n/finnish.js +1 -1
  28. package/i18n/finnish.min.js +1 -1
  29. package/i18n/french.js +1 -1
  30. package/i18n/french.min.js +1 -1
  31. package/i18n/georgian.js +1 -1
  32. package/i18n/georgian.min.js +1 -1
  33. package/i18n/german.js +1 -1
  34. package/i18n/german.min.js +1 -1
  35. package/i18n/greek.js +1 -1
  36. package/i18n/greek.min.js +1 -1
  37. package/i18n/hebrew.js +1 -1
  38. package/i18n/hebrew.min.js +1 -1
  39. package/i18n/hindi.js +1 -1
  40. package/i18n/hindi.min.js +1 -1
  41. package/i18n/hungarian.js +1 -1
  42. package/i18n/hungarian.min.js +1 -1
  43. package/i18n/icelandic.js +1 -1
  44. package/i18n/icelandic.min.js +1 -1
  45. package/i18n/index.js +1 -1
  46. package/i18n/index.min.js +1 -1
  47. package/i18n/indonesian.js +1 -1
  48. package/i18n/indonesian.min.js +1 -1
  49. package/i18n/italian.js +1 -1
  50. package/i18n/italian.min.js +1 -1
  51. package/i18n/japanese.js +1 -1
  52. package/i18n/japanese.min.js +1 -1
  53. package/i18n/kazakh.js +1 -1
  54. package/i18n/kazakh.min.js +1 -1
  55. package/i18n/korean.js +1 -1
  56. package/i18n/korean.min.js +1 -1
  57. package/i18n/latvian.js +1 -1
  58. package/i18n/latvian.min.js +1 -1
  59. package/i18n/lithuanian.js +1 -1
  60. package/i18n/lithuanian.min.js +1 -1
  61. package/i18n/macedonian.js +1 -1
  62. package/i18n/macedonian.min.js +1 -1
  63. package/i18n/malay.js +1 -1
  64. package/i18n/malay.min.js +1 -1
  65. package/i18n/nl-BE.js +1 -1
  66. package/i18n/nl-BE.min.js +1 -1
  67. package/i18n/norwegian.js +1 -1
  68. package/i18n/norwegian.min.js +1 -1
  69. package/i18n/persian.js +1 -1
  70. package/i18n/persian.min.js +1 -1
  71. package/i18n/polish.js +1 -1
  72. package/i18n/polish.min.js +1 -1
  73. package/i18n/portuguese-br.js +1 -1
  74. package/i18n/portuguese-br.min.js +1 -1
  75. package/i18n/portuguese.js +1 -1
  76. package/i18n/portuguese.min.js +1 -1
  77. package/i18n/romanian.js +1 -1
  78. package/i18n/romanian.min.js +1 -1
  79. package/i18n/russian.js +1 -1
  80. package/i18n/russian.min.js +1 -1
  81. package/i18n/serbian.js +1 -1
  82. package/i18n/serbian.min.js +1 -1
  83. package/i18n/simplified-chinese.js +1 -1
  84. package/i18n/simplified-chinese.min.js +1 -1
  85. package/i18n/slovak.js +1 -1
  86. package/i18n/slovak.min.js +1 -1
  87. package/i18n/spanish.js +1 -1
  88. package/i18n/spanish.min.js +1 -1
  89. package/i18n/swahili.js +1 -1
  90. package/i18n/swahili.min.js +1 -1
  91. package/i18n/swedish.js +1 -1
  92. package/i18n/swedish.min.js +1 -1
  93. package/i18n/tajik.js +1 -1
  94. package/i18n/tajik.min.js +1 -1
  95. package/i18n/telugu.js +1 -1
  96. package/i18n/telugu.min.js +1 -1
  97. package/i18n/thai.js +1 -1
  98. package/i18n/thai.min.js +1 -1
  99. package/i18n/traditional-chinese.js +1 -1
  100. package/i18n/traditional-chinese.min.js +1 -1
  101. package/i18n/turkish.js +1 -1
  102. package/i18n/turkish.min.js +1 -1
  103. package/i18n/ukrainian.js +1 -1
  104. package/i18n/ukrainian.min.js +1 -1
  105. package/i18n/urdu.js +1 -1
  106. package/i18n/urdu.min.js +1 -1
  107. package/i18n/vietnamese.js +1 -1
  108. package/i18n/vietnamese.min.js +1 -1
  109. package/i18n/welsh.js +1 -1
  110. package/i18n/welsh.min.js +1 -1
  111. package/modern.css +20 -11
  112. package/modern.css.map +1 -1
  113. package/modern.fontless.css +20 -11
  114. package/modern.fontless.css.map +1 -1
  115. package/modern.fontless.min.css +2 -2
  116. package/modern.min.css +2 -2
  117. package/package.json +1 -1
  118. package/plugins/bootstrap-integration.js +1 -1
  119. package/plugins/bootstrap-integration.min.js +1 -1
  120. package/plugins/bootstrap-material-integration.js +1 -1
  121. package/plugins/bootstrap-material-integration.min.js +1 -1
  122. package/survey.core.js +133 -65
  123. package/survey.core.js.map +1 -1
  124. package/survey.core.min.js +3 -3
  125. package/survey.css +11 -2
  126. package/survey.css.map +1 -1
  127. package/survey.i18n.js +1 -1
  128. package/survey.i18n.min.js +1 -1
  129. package/survey.min.css +2 -2
  130. package/themes/borderless-dark-panelless.js +1 -1
  131. package/themes/borderless-dark-panelless.min.js +1 -1
  132. package/themes/borderless-dark.js +1 -1
  133. package/themes/borderless-dark.min.js +1 -1
  134. package/themes/borderless-light-panelless..js +1 -1
  135. package/themes/borderless-light-panelless..min.js +1 -1
  136. package/themes/borderless-light.js +1 -1
  137. package/themes/borderless-light.min.js +1 -1
  138. package/themes/contrast-dark-panelless.js +1 -1
  139. package/themes/contrast-dark-panelless.min.js +1 -1
  140. package/themes/contrast-dark.js +1 -1
  141. package/themes/contrast-dark.min.js +1 -1
  142. package/themes/contrast-light-panelless.js +1 -1
  143. package/themes/contrast-light-panelless.min.js +1 -1
  144. package/themes/contrast-light.js +1 -1
  145. package/themes/contrast-light.min.js +1 -1
  146. package/themes/default-dark-panelless.js +1 -1
  147. package/themes/default-dark-panelless.min.js +1 -1
  148. package/themes/default-dark.js +1 -1
  149. package/themes/default-dark.min.js +1 -1
  150. package/themes/default-light-panelless.js +1 -1
  151. package/themes/default-light-panelless.min.js +1 -1
  152. package/themes/default-light.js +1 -1
  153. package/themes/default-light.min.js +1 -1
  154. package/themes/doubleborder-dark-panelless.js +1 -1
  155. package/themes/doubleborder-dark-panelless.min.js +1 -1
  156. package/themes/doubleborder-dark.js +1 -1
  157. package/themes/doubleborder-dark.min.js +1 -1
  158. package/themes/doubleborder-light-panelles.js +1 -1
  159. package/themes/doubleborder-light-panelles.min.js +1 -1
  160. package/themes/doubleborder-light.js +1 -1
  161. package/themes/doubleborder-light.min.js +1 -1
  162. package/themes/flat-dark-panelless.js +1 -1
  163. package/themes/flat-dark-panelless.min.js +1 -1
  164. package/themes/flat-dark.js +1 -1
  165. package/themes/flat-dark.min.js +1 -1
  166. package/themes/flat-light-panelless.js +1 -1
  167. package/themes/flat-light-panelless.min.js +1 -1
  168. package/themes/flat-light.js +1 -1
  169. package/themes/flat-light.min.js +1 -1
  170. package/themes/index.js +1 -1
  171. package/themes/index.min.js +1 -1
  172. package/themes/layered-dark-panelless.js +1 -1
  173. package/themes/layered-dark-panelless.min.js +1 -1
  174. package/themes/layered-dark.js +1 -1
  175. package/themes/layered-dark.min.js +1 -1
  176. package/themes/layered-light-panelless.js +1 -1
  177. package/themes/layered-light-panelless.min.js +1 -1
  178. package/themes/layered-light.js +1 -1
  179. package/themes/layered-light.min.js +1 -1
  180. package/themes/plain-dark-panelless.js +1 -1
  181. package/themes/plain-dark-panelless.min.js +1 -1
  182. package/themes/plain-dark.js +1 -1
  183. package/themes/plain-dark.min.js +1 -1
  184. package/themes/plain-light-panelless.js +1 -1
  185. package/themes/plain-light-panelless.min.js +1 -1
  186. package/themes/plain-light.js +1 -1
  187. package/themes/plain-light.min.js +1 -1
  188. package/themes/sharp-dark-panelless.js +1 -1
  189. package/themes/sharp-dark-panelless.min.js +1 -1
  190. package/themes/sharp-dark.js +1 -1
  191. package/themes/sharp-dark.min.js +1 -1
  192. package/themes/sharp-light-panelless.js +1 -1
  193. package/themes/sharp-light-panelless.min.js +1 -1
  194. package/themes/sharp-light.js +1 -1
  195. package/themes/sharp-light.min.js +1 -1
  196. package/themes/solid-dark-panelless.js +1 -1
  197. package/themes/solid-dark-panelless.min.js +1 -1
  198. package/themes/solid-dark.js +1 -1
  199. package/themes/solid-dark.min.js +1 -1
  200. package/themes/solid-light-panelless.js +1 -1
  201. package/themes/solid-light-panelless.min.js +1 -1
  202. package/themes/solid-light.js +1 -1
  203. package/themes/solid-light.min.js +1 -1
  204. package/themes/three-dimensional-dark-panelless.js +1 -1
  205. package/themes/three-dimensional-dark-panelless.min.js +1 -1
  206. package/themes/three-dimensional-dark.js +1 -1
  207. package/themes/three-dimensional-dark.min.js +1 -1
  208. package/themes/three-dimensional-light-panelless.js +1 -1
  209. package/themes/three-dimensional-light-panelless.min.js +1 -1
  210. package/themes/three-dimensional-light.js +1 -1
  211. package/themes/three-dimensional-light.min.js +1 -1
  212. package/ts3.4/typings/actions/action.d.ts +7 -7
  213. package/ts3.4/typings/question.d.ts +1 -0
  214. package/ts3.4/typings/question_comment.d.ts +1 -0
  215. package/ts3.4/typings/question_multipletext.d.ts +1 -1
  216. package/ts3.4/typings/question_paneldynamic.d.ts +2 -2
  217. package/ts3.4/typings/question_rating.d.ts +8 -8
  218. package/ts3.4/typings/question_signaturepad.d.ts +30 -1
  219. package/ts3.4/typings/survey-events-api.d.ts +3 -3
  220. package/ts3.4/typings/survey.d.ts +12 -12
  221. package/typings/actions/action.d.ts +7 -7
  222. package/typings/question.d.ts +1 -0
  223. package/typings/question_comment.d.ts +1 -0
  224. package/typings/question_multipletext.d.ts +1 -1
  225. package/typings/question_paneldynamic.d.ts +2 -2
  226. package/typings/question_rating.d.ts +8 -8
  227. package/typings/question_signaturepad.d.ts +30 -1
  228. package/typings/survey-events-api.d.ts +3 -3
  229. package/typings/survey.d.ts +12 -12
package/survey.core.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - Survey JavaScript library v1.9.115
2
+ * surveyjs - Survey JavaScript library v1.9.116
3
3
  * Copyright (c) 2015-2023 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
5
5
  */
@@ -9259,8 +9259,8 @@ __webpack_require__.r(__webpack_exports__);
9259
9259
  //import "../../modern.scss";
9260
9260
  var Version;
9261
9261
  var ReleaseDate;
9262
- Version = "" + "1.9.115";
9263
- ReleaseDate = "" + "2023-11-01";
9262
+ Version = "" + "1.9.116";
9263
+ ReleaseDate = "" + "2023-11-07";
9264
9264
  function checkLibraryVersion(ver, libraryName) {
9265
9265
  if (Version != ver) {
9266
9266
  var str = "survey-core has version '" + Version + "' and " + libraryName
@@ -27563,7 +27563,7 @@ var Question = /** @class */ (function (_super) {
27563
27563
  if (updateIsAnswered === void 0) { updateIsAnswered = true; }
27564
27564
  newValue = this.convertToCorrectValue(newValue);
27565
27565
  var isEqual = this.isTwoValueEquals(this.questionValue, newValue);
27566
- if (!isEqual && !this.isChangingViaDefaultValue) {
27566
+ if (!isEqual && !this.isChangingViaDefaultValue && !this.isParentChangingViaDefaultValue) {
27567
27567
  this.setValueChangedDirectly(true);
27568
27568
  }
27569
27569
  this.questionValue = newValue;
@@ -27575,6 +27575,14 @@ var Question = /** @class */ (function (_super) {
27575
27575
  if (updateIsAnswered)
27576
27576
  this.updateIsAnswered();
27577
27577
  };
27578
+ Object.defineProperty(Question.prototype, "isParentChangingViaDefaultValue", {
27579
+ get: function () {
27580
+ var _a;
27581
+ return ((_a = this.data) === null || _a === void 0 ? void 0 : _a.isChangingViaDefaultValue) === true;
27582
+ },
27583
+ enumerable: false,
27584
+ configurable: true
27585
+ });
27578
27586
  Question.prototype.onSurveyValueChanged = function (newValue) { };
27579
27587
  Question.prototype.setVisibleIndex = function (val) {
27580
27588
  if (!this.isVisible ||
@@ -28037,7 +28045,7 @@ _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("question", [
28037
28045
  "enableIf:condition",
28038
28046
  "resetValueIf:condition",
28039
28047
  "setValueIf:condition",
28040
- { name: "setValueExpression:expression", visibleIf: function (obj) { return !!obj.setValueIf; } },
28048
+ "setValueExpression:expression",
28041
28049
  "defaultValue:value",
28042
28050
  {
28043
28051
  name: "defaultValueExpression:expression",
@@ -31951,6 +31959,11 @@ var QuestionCommentModel = /** @class */ (function (_super) {
31951
31959
  event.stopPropagation();
31952
31960
  }
31953
31961
  };
31962
+ QuestionCommentModel.prototype.setQuestionValue = function (newValue, updateIsAnswered) {
31963
+ if (updateIsAnswered === void 0) { updateIsAnswered = true; }
31964
+ _super.prototype.setQuestionValue.call(this, newValue, updateIsAnswered);
31965
+ this.updateElement();
31966
+ };
31954
31967
  QuestionCommentModel.prototype.onValueChanged = function () {
31955
31968
  _super.prototype.onValueChanged.call(this);
31956
31969
  this.updateElement();
@@ -34752,7 +34765,9 @@ var QuestionFileModel = /** @class */ (function (_super) {
34752
34765
  if (_this.survey) {
34753
34766
  _this.survey.uploadFiles(_this, _this.name, files, function (status, data) {
34754
34767
  if (status === "error") {
34768
+ _this.errors.push(new _error__WEBPACK_IMPORTED_MODULE_4__["UploadingFileError"](data, _this));
34755
34769
  _this.stateChanged("error");
34770
+ _this.stateChanged("loaded");
34756
34771
  }
34757
34772
  if (status === "success") {
34758
34773
  _this.value = (_this.value || []).concat(data.map(function (r) {
@@ -40778,7 +40793,7 @@ _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("matrixdropdownc
40778
40793
  "requiredIf:condition",
40779
40794
  "resetValueIf:condition",
40780
40795
  "setValueIf:condition",
40781
- { name: "setValueExpression:expression", visibleIf: function (obj) { return !!obj.setValueIf; } },
40796
+ "setValueExpression:expression",
40782
40797
  {
40783
40798
  name: "showInMultipleColumns:boolean",
40784
40799
  dependsOn: "cellType",
@@ -43190,7 +43205,7 @@ var MultipleTextEditorModel = /** @class */ (function (_super) {
43190
43205
  /**
43191
43206
  * A class that describes an item in a [Multiple Textboxes](https://surveyjs.io/form-library/documentation/api-reference/multiple-text-entry-question-model) question.
43192
43207
  *
43193
- * [View Demo](/form-library/examples/multiple-text-box-question/)
43208
+ * [View Demo](https://surveyjs.io/form-library/examples/multiple-text-box-question/)
43194
43209
  */
43195
43210
  var MultipleTextItemModel = /** @class */ (function (_super) {
43196
43211
  __extends(MultipleTextItemModel, _super);
@@ -44671,7 +44686,7 @@ var QuestionPanelDynamicModel = /** @class */ (function (_super) {
44671
44686
  *
44672
44687
  * If you want to customize individual tab titles, handle `SurveyModel`'s [`onGetDynamicPanelTabTitle`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onGetDynamicPanelTabTitle) event.
44673
44688
  *
44674
- * [View Demo](/form-library/examples/tabbed-interface-for-duplicate-group-option/ (linkStyle))
44689
+ * [View Demo](https://surveyjs.io/form-library/examples/tabbed-interface-for-duplicate-group-option/ (linkStyle))
44675
44690
  * @see templateTitle
44676
44691
  * @see renderMode
44677
44692
  */
@@ -45458,7 +45473,7 @@ var QuestionPanelDynamicModel = /** @class */ (function (_super) {
45458
45473
  * - `"progressTop"` - Renders each panel as a card and displays a progress bar at the top. [View Demo](https://surveyjs.io/form-library/examples/questiontype-paneldynamic/)
45459
45474
  * - `"progressBottom"` - Renders each panel panel as a card and displays a progress bar at the bottom.
45460
45475
  * - `"progressTopBottom"` - Renders each panel as a card and displays a progress bar at the top and bottom.
45461
- * - `"tab"` - Renders each panel within a tab. Use the [`templateTabTitle`](https://surveyjs.io/form-library/documentation/api-reference/dynamic-panel-model#templateTabTitle) to specify a template for tab titles. [View Demo](/form-library/examples/tabbed-interface-for-duplicate-group-option/)
45476
+ * - `"tab"` - Renders each panel within a tab. Use the [`templateTabTitle`](https://surveyjs.io/form-library/documentation/api-reference/dynamic-panel-model#templateTabTitle) to specify a template for tab titles. [View Demo](https://surveyjs.io/form-library/examples/tabbed-interface-for-duplicate-group-option/)
45462
45477
  */
45463
45478
  get: function () {
45464
45479
  return this.getPropertyValue("renderMode");
@@ -47941,7 +47956,7 @@ var QuestionRatingModel = /** @class */ (function (_super) {
47941
47956
  *
47942
47957
  * If you do not specify the `rateValues` property, rate values are generated automatically based upon the [`rateMin`](https://surveyjs.io/form-library/documentation/api-reference/rating-scale-question-model#rateMin), [`rateMax`](https://surveyjs.io/form-library/documentation/api-reference/rating-scale-question-model#rateMax), [`rateStep`](https://surveyjs.io/form-library/documentation/api-reference/rating-scale-question-model#rateStep), and [`rateCount`](https://surveyjs.io/form-library/documentation/api-reference/rating-scale-question-model#rateCount) property values.
47943
47958
  *
47944
- * [View Demo](/form-library/examples/rating-scale/ (linkStyle))
47959
+ * [View Demo](https://surveyjs.io/form-library/examples/rating-scale/ (linkStyle))
47945
47960
  */
47946
47961
  get: function () {
47947
47962
  return this.getPropertyValue("rateValues");
@@ -47959,7 +47974,7 @@ var QuestionRatingModel = /** @class */ (function (_super) {
47959
47974
  *
47960
47975
  * Default value: 1
47961
47976
  *
47962
- * [View Demo](/form-library/examples/rating-scale/ (linkStyle))
47977
+ * [View Demo](https://surveyjs.io/form-library/examples/rating-scale/ (linkStyle))
47963
47978
  * @see rateMax
47964
47979
  * @see rateStep
47965
47980
  * @see rateCount
@@ -47979,7 +47994,7 @@ var QuestionRatingModel = /** @class */ (function (_super) {
47979
47994
  *
47980
47995
  * Default value: 5
47981
47996
  *
47982
- * [View Demo](/form-library/examples/rating-scale/ (linkStyle))
47997
+ * [View Demo](https://surveyjs.io/form-library/examples/rating-scale/ (linkStyle))
47983
47998
  * @see rateMin
47984
47999
  * @see rateStep
47985
48000
  * @see rateCount
@@ -47999,7 +48014,7 @@ var QuestionRatingModel = /** @class */ (function (_super) {
47999
48014
  *
48000
48015
  * Default value: 1
48001
48016
  *
48002
- * [View Demo](/form-library/examples/rating-scale/ (linkStyle))
48017
+ * [View Demo](https://surveyjs.io/form-library/examples/rating-scale/ (linkStyle))
48003
48018
  * @see rateMin
48004
48019
  * @see rateMax
48005
48020
  * @see rateCount
@@ -48785,12 +48800,11 @@ _questionfactory__WEBPACK_IMPORTED_MODULE_3__["QuestionFactory"].Instance.regist
48785
48800
  /*!**************************************!*\
48786
48801
  !*** ./src/question_signaturepad.ts ***!
48787
48802
  \**************************************/
48788
- /*! exports provided: getCanvasRatio, QuestionSignaturePadModel */
48803
+ /*! exports provided: QuestionSignaturePadModel */
48789
48804
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
48790
48805
 
48791
48806
  "use strict";
48792
48807
  __webpack_require__.r(__webpack_exports__);
48793
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCanvasRatio", function() { return getCanvasRatio; });
48794
48808
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionSignaturePadModel", function() { return QuestionSignaturePadModel; });
48795
48809
  /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts");
48796
48810
  /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts");
@@ -48827,28 +48841,6 @@ var __decorate = (undefined && undefined.__decorate) || function (decorators, ta
48827
48841
 
48828
48842
  var defaultWidth = 300;
48829
48843
  var defaultHeight = 200;
48830
- function getCanvasRatio(canvas) {
48831
- var context = canvas.getContext("2d");
48832
- var devicePixelRatio = window.devicePixelRatio || 1;
48833
- var backingStoreRatio = context.webkitBackingStorePixelRatio ||
48834
- context.mozBackingStorePixelRatio ||
48835
- context.msBackingStorePixelRatio ||
48836
- context.oBackingStorePixelRatio ||
48837
- context.backingStorePixelRatio ||
48838
- 1;
48839
- return devicePixelRatio / backingStoreRatio;
48840
- }
48841
- function resizeCanvas(canvas) {
48842
- var context = canvas.getContext("2d");
48843
- var ratio = getCanvasRatio(canvas);
48844
- var oldWidth = canvas.width;
48845
- var oldHeight = canvas.height;
48846
- canvas.width = oldWidth * ratio;
48847
- canvas.height = oldHeight * ratio;
48848
- canvas.style.width = oldWidth + "px";
48849
- canvas.style.height = oldHeight + "px";
48850
- context.scale(ratio, ratio);
48851
- }
48852
48844
  /**
48853
48845
  * A class that describes the Signature question type.
48854
48846
  *
@@ -48857,7 +48849,13 @@ function resizeCanvas(canvas) {
48857
48849
  var QuestionSignaturePadModel = /** @class */ (function (_super) {
48858
48850
  __extends(QuestionSignaturePadModel, _super);
48859
48851
  function QuestionSignaturePadModel(name) {
48860
- return _super.call(this, name) || this;
48852
+ var _this = _super.call(this, name) || this;
48853
+ _this.valueIsUpdatingInternally = false;
48854
+ _this.updateValueHandler = function () {
48855
+ _this.scaleCanvas(false, true);
48856
+ _this.refreshCanvas();
48857
+ };
48858
+ return _this;
48861
48859
  }
48862
48860
  QuestionSignaturePadModel.prototype.getPenColorFromTheme = function () {
48863
48861
  var _survey = this.survey;
@@ -48883,7 +48881,9 @@ var QuestionSignaturePadModel = /** @class */ (function (_super) {
48883
48881
  var format = this.dataFormat === "jpeg" ? "image/jpeg" :
48884
48882
  (this.dataFormat === "svg" ? "image/svg+xml" : "");
48885
48883
  var data = this.signaturePad.toDataURL(format);
48884
+ this.valueIsUpdatingInternally = true;
48886
48885
  this.value = data;
48886
+ this.valueIsUpdatingInternally = false;
48887
48887
  }
48888
48888
  };
48889
48889
  QuestionSignaturePadModel.prototype.getType = function () {
@@ -48905,10 +48905,44 @@ var QuestionSignaturePadModel = /** @class */ (function (_super) {
48905
48905
  this.updateColors(this.signaturePad);
48906
48906
  }
48907
48907
  };
48908
+ QuestionSignaturePadModel.prototype.resizeCanvas = function () {
48909
+ this.canvas.width = this.containerWidth;
48910
+ this.canvas.height = this.containerHeight;
48911
+ };
48912
+ QuestionSignaturePadModel.prototype.scaleCanvas = function (refresh, resize) {
48913
+ if (refresh === void 0) { refresh = true; }
48914
+ if (resize === void 0) { resize = false; }
48915
+ var canvas = this.canvas;
48916
+ var scale = canvas.offsetWidth / this.containerWidth;
48917
+ if (this.scale != scale || resize) {
48918
+ this.scale = scale;
48919
+ canvas.style.width = this.renderedCanvasWidth;
48920
+ this.resizeCanvas();
48921
+ this.signaturePad.minWidth = this.penMinWidth * scale;
48922
+ this.signaturePad.maxWidth = this.penMaxWidth * scale;
48923
+ canvas.getContext("2d").scale(1 / scale, 1 / scale);
48924
+ if (refresh)
48925
+ this.refreshCanvas();
48926
+ }
48927
+ };
48928
+ QuestionSignaturePadModel.prototype.refreshCanvas = function () {
48929
+ var data = this.value;
48930
+ var canvas = this.canvas;
48931
+ if (!data) {
48932
+ canvas.getContext("2d").clearRect(0, 0, canvas.width * this.scale, canvas.height * this.scale);
48933
+ this.signaturePad.clear();
48934
+ }
48935
+ else {
48936
+ this.signaturePad.fromDataURL(data, { width: canvas.width * this.scale, height: canvas.height * this.scale });
48937
+ }
48938
+ };
48908
48939
  QuestionSignaturePadModel.prototype.initSignaturePad = function (el) {
48909
48940
  var _this = this;
48910
48941
  var canvas = el.getElementsByTagName("canvas")[0];
48942
+ this.canvas = canvas;
48943
+ this.resizeCanvas();
48911
48944
  var signaturePad = new signature_pad__WEBPACK_IMPORTED_MODULE_3__["default"](canvas, { backgroundColor: "#ffffff" });
48945
+ this.signaturePad = signaturePad;
48912
48946
  if (this.isInputReadOnly) {
48913
48947
  signaturePad.off();
48914
48948
  }
@@ -48922,6 +48956,7 @@ var QuestionSignaturePadModel = /** @class */ (function (_super) {
48922
48956
  };
48923
48957
  this.updateColors(signaturePad);
48924
48958
  signaturePad.addEventListener("beginStroke", function () {
48959
+ _this.scaleCanvas();
48925
48960
  _this.isDrawingValue = true;
48926
48961
  canvas.focus();
48927
48962
  }, { once: false });
@@ -48929,24 +48964,12 @@ var QuestionSignaturePadModel = /** @class */ (function (_super) {
48929
48964
  _this.isDrawingValue = false;
48930
48965
  _this.updateValue();
48931
48966
  }, { once: false });
48932
- var updateValueHandler = function () {
48933
- var data = _this.value;
48934
- canvas.width = _this.signatureWidth || defaultWidth;
48935
- canvas.height = _this.signatureHeight || defaultHeight;
48936
- resizeCanvas(canvas);
48937
- if (!data) {
48938
- signaturePad.clear();
48939
- }
48940
- else {
48941
- signaturePad.fromDataURL(data);
48942
- }
48943
- };
48944
- updateValueHandler();
48967
+ this.updateValueHandler();
48945
48968
  this.readOnlyChangedCallback();
48946
- this.signaturePad = signaturePad;
48947
48969
  var propertyChangedHandler = function (sender, options) {
48948
48970
  if (options.name === "signatureWidth" || options.name === "signatureHeight" || options.name === "value") {
48949
- updateValueHandler();
48971
+ if (!_this.valueIsUpdatingInternally)
48972
+ _this.updateValueHandler();
48950
48973
  }
48951
48974
  };
48952
48975
  this.onPropertyChanged.add(propertyChangedHandler);
@@ -49005,6 +49028,27 @@ var QuestionSignaturePadModel = /** @class */ (function (_super) {
49005
49028
  enumerable: false,
49006
49029
  configurable: true
49007
49030
  });
49031
+ Object.defineProperty(QuestionSignaturePadModel.prototype, "containerHeight", {
49032
+ get: function () {
49033
+ return this.signatureHeight || defaultHeight;
49034
+ },
49035
+ enumerable: false,
49036
+ configurable: true
49037
+ });
49038
+ Object.defineProperty(QuestionSignaturePadModel.prototype, "containerWidth", {
49039
+ get: function () {
49040
+ return this.signatureWidth || defaultWidth;
49041
+ },
49042
+ enumerable: false,
49043
+ configurable: true
49044
+ });
49045
+ Object.defineProperty(QuestionSignaturePadModel.prototype, "renderedCanvasWidth", {
49046
+ get: function () {
49047
+ return this.signatureAutoScaleEnabled ? "100%" : this.containerWidth + "px";
49048
+ },
49049
+ enumerable: false,
49050
+ configurable: true
49051
+ });
49008
49052
  Object.defineProperty(QuestionSignaturePadModel.prototype, "height", {
49009
49053
  //todo: need to remove this property
49010
49054
  get: function () {
@@ -49125,6 +49169,15 @@ var QuestionSignaturePadModel = /** @class */ (function (_super) {
49125
49169
  __decorate([
49126
49170
  Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: false })
49127
49171
  ], QuestionSignaturePadModel.prototype, "isDrawingValue", void 0);
49172
+ __decorate([
49173
+ Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: false })
49174
+ ], QuestionSignaturePadModel.prototype, "signatureAutoScaleEnabled", void 0);
49175
+ __decorate([
49176
+ Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: 0.5 })
49177
+ ], QuestionSignaturePadModel.prototype, "penMinWidth", void 0);
49178
+ __decorate([
49179
+ Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: 2.5 })
49180
+ ], QuestionSignaturePadModel.prototype, "penMaxWidth", void 0);
49128
49181
  __decorate([
49129
49182
  Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({})
49130
49183
  ], QuestionSignaturePadModel.prototype, "showPlaceholder", void 0);
@@ -49153,6 +49206,21 @@ _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("signaturepad",
49153
49206
  category: "general",
49154
49207
  default: 200,
49155
49208
  },
49209
+ {
49210
+ name: "signatureAutoScaleEnabled:boolean",
49211
+ category: "general",
49212
+ default: false,
49213
+ },
49214
+ {
49215
+ name: "penMinWidth:number",
49216
+ category: "general",
49217
+ default: 0.5,
49218
+ },
49219
+ {
49220
+ name: "penMaxWidth:number",
49221
+ category: "general",
49222
+ default: 2.5,
49223
+ },
49156
49224
  //need to remove this property
49157
49225
  {
49158
49226
  name: "height:number",
@@ -53717,16 +53785,16 @@ var SurveyModel = /** @class */ (function (_super) {
53717
53785
  *
53718
53786
  * For information on event handler parameters, refer to descriptions within the interface.
53719
53787
  *
53720
- * [View Demo](/form-library/examples/customize-survey-with-css/ (linkStyle))
53788
+ * [View Demo](https://surveyjs.io/form-library/examples/customize-survey-with-css/ (linkStyle))
53721
53789
  * @see css
53722
53790
  */
53723
53791
  _this.onUpdateQuestionCssClasses = _this.addEvent();
53724
53792
  /**
53725
- * An event that is raised before rendering a standalone panel and panels within [Dynamic Panel](/form-library/examples/duplicate-group-of-fields-in-form/). Use it to override default panel CSS classes.
53793
+ * An event that is raised before rendering a standalone panel and panels within [Dynamic Panel](https://surveyjs.io/form-library/examples/duplicate-group-of-fields-in-form/). Use it to override default panel CSS classes.
53726
53794
  *
53727
53795
  * For information on event handler parameters, refer to descriptions within the interface.
53728
53796
  *
53729
- * [View Demo](/form-library/examples/customize-survey-with-css/ (linkStyle))
53797
+ * [View Demo](https://surveyjs.io/form-library/examples/customize-survey-with-css/ (linkStyle))
53730
53798
  * @see css
53731
53799
  */
53732
53800
  _this.onUpdatePanelCssClasses = _this.addEvent();
@@ -53735,7 +53803,7 @@ var SurveyModel = /** @class */ (function (_super) {
53735
53803
  *
53736
53804
  * For information on event handler parameters, refer to descriptions within the interface.
53737
53805
  *
53738
- * [View Demo](/form-library/examples/customize-survey-with-css/ (linkStyle))
53806
+ * [View Demo](https://surveyjs.io/form-library/examples/customize-survey-with-css/ (linkStyle))
53739
53807
  * @see css
53740
53808
  */
53741
53809
  _this.onUpdatePageCssClasses = _this.addEvent();
@@ -53744,7 +53812,7 @@ var SurveyModel = /** @class */ (function (_super) {
53744
53812
  *
53745
53813
  * For information on event handler parameters, refer to descriptions within the interface.
53746
53814
  *
53747
- * [View Demo](/form-library/examples/customize-survey-with-css/ (linkStyle))
53815
+ * [View Demo](https://surveyjs.io/form-library/examples/customize-survey-with-css/ (linkStyle))
53748
53816
  * @see css
53749
53817
  */
53750
53818
  _this.onUpdateChoiceItemCss = _this.addEvent();
@@ -53836,7 +53904,7 @@ var SurveyModel = /** @class */ (function (_super) {
53836
53904
  */
53837
53905
  _this.onMatrixRowAdding = _this.addEvent();
53838
53906
  /**
53839
- * This event is obsolete. Use the [`onMatrixRowAdding`](/form-library/documentation/api-reference/survey-data-model#onMatrixRowAdding) event instead.
53907
+ * This event is obsolete. Use the [`onMatrixRowAdding`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onMatrixRowAdding) event instead.
53840
53908
  */
53841
53909
  _this.onMatrixBeforeRowAdded = _this.onMatrixRowAdding;
53842
53910
  /**
@@ -53856,7 +53924,7 @@ var SurveyModel = /** @class */ (function (_super) {
53856
53924
  */
53857
53925
  _this.onMatrixRenderRemoveButton = _this.addEvent();
53858
53926
  /**
53859
- * This event is obsolete. Use the [`onMatrixRenderRemoveButton`](/form-library/documentation/api-reference/survey-data-model#onMatrixRenderRemoveButton) event instead.
53927
+ * This event is obsolete. Use the [`onMatrixRenderRemoveButton`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onMatrixRenderRemoveButton) event instead.
53860
53928
  */
53861
53929
  _this.onMatrixAllowRemoveRow = _this.onMatrixRenderRemoveButton;
53862
53930
  /**
@@ -53875,7 +53943,7 @@ var SurveyModel = /** @class */ (function (_super) {
53875
53943
  */
53876
53944
  _this.onAfterRenderMatrixCell = _this.addEvent();
53877
53945
  /**
53878
- * This event is obsolete. Use the [`onAfterRenderMatrixCell`](/form-library/documentation/api-reference/survey-data-model#onAfterRenderMatrixCell) event instead.
53946
+ * This event is obsolete. Use the [`onAfterRenderMatrixCell`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onAfterRenderMatrixCell) event instead.
53879
53947
  */
53880
53948
  _this.onMatrixAfterCellRender = _this.onAfterRenderMatrixCell;
53881
53949
  /**
@@ -53933,7 +54001,7 @@ var SurveyModel = /** @class */ (function (_super) {
53933
54001
  *
53934
54002
  * For information on event handler parameters, refer to descriptions within the interface.
53935
54003
  *
53936
- * [View Demo](/form-library/examples/tabbed-interface-for-duplicate-group-option/ (linkStyle))
54004
+ * [View Demo](https://surveyjs.io/form-library/examples/tabbed-interface-for-duplicate-group-option/ (linkStyle))
53937
54005
  */
53938
54006
  _this.onGetDynamicPanelTabTitle = _this.addEvent();
53939
54007
  /**
@@ -54362,7 +54430,7 @@ var SurveyModel = /** @class */ (function (_super) {
54362
54430
  /**
54363
54431
  * Gets or sets an object in which keys are UI elements and values are CSS classes applied to them.
54364
54432
  *
54365
- * [View Demo](/form-library/examples/customize-survey-with-css/ (linkStyle))
54433
+ * [View Demo](https://surveyjs.io/form-library/examples/customize-survey-with-css/ (linkStyle))
54366
54434
  */
54367
54435
  get: function () {
54368
54436
  if (!this.cssValue) {
@@ -61179,8 +61247,8 @@ var SurveyModel = /** @class */ (function (_super) {
61179
61247
  /**
61180
61248
  * Applies a specified theme to the survey.
61181
61249
  *
61182
- * [Themes & Styles](/form-library/documentation/manage-default-themes-and-styles (linkStyle))
61183
- * @param theme An [`ITheme`](/form-library/documentation/api-reference/itheme) object with theme settings.
61250
+ * [Themes & Styles](https://surveyjs.io/form-library/documentation/manage-default-themes-and-styles (linkStyle))
61251
+ * @param theme An [`ITheme`](https://surveyjs.io/form-library/documentation/api-reference/itheme) object with theme settings.
61184
61252
  */
61185
61253
  SurveyModel.prototype.applyTheme = function (theme) {
61186
61254
  var _this = this;