Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: input-table、colunmn-toggler组件增加泛型 #11318

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/amis/src/renderers/Form/InputTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,9 @@ export type FormTableRendererEvent =

export type FormTableRendererAction = 'add' | 'delete' | 'reset' | 'clear';

export default class FormTable extends React.Component<TableProps, TableState> {
export default class FormTable<
T extends TableProps = TableProps
> extends React.Component<T, TableState> {
static defaultProps = {
placeholder: 'placeholder.empty',
scaffold: {},
Expand Down Expand Up @@ -358,7 +360,7 @@ export default class FormTable extends React.Component<TableProps, TableState> {
leading: false
});

constructor(props: TableProps) {
constructor(props: T) {
super(props);
const {addHook} = props;
const items = Array.isArray(props.value) ? props.value.concat() : [];
Expand Down
9 changes: 4 additions & 5 deletions packages/amis/src/renderers/Table/ColumnToggler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,9 @@ export interface ColumnTogglerState {
tempColumns: any[];
}

export default class ColumnToggler extends React.Component<
ColumnTogglerProps,
ColumnTogglerState
> {
export default class ColumnToggler<
T extends ColumnTogglerProps = ColumnTogglerProps
> extends React.Component<T, ColumnTogglerState> {
state: ColumnTogglerState = {
isOpened: false,
enableSorting: false,
Expand All @@ -156,7 +155,7 @@ export default class ColumnToggler extends React.Component<
sortable?: Sortable;
dragRefDOM: HTMLElement;

constructor(props: ColumnTogglerProps) {
constructor(props: T) {
super(props);

this.open = this.open.bind(this);
Expand Down
Loading