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

+4 -5
View File
@@ -9,7 +9,7 @@ import React from "react";
import { createPortal } from "react-dom";
import { observer } from "mobx-react";
import type { IClassName } from "../../utils";
import { boundMethod, cssNames } from "../../utils";
import { cssNames, autoBind } from "../../utils";
import { observable, makeObservable, action } from "mobx";
export enum TooltipPosition {
@@ -61,6 +61,7 @@ export class Tooltip extends React.Component<TooltipProps> {
constructor(props: TooltipProps) {
super(props);
makeObservable(this);
autoBind(this);
}
get targetElem(): HTMLElement {
@@ -89,19 +90,18 @@ export class Tooltip extends React.Component<TooltipProps> {
this.hoverTarget.removeEventListener("mouseleave", this.onLeaveTarget);
}
@action.bound
@action
protected onEnterTarget() {
this.isVisible = true;
requestAnimationFrame(action(() => this.isContentVisible = true));
}
@action.bound
@action
protected onLeaveTarget() {
this.isVisible = false;
this.isContentVisible = false;
}
@boundMethod
refreshPosition() {
const { preferredPositions } = this.props;
const { elem, targetElem } = this;
@@ -219,7 +219,6 @@ export class Tooltip extends React.Component<TooltipProps> {
};
}
@boundMethod
bindRef(elem: HTMLElement) {
this.elem = elem;
}