Removed package "autobind-decorator" and @boundMethod in favour of "auto-bind" util for constructors-only. (#5218)

This commit is contained in:
Roman authored and GitHub committed 2022-04-07 17:21:54 +03:00
1 parent 5f145e69e5
commit 06e7dfce5e
45 files changed
+150 -180

No files matched your search

+6 -2
View File
@@ -8,7 +8,7 @@ import type { TableSortBy, TableSortParams } from "./table";
import type { ReactNode } from "react";
import React from "react";
import { boundMethod, cssNames, displayBooleans } from "../../utils";
import { autoBind, cssNames, displayBooleans } from "../../utils";
import { Icon } from "../icon";
import { Checkbox } from "../checkbox";
@@ -78,7 +78,11 @@ export interface TableCellProps extends React.DOMAttributes<HTMLDivElement> {
}
export class TableCell extends React.Component<TableCellProps> {
@boundMethod
constructor(props: TableCellProps) {
super(props);
autoBind(this);
}
onClick(evt: React.MouseEvent<HTMLDivElement>) {
if (this.props.onClick) {
this.props.onClick(evt);
+2 -2
View File
@@ -7,7 +7,7 @@ import "./table.scss";
import React from "react";
import { observer } from "mobx-react";
import { boundMethod, cssNames } from "../../utils";
import { autoBind, cssNames } from "../../utils";
import type { TableRowElem, TableRowProps } from "./table-row";
import { TableRow } from "./table-row";
import type { TableHeadElem, TableHeadProps } from "./table-head";
@@ -99,6 +99,7 @@ class NonInjectedTable<Item> extends React.Component<TableProps<Item> & Dependen
constructor(props: TableProps<Item> & Dependencies) {
super(props);
makeObservable(this);
autoBind(this);
}
componentDidMount() {
@@ -173,7 +174,6 @@ class NonInjectedTable<Item> extends React.Component<TableProps<Item> & Dependen
onSort?.({ sortBy, orderBy });
}
@boundMethod
sort(colName: TableSortBy) {
const { sortBy, orderBy } = this.sortParams;
const sameColumn = sortBy == colName;