@qrvey/utils 1.5.0-1 → 1.5.0-2

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 (24) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/filters/helpers/getTokensFromFilters.js +9 -4
  3. package/dist/cjs/globalization/interfaces/II18nResource.d.ts +2 -0
  4. package/dist/cjs/globalization/interfaces/chart_builder/II18nChartBuilderFormatValues.d.ts +1 -0
  5. package/dist/cjs/globalization/interfaces/common/II18nCommon.d.ts +1 -0
  6. package/dist/cjs/globalization/interfaces/tabular_view/II18nTabularView.d.ts +4 -0
  7. package/dist/cjs/globalization/interfaces/tabular_view/II18nTabularView.js +2 -0
  8. package/dist/cjs/globalization/labels/I18N_DEFAULT.js +2 -0
  9. package/dist/cjs/globalization/labels/chart_builder/I18N_CHART_BUILDER.js +1 -0
  10. package/dist/cjs/globalization/labels/common/I18N_COMMON.js +1 -0
  11. package/dist/cjs/globalization/labels/tabular_view/I18N_TABULAR_VIEW.d.ts +2 -0
  12. package/dist/cjs/globalization/labels/tabular_view/I18N_TABULAR_VIEW.js +7 -0
  13. package/dist/filters/helpers/getTokensFromFilters.js +9 -4
  14. package/dist/globalization/interfaces/II18nResource.d.ts +2 -0
  15. package/dist/globalization/interfaces/chart_builder/II18nChartBuilderFormatValues.d.ts +1 -0
  16. package/dist/globalization/interfaces/common/II18nCommon.d.ts +1 -0
  17. package/dist/globalization/interfaces/tabular_view/II18nTabularView.d.ts +4 -0
  18. package/dist/globalization/interfaces/tabular_view/II18nTabularView.js +1 -0
  19. package/dist/globalization/labels/I18N_DEFAULT.js +2 -0
  20. package/dist/globalization/labels/chart_builder/I18N_CHART_BUILDER.js +1 -0
  21. package/dist/globalization/labels/common/I18N_COMMON.js +1 -0
  22. package/dist/globalization/labels/tabular_view/I18N_TABULAR_VIEW.d.ts +2 -0
  23. package/dist/globalization/labels/tabular_view/I18N_TABULAR_VIEW.js +4 -0
  24. package/package.json +1 -1
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # [@qrvey/utils](https://bitbucket.org/qrvey/qrvey_utils/wiki/Home) *1.5.0-1*
1
+ # [@qrvey/utils](https://bitbucket.org/qrvey/qrvey_utils/wiki/Home) *1.5.0-2*
2
2
 
3
3
  > Helper, Utils for all Qrvey Projects
4
4
 
@@ -12,7 +12,7 @@ const isEmpty_1 = require("../../general/mix/isEmpty");
12
12
  * @returns {IFFilterTokens[]} An array of tokens that represents the filters object
13
13
  */
14
14
  function getTokensFromFilters(filters, options) {
15
- var _a, _b;
15
+ var _a, _b, _c;
16
16
  const tokens = [];
17
17
  const i18nService = options.i18nService;
18
18
  const settings = {
@@ -48,16 +48,21 @@ function getTokensFromFilters(filters, options) {
48
48
  });
49
49
  }
50
50
  for (const [index, filter] of Object.entries(database.filters)) {
51
- if (!(filter === null || filter === void 0 ? void 0 : filter.enabled))
51
+ if (!(filter === null || filter === void 0 ? void 0 : filter.enabled)) {
52
+ if (((_a = tokens[tokens.length - 1]) === null || _a === void 0 ? void 0 : _a.type) ===
53
+ FILTER_TOKENS_STRUCTURE_TYPE_1.FILTER_TOKENS_STRUCTURE_TYPE.LOGICAL_OPERATOR) {
54
+ tokens.pop();
55
+ }
52
56
  continue;
57
+ }
53
58
  const values = (0, getUIValues_1.getUIValues)(filter, settings);
54
59
  if (!thereIsFiltersWithValues)
55
60
  thereIsFiltersWithValues = true;
56
61
  let columnLabel = filter.column.label;
57
- if ((_a = filter === null || filter === void 0 ? void 0 : filter.column) === null || _a === void 0 ? void 0 : _a.aggregate) {
62
+ if ((_b = filter === null || filter === void 0 ? void 0 : filter.column) === null || _b === void 0 ? void 0 : _b.aggregate) {
58
63
  columnLabel +=
59
64
  " (" +
60
- i18nService.translate(`common.aggregate_labels.${(_b = filter === null || filter === void 0 ? void 0 : filter.column) === null || _b === void 0 ? void 0 : _b.aggregate.toLowerCase()}`) +
65
+ i18nService.translate(`common.aggregate_labels.${(_c = filter === null || filter === void 0 ? void 0 : filter.column) === null || _c === void 0 ? void 0 : _c.aggregate.toLowerCase()}`) +
61
66
  ")";
62
67
  }
63
68
  tokens.push({
@@ -11,6 +11,7 @@ import { II18nBucketBuilder } from "./bucket_builder/II18nBucketBuilder";
11
11
  import { II18nCrossTabs } from "./cross_tabs";
12
12
  import { II18nChartBuilder } from ".";
13
13
  import { II18nStyleThemes } from "./style_themes/II18nStyleThemes";
14
+ import { II18nTabularView } from './tabular_view/II18nTabularView';
14
15
  export interface II18nResource {
15
16
  bucket_builder?: II18nBucketBuilder;
16
17
  chart_builder?: II18nChartBuilder;
@@ -25,4 +26,5 @@ export interface II18nResource {
25
26
  panel?: II18nPanel;
26
27
  style_themes?: II18nStyleThemes;
27
28
  table_charts?: II18nTableCharts;
29
+ tabular_view?: II18nTabularView;
28
30
  }
@@ -14,4 +14,5 @@ export interface II18nChartBuilderFormatValues {
14
14
  custom: string;
15
15
  date_format: string;
16
16
  value_format: string;
17
+ duration: string;
17
18
  }
@@ -16,5 +16,6 @@ export interface II18nCommon {
16
16
  no_data_found: string;
17
17
  properties: II18nColumnProperties;
18
18
  search: string;
19
+ sort: string;
19
20
  units: II18nUnits;
20
21
  }
@@ -0,0 +1,4 @@
1
+ export interface II18nTabularView {
2
+ all: string;
3
+ select_columns: string;
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -11,6 +11,7 @@ const formula_builder_1 = require("./formula_builder");
11
11
  const I18N_FILTER_PANEL_1 = require("./filters/I18N_FILTER_PANEL");
12
12
  const I18N_FILTER_DISPLAY_1 = require("./filters/I18N_FILTER_DISPLAY");
13
13
  const I18N_BUCKET_BUILDER_1 = require("./bucket_builder/I18N_BUCKET_BUILDER");
14
+ const I18N_TABULAR_VIEW_1 = require("./tabular_view/I18N_TABULAR_VIEW");
14
15
  const cross_tabs_1 = require("./cross_tabs");
15
16
  const chart_builder_1 = require("./chart_builder");
16
17
  const style_themes_1 = require("./style_themes");
@@ -28,4 +29,5 @@ exports.I18N_DEFAULT = {
28
29
  panel: I18N_PANEL_1.I18N_PANEL,
29
30
  style_themes: style_themes_1.I18N_STYLE_THEMES,
30
31
  table_charts: table_charts_1.I18N_TABLE_CHARTS,
32
+ tabular_view: I18N_TABULAR_VIEW_1.I18N_TABULAR_VIEW
31
33
  };
@@ -26,6 +26,7 @@ exports.I18N_CHART_BUILDER = Object.assign(Object.assign(Object.assign(Object.as
26
26
  custom: "Custom Format",
27
27
  date_format: "Date Format",
28
28
  value_format: "Value Format",
29
+ duration: "Duration",
29
30
  }, chart_names: {
30
31
  bar: "Bar",
31
32
  line: "Line",
@@ -23,6 +23,7 @@ exports.I18N_COMMON = {
23
23
  no_data_found: "No Data Found",
24
24
  properties: I18N_COLUMN_PROPERTY_LABEL_1.I18N_COLUMN_PROPERTY_LABEL,
25
25
  search: "Search",
26
+ sort: "Sort",
26
27
  units: {
27
28
  day: RELATIVE_UNIT_INFO_1.RELATIVE_UNIT_INFO.DAY.label,
28
29
  month: RELATIVE_UNIT_INFO_1.RELATIVE_UNIT_INFO.MONTH.label,
@@ -0,0 +1,2 @@
1
+ import { II18nTabularView } from "../../interfaces/tabular_view/II18nTabularView";
2
+ export declare const I18N_TABULAR_VIEW: II18nTabularView;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.I18N_TABULAR_VIEW = void 0;
4
+ exports.I18N_TABULAR_VIEW = {
5
+ all: "Todas",
6
+ select_columns: "Select Columns",
7
+ };
@@ -9,7 +9,7 @@ import { isEmpty } from "../../general/mix/isEmpty";
9
9
  * @returns {IFFilterTokens[]} An array of tokens that represents the filters object
10
10
  */
11
11
  export function getTokensFromFilters(filters, options) {
12
- var _a, _b;
12
+ var _a, _b, _c;
13
13
  const tokens = [];
14
14
  const i18nService = options.i18nService;
15
15
  const settings = {
@@ -45,16 +45,21 @@ export function getTokensFromFilters(filters, options) {
45
45
  });
46
46
  }
47
47
  for (const [index, filter] of Object.entries(database.filters)) {
48
- if (!(filter === null || filter === void 0 ? void 0 : filter.enabled))
48
+ if (!(filter === null || filter === void 0 ? void 0 : filter.enabled)) {
49
+ if (((_a = tokens[tokens.length - 1]) === null || _a === void 0 ? void 0 : _a.type) ===
50
+ FILTER_TOKENS_STRUCTURE_TYPE.LOGICAL_OPERATOR) {
51
+ tokens.pop();
52
+ }
49
53
  continue;
54
+ }
50
55
  const values = getUIValues(filter, settings);
51
56
  if (!thereIsFiltersWithValues)
52
57
  thereIsFiltersWithValues = true;
53
58
  let columnLabel = filter.column.label;
54
- if ((_a = filter === null || filter === void 0 ? void 0 : filter.column) === null || _a === void 0 ? void 0 : _a.aggregate) {
59
+ if ((_b = filter === null || filter === void 0 ? void 0 : filter.column) === null || _b === void 0 ? void 0 : _b.aggregate) {
55
60
  columnLabel +=
56
61
  " (" +
57
- i18nService.translate(`common.aggregate_labels.${(_b = filter === null || filter === void 0 ? void 0 : filter.column) === null || _b === void 0 ? void 0 : _b.aggregate.toLowerCase()}`) +
62
+ i18nService.translate(`common.aggregate_labels.${(_c = filter === null || filter === void 0 ? void 0 : filter.column) === null || _c === void 0 ? void 0 : _c.aggregate.toLowerCase()}`) +
58
63
  ")";
59
64
  }
60
65
  tokens.push({
@@ -11,6 +11,7 @@ import { II18nBucketBuilder } from "./bucket_builder/II18nBucketBuilder";
11
11
  import { II18nCrossTabs } from "./cross_tabs";
12
12
  import { II18nChartBuilder } from ".";
13
13
  import { II18nStyleThemes } from "./style_themes/II18nStyleThemes";
14
+ import { II18nTabularView } from './tabular_view/II18nTabularView';
14
15
  export interface II18nResource {
15
16
  bucket_builder?: II18nBucketBuilder;
16
17
  chart_builder?: II18nChartBuilder;
@@ -25,4 +26,5 @@ export interface II18nResource {
25
26
  panel?: II18nPanel;
26
27
  style_themes?: II18nStyleThemes;
27
28
  table_charts?: II18nTableCharts;
29
+ tabular_view?: II18nTabularView;
28
30
  }
@@ -14,4 +14,5 @@ export interface II18nChartBuilderFormatValues {
14
14
  custom: string;
15
15
  date_format: string;
16
16
  value_format: string;
17
+ duration: string;
17
18
  }
@@ -16,5 +16,6 @@ export interface II18nCommon {
16
16
  no_data_found: string;
17
17
  properties: II18nColumnProperties;
18
18
  search: string;
19
+ sort: string;
19
20
  units: II18nUnits;
20
21
  }
@@ -0,0 +1,4 @@
1
+ export interface II18nTabularView {
2
+ all: string;
3
+ select_columns: string;
4
+ }
@@ -8,6 +8,7 @@ import { I18N_FORMULA_BUILDER } from "./formula_builder";
8
8
  import { I18N_FILTER_PANEL } from "./filters/I18N_FILTER_PANEL";
9
9
  import { I18N_FILTER_DISPLAY } from "./filters/I18N_FILTER_DISPLAY";
10
10
  import { I18N_BUCKET_BUILDER } from "./bucket_builder/I18N_BUCKET_BUILDER";
11
+ import { I18N_TABULAR_VIEW } from './tabular_view/I18N_TABULAR_VIEW';
11
12
  import { I18N_CROSS_TABS } from "./cross_tabs";
12
13
  import { I18N_CHART_BUILDER } from "./chart_builder";
13
14
  import { I18N_STYLE_THEMES } from "./style_themes";
@@ -25,4 +26,5 @@ export const I18N_DEFAULT = {
25
26
  panel: I18N_PANEL,
26
27
  style_themes: I18N_STYLE_THEMES,
27
28
  table_charts: I18N_TABLE_CHARTS,
29
+ tabular_view: I18N_TABULAR_VIEW
28
30
  };
@@ -23,6 +23,7 @@ export const I18N_CHART_BUILDER = Object.assign(Object.assign(Object.assign(Obje
23
23
  custom: "Custom Format",
24
24
  date_format: "Date Format",
25
25
  value_format: "Value Format",
26
+ duration: "Duration",
26
27
  }, chart_names: {
27
28
  bar: "Bar",
28
29
  line: "Line",
@@ -20,6 +20,7 @@ export const I18N_COMMON = {
20
20
  no_data_found: "No Data Found",
21
21
  properties: I18N_COLUMN_PROPERTY_LABEL,
22
22
  search: "Search",
23
+ sort: "Sort",
23
24
  units: {
24
25
  day: RELATIVE_UNIT_INFO.DAY.label,
25
26
  month: RELATIVE_UNIT_INFO.MONTH.label,
@@ -0,0 +1,2 @@
1
+ import { II18nTabularView } from "../../interfaces/tabular_view/II18nTabularView";
2
+ export declare const I18N_TABULAR_VIEW: II18nTabularView;
@@ -0,0 +1,4 @@
1
+ export const I18N_TABULAR_VIEW = {
2
+ all: "Todas",
3
+ select_columns: "Select Columns",
4
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qrvey/utils",
3
- "version": "1.5.0-1",
3
+ "version": "1.5.0-2",
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",