@topconsultnpm/sdkui-react-beta 6.13.34 → 6.13.35

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.
@@ -1,69 +0,0 @@
1
- import { ITMPanelProps } from './TMPanel';
2
- export declare const defaultTMPanelManagerToolbarStyles: {
3
- container: {
4
- backgroundColor: string;
5
- padding: string;
6
- };
7
- items: {
8
- width: string;
9
- height: string;
10
- inactiveBackgroundColor: string;
11
- activeBackgroundColor: string;
12
- borderRadius: string;
13
- marginBottom: string;
14
- iconFontSize: string;
15
- iconColor: string;
16
- };
17
- };
18
- export interface TMPanelManagerMatrixColumn {
19
- rows: Array<TMPanelManagerMatrixRow>;
20
- width?: string;
21
- }
22
- export interface ExtendedTMPanelProps extends ITMPanelProps {
23
- showCustomMaximizeMinimizeButton?: boolean;
24
- }
25
- export interface TMPanelManagerMatrixRow {
26
- id: string;
27
- hidden: boolean;
28
- content: JSX.Element | ((togglePanelVisibility: (toolbarItem: TMPanelManagerToolbarItem | undefined) => void, toogleMaximizeMinimizePanelCallback: (id: string) => void, toggleToolbarItemDisabled: (toolbarItem: TMPanelManagerToolbarItem | undefined) => void, toggleToolbarItemVisibility: (toolbarItem: TMPanelManagerToolbarItem | undefined) => void) => JSX.Element);
29
- height?: string;
30
- width?: string;
31
- panel?: ExtendedTMPanelProps;
32
- }
33
- export interface TMPanelManagerToolbarStyles {
34
- container?: {
35
- backgroundColor?: string;
36
- padding?: string;
37
- };
38
- items?: {
39
- width?: string;
40
- height?: string;
41
- inactiveBackgroundColor?: string;
42
- activeBackgroundColor?: string;
43
- borderRadius?: string;
44
- marginBottom?: string;
45
- iconFontSize?: string;
46
- iconColor?: string;
47
- };
48
- }
49
- export interface TMPanelManagerToolbarItem {
50
- id: string;
51
- icon: string | JSX.Element;
52
- tooltipName: string;
53
- panelManagerMatrixRowId: string;
54
- alternativePanelManagerMatrixRowId?: Array<string>;
55
- beginGroup?: boolean;
56
- disabled?: boolean;
57
- visible?: boolean;
58
- }
59
- export interface TMPanelManagerToolbar {
60
- items: Array<TMPanelManagerToolbarItem>;
61
- styles?: TMPanelManagerToolbarStyles;
62
- }
63
- export declare const calculatePanelSizes: (panelMatrixMap: Map<string, TMPanelManagerMatrixColumn>, hiddenIds: Set<string>) => Map<string, {
64
- height: string;
65
- }>;
66
- export declare const getInitialMobilePanelID: (panelMatrixMap: Map<string, TMPanelManagerMatrixColumn>) => string | undefined;
67
- export declare const DesktopToolbar: (toolbar: TMPanelManagerToolbar, hiddenPanelIds: Set<string>, togglePanelVisibility: (panel: TMPanelManagerToolbarItem) => void) => import("react/jsx-runtime").JSX.Element;
68
- export declare const MobileToolbar: (toolbar: TMPanelManagerToolbar, hiddenPanelIds: Set<string>, togglePanelVisibility: (panel: TMPanelManagerToolbarItem) => void) => import("react/jsx-runtime").JSX.Element;
69
- export declare const getDynamicColumnWidth: (col: TMPanelManagerMatrixColumn | undefined, hiddenPanelIds: Set<string>, allColumns: Array<TMPanelManagerMatrixColumn>) => string;
@@ -1,155 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { ScrollView } from "devextreme-react";
3
- import { SDKUI_Globals } from '../../helper';
4
- import TMTooltip from './TMTooltip';
5
- export const defaultTMPanelManagerToolbarStyles = {
6
- container: {
7
- backgroundColor: '#f0f0f0',
8
- padding: '6px'
9
- },
10
- items: {
11
- width: '35px',
12
- height: '35px',
13
- inactiveBackgroundColor: '#e57373',
14
- activeBackgroundColor: '#81c784',
15
- borderRadius: '50%',
16
- marginBottom: '6px',
17
- iconFontSize: "25px",
18
- iconColor: '#ffffff'
19
- }
20
- };
21
- ;
22
- // Helper to calculate sizes based on hidden panel IDs
23
- export const calculatePanelSizes = (panelMatrixMap, hiddenIds) => {
24
- const sizes = new Map();
25
- panelMatrixMap.forEach((column) => {
26
- const visiblePanels = column.rows.filter(p => !hiddenIds.has(p.id));
27
- const hiddenPanels = column.rows.filter(p => hiddenIds.has(p.id));
28
- if (visiblePanels.length > 0) {
29
- const totalVisibleHeight = visiblePanels.reduce((sum, panel) => {
30
- return sum + parseFloat(panel.height || '0');
31
- }, 0);
32
- visiblePanels.forEach(panel => {
33
- const originalHeight = parseFloat(panel.height || '0');
34
- const newHeightPercent = (originalHeight / totalVisibleHeight) * 100;
35
- sizes.set(panel.id, { height: `${newHeightPercent}%` });
36
- });
37
- }
38
- hiddenPanels.forEach(panel => {
39
- sizes.set(panel.id, { height: '0%' });
40
- });
41
- });
42
- return sizes;
43
- };
44
- export const getInitialMobilePanelID = (panelMatrixMap) => {
45
- const firstEntry = panelMatrixMap.values().next().value?.rows;
46
- if (!firstEntry)
47
- return undefined;
48
- const visiblePanel = firstEntry.find((row) => !row.hidden);
49
- return visiblePanel?.id;
50
- };
51
- export const DesktopToolbar = (toolbar, hiddenPanelIds, togglePanelVisibility) => {
52
- return _jsx("div", { style: {
53
- width: '40px',
54
- display: 'flex',
55
- flexDirection: 'column',
56
- justifyContent: 'flex-start',
57
- borderRadius: '8px',
58
- alignItems: 'center',
59
- marginLeft: SDKUI_Globals.userSettings.themeSettings.gutters,
60
- // customizable properties
61
- backgroundColor: toolbar.styles?.container?.backgroundColor ?? defaultTMPanelManagerToolbarStyles.container.backgroundColor,
62
- padding: toolbar.styles?.container?.padding ?? defaultTMPanelManagerToolbarStyles.container.padding,
63
- }, children: toolbar.items.filter(item => item.visible !== false).map((item, index) => {
64
- return _jsxs("div", { children: [item.beginGroup && index !== 0 && (_jsx("hr", { style: { margin: '10px 0', borderTop: '1px solid #c6c6c6', width: '100%' } })), _jsx("button", { disabled: item.disabled ?? false, style: {
65
- display: 'flex',
66
- justifyContent: 'center',
67
- alignItems: 'center',
68
- border: 'none',
69
- cursor: 'pointer',
70
- transition: 'background-color 0.3s, transform 0.2s',
71
- // customizable properties
72
- width: toolbar.styles?.items?.width ?? defaultTMPanelManagerToolbarStyles.items.width,
73
- height: toolbar.styles?.items?.height ?? defaultTMPanelManagerToolbarStyles.items.height,
74
- backgroundColor: item.disabled ? '#cccccc'
75
- : hiddenPanelIds.has(item.panelManagerMatrixRowId)
76
- ? toolbar.styles?.items?.inactiveBackgroundColor ?? defaultTMPanelManagerToolbarStyles.items.inactiveBackgroundColor
77
- : toolbar.styles?.items?.activeBackgroundColor ?? defaultTMPanelManagerToolbarStyles.items.activeBackgroundColor,
78
- borderRadius: toolbar.styles?.items?.borderRadius ?? defaultTMPanelManagerToolbarStyles.items.borderRadius,
79
- marginBottom: toolbar.styles?.items?.marginBottom ?? defaultTMPanelManagerToolbarStyles.items.marginBottom,
80
- }, onMouseEnter: (e) => {
81
- e.currentTarget.style.transform = 'scale(1.1)';
82
- }, onMouseLeave: (e) => {
83
- e.currentTarget.style.transform = 'scale(1)';
84
- }, onClick: () => togglePanelVisibility(item), children: _jsx(TMTooltip, { content: item.tooltipName, children: typeof item.icon === 'string' ? _jsx("i", { className: `dx-icon dx-icon-${item.icon}`, style: { fontSize: toolbar.styles?.items?.iconFontSize ?? defaultTMPanelManagerToolbarStyles.items.iconFontSize, color: toolbar.styles?.items?.iconColor ?? defaultTMPanelManagerToolbarStyles.items.iconColor } }) : item.icon }) })] }, "TMPanelManagerMatrix-Desktop-Toolbar-Item-" + item.id);
85
- }) }, "TMPanelManagerMatrix-Desktop-Toolbar");
86
- };
87
- export const MobileToolbar = (toolbar, hiddenPanelIds, togglePanelVisibility) => {
88
- return _jsx("div", { style: {
89
- width: '100%',
90
- height: '60px',
91
- background: 'linear-gradient(135deg, #e0eafc, #cfdef3)',
92
- display: 'flex',
93
- flexDirection: 'column',
94
- justifyContent: 'center',
95
- borderRadius: '12px',
96
- boxShadow: '0 6px 10px rgba(0, 0, 0, 0.15)',
97
- alignItems: 'center',
98
- padding: '5px',
99
- }, children: _jsx("div", { style: {
100
- display: "flex",
101
- overflow: "hidden",
102
- borderRadius: "12px",
103
- backgroundColor: "#ffffff",
104
- boxShadow: "0 6px 12px rgba(0,0,0,0.1)",
105
- width: "100%",
106
- height: '100%',
107
- }, children: _jsx(ScrollView, { direction: "horizontal", showScrollbar: "always", useNative: Number(SDKUI_Globals.userSettings?.themeSettings.gridSettings.useNativeScrollbar) === 1, style: { whiteSpace: "nowrap", width: "100%" }, children: _jsx("div", { style: { display: "flex", gap: "8px", justifyContent: "center", padding: "5px" }, children: toolbar.items.filter(item => item.visible !== false).map((item, index) => {
108
- return _jsxs("div", { style: { display: "flex", flexDirection: "row", alignItems: "center" }, children: [item.beginGroup && index !== 0 && (_jsx("div", { style: { height: '35px', width: '1px', backgroundColor: '#c6c6c6', margin: '0 8px' } })), _jsx("button", { disabled: item.disabled ?? false, style: {
109
- display: 'flex',
110
- justifyContent: 'center',
111
- alignItems: 'center',
112
- border: 'none',
113
- cursor: 'pointer',
114
- transition: 'background-color 0.3s, transform 0.2s',
115
- // customizable properties
116
- width: toolbar.styles?.items?.width ?? defaultTMPanelManagerToolbarStyles.items.width,
117
- height: toolbar.styles?.items?.height ?? defaultTMPanelManagerToolbarStyles.items.height,
118
- backgroundColor: item.disabled ? '#cccccc'
119
- : hiddenPanelIds.has(item.panelManagerMatrixRowId)
120
- ? toolbar.styles?.items?.inactiveBackgroundColor ?? defaultTMPanelManagerToolbarStyles.items.inactiveBackgroundColor
121
- : toolbar.styles?.items?.activeBackgroundColor ?? defaultTMPanelManagerToolbarStyles.items.activeBackgroundColor,
122
- borderRadius: toolbar.styles?.items?.borderRadius ?? defaultTMPanelManagerToolbarStyles.items.borderRadius,
123
- marginBottom: toolbar.styles?.items?.marginBottom ?? defaultTMPanelManagerToolbarStyles.items.marginBottom,
124
- }, onMouseEnter: (e) => {
125
- e.currentTarget.style.transform = 'scale(1.1)';
126
- }, onMouseLeave: (e) => {
127
- e.currentTarget.style.transform = 'scale(1)';
128
- }, onClick: () => togglePanelVisibility(item), children: _jsx(TMTooltip, { content: item.tooltipName, children: typeof item.icon === 'string' ? _jsx("i", { className: `dx-icon dx-icon-${item.icon}`, style: { fontSize: toolbar.styles?.items?.iconFontSize ?? defaultTMPanelManagerToolbarStyles.items.iconFontSize, color: toolbar.styles?.items?.iconColor ?? defaultTMPanelManagerToolbarStyles.items.iconColor } }) : item.icon }) })] }, "TMPanelManagerMatrix-Mobile-Toolbar-Item-" + item.id);
129
- }) }) }) }) }, "TMPanelManagerMatrix-Mobile-Toolbar");
130
- };
131
- export const getDynamicColumnWidth = (col, hiddenPanelIds, allColumns) => {
132
- if (!col)
133
- return '100%';
134
- // If all rows in the column are hidden, return width 0%
135
- const allRowsHidden = col.rows.every(row => hiddenPanelIds.has(row.id));
136
- if (allRowsHidden)
137
- return '100%';
138
- // Calculate which columns are visible (at least one row not hidden)
139
- const visibleColumns = allColumns.filter(c => c.rows.some(r => !hiddenPanelIds.has(r.id)));
140
- const visibleCount = visibleColumns.length;
141
- // If all columns are visible, use the original widths
142
- if (visibleCount === allColumns.length) {
143
- return col.width ?? `${100 / visibleCount}%`;
144
- }
145
- // If some columns are hidden, redistribute the 100% width among visible columns
146
- // proportionally to their original widths
147
- // First, sum the original widths (in percent) of the visible columns
148
- const totalPercent = visibleColumns.reduce((sum, c) => {
149
- const w = c.width ? parseFloat(c.width) : (100 / visibleCount);
150
- return sum + w;
151
- }, 0);
152
- // Calculate the width percentage for this column based on its original width proportion
153
- const thisPercent = col.width ? parseFloat(col.width) : (100 / visibleCount);
154
- return `${(thisPercent / totalPercent) * 100}%`;
155
- };