Skip to content

Commit

Permalink
transpile
Browse files Browse the repository at this point in the history
  • Loading branch information
peterMuriuki committed Jun 17, 2020
1 parent e1b94ff commit d26dbd3
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,13 @@ var _react = _interopRequireDefault(require("react"));

var _constants = require("../../helpers/constants");

var defaultNullDataProps = {
noDataFound: _constants.NO_DATA_FOUND
};

var NullDataComponent = function NullDataComponent(props) {
var NullDataComponent = function NullDataComponent() {
return _react["default"].createElement("div", {
className: "jumbotron"
}, _react["default"].createElement("p", null, props.noDataFound));
}, _react["default"].createElement("p", null, _constants.NO_DATA_FOUND));
};

exports.NullDataComponent = NullDataComponent;
NullDataComponent.defaultProps = defaultNullDataProps;

var DropDownCell = function DropDownCell(props) {
var cellValue = props.cellValue,
Expand Down
4 changes: 2 additions & 2 deletions packages/DrillDownTable/dist/components/TableJSX.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ var defaultTableProps = {
hasChildren: hasChildrenFunc,
identifierField: _constants.ID,
linkerField: _constants.ID,
nullDataComponent: _HelperComponents.NullDataComponent,
paginate: true,
parentIdentifierField: _constants.PARENT_ID,
renderNullDataComponent: _HelperComponents.NullDataComponent,
resize: true,
rootParentId: _constants.ROOT_PARENT_ID,
useDrillDown: true
Expand Down Expand Up @@ -169,7 +169,7 @@ function Table(props) {
className: "td"
}), cell.render('Cell'));
}));
}))), data.length === 0 && _react["default"].createElement(props.nullDataComponent, null), props.renderInBottomFilterBar && props.renderInBottomFilterBar(_objectSpread({}, tableProps, {
}))), data.length === 0 && props.renderNullDataComponent(), props.renderInBottomFilterBar && props.renderInBottomFilterBar(_objectSpread({}, tableProps, {
setRowHeight: setRowHeight
})));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export declare const defaultDrillDownTableProps: {
renderInTopFilterBar?: import("./TableJSX").FilterBarRenderer<{}> | undefined;
renderInBottomFilterBar?: import("./TableJSX").FilterBarRenderer<{}> | undefined;
rootParentId: string | null;
nullDataComponent: React.ElementType<any>;
renderNullDataComponent: () => React.ReactNode;
linkerField?: string | undefined;
useDrillDown: boolean;
getTdProps?: ((cell: Cell<{}, any>) => Dictionary<any>) | undefined;
Expand All @@ -50,7 +50,7 @@ declare namespace DrillDownTable {
renderInTopFilterBar?: import("./TableJSX").FilterBarRenderer<{}> | undefined;
renderInBottomFilterBar?: import("./TableJSX").FilterBarRenderer<{}> | undefined;
rootParentId: string | null;
nullDataComponent: React.ElementType<any>;
renderNullDataComponent: () => React.ReactNode;
linkerField?: string | undefined;
useDrillDown: boolean;
getTdProps?: ((cell: Cell<{}, any>) => Dictionary<any>) | undefined;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import React from 'react';
import { Cell } from 'react-table';
export interface NullDataComponentProps {
noDataFound: string;
}
/** Rendered component when there is no data for table component to render */
declare const NullDataComponent: {
(props: NullDataComponentProps): JSX.Element;
defaultProps: NullDataComponentProps;
};
export { NullDataComponent };
export declare const NullDataComponent: () => JSX.Element;
/** Interface for DropDown cell props */
export interface DropDownCellProps {
cell: Cell;
Expand Down
6 changes: 3 additions & 3 deletions packages/DrillDownTable/dist/types/components/TableJSX.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Dictionary } from '@onaio/utils';
import React, { Dispatch, ReactNode, SetStateAction } from 'react';
import { Dispatch, ReactNode, SetStateAction } from 'react';
import { Cell, Column, TableState, UsePaginationInstanceProps, UsePaginationState, UseResizeColumnsColumnOptions, UseSortByColumnOptions, UseSortByInstanceProps, UseSortByState, UseTableInstanceProps } from 'react-table';
/** Type definition for hasChildrenFunc */
export declare type HasChildrenFuncType = <D extends object>(cellObject: Cell<D>, parentIdList: number[] | string[], idField: string | number) => boolean;
Expand Down Expand Up @@ -28,7 +28,7 @@ export interface TableJSXProps<TData extends object> {
renderInTopFilterBar?: FilterBarRenderer<TData> /** add a section immediately above table for filter components */;
renderInBottomFilterBar?: FilterBarRenderer<TData> /** add a section immediately above table for filter components */;
rootParentId: string | null /** the value of parentIdentifierField for rows that have not parent */;
nullDataComponent: React.ElementType /** component to render if data is empty array */;
renderNullDataComponent: () => ReactNode /** component to render if data is empty array */;
linkerField?: string /** the field to be used to drill down the data */;
useDrillDown: boolean /** whether component can act as a normal table */;
getTdProps?: (cell: Cell<TData>) => Dictionary;
Expand All @@ -42,6 +42,6 @@ export declare const defaultTableProps: Omit<TableJSXProps<{}>, 'columns' | 'fet
*/
declare function Table<D extends object>(props: TableJSXProps<D>): JSX.Element;
declare namespace Table {
var defaultProps: Pick<TableJSXProps<{}>, "data" | "hasChildren" | "identifierField" | "parentIdentifierField" | "renderInTopFilterBar" | "renderInBottomFilterBar" | "rootParentId" | "nullDataComponent" | "linkerField" | "useDrillDown" | "getTdProps" | "paginate" | "resize">;
var defaultProps: Pick<TableJSXProps<{}>, "data" | "hasChildren" | "identifierField" | "parentIdentifierField" | "renderInTopFilterBar" | "renderInBottomFilterBar" | "rootParentId" | "renderNullDataComponent" | "linkerField" | "useDrillDown" | "getTdProps" | "paginate" | "resize">;
}
export { Table };

0 comments on commit d26dbd3

Please sign in to comment.