@topconsultnpm/sdkui-react 6.20.0-dev1.5 → 6.20.0-dev1.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/lib/components/NewComponents/ContextMenu/TMContextMenu.d.ts +4 -0
  2. package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +302 -0
  3. package/lib/components/NewComponents/ContextMenu/hooks.d.ts +13 -0
  4. package/lib/components/NewComponents/ContextMenu/hooks.js +61 -0
  5. package/lib/components/NewComponents/ContextMenu/index.d.ts +2 -0
  6. package/lib/components/NewComponents/ContextMenu/index.js +1 -0
  7. package/lib/components/NewComponents/ContextMenu/styles.d.ts +31 -0
  8. package/lib/components/NewComponents/ContextMenu/styles.js +336 -0
  9. package/lib/components/NewComponents/ContextMenu/types.d.ts +38 -0
  10. package/lib/components/NewComponents/ContextMenu/types.js +1 -0
  11. package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.d.ts +4 -0
  12. package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +686 -0
  13. package/lib/components/NewComponents/FloatingMenuBar/index.d.ts +2 -0
  14. package/lib/components/NewComponents/FloatingMenuBar/index.js +2 -0
  15. package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +47 -0
  16. package/lib/components/NewComponents/FloatingMenuBar/styles.js +346 -0
  17. package/lib/components/NewComponents/FloatingMenuBar/types.d.ts +28 -0
  18. package/lib/components/NewComponents/FloatingMenuBar/types.js +1 -0
  19. package/lib/components/base/TMCustomButton.js +61 -17
  20. package/lib/components/base/TMDataGrid.d.ts +7 -4
  21. package/lib/components/base/TMDataGrid.js +112 -11
  22. package/lib/components/choosers/TMMetadataChooser.js +8 -1
  23. package/lib/components/editors/TMMetadataValues.js +23 -5
  24. package/lib/components/features/documents/TMDcmtForm.d.ts +13 -1
  25. package/lib/components/features/documents/TMDcmtForm.js +385 -193
  26. package/lib/components/features/documents/TMDcmtPreview.js +37 -66
  27. package/lib/components/features/documents/TMMasterDetailDcmts.js +1 -1
  28. package/lib/components/features/search/TMDcmtCheckoutInfoForm.d.ts +8 -0
  29. package/lib/components/features/search/{TMSearchResultCheckoutInfoForm.js → TMDcmtCheckoutInfoForm.js} +5 -10
  30. package/lib/components/features/search/TMSearch.js +30 -5
  31. package/lib/components/features/search/TMSearchQueryPanel.js +13 -12
  32. package/lib/components/features/search/TMSearchResult.js +58 -208
  33. package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +3 -3
  34. package/lib/components/features/search/TMSearchResultsMenuItems.js +205 -169
  35. package/lib/components/features/search/TMSignSettingsForm.js +1 -1
  36. package/lib/components/features/search/TMSignatureInfoContent.d.ts +6 -0
  37. package/lib/components/features/search/TMSignatureInfoContent.js +140 -0
  38. package/lib/components/features/search/TMViewHistoryDcmt.js +1 -1
  39. package/lib/components/features/tasks/TMTasksView.js +2 -2
  40. package/lib/components/features/workflow/diagram/WFDiagram.js +2 -2
  41. package/lib/components/forms/Login/LoginValidatorService.d.ts +2 -0
  42. package/lib/components/forms/Login/LoginValidatorService.js +7 -2
  43. package/lib/components/forms/Login/TMLoginForm.js +34 -6
  44. package/lib/components/forms/TMChooserForm.js +1 -1
  45. package/lib/components/index.d.ts +1 -0
  46. package/lib/components/index.js +1 -0
  47. package/lib/css/tm-sdkui.css +1 -1
  48. package/lib/helper/SDKUI_Globals.d.ts +17 -0
  49. package/lib/helper/SDKUI_Globals.js +9 -0
  50. package/lib/helper/SDKUI_Localizator.d.ts +2 -1
  51. package/lib/helper/SDKUI_Localizator.js +11 -1
  52. package/lib/helper/TMIcons.d.ts +1 -0
  53. package/lib/helper/TMIcons.js +3 -0
  54. package/lib/helper/TMPdfViewer.d.ts +8 -0
  55. package/lib/helper/TMPdfViewer.js +187 -0
  56. package/lib/helper/checkinCheckoutManager.d.ts +32 -2
  57. package/lib/helper/checkinCheckoutManager.js +115 -38
  58. package/lib/helper/devextremeCustomMessages.d.ts +30 -0
  59. package/lib/helper/devextremeCustomMessages.js +30 -0
  60. package/lib/helper/helpers.d.ts +2 -1
  61. package/lib/helper/helpers.js +12 -2
  62. package/lib/helper/index.d.ts +1 -0
  63. package/lib/helper/index.js +1 -0
  64. package/lib/helper/queryHelper.js +29 -0
  65. package/lib/hooks/useCheckInOutOperations.d.ts +28 -0
  66. package/lib/hooks/useCheckInOutOperations.js +223 -0
  67. package/lib/hooks/useWorkflowApprove.d.ts +4 -0
  68. package/lib/hooks/useWorkflowApprove.js +14 -1
  69. package/package.json +5 -2
  70. package/lib/components/features/search/TMSearchResultCheckoutInfoForm.d.ts +0 -8
@@ -1,9 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React, { useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
3
- import DataGrid, { Column, HeaderFilter, Selection, Scrolling, LoadPanel, SearchPanel, Pager, Sorting, Paging, FilterPanel, ColumnChooser, Grouping, GroupPanel, Summary, Editing, FilterRow, StateStoring, RowDragging, MasterDetail } from 'devextreme-react/data-grid';
3
+ import DataGrid, { Column, HeaderFilter, Selection, Scrolling, LoadPanel, SearchPanel, Pager, Sorting, Paging, FilterPanel, ColumnChooser, Grouping, GroupPanel, Summary, Editing, FilterRow, StateStoring, RowDragging, MasterDetail, Position, ColumnChooserSearch, ColumnChooserSelection } from 'devextreme-react/data-grid';
4
4
  import DataSource from 'devextreme/data/data_source';
5
5
  import { IconAll, IconSelected, IconVisible, SDKUI_Globals, SDKUI_Localizator } from '../../helper';
6
6
  import TMCounterContainer, { CounterItemKey } from './TMCounterContainer';
7
+ import TMContextMenu from '../NewComponents/ContextMenu/TMContextMenu';
7
8
  ;
8
9
  export var TMDataGridPageSize;
9
10
  (function (TMDataGridPageSize) {
@@ -16,9 +17,9 @@ const TMDataGrid = React.forwardRef((props, ref) => {
16
17
  // main properties
17
18
  keyExpr = 'id', dataSource, focusedRowEnabled = true, hoverStateEnabled = true, focusedRowKey, selectedRowKeys = [],
18
19
  // custom options
19
- dataColumns = [], pageSize = TMDataGridPageSize.Large, showHeaderFilter = true, showFilterPanel = true, showLoadPanel = true, showSearchPanel = true, searchPanelToolbarPosition = 'before', searchPanelFocusStarting = false, counterConfig = { show: false, items: new Map() }, onHasFiltersChange,
20
+ dataColumns = [], pageSize = TMDataGridPageSize.Large, showHeaderFilter = true, showFilterPanel = true, showHeaderColumnChooser = false, showLoadPanel = true, showSearchPanel = true, searchPanelToolbarPosition = 'before', searchPanelFocusTrigger = 0, counterConfig = { show: false, items: new Map() }, onHasFiltersChange, customContextMenuItems,
20
21
  // events and callbacks
21
- onSelectionChanged, onFocusedRowChanged, onRowDblClick, onRowClick, onCellClick, onCellDblClick, onOptionChanged, onContentReady, onContextMenuPreparing, onInitialized, onEditorPreparing, onCellPrepared, onRowPrepared, onRowUpdating, onRowExpanded, onRowCollapsed, onRowUpdated, onSaved, onEditCanceled, onEditingStart, onEditingChange, customizeColumns, onKeyDown, scrolling = { mode: 'standard', useNative: SDKUI_Globals.userSettings?.themeSettings.gridSettings.useNativeScrollbar === 1 }, paging = { enabled: true, pageSize: pageSize }, pager = { visible: true, showInfo: true, showNavigationButtons: true }, selection = { mode: 'multiple', showCheckBoxesMode: "always", selectAllMode: "allPages" }, sorting, summary, stateStoring, columnChooser, grouping, groupPanel, filterRow, headerFilter, editing, rowDragging, masterDetail,
22
+ onSelectionChanged, onFocusedRowChanged, onRowDblClick, onRowClick, onCellClick, onCellDblClick, onOptionChanged, onContentReady, onContextMenuPreparing, onInitialized, onEditorPreparing, onCellPrepared, onRowPrepared, onRowUpdating, onRowExpanded, onRowCollapsed, onRowUpdated, onSaved, onEditCanceled, onEditingStart, onEditingChange, customizeColumns, onKeyDown, scrolling = { mode: 'standard', useNative: SDKUI_Globals.userSettings?.themeSettings.gridSettings.useNativeScrollbar === 1 }, paging = { enabled: true, pageSize: pageSize }, pager = { visible: true, showInfo: true, showNavigationButtons: true }, selection = { mode: 'multiple', showCheckBoxesMode: "always", selectAllMode: "allPages" }, sorting, summary, stateStoring, grouping, groupPanel, filterRow, headerFilter, editing, rowDragging, masterDetail,
22
23
  // other properties
23
24
  disabled = false, autoNavigateToFocusedRow = true, columnResizingMode = 'widget', columnHidingEnabled = true, columnAutoWidth = true, allowColumnResizing = true, allowColumnReordering = true, showBorders = true, showRowLines = SDKUI_Globals.userSettings?.themeSettings.gridSettings.showRowLines === 1, showColumnLines = SDKUI_Globals.userSettings?.themeSettings.gridSettings.showColumnLines === 1, showColumnHeaders = true, rowAlternationEnabled = false, wordWrapEnabled = false, noDataText,
24
25
  // styles
@@ -29,10 +30,53 @@ const TMDataGrid = React.forwardRef((props, ref) => {
29
30
  const [totalRecordCount, setTotalRecordCount] = useState(0);
30
31
  const [visibleItemsCount, setVisibleItemsCount] = useState(0);
31
32
  const [hasFilters, setHasFilters] = useState(false);
33
+ // Custom context menu states
34
+ const [customContextMenuVisible, setCustomContextMenuVisible] = useState(false);
35
+ const [customContextMenuPosition, setCustomContextMenuPosition] = useState({ x: 0, y: 0 });
36
+ const [customContextMenuRowKey, setCustomContextMenuRowKey] = useState(undefined);
37
+ const gridContainerRef = useRef(null);
32
38
  useEffect(() => {
33
39
  const count = getRecordCount(dataSource);
34
40
  setTotalRecordCount(count);
35
41
  }, [dataSource]);
42
+ // Handle search panel focus when trigger changes
43
+ useEffect(() => {
44
+ if (!searchPanelFocusTrigger || searchPanelFocusTrigger <= 0 || !showSearchPanel || !internalRef.current)
45
+ return;
46
+ setTimeout(() => {
47
+ const searchInput = internalRef.current?.instance().element().querySelector('.dx-datagrid-search-panel input');
48
+ if (searchInput) {
49
+ searchInput.focus();
50
+ }
51
+ }, 100);
52
+ }, [searchPanelFocusTrigger, showSearchPanel]);
53
+ // Handle custom context menu (only when customContextMenuItems is provided)
54
+ useEffect(() => {
55
+ if (!customContextMenuItems || !gridContainerRef.current)
56
+ return;
57
+ const gridContainer = gridContainerRef.current;
58
+ const handleContextMenu = (e) => {
59
+ e.preventDefault();
60
+ e.stopPropagation();
61
+ // Get the clicked row
62
+ const target = e.target;
63
+ const rowElement = target.closest('.dx-data-row');
64
+ if (rowElement && internalRef.current) {
65
+ const rowIndex = Array.from(rowElement.parentElement?.children || []).indexOf(rowElement);
66
+ const rowKey = internalRef.current.instance().getKeyByRowIndex(rowIndex);
67
+ // Change focused row
68
+ internalRef.current.instance().option('focusedRowKey', rowKey);
69
+ // Show custom context menu
70
+ setCustomContextMenuVisible(true);
71
+ setCustomContextMenuPosition({ x: e.clientX, y: e.clientY });
72
+ setCustomContextMenuRowKey(rowKey);
73
+ }
74
+ };
75
+ gridContainer.addEventListener('contextmenu', handleContextMenu);
76
+ return () => {
77
+ gridContainer.removeEventListener('contextmenu', handleContextMenu);
78
+ };
79
+ }, [customContextMenuItems]);
36
80
  // Creating a ref to store the timestamp of the last selection change
37
81
  const lastSelectionChangeTime = useRef(Date.now());
38
82
  useEffect(() => {
@@ -101,6 +145,8 @@ const TMDataGrid = React.forwardRef((props, ref) => {
101
145
  }
102
146
  return {
103
147
  ...item,
148
+ // Ensure icon is not null/undefined to prevent DevExtreme errors
149
+ icon: item.icon || '',
104
150
  disabled: disabled || disabledCalculation, // An item is disabled if it's explicitly set to `true` or if the calculation above determines so
105
151
  // Define the behavior when the menu item is clicked
106
152
  onClick: () => {
@@ -132,10 +178,51 @@ const TMDataGrid = React.forwardRef((props, ref) => {
132
178
  };
133
179
  });
134
180
  }, [focusedRowEnabled, focusedRowKey, selectedRowKeys]);
181
+ // Process custom context menu items (for TMContextMenuItemProps)
182
+ const processCustomContextMenuItems = useCallback((items, rowID) => {
183
+ return items.map(item => {
184
+ let disabled = item.disabled ?? false;
185
+ let disabledCalculation = false;
186
+ const id = focusedRowEnabled ? focusedRowKey : rowID;
187
+ if (item.operationType === 'singleRow') {
188
+ disabledCalculation = selectedRowKeys.length > 1 || id === undefined;
189
+ }
190
+ if (item.operationType === 'multiRow') {
191
+ disabledCalculation = selectedRowKeys.length === 0 && id === undefined;
192
+ }
193
+ const originalOnClick = item.onClick;
194
+ return {
195
+ ...item,
196
+ disabled: disabled || disabledCalculation,
197
+ onClick: originalOnClick ? () => {
198
+ if (item.operationType === 'singleRow' && id !== undefined) {
199
+ originalOnClick(id);
200
+ }
201
+ else if (item.operationType === 'multiRow' && id !== undefined) {
202
+ if (selectedRowKeys.length > 0) {
203
+ originalOnClick(selectedRowKeys);
204
+ }
205
+ else {
206
+ originalOnClick([id]);
207
+ }
208
+ }
209
+ else {
210
+ originalOnClick();
211
+ }
212
+ } : undefined,
213
+ submenu: item.submenu ? processCustomContextMenuItems(item.submenu, id) : undefined,
214
+ };
215
+ });
216
+ }, [focusedRowEnabled, focusedRowKey, selectedRowKeys]);
135
217
  // Handle context menu preparation
136
218
  const onContextMenuPreparingCallback = useCallback((e) => {
137
219
  if (e === undefined)
138
220
  return;
221
+ // If custom context menu is enabled, completely disable DevExtreme's native context menu
222
+ if (customContextMenuItems && e.target === 'content') {
223
+ e.items = undefined;
224
+ return;
225
+ }
139
226
  if (onContextMenuPreparing)
140
227
  onContextMenuPreparing(e);
141
228
  if (e.target === 'content') {
@@ -146,7 +233,18 @@ const TMDataGrid = React.forwardRef((props, ref) => {
146
233
  e.items = [...updatedContextMenuItems];
147
234
  }
148
235
  }
149
- }, [updateContextMenuItems, onContextMenuPreparing]);
236
+ // Add column chooser to header context menu
237
+ if (e.target === 'header' && showHeaderColumnChooser) {
238
+ e.items = e.items || [];
239
+ e.items.push({
240
+ text: SDKUI_Localizator.ShowColumnSelection,
241
+ icon: 'columnchooser',
242
+ onItemClick: () => {
243
+ internalRef.current?.instance().showColumnChooser();
244
+ }
245
+ });
246
+ }
247
+ }, [updateContextMenuItems, onContextMenuPreparing, showHeaderColumnChooser, customContextMenuItems]);
150
248
  // Handle toolbar preparation, especially for the search panel
151
249
  const onToolbarPreparingCallback = useCallback((e) => {
152
250
  if (e === undefined || e.toolbarOptions === undefined || e.toolbarOptions.items === undefined)
@@ -171,10 +269,9 @@ const TMDataGrid = React.forwardRef((props, ref) => {
171
269
  return;
172
270
  // Update state with the current number of visible rows in the DataGrid
173
271
  setVisibleItemsCount(internalRef.current.instance()?.getVisibleRows()?.length ?? 0);
174
- // Focusing SearchPanel
175
- if (showSearchPanel && searchPanelFocusStarting) {
272
+ // Focusing SearchPanel on content ready
273
+ if (showSearchPanel && searchPanelFocusTrigger && searchPanelFocusTrigger > 0) {
176
274
  // Use a small delay to ensure the DOM is fully rendered before trying to focus
177
- // This can prevent issues with the focus not being set correctly
178
275
  setTimeout(() => {
179
276
  const searchInput = internalRef.current?.instance().element().querySelector('.dx-datagrid-search-panel input');
180
277
  if (searchInput) {
@@ -182,7 +279,7 @@ const TMDataGrid = React.forwardRef((props, ref) => {
182
279
  }
183
280
  }, 100);
184
281
  }
185
- }, [onContentReady]);
282
+ }, [onContentReady, showSearchPanel, searchPanelFocusTrigger]);
186
283
  const onOptionChangedCallback = useCallback((e) => {
187
284
  // Assicurati che component esista
188
285
  const grid = e.component;
@@ -215,15 +312,19 @@ const TMDataGrid = React.forwardRef((props, ref) => {
215
312
  // Propaga l'evento originale
216
313
  onOptionChanged?.(e);
217
314
  }, [onOptionChanged, onHasFiltersChange]);
218
- return _jsxs("div", { style: { width: "100%", height: "100%" }, children: [_jsx("div", { style: { width: "100%", height: counterConfig.show ? "calc(100% - 25px)" : "100%" }, children: _jsxs(DataGrid, { ref: internalRef, id: id, className: `tm-datagrid ${hasFilters ? 'has-filters' : ''}`,
315
+ return _jsxs("div", { style: { width: "100%", height: "100%" }, children: [_jsx("div", { ref: gridContainerRef, style: { width: "100%", height: counterConfig.show ? "calc(100% - 25px)" : "100%" }, children: _jsxs(DataGrid, { ref: internalRef, id: id, className: `tm-datagrid ${hasFilters ? 'has-filters' : ''}`,
219
316
  // main properties
220
317
  keyExpr: keyExpr, dataSource: dataSource, selectedRowKeys: selectedRowKeys, focusedRowEnabled: focusedRowEnabled, hoverStateEnabled: hoverStateEnabled,
221
318
  // events and callbacks
222
- onSelectionChanged: onSelectionChangedCallback, onRowDblClick: onRowDblClickCallback, onRowPrepared: onRowPrepared, onContextMenuPreparing: onContextMenuPreparingCallback, onToolbarPreparing: onToolbarPreparingCallback, onFocusedRowChanged: onFocusedRowChanged, onRowClick: onRowClick, onCellClick: onCellClick, onCellDblClick: onCellDblClick, onOptionChanged: onOptionChangedCallback, onContentReady: onContentReadyCallback, onInitialized: onInitialized, customizeColumns: customizeColumns, onEditorPreparing: onEditorPreparing, onCellPrepared: onCellPrepared, onRowUpdating: onRowUpdating, onRowExpanded: onRowExpanded, onRowCollapsed: onRowCollapsed, onRowUpdated: onRowUpdated, onSaved: onSaved, onEditCanceled: onEditCanceled, onEditingStart: onEditingStart, onEditingChange: onEditingChange, onKeyDown: onKeyDown,
319
+ onSelectionChanged: onSelectionChangedCallback, onRowDblClick: onRowDblClickCallback, onRowPrepared: onRowPrepared, onContextMenuPreparing: customContextMenuItems ? undefined : onContextMenuPreparingCallback, onToolbarPreparing: onToolbarPreparingCallback, onFocusedRowChanged: onFocusedRowChanged, onRowClick: onRowClick, onCellClick: onCellClick, onCellDblClick: onCellDblClick, onOptionChanged: onOptionChangedCallback, onContentReady: onContentReadyCallback, onInitialized: onInitialized, customizeColumns: customizeColumns, onEditorPreparing: onEditorPreparing, onCellPrepared: onCellPrepared, onRowUpdating: onRowUpdating, onRowExpanded: onRowExpanded, onRowCollapsed: onRowCollapsed, onRowUpdated: onRowUpdated, onSaved: onSaved, onEditCanceled: onEditCanceled, onEditingStart: onEditingStart, onEditingChange: onEditingChange, onKeyDown: onKeyDown,
223
320
  // other properties
224
321
  disabled: disabled, autoNavigateToFocusedRow: autoNavigateToFocusedRow, focusedRowKey: focusedRowKey, columnHidingEnabled: columnHidingEnabled, columnResizingMode: columnResizingMode, columnAutoWidth: columnAutoWidth, allowColumnResizing: allowColumnResizing, allowColumnReordering: allowColumnReordering, showBorders: showBorders, showRowLines: showRowLines, showColumnLines: showColumnLines, showColumnHeaders: showColumnHeaders, rowAlternationEnabled: rowAlternationEnabled, wordWrapEnabled: wordWrapEnabled, noDataText: noDataText,
225
322
  // styles
226
- width: width, height: height, style: { userSelect: 'none' }, children: [dataColumns.map((column, index) => (_jsx(Column, { ...column }, column.caption + index.toString()))), sorting && _jsx(Sorting, { ...sorting }), selection && _jsx(Selection, { ...selection }), scrolling && _jsx(Scrolling, { ...scrolling }), summary && _jsx(Summary, { ...summary }), showHeaderFilter && _jsx(HeaderFilter, { visible: true, ...headerFilter }), rowDragging && _jsx(RowDragging, { ...rowDragging }), filterRow && _jsx(FilterRow, { ...filterRow }), showFilterPanel && _jsx(FilterPanel, { visible: true }), columnChooser && _jsx(ColumnChooser, { ...columnChooser }), stateStoring && _jsx(StateStoring, { ...stateStoring }), groupPanel && _jsx(GroupPanel, { ...groupPanel }), _jsx(Grouping, { contextMenuEnabled: true, ...grouping }), _jsx(LoadPanel, { enabled: showLoadPanel }), _jsx(SearchPanel, { visible: showSearchPanel, searchVisibleColumnsOnly: true, highlightSearchText: true }), editing && _jsx(Editing, { ...editing }), paging && _jsx(Paging, { ...paging }), pager && _jsx(Pager, { ...pager, visible: totalRecordCount > pageSize }), masterDetail && _jsx(MasterDetail, { ...masterDetail })] }) }), counterConfig.show && _jsx("div", { style: { width: "100%", height: "25px", display: "flex", alignItems: "center", gap: "15px", backgroundColor: "#e0e0e0" }, children: _jsx(TMCounterContainer, { items: counterValues, bgColorContainer: counterConfig.bgColorContainer, bgColorItem: counterConfig.bgColorItem, hoverColorItem: counterConfig.hoverColorItem, textColorItem: counterConfig.textColorItem }) })] });
323
+ width: width, height: height, style: { userSelect: 'none' }, children: [dataColumns.map((column, index) => (_jsx(Column, { ...column }, column.caption + index.toString()))), sorting && _jsx(Sorting, { ...sorting }), selection && _jsx(Selection, { ...selection }), scrolling && _jsx(Scrolling, { ...scrolling }), summary && _jsx(Summary, { ...summary }), showHeaderFilter && _jsx(HeaderFilter, { visible: true, ...headerFilter }), rowDragging && _jsx(RowDragging, { ...rowDragging }), filterRow && _jsx(FilterRow, { ...filterRow }), showFilterPanel && _jsx(FilterPanel, { visible: true }), showHeaderColumnChooser && _jsxs(ColumnChooser, { height: "400px", enabled: !showHeaderColumnChooser, mode: "select", children: [_jsx(Position, { my: "center", at: "center", of: window }), _jsx(ColumnChooserSearch, { enabled: true }), _jsx(ColumnChooserSelection, { allowSelectAll: false, selectByClick: true, recursive: true })] }), stateStoring && _jsx(StateStoring, { ...stateStoring }), groupPanel && _jsx(GroupPanel, { ...groupPanel }), _jsx(Grouping, { contextMenuEnabled: true, ...grouping }), _jsx(LoadPanel, { enabled: showLoadPanel }), _jsx(SearchPanel, { visible: showSearchPanel, searchVisibleColumnsOnly: true, highlightSearchText: true }), editing && _jsx(Editing, { ...editing }), paging && _jsx(Paging, { ...paging }), pager && _jsx(Pager, { ...pager, visible: totalRecordCount > pageSize }), masterDetail && _jsx(MasterDetail, { ...masterDetail })] }) }), counterConfig.show && _jsx("div", { style: { width: "100%", height: "25px", display: "flex", alignItems: "center", gap: "15px", backgroundColor: "#e0e0e0" }, children: _jsx(TMCounterContainer, { items: counterValues, bgColorContainer: counterConfig.bgColorContainer, bgColorItem: counterConfig.bgColorItem, hoverColorItem: counterConfig.hoverColorItem, textColorItem: counterConfig.textColorItem }) }), customContextMenuItems && (_jsx(TMContextMenu, { items: processCustomContextMenuItems(customContextMenuItems, customContextMenuRowKey), externalControl: {
324
+ visible: customContextMenuVisible,
325
+ position: customContextMenuPosition,
326
+ onClose: () => setCustomContextMenuVisible(false)
327
+ } }))] });
227
328
  });
228
329
  export default TMDataGrid;
229
330
  const getRecordCount = (dataSource) => {
@@ -13,8 +13,15 @@ import TMChooserForm from '../forms/TMChooserForm';
13
13
  import TMSpinner from '../base/TMSpinner';
14
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 }) => {
15
15
  const [showChooser, setShowChooser] = useState(false);
16
+ const getinputMd = () => {
17
+ if (values && values.length > 0 && values[0].mid && values[0].mid < 0) {
18
+ let md = dataSource?.find((md) => md.id === values[0].mid);
19
+ return md;
20
+ }
21
+ return undefined;
22
+ };
16
23
  const renderTemplate = useMemo(() => {
17
- return (_jsxs(StyledDivHorizontal, { style: { width: 'max-content', height: '100%' }, children: [values && _jsx(TMMidViewer, { tmSession: tmSession, tid_mid: values[0], 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 })] }));
18
25
  }, [values, tmSession, showId, showCompleteMetadataName, placeHolder]);
19
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: () => !disabled && setShowChooser(true), elementStyle: elementStyle, isModifiedWhen: isModifiedWhen, template: renderTemplate, onClearClick: showClearButton ? () => { onValueChanged?.([]); } : undefined }), showChooser &&
20
27
  _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: () => setShowChooser(false), onChoose: (tid_mids) => { onValueChanged?.(tid_mids); } })] }));
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React, { useCallback, useEffect, useMemo, useState } from "react";
3
3
  import styled from "styled-components";
4
- import { AccessLevels, DcmtTypeListCacheService, LayoutGroupBorderStyles, LayoutGroupOrientations, LayoutItemTypes, LayoutModes, MetadataDataDomains, MetadataDataTypes, SDK_Globals, SystemMIDsAsNumber, SystemTIDs, TemplateTIDs, WorkItemMetadataNames } from '@topconsultnpm/sdk-ts';
5
- import { IconUndo, IconPencil, IconFunction, IconMenuVertical, IconDataList, SDKUI_Localizator, IconNull, stringIsNullOrEmpty, deepCompare, SDKUI_Globals, IconDcmtTypeSys } from "../../helper";
4
+ import { AccessLevels, DcmtTypeListCacheService, LayoutGroupBorderStyles, LayoutGroupOrientations, LayoutItemTypes, LayoutModes, MetadataDataDomains, MetadataDataTypes, SDK_Globals, SystemMIDsAsNumber, SystemTIDs, WorkItemMetadataNames } from '@topconsultnpm/sdk-ts';
5
+ import { IconUndo, IconPencil, IconFunction, IconMenuVertical, IconDataList, SDKUI_Localizator, IconNull, stringIsNullOrEmpty, deepCompare, SDKUI_Globals, IconDcmtTypeSys, isApprovalWorkflowView } from "../../helper";
6
6
  import { TMColors } from "../../utils/theme";
7
7
  import TMButton from "../base/TMButton";
8
8
  import TMDropDownMenu from "../base/TMDropDownMenu";
@@ -389,17 +389,35 @@ const TMMetadataValues = ({ showCheckBoxes = ShowCheckBoxesMode.Never, checkPerm
389
389
  return (_jsxs("div", { style: { width: '100%' }, children: [draftData.length > 0 && _jsx(TMAccordion, { title: SDKUI_Localizator.Draft, children: draftData.map(item => renderMetadataItem(item, isReadOnly)) }), checkOutData.length > 0 && _jsx(TMAccordion, { title: `${SDKUI_Localizator.CheckIn}/${SDKUI_Localizator.CheckOut}`, children: checkOutData.map(item => renderMetadataItem(item, true)) })] }));
390
390
  }, [metadataValues, showCheckBoxes, showNullValueCheckBoxes, isReadOnly, dynDataListsToBeRefreshed, validationItems, selectedMID, isOpenDistinctValues, openChooserBySingleClick, metadataValuesOrig]);
391
391
  const layoutChronology = useMemo(() => {
392
- const chronologyData = [];
392
+ // Definiamo l'ordine desiderato: Version, Tipo, Dimensione, Autore, Data Ultima modifica
393
+ const desiredChronologyOrder = [
394
+ ChronologyMIDs.Ver,
395
+ SystemMIDsAsNumber.FileExt,
396
+ SystemMIDsAsNumber.FileSize,
397
+ ChronologyMIDs.AuthorID,
398
+ ChronologyMIDs.CheckInTime,
399
+ ];
400
+ const tempChronologyDataMap = {};
393
401
  metadataValues.forEach(item => {
394
402
  switch (item.md?.id) {
395
403
  case ChronologyMIDs.Ver:
396
404
  case ChronologyMIDs.AuthorID:
397
- chronologyData.push(item);
405
+ case ChronologyMIDs.CheckInTime:
406
+ case SystemMIDsAsNumber.FileExt:
407
+ case SystemMIDsAsNumber.FileSize:
408
+ tempChronologyDataMap[item.md.id] = item;
398
409
  break;
399
410
  default:
400
411
  break;
401
412
  }
402
413
  });
414
+ // Visualizziamo nell'ordine desiderato
415
+ const chronologyData = [];
416
+ desiredChronologyOrder.forEach(id => {
417
+ if (tempChronologyDataMap[id]) {
418
+ chronologyData.push(tempChronologyDataMap[id]);
419
+ }
420
+ });
403
421
  return (_jsx("div", { style: { width: '100%' }, children: chronologyData.length > 0 && chronologyData.map(item => renderMetadataItem(item, isReadOnly)) }));
404
422
  }, [metadataValues, showCheckBoxes, showNullValueCheckBoxes, isReadOnly, dynDataListsToBeRefreshed, validationItems, selectedMID, isOpenDistinctValues, openChooserBySingleClick, metadataValuesOrig]);
405
423
  const layoutDsAttachs = useMemo(() => {
@@ -550,7 +568,7 @@ const TMMetadataValues = ({ showCheckBoxes = ShowCheckBoxesMode.Never, checkPerm
550
568
  if (allSystem) {
551
569
  return metadataValues.map((item) => renderMetadataItem(item, true));
552
570
  }
553
- if (currentDTD?.templateTID === TemplateTIDs.WF_WIApprView && !isReadOnly) {
571
+ if (isApprovalWorkflowView(currentDTD) && !isReadOnly) {
554
572
  return layoutWorkItem;
555
573
  }
556
574
  switch (currentDTD?.id) {
@@ -1,6 +1,18 @@
1
1
  import React from 'react';
2
2
  import { HomeBlogPost, LayoutModes, ObjectRef, SearchResultDescriptor, TaskDescriptor, ValidationItem } from '@topconsultnpm/sdk-ts';
3
3
  import { DcmtInfo, FormModes, MetadataValueDescriptorEx, TaskContext } from '../../../ts';
4
+ /**
5
+ * Definisce il contesto da cui è stato invocato il TMDcmtForm.
6
+ * Permette di gestire logiche diverse in base alla provenienza.
7
+ */
8
+ export declare enum InvocationContext {
9
+ /** Invocazione standard */
10
+ Default = "default",
11
+ /** Invocato dalla pagina Todo/Task */
12
+ Todo = "todo",
13
+ /** Invocato dalla pagina WorkflowCtrl */
14
+ WorkflowCtrl = "workflowCtrl"
15
+ }
4
16
  interface ITMDcmtFormProps {
5
17
  allTasks?: Array<TaskDescriptor>;
6
18
  getAllTasks?: () => Promise<void>;
@@ -24,7 +36,7 @@ interface ITMDcmtFormProps {
24
36
  canPrev?: boolean;
25
37
  isClosable?: boolean;
26
38
  groupId?: string;
27
- invokedByTodo?: boolean;
39
+ invocationContext?: InvocationContext;
28
40
  taskFormDialogComponent?: React.ReactNode;
29
41
  taskMoreInfo?: TaskDescriptor;
30
42
  showBackButton?: boolean;