@redsift/dashboard 6.2.0 → 6.3.1

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.
Files changed (4) hide show
  1. package/index.d.ts +78 -28
  2. package/index.js +7056 -6848
  3. package/index.js.map +1 -1
  4. package/package.json +6 -5
package/index.d.ts CHANGED
@@ -1,9 +1,16 @@
1
+ import * as crossfilter2 from 'crossfilter2';
1
2
  import { Crossfilter, Group as Group$1, NaturallyOrderedValue, Dimension as Dimension$1, ComparableObject, OrderedValueSelector } from 'crossfilter2';
2
- import React, { Ref, ReactElement, Dispatch, ComponentProps } from 'react';
3
- import { GridFilterItem, DataGridProps as DataGridProps$1 } from '@redsift/table';
4
3
  import { PieChartLabelVariant, PieChartSize, PieChartTheme, PieChartVariant } from '@redsift/charts';
5
- export { PieChartLabelVariant, PieChartSize, PieChartTheme, PieChartVariant } from '@redsift/charts';
4
+ export { ColorTheme, PieChartLabelVariant, PieChartSize, PieChartTheme, PieChartVariant } from '@redsift/charts';
5
+ import React, { Ref, ReactElement, ComponentProps, Dispatch } from 'react';
6
+ import { GridFilterItem, DataGridProps as DataGridProps$1 } from '@redsift/table';
6
7
 
8
+ declare type SuccessDangerColorTheme = {
9
+ success: string;
10
+ warning: string;
11
+ danger: string;
12
+ neutral?: string;
13
+ };
7
14
  declare type JSONValue = string | number | boolean | {
8
15
  [x: string]: JSONValue;
9
16
  } | Array<JSONValue> | undefined | null;
@@ -25,6 +32,11 @@ declare type ChartDimensions = {
25
32
  marginLeft?: number;
26
33
  };
27
34
 
35
+ declare const COUNT: (d: Dimension) => crossfilter2.Group<any, crossfilter2.NaturallyOrderedValue, unknown>;
36
+
37
+ declare const groupReduceSum: (field: string) => (d: Dimension) => crossfilter2.Group<any, crossfilter2.NaturallyOrderedValue, unknown>;
38
+ declare const SUM: (field: string) => (d: Dimension) => crossfilter2.Group<any, crossfilter2.NaturallyOrderedValue, unknown>;
39
+
28
40
  /** Component Type. */
29
41
  declare type Comp<P, T = HTMLElement> = {
30
42
  (props: P & {
@@ -42,6 +54,22 @@ declare type Comp<P, T = HTMLElement> = {
42
54
  /** Get types of the values of a record. */
43
55
  declare type ValueOf<T extends Record<any, any>> = T[keyof T];
44
56
 
57
+ /**
58
+ * Component props.
59
+ */
60
+ interface ChartEmptyStateProps extends ComponentProps<'div'> {
61
+ /** Method to call when the reset button is pressed. Also conditioned whether the button is displayed or not. */
62
+ onReset?: () => void;
63
+ /** Reset button label. */
64
+ resetLabel?: string;
65
+ /** Subtitle. */
66
+ subtitle?: string;
67
+ /** Title. */
68
+ title?: string;
69
+ }
70
+
71
+ declare const ChartEmptyState: Comp<ChartEmptyStateProps, HTMLDivElement>;
72
+
45
73
  /**
46
74
  * Context props.
47
75
  */
@@ -58,12 +86,14 @@ declare type DashboardReducerState = {
58
86
  tableFilters: GridFilterItem[];
59
87
  };
60
88
  declare enum DashboardReducerActionType {
89
+ ResetFilter = "reset-filter",
90
+ ResetFilters = "reset-filters",
61
91
  FilterTable = "filter-table",
62
92
  FilterTableBatch = "filter-table-batch"
63
93
  }
64
94
  declare type DashboardReducerAction = {
65
95
  type: DashboardReducerActionType;
66
- filter: GridFilterItem | GridFilterItem[];
96
+ filter?: GridFilterItem | GridFilterItem[];
67
97
  };
68
98
  /**
69
99
  * Component props.
@@ -103,12 +133,18 @@ declare type HorizontalBarChartSize = ValueOf<typeof HorizontalBarChartSize>;
103
133
  */
104
134
  declare const HorizontalBarChartTheme: {
105
135
  readonly default: "default";
136
+ /**
137
+ * Component theme.
138
+ */
106
139
  readonly dark: "dark";
107
140
  readonly darker: "darker";
108
141
  readonly monochrome: "monochrome";
109
142
  };
110
143
  declare type HorizontalBarChartTheme = ValueOf<typeof HorizontalBarChartTheme>;
111
144
  interface LocaleText$2 {
145
+ emptyChartTitle?: string;
146
+ emptyChartSubtitle?: string;
147
+ emptyChartResetLabel?: string;
112
148
  resetLabel?: string;
113
149
  }
114
150
  /**
@@ -121,16 +157,21 @@ interface HorizontalBarChartProps extends ComponentProps<'div'> {
121
157
  caption?: string;
122
158
  /** Whether the x axis labels are rotated or not. */
123
159
  areXLabelsRotated?: boolean;
124
- /** Field value of the DataGrid column to filter. */
125
- columnToFilter?: string;
126
160
  /** Dataset to use to generate the chart, if no context is provided. */
127
161
  data?: JSONArray;
162
+ /** Which datagrid column the chart is filtering and using which operation. */
163
+ datagridFilter?: {
164
+ field: string;
165
+ operator: 'containsAnyOf' | 'endsWithAnyOf' | 'isAnyOf';
166
+ };
128
167
  /** Method that will be used by crossfilter to compute the dimensions of the charts. */
129
168
  dimension: DimensionSelector;
130
169
  /** Reset function that is triggered when reset button is pressed in the empty state chart. */
131
170
  emptyChartResetFn?: () => void;
132
171
  /** Method that will be used by crossfilter to compute the groups of the charts. */
133
- group: GroupSelector;
172
+ group: (d: Dimension) => Group;
173
+ /** Whether the dimension field is an array or not. */
174
+ isDimensionArray?: boolean;
134
175
  /** Whether the reset button is hidden or not. */
135
176
  isResetable?: boolean;
136
177
  /** Overriden values for internal labels and texts. */
@@ -139,14 +180,12 @@ interface HorizontalBarChartProps extends ComponentProps<'div'> {
139
180
  onFilter?: (filters?: string[]) => void;
140
181
  /** Whether a category should be displayed for categories that has been removed by the caping option. Optionaly, this prop can be used to change the label of this category. */
141
182
  others?: boolean | string;
183
+ /** Method to override the data labels. */
184
+ setLabels?: (key: string) => string | undefined;
142
185
  /** HorizontalBarChart size. */
143
186
  size?: HorizontalBarChartSize;
144
187
  /** Color palette to use. You can choose among the list of available color palette or also choose to use the success/warning/danger theme for which you have to specify which key corresponds to which status. */
145
- theme?: HorizontalBarChartTheme | {
146
- success: string;
147
- warning: string;
148
- danger: string;
149
- };
188
+ theme?: HorizontalBarChartTheme | SuccessDangerColorTheme;
150
189
  /** Title. */
151
190
  title?: string;
152
191
  }
@@ -168,14 +207,19 @@ interface PieChartProps extends ComponentProps<'div'> {
168
207
  caping?: number;
169
208
  /** Caption. */
170
209
  caption?: string;
171
- /** Field value of the DataGrid column to filter. */
172
- columnToFilter?: string;
173
210
  /** Dataset to use to generate the chart, if no context is provided. */
174
211
  data?: JSONArray;
212
+ /** Which datagrid column the chart is filtering and using which operation. */
213
+ datagridFilter?: {
214
+ field: string;
215
+ operator: 'containsAnyOf' | 'endsWithAnyOf' | 'isAnyOf';
216
+ };
175
217
  /** Method that will be used by crossfilter to compute the dimensions of the charts. */
176
218
  dimension: DimensionSelector;
177
219
  /** Method that will be used by crossfilter to compute the groups of the charts. */
178
- group: GroupSelector;
220
+ group: (d: Dimension) => Group;
221
+ /** Whether the dimension field is an array or not. */
222
+ isDimensionArray?: boolean;
179
223
  /** Whether the reset button is hidden or not. */
180
224
  isResetable?: boolean;
181
225
  /** Define whether the labels should be displayed inside or outside the charts and if they should contain raw or percentage values. */
@@ -186,18 +230,18 @@ interface PieChartProps extends ComponentProps<'div'> {
186
230
  onFilter?: (filters?: string[]) => void;
187
231
  /** Whether a category should be displayed for categories that has been removed by the caping option. Optionaly, this prop can be used to change the label of this category. */
188
232
  others?: boolean | string;
233
+ /** Method to override the data labels. */
234
+ setLabels?: (key: string) => string | undefined;
189
235
  /** PieChart size. */
190
236
  size?: PieChartSize;
191
- /** Secondary text to be displayed in the middle of the chart, above the main text. Only for donut variant. */
192
- subtext?: string;
193
237
  /** Main text to be displayed in the middle of the chart. Only for donut variant. */
194
238
  text?: string;
239
+ /** Secondary text to be displayed in the middle of the chart, between the main text and subtext. Recommended to be used with donut variants only. */
240
+ middleText?: string;
241
+ /** Secondary text to be displayed in the middle of the chart, above the main text. Only for donut variant. */
242
+ subtext?: string;
195
243
  /** Color palette to use. You can choose among the list of available color palette or also choose to use the success/warning/danger theme for which you have to specify which key corresponds to which status. */
196
- theme?: PieChartTheme | {
197
- success: string;
198
- warning: string;
199
- danger: string;
200
- };
244
+ theme?: PieChartTheme | SuccessDangerColorTheme;
201
245
  /** Title. */
202
246
  title?: string;
203
247
  /** PieChart variant. */
@@ -223,6 +267,9 @@ declare type TimeSeriesBarChartSize = ValueOf<typeof TimeSeriesBarChartSize>;
223
267
  * Component theme.
224
268
  */
225
269
  declare const TimeSeriesBarChartTheme: {
270
+ /**
271
+ * Component theme.
272
+ */
226
273
  readonly default: "default";
227
274
  readonly dark: "dark";
228
275
  readonly darker: "darker";
@@ -231,6 +278,9 @@ declare const TimeSeriesBarChartTheme: {
231
278
  declare type TimeSeriesBarChartTheme = ValueOf<typeof TimeSeriesBarChartTheme>;
232
279
  declare type datetimeEnum = 'hour' | 'day' | 'week' | 'month' | 'year';
233
280
  interface LocaleText {
281
+ emptyChartTitle?: string;
282
+ emptyChartSubtitle?: string;
283
+ emptyChartResetLabel?: string;
234
284
  resetLabel?: string;
235
285
  }
236
286
  /**
@@ -257,18 +307,18 @@ interface TimeSeriesBarChartProps extends ComponentProps<'div'> {
257
307
  isResetable?: boolean;
258
308
  /** Overriden values for internal labels and texts. */
259
309
  localeText?: LocaleText;
310
+ /** Method to call when a filter occured on the chart. */
311
+ onFilter?: (filters?: string[], allFiltered?: JSONArray) => void;
260
312
  /** TimeSeriesChart size. */
261
313
  size?: TimeSeriesBarChartSize;
262
314
  /** Color palette to use. You can choose among the list of available color palette or also choose to use the success/warning/danger theme for which you have to specify which key corresponds to which status. */
263
- theme?: TimeSeriesBarChartTheme | {
264
- success: string;
265
- warning: string;
266
- danger: string;
267
- };
315
+ theme?: TimeSeriesBarChartTheme | SuccessDangerColorTheme;
268
316
  /** Title. */
269
317
  title?: string;
270
318
  /** Dataset key to use to stack values. */
271
319
  stackedCategory?: string;
320
+ /** X Axis Label. */
321
+ xAxisLabel?: string;
272
322
  /** Y Axis Label. */
273
323
  yAxisLabel?: string;
274
324
  }
@@ -276,4 +326,4 @@ declare type StyledTimeSeriesBarChartProps = Omit<TimeSeriesBarChartProps, 'dime
276
326
 
277
327
  declare const TimeSeriesBarChart: Comp<TimeSeriesBarChartProps, HTMLDivElement>;
278
328
 
279
- export { ChartDimensions, Dashboard, DashboardContext, DashboardContextProps, DashboardProps, DashboardReducer, DashboardReducerAction, DashboardReducerActionType, DashboardReducerState, DataGrid, DataGridProps, Dimension, DimensionSelector, Group, GroupSelector, HorizontalBarChart, HorizontalBarChartProps, HorizontalBarChartSize, HorizontalBarChartTheme, JSONArray, JSONObject, JSONValue, PieChart, PieChartProps, StyledHorizontalBarChartProps, StyledPieChartProps, StyledTimeSeriesBarChartProps, TNdx, TimeSeriesBarChart, TimeSeriesBarChartProps, TimeSeriesBarChartSize, TimeSeriesBarChartTheme, datetimeEnum, initialState };
329
+ export { COUNT, ChartDimensions, ChartEmptyState, ChartEmptyStateProps, Dashboard, DashboardContext, DashboardContextProps, DashboardProps, DashboardReducer, DashboardReducerAction, DashboardReducerActionType, DashboardReducerState, DataGrid, DataGridProps, Dimension, DimensionSelector, Group, GroupSelector, HorizontalBarChart, HorizontalBarChartProps, HorizontalBarChartSize, HorizontalBarChartTheme, JSONArray, JSONObject, JSONValue, PieChart, PieChartProps, SUM, StyledHorizontalBarChartProps, StyledPieChartProps, StyledTimeSeriesBarChartProps, SuccessDangerColorTheme, TNdx, TimeSeriesBarChart, TimeSeriesBarChartProps, TimeSeriesBarChartSize, TimeSeriesBarChartTheme, datetimeEnum, groupReduceSum, initialState };