Skip to content

Commit

Permalink
fix(demo): add antd css and implement action hook (apache#851)
Browse files Browse the repository at this point in the history
  • Loading branch information
villebro authored and zhaoyongjie committed Nov 24, 2021
1 parent 5743a40 commit d731f70
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"@types/react-loadable": "^5.5.3",
"@types/react-resizable": "^1.7.2",
"@types/storybook__react": "5.2.1",
"antd": "^4.9.1",
"bootstrap": "^3.4.1",
"core-js": "3.6.5",
"gh-pages": "^3.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
import { boolean, withKnobs } from '@storybook/addon-knobs';
import { SuperChart, getChartTransformPropsRegistry } from '@superset-ui/core';
import { AntdSelectFilterPlugin } from '@superset-ui/plugin-filter-antd';
import transformProps from '@superset-ui/plugin-filter-antd/lib/Select/transformProps';
import data from './data';
import { withResizableChartDemo } from '../../../../shared/components/ResizableChartDemo';
import 'antd/dist/antd.css';

new AntdSelectFilterPlugin().configure({ key: 'filter_select' }).register();

getChartTransformPropsRegistry().registerValue('filter_select', transformProps);

export default {
title: 'Filter Plugins|plugin-filter-antd/Select',
decorators: [withResizableChartDemo],
decorators: [withKnobs, withResizableChartDemo],
};

export const Select = ({ width, height }) => {
Expand All @@ -24,12 +27,16 @@ export const Select = ({ width, height }) => {
formData={{
adhoc_filters: [],
extra_filters: [],
multiSelect: true,
multiSelect: boolean('Multi select', true),
inverseSelection: boolean('Inverse selection', false),
row_limit: 1000,
viz_type: 'filter_select',
groupby: ['country_name'],
metrics: ['SUM(SP_POP_TOTL)'],
}}
hooks={{
setExtraFormData: action('setExtraFormData'),
}}
/>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export default function AntdPluginFilterSelect(props: AntdPluginFilterSelectProp
enableEmptyFilter &&
!inverseSelection &&
(value === undefined || value === null || value.length === 0);
console.log(enableEmptyFilter, emptyFilter);
setExtraFormData({
append_form_data: emptyFilter
? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export default function transformProps(chartProps: ChartProps) {
const { setExtraFormData = () => {} } = hooks;
const data = queryData.data as DataRecord[];

// console.log('formData via TransformProps.ts', formData);
return {
width,
height,
Expand Down

0 comments on commit d731f70

Please sign in to comment.