@qrvey/utils 1.11.0-8 → 1.11.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.
Files changed (46) hide show
  1. package/README.md +2876 -2083
  2. package/dist/cjs/filters/helpers/common/getMergeFiltersSettings.js +7 -4
  3. package/dist/cjs/filters/helpers/common/mergeFilters.d.ts +9 -6
  4. package/dist/cjs/filters/helpers/common/mergeFilters.js +82 -43
  5. package/dist/cjs/filters/helpers/common/resolveScopeConditions.d.ts +2 -2
  6. package/dist/cjs/filters/helpers/common/resolveScopeConditions.js +2 -2
  7. package/dist/cjs/filters/helpers/getTokensFromFilters.js +6 -0
  8. package/dist/cjs/filters/interfaces/IFTokensFromFiltersSettings.d.ts +2 -0
  9. package/dist/cjs/filters/interfaces/functions/IFFiltersMergeFilters.d.ts +21 -2
  10. package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderCreateModal.d.ts +1 -0
  11. package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderErrorMessage.d.ts +6 -0
  12. package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderFunctionAnd.d.ts +9 -0
  13. package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderFunctionAnd.js +2 -0
  14. package/dist/cjs/globalization/interfaces/formula_builder/index.d.ts +1 -0
  15. package/dist/cjs/globalization/interfaces/formula_builder/index.js +1 -0
  16. package/dist/cjs/globalization/interfaces/panel/II18nPanelErrors.d.ts +1 -0
  17. package/dist/cjs/globalization/labels/chart_builder/I18N_CHART_BUILDER_GENERAL_OPTIONS.js +1 -1
  18. package/dist/cjs/globalization/labels/formula_builder/I18N_FORMULA_BUILDER.js +79 -1
  19. package/dist/cjs/globalization/labels/formula_builder/I18N_FORMULA_BUILDER_FUNCTION_AND.d.ts +2 -0
  20. package/dist/cjs/globalization/labels/formula_builder/I18N_FORMULA_BUILDER_FUNCTION_AND.js +13 -0
  21. package/dist/cjs/globalization/labels/formula_builder/index.d.ts +1 -0
  22. package/dist/cjs/globalization/labels/formula_builder/index.js +1 -0
  23. package/dist/cjs/globalization/labels/panel/I18N_PANEL.js +1 -0
  24. package/dist/filters/helpers/common/getMergeFiltersSettings.js +7 -4
  25. package/dist/filters/helpers/common/mergeFilters.d.ts +9 -6
  26. package/dist/filters/helpers/common/mergeFilters.js +82 -43
  27. package/dist/filters/helpers/common/resolveScopeConditions.d.ts +2 -2
  28. package/dist/filters/helpers/common/resolveScopeConditions.js +2 -2
  29. package/dist/filters/helpers/getTokensFromFilters.js +6 -0
  30. package/dist/filters/interfaces/IFTokensFromFiltersSettings.d.ts +2 -0
  31. package/dist/filters/interfaces/functions/IFFiltersMergeFilters.d.ts +21 -2
  32. package/dist/globalization/interfaces/formula_builder/II18nFormulaBuilderCreateModal.d.ts +1 -0
  33. package/dist/globalization/interfaces/formula_builder/II18nFormulaBuilderErrorMessage.d.ts +6 -0
  34. package/dist/globalization/interfaces/formula_builder/II18nFormulaBuilderFunctionAnd.d.ts +9 -0
  35. package/dist/globalization/interfaces/formula_builder/II18nFormulaBuilderFunctionAnd.js +1 -0
  36. package/dist/globalization/interfaces/formula_builder/index.d.ts +1 -0
  37. package/dist/globalization/interfaces/formula_builder/index.js +1 -0
  38. package/dist/globalization/interfaces/panel/II18nPanelErrors.d.ts +1 -0
  39. package/dist/globalization/labels/chart_builder/I18N_CHART_BUILDER_GENERAL_OPTIONS.js +1 -1
  40. package/dist/globalization/labels/formula_builder/I18N_FORMULA_BUILDER.js +79 -1
  41. package/dist/globalization/labels/formula_builder/I18N_FORMULA_BUILDER_FUNCTION_AND.d.ts +2 -0
  42. package/dist/globalization/labels/formula_builder/I18N_FORMULA_BUILDER_FUNCTION_AND.js +10 -0
  43. package/dist/globalization/labels/formula_builder/index.d.ts +1 -0
  44. package/dist/globalization/labels/formula_builder/index.js +1 -0
  45. package/dist/globalization/labels/panel/I18N_PANEL.js +1 -0
  46. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import { isEmpty } from "../../../general/mix/isEmpty";
2
- import { cloneDeep } from "../../../general/object/cloneDeep";
3
- import { FILTER_GROUPED_COLUMN_OPERATOR } from "../../constants/common/FILTER_GROUPED_COLUMN_OPERATOR";
2
+ import { mergeDeep } from "../../../general/object/mergeDeep";
3
+ import { objectCopy } from "../../../general/object/objectCopy";
4
4
  import { getFilterid } from "./getFilterid";
5
5
  import { getMergeFiltersSettings } from "./getMergeFiltersSettings";
6
6
  import { mergeValues } from "./mergeValues";
@@ -8,13 +8,17 @@ import { resolveDatasetConditions } from "./resolveDatasetConditions";
8
8
  import { resolveFilterConditions } from "./resolveFilterConditions";
9
9
  import { resolveScopeConditions } from "./resolveScopeConditions";
10
10
  /**
11
- * Merge filter data structures in a new one. The first Filter Data passed in the argument has the priority
12
- * @param filterData1 The target filter data
13
- * @param filterData2 the filter data to be merged
14
- * @param settings configuration of the mergeFilter
15
- * @returns a new filter data structure
11
+ * Merges the second filter data into the first one; the first Filter Data passed in the argument has the priority.
12
+ * Conditions:
13
+ * - If the info in the second filter data does not exist in the first one, the info will be added
14
+ * - If the info in the second filter data exists in the first one, the info will be merged
15
+ * @param {IFUData} filterData1 The target filter data
16
+ * @param {IFUData} filterData2 the filter data to be merged
17
+ * @param {IFFiltersMergeFilters} settings configuration of the mergeFilters
18
+ * @returns {IFUData} a new filter data structure
16
19
  */
17
20
  export function mergeFilters(filterData1, filterData2, settings) {
21
+ var _a;
18
22
  if (isEmpty(filterData1) || isEmpty(filterData1.scopes)) {
19
23
  if (isEmpty(filterData2) || isEmpty(filterData2.scopes))
20
24
  return;
@@ -22,22 +26,28 @@ export function mergeFilters(filterData1, filterData2, settings) {
22
26
  }
23
27
  if (isEmpty(filterData2) || isEmpty(filterData2.scopes))
24
28
  return filterData1;
25
- const _filterData1 = cloneDeep(filterData1);
26
- const _filterData2 = cloneDeep(filterData2);
29
+ const newFilterData1 = objectCopy(filterData1);
30
+ const newFilterData2 = objectCopy(filterData2);
27
31
  const defaultSettings = getMergeFiltersSettings(settings);
28
- return {
29
- enabled: _filterData1.enabled,
30
- scopes: mergeScopes(_filterData1.scopes, _filterData2.scopes, defaultSettings),
31
- section: _filterData1.section,
32
- version: _filterData1.version,
33
- };
32
+ const scopes = mergeScopes(newFilterData1.scopes, newFilterData2.scopes, defaultSettings);
33
+ if (defaultSettings.mergeFilterDataProps) {
34
+ return {
35
+ enabled: (_a = newFilterData2.enabled) !== null && _a !== void 0 ? _a : newFilterData1.enabled,
36
+ section: newFilterData2.section || newFilterData1.section,
37
+ scopes,
38
+ version: newFilterData2.version || newFilterData1.version,
39
+ };
40
+ }
41
+ return Object.assign(Object.assign({}, newFilterData1), { scopes });
34
42
  }
35
43
  /**
36
- * Gets a new scope structure array by merging two scope structures
37
- * @param scopes1 the target scope structure
38
- * @param scopes2 the scope to be merged
39
- * @param settings configuration of the mergeFilter
40
- * @returns a new scope structure array
44
+ * Gets a new scope array structure by merging both scope structures
45
+ * - If the info in the second scope does not exist in the first one, the scope will be added
46
+ * - If the info in the second scope exists in the first one, the scope will be merged
47
+ * @param {IFUScope[]} scopes1 the target scope structure
48
+ * @param {IFUScope[]} scopes2 the scope to be merged
49
+ * @param {IFFiltersMergeFilters} settings configuration of the mergeFilters
50
+ * @returns {IFUScope[]} a new scope array structure
41
51
  */
42
52
  function mergeScopes(scopes1 = [], scopes2 = [], settings) {
43
53
  let newScopes = scopes1.reduce((scopes, scope1) => {
@@ -47,7 +57,7 @@ function mergeScopes(scopes1 = [], scopes2 = [], settings) {
47
57
  }));
48
58
  let _scope1 = scope1;
49
59
  if (scope2Index > -1) {
50
- _scope1 = Object.assign(Object.assign({}, scopes2[scope2Index]), { datasets: mergeDatasets(scope1.datasets, scopes2[scope2Index].datasets, settings) });
60
+ _scope1 = Object.assign(Object.assign({}, mergeScopeProps(scope1, scopes2[scope2Index], settings)), { datasets: mergeDatasets(scope1.datasets, scopes2[scope2Index].datasets, settings) });
51
61
  scopes2.splice(scope2Index, 1);
52
62
  }
53
63
  scopes.push(_scope1);
@@ -58,11 +68,13 @@ function mergeScopes(scopes1 = [], scopes2 = [], settings) {
58
68
  return newScopes;
59
69
  }
60
70
  /**
61
- * Gets a new dataset structure array by merging two dataset structures
62
- * @param datasets1 the target dataset structure
63
- * @param datasets2 the dataset to be merged
64
- * @param settings configuration of the mergeFilter
65
- * @returns a new dataset structure array
71
+ * Gets a new dataset structure array by merging both dataset structures
72
+ * - If the info in the second dataset does not exist in the first one, the dataset will be added
73
+ * - If the info in the second dataset exists in the first one, the dataset will be merged
74
+ * @param {IFUDataset[]} datasets1 the target dataset structure
75
+ * @param {IFUDataset[]} datasets2 the dataset to be merged
76
+ * @param {IFFiltersMergeFilters} settings configuration of the mergeFilter
77
+ * @returns {IFUDataset[]} a new dataset structure array
66
78
  */
67
79
  function mergeDatasets(datasets1 = [], datasets2 = [], settings) {
68
80
  let newDatasets = datasets1.reduce((datasets, dataset1) => {
@@ -71,7 +83,7 @@ function mergeDatasets(datasets1 = [], datasets2 = [], settings) {
71
83
  }));
72
84
  let _dataset1 = dataset1;
73
85
  if (dataset2Index > -1) {
74
- _dataset1 = Object.assign(Object.assign({}, datasets2[dataset2Index]), { filters: mergeFilterss(dataset1.filters, datasets2[dataset2Index].filters, settings) });
86
+ _dataset1 = Object.assign(Object.assign({}, mergeDatasetProps(dataset1, datasets2[dataset2Index], settings)), { filters: mergeFilterss(dataset1.filters, datasets2[dataset2Index].filters, settings) });
75
87
  datasets2.splice(dataset2Index, 1);
76
88
  }
77
89
  datasets.push(_dataset1);
@@ -83,10 +95,10 @@ function mergeDatasets(datasets1 = [], datasets2 = [], settings) {
83
95
  }
84
96
  /**
85
97
  * Gets a new filter structure array by merging two filter structures
86
- * @param filters1 the target filter structure
87
- * @param filters2 the filter to be merged
88
- * @param settings configuration of the mergeFilter
89
- * @returns a new filter structure array
98
+ * @param {IFUFilter[]} filters1 the target filter structure
99
+ * @param {IFUFilter[]} filters2 the filter to be merged
100
+ * @param {IFFiltersMergeFilters} settings configuration of the mergeFilters
101
+ * @returns {IFUFilter[]} a new filter structure array
90
102
  */
91
103
  function mergeFilterss(filters1 = [], filters2 = [], settings) {
92
104
  let newFilters = filters1.reduce((filters, filter1) => {
@@ -99,14 +111,11 @@ function mergeFilterss(filters1 = [], filters2 = [], settings) {
99
111
  }));
100
112
  let _filter1 = filter1;
101
113
  if (filter2Index > -1) {
102
- _filter1 = Object.assign(Object.assign({}, _filter1), { values: mergeValues(_filter1, filters2[filter2Index], settings) });
103
- _filter1 = mergeFilterProps(_filter1, filters2[filter2Index], settings);
114
+ _filter1 = Object.assign(Object.assign(Object.assign({}, _filter1), mergeFilterProps(_filter1, filters2[filter2Index], settings)), { values: mergeValues(_filter1, filters2[filter2Index], settings) });
104
115
  filters2.splice(filter2Index, 1);
105
116
  }
106
- else {
107
- _filter1 = Object.assign(Object.assign({}, _filter1), { operator: settings.setGroupedColumnOperator
108
- ? FILTER_GROUPED_COLUMN_OPERATOR
109
- : _filter1.operator });
117
+ else if (!isEmpty(settings.setGroupedColumnOperator)) {
118
+ _filter1.operator = settings.setGroupedColumnOperator;
110
119
  }
111
120
  _filter1.filterid = getFilterid(_filter1);
112
121
  filters.push(_filter1);
@@ -117,17 +126,47 @@ function mergeFilterss(filters1 = [], filters2 = [], settings) {
117
126
  return newFilters;
118
127
  }
119
128
  /**
120
- * Gets a new filter structure when the setting is configured
121
- * @param filter1 the target filter structure
122
- * @param filter2 the filter to be used to merge the values
123
- * @param settings configuration of the mergeFilter
129
+ * Gets a new scope structure for the configured settings
130
+ * @param {IFUScope} scope1 the target scope structure
131
+ * @param {IFUScope} scope2 the scope to be used to merge the values
132
+ * @param {IFFiltersMergeFilters} settings configuration of the mergeFilters
133
+ * @returns {IFUScope} a new filter structure with overwritted props
134
+ */
135
+ function mergeScopeProps(scope1, scope2, settings) {
136
+ var _a, _b, _c;
137
+ let _scope1 = scope1;
138
+ if (settings.mergeScopeProps) {
139
+ _scope1 = Object.assign(Object.assign({}, scope1), { collapsed: (_a = scope2.collapsed) !== null && _a !== void 0 ? _a : scope1.collapsed, displayed: (_b = scope2.displayed) !== null && _b !== void 0 ? _b : scope1.displayed, enabled: (_c = scope2.enabled) !== null && _c !== void 0 ? _c : scope1.enabled, label: scope2.label || scope1.label, scope: scope2.scope || scope1.scope, scopeid: scope2.scopeid || scope1.scopeid });
140
+ }
141
+ return _scope1;
142
+ }
143
+ /**
144
+ * Gets a new dataset structure for the configured settings
145
+ * @param {IFUDataset} dataset1 the target dataset structure
146
+ * @param {IFUDataset} dataset2 the dataset to be used to merge the values
147
+ * @param {IFFiltersMergeFilters} settings configuration of the mergeFilters
148
+ * @returns {IFUDataset} a new filter structure with overwritted props
149
+ */
150
+ function mergeDatasetProps(dataset1, dataset2, settings) {
151
+ var _a, _b, _c;
152
+ let _dataset1 = dataset1;
153
+ if (settings.mergeDatasetProps) {
154
+ _dataset1 = Object.assign(Object.assign({}, dataset1), { collapsed: (_a = dataset2.collapsed) !== null && _a !== void 0 ? _a : dataset1.collapsed, displayed: (_b = dataset2.displayed) !== null && _b !== void 0 ? _b : dataset1.displayed, enabled: (_c = dataset2.enabled) !== null && _c !== void 0 ? _c : dataset1.enabled, label: dataset2.label || dataset1.label, qrveyid: dataset2.qrveyid || dataset1.qrveyid });
155
+ }
156
+ return _dataset1;
157
+ }
158
+ /**
159
+ * Gets a new filter structure for the configured settings
160
+ * @param {IFUFilter} filter1 the target filter structure
161
+ * @param {IFUFilter} filter2 the filter to be used to merge the values
162
+ * @param {IFFiltersMergeFilters} settings configuration of the mergeFilters
124
163
  * @returns a new filter structure with overwritted props
125
164
  */
126
165
  function mergeFilterProps(filter1, filter2, settings) {
127
166
  var _a, _b, _c;
128
167
  let _filter1 = filter1;
129
- if (settings.overwriteFilterProps) {
130
- _filter1 = Object.assign(Object.assign({}, filter1), { collapsed: (_a = filter2.collapsed) !== null && _a !== void 0 ? _a : filter1.collapsed, displayed: (_b = filter2.displayed) !== null && _b !== void 0 ? _b : filter1.displayed, dateSection: filter2.dateSection, extras: filter2.extras, enabled: (_c = filter2.enabled) !== null && _c !== void 0 ? _c : filter1.enabled, operator: filter2.operator || filter1.operator, filterid: filter2.filterid, lookupDisplayIndex: filter2.lookupDisplayIndex, nullValues: filter2.nullValues, selectAll: filter2.selectAll });
168
+ if (settings.mergeFilterProps) {
169
+ _filter1 = Object.assign(Object.assign({}, filter1), { collapsed: (_a = filter2.collapsed) !== null && _a !== void 0 ? _a : filter1.collapsed, column: mergeDeep(filter2.column, filter1.column), displayed: (_b = filter2.displayed) !== null && _b !== void 0 ? _b : filter1.displayed, dateSection: filter2.dateSection, extras: filter2.extras, enabled: (_c = filter2.enabled) !== null && _c !== void 0 ? _c : filter1.enabled, lookupDisplayIndex: filter2.lookupDisplayIndex, nullValues: filter2.nullValues, property: filter2.property || filter1.property, operator: filter2.operator || filter1.operator, selectAll: filter2.selectAll, validator: filter2.validator || filter1.validator });
131
170
  }
132
171
  return _filter1;
133
172
  }
@@ -4,8 +4,8 @@ import { IFSScope } from "../../interfaces/common/IFSScope";
4
4
  * Resolves the conditions by given params
5
5
  * @param filter The filter scope structure
6
6
  * @param params given parameters to validate the filter
7
- * @param letPassUndefinedProperties Flag to avoid applying the condition when the filter properties are undefined
8
- * @param letPassUndefinedParams Flag to avoid applying the condition when the param properties are explicit undefined.
7
+ * @param letPassUndefinedProperties Flag to avoid applying the condition when the properties of the properties are undefined
8
+ * @param letPassUndefinedParams Flag to avoid applying the condition when the properties of the params are explicit undefined.
9
9
  * @returns true: the condition is satisfied
10
10
  */
11
11
  export declare function resolveScopeConditions(scope: IFSScope, params: IFSParamsToGetFilter, letPassUndefinedProperties?: boolean, letPassUndefinedParams?: boolean): boolean;
@@ -4,8 +4,8 @@ import { _hasProperty } from "../../../general/object/hasProperty";
4
4
  * Resolves the conditions by given params
5
5
  * @param filter The filter scope structure
6
6
  * @param params given parameters to validate the filter
7
- * @param letPassUndefinedProperties Flag to avoid applying the condition when the filter properties are undefined
8
- * @param letPassUndefinedParams Flag to avoid applying the condition when the param properties are explicit undefined.
7
+ * @param letPassUndefinedProperties Flag to avoid applying the condition when the properties of the properties are undefined
8
+ * @param letPassUndefinedParams Flag to avoid applying the condition when the properties of the params are explicit undefined.
9
9
  * @returns true: the condition is satisfied
10
10
  */
11
11
  export function resolveScopeConditions(scope, params, letPassUndefinedProperties = false, letPassUndefinedParams = true) {
@@ -3,6 +3,7 @@ import { getFilterPropertyLabel } from "./ui/getFilterPropertyLabel";
3
3
  import { FILTER_TOKENS_STRUCTURE_TYPE } from "../constants/common/FILTER_TOKENS_STRUCTURE_TYPE";
4
4
  import { isEmpty } from "../../general/mix/isEmpty";
5
5
  import { FILTER_SCOPE } from "../constants";
6
+ import { transformFilterValues } from "./ui/transformFilterValues";
6
7
  /**
7
8
  * It takes a filter object and returns an array of tokens that represent the filter
8
9
  * @param {IFUData} filters - The filters object.
@@ -17,6 +18,10 @@ export function getTokensFromFilters(filters, options) {
17
18
  translate: i18nService.translate.bind(i18nService),
18
19
  addEnableds: true,
19
20
  };
21
+ const settingsTransform = {
22
+ i18n: options === null || options === void 0 ? void 0 : options.i18n,
23
+ translate: i18nService.translate.bind(i18nService),
24
+ };
20
25
  const getValue = (valueItem) => {
21
26
  var _a, _b;
22
27
  if (valueItem.value) {
@@ -56,6 +61,7 @@ export function getTokensFromFilters(filters, options) {
56
61
  }
57
62
  continue;
58
63
  }
64
+ filter.values = transformFilterValues(filter, settingsTransform);
59
65
  const values = getUIValues(filter, settings);
60
66
  if (!thereIsFiltersWithValues)
61
67
  thereIsFiltersWithValues = true;
@@ -1,7 +1,9 @@
1
+ import { II18nConfig } from "../../globalization";
1
2
  import { I18nService } from "../../globalization/service/i18nextBuilder";
2
3
  export interface IFTokensFromFiltersSettings {
3
4
  showScope?: boolean;
4
5
  showDatabaseName?: boolean;
5
6
  showChartName?: boolean;
6
7
  i18nService: I18nService;
8
+ i18n?: II18nConfig;
7
9
  }
@@ -1,8 +1,27 @@
1
+ import { IFOperator } from "../IFOperator";
1
2
  import { IFFiltersMergeValues } from "./IFFiltersMergeValues";
2
3
  /**
3
4
  * Structure for MergeFilters property settings
4
5
  */
5
6
  export interface IFFiltersMergeFilters extends IFFiltersMergeValues {
6
- overwriteFilterProps?: boolean;
7
- setGroupedColumnOperator?: boolean;
7
+ /**
8
+ * Flag to merge second filter data props to first one
9
+ */
10
+ mergeFilterDataProps?: boolean;
11
+ /**
12
+ * Flag to merge second scope props to first one
13
+ */
14
+ mergeScopeProps?: boolean;
15
+ /**
16
+ * Flag to merge second dataset props to first one
17
+ */
18
+ mergeDatasetProps?: boolean;
19
+ /**
20
+ * Flag to merge second filter props to first one
21
+ */
22
+ mergeFilterProps?: boolean;
23
+ /**
24
+ * Whet setting, the operator is overwritten on new added filters
25
+ */
26
+ setGroupedColumnOperator?: IFOperator;
8
27
  }
@@ -54,6 +54,7 @@ export interface II18nFormulaBuilderCreateModal {
54
54
  output: string;
55
55
  output_result: string;
56
56
  output_case: string;
57
+ output_invalid_column: string;
57
58
  randomize_data: string;
58
59
  randomize_data_tooltip: string;
59
60
  console_output_title: string;
@@ -13,6 +13,7 @@ export interface II18nFormulaBuilderErrorMessage {
13
13
  UNKNOWN: string;
14
14
  TOO_MANY_ARGUMENTS: string;
15
15
  DATE_DIF_UNIT_PARAM: string;
16
+ INVALID_ALLOW_VALUE: string;
16
17
  UNKNOWN_EXPRESSION: string;
17
18
  NOT_ALLOWED_EXPRESSION: string;
18
19
  OUT_OF_RANGE: string;
@@ -23,4 +24,9 @@ export interface II18nFormulaBuilderErrorMessage {
23
24
  MISSING_COLUMN_EXPRESSION: string;
24
25
  NO_COLUMN_EXPRESSION: string;
25
26
  ARGUMENTS_DATATYPE_ERROR: string;
27
+ FUNCTION_ARGUMENTS_MISMATCH: string;
28
+ NOT_ALLOWED_OPERATION: string;
29
+ NOT_ALLOWED_OPERATION_DIFFERENT_TYPES: string;
30
+ NOT_ALLOWED_OPERATION_MISSING_OPERATOR: string;
31
+ GREATER_THAN: string;
26
32
  }
@@ -0,0 +1,9 @@
1
+ import { II18nFormulaBuilderFunction } from "./II18nFormulaBuilderFunction";
2
+ export interface II18nFormulaBuilderFunctionAnd extends II18nFormulaBuilderFunction {
3
+ param_logicalTest1_name: string;
4
+ param_logicalTest1_description: string;
5
+ param_logicalTest2_name: string;
6
+ param_logicalTest2_description: string;
7
+ param_logicalTestn_name: string;
8
+ param_logicalTestn_description: string;
9
+ }
@@ -57,3 +57,4 @@ export * from "./II18nFormulaBuilderFunctionAggMax";
57
57
  export * from "./II18nFormulaBuilderFunctionAggDistinctcount";
58
58
  export * from "./II18nFormulaBuilderFunctionAggCount";
59
59
  export * from "./II18nFormulaBuilderErrorMessage";
60
+ export * from "./II18nFormulaBuilderFunctionAnd";
@@ -57,3 +57,4 @@ export * from "./II18nFormulaBuilderFunctionAggMax";
57
57
  export * from "./II18nFormulaBuilderFunctionAggDistinctcount";
58
58
  export * from "./II18nFormulaBuilderFunctionAggCount";
59
59
  export * from "./II18nFormulaBuilderErrorMessage";
60
+ export * from "./II18nFormulaBuilderFunctionAnd";
@@ -5,6 +5,7 @@ export interface II18nPanelErrors {
5
5
  continuous_time_limit: string;
6
6
  drilldown_unavailable: string;
7
7
  invalid_data_for_chart: string;
8
+ invalid_data_log_scale: string;
8
9
  longer_available_panel: string;
9
10
  long_text: string;
10
11
  missing_column: string;
@@ -32,7 +32,7 @@ export const I18N_CHART_BUILDER_GENERAL_OPTIONS = {
32
32
  select_column_placeholder: "Select column",
33
33
  display_values: "Display Values As",
34
34
  display_values_placeholder: "Select aggregate",
35
- display_values_multiples: "When multiples values display",
35
+ display_values_multiples: "When multiple values display",
36
36
  display_values_multiples_placeholder: "Select display Type",
37
37
  values_format: "Values Format",
38
38
  remove: "Remove",
@@ -1,3 +1,4 @@
1
+ import { I18N_FORMULA_BUILDER_FUNCTION_AND } from "./I18N_FORMULA_BUILDER_FUNCTION_AND";
1
2
  export const I18N_FORMULA_BUILDER = {
2
3
  list_modal: {
3
4
  create_button: "Create Formula",
@@ -79,6 +80,7 @@ export const I18N_FORMULA_BUILDER = {
79
80
  output: "Output",
80
81
  output_case: "Test Case",
81
82
  output_result: "Result",
83
+ output_invalid_column: "Invalid column name.",
82
84
  randomize_data: "Randomize data",
83
85
  randomize_data_tooltip: "Refresh the testing data with random data from the dataset.",
84
86
  console_output_title: "Console Output",
@@ -177,6 +179,76 @@ export const I18N_FORMULA_BUILDER = {
177
179
  param_replacement_name: "replacement",
178
180
  param_replacement_description: "The value that will replace the null value. It must have the same data type as the column.",
179
181
  },
182
+ dateadd: {
183
+ description: "Adds a specific date part value to a given date.",
184
+ function_placeholder: 'DATEADD(date_value1, "date_part", interval_value)',
185
+ param_date_value1_name: "date_value1",
186
+ param_date_value1_description: 'Date value for which you will get the weekday. It can be a column or a datetime value entered with a format of either "MM/DD/YYYY" or "MM/DD/YYYY HH:MM:SS".',
187
+ param_date_part_name: "date_part",
188
+ param_date_part_description: 'Date part allows: "Y" for years, "M" for months, "D" for days, "H" for hours, "MI" for minutes and "S" for seconds.',
189
+ param_interval_value_name: "interval_value",
190
+ param_interval_value_description: "Number of units of the selected date part that you want to add to the given date.",
191
+ },
192
+ dayofweek: {
193
+ description: "Returns a number or string representative of the weekday for a given date.",
194
+ function_placeholder: "DAYOFWEEK(date_value1, day_name)",
195
+ param_date_value1_name: "date_value1",
196
+ param_date_value1_description: 'Date value to which you will add the date part value. It can be a column or a datetime value entered with a format of either "MM/DD/YYYY" or "MM/DD/YYYY HH:MM:SS".',
197
+ param_day_name_name: "day_name",
198
+ param_day_name_description: 'If set equal to "Day" it will return the name of the day of the week, if set to "D" it will return a number from 1 to 7; if not set, it will also return a number from 1 to 7. 1=Sunday, 2=Monday, 3=Tuesday, 4=Wednesday, 5=Thursday, 6=Friday, 7=Saturday.',
199
+ },
200
+ trim: {
201
+ description: "Removes all leading and trailing spaces from text.",
202
+ function_placeholder: "TRIM(string1)",
203
+ param_string1_name: "string1",
204
+ param_string1_description: "Text to trim.",
205
+ },
206
+ concatenate: {
207
+ description: "Joins two or more strings into one string.",
208
+ function_placeholder: "CONCATENATE(string1,string2,...stringn)",
209
+ param_string1_name: "string1 (required)",
210
+ param_string1_description: "The first text to join.",
211
+ param_string2_name: "string2 (required)",
212
+ param_string2_description: "The second text to join.",
213
+ param_stringn_name: "stringn (optional)",
214
+ param_stringn_description: "Additional text items to join.",
215
+ },
216
+ left: {
217
+ description: "Returns the first character or characters in a text string, based on the number of characters you specify.",
218
+ function_placeholder: "LEFT(string1, num_chars)",
219
+ param_string1_name: "string1 (required)",
220
+ param_string1_description: "The text with characters to extract.",
221
+ param_num_chars_name: "num_chars (optional)",
222
+ param_num_chars_description: "Number of characters you want to extract. It has to be an integer greater than or equal to zero. If not defined, LEFT will return one character.",
223
+ },
224
+ right: {
225
+ description: "Returns the last character or characters in a text string, based on the number of characters you specify.",
226
+ function_placeholder: "RIGHT(string1, num_chars)",
227
+ param_string1_name: "string1 (required)",
228
+ param_string1_description: "The text with characters to extract.",
229
+ param_num_chars_name: "num_chars (optional)",
230
+ param_num_chars_description: "Number of characters you want to extract. It has to be an integer greater than or equal to zero. If not defined, RIGHT will return one character.",
231
+ },
232
+ upper: {
233
+ description: "Converts all the characters in a string to uppercase.",
234
+ function_placeholder: "UPPER(string1)",
235
+ param_string1_name: "string1",
236
+ param_string1_description: "The text you want converted to uppercase.",
237
+ },
238
+ lower: {
239
+ description: "Converts all the characters in a string to lowercase.",
240
+ function_placeholder: "LOWER(string1)",
241
+ param_string1_name: "string1",
242
+ param_string1_description: "The text you want converted to lowercase.",
243
+ },
244
+ proper: {
245
+ description: "Capitalizes the first letter in a string and any other letters in the text placed next to any character other than a letter or number. Converts the rest of the letters to lowercase.",
246
+ function_placeholder: "PROPER(string1)",
247
+ param_string1_name: "string1",
248
+ param_string1_description: "The text you want converted.",
249
+ },
250
+ and: Object.assign({}, I18N_FORMULA_BUILDER_FUNCTION_AND),
251
+ or: Object.assign(Object.assign({}, I18N_FORMULA_BUILDER_FUNCTION_AND), { description: "Evaluates different logical tests and returns false if all logical tests are false and true if at least one of the logical tests returns true.", function_placeholder: "OR(logicalTest1,logicalTest2,...logicalTestn)" }),
180
252
  },
181
253
  editor: {
182
254
  error_messages: {
@@ -193,7 +265,7 @@ export const I18N_FORMULA_BUILDER = {
193
265
  UNKNOWN_FUNCTION: "Unknown function",
194
266
  UNKNOWN: "Unknown error",
195
267
  TOO_MANY_ARGUMENTS: "Too many arguments",
196
- DATE_DIF_UNIT_PARAM: 'Unit param have to be equal to: "Y", "M", "D"',
268
+ DATE_DIF_UNIT_PARAM: "Argument {{i18n.function.argument.position}} has to be {{i18n.function.argument.datedif_unit}}",
197
269
  UNKNOWN_EXPRESSION: "Unknown expression",
198
270
  NOT_ALLOWED_EXPRESSION: "Expression not allowed",
199
271
  OUT_OF_RANGE: "Expression out of range",
@@ -204,6 +276,12 @@ export const I18N_FORMULA_BUILDER = {
204
276
  MISSING_COLUMN_EXPRESSION: "Argument should be a column.",
205
277
  NO_COLUMN_EXPRESSION: "Argument cannot be a column.",
206
278
  ARGUMENTS_DATATYPE_ERROR: "Arguments should have the same data type.",
279
+ FUNCTION_ARGUMENTS_MISMATCH: "{{i18n.function.name}} function is expecting {{i18n.function.input}} and is receiving {{i18n.function.received}}",
280
+ NOT_ALLOWED_OPERATION: "Expression not allowed. Allowed operators between {{i18n.function.expression.types}}: {{i18n.function.expression.operators}}",
281
+ NOT_ALLOWED_OPERATION_DIFFERENT_TYPES: "Expression not allowed {{i18n.function.expression.value}}",
282
+ NOT_ALLOWED_OPERATION_MISSING_OPERATOR: "Expression not allowed. Missing operator",
283
+ GREATER_THAN: "Argument {{i18n.function.argument.position}} has to be greater or equal than {{i18n.function.argument.greater_than}}",
284
+ INVALID_ALLOW_VALUE: "Argument {{i18n.function.argument.position}} has to be {{i18n.function.argument.allow_value}}",
207
285
  },
208
286
  },
209
287
  },
@@ -0,0 +1,2 @@
1
+ import { II18nFormulaBuilderFunctionAnd } from "../../interfaces";
2
+ export declare const I18N_FORMULA_BUILDER_FUNCTION_AND: II18nFormulaBuilderFunctionAnd;
@@ -0,0 +1,10 @@
1
+ export const I18N_FORMULA_BUILDER_FUNCTION_AND = {
2
+ description: "Evaluates different logical tests and returns true if all logical tests are true and false if at least one of the logical tests returns false. ",
3
+ function_placeholder: "AND(logicalTest1,logicalTest2,...logicalTestn)",
4
+ param_logicalTest1_name: "logicalTest1 (required)",
5
+ param_logicalTest1_description: "Logical test between two values, it should include logical operators such as =, >, <, >=, <= or <>. This argument can also be anything that returns a boolean value.",
6
+ param_logicalTest2_name: "logicalTest2 (required)",
7
+ param_logicalTest2_description: "Logical test between two values, it should include logical operators such as =, >, <, >=, <= or <>. This argument can also be anything that returns a boolean value.",
8
+ param_logicalTestn_name: "logicalTestn (optional)",
9
+ param_logicalTestn_description: "Logical test between two values, it should include logical operators such as =, >, <, >=, <= or <>. This argument can also be anything that returns a boolean value.",
10
+ };
@@ -1 +1,2 @@
1
1
  export * from "./I18N_FORMULA_BUILDER";
2
+ export * from "./I18N_FORMULA_BUILDER_FUNCTION_AND";
@@ -1 +1,2 @@
1
1
  export * from "./I18N_FORMULA_BUILDER";
2
+ export * from "./I18N_FORMULA_BUILDER_FUNCTION_AND";
@@ -13,6 +13,7 @@ export const I18N_PANEL = {
13
13
  continuous_time_limit: "The combination of data used in this chart exceeds the maximum number of data points that the system can return.<br><br>We recommend you try:<br>• Using a <i>Time Grouping</i> that returns less data<br>• Using another chart visualization<br>• Switching to Discrete Values",
14
14
  drilldown_unavailable: "No data found with drilldown.",
15
15
  invalid_data_for_chart: "No valid data for this chart.",
16
+ invalid_data_log_scale: "The data contains 0 or negative values and cannot be plotted in logarithmic scale.",
16
17
  longer_available_panel: "This panel is no longer available.",
17
18
  long_text: "long-text",
18
19
  max_buckets_limit: "The combination of data used in this chart exceeds the maximum number of aggregation buckets allowed in a single response.<br><br>To fix this issue, try the following:<br>• <i>Filter</i> your data<br>• Apply a <i>Date Grouping</i> that returns less data<br>• Use another chart visualization",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qrvey/utils",
3
- "version": "1.11.0-8",
3
+ "version": "1.11.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",