@topconsultnpm/sdkui-react 6.20.0 → 6.21.0-dev1.3

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 (35) hide show
  1. package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +7 -1
  2. package/lib/components/base/TMTreeView.d.ts +2 -1
  3. package/lib/components/base/TMTreeView.js +8 -3
  4. package/lib/components/base/TMWaitPanel.js +6 -5
  5. package/lib/components/features/archive/TMArchive.d.ts +1 -1
  6. package/lib/components/features/archive/TMArchive.js +2 -2
  7. package/lib/components/features/documents/TMDcmtBlog.d.ts +1 -0
  8. package/lib/components/features/documents/TMDcmtBlog.js +2 -1
  9. package/lib/components/features/documents/TMDcmtForm.d.ts +42 -34
  10. package/lib/components/features/documents/TMDcmtForm.js +280 -639
  11. package/lib/components/features/documents/TMDcmtFormActionButtons.d.ts +34 -0
  12. package/lib/components/features/documents/TMDcmtFormActionButtons.js +124 -0
  13. package/lib/components/features/documents/TMMasterDetailDcmts.d.ts +27 -2
  14. package/lib/components/features/documents/TMMasterDetailDcmts.js +160 -18
  15. package/lib/components/features/documents/TMRelationViewer.d.ts +6 -0
  16. package/lib/components/features/documents/TMRelationViewer.js +7 -5
  17. package/lib/components/features/search/TMSearch.d.ts +2 -2
  18. package/lib/components/features/search/TMSearch.js +3 -3
  19. package/lib/components/features/search/TMSearchResult.d.ts +27 -26
  20. package/lib/components/features/search/TMSearchResult.js +349 -486
  21. package/lib/components/features/tasks/TMTaskForm.d.ts +2 -1
  22. package/lib/components/features/tasks/TMTaskForm.js +2 -2
  23. package/lib/helper/checkinCheckoutManager.js +6 -2
  24. package/lib/hooks/useCheckInOutOperations.d.ts +7 -6
  25. package/lib/hooks/useCheckInOutOperations.js +9 -16
  26. package/lib/hooks/useDcmtOperations.d.ts +3 -2
  27. package/lib/hooks/useDcmtOperations.js +2 -2
  28. package/lib/hooks/useDocumentOperations.d.ts +139 -0
  29. package/lib/hooks/useDocumentOperations.js +1309 -0
  30. package/lib/hooks/useRelatedDocuments.d.ts +1 -1
  31. package/lib/ts/types.d.ts +2 -1
  32. package/lib/ts/types.js +1 -0
  33. package/package.json +55 -55
  34. package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +0 -11
  35. package/lib/components/features/search/TMSearchResultsMenuItems.js +0 -758
@@ -1,758 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { AccessLevels, AccessLevelsEx, AppModules, FileFormats, LayoutModes, SDK_Globals, DcmtTypeListCacheService } from '@topconsultnpm/sdk-ts';
3
- import { IconActivity, IconArchiveDoc, IconBatchUpdate, IconCheckFile, IconCheckIn, IconCircleInfo, IconCloseCircle, IconConvertFilePdf, IconDelete, IconDotsVerticalCircleOutline, IconDownload, IconEdit, IconExportTo, IconFileDots, IconHide, IconInfo, IconMenuCAArchive, IconPlatform, IconPreview, IconRelation, IconSearch, IconShow, IconStar, IconSubstFile, IconUndo, IconUserGroupOutline, SDKUI_Localizator, searchResultToMetadataValues, IconSignaturePencil, IconArchiveMaster, IconArchiveDetail, IconDetailDcmts, IconPair, IconUnpair, IconSharedDcmt, IconShare, IconCopy, IconMoveToFolder, IconPin, isPdfEditorAvailable } from '../../../helper';
4
- import ShowAlert from '../../base/TMAlert';
5
- import { TMMessageBoxManager, ButtonNames, TMExceptionBoxManager } from '../../base/TMPopUp';
6
- import TMSpinner from '../../base/TMSpinner';
7
- import { DcmtOperationTypes, DownloadTypes, SearchResultContext } from '../../../ts';
8
- import { isXMLFileExt } from '../../../helper/dcmtsHelper';
9
- import { getDcmtCicoStatus } from '../../../helper/checkinCheckoutManager';
10
- import TMSignatureInfoContent from './TMSignatureInfoContent';
11
- const disabledForSingleRow = (selectedItems, focusedItem) => {
12
- // Disabilita se ci sono più item selezionati o se focusedItem non ha TID/DID validi
13
- return selectedItems.length > 1 || focusedItem === undefined || focusedItem.TID === undefined || focusedItem.DID === undefined;
14
- };
15
- const disabledForMultiRow = (selectedItems, focusedItem) => {
16
- // Disabilita se non ci sono selectedItems e focusedItem non ha TID/DID validi
17
- return selectedItems.length === 0 && (focusedItem === undefined || focusedItem.TID === undefined || focusedItem.DID === undefined);
18
- };
19
- const MAX_DCMTS_FOR_SELECTION_REFRESH = 100;
20
- export const getSelectedDcmtsOrFocused = (selectedItems, focusedItem, fileFormat) => {
21
- if (selectedItems.length <= 0 && !focusedItem)
22
- return [];
23
- if (selectedItems.length > 0) {
24
- // Filtra solo gli item che hanno TID e DID validi
25
- return selectedItems
26
- .filter((item) => item.TID !== undefined && item.DID !== undefined)
27
- .map((item) => { return { TID: item.TID, DID: item.DID, FILEEXT: item.FILEEXT, ISSIGNED: Number(item.ISSIGNED ?? 0), fileFormat: fileFormat, rowIndex: item.rowIndex }; });
28
- }
29
- else if (focusedItem !== undefined && focusedItem.TID !== undefined && focusedItem.DID !== undefined) {
30
- return [{ TID: focusedItem.TID, DID: focusedItem.DID, FILEEXT: focusedItem.FILEEXT, ISSIGNED: Number(focusedItem.ISSIGNED ?? 0), fileFormat: fileFormat, rowIndex: focusedItem.rowIndex }];
31
- }
32
- return [];
33
- };
34
- export const getAllFieldSelectedDcmtsOrFocused = (selectedItems, focusedItem, fileFormat) => {
35
- if (selectedItems.length <= 0 && !focusedItem)
36
- return [];
37
- if (selectedItems.length > 0) {
38
- return selectedItems;
39
- }
40
- else if (focusedItem !== undefined) {
41
- return [focusedItem];
42
- }
43
- return [];
44
- };
45
- export const signatureInformationCallback = async (isMobile, inputDcmts) => {
46
- try {
47
- TMSpinner.show({ description: SDKUI_Localizator.Loading });
48
- if (!inputDcmts || inputDcmts.length === 0) {
49
- ShowAlert({
50
- message: SDKUI_Localizator.NoDcmtSelected,
51
- mode: 'warning',
52
- title: SDKUI_Localizator.SignatureInformation,
53
- duration: 3000
54
- });
55
- return;
56
- }
57
- if (inputDcmts.length > 1) {
58
- ShowAlert({
59
- message: "Selezionare un solo documento per visualizzare le informazioni di firma",
60
- mode: 'warning',
61
- title: SDKUI_Localizator.SignatureInformation,
62
- duration: 3000
63
- });
64
- return;
65
- }
66
- TMMessageBoxManager.show({
67
- title: SDKUI_Localizator.SignatureInformation,
68
- buttons: [ButtonNames.OK],
69
- showToppy: false,
70
- resizable: true,
71
- initialWidth: !isMobile ? '700px' : undefined,
72
- message: _jsx(TMSignatureInfoContent, { inputDcmt: inputDcmts[0] })
73
- });
74
- }
75
- catch (error) {
76
- console.error(error);
77
- TMExceptionBoxManager.show({ exception: error });
78
- }
79
- finally {
80
- TMSpinner.hide();
81
- }
82
- };
83
- export const getCommandsMenuItems = (isMobile, dtd, allUsers, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, showSearch, setShowFloatingBar, openFormHandler, openSharedArchiveHandler, showSharedDcmtsHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, onRefreshDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, confirmAttachments, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, openExportForm, handleToggleSearch, handleSignApprove, handleCheckOutOperationCallback, handleCheckInOperationCallback, showCheckoutInformationFormCallback, viewHistoryCallback, copyCheckoutPathToClipboardOperationCallback, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback, archiveMasterDocuments, archiveDetailDocuments, hasMasterRelation, hasDetailRelation, canArchiveMasterRelation, canArchiveDetailRelation, pairManyToManyDocuments, hasManyToManyRelation, pinnedItemIds, onTogglePin) => {
84
- const addPinIconToItems = (items) => {
85
- if (isMobile || !onTogglePin)
86
- return items;
87
- return items.map(item => {
88
- const newItem = { ...item };
89
- if (item.id && item.onClick && !item.submenu) {
90
- newItem.rightIconProps = {
91
- icon: _jsx(IconPin, {}),
92
- activeColor: 'red',
93
- inactiveColor: 'black',
94
- isActive: pinnedItemIds?.includes(item.id) ?? false,
95
- onClick: () => onTogglePin(item.id),
96
- };
97
- }
98
- if (item.submenu && item.submenu.length > 0) {
99
- newItem.submenu = addPinIconToItems(item.submenu);
100
- }
101
- return newItem;
102
- });
103
- };
104
- const addToFavoriteMenuItem = () => {
105
- return {
106
- id: 'fav',
107
- icon: _jsx(IconStar, {}),
108
- name: SDKUI_Localizator.AddTo + ' ' + SDKUI_Localizator.Favorites,
109
- operationType: 'multiRow',
110
- disabled: context === SearchResultContext.FAVORITES_AND_RECENTS || disabledForMultiRow(selectedItems, focusedItem),
111
- onClick: async () => { await runOperationAsync(getSelectedDcmtsOrFocused(selectedItems, focusedItem), DcmtOperationTypes.AddToFavs); onRefreshAfterAddDcmtToFavs?.(); },
112
- };
113
- };
114
- const addReplaceFileMenuItem = () => {
115
- return {
116
- id: 'repl',
117
- icon: _jsx(IconSubstFile, {}),
118
- name: SDKUI_Localizator.AddOrSubstFile,
119
- operationType: 'singleRow',
120
- disabled: dtd?.perm?.canSubstFile !== AccessLevels.Yes ? true : disabledForSingleRow(selectedItems, focusedItem),
121
- onClick: async () => { await runOperationAsync(getSelectedDcmtsOrFocused(selectedItems, focusedItem), DcmtOperationTypes.SubstituteFile, onRefreshDataRowsAsync); }
122
- };
123
- };
124
- const openFormMenuItem = () => {
125
- return {
126
- id: 'open-form',
127
- icon: _jsx(IconPreview, {}),
128
- name: SDKUI_Localizator.OpenForm,
129
- operationType: 'singleRow',
130
- disabled: disabledForSingleRow(selectedItems, focusedItem),
131
- onClick: () => openFormHandler?.(LayoutModes.Update)
132
- };
133
- };
134
- const deletetionMenuItem = () => {
135
- return {
136
- id: 'del',
137
- icon: _jsx(IconDelete, {}),
138
- name: SDKUI_Localizator.Deletion,
139
- operationType: 'multiRow',
140
- disabled: disabledForMultiRow(selectedItems, focusedItem),
141
- submenu: [
142
- {
143
- id: 'del-log',
144
- icon: _jsx(IconDelete, {}),
145
- name: SDKUI_Localizator.LogDelete,
146
- operationType: 'multiRow',
147
- disabled: dtd?.perm?.canLogicalDelete !== AccessLevels.Yes ? true : disabledForMultiRow(selectedItems, focusedItem),
148
- onClick: async () => {
149
- let dcmts = getSelectedDcmtsOrFocused(selectedItems, focusedItem);
150
- await runOperationAsync(dcmts, DcmtOperationTypes.LogDelete, dcmts.length <= MAX_DCMTS_FOR_SELECTION_REFRESH ? onRefreshDataRowsAsync : onRefreshSearchAsync);
151
- }
152
- },
153
- {
154
- id: 'del-rest',
155
- icon: _jsx(IconUndo, {}),
156
- name: SDKUI_Localizator.Restore,
157
- operationType: 'multiRow',
158
- disabled: dtd?.perm?.canLogicalDelete !== AccessLevels.Yes ? true : disabledForMultiRow(selectedItems, focusedItem),
159
- onClick: async () => {
160
- let dcmts = getSelectedDcmtsOrFocused(selectedItems, focusedItem);
161
- await runOperationAsync(dcmts, DcmtOperationTypes.Undelete, dcmts.length <= MAX_DCMTS_FOR_SELECTION_REFRESH ? onRefreshDataRowsAsync : onRefreshSearchAsync);
162
- }
163
- },
164
- {
165
- id: 'del-phys',
166
- icon: _jsx(IconCloseCircle, {}),
167
- name: SDKUI_Localizator.PhysDelete,
168
- operationType: 'multiRow',
169
- disabled: dtd?.perm?.canPhysicalDelete !== AccessLevels.Yes ? true : disabledForMultiRow(selectedItems, focusedItem),
170
- onClick: async () => { await runOperationAsync(getSelectedDcmtsOrFocused(selectedItems, focusedItem), DcmtOperationTypes.PhysDelete, onRefreshSearchAsync); }
171
- },
172
- ]
173
- };
174
- };
175
- const fileCheckMenuItem = () => {
176
- return {
177
- id: 'chk',
178
- icon: _jsx(IconCheckFile, {}),
179
- name: SDKUI_Localizator.FileCheck,
180
- operationType: 'multiRow',
181
- disabled: disabledForMultiRow(selectedItems, focusedItem),
182
- onClick: async () => { await runOperationAsync(getSelectedDcmtsOrFocused(selectedItems, focusedItem), DcmtOperationTypes.CheckFile); }
183
- };
184
- };
185
- const fileConversionsMenuItem = () => {
186
- return {
187
- id: 'conv',
188
- icon: _jsx(IconConvertFilePdf, {}),
189
- name: SDKUI_Localizator.FileConversion,
190
- operationType: 'multiRow',
191
- disabled: disabledForMultiRow(selectedItems, focusedItem),
192
- onClick: async () => {
193
- let format = await confirmFormat();
194
- if (format === FileFormats.None)
195
- return;
196
- let dcmts = getSelectedDcmtsOrFocused(selectedItems, focusedItem, format);
197
- await runOperationAsync(dcmts, DcmtOperationTypes.ConvertFile, dcmts.length <= MAX_DCMTS_FOR_SELECTION_REFRESH ? onRefreshDataRowsAsync : onRefreshSearchAsync);
198
- }
199
- };
200
- };
201
- const createContextualTaskMenuItem = () => {
202
- return {
203
- id: 'task',
204
- icon: _jsx(IconActivity, {}),
205
- name: SDKUI_Localizator.CreateContextualTask,
206
- operationType: 'singleRow',
207
- disabled: disabledForSingleRow(selectedItems, focusedItem),
208
- onClick: () => { openTaskFormHandler(); }
209
- };
210
- };
211
- const downloadFileMenuItem = () => {
212
- return {
213
- id: 'dl',
214
- icon: _jsx(IconDownload, {}),
215
- operationType: 'multiRow',
216
- disabled: dtd?.perm?.canRetrieveFile !== AccessLevels.Yes ? true : disabledForMultiRow(selectedItems, focusedItem),
217
- name: SDKUI_Localizator.DownloadFile, onClick: () => downloadDcmtsAsync(getSelectedDcmtsOrFocused(selectedItems, focusedItem), DownloadTypes.Dcmt, "download", undefined, undefined, true)
218
- };
219
- };
220
- const downloadXMLAttachmentsMenuItem = () => {
221
- return {
222
- id: 'dl-xml',
223
- icon: _jsx(IconDownload, {}),
224
- operationType: 'singleRow',
225
- disabled: !isXMLFileExt(getSelectedDcmtsOrFocused(selectedItems, focusedItem)?.[0]?.FILEEXT) ? true : disabledForSingleRow(selectedItems, focusedItem),
226
- name: SDKUI_Localizator.DownloadXMLAttachments, onClick: () => downloadDcmtsAsync(getSelectedDcmtsOrFocused(selectedItems, focusedItem), DownloadTypes.Attachment, "download", undefined, confirmAttachments, true)
227
- };
228
- };
229
- const duplicateDocumentMenuItem = () => {
230
- return {
231
- id: 'dup',
232
- icon: _jsx(IconArchiveDoc, {}),
233
- name: SDKUI_Localizator.DuplicateDocument,
234
- operationType: 'singleRow',
235
- disabled: dtd?.perm?.canArchive !== AccessLevelsEx.Yes && dtd?.perm?.canArchive !== AccessLevelsEx.Mixed ? true : disabledForSingleRow(selectedItems, focusedItem),
236
- onClick: () => { openFormHandler?.(LayoutModes.Ark); }
237
- };
238
- };
239
- const batchUpdateMenuItem = () => {
240
- return {
241
- id: 'batch',
242
- icon: _jsx(IconBatchUpdate, {}),
243
- name: SDKUI_Localizator.BatchUpdate,
244
- operationType: 'multiRow',
245
- disabled: dtd?.perm?.canUpdate !== AccessLevelsEx.Yes && dtd?.perm?.canUpdate !== AccessLevelsEx.Mixed ? true : disabledForMultiRow(selectedItems, focusedItem),
246
- onClick: () => openBatchUpdateFormHandler?.(true)
247
- };
248
- };
249
- const passToArchive = () => {
250
- return {
251
- id: 'p2a',
252
- icon: _jsx(IconMenuCAArchive, { fontSize: 16, viewBox: '11 11.5 26 27', strokeWidth: 2 }),
253
- name: SDKUI_Localizator.PassToArchive,
254
- operationType: 'singleRow',
255
- disabled: dtd?.perm?.canArchive !== AccessLevelsEx.Yes && dtd?.perm?.canArchive !== AccessLevelsEx.Mixed ? true : disabledForSingleRow(selectedItems, focusedItem),
256
- onClick: async () => {
257
- try {
258
- const item = selectedItems.length === 1 ? selectedItems[0] : focusedItem;
259
- if (!item?.TID || !item?.DID)
260
- return;
261
- TMSpinner.show({ description: SDKUI_Localizator.Loading });
262
- const getMetadataResult = await SDK_Globals.tmSession?.NewSearchEngine().GetMetadataAsync(item.TID, item.DID, true);
263
- const dtdFull = getMetadataResult?.dtdResult;
264
- const rowsFull = dtdFull?.rows ? dtdFull.rows[0] : [];
265
- const midsFull = getMetadataResult?.selectMIDs;
266
- const dtdWithMetadata = await DcmtTypeListCacheService.GetWithNotGrantedAsync(item.TID, item.DID, getMetadataResult);
267
- const allMetadataValues = searchResultToMetadataValues(item.TID, dtdFull, rowsFull, midsFull, dtdWithMetadata?.metadata, LayoutModes.Update);
268
- const outputMids = allMetadataValues
269
- ?.filter(md => md.mid && md.mid > 100 && md.value && md.value.length > 0)
270
- .map(md => ({ mid: md.mid, value: md.value })) || [];
271
- TMSpinner.hide();
272
- passToArchiveCallback?.(outputMids, item.TID);
273
- }
274
- catch (error) {
275
- TMSpinner.hide();
276
- TMExceptionBoxManager.show({ exception: error });
277
- }
278
- }
279
- };
280
- };
281
- const pdfEditorMenuItem = (openEditPdfCallback) => {
282
- // Get the currently selected or focused documents
283
- const selectedDocs = getSelectedDcmtsOrFocused(selectedItems, focusedItem);
284
- // Take the first document (used for validation checks)
285
- const firstDoc = selectedDocs?.[0];
286
- // Check if the selected document is a PDF
287
- const isPdf = firstDoc?.FILEEXT?.toLowerCase() === "pdf";
288
- // Check if the document has been signed
289
- const isSigned = firstDoc?.ISSIGNED === 1;
290
- // Check if the user has permission to substitute files
291
- const canSubstitute = dtd?.perm?.canSubstFile === AccessLevels.Yes;
292
- // Determine whether the menu item should be disabled
293
- const isDisabled = !canSubstitute || disabledForSingleRow(selectedItems, focusedItem) || !isPdf || isSigned;
294
- return {
295
- id: 'pdf-ed',
296
- icon: _jsx(IconEdit, {}),
297
- name: "PDF Editor",
298
- operationType: 'singleRow',
299
- disabled: isDisabled,
300
- onClick: () => openEditPdfCallback(getSelectedDcmtsOrFocused(selectedItems, focusedItem)),
301
- };
302
- };
303
- const signatureMenuItem = () => {
304
- return {
305
- id: 'sign',
306
- icon: _jsx(IconSignaturePencil, {}),
307
- name: SDKUI_Localizator.Signature,
308
- disabled: disabledForSingleRow(selectedItems, focusedItem) && disabledForMultiRow(selectedItems, focusedItem),
309
- submenu: [
310
- {
311
- id: 'sign-do',
312
- icon: _jsx(IconSignaturePencil, {}),
313
- operationType: 'singleRow',
314
- disabled: disabledForSingleRow(selectedItems, focusedItem),
315
- name: SDKUI_Localizator.Signature,
316
- onClick: handleSignApprove
317
- },
318
- {
319
- id: 'sign-info',
320
- icon: _jsx(IconCircleInfo, {}),
321
- name: SDKUI_Localizator.SignatureInformation,
322
- operationType: 'singleRow',
323
- disabled: disabledForSingleRow(selectedItems, focusedItem),
324
- onClick: () => signatureInformationCallback(isMobile, getSelectedDcmtsOrFocused(selectedItems, focusedItem))
325
- },
326
- {
327
- id: 'sign-verify',
328
- icon: _jsx(IconCheckIn, {}),
329
- name: SDKUI_Localizator.VerifySignature,
330
- operationType: 'multiRow',
331
- disabled: disabledForMultiRow(selectedItems, focusedItem),
332
- onClick: async () => { await runOperationAsync(getSelectedDcmtsOrFocused(selectedItems, focusedItem), DcmtOperationTypes.VerifySign); }
333
- },
334
- ]
335
- };
336
- };
337
- const checkinMenuItem = () => {
338
- // Get the currently selected or focused documents
339
- const selectedDocs = getAllFieldSelectedDcmtsOrFocused(selectedItems, focusedItem);
340
- // Take the first document (used for validation checks)
341
- const firstDoc = selectedDocs?.[0];
342
- const { cicoEnabled, checkoutStatus } = getDcmtCicoStatus(firstDoc, allUsers, dtd);
343
- return {
344
- id: 'cico',
345
- icon: _jsx(IconFileDots, {}),
346
- name: "Check in/Check out",
347
- disabled: firstDoc === undefined || disabledForSingleRow(selectedItems, focusedItem),
348
- submenu: [
349
- {
350
- id: 'co',
351
- icon: _jsx("span", { style: { fontSize: '18px' }, className: "dx-icon-edit" }),
352
- name: 'Check out',
353
- disabled: !cicoEnabled || checkoutStatus.isCheckedOut || disabledForSingleRow(selectedItems, focusedItem),
354
- onClick: () => handleCheckOutOperationCallback(true),
355
- },
356
- {
357
- id: 'ci',
358
- icon: _jsx("span", { style: { fontSize: '18px' }, className: "dx-icon-unlock" }),
359
- name: 'Check in',
360
- onClick: () => handleCheckInOperationCallback(),
361
- disabled: !cicoEnabled || !checkoutStatus.isCheckedOut || checkoutStatus.mode === 'lockMode' || disabledForSingleRow(selectedItems, focusedItem)
362
- },
363
- {
364
- id: 'co-cancel',
365
- icon: _jsx("span", { style: { fontSize: '18px' }, className: "dx-icon-remove" }),
366
- name: SDKUI_Localizator.CancelCheckOut,
367
- disabled: !cicoEnabled || !checkoutStatus.isCheckedOut || checkoutStatus.mode === 'lockMode' || disabledForSingleRow(selectedItems, focusedItem),
368
- onClick: () => handleCheckOutOperationCallback(false),
369
- },
370
- {
371
- id: 'co-info',
372
- icon: _jsx("span", { style: { fontSize: '18px' }, className: "dx-icon-info" }),
373
- name: SDKUI_Localizator.CheckoutInfo,
374
- onClick: showCheckoutInformationFormCallback,
375
- disabled: !checkoutStatus.isCheckedOut || disabledForSingleRow(selectedItems, focusedItem)
376
- },
377
- {
378
- id: 'co-path',
379
- icon: _jsx("span", { style: { fontSize: '18px' }, className: "dx-icon-copy" }),
380
- name: SDKUI_Localizator.CopyCheckoutPath,
381
- onClick: copyCheckoutPathToClipboardOperationCallback,
382
- disabled: !checkoutStatus.isCheckedOut || disabledForSingleRow(selectedItems, focusedItem)
383
- },
384
- {
385
- id: 'co-hist',
386
- icon: _jsx("span", { style: { fontSize: '18px' }, className: "dx-icon-clock" }),
387
- name: SDKUI_Localizator.History,
388
- disabled: !cicoEnabled || disabledForSingleRow(selectedItems, focusedItem),
389
- onClick: viewHistoryCallback,
390
- },
391
- ]
392
- };
393
- };
394
- const relationsMenuItem = () => {
395
- return {
396
- id: 'rel',
397
- icon: _jsx(IconRelation, {}),
398
- name: SDKUI_Localizator.Relations,
399
- operationType: 'multiRow',
400
- disabled: disabledForMultiRow(selectedItems, focusedItem),
401
- submenu: [
402
- {
403
- id: 'rel-pair',
404
- icon: _jsx(IconPair, {}),
405
- name: SDKUI_Localizator.MatchManyDocumentsManyToMany,
406
- operationType: 'multiRow',
407
- disabled: !hasManyToManyRelation || disabledForMultiRow(selectedItems, focusedItem),
408
- onClick: async () => await pairManyToManyDocuments?.(true)
409
- },
410
- {
411
- id: 'rel-unpair',
412
- icon: _jsx(IconUnpair, {}),
413
- name: SDKUI_Localizator.UnmatchManyDocumentsManyToMany,
414
- operationType: 'multiRow',
415
- disabled: !hasManyToManyRelation || disabledForMultiRow(selectedItems, focusedItem),
416
- onClick: async () => await pairManyToManyDocuments?.(false)
417
- },
418
- {
419
- id: 'rel-ark-mst',
420
- icon: _jsx(IconArchiveMaster, {}),
421
- name: SDKUI_Localizator.ArchiveMasterDocument,
422
- operationType: 'multiRow',
423
- beginGroup: true,
424
- disabled: canArchiveMasterRelation !== true,
425
- onClick: async () => await archiveMasterDocuments?.(focusedItem?.TID)
426
- },
427
- {
428
- id: 'rel-ark-det',
429
- icon: _jsx(IconArchiveDetail, {}),
430
- name: SDKUI_Localizator.ArchiveDetailDocument,
431
- operationType: 'multiRow',
432
- disabled: canArchiveDetailRelation !== true,
433
- onClick: async () => await archiveDetailDocuments?.(focusedItem?.TID)
434
- },
435
- {
436
- id: 'rel-mst',
437
- icon: _jsx(IconDetailDcmts, { transform: 'scale(-1, 1)' }),
438
- name: SDKUI_Localizator.DcmtsMaster,
439
- operationType: 'singleRow',
440
- visible: true,
441
- beginGroup: true,
442
- disabled: !hasMasterRelation || disabledForSingleRow(selectedItems, focusedItem),
443
- onClick: () => openMasterDcmtsFormHandler?.(true)
444
- },
445
- {
446
- id: 'rel-det',
447
- icon: _jsx(IconDetailDcmts, {}),
448
- name: SDKUI_Localizator.DcmtsDetail,
449
- operationType: 'multiRow',
450
- disabled: !hasDetailRelation || disabledForMultiRow(selectedItems, focusedItem),
451
- visible: true,
452
- onClick: () => openDetailDcmtsFormHandler?.(true)
453
- }
454
- ]
455
- };
456
- };
457
- const sharedDcmtsMenuItem = () => {
458
- return {
459
- id: 'shr',
460
- icon: _jsx(IconSharedDcmt, {}),
461
- name: SDKUI_Localizator.SharedDocuments,
462
- operationType: 'multiRow',
463
- disabled: disabledForMultiRow(selectedItems, focusedItem),
464
- submenu: [
465
- {
466
- id: 'shr-ark',
467
- icon: _jsx(IconSharedDcmt, {}),
468
- name: SDKUI_Localizator.SharedArchiving,
469
- operationType: 'singleRow',
470
- disabled: disabledForSingleRow(selectedItems, focusedItem),
471
- onClick: async () => { await openSharedArchiveHandler(); }
472
- },
473
- {
474
- id: 'shr-show',
475
- icon: _jsx(IconSharedDcmt, {}),
476
- name: SDKUI_Localizator.ShowSharedDocuments,
477
- operationType: 'multiRow',
478
- disabled: disabledForSingleRow(selectedItems, focusedItem),
479
- onClick: async () => { await showSharedDcmtsHandler(); }
480
- }
481
- ]
482
- };
483
- };
484
- /* const shareMenuItem = (): TMContextMenuItemProps => {
485
- return {
486
- icon: <IconShare />,
487
- name: "Condivisione",
488
- operationType: 'multiRow',
489
- disabled: fromDatagrid ? false : disabledForMultiRow(selectedItems, focusedItem),
490
- submenu: [
491
- {
492
- icon: <IconShare />,
493
- name: "Archiviazione condivisa",
494
- operationType: 'multiRow',
495
- disabled: fromDatagrid ? false : disabledForMultiRow(selectedItems, focusedItem),
496
- onClick: () => ShowAlert({ message: "TODO Archiviazione condivisa", mode: 'info', title: `${"TODO"}`, duration: 3000 })
497
- },
498
- {
499
- icon: <IconSharedDcmt />,
500
- name: "Documenti condivisi",
501
- operationType: 'multiRow',
502
- disabled: fromDatagrid ? false : disabledForMultiRow(selectedItems, focusedItem),
503
- onClick: () => ShowAlert({ message: "TODO Documenti condivisi", mode: 'info', title: `${"TODO"}`, duration: 3000 })
504
- }
505
- ]
506
- }
507
- } */
508
- const fullTextSearchMenuItem = () => {
509
- return {
510
- id: 'ft',
511
- icon: _jsx(IconSearch, {}),
512
- name: SDKUI_Localizator.FullTextSearch,
513
- operationType: 'multiRow',
514
- disabled: disabledForMultiRow(selectedItems, focusedItem),
515
- submenu: [
516
- {
517
- id: 'ft-info',
518
- icon: _jsx(IconInfo, {}),
519
- name: SDKUI_Localizator.IndexingInformation,
520
- operationType: 'singleRow',
521
- disabled: disabledForSingleRow(selectedItems, focusedItem),
522
- onClick: async () => {
523
- try {
524
- TMSpinner.show({ description: `${SDKUI_Localizator.Loading}...` });
525
- let dcmts = getSelectedDcmtsOrFocused(selectedItems, focusedItem);
526
- const msg = await SDK_Globals.tmSession?.NewSearchEngine().FreeSearchGetDcmtInfoAsync(dcmts[0].TID, dcmts[0].DID);
527
- TMMessageBoxManager.show({ buttons: [ButtonNames.OK], message: msg, title: SDKUI_Localizator.IndexingInformation });
528
- }
529
- catch (e) {
530
- TMExceptionBoxManager.show({ exception: e });
531
- }
532
- finally {
533
- TMSpinner.hide();
534
- }
535
- }
536
- },
537
- {
538
- id: 'ft-idx',
539
- icon: _jsx(IconArchiveDoc, {}),
540
- name: SDKUI_Localizator.IndexOrReindex,
541
- operationType: 'multiRow',
542
- disabled: disabledForMultiRow(selectedItems, focusedItem),
543
- onClick: async () => { await runOperationAsync(getSelectedDcmtsOrFocused(selectedItems, focusedItem), DcmtOperationTypes.FreeSearchReindex); }
544
- },
545
- {
546
- id: 'ft-del',
547
- icon: _jsx(IconDelete, {}),
548
- name: SDKUI_Localizator.IndexingDelete,
549
- operationType: 'multiRow',
550
- disabled: disabledForMultiRow(selectedItems, focusedItem),
551
- onClick: async () => { await runOperationAsync(getSelectedDcmtsOrFocused(selectedItems, focusedItem), DcmtOperationTypes.FreeSearchPurge); }
552
- },
553
- ...(focusedItem?.FTExplanations !== undefined
554
- ? [{
555
- id: 'ft-det',
556
- icon: _jsx(IconPlatform, {}),
557
- name: SDKUI_Localizator.ResultDetails,
558
- operationType: 'singleRow',
559
- disabled: disabledForSingleRow(selectedItems, focusedItem),
560
- onClick: () => {
561
- TMMessageBoxManager.show({ buttons: [ButtonNames.OK], message: focusedItem?.FTExplanations, title: "Dettagli del risultato" });
562
- }
563
- }] : []),
564
- ]
565
- };
566
- };
567
- const otherMenuItem = () => {
568
- return {
569
- id: 'oth',
570
- icon: _jsx(IconDotsVerticalCircleOutline, {}),
571
- name: SDKUI_Localizator.Other,
572
- submenu: [
573
- {
574
- id: 'oth-search',
575
- icon: _jsx(IconSearch, {}),
576
- name: showSearch ? SDKUI_Localizator.HideSearch : SDKUI_Localizator.ShowSearch,
577
- disabled: false,
578
- onClick: handleToggleSearch
579
- },
580
- {
581
- id: 'oth-exp',
582
- icon: _jsx(IconExportTo, {}),
583
- name: SDKUI_Localizator.ExportTo,
584
- operationType: 'multiRow',
585
- disabled: false,
586
- onClick: openExportForm
587
- },
588
- // {
589
- // icon: <IconShow />,
590
- // name: "Mostra footer",
591
- // disabled: false,
592
- // onClick: () => ShowAlert({ message: "TODO Mostra footer", mode: 'info', title: `${"TODO"}`, duration: 3000 })
593
- // },
594
- {
595
- id: 'oth-float',
596
- icon: showFloatingBar ? _jsx(IconHide, {}) : _jsx(IconShow, {}),
597
- name: showFloatingBar ? SDKUI_Localizator.HideFloatingBar : SDKUI_Localizator.ShowFloatingBar,
598
- disabled: false,
599
- onClick: () => setShowFloatingBar(!showFloatingBar)
600
- },
601
- // {
602
- // icon: <IconSave />,
603
- // name: "Salva layout",
604
- // disabled: false,
605
- // onClick: () => ShowAlert({ message: "TODO Salva layout", mode: 'info', title: `${"TODO"}`, duration: 3000 })
606
- // },
607
- // {
608
- // icon: <IconSearch />,
609
- // name: "Trova tutti i riferimenti",
610
- // submenu: [
611
- // {
612
- // icon: <IconSearch />,
613
- // name: "Trova tutti i riferimenti",
614
- // disabled: false,
615
- // onClick: () => ShowAlert({ message: "TODO Trova tutti i riferimenti", mode: 'info', title: `${"TODO"}`, duration: 3000 })
616
- // },
617
- // {
618
- // icon: <IconSearch />,
619
- // name: "Trova tutti i riferimenti (anche nello storico)",
620
- // disabled: false,
621
- // onClick: () => ShowAlert({ message: "TODO Trova tutti i riferimenti (anche nello storico)", mode: 'info', title: `${"TODO"}`, duration: 3000 })
622
- // },
623
- // ]
624
- // }
625
- ]
626
- };
627
- };
628
- const shareFromWgMenuItem = () => {
629
- return {
630
- id: 'wg-share',
631
- icon: _jsx(IconShare, {}),
632
- name: SDKUI_Localizator.Share,
633
- visible: workingGroupContext !== undefined && openAddDocumentForm !== undefined,
634
- disabled: workingGroupContext === undefined,
635
- onClick: () => openAddDocumentForm && openAddDocumentForm(),
636
- };
637
- };
638
- const copyFromWgMenuItem = () => {
639
- return {
640
- id: 'wg-copy',
641
- icon: _jsx(IconCopy, {}),
642
- name: SDKUI_Localizator.CopyToDrafts,
643
- operationType: 'multiRow',
644
- visible: openWGsCopyMoveForm !== undefined,
645
- disabled: disabledForMultiRow(selectedItems, focusedItem),
646
- onClick: () => { (dtd && openWGsCopyMoveForm) && openWGsCopyMoveForm('copyToWgDraft', dtd, getSelectedDcmtsOrFocused(selectedItems, focusedItem)); },
647
- };
648
- };
649
- const movetofolderFromWgMenuItem = () => {
650
- return {
651
- id: 'wg-move',
652
- icon: _jsx(IconMoveToFolder, {}),
653
- name: !isMobile ? SDKUI_Localizator.CopyToArchivedDocuments : SDKUI_Localizator.CopyToArchived,
654
- operationType: 'multiRow',
655
- visible: openWGsCopyMoveForm !== undefined,
656
- disabled: disabledForMultiRow(selectedItems, focusedItem),
657
- onClick: () => { (dtd && openWGsCopyMoveForm) && openWGsCopyMoveForm('copyToWgArchivedDoc', dtd, getSelectedDcmtsOrFocused(selectedItems, focusedItem)); },
658
- };
659
- };
660
- const commentFromWgMenuItem = (beginGroup) => {
661
- return {
662
- id: 'wg-cmt',
663
- icon: _jsx("span", { className: "dx-icon-chat" }),
664
- name: SDKUI_Localizator.Comment,
665
- operationType: 'multiRow',
666
- visible: workingGroupContext !== undefined && openCommentFormCallback !== undefined,
667
- disabled: workingGroupContext === undefined || disabledForMultiRow(selectedItems, focusedItem),
668
- onClick: () => openCommentFormCallback && openCommentFormCallback(getSelectedDcmtsOrFocused(selectedItems, focusedItem)),
669
- beginGroup: beginGroup,
670
- };
671
- };
672
- const removeFromWgMenuItem = (name) => {
673
- return {
674
- id: 'wg-rm',
675
- icon: _jsx(IconDelete, {}),
676
- name: name,
677
- operationType: 'multiRow',
678
- visible: workingGroupContext !== undefined,
679
- disabled: workingGroupContext === undefined || disabledForMultiRow(selectedItems, focusedItem),
680
- onClick: async () => {
681
- let dcmts = getSelectedDcmtsOrFocused(selectedItems, focusedItem);
682
- if (workingGroupContext)
683
- dcmts.forEach(dcmt => dcmt.workingGroupId = workingGroupContext.id);
684
- await runOperationAsync(dcmts, DcmtOperationTypes.RemoveFromWorkgroup, onRefreshSearchAsync);
685
- }
686
- };
687
- };
688
- // MENU SPECIFICO ARCHIVED WORKGROUP
689
- const getArchivedWorkgroupMenuItems = () => {
690
- const items = [
691
- addReplaceFileMenuItem(),
692
- openFormMenuItem(),
693
- deletetionMenuItem(),
694
- fileConversionsMenuItem(),
695
- ...(SDK_Globals.tmSession?.SessionDescr?.appModuleID === AppModules.SURFER ? [createContextualTaskMenuItem()] : []),
696
- downloadFileMenuItem(),
697
- shareFromWgMenuItem(),
698
- copyFromWgMenuItem(),
699
- movetofolderFromWgMenuItem(),
700
- commentFromWgMenuItem(false),
701
- removeFromWgMenuItem(SDKUI_Localizator.RemoveFromWorkgroup),
702
- ];
703
- return items.sort((a, b) => a.name.localeCompare(b.name));
704
- };
705
- // MENU STANDARD
706
- const getDefaultMenuItems = () => {
707
- return [
708
- {
709
- id: 'doc',
710
- icon: _jsx(IconFileDots, {}),
711
- name: !isMobile ? SDKUI_Localizator.DocumentOperations : SDKUI_Localizator.Documents,
712
- disabled: disabledForSingleRow(selectedItems, focusedItem) && disabledForMultiRow(selectedItems, focusedItem),
713
- submenu: [
714
- addToFavoriteMenuItem(),
715
- addReplaceFileMenuItem(),
716
- openFormMenuItem(),
717
- deletetionMenuItem(),
718
- fileCheckMenuItem(),
719
- fileConversionsMenuItem(),
720
- ...(SDK_Globals.tmSession?.SessionDescr?.appModuleID === AppModules.SURFER ? [createContextualTaskMenuItem()] : []),
721
- downloadFileMenuItem(),
722
- downloadXMLAttachmentsMenuItem(),
723
- duplicateDocumentMenuItem(),
724
- batchUpdateMenuItem(),
725
- passToArchive(),
726
- ...((isPdfEditorAvailable(dtd, getSelectedDcmtsOrFocused(selectedItems, focusedItem)?.[0]?.FILEEXT) && openEditPdf) ? [pdfEditorMenuItem(openEditPdf)] : []),
727
- ]
728
- },
729
- signatureMenuItem(),
730
- checkinMenuItem(),
731
- relationsMenuItem(),
732
- sharedDcmtsMenuItem(),
733
- // shareMenuItem(),
734
- fullTextSearchMenuItem(),
735
- otherMenuItem(),
736
- {
737
- id: 'wg',
738
- icon: _jsx(IconUserGroupOutline, {}),
739
- name: !isMobile ? SDKUI_Localizator.WorkgroupOperations : SDKUI_Localizator.WorkingGroups,
740
- operationType: 'multiRow',
741
- visible: openWGsCopyMoveForm !== undefined || workingGroupContext !== undefined,
742
- disabled: disabledForMultiRow(selectedItems, focusedItem),
743
- beginGroup: true,
744
- submenu: [
745
- shareFromWgMenuItem(),
746
- copyFromWgMenuItem(),
747
- movetofolderFromWgMenuItem(),
748
- commentFromWgMenuItem(true),
749
- removeFromWgMenuItem(SDKUI_Localizator.Remove)
750
- ]
751
- },
752
- ];
753
- };
754
- if (context === SearchResultContext.ARCHIVED_WORKGROUP) {
755
- return addPinIconToItems(getArchivedWorkgroupMenuItems());
756
- }
757
- return addPinIconToItems(getDefaultMenuItems());
758
- };