@xyo-network/react-shared 2.25.75 → 2.25.76
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.
|
@@ -1,22 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { TableCell
|
|
2
|
+
import { TableCell } from '@mui/material';
|
|
3
3
|
import { LinkEx } from '@xylabs/react-common';
|
|
4
4
|
import { useEffect, useRef, useState } from 'react';
|
|
5
5
|
import { getActualPaddingX } from '../../lib';
|
|
6
6
|
import { findParent } from './findParent';
|
|
7
7
|
import { getRemainingRowWidth } from './getRemainingRowWidth';
|
|
8
8
|
import { getSmallestParentWidth } from './getSmallestParentWidth';
|
|
9
|
-
const
|
|
10
|
-
return (_jsx(Typography, { variant: "body2", fontFamily: "monospace", style: {
|
|
11
|
-
display: 'block',
|
|
12
|
-
maxWidth: hashCellWidth,
|
|
13
|
-
overflow: 'hidden',
|
|
14
|
-
textOverflow: 'ellipsis',
|
|
15
|
-
whiteSpace: 'nowrap',
|
|
16
|
-
...style,
|
|
17
|
-
}, ...props, children: value }));
|
|
18
|
-
};
|
|
19
|
-
export const EllipsisTableCell = ({ value, to, href, ...props }) => {
|
|
9
|
+
export const EllipsisTableCell = ({ children, value, to, href, ...props }) => {
|
|
20
10
|
const [calcCellWidth, setCalcCellWidth] = useState(0);
|
|
21
11
|
const hashDivRef = useRef(null);
|
|
22
12
|
useEffect(() => {
|
|
@@ -48,7 +38,13 @@ export const EllipsisTableCell = ({ value, to, href, ...props }) => {
|
|
|
48
38
|
row?.removeEventListener('resize', onResize);
|
|
49
39
|
};
|
|
50
40
|
}, [hashDivRef]);
|
|
51
|
-
return (_jsx(TableCell, { ...props, children: _jsx("div", { ref: hashDivRef, children:
|
|
41
|
+
return (_jsx(TableCell, { ...props, children: _jsx("div", { ref: hashDivRef, children: children ? (_jsx("span", { style: {
|
|
42
|
+
display: 'block',
|
|
43
|
+
maxWidth: calcCellWidth,
|
|
44
|
+
overflow: 'hidden',
|
|
45
|
+
textOverflow: 'ellipsis',
|
|
46
|
+
whiteSpace: 'nowrap',
|
|
47
|
+
}, children: children })) : href || to ? (_jsx(LinkEx, { style: {
|
|
52
48
|
display: 'block',
|
|
53
49
|
maxWidth: calcCellWidth,
|
|
54
50
|
overflow: 'hidden',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EllipsisTableCell.js","sourceRoot":"","sources":["../../../../src/components/TableCell/EllipsisTableCell.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAkB,
|
|
1
|
+
{"version":3,"file":"EllipsisTableCell.js","sourceRoot":"","sources":["../../../../src/components/TableCell/EllipsisTableCell.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAkB,MAAM,eAAe,CAAA;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAGnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AAQjE,MAAM,CAAC,MAAM,iBAAiB,GAAqC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IAC7G,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAS,CAAC,CAAC,CAAA;IAC7D,MAAM,UAAU,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAA;IAE/C,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,EAAE,aAAa,CAAA;QACxD,MAAM,IAAI,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AE;oBACL,OAAO,EAAE,OAAO;oBAChB,QAAQ,EAAE,aAAa;oBACvB,QAAQ,EAAE,QAAQ;oBAClB,YAAY,EAAE,UAAU;oBACxB,UAAU,EAAE,QAAQ;iBACrB,YAEA,QAAQ,GACJ,CACR,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,CACf,KAAC,MAAM,IACL,KAAK,EAAE;oBACL,OAAO,EAAE,OAAO;oBAChB,QAAQ,EAAE,aAAa;oBACvB,QAAQ,EAAE,QAAQ;oBAClB,YAAY,EAAE,UAAU;oBACxB,UAAU,EAAE,QAAQ;iBACrB,EACD,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,YAElC,KAAK,GACC,CACV,CAAC,CAAC,CAAC,CACF,eACE,KAAK,EAAE;oBACL,OAAO,EAAE,OAAO;oBAChB,QAAQ,EAAE,aAAa;oBACvB,QAAQ,EAAE,QAAQ;oBAClB,YAAY,EAAE,UAAU;oBACxB,UAAU,EAAE,QAAQ;iBACrB,YAEA,KAAK,GACD,CACR,GACG,GACI,CACb,CAAA;AACH,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"@emotion/react": "^11.9.3",
|
|
14
14
|
"@emotion/styled": "^11.9.3",
|
|
15
15
|
"@mui/icons-material": "^5.8.4",
|
|
16
|
-
"@mui/material": "^5.8.
|
|
16
|
+
"@mui/material": "^5.8.5",
|
|
17
17
|
"@mui/styles": "^5.8.4",
|
|
18
18
|
"@xylabs/pixel": "^1.3.9",
|
|
19
19
|
"@xylabs/react-button": "^2.14.4",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@storybook/react": "^6.5.9",
|
|
38
38
|
"@xylabs/pixel": "^1.3.9",
|
|
39
39
|
"@xylabs/sdk-js": "^2.5.9",
|
|
40
|
-
"@xylabs/tsconfig": "^1.0.
|
|
40
|
+
"@xylabs/tsconfig": "^1.0.14"
|
|
41
41
|
},
|
|
42
42
|
"browser": "dist/esm/index.js",
|
|
43
43
|
"docs": "dist/docs.json",
|
|
@@ -88,6 +88,6 @@
|
|
|
88
88
|
},
|
|
89
89
|
"sideEffects": false,
|
|
90
90
|
"types": "dist/esm/index.d.ts",
|
|
91
|
-
"version": "2.25.
|
|
91
|
+
"version": "2.25.76",
|
|
92
92
|
"packageManager": "yarn@3.1.1"
|
|
93
93
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TableCell, TableCellProps
|
|
1
|
+
import { TableCell, TableCellProps } from '@mui/material'
|
|
2
2
|
import { LinkEx } from '@xylabs/react-common'
|
|
3
3
|
import { useEffect, useRef, useState } from 'react'
|
|
4
4
|
import { To } from 'react-router-dom'
|
|
@@ -8,38 +8,13 @@ import { findParent } from './findParent'
|
|
|
8
8
|
import { getRemainingRowWidth } from './getRemainingRowWidth'
|
|
9
9
|
import { getSmallestParentWidth } from './getSmallestParentWidth'
|
|
10
10
|
|
|
11
|
-
interface TableCellValueProps extends TypographyProps {
|
|
12
|
-
value: string | undefined
|
|
13
|
-
hashCellWidth: number | undefined
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const TableCellValue: React.FC<TableCellValueProps> = ({ style, hashCellWidth, value, ...props }) => {
|
|
17
|
-
return (
|
|
18
|
-
<Typography
|
|
19
|
-
variant="body2"
|
|
20
|
-
fontFamily="monospace"
|
|
21
|
-
style={{
|
|
22
|
-
display: 'block',
|
|
23
|
-
maxWidth: hashCellWidth,
|
|
24
|
-
overflow: 'hidden',
|
|
25
|
-
textOverflow: 'ellipsis',
|
|
26
|
-
whiteSpace: 'nowrap',
|
|
27
|
-
...style,
|
|
28
|
-
}}
|
|
29
|
-
{...props}
|
|
30
|
-
>
|
|
31
|
-
{value}
|
|
32
|
-
</Typography>
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
11
|
export interface EllipsisTableCellProps extends TableCellProps {
|
|
37
12
|
value?: string
|
|
38
13
|
to?: To | undefined
|
|
39
14
|
href?: string | undefined
|
|
40
15
|
}
|
|
41
16
|
|
|
42
|
-
export const EllipsisTableCell: React.FC<EllipsisTableCellProps> = ({ value, to, href, ...props }) => {
|
|
17
|
+
export const EllipsisTableCell: React.FC<EllipsisTableCellProps> = ({ children, value, to, href, ...props }) => {
|
|
43
18
|
const [calcCellWidth, setCalcCellWidth] = useState<number>(0)
|
|
44
19
|
const hashDivRef = useRef<HTMLDivElement>(null)
|
|
45
20
|
|
|
@@ -79,7 +54,19 @@ export const EllipsisTableCell: React.FC<EllipsisTableCellProps> = ({ value, to,
|
|
|
79
54
|
return (
|
|
80
55
|
<TableCell {...props}>
|
|
81
56
|
<div ref={hashDivRef}>
|
|
82
|
-
{
|
|
57
|
+
{children ? (
|
|
58
|
+
<span
|
|
59
|
+
style={{
|
|
60
|
+
display: 'block',
|
|
61
|
+
maxWidth: calcCellWidth,
|
|
62
|
+
overflow: 'hidden',
|
|
63
|
+
textOverflow: 'ellipsis',
|
|
64
|
+
whiteSpace: 'nowrap',
|
|
65
|
+
}}
|
|
66
|
+
>
|
|
67
|
+
{children}
|
|
68
|
+
</span>
|
|
69
|
+
) : href || to ? (
|
|
83
70
|
<LinkEx
|
|
84
71
|
style={{
|
|
85
72
|
display: 'block',
|