@legalplace/prerenderx 2.3.55 → 2.4.0
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.
|
@@ -38,7 +38,7 @@ var OptionRender = (function () {
|
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
var variables = OutputParser_1.getRelatedVariablesValues(this.id, this.index, outputReference.variables, this.ovc, this.references);
|
|
41
|
-
var output = OutputParser_1.parseOutputWithVariables(option.meta.output, variables, autonums);
|
|
41
|
+
var output = OutputParser_1.parseOutputWithVariables(option.meta.output, this.index, variables, autonums);
|
|
42
42
|
output = output.replace(/>([\n\s]+)</g, '><');
|
|
43
43
|
output = output.replace(/\n/g, '<br />');
|
|
44
44
|
output = output.replace(/\xA0/g, ' ');
|
|
@@ -4,6 +4,6 @@ declare type relVarsValsT = Record<string, string | number>;
|
|
|
4
4
|
declare type getRelatedVarsT = (optionId: number, index: number, variables: number[], ovc: OVC_TYPE, references: Types.ReferencesType) => relVarsValsT;
|
|
5
5
|
export declare const getRelatedVariablesValues: getRelatedVarsT;
|
|
6
6
|
declare type autonumsType = [string, string, number, string | null][];
|
|
7
|
-
declare type parseOutputT = (output: string, variables: relVarsValsT, autonums: autonumsType) => string;
|
|
7
|
+
declare type parseOutputT = (output: string, index: number, variables: relVarsValsT, autonums: autonumsType) => string;
|
|
8
8
|
export declare const parseOutputWithVariables: parseOutputT;
|
|
9
9
|
export {};
|
|
@@ -28,7 +28,7 @@ exports.getRelatedVariablesValues = function (optionId, index, variables, ovc, r
|
|
|
28
28
|
});
|
|
29
29
|
return variablesValues;
|
|
30
30
|
};
|
|
31
|
-
exports.parseOutputWithVariables = function (output, variables, autonums) {
|
|
31
|
+
exports.parseOutputWithVariables = function (output, index, variables, autonums) {
|
|
32
32
|
var parsedOutput = "" + output;
|
|
33
33
|
Object.keys(variables).forEach(function (variableId) {
|
|
34
34
|
var value = variables[variableId].toString();
|
|
@@ -40,6 +40,7 @@ exports.parseOutputWithVariables = function (output, variables, autonums) {
|
|
|
40
40
|
});
|
|
41
41
|
parsedOutput = parsedOutput.replace(/\[\[PAGE_BREAK\]\]/gi, '<div style="page-break-after:always"></div>');
|
|
42
42
|
parsedOutput = parsedOutput.replace(/\[(E|B)_BLUR\]/gi, '');
|
|
43
|
+
parsedOutput = parsedOutput.replace(/\[signature:([0-9]+)\]/g, function (v, signatureId) { return "<span data-signature-id=\"" + signatureId + "\" data-signer-index=\"" + index + "\"></span>"; });
|
|
43
44
|
autonums.forEach(function (currentAn) {
|
|
44
45
|
if (currentAn[3] === null)
|
|
45
46
|
parsedOutput = parsedOutput.replace("[" + currentAn[0] + ":" + currentAn[1] + "]", "<span class=\"" + currentAn[0] + "\">" + currentAn[2] + "</span>");
|
package/package.json
CHANGED
package/src/libs/OptionRender.ts
CHANGED
|
@@ -56,7 +56,7 @@ class OptionRender {
|
|
|
56
56
|
|
|
57
57
|
// variables
|
|
58
58
|
const variables = getRelatedVariablesValues(this.id, this.index, outputReference.variables, this.ovc, this.references)
|
|
59
|
-
let output = parseOutputWithVariables(option.meta.output, variables, autonums)
|
|
59
|
+
let output = parseOutputWithVariables(option.meta.output, this.index, variables, autonums)
|
|
60
60
|
|
|
61
61
|
// Removing spaces between tags
|
|
62
62
|
output = output.replace(/>([\n\s]+)</g, '><');
|
package/src/libs/OutputParser.ts
CHANGED
|
@@ -55,8 +55,8 @@ export const getRelatedVariablesValues: getRelatedVarsT = (optionId, index, vari
|
|
|
55
55
|
* @param autonums Autonums values
|
|
56
56
|
*/
|
|
57
57
|
type autonumsType = [string, string, number, string | null][]
|
|
58
|
-
type parseOutputT = (output: string, variables: relVarsValsT, autonums: autonumsType) => string
|
|
59
|
-
export const parseOutputWithVariables: parseOutputT = (output, variables, autonums) => {
|
|
58
|
+
type parseOutputT = (output: string, index: number, variables: relVarsValsT, autonums: autonumsType) => string
|
|
59
|
+
export const parseOutputWithVariables: parseOutputT = (output, index, variables, autonums) => {
|
|
60
60
|
// Inserting values
|
|
61
61
|
let parsedOutput = `${output}`
|
|
62
62
|
Object.keys(variables).forEach(variableId => {
|
|
@@ -76,6 +76,9 @@ export const parseOutputWithVariables: parseOutputT = (output, variables, autonu
|
|
|
76
76
|
// Cleaning BLURS
|
|
77
77
|
parsedOutput = parsedOutput.replace(/\[(E|B)_BLUR\]/gi, '')
|
|
78
78
|
|
|
79
|
+
// Parsing Signatures
|
|
80
|
+
parsedOutput = parsedOutput.replace(/\[signature:([0-9]+)\]/g, (v, signatureId) => `<span data-signature-id="${signatureId}" data-signer-index="${index}"></span>`)
|
|
81
|
+
|
|
79
82
|
// Inserting autonums
|
|
80
83
|
autonums.forEach(currentAn => {
|
|
81
84
|
if (currentAn[3] === null) parsedOutput = parsedOutput.replace(`[${currentAn[0]}:${currentAn[1]}]`, `<span class="${currentAn[0]}">${currentAn[2]}</span>`)
|