@qrvey/utils 1.18.9 → 1.18.10
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/README.md +1 -1
- package/dist/cjs/column_format/constants/COUNT_SUPPORTED_FORMATS.js +7 -0
- package/dist/cjs/column_format/constants/index.js +1 -0
- package/dist/cjs/column_format/helpers/defineTableChartFormat.js +10 -4
- package/dist/cjs/column_format/helpers/defineXYChartFormat.js +7 -2
- package/dist/column_format/constants/COUNT_SUPPORTED_FORMATS.d.ts +1 -0
- package/dist/column_format/constants/COUNT_SUPPORTED_FORMATS.js +4 -0
- package/dist/column_format/constants/index.d.ts +1 -0
- package/dist/column_format/constants/index.js +1 -0
- package/dist/column_format/helpers/defineTableChartFormat.js +10 -4
- package/dist/column_format/helpers/defineXYChartFormat.js +7 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./CHART_GROUP"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./COUNT_SUPPORTED_FORMATS"), exports);
|
|
5
6
|
tslib_1.__exportStar(require("./DATEGROUP_UNSUPPORT_FORMAT"), exports);
|
|
6
7
|
tslib_1.__exportStar(require("./DATEGROUP_WITHOUT_FORMAT"), exports);
|
|
7
8
|
tslib_1.__exportStar(require("./SHELF_TYPE"), exports);
|
|
@@ -5,6 +5,7 @@ const AGGREGATE_1 = require("../../charts/constants/AGGREGATE");
|
|
|
5
5
|
const COLUMN_1 = require("../../columns/constants/COLUMN");
|
|
6
6
|
const isEmpty_1 = require("../../general/mix/isEmpty");
|
|
7
7
|
const CHART_GROUP_1 = require("../constants/CHART_GROUP");
|
|
8
|
+
const COUNT_SUPPORTED_FORMATS_1 = require("../constants/COUNT_SUPPORTED_FORMATS");
|
|
8
9
|
const STRING_FORMAT_1 = require("../constants/STRING_FORMAT");
|
|
9
10
|
const TABLE_TYPE_1 = require("../constants/TABLE_TYPE");
|
|
10
11
|
const columnTypeByChart_1 = require("./columnTypeByChart");
|
|
@@ -85,11 +86,16 @@ const defineTableChartFormat = (column, settings) => {
|
|
|
85
86
|
return defaultPercentage;
|
|
86
87
|
if (selectedFormat && selectedFormat.format !== defaultText)
|
|
87
88
|
return selectedFormat;
|
|
89
|
+
const isCountAggregate = aggregate?.label === AGGREGATE_1.AGGREGATE.COUNT ||
|
|
90
|
+
aggregate?.label === AGGREGATE_1.AGGREGATE.DISTINCTCOUNT;
|
|
88
91
|
let output;
|
|
89
|
-
if (isGroupedTable &&
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
92
|
+
if (isGroupedTable && isCountAggregate) {
|
|
93
|
+
output = COUNT_SUPPORTED_FORMATS_1.COUNT_SUPPORTED_FORMATS.includes(outputFormat?.format)
|
|
94
|
+
? { ...outputFormat }
|
|
95
|
+
: defaultNumeric;
|
|
96
|
+
}
|
|
97
|
+
else if (definition_1.STANDARD_NUMERIC_FORMATS.includes(outputFormat?.format)) {
|
|
98
|
+
output = { ...outputFormat };
|
|
93
99
|
}
|
|
94
100
|
else {
|
|
95
101
|
output = defaultFormat || defaultNumeric;
|
|
@@ -8,6 +8,7 @@ const isEmpty_1 = require("../../general/mix/isEmpty");
|
|
|
8
8
|
const CALCULATION_LABEL_1 = require("../../qrvey/constants/CALCULATION_LABEL");
|
|
9
9
|
const constants_1 = require("../constants");
|
|
10
10
|
const CHART_GROUP_1 = require("../constants/CHART_GROUP");
|
|
11
|
+
const COUNT_SUPPORTED_FORMATS_1 = require("../constants/COUNT_SUPPORTED_FORMATS");
|
|
11
12
|
const DATEGROUP_UNSUPPORT_FORMAT_1 = require("../constants/DATEGROUP_UNSUPPORT_FORMAT");
|
|
12
13
|
const STRING_FORMAT_1 = require("../constants/STRING_FORMAT");
|
|
13
14
|
const columnTypeByChart_1 = require("./columnTypeByChart");
|
|
@@ -78,8 +79,11 @@ const defineXYChartFormat = (column, settings) => {
|
|
|
78
79
|
return defaultPercentage;
|
|
79
80
|
if ((aggregate?.label === AGGREGATE_1.AGGREGATE.COUNT ||
|
|
80
81
|
aggregate?.label === AGGREGATE_1.AGGREGATE.DISTINCTCOUNT) &&
|
|
81
|
-
hasDefaultFormat)
|
|
82
|
+
hasDefaultFormat) {
|
|
83
|
+
if (COUNT_SUPPORTED_FORMATS_1.COUNT_SUPPORTED_FORMATS.includes(outputFormat?.format))
|
|
84
|
+
return { ...outputFormat };
|
|
82
85
|
return defaultDecimal;
|
|
86
|
+
}
|
|
83
87
|
if (isUsedAsNumericColumn) {
|
|
84
88
|
if (columnCurrentFormat?.type !== COLUMN_1.COLUMN.NUMERIC || withoutFormat)
|
|
85
89
|
return defaultAbb;
|
|
@@ -91,7 +95,8 @@ const defineXYChartFormat = (column, settings) => {
|
|
|
91
95
|
else if (hasDefaultFormat) {
|
|
92
96
|
if (!outputFormat?.format)
|
|
93
97
|
return defaultDecimal;
|
|
94
|
-
if (!definition_1.STANDARD_NUMERIC_FORMATS.includes(outputFormat?.format) ||
|
|
98
|
+
if (!definition_1.STANDARD_NUMERIC_FORMATS.includes(outputFormat?.format) ||
|
|
99
|
+
constants_1.DURATION_PARTS_LIST.includes(outputFormat?.format)) {
|
|
95
100
|
return {
|
|
96
101
|
...outputFormat,
|
|
97
102
|
template: outputFormat?.format,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const COUNT_SUPPORTED_FORMATS: string[];
|
|
@@ -2,6 +2,7 @@ import { AGGREGATE } from "../../charts/constants/AGGREGATE";
|
|
|
2
2
|
import { COLUMN } from "../../columns/constants/COLUMN";
|
|
3
3
|
import { isEmpty } from "../../general/mix/isEmpty";
|
|
4
4
|
import { CHART_GROUPS } from "../constants/CHART_GROUP";
|
|
5
|
+
import { COUNT_SUPPORTED_FORMATS } from "../constants/COUNT_SUPPORTED_FORMATS";
|
|
5
6
|
import { STRING_FORMAT } from "../constants/STRING_FORMAT";
|
|
6
7
|
import { TABLE_TYPE } from "../constants/TABLE_TYPE";
|
|
7
8
|
import { columnTypeByChart } from "./columnTypeByChart";
|
|
@@ -82,11 +83,16 @@ export const defineTableChartFormat = (column, settings) => {
|
|
|
82
83
|
return defaultPercentage;
|
|
83
84
|
if (selectedFormat && selectedFormat.format !== defaultText)
|
|
84
85
|
return selectedFormat;
|
|
86
|
+
const isCountAggregate = aggregate?.label === AGGREGATE.COUNT ||
|
|
87
|
+
aggregate?.label === AGGREGATE.DISTINCTCOUNT;
|
|
85
88
|
let output;
|
|
86
|
-
if (isGroupedTable &&
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
89
|
+
if (isGroupedTable && isCountAggregate) {
|
|
90
|
+
output = COUNT_SUPPORTED_FORMATS.includes(outputFormat?.format)
|
|
91
|
+
? { ...outputFormat }
|
|
92
|
+
: defaultNumeric;
|
|
93
|
+
}
|
|
94
|
+
else if (STANDARD_NUMERIC_FORMATS.includes(outputFormat?.format)) {
|
|
95
|
+
output = { ...outputFormat };
|
|
90
96
|
}
|
|
91
97
|
else {
|
|
92
98
|
output = defaultFormat || defaultNumeric;
|
|
@@ -5,6 +5,7 @@ import { isEmpty } from "../../general/mix/isEmpty";
|
|
|
5
5
|
import { CALCULATION_LABEL } from "../../qrvey/constants/CALCULATION_LABEL";
|
|
6
6
|
import { DURATION_PARTS_LIST, SHELF_TYPE } from "../constants";
|
|
7
7
|
import { CHART_GROUPS } from "../constants/CHART_GROUP";
|
|
8
|
+
import { COUNT_SUPPORTED_FORMATS } from "../constants/COUNT_SUPPORTED_FORMATS";
|
|
8
9
|
import { DATEGROUP_UNSUPPORT_FORMAT } from "../constants/DATEGROUP_UNSUPPORT_FORMAT";
|
|
9
10
|
import { STRING_FORMAT } from "../constants/STRING_FORMAT";
|
|
10
11
|
import { columnTypeByChart } from "./columnTypeByChart";
|
|
@@ -75,8 +76,11 @@ export const defineXYChartFormat = (column, settings) => {
|
|
|
75
76
|
return defaultPercentage;
|
|
76
77
|
if ((aggregate?.label === AGGREGATE.COUNT ||
|
|
77
78
|
aggregate?.label === AGGREGATE.DISTINCTCOUNT) &&
|
|
78
|
-
hasDefaultFormat)
|
|
79
|
+
hasDefaultFormat) {
|
|
80
|
+
if (COUNT_SUPPORTED_FORMATS.includes(outputFormat?.format))
|
|
81
|
+
return { ...outputFormat };
|
|
79
82
|
return defaultDecimal;
|
|
83
|
+
}
|
|
80
84
|
if (isUsedAsNumericColumn) {
|
|
81
85
|
if (columnCurrentFormat?.type !== COLUMN.NUMERIC || withoutFormat)
|
|
82
86
|
return defaultAbb;
|
|
@@ -88,7 +92,8 @@ export const defineXYChartFormat = (column, settings) => {
|
|
|
88
92
|
else if (hasDefaultFormat) {
|
|
89
93
|
if (!outputFormat?.format)
|
|
90
94
|
return defaultDecimal;
|
|
91
|
-
if (!STANDARD_NUMERIC_FORMATS.includes(outputFormat?.format) ||
|
|
95
|
+
if (!STANDARD_NUMERIC_FORMATS.includes(outputFormat?.format) ||
|
|
96
|
+
DURATION_PARTS_LIST.includes(outputFormat?.format)) {
|
|
92
97
|
return {
|
|
93
98
|
...outputFormat,
|
|
94
99
|
template: outputFormat?.format,
|