@xyo-network/react-shared 2.25.69 → 2.25.70
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/esm/components/TableCell/EllipsisTableCell.js +2 -4
- package/dist/esm/components/TableCell/EllipsisTableCell.js.map +1 -1
- package/dist/esm/components/TableCell/getRemainingRowWidth.d.ts +1 -1
- package/dist/esm/components/TableCell/getRemainingRowWidth.js +1 -1
- package/dist/esm/components/TableCell/getRemainingRowWidth.js.map +1 -1
- package/package.json +3 -3
- package/src/components/TableCell/EllipsisTableCell.tsx +2 -6
- package/src/components/TableCell/getRemainingRowWidth.ts +1 -1
|
@@ -19,8 +19,6 @@ export const EllipsisTableCell = ({ value, to, href, ...props }) => {
|
|
|
19
19
|
const [calcCellWidth, setCalcCellWidth] = useState(0);
|
|
20
20
|
const hashDivRef = useRef(null);
|
|
21
21
|
const theme = useTheme();
|
|
22
|
-
// We calulate the spacing since we know that table rows use padding.
|
|
23
|
-
const spacing = parseInt(theme.spacing(4).substring(-2));
|
|
24
22
|
useEffect(() => {
|
|
25
23
|
const currentElement = hashDivRef.current?.parentElement;
|
|
26
24
|
const cell = findParent('td', currentElement);
|
|
@@ -28,7 +26,7 @@ export const EllipsisTableCell = ({ value, to, href, ...props }) => {
|
|
|
28
26
|
const checkWidth = (cell) => {
|
|
29
27
|
const smallestParentWidth = getSmallestParentWidth(cell);
|
|
30
28
|
if (smallestParentWidth && row) {
|
|
31
|
-
const remainderWidth = smallestParentWidth - getRemainingRowWidth(row) - spacing;
|
|
29
|
+
const remainderWidth = smallestParentWidth - getRemainingRowWidth(row) - parseInt(theme.spacing(4).substring(0, -2)) * 4;
|
|
32
30
|
setCalcCellWidth(remainderWidth);
|
|
33
31
|
}
|
|
34
32
|
};
|
|
@@ -44,7 +42,7 @@ export const EllipsisTableCell = ({ value, to, href, ...props }) => {
|
|
|
44
42
|
return () => {
|
|
45
43
|
window.removeEventListener('resize', onResize);
|
|
46
44
|
};
|
|
47
|
-
}, [hashDivRef
|
|
45
|
+
}, [hashDivRef]);
|
|
48
46
|
return (_jsx(TableCell, { ...props, children: _jsx("div", { ref: hashDivRef, style: {
|
|
49
47
|
display: 'block',
|
|
50
48
|
maxWidth: calcCellWidth,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EllipsisTableCell.js","sourceRoot":"","sources":["../../../../src/components/TableCell/EllipsisTableCell.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAkB,UAAU,EAAmB,QAAQ,EAAE,MAAM,eAAe,CAAA;AAChG,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAGnD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AAOjE,MAAM,cAAc,GAAkC,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IAClG,OAAO,CACL,KAAC,UAAU,IACT,OAAO,EAAC,OAAO,EACf,UAAU,EAAC,WAAW,EACtB,KAAK,EAAE;YACL,OAAO,EAAE,OAAO;YAChB,QAAQ,EAAE,aAAa;YACvB,QAAQ,EAAE,QAAQ;YAClB,YAAY,EAAE,UAAU;YACxB,UAAU,EAAE,QAAQ;YACpB,GAAG,KAAK;SACT,KACG,KAAK,YAER,KAAK,GACK,CACd,CAAA;AACH,CAAC,CAAA;AAQD,MAAM,CAAC,MAAM,iBAAiB,GAAqC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IACnG,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAS,CAAC,C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,QAAQ;aACrB,YAEA,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,CACZ,KAAC,MAAM,IAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,YAC7D,KAAC,cAAc,IAAC,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,aAAa,GAAI,GACvD,CACV,CAAC,CAAC,CAAC,CACF,KAAC,cAAc,IAAC,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,aAAa,GAAI,CAC/D,GACG,GACI,CACb,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/** @description This is the width of all the cells (except the one passed) in the row combined */
|
|
1
|
+
/** @description This is the width of all the cells (except the one passed) in the row combined and the spacing of the main cell */
|
|
2
2
|
export declare const getRemainingRowWidth: (row: HTMLElement, forCell?: number) => number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @description This is the width of all the cells (except the one passed) in the row combined */
|
|
1
|
+
/** @description This is the width of all the cells (except the one passed) in the row combined and the spacing of the main cell */
|
|
2
2
|
export const getRemainingRowWidth = (row, forCell = 0) => {
|
|
3
3
|
let width = 0;
|
|
4
4
|
for (let i = 0; i < (row?.childElementCount ?? 0); i++) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRemainingRowWidth.js","sourceRoot":"","sources":["../../../../src/components/TableCell/getRemainingRowWidth.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"getRemainingRowWidth.js","sourceRoot":"","sources":["../../../../src/components/TableCell/getRemainingRowWidth.ts"],"names":[],"mappings":"AAAA,mIAAmI;AACnI,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,GAAgB,EAAE,OAAO,GAAG,CAAC,EAAE,EAAE;IACpE,IAAI,KAAK,GAAG,CAAC,CAAA;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,iBAAiB,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACtD,MAAM,IAAI,GAAG,GAAG,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QAClC,IAAI,IAAI,EAAE;YACR,IAAI,CAAC,KAAK,OAAO,EAAE;gBACjB,MAAM,YAAY,GAAG,IAAI,EAAE,qBAAqB,EAAE,CAAA;gBAClD,KAAK,IAAI,YAAY,EAAE,KAAK,IAAI,CAAC,CAAA;aAClC;SACF;KACF;IAED,OAAO,KAAK,CAAA;AACd,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@xylabs/react-common": "^2.14.4",
|
|
21
21
|
"@xylabs/react-flexbox": "^2.14.4",
|
|
22
22
|
"@xylabs/react-shared": "^2.14.4",
|
|
23
|
-
"@xylabs/sdk-js": "^2.5.
|
|
23
|
+
"@xylabs/sdk-js": "^2.5.9",
|
|
24
24
|
"@xyo-network/api": "^2.20.45",
|
|
25
25
|
"@xyo-network/network": "^2.20.45",
|
|
26
26
|
"axios": "^0.27.2",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@babel/preset-env": "^7.18.2",
|
|
37
37
|
"@storybook/react": "^6.5.9",
|
|
38
38
|
"@xylabs/pixel": "^1.3.9",
|
|
39
|
-
"@xylabs/sdk-js": "^2.5.
|
|
39
|
+
"@xylabs/sdk-js": "^2.5.9",
|
|
40
40
|
"@xylabs/tsconfig": "^1.0.13"
|
|
41
41
|
},
|
|
42
42
|
"browser": "dist/esm/index.js",
|
|
@@ -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.70",
|
|
92
92
|
"packageManager": "yarn@3.1.1"
|
|
93
93
|
}
|
|
@@ -41,12 +41,8 @@ export interface EllipsisTableCellProps extends TableCellProps {
|
|
|
41
41
|
export const EllipsisTableCell: React.FC<EllipsisTableCellProps> = ({ value, to, href, ...props }) => {
|
|
42
42
|
const [calcCellWidth, setCalcCellWidth] = useState<number>(0)
|
|
43
43
|
const hashDivRef = useRef<HTMLDivElement>(null)
|
|
44
|
-
|
|
45
44
|
const theme = useTheme()
|
|
46
45
|
|
|
47
|
-
// We calulate the spacing since we know that table rows use padding.
|
|
48
|
-
const spacing = parseInt(theme.spacing(4).substring(-2))
|
|
49
|
-
|
|
50
46
|
useEffect(() => {
|
|
51
47
|
const currentElement = hashDivRef.current?.parentElement
|
|
52
48
|
const cell = findParent('td', currentElement)
|
|
@@ -55,7 +51,7 @@ export const EllipsisTableCell: React.FC<EllipsisTableCellProps> = ({ value, to,
|
|
|
55
51
|
const checkWidth = (cell: HTMLElement) => {
|
|
56
52
|
const smallestParentWidth = getSmallestParentWidth(cell)
|
|
57
53
|
if (smallestParentWidth && row) {
|
|
58
|
-
const remainderWidth = smallestParentWidth - getRemainingRowWidth(row) - spacing
|
|
54
|
+
const remainderWidth = smallestParentWidth - getRemainingRowWidth(row) - parseInt(theme.spacing(4).substring(0, -2)) * 4
|
|
59
55
|
setCalcCellWidth(remainderWidth)
|
|
60
56
|
}
|
|
61
57
|
}
|
|
@@ -73,7 +69,7 @@ export const EllipsisTableCell: React.FC<EllipsisTableCellProps> = ({ value, to,
|
|
|
73
69
|
return () => {
|
|
74
70
|
window.removeEventListener('resize', onResize)
|
|
75
71
|
}
|
|
76
|
-
}, [hashDivRef
|
|
72
|
+
}, [hashDivRef])
|
|
77
73
|
|
|
78
74
|
return (
|
|
79
75
|
<TableCell {...props}>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @description This is the width of all the cells (except the one passed) in the row combined */
|
|
1
|
+
/** @description This is the width of all the cells (except the one passed) in the row combined and the spacing of the main cell */
|
|
2
2
|
export const getRemainingRowWidth = (row: HTMLElement, forCell = 0) => {
|
|
3
3
|
let width = 0
|
|
4
4
|
for (let i = 0; i < (row?.childElementCount ?? 0); i++) {
|