@qrvey/utils 1.3.0-13 → 1.3.0-14
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.
- package/dist/cjs/columns/helpers/getDatasetColumnByDatasets.d.ts +10 -0
- package/dist/cjs/columns/helpers/{getDatasetColumnyDatasets.js → getDatasetColumnByDatasets.js} +7 -0
- package/dist/cjs/columns/helpers/index.d.ts +1 -2
- package/dist/cjs/columns/helpers/index.js +1 -2
- package/dist/cjs/filters/helpers/getAvailableScopes.js +5 -5
- package/dist/cjs/filters/interfaces/common/IFSAvailableScope.d.ts +1 -0
- package/dist/cjs/filters/interfaces/functions/IFFiltersGetData.d.ts +1 -1
- package/dist/cjs/filters/interfaces/index.d.ts +1 -0
- package/dist/cjs/filters/interfaces/index.js +1 -0
- package/dist/cjs/filters/services/Filters.api.js +7 -6
- package/dist/cjs/qrvey/helpers/getDatasetByColumn.d.ts +9 -0
- package/dist/cjs/{columns → qrvey}/helpers/getDatasetByColumn.js +8 -2
- package/dist/cjs/qrvey/helpers/index.d.ts +1 -0
- package/dist/cjs/qrvey/helpers/index.js +1 -0
- package/dist/cjs/services/adapters/BModelToUIModel.adapter.js +1 -1
- package/dist/columns/helpers/getDatasetColumnByDatasets.d.ts +10 -0
- package/dist/columns/helpers/{getDatasetColumnyDatasets.js → getDatasetColumnByDatasets.js} +7 -0
- package/dist/columns/helpers/index.d.ts +1 -2
- package/dist/columns/helpers/index.js +1 -2
- package/dist/filters/helpers/getAvailableScopes.js +5 -5
- package/dist/filters/interfaces/common/IFSAvailableScope.d.ts +1 -0
- package/dist/filters/interfaces/functions/IFFiltersGetData.d.ts +1 -1
- package/dist/filters/interfaces/index.d.ts +1 -0
- package/dist/filters/interfaces/index.js +1 -0
- package/dist/filters/services/Filters.api.js +7 -6
- package/dist/qrvey/helpers/getDatasetByColumn.d.ts +9 -0
- package/dist/qrvey/helpers/getDatasetByColumn.js +12 -0
- package/dist/qrvey/helpers/index.d.ts +1 -0
- package/dist/qrvey/helpers/index.js +1 -0
- package/dist/services/adapters/BModelToUIModel.adapter.js +1 -1
- package/package.json +1 -1
- package/src/columns/helpers/{getDatasetColumnyDatasets.ts → getDatasetColumnByDatasets.ts} +8 -0
- package/src/columns/helpers/index.ts +1 -2
- package/src/filters/helpers/getAvailableScopes.ts +4 -4
- package/src/filters/interfaces/common/IFSAvailableScope.ts +1 -0
- package/src/filters/interfaces/functions/IFFiltersGetData.ts +1 -1
- package/src/filters/interfaces/index.ts +1 -0
- package/src/filters/services/Filters.api.ts +6 -3
- package/src/qrvey/helpers/getDatasetByColumn.ts +15 -0
- package/src/qrvey/helpers/index.ts +1 -0
- package/src/services/adapters/BModelToUIModel.adapter.ts +1 -1
- package/dist/cjs/columns/helpers/getDatasetByColumn.d.ts +0 -3
- package/dist/cjs/columns/helpers/getDatasetColumnyDatasets.d.ts +0 -3
- package/dist/columns/helpers/getDatasetByColumn.d.ts +0 -3
- package/dist/columns/helpers/getDatasetByColumn.js +0 -6
- package/dist/columns/helpers/getDatasetColumnyDatasets.d.ts +0 -3
- package/src/columns/helpers/getDatasetByColumn.ts +0 -9
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IDataset } from "../../qrvey/interfaces/IDataset";
|
|
2
|
+
import { IColumn } from "../interfaces/IColumn";
|
|
3
|
+
/**
|
|
4
|
+
* Gets a column from a dataset.
|
|
5
|
+
* Recieves a partial column object and received a full column object from the Dataset
|
|
6
|
+
* @param column a partial column object
|
|
7
|
+
* @param datasets the datasets to look for the colun
|
|
8
|
+
* @returns the Column object
|
|
9
|
+
*/
|
|
10
|
+
export declare function getDatasetColumnByDatasets(column: Partial<IColumn>, datasets: IDataset[]): IColumn;
|
package/dist/cjs/columns/helpers/{getDatasetColumnyDatasets.js → getDatasetColumnByDatasets.js}
RENAMED
|
@@ -3,6 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getDatasetColumnByDatasets = void 0;
|
|
4
4
|
const isEmpty_1 = require("../../general/mix/isEmpty");
|
|
5
5
|
const getDatasetColumn_1 = require("./getDatasetColumn");
|
|
6
|
+
/**
|
|
7
|
+
* Gets a column from a dataset.
|
|
8
|
+
* Recieves a partial column object and received a full column object from the Dataset
|
|
9
|
+
* @param column a partial column object
|
|
10
|
+
* @param datasets the datasets to look for the colun
|
|
11
|
+
* @returns the Column object
|
|
12
|
+
*/
|
|
6
13
|
function getDatasetColumnByDatasets(column, datasets) {
|
|
7
14
|
if ((0, isEmpty_1.isEmpty)(column) || (0, isEmpty_1.isEmpty)(datasets))
|
|
8
15
|
return;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export * from './getColumnsLabel';
|
|
2
|
-
export * from './getDatasetByColumn';
|
|
3
2
|
export * from './getDatasetColumn';
|
|
4
|
-
export * from './
|
|
3
|
+
export * from './getDatasetColumnByDatasets';
|
|
5
4
|
export * from './getModelColumn';
|
|
6
5
|
export * from './isComplexColumn';
|
|
7
6
|
export * from './isDateColumn';
|
|
@@ -15,9 +15,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./getColumnsLabel"), exports);
|
|
18
|
-
__exportStar(require("./getDatasetByColumn"), exports);
|
|
19
18
|
__exportStar(require("./getDatasetColumn"), exports);
|
|
20
|
-
__exportStar(require("./
|
|
19
|
+
__exportStar(require("./getDatasetColumnByDatasets"), exports);
|
|
21
20
|
__exportStar(require("./getModelColumn"), exports);
|
|
22
21
|
__exportStar(require("./isComplexColumn"), exports);
|
|
23
22
|
__exportStar(require("./isDateColumn"), exports);
|
|
@@ -17,18 +17,18 @@ function getAvailableScopes(config) {
|
|
|
17
17
|
if (!(0, isEmpty_1.isEmpty)(config.predefinedScopes))
|
|
18
18
|
scopes = config.predefinedScopes;
|
|
19
19
|
scopes = [...scopes, { label: FILTER_SCOPE_1.FILTER_SCOPE.GLOBAL, id: undefined }];
|
|
20
|
-
if (config.tabid != null || config.pageid != null) {
|
|
20
|
+
if (config.tabid != null || config.pageid != null || config.panelid != null) {
|
|
21
21
|
if (config.pageid)
|
|
22
22
|
scopes = [...scopes, { label: FILTER_SCOPE_1.FILTER_SCOPE.PAGE, id: config.pageid }];
|
|
23
23
|
if (config.tabid)
|
|
24
24
|
scopes = [...scopes, { label: FILTER_SCOPE_1.FILTER_SCOPE.TAB, id: config.tabid }];
|
|
25
25
|
if (config.defaultid)
|
|
26
26
|
scopes = [...scopes, { label: FILTER_SCOPE_1.FILTER_SCOPE.DEFAULT, id: config.defaultid }];
|
|
27
|
-
|
|
27
|
+
if (config.panelid || config.tabid || config.pageid)
|
|
28
|
+
scopes = [...scopes, { label: FILTER_SCOPE_1.FILTER_SCOPE.CHART, id: config.panelid || config.tabid || config.pageid }];
|
|
28
29
|
}
|
|
29
|
-
else {
|
|
30
|
-
|
|
31
|
-
scopes = [...scopes, { label: FILTER_SCOPE_1.FILTER_SCOPE.DEFAULT, id: config.defaultid }];
|
|
30
|
+
else if (config.defaultid) {
|
|
31
|
+
scopes = [...scopes, { label: FILTER_SCOPE_1.FILTER_SCOPE.DEFAULT, id: config.defaultid }];
|
|
32
32
|
}
|
|
33
33
|
return scopes;
|
|
34
34
|
}
|
|
@@ -6,7 +6,7 @@ import { IFUChartSettings } from "../ui/IFUChartSettings";
|
|
|
6
6
|
import { IFUFlattenedFilter } from "../ui/IFUFlattenedFilter";
|
|
7
7
|
export interface IFFiltersGetData {
|
|
8
8
|
chartRequest?: IFUChartSettings;
|
|
9
|
-
|
|
9
|
+
datasets: IDataset[];
|
|
10
10
|
filterData?: IFSData;
|
|
11
11
|
filter: IFUFlattenedFilter;
|
|
12
12
|
pageid?: string;
|
|
@@ -31,6 +31,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
31
31
|
__exportStar(require("./backend/index"), exports);
|
|
32
32
|
__exportStar(require("./builder/index"), exports);
|
|
33
33
|
__exportStar(require("./common/index"), exports);
|
|
34
|
+
__exportStar(require("./functions/index"), exports);
|
|
34
35
|
__exportStar(require("./panel/index"), exports);
|
|
35
36
|
__exportStar(require("./ui/index"), exports);
|
|
36
37
|
__exportStar(require("./IFDateProperty"), exports);
|
|
@@ -31,6 +31,7 @@ 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
33
|
const getFiltersByDatasetsColumns_1 = require("../helpers/common/getFiltersByDatasetsColumns");
|
|
34
|
+
const getDatasetByColumn_1 = require("../../qrvey/helpers/getDatasetByColumn");
|
|
34
35
|
class FiltersApi {
|
|
35
36
|
constructor(cfg) {
|
|
36
37
|
this.setConfig(cfg);
|
|
@@ -58,14 +59,14 @@ class FiltersApi {
|
|
|
58
59
|
// return DataTokensApi.getAll(config);
|
|
59
60
|
// }
|
|
60
61
|
getData(config, resetApi = false) {
|
|
61
|
-
var _a, _b, _c, _d, _e;
|
|
62
|
+
var _a, _b, _c, _d, _e, _f;
|
|
62
63
|
let promise;
|
|
63
64
|
if ((0, areStaticColumnValues_1.areStaticColumnValues)((_a = config.filter) === null || _a === void 0 ? void 0 : _a.column) && (0, isEmpty_1.isEmpty)((_b = config.filter) === null || _b === void 0 ? void 0 : _b.column.aggregate)) {
|
|
64
65
|
promise = (0, getValuesFromDataset_1.getValuesFromDataset)({
|
|
65
66
|
column: (_c = config.filter) === null || _c === void 0 ? void 0 : _c.column,
|
|
66
67
|
property: (_d = config.filter) === null || _d === void 0 ? void 0 : _d.property,
|
|
67
68
|
lookupDisplay: (_e = config.filter) === null || _e === void 0 ? void 0 : _e.lookupDisplayIndex,
|
|
68
|
-
dataset: config.
|
|
69
|
+
dataset: (0, getDatasetByColumn_1.getDatasetByColumn)((_f = config.filter) === null || _f === void 0 ? void 0 : _f.column, config.datasets),
|
|
69
70
|
value: config.valueText,
|
|
70
71
|
});
|
|
71
72
|
}
|
|
@@ -99,7 +100,7 @@ class FiltersApi {
|
|
|
99
100
|
var _a;
|
|
100
101
|
const scopes = this.getAvailableScopeIds(config);
|
|
101
102
|
let filterData = (0, getFiltersByVisibility_1.getFiltersByVisibility)(config.filterData, scopes);
|
|
102
|
-
filterData = (0, getFiltersByDatasetsColumns_1.getFiltersByDatasetsColumns)(filterData,
|
|
103
|
+
filterData = (0, getFiltersByDatasetsColumns_1.getFiltersByDatasetsColumns)(filterData, config.datasets);
|
|
103
104
|
filterData = (0, excludeFiltersByAggregateColumn_1.excludeFiltersByAggregateColumn)(filterData);
|
|
104
105
|
const logics = (0, FDToLogic_1.FDToLogic)(filterData);
|
|
105
106
|
const hierarchyLogic = (0, getLogicByScopesHierarchy_1.getLogicByScopesHierarchy)(logics, scopes, (_a = config.filter) === null || _a === void 0 ? void 0 : _a.extras.scope);
|
|
@@ -121,9 +122,9 @@ class FiltersApi {
|
|
|
121
122
|
* @returns a collection of the pair Scopes and Scope IDs
|
|
122
123
|
*/
|
|
123
124
|
getAvailableScopeIds(config) {
|
|
124
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
125
|
-
return (0, getAvailableScopes_1.getAvailableScopes)(Object.assign(Object.assign({}, (0, getAvailableScopesIDsByConfig_1.getAvailableScopesIDsByConfig)(config)), {
|
|
126
|
-
{ label: FILTER_SCOPE_1.FILTER_SCOPE.DATA, id: (
|
|
125
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
126
|
+
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: [
|
|
127
|
+
{ 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
128
|
] }));
|
|
128
129
|
}
|
|
129
130
|
/**
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IColumn } from "../../columns/interfaces/IColumn";
|
|
2
|
+
import { IDataset } from "../interfaces/IDataset";
|
|
3
|
+
/**
|
|
4
|
+
* Gets a dataset by a given partial column
|
|
5
|
+
* @param column the partial column
|
|
6
|
+
* @param datasets the collection of dataset to look for one.
|
|
7
|
+
* @returns the found dataset or undefined
|
|
8
|
+
*/
|
|
9
|
+
export declare function getDatasetByColumn(column: Partial<IColumn>, datasets?: IDataset[]): IDataset;
|
|
@@ -2,9 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getDatasetByColumn = void 0;
|
|
4
4
|
const isEmpty_1 = require("../../general/mix/isEmpty");
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Gets a dataset by a given partial column
|
|
7
|
+
* @param column the partial column
|
|
8
|
+
* @param datasets the collection of dataset to look for one.
|
|
9
|
+
* @returns the found dataset or undefined
|
|
10
|
+
*/
|
|
11
|
+
function getDatasetByColumn(column, datasets = []) {
|
|
6
12
|
if ((0, isEmpty_1.isEmpty)(column) || (0, isEmpty_1.isEmpty)(datasets))
|
|
7
13
|
return;
|
|
8
|
-
return datasets.find(dataset => dataset.qrveyid === column.qrveyid
|
|
14
|
+
return datasets.find(dataset => dataset.qrveyid === column.qrveyid);
|
|
9
15
|
}
|
|
10
16
|
exports.getDatasetByColumn = getDatasetByColumn;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './areStaticColumnValues';
|
|
2
2
|
export * from './getCategorizableExpression';
|
|
3
3
|
export * from './getDataAnswersByColumn';
|
|
4
|
+
export * from './getDatasetByColumn';
|
|
4
5
|
export * from './getDropdownAnswers';
|
|
5
6
|
export * from './getExpressionAnswers';
|
|
6
7
|
export * from './getImageAnswers';
|
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./areStaticColumnValues"), exports);
|
|
18
18
|
__exportStar(require("./getCategorizableExpression"), exports);
|
|
19
19
|
__exportStar(require("./getDataAnswersByColumn"), exports);
|
|
20
|
+
__exportStar(require("./getDatasetByColumn"), exports);
|
|
20
21
|
__exportStar(require("./getDropdownAnswers"), exports);
|
|
21
22
|
__exportStar(require("./getExpressionAnswers"), exports);
|
|
22
23
|
__exportStar(require("./getImageAnswers"), exports);
|
|
@@ -12,7 +12,7 @@ function BModelToUIModel(model) {
|
|
|
12
12
|
appid: model.appid,
|
|
13
13
|
branchesMap: (0, BBranchesMapToUIBranchesMap_adapter_1.BBranchesMapToUIBranchesMap)(model.branchesMap),
|
|
14
14
|
columnOrder: model.questionOrder,
|
|
15
|
-
columns: (0, BColumnsToUIColumns_adapter_1.BColumnsToUIColumns)(model.questions.data),
|
|
15
|
+
columns: (0, BColumnsToUIColumns_adapter_1.BColumnsToUIColumns)(model.questions.data, { qrveyid: model.qrveyid }),
|
|
16
16
|
createDate: model.createDate,
|
|
17
17
|
datalinkInfo: model.datalinkInfo,
|
|
18
18
|
modifyDate: model.modifyDate,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IDataset } from "../../qrvey/interfaces/IDataset";
|
|
2
|
+
import { IColumn } from "../interfaces/IColumn";
|
|
3
|
+
/**
|
|
4
|
+
* Gets a column from a dataset.
|
|
5
|
+
* Recieves a partial column object and received a full column object from the Dataset
|
|
6
|
+
* @param column a partial column object
|
|
7
|
+
* @param datasets the datasets to look for the colun
|
|
8
|
+
* @returns the Column object
|
|
9
|
+
*/
|
|
10
|
+
export declare function getDatasetColumnByDatasets(column: Partial<IColumn>, datasets: IDataset[]): IColumn;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { isEmpty } from "../../general/mix/isEmpty";
|
|
2
2
|
import { getDatasetColumn } from "./getDatasetColumn";
|
|
3
|
+
/**
|
|
4
|
+
* Gets a column from a dataset.
|
|
5
|
+
* Recieves a partial column object and received a full column object from the Dataset
|
|
6
|
+
* @param column a partial column object
|
|
7
|
+
* @param datasets the datasets to look for the colun
|
|
8
|
+
* @returns the Column object
|
|
9
|
+
*/
|
|
3
10
|
export function getDatasetColumnByDatasets(column, datasets) {
|
|
4
11
|
if (isEmpty(column) || isEmpty(datasets))
|
|
5
12
|
return;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export * from './getColumnsLabel';
|
|
2
|
-
export * from './getDatasetByColumn';
|
|
3
2
|
export * from './getDatasetColumn';
|
|
4
|
-
export * from './
|
|
3
|
+
export * from './getDatasetColumnByDatasets';
|
|
5
4
|
export * from './getModelColumn';
|
|
6
5
|
export * from './isComplexColumn';
|
|
7
6
|
export * from './isDateColumn';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export * from './getColumnsLabel';
|
|
2
|
-
export * from './getDatasetByColumn';
|
|
3
2
|
export * from './getDatasetColumn';
|
|
4
|
-
export * from './
|
|
3
|
+
export * from './getDatasetColumnByDatasets';
|
|
5
4
|
export * from './getModelColumn';
|
|
6
5
|
export * from './isComplexColumn';
|
|
7
6
|
export * from './isDateColumn';
|
|
@@ -14,18 +14,18 @@ export function getAvailableScopes(config) {
|
|
|
14
14
|
if (!isEmpty(config.predefinedScopes))
|
|
15
15
|
scopes = config.predefinedScopes;
|
|
16
16
|
scopes = [...scopes, { label: FILTER_SCOPE.GLOBAL, id: undefined }];
|
|
17
|
-
if (config.tabid != null || config.pageid != null) {
|
|
17
|
+
if (config.tabid != null || config.pageid != null || config.panelid != null) {
|
|
18
18
|
if (config.pageid)
|
|
19
19
|
scopes = [...scopes, { label: FILTER_SCOPE.PAGE, id: config.pageid }];
|
|
20
20
|
if (config.tabid)
|
|
21
21
|
scopes = [...scopes, { label: FILTER_SCOPE.TAB, id: config.tabid }];
|
|
22
22
|
if (config.defaultid)
|
|
23
23
|
scopes = [...scopes, { label: FILTER_SCOPE.DEFAULT, id: config.defaultid }];
|
|
24
|
-
|
|
24
|
+
if (config.panelid || config.tabid || config.pageid)
|
|
25
|
+
scopes = [...scopes, { label: FILTER_SCOPE.CHART, id: config.panelid || config.tabid || config.pageid }];
|
|
25
26
|
}
|
|
26
|
-
else {
|
|
27
|
-
|
|
28
|
-
scopes = [...scopes, { label: FILTER_SCOPE.DEFAULT, id: config.defaultid }];
|
|
27
|
+
else if (config.defaultid) {
|
|
28
|
+
scopes = [...scopes, { label: FILTER_SCOPE.DEFAULT, id: config.defaultid }];
|
|
29
29
|
}
|
|
30
30
|
return scopes;
|
|
31
31
|
}
|
|
@@ -6,7 +6,7 @@ import { IFUChartSettings } from "../ui/IFUChartSettings";
|
|
|
6
6
|
import { IFUFlattenedFilter } from "../ui/IFUFlattenedFilter";
|
|
7
7
|
export interface IFFiltersGetData {
|
|
8
8
|
chartRequest?: IFUChartSettings;
|
|
9
|
-
|
|
9
|
+
datasets: IDataset[];
|
|
10
10
|
filterData?: IFSData;
|
|
11
11
|
filter: IFUFlattenedFilter;
|
|
12
12
|
pageid?: string;
|
|
@@ -25,6 +25,7 @@ import { getModel } from '../../services/api/getModel.api';
|
|
|
25
25
|
import { areStaticColumnValues } from '../../qrvey/helpers/areStaticColumnValues';
|
|
26
26
|
import { getValuesFromDataset } from '../helpers/common/getValuesFromDataset';
|
|
27
27
|
import { getFiltersByDatasetsColumns } from '../helpers/common/getFiltersByDatasetsColumns';
|
|
28
|
+
import { getDatasetByColumn } from '../../qrvey/helpers/getDatasetByColumn';
|
|
28
29
|
export class FiltersApi {
|
|
29
30
|
constructor(cfg) {
|
|
30
31
|
this.setConfig(cfg);
|
|
@@ -52,14 +53,14 @@ export class FiltersApi {
|
|
|
52
53
|
// return DataTokensApi.getAll(config);
|
|
53
54
|
// }
|
|
54
55
|
getData(config, resetApi = false) {
|
|
55
|
-
var _a, _b, _c, _d, _e;
|
|
56
|
+
var _a, _b, _c, _d, _e, _f;
|
|
56
57
|
let promise;
|
|
57
58
|
if (areStaticColumnValues((_a = config.filter) === null || _a === void 0 ? void 0 : _a.column) && isEmpty((_b = config.filter) === null || _b === void 0 ? void 0 : _b.column.aggregate)) {
|
|
58
59
|
promise = getValuesFromDataset({
|
|
59
60
|
column: (_c = config.filter) === null || _c === void 0 ? void 0 : _c.column,
|
|
60
61
|
property: (_d = config.filter) === null || _d === void 0 ? void 0 : _d.property,
|
|
61
62
|
lookupDisplay: (_e = config.filter) === null || _e === void 0 ? void 0 : _e.lookupDisplayIndex,
|
|
62
|
-
dataset: config.
|
|
63
|
+
dataset: getDatasetByColumn((_f = config.filter) === null || _f === void 0 ? void 0 : _f.column, config.datasets),
|
|
63
64
|
value: config.valueText,
|
|
64
65
|
});
|
|
65
66
|
}
|
|
@@ -93,7 +94,7 @@ export class FiltersApi {
|
|
|
93
94
|
var _a;
|
|
94
95
|
const scopes = this.getAvailableScopeIds(config);
|
|
95
96
|
let filterData = getFiltersByVisibility(config.filterData, scopes);
|
|
96
|
-
filterData = getFiltersByDatasetsColumns(filterData,
|
|
97
|
+
filterData = getFiltersByDatasetsColumns(filterData, config.datasets);
|
|
97
98
|
filterData = excludeFiltersByAggregateColumn(filterData);
|
|
98
99
|
const logics = FDToLogic(filterData);
|
|
99
100
|
const hierarchyLogic = getLogicByScopesHierarchy(logics, scopes, (_a = config.filter) === null || _a === void 0 ? void 0 : _a.extras.scope);
|
|
@@ -115,9 +116,9 @@ export class FiltersApi {
|
|
|
115
116
|
* @returns a collection of the pair Scopes and Scope IDs
|
|
116
117
|
*/
|
|
117
118
|
getAvailableScopeIds(config) {
|
|
118
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
119
|
-
return getAvailableScopes(Object.assign(Object.assign({}, getAvailableScopesIDsByConfig(config)), {
|
|
120
|
-
{ label: FILTER_SCOPE.DATA, id: (
|
|
119
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
120
|
+
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: [
|
|
121
|
+
{ 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
122
|
] }));
|
|
122
123
|
}
|
|
123
124
|
/**
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IColumn } from "../../columns/interfaces/IColumn";
|
|
2
|
+
import { IDataset } from "../interfaces/IDataset";
|
|
3
|
+
/**
|
|
4
|
+
* Gets a dataset by a given partial column
|
|
5
|
+
* @param column the partial column
|
|
6
|
+
* @param datasets the collection of dataset to look for one.
|
|
7
|
+
* @returns the found dataset or undefined
|
|
8
|
+
*/
|
|
9
|
+
export declare function getDatasetByColumn(column: Partial<IColumn>, datasets?: IDataset[]): IDataset;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { isEmpty } from "../../general/mix/isEmpty";
|
|
2
|
+
/**
|
|
3
|
+
* Gets a dataset by a given partial column
|
|
4
|
+
* @param column the partial column
|
|
5
|
+
* @param datasets the collection of dataset to look for one.
|
|
6
|
+
* @returns the found dataset or undefined
|
|
7
|
+
*/
|
|
8
|
+
export function getDatasetByColumn(column, datasets = []) {
|
|
9
|
+
if (isEmpty(column) || isEmpty(datasets))
|
|
10
|
+
return;
|
|
11
|
+
return datasets.find(dataset => dataset.qrveyid === column.qrveyid);
|
|
12
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './areStaticColumnValues';
|
|
2
2
|
export * from './getCategorizableExpression';
|
|
3
3
|
export * from './getDataAnswersByColumn';
|
|
4
|
+
export * from './getDatasetByColumn';
|
|
4
5
|
export * from './getDropdownAnswers';
|
|
5
6
|
export * from './getExpressionAnswers';
|
|
6
7
|
export * from './getImageAnswers';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './areStaticColumnValues';
|
|
2
2
|
export * from './getCategorizableExpression';
|
|
3
3
|
export * from './getDataAnswersByColumn';
|
|
4
|
+
export * from './getDatasetByColumn';
|
|
4
5
|
export * from './getDropdownAnswers';
|
|
5
6
|
export * from './getExpressionAnswers';
|
|
6
7
|
export * from './getImageAnswers';
|
|
@@ -9,7 +9,7 @@ export function BModelToUIModel(model) {
|
|
|
9
9
|
appid: model.appid,
|
|
10
10
|
branchesMap: BBranchesMapToUIBranchesMap(model.branchesMap),
|
|
11
11
|
columnOrder: model.questionOrder,
|
|
12
|
-
columns: BColumnsToUIColumns(model.questions.data),
|
|
12
|
+
columns: BColumnsToUIColumns(model.questions.data, { qrveyid: model.qrveyid }),
|
|
13
13
|
createDate: model.createDate,
|
|
14
14
|
datalinkInfo: model.datalinkInfo,
|
|
15
15
|
modifyDate: model.modifyDate,
|
package/package.json
CHANGED
|
@@ -3,6 +3,14 @@ import { IDataset } from "../../qrvey/interfaces/IDataset";
|
|
|
3
3
|
import { IColumn } from "../interfaces/IColumn";
|
|
4
4
|
import { getDatasetColumn } from "./getDatasetColumn";
|
|
5
5
|
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Gets a column from a dataset.
|
|
9
|
+
* Recieves a partial column object and received a full column object from the Dataset
|
|
10
|
+
* @param column a partial column object
|
|
11
|
+
* @param datasets the datasets to look for the colun
|
|
12
|
+
* @returns the Column object
|
|
13
|
+
*/
|
|
6
14
|
export function getDatasetColumnByDatasets(column: Partial<IColumn>, datasets: IDataset[]): IColumn {
|
|
7
15
|
if (isEmpty(column) || isEmpty(datasets)) return;
|
|
8
16
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export * from './getColumnsLabel';
|
|
2
|
-
export * from './getDatasetByColumn';
|
|
3
2
|
export * from './getDatasetColumn';
|
|
4
|
-
export * from './
|
|
3
|
+
export * from './getDatasetColumnByDatasets';
|
|
5
4
|
export * from './getModelColumn';
|
|
6
5
|
export * from './isComplexColumn';
|
|
7
6
|
export * from './isDateColumn';
|
|
@@ -17,13 +17,13 @@ export function getAvailableScopes(config: IFSAvailableScope): IFSScopeID[] {
|
|
|
17
17
|
if (!isEmpty(config.predefinedScopes)) scopes = config.predefinedScopes;
|
|
18
18
|
scopes = [ ...scopes, { label: FILTER_SCOPE.GLOBAL, id: undefined } ];
|
|
19
19
|
|
|
20
|
-
if (config.tabid != null || config.pageid != null) {
|
|
20
|
+
if (config.tabid != null || config.pageid != null || config.panelid != null) {
|
|
21
21
|
if (config.pageid) scopes = [...scopes, { label: FILTER_SCOPE.PAGE, id: config.pageid }];
|
|
22
22
|
if (config.tabid) scopes = [ ...scopes, { label: FILTER_SCOPE.TAB, id: config.tabid }];
|
|
23
23
|
if (config.defaultid) scopes = [...scopes, { label: FILTER_SCOPE.DEFAULT, id: config.defaultid }];
|
|
24
|
-
scopes = [...scopes, { label: FILTER_SCOPE.CHART, id: config.tabid || config.pageid }];
|
|
25
|
-
} else {
|
|
26
|
-
|
|
24
|
+
if (config.panelid || config.tabid || config.pageid) scopes = [...scopes, { label: FILTER_SCOPE.CHART, id: config.panelid || config.tabid || config.pageid }];
|
|
25
|
+
} else if (config.defaultid) {
|
|
26
|
+
scopes = [...scopes, { label: FILTER_SCOPE.DEFAULT, id: config.defaultid }];
|
|
27
27
|
}
|
|
28
28
|
return scopes;
|
|
29
29
|
}
|
|
@@ -10,6 +10,7 @@ export interface IFSAvailableScope {
|
|
|
10
10
|
qrveyid?: string; // Qrvey ID
|
|
11
11
|
tabid?: string; // Tab ID
|
|
12
12
|
pageid?: string; // Page ID
|
|
13
|
+
panelid?: string; // The ID for Panel Filters
|
|
13
14
|
defaultid?: string; // Default ID
|
|
14
15
|
predefinedScopes?: IFSScopeID[]; // Predefined Scopes
|
|
15
16
|
}
|
|
@@ -27,6 +27,7 @@ import { getValuesFromDataset } from '../helpers/common/getValuesFromDataset';
|
|
|
27
27
|
import { IFFiltersGetData } from '../interfaces/functions/IFFiltersGetData';
|
|
28
28
|
import { getFiltersByDatasetsColumns } from '../helpers/common/getFiltersByDatasetsColumns';
|
|
29
29
|
import { IFUData } from '../interfaces/ui/IFUData';
|
|
30
|
+
import { getDatasetByColumn } from '../../qrvey/helpers/getDatasetByColumn';
|
|
30
31
|
|
|
31
32
|
|
|
32
33
|
interface IFilterApiConfig extends IFilterConfig {
|
|
@@ -76,7 +77,7 @@ export class FiltersApi {
|
|
|
76
77
|
column: config.filter?.column,
|
|
77
78
|
property: config.filter?.property,
|
|
78
79
|
lookupDisplay: config.filter?.lookupDisplayIndex,
|
|
79
|
-
dataset: config.
|
|
80
|
+
dataset: getDatasetByColumn(config.filter?.column, config.datasets),
|
|
80
81
|
value: config.valueText,
|
|
81
82
|
});
|
|
82
83
|
} else {
|
|
@@ -108,7 +109,7 @@ export class FiltersApi {
|
|
|
108
109
|
private getLogic(config: IFSGetDataValues) {
|
|
109
110
|
const scopes = this.getAvailableScopeIds(config);
|
|
110
111
|
let filterData = getFiltersByVisibility(config.filterData, scopes);
|
|
111
|
-
filterData = getFiltersByDatasetsColumns(filterData as IFUData,
|
|
112
|
+
filterData = getFiltersByDatasetsColumns(filterData as IFUData, config.datasets);
|
|
112
113
|
filterData = excludeFiltersByAggregateColumn(filterData);
|
|
113
114
|
const logics = FDToLogic(filterData);
|
|
114
115
|
const hierarchyLogic = getLogicByScopesHierarchy(logics, scopes, config.filter?.extras.scope);
|
|
@@ -135,8 +136,10 @@ export class FiltersApi {
|
|
|
135
136
|
private getAvailableScopeIds(config: IFFiltersGetData): IFSScopeID[] {
|
|
136
137
|
return getAvailableScopes({
|
|
137
138
|
...getAvailableScopesIDsByConfig(config),
|
|
139
|
+
panelid: FILTER_SCOPE.CHART === config.filter?.extras.scope ? config.filter?.extras.scopeid : undefined,
|
|
140
|
+
scopeid: config.filter?.extras.scopeid,
|
|
138
141
|
qrveyid: config.filter?.column?.qrveyid,
|
|
139
|
-
defaultid: [FILTER_SCOPE.DEFAULT
|
|
142
|
+
defaultid: [FILTER_SCOPE.DEFAULT].includes(config.filter?.extras.scope) ? config.filter?.column?.qrveyid : undefined,
|
|
140
143
|
scope: undefined,
|
|
141
144
|
predefinedScopes: [
|
|
142
145
|
{ label: FILTER_SCOPE.DATA, id: config.filter?.column?.qrveyid }
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IColumn } from "../../columns/interfaces/IColumn";
|
|
2
|
+
import { isEmpty } from "../../general/mix/isEmpty";
|
|
3
|
+
import { IDataset } from "../interfaces/IDataset";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Gets a dataset by a given partial column
|
|
7
|
+
* @param column the partial column
|
|
8
|
+
* @param datasets the collection of dataset to look for one.
|
|
9
|
+
* @returns the found dataset or undefined
|
|
10
|
+
*/
|
|
11
|
+
export function getDatasetByColumn(column: Partial<IColumn>, datasets: IDataset[] = []): IDataset {
|
|
12
|
+
if (isEmpty(column) || isEmpty(datasets)) return;
|
|
13
|
+
|
|
14
|
+
return datasets.find(dataset => dataset.qrveyid === column.qrveyid);
|
|
15
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './areStaticColumnValues';
|
|
2
2
|
export * from './getCategorizableExpression';
|
|
3
3
|
export * from './getDataAnswersByColumn';
|
|
4
|
+
export * from './getDatasetByColumn';
|
|
4
5
|
export * from './getDropdownAnswers';
|
|
5
6
|
export * from './getExpressionAnswers';
|
|
6
7
|
export * from './getImageAnswers';
|
|
@@ -12,7 +12,7 @@ export function BModelToUIModel(model: IBModel): IModel {
|
|
|
12
12
|
appid: model.appid,
|
|
13
13
|
branchesMap: BBranchesMapToUIBranchesMap(model.branchesMap),
|
|
14
14
|
columnOrder: model.questionOrder,
|
|
15
|
-
columns: BColumnsToUIColumns(model.questions.data),
|
|
15
|
+
columns: BColumnsToUIColumns(model.questions.data, { qrveyid: model.qrveyid }),
|
|
16
16
|
createDate: model.createDate,
|
|
17
17
|
datalinkInfo: model.datalinkInfo,
|
|
18
18
|
modifyDate: model.modifyDate,
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { isEmpty } from "../../general/mix/isEmpty";
|
|
2
|
-
export function getDatasetByColumn(column, datasets) {
|
|
3
|
-
if (isEmpty(column) || isEmpty(datasets))
|
|
4
|
-
return;
|
|
5
|
-
return datasets.find(dataset => dataset.qrveyid === column.qrveyid && dataset.linkid === column.linkid);
|
|
6
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { isEmpty } from "../../general/mix/isEmpty";
|
|
2
|
-
import { IDataset } from "../../qrvey/interfaces/IDataset";
|
|
3
|
-
import { IColumn } from "../interfaces/IColumn";
|
|
4
|
-
|
|
5
|
-
export function getDatasetByColumn(column: IColumn, datasets: IDataset[]) {
|
|
6
|
-
if (isEmpty(column) || isEmpty(datasets)) return;
|
|
7
|
-
|
|
8
|
-
return datasets.find(dataset => dataset.qrveyid === column.qrveyid && dataset.linkid === column.linkid);
|
|
9
|
-
}
|