survey-pdf 3.0.0-beta.0 → 3.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  <video src="https://github.com/surveyjs/survey-pdf/assets/22315929/c6df9c60-a3ed-40e4-82e7-d7be3fa83fae"></video>
5
5
 
6
6
 
7
- [![Build Status](https://dev.azure.com/SurveyJS/SurveyJS%20Integration%20Tests/_apis/build/status/SurveyJS%20Library?branchName=master)](https://dev.azure.com/SurveyJS/SurveyJS%20Integration%20Tests/_build/latest?definitionId=7&branchName=master)
7
+ [![Build Status](https://dev.azure.com/SurveyJS/V2%20Libraries/_apis/build/status%2Fpdf%2FPDF%20Main?repoName=surveyjs%2Fsurvey-pdf&branchName=master)](https://dev.azure.com/SurveyJS/V2%20Libraries/_build/latest?definitionId=165&repoName=surveyjs%2Fsurvey-pdf&branchName=master)
8
8
  <a href="https://github.com/surveyjs/survey-pdf/issues">
9
9
  <img alt="Issues" title="Open Issues" src="https://img.shields.io/github/issues/surveyjs/survey-pdf.svg">
10
10
  </a>
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - SurveyJS PDF library v3.0.0-beta.0
2
+ * surveyjs - SurveyJS PDF library v3.0.0-beta.1
3
3
  * Copyright (c) 2015-2026 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - SurveyJS PDF library v3.0.0-beta.0
2
+ * surveyjs - SurveyJS PDF library v3.0.0-beta.1
3
3
  * Copyright (c) 2015-2026 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - SurveyJS PDF library v3.0.0-beta.0
2
+ * surveyjs - SurveyJS PDF library v3.0.0-beta.1
3
3
  * Copyright (c) 2015-2026 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - SurveyJS PDF library v3.0.0-beta.0
2
+ * surveyjs - SurveyJS PDF library v3.0.0-beta.1
3
3
  * Copyright (c) 2015-2026 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
5
5
  */
@@ -40,6 +40,8 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
40
40
  };
41
41
 
42
42
  function mergeRects(...rects) {
43
+ if (rects.length == 0)
44
+ return { xLeft: 0, xRight: 0, yTop: 0, yBot: 0 };
43
45
  const resultRect = {
44
46
  xLeft: rects[0].xLeft,
45
47
  xRight: rects[0].xRight,
@@ -1256,8 +1258,9 @@ class FlatQuestion {
1256
1258
  generateFlatsComment(point) {
1257
1259
  return __awaiter(this, void 0, void 0, function* () {
1258
1260
  const text = this.question.locCommentText;
1259
- const otherTextFlat = yield SurveyHelper.createTextFlat(point, this.controller, text);
1261
+ const otherTextFlat = yield SurveyHelper.createTextFlat(point, this.controller, text, this.style.commentLabel);
1260
1262
  const otherPoint = SurveyHelper.createPoint(otherTextFlat);
1263
+ otherPoint.yTop += this.style.spacing.commentLabelGap;
1261
1264
  const shouldRenderReadOnly = SurveyHelper.shouldRenderReadOnly(this.question, this.controller, this.question.isReadOnly);
1262
1265
  const style = SurveyHelper.getPatchedTextStyle(this.controller, SurveyHelper.mergeObjects({}, this.style.comment, shouldRenderReadOnly ? this.style.commentReadOnly : undefined));
1263
1266
  return new CompositeBrick(otherTextFlat, yield SurveyHelper.createCommentFlat(otherPoint, this.controller, {
@@ -2602,6 +2605,9 @@ class SurveyHelper {
2602
2605
  var _a;
2603
2606
  const parsedMergeAngles = typeof mergeAngles == 'object' ? mergeAngles : { top: mergeAngles, bot: mergeAngles, left: mergeAngles, right: mergeAngles };
2604
2607
  const parsedRadius = parseSideValues((_a = style.borderRadius) !== null && _a !== void 0 ? _a : 0);
2608
+ Object.keys(parsedRadius).forEach((side) => {
2609
+ parsedRadius[side] = Math.max(0, Math.min(parsedRadius[side], (rect.xRight - rect.xLeft) / 2, (rect.yBot - rect.yTop) / 2));
2610
+ });
2605
2611
  function calcAngleLine(x, y, r, angle, rotAngle) {
2606
2612
  const l = 4 / 3 * Math.tan(angle / 4) * r;
2607
2613
  const base = [
@@ -7916,6 +7922,12 @@ function getDefaultStyleFromTheme(theme) {
7916
7922
  fontSize: getSizeVariable('--sjs2-typography-font-size-default'),
7917
7923
  lineHeight: getSizeVariable('--sjs2-typography-line-height-default')
7918
7924
  },
7925
+ commentLabel: {
7926
+ fontColor: getColorVariable('--sjs2-color-fg-basic-primary'),
7927
+ fontSize: getSizeVariable('--sjs2-typography-font-size-default'),
7928
+ fontStyle: 'normal',
7929
+ lineHeight: getSizeVariable('--sjs2-typography-line-height-default')
7930
+ },
7919
7931
  spacing: {
7920
7932
  headerContentGap: getSizeVariable('--sjs2-pdf-layout-question-gap'),
7921
7933
  inlineHeaderContentGap: baseSize * 1.0,
@@ -7925,6 +7937,7 @@ function getDefaultStyleFromTheme(theme) {
7925
7937
  titleDescriptionGap: getSizeVariable('--sjs2-pdf-layout-question-labels-gap-vertical'),
7926
7938
  titleRequiredMarkGap: baseSize / 2,
7927
7939
  titleNumberGap: baseSize / 2,
7940
+ commentLabelGap: getSizeVariable('--sjs2-spacing-x050')
7928
7941
  }
7929
7942
  },
7930
7943
  panel: {
@@ -9756,9 +9769,9 @@ class FlatPanel {
9756
9769
  const visibleElements = row.elements.filter(el => el.isVisible);
9757
9770
  visibleElements.forEach((el, i) => {
9758
9771
  const style = this.survey.getElementStyle(el);
9759
- const minWidth = el.minWidth !== 'auto' ? SurveyHelper.parseWidth(el.minWidth, availableWidth, undefined, 'px') : style.minWidth;
9772
+ const minWidth = el.minWidth && el.minWidth !== 'auto' ? SurveyHelper.parseWidth(el.minWidth, availableWidth, undefined, 'px') : style.minWidth;
9760
9773
  const renderWidth = !!el.width ? SurveyHelper.parseWidth(el.width, availableWidth, undefined, 'px') : 0;
9761
- const maxWidth = SurveyHelper.parseWidth(el.maxWidth, availableWidth, undefined, 'px');
9774
+ const maxWidth = SurveyHelper.parseWidth(el.maxWidth ? el.maxWidth : '100%', availableWidth, undefined, 'px');
9762
9775
  const width = Math.min(Math.max(minWidth, renderWidth), maxWidth);
9763
9776
  if (currentAvailableWidth < width + gapBetweenElements) {
9764
9777
  rows.push(currentRow);
@@ -9779,7 +9792,7 @@ class FlatPanel {
9779
9792
  let restWidth = alignValue * row.length;
9780
9793
  while (expandableElements.length > 0 && restWidth > 0) {
9781
9794
  expandableElements = expandableElements.filter(rowEl => {
9782
- const maxWidth = SurveyHelper.parseWidth(rowEl.element.maxWidth, availableWidth, undefined, 'px');
9795
+ const maxWidth = SurveyHelper.parseWidth(rowEl.element.maxWidth ? rowEl.element.maxWidth : '100%', availableWidth, undefined, 'px');
9783
9796
  if (maxWidth > rowEl.width + alignValue) {
9784
9797
  restWidth -= alignValue;
9785
9798
  rowEl.width = rowEl.width + alignValue;
@@ -10982,21 +10995,22 @@ class FlatRating extends FlatQuestion {
10982
10995
  const availableWidth = SurveyHelper.getPageAvailableWidth(this.controller);
10983
10996
  let leftWidth = availableWidth;
10984
10997
  this.question.visibleRateValues.forEach((item, index) => {
10985
- if (!res[currentRowsIndex]) {
10986
- res.push([]);
10987
- }
10988
10998
  const locText = this.getItemText(index, item.locText);
10989
10999
  const width = this.getItemWidth(locText);
10990
- if (currentColumnIndex !== 0 && width + this.style.spacing.choiceColumnGap > leftWidth) {
11000
+ const itemInfo = { index, item, locText, width };
11001
+ const widthGap = width + (currentColumnIndex == 0 ? 0 : this.style.spacing.choiceColumnGap);
11002
+ if (currentColumnIndex !== 0 && widthGap > leftWidth) {
10991
11003
  currentRowsIndex++;
10992
- currentColumnIndex = 0;
10993
- leftWidth = availableWidth;
11004
+ leftWidth = availableWidth - width;
10994
11005
  }
10995
11006
  else {
10996
- leftWidth -= width + (currentColumnIndex == 0 ? 0 : this.style.spacing.choiceColumnGap);
10997
- currentColumnIndex++;
10998
- res[currentRowsIndex].push({ index, item, locText, width });
11007
+ leftWidth -= widthGap;
11008
+ }
11009
+ currentColumnIndex++;
11010
+ if (res.length <= currentRowsIndex) {
11011
+ res.push([]);
10999
11012
  }
11013
+ res[currentRowsIndex].push(itemInfo);
11000
11014
  });
11001
11015
  return res;
11002
11016
  }
@@ -11936,7 +11950,7 @@ class CustomBrick extends PdfBrick {
11936
11950
  }
11937
11951
  }
11938
11952
 
11939
- checkLibraryVersion(`${"3.0.0-beta.0"}`, 'survey-pdf');
11953
+ checkLibraryVersion(`${"3.0.0-beta.1"}`, 'survey-pdf');
11940
11954
 
11941
11955
  function rgbaToHex(rgbaString) {
11942
11956
  const parts = rgbaString.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+),?\s*([0-9.]+)?\)$/);