@pdfme/ui 3.1.5-dev.7 → 3.1.5-dev.9
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/dist/index.js +150 -150
- package/package.json +1 -1
- package/src/components/Renderer.tsx +1 -0
- package/src/helper.ts +7 -4
package/package.json
CHANGED
package/src/helper.ts
CHANGED
@@ -312,13 +312,16 @@ export const templateSchemas2SchemasList = async (_template: Template) => {
|
|
312
312
|
export const generateColumnsAndSampledataIfNeeded = (template: Template) => {
|
313
313
|
const { schemas, columns, sampledata } = template;
|
314
314
|
|
315
|
-
const
|
315
|
+
const flatSchemaLengthForColumns = schemas
|
316
316
|
.map((schema) => Object.keys(schema).length)
|
317
317
|
.reduce((acc, cur) => acc + cur, 0);
|
318
|
+
const needColumns = !columns || flatSchemaLengthForColumns !== columns.length;
|
318
319
|
|
319
|
-
const
|
320
|
-
|
321
|
-
|
320
|
+
const flatSchemaLengthForSampleData = schemas
|
321
|
+
.map((schema) => Object.keys(schema).filter((key) => !schema[key].readOnly).length)
|
322
|
+
.reduce((acc, cur) => acc + cur, 0);
|
323
|
+
const needSampledata =
|
324
|
+
!sampledata || flatSchemaLengthForSampleData !== Object.keys(sampledata[0]).length;
|
322
325
|
|
323
326
|
// columns
|
324
327
|
if (needColumns) {
|