@qrvey/utils 1.2.9-18 → 1.2.9-21
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/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/localization.d.ts +1 -0
- package/dist/cjs/format/localization.js +10 -3
- 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/cjs/services/api/getDatasetColumns.api.js +1 -3
- 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/localization.d.ts +1 -0
- package/dist/format/localization.js +8 -2
- 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/dist/services/api/getDatasetColumns.api.js +2 -4
- 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/localization.ts +10 -2
- 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
- package/src/services/api/getDatasetColumns.api.ts +2 -3
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ function getFilterBuilderGeneralConfig(config = {}) {
|
|
|
12
12
|
apiKey: (0, getAttribute_1.getAttribute)(config, 'api_key') || config.apiKey,
|
|
13
13
|
appid: (0, getAttribute_1.getAttribute)(config, 'app_id') || config.appid,
|
|
14
14
|
domain: config.domain,
|
|
15
|
-
|
|
15
|
+
i18n: config.i18n,
|
|
16
16
|
qv_token: config.qv_token,
|
|
17
17
|
timezoneControl: (0, getAttribute_1.getAttribute)(config, 'timezone_control') || config.timezoneControl,
|
|
18
18
|
userid: (0, getAttribute_1.getAttribute)(config, 'user_id') || config.userid,
|
|
@@ -45,7 +45,7 @@ function getUIValues(filter, settings) {
|
|
|
45
45
|
case FILTER_VALIDATOR_1.FILTER_VALIDATOR.IS_NULL:
|
|
46
46
|
case FILTER_VALIDATOR_1.FILTER_VALIDATOR.IS_NOT_NULL:
|
|
47
47
|
return [{
|
|
48
|
-
value: FILTER_VALIDATOR_INFO_1.FILTER_VALIDATOR_INFO[filter.validator].label,
|
|
48
|
+
value: (settings === null || settings === void 0 ? void 0 : settings.translate) ? settings.translate('filter.validators.' + filter.validator.toLowerCase() + '_label') : FILTER_VALIDATOR_INFO_1.FILTER_VALIDATOR_INFO[filter.validator].label,
|
|
49
49
|
enabled: settings.addEnableds ? (_a = filter.values[0]) === null || _a === void 0 ? void 0 : _a.enabled : undefined,
|
|
50
50
|
}];
|
|
51
51
|
case FILTER_VALIDATOR_1.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
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { IFormatConfig, IFormatOutputFormat } from '../interfaces';
|
|
2
2
|
export declare const getLang: (locale: string | Record<string, any>) => Record<string, any>;
|
|
3
|
+
export declare const chooseLang: (config: Record<string, any>) => string;
|
|
3
4
|
export declare const formatWithLocale: (value: any, outputFormat: IFormatOutputFormat, config?: IFormatConfig) => any;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatWithLocale = exports.getLang = void 0;
|
|
3
|
+
exports.formatWithLocale = exports.chooseLang = exports.getLang = void 0;
|
|
4
4
|
const definition_1 = require("./definition");
|
|
5
5
|
const getLang = (locale) => {
|
|
6
6
|
if (!locale)
|
|
@@ -11,6 +11,13 @@ const getLang = (locale) => {
|
|
|
11
11
|
return { lang: locale === "browser" ? window.navigator.language : locale };
|
|
12
12
|
};
|
|
13
13
|
exports.getLang = getLang;
|
|
14
|
+
const chooseLang = (config) => {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
const lang = (((_a = config === null || config === void 0 ? void 0 : config.i18n) === null || _a === void 0 ? void 0 : _a.lang) ||
|
|
17
|
+
config.lang);
|
|
18
|
+
return ((_b = lang) === null || _b === void 0 ? void 0 : _b.lang) || lang || definition_1.LANG_DEFAULT;
|
|
19
|
+
};
|
|
20
|
+
exports.chooseLang = chooseLang;
|
|
14
21
|
const formatWithLocale = (value, outputFormat, config = {}) => {
|
|
15
22
|
switch (outputFormat.type) {
|
|
16
23
|
case 'DATE':
|
|
@@ -42,10 +49,10 @@ function formatLocaleNumber(value, outputFormat, config) {
|
|
|
42
49
|
}
|
|
43
50
|
}
|
|
44
51
|
function getLocaleOptions(outputFormat) {
|
|
45
|
-
const { format, decimals, currency
|
|
52
|
+
const { format, decimals, currency } = outputFormat;
|
|
46
53
|
switch (format) {
|
|
47
54
|
case "Currency" /* CURRENCY */: {
|
|
48
|
-
const iso = definition_1.currencyISO.find(item => item.text ===
|
|
55
|
+
const iso = definition_1.currencyISO.find(item => (item.text === currency.text) || (item.text.includes(currency.label)));
|
|
49
56
|
return { style: "currency" /* CURRENCY */, currency: iso.label, maximumFractionDigits: decimals, minimumFractionDigits: 0 };
|
|
50
57
|
}
|
|
51
58
|
case "Scientific" /* SCIENTIFIC */: return { style: "decimal" /* DECIMAL */,
|
|
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
|
}
|
|
@@ -7,7 +7,6 @@ exports.getDatasetColumns = void 0;
|
|
|
7
7
|
const CHART_ENDPOINT_1 = require("../constants/CHART_ENDPOINT");
|
|
8
8
|
const Request_1 = __importDefault(require("../helpers/Request"));
|
|
9
9
|
const BDatasetsToUIDatasets_adapter_1 = require("../adapters/BDatasetsToUIDatasets.adapter");
|
|
10
|
-
const definition_1 = require("../../format/definition");
|
|
11
10
|
const __1 = require("../..");
|
|
12
11
|
/**
|
|
13
12
|
* Get a dataset by Qrvey ID
|
|
@@ -15,8 +14,7 @@ const __1 = require("../..");
|
|
|
15
14
|
* @returns a promise
|
|
16
15
|
*/
|
|
17
16
|
function getDatasetColumns(config, qrveyid) {
|
|
18
|
-
|
|
19
|
-
const lang = (0, __1.getLang)(config.lang || ((_a = config.locale) === null || _a === void 0 ? void 0 : _a.lang) || config.locale || definition_1.LANG_DEFAULT).lang;
|
|
17
|
+
const lang = (0, __1.chooseLang)(config);
|
|
20
18
|
return Request_1.default.post(Object.assign(Object.assign({}, config), { qrveyid, endpoint: CHART_ENDPOINT_1.CHART_ENDPOINT }), '/question/list', {
|
|
21
19
|
'optionsAttributes': ['id', 'text', 'type', 'property', 'linked', 'linkid', 'qrveyid', 'bucketId', 'formulaId', 'formulaType', 'geogroup', 'outputFormat'],
|
|
22
20
|
'extend': true
|
|
@@ -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
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { IFormatConfig, IFormatOutputFormat } from '../interfaces';
|
|
2
2
|
export declare const getLang: (locale: string | Record<string, any>) => Record<string, any>;
|
|
3
|
+
export declare const chooseLang: (config: Record<string, any>) => string;
|
|
3
4
|
export declare const formatWithLocale: (value: any, outputFormat: IFormatOutputFormat, config?: IFormatConfig) => any;
|
|
@@ -7,6 +7,12 @@ export const getLang = (locale) => {
|
|
|
7
7
|
else
|
|
8
8
|
return { lang: locale === "browser" ? window.navigator.language : locale };
|
|
9
9
|
};
|
|
10
|
+
export const chooseLang = (config) => {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
const lang = (((_a = config === null || config === void 0 ? void 0 : config.i18n) === null || _a === void 0 ? void 0 : _a.lang) ||
|
|
13
|
+
config.lang);
|
|
14
|
+
return ((_b = lang) === null || _b === void 0 ? void 0 : _b.lang) || lang || LANG_DEFAULT;
|
|
15
|
+
};
|
|
10
16
|
export const formatWithLocale = (value, outputFormat, config = {}) => {
|
|
11
17
|
switch (outputFormat.type) {
|
|
12
18
|
case 'DATE':
|
|
@@ -37,10 +43,10 @@ function formatLocaleNumber(value, outputFormat, config) {
|
|
|
37
43
|
}
|
|
38
44
|
}
|
|
39
45
|
function getLocaleOptions(outputFormat) {
|
|
40
|
-
const { format, decimals, currency
|
|
46
|
+
const { format, decimals, currency } = outputFormat;
|
|
41
47
|
switch (format) {
|
|
42
48
|
case "Currency" /* CURRENCY */: {
|
|
43
|
-
const iso = currencyISO.find(item => item.text ===
|
|
49
|
+
const iso = currencyISO.find(item => (item.text === currency.text) || (item.text.includes(currency.label)));
|
|
44
50
|
return { style: "currency" /* CURRENCY */, currency: iso.label, maximumFractionDigits: decimals, minimumFractionDigits: 0 };
|
|
45
51
|
}
|
|
46
52
|
case "Scientific" /* SCIENTIFIC */: return { style: "decimal" /* DECIMAL */,
|
|
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
|
}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { CHART_ENDPOINT } from "../constants/CHART_ENDPOINT";
|
|
2
2
|
import Request from "../helpers/Request";
|
|
3
3
|
import { BDatasetsToUIDatasets } from "../adapters/BDatasetsToUIDatasets.adapter";
|
|
4
|
-
import {
|
|
5
|
-
import { getLang } from "../..";
|
|
4
|
+
import { chooseLang } from "../..";
|
|
6
5
|
/**
|
|
7
6
|
* Get a dataset by Qrvey ID
|
|
8
7
|
* @param qrveyid The Qrvey ID
|
|
9
8
|
* @returns a promise
|
|
10
9
|
*/
|
|
11
10
|
export function getDatasetColumns(config, qrveyid) {
|
|
12
|
-
|
|
13
|
-
const lang = getLang(config.lang || ((_a = config.locale) === null || _a === void 0 ? void 0 : _a.lang) || config.locale || LANG_DEFAULT).lang;
|
|
11
|
+
const lang = chooseLang(config);
|
|
14
12
|
return Request.post(Object.assign(Object.assign({}, config), { qrveyid, endpoint: CHART_ENDPOINT }), '/question/list', {
|
|
15
13
|
'optionsAttributes': ['id', 'text', 'type', 'property', 'linked', 'linkid', 'qrveyid', 'bucketId', 'formulaId', 'formulaType', 'geogroup', 'outputFormat'],
|
|
16
14
|
'extend': true
|
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
|
}
|
|
@@ -7,6 +7,14 @@ export const getLang = (locale: string | Record<string, any>) => {
|
|
|
7
7
|
else return { lang: locale === "browser" ? window.navigator.language : locale };
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
+
export const chooseLang = (config: Record<string, any>): string => {
|
|
11
|
+
const lang: string | Record<string, any> = (
|
|
12
|
+
config?.i18n?.lang ||
|
|
13
|
+
config.lang
|
|
14
|
+
);
|
|
15
|
+
return (<any>lang)?.lang || lang || LANG_DEFAULT;
|
|
16
|
+
};
|
|
17
|
+
|
|
10
18
|
export const formatWithLocale = (value: any, outputFormat: IFormatOutputFormat, config: IFormatConfig = {}): any => {
|
|
11
19
|
switch (outputFormat.type) {
|
|
12
20
|
case 'DATE':
|
|
@@ -38,10 +46,10 @@ function formatLocaleNumber(value: any, outputFormat: IFormatOutputFormat, confi
|
|
|
38
46
|
}
|
|
39
47
|
|
|
40
48
|
function getLocaleOptions(outputFormat: IFormatOutputFormat) {
|
|
41
|
-
const { format, decimals, currency
|
|
49
|
+
const { format, decimals, currency } = outputFormat;
|
|
42
50
|
switch(format) {
|
|
43
51
|
case LOCALE_FORMATS.CURRENCY: {
|
|
44
|
-
const iso = currencyISO.find(item => item.text ===
|
|
52
|
+
const iso = currencyISO.find(item => (item.text === currency.text) || (item.text.includes(currency.label)));
|
|
45
53
|
return { style: LOCALE_STYLES.CURRENCY, currency: iso.label, maximumFractionDigits: decimals, minimumFractionDigits: 0 };
|
|
46
54
|
}
|
|
47
55
|
case LOCALE_FORMATS.SCIENTIFIC: return { style: LOCALE_STYLES.DECIMAL,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { II18nResource } from "./II18nResource";
|
|
2
|
+
|
|
3
|
+
export interface II18nConfig {
|
|
4
|
+
lang?: string; // Language format for getting stored traslations of the labels (en-US)
|
|
5
|
+
locale?: string; // Language format for transform number and date values (en-US)
|
|
6
|
+
lang_object?: II18nResource; // Oject Structure to translate labels
|
|
7
|
+
}
|
|
@@ -12,7 +12,7 @@ import { II18nCrossTabs } from './cross_tabs';
|
|
|
12
12
|
import { II18nChartBuilder } from '.';
|
|
13
13
|
import { II18nStyleThemes } from './style_themes/II18nStyleThemes';
|
|
14
14
|
|
|
15
|
-
export interface
|
|
15
|
+
export interface II18nResource {
|
|
16
16
|
bucket_builder?: II18nBucketBuilder;
|
|
17
17
|
chart_builder?: II18nChartBuilder;
|
|
18
18
|
common?: II18nCommon;
|
|
@@ -11,6 +11,7 @@ export * from './panel/index';
|
|
|
11
11
|
export * from './style_themes/index';
|
|
12
12
|
export * from './table_charts/index';
|
|
13
13
|
|
|
14
|
+
export * from './II18nConfig';
|
|
15
|
+
export * from './II18nResource';
|
|
14
16
|
export * from './II18nServiceTranslate';
|
|
15
17
|
export * from './II18nServiceTranslateOption';
|
|
16
|
-
export * from './IResourceI18n';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { II18nResource } from "../interfaces/II18nResource";
|
|
2
2
|
import { I18N_DASHBOARD } from "./dashboard/I18N_DASHBOARD";
|
|
3
3
|
import { I18N_PANEL } from "./panel/I18N_PANEL";
|
|
4
4
|
import { I18N_FILTER } from "./filters/I18N_FILTER";
|
|
@@ -14,7 +14,7 @@ import { I18N_CHART_BUILDER } from "./chart_builder";
|
|
|
14
14
|
import { I18N_STYLE_THEMES } from "./style_themes";
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
export const I18N_DEFAULT:
|
|
17
|
+
export const I18N_DEFAULT: II18nResource = {
|
|
18
18
|
bucket_builder: I18N_BUCKET_BUILDER,
|
|
19
19
|
chart_builder: I18N_CHART_BUILDER,
|
|
20
20
|
common: I18N_COMMON,
|
|
@@ -96,6 +96,8 @@ export const I18N_BUCKET_BUILDER: II18nBucketBuilder = {
|
|
|
96
96
|
loading: 'Loading dependencies...',
|
|
97
97
|
title: 'Buckets',
|
|
98
98
|
add_bucketed_column: 'Add Bucketed Column',
|
|
99
|
+
information_text_link: 'Learn how to',
|
|
100
|
+
information_text_text: 'create and work with buckets',
|
|
99
101
|
},
|
|
100
102
|
operator: {
|
|
101
103
|
greater_than: 'Greater than',
|
|
@@ -4,7 +4,9 @@ export const I18N_FORMULA_BUILDER: II18nFormulaBuilder = {
|
|
|
4
4
|
list_modal: {
|
|
5
5
|
title_header: 'Formulas',
|
|
6
6
|
create_button: 'Create Formula',
|
|
7
|
-
empty_message: 'No Formulas Yet'
|
|
7
|
+
empty_message: 'No Formulas Yet',
|
|
8
|
+
information_text_link: 'Learn how to',
|
|
9
|
+
information_text_text: 'create and work with formulas',
|
|
8
10
|
},
|
|
9
11
|
list_table: {
|
|
10
12
|
name: 'Formula Name',
|
|
@@ -52,5 +52,6 @@ export const I18N_STYLE_THEMES: II18nStyleThemes = {
|
|
|
52
52
|
title: 'Style Themes',
|
|
53
53
|
tooltips: {
|
|
54
54
|
theme_used_in_all_applications: 'This theme is being used in all applications',
|
|
55
|
+
theme_will_be_used_in_all_applications: 'This theme will be used in all applications'
|
|
55
56
|
}
|
|
56
57
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { IResourceI18n } from "../interfaces";
|
|
2
1
|
import i18next from 'i18next';
|
|
3
2
|
import { mergeDeep } from "../../general/object/mergeDeep";
|
|
3
|
+
import { II18nResource } from '../interfaces/II18nResource';
|
|
4
4
|
import { II18nServiceTranslateOption } from "../interfaces/II18nServiceTranslateOption";
|
|
5
5
|
|
|
6
6
|
export class I18nServiceBuilder {
|
|
7
7
|
|
|
8
|
-
public static async buildI18n(i18nDefault:
|
|
8
|
+
public static async buildI18n(i18nDefault: II18nResource, i18nResource: II18nResource): Promise<I18nService> {
|
|
9
9
|
return await this._initI18n(i18nDefault, i18nResource);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
private static async _initI18n(i18nDefault:
|
|
12
|
+
private static async _initI18n(i18nDefault: II18nResource, i18nResource: II18nResource): Promise<I18nService> {
|
|
13
13
|
|
|
14
14
|
if (!i18next.isInitialized) {
|
|
15
15
|
await i18next
|
|
@@ -30,7 +30,7 @@ export class I18nServiceBuilder {
|
|
|
30
30
|
return new I18nServiceConcrete(i18next);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
public static setTranslations(i18nDefault, i18nResource:
|
|
33
|
+
public static setTranslations(i18nDefault, i18nResource: II18nResource): II18nResource {
|
|
34
34
|
return mergeDeep(i18nResource, i18nDefault, { mergeExistingValues: false });
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { II18nResource } from "../interfaces/II18nResource";
|
|
2
2
|
import { I18nService, I18nServiceBuilder } from "../service/i18nextBuilder";
|
|
3
3
|
|
|
4
|
-
export async function initI18n(i18nConfig:
|
|
4
|
+
export async function initI18n(i18nConfig: II18nResource = {}, i18nDefault: II18nResource = {}): Promise<I18nService> {
|
|
5
5
|
return await I18nServiceBuilder.buildI18n(i18nDefault, i18nConfig);
|
|
6
|
-
}
|
|
6
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
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
|
|
|
5
6
|
export interface ITransformValueSettings {
|
|
@@ -7,6 +8,6 @@ export interface ITransformValueSettings {
|
|
|
7
8
|
property: IColumnPropertyType;
|
|
8
9
|
|
|
9
10
|
translate: II18nServiceTranslate; // Function for getting translations
|
|
10
|
-
|
|
11
|
+
i18n: II18nConfig; // The i18n configuration;
|
|
11
12
|
suffixTranslateLabel?: string // The i18n label for the suffix values.
|
|
12
13
|
}
|
|
@@ -3,8 +3,7 @@ import { IDataset } from "../../qrvey/interfaces/IDataset";
|
|
|
3
3
|
import { CHART_ENDPOINT } from "../constants/CHART_ENDPOINT";
|
|
4
4
|
import Request from "../helpers/Request";
|
|
5
5
|
import { BDatasetsToUIDatasets } from "../adapters/BDatasetsToUIDatasets.adapter";
|
|
6
|
-
import {
|
|
7
|
-
import { getLang } from "../..";
|
|
6
|
+
import { chooseLang } from "../..";
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* Get a dataset by Qrvey ID
|
|
@@ -12,7 +11,7 @@ import { getLang } from "../..";
|
|
|
12
11
|
* @returns a promise
|
|
13
12
|
*/
|
|
14
13
|
export function getDatasetColumns(config: IGeneralWidgetConfig, qrveyid?: string): Promise<IDataset[]> {
|
|
15
|
-
const lang =
|
|
14
|
+
const lang = chooseLang(config);
|
|
16
15
|
return Request.post({ ...config, qrveyid, endpoint: CHART_ENDPOINT }, '/question/list', {
|
|
17
16
|
'optionsAttributes': ['id', 'text', 'type', 'property', 'linked', 'linkid', 'qrveyid', 'bucketId', 'formulaId', 'formulaType', 'geogroup', 'outputFormat'],
|
|
18
17
|
'extend': true
|