datastake-daf 0.6.445 → 0.6.447
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
|
@@ -14536,9 +14536,9 @@ DAFFooter.propTypes = {
|
|
|
14536
14536
|
};
|
|
14537
14537
|
|
|
14538
14538
|
const PAGE_HEIGHT = 1587;
|
|
14539
|
-
// margin-top: 20, bottom: 20;
|
|
14540
14539
|
const FOOTER_HEIGHT = 70;
|
|
14541
14540
|
const HEADER_HEIGHT = 100;
|
|
14541
|
+
const CONTENT_AREA_HEIGHT = PAGE_HEIGHT - HEADER_HEIGHT - FOOTER_HEIGHT;
|
|
14542
14542
|
const Row = _ref => {
|
|
14543
14543
|
let {
|
|
14544
14544
|
widgets,
|
|
@@ -14588,43 +14588,58 @@ function PdfView(_ref2) {
|
|
|
14588
14588
|
let _pages = [1];
|
|
14589
14589
|
let _page = 1;
|
|
14590
14590
|
if (keys.length === config.length) {
|
|
14591
|
-
|
|
14591
|
+
// Reset all margins first
|
|
14592
14592
|
keys.forEach(k => {
|
|
14593
14593
|
const {
|
|
14594
14594
|
ref
|
|
14595
14595
|
} = sectionsConfig[k];
|
|
14596
14596
|
ref.current.style.marginBottom = '0px';
|
|
14597
|
-
|
|
14597
|
+
ref.current.style.marginTop = '0px';
|
|
14598
|
+
ref.current.style.pageBreakInside = 'auto';
|
|
14598
14599
|
});
|
|
14600
|
+
let currentPageHeight = 0;
|
|
14599
14601
|
keys.forEach((k, i) => {
|
|
14600
14602
|
const {
|
|
14601
14603
|
height,
|
|
14602
14604
|
ref
|
|
14603
14605
|
} = sectionsConfig[k];
|
|
14606
|
+
const sectionHeight = height + 24; // Include margin/padding
|
|
14607
|
+
|
|
14608
|
+
// First section on first page needs header space
|
|
14604
14609
|
if (i === 0) {
|
|
14605
14610
|
ref.current.style.marginTop = "".concat(HEADER_HEIGHT, "px");
|
|
14606
|
-
|
|
14611
|
+
currentPageHeight = sectionHeight;
|
|
14612
|
+
return;
|
|
14607
14613
|
}
|
|
14608
|
-
const newHeight = incrHeight + height;
|
|
14609
14614
|
|
|
14610
|
-
//
|
|
14611
|
-
|
|
14612
|
-
|
|
14613
|
-
|
|
14614
|
-
|
|
14615
|
-
|
|
14616
|
-
|
|
14615
|
+
// Check if section fits in remaining space of current page
|
|
14616
|
+
const remainingSpace = CONTENT_AREA_HEIGHT - currentPageHeight;
|
|
14617
|
+
if (sectionHeight > remainingSpace) {
|
|
14618
|
+
// Section doesn't fit, move to next page
|
|
14619
|
+
const {
|
|
14620
|
+
ref: prevRef
|
|
14621
|
+
} = sectionsConfig[keys[i - 1]];
|
|
14622
|
+
|
|
14623
|
+
// Add margin to previous section to push current section to next page
|
|
14624
|
+
prevRef.current.style.marginBottom = "".concat(remainingSpace + FOOTER_HEIGHT, "px");
|
|
14625
|
+
|
|
14626
|
+
// Add top margin for new page header
|
|
14627
|
+
ref.current.style.marginTop = "".concat(HEADER_HEIGHT, "px");
|
|
14628
|
+
|
|
14629
|
+
// Start new page
|
|
14617
14630
|
_page += 1;
|
|
14618
14631
|
_pages.push(_page);
|
|
14619
|
-
|
|
14620
|
-
const {
|
|
14621
|
-
ref: topRef
|
|
14622
|
-
} = sectionsConfig[keys[i - 1]];
|
|
14623
|
-
topRef.current.style.marginBottom = "".concat(dif + HEADER_HEIGHT - 24, "px");
|
|
14624
|
-
incrHeight = height + 24 + HEADER_HEIGHT;
|
|
14625
|
-
}
|
|
14632
|
+
currentPageHeight = sectionHeight;
|
|
14626
14633
|
} else {
|
|
14627
|
-
|
|
14634
|
+
// Section fits, add it to current page
|
|
14635
|
+
ref.current.style.marginTop = '24px';
|
|
14636
|
+
currentPageHeight += sectionHeight;
|
|
14637
|
+
}
|
|
14638
|
+
|
|
14639
|
+
// Last section needs bottom margin for footer
|
|
14640
|
+
if (i === keys.length - 1) {
|
|
14641
|
+
const finalRemainingSpace = CONTENT_AREA_HEIGHT - currentPageHeight;
|
|
14642
|
+
ref.current.style.marginBottom = "".concat(finalRemainingSpace + FOOTER_HEIGHT, "px");
|
|
14628
14643
|
}
|
|
14629
14644
|
});
|
|
14630
14645
|
setPages(_pages);
|
|
@@ -14655,28 +14670,18 @@ function PdfView(_ref2) {
|
|
|
14655
14670
|
})
|
|
14656
14671
|
});
|
|
14657
14672
|
}, [config, onChangeHeight]);
|
|
14658
|
-
|
|
14659
|
-
// <div className="daf-analysis">
|
|
14660
|
-
// <Header title={t('Dashboard Title')} />
|
|
14661
|
-
|
|
14662
|
-
// <div className="content">
|
|
14663
|
-
// <div className="view-content">
|
|
14664
|
-
// <div className="daf-analysis-layout">
|
|
14665
|
-
// <div className='sections-cont w-pt'>
|
|
14666
|
-
// <section>
|
|
14667
|
-
|
|
14668
14673
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
14669
14674
|
className: contClassName,
|
|
14670
14675
|
style: {
|
|
14671
14676
|
position: 'relative',
|
|
14672
14677
|
minHeight: pages.length * PAGE_HEIGHT
|
|
14673
14678
|
},
|
|
14674
|
-
children: [renderDashboard(), pages.map(page => /*#__PURE__*/jsxRuntime.jsxs(
|
|
14679
|
+
children: [renderDashboard(), pages.map(page => /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
14675
14680
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
14676
14681
|
style: {
|
|
14677
14682
|
top: (page - 1) * PAGE_HEIGHT,
|
|
14678
14683
|
width: '100%',
|
|
14679
|
-
height: HEADER_HEIGHT
|
|
14684
|
+
height: HEADER_HEIGHT,
|
|
14680
14685
|
position: 'absolute',
|
|
14681
14686
|
left: 0,
|
|
14682
14687
|
zIndex: 1000000
|
|
@@ -14694,7 +14699,7 @@ function PdfView(_ref2) {
|
|
|
14694
14699
|
alt: "logo"
|
|
14695
14700
|
})
|
|
14696
14701
|
})]
|
|
14697
|
-
}
|
|
14702
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
14698
14703
|
style: {
|
|
14699
14704
|
top: page * PAGE_HEIGHT - FOOTER_HEIGHT,
|
|
14700
14705
|
width: '100%',
|
|
@@ -14737,8 +14742,8 @@ function PdfView(_ref2) {
|
|
|
14737
14742
|
children: page
|
|
14738
14743
|
})
|
|
14739
14744
|
})]
|
|
14740
|
-
}
|
|
14741
|
-
}))]
|
|
14745
|
+
})]
|
|
14746
|
+
}, "page-".concat(page)))]
|
|
14742
14747
|
});
|
|
14743
14748
|
}
|
|
14744
14749
|
PdfView.propTypes = {
|
|
@@ -14748,7 +14753,8 @@ PdfView.propTypes = {
|
|
|
14748
14753
|
imgSrc: PropTypes__default["default"].string,
|
|
14749
14754
|
userId: PropTypes__default["default"].string,
|
|
14750
14755
|
accountId: PropTypes__default["default"].string,
|
|
14751
|
-
documentId: PropTypes__default["default"].string
|
|
14756
|
+
documentId: PropTypes__default["default"].string,
|
|
14757
|
+
downloadId: PropTypes__default["default"].string
|
|
14752
14758
|
};
|
|
14753
14759
|
|
|
14754
14760
|
const ajaxSelectFieldData = async (value, config, getApiBaseUrl = () => {}, getAppHeader = () => {}, app, formValues = {}) => {
|
package/package.json
CHANGED
|
@@ -4,9 +4,9 @@ import { useCallback, useEffect, useRef, useState, useLayoutEffect } from "react
|
|
|
4
4
|
import { formatClassname } from "../../../../../helpers/ClassesHelper";
|
|
5
5
|
|
|
6
6
|
const PAGE_HEIGHT = 1587;
|
|
7
|
-
// margin-top: 20, bottom: 20;
|
|
8
7
|
const FOOTER_HEIGHT = 70;
|
|
9
8
|
const HEADER_HEIGHT = 100;
|
|
9
|
+
const CONTENT_AREA_HEIGHT = PAGE_HEIGHT - HEADER_HEIGHT - FOOTER_HEIGHT;
|
|
10
10
|
|
|
11
11
|
const Row = ({ widgets, i, onChangeHeight = () => { } }) => {
|
|
12
12
|
const ref = useRef();
|
|
@@ -56,44 +56,57 @@ export default function PdfView({
|
|
|
56
56
|
let _page = 1;
|
|
57
57
|
|
|
58
58
|
if (keys.length === config.length) {
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
// Reset all margins first
|
|
61
60
|
keys.forEach(k => {
|
|
62
61
|
const { ref } = sectionsConfig[k];
|
|
63
62
|
ref.current.style.marginBottom = '0px';
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
ref.current.style.marginTop = '0px';
|
|
64
|
+
ref.current.style.pageBreakInside = 'auto';
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
let currentPageHeight = 0;
|
|
66
68
|
|
|
67
69
|
keys.forEach((k, i) => {
|
|
68
70
|
const { height, ref } = sectionsConfig[k];
|
|
69
|
-
|
|
71
|
+
const sectionHeight = height + 24; // Include margin/padding
|
|
72
|
+
|
|
73
|
+
// First section on first page needs header space
|
|
70
74
|
if (i === 0) {
|
|
71
75
|
ref.current.style.marginTop = `${HEADER_HEIGHT}px`;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const newHeight = incrHeight + height;
|
|
76
|
-
|
|
77
|
-
// ADD THIS CONDITION HERE - before the page break logic
|
|
78
|
-
if (i === keys.length - 1) {
|
|
79
|
-
ref.current.style.paddingBottom = '80px';
|
|
76
|
+
currentPageHeight = sectionHeight;
|
|
77
|
+
return;
|
|
80
78
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
|
|
80
|
+
// Check if section fits in remaining space of current page
|
|
81
|
+
const remainingSpace = CONTENT_AREA_HEIGHT - currentPageHeight;
|
|
82
|
+
|
|
83
|
+
if (sectionHeight > remainingSpace) {
|
|
84
|
+
// Section doesn't fit, move to next page
|
|
85
|
+
const { ref: prevRef } = sectionsConfig[keys[i - 1]];
|
|
86
|
+
|
|
87
|
+
// Add margin to previous section to push current section to next page
|
|
88
|
+
prevRef.current.style.marginBottom = `${remainingSpace + FOOTER_HEIGHT}px`;
|
|
89
|
+
|
|
90
|
+
// Add top margin for new page header
|
|
91
|
+
ref.current.style.marginTop = `${HEADER_HEIGHT}px`;
|
|
92
|
+
|
|
93
|
+
// Start new page
|
|
85
94
|
_page += 1;
|
|
86
95
|
_pages.push(_page);
|
|
87
|
-
|
|
88
|
-
if (sectionsConfig[keys[i - 1]]) {
|
|
89
|
-
const { ref: topRef } = sectionsConfig[keys[i - 1]];
|
|
90
|
-
topRef.current.style.marginBottom = `${dif + HEADER_HEIGHT - 24}px`;
|
|
91
|
-
incrHeight = height + 24 + HEADER_HEIGHT;
|
|
92
|
-
}
|
|
96
|
+
currentPageHeight = sectionHeight;
|
|
93
97
|
} else {
|
|
94
|
-
|
|
98
|
+
// Section fits, add it to current page
|
|
99
|
+
ref.current.style.marginTop = '24px';
|
|
100
|
+
currentPageHeight += sectionHeight;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Last section needs bottom margin for footer
|
|
104
|
+
if (i === keys.length - 1) {
|
|
105
|
+
const finalRemainingSpace = CONTENT_AREA_HEIGHT - currentPageHeight;
|
|
106
|
+
ref.current.style.marginBottom = `${finalRemainingSpace + FOOTER_HEIGHT}px`;
|
|
95
107
|
}
|
|
96
108
|
});
|
|
109
|
+
|
|
97
110
|
setPages(_pages);
|
|
98
111
|
}
|
|
99
112
|
}, [sectionsConfig]);
|
|
@@ -127,23 +140,20 @@ export default function PdfView({
|
|
|
127
140
|
);
|
|
128
141
|
}, [config, onChangeHeight]);
|
|
129
142
|
|
|
130
|
-
// <div className="daf-analysis">
|
|
131
|
-
// <Header title={t('Dashboard Title')} />
|
|
132
|
-
|
|
133
|
-
// <div className="content">
|
|
134
|
-
// <div className="view-content">
|
|
135
|
-
// <div className="daf-analysis-layout">
|
|
136
|
-
// <div className='sections-cont w-pt'>
|
|
137
|
-
// <section>
|
|
138
|
-
|
|
139
143
|
return (
|
|
140
144
|
<div className={contClassName} style={{ position: 'relative', minHeight: pages.length * PAGE_HEIGHT }}>
|
|
141
145
|
{renderDashboard()}
|
|
142
146
|
{pages.map((page) => (
|
|
143
|
-
|
|
147
|
+
<div key={`page-${page}`}>
|
|
144
148
|
<div
|
|
145
|
-
style={{
|
|
146
|
-
|
|
149
|
+
style={{
|
|
150
|
+
top: ((page - 1) * PAGE_HEIGHT),
|
|
151
|
+
width: '100%',
|
|
152
|
+
height: HEADER_HEIGHT,
|
|
153
|
+
position: 'absolute',
|
|
154
|
+
left: 0,
|
|
155
|
+
zIndex: 1000000
|
|
156
|
+
}}
|
|
147
157
|
className="flex-row dashboard-header"
|
|
148
158
|
>
|
|
149
159
|
<div className="flex flex-column justify-center flex-1">
|
|
@@ -154,8 +164,14 @@ export default function PdfView({
|
|
|
154
164
|
</div>
|
|
155
165
|
</div>
|
|
156
166
|
<div
|
|
157
|
-
style={{
|
|
158
|
-
|
|
167
|
+
style={{
|
|
168
|
+
top: (page * PAGE_HEIGHT) - FOOTER_HEIGHT,
|
|
169
|
+
width: '100%',
|
|
170
|
+
height: FOOTER_HEIGHT,
|
|
171
|
+
position: 'absolute',
|
|
172
|
+
left: 0,
|
|
173
|
+
zIndex: 1000000
|
|
174
|
+
}}
|
|
159
175
|
className="dashboard-footer flex-row"
|
|
160
176
|
>
|
|
161
177
|
<div className="flex flex-column justify-center">
|
|
@@ -189,7 +205,7 @@ export default function PdfView({
|
|
|
189
205
|
<h5>{page}</h5>
|
|
190
206
|
</div>
|
|
191
207
|
</div>
|
|
192
|
-
|
|
208
|
+
</div>
|
|
193
209
|
))}
|
|
194
210
|
</div>
|
|
195
211
|
);
|
|
@@ -203,4 +219,5 @@ PdfView.propTypes = {
|
|
|
203
219
|
userId: PropTypes.string,
|
|
204
220
|
accountId: PropTypes.string,
|
|
205
221
|
documentId: PropTypes.string,
|
|
206
|
-
|
|
222
|
+
downloadId: PropTypes.string,
|
|
223
|
+
}
|