@pdfme/schemas 4.3.2 → 4.4.0-dev.1
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/cjs/__tests__/multiVariableText.test.js +52 -0
- package/dist/cjs/__tests__/multiVariableText.test.js.map +1 -1
- package/dist/cjs/src/index.js +2 -3
- package/dist/cjs/src/index.js.map +1 -1
- package/dist/cjs/src/multiVariableText/helper.js +24 -1
- package/dist/cjs/src/multiVariableText/helper.js.map +1 -1
- package/dist/cjs/src/multiVariableText/pdfRender.js +6 -1
- package/dist/cjs/src/multiVariableText/pdfRender.js.map +1 -1
- package/dist/cjs/src/tables/dynamicTemplate.js +5 -61
- package/dist/cjs/src/tables/dynamicTemplate.js.map +1 -1
- package/dist/cjs/src/tables/tableHelper.js +10 -50
- package/dist/cjs/src/tables/tableHelper.js.map +1 -1
- package/dist/cjs/src/tables/uiRender.js +20 -19
- package/dist/cjs/src/tables/uiRender.js.map +1 -1
- package/dist/cjs/src/utils.js +1 -3
- package/dist/cjs/src/utils.js.map +1 -1
- package/dist/esm/__tests__/multiVariableText.test.js +53 -1
- package/dist/esm/__tests__/multiVariableText.test.js.map +1 -1
- package/dist/esm/src/index.js +4 -2
- package/dist/esm/src/index.js.map +1 -1
- package/dist/esm/src/multiVariableText/helper.js +22 -0
- package/dist/esm/src/multiVariableText/helper.js.map +1 -1
- package/dist/esm/src/multiVariableText/pdfRender.js +7 -2
- package/dist/esm/src/multiVariableText/pdfRender.js.map +1 -1
- package/dist/esm/src/tables/dynamicTemplate.js +4 -59
- package/dist/esm/src/tables/dynamicTemplate.js.map +1 -1
- package/dist/esm/src/tables/tableHelper.js +10 -49
- package/dist/esm/src/tables/tableHelper.js.map +1 -1
- package/dist/esm/src/tables/uiRender.js +20 -19
- package/dist/esm/src/tables/uiRender.js.map +1 -1
- package/dist/esm/src/utils.js +0 -1
- package/dist/esm/src/utils.js.map +1 -1
- package/dist/types/src/index.d.ts +2 -2
- package/dist/types/src/multiVariableText/helper.d.ts +2 -0
- package/dist/types/src/tables/dynamicTemplate.d.ts +3 -9
- package/dist/types/src/tables/tableHelper.d.ts +0 -1
- package/dist/types/src/utils.d.ts +0 -1
- package/package.json +1 -1
- package/src/index.ts +4 -4
- package/src/multiVariableText/helper.ts +27 -0
- package/src/multiVariableText/pdfRender.ts +9 -3
- package/src/tables/dynamicTemplate.ts +7 -69
- package/src/tables/tableHelper.ts +11 -62
- package/src/tables/uiRender.ts +21 -19
- package/src/utils.ts +1 -2
@@ -1,13 +1,7 @@
|
|
1
|
-
import {
|
2
|
-
export declare const
|
3
|
-
template: Template;
|
4
|
-
input: Record<string, string>;
|
5
|
-
_cache: Map<any, any>;
|
6
|
-
options: CommonOptions;
|
7
|
-
}) => Promise<Template>;
|
8
|
-
export declare const getDynamicHeightForTable: (value: string, args: {
|
1
|
+
import { Schema, BasePdf, CommonOptions } from '@pdfme/common';
|
2
|
+
export declare const getDynamicHeightsForTable: (value: string, args: {
|
9
3
|
schema: Schema;
|
10
4
|
basePdf: BasePdf;
|
11
5
|
options: CommonOptions;
|
12
6
|
_cache: Map<any, any>;
|
13
|
-
}) => Promise<number>;
|
7
|
+
}) => Promise<number[]>;
|
@@ -7,5 +7,4 @@ interface CreateTableArgs {
|
|
7
7
|
_cache: Map<any, any>;
|
8
8
|
}
|
9
9
|
export declare function createSingleTable(body: string[][], args: CreateTableArgs): Promise<Table>;
|
10
|
-
export declare function createMultiTables(body: string[][], args: CreateTableArgs): Promise<Table[]>;
|
11
10
|
export {};
|
@@ -30,4 +30,3 @@ export declare const hex2CmykColor: (hexString: string | undefined) => import("@
|
|
30
30
|
export declare const hex2PrintingColor: (hexString: string | undefined, colorType?: ColorType) => import("@pdfme/pdf-lib").RGB | import("@pdfme/pdf-lib").CMYK | undefined;
|
31
31
|
export declare const readFile: (input: File | FileList | null) => Promise<string | ArrayBuffer>;
|
32
32
|
export declare const createErrorElm: () => HTMLDivElement;
|
33
|
-
export declare const cloneDeep: <T>(value: T) => T;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
import multiVariableText from './multiVariableText/index.js'
|
1
|
+
import multiVariableText from './multiVariableText/index.js';
|
2
2
|
import text, { readOnlyText } from './text/index.js';
|
3
3
|
import image, { readOnlyImage } from './graphics/image.js';
|
4
4
|
import svg, { readOnlySvg } from './graphics/svg.js';
|
5
5
|
import barcodes from './barcodes/index.js';
|
6
6
|
import line from './shapes/line.js';
|
7
7
|
import table from './tables/index.js';
|
8
|
-
import {
|
8
|
+
import { getDynamicHeightsForTable } from './tables/dynamicTemplate.js';
|
9
9
|
import { rectangle, ellipse } from './shapes/rectAndEllipse.js';
|
10
10
|
import { convertForPdfLayoutProps, rotatePoint } from './utils.js';
|
11
11
|
|
@@ -24,11 +24,11 @@ export {
|
|
24
24
|
barcodes,
|
25
25
|
line,
|
26
26
|
tableBeta,
|
27
|
-
modifyTemplateForTable,
|
28
|
-
getDynamicHeightForTable,
|
29
27
|
rectangle,
|
30
28
|
ellipse,
|
29
|
+
// utils
|
31
30
|
builtInPlugins,
|
31
|
+
getDynamicHeightsForTable,
|
32
32
|
convertForPdfLayoutProps,
|
33
33
|
rotatePoint,
|
34
34
|
};
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import { MultiVariableTextSchema } from "./types";
|
2
|
+
|
1
3
|
export const substituteVariables = (text: string, variablesIn: string | Record<string, string>): string => {
|
2
4
|
if (!text) {
|
3
5
|
return "";
|
@@ -21,3 +23,28 @@ export const substituteVariables = (text: string, variablesIn: string | Record<s
|
|
21
23
|
|
22
24
|
return substitutedText;
|
23
25
|
};
|
26
|
+
|
27
|
+
export const validateVariables = (key: string, value: string, schema: MultiVariableTextSchema): boolean => {
|
28
|
+
if (schema.variables.length == 0) {
|
29
|
+
return true;
|
30
|
+
}
|
31
|
+
|
32
|
+
let values;
|
33
|
+
try {
|
34
|
+
values = value ? JSON.parse(value) : {};
|
35
|
+
} catch (e) {
|
36
|
+
throw new SyntaxError(`[@pdfme/generator] invalid JSON string '${value}' for variables in field ${key}`);
|
37
|
+
}
|
38
|
+
|
39
|
+
for (const variable of schema.variables) {
|
40
|
+
if (!values[variable]) {
|
41
|
+
if (schema.required) {
|
42
|
+
throw new Error(`[@pdfme/generator] variable ${variable} is missing for field ${key}`);
|
43
|
+
}
|
44
|
+
// If not required, then simply don't render this field if an input is missing
|
45
|
+
return false;
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
return true;
|
50
|
+
}
|
@@ -1,13 +1,19 @@
|
|
1
1
|
import { PDFRenderProps } from '@pdfme/common';
|
2
2
|
import { MultiVariableTextSchema } from './types';
|
3
3
|
import { pdfRender as parentPdfRender } from '../text/pdfRender';
|
4
|
-
import { substituteVariables } from './helper';
|
4
|
+
import { substituteVariables, validateVariables } from './helper';
|
5
5
|
|
6
6
|
export const pdfRender = async (arg: PDFRenderProps<MultiVariableTextSchema>) => {
|
7
|
-
const { value, schema, ...rest } = arg;
|
7
|
+
const { key, value, schema, ...rest } = arg;
|
8
|
+
|
9
|
+
if (!validateVariables(key, value, schema)) {
|
10
|
+
// Don't render if a required variable is missing
|
11
|
+
return;
|
12
|
+
}
|
8
13
|
|
9
14
|
const renderArgs = {
|
10
|
-
|
15
|
+
key,
|
16
|
+
value: substituteVariables(schema.text || '', value),
|
11
17
|
schema,
|
12
18
|
...rest,
|
13
19
|
};
|
@@ -1,71 +1,9 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import { cloneDeep } from '../utils';
|
1
|
+
import { Schema, BasePdf, CommonOptions } from '@pdfme/common';
|
2
|
+
import { createSingleTable } from './tableHelper';
|
4
3
|
import { getBodyWithRange, getBody } from './helper.js';
|
5
4
|
import { TableSchema } from './types';
|
6
|
-
export const modifyTemplateForTable = async (arg: {
|
7
|
-
template: Template;
|
8
|
-
input: Record<string, string>;
|
9
|
-
_cache: Map<any, any>;
|
10
|
-
options: CommonOptions;
|
11
|
-
}): Promise<Template> => {
|
12
|
-
const { template: t, input, options, _cache } = arg;
|
13
|
-
const template: Template = Object.assign(cloneDeep(t), { schemas: [] });
|
14
|
-
let pageIndex = 0;
|
15
|
-
for (const schemaObj of t.schemas) {
|
16
|
-
const additionalSchemaObjs: (typeof schemaObj)[] = [];
|
17
|
-
for (const [key, schema] of Object.entries(schemaObj)) {
|
18
|
-
if (schema.type === 'table') {
|
19
|
-
schema.__bodyRange = undefined;
|
20
5
|
|
21
|
-
|
22
|
-
const tables = await createMultiTables(body, {
|
23
|
-
schema,
|
24
|
-
basePdf: template.basePdf,
|
25
|
-
options,
|
26
|
-
_cache,
|
27
|
-
});
|
28
|
-
if (tables.length > 1) {
|
29
|
-
const firstTable = tables[0];
|
30
|
-
schema.__bodyRange = { start: 0, end: firstTable.body.length };
|
31
|
-
const allBodies = tables.map((table) => table.body);
|
32
|
-
const from2ndTable = tables.slice(1);
|
33
|
-
from2ndTable.forEach((table, i) => {
|
34
|
-
const additionalPageIndex = pageIndex + i + 1;
|
35
|
-
|
36
|
-
const additionalSchemaObj = {
|
37
|
-
[key]: {
|
38
|
-
...schema,
|
39
|
-
position: { x: schema.position.x, y: table.settings.startY },
|
40
|
-
height: table.getHeight(),
|
41
|
-
showHead: false,
|
42
|
-
__bodyRange: {
|
43
|
-
start: allBodies.slice(0, i + 1).reduce((acc, cur) => acc + cur.length, 0),
|
44
|
-
end: allBodies.slice(0, i + 2).reduce((acc, cur) => acc + cur.length, 0),
|
45
|
-
},
|
46
|
-
content:
|
47
|
-
typeof input[key] !== 'string' ? JSON.stringify(input[key] || '[]') : input[key],
|
48
|
-
},
|
49
|
-
};
|
50
|
-
additionalSchemaObjs[additionalPageIndex] = additionalSchemaObj;
|
51
|
-
});
|
52
|
-
}
|
53
|
-
}
|
54
|
-
}
|
55
|
-
template.schemas.push(schemaObj);
|
56
|
-
additionalSchemaObjs.forEach((obj, index) => {
|
57
|
-
if (!template.schemas[index]) {
|
58
|
-
template.schemas[index] = obj;
|
59
|
-
} else {
|
60
|
-
template.schemas[index] = { ...template.schemas[index], ...obj };
|
61
|
-
}
|
62
|
-
});
|
63
|
-
pageIndex++;
|
64
|
-
}
|
65
|
-
return template;
|
66
|
-
};
|
67
|
-
|
68
|
-
export const getDynamicHeightForTable = async (
|
6
|
+
export const getDynamicHeightsForTable = async (
|
69
7
|
value: string,
|
70
8
|
args: {
|
71
9
|
schema: Schema;
|
@@ -73,11 +11,11 @@ export const getDynamicHeightForTable = async (
|
|
73
11
|
options: CommonOptions;
|
74
12
|
_cache: Map<any, any>;
|
75
13
|
}
|
76
|
-
): Promise<number> => {
|
77
|
-
if (args.schema.type !== 'table') return Promise.resolve(args.schema.height);
|
14
|
+
): Promise<number[]> => {
|
15
|
+
if (args.schema.type !== 'table') return Promise.resolve([args.schema.height]);
|
78
16
|
const schema = args.schema as TableSchema;
|
79
17
|
const body =
|
80
18
|
schema.__bodyRange?.start === 0 ? getBody(value) : getBodyWithRange(value, schema.__bodyRange);
|
81
19
|
const table = await createSingleTable(body, args);
|
82
|
-
return table.
|
83
|
-
};
|
20
|
+
return table.allRows().map((row) => row.height);
|
21
|
+
};
|
@@ -5,6 +5,7 @@ import {
|
|
5
5
|
CommonOptions,
|
6
6
|
getDefaultFont,
|
7
7
|
getFallbackFontName,
|
8
|
+
cloneDeep,
|
8
9
|
} from '@pdfme/common';
|
9
10
|
import type {
|
10
11
|
TableSchema,
|
@@ -15,7 +16,6 @@ import type {
|
|
15
16
|
StylesProps,
|
16
17
|
Section,
|
17
18
|
} from './types';
|
18
|
-
import { cloneDeep } from '../utils';
|
19
19
|
import { Cell, Column, Row, Table } from './classes';
|
20
20
|
|
21
21
|
type StyleProp = 'styles' | 'headStyles' | 'bodyStyles' | 'alternateRowStyles' | 'columnStyles';
|
@@ -164,28 +164,6 @@ function mapCellStyle(style: CellStyle): Partial<Styles> {
|
|
164
164
|
};
|
165
165
|
}
|
166
166
|
|
167
|
-
function createTableWithAvailableHeight(
|
168
|
-
tableBody: Row[],
|
169
|
-
availableHeight: number,
|
170
|
-
args: CreateTableArgs
|
171
|
-
) {
|
172
|
-
let limit = availableHeight;
|
173
|
-
const newTableBody: string[][] = [];
|
174
|
-
let index = 0;
|
175
|
-
while (limit > 0 && index < tableBody.length) {
|
176
|
-
const row = tableBody.slice(0, index + 1).pop();
|
177
|
-
if (!row) break;
|
178
|
-
const rowHeight = row.height;
|
179
|
-
if (limit - rowHeight < 0) {
|
180
|
-
break;
|
181
|
-
}
|
182
|
-
newTableBody.push(row.raw);
|
183
|
-
limit -= rowHeight;
|
184
|
-
index++;
|
185
|
-
}
|
186
|
-
return createSingleTable(newTableBody, args);
|
187
|
-
}
|
188
|
-
|
189
167
|
function getTableOptions(schema: TableSchema, body: string[][]): UserOptions {
|
190
168
|
const columnStylesWidth = schema.headWidthPercentages.reduce(
|
191
169
|
(acc, cur, i) => ({ ...acc, [i]: { cellWidth: schema.width * (cur / 100) } }),
|
@@ -272,7 +250,16 @@ export function createSingleTable(body: string[][], args: CreateTableArgs) {
|
|
272
250
|
const { options, _cache, basePdf } = args;
|
273
251
|
if (!isBlankPdf(basePdf)) throw new Error('[@pdfme/schema/table] Custom PDF is not supported');
|
274
252
|
|
275
|
-
const
|
253
|
+
const schema = cloneDeep(args.schema) as TableSchema;
|
254
|
+
const { start } = schema.__bodyRange || { start: 0 };
|
255
|
+
if (start % 2 === 1) {
|
256
|
+
const alternateBackgroundColor = schema.bodyStyles.alternateBackgroundColor;
|
257
|
+
schema.bodyStyles.alternateBackgroundColor = schema.bodyStyles.backgroundColor;
|
258
|
+
schema.bodyStyles.backgroundColor = alternateBackgroundColor;
|
259
|
+
}
|
260
|
+
schema.showHead = schema.showHead === false ? false : start === 0;
|
261
|
+
|
262
|
+
const input = parseInput(schema, body);
|
276
263
|
|
277
264
|
const font = options.font || getDefaultFont();
|
278
265
|
|
@@ -282,41 +269,3 @@ export function createSingleTable(body: string[][], args: CreateTableArgs) {
|
|
282
269
|
|
283
270
|
return Table.create({ input, content, font, _cache });
|
284
271
|
}
|
285
|
-
|
286
|
-
export async function createMultiTables(body: string[][], args: CreateTableArgs): Promise<Table[]> {
|
287
|
-
const { basePdf, schema } = args;
|
288
|
-
|
289
|
-
if (!isBlankPdf(basePdf)) throw new Error('[@pdfme/schema/table] Custom PDF is not supported');
|
290
|
-
const pageHeight = basePdf.height;
|
291
|
-
const paddingBottom = basePdf.padding[2];
|
292
|
-
const paddingTop = basePdf.padding[0];
|
293
|
-
let availableHeight = pageHeight - paddingBottom - schema.position.y;
|
294
|
-
|
295
|
-
const testTable = await createSingleTable(body, args);
|
296
|
-
let remainingBody = testTable.body;
|
297
|
-
const tables: Table[] = [];
|
298
|
-
|
299
|
-
while (remainingBody.length > 0) {
|
300
|
-
const tableHeight =
|
301
|
-
tables.length === 0
|
302
|
-
? availableHeight - testTable.getHeadHeight()
|
303
|
-
: availableHeight - paddingTop;
|
304
|
-
|
305
|
-
const table = await createTableWithAvailableHeight(remainingBody, tableHeight, args);
|
306
|
-
|
307
|
-
tables.push(table);
|
308
|
-
|
309
|
-
remainingBody = remainingBody.slice(table.body.length);
|
310
|
-
|
311
|
-
if (remainingBody.length > 0) {
|
312
|
-
const _schema = cloneDeep(schema);
|
313
|
-
_schema.showHead = false;
|
314
|
-
_schema.position.y = paddingTop;
|
315
|
-
args.schema = _schema;
|
316
|
-
|
317
|
-
availableHeight = pageHeight - paddingTop - paddingBottom;
|
318
|
-
}
|
319
|
-
}
|
320
|
-
|
321
|
-
return tables;
|
322
|
-
}
|
package/src/tables/uiRender.ts
CHANGED
@@ -6,6 +6,8 @@ import { getBody, getBodyWithRange } from './helper.js';
|
|
6
6
|
import cell from './cell.js';
|
7
7
|
import { Row } from './classes';
|
8
8
|
|
9
|
+
const buttonSize = 30;
|
10
|
+
|
9
11
|
type RowType = InstanceType<typeof Row>;
|
10
12
|
|
11
13
|
const cellUiRender = cell.ui;
|
@@ -192,7 +194,7 @@ export const uiRender = async (arg: UIRenderProps<TableSchema>) => {
|
|
192
194
|
void uiRender(arg);
|
193
195
|
};
|
194
196
|
|
195
|
-
if (
|
197
|
+
if (table.settings.showHead) {
|
196
198
|
renderRowUi({
|
197
199
|
rows: table.head,
|
198
200
|
arg,
|
@@ -201,7 +203,7 @@ export const uiRender = async (arg: UIRenderProps<TableSchema>) => {
|
|
201
203
|
});
|
202
204
|
}
|
203
205
|
|
204
|
-
const offsetY =
|
206
|
+
const offsetY = table.settings.showHead ? table.getHeadHeight() : 0;
|
205
207
|
renderRowUi({
|
206
208
|
rows: table.body,
|
207
209
|
arg,
|
@@ -218,11 +220,11 @@ export const uiRender = async (arg: UIRenderProps<TableSchema>) => {
|
|
218
220
|
schema.__bodyRange.end >= (JSON.parse(value || '[]') as string[][]).length
|
219
221
|
) {
|
220
222
|
const addRowButton = document.createElement('button');
|
221
|
-
addRowButton.style.width =
|
222
|
-
addRowButton.style.height =
|
223
|
+
addRowButton.style.width = `${buttonSize}px`;
|
224
|
+
addRowButton.style.height = `${buttonSize}px`;
|
223
225
|
addRowButton.style.position = 'absolute';
|
224
226
|
addRowButton.style.top = `${table.getHeight()}mm`;
|
225
|
-
addRowButton.style.left =
|
227
|
+
addRowButton.style.left = `calc(50% - ${buttonSize / 2}px)`;
|
226
228
|
addRowButton.innerText = '+';
|
227
229
|
addRowButton.onclick = () => {
|
228
230
|
const newRow = Array(schema.head.length).fill('') as string[];
|
@@ -231,15 +233,15 @@ export const uiRender = async (arg: UIRenderProps<TableSchema>) => {
|
|
231
233
|
rootElement.appendChild(addRowButton);
|
232
234
|
}
|
233
235
|
|
234
|
-
let offsetY =
|
236
|
+
let offsetY = table.settings.showHead ? table.getHeadHeight() : 0;
|
235
237
|
table.body.forEach((row, i) => {
|
236
238
|
offsetY = offsetY + row.height;
|
237
239
|
const removeRowButton = document.createElement('button');
|
238
|
-
removeRowButton.style.width =
|
239
|
-
removeRowButton.style.height =
|
240
|
+
removeRowButton.style.width = `${buttonSize}px`;
|
241
|
+
removeRowButton.style.height = `${buttonSize}px`;
|
240
242
|
removeRowButton.style.position = 'absolute';
|
241
|
-
removeRowButton.style.top = `${offsetY - px2mm(
|
242
|
-
removeRowButton.style.right =
|
243
|
+
removeRowButton.style.top = `${offsetY - px2mm(buttonSize)}mm`;
|
244
|
+
removeRowButton.style.right = `-${buttonSize}px`;
|
243
245
|
removeRowButton.innerText = '-';
|
244
246
|
removeRowButton.onclick = () => {
|
245
247
|
const newTableBody = body.filter((_, j) => j !== i + (schema.__bodyRange?.start ?? 0));
|
@@ -251,11 +253,11 @@ export const uiRender = async (arg: UIRenderProps<TableSchema>) => {
|
|
251
253
|
|
252
254
|
if (mode === 'designer' && onChange) {
|
253
255
|
const addColumnButton = document.createElement('button');
|
254
|
-
addColumnButton.style.width =
|
255
|
-
addColumnButton.style.height =
|
256
|
+
addColumnButton.style.width = `${buttonSize}px`;
|
257
|
+
addColumnButton.style.height = `${buttonSize}px`;
|
256
258
|
addColumnButton.style.position = 'absolute';
|
257
|
-
addColumnButton.style.top = `${table.getHeadHeight() - px2mm(
|
258
|
-
addColumnButton.style.right =
|
259
|
+
addColumnButton.style.top = `${table.getHeadHeight() - px2mm(buttonSize)}mm`;
|
260
|
+
addColumnButton.style.right = `-${buttonSize}px`;
|
259
261
|
addColumnButton.innerText = '+';
|
260
262
|
addColumnButton.onclick = (e) => {
|
261
263
|
e.preventDefault();
|
@@ -278,11 +280,11 @@ export const uiRender = async (arg: UIRenderProps<TableSchema>) => {
|
|
278
280
|
table.columns.forEach((column, i) => {
|
279
281
|
offsetX = offsetX + column.width;
|
280
282
|
const removeColumnButton = document.createElement('button');
|
281
|
-
removeColumnButton.style.width =
|
282
|
-
removeColumnButton.style.height =
|
283
|
+
removeColumnButton.style.width = `${buttonSize}px`;
|
284
|
+
removeColumnButton.style.height = `${buttonSize}px`;
|
283
285
|
removeColumnButton.style.position = 'absolute';
|
284
|
-
removeColumnButton.style.top =
|
285
|
-
removeColumnButton.style.left = `${offsetX - px2mm(
|
286
|
+
removeColumnButton.style.top = `-${buttonSize}px`;
|
287
|
+
removeColumnButton.style.left = `${offsetX - px2mm(buttonSize)}mm`;
|
286
288
|
removeColumnButton.innerText = '-';
|
287
289
|
removeColumnButton.onclick = (e) => {
|
288
290
|
e.preventDefault();
|
@@ -386,7 +388,7 @@ export const uiRender = async (arg: UIRenderProps<TableSchema>) => {
|
|
386
388
|
resetEditingPosition();
|
387
389
|
}
|
388
390
|
|
389
|
-
const tableHeight =
|
391
|
+
const tableHeight = table.settings.showHead ? table.getHeight() : table.getBodyHeight();
|
390
392
|
if (schema.height !== tableHeight && onChange) {
|
391
393
|
onChange({ key: 'height', value: tableHeight });
|
392
394
|
}
|
package/src/utils.ts
CHANGED