@qrvey/utils 1.2.9-33 → 1.2.9-36
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 +89 -89
- package/bitbucket-pipelines.yml +1 -1
- package/dist/cjs/charts/constants/index.js +5 -1
- package/dist/cjs/charts/helpers/index.js +5 -1
- package/dist/cjs/charts/index.js +5 -1
- package/dist/cjs/charts/interfaces/index.js +5 -1
- package/dist/cjs/columns/constants/COLUMN_LABEL.d.ts +1 -0
- package/dist/cjs/columns/constants/COLUMN_LABEL.js +1 -1
- package/dist/cjs/columns/constants/COLUMN_PROPERTY_INFO.js +1 -1
- package/dist/cjs/columns/constants/index.js +5 -1
- package/dist/cjs/columns/helpers/index.js +5 -1
- package/dist/cjs/columns/index.js +5 -1
- package/dist/cjs/columns/interfaces/index.js +5 -1
- package/dist/cjs/constants/index.js +5 -1
- package/dist/cjs/dates/constants/index.js +5 -1
- package/dist/cjs/dates/helpers/index.js +5 -1
- package/dist/cjs/dates/index.js +5 -1
- package/dist/cjs/dates/interfaces/index.js +5 -1
- package/dist/cjs/dates/range/index.js +5 -1
- package/dist/cjs/dates/relative/constants/index.js +5 -1
- package/dist/cjs/dates/relative/constants/ui/index.js +5 -1
- package/dist/cjs/dates/relative/helpers/dayjs-module.js +5 -1
- package/dist/cjs/dates/relative/helpers/index.js +5 -1
- package/dist/cjs/dates/relative/index.js +5 -1
- package/dist/cjs/dates/relative/interfaces/index.js +5 -1
- package/dist/cjs/dates/relative/interfaces/ui/index.js +5 -1
- package/dist/cjs/filters/adapters/adaptFilterValues.js +1 -1
- package/dist/cjs/filters/adapters/flatUIToFD.js +4 -0
- package/dist/cjs/filters/adapters/flatUIToOldLogic.js +1 -1
- package/dist/cjs/filters/adapters/flatUIToUI.js +4 -0
- package/dist/cjs/filters/adapters/index.js +5 -1
- package/dist/cjs/filters/classes/index.js +5 -1
- package/dist/cjs/filters/constants/backend/index.js +5 -1
- package/dist/cjs/filters/constants/builder/index.js +5 -1
- package/dist/cjs/filters/constants/common/index.js +5 -1
- package/dist/cjs/filters/constants/index.js +5 -1
- package/dist/cjs/filters/constants/panel/index.js +5 -1
- package/dist/cjs/filters/helpers/backend/getBackendProperty.js +1 -1
- package/dist/cjs/filters/helpers/backend/getBackendValues.js +1 -1
- package/dist/cjs/filters/helpers/backend/index.js +5 -1
- package/dist/cjs/filters/helpers/builder/index.js +5 -1
- package/dist/cjs/filters/helpers/common/index.js +5 -1
- package/dist/cjs/filters/helpers/index.js +5 -1
- package/dist/cjs/filters/helpers/ui/index.js +5 -1
- package/dist/cjs/filters/index.js +5 -1
- package/dist/cjs/filters/interfaces/backend/index.js +5 -1
- package/dist/cjs/filters/interfaces/builder/index.js +5 -1
- package/dist/cjs/filters/interfaces/common/IFSValue.d.ts +1 -1
- package/dist/cjs/filters/interfaces/common/index.js +5 -1
- package/dist/cjs/filters/interfaces/index.js +5 -1
- package/dist/cjs/filters/interfaces/panel/index.js +5 -1
- package/dist/cjs/filters/interfaces/ui/IFUValue.d.ts +1 -1
- package/dist/cjs/filters/interfaces/ui/index.js +5 -1
- package/dist/cjs/format/format.d.ts +1 -1
- package/dist/cjs/format/format.js +7 -2
- package/dist/cjs/format/index.js +5 -1
- package/dist/cjs/format/localization.js +19 -5
- package/dist/cjs/formulas/constants/index.js +5 -1
- package/dist/cjs/formulas/index.js +5 -1
- package/dist/cjs/formulas/interfaces/index.js +5 -1
- package/dist/cjs/general/array/index.js +5 -1
- package/dist/cjs/general/function/index.js +5 -1
- package/dist/cjs/general/index.js +5 -1
- package/dist/cjs/general/mix/index.js +5 -1
- package/dist/cjs/general/object/index.js +5 -1
- package/dist/cjs/general/string/index.js +5 -1
- package/dist/cjs/globalization/helpers/index.js +5 -1
- package/dist/cjs/globalization/index.js +5 -1
- package/dist/cjs/globalization/interfaces/bucket_builder/index.js +5 -1
- package/dist/cjs/globalization/interfaces/calendar/index.js +5 -1
- package/dist/cjs/globalization/interfaces/chart_builder/II18nChartBuilderTableStyleOptions.d.ts +6 -0
- package/dist/cjs/globalization/interfaces/chart_builder/index.js +5 -1
- package/dist/cjs/globalization/interfaces/columns/index.js +5 -1
- package/dist/cjs/globalization/interfaces/common/II18nColumnTypes.d.ts +1 -0
- package/dist/cjs/globalization/interfaces/common/index.js +5 -1
- package/dist/cjs/globalization/interfaces/cross_tabs/index.js +5 -1
- package/dist/cjs/globalization/interfaces/dashboard/II18nDashboardToast.d.ts +1 -0
- package/dist/cjs/globalization/interfaces/dashboard/index.js +5 -1
- package/dist/cjs/globalization/interfaces/filters/index.js +5 -1
- package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderDeleteDialog.d.ts +3 -3
- package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderListTable.d.ts +5 -5
- package/dist/cjs/globalization/interfaces/formula_builder/index.js +5 -1
- package/dist/cjs/globalization/interfaces/index.js +5 -1
- package/dist/cjs/globalization/interfaces/panel/index.js +5 -1
- package/dist/cjs/globalization/interfaces/style_themes/II18nStyleThemesTheme.d.ts +2 -0
- package/dist/cjs/globalization/interfaces/style_themes/index.js +5 -1
- package/dist/cjs/globalization/interfaces/table_charts/index.js +5 -1
- package/dist/cjs/globalization/labels/bucket_builder/index.js +5 -1
- package/dist/cjs/globalization/labels/calendar/index.js +5 -1
- package/dist/cjs/globalization/labels/chart_builder/I18N_CHART_BUILDER_STYLE_OPTIONS.js +6 -0
- package/dist/cjs/globalization/labels/chart_builder/index.js +5 -1
- package/dist/cjs/globalization/labels/columns/index.js +5 -1
- package/dist/cjs/globalization/labels/common/I18N_COLUMN_LABEL.d.ts +1 -0
- package/dist/cjs/globalization/labels/common/I18N_COLUMN_LABEL.js +1 -0
- package/dist/cjs/globalization/labels/common/index.js +5 -1
- package/dist/cjs/globalization/labels/cross_tabs/index.js +5 -1
- package/dist/cjs/globalization/labels/dashboard/I18N_DASHBOARD.js +1 -0
- package/dist/cjs/globalization/labels/dashboard/index.js +5 -1
- package/dist/cjs/globalization/labels/filters/index.js +5 -1
- package/dist/cjs/globalization/labels/formula_builder/I18N_FORMULA_BUILDER.js +9 -9
- package/dist/cjs/globalization/labels/formula_builder/index.js +5 -1
- package/dist/cjs/globalization/labels/index.js +5 -1
- package/dist/cjs/globalization/labels/panel/index.js +5 -1
- package/dist/cjs/globalization/labels/style_themes/I18N_STYLE_THEMES.js +2 -0
- package/dist/cjs/globalization/labels/style_themes/index.js +5 -1
- package/dist/cjs/globalization/labels/table_charts/index.js +5 -1
- package/dist/cjs/globalization/service/index.js +5 -1
- package/dist/cjs/index.js +5 -1
- package/dist/cjs/interfaces/format/index.js +5 -1
- package/dist/cjs/interfaces/general/index.js +5 -1
- package/dist/cjs/interfaces/index.js +5 -1
- package/dist/cjs/qrvey/constants/index.js +5 -1
- package/dist/cjs/qrvey/helpers/index.js +5 -1
- package/dist/cjs/qrvey/helpers/transformValue.js +3 -0
- package/dist/cjs/qrvey/index.js +5 -1
- package/dist/cjs/qrvey/interfaces/index.js +5 -1
- package/dist/cjs/services/adapters/index.js +5 -1
- package/dist/cjs/services/api/index.js +5 -1
- package/dist/cjs/services/constants/index.js +5 -1
- package/dist/cjs/services/helpers/index.js +5 -1
- package/dist/cjs/services/index.js +5 -1
- package/dist/cjs/services/interfaces/index.js +5 -1
- package/dist/cjs/stencil/decorators/index.js +5 -1
- package/dist/cjs/stencil/index.js +5 -1
- package/dist/cjs/stencil/util/index.js +5 -1
- package/dist/cjs/tokens/index.js +5 -1
- package/dist/cjs/typescript/decorators/index.js +5 -1
- package/dist/cjs/typescript/index.js +5 -1
- package/dist/columns/constants/COLUMN_LABEL.d.ts +1 -0
- package/dist/columns/constants/COLUMN_LABEL.js +1 -1
- package/dist/columns/constants/COLUMN_PROPERTY_INFO.js +1 -1
- package/dist/filters/adapters/adaptFilterValues.js +1 -1
- package/dist/filters/adapters/flatUIToFD.js +4 -0
- package/dist/filters/adapters/flatUIToOldLogic.js +1 -1
- package/dist/filters/adapters/flatUIToUI.js +4 -0
- package/dist/filters/helpers/backend/getBackendProperty.js +1 -1
- package/dist/filters/helpers/backend/getBackendValues.js +1 -1
- package/dist/filters/interfaces/common/IFSValue.d.ts +1 -1
- package/dist/filters/interfaces/ui/IFUValue.d.ts +1 -1
- package/dist/format/format.d.ts +1 -1
- package/dist/format/format.js +7 -2
- package/dist/format/localization.js +19 -5
- package/dist/globalization/interfaces/chart_builder/II18nChartBuilderTableStyleOptions.d.ts +6 -0
- package/dist/globalization/interfaces/common/II18nColumnTypes.d.ts +1 -0
- package/dist/globalization/interfaces/dashboard/II18nDashboardToast.d.ts +1 -0
- package/dist/globalization/interfaces/formula_builder/II18nFormulaBuilderDeleteDialog.d.ts +3 -3
- package/dist/globalization/interfaces/formula_builder/II18nFormulaBuilderListTable.d.ts +5 -5
- package/dist/globalization/interfaces/style_themes/II18nStyleThemesTheme.d.ts +2 -0
- package/dist/globalization/labels/chart_builder/I18N_CHART_BUILDER_STYLE_OPTIONS.js +6 -0
- package/dist/globalization/labels/common/I18N_COLUMN_LABEL.d.ts +1 -0
- package/dist/globalization/labels/common/I18N_COLUMN_LABEL.js +1 -0
- package/dist/globalization/labels/dashboard/I18N_DASHBOARD.js +1 -0
- package/dist/globalization/labels/formula_builder/I18N_FORMULA_BUILDER.js +9 -9
- package/dist/globalization/labels/style_themes/I18N_STYLE_THEMES.js +2 -0
- package/dist/qrvey/helpers/transformValue.js +3 -0
- package/package.json +21 -16
- package/scripts/clean-build/index.js +62 -0
- package/{prepareToPublish.js → scripts/prepare-publish/index.js} +0 -0
- package/scripts/publishing/index.js +204 -0
- package/src/columns/constants/COLUMN_LABEL.ts +1 -0
- package/src/columns/constants/COLUMN_PROPERTY_INFO.ts +1 -1
- package/src/filters/adapters/adaptFilterValues.ts +1 -1
- package/src/filters/adapters/flatUIToFD.ts +5 -0
- package/src/filters/adapters/flatUIToOldLogic.ts +1 -1
- package/src/filters/adapters/flatUIToUI.ts +5 -0
- package/src/filters/helpers/backend/getBackendProperty.ts +2 -1
- package/src/filters/helpers/backend/getBackendValues.ts +1 -1
- package/src/filters/interfaces/common/IFSValue.ts +1 -1
- package/src/filters/interfaces/ui/IFUValue.ts +1 -1
- package/src/format/format.ts +6 -3
- package/src/format/localization.ts +17 -3
- package/src/globalization/interfaces/chart_builder/II18nChartBuilderTableStyleOptions.ts +6 -0
- package/src/globalization/interfaces/common/II18nColumnTypes.ts +1 -0
- package/src/globalization/interfaces/dashboard/II18nDashboardToast.ts +1 -0
- package/src/globalization/interfaces/formula_builder/II18nFormulaBuilderDeleteDialog.ts +3 -3
- package/src/globalization/interfaces/formula_builder/II18nFormulaBuilderListTable.ts +5 -5
- package/src/globalization/interfaces/style_themes/II18nStyleThemesTheme.ts +2 -0
- package/src/globalization/labels/chart_builder/I18N_CHART_BUILDER_STYLE_OPTIONS.ts +6 -0
- package/src/globalization/labels/common/I18N_COLUMN_LABEL.ts +1 -0
- package/src/globalization/labels/dashboard/I18N_DASHBOARD.ts +1 -0
- package/src/globalization/labels/formula_builder/I18N_FORMULA_BUILDER.ts +9 -9
- package/src/globalization/labels/style_themes/I18N_STYLE_THEMES.ts +2 -0
- package/src/qrvey/helpers/transformValue.ts +3 -0
|
@@ -7,20 +7,20 @@ export const I18N_FORMULA_BUILDER = {
|
|
|
7
7
|
information_text_text: 'create and work with formulas',
|
|
8
8
|
},
|
|
9
9
|
list_table: {
|
|
10
|
-
|
|
10
|
+
duplicate_copy: 'Copy',
|
|
11
|
+
duplicate_toast: 'Formula Duplicated Successfully',
|
|
11
12
|
formula: 'Formula',
|
|
12
|
-
menu_edit: 'Edit',
|
|
13
|
-
menu_duplicate: 'Duplicate',
|
|
14
13
|
menu_delete: 'Delete',
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
menu_duplicate: 'Duplicate',
|
|
15
|
+
menu_edit: 'Edit',
|
|
16
|
+
name: 'Formula Name'
|
|
17
17
|
},
|
|
18
18
|
delete_dialog: {
|
|
19
|
-
|
|
20
|
-
description: 'Deleting this formula will remove all instances of this calculation in your analytics.',
|
|
21
|
-
toast_description: 'Formula Successfully Deleted',
|
|
19
|
+
apply_button: 'Delete',
|
|
22
20
|
cancel_button: 'Cancel',
|
|
23
|
-
|
|
21
|
+
description: 'Deleting this formula will remove all instances of this calculation in your analytics.',
|
|
22
|
+
title: 'Delete Formula',
|
|
23
|
+
toast_description: 'Formula Deleted Successfully'
|
|
24
24
|
},
|
|
25
25
|
create_modal: {
|
|
26
26
|
title_header_create: 'Create Formula',
|
|
@@ -35,10 +35,12 @@ export const I18N_STYLE_THEMES = {
|
|
|
35
35
|
legends: 'Legends',
|
|
36
36
|
main_color: 'Main Color',
|
|
37
37
|
name_placeholder: 'Type name',
|
|
38
|
+
panel_background: 'Panel Background',
|
|
38
39
|
panel_styles: 'Panel Styles',
|
|
39
40
|
qrvey_theme: 'Qrvey Theme',
|
|
40
41
|
restore_to_default: 'Restore to Default',
|
|
41
42
|
save_theme: 'Save Theme',
|
|
43
|
+
show_title: 'Show Title',
|
|
42
44
|
table_header_styles: 'Table Header Styles',
|
|
43
45
|
text_styles: 'Text Styles',
|
|
44
46
|
tooltips: 'Tooltips',
|
|
@@ -3,6 +3,7 @@ import { isNumericalColumn } from "../../columns/helpers/isNumericalColumn";
|
|
|
3
3
|
import { DATE_GROUPING_PROPERTY } from "../../dates/constants/DATE_GROUPING_PROPERTY";
|
|
4
4
|
import { DATE_GROUPING_TIME_PROPERTY } from "../../dates/constants/DATE_GROUPING_TIME_PROPERTY";
|
|
5
5
|
import { addFormat } from "../../format/format";
|
|
6
|
+
import { isEmpty } from "../../general/mix/isEmpty";
|
|
6
7
|
import { getI18nDateGroupLabel } from "../../globalization/helpers/getI18nDateGroupLabel";
|
|
7
8
|
import { getValueWithSuffixes } from "./getValueWithSuffixes";
|
|
8
9
|
/**
|
|
@@ -12,6 +13,8 @@ import { getValueWithSuffixes } from "./getValueWithSuffixes";
|
|
|
12
13
|
* @returns A transformed value
|
|
13
14
|
*/
|
|
14
15
|
export function transformValue(value, settings) {
|
|
16
|
+
if (isEmpty(value))
|
|
17
|
+
return value;
|
|
15
18
|
const valueWithI18n = getI18nDateGroupLabel(value, settings.property, settings.translate);
|
|
16
19
|
const valueWithLocalization = addFormat(valueWithI18n, getOutputFormat(settings), getFormatConfig(settings));
|
|
17
20
|
return getValueWithSuffixes(valueWithLocalization, { suffixTranslateLabel: settings.suffixTranslateLabel, translate: settings.translate });
|
package/package.json
CHANGED
|
@@ -1,35 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qrvey/utils",
|
|
3
|
-
"version": "1.2.9-
|
|
3
|
+
"version": "1.2.9-36",
|
|
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
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"test:watch": "jest --watch test",
|
|
9
|
+
"build-clean": "node ./scripts/clean-build",
|
|
10
|
+
"docs": "./node_modules/.bin/jsdoc -c ./jsdoc.config.json",
|
|
11
|
+
"doxs": "doxdox './dist/**/*.js' --ignore './dist/cjs/**/*.js' --output README.md --layout markdown --package ./package.json",
|
|
13
12
|
"lint": "eslint src --quiet --exit-on-fatal-error --ext .ts,.js",
|
|
14
|
-
"lint-dev": "eslint src --debug --ext .ts,.tsx"
|
|
13
|
+
"lint-dev": "eslint src --debug --ext .ts,.tsx",
|
|
14
|
+
"publishing": "node ./scripts/prepare-publish && np",
|
|
15
|
+
"publishing-prerelease": "node ./scripts/prepare-publish && np --any-branch --tag=$npm_config_tag",
|
|
16
|
+
"publishing-v2": "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",
|
|
17
|
+
"test": "jest test",
|
|
18
|
+
"test:watch": "jest --watch test"
|
|
15
19
|
},
|
|
16
20
|
"author": "Qrvey Inc",
|
|
17
21
|
"license": "MIT",
|
|
18
22
|
"devDependencies": {
|
|
19
|
-
"@types/jest": "27.
|
|
23
|
+
"@types/jest": "27.4.1",
|
|
24
|
+
"@typescript-eslint/eslint-plugin": "5.15.0",
|
|
25
|
+
"@typescript-eslint/parser": "5.15.0",
|
|
20
26
|
"doxdox": "3.0.0",
|
|
21
|
-
"
|
|
27
|
+
"eslint": "8.11.0",
|
|
28
|
+
"jest": "27.5.1",
|
|
29
|
+
"jsdoc": "3.6.10",
|
|
22
30
|
"np": "7.6.0",
|
|
23
|
-
"ts-jest": "27.
|
|
24
|
-
"typedoc": "0.22.
|
|
25
|
-
"typescript": "4.
|
|
26
|
-
"@typescript-eslint/eslint-plugin": "5.3.0",
|
|
27
|
-
"@typescript-eslint/parser": "5.3.0",
|
|
28
|
-
"eslint": "8.1.0"
|
|
31
|
+
"ts-jest": "27.1.3",
|
|
32
|
+
"typedoc": "0.22.13",
|
|
33
|
+
"typescript": "4.6.2"
|
|
29
34
|
},
|
|
30
35
|
"dependencies": {
|
|
31
36
|
"d3": "6.3.1",
|
|
32
|
-
"dayjs": "1.
|
|
33
|
-
"i18next": "21.
|
|
37
|
+
"dayjs": "1.11.0",
|
|
38
|
+
"i18next": "21.6.14"
|
|
34
39
|
}
|
|
35
40
|
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Script for cleaning the project from temporary files and building a new bundle
|
|
3
|
+
* 1- Deleting some directories and files
|
|
4
|
+
* 2- Installing dependencies
|
|
5
|
+
* 3- Build a new bundle
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const util = require('util');
|
|
9
|
+
const childProcess = require('child_process');
|
|
10
|
+
const exec = util.promisify(childProcess.exec);
|
|
11
|
+
const { exit } = require('process');
|
|
12
|
+
|
|
13
|
+
async function execute(command) {
|
|
14
|
+
console.log(command);
|
|
15
|
+
const response = await exec(command);
|
|
16
|
+
if (response.error != null) {
|
|
17
|
+
throw new Error(response.error);
|
|
18
|
+
}
|
|
19
|
+
if (response.stderr != null && response.stderr !== '') {
|
|
20
|
+
console.error(response.stderr);
|
|
21
|
+
}
|
|
22
|
+
if (response.stdout != null && response.stdout !== '') {
|
|
23
|
+
console.log(response.stdout);
|
|
24
|
+
}
|
|
25
|
+
return response;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async function cleaningProject(settings) {
|
|
29
|
+
console.log('==>>> Cleaning project...');
|
|
30
|
+
await execute(`rm -f ${settings.packageLockPath}`);
|
|
31
|
+
await execute(`rm -f -R ${settings.nodeModulesPath}`);
|
|
32
|
+
await execute(`rm -f -R ${settings.distPath}`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async function buildingBundle(_settings) {
|
|
36
|
+
console.log('==>>> Installing Dependencies...');
|
|
37
|
+
await execute('npm install');
|
|
38
|
+
|
|
39
|
+
await execute('npm run build');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async function init() {
|
|
43
|
+
console.log('Welcome.');
|
|
44
|
+
let settings = {
|
|
45
|
+
distPath: './dist',
|
|
46
|
+
nodeModulesPath: './node_modules',
|
|
47
|
+
packageLockPath: './package-lock.json',
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
try {
|
|
51
|
+
await cleaningProject(settings);
|
|
52
|
+
await buildingBundle(settings);
|
|
53
|
+
console.info('Finished cleaning and installed dependencies');
|
|
54
|
+
} catch (err) {
|
|
55
|
+
console.error('Error: ', err);
|
|
56
|
+
} finally {
|
|
57
|
+
console.log('Execution finished');
|
|
58
|
+
exit();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
init();
|
|
File without changes
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* New version for publishing a new version of Qrvey Utils
|
|
3
|
+
* 1- Publish the version with np
|
|
4
|
+
* 2- Update the README.md doc with doxdox
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
const util = require('util');
|
|
9
|
+
const childProcess = require('child_process');
|
|
10
|
+
const exec = util.promisify(childProcess.exec);
|
|
11
|
+
const spawn = childProcess.spawn;
|
|
12
|
+
const proc = require('process');
|
|
13
|
+
const readline = require("readline");
|
|
14
|
+
const { exit } = require('process');
|
|
15
|
+
const rl = readline.createInterface({
|
|
16
|
+
input: proc.stdin,
|
|
17
|
+
output: proc.stdout
|
|
18
|
+
});
|
|
19
|
+
const question = util.promisify(rl.question).bind(rl);
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
async function execute(command) {
|
|
23
|
+
console.log(command);
|
|
24
|
+
const response = await exec(command);
|
|
25
|
+
if (response.error != null) {
|
|
26
|
+
throw new Error(response.error);
|
|
27
|
+
}
|
|
28
|
+
if (response.stderr != null && response.stderr !== '') {
|
|
29
|
+
console.error(response.stderr);
|
|
30
|
+
}
|
|
31
|
+
if (response.stdout != null && response.stdout !== '') {
|
|
32
|
+
console.log(response.stdout);
|
|
33
|
+
}
|
|
34
|
+
return response;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async function spawning(command, sArguments) {
|
|
38
|
+
let newProcess;
|
|
39
|
+
await new Promise(function (resolve, reject) {
|
|
40
|
+
newProcess = spawn(command, sArguments, { shell: true });
|
|
41
|
+
newProcess.stdout.on("data", data => {
|
|
42
|
+
console.log(`stdout: ${data}`);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
newProcess.stderr.on("data", data => {
|
|
46
|
+
console.log(`stderr: ${data}`);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
newProcess.on('error', (_error) => {
|
|
50
|
+
newProcess.stdin.pause();
|
|
51
|
+
newProcess.stdin.destroy();
|
|
52
|
+
newProcess.stdout.pause();
|
|
53
|
+
newProcess.stdout.destroy();
|
|
54
|
+
newProcess.kill();
|
|
55
|
+
reject();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
newProcess.on("close", code => {
|
|
59
|
+
newProcess.stdin.pause();
|
|
60
|
+
newProcess.stdin.destroy();
|
|
61
|
+
newProcess.stdout.pause();
|
|
62
|
+
newProcess.stdout.destroy();
|
|
63
|
+
newProcess.kill();
|
|
64
|
+
if (code == '1') {
|
|
65
|
+
reject();
|
|
66
|
+
}
|
|
67
|
+
resolve();
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async function getPackageJson(settings) {
|
|
73
|
+
console.log('==>>> Opening package.json file...');
|
|
74
|
+
const packageJson = await fs.readFileSync(settings.packagePath, 'utf8');
|
|
75
|
+
const packageObject = JSON.parse(packageJson);
|
|
76
|
+
if (packageObject != null) {
|
|
77
|
+
console.log(`**** The current version is ${packageObject.version}`);
|
|
78
|
+
return packageObject.version;
|
|
79
|
+
}
|
|
80
|
+
return '';
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
async function getNewVersion() {
|
|
84
|
+
console.log('==>>> Checking the new version provided...');
|
|
85
|
+
let newVersion;
|
|
86
|
+
const versionIndex = proc.argv.findIndex(function (argv) { return argv.includes('--np-new-version='); });
|
|
87
|
+
if (versionIndex > -1) {
|
|
88
|
+
const versionArg = proc.argv[versionIndex].split('--np-new-version=');
|
|
89
|
+
newVersion = versionArg[1] == null || versionArg[1] === '' ? undefined : versionArg[1];
|
|
90
|
+
}
|
|
91
|
+
if (newVersion == null) {
|
|
92
|
+
newVersion = question('No version provided. Type the new version: ');
|
|
93
|
+
}
|
|
94
|
+
console.log('**** Version to publish: ' + newVersion);
|
|
95
|
+
return newVersion;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
async function cleaningProject(settings) {
|
|
99
|
+
console.log('==>>> Cleaning project...');
|
|
100
|
+
await execute(`rm -f ${settings.packageLockPath}`);
|
|
101
|
+
await execute(`rm -f -R ${settings.nodeModulesPath}`);
|
|
102
|
+
await execute(`rm -f -R ${settings.distPath}`);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async function buildingBundle(_settings) {
|
|
106
|
+
console.log('==>>> Installing Dependencies...');
|
|
107
|
+
await execute('npm install');
|
|
108
|
+
|
|
109
|
+
console.log('==>>> Generating Build...');
|
|
110
|
+
await execute('npm run build');
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
async function startPublishingVersion(settings) {
|
|
114
|
+
await callingPublisher(settings);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async function callingPublisher(settings) {
|
|
118
|
+
console.log('==>>> Calling Publisher');
|
|
119
|
+
let anyBranch = '', tag = '';
|
|
120
|
+
const anyBranchIndex = proc.argv.findIndex(function (argv) { return argv.includes('--np-any-branch='); });
|
|
121
|
+
const tagIndex = proc.argv.findIndex(function (argv) { return argv.includes('--np-tag='); });
|
|
122
|
+
if (anyBranchIndex > -1) {
|
|
123
|
+
const anyBranchArg = proc.argv[anyBranchIndex].split('--np-any-branch=');
|
|
124
|
+
anyBranch = anyBranchArg[1] == null || anyBranchArg[1] === '' ? '' : '--any-branch';
|
|
125
|
+
}
|
|
126
|
+
if (tagIndex > -1) {
|
|
127
|
+
const tagArg = proc.argv[tagIndex].split('--np-tag=');
|
|
128
|
+
tag = tagArg[1] == null || tagArg[1] === '' ? '' : proc.argv[tagIndex].replace('--np-tag=', '--tag=');
|
|
129
|
+
}
|
|
130
|
+
await spawning(`np ${settings.newVersion}`, [anyBranch, tag]);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
async function startGeneratingDocs(settings) {
|
|
134
|
+
console.log('==>>> Starting the Docs generation');
|
|
135
|
+
|
|
136
|
+
await generatingDocument(settings);
|
|
137
|
+
await changingVersion(settings);
|
|
138
|
+
await pushingChanges(settings);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
async function generatingDocument(settings) {
|
|
142
|
+
console.log('==>>> Generating Document...');
|
|
143
|
+
await execute(`doxdox './dist/**/*.js' --output ${settings.docsFileName} --ignore './dist/cjs/**/*.js' --package ${settings.packagePath} --layout markdown`);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
async function changingVersion(settings) {
|
|
147
|
+
console.log('==>>> Replacing the old version in the document');
|
|
148
|
+
const doc = await fs.readFileSync(settings.docsPath, 'utf8');
|
|
149
|
+
const replacedDoc = doc.replace(settings.currentVersion, settings.newVersion);
|
|
150
|
+
await fs.writeFileSync(settings.docsPath, replacedDoc, 'utf8');
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
async function pushingChanges(settings) {
|
|
154
|
+
console.log('==>>> Commiting and Pushing Docs changes...');
|
|
155
|
+
|
|
156
|
+
const gitStdout = await execute('git rev-parse --abbrev-ref HEAD');
|
|
157
|
+
console.log('gitStdout', gitStdout);
|
|
158
|
+
await execute(`git add ${settings.docsPath}`);
|
|
159
|
+
await execute(`git commit -m "📝 docs: Updated docs${settings.newVersion != null || settings.newVersion !== '' ? ' for ' + settings.newVersion : ''}"`);
|
|
160
|
+
await execute(`git push -u origin ${gitStdout.stdout}`);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
async function revertChanges(settings) {
|
|
164
|
+
console.log('>>> Checking for modifications...');
|
|
165
|
+
console.warn(`>>> Unstaging posible changes from ${settings.docsFileName} and ${settings.packageFileName} file`);
|
|
166
|
+
await execute(`git restore --staged ${settings.docsPath} ${settings.packagePath}`);
|
|
167
|
+
console.warn(`>>> Discarting posible changes of ${settings.docsFileName} and ${settings.packageFileName} file`);
|
|
168
|
+
await execute(`git checkout -- ${settings.docsPath} ${settings.packagePath}`);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
async function init() {
|
|
172
|
+
let settings = {
|
|
173
|
+
currentVersion: '',
|
|
174
|
+
distPath: './dist',
|
|
175
|
+
docsPath: './README.md',
|
|
176
|
+
docsFileName: 'README.md',
|
|
177
|
+
newVersion: undefined,
|
|
178
|
+
nodeModulesPath: './node_modules',
|
|
179
|
+
packageFileName: 'package.json',
|
|
180
|
+
packageLockPath: './package-lock.json',
|
|
181
|
+
packagePath: './package.json',
|
|
182
|
+
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
console.log('Welcome. The publishing operationg will begin.');
|
|
186
|
+
try {
|
|
187
|
+
settings["currentVersion"] = await getPackageJson(settings);
|
|
188
|
+
settings["newVersion"] = await getNewVersion();
|
|
189
|
+
|
|
190
|
+
await cleaningProject(settings);
|
|
191
|
+
await buildingBundle(settings);
|
|
192
|
+
await startGeneratingDocs(settings);
|
|
193
|
+
await startPublishingVersion(settings);
|
|
194
|
+
console.info('Finished Publishing');
|
|
195
|
+
} catch (err) {
|
|
196
|
+
console.error('Error: ', err);
|
|
197
|
+
await revertChanges(settings);
|
|
198
|
+
} finally {
|
|
199
|
+
console.log('Execution finished');
|
|
200
|
+
exit();
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
init();
|
|
@@ -12,7 +12,7 @@ import { DATE_DISTINCT_TIME_PROPERTY_INFO_LIST } from "../../dates/constants/DAT
|
|
|
12
12
|
export const COLUMN_PROPERTY_INFO: { [key in IColumnType]?: IColumnPropertyInfo[] } = {
|
|
13
13
|
[COLUMN.LOOKUP]: [
|
|
14
14
|
{ value: COLUMN_PROPERTY.LOOKUP_DISPLAY, label: 'Display', shortLabel: 'Display', abbrLabel: 'DSY', displayed: true, i18nLabelPath: 'common.properties.lookup_display_label' },
|
|
15
|
-
{ value: COLUMN_PROPERTY.LOOKUP_VALUE, label: 'Value', shortLabel: 'Value', abbrLabel: 'Val', displayed: true, i18nLabelPath: 'common.properties.
|
|
15
|
+
{ value: COLUMN_PROPERTY.LOOKUP_VALUE, label: 'Value', shortLabel: 'Value', abbrLabel: 'Val', displayed: true, i18nLabelPath: 'common.properties.lookup_value_label' }
|
|
16
16
|
],
|
|
17
17
|
[COLUMN.DATE]: [
|
|
18
18
|
...DATE_GROUPING_PROPERTY_INFO_LIST,
|
|
@@ -15,7 +15,7 @@ import { IFSValueRelativeDate } from "../interfaces/common/IFSValueRelativeDate"
|
|
|
15
15
|
* @returns A new value array with the filled properties.
|
|
16
16
|
*/
|
|
17
17
|
export function adaptFilterValues(filter: IFSFilter): IFValue[] {
|
|
18
|
-
const setValue = value => ({ ...value, enabled: isEmpty(value.enabled) ? true : value.enabled });
|
|
18
|
+
const setValue = value => ({ ...value, value: isEmpty(value.value) ? undefined : value.value, enabled: isEmpty(value.enabled) ? true : value.enabled });
|
|
19
19
|
|
|
20
20
|
if (filter.column.type === COLUMN.RANKING && isEmpty(filter.column.aggregate)) {
|
|
21
21
|
return (filter.values as IFSValueRanking[][]).map(rValues => rValues.map(setValue));
|
|
@@ -9,6 +9,7 @@ import { IFSData } from "../interfaces/common/IFSData";
|
|
|
9
9
|
import { IFSScope } from "../interfaces/common/IFSScope";
|
|
10
10
|
import { IFSFilter } from "../interfaces/common/IFSFilter";
|
|
11
11
|
import { IFSDataset } from "../interfaces/common/IFSDataset";
|
|
12
|
+
import { cloneDeep } from "../../general/object/cloneDeep";
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Generates a filter data structure from the flatttened UI filters.
|
|
@@ -90,9 +91,13 @@ function buildDataset(uFilter: IFUFlattenedFilter): IFSDataset {
|
|
|
90
91
|
* @returns an filter structure
|
|
91
92
|
*/
|
|
92
93
|
function buildFilter(uFilter: IFUFlattenedFilter): IFSFilter {
|
|
94
|
+
uFilter = cloneDeep(uFilter);
|
|
95
|
+
|
|
93
96
|
const info = !isEmpty(uFilter.extras.info) ? { icon: uFilter.extras.info.icon, label: uFilter.extras.info.label } : undefined;
|
|
94
97
|
const property = adaptDateGroupingProperty(uFilter.property);
|
|
95
98
|
|
|
99
|
+
delete uFilter.extras.scopeInfo;
|
|
100
|
+
delete uFilter.extras.dataset;
|
|
96
101
|
return {
|
|
97
102
|
collapsed: uFilter.collapsed,
|
|
98
103
|
column: {
|
|
@@ -406,7 +406,7 @@ function getRankingValues(values: IFSValueRanking[][], rankingGroupIndex?: numbe
|
|
|
406
406
|
return values.map((value: IFSValue) => {
|
|
407
407
|
if (value.enabled) {
|
|
408
408
|
if (props.column.type === COLUMN.IMAGE) {
|
|
409
|
-
return value.valueid;
|
|
409
|
+
return value.valueid || value.imageUrl || value.value;
|
|
410
410
|
} else {
|
|
411
411
|
return value.value;
|
|
412
412
|
}
|
|
@@ -10,6 +10,7 @@ import { IFUFilter } from "../interfaces/ui/IFUFilter";
|
|
|
10
10
|
import { IFUDataset } from "../interfaces/ui/IFUDataset";
|
|
11
11
|
import { getLastIndexFromArray } from "../../general/array/getLastIndexFromArray";
|
|
12
12
|
import { isEmpty } from "../../general/mix/isEmpty";
|
|
13
|
+
import { cloneDeep } from "../../general/object/cloneDeep";
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Generates a UI filter data structure from the flatttened UI filters.
|
|
@@ -96,9 +97,13 @@ function buildDataset(uFilter: IFUFlattenedFilter): IFUDataset {
|
|
|
96
97
|
* @returns an filter structure
|
|
97
98
|
*/
|
|
98
99
|
function buildFilter(uFilter: IFUFlattenedFilter): IFUFilter {
|
|
100
|
+
uFilter = cloneDeep(uFilter);
|
|
101
|
+
|
|
99
102
|
const info = !isEmpty(uFilter.extras.info) ? { icon: uFilter.extras.info.icon, label: uFilter.extras.info.label } : undefined;
|
|
100
103
|
const property = adaptDateGroupingProperty(uFilter.property);
|
|
101
104
|
|
|
105
|
+
delete uFilter.extras.scopeInfo;
|
|
106
|
+
delete uFilter.extras.dataset;
|
|
102
107
|
return {
|
|
103
108
|
collapsed: uFilter.collapsed,
|
|
104
109
|
column: {
|
|
@@ -3,6 +3,7 @@ import { COLUMN_PROPERTY } from "../../../columns/constants/COLUMN_PROPERTY";
|
|
|
3
3
|
import { isDateColumn } from "../../../columns/helpers/isDateColumn";
|
|
4
4
|
import { isEmpty } from "../../../general/mix/isEmpty";
|
|
5
5
|
import { IFSFilter } from "../../interfaces/common/IFSFilter";
|
|
6
|
+
import { IFSValue } from "../../interfaces/common/IFSValue";
|
|
6
7
|
import { IFProperty } from "../../interfaces/IFProperty";
|
|
7
8
|
import { isNullValidator } from "../common/isNullValidator";
|
|
8
9
|
|
|
@@ -20,7 +21,7 @@ export function getBackendProperty(filter: IFSFilter): IFProperty {
|
|
|
20
21
|
} else if (filter.column.type === COLUMN.LOOKUP && filter.property === COLUMN_PROPERTY.LOOKUP_DISPLAY && filter.lookupDisplayIndex != null) {
|
|
21
22
|
return filter.property.concat('_').concat(filter.lookupDisplayIndex.toString()) as any;
|
|
22
23
|
} else if (filter.column.type === COLUMN.IMAGE) {
|
|
23
|
-
return COLUMN_PROPERTY.IMAGE_ANSWER_ID;
|
|
24
|
+
return (filter.values as IFSValue[]).every(value => isEmpty(value.valueid)) ? undefined : COLUMN_PROPERTY.IMAGE_ANSWER_ID;
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
return filter.property;
|
|
@@ -81,7 +81,7 @@ function getResultValues(values: IFSValue[], filter: IFSFilter): IFBExpressionVa
|
|
|
81
81
|
return values.map((value: IFSValue) => {
|
|
82
82
|
if (value.enabled) {
|
|
83
83
|
if (filter.column.type === COLUMN.IMAGE) {
|
|
84
|
-
return value.valueid;
|
|
84
|
+
return value.valueid || value.imageUrl || value.value;
|
|
85
85
|
} else {
|
|
86
86
|
return value.value;
|
|
87
87
|
}
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
export interface IFSValue {
|
|
5
5
|
enabled?: boolean; // True: the value is enabled; False: the value is disabled
|
|
6
6
|
imageUrl?: string; // URL for a image. This is common for images column type.
|
|
7
|
-
value
|
|
7
|
+
value?: string; // The value to filter
|
|
8
8
|
valueid?: string; // Mostly for webform columns that need an ID. Alias for answerid in the model object.
|
|
9
9
|
}
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
export interface IFUValue {
|
|
5
5
|
enabled?: boolean; // Optional flag to enabled the value
|
|
6
6
|
imageUrl?: string; // URL from Image type
|
|
7
|
-
value
|
|
7
|
+
value?: string; // A string value
|
|
8
8
|
valueid?: string; // For values that need a value ID or answer ID
|
|
9
9
|
}
|
package/src/format/format.ts
CHANGED
|
@@ -6,8 +6,9 @@ import { isEmpty } from '../general/mix/isEmpty';
|
|
|
6
6
|
import { _get } from '../general/object/get';
|
|
7
7
|
import { COLUMN } from '../columns/constants/COLUMN';
|
|
8
8
|
import { FORMULA } from '../formulas/constants/FORMULA';
|
|
9
|
-
import { IFormatConfig } from '..';
|
|
10
9
|
import { formatWithLocale } from './localization';
|
|
10
|
+
import { isObject } from '../general/object/isObject';
|
|
11
|
+
import { IFormatConfig } from '../interfaces/format/IFormatConfig.Interface';
|
|
11
12
|
|
|
12
13
|
dayjs.extend(advancedFormat); // Add support to advanced formats https://day.js.org/docs/en/plugin/advanced-format
|
|
13
14
|
|
|
@@ -21,9 +22,11 @@ function isValidDateString(dateString = '') {
|
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
export function formatDate(dateString, format) {
|
|
25
|
+
if(isObject(format)) format = format.format || "";
|
|
24
26
|
if (isEmpty(dateString) || !isNaN(dateString) || format === 'Default') return dateString;
|
|
25
27
|
if (!isValidDateString(dateString)) return dateString;
|
|
26
|
-
|
|
28
|
+
const dateValue = dateString?.replace(/Z$/i, '');
|
|
29
|
+
return dayjs(dateValue.split('.')[0]).format(format.replace('HH24:', 'HH:').replace('MI:SS', 'mm:ss').replace('MM:SS', 'mm:ss'));
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
export function formatAbbreviated(num, decimals) {
|
|
@@ -89,7 +92,7 @@ export const addFormat = (value: any, outputFormat: any = 'None', config?: IForm
|
|
|
89
92
|
switch (outputFormat.type) {
|
|
90
93
|
case 'DATE':
|
|
91
94
|
case 'DATETIME':
|
|
92
|
-
return config?.lang && outputFormat.format === 'Default' ? formatWithLocale(value, outputFormat, config) : formatDate(value, outputFormat
|
|
95
|
+
return config?.lang && outputFormat.format === 'Default' ? formatWithLocale(value, outputFormat, config) : formatDate(value, outputFormat?.format === 'Default' && outputFormat?.originalFormat?.format ? outputFormat?.originalFormat?.format : outputFormat?.format);
|
|
93
96
|
case 'NUMERIC': {
|
|
94
97
|
const parse = parseFloat(value);
|
|
95
98
|
const withLocale = outputFormat !== 'None' && config?.lang;
|
|
@@ -27,9 +27,10 @@ export const formatWithLocale = (value: any, outputFormat: IFormatOutputFormat,
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
+
const DATE_FORMAT_CACHE = [];
|
|
30
31
|
function formatLocaleDate(value: any, outputFormat: IFormatOutputFormat, config: IFormatConfig) {
|
|
31
32
|
const { lang = LANG_DEFAULT, options } = config;
|
|
32
|
-
const dateValue = value?.replace(
|
|
33
|
+
const dateValue = value?.replace(/Z$/i, '');
|
|
33
34
|
const dateParam = new Date(dateValue);
|
|
34
35
|
let langOpts = options;
|
|
35
36
|
if (outputFormat?.originalFormat) {
|
|
@@ -37,18 +38,31 @@ function formatLocaleDate(value: any, outputFormat: IFormatOutputFormat, config:
|
|
|
37
38
|
if (DATETIME_COLUMN_FORMAT.includes(format)) langOpts = DATETIME_OPTIONS;
|
|
38
39
|
}
|
|
39
40
|
try {
|
|
40
|
-
|
|
41
|
+
const key = lang + JSON.stringify(langOpts);
|
|
42
|
+
let formatter = DATE_FORMAT_CACHE[key];
|
|
43
|
+
if (!formatter) {
|
|
44
|
+
formatter = new Intl.DateTimeFormat([lang, LANG_DEFAULT], langOpts);
|
|
45
|
+
DATE_FORMAT_CACHE[key] = formatter;
|
|
46
|
+
}
|
|
47
|
+
return formatter.format(dateParam);
|
|
41
48
|
} catch (error) {
|
|
42
49
|
return isEmpty(dateParam) ? value : new Intl.DateTimeFormat(LANG_DEFAULT, langOpts).format(dateParam);
|
|
43
50
|
}
|
|
44
51
|
}
|
|
45
52
|
|
|
53
|
+
const NUMBER_FORMAT_CACHE = [];
|
|
46
54
|
function formatLocaleNumber(value: any, outputFormat: IFormatOutputFormat, config: IFormatConfig,) {
|
|
47
55
|
const { lang = LANG_DEFAULT, options } = config;
|
|
48
56
|
const langOpts = options || getLocaleOptions(outputFormat);
|
|
49
57
|
const valueToFormat = outputFormat?.format === LOCALE_FORMATS.PERCENTAGE ? value/100 : value;
|
|
50
58
|
try {
|
|
51
|
-
|
|
59
|
+
const key = lang + JSON.stringify(langOpts);
|
|
60
|
+
let formatter = NUMBER_FORMAT_CACHE[key];
|
|
61
|
+
if (!formatter) {
|
|
62
|
+
formatter = new Intl.NumberFormat([lang, LANG_DEFAULT], langOpts);
|
|
63
|
+
NUMBER_FORMAT_CACHE[key] = formatter;
|
|
64
|
+
}
|
|
65
|
+
return formatter.format(valueToFormat);
|
|
52
66
|
} catch (e) {
|
|
53
67
|
return new Intl.NumberFormat(LANG_DEFAULT, langOpts).format(valueToFormat);
|
|
54
68
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export interface II18nFormulaBuilderListTable{
|
|
2
|
-
name: string;
|
|
3
|
-
formula: string;
|
|
4
|
-
menu_edit: string;
|
|
5
|
-
menu_duplicate: string;
|
|
6
|
-
menu_delete: string;
|
|
7
2
|
duplicate_copy: string;
|
|
8
3
|
duplicate_toast: string
|
|
4
|
+
formula: string;
|
|
5
|
+
menu_delete: string;
|
|
6
|
+
menu_duplicate: string;
|
|
7
|
+
menu_edit: string;
|
|
8
|
+
name: string;
|
|
9
9
|
}
|