@monolith-forensics/monolith-ui 1.9.3-dev.0 → 1.9.3-dev.2
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/Charts/BarChart/BarChart.js +28 -14
- package/dist/Charts/BarChart/BarChart.styled.d.ts +7 -2
- package/dist/Charts/BarChart/BarChart.styled.js +5 -1
- package/dist/Charts/BarChart/BarChart.types.d.ts +13 -5
- package/dist/Charts/ChartUtils/chartSizing.d.ts +20 -0
- package/dist/Charts/ChartUtils/chartSizing.js +83 -0
- package/dist/Charts/ChartUtils/index.d.ts +1 -0
- package/dist/Charts/ChartUtils/index.js +1 -0
- package/dist/Charts/HeatMap/HeatMap.js +28 -7
- package/dist/Charts/HeatMap/HeatMap.styled.d.ts +6 -2
- package/dist/Charts/HeatMap/HeatMap.styled.js +3 -0
- package/dist/Charts/HeatMap/HeatMap.types.d.ts +7 -1
- package/dist/Charts/LineChart/LineChart.js +34 -15
- package/dist/Charts/LineChart/LineChart.styled.d.ts +7 -2
- package/dist/Charts/LineChart/LineChart.styled.js +5 -1
- package/dist/Charts/LineChart/LineChart.types.d.ts +13 -5
- package/dist/Charts/PieChart/PieChart.js +48 -33
- package/dist/Charts/PieChart/PieChart.styled.d.ts +7 -2
- package/dist/Charts/PieChart/PieChart.styled.js +6 -1
- package/dist/Charts/PieChart/PieChart.types.d.ts +7 -3
- package/dist/FieldLabel/FieldLabel.js +3 -18
- package/dist/RichTextEditor/Extensions/getSlashCommand.d.ts +23 -3
- package/dist/RichTextEditor/Extensions/getSlashCommand.js +14 -6
- package/dist/RichTextEditor/Extensions/getTiptapExtensions.d.ts +5 -2
- package/dist/RichTextEditor/Extensions/getTiptapExtensions.js +3 -1
- package/dist/RichTextEditor/Plugins/UploadImagesPlugin.js +17 -3
- package/dist/RichTextEditor/RichTextEditor.d.ts +6 -3
- package/dist/RichTextEditor/RichTextEditor.js +6 -6
- package/dist/SegmentedControl/SegmentedControl.js +1 -1
- package/dist/SegmentedControl/SegmentedControl.styles.d.ts +1 -0
- package/dist/SegmentedControl/SegmentedControl.styles.js +30 -14
- package/dist/SegmentedControl/SegmentedControl.utils.d.ts +1 -0
- package/dist/SegmentedControl/SegmentedControl.utils.js +5 -2
- package/dist/Table/Table.js +4 -3
- package/dist/Table/TableComponents.d.ts +3 -0
- package/dist/Table/TableComponents.js +47 -0
- package/dist/Table/TableHeader.js +1 -1
- package/dist/Table/TableMenu/TableMenu.js +4 -3
- package/dist/Table/TableProvider.js +39 -0
- package/dist/Table/TableRow.js +1 -1
- package/dist/Table/types.d.ts +6 -0
- package/dist/core/controlSizes.js +9 -9
- package/package.json +1 -1
- package/dist/RichTextEditor/Components/TableCornerMenu.d.ts +0 -16
- package/dist/RichTextEditor/Components/TableCornerMenu.js +0 -202
- package/dist/RichTextEditor/Components/TableTools.d.ts +0 -44
- package/dist/RichTextEditor/Components/TableTools.js +0 -790
|
@@ -34,6 +34,19 @@ const readFileAsDataUrl = (file) => {
|
|
|
34
34
|
reader.readAsDataURL(file);
|
|
35
35
|
});
|
|
36
36
|
};
|
|
37
|
+
const getImageExtensionFromMimeType = (mimeType) => {
|
|
38
|
+
var _a;
|
|
39
|
+
const subtype = (_a = mimeType.toLowerCase().split("/")[1]) === null || _a === void 0 ? void 0 : _a.split(";")[0];
|
|
40
|
+
if (!subtype)
|
|
41
|
+
return "png";
|
|
42
|
+
if (subtype === "jpeg" || subtype === "pjpeg")
|
|
43
|
+
return "jpg";
|
|
44
|
+
if (subtype === "svg+xml")
|
|
45
|
+
return "svg";
|
|
46
|
+
if (subtype === "x-icon" || subtype === "vnd.microsoft.icon")
|
|
47
|
+
return "ico";
|
|
48
|
+
return subtype.replace(/[^a-z0-9]/g, "") || "png";
|
|
49
|
+
};
|
|
37
50
|
export const addImagePlaceholder = ({ view, id, pos, src, label = "Processing image...", }) => {
|
|
38
51
|
if (!uploadKey.getState(view.state))
|
|
39
52
|
return;
|
|
@@ -71,6 +84,7 @@ export const startImageUpload = (file, view, pos, handleImageUpload) => {
|
|
|
71
84
|
}
|
|
72
85
|
// A fresh object to act as the ID for this upload
|
|
73
86
|
const id = nanoid(25);
|
|
87
|
+
const uploadName = `${id}.${getImageExtensionFromMimeType(file.type)}`;
|
|
74
88
|
// Replace the selection with a placeholder
|
|
75
89
|
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
76
90
|
let placeholderAdded = false;
|
|
@@ -92,7 +106,7 @@ export const startImageUpload = (file, view, pos, handleImageUpload) => {
|
|
|
92
106
|
const hashes = yield calculateFileHash(file);
|
|
93
107
|
const src = yield handleImageUpload({
|
|
94
108
|
file,
|
|
95
|
-
name:
|
|
109
|
+
name: uploadName,
|
|
96
110
|
id,
|
|
97
111
|
md5: hashes.md5Hash,
|
|
98
112
|
sha1: hashes.sha1Hash,
|
|
@@ -111,10 +125,10 @@ export const startImageUpload = (file, view, pos, handleImageUpload) => {
|
|
|
111
125
|
const imageSrc = typeof src === "object" ? previewSrc : src;
|
|
112
126
|
const node = view.state.schema.nodes.image.create({
|
|
113
127
|
src: imageSrc,
|
|
114
|
-
alt:
|
|
128
|
+
alt: uploadName,
|
|
115
129
|
"data-uuid": id,
|
|
116
130
|
crossorigin: "anonymous",
|
|
117
|
-
title: `Filename: ${
|
|
131
|
+
title: `Filename: ${uploadName}`,
|
|
118
132
|
});
|
|
119
133
|
const insertTransaction = view.state.tr
|
|
120
134
|
.replaceWith(placeholderPos, placeholderPos, node)
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { Editor } from "@tiptap/react";
|
|
2
2
|
import { ExtensionPreset, ExtensionType } from "./Extensions/getTiptapExtensions";
|
|
3
|
+
import type { CustomSlashCommand } from "./Extensions/getSlashCommand";
|
|
4
|
+
import { SlashCommands } from "./Enums";
|
|
3
5
|
import { HandleImageUrlUpload, HandleImageUpload } from "./Plugins/UploadImagesPlugin";
|
|
4
6
|
import { BubbleMenuOptions } from "./Components/BubbleMenu";
|
|
5
7
|
import { ToolbarOptions } from "./Toolbar/Toolbar";
|
|
6
|
-
type RichTextEditorProps = {
|
|
8
|
+
export type RichTextEditorProps = {
|
|
7
9
|
className?: string;
|
|
8
10
|
editorInstanceRef?: React.RefObject<Editor | null>;
|
|
9
11
|
extensions?: ExtensionType[];
|
|
10
12
|
disabledExtensions?: ExtensionType[];
|
|
11
13
|
extensionPreset?: ExtensionPreset;
|
|
12
|
-
slashCommands?:
|
|
14
|
+
slashCommands?: SlashCommands[];
|
|
15
|
+
customSlashCommands?: CustomSlashCommand[];
|
|
13
16
|
defaultValue?: string;
|
|
14
17
|
value?: string;
|
|
15
18
|
readOnly?: boolean;
|
|
@@ -25,5 +28,5 @@ type RichTextEditorProps = {
|
|
|
25
28
|
autoFocus?: boolean;
|
|
26
29
|
style?: React.CSSProperties;
|
|
27
30
|
};
|
|
31
|
+
export type { CustomSlashCommand, SlashCommandActionProps, SlashCommandRange, } from "./Extensions/getSlashCommand";
|
|
28
32
|
export declare const RichTextEditor: React.FC<RichTextEditorProps>;
|
|
29
|
-
export {};
|
|
@@ -338,11 +338,6 @@ const StyledContent = styled.div `
|
|
|
338
338
|
max-width: 100%;
|
|
339
339
|
overflow-x: auto;
|
|
340
340
|
padding: 5px 0px;
|
|
341
|
-
cursor: default;
|
|
342
|
-
|
|
343
|
-
table {
|
|
344
|
-
cursor: text;
|
|
345
|
-
}
|
|
346
341
|
}
|
|
347
342
|
|
|
348
343
|
table {
|
|
@@ -818,7 +813,7 @@ const StyledContent = styled.div `
|
|
|
818
813
|
margin: 0 0.125rem;
|
|
819
814
|
}
|
|
820
815
|
`;
|
|
821
|
-
export const RichTextEditor = ({ className, editorInstanceRef, defaultValue = "", value, readOnly = false, font, showToolbar = true, saving = false, disabledExtensions = [], extensionPreset = "basic", extensions = [], slashCommands = [], bubbleMenuOptions, toolbarOptions, autoFocus, onChange, handleImageUpload, handleImageUrlUpload, style, }) => {
|
|
816
|
+
export const RichTextEditor = ({ className, editorInstanceRef, defaultValue = "", value, readOnly = false, font, showToolbar = true, saving = false, disabledExtensions = [], extensionPreset = "basic", extensions = [], slashCommands = [], customSlashCommands = [], bubbleMenuOptions, toolbarOptions, autoFocus, onChange, handleImageUpload, handleImageUrlUpload, style, }) => {
|
|
822
817
|
const resolvedExtensions = useMemo(() => resolveExtensions({
|
|
823
818
|
disabledExtensions,
|
|
824
819
|
extensionPreset,
|
|
@@ -873,11 +868,14 @@ export const RichTextEditor = ({ className, editorInstanceRef, defaultValue = ""
|
|
|
873
868
|
const hasImageSlashCommand = hasSlashCommandExtension &&
|
|
874
869
|
resolvedSlashCommands.includes(SlashCommands.Image);
|
|
875
870
|
const onChangeRef = useRef(onChange);
|
|
871
|
+
const customSlashCommandsRef = useRef(customSlashCommands);
|
|
876
872
|
const bubbleMenuPortalRef = useRef(null);
|
|
877
873
|
const [fontState, setFontState] = useState(font || Fonts.DEFAULT);
|
|
874
|
+
customSlashCommandsRef.current = customSlashCommands;
|
|
878
875
|
useEffect(() => {
|
|
879
876
|
onChangeRef.current = onChange;
|
|
880
877
|
}, [onChange]);
|
|
878
|
+
const getCustomSlashCommands = useCallback(() => customSlashCommandsRef.current, []);
|
|
881
879
|
const getBubbleMenuPortalRoot = useCallback(() => {
|
|
882
880
|
if (bubbleMenuPortalRef.current) {
|
|
883
881
|
return bubbleMenuPortalRef.current;
|
|
@@ -932,6 +930,8 @@ export const RichTextEditor = ({ className, editorInstanceRef, defaultValue = ""
|
|
|
932
930
|
disabledExtensions,
|
|
933
931
|
extensions: resolvedExtensions,
|
|
934
932
|
slashCommands: resolvedSlashCommands,
|
|
933
|
+
customSlashCommands,
|
|
934
|
+
getCustomSlashCommands,
|
|
935
935
|
handleImageUpload,
|
|
936
936
|
}),
|
|
937
937
|
editorProps: {
|
|
@@ -55,7 +55,7 @@ export const SegmentedControl = (_a) => {
|
|
|
55
55
|
});
|
|
56
56
|
const columnCount = Math.max(normalizedData.length, 1);
|
|
57
57
|
const firstEnabledIndex = getFirstEnabledIndex(normalizedData);
|
|
58
|
-
return (_jsxs(StyledRoot, Object.assign({ role: "radiogroup", "aria-disabled": disabled, className: className, style: Object.assign({ gridTemplateColumns: `repeat(${columnCount}, minmax(0, 1fr))` }, style), "$fullWidth": fullWidth, "$disabled": disabled, onKeyDown: handleKeyDown }, other, { children: [name && _jsx("input", { type: "hidden", name: name, value: _value || "" }), activeIndex >= 0 && !(selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.disabled) && (_jsx(StyledIndicator, { "$index": activeIndex, "$count": columnCount, "$variant": variant, "$activeColor": activeColor })), normalizedData.map((item, index) => {
|
|
58
|
+
return (_jsxs(StyledRoot, Object.assign({ role: "radiogroup", "aria-disabled": disabled, className: className, style: Object.assign({ gridTemplateColumns: `repeat(${columnCount}, minmax(0, 1fr))` }, style), "$fullWidth": fullWidth, "$disabled": disabled, "$size": size, onKeyDown: handleKeyDown }, other, { children: [name && _jsx("input", { type: "hidden", name: name, value: _value || "" }), activeIndex >= 0 && !(selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.disabled) && (_jsx(StyledIndicator, { "$index": activeIndex, "$count": columnCount, "$variant": variant, "$activeColor": activeColor })), normalizedData.map((item, index) => {
|
|
59
59
|
const isActive = item.value === _value && !item.disabled;
|
|
60
60
|
const isSegmentDisabled = disabled || item.disabled;
|
|
61
61
|
return (_jsx(StyledSegmentButton, { ref: (node) => {
|
|
@@ -3,6 +3,7 @@ import { SegmentedControlVariant } from "./SegmentedControl.types";
|
|
|
3
3
|
export declare const StyledRoot: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
4
4
|
$fullWidth: boolean;
|
|
5
5
|
$disabled: boolean;
|
|
6
|
+
$size?: Size;
|
|
6
7
|
}>> & string;
|
|
7
8
|
export declare const StyledIndicator: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
8
9
|
$index: number;
|
|
@@ -1,27 +1,33 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
|
-
import { getSegmentFontSize, getSegmentHeight, resolveActiveColor, } from "./SegmentedControl.utils";
|
|
2
|
+
import { getSegmentFontSize, getSegmentHeight, getSegmentPaddingX, resolveActiveColor, } from "./SegmentedControl.utils";
|
|
3
|
+
const SEGMENT_GAP = 2;
|
|
3
4
|
export const StyledRoot = styled.div `
|
|
4
5
|
user-select: none;
|
|
5
6
|
position: relative;
|
|
6
7
|
display: grid;
|
|
7
8
|
align-items: center;
|
|
9
|
+
grid-auto-rows: minmax(0, 1fr);
|
|
10
|
+
column-gap: ${SEGMENT_GAP}px;
|
|
11
|
+
box-sizing: border-box;
|
|
8
12
|
width: ${({ $fullWidth }) => ($fullWidth ? "100%" : "fit-content")};
|
|
9
|
-
min-width:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
border:
|
|
13
|
+
min-width: 0;
|
|
14
|
+
height: ${({ $size }) => `${getSegmentHeight($size)}px`};
|
|
15
|
+
padding: 2px;
|
|
16
|
+
border-radius: 5px;
|
|
17
|
+
border: 1px solid ${({ theme }) => theme.palette.input.border};
|
|
13
18
|
background: ${({ theme }) => theme.palette.background.secondary};
|
|
14
19
|
opacity: ${({ $disabled }) => ($disabled ? 0.6 : 1)};
|
|
15
20
|
pointer-events: ${({ $disabled }) => ($disabled ? "none" : "auto")};
|
|
16
21
|
`;
|
|
17
22
|
export const StyledIndicator = styled.div `
|
|
18
23
|
position: absolute;
|
|
19
|
-
top:
|
|
20
|
-
left:
|
|
24
|
+
top: 2px;
|
|
25
|
+
left: 2px;
|
|
21
26
|
z-index: 1;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
box-sizing: border-box;
|
|
28
|
+
height: calc(100% - 4px);
|
|
29
|
+
width: ${({ $count }) => `calc((100% - 4px - ${($count - 1) * SEGMENT_GAP}px) / ${$count})`};
|
|
30
|
+
border-radius: 4px;
|
|
25
31
|
border: 1px solid
|
|
26
32
|
${({ theme, $variant, $activeColor }) => {
|
|
27
33
|
const resolved = resolveActiveColor(theme, $activeColor);
|
|
@@ -33,17 +39,26 @@ export const StyledIndicator = styled.div `
|
|
|
33
39
|
? resolved.main
|
|
34
40
|
: theme.palette.background.paper;
|
|
35
41
|
}};
|
|
36
|
-
transform: translateX(
|
|
42
|
+
transform: translateX(
|
|
43
|
+
${({ $index }) => `calc(${$index * 100}% + ${$index * SEGMENT_GAP}px)`}
|
|
44
|
+
);
|
|
37
45
|
transition: transform 160ms ease;
|
|
38
46
|
`;
|
|
39
47
|
export const StyledSegmentButton = styled.button `
|
|
40
48
|
position: relative;
|
|
41
49
|
z-index: 2;
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
justify-content: center;
|
|
53
|
+
box-sizing: border-box;
|
|
42
54
|
border: none;
|
|
43
55
|
outline: none;
|
|
44
|
-
padding: 0
|
|
56
|
+
padding: ${({ $size }) => `0 ${getSegmentPaddingX($size)}px`};
|
|
45
57
|
margin: 0;
|
|
46
|
-
|
|
58
|
+
min-width: 0;
|
|
59
|
+
overflow: hidden;
|
|
60
|
+
text-overflow: ellipsis;
|
|
61
|
+
border-radius: 4px;
|
|
47
62
|
background: transparent;
|
|
48
63
|
color: ${({ theme, $active, $variant, $activeColor }) => {
|
|
49
64
|
const resolved = resolveActiveColor(theme, $activeColor);
|
|
@@ -54,7 +69,8 @@ export const StyledSegmentButton = styled.button `
|
|
|
54
69
|
font-size: ${({ $size }) => getSegmentFontSize($size)};
|
|
55
70
|
font-weight: 500;
|
|
56
71
|
line-height: 1;
|
|
57
|
-
height:
|
|
72
|
+
height: 100%;
|
|
73
|
+
min-height: 0;
|
|
58
74
|
white-space: nowrap;
|
|
59
75
|
cursor: pointer;
|
|
60
76
|
transition:
|
|
@@ -6,6 +6,7 @@ export declare const resolveActiveColor: (theme: any, activeColor?: string) => {
|
|
|
6
6
|
};
|
|
7
7
|
export declare const getSegmentHeight: (size?: Size) => number;
|
|
8
8
|
export declare const getSegmentFontSize: (size?: Size) => string;
|
|
9
|
+
export declare const getSegmentPaddingX: (size?: Size) => number;
|
|
9
10
|
export declare const normalizeSegmentedData: (data: SegmentedControlDataItem[]) => NormalizedSegmentedItem[];
|
|
10
11
|
export declare const getFirstEnabledIndex: (data: NormalizedSegmentedItem[]) => number;
|
|
11
12
|
export declare const getNextEnabledIndex: (data: NormalizedSegmentedItem[], startIndex: number, direction: 1 | -1) => number;
|
|
@@ -22,10 +22,13 @@ export const resolveActiveColor = (theme, activeColor) => {
|
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
24
|
export const getSegmentHeight = (size) => {
|
|
25
|
-
return getControlSizeTokens(size).
|
|
25
|
+
return getControlSizeTokens(size).height;
|
|
26
26
|
};
|
|
27
27
|
export const getSegmentFontSize = (size) => {
|
|
28
|
-
return `${getControlSizeTokens(size).
|
|
28
|
+
return `${getControlSizeTokens(size).fontSize}px`;
|
|
29
|
+
};
|
|
30
|
+
export const getSegmentPaddingX = (size) => {
|
|
31
|
+
return getControlSizeTokens(size).buttonPaddingX;
|
|
29
32
|
};
|
|
30
33
|
export const normalizeSegmentedData = (data) => data.map((item) => {
|
|
31
34
|
var _a;
|
package/dist/Table/Table.js
CHANGED
|
@@ -12,7 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
14
14
|
import { useOverlayScrollbars } from "overlayscrollbars-react";
|
|
15
|
-
import { StyledTable } from "./TableComponents";
|
|
15
|
+
import { StyledTable, TableEmptyState, TableEmptyStateDescription, TableEmptyStateTitle, } from "./TableComponents";
|
|
16
16
|
import TableHeader from "./TableHeader";
|
|
17
17
|
import TableProvider from "./TableProvider";
|
|
18
18
|
import shortUUID from "short-uuid";
|
|
@@ -33,12 +33,13 @@ const StyledTableContainer = styled.div `
|
|
|
33
33
|
`;
|
|
34
34
|
const TableContent = ({ children, }) => {
|
|
35
35
|
const { columnState, tableElement, tableHeight, tableMaxHeight, tableMinHeight, headerRowElm, tableDimensions, targetElm, listElm, rowHeight, headerRowHeight, compactState, virtualized, loading, } = useTable();
|
|
36
|
-
const visibleColumnCount = columnState.filter((column) => column.visible
|
|
36
|
+
const visibleColumnCount = columnState.filter((column) => column.visible !== false).length;
|
|
37
|
+
const allColumnsHidden = columnState.length > 0 && visibleColumnCount === 0;
|
|
37
38
|
return (_jsxs(StyledTableContainer, { children: [_jsx(TableMenu, {}), children, _jsxs(StyledTable, { className: "mfui-table", style: {
|
|
38
39
|
height: tableHeight || "100%",
|
|
39
40
|
maxHeight: tableMaxHeight,
|
|
40
41
|
minHeight: tableMinHeight,
|
|
41
|
-
}, ref: tableElement, "data-compact": compactState, children: [_jsx(LoadingIndicator, { visible: loading }), _jsx(TableHeader, { headerRowElm: headerRowElm }),
|
|
42
|
+
}, ref: tableElement, "data-compact": compactState, "data-all-columns-hidden": allColumnsHidden, children: [_jsx(LoadingIndicator, { visible: loading }), _jsx(TableHeader, { headerRowElm: headerRowElm }), allColumnsHidden ? (_jsxs(TableEmptyState, { className: "mfui-table-empty-state", role: "status", children: [_jsx(TableEmptyStateTitle, { children: "All columns are hidden" }), _jsx(TableEmptyStateDescription, { children: "No data is currently displaying because every table column is hidden." })] })) : null, virtualized === true ? (_jsx(VirtualizedRows, { tableDimensions: tableDimensions, targetElm: targetElm, listElm: listElm, rowHeight: rowHeight, headerRowHeight: headerRowHeight })) : (_jsx(StaticRows, { targetElm: targetElm, listElm: listElm }))] })] }));
|
|
42
43
|
};
|
|
43
44
|
export const Table = (_a) => {
|
|
44
45
|
var { data, columnProps, children, treeOptions } = _a, props = __rest(_a, ["data", "columnProps", "children", "treeOptions"]) // pass through props straight to table context
|
|
@@ -18,5 +18,8 @@ export declare const TreeChevronPlaceholder: import("styled-components/dist/type
|
|
|
18
18
|
export declare const TreeCellContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
19
19
|
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;
|
|
20
20
|
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;
|
|
21
|
+
export declare const TableEmptyState: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
22
|
+
export declare const TableEmptyStateTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
23
|
+
export declare const TableEmptyStateDescription: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
21
24
|
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;
|
|
22
25
|
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;
|
|
@@ -175,6 +175,36 @@ export const TableListElement = styled.div `
|
|
|
175
175
|
flex-direction: column;
|
|
176
176
|
min-width: 100%;
|
|
177
177
|
`;
|
|
178
|
+
export const TableEmptyState = styled.div `
|
|
179
|
+
box-sizing: border-box;
|
|
180
|
+
position: absolute;
|
|
181
|
+
inset: 0;
|
|
182
|
+
z-index: 2;
|
|
183
|
+
width: 100%;
|
|
184
|
+
height: 100%;
|
|
185
|
+
padding: 24px;
|
|
186
|
+
display: flex;
|
|
187
|
+
flex-direction: column;
|
|
188
|
+
align-items: center;
|
|
189
|
+
gap: 10px;
|
|
190
|
+
color: ${({ theme }) => theme.palette.text.secondary};
|
|
191
|
+
background-color: ${({ theme }) => theme.palette.background.default};
|
|
192
|
+
text-align: center;
|
|
193
|
+
font-size: 12px;
|
|
194
|
+
|
|
195
|
+
svg {
|
|
196
|
+
color: ${({ theme }) => theme.palette.text.secondary};
|
|
197
|
+
}
|
|
198
|
+
`;
|
|
199
|
+
export const TableEmptyStateTitle = styled.div `
|
|
200
|
+
color: ${({ theme }) => theme.palette.text.primary};
|
|
201
|
+
font-size: 16px;
|
|
202
|
+
font-weight: 600;
|
|
203
|
+
`;
|
|
204
|
+
export const TableEmptyStateDescription = styled.div `
|
|
205
|
+
max-width: 320px;
|
|
206
|
+
line-height: 1.45;
|
|
207
|
+
`;
|
|
178
208
|
export const TableWrapper = styled.div `
|
|
179
209
|
position: relative;
|
|
180
210
|
flex: 1 1 auto;
|
|
@@ -189,6 +219,17 @@ export const StyledTable = styled.div `
|
|
|
189
219
|
display: flex;
|
|
190
220
|
flex-direction: column;
|
|
191
221
|
|
|
222
|
+
&::after {
|
|
223
|
+
content: "";
|
|
224
|
+
position: absolute;
|
|
225
|
+
inset: 0;
|
|
226
|
+
z-index: 1;
|
|
227
|
+
pointer-events: none;
|
|
228
|
+
box-shadow:
|
|
229
|
+
inset 1px 0 ${({ theme }) => theme.palette.divider},
|
|
230
|
+
inset -1px 0 ${({ theme }) => theme.palette.divider};
|
|
231
|
+
}
|
|
232
|
+
|
|
192
233
|
&[data-compact="true"] .mfui-tr,
|
|
193
234
|
&[data-compact="true"] .mfui-thr,
|
|
194
235
|
&[data-compact="true"] .mfui-td {
|
|
@@ -213,4 +254,10 @@ export const StyledTable = styled.div `
|
|
|
213
254
|
pointer-events: auto;
|
|
214
255
|
visibility: visible;
|
|
215
256
|
}
|
|
257
|
+
|
|
258
|
+
&[data-all-columns-hidden="true"] .mfui-thead,
|
|
259
|
+
&[data-all-columns-hidden="true"] .mfui-tbody-viewport {
|
|
260
|
+
visibility: hidden;
|
|
261
|
+
pointer-events: none;
|
|
262
|
+
}
|
|
216
263
|
`;
|
|
@@ -58,7 +58,7 @@ const TableHeader = ({ headerRowElm }) => {
|
|
|
58
58
|
flexShrink: 0,
|
|
59
59
|
justifyContent: "center",
|
|
60
60
|
alignItems: "center",
|
|
61
|
-
}, children: _jsx(InnerCellContent, { className: "mfui inner-cell-content", children: disableSelectAll !== true && (_jsx(CheckBox, { value: selectionState.selectionStatus === "all", partialCheck: (_a = selectionState.selectionStatus) === null || _a === void 0 ? void 0 : _a.includes("some"), onChange: handleChangeSelection })) }) })), enableActionButton && (_jsx(TH, { className: `mfui-th column-action`, style: {
|
|
61
|
+
}, children: _jsx(InnerCellContent, { className: "mfui inner-cell-content", children: disableSelectAll !== true && (_jsx(CheckBox, { size: "xs", value: selectionState.selectionStatus === "all", partialCheck: (_a = selectionState.selectionStatus) === null || _a === void 0 ? void 0 : _a.includes("some"), onChange: handleChangeSelection })) }) })), enableActionButton && (_jsx(TH, { className: `mfui-th column-action`, style: {
|
|
62
62
|
width: TableDefaults.actionCell.width,
|
|
63
63
|
minWidth: TableDefaults.actionCell.minWidth,
|
|
64
64
|
maxWidth: TableDefaults.actionCell.maxWidth,
|
|
@@ -30,7 +30,7 @@ const FlexedRow = styled.div `
|
|
|
30
30
|
`;
|
|
31
31
|
const TableMenu = () => {
|
|
32
32
|
var _a, _b, _c, _d, _e;
|
|
33
|
-
const { data, columnState, searchState,
|
|
33
|
+
const { data, columnState, searchState, setVisibleColumns, tableMenuOptions, runSearch, enableSelection, compactState, toggleCompact, totalRecords, getCalculatedSelectionTotal, handleTableExport, filterState, handleFilterChange, } = useTable();
|
|
34
34
|
const inputRef = useRef(null);
|
|
35
35
|
if ((tableMenuOptions === null || tableMenuOptions === void 0 ? void 0 : tableMenuOptions.enabled) !== true)
|
|
36
36
|
return null;
|
|
@@ -116,13 +116,14 @@ const TableMenu = () => {
|
|
|
116
116
|
}, children: _jsx(DownloadIcon, { size: 14 }) })), (compactOptions === null || compactOptions === void 0 ? void 0 : compactOptions.enabled) === true && (_jsx(Button, { variant: "outlined", title: "Toggle Compact", size: "xxs", style: { padding: "0px 4px" }, onClick: () => toggleCompact(), children: compactState ? _jsx(Rows4Icon, { size: 14 }) : _jsx(Rows3Icon, { size: 14 }) })), (columnSelectorOptions === null || columnSelectorOptions === void 0 ? void 0 : columnSelectorOptions.enabled) === true && (_jsx(DropDownMenu, { variant: "outlined", size: "xs", data: columnState.map((col) => ({
|
|
117
117
|
label: (col === null || col === void 0 ? void 0 : col.caption) || col.dataField,
|
|
118
118
|
value: col.dataField,
|
|
119
|
-
onClick: () => toggleColumnVisibility(col.dataField),
|
|
120
119
|
})), defaultValue: columnState
|
|
121
120
|
.filter((col) => col.visible !== false)
|
|
122
121
|
.map((col) => ({
|
|
123
122
|
label: (col === null || col === void 0 ? void 0 : col.caption) || col.dataField,
|
|
124
123
|
value: col.dataField,
|
|
125
|
-
})), multiselect: true, searchable: true,
|
|
124
|
+
})), multiselect: true, enableSelectAll: true, searchable: true, onChange: (e) => {
|
|
125
|
+
setVisibleColumns(e.map((item) => item.value));
|
|
126
|
+
}, buttonProps: {
|
|
126
127
|
title: "Show/Hide Columns",
|
|
127
128
|
size: "xs",
|
|
128
129
|
style: { padding: "0px 4px", height: 24 },
|
|
@@ -595,6 +595,39 @@ const TableProvider = (_a) => {
|
|
|
595
595
|
});
|
|
596
596
|
updateColumnState(newColumnState);
|
|
597
597
|
};
|
|
598
|
+
const setVisibleColumns = (dataFields) => {
|
|
599
|
+
const newColumnState = columnState.map((col) => {
|
|
600
|
+
if (dataFields.includes(col.dataField)) {
|
|
601
|
+
return Object.assign(Object.assign({}, col), { visible: true });
|
|
602
|
+
}
|
|
603
|
+
return Object.assign(Object.assign({}, col), { visible: false });
|
|
604
|
+
});
|
|
605
|
+
updateColumnState(newColumnState);
|
|
606
|
+
};
|
|
607
|
+
const showColumn = (dataField) => {
|
|
608
|
+
const column = columnState.find((col) => col.dataField === dataField);
|
|
609
|
+
if (column && column.visible === false) {
|
|
610
|
+
const newColumnState = columnState.map((col) => {
|
|
611
|
+
if (col.dataField === dataField) {
|
|
612
|
+
return Object.assign(Object.assign({}, col), { visible: true });
|
|
613
|
+
}
|
|
614
|
+
return col;
|
|
615
|
+
});
|
|
616
|
+
updateColumnState(newColumnState);
|
|
617
|
+
}
|
|
618
|
+
};
|
|
619
|
+
const hideColumn = (dataField) => {
|
|
620
|
+
const column = columnState.find((col) => col.dataField === dataField);
|
|
621
|
+
if (column && column.visible === true) {
|
|
622
|
+
const newColumnState = columnState.map((col) => {
|
|
623
|
+
if (col.dataField === dataField) {
|
|
624
|
+
return Object.assign(Object.assign({}, col), { visible: false });
|
|
625
|
+
}
|
|
626
|
+
return col;
|
|
627
|
+
});
|
|
628
|
+
updateColumnState(newColumnState);
|
|
629
|
+
}
|
|
630
|
+
};
|
|
598
631
|
const toggleCompact = () => {
|
|
599
632
|
setCompactState((prev) => !prev);
|
|
600
633
|
};
|
|
@@ -852,6 +885,9 @@ const TableProvider = (_a) => {
|
|
|
852
885
|
setColumnState: updateColumnState,
|
|
853
886
|
getColumnState,
|
|
854
887
|
toggleColumnVisibility,
|
|
888
|
+
showColumn,
|
|
889
|
+
hideColumn,
|
|
890
|
+
setVisibleColumns,
|
|
855
891
|
getColumnVisibility,
|
|
856
892
|
getSelectedRows,
|
|
857
893
|
getSelectedRowKeys,
|
|
@@ -900,6 +936,9 @@ const TableProvider = (_a) => {
|
|
|
900
936
|
selectAllRows,
|
|
901
937
|
clearSelections,
|
|
902
938
|
toggleColumnVisibility,
|
|
939
|
+
setVisibleColumns,
|
|
940
|
+
showColumn,
|
|
941
|
+
hideColumn,
|
|
903
942
|
runSearch,
|
|
904
943
|
clearSearch,
|
|
905
944
|
handleTableExport,
|
package/dist/Table/TableRow.js
CHANGED
|
@@ -13,7 +13,7 @@ const TableRow = ({ rowData, loading, rowStyle }) => {
|
|
|
13
13
|
const handleSelectionChange = (e) => {
|
|
14
14
|
e === true ? selectRow(rowData) : deselectRow(rowData);
|
|
15
15
|
};
|
|
16
|
-
return (_jsxs(TR, { className: "mfui-tr", "data-key": rowData.__key, "data-selected": selected, "data-focused": focused, style: Object.assign(Object.assign({}, rowStyle), { width: tableLayout.contentWidth }), children: [enableSelection && (_jsx(ActionCell, { className: `mfui-td column-select`, children: _jsx(InnerCellContent, { className: "mfui inner-cell-content row-action row-selection-action", children: _jsx(CheckBox, { className: `mfui-checkbox`, value: selected, onChange: (e) => handleSelectionChange(e) }) }) })), enableActionButton && (_jsx(ActionCell, { className: `mfui-td column-action`, children: _jsx(InnerCellContent, { className: "mfui inner-cell-content row-action", children: _jsx(ActionButton, { variant: "subtle", onClick: () => onActionButtonClick === null || onActionButtonClick === void 0 ? void 0 : onActionButtonClick(rowData), children: Icon ? _jsx(Icon, { size: 14 }) : _jsx(Maximize2Icon, { size: 14 }) }) }) })), columnState.map((column, index) => {
|
|
16
|
+
return (_jsxs(TR, { className: "mfui-tr", "data-key": rowData.__key, "data-selected": selected, "data-focused": focused, style: Object.assign(Object.assign({}, rowStyle), { width: tableLayout.contentWidth }), children: [enableSelection && (_jsx(ActionCell, { className: `mfui-td column-select`, children: _jsx(InnerCellContent, { className: "mfui inner-cell-content row-action row-selection-action", children: _jsx(CheckBox, { className: `mfui-checkbox`, size: "xs", value: selected, onChange: (e) => handleSelectionChange(e) }) }) })), enableActionButton && (_jsx(ActionCell, { className: `mfui-td column-action`, children: _jsx(InnerCellContent, { className: "mfui inner-cell-content row-action", children: _jsx(ActionButton, { variant: "subtle", onClick: () => onActionButtonClick === null || onActionButtonClick === void 0 ? void 0 : onActionButtonClick(rowData), children: Icon ? _jsx(Icon, { size: 14 }) : _jsx(Maximize2Icon, { size: 14 }) }) }) })), columnState.map((column, index) => {
|
|
17
17
|
var _a;
|
|
18
18
|
if (column.visible === false)
|
|
19
19
|
return null;
|
package/dist/Table/types.d.ts
CHANGED
|
@@ -168,6 +168,9 @@ export type TableContextType = {
|
|
|
168
168
|
focusedRowId?: string | number;
|
|
169
169
|
toggleCompact: () => void;
|
|
170
170
|
toggleColumnVisibility: (dataField: string) => void;
|
|
171
|
+
setVisibleColumns: (dataFields: string[]) => void;
|
|
172
|
+
showColumn: (dataField: string) => void;
|
|
173
|
+
hideColumn: (dataField: string) => void;
|
|
171
174
|
runSearch: (query: string) => void;
|
|
172
175
|
clearSearch: () => void;
|
|
173
176
|
handleTableExport: (e: TableExportOptions) => Promise<void> | void;
|
|
@@ -388,6 +391,9 @@ export type TableInstance = {
|
|
|
388
391
|
onColumnReorder?: (e: OnColumnChangeProps) => void;
|
|
389
392
|
onColumnStateChange?: (e: ColumnState[]) => void;
|
|
390
393
|
toggleColumnVisibility: (dataField: string) => void;
|
|
394
|
+
setVisibleColumns: (dataFields: string[]) => void;
|
|
395
|
+
showColumn: (dataField: string) => void;
|
|
396
|
+
hideColumn: (dataField: string) => void;
|
|
391
397
|
getColumnVisibility: (dataField: string) => boolean;
|
|
392
398
|
getSelectedRows: () => any[];
|
|
393
399
|
getSelectedRowKeys: () => string[];
|
|
@@ -26,7 +26,7 @@ const CONTROL_SIZE_TOKENS = {
|
|
|
26
26
|
pillPaddingX: 6,
|
|
27
27
|
pillIconSize: 10,
|
|
28
28
|
pillGap: 4,
|
|
29
|
-
segmentedHeight:
|
|
29
|
+
segmentedHeight: 24,
|
|
30
30
|
segmentedFontSize: 11,
|
|
31
31
|
sectionTitleFontSize: 12,
|
|
32
32
|
sectionIconSize: 12,
|
|
@@ -57,7 +57,7 @@ const CONTROL_SIZE_TOKENS = {
|
|
|
57
57
|
pillPaddingX: 8,
|
|
58
58
|
pillIconSize: 12,
|
|
59
59
|
pillGap: 5,
|
|
60
|
-
segmentedHeight:
|
|
60
|
+
segmentedHeight: 28,
|
|
61
61
|
segmentedFontSize: 12,
|
|
62
62
|
sectionTitleFontSize: 13,
|
|
63
63
|
sectionIconSize: 12,
|
|
@@ -89,7 +89,7 @@ const CONTROL_SIZE_TOKENS = {
|
|
|
89
89
|
pillIconSize: 14,
|
|
90
90
|
pillGap: 5,
|
|
91
91
|
segmentedHeight: 32,
|
|
92
|
-
segmentedFontSize:
|
|
92
|
+
segmentedFontSize: 13,
|
|
93
93
|
sectionTitleFontSize: 14,
|
|
94
94
|
sectionIconSize: 14,
|
|
95
95
|
},
|
|
@@ -119,8 +119,8 @@ const CONTROL_SIZE_TOKENS = {
|
|
|
119
119
|
pillPaddingX: 12,
|
|
120
120
|
pillIconSize: 16,
|
|
121
121
|
pillGap: 5,
|
|
122
|
-
segmentedHeight:
|
|
123
|
-
segmentedFontSize:
|
|
122
|
+
segmentedHeight: 36,
|
|
123
|
+
segmentedFontSize: 14,
|
|
124
124
|
sectionTitleFontSize: 16,
|
|
125
125
|
sectionIconSize: 18,
|
|
126
126
|
},
|
|
@@ -150,8 +150,8 @@ const CONTROL_SIZE_TOKENS = {
|
|
|
150
150
|
pillPaddingX: 14,
|
|
151
151
|
pillIconSize: 18,
|
|
152
152
|
pillGap: 5,
|
|
153
|
-
segmentedHeight:
|
|
154
|
-
segmentedFontSize:
|
|
153
|
+
segmentedHeight: 44,
|
|
154
|
+
segmentedFontSize: 15,
|
|
155
155
|
sectionTitleFontSize: 18,
|
|
156
156
|
sectionIconSize: 24,
|
|
157
157
|
},
|
|
@@ -181,8 +181,8 @@ const CONTROL_SIZE_TOKENS = {
|
|
|
181
181
|
pillPaddingX: 16,
|
|
182
182
|
pillIconSize: 20,
|
|
183
183
|
pillGap: 5,
|
|
184
|
-
segmentedHeight:
|
|
185
|
-
segmentedFontSize:
|
|
184
|
+
segmentedHeight: 52,
|
|
185
|
+
segmentedFontSize: 16,
|
|
186
186
|
sectionTitleFontSize: 20,
|
|
187
187
|
sectionIconSize: 28,
|
|
188
188
|
},
|
package/package.json
CHANGED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Editor } from "@tiptap/react";
|
|
2
|
-
import type { MouseEvent as ReactMouseEvent } from "react";
|
|
3
|
-
import type { TableRailTarget } from "./TableTools";
|
|
4
|
-
type TableCornerMenuProps = {
|
|
5
|
-
editor: Editor | null;
|
|
6
|
-
target: TableRailTarget;
|
|
7
|
-
opened: boolean;
|
|
8
|
-
onOpen: () => void;
|
|
9
|
-
onClose: () => void;
|
|
10
|
-
onAction: () => void;
|
|
11
|
-
onMouseEnter: () => void;
|
|
12
|
-
onMouseLeave: () => void;
|
|
13
|
-
onMouseDown: (event: ReactMouseEvent<HTMLButtonElement>) => void;
|
|
14
|
-
};
|
|
15
|
-
export declare const TableCornerMenu: ({ editor, target, opened, onOpen, onClose, onAction, onMouseEnter, onMouseLeave, onMouseDown, }: TableCornerMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
export {};
|