@qrvey/utils 1.2.10-2 → 1.2.10-3

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 +6 -0
  2. package/dist/cjs/columns/helpers/getModelColumn.js +1 -1
  3. package/dist/cjs/filters/adapters/UIToFD.js +2 -1
  4. package/dist/cjs/filters/adapters/adaptDateGroupingProperty.d.ts +2 -2
  5. package/dist/cjs/filters/adapters/adaptDateGroupingProperty.js +2 -2
  6. package/dist/cjs/filters/helpers/applyHierarchyForAggFilters.d.ts +3 -3
  7. package/dist/cjs/filters/helpers/applyHierarchyForAggFilters.js +3 -3
  8. package/dist/cjs/filters/helpers/backend/getAggFiltersBySummaryIndex.d.ts +5 -3
  9. package/dist/cjs/filters/helpers/backend/getAggFiltersBySummaryIndex.js +5 -3
  10. package/dist/cjs/filters/helpers/backend/getBackendValues.js +3 -1
  11. package/dist/cjs/filters/helpers/getAggFiltersFromFilterData.d.ts +5 -4
  12. package/dist/cjs/filters/helpers/getAggFiltersFromFilterData.js +5 -5
  13. package/dist/cjs/filters/helpers/ui/getUIValues.d.ts +4 -5
  14. package/dist/cjs/filters/helpers/ui/getUIValues.js +4 -5
  15. package/dist/cjs/format/localization.js +2 -1
  16. package/dist/cjs/general/object/get.d.ts +0 -20
  17. package/dist/cjs/general/object/get.js +0 -20
  18. package/dist/cjs/globalization/interfaces/chart_builder/II18nChartBuilderConditionalFormatting.d.ts +2 -0
  19. package/dist/cjs/globalization/labels/chart_builder/I18N_CHART_BUILDER_FORMAT_OPTIONS.js +2 -0
  20. package/dist/columns/helpers/getModelColumn.js +1 -1
  21. package/dist/filters/adapters/UIToFD.js +2 -1
  22. package/dist/filters/adapters/adaptDateGroupingProperty.d.ts +2 -2
  23. package/dist/filters/adapters/adaptDateGroupingProperty.js +2 -2
  24. package/dist/filters/helpers/applyHierarchyForAggFilters.d.ts +3 -3
  25. package/dist/filters/helpers/applyHierarchyForAggFilters.js +3 -3
  26. package/dist/filters/helpers/backend/getAggFiltersBySummaryIndex.d.ts +5 -3
  27. package/dist/filters/helpers/backend/getAggFiltersBySummaryIndex.js +5 -3
  28. package/dist/filters/helpers/backend/getBackendValues.js +3 -1
  29. package/dist/filters/helpers/getAggFiltersFromFilterData.d.ts +5 -4
  30. package/dist/filters/helpers/getAggFiltersFromFilterData.js +5 -5
  31. package/dist/filters/helpers/ui/getUIValues.d.ts +4 -5
  32. package/dist/filters/helpers/ui/getUIValues.js +4 -5
  33. package/dist/format/localization.js +2 -1
  34. package/dist/general/object/get.d.ts +0 -20
  35. package/dist/general/object/get.js +0 -20
  36. package/dist/globalization/interfaces/chart_builder/II18nChartBuilderConditionalFormatting.d.ts +2 -0
  37. package/dist/globalization/labels/chart_builder/I18N_CHART_BUILDER_FORMAT_OPTIONS.js +2 -0
  38. package/jsdoc.config.json +14 -0
  39. package/package.json +3 -1
  40. package/publishing.js +180 -0
  41. package/src/columns/helpers/getModelColumn.ts +1 -1
  42. package/src/filters/adapters/UIToFD.ts +2 -1
  43. package/src/filters/adapters/adaptDateGroupingProperty.ts +2 -2
  44. package/src/filters/helpers/applyHierarchyForAggFilters.ts +3 -3
  45. package/src/filters/helpers/backend/getAggFiltersBySummaryIndex.ts +5 -3
  46. package/src/filters/helpers/backend/getBackendValues.ts +3 -1
  47. package/src/filters/helpers/getAggFiltersFromFilterData.ts +5 -5
  48. package/src/filters/helpers/ui/getUIValues.ts +4 -5
  49. package/src/format/localization.ts +2 -1
  50. package/src/general/object/get.ts +0 -22
  51. package/src/globalization/interfaces/chart_builder/II18nChartBuilderConditionalFormatting.ts +2 -0
  52. package/src/globalization/labels/chart_builder/I18N_CHART_BUILDER_FORMAT_OPTIONS.ts +2 -0
package/README.md CHANGED
@@ -0,0 +1,6 @@
1
+ # [@qrvey/utils](https://bitbucket.org/qrvey/qrvey_utils/wiki/Home) *1.2.10-2*
2
+
3
+ > Helper, Utils for all Qrvey Projects
4
+
5
+
6
+ *Documentation generated with [doxdox](https://github.com/neogeek/doxdox).*
@@ -25,6 +25,6 @@ exports.getModelColumn = getModelColumn;
25
25
  * @returns the question data array from model object
26
26
  */
27
27
  function getQuestionData(model) {
28
- debugger;
28
+ // debugger
29
29
  return (0, get_1._get)(model, 'questions.data', []);
30
30
  }
@@ -24,9 +24,10 @@ function UIToFD(uFilterData) {
24
24
  exports.UIToFD = UIToFD;
25
25
  /**
26
26
  * Builds the Fitler Data structure from UI filter data
27
+ * @private
27
28
  * @param uFilterData The UI filter Data object
28
29
  * @param version the version of the structure
29
- * @returns
30
+ * @returns a Filter Data structure
30
31
  */
31
32
  function UI21ToFD(uFilterData, version) {
32
33
  return {
@@ -2,7 +2,7 @@ import { IFProperty } from "../interfaces/IFProperty";
2
2
  /**
3
3
  * [TODO: For 2022, eliminate this adapter]
4
4
  * Get the new property base on the old date grouping properties
5
- * @param property
6
- * @returns
5
+ * @param property the property to be adapted
6
+ * @returns a adapted property
7
7
  */
8
8
  export declare function adaptDateGroupingProperty(property: IFProperty | any): IFProperty;
@@ -6,8 +6,8 @@ const DATE_DISTINCT_TIME_PROPERTY_1 = require("../../dates/constants/DATE_DISTIN
6
6
  /**
7
7
  * [TODO: For 2022, eliminate this adapter]
8
8
  * Get the new property base on the old date grouping properties
9
- * @param property
10
- * @returns
9
+ * @param property the property to be adapted
10
+ * @returns a adapted property
11
11
  */
12
12
  function adaptDateGroupingProperty(property) {
13
13
  return property === 'p&quarter' ? DATE_DISTINCT_PROPERTY_1.DATE_DISTINCT_PROPERTY.YEAR_QUARTER :
@@ -4,8 +4,8 @@ import { IFUChartSettings } from "../interfaces/ui/IFUChartSettings";
4
4
  /**
5
5
  * [TODO: Make a proper description for this function]
6
6
  * @param chartSettings Chart Settings for the Filter Builder
7
- * @param scopes
8
- * @param currentScope
9
- * @returns
7
+ * @param scopes the pair id/label scopes
8
+ * @param currentScope the scope to be validated
9
+ * @returns the chart settings
10
10
  */
11
11
  export declare function applyHierarchyForAggFilters(chartSettings: IFUChartSettings, scopes?: IFSScopeID[], currentScope?: IFScope): IFUChartSettings;
@@ -8,9 +8,9 @@ const getScopesByHierarchy_1 = require("./getScopesByHierarchy");
8
8
  /**
9
9
  * [TODO: Make a proper description for this function]
10
10
  * @param chartSettings Chart Settings for the Filter Builder
11
- * @param scopes
12
- * @param currentScope
13
- * @returns
11
+ * @param scopes the pair id/label scopes
12
+ * @param currentScope the scope to be validated
13
+ * @returns the chart settings
14
14
  */
15
15
  function applyHierarchyForAggFilters(chartSettings, scopes = [], currentScope = FILTER_SCOPE_1.FILTER_SCOPE.GLOBAL) {
16
16
  if ((0, isEmpty_1.isEmpty)(chartSettings))
@@ -1,8 +1,10 @@
1
1
  import { IFBFilterAggregate } from "../../interfaces/backend/IFBFilterAggregate";
2
2
  /**
3
+ * @todo Make a proper description for this function
3
4
  *
4
- * @param aggFilters
5
- * @param summaryIndex
6
- * @returns
5
+ * Gets the aggFilters structure by an index
6
+ * @param aggFilters The aggFilter Structure
7
+ * @param summaryIndex an index
8
+ * @returns a new aggFilters structure
7
9
  */
8
10
  export declare function getAggFiltersBySummaryIndex(aggFilters: IFBFilterAggregate, summaryIndex: number): IFBFilterAggregate;
@@ -3,10 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getAggFiltersBySummaryIndex = void 0;
4
4
  const filterNestedTree_1 = require("../../../general/array/filterNestedTree");
5
5
  /**
6
+ * @todo Make a proper description for this function
6
7
  *
7
- * @param aggFilters
8
- * @param summaryIndex
9
- * @returns
8
+ * Gets the aggFilters structure by an index
9
+ * @param aggFilters The aggFilter Structure
10
+ * @param summaryIndex an index
11
+ * @returns a new aggFilters structure
10
12
  */
11
13
  function getAggFiltersBySummaryIndex(aggFilters, summaryIndex) {
12
14
  if (!aggFilters)
@@ -68,9 +68,10 @@ function getBackendValues(filter) {
68
68
  exports.getBackendValues = getBackendValues;
69
69
  /**
70
70
  * Gets the expression values. Depending on the column type
71
+ * @private
71
72
  * @param values a collection of filter values
72
73
  * @param filter The filter structure
73
- * @returns
74
+ * @returns Expression values
74
75
  */
75
76
  function getResultValues(values, filter) {
76
77
  return (values || []).map((value) => {
@@ -86,6 +87,7 @@ function getResultValues(values, filter) {
86
87
  }
87
88
  /**
88
89
  * Gets the Ranking values.
90
+ * @private
89
91
  * @param values a collection of filter values in the ranking structure
90
92
  * @param rankingGroupIndex determine the value by this index to build and return it
91
93
  * @returns Expression values for ranking
@@ -1,9 +1,10 @@
1
1
  import { IFBFilterAggregate } from "../interfaces/backend/IFBFilterAggregate";
2
2
  import { IFSData } from "../interfaces/common/IFSData";
3
3
  /**
4
- *
5
- * @param logics
6
- * @param summaries
7
- * @returns
4
+ * @todo FIX AGGREGATE FILTERS
5
+ * @private
6
+ * @param filterData
7
+ * @param _summaries
8
+ * @returns the aggFilters structure
8
9
  */
9
10
  export declare function getAggFiltersFromFilterData(filterData: IFSData, _summaries: any[]): IFBFilterAggregate;
@@ -4,12 +4,12 @@ exports.getAggFiltersFromFilterData = void 0;
4
4
  const isEmpty_1 = require("../../general/mix/isEmpty");
5
5
  const getFiltersByAggregateColumn_1 = require("./common/getFiltersByAggregateColumn");
6
6
  /**
7
- *
8
- * @param logics
9
- * @param summaries
10
- * @returns
7
+ * @todo FIX AGGREGATE FILTERS
8
+ * @private
9
+ * @param filterData
10
+ * @param _summaries
11
+ * @returns the aggFilters structure
11
12
  */
12
- // [TODO: FILTERS - FIX AGGREGATE FILTERS]
13
13
  function getAggFiltersFromFilterData(filterData, _summaries) {
14
14
  filterData = Object.assign({}, (0, getFiltersByAggregateColumn_1.getFiltersByAggregateColumn)(filterData));
15
15
  if ((0, isEmpty_1.isEmpty)(filterData))
@@ -2,10 +2,9 @@ import { IFSFilter } from "../../interfaces/common/IFSFilter";
2
2
  import { IFUValue } from "../../interfaces/ui/IFUValue";
3
3
  import { IFUUIValueSettings } from "../../interfaces/ui/IFUUIValueSettings";
4
4
  /**
5
- *
6
- * @param filter
7
- * @param addEnableds
8
- * @param rankingGroupIndex
9
- * @returns
5
+ * Gets the UI Values generated depending on the validator
6
+ * @param filter the filter structure
7
+ * @param settings a settings for this function
8
+ * @returns the UI Values
10
9
  */
11
10
  export declare function getUIValues(filter: IFSFilter, settings?: IFUUIValueSettings): IFUValue[];
@@ -10,11 +10,10 @@ const flattenDeep_1 = require("../../../general/array/flattenDeep");
10
10
  const RELATIVE_CURSOR_INFO_1 = require("../../../dates/relative/constants/RELATIVE_CURSOR_INFO");
11
11
  const getI18nDateGroupLabel_1 = require("../../../globalization/helpers/getI18nDateGroupLabel");
12
12
  /**
13
- *
14
- * @param filter
15
- * @param addEnableds
16
- * @param rankingGroupIndex
17
- * @returns
13
+ * Gets the UI Values generated depending on the validator
14
+ * @param filter the filter structure
15
+ * @param settings a settings for this function
16
+ * @returns the UI Values
18
17
  */
19
18
  function getUIValues(filter, settings) {
20
19
  var _a;
@@ -32,7 +32,8 @@ 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 dateParam = new Date(value);
35
+ const dateValue = value === null || value === void 0 ? void 0 : value.replace('.000Z', '');
36
+ const dateParam = new Date(dateValue);
36
37
  let langOpts = options;
37
38
  if (outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.originalFormat) {
38
39
  const { format } = outputFormat.originalFormat;
@@ -27,23 +27,3 @@
27
27
  * @returns the resolved value.
28
28
  */
29
29
  export declare function _get<T = any>(baseObject: T, path: string | string[], defaultValue?: any): any;
30
- /**
31
- *
32
- * /**
33
- * Like lodash _.get.
34
- * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place.
35
- * @param baseObject The object to query
36
- * @param path The path of the property to get.
37
- * @param defaultValue The value returned for undefined resolved values.
38
- * @returns the resolved value.
39
- export function get(baseObject: any, path: string, defaultValue?: any): any {
40
- function fn() {
41
- try {
42
- const value = eval(`this.${path}`.replace('.[', '['));
43
- return typeof value !== 'undefined' ? value : defaultValue;
44
- } catch (e) { return defaultValue; }
45
- }
46
- return fn.apply(baseObject, null);
47
- }
48
-
49
- */
@@ -45,23 +45,3 @@ function validateToReturnDefaultValue(baseObject, path) {
45
45
  path == null ||
46
46
  (typeof path !== 'string' && !Array.isArray(path));
47
47
  }
48
- /**
49
- *
50
- * /**
51
- * Like lodash _.get.
52
- * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place.
53
- * @param baseObject The object to query
54
- * @param path The path of the property to get.
55
- * @param defaultValue The value returned for undefined resolved values.
56
- * @returns the resolved value.
57
- export function get(baseObject: any, path: string, defaultValue?: any): any {
58
- function fn() {
59
- try {
60
- const value = eval(`this.${path}`.replace('.[', '['));
61
- return typeof value !== 'undefined' ? value : defaultValue;
62
- } catch (e) { return defaultValue; }
63
- }
64
- return fn.apply(baseObject, null);
65
- }
66
-
67
- */
@@ -18,4 +18,6 @@ export interface II18nChartBuilderConditionalFormatting {
18
18
  value: string;
19
19
  type_value: string;
20
20
  remove: string;
21
+ apply_to: string;
22
+ entire_row: string;
21
23
  }
@@ -29,5 +29,7 @@ exports.I18N_CHART_BUILDER_FORMAT_OPTIONS = {
29
29
  value: 'Value',
30
30
  type_value: 'Type Value',
31
31
  remove: 'Remove',
32
+ apply_to: 'Apply to',
33
+ entire_row: 'Entire Row'
32
34
  }
33
35
  };
@@ -21,6 +21,6 @@ export function getModelColumn(column, model) {
21
21
  * @returns the question data array from model object
22
22
  */
23
23
  function getQuestionData(model) {
24
- debugger;
24
+ // debugger
25
25
  return _get(model, 'questions.data', []);
26
26
  }
@@ -20,9 +20,10 @@ export function UIToFD(uFilterData) {
20
20
  }
21
21
  /**
22
22
  * Builds the Fitler Data structure from UI filter data
23
+ * @private
23
24
  * @param uFilterData The UI filter Data object
24
25
  * @param version the version of the structure
25
- * @returns
26
+ * @returns a Filter Data structure
26
27
  */
27
28
  function UI21ToFD(uFilterData, version) {
28
29
  return {
@@ -2,7 +2,7 @@ import { IFProperty } from "../interfaces/IFProperty";
2
2
  /**
3
3
  * [TODO: For 2022, eliminate this adapter]
4
4
  * Get the new property base on the old date grouping properties
5
- * @param property
6
- * @returns
5
+ * @param property the property to be adapted
6
+ * @returns a adapted property
7
7
  */
8
8
  export declare function adaptDateGroupingProperty(property: IFProperty | any): IFProperty;
@@ -3,8 +3,8 @@ import { DATE_DISTINCT_TIME_PROPERTY } from "../../dates/constants/DATE_DISTINCT
3
3
  /**
4
4
  * [TODO: For 2022, eliminate this adapter]
5
5
  * Get the new property base on the old date grouping properties
6
- * @param property
7
- * @returns
6
+ * @param property the property to be adapted
7
+ * @returns a adapted property
8
8
  */
9
9
  export function adaptDateGroupingProperty(property) {
10
10
  return property === 'p&quarter' ? DATE_DISTINCT_PROPERTY.YEAR_QUARTER :
@@ -4,8 +4,8 @@ import { IFUChartSettings } from "../interfaces/ui/IFUChartSettings";
4
4
  /**
5
5
  * [TODO: Make a proper description for this function]
6
6
  * @param chartSettings Chart Settings for the Filter Builder
7
- * @param scopes
8
- * @param currentScope
9
- * @returns
7
+ * @param scopes the pair id/label scopes
8
+ * @param currentScope the scope to be validated
9
+ * @returns the chart settings
10
10
  */
11
11
  export declare function applyHierarchyForAggFilters(chartSettings: IFUChartSettings, scopes?: IFSScopeID[], currentScope?: IFScope): IFUChartSettings;
@@ -5,9 +5,9 @@ import { getScopesByHierarchy } from "./getScopesByHierarchy";
5
5
  /**
6
6
  * [TODO: Make a proper description for this function]
7
7
  * @param chartSettings Chart Settings for the Filter Builder
8
- * @param scopes
9
- * @param currentScope
10
- * @returns
8
+ * @param scopes the pair id/label scopes
9
+ * @param currentScope the scope to be validated
10
+ * @returns the chart settings
11
11
  */
12
12
  export function applyHierarchyForAggFilters(chartSettings, scopes = [], currentScope = FILTER_SCOPE.GLOBAL) {
13
13
  if (isEmpty(chartSettings))
@@ -1,8 +1,10 @@
1
1
  import { IFBFilterAggregate } from "../../interfaces/backend/IFBFilterAggregate";
2
2
  /**
3
+ * @todo Make a proper description for this function
3
4
  *
4
- * @param aggFilters
5
- * @param summaryIndex
6
- * @returns
5
+ * Gets the aggFilters structure by an index
6
+ * @param aggFilters The aggFilter Structure
7
+ * @param summaryIndex an index
8
+ * @returns a new aggFilters structure
7
9
  */
8
10
  export declare function getAggFiltersBySummaryIndex(aggFilters: IFBFilterAggregate, summaryIndex: number): IFBFilterAggregate;
@@ -1,9 +1,11 @@
1
1
  import { filterNestedTree } from "../../../general/array/filterNestedTree";
2
2
  /**
3
+ * @todo Make a proper description for this function
3
4
  *
4
- * @param aggFilters
5
- * @param summaryIndex
6
- * @returns
5
+ * Gets the aggFilters structure by an index
6
+ * @param aggFilters The aggFilter Structure
7
+ * @param summaryIndex an index
8
+ * @returns a new aggFilters structure
7
9
  */
8
10
  export function getAggFiltersBySummaryIndex(aggFilters, summaryIndex) {
9
11
  if (!aggFilters)
@@ -64,9 +64,10 @@ export function getBackendValues(filter) {
64
64
  }
65
65
  /**
66
66
  * Gets the expression values. Depending on the column type
67
+ * @private
67
68
  * @param values a collection of filter values
68
69
  * @param filter The filter structure
69
- * @returns
70
+ * @returns Expression values
70
71
  */
71
72
  function getResultValues(values, filter) {
72
73
  return (values || []).map((value) => {
@@ -82,6 +83,7 @@ function getResultValues(values, filter) {
82
83
  }
83
84
  /**
84
85
  * Gets the Ranking values.
86
+ * @private
85
87
  * @param values a collection of filter values in the ranking structure
86
88
  * @param rankingGroupIndex determine the value by this index to build and return it
87
89
  * @returns Expression values for ranking
@@ -1,9 +1,10 @@
1
1
  import { IFBFilterAggregate } from "../interfaces/backend/IFBFilterAggregate";
2
2
  import { IFSData } from "../interfaces/common/IFSData";
3
3
  /**
4
- *
5
- * @param logics
6
- * @param summaries
7
- * @returns
4
+ * @todo FIX AGGREGATE FILTERS
5
+ * @private
6
+ * @param filterData
7
+ * @param _summaries
8
+ * @returns the aggFilters structure
8
9
  */
9
10
  export declare function getAggFiltersFromFilterData(filterData: IFSData, _summaries: any[]): IFBFilterAggregate;
@@ -1,12 +1,12 @@
1
1
  import { isEmpty } from "../../general/mix/isEmpty";
2
2
  import { getFiltersByAggregateColumn } from "./common/getFiltersByAggregateColumn";
3
3
  /**
4
- *
5
- * @param logics
6
- * @param summaries
7
- * @returns
4
+ * @todo FIX AGGREGATE FILTERS
5
+ * @private
6
+ * @param filterData
7
+ * @param _summaries
8
+ * @returns the aggFilters structure
8
9
  */
9
- // [TODO: FILTERS - FIX AGGREGATE FILTERS]
10
10
  export function getAggFiltersFromFilterData(filterData, _summaries) {
11
11
  filterData = Object.assign({}, getFiltersByAggregateColumn(filterData));
12
12
  if (isEmpty(filterData))
@@ -2,10 +2,9 @@ import { IFSFilter } from "../../interfaces/common/IFSFilter";
2
2
  import { IFUValue } from "../../interfaces/ui/IFUValue";
3
3
  import { IFUUIValueSettings } from "../../interfaces/ui/IFUUIValueSettings";
4
4
  /**
5
- *
6
- * @param filter
7
- * @param addEnableds
8
- * @param rankingGroupIndex
9
- * @returns
5
+ * Gets the UI Values generated depending on the validator
6
+ * @param filter the filter structure
7
+ * @param settings a settings for this function
8
+ * @returns the UI Values
10
9
  */
11
10
  export declare function getUIValues(filter: IFSFilter, settings?: IFUUIValueSettings): IFUValue[];
@@ -7,11 +7,10 @@ import { flattenDeep } from "../../../general/array/flattenDeep";
7
7
  import { RELATIVE_CURSOR_INFO } from "../../../dates/relative/constants/RELATIVE_CURSOR_INFO";
8
8
  import { getI18nDateGroupLabel } from "../../../globalization/helpers/getI18nDateGroupLabel";
9
9
  /**
10
- *
11
- * @param filter
12
- * @param addEnableds
13
- * @param rankingGroupIndex
14
- * @returns
10
+ * Gets the UI Values generated depending on the validator
11
+ * @param filter the filter structure
12
+ * @param settings a settings for this function
13
+ * @returns the UI Values
15
14
  */
16
15
  export function getUIValues(filter, settings) {
17
16
  var _a;
@@ -26,7 +26,8 @@ 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 dateParam = new Date(value);
29
+ const dateValue = value === null || value === void 0 ? void 0 : value.replace('.000Z', '');
30
+ const dateParam = new Date(dateValue);
30
31
  let langOpts = options;
31
32
  if (outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.originalFormat) {
32
33
  const { format } = outputFormat.originalFormat;
@@ -27,23 +27,3 @@
27
27
  * @returns the resolved value.
28
28
  */
29
29
  export declare function _get<T = any>(baseObject: T, path: string | string[], defaultValue?: any): any;
30
- /**
31
- *
32
- * /**
33
- * Like lodash _.get.
34
- * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place.
35
- * @param baseObject The object to query
36
- * @param path The path of the property to get.
37
- * @param defaultValue The value returned for undefined resolved values.
38
- * @returns the resolved value.
39
- export function get(baseObject: any, path: string, defaultValue?: any): any {
40
- function fn() {
41
- try {
42
- const value = eval(`this.${path}`.replace('.[', '['));
43
- return typeof value !== 'undefined' ? value : defaultValue;
44
- } catch (e) { return defaultValue; }
45
- }
46
- return fn.apply(baseObject, null);
47
- }
48
-
49
- */
@@ -41,23 +41,3 @@ function validateToReturnDefaultValue(baseObject, path) {
41
41
  path == null ||
42
42
  (typeof path !== 'string' && !Array.isArray(path));
43
43
  }
44
- /**
45
- *
46
- * /**
47
- * Like lodash _.get.
48
- * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place.
49
- * @param baseObject The object to query
50
- * @param path The path of the property to get.
51
- * @param defaultValue The value returned for undefined resolved values.
52
- * @returns the resolved value.
53
- export function get(baseObject: any, path: string, defaultValue?: any): any {
54
- function fn() {
55
- try {
56
- const value = eval(`this.${path}`.replace('.[', '['));
57
- return typeof value !== 'undefined' ? value : defaultValue;
58
- } catch (e) { return defaultValue; }
59
- }
60
- return fn.apply(baseObject, null);
61
- }
62
-
63
- */
@@ -18,4 +18,6 @@ export interface II18nChartBuilderConditionalFormatting {
18
18
  value: string;
19
19
  type_value: string;
20
20
  remove: string;
21
+ apply_to: string;
22
+ entire_row: string;
21
23
  }
@@ -26,5 +26,7 @@ export const I18N_CHART_BUILDER_FORMAT_OPTIONS = {
26
26
  value: 'Value',
27
27
  type_value: 'Type Value',
28
28
  remove: 'Remove',
29
+ apply_to: 'Apply to',
30
+ entire_row: 'Entire Row'
29
31
  }
30
32
  };
@@ -0,0 +1,14 @@
1
+ {
2
+ "plugins": ["plugins/markdown"],
3
+ "source": {
4
+ "include": ["./dist"],
5
+ "exclude": ["./node_modules", "./src"],
6
+ "includePattern": "./dist/.+\\.js",
7
+ "excludePattern": "./dist/cjs/.+\\.js"
8
+ },
9
+ "opts": {
10
+ "package": "./package.json",
11
+ "readme": "./README.md",
12
+ "recurse": true
13
+ }
14
+ }
package/package.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "@qrvey/utils",
3
- "version": "1.2.10-2",
3
+ "version": "1.2.10-3",
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",
7
7
  "scripts": {
8
8
  "build": "tsc && tsc -m commonjs --outDir dist/cjs",
9
+ "docs": "./node_modules/.bin/jsdoc -c ./jsdoc.config.json",
9
10
  "publishing": "node prepareToPublish.js && np",
10
11
  "publishing-prerelease": "node prepareToPublish.js && np --any-branch --tag=$npm_config_tag",
12
+ "publishing-v2": "node publishing.js --np-new-version=$npm_config_np_new_version --np-any-branch=$npm_config_np_any_branch --np-tag=$npm_config_np_tag",
11
13
  "test": "jest test",
12
14
  "test:watch": "jest --watch test",
13
15
  "lint": "eslint src --quiet --exit-on-fatal-error --ext .ts,.js",
package/publishing.js ADDED
@@ -0,0 +1,180 @@
1
+ // IN DEVELOPMENT
2
+
3
+
4
+ const fs = require('fs');
5
+ const util = require('util');
6
+ const childProcess = require('child_process');
7
+ const exec = util.promisify(childProcess.exec);
8
+ const spawn = childProcess.spawn;
9
+ const proc = require('process');
10
+ const readline = require("readline");
11
+ const rl = readline.createInterface({
12
+ input: proc.stdin,
13
+ output: proc.stdout
14
+ });
15
+ const question = util.promisify(rl.question).bind(rl);
16
+
17
+
18
+ async function execute(command) {
19
+ console.log(command);
20
+ const response = await exec(command);
21
+ console.log('response', response);
22
+ if (response.error != null) {
23
+ throw new Error(response.error);
24
+ }
25
+ if (response.stderr != null && response.stderr !== '') {
26
+ console.error(response.stderr);
27
+ }
28
+ if (response.stdout != null && response.stdout !== '') {
29
+ console.log(response.stdout);
30
+ }
31
+ return response;
32
+ }
33
+
34
+ //todo: fix the spawning function to wait for the second process to finish and then continue the next code
35
+ async function spawning(command, sArguments) {
36
+ const newProcess = await new Promise(function (resolve, reject) {
37
+ spawn(command, sArguments, { shell: true });
38
+ newProcess.stdout.on("data", data => {
39
+ console.log(`stdout: ${data}`);
40
+ });
41
+
42
+ newProcess.stderr.on("data", data => {
43
+ console.log(`stderr: ${data}`);
44
+ });
45
+
46
+ newProcess.on('error', (error) => {
47
+ reject();
48
+ throw new Error(error.message);
49
+ });
50
+
51
+ newProcess.on("close", code => {
52
+ if (code == '1') {
53
+ reject();
54
+ throw new Error(`child process exited with code ${code}`);
55
+ }
56
+ resolve();
57
+ });
58
+ });
59
+ }
60
+
61
+ async function openingPackageJson(settings) {
62
+ console.log('>>> Opening package.json file...');
63
+ const packageJson = await fs.readFileSync(settings.packagePath, 'utf8');
64
+ const packageObject = JSON.parse(packageJson);
65
+ if (packageObject != null) {
66
+ console.log(`The current version is ${packageObject.version}`);
67
+ return packageObject.version;
68
+ }
69
+ return '';
70
+ }
71
+
72
+ async function cleaningProject(settings) {
73
+ console.log('>>> Cleaning project...');
74
+ await execute(`rm -f ${settings.packageLockPath}`);
75
+ await execute(`rm -f -R ${settings.nodeModulesPath}`);
76
+ await execute(`rm -f -R ${settings.distPath}`);
77
+ }
78
+
79
+ async function buildingBundle(_settings) {
80
+ console.log('>>> Installing Dependencies...');
81
+ await execute('npm install');
82
+
83
+ console.log('>>> Generating Build...');
84
+ await execute('npm run build');
85
+ }
86
+
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
+ async function startPublishingVersion(settings) {
110
+ await callingPublisher(settings);
111
+ }
112
+
113
+ async function callingPublisher(settings) {
114
+ console.log('>>> Calling Publisher');
115
+ let anyBranch = '', tag = '';
116
+ const anyBranchIndex = proc.argv.findIndex(function (argv) { return argv.includes('--np-any-branch='); });
117
+ const tagIndex = proc.argv.findIndex(function (argv) { return argv.includes('--np-tag='); });
118
+ if (anyBranchIndex > -1) {
119
+ const anyBranchArg = proc.argv[anyBranchIndex].split('--np-any-branch=');
120
+ anyBranch = anyBranchArg[1] == null || anyBranchArg[1] === '' ? '' : '--any-branch';
121
+ }
122
+ if (tagIndex > -1) {
123
+ const tagArg = proc.argv[tagIndex].split('--np-tag=');
124
+ tag = tagArg[1] == null || tagArg[1] === '' ? '' : proc.argv[tagIndex].replace('--np-tag=', '--tag=');
125
+ }
126
+ // await execute(`np ${settings.newVersion} ${anyBranch} ${tag}`);
127
+ await spawning(`np ${settings.newVersion}`, [anyBranch, tag]);
128
+ }
129
+
130
+ async function startGeneratingDocs(settings) {
131
+ console.log('>>> Starting of the Docs generation.');
132
+
133
+ await generatingDocument(settings);
134
+ await pushingChanges(settings);
135
+ }
136
+
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;
148
+ }
149
+
150
+ async function init() {
151
+ let settings = {
152
+ distPath: './dist',
153
+ docsPath: './README.md',
154
+ docsFileName: 'README.md',
155
+ newVersion: undefined,
156
+ nodeModulesPath: './node_modules',
157
+ packageLockPath: './package-lock.json',
158
+ packagePath: './package.json',
159
+ packageVersion: '',
160
+ };
161
+
162
+ console.log('Welcome. The publishing operationg will begin.');
163
+ try {
164
+ settings["packageVersion"] = await openingPackageJson(settings);
165
+ settings["newVersion"] = await getNewVersion();
166
+
167
+ await cleaningProject(settings);
168
+ await buildingBundle(settings);
169
+ await startPublishingVersion(settings);
170
+ await startGeneratingDocs(settings);
171
+ console.info('Finished Publishing');
172
+ } catch (err) {
173
+ console.error('Error: ', err);
174
+ await revertChanges(settings);
175
+ } finally {
176
+ console.log('Execution finished');
177
+ }
178
+ }
179
+
180
+ init();
@@ -24,6 +24,6 @@ export function getModelColumn(column: Partial<IColumn>, model: IModel): IColumn
24
24
  * @returns the question data array from model object
25
25
  */
26
26
  function getQuestionData(model: IModel): IColumn[] {
27
- debugger
27
+ // debugger
28
28
  return _get(model, 'questions.data', []);
29
29
  }
@@ -27,9 +27,10 @@ import { IFUScope } from "../interfaces/ui/IFUScope";
27
27
 
28
28
  /**
29
29
  * Builds the Fitler Data structure from UI filter data
30
+ * @private
30
31
  * @param uFilterData The UI filter Data object
31
32
  * @param version the version of the structure
32
- * @returns
33
+ * @returns a Filter Data structure
33
34
  */
34
35
  function UI21ToFD(uFilterData: IFUData, version): IFSData {
35
36
  return {
@@ -5,8 +5,8 @@ import { DATE_DISTINCT_TIME_PROPERTY } from "../../dates/constants/DATE_DISTINCT
5
5
  /**
6
6
  * [TODO: For 2022, eliminate this adapter]
7
7
  * Get the new property base on the old date grouping properties
8
- * @param property
9
- * @returns
8
+ * @param property the property to be adapted
9
+ * @returns a adapted property
10
10
  */
11
11
  export function adaptDateGroupingProperty(property: IFProperty | any): IFProperty {
12
12
  return property === 'p&quarter' ? DATE_DISTINCT_PROPERTY.YEAR_QUARTER :
@@ -9,9 +9,9 @@ import { getScopesByHierarchy } from "./getScopesByHierarchy";
9
9
  /**
10
10
  * [TODO: Make a proper description for this function]
11
11
  * @param chartSettings Chart Settings for the Filter Builder
12
- * @param scopes
13
- * @param currentScope
14
- * @returns
12
+ * @param scopes the pair id/label scopes
13
+ * @param currentScope the scope to be validated
14
+ * @returns the chart settings
15
15
  */
16
16
  export function applyHierarchyForAggFilters(chartSettings: IFUChartSettings, scopes: IFSScopeID[] = [], currentScope: IFScope = FILTER_SCOPE.GLOBAL): IFUChartSettings {
17
17
  if (isEmpty(chartSettings)) return;
@@ -2,10 +2,12 @@ import { filterNestedTree } from "../../../general/array/filterNestedTree";
2
2
  import { IFBFilterAggregate } from "../../interfaces/backend/IFBFilterAggregate";
3
3
 
4
4
  /**
5
+ * @todo Make a proper description for this function
5
6
  *
6
- * @param aggFilters
7
- * @param summaryIndex
8
- * @returns
7
+ * Gets the aggFilters structure by an index
8
+ * @param aggFilters The aggFilter Structure
9
+ * @param summaryIndex an index
10
+ * @returns a new aggFilters structure
9
11
  */
10
12
  export function getAggFiltersBySummaryIndex(aggFilters: IFBFilterAggregate, summaryIndex: number): IFBFilterAggregate {
11
13
  if (!aggFilters) return undefined;
@@ -75,9 +75,10 @@ export function getBackendValues(filter: IFSFilter): IFBackendExpressionValue[]
75
75
 
76
76
  /**
77
77
  * Gets the expression values. Depending on the column type
78
+ * @private
78
79
  * @param values a collection of filter values
79
80
  * @param filter The filter structure
80
- * @returns
81
+ * @returns Expression values
81
82
  */
82
83
  function getResultValues(values: IFSValue[], filter: IFSFilter): IFBExpressionValue[] {
83
84
  return (values || []).map((value: IFSValue) => {
@@ -93,6 +94,7 @@ function getResultValues(values: IFSValue[], filter: IFSFilter): IFBExpressionVa
93
94
 
94
95
  /**
95
96
  * Gets the Ranking values.
97
+ * @private
96
98
  * @param values a collection of filter values in the ranking structure
97
99
  * @param rankingGroupIndex determine the value by this index to build and return it
98
100
  * @returns Expression values for ranking
@@ -4,12 +4,12 @@ import { IFSData } from "../interfaces/common/IFSData";
4
4
  import { getFiltersByAggregateColumn } from "./common/getFiltersByAggregateColumn";
5
5
 
6
6
  /**
7
- *
8
- * @param logics
9
- * @param summaries
10
- * @returns
7
+ * @todo FIX AGGREGATE FILTERS
8
+ * @private
9
+ * @param filterData
10
+ * @param _summaries
11
+ * @returns the aggFilters structure
11
12
  */
12
- // [TODO: FILTERS - FIX AGGREGATE FILTERS]
13
13
  export function getAggFiltersFromFilterData(filterData: IFSData, _summaries: any[]): IFBFilterAggregate {
14
14
  filterData = { ...getFiltersByAggregateColumn(filterData) };
15
15
  if (isEmpty(filterData)) return;
@@ -16,11 +16,10 @@ import { getI18nDateGroupLabel } from "../../../globalization/helpers/getI18nDat
16
16
  import { IDateColumnPropertyType } from "../../../columns/interfaces/IDateColumnPropertyType";
17
17
 
18
18
  /**
19
- *
20
- * @param filter
21
- * @param addEnableds
22
- * @param rankingGroupIndex
23
- * @returns
19
+ * Gets the UI Values generated depending on the validator
20
+ * @param filter the filter structure
21
+ * @param settings a settings for this function
22
+ * @returns the UI Values
24
23
  */
25
24
  export function getUIValues(filter: IFSFilter, settings?: IFUUIValueSettings): IFUValue[] {
26
25
  settings = getUiValuesSettings(settings);
@@ -29,7 +29,8 @@ 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 dateParam = new Date(value);
32
+ const dateValue = value?.replace('.000Z', '');
33
+ const dateParam = new Date(dateValue);
33
34
  let langOpts = options;
34
35
  if (outputFormat?.originalFormat) {
35
36
  const { format } = outputFormat.originalFormat;
@@ -42,25 +42,3 @@ function validateToReturnDefaultValue(baseObject: any, path: string | string[]):
42
42
  path == null ||
43
43
  (typeof path !== 'string' && !Array.isArray(path));
44
44
  }
45
-
46
-
47
- /**
48
- *
49
- * /**
50
- * Like lodash _.get.
51
- * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place.
52
- * @param baseObject The object to query
53
- * @param path The path of the property to get.
54
- * @param defaultValue The value returned for undefined resolved values.
55
- * @returns the resolved value.
56
- export function get(baseObject: any, path: string, defaultValue?: any): any {
57
- function fn() {
58
- try {
59
- const value = eval(`this.${path}`.replace('.[', '['));
60
- return typeof value !== 'undefined' ? value : defaultValue;
61
- } catch (e) { return defaultValue; }
62
- }
63
- return fn.apply(baseObject, null);
64
- }
65
-
66
- */
@@ -18,4 +18,6 @@ export interface II18nChartBuilderConditionalFormatting {
18
18
  value: string;
19
19
  type_value: string;
20
20
  remove: string;
21
+ apply_to: string;
22
+ entire_row: string;
21
23
  }
@@ -30,5 +30,7 @@ export const I18N_CHART_BUILDER_FORMAT_OPTIONS: Pick<II18nChartBuilder, FormatOp
30
30
  value: 'Value',
31
31
  type_value: 'Type Value',
32
32
  remove: 'Remove',
33
+ apply_to: 'Apply to',
34
+ entire_row: 'Entire Row'
33
35
  }
34
36
  };