survey-pdf 2.0.6 → 2.0.7

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - SurveyJS PDF library v2.0.6
2
+ * surveyjs - SurveyJS PDF library v2.0.7
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
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - SurveyJS PDF library v2.0.6
2
+ * surveyjs - SurveyJS PDF library v2.0.7
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
  */
@@ -8200,8 +8200,8 @@ class FlatFile extends FlatQuestion {
8200
8200
  return compositeFlat;
8201
8201
  });
8202
8202
  }
8203
- addLine(rowsFlats, currPoint, index) {
8204
- if (index !== this.question.previewValue.length - 1) {
8203
+ addLine(rowsFlats, currPoint, index, previewValue) {
8204
+ if (index !== previewValue.length - 1) {
8205
8205
  rowsFlats[rowsFlats.length - 1].addBrick(SurveyHelper.createRowlineFlat(currPoint, this.controller));
8206
8206
  currPoint.yTop += SurveyHelper.EPSILON;
8207
8207
  rowsFlats.push(new CompositeBrick());
@@ -8214,17 +8214,18 @@ class FlatFile extends FlatQuestion {
8214
8214
  }
8215
8215
  generateFlatsContent(point) {
8216
8216
  return __awaiter(this, void 0, void 0, function* () {
8217
- if (this.question.previewValue.length === 0) {
8217
+ const previewValue = this.question.showPreview ? this.question.previewValue : this.question.value;
8218
+ if (!previewValue || previewValue.length === 0) {
8218
8219
  return [yield SurveyHelper.createTextFlat(point, this.question, this.controller, this.question.noFileChosenCaption, TextBrick)];
8219
8220
  }
8220
8221
  const rowsFlats = [new CompositeBrick()];
8221
8222
  const currPoint = SurveyHelper.clone(point);
8222
8223
  let yBot = currPoint.yTop;
8223
- for (let i = 0; i < this.question.previewValue.length; i++) {
8224
- let item = Object.assign({}, this.question.previewValue[i]);
8224
+ for (let i = 0; i < previewValue.length; i++) {
8225
+ let item = Object.assign({}, previewValue[i]);
8225
8226
  const canPreviewImage = SurveyHelper.canPreviewImage(this.question, item, item.content);
8226
8227
  if (canPreviewImage) {
8227
- item.imageSize = yield SurveyHelper.getCorrectedImageSize(this.controller, { imageWidth: this.question.imageWidth, imageHeight: this.question.imageHeight, imageLink: this.question.previewValue[i].content, defaultImageWidth: 200, defaultImageHeight: 150 });
8228
+ item.imageSize = yield SurveyHelper.getCorrectedImageSize(this.controller, { imageWidth: this.question.imageWidth, imageHeight: this.question.imageHeight, imageLink: previewValue[i].content, defaultImageWidth: 200, defaultImageHeight: 150 });
8228
8229
  }
8229
8230
  const availableWidth = this.controller.paperWidth -
8230
8231
  this.controller.margins.right - currPoint.xLeft;
@@ -8233,7 +8234,7 @@ class FlatFile extends FlatQuestion {
8233
8234
  if (availableWidth < compositeWidth) {
8234
8235
  currPoint.xLeft = point.xLeft;
8235
8236
  currPoint.yTop = yBot;
8236
- this.addLine(rowsFlats, currPoint, i);
8237
+ this.addLine(rowsFlats, currPoint, i, previewValue);
8237
8238
  }
8238
8239
  this.controller.pushMargins(currPoint.xLeft, this.controller.paperWidth - currPoint.xLeft - compositeWidth);
8239
8240
  const itemFlat = yield this.generateFlatItem(currPoint, item);
@@ -8246,7 +8247,7 @@ class FlatFile extends FlatQuestion {
8246
8247
  if (availableWidth < this.controller.unitWidth) {
8247
8248
  currPoint.xLeft = point.xLeft;
8248
8249
  currPoint.yTop = yBot;
8249
- this.addLine(rowsFlats, currPoint, i);
8250
+ this.addLine(rowsFlats, currPoint, i, previewValue);
8250
8251
  }
8251
8252
  const itemFlat = yield this.generateFlatItem(currPoint, item);
8252
8253
  rowsFlats[rowsFlats.length - 1].addBrick(itemFlat);
@@ -9263,7 +9264,7 @@ class CustomBrick extends PdfBrick {
9263
9264
  }
9264
9265
  }
9265
9266
 
9266
- checkLibraryVersion(`${"2.0.6"}`, 'survey-pdf');
9267
+ checkLibraryVersion(`${"2.0.7"}`, 'survey-pdf');
9267
9268
 
9268
9269
  export { BooleanItemBrick, CheckItemBrick, CheckboxItemBrick, CommentBrick, CompositeBrick, CustomBrick, DocController, DocOptions, DrawCanvas, DropdownBrick, EmptyBrick, EventHandler, FlatBooleanCheckbox as FlatBoolean, FlatCheckbox, FlatComment, FlatCustomModel, FlatDropdown, FlatExpression, FlatFile, FlatHTML, FlatImage, FlatImagePicker, FlatMatrix, FlatMatrixDynamic, FlatMatrixMultiple, FlatMultipleText, FlatPanelDynamic, FlatQuestion, FlatQuestionDefault, FlatRadiogroup, FlatRanking, FlatRating, FlatRepository, FlatSelectBase, FlatSignaturePad, FlatSurvey, FlatTextbox, HTMLBrick, HorizontalAlign, ImageBrick, LinkBrick, PagePacker, PdfBrick, RadioItemBrick, RankingItemBrick, RowlineBrick, SurveyHelper, SurveyPDF, TextBoldBrick, TextBoxBrick, TextBrick, TextFieldBrick, TitlePanelBrick, VerticalAlign };
9269
9270
  //# sourceMappingURL=survey.pdf.mjs.map