@unofficialmc2/arche-controls
Version:
We know that there are a ton of react UI library projects to choose from. Our hope with this one is to provide the next generation of react components that you can use to bootstrap your next project, or as a reference for building a UIKit. Read on to get
139 lines (138 loc) • 6.01 kB
TypeScript
import * as React from "react";
import { UpPaginationProps } from "./UpPagination";
import { ActionFactory } from "./UpDataGridRow";
import { ICellFormatter } from "./UpDefaultCellFormatter";
import { IntentType } from "../../../Common/theming/types";
import { ActionType } from "../../../Common/actions";
import { UpDataGridFooterProps } from './UpDataGridFooter';
import { UpDataGridHeaderProps } from './UpDataGridHeader';
import { TestableComponentProps } from "../../../Common/utils/types";
import { ArcheIconName } from 'theming/icons';
export declare function isActionEnabled(props: {
actions?: ActionFactory<any> | Array<Action>;
displayRowActionsWithinCell?: boolean;
}): boolean;
export interface Action {
type: ActionType;
intent?: IntentType;
description: string;
action: (row: Row) => void;
libelle?: string;
borderless?: boolean;
isVisible?: (value: unknown) => boolean;
getProps?: (value: unknown) => unknown;
}
export interface ToolTip {
title?: JSX.Element | string;
content: JSX.Element | string;
icon?: ArcheIconName;
}
export interface Column {
label: string | JSX.Element;
field?: string;
formatter?: ICellFormatter;
getFormatterProps?: (value: string) => any;
render?: ({ value: any, column: Column }: {
value: any;
column: any;
}) => JSX.Element;
type?: any;
isSortable?: boolean;
isSorted?: boolean;
sortDir?: SortDirection;
tooltip?: ToolTip;
}
export interface Row {
isSelected?: boolean;
value?: any;
}
export declare type Method = "GET" | "POST";
export declare type PaginationPosition = "top" | "bottom" | "both";
export interface exportCsv {
fileName: string;
textButton?: string;
}
export interface UpDataGridProps extends TestableComponentProps {
className?: string;
columns: Array<Column>;
rowActions?: ActionFactory<any> | Array<Action>;
labelToDisplayRowActionsInCell?: string;
isSelectionEnabled?: boolean;
isPaginationEnabled?: boolean;
paginationPosition?: PaginationPosition;
isOddEvenEnabled?: boolean;
isSortEnabled?: boolean;
rowTemplate?: any;
data?: Array<any>;
dataKey?: string;
isDataFetching?: boolean;
alignCells?: 'top' | 'bottom' | 'middle' | 'initial';
textAlignCells?: 'center' | 'left' | 'right' | 'initial';
exportCsv?: exportCsv;
dataSource?: {
query: string;
method?: Method;
entityKey?: string;
orderParamName?: string;
dirParamName?: string;
skipParamName?: string;
takeParamName?: string;
};
loadingMessage?: string;
paginationProps?: Partial<UpPaginationProps>;
injectRow?: (previous: any, next: any, colum: Column[]) => JSX.Element;
onSortChange?: (c: Column, dir: SortDirection) => void;
onSelectionChange?: (lastChangeRow: Row, seletectedRow: Row[], allSelectedRows?: Row[]) => void;
onRowClick?: (rowIndex: number, row: any) => void;
isRowClickable?: boolean;
getRowCustomClassName?: (rowIndex: number, row: any) => string;
footerProps?: Partial<UpDataGridFooterProps>;
headerProps?: Partial<UpDataGridHeaderProps>;
displayRowActionsWithinCell?: boolean;
onlyOneRowCanBeSelected?: boolean;
}
export interface UpDataGridState {
data: Array<Row>;
columns: Array<Column>;
page?: number;
skip?: number;
take?: number;
total?: number;
isDataFetching?: boolean;
allRowSelected?: boolean;
selectedData?: Array<Row>;
}
export declare type SortDirection = "ASC" | "DESC";
declare const _default: {
new (props: any, context: any): {
render(): JSX.Element;
context: any;
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<UpDataGridProps & import("../../../Common/theming/withTheme").WithThemeProps>) => {} | Pick<{}, K>) | Pick<{}, K>, callback?: () => void): void;
forceUpdate(callback?: () => void): void;
readonly props: Readonly<UpDataGridProps & import("../../../Common/theming/withTheme").WithThemeProps> & Readonly<{
children?: React.ReactNode;
}>;
state: Readonly<{}>;
refs: {
[key: string]: React.ReactInstance;
};
componentDidMount?(): void;
shouldComponentUpdate?(nextProps: Readonly<UpDataGridProps & import("../../../Common/theming/withTheme").WithThemeProps>, nextState: Readonly<{}>, nextContext: any): boolean;
componentWillUnmount?(): void;
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
getSnapshotBeforeUpdate?(prevProps: Readonly<UpDataGridProps & import("../../../Common/theming/withTheme").WithThemeProps>, prevState: Readonly<{}>): any;
componentDidUpdate?(prevProps: Readonly<UpDataGridProps & import("../../../Common/theming/withTheme").WithThemeProps>, prevState: Readonly<{}>, snapshot?: any): void;
componentWillMount?(): void;
UNSAFE_componentWillMount?(): void;
componentWillReceiveProps?(nextProps: Readonly<UpDataGridProps & import("../../../Common/theming/withTheme").WithThemeProps>, nextContext: any): void;
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<UpDataGridProps & import("../../../Common/theming/withTheme").WithThemeProps>, nextContext: any): void;
componentWillUpdate?(nextProps: Readonly<UpDataGridProps & import("../../../Common/theming/withTheme").WithThemeProps>, nextState: Readonly<{}>, nextContext: any): void;
UNSAFE_componentWillUpdate?(nextProps: Readonly<UpDataGridProps & import("../../../Common/theming/withTheme").WithThemeProps>, nextState: Readonly<{}>, nextContext: any): void;
};
displayName: string;
contextTypes: {
theme: import("prop-types").Requireable<object>;
};
contextType?: React.Context<any>;
};
export default _default;