@gooddata/js-utils
Advanced tools
Comparing version 3.10.6-lanhuynh-lhq-sd-970-2020-06-25T07-45-09-734Z to 3.10.6-lanhuynh-lhq-sd-970-2020-06-25T08-23-04-655Z
import { EmbeddedGdc } from "@gooddata/typings"; | ||
interface IFlattenDateFilterItem { | ||
export interface ITransformedDateFilterItem { | ||
granularity?: string; | ||
@@ -9,3 +9,3 @@ from: string | number; | ||
} | ||
interface IFlattenAttributeFilterItem { | ||
export interface ITransformedAttributeFilterItem { | ||
negativeSelection: boolean; | ||
@@ -16,7 +16,6 @@ attributeElements: string[]; | ||
} | ||
declare type IFlattenFilterItem = IFlattenDateFilterItem | IFlattenAttributeFilterItem; | ||
export declare type ITransformedFilterItem = ITransformedDateFilterItem | ITransformedAttributeFilterItem; | ||
export declare function isValidDateFilterFormat(filterItem: EmbeddedGdc.DateFilterItem): boolean; | ||
export declare function isValidFilterItemFormat(filterItem: any): boolean; | ||
export declare function isValidFiltersFormat(filters: any[]): boolean; | ||
export declare function flattenFilterContext(filters: EmbeddedGdc.FilterItem[]): IFlattenFilterItem[]; | ||
export {}; | ||
export declare function transformFilterContext(filters: EmbeddedGdc.FilterItem[]): ITransformedFilterItem[]; |
@@ -33,3 +33,3 @@ "use strict"; | ||
exports.isValidFiltersFormat = isValidFiltersFormat; | ||
function flattenDateFilterItem(dateFilterItem) { | ||
function transformDateFilterItem(dateFilterItem) { | ||
if (typings_1.EmbeddedGdc.isAbsoluteDateFilter(dateFilterItem)) { | ||
@@ -64,3 +64,3 @@ var _a = dateFilterItem.absoluteDateFilter, dataSet = _a.dataSet, from = _a.from, to = _a.to; | ||
} | ||
function flattenAttributeFilterItem(attributeFilterItem) { | ||
function transformAttributeFilterItem(attributeFilterItem) { | ||
if (typings_1.EmbeddedGdc.isPositiveAttributeFilter(attributeFilterItem)) { | ||
@@ -87,3 +87,3 @@ var _a = attributeFilterItem.positiveAttributeFilter, attributeElements = _a.in, displayForm = _a.displayForm; | ||
} | ||
function flattenFilterContext(filters) { | ||
function transformFilterContext(filters) { | ||
if (lodash_1.isEmpty(filters)) | ||
@@ -93,7 +93,7 @@ return []; | ||
return typings_1.EmbeddedGdc.isDateFilter(filterItem) | ||
? flattenDateFilterItem(filterItem) | ||
: flattenAttributeFilterItem(filterItem); | ||
? transformDateFilterItem(filterItem) | ||
: transformAttributeFilterItem(filterItem); | ||
}); | ||
} | ||
exports.flattenFilterContext = flattenFilterContext; | ||
exports.transformFilterContext = transformFilterContext; | ||
//# sourceMappingURL=filterUtils.js.map |
{ | ||
"name": "@gooddata/js-utils", | ||
"version": "3.10.6-lanhuynh-lhq-sd-970-2020-06-25T07-45-09-734Z", | ||
"version": "3.10.6-lanhuynh-lhq-sd-970-2020-06-25T08-23-04-655Z", | ||
"description": "Various utils shared on GoodData frontend", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -5,3 +5,3 @@ // (C) 2020 GoodData Corporation | ||
interface IFlattenDateFilterItem { | ||
export interface ITransformedDateFilterItem { | ||
granularity?: string; | ||
@@ -14,3 +14,3 @@ from: string| number; | ||
interface IFlattenAttributeFilterItem { | ||
export interface ITransformedAttributeFilterItem { | ||
negativeSelection: boolean; | ||
@@ -21,4 +21,5 @@ attributeElements: string[]; | ||
} | ||
type IFlattenFilterItem = IFlattenDateFilterItem | IFlattenAttributeFilterItem; | ||
export type ITransformedFilterItem = ITransformedDateFilterItem | ITransformedAttributeFilterItem; | ||
export function isValidDateFilterFormat(filterItem: EmbeddedGdc.DateFilterItem): boolean { | ||
@@ -48,3 +49,3 @@ if(EmbeddedGdc.isAbsoluteDateFilter(filterItem)) { | ||
function flattenDateFilterItem(dateFilterItem: EmbeddedGdc.DateFilterItem): IFlattenFilterItem { | ||
function transformDateFilterItem(dateFilterItem: EmbeddedGdc.DateFilterItem): ITransformedFilterItem { | ||
if(EmbeddedGdc.isAbsoluteDateFilter(dateFilterItem)) { | ||
@@ -80,3 +81,3 @@ const {absoluteDateFilter: { dataSet, from, to}} = dateFilterItem; | ||
function flattenAttributeFilterItem(attributeFilterItem: EmbeddedGdc.AttributeFilterItem): IFlattenFilterItem { | ||
function transformAttributeFilterItem(attributeFilterItem: EmbeddedGdc.AttributeFilterItem): ITransformedFilterItem { | ||
if(EmbeddedGdc.isPositiveAttributeFilter(attributeFilterItem)) { | ||
@@ -103,11 +104,11 @@ const { positiveAttributeFilter: { in: attributeElements, displayForm }} = attributeFilterItem; | ||
export function flattenFilterContext(filters: EmbeddedGdc.FilterItem[]): IFlattenFilterItem[] { | ||
export function transformFilterContext(filters: EmbeddedGdc.FilterItem[]): ITransformedFilterItem[] { | ||
if(isEmpty(filters)) return []; | ||
return filters.map((filterItem: EmbeddedGdc.FilterItem): IFlattenFilterItem => { | ||
return filters.map((filterItem: EmbeddedGdc.FilterItem): ITransformedFilterItem => { | ||
return EmbeddedGdc.isDateFilter(filterItem) | ||
? flattenDateFilterItem(filterItem) | ||
: flattenAttributeFilterItem(filterItem); | ||
? transformDateFilterItem(filterItem) | ||
: transformAttributeFilterItem(filterItem); | ||
}); | ||
} | ||
Sorry, the diff of this file is not supported yet
84681
147
1690