datastake-daf 0.6.413 → 0.6.414

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.
@@ -13276,16 +13276,9 @@ DAFFooter.propTypes = {
13276
13276
  };
13277
13277
 
13278
13278
  const PAGE_HEIGHT = 1587;
13279
+ // margin-top: 20, bottom: 20;
13279
13280
  const FOOTER_HEIGHT = 70;
13280
13281
  const HEADER_HEIGHT = 100;
13281
- const SECTION_SPACING = 24; // Space between sections
13282
- const FIRST_PAGE_TOP_PADDING = 30; // Padding after header on first page
13283
- const NEW_PAGE_TOP_PADDING = 30; // Padding after header on new pages
13284
- const LAST_SECTION_BOTTOM_PADDING = 30; // Padding after last section
13285
- const PAGE_BOTTOM_MARGIN = 30; // Safety margin before footer
13286
-
13287
- // Available content height per page (excluding header, footer, and safety margins)
13288
- const AVAILABLE_HEIGHT = PAGE_HEIGHT - HEADER_HEIGHT - FOOTER_HEIGHT - PAGE_BOTTOM_MARGIN;
13289
13282
  const Row = _ref => {
13290
13283
  let {
13291
13284
  widgets,
@@ -13310,7 +13303,7 @@ const Row = _ref => {
13310
13303
  ref
13311
13304
  });
13312
13305
  }
13313
- }, [height, i, onChangeHeight]);
13306
+ }, [height]);
13314
13307
  return /*#__PURE__*/jsxRuntime.jsx("section", {
13315
13308
  ref: ref,
13316
13309
  style: widgets.style,
@@ -13332,75 +13325,51 @@ function PdfView(_ref2) {
13332
13325
  const [pages, setPages] = React.useState([1]);
13333
13326
  const doSizing = React.useCallback(() => {
13334
13327
  const keys = Object.keys(sectionsConfig);
13335
-
13336
- // Wait until all sections have been measured
13337
- if (keys.length !== config.length) return;
13338
13328
  let _pages = [1];
13339
- let currentPage = 1;
13340
- let currentPageContentHeight = 0; // Tracks content height on current page (excluding header)
13341
-
13342
- // Reset all styles first
13343
- keys.forEach(k => {
13344
- const {
13345
- ref
13346
- } = sectionsConfig[k];
13347
- ref.current.style.marginTop = '0px';
13348
- ref.current.style.marginBottom = '0px';
13349
- ref.current.style.paddingBottom = '0px';
13350
- });
13351
- keys.forEach((k, i) => {
13352
- const {
13353
- height,
13354
- ref
13355
- } = sectionsConfig[k];
13356
- const isFirstSection = i === 0;
13357
- const isLastSection = i === keys.length - 1;
13358
- const isFirstSectionOnPage = currentPageContentHeight === 0;
13359
-
13360
- // For first section of entire document
13361
- if (isFirstSection) {
13362
- ref.current.style.marginTop = "".concat(HEADER_HEIGHT + FIRST_PAGE_TOP_PADDING, "px");
13363
- currentPageContentHeight = height + FIRST_PAGE_TOP_PADDING;
13364
- if (isLastSection) {
13365
- ref.current.style.paddingBottom = "".concat(LAST_SECTION_BOTTOM_PADDING, "px");
13366
- currentPageContentHeight += LAST_SECTION_BOTTOM_PADDING;
13329
+ let _page = 1;
13330
+ if (keys.length === config.length) {
13331
+ let incrHeight = 0;
13332
+ keys.forEach(k => {
13333
+ const {
13334
+ ref
13335
+ } = sectionsConfig[k];
13336
+ ref.current.style.marginBottom = '0px';
13337
+ // ref.current.style.marginTop = '15px';
13338
+ });
13339
+ keys.forEach((k, i) => {
13340
+ const {
13341
+ height,
13342
+ ref
13343
+ } = sectionsConfig[k];
13344
+ if (i === 0) {
13345
+ ref.current.style.marginTop = "".concat(HEADER_HEIGHT, "px");
13346
+ incrHeight += HEADER_HEIGHT;
13347
+ }
13348
+ const newHeight = incrHeight + height;
13349
+ if (i === keys.length - 1) {
13350
+ ref.current.style.paddingBottom = '30px';
13351
+ }
13352
+ if (newHeight > PAGE_HEIGHT - 30 - FOOTER_HEIGHT - HEADER_HEIGHT) {
13353
+ const dif = Math.abs(PAGE_HEIGHT - incrHeight);
13354
+ ref.current.style.marginTop = '30px';
13355
+ _page += 1;
13356
+ _pages.push(_page);
13357
+ if (sectionsConfig[keys[i - 1]]) {
13358
+ const {
13359
+ ref: topRef
13360
+ } = sectionsConfig[keys[i - 1]];
13361
+ topRef.current.style.marginBottom = "".concat(dif + HEADER_HEIGHT - 24, "px");
13362
+ incrHeight = height + 24 + HEADER_HEIGHT;
13363
+ // console.log('margin', dif);
13364
+ }
13365
+ } else {
13366
+ incrHeight = newHeight + 24;
13367
13367
  }
13368
- return;
13369
- }
13370
-
13371
- // Calculate space needed for this section including spacing before it
13372
- const spacingBefore = isFirstSectionOnPage ? NEW_PAGE_TOP_PADDING : SECTION_SPACING;
13373
- const bottomPadding = isLastSection ? LAST_SECTION_BOTTOM_PADDING : 0;
13374
- const totalSpaceNeeded = spacingBefore + height + bottomPadding;
13375
-
13376
- // Check if we need to move to next page
13377
- if (currentPageContentHeight + totalSpaceNeeded > AVAILABLE_HEIGHT) {
13378
- // Move to new page
13379
- currentPage += 1;
13380
- _pages.push(currentPage);
13381
-
13382
- // Calculate and apply bottom margin to fill previous page
13383
- const usedSpace = currentPageContentHeight;
13384
- const remainingSpace = AVAILABLE_HEIGHT - usedSpace;
13385
- const previousKey = keys[i - 1];
13386
- sectionsConfig[previousKey].ref.current.style.marginBottom = "".concat(remainingSpace + PAGE_BOTTOM_MARGIN, "px");
13387
-
13388
- // This section starts the new page
13389
- ref.current.style.marginTop = "".concat(HEADER_HEIGHT + NEW_PAGE_TOP_PADDING, "px");
13390
- currentPageContentHeight = height + NEW_PAGE_TOP_PADDING + bottomPadding;
13391
- } else {
13392
- // Section fits on current page
13393
- ref.current.style.marginTop = "".concat(spacingBefore, "px");
13394
- currentPageContentHeight += totalSpaceNeeded;
13395
- }
13396
-
13397
- // Add bottom padding to last section
13398
- if (isLastSection) {
13399
- ref.current.style.paddingBottom = "".concat(LAST_SECTION_BOTTOM_PADDING, "px");
13400
- }
13401
- });
13402
- setPages(_pages);
13403
- }, [sectionsConfig, config.length]);
13368
+ // console.groupEnd();
13369
+ });
13370
+ setPages(_pages);
13371
+ }
13372
+ }, [sectionsConfig]);
13404
13373
  React.useEffect(() => {
13405
13374
  doSizing();
13406
13375
  }, [doSizing]);
@@ -13421,22 +13390,32 @@ function PdfView(_ref2) {
13421
13390
  widgets: widgets,
13422
13391
  i: i,
13423
13392
  onChangeHeight: onChangeHeight
13424
- }, "dashboard-sections-".concat(i + 1)))
13393
+ }, "dashboard-sections=".concat(i + 1)))
13425
13394
  })
13426
13395
  })
13427
13396
  });
13428
13397
  }, [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
+
13429
13408
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
13430
13409
  className: contClassName,
13431
13410
  style: {
13432
13411
  position: 'relative'
13433
13412
  },
13434
- children: [renderDashboard(), pages.map(page => /*#__PURE__*/jsxRuntime.jsxs("div", {
13413
+ children: [renderDashboard(), pages.map(page => /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
13435
13414
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
13436
13415
  style: {
13437
13416
  top: (page - 1) * PAGE_HEIGHT,
13438
13417
  width: '100%',
13439
- height: HEADER_HEIGHT,
13418
+ height: HEADER_HEIGHT - 24,
13440
13419
  position: 'absolute',
13441
13420
  left: 0,
13442
13421
  zIndex: 1000000
@@ -13454,7 +13433,7 @@ function PdfView(_ref2) {
13454
13433
  alt: "logo"
13455
13434
  })
13456
13435
  })]
13457
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
13436
+ }, "headers-".concat(page)), /*#__PURE__*/jsxRuntime.jsxs("div", {
13458
13437
  style: {
13459
13438
  top: page * PAGE_HEIGHT - FOOTER_HEIGHT,
13460
13439
  width: '100%',
@@ -13497,8 +13476,8 @@ function PdfView(_ref2) {
13497
13476
  children: page
13498
13477
  })
13499
13478
  })]
13500
- })]
13501
- }, "page-".concat(page)))]
13479
+ }, "footers-".concat(page))]
13480
+ }))]
13502
13481
  });
13503
13482
  }
13504
13483
  PdfView.propTypes = {
@@ -13508,8 +13487,7 @@ PdfView.propTypes = {
13508
13487
  imgSrc: PropTypes__default["default"].string,
13509
13488
  userId: PropTypes__default["default"].string,
13510
13489
  accountId: PropTypes__default["default"].string,
13511
- documentId: PropTypes__default["default"].string,
13512
- downloadId: PropTypes__default["default"].string
13490
+ documentId: PropTypes__default["default"].string
13513
13491
  };
13514
13492
 
13515
13493
  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.413",
3
+ "version": "0.6.414",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -4,16 +4,9 @@ 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 SECTION_SPACING = 24; // Space between sections
10
- const FIRST_PAGE_TOP_PADDING = 30; // Padding after header on first page
11
- const NEW_PAGE_TOP_PADDING = 30; // Padding after header on new pages
12
- const LAST_SECTION_BOTTOM_PADDING = 30; // Padding after last section
13
- const PAGE_BOTTOM_MARGIN = 30; // Safety margin before footer
14
-
15
- // Available content height per page (excluding header, footer, and safety margins)
16
- const AVAILABLE_HEIGHT = PAGE_HEIGHT - HEADER_HEIGHT - FOOTER_HEIGHT - PAGE_BOTTOM_MARGIN;
17
10
 
18
11
  const Row = ({ widgets, i, onChangeHeight = () => { } }) => {
19
12
  const ref = useRef();
@@ -35,7 +28,7 @@ const Row = ({ widgets, i, onChangeHeight = () => { } }) => {
35
28
  if (height) {
36
29
  onChangeHeight(i, { height, ref });
37
30
  }
38
- }, [height, i, onChangeHeight])
31
+ }, [height])
39
32
 
40
33
  return (
41
34
  <section ref={ref} style={widgets.style}>
@@ -59,74 +52,52 @@ export default function PdfView({
59
52
 
60
53
  const doSizing = useCallback(() => {
61
54
  const keys = Object.keys(sectionsConfig);
62
-
63
- // Wait until all sections have been measured
64
- if (keys.length !== config.length) return;
65
-
66
55
  let _pages = [1];
67
- let currentPage = 1;
68
- let currentPageContentHeight = 0; // Tracks content height on current page (excluding header)
69
-
70
- // Reset all styles first
71
- keys.forEach(k => {
72
- const { ref } = sectionsConfig[k];
73
- ref.current.style.marginTop = '0px';
74
- ref.current.style.marginBottom = '0px';
75
- ref.current.style.paddingBottom = '0px';
76
- });
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
+ })
77
66
 
78
- keys.forEach((k, i) => {
79
- const { height, ref } = sectionsConfig[k];
80
- const isFirstSection = i === 0;
81
- const isLastSection = i === keys.length - 1;
82
- const isFirstSectionOnPage = currentPageContentHeight === 0;
83
-
84
- // For first section of entire document
85
- if (isFirstSection) {
86
- ref.current.style.marginTop = `${HEADER_HEIGHT + FIRST_PAGE_TOP_PADDING}px`;
87
- currentPageContentHeight = height + FIRST_PAGE_TOP_PADDING;
88
-
89
- if (isLastSection) {
90
- ref.current.style.paddingBottom = `${LAST_SECTION_BOTTOM_PADDING}px`;
91
- currentPageContentHeight += LAST_SECTION_BOTTOM_PADDING;
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;
92
73
  }
93
- return;
94
- }
95
74
 
96
- // Calculate space needed for this section including spacing before it
97
- const spacingBefore = isFirstSectionOnPage ? NEW_PAGE_TOP_PADDING : SECTION_SPACING;
98
- const bottomPadding = isLastSection ? LAST_SECTION_BOTTOM_PADDING : 0;
99
- const totalSpaceNeeded = spacingBefore + height + bottomPadding;
100
-
101
- // Check if we need to move to next page
102
- if (currentPageContentHeight + totalSpaceNeeded > AVAILABLE_HEIGHT) {
103
- // Move to new page
104
- currentPage += 1;
105
- _pages.push(currentPage);
106
-
107
- // Calculate and apply bottom margin to fill previous page
108
- const usedSpace = currentPageContentHeight;
109
- const remainingSpace = AVAILABLE_HEIGHT - usedSpace;
110
- const previousKey = keys[i - 1];
111
- sectionsConfig[previousKey].ref.current.style.marginBottom = `${remainingSpace + PAGE_BOTTOM_MARGIN}px`;
112
-
113
- // This section starts the new page
114
- ref.current.style.marginTop = `${HEADER_HEIGHT + NEW_PAGE_TOP_PADDING}px`;
115
- currentPageContentHeight = height + NEW_PAGE_TOP_PADDING + bottomPadding;
116
- } else {
117
- // Section fits on current page
118
- ref.current.style.marginTop = `${spacingBefore}px`;
119
- currentPageContentHeight += totalSpaceNeeded;
120
- }
75
+ const newHeight = incrHeight + height;
121
76
 
122
- // Add bottom padding to last section
123
- if (isLastSection) {
124
- ref.current.style.paddingBottom = `${LAST_SECTION_BOTTOM_PADDING}px`;
125
- }
126
- });
77
+ if (i === keys.length - 1) {
78
+ ref.current.style.paddingBottom = '30px';
79
+ }
127
80
 
128
- setPages(_pages);
129
- }, [sectionsConfig, config.length]);
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]);
130
101
 
131
102
  useEffect(() => {
132
103
  doSizing();
@@ -146,7 +117,7 @@ export default function PdfView({
146
117
  {config.map((widgets, i) => (
147
118
  <Row
148
119
  widgets={widgets}
149
- key={`dashboard-sections-${i + 1}`}
120
+ key={`dashboard-sections=${i + 1}`}
150
121
  i={i}
151
122
  onChangeHeight={onChangeHeight}
152
123
  />
@@ -157,20 +128,23 @@ export default function PdfView({
157
128
  );
158
129
  }, [config, onChangeHeight]);
159
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
+
160
140
  return (
161
141
  <div className={contClassName} style={{ position: 'relative' }}>
162
142
  {renderDashboard()}
163
143
  {pages.map((page) => (
164
- <div key={`page-${page}`}>
144
+ <>
165
145
  <div
166
- style={{
167
- top: ((page - 1) * PAGE_HEIGHT),
168
- width: '100%',
169
- height: HEADER_HEIGHT,
170
- position: 'absolute',
171
- left: 0,
172
- zIndex: 1000000
173
- }}
146
+ style={{ top: ((page - 1) * PAGE_HEIGHT), width: '100%', height: HEADER_HEIGHT - 24, position: 'absolute', left: 0, zIndex: 1000000 }}
147
+ key={`headers-${page}`}
174
148
  className="flex-row dashboard-header"
175
149
  >
176
150
  <div className="flex flex-column justify-center flex-1">
@@ -181,14 +155,8 @@ export default function PdfView({
181
155
  </div>
182
156
  </div>
183
157
  <div
184
- style={{
185
- top: (page * PAGE_HEIGHT) - FOOTER_HEIGHT,
186
- width: '100%',
187
- height: FOOTER_HEIGHT,
188
- position: 'absolute',
189
- left: 0,
190
- zIndex: 1000000
191
- }}
158
+ style={{ top: (page * PAGE_HEIGHT) - FOOTER_HEIGHT, width: '100%', height: FOOTER_HEIGHT, position: 'absolute', left: 0, zIndex: 1000000 }}
159
+ key={`footers-${page}`}
192
160
  className="dashboard-footer flex-row"
193
161
  >
194
162
  <div className="flex flex-column justify-center">
@@ -222,7 +190,7 @@ export default function PdfView({
222
190
  <h5>{page}</h5>
223
191
  </div>
224
192
  </div>
225
- </div>
193
+ </>
226
194
  ))}
227
195
  </div>
228
196
  );
@@ -236,5 +204,4 @@ PdfView.propTypes = {
236
204
  userId: PropTypes.string,
237
205
  accountId: PropTypes.string,
238
206
  documentId: PropTypes.string,
239
- downloadId: PropTypes.string,
240
- }
207
+ }