datastake-daf 0.6.416 → 0.6.418
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
|
@@ -13276,9 +13276,15 @@ DAFFooter.propTypes = {
|
|
|
13276
13276
|
};
|
|
13277
13277
|
|
|
13278
13278
|
const PAGE_HEIGHT = 1587;
|
|
13279
|
-
// margin-top: 20, bottom: 20;
|
|
13280
13279
|
const FOOTER_HEIGHT = 70;
|
|
13281
13280
|
const HEADER_HEIGHT = 100;
|
|
13281
|
+
const SECTION_SPACING = 24;
|
|
13282
|
+
const TOP_PADDING = 30;
|
|
13283
|
+
const BOTTOM_PADDING = 30;
|
|
13284
|
+
|
|
13285
|
+
// Calculate usable height per page
|
|
13286
|
+
const USABLE_HEIGHT = PAGE_HEIGHT - HEADER_HEIGHT - FOOTER_HEIGHT - TOP_PADDING - BOTTOM_PADDING;
|
|
13287
|
+
const SPLIT_THRESHOLD = USABLE_HEIGHT * 0.80;
|
|
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,88 @@ 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
|
+
if (keys.length !== config.length) return;
|
|
13335
|
+
|
|
13336
|
+
// Check if all refs are ready
|
|
13337
|
+
const allRefsReady = keys.every(k => {
|
|
13338
|
+
const {
|
|
13339
|
+
ref
|
|
13340
|
+
} = sectionsConfig[k];
|
|
13341
|
+
return ref && ref.current;
|
|
13342
|
+
});
|
|
13343
|
+
if (!allRefsReady) return;
|
|
13328
13344
|
let _pages = [1];
|
|
13329
|
-
let
|
|
13330
|
-
|
|
13331
|
-
|
|
13332
|
-
|
|
13333
|
-
|
|
13334
|
-
|
|
13335
|
-
|
|
13345
|
+
let currentPage = 1;
|
|
13346
|
+
let accumulatedHeightOnPage = 0;
|
|
13347
|
+
|
|
13348
|
+
// Reset all styles first
|
|
13349
|
+
keys.forEach(k => {
|
|
13350
|
+
const {
|
|
13351
|
+
ref
|
|
13352
|
+
} = sectionsConfig[k];
|
|
13353
|
+
if (ref.current) {
|
|
13354
|
+
ref.current.style.marginTop = '0px';
|
|
13336
13355
|
ref.current.style.marginBottom = '0px';
|
|
13337
|
-
|
|
13338
|
-
|
|
13339
|
-
|
|
13340
|
-
|
|
13341
|
-
|
|
13342
|
-
|
|
13343
|
-
|
|
13344
|
-
|
|
13345
|
-
|
|
13346
|
-
|
|
13347
|
-
|
|
13348
|
-
|
|
13349
|
-
|
|
13350
|
-
|
|
13351
|
-
|
|
13352
|
-
|
|
13353
|
-
|
|
13354
|
-
|
|
13355
|
-
|
|
13356
|
-
|
|
13357
|
-
|
|
13356
|
+
ref.current.style.paddingBottom = '0px';
|
|
13357
|
+
ref.current.style.paddingTop = '0px';
|
|
13358
|
+
}
|
|
13359
|
+
});
|
|
13360
|
+
keys.forEach((k, i) => {
|
|
13361
|
+
const {
|
|
13362
|
+
height,
|
|
13363
|
+
ref
|
|
13364
|
+
} = sectionsConfig[k];
|
|
13365
|
+
if (!ref || !ref.current) return;
|
|
13366
|
+
const isFirst = i === 0;
|
|
13367
|
+
const isLast = i === keys.length - 1;
|
|
13368
|
+
|
|
13369
|
+
// For first section on first page
|
|
13370
|
+
if (isFirst) {
|
|
13371
|
+
ref.current.style.paddingTop = "".concat(HEADER_HEIGHT + TOP_PADDING, "px");
|
|
13372
|
+
accumulatedHeightOnPage = height;
|
|
13373
|
+
} else {
|
|
13374
|
+
// Calculate what the new accumulated height would be with this section
|
|
13375
|
+
const potentialAccumulated = accumulatedHeightOnPage + SECTION_SPACING + height;
|
|
13376
|
+
|
|
13377
|
+
// Check if we need a page break
|
|
13378
|
+
const needsPageBreak = potentialAccumulated > SPLIT_THRESHOLD || accumulatedHeightOnPage + SECTION_SPACING + height > USABLE_HEIGHT;
|
|
13379
|
+
if (needsPageBreak) {
|
|
13380
|
+
// Calculate remaining space and add it as margin to previous section
|
|
13381
|
+
const remainingSpace = USABLE_HEIGHT - accumulatedHeightOnPage;
|
|
13382
|
+
const previousKey = keys[i - 1];
|
|
13383
|
+
if (sectionsConfig[previousKey]) {
|
|
13358
13384
|
const {
|
|
13359
|
-
ref:
|
|
13360
|
-
} = sectionsConfig[
|
|
13361
|
-
|
|
13362
|
-
|
|
13363
|
-
|
|
13385
|
+
ref: prevRef
|
|
13386
|
+
} = sectionsConfig[previousKey];
|
|
13387
|
+
if (prevRef && prevRef.current) {
|
|
13388
|
+
// Add margin bottom to fill the rest of the page + space for header
|
|
13389
|
+
prevRef.current.style.marginBottom = "".concat(remainingSpace + HEADER_HEIGHT + BOTTOM_PADDING, "px");
|
|
13390
|
+
}
|
|
13364
13391
|
}
|
|
13392
|
+
|
|
13393
|
+
// Start new page
|
|
13394
|
+
currentPage += 1;
|
|
13395
|
+
_pages.push(currentPage);
|
|
13396
|
+
|
|
13397
|
+
// Add top padding for new page (header + top padding)
|
|
13398
|
+
ref.current.style.paddingTop = "".concat(HEADER_HEIGHT + TOP_PADDING, "px");
|
|
13399
|
+
|
|
13400
|
+
// Reset accumulated height for new page
|
|
13401
|
+
accumulatedHeightOnPage = height;
|
|
13365
13402
|
} else {
|
|
13366
|
-
|
|
13403
|
+
// Section fits on current page
|
|
13404
|
+
ref.current.style.marginTop = "".concat(SECTION_SPACING, "px");
|
|
13405
|
+
accumulatedHeightOnPage = potentialAccumulated;
|
|
13367
13406
|
}
|
|
13368
|
-
|
|
13369
|
-
|
|
13370
|
-
|
|
13371
|
-
|
|
13372
|
-
|
|
13407
|
+
}
|
|
13408
|
+
|
|
13409
|
+
// Add bottom padding to last section
|
|
13410
|
+
if (isLast) {
|
|
13411
|
+
ref.current.style.paddingBottom = "".concat(BOTTOM_PADDING, "px");
|
|
13412
|
+
}
|
|
13413
|
+
});
|
|
13414
|
+
setPages(_pages);
|
|
13415
|
+
}, [sectionsConfig, config.length]);
|
|
13373
13416
|
React.useEffect(() => {
|
|
13374
13417
|
doSizing();
|
|
13375
13418
|
}, [doSizing]);
|
|
@@ -13390,32 +13433,22 @@ function PdfView(_ref2) {
|
|
|
13390
13433
|
widgets: widgets,
|
|
13391
13434
|
i: i,
|
|
13392
13435
|
onChangeHeight: onChangeHeight
|
|
13393
|
-
}, "dashboard-sections
|
|
13436
|
+
}, "dashboard-sections-".concat(i + 1)))
|
|
13394
13437
|
})
|
|
13395
13438
|
})
|
|
13396
13439
|
});
|
|
13397
13440
|
}, [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
13441
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
13409
13442
|
className: contClassName,
|
|
13410
13443
|
style: {
|
|
13411
13444
|
position: 'relative'
|
|
13412
13445
|
},
|
|
13413
|
-
children: [renderDashboard(), pages.map(page => /*#__PURE__*/jsxRuntime.jsxs(
|
|
13446
|
+
children: [renderDashboard(), pages.map(page => /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
13414
13447
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
13415
13448
|
style: {
|
|
13416
13449
|
top: (page - 1) * PAGE_HEIGHT,
|
|
13417
13450
|
width: '100%',
|
|
13418
|
-
height: HEADER_HEIGHT
|
|
13451
|
+
height: HEADER_HEIGHT,
|
|
13419
13452
|
position: 'absolute',
|
|
13420
13453
|
left: 0,
|
|
13421
13454
|
zIndex: 1000000
|
|
@@ -13433,7 +13466,7 @@ function PdfView(_ref2) {
|
|
|
13433
13466
|
alt: "logo"
|
|
13434
13467
|
})
|
|
13435
13468
|
})]
|
|
13436
|
-
}
|
|
13469
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
13437
13470
|
style: {
|
|
13438
13471
|
top: page * PAGE_HEIGHT - FOOTER_HEIGHT,
|
|
13439
13472
|
width: '100%',
|
|
@@ -13476,8 +13509,8 @@ function PdfView(_ref2) {
|
|
|
13476
13509
|
children: page
|
|
13477
13510
|
})
|
|
13478
13511
|
})]
|
|
13479
|
-
}
|
|
13480
|
-
}))]
|
|
13512
|
+
})]
|
|
13513
|
+
}, "page-".concat(page)))]
|
|
13481
13514
|
});
|
|
13482
13515
|
}
|
|
13483
13516
|
PdfView.propTypes = {
|
|
@@ -13487,7 +13520,8 @@ PdfView.propTypes = {
|
|
|
13487
13520
|
imgSrc: PropTypes__default["default"].string,
|
|
13488
13521
|
userId: PropTypes__default["default"].string,
|
|
13489
13522
|
accountId: PropTypes__default["default"].string,
|
|
13490
|
-
documentId: PropTypes__default["default"].string
|
|
13523
|
+
documentId: PropTypes__default["default"].string,
|
|
13524
|
+
downloadId: PropTypes__default["default"].string
|
|
13491
13525
|
};
|
|
13492
13526
|
|
|
13493
13527
|
const ajaxSelectFieldData = async (value, config, getApiBaseUrl = () => {}, getAppHeader = () => {}, app, formValues = {}) => {
|
package/package.json
CHANGED
|
@@ -4,9 +4,15 @@ import { useCallback, useEffect, useRef, useState } 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 SECTION_SPACING = 24;
|
|
10
|
+
const TOP_PADDING = 30;
|
|
11
|
+
const BOTTOM_PADDING = 30;
|
|
12
|
+
|
|
13
|
+
// Calculate usable height per page
|
|
14
|
+
const USABLE_HEIGHT = PAGE_HEIGHT - HEADER_HEIGHT - FOOTER_HEIGHT - TOP_PADDING - BOTTOM_PADDING;
|
|
15
|
+
const SPLIT_THRESHOLD = USABLE_HEIGHT * 0.80;
|
|
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,88 @@ export default function PdfView({
|
|
|
52
58
|
|
|
53
59
|
const doSizing = useCallback(() => {
|
|
54
60
|
const keys = Object.keys(sectionsConfig);
|
|
55
|
-
|
|
56
|
-
|
|
61
|
+
|
|
62
|
+
if (keys.length !== config.length) return;
|
|
63
|
+
|
|
64
|
+
// Check if all refs are ready
|
|
65
|
+
const allRefsReady = keys.every(k => {
|
|
66
|
+
const { ref } = sectionsConfig[k];
|
|
67
|
+
return ref && ref.current;
|
|
68
|
+
});
|
|
57
69
|
|
|
58
|
-
if (
|
|
59
|
-
let incrHeight = 0;
|
|
70
|
+
if (!allRefsReady) return;
|
|
60
71
|
|
|
61
|
-
|
|
62
|
-
|
|
72
|
+
let _pages = [1];
|
|
73
|
+
let currentPage = 1;
|
|
74
|
+
let accumulatedHeightOnPage = 0;
|
|
75
|
+
|
|
76
|
+
// Reset all styles first
|
|
77
|
+
keys.forEach(k => {
|
|
78
|
+
const { ref } = sectionsConfig[k];
|
|
79
|
+
if (ref.current) {
|
|
80
|
+
ref.current.style.marginTop = '0px';
|
|
63
81
|
ref.current.style.marginBottom = '0px';
|
|
64
|
-
|
|
65
|
-
|
|
82
|
+
ref.current.style.paddingBottom = '0px';
|
|
83
|
+
ref.current.style.paddingTop = '0px';
|
|
84
|
+
}
|
|
85
|
+
});
|
|
66
86
|
|
|
67
|
-
|
|
68
|
-
|
|
87
|
+
keys.forEach((k, i) => {
|
|
88
|
+
const { height, ref } = sectionsConfig[k];
|
|
89
|
+
if (!ref || !ref.current) return;
|
|
90
|
+
|
|
91
|
+
const isFirst = i === 0;
|
|
92
|
+
const isLast = i === keys.length - 1;
|
|
93
|
+
|
|
94
|
+
// For first section on first page
|
|
95
|
+
if (isFirst) {
|
|
96
|
+
ref.current.style.paddingTop = `${HEADER_HEIGHT + TOP_PADDING}px`;
|
|
97
|
+
accumulatedHeightOnPage = height;
|
|
98
|
+
} else {
|
|
99
|
+
// Calculate what the new accumulated height would be with this section
|
|
100
|
+
const potentialAccumulated = accumulatedHeightOnPage + SECTION_SPACING + height;
|
|
101
|
+
|
|
102
|
+
// Check if we need a page break
|
|
103
|
+
const needsPageBreak = potentialAccumulated > SPLIT_THRESHOLD ||
|
|
104
|
+
(accumulatedHeightOnPage + SECTION_SPACING + height) > USABLE_HEIGHT;
|
|
105
|
+
|
|
106
|
+
if (needsPageBreak) {
|
|
107
|
+
// Calculate remaining space and add it as margin to previous section
|
|
108
|
+
const remainingSpace = USABLE_HEIGHT - accumulatedHeightOnPage;
|
|
109
|
+
const previousKey = keys[i - 1];
|
|
110
|
+
|
|
111
|
+
if (sectionsConfig[previousKey]) {
|
|
112
|
+
const { ref: prevRef } = sectionsConfig[previousKey];
|
|
113
|
+
if (prevRef && prevRef.current) {
|
|
114
|
+
// Add margin bottom to fill the rest of the page + space for header
|
|
115
|
+
prevRef.current.style.marginBottom = `${remainingSpace + HEADER_HEIGHT + BOTTOM_PADDING}px`;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
69
118
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
119
|
+
// Start new page
|
|
120
|
+
currentPage += 1;
|
|
121
|
+
_pages.push(currentPage);
|
|
122
|
+
|
|
123
|
+
// Add top padding for new page (header + top padding)
|
|
124
|
+
ref.current.style.paddingTop = `${HEADER_HEIGHT + TOP_PADDING}px`;
|
|
125
|
+
|
|
126
|
+
// Reset accumulated height for new page
|
|
127
|
+
accumulatedHeightOnPage = height;
|
|
128
|
+
} else {
|
|
129
|
+
// Section fits on current page
|
|
130
|
+
ref.current.style.marginTop = `${SECTION_SPACING}px`;
|
|
131
|
+
accumulatedHeightOnPage = potentialAccumulated;
|
|
73
132
|
}
|
|
133
|
+
}
|
|
74
134
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
135
|
+
// Add bottom padding to last section
|
|
136
|
+
if (isLast) {
|
|
137
|
+
ref.current.style.paddingBottom = `${BOTTOM_PADDING}px`;
|
|
138
|
+
}
|
|
139
|
+
});
|
|
80
140
|
|
|
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]);
|
|
141
|
+
setPages(_pages);
|
|
142
|
+
}, [sectionsConfig, config.length]);
|
|
101
143
|
|
|
102
144
|
useEffect(() => {
|
|
103
145
|
doSizing();
|
|
@@ -117,7 +159,7 @@ export default function PdfView({
|
|
|
117
159
|
{config.map((widgets, i) => (
|
|
118
160
|
<Row
|
|
119
161
|
widgets={widgets}
|
|
120
|
-
key={`dashboard-sections
|
|
162
|
+
key={`dashboard-sections-${i + 1}`}
|
|
121
163
|
i={i}
|
|
122
164
|
onChangeHeight={onChangeHeight}
|
|
123
165
|
/>
|
|
@@ -128,23 +170,20 @@ export default function PdfView({
|
|
|
128
170
|
);
|
|
129
171
|
}, [config, onChangeHeight]);
|
|
130
172
|
|
|
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
173
|
return (
|
|
141
174
|
<div className={contClassName} style={{ position: 'relative' }}>
|
|
142
175
|
{renderDashboard()}
|
|
143
176
|
{pages.map((page) => (
|
|
144
|
-
|
|
177
|
+
<div key={`page-${page}`}>
|
|
145
178
|
<div
|
|
146
|
-
style={{
|
|
147
|
-
|
|
179
|
+
style={{
|
|
180
|
+
top: ((page - 1) * PAGE_HEIGHT),
|
|
181
|
+
width: '100%',
|
|
182
|
+
height: HEADER_HEIGHT,
|
|
183
|
+
position: 'absolute',
|
|
184
|
+
left: 0,
|
|
185
|
+
zIndex: 1000000
|
|
186
|
+
}}
|
|
148
187
|
className="flex-row dashboard-header"
|
|
149
188
|
>
|
|
150
189
|
<div className="flex flex-column justify-center flex-1">
|
|
@@ -155,8 +194,14 @@ export default function PdfView({
|
|
|
155
194
|
</div>
|
|
156
195
|
</div>
|
|
157
196
|
<div
|
|
158
|
-
style={{
|
|
159
|
-
|
|
197
|
+
style={{
|
|
198
|
+
top: (page * PAGE_HEIGHT) - FOOTER_HEIGHT,
|
|
199
|
+
width: '100%',
|
|
200
|
+
height: FOOTER_HEIGHT,
|
|
201
|
+
position: 'absolute',
|
|
202
|
+
left: 0,
|
|
203
|
+
zIndex: 1000000
|
|
204
|
+
}}
|
|
160
205
|
className="dashboard-footer flex-row"
|
|
161
206
|
>
|
|
162
207
|
<div className="flex flex-column justify-center">
|
|
@@ -190,7 +235,7 @@ export default function PdfView({
|
|
|
190
235
|
<h5>{page}</h5>
|
|
191
236
|
</div>
|
|
192
237
|
</div>
|
|
193
|
-
|
|
238
|
+
</div>
|
|
194
239
|
))}
|
|
195
240
|
</div>
|
|
196
241
|
);
|
|
@@ -204,4 +249,5 @@ PdfView.propTypes = {
|
|
|
204
249
|
userId: PropTypes.string,
|
|
205
250
|
accountId: PropTypes.string,
|
|
206
251
|
documentId: PropTypes.string,
|
|
207
|
-
|
|
252
|
+
downloadId: PropTypes.string,
|
|
253
|
+
}
|