@monolith-forensics/monolith-ui 1.9.3-dev.0 → 1.9.3-dev.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.
Files changed (48) hide show
  1. package/dist/Charts/BarChart/BarChart.js +28 -14
  2. package/dist/Charts/BarChart/BarChart.styled.d.ts +7 -2
  3. package/dist/Charts/BarChart/BarChart.styled.js +5 -1
  4. package/dist/Charts/BarChart/BarChart.types.d.ts +13 -5
  5. package/dist/Charts/ChartUtils/chartSizing.d.ts +20 -0
  6. package/dist/Charts/ChartUtils/chartSizing.js +83 -0
  7. package/dist/Charts/ChartUtils/index.d.ts +1 -0
  8. package/dist/Charts/ChartUtils/index.js +1 -0
  9. package/dist/Charts/HeatMap/HeatMap.js +28 -7
  10. package/dist/Charts/HeatMap/HeatMap.styled.d.ts +6 -2
  11. package/dist/Charts/HeatMap/HeatMap.styled.js +3 -0
  12. package/dist/Charts/HeatMap/HeatMap.types.d.ts +7 -1
  13. package/dist/Charts/LineChart/LineChart.js +34 -15
  14. package/dist/Charts/LineChart/LineChart.styled.d.ts +7 -2
  15. package/dist/Charts/LineChart/LineChart.styled.js +5 -1
  16. package/dist/Charts/LineChart/LineChart.types.d.ts +13 -5
  17. package/dist/Charts/PieChart/PieChart.js +48 -33
  18. package/dist/Charts/PieChart/PieChart.styled.d.ts +7 -2
  19. package/dist/Charts/PieChart/PieChart.styled.js +6 -1
  20. package/dist/Charts/PieChart/PieChart.types.d.ts +7 -3
  21. package/dist/FieldLabel/FieldLabel.js +3 -18
  22. package/dist/RichTextEditor/Extensions/getSlashCommand.d.ts +23 -3
  23. package/dist/RichTextEditor/Extensions/getSlashCommand.js +14 -6
  24. package/dist/RichTextEditor/Extensions/getTiptapExtensions.d.ts +5 -2
  25. package/dist/RichTextEditor/Extensions/getTiptapExtensions.js +3 -1
  26. package/dist/RichTextEditor/RichTextEditor.d.ts +6 -3
  27. package/dist/RichTextEditor/RichTextEditor.js +6 -6
  28. package/dist/SegmentedControl/SegmentedControl.js +1 -1
  29. package/dist/SegmentedControl/SegmentedControl.styles.d.ts +1 -0
  30. package/dist/SegmentedControl/SegmentedControl.styles.js +30 -14
  31. package/dist/SegmentedControl/SegmentedControl.utils.d.ts +1 -0
  32. package/dist/SegmentedControl/SegmentedControl.utils.js +5 -2
  33. package/dist/Table/Table.js +4 -3
  34. package/dist/Table/TableComponents.d.ts +3 -0
  35. package/dist/Table/TableComponents.js +47 -0
  36. package/dist/Table/TableHeader.js +1 -1
  37. package/dist/Table/TableMenu/TableMenu.js +4 -3
  38. package/dist/Table/TableProvider.js +39 -0
  39. package/dist/Table/TableRow.js +1 -1
  40. package/dist/Table/types.d.ts +6 -0
  41. package/dist/Utilities/getImageTextContent.d.ts +78 -0
  42. package/dist/Utilities/getImageTextContent.js +222 -0
  43. package/dist/core/controlSizes.js +9 -9
  44. package/package.json +1 -1
  45. package/dist/RichTextEditor/Components/TableCornerMenu.d.ts +0 -16
  46. package/dist/RichTextEditor/Components/TableCornerMenu.js +0 -202
  47. package/dist/RichTextEditor/Components/TableTools.d.ts +0 -44
  48. package/dist/RichTextEditor/Components/TableTools.js +0 -790
@@ -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: ${({ $fullWidth }) => ($fullWidth ? "0" : "200px")};
10
- padding: 3px;
11
- border-radius: 8px;
12
- border: 1px solid ${({ theme }) => theme.palette.action.hover};
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: 3px;
20
- left: 3px;
24
+ top: 2px;
25
+ left: 2px;
21
26
  z-index: 1;
22
- height: calc(100% - 6px);
23
- width: ${({ $count }) => `calc((100% - 6px) / ${$count})`};
24
- border-radius: 6px;
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(${({ $index }) => `${$index * 100}%`});
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 12px;
56
+ padding: ${({ $size }) => `0 ${getSegmentPaddingX($size)}px`};
45
57
  margin: 0;
46
- border-radius: 6px;
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: ${({ $size }) => `${getSegmentHeight($size)}px`};
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).segmentedHeight;
25
+ return getControlSizeTokens(size).height;
26
26
  };
27
27
  export const getSegmentFontSize = (size) => {
28
- return `${getControlSizeTokens(size).segmentedFontSize}px`;
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;
@@ -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 === true).length;
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 }), visibleColumnCount === 0 && _jsx("div", { children: "No columns visible" }), virtualized === true ? (_jsx(VirtualizedRows, { tableDimensions: tableDimensions, targetElm: targetElm, listElm: listElm, rowHeight: rowHeight, headerRowHeight: headerRowHeight })) : (_jsx(StaticRows, { targetElm: targetElm, listElm: listElm }))] })] }));
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, toggleColumnVisibility, tableMenuOptions, runSearch, enableSelection, compactState, toggleCompact, totalRecords, getCalculatedSelectionTotal, handleTableExport, filterState, handleFilterChange, clearSearch, } = useTable();
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, buttonProps: {
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,
@@ -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;
@@ -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[];
@@ -0,0 +1,78 @@
1
+ export type ImageOcrProgress = {
2
+ status: string;
3
+ progress: number;
4
+ };
5
+ export type ImageOcrLine = {
6
+ text: string;
7
+ confidence?: number;
8
+ bbox?: {
9
+ x0: number;
10
+ y0: number;
11
+ x1: number;
12
+ y1: number;
13
+ };
14
+ };
15
+ export type ImageTextContent = {
16
+ text: string;
17
+ confidence?: number;
18
+ language: string;
19
+ lines: ImageOcrLine[];
20
+ };
21
+ export declare const ImageOcrPageSegModes: {
22
+ readonly OSD_ONLY: "0";
23
+ readonly AUTO_OSD: "1";
24
+ readonly AUTO_ONLY: "2";
25
+ readonly AUTO: "3";
26
+ readonly SINGLE_COLUMN: "4";
27
+ readonly SINGLE_BLOCK_VERT_TEXT: "5";
28
+ readonly SINGLE_BLOCK: "6";
29
+ readonly SINGLE_LINE: "7";
30
+ readonly SINGLE_WORD: "8";
31
+ readonly CIRCLE_WORD: "9";
32
+ readonly SINGLE_CHAR: "10";
33
+ readonly SPARSE_TEXT: "11";
34
+ readonly SPARSE_TEXT_OSD: "12";
35
+ readonly RAW_LINE: "13";
36
+ };
37
+ export type ImageOcrPageSegMode = (typeof ImageOcrPageSegModes)[keyof typeof ImageOcrPageSegModes];
38
+ export type ImageOcrPreprocessOptions = {
39
+ grayscale?: boolean;
40
+ contrast?: number;
41
+ scale?: number;
42
+ threshold?: number;
43
+ maxDimension?: number;
44
+ };
45
+ export type ImageOcrRectangle = {
46
+ left: number;
47
+ top: number;
48
+ width: number;
49
+ height: number;
50
+ };
51
+ export type ImageOcrRecognizeOptions = {
52
+ rectangle?: ImageOcrRectangle;
53
+ rotateAuto?: boolean;
54
+ rotateRadians?: number;
55
+ };
56
+ export type ImageOcrParameters = {
57
+ tessedit_pageseg_mode?: ImageOcrPageSegMode;
58
+ tessedit_char_whitelist?: string;
59
+ tessedit_char_blacklist?: string;
60
+ preserve_interword_spaces?: "0" | "1";
61
+ user_defined_dpi?: string;
62
+ [key: string]: string | undefined;
63
+ };
64
+ export type ImageOcrPreset = "default" | "document" | "driver-license";
65
+ export type GetImageTextContentOptions = {
66
+ language?: string;
67
+ preset?: ImageOcrPreset;
68
+ onProgress?: (progress: ImageOcrProgress) => void;
69
+ preprocess?: ImageOcrPreprocessOptions;
70
+ recognizeOptions?: ImageOcrRecognizeOptions;
71
+ parameters?: ImageOcrParameters;
72
+ workerOptions?: {
73
+ workerPath?: string;
74
+ corePath?: string;
75
+ langPath?: string;
76
+ };
77
+ };
78
+ export declare const getImageTextContent: (image: File, options?: GetImageTextContentOptions) => Promise<ImageTextContent>;