datastake-daf 0.6.409 → 0.6.411
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,15 @@ 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 PAGE_TOP_PADDING = 30; // Padding at top of new page (after header)
|
|
13283
|
+
const PAGE_BOTTOM_PADDING = 30; // Padding before footer
|
|
13284
|
+
|
|
13285
|
+
// Available content height per page
|
|
13286
|
+
const AVAILABLE_HEIGHT = PAGE_HEIGHT - HEADER_HEIGHT - FOOTER_HEIGHT - PAGE_TOP_PADDING - PAGE_BOTTOM_PADDING;
|
|
13282
13287
|
const Row = _ref => {
|
|
13283
13288
|
let {
|
|
13284
13289
|
widgets,
|
|
@@ -13303,7 +13308,7 @@ const Row = _ref => {
|
|
|
13303
13308
|
ref
|
|
13304
13309
|
});
|
|
13305
13310
|
}
|
|
13306
|
-
}, [height]);
|
|
13311
|
+
}, [height, i, onChangeHeight]);
|
|
13307
13312
|
return /*#__PURE__*/jsxRuntime.jsx("section", {
|
|
13308
13313
|
ref: ref,
|
|
13309
13314
|
style: widgets.style,
|
|
@@ -13325,51 +13330,83 @@ function PdfView(_ref2) {
|
|
|
13325
13330
|
const [pages, setPages] = React.useState([1]);
|
|
13326
13331
|
const doSizing = React.useCallback(() => {
|
|
13327
13332
|
const keys = Object.keys(sectionsConfig);
|
|
13333
|
+
|
|
13334
|
+
// Wait until all sections have been measured
|
|
13335
|
+
if (keys.length !== config.length) return;
|
|
13328
13336
|
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
|
-
|
|
13357
|
-
|
|
13358
|
-
|
|
13359
|
-
|
|
13360
|
-
|
|
13361
|
-
|
|
13362
|
-
|
|
13363
|
-
|
|
13364
|
-
|
|
13337
|
+
let currentPage = 1;
|
|
13338
|
+
let currentPageHeight = 0; // Height used on current page (excluding header/footer)
|
|
13339
|
+
|
|
13340
|
+
// Reset all margins first
|
|
13341
|
+
keys.forEach(k => {
|
|
13342
|
+
const {
|
|
13343
|
+
ref
|
|
13344
|
+
} = sectionsConfig[k];
|
|
13345
|
+
ref.current.style.marginTop = '0px';
|
|
13346
|
+
ref.current.style.marginBottom = '0px';
|
|
13347
|
+
ref.current.style.paddingBottom = '0px';
|
|
13348
|
+
});
|
|
13349
|
+
keys.forEach((k, i) => {
|
|
13350
|
+
const {
|
|
13351
|
+
height,
|
|
13352
|
+
ref
|
|
13353
|
+
} = sectionsConfig[k];
|
|
13354
|
+
const isFirstSection = i === 0;
|
|
13355
|
+
const isLastSection = i === keys.length - 1;
|
|
13356
|
+
const isFirstOnPage = currentPageHeight === 0;
|
|
13357
|
+
|
|
13358
|
+
// Calculate height needed for this section
|
|
13359
|
+
let sectionHeightWithSpacing = height;
|
|
13360
|
+
|
|
13361
|
+
// Add spacing before section (except first on page)
|
|
13362
|
+
if (!isFirstOnPage) {
|
|
13363
|
+
sectionHeightWithSpacing += SECTION_SPACING;
|
|
13364
|
+
}
|
|
13365
|
+
|
|
13366
|
+
// Check if section fits on current page
|
|
13367
|
+
if (currentPageHeight + sectionHeightWithSpacing > AVAILABLE_HEIGHT && !isFirstOnPage) {
|
|
13368
|
+
// Section doesn't fit, move to next page
|
|
13369
|
+
|
|
13370
|
+
// Add bottom margin to previous section to fill remaining space
|
|
13371
|
+
const remainingSpace = AVAILABLE_HEIGHT - currentPageHeight;
|
|
13372
|
+
const previousKey = keys[i - 1];
|
|
13373
|
+
if (sectionsConfig[previousKey]) {
|
|
13374
|
+
sectionsConfig[previousKey].ref.current.style.marginBottom = "".concat(remainingSpace + PAGE_BOTTOM_PADDING, "px");
|
|
13375
|
+
}
|
|
13376
|
+
|
|
13377
|
+
// Start new page
|
|
13378
|
+
currentPage += 1;
|
|
13379
|
+
_pages.push(currentPage);
|
|
13380
|
+
currentPageHeight = 0;
|
|
13381
|
+
|
|
13382
|
+
// Add top margin for new page
|
|
13383
|
+
ref.current.style.marginTop = "".concat(HEADER_HEIGHT + PAGE_TOP_PADDING, "px");
|
|
13384
|
+
|
|
13385
|
+
// Update height calculation for this section on new page
|
|
13386
|
+
currentPageHeight = height;
|
|
13387
|
+
} else {
|
|
13388
|
+
// Section fits on current page
|
|
13389
|
+
|
|
13390
|
+
if (isFirstSection) {
|
|
13391
|
+
// First section gets header spacing
|
|
13392
|
+
ref.current.style.marginTop = "".concat(HEADER_HEIGHT + PAGE_TOP_PADDING, "px");
|
|
13393
|
+
} else if (isFirstOnPage) {
|
|
13394
|
+
// First section on a new page (after page break)
|
|
13395
|
+
ref.current.style.marginTop = "".concat(PAGE_TOP_PADDING, "px");
|
|
13365
13396
|
} else {
|
|
13366
|
-
|
|
13397
|
+
// Regular section spacing
|
|
13398
|
+
ref.current.style.marginTop = "".concat(SECTION_SPACING, "px");
|
|
13367
13399
|
}
|
|
13368
|
-
|
|
13369
|
-
}
|
|
13370
|
-
|
|
13371
|
-
|
|
13372
|
-
|
|
13400
|
+
currentPageHeight += sectionHeightWithSpacing;
|
|
13401
|
+
}
|
|
13402
|
+
|
|
13403
|
+
// Add padding to last section
|
|
13404
|
+
if (isLastSection) {
|
|
13405
|
+
ref.current.style.paddingBottom = "".concat(PAGE_BOTTOM_PADDING, "px");
|
|
13406
|
+
}
|
|
13407
|
+
});
|
|
13408
|
+
setPages(_pages);
|
|
13409
|
+
}, [sectionsConfig, config.length]);
|
|
13373
13410
|
React.useEffect(() => {
|
|
13374
13411
|
doSizing();
|
|
13375
13412
|
}, [doSizing]);
|
|
@@ -13390,32 +13427,22 @@ function PdfView(_ref2) {
|
|
|
13390
13427
|
widgets: widgets,
|
|
13391
13428
|
i: i,
|
|
13392
13429
|
onChangeHeight: onChangeHeight
|
|
13393
|
-
}, "dashboard-sections
|
|
13430
|
+
}, "dashboard-sections-".concat(i + 1)))
|
|
13394
13431
|
})
|
|
13395
13432
|
})
|
|
13396
13433
|
});
|
|
13397
13434
|
}, [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
13435
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
13409
13436
|
className: contClassName,
|
|
13410
13437
|
style: {
|
|
13411
13438
|
position: 'relative'
|
|
13412
13439
|
},
|
|
13413
|
-
children: [renderDashboard(), pages.map(page => /*#__PURE__*/jsxRuntime.jsxs(
|
|
13440
|
+
children: [renderDashboard(), pages.map(page => /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
13414
13441
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
13415
13442
|
style: {
|
|
13416
13443
|
top: (page - 1) * PAGE_HEIGHT,
|
|
13417
13444
|
width: '100%',
|
|
13418
|
-
height: HEADER_HEIGHT
|
|
13445
|
+
height: HEADER_HEIGHT,
|
|
13419
13446
|
position: 'absolute',
|
|
13420
13447
|
left: 0,
|
|
13421
13448
|
zIndex: 1000000
|
|
@@ -13433,7 +13460,7 @@ function PdfView(_ref2) {
|
|
|
13433
13460
|
alt: "logo"
|
|
13434
13461
|
})
|
|
13435
13462
|
})]
|
|
13436
|
-
}
|
|
13463
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
13437
13464
|
style: {
|
|
13438
13465
|
top: page * PAGE_HEIGHT - FOOTER_HEIGHT,
|
|
13439
13466
|
width: '100%',
|
|
@@ -13476,8 +13503,8 @@ function PdfView(_ref2) {
|
|
|
13476
13503
|
children: page
|
|
13477
13504
|
})
|
|
13478
13505
|
})]
|
|
13479
|
-
}
|
|
13480
|
-
}))]
|
|
13506
|
+
})]
|
|
13507
|
+
}, "page-".concat(page)))]
|
|
13481
13508
|
});
|
|
13482
13509
|
}
|
|
13483
13510
|
PdfView.propTypes = {
|
|
@@ -13487,7 +13514,8 @@ PdfView.propTypes = {
|
|
|
13487
13514
|
imgSrc: PropTypes__default["default"].string,
|
|
13488
13515
|
userId: PropTypes__default["default"].string,
|
|
13489
13516
|
accountId: PropTypes__default["default"].string,
|
|
13490
|
-
documentId: PropTypes__default["default"].string
|
|
13517
|
+
documentId: PropTypes__default["default"].string,
|
|
13518
|
+
downloadId: PropTypes__default["default"].string
|
|
13491
13519
|
};
|
|
13492
13520
|
|
|
13493
13521
|
const ajaxSelectFieldData = async (value, config, getApiBaseUrl = () => {}, getAppHeader = () => {}, app, formValues = {}) => {
|
package/package.json
CHANGED
|
@@ -3,10 +3,15 @@ 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 PAGE_TOP_PADDING = 30; // Padding at top of new page (after header)
|
|
11
|
+
const PAGE_BOTTOM_PADDING = 30; // Padding before footer
|
|
12
|
+
|
|
13
|
+
// Available content height per page
|
|
14
|
+
const AVAILABLE_HEIGHT = PAGE_HEIGHT - HEADER_HEIGHT - FOOTER_HEIGHT - PAGE_TOP_PADDING - PAGE_BOTTOM_PADDING;
|
|
10
15
|
|
|
11
16
|
const Row = ({ widgets, i, onChangeHeight = () => { } }) => {
|
|
12
17
|
const ref = useRef();
|
|
@@ -28,7 +33,7 @@ const Row = ({ widgets, i, onChangeHeight = () => { } }) => {
|
|
|
28
33
|
if (height) {
|
|
29
34
|
onChangeHeight(i, { height, ref });
|
|
30
35
|
}
|
|
31
|
-
}, [height])
|
|
36
|
+
}, [height, i, onChangeHeight])
|
|
32
37
|
|
|
33
38
|
return (
|
|
34
39
|
<section ref={ref} style={widgets.style}>
|
|
@@ -52,52 +57,82 @@ export default function PdfView({
|
|
|
52
57
|
|
|
53
58
|
const doSizing = useCallback(() => {
|
|
54
59
|
const keys = Object.keys(sectionsConfig);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (keys.length === config.length) {
|
|
59
|
-
let incrHeight = 0;
|
|
60
|
-
|
|
61
|
-
keys.forEach(k => {
|
|
62
|
-
const { ref } = sectionsConfig[k];
|
|
63
|
-
ref.current.style.marginBottom = '0px';
|
|
64
|
-
// ref.current.style.marginTop = '15px';
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
keys.forEach((k, i) => {
|
|
68
|
-
const { height, ref } = sectionsConfig[k];
|
|
60
|
+
|
|
61
|
+
// Wait until all sections have been measured
|
|
62
|
+
if (keys.length !== config.length) return;
|
|
69
63
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
64
|
+
let _pages = [1];
|
|
65
|
+
let currentPage = 1;
|
|
66
|
+
let currentPageHeight = 0; // Height used on current page (excluding header/footer)
|
|
67
|
+
|
|
68
|
+
// Reset all margins first
|
|
69
|
+
keys.forEach(k => {
|
|
70
|
+
const { ref } = sectionsConfig[k];
|
|
71
|
+
ref.current.style.marginTop = '0px';
|
|
72
|
+
ref.current.style.marginBottom = '0px';
|
|
73
|
+
ref.current.style.paddingBottom = '0px';
|
|
74
|
+
});
|
|
74
75
|
|
|
75
|
-
|
|
76
|
+
keys.forEach((k, i) => {
|
|
77
|
+
const { height, ref } = sectionsConfig[k];
|
|
78
|
+
const isFirstSection = i === 0;
|
|
79
|
+
const isLastSection = i === keys.length - 1;
|
|
80
|
+
const isFirstOnPage = currentPageHeight === 0;
|
|
81
|
+
|
|
82
|
+
// Calculate height needed for this section
|
|
83
|
+
let sectionHeightWithSpacing = height;
|
|
84
|
+
|
|
85
|
+
// Add spacing before section (except first on page)
|
|
86
|
+
if (!isFirstOnPage) {
|
|
87
|
+
sectionHeightWithSpacing += SECTION_SPACING;
|
|
88
|
+
}
|
|
76
89
|
|
|
77
|
-
|
|
78
|
-
|
|
90
|
+
// Check if section fits on current page
|
|
91
|
+
if (currentPageHeight + sectionHeightWithSpacing > AVAILABLE_HEIGHT && !isFirstOnPage) {
|
|
92
|
+
// Section doesn't fit, move to next page
|
|
93
|
+
|
|
94
|
+
// Add bottom margin to previous section to fill remaining space
|
|
95
|
+
const remainingSpace = AVAILABLE_HEIGHT - currentPageHeight;
|
|
96
|
+
const previousKey = keys[i - 1];
|
|
97
|
+
if (sectionsConfig[previousKey]) {
|
|
98
|
+
sectionsConfig[previousKey].ref.current.style.marginBottom = `${remainingSpace + PAGE_BOTTOM_PADDING}px`;
|
|
79
99
|
}
|
|
80
100
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
101
|
+
// Start new page
|
|
102
|
+
currentPage += 1;
|
|
103
|
+
_pages.push(currentPage);
|
|
104
|
+
currentPageHeight = 0;
|
|
105
|
+
|
|
106
|
+
// Add top margin for new page
|
|
107
|
+
ref.current.style.marginTop = `${HEADER_HEIGHT + PAGE_TOP_PADDING}px`;
|
|
108
|
+
|
|
109
|
+
// Update height calculation for this section on new page
|
|
110
|
+
currentPageHeight = height;
|
|
111
|
+
} else {
|
|
112
|
+
// Section fits on current page
|
|
113
|
+
|
|
114
|
+
if (isFirstSection) {
|
|
115
|
+
// First section gets header spacing
|
|
116
|
+
ref.current.style.marginTop = `${HEADER_HEIGHT + PAGE_TOP_PADDING}px`;
|
|
117
|
+
} else if (isFirstOnPage) {
|
|
118
|
+
// First section on a new page (after page break)
|
|
119
|
+
ref.current.style.marginTop = `${PAGE_TOP_PADDING}px`;
|
|
93
120
|
} else {
|
|
94
|
-
|
|
121
|
+
// Regular section spacing
|
|
122
|
+
ref.current.style.marginTop = `${SECTION_SPACING}px`;
|
|
95
123
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
124
|
+
|
|
125
|
+
currentPageHeight += sectionHeightWithSpacing;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Add padding to last section
|
|
129
|
+
if (isLastSection) {
|
|
130
|
+
ref.current.style.paddingBottom = `${PAGE_BOTTOM_PADDING}px`;
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
setPages(_pages);
|
|
135
|
+
}, [sectionsConfig, config.length]);
|
|
101
136
|
|
|
102
137
|
useEffect(() => {
|
|
103
138
|
doSizing();
|
|
@@ -117,7 +152,7 @@ export default function PdfView({
|
|
|
117
152
|
{config.map((widgets, i) => (
|
|
118
153
|
<Row
|
|
119
154
|
widgets={widgets}
|
|
120
|
-
key={`dashboard-sections
|
|
155
|
+
key={`dashboard-sections-${i + 1}`}
|
|
121
156
|
i={i}
|
|
122
157
|
onChangeHeight={onChangeHeight}
|
|
123
158
|
/>
|
|
@@ -128,23 +163,20 @@ export default function PdfView({
|
|
|
128
163
|
);
|
|
129
164
|
}, [config, onChangeHeight]);
|
|
130
165
|
|
|
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
166
|
return (
|
|
141
167
|
<div className={contClassName} style={{ position: 'relative' }}>
|
|
142
168
|
{renderDashboard()}
|
|
143
169
|
{pages.map((page) => (
|
|
144
|
-
|
|
170
|
+
<div key={`page-${page}`}>
|
|
145
171
|
<div
|
|
146
|
-
style={{
|
|
147
|
-
|
|
172
|
+
style={{
|
|
173
|
+
top: ((page - 1) * PAGE_HEIGHT),
|
|
174
|
+
width: '100%',
|
|
175
|
+
height: HEADER_HEIGHT,
|
|
176
|
+
position: 'absolute',
|
|
177
|
+
left: 0,
|
|
178
|
+
zIndex: 1000000
|
|
179
|
+
}}
|
|
148
180
|
className="flex-row dashboard-header"
|
|
149
181
|
>
|
|
150
182
|
<div className="flex flex-column justify-center flex-1">
|
|
@@ -155,8 +187,14 @@ export default function PdfView({
|
|
|
155
187
|
</div>
|
|
156
188
|
</div>
|
|
157
189
|
<div
|
|
158
|
-
style={{
|
|
159
|
-
|
|
190
|
+
style={{
|
|
191
|
+
top: (page * PAGE_HEIGHT) - FOOTER_HEIGHT,
|
|
192
|
+
width: '100%',
|
|
193
|
+
height: FOOTER_HEIGHT,
|
|
194
|
+
position: 'absolute',
|
|
195
|
+
left: 0,
|
|
196
|
+
zIndex: 1000000
|
|
197
|
+
}}
|
|
160
198
|
className="dashboard-footer flex-row"
|
|
161
199
|
>
|
|
162
200
|
<div className="flex flex-column justify-center">
|
|
@@ -190,7 +228,7 @@ export default function PdfView({
|
|
|
190
228
|
<h5>{page}</h5>
|
|
191
229
|
</div>
|
|
192
230
|
</div>
|
|
193
|
-
|
|
231
|
+
</div>
|
|
194
232
|
))}
|
|
195
233
|
</div>
|
|
196
234
|
);
|
|
@@ -204,4 +242,5 @@ PdfView.propTypes = {
|
|
|
204
242
|
userId: PropTypes.string,
|
|
205
243
|
accountId: PropTypes.string,
|
|
206
244
|
documentId: PropTypes.string,
|
|
207
|
-
|
|
245
|
+
downloadId: PropTypes.string,
|
|
246
|
+
}
|