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