datastake-daf 0.6.410 → 0.6.412
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
|
@@ -13275,10 +13275,16 @@ DAFFooter.propTypes = {
|
|
|
13275
13275
|
isViewMode: PropTypes__default["default"].bool
|
|
13276
13276
|
};
|
|
13277
13277
|
|
|
13278
|
-
const PAGE_HEIGHT =
|
|
13279
|
-
// margin-top: 20, bottom: 20;
|
|
13278
|
+
const PAGE_HEIGHT = 1587;
|
|
13280
13279
|
const FOOTER_HEIGHT = 70;
|
|
13281
13280
|
const HEADER_HEIGHT = 100;
|
|
13281
|
+
const SECTION_SPACING = 24; // Space between sections
|
|
13282
|
+
const FIRST_PAGE_TOP_PADDING = 30; // Padding after header on first page
|
|
13283
|
+
const NEW_PAGE_TOP_PADDING = 30; // Padding after header on new pages
|
|
13284
|
+
const LAST_SECTION_BOTTOM_PADDING = 30; // Padding after last section
|
|
13285
|
+
|
|
13286
|
+
// Available content height per page (excluding header and footer)
|
|
13287
|
+
const AVAILABLE_HEIGHT = PAGE_HEIGHT - HEADER_HEIGHT - FOOTER_HEIGHT;
|
|
13282
13288
|
const Row = _ref => {
|
|
13283
13289
|
let {
|
|
13284
13290
|
widgets,
|
|
@@ -13303,7 +13309,7 @@ const Row = _ref => {
|
|
|
13303
13309
|
ref
|
|
13304
13310
|
});
|
|
13305
13311
|
}
|
|
13306
|
-
}, [height]);
|
|
13312
|
+
}, [height, i, onChangeHeight]);
|
|
13307
13313
|
return /*#__PURE__*/jsxRuntime.jsx("section", {
|
|
13308
13314
|
ref: ref,
|
|
13309
13315
|
style: widgets.style,
|
|
@@ -13325,51 +13331,73 @@ function PdfView(_ref2) {
|
|
|
13325
13331
|
const [pages, setPages] = React.useState([1]);
|
|
13326
13332
|
const doSizing = React.useCallback(() => {
|
|
13327
13333
|
const keys = Object.keys(sectionsConfig);
|
|
13334
|
+
|
|
13335
|
+
// Wait until all sections have been measured
|
|
13336
|
+
if (keys.length !== config.length) return;
|
|
13328
13337
|
let _pages = [1];
|
|
13329
|
-
let
|
|
13330
|
-
|
|
13331
|
-
|
|
13332
|
-
|
|
13333
|
-
|
|
13334
|
-
|
|
13335
|
-
|
|
13336
|
-
|
|
13337
|
-
|
|
13338
|
-
|
|
13339
|
-
|
|
13340
|
-
|
|
13341
|
-
|
|
13342
|
-
|
|
13343
|
-
|
|
13344
|
-
|
|
13345
|
-
|
|
13346
|
-
|
|
13347
|
-
|
|
13348
|
-
|
|
13349
|
-
|
|
13350
|
-
|
|
13351
|
-
|
|
13352
|
-
|
|
13353
|
-
|
|
13354
|
-
|
|
13355
|
-
|
|
13356
|
-
_pages.push(_page);
|
|
13357
|
-
if (sectionsConfig[keys[i - 1]]) {
|
|
13358
|
-
const {
|
|
13359
|
-
ref: topRef
|
|
13360
|
-
} = sectionsConfig[keys[i - 1]];
|
|
13361
|
-
topRef.current.style.marginBottom = "".concat(dif + HEADER_HEIGHT - 24, "px");
|
|
13362
|
-
incrHeight = height + 24 + HEADER_HEIGHT;
|
|
13363
|
-
// console.log('margin', dif);
|
|
13364
|
-
}
|
|
13365
|
-
} else {
|
|
13366
|
-
incrHeight = newHeight + 24;
|
|
13338
|
+
let currentPage = 1;
|
|
13339
|
+
let currentPageContentHeight = 0; // Tracks content height on current page (excluding header)
|
|
13340
|
+
|
|
13341
|
+
// Reset all styles first
|
|
13342
|
+
keys.forEach(k => {
|
|
13343
|
+
const {
|
|
13344
|
+
ref
|
|
13345
|
+
} = sectionsConfig[k];
|
|
13346
|
+
ref.current.style.marginTop = '0px';
|
|
13347
|
+
ref.current.style.marginBottom = '0px';
|
|
13348
|
+
ref.current.style.paddingBottom = '0px';
|
|
13349
|
+
});
|
|
13350
|
+
keys.forEach((k, i) => {
|
|
13351
|
+
const {
|
|
13352
|
+
height,
|
|
13353
|
+
ref
|
|
13354
|
+
} = sectionsConfig[k];
|
|
13355
|
+
const isFirstSection = i === 0;
|
|
13356
|
+
const isLastSection = i === keys.length - 1;
|
|
13357
|
+
const isFirstSectionOnPage = currentPageContentHeight === 0;
|
|
13358
|
+
|
|
13359
|
+
// For first section of entire document
|
|
13360
|
+
if (isFirstSection) {
|
|
13361
|
+
ref.current.style.marginTop = "".concat(HEADER_HEIGHT + FIRST_PAGE_TOP_PADDING, "px");
|
|
13362
|
+
currentPageContentHeight = height + FIRST_PAGE_TOP_PADDING;
|
|
13363
|
+
if (isLastSection) {
|
|
13364
|
+
ref.current.style.paddingBottom = "".concat(LAST_SECTION_BOTTOM_PADDING, "px");
|
|
13367
13365
|
}
|
|
13368
|
-
|
|
13369
|
-
}
|
|
13370
|
-
|
|
13371
|
-
|
|
13372
|
-
|
|
13366
|
+
return;
|
|
13367
|
+
}
|
|
13368
|
+
|
|
13369
|
+
// Calculate space needed for this section including spacing before it
|
|
13370
|
+
const spacingBefore = isFirstSectionOnPage ? NEW_PAGE_TOP_PADDING : SECTION_SPACING;
|
|
13371
|
+
const totalSpaceNeeded = spacingBefore + height;
|
|
13372
|
+
|
|
13373
|
+
// Check if we need to move to next page
|
|
13374
|
+
if (currentPageContentHeight + totalSpaceNeeded > AVAILABLE_HEIGHT) {
|
|
13375
|
+
// Move to new page
|
|
13376
|
+
currentPage += 1;
|
|
13377
|
+
_pages.push(currentPage);
|
|
13378
|
+
|
|
13379
|
+
// Calculate and apply bottom margin to fill previous page
|
|
13380
|
+
const usedSpace = currentPageContentHeight;
|
|
13381
|
+
const remainingSpace = AVAILABLE_HEIGHT - usedSpace;
|
|
13382
|
+
const previousKey = keys[i - 1];
|
|
13383
|
+
sectionsConfig[previousKey].ref.current.style.marginBottom = "".concat(remainingSpace, "px");
|
|
13384
|
+
|
|
13385
|
+
// This section starts the new page
|
|
13386
|
+
ref.current.style.marginTop = "".concat(HEADER_HEIGHT + NEW_PAGE_TOP_PADDING, "px");
|
|
13387
|
+
currentPageContentHeight = height + NEW_PAGE_TOP_PADDING;
|
|
13388
|
+
} else {
|
|
13389
|
+
// Section fits on current page
|
|
13390
|
+
ref.current.style.marginTop = "".concat(spacingBefore, "px");
|
|
13391
|
+
currentPageContentHeight += totalSpaceNeeded;
|
|
13392
|
+
}
|
|
13393
|
+
|
|
13394
|
+
// Add bottom padding to last section
|
|
13395
|
+
if (isLastSection) {
|
|
13396
|
+
ref.current.style.paddingBottom = "".concat(LAST_SECTION_BOTTOM_PADDING, "px");
|
|
13397
|
+
}
|
|
13398
|
+
});
|
|
13399
|
+
setPages(_pages);
|
|
13400
|
+
}, [sectionsConfig, config.length]);
|
|
13373
13401
|
React.useEffect(() => {
|
|
13374
13402
|
doSizing();
|
|
13375
13403
|
}, [doSizing]);
|
|
@@ -13390,32 +13418,22 @@ function PdfView(_ref2) {
|
|
|
13390
13418
|
widgets: widgets,
|
|
13391
13419
|
i: i,
|
|
13392
13420
|
onChangeHeight: onChangeHeight
|
|
13393
|
-
}, "dashboard-sections
|
|
13421
|
+
}, "dashboard-sections-".concat(i + 1)))
|
|
13394
13422
|
})
|
|
13395
13423
|
})
|
|
13396
13424
|
});
|
|
13397
13425
|
}, [config, onChangeHeight]);
|
|
13398
|
-
|
|
13399
|
-
// <div className="daf-analysis">
|
|
13400
|
-
// <Header title={t('Dashboard Title')} />
|
|
13401
|
-
|
|
13402
|
-
// <div className="content">
|
|
13403
|
-
// <div className="view-content">
|
|
13404
|
-
// <div className="daf-analysis-layout">
|
|
13405
|
-
// <div className='sections-cont w-pt'>
|
|
13406
|
-
// <section>
|
|
13407
|
-
|
|
13408
13426
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
13409
13427
|
className: contClassName,
|
|
13410
13428
|
style: {
|
|
13411
13429
|
position: 'relative'
|
|
13412
13430
|
},
|
|
13413
|
-
children: [renderDashboard(), pages.map(page => /*#__PURE__*/jsxRuntime.jsxs(
|
|
13431
|
+
children: [renderDashboard(), pages.map(page => /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
13414
13432
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
13415
13433
|
style: {
|
|
13416
13434
|
top: (page - 1) * PAGE_HEIGHT,
|
|
13417
13435
|
width: '100%',
|
|
13418
|
-
height: HEADER_HEIGHT
|
|
13436
|
+
height: HEADER_HEIGHT,
|
|
13419
13437
|
position: 'absolute',
|
|
13420
13438
|
left: 0,
|
|
13421
13439
|
zIndex: 1000000
|
|
@@ -13433,7 +13451,7 @@ function PdfView(_ref2) {
|
|
|
13433
13451
|
alt: "logo"
|
|
13434
13452
|
})
|
|
13435
13453
|
})]
|
|
13436
|
-
}
|
|
13454
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
13437
13455
|
style: {
|
|
13438
13456
|
top: page * PAGE_HEIGHT - FOOTER_HEIGHT,
|
|
13439
13457
|
width: '100%',
|
|
@@ -13476,8 +13494,8 @@ function PdfView(_ref2) {
|
|
|
13476
13494
|
children: page
|
|
13477
13495
|
})
|
|
13478
13496
|
})]
|
|
13479
|
-
}
|
|
13480
|
-
}))]
|
|
13497
|
+
})]
|
|
13498
|
+
}, "page-".concat(page)))]
|
|
13481
13499
|
});
|
|
13482
13500
|
}
|
|
13483
13501
|
PdfView.propTypes = {
|
|
@@ -13487,7 +13505,8 @@ PdfView.propTypes = {
|
|
|
13487
13505
|
imgSrc: PropTypes__default["default"].string,
|
|
13488
13506
|
userId: PropTypes__default["default"].string,
|
|
13489
13507
|
accountId: PropTypes__default["default"].string,
|
|
13490
|
-
documentId: PropTypes__default["default"].string
|
|
13508
|
+
documentId: PropTypes__default["default"].string,
|
|
13509
|
+
downloadId: PropTypes__default["default"].string
|
|
13491
13510
|
};
|
|
13492
13511
|
|
|
13493
13512
|
const ajaxSelectFieldData = async (value, config, getApiBaseUrl = () => {}, getAppHeader = () => {}, app, formValues = {}) => {
|
package/package.json
CHANGED
|
@@ -3,10 +3,16 @@ 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 PAGE_HEIGHT =
|
|
7
|
-
// margin-top: 20, bottom: 20;
|
|
6
|
+
const PAGE_HEIGHT = 1587;
|
|
8
7
|
const FOOTER_HEIGHT = 70;
|
|
9
8
|
const HEADER_HEIGHT = 100;
|
|
9
|
+
const SECTION_SPACING = 24; // Space between sections
|
|
10
|
+
const FIRST_PAGE_TOP_PADDING = 30; // Padding after header on first page
|
|
11
|
+
const NEW_PAGE_TOP_PADDING = 30; // Padding after header on new pages
|
|
12
|
+
const LAST_SECTION_BOTTOM_PADDING = 30; // Padding after last section
|
|
13
|
+
|
|
14
|
+
// Available content height per page (excluding header and footer)
|
|
15
|
+
const AVAILABLE_HEIGHT = PAGE_HEIGHT - HEADER_HEIGHT - FOOTER_HEIGHT;
|
|
10
16
|
|
|
11
17
|
const Row = ({ widgets, i, onChangeHeight = () => { } }) => {
|
|
12
18
|
const ref = useRef();
|
|
@@ -28,7 +34,7 @@ const Row = ({ widgets, i, onChangeHeight = () => { } }) => {
|
|
|
28
34
|
if (height) {
|
|
29
35
|
onChangeHeight(i, { height, ref });
|
|
30
36
|
}
|
|
31
|
-
}, [height])
|
|
37
|
+
}, [height, i, onChangeHeight])
|
|
32
38
|
|
|
33
39
|
return (
|
|
34
40
|
<section ref={ref} style={widgets.style}>
|
|
@@ -52,52 +58,72 @@ export default function PdfView({
|
|
|
52
58
|
|
|
53
59
|
const doSizing = useCallback(() => {
|
|
54
60
|
const keys = Object.keys(sectionsConfig);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (keys.length === config.length) {
|
|
59
|
-
let incrHeight = 0;
|
|
61
|
+
|
|
62
|
+
// Wait until all sections have been measured
|
|
63
|
+
if (keys.length !== config.length) return;
|
|
60
64
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
let _pages = [1];
|
|
66
|
+
let currentPage = 1;
|
|
67
|
+
let currentPageContentHeight = 0; // Tracks content height on current page (excluding header)
|
|
68
|
+
|
|
69
|
+
// Reset all styles first
|
|
70
|
+
keys.forEach(k => {
|
|
71
|
+
const { ref } = sectionsConfig[k];
|
|
72
|
+
ref.current.style.marginTop = '0px';
|
|
73
|
+
ref.current.style.marginBottom = '0px';
|
|
74
|
+
ref.current.style.paddingBottom = '0px';
|
|
75
|
+
});
|
|
69
76
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
77
|
+
keys.forEach((k, i) => {
|
|
78
|
+
const { height, ref } = sectionsConfig[k];
|
|
79
|
+
const isFirstSection = i === 0;
|
|
80
|
+
const isLastSection = i === keys.length - 1;
|
|
81
|
+
const isFirstSectionOnPage = currentPageContentHeight === 0;
|
|
82
|
+
|
|
83
|
+
// For first section of entire document
|
|
84
|
+
if (isFirstSection) {
|
|
85
|
+
ref.current.style.marginTop = `${HEADER_HEIGHT + FIRST_PAGE_TOP_PADDING}px`;
|
|
86
|
+
currentPageContentHeight = height + FIRST_PAGE_TOP_PADDING;
|
|
87
|
+
|
|
88
|
+
if (isLastSection) {
|
|
89
|
+
ref.current.style.paddingBottom = `${LAST_SECTION_BOTTOM_PADDING}px`;
|
|
73
90
|
}
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
74
93
|
|
|
75
|
-
|
|
94
|
+
// Calculate space needed for this section including spacing before it
|
|
95
|
+
const spacingBefore = isFirstSectionOnPage ? NEW_PAGE_TOP_PADDING : SECTION_SPACING;
|
|
96
|
+
const totalSpaceNeeded = spacingBefore + height;
|
|
97
|
+
|
|
98
|
+
// Check if we need to move to next page
|
|
99
|
+
if (currentPageContentHeight + totalSpaceNeeded > AVAILABLE_HEIGHT) {
|
|
100
|
+
// Move to new page
|
|
101
|
+
currentPage += 1;
|
|
102
|
+
_pages.push(currentPage);
|
|
103
|
+
|
|
104
|
+
// Calculate and apply bottom margin to fill previous page
|
|
105
|
+
const usedSpace = currentPageContentHeight;
|
|
106
|
+
const remainingSpace = AVAILABLE_HEIGHT - usedSpace;
|
|
107
|
+
const previousKey = keys[i - 1];
|
|
108
|
+
sectionsConfig[previousKey].ref.current.style.marginBottom = `${remainingSpace}px`;
|
|
109
|
+
|
|
110
|
+
// This section starts the new page
|
|
111
|
+
ref.current.style.marginTop = `${HEADER_HEIGHT + NEW_PAGE_TOP_PADDING}px`;
|
|
112
|
+
currentPageContentHeight = height + NEW_PAGE_TOP_PADDING;
|
|
113
|
+
} else {
|
|
114
|
+
// Section fits on current page
|
|
115
|
+
ref.current.style.marginTop = `${spacingBefore}px`;
|
|
116
|
+
currentPageContentHeight += totalSpaceNeeded;
|
|
117
|
+
}
|
|
76
118
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
119
|
+
// Add bottom padding to last section
|
|
120
|
+
if (isLastSection) {
|
|
121
|
+
ref.current.style.paddingBottom = `${LAST_SECTION_BOTTOM_PADDING}px`;
|
|
122
|
+
}
|
|
123
|
+
});
|
|
80
124
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
ref.current.style.marginTop = '30px';
|
|
84
|
-
_page += 1;
|
|
85
|
-
_pages.push(_page);
|
|
86
|
-
|
|
87
|
-
if (sectionsConfig[keys[i - 1]]) {
|
|
88
|
-
const { ref: topRef } = sectionsConfig[keys[i - 1]];
|
|
89
|
-
topRef.current.style.marginBottom = `${dif + HEADER_HEIGHT - 24}px`;
|
|
90
|
-
incrHeight = height + 24 + HEADER_HEIGHT;
|
|
91
|
-
// console.log('margin', dif);
|
|
92
|
-
}
|
|
93
|
-
} else {
|
|
94
|
-
incrHeight = newHeight + 24;
|
|
95
|
-
}
|
|
96
|
-
// console.groupEnd();
|
|
97
|
-
})
|
|
98
|
-
setPages(_pages);
|
|
99
|
-
}
|
|
100
|
-
}, [sectionsConfig]);
|
|
125
|
+
setPages(_pages);
|
|
126
|
+
}, [sectionsConfig, config.length]);
|
|
101
127
|
|
|
102
128
|
useEffect(() => {
|
|
103
129
|
doSizing();
|
|
@@ -117,7 +143,7 @@ export default function PdfView({
|
|
|
117
143
|
{config.map((widgets, i) => (
|
|
118
144
|
<Row
|
|
119
145
|
widgets={widgets}
|
|
120
|
-
key={`dashboard-sections
|
|
146
|
+
key={`dashboard-sections-${i + 1}`}
|
|
121
147
|
i={i}
|
|
122
148
|
onChangeHeight={onChangeHeight}
|
|
123
149
|
/>
|
|
@@ -128,23 +154,20 @@ export default function PdfView({
|
|
|
128
154
|
);
|
|
129
155
|
}, [config, onChangeHeight]);
|
|
130
156
|
|
|
131
|
-
// <div className="daf-analysis">
|
|
132
|
-
// <Header title={t('Dashboard Title')} />
|
|
133
|
-
|
|
134
|
-
// <div className="content">
|
|
135
|
-
// <div className="view-content">
|
|
136
|
-
// <div className="daf-analysis-layout">
|
|
137
|
-
// <div className='sections-cont w-pt'>
|
|
138
|
-
// <section>
|
|
139
|
-
|
|
140
157
|
return (
|
|
141
158
|
<div className={contClassName} style={{ position: 'relative' }}>
|
|
142
159
|
{renderDashboard()}
|
|
143
160
|
{pages.map((page) => (
|
|
144
|
-
|
|
161
|
+
<div key={`page-${page}`}>
|
|
145
162
|
<div
|
|
146
|
-
style={{
|
|
147
|
-
|
|
163
|
+
style={{
|
|
164
|
+
top: ((page - 1) * PAGE_HEIGHT),
|
|
165
|
+
width: '100%',
|
|
166
|
+
height: HEADER_HEIGHT,
|
|
167
|
+
position: 'absolute',
|
|
168
|
+
left: 0,
|
|
169
|
+
zIndex: 1000000
|
|
170
|
+
}}
|
|
148
171
|
className="flex-row dashboard-header"
|
|
149
172
|
>
|
|
150
173
|
<div className="flex flex-column justify-center flex-1">
|
|
@@ -155,8 +178,14 @@ export default function PdfView({
|
|
|
155
178
|
</div>
|
|
156
179
|
</div>
|
|
157
180
|
<div
|
|
158
|
-
style={{
|
|
159
|
-
|
|
181
|
+
style={{
|
|
182
|
+
top: (page * PAGE_HEIGHT) - FOOTER_HEIGHT,
|
|
183
|
+
width: '100%',
|
|
184
|
+
height: FOOTER_HEIGHT,
|
|
185
|
+
position: 'absolute',
|
|
186
|
+
left: 0,
|
|
187
|
+
zIndex: 1000000
|
|
188
|
+
}}
|
|
160
189
|
className="dashboard-footer flex-row"
|
|
161
190
|
>
|
|
162
191
|
<div className="flex flex-column justify-center">
|
|
@@ -190,7 +219,7 @@ export default function PdfView({
|
|
|
190
219
|
<h5>{page}</h5>
|
|
191
220
|
</div>
|
|
192
221
|
</div>
|
|
193
|
-
|
|
222
|
+
</div>
|
|
194
223
|
))}
|
|
195
224
|
</div>
|
|
196
225
|
);
|
|
@@ -204,4 +233,5 @@ PdfView.propTypes = {
|
|
|
204
233
|
userId: PropTypes.string,
|
|
205
234
|
accountId: PropTypes.string,
|
|
206
235
|
documentId: PropTypes.string,
|
|
207
|
-
|
|
236
|
+
downloadId: PropTypes.string,
|
|
237
|
+
}
|