@qrvey/utils 1.15.0 → 1.16.0-1

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 (27) hide show
  1. package/dist/cjs/dates/constants/DATE_DISTINCT_PROPERTY.d.ts +2 -1
  2. package/dist/cjs/dates/constants/DATE_DISTINCT_PROPERTY.js +1 -0
  3. package/dist/cjs/globalization/helpers/getI18nDateGroupLabel.d.ts +6 -0
  4. package/dist/cjs/globalization/helpers/getI18nDateGroupLabel.js +120 -0
  5. package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderCreateModal.d.ts +2 -0
  6. package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderFunctionsType.d.ts +1 -0
  7. package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderListModal.d.ts +5 -0
  8. package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderV2FunctionAggregate.d.ts +5 -0
  9. package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderV2FunctionAggregate.js +2 -0
  10. package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderV2Functions.d.ts +8 -0
  11. package/dist/cjs/globalization/interfaces/formula_builder/index.d.ts +3 -0
  12. package/dist/cjs/globalization/interfaces/formula_builder/index.js +3 -0
  13. package/dist/cjs/globalization/labels/formula_builder/I18N_FORMULA_BUILDER.js +50 -0
  14. package/dist/dates/constants/DATE_DISTINCT_PROPERTY.d.ts +2 -1
  15. package/dist/dates/constants/DATE_DISTINCT_PROPERTY.js +1 -0
  16. package/dist/globalization/helpers/getI18nDateGroupLabel.d.ts +6 -0
  17. package/dist/globalization/helpers/getI18nDateGroupLabel.js +120 -0
  18. package/dist/globalization/interfaces/formula_builder/II18nFormulaBuilderCreateModal.d.ts +2 -0
  19. package/dist/globalization/interfaces/formula_builder/II18nFormulaBuilderFunctionsType.d.ts +1 -0
  20. package/dist/globalization/interfaces/formula_builder/II18nFormulaBuilderListModal.d.ts +5 -0
  21. package/dist/globalization/interfaces/formula_builder/II18nFormulaBuilderV2FunctionAggregate.d.ts +5 -0
  22. package/dist/globalization/interfaces/formula_builder/II18nFormulaBuilderV2FunctionAggregate.js +1 -0
  23. package/dist/globalization/interfaces/formula_builder/II18nFormulaBuilderV2Functions.d.ts +8 -0
  24. package/dist/globalization/interfaces/formula_builder/index.d.ts +3 -0
  25. package/dist/globalization/interfaces/formula_builder/index.js +3 -0
  26. package/dist/globalization/labels/formula_builder/I18N_FORMULA_BUILDER.js +50 -0
  27. package/package.json +1 -1
@@ -1,5 +1,6 @@
1
1
  export declare enum DATE_DISTINCT_PROPERTY {
2
2
  YEAR_QUARTER = "quarter_only",
3
3
  YEAR_MONTH = "month_only",
4
- MONTH_DAY = "day_only"
4
+ MONTH_DAY = "day_only",
5
+ DAY_CUSTOM = "day_custom"
5
6
  }
@@ -8,4 +8,5 @@ var DATE_DISTINCT_PROPERTY;
8
8
  // YEAR_DAY = 'p-y-day',
9
9
  DATE_DISTINCT_PROPERTY["MONTH_DAY"] = "day_only";
10
10
  // WEEK_DAY = 'p-w-day'
11
+ DATE_DISTINCT_PROPERTY["DAY_CUSTOM"] = "day_custom";
11
12
  })(DATE_DISTINCT_PROPERTY || (exports.DATE_DISTINCT_PROPERTY = DATE_DISTINCT_PROPERTY = {}));
@@ -1,3 +1,9 @@
1
1
  import { IDateColumnPropertyType } from "../../columns/interfaces/IDateColumnPropertyType";
2
2
  import { II18nServiceTranslate } from "../interfaces/II18nServiceTranslate";
3
+ /**
4
+ *
5
+ * @param label
6
+ * @param dateGroup
7
+ * @param translate
8
+ */
3
9
  export declare function getI18nDateGroupLabel(label: string, dateGroup: IDateColumnPropertyType, translate?: II18nServiceTranslate): string;
@@ -6,6 +6,12 @@ const DATE_GROUPING_PROPERTY_1 = require("../../dates/constants/DATE_GROUPING_PR
6
6
  const DATE_YEAR_MONTHS_1 = require("../../dates/constants/DATE_YEAR_MONTHS");
7
7
  const isEmpty_1 = require("../../general/mix/isEmpty");
8
8
  const isTokenLabel_1 = require("../../tokens/isTokenLabel");
9
+ /**
10
+ *
11
+ * @param label
12
+ * @param dateGroup
13
+ * @param translate
14
+ */
9
15
  function getI18nDateGroupLabel(label, dateGroup, translate) {
10
16
  if ((0, isEmpty_1.isEmpty)(label))
11
17
  return label;
@@ -19,14 +25,26 @@ function getI18nDateGroupLabel(label, dateGroup, translate) {
19
25
  return getI18nYearMonthLabel(label, translate);
20
26
  else if (dateGroup === DATE_DISTINCT_PROPERTY_1.DATE_DISTINCT_PROPERTY.YEAR_QUARTER)
21
27
  return getI18nYearQuarterLabel(label, translate);
28
+ else if (dateGroup === DATE_DISTINCT_PROPERTY_1.DATE_DISTINCT_PROPERTY.DAY_CUSTOM)
29
+ return getI18nDayCustomLabel(label, translate);
22
30
  return label;
23
31
  }
24
32
  exports.getI18nDateGroupLabel = getI18nDateGroupLabel;
33
+ /**
34
+ *
35
+ * @param label
36
+ * @param translate
37
+ */
25
38
  function getI18nMonthLabel(label, translate) {
26
39
  const splittedLabel = label.split(" ");
27
40
  splittedLabel[0] = getI18nYearMonthLabel(splittedLabel[0], translate);
28
41
  return splittedLabel.join(" ");
29
42
  }
43
+ /**
44
+ *
45
+ * @param label
46
+ * @param translate
47
+ */
30
48
  function getI18nYearMonthLabel(label, translate) {
31
49
  let newLabel = label;
32
50
  if (!(0, isTokenLabel_1.isTokenLabel)(newLabel) && !(0, isEmpty_1.isEmpty)(translate)) {
@@ -36,6 +54,10 @@ function getI18nYearMonthLabel(label, translate) {
36
54
  }
37
55
  return newLabel;
38
56
  }
57
+ /**
58
+ *
59
+ * @param index
60
+ */
39
61
  function getI18nMonthPropertyByIndex(index) {
40
62
  const months = [
41
63
  "january",
@@ -53,11 +75,21 @@ function getI18nMonthPropertyByIndex(index) {
53
75
  ];
54
76
  return months[index];
55
77
  }
78
+ /**
79
+ *
80
+ * @param label
81
+ * @param translate
82
+ */
56
83
  function getI18nQuarterLabel(label, translate) {
57
84
  const splittedLabel = label.split(" ");
58
85
  splittedLabel[0] = getI18nYearQuarterLabel(splittedLabel[0], translate);
59
86
  return splittedLabel.join(" ");
60
87
  }
88
+ /**
89
+ *
90
+ * @param label
91
+ * @param translate
92
+ */
61
93
  function getI18nYearQuarterLabel(label, translate) {
62
94
  let newLabel = label;
63
95
  if (!(0, isTokenLabel_1.isTokenLabel)(newLabel) && !(0, isEmpty_1.isEmpty)(translate)) {
@@ -65,11 +97,21 @@ function getI18nYearQuarterLabel(label, translate) {
65
97
  }
66
98
  return newLabel;
67
99
  }
100
+ /**
101
+ *
102
+ * @param label
103
+ * @param translate
104
+ */
68
105
  function getI18nWeekLabel(label, translate) {
69
106
  const splittedLabel = label.split(" ");
70
107
  splittedLabel[0] = getI18nYearWeekLabel(splittedLabel[0], translate);
71
108
  return splittedLabel.join(" ");
72
109
  }
110
+ /**
111
+ *
112
+ * @param label
113
+ * @param translate
114
+ */
73
115
  function getI18nYearWeekLabel(label, translate) {
74
116
  let newLabel = label;
75
117
  if (!(0, isTokenLabel_1.isTokenLabel)(newLabel) && !(0, isEmpty_1.isEmpty)(translate)) {
@@ -77,3 +119,81 @@ function getI18nYearWeekLabel(label, translate) {
77
119
  }
78
120
  return newLabel;
79
121
  }
122
+ /**
123
+ *
124
+ * @param label
125
+ * @param translate
126
+ */
127
+ function getI18nDayCustomLabel(label, translate) {
128
+ const dayMapper = {
129
+ Monday: "monday",
130
+ Tuesday: "tuesday",
131
+ Wednesday: "wednesday",
132
+ Thursday: "thursday",
133
+ Friday: "friday",
134
+ Saturday: "saturday",
135
+ Sunday: "sunday",
136
+ };
137
+ const dayAbbMapper = {
138
+ Mon: "monday",
139
+ Tue: "tuesday",
140
+ Wed: "wednesday",
141
+ Thu: "thursday",
142
+ Fri: "friday",
143
+ Sat: "saturday",
144
+ Sun: "sunday",
145
+ };
146
+ const monthMapper = {
147
+ January: "january",
148
+ February: "february",
149
+ March: "march",
150
+ April: "april",
151
+ May: "may",
152
+ June: "june",
153
+ July: "july",
154
+ August: "august",
155
+ September: "september",
156
+ October: "october",
157
+ November: "november",
158
+ December: "december",
159
+ };
160
+ const monthAbbMapper = {
161
+ Jan: "january",
162
+ Feb: "february",
163
+ Mar: "march",
164
+ Apr: "april",
165
+ May: "may",
166
+ Jun: "june",
167
+ Jul: "july",
168
+ Aug: "august",
169
+ Sep: "september",
170
+ Oct: "october",
171
+ Nov: "november",
172
+ Dec: "december",
173
+ };
174
+ let newLabel = label;
175
+ if (!(0, isTokenLabel_1.isTokenLabel)(newLabel) && !(0, isEmpty_1.isEmpty)(translate)) {
176
+ const regex = new RegExp([
177
+ ...Object.keys(dayMapper),
178
+ ...Object.keys(dayAbbMapper),
179
+ ...Object.keys(monthMapper),
180
+ ...Object.keys(monthAbbMapper),
181
+ ].join("|"), "g");
182
+ newLabel = newLabel.replace(regex, (match) => {
183
+ if (dayMapper[match]) {
184
+ return translate(`common.day_names.${dayMapper[match]}_dddd`);
185
+ }
186
+ else if (dayAbbMapper[match]) {
187
+ return translate(`common.day_names.${dayAbbMapper[match]}_ddd`);
188
+ }
189
+ else if (monthMapper[match]) {
190
+ return translate(`common.date_grouping.${monthMapper[match]}_mmmm`);
191
+ }
192
+ else if (monthAbbMapper[match]) {
193
+ return translate(`common.date_grouping.${monthAbbMapper[match]}_mmm`);
194
+ }
195
+ return match;
196
+ });
197
+ }
198
+ return newLabel;
199
+ }
@@ -36,12 +36,14 @@ export interface II18nFormulaBuilderCreateModal {
36
36
  formula_name_error_reserved_word: string;
37
37
  formula_type: string;
38
38
  formula_custom_script_mode: string;
39
+ formula_custom_script_mode_soon: string;
39
40
  formula_mode: {
40
41
  title: string;
41
42
  info: string;
42
43
  tab_formula: string;
43
44
  tab_testing: string;
44
45
  tab_testing_tooltip: string;
46
+ tab_testing_tooltip_not_available: string;
45
47
  tab_testing_tooltip_empty: string;
46
48
  show_columns: string;
47
49
  hide_columns: string;
@@ -5,4 +5,5 @@ export interface II18nFormulaBuilderFunctionsType {
5
5
  date: string;
6
6
  aggregate: string;
7
7
  logical: string;
8
+ aggregated: string;
8
9
  }
@@ -6,4 +6,9 @@ export interface II18nFormulaBuilderListModal {
6
6
  information_text_text: string;
7
7
  title_header: string;
8
8
  column_editor_type: string;
9
+ loading: string;
10
+ formulas: string;
11
+ aggregate_formulas: string;
12
+ new_formula: string;
13
+ new_aggregate_formula: string;
9
14
  }
@@ -0,0 +1,5 @@
1
+ import { II18nFormulaBuilderFunction } from "./II18nFormulaBuilderFunction";
2
+ export interface II18nFormulaBuilderV2FunctionAggregate extends II18nFormulaBuilderFunction {
3
+ param_column_name: string;
4
+ param_column_description: string;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +1,6 @@
1
1
  import { II18nFormulaBuilderFunction } from "./II18nFormulaBuilderFunction";
2
2
  import { II18nFormulaBuilderV2FunctionAbs } from "./II18nFormulaBuilderV2FunctionAbs";
3
+ import { II18nFormulaBuilderV2FunctionAggregate } from "./II18nFormulaBuilderV2FunctionAggregate";
3
4
  import { II18nFormulaBuilderV2FunctionAnd } from "./II18nFormulaBuilderV2FunctionAnd";
4
5
  import { II18nFormulaBuilderV2FunctionConcantenate } from "./II18nFormulaBuilderV2FunctionConcatenate";
5
6
  import { II18nFormulaBuilderV2FunctionDateadd } from "./II18nFormulaBuilderV2FunctionDateadd";
@@ -73,4 +74,11 @@ export interface II18nFormulaBuilderV2Functions {
73
74
  roundup: II18nFormulaBuilderV2FunctionRound;
74
75
  millisecond: II18nFormulaBuilderV2FunctionMillisecond;
75
76
  text: II18nFormulaBuilderV2FunctionText;
77
+ agg_sum: II18nFormulaBuilderV2FunctionAggregate;
78
+ agg_avg: II18nFormulaBuilderV2FunctionAggregate;
79
+ agg_med: II18nFormulaBuilderV2FunctionAggregate;
80
+ agg_min: II18nFormulaBuilderV2FunctionAggregate;
81
+ agg_max: II18nFormulaBuilderV2FunctionAggregate;
82
+ agg_count: II18nFormulaBuilderV2FunctionAggregate;
83
+ agg_distcount: II18nFormulaBuilderV2FunctionAggregate;
76
84
  }
@@ -88,3 +88,6 @@ export * from "./II18nFormulaBuilderV2FunctionLog";
88
88
  export * from "./II18nFormulaBuilderV2FunctionOdd";
89
89
  export * from "./II18nFormulaBuilderV2FunctionPower";
90
90
  export * from "./II18nFormulaBuilderV2FunctionRound";
91
+ export * from "./II18nFormulaBuilderV2FunctionMillisecond";
92
+ export * from "./II18nFormulaBuilderV2FunctionText";
93
+ export * from "./II18nFormulaBuilderV2FunctionAggregate";
@@ -104,3 +104,6 @@ __exportStar(require("./II18nFormulaBuilderV2FunctionLog"), exports);
104
104
  __exportStar(require("./II18nFormulaBuilderV2FunctionOdd"), exports);
105
105
  __exportStar(require("./II18nFormulaBuilderV2FunctionPower"), exports);
106
106
  __exportStar(require("./II18nFormulaBuilderV2FunctionRound"), exports);
107
+ __exportStar(require("./II18nFormulaBuilderV2FunctionMillisecond"), exports);
108
+ __exportStar(require("./II18nFormulaBuilderV2FunctionText"), exports);
109
+ __exportStar(require("./II18nFormulaBuilderV2FunctionAggregate"), exports);
@@ -15,6 +15,11 @@ exports.I18N_FORMULA_BUILDER = {
15
15
  information_text_text: "create and work with formulas",
16
16
  title_header: "Formulas",
17
17
  column_editor_type: "Editor Type",
18
+ loading: "Loading dependencies...",
19
+ formulas: "Formulas",
20
+ aggregate_formulas: "Aggregate Formulas",
21
+ new_formula: "New Formula",
22
+ new_aggregate_formula: "New Aggregate Formula",
18
23
  },
19
24
  list_table: {
20
25
  duplicate_copy: "Copy",
@@ -68,12 +73,14 @@ exports.I18N_FORMULA_BUILDER = {
68
73
  formula_name_error_reserved_word: "The formula name cannot be a reserved word: null, true or false.",
69
74
  formula_type: "Formula Mode",
70
75
  formula_custom_script_mode: "Data Engine Syntax (legacy)",
76
+ formula_custom_script_mode_soon: "Data Engine Syntax (legacy) - Coming Soon",
71
77
  formula_mode: {
72
78
  title: "Standardized Syntax",
73
79
  info: 'Allows mathematical and logical operators including +, -, *, /, (), =, >, <, >=, <=, <>. Numbers must be entered in en-US format. Date time values should be entered with format: "MM/DD/YYYY" or "MM/DD/YYYY HH:MM:SS"',
74
80
  tab_formula: "Formula",
75
81
  tab_testing: "Testing",
76
82
  tab_testing_tooltip: "This formula contains errors or is not finished.",
83
+ tab_testing_tooltip_not_available: "Testing not available for this formula type.",
77
84
  tab_testing_tooltip_empty: "No formula to test.",
78
85
  show_columns: "Show Columns and Functions",
79
86
  hide_columns: "Hide Columns and Functions",
@@ -374,6 +381,48 @@ exports.I18N_FORMULA_BUILDER = {
374
381
  param_num1_name: "num1",
375
382
  param_num1_description: "The number that you want to convert to text.",
376
383
  },
384
+ agg_sum: {
385
+ description: "Returns the aggregated sum of the numeric values of a column.",
386
+ function_placeholder: "AGG_SUM(column)",
387
+ param_column_name: "column",
388
+ param_column_description: "The numeric column that will be aggregated.",
389
+ },
390
+ agg_avg: {
391
+ description: "Returns the average value for all the numeric values of a column.",
392
+ function_placeholder: "AGG_AVG(column)",
393
+ param_column_name: "column",
394
+ param_column_description: "The numeric column that will be aggregated.",
395
+ },
396
+ agg_med: {
397
+ description: "Returns the median value for all the numeric values of a column.",
398
+ function_placeholder: "AGG_MED(column)",
399
+ param_column_name: "column",
400
+ param_column_description: "The numeric column that will be aggregated.",
401
+ },
402
+ agg_min: {
403
+ description: "Returns the minimum value among all the numeric values of a column.",
404
+ function_placeholder: "AGG_MIN(column)",
405
+ param_column_name: "column",
406
+ param_column_description: "The numeric column that will be aggregated.",
407
+ },
408
+ agg_max: {
409
+ description: "Returns the maximum value among all the numeric values of a column.",
410
+ function_placeholder: "AGG_MAX(column)",
411
+ param_column_name: "column",
412
+ param_column_description: "The numeric column that will be aggregated.",
413
+ },
414
+ agg_count: {
415
+ description: "Returns the count of all the values of a column.",
416
+ function_placeholder: "AGG_COUNT(column)",
417
+ param_column_name: "column",
418
+ param_column_description: "The column that will be aggregated.",
419
+ },
420
+ agg_distcount: {
421
+ description: "Returns the count of all the distinct values of a column.",
422
+ function_placeholder: "AGG_DISTCOUNT(column)",
423
+ param_column_name: "column",
424
+ param_column_description: "The column that will be aggregated.",
425
+ },
377
426
  },
378
427
  editor: {
379
428
  error_messages: {
@@ -427,6 +476,7 @@ exports.I18N_FORMULA_BUILDER = {
427
476
  date: "Date/Time",
428
477
  aggregate: "Aggregates",
429
478
  logical: "Logical",
479
+ aggregated: "Aggregate",
430
480
  },
431
481
  function_is_null: {
432
482
  description: "Replaces NULL with the specified replacement value.",
@@ -1,5 +1,6 @@
1
1
  export declare enum DATE_DISTINCT_PROPERTY {
2
2
  YEAR_QUARTER = "quarter_only",
3
3
  YEAR_MONTH = "month_only",
4
- MONTH_DAY = "day_only"
4
+ MONTH_DAY = "day_only",
5
+ DAY_CUSTOM = "day_custom"
5
6
  }
@@ -5,4 +5,5 @@ export var DATE_DISTINCT_PROPERTY;
5
5
  // YEAR_DAY = 'p-y-day',
6
6
  DATE_DISTINCT_PROPERTY["MONTH_DAY"] = "day_only";
7
7
  // WEEK_DAY = 'p-w-day'
8
+ DATE_DISTINCT_PROPERTY["DAY_CUSTOM"] = "day_custom";
8
9
  })(DATE_DISTINCT_PROPERTY || (DATE_DISTINCT_PROPERTY = {}));
@@ -1,3 +1,9 @@
1
1
  import { IDateColumnPropertyType } from "../../columns/interfaces/IDateColumnPropertyType";
2
2
  import { II18nServiceTranslate } from "../interfaces/II18nServiceTranslate";
3
+ /**
4
+ *
5
+ * @param label
6
+ * @param dateGroup
7
+ * @param translate
8
+ */
3
9
  export declare function getI18nDateGroupLabel(label: string, dateGroup: IDateColumnPropertyType, translate?: II18nServiceTranslate): string;
@@ -3,6 +3,12 @@ import { DATE_GROUPING_PROPERTY } from "../../dates/constants/DATE_GROUPING_PROP
3
3
  import { DATE_YEAR_MONTHS } from "../../dates/constants/DATE_YEAR_MONTHS";
4
4
  import { isEmpty } from "../../general/mix/isEmpty";
5
5
  import { isTokenLabel } from "../../tokens/isTokenLabel";
6
+ /**
7
+ *
8
+ * @param label
9
+ * @param dateGroup
10
+ * @param translate
11
+ */
6
12
  export function getI18nDateGroupLabel(label, dateGroup, translate) {
7
13
  if (isEmpty(label))
8
14
  return label;
@@ -16,13 +22,25 @@ export function getI18nDateGroupLabel(label, dateGroup, translate) {
16
22
  return getI18nYearMonthLabel(label, translate);
17
23
  else if (dateGroup === DATE_DISTINCT_PROPERTY.YEAR_QUARTER)
18
24
  return getI18nYearQuarterLabel(label, translate);
25
+ else if (dateGroup === DATE_DISTINCT_PROPERTY.DAY_CUSTOM)
26
+ return getI18nDayCustomLabel(label, translate);
19
27
  return label;
20
28
  }
29
+ /**
30
+ *
31
+ * @param label
32
+ * @param translate
33
+ */
21
34
  function getI18nMonthLabel(label, translate) {
22
35
  const splittedLabel = label.split(" ");
23
36
  splittedLabel[0] = getI18nYearMonthLabel(splittedLabel[0], translate);
24
37
  return splittedLabel.join(" ");
25
38
  }
39
+ /**
40
+ *
41
+ * @param label
42
+ * @param translate
43
+ */
26
44
  function getI18nYearMonthLabel(label, translate) {
27
45
  let newLabel = label;
28
46
  if (!isTokenLabel(newLabel) && !isEmpty(translate)) {
@@ -32,6 +50,10 @@ function getI18nYearMonthLabel(label, translate) {
32
50
  }
33
51
  return newLabel;
34
52
  }
53
+ /**
54
+ *
55
+ * @param index
56
+ */
35
57
  function getI18nMonthPropertyByIndex(index) {
36
58
  const months = [
37
59
  "january",
@@ -49,11 +71,21 @@ function getI18nMonthPropertyByIndex(index) {
49
71
  ];
50
72
  return months[index];
51
73
  }
74
+ /**
75
+ *
76
+ * @param label
77
+ * @param translate
78
+ */
52
79
  function getI18nQuarterLabel(label, translate) {
53
80
  const splittedLabel = label.split(" ");
54
81
  splittedLabel[0] = getI18nYearQuarterLabel(splittedLabel[0], translate);
55
82
  return splittedLabel.join(" ");
56
83
  }
84
+ /**
85
+ *
86
+ * @param label
87
+ * @param translate
88
+ */
57
89
  function getI18nYearQuarterLabel(label, translate) {
58
90
  let newLabel = label;
59
91
  if (!isTokenLabel(newLabel) && !isEmpty(translate)) {
@@ -61,11 +93,21 @@ function getI18nYearQuarterLabel(label, translate) {
61
93
  }
62
94
  return newLabel;
63
95
  }
96
+ /**
97
+ *
98
+ * @param label
99
+ * @param translate
100
+ */
64
101
  function getI18nWeekLabel(label, translate) {
65
102
  const splittedLabel = label.split(" ");
66
103
  splittedLabel[0] = getI18nYearWeekLabel(splittedLabel[0], translate);
67
104
  return splittedLabel.join(" ");
68
105
  }
106
+ /**
107
+ *
108
+ * @param label
109
+ * @param translate
110
+ */
69
111
  function getI18nYearWeekLabel(label, translate) {
70
112
  let newLabel = label;
71
113
  if (!isTokenLabel(newLabel) && !isEmpty(translate)) {
@@ -73,3 +115,81 @@ function getI18nYearWeekLabel(label, translate) {
73
115
  }
74
116
  return newLabel;
75
117
  }
118
+ /**
119
+ *
120
+ * @param label
121
+ * @param translate
122
+ */
123
+ function getI18nDayCustomLabel(label, translate) {
124
+ const dayMapper = {
125
+ Monday: "monday",
126
+ Tuesday: "tuesday",
127
+ Wednesday: "wednesday",
128
+ Thursday: "thursday",
129
+ Friday: "friday",
130
+ Saturday: "saturday",
131
+ Sunday: "sunday",
132
+ };
133
+ const dayAbbMapper = {
134
+ Mon: "monday",
135
+ Tue: "tuesday",
136
+ Wed: "wednesday",
137
+ Thu: "thursday",
138
+ Fri: "friday",
139
+ Sat: "saturday",
140
+ Sun: "sunday",
141
+ };
142
+ const monthMapper = {
143
+ January: "january",
144
+ February: "february",
145
+ March: "march",
146
+ April: "april",
147
+ May: "may",
148
+ June: "june",
149
+ July: "july",
150
+ August: "august",
151
+ September: "september",
152
+ October: "october",
153
+ November: "november",
154
+ December: "december",
155
+ };
156
+ const monthAbbMapper = {
157
+ Jan: "january",
158
+ Feb: "february",
159
+ Mar: "march",
160
+ Apr: "april",
161
+ May: "may",
162
+ Jun: "june",
163
+ Jul: "july",
164
+ Aug: "august",
165
+ Sep: "september",
166
+ Oct: "october",
167
+ Nov: "november",
168
+ Dec: "december",
169
+ };
170
+ let newLabel = label;
171
+ if (!isTokenLabel(newLabel) && !isEmpty(translate)) {
172
+ const regex = new RegExp([
173
+ ...Object.keys(dayMapper),
174
+ ...Object.keys(dayAbbMapper),
175
+ ...Object.keys(monthMapper),
176
+ ...Object.keys(monthAbbMapper),
177
+ ].join("|"), "g");
178
+ newLabel = newLabel.replace(regex, (match) => {
179
+ if (dayMapper[match]) {
180
+ return translate(`common.day_names.${dayMapper[match]}_dddd`);
181
+ }
182
+ else if (dayAbbMapper[match]) {
183
+ return translate(`common.day_names.${dayAbbMapper[match]}_ddd`);
184
+ }
185
+ else if (monthMapper[match]) {
186
+ return translate(`common.date_grouping.${monthMapper[match]}_mmmm`);
187
+ }
188
+ else if (monthAbbMapper[match]) {
189
+ return translate(`common.date_grouping.${monthAbbMapper[match]}_mmm`);
190
+ }
191
+ return match;
192
+ });
193
+ }
194
+ return newLabel;
195
+ }
@@ -36,12 +36,14 @@ export interface II18nFormulaBuilderCreateModal {
36
36
  formula_name_error_reserved_word: string;
37
37
  formula_type: string;
38
38
  formula_custom_script_mode: string;
39
+ formula_custom_script_mode_soon: string;
39
40
  formula_mode: {
40
41
  title: string;
41
42
  info: string;
42
43
  tab_formula: string;
43
44
  tab_testing: string;
44
45
  tab_testing_tooltip: string;
46
+ tab_testing_tooltip_not_available: string;
45
47
  tab_testing_tooltip_empty: string;
46
48
  show_columns: string;
47
49
  hide_columns: string;
@@ -5,4 +5,5 @@ export interface II18nFormulaBuilderFunctionsType {
5
5
  date: string;
6
6
  aggregate: string;
7
7
  logical: string;
8
+ aggregated: string;
8
9
  }
@@ -6,4 +6,9 @@ export interface II18nFormulaBuilderListModal {
6
6
  information_text_text: string;
7
7
  title_header: string;
8
8
  column_editor_type: string;
9
+ loading: string;
10
+ formulas: string;
11
+ aggregate_formulas: string;
12
+ new_formula: string;
13
+ new_aggregate_formula: string;
9
14
  }
@@ -0,0 +1,5 @@
1
+ import { II18nFormulaBuilderFunction } from "./II18nFormulaBuilderFunction";
2
+ export interface II18nFormulaBuilderV2FunctionAggregate extends II18nFormulaBuilderFunction {
3
+ param_column_name: string;
4
+ param_column_description: string;
5
+ }
@@ -1,5 +1,6 @@
1
1
  import { II18nFormulaBuilderFunction } from "./II18nFormulaBuilderFunction";
2
2
  import { II18nFormulaBuilderV2FunctionAbs } from "./II18nFormulaBuilderV2FunctionAbs";
3
+ import { II18nFormulaBuilderV2FunctionAggregate } from "./II18nFormulaBuilderV2FunctionAggregate";
3
4
  import { II18nFormulaBuilderV2FunctionAnd } from "./II18nFormulaBuilderV2FunctionAnd";
4
5
  import { II18nFormulaBuilderV2FunctionConcantenate } from "./II18nFormulaBuilderV2FunctionConcatenate";
5
6
  import { II18nFormulaBuilderV2FunctionDateadd } from "./II18nFormulaBuilderV2FunctionDateadd";
@@ -73,4 +74,11 @@ export interface II18nFormulaBuilderV2Functions {
73
74
  roundup: II18nFormulaBuilderV2FunctionRound;
74
75
  millisecond: II18nFormulaBuilderV2FunctionMillisecond;
75
76
  text: II18nFormulaBuilderV2FunctionText;
77
+ agg_sum: II18nFormulaBuilderV2FunctionAggregate;
78
+ agg_avg: II18nFormulaBuilderV2FunctionAggregate;
79
+ agg_med: II18nFormulaBuilderV2FunctionAggregate;
80
+ agg_min: II18nFormulaBuilderV2FunctionAggregate;
81
+ agg_max: II18nFormulaBuilderV2FunctionAggregate;
82
+ agg_count: II18nFormulaBuilderV2FunctionAggregate;
83
+ agg_distcount: II18nFormulaBuilderV2FunctionAggregate;
76
84
  }
@@ -88,3 +88,6 @@ export * from "./II18nFormulaBuilderV2FunctionLog";
88
88
  export * from "./II18nFormulaBuilderV2FunctionOdd";
89
89
  export * from "./II18nFormulaBuilderV2FunctionPower";
90
90
  export * from "./II18nFormulaBuilderV2FunctionRound";
91
+ export * from "./II18nFormulaBuilderV2FunctionMillisecond";
92
+ export * from "./II18nFormulaBuilderV2FunctionText";
93
+ export * from "./II18nFormulaBuilderV2FunctionAggregate";
@@ -88,3 +88,6 @@ export * from "./II18nFormulaBuilderV2FunctionLog";
88
88
  export * from "./II18nFormulaBuilderV2FunctionOdd";
89
89
  export * from "./II18nFormulaBuilderV2FunctionPower";
90
90
  export * from "./II18nFormulaBuilderV2FunctionRound";
91
+ export * from "./II18nFormulaBuilderV2FunctionMillisecond";
92
+ export * from "./II18nFormulaBuilderV2FunctionText";
93
+ export * from "./II18nFormulaBuilderV2FunctionAggregate";
@@ -12,6 +12,11 @@ export const I18N_FORMULA_BUILDER = {
12
12
  information_text_text: "create and work with formulas",
13
13
  title_header: "Formulas",
14
14
  column_editor_type: "Editor Type",
15
+ loading: "Loading dependencies...",
16
+ formulas: "Formulas",
17
+ aggregate_formulas: "Aggregate Formulas",
18
+ new_formula: "New Formula",
19
+ new_aggregate_formula: "New Aggregate Formula",
15
20
  },
16
21
  list_table: {
17
22
  duplicate_copy: "Copy",
@@ -65,12 +70,14 @@ export const I18N_FORMULA_BUILDER = {
65
70
  formula_name_error_reserved_word: "The formula name cannot be a reserved word: null, true or false.",
66
71
  formula_type: "Formula Mode",
67
72
  formula_custom_script_mode: "Data Engine Syntax (legacy)",
73
+ formula_custom_script_mode_soon: "Data Engine Syntax (legacy) - Coming Soon",
68
74
  formula_mode: {
69
75
  title: "Standardized Syntax",
70
76
  info: 'Allows mathematical and logical operators including +, -, *, /, (), =, >, <, >=, <=, <>. Numbers must be entered in en-US format. Date time values should be entered with format: "MM/DD/YYYY" or "MM/DD/YYYY HH:MM:SS"',
71
77
  tab_formula: "Formula",
72
78
  tab_testing: "Testing",
73
79
  tab_testing_tooltip: "This formula contains errors or is not finished.",
80
+ tab_testing_tooltip_not_available: "Testing not available for this formula type.",
74
81
  tab_testing_tooltip_empty: "No formula to test.",
75
82
  show_columns: "Show Columns and Functions",
76
83
  hide_columns: "Hide Columns and Functions",
@@ -371,6 +378,48 @@ export const I18N_FORMULA_BUILDER = {
371
378
  param_num1_name: "num1",
372
379
  param_num1_description: "The number that you want to convert to text.",
373
380
  },
381
+ agg_sum: {
382
+ description: "Returns the aggregated sum of the numeric values of a column.",
383
+ function_placeholder: "AGG_SUM(column)",
384
+ param_column_name: "column",
385
+ param_column_description: "The numeric column that will be aggregated.",
386
+ },
387
+ agg_avg: {
388
+ description: "Returns the average value for all the numeric values of a column.",
389
+ function_placeholder: "AGG_AVG(column)",
390
+ param_column_name: "column",
391
+ param_column_description: "The numeric column that will be aggregated.",
392
+ },
393
+ agg_med: {
394
+ description: "Returns the median value for all the numeric values of a column.",
395
+ function_placeholder: "AGG_MED(column)",
396
+ param_column_name: "column",
397
+ param_column_description: "The numeric column that will be aggregated.",
398
+ },
399
+ agg_min: {
400
+ description: "Returns the minimum value among all the numeric values of a column.",
401
+ function_placeholder: "AGG_MIN(column)",
402
+ param_column_name: "column",
403
+ param_column_description: "The numeric column that will be aggregated.",
404
+ },
405
+ agg_max: {
406
+ description: "Returns the maximum value among all the numeric values of a column.",
407
+ function_placeholder: "AGG_MAX(column)",
408
+ param_column_name: "column",
409
+ param_column_description: "The numeric column that will be aggregated.",
410
+ },
411
+ agg_count: {
412
+ description: "Returns the count of all the values of a column.",
413
+ function_placeholder: "AGG_COUNT(column)",
414
+ param_column_name: "column",
415
+ param_column_description: "The column that will be aggregated.",
416
+ },
417
+ agg_distcount: {
418
+ description: "Returns the count of all the distinct values of a column.",
419
+ function_placeholder: "AGG_DISTCOUNT(column)",
420
+ param_column_name: "column",
421
+ param_column_description: "The column that will be aggregated.",
422
+ },
374
423
  },
375
424
  editor: {
376
425
  error_messages: {
@@ -424,6 +473,7 @@ export const I18N_FORMULA_BUILDER = {
424
473
  date: "Date/Time",
425
474
  aggregate: "Aggregates",
426
475
  logical: "Logical",
476
+ aggregated: "Aggregate",
427
477
  },
428
478
  function_is_null: {
429
479
  description: "Replaces NULL with the specified replacement value.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qrvey/utils",
3
- "version": "1.15.0",
3
+ "version": "1.16.0-1",
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",