@symply.io/basic-components 1.7.0-alpha.2 → 1.7.0-alpha.4

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.
@@ -0,0 +1,8 @@
1
+ import { ForwardedRef } from "react";
2
+ import type { VirtualTableProps, TVirtualTableRow, TVirtualTableOptions, VirtualDataTableRefProps } from "./types";
3
+ declare const VirtualDataTable: <RowProps extends TVirtualTableRow, OptionProps extends TVirtualTableOptions>(props: VirtualTableProps<RowProps, OptionProps>, ref: ForwardedRef<VirtualDataTableRefProps>) => import("react/jsx-runtime").JSX.Element;
4
+ declare const _default: <RowProps extends TVirtualTableRow, OptionProps extends TVirtualTableOptions>(props: VirtualTableProps<RowProps, OptionProps> & {
5
+ ref?: ForwardedRef<VirtualDataTableRefProps> | undefined;
6
+ }) => ReturnType<typeof VirtualDataTable>;
7
+ export default _default;
8
+ export type { VirtualDataTableRefProps, VirtualDataTableOrderType, VirtualDataTableSortingProps, } from "./types";
@@ -0,0 +1,284 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsxs as _jsxs, Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
13
+ import { useMemo, forwardRef, useCallback, cloneElement, useImperativeHandle, } from "react";
14
+ import { TableVirtuoso } from "react-virtuoso";
15
+ import Table from "@mui/material/Table";
16
+ import TableRow from "@mui/material/TableRow";
17
+ import TableBody from "@mui/material/TableBody";
18
+ import TableCell from "@mui/material/TableCell";
19
+ import TableHead from "@mui/material/TableHead";
20
+ import TableFooter from "@mui/material/TableFooter";
21
+ import TableContainer from "@mui/material/TableContainer";
22
+ import Typography from "@mui/material/Typography";
23
+ import useInteractions from "./useInteractions";
24
+ var VirtualDataTable = function (props, ref) {
25
+ var rows = props.rows, columns = props.columns, dense = props.dense, height = props.height, _a = props.noDataText, noDataText = _a === void 0 ? "No Data" : _a, headerBgColor = props.headerBgColor, headerTextColor = props.headerTextColor, footerBgColor = props.footerBgColor, footerTextColor = props.footerTextColor, sortingDisabled = props.sortingDisabled, options = props.options;
26
+ var _b = useInteractions({ rows: rows, columns: columns }), normalCols = _b.normalCols, pinnedLeftCols = _b.pinnedLeftCols, pinnedRightCols = _b.pinnedRightCols, leftShadowVisible = _b.leftShadowVisible, rightShadowVisible = _b.rightShadowVisible, onScroll = _b.onScroll, handleSort = _b.handleSort, onResetSorting = _b.onResetSorting, renderSortingSymbol = _b.renderSortingSymbol;
27
+ useImperativeHandle(ref, function () { return ({
28
+ onResetSorting: onResetSorting,
29
+ }); }, [onResetSorting]);
30
+ var fixedHeaderContent = useCallback(function () {
31
+ return (_jsxs(TableRow, __assign({ sx: {
32
+ backgroundColor: "".concat(headerBgColor || "#eaf0f6", " !important"),
33
+ color: "".concat(headerTextColor || "inherit", " !important"),
34
+ width: "100%F",
35
+ } }, { children: [pinnedLeftCols.map(function (column, index) {
36
+ var align = column.align, width = column.width, Header = column.Header, accessor = column.accessor, headerTip = column.headerTip, sortable = column.sortable;
37
+ var canSortBy = sortable && !sortingDisabled;
38
+ var left = pinnedLeftCols
39
+ .slice(0, index)
40
+ .reduce(function (w, t) { return w + (t.width || 0); }, 0);
41
+ return (_jsxs(TableCell, __assign({ variant: "head", title: headerTip, align: align, onClick: function () {
42
+ if (canSortBy) {
43
+ handleSort({ accessor: accessor });
44
+ }
45
+ }, sx: {
46
+ position: "sticky",
47
+ left: left,
48
+ width: width,
49
+ cursor: sortable ? "pointer" : "default",
50
+ backgroundColor: "".concat(headerBgColor || "#eaf0f6", " !important"),
51
+ color: "".concat(headerTextColor || "inherit", " !important"),
52
+ "&::after": index === pinnedLeftCols.length - 1 && leftShadowVisible
53
+ ? {
54
+ position: "absolute",
55
+ top: 0,
56
+ right: 0,
57
+ bottom: "-1px",
58
+ width: "20px",
59
+ transform: "translateX(100%)",
60
+ transition: "box-shadow .3s",
61
+ content: "''",
62
+ boxShadow: "inset 10px 0 10px -8px rgba(0, 0, 0, 0.1)",
63
+ }
64
+ : undefined,
65
+ } }, { children: [cloneElement(Header, { column: column, rows: rows, options: options }), canSortBy && renderSortingSymbol(accessor)] }), accessor));
66
+ }), normalCols.map(function (column) {
67
+ var align = column.align, width = column.width, Header = column.Header, accessor = column.accessor, headerTip = column.headerTip, sortable = column.sortable;
68
+ var canSortBy = sortable && !sortingDisabled;
69
+ return (_jsxs(TableCell, __assign({ variant: "head", title: headerTip, align: align, onClick: function () {
70
+ if (canSortBy) {
71
+ handleSort({ accessor: accessor });
72
+ }
73
+ }, sx: {
74
+ width: width,
75
+ cursor: sortable ? "pointer" : "default",
76
+ backgroundColor: "".concat(headerBgColor || "#eaf0f6", " !important"),
77
+ color: "".concat(headerTextColor || "inherit", " !important"),
78
+ } }, { children: [cloneElement(Header, { column: column, rows: rows, options: options }), canSortBy && renderSortingSymbol(accessor)] }), accessor));
79
+ }), pinnedRightCols.map(function (column, index) {
80
+ var align = column.align, width = column.width, Header = column.Header, accessor = column.accessor, headerTip = column.headerTip, sortable = column.sortable;
81
+ var canSortBy = sortable && !sortingDisabled;
82
+ var right = pinnedRightCols
83
+ .slice(0, pinnedRightCols.length - 1 - index)
84
+ .reduce(function (w, t) { return w + (t.width || 0); }, 0);
85
+ return (_jsxs(TableCell, __assign({ variant: "head", title: headerTip, align: align, onClick: function () {
86
+ if (canSortBy) {
87
+ handleSort({ accessor: accessor });
88
+ }
89
+ }, sx: {
90
+ position: "sticky",
91
+ right: right,
92
+ width: width,
93
+ cursor: sortable ? "pointer" : "default",
94
+ backgroundColor: "".concat(headerBgColor || "#eaf0f6", " !important"),
95
+ color: "".concat(headerTextColor || "inherit", " !important"),
96
+ "&::after": index === 0 && rightShadowVisible
97
+ ? {
98
+ position: "absolute",
99
+ top: 0,
100
+ left: 0,
101
+ bottom: "-1px",
102
+ width: "20px",
103
+ transform: "translateX(-100%)",
104
+ transition: "box-shadow .3s",
105
+ content: "''",
106
+ boxShadow: "inset -10px 0 10px -8px rgba(0, 0, 0, 0.1)",
107
+ }
108
+ : undefined,
109
+ } }, { children: [cloneElement(Header, { column: column, rows: rows, options: options }), canSortBy && renderSortingSymbol(accessor)] }), accessor));
110
+ })] })));
111
+ }, [
112
+ normalCols,
113
+ pinnedLeftCols,
114
+ pinnedRightCols,
115
+ headerBgColor,
116
+ sortingDisabled,
117
+ headerTextColor,
118
+ leftShadowVisible,
119
+ rightShadowVisible,
120
+ handleSort,
121
+ renderSortingSymbol,
122
+ ]);
123
+ var fixedFooterContent = useCallback(function () {
124
+ return (_jsxs(TableRow, __assign({ sx: {
125
+ backgroundColor: "".concat(footerBgColor || "#eaf0f6", " !important"),
126
+ color: "".concat(footerTextColor || "inherit", " !important"),
127
+ width: "100%F",
128
+ } }, { children: [pinnedLeftCols.map(function (column, index) {
129
+ var align = column.align, width = column.width, Footer = column.Footer, accessor = column.accessor;
130
+ var left = pinnedLeftCols
131
+ .slice(0, index)
132
+ .reduce(function (w, t) { return w + (t.width || 0); }, 0);
133
+ return (_jsx(TableCell, __assign({ variant: "footer", align: align, sx: {
134
+ position: "sticky",
135
+ left: left,
136
+ width: width,
137
+ backgroundColor: "".concat(footerBgColor || "#eaf0f6", " !important"),
138
+ color: "".concat(footerTextColor || "inherit", " !important"),
139
+ "&::after": index === pinnedLeftCols.length - 1 && leftShadowVisible
140
+ ? {
141
+ position: "absolute",
142
+ top: 0,
143
+ right: 0,
144
+ bottom: "-1px",
145
+ width: "20px",
146
+ transform: "translateX(100%)",
147
+ transition: "box-shadow .3s",
148
+ content: "''",
149
+ boxShadow: "inset 10px 0 10px -8px rgba(0, 0, 0, 0.1)",
150
+ }
151
+ : undefined,
152
+ } }, { children: Footer ? cloneElement(Footer, { column: column, rows: rows, options: options }) : _jsx(_Fragment, {}) }), accessor));
153
+ }), normalCols.map(function (column) {
154
+ var align = column.align, width = column.width, Footer = column.Footer, accessor = column.accessor;
155
+ return (_jsx(TableCell, __assign({ variant: "footer", align: align, sx: {
156
+ width: width,
157
+ backgroundColor: "".concat(footerBgColor || "#eaf0f6", " !important"),
158
+ color: "".concat(footerTextColor || "inherit", " !important"),
159
+ } }, { children: Footer ? cloneElement(Footer, { column: column, rows: rows, options: options }) : _jsx(_Fragment, {}) }), accessor));
160
+ }), pinnedRightCols.map(function (column, index) {
161
+ var align = column.align, width = column.width, Footer = column.Footer, accessor = column.accessor;
162
+ var right = pinnedRightCols
163
+ .slice(0, pinnedRightCols.length - 1 - index)
164
+ .reduce(function (w, t) { return w + (t.width || 0); }, 0);
165
+ return (_jsx(TableCell, __assign({ variant: "footer", align: align, sx: {
166
+ position: "sticky",
167
+ right: right,
168
+ width: width,
169
+ backgroundColor: "".concat(footerBgColor || "#eaf0f6", " !important"),
170
+ color: "".concat(footerTextColor || "inherit", " !important"),
171
+ "&::after": index === 0 && rightShadowVisible
172
+ ? {
173
+ position: "absolute",
174
+ top: 0,
175
+ left: 0,
176
+ bottom: "-1px",
177
+ width: "20px",
178
+ transform: "translateX(-100%)",
179
+ transition: "box-shadow .3s",
180
+ content: "''",
181
+ boxShadow: "inset -10px 0 10px -8px rgba(0, 0, 0, 0.1)",
182
+ }
183
+ : undefined,
184
+ } }, { children: Footer ? cloneElement(Footer, { column: column, rows: rows, options: options }) : _jsx(_Fragment, {}) }), accessor));
185
+ })] })));
186
+ }, [
187
+ normalCols,
188
+ pinnedLeftCols,
189
+ pinnedRightCols,
190
+ footerBgColor,
191
+ footerTextColor,
192
+ leftShadowVisible,
193
+ rightShadowVisible,
194
+ ]);
195
+ var itemContent = useCallback(function (rowIndex, row) {
196
+ return (_jsxs(_Fragment, { children: [pinnedLeftCols.map(function (column, index) {
197
+ var align = column.align, width = column.width, Body = column.Body, accessor = column.accessor;
198
+ var left = pinnedLeftCols
199
+ .slice(0, index)
200
+ .reduce(function (w, t) { return w + (t.width || 0); }, 0);
201
+ return (_jsx(TableCell, __assign({ variant: "footer", align: align, sx: {
202
+ position: "sticky",
203
+ left: left,
204
+ zIndex: 1,
205
+ width: width,
206
+ backgroundColor: "background.paper",
207
+ "&::after": index === pinnedLeftCols.length - 1 && leftShadowVisible
208
+ ? {
209
+ position: "absolute",
210
+ top: 0,
211
+ right: 0,
212
+ bottom: "-1px",
213
+ width: "20px",
214
+ transform: "translateX(100%)",
215
+ transition: "box-shadow .3s",
216
+ content: "''",
217
+ boxShadow: "inset 10px 0 10px -8px rgba(0, 0, 0, 0.1)",
218
+ }
219
+ : undefined,
220
+ } }, { children: cloneElement(Body, { column: column, row: row, rows: rows, rowIndex: rowIndex, options: options }) }), accessor));
221
+ }), normalCols.map(function (column) {
222
+ var align = column.align, width = column.width, Body = column.Body, accessor = column.accessor;
223
+ return (_jsx(TableCell, __assign({ variant: "footer", align: align, sx: {
224
+ width: width,
225
+ backgroundColor: "background.paper",
226
+ } }, { children: cloneElement(Body, { column: column, row: row, rows: rows, rowIndex: rowIndex, options: options }) }), accessor));
227
+ }), pinnedRightCols.map(function (column, index) {
228
+ var align = column.align, width = column.width, Body = column.Body, accessor = column.accessor;
229
+ var right = pinnedRightCols
230
+ .slice(0, pinnedRightCols.length - 1 - index)
231
+ .reduce(function (w, t) { return w + (t.width || 0); }, 0);
232
+ return (_jsx(TableCell, __assign({ variant: "footer", align: align, sx: {
233
+ position: "sticky",
234
+ right: right,
235
+ zIndex: 1,
236
+ width: width,
237
+ backgroundColor: "background.paper",
238
+ "&::after": index === 0 && rightShadowVisible
239
+ ? {
240
+ position: "absolute",
241
+ top: 0,
242
+ left: 0,
243
+ bottom: "-1px",
244
+ width: "20px",
245
+ transform: "translateX(-100%)",
246
+ transition: "box-shadow .3s",
247
+ content: "''",
248
+ boxShadow: "inset -10px 0 10px -8px rgba(0, 0, 0, 0.1)",
249
+ }
250
+ : undefined,
251
+ } }, { children: cloneElement(Body, { column: column, row: row, rows: rows, rowIndex: rowIndex, options: options }) }), accessor));
252
+ })] }));
253
+ }, [
254
+ rows,
255
+ normalCols,
256
+ pinnedLeftCols,
257
+ pinnedRightCols,
258
+ leftShadowVisible,
259
+ rightShadowVisible,
260
+ ]);
261
+ var VirtuosoTableComponents = useMemo(function () { return ({
262
+ EmptyPlaceholder: function () { return (_jsx(TableRow, { children: _jsx(TableCell, __assign({ colSpan: columns.length }, { children: _jsx(Typography, __assign({ align: "center", variant: "body1", fontSize: 14, fontWeight: 600 }, { children: noDataText })) })) })); },
263
+ Scroller: forwardRef(function (props, ref) { return (_jsx(TableContainer, __assign({}, props, { ref: ref, sx: {
264
+ maxHeight: "inherit",
265
+ borderWidth: "thin",
266
+ borderColor: "#e5e5e5",
267
+ borderStyle: "solid",
268
+ borderRadius: "4px",
269
+ borderCollapse: "unset !important",
270
+ transition: "all 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms",
271
+ } }))); }),
272
+ Table: function (props) { return (_jsx(Table, __assign({}, props, { size: dense ? "small" : "medium", sx: {
273
+ borderCollapse: "separate",
274
+ minWidth: 600,
275
+ tableLayout: "fixed",
276
+ } }))); },
277
+ TableHead: forwardRef(function (props, ref) { return (_jsx(TableHead, __assign({}, props, { ref: ref }))); }),
278
+ TableRow: TableRow,
279
+ TableBody: forwardRef(function (props, ref) { return (_jsx(TableBody, __assign({}, props, { ref: ref }))); }),
280
+ TableFoot: forwardRef(function (props, ref) { return (_jsx(TableFooter, __assign({}, props, { ref: ref }))); }),
281
+ }); }, []);
282
+ return (_jsx(TableVirtuoso, { data: rows, style: { height: height }, onResize: onScroll, onScroll: onScroll, components: VirtuosoTableComponents, fixedHeaderContent: fixedHeaderContent, fixedFooterContent: fixedFooterContent, itemContent: itemContent, followOutput: "smooth", increaseViewportBy: 5 }));
283
+ };
284
+ export default forwardRef(VirtualDataTable);
@@ -0,0 +1,54 @@
1
+ import type { ReactElement, CSSProperties, MouseEvent } from "react";
2
+ declare type HexColor = `#${string}`;
3
+ declare type CustomVirtualTableRowBgColor = {
4
+ normal?: HexColor;
5
+ hover?: HexColor;
6
+ };
7
+ export declare type VirtualDataTableOrderType = "ASC" | "DESC" | "NONE";
8
+ export declare type VirtualDataTableSortingProps = {
9
+ accessor: string;
10
+ order: VirtualDataTableOrderType;
11
+ };
12
+ declare type InitialVirtualDataTableStateProps = {
13
+ sortBy?: VirtualDataTableSortingProps;
14
+ };
15
+ export declare type TVirtualTableRow = Record<string, any>;
16
+ export declare type TVirtualTableOptions = Record<string, any>;
17
+ export declare type TVirtualTableColumn = {
18
+ headerTip?: string;
19
+ Header: ReactElement;
20
+ Body: ReactElement;
21
+ Footer?: ReactElement;
22
+ align?: "left" | "center" | "right";
23
+ accessor: string;
24
+ sortable?: boolean;
25
+ fixable?: "left" | "right";
26
+ width: number;
27
+ };
28
+ export interface InteractionProps<RowProps extends TVirtualTableRow> {
29
+ rows: Array<RowProps>;
30
+ columns: Array<TVirtualTableColumn>;
31
+ initialState?: InitialVirtualDataTableStateProps;
32
+ sortingDisabled?: boolean;
33
+ onSort?: (props: VirtualDataTableSortingProps) => unknown;
34
+ }
35
+ export interface VirtualTableProps<RowProps extends TVirtualTableRow, OptionProps extends TVirtualTableOptions> extends InteractionProps<RowProps> {
36
+ dense?: boolean;
37
+ height: number;
38
+ headerBgColor?: CSSProperties["color"];
39
+ headerTextColor?: CSSProperties["color"];
40
+ footerBgColor?: CSSProperties["color"];
41
+ footerTextColor?: CSSProperties["color"];
42
+ noDataText?: string;
43
+ onRowClick?: (row: RowProps) => unknown;
44
+ onContextMenu?: (event: MouseEvent<HTMLTableRowElement>, row: RowProps) => unknown;
45
+ onCustomizeRowBgColor?: ({ row, columns, }: {
46
+ row: RowProps;
47
+ columns: TVirtualTableColumn;
48
+ }) => CustomVirtualTableRowBgColor;
49
+ options?: OptionProps;
50
+ }
51
+ export declare type VirtualDataTableRefProps = {
52
+ onResetSorting: () => void;
53
+ };
54
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ import { UIEventHandler } from "react";
2
+ import type { InteractionProps, TVirtualTableRow, TVirtualTableColumn, VirtualDataTableSortingProps } from "./types";
3
+ declare function useInteractions<RowProps extends TVirtualTableRow>(props: InteractionProps<RowProps>): {
4
+ normalCols: TVirtualTableColumn[];
5
+ pinnedLeftCols: TVirtualTableColumn[];
6
+ pinnedRightCols: TVirtualTableColumn[];
7
+ leftShadowVisible: boolean;
8
+ rightShadowVisible: boolean;
9
+ onScroll: UIEventHandler<HTMLDivElement>;
10
+ handleSort: ({ accessor }: Pick<VirtualDataTableSortingProps, "accessor">) => void;
11
+ onResetSorting: () => void;
12
+ renderSortingSymbol: (accessor: string) => "" | "↑" | "↓";
13
+ };
14
+ export default useInteractions;
@@ -0,0 +1,99 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { useMemo, useState, useCallback } from "react";
13
+ import useMediaQuery from "@mui/material/useMediaQuery";
14
+ import useTheme from "@mui/material/styles/useTheme";
15
+ function useInteractions(props) {
16
+ var rows = props.rows, columns = props.columns, sortingDisabled = props.sortingDisabled, initialState = props.initialState, onSort = props.onSort;
17
+ var theme = useTheme();
18
+ var isUpMd = useMediaQuery(theme.breakpoints.up("md"));
19
+ var _a = useState(false), leftShadowVisible = _a[0], setLeftShadowVisible = _a[1];
20
+ var _b = useState(columns.filter(function (c) { return c.fixable === "right"; }).length > 0 || false), rightShadowVisible = _b[0], setRightShadowVisible = _b[1];
21
+ var initialSortingProps = useMemo(function () {
22
+ var sortBy = (initialState || {}).sortBy;
23
+ var _a = sortBy || {}, accessor = _a.accessor, order = _a.order;
24
+ return {
25
+ accessor: accessor || "",
26
+ order: !!accessor ? order || "NONE" : "NONE",
27
+ };
28
+ }, [initialState]);
29
+ var _c = useState(initialSortingProps), sortingProps = _c[0], setSortingProps = _c[1];
30
+ var handleSort = useCallback(function (_a) {
31
+ var accessor = _a.accessor;
32
+ if (!sortingDisabled) {
33
+ var newSortingProps = __assign({}, sortingProps);
34
+ if (accessor !== sortingProps.accessor ||
35
+ sortingProps.order === "NONE") {
36
+ newSortingProps = { accessor: accessor, order: "ASC" };
37
+ }
38
+ else if (sortingProps.order === "ASC") {
39
+ newSortingProps = __assign(__assign({}, sortingProps), { order: "DESC" });
40
+ }
41
+ else {
42
+ newSortingProps = __assign(__assign({}, sortingProps), { order: "NONE" });
43
+ }
44
+ if (onSort) {
45
+ onSort(__assign({}, newSortingProps));
46
+ }
47
+ setSortingProps(__assign({}, newSortingProps));
48
+ }
49
+ }, [sortingDisabled, onSort, sortingProps]);
50
+ var onResetSorting = useCallback(function () {
51
+ if (onSort) {
52
+ onSort(__assign({}, initialSortingProps));
53
+ }
54
+ setSortingProps(__assign({}, initialSortingProps));
55
+ }, [initialSortingProps, onSort]);
56
+ var renderSortingSymbol = useCallback(function (accessor) {
57
+ var field = sortingProps.accessor, order = sortingProps.order;
58
+ if (accessor !== field || order === "NONE") {
59
+ return "";
60
+ }
61
+ if (order === "ASC") {
62
+ return "↑";
63
+ }
64
+ return "↓";
65
+ }, [sortingProps]);
66
+ var onScroll = useCallback(function (event) {
67
+ var target = event.currentTarget;
68
+ var scrollLeft = target.scrollLeft;
69
+ var scrollWidth = target.scrollWidth;
70
+ var clientWidth = target.clientWidth;
71
+ var hasScrollBar = scrollWidth > clientWidth;
72
+ setLeftShadowVisible(hasScrollBar && scrollLeft > 0);
73
+ setRightShadowVisible(hasScrollBar && scrollWidth - scrollLeft > clientWidth + 1);
74
+ }, []);
75
+ var _d = useMemo(function () {
76
+ var hasData = rows.length > 0;
77
+ if (isUpMd && hasData) {
78
+ var left = columns.filter(function (c) { return c.fixable === "left"; });
79
+ var right = columns.filter(function (c) { return c.fixable === "right"; });
80
+ var dynamic = columns.filter(function (c) { return !c.fixable; });
81
+ return [left, dynamic, right];
82
+ }
83
+ else {
84
+ return [[], columns, []];
85
+ }
86
+ }, [isUpMd, rows, columns]), pinnedLeftCols = _d[0], normalCols = _d[1], pinnedRightCols = _d[2];
87
+ return {
88
+ normalCols: normalCols,
89
+ pinnedLeftCols: pinnedLeftCols,
90
+ pinnedRightCols: pinnedRightCols,
91
+ leftShadowVisible: leftShadowVisible,
92
+ rightShadowVisible: rightShadowVisible,
93
+ onScroll: onScroll,
94
+ handleSort: handleSort,
95
+ onResetSorting: onResetSorting,
96
+ renderSortingSymbol: renderSortingSymbol,
97
+ };
98
+ }
99
+ export default useInteractions;
@@ -18,7 +18,6 @@ import useTheme from "@mui/material/styles/useTheme";
18
18
  import { useGridVirtualizer } from "../GridVirtualizerContext";
19
19
  function VirtualGridBodyRow(props) {
20
20
  var rows = props.rows, columns = props.columns, rowIndex = props.rowIndex, virtualRow = props.virtualRow, onRowClick = props.onRowClick, onContextMenu = props.onContextMenu, onCustomizeRowBgColor = props.onCustomizeRowBgColor;
21
- console.log({ virtualRow: virtualRow });
22
21
  var theme = useTheme();
23
22
  var isUpMd = useMediaQuery(theme.breakpoints.up("md"));
24
23
  var _a = useGridVirtualizer(), leftShadowVisible = _a.leftShadowVisible, rightShadowVisible = _a.rightShadowVisible, onMeasureElement = _a.onMeasureElement;
@@ -79,8 +79,6 @@ export declare type VirtualGridFooterProps<RowProps extends Record<string, any>,
79
79
  };
80
80
  export declare type VirtualGridCoreProps<RowProps extends Record<string, any>, ExtendedProps extends Record<string, any>> = Omit<VirtualGridHeaderProps<RowProps, ExtendedProps>, "noData"> & VirtualGridBodyProps<RowProps, ExtendedProps> & Omit<VirtualGridFooterProps<RowProps, ExtendedProps>, "noData"> & {
81
81
  dense?: boolean;
82
- primaryColor?: CSSProperties["color"];
83
- secondaryColor?: CSSProperties["color"];
84
82
  };
85
83
  export declare type VirtualGridProps<RowProps extends Record<string, any>, ExtendedProps extends Record<string, any>> = VirtualGridCoreProps<RowProps, ExtendedProps> & {
86
84
  estimateRowHeight?: number;
package/index.d.ts CHANGED
@@ -29,6 +29,7 @@ export * from "./TablePagination";
29
29
  export * from "./TextInput";
30
30
  export * from "./ToastPrompt";
31
31
  export * from "./VideoPlayerModal";
32
+ export * from "./VirtualDataTable";
32
33
  export * from "./VirtualGrid";
33
34
  export { default as AlertDialog } from "./AlertDialog";
34
35
  export { default as Autocomplete } from "./Autocomplete";
@@ -58,4 +59,5 @@ export { default as TabGroup } from "./TabGroup";
58
59
  export { default as TablePagination } from "./TablePagination";
59
60
  export { default as TextInput } from "./TextInput";
60
61
  export { default as VideoPlayerModal } from "./VideoPlayerModal";
62
+ export { default as VirtualDataTable } from "./VirtualDataTable";
61
63
  export { default as VirtualGrid } from "./VirtualGrid";
package/index.js CHANGED
@@ -29,6 +29,7 @@ export * from "./TablePagination";
29
29
  export * from "./TextInput";
30
30
  export * from "./ToastPrompt";
31
31
  export * from "./VideoPlayerModal";
32
+ export * from "./VirtualDataTable";
32
33
  export * from "./VirtualGrid";
33
34
  export { default as AlertDialog } from "./AlertDialog";
34
35
  export { default as Autocomplete } from "./Autocomplete";
@@ -58,4 +59,5 @@ export { default as TabGroup } from "./TabGroup";
58
59
  export { default as TablePagination } from "./TablePagination";
59
60
  export { default as TextInput } from "./TextInput";
60
61
  export { default as VideoPlayerModal } from "./VideoPlayerModal";
62
+ export { default as VirtualDataTable } from "./VirtualDataTable";
61
63
  export { default as VirtualGrid } from "./VirtualGrid";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symply.io/basic-components",
3
- "version": "1.7.0-alpha.2",
3
+ "version": "1.7.0-alpha.4",
4
4
  "description": "Basic and reusable components for all frontend of Symply apps",
5
5
  "keywords": [
6
6
  "react",
@@ -60,6 +60,7 @@
60
60
  "color-alpha": "^1.1.3",
61
61
  "react-dropzone": "14.2.3",
62
62
  "react-player": "2.11.0",
63
+ "react-virtuoso": "^4.12.0",
63
64
  "rifm": "^0.12.1"
64
65
  },
65
66
  "resolutions": {