@qrvey/utils 1.3.0-7 → 1.3.0
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/.eslintrc.json +2 -0
- package/README.md +503 -49
- package/bitbucket-pipelines.yml +24 -16
- package/dist/cjs/column_format/helpers/columnTypeByChart.d.ts +1 -1
- package/dist/cjs/column_format/helpers/defineXYChartFormat.js +4 -3
- package/dist/cjs/columns/helpers/getDatasetColumnByDatasets.d.ts +10 -0
- package/dist/cjs/columns/helpers/{getDatasetColumnyDatasets.js → getDatasetColumnByDatasets.js} +8 -1
- package/dist/cjs/columns/helpers/index.d.ts +1 -2
- package/dist/cjs/columns/helpers/index.js +1 -2
- package/dist/cjs/dates/adapters/index.d.ts +6 -0
- package/dist/cjs/dates/adapters/index.js +6 -0
- package/dist/cjs/filters/adapters/FDToLogic.js +3 -3
- package/dist/cjs/filters/helpers/backend/getLogicByDatasets.d.ts +11 -0
- package/dist/cjs/filters/helpers/backend/getLogicByDatasets.js +34 -0
- package/dist/cjs/filters/helpers/backend/getLogicByDatasetsColumns.d.ts +12 -0
- package/dist/cjs/filters/helpers/backend/getLogicByDatasetsColumns.js +47 -0
- package/dist/cjs/filters/helpers/backend/index.d.ts +2 -0
- package/dist/cjs/filters/helpers/backend/index.js +2 -0
- package/dist/cjs/filters/helpers/common/excludeFiltersByParams.js +1 -1
- package/dist/cjs/filters/helpers/common/getFiltersByDatasetsColumns.d.ts +10 -0
- package/dist/cjs/filters/helpers/common/getFiltersByDatasetsColumns.js +32 -0
- package/dist/cjs/filters/helpers/common/index.d.ts +1 -0
- package/dist/cjs/filters/helpers/common/index.js +1 -0
- package/dist/cjs/filters/helpers/getAvailableScopes.js +5 -5
- package/dist/cjs/filters/interfaces/backend/IFBExpression.d.ts +1 -0
- package/dist/cjs/filters/interfaces/common/IFSAvailableScope.d.ts +1 -0
- package/dist/cjs/filters/interfaces/functions/IFFGetLogicByDatasets.d.ts +6 -0
- package/dist/cjs/filters/interfaces/functions/IFFGetLogicByDatasets.js +2 -0
- package/dist/cjs/filters/interfaces/functions/IFFGetLogicByDatasetsColumns.d.ts +7 -0
- package/dist/cjs/filters/interfaces/functions/IFFGetLogicByDatasetsColumns.js +2 -0
- package/dist/cjs/filters/interfaces/functions/IFFiltersGetData.d.ts +1 -1
- package/dist/cjs/filters/interfaces/functions/index.d.ts +2 -0
- package/dist/cjs/filters/interfaces/functions/index.js +2 -0
- package/dist/cjs/filters/interfaces/index.d.ts +1 -0
- package/dist/cjs/filters/interfaces/index.js +1 -0
- package/dist/cjs/filters/services/Filters.api.js +11 -6
- package/dist/cjs/globalization/helpers/getI18nDateGroupLabel.js +1 -1
- package/dist/cjs/globalization/interfaces/chart_builder/II18nChartBuilderStyleOptions.d.ts +10 -0
- package/dist/cjs/globalization/interfaces/style_themes/II18nStyleThemesTheme.d.ts +1 -0
- package/dist/cjs/globalization/labels/chart_builder/I18N_CHART_BUILDER_LAYER_OPTIONS.js +1 -1
- package/dist/cjs/globalization/labels/chart_builder/I18N_CHART_BUILDER_STYLE_OPTIONS.js +10 -0
- package/dist/cjs/globalization/labels/style_themes/I18N_STYLE_THEMES.js +1 -0
- package/dist/cjs/qrvey/helpers/getDatasetByColumn.d.ts +9 -0
- package/dist/cjs/{columns → qrvey}/helpers/getDatasetByColumn.js +8 -2
- package/dist/cjs/qrvey/helpers/index.d.ts +1 -0
- package/dist/cjs/qrvey/helpers/index.js +1 -0
- package/dist/cjs/services/adapters/BBranchesMapToUIBranchesMap.adapter.js +3 -3
- package/dist/cjs/services/adapters/BColumnsToUIColumns.adapter.js +5 -4
- package/dist/cjs/services/adapters/BDatasetsToUIDatasets.adapter.js +3 -2
- package/dist/cjs/services/adapters/BModelToUIModel.adapter.js +1 -1
- package/dist/column_format/helpers/defineXYChartFormat.js +4 -3
- package/dist/columns/helpers/getDatasetColumnByDatasets.d.ts +10 -0
- package/dist/columns/helpers/getDatasetColumnByDatasets.js +15 -0
- package/dist/columns/helpers/index.d.ts +1 -2
- package/dist/columns/helpers/index.js +1 -2
- package/dist/dates/adapters/index.d.ts +6 -0
- package/dist/dates/adapters/index.js +6 -0
- package/dist/filters/adapters/FDToLogic.js +3 -3
- package/dist/filters/helpers/backend/getLogicByDatasets.d.ts +11 -0
- package/dist/filters/helpers/backend/getLogicByDatasets.js +30 -0
- package/dist/filters/helpers/backend/getLogicByDatasetsColumns.d.ts +12 -0
- package/dist/filters/helpers/backend/getLogicByDatasetsColumns.js +43 -0
- package/dist/filters/helpers/backend/index.d.ts +2 -0
- package/dist/filters/helpers/backend/index.js +2 -0
- package/dist/filters/helpers/common/excludeFiltersByParams.js +1 -1
- package/dist/filters/helpers/common/getFiltersByDatasetsColumns.d.ts +10 -0
- package/dist/filters/helpers/common/getFiltersByDatasetsColumns.js +28 -0
- package/dist/filters/helpers/common/index.d.ts +1 -0
- package/dist/filters/helpers/common/index.js +1 -0
- package/dist/filters/helpers/getAvailableScopes.js +5 -5
- package/dist/filters/interfaces/backend/IFBExpression.d.ts +1 -0
- package/dist/filters/interfaces/common/IFSAvailableScope.d.ts +1 -0
- package/dist/filters/interfaces/functions/IFFGetLogicByDatasets.d.ts +6 -0
- package/dist/filters/interfaces/functions/IFFGetLogicByDatasets.js +1 -0
- package/dist/filters/interfaces/functions/IFFGetLogicByDatasetsColumns.d.ts +7 -0
- package/dist/filters/interfaces/functions/IFFGetLogicByDatasetsColumns.js +1 -0
- package/dist/filters/interfaces/functions/IFFiltersGetData.d.ts +1 -1
- package/dist/filters/interfaces/functions/index.d.ts +2 -0
- package/dist/filters/interfaces/functions/index.js +2 -0
- package/dist/filters/interfaces/index.d.ts +1 -0
- package/dist/filters/interfaces/index.js +1 -0
- package/dist/filters/services/Filters.api.js +11 -6
- package/dist/globalization/helpers/getI18nDateGroupLabel.js +1 -1
- package/dist/globalization/interfaces/chart_builder/II18nChartBuilderStyleOptions.d.ts +10 -0
- package/dist/globalization/interfaces/style_themes/II18nStyleThemesTheme.d.ts +1 -0
- package/dist/globalization/labels/chart_builder/I18N_CHART_BUILDER_LAYER_OPTIONS.js +1 -1
- package/dist/globalization/labels/chart_builder/I18N_CHART_BUILDER_STYLE_OPTIONS.js +10 -0
- package/dist/globalization/labels/style_themes/I18N_STYLE_THEMES.js +1 -0
- package/dist/qrvey/helpers/getDatasetByColumn.d.ts +9 -0
- package/dist/qrvey/helpers/getDatasetByColumn.js +12 -0
- package/dist/qrvey/helpers/index.d.ts +1 -0
- package/dist/qrvey/helpers/index.js +1 -0
- package/dist/services/adapters/BBranchesMapToUIBranchesMap.adapter.js +3 -3
- package/dist/services/adapters/BColumnsToUIColumns.adapter.js +5 -4
- package/dist/services/adapters/BDatasetsToUIDatasets.adapter.js +3 -2
- package/dist/services/adapters/BModelToUIModel.adapter.js +1 -1
- package/jest.config.js +1 -1
- package/package.json +5 -4
- package/src/column_format/helpers/defineXYChartFormat.ts +4 -5
- package/src/columns/helpers/{getDatasetColumnyDatasets.ts → getDatasetColumnByDatasets.ts} +9 -1
- package/src/columns/helpers/index.ts +1 -2
- package/src/dates/adapters/index.ts +6 -0
- package/src/filters/adapters/FDToLogic.ts +5 -5
- package/src/filters/helpers/backend/getLogicByDatasets.ts +37 -0
- package/src/filters/helpers/backend/getLogicByDatasetsColumns.ts +52 -0
- package/src/filters/helpers/backend/index.ts +2 -0
- package/src/filters/helpers/common/excludeFiltersByParams.ts +1 -1
- package/src/filters/helpers/common/getFiltersByDatasetsColumns.ts +40 -0
- package/src/filters/helpers/common/index.ts +1 -0
- package/src/filters/helpers/getAvailableScopes.ts +4 -4
- package/src/filters/interfaces/backend/IFBExpression.ts +1 -0
- package/src/filters/interfaces/common/IFSAvailableScope.ts +1 -0
- package/src/filters/interfaces/functions/IFFGetLogicByDatasets.ts +6 -0
- package/src/filters/interfaces/functions/IFFGetLogicByDatasetsColumns.ts +7 -0
- package/src/filters/interfaces/functions/IFFiltersGetData.ts +1 -1
- package/src/filters/interfaces/functions/index.ts +2 -0
- package/src/filters/interfaces/index.ts +1 -0
- package/src/filters/services/Filters.api.ts +11 -3
- package/src/globalization/helpers/getI18nDateGroupLabel.ts +1 -1
- package/src/globalization/interfaces/chart_builder/II18nChartBuilderStyleOptions.ts +10 -0
- package/src/globalization/interfaces/style_themes/II18nStyleThemesTheme.ts +1 -0
- package/src/globalization/labels/chart_builder/I18N_CHART_BUILDER_LAYER_OPTIONS.ts +1 -1
- package/src/globalization/labels/chart_builder/I18N_CHART_BUILDER_STYLE_OPTIONS.ts +10 -0
- package/src/globalization/labels/style_themes/I18N_STYLE_THEMES.ts +1 -0
- package/src/qrvey/helpers/getDatasetByColumn.ts +15 -0
- package/src/qrvey/helpers/index.ts +1 -0
- package/src/services/adapters/BBranchesMapToUIBranchesMap.adapter.ts +3 -3
- package/src/services/adapters/BColumnsToUIColumns.adapter.ts +5 -4
- package/src/services/adapters/BDatasetsToUIDatasets.adapter.ts +3 -2
- package/src/services/adapters/BModelToUIModel.adapter.ts +1 -1
- package/test/filters/backend/getLogicByDatasetsColumns.test.js +312 -0
- package/test/tokens/isTokenLabel.test.js +259 -0
- package/tsconfig.json +1 -4
- package/dist/cjs/columns/helpers/getDatasetByColumn.d.ts +0 -3
- package/dist/cjs/columns/helpers/getDatasetColumnyDatasets.d.ts +0 -3
- package/dist/columns/helpers/getDatasetByColumn.d.ts +0 -3
- package/dist/columns/helpers/getDatasetByColumn.js +0 -6
- package/dist/columns/helpers/getDatasetColumnyDatasets.d.ts +0 -3
- package/dist/columns/helpers/getDatasetColumnyDatasets.js +0 -8
- package/src/columns/helpers/getDatasetByColumn.ts +0 -9
- package/test/tokens/isTokenLabel.test.ts +0 -129
|
@@ -12,6 +12,16 @@ export const I18N_CHART_BUILDER_STYLE_OPTIONS = {
|
|
|
12
12
|
chart_type_disabled_message: '<i>Type</i> selection is disabled because stacked type configuration is in use.',
|
|
13
13
|
comparision_color: 'Comparision Color',
|
|
14
14
|
data_labels_check: 'Data Labels',
|
|
15
|
+
data_labels_clustering: '<i>Clustering</i> is inactive, enable it to use <i>{{text}}</i>.',
|
|
16
|
+
data_labels_format: '<i>% Difference</i> is active, disable it to set a different formatting.',
|
|
17
|
+
data_labels_position: 'Label Position',
|
|
18
|
+
data_labels_position_inside: 'Inside',
|
|
19
|
+
data_labels_position_outside: 'Outside',
|
|
20
|
+
data_labels_show_as: 'Show as',
|
|
21
|
+
data_labels_show_as_category: 'Category',
|
|
22
|
+
data_labels_show_as_percentage: 'Percentage',
|
|
23
|
+
data_labels_show_as_placeholder: 'Select Option',
|
|
24
|
+
data_labels_show_as_value: 'Value',
|
|
15
25
|
default_format_title: 'Format',
|
|
16
26
|
display_outliers_check: 'Display Outliers',
|
|
17
27
|
line_opacity: 'Line Opacity',
|
|
@@ -40,6 +40,7 @@ export const I18N_STYLE_THEMES = {
|
|
|
40
40
|
qrvey_theme: 'Qrvey Theme',
|
|
41
41
|
restore_to_default: 'Restore to Default',
|
|
42
42
|
save_theme: 'Save Theme',
|
|
43
|
+
show_header: 'Show Header',
|
|
43
44
|
show_title: 'Show Title',
|
|
44
45
|
table_header_styles: 'Table Header Styles',
|
|
45
46
|
text_styles: 'Text Styles',
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IColumn } from "../../columns/interfaces/IColumn";
|
|
2
|
+
import { IDataset } from "../interfaces/IDataset";
|
|
3
|
+
/**
|
|
4
|
+
* Gets a dataset by a given partial column
|
|
5
|
+
* @param column the partial column
|
|
6
|
+
* @param datasets the collection of dataset to look for one.
|
|
7
|
+
* @returns the found dataset or undefined
|
|
8
|
+
*/
|
|
9
|
+
export declare function getDatasetByColumn(column: Partial<IColumn>, datasets?: IDataset[]): IDataset;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { isEmpty } from "../../general/mix/isEmpty";
|
|
2
|
+
/**
|
|
3
|
+
* Gets a dataset by a given partial column
|
|
4
|
+
* @param column the partial column
|
|
5
|
+
* @param datasets the collection of dataset to look for one.
|
|
6
|
+
* @returns the found dataset or undefined
|
|
7
|
+
*/
|
|
8
|
+
export function getDatasetByColumn(column, datasets = []) {
|
|
9
|
+
if (isEmpty(column) || isEmpty(datasets))
|
|
10
|
+
return;
|
|
11
|
+
return datasets.find(dataset => dataset.qrveyid === column.qrveyid);
|
|
12
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './areStaticColumnValues';
|
|
2
2
|
export * from './getCategorizableExpression';
|
|
3
3
|
export * from './getDataAnswersByColumn';
|
|
4
|
+
export * from './getDatasetByColumn';
|
|
4
5
|
export * from './getDropdownAnswers';
|
|
5
6
|
export * from './getExpressionAnswers';
|
|
6
7
|
export * from './getImageAnswers';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './areStaticColumnValues';
|
|
2
2
|
export * from './getCategorizableExpression';
|
|
3
3
|
export * from './getDataAnswersByColumn';
|
|
4
|
+
export * from './getDatasetByColumn';
|
|
4
5
|
export * from './getDropdownAnswers';
|
|
5
6
|
export * from './getExpressionAnswers';
|
|
6
7
|
export * from './getImageAnswers';
|
|
@@ -8,9 +8,9 @@ import { BColumnsToUIColumns } from "./BColumnsToUIColumns.adapter";
|
|
|
8
8
|
export function BBranchesMapToUIBranchesMap(branchesMap) {
|
|
9
9
|
if (isEmpty(branchesMap))
|
|
10
10
|
return [];
|
|
11
|
-
return branchesMap.map(
|
|
12
|
-
questionid:
|
|
13
|
-
branches:
|
|
11
|
+
return branchesMap.map(branchMap => ({
|
|
12
|
+
questionid: branchMap.questionid,
|
|
13
|
+
branches: branchMap.branches.map(branch => ({
|
|
14
14
|
columns: BColumnsToUIColumns(branch.questions.data)
|
|
15
15
|
}))
|
|
16
16
|
}));
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
+
import { getAttribute } from "../../general/object/getAttribute";
|
|
1
2
|
export function BColumnsToUIColumns(columns = [], dataset) {
|
|
2
3
|
return columns.map(column => ({
|
|
3
4
|
answers: column.answers,
|
|
4
|
-
bucketid: column
|
|
5
|
+
bucketid: getAttribute(column, 'bucket_id'),
|
|
5
6
|
expressionCategory: column.activeCat,
|
|
6
7
|
expressionNegative: column.negative,
|
|
7
8
|
expressionPositive: column.positive,
|
|
8
9
|
expressionWords: column.words,
|
|
9
|
-
formulaid: column
|
|
10
|
+
formulaid: getAttribute(column, 'formula_id'),
|
|
10
11
|
formulaType: column.formulaType,
|
|
11
12
|
geogroup: column.geogroup,
|
|
12
13
|
id: column.id,
|
|
13
14
|
imageUploadOption: column.imageUploadOption,
|
|
14
15
|
label: column.text,
|
|
15
16
|
linked: column.linked,
|
|
16
|
-
linkid: (dataset
|
|
17
|
+
linkid: getAttribute(dataset, 'link_id') || getAttribute(column, 'link_id'),
|
|
17
18
|
outputFormat: column.outputFormat,
|
|
18
19
|
property: column.property,
|
|
19
|
-
qrveyid: (dataset
|
|
20
|
+
qrveyid: getAttribute(dataset, 'qrvey_id') || getAttribute(column, 'qrvey_id'),
|
|
20
21
|
slidebarValue: column.sliderVal,
|
|
21
22
|
lookupValue: column.value,
|
|
22
23
|
type: column.type,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { getAttribute } from "../../general/object/getAttribute";
|
|
1
2
|
import { BColumnsToUIColumns } from "./BColumnsToUIColumns.adapter";
|
|
2
3
|
export function BDatasetsToUIDatasets(datasets = []) {
|
|
3
4
|
return datasets.map(dataset => ({
|
|
4
|
-
qrveyid: dataset
|
|
5
|
+
qrveyid: getAttribute(dataset, 'qrvey_id'),
|
|
5
6
|
label: dataset.name,
|
|
6
|
-
linkid: dataset
|
|
7
|
+
linkid: getAttribute(dataset, 'link_id'),
|
|
7
8
|
options: BColumnsToUIColumns(dataset.options, dataset),
|
|
8
9
|
}));
|
|
9
10
|
}
|
|
@@ -9,7 +9,7 @@ export function BModelToUIModel(model) {
|
|
|
9
9
|
appid: model.appid,
|
|
10
10
|
branchesMap: BBranchesMapToUIBranchesMap(model.branchesMap),
|
|
11
11
|
columnOrder: model.questionOrder,
|
|
12
|
-
columns: BColumnsToUIColumns(model.questions.data),
|
|
12
|
+
columns: BColumnsToUIColumns(model.questions.data, { qrveyid: model.qrveyid }),
|
|
13
13
|
createDate: model.createDate,
|
|
14
14
|
datalinkInfo: model.datalinkInfo,
|
|
15
15
|
modifyDate: model.modifyDate,
|
package/jest.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qrvey/utils",
|
|
3
|
-
"version": "1.3.0
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Helper, Utils for all Qrvey Projects",
|
|
5
5
|
"homepage": "https://bitbucket.org/qrvey/qrvey_utils/wiki/Home",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"compodoc:server": "./node_modules/.bin/compodoc -p ./tsconfig.doc.json -s --port=4400",
|
|
12
12
|
"lint": "eslint src --quiet --exit-on-fatal-error --ext .ts,.js",
|
|
13
13
|
"lint-dev": "eslint src --debug --ext .ts,.tsx",
|
|
14
|
+
"pipeline": "npm run build-clean && npm run lint && npm run test",
|
|
14
15
|
"publishing-old": "node ./scripts/prepare-publish && np",
|
|
15
16
|
"publishing-prerelease-old": "node ./scripts/prepare-publish && np --any-branch --tag=$npm_config_tag",
|
|
16
17
|
"publishing-beta-1": "node ./scripts/publishing --np-new-version=$npm_config_np_new_version --np-any-branch=$npm_config_np_any_branch --np-tag=$npm_config_np_tag",
|
|
@@ -22,13 +23,13 @@
|
|
|
22
23
|
"license": "MIT",
|
|
23
24
|
"devDependencies": {
|
|
24
25
|
"@compodoc/compodoc": "1.1.19",
|
|
25
|
-
"@types/jest": "27.5.
|
|
26
|
+
"@types/jest": "27.5.1",
|
|
26
27
|
"@typescript-eslint/eslint-plugin": "5.22.0",
|
|
27
28
|
"@typescript-eslint/parser": "5.22.0",
|
|
28
29
|
"eslint": "8.14.0",
|
|
29
|
-
"jest": "
|
|
30
|
+
"jest": "28.1.0",
|
|
30
31
|
"np": "7.6.1",
|
|
31
|
-
"ts-jest": "
|
|
32
|
+
"ts-jest": "28.0.2",
|
|
32
33
|
"typedoc": "0.22.15",
|
|
33
34
|
"typescript": "4.6.4"
|
|
34
35
|
},
|
|
@@ -17,6 +17,7 @@ import { columnTypeByChart } from "./columnTypeByChart";
|
|
|
17
17
|
export const defineXYChartFormat = (column: IChartColumn, settings: IColumnFormatSettings) : IColumnFormatReturnType => {
|
|
18
18
|
const { aggregate, type, defaultFormat, outputFormat, selectedFormat, dateGroup } = column;
|
|
19
19
|
const { shelfType, withoutFormat } = settings;
|
|
20
|
+
const columnDefaultFormat = defaultFormat || outputFormat;
|
|
20
21
|
|
|
21
22
|
//Defaults
|
|
22
23
|
const defaultText = 'Default';
|
|
@@ -27,9 +28,7 @@ export const defineXYChartFormat = (column: IChartColumn, settings: IColumnForma
|
|
|
27
28
|
|
|
28
29
|
const noFormatSupported = DATEGROUP_UNSUPPORT_FORMAT.some(gp => gp === dateGroup?.label);
|
|
29
30
|
const isUsedAsNumericColumn = type !== columnType;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const hasDefaultFormat = (isEmpty(selectedFormat) && outputFormat?.format === defaultText) || (selectedFormat?.format === defaultText);
|
|
31
|
+
const hasDefaultFormat = isEmpty(selectedFormat) || (outputFormat?.format === defaultText) || (selectedFormat?.format === defaultText);
|
|
33
32
|
|
|
34
33
|
|
|
35
34
|
switch(columnType) {
|
|
@@ -49,7 +48,7 @@ export const defineXYChartFormat = (column: IChartColumn, settings: IColumnForma
|
|
|
49
48
|
return STRING_FORMAT.NONE;
|
|
50
49
|
}
|
|
51
50
|
else if(hasDefaultFormat) {
|
|
52
|
-
return { ...
|
|
51
|
+
return { ...columnDefaultFormat, format: defaultText, originalFormat: { ...outputFormat } };
|
|
53
52
|
}
|
|
54
53
|
else {
|
|
55
54
|
return selectedFormat;
|
|
@@ -69,7 +68,7 @@ export const defineXYChartFormat = (column: IChartColumn, settings: IColumnForma
|
|
|
69
68
|
else return outputFormat;
|
|
70
69
|
} else {
|
|
71
70
|
if(withoutFormat === true) {
|
|
72
|
-
return
|
|
71
|
+
return columnDefaultFormat;
|
|
73
72
|
}
|
|
74
73
|
else if(hasDefaultFormat) {
|
|
75
74
|
return { ...outputFormat };
|
|
@@ -3,9 +3,17 @@ import { IDataset } from "../../qrvey/interfaces/IDataset";
|
|
|
3
3
|
import { IColumn } from "../interfaces/IColumn";
|
|
4
4
|
import { getDatasetColumn } from "./getDatasetColumn";
|
|
5
5
|
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Gets a column from a dataset.
|
|
9
|
+
* Recieves a partial column object and received a full column object from the Dataset
|
|
10
|
+
* @param column a partial column object
|
|
11
|
+
* @param datasets the datasets to look for the colun
|
|
12
|
+
* @returns the Column object
|
|
13
|
+
*/
|
|
6
14
|
export function getDatasetColumnByDatasets(column: Partial<IColumn>, datasets: IDataset[]): IColumn {
|
|
7
15
|
if (isEmpty(column) || isEmpty(datasets)) return;
|
|
8
16
|
|
|
9
|
-
const dataset = datasets.find(
|
|
17
|
+
const dataset = datasets.find(_dataset => _dataset.qrveyid === column.qrveyid);
|
|
10
18
|
return getDatasetColumn(column, dataset);
|
|
11
19
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export * from './getColumnsLabel';
|
|
2
|
-
export * from './getDatasetByColumn';
|
|
3
2
|
export * from './getDatasetColumn';
|
|
4
|
-
export * from './
|
|
3
|
+
export * from './getDatasetColumnByDatasets';
|
|
5
4
|
export * from './getModelColumn';
|
|
6
5
|
export * from './isComplexColumn';
|
|
7
6
|
export * from './isDateColumn';
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
export * from './dateToHms';
|
|
2
|
+
export * from './dateToMdyDate';
|
|
3
|
+
export * from './dateToMonthYear';
|
|
4
|
+
export * from './dateToQuarterYear';
|
|
5
|
+
export * from './dateToWeekYear';
|
|
6
|
+
export * from './dateToYear';
|
|
1
7
|
export * from './mdyDateToDate';
|
|
2
8
|
export * from './monthYearToDate';
|
|
3
9
|
export * from './quarterYearToDate';
|
|
@@ -33,8 +33,9 @@ export function FDToLogic(filterData: IFSData): IFBLogic[] {
|
|
|
33
33
|
* @returns a filter logic array
|
|
34
34
|
*/
|
|
35
35
|
function getLogicBodyFromFD21(filterData: IFSData): IFBLogic[] {
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
if (isEmpty(filterData)) return [];
|
|
37
|
+
|
|
38
|
+
return filterData.scopes.reduce((logics: IFBLogic[], scope: IFSScope) => {
|
|
38
39
|
const logic: IFBLogic = buildLogic(scope);
|
|
39
40
|
let filters: IFBFilter[] = [];
|
|
40
41
|
if (scope.datasets.length > 0) {
|
|
@@ -45,9 +46,8 @@ function getLogicBodyFromFD21(filterData: IFSData): IFBLogic[] {
|
|
|
45
46
|
}
|
|
46
47
|
logics.push({ ...logic, filters });
|
|
47
48
|
return logics;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
49
|
+
}, [] as IFBLogic[]);
|
|
50
|
+
}
|
|
51
51
|
|
|
52
52
|
function buildLogic(scopeSection: IFSScope): IFBLogic {
|
|
53
53
|
return {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { filterNestedTree, _hasProperty } from "../../../general";
|
|
2
|
+
import { isEmpty } from "../../../general/mix/isEmpty";
|
|
3
|
+
import { IFBExpression } from "../../interfaces/backend/IFBExpression";
|
|
4
|
+
import { IFBLogic } from "../../interfaces/backend/IFBLogic";
|
|
5
|
+
import { IFFGetLogicByDatasets } from "../../interfaces/functions/IFFGetLogicByDatasets";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* [TODO: Add filterEmptyArrays to the filterNestedTree filter condition. Firstly, that function should accept this argument]
|
|
9
|
+
* Filters the logic by a qrveyids array
|
|
10
|
+
* If an qrveyid is not provided in the expression the filter passes normally
|
|
11
|
+
* @param logic The logic of the filter
|
|
12
|
+
* @param datasets The collection of qrveyids
|
|
13
|
+
* @returns a new filtered logic
|
|
14
|
+
*/
|
|
15
|
+
export function getLogicByDatasets(logic: IFBLogic[], datasets: string[] = [], settings?: IFFGetLogicByDatasets): IFBLogic[] {
|
|
16
|
+
if (isEmpty(logic)) return;
|
|
17
|
+
if (isEmpty(datasets)) return logic;
|
|
18
|
+
|
|
19
|
+
settings = getGetLogicByDatasetsSettings(settings);
|
|
20
|
+
|
|
21
|
+
return logic.map(_l => ({
|
|
22
|
+
..._l,
|
|
23
|
+
filters: filterNestedTree(_l.filters, 'expressions', (expression: IFBExpression) => {
|
|
24
|
+
const dataset = datasets.find(_data => _data === expression.qrveyid);
|
|
25
|
+
return (settings.letPassUndefinedProperties.qrveyid && !_hasProperty(expression, 'qrveyid')) || !isEmpty(dataset);
|
|
26
|
+
})
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function getGetLogicByDatasetsSettings(settings?: IFFGetLogicByDatasets): IFFGetLogicByDatasets {
|
|
31
|
+
return {
|
|
32
|
+
filterEmptyArrays: settings?.filterEmptyArrays ?? true,
|
|
33
|
+
letPassUndefinedProperties: {
|
|
34
|
+
qrveyid: settings?.letPassUndefinedProperties?.qrveyid ?? true
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { filterNestedTree } from "../../../general/array/filterNestedTree";
|
|
2
|
+
import { isEmpty } from "../../../general/mix/isEmpty";
|
|
3
|
+
import { _hasProperty } from "../../../general/object/hasProperty";
|
|
4
|
+
import { IDataset } from "../../../qrvey/interfaces/IDataset";
|
|
5
|
+
import { IFBExpression } from "../../interfaces/backend/IFBExpression";
|
|
6
|
+
import { IFBLogic } from "../../interfaces/backend/IFBLogic";
|
|
7
|
+
import { IFFGetLogicByDatasetsColumns } from "../../interfaces/functions/IFFGetLogicByDatasetsColumns";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @todo MODULE NO READY
|
|
11
|
+
* Filters the logic by a datasets array
|
|
12
|
+
* If an qrveyid is not provided in the expression a the filter passes normally
|
|
13
|
+
* @param logic The logic of the filter
|
|
14
|
+
* @param datasets The collection of datasets
|
|
15
|
+
* @returns a new filtered logic
|
|
16
|
+
*/
|
|
17
|
+
export function getLogicByDatasetsColumns(logic: IFBLogic[], datasets: IDataset[] = [], settings?: IFFGetLogicByDatasetsColumns): IFBLogic[] {
|
|
18
|
+
if (isEmpty(logic)) return;
|
|
19
|
+
if (isEmpty(datasets)) return logic;
|
|
20
|
+
|
|
21
|
+
settings = getGetLogicByDatasetsSettings(settings);
|
|
22
|
+
|
|
23
|
+
return logic.map(_l => ({
|
|
24
|
+
..._l,
|
|
25
|
+
filters: filterNestedTree(_l.filters, 'expressions', (expression: IFBExpression) => {
|
|
26
|
+
const letQrveyidPass = settings.letPassUndefinedProperties.qrveyid || _hasProperty(expression, 'qrveyid');
|
|
27
|
+
let letQuestionidPass = settings.letPassUndefinedProperties.questionid || _hasProperty(expression, 'questionid');
|
|
28
|
+
const dataset = letQrveyidPass ? datasets.find(_data => _data.qrveyid === expression.qrveyid) : undefined;
|
|
29
|
+
if (!isEmpty(dataset)) {
|
|
30
|
+
const column = letQuestionidPass ? (dataset.options || []).find(option => option.id === expression.questionid) : undefined;
|
|
31
|
+
letQuestionidPass = letQuestionidPass || !isEmpty(column);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return (letQrveyidPass && !isEmpty(dataset)) && letQuestionidPass;
|
|
35
|
+
})
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Gets the default settings for the getLogicByDatasetsColumn function
|
|
41
|
+
* @param settings the settings given by the implementer
|
|
42
|
+
* @returns an object with all properties set
|
|
43
|
+
*/
|
|
44
|
+
function getGetLogicByDatasetsSettings(settings?: IFFGetLogicByDatasetsColumns): IFFGetLogicByDatasetsColumns {
|
|
45
|
+
return {
|
|
46
|
+
filterEmptyArrays: settings?.filterEmptyArrays ?? true,
|
|
47
|
+
letPassUndefinedProperties: {
|
|
48
|
+
qrveyid: settings?.letPassUndefinedProperties?.qrveyid ?? true,
|
|
49
|
+
questionid: settings?.letPassUndefinedProperties?.questionid ?? true
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -6,6 +6,8 @@ export * from './getBackendGroupValue';
|
|
|
6
6
|
export * from './getBackendProperty';
|
|
7
7
|
export * from './getBackendValidator';
|
|
8
8
|
export * from './getBackendValues';
|
|
9
|
+
export * from './getLogicByDatasets';
|
|
10
|
+
export * from './getLogicByDatasetsColumns';
|
|
9
11
|
export * from './getLogicByScopes';
|
|
10
12
|
export * from './getLogicByScopesHierarchy';
|
|
11
13
|
// export * from './hasDatasetRelatedFilters';
|
|
@@ -45,7 +45,7 @@ export function excludeFiltersByParams(filterData: IFSData | IFUData, params: IF
|
|
|
45
45
|
values: (filter.values || []).map((value: IFValue) => {
|
|
46
46
|
if (Array.isArray(value) && value.length > 0) {
|
|
47
47
|
const rankingValues = value as IFSValueRanking[];
|
|
48
|
-
rankingValues.map(rValue => {
|
|
48
|
+
return rankingValues.map(rValue => {
|
|
49
49
|
if (params.enableds == null || params.enableds === rValue.enabled) return rValue;
|
|
50
50
|
}).filter(Boolean);
|
|
51
51
|
} else {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { isEmpty } from "../../../general/mix/isEmpty";
|
|
2
|
+
import { IDataset } from "../../../qrvey/interfaces/IDataset";
|
|
3
|
+
import { IFUData } from "../../interfaces/ui/IFUData";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Filtering the filters by the columns of datasets.
|
|
7
|
+
* Module specially for CLS.
|
|
8
|
+
* @param data the filter data
|
|
9
|
+
* @param datasets the collection of datasets and their columns
|
|
10
|
+
* @returns A new filter data with the filtered filters by columns
|
|
11
|
+
*/
|
|
12
|
+
export function getFiltersByDatasetsColumns(data: IFUData, datasets: IDataset[] = []): IFUData {
|
|
13
|
+
if (isEmpty(data) || isEmpty(data.scopes)) return;
|
|
14
|
+
if (isEmpty(datasets)) return data;
|
|
15
|
+
|
|
16
|
+
const newData = {
|
|
17
|
+
...data,
|
|
18
|
+
scopes: data.scopes.map(scope => ({
|
|
19
|
+
...scope,
|
|
20
|
+
datasets: scope.datasets.map(filterDataset => {
|
|
21
|
+
const dataset = datasets.find(_data => _data.qrveyid === filterDataset.qrveyid);
|
|
22
|
+
if (!isEmpty(dataset)) {
|
|
23
|
+
return {
|
|
24
|
+
...filterDataset,
|
|
25
|
+
filters: filterDataset.filters.map(filter => {
|
|
26
|
+
const column = (dataset.options || []).find(cInfo => cInfo.id === filter.column.id && cInfo.qrveyid === filter.column.qrveyid);
|
|
27
|
+
if (!isEmpty(column)) {
|
|
28
|
+
return { ...filter };
|
|
29
|
+
}
|
|
30
|
+
}).filter(Boolean)
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}).filter(dataset => !isEmpty(dataset) && dataset.filters.length > 0)
|
|
34
|
+
})).filter(scope => !isEmpty(scope) && scope.datasets.length > 0)
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
if (!isEmpty(newData) && newData.scopes.length > 0) {
|
|
38
|
+
return newData;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -8,6 +8,7 @@ export * from './getFilterColumnLabel';
|
|
|
8
8
|
export * from './getFilterid';
|
|
9
9
|
export * from './getFilterLabel';
|
|
10
10
|
export * from './getFiltersByAggregateColumn';
|
|
11
|
+
export * from './getFiltersByDatasetsColumns';
|
|
11
12
|
export * from './getFiltersByParams';
|
|
12
13
|
export * from './getFiltersByScopes';
|
|
13
14
|
export * from './getFiltersByScopesIds';
|
|
@@ -17,13 +17,13 @@ export function getAvailableScopes(config: IFSAvailableScope): IFSScopeID[] {
|
|
|
17
17
|
if (!isEmpty(config.predefinedScopes)) scopes = config.predefinedScopes;
|
|
18
18
|
scopes = [ ...scopes, { label: FILTER_SCOPE.GLOBAL, id: undefined } ];
|
|
19
19
|
|
|
20
|
-
if (config.tabid != null || config.pageid != null) {
|
|
20
|
+
if (config.tabid != null || config.pageid != null || config.panelid != null) {
|
|
21
21
|
if (config.pageid) scopes = [...scopes, { label: FILTER_SCOPE.PAGE, id: config.pageid }];
|
|
22
22
|
if (config.tabid) scopes = [ ...scopes, { label: FILTER_SCOPE.TAB, id: config.tabid }];
|
|
23
23
|
if (config.defaultid) scopes = [...scopes, { label: FILTER_SCOPE.DEFAULT, id: config.defaultid }];
|
|
24
|
-
scopes = [...scopes, { label: FILTER_SCOPE.CHART, id: config.tabid || config.pageid }];
|
|
25
|
-
} else {
|
|
26
|
-
|
|
24
|
+
if (config.panelid || config.tabid || config.pageid) scopes = [...scopes, { label: FILTER_SCOPE.CHART, id: config.panelid || config.tabid || config.pageid }];
|
|
25
|
+
} else if (config.defaultid) {
|
|
26
|
+
scopes = [...scopes, { label: FILTER_SCOPE.DEFAULT, id: config.defaultid }];
|
|
27
27
|
}
|
|
28
28
|
return scopes;
|
|
29
29
|
}
|
|
@@ -8,6 +8,7 @@ import { IFProperty } from "../IFProperty";
|
|
|
8
8
|
export interface IFBExpression {
|
|
9
9
|
enabled?: boolean; // True: The filter expression is applied; False: The filter expression is not applied.
|
|
10
10
|
groupValue?: IFProperty; // Date grouping for Date column filters
|
|
11
|
+
qrveyid?: string; // The Qrvey ID used in the expression
|
|
11
12
|
questionid?: string; // The Question/Column ID
|
|
12
13
|
questionType?: string; // The type of the Question/Column. Require if it is FORMULA OR BUCKET, otherwise is optional.
|
|
13
14
|
property?: IFProperty; // Properties for Complex Data types
|
|
@@ -10,6 +10,7 @@ export interface IFSAvailableScope {
|
|
|
10
10
|
qrveyid?: string; // Qrvey ID
|
|
11
11
|
tabid?: string; // Tab ID
|
|
12
12
|
pageid?: string; // Page ID
|
|
13
|
+
panelid?: string; // The ID for Panel Filters
|
|
13
14
|
defaultid?: string; // Default ID
|
|
14
15
|
predefinedScopes?: IFSScopeID[]; // Predefined Scopes
|
|
15
16
|
}
|
|
@@ -25,6 +25,10 @@ import { IFUFlattenedFilter } from '../interfaces/ui/IFUFlattenedFilter';
|
|
|
25
25
|
import { areStaticColumnValues } from '../../qrvey/helpers/areStaticColumnValues';
|
|
26
26
|
import { getValuesFromDataset } from '../helpers/common/getValuesFromDataset';
|
|
27
27
|
import { IFFiltersGetData } from '../interfaces/functions/IFFiltersGetData';
|
|
28
|
+
import { IFUData } from '../interfaces/ui/IFUData';
|
|
29
|
+
import { getDatasetByColumn } from '../../qrvey/helpers/getDatasetByColumn';
|
|
30
|
+
import { getLogicByDatasets } from '../helpers/backend/getLogicByDatasets';
|
|
31
|
+
import { getFiltersByParams } from '../helpers/common/getFiltersByParams';
|
|
28
32
|
|
|
29
33
|
|
|
30
34
|
interface IFilterApiConfig extends IFilterConfig {
|
|
@@ -74,7 +78,7 @@ export class FiltersApi {
|
|
|
74
78
|
column: config.filter?.column,
|
|
75
79
|
property: config.filter?.property,
|
|
76
80
|
lookupDisplay: config.filter?.lookupDisplayIndex,
|
|
77
|
-
dataset: config.
|
|
81
|
+
dataset: getDatasetByColumn(config.filter?.column, config.datasets),
|
|
78
82
|
value: config.valueText,
|
|
79
83
|
});
|
|
80
84
|
} else {
|
|
@@ -106,13 +110,15 @@ export class FiltersApi {
|
|
|
106
110
|
private getLogic(config: IFSGetDataValues) {
|
|
107
111
|
const scopes = this.getAvailableScopeIds(config);
|
|
108
112
|
let filterData = getFiltersByVisibility(config.filterData, scopes);
|
|
113
|
+
const dataset = config.datasets.find(d => d.qrveyid === config.filter?.column.qrveyid);
|
|
114
|
+
filterData = getFiltersByParams(filterData, { qrveyid: dataset.qrveyid }, { letPassUndefinedProperties: { filter: true }, filterEmptyArrays: { filter: false } }) as IFUData;
|
|
109
115
|
filterData = excludeFiltersByAggregateColumn(filterData);
|
|
110
116
|
const logics = FDToLogic(filterData);
|
|
111
117
|
const hierarchyLogic = getLogicByScopesHierarchy(logics, scopes, config.filter?.extras.scope);
|
|
112
118
|
|
|
113
119
|
return [
|
|
114
120
|
...hierarchyLogic,
|
|
115
|
-
...buildUserFilters(config.userFilters) || [],
|
|
121
|
+
...getLogicByDatasets(buildUserFilters(config.userFilters), isEmpty(dataset) ? [] : [dataset.qrveyid]) || [],
|
|
116
122
|
];
|
|
117
123
|
}
|
|
118
124
|
|
|
@@ -132,8 +138,10 @@ export class FiltersApi {
|
|
|
132
138
|
private getAvailableScopeIds(config: IFFiltersGetData): IFSScopeID[] {
|
|
133
139
|
return getAvailableScopes({
|
|
134
140
|
...getAvailableScopesIDsByConfig(config),
|
|
141
|
+
panelid: FILTER_SCOPE.CHART === config.filter?.extras.scope ? config.filter?.extras.scopeid : undefined,
|
|
142
|
+
scopeid: config.filter?.extras.scopeid,
|
|
135
143
|
qrveyid: config.filter?.column?.qrveyid,
|
|
136
|
-
defaultid:
|
|
144
|
+
defaultid: config.filter?.column?.qrveyid,
|
|
137
145
|
scope: undefined,
|
|
138
146
|
predefinedScopes: [
|
|
139
147
|
{ label: FILTER_SCOPE.DATA, id: config.filter?.column?.qrveyid }
|
|
@@ -30,7 +30,7 @@ function getI18nMonthLabel(label: string, translate?: II18nServiceTranslate): st
|
|
|
30
30
|
|
|
31
31
|
function getI18nYearMonthLabel(label: string, translate?: II18nServiceTranslate): string {
|
|
32
32
|
if (!isTokenLabel(label) && !isEmpty(translate)) {
|
|
33
|
-
const month = getI18nMonthPropertyByIndex(DATE_YEAR_MONTHS.findIndex(
|
|
33
|
+
const month = getI18nMonthPropertyByIndex(DATE_YEAR_MONTHS.findIndex(_month => _month === label));
|
|
34
34
|
if (!isEmpty(month)) label = translate('common.date_grouping.' + month + '_mmm');
|
|
35
35
|
}
|
|
36
36
|
return label;
|
|
@@ -11,6 +11,16 @@ export interface II18nChartBuilderStyleOptions {
|
|
|
11
11
|
chart_type_disabled_message: string;
|
|
12
12
|
comparision_color: string;
|
|
13
13
|
data_labels_check: string;
|
|
14
|
+
data_labels_clustering: string;
|
|
15
|
+
data_labels_format: string;
|
|
16
|
+
data_labels_position: string;
|
|
17
|
+
data_labels_position_inside: string;
|
|
18
|
+
data_labels_position_outside: string;
|
|
19
|
+
data_labels_show_as: string;
|
|
20
|
+
data_labels_show_as_category: string;
|
|
21
|
+
data_labels_show_as_percentage: string;
|
|
22
|
+
data_labels_show_as_placeholder: string;
|
|
23
|
+
data_labels_show_as_value: string;
|
|
14
24
|
default_format_title: string;
|
|
15
25
|
display_outliers_check: string;
|
|
16
26
|
line_opacity: string;
|
|
@@ -12,7 +12,7 @@ export const I18N_CHART_BUILDER_LAYER_OPTIONS: Pick<II18nChartBuilder, LayerOpti
|
|
|
12
12
|
type_logarithmic: 'Logarithmic',
|
|
13
13
|
type_moving_average_trendline: 'Moving Average Trendline',
|
|
14
14
|
type_polynomial: 'Polynomial',
|
|
15
|
-
type_standard_regression: '
|
|
15
|
+
type_standard_regression: 'Standard Regression',
|
|
16
16
|
intercept: 'Intercept',
|
|
17
17
|
slope: 'Slope',
|
|
18
18
|
legend: 'Trend Line'
|