@qrvey/utils 1.7.1 → 1.8.0-1
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/filters/helpers/settings/getFilterSettings.js +18 -1
- package/dist/cjs/format/format.js +5 -5
- package/dist/cjs/qrvey/interfaces/IBModel.d.ts +1 -0
- package/dist/cjs/services/adapters/BModelToUIModel.adapter.js +1 -0
- package/dist/filters/helpers/settings/getFilterSettings.js +18 -1
- package/dist/format/format.js +1 -1
- package/dist/qrvey/interfaces/IBModel.d.ts +1 -0
- package/dist/services/adapters/BModelToUIModel.adapter.js +1 -0
- package/package.json +14 -14
package/README.md
CHANGED
|
@@ -48,7 +48,11 @@ function getFilterSettingsByMultipleScopes(settings, allowedScopes) {
|
|
|
48
48
|
else if (scopesSettings.length <= 2) {
|
|
49
49
|
newSettings = getFilterSettingsByDefaultWithOneAdditionalScope(newSettings);
|
|
50
50
|
}
|
|
51
|
-
if ((0, isEmpty_1.isEmpty)(scopesSettings.find((scope) => scope.id === FILTER_SCOPE_1.FILTER_SCOPE.CHART))
|
|
51
|
+
if ((0, isEmpty_1.isEmpty)(scopesSettings.find((scope) => scope.id === FILTER_SCOPE_1.FILTER_SCOPE.CHART)) &&
|
|
52
|
+
!(0, isEmpty_1.isEmpty)(scopesSettings.find((scope) => scope.id === FILTER_SCOPE_1.FILTER_SCOPE.GLOBAL))) {
|
|
53
|
+
newSettings = getFilterSettingsByMultipleNoPanelGlobalScopes(newSettings);
|
|
54
|
+
}
|
|
55
|
+
else if ((0, isEmpty_1.isEmpty)(scopesSettings.find((scope) => scope.id === FILTER_SCOPE_1.FILTER_SCOPE.CHART))) {
|
|
52
56
|
newSettings = getFilterSettingsByMultipleNoPanelScopes(newSettings);
|
|
53
57
|
}
|
|
54
58
|
if ((0, isEmpty_1.isEmpty)(scopesSettings.find((scope) => scope.id === FILTER_SCOPE_1.FILTER_SCOPE.CHART)) &&
|
|
@@ -313,6 +317,19 @@ function getFilterSettingsBySkippingGeneralScopes(settings) {
|
|
|
313
317
|
};
|
|
314
318
|
return (0, mergeDeep_1.mergeDeep)(settings, newSettings);
|
|
315
319
|
}
|
|
320
|
+
/**
|
|
321
|
+
* Gets the filter settings when there are no panel scopes and multiple scopes allowed.
|
|
322
|
+
* @param {IFSettings} settings the given filter settings
|
|
323
|
+
* @returns a new filter settings object
|
|
324
|
+
*/
|
|
325
|
+
function getFilterSettingsByMultipleNoPanelGlobalScopes(settings) {
|
|
326
|
+
const newSettings = {
|
|
327
|
+
panel: {
|
|
328
|
+
filterAccessEnabled: false,
|
|
329
|
+
},
|
|
330
|
+
};
|
|
331
|
+
return (0, mergeDeep_1.mergeDeep)(settings, newSettings);
|
|
332
|
+
}
|
|
316
333
|
/**
|
|
317
334
|
* Gets the filter settings when there are no panel scopes and multiple scopes allowed.
|
|
318
335
|
* @param {IFSettings} settings the given filter settings
|
|
@@ -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)
|
|
@@ -44,7 +44,11 @@ function getFilterSettingsByMultipleScopes(settings, allowedScopes) {
|
|
|
44
44
|
else if (scopesSettings.length <= 2) {
|
|
45
45
|
newSettings = getFilterSettingsByDefaultWithOneAdditionalScope(newSettings);
|
|
46
46
|
}
|
|
47
|
-
if (isEmpty(scopesSettings.find((scope) => scope.id === FILTER_SCOPE.CHART))
|
|
47
|
+
if (isEmpty(scopesSettings.find((scope) => scope.id === FILTER_SCOPE.CHART)) &&
|
|
48
|
+
!isEmpty(scopesSettings.find((scope) => scope.id === FILTER_SCOPE.GLOBAL))) {
|
|
49
|
+
newSettings = getFilterSettingsByMultipleNoPanelGlobalScopes(newSettings);
|
|
50
|
+
}
|
|
51
|
+
else if (isEmpty(scopesSettings.find((scope) => scope.id === FILTER_SCOPE.CHART))) {
|
|
48
52
|
newSettings = getFilterSettingsByMultipleNoPanelScopes(newSettings);
|
|
49
53
|
}
|
|
50
54
|
if (isEmpty(scopesSettings.find((scope) => scope.id === FILTER_SCOPE.CHART)) &&
|
|
@@ -309,6 +313,19 @@ function getFilterSettingsBySkippingGeneralScopes(settings) {
|
|
|
309
313
|
};
|
|
310
314
|
return mergeDeep(settings, newSettings);
|
|
311
315
|
}
|
|
316
|
+
/**
|
|
317
|
+
* Gets the filter settings when there are no panel scopes and multiple scopes allowed.
|
|
318
|
+
* @param {IFSettings} settings the given filter settings
|
|
319
|
+
* @returns a new filter settings object
|
|
320
|
+
*/
|
|
321
|
+
function getFilterSettingsByMultipleNoPanelGlobalScopes(settings) {
|
|
322
|
+
const newSettings = {
|
|
323
|
+
panel: {
|
|
324
|
+
filterAccessEnabled: false,
|
|
325
|
+
},
|
|
326
|
+
};
|
|
327
|
+
return mergeDeep(settings, newSettings);
|
|
328
|
+
}
|
|
312
329
|
/**
|
|
313
330
|
* Gets the filter settings when there are no panel scopes and multiple scopes allowed.
|
|
314
331
|
* @param {IFSettings} settings the given filter settings
|
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";
|
package/package.json
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qrvey/utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0-1",
|
|
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",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "tsc && tsc -m commonjs --outDir dist/cjs",
|
|
9
|
-
"build
|
|
9
|
+
"build.clean": "node ./scripts/clean-build",
|
|
10
10
|
"compodoc": "npx compodoc -p tsconfig.doc.json",
|
|
11
|
-
"compodoc
|
|
11
|
+
"compodoc.server": "./node_modules/.bin/compodoc -p ./tsconfig.doc.json -s --port=4400",
|
|
12
12
|
"lint": "eslint . --quiet --exit-on-fatal-error --ext .ts,.js",
|
|
13
|
-
"lint
|
|
13
|
+
"lint.dev": "eslint . --debug --ext .ts,.tsx",
|
|
14
14
|
"prepare": "husky install",
|
|
15
|
-
"publishing
|
|
15
|
+
"publishing.beta.1": "node ./scripts/publishing --np-new-version=$npm_config_np_new_version --np-any-branch=$npm_config_np_any_branch --np-tag=$npm_config_np_tag",
|
|
16
16
|
"publishing": "node ./scripts/clean-build && node ./scripts/generating-docs --np-new-version=$npm_config_np_new_version && np $npm_config_np_new_version --any-branch --tag=$npm_config_np_tag",
|
|
17
|
-
"publishing
|
|
17
|
+
"publishing.win": "node ./scripts/clean-build && node ./scripts/generating-docs --np-new-version=%npm_config_np_new_version% && np %npm_config_np_new_version% --any-branch --tag=%npm_config_np_tag%",
|
|
18
18
|
"test": "jest test",
|
|
19
|
-
"test
|
|
19
|
+
"test.watch": "jest --watch test"
|
|
20
20
|
},
|
|
21
21
|
"author": "Qrvey Inc",
|
|
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": "3.1.0",
|
|
42
|
+
"dayjs": "1.11.6",
|
|
43
|
+
"i18next": "22.0.4"
|
|
44
44
|
},
|
|
45
45
|
"files": [
|
|
46
46
|
"dist/**/*"
|