@qrvey/utils 1.8.0-0 → 1.8.0-2
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/format/format.js +5 -5
- package/dist/cjs/globalization/interfaces/chart_builder/II18nChartBuilderChartLabels.d.ts +1 -0
- package/dist/cjs/globalization/interfaces/chart_builder/II18nChartBuilderChartNames.d.ts +1 -0
- package/dist/cjs/globalization/interfaces/chart_builder/II18nChartBuilderStyleOptions.d.ts +1 -0
- package/dist/cjs/globalization/labels/chart_builder/I18N_CHART_BUILDER.js +1 -0
- package/dist/cjs/globalization/labels/chart_builder/I18N_CHART_BUILDER_GENERAL.js +1 -0
- package/dist/cjs/globalization/labels/chart_builder/I18N_CHART_BUILDER_STYLE_OPTIONS.js +1 -0
- package/dist/format/format.js +1 -1
- package/dist/globalization/interfaces/chart_builder/II18nChartBuilderChartLabels.d.ts +1 -0
- package/dist/globalization/interfaces/chart_builder/II18nChartBuilderChartNames.d.ts +1 -0
- package/dist/globalization/interfaces/chart_builder/II18nChartBuilderStyleOptions.d.ts +1 -0
- package/dist/globalization/labels/chart_builder/I18N_CHART_BUILDER.js +1 -0
- package/dist/globalization/labels/chart_builder/I18N_CHART_BUILDER_GENERAL.js +1 -0
- package/dist/globalization/labels/chart_builder/I18N_CHART_BUILDER_STYLE_OPTIONS.js +1 -0
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.defineFormat = exports.validateColumnType = exports.parseFormulaType = exports.addFormat = exports.formatTime = exports.isValidTimeString = exports.formatFileSize = exports.formatAbbreviated = exports.formatDate = void 0;
|
|
7
|
-
const
|
|
7
|
+
const d3_format_1 = require("d3-format");
|
|
8
8
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
9
9
|
const definition_1 = require("./definition");
|
|
10
10
|
const isoWeek_1 = __importDefault(require("dayjs/plugin/isoWeek"));
|
|
@@ -49,7 +49,7 @@ function formatAbbreviated(num, decimals) {
|
|
|
49
49
|
const exp = Math.floor(Math.log10(absValue));
|
|
50
50
|
if (exp <= 0 && exp >= -3)
|
|
51
51
|
return num.toFixed(decimals === 0 ? 2 : decimals);
|
|
52
|
-
return (0,
|
|
52
|
+
return (0, d3_format_1.format)(num > -100 && num < 100 ? `.${decimals + 2}n` : ".3s")(num);
|
|
53
53
|
}
|
|
54
54
|
exports.formatAbbreviated = formatAbbreviated;
|
|
55
55
|
function formatNumber(num, outputFormat, _config) {
|
|
@@ -70,15 +70,15 @@ function formatNumber(num, outputFormat, _config) {
|
|
|
70
70
|
return formatAbbreviated(_num, num_decimals);
|
|
71
71
|
case "Numeric":
|
|
72
72
|
case "Decimal":
|
|
73
|
-
return (0,
|
|
73
|
+
return (0, d3_format_1.format)(`,.${num_decimals}f`)(_num).replace(/\.(%*)$/, "$1");
|
|
74
74
|
case "Currency": {
|
|
75
75
|
const currency = `${_num < 0 ? "-" : ""} ${(0, get_1._get)(outputFormat, "currency.label", "$")}`;
|
|
76
76
|
const absNum = Math.abs(_num);
|
|
77
77
|
return (currency +
|
|
78
|
-
(0,
|
|
78
|
+
(0, d3_format_1.format)(`,.${num_decimals}f`)(absNum).replace(/\.(%*)$/, "$1"));
|
|
79
79
|
}
|
|
80
80
|
case "Percentage":
|
|
81
|
-
return `${(0,
|
|
81
|
+
return `${(0, d3_format_1.format)(`,.${num_decimals}f`)(_num).replace(/\.(%*)$/, "$1")}%`;
|
|
82
82
|
case "Scientific":
|
|
83
83
|
return Number(_num)
|
|
84
84
|
.toExponential(num_decimals)
|
|
@@ -60,6 +60,7 @@ exports.I18N_CHART_BUILDER = Object.assign(Object.assign(Object.assign(Object.as
|
|
|
60
60
|
choropleth_map: "Choropleth Map",
|
|
61
61
|
boxwhisker: "Box and Whisker",
|
|
62
62
|
wordcloud: "Word Cloud",
|
|
63
|
+
multiseries_combo: "Multiseries Combo",
|
|
63
64
|
}, filters_options: {
|
|
64
65
|
add: "Add Filters",
|
|
65
66
|
}, word_cloud: {
|
|
@@ -175,6 +175,7 @@ exports.I18N_CHART_BUILDER_GENERAL = {
|
|
|
175
175
|
choropleth_map: "Choropleth Map Chart",
|
|
176
176
|
boxwhisker: "Box and Whisker Chart",
|
|
177
177
|
wordcloud: "Word Cloud Chart",
|
|
178
|
+
multiseries_combo: "Multiseries Combo Chart",
|
|
178
179
|
},
|
|
179
180
|
action_panel: {
|
|
180
181
|
charts: "Charts",
|
package/dist/format/format.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { format as d3Format } from "d3";
|
|
1
|
+
import { format as d3Format } from "d3-format";
|
|
2
2
|
import dayjs from "dayjs";
|
|
3
3
|
import { DATEGROUP_FORMATTING_UNSUPPORT, appliesFormatting, hasfileSizeProperty, isTextColumn, DEFAULT_DATE, } from "./definition";
|
|
4
4
|
import isoWeek from "dayjs/plugin/isoWeek";
|
|
@@ -57,6 +57,7 @@ export const I18N_CHART_BUILDER = Object.assign(Object.assign(Object.assign(Obje
|
|
|
57
57
|
choropleth_map: "Choropleth Map",
|
|
58
58
|
boxwhisker: "Box and Whisker",
|
|
59
59
|
wordcloud: "Word Cloud",
|
|
60
|
+
multiseries_combo: "Multiseries Combo",
|
|
60
61
|
}, filters_options: {
|
|
61
62
|
add: "Add Filters",
|
|
62
63
|
}, word_cloud: {
|
|
@@ -172,6 +172,7 @@ export const I18N_CHART_BUILDER_GENERAL = {
|
|
|
172
172
|
choropleth_map: "Choropleth Map Chart",
|
|
173
173
|
boxwhisker: "Box and Whisker Chart",
|
|
174
174
|
wordcloud: "Word Cloud Chart",
|
|
175
|
+
multiseries_combo: "Multiseries Combo Chart",
|
|
175
176
|
},
|
|
176
177
|
action_panel: {
|
|
177
178
|
charts: "Charts",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qrvey/utils",
|
|
3
|
-
"version": "1.8.0-
|
|
3
|
+
"version": "1.8.0-2",
|
|
4
4
|
"description": "Helper, Utils for all Qrvey Projects",
|
|
5
5
|
"homepage": "https://bitbucket.org/qrvey/qrvey_utils/wiki/Home",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@compodoc/compodoc": "1.1.19",
|
|
25
|
-
"@types/jest": "29.
|
|
25
|
+
"@types/jest": "29.2.1",
|
|
26
26
|
"@types/responselike": "1.0.0",
|
|
27
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
28
|
-
"@typescript-eslint/parser": "5.
|
|
29
|
-
"eslint": "8.
|
|
27
|
+
"@typescript-eslint/eslint-plugin": "5.42.0",
|
|
28
|
+
"@typescript-eslint/parser": "5.42.0",
|
|
29
|
+
"eslint": "8.26.0",
|
|
30
30
|
"eslint-config-prettier": "8.5.0",
|
|
31
31
|
"eslint-plugin-prettier": "4.2.1",
|
|
32
32
|
"husky": "8.0.1",
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"typescript": "4.8.4"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"d3": "
|
|
42
|
-
"dayjs": "1.11.
|
|
43
|
-
"i18next": "
|
|
41
|
+
"d3-format": "2.0.0",
|
|
42
|
+
"dayjs": "1.11.6",
|
|
43
|
+
"i18next": "22.0.4"
|
|
44
44
|
},
|
|
45
45
|
"files": [
|
|
46
46
|
"dist/**/*"
|