@qrvey/utils 1.2.9-19 → 1.2.9-22
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 +125 -125
- package/dist/cjs/filters/helpers/builder/getFilterBuilderGeneralConfig.js +1 -1
- package/dist/cjs/filters/helpers/ui/getUIValues.js +1 -1
- package/dist/cjs/filters/interfaces/builder/IFilterBuilderConfig.d.ts +0 -2
- package/dist/cjs/filters/interfaces/builder/IFilterBuilderGeneralConfig.d.ts +2 -1
- package/dist/cjs/filters/interfaces/panel/IFilterPanelConfig.d.ts +2 -3
- package/dist/cjs/filters/interfaces/ui/IFUTransformFilterValuesSettings.d.ts +2 -1
- package/dist/cjs/format/definition.d.ts +8 -2
- package/dist/cjs/format/definition.js +2 -1
- package/dist/cjs/format/format.js +1 -1
- package/dist/cjs/format/localization.js +7 -7
- package/dist/cjs/globalization/interfaces/II18nConfig.d.ts +6 -0
- package/dist/cjs/globalization/interfaces/{IResourceI18n.js → II18nConfig.js} +0 -0
- package/dist/cjs/globalization/interfaces/{IResourceI18n.d.ts → II18nResource.d.ts} +1 -1
- package/dist/cjs/globalization/interfaces/II18nResource.js +2 -0
- package/dist/cjs/globalization/interfaces/bucket_builder/II18nBucketBuilderModalBucket.d.ts +2 -0
- package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderListModal.d.ts +2 -0
- package/dist/cjs/globalization/interfaces/index.d.ts +2 -1
- package/dist/cjs/globalization/interfaces/index.js +2 -1
- package/dist/cjs/globalization/interfaces/style_themes/II18nStyleThemesTooltips.d.ts +1 -0
- package/dist/cjs/globalization/labels/I18N_DEFAULT.d.ts +2 -2
- package/dist/cjs/globalization/labels/bucket_builder/I18N_BUCKET_BUILDER.js +2 -0
- package/dist/cjs/globalization/labels/formula_builder/I18N_FORMULA_BUILDER.js +3 -1
- package/dist/cjs/globalization/labels/style_themes/I18N_STYLE_THEMES.js +1 -0
- package/dist/cjs/globalization/service/i18nextBuilder.d.ts +3 -3
- package/dist/cjs/globalization/service/initI18n.d.ts +2 -2
- package/dist/cjs/qrvey/helpers/transformValue.js +2 -1
- package/dist/cjs/qrvey/interfaces/ITransformValueSettings.d.ts +2 -1
- package/dist/filters/helpers/builder/getFilterBuilderGeneralConfig.js +1 -1
- package/dist/filters/helpers/ui/getUIValues.js +1 -1
- package/dist/filters/interfaces/builder/IFilterBuilderConfig.d.ts +0 -2
- package/dist/filters/interfaces/builder/IFilterBuilderGeneralConfig.d.ts +2 -1
- package/dist/filters/interfaces/panel/IFilterPanelConfig.d.ts +2 -3
- package/dist/filters/interfaces/ui/IFUTransformFilterValuesSettings.d.ts +2 -1
- package/dist/format/definition.d.ts +8 -2
- package/dist/format/definition.js +1 -0
- package/dist/format/format.js +1 -1
- package/dist/format/localization.js +8 -8
- package/dist/globalization/interfaces/II18nConfig.d.ts +6 -0
- package/dist/globalization/interfaces/{IResourceI18n.js → II18nConfig.js} +0 -0
- package/dist/globalization/interfaces/{IResourceI18n.d.ts → II18nResource.d.ts} +1 -1
- package/dist/globalization/interfaces/II18nResource.js +1 -0
- package/dist/globalization/interfaces/bucket_builder/II18nBucketBuilderModalBucket.d.ts +2 -0
- package/dist/globalization/interfaces/formula_builder/II18nFormulaBuilderListModal.d.ts +2 -0
- package/dist/globalization/interfaces/index.d.ts +2 -1
- package/dist/globalization/interfaces/index.js +2 -1
- package/dist/globalization/interfaces/style_themes/II18nStyleThemesTooltips.d.ts +1 -0
- package/dist/globalization/labels/I18N_DEFAULT.d.ts +2 -2
- package/dist/globalization/labels/bucket_builder/I18N_BUCKET_BUILDER.js +2 -0
- package/dist/globalization/labels/formula_builder/I18N_FORMULA_BUILDER.js +3 -1
- package/dist/globalization/labels/style_themes/I18N_STYLE_THEMES.js +1 -0
- package/dist/globalization/service/i18nextBuilder.d.ts +3 -3
- package/dist/globalization/service/initI18n.d.ts +2 -2
- package/dist/qrvey/helpers/transformValue.js +2 -1
- package/dist/qrvey/interfaces/ITransformValueSettings.d.ts +2 -1
- package/package.json +1 -1
- package/src/filters/helpers/builder/getFilterBuilderGeneralConfig.ts +1 -1
- package/src/filters/helpers/ui/getUIValues.ts +1 -1
- package/src/filters/interfaces/builder/IFilterBuilderConfig.ts +0 -2
- package/src/filters/interfaces/builder/IFilterBuilderGeneralConfig.ts +3 -1
- package/src/filters/interfaces/panel/IFilterPanelConfig.ts +2 -3
- package/src/filters/interfaces/ui/IFUTransformFilterValuesSettings.ts +2 -1
- package/src/format/definition.ts +4 -1
- package/src/format/format.ts +1 -1
- package/src/format/localization.ts +6 -6
- package/src/globalization/interfaces/II18nConfig.ts +7 -0
- package/src/globalization/interfaces/{IResourceI18n.ts → II18nResource.ts} +1 -1
- package/src/globalization/interfaces/bucket_builder/II18nBucketBuilderModalBucket.ts +2 -0
- package/src/globalization/interfaces/formula_builder/II18nFormulaBuilderListModal.ts +3 -1
- package/src/globalization/interfaces/index.ts +2 -1
- package/src/globalization/interfaces/style_themes/II18nStyleThemesTooltips.ts +1 -0
- package/src/globalization/labels/I18N_DEFAULT.ts +2 -2
- package/src/globalization/labels/bucket_builder/I18N_BUCKET_BUILDER.ts +2 -0
- package/src/globalization/labels/formula_builder/I18N_FORMULA_BUILDER.ts +3 -1
- package/src/globalization/labels/style_themes/I18N_STYLE_THEMES.ts +1 -0
- package/src/globalization/service/i18nextBuilder.ts +4 -4
- package/src/globalization/service/initI18n.ts +3 -3
- package/src/qrvey/helpers/transformValue.ts +1 -1
- package/src/qrvey/interfaces/ITransformValueSettings.ts +2 -1
|
@@ -93,7 +93,7 @@ const addFormat = (value, outputFormat = 'None', config) => {
|
|
|
93
93
|
return (config === null || config === void 0 ? void 0 : config.lang) && outputFormat.format === 'Default' ? (0, localization_1.formatWithLocale)(value, outputFormat, config) : formatDate(value, outputFormat.format);
|
|
94
94
|
case 'NUMERIC': {
|
|
95
95
|
const parse = parseFloat(value);
|
|
96
|
-
const withLocale = outputFormat
|
|
96
|
+
const withLocale = outputFormat !== 'None' && (config === null || config === void 0 ? void 0 : config.lang);
|
|
97
97
|
return isNaN(parse) ? value : withLocale ? (0, localization_1.formatWithLocale)(value, outputFormat, config)
|
|
98
98
|
: formatNumber(parse, outputFormat, config);
|
|
99
99
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.formatWithLocale = exports.chooseLang = exports.getLang = void 0;
|
|
4
|
+
const isEmpty_1 = require("../general/mix/isEmpty");
|
|
4
5
|
const definition_1 = require("./definition");
|
|
5
6
|
const getLang = (locale) => {
|
|
6
7
|
if (!locale)
|
|
@@ -12,12 +13,10 @@ const getLang = (locale) => {
|
|
|
12
13
|
};
|
|
13
14
|
exports.getLang = getLang;
|
|
14
15
|
const chooseLang = (config) => {
|
|
15
|
-
var _a, _b
|
|
16
|
+
var _a, _b;
|
|
16
17
|
const lang = (((_a = config === null || config === void 0 ? void 0 : config.i18n) === null || _a === void 0 ? void 0 : _a.lang) ||
|
|
17
|
-
((_c = (_b = config === null || config === void 0 ? void 0 : config.i18n) === null || _b === void 0 ? void 0 : _b.locale) === null || _c === void 0 ? void 0 : _c.lang) ||
|
|
18
|
-
((_d = config === null || config === void 0 ? void 0 : config.locale) === null || _d === void 0 ? void 0 : _d.lang) ||
|
|
19
18
|
config.lang);
|
|
20
|
-
return ((
|
|
19
|
+
return ((_b = lang) === null || _b === void 0 ? void 0 : _b.lang) || lang || definition_1.LANG_DEFAULT;
|
|
21
20
|
};
|
|
22
21
|
exports.chooseLang = chooseLang;
|
|
23
22
|
const formatWithLocale = (value, outputFormat, config = {}) => {
|
|
@@ -51,15 +50,16 @@ function formatLocaleNumber(value, outputFormat, config) {
|
|
|
51
50
|
}
|
|
52
51
|
}
|
|
53
52
|
function getLocaleOptions(outputFormat) {
|
|
54
|
-
const { format, decimals, currency
|
|
53
|
+
const { format, decimals, currency } = outputFormat;
|
|
55
54
|
switch (format) {
|
|
56
55
|
case "Currency" /* CURRENCY */: {
|
|
57
|
-
const iso = definition_1.currencyISO.find(item => item.text ===
|
|
58
|
-
return { style: "currency" /* CURRENCY */, currency: iso.label, maximumFractionDigits: decimals, minimumFractionDigits: 0 };
|
|
56
|
+
const iso = (0, isEmpty_1.isEmpty)(currency) ? definition_1.CURRENCY_DEFAULT : definition_1.currencyISO.find(item => (item.text === currency.text) || item.text.includes(currency.label));
|
|
57
|
+
return { style: "currency" /* CURRENCY */, currency: iso.label, maximumFractionDigits: decimals, minimumFractionDigits: 0, currencyDisplay: 'narrowSymbol' };
|
|
59
58
|
}
|
|
60
59
|
case "Scientific" /* SCIENTIFIC */: return { style: "decimal" /* DECIMAL */,
|
|
61
60
|
notation: "scientific" /* SCIENTIFIC */, maximumFractionDigits: decimals };
|
|
62
61
|
case "Percentage" /* PERCENTAGE */: return { style: "percent" /* PERCENT */, maximumFractionDigits: decimals };
|
|
62
|
+
case "Abbreviated" /* ABBREVIATED */: return { notation: "compact" /* COMPACT */, maximumFractionDigits: decimals };
|
|
63
63
|
default: return { style: "decimal" /* DECIMAL */, maximumFractionDigits: decimals };
|
|
64
64
|
}
|
|
65
65
|
}
|
|
File without changes
|
|
@@ -11,7 +11,7 @@ import { II18nBucketBuilder } from './bucket_builder/II18nBucketBuilder';
|
|
|
11
11
|
import { II18nCrossTabs } from './cross_tabs';
|
|
12
12
|
import { II18nChartBuilder } from '.';
|
|
13
13
|
import { II18nStyleThemes } from './style_themes/II18nStyleThemes';
|
|
14
|
-
export interface
|
|
14
|
+
export interface II18nResource {
|
|
15
15
|
bucket_builder?: II18nBucketBuilder;
|
|
16
16
|
chart_builder?: II18nChartBuilder;
|
|
17
17
|
common?: II18nCommon;
|
|
@@ -10,6 +10,7 @@ export * from './formula_builder/index';
|
|
|
10
10
|
export * from './panel/index';
|
|
11
11
|
export * from './style_themes/index';
|
|
12
12
|
export * from './table_charts/index';
|
|
13
|
+
export * from './II18nConfig';
|
|
14
|
+
export * from './II18nResource';
|
|
13
15
|
export * from './II18nServiceTranslate';
|
|
14
16
|
export * from './II18nServiceTranslateOption';
|
|
15
|
-
export * from './IResourceI18n';
|
|
@@ -22,6 +22,7 @@ __exportStar(require("./formula_builder/index"), exports);
|
|
|
22
22
|
__exportStar(require("./panel/index"), exports);
|
|
23
23
|
__exportStar(require("./style_themes/index"), exports);
|
|
24
24
|
__exportStar(require("./table_charts/index"), exports);
|
|
25
|
+
__exportStar(require("./II18nConfig"), exports);
|
|
26
|
+
__exportStar(require("./II18nResource"), exports);
|
|
25
27
|
__exportStar(require("./II18nServiceTranslate"), exports);
|
|
26
28
|
__exportStar(require("./II18nServiceTranslateOption"), exports);
|
|
27
|
-
__exportStar(require("./IResourceI18n"), exports);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const I18N_DEFAULT:
|
|
1
|
+
import { II18nResource } from "../interfaces/II18nResource";
|
|
2
|
+
export declare const I18N_DEFAULT: II18nResource;
|
|
@@ -97,6 +97,8 @@ exports.I18N_BUCKET_BUILDER = {
|
|
|
97
97
|
loading: 'Loading dependencies...',
|
|
98
98
|
title: 'Buckets',
|
|
99
99
|
add_bucketed_column: 'Add Bucketed Column',
|
|
100
|
+
information_text_link: 'Learn how to',
|
|
101
|
+
information_text_text: 'create and work with buckets',
|
|
100
102
|
},
|
|
101
103
|
operator: {
|
|
102
104
|
greater_than: 'Greater than',
|
|
@@ -5,7 +5,9 @@ exports.I18N_FORMULA_BUILDER = {
|
|
|
5
5
|
list_modal: {
|
|
6
6
|
title_header: 'Formulas',
|
|
7
7
|
create_button: 'Create Formula',
|
|
8
|
-
empty_message: 'No Formulas Yet'
|
|
8
|
+
empty_message: 'No Formulas Yet',
|
|
9
|
+
information_text_link: 'Learn how to',
|
|
10
|
+
information_text_text: 'create and work with formulas',
|
|
9
11
|
},
|
|
10
12
|
list_table: {
|
|
11
13
|
name: 'Formula Name',
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { II18nResource } from '../interfaces/II18nResource';
|
|
2
2
|
import { II18nServiceTranslateOption } from "../interfaces/II18nServiceTranslateOption";
|
|
3
3
|
export declare class I18nServiceBuilder {
|
|
4
|
-
static buildI18n(i18nDefault:
|
|
4
|
+
static buildI18n(i18nDefault: II18nResource, i18nResource: II18nResource): Promise<I18nService>;
|
|
5
5
|
private static _initI18n;
|
|
6
|
-
static setTranslations(i18nDefault: any, i18nResource:
|
|
6
|
+
static setTranslations(i18nDefault: any, i18nResource: II18nResource): II18nResource;
|
|
7
7
|
}
|
|
8
8
|
export declare abstract class I18nService {
|
|
9
9
|
abstract translate(key: string, options?: II18nServiceTranslateOption): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { II18nResource } from "../interfaces/II18nResource";
|
|
2
2
|
import { I18nService } from "../service/i18nextBuilder";
|
|
3
|
-
export declare function initI18n(i18nConfig?:
|
|
3
|
+
export declare function initI18n(i18nConfig?: II18nResource, i18nDefault?: II18nResource): Promise<I18nService>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { IColumn } from "../../columns/interfaces/IColumn";
|
|
2
2
|
import { IColumnPropertyType } from "../../columns/interfaces/IColumnPropertyType";
|
|
3
|
+
import { II18nConfig } from "../../globalization/interfaces/II18nConfig";
|
|
3
4
|
import { II18nServiceTranslate } from "../../globalization/interfaces/II18nServiceTranslate";
|
|
4
5
|
export interface ITransformValueSettings {
|
|
5
6
|
column: IColumn;
|
|
6
7
|
property: IColumnPropertyType;
|
|
7
8
|
translate: II18nServiceTranslate;
|
|
8
|
-
|
|
9
|
+
i18n: II18nConfig;
|
|
9
10
|
suffixTranslateLabel?: string;
|
|
10
11
|
}
|
|
@@ -9,7 +9,7 @@ export function getFilterBuilderGeneralConfig(config = {}) {
|
|
|
9
9
|
apiKey: getAttribute(config, 'api_key') || config.apiKey,
|
|
10
10
|
appid: getAttribute(config, 'app_id') || config.appid,
|
|
11
11
|
domain: config.domain,
|
|
12
|
-
|
|
12
|
+
i18n: config.i18n,
|
|
13
13
|
qv_token: config.qv_token,
|
|
14
14
|
timezoneControl: getAttribute(config, 'timezone_control') || config.timezoneControl,
|
|
15
15
|
userid: getAttribute(config, 'user_id') || config.userid,
|
|
@@ -42,7 +42,7 @@ export function getUIValues(filter, settings) {
|
|
|
42
42
|
case FILTER_VALIDATOR.IS_NULL:
|
|
43
43
|
case FILTER_VALIDATOR.IS_NOT_NULL:
|
|
44
44
|
return [{
|
|
45
|
-
value: FILTER_VALIDATOR_INFO[filter.validator].label,
|
|
45
|
+
value: (settings === null || settings === void 0 ? void 0 : settings.translate) ? settings.translate('filter.validators.' + filter.validator.toLowerCase() + '_label') : FILTER_VALIDATOR_INFO[filter.validator].label,
|
|
46
46
|
enabled: settings.addEnableds ? (_a = filter.values[0]) === null || _a === void 0 ? void 0 : _a.enabled : undefined,
|
|
47
47
|
}];
|
|
48
48
|
case FILTER_VALIDATOR.IN:
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { IResourceI18n } from "../../../globalization/interfaces/IResourceI18n";
|
|
2
1
|
import { IFBLogic } from "../backend/IFBLogic";
|
|
3
2
|
import { IFBUserFilters } from "../backend/IFBUserFilters";
|
|
4
3
|
import { IFSColumn } from "../common/IFSColumn";
|
|
@@ -15,7 +14,6 @@ import { IFilterBuilderSettings } from "./IFilterBuilderSettings";
|
|
|
15
14
|
* Structure for the configuration of the Filter Builder
|
|
16
15
|
*/
|
|
17
16
|
export interface IFilterBuilderConfig {
|
|
18
|
-
i18n?: IResourceI18n;
|
|
19
17
|
datasets?: string[];
|
|
20
18
|
filterData?: IFSData;
|
|
21
19
|
filterLabel?: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { II18nConfig } from "../../../globalization/interfaces/II18nConfig";
|
|
1
2
|
/**
|
|
2
3
|
* Structure for the Fiter Builder General config
|
|
3
4
|
*/
|
|
@@ -7,6 +8,6 @@ export interface IFilterBuilderGeneralConfig {
|
|
|
7
8
|
domain: string;
|
|
8
9
|
qv_token?: string;
|
|
9
10
|
timezoneControl?: string;
|
|
10
|
-
|
|
11
|
+
i18n?: II18nConfig;
|
|
11
12
|
userid: string;
|
|
12
13
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { II18nConfig } from "../../../globalization/interfaces/II18nConfig";
|
|
2
2
|
import { IFilterBuilderConfig } from "../builder/IFilterBuilderConfig";
|
|
3
3
|
import { IFUDataStore } from "../ui/IFUDataStore";
|
|
4
4
|
/**
|
|
@@ -6,6 +6,5 @@ import { IFUDataStore } from "../ui/IFUDataStore";
|
|
|
6
6
|
*/
|
|
7
7
|
export interface IFilterPanelConfig extends IFUDataStore {
|
|
8
8
|
filterBuilderConfig?: IFilterBuilderConfig;
|
|
9
|
-
i18n?:
|
|
10
|
-
locale?: string;
|
|
9
|
+
i18n?: II18nConfig;
|
|
11
10
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { II18nConfig } from "../../../globalization/interfaces/II18nConfig";
|
|
1
2
|
import { II18nServiceTranslate } from "../../../globalization/interfaces/II18nServiceTranslate";
|
|
2
3
|
export interface IFUTransformFilterValuesSettings {
|
|
3
4
|
translate: II18nServiceTranslate;
|
|
4
|
-
|
|
5
|
+
i18n: II18nConfig;
|
|
5
6
|
suffixTranslateLabel?: string;
|
|
6
7
|
}
|
|
@@ -19,12 +19,18 @@ export declare const enum LOCALE_FORMATS {
|
|
|
19
19
|
DECIMAL = "Decimal",
|
|
20
20
|
CURRENCY = "Currency",
|
|
21
21
|
PERCENTAGE = "Percentage",
|
|
22
|
-
SCIENTIFIC = "Scientific"
|
|
22
|
+
SCIENTIFIC = "Scientific",
|
|
23
|
+
ABBREVIATED = "Abbreviated"
|
|
23
24
|
}
|
|
24
25
|
export declare const enum LOCALE_STYLES {
|
|
25
26
|
DECIMAL = "decimal",
|
|
26
27
|
PERCENT = "percent",
|
|
27
28
|
CURRENCY = "currency",
|
|
28
|
-
SCIENTIFIC = "scientific"
|
|
29
|
+
SCIENTIFIC = "scientific",
|
|
30
|
+
COMPACT = "compact"
|
|
29
31
|
}
|
|
30
32
|
export declare const LANG_DEFAULT = "en-US";
|
|
33
|
+
export declare const CURRENCY_DEFAULT: {
|
|
34
|
+
text: string;
|
|
35
|
+
label: string;
|
|
36
|
+
};
|
package/dist/format/format.js
CHANGED
|
@@ -84,7 +84,7 @@ export const addFormat = (value, outputFormat = 'None', config) => {
|
|
|
84
84
|
return (config === null || config === void 0 ? void 0 : config.lang) && outputFormat.format === 'Default' ? formatWithLocale(value, outputFormat, config) : formatDate(value, outputFormat.format);
|
|
85
85
|
case 'NUMERIC': {
|
|
86
86
|
const parse = parseFloat(value);
|
|
87
|
-
const withLocale = outputFormat
|
|
87
|
+
const withLocale = outputFormat !== 'None' && (config === null || config === void 0 ? void 0 : config.lang);
|
|
88
88
|
return isNaN(parse) ? value : withLocale ? formatWithLocale(value, outputFormat, config)
|
|
89
89
|
: formatNumber(parse, outputFormat, config);
|
|
90
90
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isEmpty } from '../general/mix/isEmpty';
|
|
2
|
+
import { currencyISO, LANG_DEFAULT, CURRENCY_DEFAULT } from './definition';
|
|
2
3
|
export const getLang = (locale) => {
|
|
3
4
|
if (!locale)
|
|
4
5
|
return;
|
|
@@ -8,12 +9,10 @@ export const getLang = (locale) => {
|
|
|
8
9
|
return { lang: locale === "browser" ? window.navigator.language : locale };
|
|
9
10
|
};
|
|
10
11
|
export const chooseLang = (config) => {
|
|
11
|
-
var _a, _b
|
|
12
|
+
var _a, _b;
|
|
12
13
|
const lang = (((_a = config === null || config === void 0 ? void 0 : config.i18n) === null || _a === void 0 ? void 0 : _a.lang) ||
|
|
13
|
-
((_c = (_b = config === null || config === void 0 ? void 0 : config.i18n) === null || _b === void 0 ? void 0 : _b.locale) === null || _c === void 0 ? void 0 : _c.lang) ||
|
|
14
|
-
((_d = config === null || config === void 0 ? void 0 : config.locale) === null || _d === void 0 ? void 0 : _d.lang) ||
|
|
15
14
|
config.lang);
|
|
16
|
-
return ((
|
|
15
|
+
return ((_b = lang) === null || _b === void 0 ? void 0 : _b.lang) || lang || LANG_DEFAULT;
|
|
17
16
|
};
|
|
18
17
|
export const formatWithLocale = (value, outputFormat, config = {}) => {
|
|
19
18
|
switch (outputFormat.type) {
|
|
@@ -45,15 +44,16 @@ function formatLocaleNumber(value, outputFormat, config) {
|
|
|
45
44
|
}
|
|
46
45
|
}
|
|
47
46
|
function getLocaleOptions(outputFormat) {
|
|
48
|
-
const { format, decimals, currency
|
|
47
|
+
const { format, decimals, currency } = outputFormat;
|
|
49
48
|
switch (format) {
|
|
50
49
|
case "Currency" /* CURRENCY */: {
|
|
51
|
-
const iso = currencyISO.find(item => item.text ===
|
|
52
|
-
return { style: "currency" /* CURRENCY */, currency: iso.label, maximumFractionDigits: decimals, minimumFractionDigits: 0 };
|
|
50
|
+
const iso = isEmpty(currency) ? CURRENCY_DEFAULT : currencyISO.find(item => (item.text === currency.text) || item.text.includes(currency.label));
|
|
51
|
+
return { style: "currency" /* CURRENCY */, currency: iso.label, maximumFractionDigits: decimals, minimumFractionDigits: 0, currencyDisplay: 'narrowSymbol' };
|
|
53
52
|
}
|
|
54
53
|
case "Scientific" /* SCIENTIFIC */: return { style: "decimal" /* DECIMAL */,
|
|
55
54
|
notation: "scientific" /* SCIENTIFIC */, maximumFractionDigits: decimals };
|
|
56
55
|
case "Percentage" /* PERCENTAGE */: return { style: "percent" /* PERCENT */, maximumFractionDigits: decimals };
|
|
56
|
+
case "Abbreviated" /* ABBREVIATED */: return { notation: "compact" /* COMPACT */, maximumFractionDigits: decimals };
|
|
57
57
|
default: return { style: "decimal" /* DECIMAL */, maximumFractionDigits: decimals };
|
|
58
58
|
}
|
|
59
59
|
}
|
|
File without changes
|
|
@@ -11,7 +11,7 @@ import { II18nBucketBuilder } from './bucket_builder/II18nBucketBuilder';
|
|
|
11
11
|
import { II18nCrossTabs } from './cross_tabs';
|
|
12
12
|
import { II18nChartBuilder } from '.';
|
|
13
13
|
import { II18nStyleThemes } from './style_themes/II18nStyleThemes';
|
|
14
|
-
export interface
|
|
14
|
+
export interface II18nResource {
|
|
15
15
|
bucket_builder?: II18nBucketBuilder;
|
|
16
16
|
chart_builder?: II18nChartBuilder;
|
|
17
17
|
common?: II18nCommon;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -10,6 +10,7 @@ export * from './formula_builder/index';
|
|
|
10
10
|
export * from './panel/index';
|
|
11
11
|
export * from './style_themes/index';
|
|
12
12
|
export * from './table_charts/index';
|
|
13
|
+
export * from './II18nConfig';
|
|
14
|
+
export * from './II18nResource';
|
|
13
15
|
export * from './II18nServiceTranslate';
|
|
14
16
|
export * from './II18nServiceTranslateOption';
|
|
15
|
-
export * from './IResourceI18n';
|
|
@@ -10,6 +10,7 @@ export * from './formula_builder/index';
|
|
|
10
10
|
export * from './panel/index';
|
|
11
11
|
export * from './style_themes/index';
|
|
12
12
|
export * from './table_charts/index';
|
|
13
|
+
export * from './II18nConfig';
|
|
14
|
+
export * from './II18nResource';
|
|
13
15
|
export * from './II18nServiceTranslate';
|
|
14
16
|
export * from './II18nServiceTranslateOption';
|
|
15
|
-
export * from './IResourceI18n';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const I18N_DEFAULT:
|
|
1
|
+
import { II18nResource } from "../interfaces/II18nResource";
|
|
2
|
+
export declare const I18N_DEFAULT: II18nResource;
|
|
@@ -94,6 +94,8 @@ export const I18N_BUCKET_BUILDER = {
|
|
|
94
94
|
loading: 'Loading dependencies...',
|
|
95
95
|
title: 'Buckets',
|
|
96
96
|
add_bucketed_column: 'Add Bucketed Column',
|
|
97
|
+
information_text_link: 'Learn how to',
|
|
98
|
+
information_text_text: 'create and work with buckets',
|
|
97
99
|
},
|
|
98
100
|
operator: {
|
|
99
101
|
greater_than: 'Greater than',
|
|
@@ -2,7 +2,9 @@ export const I18N_FORMULA_BUILDER = {
|
|
|
2
2
|
list_modal: {
|
|
3
3
|
title_header: 'Formulas',
|
|
4
4
|
create_button: 'Create Formula',
|
|
5
|
-
empty_message: 'No Formulas Yet'
|
|
5
|
+
empty_message: 'No Formulas Yet',
|
|
6
|
+
information_text_link: 'Learn how to',
|
|
7
|
+
information_text_text: 'create and work with formulas',
|
|
6
8
|
},
|
|
7
9
|
list_table: {
|
|
8
10
|
name: 'Formula Name',
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { II18nResource } from '../interfaces/II18nResource';
|
|
2
2
|
import { II18nServiceTranslateOption } from "../interfaces/II18nServiceTranslateOption";
|
|
3
3
|
export declare class I18nServiceBuilder {
|
|
4
|
-
static buildI18n(i18nDefault:
|
|
4
|
+
static buildI18n(i18nDefault: II18nResource, i18nResource: II18nResource): Promise<I18nService>;
|
|
5
5
|
private static _initI18n;
|
|
6
|
-
static setTranslations(i18nDefault: any, i18nResource:
|
|
6
|
+
static setTranslations(i18nDefault: any, i18nResource: II18nResource): II18nResource;
|
|
7
7
|
}
|
|
8
8
|
export declare abstract class I18nService {
|
|
9
9
|
abstract translate(key: string, options?: II18nServiceTranslateOption): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { II18nResource } from "../interfaces/II18nResource";
|
|
2
2
|
import { I18nService } from "../service/i18nextBuilder";
|
|
3
|
-
export declare function initI18n(i18nConfig?:
|
|
3
|
+
export declare function initI18n(i18nConfig?: II18nResource, i18nDefault?: II18nResource): Promise<I18nService>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { IColumn } from "../../columns/interfaces/IColumn";
|
|
2
2
|
import { IColumnPropertyType } from "../../columns/interfaces/IColumnPropertyType";
|
|
3
|
+
import { II18nConfig } from "../../globalization/interfaces/II18nConfig";
|
|
3
4
|
import { II18nServiceTranslate } from "../../globalization/interfaces/II18nServiceTranslate";
|
|
4
5
|
export interface ITransformValueSettings {
|
|
5
6
|
column: IColumn;
|
|
6
7
|
property: IColumnPropertyType;
|
|
7
8
|
translate: II18nServiceTranslate;
|
|
8
|
-
|
|
9
|
+
i18n: II18nConfig;
|
|
9
10
|
suffixTranslateLabel?: string;
|
|
10
11
|
}
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@ export function getFilterBuilderGeneralConfig(config: any = {}): IFilterBuilderG
|
|
|
11
11
|
apiKey: getAttribute(config, 'api_key') || config.apiKey,
|
|
12
12
|
appid: getAttribute(config, 'app_id') || config.appid,
|
|
13
13
|
domain: config.domain,
|
|
14
|
-
|
|
14
|
+
i18n: config.i18n,
|
|
15
15
|
qv_token: config.qv_token,
|
|
16
16
|
timezoneControl: getAttribute(config, 'timezone_control') || config.timezoneControl,
|
|
17
17
|
userid: getAttribute(config, 'user_id') || config.userid,
|
|
@@ -49,7 +49,7 @@ export function getUIValues(filter: IFSFilter, settings?: IFUUIValueSettings): I
|
|
|
49
49
|
case FILTER_VALIDATOR.IS_NULL:
|
|
50
50
|
case FILTER_VALIDATOR.IS_NOT_NULL:
|
|
51
51
|
return [{
|
|
52
|
-
value: FILTER_VALIDATOR_INFO[filter.validator].label,
|
|
52
|
+
value: settings?.translate ? settings.translate('filter.validators.' + filter.validator.toLowerCase() + '_label') : FILTER_VALIDATOR_INFO[filter.validator].label,
|
|
53
53
|
enabled: settings.addEnableds ? (filter.values as IFSValue[])[0]?.enabled : undefined,
|
|
54
54
|
}];
|
|
55
55
|
case FILTER_VALIDATOR.IN:
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { IResourceI18n } from "../../../globalization/interfaces/IResourceI18n";
|
|
2
1
|
import { IFBLogic } from "../backend/IFBLogic";
|
|
3
2
|
import { IFBUserFilters } from "../backend/IFBUserFilters";
|
|
4
3
|
import { IFSColumn } from "../common/IFSColumn";
|
|
@@ -16,7 +15,6 @@ import { IFilterBuilderSettings } from "./IFilterBuilderSettings";
|
|
|
16
15
|
* Structure for the configuration of the Filter Builder
|
|
17
16
|
*/
|
|
18
17
|
export interface IFilterBuilderConfig {
|
|
19
|
-
i18n?: IResourceI18n; // Globalization object
|
|
20
18
|
datasets?: string[]; // Qrvey IDs for displaying their columns in the colum selector. No qrveyids, the column list is not render
|
|
21
19
|
filterData?: IFSData; // The Filter Data structure
|
|
22
20
|
filterLabel?: string; // A label for the filter. If filterLabel is provided the old filterLabel is replaced by the new one
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { II18nConfig } from "../../../globalization/interfaces/II18nConfig";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Structure for the Fiter Builder General config
|
|
3
5
|
*/
|
|
@@ -7,6 +9,6 @@ export interface IFilterBuilderGeneralConfig {
|
|
|
7
9
|
domain: string; // The domain of the environment
|
|
8
10
|
qv_token?: string; // Qrvey Token for RLS
|
|
9
11
|
timezoneControl?: string; // Offset number for Timezone
|
|
10
|
-
|
|
12
|
+
i18n?: II18nConfig; // The i18n configuration;
|
|
11
13
|
userid: string; // User ID
|
|
12
14
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { II18nConfig } from "../../../globalization/interfaces/II18nConfig";
|
|
2
2
|
import { IFilterBuilderConfig } from "../builder/IFilterBuilderConfig";
|
|
3
3
|
import { IFUDataStore } from "../ui/IFUDataStore";
|
|
4
4
|
|
|
@@ -7,6 +7,5 @@ import { IFUDataStore } from "../ui/IFUDataStore";
|
|
|
7
7
|
*/
|
|
8
8
|
export interface IFilterPanelConfig extends IFUDataStore {
|
|
9
9
|
filterBuilderConfig?: IFilterBuilderConfig; // Filter Builder config object
|
|
10
|
-
i18n?:
|
|
11
|
-
locale?: string; // Localization setting
|
|
10
|
+
i18n?: II18nConfig; // The i18n configuration;
|
|
12
11
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { II18nConfig } from "../../../globalization/interfaces/II18nConfig";
|
|
1
2
|
import { II18nServiceTranslate } from "../../../globalization/interfaces/II18nServiceTranslate";
|
|
2
3
|
|
|
3
4
|
export interface IFUTransformFilterValuesSettings {
|
|
4
5
|
translate: II18nServiceTranslate; // Function for getting translations
|
|
5
|
-
|
|
6
|
+
i18n: II18nConfig; // I18n configuration
|
|
6
7
|
suffixTranslateLabel?: string // The i18n label for the suffix values.
|
|
7
8
|
}
|
package/src/format/definition.ts
CHANGED
|
@@ -91,12 +91,15 @@ export const enum LOCALE_FORMATS {
|
|
|
91
91
|
CURRENCY = 'Currency',
|
|
92
92
|
PERCENTAGE = 'Percentage',
|
|
93
93
|
SCIENTIFIC = 'Scientific',
|
|
94
|
+
ABBREVIATED = 'Abbreviated'
|
|
94
95
|
}
|
|
95
96
|
export const enum LOCALE_STYLES {
|
|
96
97
|
DECIMAL = 'decimal',
|
|
97
98
|
PERCENT = 'percent',
|
|
98
99
|
CURRENCY = 'currency',
|
|
99
100
|
SCIENTIFIC = 'scientific',
|
|
101
|
+
COMPACT = 'compact'
|
|
100
102
|
}
|
|
101
103
|
|
|
102
|
-
export const LANG_DEFAULT = 'en-US';
|
|
104
|
+
export const LANG_DEFAULT = 'en-US';
|
|
105
|
+
export const CURRENCY_DEFAULT = { text: '$ (USD)', label: 'USD' };
|