@topconsultnpm/sdkui-react 6.21.0-dev4.11 → 6.21.0-dev4.13
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/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/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 +33 -1
- package/lib/helper/TMUtils.js +104 -1
- package/package.json +2 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DcmtTypeDescriptor, SearchResultDescriptor, DataColumnDescriptor } from "@topconsultnpm/sdk-ts";
|
|
3
|
+
import { DcmtMetadataMap } from '../../../helper';
|
|
3
4
|
import { DcmtInfo, MetadataValueDescriptorEx } from '../../../ts';
|
|
4
5
|
import { ITMTreeItem } from '../../base/TMTreeView';
|
|
5
6
|
/**
|
|
@@ -19,7 +20,7 @@ export interface RelationTreeItem extends ITMTreeItem {
|
|
|
19
20
|
isSeparator?: boolean;
|
|
20
21
|
isInfoMessage?: boolean;
|
|
21
22
|
isLogDel?: number;
|
|
22
|
-
values?:
|
|
23
|
+
values?: DcmtMetadataMap;
|
|
23
24
|
searchResult?: SearchResultDescriptor[];
|
|
24
25
|
itemsCount?: number;
|
|
25
26
|
fileExt?: string;
|
|
@@ -131,14 +132,6 @@ export declare const hasDetailRelations: (mTID: number | undefined) => Promise<b
|
|
|
131
132
|
* Check if document type has master relations
|
|
132
133
|
*/
|
|
133
134
|
export declare const hasMasterRelations: (dTID: number | undefined) => Promise<boolean>;
|
|
134
|
-
/**
|
|
135
|
-
* Get metadata keys excluding system metadata
|
|
136
|
-
*/
|
|
137
|
-
export declare const getMetadataKeys: (obj: any) => string[];
|
|
138
|
-
/**
|
|
139
|
-
* Get display value keys for a document (max 5, prioritize SYS_Abstract)
|
|
140
|
-
*/
|
|
141
|
-
export declare const getDcmtDisplayValue: (obj: any) => string[];
|
|
142
135
|
/**
|
|
143
136
|
* Get display value formatted by column type
|
|
144
137
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
3
|
-
import { DcmtTypeListCacheService, SDK_Globals, DataColumnTypes, MetadataFormats,
|
|
4
|
-
import { genUniqueId, IconFolder, IconBackhandIndexPointingRight, IconCircleInfo, getDcmtCicoStatus, IconChevronDown, IconChevronRight, SDKUI_Localizator } from '../../../helper';
|
|
3
|
+
import { DcmtTypeListCacheService, SDK_Globals, DataColumnTypes, MetadataFormats, MetadataDataDomains, RelationCacheService, RelationTypes, UserListCacheService } from "@topconsultnpm/sdk-ts";
|
|
4
|
+
import { genUniqueId, IconFolder, IconBackhandIndexPointingRight, IconCircleInfo, getDcmtCicoStatus, IconChevronDown, IconChevronRight, SDKUI_Localizator, buildDcmtDisplayName } from '../../../helper';
|
|
5
5
|
import ShowAlert from '../../base/TMAlert';
|
|
6
6
|
import TMToppyMessage from '../../../helper/TMToppyMessage';
|
|
7
7
|
import { TMColors } from '../../../utils/theme';
|
|
@@ -43,31 +43,6 @@ const isManyToManyRelation = async (relationID) => {
|
|
|
43
43
|
const rdlManyToMany = allRelations.filter(o => o.relationType == RelationTypes.ManyToMany && o.id === relationID) ?? [];
|
|
44
44
|
return rdlManyToMany.length > 0;
|
|
45
45
|
};
|
|
46
|
-
/**
|
|
47
|
-
* Get metadata keys excluding system metadata
|
|
48
|
-
*/
|
|
49
|
-
export const getMetadataKeys = (obj) => {
|
|
50
|
-
if (!obj)
|
|
51
|
-
return [];
|
|
52
|
-
const keys = Object.keys(obj);
|
|
53
|
-
// Escludi metadati di sistema (MID < 100 che sono uppercase) e altri campi tecnici
|
|
54
|
-
const sysMIDs = Object.values(SystemMIDs).map(o => o.toUpperCase());
|
|
55
|
-
return keys.filter(k => obj?.[k].value && !sysMIDs.includes(k)).filter(o => o !== "rowIndex" && o !== "ISLEXPROT");
|
|
56
|
-
};
|
|
57
|
-
/**
|
|
58
|
-
* Get display value keys for a document (max 5, prioritize SYS_Abstract)
|
|
59
|
-
*/
|
|
60
|
-
export const getDcmtDisplayValue = (obj) => {
|
|
61
|
-
if (!obj)
|
|
62
|
-
return [];
|
|
63
|
-
// Prima cerca SYS_Abstract
|
|
64
|
-
if (obj['SYS_Abstract']?.value) {
|
|
65
|
-
return ['SYS_Abstract'];
|
|
66
|
-
}
|
|
67
|
-
// Altrimenti prendi i primi 5 metadati non di sistema
|
|
68
|
-
const mdKeys = getMetadataKeys(obj);
|
|
69
|
-
return mdKeys.slice(0, 5);
|
|
70
|
-
};
|
|
71
46
|
/**
|
|
72
47
|
* Get display value formatted by column type
|
|
73
48
|
*/
|
|
@@ -115,23 +90,34 @@ export const getDisplayValueByColumn = (col, value) => {
|
|
|
115
90
|
export const searchResultToDataSource = async (searchResult, hideSysMetadata) => {
|
|
116
91
|
const rows = searchResult?.dtdResult?.rows ?? [];
|
|
117
92
|
const tid = searchResult?.fromTID;
|
|
118
|
-
|
|
93
|
+
// IMPORTANT: Pass true to get full metadata with all properties (isSpecialSearchOutput, etc.)
|
|
94
|
+
const dtd = await DcmtTypeListCacheService.GetAsync(tid, true);
|
|
119
95
|
const output = [];
|
|
120
96
|
for (let index = 0; index < rows.length; index++) {
|
|
121
97
|
const item = { rowIndex: index };
|
|
122
98
|
const row = rows[index];
|
|
123
99
|
for (let i = 0; i < row.length; i++) {
|
|
124
|
-
const
|
|
100
|
+
const column = searchResult?.dtdResult?.columns?.[i];
|
|
101
|
+
const mid = Number(column?.extendedProperties?.["MID"] ?? "0");
|
|
125
102
|
if (hideSysMetadata && mid < 100)
|
|
126
103
|
continue;
|
|
127
|
-
|
|
128
|
-
|
|
104
|
+
// For system metadata (MID <= 100), use UPPERCASE caption as key
|
|
105
|
+
// For custom metadata (MID > 100), use caption as key but handle duplicates
|
|
106
|
+
let key = column?.caption ?? '';
|
|
107
|
+
if (mid <= 100) {
|
|
129
108
|
key = key.toUpperCase();
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
// If key already exists with a different MID, append MID to make it unique
|
|
112
|
+
if (item[key] !== undefined && item[key]?.md?.id !== mid) {
|
|
113
|
+
key = `${key}_${mid}`;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
130
116
|
const value = row[i];
|
|
131
117
|
const md = dtd?.metadata?.find(o => o.id == mid);
|
|
132
118
|
item[key] = {
|
|
133
119
|
md: md,
|
|
134
|
-
value: getDisplayValueByColumn(
|
|
120
|
+
value: getDisplayValueByColumn(column, value)
|
|
135
121
|
};
|
|
136
122
|
}
|
|
137
123
|
output.push(item);
|
|
@@ -1126,34 +1112,36 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
|
|
|
1126
1112
|
: defaultDocumentStyle;
|
|
1127
1113
|
const textDecoration = isLogicallyDeleted ? 'line-through' : 'none';
|
|
1128
1114
|
const textColor = isLogicallyDeleted ? 'gray' : undefined;
|
|
1129
|
-
const defaultMetadataContent = item.values && (
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1115
|
+
const defaultMetadataContent = item.values && (() => {
|
|
1116
|
+
const displayKeys = buildDcmtDisplayName(item.values);
|
|
1117
|
+
return (_jsx(StyledDivHorizontal, { style: {
|
|
1118
|
+
fontSize: '1rem',
|
|
1119
|
+
overflow: 'hidden',
|
|
1120
|
+
flex: 1,
|
|
1121
|
+
minWidth: 0,
|
|
1122
|
+
whiteSpace: 'nowrap',
|
|
1123
|
+
textDecoration: textDecoration,
|
|
1124
|
+
color: textColor
|
|
1125
|
+
}, children: displayKeys.map((key, index) => {
|
|
1126
|
+
const md = item.values?.[key]?.md;
|
|
1127
|
+
const value = item.values?.[key]?.value;
|
|
1128
|
+
const isLast = index === displayKeys.length - 1;
|
|
1129
|
+
return (_jsxs(StyledDivHorizontal, { style: {
|
|
1130
|
+
flexShrink: isLast ? 1 : 0,
|
|
1131
|
+
minWidth: isLast ? 0 : 'auto',
|
|
1132
|
+
overflow: isLast ? 'hidden' : 'visible',
|
|
1133
|
+
textDecoration: textDecoration,
|
|
1134
|
+
color: textColor
|
|
1135
|
+
}, children: [index > 0 && _jsx("span", { style: { margin: '0 5px', color: textColor || '#999', textDecoration: textDecoration }, children: "\u2022" }), showMetadataNames && (_jsxs("span", { style: { color: textColor || '#666', marginRight: '5px', textDecoration: textDecoration }, children: [md?.name || key, ":"] })), md?.dataDomain === MetadataDataDomains.DataList ? (_jsx("span", { style: { textDecoration: textDecoration, color: textColor }, children: _jsx(TMDataListItemViewer, { dataListId: md.dataListID, viewMode: md.dataListViewMode, value: value }) })) : md?.dataDomain === MetadataDataDomains.UserID ? (_jsx("span", { style: { textDecoration: textDecoration, color: textColor }, children: _jsx(TMDataUserIdItemViewer, { userId: value, showIcon: true }) })) : (_jsx("span", { style: {
|
|
1136
|
+
fontWeight: 500,
|
|
1137
|
+
overflow: isLast ? 'hidden' : 'visible',
|
|
1138
|
+
textOverflow: isLast ? 'ellipsis' : 'clip',
|
|
1139
|
+
whiteSpace: 'nowrap',
|
|
1140
|
+
textDecoration: textDecoration,
|
|
1141
|
+
color: textColor
|
|
1142
|
+
}, children: value }))] }, `${key}_${index}`));
|
|
1143
|
+
}) }));
|
|
1144
|
+
})();
|
|
1157
1145
|
const metadataContent = customDocumentContent
|
|
1158
1146
|
? customDocumentContent(item, defaultMetadataContent || _jsx(_Fragment, {}))
|
|
1159
1147
|
: defaultMetadataContent;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { MetadataDescriptor } from '@topconsultnpm/sdk-ts';
|
|
2
3
|
import { DcmtInfo } from '../../../ts';
|
|
3
4
|
import { DocumentDownloadSettings, FileNamingMode } from '../../../helper';
|
|
4
5
|
import { IRelatedDcmt } from './TMMasterDetailDcmts';
|
|
@@ -32,9 +33,9 @@ export declare const fileExists: (dirHandle: FileSystemDirectoryHandle, fileName
|
|
|
32
33
|
export declare const generateUniqueFileName: (dirHandle: FileSystemDirectoryHandle, originalName: string) => Promise<string>;
|
|
33
34
|
/** Recupera il nome leggibile del tipo documento (cache) */
|
|
34
35
|
export declare const getTypeName: (tid: number | undefined) => Promise<string>;
|
|
35
|
-
/** Formatta un valore convertendo le date
|
|
36
|
-
export declare const formatMetadataValue: (value: string) => string;
|
|
37
|
-
/** Recupera i metadati filtrati
|
|
36
|
+
/** Formatta un valore convertendo le date secondo il formato specificato in MetadataDescriptor.format */
|
|
37
|
+
export declare const formatMetadataValue: (value: string, md?: MetadataDescriptor) => string;
|
|
38
|
+
/** Recupera i metadati filtrati usando buildDcmtDisplayName, concatenati con separatorChar */
|
|
38
39
|
export declare const getFilteredMetadata: (tid: number, did: number, separatorChar: string) => Promise<string | null>;
|
|
39
40
|
/** Opzioni di naming necessarie per generare il nome del file di destinazione */
|
|
40
41
|
export interface IFileNamingOptions {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DcmtTypeListCacheService, LayoutModes, SDK_Globals } from '@topconsultnpm/sdk-ts';
|
|
2
|
-
import { searchResultToMetadataValues, DocumentDownloadSettings, getFullFileExtension } from '../../../helper';
|
|
1
|
+
import { DcmtTypeListCacheService, LayoutModes, MetadataDataTypes, MetadataFormats, SDK_Globals } from '@topconsultnpm/sdk-ts';
|
|
2
|
+
import { searchResultToMetadataValues, DocumentDownloadSettings, getFullFileExtension, buildDcmtDisplayName } from '../../../helper';
|
|
3
3
|
import { TMColors } from '../../../utils/theme';
|
|
4
4
|
/** Numero minimo di file PDF necessari per poterli unire in un unico documento. */
|
|
5
5
|
export const MIN_PDF_FOR_MERGE = 2;
|
|
@@ -82,7 +82,7 @@ export const sanitizeFileName = (fileName, fallbackName, maxLength = 255) => {
|
|
|
82
82
|
const illegalCharsRegex = /[<>:"/\\|?*]/g;
|
|
83
83
|
const controlCharsRegex = /[\x00-\x1F\x7F]/g;
|
|
84
84
|
let sanitized = fileName
|
|
85
|
-
.replace(illegalCharsRegex, '
|
|
85
|
+
.replace(illegalCharsRegex, '-')
|
|
86
86
|
.replace(controlCharsRegex, '')
|
|
87
87
|
.trim();
|
|
88
88
|
sanitized = sanitized.replace(/[. ]+$/, '');
|
|
@@ -146,27 +146,40 @@ export const getTypeName = async (tid) => {
|
|
|
146
146
|
const foundDtd = typeList.find(dtd => dtd.id?.toString() === tid?.toString());
|
|
147
147
|
return foundDtd?.name ?? String(tid);
|
|
148
148
|
};
|
|
149
|
-
/** Formatta un valore convertendo le date
|
|
150
|
-
export const formatMetadataValue = (value) => {
|
|
149
|
+
/** Formatta un valore convertendo le date secondo il formato specificato in MetadataDescriptor.format */
|
|
150
|
+
export const formatMetadataValue = (value, md) => {
|
|
151
|
+
// Formatta come data solo se il MetadataDescriptor indica tipo DateTime
|
|
152
|
+
if (md?.dataType !== MetadataDataTypes.DateTime) {
|
|
153
|
+
return value;
|
|
154
|
+
}
|
|
151
155
|
const date = new Date(value);
|
|
152
|
-
if (
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
return
|
|
164
|
-
|
|
165
|
-
|
|
156
|
+
if (isNaN(date.getTime())) {
|
|
157
|
+
return value;
|
|
158
|
+
}
|
|
159
|
+
const format = md.format?.format;
|
|
160
|
+
const formatCulture = md.format?.formatCulture ?? window.navigator.language;
|
|
161
|
+
switch (format) {
|
|
162
|
+
case MetadataFormats.ShortDate:
|
|
163
|
+
return date.toLocaleString(formatCulture, formatCulture === "it-IT" ? { year: "numeric", month: "2-digit", day: "2-digit" } : { dateStyle: 'short' });
|
|
164
|
+
case MetadataFormats.ShortTime:
|
|
165
|
+
return date.toLocaleString(formatCulture, { timeStyle: 'short' });
|
|
166
|
+
case MetadataFormats.ShortDateLongTime:
|
|
167
|
+
return date.toLocaleString(formatCulture, formatCulture === "it-IT" ? { year: "numeric", month: "2-digit", day: "2-digit", hour: '2-digit', minute: '2-digit', second: '2-digit' } : { dateStyle: 'short', timeStyle: 'medium' }).replace(',', '');
|
|
168
|
+
case MetadataFormats.ShortDateShortTime:
|
|
169
|
+
return date.toLocaleString(formatCulture, formatCulture === "it-IT" ? { year: "numeric", month: "2-digit", day: "2-digit", hour: '2-digit', minute: '2-digit' } : { dateStyle: 'short', timeStyle: 'short' }).replace(',', '');
|
|
170
|
+
case MetadataFormats.LongDate:
|
|
171
|
+
return date.toLocaleString(formatCulture, { weekday: "long", year: "numeric", month: "long", day: "numeric" });
|
|
172
|
+
case MetadataFormats.LongTime:
|
|
173
|
+
return date.toLocaleString(formatCulture, { timeStyle: 'medium' });
|
|
174
|
+
case MetadataFormats.LongDateLongTime:
|
|
175
|
+
return date.toLocaleString(formatCulture, { weekday: "long", year: "numeric", month: "long", day: "numeric", hour: '2-digit', minute: '2-digit', second: '2-digit' });
|
|
176
|
+
case MetadataFormats.LongDateShortTime:
|
|
177
|
+
return date.toLocaleString(formatCulture, { weekday: "long", year: "numeric", month: "long", day: "numeric", hour: '2-digit', minute: '2-digit' });
|
|
178
|
+
default:
|
|
179
|
+
return date.toLocaleString(formatCulture, formatCulture === "it-IT" ? { year: "numeric", month: "2-digit", day: "2-digit" } : { dateStyle: 'short' });
|
|
166
180
|
}
|
|
167
|
-
return value;
|
|
168
181
|
};
|
|
169
|
-
/** Recupera i metadati filtrati
|
|
182
|
+
/** Recupera i metadati filtrati usando buildDcmtDisplayName, concatenati con separatorChar */
|
|
170
183
|
export const getFilteredMetadata = async (tid, did, separatorChar) => {
|
|
171
184
|
const metadata = await SDK_Globals.tmSession?.NewSearchEngine().GetMetadataAsync(tid, did, true);
|
|
172
185
|
if (!metadata)
|
|
@@ -177,8 +190,18 @@ export const getFilteredMetadata = async (tid, did, separatorChar) => {
|
|
|
177
190
|
const dtdWithMetadata = await DcmtTypeListCacheService.GetWithNotGrantedAsync(tid, did, metadata);
|
|
178
191
|
const mdList = dtdWithMetadata?.metadata ?? [];
|
|
179
192
|
const metadataList = searchResultToMetadataValues(tid, dtdResult, rows, mids, mdList, LayoutModes.Update);
|
|
180
|
-
|
|
181
|
-
|
|
193
|
+
// Converte l'array di MetadataValueDescriptorEx in DcmtMetadataMap per buildDcmtDisplayName
|
|
194
|
+
const metadataMap = Object.fromEntries(metadataList.filter(mvd => mvd.md?.name).map(mvd => [mvd.md.name, { md: mvd.md, value: mvd.value }]));
|
|
195
|
+
// Usa buildDcmtDisplayName per ricavare i nomi dei metadati da visualizzare
|
|
196
|
+
const displayKeys = buildDcmtDisplayName(metadataMap);
|
|
197
|
+
if (displayKeys.length === 0)
|
|
198
|
+
return null;
|
|
199
|
+
return displayKeys
|
|
200
|
+
.map(key => {
|
|
201
|
+
const entry = metadataMap[key];
|
|
202
|
+
return entry?.value ? formatMetadataValue(String(entry.value), entry.md) : null;
|
|
203
|
+
})
|
|
204
|
+
.filter(Boolean)
|
|
182
205
|
.join(separatorChar);
|
|
183
206
|
};
|
|
184
207
|
/** Genera il nome file di destinazione in base alle impostazioni di naming */
|
|
@@ -201,6 +224,7 @@ export const generateTargetFileName = async (file, dcmtInfo, options) => {
|
|
|
201
224
|
case 'onlyCustomMetadata': {
|
|
202
225
|
try {
|
|
203
226
|
const filteredMetadata = await getFilteredMetadata(dcmtInfo.TID, dcmtInfo.DID, separatorChar);
|
|
227
|
+
console.log("filteredMetadata for TID:", dcmtInfo.TID, "DID:", dcmtInfo.DID, "is", filteredMetadata);
|
|
204
228
|
if (filteredMetadata) {
|
|
205
229
|
if (fileNamingMode === 'documentTypeAndCustomMetadata') {
|
|
206
230
|
const typeName = await getTypeName(dcmtInfo.TID);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
|
-
import { IconDcmtType, IconDcmtTypeOnlyMetadata, IconLocked, IconView, isCreateCertificateEnabled, isPdfEditorEnabled, isSign4TopEnabled, LocalizeArchiveConstraints, LocalizeParametricFilterTypes, SDKUI_Localizator, TMImageLibrary } from '../../helper';
|
|
3
|
+
import { getDTDDisplayNameInfo, IconDcmtType, IconDcmtTypeOnlyMetadata, IconLocked, IconView, isCreateCertificateEnabled, isPdfEditorEnabled, isSign4TopEnabled, LocalizeArchiveConstraints, LocalizeParametricFilterTypes, SDKUI_Localizator, TMImageLibrary } from '../../helper';
|
|
4
4
|
import { AccessLevels, AccessLevelsEx, ArchiveConstraints, DcmtTypeListCacheService, OwnershipLevels, ParametricFilterTypes, SDK_Globals, SDK_Localizator, TemplateTIDs } from '@topconsultnpm/sdk-ts';
|
|
5
5
|
import TMSpinner from '../base/TMSpinner';
|
|
6
6
|
import { StyledDivHorizontal, StyledTooltipContainer, StyledTooltipItem, StyledTooltipSeparatorItem } from '../base/Styled';
|
|
@@ -309,6 +309,18 @@ export default TMTidViewer;
|
|
|
309
309
|
export const cellRenderTID = (data, noneSelectionText) => {
|
|
310
310
|
return (_jsx(TMTidViewer, { tid: data.value, noneSelectionText: noneSelectionText }));
|
|
311
311
|
};
|
|
312
|
+
/** Componente per mostrare il metodo di visualizzazione del nome documento (carica i metadati dalla cache se necessario) */
|
|
313
|
+
const TMDisplayNameMethodItem = ({ dtd }) => {
|
|
314
|
+
const [displayNameMethod, setDisplayNameMethod] = useState('...');
|
|
315
|
+
useEffect(() => {
|
|
316
|
+
const fetchDisplayNameMethod = async () => {
|
|
317
|
+
const method = await getDTDDisplayNameInfo(dtd);
|
|
318
|
+
setDisplayNameMethod(method);
|
|
319
|
+
};
|
|
320
|
+
fetchDisplayNameMethod();
|
|
321
|
+
}, [dtd]);
|
|
322
|
+
return _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.DisplayNameMethod}: ${displayNameMethod}` });
|
|
323
|
+
};
|
|
312
324
|
export const renderDTDTooltipContent = (dtd) => {
|
|
313
325
|
const mapAccessLevelToLocalizedString = (level) => {
|
|
314
326
|
if (level === undefined || level === null)
|
|
@@ -343,5 +355,5 @@ export const renderDTDTooltipContent = (dtd) => {
|
|
|
343
355
|
isPdfEditorEnabled(dtd.widgets) ? 'PDFEditor' : null,
|
|
344
356
|
].filter(Boolean);
|
|
345
357
|
return (_jsxs(_Fragment, { children: [_jsx(StyledTooltipSeparatorItem, {}), enabledWidgets.length > 0 && (_jsxs(StyledTooltipItem, { children: ["Widgets: ", enabledWidgets.join(', ')] })), enabledWidgets.length === 0 && (_jsxs(StyledTooltipItem, { children: ["Widgets: ", SDKUI_Localizator.No] }))] }));
|
|
346
|
-
})() : (_jsxs(_Fragment, { children: [_jsx(StyledTooltipSeparatorItem, {}), _jsxs(StyledTooltipItem, { children: ["Widgets: ", SDKUI_Localizator.No] })] }))] })] }));
|
|
358
|
+
})() : (_jsxs(_Fragment, { children: [_jsx(StyledTooltipSeparatorItem, {}), _jsxs(StyledTooltipItem, { children: ["Widgets: ", SDKUI_Localizator.No] })] })), _jsx(StyledTooltipSeparatorItem, {}), _jsx(TMDisplayNameMethodItem, { dtd: dtd })] })] }));
|
|
347
359
|
};
|
|
@@ -203,6 +203,9 @@ export declare class SDKUI_Localizator {
|
|
|
203
203
|
static get DiagramItemTypes_End(): "Ende" | "End" | "Fin" | "Fim" | "Fine";
|
|
204
204
|
static get Disabled(): "Deaktiviert" | "Disabled" | "Deshabilitado" | "Désactivé" | "Desabilitado" | "Disabilitato";
|
|
205
205
|
static get DisplayFormat(): string;
|
|
206
|
+
static get DisplayNameMethod(): string;
|
|
207
|
+
static get DisplayNameMethod_Abstract(): string;
|
|
208
|
+
static get DisplayNameMethod_Top5(): string;
|
|
206
209
|
static get DistinctValues(): "Unterschiedliche Werte" | "Distinct values" | "Valores distintos" | "Valeurs distinctes" | "Valori distinti";
|
|
207
210
|
static get DocumentArchivedSuccessfully(): "Dokument erfolgreich archiviert" | "Document archived successfully" | "Documento archivado con éxito" | "Document archivé avec succès" | "Documento arquivado com sucesso" | "Documento archiviato con successo";
|
|
208
211
|
static get DocumentAttachedSuccessfullyToEmail(): "Dokument erfolgreich zur E-Mail hinzugefügt." | "Document attached successfully to the email." | "Documento adjuntado exitosamente al correo electrónico." | "Document joint avec succès à l'e-mail." | "Documento anexado com sucesso ao e-mail." | "Documento allegato con successo all'email.";
|
|
@@ -1979,6 +1979,36 @@ export class SDKUI_Localizator {
|
|
|
1979
1979
|
default: return "Formato di visualizzazione";
|
|
1980
1980
|
}
|
|
1981
1981
|
}
|
|
1982
|
+
static get DisplayNameMethod() {
|
|
1983
|
+
switch (this._cultureID) {
|
|
1984
|
+
case CultureIDs.De_DE: return "Anzeigemethode";
|
|
1985
|
+
case CultureIDs.En_US: return "Display Method";
|
|
1986
|
+
case CultureIDs.Es_ES: return "Método de visualización";
|
|
1987
|
+
case CultureIDs.Fr_FR: return "Méthode d'affichage";
|
|
1988
|
+
case CultureIDs.Pt_PT: return "Método de exibição";
|
|
1989
|
+
default: return "Metodo di visualizzazione";
|
|
1990
|
+
}
|
|
1991
|
+
}
|
|
1992
|
+
static get DisplayNameMethod_Abstract() {
|
|
1993
|
+
switch (this._cultureID) {
|
|
1994
|
+
case CultureIDs.De_DE: return "Dokumentbeschreibung (SYS_Abstract)";
|
|
1995
|
+
case CultureIDs.En_US: return "Document description (SYS_Abstract)";
|
|
1996
|
+
case CultureIDs.Es_ES: return "Descripción del documento (SYS_Abstract)";
|
|
1997
|
+
case CultureIDs.Fr_FR: return "Description du document (SYS_Abstract)";
|
|
1998
|
+
case CultureIDs.Pt_PT: return "Descrição do documento (SYS_Abstract)";
|
|
1999
|
+
default: return "Descrizione documento (SYS_Abstract)";
|
|
2000
|
+
}
|
|
2001
|
+
}
|
|
2002
|
+
static get DisplayNameMethod_Top5() {
|
|
2003
|
+
switch (this._cultureID) {
|
|
2004
|
+
case CultureIDs.De_DE: return "Erste 5 Metadaten";
|
|
2005
|
+
case CultureIDs.En_US: return "First 5 metadata";
|
|
2006
|
+
case CultureIDs.Es_ES: return "Primeros 5 metadatos";
|
|
2007
|
+
case CultureIDs.Fr_FR: return "5 premières métadonnées";
|
|
2008
|
+
case CultureIDs.Pt_PT: return "Primeiros 5 metadados";
|
|
2009
|
+
default: return "Primi 5 metadati";
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
1982
2012
|
static get DistinctValues() {
|
|
1983
2013
|
switch (this._cultureID) {
|
|
1984
2014
|
case CultureIDs.De_DE: return "Unterschiedliche Werte";
|
package/lib/helper/TMUtils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FileItem } from '../components';
|
|
3
|
-
import { AppModules, DataColumnDescriptor, DcmtTypeDescriptor, PdGs, SearchResultDescriptor } from '@topconsultnpm/sdk-ts';
|
|
3
|
+
import { AppModules, DataColumnDescriptor, DcmtTypeDescriptor, MetadataDescriptor, PdGs, SearchResultDescriptor } from '@topconsultnpm/sdk-ts';
|
|
4
4
|
/**
|
|
5
5
|
* Estensioni di firma/marca temporale note che possono avvolgere altre estensioni.
|
|
6
6
|
* Es: file.pdf.p7m, file.xml.p7m, file.docx.p7m, file.xml.p7m.ts
|
|
@@ -77,4 +77,36 @@ type DcmtFormToolbarVisibility = {
|
|
|
77
77
|
};
|
|
78
78
|
export declare const getDcmtFormToolbarVisibility: (appModuleID: AppModules) => DcmtFormToolbarVisibility;
|
|
79
79
|
export declare const isConvertibleToPdfExt: (ext: string | undefined | null) => boolean;
|
|
80
|
+
/** Valore metadato con descrittore (da searchResultToDataSource) */
|
|
81
|
+
export interface DcmtMetadataValue {
|
|
82
|
+
md?: MetadataDescriptor;
|
|
83
|
+
value: any;
|
|
84
|
+
}
|
|
85
|
+
/** Documento con metadati indicizzati per nome */
|
|
86
|
+
export interface DcmtMetadataMap {
|
|
87
|
+
[key: string]: DcmtMetadataValue;
|
|
88
|
+
rowIndex?: any;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Restituisce le chiavi dei metadati da visualizzare come descrizione documento.
|
|
92
|
+
* Priorità: 1) SYS_Abstract 2) isSpecialSearchOutput=true 3) primi 5 metadati non di sistema
|
|
93
|
+
*/
|
|
94
|
+
export declare const buildDcmtDisplayName: (obj: DcmtMetadataMap | null | undefined) => Array<string>;
|
|
95
|
+
/** Metodo utilizzato per determinare i metadati da visualizzare come descrizione documento */
|
|
96
|
+
export declare enum DcmtDisplayNameMethod {
|
|
97
|
+
/** Nessun metadato disponibile */
|
|
98
|
+
None = "None",
|
|
99
|
+
/** Campo SYS_Abstract presente */
|
|
100
|
+
SysAbstract = "SysAbstract",
|
|
101
|
+
/** Metadati con isSpecialSearchOutput = true */
|
|
102
|
+
SpecialSearchOutput = "SpecialSearchOutput",
|
|
103
|
+
/** Primi 5 metadati non di sistema con permesso canView */
|
|
104
|
+
FirstViewableMetadata = "FirstViewableMetadata"
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Analizza un DcmtTypeDescriptor e restituisce la stringa descrittiva del metodo di visualizzazione.
|
|
108
|
+
* Priorità: 1) SYS_Abstract 2) isSpecialSearchOutput=true 3) primi 5 metadati non di sistema (default)
|
|
109
|
+
* Se i metadati non sono presenti nel dtd, li recupera dalla cache.
|
|
110
|
+
*/
|
|
111
|
+
export declare const getDTDDisplayNameInfo: (dtd: DcmtTypeDescriptor | undefined) => Promise<string>;
|
|
80
112
|
export {};
|
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.slice(0, 5);
|
|
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
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topconsultnpm/sdkui-react",
|
|
3
|
-
"version": "6.21.0-dev4.
|
|
3
|
+
"version": "6.21.0-dev4.13",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"lib"
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@topconsultnpm/sdk-ts": "6.21.0-dev4.
|
|
43
|
+
"@topconsultnpm/sdk-ts": "6.21.0-dev4.3",
|
|
44
44
|
"@zip.js/zip.js": "2.8.26",
|
|
45
45
|
"buffer": "^6.0.3",
|
|
46
46
|
"devextreme": "^25.2.6",
|