@bsol-oss/react-datatable5 7.4.0 → 7.4.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/index.js
CHANGED
|
@@ -628,6 +628,9 @@ const DataListItem = React__namespace.forwardRef(function DataListItem(props, re
|
|
|
628
628
|
});
|
|
629
629
|
|
|
630
630
|
const RecordDisplay = ({ object, dataListProps, }) => {
|
|
631
|
+
if (object === null) {
|
|
632
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: "null" });
|
|
633
|
+
}
|
|
631
634
|
return (jsxRuntime.jsx(DataListRoot, { gap: 4, padding: 4, display: "grid", variant: "subtle", orientation: "horizontal", overflow: "auto", ...dataListProps, children: Object.entries(object).map(([field, value]) => {
|
|
632
635
|
return (jsxRuntime.jsx(DataListItem, { label: snakeToLabel(field), value: JSON.stringify(value) }, field));
|
|
633
636
|
}) }));
|
|
@@ -664,12 +667,20 @@ const DataDisplay = ({ variant = "" }) => {
|
|
|
664
667
|
if (variant == "stats") {
|
|
665
668
|
return (jsxRuntime.jsx(react.Flex, { flexFlow: "column", gap: "1", children: table.getRowModel().rows.map((row) => {
|
|
666
669
|
return (jsxRuntime.jsx(react.Card.Root, { children: jsxRuntime.jsx(react.Card.Body, { children: jsxRuntime.jsx(react.DataList.Root, { gap: 4, padding: 4, display: "flex", flexFlow: "row", variant: "subtle", overflow: "auto", children: row.getVisibleCells().map((cell) => {
|
|
670
|
+
const value = cell.getValue();
|
|
671
|
+
if (typeof value === "object") {
|
|
672
|
+
return jsxRuntime.jsx(RecordDisplay, { object: value });
|
|
673
|
+
}
|
|
667
674
|
return (jsxRuntime.jsxs(react.DataList.Item, { display: "flex", justifyContent: "center", alignItems: "center", flex: "1 0 0%", children: [jsxRuntime.jsx(react.DataList.ItemLabel, { children: snakeToLabel(cell.column.id) }), jsxRuntime.jsx(react.DataList.ItemValue, { wordBreak: "break-word", textOverflow: "ellipsis", overflow: "hidden", children: `${formatValue(cell.getValue())}` })] }, cell.id));
|
|
668
675
|
}) }) }) }, `chakra-table-card-${row.id}`));
|
|
669
676
|
}) }));
|
|
670
677
|
}
|
|
671
678
|
return (jsxRuntime.jsx(react.Flex, { flexFlow: "column", gap: "1", children: table.getRowModel().rows.map((row) => {
|
|
672
679
|
return (jsxRuntime.jsx(react.Card.Root, { children: jsxRuntime.jsx(react.Card.Body, { children: jsxRuntime.jsx(react.DataList.Root, { gap: 4, padding: 4, display: "grid", variant: "subtle", gridTemplateColumns: "repeat(auto-fit, minmax(20rem, 1fr))", children: row.getVisibleCells().map((cell) => {
|
|
680
|
+
const value = cell.getValue();
|
|
681
|
+
if (typeof value === "object") {
|
|
682
|
+
return jsxRuntime.jsx(RecordDisplay, { object: value });
|
|
683
|
+
}
|
|
673
684
|
return (jsxRuntime.jsxs(react.DataList.Item, { children: [jsxRuntime.jsx(react.DataList.ItemLabel, { children: snakeToLabel(cell.column.id) }), jsxRuntime.jsx(react.DataList.ItemValue, { wordBreak: "break-word", textOverflow: "ellipsis", overflow: "hidden", children: `${formatValue(cell.getValue())}` })] }, cell.id));
|
|
674
685
|
}) }) }) }, `chakra-table-card-${row.id}`));
|
|
675
686
|
}) }));
|
package/dist/index.mjs
CHANGED
|
@@ -608,6 +608,9 @@ const DataListItem = React.forwardRef(function DataListItem(props, ref) {
|
|
|
608
608
|
});
|
|
609
609
|
|
|
610
610
|
const RecordDisplay = ({ object, dataListProps, }) => {
|
|
611
|
+
if (object === null) {
|
|
612
|
+
return jsx(Fragment, { children: "null" });
|
|
613
|
+
}
|
|
611
614
|
return (jsx(DataListRoot, { gap: 4, padding: 4, display: "grid", variant: "subtle", orientation: "horizontal", overflow: "auto", ...dataListProps, children: Object.entries(object).map(([field, value]) => {
|
|
612
615
|
return (jsx(DataListItem, { label: snakeToLabel(field), value: JSON.stringify(value) }, field));
|
|
613
616
|
}) }));
|
|
@@ -644,12 +647,20 @@ const DataDisplay = ({ variant = "" }) => {
|
|
|
644
647
|
if (variant == "stats") {
|
|
645
648
|
return (jsx(Flex, { flexFlow: "column", gap: "1", children: table.getRowModel().rows.map((row) => {
|
|
646
649
|
return (jsx(Card.Root, { children: jsx(Card.Body, { children: jsx(DataList.Root, { gap: 4, padding: 4, display: "flex", flexFlow: "row", variant: "subtle", overflow: "auto", children: row.getVisibleCells().map((cell) => {
|
|
650
|
+
const value = cell.getValue();
|
|
651
|
+
if (typeof value === "object") {
|
|
652
|
+
return jsx(RecordDisplay, { object: value });
|
|
653
|
+
}
|
|
647
654
|
return (jsxs(DataList.Item, { display: "flex", justifyContent: "center", alignItems: "center", flex: "1 0 0%", children: [jsx(DataList.ItemLabel, { children: snakeToLabel(cell.column.id) }), jsx(DataList.ItemValue, { wordBreak: "break-word", textOverflow: "ellipsis", overflow: "hidden", children: `${formatValue(cell.getValue())}` })] }, cell.id));
|
|
648
655
|
}) }) }) }, `chakra-table-card-${row.id}`));
|
|
649
656
|
}) }));
|
|
650
657
|
}
|
|
651
658
|
return (jsx(Flex, { flexFlow: "column", gap: "1", children: table.getRowModel().rows.map((row) => {
|
|
652
659
|
return (jsx(Card.Root, { children: jsx(Card.Body, { children: jsx(DataList.Root, { gap: 4, padding: 4, display: "grid", variant: "subtle", gridTemplateColumns: "repeat(auto-fit, minmax(20rem, 1fr))", children: row.getVisibleCells().map((cell) => {
|
|
660
|
+
const value = cell.getValue();
|
|
661
|
+
if (typeof value === "object") {
|
|
662
|
+
return jsx(RecordDisplay, { object: value });
|
|
663
|
+
}
|
|
653
664
|
return (jsxs(DataList.Item, { children: [jsx(DataList.ItemLabel, { children: snakeToLabel(cell.column.id) }), jsx(DataList.ItemValue, { wordBreak: "break-word", textOverflow: "ellipsis", overflow: "hidden", children: `${formatValue(cell.getValue())}` })] }, cell.id));
|
|
654
665
|
}) }) }) }, `chakra-table-card-${row.id}`));
|
|
655
666
|
}) }));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DataListRootProps } from "@chakra-ui/react";
|
|
2
2
|
export interface RecordDisplayProps {
|
|
3
|
-
object:
|
|
3
|
+
object: object | null;
|
|
4
4
|
dataListProps?: DataListRootProps;
|
|
5
5
|
}
|
|
6
6
|
export declare const RecordDisplay: ({ object, dataListProps, }: RecordDisplayProps) => import("react/jsx-runtime").JSX.Element;
|