@legalplace/prerenderx 2.4.3 → 2.5.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.
@@ -1,8 +1,7 @@
1
1
  import FillPdfFormBase from './misc/FillPdfFormBase';
2
2
  declare type FDFType = {
3
3
  id: string;
4
- inputs: Record<string, string>;
5
- boxes: Record<string, string>;
4
+ fields: Record<string, string>;
6
5
  };
7
6
  declare class FillPdfForm extends FillPdfFormBase {
8
7
  fillDocument(documentName: string): FDFType;
@@ -26,8 +26,7 @@ var FillPdfForm = (function (_super) {
26
26
  var _this = this;
27
27
  var result = {
28
28
  id: '',
29
- inputs: {},
30
- boxes: {}
29
+ fields: {}
31
30
  };
32
31
  var document = this.references.documents[documentName];
33
32
  var pdf = document.pdf;
@@ -36,14 +35,14 @@ var FillPdfForm = (function (_super) {
36
35
  var form = pdf.form;
37
36
  result.id = pdf.id;
38
37
  form.inputs.forEach(function (input) {
39
- var id = "Page" + input.page + "[0]." + input.name;
40
- result.inputs[id] = _this.getInputValue(input);
38
+ var id = "" + input.name;
39
+ result.fields[id] = _this.getInputValue(input);
41
40
  });
42
41
  form.boxes.forEach(function (box) {
43
- var id = "Page" + box.page + "[0]." + box.name;
42
+ var id = "" + box.name;
44
43
  var value = _this.getBoxValue(box);
45
- if (!(value === '' && Object.prototype.hasOwnProperty.call(result.boxes, id)))
46
- result.boxes[id] = value;
44
+ if (!(value === '' && Object.prototype.hasOwnProperty.call(result.fields, id)))
45
+ result.fields[id] = value;
47
46
  });
48
47
  return result;
49
48
  };
@@ -39,7 +39,7 @@ var OptionRender = (function () {
39
39
  }
40
40
  var variables = OutputParser_1.getRelatedVariablesValues(this.id, this.index, outputReference.variables, this.ovc, this.references);
41
41
  var output = OutputParser_1.parseOutputWithVariables(option.meta.output, this.index, variables, autonums);
42
- output = output.replace(/>([\n\s]+)</g, '><');
42
+ output = output.replace(/<\/([a-z]+)>([\n\s]+)</gi, '</$1><');
43
43
  output = output.replace(/\n/g, '<br />');
44
44
  output = output.replace(/\xA0/g, ' ');
45
45
  this.outputs.push(output);
@@ -13,14 +13,12 @@ declare type DocumentPdfFormIndex = {
13
13
  form: boolean;
14
14
  fdf: {
15
15
  id: string;
16
- inputs: Record<string, string>;
17
- boxes: Record<string, string>;
16
+ fields: Record<string, string>;
18
17
  };
19
18
  };
20
19
  declare type FDFType = {
21
20
  id: string;
22
- inputs: Record<string, string>;
23
- boxes: Record<string, string>;
21
+ fields: Record<string, string>;
24
22
  };
25
23
  declare class Prerender {
26
24
  private model;
@@ -55,8 +55,7 @@ var Prerender = (function () {
55
55
  form: true,
56
56
  fdf: {
57
57
  id: '',
58
- inputs: {},
59
- boxes: {}
58
+ fields: {}
60
59
  }
61
60
  };
62
61
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legalplace/prerenderx",
3
- "version": "2.4.3",
3
+ "version": "2.5.0",
4
4
  "description": "PrerenderX",
5
5
  "main": "dist/index.js",
6
6
  "repository": "https://git.legalplace.eu/legalplace/prerenderx",
@@ -3,15 +3,13 @@ import FillPdfFormBase from './misc/FillPdfFormBase'
3
3
 
4
4
  type FDFType = {
5
5
  id: string
6
- inputs: Record<string, string>
7
- boxes: Record<string, string>
6
+ fields: Record<string, string>
8
7
  }
9
8
  class FillPdfForm extends FillPdfFormBase {
10
9
  public fillDocument(documentName: string) {
11
10
  const result: FDFType = {
12
11
  id: '',
13
- inputs: {},
14
- boxes: {}
12
+ fields: {}
15
13
  }
16
14
 
17
15
  // Getting document
@@ -25,15 +23,15 @@ class FillPdfForm extends FillPdfFormBase {
25
23
 
26
24
  // Filling inputs
27
25
  form.inputs.forEach(input => {
28
- const id = `Page${input.page}[0].${input.name}`
29
- result.inputs[id] = this.getInputValue(input)
26
+ const id = `${input.name}`
27
+ result.fields[id] = this.getInputValue(input)
30
28
  })
31
29
 
32
30
  // Filling boxes
33
31
  form.boxes.forEach(box => {
34
- const id = `Page${box.page}[0].${box.name}`
32
+ const id = `${box.name}`
35
33
  const value = this.getBoxValue(box)
36
- if (!(value === '' && Object.prototype.hasOwnProperty.call(result.boxes, id))) result.boxes[id] = value
34
+ if (!(value === '' && Object.prototype.hasOwnProperty.call(result.fields, id))) result.fields[id] = value
37
35
  })
38
36
 
39
37
  return result
@@ -59,7 +59,7 @@ class OptionRender {
59
59
  let output = parseOutputWithVariables(option.meta.output, this.index, variables, autonums)
60
60
 
61
61
  // Removing spaces between tags
62
- output = output.replace(/>([\n\s]+)</g, '><');
62
+ output = output.replace(/<\/([a-z]+)>([\n\s]+)</gi, '</$1><');
63
63
 
64
64
  // Replacing \n with line-break
65
65
  output = output.replace(/\n/g, '<br />')
@@ -21,8 +21,7 @@ type DocumentPdfFormIndex = {
21
21
  form: boolean
22
22
  fdf: {
23
23
  id: string
24
- inputs: Record<string, string>
25
- boxes: Record<string, string>
24
+ fields: Record<string, string>
26
25
  }
27
26
  }
28
27
 
@@ -30,8 +29,7 @@ type DocumentIndex = Record<string, DocumentOutputIndex | DocumentPdfFormIndex>
30
29
 
31
30
  type FDFType = {
32
31
  id: string
33
- inputs: Record<string, string>
34
- boxes: Record<string, string>
32
+ fields: Record<string, string>
35
33
  }
36
34
 
37
35
  class Prerender {
@@ -114,8 +112,7 @@ class Prerender {
114
112
  form: true,
115
113
  fdf: {
116
114
  id: '',
117
- inputs: {},
118
- boxes: {}
115
+ fields: {}
119
116
  }
120
117
  }
121
118
  } else {