@qrvey/utils 1.16.1-1 → 1.16.1-17

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.
Files changed (67) hide show
  1. package/dist/cache-managers/cache-platform-config-manager.d.ts +8 -0
  2. package/dist/cache-managers/cache-platform-config-manager.js +37 -0
  3. package/dist/cache-managers/clean-cache-managers.js +3 -0
  4. package/dist/cache-managers/index.d.ts +1 -0
  5. package/dist/cache-managers/index.js +1 -0
  6. package/dist/charts/helpers/styleSettingsByChartType.js +1 -0
  7. package/dist/charts/interfaces/IChartV2.d.ts +1 -0
  8. package/dist/cjs/cache-managers/cache-platform-config-manager.d.ts +8 -0
  9. package/dist/cjs/cache-managers/cache-platform-config-manager.js +41 -0
  10. package/dist/cjs/cache-managers/clean-cache-managers.js +3 -0
  11. package/dist/cjs/cache-managers/index.d.ts +1 -0
  12. package/dist/cjs/cache-managers/index.js +1 -0
  13. package/dist/cjs/charts/helpers/styleSettingsByChartType.js +1 -0
  14. package/dist/cjs/charts/interfaces/IChartV2.d.ts +1 -0
  15. package/dist/cjs/column_format/helpers/columnTypeByChart.d.ts +1 -1
  16. package/dist/cjs/column_format/helpers/parseFormulaTypeByCharts.d.ts +1 -1
  17. package/dist/cjs/columns/interfaces/IBColumn.d.ts +3 -1
  18. package/dist/cjs/columns/interfaces/IColumn.d.ts +6 -5
  19. package/dist/cjs/filters/helpers/OLD_getAggFilters.js +32 -49
  20. package/dist/cjs/format/definition.d.ts +1 -0
  21. package/dist/cjs/format/definition.js +27 -27
  22. package/dist/cjs/format/format.d.ts +1 -1
  23. package/dist/cjs/format/helpers/getCurrencySymbolByCode.d.ts +1 -0
  24. package/dist/cjs/format/helpers/getCurrencySymbolByCode.js +10 -2
  25. package/dist/cjs/format/helpers/isDefaultCurrent.js +1 -2
  26. package/dist/cjs/format/localization.js +5 -5
  27. package/dist/cjs/formulas/constants/FORMULA.d.ts +1 -0
  28. package/dist/cjs/general/object/traverseTree.d.ts +16 -0
  29. package/dist/cjs/general/object/traverseTree.js +37 -0
  30. package/dist/cjs/globalization/interfaces/chart_builder/II18nChartBuilderMenuActions.d.ts +1 -0
  31. package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderCreateModal.d.ts +1 -0
  32. package/dist/cjs/globalization/interfaces/panel/II18nPanelTooltips.d.ts +1 -0
  33. package/dist/cjs/globalization/interfaces/table_charts/II18nTableCharts.d.ts +5 -0
  34. package/dist/cjs/globalization/labels/chart_builder/I18N_CHART_BUILDER_GENERAL_OPTIONS.js +2 -1
  35. package/dist/cjs/globalization/labels/formula_builder/I18N_FORMULA_BUILDER.js +1 -0
  36. package/dist/cjs/globalization/labels/panel/I18N_PANEL.js +1 -0
  37. package/dist/cjs/globalization/labels/table_charts/I18N_TABLE_CHARTS.js +5 -0
  38. package/dist/cjs/services/adapters/BColumnsToUIColumns.adapter.js +1 -0
  39. package/dist/cjs/services/api/platformConfig.api.d.ts +2 -0
  40. package/dist/cjs/services/api/platformConfig.api.js +20 -0
  41. package/dist/column_format/helpers/columnTypeByChart.d.ts +1 -1
  42. package/dist/column_format/helpers/parseFormulaTypeByCharts.d.ts +1 -1
  43. package/dist/columns/interfaces/IBColumn.d.ts +3 -1
  44. package/dist/columns/interfaces/IColumn.d.ts +6 -5
  45. package/dist/filters/helpers/OLD_getAggFilters.js +32 -49
  46. package/dist/format/definition.d.ts +1 -0
  47. package/dist/format/definition.js +27 -27
  48. package/dist/format/format.d.ts +1 -1
  49. package/dist/format/helpers/getCurrencySymbolByCode.d.ts +1 -0
  50. package/dist/format/helpers/getCurrencySymbolByCode.js +8 -1
  51. package/dist/format/helpers/isDefaultCurrent.js +1 -2
  52. package/dist/format/localization.js +6 -6
  53. package/dist/formulas/constants/FORMULA.d.ts +1 -0
  54. package/dist/general/object/traverseTree.d.ts +16 -0
  55. package/dist/general/object/traverseTree.js +33 -0
  56. package/dist/globalization/interfaces/chart_builder/II18nChartBuilderMenuActions.d.ts +1 -0
  57. package/dist/globalization/interfaces/formula_builder/II18nFormulaBuilderCreateModal.d.ts +1 -0
  58. package/dist/globalization/interfaces/panel/II18nPanelTooltips.d.ts +1 -0
  59. package/dist/globalization/interfaces/table_charts/II18nTableCharts.d.ts +5 -0
  60. package/dist/globalization/labels/chart_builder/I18N_CHART_BUILDER_GENERAL_OPTIONS.js +2 -1
  61. package/dist/globalization/labels/formula_builder/I18N_FORMULA_BUILDER.js +1 -0
  62. package/dist/globalization/labels/panel/I18N_PANEL.js +1 -0
  63. package/dist/globalization/labels/table_charts/I18N_TABLE_CHARTS.js +5 -0
  64. package/dist/services/adapters/BColumnsToUIColumns.adapter.js +1 -0
  65. package/dist/services/api/platformConfig.api.d.ts +2 -0
  66. package/dist/services/api/platformConfig.api.js +16 -0
  67. 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
  ? {
@@ -72,6 +72,7 @@ export interface VisualizationTableMenu {
72
72
  filtering: boolean;
73
73
  column_resizing: boolean;
74
74
  column_arrangement: boolean;
75
+ columnGrouping: boolean;
75
76
  column_update: boolean;
76
77
  change_aggregation: boolean;
77
78
  }
@@ -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
  ? {
@@ -72,6 +72,7 @@ export interface VisualizationTableMenu {
72
72
  filtering: boolean;
73
73
  column_resizing: boolean;
74
74
  column_arrangement: boolean;
75
+ columnGrouping: boolean;
75
76
  column_update: boolean;
76
77
  change_aggregation: boolean;
77
78
  }
@@ -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) => "DATE" | "TEXT_LABEL" | "NUMERIC" | import("../..").COMPLEX_COLUMN | import("../..").COMPOUND_COLUMN | NUMERICAL_COLUMN | 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;
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) => "DATE" | "TEXT_LABEL" | "NUMERIC";
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?: string;
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 FILTER_OPERATOR_1 = require("../constants/common/FILTER_OPERATOR");
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 aggFilters = aggregateFilters
18
- .map((aggFilter) => {
19
- const expressions = getExpressionsInLogic([aggFilter]);
20
- return (expressions &&
21
- expressions.length && {
22
- operator: FILTER_OPERATOR_1.FILTER_OPERATOR.OR,
23
- expressions: expressions
24
- .map((expression) => {
25
- const summaryIndex = summaries.findIndex((summary) => expression.questionid === summary.questionid &&
26
- expression.qrveyid === summary.qrveyid &&
27
- (0, get_1._get)(expression.uiExtras.column, "aggregate") ===
28
- summary.aggregate);
29
- if (summaryIndex > -1 ||
30
- expression.questionType === COLUMN_1.COLUMN.AGGREGATED_FORMULA) {
31
- return {
32
- enabled: expression.enabled,
33
- summaryIndex,
34
- validationType: expression.validationType,
35
- value: expression.value,
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
- function concatAggFilters(aggFilters, operator = FILTER_OPERATOR_1.FILTER_OPERATOR.AND) {
73
- const expressions = aggFilters.filter(Boolean);
74
- if (!expressions.length)
75
- return undefined;
76
- else if (expressions.length === 1)
77
- return expressions[0];
78
- return {
79
- operator,
80
- expressions: aggFilters.filter(Boolean),
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
  }
@@ -12,6 +12,7 @@ export declare const isTextColumn: (column: any) => boolean;
12
12
  export declare const currencyISO: {
13
13
  text: string;
14
14
  label: string;
15
+ key: string;
15
16
  }[];
16
17
  export declare const enum LOCALE_FORMATS {
17
18
  DECIMAL = "Decimal",
@@ -77,33 +77,33 @@ const isTextColumn = (column) => exports.textFields.includes(column.type) ||
77
77
  column.formulaType === "boolean";
78
78
  exports.isTextColumn = isTextColumn;
79
79
  exports.currencyISO = [
80
- { text: "Default", label: "USD" },
81
- { text: "$ (USD)", label: "USD" },
82
- { text: "€ (EUR)", label: "EUR" },
83
- { text: "¥ (JPY)", label: "JPY" },
84
- { text: "£ (GBP)", label: "GBP" },
85
- { text: "₩ (WON)", label: "WON" },
86
- { text: "$ (AUD)", label: "AUD" },
87
- { text: "$ (CAD)", label: "CAD" },
88
- { text: "CHF (CHF)", label: "CHF" },
89
- { text: "¥ (CNY)", label: "CNY" },
90
- { text: "kr (SEK)", label: "SEK" },
91
- { text: "$ (MXN)", label: "MXN" },
92
- { text: "$ (NZD)", label: "NZD" },
93
- { text: "$ (SGD)", label: "SGD" },
94
- { text: "$ (HKD)", label: "HKD" },
95
- { text: "kr (NOK)", label: "NOK" },
96
- { text: "₩ (KRW)", label: "KRW" },
97
- { text: "₺ (TRY)", label: "TRY" },
98
- { text: "₹ (INR)", label: "INR" },
99
- { text: "₽ (RUB)", label: "RUB" },
100
- { text: "R$ (BRL)", label: "BRL" },
101
- { text: "R (ZAR)", label: "ZAR" },
102
- { text: "kr (DKK)", label: "DKK" },
103
- { text: "zł (PLN)", label: "PLN" },
104
- { text: "NT$ (TWD)", label: "TWD" },
105
- { text: "฿ (THB)", label: "THB" },
106
- { text: "RM (MYR)", label: "MYR" },
80
+ { text: "Default", label: "USD", key: "default" },
81
+ { text: "$ (USD)", label: "USD", key: 'usd' },
82
+ { text: "€ (EUR)", label: "EUR", key: 'eur' },
83
+ { text: "¥ (JPY)", label: "JPY", key: 'jpy' },
84
+ { text: "£ (GBP)", label: "GBP", key: 'gbp' },
85
+ { text: '₩ (KPW)', label: "KPW", key: 'won' },
86
+ { text: "$ (AUD)", label: "AUD", key: 'aud' },
87
+ { text: "$ (CAD)", label: "CAD", key: 'cad' },
88
+ { text: "CHF (CHF)", label: "CHF", key: 'chf' },
89
+ { text: "¥ (CNY)", label: "CNY", key: 'cny' },
90
+ { text: "kr (SEK)", label: "SEK", key: 'sek' },
91
+ { text: "$ (MXN)", label: "MXN", key: 'mxn' },
92
+ { text: "$ (NZD)", label: "NZD", key: 'nzd' },
93
+ { text: "$ (SGD)", label: "SGD", key: 'sgd' },
94
+ { text: "$ (HKD)", label: "HKD", key: 'hkd' },
95
+ { text: "kr (NOK)", label: "NOK", key: 'nok' },
96
+ { text: "₩ (KRW)", label: "KRW", key: 'krw' },
97
+ { text: "₺ (TRY)", label: "TRY", key: 'try' },
98
+ { text: "₹ (INR)", label: "INR", key: 'inr' },
99
+ { text: "₽ (RUB)", label: "RUB", key: 'rub' },
100
+ { text: "R$ (BRL)", label: "BRL", key: 'brl' },
101
+ { text: "R (ZAR)", label: "ZAR", key: 'zar' },
102
+ { text: "kr (DKK)", label: "DKK", key: 'dkk' },
103
+ { text: "zł (PLN)", label: "PLN", key: 'pln' },
104
+ { text: "NT$ (TWD)", label: "TWD", key: 'twd' },
105
+ { text: "฿ (THB)", label: "THB", key: 'thb' },
106
+ { text: "RM (MYR)", label: "MYR", key: 'myr' },
107
107
  ];
108
108
  exports.STANDARD_NUMERIC_FORMATS = [
109
109
  "Decimal",
@@ -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) => "DATE" | "TEXT_LABEL" | "NUMERIC";
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,3 +1,4 @@
1
+ export declare const fixCurrencyFormatOverride: (currencyFormatOverride: string) => string | undefined;
1
2
  /**
2
3
  * Gets the currency symbol for a given currency code.
3
4
  * @param currencyCode The ISO 4217 currency code (e.g., "USD", "EUR").
@@ -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: currencyCode,
24
+ currency: fixedCurrencyCode,
17
25
  currencyDisplay: "narrowSymbol",
18
26
  }).formatToParts(1);
19
27
  const symbolPart = parts.find((p) => p.type === "currency");
@@ -7,7 +7,6 @@ exports.isDefaultCurrent = void 0;
7
7
  * @returns true if the currency is the default currency, false otherwise
8
8
  */
9
9
  function isDefaultCurrent(currency) {
10
- return (((currency === null || currency === void 0 ? void 0 : currency.key) == null || (currency === null || currency === void 0 ? void 0 : currency.key) === "default") &&
11
- ((currency === null || currency === void 0 ? void 0 : currency.text) == null || (currency === null || currency === void 0 ? void 0 : currency.text) === "Default"));
10
+ return (((currency === null || currency === void 0 ? void 0 : currency.key) == null || (currency === null || currency === void 0 ? void 0 : currency.key) === "default"));
12
11
  }
13
12
  exports.isDefaultCurrent = isDefaultCurrent;
@@ -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
- if (config.currencyFormatOverride &&
74
- (0, isDefaultCurrent_1.isDefaultCurrent)(outputFormat.currency) &&
75
- (0, helpers_1.getCurrencySymbolByCode)(config.currencyFormatOverride)) {
76
- langOpts = Object.assign(Object.assign({}, langOpts), { currency: config.currencyFormatOverride });
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 +
@@ -103,7 +103,7 @@ function getLocaleOptions(outputFormat) {
103
103
  case "Currency" /* LOCALE_FORMATS.CURRENCY */: {
104
104
  let iso = (0, isEmpty_1.isEmpty)(currency)
105
105
  ? definition_1.CURRENCY_DEFAULT
106
- : definition_1.currencyISO.find((item) => item.text === currency.text);
106
+ : definition_1.currencyISO.find((item) => item.label === currency.label);
107
107
  if ((0, isEmpty_1.isEmpty)(iso)) {
108
108
  iso = definition_1.currencyISO.find((item) => {
109
109
  const symbol = item.text.split(" ")[0];
@@ -10,3 +10,4 @@ export declare const COLUMN_BY_FORMULA: {
10
10
  [key in IFormulaType]: IColumnType;
11
11
  };
12
12
  export declare const AGGREGATE_FORMULA = "AGGREGATE";
13
+ export type AGGREGATE_FORMULA_TYPE = "AGGREGATE";
@@ -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;
@@ -5,6 +5,7 @@ export interface II18nChartBuilderMenuActions {
5
5
  filtering: string;
6
6
  column_resizing: string;
7
7
  column_arrangement: string;
8
+ grouping_column_update: string;
8
9
  column_update: string;
9
10
  change_aggregation: string;
10
11
  }
@@ -39,6 +39,7 @@ export interface II18nFormulaBuilderCreateModal {
39
39
  formula_type: string;
40
40
  formula_custom_script_mode: string;
41
41
  formula_custom_script_mode_soon: string;
42
+ default_name_warning: string;
42
43
  formula_mode: {
43
44
  title: string;
44
45
  info: string;
@@ -2,6 +2,7 @@ export interface II18nPanelTooltips {
2
2
  exporting: string;
3
3
  fit_panel: string;
4
4
  no_filters: string;
5
+ grouping_select_columns: string;
5
6
  select_columns: string;
6
7
  sort_by: string;
7
8
  smart_analyzer: string;
@@ -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;