@pdfme/generator 3.1.5-dev.12 → 3.1.5-dev.13

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,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.other = exports.textType = exports.business = exports.barcode = exports.envelope = exports.label = void 0;
3
+ exports.shape = exports.other = exports.textType = exports.business = exports.barcode = exports.envelope = exports.label = void 0;
4
4
  const レターパック = require('./レターパック.json');
5
5
  const レターパックライト = require('./レターパックライト.json');
6
6
  const レターパックプラス = require('./レターパックプラス.json');
@@ -43,6 +43,7 @@ const verticalAlignmentTop = require('./verticalAlignmentTop.json');
43
43
  const verticalAlignmentMiddle = require('./verticalAlignmentMiddle.json');
44
44
  const verticalAlignmentBottom = require('./verticalAlignmentBottom.json');
45
45
  const test = require('./test.json');
46
+ const shapes = require('./shapes.json');
46
47
  exports.label = {
47
48
  宛名8面,
48
49
  シンプルラベル24面,
@@ -98,4 +99,7 @@ exports.other = {
98
99
  background,
99
100
  rotation,
100
101
  };
102
+ exports.shape = {
103
+ shapes,
104
+ };
101
105
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../__tests__/assets/templates/index.ts"],"names":[],"mappings":";;;AAEA,MAAM,MAAM,GAAG,OAAO,CAAC,eAAe,CAAa,CAAC;AACpD,MAAM,SAAS,GAAG,OAAO,CAAC,kBAAkB,CAAa,CAAC;AAC1D,MAAM,SAAS,GAAG,OAAO,CAAC,kBAAkB,CAAa,CAAC;AAC1D,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAa,CAAC;AAChD,MAAM,UAAU,GAAG,OAAO,CAAC,mBAAmB,CAAa,CAAC;AAC5D,MAAM,cAAc,GAAG,OAAO,CAAC,uBAAuB,CAAa,CAAC;AACpE,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAa,CAAC;A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BAAiB,CAAa,CAAC;AACxD,MAAM,oBAAoB,GAAG,OAAO,CAAC,6BAA6B,CAAa,CAAC;AAChF,MAAM,uBAAuB,GAAG,OAAO,CAAC,gCAAgC,CAAa,CAAC;AACtF,MAAM,uBAAuB,GAAG,OAAO,CAAC,gCAAgC,CAAa,CAAC;AACtF,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAa,CAAC;AAChD,MAAM,MAAM,GAAG,OAAO,CAAC,eAAe,CAAa,CAAC;AAEvC,QAAA,KAAK,GAAG;IACnB,IAAI;IACJ,UAAU;IACV,UAAU;IACV,WAAW;IACX,UAAU;IACV,cAAc;IACd,QAAQ;IACR,MAAM;IACN,SAAS;IACT,SAAS;IACT,OAAO;IACP,MAAM;IACN,WAAW;IACX,QAAQ;IACR,UAAU;CACX,CAAC;AAEW,QAAA,QAAQ,GAAG;IACtB,MAAM;IACN,MAAM;IACN,MAAM;CACP,CAAC;AAEW,QAAA,OAAO,GAAG;IACrB,cAAc;IACd,cAAc;IACd,iBAAiB;IACjB,iBAAiB;IACjB,QAAQ;CACT,CAAC;AAEW,QAAA,QAAQ,GAAG;IACtB,GAAG;IACH,KAAK;IACL,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,KAAK;IACL,GAAG;IACH,OAAO;CACR,CAAC;AAEF,iEAAiE;AACpD,QAAA,QAAQ,GAAG;IACtB,yBAAyB;IACzB,uBAAuB;IACvB,oBAAoB;IACpB,uBAAuB;IACvB,uBAAuB;CACxB,CAAC;AAEW,QAAA,KAAK,GAAG;IACnB,IAAI;IACJ,WAAW;IACX,SAAS;IACT,UAAU;IACV,QAAQ;CACT,CAAC;AAEW,QAAA,KAAK,GAAG;IACnB,MAAM;CACP,CAAC"}
@@ -8,8 +8,8 @@ const generate_1 = __importDefault(require("../src/generate"));
8
8
  const templates_1 = require("./assets/templates");
9
9
  const schemas_1 = require("@pdfme/schemas");
10
10
  const utils_1 = require("./utils");
11
- describe('generate integration test(other)', () => {
12
- describe.each([templates_1.other])('%s', (templateData) => {
11
+ describe('generate integration test(other, shape)', () => {
12
+ describe.each([templates_1.other, templates_1.shape])('%s', (templateData) => {
13
13
  const entries = Object.entries(templateData);
14
14
  for (let l = 0; l < entries.length; l += 1) {
15
15
  const [key, template] = entries[l];
@@ -26,7 +26,7 @@ describe('generate integration test(other)', () => {
26
26
  const pdf = await (0, generate_1.default)({
27
27
  inputs,
28
28
  template,
29
- plugins: { text: schemas_1.text, image: schemas_1.image },
29
+ plugins: { text: schemas_1.text, image: schemas_1.image, line: schemas_1.line, rectangle: schemas_1.rectangle, ellipse: schemas_1.ellipse },
30
30
  options: { font },
31
31
  });
32
32
  const hrend = process.hrtime(hrstart);
@@ -1 +1 @@
1
- {"version":3,"file":"integration3.test.js","sourceRoot":"","sources":["../../../__tests__/integration3.test.ts"],"names":[],"mappings":";;;;;AAAA,2BAAmC;AACnC,+DAAuC;AACvC,kDAA2C;AAC3C,4CAA6C;AAC7C,mCAA2E;AAE3E,QAAQ,CAAC,kCAAkC,EAAE,GAAG,EAAE;IAChD,QAAQ,CAAC,IAAI,CAAC,CAAC,iBAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,YAAY,EAAE,EAAE;QAC5C,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAC7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;YAC1C,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YAEnC,wCAAwC;YACxC,IAAI,CAAC,YAAY,GAAG,EAAE,EAAE,KAAK,IAAI,EAAE;gBACjC,MAAM,MAAM,GAAG,QAAQ,CAAC,UAAW,CAAC;gBAEpC,MAAM,IAAI,GAAG,IAAA,eAAO,GAAE,CAAC;gBACvB,IAAI,CAAC,cAAc,CAAC,QAAQ,GAAG,KAAK,CA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AAE,IAAI,EAAJ,cAAI,EAAE,KAAK,EAAL,eAAK,EAAE,IAAI,EAAJ,cAAI,EAAE,SAAS,EAAT,mBAAS,EAAE,OAAO,EAAP,iBAAO,EAAE;oBAClD,OAAO,EAAE,EAAE,IAAI,EAAE;iBAClB,CAAC,CAAC;gBAEH,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBACtC,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC;gBACrD,MAAM,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;gBAEtC,MAAM,OAAO,GAAG,IAAA,qBAAa,EAAC,GAAG,GAAG,MAAM,CAAC,CAAC;gBAC5C,MAAM,UAAU,GAAG,IAAA,wBAAgB,EAAC,GAAG,GAAG,MAAM,CAAC,CAAC;gBAElD,IAAA,kBAAa,EAAC,OAAO,EAAE,GAAG,CAAC,CAAC;gBAC5B,MAAM,GAAG,GAAQ,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,IAAA,cAAM,EAAC,OAAO,CAAC,EAAE,IAAA,cAAM,EAAC,UAAU,CAAC,CAAC,CAAC,CAAC;gBAC1E,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC;gBACnB,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -33,7 +33,10 @@ const generate = async (props) => {
33
33
  const _cache = new Map();
34
34
  for (let i = 0; i < inputs.length; i += 1) {
35
35
  const inputObj = inputs[i];
36
- const keys = Object.keys(inputObj).concat(readOnlySchemaKeys);
36
+ const keys = readOnlySchemaKeys.concat(Object.keys(inputObj));
37
+ if (template.columns) {
38
+ keys.sort((a, b) => (template.columns ?? []).indexOf(a) - (template.columns ?? []).indexOf(b));
39
+ }
37
40
  for (let j = 0; j < embeddedPages.length; j += 1) {
38
41
  const embeddedPage = embeddedPages[j];
39
42
  const { width: pageWidth, height: pageHeight } = embeddedPage;
@@ -1 +1 @@
1
- {"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/generate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAyC;AAEzC,0CAAmD;AACnD,2CAA8E;AAE9E,MAAM,QAAQ,GAAG,KAAK,EAAE,KAAoB,EAAE,EAAE;IAC9C,IAAA,2BAAkB,EAAC,KAAK,CAAC,CAAC;IAC1B,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,EAAE,EAAE,OAAO,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,KAAK,CAAC;IAE5E,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,kBAAkB,EAAE,GAC3E,MAAM,IAAA,yBAAa,EAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,CAAC;IAEjD,MAAM,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;IAEzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;QACzC,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QAC3B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;QAC9D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;YAChD,MAAM,YAAY,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;YACtC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,YAA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AC,OAAO,CAAC,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;YAErD,IAAA,4BAAgB,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC,CAAC;YACtD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;gBACvC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;gBACpB,MAAM,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;gBACtC,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;gBAC9B,IAAI,CAAC,MAAM,EAAE;oBACX,SAAS;iBACV;gBAED,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBACtC,IAAI,CAAC,MAAM,EAAE;oBACX,SAAS;iBACV;gBAED,MAAM,MAAM,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;aAC5F;SACF;KACF;IAED,IAAA,0BAAc,EAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IAEpC,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
@@ -40,6 +40,7 @@ const verticalAlignmentTop = require('./verticalAlignmentTop.json');
40
40
  const verticalAlignmentMiddle = require('./verticalAlignmentMiddle.json');
41
41
  const verticalAlignmentBottom = require('./verticalAlignmentBottom.json');
42
42
  const test = require('./test.json');
43
+ const shapes = require('./shapes.json');
43
44
  export const label = {
44
45
  宛名8面,
45
46
  シンプルラベル24面,
@@ -95,4 +96,7 @@ export const other = {
95
96
  background,
96
97
  rotation,
97
98
  };
99
+ export const shape = {
100
+ shapes,
101
+ };
98
102
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../__tests__/assets/templates/index.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,GAAG,OAAO,CAAC,eAAe,CAAa,CAAC;AACpD,MAAM,SAAS,GAAG,OAAO,CAAC,kBAAkB,CAAa,CAAC;AAC1D,MAAM,SAAS,GAAG,OAAO,CAAC,kBAAkB,CAAa,CAAC;AAC1D,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAa,CAAC;AAChD,MAAM,UAAU,GAAG,OAAO,CAAC,mBAAmB,CAAa,CAAC;AAC5D,MAAM,cAAc,GAAG,OAAO,CAAC,uBAAuB,CAAa,CAAC;AACpE,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAa,CAAC;AACtD,MAAM,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAa,CAAC;AAC9D,MAAM,UAAU,GAAG,OAAO,CAAC,mBAAmB,CAAa,CAAC;AAC5D,MAAM,UAAU,GAAG,OAAO,CAAC,mBAAmB,CAAa,CAAC;AAC5D,MAAM,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAa,CAAC;AACxD,MAAM,MAAM,GAAG,OAAO,CAAC,eAAe,CAAa,CAAC;AACpD,MAAM,MAAM,GAAG,OAAO,CAAC,eAAe,CAAa,CAAC;AACpD,MAAM,MAAM,GAAG,OAAO,CAAC,eAAe,CAAa,CAAC;AACpD,MAAM,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAa,CAAC;AACxD,MAAM,UAAU,GAAG,OAAO,CAAC,mBAAmB,CAAa,CAAC;AAC5D,MAAM,MAAM,GAAG,OAAO,CAAC,eAAe,CAAa,CAAC;AACpD,MAAM,cAAc,GAAG,OAAO,CAAC,uBAAuB,CAAa,CAAC;AACpE,MAAM,cAAc,GAAG,OAAO,CAAC,uBAAuB,CAAa,CAAC;AACpE,MAAM,iBAAiB,GAAG,O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AACtF,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAa,CAAC;AAEhD,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,IAAI;IACJ,UAAU;IACV,UAAU;IACV,WAAW;IACX,UAAU;IACV,cAAc;IACd,QAAQ;IACR,MAAM;IACN,SAAS;IACT,SAAS;IACT,OAAO;IACP,MAAM;IACN,WAAW;IACX,QAAQ;IACR,UAAU;CACX,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,MAAM;IACN,MAAM;IACN,MAAM;CACP,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,cAAc;IACd,cAAc;IACd,iBAAiB;IACjB,iBAAiB;IACjB,QAAQ;CACT,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,GAAG;IACH,KAAK;IACL,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,KAAK;IACL,GAAG;IACH,OAAO;CACR,CAAC;AAEF,iEAAiE;AACjE,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,yBAAyB;IACzB,uBAAuB;IACvB,oBAAoB;IACpB,uBAAuB;IACvB,uBAAuB;CACxB,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,IAAI;IACJ,WAAW;IACX,SAAS;IACT,UAAU;IACV,QAAQ;CACT,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../__tests__/assets/templates/index.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,GAAG,OAAO,CAAC,eAAe,CAAa,CAAC;AACpD,MAAM,SAAS,GAAG,OAAO,CAAC,kBAAkB,CAAa,CAAC;AAC1D,MAAM,SAAS,GAAG,OAAO,CAAC,kBAAkB,CAAa,CAAC;AAC1D,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAa,CAAC;AAChD,MAAM,UAAU,GAAG,OAAO,CAAC,mBAAmB,CAAa,CAAC;AAC5D,MAAM,cAAc,GAA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AAG;IACrB,cAAc;IACd,cAAc;IACd,iBAAiB;IACjB,iBAAiB;IACjB,QAAQ;CACT,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,GAAG;IACH,KAAK;IACL,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,KAAK;IACL,GAAG;IACH,OAAO;CACR,CAAC;AAEF,iEAAiE;AACjE,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,yBAAyB;IACzB,uBAAuB;IACvB,oBAAoB;IACpB,uBAAuB;IACvB,uBAAuB;CACxB,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,IAAI;IACJ,WAAW;IACX,SAAS;IACT,UAAU;IACV,QAAQ;CACT,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,MAAM;CACP,CAAC"}
@@ -1,10 +1,10 @@
1
1
  import { writeFileSync } from 'fs';
2
2
  import generate from '../src/generate';
3
- import { other } from './assets/templates';
4
- import { text, image } from '@pdfme/schemas';
3
+ import { other, shape } from './assets/templates';
4
+ import { text, image, line, rectangle, ellipse } from '@pdfme/schemas';
5
5
  import { getFont, getPdf, getPdfTmpPath, getPdfAssertPath } from './utils';
6
- describe('generate integration test(other)', () => {
7
- describe.each([other])('%s', (templateData) => {
6
+ describe('generate integration test(other, shape)', () => {
7
+ describe.each([other, shape])('%s', (templateData) => {
8
8
  const entries = Object.entries(templateData);
9
9
  for (let l = 0; l < entries.length; l += 1) {
10
10
  const [key, template] = entries[l];
@@ -21,7 +21,7 @@ describe('generate integration test(other)', () => {
21
21
  const pdf = await generate({
22
22
  inputs,
23
23
  template,
24
- plugins: { text, image },
24
+ plugins: { text, image, line, rectangle, ellipse },
25
25
  options: { font },
26
26
  });
27
27
  const hrend = process.hrtime(hrstart);
@@ -1 +1 @@
1
- {"version":3,"file":"integration3.test.js","sourceRoot":"","sources":["../../../__tests__/integration3.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,E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,OAAO,CAAC,CAAC;gBACtC,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC;gBACrD,MAAM,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;gBAEtC,MAAM,OAAO,GAAG,aAAa,CAAC,GAAG,GAAG,MAAM,CAAC,CAAC;gBAC5C,MAAM,UAAU,GAAG,gBAAgB,CAAC,GAAG,GAAG,MAAM,CAAC,CAAC;gBAElD,aAAa,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;gBAC5B,MAAM,GAAG,GAAQ,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;gBAC1E,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC;gBACnB,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -8,7 +8,10 @@ const generate = async (props) => {
8
8
  const _cache = new Map();
9
9
  for (let i = 0; i < inputs.length; i += 1) {
10
10
  const inputObj = inputs[i];
11
- const keys = Object.keys(inputObj).concat(readOnlySchemaKeys);
11
+ const keys = readOnlySchemaKeys.concat(Object.keys(inputObj));
12
+ if (template.columns) {
13
+ keys.sort((a, b) => (template.columns ?? []).indexOf(a) - (template.columns ?? []).indexOf(b));
14
+ }
12
15
  for (let j = 0; j < embeddedPages.length; j += 1) {
13
16
  const embeddedPage = embeddedPages[j];
14
17
  const { width: pageWidth, height: pageHeight } = embeddedPage;
@@ -1 +1 @@
1
- {"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/generate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,gBAA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,EAAE,CAAC,CAAC;YACtD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;gBACvC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;gBACpB,MAAM,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;gBACtC,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;gBAC9B,IAAI,CAAC,MAAM,EAAE;oBACX,SAAS;iBACV;gBAED,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBACtC,IAAI,CAAC,MAAM,EAAE;oBACX,SAAS;iBACV;gBAED,MAAM,MAAM,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;aAC5F;SACF;KACF;IAED,cAAc,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IAEpC,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -976,3 +976,28 @@ export declare const other: {
976
976
  columns?: string[] | undefined;
977
977
  };
978
978
  };
979
+ export declare const shape: {
980
+ shapes: {
981
+ schemas: Record<string, import("zod").objectOutputType<{
982
+ type: import("zod").ZodString;
983
+ readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
984
+ position: import("zod").ZodObject<{
985
+ x: import("zod").ZodNumber;
986
+ y: import("zod").ZodNumber;
987
+ }, "strip", import("zod").ZodTypeAny, {
988
+ x: number;
989
+ y: number;
990
+ }, {
991
+ x: number;
992
+ y: number;
993
+ }>;
994
+ width: import("zod").ZodNumber;
995
+ height: import("zod").ZodNumber;
996
+ rotate: import("zod").ZodOptional<import("zod").ZodNumber>;
997
+ opacity: import("zod").ZodOptional<import("zod").ZodNumber>;
998
+ }, import("zod").ZodTypeAny, "passthrough">>[];
999
+ basePdf: (string | ArrayBuffer | Uint8Array) & (string | ArrayBuffer | Uint8Array | undefined);
1000
+ sampledata?: Record<string, string>[] | undefined;
1001
+ columns?: string[] | undefined;
1002
+ };
1003
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdfme/generator",
3
- "version": "3.1.5-dev.12",
3
+ "version": "3.1.5-dev.13",
4
4
  "sideEffects": false,
5
5
  "author": "hand-dot",
6
6
  "license": "MIT",
package/src/generate.ts CHANGED
@@ -14,7 +14,13 @@ const generate = async (props: GenerateProps) => {
14
14
 
15
15
  for (let i = 0; i < inputs.length; i += 1) {
16
16
  const inputObj = inputs[i];
17
- const keys = Object.keys(inputObj).concat(readOnlySchemaKeys);
17
+ const keys = readOnlySchemaKeys.concat(Object.keys(inputObj));
18
+ if (template.columns) {
19
+ keys.sort(
20
+ (a, b) => (template.columns ?? []).indexOf(a) - (template.columns ?? []).indexOf(b)
21
+ );
22
+ }
23
+
18
24
  for (let j = 0; j < embeddedPages.length; j += 1) {
19
25
  const embeddedPage = embeddedPages[j];
20
26
  const { width: pageWidth, height: pageHeight } = embeddedPage;