datastake-daf 0.6.424 → 0.6.426
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
|
@@ -13302,12 +13302,11 @@ DAFFooter.propTypes = {
|
|
|
13302
13302
|
isViewMode: PropTypes__default["default"].bool
|
|
13303
13303
|
};
|
|
13304
13304
|
|
|
13305
|
-
const
|
|
13305
|
+
const CONTENT_HEIGHT = 1200; // <--- usable area between header and footer
|
|
13306
13306
|
const FOOTER_HEIGHT = 70;
|
|
13307
13307
|
const HEADER_HEIGHT = 100;
|
|
13308
|
-
const
|
|
13309
|
-
const
|
|
13310
|
-
|
|
13308
|
+
const PAGE_HEIGHT = CONTENT_HEIGHT + FOOTER_HEIGHT + HEADER_HEIGHT;
|
|
13309
|
+
const SECTION_GAP = 24;
|
|
13311
13310
|
const Row = _ref => {
|
|
13312
13311
|
let {
|
|
13313
13312
|
widgets,
|
|
@@ -13332,92 +13331,69 @@ const Row = _ref => {
|
|
|
13332
13331
|
ref
|
|
13333
13332
|
});
|
|
13334
13333
|
}
|
|
13335
|
-
}, [height]);
|
|
13334
|
+
}, [height, i, onChangeHeight]);
|
|
13336
13335
|
return /*#__PURE__*/jsxRuntime.jsx("section", {
|
|
13337
13336
|
ref: ref,
|
|
13338
|
-
style: widgets.style,
|
|
13339
|
-
|
|
13337
|
+
style: _objectSpread2(_objectSpread2({}, widgets.style), {}, {
|
|
13338
|
+
marginBottom: SECTION_GAP
|
|
13339
|
+
}),
|
|
13340
|
+
children: typeof widgets.render === "function" ? widgets.render() : null
|
|
13340
13341
|
});
|
|
13341
13342
|
};
|
|
13342
13343
|
function PdfView(_ref2) {
|
|
13343
13344
|
let {
|
|
13344
13345
|
config = [],
|
|
13345
13346
|
customClassName,
|
|
13346
|
-
title =
|
|
13347
|
-
imgSrc =
|
|
13348
|
-
userId =
|
|
13349
|
-
accountId =
|
|
13350
|
-
documentId =
|
|
13351
|
-
downloadId =
|
|
13347
|
+
title = "Title",
|
|
13348
|
+
imgSrc = "",
|
|
13349
|
+
userId = "IDD-0000000",
|
|
13350
|
+
accountId = "IDD-0000000",
|
|
13351
|
+
documentId = "IDD-0000000",
|
|
13352
|
+
downloadId = "DWL-00000123"
|
|
13352
13353
|
} = _ref2;
|
|
13353
13354
|
const [sectionsConfig, setSectionsConfig] = React.useState({});
|
|
13354
13355
|
const [pages, setPages] = React.useState([1]);
|
|
13355
13356
|
const doSizing = React.useCallback(() => {
|
|
13356
13357
|
const keys = Object.keys(sectionsConfig);
|
|
13358
|
+
if (keys.length !== config.length) return;
|
|
13357
13359
|
let _pages = [1];
|
|
13358
|
-
let
|
|
13359
|
-
|
|
13360
|
-
// Reset all margins and padding first
|
|
13361
|
-
keys.forEach(k => {
|
|
13362
|
-
const {
|
|
13363
|
-
ref
|
|
13364
|
-
} = sectionsConfig[k];
|
|
13365
|
-
ref.current.style.marginTop = '0px';
|
|
13366
|
-
ref.current.style.marginBottom = '0px';
|
|
13367
|
-
ref.current.style.paddingBottom = '0px';
|
|
13368
|
-
});
|
|
13369
|
-
let currentPageHeight = 0; // Track height accumulated on current page
|
|
13370
|
-
const sectionGap = 24; // Gap between sections
|
|
13371
|
-
|
|
13372
|
-
keys.forEach((k, i) => {
|
|
13373
|
-
const {
|
|
13374
|
-
height,
|
|
13375
|
-
ref
|
|
13376
|
-
} = sectionsConfig[k];
|
|
13377
|
-
const isFirstSection = i === 0;
|
|
13378
|
-
const isLastSection = i === keys.length - 1;
|
|
13379
|
-
|
|
13380
|
-
// First section on first page needs header space
|
|
13381
|
-
if (isFirstSection) {
|
|
13382
|
-
ref.current.style.marginTop = "".concat(HEADER_HEIGHT, "px");
|
|
13383
|
-
currentPageHeight = 0; // Content height tracking starts fresh
|
|
13384
|
-
}
|
|
13385
|
-
|
|
13386
|
-
// Check if this section would exceed the page content limit
|
|
13387
|
-
const willExceedPageLimit = currentPageHeight + height > CONTENT_HEIGHT_PER_PAGE;
|
|
13388
|
-
if (willExceedPageLimit && !isFirstSection) {
|
|
13389
|
-
// Need to break to a new page
|
|
13390
|
-
_page += 1;
|
|
13391
|
-
_pages.push(_page);
|
|
13392
|
-
|
|
13393
|
-
// Calculate remaining space on current page
|
|
13394
|
-
const remainingSpace = PAGE_HEIGHT - currentPageHeight - HEADER_HEIGHT - FOOTER_HEIGHT;
|
|
13395
|
-
|
|
13396
|
-
// Add margin to previous section to push current section to next page
|
|
13397
|
-
if (sectionsConfig[keys[i - 1]]) {
|
|
13398
|
-
const {
|
|
13399
|
-
ref: prevRef
|
|
13400
|
-
} = sectionsConfig[keys[i - 1]];
|
|
13401
|
-
prevRef.current.style.marginBottom = "".concat(remainingSpace, "px");
|
|
13402
|
-
}
|
|
13360
|
+
let currentPage = 1;
|
|
13361
|
+
let currentHeight = 0;
|
|
13403
13362
|
|
|
13404
|
-
|
|
13405
|
-
|
|
13406
|
-
|
|
13407
|
-
|
|
13408
|
-
|
|
13409
|
-
|
|
13410
|
-
|
|
13411
|
-
|
|
13412
|
-
|
|
13363
|
+
// Reset all margins
|
|
13364
|
+
keys.forEach(k => {
|
|
13365
|
+
const {
|
|
13366
|
+
ref
|
|
13367
|
+
} = sectionsConfig[k];
|
|
13368
|
+
if (ref.current) {
|
|
13369
|
+
ref.current.style.marginTop = "0px";
|
|
13370
|
+
ref.current.style.marginBottom = "".concat(SECTION_GAP, "px");
|
|
13371
|
+
}
|
|
13372
|
+
});
|
|
13373
|
+
keys.forEach((k, i) => {
|
|
13374
|
+
const {
|
|
13375
|
+
height,
|
|
13376
|
+
ref
|
|
13377
|
+
} = sectionsConfig[k];
|
|
13378
|
+
const nextHeight = currentHeight + height + SECTION_GAP;
|
|
13379
|
+
|
|
13380
|
+
// If section exceeds current page height, move it to next page
|
|
13381
|
+
if (nextHeight > CONTENT_HEIGHT && currentHeight > 0) {
|
|
13382
|
+
currentPage += 1;
|
|
13383
|
+
_pages.push(currentPage);
|
|
13384
|
+
const offsetTop = PAGE_HEIGHT * (currentPage - 1) + HEADER_HEIGHT;
|
|
13385
|
+
ref.current.style.marginTop = "".concat(offsetTop - ref.current.offsetTop, "px");
|
|
13386
|
+
currentHeight = height + SECTION_GAP;
|
|
13387
|
+
} else {
|
|
13388
|
+
currentHeight = nextHeight;
|
|
13389
|
+
}
|
|
13413
13390
|
|
|
13414
|
-
|
|
13415
|
-
|
|
13416
|
-
|
|
13417
|
-
|
|
13418
|
-
|
|
13419
|
-
|
|
13420
|
-
}
|
|
13391
|
+
// First section starts after header
|
|
13392
|
+
if (i === 0) {
|
|
13393
|
+
ref.current.style.marginTop = "".concat(HEADER_HEIGHT, "px");
|
|
13394
|
+
}
|
|
13395
|
+
});
|
|
13396
|
+
setPages(_pages);
|
|
13421
13397
|
}, [sectionsConfig, config.length]);
|
|
13422
13398
|
React.useEffect(() => {
|
|
13423
13399
|
doSizing();
|
|
@@ -13427,7 +13403,7 @@ function PdfView(_ref2) {
|
|
|
13427
13403
|
[index]: conf
|
|
13428
13404
|
}));
|
|
13429
13405
|
}, []);
|
|
13430
|
-
const contClassName = formatClassname([
|
|
13406
|
+
const contClassName = formatClassname(["daf-analysis daf-pdf-view", customClassName]);
|
|
13431
13407
|
const renderDashboard = React.useCallback(() => {
|
|
13432
13408
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
13433
13409
|
className: "view-content",
|
|
@@ -13439,35 +13415,29 @@ function PdfView(_ref2) {
|
|
|
13439
13415
|
widgets: widgets,
|
|
13440
13416
|
i: i,
|
|
13441
13417
|
onChangeHeight: onChangeHeight
|
|
13442
|
-
}, "dashboard-
|
|
13418
|
+
}, "dashboard-section-".concat(i)))
|
|
13443
13419
|
})
|
|
13444
13420
|
})
|
|
13445
13421
|
});
|
|
13446
13422
|
}, [config, onChangeHeight]);
|
|
13447
|
-
|
|
13448
|
-
// <div className="daf-analysis">
|
|
13449
|
-
// <Header title={t('Dashboard Title')} />
|
|
13450
|
-
|
|
13451
|
-
// <div className="content">
|
|
13452
|
-
// <div className="view-content">
|
|
13453
|
-
// <div className="daf-analysis-layout">
|
|
13454
|
-
// <div className='sections-cont w-pt'>
|
|
13455
|
-
// <section>
|
|
13456
|
-
|
|
13457
13423
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
13458
13424
|
className: contClassName,
|
|
13459
13425
|
style: {
|
|
13460
|
-
position:
|
|
13426
|
+
position: "relative"
|
|
13461
13427
|
},
|
|
13462
|
-
children: [renderDashboard(), pages.map(page => /*#__PURE__*/jsxRuntime.jsxs(
|
|
13428
|
+
children: [renderDashboard(), pages.map(page => /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
13463
13429
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
13464
13430
|
style: {
|
|
13465
13431
|
top: (page - 1) * PAGE_HEIGHT,
|
|
13466
|
-
width:
|
|
13432
|
+
width: "100%",
|
|
13467
13433
|
height: HEADER_HEIGHT - 24,
|
|
13468
|
-
position:
|
|
13434
|
+
position: "absolute",
|
|
13469
13435
|
left: 0,
|
|
13470
|
-
zIndex: 1000000
|
|
13436
|
+
zIndex: 1000000,
|
|
13437
|
+
display: "flex",
|
|
13438
|
+
justifyContent: "space-between",
|
|
13439
|
+
alignItems: "center",
|
|
13440
|
+
padding: "0 32px"
|
|
13471
13441
|
},
|
|
13472
13442
|
className: "flex-row dashboard-header",
|
|
13473
13443
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
@@ -13477,44 +13447,52 @@ function PdfView(_ref2) {
|
|
|
13477
13447
|
})
|
|
13478
13448
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
13479
13449
|
className: "flex flex-column justify-center",
|
|
13480
|
-
children: /*#__PURE__*/jsxRuntime.jsx("img", {
|
|
13450
|
+
children: imgSrc && /*#__PURE__*/jsxRuntime.jsx("img", {
|
|
13481
13451
|
src: imgSrc,
|
|
13482
|
-
alt: "logo"
|
|
13452
|
+
alt: "logo",
|
|
13453
|
+
style: {
|
|
13454
|
+
height: 60,
|
|
13455
|
+
objectFit: "contain"
|
|
13456
|
+
}
|
|
13483
13457
|
})
|
|
13484
13458
|
})]
|
|
13485
|
-
}
|
|
13459
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
13486
13460
|
style: {
|
|
13487
13461
|
top: page * PAGE_HEIGHT - FOOTER_HEIGHT,
|
|
13488
|
-
width:
|
|
13462
|
+
width: "100%",
|
|
13489
13463
|
height: FOOTER_HEIGHT,
|
|
13490
|
-
position:
|
|
13464
|
+
position: "absolute",
|
|
13491
13465
|
left: 0,
|
|
13492
|
-
zIndex: 1000000
|
|
13466
|
+
zIndex: 1000000,
|
|
13467
|
+
display: "flex",
|
|
13468
|
+
justifyContent: "space-between",
|
|
13469
|
+
alignItems: "center",
|
|
13470
|
+
padding: "0 32px"
|
|
13493
13471
|
},
|
|
13494
13472
|
className: "dashboard-footer flex-row",
|
|
13495
13473
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
13496
13474
|
className: "flex flex-column justify-center",
|
|
13497
13475
|
children: /*#__PURE__*/jsxRuntime.jsx("h5", {
|
|
13498
|
-
children: moment__default["default"]().format(
|
|
13476
|
+
children: moment__default["default"]().format("DD MMM YYYY")
|
|
13499
13477
|
})
|
|
13500
13478
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
13501
13479
|
className: "flex flex-column justify-center",
|
|
13502
13480
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
13503
13481
|
className: "flex gap-2",
|
|
13504
13482
|
children: [/*#__PURE__*/jsxRuntime.jsxs("h5", {
|
|
13505
|
-
children: ["User ID:",
|
|
13483
|
+
children: ["User ID: ", /*#__PURE__*/jsxRuntime.jsx("strong", {
|
|
13506
13484
|
children: userId
|
|
13507
13485
|
})]
|
|
13508
13486
|
}), /*#__PURE__*/jsxRuntime.jsxs("h5", {
|
|
13509
|
-
children: ["Account ID:",
|
|
13487
|
+
children: ["Account ID: ", /*#__PURE__*/jsxRuntime.jsx("strong", {
|
|
13510
13488
|
children: accountId
|
|
13511
13489
|
})]
|
|
13512
13490
|
}), /*#__PURE__*/jsxRuntime.jsxs("h5", {
|
|
13513
|
-
children: ["Document ID:",
|
|
13491
|
+
children: ["Document ID: ", /*#__PURE__*/jsxRuntime.jsx("strong", {
|
|
13514
13492
|
children: documentId
|
|
13515
13493
|
})]
|
|
13516
13494
|
}), /*#__PURE__*/jsxRuntime.jsxs("h5", {
|
|
13517
|
-
children: ["Download ID:",
|
|
13495
|
+
children: ["Download ID: ", /*#__PURE__*/jsxRuntime.jsx("strong", {
|
|
13518
13496
|
children: downloadId
|
|
13519
13497
|
})]
|
|
13520
13498
|
})]
|
|
@@ -13525,8 +13503,8 @@ function PdfView(_ref2) {
|
|
|
13525
13503
|
children: page
|
|
13526
13504
|
})
|
|
13527
13505
|
})]
|
|
13528
|
-
}
|
|
13529
|
-
}))]
|
|
13506
|
+
})]
|
|
13507
|
+
}, "page-".concat(page)))]
|
|
13530
13508
|
});
|
|
13531
13509
|
}
|
|
13532
13510
|
PdfView.propTypes = {
|
|
@@ -13536,7 +13514,8 @@ PdfView.propTypes = {
|
|
|
13536
13514
|
imgSrc: PropTypes__default["default"].string,
|
|
13537
13515
|
userId: PropTypes__default["default"].string,
|
|
13538
13516
|
accountId: PropTypes__default["default"].string,
|
|
13539
|
-
documentId: PropTypes__default["default"].string
|
|
13517
|
+
documentId: PropTypes__default["default"].string,
|
|
13518
|
+
downloadId: PropTypes__default["default"].string
|
|
13540
13519
|
};
|
|
13541
13520
|
|
|
13542
13521
|
const ajaxSelectFieldData = async (value, config, getApiBaseUrl = () => {}, getAppHeader = () => {}, app, formValues = {}) => {
|
package/package.json
CHANGED
|
@@ -189,15 +189,5 @@ export const Primary = {
|
|
|
189
189
|
},
|
|
190
190
|
],
|
|
191
191
|
},
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
height: '100vh',
|
|
195
|
-
overflowY: 'auto',
|
|
196
|
-
background: "#f8f8f8",
|
|
197
|
-
padding: "20px",
|
|
198
|
-
}}
|
|
199
|
-
>
|
|
200
|
-
<PdfView {...args} />
|
|
201
|
-
</div>
|
|
202
|
-
),
|
|
203
|
-
};
|
|
192
|
+
}
|
|
193
|
+
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import moment from "moment";
|
|
2
|
-
import PropTypes from
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
3
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
4
4
|
import { formatClassname } from "../../../../../helpers/ClassesHelper";
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const CONTENT_HEIGHT = 1200; // <--- usable area between header and footer
|
|
7
7
|
const FOOTER_HEIGHT = 70;
|
|
8
8
|
const HEADER_HEIGHT = 100;
|
|
9
|
-
const
|
|
10
|
-
const
|
|
9
|
+
const PAGE_HEIGHT = CONTENT_HEIGHT + FOOTER_HEIGHT + HEADER_HEIGHT;
|
|
10
|
+
const SECTION_GAP = 24;
|
|
11
11
|
|
|
12
|
-
const Row = ({ widgets, i, onChangeHeight = () => {
|
|
12
|
+
const Row = ({ widgets, i, onChangeHeight = () => {} }) => {
|
|
13
13
|
const ref = useRef();
|
|
14
14
|
const [height, setHeight] = useState(0);
|
|
15
15
|
|
|
@@ -19,9 +19,7 @@ const Row = ({ widgets, i, onChangeHeight = () => { } }) => {
|
|
|
19
19
|
setHeight(entry.contentRect.height);
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
-
|
|
23
22
|
observer.observe(ref.current);
|
|
24
|
-
|
|
25
23
|
return () => observer.disconnect();
|
|
26
24
|
}, []);
|
|
27
25
|
|
|
@@ -29,91 +27,74 @@ const Row = ({ widgets, i, onChangeHeight = () => { } }) => {
|
|
|
29
27
|
if (height) {
|
|
30
28
|
onChangeHeight(i, { height, ref });
|
|
31
29
|
}
|
|
32
|
-
}, [height])
|
|
30
|
+
}, [height, i, onChangeHeight]);
|
|
33
31
|
|
|
34
32
|
return (
|
|
35
|
-
<section
|
|
36
|
-
{
|
|
33
|
+
<section
|
|
34
|
+
ref={ref}
|
|
35
|
+
style={{
|
|
36
|
+
...widgets.style,
|
|
37
|
+
marginBottom: SECTION_GAP,
|
|
38
|
+
}}
|
|
39
|
+
>
|
|
40
|
+
{typeof widgets.render === "function" ? widgets.render() : null}
|
|
37
41
|
</section>
|
|
38
|
-
)
|
|
42
|
+
);
|
|
39
43
|
};
|
|
40
44
|
|
|
41
45
|
export default function PdfView({
|
|
42
46
|
config = [],
|
|
43
47
|
customClassName,
|
|
44
|
-
title =
|
|
45
|
-
imgSrc =
|
|
46
|
-
userId =
|
|
47
|
-
accountId =
|
|
48
|
-
documentId =
|
|
49
|
-
downloadId =
|
|
48
|
+
title = "Title",
|
|
49
|
+
imgSrc = "",
|
|
50
|
+
userId = "IDD-0000000",
|
|
51
|
+
accountId = "IDD-0000000",
|
|
52
|
+
documentId = "IDD-0000000",
|
|
53
|
+
downloadId = "DWL-00000123",
|
|
50
54
|
}) {
|
|
51
55
|
const [sectionsConfig, setSectionsConfig] = useState({});
|
|
52
56
|
const [pages, setPages] = useState([1]);
|
|
53
57
|
|
|
54
58
|
const doSizing = useCallback(() => {
|
|
55
59
|
const keys = Object.keys(sectionsConfig);
|
|
60
|
+
if (keys.length !== config.length) return;
|
|
61
|
+
|
|
56
62
|
let _pages = [1];
|
|
57
|
-
let
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
ref.current.style.
|
|
65
|
-
ref.current.style.
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
// Add margin to previous section to push current section to next page
|
|
94
|
-
if (sectionsConfig[keys[i - 1]]) {
|
|
95
|
-
const { ref: prevRef } = sectionsConfig[keys[i - 1]];
|
|
96
|
-
prevRef.current.style.marginBottom = `${remainingSpace}px`;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// Position this section at the top of the new page
|
|
100
|
-
ref.current.style.marginTop = `${HEADER_HEIGHT + PAGE_TOP_MARGIN}px`;
|
|
101
|
-
|
|
102
|
-
// Reset page height counter for new page
|
|
103
|
-
currentPageHeight = height + sectionGap;
|
|
104
|
-
} else {
|
|
105
|
-
// Section fits on current page
|
|
106
|
-
currentPageHeight += height + sectionGap;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// Add padding to last section
|
|
110
|
-
if (isLastSection) {
|
|
111
|
-
ref.current.style.paddingBottom = `${PAGE_TOP_MARGIN}px`;
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
setPages(_pages);
|
|
116
|
-
}
|
|
63
|
+
let currentPage = 1;
|
|
64
|
+
let currentHeight = 0;
|
|
65
|
+
|
|
66
|
+
// Reset all margins
|
|
67
|
+
keys.forEach((k) => {
|
|
68
|
+
const { ref } = sectionsConfig[k];
|
|
69
|
+
if (ref.current) {
|
|
70
|
+
ref.current.style.marginTop = "0px";
|
|
71
|
+
ref.current.style.marginBottom = `${SECTION_GAP}px`;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
keys.forEach((k, i) => {
|
|
76
|
+
const { height, ref } = sectionsConfig[k];
|
|
77
|
+
const nextHeight = currentHeight + height + SECTION_GAP;
|
|
78
|
+
|
|
79
|
+
// If section exceeds current page height, move it to next page
|
|
80
|
+
if (nextHeight > CONTENT_HEIGHT && currentHeight > 0) {
|
|
81
|
+
currentPage += 1;
|
|
82
|
+
_pages.push(currentPage);
|
|
83
|
+
|
|
84
|
+
const offsetTop = PAGE_HEIGHT * (currentPage - 1) + HEADER_HEIGHT;
|
|
85
|
+
ref.current.style.marginTop = `${offsetTop - ref.current.offsetTop}px`;
|
|
86
|
+
currentHeight = height + SECTION_GAP;
|
|
87
|
+
} else {
|
|
88
|
+
currentHeight = nextHeight;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// First section starts after header
|
|
92
|
+
if (i === 0) {
|
|
93
|
+
ref.current.style.marginTop = `${HEADER_HEIGHT}px`;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
setPages(_pages);
|
|
117
98
|
}, [sectionsConfig, config.length]);
|
|
118
99
|
|
|
119
100
|
useEffect(() => {
|
|
@@ -121,20 +102,23 @@ export default function PdfView({
|
|
|
121
102
|
}, [doSizing]);
|
|
122
103
|
|
|
123
104
|
const onChangeHeight = useCallback((index, conf) => {
|
|
124
|
-
setSectionsConfig((prev) => ({ ...prev, [index]: conf }))
|
|
105
|
+
setSectionsConfig((prev) => ({ ...prev, [index]: conf }));
|
|
125
106
|
}, []);
|
|
126
107
|
|
|
127
|
-
const contClassName = formatClassname([
|
|
108
|
+
const contClassName = formatClassname([
|
|
109
|
+
"daf-analysis daf-pdf-view",
|
|
110
|
+
customClassName,
|
|
111
|
+
]);
|
|
128
112
|
|
|
129
113
|
const renderDashboard = useCallback(() => {
|
|
130
114
|
return (
|
|
131
115
|
<div className="view-content">
|
|
132
116
|
<div className="daf-analysis-layout">
|
|
133
|
-
<div className=
|
|
117
|
+
<div className="sections-cont">
|
|
134
118
|
{config.map((widgets, i) => (
|
|
135
119
|
<Row
|
|
136
120
|
widgets={widgets}
|
|
137
|
-
key={`dashboard-
|
|
121
|
+
key={`dashboard-section-${i}`}
|
|
138
122
|
i={i}
|
|
139
123
|
onChangeHeight={onChangeHeight}
|
|
140
124
|
/>
|
|
@@ -145,61 +129,74 @@ export default function PdfView({
|
|
|
145
129
|
);
|
|
146
130
|
}, [config, onChangeHeight]);
|
|
147
131
|
|
|
148
|
-
// <div className="daf-analysis">
|
|
149
|
-
// <Header title={t('Dashboard Title')} />
|
|
150
|
-
|
|
151
|
-
// <div className="content">
|
|
152
|
-
// <div className="view-content">
|
|
153
|
-
// <div className="daf-analysis-layout">
|
|
154
|
-
// <div className='sections-cont w-pt'>
|
|
155
|
-
// <section>
|
|
156
|
-
|
|
157
132
|
return (
|
|
158
|
-
<div className={contClassName} style={{ position:
|
|
133
|
+
<div className={contClassName} style={{ position: "relative" }}>
|
|
159
134
|
{renderDashboard()}
|
|
135
|
+
|
|
160
136
|
{pages.map((page) => (
|
|
161
|
-
|
|
137
|
+
<div key={`page-${page}`}>
|
|
138
|
+
{/* Header */}
|
|
162
139
|
<div
|
|
163
|
-
style={{
|
|
164
|
-
|
|
140
|
+
style={{
|
|
141
|
+
top: (page - 1) * PAGE_HEIGHT,
|
|
142
|
+
width: "100%",
|
|
143
|
+
height: HEADER_HEIGHT - 24,
|
|
144
|
+
position: "absolute",
|
|
145
|
+
left: 0,
|
|
146
|
+
zIndex: 1000000,
|
|
147
|
+
display: "flex",
|
|
148
|
+
justifyContent: "space-between",
|
|
149
|
+
alignItems: "center",
|
|
150
|
+
padding: "0 32px",
|
|
151
|
+
}}
|
|
165
152
|
className="flex-row dashboard-header"
|
|
166
153
|
>
|
|
167
154
|
<div className="flex flex-column justify-center flex-1">
|
|
168
155
|
<h2>{title}</h2>
|
|
169
156
|
</div>
|
|
170
157
|
<div className="flex flex-column justify-center">
|
|
171
|
-
|
|
158
|
+
{imgSrc && (
|
|
159
|
+
<img
|
|
160
|
+
src={imgSrc}
|
|
161
|
+
alt="logo"
|
|
162
|
+
style={{ height: 60, objectFit: "contain" }}
|
|
163
|
+
/>
|
|
164
|
+
)}
|
|
172
165
|
</div>
|
|
173
166
|
</div>
|
|
167
|
+
|
|
168
|
+
{/* Footer */}
|
|
174
169
|
<div
|
|
175
|
-
style={{
|
|
176
|
-
|
|
170
|
+
style={{
|
|
171
|
+
top: page * PAGE_HEIGHT - FOOTER_HEIGHT,
|
|
172
|
+
width: "100%",
|
|
173
|
+
height: FOOTER_HEIGHT,
|
|
174
|
+
position: "absolute",
|
|
175
|
+
left: 0,
|
|
176
|
+
zIndex: 1000000,
|
|
177
|
+
display: "flex",
|
|
178
|
+
justifyContent: "space-between",
|
|
179
|
+
alignItems: "center",
|
|
180
|
+
padding: "0 32px",
|
|
181
|
+
}}
|
|
177
182
|
className="dashboard-footer flex-row"
|
|
178
183
|
>
|
|
179
184
|
<div className="flex flex-column justify-center">
|
|
180
|
-
<h5>{moment().format(
|
|
185
|
+
<h5>{moment().format("DD MMM YYYY")}</h5>
|
|
181
186
|
</div>
|
|
182
187
|
<div className="flex flex-column justify-center">
|
|
183
188
|
<div className="flex gap-2">
|
|
184
189
|
<h5>
|
|
185
|
-
User ID:
|
|
186
|
-
{' '}
|
|
187
|
-
<strong>{userId}</strong>
|
|
190
|
+
User ID: <strong>{userId}</strong>
|
|
188
191
|
</h5>
|
|
189
192
|
<h5>
|
|
190
|
-
Account ID:
|
|
191
|
-
{' '}
|
|
192
|
-
<strong>{accountId}</strong>
|
|
193
|
+
Account ID: <strong>{accountId}</strong>
|
|
193
194
|
</h5>
|
|
194
195
|
<h5>
|
|
195
|
-
Document ID:
|
|
196
|
-
{' '}
|
|
197
|
-
<strong>{documentId}</strong>
|
|
196
|
+
Document ID: <strong>{documentId}</strong>
|
|
198
197
|
</h5>
|
|
199
198
|
<h5>
|
|
200
|
-
Download ID:
|
|
201
|
-
{' '}
|
|
202
|
-
<strong>{downloadId}</strong>
|
|
199
|
+
Download ID: <strong>{downloadId}</strong>
|
|
203
200
|
</h5>
|
|
204
201
|
</div>
|
|
205
202
|
</div>
|
|
@@ -207,7 +204,7 @@ export default function PdfView({
|
|
|
207
204
|
<h5>{page}</h5>
|
|
208
205
|
</div>
|
|
209
206
|
</div>
|
|
210
|
-
|
|
207
|
+
</div>
|
|
211
208
|
))}
|
|
212
209
|
</div>
|
|
213
210
|
);
|
|
@@ -221,4 +218,5 @@ PdfView.propTypes = {
|
|
|
221
218
|
userId: PropTypes.string,
|
|
222
219
|
accountId: PropTypes.string,
|
|
223
220
|
documentId: PropTypes.string,
|
|
224
|
-
|
|
221
|
+
downloadId: PropTypes.string,
|
|
222
|
+
};
|