@formepdf/react 0.1.3 → 0.2.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/dist/serialize.js +15 -5
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/serialize.js
CHANGED
|
@@ -525,6 +525,15 @@ export function mapStyle(style) {
|
|
|
525
525
|
left: style.marginLeft ?? hl,
|
|
526
526
|
};
|
|
527
527
|
}
|
|
528
|
+
// Flex shorthand: flex: N → flexGrow: N, flexShrink: 1, flexBasis: 0
|
|
529
|
+
if (style.flex !== undefined) {
|
|
530
|
+
if (style.flexGrow === undefined)
|
|
531
|
+
result.flexGrow = style.flex;
|
|
532
|
+
if (style.flexShrink === undefined)
|
|
533
|
+
result.flexShrink = 1;
|
|
534
|
+
if (style.flexBasis === undefined)
|
|
535
|
+
result.flexBasis = { Pt: 0 };
|
|
536
|
+
}
|
|
528
537
|
// Flex
|
|
529
538
|
if (style.flexDirection !== undefined)
|
|
530
539
|
result.flexDirection = FLEX_DIRECTION_MAP[style.flexDirection];
|
|
@@ -588,7 +597,8 @@ export function mapStyle(style) {
|
|
|
588
597
|
};
|
|
589
598
|
}
|
|
590
599
|
if (style.borderColor !== undefined || style.borderTopColor !== undefined || style.borderRightColor !== undefined || style.borderBottomColor !== undefined || style.borderLeftColor !== undefined) {
|
|
591
|
-
|
|
600
|
+
const defaultColor = parseColor('#000000');
|
|
601
|
+
let base = { top: defaultColor, right: defaultColor, bottom: defaultColor, left: defaultColor };
|
|
592
602
|
if (typeof style.borderColor === 'string') {
|
|
593
603
|
const c = parseColor(style.borderColor);
|
|
594
604
|
base = { top: c, right: c, bottom: c, left: c };
|
|
@@ -602,10 +612,10 @@ export function mapStyle(style) {
|
|
|
602
612
|
};
|
|
603
613
|
}
|
|
604
614
|
result.borderColor = {
|
|
605
|
-
top:
|
|
606
|
-
right:
|
|
607
|
-
bottom:
|
|
608
|
-
left:
|
|
615
|
+
top: style.borderTopColor ? parseColor(style.borderTopColor) : base.top,
|
|
616
|
+
right: style.borderRightColor ? parseColor(style.borderRightColor) : base.right,
|
|
617
|
+
bottom: style.borderBottomColor ? parseColor(style.borderBottomColor) : base.bottom,
|
|
618
|
+
left: style.borderLeftColor ? parseColor(style.borderLeftColor) : base.left,
|
|
609
619
|
};
|
|
610
620
|
}
|
|
611
621
|
if (style.borderRadius !== undefined || style.borderTopLeftRadius !== undefined || style.borderTopRightRadius !== undefined || style.borderBottomRightRadius !== undefined || style.borderBottomLeftRadius !== undefined) {
|
package/dist/types.d.ts
CHANGED