datastake-daf 0.6.150 → 0.6.152
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
|
@@ -12956,11 +12956,9 @@ DAFFooter.propTypes = {
|
|
|
12956
12956
|
};
|
|
12957
12957
|
|
|
12958
12958
|
const PAGE_HEIGHT = 1587;
|
|
12959
|
+
// margin-top: 20, bottom: 20;
|
|
12959
12960
|
const FOOTER_HEIGHT = 70;
|
|
12960
12961
|
const HEADER_HEIGHT = 100;
|
|
12961
|
-
const ROW_SPACING = 24; // Spacing between content rows
|
|
12962
|
-
const CONTENT_BOTTOM_PADDING = 30; // Extra padding at the very bottom of the last section of the document
|
|
12963
|
-
|
|
12964
12962
|
const Row = _ref => {
|
|
12965
12963
|
let {
|
|
12966
12964
|
widgets,
|
|
@@ -13009,84 +13007,49 @@ function PdfView(_ref2) {
|
|
|
13009
13007
|
const keys = Object.keys(sectionsConfig);
|
|
13010
13008
|
let _pages = [1];
|
|
13011
13009
|
let _page = 1;
|
|
13012
|
-
|
|
13013
|
-
// The total vertical space available for flowing content on each page,
|
|
13014
|
-
// considering that HEADER_HEIGHT and FOOTER_HEIGHT are for absolutely positioned elements
|
|
13015
|
-
// and content should flow between them.
|
|
13016
|
-
const usableContentHeightPerPage = PAGE_HEIGHT - HEADER_HEIGHT - FOOTER_HEIGHT;
|
|
13017
13010
|
if (keys.length === config.length) {
|
|
13018
|
-
let
|
|
13019
|
-
|
|
13020
|
-
// Reset all margins/paddings first for a clean slate
|
|
13011
|
+
let incrHeight = 0;
|
|
13021
13012
|
keys.forEach(k => {
|
|
13022
13013
|
const {
|
|
13023
13014
|
ref
|
|
13024
13015
|
} = sectionsConfig[k];
|
|
13025
|
-
|
|
13026
|
-
|
|
13027
|
-
ref.current.style.marginTop = '0px';
|
|
13028
|
-
ref.current.style.paddingBottom = '0px';
|
|
13029
|
-
}
|
|
13016
|
+
ref.current.style.marginBottom = '0px';
|
|
13017
|
+
// ref.current.style.marginTop = '15px';
|
|
13030
13018
|
});
|
|
13031
13019
|
keys.forEach((k, i) => {
|
|
13032
13020
|
const {
|
|
13033
13021
|
height,
|
|
13034
13022
|
ref
|
|
13035
13023
|
} = sectionsConfig[k];
|
|
13036
|
-
if (
|
|
13037
|
-
|
|
13038
|
-
|
|
13039
|
-
|
|
13040
|
-
// The first section on *any* page (either global first or first on a new page)
|
|
13041
|
-
// needs to be offset by HEADER_HEIGHT from the top of the page.
|
|
13042
|
-
if (i === 0 || currentFlowHeight === 0) {
|
|
13043
|
-
sectionTopMargin = HEADER_HEIGHT;
|
|
13024
|
+
if (i === 0) {
|
|
13025
|
+
ref.current.style.marginTop = "".concat(HEADER_HEIGHT, "px");
|
|
13026
|
+
incrHeight += HEADER_HEIGHT;
|
|
13044
13027
|
}
|
|
13045
|
-
|
|
13046
|
-
|
|
13047
|
-
|
|
13048
|
-
|
|
13049
|
-
// If it's not the very last section of the document, add the standard row spacing.
|
|
13050
|
-
if (i < keys.length - 1) {
|
|
13051
|
-
totalHeightForThisSection += ROW_SPACING;
|
|
13052
|
-
} else {
|
|
13053
|
-
// For the very last section, add the document-level bottom padding.
|
|
13054
|
-
totalHeightForThisSection += CONTENT_BOTTOM_PADDING;
|
|
13028
|
+
const newHeight = incrHeight + height;
|
|
13029
|
+
if (i === keys.length - 1) {
|
|
13030
|
+
ref.current.style.paddingBottom = '30px';
|
|
13055
13031
|
}
|
|
13056
|
-
|
|
13057
|
-
|
|
13058
|
-
|
|
13059
|
-
if (currentFlowHeight + totalHeightForThisSection > usableContentHeightPerPage) {
|
|
13060
|
-
// This section overflows, so it starts on a new page.
|
|
13032
|
+
if (newHeight > PAGE_HEIGHT - 30 - FOOTER_HEIGHT - HEADER_HEIGHT) {
|
|
13033
|
+
const dif = Math.abs(PAGE_HEIGHT - incrHeight);
|
|
13034
|
+
ref.current.style.marginTop = '30px';
|
|
13061
13035
|
_page += 1;
|
|
13062
13036
|
_pages.push(_page);
|
|
13063
|
-
|
|
13064
|
-
|
|
13065
|
-
|
|
13066
|
-
|
|
13067
|
-
|
|
13068
|
-
|
|
13069
|
-
|
|
13070
|
-
if (i < keys.length - 1) {
|
|
13071
|
-
currentFlowHeight += ROW_SPACING;
|
|
13072
|
-
} else {
|
|
13073
|
-
ref.current.style.paddingBottom = "".concat(CONTENT_BOTTOM_PADDING, "px");
|
|
13074
|
-
currentFlowHeight += CONTENT_BOTTOM_PADDING;
|
|
13037
|
+
if (sectionsConfig[keys[i - 1]]) {
|
|
13038
|
+
const {
|
|
13039
|
+
ref: topRef
|
|
13040
|
+
} = sectionsConfig[keys[i - 1]];
|
|
13041
|
+
topRef.current.style.marginBottom = "".concat(dif + HEADER_HEIGHT - 24, "px");
|
|
13042
|
+
incrHeight = height + 24 + HEADER_HEIGHT;
|
|
13043
|
+
// console.log('margin', dif);
|
|
13075
13044
|
}
|
|
13076
13045
|
} else {
|
|
13077
|
-
|
|
13078
|
-
ref.current.style.marginTop = "".concat(sectionTopMargin, "px");
|
|
13079
|
-
currentFlowHeight += totalHeightForThisSection; // Accumulate the height this section takes
|
|
13080
|
-
|
|
13081
|
-
// Apply special padding for the very last section of the document if it fits on current page
|
|
13082
|
-
if (i === keys.length - 1) {
|
|
13083
|
-
ref.current.style.paddingBottom = "".concat(CONTENT_BOTTOM_PADDING, "px");
|
|
13084
|
-
}
|
|
13046
|
+
incrHeight = newHeight + 24;
|
|
13085
13047
|
}
|
|
13048
|
+
// console.groupEnd();
|
|
13086
13049
|
});
|
|
13087
13050
|
setPages(_pages);
|
|
13088
13051
|
}
|
|
13089
|
-
}, [sectionsConfig
|
|
13052
|
+
}, [sectionsConfig]);
|
|
13090
13053
|
React.useEffect(() => {
|
|
13091
13054
|
doSizing();
|
|
13092
13055
|
}, [doSizing]);
|
|
@@ -13112,6 +13075,16 @@ function PdfView(_ref2) {
|
|
|
13112
13075
|
})
|
|
13113
13076
|
});
|
|
13114
13077
|
}, [config, onChangeHeight]);
|
|
13078
|
+
|
|
13079
|
+
// <div className="daf-analysis">
|
|
13080
|
+
// <Header title={t('Dashboard Title')} />
|
|
13081
|
+
|
|
13082
|
+
// <div className="content">
|
|
13083
|
+
// <div className="view-content">
|
|
13084
|
+
// <div className="daf-analysis-layout">
|
|
13085
|
+
// <div className='sections-cont w-pt'>
|
|
13086
|
+
// <section>
|
|
13087
|
+
|
|
13115
13088
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
13116
13089
|
className: contClassName,
|
|
13117
13090
|
style: {
|
|
@@ -13122,13 +13095,11 @@ function PdfView(_ref2) {
|
|
|
13122
13095
|
style: {
|
|
13123
13096
|
top: (page - 1) * PAGE_HEIGHT,
|
|
13124
13097
|
width: '100%',
|
|
13125
|
-
height: HEADER_HEIGHT,
|
|
13098
|
+
height: HEADER_HEIGHT - 24,
|
|
13126
13099
|
position: 'absolute',
|
|
13127
13100
|
left: 0,
|
|
13128
13101
|
zIndex: 1000000
|
|
13129
|
-
}
|
|
13130
|
-
,
|
|
13131
|
-
|
|
13102
|
+
},
|
|
13132
13103
|
className: "flex-row dashboard-header",
|
|
13133
13104
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
13134
13105
|
className: "flex flex-column justify-center flex-1",
|
|
@@ -13189,6 +13160,15 @@ function PdfView(_ref2) {
|
|
|
13189
13160
|
}))]
|
|
13190
13161
|
});
|
|
13191
13162
|
}
|
|
13163
|
+
PdfView.propTypes = {
|
|
13164
|
+
config: PropTypes__default["default"].array,
|
|
13165
|
+
customClassName: PropTypes__default["default"].any,
|
|
13166
|
+
title: PropTypes__default["default"].string,
|
|
13167
|
+
imgSrc: PropTypes__default["default"].string,
|
|
13168
|
+
userId: PropTypes__default["default"].string,
|
|
13169
|
+
accountId: PropTypes__default["default"].string,
|
|
13170
|
+
documentId: PropTypes__default["default"].string
|
|
13171
|
+
};
|
|
13192
13172
|
|
|
13193
13173
|
const ajaxSelectFieldData = async (value, config, getApiBaseUrl = () => {}, getAppHeader = () => {}, app, formValues = {}) => {
|
|
13194
13174
|
const url = getApiBaseUrl();
|
package/package.json
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
// Dashboard/PdfView/index.jsx
|
|
2
1
|
import moment from "moment";
|
|
3
2
|
import PropTypes from 'prop-types';
|
|
4
3
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
5
4
|
import { formatClassname } from "../../../../../helpers/ClassesHelper";
|
|
6
5
|
|
|
7
6
|
const PAGE_HEIGHT = 1587;
|
|
7
|
+
// margin-top: 20, bottom: 20;
|
|
8
8
|
const FOOTER_HEIGHT = 70;
|
|
9
9
|
const HEADER_HEIGHT = 100;
|
|
10
|
-
const ROW_SPACING = 24; // Spacing between content rows
|
|
11
|
-
const CONTENT_BOTTOM_PADDING = 30; // Extra padding at the very bottom of the last section of the document
|
|
12
10
|
|
|
13
11
|
const Row = ({ widgets, i, onChangeHeight = () => { } }) => {
|
|
14
12
|
const ref = useRef();
|
|
@@ -57,81 +55,49 @@ export default function PdfView({
|
|
|
57
55
|
let _pages = [1];
|
|
58
56
|
let _page = 1;
|
|
59
57
|
|
|
60
|
-
// The total vertical space available for flowing content on each page,
|
|
61
|
-
// considering that HEADER_HEIGHT and FOOTER_HEIGHT are for absolutely positioned elements
|
|
62
|
-
// and content should flow between them.
|
|
63
|
-
const usableContentHeightPerPage = PAGE_HEIGHT - HEADER_HEIGHT - FOOTER_HEIGHT;
|
|
64
|
-
|
|
65
58
|
if (keys.length === config.length) {
|
|
66
|
-
let
|
|
59
|
+
let incrHeight = 0;
|
|
67
60
|
|
|
68
|
-
// Reset all margins/paddings first for a clean slate
|
|
69
61
|
keys.forEach(k => {
|
|
70
62
|
const { ref } = sectionsConfig[k];
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
ref.current.style.paddingBottom = '0px';
|
|
75
|
-
}
|
|
76
|
-
});
|
|
63
|
+
ref.current.style.marginBottom = '0px';
|
|
64
|
+
// ref.current.style.marginTop = '15px';
|
|
65
|
+
})
|
|
77
66
|
|
|
78
67
|
keys.forEach((k, i) => {
|
|
79
68
|
const { height, ref } = sectionsConfig[k];
|
|
80
|
-
if (!ref.current) return; // Skip if ref is not available yet
|
|
81
|
-
|
|
82
|
-
let sectionTopMargin = ROW_SPACING; // Default margin for sections that follow another on the same page
|
|
83
69
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
sectionTopMargin = HEADER_HEIGHT;
|
|
70
|
+
if (i === 0) {
|
|
71
|
+
ref.current.style.marginTop = `${HEADER_HEIGHT}px`;
|
|
72
|
+
incrHeight += HEADER_HEIGHT;
|
|
88
73
|
}
|
|
89
74
|
|
|
90
|
-
|
|
91
|
-
let totalHeightForThisSection = sectionTopMargin + height;
|
|
75
|
+
const newHeight = incrHeight + height;
|
|
92
76
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
totalHeightForThisSection += ROW_SPACING;
|
|
96
|
-
} else {
|
|
97
|
-
// For the very last section, add the document-level bottom padding.
|
|
98
|
-
totalHeightForThisSection += CONTENT_BOTTOM_PADDING;
|
|
77
|
+
if (i === keys.length - 1) {
|
|
78
|
+
ref.current.style.paddingBottom = '30px';
|
|
99
79
|
}
|
|
100
80
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
// This section overflows, so it starts on a new page.
|
|
81
|
+
if (newHeight > PAGE_HEIGHT - 30 - FOOTER_HEIGHT - HEADER_HEIGHT) {
|
|
82
|
+
const dif = Math.abs(PAGE_HEIGHT - incrHeight);
|
|
83
|
+
ref.current.style.marginTop = '30px';
|
|
105
84
|
_page += 1;
|
|
106
85
|
_pages.push(_page);
|
|
107
86
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
// Add row spacing or bottom padding for this section on its new page
|
|
114
|
-
if (i < keys.length - 1) {
|
|
115
|
-
currentFlowHeight += ROW_SPACING;
|
|
116
|
-
} else {
|
|
117
|
-
ref.current.style.paddingBottom = `${CONTENT_BOTTOM_PADDING}px`;
|
|
118
|
-
currentFlowHeight += CONTENT_BOTTOM_PADDING;
|
|
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);
|
|
119
92
|
}
|
|
120
|
-
|
|
121
93
|
} else {
|
|
122
|
-
|
|
123
|
-
ref.current.style.marginTop = `${sectionTopMargin}px`;
|
|
124
|
-
currentFlowHeight += totalHeightForThisSection; // Accumulate the height this section takes
|
|
125
|
-
|
|
126
|
-
// Apply special padding for the very last section of the document if it fits on current page
|
|
127
|
-
if (i === keys.length - 1) {
|
|
128
|
-
ref.current.style.paddingBottom = `${CONTENT_BOTTOM_PADDING}px`;
|
|
129
|
-
}
|
|
94
|
+
incrHeight = newHeight + 24;
|
|
130
95
|
}
|
|
131
|
-
|
|
96
|
+
// console.groupEnd();
|
|
97
|
+
})
|
|
132
98
|
setPages(_pages);
|
|
133
99
|
}
|
|
134
|
-
}, [sectionsConfig
|
|
100
|
+
}, [sectionsConfig]);
|
|
135
101
|
|
|
136
102
|
useEffect(() => {
|
|
137
103
|
doSizing();
|
|
@@ -162,13 +128,22 @@ export default function PdfView({
|
|
|
162
128
|
);
|
|
163
129
|
}, [config, onChangeHeight]);
|
|
164
130
|
|
|
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
|
+
|
|
165
140
|
return (
|
|
166
141
|
<div className={contClassName} style={{ position: 'relative' }}>
|
|
167
142
|
{renderDashboard()}
|
|
168
143
|
{pages.map((page) => (
|
|
169
144
|
<>
|
|
170
145
|
<div
|
|
171
|
-
style={{ top: ((page - 1) * PAGE_HEIGHT), width: '100%', height: HEADER_HEIGHT, position: 'absolute', left: 0, zIndex: 1000000 }}
|
|
146
|
+
style={{ top: ((page - 1) * PAGE_HEIGHT), width: '100%', height: HEADER_HEIGHT - 24, position: 'absolute', left: 0, zIndex: 1000000 }}
|
|
172
147
|
key={`headers-${page}`}
|
|
173
148
|
className="flex-row dashboard-header"
|
|
174
149
|
>
|
|
@@ -219,4 +194,14 @@ export default function PdfView({
|
|
|
219
194
|
))}
|
|
220
195
|
</div>
|
|
221
196
|
);
|
|
222
|
-
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
PdfView.propTypes = {
|
|
200
|
+
config: PropTypes.array,
|
|
201
|
+
customClassName: PropTypes.any,
|
|
202
|
+
title: PropTypes.string,
|
|
203
|
+
imgSrc: PropTypes.string,
|
|
204
|
+
userId: PropTypes.string,
|
|
205
|
+
accountId: PropTypes.string,
|
|
206
|
+
documentId: PropTypes.string,
|
|
207
|
+
}
|