@gooddata/sdk-embedding 11.39.0-alpha.0 → 11.39.0-alpha.2
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/esm/iframe/EmbeddedGdc.d.ts +45 -3
- package/esm/iframe/EmbeddedGdc.js +12 -0
- package/esm/index.d.ts +1 -1
- package/esm/index.js +1 -1
- package/esm/internal/filterConverters.d.ts +7 -1
- package/esm/internal/filterConverters.js +69 -1
- package/esm/sdk-embedding.d.ts +48 -2
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type DashboardAttributeFilterConfigMode, type DashboardDateFilterConfigMode, type ILowerBoundedFilter, type IUpperBoundedFilter } from "@gooddata/sdk-model";
|
|
2
|
-
import { type ILocalIdentifierQualifier, type IObjIdentifierQualifier, type ObjQualifier, type RankingFilterOperator } from "./legacyTypes.js";
|
|
2
|
+
import { type ILocalIdentifierQualifier, type IObjIdentifierQualifier, type MeasureValueFilterCondition, type ObjQualifier, type RankingFilterOperator } from "./legacyTypes.js";
|
|
3
3
|
/**
|
|
4
4
|
* Attribute filter config with props non relevant for execution, but important for UI.
|
|
5
5
|
* @public
|
|
@@ -121,6 +121,27 @@ export interface IRankingFilter {
|
|
|
121
121
|
value: number;
|
|
122
122
|
};
|
|
123
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Measure value (numeric) filter exchanged via the postMessage embedding API.
|
|
126
|
+
*
|
|
127
|
+
* @remarks
|
|
128
|
+
* Used by KD/AD embedding to set, change or clear measure value filter conditions on a dashboard.
|
|
129
|
+
* Dashboards apply the condition only to an existing MVF — embedded clients cannot add new MVFs
|
|
130
|
+
* via postMessage. The measure is identified by a catalog identifier (Tiger backend; URI
|
|
131
|
+
* references are not supported). When the dashboard holds multiple MVFs for the same metric,
|
|
132
|
+
* `localIdentifier` disambiguates which one is targeted; without it the dashboard matches by
|
|
133
|
+
* metric only and silently ignores the change if more than one filter exists for that metric.
|
|
134
|
+
* Conditions are OR-ed; an empty array (or omitted property) clears the filter.
|
|
135
|
+
*
|
|
136
|
+
* @public
|
|
137
|
+
*/
|
|
138
|
+
export interface IMeasureValueFilter {
|
|
139
|
+
measureValueFilter: {
|
|
140
|
+
measure: IObjIdentifierQualifier;
|
|
141
|
+
localIdentifier?: string;
|
|
142
|
+
conditions?: MeasureValueFilterCondition[];
|
|
143
|
+
};
|
|
144
|
+
}
|
|
124
145
|
/**
|
|
125
146
|
* @public
|
|
126
147
|
*/
|
|
@@ -132,7 +153,7 @@ export type DateFilterItem = IAbsoluteDateFilter | IRelativeDateFilter;
|
|
|
132
153
|
/**
|
|
133
154
|
* @public
|
|
134
155
|
*/
|
|
135
|
-
export type FilterItem = DateFilterItem | AttributeFilterItem | IRankingFilter;
|
|
156
|
+
export type FilterItem = DateFilterItem | AttributeFilterItem | IRankingFilter | IMeasureValueFilter;
|
|
136
157
|
/**
|
|
137
158
|
* @public
|
|
138
159
|
*/
|
|
@@ -155,10 +176,23 @@ export interface IRemoveAttributeFilterItem {
|
|
|
155
176
|
export interface IRemoveRankingFilterItem {
|
|
156
177
|
removeRankingFilter: unknown;
|
|
157
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* Removes the conditions of a measure value filter on the dashboard, identified by its target
|
|
181
|
+
* catalog metric identifier (Tiger backend; URI references are not supported). When the dashboard
|
|
182
|
+
* holds multiple MVFs for the same metric, `localIdentifier` disambiguates which one is targeted.
|
|
183
|
+
*
|
|
184
|
+
* @public
|
|
185
|
+
*/
|
|
186
|
+
export interface IRemoveMeasureValueFilterItem {
|
|
187
|
+
removeMeasureValueFilter: {
|
|
188
|
+
measure: IObjIdentifierQualifier;
|
|
189
|
+
localIdentifier?: string;
|
|
190
|
+
};
|
|
191
|
+
}
|
|
158
192
|
/**
|
|
159
193
|
* @public
|
|
160
194
|
*/
|
|
161
|
-
export type RemoveFilterItem = IRemoveDateFilterItem | IRemoveAttributeFilterItem | IRemoveRankingFilterItem;
|
|
195
|
+
export type RemoveFilterItem = IRemoveDateFilterItem | IRemoveAttributeFilterItem | IRemoveRankingFilterItem | IRemoveMeasureValueFilterItem;
|
|
162
196
|
/**
|
|
163
197
|
* @public
|
|
164
198
|
*/
|
|
@@ -187,6 +221,10 @@ export declare function isNegativeAttributeFilter(filter: unknown): filter is IN
|
|
|
187
221
|
* @public
|
|
188
222
|
*/
|
|
189
223
|
export declare function isRankingFilter(filter: unknown): filter is IRankingFilter;
|
|
224
|
+
/**
|
|
225
|
+
* @public
|
|
226
|
+
*/
|
|
227
|
+
export declare function isMeasureValueFilter(filter: unknown): filter is IMeasureValueFilter;
|
|
190
228
|
/**
|
|
191
229
|
* @public
|
|
192
230
|
*/
|
|
@@ -223,6 +261,10 @@ export declare function isRemoveAttributeFilter(filter: unknown): filter is IRem
|
|
|
223
261
|
* @public
|
|
224
262
|
*/
|
|
225
263
|
export declare function isRemoveRankingFilter(filter: unknown): filter is IRemoveRankingFilterItem;
|
|
264
|
+
/**
|
|
265
|
+
* @public
|
|
266
|
+
*/
|
|
267
|
+
export declare function isRemoveMeasureValueFilter(filter: unknown): filter is IRemoveMeasureValueFilterItem;
|
|
226
268
|
/**
|
|
227
269
|
* @public
|
|
228
270
|
*/
|
|
@@ -46,6 +46,12 @@ export function isNegativeAttributeFilter(filter) {
|
|
|
46
46
|
export function isRankingFilter(filter) {
|
|
47
47
|
return !isEmpty(filter) && filter.rankingFilter !== undefined;
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
export function isMeasureValueFilter(filter) {
|
|
53
|
+
return !isEmpty(filter) && filter.measureValueFilter !== undefined;
|
|
54
|
+
}
|
|
49
55
|
/**
|
|
50
56
|
* @public
|
|
51
57
|
*/
|
|
@@ -76,6 +82,12 @@ export function isRemoveAttributeFilter(filter) {
|
|
|
76
82
|
export function isRemoveRankingFilter(filter) {
|
|
77
83
|
return !isEmpty(filter) && filter.removeRankingFilter !== undefined;
|
|
78
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* @public
|
|
87
|
+
*/
|
|
88
|
+
export function isRemoveMeasureValueFilter(filter) {
|
|
89
|
+
return (!isEmpty(filter) && filter.removeMeasureValueFilter !== undefined);
|
|
90
|
+
}
|
|
79
91
|
/**
|
|
80
92
|
* @public
|
|
81
93
|
*/
|
package/esm/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
*/
|
|
10
|
-
export { type IAttributeFilterConfig, type IPositiveAttributeFilter, type INegativeAttributeFilter, type IAbsoluteDateFilter, type IRelativeDateFilter, type IRankingFilter, type IArbitraryAttributeFilterItem, type IMatchAttributeFilterItem, type AttributeFilterItem, type DateFilterItem, type FilterItem, type AttributeFilterItemSelectionMode, type IRemoveDateFilterItem, type IRemoveAttributeFilterItem, type IRemoveRankingFilterItem, type RemoveFilterItem, type IFilterContextContent, type IRemoveFilterContextContent, type AllTimeType, type AbsoluteType, type RelativeType, type DateString, type DateFilterGranularity, type IDashboardAllTimeDateFilter, type IDashboardAbsoluteDateFilter, type IDashboardRelativeDateFilter, type DashboardDateFilter, type IDashboardAttributeFilter, type IResolvedAttributeFilterValues, type IResolvedDateFilterValue, type ResolvedDateFilterValues, type IResolvedFilterValues, isDateFilter, isRelativeDateFilter, isAbsoluteDateFilter, isAttributeFilter, isPositiveAttributeFilter, isNegativeAttributeFilter, isRankingFilter, isArbitraryAttributeFilterItem, isMatchAttributeFilterItem, isRemoveDateFilter, isRemoveAttributeFilter, isRemoveRankingFilter, isDashboardDateFilter, isDashboardAllTimeDateFilter, isDashboardAbsoluteDateFilter, isDashboardRelativeDateFilter, isDashboardAttributeFilter, type IDashboardArbitraryAttributeFilter, isDashboardArbitraryAttributeFilter, type IDashboardMatchAttributeFilter, isDashboardMatchAttributeFilter, type DashboardTextAttributeFilter, } from "./iframe/EmbeddedGdc.js";
|
|
10
|
+
export { type IAttributeFilterConfig, type IPositiveAttributeFilter, type INegativeAttributeFilter, type IAbsoluteDateFilter, type IRelativeDateFilter, type IRankingFilter, type IMeasureValueFilter, type IArbitraryAttributeFilterItem, type IMatchAttributeFilterItem, type AttributeFilterItem, type DateFilterItem, type FilterItem, type AttributeFilterItemSelectionMode, type IRemoveDateFilterItem, type IRemoveAttributeFilterItem, type IRemoveRankingFilterItem, type IRemoveMeasureValueFilterItem, type RemoveFilterItem, type IFilterContextContent, type IRemoveFilterContextContent, type AllTimeType, type AbsoluteType, type RelativeType, type DateString, type DateFilterGranularity, type IDashboardAllTimeDateFilter, type IDashboardAbsoluteDateFilter, type IDashboardRelativeDateFilter, type DashboardDateFilter, type IDashboardAttributeFilter, type IResolvedAttributeFilterValues, type IResolvedDateFilterValue, type ResolvedDateFilterValues, type IResolvedFilterValues, isDateFilter, isRelativeDateFilter, isAbsoluteDateFilter, isAttributeFilter, isPositiveAttributeFilter, isNegativeAttributeFilter, isRankingFilter, isMeasureValueFilter, isArbitraryAttributeFilterItem, isMatchAttributeFilterItem, isRemoveDateFilter, isRemoveAttributeFilter, isRemoveRankingFilter, isRemoveMeasureValueFilter, isDashboardDateFilter, isDashboardAllTimeDateFilter, isDashboardAbsoluteDateFilter, isDashboardRelativeDateFilter, isDashboardAttributeFilter, type IDashboardArbitraryAttributeFilter, isDashboardArbitraryAttributeFilter, type IDashboardMatchAttributeFilter, isDashboardMatchAttributeFilter, type DashboardTextAttributeFilter, } from "./iframe/EmbeddedGdc.js";
|
|
11
11
|
export { type IInsightExportConfig, type IGdcAdMessageEvent, type IGdcAdMessageEnvelope, type AdCommandFailed, type AdCommandFailedData, type AdDrillableItemsCommand, type AdDrillableItemsCommandData, type IAdOpenInsightCommandBody, type AdOpenInsightCommand, type AdOpenInsightCommandData, type AdClearCommand, type AdClearCommandData, type AdClearInsightCommand, type AdClearInsightCommandData, type AdRequestCancellationCommand, type AdRequestCancellationCommandData, type IAdSaveCommandBody, type AdSaveInsightCommand, type AdSaveInsightCommandData, type IAdSaveAsInsightCommandBody, type AdSaveAsInsightCommand, type AdSaveAsInsightCommandData, type IAdExportInsightCommandBody, type AdExportInsightCommand, type AdExportInsightCommandData, type AdUndoCommand, type AdUndoCommandData, type AdRedoCommand, type AdRedoCommandData, type AdSetFilterContextCommandData, type AdSetFilterContextCommand, type AdRemoveFilterContextCommandData, type AdRemoveFilterContextCommand, type IAdAvailableCommands, type AdNewInsightInitializedBody, type AdNewInsightInitialized, type AdNewInsightInitializedData, type AdInsightOpenedBody, type AdInsightOpened, type AdInsightOpenedData, type AdInsightRenderedBody, type AdInsightRendered, type AdInsightRenderedData, type AdClearFinished, type AdClearFinishedData, type AdClearInsightFinished, type AdClearInsightFinishedData, type AdInsightSavedBody, type AdInsightSaved, type AdInsightSavedData, type AdExportFinishedBody, type AdExportFinished, type AdExportFinishedData, type AdUndoFinishedBody, type AdUndoFinished, type AdUndoFinishedData, type AdRedoFinishedBody, type AdRedoFinished, type AdRedoFinishedData, type AdSetFilterContextFinishedData, type AdRemoveFilterContextFinishedData, type AdFilterContextChangedBody, type AdFilterContextChangedData, type AdInsightChangedBody, type AdInsightChangedData, type IAdSetApiTokenBody, type AdSetApiTokenCommand, type AdSetApiTokenCommandData, type AdAttributeHierarchyModifiedCommand, type AdAttributeHierarchyModifiedCommandData, GdcAdCommandType, GdcAdEventType, isAdCommandFailedData, isAdDrillableItemsCommandData, isAdOpenInsightCommandData, isAdClearCommandData, isAdClearInsightCommandData, isAdRequestCancellationCommandData, isAdSaveInsightCommandData, isAdSaveAsInsightCommandData, isAdExportInsightCommandData, isAdUndoCommandData, isAdRedoCommandData, isAdSetFilterContextCommandData, isAdRemoveFilterContextCommandData, isAdNewInsightInitializedData, isAdInsightOpenedData, isAdInsightRenderedData, isAdClearFinishedData, isAdClearInsightFinishedData, isAdInsightSavedData, isAdExportFinishedData, isAdUndoFinishedData, isAdRedoFinishedData, isAdSetApiTokenCommandData, isAttributeHierarchyModifiedCommandData, } from "./iframe/EmbeddedAnalyticalDesigner.js";
|
|
12
12
|
export { type IGdcKdMessageEvent, type IGdcKdMessageEnvelope, type IKdAvailableCommands, type IKdSaveCommandBody, type KdSaveDashboardCommand, type KdSaveDashboardCommandData, type KdSaveAsDashboardCommand, type KdSaveAsDashboardCommandData, type KdCancelEditCommand, type KdCancelEditCommandData, type KdDeleteDashboardCommand, type KdDeleteDashboardCommandData, type KdSwitchToEditCommand, type KdSwitchToEditCommandData, type KdDrillableItemsCommand, type KdDrillableItemsCommandData, type IKdSetSizeCommandBody, type KdSetSizeCommand, type KdSetSizeCommandData, type KdSetFilterContextCommandData, type KdSetFilterContextCommand, type KdRemoveFilterContextCommandData, type KdRemoveFilterContextCommand, type IKdKpiWidget, type IKdIdentifierInsightRef, type IKdUriInsightRef, type IKdInsightWidget, type IKdAddWidgetBody, type KdAddWidgetCommand, type KdAddWidgetCommandData, type KdAddFilterCommand, type KdAddFilterCommandData, type KdExportToPdfCommand, type KdExportToPdfCommandData, type IKdNoPermissionsBody, type KdNoPermissionsEventData, type IKdResizedBody, type KdResizedEventData, type IKdDashboardObjectMeta, type KdDashboardBody, type IKdDashboardCreatedData, type IKdDashboardLoadedData, type IKdDashboardUpdatedData, type IKdDashboardSavedData, type IKdDashboardDeletedData, type KdSwitchedToEditData, type KdSwitchedToViewData, type IKdPlatformBody, type KdPlatformData, type IKdInsightWidgetBody, type IKdAddedWidgetBody, type KdWidgetAddedData, type KdFilterAddedBody, type KdFilterAddedData, type KdExportToPdfFinishedBody, type KdExportToPdfFinishedData, type KdSetFilterContextFinishedData, type KdRemoveFilterContextFinishedData, type KdFilterContextChangedBody, type KdFilterContextChangedData, type KdDrillToUrlFilters, type IKdDrillToUrlStartedDataBody, type IKdDrillToUrlResolvedDataBody, type KdDrillToUrlStartedData, type KdDrillToUrlResolvedData, type IKdSetFilterParentsAttributeFilter, type KdSetFilterParentsItemFilter, type IKdSetFilterParentsItemParent, type IKdSetFilterParentsItem, type IKdSetFilterParentsDataBody, type KdSetFilterParentsCommand, type KdSetFilterParentsCommandData, type KdSetFilterParentsFinished, type KdSetFilterParentsFinishedData, type IKdSetFilterParentsFailedDataBody, type KdSetFilterParentsFailed, type KdSetFilterParentsFailedData, type IKdInsightSavedBody, type KdInsightSavedData, type KdOpenDeleteDashboardDialogCommand, type KdOpenDeleteDashboardDialogCommandData, type IKdSetApiTokenBody, type KdSetApiTokenCommand, type KdSetApiTokenCommandData, GdcKdCommandType, GdcKdEventType, KdSetFilterParentsErrorCode, isKdSaveDashboardCommandData, isKdSaveAsDashboardCommandData, isKdCancelEditCommandData, isKdSwitchToEditCommandData, isKdDrillableItemsCommandData, isKdSetSizeCommandData, isKdSetFilterContextCommandData, isKdRemoveFilterContextCommandData, isKdIdentifierInsight, isKdUriInsight, isKdAddWidgetCommandData, isKdAddFilterCommandData, isKdExportToPdfCommandData, isKdSetFilterParentsCommandData, isKdOpenDeleteDashboardDialogCommandData, isKdSetApiTokenCommandData, } from "./iframe/EmbeddedKpiDashboard.js";
|
|
13
13
|
export { type ILegacyBaseExportConfig, type IVisualizationObjectRelativeDateFilter, type IVisualizationObjectAbsoluteDateFilter, type IVisualizationObjectPositiveAttributeFilter, type IVisualizationObjectNegativeAttributeFilter, type VisualizationObjectAttributeFilter, type VisualizationObjectDateFilter, type VisualizationObjectFilter, type ArithmeticMeasureOperator, type MeasureAggregation, type IPreviousPeriodDateDataSet, type IObjUriQualifier, type IObjIdentifierQualifier, type ObjQualifier, type IVisualizationObjectMeasureDefinition, type IVisualizationObjectArithmeticMeasureDefinition, type IVisualizationObjectPoPMeasureDefinition, type IVisualizationObjectPreviousPeriodMeasureDefinition, type VisualizationObjectMeasureDefinitionType, type IMeasureContent, type IVisualizationObjectMeasure, type IVisualizationObjectAttribute, type IVisualizationAttributeContent, type BucketItem, type Identifier, type TotalType, type ITotal, type IBucket, type ILocalIdentifierQualifier, type ComparisonConditionOperator, type IComparisonCondition, type RangeConditionOperator, type IRangeCondition, type MeasureValueFilterCondition, type IVisualizationObjectMeasureValueFilter, type RankingFilterOperator, type IVisualizationObjectRankingFilter, type VisualizationObjectExtendedFilter, type IReferenceItems, type IVisualizationObjectContent, type ObjectCategory, type Timestamp, type ILegacyObjectMeta, type IVisualizationObject, type IVisualization, isObjIdentifierQualifier, isObjectUriQualifier, isLocalIdentifierQualifier, } from "./iframe/legacyTypes.js";
|
package/esm/index.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @packageDocumentation
|
|
11
11
|
*/
|
|
12
12
|
// EmbeddedGdc
|
|
13
|
-
export { isDateFilter, isRelativeDateFilter, isAbsoluteDateFilter, isAttributeFilter, isPositiveAttributeFilter, isNegativeAttributeFilter, isRankingFilter, isArbitraryAttributeFilterItem, isMatchAttributeFilterItem, isRemoveDateFilter, isRemoveAttributeFilter, isRemoveRankingFilter, isDashboardDateFilter, isDashboardAllTimeDateFilter, isDashboardAbsoluteDateFilter, isDashboardRelativeDateFilter, isDashboardAttributeFilter, isDashboardArbitraryAttributeFilter, isDashboardMatchAttributeFilter, } from "./iframe/EmbeddedGdc.js";
|
|
13
|
+
export { isDateFilter, isRelativeDateFilter, isAbsoluteDateFilter, isAttributeFilter, isPositiveAttributeFilter, isNegativeAttributeFilter, isRankingFilter, isMeasureValueFilter, isArbitraryAttributeFilterItem, isMatchAttributeFilterItem, isRemoveDateFilter, isRemoveAttributeFilter, isRemoveRankingFilter, isRemoveMeasureValueFilter, isDashboardDateFilter, isDashboardAllTimeDateFilter, isDashboardAbsoluteDateFilter, isDashboardRelativeDateFilter, isDashboardAttributeFilter, isDashboardArbitraryAttributeFilter, isDashboardMatchAttributeFilter, } from "./iframe/EmbeddedGdc.js";
|
|
14
14
|
// EmbeddedAnalyticalDesigner
|
|
15
15
|
export { GdcAdCommandType, GdcAdEventType, isAdCommandFailedData, isAdDrillableItemsCommandData, isAdOpenInsightCommandData, isAdClearCommandData, isAdClearInsightCommandData, isAdRequestCancellationCommandData, isAdSaveInsightCommandData, isAdSaveAsInsightCommandData, isAdExportInsightCommandData, isAdUndoCommandData, isAdRedoCommandData, isAdSetFilterContextCommandData, isAdRemoveFilterContextCommandData, isAdNewInsightInitializedData, isAdInsightOpenedData, isAdInsightRenderedData, isAdClearFinishedData, isAdClearInsightFinishedData, isAdInsightSavedData, isAdExportFinishedData, isAdUndoFinishedData, isAdRedoFinishedData, isAdSetApiTokenCommandData, isAttributeHierarchyModifiedCommandData, } from "./iframe/EmbeddedAnalyticalDesigner.js";
|
|
16
16
|
// EmbeddedKpiDashboard
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ILowerBoundedFilter, type IUpperBoundedFilter, type ObjRef } from "@gooddata/sdk-model";
|
|
2
2
|
import { type DateFilterItem, type FilterItem } from "../iframe/EmbeddedGdc.js";
|
|
3
|
-
import { type ObjQualifier, type RankingFilterOperator } from "../iframe/legacyTypes.js";
|
|
3
|
+
import { type MeasureValueFilterCondition, type ObjQualifier, type RankingFilterOperator } from "../iframe/legacyTypes.js";
|
|
4
4
|
export interface ITransformedArbitraryAttributeFilter {
|
|
5
5
|
dfIdentifier: string;
|
|
6
6
|
values: string[];
|
|
@@ -19,6 +19,7 @@ export interface IExternalFiltersObject {
|
|
|
19
19
|
rankingFilter?: ITransformedRankingFilter;
|
|
20
20
|
arbitraryAttributeFilters?: ITransformedArbitraryAttributeFilter[];
|
|
21
21
|
matchAttributeFilters?: ITransformedMatchAttributeFilter[];
|
|
22
|
+
measureValueFilters?: ITransformedMeasureValueFilter[];
|
|
22
23
|
}
|
|
23
24
|
export interface ITransformedRankingFilter {
|
|
24
25
|
measureLocalIdentifier: string;
|
|
@@ -26,6 +27,11 @@ export interface ITransformedRankingFilter {
|
|
|
26
27
|
operator: RankingFilterOperator;
|
|
27
28
|
value: number;
|
|
28
29
|
}
|
|
30
|
+
export interface ITransformedMeasureValueFilter {
|
|
31
|
+
measureIdentifier: string;
|
|
32
|
+
localIdentifier?: string;
|
|
33
|
+
conditions?: MeasureValueFilterCondition[];
|
|
34
|
+
}
|
|
29
35
|
export interface ITransformedDateFilterItem {
|
|
30
36
|
granularity?: string;
|
|
31
37
|
from: string | number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// (C) 2020-2026 GoodData Corporation
|
|
2
2
|
import { isEmpty } from "lodash-es";
|
|
3
3
|
import { idRef } from "@gooddata/sdk-model";
|
|
4
|
-
import { isAbsoluteDateFilter, isArbitraryAttributeFilterItem, isAttributeFilter, isDateFilter, isMatchAttributeFilterItem, isNegativeAttributeFilter, isPositiveAttributeFilter, isRankingFilter, isRemoveAttributeFilter, isRemoveDateFilter, isRemoveRankingFilter, } from "../iframe/EmbeddedGdc.js";
|
|
4
|
+
import { isAbsoluteDateFilter, isArbitraryAttributeFilterItem, isAttributeFilter, isDateFilter, isMatchAttributeFilterItem, isMeasureValueFilter, isNegativeAttributeFilter, isPositiveAttributeFilter, isRankingFilter, isRemoveAttributeFilter, isRemoveDateFilter, isRemoveMeasureValueFilter, isRemoveRankingFilter, } from "../iframe/EmbeddedGdc.js";
|
|
5
5
|
import { isLocalIdentifierQualifier, isObjIdentifierQualifier, isObjectUriQualifier, } from "../iframe/legacyTypes.js";
|
|
6
6
|
const EXTERNAL_DATE_FILTER_FORMAT = "YYYY-MM-DD";
|
|
7
7
|
const DATE_FORMAT_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
@@ -84,6 +84,49 @@ function isValidRankingFilterFormat(rankingFilterItem) {
|
|
|
84
84
|
isValidRankingFilterOperator(operator) &&
|
|
85
85
|
isValidRankingFilterValue(value));
|
|
86
86
|
}
|
|
87
|
+
const VALID_COMPARISON_OPERATORS = [
|
|
88
|
+
"GREATER_THAN",
|
|
89
|
+
"GREATER_THAN_OR_EQUAL_TO",
|
|
90
|
+
"LESS_THAN",
|
|
91
|
+
"LESS_THAN_OR_EQUAL_TO",
|
|
92
|
+
"EQUAL_TO",
|
|
93
|
+
"NOT_EQUAL_TO",
|
|
94
|
+
];
|
|
95
|
+
const VALID_RANGE_OPERATORS = ["BETWEEN", "NOT_BETWEEN"];
|
|
96
|
+
function isValidMeasureValueFilterCondition(condition) {
|
|
97
|
+
if (isEmpty(condition)) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
const candidate = condition;
|
|
101
|
+
if ("comparison" in candidate && candidate.comparison) {
|
|
102
|
+
const { operator, value } = candidate.comparison;
|
|
103
|
+
return VALID_COMPARISON_OPERATORS.includes(operator) && typeof value === "number";
|
|
104
|
+
}
|
|
105
|
+
if ("range" in candidate && candidate.range) {
|
|
106
|
+
const { operator, from, to } = candidate.range;
|
|
107
|
+
return VALID_RANGE_OPERATORS.includes(operator) && typeof from === "number" && typeof to === "number";
|
|
108
|
+
}
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
function isValidMeasureValueFilterFormat(filterItem) {
|
|
112
|
+
const { measure, localIdentifier, conditions } = filterItem.measureValueFilter;
|
|
113
|
+
if (isEmpty(measure) || !isObjIdentifierQualifier(measure)) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
if (localIdentifier !== undefined && typeof localIdentifier !== "string") {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
// Omitted or empty `conditions` clears the filter; otherwise every entry must be a valid condition.
|
|
120
|
+
if (conditions !== undefined) {
|
|
121
|
+
if (!Array.isArray(conditions)) {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
if (conditions.length > 0 && !conditions.every(isValidMeasureValueFilterCondition)) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
87
130
|
const VALID_MATCH_OPERATORS = ["contains", "startsWith", "endsWith"];
|
|
88
131
|
function isValidArbitraryAttributeFilterFormat(filterItem) {
|
|
89
132
|
const { arbitraryAttributeFilter: { displayForm, values, negativeSelection }, } = filterItem;
|
|
@@ -111,6 +154,9 @@ function isValidFilterItemFormat(filterItem, shouldValidateDataSet = true, isTim
|
|
|
111
154
|
else if (isRankingFilter(filterItem)) {
|
|
112
155
|
return isValidRankingFilterFormat(filterItem);
|
|
113
156
|
}
|
|
157
|
+
else if (isMeasureValueFilter(filterItem)) {
|
|
158
|
+
return isValidMeasureValueFilterFormat(filterItem);
|
|
159
|
+
}
|
|
114
160
|
return false;
|
|
115
161
|
}
|
|
116
162
|
function isValidRemoveFilterItemFormat(filterItem) {
|
|
@@ -127,6 +173,13 @@ function isValidRemoveFilterItemFormat(filterItem) {
|
|
|
127
173
|
else if (isRemoveRankingFilter(filterItem)) {
|
|
128
174
|
return true;
|
|
129
175
|
}
|
|
176
|
+
else if (isRemoveMeasureValueFilter(filterItem)) {
|
|
177
|
+
const { measure, localIdentifier } = filterItem.removeMeasureValueFilter;
|
|
178
|
+
if (!isObjIdentifierQualifier(measure) || typeof measure.identifier !== "string") {
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
return localIdentifier === undefined || typeof localIdentifier === "string";
|
|
182
|
+
}
|
|
130
183
|
return false;
|
|
131
184
|
}
|
|
132
185
|
export function isValidRemoveFiltersFormat(filters) {
|
|
@@ -235,6 +288,14 @@ function transformRankingFilterItem(rankingFilterItem) {
|
|
|
235
288
|
operator,
|
|
236
289
|
};
|
|
237
290
|
}
|
|
291
|
+
function transformMeasureValueFilterItem(measureValueFilterItem) {
|
|
292
|
+
const { measure, localIdentifier, conditions } = measureValueFilterItem.measureValueFilter;
|
|
293
|
+
return {
|
|
294
|
+
measureIdentifier: measure.identifier,
|
|
295
|
+
...(localIdentifier ? { localIdentifier } : {}),
|
|
296
|
+
...(conditions && conditions.length > 0 ? { conditions } : {}),
|
|
297
|
+
};
|
|
298
|
+
}
|
|
238
299
|
export function transformFilterContext(filters) {
|
|
239
300
|
const defaultFiltersObject = {
|
|
240
301
|
attributeFilters: [],
|
|
@@ -272,6 +333,13 @@ export function transformFilterContext(filters) {
|
|
|
272
333
|
const rankingFilter = transformRankingFilterItem(filterItem);
|
|
273
334
|
externalFilters.rankingFilter = rankingFilter;
|
|
274
335
|
}
|
|
336
|
+
else if (isMeasureValueFilter(filterItem)) {
|
|
337
|
+
const measureValueFilter = transformMeasureValueFilterItem(filterItem);
|
|
338
|
+
if (!externalFilters.measureValueFilters) {
|
|
339
|
+
externalFilters.measureValueFilters = [];
|
|
340
|
+
}
|
|
341
|
+
externalFilters.measureValueFilters.push(measureValueFilter);
|
|
342
|
+
}
|
|
275
343
|
return externalFilters;
|
|
276
344
|
}, defaultFiltersObject);
|
|
277
345
|
}
|
package/esm/sdk-embedding.d.ts
CHANGED
|
@@ -670,7 +670,7 @@ export declare type DateString = string;
|
|
|
670
670
|
/**
|
|
671
671
|
* @public
|
|
672
672
|
*/
|
|
673
|
-
export declare type FilterItem = DateFilterItem | AttributeFilterItem | IRankingFilter;
|
|
673
|
+
export declare type FilterItem = DateFilterItem | AttributeFilterItem | IRankingFilter | IMeasureValueFilter;
|
|
674
674
|
|
|
675
675
|
/**
|
|
676
676
|
* All AD command Types
|
|
@@ -1873,6 +1873,28 @@ export declare interface IMeasureContent {
|
|
|
1873
1873
|
format?: string;
|
|
1874
1874
|
}
|
|
1875
1875
|
|
|
1876
|
+
/**
|
|
1877
|
+
* Measure value (numeric) filter exchanged via the postMessage embedding API.
|
|
1878
|
+
*
|
|
1879
|
+
* @remarks
|
|
1880
|
+
* Used by KD/AD embedding to set, change or clear measure value filter conditions on a dashboard.
|
|
1881
|
+
* Dashboards apply the condition only to an existing MVF — embedded clients cannot add new MVFs
|
|
1882
|
+
* via postMessage. The measure is identified by a catalog identifier (Tiger backend; URI
|
|
1883
|
+
* references are not supported). When the dashboard holds multiple MVFs for the same metric,
|
|
1884
|
+
* `localIdentifier` disambiguates which one is targeted; without it the dashboard matches by
|
|
1885
|
+
* metric only and silently ignores the change if more than one filter exists for that metric.
|
|
1886
|
+
* Conditions are OR-ed; an empty array (or omitted property) clears the filter.
|
|
1887
|
+
*
|
|
1888
|
+
* @public
|
|
1889
|
+
*/
|
|
1890
|
+
export declare interface IMeasureValueFilter {
|
|
1891
|
+
measureValueFilter: {
|
|
1892
|
+
measure: IObjIdentifierQualifier;
|
|
1893
|
+
localIdentifier?: string;
|
|
1894
|
+
conditions?: MeasureValueFilterCondition[];
|
|
1895
|
+
};
|
|
1896
|
+
}
|
|
1897
|
+
|
|
1876
1898
|
/**
|
|
1877
1899
|
* @public
|
|
1878
1900
|
*/
|
|
@@ -2042,6 +2064,20 @@ export declare interface IRemoveFilterContextContent {
|
|
|
2042
2064
|
filters: RemoveFilterItem[];
|
|
2043
2065
|
}
|
|
2044
2066
|
|
|
2067
|
+
/**
|
|
2068
|
+
* Removes the conditions of a measure value filter on the dashboard, identified by its target
|
|
2069
|
+
* catalog metric identifier (Tiger backend; URI references are not supported). When the dashboard
|
|
2070
|
+
* holds multiple MVFs for the same metric, `localIdentifier` disambiguates which one is targeted.
|
|
2071
|
+
*
|
|
2072
|
+
* @public
|
|
2073
|
+
*/
|
|
2074
|
+
export declare interface IRemoveMeasureValueFilterItem {
|
|
2075
|
+
removeMeasureValueFilter: {
|
|
2076
|
+
measure: IObjIdentifierQualifier;
|
|
2077
|
+
localIdentifier?: string;
|
|
2078
|
+
};
|
|
2079
|
+
}
|
|
2080
|
+
|
|
2045
2081
|
/**
|
|
2046
2082
|
* @public
|
|
2047
2083
|
*/
|
|
@@ -2510,6 +2546,11 @@ export declare function isLocalIdentifierQualifier(qualifier: unknown): qualifie
|
|
|
2510
2546
|
*/
|
|
2511
2547
|
export declare function isMatchAttributeFilterItem(filter: unknown): filter is IMatchAttributeFilterItem;
|
|
2512
2548
|
|
|
2549
|
+
/**
|
|
2550
|
+
* @public
|
|
2551
|
+
*/
|
|
2552
|
+
export declare function isMeasureValueFilter(filter: unknown): filter is IMeasureValueFilter;
|
|
2553
|
+
|
|
2513
2554
|
/**
|
|
2514
2555
|
* @public
|
|
2515
2556
|
*/
|
|
@@ -2550,6 +2591,11 @@ export declare function isRemoveAttributeFilter(filter: unknown): filter is IRem
|
|
|
2550
2591
|
*/
|
|
2551
2592
|
export declare function isRemoveDateFilter(filter: unknown): filter is IRemoveDateFilterItem;
|
|
2552
2593
|
|
|
2594
|
+
/**
|
|
2595
|
+
* @public
|
|
2596
|
+
*/
|
|
2597
|
+
export declare function isRemoveMeasureValueFilter(filter: unknown): filter is IRemoveMeasureValueFilterItem;
|
|
2598
|
+
|
|
2553
2599
|
/**
|
|
2554
2600
|
* @public
|
|
2555
2601
|
*/
|
|
@@ -3321,7 +3367,7 @@ export declare type RelativeType = "relative";
|
|
|
3321
3367
|
/**
|
|
3322
3368
|
* @public
|
|
3323
3369
|
*/
|
|
3324
|
-
export declare type RemoveFilterItem = IRemoveDateFilterItem | IRemoveAttributeFilterItem | IRemoveRankingFilterItem;
|
|
3370
|
+
export declare type RemoveFilterItem = IRemoveDateFilterItem | IRemoveAttributeFilterItem | IRemoveRankingFilterItem | IRemoveMeasureValueFilterItem;
|
|
3325
3371
|
|
|
3326
3372
|
/**
|
|
3327
3373
|
* @public
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gooddata/sdk-embedding",
|
|
3
|
-
"version": "11.39.0-alpha.
|
|
3
|
+
"version": "11.39.0-alpha.2",
|
|
4
4
|
"description": "GoodData Embedding APIs",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "GoodData",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"lodash-es": "^4.17.23",
|
|
30
30
|
"ts-invariant": "0.10.3",
|
|
31
31
|
"tslib": "2.8.1",
|
|
32
|
-
"@gooddata/sdk-model": "11.39.0-alpha.
|
|
32
|
+
"@gooddata/sdk-model": "11.39.0-alpha.2"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@microsoft/api-documenter": "^7.17.0",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"oxlint-tsgolint": "0.11.4",
|
|
54
54
|
"typescript": "5.9.3",
|
|
55
55
|
"vitest": "4.1.0",
|
|
56
|
-
"@gooddata/oxlint-config": "11.39.0-alpha.
|
|
57
|
-
"@gooddata/eslint-config": "11.39.0-alpha.
|
|
56
|
+
"@gooddata/oxlint-config": "11.39.0-alpha.2",
|
|
57
|
+
"@gooddata/eslint-config": "11.39.0-alpha.2"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
60
|
"_phase:build": "npm run build",
|