@quillsql/react 2.10.33 → 2.10.35
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/dist/cjs/Chart.d.ts.map +1 -1
- package/dist/cjs/Chart.js +13 -1
- package/dist/cjs/Dashboard.d.ts.map +1 -1
- package/dist/cjs/Dashboard.js +3 -9
- package/dist/cjs/SQLEditor.d.ts.map +1 -1
- package/dist/cjs/SQLEditor.js +1 -1
- package/dist/cjs/Table.d.ts +3 -2
- package/dist/cjs/Table.d.ts.map +1 -1
- package/dist/cjs/Table.js +15 -26
- package/dist/cjs/components/Dashboard/DashboardSection.d.ts +5 -1
- package/dist/cjs/components/Dashboard/DashboardSection.d.ts.map +1 -1
- package/dist/cjs/components/Dashboard/DashboardSection.js +12 -4
- package/dist/cjs/components/Dashboard/TableComponent.d.ts +1 -1
- package/dist/cjs/components/Dashboard/TableComponent.d.ts.map +1 -1
- package/dist/cjs/components/Dashboard/TableComponent.js +38 -16
- package/dist/cjs/components/QuillTable.d.ts +1 -1
- package/dist/cjs/components/QuillTable.d.ts.map +1 -1
- package/dist/cjs/components/QuillTable.js +10 -36
- package/dist/cjs/components/UiComponents.d.ts +2 -3
- package/dist/cjs/components/UiComponents.d.ts.map +1 -1
- package/dist/cjs/components/UiComponents.js +8 -1
- package/dist/cjs/hooks/useExport.d.ts +1 -11
- package/dist/cjs/hooks/useExport.d.ts.map +1 -1
- package/dist/cjs/hooks/useExport.js +9 -21
- package/dist/cjs/hooks/useFormat.d.ts +2 -3
- package/dist/cjs/hooks/useFormat.d.ts.map +1 -1
- package/dist/cjs/hooks/useFormat.js +19 -15
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/utils/csv.d.ts.map +1 -1
- package/dist/cjs/utils/csv.js +8 -6
- package/dist/esm/Chart.d.ts.map +1 -1
- package/dist/esm/Chart.js +13 -1
- package/dist/esm/Dashboard.d.ts.map +1 -1
- package/dist/esm/Dashboard.js +3 -9
- package/dist/esm/SQLEditor.d.ts.map +1 -1
- package/dist/esm/SQLEditor.js +1 -1
- package/dist/esm/Table.d.ts +3 -2
- package/dist/esm/Table.d.ts.map +1 -1
- package/dist/esm/Table.js +16 -27
- package/dist/esm/components/Dashboard/DashboardSection.d.ts +5 -1
- package/dist/esm/components/Dashboard/DashboardSection.d.ts.map +1 -1
- package/dist/esm/components/Dashboard/DashboardSection.js +12 -4
- package/dist/esm/components/Dashboard/TableComponent.d.ts +1 -1
- package/dist/esm/components/Dashboard/TableComponent.d.ts.map +1 -1
- package/dist/esm/components/Dashboard/TableComponent.js +38 -16
- package/dist/esm/components/QuillTable.d.ts +1 -1
- package/dist/esm/components/QuillTable.d.ts.map +1 -1
- package/dist/esm/components/QuillTable.js +12 -38
- package/dist/esm/components/UiComponents.d.ts +2 -3
- package/dist/esm/components/UiComponents.d.ts.map +1 -1
- package/dist/esm/components/UiComponents.js +8 -1
- package/dist/esm/hooks/useExport.d.ts +1 -11
- package/dist/esm/hooks/useExport.d.ts.map +1 -1
- package/dist/esm/hooks/useExport.js +9 -21
- package/dist/esm/hooks/useFormat.d.ts +2 -3
- package/dist/esm/hooks/useFormat.d.ts.map +1 -1
- package/dist/esm/hooks/useFormat.js +19 -15
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/utils/csv.d.ts.map +1 -1
- package/dist/esm/utils/csv.js +8 -6
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExport.d.ts","sourceRoot":"","sources":["../../../src/hooks/useExport.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useExport.d.ts","sourceRoot":"","sources":["../../../src/hooks/useExport.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,SAAS,YAAa,MAAM;;;CAYxC,CAAC"}
|
|
@@ -1,27 +1,15 @@
|
|
|
1
1
|
import { downloadCSV } from '../utils/csv';
|
|
2
2
|
import { useQuill } from '../hooks/useQuill';
|
|
3
|
-
export const useExport = (
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return { downloadCSV: () => { }, downloadPDF: () => { } };
|
|
8
|
-
return {
|
|
9
|
-
downloadCSV: () => downloadCSV({
|
|
10
|
-
rows: chartData.rows,
|
|
11
|
-
fields: chartData.fields,
|
|
12
|
-
name: chartData.name,
|
|
13
|
-
}),
|
|
14
|
-
downloadPDF: () => { },
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
if ('rows' in data) {
|
|
18
|
-
return {
|
|
19
|
-
downloadCSV: () => downloadCSV({ ...data }),
|
|
20
|
-
downloadPDF: () => { },
|
|
21
|
-
};
|
|
22
|
-
}
|
|
3
|
+
export const useExport = (chartId) => {
|
|
4
|
+
const chartData = useQuill(chartId).data;
|
|
5
|
+
if (!chartData)
|
|
6
|
+
return { downloadCSV: () => { }, downloadPDF: () => { } };
|
|
23
7
|
return {
|
|
24
|
-
downloadCSV: () => {
|
|
8
|
+
downloadCSV: () => downloadCSV({
|
|
9
|
+
rows: chartData.rows,
|
|
10
|
+
fields: chartData.columns,
|
|
11
|
+
name: chartData.name,
|
|
12
|
+
}),
|
|
25
13
|
downloadPDF: () => { },
|
|
26
14
|
};
|
|
27
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFormat.d.ts","sourceRoot":"","sources":["../../../src/hooks/useFormat.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"useFormat.d.ts","sourceRoot":"","sources":["../../../src/hooks/useFormat.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,eAAe,YACjB,MAAM,KACd;IAAE,IAAI,EAAE,GAAG,EAAE,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAwBjC,CAAC"}
|
|
@@ -3,19 +3,23 @@ import { useQuill } from './useQuill';
|
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
4
|
export const useMemoizedRows = (chartId) => {
|
|
5
5
|
const { data } = useQuill(chartId);
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
const formattedRows = useMemo(() => {
|
|
7
|
+
if (!data || !data.rows || !data.columns)
|
|
8
|
+
return { rows: [], loading: true };
|
|
9
|
+
return {
|
|
10
|
+
rows: data.rows.map((row) => {
|
|
11
|
+
return data.columns.reduce((formattedRow, column) => {
|
|
12
|
+
// Apply the format function to each field in the row
|
|
13
|
+
const formattedValue = quillFormat({
|
|
14
|
+
value: row[column.field],
|
|
15
|
+
format: column.format,
|
|
16
|
+
});
|
|
17
|
+
formattedRow[column.field] = formattedValue;
|
|
18
|
+
return formattedRow;
|
|
19
|
+
}, {});
|
|
20
|
+
}),
|
|
21
|
+
loading: false,
|
|
22
|
+
};
|
|
23
|
+
}, [data]);
|
|
24
|
+
return formattedRows;
|
|
21
25
|
};
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -16,4 +16,5 @@ export type { QuillTheme } from './QuillProvider';
|
|
|
16
16
|
export { ThemeContext } from './Context';
|
|
17
17
|
export type { TextInputComponentProps, ButtonComponentProps, Option, PopoverComponentProps, ModalComponentProps, TableComponentProps, HeaderProps, } from './components/UiComponents';
|
|
18
18
|
export type { DateRangePickerProps, DateRangePickerOption, DateRange, } from './DateRangePicker/DateRangePicker';
|
|
19
|
+
export { type DashboardSectionComponentProps, } from './components/Dashboard/DashboardSection';
|
|
19
20
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,IAAI,SAAS,EACpB,KAAK,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AK,8BAA8B,GACpC,MAAM,yCAAyC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"csv.d.ts","sourceRoot":"","sources":["../../../src/utils/csv.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"csv.d.ts","sourceRoot":"","sources":["../../../src/utils/csv.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,SAAU;IAChC,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,SA2FA,CAAC"}
|
package/dist/esm/utils/csv.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { quillFormat } from './valueFormatter';
|
|
2
2
|
export const downloadCSV = (data) => {
|
|
3
3
|
const { rows, fields, name } = data;
|
|
4
4
|
// report.rows
|
|
@@ -10,11 +10,13 @@ export const downloadCSV = (data) => {
|
|
|
10
10
|
const newRows = [];
|
|
11
11
|
for (let i = 0; i < rows.length; i++) {
|
|
12
12
|
const newRow = {};
|
|
13
|
-
Object.keys(rows[i]).forEach((field) =>
|
|
14
|
-
|
|
15
|
-
field
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
Object.keys(rows[i]).forEach((field) => {
|
|
14
|
+
const fieldObj = fields.find((f) => f.field === field);
|
|
15
|
+
newRow[field] = quillFormat({
|
|
16
|
+
value: rows[i][field],
|
|
17
|
+
format: fieldObj?.format || 'text',
|
|
18
|
+
});
|
|
19
|
+
});
|
|
18
20
|
newRows.push(newRow);
|
|
19
21
|
}
|
|
20
22
|
const fieldsProcessed = fields?.map((col) => {
|