@sisense/sdk-data 1.7.1 → 1.8.0
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/README.md +1 -1
- package/dist/dimensional-model/analytics/factory.js +2 -2
- package/dist/dimensional-model/base.d.ts +11 -0
- package/dist/dimensional-model/base.js +17 -0
- package/dist/dimensional-model/filters/factory.d.ts +9 -0
- package/dist/dimensional-model/filters/factory.js +13 -0
- package/dist/dimensional-model/filters/utils/filter-jaql-util.d.ts +25 -0
- package/dist/dimensional-model/filters/utils/filter-jaql-util.js +167 -0
- package/dist/dimensional-model/filters/utils/modern-analytics-filters/condition-filter-util.d.ts +2 -0
- package/dist/dimensional-model/filters/utils/modern-analytics-filters/condition-filter-util.js +27 -0
- package/dist/dimensional-model/filters/utils/modern-analytics-filters/condition-types-util.d.ts +24 -0
- package/dist/dimensional-model/filters/utils/modern-analytics-filters/condition-types-util.js +138 -0
- package/dist/dimensional-model/filters/utils/modern-analytics-filters/date-time-filter-util.d.ts +2 -0
- package/dist/dimensional-model/filters/utils/modern-analytics-filters/date-time-filter-util.js +8 -0
- package/dist/dimensional-model/filters/utils/modern-analytics-filters/filter-types-util.d.ts +31 -0
- package/dist/dimensional-model/filters/utils/modern-analytics-filters/filter-types-util.js +114 -0
- package/dist/dimensional-model/filters/utils/modern-analytics-filters/types.d.ts +200 -0
- package/dist/dimensional-model/filters/utils/modern-analytics-filters/types.js +97 -0
- package/dist/dimensional-model/interfaces.d.ts +58 -8
- package/dist/dimensional-model/measures/factory.d.ts +2 -2
- package/dist/dimensional-model/measures/factory.js +2 -2
- package/dist/dimensional-model/types.d.ts +27 -4
- package/dist/dimensional-model/types.js +5 -5
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -2
- package/dist/utils.d.ts +12 -1
- package/dist/utils.js +17 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
This library, which is a part of Sisense Compose SDK, is
|
|
2
|
-
for implementing the elements of
|
|
2
|
+
for implementing the elements of dimensional modeling
|
|
3
3
|
including dimensions, attributes, measures, and filters.
|
|
@@ -97,7 +97,7 @@ export const boxWhiskerIqrOutliers = (target) => {
|
|
|
97
97
|
});
|
|
98
98
|
outliersAttrWithInnerFilter.name = `${outliersAttrWithInnerFilter.name} (Outliers)`;
|
|
99
99
|
outliersAttrWithInnerFilter.jaql = () => {
|
|
100
|
-
return Object.assign(Object.assign({}, target.jaql()), { filter: {
|
|
100
|
+
return Object.assign(Object.assign({}, target.jaql(true)), { filter: {
|
|
101
101
|
or: [
|
|
102
102
|
{
|
|
103
103
|
fromNotEqual: outliersMax.jaql(true),
|
|
@@ -125,7 +125,7 @@ export const boxWhiskerStdDevOutliers = (target) => {
|
|
|
125
125
|
Attr: target,
|
|
126
126
|
});
|
|
127
127
|
outliersAttrWithInnerFilter.jaql = () => {
|
|
128
|
-
return Object.assign(Object.assign({}, target.jaql()), { filter: {
|
|
128
|
+
return Object.assign(Object.assign({}, target.jaql(true)), { filter: {
|
|
129
129
|
or: [
|
|
130
130
|
{
|
|
131
131
|
fromNotEqual: outliersMax.jaql(true),
|
|
@@ -41,3 +41,14 @@ export declare abstract class DimensionalElement implements Element {
|
|
|
41
41
|
* @internal
|
|
42
42
|
*/
|
|
43
43
|
export declare function normalizeName(name: string): string;
|
|
44
|
+
/**
|
|
45
|
+
* Normalize attribute name
|
|
46
|
+
*
|
|
47
|
+
* @param tableName - Table name (e.g., Commerce Sales)
|
|
48
|
+
* @param columnName - Column name (e.g., Order Date)
|
|
49
|
+
* @param dateLevel - Date level (e.g., Years)
|
|
50
|
+
* @param modelName - module name (e.g., DM)
|
|
51
|
+
* @return full normalized attribute name (e.g., DM.CommerceSales.OrderDate.Years)
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
export declare function normalizeAttributeName(tableName: string, columnName: string, dateLevel?: string, modelName?: string): string;
|
|
@@ -51,3 +51,20 @@ export function normalizeName(name) {
|
|
|
51
51
|
}
|
|
52
52
|
return normalizedName;
|
|
53
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Normalize attribute name
|
|
56
|
+
*
|
|
57
|
+
* @param tableName - Table name (e.g., Commerce Sales)
|
|
58
|
+
* @param columnName - Column name (e.g., Order Date)
|
|
59
|
+
* @param dateLevel - Date level (e.g., Years)
|
|
60
|
+
* @param modelName - module name (e.g., DM)
|
|
61
|
+
* @return full normalized attribute name (e.g., DM.CommerceSales.OrderDate.Years)
|
|
62
|
+
* @internal
|
|
63
|
+
*/
|
|
64
|
+
export function normalizeAttributeName(tableName, columnName, dateLevel, modelName) {
|
|
65
|
+
return ((modelName && modelName.length > 0 ? modelName + '.' : '') +
|
|
66
|
+
normalizeName(tableName) +
|
|
67
|
+
'.' +
|
|
68
|
+
normalizeName(columnName) +
|
|
69
|
+
(dateLevel && dateLevel.length > 0 ? '.' + dateLevel : ''));
|
|
70
|
+
}
|
|
@@ -698,3 +698,12 @@ export declare namespace logic {
|
|
|
698
698
|
*/
|
|
699
699
|
const or: (left: FilterRelationsNode, right: FilterRelationsNode) => FilterRelations;
|
|
700
700
|
}
|
|
701
|
+
/**
|
|
702
|
+
* Creates a filter from JAQL
|
|
703
|
+
*
|
|
704
|
+
* @param jaql - Filter Jaql
|
|
705
|
+
* @param instanceid - Filter instance id
|
|
706
|
+
* @returns A filter instance
|
|
707
|
+
* @internal
|
|
708
|
+
*/
|
|
709
|
+
export declare function customFilter(jaql: any, instanceid?: string): Filter;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TextOperators, NumericOperators, DateOperators, LogicalOperators, RankingOperators, LogicalAttributeFilter, MembersFilter, ExcludeFilter, NumericFilter, MeasureFilter, RankingFilter, TextFilter, DateRangeFilter, RelativeDateFilter, } from './filters.js';
|
|
2
|
+
import { createGenericFilter } from './utils/filter-jaql-util.js';
|
|
2
3
|
// LOGICAL FILTERS
|
|
3
4
|
/**
|
|
4
5
|
* Creates a filter representing the union of multiple filters on the same attribute. The resulting
|
|
@@ -810,3 +811,15 @@ export var logic;
|
|
|
810
811
|
right: relate(right),
|
|
811
812
|
});
|
|
812
813
|
})(logic = logic || (logic = {}));
|
|
814
|
+
// CUSTOM FILTER
|
|
815
|
+
/**
|
|
816
|
+
* Creates a filter from JAQL
|
|
817
|
+
*
|
|
818
|
+
* @param jaql - Filter Jaql
|
|
819
|
+
* @param instanceid - Filter instance id
|
|
820
|
+
* @returns A filter instance
|
|
821
|
+
* @internal
|
|
822
|
+
*/
|
|
823
|
+
export function customFilter(jaql, instanceid) {
|
|
824
|
+
return createGenericFilter(jaql, instanceid);
|
|
825
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ConditionJaql, FilterJaqlInternal, RangeJaql, SpecificItemsJaql } from './modern-analytics-filters/types.js';
|
|
2
|
+
import { Attribute, Filter, LevelAttribute } from '../../interfaces.js';
|
|
3
|
+
import { FilterJaql } from '../../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Creates a generic filter if the JAQL cannot be translated to a specific filter type.
|
|
6
|
+
*
|
|
7
|
+
* @param jaql - The JAQL object.
|
|
8
|
+
* @param instanceid - The instance ID.
|
|
9
|
+
* @returns - The created Filter object.
|
|
10
|
+
*/
|
|
11
|
+
export declare const createGenericFilter: (jaql: FilterJaql | FilterJaqlInternal, instanceid?: string) => Filter;
|
|
12
|
+
export declare const createFilterIncludeAll: (attribute: Attribute) => Filter;
|
|
13
|
+
export declare const createFilterFromConditionJaql: (attribute: Attribute, conditionJaql: ConditionJaql) => Filter;
|
|
14
|
+
export declare const createFilterFromSpecificItemsJaql: (attribute: Attribute, specificItemsJaql: SpecificItemsJaql) => Filter;
|
|
15
|
+
export declare const createFilterFromRangeJaql: (attribute: LevelAttribute, rangeJaql: RangeJaql) => Filter;
|
|
16
|
+
export declare function capitalizeFirstLetter(str: string): string;
|
|
17
|
+
export declare const createAttributeFromFilterJaql: (jaql: FilterJaql | FilterJaqlInternal) => Attribute | LevelAttribute;
|
|
18
|
+
/**
|
|
19
|
+
* Creates a filter from a JAQL object.
|
|
20
|
+
*
|
|
21
|
+
* @param jaql - The filter JAQL object.
|
|
22
|
+
* @param instanceid - The instance ID.
|
|
23
|
+
* @returns - The created Filter object.
|
|
24
|
+
*/
|
|
25
|
+
export declare const createFilterFromJaqlInternal: (jaql: FilterJaqlInternal, instanceid?: string) => Filter;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/* eslint-disable max-lines */
|
|
2
|
+
import { ConditionTypes, FILTER_TYPES, } from './modern-analytics-filters/types.js';
|
|
3
|
+
import { isNumber } from '../../simple-column-types.js';
|
|
4
|
+
import { MetadataTypes } from '../../types.js';
|
|
5
|
+
import { DimensionalAttribute, DimensionalLevelAttribute } from '../../attributes.js';
|
|
6
|
+
import * as filterFactory from '../factory.js';
|
|
7
|
+
import { getSelectedConditionOption } from './modern-analytics-filters/condition-filter-util.js';
|
|
8
|
+
import { extractTypeFromFilterJaql } from './modern-analytics-filters/filter-types-util.js';
|
|
9
|
+
import { normalizeAttributeName } from '../../base.js';
|
|
10
|
+
const DATA_MODEL_MODULE_NAME = 'DM';
|
|
11
|
+
/**
|
|
12
|
+
* High order function to construct compose code for filter factory functions
|
|
13
|
+
*
|
|
14
|
+
* @param func - filter factory function
|
|
15
|
+
*/
|
|
16
|
+
function withComposeCode(func) {
|
|
17
|
+
return function (...args) {
|
|
18
|
+
const argValues = args
|
|
19
|
+
.map((arg) => {
|
|
20
|
+
if (MetadataTypes.isAttribute(arg)) {
|
|
21
|
+
return arg.composeCode;
|
|
22
|
+
}
|
|
23
|
+
if (Array.isArray(arg)) {
|
|
24
|
+
return ('[' +
|
|
25
|
+
arg
|
|
26
|
+
.map((item) => {
|
|
27
|
+
if (typeof item === 'string') {
|
|
28
|
+
return `'${item}'`;
|
|
29
|
+
}
|
|
30
|
+
if (typeof item === 'number') {
|
|
31
|
+
return item;
|
|
32
|
+
}
|
|
33
|
+
return JSON.stringify(item);
|
|
34
|
+
})
|
|
35
|
+
.join(', ') +
|
|
36
|
+
']');
|
|
37
|
+
}
|
|
38
|
+
return JSON.stringify(arg);
|
|
39
|
+
})
|
|
40
|
+
.join(', ');
|
|
41
|
+
const signature = `filterFactory.${func.name}(${argValues})`;
|
|
42
|
+
const filter = func(...args);
|
|
43
|
+
filter.composeCode = signature;
|
|
44
|
+
return filter;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Creates a generic filter if the JAQL cannot be translated to a specific filter type.
|
|
49
|
+
*
|
|
50
|
+
* @param jaql - The JAQL object.
|
|
51
|
+
* @param instanceid - The instance ID.
|
|
52
|
+
* @returns - The created Filter object.
|
|
53
|
+
*/
|
|
54
|
+
export const createGenericFilter = (jaql, instanceid) => {
|
|
55
|
+
return {
|
|
56
|
+
guid: instanceid,
|
|
57
|
+
jaql: (nested) => {
|
|
58
|
+
if (nested) {
|
|
59
|
+
return jaql;
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
jaql,
|
|
63
|
+
panel: 'scope',
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
attribute: {
|
|
67
|
+
id: jaql.dim,
|
|
68
|
+
},
|
|
69
|
+
type: 'filter',
|
|
70
|
+
serializable() {
|
|
71
|
+
return Object.assign(Object.assign({}, this), { jaql: this.jaql() });
|
|
72
|
+
},
|
|
73
|
+
toJSON() {
|
|
74
|
+
return this.serializable();
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
export const createFilterIncludeAll = (attribute) => {
|
|
79
|
+
return withComposeCode(filterFactory.members)(attribute, []);
|
|
80
|
+
};
|
|
81
|
+
export const createFilterFromConditionJaql = (attribute, conditionJaql) => {
|
|
82
|
+
switch (getSelectedConditionOption(conditionJaql)) {
|
|
83
|
+
case ConditionTypes.BOTTOM:
|
|
84
|
+
return withComposeCode(filterFactory.bottomRanking)(attribute, conditionJaql[ConditionTypes.BOTTOM]);
|
|
85
|
+
case ConditionTypes.GREATER_THAN:
|
|
86
|
+
return withComposeCode(filterFactory.greaterThan)(attribute, conditionJaql[ConditionTypes.GREATER_THAN]);
|
|
87
|
+
case ConditionTypes.GREATER_THAN_OR_EQUAL:
|
|
88
|
+
return withComposeCode(filterFactory.greaterThanOrEqual)(attribute, conditionJaql[ConditionTypes.GREATER_THAN_OR_EQUAL]);
|
|
89
|
+
case ConditionTypes.EQUALS:
|
|
90
|
+
return withComposeCode(filterFactory.equals)(attribute, conditionJaql[ConditionTypes.EQUALS]);
|
|
91
|
+
}
|
|
92
|
+
throw 'Jaql contains unsupported condition filter: ' + JSON.stringify(conditionJaql);
|
|
93
|
+
};
|
|
94
|
+
export const createFilterFromSpecificItemsJaql = (attribute, specificItemsJaql) => {
|
|
95
|
+
return withComposeCode(filterFactory.members)(attribute, specificItemsJaql.members);
|
|
96
|
+
};
|
|
97
|
+
export const createFilterFromRangeJaql = (attribute, rangeJaql) => {
|
|
98
|
+
return withComposeCode(filterFactory.dateRange)(attribute, rangeJaql.from, rangeJaql.to);
|
|
99
|
+
};
|
|
100
|
+
// TODO
|
|
101
|
+
// export const createFilterFromPeriodJaql = (
|
|
102
|
+
// attribute: LevelAttribute,
|
|
103
|
+
// periodJaql: PeriodJaql,
|
|
104
|
+
// ): Filter => {
|
|
105
|
+
// return filterFactory.dateRange(attribute, rangeJaql.from as string, rangeJaql.to as string);
|
|
106
|
+
// };
|
|
107
|
+
export function capitalizeFirstLetter(str) {
|
|
108
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
109
|
+
}
|
|
110
|
+
export const createAttributeFromFilterJaql = (jaql) => {
|
|
111
|
+
if (jaql.level) {
|
|
112
|
+
// while level in JAQL is in lowercase, LevelAttribute.granularity has the first char capitalized
|
|
113
|
+
const dateLevel = capitalizeFirstLetter(jaql.level);
|
|
114
|
+
const levelAttribute = new DimensionalLevelAttribute(jaql.column, jaql.dim, dateLevel);
|
|
115
|
+
levelAttribute.composeCode = normalizeAttributeName(jaql.table, jaql.column, dateLevel, DATA_MODEL_MODULE_NAME);
|
|
116
|
+
return levelAttribute;
|
|
117
|
+
}
|
|
118
|
+
const attributeType = isNumber(jaql.datatype)
|
|
119
|
+
? MetadataTypes.NumericAttribute
|
|
120
|
+
: MetadataTypes.TextAttribute;
|
|
121
|
+
const attribute = new DimensionalAttribute(jaql.column, jaql.dim, attributeType);
|
|
122
|
+
attribute.composeCode = normalizeAttributeName(jaql.table, jaql.column, undefined, DATA_MODEL_MODULE_NAME);
|
|
123
|
+
return attribute;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Creates a filter from a JAQL object.
|
|
127
|
+
*
|
|
128
|
+
* @param jaql - The filter JAQL object.
|
|
129
|
+
* @param instanceid - The instance ID.
|
|
130
|
+
* @returns - The created Filter object.
|
|
131
|
+
*/
|
|
132
|
+
// eslint-disable-next-line complexity
|
|
133
|
+
export const createFilterFromJaqlInternal = (jaql, instanceid) => {
|
|
134
|
+
try {
|
|
135
|
+
const jaqlWrapperType = extractTypeFromFilterJaql(jaql, jaql.datatype);
|
|
136
|
+
const { filter: filterJaqlWithType } = jaqlWrapperType;
|
|
137
|
+
const { jaqlType } = filterJaqlWithType;
|
|
138
|
+
const attribute = createAttributeFromFilterJaql(jaql);
|
|
139
|
+
switch (jaqlType) {
|
|
140
|
+
case FILTER_TYPES.INCLUDE_ALL:
|
|
141
|
+
return createFilterIncludeAll(attribute);
|
|
142
|
+
case FILTER_TYPES.SPECIFIC_ITEMS:
|
|
143
|
+
return createFilterFromSpecificItemsJaql(attribute, filterJaqlWithType);
|
|
144
|
+
case FILTER_TYPES.CONDITION:
|
|
145
|
+
return createFilterFromConditionJaql(attribute, filterJaqlWithType);
|
|
146
|
+
case FILTER_TYPES.DATE_RANGE:
|
|
147
|
+
return createFilterFromRangeJaql(attribute, filterJaqlWithType);
|
|
148
|
+
case FILTER_TYPES.PERIOD:
|
|
149
|
+
// TODO implement Filters of Period type
|
|
150
|
+
break;
|
|
151
|
+
case FILTER_TYPES.NUMERIC_RANGE:
|
|
152
|
+
// TODO implement Filters of Numeric Range type
|
|
153
|
+
break;
|
|
154
|
+
case FILTER_TYPES.ADVANCED:
|
|
155
|
+
// TODO implement Filters of Advanced type
|
|
156
|
+
break;
|
|
157
|
+
case FILTER_TYPES.INVALID:
|
|
158
|
+
return createGenericFilter(jaql, instanceid);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
catch (e) {
|
|
162
|
+
// console.error(e);
|
|
163
|
+
return createGenericFilter(jaql, instanceid);
|
|
164
|
+
}
|
|
165
|
+
// if a filter type is untranslatable, fall back to the generic filter
|
|
166
|
+
return createGenericFilter(jaql, instanceid);
|
|
167
|
+
};
|
package/dist/dimensional-model/filters/utils/modern-analytics-filters/condition-filter-util.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as conditionTypesUtil from './condition-types-util.js';
|
|
2
|
+
export const getSelectedConditionOption = (filter) => {
|
|
3
|
+
let selected;
|
|
4
|
+
selected = conditionTypesUtil.isBottomCondition(filter);
|
|
5
|
+
selected = conditionTypesUtil.isTopCondition(filter, selected);
|
|
6
|
+
selected = conditionTypesUtil.isExcludeCondition(filter, selected);
|
|
7
|
+
selected = conditionTypesUtil.isWithinCondition(filter, selected);
|
|
8
|
+
selected = conditionTypesUtil.isGreaterThanCondition(filter, selected);
|
|
9
|
+
selected = conditionTypesUtil.isGreaterThanOrEqualCondition(filter, selected);
|
|
10
|
+
selected = conditionTypesUtil.isLessThanCondition(filter, selected);
|
|
11
|
+
selected = conditionTypesUtil.isLessThanOrEqualCondition(filter, selected);
|
|
12
|
+
selected = conditionTypesUtil.isEqualsCondition(filter, selected);
|
|
13
|
+
selected = conditionTypesUtil.isNotEqualCondition(filter, selected);
|
|
14
|
+
selected = conditionTypesUtil.isEmptyCondition(filter, selected);
|
|
15
|
+
selected = conditionTypesUtil.isNotEmptyCondition(filter, selected);
|
|
16
|
+
selected = conditionTypesUtil.isContainsCondition(filter, selected);
|
|
17
|
+
selected = conditionTypesUtil.isDoesntContainCondition(filter, selected);
|
|
18
|
+
selected = conditionTypesUtil.isDoesntEndWithCondition(filter, selected);
|
|
19
|
+
selected = conditionTypesUtil.isDoesntStartsWithCondition(filter, selected);
|
|
20
|
+
selected = conditionTypesUtil.isEndsWithCondition(filter, selected);
|
|
21
|
+
selected = conditionTypesUtil.isStartsWithCondition(filter, selected);
|
|
22
|
+
selected = conditionTypesUtil.isBetweenCondition(filter, selected);
|
|
23
|
+
selected = conditionTypesUtil.isNotBetweenCondition(filter, selected);
|
|
24
|
+
selected = conditionTypesUtil.isMembersCondition(filter, selected);
|
|
25
|
+
selected = conditionTypesUtil.isMultipleCondition(filter, selected);
|
|
26
|
+
return selected;
|
|
27
|
+
};
|
package/dist/dimensional-model/filters/utils/modern-analytics-filters/condition-types-util.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ConditionTypes } from './types.js';
|
|
2
|
+
import type { ConditionJaql } from './types.js';
|
|
3
|
+
export declare const isTopCondition: (filter: ConditionJaql, selected?: ConditionTypes) => ConditionTypes;
|
|
4
|
+
export declare const isBottomCondition: (filter: ConditionJaql, selected?: ConditionTypes) => ConditionTypes;
|
|
5
|
+
export declare const isExcludeCondition: (filter: ConditionJaql, selected?: ConditionTypes) => ConditionTypes;
|
|
6
|
+
export declare const isMembersCondition: (filter: ConditionJaql, selected?: ConditionTypes) => ConditionTypes;
|
|
7
|
+
export declare const isWithinCondition: (filter: ConditionJaql, selected?: ConditionTypes) => ConditionTypes;
|
|
8
|
+
export declare const isGreaterThanCondition: (filter: ConditionJaql, selected?: ConditionTypes) => ConditionTypes;
|
|
9
|
+
export declare const isGreaterThanOrEqualCondition: (filter: ConditionJaql, selected?: ConditionTypes) => ConditionTypes;
|
|
10
|
+
export declare const isLessThanCondition: (filter: ConditionJaql, selected?: ConditionTypes) => ConditionTypes;
|
|
11
|
+
export declare const isLessThanOrEqualCondition: (filter: ConditionJaql, selected?: ConditionTypes) => ConditionTypes;
|
|
12
|
+
export declare const isEqualsCondition: (filter: ConditionJaql, selected?: ConditionTypes) => ConditionTypes;
|
|
13
|
+
export declare const isNotEqualCondition: (filter: ConditionJaql, selected?: ConditionTypes) => ConditionTypes;
|
|
14
|
+
export declare const isEmptyCondition: (filter: ConditionJaql, selected?: ConditionTypes) => ConditionTypes;
|
|
15
|
+
export declare const isNotEmptyCondition: (filter: ConditionJaql, selected?: ConditionTypes) => ConditionTypes;
|
|
16
|
+
export declare const isContainsCondition: (filter: ConditionJaql, selected?: ConditionTypes) => ConditionTypes;
|
|
17
|
+
export declare const isDoesntContainCondition: (filter: ConditionJaql, selected?: ConditionTypes) => ConditionTypes;
|
|
18
|
+
export declare const isStartsWithCondition: (filter: ConditionJaql, selected?: ConditionTypes) => ConditionTypes;
|
|
19
|
+
export declare const isDoesntStartsWithCondition: (filter: ConditionJaql, selected?: ConditionTypes) => ConditionTypes;
|
|
20
|
+
export declare const isEndsWithCondition: (filter: ConditionJaql, selected?: ConditionTypes) => ConditionTypes;
|
|
21
|
+
export declare const isDoesntEndWithCondition: (filter: ConditionJaql, selected?: ConditionTypes) => ConditionTypes;
|
|
22
|
+
export declare const isBetweenCondition: (filter: ConditionJaql, selected?: ConditionTypes) => ConditionTypes;
|
|
23
|
+
export declare const isNotBetweenCondition: (filter: ConditionJaql, selected?: ConditionTypes) => ConditionTypes;
|
|
24
|
+
export declare const isMultipleCondition: (filter: ConditionJaql, selected?: ConditionTypes) => ConditionTypes;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/* eslint-disable max-lines */
|
|
2
|
+
import { ConditionTypes } from './types.js';
|
|
3
|
+
export const isTopCondition = (filter, selected = ConditionTypes.NONE) => {
|
|
4
|
+
if (filter.top !== undefined) {
|
|
5
|
+
return ConditionTypes.TOP;
|
|
6
|
+
}
|
|
7
|
+
return selected;
|
|
8
|
+
};
|
|
9
|
+
export const isBottomCondition = (filter, selected = ConditionTypes.NONE) => {
|
|
10
|
+
if (filter.bottom !== undefined) {
|
|
11
|
+
return ConditionTypes.BOTTOM;
|
|
12
|
+
}
|
|
13
|
+
return selected;
|
|
14
|
+
};
|
|
15
|
+
export const isExcludeCondition = (filter, selected = ConditionTypes.NONE) => {
|
|
16
|
+
var _a;
|
|
17
|
+
if ((_a = filter.exclude) === null || _a === void 0 ? void 0 : _a.members) {
|
|
18
|
+
return ConditionTypes.IS_NOT;
|
|
19
|
+
}
|
|
20
|
+
return selected;
|
|
21
|
+
};
|
|
22
|
+
export const isMembersCondition = (filter, selected = ConditionTypes.NONE) => {
|
|
23
|
+
if (filter.members && filter.isCondition) {
|
|
24
|
+
return ConditionTypes.IS;
|
|
25
|
+
}
|
|
26
|
+
return selected;
|
|
27
|
+
};
|
|
28
|
+
export const isWithinCondition = (filter, selected = ConditionTypes.NONE) => {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
if (((_a = filter.last) === null || _a === void 0 ? void 0 : _a.anchor) !== undefined || ((_b = filter.next) === null || _b === void 0 ? void 0 : _b.anchor) !== undefined) {
|
|
31
|
+
return ConditionTypes.IS_WITHIN;
|
|
32
|
+
}
|
|
33
|
+
return selected;
|
|
34
|
+
};
|
|
35
|
+
export const isGreaterThanCondition = (filter, selected = ConditionTypes.NONE) => {
|
|
36
|
+
if (filter.fromNotEqual !== undefined) {
|
|
37
|
+
return ConditionTypes.GREATER_THAN;
|
|
38
|
+
}
|
|
39
|
+
return selected;
|
|
40
|
+
};
|
|
41
|
+
export const isGreaterThanOrEqualCondition = (filter, selected = ConditionTypes.NONE) => {
|
|
42
|
+
if (filter.from !== undefined && !filter.isBetween) {
|
|
43
|
+
return ConditionTypes.GREATER_THAN_OR_EQUAL;
|
|
44
|
+
}
|
|
45
|
+
return selected;
|
|
46
|
+
};
|
|
47
|
+
export const isLessThanCondition = (filter, selected = ConditionTypes.NONE) => {
|
|
48
|
+
if (filter.toNotEqual !== undefined) {
|
|
49
|
+
return ConditionTypes.LESS_THAN;
|
|
50
|
+
}
|
|
51
|
+
return selected;
|
|
52
|
+
};
|
|
53
|
+
export const isLessThanOrEqualCondition = (filter, selected = ConditionTypes.NONE) => {
|
|
54
|
+
if (filter.to !== undefined && !filter.isBetween) {
|
|
55
|
+
return ConditionTypes.LESS_THAN_OR_EQUAL;
|
|
56
|
+
}
|
|
57
|
+
return selected;
|
|
58
|
+
};
|
|
59
|
+
export const isEqualsCondition = (filter, selected = ConditionTypes.NONE) => {
|
|
60
|
+
if (filter.equals !== undefined) {
|
|
61
|
+
return ConditionTypes.EQUALS;
|
|
62
|
+
}
|
|
63
|
+
return selected;
|
|
64
|
+
};
|
|
65
|
+
export const isNotEqualCondition = (filter, selected = ConditionTypes.NONE) => {
|
|
66
|
+
if (filter.doesntEqual !== undefined) {
|
|
67
|
+
return ConditionTypes.DOESNT_EQUAL;
|
|
68
|
+
}
|
|
69
|
+
return selected;
|
|
70
|
+
};
|
|
71
|
+
export const isEmptyCondition = (filter, selected = ConditionTypes.NONE) => {
|
|
72
|
+
if (filter.equals === '' && filter.isEmpty) {
|
|
73
|
+
return ConditionTypes.IS_EMPTY;
|
|
74
|
+
}
|
|
75
|
+
return selected;
|
|
76
|
+
};
|
|
77
|
+
export const isNotEmptyCondition = (filter, selected = ConditionTypes.NONE) => {
|
|
78
|
+
if (filter.doesntEqual === '' && filter.isEmpty) {
|
|
79
|
+
return ConditionTypes.IS_NOT_EMPTY;
|
|
80
|
+
}
|
|
81
|
+
return selected;
|
|
82
|
+
};
|
|
83
|
+
export const isContainsCondition = (filter, selected = ConditionTypes.NONE) => {
|
|
84
|
+
if (filter.contains !== undefined) {
|
|
85
|
+
return ConditionTypes.CONTAINS;
|
|
86
|
+
}
|
|
87
|
+
return selected;
|
|
88
|
+
};
|
|
89
|
+
export const isDoesntContainCondition = (filter, selected = ConditionTypes.NONE) => {
|
|
90
|
+
if (filter.doesntContain !== undefined) {
|
|
91
|
+
return ConditionTypes.DOESNT_CONTAIN;
|
|
92
|
+
}
|
|
93
|
+
return selected;
|
|
94
|
+
};
|
|
95
|
+
export const isStartsWithCondition = (filter, selected = ConditionTypes.NONE) => {
|
|
96
|
+
if (filter.startsWith !== undefined) {
|
|
97
|
+
return ConditionTypes.STARTS_WITH;
|
|
98
|
+
}
|
|
99
|
+
return selected;
|
|
100
|
+
};
|
|
101
|
+
export const isDoesntStartsWithCondition = (filter, selected = ConditionTypes.NONE) => {
|
|
102
|
+
if (filter.doesntStartWith !== undefined) {
|
|
103
|
+
return ConditionTypes.DOESNT_START_WITH;
|
|
104
|
+
}
|
|
105
|
+
return selected;
|
|
106
|
+
};
|
|
107
|
+
export const isEndsWithCondition = (filter, selected = ConditionTypes.NONE) => {
|
|
108
|
+
if (filter.endsWith !== undefined) {
|
|
109
|
+
return ConditionTypes.ENDS_WITH;
|
|
110
|
+
}
|
|
111
|
+
return selected;
|
|
112
|
+
};
|
|
113
|
+
export const isDoesntEndWithCondition = (filter, selected = ConditionTypes.NONE) => {
|
|
114
|
+
if (filter.doesntEndWith !== undefined) {
|
|
115
|
+
return ConditionTypes.DOESNT_END_WITH;
|
|
116
|
+
}
|
|
117
|
+
return selected;
|
|
118
|
+
};
|
|
119
|
+
export const isBetweenCondition = (filter, selected = ConditionTypes.NONE) => {
|
|
120
|
+
if (filter.from !== undefined && filter.to !== undefined) {
|
|
121
|
+
return ConditionTypes.BETWEEN;
|
|
122
|
+
}
|
|
123
|
+
return selected;
|
|
124
|
+
};
|
|
125
|
+
export const isNotBetweenCondition = (filter, selected = ConditionTypes.NONE) => {
|
|
126
|
+
const { exclude } = filter;
|
|
127
|
+
if ((exclude === null || exclude === void 0 ? void 0 : exclude.from) !== undefined && (exclude === null || exclude === void 0 ? void 0 : exclude.to) !== undefined) {
|
|
128
|
+
return ConditionTypes.IS_NOT_BETWEEN;
|
|
129
|
+
}
|
|
130
|
+
return selected;
|
|
131
|
+
};
|
|
132
|
+
export const isMultipleCondition = (filter, selected = ConditionTypes.NONE) => {
|
|
133
|
+
const { or, and } = filter;
|
|
134
|
+
if (or || and) {
|
|
135
|
+
return ConditionTypes.MULTIPLE_CONDITION;
|
|
136
|
+
}
|
|
137
|
+
return selected;
|
|
138
|
+
};
|
package/dist/dimensional-model/filters/utils/modern-analytics-filters/date-time-filter-util.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DatetimeLevel } from './types.js';
|
|
2
|
+
export const getCorrectTimeLevel = (level, bucket) => {
|
|
3
|
+
let newLevel = level ? level.toLocaleLowerCase() : DatetimeLevel.YEARS;
|
|
4
|
+
if (newLevel === DatetimeLevel.MINUTES && bucket === '60') {
|
|
5
|
+
newLevel = DatetimeLevel.HOURS;
|
|
6
|
+
}
|
|
7
|
+
return newLevel;
|
|
8
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { FilterModalTypes, FilterJaqlTypes, DatetimeLevel, FilterTypes, PeriodJaql, FilterJaqlInternal, FilterJaqlWrapperType } from './types.js';
|
|
2
|
+
export declare const isIncludeAllFilter: (filter: FilterJaqlTypes, currentDefaultFilter: FilterTypes) => FilterTypes;
|
|
3
|
+
export declare const getInnerPeriodFilter: (filter: PeriodJaql) => {
|
|
4
|
+
count: number;
|
|
5
|
+
offset: number;
|
|
6
|
+
anchor?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const isPeriodFilter: (filter: FilterJaqlTypes, currentDefaultFilter: FilterTypes) => FilterTypes;
|
|
9
|
+
export declare const isSpecificItemsFilter: (filter: FilterJaqlTypes, currentDefaultFilter: FilterTypes) => FilterTypes;
|
|
10
|
+
export declare const isDateRangeFilter: (filter: FilterJaqlTypes, currentDefaultFilter: FilterTypes, dataType: FilterModalTypes) => FilterTypes;
|
|
11
|
+
export declare const isNumericRangeFilter: (filter: FilterJaqlTypes, currentDefaultFilter: FilterTypes) => FilterTypes;
|
|
12
|
+
export declare const isConditionFilter: (filter: FilterJaqlTypes, currentDefaultFilter: FilterTypes) => FilterTypes;
|
|
13
|
+
export declare const isAdvancedFilter: (filter: FilterJaqlTypes, currentDefaultFilter: FilterTypes) => FilterTypes;
|
|
14
|
+
export declare const isTimeLevelNotSupported: (timeData: {
|
|
15
|
+
level?: DatetimeLevel;
|
|
16
|
+
bucket?: string;
|
|
17
|
+
}) => boolean;
|
|
18
|
+
export declare const isInvalidFilter: (filter: FilterJaqlTypes, currentDefaultFilter: FilterTypes) => FilterTypes;
|
|
19
|
+
export declare const getFilterType: (filter: FilterJaqlTypes, dataType?: FilterModalTypes, timeData?: {
|
|
20
|
+
level?: DatetimeLevel;
|
|
21
|
+
bucket?: string;
|
|
22
|
+
}) => FilterTypes;
|
|
23
|
+
/**
|
|
24
|
+
* Extracts Type from Filter Jaql
|
|
25
|
+
*
|
|
26
|
+
* @param jaql - jaql
|
|
27
|
+
* @param dataType - data type
|
|
28
|
+
* @return FilterJaqlWrapperType
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
export declare const extractTypeFromFilterJaql: (jaql: FilterJaqlInternal, dataType: FilterModalTypes) => FilterJaqlWrapperType;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/* eslint-disable max-lines */
|
|
2
|
+
import { getSelectedConditionOption } from './condition-filter-util.js';
|
|
3
|
+
import { FilterModalTypes, DatetimeLevel, FILTER_TYPES, nonSupportedMinutesBuckets, ConditionTypes, FILTER_JAQL_WRAPPER, } from './types.js';
|
|
4
|
+
import { getCorrectTimeLevel } from './date-time-filter-util.js';
|
|
5
|
+
export const isIncludeAllFilter = (filter, currentDefaultFilter) => {
|
|
6
|
+
if (filter === null || filter === void 0 ? void 0 : filter.all) {
|
|
7
|
+
return FILTER_TYPES.INCLUDE_ALL;
|
|
8
|
+
}
|
|
9
|
+
return currentDefaultFilter;
|
|
10
|
+
};
|
|
11
|
+
export const getInnerPeriodFilter = (filter) => {
|
|
12
|
+
return filter.last ? filter.last : filter.next;
|
|
13
|
+
};
|
|
14
|
+
export const isPeriodFilter = (filter, currentDefaultFilter) => {
|
|
15
|
+
const period = getInnerPeriodFilter(filter);
|
|
16
|
+
if ((period === null || period === void 0 ? void 0 : period.offset) < 2) {
|
|
17
|
+
return FILTER_TYPES.PERIOD;
|
|
18
|
+
}
|
|
19
|
+
return currentDefaultFilter;
|
|
20
|
+
};
|
|
21
|
+
export const isSpecificItemsFilter = (filter, currentDefaultFilter) => {
|
|
22
|
+
const specificItemsFilter = filter;
|
|
23
|
+
if (specificItemsFilter === null || specificItemsFilter === void 0 ? void 0 : specificItemsFilter.members) {
|
|
24
|
+
if (specificItemsFilter.members.length > 0) {
|
|
25
|
+
return FILTER_TYPES.SPECIFIC_ITEMS;
|
|
26
|
+
}
|
|
27
|
+
return FILTER_TYPES.INCLUDE_ALL;
|
|
28
|
+
}
|
|
29
|
+
return currentDefaultFilter;
|
|
30
|
+
};
|
|
31
|
+
const areFromOrToDefined = (fromRange, toRange) => (fromRange && typeof fromRange === 'string') || (toRange && typeof toRange === 'string');
|
|
32
|
+
const areFromAndToEmpty = (from, to) => from === '' && to === '';
|
|
33
|
+
export const isDateRangeFilter = (filter, currentDefaultFilter, dataType) => {
|
|
34
|
+
const { from, to } = filter;
|
|
35
|
+
if (dataType !== FilterModalTypes.DATE_TIME) {
|
|
36
|
+
return currentDefaultFilter;
|
|
37
|
+
}
|
|
38
|
+
if (areFromOrToDefined(from, to)) {
|
|
39
|
+
return FILTER_TYPES.DATE_RANGE;
|
|
40
|
+
}
|
|
41
|
+
if (areFromAndToEmpty(from, to)) {
|
|
42
|
+
return FILTER_TYPES.INCLUDE_ALL;
|
|
43
|
+
}
|
|
44
|
+
return currentDefaultFilter;
|
|
45
|
+
};
|
|
46
|
+
export const isNumericRangeFilter = (filter, currentDefaultFilter) => {
|
|
47
|
+
const { from, to } = filter;
|
|
48
|
+
if (from !== undefined && to !== undefined && !filter.isBetween) {
|
|
49
|
+
return FILTER_TYPES.NUMERIC_RANGE;
|
|
50
|
+
}
|
|
51
|
+
return currentDefaultFilter;
|
|
52
|
+
};
|
|
53
|
+
export const isConditionFilter = (filter, currentDefaultFilter) => {
|
|
54
|
+
if (getSelectedConditionOption(filter) !== ConditionTypes.NONE) {
|
|
55
|
+
return FILTER_TYPES.CONDITION;
|
|
56
|
+
}
|
|
57
|
+
return currentDefaultFilter;
|
|
58
|
+
};
|
|
59
|
+
export const isAdvancedFilter = (filter, currentDefaultFilter) => {
|
|
60
|
+
if (Object.keys(filter).includes('isAdvanced')) {
|
|
61
|
+
return FILTER_TYPES.ADVANCED;
|
|
62
|
+
}
|
|
63
|
+
return currentDefaultFilter;
|
|
64
|
+
};
|
|
65
|
+
export const isTimeLevelNotSupported = (timeData) => {
|
|
66
|
+
const { level, bucket } = timeData;
|
|
67
|
+
return !!(level &&
|
|
68
|
+
bucket &&
|
|
69
|
+
level === DatetimeLevel.MINUTES &&
|
|
70
|
+
nonSupportedMinutesBuckets.includes(bucket));
|
|
71
|
+
};
|
|
72
|
+
export const isInvalidFilter = (filter, currentDefaultFilter) => {
|
|
73
|
+
if (filter.jaqlType === FILTER_TYPES.INVALID) {
|
|
74
|
+
return FILTER_TYPES.INVALID;
|
|
75
|
+
}
|
|
76
|
+
return currentDefaultFilter;
|
|
77
|
+
};
|
|
78
|
+
export const getFilterType = (filter, dataType = FilterModalTypes.DATE_TIME, timeData) => {
|
|
79
|
+
let filterType = FILTER_TYPES.ADVANCED;
|
|
80
|
+
if (timeData && isTimeLevelNotSupported(timeData)) {
|
|
81
|
+
return filterType;
|
|
82
|
+
}
|
|
83
|
+
filterType = isIncludeAllFilter(filter, filterType);
|
|
84
|
+
filterType = isPeriodFilter(filter, filterType);
|
|
85
|
+
filterType = isSpecificItemsFilter(filter, filterType);
|
|
86
|
+
filterType = isConditionFilter(filter, filterType);
|
|
87
|
+
filterType = isNumericRangeFilter(filter, filterType);
|
|
88
|
+
filterType = isDateRangeFilter(filter, filterType, dataType);
|
|
89
|
+
filterType = isAdvancedFilter(filter, filterType);
|
|
90
|
+
filterType = isInvalidFilter(filter, filterType);
|
|
91
|
+
return filterType;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Extracts Type from Filter Jaql
|
|
95
|
+
*
|
|
96
|
+
* @param jaql - jaql
|
|
97
|
+
* @param dataType - data type
|
|
98
|
+
* @return FilterJaqlWrapperType
|
|
99
|
+
* @internal
|
|
100
|
+
*/
|
|
101
|
+
export const extractTypeFromFilterJaql = (jaql, dataType) => {
|
|
102
|
+
const { level: filterLevel, filter, bucket } = jaql;
|
|
103
|
+
const filterFromJaql = filter || FILTER_JAQL_WRAPPER.filter;
|
|
104
|
+
const filterToReturn = {
|
|
105
|
+
filter: Object.assign(Object.assign({}, filterFromJaql), { jaqlType: getFilterType(filterFromJaql, dataType) }),
|
|
106
|
+
};
|
|
107
|
+
if (dataType === FilterModalTypes.DATE_TIME) {
|
|
108
|
+
const backgroundFilter = filterFromJaql;
|
|
109
|
+
const level = (backgroundFilter === null || backgroundFilter === void 0 ? void 0 : backgroundFilter.level) || filterLevel;
|
|
110
|
+
filterToReturn.level = getCorrectTimeLevel(level, bucket);
|
|
111
|
+
filterToReturn.filter.jaqlType = getFilterType(filterFromJaql, dataType, { level, bucket });
|
|
112
|
+
}
|
|
113
|
+
return filterToReturn;
|
|
114
|
+
};
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
declare type RequireOnlyOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
|
|
2
|
+
[K in Keys]-?: Required<Pick<T, K>> & Partial<Record<Exclude<Keys, K>, undefined>>;
|
|
3
|
+
}[Keys];
|
|
4
|
+
export declare type JaqlContext = Record<string, Partial<FilterJaqlInternal>>;
|
|
5
|
+
export declare type Id = string;
|
|
6
|
+
export declare type Datasource = {
|
|
7
|
+
address: Id;
|
|
8
|
+
database: string;
|
|
9
|
+
id: string;
|
|
10
|
+
title: string;
|
|
11
|
+
live?: boolean;
|
|
12
|
+
fullname: string;
|
|
13
|
+
lastBuildTime?: string;
|
|
14
|
+
revisionId?: string;
|
|
15
|
+
};
|
|
16
|
+
export declare enum GeneralFilterTypes {
|
|
17
|
+
INCLUDE_ALL = "INCLUDE_ALL",
|
|
18
|
+
ADVANCED = "ADVANCED",
|
|
19
|
+
INVALID = "INVALID",
|
|
20
|
+
CONDITION = "CONDITION",
|
|
21
|
+
SPECIFIC_ITEMS = "SPECIFIC_ITEMS"
|
|
22
|
+
}
|
|
23
|
+
export declare enum DateTimeFilterTypes {
|
|
24
|
+
PERIOD = "PERIOD",
|
|
25
|
+
DATE_RANGE = "DATE_RANGE"
|
|
26
|
+
}
|
|
27
|
+
export declare enum NumericFilterTypes {
|
|
28
|
+
NUMERIC_RANGE = "NUMERIC_RANGE"
|
|
29
|
+
}
|
|
30
|
+
export declare type FilterTypes = GeneralFilterTypes | DateTimeFilterTypes | NumericFilterTypes;
|
|
31
|
+
export interface FilterType {
|
|
32
|
+
jaqlType?: FilterTypes;
|
|
33
|
+
custom?: boolean;
|
|
34
|
+
isAdvanced?: boolean;
|
|
35
|
+
rankingMessage?: string;
|
|
36
|
+
isBetween?: boolean;
|
|
37
|
+
isEmpty?: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface IncludeAllJaql extends FilterType {
|
|
40
|
+
all: boolean;
|
|
41
|
+
}
|
|
42
|
+
export declare type PeriodDetails = {
|
|
43
|
+
count: number;
|
|
44
|
+
offset: number;
|
|
45
|
+
anchor?: string;
|
|
46
|
+
};
|
|
47
|
+
export interface PeriodJaqlOptions extends FilterType {
|
|
48
|
+
last: PeriodDetails;
|
|
49
|
+
next: PeriodDetails;
|
|
50
|
+
multiSelection?: boolean;
|
|
51
|
+
isNotCurrentPeriod?: boolean;
|
|
52
|
+
}
|
|
53
|
+
export declare type PeriodJaql = RequireOnlyOne<PeriodJaqlOptions, 'last' | 'next'>;
|
|
54
|
+
export interface RangeJaql extends FilterType {
|
|
55
|
+
from?: string | number;
|
|
56
|
+
to?: string | number;
|
|
57
|
+
multiSelection?: boolean;
|
|
58
|
+
}
|
|
59
|
+
export declare type RankingJaql = {
|
|
60
|
+
agg: string;
|
|
61
|
+
column: string;
|
|
62
|
+
datatype: string;
|
|
63
|
+
dim: string;
|
|
64
|
+
level?: string;
|
|
65
|
+
merged?: boolean;
|
|
66
|
+
table: string;
|
|
67
|
+
};
|
|
68
|
+
export declare type FilterMultiSelect = {
|
|
69
|
+
explicit?: boolean;
|
|
70
|
+
multiSelection: boolean;
|
|
71
|
+
members: string[];
|
|
72
|
+
isCondition?: boolean;
|
|
73
|
+
};
|
|
74
|
+
export declare type MultipleCondition = {
|
|
75
|
+
or: ConditionJaql[];
|
|
76
|
+
and: ConditionJaql[];
|
|
77
|
+
};
|
|
78
|
+
export declare type ConditionJaqlOptions = FilterType & {
|
|
79
|
+
top: number;
|
|
80
|
+
bottom: number;
|
|
81
|
+
exclude: {
|
|
82
|
+
members?: string[];
|
|
83
|
+
from?: number;
|
|
84
|
+
to?: number;
|
|
85
|
+
};
|
|
86
|
+
startsWith: string;
|
|
87
|
+
doesntStartWith: string;
|
|
88
|
+
endsWith: string;
|
|
89
|
+
doesntEndWith: string;
|
|
90
|
+
doesntContain: string;
|
|
91
|
+
equals: number | string;
|
|
92
|
+
doesntEqual: number | string;
|
|
93
|
+
to: number;
|
|
94
|
+
toNotEqual: number;
|
|
95
|
+
from: number;
|
|
96
|
+
fromNotEqual: number;
|
|
97
|
+
contains: string;
|
|
98
|
+
by?: RankingJaql;
|
|
99
|
+
rankingMessage?: string;
|
|
100
|
+
} & Partial<FilterMultiSelect> & Partial<PeriodJaql> & Partial<RangeJaql> & Partial<MultipleCondition>;
|
|
101
|
+
export declare type ConditionJaql = RequireOnlyOne<ConditionJaqlOptions, 'top' | 'bottom' | 'exclude' | 'last' | 'next' | 'contains' | 'equals' | 'doesntEqual' | 'to' | 'toNotEqual' | 'from' | 'fromNotEqual' | 'startsWith' | 'doesntStartWith' | 'endsWith' | 'doesntEndWith' | 'doesntContain' | 'or' | 'and'>;
|
|
102
|
+
export declare type InvalidType = FilterType;
|
|
103
|
+
export declare type SpecificItemsJaql = FilterType & FilterMultiSelect;
|
|
104
|
+
export declare type FilterJaqlTypes = IncludeAllJaql | PeriodJaql | RangeJaql | ConditionJaql | InvalidType | SpecificItemsJaql;
|
|
105
|
+
export declare enum DatetimeLevel {
|
|
106
|
+
YEARS = "years",
|
|
107
|
+
QUARTERS = "quarters",
|
|
108
|
+
MONTHS = "months",
|
|
109
|
+
WEEKS = "weeks",
|
|
110
|
+
DAYS = "days",
|
|
111
|
+
HOURS = "hours",
|
|
112
|
+
MINUTES = "minutes"
|
|
113
|
+
}
|
|
114
|
+
export declare type FilterJaqlInternal = {
|
|
115
|
+
title: string;
|
|
116
|
+
column: string;
|
|
117
|
+
datasource?: Datasource;
|
|
118
|
+
datatype: string;
|
|
119
|
+
dim: string;
|
|
120
|
+
dimension?: string;
|
|
121
|
+
fiscal?: string;
|
|
122
|
+
firstday?: string;
|
|
123
|
+
merged?: boolean;
|
|
124
|
+
table: string;
|
|
125
|
+
filter?: FilterJaqlTypes;
|
|
126
|
+
level?: DatetimeLevel;
|
|
127
|
+
locale?: string;
|
|
128
|
+
bucket?: string;
|
|
129
|
+
collapsed?: boolean;
|
|
130
|
+
isDashboardFilter?: boolean;
|
|
131
|
+
formula?: string;
|
|
132
|
+
context?: JaqlContext;
|
|
133
|
+
agg?: string;
|
|
134
|
+
};
|
|
135
|
+
export declare enum FilterModalTypes {
|
|
136
|
+
DATE_TIME = "datetime",
|
|
137
|
+
NUMERIC = "numeric",
|
|
138
|
+
TEXT = "text"
|
|
139
|
+
}
|
|
140
|
+
export declare type BackgroundFilterExtraProps = {
|
|
141
|
+
level?: DatetimeLevel;
|
|
142
|
+
turnedOff?: boolean;
|
|
143
|
+
};
|
|
144
|
+
export declare type BackgroundFilter = {
|
|
145
|
+
filter?: FilterJaqlTypes & BackgroundFilterExtraProps;
|
|
146
|
+
};
|
|
147
|
+
export declare type FilterJaqlWrapperType = {
|
|
148
|
+
filter: FilterJaqlTypes & BackgroundFilter;
|
|
149
|
+
level?: DatetimeLevel;
|
|
150
|
+
agg?: string;
|
|
151
|
+
};
|
|
152
|
+
export declare const nonSupportedMinutesBuckets: string[];
|
|
153
|
+
export declare const FILTER_TYPES: {
|
|
154
|
+
NUMERIC_RANGE: NumericFilterTypes.NUMERIC_RANGE;
|
|
155
|
+
PERIOD: DateTimeFilterTypes.PERIOD;
|
|
156
|
+
DATE_RANGE: DateTimeFilterTypes.DATE_RANGE;
|
|
157
|
+
INCLUDE_ALL: GeneralFilterTypes.INCLUDE_ALL;
|
|
158
|
+
ADVANCED: GeneralFilterTypes.ADVANCED;
|
|
159
|
+
INVALID: GeneralFilterTypes.INVALID;
|
|
160
|
+
CONDITION: GeneralFilterTypes.CONDITION;
|
|
161
|
+
SPECIFIC_ITEMS: GeneralFilterTypes.SPECIFIC_ITEMS;
|
|
162
|
+
};
|
|
163
|
+
export declare type FilterJaqlDefaultType = {
|
|
164
|
+
[FILTER_TYPES.INCLUDE_ALL]: IncludeAllJaql;
|
|
165
|
+
[FILTER_TYPES.PERIOD]: PeriodJaql;
|
|
166
|
+
[FILTER_TYPES.DATE_RANGE]: RangeJaql;
|
|
167
|
+
[FILTER_TYPES.NUMERIC_RANGE]: RangeJaql;
|
|
168
|
+
[FILTER_TYPES.CONDITION]: ConditionJaql;
|
|
169
|
+
[FILTER_TYPES.SPECIFIC_ITEMS]: SpecificItemsJaql;
|
|
170
|
+
};
|
|
171
|
+
export declare const FILTER_JAQL_DEFAULT: FilterJaqlDefaultType;
|
|
172
|
+
export declare const FILTER_JAQL_WRAPPER: FilterJaqlWrapperType;
|
|
173
|
+
export declare enum ConditionTypes {
|
|
174
|
+
IS = "members",
|
|
175
|
+
IS_NOT = "exclude",
|
|
176
|
+
IS_WITHIN = "isWithin",
|
|
177
|
+
TOP = "top",
|
|
178
|
+
BOTTOM = "bottom",
|
|
179
|
+
AFTER = "after",
|
|
180
|
+
BEFORE = "before",
|
|
181
|
+
STARTS_WITH = "startsWith",
|
|
182
|
+
DOESNT_START_WITH = "doesntStartWith",
|
|
183
|
+
ENDS_WITH = "endsWith",
|
|
184
|
+
DOESNT_END_WITH = "doesntEndWith",
|
|
185
|
+
CONTAINS = "contains",
|
|
186
|
+
DOESNT_CONTAIN = "doesntContain",
|
|
187
|
+
EQUALS = "equals",
|
|
188
|
+
DOESNT_EQUAL = "doesntEqual",
|
|
189
|
+
IS_EMPTY = "isEmpty",
|
|
190
|
+
IS_NOT_EMPTY = "isNotEmpty",
|
|
191
|
+
GREATER_THAN = "fromNotEqual",
|
|
192
|
+
GREATER_THAN_OR_EQUAL = "from",
|
|
193
|
+
LESS_THAN = "toNotEqual",
|
|
194
|
+
LESS_THAN_OR_EQUAL = "to",
|
|
195
|
+
BETWEEN = "between",
|
|
196
|
+
IS_NOT_BETWEEN = "isNotBetween",
|
|
197
|
+
MULTIPLE_CONDITION = "multipleCondition",
|
|
198
|
+
NONE = "none"
|
|
199
|
+
}
|
|
200
|
+
export {};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/* eslint-disable max-lines */
|
|
2
|
+
export var GeneralFilterTypes;
|
|
3
|
+
(function (GeneralFilterTypes) {
|
|
4
|
+
GeneralFilterTypes["INCLUDE_ALL"] = "INCLUDE_ALL";
|
|
5
|
+
GeneralFilterTypes["ADVANCED"] = "ADVANCED";
|
|
6
|
+
GeneralFilterTypes["INVALID"] = "INVALID";
|
|
7
|
+
GeneralFilterTypes["CONDITION"] = "CONDITION";
|
|
8
|
+
GeneralFilterTypes["SPECIFIC_ITEMS"] = "SPECIFIC_ITEMS";
|
|
9
|
+
})(GeneralFilterTypes = GeneralFilterTypes || (GeneralFilterTypes = {}));
|
|
10
|
+
export var DateTimeFilterTypes;
|
|
11
|
+
(function (DateTimeFilterTypes) {
|
|
12
|
+
DateTimeFilterTypes["PERIOD"] = "PERIOD";
|
|
13
|
+
DateTimeFilterTypes["DATE_RANGE"] = "DATE_RANGE";
|
|
14
|
+
})(DateTimeFilterTypes = DateTimeFilterTypes || (DateTimeFilterTypes = {}));
|
|
15
|
+
export var NumericFilterTypes;
|
|
16
|
+
(function (NumericFilterTypes) {
|
|
17
|
+
NumericFilterTypes["NUMERIC_RANGE"] = "NUMERIC_RANGE";
|
|
18
|
+
})(NumericFilterTypes = NumericFilterTypes || (NumericFilterTypes = {}));
|
|
19
|
+
export var DatetimeLevel;
|
|
20
|
+
(function (DatetimeLevel) {
|
|
21
|
+
DatetimeLevel["YEARS"] = "years";
|
|
22
|
+
DatetimeLevel["QUARTERS"] = "quarters";
|
|
23
|
+
DatetimeLevel["MONTHS"] = "months";
|
|
24
|
+
DatetimeLevel["WEEKS"] = "weeks";
|
|
25
|
+
DatetimeLevel["DAYS"] = "days";
|
|
26
|
+
DatetimeLevel["HOURS"] = "hours";
|
|
27
|
+
DatetimeLevel["MINUTES"] = "minutes";
|
|
28
|
+
})(DatetimeLevel = DatetimeLevel || (DatetimeLevel = {}));
|
|
29
|
+
export var FilterModalTypes;
|
|
30
|
+
(function (FilterModalTypes) {
|
|
31
|
+
FilterModalTypes["DATE_TIME"] = "datetime";
|
|
32
|
+
FilterModalTypes["NUMERIC"] = "numeric";
|
|
33
|
+
FilterModalTypes["TEXT"] = "text";
|
|
34
|
+
})(FilterModalTypes = FilterModalTypes || (FilterModalTypes = {}));
|
|
35
|
+
export const nonSupportedMinutesBuckets = ['1', '30'];
|
|
36
|
+
export const FILTER_TYPES = Object.assign(Object.assign(Object.assign({}, GeneralFilterTypes), DateTimeFilterTypes), NumericFilterTypes);
|
|
37
|
+
export const FILTER_JAQL_DEFAULT = {
|
|
38
|
+
[FILTER_TYPES.INCLUDE_ALL]: {
|
|
39
|
+
all: true,
|
|
40
|
+
jaqlType: FILTER_TYPES.INCLUDE_ALL,
|
|
41
|
+
},
|
|
42
|
+
[FILTER_TYPES.PERIOD]: {
|
|
43
|
+
last: { count: 1, offset: 1 },
|
|
44
|
+
isNotCurrentPeriod: true,
|
|
45
|
+
jaqlType: FILTER_TYPES.PERIOD,
|
|
46
|
+
},
|
|
47
|
+
[FILTER_TYPES.DATE_RANGE]: {
|
|
48
|
+
jaqlType: FILTER_TYPES.DATE_RANGE,
|
|
49
|
+
},
|
|
50
|
+
[FILTER_TYPES.NUMERIC_RANGE]: {
|
|
51
|
+
jaqlType: FILTER_TYPES.NUMERIC_RANGE,
|
|
52
|
+
},
|
|
53
|
+
[FILTER_TYPES.CONDITION]: {
|
|
54
|
+
explicit: false,
|
|
55
|
+
multiSelection: true,
|
|
56
|
+
exclude: { members: [] },
|
|
57
|
+
jaqlType: FILTER_TYPES.CONDITION,
|
|
58
|
+
},
|
|
59
|
+
[FILTER_TYPES.SPECIFIC_ITEMS]: {
|
|
60
|
+
explicit: true,
|
|
61
|
+
multiSelection: true,
|
|
62
|
+
members: [],
|
|
63
|
+
jaqlType: FILTER_TYPES.SPECIFIC_ITEMS,
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
export const FILTER_JAQL_WRAPPER = {
|
|
67
|
+
filter: FILTER_JAQL_DEFAULT.INCLUDE_ALL,
|
|
68
|
+
level: DatetimeLevel.YEARS,
|
|
69
|
+
};
|
|
70
|
+
export var ConditionTypes;
|
|
71
|
+
(function (ConditionTypes) {
|
|
72
|
+
ConditionTypes["IS"] = "members";
|
|
73
|
+
ConditionTypes["IS_NOT"] = "exclude";
|
|
74
|
+
ConditionTypes["IS_WITHIN"] = "isWithin";
|
|
75
|
+
ConditionTypes["TOP"] = "top";
|
|
76
|
+
ConditionTypes["BOTTOM"] = "bottom";
|
|
77
|
+
ConditionTypes["AFTER"] = "after";
|
|
78
|
+
ConditionTypes["BEFORE"] = "before";
|
|
79
|
+
ConditionTypes["STARTS_WITH"] = "startsWith";
|
|
80
|
+
ConditionTypes["DOESNT_START_WITH"] = "doesntStartWith";
|
|
81
|
+
ConditionTypes["ENDS_WITH"] = "endsWith";
|
|
82
|
+
ConditionTypes["DOESNT_END_WITH"] = "doesntEndWith";
|
|
83
|
+
ConditionTypes["CONTAINS"] = "contains";
|
|
84
|
+
ConditionTypes["DOESNT_CONTAIN"] = "doesntContain";
|
|
85
|
+
ConditionTypes["EQUALS"] = "equals";
|
|
86
|
+
ConditionTypes["DOESNT_EQUAL"] = "doesntEqual";
|
|
87
|
+
ConditionTypes["IS_EMPTY"] = "isEmpty";
|
|
88
|
+
ConditionTypes["IS_NOT_EMPTY"] = "isNotEmpty";
|
|
89
|
+
ConditionTypes["GREATER_THAN"] = "fromNotEqual";
|
|
90
|
+
ConditionTypes["GREATER_THAN_OR_EQUAL"] = "from";
|
|
91
|
+
ConditionTypes["LESS_THAN"] = "toNotEqual";
|
|
92
|
+
ConditionTypes["LESS_THAN_OR_EQUAL"] = "to";
|
|
93
|
+
ConditionTypes["BETWEEN"] = "between";
|
|
94
|
+
ConditionTypes["IS_NOT_BETWEEN"] = "isNotBetween";
|
|
95
|
+
ConditionTypes["MULTIPLE_CONDITION"] = "multipleCondition";
|
|
96
|
+
ConditionTypes["NONE"] = "none";
|
|
97
|
+
})(ConditionTypes = ConditionTypes || (ConditionTypes = {}));
|
|
@@ -10,8 +10,7 @@ export interface DataModel {
|
|
|
10
10
|
[propName: string]: any;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Common interface for elements of
|
|
14
|
-
* [dimensional modeling](https://docs.sisense.com/main/SisenseLinux/data-model-building-practices.htm?tocpath=Modeling%20Data%7C_____4).
|
|
13
|
+
* Common interface for elements of a dimensional model.
|
|
15
14
|
*
|
|
16
15
|
* @internal
|
|
17
16
|
*/
|
|
@@ -61,6 +60,12 @@ export interface Element {
|
|
|
61
60
|
* @internal
|
|
62
61
|
*/
|
|
63
62
|
skipValidation?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Optional CSDK code to initialize this element
|
|
65
|
+
*
|
|
66
|
+
* @internal
|
|
67
|
+
*/
|
|
68
|
+
composeCode?: string;
|
|
64
69
|
}
|
|
65
70
|
/**
|
|
66
71
|
* Base interface for measure, which is typically numeric aggregation over {@link Attribute}(s).
|
|
@@ -210,9 +215,6 @@ export interface Dimension extends Element, Attribute {
|
|
|
210
215
|
}
|
|
211
216
|
/**
|
|
212
217
|
* Date Dimension extending {@link Dimension}.
|
|
213
|
-
*
|
|
214
|
-
* See [here](https://docs.sisense.com/main/SisenseLinux/date-and-time-fields.htm)
|
|
215
|
-
* for more details on Date and Time Resolution for ElastiCubes and for Live Models.
|
|
216
218
|
*/
|
|
217
219
|
export interface DateDimension extends Dimension {
|
|
218
220
|
/**
|
|
@@ -265,9 +267,9 @@ export interface DateDimension extends Dimension {
|
|
|
265
267
|
readonly AggMinutesRoundTo1: LevelAttribute;
|
|
266
268
|
}
|
|
267
269
|
/**
|
|
268
|
-
* Common interface of an
|
|
269
|
-
*
|
|
270
|
-
*
|
|
270
|
+
* Common interface of an attribute as in a dimensional model.
|
|
271
|
+
*
|
|
272
|
+
* An attribute is an extension of a {@link Column} in a generic {@link Data | data set}.
|
|
271
273
|
*/
|
|
272
274
|
export interface Attribute extends Element {
|
|
273
275
|
/**
|
|
@@ -354,6 +356,7 @@ export interface CustomFormulaContext {
|
|
|
354
356
|
export interface PivotAttribute {
|
|
355
357
|
attribute: Attribute;
|
|
356
358
|
includeSubTotals?: boolean;
|
|
359
|
+
sort?: PivotRowsSort;
|
|
357
360
|
}
|
|
358
361
|
/**
|
|
359
362
|
* Runs type guard check for PivotAttribute.
|
|
@@ -454,3 +457,50 @@ export declare type FilterRelationsModelIdNode = {
|
|
|
454
457
|
export declare type FilterRelationsModelBracketNode = {
|
|
455
458
|
value: FilterRelationsModelNode;
|
|
456
459
|
};
|
|
460
|
+
/** Sorting direction, either in Ascending order, Descending order, or None */
|
|
461
|
+
export declare type SortDirection = 'sortAsc' | 'sortDesc' | 'sortNone';
|
|
462
|
+
/**
|
|
463
|
+
* Sorting configuration for pivot "rows".
|
|
464
|
+
*
|
|
465
|
+
* This configuration allows sorting pivot "rows" either by their data or by data in a specific "values" column.
|
|
466
|
+
*
|
|
467
|
+
* @example
|
|
468
|
+
* Examples of sorting configurations for various scenarios:
|
|
469
|
+
*
|
|
470
|
+
* (1) Row sorted in ascending order by its data:
|
|
471
|
+
* ```ts
|
|
472
|
+
* { direction: 'sortAsc' }
|
|
473
|
+
* ```
|
|
474
|
+
*
|
|
475
|
+
* (2) Row sorted in descending order by data in the first "values" column (index 0):
|
|
476
|
+
* ```ts
|
|
477
|
+
* {
|
|
478
|
+
* direction: 'sortDesc',
|
|
479
|
+
* by: {
|
|
480
|
+
* valuesIndex: 0,
|
|
481
|
+
* }
|
|
482
|
+
* }
|
|
483
|
+
* ```
|
|
484
|
+
*
|
|
485
|
+
* (3) Row sorted in ascending order by data in the second "values" column (index 1) under the "columns" values of "Female" (for Gender) and "0-18" (for AgeRange):
|
|
486
|
+
* ```ts
|
|
487
|
+
* {
|
|
488
|
+
* direction: 'sortAsc',
|
|
489
|
+
* by: {
|
|
490
|
+
* valuesIndex: 1,
|
|
491
|
+
* columnsMembersPath: ['Female', '0-18']
|
|
492
|
+
* }
|
|
493
|
+
* }
|
|
494
|
+
* ```
|
|
495
|
+
*/
|
|
496
|
+
export declare type PivotRowsSort = {
|
|
497
|
+
/** {@inheritDoc SortDirection} */
|
|
498
|
+
direction: SortDirection;
|
|
499
|
+
/** Sorting target configuration, allowing sorting "rows" by the data in a specific "values" column */
|
|
500
|
+
by?: {
|
|
501
|
+
/** Index of the target "values" item (measure) */
|
|
502
|
+
valuesIndex?: number;
|
|
503
|
+
/** Path to the target column if selected "columns" items (dimensions) are involved */
|
|
504
|
+
columnsMembersPath?: (string | number)[];
|
|
505
|
+
};
|
|
506
|
+
};
|
|
@@ -40,8 +40,8 @@ export declare const RankingSortTypes: {
|
|
|
40
40
|
*
|
|
41
41
|
* You can nest custom formulas by placing one inside the `formula` parameter of another.
|
|
42
42
|
*
|
|
43
|
-
* Note: [
|
|
44
|
-
*
|
|
43
|
+
* Note: To use [shared formulas](https://docs.sisense.com/main/SisenseLinux/shared-formulas.htm)
|
|
44
|
+
* from a Fusion Embed instance, you must fetch them first using {@link @sisense/sdk-ui!useGetSharedFormula | useGetSharedFormula}.
|
|
45
45
|
*
|
|
46
46
|
* @example
|
|
47
47
|
* An example of constructing a custom formulas using dimensions, measures, and nested custom formulas
|
|
@@ -105,8 +105,8 @@ function transformCustomFormulaJaql(jaql) {
|
|
|
105
105
|
*
|
|
106
106
|
* You can nest custom formulas by placing one inside the `formula` parameter of another.
|
|
107
107
|
*
|
|
108
|
-
* Note: [
|
|
109
|
-
*
|
|
108
|
+
* Note: To use [shared formulas](https://docs.sisense.com/main/SisenseLinux/shared-formulas.htm)
|
|
109
|
+
* from a Fusion Embed instance, you must fetch them first using {@link @sisense/sdk-ui!useGetSharedFormula | useGetSharedFormula}.
|
|
110
110
|
*
|
|
111
111
|
* @example
|
|
112
112
|
* An example of constructing a custom formulas using dimensions, measures, and nested custom formulas
|
|
@@ -157,7 +157,7 @@ export declare enum DataType {
|
|
|
157
157
|
DATETIME = "datetime"
|
|
158
158
|
}
|
|
159
159
|
/** @internal */
|
|
160
|
-
export declare enum
|
|
160
|
+
export declare enum JaqlSortDirection {
|
|
161
161
|
ASC = "asc",
|
|
162
162
|
DESC = "desc"
|
|
163
163
|
}
|
|
@@ -172,7 +172,7 @@ export declare type BaseJaql = {
|
|
|
172
172
|
column: string;
|
|
173
173
|
title: string;
|
|
174
174
|
level?: 'years' | 'quarters' | 'months' | 'weeks' | 'minutes' | 'days';
|
|
175
|
-
sort?:
|
|
175
|
+
sort?: JaqlSortDirection;
|
|
176
176
|
};
|
|
177
177
|
/** @internal */
|
|
178
178
|
export declare type FormulaID = string;
|
|
@@ -181,13 +181,13 @@ export declare type FormulaContext = BaseJaql | FormulaJaql | FilterJaql;
|
|
|
181
181
|
/** @internal */
|
|
182
182
|
export declare type FormulaJaql = {
|
|
183
183
|
type?: 'measure';
|
|
184
|
-
sort?:
|
|
184
|
+
sort?: JaqlSortDirection;
|
|
185
185
|
title: string;
|
|
186
186
|
formula: string;
|
|
187
187
|
context?: Record<FormulaID, FormulaContext>;
|
|
188
188
|
};
|
|
189
189
|
/** @internal */
|
|
190
|
-
export declare type BaseFilter = IncludeAllFilter | IncludeMembersFilter | ExcludeMembersFilter
|
|
190
|
+
export declare type BaseFilter = IncludeAllFilter | IncludeMembersFilter | ExcludeMembersFilter | JaqlNumericFilter | AndFilter<JaqlNumericFilter> | OrFilter<JaqlNumericFilter>;
|
|
191
191
|
/** @internal */
|
|
192
192
|
export declare type BackgroundFilter = BaseFilter & {
|
|
193
193
|
level?: 'string';
|
|
@@ -216,3 +216,26 @@ export declare type FilterJaql = BaseJaql & {
|
|
|
216
216
|
filter?: BackgroundFilter | TurnOffMembersFilter;
|
|
217
217
|
};
|
|
218
218
|
};
|
|
219
|
+
declare type NumericFilterValue = number | FormulaJaql;
|
|
220
|
+
/** @internal */
|
|
221
|
+
export declare type JaqlNumericFilter = {
|
|
222
|
+
equals?: NumericFilterValue;
|
|
223
|
+
doesntEqual?: NumericFilterValue;
|
|
224
|
+
toNotEqual?: NumericFilterValue;
|
|
225
|
+
to?: NumericFilterValue;
|
|
226
|
+
fromNotEqual?: NumericFilterValue;
|
|
227
|
+
from?: NumericFilterValue;
|
|
228
|
+
'='?: NumericFilterValue;
|
|
229
|
+
'<'?: NumericFilterValue;
|
|
230
|
+
'>'?: NumericFilterValue;
|
|
231
|
+
'>='?: NumericFilterValue;
|
|
232
|
+
'<='?: NumericFilterValue;
|
|
233
|
+
};
|
|
234
|
+
declare type AndFilter<FilterItem> = {
|
|
235
|
+
and: FilterItem[];
|
|
236
|
+
};
|
|
237
|
+
/** @internal */
|
|
238
|
+
export declare type OrFilter<FilterItem> = {
|
|
239
|
+
or: FilterItem[];
|
|
240
|
+
};
|
|
241
|
+
export {};
|
|
@@ -290,8 +290,8 @@ export var DataType;
|
|
|
290
290
|
DataType["DATETIME"] = "datetime";
|
|
291
291
|
})(DataType = DataType || (DataType = {}));
|
|
292
292
|
/** @internal */
|
|
293
|
-
export var
|
|
294
|
-
(function (
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
})(
|
|
293
|
+
export var JaqlSortDirection;
|
|
294
|
+
(function (JaqlSortDirection) {
|
|
295
|
+
JaqlSortDirection["ASC"] = "asc";
|
|
296
|
+
JaqlSortDirection["DESC"] = "desc";
|
|
297
|
+
})(JaqlSortDirection = JaqlSortDirection || (JaqlSortDirection = {}));
|
package/dist/index.d.ts
CHANGED
|
@@ -54,8 +54,6 @@ export * from './dimensional-model/measures/measures.js';
|
|
|
54
54
|
* Functions to create measures that aggregate, summarize, and accumulate data,
|
|
55
55
|
* plus show changes in data over time.
|
|
56
56
|
*
|
|
57
|
-
* They are similar to [Formulas](https://docs.sisense.com/main/SisenseLinux/build-formulas.htm) in Sisense.
|
|
58
|
-
*
|
|
59
57
|
* Measures created with these functions can be used in the data options of UI components such as
|
|
60
58
|
* {@link @sisense/sdk-ui!ChartProps | Chart}, {@link @sisense/sdk-ui!ChartWidgetProps | ChartWidget},
|
|
61
59
|
* and {@link @sisense/sdk-ui!ExecuteQueryProps | ExecuteQuery}.
|
package/dist/index.js
CHANGED
|
@@ -54,8 +54,6 @@ export * from './dimensional-model/measures/measures.js';
|
|
|
54
54
|
* Functions to create measures that aggregate, summarize, and accumulate data,
|
|
55
55
|
* plus show changes in data over time.
|
|
56
56
|
*
|
|
57
|
-
* They are similar to [Formulas](https://docs.sisense.com/main/SisenseLinux/build-formulas.htm) in Sisense.
|
|
58
|
-
*
|
|
59
57
|
* Measures created with these functions can be used in the data options of UI components such as
|
|
60
58
|
* {@link @sisense/sdk-ui!ChartProps | Chart}, {@link @sisense/sdk-ui!ChartWidgetProps | ChartWidget},
|
|
61
59
|
* and {@link @sisense/sdk-ui!ExecuteQueryProps | ExecuteQuery}.
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Filter, FilterRelations, FilterRelationsJaql, DataSource, DataSourceInfo } from './index.js';
|
|
1
|
+
import { Filter, FilterRelations, FilterRelationsJaql, DataSource, DataSourceInfo, FilterJaql } from './index.js';
|
|
2
2
|
/**
|
|
3
3
|
* A more performant, but slightly bulkier, RFC4122v4 implementation. Performance is improved by minimizing calls to random()
|
|
4
4
|
*
|
|
@@ -16,11 +16,22 @@ export declare const getFilterListAndRelations: (filterRelations: FilterRelation
|
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
18
|
* Gets the name of the data source
|
|
19
|
+
*
|
|
19
20
|
* @internal
|
|
20
21
|
*/
|
|
21
22
|
export declare function getDataSourceName(dataSource: DataSource): string;
|
|
22
23
|
/**
|
|
23
24
|
* Checks if the provided 'dataSource' is a data source info structure that contains more than just the data source name.
|
|
25
|
+
*
|
|
24
26
|
* @internal
|
|
25
27
|
*/
|
|
26
28
|
export declare function isDataSourceInfo(dataSource: DataSource): dataSource is DataSourceInfo;
|
|
29
|
+
/**
|
|
30
|
+
* Creates a filter from a JAQL object.
|
|
31
|
+
*
|
|
32
|
+
* @param jaql - The filter JAQL object.
|
|
33
|
+
* @param instanceid - The instance ID.
|
|
34
|
+
* @returns - The created Filter object.
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
export declare const createFilterFromJaql: (jaql: FilterJaql, instanceid?: string) => Filter;
|
package/dist/utils.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import cloneDeep from 'lodash/cloneDeep.js';
|
|
2
|
+
import { createFilterFromJaqlInternal } from './dimensional-model/filters/utils/filter-jaql-util.js';
|
|
2
3
|
/**
|
|
3
4
|
* A more performant, but slightly bulkier, RFC4122v4 implementation. Performance is improved by minimizing calls to random()
|
|
4
5
|
*
|
|
@@ -63,6 +64,7 @@ export const getFilterListAndRelations = (filterRelations) => {
|
|
|
63
64
|
};
|
|
64
65
|
/**
|
|
65
66
|
* Gets the name of the data source
|
|
67
|
+
*
|
|
66
68
|
* @internal
|
|
67
69
|
*/
|
|
68
70
|
export function getDataSourceName(dataSource) {
|
|
@@ -70,8 +72,23 @@ export function getDataSourceName(dataSource) {
|
|
|
70
72
|
}
|
|
71
73
|
/**
|
|
72
74
|
* Checks if the provided 'dataSource' is a data source info structure that contains more than just the data source name.
|
|
75
|
+
*
|
|
73
76
|
* @internal
|
|
74
77
|
*/
|
|
75
78
|
export function isDataSourceInfo(dataSource) {
|
|
76
79
|
return typeof dataSource === 'object' && 'type' in dataSource && 'title' in dataSource;
|
|
77
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Creates a filter from a JAQL object.
|
|
83
|
+
*
|
|
84
|
+
* @param jaql - The filter JAQL object.
|
|
85
|
+
* @param instanceid - The instance ID.
|
|
86
|
+
* @returns - The created Filter object.
|
|
87
|
+
* @internal
|
|
88
|
+
*/
|
|
89
|
+
export const createFilterFromJaql = (jaql, instanceid) => {
|
|
90
|
+
// translation logic is based on FilterJaqlInternal type (from internal modern-analytics-filters)
|
|
91
|
+
// TODO reconcile FilterJaql and FilterJaqlInternal
|
|
92
|
+
const jaqlInternal = jaql;
|
|
93
|
+
return createFilterFromJaqlInternal(jaqlInternal, instanceid);
|
|
94
|
+
};
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"Sisense",
|
|
12
12
|
"Compose SDK"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.
|
|
14
|
+
"version": "1.8.0",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": "./dist/index.js",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"author": "Sisense ",
|
|
24
24
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@sisense/sdk-common": "^1.
|
|
27
|
-
"@sisense/sdk-rest-client": "^1.
|
|
26
|
+
"@sisense/sdk-common": "^1.8.0",
|
|
27
|
+
"@sisense/sdk-rest-client": "^1.8.0",
|
|
28
28
|
"guid-typescript": "^1.0.9",
|
|
29
29
|
"lodash": "^4.17.21",
|
|
30
30
|
"numeral": "^2.0.6",
|