@qrvey/utils 1.2.10-3 → 1.2.10-6

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 (52) hide show
  1. package/README.md +1 -1
  2. package/bitbucket-pipelines.yml +1 -1
  3. package/dist/cjs/filters/adapters/adaptFilterValues.js +1 -1
  4. package/dist/cjs/filters/adapters/flatUIToFD.js +4 -0
  5. package/dist/cjs/filters/adapters/flatUIToOldLogic.js +1 -1
  6. package/dist/cjs/filters/adapters/flatUIToUI.js +4 -0
  7. package/dist/cjs/filters/helpers/OLD_getAggFilters.d.ts +1 -1
  8. package/dist/cjs/filters/helpers/OLD_getAggFilters.js +1 -1
  9. package/dist/cjs/filters/helpers/backend/getBackendProperty.js +1 -1
  10. package/dist/cjs/filters/helpers/backend/getBackendValues.js +1 -1
  11. package/dist/cjs/filters/interfaces/common/IFSValue.d.ts +1 -1
  12. package/dist/cjs/filters/interfaces/ui/IFUValue.d.ts +1 -1
  13. package/dist/cjs/filters/services/UChartPaginationApi.d.ts +2 -2
  14. package/dist/cjs/filters/services/UChartPaginationApi.js +2 -2
  15. package/dist/cjs/format/format.js +4 -2
  16. package/dist/cjs/format/localization.js +1 -1
  17. package/dist/cjs/qrvey/helpers/transformValue.js +3 -0
  18. package/dist/cjs/services/adapters/BBranchesMapToUIBranchesMap.adapter.d.ts +3 -3
  19. package/dist/cjs/services/adapters/BBranchesMapToUIBranchesMap.adapter.js +3 -3
  20. package/dist/filters/adapters/adaptFilterValues.js +1 -1
  21. package/dist/filters/adapters/flatUIToFD.js +4 -0
  22. package/dist/filters/adapters/flatUIToOldLogic.js +1 -1
  23. package/dist/filters/adapters/flatUIToUI.js +4 -0
  24. package/dist/filters/helpers/OLD_getAggFilters.d.ts +1 -1
  25. package/dist/filters/helpers/OLD_getAggFilters.js +1 -1
  26. package/dist/filters/helpers/backend/getBackendProperty.js +1 -1
  27. package/dist/filters/helpers/backend/getBackendValues.js +1 -1
  28. package/dist/filters/interfaces/common/IFSValue.d.ts +1 -1
  29. package/dist/filters/interfaces/ui/IFUValue.d.ts +1 -1
  30. package/dist/filters/services/UChartPaginationApi.d.ts +2 -2
  31. package/dist/filters/services/UChartPaginationApi.js +2 -2
  32. package/dist/format/format.js +4 -2
  33. package/dist/format/localization.js +1 -1
  34. package/dist/qrvey/helpers/transformValue.js +3 -0
  35. package/dist/services/adapters/BBranchesMapToUIBranchesMap.adapter.d.ts +3 -3
  36. package/dist/services/adapters/BBranchesMapToUIBranchesMap.adapter.js +3 -3
  37. package/package.json +6 -5
  38. package/publishing.js +69 -53
  39. package/src/filters/adapters/adaptFilterValues.ts +1 -1
  40. package/src/filters/adapters/flatUIToFD.ts +5 -0
  41. package/src/filters/adapters/flatUIToOldLogic.ts +1 -1
  42. package/src/filters/adapters/flatUIToUI.ts +5 -0
  43. package/src/filters/helpers/OLD_getAggFilters.ts +1 -1
  44. package/src/filters/helpers/backend/getBackendProperty.ts +2 -1
  45. package/src/filters/helpers/backend/getBackendValues.ts +1 -1
  46. package/src/filters/interfaces/common/IFSValue.ts +1 -1
  47. package/src/filters/interfaces/ui/IFUValue.ts +1 -1
  48. package/src/filters/services/UChartPaginationApi.ts +2 -4
  49. package/src/format/format.ts +3 -2
  50. package/src/format/localization.ts +1 -1
  51. package/src/qrvey/helpers/transformValue.ts +3 -0
  52. package/src/services/adapters/BBranchesMapToUIBranchesMap.adapter.ts +3 -3
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # [@qrvey/utils](https://bitbucket.org/qrvey/qrvey_utils/wiki/Home) *1.2.10-2*
1
+ # [@qrvey/utils](https://bitbucket.org/qrvey/qrvey_utils/wiki/Home) *1.2.10-5*
2
2
 
3
3
  > Helper, Utils for all Qrvey Projects
4
4
 
@@ -1,4 +1,4 @@
1
- image: node:14.17.3
1
+ image: node:16.14.1
2
2
 
3
3
  pipelines:
4
4
  default:
@@ -10,7 +10,7 @@ const COLUMN_1 = require("../../columns/constants/COLUMN");
10
10
  * @returns A new value array with the filled properties.
11
11
  */
12
12
  function adaptFilterValues(filter) {
13
- const setValue = value => (Object.assign(Object.assign({}, value), { enabled: (0, isEmpty_1.isEmpty)(value.enabled) ? true : value.enabled }));
13
+ const setValue = value => (Object.assign(Object.assign({}, value), { value: (0, isEmpty_1.isEmpty)(value.value) ? undefined : value.value, enabled: (0, isEmpty_1.isEmpty)(value.enabled) ? true : value.enabled }));
14
14
  if (filter.column.type === COLUMN_1.COLUMN.RANKING && (0, isEmpty_1.isEmpty)(filter.column.aggregate)) {
15
15
  return (filter.values || []).map(rValues => rValues.map(setValue));
16
16
  }
@@ -6,6 +6,7 @@ const isEmpty_1 = require("../../general/mix/isEmpty");
6
6
  const adaptFilterValues_1 = require("./adaptFilterValues");
7
7
  const FILTER_SECTION_1 = require("../constants/common/FILTER_SECTION");
8
8
  const FILTER_STRUCTURE_VERSION_1 = require("../constants/common/FILTER_STRUCTURE_VERSION");
9
+ const cloneDeep_1 = require("../../general/object/cloneDeep");
9
10
  /**
10
11
  * Generates a filter data structure from the flatttened UI filters.
11
12
  * @param uFilters Array of flattened filters from UI
@@ -82,8 +83,11 @@ function buildDataset(uFilter) {
82
83
  * @returns an filter structure
83
84
  */
84
85
  function buildFilter(uFilter) {
86
+ uFilter = (0, cloneDeep_1.cloneDeep)(uFilter);
85
87
  const info = !(0, isEmpty_1.isEmpty)(uFilter.extras.info) ? { icon: uFilter.extras.info.icon, label: uFilter.extras.info.label } : undefined;
86
88
  const property = (0, adaptDateGroupingProperty_1.adaptDateGroupingProperty)(uFilter.property);
89
+ delete uFilter.extras.scopeInfo;
90
+ delete uFilter.extras.dataset;
87
91
  return {
88
92
  collapsed: uFilter.collapsed,
89
93
  column: {
@@ -359,7 +359,7 @@ function getResultValues(values, props) {
359
359
  return (values || []).map((value) => {
360
360
  if (value.enabled) {
361
361
  if (props.column.type === COLUMN_1.COLUMN.IMAGE) {
362
- return value.valueid;
362
+ return value.valueid || value.imageUrl || value.value;
363
363
  }
364
364
  else {
365
365
  return value.value;
@@ -7,6 +7,7 @@ const FILTER_SECTION_1 = require("../constants/common/FILTER_SECTION");
7
7
  const FILTER_STRUCTURE_VERSION_1 = require("../constants/common/FILTER_STRUCTURE_VERSION");
8
8
  const getLastIndexFromArray_1 = require("../../general/array/getLastIndexFromArray");
9
9
  const isEmpty_1 = require("../../general/mix/isEmpty");
10
+ const cloneDeep_1 = require("../../general/object/cloneDeep");
10
11
  /**
11
12
  * Generates a UI filter data structure from the flatttened UI filters.
12
13
  * @param uFilters Array of flattened filters from UI
@@ -89,8 +90,11 @@ function buildDataset(uFilter) {
89
90
  * @returns an filter structure
90
91
  */
91
92
  function buildFilter(uFilter) {
93
+ uFilter = (0, cloneDeep_1.cloneDeep)(uFilter);
92
94
  const info = !(0, isEmpty_1.isEmpty)(uFilter.extras.info) ? { icon: uFilter.extras.info.icon, label: uFilter.extras.info.label } : undefined;
93
95
  const property = (0, adaptDateGroupingProperty_1.adaptDateGroupingProperty)(uFilter.property);
96
+ delete uFilter.extras.scopeInfo;
97
+ delete uFilter.extras.dataset;
94
98
  return {
95
99
  collapsed: uFilter.collapsed,
96
100
  column: {
@@ -4,6 +4,6 @@ import { OLD_IFilterLogic } from "../interfaces/OLD_IFilterLogic";
4
4
  * @deprecated soon
5
5
  * @param logics
6
6
  * @param summaries
7
- * @returns
7
+ * @returns the filter aggregate structure
8
8
  */
9
9
  export declare function getAggFilters(logics?: OLD_IFilterLogic[], summaries?: any[]): IFBFilterAggregate;
@@ -10,7 +10,7 @@ const FILTER_OPERATOR_1 = require("../constants/common/FILTER_OPERATOR");
10
10
  * @deprecated soon
11
11
  * @param logics
12
12
  * @param summaries
13
- * @returns
13
+ * @returns the filter aggregate structure
14
14
  */
15
15
  function getAggFilters(logics = [], summaries = []) {
16
16
  const aggregateFilters = getAggregateFilters(logics);
@@ -23,7 +23,7 @@ function getBackendProperty(filter) {
23
23
  return filter.property.concat('_').concat(filter.lookupDisplayIndex.toString());
24
24
  }
25
25
  else if (filter.column.type === COLUMN_1.COLUMN.IMAGE) {
26
- return COLUMN_PROPERTY_1.COLUMN_PROPERTY.IMAGE_ANSWER_ID;
26
+ return filter.values.every(value => (0, isEmpty_1.isEmpty)(value.valueid)) ? undefined : COLUMN_PROPERTY_1.COLUMN_PROPERTY.IMAGE_ANSWER_ID;
27
27
  }
28
28
  }
29
29
  return filter.property;
@@ -77,7 +77,7 @@ function getResultValues(values, filter) {
77
77
  return (values || []).map((value) => {
78
78
  if (value.enabled) {
79
79
  if (filter.column.type === COLUMN_1.COLUMN.IMAGE) {
80
- return value.valueid;
80
+ return value.valueid || value.imageUrl || value.value;
81
81
  }
82
82
  else {
83
83
  return value.value;
@@ -4,6 +4,6 @@
4
4
  export interface IFSValue {
5
5
  enabled?: boolean;
6
6
  imageUrl?: string;
7
- value: string;
7
+ value?: string;
8
8
  valueid?: string;
9
9
  }
@@ -4,6 +4,6 @@
4
4
  export interface IFUValue {
5
5
  enabled?: boolean;
6
6
  imageUrl?: string;
7
- value: string;
7
+ value?: string;
8
8
  valueid?: string;
9
9
  }
@@ -9,7 +9,7 @@ export default class UChartPaginationApi {
9
9
  uFilter: IFUFlattenedFilter;
10
10
  /**
11
11
  * Gets afterKey object
12
- * @returns
12
+ * @returns the afterKey object
13
13
  */
14
14
  getAfterKey: () => any;
15
15
  /**
@@ -38,7 +38,7 @@ export default class UChartPaginationApi {
38
38
  /**
39
39
  * Get a dimension body structure foor pagination endpoint
40
40
  * @param dimensions
41
- * @returns
41
+ * @returns the dimension body structure
42
42
  */
43
43
  private _getDimensionsBodyAdapter;
44
44
  /**
@@ -21,7 +21,7 @@ class UChartPaginationApi {
21
21
  constructor() {
22
22
  /**
23
23
  * Gets afterKey object
24
- * @returns
24
+ * @returns the afterKey object
25
25
  */
26
26
  this.getAfterKey = () => {
27
27
  return this.afterKey;
@@ -100,7 +100,7 @@ class UChartPaginationApi {
100
100
  /**
101
101
  * Get a dimension body structure foor pagination endpoint
102
102
  * @param dimensions
103
- * @returns
103
+ * @returns the dimension body structure
104
104
  */
105
105
  this._getDimensionsBodyAdapter = (dimensions = []) => {
106
106
  return dimensions.map(dimension => ({
@@ -27,7 +27,8 @@ function formatDate(dateString, format) {
27
27
  return dateString;
28
28
  if (!isValidDateString(dateString))
29
29
  return dateString;
30
- return (0, dayjs_1.default)(dateString.split('.')[0]).format(format.replace('HH24:', 'HH:').replace('MI:SS', 'mm:ss').replace('MM:SS', 'mm:ss'));
30
+ const dateValue = dateString === null || dateString === void 0 ? void 0 : dateString.replace(/Z$/i, '');
31
+ return (0, dayjs_1.default)(dateValue.split('.')[0]).format(format.replace('HH24:', 'HH:').replace('MI:SS', 'mm:ss').replace('MM:SS', 'mm:ss'));
31
32
  }
32
33
  exports.formatDate = formatDate;
33
34
  function formatAbbreviated(num, decimals) {
@@ -85,12 +86,13 @@ function formatFileSize(bytes) {
85
86
  }
86
87
  exports.formatFileSize = formatFileSize;
87
88
  const addFormat = (value, outputFormat = 'None', config) => {
89
+ var _a, _b;
88
90
  if ((0, isEmpty_1.isEmpty)(value) || typeof value === 'object' && (0, isEmpty_1.isEmpty)(value[0]))
89
91
  return value;
90
92
  switch (outputFormat.type) {
91
93
  case 'DATE':
92
94
  case 'DATETIME':
93
- return (config === null || config === void 0 ? void 0 : config.lang) && outputFormat.format === 'Default' ? (0, localization_1.formatWithLocale)(value, outputFormat, config) : formatDate(value, outputFormat.format);
95
+ return (config === null || config === void 0 ? void 0 : config.lang) && outputFormat.format === 'Default' ? (0, localization_1.formatWithLocale)(value, outputFormat, config) : formatDate(value, (outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format) === 'Default' && ((_a = outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.originalFormat) === null || _a === void 0 ? void 0 : _a.format) ? (_b = outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.originalFormat) === null || _b === void 0 ? void 0 : _b.format : outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format);
94
96
  case 'NUMERIC': {
95
97
  const parse = parseFloat(value);
96
98
  const withLocale = outputFormat !== 'None' && (config === null || config === void 0 ? void 0 : config.lang);
@@ -32,7 +32,7 @@ const formatWithLocale = (value, outputFormat, config = {}) => {
32
32
  exports.formatWithLocale = formatWithLocale;
33
33
  function formatLocaleDate(value, outputFormat, config) {
34
34
  const { lang = definition_1.LANG_DEFAULT, options } = config;
35
- const dateValue = value === null || value === void 0 ? void 0 : value.replace('.000Z', '');
35
+ const dateValue = value === null || value === void 0 ? void 0 : value.replace(/Z$/i, '');
36
36
  const dateParam = new Date(dateValue);
37
37
  let langOpts = options;
38
38
  if (outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.originalFormat) {
@@ -6,6 +6,7 @@ const isNumericalColumn_1 = require("../../columns/helpers/isNumericalColumn");
6
6
  const DATE_GROUPING_PROPERTY_1 = require("../../dates/constants/DATE_GROUPING_PROPERTY");
7
7
  const DATE_GROUPING_TIME_PROPERTY_1 = require("../../dates/constants/DATE_GROUPING_TIME_PROPERTY");
8
8
  const format_1 = require("../../format/format");
9
+ const isEmpty_1 = require("../../general/mix/isEmpty");
9
10
  const getI18nDateGroupLabel_1 = require("../../globalization/helpers/getI18nDateGroupLabel");
10
11
  const getValueWithSuffixes_1 = require("./getValueWithSuffixes");
11
12
  /**
@@ -15,6 +16,8 @@ const getValueWithSuffixes_1 = require("./getValueWithSuffixes");
15
16
  * @returns A transformed value
16
17
  */
17
18
  function transformValue(value, settings) {
19
+ if ((0, isEmpty_1.isEmpty)(value))
20
+ return value;
18
21
  const valueWithI18n = (0, getI18nDateGroupLabel_1.getI18nDateGroupLabel)(value, settings.property, settings.translate);
19
22
  const valueWithLocalization = (0, format_1.addFormat)(valueWithI18n, getOutputFormat(settings), getFormatConfig(settings));
20
23
  return (0, getValueWithSuffixes_1.getValueWithSuffixes)(valueWithLocalization, { suffixTranslateLabel: settings.suffixTranslateLabel, translate: settings.translate });
@@ -1,8 +1,8 @@
1
1
  import { IBModelBranchesMap } from "../../qrvey/interfaces/IBModelBranchesMap";
2
2
  import { IModelBranchesMap } from "../../qrvey/interfaces/IModelBranchesMap";
3
3
  /**
4
- *
5
- * @param branchesMap
6
- * @returns
4
+ * Adapts the branches map from backend to the UI branches map
5
+ * @param branchesMap the backend branches map
6
+ * @returns The Branches map array
7
7
  */
8
8
  export declare function BBranchesMapToUIBranchesMap(branchesMap: IBModelBranchesMap[]): IModelBranchesMap[];
@@ -4,9 +4,9 @@ exports.BBranchesMapToUIBranchesMap = void 0;
4
4
  const isEmpty_1 = require("../../general/mix/isEmpty");
5
5
  const BColumnsToUIColumns_adapter_1 = require("./BColumnsToUIColumns.adapter");
6
6
  /**
7
- *
8
- * @param branchesMap
9
- * @returns
7
+ * Adapts the branches map from backend to the UI branches map
8
+ * @param branchesMap the backend branches map
9
+ * @returns The Branches map array
10
10
  */
11
11
  function BBranchesMapToUIBranchesMap(branchesMap) {
12
12
  if ((0, isEmpty_1.isEmpty)(branchesMap))
@@ -7,7 +7,7 @@ import { COLUMN } from "../../columns/constants/COLUMN";
7
7
  * @returns A new value array with the filled properties.
8
8
  */
9
9
  export function adaptFilterValues(filter) {
10
- const setValue = value => (Object.assign(Object.assign({}, value), { enabled: isEmpty(value.enabled) ? true : value.enabled }));
10
+ const setValue = value => (Object.assign(Object.assign({}, value), { value: isEmpty(value.value) ? undefined : value.value, enabled: isEmpty(value.enabled) ? true : value.enabled }));
11
11
  if (filter.column.type === COLUMN.RANKING && isEmpty(filter.column.aggregate)) {
12
12
  return (filter.values || []).map(rValues => rValues.map(setValue));
13
13
  }
@@ -3,6 +3,7 @@ import { isEmpty } from "../../general/mix/isEmpty";
3
3
  import { adaptFilterValues } from "./adaptFilterValues";
4
4
  import { FILTER_SECTION } from "../constants/common/FILTER_SECTION";
5
5
  import { FILTER_STRUCTURE_VERSION } from "../constants/common/FILTER_STRUCTURE_VERSION";
6
+ import { cloneDeep } from "../../general/object/cloneDeep";
6
7
  /**
7
8
  * Generates a filter data structure from the flatttened UI filters.
8
9
  * @param uFilters Array of flattened filters from UI
@@ -78,8 +79,11 @@ function buildDataset(uFilter) {
78
79
  * @returns an filter structure
79
80
  */
80
81
  function buildFilter(uFilter) {
82
+ uFilter = cloneDeep(uFilter);
81
83
  const info = !isEmpty(uFilter.extras.info) ? { icon: uFilter.extras.info.icon, label: uFilter.extras.info.label } : undefined;
82
84
  const property = adaptDateGroupingProperty(uFilter.property);
85
+ delete uFilter.extras.scopeInfo;
86
+ delete uFilter.extras.dataset;
83
87
  return {
84
88
  collapsed: uFilter.collapsed,
85
89
  column: {
@@ -353,7 +353,7 @@ function getResultValues(values, props) {
353
353
  return (values || []).map((value) => {
354
354
  if (value.enabled) {
355
355
  if (props.column.type === COLUMN.IMAGE) {
356
- return value.valueid;
356
+ return value.valueid || value.imageUrl || value.value;
357
357
  }
358
358
  else {
359
359
  return value.value;
@@ -4,6 +4,7 @@ import { FILTER_SECTION } from "../constants/common/FILTER_SECTION";
4
4
  import { FILTER_STRUCTURE_VERSION } from "../constants/common/FILTER_STRUCTURE_VERSION";
5
5
  import { getLastIndexFromArray } from "../../general/array/getLastIndexFromArray";
6
6
  import { isEmpty } from "../../general/mix/isEmpty";
7
+ import { cloneDeep } from "../../general/object/cloneDeep";
7
8
  /**
8
9
  * Generates a UI filter data structure from the flatttened UI filters.
9
10
  * @param uFilters Array of flattened filters from UI
@@ -85,8 +86,11 @@ function buildDataset(uFilter) {
85
86
  * @returns an filter structure
86
87
  */
87
88
  function buildFilter(uFilter) {
89
+ uFilter = cloneDeep(uFilter);
88
90
  const info = !isEmpty(uFilter.extras.info) ? { icon: uFilter.extras.info.icon, label: uFilter.extras.info.label } : undefined;
89
91
  const property = adaptDateGroupingProperty(uFilter.property);
92
+ delete uFilter.extras.scopeInfo;
93
+ delete uFilter.extras.dataset;
90
94
  return {
91
95
  collapsed: uFilter.collapsed,
92
96
  column: {
@@ -4,6 +4,6 @@ import { OLD_IFilterLogic } from "../interfaces/OLD_IFilterLogic";
4
4
  * @deprecated soon
5
5
  * @param logics
6
6
  * @param summaries
7
- * @returns
7
+ * @returns the filter aggregate structure
8
8
  */
9
9
  export declare function getAggFilters(logics?: OLD_IFilterLogic[], summaries?: any[]): IFBFilterAggregate;
@@ -7,7 +7,7 @@ import { FILTER_OPERATOR } from "../constants/common/FILTER_OPERATOR";
7
7
  * @deprecated soon
8
8
  * @param logics
9
9
  * @param summaries
10
- * @returns
10
+ * @returns the filter aggregate structure
11
11
  */
12
12
  export function getAggFilters(logics = [], summaries = []) {
13
13
  const aggregateFilters = getAggregateFilters(logics);
@@ -20,7 +20,7 @@ export function getBackendProperty(filter) {
20
20
  return filter.property.concat('_').concat(filter.lookupDisplayIndex.toString());
21
21
  }
22
22
  else if (filter.column.type === COLUMN.IMAGE) {
23
- return COLUMN_PROPERTY.IMAGE_ANSWER_ID;
23
+ return filter.values.every(value => isEmpty(value.valueid)) ? undefined : COLUMN_PROPERTY.IMAGE_ANSWER_ID;
24
24
  }
25
25
  }
26
26
  return filter.property;
@@ -73,7 +73,7 @@ function getResultValues(values, filter) {
73
73
  return (values || []).map((value) => {
74
74
  if (value.enabled) {
75
75
  if (filter.column.type === COLUMN.IMAGE) {
76
- return value.valueid;
76
+ return value.valueid || value.imageUrl || value.value;
77
77
  }
78
78
  else {
79
79
  return value.value;
@@ -4,6 +4,6 @@
4
4
  export interface IFSValue {
5
5
  enabled?: boolean;
6
6
  imageUrl?: string;
7
- value: string;
7
+ value?: string;
8
8
  valueid?: string;
9
9
  }
@@ -4,6 +4,6 @@
4
4
  export interface IFUValue {
5
5
  enabled?: boolean;
6
6
  imageUrl?: string;
7
- value: string;
7
+ value?: string;
8
8
  valueid?: string;
9
9
  }
@@ -9,7 +9,7 @@ export default class UChartPaginationApi {
9
9
  uFilter: IFUFlattenedFilter;
10
10
  /**
11
11
  * Gets afterKey object
12
- * @returns
12
+ * @returns the afterKey object
13
13
  */
14
14
  getAfterKey: () => any;
15
15
  /**
@@ -38,7 +38,7 @@ export default class UChartPaginationApi {
38
38
  /**
39
39
  * Get a dimension body structure foor pagination endpoint
40
40
  * @param dimensions
41
- * @returns
41
+ * @returns the dimension body structure
42
42
  */
43
43
  private _getDimensionsBodyAdapter;
44
44
  /**
@@ -16,7 +16,7 @@ export default class UChartPaginationApi {
16
16
  constructor() {
17
17
  /**
18
18
  * Gets afterKey object
19
- * @returns
19
+ * @returns the afterKey object
20
20
  */
21
21
  this.getAfterKey = () => {
22
22
  return this.afterKey;
@@ -95,7 +95,7 @@ export default class UChartPaginationApi {
95
95
  /**
96
96
  * Get a dimension body structure foor pagination endpoint
97
97
  * @param dimensions
98
- * @returns
98
+ * @returns the dimension body structure
99
99
  */
100
100
  this._getDimensionsBodyAdapter = (dimensions = []) => {
101
101
  return dimensions.map(dimension => ({
@@ -21,7 +21,8 @@ export function formatDate(dateString, format) {
21
21
  return dateString;
22
22
  if (!isValidDateString(dateString))
23
23
  return dateString;
24
- return dayjs(dateString.split('.')[0]).format(format.replace('HH24:', 'HH:').replace('MI:SS', 'mm:ss').replace('MM:SS', 'mm:ss'));
24
+ const dateValue = dateString === null || dateString === void 0 ? void 0 : dateString.replace(/Z$/i, '');
25
+ return dayjs(dateValue.split('.')[0]).format(format.replace('HH24:', 'HH:').replace('MI:SS', 'mm:ss').replace('MM:SS', 'mm:ss'));
25
26
  }
26
27
  export function formatAbbreviated(num, decimals) {
27
28
  if (num == 0)
@@ -76,12 +77,13 @@ export function formatFileSize(bytes) {
76
77
  return megaBytes < 10 ? `${fixDecimals(megaBytes)} MB` : `${Math.round(megaBytes)} MB`;
77
78
  }
78
79
  export const addFormat = (value, outputFormat = 'None', config) => {
80
+ var _a, _b;
79
81
  if (isEmpty(value) || typeof value === 'object' && isEmpty(value[0]))
80
82
  return value;
81
83
  switch (outputFormat.type) {
82
84
  case 'DATE':
83
85
  case 'DATETIME':
84
- return (config === null || config === void 0 ? void 0 : config.lang) && outputFormat.format === 'Default' ? formatWithLocale(value, outputFormat, config) : formatDate(value, outputFormat.format);
86
+ return (config === null || config === void 0 ? void 0 : config.lang) && outputFormat.format === 'Default' ? formatWithLocale(value, outputFormat, config) : formatDate(value, (outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format) === 'Default' && ((_a = outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.originalFormat) === null || _a === void 0 ? void 0 : _a.format) ? (_b = outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.originalFormat) === null || _b === void 0 ? void 0 : _b.format : outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format);
85
87
  case 'NUMERIC': {
86
88
  const parse = parseFloat(value);
87
89
  const withLocale = outputFormat !== 'None' && (config === null || config === void 0 ? void 0 : config.lang);
@@ -26,7 +26,7 @@ export const formatWithLocale = (value, outputFormat, config = {}) => {
26
26
  };
27
27
  function formatLocaleDate(value, outputFormat, config) {
28
28
  const { lang = LANG_DEFAULT, options } = config;
29
- const dateValue = value === null || value === void 0 ? void 0 : value.replace('.000Z', '');
29
+ const dateValue = value === null || value === void 0 ? void 0 : value.replace(/Z$/i, '');
30
30
  const dateParam = new Date(dateValue);
31
31
  let langOpts = options;
32
32
  if (outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.originalFormat) {
@@ -3,6 +3,7 @@ import { isNumericalColumn } from "../../columns/helpers/isNumericalColumn";
3
3
  import { DATE_GROUPING_PROPERTY } from "../../dates/constants/DATE_GROUPING_PROPERTY";
4
4
  import { DATE_GROUPING_TIME_PROPERTY } from "../../dates/constants/DATE_GROUPING_TIME_PROPERTY";
5
5
  import { addFormat } from "../../format/format";
6
+ import { isEmpty } from "../../general/mix/isEmpty";
6
7
  import { getI18nDateGroupLabel } from "../../globalization/helpers/getI18nDateGroupLabel";
7
8
  import { getValueWithSuffixes } from "./getValueWithSuffixes";
8
9
  /**
@@ -12,6 +13,8 @@ import { getValueWithSuffixes } from "./getValueWithSuffixes";
12
13
  * @returns A transformed value
13
14
  */
14
15
  export function transformValue(value, settings) {
16
+ if (isEmpty(value))
17
+ return value;
15
18
  const valueWithI18n = getI18nDateGroupLabel(value, settings.property, settings.translate);
16
19
  const valueWithLocalization = addFormat(valueWithI18n, getOutputFormat(settings), getFormatConfig(settings));
17
20
  return getValueWithSuffixes(valueWithLocalization, { suffixTranslateLabel: settings.suffixTranslateLabel, translate: settings.translate });
@@ -1,8 +1,8 @@
1
1
  import { IBModelBranchesMap } from "../../qrvey/interfaces/IBModelBranchesMap";
2
2
  import { IModelBranchesMap } from "../../qrvey/interfaces/IModelBranchesMap";
3
3
  /**
4
- *
5
- * @param branchesMap
6
- * @returns
4
+ * Adapts the branches map from backend to the UI branches map
5
+ * @param branchesMap the backend branches map
6
+ * @returns The Branches map array
7
7
  */
8
8
  export declare function BBranchesMapToUIBranchesMap(branchesMap: IBModelBranchesMap[]): IModelBranchesMap[];
@@ -1,9 +1,9 @@
1
1
  import { isEmpty } from "../../general/mix/isEmpty";
2
2
  import { BColumnsToUIColumns } from "./BColumnsToUIColumns.adapter";
3
3
  /**
4
- *
5
- * @param branchesMap
6
- * @returns
4
+ * Adapts the branches map from backend to the UI branches map
5
+ * @param branchesMap the backend branches map
6
+ * @returns The Branches map array
7
7
  */
8
8
  export function BBranchesMapToUIBranchesMap(branchesMap) {
9
9
  if (isEmpty(branchesMap))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qrvey/utils",
3
- "version": "1.2.10-3",
3
+ "version": "1.2.10-6",
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",
@@ -19,15 +19,16 @@
19
19
  "license": "MIT",
20
20
  "devDependencies": {
21
21
  "@types/jest": "27.4.1",
22
+ "@typescript-eslint/eslint-plugin": "5.15.0",
23
+ "@typescript-eslint/parser": "5.15.0",
22
24
  "doxdox": "3.0.0",
25
+ "eslint": "8.11.0",
23
26
  "jest": "27.5.1",
27
+ "jsdoc": "3.6.10",
24
28
  "np": "7.6.0",
25
29
  "ts-jest": "27.1.3",
26
30
  "typedoc": "0.22.13",
27
- "typescript": "4.6.2",
28
- "@typescript-eslint/eslint-plugin": "5.15.0",
29
- "@typescript-eslint/parser": "5.15.0",
30
- "eslint": "8.11.0"
31
+ "typescript": "4.6.2"
31
32
  },
32
33
  "dependencies": {
33
34
  "d3": "6.3.1",
package/publishing.js CHANGED
@@ -1,5 +1,8 @@
1
- // IN DEVELOPMENT
2
-
1
+ /**
2
+ * New version for publishing a new version of Qrvey Utils
3
+ * 1- Publish the version with np
4
+ * 2- Update the README.md doc with doxdox
5
+ */
3
6
 
4
7
  const fs = require('fs');
5
8
  const util = require('util');
@@ -8,6 +11,7 @@ const exec = util.promisify(childProcess.exec);
8
11
  const spawn = childProcess.spawn;
9
12
  const proc = require('process');
10
13
  const readline = require("readline");
14
+ const { exit } = require('process');
11
15
  const rl = readline.createInterface({
12
16
  input: proc.stdin,
13
17
  output: proc.stdout
@@ -18,7 +22,6 @@ const question = util.promisify(rl.question).bind(rl);
18
22
  async function execute(command) {
19
23
  console.log(command);
20
24
  const response = await exec(command);
21
- console.log('response', response);
22
25
  if (response.error != null) {
23
26
  throw new Error(response.error);
24
27
  }
@@ -31,10 +34,10 @@ async function execute(command) {
31
34
  return response;
32
35
  }
33
36
 
34
- //todo: fix the spawning function to wait for the second process to finish and then continue the next code
35
37
  async function spawning(command, sArguments) {
36
- const newProcess = await new Promise(function (resolve, reject) {
37
- spawn(command, sArguments, { shell: true });
38
+ let newProcess;
39
+ await new Promise(function (resolve, reject) {
40
+ newProcess = spawn(command, sArguments, { shell: true });
38
41
  newProcess.stdout.on("data", data => {
39
42
  console.log(`stdout: ${data}`);
40
43
  });
@@ -43,75 +46,76 @@ async function spawning(command, sArguments) {
43
46
  console.log(`stderr: ${data}`);
44
47
  });
45
48
 
46
- newProcess.on('error', (error) => {
49
+ newProcess.on('error', (_error) => {
50
+ newProcess.stdin.pause();
51
+ newProcess.stdin.destroy();
52
+ newProcess.stdout.pause();
53
+ newProcess.stdout.destroy();
54
+ newProcess.kill();
47
55
  reject();
48
- throw new Error(error.message);
49
56
  });
50
57
 
51
58
  newProcess.on("close", code => {
59
+ newProcess.stdin.pause();
60
+ newProcess.stdin.destroy();
61
+ newProcess.stdout.pause();
62
+ newProcess.stdout.destroy();
63
+ newProcess.kill();
52
64
  if (code == '1') {
53
65
  reject();
54
- throw new Error(`child process exited with code ${code}`);
55
66
  }
56
67
  resolve();
57
68
  });
58
69
  });
59
70
  }
60
71
 
61
- async function openingPackageJson(settings) {
62
- console.log('>>> Opening package.json file...');
72
+ async function getPackageJson(settings) {
73
+ console.log('==>>> Opening package.json file...');
63
74
  const packageJson = await fs.readFileSync(settings.packagePath, 'utf8');
64
75
  const packageObject = JSON.parse(packageJson);
65
76
  if (packageObject != null) {
66
- console.log(`The current version is ${packageObject.version}`);
77
+ console.log(`**** The current version is ${packageObject.version}`);
67
78
  return packageObject.version;
68
79
  }
69
80
  return '';
70
81
  }
71
82
 
83
+ async function getNewVersion() {
84
+ console.log('==>>> Checking the new version provided...');
85
+ let newVersion;
86
+ const versionIndex = proc.argv.findIndex(function (argv) { return argv.includes('--np-new-version='); });
87
+ if (versionIndex > -1) {
88
+ const versionArg = proc.argv[versionIndex].split('--np-new-version=');
89
+ newVersion = versionArg[1] == null || versionArg[1] === '' ? undefined : versionArg[1];
90
+ }
91
+ if (newVersion == null) {
92
+ newVersion = question('No version provided. Type the new version: ');
93
+ }
94
+ console.log('**** Version to publish: ' + newVersion);
95
+ return newVersion;
96
+ }
97
+
72
98
  async function cleaningProject(settings) {
73
- console.log('>>> Cleaning project...');
99
+ console.log('==>>> Cleaning project...');
74
100
  await execute(`rm -f ${settings.packageLockPath}`);
75
101
  await execute(`rm -f -R ${settings.nodeModulesPath}`);
76
102
  await execute(`rm -f -R ${settings.distPath}`);
77
103
  }
78
104
 
79
105
  async function buildingBundle(_settings) {
80
- console.log('>>> Installing Dependencies...');
106
+ console.log('==>>> Installing Dependencies...');
81
107
  await execute('npm install');
82
108
 
83
- console.log('>>> Generating Build...');
109
+ console.log('==>>> Generating Build...');
84
110
  await execute('npm run build');
85
111
  }
86
112
 
87
- async function generatingDocument(settings) {
88
- console.log('>>> Generating Document...');
89
- await execute(`doxdox './dist/.+\\.js' --output ${settings.docsFileName} --ignore './dist/cjs/.+\\.js' --package ${settings.packagePath}`);
90
- }
91
-
92
- async function pushingChanges(settings) {
93
- console.log('>>> Commiting and Pushing Docs changes...');
94
-
95
- const stdout = await execute('git rev-parse --abbrev-ref HEAD');
96
- await execute(`git add ${settings.docsPath}`);
97
- await execute(`git commit -m "📝 docs: Updated docs${settings.packageVersion !== '' ? ' for ' + settings.packageVersion : ''}"`);
98
- await execute(`git push -u origin ${stdout}`);
99
- }
100
-
101
- async function revertChanges(settings) {
102
- console.log('>>> Checking for modifications...');
103
- console.warn(`>>> Unstaging posible changes from ${settings.docsFileName} file`);
104
- await execute(`git restore --staged ${settings.docsPath}`);
105
- console.warn(`>>> Discarting posible changes of ${settings.docsFileName} file`);
106
- await execute(`git checkout -- ${settings.docsPath}`);
107
- }
108
-
109
113
  async function startPublishingVersion(settings) {
110
114
  await callingPublisher(settings);
111
115
  }
112
116
 
113
117
  async function callingPublisher(settings) {
114
- console.log('>>> Calling Publisher');
118
+ console.log('==>>> Calling Publisher');
115
119
  let anyBranch = '', tag = '';
116
120
  const anyBranchIndex = proc.argv.findIndex(function (argv) { return argv.includes('--np-any-branch='); });
117
121
  const tagIndex = proc.argv.findIndex(function (argv) { return argv.includes('--np-tag='); });
@@ -123,45 +127,56 @@ async function callingPublisher(settings) {
123
127
  const tagArg = proc.argv[tagIndex].split('--np-tag=');
124
128
  tag = tagArg[1] == null || tagArg[1] === '' ? '' : proc.argv[tagIndex].replace('--np-tag=', '--tag=');
125
129
  }
126
- // await execute(`np ${settings.newVersion} ${anyBranch} ${tag}`);
127
130
  await spawning(`np ${settings.newVersion}`, [anyBranch, tag]);
128
131
  }
129
132
 
130
133
  async function startGeneratingDocs(settings) {
131
- console.log('>>> Starting of the Docs generation.');
134
+ console.log('==>>> Starting the Docs generation');
132
135
 
133
136
  await generatingDocument(settings);
134
137
  await pushingChanges(settings);
135
138
  }
136
139
 
137
- async function getNewVersion() {
138
- let newVersion;
139
- const versionIndex = proc.argv.findIndex(function (argv) { return argv.includes('--np-new-version='); });
140
- if (versionIndex > -1) {
141
- const versionArg = proc.argv[versionIndex].split('--np-new-version=');
142
- newVersion = versionArg[1] == null || versionArg[1] === '' ? undefined : versionArg[1];
143
- }
144
- if (newVersion == null) {
145
- newVersion = question('No version provided. Type the new version: ');
146
- }
147
- return newVersion;
140
+ async function generatingDocument(settings) {
141
+ console.log('==>>> Generating Document...');
142
+ await execute(`doxdox './dist/.+\\.js' --output ${settings.docsFileName} --ignore './dist/cjs/.+\\.js' --package ${settings.packagePath}`);
143
+ }
144
+
145
+ async function pushingChanges(settings) {
146
+ console.log('==>>> Commiting and Pushing Docs changes...');
147
+
148
+ const gitStdout = await execute('git rev-parse --abbrev-ref HEAD');
149
+ console.log('gitStdout', gitStdout);
150
+ await execute(`git add ${settings.docsPath}`);
151
+ await execute(`git commit -m "📝 docs: Updated docs${settings.newVersion != null || settings.newVersion !== '' ? ' for ' + settings.newVersion : ''}"`);
152
+ await execute(`git push -u origin ${gitStdout.stdout}`);
153
+ }
154
+
155
+ async function revertChanges(settings) {
156
+ console.log('>>> Checking for modifications...');
157
+ console.warn(`>>> Unstaging posible changes from ${settings.docsFileName} and ${settings.packageFileName} file`);
158
+ await execute(`git restore --staged ${settings.docsPath} ${settings.packagePath}`);
159
+ console.warn(`>>> Discarting posible changes of ${settings.docsFileName} and ${settings.packageFileName} file`);
160
+ await execute(`git checkout -- ${settings.docsPath} ${settings.packagePath}`);
148
161
  }
149
162
 
150
163
  async function init() {
151
164
  let settings = {
165
+ currentVersion: '',
152
166
  distPath: './dist',
153
167
  docsPath: './README.md',
154
168
  docsFileName: 'README.md',
155
169
  newVersion: undefined,
156
170
  nodeModulesPath: './node_modules',
171
+ packageFileName: 'package.json',
157
172
  packageLockPath: './package-lock.json',
158
173
  packagePath: './package.json',
159
- packageVersion: '',
174
+
160
175
  };
161
176
 
162
177
  console.log('Welcome. The publishing operationg will begin.');
163
178
  try {
164
- settings["packageVersion"] = await openingPackageJson(settings);
179
+ settings["currentVersion"] = await getPackageJson(settings);
165
180
  settings["newVersion"] = await getNewVersion();
166
181
 
167
182
  await cleaningProject(settings);
@@ -174,6 +189,7 @@ async function init() {
174
189
  await revertChanges(settings);
175
190
  } finally {
176
191
  console.log('Execution finished');
192
+ exit();
177
193
  }
178
194
  }
179
195
 
@@ -15,7 +15,7 @@ import { IFSValueRelativeDate } from "../interfaces/common/IFSValueRelativeDate"
15
15
  * @returns A new value array with the filled properties.
16
16
  */
17
17
  export function adaptFilterValues(filter: IFSFilter): IFValue[] {
18
- const setValue = value => ({ ...value, enabled: isEmpty(value.enabled) ? true : value.enabled });
18
+ const setValue = value => ({ ...value, value: isEmpty(value.value) ? undefined : value.value, enabled: isEmpty(value.enabled) ? true : value.enabled });
19
19
 
20
20
  if (filter.column.type === COLUMN.RANKING && isEmpty(filter.column.aggregate)) {
21
21
  return ((filter.values || []) as IFSValueRanking[][]).map(rValues => rValues.map(setValue));
@@ -9,6 +9,7 @@ import { IFSData } from "../interfaces/common/IFSData";
9
9
  import { IFSScope } from "../interfaces/common/IFSScope";
10
10
  import { IFSFilter } from "../interfaces/common/IFSFilter";
11
11
  import { IFSDataset } from "../interfaces/common/IFSDataset";
12
+ import { cloneDeep } from "../../general/object/cloneDeep";
12
13
 
13
14
  /**
14
15
  * Generates a filter data structure from the flatttened UI filters.
@@ -90,9 +91,13 @@ function buildDataset(uFilter: IFUFlattenedFilter): IFSDataset {
90
91
  * @returns an filter structure
91
92
  */
92
93
  function buildFilter(uFilter: IFUFlattenedFilter): IFSFilter {
94
+ uFilter = cloneDeep(uFilter);
95
+
93
96
  const info = !isEmpty(uFilter.extras.info) ? { icon: uFilter.extras.info.icon, label: uFilter.extras.info.label } : undefined;
94
97
  const property = adaptDateGroupingProperty(uFilter.property);
95
98
 
99
+ delete uFilter.extras.scopeInfo;
100
+ delete uFilter.extras.dataset;
96
101
  return {
97
102
  collapsed: uFilter.collapsed,
98
103
  column: {
@@ -410,7 +410,7 @@ function getRankingValues(values: IFSValueRanking[][], rankingGroupIndex?: numbe
410
410
  return (values || []).map((value: IFSValue) => {
411
411
  if (value.enabled) {
412
412
  if (props.column.type === COLUMN.IMAGE) {
413
- return value.valueid;
413
+ return value.valueid || value.imageUrl || value.value;
414
414
  } else {
415
415
  return value.value;
416
416
  }
@@ -10,6 +10,7 @@ import { IFUFilter } from "../interfaces/ui/IFUFilter";
10
10
  import { IFUDataset } from "../interfaces/ui/IFUDataset";
11
11
  import { getLastIndexFromArray } from "../../general/array/getLastIndexFromArray";
12
12
  import { isEmpty } from "../../general/mix/isEmpty";
13
+ import { cloneDeep } from "../../general/object/cloneDeep";
13
14
 
14
15
  /**
15
16
  * Generates a UI filter data structure from the flatttened UI filters.
@@ -96,9 +97,13 @@ function buildDataset(uFilter: IFUFlattenedFilter): IFUDataset {
96
97
  * @returns an filter structure
97
98
  */
98
99
  function buildFilter(uFilter: IFUFlattenedFilter): IFUFilter {
100
+ uFilter = cloneDeep(uFilter);
101
+
99
102
  const info = !isEmpty(uFilter.extras.info) ? { icon: uFilter.extras.info.icon, label: uFilter.extras.info.label } : undefined;
100
103
  const property = adaptDateGroupingProperty(uFilter.property);
101
104
 
105
+ delete uFilter.extras.scopeInfo;
106
+ delete uFilter.extras.dataset;
102
107
  return {
103
108
  collapsed: uFilter.collapsed,
104
109
  column: {
@@ -13,7 +13,7 @@ import { OLD_IFilterLogic } from "../interfaces/OLD_IFilterLogic";
13
13
  * @deprecated soon
14
14
  * @param logics
15
15
  * @param summaries
16
- * @returns
16
+ * @returns the filter aggregate structure
17
17
  */
18
18
  export function getAggFilters(logics: OLD_IFilterLogic[] = [], summaries: any[] = []): IFBFilterAggregate {
19
19
  const aggregateFilters: OLD_IFilterLogic[] = getAggregateFilters(logics) as OLD_IFilterLogic[];
@@ -3,6 +3,7 @@ import { COLUMN_PROPERTY } from "../../../columns/constants/COLUMN_PROPERTY";
3
3
  import { isDateColumn } from "../../../columns/helpers/isDateColumn";
4
4
  import { isEmpty } from "../../../general/mix/isEmpty";
5
5
  import { IFSFilter } from "../../interfaces/common/IFSFilter";
6
+ import { IFSValue } from "../../interfaces/common/IFSValue";
6
7
  import { IFProperty } from "../../interfaces/IFProperty";
7
8
  import { isNullValidator } from "../common/isNullValidator";
8
9
 
@@ -20,7 +21,7 @@ export function getBackendProperty(filter: IFSFilter): IFProperty {
20
21
  } else if (filter.column.type === COLUMN.LOOKUP && filter.property === COLUMN_PROPERTY.LOOKUP_DISPLAY && filter.lookupDisplayIndex != null) {
21
22
  return filter.property.concat('_').concat(filter.lookupDisplayIndex.toString()) as any;
22
23
  } else if (filter.column.type === COLUMN.IMAGE) {
23
- return COLUMN_PROPERTY.IMAGE_ANSWER_ID;
24
+ return (filter.values as IFSValue[]).every(value => isEmpty(value.valueid)) ? undefined : COLUMN_PROPERTY.IMAGE_ANSWER_ID;
24
25
  }
25
26
  }
26
27
  return filter.property;
@@ -84,7 +84,7 @@ function getResultValues(values: IFSValue[], filter: IFSFilter): IFBExpressionVa
84
84
  return (values || []).map((value: IFSValue) => {
85
85
  if (value.enabled) {
86
86
  if (filter.column.type === COLUMN.IMAGE) {
87
- return value.valueid;
87
+ return value.valueid || value.imageUrl || value.value;
88
88
  } else {
89
89
  return value.value;
90
90
  }
@@ -4,6 +4,6 @@
4
4
  export interface IFSValue {
5
5
  enabled?: boolean; // True: the value is enabled; False: the value is disabled
6
6
  imageUrl?: string; // URL for a image. This is common for images column type.
7
- value: string; // The value to filter
7
+ value?: string; // The value to filter
8
8
  valueid?: string; // Mostly for webform columns that need an ID. Alias for answerid in the model object.
9
9
  }
@@ -4,6 +4,6 @@
4
4
  export interface IFUValue {
5
5
  enabled?: boolean; // Optional flag to enabled the value
6
6
  imageUrl?: string; // URL from Image type
7
- value: string; // A string value
7
+ value?: string; // A string value
8
8
  valueid?: string; // For values that need a value ID or answer ID
9
9
  }
@@ -1,5 +1,3 @@
1
-
2
-
3
1
  import { isNumericalColumn } from "../../columns/helpers/isNumericalColumn";
4
2
  import { isDateColumn } from "../../columns/helpers/isDateColumn";
5
3
  import { getAggFilters } from "../helpers/OLD_getAggFilters";
@@ -31,7 +29,7 @@ export default class UChartPaginationApi {
31
29
 
32
30
  /**
33
31
  * Gets afterKey object
34
- * @returns
32
+ * @returns the afterKey object
35
33
  */
36
34
  getAfterKey = (): any => {
37
35
  return this.afterKey;
@@ -127,7 +125,7 @@ export default class UChartPaginationApi {
127
125
  /**
128
126
  * Get a dimension body structure foor pagination endpoint
129
127
  * @param dimensions
130
- * @returns
128
+ * @returns the dimension body structure
131
129
  */
132
130
  private _getDimensionsBodyAdapter = (dimensions = []) => {
133
131
  return dimensions.map(dimension => ({
@@ -23,7 +23,8 @@ function isValidDateString(dateString = '') {
23
23
  export function formatDate(dateString, format) {
24
24
  if (isEmpty(dateString) || !isNaN(dateString) || format === 'Default') return dateString;
25
25
  if (!isValidDateString(dateString)) return dateString;
26
- return dayjs(dateString.split('.')[0]).format(format.replace('HH24:', 'HH:').replace('MI:SS', 'mm:ss').replace('MM:SS', 'mm:ss'));
26
+ const dateValue = dateString?.replace(/Z$/i, '');
27
+ return dayjs(dateValue.split('.')[0]).format(format.replace('HH24:', 'HH:').replace('MI:SS', 'mm:ss').replace('MM:SS', 'mm:ss'));
27
28
  }
28
29
 
29
30
  export function formatAbbreviated(num, decimals) {
@@ -89,7 +90,7 @@ export const addFormat = (value: any, outputFormat: any = 'None', config?: IForm
89
90
  switch (outputFormat.type) {
90
91
  case 'DATE':
91
92
  case 'DATETIME':
92
- return config?.lang && outputFormat.format === 'Default' ? formatWithLocale(value, outputFormat, config) : formatDate(value, outputFormat.format);
93
+ return config?.lang && outputFormat.format === 'Default' ? formatWithLocale(value, outputFormat, config) : formatDate(value, outputFormat?.format === 'Default' && outputFormat?.originalFormat?.format ? outputFormat?.originalFormat?.format : outputFormat?.format);
93
94
  case 'NUMERIC': {
94
95
  const parse = parseFloat(value);
95
96
  const withLocale = outputFormat !== 'None' && config?.lang;
@@ -29,7 +29,7 @@ export const formatWithLocale = (value: any, outputFormat: IFormatOutputFormat,
29
29
 
30
30
  function formatLocaleDate(value: any, outputFormat: IFormatOutputFormat, config: IFormatConfig) {
31
31
  const { lang = LANG_DEFAULT, options } = config;
32
- const dateValue = value?.replace('.000Z', '');
32
+ const dateValue = value?.replace(/Z$/i, '');
33
33
  const dateParam = new Date(dateValue);
34
34
  let langOpts = options;
35
35
  if (outputFormat?.originalFormat) {
@@ -4,6 +4,7 @@ import { IDateColumnPropertyType } from "../../columns/interfaces/IDateColumnPro
4
4
  import { DATE_GROUPING_PROPERTY } from "../../dates/constants/DATE_GROUPING_PROPERTY";
5
5
  import { DATE_GROUPING_TIME_PROPERTY } from "../../dates/constants/DATE_GROUPING_TIME_PROPERTY";
6
6
  import { addFormat } from "../../format/format";
7
+ import { isEmpty } from "../../general/mix/isEmpty";
7
8
  import { getI18nDateGroupLabel } from "../../globalization/helpers/getI18nDateGroupLabel";
8
9
  import { ITransformValueSettings } from "../interfaces/ITransformValueSettings";
9
10
  import { getValueWithSuffixes } from "./getValueWithSuffixes";
@@ -15,6 +16,8 @@ import { getValueWithSuffixes } from "./getValueWithSuffixes";
15
16
  * @returns A transformed value
16
17
  */
17
18
  export function transformValue(value: string, settings: ITransformValueSettings): string {
19
+ if (isEmpty(value)) return value;
20
+
18
21
  const valueWithI18n = getI18nDateGroupLabel(value, settings.property as IDateColumnPropertyType, settings.translate);
19
22
 
20
23
  const valueWithLocalization = addFormat(valueWithI18n, getOutputFormat(settings), getFormatConfig(settings));
@@ -4,9 +4,9 @@ import { IModelBranchesMap } from "../../qrvey/interfaces/IModelBranchesMap";
4
4
  import { BColumnsToUIColumns } from "./BColumnsToUIColumns.adapter";
5
5
 
6
6
  /**
7
- *
8
- * @param branchesMap
9
- * @returns
7
+ * Adapts the branches map from backend to the UI branches map
8
+ * @param branchesMap the backend branches map
9
+ * @returns The Branches map array
10
10
  */
11
11
  export function BBranchesMapToUIBranchesMap(branchesMap: IBModelBranchesMap[]): IModelBranchesMap[] {
12
12
  if (isEmpty(branchesMap)) return [];