Skip to content
This repository has been archived by the owner on Dec 10, 2021. It is now read-only.

Commit

Permalink
Fix basic storybook
Browse files Browse the repository at this point in the history
  • Loading branch information
ktmud committed Mar 29, 2021
1 parent 2c2fbd5 commit 10b5035
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function InfoTooltipWithTrigger({
onClick={onClick}
onKeyPress={
onClick &&
((event: React.KeyboardEvent) => {
(event => {
if (event.key === 'Enter' || event.key === ' ') {
onClick();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const basic = ({ width, height }) => (
}}
width={width}
height={height}
queriesData={[{ data: basicData }]}
queriesData={[basicData]}
formData={basicFormData}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,38 @@
* specific language governing permissions and limitations
* under the License.
*/
import { TableChartProps } from '@superset-ui/plugin-chart-table/src';
import { ChartDataResponseResult, GenericDataType } from '@superset-ui/core/src';
import { TableChartFormData, TableChartProps } from '@superset-ui/plugin-chart-table/src';
// @ts-ignore
// eslint-disable-next-line import/extensions
import birthNamesJson from './birthNames.json';

export const birthNames = (birthNamesJson as unknown) as TableChartProps;
export const basicFormData = {
alignPn: false,
colorPn: false,
includeSearch: false,

export const basicFormData: TableChartFormData = {
datasource: '1__table',
viz_type: 'table',
align_pn: false,
color_pn: false,
include_search: true,
metrics: ['sum__num', 'MAX(ds)'],
orderDesc: true,
pageLength: 0,
percentMetrics: null,
showCellBars: true,
tableFilter: false,
tableTimestampFormat: 'smart_date',
timeseriesLimitMetric: null,
order_desc: true,
page_length: 0,
percent_metrics: null,
show_cell_bars: true,
table_filter: false,
table_timestamp_format: 'smart_date',
};
export const basicData = {
columns: ['name', 'sum__num', 'MAX(ds)', 'Abc.com'],
records: [

export const basicData: Partial<ChartDataResponseResult> = {
colnames: ['name', 'sum__num', 'MAX(ds)', 'Abc.com'],
coltypes: [
GenericDataType.STRING,
GenericDataType.NUMERIC,
GenericDataType.TEMPORAL,
GenericDataType.STRING,
],
data: [
{
name: 'Michael',
sum__num: 2467063,
Expand Down
13 changes: 6 additions & 7 deletions plugins/plugin-chart-table/src/utils/DateWithFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,11 @@ export default class DateWithFormatter extends Date {

this.input = input;
this.formatter = formatter;
}

toString(): string {
if (this.formatter === String) {
return String(this.input);
}
return this.formatter ? this.formatter(this) : Date.toString.call(this);
this.toString = (): string => {
if (this.formatter === String) {
return String(this.input);
}
return this.formatter ? this.formatter(this) : Date.toString.call(this);
};
}
}

0 comments on commit 10b5035

Please sign in to comment.