@topconsultnpm/sdkui-react 6.21.0-dev4.12 → 6.21.0-dev4.14
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/styles.d.ts +43 -19
- package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +79 -27
- package/lib/components/base/Styled.d.ts +76 -40
- package/lib/components/base/TMFileManagerUtils.d.ts +6 -2
- package/lib/components/base/TMTreeView.d.ts +5 -3
- package/lib/components/editors/TMEditorStyled.d.ts +42 -10
- package/lib/components/features/documents/TMDcmtPreview.d.ts +5 -3
- package/lib/components/features/documents/TMRelationViewer.d.ts +2 -9
- package/lib/components/features/documents/TMRelationViewer.js +48 -60
- package/lib/components/features/documents/copyAndMergeDcmtsShared.d.ts +4 -3
- package/lib/components/features/documents/copyAndMergeDcmtsShared.js +47 -23
- package/lib/components/features/search/TMSearchQueryPanel.d.ts +3 -3
- package/lib/components/features/workflow/diagram/WorkitemRecipientsEditor.d.ts +1 -1
- package/lib/components/forms/Login/ChangePasswordInputs.d.ts +1 -1
- package/lib/components/layout/panelManager/TMPanelManagerToolbar.d.ts +5 -2
- package/lib/components/query/TMQueryEditor.d.ts +10 -6
- package/lib/components/sidebar/TMCommandsPanel.d.ts +4 -2
- package/lib/components/viewers/TMTidViewer.js +14 -2
- package/lib/helper/SDKUI_Localizator.d.ts +3 -0
- package/lib/helper/SDKUI_Localizator.js +30 -0
- package/lib/helper/TMUtils.d.ts +36 -4
- package/lib/helper/TMUtils.js +104 -1
- package/package.json +1 -1
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, LicenseModuleStatus, MetadataDataDomains, PdGs, SDK_Globals } from '@topconsultnpm/sdk-ts';
|
|
5
|
+
import { AccessLevels, AppModules, DataListCacheService, DcmtTypeListCacheService, LicenseModuleStatus, MetadataDataDomains, PdGs, SDK_Globals, SystemMIDs } from '@topconsultnpm/sdk-ts';
|
|
6
6
|
import { SDKUI_Localizator } from './SDKUI_Localizator';
|
|
7
7
|
/**
|
|
8
8
|
* Estensioni di firma/marca temporale note che possono avvolgere altre estensioni.
|
|
@@ -430,3 +430,106 @@ export const isConvertibleToPdfExt = (ext) => {
|
|
|
430
430
|
'eml', 'msg'
|
|
431
431
|
].includes(normalized);
|
|
432
432
|
};
|
|
433
|
+
/**
|
|
434
|
+
* Restituisce le chiavi dei metadati da visualizzare come descrizione documento.
|
|
435
|
+
* Priorità: 1) SYS_Abstract 2) isSpecialSearchOutput=true 3) primi 5 metadati non di sistema
|
|
436
|
+
*/
|
|
437
|
+
export const buildDcmtDisplayName = (obj) => {
|
|
438
|
+
try {
|
|
439
|
+
if (!obj)
|
|
440
|
+
return [];
|
|
441
|
+
const sysAbstractKey = Object.keys(obj).find(k => k.toUpperCase() === 'SYS_ABSTRACT');
|
|
442
|
+
if (sysAbstractKey) {
|
|
443
|
+
if (obj[sysAbstractKey]?.value) {
|
|
444
|
+
return [sysAbstractKey];
|
|
445
|
+
}
|
|
446
|
+
// SYS_Abstract esiste ma è vuoto: usa DID se presente, altrimenti continua con la logica standard
|
|
447
|
+
const didKey = Object.keys(obj).find(k => k.toUpperCase() === 'DID');
|
|
448
|
+
if (didKey && obj[didKey]?.value) {
|
|
449
|
+
return [didKey];
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
const keys = Object.keys(obj);
|
|
453
|
+
const sysMIDs = Object.values(SystemMIDs).map(o => o.toUpperCase());
|
|
454
|
+
const viewableMetadataKeys = keys.filter(k => obj?.[k]?.value &&
|
|
455
|
+
obj?.[k]?.md?.perm?.canView === AccessLevels.Yes &&
|
|
456
|
+
!sysMIDs.includes(k.toUpperCase()) &&
|
|
457
|
+
k !== "rowIndex" &&
|
|
458
|
+
k !== "ISLEXPROT");
|
|
459
|
+
// Metadati con isSpecialSearchOutput = true
|
|
460
|
+
const specialOutputKeys = viewableMetadataKeys.filter(k => obj?.[k]?.md?.isSpecialSearchOutput === true);
|
|
461
|
+
if (specialOutputKeys.length > 0) {
|
|
462
|
+
return specialOutputKeys;
|
|
463
|
+
}
|
|
464
|
+
if (viewableMetadataKeys.length > 0) {
|
|
465
|
+
return viewableMetadataKeys.slice(0, 5);
|
|
466
|
+
}
|
|
467
|
+
// Fallback: se tutti i metadati personalizzati sono vuoti, usa DID
|
|
468
|
+
const didKey = Object.keys(obj).find(k => k.toUpperCase() === 'DID');
|
|
469
|
+
if (didKey && obj[didKey]?.value) {
|
|
470
|
+
return [didKey];
|
|
471
|
+
}
|
|
472
|
+
return [];
|
|
473
|
+
}
|
|
474
|
+
catch (error) {
|
|
475
|
+
console.error('buildDcmtDisplayName error:', error);
|
|
476
|
+
return [];
|
|
477
|
+
}
|
|
478
|
+
};
|
|
479
|
+
/** Metodo utilizzato per determinare i metadati da visualizzare come descrizione documento */
|
|
480
|
+
export var DcmtDisplayNameMethod;
|
|
481
|
+
(function (DcmtDisplayNameMethod) {
|
|
482
|
+
/** Nessun metadato disponibile */
|
|
483
|
+
DcmtDisplayNameMethod["None"] = "None";
|
|
484
|
+
/** Campo SYS_Abstract presente */
|
|
485
|
+
DcmtDisplayNameMethod["SysAbstract"] = "SysAbstract";
|
|
486
|
+
/** Metadati con isSpecialSearchOutput = true */
|
|
487
|
+
DcmtDisplayNameMethod["SpecialSearchOutput"] = "SpecialSearchOutput";
|
|
488
|
+
/** Primi 5 metadati non di sistema con permesso canView */
|
|
489
|
+
DcmtDisplayNameMethod["FirstViewableMetadata"] = "FirstViewableMetadata";
|
|
490
|
+
})(DcmtDisplayNameMethod || (DcmtDisplayNameMethod = {}));
|
|
491
|
+
/**
|
|
492
|
+
* Analizza un DcmtTypeDescriptor e restituisce la stringa descrittiva del metodo di visualizzazione.
|
|
493
|
+
* Priorità: 1) SYS_Abstract 2) isSpecialSearchOutput=true 3) primi 5 metadati non di sistema (default)
|
|
494
|
+
* Se i metadati non sono presenti nel dtd, li recupera dalla cache.
|
|
495
|
+
*/
|
|
496
|
+
export const getDTDDisplayNameInfo = async (dtd) => {
|
|
497
|
+
try {
|
|
498
|
+
if (!dtd) {
|
|
499
|
+
return SDKUI_Localizator.DisplayNameMethod_Top5;
|
|
500
|
+
}
|
|
501
|
+
// Recupera i metadati dalla cache se non presenti nel dtd
|
|
502
|
+
let metadata = dtd.metadata;
|
|
503
|
+
if (!metadata || metadata.length === 0) {
|
|
504
|
+
const cachedDtd = await DcmtTypeListCacheService.GetAsync(dtd.id);
|
|
505
|
+
metadata = cachedDtd?.metadata;
|
|
506
|
+
}
|
|
507
|
+
if (!metadata || metadata.length === 0) {
|
|
508
|
+
return SDKUI_Localizator.DisplayNameMethod_Top5;
|
|
509
|
+
}
|
|
510
|
+
const sysMIDs = Object.values(SystemMIDs).map(o => o.toUpperCase());
|
|
511
|
+
// 1) Cerca SYS_Abstract
|
|
512
|
+
const sysAbstract = metadata.find(md => md.name?.toUpperCase() === 'SYS_ABSTRACT');
|
|
513
|
+
if (sysAbstract) {
|
|
514
|
+
return SDKUI_Localizator.DisplayNameMethod_Abstract;
|
|
515
|
+
}
|
|
516
|
+
// Filtra metadati non di sistema con permesso canView
|
|
517
|
+
const viewableMetadata = metadata.filter(md => md.perm?.canView === AccessLevels.Yes &&
|
|
518
|
+
md.name &&
|
|
519
|
+
!sysMIDs.includes(md.name.toUpperCase()));
|
|
520
|
+
// 2) Cerca metadati con isSpecialSearchOutput = true
|
|
521
|
+
const specialOutputMetadata = viewableMetadata.filter(md => md.isSpecialSearchOutput === true);
|
|
522
|
+
if (specialOutputMetadata.length > 0) {
|
|
523
|
+
const metadataNames = specialOutputMetadata.map(md => md.nameLoc || md.name).filter(Boolean).join(', ');
|
|
524
|
+
const maxLength = 50;
|
|
525
|
+
const truncatedNames = metadataNames.length > maxLength ? metadataNames.substring(0, maxLength) + '...' : metadataNames;
|
|
526
|
+
return `${SDKUI_Localizator.Search_Special} (${truncatedNames})`;
|
|
527
|
+
}
|
|
528
|
+
// 3) Default: primi 5 metadati non di sistema
|
|
529
|
+
return SDKUI_Localizator.DisplayNameMethod_Top5;
|
|
530
|
+
}
|
|
531
|
+
catch (error) {
|
|
532
|
+
console.error('getDTDDisplayNameInfo error:', error);
|
|
533
|
+
return SDKUI_Localizator.DisplayNameMethod_Top5;
|
|
534
|
+
}
|
|
535
|
+
};
|