@redsift/dashboard 11.5.0 → 11.6.0-alpha.0
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/_internal/ChartEmptyState.js +2 -0
- package/_internal/ChartEmptyState.js.map +1 -0
- package/_internal/ChartEmptyState2.js +154 -0
- package/_internal/ChartEmptyState2.js.map +1 -0
- package/_internal/CrossfilterRegistry.js +2 -0
- package/_internal/CrossfilterRegistry.js.map +1 -0
- package/_internal/CrossfilterRegistry2.js +23 -0
- package/_internal/CrossfilterRegistry2.js.map +1 -0
- package/_internal/Dashboard.js +4 -0
- package/_internal/Dashboard.js.map +1 -0
- package/_internal/Dashboard2.js +101 -0
- package/_internal/Dashboard2.js.map +1 -0
- package/_internal/PdfExportButton.js +2 -0
- package/_internal/PdfExportButton.js.map +1 -0
- package/_internal/PdfExportButton2.js +417 -0
- package/_internal/PdfExportButton2.js.map +1 -0
- package/_internal/TimeSeriesBarChart.js +2 -0
- package/_internal/TimeSeriesBarChart.js.map +1 -0
- package/_internal/TimeSeriesBarChart2.js +474 -0
- package/_internal/TimeSeriesBarChart2.js.map +1 -0
- package/_internal/WithFilters.js +2 -0
- package/_internal/WithFilters.js.map +1 -0
- package/_internal/WithFilters2.js +701 -0
- package/_internal/WithFilters2.js.map +1 -0
- package/_internal/context.js +102 -0
- package/_internal/context.js.map +1 -0
- package/_internal/types.js +23 -0
- package/_internal/types.js.map +1 -0
- package/index.js +8 -1949
- package/index.js.map +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
import { a as _objectWithoutProperties, D as DashboardContext, b as _extends } from './context.js';
|
|
2
|
+
import React, { forwardRef, useState, useContext, useEffect } from 'react';
|
|
3
|
+
import { gridFilteredSortedRowEntriesSelector, gridVisibleColumnDefinitionsSelector, gridColumnsTotalWidthSelector } from '@mui/x-data-grid-pro';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import { saveAs } from 'file-saver';
|
|
6
|
+
import { Font, StyleSheet, Document, Page, View, Image, Text, pdf } from '@react-pdf/renderer';
|
|
7
|
+
import domToImage from 'dom-to-image';
|
|
8
|
+
import { Button, Spinner, RedsiftColorBlueD1 } from '@redsift/design-system';
|
|
9
|
+
|
|
10
|
+
// istanbul ignore file
|
|
11
|
+
const BACKGROUND_COLOR = '#F8F8F8';
|
|
12
|
+
const GREY_1 = '#E2E6EA';
|
|
13
|
+
const GREY_2 = '#bff0fd';
|
|
14
|
+
const getPdfStyles = primaryColor => {
|
|
15
|
+
Font.register({
|
|
16
|
+
family: 'Source Code Pro',
|
|
17
|
+
fonts: [{
|
|
18
|
+
src: 'https://fonts.gstatic.com/s/sourcecodepro/v7/HI_SiYsKILxRpg3hIP6sJ7fM7PqlM-vT.ttf'
|
|
19
|
+
}]
|
|
20
|
+
});
|
|
21
|
+
Font.register({
|
|
22
|
+
family: 'Roboto',
|
|
23
|
+
fonts: [{
|
|
24
|
+
fontWeight: 700,
|
|
25
|
+
src: 'https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.0/fonts/roboto/Roboto-Regular.ttf'
|
|
26
|
+
}, {
|
|
27
|
+
fontWeight: 400,
|
|
28
|
+
src: 'https://cdnjs.cloudflare.com/ajax/libs/ink/3.1.10/fonts/Roboto/roboto-light-webfont.ttf'
|
|
29
|
+
}]
|
|
30
|
+
});
|
|
31
|
+
return StyleSheet.create({
|
|
32
|
+
page: {
|
|
33
|
+
borderTopStyle: 'solid',
|
|
34
|
+
borderTopWidth: 32,
|
|
35
|
+
borderTopColor: primaryColor,
|
|
36
|
+
borderBottomStyle: 'solid',
|
|
37
|
+
borderBottomWidth: 6,
|
|
38
|
+
borderBottomColor: primaryColor,
|
|
39
|
+
backgroundColor: BACKGROUND_COLOR,
|
|
40
|
+
paddingTop: 20,
|
|
41
|
+
paddingBottom: 40
|
|
42
|
+
},
|
|
43
|
+
logoContainer: {
|
|
44
|
+
margin: 0,
|
|
45
|
+
paddingBottom: 10,
|
|
46
|
+
alignItems: 'center',
|
|
47
|
+
width: '100%'
|
|
48
|
+
},
|
|
49
|
+
logo: {
|
|
50
|
+
width: 'auto',
|
|
51
|
+
height: 30
|
|
52
|
+
},
|
|
53
|
+
introductionContainer: {
|
|
54
|
+
lineHeight: 1.4,
|
|
55
|
+
textAlign: 'center',
|
|
56
|
+
marginHorizontal: 40,
|
|
57
|
+
marginVertical: 10
|
|
58
|
+
},
|
|
59
|
+
introductionText: {
|
|
60
|
+
fontSize: 8,
|
|
61
|
+
fontFamily: 'Roboto',
|
|
62
|
+
fontWeight: 400,
|
|
63
|
+
color: 'black'
|
|
64
|
+
},
|
|
65
|
+
pageNumber: {
|
|
66
|
+
fontFamily: 'Source Code Pro',
|
|
67
|
+
position: 'absolute',
|
|
68
|
+
fontSize: 6,
|
|
69
|
+
bottom: 5,
|
|
70
|
+
right: 20,
|
|
71
|
+
left: 0,
|
|
72
|
+
textAlign: 'right',
|
|
73
|
+
color: 'black'
|
|
74
|
+
},
|
|
75
|
+
pageContinue: {
|
|
76
|
+
fontSize: 8,
|
|
77
|
+
fontFamily: 'Roboto',
|
|
78
|
+
fontWeight: 400,
|
|
79
|
+
top: -10,
|
|
80
|
+
left: 20
|
|
81
|
+
},
|
|
82
|
+
tableContainer: {
|
|
83
|
+
backgroundColor: 'white',
|
|
84
|
+
marginHorizontal: 20,
|
|
85
|
+
marginVertical: 10,
|
|
86
|
+
paddingTop: 10,
|
|
87
|
+
paddingLeft: 10,
|
|
88
|
+
borderRightWidth: 1,
|
|
89
|
+
borderBottomWidth: 1,
|
|
90
|
+
borderRightColor: BACKGROUND_COLOR,
|
|
91
|
+
borderBottomColor: GREY_1,
|
|
92
|
+
width: 'auto'
|
|
93
|
+
},
|
|
94
|
+
tableRowContainer: {
|
|
95
|
+
flexDirection: 'row',
|
|
96
|
+
borderBottomColor: GREY_2,
|
|
97
|
+
alignItems: 'flex-start',
|
|
98
|
+
fontSize: 8,
|
|
99
|
+
marginLeft: 16,
|
|
100
|
+
marginRight: 24,
|
|
101
|
+
height: 'auto'
|
|
102
|
+
},
|
|
103
|
+
tableHeaderContainer: {
|
|
104
|
+
flexDirection: 'row',
|
|
105
|
+
alignItems: 'flex-start',
|
|
106
|
+
fontSize: 7,
|
|
107
|
+
fontFamily: 'Roboto',
|
|
108
|
+
fontWeight: 700,
|
|
109
|
+
marginLeft: 16,
|
|
110
|
+
marginRight: 24,
|
|
111
|
+
marginBottom: 12,
|
|
112
|
+
paddingTop: 12,
|
|
113
|
+
paddingBottom: 12,
|
|
114
|
+
borderBottomWidth: 2,
|
|
115
|
+
borderBottomColor: primaryColor
|
|
116
|
+
},
|
|
117
|
+
tableCellHeaderText: {
|
|
118
|
+
fontSize: 7,
|
|
119
|
+
fontFamily: 'Roboto',
|
|
120
|
+
fontWeight: 700,
|
|
121
|
+
color: 'black',
|
|
122
|
+
overflow: 'hidden'
|
|
123
|
+
},
|
|
124
|
+
tableCellText: {
|
|
125
|
+
fontSize: 6,
|
|
126
|
+
lineHeight: 1.5,
|
|
127
|
+
fontFamily: 'Roboto',
|
|
128
|
+
fontWeight: 400,
|
|
129
|
+
color: 'black',
|
|
130
|
+
overflow: 'hidden'
|
|
131
|
+
},
|
|
132
|
+
dashboardImageContainer: {
|
|
133
|
+
marginHorizontal: 20,
|
|
134
|
+
marginTop: 0,
|
|
135
|
+
marginBottom: 10
|
|
136
|
+
},
|
|
137
|
+
constraintsContainer: {
|
|
138
|
+
width: 'auto',
|
|
139
|
+
height: 'auto',
|
|
140
|
+
paddingVertical: 30,
|
|
141
|
+
textAlign: 'center'
|
|
142
|
+
},
|
|
143
|
+
constraints: {
|
|
144
|
+
fontSize: 6,
|
|
145
|
+
fontFamily: 'Roboto',
|
|
146
|
+
fontWeight: 700,
|
|
147
|
+
color: 'black'
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
// istanbul ignore file
|
|
153
|
+
const DEFAULT_COLUMN_WIDTH = 100;
|
|
154
|
+
const getWidthColumn = (width, totalW, nrColumns) => {
|
|
155
|
+
// calculation width column where the 7px margin between the columns is included
|
|
156
|
+
return `${Math.round(width * 100 / (totalW - 7 * (nrColumns - 1)))}%`;
|
|
157
|
+
};
|
|
158
|
+
const PdfTableRow = _ref => {
|
|
159
|
+
let {
|
|
160
|
+
rowIndex,
|
|
161
|
+
rowData,
|
|
162
|
+
columns,
|
|
163
|
+
styles,
|
|
164
|
+
totalWidth
|
|
165
|
+
} = _ref;
|
|
166
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
167
|
+
style: styles.tableRowContainer,
|
|
168
|
+
key: `row-${rowIndex}`
|
|
169
|
+
}, columns.map((column, index) => {
|
|
170
|
+
const {
|
|
171
|
+
field,
|
|
172
|
+
width
|
|
173
|
+
} = column;
|
|
174
|
+
let totalW = totalWidth;
|
|
175
|
+
let nrColumns = columns.length;
|
|
176
|
+
|
|
177
|
+
// The checkbox in the table will not be printed
|
|
178
|
+
if (field === '__check__') {
|
|
179
|
+
totalW = totalW - (width || 50);
|
|
180
|
+
nrColumns = nrColumns - 1;
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
const widthColumn = getWidthColumn(width || DEFAULT_COLUMN_WIDTH, totalW, nrColumns);
|
|
184
|
+
|
|
185
|
+
// Empty value will print '-'
|
|
186
|
+
if (!rowData[field]) {
|
|
187
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
188
|
+
style: {
|
|
189
|
+
width: widthColumn,
|
|
190
|
+
paddingVertical: 2,
|
|
191
|
+
marginRight: 7
|
|
192
|
+
},
|
|
193
|
+
key: `cell-${rowIndex}-${index}`
|
|
194
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
195
|
+
style: styles.tableCellText
|
|
196
|
+
}, '-'));
|
|
197
|
+
}
|
|
198
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
199
|
+
style: {
|
|
200
|
+
width: widthColumn,
|
|
201
|
+
paddingVertical: 2,
|
|
202
|
+
marginRight: 7
|
|
203
|
+
},
|
|
204
|
+
key: `cell-${rowIndex}-${index}`
|
|
205
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
206
|
+
style: styles.tableCellText
|
|
207
|
+
}, Array.isArray(rowData[field]) ? rowData[field].join(', ') : rowData[field]));
|
|
208
|
+
}));
|
|
209
|
+
};
|
|
210
|
+
const PdfTable = _ref2 => {
|
|
211
|
+
let {
|
|
212
|
+
dataTable,
|
|
213
|
+
styles,
|
|
214
|
+
localeText
|
|
215
|
+
} = _ref2;
|
|
216
|
+
const {
|
|
217
|
+
data,
|
|
218
|
+
columns,
|
|
219
|
+
totalWidth
|
|
220
|
+
} = dataTable;
|
|
221
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(View, {
|
|
222
|
+
style: styles.tableHeaderContainer
|
|
223
|
+
}, columns.map(column => {
|
|
224
|
+
let totalW = totalWidth;
|
|
225
|
+
let nrColumns = columns.length;
|
|
226
|
+
const {
|
|
227
|
+
field,
|
|
228
|
+
headerName,
|
|
229
|
+
width
|
|
230
|
+
} = column;
|
|
231
|
+
|
|
232
|
+
// The checkbox in the table will not be printed
|
|
233
|
+
if (field === '__check__') {
|
|
234
|
+
totalW = totalW - (width || 50);
|
|
235
|
+
nrColumns = nrColumns - 1;
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
const widthColumn = getWidthColumn(width || DEFAULT_COLUMN_WIDTH, totalW, nrColumns);
|
|
239
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
240
|
+
style: {
|
|
241
|
+
width: widthColumn,
|
|
242
|
+
paddingVertical: 2,
|
|
243
|
+
marginRight: 7
|
|
244
|
+
},
|
|
245
|
+
key: `heading-${field}`
|
|
246
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
247
|
+
style: styles.tableCellHeaderText
|
|
248
|
+
}, headerName));
|
|
249
|
+
})), /*#__PURE__*/React.createElement(View, null, data.map((row, index) => {
|
|
250
|
+
if (index < 1000) {
|
|
251
|
+
return /*#__PURE__*/React.createElement(PdfTableRow, {
|
|
252
|
+
key: index,
|
|
253
|
+
rowIndex: index,
|
|
254
|
+
rowData: data[index],
|
|
255
|
+
columns: columns,
|
|
256
|
+
styles: styles,
|
|
257
|
+
totalWidth: totalWidth
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
})), data.length >= 1000 ? /*#__PURE__*/React.createElement(View, {
|
|
261
|
+
style: styles.constraintsContainer
|
|
262
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
263
|
+
style: styles.constraints
|
|
264
|
+
}, (localeText === null || localeText === void 0 ? void 0 : localeText.maxSizeDisclaimer) || 'Due to processing constraints this pdf is limited to the first 1000 rows of data.')) : null);
|
|
265
|
+
};
|
|
266
|
+
const Pagination = _ref3 => {
|
|
267
|
+
let {
|
|
268
|
+
styles
|
|
269
|
+
} = _ref3;
|
|
270
|
+
return /*#__PURE__*/React.createElement(Text, {
|
|
271
|
+
style: styles.pageNumber,
|
|
272
|
+
render: _ref4 => {
|
|
273
|
+
let {
|
|
274
|
+
pageNumber,
|
|
275
|
+
totalPages
|
|
276
|
+
} = _ref4;
|
|
277
|
+
return `${pageNumber}/${totalPages}`;
|
|
278
|
+
},
|
|
279
|
+
fixed: true
|
|
280
|
+
});
|
|
281
|
+
};
|
|
282
|
+
const PdfDocument = _ref5 => {
|
|
283
|
+
let {
|
|
284
|
+
dashboardImage,
|
|
285
|
+
introduction,
|
|
286
|
+
localeText,
|
|
287
|
+
logo,
|
|
288
|
+
dataTable,
|
|
289
|
+
primaryColor
|
|
290
|
+
} = _ref5;
|
|
291
|
+
const styles = getPdfStyles(primaryColor);
|
|
292
|
+
return /*#__PURE__*/React.createElement(Document, null, /*#__PURE__*/React.createElement(Page, {
|
|
293
|
+
size: "A4",
|
|
294
|
+
style: styles.page
|
|
295
|
+
}, /*#__PURE__*/React.createElement(React.Fragment, null, logo ? /*#__PURE__*/React.createElement(View, {
|
|
296
|
+
style: styles.logoContainer
|
|
297
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
298
|
+
src: logo,
|
|
299
|
+
style: styles.logo
|
|
300
|
+
})) : null, introduction ? /*#__PURE__*/React.createElement(View, {
|
|
301
|
+
style: styles.introductionContainer
|
|
302
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
303
|
+
style: styles.introductionText
|
|
304
|
+
}, introduction)) : null, dashboardImage ? /*#__PURE__*/React.createElement(View, {
|
|
305
|
+
style: styles.dashboardImageContainer
|
|
306
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
307
|
+
src: dashboardImage
|
|
308
|
+
})) : null, dataTable ? /*#__PURE__*/React.createElement(View, {
|
|
309
|
+
style: styles.tableContainer
|
|
310
|
+
}, /*#__PURE__*/React.createElement(PdfTable, {
|
|
311
|
+
dataTable: dataTable,
|
|
312
|
+
styles: styles,
|
|
313
|
+
localeText: localeText
|
|
314
|
+
})) : null, /*#__PURE__*/React.createElement(Pagination, {
|
|
315
|
+
styles: styles
|
|
316
|
+
}))));
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
const _excluded = ["children", "className", "componentRef", "fileName", "introduction", "localeText", "logo", "onClick", "primaryColor"];
|
|
320
|
+
const COMPONENT_NAME = 'PdfExportButton';
|
|
321
|
+
const CLASSNAME = 'redsift-pdf-export-button';
|
|
322
|
+
const getDashboardImage = async componentRef => {
|
|
323
|
+
var _componentRef$current, _componentRef$current2, _componentRef$current3, _componentRef$current4;
|
|
324
|
+
const filter = el => {
|
|
325
|
+
const classList = el.classList;
|
|
326
|
+
return !(classList !== null && classList !== void 0 && classList.contains('redsift-datagrid') || classList !== null && classList !== void 0 && classList.contains('redsift-button'));
|
|
327
|
+
};
|
|
328
|
+
const dashboardHeight = componentRef.current.getBoundingClientRect().height;
|
|
329
|
+
const datagridHeight = ((_componentRef$current = componentRef.current) === null || _componentRef$current === void 0 ? void 0 : (_componentRef$current2 = _componentRef$current.getElementsByClassName('redsift-datagrid')) === null || _componentRef$current2 === void 0 ? void 0 : (_componentRef$current3 = _componentRef$current2[0]) === null || _componentRef$current3 === void 0 ? void 0 : (_componentRef$current4 = _componentRef$current3.getBoundingClientRect()) === null || _componentRef$current4 === void 0 ? void 0 : _componentRef$current4.height) || 0;
|
|
330
|
+
return new Promise(resolve => {
|
|
331
|
+
domToImage.toPng(componentRef.current, {
|
|
332
|
+
filter,
|
|
333
|
+
height: dashboardHeight - datagridHeight
|
|
334
|
+
}).then(function (dataUrl) {
|
|
335
|
+
resolve(dataUrl);
|
|
336
|
+
}).catch(() => {
|
|
337
|
+
resolve('');
|
|
338
|
+
});
|
|
339
|
+
});
|
|
340
|
+
};
|
|
341
|
+
const PdfExportButton = /*#__PURE__*/forwardRef((props, ref) => {
|
|
342
|
+
const {
|
|
343
|
+
children,
|
|
344
|
+
className,
|
|
345
|
+
componentRef: propComponentRef,
|
|
346
|
+
fileName,
|
|
347
|
+
introduction,
|
|
348
|
+
localeText,
|
|
349
|
+
logo,
|
|
350
|
+
onClick,
|
|
351
|
+
primaryColor
|
|
352
|
+
} = props,
|
|
353
|
+
forwardedProps = _objectWithoutProperties(props, _excluded);
|
|
354
|
+
const [componentRef, setComponentRef] = useState(propComponentRef);
|
|
355
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
356
|
+
const {
|
|
357
|
+
dashboardRef,
|
|
358
|
+
dataGridApiRef
|
|
359
|
+
} = useContext(DashboardContext);
|
|
360
|
+
useEffect(() => {
|
|
361
|
+
if (!componentRef || !componentRef.current) {
|
|
362
|
+
setComponentRef(dashboardRef);
|
|
363
|
+
}
|
|
364
|
+
}, [dashboardRef]);
|
|
365
|
+
const exportPdf = async () => {
|
|
366
|
+
if (onClick) {
|
|
367
|
+
onClick();
|
|
368
|
+
}
|
|
369
|
+
setIsLoading(true);
|
|
370
|
+
try {
|
|
371
|
+
const dashboardImage = await getDashboardImage(componentRef || dashboardRef);
|
|
372
|
+
let dataTable;
|
|
373
|
+
if (dataGridApiRef && dataGridApiRef.current && Object.keys(dataGridApiRef.current).length) {
|
|
374
|
+
dataTable = {
|
|
375
|
+
data: gridFilteredSortedRowEntriesSelector(dataGridApiRef.current.state, dataGridApiRef.current.instanceId).slice(0, 1000).map(_ref => {
|
|
376
|
+
let {
|
|
377
|
+
model
|
|
378
|
+
} = _ref;
|
|
379
|
+
return model;
|
|
380
|
+
}),
|
|
381
|
+
columns: gridVisibleColumnDefinitionsSelector(dataGridApiRef.current.state, dataGridApiRef.current.instanceId),
|
|
382
|
+
totalWidth: gridColumnsTotalWidthSelector(dataGridApiRef.current.state, dataGridApiRef.current.instanceId)
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
const doc = /*#__PURE__*/React.createElement(PdfDocument, {
|
|
386
|
+
localeText: localeText,
|
|
387
|
+
dashboardImage: dashboardImage,
|
|
388
|
+
introduction: introduction,
|
|
389
|
+
logo: logo,
|
|
390
|
+
primaryColor: primaryColor || RedsiftColorBlueD1,
|
|
391
|
+
dataTable: dataTable
|
|
392
|
+
});
|
|
393
|
+
const asPdf = pdf([]);
|
|
394
|
+
asPdf.updateContainer(doc);
|
|
395
|
+
const blob = await asPdf.toBlob();
|
|
396
|
+
saveAs(blob, fileName || 'redsift-dashboard.pdf');
|
|
397
|
+
} catch (e) {
|
|
398
|
+
console.log('error:', e);
|
|
399
|
+
}
|
|
400
|
+
setIsLoading(false);
|
|
401
|
+
};
|
|
402
|
+
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
403
|
+
className: classNames(PdfExportButton.className, className),
|
|
404
|
+
onClick: exportPdf,
|
|
405
|
+
isDisabled: isLoading
|
|
406
|
+
}, forwardedProps, {
|
|
407
|
+
ref: ref
|
|
408
|
+
}), isLoading ? /*#__PURE__*/React.createElement(Spinner, {
|
|
409
|
+
size: "xsmall",
|
|
410
|
+
isColored: false
|
|
411
|
+
}) : null, " ", children);
|
|
412
|
+
});
|
|
413
|
+
PdfExportButton.className = CLASSNAME;
|
|
414
|
+
PdfExportButton.displayName = COMPONENT_NAME;
|
|
415
|
+
|
|
416
|
+
export { PdfExportButton as P };
|
|
417
|
+
//# sourceMappingURL=PdfExportButton2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PdfExportButton2.js","sources":["../../src/components/PdfExportButton/styles.ts","../../src/components/PdfExportButton/PdfDocument.tsx","../../src/components/PdfExportButton/PdfExportButton.tsx"],"sourcesContent":["// istanbul ignore file\n\nimport { Font, StyleSheet } from '@react-pdf/renderer';\nconst BACKGROUND_COLOR = '#F8F8F8';\nconst GREY_1 = '#E2E6EA';\nconst GREY_2 = '#bff0fd';\n\nexport const getPdfStyles = (primaryColor: string) => {\n Font.register({\n family: 'Source Code Pro',\n fonts: [\n {\n src: 'https://fonts.gstatic.com/s/sourcecodepro/v7/HI_SiYsKILxRpg3hIP6sJ7fM7PqlM-vT.ttf',\n },\n ],\n });\n\n Font.register({\n family: 'Roboto',\n fonts: [\n {\n fontWeight: 700,\n src: 'https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.0/fonts/roboto/Roboto-Regular.ttf',\n },\n {\n fontWeight: 400,\n src: 'https://cdnjs.cloudflare.com/ajax/libs/ink/3.1.10/fonts/Roboto/roboto-light-webfont.ttf',\n },\n ],\n });\n\n return StyleSheet.create({\n page: {\n borderTopStyle: 'solid',\n borderTopWidth: 32,\n borderTopColor: primaryColor,\n borderBottomStyle: 'solid',\n borderBottomWidth: 6,\n borderBottomColor: primaryColor,\n backgroundColor: BACKGROUND_COLOR,\n paddingTop: 20,\n paddingBottom: 40,\n },\n logoContainer: {\n margin: 0,\n paddingBottom: 10,\n alignItems: 'center',\n width: '100%',\n },\n logo: {\n width: 'auto',\n height: 30,\n },\n introductionContainer: {\n lineHeight: 1.4,\n textAlign: 'center',\n marginHorizontal: 40,\n marginVertical: 10,\n },\n introductionText: {\n fontSize: 8,\n fontFamily: 'Roboto',\n fontWeight: 400,\n color: 'black',\n },\n pageNumber: {\n fontFamily: 'Source Code Pro',\n position: 'absolute',\n fontSize: 6,\n bottom: 5,\n right: 20,\n left: 0,\n textAlign: 'right',\n color: 'black',\n },\n pageContinue: {\n fontSize: 8,\n fontFamily: 'Roboto',\n fontWeight: 400,\n top: -10,\n left: 20,\n },\n tableContainer: {\n backgroundColor: 'white',\n marginHorizontal: 20,\n marginVertical: 10,\n paddingTop: 10,\n paddingLeft: 10,\n borderRightWidth: 1,\n borderBottomWidth: 1,\n borderRightColor: BACKGROUND_COLOR,\n borderBottomColor: GREY_1,\n width: 'auto',\n },\n tableRowContainer: {\n flexDirection: 'row',\n borderBottomColor: GREY_2,\n alignItems: 'flex-start',\n fontSize: 8,\n marginLeft: 16,\n marginRight: 24,\n height: 'auto',\n },\n tableHeaderContainer: {\n flexDirection: 'row',\n alignItems: 'flex-start',\n fontSize: 7,\n fontFamily: 'Roboto',\n fontWeight: 700,\n marginLeft: 16,\n marginRight: 24,\n marginBottom: 12,\n paddingTop: 12,\n paddingBottom: 12,\n borderBottomWidth: 2,\n borderBottomColor: primaryColor,\n },\n tableCellHeaderText: {\n fontSize: 7,\n fontFamily: 'Roboto',\n fontWeight: 700,\n color: 'black',\n overflow: 'hidden',\n },\n tableCellText: {\n fontSize: 6,\n lineHeight: 1.5,\n fontFamily: 'Roboto',\n fontWeight: 400,\n color: 'black',\n overflow: 'hidden',\n },\n dashboardImageContainer: {\n marginHorizontal: 20,\n marginTop: 0,\n marginBottom: 10,\n },\n constraintsContainer: {\n width: 'auto',\n height: 'auto',\n paddingVertical: 30,\n textAlign: 'center',\n },\n constraints: {\n fontSize: 6,\n fontFamily: 'Roboto',\n fontWeight: 700,\n color: 'black',\n },\n });\n};\n","// istanbul ignore file\n\nimport React from 'react';\nimport { Document, Image, Page, Text, View } from '@react-pdf/renderer';\nimport { GridValidRowModel } from '@mui/x-data-grid-pro';\nimport { PdfTableColumn, PdfTableRowProps, PdfTableProps, PdfDocumentProps, PdfStyles } from './types';\nimport { getPdfStyles } from './styles';\n\nconst DEFAULT_COLUMN_WIDTH = 100;\n\nconst getWidthColumn = (width: number, totalW: number, nrColumns: number) => {\n // calculation width column where the 7px margin between the columns is included\n return `${Math.round((width * 100) / (totalW - 7 * (nrColumns - 1)))}%`;\n};\n\nconst PdfTableRow = ({ rowIndex, rowData, columns, styles, totalWidth }: PdfTableRowProps) => {\n return (\n <View style={styles.tableRowContainer} key={`row-${rowIndex}`}>\n {columns.map((column: PdfTableColumn, index: number) => {\n const { field, width } = column;\n let totalW = totalWidth;\n let nrColumns = columns.length;\n\n // The checkbox in the table will not be printed\n if (field === '__check__') {\n totalW = totalW - (width || 50);\n nrColumns = nrColumns - 1;\n return;\n }\n const widthColumn = getWidthColumn(width || DEFAULT_COLUMN_WIDTH, totalW, nrColumns);\n\n // Empty value will print '-'\n if (!rowData[field]) {\n return (\n <View\n style={{\n width: widthColumn,\n paddingVertical: 2,\n marginRight: 7,\n }}\n key={`cell-${rowIndex}-${index}`}\n >\n <Text style={styles.tableCellText}>{'-'}</Text>\n </View>\n );\n }\n return (\n <View\n style={{\n width: widthColumn,\n paddingVertical: 2,\n marginRight: 7,\n }}\n key={`cell-${rowIndex}-${index}`}\n >\n <Text style={styles.tableCellText}>\n {Array.isArray(rowData[field]) ? rowData[field].join(', ') : rowData[field]}\n </Text>\n </View>\n );\n })}\n </View>\n );\n};\n\nconst PdfTable = ({ dataTable, styles, localeText }: PdfTableProps) => {\n const { data, columns, totalWidth } = dataTable;\n\n return (\n <>\n <View style={styles.tableHeaderContainer}>\n {columns.map((column: PdfTableColumn) => {\n let totalW = totalWidth;\n let nrColumns = columns.length;\n const { field, headerName, width } = column;\n\n // The checkbox in the table will not be printed\n if (field === '__check__') {\n totalW = totalW - (width || 50);\n nrColumns = nrColumns - 1;\n return;\n }\n const widthColumn = getWidthColumn(width || DEFAULT_COLUMN_WIDTH, totalW, nrColumns);\n\n return (\n <View\n style={{\n width: widthColumn,\n paddingVertical: 2,\n marginRight: 7,\n }}\n key={`heading-${field}`}\n >\n <Text style={styles.tableCellHeaderText}>{headerName}</Text>\n </View>\n );\n })}\n </View>\n <View>\n {data.map((row: GridValidRowModel, index: number) => {\n if (index < 1000) {\n return (\n <PdfTableRow\n key={index}\n rowIndex={index}\n rowData={data[index]}\n columns={columns}\n styles={styles}\n totalWidth={totalWidth}\n />\n );\n }\n })}\n </View>\n {data.length >= 1000 ? (\n <View style={styles.constraintsContainer}>\n <Text style={styles.constraints}>\n {localeText?.maxSizeDisclaimer ||\n 'Due to processing constraints this pdf is limited to the first 1000 rows of data.'}\n </Text>\n </View>\n ) : null}\n </>\n );\n};\n\nconst Pagination = ({ styles }: { styles: PdfStyles }) => {\n return (\n <Text style={styles.pageNumber} render={({ pageNumber, totalPages }) => `${pageNumber}/${totalPages}`} fixed />\n );\n};\n\nexport const PdfDocument = ({\n dashboardImage,\n introduction,\n localeText,\n logo,\n dataTable,\n primaryColor,\n}: PdfDocumentProps) => {\n const styles = getPdfStyles(primaryColor);\n\n return (\n <Document>\n <Page size=\"A4\" style={styles.page}>\n <>\n {logo ? (\n <View style={styles.logoContainer}>\n <Image src={logo} style={styles.logo} />\n </View>\n ) : null}\n {introduction ? (\n <View style={styles.introductionContainer}>\n <Text style={styles.introductionText}>{introduction}</Text>\n </View>\n ) : null}\n {dashboardImage ? (\n <View style={styles.dashboardImageContainer}>\n <Image src={dashboardImage as unknown as string} />\n </View>\n ) : null}\n {dataTable ? (\n <View style={styles.tableContainer}>\n <PdfTable dataTable={dataTable} styles={styles} localeText={localeText} />\n </View>\n ) : null}\n\n <Pagination styles={styles} />\n </>\n </Page>\n </Document>\n );\n};\n","// istanbul ignore file\n\nimport React, {\n forwardRef,\n JSXElementConstructor,\n ReactElement,\n RefObject,\n useContext,\n useEffect,\n useState,\n} from 'react';\nimport {\n gridFilteredSortedRowEntriesSelector,\n gridVisibleColumnDefinitionsSelector,\n gridColumnsTotalWidthSelector,\n} from '@mui/x-data-grid-pro';\nimport classNames from 'classnames';\nimport { saveAs } from 'file-saver';\nimport { pdf } from '@react-pdf/renderer';\nimport domToImage from 'dom-to-image';\n\nimport { Comp, Button, Spinner, RedsiftColorBlueD1 } from '@redsift/design-system';\n\nimport { PdfExportButtonProps } from './types';\nimport { PdfDocument } from './PdfDocument';\nimport { DashboardContext } from '../Dashboard';\n\nconst COMPONENT_NAME = 'PdfExportButton';\nconst CLASSNAME = 'redsift-pdf-export-button';\n\nconst getDashboardImage = async (componentRef: RefObject<HTMLElement>): Promise<string> => {\n const filter = (el: Node) => {\n const classList = (el as HTMLElement).classList;\n return !(classList?.contains('redsift-datagrid') || classList?.contains('redsift-button'));\n };\n\n const dashboardHeight = (componentRef.current as HTMLElement).getBoundingClientRect().height;\n const datagridHeight =\n (componentRef.current as HTMLElement)?.getElementsByClassName('redsift-datagrid')?.[0]?.getBoundingClientRect()\n ?.height || 0;\n\n return new Promise((resolve) => {\n domToImage\n .toPng(componentRef.current as HTMLElement, {\n filter,\n height: dashboardHeight - datagridHeight,\n })\n .then(function (dataUrl: string) {\n resolve(dataUrl);\n })\n .catch(() => {\n resolve('');\n });\n });\n};\n\nexport const PdfExportButton: Comp<PdfExportButtonProps, HTMLButtonElement> = forwardRef((props, ref) => {\n const {\n children,\n className,\n componentRef: propComponentRef,\n fileName,\n introduction,\n localeText,\n logo,\n onClick,\n primaryColor,\n ...forwardedProps\n } = props;\n const [componentRef, setComponentRef] = useState(propComponentRef);\n const [isLoading, setIsLoading] = useState(false);\n\n const { dashboardRef, dataGridApiRef } = useContext(DashboardContext);\n\n useEffect(() => {\n if (!componentRef || !componentRef.current) {\n setComponentRef(dashboardRef);\n }\n }, [dashboardRef]);\n\n const exportPdf = async () => {\n if (onClick) {\n onClick();\n }\n setIsLoading(true);\n try {\n const dashboardImage = await getDashboardImage(componentRef || dashboardRef!);\n\n let dataTable;\n if (dataGridApiRef && dataGridApiRef.current && Object.keys(dataGridApiRef.current).length) {\n dataTable = {\n data: gridFilteredSortedRowEntriesSelector(dataGridApiRef.current.state, dataGridApiRef.current.instanceId)\n .slice(0, 1000)\n .map(({ model }) => model),\n columns: gridVisibleColumnDefinitionsSelector(\n dataGridApiRef.current.state,\n dataGridApiRef.current.instanceId\n ),\n totalWidth: gridColumnsTotalWidthSelector(dataGridApiRef.current.state, dataGridApiRef.current.instanceId),\n };\n }\n\n const doc = (\n <PdfDocument\n localeText={localeText}\n dashboardImage={dashboardImage}\n introduction={introduction}\n logo={logo}\n primaryColor={primaryColor || RedsiftColorBlueD1}\n dataTable={dataTable}\n />\n );\n const asPdf = pdf([] as unknown as ReactElement<any, string | JSXElementConstructor<any>>);\n asPdf.updateContainer(doc);\n const blob = await asPdf.toBlob();\n saveAs(blob, fileName || 'redsift-dashboard.pdf');\n } catch (e) {\n console.log('error:', e);\n }\n setIsLoading(false);\n };\n\n return (\n <Button\n className={classNames(PdfExportButton.className, className)}\n onClick={exportPdf}\n isDisabled={isLoading}\n {...forwardedProps}\n ref={ref as RefObject<HTMLButtonElement>}\n >\n {isLoading ? <Spinner size=\"xsmall\" isColored={false} /> : null} {children}\n </Button>\n );\n});\nPdfExportButton.className = CLASSNAME;\nPdfExportButton.displayName = COMPONENT_NAME;\n"],"names":["BACKGROUND_COLOR","GREY_1","GREY_2","getPdfStyles","primaryColor","Font","register","family","fonts","src","fontWeight","StyleSheet","create","page","borderTopStyle","borderTopWidth","borderTopColor","borderBottomStyle","borderBottomWidth","borderBottomColor","backgroundColor","paddingTop","paddingBottom","logoContainer","margin","alignItems","width","logo","height","introductionContainer","lineHeight","textAlign","marginHorizontal","marginVertical","introductionText","fontSize","fontFamily","color","pageNumber","position","bottom","right","left","pageContinue","top","tableContainer","paddingLeft","borderRightWidth","borderRightColor","tableRowContainer","flexDirection","marginLeft","marginRight","tableHeaderContainer","marginBottom","tableCellHeaderText","overflow","tableCellText","dashboardImageContainer","marginTop","constraintsContainer","paddingVertical","constraints","DEFAULT_COLUMN_WIDTH","getWidthColumn","totalW","nrColumns","Math","round","PdfTableRow","_ref","rowIndex","rowData","columns","styles","totalWidth","React","createElement","View","style","key","map","column","index","field","length","widthColumn","Text","Array","isArray","join","PdfTable","_ref2","dataTable","localeText","data","Fragment","headerName","row","maxSizeDisclaimer","Pagination","_ref3","render","_ref4","totalPages","fixed","PdfDocument","_ref5","dashboardImage","introduction","Document","Page","size","Image","COMPONENT_NAME","CLASSNAME","getDashboardImage","componentRef","_componentRef$current","_componentRef$current2","_componentRef$current3","_componentRef$current4","filter","el","classList","contains","dashboardHeight","current","getBoundingClientRect","datagridHeight","getElementsByClassName","Promise","resolve","domToImage","toPng","then","dataUrl","catch","PdfExportButton","forwardRef","props","ref","children","className","propComponentRef","fileName","onClick","forwardedProps","_objectWithoutProperties","_excluded","setComponentRef","useState","isLoading","setIsLoading","dashboardRef","dataGridApiRef","useContext","DashboardContext","useEffect","exportPdf","Object","keys","gridFilteredSortedRowEntriesSelector","state","instanceId","slice","model","gridVisibleColumnDefinitionsSelector","gridColumnsTotalWidthSelector","doc","RedsiftColorBlueD1","asPdf","pdf","updateContainer","blob","toBlob","saveAs","e","console","log","Button","_extends","classNames","isDisabled","Spinner","isColored","displayName"],"mappings":";;;;;;;;;AAAA;AAGA,MAAMA,gBAAgB,GAAG,SAAS,CAAA;AAClC,MAAMC,MAAM,GAAG,SAAS,CAAA;AACxB,MAAMC,MAAM,GAAG,SAAS,CAAA;AAEjB,MAAMC,YAAY,GAAIC,YAAoB,IAAK;EACpDC,IAAI,CAACC,QAAQ,CAAC;AACZC,IAAAA,MAAM,EAAE,iBAAiB;AACzBC,IAAAA,KAAK,EAAE,CACL;AACEC,MAAAA,GAAG,EAAE,mFAAA;KACN,CAAA;AAEL,GAAC,CAAC,CAAA;EAEFJ,IAAI,CAACC,QAAQ,CAAC;AACZC,IAAAA,MAAM,EAAE,QAAQ;AAChBC,IAAAA,KAAK,EAAE,CACL;AACEE,MAAAA,UAAU,EAAE,GAAG;AACfD,MAAAA,GAAG,EAAE,2FAAA;AACP,KAAC,EACD;AACEC,MAAAA,UAAU,EAAE,GAAG;AACfD,MAAAA,GAAG,EAAE,yFAAA;KACN,CAAA;AAEL,GAAC,CAA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