@topconsultnpm/sdkui-react 6.20.0-dev1.76 → 6.20.0-dev1.78
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/TMContextMenu.js +25 -12
- package/lib/components/NewComponents/ContextMenu/hooks.d.ts +3 -1
- package/lib/components/NewComponents/ContextMenu/hooks.js +42 -4
- package/lib/components/NewComponents/ContextMenu/styles.d.ts +4 -0
- package/lib/components/NewComponents/ContextMenu/styles.js +101 -9
- package/lib/components/features/search/TMSearchResult.js +9 -9
- package/lib/components/features/tasks/TMTasksUtils.d.ts +2 -2
- package/lib/components/features/tasks/TMTasksUtils.js +52 -62
- package/lib/components/features/tasks/TMTasksView.js +4 -4
- package/lib/components/features/workflow/TMWorkflowPopup.js +5 -10
- package/lib/components/features/workflow/diagram/WFDiagram.d.ts +1 -0
- package/lib/components/features/workflow/diagram/WFDiagram.js +139 -7
- package/lib/components/query/TMQueryEditor.d.ts +2 -1
- package/lib/components/query/TMQueryEditor.js +92 -92
- package/lib/helper/TMIcons.d.ts +1 -0
- package/lib/helper/TMIcons.js +4 -3
- package/package.json +1 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import { Task_States, PdGs, Priorities, ValidationItem, SDK_Localizator, ResultTypes, SDK_Globals } from '@topconsultnpm/sdk-ts';
|
|
3
2
|
import { TMColors } from '../../../utils/theme';
|
|
4
3
|
import { SDKUI_Localizator } from '../../../helper';
|
|
@@ -402,116 +401,107 @@ export const createTasksMenuItems = (taskDescriptor, showId, setShowId, showSear
|
|
|
402
401
|
const isTaskFromAnotherUser = isTaskDescriptorDefined && areDifferentIDs(taskDescriptor.fromID, SDK_Globals.tmSession?.SessionDescr?.userID);
|
|
403
402
|
const menuItems = [
|
|
404
403
|
{
|
|
405
|
-
name: SDKUI_Localizator.CreateContextualTask,
|
|
406
|
-
icon: _jsx("span", { className: "dx-icon-plus" }),
|
|
407
|
-
onClick: () => { openTaskForm(FormModes.Create, undefined, true); },
|
|
408
|
-
disabled: false,
|
|
409
404
|
id: 'createContextualTask',
|
|
410
|
-
|
|
405
|
+
text: SDKUI_Localizator.CreateContextualTask,
|
|
406
|
+
icon: 'plus',
|
|
407
|
+
onClick: () => { openTaskForm(FormModes.Create, undefined, true); },
|
|
408
|
+
disabled: false
|
|
411
409
|
},
|
|
412
410
|
{
|
|
413
|
-
|
|
414
|
-
icon:
|
|
411
|
+
text: SDKUI_Localizator.Create,
|
|
412
|
+
icon: 'plus',
|
|
415
413
|
onClick: () => { openTaskForm(FormModes.Create, undefined, false); },
|
|
416
|
-
disabled: false
|
|
417
|
-
operationType: 'singleRow'
|
|
414
|
+
disabled: false
|
|
418
415
|
},
|
|
419
416
|
{
|
|
420
|
-
|
|
421
|
-
icon:
|
|
417
|
+
text: SDKUI_Localizator.Update,
|
|
418
|
+
icon: 'edit',
|
|
422
419
|
onClick: openEditTaskForm,
|
|
423
|
-
|
|
424
|
-
|
|
420
|
+
operationType: 'singleRow',
|
|
421
|
+
disabled: fromDatagrid ? false : !isTaskDescriptorDefined
|
|
425
422
|
},
|
|
426
423
|
{
|
|
427
|
-
|
|
428
|
-
icon:
|
|
424
|
+
text: SDKUI_Localizator.Duplicate,
|
|
425
|
+
icon: 'copy',
|
|
429
426
|
onClick: openDuplicateTaskForm,
|
|
430
|
-
|
|
431
|
-
|
|
427
|
+
operationType: 'singleRow',
|
|
428
|
+
disabled: fromDatagrid ? isTaskFromAnotherUser : !isTaskDescriptorDefined || isTaskFromAnotherUser
|
|
432
429
|
},
|
|
433
430
|
{
|
|
434
|
-
|
|
435
|
-
icon:
|
|
431
|
+
text: SDKUI_Localizator.Delete,
|
|
432
|
+
icon: 'trash',
|
|
436
433
|
onClick: onDeleteCallback,
|
|
437
|
-
|
|
438
|
-
|
|
434
|
+
operationType: 'multiRow',
|
|
435
|
+
disabled: fromDatagrid ? isTaskFromAnotherUser : !isTaskDescriptorDefined || isTaskFromAnotherUser
|
|
439
436
|
},
|
|
440
437
|
{
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
disabled: fromDatagrid ? false : !isTaskDescriptorDefined,
|
|
438
|
+
icon: 'optionsgear',
|
|
439
|
+
text: SDKUI_Localizator.MarkAs,
|
|
444
440
|
id: "markAs",
|
|
445
441
|
operationType: 'multiRow',
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
{
|
|
449
|
-
{
|
|
450
|
-
{
|
|
451
|
-
{
|
|
442
|
+
disabled: fromDatagrid ? false : !isTaskDescriptorDefined,
|
|
443
|
+
items: [
|
|
444
|
+
{ icon: 'product', text: SDKUI_Localizator.NewFemale, operationType: 'multiRow', onClick: (rowIds) => markAsStatus(rowIds, Task_States.NotStarted) },
|
|
445
|
+
{ icon: 'refresh', text: SDKUI_Localizator.InProgress, operationType: 'multiRow', onClick: (rowIds) => markAsStatus(rowIds, Task_States.InProgress) },
|
|
446
|
+
{ icon: 'check', text: SDKUI_Localizator.Completed, operationType: 'multiRow', onClick: (rowIds) => markAsStatus(rowIds, Task_States.Completed) },
|
|
447
|
+
{ icon: 'taskstop', text: SDKUI_Localizator.Pending, operationType: 'multiRow', onClick: (rowIds) => markAsStatus(rowIds, Task_States.Waiting) },
|
|
448
|
+
{ icon: 'clock', text: SDKUI_Localizator.Postponed, operationType: 'multiRow', onClick: (rowIds) => markAsStatus(rowIds, Task_States.Deferred) }
|
|
452
449
|
]
|
|
453
450
|
},
|
|
454
451
|
{
|
|
455
|
-
|
|
456
|
-
|
|
452
|
+
id: 'wgContextFilter',
|
|
453
|
+
text: showContextualWG ? SDKUI_Localizator.RemoveContextualFilter : SDKUI_Localizator.ApplyContextualFilter,
|
|
454
|
+
icon: 'filter',
|
|
457
455
|
onClick: () => { setShowContextualWG(prev => !prev); },
|
|
458
456
|
disabled: false,
|
|
459
457
|
beginGroup: true,
|
|
460
|
-
visible: fromWG
|
|
461
|
-
id: 'wgContextFilter',
|
|
462
|
-
operationType: 'singleRow'
|
|
458
|
+
visible: fromWG
|
|
463
459
|
},
|
|
464
460
|
{
|
|
465
|
-
|
|
466
|
-
|
|
461
|
+
id: 'dossierContextFilter',
|
|
462
|
+
text: showContextualDossier ? SDKUI_Localizator.RemoveContextualFilter : SDKUI_Localizator.ApplyContextualFilter,
|
|
463
|
+
icon: 'filter',
|
|
467
464
|
onClick: () => { setShowContextualDossier(prev => !prev); },
|
|
468
465
|
disabled: false,
|
|
469
466
|
beginGroup: !fromWG && !fromDocument,
|
|
470
|
-
visible: fromDossier
|
|
471
|
-
id: 'dossierContextFilter',
|
|
472
|
-
operationType: 'singleRow'
|
|
467
|
+
visible: fromDossier
|
|
473
468
|
},
|
|
474
469
|
{
|
|
475
|
-
|
|
476
|
-
|
|
470
|
+
id: 'documentContextFilter',
|
|
471
|
+
text: showContextualDocument ? SDKUI_Localizator.RemoveContextualFilter : SDKUI_Localizator.ApplyContextualFilter,
|
|
472
|
+
icon: 'filter',
|
|
477
473
|
onClick: () => { setShowContextualDocument(prev => !prev); },
|
|
478
474
|
disabled: false,
|
|
479
475
|
beginGroup: !fromDossier && !fromWG,
|
|
480
|
-
visible: fromDocument
|
|
481
|
-
id: 'documentContextFilter',
|
|
482
|
-
operationType: 'singleRow'
|
|
476
|
+
visible: fromDocument
|
|
483
477
|
},
|
|
484
478
|
{
|
|
485
|
-
|
|
486
|
-
icon: _jsx("span", { className: "dx-icon-event" }),
|
|
479
|
+
icon: "event",
|
|
487
480
|
onClick: () => { if (handleGoToToday) {
|
|
488
481
|
handleGoToToday();
|
|
489
482
|
} },
|
|
483
|
+
text: SDKUI_Localizator.GoToToday,
|
|
490
484
|
disabled: false,
|
|
491
485
|
beginGroup: true,
|
|
492
|
-
operationType: 'singleRow'
|
|
493
486
|
},
|
|
494
487
|
{
|
|
495
|
-
name: showSearch ? SDKUI_Localizator.HideSearch : SDKUI_Localizator.ShowSearch,
|
|
496
|
-
icon: _jsx("span", { className: showSearch ? "dx-icon-eyeclose" : "dx-icon-eyeopen" }),
|
|
497
|
-
onClick: () => setShowSearch(prevShowSearch => !prevShowSearch),
|
|
498
|
-
disabled: false,
|
|
499
488
|
beginGroup: true,
|
|
500
|
-
|
|
489
|
+
icon: showSearch ? "eyeclose" : "eyeopen",
|
|
490
|
+
onClick: () => setShowSearch(prevShowSearch => !prevShowSearch),
|
|
491
|
+
text: showSearch ? SDKUI_Localizator.HideSearch : SDKUI_Localizator.ShowSearch,
|
|
492
|
+
disabled: false
|
|
501
493
|
},
|
|
502
494
|
{
|
|
503
|
-
|
|
504
|
-
icon: _jsx("span", { className: showId ? "dx-icon-eyeclose" : "dx-icon-eyeopen" }),
|
|
495
|
+
icon: showId ? "eyeclose" : "eyeopen",
|
|
505
496
|
onClick: () => setShowId(prevShowId => !prevShowId),
|
|
506
|
-
|
|
507
|
-
|
|
497
|
+
text: showId ? SDKUI_Localizator.ID_Hide : SDKUI_Localizator.ID_Show,
|
|
498
|
+
disabled: false
|
|
508
499
|
},
|
|
509
500
|
{
|
|
510
|
-
|
|
511
|
-
icon:
|
|
501
|
+
text: SDKUI_Localizator.Refresh,
|
|
502
|
+
icon: 'refresh',
|
|
512
503
|
onClick: () => getAllTasks(),
|
|
513
504
|
disabled: false,
|
|
514
|
-
operationType: 'multiRow'
|
|
515
505
|
},
|
|
516
506
|
];
|
|
517
507
|
// Apply filters
|
|
@@ -539,7 +529,7 @@ export const createTasksMenuItems = (taskDescriptor, showId, setShowId, showSear
|
|
|
539
529
|
item.visible === undefined);
|
|
540
530
|
}
|
|
541
531
|
if (showGoToToday === false) {
|
|
542
|
-
filteredMenuItems = filteredMenuItems.filter(item => item.
|
|
532
|
+
filteredMenuItems = filteredMenuItems.filter(item => item.text !== SDKUI_Localizator.GoToToday);
|
|
543
533
|
}
|
|
544
534
|
return filteredMenuItems;
|
|
545
535
|
};
|
|
@@ -5,6 +5,7 @@ import { TabPanel, Item } from 'devextreme-react/tab-panel';
|
|
|
5
5
|
import { Priorities, ResultTypes, SDK_Globals, Task_States } from "@topconsultnpm/sdk-ts";
|
|
6
6
|
import { calculateNumberOfDays, renderTaskIcons } from "./TMTasksUtilsView";
|
|
7
7
|
import { getPriorityLocalizatorValue } from "../tasks/TMTasksUtils";
|
|
8
|
+
import ContextMenu from 'devextreme-react/context-menu';
|
|
8
9
|
import { calcResponsiveSizes, getExceptionMessage, SDKUI_Localizator, StyledTabItem, TMCountBadge } from "../../../helper";
|
|
9
10
|
import { useDeviceType } from "../../base/TMDeviceProvider";
|
|
10
11
|
import { FormModes } from "../../../ts";
|
|
@@ -16,7 +17,6 @@ import { TMResultManager } from "../../forms/TMResultDialog";
|
|
|
16
17
|
import TMTasksCalendar from "./TMTasksCalendar";
|
|
17
18
|
import TMTasksAgenda from "./TMTasksAgenda";
|
|
18
19
|
import TMTaskForm from "./TMTaskForm";
|
|
19
|
-
import { ContextMenu as TMContextMenu } from "../../NewComponents/ContextMenu";
|
|
20
20
|
let abortController = new AbortController();
|
|
21
21
|
const TMTasksView = (props) => {
|
|
22
22
|
const { id, allTasks, getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, visualizedTasks, activeComponent, activeTabIndex, setActiveTabIndex, currentTask, setCurrentTask, assignedToMeCount, assignedByMeCount, allTasksFilteredCount, showId, setShowId, showSearch, setShowSearch, showContextualWG, setShowContextualWG, showContextualDossier, setShowContextualDossier, showContextualDocument, setShowContextualDocument, handleNavigateToWGs, handleNavigateToDossiers, taskContext, usersList, onOpenS4TViewerRequest, s4TViewerDialogComponent, afterTaskSaved, } = props;
|
|
@@ -519,13 +519,13 @@ const TMTasksView = (props) => {
|
|
|
519
519
|
];
|
|
520
520
|
}, [showId]);
|
|
521
521
|
const getFromOrToDatagridElement = (fromOrToDataSource, fromCell = false, toCell = false) => {
|
|
522
|
-
return _jsx(TMDataGrid, { dataSource: fromOrToDataSource, dataColumns: getDataColumns(fromCell, toCell), selection: { mode: 'multiple', showCheckBoxesMode: "always" }, focusedRowKey: focusedRowKey, selectedRowKeys: [...selectedRowKeys], onFocusedRowChanged: onFocusedRowChanged, onSelectionChanged: onSelectionChanged, onRowDblClick: onRowDblClick,
|
|
522
|
+
return _jsx(TMDataGrid, { dataSource: fromOrToDataSource, dataColumns: getDataColumns(fromCell, toCell), selection: { mode: 'multiple', showCheckBoxesMode: "always" }, focusedRowKey: focusedRowKey, selectedRowKeys: [...selectedRowKeys], onFocusedRowChanged: onFocusedRowChanged, onSelectionChanged: onSelectionChanged, onRowDblClick: onRowDblClick, onContextMenuPreparing: onContextMenuPreparing, showSearchPanel: showSearch, noDataText: SDKUI_Localizator.TasksEmpty, counterConfig: { show: true }, onHasFiltersChange: (active) => setHasFilters(active) });
|
|
523
523
|
};
|
|
524
524
|
const getFromOrToAgendaElement = (fromOrToDataSource, fromCell = false, toCell = false) => {
|
|
525
|
-
return
|
|
525
|
+
return _jsxs("div", { style: { width: '100%', height: '100%', display: 'flex', flexDirection: 'column', overflow: "auto" }, children: [_jsx(ContextMenu, { dataSource: menuItems, target: `#tasks-agenda-wrapper-${id}` }), _jsx("div", { style: { width: "100%", height: "100%" }, children: _jsx(TMTasksAgenda, { id: id, showId: showId, showSearch: showSearch, visualizedTasks: fromOrToDataSource, fromCell: fromCell, toCell: toCell, currentAgendaDate: currentAgendaDate, setCurrentAgendaDate: setCurrentAgendaDate, openTaskForm: openTaskFormCallback, handleFocusedRowChange: handleFocusedRowChange }) })] });
|
|
526
526
|
};
|
|
527
527
|
const getFromOrToCalendarElement = (fromOrToDataSource, fromCell = false, toCell = false) => {
|
|
528
|
-
return
|
|
528
|
+
return _jsxs("div", { style: { width: '100%', height: '100%', display: 'flex', flexDirection: 'column', overflow: "auto" }, children: [_jsx(ContextMenu, { dataSource: menuItems, target: `#tasks-calendar-wrapper-${id}` }), _jsx("div", { style: { width: "100%", height: "100%" }, children: _jsx(TMTasksCalendar, { id: id, visualizedTasks: fromOrToDataSource, showId: showId, fromCell: fromCell, toCell: toCell, showSearch: showSearch, currentCalendarDate: currentCalendarDate, setCurrentCalendarDate: setCurrentCalendarDate, openTaskForm: openTaskFormCallback, onDeleteCallback: onDeleteCallback, setCalendarStartDate: setCalendarStartDate, setCalendarEndDate: setCalendarEndDate, focusedRowKey: focusedRowKey, handleFocusedRowChange: handleFocusedRowChange }) })] });
|
|
529
529
|
};
|
|
530
530
|
return _jsxs("div", { style: { width: '100%', height: '100%' }, onContextMenu: (e) => e.preventDefault(), children: [_jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showWaitPanel, showWaitPanelPrimary: showPrimary, waitPanelTitle: waitPanelTitle, waitPanelTextPrimary: waitPanelTextPrimary, waitPanelValuePrimary: waitPanelValuePrimary, waitPanelMaxValuePrimary: waitPanelMaxValuePrimary, isCancelable: true, abortController: abortController, children: _jsxs(TabPanel, { width: "100%", height: "100%", animationEnabled: false, swipeEnabled: false, loop: false, showNavButtons: true, repaintChangesOnly: true, stylingMode: "primary", iconPosition: 'start', tabsPosition: 'top', selectedIndex: activeTabIndex, onSelectedIndexChange: onSelectedIndexChange, id: "task-centered-tab-title", children: [_jsx(Item, { title: SDKUI_Localizator.AssignedToMe, icon: "user", tabRender: (params) => {
|
|
531
531
|
return _jsxs(StyledTabItem, { "$isSelected": activeTabIndex === AssignedTab.AssignedToMe, children: [_jsxs(TMTooltip, { content: SDKUI_Localizator.AssignedToMe, children: [_jsx("i", { className: `dx-icon-${params.icon}` }), "\u00A0", params.title, " ", (assignedToMeCount > 0) ? `(${assignedToMeCount})` : ''] }), newTaskCount > 0 && (_jsx(TMTooltip, { content: SDKUI_Localizator.NewAssignedActivitiesNumber + ": " + newTaskCount, children: _jsx(TMCountBadge, { children: newTaskCount }) }))] });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
2
|
+
import { useEffect, useMemo, useState } from "react";
|
|
3
3
|
import { Priorities, ResultTypes, SDK_Globals, SDK_Localizator, TaskEngine, UserListCacheService, ValidationItem, WFEvents, WorkflowCacheService } from '@topconsultnpm/sdk-ts';
|
|
4
4
|
import styled from "styled-components";
|
|
5
5
|
import { SDKUI_Localizator, IconApply, IconCloseOutline, IconUser, IconInfo, DateDisplayTypes, TASK_MORE_INFO_PREFIX_NAME, IconSignaturePencil, isSign4TopEnabled, IconCheck, IconCloseCircle, IconStop } from "../../../helper";
|
|
@@ -66,17 +66,12 @@ const StyledHorizontalContainer = styled.div `
|
|
|
66
66
|
export const WorkFlowOperationButtons = (props) => {
|
|
67
67
|
const { dtd = undefined, deviceType = DeviceType.DESKTOP, approveDisable = false, signApproveDisable = false, rejectDisable = false, reassignDisable = false, infoDisable = false, onApprove, onSignApprove, onReject, onReAssign, onMoreInfo } = props;
|
|
68
68
|
const isMobile = deviceType === DeviceType.MOBILE;
|
|
69
|
-
//
|
|
70
|
-
const
|
|
71
|
-
useEffect(() => {
|
|
72
|
-
// Controlla se il documento ha dei widget definiti, se il documento ha il widget SIGN4_TOP abilitato, allora è un workflow di firma
|
|
69
|
+
// Calcola direttamente se è un workflow di firma per evitare flickering durante il render
|
|
70
|
+
const isSignWorkflow = useMemo(() => {
|
|
73
71
|
if (dtd && dtd.widgets && dtd.widgets.length > 0) {
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
// Se non ci sono widget o non è SIGN4_TOP, imposta il workflow di default (approvazione senza firma)
|
|
78
|
-
setIsSignWorkflow(false);
|
|
72
|
+
return isSign4TopEnabled(dtd.widgets);
|
|
79
73
|
}
|
|
74
|
+
return false;
|
|
80
75
|
}, [dtd]);
|
|
81
76
|
return (_jsx(StyledWorkFlowOperationButtonsContainer, { "$isMobile": isMobile, children: isSignWorkflow ? (_jsxs(_Fragment, { children: [_jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconSignaturePencil, {}), caption: SDKUI_Localizator.SignatureAndApprove, width: "160px", disabled: signApproveDisable, onClick: () => !signApproveDisable && onSignApprove?.(), onMouseDown: e => e.stopPropagation(), advancedColor: "#1a9a49", color: "success" }), _jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconCloseOutline, {}), caption: SDKUI_Localizator.Reject, disabled: rejectDisable, onClick: () => !rejectDisable && onReject?.(), onMouseDown: e => e.stopPropagation(), advancedColor: TMColors.error, color: "error" }), _jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconInfo, { fontSize: 16 }), caption: SDKUI_Localizator.MoreInformation, width: "180px", disabled: infoDisable, onClick: () => !infoDisable && onMoreInfo?.(), onMouseDown: e => e.stopPropagation(), advancedColor: TMColors.info, color: "info" })] })) : (_jsxs(_Fragment, { children: [_jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconApply, {}), caption: SDKUI_Localizator.Approve, disabled: approveDisable, onClick: () => !approveDisable && onApprove?.(), advancedColor: "#1a9a49", color: "success" }), _jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconCloseOutline, {}), caption: SDKUI_Localizator.Reject, disabled: rejectDisable, onClick: () => !rejectDisable && onReject?.(), advancedColor: TMColors.error, color: "error" }), _jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconUser, { fontSize: 16 }), caption: SDKUI_Localizator.Reassign, disabled: reassignDisable, onClick: () => !reassignDisable && onReAssign?.(), advancedColor: TMColors.tertiary, color: "tertiary" }), _jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconInfo, { fontSize: 16 }), caption: SDKUI_Localizator.MoreInformation, width: "180px", disabled: infoDisable, onClick: () => !infoDisable && onMoreInfo?.(), advancedColor: TMColors.info, color: "info" })] })) }));
|
|
82
77
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useEffect, useCallback, useRef, useMemo } from 'react';
|
|
2
|
+
import { useState, useEffect, useCallback, useRef, useMemo, useLayoutEffect } from 'react';
|
|
3
3
|
import { DiagramItemTypes, ArrowSymbol } from './interfaces';
|
|
4
4
|
import { parseWfDiagramXml, serializeWfDiagramToXml } from './xmlParser';
|
|
5
5
|
import styled, { css, keyframes } from 'styled-components';
|
|
@@ -8,7 +8,7 @@ import ConnectionComponent from './ConnectionComponent';
|
|
|
8
8
|
import DiagramItemComponent from './DiagramItemComponent';
|
|
9
9
|
import DiagramItemSvgContent from './DiagramItemSvgContent';
|
|
10
10
|
import { calculateArrowAngle, downloadFile, getConnectionPoint, getNewWfDiagram, isConnectionNonLinear, validateDiagram } from './workflowHelpers';
|
|
11
|
-
import { IconFlowChart, IconUndo, IconRestore, IconAdjust, IconCopy, IconCut, IconPaste, IconPin, IconUnpin, IconChevronRight, IconCloseOutline, IconNew, SDKUI_Localizator, generateUUID, IconExport, IconImport, IconWindowMaximize, IconZoomIn, IconZoomOut, IconPencil, IconLock, LocalizeDiagramItemType, IconWindowMinimize } from '../../../../helper';
|
|
11
|
+
import { IconFlowChart, IconUndo, IconRestore, IconAdjust, IconCopy, IconCut, IconPaste, IconPin, IconUnpin, IconChevronRight, IconCloseOutline, IconNew, SDKUI_Localizator, generateUUID, IconExport, IconImport, IconWindowMaximize, IconZoomIn, IconZoomOut, IconPencil, IconLock, LocalizeDiagramItemType, IconWindowMinimize, IconZoomAuto } from '../../../../helper';
|
|
12
12
|
import { ButtonNames, TMExceptionBoxManager, TMMessageBoxManager } from '../../../base/TMPopUp';
|
|
13
13
|
import { StyledLoadingContainer, StyledSpinner } from '../../../base/Styled';
|
|
14
14
|
import DiagramItemForm from './DiagramItemForm';
|
|
@@ -317,13 +317,15 @@ const DiagramMessage = styled.div `
|
|
|
317
317
|
color: #555;
|
|
318
318
|
text-align: center;
|
|
319
319
|
`;
|
|
320
|
-
const WFDiagram = ({ xmlDiagramString, currentSetID, allowEdit = true, onDiagramChange, workitems }) => {
|
|
320
|
+
const WFDiagram = ({ xmlDiagramString, currentSetID, allowEdit = true, onDiagramChange, workitems, defaultAutoZoom = false }) => {
|
|
321
321
|
const [isReadOnly, setIsReadOnly] = useState(true);
|
|
322
322
|
const [isFullScreen, setIsFullScreen] = useState(false);
|
|
323
323
|
const [zoomLevel, setZoomLevel] = useState(1);
|
|
324
324
|
const [translateX, setTranslateX] = useState(0);
|
|
325
325
|
const [translateY, setTranslateY] = useState(0);
|
|
326
|
+
const [isAutoZoomEnabled, setIsAutoZoomEnabled] = useState(defaultAutoZoom);
|
|
326
327
|
const [isLoading, setIsLoading] = useState(true);
|
|
328
|
+
const [isInitialZoomCalculated, setIsInitialZoomCalculated] = useState(!defaultAutoZoom);
|
|
327
329
|
const [wfDiagram, setWfDiagram] = useState(null);
|
|
328
330
|
const [selectedItems, setSelectedItems] = useState(new Set());
|
|
329
331
|
const [selectedConnections, setSelectedConnections] = useState(new Set());
|
|
@@ -333,6 +335,7 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, allowEdit = true, onDiagram
|
|
|
333
335
|
const initialDiagramRef = useRef(null);
|
|
334
336
|
const notifiedXmlRef = useRef(null);
|
|
335
337
|
const svgRef = useRef(null);
|
|
338
|
+
const containerRef = useRef(null);
|
|
336
339
|
const [isDrawingConnection, setIsDrawingConnection] = useState(false);
|
|
337
340
|
const [tempConnectionSource, setTempConnectionSource] = useState(null);
|
|
338
341
|
const [tempConnectionEnd, setTempConnectionEnd] = useState(null);
|
|
@@ -1624,6 +1627,67 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, allowEdit = true, onDiagram
|
|
|
1624
1627
|
const handleZoomOut = useCallback(() => {
|
|
1625
1628
|
setZoomLevel(prev => Math.max(prev - 0.1, 0.5)); // Limite min a 0.5
|
|
1626
1629
|
}, []);
|
|
1630
|
+
const calculateOptimalZoom = useCallback(() => {
|
|
1631
|
+
if (!wfDiagram || !containerRef.current || wfDiagram.DiagramItems.length === 0) {
|
|
1632
|
+
return 1;
|
|
1633
|
+
}
|
|
1634
|
+
// Calcola il bounding box del diagramma
|
|
1635
|
+
let minX = Infinity;
|
|
1636
|
+
let minY = Infinity;
|
|
1637
|
+
let maxX = -Infinity;
|
|
1638
|
+
let maxY = -Infinity;
|
|
1639
|
+
wfDiagram.DiagramItems.forEach(item => {
|
|
1640
|
+
minX = Math.min(minX, item.Left);
|
|
1641
|
+
minY = Math.min(minY, item.Top);
|
|
1642
|
+
maxX = Math.max(maxX, item.Left + item.Width);
|
|
1643
|
+
maxY = Math.max(maxY, item.Top + item.Height + 50);
|
|
1644
|
+
});
|
|
1645
|
+
const padding = 100; // Padding intorno al diagramma
|
|
1646
|
+
const diagramWidth = maxX - minX + (padding * 2);
|
|
1647
|
+
const diagramHeight = maxY - minY + (padding * 2);
|
|
1648
|
+
// Ottieni le dimensioni del container
|
|
1649
|
+
const containerWidth = containerRef.current.clientWidth;
|
|
1650
|
+
const containerHeight = containerRef.current.clientHeight;
|
|
1651
|
+
// Calcola il fattore di zoom per far entrare tutto il contenuto
|
|
1652
|
+
const zoomX = containerWidth / diagramWidth;
|
|
1653
|
+
const zoomY = containerHeight / diagramHeight;
|
|
1654
|
+
// Usa il fattore più piccolo per garantire che tutto sia visibile
|
|
1655
|
+
let optimalZoom = Math.min(zoomX, zoomY, 2.0); // Max 2.0
|
|
1656
|
+
// Applica un minimo di 0.3 per evitare zoom troppo piccoli
|
|
1657
|
+
optimalZoom = Math.max(optimalZoom, 0.3);
|
|
1658
|
+
// Arrotonda per eccesso alla decina più vicina (in percentuale)
|
|
1659
|
+
const zoomPercentage = optimalZoom * 100;
|
|
1660
|
+
const roundedPercentage = Math.ceil(zoomPercentage / 10) * 10;
|
|
1661
|
+
// Limita al massimo 100%
|
|
1662
|
+
const finalPercentage = Math.min(roundedPercentage, 100);
|
|
1663
|
+
return finalPercentage / 100;
|
|
1664
|
+
}, [wfDiagram]);
|
|
1665
|
+
const handleZoomToFit = useCallback(() => {
|
|
1666
|
+
const optimalZoom = calculateOptimalZoom();
|
|
1667
|
+
setZoomLevel(optimalZoom);
|
|
1668
|
+
setTranslateX(0);
|
|
1669
|
+
setTranslateY(0);
|
|
1670
|
+
setIsAutoZoomEnabled(true);
|
|
1671
|
+
}, [calculateOptimalZoom]);
|
|
1672
|
+
const handleToggleAutoZoom = useCallback(() => {
|
|
1673
|
+
setIsAutoZoomEnabled(prev => {
|
|
1674
|
+
const newValue = !prev;
|
|
1675
|
+
if (!newValue) {
|
|
1676
|
+
// Se si disattiva AutoZoom, riporta lo zoom a 1
|
|
1677
|
+
setZoomLevel(1);
|
|
1678
|
+
setTranslateX(0);
|
|
1679
|
+
setTranslateY(0);
|
|
1680
|
+
}
|
|
1681
|
+
else {
|
|
1682
|
+
// Se si attiva AutoZoom, calcola lo zoom ottimale
|
|
1683
|
+
const optimalZoom = calculateOptimalZoom();
|
|
1684
|
+
setZoomLevel(optimalZoom);
|
|
1685
|
+
setTranslateX(0);
|
|
1686
|
+
setTranslateY(0);
|
|
1687
|
+
}
|
|
1688
|
+
return newValue;
|
|
1689
|
+
});
|
|
1690
|
+
}, [calculateOptimalZoom]);
|
|
1627
1691
|
const formattedZoomLevel = useMemo(() => {
|
|
1628
1692
|
return `${Math.round(zoomLevel * 100)}%`;
|
|
1629
1693
|
}, [zoomLevel]);
|
|
@@ -1662,8 +1726,6 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, allowEdit = true, onDiagram
|
|
|
1662
1726
|
catch (error) {
|
|
1663
1727
|
console.error("Errore durante l'elaborazione del diagramma:", error);
|
|
1664
1728
|
setWfDiagram(null);
|
|
1665
|
-
}
|
|
1666
|
-
finally {
|
|
1667
1729
|
setIsLoading(false);
|
|
1668
1730
|
}
|
|
1669
1731
|
}, [xmlDiagramString, getAdjustedAndRecalculatedDiagram]);
|
|
@@ -1672,6 +1734,73 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, allowEdit = true, onDiagram
|
|
|
1672
1734
|
isUndoingRedoing.current = false;
|
|
1673
1735
|
}
|
|
1674
1736
|
}, [wfDiagram]);
|
|
1737
|
+
// useLayoutEffect viene eseguito PRIMA del paint del browser, evitando il flash visivo
|
|
1738
|
+
useLayoutEffect(() => {
|
|
1739
|
+
if (defaultAutoZoom && !isInitialZoomCalculated && wfDiagram && wfDiagram.DiagramItems.length > 0 && containerRef.current) {
|
|
1740
|
+
const container = containerRef.current;
|
|
1741
|
+
// Calcola il bounding box del diagramma
|
|
1742
|
+
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
1743
|
+
wfDiagram.DiagramItems.forEach(item => {
|
|
1744
|
+
minX = Math.min(minX, item.Left);
|
|
1745
|
+
minY = Math.min(minY, item.Top);
|
|
1746
|
+
maxX = Math.max(maxX, item.Left + item.Width);
|
|
1747
|
+
maxY = Math.max(maxY, item.Top + item.Height + 50);
|
|
1748
|
+
});
|
|
1749
|
+
const padding = 100;
|
|
1750
|
+
const diagramWidth = maxX - minX + (padding * 2);
|
|
1751
|
+
const diagramHeight = maxY - minY + (padding * 2);
|
|
1752
|
+
const containerWidth = container.clientWidth;
|
|
1753
|
+
const containerHeight = container.clientHeight;
|
|
1754
|
+
if (containerWidth > 0 && containerHeight > 0) {
|
|
1755
|
+
const zoomX = containerWidth / diagramWidth;
|
|
1756
|
+
const zoomY = containerHeight / diagramHeight;
|
|
1757
|
+
let optimalZoom = Math.min(zoomX, zoomY, 2.0);
|
|
1758
|
+
optimalZoom = Math.max(optimalZoom, 0.3);
|
|
1759
|
+
const zoomPercentage = optimalZoom * 100;
|
|
1760
|
+
const roundedPercentage = Math.ceil(zoomPercentage / 10) * 10;
|
|
1761
|
+
const finalPercentage = Math.min(roundedPercentage, 100);
|
|
1762
|
+
setZoomLevel(finalPercentage / 100);
|
|
1763
|
+
setIsInitialZoomCalculated(true);
|
|
1764
|
+
setIsLoading(false);
|
|
1765
|
+
}
|
|
1766
|
+
else {
|
|
1767
|
+
// Se il container non ha dimensioni, riprova al prossimo render
|
|
1768
|
+
requestAnimationFrame(() => {
|
|
1769
|
+
setIsInitialZoomCalculated(false);
|
|
1770
|
+
});
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
else if (!defaultAutoZoom && wfDiagram && isLoading) {
|
|
1774
|
+
// Se non c'è autozoom, rimuovi il loading appena il diagramma è pronto
|
|
1775
|
+
setIsLoading(false);
|
|
1776
|
+
}
|
|
1777
|
+
}, [wfDiagram, defaultAutoZoom, isInitialZoomCalculated, isLoading]);
|
|
1778
|
+
// Gestisce AutoZoom: ricalcola lo zoom quando il diagramma cambia o il container viene ridimensionato
|
|
1779
|
+
useEffect(() => {
|
|
1780
|
+
if (!containerRef.current || !isAutoZoomEnabled || !isInitialZoomCalculated) {
|
|
1781
|
+
return;
|
|
1782
|
+
}
|
|
1783
|
+
// Funzione per ricalcolare e applicare lo zoom se necessario
|
|
1784
|
+
const updateZoom = () => {
|
|
1785
|
+
if (wfDiagram && wfDiagram.DiagramItems.length > 0) {
|
|
1786
|
+
const newZoom = calculateOptimalZoom();
|
|
1787
|
+
if (newZoom !== undefined && Math.abs(zoomLevel - newZoom) > 0.001) {
|
|
1788
|
+
setZoomLevel(newZoom);
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
};
|
|
1792
|
+
// Ricalcola lo zoom quando il diagramma cambia
|
|
1793
|
+
updateZoom();
|
|
1794
|
+
// Installa ResizeObserver per reagire ai ridimensionamenti del container
|
|
1795
|
+
const container = containerRef.current;
|
|
1796
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
1797
|
+
updateZoom();
|
|
1798
|
+
});
|
|
1799
|
+
resizeObserver.observe(container);
|
|
1800
|
+
return () => {
|
|
1801
|
+
resizeObserver.disconnect();
|
|
1802
|
+
};
|
|
1803
|
+
}, [isAutoZoomEnabled, wfDiagram, calculateOptimalZoom, isInitialZoomCalculated, zoomLevel]);
|
|
1675
1804
|
const handleCanvasDoubleClick = useCallback((event) => {
|
|
1676
1805
|
if (isReadOnly && allowEdit) {
|
|
1677
1806
|
toggleReadOnlyMode();
|
|
@@ -1696,8 +1825,11 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, allowEdit = true, onDiagram
|
|
|
1696
1825
|
}
|
|
1697
1826
|
}, [isFullScreen]);
|
|
1698
1827
|
const diagramContent = (_jsxs(CanvasContainer, { onDoubleClick: handleCanvasDoubleClick, children: [_jsx("input", { ref: fileInputRef, type: "file", accept: ".xml" // Filtra per file XML
|
|
1699
|
-
, onChange: handleFileChange, style: { display: 'none' } }), _jsxs(ToolbarContainer, { "$isCollapsed": isToolbarCollapsed, "$isFloating": isToolbarFloating, "$isToolboxVisible": isToolboxVisible, "$isReadOnly": isReadOnly, children: [allowEdit && _jsx(ButtonGroup, { "$isFloating": isToolbarFloating, children: _jsxs("button", { onClick: toggleReadOnlyMode, title: isReadOnly ? SDKUI_Localizator.Design : SDKUI_Localizator.ReadOnly, children: [isReadOnly ? _jsx(IconPencil, {}) : _jsx(IconLock, {}), !isToolbarCollapsed && _jsx("span", { children: isReadOnly ? SDKUI_Localizator.Design : SDKUI_Localizator.ReadOnly })] }) }), allowEdit && _jsxs(ButtonGroup, { "$isFloating": isToolbarFloating, children: [!isReadOnly && _jsxs("button", { onClick: handleToggleToolboxVisibility, title: SDKUI_Localizator.ShowToolbox, children: [_jsx(IconFlowChart, {}), !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.ShowToolboxToggle })] }), _jsxs("button", { onClick: toggleFullScreenMode, title: SDKUI_Localizator.ShowFullScreen, children: [isFullScreen ? _jsx(IconWindowMinimize, {}) : _jsx(IconWindowMaximize, {}), !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.ShowFullScreen })] })] }), _jsxs(ButtonGroup, { "$isFloating": isToolbarFloating, children: [_jsxs("button", { onClick: handleZoomIn, title: SDKUI_Localizator.ZoomIn, children: [_jsx(IconZoomIn, {}), !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.ZoomIn })] }), _jsxs("button", { onClick: handleZoomOut, title: SDKUI_Localizator.ZoomOut, children: [_jsx(IconZoomOut, {}), !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.ZoomOut })] }), _jsx(ZoomLevelText, { "$isFloating": isToolbarFloating, "$isCollapsed": isToolbarCollapsed, children: formattedZoomLevel })] }), !isReadOnly && _jsxs(ButtonGroup, { "$isFloating": isToolbarFloating, children: [_jsxs("button", { onClick: handleUndo, disabled: historyIndex === 0, title: SDKUI_Localizator.Undo, children: [_jsx(IconUndo, {}), " ", !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.Undo })] }), _jsxs("button", { onClick: handleRedo, disabled: historyIndex === wfDiagramHistory.length - 1, title: SDKUI_Localizator.Redo, children: [_jsx(IconUndo, { style: { transform: 'scaleX(-1)' } }), " ", !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.Redo })] }), _jsxs("button", { onClick: handleRestore, title: SDKUI_Localizator.Restore, children: [_jsx(IconRestore, {}), " ", !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.Restore })] }), _jsxs("button", { onClick: handleNew, title: SDKUI_Localizator.DiagramNew, disabled: isReadOnly, children: [_jsx(IconNew, {}), " ", !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.DiagramNew })] }), _jsxs("button", { onClick: handleExportDiagram, disabled: isReadOnly || !wfDiagram, title: SDKUI_Localizator.Export, children: [_jsx(IconExport, {}), _jsx("span", { children: SDKUI_Localizator.Export })] }), _jsxs("button", { onClick: handleImportDiagramClick, disabled: isReadOnly, title: SDKUI_Localizator.Import, children: [_jsx(IconImport, {}), _jsx("span", { children: SDKUI_Localizator.Import })] })] }), !isReadOnly && _jsx(ButtonGroup, { "$isFloating": isToolbarFloating, children: _jsxs("button", { onClick: handleAutoAdjust, title: SDKUI_Localizator.AutoAdjust, children: [_jsx(IconAdjust, {}), " ", !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.AutoAdjust })] }) }), !isReadOnly && _jsxs(ButtonGroup, { "$isFloating": isToolbarFloating, children: [_jsxs("button", { onClick: handleCopy, disabled: selectedItems.size === 0, title: SDKUI_Localizator.Copy, children: [_jsx(IconCopy, {}), " ", !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.Copy })] }), _jsxs("button", { onClick: handleCut, disabled: selectedItems.size === 0, title: SDKUI_Localizator.Cut, children: [_jsx(IconCut, {}), " ", !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.Cut })] }), _jsxs("button", { onClick: handlePaste, disabled: copiedItems.length === 0 && copiedConnections.length === 0, title: SDKUI_Localizator.Paste, children: [_jsx(IconPaste, {}), " ", !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.Paste })] })] }), allowEdit && _jsxs("button", { onClick: handleToggleToolbarMode, title: isToolbarFloating ? SDKUI_Localizator.ToolbarDock : SDKUI_Localizator.ToolbarFloat, children: [isToolbarFloating ? _jsx(IconPin, {}) : _jsx(IconUnpin, {}), !isToolbarCollapsed && !isToolbarFloating && _jsx("span", { children: SDKUI_Localizator.ToggleMode })] }), !isToolbarFloating && _jsx(ToolbarToggle, { onClick: () => setIsToolbarCollapsed(!isToolbarCollapsed), title: isToolbarCollapsed ? SDKUI_Localizator.ToolbarExpand : SDKUI_Localizator.ToolbarCollapse, children: isToolbarCollapsed ? _jsx(IconChevronRight, {}) : _jsx(IconCloseOutline, {}) })] }), !isReadOnly && (_jsx(ToolboxContainer, { "$isVisible": isToolboxVisible, children: isToolboxVisible && availableItemTypes.map(type => (_jsxs(ToolboxItem, { draggable: true, onDragStart: (e) => handleToolboxDragStart(e, type), onDragEnd: handleToolboxDragEnd, children: [_jsx(ToolboxIconWrapper, { children: _jsx(DiagramItemSvgContent, { itemType: type, width: 38, height: 38, isToolboxPreview: true }) }), _jsx("span", { children: LocalizeDiagramItemType(type) })] }, type))) })), _jsx(SvgScrollContainer, { children: isLoading ?
|
|
1700
|
-
(_jsxs(StyledLoadingContainer, { children: [_jsx(StyledSpinner, {}), _jsx("span", { children: `${'Caricamento diagramma'}...` })] })) : wfDiagram ? (_jsx(StyledSvg, { ref: svgRef, tabIndex: 0, onKeyDownCapture: handleKeyDown, onMouseMove: handleMouseMove, onMouseUp: handleMouseUp, onMouseDown: handleMouseDown, onDrop: handleDropOnCanvas, onDragOver: handleDragOver, width: svgWidth, height: svgHeight,
|
|
1828
|
+
, onChange: handleFileChange, style: { display: 'none' } }), _jsxs(ToolbarContainer, { "$isCollapsed": isToolbarCollapsed, "$isFloating": isToolbarFloating, "$isToolboxVisible": isToolboxVisible, "$isReadOnly": isReadOnly, children: [allowEdit && _jsx(ButtonGroup, { "$isFloating": isToolbarFloating, children: _jsxs("button", { onClick: toggleReadOnlyMode, title: isReadOnly ? SDKUI_Localizator.Design : SDKUI_Localizator.ReadOnly, children: [isReadOnly ? _jsx(IconPencil, {}) : _jsx(IconLock, {}), !isToolbarCollapsed && _jsx("span", { children: isReadOnly ? SDKUI_Localizator.Design : SDKUI_Localizator.ReadOnly })] }) }), allowEdit && _jsxs(ButtonGroup, { "$isFloating": isToolbarFloating, children: [!isReadOnly && _jsxs("button", { onClick: handleToggleToolboxVisibility, title: SDKUI_Localizator.ShowToolbox, children: [_jsx(IconFlowChart, {}), !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.ShowToolboxToggle })] }), _jsxs("button", { onClick: toggleFullScreenMode, title: SDKUI_Localizator.ShowFullScreen, children: [isFullScreen ? _jsx(IconWindowMinimize, {}) : _jsx(IconWindowMaximize, {}), !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.ShowFullScreen })] })] }), _jsxs(ButtonGroup, { "$isFloating": isToolbarFloating, children: [_jsxs("button", { onClick: handleZoomIn, title: SDKUI_Localizator.ZoomIn, disabled: isAutoZoomEnabled, children: [_jsx(IconZoomIn, {}), !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.ZoomIn })] }), _jsxs("button", { onClick: handleZoomOut, title: SDKUI_Localizator.ZoomOut, disabled: isAutoZoomEnabled, children: [_jsx(IconZoomOut, {}), !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.ZoomOut })] }), _jsxs("button", { onClick: handleToggleAutoZoom, title: "AutoZoom", style: { backgroundColor: isAutoZoomEnabled ? '#66b3ff' : undefined }, children: [_jsx(IconZoomAuto, {}), !isToolbarCollapsed && _jsx("span", { children: "AutoZoom" })] }), _jsx(ZoomLevelText, { "$isFloating": isToolbarFloating, "$isCollapsed": isToolbarCollapsed, children: formattedZoomLevel })] }), !isReadOnly && _jsxs(ButtonGroup, { "$isFloating": isToolbarFloating, children: [_jsxs("button", { onClick: handleUndo, disabled: historyIndex === 0, title: SDKUI_Localizator.Undo, children: [_jsx(IconUndo, {}), " ", !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.Undo })] }), _jsxs("button", { onClick: handleRedo, disabled: historyIndex === wfDiagramHistory.length - 1, title: SDKUI_Localizator.Redo, children: [_jsx(IconUndo, { style: { transform: 'scaleX(-1)' } }), " ", !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.Redo })] }), _jsxs("button", { onClick: handleRestore, title: SDKUI_Localizator.Restore, children: [_jsx(IconRestore, {}), " ", !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.Restore })] }), _jsxs("button", { onClick: handleNew, title: SDKUI_Localizator.DiagramNew, disabled: isReadOnly, children: [_jsx(IconNew, {}), " ", !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.DiagramNew })] }), _jsxs("button", { onClick: handleExportDiagram, disabled: isReadOnly || !wfDiagram, title: SDKUI_Localizator.Export, children: [_jsx(IconExport, {}), _jsx("span", { children: SDKUI_Localizator.Export })] }), _jsxs("button", { onClick: handleImportDiagramClick, disabled: isReadOnly, title: SDKUI_Localizator.Import, children: [_jsx(IconImport, {}), _jsx("span", { children: SDKUI_Localizator.Import })] })] }), !isReadOnly && _jsx(ButtonGroup, { "$isFloating": isToolbarFloating, children: _jsxs("button", { onClick: handleAutoAdjust, title: SDKUI_Localizator.AutoAdjust, children: [_jsx(IconAdjust, {}), " ", !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.AutoAdjust })] }) }), !isReadOnly && _jsxs(ButtonGroup, { "$isFloating": isToolbarFloating, children: [_jsxs("button", { onClick: handleCopy, disabled: selectedItems.size === 0, title: SDKUI_Localizator.Copy, children: [_jsx(IconCopy, {}), " ", !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.Copy })] }), _jsxs("button", { onClick: handleCut, disabled: selectedItems.size === 0, title: SDKUI_Localizator.Cut, children: [_jsx(IconCut, {}), " ", !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.Cut })] }), _jsxs("button", { onClick: handlePaste, disabled: copiedItems.length === 0 && copiedConnections.length === 0, title: SDKUI_Localizator.Paste, children: [_jsx(IconPaste, {}), " ", !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.Paste })] })] }), allowEdit && _jsxs("button", { onClick: handleToggleToolbarMode, title: isToolbarFloating ? SDKUI_Localizator.ToolbarDock : SDKUI_Localizator.ToolbarFloat, children: [isToolbarFloating ? _jsx(IconPin, {}) : _jsx(IconUnpin, {}), !isToolbarCollapsed && !isToolbarFloating && _jsx("span", { children: SDKUI_Localizator.ToggleMode })] }), !isToolbarFloating && _jsx(ToolbarToggle, { onClick: () => setIsToolbarCollapsed(!isToolbarCollapsed), title: isToolbarCollapsed ? SDKUI_Localizator.ToolbarExpand : SDKUI_Localizator.ToolbarCollapse, children: isToolbarCollapsed ? _jsx(IconChevronRight, {}) : _jsx(IconCloseOutline, {}) })] }), !isReadOnly && (_jsx(ToolboxContainer, { "$isVisible": isToolboxVisible, children: isToolboxVisible && availableItemTypes.map(type => (_jsxs(ToolboxItem, { draggable: true, onDragStart: (e) => handleToolboxDragStart(e, type), onDragEnd: handleToolboxDragEnd, children: [_jsx(ToolboxIconWrapper, { children: _jsx(DiagramItemSvgContent, { itemType: type, width: 38, height: 38, isToolboxPreview: true }) }), _jsx("span", { children: LocalizeDiagramItemType(type) })] }, type))) })), _jsx(SvgScrollContainer, { ref: containerRef, children: isLoading ?
|
|
1829
|
+
(_jsxs(StyledLoadingContainer, { children: [_jsx(StyledSpinner, {}), _jsx("span", { children: `${'Caricamento diagramma'}...` })] })) : wfDiagram ? (_jsx(StyledSvg, { ref: svgRef, tabIndex: 0, onKeyDownCapture: handleKeyDown, onMouseMove: handleMouseMove, onMouseUp: handleMouseUp, onMouseDown: handleMouseDown, onDrop: handleDropOnCanvas, onDragOver: handleDragOver, width: svgWidth, height: svgHeight, style: {
|
|
1830
|
+
opacity: (defaultAutoZoom && !isInitialZoomCalculated) ? 0 : 1,
|
|
1831
|
+
transition: 'opacity 0.15s ease-in'
|
|
1832
|
+
}, children: _jsxs(ScalableGroup, { "$scale": zoomLevel, "$translateX": translateX, "$translateY": translateY, children: [wfDiagram?.DiagramItems.map(item => (_jsx(DiagramItemComponent, { wf: wfDiagram?.Info, readOnly: isReadOnly, item: item, isSelected: selectedItems.has(item.ID), isCurrent: item.ID === currentSetID, onClick: handleDiagramItemClick, onDrag: handleDrag, onDragEnd: handleDragEnd, onConnectorMouseDown: handleConnectorMouseDown, onConnectorMouseUp: handleConnectorMouseUp, onDimensionsChange: handleItemDimensionsChange, onDoubleClick: handleDoubleClickItem, backgroundColor: getWorkItemBackgroundColor(item.ID) }, item.ID))), calculatedConnections.map(connection => {
|
|
1701
1833
|
const sourceItem = wfDiagram?.DiagramItems.find(item => item.ID === connection.Source.ParentDiagramItem.ID);
|
|
1702
1834
|
const sinkItem = wfDiagram?.DiagramItems.find(item => item.ID === connection.Sink.ParentDiagramItem.ID);
|
|
1703
1835
|
if (!sourceItem || !sinkItem)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { QueryDescriptor, ValidationItem } from '@topconsultnpm/sdk-ts';
|
|
3
3
|
import { ITMApplyFormProps, FormModes } from '../../ts';
|
|
4
|
+
import type { TMContextMenuItemProps } from '../NewComponents/ContextMenu/types';
|
|
4
5
|
export declare const StyledRowItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
5
6
|
export declare const StyledItemWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
6
7
|
$borderRadius?: string;
|
|
@@ -54,5 +55,5 @@ export interface ITMQdDropDownMenuProps {
|
|
|
54
55
|
backgroundColor?: string;
|
|
55
56
|
disabled?: boolean;
|
|
56
57
|
borderRadius?: string;
|
|
57
|
-
items?:
|
|
58
|
+
items?: TMContextMenuItemProps[];
|
|
58
59
|
}
|