@ltht-react/table 2.0.171 → 2.0.172
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.
|
@@ -42,6 +42,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
42
42
|
};
|
|
43
43
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
44
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
45
|
+
var react_1 = require("react");
|
|
45
46
|
var button_1 = require("@ltht-react/button");
|
|
46
47
|
var styled_1 = __importDefault(require("@emotion/styled"));
|
|
47
48
|
var icon_1 = __importStar(require("@ltht-react/icon"));
|
|
@@ -60,6 +61,12 @@ var StyledActionMenuContainer = styled_1.default.div(templateObject_2 || (templa
|
|
|
60
61
|
// Betters ways of handling the customComponentOverride will be considered too
|
|
61
62
|
var TableCell = function (_a) {
|
|
62
63
|
var id = _a.id, adminActions = _a.adminActions, _b = _a.isButton, isButton = _b === void 0 ? false : _b, text = _a.text, iconProps = _a.iconProps, _c = _a.headerAxis, headerAxis = _c === void 0 ? 'x' : _c, clickHandler = _a.clickHandler, customComponentOverride = _a.customComponentOverride;
|
|
64
|
+
/*
|
|
65
|
+
* Ensures the action menu popup is rendered within the table’s DOM.
|
|
66
|
+
* Needed for Fullscreen API, since only elements inside the fullscreen subtree are visible.
|
|
67
|
+
* Using this ref as the portal root keeps the popup visible on top of the table in fullscreen.
|
|
68
|
+
*/
|
|
69
|
+
var actionMenuRootElementRef = (0, react_1.useRef)(null);
|
|
63
70
|
if (customComponentOverride) {
|
|
64
71
|
return customComponentOverride;
|
|
65
72
|
}
|
|
@@ -67,7 +74,7 @@ var TableCell = function (_a) {
|
|
|
67
74
|
if (adminActions.length === 0) {
|
|
68
75
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
|
|
69
76
|
}
|
|
70
|
-
return ((0, jsx_runtime_1.jsx)(StyledActionMenuContainer, { children: (0, jsx_runtime_1.jsx)(menu_1.default, { id: "".concat("".concat(id !== null && id !== void 0 ? id : '', "-"), "action-menu-button"), actions: adminActions, menuButtonOptions: {
|
|
77
|
+
return ((0, jsx_runtime_1.jsx)(StyledActionMenuContainer, { ref: actionMenuRootElementRef, children: (0, jsx_runtime_1.jsx)(menu_1.default, { root: actionMenuRootElementRef, id: "".concat("".concat(id !== null && id !== void 0 ? id : '', "-"), "action-menu-button"), actions: adminActions, menuButtonOptions: {
|
|
71
78
|
type: 'button',
|
|
72
79
|
text: '',
|
|
73
80
|
buttonProps: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-cell.js","sourceRoot":"","sources":["../../src/molecules/table-cell.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"table-cell.js","sourceRoot":"","sources":["../../src/molecules/table-cell.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAkC;AAClC,6CAA2C;AAC3C,2DAAoC;AACpC,uDAA8D;AAC9D,0DAA+D;AAC/D,6CAAgD;AAGhD,IAAM,cAAc,GAAG,gBAAM,CAAC,IAAI,+FAAA,4BAEjC,IAAA,CAAA;AACD,IAAM,yBAAyB,GAAG,gBAAM,CAAC,GAAG,qHAAA,kDAG3C;IAED,oEAAoE;IACpE,kJAAkJ;IAClJ,mFAAmF;IACnF,8EAA8E;IAL7E,CAAA;AAED,oEAAoE;AACpE,kJAAkJ;AAClJ,mFAAmF;AACnF,8EAA8E;AAC9E,IAAM,SAAS,GAAkB,UAAC,EASjC;QARC,EAAE,QAAA,EACF,YAAY,kBAAA,EACZ,gBAAgB,EAAhB,QAAQ,mBAAG,KAAK,KAAA,EAChB,IAAI,UAAA,EACJ,SAAS,eAAA,EACT,kBAAgB,EAAhB,UAAU,mBAAG,GAAG,KAAA,EAChB,YAAY,kBAAA,EACZ,uBAAuB,6BAAA;IAEvB;;;;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YAAY,GAAI,CAAA;IAC3G,CAAC;IAED,IAAI,YAAY,IAAI,SAAS,EAAE,CAAC;QAC9B,OAAO,uBAAC,iBAAU,IAAC,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,GAAI,CAAA;IACxF,CAAC;IAED,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,CACL,6DACE,uBAAC,cAAI,eAAK,SAAS,EAAI,EACtB,IAAI,IAAI,uBAAC,cAAc,cAAE,IAAI,GAAkB,IAC/C,CACJ,CAAA;IACH,CAAC;IAED,IAAI,IAAI,EAAE,CAAC;QACT,OAAO,gCAAK,EAAE,EAAE,EAAE,YAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE,GAAO,CAAA;IACxC,CAAC;IAED,OAAO,kDAAK,CAAA;AACd,CAAC,CAAA;AAcD,kBAAe,SAAS,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ltht-react/table",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.172",
|
|
4
4
|
"description": "ltht-react Table component.",
|
|
5
5
|
"author": "LTHT",
|
|
6
6
|
"homepage": "",
|
|
@@ -28,15 +28,15 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@emotion/react": "^11.0.0",
|
|
30
30
|
"@emotion/styled": "^11.0.0",
|
|
31
|
-
"@ltht-react/button": "^2.0.
|
|
32
|
-
"@ltht-react/icon": "^2.0.
|
|
33
|
-
"@ltht-react/menu": "^2.0.
|
|
34
|
-
"@ltht-react/styles": "^2.0.
|
|
35
|
-
"@ltht-react/types": "^2.0.
|
|
36
|
-
"@ltht-react/utils": "^2.0.
|
|
31
|
+
"@ltht-react/button": "^2.0.172",
|
|
32
|
+
"@ltht-react/icon": "^2.0.172",
|
|
33
|
+
"@ltht-react/menu": "^2.0.172",
|
|
34
|
+
"@ltht-react/styles": "^2.0.172",
|
|
35
|
+
"@ltht-react/types": "^2.0.172",
|
|
36
|
+
"@ltht-react/utils": "^2.0.172",
|
|
37
37
|
"@tanstack/react-table": "^8.10.7",
|
|
38
38
|
"react": "^18.2.0",
|
|
39
39
|
"react-uuid": "^2.0.0"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "5db08eeb239dfb0624cd069aea4ad3a5f02d13d7"
|
|
42
42
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FC } from 'react'
|
|
1
|
+
import { FC, useRef } from 'react'
|
|
2
2
|
import { Button } from '@ltht-react/button'
|
|
3
3
|
import styled from '@emotion/styled'
|
|
4
4
|
import Icon, { IconButton, IconProps } from '@ltht-react/icon'
|
|
@@ -28,6 +28,13 @@ const TableCell: FC<CellProps> = ({
|
|
|
28
28
|
clickHandler,
|
|
29
29
|
customComponentOverride,
|
|
30
30
|
}) => {
|
|
31
|
+
/*
|
|
32
|
+
* Ensures the action menu popup is rendered within the table’s DOM.
|
|
33
|
+
* Needed for Fullscreen API, since only elements inside the fullscreen subtree are visible.
|
|
34
|
+
* Using this ref as the portal root keeps the popup visible on top of the table in fullscreen.
|
|
35
|
+
*/
|
|
36
|
+
const actionMenuRootElementRef = useRef<HTMLDivElement>(null)
|
|
37
|
+
|
|
31
38
|
if (customComponentOverride) {
|
|
32
39
|
return customComponentOverride
|
|
33
40
|
}
|
|
@@ -37,8 +44,9 @@ const TableCell: FC<CellProps> = ({
|
|
|
37
44
|
return <></>
|
|
38
45
|
}
|
|
39
46
|
return (
|
|
40
|
-
<StyledActionMenuContainer>
|
|
47
|
+
<StyledActionMenuContainer ref={actionMenuRootElementRef}>
|
|
41
48
|
<ActionMenu
|
|
49
|
+
root={actionMenuRootElementRef}
|
|
42
50
|
id={`${`${id ?? ''}-`}action-menu-button`}
|
|
43
51
|
actions={adminActions}
|
|
44
52
|
menuButtonOptions={{
|