ar-design 0.3.22 → 0.3.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -12,6 +12,8 @@ const KanbanBoard = function ({ trackBy, columns, onChange }) {
|
|
|
12
12
|
event.preventDefault();
|
|
13
13
|
const item = JSON.parse(event.dataTransfer.getData("item"));
|
|
14
14
|
const fromColumn = event.dataTransfer.getData("fromColumn");
|
|
15
|
+
const nodes = document.querySelectorAll("[data-id='placeholder']");
|
|
16
|
+
nodes.forEach((node) => node.remove());
|
|
15
17
|
if (!item || fromColumn === toColumn)
|
|
16
18
|
return;
|
|
17
19
|
const updatedColumns = data.map((board) => {
|
|
@@ -38,8 +40,6 @@ const KanbanBoard = function ({ trackBy, columns, onChange }) {
|
|
|
38
40
|
event.dataTransfer.clearData("item");
|
|
39
41
|
event.dataTransfer.clearData("fromColumn");
|
|
40
42
|
_hoverItemIndex.current = null;
|
|
41
|
-
const nodes = document.querySelectorAll("[data-id='placeholder']");
|
|
42
|
-
nodes.forEach((node) => node.remove());
|
|
43
43
|
};
|
|
44
44
|
// useEffects
|
|
45
45
|
useEffect(() => setData(columns), [columns]);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Color } from "../../../libs/types";
|
|
2
|
+
import { IIcon } from "../../../libs/types/IGlobalProps";
|
|
2
3
|
interface IProps {
|
|
3
|
-
buttons: {
|
|
4
|
+
buttons: ({
|
|
4
5
|
text: string;
|
|
5
6
|
onClick: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
6
7
|
color?: Color;
|
|
7
|
-
}[];
|
|
8
|
+
} & IIcon)[];
|
|
8
9
|
}
|
|
9
10
|
export default IProps;
|
|
@@ -44,13 +44,13 @@ const ButtonAction = ({ buttons }) => {
|
|
|
44
44
|
const handleResizeEvent = () => setOpen(false);
|
|
45
45
|
// useEffects
|
|
46
46
|
useEffect(() => {
|
|
47
|
-
if (open)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
if (!open)
|
|
48
|
+
return;
|
|
49
|
+
setTimeout(() => handlePosition(), 0);
|
|
50
|
+
window.addEventListener("blur", () => setOpen(false));
|
|
51
|
+
window.addEventListener("resize", handleResizeEvent);
|
|
52
|
+
document.addEventListener("click", handleClickOutSide);
|
|
53
|
+
document.addEventListener("keydown", handleKeys);
|
|
54
54
|
return () => {
|
|
55
55
|
window.removeEventListener("blur", () => setOpen(false));
|
|
56
56
|
window.removeEventListener("resize", handleResizeEvent);
|
|
@@ -60,9 +60,9 @@ const ButtonAction = ({ buttons }) => {
|
|
|
60
60
|
}, [open]);
|
|
61
61
|
return (React.createElement("div", { ref: _wrapper, className: "ar-button-action" },
|
|
62
62
|
React.createElement("span", { ref: _button },
|
|
63
|
-
React.createElement(Button, { variant: "
|
|
63
|
+
React.createElement(Button, { variant: "borderless", color: "light", icon: { element: React.createElement("span", { className: "dotted" }) }, onClick: () => setOpen((prev) => !prev) })),
|
|
64
64
|
open &&
|
|
65
|
-
ReactDOM.createPortal(React.createElement("span", { ref: _list, className: "ar-action-buttons" }, buttons.map((button) => (React.createElement(Button, { variant: "borderless", color: button.color ?? "blue", onClick: button.onClick }, button.text)))), document.body)));
|
|
65
|
+
ReactDOM.createPortal(React.createElement("span", { ref: _list, className: "ar-action-buttons" }, buttons.map((button) => (React.createElement(Button, { style: { display: "flex", justifyContent: "flex-start" }, variant: "borderless", color: button.color ?? "blue", size: "small", icon: button.icon, onClick: button.onClick }, button.text)))), document.body)));
|
|
66
66
|
};
|
|
67
67
|
ButtonAction.displayName = "ButtonAction";
|
|
68
68
|
export default ButtonAction;
|