mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Removed package "autobind-decorator" and @boundMethod in favour of "auto-bind" util for constructors-only. (#5218)
This commit is contained in:
1 parent
5f145e69e5
commit
06e7dfce5e
45 files changed
+150
-180
No files matched your search
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user