@codezee/sixtify-brahma 0.2.163 → 0.2.164
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/package.json +1 -1
- package/packages/shared-components/dist/AgGrid/RedirectionCell/RedirectionCell.d.ts.map +1 -1
- package/packages/shared-components/dist/AgGrid/RedirectionCell/RedirectionCell.js +54 -26
- package/packages/shared-components/dist/AgGrid/RedirectionCell/index.d.ts +0 -1
- package/packages/shared-components/dist/AgGrid/RedirectionCell/index.d.ts.map +1 -1
- package/packages/shared-components/dist/AgGrid/RedirectionCell/index.js +0 -1
- package/packages/shared-components/dist/AgGrid/hooks/useCellEnterClick.d.ts +2 -1
- package/packages/shared-components/dist/AgGrid/hooks/useCellEnterClick.d.ts.map +1 -1
- package/packages/shared-components/dist/AgGrid/hooks/useCellEnterClick.js +7 -2
- package/packages/shared-components/dist/utils/hooks/useGlobalKeyboardShortcut.d.ts.map +1 -1
- package/packages/shared-components/dist/utils/hooks/useGlobalKeyboardShortcut.js +0 -4
- package/packages/shared-components/dist/AgGrid/RedirectionCell/ClickableCell.d.ts +0 -12
- package/packages/shared-components/dist/AgGrid/RedirectionCell/ClickableCell.d.ts.map +0 -1
- package/packages/shared-components/dist/AgGrid/RedirectionCell/ClickableCell.js +0 -20
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RedirectionCell.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/RedirectionCell/RedirectionCell.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RedirectionCell.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/RedirectionCell/RedirectionCell.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAInD,KAAK,oBAAoB,GAAG;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAClD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,6HAY7B,oBAAoB,4CA2ItB,CAAC"}
|
|
@@ -6,42 +6,70 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.RedirectionCell = void 0;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const material_1 = require("@mui/material");
|
|
9
|
+
const isFunction_1 = __importDefault(require("lodash/isFunction"));
|
|
9
10
|
const react_1 = require("react");
|
|
10
11
|
const useCellEnterClick_1 = require("../hooks/useCellEnterClick");
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
const RedirectionCell = ({ mainLabel, onClick, includeSubLabel = false, isSubLabelClickable = false, subLabel, avatar, includeAvatar = false, disabled = false, includeIcon = false, icon,
|
|
13
|
+
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
14
|
+
}) => {
|
|
14
15
|
const theme = (0, material_1.useTheme)();
|
|
15
16
|
const { butterflyBlue, black } = theme.palette.app.color;
|
|
16
|
-
const
|
|
17
|
+
const mainLabelRef = (0, react_1.useRef)(null);
|
|
18
|
+
const subLabelRef = (0, react_1.useRef)(null);
|
|
19
|
+
const isStringSubLabel = typeof subLabel === "string";
|
|
20
|
+
const useSubLabelRef = includeSubLabel && isSubLabelClickable && isStringSubLabel;
|
|
21
|
+
const activeRef = (0, react_1.useMemo)(() => (useSubLabelRef ? subLabelRef : mainLabelRef), [useSubLabelRef]);
|
|
17
22
|
(0, useCellEnterClick_1.useCellEnterClick)({
|
|
18
|
-
buttonRef:
|
|
23
|
+
buttonRef: activeRef,
|
|
19
24
|
disabled,
|
|
25
|
+
onPressEnter: (e) => {
|
|
26
|
+
if (!disabled && (0, isFunction_1.default)(onClick)) {
|
|
27
|
+
onClick(e);
|
|
28
|
+
}
|
|
29
|
+
},
|
|
20
30
|
});
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (
|
|
33
|
-
!isSubLabelClickable &&
|
|
34
|
-
(0, isFunction_1.default)(onClick)) {
|
|
35
|
-
onClick(e);
|
|
36
|
-
}
|
|
37
|
-
}, children: mainLabel }), includeSubLabel && typeof subLabel === "string" ? ((0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", color: !isSubLabelClickable ? black[900] : butterflyBlue[900], onMouseDown: (e) => {
|
|
38
|
-
if (!disabled && isSubLabelClickable) {
|
|
31
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Box, { component: "div", sx: { width: "100%" }, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", sx: { width: "100%" }, children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", gap: "5px", alignItems: "center", children: [includeAvatar && ((0, jsx_runtime_1.jsx)(material_1.Avatar, { src: avatar ?? "", alt: "Photo", sx: { width: 28, height: 28 } })), (0, jsx_runtime_1.jsxs)(material_1.Stack, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", sx: {
|
|
32
|
+
width: "100%",
|
|
33
|
+
color: disabled || isSubLabelClickable
|
|
34
|
+
? black[900]
|
|
35
|
+
: butterflyBlue[900],
|
|
36
|
+
cursor: !disabled && !isSubLabelClickable ? "pointer" : "default",
|
|
37
|
+
}, ref: mainLabelRef, tabIndex: !disabled && !isSubLabelClickable ? 0 : -1, onKeyDown: (e) => {
|
|
38
|
+
if ((e.key === "Enter" || e.key === " ") &&
|
|
39
|
+
!disabled &&
|
|
40
|
+
!isSubLabelClickable) {
|
|
41
|
+
e.preventDefault();
|
|
42
|
+
if ((0, isFunction_1.default)(onClick)) {
|
|
39
43
|
onClick(e);
|
|
40
44
|
}
|
|
41
|
-
}
|
|
42
|
-
|
|
45
|
+
}
|
|
46
|
+
}, onClick: (e) => {
|
|
47
|
+
if (!disabled && !isSubLabelClickable && (0, isFunction_1.default)(onClick)) {
|
|
48
|
+
onClick(e);
|
|
49
|
+
}
|
|
50
|
+
}, children: mainLabel }), includeSubLabel && isStringSubLabel ? ((0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", color: !isSubLabelClickable ? black[900] : butterflyBlue[900], sx: {
|
|
51
|
+
cursor: !disabled && isSubLabelClickable ? "pointer" : "default",
|
|
52
|
+
}, onKeyDown: (e) => {
|
|
53
|
+
if ((e.key === "Enter" || e.key === " ") &&
|
|
54
|
+
!disabled &&
|
|
55
|
+
isSubLabelClickable) {
|
|
56
|
+
e.preventDefault();
|
|
57
|
+
if ((0, isFunction_1.default)(onClick)) {
|
|
43
58
|
onClick(e);
|
|
44
59
|
}
|
|
45
|
-
}
|
|
60
|
+
}
|
|
61
|
+
}, onClick: (e) => {
|
|
62
|
+
if (!disabled &&
|
|
63
|
+
isSubLabelClickable &&
|
|
64
|
+
(0, isFunction_1.default)(onClick)) {
|
|
65
|
+
onClick(e);
|
|
66
|
+
}
|
|
67
|
+
}, ref: subLabelRef, tabIndex: !disabled && isSubLabelClickable ? 0 : -1, children: subLabel ?? "-" })) : ((0, jsx_runtime_1.jsx)(material_1.Stack, { sx: {
|
|
68
|
+
cursor: !disabled && isSubLabelClickable ? "pointer" : "default",
|
|
69
|
+
}, onClick: (e) => {
|
|
70
|
+
if (!disabled && isSubLabelClickable) {
|
|
71
|
+
onClick(e);
|
|
72
|
+
}
|
|
73
|
+
}, children: subLabel }))] })] }), includeIcon && icon && (0, jsx_runtime_1.jsx)(material_1.Box, { children: icon })] }) }));
|
|
46
74
|
};
|
|
47
75
|
exports.RedirectionCell = RedirectionCell;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/RedirectionCell/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/RedirectionCell/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
|
@@ -2,7 +2,8 @@ type UseCellEnterClickArgs = {
|
|
|
2
2
|
buttonRef: React.RefObject<HTMLElement>;
|
|
3
3
|
disabled?: boolean;
|
|
4
4
|
popoverOpen?: boolean;
|
|
5
|
+
onPressEnter?: (event: KeyboardEvent) => void;
|
|
5
6
|
};
|
|
6
|
-
export declare function useCellEnterClick({ buttonRef, disabled, popoverOpen, }: UseCellEnterClickArgs): void;
|
|
7
|
+
export declare function useCellEnterClick({ buttonRef, disabled, popoverOpen, onPressEnter, }: UseCellEnterClickArgs): void;
|
|
7
8
|
export {};
|
|
8
9
|
//# sourceMappingURL=useCellEnterClick.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCellEnterClick.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/hooks/useCellEnterClick.ts"],"names":[],"mappings":"AAEA,KAAK,qBAAqB,GAAG;IAC3B,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useCellEnterClick.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/hooks/useCellEnterClick.ts"],"names":[],"mappings":"AAEA,KAAK,qBAAqB,GAAG;IAC3B,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;CAC/C,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,QAAQ,EACR,WAAW,EACX,YAAY,GACb,EAAE,qBAAqB,QA4DvB"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useCellEnterClick = useCellEnterClick;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
function useCellEnterClick({ buttonRef, disabled, popoverOpen, }) {
|
|
5
|
+
function useCellEnterClick({ buttonRef, disabled, popoverOpen, onPressEnter, }) {
|
|
6
6
|
(0, react_1.useEffect)(() => {
|
|
7
7
|
const handleKeyDown = (event) => {
|
|
8
8
|
if (event.key !== "Enter" ||
|
|
@@ -26,7 +26,12 @@ function useCellEnterClick({ buttonRef, disabled, popoverOpen, }) {
|
|
|
26
26
|
}
|
|
27
27
|
event.preventDefault();
|
|
28
28
|
event.stopPropagation();
|
|
29
|
-
|
|
29
|
+
if (onPressEnter) {
|
|
30
|
+
onPressEnter(event);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
button.click();
|
|
34
|
+
}
|
|
30
35
|
};
|
|
31
36
|
if (buttonRef.current) {
|
|
32
37
|
const cell = buttonRef.current.closest(".ag-cell");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGlobalKeyboardShortcut.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/useGlobalKeyboardShortcut.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;AAEpD,KAAK,6BAA6B,GAAG;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,QAAQ,CAAC;IACpB,YAAY,CAAC,EAAE,YAAY,GAAG,YAAY,EAAE,CAAC;IAC7C,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,qDAKvC,6BAA6B,
|
|
1
|
+
{"version":3,"file":"useGlobalKeyboardShortcut.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/useGlobalKeyboardShortcut.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;AAEpD,KAAK,6BAA6B,GAAG;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,QAAQ,CAAC;IACpB,YAAY,CAAC,EAAE,YAAY,GAAG,YAAY,EAAE,CAAC;IAC7C,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,qDAKvC,6BAA6B,SAwH/B,CAAC"}
|
|
@@ -12,10 +12,6 @@ const useGlobalKeyboardShortcut = ({ key, onTrigger, modifierKeys = "ctrl", with
|
|
|
12
12
|
(0, react_1.useEffect)(() => {
|
|
13
13
|
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
14
14
|
const handler = (e) => {
|
|
15
|
-
const dialog = document.querySelector('[role="dialog"]');
|
|
16
|
-
if (dialog) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
15
|
const eventTarget = e.target;
|
|
20
16
|
const autocompleteRoot = eventTarget?.closest(".MuiAutocomplete-root");
|
|
21
17
|
if (autocompleteRoot) {
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { MouseEvent, ReactNode } from "react";
|
|
2
|
-
type ClickableCellProps = {
|
|
3
|
-
children: ReactNode;
|
|
4
|
-
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
5
|
-
onMouseDown?: (event: MouseEvent<HTMLElement>) => void;
|
|
6
|
-
disabled?: boolean;
|
|
7
|
-
className?: string;
|
|
8
|
-
sx?: object;
|
|
9
|
-
};
|
|
10
|
-
export declare const ClickableCell: ({ children, onClick, onMouseDown, disabled, className, sx, }: ClickableCellProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export {};
|
|
12
|
-
//# sourceMappingURL=ClickableCell.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ClickableCell.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/RedirectionCell/ClickableCell.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEnD,KAAK,kBAAkB,GAAG;IACxB,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IACnD,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,8DAO3B,kBAAkB,4CA2BpB,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ClickableCell = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const material_1 = require("@mui/material");
|
|
6
|
-
const ClickableCell = ({ children, onClick, onMouseDown, disabled = false, className, sx, }) => {
|
|
7
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Box, { component: "div", "data-clickable": !disabled ? "true" : undefined, onClick: (e) => e.preventDefault(), onMouseDown: (e) => e.preventDefault(), onKeyDown: (e) => {
|
|
8
|
-
if (!disabled && (e.key === "Enter" || e.key === " ")) {
|
|
9
|
-
onClick?.(e);
|
|
10
|
-
}
|
|
11
|
-
}, tabIndex: disabled ? -1 : 0, role: "button", className: className, sx: {
|
|
12
|
-
width: "100%",
|
|
13
|
-
height: "100%",
|
|
14
|
-
display: "flex",
|
|
15
|
-
alignItems: "center",
|
|
16
|
-
cursor: !disabled && (onClick || onMouseDown) ? "pointer" : "default",
|
|
17
|
-
...sx,
|
|
18
|
-
}, children: children }));
|
|
19
|
-
};
|
|
20
|
-
exports.ClickableCell = ClickableCell;
|