@quillsql/react 2.11.9 → 2.11.12
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/BarList.d.ts +2 -1
- package/dist/cjs/BarList.d.ts.map +1 -1
- package/dist/cjs/BarList.js +9 -3
- package/dist/cjs/Chart.d.ts +11 -5
- package/dist/cjs/Chart.d.ts.map +1 -1
- package/dist/cjs/Chart.js +57 -20
- package/dist/cjs/ChartBuilder.d.ts +16 -1
- package/dist/cjs/ChartBuilder.d.ts.map +1 -1
- package/dist/cjs/ChartBuilder.js +423 -281
- package/dist/cjs/ChartEditor.d.ts.map +1 -1
- package/dist/cjs/ChartEditor.js +1 -0
- package/dist/cjs/Dashboard.d.ts +2 -1
- package/dist/cjs/Dashboard.d.ts.map +1 -1
- package/dist/cjs/Dashboard.js +5 -19
- package/dist/cjs/PieChart.d.ts.map +1 -1
- package/dist/cjs/PieChart.js +2 -1
- package/dist/cjs/QuillProvider.d.ts.map +1 -1
- package/dist/cjs/QuillProvider.js +15 -1
- package/dist/cjs/ReportBuilder.d.ts +4 -3
- package/dist/cjs/ReportBuilder.d.ts.map +1 -1
- package/dist/cjs/ReportBuilder.js +76 -45
- package/dist/cjs/SQLEditor.d.ts +2 -1
- package/dist/cjs/SQLEditor.d.ts.map +1 -1
- package/dist/cjs/SQLEditor.js +60 -90
- package/dist/cjs/components/Chart/BarChart.d.ts +2 -1
- package/dist/cjs/components/Chart/BarChart.d.ts.map +1 -1
- package/dist/cjs/components/Chart/BarChart.js +10 -3
- package/dist/cjs/components/Chart/LineChart.d.ts +3 -4
- package/dist/cjs/components/Chart/LineChart.d.ts.map +1 -1
- package/dist/cjs/components/Chart/LineChart.js +32 -15
- package/dist/cjs/components/Dashboard/ChartComponent.d.ts.map +1 -1
- package/dist/cjs/components/Dashboard/ChartComponent.js +0 -3
- package/dist/cjs/components/Dashboard/DashboardSection.js +4 -4
- package/dist/cjs/components/Dashboard/DashboardSectionContainer.js +1 -1
- package/dist/cjs/components/Dashboard/DataLoader.d.ts +8 -1
- package/dist/cjs/components/Dashboard/DataLoader.d.ts.map +1 -1
- package/dist/cjs/components/Dashboard/DataLoader.js +12 -3
- package/dist/cjs/components/Dashboard/MetricComponent.d.ts +12 -1
- package/dist/cjs/components/Dashboard/MetricComponent.d.ts.map +1 -1
- package/dist/cjs/components/Dashboard/MetricComponent.js +105 -9
- 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 +78 -3
- package/dist/cjs/components/QuillTable.d.ts.map +1 -1
- package/dist/cjs/components/QuillTable.js +3 -1
- package/dist/cjs/components/ReportBuilder/AddSortPopover.d.ts.map +1 -1
- package/dist/cjs/components/ReportBuilder/AddSortPopover.js +5 -4
- package/dist/cjs/components/ReportBuilder/ast.d.ts +4 -0
- package/dist/cjs/components/ReportBuilder/ast.d.ts.map +1 -1
- package/dist/cjs/components/ReportBuilder/ast.js +10 -1
- package/dist/cjs/components/ReportBuilder/convert.d.ts +4 -1
- package/dist/cjs/components/ReportBuilder/convert.d.ts.map +1 -1
- package/dist/cjs/components/ReportBuilder/convert.js +45 -13
- package/dist/cjs/components/ReportBuilder/pivot.d.ts +3 -0
- package/dist/cjs/components/ReportBuilder/pivot.d.ts.map +1 -1
- package/dist/cjs/components/ReportBuilder/ui.d.ts.map +1 -1
- package/dist/cjs/components/ReportBuilder/ui.js +3 -2
- package/dist/cjs/components/ReportBuilder/util.d.ts +1 -0
- package/dist/cjs/components/ReportBuilder/util.d.ts.map +1 -1
- package/dist/cjs/components/ReportBuilder/util.js +48 -1
- package/dist/cjs/components/UiComponents.d.ts +3 -1
- package/dist/cjs/components/UiComponents.d.ts.map +1 -1
- package/dist/cjs/components/UiComponents.js +4 -4
- package/dist/cjs/hooks/useQuill.js +1 -1
- package/dist/cjs/internals/ReportBuilder/PivotModal.d.ts.map +1 -1
- package/dist/cjs/internals/ReportBuilder/PivotModal.js +65 -62
- package/dist/cjs/utils/axisFormatter.js +74 -30
- package/dist/cjs/utils/dataFetcher.d.ts.map +1 -1
- package/dist/cjs/utils/dataFetcher.js +10 -0
- package/dist/cjs/utils/getDomain.d.ts.map +1 -1
- package/dist/cjs/utils/getDomain.js +22 -4
- package/dist/cjs/utils/valueFormatter.d.ts +2 -1
- package/dist/cjs/utils/valueFormatter.d.ts.map +1 -1
- package/dist/esm/BarList.d.ts +2 -1
- package/dist/esm/BarList.d.ts.map +1 -1
- package/dist/esm/BarList.js +9 -3
- package/dist/esm/Chart.d.ts +11 -5
- package/dist/esm/Chart.d.ts.map +1 -1
- package/dist/esm/Chart.js +57 -20
- package/dist/esm/ChartBuilder.d.ts +16 -1
- package/dist/esm/ChartBuilder.d.ts.map +1 -1
- package/dist/esm/ChartBuilder.js +421 -280
- package/dist/esm/ChartEditor.d.ts.map +1 -1
- package/dist/esm/ChartEditor.js +1 -0
- package/dist/esm/Dashboard.d.ts +2 -1
- package/dist/esm/Dashboard.d.ts.map +1 -1
- package/dist/esm/Dashboard.js +5 -19
- package/dist/esm/PieChart.d.ts.map +1 -1
- package/dist/esm/PieChart.js +2 -1
- package/dist/esm/QuillProvider.d.ts.map +1 -1
- package/dist/esm/QuillProvider.js +16 -2
- package/dist/esm/ReportBuilder.d.ts +4 -3
- package/dist/esm/ReportBuilder.d.ts.map +1 -1
- package/dist/esm/ReportBuilder.js +80 -49
- package/dist/esm/SQLEditor.d.ts +2 -1
- package/dist/esm/SQLEditor.d.ts.map +1 -1
- package/dist/esm/SQLEditor.js +61 -91
- package/dist/esm/components/Chart/BarChart.d.ts +2 -1
- package/dist/esm/components/Chart/BarChart.d.ts.map +1 -1
- package/dist/esm/components/Chart/BarChart.js +10 -3
- package/dist/esm/components/Chart/LineChart.d.ts +3 -4
- package/dist/esm/components/Chart/LineChart.d.ts.map +1 -1
- package/dist/esm/components/Chart/LineChart.js +32 -15
- package/dist/esm/components/Dashboard/ChartComponent.d.ts.map +1 -1
- package/dist/esm/components/Dashboard/ChartComponent.js +0 -3
- package/dist/esm/components/Dashboard/DashboardSection.js +4 -4
- package/dist/esm/components/Dashboard/DashboardSectionContainer.js +1 -1
- package/dist/esm/components/Dashboard/DataLoader.d.ts +8 -1
- package/dist/esm/components/Dashboard/DataLoader.d.ts.map +1 -1
- package/dist/esm/components/Dashboard/DataLoader.js +13 -4
- package/dist/esm/components/Dashboard/MetricComponent.d.ts +12 -1
- package/dist/esm/components/Dashboard/MetricComponent.d.ts.map +1 -1
- package/dist/esm/components/Dashboard/MetricComponent.js +101 -8
- 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 +74 -2
- package/dist/esm/components/QuillTable.d.ts.map +1 -1
- package/dist/esm/components/QuillTable.js +3 -1
- package/dist/esm/components/ReportBuilder/AddSortPopover.d.ts.map +1 -1
- package/dist/esm/components/ReportBuilder/AddSortPopover.js +6 -5
- package/dist/esm/components/ReportBuilder/ast.d.ts +4 -0
- package/dist/esm/components/ReportBuilder/ast.d.ts.map +1 -1
- package/dist/esm/components/ReportBuilder/ast.js +8 -0
- package/dist/esm/components/ReportBuilder/convert.d.ts +4 -1
- package/dist/esm/components/ReportBuilder/convert.d.ts.map +1 -1
- package/dist/esm/components/ReportBuilder/convert.js +45 -13
- package/dist/esm/components/ReportBuilder/pivot.d.ts +3 -0
- package/dist/esm/components/ReportBuilder/pivot.d.ts.map +1 -1
- package/dist/esm/components/ReportBuilder/ui.d.ts.map +1 -1
- package/dist/esm/components/ReportBuilder/ui.js +3 -2
- package/dist/esm/components/ReportBuilder/util.d.ts +1 -0
- package/dist/esm/components/ReportBuilder/util.d.ts.map +1 -1
- package/dist/esm/components/ReportBuilder/util.js +46 -0
- package/dist/esm/components/UiComponents.d.ts +3 -1
- package/dist/esm/components/UiComponents.d.ts.map +1 -1
- package/dist/esm/components/UiComponents.js +4 -4
- package/dist/esm/hooks/useQuill.js +1 -1
- package/dist/esm/internals/ReportBuilder/PivotModal.d.ts.map +1 -1
- package/dist/esm/internals/ReportBuilder/PivotModal.js +65 -62
- package/dist/esm/utils/axisFormatter.js +74 -30
- package/dist/esm/utils/dataFetcher.d.ts.map +1 -1
- package/dist/esm/utils/dataFetcher.js +10 -0
- package/dist/esm/utils/getDomain.d.ts.map +1 -1
- package/dist/esm/utils/getDomain.js +22 -4
- package/dist/esm/utils/valueFormatter.d.ts +2 -1
- package/dist/esm/utils/valueFormatter.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../../src/components/ReportBuilder/util.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,eAAO,MAAM,qBAAqB,SAAU,GAAG,YAW9C,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,GAAG,WAa1C;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,GAAG,WAK5C;AAGD,eAAO,MAAM,WAAW,SAAU,GAAG,YAuBpC,CAAC;AAKF,eAAO,MAAM,oBAAoB,SAAU,GAAG,QAE7C,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,GAAG;;;;;;;;EAU3C;AAKD,eAAO,MAAM,eAAe,QAAS,GAAG,QAMvC,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,WAiBvD;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,GAAG,iBAQjD;AAED,wBAAgB,+BAA+B,CAC7C,IAAI,EAAE,GAAG,EACT,YAAY,EAAE,MAAM,GACnB,MAAM,GAAG,IAAI,CAOf;AAQD,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,GAAG,EACT,YAAY,EAAE,MAAM,GACnB,MAAM,GAAG,IAAI,CAWf;AAED,wBAAgB,gCAAgC,CAC9C,IAA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H,eAAO,MAAM,kBAAkB,SAAU,GAAG,QA4B3C,CAAC;AAGF,eAAO,MAAM,UAAU,eAAgB,MAAM,SAe5C,CAAC;AAmBF;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,GAAG,EAAE,YAAY,CAAC,EAAE,MAAM,UAsBvE;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,GAAG,UAgB9C;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,GAAG,EAAE,YAAY,CAAC,EAAE,MAAM,sBAetE;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,SAAU,GAAG,YAU1C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,SAAU,GAAG,YAOxC,CAAC;AAEF,wBAAgB,aAAa,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,WAehD;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,GAAG,GACV,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAyB1C;AAED,eAAO,MAAM,QAAQ,QAAS,GAAG,QAAoC,CAAC;AAEtE,eAAO,MAAM,QAAQ,MAAO,MAAM,WAA2C,CAAC;AA4L9E,eAAO,MAAM,iBAAiB,SAAU,GAAG;;;;;;;CAc1C,CAAC;AAqCF,wBAAgB,gCAAgC,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,OAQvE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// A collection of reusable, pure, utility functions for the Report Builder.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.getDateFilterInfo = exports.trimEndS = exports.deepCopy = exports.getPostgresBasicType = exports.showNodeAsRow = exports.isExtractEquals = exports.isDateTruncEquals = exports.tryConvertDateEquality = exports.extractSuffixToString = exports.dateTruncSuffixToString = exports.newUTCDate = exports.isColumnComparison = exports.isTheCurrentIntervalBigQuery = exports.isThePreviousInterval = exports.isTheCurrentInterval = exports.isInTheLastIntervalBigQuery = exports.isInTheLastInterval = exports.getInThePreviousIntervalSentence = exports.getInTheLastIntervalSentence = exports.getInTheCurrentIntervalSentence = exports.formatDateComparisonNode = exports.areObjectsEqualish = exports.isColumnDateish = exports.generateColumnExpr = exports.isColumnReferenceish = exports.isDateTrunc = exports.hasTopLevelOrBoolean = exports.isTopLevelBoolean = exports.isNodeEmptyCollection = void 0;
|
|
4
|
+
exports.removeNonSelectedTableReferences = exports.getDateFilterInfo = exports.trimEndS = exports.deepCopy = exports.getPostgresBasicType = exports.showNodeAsRow = exports.isExtractEquals = exports.isDateTruncEquals = exports.tryConvertDateEquality = exports.extractSuffixToString = exports.dateTruncSuffixToString = exports.newUTCDate = exports.isColumnComparison = exports.isTheCurrentIntervalBigQuery = exports.isThePreviousInterval = exports.isTheCurrentInterval = exports.isInTheLastIntervalBigQuery = exports.isInTheLastInterval = exports.getInThePreviousIntervalSentence = exports.getInTheLastIntervalSentence = exports.getInTheCurrentIntervalSentence = exports.formatDateComparisonNode = exports.areObjectsEqualish = exports.isColumnDateish = exports.generateColumnExpr = exports.isColumnReferenceish = exports.isDateTrunc = exports.hasTopLevelOrBoolean = exports.isTopLevelBoolean = exports.isNodeEmptyCollection = void 0;
|
|
5
5
|
const date_fns_1 = require("date-fns");
|
|
6
6
|
const bigDateMap_1 = require("./bigDateMap");
|
|
7
7
|
/**
|
|
@@ -646,3 +646,50 @@ const getDateFilterInfo = (node) => {
|
|
|
646
646
|
};
|
|
647
647
|
};
|
|
648
648
|
exports.getDateFilterInfo = getDateFilterInfo;
|
|
649
|
+
// NEED TO UPDATE FOR MORE POTENTIAL CASES
|
|
650
|
+
function getNodeTable(node) {
|
|
651
|
+
if (node.table) {
|
|
652
|
+
return node.table;
|
|
653
|
+
}
|
|
654
|
+
if (node.args && node.args.value[0].table) {
|
|
655
|
+
return node.args.value[0].table;
|
|
656
|
+
}
|
|
657
|
+
return null;
|
|
658
|
+
}
|
|
659
|
+
// Recursively remove filters that don't apply to the given table
|
|
660
|
+
function removeNonSelectedTableFilters(node, table) {
|
|
661
|
+
if (node.left.type !== 'binary_expr') {
|
|
662
|
+
const referencedTable = getNodeTable(node.left);
|
|
663
|
+
if (referencedTable && referencedTable !== table) {
|
|
664
|
+
return null;
|
|
665
|
+
}
|
|
666
|
+
else {
|
|
667
|
+
return node;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
node.left = removeNonSelectedTableFilters(node.left, table);
|
|
671
|
+
node.right = removeNonSelectedTableFilters(node.right, table);
|
|
672
|
+
if (node.left && node.right) {
|
|
673
|
+
return node;
|
|
674
|
+
}
|
|
675
|
+
else if (node.left) {
|
|
676
|
+
return node.left;
|
|
677
|
+
}
|
|
678
|
+
else if (node.right) {
|
|
679
|
+
return node.right;
|
|
680
|
+
}
|
|
681
|
+
else {
|
|
682
|
+
return null;
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
function removeNonSelectedTableReferences(ast, table) {
|
|
686
|
+
ast.columns = ast.columns.filter((col) => {
|
|
687
|
+
return col.table === table || col.expr.table === table || !col.expr.table;
|
|
688
|
+
});
|
|
689
|
+
if (!ast.where)
|
|
690
|
+
return ast;
|
|
691
|
+
ast.where = removeNonSelectedTableFilters(ast.where, table);
|
|
692
|
+
console.log(ast);
|
|
693
|
+
return ast;
|
|
694
|
+
}
|
|
695
|
+
exports.removeNonSelectedTableReferences = removeNonSelectedTableReferences;
|
|
@@ -14,6 +14,7 @@ export interface SelectComponentProps {
|
|
|
14
14
|
export interface ButtonComponentProps {
|
|
15
15
|
onClick: () => void;
|
|
16
16
|
label: string;
|
|
17
|
+
isLoading?: boolean | undefined;
|
|
17
18
|
primary?: boolean;
|
|
18
19
|
width?: string;
|
|
19
20
|
}
|
|
@@ -67,10 +68,11 @@ export declare const MemoizedTextInput: ({ value, onChange, placeholder, id }: {
|
|
|
67
68
|
placeholder: any;
|
|
68
69
|
id: any;
|
|
69
70
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
70
|
-
export declare const MemoizedButton: ({ label, onClick, primary }: {
|
|
71
|
+
export declare const MemoizedButton: ({ label, onClick, primary, isLoading, }: {
|
|
71
72
|
label: any;
|
|
72
73
|
onClick: any;
|
|
73
74
|
primary?: boolean | undefined;
|
|
75
|
+
isLoading?: boolean | undefined;
|
|
74
76
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
75
77
|
export declare const MemoizedSecondaryButton: ({ label, onClick }: {
|
|
76
78
|
label: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UiComponents.d.ts","sourceRoot":"","sources":["../../../src/components/UiComponents.tsx"],"names":[],"mappings":"AACA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAK7D,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,GAAG,CAAC;CACZ;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,gBAAgB,CAA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O,MAAM,YAAY;;6CAYxB,CAAC;AAsBF,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,GAAG,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,GAAG,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CACtC;AAED,wBAAgB,eAAe,CAAC,EAC9B,OAAO,EACP,SAAS,EACT,QAAQ,EACR,KAAU,EACV,OAAO,EACP,WAAkB,EAClB,MAAM,EACN,KAAK,EACL,SAAS,GACV,EAAE,oBAAoB,2CA2DtB;AAED,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,OAAO,EACP,SAAS,EACT,KAAK,EACL,QAAQ,EACR,KAAK,EACL,KAAU,GACX;;;;;;;;CAAA,kDA4FA;AAED,eAAO,MAAM,oBAAoB;;;6CA0BhC,CAAC;AAEF,eAAO,MAAM,cAAc,+CAwD1B,CAAC"}
|
|
@@ -31,7 +31,7 @@ const MemoizedTextInput = ({ value, onChange, placeholder, id }) => {
|
|
|
31
31
|
.quill-text-input {
|
|
32
32
|
background-color: white;
|
|
33
33
|
height: 40px;
|
|
34
|
-
width:
|
|
34
|
+
width: 100%;
|
|
35
35
|
color: #384151;
|
|
36
36
|
border: 1px solid #e7e7e7;
|
|
37
37
|
border-radius: 6px;
|
|
@@ -41,11 +41,11 @@ const MemoizedTextInput = ({ value, onChange, placeholder, id }) => {
|
|
|
41
41
|
padding-right: 12px;
|
|
42
42
|
padding-top: 0px;
|
|
43
43
|
padding-bottom: 0px;
|
|
44
|
-
box-sizing:
|
|
44
|
+
box-sizing: border-box;
|
|
45
45
|
}` }), (0, jsx_runtime_1.jsx)("input", { id: id, className: "quill-text-input", type: "text", value: value, onChange: (event) => onChange(event.target.value), placeholder: placeholder, style: { fontFamily: theme?.fontFamily } })] }));
|
|
46
46
|
};
|
|
47
47
|
exports.MemoizedTextInput = MemoizedTextInput;
|
|
48
|
-
const MemoizedButton = ({ label, onClick, primary = true }) => {
|
|
48
|
+
const MemoizedButton = ({ label, onClick, primary = true, isLoading = false, }) => {
|
|
49
49
|
const [theme] = (0, react_1.useContext)(Context_1.ThemeContext);
|
|
50
50
|
return ((0, jsx_runtime_1.jsxs)("button", { className: "quill-button", onClick: onClick, style: { fontFamily: theme?.fontFamily }, children: [(0, jsx_runtime_1.jsx)("style", { children: `
|
|
51
51
|
.quill-button {
|
|
@@ -65,7 +65,7 @@ const MemoizedButton = ({ label, onClick, primary = true }) => {
|
|
|
65
65
|
.quill-button:hover {
|
|
66
66
|
background-color: rgba(56, 65, 81, 0.9);
|
|
67
67
|
border-radius: 6px;
|
|
68
|
-
}` }), label] }));
|
|
68
|
+
}` }), isLoading ? ((0, jsx_runtime_1.jsx)("div", { style: { padding: '0px 16px' }, children: (0, jsx_runtime_1.jsx)(exports.LoadingSpinner, {}) })) : (label)] }));
|
|
69
69
|
};
|
|
70
70
|
exports.MemoizedButton = MemoizedButton;
|
|
71
71
|
const MemoizedSecondaryButton = ({ label, onClick }) => {
|
|
@@ -43,7 +43,7 @@ const useQuill = (chartId) => {
|
|
|
43
43
|
};
|
|
44
44
|
const resp = await (0, dataFetcher_1.getData)(client, 'itempost', 'same-origin', hostedBody, cloudBody);
|
|
45
45
|
if (resp) {
|
|
46
|
-
if (resp.name === 'error') {
|
|
46
|
+
if (resp.name === 'error' || resp.errorMessage) {
|
|
47
47
|
setError(JSON.stringify(resp));
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PivotModal.d.ts","sourceRoot":"","sources":["../../../../src/internals/ReportBuilder/PivotModal.tsx"],"names":[],"mappings":"AA+BA,MAAM,WAAW,KAAK;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAkBD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"PivotModal.d.ts","sourceRoot":"","sources":["../../../../src/internals/ReportBuilder/PivotModal.tsx"],"names":[],"mappings":"AA+BA,MAAM,WAAW,KAAK;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAkBD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6CAotBtB,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,KAAK,KAAA,EAAE,IAAI,KAAA,EAAE,MAAM,KAAA,OAyB1D;AAkHD,wBAAgB,WAAW,CAAC,SAAS,KAAA,WAYpC;AAgCD,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,GAAG,EACT,SAAS,EAAE,GAAG,EACd,YAAY,EAAE,OAAO,EACrB,QAAQ,SAAK,EACb,SAAS,GAAE,GAAU;;;;;;EA6atB"}
|
|
@@ -132,6 +132,9 @@ const PivotModal = ({ pivotRowField, setPivotRowField, pivotColumnField, setPivo
|
|
|
132
132
|
onEditPivot(pivot, null);
|
|
133
133
|
};
|
|
134
134
|
const refreshPivots = (0, react_1.useCallback)(async () => {
|
|
135
|
+
if (!showTrigger) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
135
138
|
if (isLoading || Object.keys(columnsToShow).length === 0) {
|
|
136
139
|
return;
|
|
137
140
|
}
|
|
@@ -150,50 +153,6 @@ const PivotModal = ({ pivotRowField, setPivotRowField, pivotColumnField, setPivo
|
|
|
150
153
|
try {
|
|
151
154
|
const resp = await (0, dataFetcher_1.getDataFromCloud)(client, 'pivotai', cloudBody);
|
|
152
155
|
const recommendedPivots = resp?.data?.pivotTables.slice(0, recommendPivotCount) || [];
|
|
153
|
-
// for testing if needed
|
|
154
|
-
// const recommendedPivots = [
|
|
155
|
-
// {
|
|
156
|
-
// title: 'Total Amount by Merchant',
|
|
157
|
-
// rowField: 'merchant',
|
|
158
|
-
// valueField: 'amount',
|
|
159
|
-
// aggregationType: 'sum',
|
|
160
|
-
// },
|
|
161
|
-
// {
|
|
162
|
-
// title: 'Average Amount by User and Category',
|
|
163
|
-
// rowField: 'user_name',
|
|
164
|
-
// columnField: 'category',
|
|
165
|
-
// valueField: 'amount',
|
|
166
|
-
// aggregationType: 'average',
|
|
167
|
-
// },
|
|
168
|
-
// {
|
|
169
|
-
// title: 'Count of Transactions by User and Merchant',
|
|
170
|
-
// rowField: 'user_name',
|
|
171
|
-
// columnField: 'merchant',
|
|
172
|
-
// valueField: 'id',
|
|
173
|
-
// aggregationType: 'count',
|
|
174
|
-
// },
|
|
175
|
-
// {
|
|
176
|
-
// title: 'Total Amount by Merchant and Category',
|
|
177
|
-
// rowField: 'merchant',
|
|
178
|
-
// columnField: 'category',
|
|
179
|
-
// valueField: 'amount',
|
|
180
|
-
// aggregationType: 'sum',
|
|
181
|
-
// },
|
|
182
|
-
// {
|
|
183
|
-
// title: 'Average Amount by Category and Date',
|
|
184
|
-
// rowField: 'category',
|
|
185
|
-
// columnField: 'created_at',
|
|
186
|
-
// valueField: 'amount',
|
|
187
|
-
// aggregationType: 'average',
|
|
188
|
-
// },
|
|
189
|
-
// {
|
|
190
|
-
// title: 'Count of Transactions by Date and Category',
|
|
191
|
-
// rowField: 'created_at',
|
|
192
|
-
// columnField: 'category',
|
|
193
|
-
// valueField: 'id',
|
|
194
|
-
// aggregationType: 'count',
|
|
195
|
-
// },
|
|
196
|
-
// ];
|
|
197
156
|
setRecommendedPivots(recommendedPivots
|
|
198
157
|
.filter((pivot) => pivot.rowField != '')
|
|
199
158
|
.map((pivot) => {
|
|
@@ -210,7 +169,7 @@ const PivotModal = ({ pivotRowField, setPivotRowField, pivotColumnField, setPivo
|
|
|
210
169
|
console.error('Failed parsing pivotai response', e);
|
|
211
170
|
}
|
|
212
171
|
setIsLoading(false);
|
|
213
|
-
}, [selectedTable, data, columnsToShow, isLoading]);
|
|
172
|
+
}, [selectedTable, data, columnsToShow, isLoading, showTrigger]);
|
|
214
173
|
(0, react_1.useEffect)(() => {
|
|
215
174
|
if (recommendedPivots.length === 0) {
|
|
216
175
|
refreshPivots();
|
|
@@ -302,7 +261,6 @@ const PivotModal = ({ pivotRowField, setPivotRowField, pivotColumnField, setPivo
|
|
|
302
261
|
}, children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(LabelComponent, { children: "Row Field" }), (0, jsx_runtime_1.jsx)(SelectComponent, { id: "pivot-row-field", value: pivotRowField, onChange: (e) => {
|
|
303
262
|
setPivotRowField(e === '' ? undefined : e);
|
|
304
263
|
}, options: [
|
|
305
|
-
{ label: 'Select', value: '' },
|
|
306
264
|
...columnSelectOptions.filter((option) => {
|
|
307
265
|
const format = columns.find((col) => col.field === option.value)?.format;
|
|
308
266
|
return (format === 'string' ||
|
|
@@ -311,7 +269,6 @@ const PivotModal = ({ pivotRowField, setPivotRowField, pivotColumnField, setPivo
|
|
|
311
269
|
], theme: theme })] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(LabelComponent, { children: "Column Field" }), (0, jsx_runtime_1.jsx)(SelectComponent, { id: "pivot-row-field", value: pivotColumnField, onChange: (e) => {
|
|
312
270
|
setPivotColumnField(e === '' ? undefined : e);
|
|
313
271
|
}, options: [
|
|
314
|
-
{ label: 'Select', value: '' },
|
|
315
272
|
...columnSelectOptions.filter((option) => {
|
|
316
273
|
return (columns.find((col) => col.field === option.value)
|
|
317
274
|
?.format === 'string');
|
|
@@ -323,18 +280,12 @@ const PivotModal = ({ pivotRowField, setPivotRowField, pivotColumnField, setPivo
|
|
|
323
280
|
marginBottom: 20,
|
|
324
281
|
}, children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(LabelComponent, { children: "Value Field" }), (0, jsx_runtime_1.jsx)(SelectComponent, { id: "pivot-row-field", value: pivotValueField, onChange: (e) => {
|
|
325
282
|
setPivotValueField(e === '' ? undefined : e);
|
|
326
|
-
}, options:
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
{ label: 'Select', value: '' },
|
|
333
|
-
...columnSelectOptions.filter((option) => {
|
|
334
|
-
return (option.value === '' ||
|
|
335
|
-
ChartBuilder_1.numberFormatOptions.includes(columns.find((col) => col.field === option.value)?.format));
|
|
336
|
-
}),
|
|
337
|
-
], theme: theme })] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(LabelComponent, { children: "Aggregation Type" }), (0, jsx_runtime_1.jsx)(SelectComponent, { id: "pivot-row-field", value: pivotAggregation, theme: theme, onChange: (e) => {
|
|
283
|
+
}, options: [
|
|
284
|
+
...columnSelectOptions.filter((option) => {
|
|
285
|
+
return (option.value === '' ||
|
|
286
|
+
ChartBuilder_1.numberFormatOptions.includes(columns.find((col) => col.field === option.value)?.format));
|
|
287
|
+
}),
|
|
288
|
+
], theme: theme })] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(LabelComponent, { children: "Aggregation Type" }), (0, jsx_runtime_1.jsx)(SelectComponent, { id: "pivot-row-field", value: pivotAggregation, theme: theme, onChange: (e) => {
|
|
338
289
|
if (e !== 'count' &&
|
|
339
290
|
pivotValueField &&
|
|
340
291
|
!ChartBuilder_1.numberFormatOptions.includes(columns.find((col) => col.field === pivotValueField)?.format)) {
|
|
@@ -342,8 +293,7 @@ const PivotModal = ({ pivotRowField, setPivotRowField, pivotColumnField, setPivo
|
|
|
342
293
|
}
|
|
343
294
|
setPivotAggregation(e === '' ? undefined : e);
|
|
344
295
|
}, options: [
|
|
345
|
-
|
|
346
|
-
...['sum', 'average', 'count'].map((option) => {
|
|
296
|
+
...['sum', 'average', 'count', 'max', 'min'].map((option) => {
|
|
347
297
|
return { label: option, value: option };
|
|
348
298
|
}),
|
|
349
299
|
] })] })] })] }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(ButtonComponent, { id: "custom-button", onClick: () => {
|
|
@@ -581,7 +531,7 @@ const handleBigQueryValue = (value) => {
|
|
|
581
531
|
return value;
|
|
582
532
|
};
|
|
583
533
|
// Process out all the BigQuery dates.
|
|
584
|
-
const fixBigQueryData = (data) => {
|
|
534
|
+
const fixBigQueryData = (data = []) => {
|
|
585
535
|
const newData = [];
|
|
586
536
|
for (const row of data) {
|
|
587
537
|
const newRow = {};
|
|
@@ -593,6 +543,10 @@ const fixBigQueryData = (data) => {
|
|
|
593
543
|
return newData;
|
|
594
544
|
};
|
|
595
545
|
function generatePivotTable(pivot, data, dateRange, isComparison, rowLimit = -1, compRange = null) {
|
|
546
|
+
// If there is no rowField, aggregate on the valueField
|
|
547
|
+
if (!pivot.rowField) {
|
|
548
|
+
return valueFieldAggregation(data, pivot.valueField, pivot.aggregationType);
|
|
549
|
+
}
|
|
596
550
|
// Handle edge-case for BigQuery objects.
|
|
597
551
|
data = fixBigQueryData(data);
|
|
598
552
|
if (dateRange[0] === null && dateRange[1] === null) {
|
|
@@ -820,6 +774,18 @@ function generatePivotTable(pivot, data, dateRange, isComparison, rowLimit = -1,
|
|
|
820
774
|
: 0;
|
|
821
775
|
}
|
|
822
776
|
break;
|
|
777
|
+
case 'max':
|
|
778
|
+
value = filteredData.reduce((max, item) => Math.max(max, parseFloat(item[key] ?? 0)), -Infinity);
|
|
779
|
+
if (isComparison) {
|
|
780
|
+
comparisonValue = comparisonFilteredData.reduce((max, item) => Math.max(max, parseFloat(item[key] ?? 0)), -Infinity);
|
|
781
|
+
}
|
|
782
|
+
break;
|
|
783
|
+
case 'min':
|
|
784
|
+
value = filteredData.reduce((min, item) => Math.min(min, parseFloat(item[key] ?? 0)), Infinity);
|
|
785
|
+
if (isComparison) {
|
|
786
|
+
comparisonValue = comparisonFilteredData.reduce((min, item) => Math.min(min, parseFloat(item[key] ?? 0)), Infinity);
|
|
787
|
+
}
|
|
788
|
+
break;
|
|
823
789
|
// Implement other aggregation types as needed
|
|
824
790
|
default:
|
|
825
791
|
throw new Error('Unsupported aggregation type');
|
|
@@ -898,9 +864,15 @@ function generatePivotTable(pivot, data, dateRange, isComparison, rowLimit = -1,
|
|
|
898
864
|
if (pivot.sort) {
|
|
899
865
|
pivotRows.sort((a, b) => {
|
|
900
866
|
if (pivot.sortDirection === 'ASC') {
|
|
867
|
+
if (pivot.rowFieldType === 'date') {
|
|
868
|
+
return new Date(a[pivot.rowField]) - new Date(b[pivot.rowField]);
|
|
869
|
+
}
|
|
901
870
|
return a[pivot.rowField].localeCompare(b[pivot.rowField]);
|
|
902
871
|
}
|
|
903
872
|
else {
|
|
873
|
+
if (pivot.rowFieldType === 'date') {
|
|
874
|
+
return new Date(b[pivot.rowField]) - new Date(a[pivot.rowField]);
|
|
875
|
+
}
|
|
904
876
|
return b[pivot.rowField].localeCompare(a[pivot.rowField]);
|
|
905
877
|
}
|
|
906
878
|
});
|
|
@@ -908,3 +880,34 @@ function generatePivotTable(pivot, data, dateRange, isComparison, rowLimit = -1,
|
|
|
908
880
|
return { rows: pivotRows, columns };
|
|
909
881
|
}
|
|
910
882
|
exports.generatePivotTable = generatePivotTable;
|
|
883
|
+
function valueFieldAggregation(data, valueField, aggregationType) {
|
|
884
|
+
let value;
|
|
885
|
+
switch (aggregationType) {
|
|
886
|
+
case 'sum':
|
|
887
|
+
value = data.reduce((sum, item) => sum + parseFloat(item[valueField] ?? 0), 0);
|
|
888
|
+
break;
|
|
889
|
+
case 'count':
|
|
890
|
+
value = filteredData.length;
|
|
891
|
+
break;
|
|
892
|
+
case 'average':
|
|
893
|
+
value = filteredData.length
|
|
894
|
+
? filteredData.reduce((sum, item) => sum + parseFloat(item[valueField] ?? 0), 0) / filteredData.length
|
|
895
|
+
: 0;
|
|
896
|
+
break;
|
|
897
|
+
case 'max':
|
|
898
|
+
value = data.reduce((max, item) => Math.max(max, parseFloat(item[valueField] ?? 0)), -Infinity);
|
|
899
|
+
break;
|
|
900
|
+
case 'min':
|
|
901
|
+
value = data.reduce((min, item) => Math.min(min, parseFloat(item[valueField] ?? 0)), Infinity);
|
|
902
|
+
break;
|
|
903
|
+
// Implement other aggregation types as needed
|
|
904
|
+
default:
|
|
905
|
+
throw new Error('Unsupported aggregation type');
|
|
906
|
+
}
|
|
907
|
+
const row = {};
|
|
908
|
+
row[valueField] = value;
|
|
909
|
+
return {
|
|
910
|
+
rows: [row],
|
|
911
|
+
columns: [{ label: (0, textProcessing_1.snakeCaseToTitleCase)(valueField), field: valueField }],
|
|
912
|
+
};
|
|
913
|
+
}
|
|
@@ -53,51 +53,83 @@ const formatString = (value) => {
|
|
|
53
53
|
}
|
|
54
54
|
return value.toString();
|
|
55
55
|
};
|
|
56
|
+
// Formats large numbers like 12345.67 -> $12K
|
|
57
|
+
const formatterBigDollars = new Intl.NumberFormat('en-US', {
|
|
58
|
+
style: 'currency',
|
|
59
|
+
currency: 'USD',
|
|
60
|
+
minimumSignificantDigits: 1,
|
|
61
|
+
maximumSignificantDigits: 2,
|
|
62
|
+
notation: 'compact',
|
|
63
|
+
compactDisplay: 'short',
|
|
64
|
+
});
|
|
65
|
+
// Formats to dollars like 1234.56 -> $1235
|
|
66
|
+
const formatterDollar = new Intl.NumberFormat('en-US', {
|
|
67
|
+
style: 'currency',
|
|
68
|
+
currency: 'USD',
|
|
69
|
+
maximumFractionDigits: 0,
|
|
70
|
+
});
|
|
71
|
+
// Formats to dollars like 1234.567 -> $1234.57
|
|
72
|
+
const formatterDollarsCents = new Intl.NumberFormat('en-US', {
|
|
73
|
+
style: 'currency',
|
|
74
|
+
currency: 'USD',
|
|
75
|
+
minimumFractionDigits: 2,
|
|
76
|
+
maximumFractionDigits: 2,
|
|
77
|
+
});
|
|
56
78
|
/**
|
|
57
|
-
* Formats the value as a (rounded) currency amount in dollars.
|
|
79
|
+
* Formats the value as a (rounded) currency amount in dollars. If value is
|
|
80
|
+
* zero, returns '$0' with no cents. If value is greater than or equal to 1000,
|
|
81
|
+
* it will not show cents and shorten the value with a suffix such as K
|
|
82
|
+
* (for thousands) or M (for millions).
|
|
58
83
|
*
|
|
59
|
-
*
|
|
84
|
+
* @example format(1,234,567) => "$1.2M"
|
|
85
|
+
* @example format(1234.567) => "$1.2K"
|
|
86
|
+
* @example format(5000) => "$5K"
|
|
87
|
+
* @example format(123.45) => "$123"
|
|
88
|
+
* @example format(0.00) => "$0"
|
|
60
89
|
*/
|
|
61
90
|
const formatDollarAmount = (value) => {
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
});
|
|
70
|
-
return formatter.format(Number(value ?? 0));
|
|
91
|
+
const num = Number(value ?? 0);
|
|
92
|
+
if (num >= 1000 || num === 0) {
|
|
93
|
+
return formatterBigDollars.format(num);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
return formatterDollar.format(num);
|
|
97
|
+
}
|
|
71
98
|
};
|
|
72
99
|
/**
|
|
73
|
-
* Formats the value as a (rounded) currency amount in dollars and cents.
|
|
100
|
+
* Formats the value as a (rounded) currency amount in dollars and cents. If
|
|
101
|
+
* value is zero, returns '$0' with no cents. If value is greater than or equal
|
|
102
|
+
* to 1000, it will not show cents and shorten the value with a suffix such
|
|
103
|
+
* as K (for thousands) or M (for millions).
|
|
74
104
|
*
|
|
105
|
+
* @example format(1,234,567) => "$1.2M"
|
|
75
106
|
* @example format(1234.567) => "$1.2K"
|
|
107
|
+
* @example format(5000) => "$5K"
|
|
108
|
+
* @example format(123.45) => "$123.45"
|
|
109
|
+
* @example format(0.00) => "$0"
|
|
76
110
|
*/
|
|
77
111
|
const formatDollarCents = (value) => {
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
});
|
|
86
|
-
return formatter.format(Number(value ?? 0));
|
|
112
|
+
const num = Number(value ?? 0);
|
|
113
|
+
if (num >= 1000 || num === 0) {
|
|
114
|
+
return formatterBigDollars.format(num);
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
return formatterDollarsCents.format(num);
|
|
118
|
+
}
|
|
87
119
|
};
|
|
120
|
+
const formatterBigWholeNumber = new Intl.NumberFormat('en-US', {
|
|
121
|
+
minimumSignificantDigits: 1,
|
|
122
|
+
maximumSignificantDigits: 2,
|
|
123
|
+
notation: 'compact',
|
|
124
|
+
compactDisplay: 'short',
|
|
125
|
+
});
|
|
88
126
|
/**
|
|
89
127
|
* Formats the value as a (rounded) integer.
|
|
90
128
|
*
|
|
91
129
|
* @example format(1234.567) => "1.2K"
|
|
92
130
|
*/
|
|
93
131
|
const formatWholeNumber = (value) => {
|
|
94
|
-
|
|
95
|
-
minimumSignificantDigits: 2,
|
|
96
|
-
maximumSignificantDigits: 2,
|
|
97
|
-
notation: 'compact',
|
|
98
|
-
compactDisplay: 'short',
|
|
99
|
-
});
|
|
100
|
-
return formatter.format(Number(value));
|
|
132
|
+
return formatterBigWholeNumber.format(Number(value));
|
|
101
133
|
};
|
|
102
134
|
/**
|
|
103
135
|
* Formats the value as a number rounded to exactly one decimal place.
|
|
@@ -112,7 +144,13 @@ const formatOneDecimalPlace = (value) => {
|
|
|
112
144
|
notation: 'compact',
|
|
113
145
|
compactDisplay: 'short',
|
|
114
146
|
});
|
|
115
|
-
|
|
147
|
+
const num = Number(value ?? 0);
|
|
148
|
+
if (num >= 1000 || num === 0) {
|
|
149
|
+
return formatterBigWholeNumber.format(num);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
return formatter.format(num);
|
|
153
|
+
}
|
|
116
154
|
};
|
|
117
155
|
/**
|
|
118
156
|
* Formats the value as a number rounded to exactly two decimal places.
|
|
@@ -127,7 +165,13 @@ const formatTwoDecimalPlaces = (value) => {
|
|
|
127
165
|
notation: 'compact',
|
|
128
166
|
compactDisplay: 'short',
|
|
129
167
|
});
|
|
130
|
-
|
|
168
|
+
const num = Number(value ?? 0);
|
|
169
|
+
if (num >= 1000 || num === 0) {
|
|
170
|
+
return formatterBigWholeNumber.format(num);
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
return formatter.format(num);
|
|
174
|
+
}
|
|
131
175
|
};
|
|
132
176
|
/**
|
|
133
177
|
* Formats the value as a percentage.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataFetcher.d.ts","sourceRoot":"","sources":["../../../src/utils/dataFetcher.tsx"],"names":[],"mappings":"AAEA,wBAAsB,OAAO,CAC3B,MAAM,EAAE,GAAG,EACX,kBAAkB,EAAE,MAAM,EAC1B,MAAM,EAAE,kBAAkB,EAC1B,iBAAiB,EAAE,GAAG,EACtB,gBAAgB,EAAE,GAAG,EACrB,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"dataFetcher.d.ts","sourceRoot":"","sources":["../../../src/utils/dataFetcher.tsx"],"names":[],"mappings":"AAEA,wBAAsB,OAAO,CAC3B,MAAM,EAAE,GAAG,EACX,kBAAkB,EAAE,MAAM,EAC1B,MAAM,EAAE,kBAAkB,EAC1B,iBAAiB,EAAE,GAAG,EACtB,gBAAgB,EAAE,GAAG,EACrB,MAAM,SAAS,gBA8DhB;AAED,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,GAAG,EACX,kBAAkB,EAAE,MAAM,EAC1B,gBAAgB,EAAE,GAAG,EACrB,MAAM,SAAS,gBA+BhB"}
|
|
@@ -35,6 +35,16 @@ async function getData(client, cloudQueryEndpoint, noCred, hostedRequestBody, cl
|
|
|
35
35
|
compareRows: responseJson?.queries?.queryResults[1]?.rows,
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
+
if (responseJson.data.columns &&
|
|
39
|
+
responseJson.data.fields &&
|
|
40
|
+
responseJson.data.columns.length != responseJson.data.fields) {
|
|
41
|
+
// Remove all columns that don't appear in fields, overtime this should never be the case
|
|
42
|
+
const columns = responseJson.data.columns.filter((columns) => responseJson.data.fields.find((field) => field.name === columns.field));
|
|
43
|
+
result = {
|
|
44
|
+
...result,
|
|
45
|
+
columns,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
38
48
|
return result;
|
|
39
49
|
}
|
|
40
50
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDomain.d.ts","sourceRoot":"","sources":["../../../src/utils/getDomain.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"getDomain.d.ts","sourceRoot":"","sources":["../../../src/utils/getDomain.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,EAAE,CA0BtE"}
|
|
@@ -23,9 +23,27 @@ function getDomain(data, fields) {
|
|
|
23
23
|
});
|
|
24
24
|
});
|
|
25
25
|
const [minValue, maxValue] = numericValues.reduce(([min, max], value) => [Math.min(min, value), Math.max(max, value)], [Infinity, -Infinity]);
|
|
26
|
-
|
|
27
|
-
const padding = Math.round(0.2 * (maxValue - minValue));
|
|
28
|
-
const adjustedMax = maxValue + padding;
|
|
29
|
-
return [adjustedMin, adjustedMax];
|
|
26
|
+
return fuzzyRound(Math.min(minValue, 0), maxValue);
|
|
30
27
|
}
|
|
31
28
|
exports.default = getDomain;
|
|
29
|
+
// Rounds the range to 4 equally-spaced increments of nice,round numbers.
|
|
30
|
+
function fuzzyRound(min, max) {
|
|
31
|
+
const range = parseFloat((max - min).toPrecision(1));
|
|
32
|
+
const increment = Math.ceil(range / 4);
|
|
33
|
+
let newMin = min;
|
|
34
|
+
// if (min % increment !== 0) {
|
|
35
|
+
// newMin = min - (min % increment);
|
|
36
|
+
// }
|
|
37
|
+
if (Number.isNaN(newMin)) {
|
|
38
|
+
newMin = 0;
|
|
39
|
+
}
|
|
40
|
+
let newMax = min + increment * 4;
|
|
41
|
+
if (max % increment !== 0) {
|
|
42
|
+
const adjMax = max + (increment - (max % increment));
|
|
43
|
+
newMax = parseFloat(adjMax.toPrecision(2));
|
|
44
|
+
}
|
|
45
|
+
if (Number.isNaN(newMax)) {
|
|
46
|
+
newMax = 0;
|
|
47
|
+
}
|
|
48
|
+
return [newMin ?? 0, newMax ?? 0];
|
|
49
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"valueFormatter.d.ts","sourceRoot":"","sources":["../../../src/utils/valueFormatter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"valueFormatter.d.ts","sourceRoot":"","sources":["../../../src/utils/valueFormatter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,KAAK,KAAK,GAAG;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,UAAU,CAAC;CACpB,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,GAAG,CAAC;IACX,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IACjC,MAAM,EAAE,KAAK,EAAE,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,iBAAiB,UAQ7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,6BAA8B,KAAK,KAAG,MAwChE,CAAC;AAEF,eAAO,MAAM,WAAW;WAIf,GAAG;YACF,MAAM;MACZ,MAoCH,CAAC;AAmJF,eAAO,MAAM,aAAa;;;;WAGhB,MAAM,KACb,MA2BF,CAAC"}
|
package/dist/esm/BarList.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { type ColorMapType } from './Chart';
|
|
2
3
|
interface YAxisField {
|
|
3
4
|
label: string;
|
|
4
5
|
field: string;
|
|
@@ -14,7 +15,7 @@ export interface BarListProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
14
15
|
containerStyle: any;
|
|
15
16
|
xAxisFormat: string;
|
|
16
17
|
colors?: string[];
|
|
17
|
-
colorMap?:
|
|
18
|
+
colorMap?: ColorMapType;
|
|
18
19
|
theme: any;
|
|
19
20
|
}
|
|
20
21
|
export declare function hexToRgbaWith10PercentAlpha(hex: any): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BarList.d.ts","sourceRoot":"","sources":["../../src/BarList.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"BarList.d.ts","sourceRoot":"","sources":["../../src/BarList.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAcxC,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAuB5C,UAAU,UAAU;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,YAAa,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IACxE,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,cAAc,CAAC,EAAE,GAAG,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,cAAc,EAAE,GAAG,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,KAAK,EAAE,GAAG,CAAC;CACZ;AAYD,wBAAgB,2BAA2B,CAAC,GAAG,KAAA,UAW9C;AAED,QAAA,MAAM,OAAO,qFAwdX,CAAC;AAEH,eAAe,OAAO,CAAC"}
|