@topconsultnpm/sdkui-react 6.20.0-dev3.2 → 6.20.0-dev3.20
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/TMPopUp.js +4 -0
- package/lib/components/base/TMTreeView.js +12 -8
- package/lib/components/choosers/TMDataListItemChooser.js +1 -1
- package/lib/components/choosers/TMDataListItemFields.js +1 -1
- package/lib/components/choosers/TMDataListItemPicker.d.ts +1 -0
- package/lib/components/choosers/TMDataListItemPicker.js +5 -1
- package/lib/components/choosers/TMUserChooser.js +1 -1
- package/lib/components/editors/TMMetadataValues.js +200 -40
- package/lib/components/editors/TMTextArea.d.ts +1 -0
- package/lib/components/editors/TMTextArea.js +6 -6
- package/lib/components/features/archive/TMArchive.d.ts +1 -0
- package/lib/components/features/archive/TMArchive.js +2 -2
- package/lib/components/features/documents/TMDcmtForm.js +12 -3
- package/lib/components/features/documents/TMFileUploader.d.ts +1 -0
- package/lib/components/features/documents/TMFileUploader.js +19 -8
- package/lib/components/features/documents/TMMasterDetailDcmts.js +25 -63
- package/lib/components/features/documents/TMRelationViewer.js +109 -40
- package/lib/components/features/search/TMSearchQueryPanel.js +3 -3
- package/lib/components/features/search/TMSearchResult.js +5 -13
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +1 -1
- package/lib/components/features/search/TMSearchResultsMenuItems.js +4 -16
- package/lib/components/features/search/TMSignatureInfoContent.js +10 -6
- package/lib/components/features/search/TMTreeSelector.js +1 -1
- package/lib/components/features/tasks/TMTaskFormUtils.js +1 -1
- package/lib/components/features/workflow/TMWorkflowPopup.js +9 -19
- package/lib/components/features/workflow/diagram/DiagramItemForm.d.ts +2 -0
- package/lib/components/features/workflow/diagram/DiagramItemForm.js +32 -25
- package/lib/components/features/workflow/diagram/RecipientList.d.ts +3 -1
- package/lib/components/features/workflow/diagram/RecipientList.js +13 -9
- package/lib/components/features/workflow/diagram/WFDiagram.js +29 -2
- package/lib/components/features/workflow/diagram/workflowHelpers.js +31 -19
- package/lib/components/grids/TMRecentsManager.js +1 -1
- package/lib/components/viewers/TMMidViewer.js +2 -1
- package/lib/components/viewers/TMTidViewer.js +2 -1
- package/lib/helper/SDKUI_Globals.d.ts +4 -0
- package/lib/helper/SDKUI_Globals.js +9 -1
- package/lib/helper/SDKUI_Localizator.d.ts +12 -4
- package/lib/helper/SDKUI_Localizator.js +104 -24
- package/lib/helper/TMUtils.d.ts +9 -41
- package/lib/helper/TMUtils.js +79 -167
- package/lib/hooks/useDataUserIdItem.js +2 -2
- package/package.json +1 -1
- package/lib/components/features/search/TMSignSettingsForm.d.ts +0 -9
- package/lib/components/features/search/TMSignSettingsForm.js +0 -621
package/lib/helper/TMUtils.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import styled from "styled-components";
|
|
3
3
|
import { TMTooltip } from '../components';
|
|
4
4
|
import { IconCADossier, IconKey, IconMenuCAWorkingGroups } from './TMIcons';
|
|
5
|
-
import { AppModules, DataListCacheService, MetadataDataDomains, PdGs } from '@topconsultnpm/sdk-ts';
|
|
5
|
+
import { AppModules, DataListCacheService, LicenseModuleStatus, MetadataDataDomains, PdGs, SDK_Globals } from '@topconsultnpm/sdk-ts';
|
|
6
6
|
import { SDKUI_Localizator } from './SDKUI_Localizator';
|
|
7
7
|
const StyledIconFileContainer = styled.div `
|
|
8
8
|
height: 22px;
|
|
@@ -178,6 +178,15 @@ export const isCreateCertificateEnabled = (widgetsString) => {
|
|
|
178
178
|
export const isPdfEditorEnabled = (widgetsString) => {
|
|
179
179
|
return isWidgetEnabled(PDF_EDITOR_ID, widgetsString);
|
|
180
180
|
};
|
|
181
|
+
/** Verifica se l'editor PDF è disponibile: richiede file PDF, licenza attiva e widget abilitato sul tipo documento. */
|
|
182
|
+
export const isPdfEditorAvailable = (fromDTD, ext) => {
|
|
183
|
+
if (fromDTD === undefined || !fromDTD.widgets || !ext)
|
|
184
|
+
return false;
|
|
185
|
+
if (ext.toLowerCase() !== "pdf")
|
|
186
|
+
return false;
|
|
187
|
+
const isPdfEditorLicensed = SDK_Globals?.license?.dcmtArchiveLicenses?.[0]?.siX_60007?.status === LicenseModuleStatus.Licensed;
|
|
188
|
+
return isPdfEditorLicensed && isPdfEditorEnabled(fromDTD.widgets);
|
|
189
|
+
};
|
|
181
190
|
export const StyledTabItem = styled.div `
|
|
182
191
|
display: flex;
|
|
183
192
|
align-items: center;
|
|
@@ -185,8 +194,9 @@ export const StyledTabItem = styled.div `
|
|
|
185
194
|
border-radius: 8px;
|
|
186
195
|
font-weight: ${({ $isSelected }) => ($isSelected ? 'bold' : 'normal')};
|
|
187
196
|
color: ${({ $isSelected }) => ($isSelected ? '#fff' : '#000')};
|
|
188
|
-
background: ${({ $isSelected }) => $isSelected
|
|
189
|
-
?
|
|
197
|
+
background: ${({ $isSelected, $activeGradient }) => $isSelected
|
|
198
|
+
? ($activeGradient ??
|
|
199
|
+
'linear-gradient(270deg, #46B5A2 16%, #3BAABC 34%, #3BAABC 34%, #3681AD 54%, #3368A5 72%, #2F549D 88%, #304F99 100%)')
|
|
190
200
|
: 'transparent'};
|
|
191
201
|
transition: background-color 0.2s ease;
|
|
192
202
|
font-size: 1rem;
|
|
@@ -215,177 +225,79 @@ export const getPdgsIconMap = (fontSize = 20) => {
|
|
|
215
225
|
[PdGs.WG, _jsx(IconMenuCAWorkingGroups, { color: PDGS_COLORS.WORKING_GROUP, fontSize: 28 }, "PdGs-WG")],
|
|
216
226
|
]);
|
|
217
227
|
};
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
*
|
|
235
|
-
* // 2. "All" - Tutti i campi attivi con valori di default
|
|
236
|
-
* parseSignatureConfiguration(1, "All", "Mario", "Rossi", "Doc1")
|
|
237
|
-
*
|
|
238
|
-
* // 3. "None" - Nessun campo attivo
|
|
239
|
-
* parseSignatureConfiguration(1, "None", "Mario", "Rossi", "Doc1")
|
|
240
|
-
*
|
|
241
|
-
* // 4. Formato con valori espliciti: Key=Value
|
|
242
|
-
* parseSignatureConfiguration(1, "Date=Yes,SignerBy=Mario,Location=Milano,Copyright=TopConsult", ...)
|
|
243
|
-
*
|
|
244
|
-
* // 5. Formato chiavi semplici (attiva i default): key1,key2,key3
|
|
245
|
-
* parseSignatureConfiguration(1, "date,signerby,location", "Mario", "Rossi", "Doc1")
|
|
246
|
-
*
|
|
247
|
-
* // 6. Formato misto
|
|
248
|
-
* parseSignatureConfiguration(1, "date,SignerBy=Yes,Location=Roma", "Mario", "Rossi", "Doc1")
|
|
249
|
-
*/
|
|
250
|
-
export const parseSignatureConfiguration = (did, informationSign, firstName, lastName, title) => {
|
|
251
|
-
try {
|
|
252
|
-
// Rimuove spazi dalla stringa di input mantenendo il case originale
|
|
253
|
-
const signatureSign = informationSign?.trim();
|
|
254
|
-
// Definisce i valori di default per ciascun campo
|
|
255
|
-
const defaultLocationValue = SDKUI_Localizator.Torino;
|
|
256
|
-
const defaultCopyrightValue = "Sign4Top";
|
|
257
|
-
const defaultSignerByValue = `${firstName ?? ''} ${lastName ?? ''}`.trim() || '';
|
|
258
|
-
// Configurazione di default: solo data attiva
|
|
259
|
-
const defaultInfo = {
|
|
260
|
-
allowDate: true,
|
|
261
|
-
allowSignerBy: false,
|
|
262
|
-
signerByValue: defaultSignerByValue,
|
|
263
|
-
allowLocation: false,
|
|
264
|
-
locationValue: defaultLocationValue,
|
|
265
|
-
allowCopyright: false,
|
|
266
|
-
copyrightValue: defaultCopyrightValue
|
|
267
|
-
};
|
|
268
|
-
// Se la stringa è vuota o non definita, ritorna la configurazione di default
|
|
269
|
-
if (!signatureSign || signatureSign.length === 0) {
|
|
270
|
-
return defaultInfo;
|
|
271
|
-
}
|
|
272
|
-
// Caso speciale: "all" attiva tutti i campi con valori di default
|
|
273
|
-
if (signatureSign.toLowerCase() === "all") {
|
|
274
|
-
return {
|
|
275
|
-
allowDate: true,
|
|
276
|
-
allowSignerBy: true,
|
|
277
|
-
signerByValue: defaultSignerByValue,
|
|
278
|
-
allowLocation: true,
|
|
279
|
-
locationValue: defaultLocationValue,
|
|
280
|
-
allowCopyright: true,
|
|
281
|
-
copyrightValue: defaultCopyrightValue
|
|
282
|
-
};
|
|
228
|
+
export const parseSignatureConfiguration = (did, informationSign, title) => {
|
|
229
|
+
const signatureSign = informationSign?.trim() || "";
|
|
230
|
+
if (!signatureSign)
|
|
231
|
+
return {};
|
|
232
|
+
const infoParts = signatureSign.split(',').map(part => part.trim()).filter(Boolean);
|
|
233
|
+
const allowedKeys = ["copyright", "date", "location"];
|
|
234
|
+
const allowedDateValues = ["no", "yes", "true", "false", ""];
|
|
235
|
+
const invalidKeys = [];
|
|
236
|
+
const invalidDateValues = [];
|
|
237
|
+
for (const part of infoParts) {
|
|
238
|
+
const [key, ...valueParts] = part.split("=");
|
|
239
|
+
const currentKey = key.trim().toLowerCase();
|
|
240
|
+
const rawValue = valueParts.join("=").trim();
|
|
241
|
+
const currentValue = rawValue.replace(/^["']|["']$/g, "").toLowerCase();
|
|
242
|
+
if (!allowedKeys.includes(currentKey)) {
|
|
243
|
+
invalidKeys.push(key.trim());
|
|
283
244
|
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
return {
|
|
287
|
-
allowDate: false,
|
|
288
|
-
allowSignerBy: false,
|
|
289
|
-
signerByValue: defaultSignerByValue,
|
|
290
|
-
allowLocation: false,
|
|
291
|
-
locationValue: defaultLocationValue,
|
|
292
|
-
allowCopyright: false,
|
|
293
|
-
copyrightValue: defaultCopyrightValue
|
|
294
|
-
};
|
|
245
|
+
else if (currentKey === "date" && !allowedDateValues.includes(currentValue)) {
|
|
246
|
+
invalidDateValues.push(rawValue);
|
|
295
247
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
248
|
+
}
|
|
249
|
+
if (invalidKeys.length > 0) {
|
|
250
|
+
throw new Error(`${invalidKeys.length > 1 ? 'I parametri' : 'Il parametro'} "${invalidKeys.join('", "')}" non ${invalidKeys.length > 1 ? 'sono riconosciuti' : 'è riconosciuto'} nel campo "informationSign" per il documento "${title || did}". ` +
|
|
251
|
+
`I parametri ammessi sono: ${allowedKeys.join(", ")}. ` +
|
|
252
|
+
`Il valore attuale del campo è "${informationSign}"`);
|
|
253
|
+
}
|
|
254
|
+
if (invalidDateValues.length > 0) {
|
|
255
|
+
throw new Error(`${invalidDateValues.length > 1 ? 'I valori' : 'Il valore'} "${invalidDateValues.join('", "')}" non ${invalidDateValues.length > 1 ? 'sono validi' : 'è valido'} per il parametro "date" nel campo "informationSign" per il documento "${title || did}". ` +
|
|
256
|
+
`I valori ammessi per "date" sono: ${allowedDateValues.filter(v => v).join(", ")}. ` +
|
|
257
|
+
`Il valore attuale del campo è "${informationSign}"`);
|
|
258
|
+
}
|
|
259
|
+
// DEFAULT
|
|
260
|
+
let result = {
|
|
261
|
+
copyright: "",
|
|
262
|
+
date: false,
|
|
263
|
+
location: ""
|
|
264
|
+
};
|
|
265
|
+
const parseBooleanOrValue = (value) => {
|
|
266
|
+
const valueLower = value.toLowerCase();
|
|
267
|
+
if (valueLower === "no" || valueLower === "false")
|
|
268
|
+
return { enabled: false };
|
|
269
|
+
if (valueLower === "yes" || valueLower === "true" || !value)
|
|
270
|
+
return { enabled: true };
|
|
271
|
+
return { enabled: true, customValue: value };
|
|
272
|
+
};
|
|
273
|
+
for (const part of infoParts) {
|
|
274
|
+
const [key, ...valueParts] = part.split("=");
|
|
275
|
+
const currentKey = key.trim().toLowerCase();
|
|
276
|
+
const rawValue = valueParts.join("=").trim();
|
|
277
|
+
const currentValue = rawValue.replace(/^["']|["']$/g, "");
|
|
278
|
+
switch (currentKey) {
|
|
279
|
+
case "date": {
|
|
280
|
+
const parsed = parseBooleanOrValue(currentValue);
|
|
281
|
+
result.date = parsed.enabled;
|
|
282
|
+
break;
|
|
307
283
|
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
}
|
|
315
|
-
// Clone della configurazione di default per la modifica
|
|
316
|
-
const info = { ...defaultInfo };
|
|
317
|
-
// Itera su ogni parte della configurazione
|
|
318
|
-
for (const part of infoParts) {
|
|
319
|
-
const [key, ...valueParts] = part.split("=");
|
|
320
|
-
const currentKey = key.trim().toLowerCase();
|
|
321
|
-
// Ricostruisce il valore nel caso contenga "=" al suo interno
|
|
322
|
-
const rawValue = valueParts.join("=").trim();
|
|
323
|
-
// Rimuove le virgolette dall'inizio e dalla fine del valore
|
|
324
|
-
const currentValue = rawValue.replace(/^["']|["']$/g, "");
|
|
325
|
-
// Helper per gestire i valori booleani e custom
|
|
326
|
-
const parseBooleanOrValue = (value) => {
|
|
327
|
-
const valueLower = value.toLowerCase();
|
|
328
|
-
if (valueLower === "no" || valueLower === "false")
|
|
329
|
-
return { enabled: false };
|
|
330
|
-
if (valueLower === "yes" || valueLower === "true" || !value)
|
|
331
|
-
return { enabled: true };
|
|
332
|
-
return { enabled: true, customValue: value };
|
|
333
|
-
};
|
|
334
|
-
// Processa ciascuna chiave in base al tipo
|
|
335
|
-
if (part.includes("=")) {
|
|
336
|
-
// Formato: Key=Value
|
|
337
|
-
switch (currentKey) {
|
|
338
|
-
case "date":
|
|
339
|
-
// Data supporta solo Yes/No/True/False
|
|
340
|
-
const dateLower = currentValue.toLowerCase();
|
|
341
|
-
info.allowDate = dateLower === "yes" || dateLower === "true";
|
|
342
|
-
break;
|
|
343
|
-
case "signerby": {
|
|
344
|
-
const parsed = parseBooleanOrValue(currentValue);
|
|
345
|
-
info.allowSignerBy = parsed.enabled;
|
|
346
|
-
info.signerByValue = parsed.customValue || defaultSignerByValue;
|
|
347
|
-
break;
|
|
348
|
-
}
|
|
349
|
-
case "location": {
|
|
350
|
-
const parsed = parseBooleanOrValue(currentValue);
|
|
351
|
-
info.allowLocation = parsed.enabled;
|
|
352
|
-
info.locationValue = parsed.customValue || defaultLocationValue;
|
|
353
|
-
break;
|
|
354
|
-
}
|
|
355
|
-
case "copyright": {
|
|
356
|
-
const parsed = parseBooleanOrValue(currentValue);
|
|
357
|
-
info.allowCopyright = parsed.enabled;
|
|
358
|
-
info.copyrightValue = parsed.customValue || defaultCopyrightValue;
|
|
359
|
-
break;
|
|
360
|
-
}
|
|
361
|
-
}
|
|
284
|
+
case "location": {
|
|
285
|
+
const parsed = parseBooleanOrValue(currentValue);
|
|
286
|
+
result.location = parsed.enabled
|
|
287
|
+
? parsed.customValue || ""
|
|
288
|
+
: "";
|
|
289
|
+
break;
|
|
362
290
|
}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
case "signerby":
|
|
370
|
-
info.allowSignerBy = true;
|
|
371
|
-
info.signerByValue = defaultSignerByValue;
|
|
372
|
-
break;
|
|
373
|
-
case "location":
|
|
374
|
-
info.allowLocation = true;
|
|
375
|
-
info.locationValue = defaultLocationValue;
|
|
376
|
-
break;
|
|
377
|
-
case "copyright":
|
|
378
|
-
info.allowCopyright = true;
|
|
379
|
-
info.copyrightValue = defaultCopyrightValue;
|
|
380
|
-
break;
|
|
381
|
-
}
|
|
291
|
+
case "copyright": {
|
|
292
|
+
const parsed = parseBooleanOrValue(currentValue);
|
|
293
|
+
result.copyright = parsed.enabled
|
|
294
|
+
? parsed.customValue || ""
|
|
295
|
+
: "";
|
|
296
|
+
break;
|
|
382
297
|
}
|
|
383
298
|
}
|
|
384
|
-
return info;
|
|
385
|
-
}
|
|
386
|
-
catch (error) {
|
|
387
|
-
throw error;
|
|
388
299
|
}
|
|
300
|
+
return result;
|
|
389
301
|
};
|
|
390
302
|
export const convertSearchResultDescriptorToFileItems = (documents) => {
|
|
391
303
|
const fileItems = [];
|
|
@@ -76,14 +76,14 @@ export const useDataUserIdItem = () => {
|
|
|
76
76
|
return null;
|
|
77
77
|
if (!userId)
|
|
78
78
|
return null;
|
|
79
|
-
return ud ? _jsx(TMUserIcon, { ud: ud }) : _jsx("
|
|
79
|
+
return ud ? _jsx(TMUserIcon, { ud: ud }) : _jsx("span", { title: showTitile ? SDKUI_Localizator.ValueNotPresent : undefined, style: { display: 'inline-flex', alignItems: 'center' }, children: _jsx(IconWarning, { color: TMColors.warning }) });
|
|
80
80
|
};
|
|
81
81
|
const getDescription = () => {
|
|
82
82
|
if (!userId)
|
|
83
83
|
return undefined;
|
|
84
84
|
return ud ? getCompleteUserName(ud.domain, ud.name) : userId.toString() ?? SDKUI_Localizator.NoneSelection;
|
|
85
85
|
};
|
|
86
|
-
return (_jsxs("
|
|
86
|
+
return (_jsxs("span", { style: { display: 'inline-flex', alignItems: 'center', gap: '4px', lineHeight: 1 }, children: [getIcon(), _jsx("span", { style: { lineHeight: 'normal' }, children: getDescription() })] }));
|
|
87
87
|
}, [getUserItem, getCompleteUserName]);
|
|
88
88
|
return {
|
|
89
89
|
loadUsersAsync,
|
package/package.json
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { DcmtTypeDescriptor, SearchResultDescriptor } from "@topconsultnpm/sdk-ts";
|
|
2
|
-
interface TMSignSettingsFormProps {
|
|
3
|
-
fromDTD: DcmtTypeDescriptor;
|
|
4
|
-
inputDcmts: any[];
|
|
5
|
-
onCloseSignSettingsForm: () => void;
|
|
6
|
-
onSavedAsyncCallback: ((tid: number | undefined, did: number | undefined, metadataResult?: SearchResultDescriptor | null) => Promise<void>);
|
|
7
|
-
}
|
|
8
|
-
declare const TMSignSettingsForm: (props: TMSignSettingsFormProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
9
|
-
export default TMSignSettingsForm;
|