datastake-daf 0.6.449 → 0.6.451

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.
@@ -14536,9 +14536,9 @@ DAFFooter.propTypes = {
14536
14536
  };
14537
14537
 
14538
14538
  const PAGE_HEIGHT = 1587;
14539
+ // margin-top: 20, bottom: 20;
14539
14540
  const FOOTER_HEIGHT = 70;
14540
14541
  const HEADER_HEIGHT = 100;
14541
- const CONTENT_AREA_HEIGHT = PAGE_HEIGHT - HEADER_HEIGHT - FOOTER_HEIGHT;
14542
14542
  const Row = _ref => {
14543
14543
  let {
14544
14544
  widgets,
@@ -14547,7 +14547,7 @@ const Row = _ref => {
14547
14547
  } = _ref;
14548
14548
  const ref = React.useRef();
14549
14549
  const [height, setHeight] = React.useState(0);
14550
- React.useLayoutEffect(() => {
14550
+ React.useEffect(() => {
14551
14551
  const observer = new ResizeObserver(entries => {
14552
14552
  for (const entry of entries) {
14553
14553
  setHeight(entry.contentRect.height);
@@ -14555,7 +14555,7 @@ const Row = _ref => {
14555
14555
  });
14556
14556
  observer.observe(ref.current);
14557
14557
  return () => observer.disconnect();
14558
- }, [ref]);
14558
+ }, []);
14559
14559
  React.useEffect(() => {
14560
14560
  if (height) {
14561
14561
  onChangeHeight(i, {
@@ -14588,64 +14588,50 @@ function PdfView(_ref2) {
14588
14588
  let _pages = [1];
14589
14589
  let _page = 1;
14590
14590
  if (keys.length === config.length) {
14591
- // Reset all margins first
14591
+ let incrHeight = 0;
14592
14592
  keys.forEach(k => {
14593
14593
  const {
14594
14594
  ref
14595
14595
  } = sectionsConfig[k];
14596
14596
  ref.current.style.marginBottom = '0px';
14597
- ref.current.style.marginTop = '0px';
14598
- ref.current.style.pageBreakInside = 'inherit';
14597
+ ref.current.style.breakAfter = 'auto';
14598
+ // ref.current.style.marginTop = '15px';
14599
14599
  });
14600
- let currentPageHeight = 0;
14601
14600
  keys.forEach((k, i) => {
14602
14601
  const {
14603
14602
  height,
14604
14603
  ref
14605
14604
  } = sectionsConfig[k];
14606
- const sectionHeight = height + 24; // Include margin/padding
14607
-
14608
- // First section on first page needs header space
14609
14605
  if (i === 0) {
14610
14606
  ref.current.style.marginTop = "".concat(HEADER_HEIGHT, "px");
14611
- currentPageHeight = sectionHeight;
14612
- return;
14607
+ incrHeight += HEADER_HEIGHT;
14613
14608
  }
14614
-
14615
- // Check if section fits in remaining space of current page
14616
- const remainingSpace = CONTENT_AREA_HEIGHT - currentPageHeight;
14617
- if (sectionHeight > remainingSpace) {
14618
- // Section doesn't fit, move to next page
14619
- const {
14620
- ref: prevRef
14621
- } = sectionsConfig[keys[i - 1]];
14622
-
14623
- // Add margin to previous section to push current section to next page
14624
- prevRef.current.style.marginBottom = "".concat(remainingSpace + FOOTER_HEIGHT, "px");
14625
-
14626
- // Add top margin for new page header
14627
- ref.current.style.marginTop = "".concat(HEADER_HEIGHT, "px");
14628
-
14629
- // Start new page
14609
+ const newHeight = incrHeight + height;
14610
+ if (i === keys.length - 1) {
14611
+ ref.current.style.paddingBottom = '30px';
14612
+ }
14613
+ if (newHeight > PAGE_HEIGHT - 30 - FOOTER_HEIGHT - HEADER_HEIGHT) {
14614
+ const dif = Math.abs(PAGE_HEIGHT - incrHeight);
14615
+ ref.current.style.marginTop = '30px';
14630
14616
  _page += 1;
14631
14617
  _pages.push(_page);
14632
- currentPageHeight = sectionHeight;
14618
+ if (sectionsConfig[keys[i - 1]]) {
14619
+ const {
14620
+ ref: topRef
14621
+ } = sectionsConfig[keys[i - 1]];
14622
+ topRef.current.style.marginBottom = "".concat(dif + HEADER_HEIGHT - 24, "px");
14623
+ incrHeight = height + 24 + HEADER_HEIGHT;
14624
+ // console.log('margin', dif);
14625
+ }
14633
14626
  } else {
14634
- // Section fits, add it to current page
14635
- ref.current.style.marginTop = '24px';
14636
- currentPageHeight += sectionHeight;
14637
- }
14638
-
14639
- // Last section needs bottom margin for footer
14640
- if (i === keys.length - 1) {
14641
- const finalRemainingSpace = CONTENT_AREA_HEIGHT - currentPageHeight;
14642
- ref.current.style.marginBottom = "".concat(finalRemainingSpace + FOOTER_HEIGHT, "px");
14627
+ incrHeight = newHeight + 24;
14643
14628
  }
14629
+ // console.groupEnd();
14644
14630
  });
14645
14631
  setPages(_pages);
14646
14632
  }
14647
14633
  }, [sectionsConfig]);
14648
- React.useLayoutEffect(() => {
14634
+ React.useEffect(() => {
14649
14635
  doSizing();
14650
14636
  }, [doSizing]);
14651
14637
  const onChangeHeight = React.useCallback((index, conf) => {
@@ -14670,18 +14656,27 @@ function PdfView(_ref2) {
14670
14656
  })
14671
14657
  });
14672
14658
  }, [config, onChangeHeight]);
14659
+
14660
+ // <div className="daf-analysis">
14661
+ // <Header title={t('Dashboard Title')} />
14662
+
14663
+ // <div className="content">
14664
+ // <div className="view-content">
14665
+ // <div className="daf-analysis-layout">
14666
+ // <div className='sections-cont w-pt'>
14667
+ // <section>
14668
+
14673
14669
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
14674
14670
  className: contClassName,
14675
14671
  style: {
14676
- position: 'relative',
14677
- minHeight: pages.length * PAGE_HEIGHT
14672
+ position: 'relative'
14678
14673
  },
14679
- children: [renderDashboard(), pages.map(page => /*#__PURE__*/jsxRuntime.jsxs("div", {
14674
+ children: [renderDashboard(), pages.map(page => /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
14680
14675
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
14681
14676
  style: {
14682
14677
  top: (page - 1) * PAGE_HEIGHT,
14683
14678
  width: '100%',
14684
- height: HEADER_HEIGHT,
14679
+ height: HEADER_HEIGHT - 24,
14685
14680
  position: 'absolute',
14686
14681
  left: 0,
14687
14682
  zIndex: 1000000
@@ -14699,7 +14694,7 @@ function PdfView(_ref2) {
14699
14694
  alt: "logo"
14700
14695
  })
14701
14696
  })]
14702
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
14697
+ }, "headers-".concat(page)), /*#__PURE__*/jsxRuntime.jsxs("div", {
14703
14698
  style: {
14704
14699
  top: page * PAGE_HEIGHT - FOOTER_HEIGHT,
14705
14700
  width: '100%',
@@ -14742,8 +14737,8 @@ function PdfView(_ref2) {
14742
14737
  children: page
14743
14738
  })
14744
14739
  })]
14745
- })]
14746
- }, "page-".concat(page)))]
14740
+ }, "footers-".concat(page))]
14741
+ }))]
14747
14742
  });
14748
14743
  }
14749
14744
  PdfView.propTypes = {
@@ -14753,8 +14748,7 @@ PdfView.propTypes = {
14753
14748
  imgSrc: PropTypes__default["default"].string,
14754
14749
  userId: PropTypes__default["default"].string,
14755
14750
  accountId: PropTypes__default["default"].string,
14756
- documentId: PropTypes__default["default"].string,
14757
- downloadId: PropTypes__default["default"].string
14751
+ documentId: PropTypes__default["default"].string
14758
14752
  };
14759
14753
 
14760
14754
  const ajaxSelectFieldData = async (value, config, getApiBaseUrl = () => {}, getAppHeader = () => {}, app, formValues = {}) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.449",
3
+ "version": "0.6.451",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -1,18 +1,18 @@
1
1
  import moment from "moment";
2
2
  import PropTypes from 'prop-types';
3
- import { useCallback, useEffect, useRef, useState, useLayoutEffect } from "react";
3
+ 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;
7
8
  const FOOTER_HEIGHT = 70;
8
9
  const HEADER_HEIGHT = 100;
9
- const CONTENT_AREA_HEIGHT = PAGE_HEIGHT - HEADER_HEIGHT - FOOTER_HEIGHT;
10
10
 
11
11
  const Row = ({ widgets, i, onChangeHeight = () => { } }) => {
12
12
  const ref = useRef();
13
13
  const [height, setHeight] = useState(0);
14
14
 
15
- useLayoutEffect(() => {
15
+ useEffect(() => {
16
16
  const observer = new ResizeObserver((entries) => {
17
17
  for (const entry of entries) {
18
18
  setHeight(entry.contentRect.height);
@@ -22,7 +22,7 @@ const Row = ({ widgets, i, onChangeHeight = () => { } }) => {
22
22
  observer.observe(ref.current);
23
23
 
24
24
  return () => observer.disconnect();
25
- }, [ref]);
25
+ }, []);
26
26
 
27
27
  useEffect(() => {
28
28
  if (height) {
@@ -56,62 +56,51 @@ export default function PdfView({
56
56
  let _page = 1;
57
57
 
58
58
  if (keys.length === config.length) {
59
- // Reset all margins first
59
+ let incrHeight = 0;
60
+
60
61
  keys.forEach(k => {
61
62
  const { ref } = sectionsConfig[k];
62
63
  ref.current.style.marginBottom = '0px';
63
- ref.current.style.marginTop = '0px';
64
- ref.current.style.pageBreakInside = 'inherit';
65
- });
66
-
67
- let currentPageHeight = 0;
64
+ ref.current.style.breakAfter = 'auto';
65
+ // ref.current.style.marginTop = '15px';
66
+ })
68
67
 
69
68
  keys.forEach((k, i) => {
70
69
  const { height, ref } = sectionsConfig[k];
71
- const sectionHeight = height + 24; // Include margin/padding
72
-
73
- // First section on first page needs header space
70
+
74
71
  if (i === 0) {
75
72
  ref.current.style.marginTop = `${HEADER_HEIGHT}px`;
76
- currentPageHeight = sectionHeight;
77
- return;
73
+ incrHeight += HEADER_HEIGHT;
78
74
  }
79
75
 
80
- // Check if section fits in remaining space of current page
81
- const remainingSpace = CONTENT_AREA_HEIGHT - currentPageHeight;
82
-
83
- if (sectionHeight > remainingSpace) {
84
- // Section doesn't fit, move to next page
85
- const { ref: prevRef } = sectionsConfig[keys[i - 1]];
86
-
87
- // Add margin to previous section to push current section to next page
88
- prevRef.current.style.marginBottom = `${remainingSpace + FOOTER_HEIGHT}px`;
89
-
90
- // Add top margin for new page header
91
- ref.current.style.marginTop = `${HEADER_HEIGHT}px`;
92
-
93
- // Start new page
94
- _page += 1;
95
- _pages.push(_page);
96
- currentPageHeight = sectionHeight;
97
- } else {
98
- // Section fits, add it to current page
99
- ref.current.style.marginTop = '24px';
100
- currentPageHeight += sectionHeight;
101
- }
76
+ const newHeight = incrHeight + height;
102
77
 
103
- // Last section needs bottom margin for footer
104
78
  if (i === keys.length - 1) {
105
- const finalRemainingSpace = CONTENT_AREA_HEIGHT - currentPageHeight;
106
- ref.current.style.marginBottom = `${finalRemainingSpace + FOOTER_HEIGHT}px`;
79
+ ref.current.style.paddingBottom = '30px';
107
80
  }
108
- });
109
81
 
82
+ if (newHeight > PAGE_HEIGHT - 30 - FOOTER_HEIGHT - HEADER_HEIGHT) {
83
+ const dif = Math.abs(PAGE_HEIGHT - incrHeight);
84
+ ref.current.style.marginTop = '30px';
85
+ _page += 1;
86
+ _pages.push(_page);
87
+
88
+ if (sectionsConfig[keys[i - 1]]) {
89
+ const { ref: topRef } = sectionsConfig[keys[i - 1]];
90
+ topRef.current.style.marginBottom = `${dif + HEADER_HEIGHT - 24}px`;
91
+ incrHeight = height + 24 + HEADER_HEIGHT;
92
+ // console.log('margin', dif);
93
+ }
94
+ } else {
95
+ incrHeight = newHeight + 24;
96
+ }
97
+ // console.groupEnd();
98
+ })
110
99
  setPages(_pages);
111
100
  }
112
101
  }, [sectionsConfig]);
113
102
 
114
- useLayoutEffect(() => {
103
+ useEffect(() => {
115
104
  doSizing();
116
105
  }, [doSizing]);
117
106
 
@@ -140,20 +129,23 @@ export default function PdfView({
140
129
  );
141
130
  }, [config, onChangeHeight]);
142
131
 
132
+ // <div className="daf-analysis">
133
+ // <Header title={t('Dashboard Title')} />
134
+
135
+ // <div className="content">
136
+ // <div className="view-content">
137
+ // <div className="daf-analysis-layout">
138
+ // <div className='sections-cont w-pt'>
139
+ // <section>
140
+
143
141
  return (
144
- <div className={contClassName} style={{ position: 'relative', minHeight: pages.length * PAGE_HEIGHT }}>
142
+ <div className={contClassName} style={{ position: 'relative' }}>
145
143
  {renderDashboard()}
146
144
  {pages.map((page) => (
147
- <div key={`page-${page}`}>
145
+ <>
148
146
  <div
149
- style={{
150
- top: ((page - 1) * PAGE_HEIGHT),
151
- width: '100%',
152
- height: HEADER_HEIGHT,
153
- position: 'absolute',
154
- left: 0,
155
- zIndex: 1000000
156
- }}
147
+ style={{ top: ((page - 1) * PAGE_HEIGHT), width: '100%', height: HEADER_HEIGHT - 24, position: 'absolute', left: 0, zIndex: 1000000 }}
148
+ key={`headers-${page}`}
157
149
  className="flex-row dashboard-header"
158
150
  >
159
151
  <div className="flex flex-column justify-center flex-1">
@@ -164,14 +156,8 @@ export default function PdfView({
164
156
  </div>
165
157
  </div>
166
158
  <div
167
- style={{
168
- top: (page * PAGE_HEIGHT) - FOOTER_HEIGHT,
169
- width: '100%',
170
- height: FOOTER_HEIGHT,
171
- position: 'absolute',
172
- left: 0,
173
- zIndex: 1000000
174
- }}
159
+ style={{ top: (page * PAGE_HEIGHT) - FOOTER_HEIGHT, width: '100%', height: FOOTER_HEIGHT, position: 'absolute', left: 0, zIndex: 1000000 }}
160
+ key={`footers-${page}`}
175
161
  className="dashboard-footer flex-row"
176
162
  >
177
163
  <div className="flex flex-column justify-center">
@@ -205,7 +191,7 @@ export default function PdfView({
205
191
  <h5>{page}</h5>
206
192
  </div>
207
193
  </div>
208
- </div>
194
+ </>
209
195
  ))}
210
196
  </div>
211
197
  );
@@ -219,5 +205,4 @@ PdfView.propTypes = {
219
205
  userId: PropTypes.string,
220
206
  accountId: PropTypes.string,
221
207
  documentId: PropTypes.string,
222
- downloadId: PropTypes.string,
223
- }
208
+ }