@pdfme/schemas
Version:
TypeScript base PDF generator and React base UI. Open source, developed by the community, and completely free to use under the MIT license!
13 lines • 652 B
JavaScript
import { createSingleTable } from './tableHelper.js';
import { getBodyWithRange, getBody } from './helper.js';
export const getDynamicHeightsForTable = async (value, args) => {
if (args.schema.type !== 'table')
return Promise.resolve([args.schema.height]);
const schema = args.schema;
const body = schema.__bodyRange?.start === 0 ? getBody(value) : getBodyWithRange(value, schema.__bodyRange);
const table = await createSingleTable(body, args);
return schema.showHead
? table.allRows().map((row) => row.height)
: [0].concat(table.body.map((row) => row.height));
};
//# sourceMappingURL=dynamicTemplate.js.map