datastake-daf 0.6.433 → 0.6.435
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 +1754 -508
- package/dist/utils/index.js +1657 -424
- package/package.json +1 -1
- package/src/@daf/core/components/Dashboard/PdfView/index.jsx +97 -95
- package/src/@daf/core/components/Icon/configs/ArcGis.js +320 -0
- package/src/@daf/core/components/Icon/configs/index.js +2 -0
package/package.json
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import moment from "moment";
|
|
2
|
-
import PropTypes from
|
|
2
|
+
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 = 1587;
|
|
6
|
+
const PAGE_HEIGHT = 1587;
|
|
7
|
+
// margin-top: 20, bottom: 20;
|
|
7
8
|
const FOOTER_HEIGHT = 70;
|
|
8
9
|
const HEADER_HEIGHT = 100;
|
|
9
|
-
const GAP = 24; // space between rows
|
|
10
10
|
|
|
11
|
-
const Row = ({ widgets, i, onChangeHeight = () => {} }) => {
|
|
11
|
+
const Row = ({ widgets, i, onChangeHeight = () => { } }) => {
|
|
12
12
|
const ref = useRef();
|
|
13
13
|
const [height, setHeight] = useState(0);
|
|
14
14
|
|
|
15
15
|
useEffect(() => {
|
|
16
16
|
const observer = new ResizeObserver((entries) => {
|
|
17
17
|
for (const entry of entries) {
|
|
18
|
-
setHeight(entry.contentRect.height);
|
|
18
|
+
setHeight(entry.contentRect.height * 0.8);
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
observer.observe(ref.current);
|
|
23
|
+
|
|
23
24
|
return () => observer.disconnect();
|
|
24
25
|
}, []);
|
|
25
26
|
|
|
@@ -27,95 +28,96 @@ const Row = ({ widgets, i, onChangeHeight = () => {} }) => {
|
|
|
27
28
|
if (height) {
|
|
28
29
|
onChangeHeight(i, { height, ref });
|
|
29
30
|
}
|
|
30
|
-
}, [height])
|
|
31
|
+
}, [height])
|
|
31
32
|
|
|
32
33
|
return (
|
|
33
34
|
<section ref={ref} style={widgets.style}>
|
|
34
|
-
{typeof widgets.render ===
|
|
35
|
+
{typeof widgets.render === 'function' ? widgets.render() : null}
|
|
35
36
|
</section>
|
|
36
|
-
)
|
|
37
|
+
)
|
|
37
38
|
};
|
|
38
39
|
|
|
39
40
|
export default function PdfView({
|
|
40
41
|
config = [],
|
|
41
42
|
customClassName,
|
|
42
|
-
title =
|
|
43
|
-
imgSrc =
|
|
44
|
-
userId =
|
|
45
|
-
accountId =
|
|
46
|
-
documentId =
|
|
47
|
-
downloadId =
|
|
43
|
+
title = 'Title',
|
|
44
|
+
imgSrc = '',
|
|
45
|
+
userId = 'IDD-0000000',
|
|
46
|
+
accountId = 'IDD-0000000',
|
|
47
|
+
documentId = 'IDD-0000000',
|
|
48
|
+
downloadId = 'DWL-00000123',
|
|
48
49
|
}) {
|
|
49
50
|
const [sectionsConfig, setSectionsConfig] = useState({});
|
|
50
51
|
const [pages, setPages] = useState([1]);
|
|
51
52
|
|
|
52
|
-
const onChangeHeight = useCallback((index, conf) => {
|
|
53
|
-
setSectionsConfig((prev) => ({ ...prev, [index]: conf }));
|
|
54
|
-
}, []);
|
|
55
|
-
|
|
56
53
|
const doSizing = useCallback(() => {
|
|
57
54
|
const keys = Object.keys(sectionsConfig);
|
|
58
|
-
if (keys.length !== config.length) return;
|
|
59
|
-
|
|
60
55
|
let _pages = [1];
|
|
61
|
-
let
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
56
|
+
let _page = 1;
|
|
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];
|
|
69
|
+
|
|
70
|
+
if (i === 0) {
|
|
71
|
+
ref.current.style.marginTop = `${HEADER_HEIGHT}px`;
|
|
72
|
+
incrHeight += HEADER_HEIGHT;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const newHeight = incrHeight + height;
|
|
76
|
+
|
|
77
|
+
if (i === keys.length - 1) {
|
|
78
|
+
ref.current.style.paddingBottom = '30px';
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (newHeight > PAGE_HEIGHT - 30 - FOOTER_HEIGHT - HEADER_HEIGHT) {
|
|
82
|
+
const dif = Math.abs(PAGE_HEIGHT - incrHeight);
|
|
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]);
|
|
100
101
|
|
|
101
102
|
useEffect(() => {
|
|
102
103
|
doSizing();
|
|
103
104
|
}, [doSizing]);
|
|
104
105
|
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
const onChangeHeight = useCallback((index, conf) => {
|
|
107
|
+
setSectionsConfig((prev) => ({ ...prev, [index]: conf }))
|
|
108
|
+
}, []);
|
|
109
|
+
|
|
110
|
+
const contClassName = formatClassname(['daf-analysis daf-pdf-view', customClassName]);
|
|
109
111
|
|
|
110
112
|
const renderDashboard = useCallback(() => {
|
|
111
113
|
return (
|
|
112
114
|
<div className="view-content">
|
|
113
115
|
<div className="daf-analysis-layout">
|
|
114
|
-
<div className=
|
|
116
|
+
<div className='sections-cont'>
|
|
115
117
|
{config.map((widgets, i) => (
|
|
116
118
|
<Row
|
|
117
119
|
widgets={widgets}
|
|
118
|
-
key={`dashboard-
|
|
120
|
+
key={`dashboard-sections=${i + 1}`}
|
|
119
121
|
i={i}
|
|
120
122
|
onChangeHeight={onChangeHeight}
|
|
121
123
|
/>
|
|
@@ -126,22 +128,23 @@ export default function PdfView({
|
|
|
126
128
|
);
|
|
127
129
|
}, [config, onChangeHeight]);
|
|
128
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
|
+
|
|
129
140
|
return (
|
|
130
|
-
<div className={contClassName} style={{ position:
|
|
141
|
+
<div className={contClassName} style={{ position: 'relative' }}>
|
|
131
142
|
{renderDashboard()}
|
|
132
|
-
|
|
133
143
|
{pages.map((page) => (
|
|
134
|
-
|
|
135
|
-
{/* HEADER */}
|
|
144
|
+
<>
|
|
136
145
|
<div
|
|
137
|
-
style={{
|
|
138
|
-
|
|
139
|
-
width: "100%",
|
|
140
|
-
height: HEADER_HEIGHT,
|
|
141
|
-
position: "absolute",
|
|
142
|
-
left: 0,
|
|
143
|
-
zIndex: 1000000,
|
|
144
|
-
}}
|
|
146
|
+
style={{ top: ((page - 1) * PAGE_HEIGHT), width: '100%', height: HEADER_HEIGHT - 24, position: 'absolute', left: 0, zIndex: 1000000 }}
|
|
147
|
+
key={`headers-${page}`}
|
|
145
148
|
className="flex-row dashboard-header"
|
|
146
149
|
>
|
|
147
150
|
<div className="flex flex-column justify-center flex-1">
|
|
@@ -151,35 +154,35 @@ export default function PdfView({
|
|
|
151
154
|
<img src={imgSrc} alt="logo" />
|
|
152
155
|
</div>
|
|
153
156
|
</div>
|
|
154
|
-
|
|
155
|
-
{/* FOOTER */}
|
|
156
157
|
<div
|
|
157
|
-
style={{
|
|
158
|
-
|
|
159
|
-
width: "100%",
|
|
160
|
-
height: FOOTER_HEIGHT,
|
|
161
|
-
position: "absolute",
|
|
162
|
-
left: 0,
|
|
163
|
-
zIndex: 1000000,
|
|
164
|
-
}}
|
|
158
|
+
style={{ top: (page * PAGE_HEIGHT) - FOOTER_HEIGHT, width: '100%', height: FOOTER_HEIGHT, position: 'absolute', left: 0, zIndex: 1000000 }}
|
|
159
|
+
key={`footers-${page}`}
|
|
165
160
|
className="dashboard-footer flex-row"
|
|
166
161
|
>
|
|
167
162
|
<div className="flex flex-column justify-center">
|
|
168
|
-
<h5>{moment().format(
|
|
163
|
+
<h5>{moment().format('DD MMM YYYY')}</h5>
|
|
169
164
|
</div>
|
|
170
165
|
<div className="flex flex-column justify-center">
|
|
171
166
|
<div className="flex gap-2">
|
|
172
167
|
<h5>
|
|
173
|
-
User ID:
|
|
168
|
+
User ID:
|
|
169
|
+
{' '}
|
|
170
|
+
<strong>{userId}</strong>
|
|
174
171
|
</h5>
|
|
175
172
|
<h5>
|
|
176
|
-
Account ID:
|
|
173
|
+
Account ID:
|
|
174
|
+
{' '}
|
|
175
|
+
<strong>{accountId}</strong>
|
|
177
176
|
</h5>
|
|
178
177
|
<h5>
|
|
179
|
-
Document ID:
|
|
178
|
+
Document ID:
|
|
179
|
+
{' '}
|
|
180
|
+
<strong>{documentId}</strong>
|
|
180
181
|
</h5>
|
|
181
182
|
<h5>
|
|
182
|
-
Download ID:
|
|
183
|
+
Download ID:
|
|
184
|
+
{' '}
|
|
185
|
+
<strong>{downloadId}</strong>
|
|
183
186
|
</h5>
|
|
184
187
|
</div>
|
|
185
188
|
</div>
|
|
@@ -187,7 +190,7 @@ export default function PdfView({
|
|
|
187
190
|
<h5>{page}</h5>
|
|
188
191
|
</div>
|
|
189
192
|
</div>
|
|
190
|
-
|
|
193
|
+
</>
|
|
191
194
|
))}
|
|
192
195
|
</div>
|
|
193
196
|
);
|
|
@@ -201,5 +204,4 @@ PdfView.propTypes = {
|
|
|
201
204
|
userId: PropTypes.string,
|
|
202
205
|
accountId: PropTypes.string,
|
|
203
206
|
documentId: PropTypes.string,
|
|
204
|
-
|
|
205
|
-
};
|
|
207
|
+
}
|