react-id-card-generator 1.0.21 → 1.1.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.
- package/README.md +33 -12
- package/dist/cjs/components/IDCardDesigner.js +147 -10
- package/dist/cjs/components/IDCardDesigner.js.map +1 -1
- package/dist/cjs/components/IDCardGenerator.js +8 -3
- package/dist/cjs/components/IDCardGenerator.js.map +1 -1
- package/dist/cjs/components/IDCardPreview.js +3 -2
- package/dist/cjs/components/IDCardPreview.js.map +1 -1
- package/dist/cjs/components/IDCardTable.js +74 -0
- package/dist/cjs/components/IDCardTable.js.map +1 -0
- package/dist/cjs/index.js +4 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/storage/templateStorage.js +2 -2
- package/dist/cjs/storage/templateStorage.js.map +1 -1
- package/dist/cjs/styles.css +1 -1
- package/dist/cjs/utils/styleUtils.js +3 -0
- package/dist/cjs/utils/styleUtils.js.map +1 -1
- package/dist/cjs/utils/tableUtils.js +106 -0
- package/dist/cjs/utils/tableUtils.js.map +1 -0
- package/dist/cjs/utils/validators.js +33 -10
- package/dist/cjs/utils/validators.js.map +1 -1
- package/dist/esm/components/IDCardDesigner.js +147 -10
- package/dist/esm/components/IDCardDesigner.js.map +1 -1
- package/dist/esm/components/IDCardGenerator.js +8 -3
- package/dist/esm/components/IDCardGenerator.js.map +1 -1
- package/dist/esm/components/IDCardPreview.js +3 -2
- package/dist/esm/components/IDCardPreview.js.map +1 -1
- package/dist/esm/components/IDCardTable.js +72 -0
- package/dist/esm/components/IDCardTable.js.map +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/storage/templateStorage.js +2 -2
- package/dist/esm/storage/templateStorage.js.map +1 -1
- package/dist/esm/styles.css +1 -1
- package/dist/esm/utils/styleUtils.js +3 -0
- package/dist/esm/utils/styleUtils.js.map +1 -1
- package/dist/esm/utils/tableUtils.js +96 -0
- package/dist/esm/utils/tableUtils.js.map +1 -0
- package/dist/esm/utils/validators.js +33 -10
- package/dist/esm/utils/validators.js.map +1 -1
- package/dist/index.d.ts +43 -4
- package/dist/types/components/IDCardTable.d.ts +8 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/types/index.d.ts +37 -2
- package/dist/types/utils/tableUtils.d.ts +10 -0
- package/package.json +1 -1
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
const DEFAULT_TABLE_ROW_COUNT = 5;
|
|
2
|
+
const DEFAULT_TABLE_COLUMN_COUNT = 5;
|
|
3
|
+
function createDefaultTableColumns(count = DEFAULT_TABLE_COLUMN_COUNT) {
|
|
4
|
+
return Array.from({ length: Math.max(1, count) }, (_, index) => ({
|
|
5
|
+
id: `column_${index + 1}`,
|
|
6
|
+
header: `Header ${index + 1}`,
|
|
7
|
+
fieldKey: `column${index + 1}`,
|
|
8
|
+
width: 1,
|
|
9
|
+
align: 'left',
|
|
10
|
+
}));
|
|
11
|
+
}
|
|
12
|
+
function createDefaultTableConfig() {
|
|
13
|
+
return {
|
|
14
|
+
rowCount: DEFAULT_TABLE_ROW_COUNT,
|
|
15
|
+
columns: createDefaultTableColumns(DEFAULT_TABLE_COLUMN_COUNT),
|
|
16
|
+
showHeader: true,
|
|
17
|
+
zebraRows: false,
|
|
18
|
+
style: {
|
|
19
|
+
borderColor: '#000000',
|
|
20
|
+
borderWidth: 1,
|
|
21
|
+
headerBackgroundColor: '#f0f0f0',
|
|
22
|
+
headerTextColor: '#000000',
|
|
23
|
+
headerFontSize: '10px',
|
|
24
|
+
headerFontWeight: 'bold',
|
|
25
|
+
bodyTextColor: '#000000',
|
|
26
|
+
bodyFontSize: '10px',
|
|
27
|
+
bodyFontWeight: 'normal',
|
|
28
|
+
cellPadding: '2px 4px',
|
|
29
|
+
zebraBackgroundColor: '#f7f7f7',
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function resizeTableColumns(columns, count) {
|
|
34
|
+
const safeCount = Math.max(1, Math.floor(count || 1));
|
|
35
|
+
const existing = columns || [];
|
|
36
|
+
return Array.from({ length: safeCount }, (_, index) => {
|
|
37
|
+
const current = existing[index];
|
|
38
|
+
if (current) {
|
|
39
|
+
return {
|
|
40
|
+
...current,
|
|
41
|
+
id: current.id || `column_${index + 1}`,
|
|
42
|
+
header: current.header ?? `Header ${index + 1}`,
|
|
43
|
+
fieldKey: current.fieldKey || `column${index + 1}`,
|
|
44
|
+
width: current.width && current.width > 0 ? current.width : 1,
|
|
45
|
+
align: current.align || 'left',
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
return createDefaultTableColumns(safeCount)[index];
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function normalizeTableConfig(table) {
|
|
52
|
+
const defaults = createDefaultTableConfig();
|
|
53
|
+
const columns = resizeTableColumns(table?.columns?.length ? table.columns : defaults.columns, table?.columns?.length || DEFAULT_TABLE_COLUMN_COUNT);
|
|
54
|
+
return {
|
|
55
|
+
...defaults,
|
|
56
|
+
...table,
|
|
57
|
+
rowCount: Math.max(1, Math.floor(table?.rowCount || defaults.rowCount)),
|
|
58
|
+
columns,
|
|
59
|
+
showHeader: table?.showHeader ?? defaults.showHeader,
|
|
60
|
+
zebraRows: table?.zebraRows ?? defaults.zebraRows,
|
|
61
|
+
rowHeight: typeof table?.rowHeight === 'number' && table.rowHeight > 0
|
|
62
|
+
? table.rowHeight
|
|
63
|
+
: undefined,
|
|
64
|
+
style: {
|
|
65
|
+
...defaults.style,
|
|
66
|
+
...table?.style,
|
|
67
|
+
borderWidth: typeof table?.style?.borderWidth === 'number' && table.style.borderWidth >= 0
|
|
68
|
+
? table.style.borderWidth
|
|
69
|
+
: defaults.style?.borderWidth,
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function coerceTableRows(value) {
|
|
74
|
+
if (!Array.isArray(value))
|
|
75
|
+
return [];
|
|
76
|
+
return value
|
|
77
|
+
.filter((row) => Boolean(row) && typeof row === 'object' && !Array.isArray(row))
|
|
78
|
+
.map((row) => ({ ...row }));
|
|
79
|
+
}
|
|
80
|
+
function getRenderedTableRows(data, fieldKey, table) {
|
|
81
|
+
const rows = coerceTableRows(data[fieldKey]);
|
|
82
|
+
const renderedRowCount = Math.max(table.rowCount, rows.length);
|
|
83
|
+
return Array.from({ length: renderedRowCount }, (_, index) => rows[index] || {});
|
|
84
|
+
}
|
|
85
|
+
function createSampleTableRows(tableConfig) {
|
|
86
|
+
const table = normalizeTableConfig(tableConfig);
|
|
87
|
+
return Array.from({ length: table.rowCount }, (_, rowIndex) => {
|
|
88
|
+
return table.columns.reduce((row, column) => {
|
|
89
|
+
row[column.fieldKey] = `${column.header} ${rowIndex + 1}`;
|
|
90
|
+
return row;
|
|
91
|
+
}, {});
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export { DEFAULT_TABLE_COLUMN_COUNT, DEFAULT_TABLE_ROW_COUNT, coerceTableRows, createDefaultTableColumns, createDefaultTableConfig, createSampleTableRows, getRenderedTableRows, normalizeTableConfig, resizeTableColumns };
|
|
96
|
+
//# sourceMappingURL=tableUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tableUtils.js","sources":["../../../src/utils/tableUtils.ts"],"sourcesContent":["import type { IDCardData, TableColumn, TableConfig, TableRowData } from '../types';\n\nexport const DEFAULT_TABLE_ROW_COUNT = 5;\nexport const DEFAULT_TABLE_COLUMN_COUNT = 5;\n\nexport function createDefaultTableColumns(count = DEFAULT_TABLE_COLUMN_COUNT): TableColumn[] {\n return Array.from({ length: Math.max(1, count) }, (_, index) => ({\n id: `column_${index + 1}`,\n header: `Header ${index + 1}`,\n fieldKey: `column${index + 1}`,\n width: 1,\n align: 'left',\n }));\n}\n\nexport function createDefaultTableConfig(): TableConfig {\n return {\n rowCount: DEFAULT_TABLE_ROW_COUNT,\n columns: createDefaultTableColumns(DEFAULT_TABLE_COLUMN_COUNT),\n showHeader: true,\n zebraRows: false,\n style: {\n borderColor: '#000000',\n borderWidth: 1,\n headerBackgroundColor: '#f0f0f0',\n headerTextColor: '#000000',\n headerFontSize: '10px',\n headerFontWeight: 'bold',\n bodyTextColor: '#000000',\n bodyFontSize: '10px',\n bodyFontWeight: 'normal',\n cellPadding: '2px 4px',\n zebraBackgroundColor: '#f7f7f7',\n },\n };\n}\n\nexport function resizeTableColumns(\n columns: TableColumn[] | undefined,\n count: number\n): TableColumn[] {\n const safeCount = Math.max(1, Math.floor(count || 1));\n const existing = columns || [];\n\n return Array.from({ length: safeCount }, (_, index) => {\n const current = existing[index];\n if (current) {\n return {\n ...current,\n id: current.id || `column_${index + 1}`,\n header: current.header ?? `Header ${index + 1}`,\n fieldKey: current.fieldKey || `column${index + 1}`,\n width: current.width && current.width > 0 ? current.width : 1,\n align: current.align || 'left',\n };\n }\n\n return createDefaultTableColumns(safeCount)[index];\n });\n}\n\nexport function normalizeTableConfig(table?: TableConfig): TableConfig {\n const defaults = createDefaultTableConfig();\n const columns = resizeTableColumns(\n table?.columns?.length ? table.columns : defaults.columns,\n table?.columns?.length || DEFAULT_TABLE_COLUMN_COUNT\n );\n\n return {\n ...defaults,\n ...table,\n rowCount: Math.max(1, Math.floor(table?.rowCount || defaults.rowCount)),\n columns,\n showHeader: table?.showHeader ?? defaults.showHeader,\n zebraRows: table?.zebraRows ?? defaults.zebraRows,\n rowHeight:\n typeof table?.rowHeight === 'number' && table.rowHeight > 0\n ? table.rowHeight\n : undefined,\n style: {\n ...defaults.style,\n ...table?.style,\n borderWidth:\n typeof table?.style?.borderWidth === 'number' && table.style.borderWidth >= 0\n ? table.style.borderWidth\n : defaults.style?.borderWidth,\n },\n };\n}\n\nexport function coerceTableRows(value: IDCardData[string]): TableRowData[] {\n if (!Array.isArray(value)) return [];\n\n return value\n .filter((row): row is TableRowData => Boolean(row) && typeof row === 'object' && !Array.isArray(row))\n .map((row) => ({ ...row }));\n}\n\nexport function getRenderedTableRows(data: IDCardData, fieldKey: string, table: TableConfig): TableRowData[] {\n const rows = coerceTableRows(data[fieldKey]);\n const renderedRowCount = Math.max(table.rowCount, rows.length);\n\n return Array.from({ length: renderedRowCount }, (_, index) => rows[index] || {});\n}\n\nexport function createSampleTableRows(tableConfig?: TableConfig): TableRowData[] {\n const table = normalizeTableConfig(tableConfig);\n\n return Array.from({ length: table.rowCount }, (_, rowIndex) => {\n return table.columns.reduce<TableRowData>((row, column) => {\n row[column.fieldKey] = `${column.header} ${rowIndex + 1}`;\n return row;\n }, {});\n });\n}\n"],"names":[],"mappings":"AAEO,MAAM,uBAAuB,GAAG;AAChC,MAAM,0BAA0B,GAAG;AAEpC,SAAU,yBAAyB,CAAC,KAAK,GAAG,0BAA0B,EAAA;IAC1E,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,MAAM;AAC/D,QAAA,EAAE,EAAE,CAAA,OAAA,EAAU,KAAK,GAAG,CAAC,CAAA,CAAE;AACzB,QAAA,MAAM,EAAE,CAAA,OAAA,EAAU,KAAK,GAAG,CAAC,CAAA,CAAE;AAC7B,QAAA,QAAQ,EAAE,CAAA,MAAA,EAAS,KAAK,GAAG,CAAC,CAAA,CAAE;AAC9B,QAAA,KAAK,EAAE,CAAC;AACR,QAAA,KAAK,EAAE,MAAM;AACd,KAAA,CAAC,CAAC;AACL;SAEgB,wBAAwB,GAAA;IACtC,OAAO;AACL,QAAA,QAAQ,EAAE,uBAAuB;AACjC,QAAA,OAAO,EAAE,yBAAyB,CAAC,0BAA0B,CAAC;AAC9D,QAAA,UAAU,EAAE,IAAI;AAChB,QAAA,SAAS,EAAE,KAAK;AAChB,QAAA,KAAK,EAAE;AACL,YAAA,WAAW,EAAE,SAAS;AACtB,YAAA,WAAW,EAAE,CAAC;AACd,YAAA,qBAAqB,EAAE,SAAS;AAChC,YAAA,eAAe,EAAE,SAAS;AAC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(!template.backgrounds?.front && template.sides === 'single') {
|
|
30
|
-
errors.push({ field: 'backgrounds.front', message: 'Front background is required' });
|
|
31
|
-
}
|
|
32
|
-
if (template.sides === 'double' && !template.backgrounds?.back) {
|
|
33
|
-
errors.push({
|
|
34
|
-
field: 'backgrounds.back',
|
|
35
|
-
message: 'Back background is required for double-sided cards',
|
|
36
|
-
});
|
|
37
|
-
}
|
|
28
|
+
// Backgrounds are optional; blank card sides render with the default card background.
|
|
38
29
|
// Validate fields
|
|
39
30
|
if (!template.fields || template.fields.length === 0) {
|
|
40
31
|
errors.push({ field: 'fields', message: 'At least one field is required' });
|
|
@@ -106,6 +97,38 @@ function validateField(field, index) {
|
|
|
106
97
|
message: 'Label fields require static text',
|
|
107
98
|
});
|
|
108
99
|
}
|
|
100
|
+
if (field.type === 'table') {
|
|
101
|
+
if (!field.table) {
|
|
102
|
+
errors.push({
|
|
103
|
+
field: `${prefix}.table`,
|
|
104
|
+
message: 'Table fields require table configuration',
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
if (!field.table.rowCount || field.table.rowCount <= 0) {
|
|
109
|
+
errors.push({
|
|
110
|
+
field: `${prefix}.table.rowCount`,
|
|
111
|
+
message: 'Table row count must be positive',
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
if (!field.table.columns || field.table.columns.length === 0) {
|
|
115
|
+
errors.push({
|
|
116
|
+
field: `${prefix}.table.columns`,
|
|
117
|
+
message: 'Table fields require at least one column',
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
field.table.columns.forEach((column, columnIndex) => {
|
|
122
|
+
if (!column.fieldKey) {
|
|
123
|
+
errors.push({
|
|
124
|
+
field: `${prefix}.table.columns[${columnIndex}].fieldKey`,
|
|
125
|
+
message: 'Table columns require field keys',
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
109
132
|
return errors;
|
|
110
133
|
}
|
|
111
134
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.js","sources":["../../../src/utils/validators.ts"],"sourcesContent":["import type { IDCardTemplate, FieldMapping, CardSize } from '../types';\r\n\r\nexport interface ValidationError {\r\n field: string;\r\n message: string;\r\n}\r\n\r\n/**\r\n * Validate a complete ID card template\r\n * Checks for required fields, valid dimensions, and proper field configuration\r\n * @param template - The template to validate\r\n * @returns Array of validation errors (empty if valid)\r\n */\r\nexport function validateTemplate(template: IDCardTemplate): ValidationError[] {\r\n const errors: ValidationError[] = [];\r\n\r\n // Check required metadata\r\n if (!template.id) {\r\n errors.push({ field: 'id', message: 'Template ID is required' });\r\n }\r\n\r\n if (!template.name) {\r\n errors.push({ field: 'name', message: 'Template name is required' });\r\n }\r\n\r\n // Validate card dimensions\r\n if (!template.cardSize) {\r\n errors.push({ field: 'cardSize', message: 'Card size is required' });\r\n } else {\r\n if (template.cardSize.width <= 0) {\r\n errors.push({ field: 'cardSize.width', message: 'Card width must be positive' });\r\n }\r\n if (template.cardSize.height <= 0) {\r\n errors.push({ field: 'cardSize.height', message: 'Card height must be positive' });\r\n }\r\n }\r\n\r\n // Validate backgrounds\r\n if (!template.backgrounds?.front && template.sides === 'single') {\r\n errors.push({ field: 'backgrounds.front', message: 'Front background is required' });\r\n }\r\n\r\n if (template.sides === 'double' && !template.backgrounds?.back) {\r\n errors.push({\r\n field: 'backgrounds.back',\r\n message: 'Back background is required for double-sided cards',\r\n });\r\n }\r\n\r\n // Validate fields\r\n if (!template.fields || template.fields.length === 0) {\r\n errors.push({ field: 'fields', message: 'At least one field is required' });\r\n } else {\r\n template.fields.forEach((field, index) => {\r\n const fieldErrors = validateField(field, index);\r\n errors.push(...fieldErrors);\r\n });\r\n }\r\n\r\n // Ensure no duplicate field IDs (would cause rendering issues)\r\n const fieldIds = template.fields?.map((f) => f.id) || [];\r\n const duplicateIds = fieldIds.filter((id, index) => fieldIds.indexOf(id) !== index);\r\n if (duplicateIds.length > 0) {\r\n errors.push({\r\n field: 'fields',\r\n message: `Duplicate field IDs: ${[...new Set(duplicateIds)].join(', ')}`,\r\n });\r\n }\r\n\r\n return errors;\r\n}\r\n\r\n/**\r\n * Validate a single field's configuration\r\n * @param field - The field to validate\r\n * @param index - Field index (for error messages)\r\n * @returns Array of validation errors\r\n */\r\nexport function validateField(field: FieldMapping, index: number): ValidationError[] {\r\n const errors: ValidationError[] = [];\r\n const prefix = `fields[${index}]`;\r\n\r\n if (!field.id) {\r\n errors.push({ field: `${prefix}.id`, message: 'Field ID is required' });\r\n }\r\n\r\n if (!field.fieldKey) {\r\n errors.push({ field: `${prefix}.fieldKey`, message: 'Field key is required' });\r\n }\r\n\r\n if (!field.type) {\r\n errors.push({ field: `${prefix}.type`, message: 'Field type is required' });\r\n }\r\n\r\n if (!field.side) {\r\n errors.push({ field: `${prefix}.side`, message: 'Field side is required' });\r\n }\r\n\r\n if (!field.position) {\r\n errors.push({ field: `${prefix}.position`, message: 'Field position is required' });\r\n } else {\r\n if (field.position.x < 0) {\r\n errors.push({ field: `${prefix}.position.x`, message: 'X position cannot be negative' });\r\n }\r\n if (field.position.y < 0) {\r\n errors.push({ field: `${prefix}.position.y`, message: 'Y position cannot be negative' });\r\n }\r\n if (field.position.width <= 0) {\r\n errors.push({ field: `${prefix}.position.width`, message: 'Width must be positive' });\r\n }\r\n if (field.position.height <= 0) {\r\n errors.push({ field: `${prefix}.position.height`, message: 'Height must be positive' });\r\n }\r\n }\r\n\r\n\r\n\r\n if (field.type === 'qrcode' && (!field.qrFields || field.qrFields.length === 0)) {\r\n errors.push({\r\n field: `${prefix}.qrFields`,\r\n message: 'QR code fields require at least one data field',\r\n });\r\n }\r\n\r\n if (field.type === 'label' && !field.staticText && !field.label) {\r\n errors.push({\r\n field: `${prefix}.staticText`,\r\n message: 'Label fields require static text',\r\n });\r\n }\r\n\r\n return errors;\r\n}\r\n\r\n/**\r\n * Validate card size against standard dimensions\r\n */\r\nexport function validateCardSize(size: CardSize): boolean {\r\n const standardSizes = {\r\n 'CR80': { width: 85.6, height: 53.98, unit: 'mm' },\r\n 'CR79': { width: 83.9, height: 51.0, unit: 'mm' },\r\n 'CR100': { width: 98.0, height: 67.0, unit: 'mm' },\r\n };\r\n\r\n // Just ensure dimensions are reasonable\r\n if (size.unit === 'mm') {\r\n return size.width >= 30 && size.width <= 200 && size.height >= 30 && size.height <= 200;\r\n }\r\n if (size.unit === 'px') {\r\n return size.width >= 100 && size.width <= 2000 && size.height >= 100 && size.height <= 2000;\r\n }\r\n if (size.unit === 'in') {\r\n return size.width >= 1 && size.width <= 10 && size.height >= 1 && size.height <= 10;\r\n }\r\n\r\n return true;\r\n}\r\n\r\n/**\r\n * Check if a field is within card bounds\r\n */\r\nexport function isFieldInBounds(\r\n field: FieldMapping,\r\n cardSize: CardSize\r\n): boolean {\r\n const { x, y, width, height } = field.position;\r\n return (\r\n x >= 0 &&\r\n y >= 0 &&\r\n x + width <= cardSize.width &&\r\n y + height <= cardSize.height\r\n );\r\n}\r\n"],"names":[],"mappings":"AAOA;;;;;AAKG;AACG,SAAU,gBAAgB,CAAC,QAAwB,EAAA;IACvD,MAAM,MAAM,GAAsB,EAAE;;AAGpC,IAAA,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE;AAChB,QAAA,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,yBAAyB,EAAE,CAAC;IAClE;AAEA,IAAA,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE;AAClB,QAAA,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,2BAA2B,EAAE,CAAC;IACtE;;AAGA,IAAA,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE;AACtB,QAAA,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,uBAAuB,EAAE,CAAC;IACtE;SAAO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G;AACG,SAAU,eAAe,CAC7B,KAAmB,EACnB,QAAkB,EAAA;AAElB,IAAA,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,QAAQ;IAC9C,QACE,CAAC,IAAI,CAAC;AACN,QAAA,CAAC,IAAI,CAAC;AACN,QAAA,CAAC,GAAG,KAAK,IAAI,QAAQ,CAAC,KAAK;AAC3B,QAAA,CAAC,GAAG,MAAM,IAAI,QAAQ,CAAC,MAAM;AAEjC;;;;"}
|
|
1
|
+
{"version":3,"file":"validators.js","sources":["../../../src/utils/validators.ts"],"sourcesContent":["import type { IDCardTemplate, FieldMapping, CardSize } from '../types';\r\n\r\nexport interface ValidationError {\r\n field: string;\r\n message: string;\r\n}\r\n\r\n/**\r\n * Validate a complete ID card template\r\n * Checks for required fields, valid dimensions, and proper field configuration\r\n * @param template - The template to validate\r\n * @returns Array of validation errors (empty if valid)\r\n */\r\nexport function validateTemplate(template: IDCardTemplate): ValidationError[] {\r\n const errors: ValidationError[] = [];\r\n\r\n // Check required metadata\r\n if (!template.id) {\r\n errors.push({ field: 'id', message: 'Template ID is required' });\r\n }\r\n\r\n if (!template.name) {\r\n errors.push({ field: 'name', message: 'Template name is required' });\r\n }\r\n\r\n // Validate card dimensions\r\n if (!template.cardSize) {\r\n errors.push({ field: 'cardSize', message: 'Card size is required' });\r\n } else {\r\n if (template.cardSize.width <= 0) {\r\n errors.push({ field: 'cardSize.width', message: 'Card width must be positive' });\r\n }\r\n if (template.cardSize.height <= 0) {\r\n errors.push({ field: 'cardSize.height', message: 'Card height must be positive' });\r\n }\r\n }\r\n\r\n // Backgrounds are optional; blank card sides render with the default card background.\n\r\n // Validate fields\r\n if (!template.fields || template.fields.length === 0) {\r\n errors.push({ field: 'fields', message: 'At least one field is required' });\r\n } else {\r\n template.fields.forEach((field, index) => {\r\n const fieldErrors = validateField(field, index);\r\n errors.push(...fieldErrors);\r\n });\r\n }\r\n\r\n // Ensure no duplicate field IDs (would cause rendering issues)\r\n const fieldIds = template.fields?.map((f) => f.id) || [];\r\n const duplicateIds = fieldIds.filter((id, index) => fieldIds.indexOf(id) !== index);\r\n if (duplicateIds.length > 0) {\r\n errors.push({\r\n field: 'fields',\r\n message: `Duplicate field IDs: ${[...new Set(duplicateIds)].join(', ')}`,\r\n });\r\n }\r\n\r\n return errors;\r\n}\r\n\r\n/**\r\n * Validate a single field's configuration\r\n * @param field - The field to validate\r\n * @param index - Field index (for error messages)\r\n * @returns Array of validation errors\r\n */\r\nexport function validateField(field: FieldMapping, index: number): ValidationError[] {\r\n const errors: ValidationError[] = [];\r\n const prefix = `fields[${index}]`;\r\n\r\n if (!field.id) {\r\n errors.push({ field: `${prefix}.id`, message: 'Field ID is required' });\r\n }\r\n\r\n if (!field.fieldKey) {\r\n errors.push({ field: `${prefix}.fieldKey`, message: 'Field key is required' });\r\n }\r\n\r\n if (!field.type) {\r\n errors.push({ field: `${prefix}.type`, message: 'Field type is required' });\r\n }\r\n\r\n if (!field.side) {\r\n errors.push({ field: `${prefix}.side`, message: 'Field side is required' });\r\n }\r\n\r\n if (!field.position) {\r\n errors.push({ field: `${prefix}.position`, message: 'Field position is required' });\r\n } else {\r\n if (field.position.x < 0) {\r\n errors.push({ field: `${prefix}.position.x`, message: 'X position cannot be negative' });\r\n }\r\n if (field.position.y < 0) {\r\n errors.push({ field: `${prefix}.position.y`, message: 'Y position cannot be negative' });\r\n }\r\n if (field.position.width <= 0) {\r\n errors.push({ field: `${prefix}.position.width`, message: 'Width must be positive' });\r\n }\r\n if (field.position.height <= 0) {\r\n errors.push({ field: `${prefix}.position.height`, message: 'Height must be positive' });\r\n }\r\n }\r\n\r\n\r\n\r\n if (field.type === 'qrcode' && (!field.qrFields || field.qrFields.length === 0)) {\r\n errors.push({\r\n field: `${prefix}.qrFields`,\r\n message: 'QR code fields require at least one data field',\r\n });\r\n }\r\n\r\n if (field.type === 'label' && !field.staticText && !field.label) {\n errors.push({\n field: `${prefix}.staticText`,\n message: 'Label fields require static text',\n });\n }\n\n if (field.type === 'table') {\n if (!field.table) {\n errors.push({\n field: `${prefix}.table`,\n message: 'Table fields require table configuration',\n });\n } else {\n if (!field.table.rowCount || field.table.rowCount <= 0) {\n errors.push({\n field: `${prefix}.table.rowCount`,\n message: 'Table row count must be positive',\n });\n }\n\n if (!field.table.columns || field.table.columns.length === 0) {\n errors.push({\n field: `${prefix}.table.columns`,\n message: 'Table fields require at least one column',\n });\n } else {\n field.table.columns.forEach((column, columnIndex) => {\n if (!column.fieldKey) {\n errors.push({\n field: `${prefix}.table.columns[${columnIndex}].fieldKey`,\n message: 'Table columns require field keys',\n });\n }\n });\n }\n }\n }\n\n return errors;\n}\n\r\n/**\r\n * Validate card size against standard dimensions\r\n */\r\nexport function validateCardSize(size: CardSize): boolean {\r\n const standardSizes = {\r\n 'CR80': { width: 85.6, height: 53.98, unit: 'mm' },\r\n 'CR79': { width: 83.9, height: 51.0, unit: 'mm' },\r\n 'CR100': { width: 98.0, height: 67.0, unit: 'mm' },\r\n };\r\n\r\n // Just ensure dimensions are reasonable\r\n if (size.unit === 'mm') {\r\n return size.width >= 30 && size.width <= 200 && size.height >= 30 && size.height <= 200;\r\n }\r\n if (size.unit === 'px') {\r\n return size.width >= 100 && size.width <= 2000 && size.height >= 100 && size.height <= 2000;\r\n }\r\n if (size.unit === 'in') {\r\n return size.width >= 1 && size.width <= 10 && size.height >= 1 && size.height <= 10;\r\n }\r\n\r\n return true;\r\n}\r\n\r\n/**\r\n * Check if a field is within card bounds\r\n */\r\nexport function isFieldInBounds(\r\n field: FieldMapping,\r\n cardSize: CardSize\r\n): boolean {\r\n const { x, y, width, height } = field.position;\r\n return (\r\n x >= 0 &&\r\n y >= 0 &&\r\n x + width <= cardSize.width &&\r\n y + height <= cardSize.height\r\n );\r\n}\r\n"],"names":[],"mappings":"AAOA;;;;;AAKG;AACG,SAAU,gBAAgB,CAAC,QAAwB,EAAA;IACvD,MAAM,MAAM,GAAsB,EA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kB,EAAA;AAElB,IAAA,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,QAAQ;IAC9C,QACE,CAAC,IAAI,CAAC;AACN,QAAA,CAAC,IAAI,CAAC;AACN,QAAA,CAAC,GAAG,KAAK,IAAI,QAAQ,CAAC,KAAK;AAC3B,QAAA,CAAC,GAAG,MAAM,IAAI,QAAQ,CAAC,MAAM;AAEjC;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -47,14 +47,48 @@ interface FieldStyle {
|
|
|
47
47
|
lineHeight?: string;
|
|
48
48
|
letterSpacing?: string;
|
|
49
49
|
}
|
|
50
|
+
type TableCellValue = string | number | boolean | null | undefined;
|
|
51
|
+
interface TableRowData {
|
|
52
|
+
[key: string]: TableCellValue;
|
|
53
|
+
}
|
|
54
|
+
interface TableColumn {
|
|
55
|
+
id: string;
|
|
56
|
+
header: string;
|
|
57
|
+
fieldKey: string;
|
|
58
|
+
/** Relative width weight for CSS grid columns */
|
|
59
|
+
width?: number;
|
|
60
|
+
align?: 'left' | 'center' | 'right';
|
|
61
|
+
}
|
|
62
|
+
interface TableStyle {
|
|
63
|
+
borderColor?: string;
|
|
64
|
+
borderWidth?: number;
|
|
65
|
+
headerBackgroundColor?: string;
|
|
66
|
+
headerTextColor?: string;
|
|
67
|
+
headerFontSize?: string;
|
|
68
|
+
headerFontWeight?: FieldStyle['fontWeight'];
|
|
69
|
+
bodyTextColor?: string;
|
|
70
|
+
bodyFontSize?: string;
|
|
71
|
+
bodyFontWeight?: FieldStyle['fontWeight'];
|
|
72
|
+
cellPadding?: string;
|
|
73
|
+
zebraBackgroundColor?: string;
|
|
74
|
+
}
|
|
75
|
+
interface TableConfig {
|
|
76
|
+
rowCount: number;
|
|
77
|
+
columns: TableColumn[];
|
|
78
|
+
showHeader?: boolean;
|
|
79
|
+
zebraRows?: boolean;
|
|
80
|
+
rowHeight?: number;
|
|
81
|
+
style?: TableStyle;
|
|
82
|
+
}
|
|
50
83
|
/**
|
|
51
84
|
* Available field types for ID cards
|
|
52
85
|
* - text: Dynamic text data (name, ID, etc.)
|
|
53
86
|
* - image: Photos or logos
|
|
54
87
|
* - qrcode: QR codes generated from card data
|
|
55
88
|
* - label: Static text that doesn't change
|
|
89
|
+
* - table: Tabular row data with configurable columns
|
|
56
90
|
*/
|
|
57
|
-
type FieldType = 'text' | 'image' | 'qrcode' | 'label';
|
|
91
|
+
type FieldType = 'text' | 'image' | 'qrcode' | 'label' | 'table';
|
|
58
92
|
/**
|
|
59
93
|
* A single field on the ID card (text, image, QR code, etc.)
|
|
60
94
|
* This defines what the field displays and how it's styled
|
|
@@ -72,6 +106,7 @@ interface FieldMapping {
|
|
|
72
106
|
qrFields?: string[];
|
|
73
107
|
aspectRatio?: number;
|
|
74
108
|
staticText?: string;
|
|
109
|
+
table?: TableConfig;
|
|
75
110
|
zIndex?: number;
|
|
76
111
|
}
|
|
77
112
|
type CardOrientation = 'portrait' | 'landscape';
|
|
@@ -114,7 +149,7 @@ interface IDCardTemplate {
|
|
|
114
149
|
* Example: { name: 'John Doe', photo: 'data:image/jpeg;base64,...' }
|
|
115
150
|
*/
|
|
116
151
|
interface IDCardData {
|
|
117
|
-
[key: string]: string | number | boolean | string[] | undefined;
|
|
152
|
+
[key: string]: string | number | boolean | string[] | TableRowData[] | undefined;
|
|
118
153
|
}
|
|
119
154
|
/**
|
|
120
155
|
* Options for exporting cards to PDF or images
|
|
@@ -501,5 +536,9 @@ declare const defaultFieldStyles: Record<string, FieldStyle>;
|
|
|
501
536
|
*/
|
|
502
537
|
declare function cn(...classes: (string | undefined | null | false)[]): string;
|
|
503
538
|
|
|
504
|
-
|
|
505
|
-
|
|
539
|
+
declare function createDefaultTableColumns(count?: number): TableColumn[];
|
|
540
|
+
declare function createDefaultTableConfig(): TableConfig;
|
|
541
|
+
declare function normalizeTableConfig(table?: TableConfig): TableConfig;
|
|
542
|
+
|
|
543
|
+
export { IDCardDesigner, IDCardGenerator, IDCardPreview, cn, createDefaultTableColumns, createDefaultTableConfig, createDefaultTemplate, defaultFieldStyles, downloadIDCardAsImage, downloadIDCardAsPDF, exportIDCard, exportTemplateAsJSON, fieldStyleToCSS, generateId, generateQrCodeDataURL, generateQrCodeFromFields, imageFileToBase64, importTemplateFromJSON, isFieldInBounds, listTemplatesFromLocal, loadTemplateFromLocal, mergeStyles, normalizeTableConfig, positionToStyle, removeTemplateFromLocal, saveTemplateToLocal, setQrCodeOnElement, toReactStyle, useFieldMapping, useIDCardExport, useIDCardTemplate, validateCardSize, validateField, validateTemplate };
|
|
544
|
+
export type { CardBackground, CardOrientation, CardSides, CardSize, DragState, ExportOptions, ExportResult, FieldDefinition, FieldMapping, FieldPosition, FieldStyle, FieldType, IDCardData, IDCardDesignerProps, IDCardGeneratorProps, IDCardPreviewProps, IDCardTemplate, ResizeState, TableCellValue, TableColumn, TableConfig, TableRowData, TableStyle, TemplateStorage, UseFieldMappingReturn, UseIDCardExportReturn, UseIDCardTemplateReturn };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -29,5 +29,6 @@ export { downloadIDCardAsPDF, downloadIDCardAsImage, exportIDCard, } from './cor
|
|
|
29
29
|
export { saveTemplateToLocal, loadTemplateFromLocal, listTemplatesFromLocal, removeTemplateFromLocal, exportTemplateAsJSON, importTemplateFromJSON, imageFileToBase64, generateId, createDefaultTemplate, } from './storage/templateStorage';
|
|
30
30
|
export { validateTemplate, validateField, validateCardSize, isFieldInBounds, } from './utils/validators';
|
|
31
31
|
export { toReactStyle, fieldStyleToCSS, mergeStyles, positionToStyle, defaultFieldStyles, cn, } from './utils/styleUtils';
|
|
32
|
-
export
|
|
32
|
+
export { createDefaultTableColumns, createDefaultTableConfig, normalizeTableConfig, } from './utils/tableUtils';
|
|
33
|
+
export type { FieldPosition, FieldStyle, FieldType, FieldMapping, FieldDefinition, TableCellValue, TableRowData, TableColumn, TableStyle, TableConfig, CardOrientation, CardSides, CardSize, CardBackground, IDCardTemplate, IDCardData, ExportOptions, ExportResult, IDCardGeneratorProps, IDCardDesignerProps, IDCardPreviewProps, UseIDCardTemplateReturn, UseIDCardExportReturn, UseFieldMappingReturn, TemplateStorage, DragState, ResizeState, } from './types';
|
|
33
34
|
import './components/IDCardDesigner.css';
|
|
@@ -46,14 +46,48 @@ export interface FieldStyle {
|
|
|
46
46
|
lineHeight?: string;
|
|
47
47
|
letterSpacing?: string;
|
|
48
48
|
}
|
|
49
|
+
export type TableCellValue = string | number | boolean | null | undefined;
|
|
50
|
+
export interface TableRowData {
|
|
51
|
+
[key: string]: TableCellValue;
|
|
52
|
+
}
|
|
53
|
+
export interface TableColumn {
|
|
54
|
+
id: string;
|
|
55
|
+
header: string;
|
|
56
|
+
fieldKey: string;
|
|
57
|
+
/** Relative width weight for CSS grid columns */
|
|
58
|
+
width?: number;
|
|
59
|
+
align?: 'left' | 'center' | 'right';
|
|
60
|
+
}
|
|
61
|
+
export interface TableStyle {
|
|
62
|
+
borderColor?: string;
|
|
63
|
+
borderWidth?: number;
|
|
64
|
+
headerBackgroundColor?: string;
|
|
65
|
+
headerTextColor?: string;
|
|
66
|
+
headerFontSize?: string;
|
|
67
|
+
headerFontWeight?: FieldStyle['fontWeight'];
|
|
68
|
+
bodyTextColor?: string;
|
|
69
|
+
bodyFontSize?: string;
|
|
70
|
+
bodyFontWeight?: FieldStyle['fontWeight'];
|
|
71
|
+
cellPadding?: string;
|
|
72
|
+
zebraBackgroundColor?: string;
|
|
73
|
+
}
|
|
74
|
+
export interface TableConfig {
|
|
75
|
+
rowCount: number;
|
|
76
|
+
columns: TableColumn[];
|
|
77
|
+
showHeader?: boolean;
|
|
78
|
+
zebraRows?: boolean;
|
|
79
|
+
rowHeight?: number;
|
|
80
|
+
style?: TableStyle;
|
|
81
|
+
}
|
|
49
82
|
/**
|
|
50
83
|
* Available field types for ID cards
|
|
51
84
|
* - text: Dynamic text data (name, ID, etc.)
|
|
52
85
|
* - image: Photos or logos
|
|
53
86
|
* - qrcode: QR codes generated from card data
|
|
54
87
|
* - label: Static text that doesn't change
|
|
88
|
+
* - table: Tabular row data with configurable columns
|
|
55
89
|
*/
|
|
56
|
-
export type FieldType = 'text' | 'image' | 'qrcode' | 'label';
|
|
90
|
+
export type FieldType = 'text' | 'image' | 'qrcode' | 'label' | 'table';
|
|
57
91
|
/**
|
|
58
92
|
* A single field on the ID card (text, image, QR code, etc.)
|
|
59
93
|
* This defines what the field displays and how it's styled
|
|
@@ -71,6 +105,7 @@ export interface FieldMapping {
|
|
|
71
105
|
qrFields?: string[];
|
|
72
106
|
aspectRatio?: number;
|
|
73
107
|
staticText?: string;
|
|
108
|
+
table?: TableConfig;
|
|
74
109
|
zIndex?: number;
|
|
75
110
|
}
|
|
76
111
|
export type CardOrientation = 'portrait' | 'landscape';
|
|
@@ -113,7 +148,7 @@ export interface IDCardTemplate {
|
|
|
113
148
|
* Example: { name: 'John Doe', photo: 'data:image/jpeg;base64,...' }
|
|
114
149
|
*/
|
|
115
150
|
export interface IDCardData {
|
|
116
|
-
[key: string]: string | number | boolean | string[] | undefined;
|
|
151
|
+
[key: string]: string | number | boolean | string[] | TableRowData[] | undefined;
|
|
117
152
|
}
|
|
118
153
|
/**
|
|
119
154
|
* Options for exporting cards to PDF or images
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IDCardData, TableColumn, TableConfig, TableRowData } from '../types';
|
|
2
|
+
export declare const DEFAULT_TABLE_ROW_COUNT = 5;
|
|
3
|
+
export declare const DEFAULT_TABLE_COLUMN_COUNT = 5;
|
|
4
|
+
export declare function createDefaultTableColumns(count?: number): TableColumn[];
|
|
5
|
+
export declare function createDefaultTableConfig(): TableConfig;
|
|
6
|
+
export declare function resizeTableColumns(columns: TableColumn[] | undefined, count: number): TableColumn[];
|
|
7
|
+
export declare function normalizeTableConfig(table?: TableConfig): TableConfig;
|
|
8
|
+
export declare function coerceTableRows(value: IDCardData[string]): TableRowData[];
|
|
9
|
+
export declare function getRenderedTableRows(data: IDCardData, fieldKey: string, table: TableConfig): TableRowData[];
|
|
10
|
+
export declare function createSampleTableRows(tableConfig?: TableConfig): TableRowData[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-id-card-generator",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "A flexible React library for designing, configuring, and generating ID cards with drag-and-drop field positioning",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"type": "module",
|