@databrainhq/plugin 0.14.40 → 0.14.41

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.
@@ -2,11 +2,19 @@ import React from 'react';
2
2
  export type FilterFieldType = {
3
3
  column: string;
4
4
  operator: string;
5
+ applyOnTables?: {
6
+ tableName: string;
7
+ columnName: string;
8
+ dataType: string;
9
+ }[];
5
10
  value?: string | string[] | number | number[] | boolean | boolean[] | null | Record<string, any>;
6
11
  as?: string;
7
12
  defaultValues?: any;
8
13
  filterType?: 'global' | 'horizontal';
9
14
  isFilterApplied?: boolean;
15
+ isVariableFilter?: boolean;
16
+ variableStrings?: string[];
17
+ label: string;
10
18
  };
11
19
  export type FilterFieldProps = {
12
20
  tableName: string;
@@ -1,27 +1,12 @@
1
1
  import React from 'react';
2
2
  import { FilterFieldType } from '@/components';
3
- import { FilterType, FloatingDropDownOption } from '@/types/app';
4
- export type FilterColumn = {
5
- as: string;
6
- dataType: string;
7
- name: string;
8
- isDefault?: boolean;
9
- isShowHorizontal?: boolean;
10
- label?: string;
11
- options?: FloatingDropDownOption[];
12
- isClientScoped?: boolean;
13
- clientColumn?: string;
14
- clientColumnType?: string;
15
- isManualOptions?: boolean;
16
- manualOptions?: string[];
17
- dependOn?: FloatingDropDownOption[];
18
- };
3
+ import { GlobalFilterType, GlobalFilterColumn } from '@/types/app';
19
4
  type FiltersProps = {
20
- filterList: FilterColumn[];
21
- setFilterList: React.Dispatch<React.SetStateAction<FilterColumn[]>>;
5
+ filterList: GlobalFilterColumn[];
6
+ setFilterList: React.Dispatch<React.SetStateAction<GlobalFilterColumn[]>>;
22
7
  appliedfilters: FilterFieldType[];
23
8
  setAppliedFilters: (value: React.SetStateAction<FilterFieldType[]>) => void;
24
- filters: FilterType[];
9
+ filters: GlobalFilterType[];
25
10
  internal?: {
26
11
  isInternal: boolean;
27
12
  workspaceId: string;
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
- import { FilterType } from '@/types/app';
2
+ import { GlobalFilterType } from '@/types/app';
3
3
  import { FilterFieldType } from '@/components';
4
4
  type HorizontalFiltersProps = {
5
5
  appliedfilters: FilterFieldType[];
6
6
  setAppliedFilters: (value: React.SetStateAction<FilterFieldType[]>) => void;
7
- filters: FilterType[];
7
+ filters: GlobalFilterType[];
8
8
  internal?: {
9
9
  isInternal: boolean;
10
10
  workspaceId: string;
@@ -1,14 +1,8 @@
1
1
  import React from 'react';
2
+ import { GlobalFilterColumn } from '@/types';
2
3
  type NumberFieldProps = {
3
4
  setAppliedFilters?: any;
4
- column?: {
5
- as: any;
6
- dataType: string;
7
- name: string;
8
- isDefault?: boolean | undefined;
9
- label?: string;
10
- isShowHorizontal?: boolean;
11
- };
5
+ column?: GlobalFilterColumn;
12
6
  defaultValues?: {
13
7
  min: number | null;
14
8
  max: number | null;
@@ -1,9 +1,8 @@
1
1
  import React from 'react';
2
- import { FilterColumn } from './Filters';
3
2
  import { FilterFieldType, MetricCardProps } from '@/components';
4
- import { FilterType } from '@/types/app';
3
+ import { GlobalFilterColumn, GlobalFilterType } from '@/types/app';
5
4
  type GlobalFiltersProps = {
6
- filters: FilterType[];
5
+ filters: GlobalFilterType[];
7
6
  onApply: (filters: MetricCardProps['globalFilters']) => void;
8
7
  renderAdditionalHeaderContent?: () => JSX.Element;
9
8
  internal?: {
@@ -26,10 +25,10 @@ export declare const getFormattedFilterValue: (obj: {
26
25
  }) => any;
27
26
  export declare const GlobalFilters: React.FC<GlobalFiltersProps>;
28
27
  type FilterPopupProps = {
29
- filters: FilterType[];
28
+ filters: GlobalFilterType[];
30
29
  renderAdditionalHeaderContent?: () => JSX.Element;
31
- filterList: FilterColumn[];
32
- setFilterList: React.Dispatch<React.SetStateAction<FilterColumn[]>>;
30
+ filterList: GlobalFilterColumn[];
31
+ setFilterList: React.Dispatch<React.SetStateAction<GlobalFilterColumn[]>>;
33
32
  appliedfilters: FilterFieldType[];
34
33
  setAppliedFilters: (value: React.SetStateAction<FilterFieldType[]>) => void;
35
34
  globalFilterRef: React.RefObject<HTMLDivElement>;
@@ -17,8 +17,9 @@ export type ReplaceVariable = {
17
17
  tenancyLevel: string;
18
18
  values?: Record<string, string>;
19
19
  isAllClient?: boolean;
20
+ globalFilters?: MetricCardProps['globalFilters'];
20
21
  };
21
- export declare const replaceVariable: ({ query, rlsConditions, tenancyLevel, clientId, values, isAllClient, }: ReplaceVariable) => string;
22
+ export declare const replaceVariable: ({ query, rlsConditions, tenancyLevel, clientId, values, isAllClient, globalFilters, }: ReplaceVariable) => string;
22
23
  export declare const nameSpace: (name: string, dbName: string) => string;
23
24
  export declare const nameSpaceSpecification: (parentAlias: string, columnName: string, dbName: string) => string;
24
25
  export declare const cteQuery: (queryStr: string, groupedConditions: Record<string, RlsCondition[]>, dbName: string) => string;
@@ -382,6 +382,39 @@ export type FilterType = {
382
382
  tableName: string;
383
383
  columns: Schema['columnsWithDataType'];
384
384
  };
385
+ export type GlobalFilterColumn = {
386
+ filterType?: string;
387
+ selectedTable?: string;
388
+ variableStrings?: string[];
389
+ as: any;
390
+ dataType: string;
391
+ name: string;
392
+ isDefault?: boolean;
393
+ label?: string;
394
+ isShowHorizontal?: boolean;
395
+ defaultValue?: GlobalFiltersDefaultValue;
396
+ isClientScoped?: boolean;
397
+ clientColumn?: string;
398
+ clientColumnType?: string;
399
+ isManualOptions?: boolean;
400
+ manualOptions?: string[];
401
+ dependOn?: FloatingDropDownOption[];
402
+ selectedCustomColumn?: {
403
+ query: string;
404
+ columnName: string;
405
+ };
406
+ options?: FloatingDropDownOption[];
407
+ isVariableFilter?: boolean;
408
+ applyOnTables?: {
409
+ tableName: string;
410
+ columnName: string;
411
+ dataType: string;
412
+ }[];
413
+ };
414
+ export type GlobalFilterType = {
415
+ tableName: string;
416
+ columns: GlobalFilterColumn[];
417
+ };
385
418
  export type JoinField = {
386
419
  a: string;
387
420
  b: string;