@qrvey/utils 1.3.0-19 → 1.3.0-21

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.
@@ -30,9 +30,9 @@ const isEmpty_1 = require("../../general/mix/isEmpty");
30
30
  const getModel_api_1 = require("../../services/api/getModel.api");
31
31
  const areStaticColumnValues_1 = require("../../qrvey/helpers/areStaticColumnValues");
32
32
  const getValuesFromDataset_1 = require("../helpers/common/getValuesFromDataset");
33
- const getFiltersByDatasetsColumns_1 = require("../helpers/common/getFiltersByDatasetsColumns");
34
33
  const getDatasetByColumn_1 = require("../../qrvey/helpers/getDatasetByColumn");
35
34
  const getLogicByDatasets_1 = require("../helpers/backend/getLogicByDatasets");
35
+ const getFiltersByParams_1 = require("../helpers/common/getFiltersByParams");
36
36
  class FiltersApi {
37
37
  constructor(cfg) {
38
38
  this.setConfig(cfg);
@@ -102,7 +102,7 @@ class FiltersApi {
102
102
  const scopes = this.getAvailableScopeIds(config);
103
103
  let filterData = (0, getFiltersByVisibility_1.getFiltersByVisibility)(config.filterData, scopes);
104
104
  const dataset = config.datasets.find(d => { var _a; return d.qrveyid === ((_a = config.filter) === null || _a === void 0 ? void 0 : _a.column.qrveyid); });
105
- filterData = (0, getFiltersByDatasetsColumns_1.getFiltersByDatasetsColumns)(filterData, (0, isEmpty_1.isEmpty)(dataset) ? [] : [dataset]);
105
+ filterData = (0, getFiltersByParams_1.getFiltersByParams)(filterData, { qrveyid: dataset.qrveyid }, { letPassUndefinedProperties: { filter: true }, filterEmptyArrays: { filter: false } });
106
106
  filterData = (0, excludeFiltersByAggregateColumn_1.excludeFiltersByAggregateColumn)(filterData);
107
107
  const logics = (0, FDToLogic_1.FDToLogic)(filterData);
108
108
  const hierarchyLogic = (0, getLogicByScopesHierarchy_1.getLogicByScopesHierarchy)(logics, scopes, (_a = config.filter) === null || _a === void 0 ? void 0 : _a.extras.scope);
@@ -124,9 +124,9 @@ class FiltersApi {
124
124
  * @returns a collection of the pair Scopes and Scope IDs
125
125
  */
126
126
  getAvailableScopeIds(config) {
127
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
128
- return (0, getAvailableScopes_1.getAvailableScopes)(Object.assign(Object.assign({}, (0, getAvailableScopesIDsByConfig_1.getAvailableScopesIDsByConfig)(config)), { panelid: FILTER_SCOPE_1.FILTER_SCOPE.CHART === ((_a = config.filter) === null || _a === void 0 ? void 0 : _a.extras.scope) ? (_b = config.filter) === null || _b === void 0 ? void 0 : _b.extras.scopeid : undefined, scopeid: (_c = config.filter) === null || _c === void 0 ? void 0 : _c.extras.scopeid, qrveyid: (_e = (_d = config.filter) === null || _d === void 0 ? void 0 : _d.column) === null || _e === void 0 ? void 0 : _e.qrveyid, defaultid: [FILTER_SCOPE_1.FILTER_SCOPE.DEFAULT].includes((_f = config.filter) === null || _f === void 0 ? void 0 : _f.extras.scope) ? (_h = (_g = config.filter) === null || _g === void 0 ? void 0 : _g.column) === null || _h === void 0 ? void 0 : _h.qrveyid : undefined, scope: undefined, predefinedScopes: [
129
- { label: FILTER_SCOPE_1.FILTER_SCOPE.DATA, id: (_k = (_j = config.filter) === null || _j === void 0 ? void 0 : _j.column) === null || _k === void 0 ? void 0 : _k.qrveyid }
127
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
128
+ return (0, getAvailableScopes_1.getAvailableScopes)(Object.assign(Object.assign({}, (0, getAvailableScopesIDsByConfig_1.getAvailableScopesIDsByConfig)(config)), { panelid: FILTER_SCOPE_1.FILTER_SCOPE.CHART === ((_a = config.filter) === null || _a === void 0 ? void 0 : _a.extras.scope) ? (_b = config.filter) === null || _b === void 0 ? void 0 : _b.extras.scopeid : undefined, scopeid: (_c = config.filter) === null || _c === void 0 ? void 0 : _c.extras.scopeid, qrveyid: (_e = (_d = config.filter) === null || _d === void 0 ? void 0 : _d.column) === null || _e === void 0 ? void 0 : _e.qrveyid, defaultid: (_g = (_f = config.filter) === null || _f === void 0 ? void 0 : _f.column) === null || _g === void 0 ? void 0 : _g.qrveyid, scope: undefined, predefinedScopes: [
129
+ { label: FILTER_SCOPE_1.FILTER_SCOPE.DATA, id: (_j = (_h = config.filter) === null || _h === void 0 ? void 0 : _h.column) === null || _j === void 0 ? void 0 : _j.qrveyid }
130
130
  ] }));
131
131
  }
132
132
  /**
@@ -24,9 +24,9 @@ import { isEmpty } from '../../general/mix/isEmpty';
24
24
  import { getModel } from '../../services/api/getModel.api';
25
25
  import { areStaticColumnValues } from '../../qrvey/helpers/areStaticColumnValues';
26
26
  import { getValuesFromDataset } from '../helpers/common/getValuesFromDataset';
27
- import { getFiltersByDatasetsColumns } from '../helpers/common/getFiltersByDatasetsColumns';
28
27
  import { getDatasetByColumn } from '../../qrvey/helpers/getDatasetByColumn';
29
28
  import { getLogicByDatasets } from '../helpers/backend/getLogicByDatasets';
29
+ import { getFiltersByParams } from '../helpers/common/getFiltersByParams';
30
30
  export class FiltersApi {
31
31
  constructor(cfg) {
32
32
  this.setConfig(cfg);
@@ -96,7 +96,7 @@ export class FiltersApi {
96
96
  const scopes = this.getAvailableScopeIds(config);
97
97
  let filterData = getFiltersByVisibility(config.filterData, scopes);
98
98
  const dataset = config.datasets.find(d => { var _a; return d.qrveyid === ((_a = config.filter) === null || _a === void 0 ? void 0 : _a.column.qrveyid); });
99
- filterData = getFiltersByDatasetsColumns(filterData, isEmpty(dataset) ? [] : [dataset]);
99
+ filterData = getFiltersByParams(filterData, { qrveyid: dataset.qrveyid }, { letPassUndefinedProperties: { filter: true }, filterEmptyArrays: { filter: false } });
100
100
  filterData = excludeFiltersByAggregateColumn(filterData);
101
101
  const logics = FDToLogic(filterData);
102
102
  const hierarchyLogic = getLogicByScopesHierarchy(logics, scopes, (_a = config.filter) === null || _a === void 0 ? void 0 : _a.extras.scope);
@@ -118,9 +118,9 @@ export class FiltersApi {
118
118
  * @returns a collection of the pair Scopes and Scope IDs
119
119
  */
120
120
  getAvailableScopeIds(config) {
121
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
122
- return getAvailableScopes(Object.assign(Object.assign({}, getAvailableScopesIDsByConfig(config)), { panelid: FILTER_SCOPE.CHART === ((_a = config.filter) === null || _a === void 0 ? void 0 : _a.extras.scope) ? (_b = config.filter) === null || _b === void 0 ? void 0 : _b.extras.scopeid : undefined, scopeid: (_c = config.filter) === null || _c === void 0 ? void 0 : _c.extras.scopeid, qrveyid: (_e = (_d = config.filter) === null || _d === void 0 ? void 0 : _d.column) === null || _e === void 0 ? void 0 : _e.qrveyid, defaultid: [FILTER_SCOPE.DEFAULT].includes((_f = config.filter) === null || _f === void 0 ? void 0 : _f.extras.scope) ? (_h = (_g = config.filter) === null || _g === void 0 ? void 0 : _g.column) === null || _h === void 0 ? void 0 : _h.qrveyid : undefined, scope: undefined, predefinedScopes: [
123
- { label: FILTER_SCOPE.DATA, id: (_k = (_j = config.filter) === null || _j === void 0 ? void 0 : _j.column) === null || _k === void 0 ? void 0 : _k.qrveyid }
121
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
122
+ return getAvailableScopes(Object.assign(Object.assign({}, getAvailableScopesIDsByConfig(config)), { panelid: FILTER_SCOPE.CHART === ((_a = config.filter) === null || _a === void 0 ? void 0 : _a.extras.scope) ? (_b = config.filter) === null || _b === void 0 ? void 0 : _b.extras.scopeid : undefined, scopeid: (_c = config.filter) === null || _c === void 0 ? void 0 : _c.extras.scopeid, qrveyid: (_e = (_d = config.filter) === null || _d === void 0 ? void 0 : _d.column) === null || _e === void 0 ? void 0 : _e.qrveyid, defaultid: (_g = (_f = config.filter) === null || _f === void 0 ? void 0 : _f.column) === null || _g === void 0 ? void 0 : _g.qrveyid, scope: undefined, predefinedScopes: [
123
+ { label: FILTER_SCOPE.DATA, id: (_j = (_h = config.filter) === null || _h === void 0 ? void 0 : _h.column) === null || _j === void 0 ? void 0 : _j.qrveyid }
124
124
  ] }));
125
125
  }
126
126
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qrvey/utils",
3
- "version": "1.3.0-19",
3
+ "version": "1.3.0-21",
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",
@@ -25,10 +25,10 @@ import { IFUFlattenedFilter } from '../interfaces/ui/IFUFlattenedFilter';
25
25
  import { areStaticColumnValues } from '../../qrvey/helpers/areStaticColumnValues';
26
26
  import { getValuesFromDataset } from '../helpers/common/getValuesFromDataset';
27
27
  import { IFFiltersGetData } from '../interfaces/functions/IFFiltersGetData';
28
- import { getFiltersByDatasetsColumns } from '../helpers/common/getFiltersByDatasetsColumns';
29
28
  import { IFUData } from '../interfaces/ui/IFUData';
30
29
  import { getDatasetByColumn } from '../../qrvey/helpers/getDatasetByColumn';
31
30
  import { getLogicByDatasets } from '../helpers/backend/getLogicByDatasets';
31
+ import { getFiltersByParams } from '../helpers/common/getFiltersByParams';
32
32
 
33
33
 
34
34
  interface IFilterApiConfig extends IFilterConfig {
@@ -111,7 +111,7 @@ export class FiltersApi {
111
111
  const scopes = this.getAvailableScopeIds(config);
112
112
  let filterData = getFiltersByVisibility(config.filterData, scopes);
113
113
  const dataset = config.datasets.find(d => d.qrveyid === config.filter?.column.qrveyid);
114
- filterData = getFiltersByDatasetsColumns(filterData as IFUData, isEmpty(dataset) ? [] : [dataset]);
114
+ filterData = getFiltersByParams(filterData, { qrveyid: dataset.qrveyid }, { letPassUndefinedProperties: { filter: true }, filterEmptyArrays: { filter: false } }) as IFUData;
115
115
  filterData = excludeFiltersByAggregateColumn(filterData);
116
116
  const logics = FDToLogic(filterData);
117
117
  const hierarchyLogic = getLogicByScopesHierarchy(logics, scopes, config.filter?.extras.scope);
@@ -141,7 +141,7 @@ export class FiltersApi {
141
141
  panelid: FILTER_SCOPE.CHART === config.filter?.extras.scope ? config.filter?.extras.scopeid : undefined,
142
142
  scopeid: config.filter?.extras.scopeid,
143
143
  qrveyid: config.filter?.column?.qrveyid,
144
- defaultid: [FILTER_SCOPE.DEFAULT].includes(config.filter?.extras.scope) ? config.filter?.column?.qrveyid : undefined,
144
+ defaultid: config.filter?.column?.qrveyid,
145
145
  scope: undefined,
146
146
  predefinedScopes: [
147
147
  { label: FILTER_SCOPE.DATA, id: config.filter?.column?.qrveyid }