@topconsultnpm/sdkui-react 6.20.0-dev1.99 → 6.20.0-dev2.10
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/lib/assets/headergradient.svg +87 -0
- package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +56 -18
- package/lib/components/NewComponents/ContextMenu/styles.js +13 -34
- package/lib/components/NewComponents/ContextMenu/types.d.ts +8 -2
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +315 -271
- package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +4 -0
- package/lib/components/NewComponents/FloatingMenuBar/styles.js +6 -2
- package/lib/components/NewComponents/FloatingMenuBar/types.d.ts +7 -4
- package/lib/components/base/TMButton.js +6 -0
- package/lib/components/base/TMClosableList.js +4 -0
- package/lib/components/base/TMDropDownMenu.js +2 -0
- package/lib/components/base/TMListView.js +1 -1
- package/lib/components/base/TMPanel.d.ts +1 -1
- package/lib/components/base/TMPanel.js +9 -5
- package/lib/components/base/TMPopUp.js +6 -0
- package/lib/components/base/TMToolbarCard.js +2 -0
- package/lib/components/base/TMTreeView.d.ts +2 -1
- package/lib/components/base/TMTreeView.js +33 -26
- package/lib/components/choosers/TMDataListItemChooser.d.ts +2 -0
- package/lib/components/choosers/TMDataListItemChooser.js +8 -2
- package/lib/components/choosers/TMDcmtTypeChooser.d.ts +1 -0
- package/lib/components/choosers/TMDcmtTypeChooser.js +11 -3
- package/lib/components/choosers/TMDistinctValues.js +2 -2
- package/lib/components/choosers/TMDynDataListItemChooser.d.ts +2 -0
- package/lib/components/choosers/TMDynDataListItemChooser.js +19 -8
- package/lib/components/choosers/TMMetadataChooser.d.ts +2 -0
- package/lib/components/choosers/TMMetadataChooser.js +11 -3
- package/lib/components/choosers/TMUserChooser.d.ts +2 -0
- package/lib/components/choosers/TMUserChooser.js +8 -2
- package/lib/components/editors/TMCheckBox.js +2 -0
- package/lib/components/editors/TMDateBox.js +18 -9
- package/lib/components/editors/TMEditorStyled.js +7 -0
- package/lib/components/editors/TMLocalizedTextBox.d.ts +3 -1
- package/lib/components/editors/TMLocalizedTextBox.js +16 -14
- package/lib/components/editors/TMMetadataEditor.d.ts +1 -0
- package/lib/components/editors/TMMetadataEditor.js +4 -4
- package/lib/components/editors/TMMetadataTextBox.d.ts +9 -0
- package/lib/components/editors/TMMetadataTextBox.js +92 -0
- package/lib/components/editors/TMMetadataValues.d.ts +2 -0
- package/lib/components/editors/TMMetadataValues.js +6 -4
- package/lib/components/editors/TMRadioButton.js +2 -0
- package/lib/components/editors/TMTextBox.d.ts +1 -1
- package/lib/components/editors/TMTextBox.js +23 -1
- package/lib/components/editors/TMTextExpression.js +6 -91
- package/lib/components/features/assistant/TMToppyDraggableHelpCenter.js +2 -0
- package/lib/components/features/documents/TMDcmtBlog.js +1 -1
- package/lib/components/features/documents/TMDcmtForm.js +126 -88
- package/lib/components/features/documents/TMDcmtPreview.js +92 -42
- package/lib/components/features/search/TMSearch.js +5 -1
- package/lib/components/features/search/TMSearchQueryEditor.d.ts +1 -0
- package/lib/components/features/search/TMSearchQueryEditor.js +10 -10
- package/lib/components/features/search/TMSearchQueryPanel.js +24 -10
- package/lib/components/features/search/TMSearchResult.js +198 -13
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +1 -1
- package/lib/components/features/search/TMSearchResultsMenuItems.js +24 -4
- package/lib/components/features/search/TMViewHistoryDcmt.js +45 -50
- package/lib/components/features/tasks/TMTaskForm.js +55 -24
- package/lib/components/features/tasks/TMTasksUtils.js +14 -1
- package/lib/components/features/workflow/TMWorkflowPopup.js +5 -4
- package/lib/components/features/workflow/diagram/DiagramItemComponent.js +2 -0
- package/lib/components/features/workflow/diagram/DiagramItemForm.js +1 -1
- package/lib/components/features/workflow/diagram/WFDiagram.js +1 -1
- package/lib/components/forms/Login/TMLoginForm.js +1 -1
- package/lib/components/grids/TMValidationItemsList.js +6 -0
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +1 -0
- package/lib/components/layout/panelManager/TMPanelManagerContainer.js +3 -2
- package/lib/components/layout/panelManager/TMPanelManagerContext.js +13 -5
- package/lib/components/query/TMQueryEditor.d.ts +4 -0
- package/lib/components/query/TMQueryEditor.js +14 -10
- package/lib/components/sidebar/TMHeader.js +11 -7
- package/lib/components/sidebar/TMSidebar.d.ts +0 -1
- package/lib/components/sidebar/TMSidebar.js +16 -44
- package/lib/components/sidebar/TMSidebarItem.js +36 -17
- package/lib/helper/SDKUI_Globals.d.ts +3 -0
- package/lib/helper/SDKUI_Globals.js +6 -3
- package/lib/helper/SDKUI_Localizator.d.ts +4 -16
- package/lib/helper/SDKUI_Localizator.js +37 -157
- package/lib/helper/TMIcons.d.ts +1 -0
- package/lib/helper/TMIcons.js +3 -0
- package/lib/helper/TMToppyMessage.js +4 -0
- package/lib/helper/TMUtils.d.ts +20 -1
- package/lib/helper/TMUtils.js +71 -1
- package/lib/helper/helpers.d.ts +27 -1
- package/lib/helper/helpers.js +107 -1
- package/lib/helper/queryHelper.d.ts +1 -1
- package/lib/helper/queryHelper.js +24 -1
- package/lib/hooks/useFloatingBarPinnedItems.d.ts +11 -0
- package/lib/hooks/useFloatingBarPinnedItems.js +54 -0
- package/lib/hooks/useMetadataExpression.d.ts +19 -0
- package/lib/hooks/useMetadataExpression.js +99 -0
- package/lib/ts/types.d.ts +3 -0
- package/package.json +55 -55
|
@@ -7,17 +7,21 @@ export declare const FloatingContainer: import("styled-components/dist/types").I
|
|
|
7
7
|
$x: number;
|
|
8
8
|
$y: number;
|
|
9
9
|
$orientation: "horizontal" | "vertical";
|
|
10
|
+
$verticalDirection: "down" | "up";
|
|
10
11
|
$isDragging: boolean;
|
|
11
12
|
$isConfigMode: boolean;
|
|
12
13
|
$isConstrained?: boolean;
|
|
14
|
+
$isHidden?: boolean;
|
|
13
15
|
$bgColor?: string;
|
|
14
16
|
}>, {
|
|
15
17
|
$x: number;
|
|
16
18
|
$y: number;
|
|
17
19
|
$orientation: "horizontal" | "vertical";
|
|
20
|
+
$verticalDirection: "down" | "up";
|
|
18
21
|
$isDragging: boolean;
|
|
19
22
|
$isConfigMode: boolean;
|
|
20
23
|
$isConstrained?: boolean;
|
|
24
|
+
$isHidden?: boolean;
|
|
21
25
|
$bgColor?: string;
|
|
22
26
|
}>> & string;
|
|
23
27
|
export declare const GripHandle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
@@ -39,7 +39,9 @@ export const FloatingContainer = styled.div.attrs(props => ({
|
|
|
39
39
|
position: ${props => props.$isConstrained ? 'absolute' : 'fixed'};
|
|
40
40
|
z-index: ${props => props.$isConfigMode ? 9999 : 1500};
|
|
41
41
|
display: flex;
|
|
42
|
-
|
|
42
|
+
opacity: ${props => props.$isHidden ? 0 : 1};
|
|
43
|
+
pointer-events: ${props => props.$isHidden ? 'none' : 'auto'};
|
|
44
|
+
flex-direction: ${props => props.$orientation === 'horizontal' ? 'row' : (props.$verticalDirection === 'up' ? 'column-reverse' : 'column')};
|
|
43
45
|
align-items: center;
|
|
44
46
|
background: ${props => props.$bgColor || 'linear-gradient(135deg, #0071BC 0%, #1B1464 100%)'};
|
|
45
47
|
border: 1px solid #667eea;
|
|
@@ -50,6 +52,8 @@ export const FloatingContainer = styled.div.attrs(props => ({
|
|
|
50
52
|
0 6px 16px rgba(0, 0, 0, 0.2);
|
|
51
53
|
cursor: ${props => props.$isDragging ? 'grabbing' : 'default'};
|
|
52
54
|
user-select: none;
|
|
55
|
+
-webkit-touch-callout: none;
|
|
56
|
+
-webkit-user-select: none;
|
|
53
57
|
animation: ${props => props.$isConfigMode && css `${shake} 0.3s ease-in-out`};
|
|
54
58
|
transition: none;
|
|
55
59
|
|
|
@@ -136,7 +140,7 @@ export const ItemSeparator = styled.div `
|
|
|
136
140
|
` : `
|
|
137
141
|
/* Normal mode: simple line with tight spacing */
|
|
138
142
|
background: rgba(255, 255, 255, 0.25);
|
|
139
|
-
width: ${props.$orientation === 'horizontal' ? '1px' : '
|
|
143
|
+
width: ${props.$orientation === 'horizontal' ? '1px' : '20px'};
|
|
140
144
|
height: ${props.$orientation === 'horizontal' ? '20px' : '1px'};
|
|
141
145
|
margin: ${props.$orientation === 'horizontal' ? '0 2px' : '2px 0'};
|
|
142
146
|
`}
|
|
@@ -16,11 +16,14 @@ export interface TMFloatingMenuBarProps {
|
|
|
16
16
|
isConstrained?: boolean;
|
|
17
17
|
defaultPosition?: Position;
|
|
18
18
|
maxItems?: number;
|
|
19
|
-
|
|
19
|
+
defaultPinnedItems?: string[];
|
|
20
20
|
defaultOrientation?: 'horizontal' | 'vertical';
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
fixedItems?: TMFloatingMenuItem[];
|
|
22
|
+
enableConfigMode?: boolean;
|
|
23
23
|
bgColor?: string;
|
|
24
|
+
hasContextMenu?: boolean;
|
|
25
|
+
pinnedItemIds?: string[];
|
|
26
|
+
onPinChange?: (pinnedIds: string[]) => void;
|
|
24
27
|
}
|
|
25
28
|
export interface Position {
|
|
26
29
|
x: number;
|
|
@@ -29,8 +32,8 @@ export interface Position {
|
|
|
29
32
|
export interface TMFloatingMenuBarState {
|
|
30
33
|
position: Position;
|
|
31
34
|
isDragging: boolean;
|
|
32
|
-
isConfigMode: boolean;
|
|
33
35
|
orientation: 'horizontal' | 'vertical';
|
|
36
|
+
verticalDirection: 'down' | 'up';
|
|
34
37
|
items: TMFloatingMenuItem[];
|
|
35
38
|
draggedItemIndex: number | null;
|
|
36
39
|
}
|
|
@@ -61,6 +61,8 @@ const StyledIconButton = styled.button.withConfig({ shouldForwardProp: prop => !
|
|
|
61
61
|
background-color: transparent;
|
|
62
62
|
color: ${props => !props.disabled ? getColor(props.color) : 'rgb(180, 180, 180)'};
|
|
63
63
|
user-select: none;
|
|
64
|
+
-webkit-touch-callout: none;
|
|
65
|
+
-webkit-user-select: none;
|
|
64
66
|
`;
|
|
65
67
|
const StyledTextButton = styled.button.withConfig({ shouldForwardProp: prop => !['text'].includes(prop) }) `
|
|
66
68
|
font-size: ${props => props.fontSize};
|
|
@@ -79,6 +81,8 @@ const StyledTextButton = styled.button.withConfig({ shouldForwardProp: prop => !
|
|
|
79
81
|
background-color: transparent;
|
|
80
82
|
color: ${props => !props.disabled ? getColor(props.color) : 'rgb(231, 231, 231)'};
|
|
81
83
|
user-select: none;
|
|
84
|
+
-webkit-touch-callout: none;
|
|
85
|
+
-webkit-user-select: none;
|
|
82
86
|
transition: ease 200ms;
|
|
83
87
|
&:hover {
|
|
84
88
|
background-color: rgb(241, 241, 241);
|
|
@@ -118,6 +122,8 @@ const StyledAdvancedButton = styled.button `
|
|
|
118
122
|
overflow: hidden;
|
|
119
123
|
color: ${({ $isPrimaryOutline }) => $isPrimaryOutline ? TMColors.primaryColor : 'white'};
|
|
120
124
|
user-select: none;
|
|
125
|
+
-webkit-touch-callout: none;
|
|
126
|
+
-webkit-user-select: none;
|
|
121
127
|
border: ${({ $isPrimaryOutline }) => $isPrimaryOutline ? `1px solid ${TMColors.primaryColor}` : 'none'};
|
|
122
128
|
background: ${({ $isPrimaryOutline }) => $isPrimaryOutline ? 'white' : 'unset'};
|
|
123
129
|
`;
|
|
@@ -49,6 +49,8 @@ const StyledClosabelIcon = styled.div `
|
|
|
49
49
|
justify-content: flex-start;
|
|
50
50
|
padding: 2px;
|
|
51
51
|
user-select: none;
|
|
52
|
+
-webkit-touch-callout: none;
|
|
53
|
+
-webkit-user-select: none;
|
|
52
54
|
`;
|
|
53
55
|
const StyledClosableItemsCount = styled.div `
|
|
54
56
|
/* color: ${Colors.primary}; */
|
|
@@ -56,6 +58,8 @@ const StyledClosableItemsCount = styled.div `
|
|
|
56
58
|
cursor: pointer;
|
|
57
59
|
margin-right: 5px;
|
|
58
60
|
user-select: none;
|
|
61
|
+
-webkit-touch-callout: none;
|
|
62
|
+
-webkit-user-select: none;
|
|
59
63
|
`;
|
|
60
64
|
const TMClosableList = ({ dataSource, visibility = false, label, inline = false, hasPadding = true }) => {
|
|
61
65
|
const [status, setStatus] = useState(visibility);
|
|
@@ -12,6 +12,8 @@ const StyledContent = styled.div `
|
|
|
12
12
|
opacity: ${props => props.$disabled ? 0.4 : 1};
|
|
13
13
|
pointer-events: ${props => props.$disabled ? 'none' : ''};
|
|
14
14
|
user-select: none;
|
|
15
|
+
-webkit-touch-callout: none;
|
|
16
|
+
-webkit-user-select: none;
|
|
15
17
|
display: flex;
|
|
16
18
|
align-items: center;
|
|
17
19
|
|
|
@@ -246,7 +246,7 @@ const TMListView = ({ customGroupingHeaders, headerBackGroundColor, header, show
|
|
|
246
246
|
onClick: () => { setOrderedBy(key); setShowOrderOptions(false); setOrderMenuVisible(false); },
|
|
247
247
|
icon: _jsx(IconColumns, { fontSize: 16 }),
|
|
248
248
|
name: key,
|
|
249
|
-
|
|
249
|
+
rightIconProps: key === orderedBy ? { icon: _jsx(IconApply, { fontSize: 14, color: 'gray' }) } : undefined
|
|
250
250
|
});
|
|
251
251
|
}
|
|
252
252
|
}
|
|
@@ -5,9 +5,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
5
5
|
*/
|
|
6
6
|
import { useCallback, useRef, useState, forwardRef, useImperativeHandle } from 'react';
|
|
7
7
|
import styled from 'styled-components';
|
|
8
|
-
import { IconArrowLeft, IconClearButton, IconWindowMaximize, IconWindowMinimize, isPositiveNumber, SDKUI_Localizator } from '../../helper';
|
|
8
|
+
import { getAppModuleGradient, IconArrowLeft, IconClearButton, IconWindowMaximize, IconWindowMinimize, isPositiveNumber, SDKUI_Localizator } from '../../helper';
|
|
9
9
|
import TMButton from './TMButton';
|
|
10
10
|
import { Gutters } from '../../utils/theme';
|
|
11
|
+
import { AppModules, SDK_Globals } from '@topconsultnpm/sdk-ts';
|
|
11
12
|
const StyledPanelContainer = styled.div `
|
|
12
13
|
width: 100%;
|
|
13
14
|
height: 100%;
|
|
@@ -34,8 +35,9 @@ const StyledPanelHeader = styled.div `
|
|
|
34
35
|
align-items: center;
|
|
35
36
|
justify-content: flex-start;
|
|
36
37
|
padding: 4px 10px;
|
|
37
|
-
background: ${({ $isActive, $backgroundColor }) => $isActive
|
|
38
|
-
?
|
|
38
|
+
background: ${({ $isActive, $backgroundColor, $activeGradient }) => $isActive
|
|
39
|
+
? ($activeGradient ??
|
|
40
|
+
'linear-gradient(270deg, #46B5A2 16%, #3BAABC 34%, #3BAABC 34%, #3681AD 54%, #3368A5 72%, #2F549D 88%, #304F99 100%)')
|
|
39
41
|
: ($backgroundColor ?? '#F4F4F4')};
|
|
40
42
|
box-shadow: 3px 3px 5px #D3D3D3BF;
|
|
41
43
|
color: ${({ $isActive, $color }) => $isActive ? '#FFFFFF' : ($color ?? '#2559A5')};
|
|
@@ -65,6 +67,8 @@ const StyledPanelContent = styled.div `
|
|
|
65
67
|
justify-content: space-between;
|
|
66
68
|
position: relative;
|
|
67
69
|
user-select: none;
|
|
70
|
+
-webkit-touch-callout: none;
|
|
71
|
+
-webkit-user-select: none;
|
|
68
72
|
outline: none;
|
|
69
73
|
&:focus {
|
|
70
74
|
outline: none;
|
|
@@ -139,7 +143,7 @@ onActivate, onBack, onClose, onHeaderDoubleClick, onMaximize, onActiveChanged },
|
|
|
139
143
|
onHeaderDoubleClick();
|
|
140
144
|
else
|
|
141
145
|
allowMaximize && handleMaximize();
|
|
142
|
-
}, children: _jsxs("div", { style: {
|
|
146
|
+
}, "$activeGradient": getAppModuleGradient(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER), children: _jsxs("div", { style: {
|
|
143
147
|
display: 'flex',
|
|
144
148
|
flexDirection: 'row',
|
|
145
149
|
alignItems: 'center',
|
|
@@ -158,7 +162,7 @@ onActivate, onBack, onClose, onHeaderDoubleClick, onMaximize, onActiveChanged },
|
|
|
158
162
|
flexDirection: 'row',
|
|
159
163
|
alignItems: 'center',
|
|
160
164
|
overflow: 'hidden',
|
|
161
|
-
}, children: _jsxs("
|
|
165
|
+
}, children: _jsxs("div", { style: {
|
|
162
166
|
whiteSpace: 'nowrap',
|
|
163
167
|
overflow: 'hidden',
|
|
164
168
|
textOverflow: 'ellipsis',
|
|
@@ -31,6 +31,8 @@ const StyledExeptionToolbar = styled.div `
|
|
|
31
31
|
gap: 5px;
|
|
32
32
|
padding: 5px;
|
|
33
33
|
user-select: none;
|
|
34
|
+
-webkit-touch-callout: none;
|
|
35
|
+
-webkit-user-select: none;
|
|
34
36
|
border-top: 1px solid #f3f3f3;
|
|
35
37
|
/* background-color: ${TMColors.primary_container}; */
|
|
36
38
|
background-color: white;
|
|
@@ -45,6 +47,8 @@ const StyledMessageToolbar = styled.div `
|
|
|
45
47
|
gap: clamp(2px, 1vw, 5px);
|
|
46
48
|
padding: clamp(3px, 1vw, 5px);
|
|
47
49
|
user-select: none;
|
|
50
|
+
-webkit-touch-callout: none;
|
|
51
|
+
-webkit-user-select: none;
|
|
48
52
|
border-top: 1px solid #f3f3f3;
|
|
49
53
|
background-color: #ffffff;
|
|
50
54
|
z-index: 1;
|
|
@@ -69,6 +73,8 @@ const TabContextContainer = styled.div `
|
|
|
69
73
|
border-radius: 5px;
|
|
70
74
|
overflow: auto;
|
|
71
75
|
user-select: none;
|
|
76
|
+
-webkit-touch-callout: none;
|
|
77
|
+
-webkit-user-select: none;
|
|
72
78
|
position: relative;
|
|
73
79
|
`;
|
|
74
80
|
const StyledAppVersionText = styled.p `
|
|
@@ -42,6 +42,8 @@ const StyledSearchCardContent = styled.div `
|
|
|
42
42
|
|
|
43
43
|
position: relative;
|
|
44
44
|
user-select: none;
|
|
45
|
+
-webkit-touch-callout: none;
|
|
46
|
+
-webkit-user-select: none;
|
|
45
47
|
`;
|
|
46
48
|
const TMToolbarCard = ({ items = [], onItemClick, selectedItem, showPanel, color = TMColors.colorHeader, backgroundColor = TMColors.backgroundColorHeader, backgroundColorContainer, children, showHeader = true, title, totalItems, displayedItemsCount, toolbar, padding = '3px', onBack, onClose, onHeaderDoubleClick }) => {
|
|
47
49
|
return (_jsxs(StyledSearchCard, { children: [showHeader && _jsx(StyledSearchCardHeader, { "$backgroundColor": backgroundColor, "$color": color, onDoubleClick: () => { if (onHeaderDoubleClick)
|
|
@@ -22,10 +22,11 @@ interface ITMTreeViewProps<T extends ITMTreeItem> {
|
|
|
22
22
|
onNodeUpdate?: (updatedNode: T) => void;
|
|
23
23
|
onDataChanged?: (items: T[]) => void;
|
|
24
24
|
shouldDelayFocusOnEvent?: (node: T, event: React.MouseEvent) => boolean;
|
|
25
|
+
autoSelectChildren?: boolean;
|
|
25
26
|
itemsPerPage?: number;
|
|
26
27
|
showLoadMoreButton?: boolean;
|
|
27
28
|
}
|
|
28
|
-
declare const TMTreeView: <T extends ITMTreeItem>({ dataSource, focusedItem, selectedItems, allowMultipleSelection, onDataChanged, calculateItemsForNode, itemRender, onNodeUpdate, onFocusedItemChanged, onSelectionChanged, shouldDelayFocusOnEvent, itemsPerPage, showLoadMoreButton }: ITMTreeViewProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
declare const TMTreeView: <T extends ITMTreeItem>({ dataSource, focusedItem, selectedItems, allowMultipleSelection, onDataChanged, calculateItemsForNode, itemRender, onNodeUpdate, onFocusedItemChanged, onSelectionChanged, shouldDelayFocusOnEvent, autoSelectChildren, itemsPerPage, showLoadMoreButton }: ITMTreeViewProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
29
30
|
export default TMTreeView;
|
|
30
31
|
export declare const StyledTreeNode: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
31
32
|
$isSelected?: boolean;
|
|
@@ -3,7 +3,7 @@ import { useCallback, useEffect, useRef } from 'react';
|
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import { IconChevronDown, IconChevronRight } from '../../helper';
|
|
5
5
|
import TMButton from './TMButton';
|
|
6
|
-
const TMTreeView = ({ dataSource = [], focusedItem, selectedItems = [], allowMultipleSelection, onDataChanged, calculateItemsForNode, itemRender, onNodeUpdate, onFocusedItemChanged, onSelectionChanged, shouldDelayFocusOnEvent, itemsPerPage = 100, showLoadMoreButton = true }) => {
|
|
6
|
+
const TMTreeView = ({ dataSource = [], focusedItem, selectedItems = [], allowMultipleSelection, onDataChanged, calculateItemsForNode, itemRender, onNodeUpdate, onFocusedItemChanged, onSelectionChanged, shouldDelayFocusOnEvent, autoSelectChildren = true, itemsPerPage = 100, showLoadMoreButton = true }) => {
|
|
7
7
|
useEffect(() => {
|
|
8
8
|
const handleKeyDown = (event) => {
|
|
9
9
|
if (!focusedItem)
|
|
@@ -187,47 +187,51 @@ const TMTreeView = ({ dataSource = [], focusedItem, selectedItems = [], allowMul
|
|
|
187
187
|
};
|
|
188
188
|
let newSelectedItems;
|
|
189
189
|
if (checked) {
|
|
190
|
-
if (node.isContainer) {
|
|
191
|
-
// Quando selezioni un container, aggiungi il container stesso + tutti i figli
|
|
190
|
+
if (node.isContainer && autoSelectChildren) {
|
|
191
|
+
// Quando selezioni un container, aggiungi il container stesso + tutti i figli (se autoSelectChildren è true)
|
|
192
192
|
const allChildren = flattenTree(node.items || []);
|
|
193
193
|
newSelectedItems = [...selectedItems, node, ...allChildren];
|
|
194
194
|
}
|
|
195
195
|
else if (!selectedItems.some(item => item.key === node.key)) {
|
|
196
|
-
// Quando selezioni un figlio, aggiungi il
|
|
196
|
+
// Quando selezioni un figlio o un container con autoSelectChildren=false, aggiungi solo il nodo
|
|
197
197
|
newSelectedItems = [...selectedItems, node];
|
|
198
|
-
// Verifica se selezionando questo figlio sono ora selezionati tutti i figli del parent
|
|
199
|
-
|
|
200
|
-
|
|
198
|
+
// Verifica se selezionando questo figlio sono ora selezionati tutti i figli del parent (solo se autoSelectChildren è true)
|
|
199
|
+
if (autoSelectChildren) {
|
|
200
|
+
const parentsToAdd = findAndCheckParents(dataSource, node, newSelectedItems);
|
|
201
|
+
newSelectedItems = [...newSelectedItems, ...parentsToAdd];
|
|
202
|
+
}
|
|
201
203
|
}
|
|
202
204
|
else {
|
|
203
205
|
newSelectedItems = selectedItems;
|
|
204
206
|
}
|
|
205
207
|
}
|
|
206
|
-
else if (node.isContainer) {
|
|
207
|
-
// Quando deselezioni un container, rimuovi il container stesso + tutti i figli
|
|
208
|
+
else if (node.isContainer && autoSelectChildren) {
|
|
209
|
+
// Quando deselezioni un container, rimuovi il container stesso + tutti i figli (solo se autoSelectChildren è true)
|
|
208
210
|
const childKeys = flattenTree(node.items || []).map(item => item.key);
|
|
209
211
|
newSelectedItems = selectedItems.filter(item => item.key !== node.key && !childKeys.includes(item.key));
|
|
210
212
|
}
|
|
211
213
|
else {
|
|
212
|
-
// Quando deselezioni un figlio, rimuovi il
|
|
214
|
+
// Quando deselezioni un figlio o un container con autoSelectChildren=false, rimuovi solo il nodo
|
|
213
215
|
newSelectedItems = selectedItems.filter(item => item.key !== node.key);
|
|
214
|
-
// Se il figlio apparteneva a un parent che era selezionato, rimuovi anche il parent
|
|
215
|
-
|
|
216
|
-
const
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
216
|
+
// Se il figlio apparteneva a un parent che era selezionato, rimuovi anche il parent (solo se autoSelectChildren è true)
|
|
217
|
+
if (autoSelectChildren && !node.isContainer) {
|
|
218
|
+
const removeParentContainers = (items) => {
|
|
219
|
+
const parentsToRemove = [];
|
|
220
|
+
items.forEach(item => {
|
|
221
|
+
if (item.isContainer && item.items) {
|
|
222
|
+
const childKeys = flattenTree(item.items).map(child => child.key);
|
|
223
|
+
if (childKeys.includes(node.key)) {
|
|
224
|
+
parentsToRemove.push(item.key);
|
|
225
|
+
}
|
|
226
|
+
// Ricorsione per parent annidati
|
|
227
|
+
parentsToRemove.push(...removeParentContainers(item.items));
|
|
222
228
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}
|
|
229
|
-
const parentsToRemove = removeParentContainers(dataSource);
|
|
230
|
-
newSelectedItems = newSelectedItems.filter(item => !parentsToRemove.includes(item.key));
|
|
229
|
+
});
|
|
230
|
+
return parentsToRemove;
|
|
231
|
+
};
|
|
232
|
+
const parentsToRemove = removeParentContainers(dataSource);
|
|
233
|
+
newSelectedItems = newSelectedItems.filter(item => !parentsToRemove.includes(item.key));
|
|
234
|
+
}
|
|
231
235
|
}
|
|
232
236
|
onSelectionChanged?.(newSelectedItems);
|
|
233
237
|
};
|
|
@@ -252,6 +256,9 @@ const TMTreeView = ({ dataSource = [], focusedItem, selectedItems = [], allowMul
|
|
|
252
256
|
// setTreeData(prevData => collapseAll(prevData));
|
|
253
257
|
// };
|
|
254
258
|
const isIndeterminate = (node) => {
|
|
259
|
+
// Lo stato indeterminate ha senso solo quando autoSelectChildren è true
|
|
260
|
+
if (!autoSelectChildren)
|
|
261
|
+
return false;
|
|
255
262
|
if (!node.isContainer || !node.items)
|
|
256
263
|
return false;
|
|
257
264
|
const childKeys = flattenTree(node.items).map(item => item.key);
|
|
@@ -8,6 +8,8 @@ interface ITMDataListItemChooserProps extends ITMChooserProps {
|
|
|
8
8
|
values?: string[];
|
|
9
9
|
/** Visualizza il bordo */
|
|
10
10
|
showBorder?: boolean;
|
|
11
|
+
/** Funzione per aggiornare lo stato di apertura della modale */
|
|
12
|
+
updateIsModalOpen?: (isOpen: boolean) => void;
|
|
11
13
|
}
|
|
12
14
|
declare const TMDataListItemChooser: React.FunctionComponent<ITMDataListItemChooserProps>;
|
|
13
15
|
export default TMDataListItemChooser;
|
|
@@ -7,17 +7,23 @@ import TMSpinner from '../base/TMSpinner';
|
|
|
7
7
|
import TMSummary from '../editors/TMSummary';
|
|
8
8
|
import TMChooserForm from '../forms/TMChooserForm';
|
|
9
9
|
import TMDataListItemViewer from '../viewers/TMDataListItemViewer';
|
|
10
|
-
const TMDataListItemChooser = ({ labelColor, width = '100%', dataListId, icon, backgroundColor, showBorder = true, readOnly, openChooserBySingleClick, buttons = [], elementStyle, allowMultipleSelection, values, isModifiedWhen, label, placeHolder, titleForm, showClearButton = false, validationItems = [], onValueChanged }) => {
|
|
10
|
+
const TMDataListItemChooser = ({ labelColor, width = '100%', dataListId, icon, backgroundColor, showBorder = true, readOnly, openChooserBySingleClick, buttons = [], elementStyle, allowMultipleSelection, values, isModifiedWhen, label, placeHolder, titleForm, showClearButton = false, validationItems = [], onValueChanged, updateIsModalOpen }) => {
|
|
11
11
|
const [showChooser, setShowChooser] = useState(false);
|
|
12
12
|
const renderTemplate = () => {
|
|
13
13
|
const isPlaceholder = values?.[0] === placeHolder;
|
|
14
14
|
return (_jsxs(StyledDivHorizontal, { style: { width: '100%', color: isPlaceholder ? '#a9a9a9' : 'inherit' }, children: [values && values.length > 0 && _jsx(TMDataListItemViewer, { dataListId: dataListId, value: values?.[0] }), values && values.length > 1 && _jsx("p", { style: { marginLeft: '10px' }, children: `(+${values.length - 1} ${values.length == 2 ? 'altro' : 'altri'})` })] }));
|
|
15
15
|
};
|
|
16
16
|
const summaryInputRef = useRef(null);
|
|
17
|
-
return (_jsxs(_Fragment, { children: [_jsx(TMSummary, { ref: summaryInputRef, placeHolder: placeHolder, labelColor: labelColor, width: width, icon: icon, buttons: buttons, readOnly: readOnly, backgroundColor: backgroundColor, showBorder: showBorder, hasValue: values && values.length > 0, showClearButton: showClearButton, iconEditButton: _jsx(IconSearch, { fontSize: 16 }), onEditorClick: () =>
|
|
17
|
+
return (_jsxs(_Fragment, { children: [_jsx(TMSummary, { ref: summaryInputRef, placeHolder: placeHolder, labelColor: labelColor, width: width, icon: icon, buttons: buttons, readOnly: readOnly, backgroundColor: backgroundColor, showBorder: showBorder, hasValue: values && values.length > 0, showClearButton: showClearButton, iconEditButton: _jsx(IconSearch, { fontSize: 16 }), onEditorClick: () => {
|
|
18
|
+
if (!readOnly) {
|
|
19
|
+
setShowChooser(true);
|
|
20
|
+
updateIsModalOpen?.(true);
|
|
21
|
+
}
|
|
22
|
+
}, elementStyle: elementStyle, isModifiedWhen: isModifiedWhen, label: label, openEditorOnSummaryClick: openChooserBySingleClick, template: renderTemplate(), onClearClick: showClearButton ? () => { onValueChanged?.([]); } : undefined, validationItems: validationItems }), showChooser &&
|
|
18
23
|
_jsx(TMDataListItemChooserForm, { allowMultipleSelection: allowMultipleSelection, title: titleForm, dataListId: dataListId, selectedIDs: values, onClose: () => {
|
|
19
24
|
setShowChooser(false);
|
|
20
25
|
summaryInputRef.current?.focus();
|
|
26
|
+
updateIsModalOpen?.(false);
|
|
21
27
|
}, onChoose: (IDs) => { onValueChanged?.(IDs); } })] }));
|
|
22
28
|
};
|
|
23
29
|
export default TMDataListItemChooser;
|
|
@@ -11,6 +11,7 @@ interface ITMDcmtTypeChooser extends ITMChooserProps {
|
|
|
11
11
|
openEditorOnSummaryClick?: boolean;
|
|
12
12
|
accessFilter?: AccessFilter;
|
|
13
13
|
filter?: (value: DcmtTypeDescriptor, index: number, array: DcmtTypeDescriptor[]) => unknown;
|
|
14
|
+
updateIsModalOpen?: (isOpen: boolean) => void;
|
|
14
15
|
}
|
|
15
16
|
declare const TMDcmtTypeChooser: React.FunctionComponent<ITMDcmtTypeChooser>;
|
|
16
17
|
export default TMDcmtTypeChooser;
|
|
@@ -7,7 +7,7 @@ import { StyledDivHorizontal } from '../base/Styled';
|
|
|
7
7
|
import TMTidViewer, { TMDcmtTypeIcon } from '../viewers/TMTidViewer';
|
|
8
8
|
import TMSummary from '../editors/TMSummary';
|
|
9
9
|
import TMChooserForm from '../forms/TMChooserForm';
|
|
10
|
-
const TMDcmtTypeChooser = ({ tmSession, dataSource, disabled, backgroundColor, filter, accessFilter = 'all', showEditButton = true, borderRadius = '4px', buttons = [], placeHolder = `<${SDKUI_Localizator.NoneSelection}>`, openEditorOnSummaryClick, showBorder = true, showId = false, elementStyle, allowMultipleSelection, ShowOnlyDcmtTypes, ShowOnlySAP, filterTemplateTID, values, isModifiedWhen, label, width, height, showClearButton = false, validationItems = [], onValueChanged }) => {
|
|
10
|
+
const TMDcmtTypeChooser = ({ tmSession, dataSource, disabled, backgroundColor, filter, accessFilter = 'all', showEditButton = true, borderRadius = '4px', buttons = [], placeHolder = `<${SDKUI_Localizator.NoneSelection}>`, openEditorOnSummaryClick, showBorder = true, showId = false, elementStyle, allowMultipleSelection, ShowOnlyDcmtTypes, ShowOnlySAP, filterTemplateTID, values, isModifiedWhen, label, width, height, showClearButton = false, validationItems = [], onValueChanged, updateIsModalOpen }) => {
|
|
11
11
|
const [showChooser, setShowChooser] = useState(false);
|
|
12
12
|
useEffect(() => {
|
|
13
13
|
TMSpinner.show({ description: `${SDKUI_Localizator.Loading} - ${SDK_Localizator.ListDcmtTypeOrView} ...` });
|
|
@@ -17,8 +17,16 @@ const TMDcmtTypeChooser = ({ tmSession, dataSource, disabled, backgroundColor, f
|
|
|
17
17
|
const renderTemplate = () => {
|
|
18
18
|
return (_jsxs(StyledDivHorizontal, { style: { width: 'max-content', height: '100%' }, children: [values && _jsx(TMTidViewer, { tmSession: tmSession, tid: values[0], showIcon: true, showId: showId, noneSelectionText: placeHolder }), values && values.length > 1 && _jsx("p", { style: { marginLeft: '10px' }, children: `(+${values.length - 1} ${values.length == 2 ? 'altro' : 'altri'})` })] }));
|
|
19
19
|
};
|
|
20
|
-
return (_jsxs(_Fragment, { children: [_jsx(TMSummary, { backgroundColor: backgroundColor, buttons: buttons, showBorder: showBorder, borderRadius: borderRadius, hasValue: values && values.length > 0, showClearButton: showClearButton, showEditButton: showEditButton, iconEditButton: _jsx(IconSearch, { fontSize: 16 }), onEditorClick: () =>
|
|
21
|
-
|
|
20
|
+
return (_jsxs(_Fragment, { children: [_jsx(TMSummary, { backgroundColor: backgroundColor, buttons: buttons, showBorder: showBorder, borderRadius: borderRadius, hasValue: values && values.length > 0, showClearButton: showClearButton, showEditButton: showEditButton, iconEditButton: _jsx(IconSearch, { fontSize: 16 }), onEditorClick: () => {
|
|
21
|
+
if (!disabled) {
|
|
22
|
+
setShowChooser(true);
|
|
23
|
+
updateIsModalOpen?.(true);
|
|
24
|
+
}
|
|
25
|
+
}, elementStyle: elementStyle, isModifiedWhen: isModifiedWhen, label: label, width: width, height: height, template: renderTemplate(), openEditorOnSummaryClick: openEditorOnSummaryClick, onClearClick: showClearButton ? () => { !disabled && onValueChanged?.([]); } : undefined, validationItems: validationItems }), showChooser &&
|
|
26
|
+
_jsx(TMDcmtTypeChooserForm, { tmSession: tmSession, allowMultipleSelection: allowMultipleSelection, dataSource: dataSource, selectedIDs: values, ShowOnlyDcmtTypes: ShowOnlyDcmtTypes, ShowOnlySAP: ShowOnlySAP, accessFilter: accessFilter, filterTemplateTID: filterTemplateTID, filter: filter, onClose: () => {
|
|
27
|
+
setShowChooser(false);
|
|
28
|
+
updateIsModalOpen?.(false);
|
|
29
|
+
}, onChoose: (IDs) => { onValueChanged?.(IDs); } })] }));
|
|
22
30
|
};
|
|
23
31
|
export default TMDcmtTypeChooser;
|
|
24
32
|
const cellRenderIcon = (data) => _jsx(TMDcmtTypeIcon, { dtd: data.data });
|
|
@@ -3,7 +3,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
|
3
3
|
import { LayoutModes, MetadataDataDomains, AccessLevels, MetadataDataTypes, SDK_Globals, DcmtTypeListCacheService, DataColumnTypes } from '@topconsultnpm/sdk-ts';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
import { SDKUI_Localizator, stringIsNullOrEmpty } from '../../helper';
|
|
6
|
-
import TMDataGrid from '../base/TMDataGrid';
|
|
6
|
+
import TMDataGrid, { TMDataGridPageSize } from '../base/TMDataGrid';
|
|
7
7
|
import { TMExceptionBoxManager } from '../base/TMPopUp';
|
|
8
8
|
import TMSpinner from '../base/TMSpinner';
|
|
9
9
|
import TMCheckBox from '../editors/TMCheckBox';
|
|
@@ -131,7 +131,7 @@ const TMDistinctValues = ({ tid, mid, layoutMode = LayoutModes.None, allowAppend
|
|
|
131
131
|
return md.dataDomain === undefined || md.dataDomain === MetadataDataDomains.None;
|
|
132
132
|
};
|
|
133
133
|
const renderContent = () => {
|
|
134
|
-
return (_jsxs(StyledDistinctValues, { children: [isVisibleAppend() && _jsx(TMCheckBox, { elementStyle: { position: 'absolute', right: '15px', top: '15px', zIndex: 10000 }, label: 'Accoda', value: isAppendMode, onValueChanged: () => { setIsAppendMode(!isAppendMode); } }), _jsx(TMDataGrid, { focusedRowKey: focusedItem ? focusedItem.rowIndex : undefined, selection: { showCheckBoxesMode: 'none' }, searchPanel: { highlightCaseSensitive: true, visible: true }, dataColumns: customColumns, dataSource: dataSource, keyExpr: 'rowIndex', height: 'calc(100%)', onFocusedRowChanged: onFocusedRowChanged, paging: { pageSize: 30 }, summary: customSummary, onRowDblClick: () => !isAppendMode && onClosePanelCallback?.() })] }));
|
|
134
|
+
return (_jsxs(StyledDistinctValues, { children: [isVisibleAppend() && _jsx(TMCheckBox, { elementStyle: { position: 'absolute', right: '15px', top: '15px', zIndex: 10000 }, label: 'Accoda', value: isAppendMode, onValueChanged: () => { setIsAppendMode(!isAppendMode); } }), _jsx(TMDataGrid, { focusedRowKey: focusedItem ? focusedItem.rowIndex : undefined, selection: { showCheckBoxesMode: 'none' }, searchPanel: { highlightCaseSensitive: true, visible: true }, dataColumns: customColumns, dataSource: dataSource, keyExpr: 'rowIndex', height: 'calc(100%)', onFocusedRowChanged: onFocusedRowChanged, paging: { pageSize: 30 }, summary: customSummary, onRowDblClick: () => !isAppendMode && onClosePanelCallback?.(), pageSize: TMDataGridPageSize.Medium })] }));
|
|
135
135
|
};
|
|
136
136
|
return (_jsx(_Fragment, { children: isModal
|
|
137
137
|
? _jsx(TMModal, { title: SDKUI_Localizator.DistinctValues + (md?.nameLoc ? ` (${md?.nameLoc})` : ''), height: '600px', width: '500px', resizable: true, onClose: onClosePanelCallback, children: renderContent() })
|
|
@@ -18,6 +18,8 @@ interface ITMDynDataListItemChooserProps extends ITMChooserProps {
|
|
|
18
18
|
onCascadeRefreshDynDataLists?: (dynDataListsToBeRefreshed: DynDataListsToBeRefreshed[]) => void;
|
|
19
19
|
/** Indica quali metadati aggiornare in cascata (valore) */
|
|
20
20
|
onCascadeUpdateMIDs?: (midsToBeUpdated: MIDsToBeUpdated[]) => void;
|
|
21
|
+
/** Funzione per aggiornare lo stato di apertura della modale */
|
|
22
|
+
updateIsModalOpen?: (isOpen: boolean) => void;
|
|
21
23
|
}
|
|
22
24
|
export type DynDataListsToBeRefreshed = {
|
|
23
25
|
mid: number | undefined;
|
|
@@ -9,7 +9,8 @@ import TMChooserForm from '../forms/TMChooserForm';
|
|
|
9
9
|
import { TMColors } from '../../utils/theme';
|
|
10
10
|
import TMTooltip from '../base/TMTooltip';
|
|
11
11
|
import { FormulaHelper } from '../editors/TMFormulaEditor';
|
|
12
|
-
|
|
12
|
+
import { TMExceptionBoxManager } from '../base/TMPopUp';
|
|
13
|
+
const TMDynDataListItemChooser = ({ tid, md, width = '100%', titleForm, openChooserBySingleClick, readOnly, layoutMode = LayoutModes.None, queryParamsDynDataList, buttons = [], backgroundColor, showBorder = true, elementStyle, allowMultipleSelection, values, isModifiedWhen, label, placeHolder, validationItems = [], icon, labelColor, showClearButton, onValueChanged, onCascadeRefreshDynDataLists, onCascadeUpdateMIDs, updateIsModalOpen }) => {
|
|
13
14
|
const [showChooser, setShowChooser] = useState(false);
|
|
14
15
|
const [dynDl, setDynDl] = useState();
|
|
15
16
|
const [dataSource, setDataSource] = useState();
|
|
@@ -30,7 +31,9 @@ const TMDynDataListItemChooser = ({ tid, md, width = '100%', titleForm, openChoo
|
|
|
30
31
|
setDynDl(d);
|
|
31
32
|
if (!IsParametricQuery(d?.qd) && !dataSource) {
|
|
32
33
|
setDataSource(undefined);
|
|
33
|
-
loadData()
|
|
34
|
+
loadData()
|
|
35
|
+
.then((result) => { setDataSource(result); })
|
|
36
|
+
.catch((err) => { TMExceptionBoxManager.show({ exception: err }); });
|
|
34
37
|
}
|
|
35
38
|
}, [md]);
|
|
36
39
|
useEffect(() => {
|
|
@@ -42,12 +45,13 @@ const TMDynDataListItemChooser = ({ tid, md, width = '100%', titleForm, openChoo
|
|
|
42
45
|
setDataSource(undefined);
|
|
43
46
|
return;
|
|
44
47
|
}
|
|
45
|
-
loadData()
|
|
46
|
-
setDataSource(result);
|
|
47
|
-
|
|
48
|
+
loadData()
|
|
49
|
+
.then((result) => { setDataSource(result); })
|
|
50
|
+
.catch((err) => { TMExceptionBoxManager.show({ exception: err }); });
|
|
48
51
|
}, [queryParamsDynDataList, dynDl]);
|
|
49
52
|
const loadData = async () => {
|
|
50
|
-
return await SDK_Globals.tmSession?.NewSearchEngine().GetDynDataListValuesAsync(tid, md?.id, layoutMode, queryParamsDynDataList ?? [])
|
|
53
|
+
return await SDK_Globals.tmSession?.NewSearchEngine().GetDynDataListValuesAsync(tid, md?.id, layoutMode, queryParamsDynDataList ?? [])
|
|
54
|
+
.catch((err) => { throw err; });
|
|
51
55
|
};
|
|
52
56
|
const getDescription = () => {
|
|
53
57
|
if (!Array.isArray(values))
|
|
@@ -80,9 +84,15 @@ const TMDynDataListItemChooser = ({ tid, md, width = '100%', titleForm, openChoo
|
|
|
80
84
|
const isPlaceholder = values?.[0] === placeHolder;
|
|
81
85
|
return (_jsxs(StyledDivHorizontal, { style: { width: '100%', color: isPlaceholder ? '#a9a9a9' : 'inherit' }, children: [dataSource && _jsxs(StyledDivHorizontal, { children: [getIcon(), _jsx("p", { style: { marginLeft: '5px' }, children: getDescription() })] }), values && values.length > 1 && _jsx("p", { style: { marginLeft: '10px' }, children: `(+${values.length - 1} ${values.length == 2 ? 'altro' : 'altri'})` })] }));
|
|
82
86
|
};
|
|
83
|
-
return (_jsxs(_Fragment, { children: [_jsx(TMSummary, { placeHolder: placeHolder, width: width, icon: icon, labelColor: labelColor, backgroundColor: backgroundColor, buttons: buttons, showBorder: showBorder, readOnly: readOnly, hasValue: values && values.length > 0, showClearButton: showClearButton, iconEditButton: _jsx(IconSearch, { fontSize: 16 }), onEditorClick: () =>
|
|
87
|
+
return (_jsxs(_Fragment, { children: [_jsx(TMSummary, { placeHolder: placeHolder, width: width, icon: icon, labelColor: labelColor, backgroundColor: backgroundColor, buttons: buttons, showBorder: showBorder, readOnly: readOnly, hasValue: values && values.length > 0, showClearButton: showClearButton, iconEditButton: _jsx(IconSearch, { fontSize: 16 }), onEditorClick: () => {
|
|
88
|
+
if (!readOnly) {
|
|
89
|
+
setShowChooser(true);
|
|
90
|
+
updateIsModalOpen?.(true);
|
|
91
|
+
}
|
|
92
|
+
}, elementStyle: elementStyle, isModifiedWhen: isModifiedWhen, openEditorOnSummaryClick: openChooserBySingleClick, label: label, template: renderTemplate(), onClearClick: showClearButton ? () => { onValueChanged?.([]); } : undefined, validationItems: validationItems }), showChooser &&
|
|
84
93
|
_jsx(TMDynDataListItemChooserForm, { TID: tid, MID: md?.id, dynDL: dynDl, title: titleForm, allowMultipleSelection: allowMultipleSelection, searchResult: dataSource, selectedIDs: values, onClose: () => {
|
|
85
94
|
setShowChooser(false);
|
|
95
|
+
updateIsModalOpen?.(false);
|
|
86
96
|
summaryInputRef.current?.focus();
|
|
87
97
|
}, onChoose: (IDs) => {
|
|
88
98
|
onValueChanged?.(IDs);
|
|
@@ -146,7 +156,8 @@ export const TMDynDataListItemChooserForm = (props) => {
|
|
|
146
156
|
if (refreshCache)
|
|
147
157
|
DataListCacheService.RemoveAll();
|
|
148
158
|
TMSpinner.show({ description: `${SDKUI_Localizator.Loading} - ${SDK_Localizator.DataList} ...` });
|
|
149
|
-
let result = await SDK_Globals.tmSession?.NewSearchEngine().GetDynDataListValuesAsync(props.TID, props.MID, props.layoutMode, [])
|
|
159
|
+
let result = await SDK_Globals.tmSession?.NewSearchEngine().GetDynDataListValuesAsync(props.TID, props.MID, props.layoutMode, [])
|
|
160
|
+
.catch((err) => { TMSpinner.hide(); TMExceptionBoxManager.show({ exception: err }); });
|
|
150
161
|
TMSpinner.hide();
|
|
151
162
|
return result ? searchResultDescriptorToSimpleArray(result) ?? [] : [];
|
|
152
163
|
};
|
|
@@ -32,6 +32,8 @@ interface ITMMetadataChooserProps extends ITMChooserProps {
|
|
|
32
32
|
getColorIndex?: (tid: TID_Alias) => string;
|
|
33
33
|
/** Allows you to view system metadata directly */
|
|
34
34
|
showSysMetadataDirectly?: boolean;
|
|
35
|
+
/** Funzione per aggiornare lo stato di apertura della modale */
|
|
36
|
+
updateIsModalOpen?: (isOpen: boolean) => void;
|
|
35
37
|
}
|
|
36
38
|
declare const TMMetadataChooser: React.FunctionComponent<ITMMetadataChooserProps>;
|
|
37
39
|
export default TMMetadataChooser;
|
|
@@ -11,7 +11,7 @@ import TMButton from '../base/TMButton';
|
|
|
11
11
|
import TMSummary from '../editors/TMSummary';
|
|
12
12
|
import TMChooserForm from '../forms/TMChooserForm';
|
|
13
13
|
import TMSpinner from '../base/TMSpinner';
|
|
14
|
-
const TMMetadataChooser = ({ tmSession, dataSource, showEditButton = true, buttons = [], disabled, validationItems, getColorIndex, showCompleteMetadataName, qdShowOnlySelectItems, borderRadius = '4px', fontSize = FontSize.defaultFontSize, backgroundColor, openEditorOnSummaryClick, showBorder = true, showId = false, elementStyle, allowMultipleSelection, allowSysMetadata, showSysMetadataDirectly, value, values, isModifiedWhen, tids, label, width, height, showClearButton, qd, placeHolder, filterMetadata, onValueChanged }) => {
|
|
14
|
+
const TMMetadataChooser = ({ tmSession, dataSource, showEditButton = true, buttons = [], disabled, validationItems, getColorIndex, showCompleteMetadataName, qdShowOnlySelectItems, borderRadius = '4px', fontSize = FontSize.defaultFontSize, backgroundColor, openEditorOnSummaryClick, showBorder = true, showId = false, elementStyle, allowMultipleSelection, allowSysMetadata, showSysMetadataDirectly, value, values, isModifiedWhen, tids, label, width, height, showClearButton, qd, placeHolder, filterMetadata, onValueChanged, updateIsModalOpen }) => {
|
|
15
15
|
const [showChooser, setShowChooser] = useState(false);
|
|
16
16
|
const getinputMd = () => {
|
|
17
17
|
if (values && values.length > 0 && values[0].mid && values[0].mid < 0) {
|
|
@@ -23,8 +23,16 @@ const TMMetadataChooser = ({ tmSession, dataSource, showEditButton = true, butto
|
|
|
23
23
|
const renderTemplate = useMemo(() => {
|
|
24
24
|
return (_jsxs(StyledDivHorizontal, { style: { width: 'max-content', height: '100%' }, children: [values && values.length > 0 && values[0].mid && values[0].mid > 0 && _jsx(TMMidViewer, { tmSession: tmSession, tid_mid: values[0], showIcon: true, showId: showId, showCompleteName: showCompleteMetadataName }), values && values.length > 0 && values[0].mid && values[0].mid < 0 && _jsx(TMMidViewer, { tmSession: tmSession, tid_mid: values[0], inputMd: getinputMd(), showIcon: true, showId: showId, showCompleteName: showCompleteMetadataName }), values && values.length > 1 && _jsx("p", { style: { marginLeft: '10px' }, children: `(+${values.length - 1} ${values.length == 2 ? 'altro' : 'altri'})` }), (values == undefined || values.length == 0) && _jsx("p", { children: placeHolder })] }));
|
|
25
25
|
}, [values, tmSession, showId, showCompleteMetadataName, placeHolder]);
|
|
26
|
-
return (_jsxs(_Fragment, { children: [_jsx(TMSummary, { label: label, width: width, height: height, disabled: disabled, validationItems: validationItems, backgroundColor: backgroundColor, buttons: buttons, placeHolder: placeHolder, fontSize: fontSize, showBorder: showBorder, borderRadius: borderRadius, hasValue: values && values.length > 0, showClearButton: showClearButton, showEditButton: showEditButton, iconEditButton: _jsx(IconSearch, { fontSize: 16 }), openEditorOnSummaryClick: openEditorOnSummaryClick, onEditorClick: () =>
|
|
27
|
-
|
|
26
|
+
return (_jsxs(_Fragment, { children: [_jsx(TMSummary, { label: label, width: width, height: height, disabled: disabled, validationItems: validationItems, backgroundColor: backgroundColor, buttons: buttons, placeHolder: placeHolder, fontSize: fontSize, showBorder: showBorder, borderRadius: borderRadius, hasValue: values && values.length > 0, showClearButton: showClearButton, showEditButton: showEditButton, iconEditButton: _jsx(IconSearch, { fontSize: 16 }), openEditorOnSummaryClick: openEditorOnSummaryClick, onEditorClick: () => {
|
|
27
|
+
if (!disabled) {
|
|
28
|
+
setShowChooser(true);
|
|
29
|
+
updateIsModalOpen?.(true);
|
|
30
|
+
}
|
|
31
|
+
}, elementStyle: elementStyle, isModifiedWhen: isModifiedWhen, template: renderTemplate, onClearClick: showClearButton ? () => { onValueChanged?.([]); } : undefined }), showChooser &&
|
|
32
|
+
_jsx(TMMetadataChooserForm, { tmSession: tmSession, allowMultipleSelection: allowMultipleSelection, height: '500px', width: '600px', allowSysMetadata: allowSysMetadata, showSysMetadataDirectly: showSysMetadataDirectly, getColorIndex: getColorIndex, dataSource: dataSource, tids: tids, qd: qd, qdShowOnlySelectItems: qdShowOnlySelectItems, filterMetadata: filterMetadata, selectedIDs: values, onClose: () => {
|
|
33
|
+
setShowChooser(false);
|
|
34
|
+
updateIsModalOpen?.(false);
|
|
35
|
+
}, onChoose: (tid_mids) => { onValueChanged?.(tid_mids); } })] }));
|
|
28
36
|
};
|
|
29
37
|
export default TMMetadataChooser;
|
|
30
38
|
export const TMMetadataChooserForm = ({ tmSession, tids, qd, filterMetadata, qdShowOnlySelectItems, selectedIDs, dataSource, allowMultipleSelection, allowSysMetadata = true, showSysMetadataDirectly, width, height, getColorIndex, onClose, onChoose }) => {
|
|
@@ -16,6 +16,8 @@ interface ITMUserChooserProps extends ITMChooserProps {
|
|
|
16
16
|
initialShowChooser?: boolean;
|
|
17
17
|
/** Allow showing all users with toggle button */
|
|
18
18
|
allowShowAllUsers?: boolean;
|
|
19
|
+
/** Funzione per aggiornare lo stato di apertura della modale */
|
|
20
|
+
updateIsModalOpen?: (isOpen: boolean) => void;
|
|
19
21
|
}
|
|
20
22
|
declare const TMUserChooser: React.FunctionComponent<ITMUserChooserProps>;
|
|
21
23
|
export default TMUserChooser;
|