@topconsultnpm/sdkui-react 6.20.0-test1 → 6.21.0-dev1.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/components/NewComponents/ContextMenu/styles.d.ts +3 -1
- package/lib/components/NewComponents/ContextMenu/styles.js +7 -5
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +7 -1
- package/lib/components/base/Styled.d.ts +4 -1
- package/lib/components/base/Styled.js +11 -3
- package/lib/components/base/TMPanel.js +6 -4
- package/lib/components/base/TMPopUp.js +4 -0
- package/lib/components/base/TMTreeView.d.ts +5 -2
- package/lib/components/base/TMTreeView.js +74 -22
- package/lib/components/base/TMWaitPanel.js +6 -5
- package/lib/components/choosers/TMDataListItemChooser.js +1 -1
- package/lib/components/choosers/TMDataListItemEditor.d.ts +11 -0
- package/lib/components/choosers/TMDataListItemEditor.js +130 -0
- package/lib/components/choosers/TMDataListItemFields.d.ts +11 -0
- package/lib/components/choosers/TMDataListItemFields.js +61 -0
- package/lib/components/choosers/TMDataListItemPicker.d.ts +2 -0
- package/lib/components/choosers/TMDataListItemPicker.js +182 -18
- package/lib/components/choosers/TMDynDataListItemChooser.js +11 -6
- package/lib/components/choosers/TMImageIDChooser.d.ts +16 -0
- package/lib/components/choosers/TMImageIDChooser.js +53 -0
- package/lib/components/choosers/TMMetadataChooser.js +1 -1
- package/lib/components/choosers/TMUserChooser.js +4 -2
- package/lib/components/editors/TMDateBox.js +1 -1
- package/lib/components/editors/TMHtmlEditor.js +1 -1
- package/lib/components/editors/TMLocalizedTextBox.d.ts +1 -0
- package/lib/components/editors/TMLocalizedTextBox.js +3 -3
- package/lib/components/editors/TMMetadataValues.js +203 -41
- package/lib/components/editors/TMTextArea.d.ts +1 -0
- package/lib/components/editors/TMTextArea.js +6 -6
- package/lib/components/editors/TMTextBox.js +9 -10
- package/lib/components/features/archive/TMArchive.d.ts +3 -1
- package/lib/components/features/archive/TMArchive.js +31 -44
- package/lib/components/features/blog/TMBlogCommentForm.d.ts +3 -0
- package/lib/components/features/blog/TMBlogCommentForm.js +42 -36
- package/lib/components/features/documents/TMDcmtBlog.d.ts +1 -0
- package/lib/components/features/documents/TMDcmtBlog.js +2 -1
- package/lib/components/features/documents/TMDcmtForm.d.ts +44 -34
- package/lib/components/features/documents/TMDcmtForm.js +367 -565
- package/lib/components/features/documents/TMDcmtFormActionButtons.d.ts +34 -0
- package/lib/components/features/documents/TMDcmtFormActionButtons.js +124 -0
- package/lib/components/features/documents/TMDcmtPreview.js +66 -13
- package/lib/components/features/documents/TMDcmtTasks.d.ts +3 -1
- package/lib/components/features/documents/TMDcmtTasks.js +2 -2
- package/lib/components/features/documents/TMFileUploader.d.ts +5 -0
- package/lib/components/features/documents/TMFileUploader.js +28 -6
- package/lib/components/features/documents/TMMasterDetailDcmts.d.ts +27 -2
- package/lib/components/features/documents/TMMasterDetailDcmts.js +264 -97
- package/lib/components/features/documents/TMRelationViewer.d.ts +19 -2
- package/lib/components/features/documents/TMRelationViewer.js +540 -116
- package/lib/components/features/search/TMSearch.d.ts +3 -2
- package/lib/components/features/search/TMSearch.js +3 -3
- package/lib/components/features/search/TMSearchQueryPanel.js +6 -6
- package/lib/components/features/search/TMSearchResult.d.ts +29 -25
- package/lib/components/features/search/TMSearchResult.js +446 -562
- package/lib/components/features/search/TMSignatureInfoContent.js +10 -6
- package/lib/components/features/search/TMTreeSelector.js +1 -1
- package/lib/components/features/tasks/TMTaskForm.d.ts +3 -1
- package/lib/components/features/tasks/TMTaskForm.js +61 -193
- package/lib/components/features/tasks/TMTaskFormUtils.d.ts +80 -0
- package/lib/components/features/tasks/TMTaskFormUtils.js +559 -0
- package/lib/components/features/tasks/TMTasksUtils.d.ts +3 -1
- package/lib/components/features/tasks/TMTasksUtils.js +46 -16
- package/lib/components/features/tasks/TMTasksUtilsView.d.ts +0 -7
- package/lib/components/features/tasks/TMTasksUtilsView.js +7 -14
- package/lib/components/features/tasks/TMTasksView.js +5 -3
- package/lib/components/features/workflow/TMWorkflowPopup.d.ts +20 -3
- package/lib/components/features/workflow/TMWorkflowPopup.js +21 -109
- package/lib/components/features/workflow/diagram/ConnectionComponent.d.ts +1 -0
- package/lib/components/features/workflow/diagram/ConnectionComponent.js +6 -2
- package/lib/components/features/workflow/diagram/DiagramItemForm.d.ts +2 -0
- package/lib/components/features/workflow/diagram/DiagramItemForm.js +32 -25
- package/lib/components/features/workflow/diagram/RecipientList.d.ts +3 -1
- package/lib/components/features/workflow/diagram/RecipientList.js +13 -9
- package/lib/components/features/workflow/diagram/WFDiagram.js +102 -5
- package/lib/components/features/workflow/diagram/workflowHelpers.js +31 -19
- package/lib/components/forms/Login/TMLoginForm.js +1 -1
- package/lib/components/forms/TMSaveForm.js +61 -13
- package/lib/components/grids/TMBlogsPost.js +8 -8
- package/lib/components/grids/TMBlogsPostUtils.js +2 -2
- package/lib/components/grids/TMRecentsManager.js +1 -1
- package/lib/components/index.d.ts +2 -0
- package/lib/components/index.js +2 -0
- package/lib/components/layout/panelManager/TMPanelManagerContainer.js +3 -2
- package/lib/components/pages/TMPage.js +4 -0
- package/lib/components/query/TMQueryEditor.d.ts +1 -0
- package/lib/components/query/TMQueryEditor.js +3 -3
- package/lib/components/viewers/TMMidViewer.js +2 -1
- package/lib/components/viewers/TMTidViewer.js +7 -3
- package/lib/helper/Enum_Localizator.js +5 -0
- package/lib/helper/GlobalStyles.js +3 -0
- package/lib/helper/SDKUI_Globals.d.ts +12 -0
- package/lib/helper/SDKUI_Globals.js +21 -1
- package/lib/helper/SDKUI_Localizator.d.ts +31 -7
- package/lib/helper/SDKUI_Localizator.js +286 -46
- package/lib/helper/TMIcons.d.ts +2 -1
- package/lib/helper/TMIcons.js +4 -1
- package/lib/helper/TMUtils.d.ts +33 -41
- package/lib/helper/TMUtils.js +157 -170
- package/lib/helper/checkinCheckoutManager.d.ts +1 -1
- package/lib/helper/checkinCheckoutManager.js +25 -6
- package/lib/helper/helpers.d.ts +6 -2
- package/lib/helper/helpers.js +24 -8
- package/lib/helper/index.d.ts +1 -0
- package/lib/helper/index.js +1 -0
- package/lib/helper/queryHelper.js +1 -1
- package/lib/hooks/useBetaFeatures.d.ts +1 -0
- package/lib/hooks/useBetaFeatures.js +41 -0
- package/lib/hooks/useCheckInOutOperations.d.ts +7 -6
- package/lib/hooks/useCheckInOutOperations.js +9 -16
- package/lib/hooks/useDataUserIdItem.js +2 -2
- package/lib/hooks/useDcmtOperations.d.ts +3 -2
- package/lib/hooks/useDcmtOperations.js +16 -4
- package/lib/hooks/useDocumentOperations.d.ts +140 -0
- package/lib/hooks/useDocumentOperations.js +1307 -0
- package/lib/hooks/useRelatedDocuments.d.ts +1 -1
- package/lib/hooks/useRelatedDocuments.js +64 -42
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/services/platform_services.d.ts +1 -1
- package/lib/services/platform_services.js +4 -0
- package/lib/ts/types.d.ts +5 -1
- package/lib/ts/types.js +1 -0
- package/package.json +2 -2
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +0 -11
- package/lib/components/features/search/TMSearchResultsMenuItems.js +0 -770
- package/lib/components/features/search/TMSignSettingsForm.d.ts +0 -9
- package/lib/components/features/search/TMSignSettingsForm.js +0 -621
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
3
|
import styled, { keyframes } from 'styled-components';
|
|
4
|
-
import { DataListCacheService, SDK_Localizator } from '@topconsultnpm/sdk-ts';
|
|
5
|
-
import { SDKUI_Localizator, TMImageLibrary } from '../../helper';
|
|
4
|
+
import { DataListCacheService, SDK_Localizator, ObjectClasses, JobTypes } from '@topconsultnpm/sdk-ts';
|
|
5
|
+
import { IconDelete, SDKUI_Localizator, TMImageLibrary } from '../../helper';
|
|
6
|
+
import { PlatformObjectService } from '../../services/platform_services';
|
|
7
|
+
import TMDataListItemEditor from './TMDataListItemEditor';
|
|
8
|
+
import { ButtonNames, TMMessageBoxManager } from '../base/TMPopUp';
|
|
9
|
+
import TMSpinner from '../base/TMSpinner';
|
|
6
10
|
const PickerContainer = styled.div `
|
|
7
11
|
display: flex;
|
|
8
12
|
flex-direction: column;
|
|
@@ -30,6 +34,11 @@ const slideIn = keyframes `
|
|
|
30
34
|
transform: translateX(0);
|
|
31
35
|
}
|
|
32
36
|
`;
|
|
37
|
+
const ItemWrapper = styled.div `
|
|
38
|
+
position: relative;
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-shrink: 0;
|
|
41
|
+
`;
|
|
33
42
|
const StatusItem = styled.div `
|
|
34
43
|
display: flex;
|
|
35
44
|
flex-direction: column;
|
|
@@ -58,39 +67,194 @@ const StatusItem = styled.div `
|
|
|
58
67
|
background-color: #e6f2ff;
|
|
59
68
|
`}
|
|
60
69
|
`;
|
|
70
|
+
const DeleteButton = styled.button `
|
|
71
|
+
position: absolute;
|
|
72
|
+
top: -8px;
|
|
73
|
+
right: -8px;
|
|
74
|
+
width: 24px;
|
|
75
|
+
height: 24px;
|
|
76
|
+
border-radius: 50%;
|
|
77
|
+
background-color: #dc3545;
|
|
78
|
+
color: white;
|
|
79
|
+
border: 2px solid white;
|
|
80
|
+
cursor: pointer;
|
|
81
|
+
display: flex;
|
|
82
|
+
align-items: center;
|
|
83
|
+
justify-content: center;
|
|
84
|
+
font-size: 14px;
|
|
85
|
+
font-weight: bold;
|
|
86
|
+
opacity: 0;
|
|
87
|
+
transition: all 0.2s ease-in-out;
|
|
88
|
+
box-shadow: 0 2px 4px rgba(0,0,0,0.2);
|
|
89
|
+
z-index: 10;
|
|
90
|
+
|
|
91
|
+
${ItemWrapper}:hover & {
|
|
92
|
+
opacity: 1;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&:hover {
|
|
96
|
+
background-color: #c82333;
|
|
97
|
+
transform: scale(1.1);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
&:active {
|
|
101
|
+
transform: scale(0.95);
|
|
102
|
+
}
|
|
103
|
+
`;
|
|
104
|
+
const AddButton = styled.div `
|
|
105
|
+
display: flex;
|
|
106
|
+
flex-direction: column;
|
|
107
|
+
align-items: center;
|
|
108
|
+
justify-content: center;
|
|
109
|
+
cursor: pointer;
|
|
110
|
+
text-align: center;
|
|
111
|
+
font-size: 0.8em;
|
|
112
|
+
padding: 5px 10px;
|
|
113
|
+
border-radius: 8px;
|
|
114
|
+
border: 2px dashed #007bff;
|
|
115
|
+
background-color: #f8f9fa;
|
|
116
|
+
transition: all 0.2s ease-in-out;
|
|
117
|
+
flex-shrink: 0;
|
|
118
|
+
min-width: 80px;
|
|
119
|
+
color: #007bff;
|
|
120
|
+
font-weight: 500;
|
|
121
|
+
|
|
122
|
+
&:hover {
|
|
123
|
+
background-color: #e6f2ff;
|
|
124
|
+
border-color: #0056b3;
|
|
125
|
+
}
|
|
126
|
+
`;
|
|
61
127
|
const Label = styled.div `
|
|
62
128
|
font-weight: bold;
|
|
63
129
|
margin-bottom: 5px;
|
|
64
130
|
`;
|
|
65
|
-
const TMDataListItemPicker = ({ dataListID, selectedValue, onItemSelect }) => {
|
|
131
|
+
const TMDataListItemPicker = ({ dataListID, selectedValue, onItemSelect, onItemEdited, allowEdit = false }) => {
|
|
66
132
|
const [dataList, setDataList] = useState(undefined);
|
|
133
|
+
const [items, setItems] = useState([]);
|
|
67
134
|
const [loading, setLoading] = useState(true);
|
|
68
135
|
const [error, setError] = useState(undefined);
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
136
|
+
const [showEditDialog, setShowEditDialog] = useState(false);
|
|
137
|
+
const [editingItem, setEditingItem] = useState(undefined);
|
|
138
|
+
const [isCreating, setIsCreating] = useState(false);
|
|
139
|
+
const loadDataList = async (showLoading = true) => {
|
|
140
|
+
if (!dataListID)
|
|
141
|
+
return;
|
|
142
|
+
try {
|
|
143
|
+
if (showLoading)
|
|
144
|
+
setLoading(true);
|
|
72
145
|
setError(undefined);
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
146
|
+
const dl = await PlatformObjectService.retrieveAdminAsync(ObjectClasses.DataList, JobTypes.None, dataListID);
|
|
147
|
+
setDataList(dl);
|
|
148
|
+
setItems(dl?.items ?? []);
|
|
149
|
+
}
|
|
150
|
+
catch (err) {
|
|
151
|
+
console.error("Failed to fetch data list:", err);
|
|
152
|
+
setError("Failed to load data list.");
|
|
153
|
+
}
|
|
154
|
+
finally {
|
|
155
|
+
if (showLoading)
|
|
81
156
|
setLoading(false);
|
|
82
|
-
});
|
|
83
157
|
}
|
|
158
|
+
};
|
|
159
|
+
useEffect(() => {
|
|
160
|
+
loadDataList(true);
|
|
84
161
|
}, [dataListID]);
|
|
162
|
+
const handleCreateNew = () => {
|
|
163
|
+
setIsCreating(true);
|
|
164
|
+
setEditingItem(undefined);
|
|
165
|
+
setShowEditDialog(true);
|
|
166
|
+
};
|
|
167
|
+
const handleEdit = (item) => {
|
|
168
|
+
setIsCreating(false);
|
|
169
|
+
setEditingItem(item);
|
|
170
|
+
setShowEditDialog(true);
|
|
171
|
+
};
|
|
172
|
+
const handleSave = async (newItem) => {
|
|
173
|
+
if (!dataList || !dataListID)
|
|
174
|
+
return;
|
|
175
|
+
try {
|
|
176
|
+
let updatedItems;
|
|
177
|
+
TMSpinner.show({ description: 'Salvataggio in corso...' });
|
|
178
|
+
if (isCreating) {
|
|
179
|
+
// Aggiungi nuovo item
|
|
180
|
+
updatedItems = [...items, newItem];
|
|
181
|
+
}
|
|
182
|
+
else if (editingItem) {
|
|
183
|
+
// Modifica item esistente
|
|
184
|
+
updatedItems = items.map(item => item.value === editingItem.value ? newItem : item);
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
// Modifica direttamente la dataList invece di usare spread operator
|
|
190
|
+
dataList.items = updatedItems;
|
|
191
|
+
// Salva sul server usando l'API corretta
|
|
192
|
+
await PlatformObjectService.updateAsync(ObjectClasses.DataList, JobTypes.None, dataList);
|
|
193
|
+
// Invalida la cache per garantire la sincronizzazione
|
|
194
|
+
DataListCacheService.Remove();
|
|
195
|
+
// Ricarica i dati dalla cache (che richiamerà il server)
|
|
196
|
+
await loadDataList(false);
|
|
197
|
+
// Notifica il parent se un item esistente è stato modificato
|
|
198
|
+
if (!isCreating && editingItem) {
|
|
199
|
+
onItemEdited?.(editingItem, newItem);
|
|
200
|
+
}
|
|
201
|
+
handleCloseDialog();
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
console.error('Failed to save DataList item:', error);
|
|
205
|
+
setError('Failed to save changes.');
|
|
206
|
+
}
|
|
207
|
+
finally {
|
|
208
|
+
TMSpinner.hide();
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
const handleCloseDialog = () => {
|
|
212
|
+
setShowEditDialog(false);
|
|
213
|
+
setEditingItem(undefined);
|
|
214
|
+
setIsCreating(false);
|
|
215
|
+
};
|
|
216
|
+
const handleDelete = async (item, event) => {
|
|
217
|
+
event.stopPropagation(); // Previeni la selezione dell'item quando si clicca delete
|
|
218
|
+
const confirmMessage = SDKUI_Localizator.Delete_ConfirmFor1.replaceParams(item.name);
|
|
219
|
+
TMMessageBoxManager.show({
|
|
220
|
+
title: SDKUI_Localizator.Delete, message: confirmMessage, buttons: [ButtonNames.YES, ButtonNames.NO],
|
|
221
|
+
onButtonClick: async (e) => {
|
|
222
|
+
if (e !== ButtonNames.YES)
|
|
223
|
+
return;
|
|
224
|
+
if (!dataList || !dataListID)
|
|
225
|
+
return;
|
|
226
|
+
try {
|
|
227
|
+
TMSpinner.show({ description: 'Eliminazione in corso...' });
|
|
228
|
+
// Rimuovi l'item dalla lista
|
|
229
|
+
const updatedItems = items.filter(i => i.value !== item.value);
|
|
230
|
+
// Modifica direttamente la dataList
|
|
231
|
+
dataList.items = updatedItems;
|
|
232
|
+
// Salva sul server usando l'API corretta
|
|
233
|
+
await PlatformObjectService.updateAsync(ObjectClasses.DataList, JobTypes.None, dataList);
|
|
234
|
+
// Invalida la cache per garantire la sincronizzazione
|
|
235
|
+
DataListCacheService.Remove();
|
|
236
|
+
// Ricarica i dati dalla cache (che richiamerà il server)
|
|
237
|
+
await loadDataList(false);
|
|
238
|
+
}
|
|
239
|
+
catch (error) {
|
|
240
|
+
console.error('Failed to delete DataList item:', error);
|
|
241
|
+
setError('Failed to delete item.');
|
|
242
|
+
}
|
|
243
|
+
finally {
|
|
244
|
+
TMSpinner.hide();
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
};
|
|
85
249
|
if (loading) {
|
|
86
250
|
return _jsxs("p", { children: [SDKUI_Localizator.Loading, "..."] });
|
|
87
251
|
}
|
|
88
252
|
if (error) {
|
|
89
253
|
return _jsx("p", { children: error });
|
|
90
254
|
}
|
|
91
|
-
if (!dataList || !
|
|
92
|
-
return _jsx("p", { children: SDKUI_Localizator.NoDataToDisplay });
|
|
255
|
+
if (!dataList || !items || items.length === 0) {
|
|
256
|
+
return (_jsxs(PickerContainer, { children: [_jsx(Label, { children: dataList ? `${SDK_Localizator.DataList}: ${dataList.name}` : SDKUI_Localizator.NoDataToDisplay }), _jsx(ItemsContainer, { children: allowEdit && (_jsxs(AddButton, { onClick: handleCreateNew, children: ["+ ", SDKUI_Localizator.NewMale] })) }), !allowEdit && _jsx("p", { children: SDKUI_Localizator.NoDataToDisplay })] }));
|
|
93
257
|
}
|
|
94
|
-
return (_jsxs(PickerContainer, { children: [_jsx(Label, { children: `${SDK_Localizator.DataList}: ${dataList.name}` }),
|
|
258
|
+
return (_jsxs(PickerContainer, { children: [_jsx(Label, { children: `${SDK_Localizator.DataList}: ${dataList.name}` }), _jsxs(ItemsContainer, { children: [items.map((item, index) => (_jsxs(ItemWrapper, { children: [_jsxs(StatusItem, { "$isSelected": item.value === selectedValue, "$index": index, onClick: () => onItemSelect(item), onDoubleClick: () => allowEdit && handleEdit(item), children: [item.imageID && _jsx(TMImageLibrary, { imageID: item.imageID }), _jsx("span", { children: item.name })] }), allowEdit && (_jsx(DeleteButton, { onClick: (e) => handleDelete(item, e), title: SDKUI_Localizator.Delete || 'Delete', "aria-label": "Delete item", children: _jsx(IconDelete, { fontSize: 16 }) }))] }, item.value))), allowEdit && (_jsxs(AddButton, { onClick: handleCreateNew, children: ["+ ", SDKUI_Localizator.NewMale] }))] }), _jsx(TMDataListItemEditor, { isOpen: showEditDialog, item: editingItem, isCreating: isCreating, onClose: handleCloseDialog, onSave: handleSave })] }));
|
|
95
259
|
};
|
|
96
260
|
export default TMDataListItemPicker;
|
|
@@ -9,6 +9,7 @@ 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
|
+
import { TMExceptionBoxManager } from '../base/TMPopUp';
|
|
12
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();
|
|
@@ -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))
|
|
@@ -152,7 +156,8 @@ export const TMDynDataListItemChooserForm = (props) => {
|
|
|
152
156
|
if (refreshCache)
|
|
153
157
|
DataListCacheService.RemoveAll();
|
|
154
158
|
TMSpinner.show({ description: `${SDKUI_Localizator.Loading} - ${SDK_Localizator.DataList} ...` });
|
|
155
|
-
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 }); });
|
|
156
161
|
TMSpinner.hide();
|
|
157
162
|
return result ? searchResultDescriptorToSimpleArray(result) ?? [] : [];
|
|
158
163
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ITMChooserProps, ITMChooserFormProps } from '../../ts';
|
|
3
|
+
interface ITMImageIDChooserProps extends ITMChooserProps {
|
|
4
|
+
/** Contiene i values selezionati -> attualmente sempre e solo 1 elemento */
|
|
5
|
+
value?: string;
|
|
6
|
+
readOnly?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare const TMImageIDChooser: React.FunctionComponent<ITMImageIDChooserProps>;
|
|
9
|
+
export default TMImageIDChooser;
|
|
10
|
+
interface ITMImageIDChooserFormProps extends ITMChooserFormProps<Image_Wrap> {
|
|
11
|
+
}
|
|
12
|
+
declare class Image_Wrap {
|
|
13
|
+
id: number;
|
|
14
|
+
imageID?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const TMImageIDChooserForm: React.FunctionComponent<ITMImageIDChooserFormProps>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
3
|
+
import { TMImageLibrary, IconSearch } from '../../helper';
|
|
4
|
+
import { StyledDivHorizontal } from '../base/Styled';
|
|
5
|
+
import TMSummary from '../editors/TMSummary';
|
|
6
|
+
import TMChooserForm from '../forms/TMChooserForm';
|
|
7
|
+
import { ImageIDList } from '../viewers/TMTidViewer';
|
|
8
|
+
const TMImageIDChooser = ({ backgroundColor, elementStyle, value, isModifiedWhen, placeHolder, validationItems = [], readOnly, onValueChanged }) => {
|
|
9
|
+
const [showChooser, setShowChooser] = useState(false);
|
|
10
|
+
const renderTemplate = () => {
|
|
11
|
+
return (_jsx(StyledDivHorizontal, { style: { minWidth: '125px' }, children: placeHolder && (!value || value == '')
|
|
12
|
+
? _jsx("p", { children: placeHolder })
|
|
13
|
+
: _jsx(TMImageLibrary, { imageID: value }) }));
|
|
14
|
+
};
|
|
15
|
+
return (_jsxs(_Fragment, { children: [_jsx(TMSummary, { backgroundColor: backgroundColor, showClearButton: true, iconEditButton: _jsx(IconSearch, {}), onEditorClick: () => setShowChooser(true), onClearClick: () => onValueChanged?.(''), elementStyle: elementStyle, isModifiedWhen: isModifiedWhen, label: "Immagine", hasValue: value != undefined && value?.length > 0, template: renderTemplate(), validationItems: validationItems,
|
|
16
|
+
// openEditorOnSummaryClick={!readOnly}
|
|
17
|
+
readOnly: readOnly, disabled: readOnly }), showChooser &&
|
|
18
|
+
_jsx(TMImageIDChooserForm, { selectedIDs: [value], onClose: () => setShowChooser(false), onChoose: (img) => { onValueChanged?.(img); } })] }));
|
|
19
|
+
};
|
|
20
|
+
export default TMImageIDChooser;
|
|
21
|
+
class Image_Wrap {
|
|
22
|
+
constructor() {
|
|
23
|
+
this.id = 0;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export const TMImageIDChooserForm = (props) => {
|
|
27
|
+
const getItems = async () => {
|
|
28
|
+
let datasource = [];
|
|
29
|
+
let i = 0;
|
|
30
|
+
for (let img of Object.values(ImageIDList))
|
|
31
|
+
datasource.push({ id: i, imageID: img });
|
|
32
|
+
return datasource;
|
|
33
|
+
};
|
|
34
|
+
const cellRenderImageListItemIcon = (data) => {
|
|
35
|
+
let imageID = data.row.data;
|
|
36
|
+
return _jsx(TMImageLibrary, { imageID: imageID.imageID });
|
|
37
|
+
};
|
|
38
|
+
const cellRenderName = (data) => {
|
|
39
|
+
let imageID = data.row.data;
|
|
40
|
+
return _jsxs("p", { children: [imageID.imageID, " "] });
|
|
41
|
+
};
|
|
42
|
+
const dataColumns = useMemo(() => {
|
|
43
|
+
return [
|
|
44
|
+
{ name: 'icon', dataField: 'imageID', caption: '', width: '40px', allowResizing: false, cellRender: cellRenderImageListItemIcon },
|
|
45
|
+
{ name: 'name', dataField: 'imageID', caption: '', cellRender: cellRenderName }
|
|
46
|
+
];
|
|
47
|
+
}, []);
|
|
48
|
+
return (_jsx(TMChooserForm, { title: "Immagini", hasShowId: false, allowMultipleSelection: false, height: props.height, width: '200px', showDefaultColumns: false, keyName: 'imageID', columns: dataColumns, selectedIDs: props.selectedIDs, dataSource: props.dataSource, getItems: getItems, onClose: props.onClose, onChoose: (IDs) => {
|
|
49
|
+
if (IDs && IDs.length > 0) {
|
|
50
|
+
props.onChoose?.(IDs[0]);
|
|
51
|
+
}
|
|
52
|
+
} }));
|
|
53
|
+
};
|
|
@@ -21,7 +21,7 @@ const TMMetadataChooser = ({ tmSession, dataSource, showEditButton = true, butto
|
|
|
21
21
|
return undefined;
|
|
22
22
|
};
|
|
23
23
|
const renderTemplate = useMemo(() => {
|
|
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 })] }));
|
|
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 ?? SDKUI_Localizator.SelectMetadata })] }));
|
|
25
25
|
}, [values, tmSession, showId, showCompleteMetadataName, placeHolder]);
|
|
26
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
27
|
if (!disabled) {
|
|
@@ -37,7 +37,9 @@ export const TMUserChooserForm = ({ allowMultipleSelection, columns, hideRefresh
|
|
|
37
37
|
const dataColumns = useMemo(() => {
|
|
38
38
|
return [
|
|
39
39
|
{ dataField: 'domain', caption: SDKUI_Localizator.Domain, dataType: 'string' },
|
|
40
|
-
{ dataField: 'name', caption: SDKUI_Localizator.UserName, dataType: 'string' }
|
|
40
|
+
{ dataField: 'name', caption: SDKUI_Localizator.UserName, dataType: 'string' },
|
|
41
|
+
{ dataField: 'fn', caption: SDKUI_Localizator.User_FirstName, dataType: 'string' },
|
|
42
|
+
{ dataField: 'ln', caption: SDKUI_Localizator.User_LastName, dataType: 'string' }
|
|
41
43
|
];
|
|
42
44
|
}, []);
|
|
43
45
|
const getItems = async (refreshCache) => {
|
|
@@ -100,7 +102,7 @@ export const TMUserTooltip = ({ ud, children }) => {
|
|
|
100
102
|
.filter(Boolean)
|
|
101
103
|
.join('\n');
|
|
102
104
|
};
|
|
103
|
-
return (_jsx("
|
|
105
|
+
return (_jsx("span", { title: buildTitle(ud), style: { display: 'inline-flex', alignItems: 'center' }, children: children }));
|
|
104
106
|
};
|
|
105
107
|
const getCompleteUserName = (domain, name) => {
|
|
106
108
|
if (!name)
|
|
@@ -63,7 +63,7 @@ const TMDateBox = (props) => {
|
|
|
63
63
|
return "datetime";
|
|
64
64
|
return props.dateDisplayType == DateDisplayTypes.Date ? "date" : "time";
|
|
65
65
|
};
|
|
66
|
-
return (_jsxs("div", { style: { display: 'flex', alignItems: 'center', width: '100%', padding: props.padding }, children: [props.icon && (_jsx("span", { style: { marginRight: '8px', marginTop: '8px', display: 'flex', alignItems: 'center' }, children: props.icon })), _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '5px', width: '100%' }, children: [_jsx(DateBox, { readOnly: props.readOnly, ref: dateBoxRef, showClearButton: props.showClearButton, dateSerializationFormat: props.useDateSerializationFormat ? 'yyyy-MM-ddTHH:mm:ss' : undefined, disabled: props.disabled, displayFormat: props.displayFormat ?? Globalization.getDateDisplayFormat(props.dateDisplayType), dropDownOptions: dropDownOptions, label: props.label, labelMode: 'static', type: getType(), useMaskBehavior: true, height: '28px', value: props.value, width: props.width, valueChangeEvent: 'keyup input change', onValueChange: (e) => { props.onValueChange?.(e); }, onInitialized: (e) => { props.onInitialized?.(e); }, onContentReady: (e) => { props.onContentReady?.(e); }, placeholder: props.placeholder, onKeyUp: (e) => {
|
|
66
|
+
return (_jsxs("div", { style: { display: 'flex', alignItems: 'center', width: '100%', padding: props.padding }, children: [props.icon && (_jsx("span", { style: { marginRight: '8px', marginTop: '8px', display: 'flex', alignItems: 'center' }, children: props.icon })), _jsxs("div", { onContextMenu: (e) => e.stopPropagation(), style: { display: 'flex', flexDirection: 'column', gap: '5px', width: '100%' }, children: [_jsx(DateBox, { readOnly: props.readOnly, ref: dateBoxRef, showClearButton: props.showClearButton, dateSerializationFormat: props.useDateSerializationFormat ? 'yyyy-MM-ddTHH:mm:ss' : undefined, disabled: props.disabled, displayFormat: props.displayFormat ?? Globalization.getDateDisplayFormat(props.dateDisplayType), dropDownOptions: dropDownOptions, label: props.label, labelMode: 'static', type: getType(), useMaskBehavior: true, height: '28px', value: props.value, width: props.width, valueChangeEvent: 'keyup input change', onValueChange: (e) => { props.onValueChange?.(e); }, onInitialized: (e) => { props.onInitialized?.(e); }, onContentReady: (e) => { props.onContentReady?.(e); }, placeholder: props.placeholder, onKeyUp: (e) => {
|
|
67
67
|
if (e.event?.code == "Space") {
|
|
68
68
|
const currentDate = new Date();
|
|
69
69
|
currentDate.setHours(0, 0, 0, 0);
|
|
@@ -158,7 +158,7 @@ const TMHtmlEditor = (props) => {
|
|
|
158
158
|
borderStyle: 'solid',
|
|
159
159
|
borderColor: hasValidationErrors ? "red" : "#e0e0e0 #e0e0e0 #616161",
|
|
160
160
|
width: "100%",
|
|
161
|
-
height: `calc(100% - ${showCount ? 15 : 0}px - ${validationItems.length > 0 ?
|
|
161
|
+
height: `calc(100% - ${showCount ? 15 : 0}px - ${validationItems.length > 0 ? 25 : 0}px)`,
|
|
162
162
|
}, children: _jsx(HtmlEditor, { ref: editorRef, placeholder: SDKUI_Localizator.TypeAMessage + "...", width: "100%", height: "100%", value: markup, onValueChange: onValueChangeCallback, mentions: mentionsConfig, style: { overflow: 'hidden', outline: "none", fontSize: '1rem' }, children: isEditorEnabled && (toolbarMode === 'compact' ?
|
|
163
163
|
_jsxs(Toolbar, { multiline: false, children: [_jsx(Item, { name: "undo" }), _jsx(Item, { name: "redo" }), _jsx(Item, { name: "separator" }), _jsx(Item, { name: "bold" }), _jsx(Item, { name: "italic" }), _jsx(Item, { name: "strike" }), _jsx(Item, { name: "underline" }), _jsx(Item, { name: "separator" }), _jsx(Item, { name: "orderedList" }), _jsx(Item, { name: "bulletList" })] }) :
|
|
164
164
|
_jsxs(Toolbar, { children: [_jsx(Item, { name: "undo" }), _jsx(Item, { name: "redo" }), _jsx(Item, { name: "separator" }), _jsx(Item, { name: "separator" }), _jsx(Item, { name: "bold" }), _jsx(Item, { name: "italic" }), _jsx(Item, { name: "strike" }), _jsx(Item, { name: "underline" }), _jsx(Item, { name: "separator" }), _jsx(Item, { name: "alignLeft" }), _jsx(Item, { name: "alignCenter" }), _jsx(Item, { name: "alignRight" }), _jsx(Item, { name: "alignJustify" }), _jsx(Item, { name: "separator" }), _jsx(Item, { name: "color" }), _jsx(Item, { name: "background" }), _jsx(Item, { name: "separator" }), _jsx(Item, { name: "link" }), _jsx(Item, { name: "image" }), _jsx(Item, { name: "separator" })] })) }) }), showCount ? ((() => {
|
|
@@ -15,6 +15,7 @@ interface TMLocalizedTextBoxProps {
|
|
|
15
15
|
validationItems?: ValidationItem[];
|
|
16
16
|
qd?: QueryDescriptor;
|
|
17
17
|
tid?: number;
|
|
18
|
+
readOnly?: boolean;
|
|
18
19
|
onValueChanged: (lang: CultureIDs, value: string) => void;
|
|
19
20
|
}
|
|
20
21
|
declare const TMLocalizedTextBox: React.FC<TMLocalizedTextBoxProps>;
|
|
@@ -40,7 +40,7 @@ const Popover = styled.div `
|
|
|
40
40
|
border-radius: 4px;
|
|
41
41
|
background-color: #fff;
|
|
42
42
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
43
|
-
z-index:
|
|
43
|
+
z-index: 2000000001;
|
|
44
44
|
padding: 8px;
|
|
45
45
|
`;
|
|
46
46
|
const Badge = styled.span `
|
|
@@ -71,7 +71,7 @@ export const getCultureIDImg = (cultureID) => {
|
|
|
71
71
|
default: return it;
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
|
-
const TMLocalizedTextBox = ({ label, value, value_IT, value_EN, value_FR, value_PT, value_ES, value_DE, isModifiedWhen, validationItems, qd, tid, onValueChanged, }) => {
|
|
74
|
+
const TMLocalizedTextBox = ({ label, value, value_IT, value_EN, value_FR, value_PT, value_ES, value_DE, isModifiedWhen, validationItems, qd, tid, readOnly, onValueChanged, }) => {
|
|
75
75
|
const [isPopoverVisible, setIsPopoverVisible] = useState(false);
|
|
76
76
|
const containerRef = useRef(null);
|
|
77
77
|
const popoverRef = useRef(null);
|
|
@@ -122,6 +122,6 @@ const TMLocalizedTextBox = ({ label, value, value_IT, value_EN, value_FR, value_
|
|
|
122
122
|
icon: (_jsxs(IconContainer, { children: [_jsx(IconLanguage, {}), localizedCount > 0 && _jsx(Badge, { children: localizedCount })] })),
|
|
123
123
|
onClick: handleTogglePopover,
|
|
124
124
|
};
|
|
125
|
-
return (_jsxs(LocalizedContainer, { ref: containerRef, children: [(qd || tid) ? (_jsx(TMMetadataTextBox, { type: "text", label: label, value: value, isModifiedWhen: isModifiedWhen, buttons: [localizationButton], validationItems: validationItems, qd: qd, tid: tid, onValueChanged: (e) => onValueChanged(CultureIDs.None, e.target.value) })) : (_jsx(TMTextBox, { type: "text", label: label, value: value, isModifiedWhen: isModifiedWhen, buttons: [localizationButton], validationItems: validationItems, onValueChanged: (e) => onValueChanged(CultureIDs.None, e.target.value) })), isPopoverVisible && (_jsx(Portal, { popoverRef: popoverRef, children: _jsx(Popover, { ref: popoverRef, "$isVisible": isPopoverVisible, "$top": popoverPosition.top, "$left": popoverPosition.left, "$width": popoverPosition.width, onMouseDown: (e) => e.stopPropagation(), children: languages.map((lang) => ((qd || tid) ? (_jsx(TMMetadataTextBox, { label: `${lang.label}`, showClearButton: true, icon: _jsx("img", { src: getCultureIDImg(lang.code), alt: "Lang", width: 18, height: 18 }), value: lang.value || '', qd: qd, tid: tid, onValueChanged: (e) => onValueChanged(lang.code, e.target.value) }, lang.code)) : (_jsx(TMTextBox, { label: `${lang.label}`, showClearButton: true, icon: _jsx("img", { src: getCultureIDImg(lang.code), alt: "Lang", width: 18, height: 18 }), value: lang.value || '', onValueChanged: (e) => onValueChanged(lang.code, e.target.value) }, lang.code)))) }) }))] }));
|
|
125
|
+
return (_jsxs(LocalizedContainer, { ref: containerRef, children: [(qd || tid) ? (_jsx(TMMetadataTextBox, { type: "text", label: label, value: value, isModifiedWhen: isModifiedWhen, buttons: [localizationButton], validationItems: validationItems, qd: qd, tid: tid, readOnly: readOnly, onValueChanged: (e) => onValueChanged(CultureIDs.None, e.target.value) })) : (_jsx(TMTextBox, { type: "text", label: label, value: value, isModifiedWhen: isModifiedWhen, buttons: [localizationButton], validationItems: validationItems, readOnly: readOnly, onValueChanged: (e) => onValueChanged(CultureIDs.None, e.target.value) })), isPopoverVisible && (_jsx(Portal, { popoverRef: popoverRef, children: _jsx(Popover, { ref: popoverRef, "$isVisible": isPopoverVisible, "$top": popoverPosition.top, "$left": popoverPosition.left, "$width": popoverPosition.width, onMouseDown: (e) => e.stopPropagation(), children: languages.map((lang) => ((qd || tid) ? (_jsx(TMMetadataTextBox, { label: `${lang.label}`, showClearButton: true, icon: _jsx("img", { src: getCultureIDImg(lang.code), alt: "Lang", width: 18, height: 18 }), value: lang.value || '', qd: qd, tid: tid, readOnly: readOnly, onValueChanged: (e) => onValueChanged(lang.code, e.target.value) }, lang.code)) : (_jsx(TMTextBox, { label: `${lang.label}`, showClearButton: true, icon: _jsx("img", { src: getCultureIDImg(lang.code), alt: "Lang", width: 18, height: 18 }), value: lang.value || '', readOnly: readOnly, onValueChanged: (e) => onValueChanged(lang.code, e.target.value) }, lang.code)))) }) }))] }));
|
|
126
126
|
};
|
|
127
127
|
export default TMLocalizedTextBox;
|