@redsift/dashboard 11.6.0-muiv5-alpha.3 → 11.6.0-muiv5-alpha.5
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 +3 -0
- package/_internal/ChartEmptyState.js.map +1 -0
- package/{components/ChartEmptyState/types.d.ts → _internal/ChartEmptyState2.js} +4 -1
- package/_internal/ChartEmptyState2.js.map +1 -0
- package/_internal/CrossfilterRegistry.js +9 -0
- package/_internal/CrossfilterRegistry.js.map +1 -0
- package/{components/CrossfilterRegistry/CrossfilterRegistry.js → _internal/CrossfilterRegistry2.js} +2 -2
- package/_internal/CrossfilterRegistry2.js.map +1 -0
- package/_internal/Dashboard.js +7 -0
- package/_internal/Dashboard.js.map +1 -0
- package/{components/Dashboard/reducer.js → _internal/Dashboard2.js} +44 -4
- package/_internal/Dashboard2.js.map +1 -0
- package/_internal/PdfExportButton.js +3 -0
- package/_internal/PdfExportButton.js.map +1 -0
- package/{components/PdfExportButton/types.d.ts → _internal/PdfExportButton2.js} +4 -2
- package/_internal/PdfExportButton2.js.map +1 -0
- package/_internal/TimeSeriesBarChart.js +5 -0
- package/_internal/TimeSeriesBarChart.js.map +1 -0
- package/{components/TimeSeriesBarChart/types.d.ts → _internal/TimeSeriesBarChart2.js} +5 -3
- package/_internal/TimeSeriesBarChart2.js.map +1 -0
- package/_internal/WithFilters.js +4 -0
- package/_internal/WithFilters.js.map +1 -0
- package/{components/WithFilters/types.d.ts → _internal/WithFilters2.js} +5 -3
- package/_internal/WithFilters2.js.map +1 -0
- package/{_virtual/_rollupPluginBabelHelpers.js → _internal/context.js} +11 -2
- package/_internal/context.js.map +1 -0
- package/{components/Dashboard/types.d.ts → _internal/reducer.js} +11 -3
- package/{types.d.ts → _internal/types.js} +1 -1
- package/_internal/types.js.map +1 -0
- package/index.js +19 -12
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
- package/components/ChartEmptyState/ChartEmptyState.d.ts +0 -6
- package/components/ChartEmptyState/ChartEmptyState.js +0 -123
- package/components/ChartEmptyState/ChartEmptyState.js.map +0 -1
- package/components/ChartEmptyState/styles.js +0 -35
- package/components/ChartEmptyState/styles.js.map +0 -1
- package/components/CrossfilterRegistry/CrossfilterRegistry.js.map +0 -1
- package/components/Dashboard/Dashboard.d.ts +0 -6
- package/components/Dashboard/Dashboard.js +0 -46
- package/components/Dashboard/Dashboard.js.map +0 -1
- package/components/Dashboard/context.d.ts +0 -7
- package/components/Dashboard/context.js +0 -11
- package/components/Dashboard/context.js.map +0 -1
- package/components/Dashboard/reducer.d.ts +0 -5
- package/components/Dashboard/reducer.js.map +0 -1
- package/components/Dashboard/types.js +0 -23
- package/components/Dashboard/types.js.map +0 -1
- package/components/PdfExportButton/PdfDocument.js +0 -173
- package/components/PdfExportButton/PdfDocument.js.map +0 -1
- package/components/PdfExportButton/PdfExportButton.d.ts +0 -6
- package/components/PdfExportButton/PdfExportButton.js +0 -110
- package/components/PdfExportButton/PdfExportButton.js.map +0 -1
- package/components/PdfExportButton/styles.js +0 -146
- package/components/PdfExportButton/styles.js.map +0 -1
- package/components/TimeSeriesBarChart/TimeSeriesBarChart.d.ts +0 -6
- package/components/TimeSeriesBarChart/TimeSeriesBarChart.js +0 -365
- package/components/TimeSeriesBarChart/TimeSeriesBarChart.js.map +0 -1
- package/components/TimeSeriesBarChart/styles.js +0 -98
- package/components/TimeSeriesBarChart/styles.js.map +0 -1
- package/components/TimeSeriesBarChart/types.js +0 -22
- package/components/TimeSeriesBarChart/types.js.map +0 -1
- package/components/WithFilters/FilterableBarChart.js +0 -152
- package/components/WithFilters/FilterableBarChart.js.map +0 -1
- package/components/WithFilters/FilterableDataGrid.js +0 -51
- package/components/WithFilters/FilterableDataGrid.js.map +0 -1
- package/components/WithFilters/FilterablePieChart.js +0 -160
- package/components/WithFilters/FilterablePieChart.js.map +0 -1
- package/components/WithFilters/FilterableScatterPlot.js +0 -252
- package/components/WithFilters/FilterableScatterPlot.js.map +0 -1
- package/components/WithFilters/WithFilters.d.ts +0 -6
- package/components/WithFilters/WithFilters.js +0 -36
- package/components/WithFilters/WithFilters.js.map +0 -1
- package/hooks/useCategoricalChartAsListbox.js +0 -94
- package/hooks/useCategoricalChartAsListbox.js.map +0 -1
- package/index.d.ts +0 -15
- package/utils/groupReducers/groupReduceCount.d.ts +0 -6
- package/utils/groupReducers/groupReduceCount.js +0 -5
- package/utils/groupReducers/groupReduceCount.js.map +0 -1
- package/utils/groupReducers/groupReduceSum.d.ts +0 -7
- package/utils/groupReducers/groupReduceSum.js +0 -5
- package/utils/groupReducers/groupReduceSum.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PdfDocument.js","sources":["../../../src/components/PdfExportButton/PdfDocument.tsx"],"sourcesContent":["// 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"],"names":["DEFAULT_COLUMN_WIDTH","getWidthColumn","width","totalW","nrColumns","Math","round","PdfTableRow","_ref","rowIndex","rowData","columns","styles","totalWidth","React","createElement","View","style","tableRowContainer","key","map","column","index","field","length","widthColumn","paddingVertical","marginRight","Text","tableCellText","Array","isArray","join","PdfTable","_ref2","dataTable","localeText","data","Fragment","tableHeaderContainer","headerName","tableCellHeaderText","row","constraintsContainer","constraints","maxSizeDisclaimer","Pagination","_ref3","pageNumber","render","_ref4","totalPages","fixed","PdfDocument","_ref5","dashboardImage","introduction","logo","primaryColor","getPdfStyles","Document","Page","size","page","logoContainer","Image","src","introductionContainer","introductionText","dashboardImageContainer","tableContainer"],"mappings":";;;;AAAA;AAQA,MAAMA,oBAAoB,GAAG,GAAG,CAAA;AAEhC,MAAMC,cAAc,GAAGA,CAACC,KAAa,EAAEC,MAAc,EAAEC,SAAiB,KAAK;AAC3E;AACA,EAAA,OAAQ,GAAEC,IAAI,CAACC,KAAK,CAAEJ,KAAK,GAAG,GAAG,IAAKC,MAAM,GAAG,CAAC,IAAIC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAE,CAAE,CAAA,CAAA,CAAA;AACzE,CAAC,CAAA;AAED,MAA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AAM,EAAEA,MAAAA;GAAS,CAC7B,CACE,CACE,CAAC,CAAA;AAEf;;;;"}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.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 { pdf } from '@react-pdf/renderer';
|
|
7
|
-
import domToImage from 'dom-to-image';
|
|
8
|
-
import { Button, Spinner, RedsiftColorBlueD1 } from '@redsift/design-system';
|
|
9
|
-
import { PdfDocument } from './PdfDocument.js';
|
|
10
|
-
import { DashboardContext } from '../Dashboard/context.js';
|
|
11
|
-
|
|
12
|
-
const _excluded = ["children", "className", "componentRef", "fileName", "introduction", "localeText", "logo", "onClick", "primaryColor"];
|
|
13
|
-
const COMPONENT_NAME = 'PdfExportButton';
|
|
14
|
-
const CLASSNAME = 'redsift-pdf-export-button';
|
|
15
|
-
const getDashboardImage = async componentRef => {
|
|
16
|
-
var _componentRef$current, _componentRef$current2, _componentRef$current3, _componentRef$current4;
|
|
17
|
-
const filter = el => {
|
|
18
|
-
const classList = el.classList;
|
|
19
|
-
return !(classList !== null && classList !== void 0 && classList.contains('redsift-datagrid') || classList !== null && classList !== void 0 && classList.contains('redsift-button'));
|
|
20
|
-
};
|
|
21
|
-
const dashboardHeight = componentRef.current.getBoundingClientRect().height;
|
|
22
|
-
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;
|
|
23
|
-
return new Promise(resolve => {
|
|
24
|
-
domToImage.toPng(componentRef.current, {
|
|
25
|
-
filter,
|
|
26
|
-
height: dashboardHeight - datagridHeight
|
|
27
|
-
}).then(function (dataUrl) {
|
|
28
|
-
resolve(dataUrl);
|
|
29
|
-
}).catch(() => {
|
|
30
|
-
resolve('');
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
const PdfExportButton = /*#__PURE__*/forwardRef((props, ref) => {
|
|
35
|
-
const {
|
|
36
|
-
children,
|
|
37
|
-
className,
|
|
38
|
-
componentRef: propComponentRef,
|
|
39
|
-
fileName,
|
|
40
|
-
introduction,
|
|
41
|
-
localeText,
|
|
42
|
-
logo,
|
|
43
|
-
onClick,
|
|
44
|
-
primaryColor
|
|
45
|
-
} = props,
|
|
46
|
-
forwardedProps = _objectWithoutProperties(props, _excluded);
|
|
47
|
-
const [componentRef, setComponentRef] = useState(propComponentRef);
|
|
48
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
49
|
-
const {
|
|
50
|
-
dashboardRef,
|
|
51
|
-
dataGridApiRef
|
|
52
|
-
} = useContext(DashboardContext);
|
|
53
|
-
useEffect(() => {
|
|
54
|
-
if (!componentRef || !componentRef.current) {
|
|
55
|
-
setComponentRef(dashboardRef);
|
|
56
|
-
}
|
|
57
|
-
}, [dashboardRef]);
|
|
58
|
-
const exportPdf = async () => {
|
|
59
|
-
if (onClick) {
|
|
60
|
-
onClick();
|
|
61
|
-
}
|
|
62
|
-
setIsLoading(true);
|
|
63
|
-
try {
|
|
64
|
-
const dashboardImage = await getDashboardImage(componentRef || dashboardRef);
|
|
65
|
-
let dataTable;
|
|
66
|
-
if (dataGridApiRef && dataGridApiRef.current && Object.keys(dataGridApiRef.current).length) {
|
|
67
|
-
dataTable = {
|
|
68
|
-
data: gridFilteredSortedRowEntriesSelector(dataGridApiRef.current.state, dataGridApiRef.current.instanceId).slice(0, 1000).map(_ref => {
|
|
69
|
-
let {
|
|
70
|
-
model
|
|
71
|
-
} = _ref;
|
|
72
|
-
return model;
|
|
73
|
-
}),
|
|
74
|
-
columns: gridVisibleColumnDefinitionsSelector(dataGridApiRef.current.state, dataGridApiRef.current.instanceId),
|
|
75
|
-
totalWidth: gridColumnsTotalWidthSelector(dataGridApiRef.current.state, dataGridApiRef.current.instanceId)
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
const doc = /*#__PURE__*/React.createElement(PdfDocument, {
|
|
79
|
-
localeText: localeText,
|
|
80
|
-
dashboardImage: dashboardImage,
|
|
81
|
-
introduction: introduction,
|
|
82
|
-
logo: logo,
|
|
83
|
-
primaryColor: primaryColor || RedsiftColorBlueD1,
|
|
84
|
-
dataTable: dataTable
|
|
85
|
-
});
|
|
86
|
-
const asPdf = pdf([]);
|
|
87
|
-
asPdf.updateContainer(doc);
|
|
88
|
-
const blob = await asPdf.toBlob();
|
|
89
|
-
saveAs(blob, fileName || 'redsift-dashboard.pdf');
|
|
90
|
-
} catch (e) {
|
|
91
|
-
console.log('error:', e);
|
|
92
|
-
}
|
|
93
|
-
setIsLoading(false);
|
|
94
|
-
};
|
|
95
|
-
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
96
|
-
className: classNames(PdfExportButton.className, className),
|
|
97
|
-
onClick: exportPdf,
|
|
98
|
-
isDisabled: isLoading
|
|
99
|
-
}, forwardedProps, {
|
|
100
|
-
ref: ref
|
|
101
|
-
}), isLoading ? /*#__PURE__*/React.createElement(Spinner, {
|
|
102
|
-
size: "xsmall",
|
|
103
|
-
isColored: false
|
|
104
|
-
}) : null, " ", children);
|
|
105
|
-
});
|
|
106
|
-
PdfExportButton.className = CLASSNAME;
|
|
107
|
-
PdfExportButton.displayName = COMPONENT_NAME;
|
|
108
|
-
|
|
109
|
-
export { PdfExportButton };
|
|
110
|
-
//# sourceMappingURL=PdfExportButton.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PdfExportButton.js","sources":["../../../src/components/PdfExportButton/PdfExportButton.tsx"],"sourcesContent":["// 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":["COMPONENT_NAME","CLASSNAME","getDashboardImage","componentRef","_componentRef$current","_componentRef$current2","_componentRef$current3","_componentRef$current4","filter","el","classList","contains","dashboardHeight","current","getBoundingClientRect","height","datagridHeight","getElementsByClassName","Promise","resolve","domToImage","toPng","then","dataUrl","catch","PdfExportButton","forwardRef","props","ref","children","className","propComponentRef","fileName","introduction","localeText","logo","onClick","primaryColor","forwardedProps","_objectWithoutProperties","_excluded","setComponentRef","useState","isLoading","setIsLoading","dashboardRef","dataGridApiRef","useContext","DashboardContext","useEffect","exportPdf","dashboardImage","dataTable","Object","keys","length","data","gridFilteredSortedRowEntriesSelector","state","instanceId","slice","map","_ref","model","columns","gridVisibleColumnDefinitionsSelector","totalWidth","gridColumnsTotalWidthSelector","doc","React","createElement","PdfDocument","RedsiftColorBlueD1","asPdf","pdf","updateContainer","blob","toBlob","saveAs","e","console","log","Button","_extends","classNames","isDisabled","Spinner","size","isColored","displayName"],"mappings":";;;;;;;;;;;;AA2BA,MAAMA,cAAc,GAAG,iBAAiB,CAAA;AACxC,MAAMC,SAAS,GAAG,2BAA2B,CAAA;AAE7C,MAAMC,iBAAiB,GAAG,MAAOC,YAAoC,IAAsB;AAAA,EAAA,IAAAC,qBAAA,EAAAC,sBAAA,EAAAC,sBAAA,EAAAC,sBAAA,CAAA;EACzF,MAAMC,MAAM,GAAIC,EAAQ,IAAK;AAC3B,IAAA,MAAMC,SAAS,GAAID,EAAE,CAAiBC,SAAS,CAAA;IAC/C,OAAO,EAAEA,SAAS,KAATA,IAAAA,IAAAA,SAAS,eAATA,SAAS,CAAEC,QAAQ,CAAC,kBAAkB,CAAC,IAAID,SAAS,KAAA,IAAA,IAATA,SAAS,KAATA,KAAAA,CAAAA,IAAAA,SAAS,CAAEC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAA;GAC3F,CAAA;EAED,MAAMC,eAAe,GAAIT,YAAY,CAACU,OAAO,CAAiBC,qBAAqB,EAAE,CAACC,MAAM,CAAA;EAC5F,MAAMC,cAAc,GAClB,CAAAZ,CAAAA,qBAAA,GAACD,YAAY,CAACU,OAAO,MAAAT,IAAAA,IAAAA,qBAAA,wBAAAC,sBAAA,GAArBD,qBAAA,CAAuCa,sBAAsB,CAAC,kBAAkB,CAAC,cAAAZ,sBAAA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C,EAAC3D,QAC5D,CAAC,CAAA;AAEb,CAAC,EAAC;AACFJ,eAAe,CAACK,SAAS,GAAG7B,SAAS,CAAA;AACrCwB,eAAe,CAACgE,WAAW,GAAGzF,cAAc;;;;"}
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { Font, StyleSheet } from '@react-pdf/renderer';
|
|
2
|
-
|
|
3
|
-
// istanbul ignore file
|
|
4
|
-
const BACKGROUND_COLOR = '#F8F8F8';
|
|
5
|
-
const GREY_1 = '#E2E6EA';
|
|
6
|
-
const GREY_2 = '#bff0fd';
|
|
7
|
-
const getPdfStyles = primaryColor => {
|
|
8
|
-
Font.register({
|
|
9
|
-
family: 'Source Code Pro',
|
|
10
|
-
fonts: [{
|
|
11
|
-
src: 'https://fonts.gstatic.com/s/sourcecodepro/v7/HI_SiYsKILxRpg3hIP6sJ7fM7PqlM-vT.ttf'
|
|
12
|
-
}]
|
|
13
|
-
});
|
|
14
|
-
Font.register({
|
|
15
|
-
family: 'Roboto',
|
|
16
|
-
fonts: [{
|
|
17
|
-
fontWeight: 700,
|
|
18
|
-
src: 'https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.0/fonts/roboto/Roboto-Regular.ttf'
|
|
19
|
-
}, {
|
|
20
|
-
fontWeight: 400,
|
|
21
|
-
src: 'https://cdnjs.cloudflare.com/ajax/libs/ink/3.1.10/fonts/Roboto/roboto-light-webfont.ttf'
|
|
22
|
-
}]
|
|
23
|
-
});
|
|
24
|
-
return StyleSheet.create({
|
|
25
|
-
page: {
|
|
26
|
-
borderTopStyle: 'solid',
|
|
27
|
-
borderTopWidth: 32,
|
|
28
|
-
borderTopColor: primaryColor,
|
|
29
|
-
borderBottomStyle: 'solid',
|
|
30
|
-
borderBottomWidth: 6,
|
|
31
|
-
borderBottomColor: primaryColor,
|
|
32
|
-
backgroundColor: BACKGROUND_COLOR,
|
|
33
|
-
paddingTop: 20,
|
|
34
|
-
paddingBottom: 40
|
|
35
|
-
},
|
|
36
|
-
logoContainer: {
|
|
37
|
-
margin: 0,
|
|
38
|
-
paddingBottom: 10,
|
|
39
|
-
alignItems: 'center',
|
|
40
|
-
width: '100%'
|
|
41
|
-
},
|
|
42
|
-
logo: {
|
|
43
|
-
width: 'auto',
|
|
44
|
-
height: 30
|
|
45
|
-
},
|
|
46
|
-
introductionContainer: {
|
|
47
|
-
lineHeight: 1.4,
|
|
48
|
-
textAlign: 'center',
|
|
49
|
-
marginHorizontal: 40,
|
|
50
|
-
marginVertical: 10
|
|
51
|
-
},
|
|
52
|
-
introductionText: {
|
|
53
|
-
fontSize: 8,
|
|
54
|
-
fontFamily: 'Roboto',
|
|
55
|
-
fontWeight: 400,
|
|
56
|
-
color: 'black'
|
|
57
|
-
},
|
|
58
|
-
pageNumber: {
|
|
59
|
-
fontFamily: 'Source Code Pro',
|
|
60
|
-
position: 'absolute',
|
|
61
|
-
fontSize: 6,
|
|
62
|
-
bottom: 5,
|
|
63
|
-
right: 20,
|
|
64
|
-
left: 0,
|
|
65
|
-
textAlign: 'right',
|
|
66
|
-
color: 'black'
|
|
67
|
-
},
|
|
68
|
-
pageContinue: {
|
|
69
|
-
fontSize: 8,
|
|
70
|
-
fontFamily: 'Roboto',
|
|
71
|
-
fontWeight: 400,
|
|
72
|
-
top: -10,
|
|
73
|
-
left: 20
|
|
74
|
-
},
|
|
75
|
-
tableContainer: {
|
|
76
|
-
backgroundColor: 'white',
|
|
77
|
-
marginHorizontal: 20,
|
|
78
|
-
marginVertical: 10,
|
|
79
|
-
paddingTop: 10,
|
|
80
|
-
paddingLeft: 10,
|
|
81
|
-
borderRightWidth: 1,
|
|
82
|
-
borderBottomWidth: 1,
|
|
83
|
-
borderRightColor: BACKGROUND_COLOR,
|
|
84
|
-
borderBottomColor: GREY_1,
|
|
85
|
-
width: 'auto'
|
|
86
|
-
},
|
|
87
|
-
tableRowContainer: {
|
|
88
|
-
flexDirection: 'row',
|
|
89
|
-
borderBottomColor: GREY_2,
|
|
90
|
-
alignItems: 'flex-start',
|
|
91
|
-
fontSize: 8,
|
|
92
|
-
marginLeft: 16,
|
|
93
|
-
marginRight: 24,
|
|
94
|
-
height: 'auto'
|
|
95
|
-
},
|
|
96
|
-
tableHeaderContainer: {
|
|
97
|
-
flexDirection: 'row',
|
|
98
|
-
alignItems: 'flex-start',
|
|
99
|
-
fontSize: 7,
|
|
100
|
-
fontFamily: 'Roboto',
|
|
101
|
-
fontWeight: 700,
|
|
102
|
-
marginLeft: 16,
|
|
103
|
-
marginRight: 24,
|
|
104
|
-
marginBottom: 12,
|
|
105
|
-
paddingTop: 12,
|
|
106
|
-
paddingBottom: 12,
|
|
107
|
-
borderBottomWidth: 2,
|
|
108
|
-
borderBottomColor: primaryColor
|
|
109
|
-
},
|
|
110
|
-
tableCellHeaderText: {
|
|
111
|
-
fontSize: 7,
|
|
112
|
-
fontFamily: 'Roboto',
|
|
113
|
-
fontWeight: 700,
|
|
114
|
-
color: 'black',
|
|
115
|
-
overflow: 'hidden'
|
|
116
|
-
},
|
|
117
|
-
tableCellText: {
|
|
118
|
-
fontSize: 6,
|
|
119
|
-
lineHeight: 1.5,
|
|
120
|
-
fontFamily: 'Roboto',
|
|
121
|
-
fontWeight: 400,
|
|
122
|
-
color: 'black',
|
|
123
|
-
overflow: 'hidden'
|
|
124
|
-
},
|
|
125
|
-
dashboardImageContainer: {
|
|
126
|
-
marginHorizontal: 20,
|
|
127
|
-
marginTop: 0,
|
|
128
|
-
marginBottom: 10
|
|
129
|
-
},
|
|
130
|
-
constraintsContainer: {
|
|
131
|
-
width: 'auto',
|
|
132
|
-
height: 'auto',
|
|
133
|
-
paddingVertical: 30,
|
|
134
|
-
textAlign: 'center'
|
|
135
|
-
},
|
|
136
|
-
constraints: {
|
|
137
|
-
fontSize: 6,
|
|
138
|
-
fontFamily: 'Roboto',
|
|
139
|
-
fontWeight: 700,
|
|
140
|
-
color: 'black'
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
export { getPdfStyles };
|
|
146
|
-
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sources":["../../../src/components/PdfExportButton/styles.ts"],"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"],"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"],"mappings":";;AAAA;AAGA,MAAMA,gBAAgB,GAAG,SAAS,CAAA;AAClC,MAAMC,MAAM,GAAG,SAAS,CAAA;AACxB,MAAMC,MAAM,GAAG,SAAS,CAAA;AAEXC,MAAAA,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,CAAC,CAAA;EAEF,OAAOE,UAAU,CAACC,MAAM,CAAC;AACvBC,IAAAA,IAAI,EAAE;AACJC,MAAAA,cAAc,EAAE,OAAO;AACvBC,MAAAA,cAAc,EAAE,EAAE;AAClBC,MAAAA,cAAc,EAAEZ,YAAY;AAC5Ba,MAAAA,iBAAiB,EAAE,OAAO;AAC1BC,MAAAA,iBAAiB,EAAE,CAAC;AACpBC,MAAAA,iBAAiB,EAAEf,YAAY;AAC/BgB,MAAAA,eAAe,EAAEpB,gBAAgB;AACjCqB,MAAAA,UAAU,EAAE,EAAE;AACdC,MAAAA,aAAa,EAAE,EAAA;KAChB;AACDC,IAAAA,aAAa,EAAE;AACbC,MAAAA,MAAM,EAAE,CAAC;AACTF,MAAAA,aAAa,EAAE,EAAE;AACjBG,MAAAA,UAAU,EAAE,QAAQ;AACpBC,MAAA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