@redsift/dashboard 6.1.0 → 6.2.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/index.d.ts CHANGED
@@ -135,6 +135,8 @@ interface HorizontalBarChartProps extends ComponentProps<'div'> {
135
135
  isResetable?: boolean;
136
136
  /** Overriden values for internal labels and texts. */
137
137
  localeText?: LocaleText$2;
138
+ /** Method to call when a filter occured on the chart. */
139
+ onFilter?: (filters?: string[]) => void;
138
140
  /** 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. */
139
141
  others?: boolean | string;
140
142
  /** HorizontalBarChart size. */
@@ -180,6 +182,8 @@ interface PieChartProps extends ComponentProps<'div'> {
180
182
  labelVariant?: PieChartLabelVariant;
181
183
  /** Overriden values for internal labels and texts. */
182
184
  localeText?: LocaleText$1;
185
+ /** Method to call when a filter occured on the chart. */
186
+ onFilter?: (filters?: string[]) => void;
183
187
  /** 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. */
184
188
  others?: boolean | string;
185
189
  /** PieChart size. */
package/index.js CHANGED
@@ -7173,7 +7173,7 @@ const useChartAsListbox = _ref => {
7173
7173
  }, [chart]);
7174
7174
  };
7175
7175
 
7176
- const _excluded$2 = ["areXLabelsRotated", "caping", "caption", "className", "columnToFilter", "data", "dimension", "group", "isResetable", "localeText", "others", "size", "theme", "title"];
7176
+ const _excluded$2 = ["areXLabelsRotated", "caping", "caption", "className", "columnToFilter", "data", "dimension", "group", "isResetable", "localeText", "onFilter", "others", "size", "theme", "title"];
7177
7177
  const COMPONENT_NAME$3 = 'RedSiftHorizontalBarChart';
7178
7178
  const CLASSNAME$3 = 'redsift-horizontal-barchart';
7179
7179
  const DEFAULT_PROPS$2 = {
@@ -7223,6 +7223,7 @@ const HorizontalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
7223
7223
  group,
7224
7224
  isResetable,
7225
7225
  localeText,
7226
+ onFilter,
7226
7227
  others = DEFAULT_PROPS$2.others,
7227
7228
  size = DEFAULT_PROPS$2.size,
7228
7229
  theme,
@@ -7292,8 +7293,8 @@ const HorizontalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
7292
7293
  }
7293
7294
 
7294
7295
  // Dispatch filters to datagrid when a value is selected or unselected.
7295
- if (columnToFilter) {
7296
- rowChart$1.on('filtered', () => {
7296
+ rowChart$1.on('filtered', () => {
7297
+ if (columnToFilter) {
7297
7298
  dispatch === null || dispatch === void 0 ? void 0 : dispatch({
7298
7299
  type: DashboardReducerActionType.FilterTable,
7299
7300
  filter: {
@@ -7303,8 +7304,9 @@ const HorizontalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
7303
7304
  value: rowChart$1.filters()
7304
7305
  }
7305
7306
  });
7306
- });
7307
- }
7307
+ }
7308
+ onFilter === null || onFilter === void 0 ? void 0 : onFilter(rowChart$1.filters());
7309
+ });
7308
7310
 
7309
7311
  // Render the chart.
7310
7312
  rowChart$1.render();
@@ -7547,7 +7549,7 @@ const StyledPieChartContainer = styled.div`
7547
7549
  }
7548
7550
  `;
7549
7551
 
7550
- const _excluded$1 = ["caping", "caption", "className", "columnToFilter", "data", "isResetable", "labelVariant", "dimension", "group", "localeText", "others", "size", "subtext", "text", "theme", "title", "variant"];
7552
+ const _excluded$1 = ["caping", "caption", "className", "columnToFilter", "data", "isResetable", "labelVariant", "dimension", "group", "localeText", "onFilter", "others", "size", "subtext", "text", "theme", "title", "variant"];
7551
7553
  const COMPONENT_NAME$1 = 'RedSiftPieChart';
7552
7554
  const CLASSNAME$1 = 'redsift-piechart';
7553
7555
  const DEFAULT_PROPS$1 = {
@@ -7613,6 +7615,7 @@ const PieChart = /*#__PURE__*/forwardRef((props, ref) => {
7613
7615
  dimension,
7614
7616
  group,
7615
7617
  localeText,
7618
+ onFilter,
7616
7619
  others,
7617
7620
  size,
7618
7621
  subtext,
@@ -7676,8 +7679,8 @@ const PieChart = /*#__PURE__*/forwardRef((props, ref) => {
7676
7679
  }
7677
7680
 
7678
7681
  // Dispatch filters to datagrid when a value is selected or unselected.
7679
- if (columnToFilter) {
7680
- pieChart$1.on('filtered', () => {
7682
+ pieChart$1.on('filtered', () => {
7683
+ if (columnToFilter) {
7681
7684
  dispatch === null || dispatch === void 0 ? void 0 : dispatch({
7682
7685
  type: DashboardReducerActionType.FilterTable,
7683
7686
  filter: {
@@ -7687,8 +7690,9 @@ const PieChart = /*#__PURE__*/forwardRef((props, ref) => {
7687
7690
  value: pieChart$1.filters()
7688
7691
  }
7689
7692
  });
7690
- });
7691
- }
7693
+ }
7694
+ onFilter === null || onFilter === void 0 ? void 0 : onFilter(pieChart$1.filters());
7695
+ });
7692
7696
 
7693
7697
  // Render the chart.
7694
7698
  pieChart$1.render();