datastake-daf 0.6.441 → 0.6.442
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/components/index.js
CHANGED
|
@@ -14535,12 +14535,6 @@ DAFFooter.propTypes = {
|
|
|
14535
14535
|
isViewMode: PropTypes__default["default"].bool
|
|
14536
14536
|
};
|
|
14537
14537
|
|
|
14538
|
-
const PAGE_HEIGHT = 1587;
|
|
14539
|
-
const HEADER_HEIGHT = 100;
|
|
14540
|
-
const FOOTER_HEIGHT = 70;
|
|
14541
|
-
const GAP_BETWEEN_BLOCKS = 24;
|
|
14542
|
-
const FILL_RATIO = 0.80;
|
|
14543
|
-
const CONTENT_HEIGHT = PAGE_HEIGHT - HEADER_HEIGHT - FOOTER_HEIGHT;
|
|
14544
14538
|
const Row = _ref => {
|
|
14545
14539
|
let {
|
|
14546
14540
|
widgets,
|
|
@@ -14578,6 +14572,29 @@ function PdfView(_ref2) {
|
|
|
14578
14572
|
documentId = "IDD-0000000",
|
|
14579
14573
|
downloadId = "DWL-00000123"
|
|
14580
14574
|
} = _ref2;
|
|
14575
|
+
function useA4HeightPx() {
|
|
14576
|
+
const [pagePx, setPagePx] = React.useState(1123); // fallback ~A4 @96dpi
|
|
14577
|
+
React.useLayoutEffect(() => {
|
|
14578
|
+
const probe = document.createElement("div");
|
|
14579
|
+
probe.style.position = "absolute";
|
|
14580
|
+
probe.style.visibility = "hidden";
|
|
14581
|
+
probe.style.height = "1in"; // physical inch
|
|
14582
|
+
probe.style.width = "1in";
|
|
14583
|
+
document.body.appendChild(probe);
|
|
14584
|
+
const ppi = probe.getBoundingClientRect().height; // px per inch at current zoom
|
|
14585
|
+
document.body.removeChild(probe);
|
|
14586
|
+
const A4_INCHES = 11.69; // height
|
|
14587
|
+
setPagePx(Math.round(A4_INCHES * ppi));
|
|
14588
|
+
}, []);
|
|
14589
|
+
return pagePx;
|
|
14590
|
+
}
|
|
14591
|
+
const PAGE_HEIGHT = useA4HeightPx();
|
|
14592
|
+
const HEADER_HEIGHT = 100;
|
|
14593
|
+
const FOOTER_HEIGHT = 70;
|
|
14594
|
+
const GAP_BETWEEN_BLOCKS = 24;
|
|
14595
|
+
const FILL_RATIO = 0.80;
|
|
14596
|
+
const CONTENT_HEIGHT = PAGE_HEIGHT - HEADER_HEIGHT - FOOTER_HEIGHT;
|
|
14597
|
+
|
|
14581
14598
|
// Config actually used for rendering (may expand if we split big blocks)
|
|
14582
14599
|
const [expandedConfig, setExpandedConfig] = React.useState(config);
|
|
14583
14600
|
// index -> {height, ref}
|
|
@@ -14731,7 +14748,8 @@ function PdfView(_ref2) {
|
|
|
14731
14748
|
style: {
|
|
14732
14749
|
height: PAGE_HEIGHT,
|
|
14733
14750
|
position: "relative",
|
|
14734
|
-
overflow: "
|
|
14751
|
+
overflow: "visible",
|
|
14752
|
+
boxSizing: "border-box"
|
|
14735
14753
|
},
|
|
14736
14754
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
14737
14755
|
style: {
|
package/package.json
CHANGED
|
@@ -3,13 +3,9 @@ import PropTypes from "prop-types";
|
|
|
3
3
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { formatClassname } from "../../../../../helpers/ClassesHelper";
|
|
5
5
|
|
|
6
|
-
const PAGE_HEIGHT = 1587;
|
|
7
|
-
const HEADER_HEIGHT = 100;
|
|
8
|
-
const FOOTER_HEIGHT = 70;
|
|
9
|
-
const GAP_BETWEEN_BLOCKS = 24;
|
|
10
|
-
const FILL_RATIO = 0.80;
|
|
11
6
|
|
|
12
|
-
|
|
7
|
+
|
|
8
|
+
|
|
13
9
|
|
|
14
10
|
const Row = ({ widgets, i, onChangeHeight = () => {} }) => {
|
|
15
11
|
const ref = useRef(null);
|
|
@@ -41,6 +37,31 @@ export default function PdfView({
|
|
|
41
37
|
documentId = "IDD-0000000",
|
|
42
38
|
downloadId = "DWL-00000123",
|
|
43
39
|
}) {
|
|
40
|
+
|
|
41
|
+
function useA4HeightPx() {
|
|
42
|
+
const [pagePx, setPagePx] = useState(1123); // fallback ~A4 @96dpi
|
|
43
|
+
useLayoutEffect(() => {
|
|
44
|
+
const probe = document.createElement("div");
|
|
45
|
+
probe.style.position = "absolute";
|
|
46
|
+
probe.style.visibility = "hidden";
|
|
47
|
+
probe.style.height = "1in"; // physical inch
|
|
48
|
+
probe.style.width = "1in";
|
|
49
|
+
document.body.appendChild(probe);
|
|
50
|
+
const ppi = probe.getBoundingClientRect().height; // px per inch at current zoom
|
|
51
|
+
document.body.removeChild(probe);
|
|
52
|
+
const A4_INCHES = 11.69; // height
|
|
53
|
+
setPagePx(Math.round(A4_INCHES * ppi));
|
|
54
|
+
}, []);
|
|
55
|
+
return pagePx;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const PAGE_HEIGHT = useA4HeightPx();
|
|
59
|
+
const HEADER_HEIGHT = 100;
|
|
60
|
+
const FOOTER_HEIGHT = 70;
|
|
61
|
+
const GAP_BETWEEN_BLOCKS = 24;
|
|
62
|
+
const FILL_RATIO = 0.80;
|
|
63
|
+
const CONTENT_HEIGHT = PAGE_HEIGHT - HEADER_HEIGHT - FOOTER_HEIGHT;
|
|
64
|
+
|
|
44
65
|
// Config actually used for rendering (may expand if we split big blocks)
|
|
45
66
|
const [expandedConfig, setExpandedConfig] = useState(config);
|
|
46
67
|
// index -> {height, ref}
|
|
@@ -59,6 +80,8 @@ export default function PdfView({
|
|
|
59
80
|
setSections((prev) => (prev[index]?.height === conf.height ? prev : { ...prev, [index]: conf }));
|
|
60
81
|
}, []);
|
|
61
82
|
|
|
83
|
+
|
|
84
|
+
|
|
62
85
|
// --- Step 1: After measurement, split any oversized splittable blocks (one per pass) ---
|
|
63
86
|
useEffect(() => {
|
|
64
87
|
const keys = Object.keys(sections)
|
|
@@ -201,7 +224,7 @@ export default function PdfView({
|
|
|
201
224
|
<div
|
|
202
225
|
key={`page-${pageIdx}`}
|
|
203
226
|
className="pdf-page"
|
|
204
|
-
style={{ height: PAGE_HEIGHT, position: "relative", overflow: "
|
|
227
|
+
style={{ height: PAGE_HEIGHT, position: "relative", overflow: "visible", boxSizing: "border-box" }}
|
|
205
228
|
>
|
|
206
229
|
{/* Header */}
|
|
207
230
|
<div style={{ height: HEADER_HEIGHT }} className="flex-row dashboard-header">
|