oolib 2.90.0 → 2.90.1
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.
- package/dist/components/ActionMenu/index.d.ts +2 -1
- package/dist/components/ActionMenu/index.js +25 -22
- package/dist/components/SimpleTable/comps/rowColActionMenus/ColActionsMenu/index.js +1 -1
- package/dist/components/SimpleTable/comps/rowColActionMenus/RowActionsMenu/index.js +1 -1
- package/dist/components/SimpleTable/useResizeTableColumns.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function ActionMenu({ icon, invert, actions, align, iconSize, M, ButtonComp: _ButtonComp, setShowActions: setShowActionsInParent, popOutOfOverflowHiddenParent, CustomSelectComp, storybookPreview }: {
|
|
1
|
+
export function ActionMenu({ icon, invert, actions, align, iconSize, M, ButtonComp: _ButtonComp, setShowActions: setShowActionsInParent, popOutOfOverflowHiddenParent, CustomSelectComp, storybookPreview, useLightboxPortal, }: {
|
|
2
2
|
icon?: string;
|
|
3
3
|
invert: any;
|
|
4
4
|
actions: any;
|
|
@@ -10,5 +10,6 @@ export function ActionMenu({ icon, invert, actions, align, iconSize, M, ButtonCo
|
|
|
10
10
|
popOutOfOverflowHiddenParent?: boolean;
|
|
11
11
|
CustomSelectComp: any;
|
|
12
12
|
storybookPreview: any;
|
|
13
|
+
useLightboxPortal: any;
|
|
13
14
|
}): React.JSX.Element;
|
|
14
15
|
import React from "react";
|
|
@@ -43,15 +43,15 @@ var useHandleClickOutside_1 = require("../../utils/customHooks/useHandleClickOut
|
|
|
43
43
|
var usePopOutOfOverflowHiddenParent_1 = require("../../utils/usePopOutOfOverflowHiddenParent");
|
|
44
44
|
var styled_1 = require("./styled");
|
|
45
45
|
var ModalConfirmAction_1 = require("../Modals/derivedComps/ModalConfirmAction");
|
|
46
|
+
var react_dom_1 = require("react-dom");
|
|
46
47
|
//
|
|
47
48
|
var ActionMenu = function (_a) {
|
|
48
|
-
var _b,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
;
|
|
49
|
+
var _b = _a.icon, icon = _b === void 0 ? "DotsThree" : _b, //most likely will never change
|
|
50
|
+
invert = _a.invert, actions = _a.actions, _c = _a.align, align = _c === void 0 ? "right" : _c, _d = _a.iconSize, iconSize = _d === void 0 ? "S" : _d, M = _a.M, _e = _a.ButtonComp, _ButtonComp = _e === void 0 ? "ButtonGhost" : _e, setShowActionsInParent = _a.setShowActions, _f = _a.popOutOfOverflowHiddenParent, popOutOfOverflowHiddenParent = _f === void 0 ? false : _f, CustomSelectComp = _a.CustomSelectComp, storybookPreview = _a.storybookPreview, //for storybook purposes
|
|
51
|
+
useLightboxPortal = _a.useLightboxPortal;
|
|
52
52
|
var actionMenuRef = (0, react_1.useRef)(null);
|
|
53
53
|
var optionsWrapperRef = (0, react_1.useRef)(null);
|
|
54
|
-
var
|
|
54
|
+
var _g = (0, react_1.useState)(false), showActions = _g[0], setShowActions = _g[1];
|
|
55
55
|
(0, useHandleClickOutside_1.useHandleClickOutside)(actionMenuRef, setShowActions);
|
|
56
56
|
if (!actions || actions.length === 0)
|
|
57
57
|
return null;
|
|
@@ -77,25 +77,17 @@ var ActionMenu = function (_a) {
|
|
|
77
77
|
(0, react_1.useEffect)(function () {
|
|
78
78
|
return function () { return setShowActionsInParent && setShowActionsInParent(false); };
|
|
79
79
|
}, []);
|
|
80
|
-
var
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
} })
|
|
86
|
-
: react_1.default.createElement(ButtonComp, __assign({}, buttonSize, { icon: icon, iconSize: iconSize, invert: invert, stopPropagation: true, preventDefault: true, onClick: function (e) {
|
|
87
|
-
setShowActions(!showActions);
|
|
88
|
-
}, active: showActions })),
|
|
89
|
-
popOutOfOverflowHiddenParent &&
|
|
90
|
-
react_1.default.createElement(styled_1.StyledActionMenuTracker, { storybookPreview: storybookPreview, align: align, ref: trackerRef }),
|
|
91
|
-
react_1.default.createElement(styled_1.StyledActionsDropMenu, __assign({}, {
|
|
92
|
-
id: 'dropmenu',
|
|
80
|
+
var _h = (0, usePopOutOfOverflowHiddenParent_1.usePopOutOfOverflowHiddenParent)(popOutOfOverflowHiddenParent), fixPos = _h.fixPos, applyFixedPos = _h.applyFixedPos, removeFixedPos = _h.removeFixedPos, trackerRef = _h.trackerRef;
|
|
81
|
+
var genLighbox = function () {
|
|
82
|
+
var _a, _b;
|
|
83
|
+
return (react_1.default.createElement(styled_1.StyledActionsDropMenu, __assign({}, {
|
|
84
|
+
id: "dropmenu",
|
|
93
85
|
align: align,
|
|
94
86
|
invert: invert,
|
|
95
|
-
optionsHeight: (
|
|
96
|
-
optionsWidth: (
|
|
87
|
+
optionsHeight: (_a = getOpsRect()) === null || _a === void 0 ? void 0 : _a.height,
|
|
88
|
+
optionsWidth: (_b = getOpsRect()) === null || _b === void 0 ? void 0 : _b.width,
|
|
97
89
|
showActions: showActions,
|
|
98
|
-
fixPos: fixPos
|
|
90
|
+
fixPos: fixPos,
|
|
99
91
|
}),
|
|
100
92
|
react_1.default.createElement(styled_1.StyledActionMenuOpsWrapper, { invert: invert, align: align, ref: optionsWrapperRef }, actions.map(function (action) {
|
|
101
93
|
return (react_1.default.createElement(ModalConfirmAction_1.ModalConfirmAction, __assign({}, action.confirmAction),
|
|
@@ -107,6 +99,17 @@ var ActionMenu = function (_a) {
|
|
|
107
99
|
}, key: action.display, invert: invert }),
|
|
108
100
|
action.icon && genOptionIcon(action.icon),
|
|
109
101
|
react_1.default.createElement(Typo_1.SANS_2, null, action.display))));
|
|
110
|
-
}))))
|
|
102
|
+
}))));
|
|
103
|
+
};
|
|
104
|
+
return (react_1.default.createElement(styled_1.StyledActionMenu, { ref: actionMenuRef },
|
|
105
|
+
CustomSelectComp ? (react_1.default.createElement(CustomSelectComp, { active: showActions, onClick: function (e) {
|
|
106
|
+
setShowActions(!showActions);
|
|
107
|
+
} })) : (react_1.default.createElement(ButtonComp, __assign({}, buttonSize, { icon: icon, iconSize: iconSize, invert: invert, stopPropagation: true, preventDefault: true, onClick: function (e) {
|
|
108
|
+
setShowActions(!showActions);
|
|
109
|
+
}, active: showActions }))),
|
|
110
|
+
popOutOfOverflowHiddenParent && (react_1.default.createElement(styled_1.StyledActionMenuTracker, { storybookPreview: storybookPreview, align: align, ref: trackerRef })),
|
|
111
|
+
popOutOfOverflowHiddenParent
|
|
112
|
+
? (0, react_dom_1.createPortal)(genLighbox(), document.getElementById("actionmenu-lightbox-root"))
|
|
113
|
+
: genLighbox()));
|
|
111
114
|
};
|
|
112
115
|
exports.ActionMenu = ActionMenu;
|
|
@@ -54,7 +54,7 @@ var ColActionsMenu = function (_a) {
|
|
|
54
54
|
// cuz if an actionmenu is open we want it to continue showing
|
|
55
55
|
// on screen irrespective of other factors such as hover and such
|
|
56
56
|
return (conditionsToRender || actionMenuIsOpen) && (react_1.default.createElement("div", { style: { zIndex: 2, position: 'absolute', top: 0, left: '50%', transform: 'translate(-50%, -50%)' } },
|
|
57
|
-
react_1.default.createElement(ActionMenu_1.ActionMenu, { setShowActions: function (bool) { return setActionMenuIsOpen(bool); }, align: "left", CustomSelectComp: function (_a) {
|
|
57
|
+
react_1.default.createElement(ActionMenu_1.ActionMenu, { popOutOfOverflowHiddenParent: true, setShowActions: function (bool) { return setActionMenuIsOpen(bool); }, align: "left", CustomSelectComp: function (_a) {
|
|
58
58
|
var active = _a.active, onClick = _a.onClick;
|
|
59
59
|
return (react_1.default.createElement(StyledCustomSelectCompWrapper, { style: { height: colActionsButtonHeight + 'px' }, onClick: onClick, active: active },
|
|
60
60
|
react_1.default.createElement(DisplayIcon_1.DisplayIcon, { icon: "DotsThree", size: 16 })));
|
|
@@ -61,7 +61,7 @@ var RowActionsMenu = function (_a) {
|
|
|
61
61
|
left: 0,
|
|
62
62
|
transform: "translate(-50%, -50%)",
|
|
63
63
|
} },
|
|
64
|
-
react_1.default.createElement(ActionMenu_1.ActionMenu, { align: "left", setShowActions: function (showActions) {
|
|
64
|
+
react_1.default.createElement(ActionMenu_1.ActionMenu, { popOutOfOverflowHiddenParent: true, align: "left", setShowActions: function (showActions) {
|
|
65
65
|
setActionMenuIsOpen(showActions);
|
|
66
66
|
}, CustomSelectComp: function (_a) {
|
|
67
67
|
var active = _a.active, onClick = _a.onClick;
|
|
@@ -61,7 +61,7 @@ var useResizeTableColumns = function (_a) {
|
|
|
61
61
|
if (!colResizeState) {
|
|
62
62
|
if (isInDragZone(e)) {
|
|
63
63
|
e.currentTarget.style.borderRight = borderStyleActive;
|
|
64
|
-
e.currentTarget.style.cursor
|
|
64
|
+
e.currentTarget.style.setProperty('cursor', 'col-resize', 'important'); // using the setProperty approach only so that we can apply !important
|
|
65
65
|
}
|
|
66
66
|
else {
|
|
67
67
|
e.currentTarget.style.borderRight = borderStyleInactive;
|