@qrvey/utils 1.16.1-2 → 1.16.1-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/dist/cache-managers/cache-platform-config-manager.d.ts +8 -0
- package/dist/cache-managers/cache-platform-config-manager.js +37 -0
- package/dist/cache-managers/clean-cache-managers.js +3 -0
- package/dist/cache-managers/index.d.ts +1 -0
- package/dist/cache-managers/index.js +1 -0
- package/dist/charts/helpers/styleSettingsByChartType.js +1 -0
- package/dist/charts/interfaces/IChartV2.d.ts +1 -0
- package/dist/cjs/cache-managers/cache-platform-config-manager.d.ts +8 -0
- package/dist/cjs/cache-managers/cache-platform-config-manager.js +41 -0
- package/dist/cjs/cache-managers/clean-cache-managers.js +3 -0
- package/dist/cjs/cache-managers/index.d.ts +1 -0
- package/dist/cjs/cache-managers/index.js +1 -0
- package/dist/cjs/charts/helpers/styleSettingsByChartType.js +1 -0
- package/dist/cjs/charts/interfaces/IChartV2.d.ts +1 -0
- package/dist/cjs/column_format/helpers/columnTypeByChart.d.ts +1 -1
- package/dist/cjs/column_format/helpers/parseFormulaTypeByCharts.d.ts +1 -1
- package/dist/cjs/columns/interfaces/IBColumn.d.ts +3 -1
- package/dist/cjs/columns/interfaces/IColumn.d.ts +6 -5
- package/dist/cjs/filters/helpers/OLD_getAggFilters.js +32 -49
- package/dist/cjs/format/definition.d.ts +1 -1
- package/dist/cjs/format/definition.js +2 -2
- package/dist/cjs/format/format.d.ts +1 -1
- package/dist/cjs/format/helpers/getCurrencySymbolByCode.d.ts +1 -0
- package/dist/cjs/format/helpers/getCurrencySymbolByCode.js +10 -2
- package/dist/cjs/format/localization.js +4 -4
- package/dist/cjs/formulas/constants/FORMULA.d.ts +1 -0
- package/dist/cjs/general/object/traverseTree.d.ts +16 -0
- package/dist/cjs/general/object/traverseTree.js +37 -0
- package/dist/cjs/globalization/interfaces/chart_builder/II18nChartBuilderMenuActions.d.ts +1 -0
- package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderCreateModal.d.ts +1 -0
- package/dist/cjs/globalization/interfaces/panel/II18nPanelTooltips.d.ts +1 -0
- package/dist/cjs/globalization/interfaces/table_charts/II18nTableCharts.d.ts +5 -0
- package/dist/cjs/globalization/labels/chart_builder/I18N_CHART_BUILDER_GENERAL_OPTIONS.js +2 -1
- package/dist/cjs/globalization/labels/chart_builder/I18N_CHART_BUILDER_STYLE_OPTIONS.js +1 -1
- package/dist/cjs/globalization/labels/formula_builder/I18N_FORMULA_BUILDER.js +1 -0
- package/dist/cjs/globalization/labels/panel/I18N_PANEL.js +1 -0
- package/dist/cjs/globalization/labels/table_charts/I18N_TABLE_CHARTS.js +5 -0
- package/dist/cjs/services/adapters/BColumnsToUIColumns.adapter.js +1 -0
- package/dist/cjs/services/api/platformConfig.api.d.ts +2 -0
- package/dist/cjs/services/api/platformConfig.api.js +21 -0
- package/dist/cjs/services/helpers/Request.js +2 -1
- package/dist/cjs/services/interfaces/IEndpointConfig.d.ts +1 -0
- package/dist/column_format/helpers/columnTypeByChart.d.ts +1 -1
- package/dist/column_format/helpers/parseFormulaTypeByCharts.d.ts +1 -1
- package/dist/columns/interfaces/IBColumn.d.ts +3 -1
- package/dist/columns/interfaces/IColumn.d.ts +6 -5
- package/dist/filters/helpers/OLD_getAggFilters.js +32 -49
- package/dist/format/definition.d.ts +1 -1
- package/dist/format/definition.js +2 -2
- package/dist/format/format.d.ts +1 -1
- package/dist/format/helpers/getCurrencySymbolByCode.d.ts +1 -0
- package/dist/format/helpers/getCurrencySymbolByCode.js +8 -1
- package/dist/format/localization.js +5 -5
- package/dist/formulas/constants/FORMULA.d.ts +1 -0
- package/dist/general/object/traverseTree.d.ts +16 -0
- package/dist/general/object/traverseTree.js +33 -0
- package/dist/globalization/interfaces/chart_builder/II18nChartBuilderMenuActions.d.ts +1 -0
- package/dist/globalization/interfaces/formula_builder/II18nFormulaBuilderCreateModal.d.ts +1 -0
- package/dist/globalization/interfaces/panel/II18nPanelTooltips.d.ts +1 -0
- package/dist/globalization/interfaces/table_charts/II18nTableCharts.d.ts +5 -0
- package/dist/globalization/labels/chart_builder/I18N_CHART_BUILDER_GENERAL_OPTIONS.js +2 -1
- package/dist/globalization/labels/chart_builder/I18N_CHART_BUILDER_STYLE_OPTIONS.js +1 -1
- package/dist/globalization/labels/formula_builder/I18N_FORMULA_BUILDER.js +1 -0
- package/dist/globalization/labels/panel/I18N_PANEL.js +1 -0
- package/dist/globalization/labels/table_charts/I18N_TABLE_CHARTS.js +5 -0
- package/dist/services/adapters/BColumnsToUIColumns.adapter.js +1 -0
- package/dist/services/api/platformConfig.api.d.ts +2 -0
- package/dist/services/api/platformConfig.api.js +17 -0
- package/dist/services/helpers/Request.js +2 -1
- package/dist/services/interfaces/IEndpointConfig.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { QrveyCacheManager, QvCacheStoreProperties } from "./cache-manager";
|
|
2
|
+
import { IGetPermissionsConfig } from "./cache-permissions-manager";
|
|
3
|
+
export declare class PlatformConfigCacheManager extends QrveyCacheManager<QvCacheStoreProperties, IGetPermissionsConfig> {
|
|
4
|
+
static getInstance(): any;
|
|
5
|
+
protected getConfigEntityId(): keyof IGetPermissionsConfig;
|
|
6
|
+
protected buildStoreId({ app_id }: IGetPermissionsConfig): string;
|
|
7
|
+
protected fetchDataAndUpdateStore(state: QvCacheStoreProperties, config: IGetPermissionsConfig): Promise<void>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { QrveyCacheManager } from "./cache-manager";
|
|
11
|
+
import { getPlatformConfig } from "../services/api/platformConfig.api";
|
|
12
|
+
export class PlatformConfigCacheManager extends QrveyCacheManager {
|
|
13
|
+
static getInstance() {
|
|
14
|
+
if (!window.qvPlatformConfigCacheManager) {
|
|
15
|
+
window.qvPlatformConfigCacheManager = new PlatformConfigCacheManager();
|
|
16
|
+
}
|
|
17
|
+
return window.qvPlatformConfigCacheManager;
|
|
18
|
+
}
|
|
19
|
+
getConfigEntityId() {
|
|
20
|
+
return "app_id";
|
|
21
|
+
}
|
|
22
|
+
buildStoreId({ app_id }) {
|
|
23
|
+
return `${app_id}`;
|
|
24
|
+
}
|
|
25
|
+
fetchDataAndUpdateStore(state, config) {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
return getPlatformConfig(config)
|
|
28
|
+
.then((platformConfig) => {
|
|
29
|
+
state.entity = platformConfig;
|
|
30
|
+
state.error = null;
|
|
31
|
+
})
|
|
32
|
+
.catch((e) => {
|
|
33
|
+
state.error = e;
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -11,6 +11,7 @@ import { ChartCacheManager } from "./cache-chart-manager";
|
|
|
11
11
|
import { MetricCacheManager } from "./cache-metric-manager";
|
|
12
12
|
import { ModelCacheManager } from "./cache-model-manager";
|
|
13
13
|
import { PermissionsCacheManager } from "./cache-permissions-manager";
|
|
14
|
+
import { PlatformConfigCacheManager } from "./cache-platform-config-manager";
|
|
14
15
|
import { ThemeCacheManager } from "./cache-theme-manager";
|
|
15
16
|
export const cleanCacheManagers = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
17
|
const chartManager = ChartCacheManager.getInstance();
|
|
@@ -23,4 +24,6 @@ export const cleanCacheManagers = () => __awaiter(void 0, void 0, void 0, functi
|
|
|
23
24
|
yield permissionsManager.cleanAllStores();
|
|
24
25
|
const themeManager = ThemeCacheManager.getInstance();
|
|
25
26
|
yield themeManager.cleanAllStores();
|
|
27
|
+
const platformConfigManager = PlatformConfigCacheManager.getInstance();
|
|
28
|
+
yield platformConfigManager.cleanAllStores();
|
|
26
29
|
});
|
|
@@ -2,6 +2,7 @@ export * from "./cache-chart-manager";
|
|
|
2
2
|
export * from "./cache-manager";
|
|
3
3
|
export * from "./cache-metric-manager";
|
|
4
4
|
export * from "./cache-model-manager";
|
|
5
|
+
export * from "./cache-platform-config-manager";
|
|
5
6
|
export * from "./cache-permissions-manager";
|
|
6
7
|
export * from "./cache-theme-manager";
|
|
7
8
|
export * from "./clean-cache-managers";
|
|
@@ -2,6 +2,7 @@ export * from "./cache-chart-manager";
|
|
|
2
2
|
export * from "./cache-manager";
|
|
3
3
|
export * from "./cache-metric-manager";
|
|
4
4
|
export * from "./cache-model-manager";
|
|
5
|
+
export * from "./cache-platform-config-manager";
|
|
5
6
|
export * from "./cache-permissions-manager";
|
|
6
7
|
export * from "./cache-theme-manager";
|
|
7
8
|
export * from "./clean-cache-managers";
|
|
@@ -199,6 +199,7 @@ export const parseStyleSettingByType = (type, { stylesSettings, globalSettings,
|
|
|
199
199
|
column_resizing: _get(globalSettings, "table_menu.column_resizing", true),
|
|
200
200
|
column_arrangement: _get(globalSettings, "table_menu.column_arrangement", true),
|
|
201
201
|
column_update: _get(globalSettings, "table_menu.column_update", false),
|
|
202
|
+
grouping_column_update: _get(globalSettings, "table_menu.grouping_column_update", false),
|
|
202
203
|
change_aggregation: _get(globalSettings, "table_menu.change_aggregation", false),
|
|
203
204
|
pagination: isGrouped
|
|
204
205
|
? {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { QrveyCacheManager, QvCacheStoreProperties } from "./cache-manager";
|
|
2
|
+
import { IGetPermissionsConfig } from "./cache-permissions-manager";
|
|
3
|
+
export declare class PlatformConfigCacheManager extends QrveyCacheManager<QvCacheStoreProperties, IGetPermissionsConfig> {
|
|
4
|
+
static getInstance(): any;
|
|
5
|
+
protected getConfigEntityId(): keyof IGetPermissionsConfig;
|
|
6
|
+
protected buildStoreId({ app_id }: IGetPermissionsConfig): string;
|
|
7
|
+
protected fetchDataAndUpdateStore(state: QvCacheStoreProperties, config: IGetPermissionsConfig): Promise<void>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.PlatformConfigCacheManager = void 0;
|
|
13
|
+
const cache_manager_1 = require("./cache-manager");
|
|
14
|
+
const platformConfig_api_1 = require("../services/api/platformConfig.api");
|
|
15
|
+
class PlatformConfigCacheManager extends cache_manager_1.QrveyCacheManager {
|
|
16
|
+
static getInstance() {
|
|
17
|
+
if (!window.qvPlatformConfigCacheManager) {
|
|
18
|
+
window.qvPlatformConfigCacheManager = new PlatformConfigCacheManager();
|
|
19
|
+
}
|
|
20
|
+
return window.qvPlatformConfigCacheManager;
|
|
21
|
+
}
|
|
22
|
+
getConfigEntityId() {
|
|
23
|
+
return "app_id";
|
|
24
|
+
}
|
|
25
|
+
buildStoreId({ app_id }) {
|
|
26
|
+
return `${app_id}`;
|
|
27
|
+
}
|
|
28
|
+
fetchDataAndUpdateStore(state, config) {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
return (0, platformConfig_api_1.getPlatformConfig)(config)
|
|
31
|
+
.then((platformConfig) => {
|
|
32
|
+
state.entity = platformConfig;
|
|
33
|
+
state.error = null;
|
|
34
|
+
})
|
|
35
|
+
.catch((e) => {
|
|
36
|
+
state.error = e;
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.PlatformConfigCacheManager = PlatformConfigCacheManager;
|
|
@@ -14,6 +14,7 @@ const cache_chart_manager_1 = require("./cache-chart-manager");
|
|
|
14
14
|
const cache_metric_manager_1 = require("./cache-metric-manager");
|
|
15
15
|
const cache_model_manager_1 = require("./cache-model-manager");
|
|
16
16
|
const cache_permissions_manager_1 = require("./cache-permissions-manager");
|
|
17
|
+
const cache_platform_config_manager_1 = require("./cache-platform-config-manager");
|
|
17
18
|
const cache_theme_manager_1 = require("./cache-theme-manager");
|
|
18
19
|
const cleanCacheManagers = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
20
|
const chartManager = cache_chart_manager_1.ChartCacheManager.getInstance();
|
|
@@ -26,5 +27,7 @@ const cleanCacheManagers = () => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
26
27
|
yield permissionsManager.cleanAllStores();
|
|
27
28
|
const themeManager = cache_theme_manager_1.ThemeCacheManager.getInstance();
|
|
28
29
|
yield themeManager.cleanAllStores();
|
|
30
|
+
const platformConfigManager = cache_platform_config_manager_1.PlatformConfigCacheManager.getInstance();
|
|
31
|
+
yield platformConfigManager.cleanAllStores();
|
|
29
32
|
});
|
|
30
33
|
exports.cleanCacheManagers = cleanCacheManagers;
|
|
@@ -2,6 +2,7 @@ export * from "./cache-chart-manager";
|
|
|
2
2
|
export * from "./cache-manager";
|
|
3
3
|
export * from "./cache-metric-manager";
|
|
4
4
|
export * from "./cache-model-manager";
|
|
5
|
+
export * from "./cache-platform-config-manager";
|
|
5
6
|
export * from "./cache-permissions-manager";
|
|
6
7
|
export * from "./cache-theme-manager";
|
|
7
8
|
export * from "./clean-cache-managers";
|
|
@@ -18,6 +18,7 @@ __exportStar(require("./cache-chart-manager"), exports);
|
|
|
18
18
|
__exportStar(require("./cache-manager"), exports);
|
|
19
19
|
__exportStar(require("./cache-metric-manager"), exports);
|
|
20
20
|
__exportStar(require("./cache-model-manager"), exports);
|
|
21
|
+
__exportStar(require("./cache-platform-config-manager"), exports);
|
|
21
22
|
__exportStar(require("./cache-permissions-manager"), exports);
|
|
22
23
|
__exportStar(require("./cache-theme-manager"), exports);
|
|
23
24
|
__exportStar(require("./clean-cache-managers"), exports);
|
|
@@ -202,6 +202,7 @@ const parseStyleSettingByType = (type, { stylesSettings, globalSettings, isGroup
|
|
|
202
202
|
column_resizing: (0, general_1._get)(globalSettings, "table_menu.column_resizing", true),
|
|
203
203
|
column_arrangement: (0, general_1._get)(globalSettings, "table_menu.column_arrangement", true),
|
|
204
204
|
column_update: (0, general_1._get)(globalSettings, "table_menu.column_update", false),
|
|
205
|
+
grouping_column_update: (0, general_1._get)(globalSettings, "table_menu.grouping_column_update", false),
|
|
205
206
|
change_aggregation: (0, general_1._get)(globalSettings, "table_menu.change_aggregation", false),
|
|
206
207
|
pagination: isGrouped
|
|
207
208
|
? {
|
|
@@ -13,4 +13,4 @@ import { IChartShelfType } from "../interfaces/IChartShelfType";
|
|
|
13
13
|
* grouped.
|
|
14
14
|
* @returns The column type of the column.
|
|
15
15
|
*/
|
|
16
|
-
export declare const columnTypeByChart: (column: IChartColumn, shelfType: IChartShelfType, chartGroup: IChartGroupType, isGroupedTable?: boolean) => "
|
|
16
|
+
export declare const columnTypeByChart: (column: IChartColumn, shelfType: IChartShelfType, chartGroup: IChartGroupType, isGroupedTable?: boolean) => import("../..").COMPLEX_COLUMN | import("../..").COMPOUND_COLUMN | "NUMERIC" | NUMERICAL_COLUMN | "DATE" | "TEXT_LABEL" | COLUMN.SINGLE_CHOICE | COLUMN.MULTIPLE_CHOICE | COLUMN.YES_NO | COLUMN.RANKING | COLUMN.DATE | COLUMN.TIME | COLUMN.SIGNATURE | COLUMN.DROPDOWN | COLUMN.IMAGE | COLUMN.EMAIL_FORM | COLUMN.PHONE | COLUMN.PASSWORD | COLUMN.TEXT_LABEL | COLUMN.TEXT_CATEGORY | COLUMN.LOOKUP | COLUMN.TEXT_FORMULA | COLUMN.NUMERIC_FORMULA | COLUMN.DATE_FORMULA | COLUMN.AGGREGATED_FORMULA | COLUMN.BUCKET | COLUMN.SLIDEBAR | COLUMN.NUMERIC | COLUMN.RATING | COLUMN.TEXTFIELD | COLUMN.LONGTEXT | COLUMN.IMAGEUPLOAD | COLUMN.FILEUPLOAD | COLUMN.EXPRESSION | COLUMN.NAME | COLUMN.USADDRESS | COLUMN.ADDRESS;
|
|
@@ -4,4 +4,4 @@ import { IFormulaType } from "../..";
|
|
|
4
4
|
* @param {IFormulaType} type - IFormulaType - this is the type of the formula.
|
|
5
5
|
* @returns The type of the formula.
|
|
6
6
|
*/
|
|
7
|
-
export declare const parseFormulaTypeByCharts: (type: IFormulaType) => "
|
|
7
|
+
export declare const parseFormulaTypeByCharts: (type: IFormulaType) => "NUMERIC" | "DATE" | "TEXT_LABEL";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { IFormulaType } from "../../formulas/interfaces/IFormulaType";
|
|
2
1
|
import { IBColumAnswer } from "./IBColumAnswer";
|
|
3
2
|
import { IBColumnAnswerExpression } from "./IBColumnAnswerExpression";
|
|
4
3
|
import { IBColumnAnswerExpressionCategory } from "./IBColumnAnswerExpressionCategory";
|
|
@@ -8,6 +7,8 @@ import { IColumnImageUploadOption } from "./IColumnImageUploadOption";
|
|
|
8
7
|
import { IColumnOutputFormatSettings } from "./IColumnOutputFormatSettings";
|
|
9
8
|
import { IColumnPropertyType } from "./IColumnPropertyType";
|
|
10
9
|
import { IColumnType } from "./IColumnType";
|
|
10
|
+
import { AGGREGATE_FORMULA_TYPE } from "../../formulas/constants/FORMULA";
|
|
11
|
+
import { IFormulaType } from "../../formulas/interfaces/IFormulaType";
|
|
11
12
|
/**
|
|
12
13
|
* Structure for columns received in the question/list, model endpoints
|
|
13
14
|
*/
|
|
@@ -15,6 +16,7 @@ export interface IBColumn extends Partial<IBColumAnswer>, Partial<IBColumnAnswer
|
|
|
15
16
|
bucketId?: string;
|
|
16
17
|
formulaId?: string;
|
|
17
18
|
formulaType?: IFormulaType;
|
|
19
|
+
formulaInputType?: AGGREGATE_FORMULA_TYPE;
|
|
18
20
|
geogroup?: boolean;
|
|
19
21
|
id: string;
|
|
20
22
|
imageUploadOption?: IColumnImageUploadOption;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { IColumnCalculationType } from "../../qrvey/interfaces/ICalculationType";
|
|
2
|
-
import { IColumnPropertyType } from "./IColumnPropertyType";
|
|
3
|
-
import { IColumnSortingSettings } from "./IColumnSortingSettings";
|
|
4
1
|
import { IBColumn } from "./IBColumn";
|
|
5
|
-
import { IAggregateType } from "../../charts/interfaces/IAggregateType";
|
|
6
2
|
import { IBColumnAnswerExpressionWord } from "./IBColumnAnswerExpressionWord";
|
|
7
3
|
import { IBColumnAnswerLookupValueValue } from "./IBColumnAnswerLookupValueValue";
|
|
4
|
+
import { IColumnPropertyType } from "./IColumnPropertyType";
|
|
5
|
+
import { IColumnSortingSettings } from "./IColumnSortingSettings";
|
|
6
|
+
import { IAggregateType } from "../../charts/interfaces/IAggregateType";
|
|
7
|
+
import { AGGREGATE_FORMULA_TYPE } from "../../formulas/constants/FORMULA";
|
|
8
|
+
import { IColumnCalculationType } from "../../qrvey/interfaces/ICalculationType";
|
|
8
9
|
/**
|
|
9
10
|
* Structure for columns used in the App frontend side
|
|
10
11
|
*/
|
|
@@ -22,5 +23,5 @@ export interface IColumn extends Omit<IBColumn, "text" | "bucketId" | "formulaId
|
|
|
22
23
|
property?: IColumnPropertyType;
|
|
23
24
|
slidebarValue?: number;
|
|
24
25
|
sorting?: IColumnSortingSettings;
|
|
25
|
-
formulaInputType?:
|
|
26
|
+
formulaInputType?: AGGREGATE_FORMULA_TYPE;
|
|
26
27
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getAggFilters = void 0;
|
|
4
|
-
const COLUMN_1 = require("../../columns/constants/COLUMN");
|
|
5
4
|
const isEmpty_1 = require("../../general/mix/isEmpty");
|
|
6
|
-
const objectCopy_1 = require("../../general/object/objectCopy");
|
|
7
5
|
const get_1 = require("../../general/object/get");
|
|
8
|
-
const
|
|
6
|
+
const objectCopy_1 = require("../../general/object/objectCopy");
|
|
7
|
+
const traverseTree_1 = require("../../general/object/traverseTree");
|
|
8
|
+
const adapters_1 = require("../adapters");
|
|
9
9
|
/**
|
|
10
10
|
* @deprecated soon
|
|
11
11
|
* @param logics
|
|
@@ -14,33 +14,26 @@ const FILTER_OPERATOR_1 = require("../constants/common/FILTER_OPERATOR");
|
|
|
14
14
|
*/
|
|
15
15
|
function getAggFilters(logics = [], summaries = []) {
|
|
16
16
|
const aggregateFilters = getAggregateFilters(logics);
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
})
|
|
39
|
-
.filter(Boolean),
|
|
40
|
-
});
|
|
41
|
-
})
|
|
42
|
-
.filter((aggFilter) => aggFilter && aggFilter.expressions && aggFilter.expressions.length);
|
|
43
|
-
return aggFilters && concatAggFilters(aggFilters);
|
|
17
|
+
const logic = (0, objectCopy_1.objectCopy)((0, adapters_1.FDToLogic)((0, adapters_1.adaptFilterData)({ logic: aggregateFilters })));
|
|
18
|
+
if ((0, isEmpty_1.isEmpty)(logic) || (0, isEmpty_1.isEmpty)(logic[0].filters))
|
|
19
|
+
return;
|
|
20
|
+
(0, traverseTree_1.traverseTree)({
|
|
21
|
+
root: logic[0].filters,
|
|
22
|
+
getChildren: (node) => node.expressions,
|
|
23
|
+
isLeaf: (node) => !("operator" in node),
|
|
24
|
+
onLeaf: (expression) => {
|
|
25
|
+
const { enabled, validationType, value } = expression;
|
|
26
|
+
const summaryIndex = getIndexByExpression(expression, summaries);
|
|
27
|
+
Object.keys(expression).forEach((key) => {
|
|
28
|
+
delete expression[key];
|
|
29
|
+
});
|
|
30
|
+
expression.enabled = enabled;
|
|
31
|
+
expression.summaryIndex = summaryIndex;
|
|
32
|
+
expression.validationType = validationType;
|
|
33
|
+
expression.value = value;
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
return logic[0].filters[0];
|
|
44
37
|
}
|
|
45
38
|
exports.getAggFilters = getAggFilters;
|
|
46
39
|
/**
|
|
@@ -69,23 +62,13 @@ function getAggregateFilters(logics = []) {
|
|
|
69
62
|
return newLogics;
|
|
70
63
|
}, []);
|
|
71
64
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
function getExpressionsInLogic(logics = []) {
|
|
84
|
-
return logics.reduce((expressions, logic) => {
|
|
85
|
-
let _expressions = expressions;
|
|
86
|
-
logic.filters.forEach((filter) => {
|
|
87
|
-
_expressions = _expressions.concat(filter.expressions[0].expressions);
|
|
88
|
-
});
|
|
89
|
-
return _expressions;
|
|
90
|
-
}, []);
|
|
65
|
+
/**
|
|
66
|
+
* Finds the index of a summary that matches the given filter expression based on question ID and Qrvey ID.
|
|
67
|
+
* @param expression The filter expression to match
|
|
68
|
+
* @param summaries The list of summaries to search
|
|
69
|
+
* @returns The index of the matching summary, or -1 if not found
|
|
70
|
+
*/
|
|
71
|
+
function getIndexByExpression(expression, summaries = []) {
|
|
72
|
+
return summaries.findIndex((summary) => expression.questionid === summary.questionid &&
|
|
73
|
+
expression.qrveyid === summary.qrveyid);
|
|
91
74
|
}
|
|
@@ -31,7 +31,7 @@ export declare const enum LOCALE_STYLES {
|
|
|
31
31
|
SCIENTIFIC = "scientific",
|
|
32
32
|
COMPACT = "compact"
|
|
33
33
|
}
|
|
34
|
-
export declare const LANG_DEFAULT = "en
|
|
34
|
+
export declare const LANG_DEFAULT = "en";
|
|
35
35
|
export declare const CURRENCY_DEFAULT: {
|
|
36
36
|
text: string;
|
|
37
37
|
label: string;
|
|
@@ -82,7 +82,7 @@ exports.currencyISO = [
|
|
|
82
82
|
{ text: "€ (EUR)", label: "EUR", key: 'eur' },
|
|
83
83
|
{ text: "¥ (JPY)", label: "JPY", key: 'jpy' },
|
|
84
84
|
{ text: "£ (GBP)", label: "GBP", key: 'gbp' },
|
|
85
|
-
{ text:
|
|
85
|
+
{ text: '₩ (KPW)', label: "KPW", key: 'won' },
|
|
86
86
|
{ text: "$ (AUD)", label: "AUD", key: 'aud' },
|
|
87
87
|
{ text: "$ (CAD)", label: "CAD", key: 'cad' },
|
|
88
88
|
{ text: "CHF (CHF)", label: "CHF", key: 'chf' },
|
|
@@ -114,7 +114,7 @@ exports.STANDARD_NUMERIC_FORMATS = [
|
|
|
114
114
|
"Abbreviated",
|
|
115
115
|
"Duration",
|
|
116
116
|
];
|
|
117
|
-
exports.LANG_DEFAULT = "en
|
|
117
|
+
exports.LANG_DEFAULT = "en";
|
|
118
118
|
exports.CURRENCY_DEFAULT = { text: "$ (USD)", label: "USD" };
|
|
119
119
|
exports.DATETIME_OPTIONS = {
|
|
120
120
|
year: "numeric",
|
|
@@ -19,6 +19,6 @@ export declare function isValidTimeString(timeString?: string): boolean;
|
|
|
19
19
|
*/
|
|
20
20
|
export declare function formatTime(timeString: any, format: string): any;
|
|
21
21
|
export declare const addFormat: (value: any, outputFormat?: any, config?: IFormatConfig) => any;
|
|
22
|
-
export declare const parseFormulaType: (type: string) => "
|
|
22
|
+
export declare const parseFormulaType: (type: string) => "NUMERIC" | "DATE" | "TEXT_LABEL";
|
|
23
23
|
export declare const validateColumnType: (column: any) => any;
|
|
24
24
|
export declare const defineFormat: (column?: any, isSimpleTable?: boolean, isCategoryDimension?: boolean) => any;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCurrencySymbolByCode = void 0;
|
|
3
|
+
exports.getCurrencySymbolByCode = exports.fixCurrencyFormatOverride = void 0;
|
|
4
4
|
const isEmpty_1 = require("../../general/mix/isEmpty");
|
|
5
|
+
const fixCurrencyFormatOverride = (currencyFormatOverride) => {
|
|
6
|
+
if (currencyFormatOverride === "WON") {
|
|
7
|
+
return "KPW";
|
|
8
|
+
}
|
|
9
|
+
return currencyFormatOverride;
|
|
10
|
+
};
|
|
11
|
+
exports.fixCurrencyFormatOverride = fixCurrencyFormatOverride;
|
|
5
12
|
/**
|
|
6
13
|
* Gets the currency symbol for a given currency code.
|
|
7
14
|
* @param currencyCode The ISO 4217 currency code (e.g., "USD", "EUR").
|
|
@@ -10,10 +17,11 @@ const isEmpty_1 = require("../../general/mix/isEmpty");
|
|
|
10
17
|
function getCurrencySymbolByCode(currencyCode) {
|
|
11
18
|
if ((0, isEmpty_1.isEmpty)(currencyCode))
|
|
12
19
|
return null;
|
|
20
|
+
const fixedCurrencyCode = (0, exports.fixCurrencyFormatOverride)(currencyCode);
|
|
13
21
|
try {
|
|
14
22
|
const parts = new Intl.NumberFormat("en-US", {
|
|
15
23
|
style: "currency",
|
|
16
|
-
currency:
|
|
24
|
+
currency: fixedCurrencyCode,
|
|
17
25
|
currencyDisplay: "narrowSymbol",
|
|
18
26
|
}).formatToParts(1);
|
|
19
27
|
const symbolPart = parts.find((p) => p.type === "currency");
|
|
@@ -70,10 +70,10 @@ function formatLocaleNumber(value, outputFormat, config) {
|
|
|
70
70
|
let langOpts = options || getLocaleOptions(outputFormat);
|
|
71
71
|
const valueToFormat = (outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format) === "Percentage" /* LOCALE_FORMATS.PERCENTAGE */ ? value / 100 : value;
|
|
72
72
|
try {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
langOpts = Object.assign(Object.assign({}, langOpts), { currency:
|
|
73
|
+
const fixedCurrencyCode = (0, helpers_1.fixCurrencyFormatOverride)(config.currencyFormatOverride);
|
|
74
|
+
if ((0, isDefaultCurrent_1.isDefaultCurrent)(outputFormat.currency) &&
|
|
75
|
+
!!fixedCurrencyCode) {
|
|
76
|
+
langOpts = Object.assign(Object.assign({}, langOpts), { currency: fixedCurrencyCode });
|
|
77
77
|
}
|
|
78
78
|
const key = (outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format) +
|
|
79
79
|
lang +
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Traverses a tree structure and allows modification of nodes and leaves via callback functions.
|
|
3
|
+
* @param options The options for traversing and modifying the tree.
|
|
4
|
+
* @param options.root The root node of the tree.
|
|
5
|
+
* @param options.getChildren Function to get the children of a node.
|
|
6
|
+
* @param options.isLeaf Function to determine if a node is a leaf.
|
|
7
|
+
* @param options.onLeaf Callback function to be called on each leaf node.
|
|
8
|
+
* @param options.onNode Callback function to be called on each non-leaf node.
|
|
9
|
+
*/
|
|
10
|
+
export declare function traverseTree<TNode, TLeaf extends TNode = TNode>(options: {
|
|
11
|
+
root: TNode | readonly TNode[];
|
|
12
|
+
getChildren: (node: TNode) => readonly TNode[] | undefined;
|
|
13
|
+
isLeaf?: (node: TNode) => node is TLeaf;
|
|
14
|
+
onLeaf?: (leaf: TLeaf, parent: TNode | null) => void;
|
|
15
|
+
onNode?: (node: TNode, parent: TNode | null) => void;
|
|
16
|
+
}): void;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.traverseTree = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Traverses a tree structure and allows modification of nodes and leaves via callback functions.
|
|
6
|
+
* @param options The options for traversing and modifying the tree.
|
|
7
|
+
* @param options.root The root node of the tree.
|
|
8
|
+
* @param options.getChildren Function to get the children of a node.
|
|
9
|
+
* @param options.isLeaf Function to determine if a node is a leaf.
|
|
10
|
+
* @param options.onLeaf Callback function to be called on each leaf node.
|
|
11
|
+
* @param options.onNode Callback function to be called on each non-leaf node.
|
|
12
|
+
*/
|
|
13
|
+
function traverseTree(options) {
|
|
14
|
+
const { root, getChildren, isLeaf, onLeaf, onNode } = options;
|
|
15
|
+
/**
|
|
16
|
+
* Recursively walks the tree, calling the appropriate callbacks for nodes and leaves.
|
|
17
|
+
* @param node The current node being processed.
|
|
18
|
+
* @param parent The parent of the current node, or null if it's the root.
|
|
19
|
+
*/
|
|
20
|
+
function walk(node, parent) {
|
|
21
|
+
onNode === null || onNode === void 0 ? void 0 : onNode(node, parent);
|
|
22
|
+
if (isLeaf === null || isLeaf === void 0 ? void 0 : isLeaf(node)) {
|
|
23
|
+
onLeaf === null || onLeaf === void 0 ? void 0 : onLeaf(node, parent);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const children = getChildren(node);
|
|
27
|
+
if (!children)
|
|
28
|
+
return;
|
|
29
|
+
for (const child of children) {
|
|
30
|
+
walk(child, node);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const roots = Array.isArray(root) ? root : [root];
|
|
34
|
+
for (const r of roots)
|
|
35
|
+
walk(r, null);
|
|
36
|
+
}
|
|
37
|
+
exports.traverseTree = traverseTree;
|
|
@@ -8,6 +8,11 @@ export interface II18nTableCharts {
|
|
|
8
8
|
inner_charts: II18nTableChartsInnerCharts;
|
|
9
9
|
pagination: II18nTableChartsPagination;
|
|
10
10
|
sort: II18nTableChartsSort;
|
|
11
|
+
group: {
|
|
12
|
+
level: string;
|
|
13
|
+
select_column: string;
|
|
14
|
+
no_grouping_applied: string;
|
|
15
|
+
};
|
|
11
16
|
sort_tooltip: II18nTableChartsSortTooltip;
|
|
12
17
|
total: string;
|
|
13
18
|
visualization: string;
|
|
@@ -121,7 +121,8 @@ exports.I18N_CHART_BUILDER_GENERAL_OPTIONS = {
|
|
|
121
121
|
filtering: "Filtering",
|
|
122
122
|
column_resizing: "Column Resizing",
|
|
123
123
|
column_arrangement: "Column Arrangement",
|
|
124
|
-
|
|
124
|
+
grouping_column_update: "Add/Remove Groups",
|
|
125
|
+
column_update: "Add/Remove Columns",
|
|
125
126
|
change_aggregation: "Change Column Aggregations",
|
|
126
127
|
},
|
|
127
128
|
customization: {
|
|
@@ -270,7 +270,7 @@ exports.I18N_CHART_BUILDER_STYLE_OPTIONS = {
|
|
|
270
270
|
title: "Body",
|
|
271
271
|
alternate_color: "Alternate Color",
|
|
272
272
|
alternate_bg_color: "Alternate BG Color",
|
|
273
|
-
text_wrapping: "Text
|
|
273
|
+
text_wrapping: "Text Wrapping",
|
|
274
274
|
text_wrapping_normal: "Normal",
|
|
275
275
|
text_wrapping_wrap: "Text Wrap",
|
|
276
276
|
repeatable_rows: "Repeatable Rows",
|
|
@@ -76,6 +76,7 @@ exports.I18N_FORMULA_BUILDER = {
|
|
|
76
76
|
formula_type: "Formula Mode",
|
|
77
77
|
formula_custom_script_mode: "Data Engine Syntax (legacy)",
|
|
78
78
|
formula_custom_script_mode_soon: "Data Engine Syntax (legacy) - Coming Soon",
|
|
79
|
+
default_name_warning: "Default name is mandatory.",
|
|
79
80
|
formula_mode: {
|
|
80
81
|
title: "Standardized Syntax",
|
|
81
82
|
info: 'Allows mathematical and logical operators including +, -, *, /, (), =, >, <, >=, <=, <>. Numbers must be entered in en-US format. Date time values should be entered with format: "MM/DD/YYYY" or "MM/DD/YYYY HH:MM:SS"',
|
|
@@ -130,6 +130,7 @@ exports.I18N_PANEL = {
|
|
|
130
130
|
exporting: "Exporting",
|
|
131
131
|
fit_panel: "Fit to panel",
|
|
132
132
|
no_filters: "No filters applied",
|
|
133
|
+
grouping_select_columns: "Grouping Columns",
|
|
133
134
|
select_columns: "Select columns",
|
|
134
135
|
sort_by: "Sort by",
|
|
135
136
|
smart_analyzer: "Smart analyzer",
|
|
@@ -29,6 +29,11 @@ exports.I18N_TABLE_CHARTS = {
|
|
|
29
29
|
select_column: "Select column to sort by",
|
|
30
30
|
sorted_by: "Order by",
|
|
31
31
|
},
|
|
32
|
+
group: {
|
|
33
|
+
level: "Group",
|
|
34
|
+
select_column: "Select column to group by",
|
|
35
|
+
no_grouping_applied: "No grouping applied",
|
|
36
|
+
},
|
|
32
37
|
sort_tooltip: {
|
|
33
38
|
disabled_multi_sort_dropdown: "Multi-Sorting disabled, add more columns to enable it.",
|
|
34
39
|
will_replace: "Selecting this column will replace the '{{column_name}}' sorting",
|
|
@@ -12,6 +12,7 @@ function BColumnsToUIColumns(columns = [], dataset) {
|
|
|
12
12
|
expressionWords: column.words,
|
|
13
13
|
formulaid: (0, getAttribute_1.getAttribute)(column, "formula_id"),
|
|
14
14
|
formulaType: column.formulaType,
|
|
15
|
+
formulaInputType: column.formulaInputType,
|
|
15
16
|
geogroup: column.geogroup,
|
|
16
17
|
id: column.id,
|
|
17
18
|
imageUploadOption: column.imageUploadOption,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPlatformConfig = void 0;
|
|
4
|
+
const Request_1 = require("../helpers/Request");
|
|
5
|
+
const PLATFORM_CONFIG_ENDPOINT = {
|
|
6
|
+
admin: true,
|
|
7
|
+
devApi: false,
|
|
8
|
+
noUser: true,
|
|
9
|
+
uri: "/platform/config",
|
|
10
|
+
version: 1,
|
|
11
|
+
adminApiInverted: true,
|
|
12
|
+
};
|
|
13
|
+
function getPlatformConfig(config) {
|
|
14
|
+
return Request_1.Request.get({
|
|
15
|
+
apiKey: config.api_key,
|
|
16
|
+
domain: config.domain,
|
|
17
|
+
endpoint: PLATFORM_CONFIG_ENDPOINT,
|
|
18
|
+
qvToken: config.qv_token,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
exports.getPlatformConfig = getPlatformConfig;
|
|
@@ -51,7 +51,8 @@ class Request {
|
|
|
51
51
|
const admin = endpoint.admin ? "/admin" : "";
|
|
52
52
|
const api = Request.getApiUrl(config);
|
|
53
53
|
const user = Request.getUserUrl(config);
|
|
54
|
-
const
|
|
54
|
+
const apiAdmin = !endpoint.adminApiInverted ? `${api}${admin}` : `${admin}${api}`;
|
|
55
|
+
const base = `${apiAdmin}${version}${user}`;
|
|
55
56
|
_url = (config.domain || "") + base + endpoint.uri + _url;
|
|
56
57
|
}
|
|
57
58
|
return this.parseUrl(_url, config);
|
|
@@ -13,4 +13,4 @@ import { IChartShelfType } from "../interfaces/IChartShelfType";
|
|
|
13
13
|
* grouped.
|
|
14
14
|
* @returns The column type of the column.
|
|
15
15
|
*/
|
|
16
|
-
export declare const columnTypeByChart: (column: IChartColumn, shelfType: IChartShelfType, chartGroup: IChartGroupType, isGroupedTable?: boolean) => "
|
|
16
|
+
export declare const columnTypeByChart: (column: IChartColumn, shelfType: IChartShelfType, chartGroup: IChartGroupType, isGroupedTable?: boolean) => import("../..").COMPLEX_COLUMN | import("../..").COMPOUND_COLUMN | "NUMERIC" | NUMERICAL_COLUMN | "DATE" | "TEXT_LABEL" | COLUMN.SINGLE_CHOICE | COLUMN.MULTIPLE_CHOICE | COLUMN.YES_NO | COLUMN.RANKING | COLUMN.DATE | COLUMN.TIME | COLUMN.SIGNATURE | COLUMN.DROPDOWN | COLUMN.IMAGE | COLUMN.EMAIL_FORM | COLUMN.PHONE | COLUMN.PASSWORD | COLUMN.TEXT_LABEL | COLUMN.TEXT_CATEGORY | COLUMN.LOOKUP | COLUMN.TEXT_FORMULA | COLUMN.NUMERIC_FORMULA | COLUMN.DATE_FORMULA | COLUMN.AGGREGATED_FORMULA | COLUMN.BUCKET | COLUMN.SLIDEBAR | COLUMN.NUMERIC | COLUMN.RATING | COLUMN.TEXTFIELD | COLUMN.LONGTEXT | COLUMN.IMAGEUPLOAD | COLUMN.FILEUPLOAD | COLUMN.EXPRESSION | COLUMN.NAME | COLUMN.USADDRESS | COLUMN.ADDRESS;
|
|
@@ -4,4 +4,4 @@ import { IFormulaType } from "../..";
|
|
|
4
4
|
* @param {IFormulaType} type - IFormulaType - this is the type of the formula.
|
|
5
5
|
* @returns The type of the formula.
|
|
6
6
|
*/
|
|
7
|
-
export declare const parseFormulaTypeByCharts: (type: IFormulaType) => "
|
|
7
|
+
export declare const parseFormulaTypeByCharts: (type: IFormulaType) => "NUMERIC" | "DATE" | "TEXT_LABEL";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { IFormulaType } from "../../formulas/interfaces/IFormulaType";
|
|
2
1
|
import { IBColumAnswer } from "./IBColumAnswer";
|
|
3
2
|
import { IBColumnAnswerExpression } from "./IBColumnAnswerExpression";
|
|
4
3
|
import { IBColumnAnswerExpressionCategory } from "./IBColumnAnswerExpressionCategory";
|
|
@@ -8,6 +7,8 @@ import { IColumnImageUploadOption } from "./IColumnImageUploadOption";
|
|
|
8
7
|
import { IColumnOutputFormatSettings } from "./IColumnOutputFormatSettings";
|
|
9
8
|
import { IColumnPropertyType } from "./IColumnPropertyType";
|
|
10
9
|
import { IColumnType } from "./IColumnType";
|
|
10
|
+
import { AGGREGATE_FORMULA_TYPE } from "../../formulas/constants/FORMULA";
|
|
11
|
+
import { IFormulaType } from "../../formulas/interfaces/IFormulaType";
|
|
11
12
|
/**
|
|
12
13
|
* Structure for columns received in the question/list, model endpoints
|
|
13
14
|
*/
|
|
@@ -15,6 +16,7 @@ export interface IBColumn extends Partial<IBColumAnswer>, Partial<IBColumnAnswer
|
|
|
15
16
|
bucketId?: string;
|
|
16
17
|
formulaId?: string;
|
|
17
18
|
formulaType?: IFormulaType;
|
|
19
|
+
formulaInputType?: AGGREGATE_FORMULA_TYPE;
|
|
18
20
|
geogroup?: boolean;
|
|
19
21
|
id: string;
|
|
20
22
|
imageUploadOption?: IColumnImageUploadOption;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { IColumnCalculationType } from "../../qrvey/interfaces/ICalculationType";
|
|
2
|
-
import { IColumnPropertyType } from "./IColumnPropertyType";
|
|
3
|
-
import { IColumnSortingSettings } from "./IColumnSortingSettings";
|
|
4
1
|
import { IBColumn } from "./IBColumn";
|
|
5
|
-
import { IAggregateType } from "../../charts/interfaces/IAggregateType";
|
|
6
2
|
import { IBColumnAnswerExpressionWord } from "./IBColumnAnswerExpressionWord";
|
|
7
3
|
import { IBColumnAnswerLookupValueValue } from "./IBColumnAnswerLookupValueValue";
|
|
4
|
+
import { IColumnPropertyType } from "./IColumnPropertyType";
|
|
5
|
+
import { IColumnSortingSettings } from "./IColumnSortingSettings";
|
|
6
|
+
import { IAggregateType } from "../../charts/interfaces/IAggregateType";
|
|
7
|
+
import { AGGREGATE_FORMULA_TYPE } from "../../formulas/constants/FORMULA";
|
|
8
|
+
import { IColumnCalculationType } from "../../qrvey/interfaces/ICalculationType";
|
|
8
9
|
/**
|
|
9
10
|
* Structure for columns used in the App frontend side
|
|
10
11
|
*/
|
|
@@ -22,5 +23,5 @@ export interface IColumn extends Omit<IBColumn, "text" | "bucketId" | "formulaId
|
|
|
22
23
|
property?: IColumnPropertyType;
|
|
23
24
|
slidebarValue?: number;
|
|
24
25
|
sorting?: IColumnSortingSettings;
|
|
25
|
-
formulaInputType?:
|
|
26
|
+
formulaInputType?: AGGREGATE_FORMULA_TYPE;
|
|
26
27
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { COLUMN } from "../../columns/constants/COLUMN";
|
|
2
1
|
import { isEmpty } from "../../general/mix/isEmpty";
|
|
3
|
-
import { objectCopy } from "../../general/object/objectCopy";
|
|
4
2
|
import { _get } from "../../general/object/get";
|
|
5
|
-
import {
|
|
3
|
+
import { objectCopy } from "../../general/object/objectCopy";
|
|
4
|
+
import { traverseTree } from "../../general/object/traverseTree";
|
|
5
|
+
import { adaptFilterData, FDToLogic } from "../adapters";
|
|
6
6
|
/**
|
|
7
7
|
* @deprecated soon
|
|
8
8
|
* @param logics
|
|
@@ -11,33 +11,26 @@ import { FILTER_OPERATOR } from "../constants/common/FILTER_OPERATOR";
|
|
|
11
11
|
*/
|
|
12
12
|
export function getAggFilters(logics = [], summaries = []) {
|
|
13
13
|
const aggregateFilters = getAggregateFilters(logics);
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
})
|
|
36
|
-
.filter(Boolean),
|
|
37
|
-
});
|
|
38
|
-
})
|
|
39
|
-
.filter((aggFilter) => aggFilter && aggFilter.expressions && aggFilter.expressions.length);
|
|
40
|
-
return aggFilters && concatAggFilters(aggFilters);
|
|
14
|
+
const logic = objectCopy(FDToLogic(adaptFilterData({ logic: aggregateFilters })));
|
|
15
|
+
if (isEmpty(logic) || isEmpty(logic[0].filters))
|
|
16
|
+
return;
|
|
17
|
+
traverseTree({
|
|
18
|
+
root: logic[0].filters,
|
|
19
|
+
getChildren: (node) => node.expressions,
|
|
20
|
+
isLeaf: (node) => !("operator" in node),
|
|
21
|
+
onLeaf: (expression) => {
|
|
22
|
+
const { enabled, validationType, value } = expression;
|
|
23
|
+
const summaryIndex = getIndexByExpression(expression, summaries);
|
|
24
|
+
Object.keys(expression).forEach((key) => {
|
|
25
|
+
delete expression[key];
|
|
26
|
+
});
|
|
27
|
+
expression.enabled = enabled;
|
|
28
|
+
expression.summaryIndex = summaryIndex;
|
|
29
|
+
expression.validationType = validationType;
|
|
30
|
+
expression.value = value;
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
return logic[0].filters[0];
|
|
41
34
|
}
|
|
42
35
|
/**
|
|
43
36
|
* Filters and gets the filters used for aggregate values.
|
|
@@ -65,23 +58,13 @@ function getAggregateFilters(logics = []) {
|
|
|
65
58
|
return newLogics;
|
|
66
59
|
}, []);
|
|
67
60
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
function getExpressionsInLogic(logics = []) {
|
|
80
|
-
return logics.reduce((expressions, logic) => {
|
|
81
|
-
let _expressions = expressions;
|
|
82
|
-
logic.filters.forEach((filter) => {
|
|
83
|
-
_expressions = _expressions.concat(filter.expressions[0].expressions);
|
|
84
|
-
});
|
|
85
|
-
return _expressions;
|
|
86
|
-
}, []);
|
|
61
|
+
/**
|
|
62
|
+
* Finds the index of a summary that matches the given filter expression based on question ID and Qrvey ID.
|
|
63
|
+
* @param expression The filter expression to match
|
|
64
|
+
* @param summaries The list of summaries to search
|
|
65
|
+
* @returns The index of the matching summary, or -1 if not found
|
|
66
|
+
*/
|
|
67
|
+
function getIndexByExpression(expression, summaries = []) {
|
|
68
|
+
return summaries.findIndex((summary) => expression.questionid === summary.questionid &&
|
|
69
|
+
expression.qrveyid === summary.qrveyid);
|
|
87
70
|
}
|
|
@@ -31,7 +31,7 @@ export declare const enum LOCALE_STYLES {
|
|
|
31
31
|
SCIENTIFIC = "scientific",
|
|
32
32
|
COMPACT = "compact"
|
|
33
33
|
}
|
|
34
|
-
export declare const LANG_DEFAULT = "en
|
|
34
|
+
export declare const LANG_DEFAULT = "en";
|
|
35
35
|
export declare const CURRENCY_DEFAULT: {
|
|
36
36
|
text: string;
|
|
37
37
|
label: string;
|
|
@@ -75,7 +75,7 @@ export const currencyISO = [
|
|
|
75
75
|
{ text: "€ (EUR)", label: "EUR", key: 'eur' },
|
|
76
76
|
{ text: "¥ (JPY)", label: "JPY", key: 'jpy' },
|
|
77
77
|
{ text: "£ (GBP)", label: "GBP", key: 'gbp' },
|
|
78
|
-
{ text:
|
|
78
|
+
{ text: '₩ (KPW)', label: "KPW", key: 'won' },
|
|
79
79
|
{ text: "$ (AUD)", label: "AUD", key: 'aud' },
|
|
80
80
|
{ text: "$ (CAD)", label: "CAD", key: 'cad' },
|
|
81
81
|
{ text: "CHF (CHF)", label: "CHF", key: 'chf' },
|
|
@@ -107,7 +107,7 @@ export const STANDARD_NUMERIC_FORMATS = [
|
|
|
107
107
|
"Abbreviated",
|
|
108
108
|
"Duration",
|
|
109
109
|
];
|
|
110
|
-
export const LANG_DEFAULT = "en
|
|
110
|
+
export const LANG_DEFAULT = "en";
|
|
111
111
|
export const CURRENCY_DEFAULT = { text: "$ (USD)", label: "USD" };
|
|
112
112
|
export const DATETIME_OPTIONS = {
|
|
113
113
|
year: "numeric",
|
package/dist/format/format.d.ts
CHANGED
|
@@ -19,6 +19,6 @@ export declare function isValidTimeString(timeString?: string): boolean;
|
|
|
19
19
|
*/
|
|
20
20
|
export declare function formatTime(timeString: any, format: string): any;
|
|
21
21
|
export declare const addFormat: (value: any, outputFormat?: any, config?: IFormatConfig) => any;
|
|
22
|
-
export declare const parseFormulaType: (type: string) => "
|
|
22
|
+
export declare const parseFormulaType: (type: string) => "NUMERIC" | "DATE" | "TEXT_LABEL";
|
|
23
23
|
export declare const validateColumnType: (column: any) => any;
|
|
24
24
|
export declare const defineFormat: (column?: any, isSimpleTable?: boolean, isCategoryDimension?: boolean) => any;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { isEmpty } from "../../general/mix/isEmpty";
|
|
2
|
+
export const fixCurrencyFormatOverride = (currencyFormatOverride) => {
|
|
3
|
+
if (currencyFormatOverride === "WON") {
|
|
4
|
+
return "KPW";
|
|
5
|
+
}
|
|
6
|
+
return currencyFormatOverride;
|
|
7
|
+
};
|
|
2
8
|
/**
|
|
3
9
|
* Gets the currency symbol for a given currency code.
|
|
4
10
|
* @param currencyCode The ISO 4217 currency code (e.g., "USD", "EUR").
|
|
@@ -7,10 +13,11 @@ import { isEmpty } from "../../general/mix/isEmpty";
|
|
|
7
13
|
export function getCurrencySymbolByCode(currencyCode) {
|
|
8
14
|
if (isEmpty(currencyCode))
|
|
9
15
|
return null;
|
|
16
|
+
const fixedCurrencyCode = fixCurrencyFormatOverride(currencyCode);
|
|
10
17
|
try {
|
|
11
18
|
const parts = new Intl.NumberFormat("en-US", {
|
|
12
19
|
style: "currency",
|
|
13
|
-
currency:
|
|
20
|
+
currency: fixedCurrencyCode,
|
|
14
21
|
currencyDisplay: "narrowSymbol",
|
|
15
22
|
}).formatToParts(1);
|
|
16
23
|
const symbolPart = parts.find((p) => p.type === "currency");
|
|
@@ -2,7 +2,7 @@ import { ISOToNumericOffset } from "../dates";
|
|
|
2
2
|
import { isEmpty } from "../general/mix/isEmpty";
|
|
3
3
|
import { currencyISO, LANG_DEFAULT, CURRENCY_DEFAULT, DATETIME_OPTIONS, } from "./definition";
|
|
4
4
|
import { DurationFormatter } from "./duration/durationFormatter";
|
|
5
|
-
import {
|
|
5
|
+
import { fixCurrencyFormatOverride } from "./helpers";
|
|
6
6
|
import { isDateTimeFormat } from "./helpers/isDateTimeFormat";
|
|
7
7
|
import { isDefaultCurrent } from "./helpers/isDefaultCurrent";
|
|
8
8
|
export const getLang = (locale) => {
|
|
@@ -64,10 +64,10 @@ function formatLocaleNumber(value, outputFormat, config) {
|
|
|
64
64
|
let langOpts = options || getLocaleOptions(outputFormat);
|
|
65
65
|
const valueToFormat = (outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format) === "Percentage" /* LOCALE_FORMATS.PERCENTAGE */ ? value / 100 : value;
|
|
66
66
|
try {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
langOpts = Object.assign(Object.assign({}, langOpts), { currency:
|
|
67
|
+
const fixedCurrencyCode = fixCurrencyFormatOverride(config.currencyFormatOverride);
|
|
68
|
+
if (isDefaultCurrent(outputFormat.currency) &&
|
|
69
|
+
!!fixedCurrencyCode) {
|
|
70
|
+
langOpts = Object.assign(Object.assign({}, langOpts), { currency: fixedCurrencyCode });
|
|
71
71
|
}
|
|
72
72
|
const key = (outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format) +
|
|
73
73
|
lang +
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Traverses a tree structure and allows modification of nodes and leaves via callback functions.
|
|
3
|
+
* @param options The options for traversing and modifying the tree.
|
|
4
|
+
* @param options.root The root node of the tree.
|
|
5
|
+
* @param options.getChildren Function to get the children of a node.
|
|
6
|
+
* @param options.isLeaf Function to determine if a node is a leaf.
|
|
7
|
+
* @param options.onLeaf Callback function to be called on each leaf node.
|
|
8
|
+
* @param options.onNode Callback function to be called on each non-leaf node.
|
|
9
|
+
*/
|
|
10
|
+
export declare function traverseTree<TNode, TLeaf extends TNode = TNode>(options: {
|
|
11
|
+
root: TNode | readonly TNode[];
|
|
12
|
+
getChildren: (node: TNode) => readonly TNode[] | undefined;
|
|
13
|
+
isLeaf?: (node: TNode) => node is TLeaf;
|
|
14
|
+
onLeaf?: (leaf: TLeaf, parent: TNode | null) => void;
|
|
15
|
+
onNode?: (node: TNode, parent: TNode | null) => void;
|
|
16
|
+
}): void;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Traverses a tree structure and allows modification of nodes and leaves via callback functions.
|
|
3
|
+
* @param options The options for traversing and modifying the tree.
|
|
4
|
+
* @param options.root The root node of the tree.
|
|
5
|
+
* @param options.getChildren Function to get the children of a node.
|
|
6
|
+
* @param options.isLeaf Function to determine if a node is a leaf.
|
|
7
|
+
* @param options.onLeaf Callback function to be called on each leaf node.
|
|
8
|
+
* @param options.onNode Callback function to be called on each non-leaf node.
|
|
9
|
+
*/
|
|
10
|
+
export function traverseTree(options) {
|
|
11
|
+
const { root, getChildren, isLeaf, onLeaf, onNode } = options;
|
|
12
|
+
/**
|
|
13
|
+
* Recursively walks the tree, calling the appropriate callbacks for nodes and leaves.
|
|
14
|
+
* @param node The current node being processed.
|
|
15
|
+
* @param parent The parent of the current node, or null if it's the root.
|
|
16
|
+
*/
|
|
17
|
+
function walk(node, parent) {
|
|
18
|
+
onNode === null || onNode === void 0 ? void 0 : onNode(node, parent);
|
|
19
|
+
if (isLeaf === null || isLeaf === void 0 ? void 0 : isLeaf(node)) {
|
|
20
|
+
onLeaf === null || onLeaf === void 0 ? void 0 : onLeaf(node, parent);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const children = getChildren(node);
|
|
24
|
+
if (!children)
|
|
25
|
+
return;
|
|
26
|
+
for (const child of children) {
|
|
27
|
+
walk(child, node);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const roots = Array.isArray(root) ? root : [root];
|
|
31
|
+
for (const r of roots)
|
|
32
|
+
walk(r, null);
|
|
33
|
+
}
|
|
@@ -8,6 +8,11 @@ export interface II18nTableCharts {
|
|
|
8
8
|
inner_charts: II18nTableChartsInnerCharts;
|
|
9
9
|
pagination: II18nTableChartsPagination;
|
|
10
10
|
sort: II18nTableChartsSort;
|
|
11
|
+
group: {
|
|
12
|
+
level: string;
|
|
13
|
+
select_column: string;
|
|
14
|
+
no_grouping_applied: string;
|
|
15
|
+
};
|
|
11
16
|
sort_tooltip: II18nTableChartsSortTooltip;
|
|
12
17
|
total: string;
|
|
13
18
|
visualization: string;
|
|
@@ -118,7 +118,8 @@ export const I18N_CHART_BUILDER_GENERAL_OPTIONS = {
|
|
|
118
118
|
filtering: "Filtering",
|
|
119
119
|
column_resizing: "Column Resizing",
|
|
120
120
|
column_arrangement: "Column Arrangement",
|
|
121
|
-
|
|
121
|
+
grouping_column_update: "Add/Remove Groups",
|
|
122
|
+
column_update: "Add/Remove Columns",
|
|
122
123
|
change_aggregation: "Change Column Aggregations",
|
|
123
124
|
},
|
|
124
125
|
customization: {
|
|
@@ -267,7 +267,7 @@ export const I18N_CHART_BUILDER_STYLE_OPTIONS = {
|
|
|
267
267
|
title: "Body",
|
|
268
268
|
alternate_color: "Alternate Color",
|
|
269
269
|
alternate_bg_color: "Alternate BG Color",
|
|
270
|
-
text_wrapping: "Text
|
|
270
|
+
text_wrapping: "Text Wrapping",
|
|
271
271
|
text_wrapping_normal: "Normal",
|
|
272
272
|
text_wrapping_wrap: "Text Wrap",
|
|
273
273
|
repeatable_rows: "Repeatable Rows",
|
|
@@ -73,6 +73,7 @@ export const I18N_FORMULA_BUILDER = {
|
|
|
73
73
|
formula_type: "Formula Mode",
|
|
74
74
|
formula_custom_script_mode: "Data Engine Syntax (legacy)",
|
|
75
75
|
formula_custom_script_mode_soon: "Data Engine Syntax (legacy) - Coming Soon",
|
|
76
|
+
default_name_warning: "Default name is mandatory.",
|
|
76
77
|
formula_mode: {
|
|
77
78
|
title: "Standardized Syntax",
|
|
78
79
|
info: 'Allows mathematical and logical operators including +, -, *, /, (), =, >, <, >=, <=, <>. Numbers must be entered in en-US format. Date time values should be entered with format: "MM/DD/YYYY" or "MM/DD/YYYY HH:MM:SS"',
|
|
@@ -127,6 +127,7 @@ export const I18N_PANEL = {
|
|
|
127
127
|
exporting: "Exporting",
|
|
128
128
|
fit_panel: "Fit to panel",
|
|
129
129
|
no_filters: "No filters applied",
|
|
130
|
+
grouping_select_columns: "Grouping Columns",
|
|
130
131
|
select_columns: "Select columns",
|
|
131
132
|
sort_by: "Sort by",
|
|
132
133
|
smart_analyzer: "Smart analyzer",
|
|
@@ -26,6 +26,11 @@ export const I18N_TABLE_CHARTS = {
|
|
|
26
26
|
select_column: "Select column to sort by",
|
|
27
27
|
sorted_by: "Order by",
|
|
28
28
|
},
|
|
29
|
+
group: {
|
|
30
|
+
level: "Group",
|
|
31
|
+
select_column: "Select column to group by",
|
|
32
|
+
no_grouping_applied: "No grouping applied",
|
|
33
|
+
},
|
|
29
34
|
sort_tooltip: {
|
|
30
35
|
disabled_multi_sort_dropdown: "Multi-Sorting disabled, add more columns to enable it.",
|
|
31
36
|
will_replace: "Selecting this column will replace the '{{column_name}}' sorting",
|
|
@@ -9,6 +9,7 @@ export function BColumnsToUIColumns(columns = [], dataset) {
|
|
|
9
9
|
expressionWords: column.words,
|
|
10
10
|
formulaid: getAttribute(column, "formula_id"),
|
|
11
11
|
formulaType: column.formulaType,
|
|
12
|
+
formulaInputType: column.formulaInputType,
|
|
12
13
|
geogroup: column.geogroup,
|
|
13
14
|
id: column.id,
|
|
14
15
|
imageUploadOption: column.imageUploadOption,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Request } from "../helpers/Request";
|
|
2
|
+
const PLATFORM_CONFIG_ENDPOINT = {
|
|
3
|
+
admin: true,
|
|
4
|
+
devApi: false,
|
|
5
|
+
noUser: true,
|
|
6
|
+
uri: "/platform/config",
|
|
7
|
+
version: 1,
|
|
8
|
+
adminApiInverted: true,
|
|
9
|
+
};
|
|
10
|
+
export function getPlatformConfig(config) {
|
|
11
|
+
return Request.get({
|
|
12
|
+
apiKey: config.api_key,
|
|
13
|
+
domain: config.domain,
|
|
14
|
+
endpoint: PLATFORM_CONFIG_ENDPOINT,
|
|
15
|
+
qvToken: config.qv_token,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
@@ -48,7 +48,8 @@ export class Request {
|
|
|
48
48
|
const admin = endpoint.admin ? "/admin" : "";
|
|
49
49
|
const api = Request.getApiUrl(config);
|
|
50
50
|
const user = Request.getUserUrl(config);
|
|
51
|
-
const
|
|
51
|
+
const apiAdmin = !endpoint.adminApiInverted ? `${api}${admin}` : `${admin}${api}`;
|
|
52
|
+
const base = `${apiAdmin}${version}${user}`;
|
|
52
53
|
_url = (config.domain || "") + base + endpoint.uri + _url;
|
|
53
54
|
}
|
|
54
55
|
return this.parseUrl(_url, config);
|