@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.
Files changed (44) hide show
  1. package/lib/components/base/TMPopUp.js +4 -0
  2. package/lib/components/base/TMTreeView.js +12 -8
  3. package/lib/components/choosers/TMDataListItemChooser.js +1 -1
  4. package/lib/components/choosers/TMDataListItemFields.js +1 -1
  5. package/lib/components/choosers/TMDataListItemPicker.d.ts +1 -0
  6. package/lib/components/choosers/TMDataListItemPicker.js +5 -1
  7. package/lib/components/choosers/TMUserChooser.js +1 -1
  8. package/lib/components/editors/TMMetadataValues.js +200 -40
  9. package/lib/components/editors/TMTextArea.d.ts +1 -0
  10. package/lib/components/editors/TMTextArea.js +6 -6
  11. package/lib/components/features/archive/TMArchive.d.ts +1 -0
  12. package/lib/components/features/archive/TMArchive.js +2 -2
  13. package/lib/components/features/documents/TMDcmtForm.js +12 -3
  14. package/lib/components/features/documents/TMFileUploader.d.ts +1 -0
  15. package/lib/components/features/documents/TMFileUploader.js +19 -8
  16. package/lib/components/features/documents/TMMasterDetailDcmts.js +25 -63
  17. package/lib/components/features/documents/TMRelationViewer.js +109 -40
  18. package/lib/components/features/search/TMSearchQueryPanel.js +3 -3
  19. package/lib/components/features/search/TMSearchResult.js +5 -13
  20. package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +1 -1
  21. package/lib/components/features/search/TMSearchResultsMenuItems.js +4 -16
  22. package/lib/components/features/search/TMSignatureInfoContent.js +10 -6
  23. package/lib/components/features/search/TMTreeSelector.js +1 -1
  24. package/lib/components/features/tasks/TMTaskFormUtils.js +1 -1
  25. package/lib/components/features/workflow/TMWorkflowPopup.js +9 -19
  26. package/lib/components/features/workflow/diagram/DiagramItemForm.d.ts +2 -0
  27. package/lib/components/features/workflow/diagram/DiagramItemForm.js +32 -25
  28. package/lib/components/features/workflow/diagram/RecipientList.d.ts +3 -1
  29. package/lib/components/features/workflow/diagram/RecipientList.js +13 -9
  30. package/lib/components/features/workflow/diagram/WFDiagram.js +29 -2
  31. package/lib/components/features/workflow/diagram/workflowHelpers.js +31 -19
  32. package/lib/components/grids/TMRecentsManager.js +1 -1
  33. package/lib/components/viewers/TMMidViewer.js +2 -1
  34. package/lib/components/viewers/TMTidViewer.js +2 -1
  35. package/lib/helper/SDKUI_Globals.d.ts +4 -0
  36. package/lib/helper/SDKUI_Globals.js +9 -1
  37. package/lib/helper/SDKUI_Localizator.d.ts +12 -4
  38. package/lib/helper/SDKUI_Localizator.js +104 -24
  39. package/lib/helper/TMUtils.d.ts +9 -41
  40. package/lib/helper/TMUtils.js +79 -167
  41. package/lib/hooks/useDataUserIdItem.js +2 -2
  42. package/package.json +1 -1
  43. package/lib/components/features/search/TMSignSettingsForm.d.ts +0 -9
  44. package/lib/components/features/search/TMSignSettingsForm.js +0 -621
@@ -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
- ? 'linear-gradient(270deg, #46B5A2 16%, #3BAABC 34%, #3BAABC 34%, #3681AD 54%, #3368A5 72%, #2F549D 88%, #304F99 100%)'
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
- * Analizza e configura i parametri delle informazioni di firma per un documento.
220
- *
221
- * @param did - ID del documento
222
- * @param informationSign - Stringa di configurazione della firma
223
- * @param firstName - Nome del firmatario
224
- * @param lastName - Cognome del firmatario
225
- * @param title - Titolo del documento (per messaggi di errore)
226
- *
227
- * @returns Oggetto contenente le configurazioni dei campi della firma
228
- *
229
- * @example
230
- * // Formati supportati:
231
- *
232
- * // 1. Configurazione predefinita (vuoto o undefined): solo data attiva
233
- * parseSignatureConfiguration(1, undefined, "Mario", "Rossi", "Doc1")
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
- // Caso speciale: "none" disattiva tutti i campi
285
- if (signatureSign.toLowerCase() === "none") {
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
- // Chiavi ammesse per la configurazione
297
- const allowedKeys = ["date", "signerby", "location", "copyright"];
298
- // Suddivisione della stringa in parti separate da virgola
299
- const infoParts = signatureSign.split(',').map(part => part.trim()).filter(Boolean);
300
- // Validazione preventiva di tutte le chiavi
301
- const invalidKeys = [];
302
- for (const part of infoParts) {
303
- const [key] = part.split("=");
304
- const currentKey = key.trim().toLowerCase();
305
- if (!allowedKeys.includes(currentKey)) {
306
- invalidKeys.push(key.trim());
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
- // Se ci sono chiavi non valide, lancia un errore unico
310
- if (invalidKeys.length > 0) {
311
- 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}". ` +
312
- `I parametri ammessi sono: ${allowedKeys.join(", ")}. ` +
313
- `Il valore attuale del campo è "${informationSign}"`);
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
- else {
364
- // Formato: Key (attiva il campo con valore di default)
365
- switch (currentKey) {
366
- case "date":
367
- info.allowDate = true;
368
- break;
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("div", { title: showTitile ? SDKUI_Localizator.ValueNotPresent : undefined, children: _jsx(IconWarning, { color: TMColors.warning }) });
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("div", { style: { display: 'flex', alignItems: 'center', gap: '4px' }, children: [getIcon(), _jsx("span", { children: getDescription() })] }));
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.20.0-dev3.2",
3
+ "version": "6.20.0-dev3.20",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -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;