@monolith-forensics/monolith-ui 1.1.89 → 1.1.91

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.
Files changed (52) hide show
  1. package/dist/MonolithUIProvider/GlobalStyle.d.ts +1 -0
  2. package/dist/MonolithUIProvider/GlobalStyle.js +17 -0
  3. package/dist/NewTable/ActionButton.d.ts +4 -0
  4. package/dist/NewTable/ActionButton.js +11 -0
  5. package/dist/NewTable/ActionCell.d.ts +4 -0
  6. package/dist/NewTable/ActionCell.js +12 -0
  7. package/dist/NewTable/Column.d.ts +3 -0
  8. package/dist/NewTable/Column.js +5 -0
  9. package/dist/NewTable/ColumnResizer.d.ts +14 -0
  10. package/dist/NewTable/ColumnResizer.js +45 -0
  11. package/dist/NewTable/SelectionCell.d.ts +4 -0
  12. package/dist/NewTable/SelectionCell.js +12 -0
  13. package/dist/NewTable/StateStorage.d.ts +18 -0
  14. package/dist/NewTable/StateStorage.js +72 -0
  15. package/dist/NewTable/StaticRows.d.ts +5 -0
  16. package/dist/NewTable/StaticRows.js +10 -0
  17. package/dist/NewTable/Table.d.ts +3 -0
  18. package/dist/NewTable/Table.js +83 -0
  19. package/dist/NewTable/TableComponents.d.ts +16 -0
  20. package/dist/NewTable/TableComponents.js +139 -0
  21. package/dist/NewTable/TableDefaults.d.ts +20 -0
  22. package/dist/NewTable/TableDefaults.js +20 -0
  23. package/dist/NewTable/TableHeader.d.ts +3 -0
  24. package/dist/NewTable/TableHeader.js +92 -0
  25. package/dist/NewTable/TableProvider.d.ts +4 -0
  26. package/dist/NewTable/TableProvider.js +330 -0
  27. package/dist/NewTable/TableRow.d.ts +3 -0
  28. package/dist/NewTable/TableRow.js +27 -0
  29. package/dist/NewTable/Utils/index.d.ts +3 -0
  30. package/dist/NewTable/Utils/index.js +3 -0
  31. package/dist/NewTable/Utils/resizeHandler.d.ts +3 -0
  32. package/dist/NewTable/Utils/resizeHandler.js +84 -0
  33. package/dist/NewTable/Utils/resolveColumnReorder.d.ts +3 -0
  34. package/dist/NewTable/Utils/resolveColumnReorder.js +5 -0
  35. package/dist/NewTable/Utils/resolveColumnResize.d.ts +3 -0
  36. package/dist/NewTable/Utils/resolveColumnResize.js +5 -0
  37. package/dist/NewTable/Utils/syncColumnState.d.ts +3 -0
  38. package/dist/NewTable/Utils/syncColumnState.js +26 -0
  39. package/dist/NewTable/VirtualIzedRows.d.ts +12 -0
  40. package/dist/NewTable/VirtualIzedRows.js +26 -0
  41. package/dist/NewTable/enums.d.ts +6 -0
  42. package/dist/NewTable/enums.js +7 -0
  43. package/dist/NewTable/index.d.ts +4 -0
  44. package/dist/NewTable/index.js +4 -0
  45. package/dist/NewTable/types.d.ts +191 -0
  46. package/dist/NewTable/types.js +1 -0
  47. package/dist/NewTable/useTable.d.ts +3 -0
  48. package/dist/NewTable/useTable.js +10 -0
  49. package/dist/Table/Table.d.ts +2 -0
  50. package/dist/index.d.ts +2 -0
  51. package/dist/index.js +1 -0
  52. package/package.json +2 -1
@@ -1,3 +1,4 @@
1
+ import "overlayscrollbars/overlayscrollbars.css";
1
2
  declare const GlobalStyle: import("react").NamedExoticComponent<import("styled-components").ExecutionProps & {
2
3
  theme: any;
3
4
  }>;
@@ -1,4 +1,5 @@
1
1
  import { createGlobalStyle } from "styled-components";
2
+ import "overlayscrollbars/overlayscrollbars.css";
2
3
  const GlobalStyle = createGlobalStyle `
3
4
 
4
5
  * {
@@ -50,6 +51,22 @@ const GlobalStyle = createGlobalStyle `
50
51
  color: unset;
51
52
  }
52
53
 
54
+ // Custom OS scrollbar theme
55
+ .os-theme-dark {
56
+ --os-handle-bg: ${(props) => props.theme.scrollbar.thumb};
57
+ --os-handle-bg-active: ${(props) => props.theme.scrollbar.thumb};
58
+ }
59
+
60
+ .os-theme-light {
61
+ --os-handle-bg: #e4e4e4;
62
+ --os-handle-bg-hover: #c6c6c6;
63
+ --os-handle-bg-active: #c6c6c6;
64
+
65
+ &:hover {
66
+ --os-scrollbar-color: #c6c6c6;
67
+ }
68
+ }
69
+
53
70
  ::-webkit-scrollbar {
54
71
  width: 6px;
55
72
  height: 5px;
@@ -0,0 +1,4 @@
1
+ declare const ActionButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("../Button").ButtonProps & import("react").RefAttributes<HTMLButtonElement>, "ref"> & {
2
+ ref?: ((instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLButtonElement> | null | undefined;
3
+ }, never>> & string & Omit<import("react").ForwardRefExoticComponent<import("../Button").ButtonProps & import("react").RefAttributes<HTMLButtonElement>>, keyof import("react").Component<any, {}, any>>;
4
+ export default ActionButton;
@@ -0,0 +1,11 @@
1
+ import styled from "styled-components";
2
+ import Button from "../Button";
3
+ const ActionButton = styled(Button) `
4
+ padding: 2px;
5
+ height: fit-content;
6
+
7
+ svg {
8
+ color: ${({ theme }) => theme.palette.primary.main};
9
+ }
10
+ `;
11
+ export default ActionButton;
@@ -0,0 +1,4 @@
1
+ declare const ActionCell: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("./types").TDProps> & import("./types").TDProps, "ref"> & {
2
+ ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
3
+ }, never>> & string;
4
+ export default ActionCell;
@@ -0,0 +1,12 @@
1
+ import styled from "styled-components";
2
+ import { TD } from "./TableComponents";
3
+ const ActionCell = styled(TD) `
4
+ width: 40px;
5
+ min-width: 40px;
6
+ max-width: 40px;
7
+
8
+ display: flex;
9
+ justify-content: center;
10
+ align-items: center;
11
+ `;
12
+ export default ActionCell;
@@ -0,0 +1,3 @@
1
+ import { ColumnProps } from "./types";
2
+ declare const Column: React.FC<ColumnProps>;
3
+ export default Column;
@@ -0,0 +1,5 @@
1
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ const Column = () => {
3
+ return _jsx(_Fragment, {});
4
+ };
5
+ export default Column;
@@ -0,0 +1,14 @@
1
+ import { ColumnState, onResizeFinishedProps } from "./types";
2
+ declare const ColumnResizer: ({ onResize, onResizeFinished, column, showOnHover, }: {
3
+ className?: string;
4
+ onResize?: (e: {
5
+ columns: {
6
+ dataField: string;
7
+ width: number;
8
+ }[];
9
+ }) => void;
10
+ onResizeFinished?: (e: onResizeFinishedProps) => void;
11
+ column: ColumnState;
12
+ showOnHover?: boolean;
13
+ }) => import("react/jsx-runtime").JSX.Element;
14
+ export default ColumnResizer;
@@ -0,0 +1,45 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import styled from "styled-components";
3
+ import { resizeHandler } from "./Utils";
4
+ const StyledContainer = styled.div `
5
+ position: absolute;
6
+ right: -2px;
7
+ top: 0;
8
+ height: 100%;
9
+ z-index: 1;
10
+ width: 4px;
11
+ background-color: ${(props) => props.theme.palette.divider};
12
+ cursor: col-resize;
13
+ user-select: none;
14
+ touch-action: none;
15
+ opacity: 0;
16
+
17
+ &[data-show-on-hover="true"]:hover {
18
+ opacity: 1;
19
+ background: ${(props) => props.theme.palette.primary.main};
20
+ }
21
+
22
+ &.isResizing {
23
+ opacity: 1;
24
+ background: ${(props) => props.theme.palette.primary.main};
25
+ }
26
+ `;
27
+ const ColumnResizer = ({ onResize = () => { }, onResizeFinished, column, showOnHover = false, }) => {
28
+ return (_jsx(StyledContainer, { className: `resizer col-${column.columnId}`, "data-show-on-hover": showOnHover, onClick: (e) => {
29
+ e.stopPropagation();
30
+ e.nativeEvent.stopImmediatePropagation();
31
+ e.preventDefault();
32
+ }, onMouseDown: (e) => {
33
+ e.stopPropagation();
34
+ e.nativeEvent.stopImmediatePropagation();
35
+ e.preventDefault();
36
+ resizeHandler({
37
+ event: e,
38
+ columnId: column.columnId,
39
+ columnProps: column,
40
+ onResize: onResize,
41
+ onResizeFinished: onResizeFinished,
42
+ });
43
+ } }));
44
+ };
45
+ export default ColumnResizer;
@@ -0,0 +1,4 @@
1
+ declare const SelectionCell: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("./types").TDProps> & import("./types").TDProps, "ref"> & {
2
+ ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
3
+ }, never>> & string;
4
+ export default SelectionCell;
@@ -0,0 +1,12 @@
1
+ import styled from "styled-components";
2
+ import { TD } from "./TableComponents";
3
+ const SelectionCell = styled(TD) `
4
+ width: 40px;
5
+ min-width: 40px;
6
+ max-width: 40px;
7
+
8
+ display: flex;
9
+ justify-content: center;
10
+ align-items: center;
11
+ `;
12
+ export default SelectionCell;
@@ -0,0 +1,18 @@
1
+ import { ColumnState, SelectionState, SortState, TableState } from "./types";
2
+ type GetTableStateFn = (key: string) => TableState;
3
+ type GetColumnStateFn = (key: string) => ColumnState[];
4
+ type SetColumneStateFn = (key: string, value: ColumnState[]) => void;
5
+ type GetSelectionStateFn = (key: string) => SelectionState;
6
+ type SetSelectionStateFn = (key: string, value: any) => void;
7
+ type GetSortStateStateFn = (key: string) => SortState | null | undefined;
8
+ type SetSortStateFn = (key: string, value: SortState | undefined | null) => void;
9
+ declare const StateStorage: {
10
+ getTableState: GetTableStateFn;
11
+ getColumnState: GetColumnStateFn;
12
+ setColumnState: SetColumneStateFn;
13
+ getSelectionState: GetSelectionStateFn;
14
+ setSelectionState: SetSelectionStateFn;
15
+ getSortState: GetSortStateStateFn;
16
+ setSortState: SetSortStateFn;
17
+ };
18
+ export default StateStorage;
@@ -0,0 +1,72 @@
1
+ const get = (key, type) => {
2
+ const data = localStorage.getItem(key) || "";
3
+ if (type === "string") {
4
+ return data;
5
+ }
6
+ else {
7
+ try {
8
+ return JSON.parse(data);
9
+ }
10
+ catch (e) {
11
+ return {};
12
+ }
13
+ }
14
+ };
15
+ const set = (key, value) => {
16
+ if (typeof value === "object") {
17
+ localStorage.setItem(key, JSON.stringify(value));
18
+ }
19
+ else {
20
+ localStorage.setItem(key, value);
21
+ }
22
+ };
23
+ const del = (key) => {
24
+ localStorage.removeItem(key);
25
+ };
26
+ const getTableState = (key) => {
27
+ const data = get(key, "json");
28
+ return data;
29
+ };
30
+ const getColumnState = (key) => {
31
+ const data = getTableState(key);
32
+ return data.columnState;
33
+ };
34
+ const setColumnState = (key, value) => {
35
+ // get previous state
36
+ const previousState = getTableState(key);
37
+ // merge previous state with new state
38
+ const newState = Object.assign(Object.assign({}, previousState), { columnState: value });
39
+ set(key, newState);
40
+ };
41
+ const getSelectionState = (key) => {
42
+ const data = getTableState(key);
43
+ return data.selectionState;
44
+ };
45
+ const setSelectionState = (key, value) => {
46
+ // get previous state
47
+ const previousState = getTableState(key);
48
+ // merge previous state with new state
49
+ const newState = Object.assign(Object.assign({}, previousState), { selectionState: value });
50
+ set(key, newState);
51
+ };
52
+ const getSortState = (key) => {
53
+ const data = getTableState(key);
54
+ return data.sortState;
55
+ };
56
+ const setSortState = (key, value) => {
57
+ // get previous state
58
+ const previousState = getTableState(key);
59
+ // merge previous state with new state
60
+ const newState = Object.assign(Object.assign({}, previousState), { sortState: value });
61
+ set(key, newState);
62
+ };
63
+ const StateStorage = {
64
+ getTableState,
65
+ getColumnState,
66
+ setColumnState,
67
+ getSelectionState,
68
+ setSelectionState,
69
+ getSortState,
70
+ setSortState,
71
+ };
72
+ export default StateStorage;
@@ -0,0 +1,5 @@
1
+ declare const StaticRows: React.FC<{
2
+ targetElm: React.RefObject<HTMLDivElement>;
3
+ listElm: React.RefObject<HTMLDivElement>;
4
+ }>;
5
+ export default StaticRows;
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { TableListElement, TableViewPort, TBody } from "./TableComponents";
3
+ import TableRow from "./TableRow";
4
+ import useTable from "./useTable";
5
+ const StaticRows = ({ targetElm, listElm }) => {
6
+ var _a;
7
+ const { data } = useTable();
8
+ return (_jsx(TBody, { className: "mfui-tbody", children: _jsx(TableViewPort, { className: "mfui-tbody-viewport", ref: targetElm, children: _jsx(TableListElement, { className: "mfui-tbody-list", ref: listElm, children: (_a = data === null || data === void 0 ? void 0 : data.map) === null || _a === void 0 ? void 0 : _a.call(data, (row, index) => (_jsx(TableRow, { rowData: row }, index))) }) }) }));
9
+ };
10
+ export default StaticRows;
@@ -0,0 +1,3 @@
1
+ import { TableProps } from "./types";
2
+ declare const Table: React.FC<TableProps>;
3
+ export default Table;
@@ -0,0 +1,83 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
14
+ import Column from "./Column";
15
+ import { useOverlayScrollbars } from "overlayscrollbars-react";
16
+ import { StyledTable } from "./TableComponents";
17
+ import TableHeader from "./TableHeader";
18
+ import TableProvider from "./TableProvider";
19
+ import shortUUID from "short-uuid";
20
+ import VirtualizedRows from "./VirtualIzedRows";
21
+ import StaticRows from "./StaticRows";
22
+ const Table = (_a) => {
23
+ var { data, children } = _a, props = __rest(_a, ["data", "children"]) // pass through props straight to table context
24
+ ;
25
+ const tableElement = useRef(null);
26
+ const targetElm = useRef(null);
27
+ const listElm = useRef(null);
28
+ const headerRowElm = useRef(null);
29
+ // check if children is array and convert if not
30
+ if (!Array.isArray(children)) {
31
+ children = [children];
32
+ }
33
+ const [tableDimensions, setTableDimensions] = useState({
34
+ width: 0,
35
+ height: 0,
36
+ });
37
+ const handleOnScroll = (event) => {
38
+ // move header row horizontally with the scroll
39
+ const headerRow = headerRowElm.current;
40
+ if (headerRow) {
41
+ // shift position of header row
42
+ headerRow.style.transform = `translateX(-${event.target.scrollLeft}px)`; // move header row horizontally with the scroll
43
+ }
44
+ };
45
+ const [initialize, getInstance] = useOverlayScrollbars({
46
+ options: {
47
+ scrollbars: {
48
+ autoHide: "scroll",
49
+ autoHideDelay: 500,
50
+ },
51
+ },
52
+ events: { scroll: (_, event) => handleOnScroll(event) },
53
+ });
54
+ const getTableDimensions = () => {
55
+ if (tableElement.current) {
56
+ const { width, height } = tableElement.current.getBoundingClientRect();
57
+ setTableDimensions({ width, height });
58
+ }
59
+ };
60
+ useEffect(() => {
61
+ if (targetElm.current && listElm.current) {
62
+ initialize({
63
+ target: targetElm.current,
64
+ elements: {
65
+ viewport: listElm.current,
66
+ },
67
+ });
68
+ return () => { var _a; return (_a = getInstance()) === null || _a === void 0 ? void 0 : _a.destroy(); };
69
+ }
70
+ }, [targetElm, listElm, initialize, getInstance]);
71
+ useLayoutEffect(() => {
72
+ getTableDimensions();
73
+ window.addEventListener("resize", getTableDimensions);
74
+ return () => {
75
+ window.removeEventListener("resize", getTableDimensions);
76
+ };
77
+ }, []);
78
+ const __data = useMemo(() => data === null || data === void 0 ? void 0 : data.map((d, i) => (Object.assign(Object.assign({}, d), { __key: shortUUID.generate(), __index: i }))), [data]);
79
+ return (_jsx(TableProvider, Object.assign({ columns: children
80
+ .filter((child) => child.type === Column)
81
+ .map((child) => child.props), data: __data }, props, { children: _jsxs(StyledTable, { className: "mfui-table", ref: tableElement, children: [_jsx(TableHeader, { headerRowElm: headerRowElm }), props.virtualized === true ? (_jsx(VirtualizedRows, { tableDimensions: tableDimensions, targetElm: targetElm, listElm: listElm, rowHeight: props.rowHeight, headerRowHeight: props.headerRowHeight, compact: props.compact })) : (_jsx(StaticRows, { targetElm: targetElm, listElm: listElm }))] }) })));
82
+ };
83
+ export default Table;
@@ -0,0 +1,16 @@
1
+ import { TDProps, TRProps } from "./types";
2
+ export declare const THead: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
3
+ export declare const TBody: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
4
+ export declare const TR: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, TRProps>> & string;
5
+ export declare const THR: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof TRProps> & TRProps, "ref"> & {
6
+ ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
7
+ }, never>> & string;
8
+ export declare const TD: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, TDProps>> & string;
9
+ export declare const TH: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof TDProps> & TDProps, "ref"> & {
10
+ ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
11
+ }, never>> & string;
12
+ export declare const InnerCellContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
13
+ export declare const TableViewPort: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
14
+ export declare const TableListElement: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
15
+ export declare const TableWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
16
+ export declare const StyledTable: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
@@ -0,0 +1,139 @@
1
+ import styled from "styled-components";
2
+ import TableDefaults from "./TableDefaults";
3
+ export const THead = styled.div ``;
4
+ export const TBody = styled.div `
5
+ display: flex;
6
+ flex-direction: column;
7
+ flex: 1;
8
+ overflow: hidden;
9
+ `;
10
+ export const TR = styled.div `
11
+ display: flex;
12
+ flex-direction: row;
13
+
14
+ flex: 1;
15
+
16
+ height: ${({ compact, height }) => {
17
+ const customHeight = height ? height + "px" : undefined;
18
+ return compact
19
+ ? `${TableDefaults.row.height.compact}px`
20
+ : customHeight || `${TableDefaults.row.height.normal}px`;
21
+ }};
22
+
23
+ border-left: 1px solid ${({ theme }) => theme.palette.divider};
24
+ border-right: 1px solid ${({ theme }) => theme.palette.divider};
25
+
26
+ // Get last row element and remove border bottom
27
+ // This is to prevent double border bottom on last row
28
+ // &.mfui-tr:last-child .mfui-td {
29
+ // border-bottom: none;
30
+ // }
31
+
32
+ &:hover > .mfui-td {
33
+ background-color: ${({ theme }) => theme.palette.action.hover};
34
+ }
35
+ `;
36
+ export const THR = styled(TR) `
37
+ height: ${({ compact, height }) => {
38
+ const customHeight = height ? height + "px" : undefined;
39
+ return compact
40
+ ? `${TableDefaults.row.height.compact}px`
41
+ : customHeight || `${TableDefaults.row.height.normal}px`;
42
+ }};
43
+
44
+ &:hover {
45
+ background-color: transparent;
46
+ }
47
+ `;
48
+ export const TD = styled.div `
49
+ position: relative;
50
+ display: flex;
51
+ flex-direction: row;
52
+ align-items: center;
53
+ flex: 1;
54
+
55
+ padding: ${({ compact }) => compact
56
+ ? `${TableDefaults.td.padding.compact}px`
57
+ : `${TableDefaults.td.padding.normal}px`};
58
+ font-size: ${({ compact }) => compact
59
+ ? `${TableDefaults.td.fontSize.compact}px`
60
+ : `${TableDefaults.td.fontSize.normal}px`};
61
+
62
+ min-width: ${TableDefaults.td.minWidth}px;
63
+
64
+ &:last-child {
65
+ flex: 1 !important; // ensure last column takes up remaining space
66
+ }
67
+
68
+ background-color: ${({ theme }) => theme.palette.background.default};
69
+
70
+ border-bottom: 1px solid ${({ theme }) => theme.palette.divider};
71
+ `;
72
+ export const TH = styled(TD) `
73
+ user-select: none;
74
+ text-align: left;
75
+ font-weight: bold;
76
+
77
+ background-color: ${({ theme }) => theme.palette.background.alt};
78
+
79
+ border-top: 1px solid ${({ theme }) => theme.palette.divider};
80
+ border-bottom: 1px solid ${({ theme }) => theme.palette.divider};
81
+
82
+ .inner-cell-content {
83
+ display: flex;
84
+ flex-direction: row;
85
+ align-items: center;
86
+ gap: 5px;
87
+ }
88
+
89
+ &.dragover {
90
+ background-color: ${({ theme }) => theme.palette.primary.main}50;
91
+ }
92
+
93
+ // disable pointer events on children when dragging
94
+ &.dragover > * {
95
+ pointer-events: none;
96
+ }
97
+
98
+ &:hover {
99
+ background-color: ${({ theme }) => theme.palette.action.hover};
100
+ }
101
+ `;
102
+ export const InnerCellContent = styled.div `
103
+ max-width: 100%;
104
+
105
+ white-space: nowrap;
106
+ overflow: hidden;
107
+ text-overflow: ellipsis;
108
+ `;
109
+ export const TableViewPort = styled.div `
110
+ display: flex;
111
+ flex-direction: column;
112
+ `;
113
+ export const TableListElement = styled.div `
114
+ display: flex;
115
+ flex-direction: column;
116
+ `;
117
+ export const TableWrapper = styled.div `
118
+ position: relative;
119
+ flex: 1 1 auto;
120
+ overflow: hidden;
121
+ display: flex;
122
+ flex-direction: column;
123
+ `;
124
+ export const StyledTable = styled.div `
125
+ position: relative;
126
+ flex: 1 1 auto;
127
+ overflow: hidden;
128
+ display: flex;
129
+ flex-direction: column;
130
+
131
+ // border-left: 1px solid ${({ theme }) => theme.palette.divider};
132
+ // border-right: 1px solid ${({ theme }) => theme.palette.divider};
133
+ // border-bottom: 1px solid ${({ theme }) => theme.palette.divider};
134
+
135
+ .os-scrollbar {
136
+ pointer-events: auto;
137
+ visibility: visible;
138
+ }
139
+ `;
@@ -0,0 +1,20 @@
1
+ declare const TableDefaults: {
2
+ row: {
3
+ height: {
4
+ compact: number;
5
+ normal: number;
6
+ };
7
+ };
8
+ td: {
9
+ minWidth: number;
10
+ padding: {
11
+ compact: number;
12
+ normal: number;
13
+ };
14
+ fontSize: {
15
+ compact: number;
16
+ normal: number;
17
+ };
18
+ };
19
+ };
20
+ export default TableDefaults;
@@ -0,0 +1,20 @@
1
+ const TableDefaults = {
2
+ row: {
3
+ height: {
4
+ compact: 28,
5
+ normal: 38,
6
+ },
7
+ },
8
+ td: {
9
+ minWidth: 100,
10
+ padding: {
11
+ compact: 3,
12
+ normal: 8,
13
+ },
14
+ fontSize: {
15
+ compact: 10,
16
+ normal: 12,
17
+ },
18
+ },
19
+ };
20
+ export default TableDefaults;
@@ -0,0 +1,3 @@
1
+ import { TableHeaderProps } from "./types";
2
+ declare const TableHeader: React.FC<TableHeaderProps>;
3
+ export default TableHeader;