@topconsultnpm/sdkui-react 6.22.0-dev3.24 → 6.22.0-dev3.25
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/base/TMAlert.js +6 -8
- package/lib/components/base/TMAreaManager.js +53 -55
- package/lib/components/base/TMCustomButton.js +39 -48
- package/lib/components/base/TMTreeView.js +14 -0
- package/lib/components/base/waitPanel/TMWaitPanelConfirm.d.ts +12 -0
- package/lib/components/base/waitPanel/TMWaitPanelConfirm.js +185 -0
- package/lib/components/base/waitPanel/TMWaitPanelManager.d.ts +169 -0
- package/lib/components/base/waitPanel/TMWaitPanelManager.js +320 -0
- package/lib/components/base/waitPanel/TMWaitPanelView.d.ts +53 -0
- package/lib/components/base/waitPanel/TMWaitPanelView.js +274 -0
- package/lib/components/base/waitPanel/index.d.ts +1 -0
- package/lib/components/base/waitPanel/index.js +1 -0
- package/lib/components/choosers/TMPathChooser.js +17 -34
- package/lib/components/features/assistant/TMToppyDraggableHelpCenter.js +2 -2
- package/lib/components/features/documents/TMBatchUpdateForm.js +3 -4
- package/lib/components/features/documents/TMCopyToFolderForm.js +32 -35
- package/lib/components/features/documents/TMDcmtForm.js +48 -60
- package/lib/components/features/documents/TMDcmtIcon.d.ts +1 -3
- package/lib/components/features/documents/TMDcmtIcon.js +3 -5
- package/lib/components/features/documents/TMDcmtPreview.js +5 -3
- package/lib/components/features/documents/TMMasterDetailDcmts.d.ts +2 -0
- package/lib/components/features/documents/TMMasterDetailDcmts.js +45 -147
- package/lib/components/features/documents/TMMergeToPdfForm.js +48 -47
- package/lib/components/features/documents/TMMultiMasterDetailDcmtsForm.js +14 -15
- package/lib/components/features/documents/TMRelationViewer.d.ts +3 -14
- package/lib/components/features/documents/TMRelationViewer.js +115 -79
- package/lib/components/features/search/TMSearchResult.js +6 -8
- package/lib/components/features/search/TMViewHistoryDcmt.js +14 -25
- package/lib/components/features/tasks/TMTasksView.js +91 -90
- package/lib/components/features/wg/TMWGsCopyMoveForm.js +91 -91
- package/lib/components/grids/TMBlogsPost.js +92 -96
- package/lib/components/index.d.ts +2 -0
- package/lib/components/index.js +2 -0
- package/lib/components/pages/TMPage.js +29 -31
- package/lib/helper/SDKUI_Localizator.d.ts +7 -0
- package/lib/helper/SDKUI_Localizator.js +70 -0
- package/lib/helper/ZipManager.d.ts +1 -1
- package/lib/helper/ZipManager.js +2 -1
- package/lib/hooks/useCheckInOutOperations.d.ts +0 -6
- package/lib/hooks/useCheckInOutOperations.js +14 -34
- package/lib/hooks/useDcmtOperations.d.ts +3 -12
- package/lib/hooks/useDcmtOperations.js +130 -160
- package/lib/hooks/useDocumentOperations.js +12 -23
- package/lib/hooks/useMultiMasterDetailDcmts.d.ts +0 -15
- package/lib/hooks/useMultiMasterDetailDcmts.js +62 -65
- package/lib/hooks/useWorkflowApprove.js +33 -17
- package/package.json +1 -1
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useLayoutEffect, useRef } from 'react';
|
|
3
|
+
import styled, { keyframes } from 'styled-components';
|
|
4
|
+
import toppy from '../../../assets/Toppy-generico.png';
|
|
5
|
+
import { AppModules, SDK_Globals } from '@topconsultnpm/sdk-ts';
|
|
6
|
+
import { getAppModuleButtonColors, SDKUI_Localizator } from '../../../helper';
|
|
7
|
+
import TMWaitPanelConfirm from './TMWaitPanelConfirm';
|
|
8
|
+
/** Colore della barra per applicazione, da getAppModuleButtonColors. SDK_Globals.tmSession lancia senza sessione. */
|
|
9
|
+
const getProgressColor = () => {
|
|
10
|
+
let appModuleID = AppModules.SURFER;
|
|
11
|
+
try {
|
|
12
|
+
appModuleID = SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER;
|
|
13
|
+
}
|
|
14
|
+
catch { /* nessuna sessione: resta il default */ }
|
|
15
|
+
return getAppModuleButtonColors(appModuleID).base;
|
|
16
|
+
};
|
|
17
|
+
const fadeIn = keyframes `
|
|
18
|
+
from { opacity: 0; }
|
|
19
|
+
to { opacity: 1; }
|
|
20
|
+
`;
|
|
21
|
+
// Sfondo su uno pseudo-elemento: il layer composito dell'animazione sgranerebbe Toppy.
|
|
22
|
+
const StyledOverlay = styled.div `
|
|
23
|
+
position: fixed;
|
|
24
|
+
inset: 0;
|
|
25
|
+
z-index: ${props => props.$zIndex};
|
|
26
|
+
|
|
27
|
+
&::before {
|
|
28
|
+
content: '';
|
|
29
|
+
position: absolute;
|
|
30
|
+
inset: 0;
|
|
31
|
+
background-color: rgba(17, 24, 39, 0.16);
|
|
32
|
+
animation: ${fadeIn} 140ms ease-out;
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
const StyledCard = styled.div `
|
|
36
|
+
position: absolute;
|
|
37
|
+
top: 50%;
|
|
38
|
+
left: 50%;
|
|
39
|
+
transform: translate(-50%, -50%);
|
|
40
|
+
width: 420px;
|
|
41
|
+
max-width: calc(100% - 24px);
|
|
42
|
+
max-height: calc(100% - 24px);
|
|
43
|
+
overflow-y: auto;
|
|
44
|
+
box-sizing: border-box;
|
|
45
|
+
padding: 22px 24px 18px 24px;
|
|
46
|
+
background: #ffffff;
|
|
47
|
+
border-radius: 16px;
|
|
48
|
+
box-shadow: 0 18px 48px rgba(16, 24, 40, 0.22);
|
|
49
|
+
font-family: inherit;
|
|
50
|
+
`;
|
|
51
|
+
const StyledHeader = styled.div `
|
|
52
|
+
display: flex;
|
|
53
|
+
flex-direction: row;
|
|
54
|
+
align-items: center;
|
|
55
|
+
gap: 16px;
|
|
56
|
+
`;
|
|
57
|
+
// Ritaglio dal contenitore, non object-fit: cover darebbe un'altezza frazionaria e sgranerebbe l'immagine.
|
|
58
|
+
const StyledToppyClip = styled.div `
|
|
59
|
+
height: 61px;
|
|
60
|
+
width: 68px;
|
|
61
|
+
overflow: hidden;
|
|
62
|
+
flex: 0 0 auto;
|
|
63
|
+
`;
|
|
64
|
+
const StyledToppy = styled.img `
|
|
65
|
+
display: block;
|
|
66
|
+
width: 68px;
|
|
67
|
+
height: 79px;
|
|
68
|
+
user-select: none;
|
|
69
|
+
-webkit-user-drag: none;
|
|
70
|
+
`;
|
|
71
|
+
const StyledHeaderText = styled.div `
|
|
72
|
+
flex: 1;
|
|
73
|
+
min-width: 0;
|
|
74
|
+
`;
|
|
75
|
+
const StyledTitle = styled.div `
|
|
76
|
+
font-size: 17px;
|
|
77
|
+
font-weight: 600;
|
|
78
|
+
color: #1f2937;
|
|
79
|
+
line-height: 1.3;
|
|
80
|
+
overflow-wrap: anywhere;
|
|
81
|
+
`;
|
|
82
|
+
const StyledSubtitle = styled.div `
|
|
83
|
+
margin-top: 3px;
|
|
84
|
+
font-size: 13px;
|
|
85
|
+
color: #6b7280;
|
|
86
|
+
line-height: 1.3;
|
|
87
|
+
font-variant-numeric: tabular-nums;
|
|
88
|
+
overflow-wrap: anywhere;
|
|
89
|
+
`;
|
|
90
|
+
// Didascalia di una barra: con due avanzamenti e' l'unica cosa che dice quale sia quale.
|
|
91
|
+
const StyledBarLabel = styled.div `
|
|
92
|
+
margin-top: 18px;
|
|
93
|
+
font-size: 11px;
|
|
94
|
+
font-weight: 700;
|
|
95
|
+
letter-spacing: 0.04em;
|
|
96
|
+
text-transform: uppercase;
|
|
97
|
+
color: #9aa3b2;
|
|
98
|
+
overflow: hidden;
|
|
99
|
+
text-overflow: ellipsis;
|
|
100
|
+
white-space: nowrap;
|
|
101
|
+
`;
|
|
102
|
+
const StyledPercentRow = styled.div `
|
|
103
|
+
display: flex;
|
|
104
|
+
flex-direction: row;
|
|
105
|
+
align-items: flex-end;
|
|
106
|
+
justify-content: space-between;
|
|
107
|
+
flex-wrap: wrap;
|
|
108
|
+
gap: 8px 12px;
|
|
109
|
+
margin-top: ${props => (props.$hasLabel ? '4px' : '18px')};
|
|
110
|
+
`;
|
|
111
|
+
const StyledPercent = styled.div `
|
|
112
|
+
font-size: 34px;
|
|
113
|
+
font-weight: 700;
|
|
114
|
+
color: #111827;
|
|
115
|
+
line-height: 1;
|
|
116
|
+
font-variant-numeric: tabular-nums;
|
|
117
|
+
`;
|
|
118
|
+
const StyledCounters = styled.div `
|
|
119
|
+
display: flex;
|
|
120
|
+
flex-direction: row;
|
|
121
|
+
align-items: center;
|
|
122
|
+
gap: 6px;
|
|
123
|
+
padding-bottom: 3px;
|
|
124
|
+
`;
|
|
125
|
+
const StyledPill = styled.span `
|
|
126
|
+
display: inline-flex;
|
|
127
|
+
flex-direction: row;
|
|
128
|
+
align-items: center;
|
|
129
|
+
gap: 4px;
|
|
130
|
+
padding: 2px 8px 2px 6px;
|
|
131
|
+
border-radius: 999px;
|
|
132
|
+
font-size: 12px;
|
|
133
|
+
font-weight: 600;
|
|
134
|
+
line-height: 18px;
|
|
135
|
+
color: ${props => props.$color};
|
|
136
|
+
background: ${props => props.$background};
|
|
137
|
+
font-variant-numeric: tabular-nums;
|
|
138
|
+
|
|
139
|
+
svg { flex: 0 0 auto; }
|
|
140
|
+
`;
|
|
141
|
+
const StyledTrack = styled.div `
|
|
142
|
+
margin-top: 12px;
|
|
143
|
+
width: 100%;
|
|
144
|
+
height: 8px;
|
|
145
|
+
border-radius: 999px;
|
|
146
|
+
background: #e8edf4;
|
|
147
|
+
overflow: hidden;
|
|
148
|
+
`;
|
|
149
|
+
const StyledFill = styled.div `
|
|
150
|
+
width: 100%;
|
|
151
|
+
height: 100%;
|
|
152
|
+
background: ${props => props.$color};
|
|
153
|
+
transform: scaleX(0);
|
|
154
|
+
transform-origin: left center;
|
|
155
|
+
transition: transform 120ms linear;
|
|
156
|
+
will-change: transform;
|
|
157
|
+
`;
|
|
158
|
+
const StyledTimeRow = styled.div `
|
|
159
|
+
display: flex;
|
|
160
|
+
flex-direction: row;
|
|
161
|
+
align-items: center;
|
|
162
|
+
justify-content: space-between;
|
|
163
|
+
gap: 12px;
|
|
164
|
+
margin-top: 8px;
|
|
165
|
+
font-size: 12px;
|
|
166
|
+
color: #8a94a6;
|
|
167
|
+
font-variant-numeric: tabular-nums;
|
|
168
|
+
`;
|
|
169
|
+
// Seconda barra: come la principale ma piu' piccola e in tono minore.
|
|
170
|
+
const StyledSecondary = styled.div `
|
|
171
|
+
margin-top: ${props => (props.$hasLabel ? '4px' : '14px')};
|
|
172
|
+
`;
|
|
173
|
+
const StyledSecondaryRow = styled.div `
|
|
174
|
+
display: flex;
|
|
175
|
+
flex-direction: row;
|
|
176
|
+
align-items: baseline;
|
|
177
|
+
justify-content: space-between;
|
|
178
|
+
gap: 12px;
|
|
179
|
+
font-size: 12px;
|
|
180
|
+
color: #6b7280;
|
|
181
|
+
font-variant-numeric: tabular-nums;
|
|
182
|
+
`;
|
|
183
|
+
const StyledSecondaryText = styled.span `
|
|
184
|
+
overflow: hidden;
|
|
185
|
+
text-overflow: ellipsis;
|
|
186
|
+
white-space: nowrap;
|
|
187
|
+
`;
|
|
188
|
+
const StyledSecondaryTrack = styled.div `
|
|
189
|
+
margin-top: 5px;
|
|
190
|
+
width: 100%;
|
|
191
|
+
height: 5px;
|
|
192
|
+
border-radius: 999px;
|
|
193
|
+
background: #eef1f6;
|
|
194
|
+
overflow: hidden;
|
|
195
|
+
`;
|
|
196
|
+
const StyledSecondaryFill = styled.div `
|
|
197
|
+
width: 100%;
|
|
198
|
+
height: 100%;
|
|
199
|
+
background: ${props => props.$color};
|
|
200
|
+
opacity: 0.55;
|
|
201
|
+
transform: scaleX(0);
|
|
202
|
+
transform-origin: left center;
|
|
203
|
+
transition: transform 120ms linear;
|
|
204
|
+
will-change: transform;
|
|
205
|
+
`;
|
|
206
|
+
const StyledFooter = styled.div `
|
|
207
|
+
display: flex;
|
|
208
|
+
flex-direction: row;
|
|
209
|
+
justify-content: flex-end;
|
|
210
|
+
margin-top: 18px;
|
|
211
|
+
`;
|
|
212
|
+
const StyledAbortButton = styled.button `
|
|
213
|
+
padding: 9px 18px;
|
|
214
|
+
border: 1px solid #d5dbe5;
|
|
215
|
+
border-radius: 10px;
|
|
216
|
+
background: #ffffff;
|
|
217
|
+
color: #374151;
|
|
218
|
+
font-size: 13px;
|
|
219
|
+
font-family: inherit;
|
|
220
|
+
cursor: pointer;
|
|
221
|
+
transition: background-color 120ms ease, border-color 120ms ease;
|
|
222
|
+
|
|
223
|
+
&:hover:not(:disabled) { background: #f3f5f9; border-color: #c3cbd8; }
|
|
224
|
+
&:active:not(:disabled) { background: #e9edf4; }
|
|
225
|
+
&:disabled { cursor: default; opacity: 0.55; }
|
|
226
|
+
`;
|
|
227
|
+
const IconOk = () => (_jsx("svg", { width: '13', height: '13', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '3', strokeLinecap: 'round', strokeLinejoin: 'round', children: _jsx("polyline", { points: '20 6 9 17 4 12' }) }));
|
|
228
|
+
const IconWarning = () => (_jsxs("svg", { width: '13', height: '13', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '2.4', strokeLinecap: 'round', strokeLinejoin: 'round', children: [_jsx("path", { d: 'M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0Z' }), _jsx("line", { x1: '12', y1: '9', x2: '12', y2: '13' }), _jsx("line", { x1: '12', y1: '17', x2: '12.01', y2: '17' })] }));
|
|
229
|
+
const IconError = () => (_jsxs("svg", { width: '13', height: '13', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '3', strokeLinecap: 'round', strokeLinejoin: 'round', children: [_jsx("line", { x1: '18', y1: '6', x2: '6', y2: '18' }), _jsx("line", { x1: '6', y1: '6', x2: '18', y2: '18' })] }));
|
|
230
|
+
const TMWaitPanelView = ({ title = '', subtitle = '', cancelable = false, showEta = true, showCounters = true, showSecondary = false, secondaryText = '', primaryLabel = '', secondaryLabel = '', zIndex = 2147483601, onAbort, onConfirmYes, onConfirmNo, onMount }) => {
|
|
231
|
+
const confirmRef = useRef(null);
|
|
232
|
+
const titleRef = useRef(null);
|
|
233
|
+
const subtitleRef = useRef(null);
|
|
234
|
+
const percentRef = useRef(null);
|
|
235
|
+
const fillRef = useRef(null);
|
|
236
|
+
const elapsedRef = useRef(null);
|
|
237
|
+
const remainingRef = useRef(null);
|
|
238
|
+
const okValueRef = useRef(null);
|
|
239
|
+
const warningValueRef = useRef(null);
|
|
240
|
+
const errorValueRef = useRef(null);
|
|
241
|
+
const abortRef = useRef(null);
|
|
242
|
+
const secondaryTextRef = useRef(null);
|
|
243
|
+
const secondaryPercentRef = useRef(null);
|
|
244
|
+
const secondaryFillRef = useRef(null);
|
|
245
|
+
useLayoutEffect(() => {
|
|
246
|
+
if (!confirmRef.current || !titleRef.current || !subtitleRef.current || !percentRef.current || !fillRef.current)
|
|
247
|
+
return;
|
|
248
|
+
if (!elapsedRef.current || !remainingRef.current)
|
|
249
|
+
return;
|
|
250
|
+
if (!okValueRef.current || !warningValueRef.current || !errorValueRef.current)
|
|
251
|
+
return;
|
|
252
|
+
onMount?.({
|
|
253
|
+
confirm: confirmRef.current,
|
|
254
|
+
title: titleRef.current,
|
|
255
|
+
subtitle: subtitleRef.current,
|
|
256
|
+
percent: percentRef.current,
|
|
257
|
+
fill: fillRef.current,
|
|
258
|
+
elapsed: elapsedRef.current,
|
|
259
|
+
remaining: remainingRef.current,
|
|
260
|
+
okValue: okValueRef.current,
|
|
261
|
+
warningValue: warningValueRef.current,
|
|
262
|
+
errorValue: errorValueRef.current,
|
|
263
|
+
abortButton: abortRef.current,
|
|
264
|
+
secondaryText: secondaryTextRef.current,
|
|
265
|
+
secondaryPercent: secondaryPercentRef.current,
|
|
266
|
+
secondaryFill: secondaryFillRef.current,
|
|
267
|
+
});
|
|
268
|
+
// Montaggio una tantum: da qui in avanti il manager aggiorna il pannello via DOM, non via render.
|
|
269
|
+
}, []);
|
|
270
|
+
return (_jsxs(_Fragment, { children: [_jsx(StyledOverlay, { $zIndex: zIndex, children: _jsxs(StyledCard, { role: 'dialog', "aria-live": 'polite', children: [_jsxs(StyledHeader, { children: [_jsx(StyledToppyClip, { children: _jsx(StyledToppy, { src: toppy, alt: '', draggable: false }) }), _jsxs(StyledHeaderText, { children: [_jsx(StyledTitle, { ref: titleRef, children: title }), _jsx(StyledSubtitle, { ref: subtitleRef, children: subtitle })] })] }), primaryLabel && _jsx(StyledBarLabel, { children: primaryLabel }), _jsxs(StyledPercentRow, { $hasLabel: !!primaryLabel, children: [_jsx(StyledPercent, { ref: percentRef, children: "0.00%" }), _jsxs(StyledCounters, { style: { display: showCounters ? 'flex' : 'none' }, children: [_jsxs(StyledPill, { $color: '#3E7B1C', $background: '#E8F5E0', children: [_jsx(IconOk, {}), _jsx("span", { ref: okValueRef, children: "0" })] }), _jsxs(StyledPill, { $color: '#8A6D00', $background: '#FBF3CF', children: [_jsx(IconWarning, {}), _jsx("span", { ref: warningValueRef, children: "0" })] }), _jsxs(StyledPill, { $color: '#B00F2B', $background: '#FBE1E6', children: [_jsx(IconError, {}), _jsx("span", { ref: errorValueRef, children: "0" })] })] })] }), _jsx(StyledTrack, { children: _jsx(StyledFill, { ref: fillRef, $color: getProgressColor() }) }), _jsxs(StyledTimeRow, { style: { visibility: showEta ? 'visible' : 'hidden' }, children: [_jsx("span", { ref: elapsedRef }), _jsx("span", { ref: remainingRef })] }), showSecondary && secondaryLabel && _jsx(StyledBarLabel, { children: secondaryLabel }), showSecondary &&
|
|
271
|
+
_jsxs(StyledSecondary, { $hasLabel: !!secondaryLabel, children: [_jsxs(StyledSecondaryRow, { children: [_jsx(StyledSecondaryText, { ref: secondaryTextRef, children: secondaryText }), _jsx("span", { ref: secondaryPercentRef, children: "0.00%" })] }), _jsx(StyledSecondaryTrack, { children: _jsx(StyledSecondaryFill, { ref: secondaryFillRef, $color: getProgressColor() }) })] }), cancelable &&
|
|
272
|
+
_jsx(StyledFooter, { children: _jsx(StyledAbortButton, { ref: abortRef, type: 'button', onClick: onAbort, children: SDKUI_Localizator.Abort }) })] }) }), _jsx(TMWaitPanelConfirm, { ref: confirmRef, zIndex: zIndex + 1, onYes: onConfirmYes, onNo: onConfirmNo })] }));
|
|
273
|
+
};
|
|
274
|
+
export default TMWaitPanelView;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './TMWaitPanelManager';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './TMWaitPanelManager';
|
|
@@ -6,12 +6,11 @@ import { TMColors } from '../../utils/theme';
|
|
|
6
6
|
import ShowAlert from '../base/TMAlert';
|
|
7
7
|
import TMAreaManager from '../base/TMAreaManager';
|
|
8
8
|
import TMButton from '../base/TMButton';
|
|
9
|
-
import { TMLayoutItem } from '../base/TMLayout';
|
|
9
|
+
import TMLayoutContainer, { TMLayoutItem } from '../base/TMLayout';
|
|
10
10
|
import TMModal from '../base/TMModal';
|
|
11
11
|
import { TMExceptionBoxManager } from '../base/TMPopUp';
|
|
12
|
-
import
|
|
12
|
+
import TMWaitPanelManager from '../base/waitPanel/TMWaitPanelManager';
|
|
13
13
|
import TMTextBox from '../editors/TMTextBox';
|
|
14
|
-
let abortController = new AbortController();
|
|
15
14
|
const TMPathChooser = (props) => {
|
|
16
15
|
//const [path, setPath] = useState<string>(props.value)
|
|
17
16
|
const [elementStyle, setElementStyle] = useState(props.elementStyle);
|
|
@@ -22,12 +21,6 @@ const TMPathChooser = (props) => {
|
|
|
22
21
|
const [showAreaManager, setShowAreaManager] = useState(false);
|
|
23
22
|
const [downloadLink, setDownloadLink] = useState(null);
|
|
24
23
|
const [file, setFile] = useState(null);
|
|
25
|
-
const [showWaitPanel, setShowWaitPanel] = useState(false);
|
|
26
|
-
const [waitPanelTitle, setWaitPanelTitle] = useState('');
|
|
27
|
-
const [showSecondary, setShowSecondary] = useState(false);
|
|
28
|
-
const [waitPanelTextSecondary, setWaitPanelTextSecondary] = useState('');
|
|
29
|
-
const [waitPanelValueSecondary, setWaitPanelValueSecondary] = useState(0);
|
|
30
|
-
const [waitPanelMaxValueSecondary, setWaitPanelMaxValueSecondary] = useState(0);
|
|
31
24
|
const formulaItems = ['{@JobName}', '{@JobStartDate}', '{@JobStartDate_DDMMYYYY}', '{@JobStartDateTime}', '{@ProcessRunID}', '{@ProcessName}', '{@ProcessStartDate}', '{@ProcessStartDateTime}'];
|
|
32
25
|
//useEffect(() => { setPath(props.value) }, [props.value])
|
|
33
26
|
useEffect(() => {
|
|
@@ -98,30 +91,23 @@ const TMPathChooser = (props) => {
|
|
|
98
91
|
return buttons;
|
|
99
92
|
};
|
|
100
93
|
const onFileDownloadHandler = async () => {
|
|
94
|
+
// Un solo file: la barra del pannello segue i byte scaricati
|
|
95
|
+
const waitPanel = TMWaitPanelManager.show({
|
|
96
|
+
title: "Download",
|
|
97
|
+
cancelable: true,
|
|
98
|
+
showCounters: false,
|
|
99
|
+
});
|
|
101
100
|
try {
|
|
102
101
|
let av = AreaHelper.ExtractAreaInfo_2(props.value, true);
|
|
103
102
|
let doc;
|
|
104
103
|
let tms = props.tmSession ?? SDK_Globals.tmSession;
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
if (firstBlock) {
|
|
113
|
-
maxFileSize = pd.ProgressBarMaximum ?? 0;
|
|
114
|
-
setWaitPanelMaxValueSecondary(maxFileSize);
|
|
115
|
-
firstBlock = false;
|
|
116
|
-
}
|
|
117
|
-
setWaitPanelValueSecondary(pd.ProgressBarValue);
|
|
118
|
-
setWaitPanelTextSecondary(`Downloading... ${Globalization.getNumberDisplayValue(pd.ProgressBarValue, true)} / ${Globalization.getNumberDisplayValue(maxFileSize, true)}`);
|
|
119
|
-
if (pd.ProgressBarValue === pd.ProgressBarMaximum) {
|
|
120
|
-
setWaitPanelMaxValueSecondary(0);
|
|
121
|
-
setWaitPanelValueSecondary(0);
|
|
122
|
-
setWaitPanelTextSecondary('');
|
|
123
|
-
firstBlock = true;
|
|
124
|
-
}
|
|
104
|
+
doc = await tms?.NewAreaEngine().RetrieveFileAsync(av.aid, av.subFolder, av.fileName, FileFormats.None, waitPanel.signal, (pd) => {
|
|
105
|
+
const total = pd.ProgressBarMaximum ?? 0;
|
|
106
|
+
waitPanel.update({
|
|
107
|
+
value: pd.ProgressBarValue,
|
|
108
|
+
max: total,
|
|
109
|
+
subtitle: `Downloading... ${Globalization.getNumberDisplayValue(pd.ProgressBarValue, true)} / ${Globalization.getNumberDisplayValue(total, true)}`
|
|
110
|
+
});
|
|
125
111
|
});
|
|
126
112
|
setFile(doc);
|
|
127
113
|
}
|
|
@@ -135,13 +121,10 @@ const TMPathChooser = (props) => {
|
|
|
135
121
|
setFile(null);
|
|
136
122
|
}
|
|
137
123
|
finally {
|
|
138
|
-
|
|
139
|
-
setWaitPanelMaxValueSecondary(0);
|
|
140
|
-
setWaitPanelValueSecondary(0);
|
|
141
|
-
setShowWaitPanel(false);
|
|
124
|
+
waitPanel.close();
|
|
142
125
|
}
|
|
143
126
|
};
|
|
144
|
-
return (_jsxs(
|
|
127
|
+
return (_jsxs(TMLayoutContainer, { direction: 'vertical', children: [_jsx(TMLayoutItem, { children: _jsx(TMTextBox, { buttons: renderButtons(), elementStyle: elementStyle, formulaItems: props.allowParametricPath ? formulaItems : [], isModifiedWhen: props.isModifiedWhen, label: props.label, value: props.value || '', onValueChanged: (e) => { /*setPath(e.target.value);*/ props.onValueChanged?.(e.target.value); }, validationItems: props.validationItems }) }), showAreaManager &&
|
|
145
128
|
_jsxs(TMModal, { resizable: true, width: '80%', onClose: () => setShowAreaManager(false), children: [_jsx(TMAreaManager, { showOnlyFolders: props.allowBrowseFolder_Area && !props.allowBrowseFile_Area, initialPath: props.value, onFolderChanged: (folder) => setAreaFolderPath(folder), onFileChanged: (file) => setAreaFilePath(file), isPathChooser: true, areaChoose: areaChoose, width: '98%', height: props.allowBrowseFile_Area ? '70vh' : '90%', tmSession: props.tmSession, selectionMode: 'single' }), _jsx("div", { style: { position: 'absolute', right: '22px', bottom: '8px' }, children: _jsx(TMButton, { caption: 'OK', onClick: () => areaChoose() }) })] })] }));
|
|
146
129
|
};
|
|
147
130
|
export default TMPathChooser;
|
|
@@ -60,7 +60,7 @@ const TMToppyButton = styled.div.attrs((props) => ({
|
|
|
60
60
|
height: ${(props) => props.$isCollapsed ? '56px' : '110px'};
|
|
61
61
|
max-width: 100%;
|
|
62
62
|
max-height: 100%;
|
|
63
|
-
z-index:
|
|
63
|
+
z-index: 2147483600;
|
|
64
64
|
background-color: ${(props) => props.$isCollapsed ? '#ffffff' : 'transparent'};
|
|
65
65
|
border: ${(props) => props.$isCollapsed ? '3px solid #3b82f6' : 'none'};
|
|
66
66
|
border-radius: ${(props) => props.$isCollapsed ? '50%' : '0'};
|
|
@@ -130,7 +130,7 @@ const DragOverlay = styled.div `
|
|
|
130
130
|
left: 0;
|
|
131
131
|
right: 0;
|
|
132
132
|
bottom: 0;
|
|
133
|
-
z-index:
|
|
133
|
+
z-index: 2147483599;
|
|
134
134
|
cursor: grabbing;
|
|
135
135
|
`;
|
|
136
136
|
const TMToppyDraggableHelpCenter = (props) => {
|
|
@@ -6,11 +6,10 @@ import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
|
|
|
6
6
|
import { DcmtOperationTypes, FormModes } from '../../../ts';
|
|
7
7
|
import { StyledToolbarCardContainer, StyledFormButtonsContainer } from '../../base/Styled';
|
|
8
8
|
import { useDeviceType, DeviceType } from '../../base/TMDeviceProvider';
|
|
9
|
-
import { TMSplitterLayout } from '../../base/TMLayout';
|
|
9
|
+
import TMLayoutContainer, { TMSplitterLayout } from '../../base/TMLayout';
|
|
10
10
|
import { TMExceptionBoxManager, TMMessageBoxManager, ButtonNames } from '../../base/TMPopUp';
|
|
11
11
|
import TMShowAllOrMaxItemsButton from '../../base/TMShowAllOrMaxItemsButton';
|
|
12
12
|
import TMSpinner from '../../base/TMSpinner';
|
|
13
|
-
import { TMLayoutWaitingContainer } from '../../base/TMWaitPanel';
|
|
14
13
|
import TMDistinctValues from '../../choosers/TMDistinctValues';
|
|
15
14
|
import TMFormulaEditor, { FormulaDescriptor, FormulaHelper, FormulaTargets } from '../../editors/TMFormulaEditor';
|
|
16
15
|
import { useMetadataEditableList } from '../../editors/TMMetadataEditor';
|
|
@@ -28,7 +27,7 @@ const TMBatchUpdateForm = ({ inputDcmts, TID, DID, isExpertMode = SDKUI_Globals.
|
|
|
28
27
|
const [showFormulaEditor, setShowFormulaEditor] = useState(false);
|
|
29
28
|
const [focusedMetadataValue, setFocusedMetadataValue] = useState();
|
|
30
29
|
const [addOrRemoveEditableList] = useMetadataEditableList();
|
|
31
|
-
const {
|
|
30
|
+
const { runOperationAsync } = useDcmtOperations();
|
|
32
31
|
const deviceType = useDeviceType();
|
|
33
32
|
useEffect(() => {
|
|
34
33
|
if (!TID)
|
|
@@ -131,7 +130,7 @@ const TMBatchUpdateForm = ({ inputDcmts, TID, DID, isExpertMode = SDKUI_Globals.
|
|
|
131
130
|
});
|
|
132
131
|
};
|
|
133
132
|
const renderContent = () => {
|
|
134
|
-
return (_jsx(
|
|
133
|
+
return (_jsx(TMLayoutContainer, { children: _jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: 'visible', separatorSize: Gutters.getGutters(), separatorColor: 'transparent', separatorActiveColor: 'transparent', showSeparator: showFormulaEditor, start: showFormulaEditor ? ['50%', '50%'] : ['100%', '0%'], min: ['0', '0'], children: [_jsx(TMPanel, { title: isModal ? 'Modifica i metadati' : `${SDKUI_Localizator.BatchUpdate} (${inputDcmts.length} documenti selezionati)`, onBack: deviceType === DeviceType.MOBILE ? handleClose : undefined, allowMaximize: !isModal, showHeader: !isModal, children: _jsxs(StyledToolbarCardContainer, { children: [_jsx(TMMetadataValues, { TID: TID, isExpertMode: isExpertMode, showCheckBoxes: ShowCheckBoxesMode.Always, showNullValueCheckBoxes: true, metadataValues: metadataValuesSource, metadataValuesOrig: metadataValuesSourceOrig, validationItems: validationItems, isOpenDistinctValues: showDistinctValuesPanel, selectedMID: focusedMetadataValue?.mid, onFocusedItemChanged: (item) => { setFocusedMetadataValue(item); }, onValueChanged: (newItems) => {
|
|
135
134
|
setMetadataValues((prevItems) => prevItems.map((item) => {
|
|
136
135
|
const newItem = newItems.find((newItem) => newItem.tid === item.tid && newItem.mid === item.mid);
|
|
137
136
|
return newItem ? { ...item, ...newItem } : item;
|
|
@@ -13,8 +13,8 @@ import TMOrderRetrieveFormats from '../../choosers/TMOrderRetrieveFormats';
|
|
|
13
13
|
import TMButton from '../../base/TMButton';
|
|
14
14
|
import { ButtonNames, TMMessageBoxManager } from '../../base/TMPopUp';
|
|
15
15
|
import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
|
|
16
|
-
import { TMLayoutWaitingContainer } from '../../base/TMWaitPanel';
|
|
17
16
|
import { TMSplitterLayout } from '../../base/TMLayout';
|
|
17
|
+
import TMWaitPanelManager from '../../base/waitPanel/TMWaitPanelManager';
|
|
18
18
|
import TMCheckBox from '../../editors/TMCheckBox';
|
|
19
19
|
import ShowAlert from '../../base/TMAlert';
|
|
20
20
|
import { TMColors } from '../../../utils/theme';
|
|
@@ -26,17 +26,13 @@ import { buildInitialDownloadSettings, fileExists, generateTargetFileName, gener
|
|
|
26
26
|
* e TMDownloadRelationViewerSection.
|
|
27
27
|
*/
|
|
28
28
|
const TMCopyToFolderForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationViewer, allTasks, getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers }) => {
|
|
29
|
-
|
|
29
|
+
// Il wait panel del download lo apre e lo aggiorna l'hook: qui serve solo la funzione.
|
|
30
|
+
const { downloadDcmtsAsync } = useDcmtOperations();
|
|
30
31
|
// Get the current device type (e.g., mobile, tablet, desktop) using a custom hook.
|
|
31
32
|
const deviceType = useDeviceType();
|
|
32
33
|
// ---- Stato dei settings ----
|
|
33
34
|
const [settings, setSettings] = useState(() => buildInitialDownloadSettings(SDKUI_Globals.userSettings.documentDownloadSettings, SDKUI_Globals.userSettings.searchSettings.invoiceRetrieveFormat, SDKUI_Globals.userSettings.searchSettings.orderRetrieveFormat));
|
|
34
35
|
const [selectedItemsRelationViewer, setSelectedItemsRelationViewer] = useState([]);
|
|
35
|
-
// ---- Stato per la creazione ZIP (spinner separato) ----
|
|
36
|
-
const [isCreatingZip, setIsCreatingZip] = useState(false);
|
|
37
|
-
const [zipProgressText, setZipProgressText] = useState('');
|
|
38
|
-
const [zipProgressValue, setZipProgressValue] = useState(0);
|
|
39
|
-
const [zipProgressMax, setZipProgressMax] = useState(0);
|
|
40
36
|
const [hasSavedLayout, setHasSavedLayout] = useState(() => {
|
|
41
37
|
const saved = SDKUI_Globals.userSettings.documentDownloadSettings;
|
|
42
38
|
const defaults = new DocumentDownloadSettings();
|
|
@@ -215,18 +211,19 @@ const TMCopyToFolderForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationVi
|
|
|
215
211
|
const zipFileName = settings.zipFileName.trim().toLowerCase().endsWith('.zip')
|
|
216
212
|
? settings.zipFileName.trim()
|
|
217
213
|
: settings.zipFileName.trim() + '.zip';
|
|
218
|
-
// Crea il blob ZIP
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
214
|
+
// Crea il blob ZIP: la compressione non e' interrompibile, quindi niente Interrompi.
|
|
215
|
+
const zipPanel = TMWaitPanelManager.show({
|
|
216
|
+
title: SDKUI_Localizator.CompressToZipFile,
|
|
217
|
+
subtitle: SDKUI_Localizator.CompressToZipFile,
|
|
218
|
+
max: zipEntries.length,
|
|
219
|
+
showCounters: false,
|
|
220
|
+
});
|
|
223
221
|
try {
|
|
224
222
|
const zipBlob = await ZipManager.createZip(zipEntries, {
|
|
225
223
|
compressionLevel: 6,
|
|
226
224
|
password: settings.zipPassword.trim() || undefined,
|
|
227
225
|
onProgress: (current, total, filename) => {
|
|
228
|
-
|
|
229
|
-
setZipProgressText(`${SDKUI_Localizator.CompressToZipFile}: ${filename}`);
|
|
226
|
+
zipPanel.update({ value: current, subtitle: `${SDKUI_Localizator.CompressToZipFile}: ${filename}` });
|
|
230
227
|
},
|
|
231
228
|
});
|
|
232
229
|
// Se c'è un handle della cartella: salva direttamente nella cartella selezionata
|
|
@@ -258,7 +255,7 @@ const TMCopyToFolderForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationVi
|
|
|
258
255
|
ShowAlert({ message: SDKUI_Localizator.Error, mode: 'error', duration: 5000, title: SDKUI_Localizator.CompressToZipFile });
|
|
259
256
|
}
|
|
260
257
|
finally {
|
|
261
|
-
|
|
258
|
+
zipPanel.close();
|
|
262
259
|
}
|
|
263
260
|
}
|
|
264
261
|
}
|
|
@@ -388,25 +385,25 @@ const TMCopyToFolderForm = ({ mode, selectedDcmtInfos, onClose, showTMRelationVi
|
|
|
388
385
|
{ value: 'skip', display: SDKUI_Localizator.DoNotCopy },
|
|
389
386
|
{ value: 'rename', display: SDKUI_Localizator.CopyButRename },
|
|
390
387
|
], value: isUsingDefaultDownloads ? 'rename' : settings.fileExistsMode, direction: "row", disabled: isUsingDefaultDownloads, onValueChanged: (value) => updateSettings('fileExistsMode', value), fontSize: '0.9rem' }) }), isUsingDefaultDownloads && (_jsx("span", { style: { fontSize: '0.8rem', color: '#888', fontStyle: 'italic', marginTop: '4px', display: 'block' }, children: SDKUI_Localizator.BrowserAutoRenamesDuplicateFilesInDownloadsFolder }))] }) }), fileNamingRow, formatSelectorsRow] })), settings.exportMode === 'zip' && (_jsxs("div", { style: { display: 'flex', flexWrap: 'wrap', columnGap: '10px' }, children: [_jsxs("div", { style: { display: 'flex', flexWrap: 'wrap', columnGap: '10px', width: '100%' }, children: [folderSelector, _jsx("div", { style: { flex: '1 1 280px', minWidth: '280px' }, children: _jsx(TMTextBox, { label: SDKUI_Localizator.ZipFileName, value: settings.zipFileName, validationItems: zipValidationItems, autoComplete: "one-time-code", onValueChanged: (e) => updateSettings('zipFileName', e.target.value) }) }), _jsx("div", { style: { flex: '1 1 280px', minWidth: '280px' }, children: _jsx(TMTextBox, { label: SDKUI_Localizator.ProtectWithPasswordOptional, value: settings.zipPassword, type: "password", autoComplete: "one-time-code", onValueChanged: (e) => updateSettings('zipPassword', e.target.value) }) })] }), fileNamingRow, formatSelectorsRow] }))] })] }));
|
|
391
|
-
return (_jsx(
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
388
|
+
return (_jsx(TMModal, { width: calcResponsiveSizes(deviceType, showTMRelationViewer ? '95%' : '950px', '95%', '95%'), height: showTMRelationViewer ? '95%' : 'auto', title: getTitle(), onClose: onClose, showCloseButton: true, children: _jsxs("div", { onContextMenu: (e) => e.preventDefault(), style: { display: 'flex', flexDirection: 'column', padding: '4px 4px 16px 4px', width: '100%', height: '100%', boxSizing: 'border-box', overflow: 'hidden' }, children: [showTMRelationViewer ? (_jsx("div", { style: { flex: 1, minHeight: 0, display: 'flex', flexDirection: 'column' }, children: _jsxs(TMSplitterLayout, { direction: 'vertical', showSeparator: true, separatorSize: 8, separatorColor: 'transparent', separatorActiveColor: 'transparent', overflow: 'hidden', min: ["50", "50"], start: ['65%', '35%'], children: [_jsx(TMDownloadRelationViewerSection, { selectedDcmtInfos: selectedDcmtInfos, onSelectionChanged: setSelectedItemsRelationViewer, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), configSection] }, "TMCopyToFolder-relation-config") })) : (configSection), _jsx("div", { style: { display: 'flex', justifyContent: 'center', alignItems: 'center', flexShrink: 0, marginTop: '12px' }, children: _jsxs("button", { disabled: !isFormValid() || (showTMRelationViewer && selectedItemsRelationViewer.filter(i => i.isDcmt).length === 0), onClick: run, style: {
|
|
389
|
+
display: 'flex',
|
|
390
|
+
alignItems: 'center',
|
|
391
|
+
justifyContent: 'center',
|
|
392
|
+
gap: '6px',
|
|
393
|
+
padding: '8px 20px',
|
|
394
|
+
fontSize: '0.95rem',
|
|
395
|
+
fontWeight: 600,
|
|
396
|
+
color: '#fff',
|
|
397
|
+
background: (!isFormValid() || (showTMRelationViewer && selectedItemsRelationViewer.filter(i => i.isDcmt).length === 0))
|
|
398
|
+
? '#b0b0b0'
|
|
399
|
+
: 'linear-gradient(135deg, #28a745 0%, #218838 100%)',
|
|
400
|
+
border: 'none',
|
|
401
|
+
borderRadius: '6px',
|
|
402
|
+
cursor: (!isFormValid() || (showTMRelationViewer && selectedItemsRelationViewer.filter(i => i.isDcmt).length === 0)) ? 'not-allowed' : 'pointer',
|
|
403
|
+
boxShadow: (!isFormValid() || (showTMRelationViewer && selectedItemsRelationViewer.filter(i => i.isDcmt).length === 0))
|
|
404
|
+
? 'none'
|
|
405
|
+
: '0 2px 8px rgba(40, 167, 69, 0.35)',
|
|
406
|
+
transition: 'all 0.2s ease',
|
|
407
|
+
}, children: [_jsx(IconPlay, {}), _jsx("span", { children: SDKUI_Localizator.Execute })] }) })] }) }));
|
|
411
408
|
};
|
|
412
409
|
export default TMCopyToFolderForm;
|