survey-pdf 2.2.6 → 2.3.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/fesm/pdf-form-filler-shared.mjs +1 -1
- package/fesm/pdf-form-filler.mjs +1 -1
- package/fesm/pdf-form-filler.node.mjs +1 -1
- package/fesm/survey.pdf.fonts.mjs +1 -1
- package/fesm/survey.pdf.mjs +81 -58
- package/fesm/survey.pdf.mjs.map +1 -1
- package/package.json +2 -2
- package/pdf-form-filler.js +1 -1
- package/pdf-form-filler.min.js.LICENSE.txt +1 -1
- package/pdf-form-filler.node.js +1 -1
- package/pdf-form-filler.node.min.js.LICENSE.txt +1 -1
- package/survey.pdf.fonts.js +1 -1
- package/survey.pdf.fonts.min.js.LICENSE.txt +1 -1
- package/survey.pdf.js +165 -113
- package/survey.pdf.js.map +1 -1
- package/survey.pdf.min.js +1 -1
- package/survey.pdf.min.js.LICENSE.txt +1 -1
- package/typings/flat_layout/flat_dropdown.d.ts +1 -0
- package/typings/flat_layout/flat_matrix.d.ts +10 -6
- package/typings/flat_layout/flat_selectbase.d.ts +3 -1
- package/typings/helper_survey.d.ts +0 -1
package/fesm/pdf-form-filler.mjs
CHANGED
package/fesm/survey.pdf.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* surveyjs - SurveyJS PDF library v2.
|
|
2
|
+
* surveyjs - SurveyJS PDF library v2.3.1
|
|
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
|
*/
|
|
@@ -1710,19 +1710,6 @@ class SurveyHelper {
|
|
|
1710
1710
|
return text.renderedHtml;
|
|
1711
1711
|
return text.renderedText || text.renderedHtml;
|
|
1712
1712
|
}
|
|
1713
|
-
static getDropdownQuestionValue(question) {
|
|
1714
|
-
const qDropDown = question;
|
|
1715
|
-
if (qDropDown.isOtherSelected) {
|
|
1716
|
-
return qDropDown.otherText;
|
|
1717
|
-
}
|
|
1718
|
-
else if (!!question.displayValue) {
|
|
1719
|
-
return question.displayValue;
|
|
1720
|
-
}
|
|
1721
|
-
else if (qDropDown.showOptionsCaption) {
|
|
1722
|
-
return qDropDown.optionsCaption;
|
|
1723
|
-
}
|
|
1724
|
-
return '';
|
|
1725
|
-
}
|
|
1726
1713
|
static getContentQuestion(question) {
|
|
1727
1714
|
return !!question.contentQuestion ? question.contentQuestion : question;
|
|
1728
1715
|
}
|
|
@@ -7834,6 +7821,19 @@ class FlatSelectBase extends FlatQuestion {
|
|
|
7834
7821
|
this.controller = controller;
|
|
7835
7822
|
this.question = question;
|
|
7836
7823
|
}
|
|
7824
|
+
generateItemComment(point, item) {
|
|
7825
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
7826
|
+
const commentModel = this.question.getCommentTextAreaModel(item);
|
|
7827
|
+
return yield SurveyHelper.createCommentFlat(point, this.question, this.controller, {
|
|
7828
|
+
fieldName: commentModel.id,
|
|
7829
|
+
rows: SurveyHelper.OTHER_ROWS_COUNT,
|
|
7830
|
+
value: commentModel.getTextValue(),
|
|
7831
|
+
shouldRenderBorders: settings.readOnlyCommentRenderMode === 'textarea',
|
|
7832
|
+
isReadOnly: this.question.isReadOnly,
|
|
7833
|
+
isMultiline: true,
|
|
7834
|
+
});
|
|
7835
|
+
});
|
|
7836
|
+
}
|
|
7837
7837
|
generateFlatComposite(point, item, index) {
|
|
7838
7838
|
return __awaiter(this, void 0, void 0, function* () {
|
|
7839
7839
|
const compositeFlat = new CompositeBrick();
|
|
@@ -7845,18 +7845,10 @@ class FlatSelectBase extends FlatQuestion {
|
|
|
7845
7845
|
if (item.locText.renderedHtml !== null) {
|
|
7846
7846
|
compositeFlat.addBrick(yield SurveyHelper.createTextFlat(textPoint, this.question, this.controller, item.locText, TextBrick));
|
|
7847
7847
|
}
|
|
7848
|
-
if (item
|
|
7849
|
-
|
|
7850
|
-
const otherPoint = SurveyHelper.createPoint(compositeFlat);
|
|
7848
|
+
if (item.isCommentShowing) {
|
|
7849
|
+
const otherPoint = SurveyHelper.createPoint(compositeFlat, true, false);
|
|
7851
7850
|
otherPoint.yTop += this.controller.unitHeight * SurveyHelper.GAP_BETWEEN_ROWS;
|
|
7852
|
-
compositeFlat.addBrick(yield
|
|
7853
|
-
fieldName: this.question.id + '_comment' + index,
|
|
7854
|
-
rows: SurveyHelper.OTHER_ROWS_COUNT,
|
|
7855
|
-
value: this.question.comment !== undefined && this.question.comment !== null ? this.question.comment : '',
|
|
7856
|
-
shouldRenderBorders: settings.readOnlyCommentRenderMode === 'textarea',
|
|
7857
|
-
isReadOnly: this.question.isReadOnly,
|
|
7858
|
-
isMultiline: true,
|
|
7859
|
-
}));
|
|
7851
|
+
compositeFlat.addBrick(yield this.generateItemComment(otherPoint, item));
|
|
7860
7852
|
}
|
|
7861
7853
|
return compositeFlat;
|
|
7862
7854
|
});
|
|
@@ -8140,7 +8132,7 @@ class DropdownBrick extends PdfBrick {
|
|
|
8140
8132
|
comboBox.fontSize = this.fontSize;
|
|
8141
8133
|
comboBox.readOnly = this.question.isReadOnly;
|
|
8142
8134
|
comboBox.isUnicode = SurveyHelper.isCustomFont(this.controller, comboBox.fontName);
|
|
8143
|
-
comboBox.V = this.getCorrectedText(
|
|
8135
|
+
comboBox.V = this.getCorrectedText(this.question.readOnlyText || '');
|
|
8144
8136
|
this.controller.doc.addField(comboBox);
|
|
8145
8137
|
SurveyHelper.renderFlatBorders(this.controller, this);
|
|
8146
8138
|
});
|
|
@@ -8154,27 +8146,33 @@ class FlatDropdown extends FlatQuestion {
|
|
|
8154
8146
|
this.controller = controller;
|
|
8155
8147
|
this.question = question;
|
|
8156
8148
|
}
|
|
8149
|
+
generateItemComment(point) {
|
|
8150
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
8151
|
+
const commentModel = this.question.getCommentTextAreaModel(this.question.selectedItem);
|
|
8152
|
+
return yield SurveyHelper.createCommentFlat(point, this.question, this.controller, {
|
|
8153
|
+
fieldName: commentModel.id,
|
|
8154
|
+
rows: SurveyHelper.OTHER_ROWS_COUNT,
|
|
8155
|
+
value: commentModel.getTextValue(),
|
|
8156
|
+
shouldRenderBorders: settings.readOnlyCommentRenderMode === 'textarea',
|
|
8157
|
+
isReadOnly: this.question.isReadOnly,
|
|
8158
|
+
isMultiline: true,
|
|
8159
|
+
});
|
|
8160
|
+
});
|
|
8161
|
+
}
|
|
8157
8162
|
generateFlatsContent(point) {
|
|
8158
8163
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8159
8164
|
const valueBrick = !this.shouldRenderAsComment ? new DropdownBrick(this.question, this.controller, SurveyHelper.createTextFieldRect(point, this.controller)) : yield SurveyHelper.createCommentFlat(point, this.question, this.controller, {
|
|
8160
8165
|
fieldName: this.question.id,
|
|
8161
8166
|
shouldRenderBorders: settings.readOnlyTextRenderMode === 'input',
|
|
8162
|
-
value:
|
|
8167
|
+
value: this.question.readOnlyText || '',
|
|
8163
8168
|
isReadOnly: this.question.isReadOnly,
|
|
8164
8169
|
placeholder: SurveyHelper.getLocString(this.question.locPlaceholder)
|
|
8165
8170
|
});
|
|
8166
8171
|
const compositeFlat = new CompositeBrick(valueBrick);
|
|
8167
|
-
if (this.question.
|
|
8172
|
+
if (this.question.isShowingChoiceComment) {
|
|
8168
8173
|
const otherPoint = SurveyHelper.createPoint(compositeFlat);
|
|
8169
8174
|
otherPoint.yTop += this.controller.unitHeight * SurveyHelper.GAP_BETWEEN_ROWS;
|
|
8170
|
-
compositeFlat.addBrick(yield
|
|
8171
|
-
fieldName: this.question.id + '_comment',
|
|
8172
|
-
rows: SurveyHelper.OTHER_ROWS_COUNT,
|
|
8173
|
-
value: this.question.comment !== undefined && this.question.comment !== null ? this.question.comment : '',
|
|
8174
|
-
shouldRenderBorders: settings.readOnlyCommentRenderMode === 'textarea',
|
|
8175
|
-
isReadOnly: this.question.isReadOnly,
|
|
8176
|
-
isMultiline: true,
|
|
8177
|
-
}));
|
|
8175
|
+
compositeFlat.addBrick(yield this.generateItemComment(otherPoint));
|
|
8178
8176
|
}
|
|
8179
8177
|
return [compositeFlat];
|
|
8180
8178
|
});
|
|
@@ -8906,10 +8904,10 @@ class FlatMatrix extends FlatQuestion {
|
|
|
8906
8904
|
}
|
|
8907
8905
|
}
|
|
8908
8906
|
FlatMatrix.GAP_BETWEEN_ROWS = 0.5;
|
|
8909
|
-
class FlatMatrixRow
|
|
8907
|
+
class FlatMatrixRow {
|
|
8910
8908
|
constructor(survey, question, controller, row, rowIndex, key, isFirst = false, isVertical = false, rowTitleWidth, columnWidth) {
|
|
8911
|
-
super(survey, question, controller);
|
|
8912
8909
|
this.survey = survey;
|
|
8910
|
+
this.question = question;
|
|
8913
8911
|
this.controller = controller;
|
|
8914
8912
|
this.row = row;
|
|
8915
8913
|
this.rowIndex = rowIndex;
|
|
@@ -8918,7 +8916,6 @@ class FlatMatrixRow extends FlatRadiogroup {
|
|
|
8918
8916
|
this.isVertical = isVertical;
|
|
8919
8917
|
this.rowTitleWidth = rowTitleWidth;
|
|
8920
8918
|
this.columnWidth = columnWidth;
|
|
8921
|
-
this.questionMatrix = question;
|
|
8922
8919
|
}
|
|
8923
8920
|
generateFlatsContent(point) {
|
|
8924
8921
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -8927,25 +8924,40 @@ class FlatMatrixRow extends FlatRadiogroup {
|
|
|
8927
8924
|
yield this.generateFlatsHorizontallyCells(point);
|
|
8928
8925
|
});
|
|
8929
8926
|
}
|
|
8927
|
+
generateFlatItem(rect, item, index, key, context = {}) {
|
|
8928
|
+
const fieldName = this.question.id + key;
|
|
8929
|
+
const isChecked = this.row.isChecked(item);
|
|
8930
|
+
if (this.question.isMultiSelect) {
|
|
8931
|
+
return new CheckItemBrick(this.controller, rect, fieldName + 'index' + index, { question: this.question, index, checked: isChecked, item, readOnly: this.question.isReadOnly });
|
|
8932
|
+
}
|
|
8933
|
+
else {
|
|
8934
|
+
if (index === 0) {
|
|
8935
|
+
this.radioGroupWrap = new RadioGroupWrap(fieldName, this.controller, Object.assign({ readOnly: this.question.isReadOnly, question: this.question }, context));
|
|
8936
|
+
this.question.pdfRadioGroupWrap = this.radioGroupWrap;
|
|
8937
|
+
}
|
|
8938
|
+
else if (typeof this.radioGroupWrap === 'undefined') {
|
|
8939
|
+
this.radioGroupWrap = this.question.pdfRadioGroupWrap;
|
|
8940
|
+
}
|
|
8941
|
+
return new RadioItemBrick(this.controller, rect, { question: this.question, index: index, checked: isChecked, item: item }, this.radioGroupWrap);
|
|
8942
|
+
}
|
|
8943
|
+
}
|
|
8930
8944
|
generateTextComposite(point, column, index) {
|
|
8931
8945
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8932
8946
|
const currPoint = SurveyHelper.clone(point);
|
|
8933
|
-
const checked = this.row.value == column.value;
|
|
8934
8947
|
const itemRect = SurveyHelper.createRect(currPoint, SurveyHelper.getPageAvailableWidth(this.controller), this.controller.unitHeight);
|
|
8935
|
-
const radioFlat = this.generateFlatItem(itemRect, column, index, this.key,
|
|
8948
|
+
const radioFlat = this.generateFlatItem(itemRect, column, index, this.key, { row: this.row, rowIndex: this.rowIndex });
|
|
8936
8949
|
currPoint.yTop = radioFlat.yBot + this.controller.unitHeight * SurveyHelper.GAP_BETWEEN_ITEM_TEXT;
|
|
8937
|
-
const cellTextFlat = yield SurveyHelper.createTextFlat(currPoint, this.
|
|
8950
|
+
const cellTextFlat = yield SurveyHelper.createTextFlat(currPoint, this.question, this.controller, this.question.getCellDisplayLocText(this.row.name, column), TextBrick);
|
|
8938
8951
|
return new CompositeBrick(radioFlat, cellTextFlat);
|
|
8939
8952
|
});
|
|
8940
8953
|
}
|
|
8941
|
-
|
|
8954
|
+
generateItemComposite(point, column, index) {
|
|
8942
8955
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8943
8956
|
const currPoint = SurveyHelper.clone(point);
|
|
8944
|
-
const checked = this.row.value == column.value;
|
|
8945
8957
|
const itemRect = SurveyHelper.createRect(currPoint, this.controller.unitHeight, this.controller.unitHeight);
|
|
8946
|
-
const radioFlat = this.generateFlatItem(SurveyHelper.moveRect(SurveyHelper.scaleRect(itemRect, SurveyHelper.SELECT_ITEM_FLAT_SCALE), itemRect.xLeft), column, index, this.key,
|
|
8958
|
+
const radioFlat = this.generateFlatItem(SurveyHelper.moveRect(SurveyHelper.scaleRect(itemRect, SurveyHelper.SELECT_ITEM_FLAT_SCALE), itemRect.xLeft), column, index, this.key, { row: this.row, rowIndex: this.rowIndex });
|
|
8947
8959
|
currPoint.xLeft = radioFlat.xRight + this.controller.unitWidth * SurveyHelper.GAP_BETWEEN_ITEM_TEXT;
|
|
8948
|
-
const radioText = yield SurveyHelper.createTextFlat(currPoint, this.
|
|
8960
|
+
const radioText = yield SurveyHelper.createTextFlat(currPoint, this.question, this.controller, column.locText, TextBrick);
|
|
8949
8961
|
return new CompositeBrick(radioFlat, radioText);
|
|
8950
8962
|
});
|
|
8951
8963
|
}
|
|
@@ -8953,26 +8965,26 @@ class FlatMatrixRow extends FlatRadiogroup {
|
|
|
8953
8965
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8954
8966
|
const cells = [];
|
|
8955
8967
|
const currPoint = SurveyHelper.clone(point);
|
|
8956
|
-
if (this.
|
|
8968
|
+
if (this.question.hasRows) {
|
|
8957
8969
|
this.controller.pushMargins();
|
|
8958
8970
|
currPoint.xLeft = this.controller.margins.left;
|
|
8959
8971
|
this.controller.margins.right += (SurveyHelper.getPageAvailableWidth(this.controller) - this.rowTitleWidth);
|
|
8960
|
-
cells.push(yield SurveyHelper.createTextFlat(currPoint, this.
|
|
8972
|
+
cells.push(yield SurveyHelper.createTextFlat(currPoint, this.question, this.controller, this.row.locText, TextBrick));
|
|
8961
8973
|
currPoint.xLeft += this.rowTitleWidth + this.controller.unitWidth * SurveyHelper.GAP_BETWEEN_COLUMNS;
|
|
8962
8974
|
this.controller.popMargins();
|
|
8963
8975
|
}
|
|
8964
|
-
for (let i = 0; i < this.
|
|
8965
|
-
const column = this.
|
|
8966
|
-
|
|
8976
|
+
for (let i = 0; i < this.question.visibleColumns.length; i++) {
|
|
8977
|
+
const column = this.question.visibleColumns[i];
|
|
8978
|
+
this.row.value == column.value;
|
|
8967
8979
|
this.controller.pushMargins();
|
|
8968
8980
|
this.controller.margins.left = currPoint.xLeft;
|
|
8969
8981
|
this.controller.margins.right += (SurveyHelper.getPageAvailableWidth(this.controller) - this.columnWidth);
|
|
8970
|
-
if (this.
|
|
8982
|
+
if (this.question.hasCellText) {
|
|
8971
8983
|
cells.push(yield this.generateTextComposite(currPoint, column, i));
|
|
8972
8984
|
}
|
|
8973
8985
|
else {
|
|
8974
8986
|
const itemRect = SurveyHelper.createRect(currPoint, this.controller.unitHeight, this.controller.unitHeight);
|
|
8975
|
-
cells.push(this.generateFlatItem(SurveyHelper.moveRect(SurveyHelper.scaleRect(itemRect, SurveyHelper.SELECT_ITEM_FLAT_SCALE), currPoint.xLeft), column, i, this.key,
|
|
8987
|
+
cells.push(this.generateFlatItem(SurveyHelper.moveRect(SurveyHelper.scaleRect(itemRect, SurveyHelper.SELECT_ITEM_FLAT_SCALE), currPoint.xLeft), column, i, this.key, { row: this.row, rowIndex: this.rowIndex }));
|
|
8976
8988
|
}
|
|
8977
8989
|
currPoint.xLeft += this.columnWidth + this.controller.unitWidth * SurveyHelper.GAP_BETWEEN_COLUMNS;
|
|
8978
8990
|
this.controller.popMargins();
|
|
@@ -8985,17 +8997,28 @@ class FlatMatrixRow extends FlatRadiogroup {
|
|
|
8985
8997
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8986
8998
|
const cells = [];
|
|
8987
8999
|
const currPoint = SurveyHelper.clone(point);
|
|
8988
|
-
if (this.
|
|
8989
|
-
const rowTextFlat = yield SurveyHelper.createTextFlat(currPoint, this.
|
|
9000
|
+
if (this.question.hasRows) {
|
|
9001
|
+
const rowTextFlat = yield SurveyHelper.createTextFlat(currPoint, this.question, this.controller, this.row.locText, TextBrick);
|
|
8990
9002
|
currPoint.yTop = rowTextFlat.yBot + FlatQuestion.CONTENT_GAP_VERT_SCALE * this.controller.unitHeight;
|
|
8991
9003
|
cells.push(rowTextFlat);
|
|
8992
9004
|
}
|
|
8993
|
-
|
|
8994
|
-
cells.push(...yield this.generateVerticallyItems(currPoint, this.questionMatrix.visibleColumns));
|
|
9005
|
+
cells.push(...yield this.generateVerticallyItems(currPoint, this.question.visibleColumns));
|
|
8995
9006
|
const compositeBrick = new CompositeBrick(...cells);
|
|
8996
9007
|
return [compositeBrick, SurveyHelper.createRowlineFlat(SurveyHelper.createPoint(compositeBrick), this.controller)];
|
|
8997
9008
|
});
|
|
8998
9009
|
}
|
|
9010
|
+
generateVerticallyItems(point, itemValues) {
|
|
9011
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9012
|
+
const currPoint = SurveyHelper.clone(point);
|
|
9013
|
+
const flats = [];
|
|
9014
|
+
for (let i = 0; i < itemValues.length; i++) {
|
|
9015
|
+
const itemFlat = yield ((this.question.hasCellText) ? this.generateTextComposite : this.generateItemComposite).call(this, currPoint, itemValues[i], i);
|
|
9016
|
+
currPoint.yTop = itemFlat.yBot + SurveyHelper.GAP_BETWEEN_ROWS * this.controller.unitHeight;
|
|
9017
|
+
flats.push(itemFlat);
|
|
9018
|
+
}
|
|
9019
|
+
return flats;
|
|
9020
|
+
});
|
|
9021
|
+
}
|
|
8999
9022
|
}
|
|
9000
9023
|
Serializer.removeProperty('matrix', 'renderAs');
|
|
9001
9024
|
Serializer.addProperty('matrix', {
|
|
@@ -9352,7 +9375,7 @@ class CustomBrick extends PdfBrick {
|
|
|
9352
9375
|
}
|
|
9353
9376
|
}
|
|
9354
9377
|
|
|
9355
|
-
checkLibraryVersion(`${"2.
|
|
9378
|
+
checkLibraryVersion(`${"2.3.1"}`, 'survey-pdf');
|
|
9356
9379
|
|
|
9357
9380
|
export { BooleanItemBrick, CheckItemBrick, CheckboxItemBrick, 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, FlatSlider, FlatSurvey, FlatTextbox, HTMLBrick, HorizontalAlign, ImageBrick, LinkBrick, PagePacker, PdfBrick, RadioItemBrick, RankingItemBrick, RowlineBrick, SurveyHelper, SurveyPDF, TextBoldBrick, TextBrick, TextFieldBrick, TitlePanelBrick, VerticalAlign };
|
|
9358
9381
|
//# sourceMappingURL=survey.pdf.mjs.map
|