@topconsultnpm/sdkui-react 6.19.0-dev2.3 → 6.19.0-dev2.30

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 (100) hide show
  1. package/lib/components/NewComponents/ContextMenu/TMContextMenu.d.ts +4 -0
  2. package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +187 -0
  3. package/lib/components/NewComponents/ContextMenu/hooks.d.ts +11 -0
  4. package/lib/components/NewComponents/ContextMenu/hooks.js +48 -0
  5. package/lib/components/NewComponents/ContextMenu/index.d.ts +2 -0
  6. package/lib/components/NewComponents/ContextMenu/index.js +1 -0
  7. package/lib/components/NewComponents/ContextMenu/styles.d.ts +27 -0
  8. package/lib/components/NewComponents/ContextMenu/styles.js +308 -0
  9. package/lib/components/NewComponents/ContextMenu/types.d.ts +26 -0
  10. package/lib/components/NewComponents/ContextMenu/types.js +1 -0
  11. package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.d.ts +4 -0
  12. package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +370 -0
  13. package/lib/components/NewComponents/FloatingMenuBar/index.d.ts +2 -0
  14. package/lib/components/NewComponents/FloatingMenuBar/index.js +2 -0
  15. package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +38 -0
  16. package/lib/components/NewComponents/FloatingMenuBar/styles.js +267 -0
  17. package/lib/components/NewComponents/FloatingMenuBar/types.d.ts +30 -0
  18. package/lib/components/NewComponents/FloatingMenuBar/types.js +1 -0
  19. package/lib/components/NewComponents/Notification/Notification.d.ts +4 -0
  20. package/lib/components/NewComponents/Notification/Notification.js +60 -0
  21. package/lib/components/NewComponents/Notification/NotificationContainer.d.ts +8 -0
  22. package/lib/components/NewComponents/Notification/NotificationContainer.js +33 -0
  23. package/lib/components/NewComponents/Notification/index.d.ts +2 -0
  24. package/lib/components/NewComponents/Notification/index.js +2 -0
  25. package/lib/components/NewComponents/Notification/styles.d.ts +21 -0
  26. package/lib/components/NewComponents/Notification/styles.js +180 -0
  27. package/lib/components/NewComponents/Notification/types.d.ts +18 -0
  28. package/lib/components/NewComponents/Notification/types.js +1 -0
  29. package/lib/components/base/TMCustomButton.js +79 -26
  30. package/lib/components/base/TMDataGridExportForm.d.ts +1 -1
  31. package/lib/components/base/TMDataGridExportForm.js +9 -3
  32. package/lib/components/base/TMFileManager.js +12 -3
  33. package/lib/components/base/TMFileManagerDataGridView.d.ts +2 -0
  34. package/lib/components/base/TMFileManagerDataGridView.js +11 -2
  35. package/lib/components/base/TMFileManagerThumbnailItems.d.ts +2 -0
  36. package/lib/components/base/TMFileManagerThumbnailItems.js +12 -2
  37. package/lib/components/base/TMFileManagerThumbnailsView.d.ts +2 -0
  38. package/lib/components/base/TMFileManagerThumbnailsView.js +2 -2
  39. package/lib/components/base/TMTooltip.d.ts +1 -1
  40. package/lib/components/base/TMTooltip.js +1 -1
  41. package/lib/components/choosers/TMDcmtTypeChooser.js +2 -2
  42. package/lib/components/choosers/TMMetadataChooser.d.ts +4 -1
  43. package/lib/components/choosers/TMMetadataChooser.js +28 -7
  44. package/lib/components/editors/TMDateBox.d.ts +1 -1
  45. package/lib/components/features/documents/TMDcmtForm.js +312 -56
  46. package/lib/components/features/documents/TMRelationViewer.js +56 -23
  47. package/lib/components/features/search/TMSavedQuerySelector.js +1 -1
  48. package/lib/components/features/search/TMSearch.js +2 -2
  49. package/lib/components/features/search/TMSearchQueryEditor.js +1 -1
  50. package/lib/components/features/search/TMSearchQueryPanel.js +8 -25
  51. package/lib/components/features/search/TMSearchResult.js +91 -10
  52. package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +2 -1
  53. package/lib/components/features/search/TMSearchResultsMenuItems.js +97 -51
  54. package/lib/components/features/tasks/TMTaskForm.js +5 -4
  55. package/lib/components/features/tasks/TMTasksAgenda.js +4 -4
  56. package/lib/components/features/tasks/TMTasksCalendar.js +2 -2
  57. package/lib/components/features/tasks/TMTasksHeader.js +1 -1
  58. package/lib/components/features/tasks/TMTasksUtils.d.ts +2 -1
  59. package/lib/components/features/tasks/TMTasksUtils.js +18 -3
  60. package/lib/components/features/tasks/TMTasksUtilsView.js +26 -4
  61. package/lib/components/features/tasks/TMTasksView.js +12 -6
  62. package/lib/components/features/workflow/TMWorkflowPopup.js +3 -3
  63. package/lib/components/features/workflow/diagram/DiagramItemForm.js +11 -6
  64. package/lib/components/features/workflow/diagram/RecipientList.js +1 -1
  65. package/lib/components/forms/TMResultDialog.js +8 -2
  66. package/lib/components/grids/TMBlogsPost.d.ts +1 -0
  67. package/lib/components/grids/TMBlogsPost.js +20 -4
  68. package/lib/components/grids/TMBlogsPostUtils.js +5 -3
  69. package/lib/components/grids/TMRecentsManager.js +1 -1
  70. package/lib/components/layout/panelManager/TMPanelManagerContainer.d.ts +1 -0
  71. package/lib/components/layout/panelManager/TMPanelManagerContainer.js +2 -2
  72. package/lib/components/layout/panelManager/TMPanelManagerContext.js +0 -1
  73. package/lib/components/layout/panelManager/TMPanelManagerToolbar.js +2 -1
  74. package/lib/components/layout/panelManager/types.d.ts +1 -0
  75. package/lib/components/pages/TMPage.js +1 -1
  76. package/lib/components/query/TMQuerySummary.d.ts +1 -0
  77. package/lib/components/query/TMQuerySummary.js +3 -3
  78. package/lib/components/settings/SettingsAppearance.js +5 -5
  79. package/lib/components/viewers/TMDataListItemViewer.d.ts +1 -1
  80. package/lib/components/viewers/TMMidViewer.d.ts +1 -1
  81. package/lib/components/viewers/TMTidViewer.d.ts +1 -1
  82. package/lib/helper/GlobalStyles.d.ts +2 -0
  83. package/lib/helper/GlobalStyles.js +10 -0
  84. package/lib/helper/Globalization.d.ts +1 -0
  85. package/lib/helper/Globalization.js +30 -0
  86. package/lib/helper/SDKUI_Localizator.d.ts +34 -2
  87. package/lib/helper/SDKUI_Localizator.js +342 -22
  88. package/lib/helper/TMCustomSearchBar.js +1 -1
  89. package/lib/helper/TMIcons.d.ts +2 -1
  90. package/lib/helper/TMIcons.js +4 -1
  91. package/lib/helper/TMUtils.d.ts +1 -4
  92. package/lib/helper/TMUtils.js +18 -23
  93. package/lib/helper/dcmtsHelper.d.ts +2 -1
  94. package/lib/helper/dcmtsHelper.js +19 -13
  95. package/lib/helper/helpers.js +2 -1
  96. package/lib/helper/index.d.ts +1 -0
  97. package/lib/helper/index.js +1 -0
  98. package/lib/hooks/useRelatedDocuments.js +35 -26
  99. package/lib/ts/types.d.ts +1 -1
  100. package/package.json +8 -8
@@ -161,7 +161,7 @@ const TMSearchWhereItemEditor = React.memo(({ whereItem, queryParamsDynDataList,
161
161
  }
162
162
  onValueChanged?.(newValues);
163
163
  };
164
- return (_jsxs(StyledRowItem, { style: { marginBottom: 0 }, children: [showValue1 && _jsx(TMMetadataEditor, { openChooserBySingleClick: openChooserBySingleClick, isSelected: isSelected, tid: whereItem.tid, mid: whereItem.mid, layoutMode: LayoutModes.None, isEditable: isEditableList, value: whereItem.value1, queryOperator: whereItem.operator, queryParamsDynDataList: queryParamsDynDataList, autoFocus: autoFocus ?? false, containerElement: undefined, onValueChanged: (value) => { normalizeValue(value, true); }, onCascadeRefreshDynDataLists: onCascadeRefreshDynDataLists, onCascadeUpdateMIDs: onCascadeUpdateMIDs }), showValue2 && _jsx(TMMetadataEditor, { openChooserBySingleClick: openChooserBySingleClick, isSelected: isSelected, tid: whereItem.tid, mid: whereItem.mid, layoutMode: LayoutModes.None, isEditable: isEditableList, value: whereItem.value2, queryOperator: whereItem.operator, autoFocus: autoFocus ?? false, containerElement: undefined, onValueChanged: (value) => { normalizeValue(value, false); } })] }));
164
+ return (_jsxs(StyledRowItem, { style: { marginBottom: 0, width: '100%' }, children: [showValue1 && _jsx(TMMetadataEditor, { openChooserBySingleClick: openChooserBySingleClick, isSelected: isSelected, tid: whereItem.tid, mid: whereItem.mid, layoutMode: LayoutModes.None, isEditable: isEditableList, value: whereItem.value1, queryOperator: whereItem.operator, queryParamsDynDataList: queryParamsDynDataList, autoFocus: autoFocus ?? false, containerElement: undefined, onValueChanged: (value) => { normalizeValue(value, true); }, onCascadeRefreshDynDataLists: onCascadeRefreshDynDataLists, onCascadeUpdateMIDs: onCascadeUpdateMIDs }), showValue2 && _jsx(TMMetadataEditor, { openChooserBySingleClick: openChooserBySingleClick, isSelected: isSelected, tid: whereItem.tid, mid: whereItem.mid, layoutMode: LayoutModes.None, isEditable: isEditableList, value: whereItem.value2, queryOperator: whereItem.operator, autoFocus: autoFocus ?? false, containerElement: undefined, onValueChanged: (value) => { normalizeValue(value, false); } })] }));
165
165
  });
166
166
  const TMSearchWhereItemCard = React.memo(({ index, whereItem, isSelected, queryParamsDynDataList, showEditor, showCompleteMetadataName, showId, isEditableList, onWhereItemChange, onHideEditor, onCascadeRefreshDynDataLists, onCascadeUpdateMIDs }) => {
167
167
  const [isOpen, setIsOpen] = useState(false);
@@ -317,31 +317,14 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
317
317
  : _jsx(_Fragment, {}) }), children: [_jsx(ConfirmQueryParamsDialog, {}), SQD
318
318
  ? _jsxs("div", { style: { height: '100%', width: '100%', position: 'relative', display: 'flex', flexDirection: 'column', gap: 5 }, children: [showAdvancedSearch
319
319
  ? _jsx(TMQueryEditor, { formMode: FormModes.Update, showToolbar: false, inputData: qd, validateSelect: true, showApply: false, onQDChanged: handleQdChanged })
320
- : _jsx(TMSearchQueryEditor, { qd: qd, dcmtTypesList: dcmtTypesList, isExpertMode: isExpertMode, showAllMdWhere: showAllMdWhere, onQdChanged: handleQdChanged, onFocusedMetadataChanged: setFocusedTidMid, onAdvancedMenuClick: handleAdvancedMenuClick }), _jsx("div", { style: { display: 'flex', justifyContent: 'center', alignItems: 'center', gap: '80px', padding: '15px', position: 'relative' }, children: _jsxs("div", { style: {
321
- display: 'flex',
322
- justifyContent: 'space-between',
323
- alignItems: 'center',
324
- flexWrap: 'wrap',
325
- gap: '10px',
326
- padding: '15px',
327
- width: '100%',
328
- boxSizing: 'border-box'
329
- }, children: [_jsxs("div", { style: {
330
- display: 'flex',
331
- justifyContent: 'center',
332
- alignItems: 'center',
333
- gap: '10px',
334
- flex: '1 1 auto',
335
- minWidth: 0,
336
- }, children: [_jsx(TMButton, { btnStyle: 'advanced', icon: _jsx(IconSearch, {}), showTooltip: false, width: '90px', caption: SDKUI_Localizator.Search, advancedColor: '#4A96D2', onClick: handleSearchButtonClick }), _jsx(TMButton, { width: '90px', btnStyle: 'advanced', advancedType: 'primary', showTooltip: false, caption: SDKUI_Localizator.Clear, icon: _jsx(IconClear, {}), advancedColor: 'white', color: 'primaryOutline', onClick: clearFilters })] }), (!showAdvancedSearch && qd?.where && qd.where.length > initialMaxItems) && (_jsx("div", { style: { flex: '0 0 auto' }, children: _jsx(TMButton, { width: '120px', btnStyle: isMobile ? 'icon' : 'advanced', advancedColor: TMColors.button_primary, caption: captionText, showTooltip: false, icon: isMobile ? (_jsx("div", { style: {
337
- backgroundColor: TMColors.button_primary,
338
- minWidth: '30px',
339
- minHeight: '30px',
340
- borderRadius: '10px',
341
- display: 'flex',
342
- alignItems: 'center',
343
- justifyContent: 'center',
344
- }, children: _jsx("p", { style: { color: 'white', margin: 0 }, children: showAllMdWhere ? `-${diff}` : `+${diff}` }) })) : (_jsx("p", { style: { color: 'white', margin: 0 }, children: showAllMdWhere ? `-${diff}` : `+${diff}` })), onClick: () => setShowAllMdWhere(!showAllMdWhere) }) }))] }) }), showFiltersConfig &&
320
+ : _jsx(TMSearchQueryEditor, { qd: qd, dcmtTypesList: dcmtTypesList, isExpertMode: isExpertMode, showAllMdWhere: showAllMdWhere, onQdChanged: handleQdChanged, onFocusedMetadataChanged: setFocusedTidMid, onAdvancedMenuClick: handleAdvancedMenuClick }), _jsxs("div", { style: {
321
+ display: 'flex',
322
+ flexWrap: 'wrap',
323
+ justifyContent: 'center',
324
+ alignItems: 'center',
325
+ gap: '10px',
326
+ width: '100%'
327
+ }, children: [_jsx(TMButton, { btnStyle: 'advanced', icon: _jsx(IconSearch, {}), showTooltip: false, width: '90px', caption: SDKUI_Localizator.Search, advancedColor: '#4A96D2', onClick: handleSearchButtonClick }), _jsx(TMButton, { width: '90px', btnStyle: 'advanced', advancedType: 'primary', showTooltip: false, caption: SDKUI_Localizator.Clear, icon: _jsx(IconClear, {}), advancedColor: 'white', color: 'primaryOutline', onClick: clearFilters }), (!showAdvancedSearch && qd?.where && qd.where.length > initialMaxItems) && (_jsx(TMButton, { width: '120px', btnStyle: isMobile ? 'icon' : 'advanced', advancedColor: TMColors.button_primary, caption: captionText, showTooltip: false, icon: isMobile ? (_jsx("div", { children: _jsx("p", { children: showAllMdWhere ? `-${diff}` : `+${diff}` }) })) : (_jsx("p", { children: showAllMdWhere ? `-${diff}` : `+${diff}` })), onClick: () => setShowAllMdWhere(!showAllMdWhere) }))] }), showFiltersConfig &&
345
328
  _jsx(TMMetadataChooserForm, { allowMultipleSelection: true, height: '500px', width: '600px', allowSysMetadata: true, qd: qd, selectedIDs: qd?.where?.map((w) => ({ tid: w.tid, mid: w.mid })), onClose: handleCloseFiltersConfig, onChoose: handleChooseFilters }), showOutputConfig &&
346
329
  _jsx(TMMetadataChooserForm, { allowMultipleSelection: true, height: '500px', width: '600px', allowSysMetadata: true, qd: qd, selectedIDs: qd?.select?.map((item) => ({ tid: item.tid, mid: item.mid })), onClose: handleCloseOutputConfig, onChoose: handleChooseOutput }), showOrderByConfig &&
347
330
  _jsx(TMMetadataChooserForm, { allowMultipleSelection: true, height: '500px', width: '600px', allowSysMetadata: true, qd: qd, selectedIDs: qd?.orderBy?.map((item) => ({ tid: item.tid, mid: item.mid })), onClose: handleCloseOrderByConfig, onChoose: handleChooseOrderBy })] })
@@ -1,13 +1,13 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
3
- import { SDK_Globals, DataColumnTypes, MetadataDataDomains, DataListViewModes, MetadataFormats, LayoutModes, TemplateTIDs, DcmtTypeListCacheService, AccessLevels, SystemMIDsAsNumber, RetrieveFileOptions, DcmtOpers, GeneralRetrieveFormats, AccessLevelsEx } from '@topconsultnpm/sdk-ts';
3
+ import { SDK_Globals, DataColumnTypes, MetadataDataDomains, DataListViewModes, MetadataFormats, LayoutModes, TemplateTIDs, DcmtTypeListCacheService, AccessLevels, SystemMIDsAsNumber, RetrieveFileOptions, DcmtOpers, GeneralRetrieveFormats, AccessLevelsEx, ResultTypes, LayoutCacheService } from '@topconsultnpm/sdk-ts';
4
4
  import styled from 'styled-components';
5
5
  import { getCommandsMenuItems, getSelectedDcmtsOrFocused } from './TMSearchResultsMenuItems';
6
- import { genUniqueId, IconShow, IconBoard, IconDcmtTypeSys, IconDetailDcmts, SDKUI_Localizator, IconDelete, IconRefresh, IconMenuVertical, IconDownload, deepCompare, getDataColumnName, searchResultDescriptorToSimpleArray, searchResultToMetadataValues, IconSearchCheck, TMCommandsContextMenu } from '../../../helper';
6
+ import { genUniqueId, IconShow, IconBoard, IconDcmtTypeSys, IconDetailDcmts, SDKUI_Localizator, IconDelete, IconRefresh, IconMenuVertical, IconDownload, deepCompare, getDataColumnName, searchResultDescriptorToSimpleArray, searchResultToMetadataValues, IconSearchCheck, TMCommandsContextMenu, getExceptionMessage, IconCheck, svgToString, TMImageLibrary } from '../../../helper';
7
7
  import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
8
8
  import { useInputAttachmentsDialog, useInputCvtFormatDialog } from '../../../hooks/useInputDialog';
9
9
  import { useRelatedDocuments } from '../../../hooks/useRelatedDocuments';
10
- import { DcmtOperationTypes, FormModes, SearchResultContext, DownloadTypes } from '../../../ts';
10
+ import { DcmtOperationTypes, SearchResultContext, DownloadTypes } from '../../../ts';
11
11
  import { Gutters, TMColors } from '../../../utils/theme';
12
12
  import { StyledModalContainer, StyledBadge, StyledMultiViewPanel } from '../../base/Styled';
13
13
  import TMButton from '../../base/TMButton';
@@ -19,7 +19,6 @@ import TMTooltip from '../../base/TMTooltip';
19
19
  import { TMLayoutWaitingContainer } from '../../base/TMWaitPanel';
20
20
  import { TMUserIdViewer } from '../../choosers/TMUserChooser';
21
21
  import TMMetadataValues from '../../editors/TMMetadataValues';
22
- import { TMSaveFormButtonPrevious, TMSaveFormButtonNext } from '../../forms/TMSaveForm';
23
22
  import TMDataListItemViewer from '../../viewers/TMDataListItemViewer';
24
23
  import TMTidViewer from '../../viewers/TMTidViewer';
25
24
  import TMDcmtPreview from '../documents/TMDcmtPreview';
@@ -42,6 +41,8 @@ import TMChooserForm from '../../forms/TMChooserForm';
42
41
  import TMModal from '../../base/TMModal';
43
42
  import TMSearch from './TMSearch';
44
43
  import TMArchive from '../archive/TMArchive';
44
+ import { TMResultManager } from '../../forms/TMResultDialog';
45
+ import TMCustomButton from '../../base/TMCustomButton';
45
46
  //#region Helper Methods
46
47
  export const getSearchResultCountersSingleCategory = (searchResults) => {
47
48
  // let totDcmtTypes = searchResults.length;
@@ -92,6 +93,8 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
92
93
  const { abortController, showWaitPanel, waitPanelTitle, showPrimary, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, downloadDcmtsAsync, runOperationAsync, getDcmtFileAsync } = useDcmtOperations();
93
94
  const relatedDocuments = useRelatedDocuments({ selectedSearchResult, focusedItem, currentSearchResults });
94
95
  const { relatedDcmts, showRelatedDcmtsChooser, archiveType, isOpenDetails, isOpenMaster, isOpenArchiveRelationForm, archiveRelatedDcmtFormTID, archiveRelatedDcmtFormMids, relatedDcmtsChooserDataSource, showPairDcmtsModal, isPairingManyToMany, pairedSearchResults, manyToManyRelations, selectedManyToManyRelation, showManyToManyChooser, manyToManyChooserDataSource, showPairSearchModal, pairSearchModalTargetTID, pairSearchModalParentTID, pairSearchModalParentDID, pairSearchModalRelation, pairSearchModalInputMids, currentTIDHasDetailRelations, currentTIDHasMasterRelations, canArchiveMasterRelation, canArchiveDetailRelation, hasManyToManyRelation, setIsOpenDetails, setIsOpenMaster, setShowRelatedDcmtsChooser, setShowManyToManyChooser, setShowPairDcmtsModal, setShowPairSearchModal, setIsOpenArchiveRelationForm, setArchiveType, setArchiveRelatedDcmtFormTID, setArchiveRelatedDcmtFormMids, pairFloatingActionConfig, pairSearchModalFloatingActionConfig, archiveMasterDocuments, archiveDetailDocuments, pairManyToMany, checkRelatedDcmtsArchiveCapability, checkManyToManyCapability, archiveRelatedDcmtHandler, executeManyToManyPairing, } = relatedDocuments;
96
+ const [customButtonsLayout, setCustomButtonsLayout] = useState();
97
+ const [customButton, setCustomButton] = useState();
95
98
  const deviceType = useDeviceType();
96
99
  const isMobile = deviceType === DeviceType.MOBILE;
97
100
  const selectedDocs = getSelectedDcmtsOrFocused(selectedItems, focusedItem);
@@ -153,6 +156,13 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
153
156
  fileSize: currentMetadataValues.find(o => o.mid == SystemMIDsAsNumber.FileSize)?.value,
154
157
  fileExt: currentMetadataValues.find(o => o.mid == SystemMIDsAsNumber.FileExt)?.value
155
158
  });
159
+ const fetchLayout = async () => {
160
+ if (currentDcmt?.tid && dcmtFormLayoutMode === LayoutModes.Update) {
161
+ const layoutDescriptor = await LayoutCacheService.GetAsync(currentDcmt?.tid, LayoutModes.None);
162
+ setCustomButtonsLayout(layoutDescriptor);
163
+ }
164
+ };
165
+ fetchLayout();
156
166
  }, [currentMetadataValues]);
157
167
  const openFormHandler = (layoutMode) => {
158
168
  setIsOpenDcmtForm(true);
@@ -296,15 +306,85 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
296
306
  onClose?.();
297
307
  }
298
308
  };
309
+ const customButtonMenuItems = () => {
310
+ const customButtonsItems = customButtonsLayout?.customButtons?.filter((customButton) => customButton.isForSearchResult && customButton.isForSearchResult > 0)
311
+ .map((customButton) => ({
312
+ icon: svgToString(TMImageLibrary({ imageID: customButton.glyphID, showPath: true })),
313
+ text: customButton.title || 'Bottone personalizzato',
314
+ onClick: () => setCustomButton(customButton)
315
+ }));
316
+ return {
317
+ icon: svgToString(_jsx(IconCheck, {})),
318
+ text: SDKUI_Localizator.CustomButtons,
319
+ items: customButtonsItems
320
+ };
321
+ };
299
322
  const onContextMenuPreparing = (e) => {
300
323
  if (e === undefined)
301
324
  return;
302
325
  if (e.target === 'content') {
303
326
  e.items = e.items || [];
304
- const menuItems = getCommandsMenuItems(isMobile, fromDTD, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, showSearch, setShowFloatingBar, openFormHandler, openSharedArchiveHandler, showSharedDcmtsHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, openExportForm, handleToggleSearch, handleSignApprove, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback, archiveMasterDocuments, archiveDetailDocuments, currentTIDHasMasterRelations, currentTIDHasDetailRelations, canArchiveMasterRelation, canArchiveDetailRelation, pairManyToMany, hasManyToManyRelation);
327
+ const menuItems = getCommandsMenuItems(isMobile, fromDTD, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, showSearch, setShowFloatingBar, openFormHandler, openSharedArchiveHandler, showSharedDcmtsHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, openExportForm, handleToggleSearch, handleSignApprove, handleCheckOutOperationCallback, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback, archiveMasterDocuments, archiveDetailDocuments, currentTIDHasMasterRelations, currentTIDHasDetailRelations, canArchiveMasterRelation, canArchiveDetailRelation, pairManyToMany, hasManyToManyRelation);
305
328
  e.items.push(...menuItems);
329
+ e.items.push(customButtonMenuItems());
306
330
  }
307
331
  };
332
+ const handleCheckOutOperationCallback = async (checkout) => {
333
+ const selectedDocs = getSelectedDcmtsOrFocused(selectedItems, focusedItem);
334
+ const firstDoc = selectedDocs?.[0];
335
+ if (!firstDoc)
336
+ return;
337
+ const title = checkout ? 'Check out' : SDKUI_Localizator.CancelCheckOut;
338
+ const msg = checkout ? SDKUI_Localizator.ExecuteCheckOutQuestion : SDKUI_Localizator.ExecuteCancelCheckOutQuestion;
339
+ TMMessageBoxManager.show({
340
+ title: title,
341
+ message: msg,
342
+ buttons: [ButtonNames.YES, ButtonNames.NO],
343
+ onButtonClick: async (e) => {
344
+ let result = [];
345
+ if (e !== ButtonNames.YES)
346
+ return;
347
+ try {
348
+ const ue = SDK_Globals.tmSession?.NewUpdateEngineByID();
349
+ if (ue) {
350
+ ue.TID = firstDoc.TID;
351
+ ue.DID = firstDoc.DID;
352
+ if (checkout) {
353
+ await ue.CheckOutAsync()
354
+ .then(async () => {
355
+ await downloadDcmtsAsync(getSelectedDcmtsOrFocused(selectedItems, focusedItem), DownloadTypes.Dcmt, "download");
356
+ result.push({ rowIndex: 0, id1: firstDoc.TID, id2: firstDoc.DID, description: SDKUI_Localizator.UpdateCompletedSuccessfully, resultType: ResultTypes.SUCCESS });
357
+ // await refreshSelectionDataRowsAsync();
358
+ await refreshFocusedDataRowAsync(firstDoc.TID, firstDoc.DID, true);
359
+ })
360
+ .catch((error) => {
361
+ result.push({ rowIndex: 0, id1: firstDoc.TID, id2: firstDoc.DID, resultType: ResultTypes.ERROR, description: getExceptionMessage(error) });
362
+ throw error;
363
+ });
364
+ }
365
+ else {
366
+ await ue.UndoCheckOutAsync()
367
+ .then(async () => {
368
+ result.push({ rowIndex: 0, id1: firstDoc.TID, id2: firstDoc.DID, description: SDKUI_Localizator.UpdateCompletedSuccessfully, resultType: ResultTypes.SUCCESS });
369
+ // await refreshSelectionDataRowsAsync();
370
+ await refreshFocusedDataRowAsync(firstDoc.TID, firstDoc.DID, true);
371
+ })
372
+ .catch((error) => {
373
+ result.push({ rowIndex: 0, id1: firstDoc.TID, id2: firstDoc.DID, resultType: ResultTypes.ERROR, description: getExceptionMessage(error) });
374
+ throw error;
375
+ });
376
+ }
377
+ }
378
+ }
379
+ catch (error) {
380
+ result.push({ rowIndex: 0, id1: firstDoc.TID, id2: firstDoc.DID, resultType: ResultTypes.ERROR, description: getExceptionMessage(error) });
381
+ }
382
+ finally {
383
+ TMResultManager.show(result, title, "ID", undefined);
384
+ }
385
+ }
386
+ });
387
+ };
308
388
  const refreshDataGridAfterRemoveAsync = async () => {
309
389
  let index = selectedSearchResult?.dtdResult?.columns?.findIndex(col => col.caption === 'DID');
310
390
  let selectedRows = [];
@@ -466,8 +546,7 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
466
546
  }
467
547
  };
468
548
  const searchResutlToolbar = _jsxs(_Fragment, { children: [(dcmtsReturned != dcmtsFound) && _jsx("p", { style: { backgroundColor: `white`, color: TMColors.primaryColor, textAlign: 'center', padding: '1px 4px', borderRadius: '3px', display: 'flex' }, children: `${dcmtsReturned}/${dcmtsFound} restituiti` }), context === SearchResultContext.FAVORITES_AND_RECENTS &&
469
- _jsx("div", { style: { display: 'flex', alignItems: 'center', gap: '5px' }, children: _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconDelete, { color: 'white' }), caption: "Rimuovi da " + (selectedSearchResult?.category === "Favorites" ? '"Preferiti"' : '"Recenti"'), disabled: getSelectedDcmtsOrFocused(selectedItems, focusedItem).length <= 0, onClick: removeDcmtFromFavsOrRecents }) }), _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconRefresh, { color: 'white' }), caption: SDKUI_Localizator.Refresh, onClick: onRefreshSearchAsync }), _jsx(IconMenuVertical, { id: `commands-header-${id}`, color: 'white', cursor: 'pointer' }), _jsx(TMCommandsContextMenu, { target: `#commands-header-${id}`, showEvent: "click", menuItems: getCommandsMenuItems(isMobile, fromDTD, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, showSearch, setShowFloatingBar, openFormHandler, openSharedArchiveHandler, showSharedDcmtsHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, openExportForm, handleToggleSearch, handleSignApprove, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback, archiveMasterDocuments, archiveDetailDocuments, currentTIDHasMasterRelations, currentTIDHasDetailRelations, canArchiveMasterRelation, canArchiveDetailRelation, pairManyToMany, hasManyToManyRelation) })] });
470
- const middlePanelToolbar = _jsxs("div", { style: { width: 'max-content', display: 'flex', alignItems: 'center', gap: '10px' }, children: [_jsx(TMSaveFormButtonPrevious, { btnStyle: 'icon', isModified: false, iconColor: TMColors.default_background, formMode: FormModes.ReadOnly, canPrev: canNavigateHandler('prev'), onPrev: () => onNavigateHandler('prev') }), _jsx(TMSaveFormButtonNext, { btnStyle: 'icon', isModified: false, iconColor: TMColors.default_background, formMode: FormModes.ReadOnly, canNext: canNavigateHandler('next'), onNext: () => onNavigateHandler('next') })] });
549
+ _jsx("div", { style: { display: 'flex', alignItems: 'center', gap: '5px' }, children: _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconDelete, { color: 'white' }), caption: "Rimuovi da " + (selectedSearchResult?.category === "Favorites" ? '"Preferiti"' : '"Recenti"'), disabled: getSelectedDcmtsOrFocused(selectedItems, focusedItem).length <= 0, onClick: removeDcmtFromFavsOrRecents }) }), _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconRefresh, { color: 'white' }), caption: SDKUI_Localizator.Refresh, onClick: onRefreshSearchAsync }), _jsx(IconMenuVertical, { id: `commands-header-${id}`, color: 'white', cursor: 'pointer' }), _jsx(TMCommandsContextMenu, { target: `#commands-header-${id}`, showEvent: "click", menuItems: getCommandsMenuItems(isMobile, fromDTD, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, showSearch, setShowFloatingBar, openFormHandler, openSharedArchiveHandler, showSharedDcmtsHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, openExportForm, handleToggleSearch, handleSignApprove, handleCheckOutOperationCallback, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback, archiveMasterDocuments, archiveDetailDocuments, currentTIDHasMasterRelations, currentTIDHasDetailRelations, canArchiveMasterRelation, canArchiveDetailRelation, pairManyToMany, hasManyToManyRelation).concat([customButtonMenuItems()]) })] });
471
550
  const handleAddItem = (tid, did) => {
472
551
  let newItem = { TID: tid ?? 0, DID: did ?? 0 };
473
552
  setSecondaryMasterDcmts((prevItems) => [...prevItems, newItem]);
@@ -499,7 +578,7 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
499
578
  _jsx(TMLayoutItem, { children: _jsx(TMSearchResultSelector, { searchResults: currentSearchResults, disableAccordionIfSingleCategory: disableAccordionIfSingleCategory, selectedTID: selectedSearchResultTID, onSelectionChanged: onSearchResultSelectionChanged }) })
500
579
  :
501
580
  _jsx(_Fragment, {}), _jsxs(TMLayoutItem, { children: [_jsx(TMSearchResultGrid, { showSearch: showSearch, inputFocusedItem: focusedItem, inputSelectedItems: selectedItems, searchResult: searchResults.length > 1 ? selectedSearchResult : searchResults[0], lastUpdateSearchTime: lastUpdateSearchTime, openInOffice: openInOffice, onDblClick: () => openFormHandler(LayoutModes.Update), onContextMenuPreparing: onContextMenuPreparing, onSelectionChanged: (items) => { setSelectedItems(items); }, onVisibleItemChanged: setVisibleItems, onFocusedItemChanged: setFocusedItem, onDownloadDcmtsAsync: async (inputDcmts, downloadType, downloadMode, _y, confirmAttachments) => await downloadDcmtsAsync(inputDcmts, downloadType, downloadMode, onFileOpened, confirmAttachments), showExportForm: showExportForm, onCloseExportForm: onCloseExportForm }), allowFloatingBar && showFloatingBar && deviceType !== DeviceType.MOBILE &&
502
- _jsxs(TMFloatingToolbar, { backgroundColor: TMColors.primaryColor, initialLeft: '10px', initialTop: 'calc(100% - 75px)', children: [fromDTD?.perm?.canRetrieveFile === AccessLevels.Yes && _jsx(TMButton, { btnStyle: 'icon', caption: "Download file", disabled: fromDTD?.perm?.canRetrieveFile !== AccessLevels.Yes || !focusedItem?.DID, icon: _jsx(IconDownload, { color: 'white' }), onClick: () => { downloadDcmtsAsync(getSelectedDcmtsOrFocused(selectedItems, focusedItem), DownloadTypes.Dcmt, "download"); } }), allowRelations && _jsx(TMButton, { btnStyle: 'icon', disabled: !currentTIDHasDetailRelations || !focusedItem?.DID, icon: _jsx(IconDetailDcmts, { color: 'white' }), caption: SDKUI_Localizator.DcmtsDetail, onClick: () => setIsOpenDetails(true) }), allowRelations && _jsx(TMButton, { btnStyle: 'icon', disabled: !currentTIDHasMasterRelations || !focusedItem?.DID, icon: _jsx(IconDetailDcmts, { color: 'white', transform: 'scale(-1, 1)' }), caption: SDKUI_Localizator.DcmtsMaster, onClick: () => setIsOpenMaster(true) }), _jsx(IconMenuVertical, { id: `commands-floating-${id}`, color: 'white', cursor: 'pointer' }), _jsx(TMCommandsContextMenu, { target: `#commands-floating-${id}`, showEvent: "click", menuItems: getCommandsMenuItems(isMobile, fromDTD, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, showSearch, setShowFloatingBar, openFormHandler, openSharedArchiveHandler, showSharedDcmtsHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, openExportForm, handleToggleSearch, handleSignApprove, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback, archiveMasterDocuments, archiveDetailDocuments, currentTIDHasMasterRelations, currentTIDHasDetailRelations, canArchiveMasterRelation, canArchiveDetailRelation, pairManyToMany, hasManyToManyRelation) })] })] })] }), showApprovePopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: onWFOperationCompleted, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), isReject: 0, onClose: () => setShowApprovePopup(false) }), showRejectPopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: onWFOperationCompleted, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), isReject: 1, onClose: () => setShowRejectPopup(false) }), showReAssignPopup && _jsx(WorkFlowReAssignPopUp, { deviceType: deviceType, onCompleted: onWFOperationCompleted, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), onClose: () => setShowReAssignPopup(false) }), showMoreInfoPopup && _jsx(WorkFlowMoreInfoPopUp, { TID: focusedItem?.TID, DID: focusedItem?.DID, deviceType: deviceType, onCompleted: onWFOperationCompleted, onClose: () => setShowMoreInfoPopup(false) }), isOpenBatchUpdate && _jsx(TMBatchUpdateForm, { isModal: true, titleModal: `${SDKUI_Localizator.BatchUpdate} (${getSelectionDcmtInfo().length} documenti selezionati)`, inputDcmts: getSelectionDcmtInfo(), TID: focusedItem ? focusedItem?.TID : selectedItems[0]?.TID, DID: focusedItem ? focusedItem?.DID : selectedItems[0]?.DID, onBack: () => {
581
+ _jsxs(TMFloatingToolbar, { backgroundColor: TMColors.primaryColor, initialLeft: '10px', initialTop: 'calc(100% - 75px)', children: [fromDTD?.perm?.canRetrieveFile === AccessLevels.Yes && _jsx(TMButton, { btnStyle: 'icon', caption: "Download file", disabled: fromDTD?.perm?.canRetrieveFile !== AccessLevels.Yes || !focusedItem?.DID, icon: _jsx(IconDownload, { color: 'white' }), onClick: () => { downloadDcmtsAsync(getSelectedDcmtsOrFocused(selectedItems, focusedItem), DownloadTypes.Dcmt, "download"); } }), allowRelations && _jsx(TMButton, { btnStyle: 'icon', disabled: !currentTIDHasDetailRelations || !focusedItem?.DID, icon: _jsx(IconDetailDcmts, { color: 'white' }), caption: SDKUI_Localizator.DcmtsDetail, onClick: () => setIsOpenDetails(true) }), allowRelations && _jsx(TMButton, { btnStyle: 'icon', disabled: !currentTIDHasMasterRelations || !focusedItem?.DID, icon: _jsx(IconDetailDcmts, { color: 'white', transform: 'scale(-1, 1)' }), caption: SDKUI_Localizator.DcmtsMaster, onClick: () => setIsOpenMaster(true) }), _jsx(IconMenuVertical, { id: `commands-floating-${id}`, color: 'white', cursor: 'pointer' }), _jsx(TMCommandsContextMenu, { target: `#commands-floating-${id}`, showEvent: "click", menuItems: getCommandsMenuItems(isMobile, fromDTD, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, showSearch, setShowFloatingBar, openFormHandler, openSharedArchiveHandler, showSharedDcmtsHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, openExportForm, handleToggleSearch, handleSignApprove, handleCheckOutOperationCallback, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback, archiveMasterDocuments, archiveDetailDocuments, currentTIDHasMasterRelations, currentTIDHasDetailRelations, canArchiveMasterRelation, canArchiveDetailRelation, pairManyToMany, hasManyToManyRelation).concat([customButtonMenuItems()]) })] })] })] }), showApprovePopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: onWFOperationCompleted, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), isReject: 0, onClose: () => setShowApprovePopup(false) }), showRejectPopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: onWFOperationCompleted, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), isReject: 1, onClose: () => setShowRejectPopup(false) }), showReAssignPopup && _jsx(WorkFlowReAssignPopUp, { deviceType: deviceType, onCompleted: onWFOperationCompleted, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), onClose: () => setShowReAssignPopup(false) }), showMoreInfoPopup && _jsx(WorkFlowMoreInfoPopUp, { TID: focusedItem?.TID, DID: focusedItem?.DID, deviceType: deviceType, onCompleted: onWFOperationCompleted, onClose: () => setShowMoreInfoPopup(false) }), isOpenBatchUpdate && _jsx(TMBatchUpdateForm, { isModal: true, titleModal: `${SDKUI_Localizator.BatchUpdate} (${getSelectionDcmtInfo().length} documenti selezionati)`, inputDcmts: getSelectionDcmtInfo(), TID: focusedItem ? focusedItem?.TID : selectedItems[0]?.TID, DID: focusedItem ? focusedItem?.DID : selectedItems[0]?.DID, onBack: () => {
503
582
  setIsOpenBatchUpdate(false);
504
583
  }, onSavedCallbackAsync: async () => {
505
584
  setIsOpenBatchUpdate(false);
@@ -516,7 +595,7 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
516
595
  setShowReAssignPopup(true);
517
596
  }, onMoreInfo: () => {
518
597
  setShowMoreInfoPopup(true);
519
- }, approveDisable: selectedDocs.length === 0, signApproveDisable: disableSignApproveDisable, rejectDisable: selectedDocs.length === 0, reassignDisable: selectedDocs.length === 0, infoDisable: selectedDocs.length !== 1, dtd: fromDTD }) }) })] }), _jsx(ConfirmFormatDialog, {}), _jsx(ConfirmAttachmentsDialog, {}), showRelatedDcmtsChooser &&
598
+ }, approveDisable: selectedDocs.length === 0, signApproveDisable: disableSignApproveDisable, rejectDisable: selectedDocs.length === 0, reassignDisable: selectedDocs.length === 0, infoDisable: selectedDocs.length !== 1, dtd: fromDTD }) }) })] }), _jsx(ConfirmFormatDialog, {}), _jsx(ConfirmAttachmentsDialog, {}), customButton && _jsx(TMCustomButton, { button: customButton, formData: currentMetadataValues, selectedItems: selectedItems, onClose: () => setCustomButton(undefined) }), showRelatedDcmtsChooser &&
520
599
  _jsx(TMChooserForm, { dataSource: relatedDcmtsChooserDataSource, onChoose: async (selectedRelation) => {
521
600
  try {
522
601
  setShowRelatedDcmtsChooser(false);
@@ -692,7 +771,9 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
692
771
  }, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers })] }));
693
772
  };
694
773
  export default TMSearchResult;
695
- const renderDcmtIcon = (cellData, onDownloadDcmtsAsync, openInOffice) => _jsx(TMDcmtIcon, { tid: cellData.data.TID, did: cellData.data.DID, fileExtension: cellData.data.FILEEXT, fileCount: cellData.data.FILECOUNT, isLexProt: cellData.data.IsLexProt, isMail: cellData.data.ISMAIL, isShared: cellData.data.ISSHARED, isSigned: cellData.data.ISSIGNED, downloadMode: 'openInNewWindow', onDownloadDcmtsAsync: onDownloadDcmtsAsync, openInOffice: openInOffice });
774
+ const renderDcmtIcon = (cellData, onDownloadDcmtsAsync, openInOffice) => {
775
+ return _jsx(TMDcmtIcon, { tid: cellData.data.TID, did: cellData.data.DID, fileExtension: cellData.data.FILEEXT, fileCount: cellData.data.FILECOUNT, isLexProt: cellData.data.IsLexProt, isMail: cellData.data.ISMAIL, isShared: cellData.data.ISSHARED, isSigned: cellData.data.ISSIGNED, downloadMode: 'openInNewWindow', onDownloadDcmtsAsync: onDownloadDcmtsAsync, openInOffice: openInOffice });
776
+ };
696
777
  const TMSearchResultGrid = ({ openInOffice, inputFocusedItem, showSearch, allowMultipleSelection = true, showExportForm = false, onCloseExportForm, onFocusedItemChanged, onDownloadDcmtsAsync, onVisibleItemChanged, inputSelectedItems = [], lastUpdateSearchTime, searchResult, onContextMenuPreparing, onSelectionChanged, onDblClick }) => {
697
778
  const [dataSource, setDataSource] = useState();
698
779
  const [columns, setColumns] = useState([]);
@@ -3,8 +3,9 @@ import { DcmtTypeDescriptor, FileDescriptor, FileFormats, LayoutModes, WorkingGr
3
3
  import { TMDataGridContextMenuItem } from '../../base/TMDataGrid';
4
4
  import { DcmtInfo, DcmtOperationTypes, DownloadModes, DownloadTypes, SearchResultContext } from '../../../ts';
5
5
  export declare const getSelectedDcmtsOrFocused: (selectedItems: Array<any>, focusedItem: any, fileFormat?: FileFormats) => DcmtInfo[];
6
+ export declare const getAllFieldSelectedDcmtsOrFocused: (selectedItems: Array<any>, focusedItem: any, fileFormat?: FileFormats) => any[];
6
7
  export declare const signatureInformationCallback: (isMobile: boolean, inputDcmts: DcmtInfo[] | undefined) => Promise<void>;
7
- export declare const getCommandsMenuItems: (isMobile: boolean, dtd: DcmtTypeDescriptor | undefined, selectedItems: Array<any>, focusedItem: any, context: SearchResultContext, showFloatingBar: boolean, workingGroupContext: WorkingGroupDescriptor | undefined, showSearch: boolean, setShowFloatingBar: React.Dispatch<React.SetStateAction<boolean>>, openFormHandler: (layoutMode: LayoutModes) => void, openSharedArchiveHandler: () => Promise<void>, showSharedDcmtsHandler: () => Promise<void>, downloadDcmtsAsync: (inputDcmts: DcmtInfo[] | undefined, downloadType: DownloadTypes, downloadMode: DownloadModes, onFileDownloaded?: (dcmtFile: File | undefined) => void, confirmAttachments?: (list: FileDescriptor[]) => Promise<string[] | undefined>) => Promise<void>, runOperationAsync: (inputDcmts: DcmtInfo[] | undefined, dcmtOperationType: DcmtOperationTypes, actionAfterOperationAsync?: () => Promise<void>) => Promise<void>, onRefreshSearchAsync: (() => Promise<void>) | undefined, onRefreshDataRowsAsync: (() => Promise<void>) | undefined, onRefreshAfterAddDcmtToFavs: (() => void) | undefined, confirmFormat: () => Promise<FileFormats>, confirmAttachments: (list: FileDescriptor[]) => Promise<string[] | undefined>, openTaskFormHandler: () => void, openDetailDcmtsFormHandler: (value: boolean) => void, openMasterDcmtsFormHandler: (value: boolean) => void, openBatchUpdateFormHandler: (value: boolean) => void, openExportForm: () => void, handleToggleSearch: () => void, handleSignApprove: () => void, openWGsCopyMoveForm?: ((mode: "copyToWgDraft" | "copyToWgArchivedDoc", dcmtTypeDescriptor: DcmtTypeDescriptor, documents: Array<DcmtInfo>) => void), openCommentFormCallback?: ((documents: Array<DcmtInfo>) => void), openEditPdf?: ((documents: Array<DcmtInfo>) => void), openAddDocumentForm?: () => void, passToArchiveCallback?: (outputMids: Array<{
8
+ export declare const getCommandsMenuItems: (isMobile: boolean, dtd: DcmtTypeDescriptor | undefined, selectedItems: Array<any>, focusedItem: any, context: SearchResultContext, showFloatingBar: boolean, workingGroupContext: WorkingGroupDescriptor | undefined, showSearch: boolean, setShowFloatingBar: React.Dispatch<React.SetStateAction<boolean>>, openFormHandler: (layoutMode: LayoutModes) => void, openSharedArchiveHandler: () => Promise<void>, showSharedDcmtsHandler: () => Promise<void>, downloadDcmtsAsync: (inputDcmts: DcmtInfo[] | undefined, downloadType: DownloadTypes, downloadMode: DownloadModes, onFileDownloaded?: (dcmtFile: File | undefined) => void, confirmAttachments?: (list: FileDescriptor[]) => Promise<string[] | undefined>) => Promise<void>, runOperationAsync: (inputDcmts: DcmtInfo[] | undefined, dcmtOperationType: DcmtOperationTypes, actionAfterOperationAsync?: () => Promise<void>) => Promise<void>, onRefreshSearchAsync: (() => Promise<void>) | undefined, onRefreshDataRowsAsync: (() => Promise<void>) | undefined, onRefreshAfterAddDcmtToFavs: (() => void) | undefined, confirmFormat: () => Promise<FileFormats>, confirmAttachments: (list: FileDescriptor[]) => Promise<string[] | undefined>, openTaskFormHandler: () => void, openDetailDcmtsFormHandler: (value: boolean) => void, openMasterDcmtsFormHandler: (value: boolean) => void, openBatchUpdateFormHandler: (value: boolean) => void, openExportForm: () => void, handleToggleSearch: () => void, handleSignApprove: () => void, handleCheckOutOperationCallback: (checkout: boolean) => Promise<void>, openWGsCopyMoveForm?: ((mode: "copyToWgDraft" | "copyToWgArchivedDoc", dcmtTypeDescriptor: DcmtTypeDescriptor, documents: Array<DcmtInfo>) => void), openCommentFormCallback?: ((documents: Array<DcmtInfo>) => void), openEditPdf?: ((documents: Array<DcmtInfo>) => void), openAddDocumentForm?: () => void, passToArchiveCallback?: (outputMids: Array<{
8
9
  mid: number;
9
10
  value: string;
10
11
  }>, tid?: number) => void, archiveMasterDocuments?: (tid: number | undefined) => Promise<void>, archiveDetailDocuments?: (tid: number | undefined) => Promise<void>, hasMasterRelation?: boolean, hasDetailRelation?: boolean, canArchiveMasterRelation?: boolean, canArchiveDetailRelation?: boolean, pairManyToManyDocuments?: (isPairing: boolean) => Promise<void>, hasManyToManyRelation?: boolean) => Array<TMDataGridContextMenuItem>;
@@ -1,11 +1,61 @@
1
1
  import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
- import { AccessLevels, AccessLevelsEx, AppModules, FileFormats, LayoutModes, SDK_Globals, DcmtTypeListCacheService, LicenseModuleStatus } 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, svgToString, searchResultToMetadataValues, IconSignaturePencil, IconArchiveMaster, IconArchiveDetail, IconDetailDcmts, isPdfEditorEnabled, IconPair, IconUnpair, IconSharedDcmt } from '../../../helper';
2
+ import { AccessLevels, AccessLevelsEx, AppModules, FileFormats, LayoutModes, SDK_Globals, DcmtTypeListCacheService, LicenseModuleStatus, CICO_MetadataNames } 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, svgToString, searchResultToMetadataValues, IconSignaturePencil, IconArchiveMaster, IconArchiveDetail, IconDetailDcmts, isPdfEditorEnabled, IconPair, IconUnpair, IconSharedDcmt, IconShare, IconCopy, IconMoveToFolder } from '../../../helper';
4
4
  import ShowAlert from '../../base/TMAlert';
5
5
  import { TMMessageBoxManager, ButtonNames, TMExceptionBoxManager } from '../../base/TMPopUp';
6
6
  import TMSpinner from '../../base/TMSpinner';
7
7
  import { DcmtOperationTypes, DownloadTypes, SearchResultContext } from '../../../ts';
8
8
  import { isXMLFileExt } from '../../../helper/dcmtsHelper';
9
+ const getCicoInfo = (dtd) => {
10
+ const cico = {
11
+ CICO: 0,
12
+ CanCICO: AccessLevels.No,
13
+ CanDelChronology: AccessLevels.No,
14
+ UserID_MID: 0,
15
+ Date_MID: 0,
16
+ Ver_MID: 0,
17
+ UserID_CanViewOrUpdate: AccessLevels.No,
18
+ Date_CanViewOrUpdate: AccessLevels.No,
19
+ Ver_CanViewOrUpdate: AccessLevels.No,
20
+ };
21
+ if (dtd === undefined)
22
+ return cico;
23
+ cico.CICO = dtd.cico ?? 0;
24
+ cico.CanCICO = dtd.perm?.canCICO ?? AccessLevels.No;
25
+ cico.CanDelChronology = dtd.perm?.canDelChron ?? AccessLevels.No;
26
+ const mdCheckout = dtd.metadata?.find(md => md.name === CICO_MetadataNames.CICO_CheckoutUserID);
27
+ if (mdCheckout) {
28
+ cico.UserID_MID = mdCheckout.fromMID;
29
+ cico.UserID_CanViewOrUpdate = (mdCheckout.perm?.canView == AccessLevels.Yes || mdCheckout.perm?.canUpdate == AccessLevels.Yes) ? AccessLevels.Yes : AccessLevels.No;
30
+ }
31
+ const mdDate = dtd.metadata?.find(md => md.name === CICO_MetadataNames.CICO_CheckoutDate);
32
+ if (mdDate) {
33
+ cico.Date_MID = mdDate.fromMID;
34
+ cico.Date_CanViewOrUpdate = (mdDate.perm?.canView == AccessLevels.Yes || mdDate.perm?.canUpdate == AccessLevels.Yes) ? AccessLevels.Yes : AccessLevels.No;
35
+ }
36
+ const mdVer = dtd.metadata?.find(md => md.name === CICO_MetadataNames.CICO_Version);
37
+ if (mdVer) {
38
+ cico.Ver_MID = mdVer.fromMID;
39
+ cico.Ver_CanViewOrUpdate = (mdVer.perm?.canView == AccessLevels.Yes || mdVer.perm?.canUpdate == AccessLevels.Yes) ? AccessLevels.Yes : AccessLevels.No;
40
+ }
41
+ return cico;
42
+ };
43
+ const cicoIsEnabled = (dcmt, dtd) => {
44
+ const cicoInfo = getCicoInfo(dtd);
45
+ let isCheckout = false;
46
+ const CICO_CheckoutUserID = dtd?.metadata?.find(md => md.name === CICO_MetadataNames.CICO_CheckoutUserID)?.id;
47
+ if (dcmt && CICO_CheckoutUserID) {
48
+ const key = dcmt.TID + "_" + CICO_CheckoutUserID;
49
+ const value = dcmt[key];
50
+ if (value && value > 0) {
51
+ isCheckout = true;
52
+ }
53
+ }
54
+ return {
55
+ cicoEnabled: cicoInfo.CICO === 1 && cicoInfo.CanCICO === AccessLevels.Yes,
56
+ isCheckout: isCheckout
57
+ };
58
+ };
9
59
  const disabledForSingleRow = (selectedItems, focusedItem) => {
10
60
  return selectedItems.length > 1 || focusedItem === undefined;
11
61
  };
@@ -24,6 +74,17 @@ export const getSelectedDcmtsOrFocused = (selectedItems, focusedItem, fileFormat
24
74
  }
25
75
  return [];
26
76
  };
77
+ export const getAllFieldSelectedDcmtsOrFocused = (selectedItems, focusedItem, fileFormat) => {
78
+ if (selectedItems.length <= 0 && !focusedItem)
79
+ return [];
80
+ if (selectedItems.length > 0) {
81
+ return selectedItems;
82
+ }
83
+ else if (focusedItem !== undefined) {
84
+ return [focusedItem];
85
+ }
86
+ return [];
87
+ };
27
88
  export const signatureInformationCallback = async (isMobile, inputDcmts) => {
28
89
  try {
29
90
  if (!inputDcmts || inputDcmts.length === 0) {
@@ -75,7 +136,7 @@ export const signatureInformationCallback = async (isMobile, inputDcmts) => {
75
136
  TMExceptionBoxManager.show({ exception: error });
76
137
  }
77
138
  };
78
- export const getCommandsMenuItems = (isMobile, dtd, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, showSearch, setShowFloatingBar, openFormHandler, openSharedArchiveHandler, showSharedDcmtsHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, onRefreshDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, confirmAttachments, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, openExportForm, handleToggleSearch, handleSignApprove, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback, archiveMasterDocuments, archiveDetailDocuments, hasMasterRelation, hasDetailRelation, canArchiveMasterRelation, canArchiveDetailRelation, pairManyToManyDocuments, hasManyToManyRelation) => {
139
+ export const getCommandsMenuItems = (isMobile, dtd, 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, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback, archiveMasterDocuments, archiveDetailDocuments, hasMasterRelation, hasDetailRelation, canArchiveMasterRelation, canArchiveDetailRelation, pairManyToManyDocuments, hasManyToManyRelation) => {
79
140
  const isPdfEditorLicensed = SDK_Globals?.license?.dcmtArchiveLicenses?.[0]?.siX_60007?.status === LicenseModuleStatus.Licensed;
80
141
  let pdfEditorAvailable = false;
81
142
  if (dtd && dtd.widgets && dtd.widgets.length > 0) {
@@ -295,49 +356,34 @@ export const getCommandsMenuItems = (isMobile, dtd, selectedItems, focusedItem,
295
356
  ]
296
357
  };
297
358
  };
298
- /* const checkinMenuItem = (): TMDataGridContextMenuItem => {
359
+ const checkinMenuItem = () => {
360
+ // Get the currently selected or focused documents
361
+ const selectedDocs = getAllFieldSelectedDcmtsOrFocused(selectedItems, focusedItem);
362
+ // Take the first document (used for validation checks)
363
+ const firstDoc = selectedDocs?.[0];
364
+ const { cicoEnabled, isCheckout } = cicoIsEnabled(firstDoc, dtd);
299
365
  return {
300
- icon: svgToString(<IconCheckIn />),
301
- text: "Check in",
302
- disabled: disabledForSingleRow(selectedItems, focusedItem) && disabledForMultiRow(selectedItems, focusedItem),
366
+ icon: svgToString(_jsx(IconFileDots, {})),
367
+ text: "Check in/Check out",
368
+ disabled: !cicoEnabled || (disabledForSingleRow(selectedItems, focusedItem) && disabledForMultiRow(selectedItems, focusedItem)),
303
369
  items: [
304
370
  {
305
- icon: svgToString(<IconCheckIn />),
306
- operationType: 'singleRow',
307
- disabled: fromDatagrid ? false : disabledForSingleRow(selectedItems, focusedItem),
308
- text: "Check out", onClick: () => ShowAlert({ message: "TODO Check out", mode: 'info', title: `${"TODO"}`, duration: 3000 })
309
- },
310
- {
311
- icon: svgToString(<IconCheckIn />),
312
- text: "Modifica file",
313
- operationType: 'singleRow',
314
- disabled: fromDatagrid ? false : disabledForSingleRow(selectedItems, focusedItem),
315
- onClick: () => ShowAlert({ message: "TODO Modifica file", mode: 'info', title: `${"TODO"}`, duration: 3000 })
316
- },
317
- {
318
- icon: svgToString(<IconCheckIn />),
319
- text: "Annulla check out",
320
- operationType: 'singleRow',
321
- disabled: fromDatagrid ? false : disabledForSingleRow(selectedItems, focusedItem),
322
- onClick: () => ShowAlert({ message: "TODO Annulla check out", mode: 'info', title: `${"TODO"}`, duration: 3000 })
371
+ icon: "edit",
372
+ text: 'Check out',
373
+ disabled: !cicoEnabled || (disabledForSingleRow(selectedItems, focusedItem) && disabledForMultiRow(selectedItems, focusedItem)),
374
+ // disabled: isNotSingleFile || isGroupLocked || isFileCheckedOut,
375
+ onClick: () => handleCheckOutOperationCallback(true),
323
376
  },
324
377
  {
325
- icon: svgToString(<IconCheckIn />),
326
- text: "Check in",
327
- operationType: 'singleRow',
328
- disabled: fromDatagrid ? false : disabledForSingleRow(selectedItems, focusedItem),
329
- onClick: () => ShowAlert({ message: "TODO Check in", mode: 'info', title: `${"TODO"}`, duration: 3000 })
330
- },
331
- {
332
- icon: svgToString(<IconCheckIn />),
333
- text: "Cronologia",
334
- operationType: 'singleRow',
335
- disabled: fromDatagrid ? false : disabledForSingleRow(selectedItems, focusedItem),
336
- onClick: () => ShowAlert({ message: "TODO Cronologia", mode: 'info', title: `${"TODO"}`, duration: 3000 })
378
+ icon: "remove",
379
+ text: SDKUI_Localizator.CancelCheckOut,
380
+ disabled: !cicoEnabled || (disabledForSingleRow(selectedItems, focusedItem) && disabledForMultiRow(selectedItems, focusedItem)),
381
+ // disabled: isNotSingleFile || isGroupLocked || isFileNotCheckedOut || isNotCheckedOutByCurrentUser,
382
+ onClick: () => handleCheckOutOperationCallback(false),
337
383
  },
338
384
  ]
339
- }
340
- } */
385
+ };
386
+ };
341
387
  const relationsMenuItem = () => {
342
388
  return {
343
389
  icon: svgToString(_jsx(IconRelation, {})),
@@ -347,21 +393,21 @@ export const getCommandsMenuItems = (isMobile, dtd, selectedItems, focusedItem,
347
393
  items: [
348
394
  {
349
395
  icon: svgToString(_jsx(IconPair, {})),
350
- text: "Abbina documenti molti a molti",
396
+ text: SDKUI_Localizator.MatchManyDocumentsManyToMany,
351
397
  operationType: 'multiRow',
352
398
  disabled: !hasManyToManyRelation || disabledForMultiRow(selectedItems, focusedItem),
353
399
  onClick: async () => await pairManyToManyDocuments?.(true)
354
400
  },
355
401
  {
356
402
  icon: svgToString(_jsx(IconUnpair, {})),
357
- text: "Disabbina documenti molti a molti",
403
+ text: SDKUI_Localizator.UnmatchManyDocumentsManyToMany,
358
404
  operationType: 'multiRow',
359
405
  disabled: !hasManyToManyRelation || disabledForMultiRow(selectedItems, focusedItem),
360
406
  onClick: async () => await pairManyToManyDocuments?.(false)
361
407
  },
362
408
  {
363
409
  icon: svgToString(_jsx(IconArchiveMaster, {})),
364
- text: "Archivia documento master",
410
+ text: SDKUI_Localizator.ArchiveMasterDocument,
365
411
  operationType: 'multiRow',
366
412
  beginGroup: true,
367
413
  disabled: canArchiveMasterRelation !== true,
@@ -369,7 +415,7 @@ export const getCommandsMenuItems = (isMobile, dtd, selectedItems, focusedItem,
369
415
  },
370
416
  {
371
417
  icon: svgToString(_jsx(IconArchiveDetail, {})),
372
- text: "Archivia documento dettaglio",
418
+ text: SDKUI_Localizator.ArchiveDetailDocument,
373
419
  operationType: 'multiRow',
374
420
  disabled: canArchiveDetailRelation !== true,
375
421
  onClick: async () => await archiveDetailDocuments?.(focusedItem?.TID)
@@ -397,22 +443,22 @@ export const getCommandsMenuItems = (isMobile, dtd, selectedItems, focusedItem,
397
443
  const sharedDcmtsMenuItem = () => {
398
444
  return {
399
445
  icon: svgToString(_jsx(IconSharedDcmt, {})),
400
- text: 'Documenti condivisi',
446
+ text: SDKUI_Localizator.SharedDocuments,
401
447
  operationType: 'multiRow',
402
448
  disabled: disabledForMultiRow(selectedItems, focusedItem),
403
449
  items: [
404
450
  {
405
451
  icon: svgToString(_jsx(IconSharedDcmt, {})),
406
- text: "Archiviazione condivisa",
452
+ text: SDKUI_Localizator.SharedArchiving,
407
453
  operationType: 'singleRow',
408
454
  disabled: disabledForSingleRow(selectedItems, focusedItem),
409
455
  onClick: async () => { await openSharedArchiveHandler(); }
410
456
  },
411
457
  {
412
458
  icon: svgToString(_jsx(IconSharedDcmt, {})),
413
- text: "Mostra documenti condivisi",
459
+ text: SDKUI_Localizator.ShowSharedDocuments,
414
460
  operationType: 'multiRow',
415
- disabled: disabledForMultiRow(selectedItems, focusedItem),
461
+ disabled: disabledForSingleRow(selectedItems, focusedItem),
416
462
  onClick: async () => { await showSharedDcmtsHandler(); }
417
463
  }
418
464
  ]
@@ -555,7 +601,7 @@ export const getCommandsMenuItems = (isMobile, dtd, selectedItems, focusedItem,
555
601
  };
556
602
  const shareFromWgMenuItem = () => {
557
603
  return {
558
- icon: "share",
604
+ icon: svgToString(_jsx(IconShare, {})),
559
605
  text: SDKUI_Localizator.Share,
560
606
  visible: workingGroupContext !== undefined && openAddDocumentForm !== undefined,
561
607
  disabled: workingGroupContext === undefined,
@@ -564,7 +610,7 @@ export const getCommandsMenuItems = (isMobile, dtd, selectedItems, focusedItem,
564
610
  };
565
611
  const copyFromWgMenuItem = () => {
566
612
  return {
567
- icon: 'copy',
613
+ icon: svgToString(_jsx(IconCopy, {})),
568
614
  text: SDKUI_Localizator.CopyToDrafts,
569
615
  operationType: 'multiRow',
570
616
  visible: openWGsCopyMoveForm !== undefined,
@@ -574,7 +620,7 @@ export const getCommandsMenuItems = (isMobile, dtd, selectedItems, focusedItem,
574
620
  };
575
621
  const movetofolderFromWgMenuItem = () => {
576
622
  return {
577
- icon: 'movetofolder',
623
+ icon: svgToString(_jsx(IconMoveToFolder, {})),
578
624
  text: !isMobile ? SDKUI_Localizator.CopyToArchivedDocuments : SDKUI_Localizator.CopyToArchived,
579
625
  operationType: 'multiRow',
580
626
  visible: openWGsCopyMoveForm !== undefined,
@@ -649,7 +695,7 @@ export const getCommandsMenuItems = (isMobile, dtd, selectedItems, focusedItem,
649
695
  ]
650
696
  },
651
697
  signatureMenuItem(),
652
- // checkinMenuItem(),\
698
+ // checkinMenuItem(),
653
699
  relationsMenuItem(),
654
700
  sharedDcmtsMenuItem(),
655
701
  // shareMenuItem(),
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
2
2
  import { useEffect, useRef, useState } from 'react';
3
3
  import { ObjectClasses, TaskDescriptor, Priorities, PdGs, SDK_Globals, UserListCacheService, SDK_Localizator, Task_States } from '@topconsultnpm/sdk-ts';
4
4
  import { areDifferentIDs, formatDate, getOriginLabel, getPriorityLocalizatorValue, getPriorityLocalizatorValues, getStatusLocalizatorValues, gotoPDGExtendedLabel, taskValidatorAsync } from './TMTasksUtils';
5
- import ScrollView from 'devextreme-react/cjs/scroll-view';
5
+ import ScrollView from 'devextreme-react/scroll-view';
6
6
  import TMLayoutContainer from '../../base/TMLayout';
7
7
  import { FormModes } from '../../../ts';
8
8
  import { useWorkflowApprove } from '../../../hooks/useWorkflowApprove';
@@ -357,6 +357,7 @@ const TMTaskForm = (props) => {
357
357
  }, children: _jsx(TMTooltip, { content: formData.pdG !== PdGs.None ? gotoPDGExtendedLabel(true, formData.pdG, formData.iD1Name) : '', children: _jsxs("span", { onClick: () => formData.pdG !== PdGs.None ? gotoPDGExtendedLabelClickCallback() : null, style: {
358
358
  display: 'inline-flex',
359
359
  alignItems: 'center',
360
+ lineHeight: 1,
360
361
  padding: '6px 10px',
361
362
  borderRadius: 8,
362
363
  backgroundColor: formData.pdG !== PdGs.None ? '#f5f5f7' : 'transparent',
@@ -371,13 +372,13 @@ const TMTaskForm = (props) => {
371
372
  }, onMouseLeave: e => {
372
373
  if (formData.pdG !== PdGs.None)
373
374
  e.currentTarget.style.backgroundColor = '#f5f5f7';
374
- }, children: [getPdgsIconMap().get(formData.pdG), _jsx("span", { children: getOriginLabel(formData.pdG, formData.iD1Name) })] }) }) }) }) })), _jsx(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: 'flex', flexDirection: 'row', width: '100%', gap: 10 }, children: children }), children: _jsx("div", { style: { width: isMobile ? '100%' : '50%' }, children: _jsx(TMTextBox, { label: SDKUI_Localizator.Name, value: formData?.name ?? '', readOnly: fieldsReadOnly.name, autoFocus: true, maxLength: 100, isModifiedWhen: formData?.name !== formDataOrig?.name, onValueChanged: (e) => { setFormData({ ...formData ?? {}, name: e.target.value }); }, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.Name) }) }) }), _jsx("div", { style: { width: '100%' }, children: _jsx(TMTextArea, { label: SDKUI_Localizator.Description, value: formData?.description ?? '', maxLength: 200, readOnly: fieldsReadOnly.description, isModifiedWhen: formData?.description !== formDataOrig?.description, onValueChanged: (e) => { setFormData({ ...formData ?? {}, description: e.target.value }); }, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.Description), resize: false }) }), _jsx(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: 'flex', flexDirection: 'row', width: '100%', gap: 10 }, children: children }), children: (formMode === FormModes.Create || !areDifferentIDs(formDataOrig?.fromID, SDK_Globals.tmSession?.SessionDescr?.userID)) ?
375
- _jsx("div", { id: "assignedToAnotherUserField", style: { width: isMobile ? '100%' : '50%' }, children: _jsx(TMUserChooser, { dataSource: usersList ?? undefined, allowMultipleSelection: false, label: SDKUI_Localizator.AssignedTo, readOnly: fieldsReadOnly.assignedTO, values: formData?.toID ? [formData?.toID] : [], isModifiedWhen: formData?.toID !== formDataOrig?.toID, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.AssignedTo), onValueChanged: (newValue) => {
375
+ }, children: [_jsx("span", { style: { display: 'flex', alignItems: 'center' }, children: getPdgsIconMap().get(formData.pdG) }), _jsx("span", { children: getOriginLabel(formData.pdG, formData.iD1Name) })] }) }) }) }) })), _jsx(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: 'flex', flexDirection: 'row', width: '100%', gap: 10 }, children: children }), children: _jsx("div", { style: { width: isMobile ? '100%' : '50%' }, children: _jsx(TMTextBox, { label: SDKUI_Localizator.Name, value: formData?.name ?? '', readOnly: fieldsReadOnly.name, autoFocus: true, maxLength: 100, isModifiedWhen: formData?.name !== formDataOrig?.name, onValueChanged: (e) => { setFormData({ ...formData ?? {}, name: e.target.value }); }, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.Name) }) }) }), _jsx("div", { style: { width: '100%' }, children: _jsx(TMTextArea, { label: SDKUI_Localizator.Description, value: formData?.description ?? '', maxLength: 200, readOnly: fieldsReadOnly.description, isModifiedWhen: formData?.description !== formDataOrig?.description, onValueChanged: (e) => { setFormData({ ...formData ?? {}, description: e.target.value }); }, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.Description), resize: false }) }), _jsx(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: 'flex', flexDirection: 'row', width: '100%', gap: 10 }, children: children }), children: (formMode === FormModes.Create || !areDifferentIDs(formDataOrig?.fromID, SDK_Globals.tmSession?.SessionDescr?.userID)) ?
376
+ _jsx("div", { id: "assignedToAnotherUserField", style: { width: isMobile ? '100%' : '50%' }, children: _jsx(TMUserChooser, { dataSource: usersList ?? undefined, allowMultipleSelection: false, label: SDKUI_Localizator.AssignedTo_Female, readOnly: fieldsReadOnly.assignedTO, values: formData?.toID ? [formData?.toID] : [], isModifiedWhen: formData?.toID !== formDataOrig?.toID, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.AssignedTo_Female), onValueChanged: (newValue) => {
376
377
  if (newValue === undefined)
377
378
  return;
378
379
  setFormData({ ...formData ?? {}, toID: newValue[0] });
379
380
  } }) })
380
- : formMode === FormModes.Update && _jsxs(_Fragment, { children: [areDifferentIDs(formDataOrig?.fromID, SDK_Globals.tmSession?.SessionDescr?.userID) && _jsx("div", { style: { width: isMobile ? '100%' : '50%' }, children: _jsx(TMTextBox, { label: SDKUI_Localizator.AssignedBy, value: formData?.fromName ?? '', readOnly: true }) }), areDifferentIDs(formDataOrig?.toID, SDK_Globals.tmSession?.SessionDescr?.userID) && _jsx("div", { style: { width: isMobile ? '100%' : '50%' }, children: _jsx(TMTextBox, { label: SDKUI_Localizator.AssignedTo, value: formData?.toName ?? '', readOnly: true }) })] }) }), _jsx(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: 'flex', flexDirection: 'row', width: '100%', gap: 10 }, children: children }), children: _jsxs(_Fragment, { children: [_jsx("div", { style: { width: isMobile ? '100%' : '50%' }, children: _jsx(TMDropDown, { label: SDKUI_Localizator.Status, value: formData?.state, dataSource: getStatusLocalizatorValues(), isModifiedWhen: formData?.state !== formDataOrig?.state, onValueChanged: onStatusValueChange, readOnly: fieldsReadOnly.status }) }), _jsx("div", { style: { width: isMobile ? '100%' : '50%' }, children: !fieldsReadOnly.priority ? _jsx(TMDropDown, { label: SDKUI_Localizator.Priority, value: formData?.priority, dataSource: getPriorityLocalizatorValues(), isModifiedWhen: formData?.priority !== formDataOrig?.priority, onValueChanged: onPriorityValueChange })
381
+ : formMode === FormModes.Update && _jsxs(_Fragment, { children: [areDifferentIDs(formDataOrig?.fromID, SDK_Globals.tmSession?.SessionDescr?.userID) && _jsx("div", { style: { width: isMobile ? '100%' : '50%' }, children: _jsx(TMTextBox, { label: SDKUI_Localizator.AssignedBy, value: formData?.fromName ?? '', readOnly: true }) }), areDifferentIDs(formDataOrig?.toID, SDK_Globals.tmSession?.SessionDescr?.userID) && _jsx("div", { style: { width: isMobile ? '100%' : '50%' }, children: _jsx(TMTextBox, { label: SDKUI_Localizator.AssignedTo_Female, value: formData?.toName ?? '', readOnly: true }) })] }) }), _jsx(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: 'flex', flexDirection: 'row', width: '100%', gap: 10 }, children: children }), children: _jsxs(_Fragment, { children: [_jsx("div", { style: { width: isMobile ? '100%' : '50%' }, children: _jsx(TMDropDown, { label: SDKUI_Localizator.Status, value: formData?.state, dataSource: getStatusLocalizatorValues(), isModifiedWhen: formData?.state !== formDataOrig?.state, onValueChanged: onStatusValueChange, readOnly: fieldsReadOnly.status }) }), _jsx("div", { style: { width: isMobile ? '100%' : '50%' }, children: !fieldsReadOnly.priority ? _jsx(TMDropDown, { label: SDKUI_Localizator.Priority, value: formData?.priority, dataSource: getPriorityLocalizatorValues(), isModifiedWhen: formData?.priority !== formDataOrig?.priority, onValueChanged: onPriorityValueChange })
381
382
  : _jsx(TMTextBox, { label: SDKUI_Localizator.Priority, value: getPriorityLocalizatorValue(formData?.priority ?? Priorities.Low), readOnly: true }) })] }) }), _jsx(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: 'flex', flexDirection: 'row', width: '100%', gap: 10 }, children: children }), children: _jsxs(_Fragment, { children: [_jsx("div", { style: { width: isMobile ? '100%' : '50%', marginTop: 10 }, children: !fieldsReadOnly.startDate ? _jsx(TMDateBox, { id: "start-date", resetTimeToZeroOnKeyPress: false, label: SDKUI_Localizator.StartDate, dateDisplayType: DateDisplayTypes.DateTime, value: formData?.startTime, isModifiedWhen: formData?.startTime !== formDataOrig?.startTime, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.ErrorStartEndDate), onContentReady: handleStartTimeContentReady, onValueChange: (value) => { setFormData({ ...formData ?? {}, startTime: value }); }, showClearButton: true }) : _jsx(TMTextBox, { label: SDKUI_Localizator.StartDate, value: formData?.startTime ? formatDate(formData?.startTime) : '', readOnly: true }) }), _jsx("div", { style: { width: isMobile ? '100%' : '50%', marginTop: 10 }, children: !fieldsReadOnly.startDate ? _jsx(TMDateBox, { id: "end-date", resetTimeToZeroOnKeyPress: false, label: SDKUI_Localizator.Expiration, dateDisplayType: DateDisplayTypes.DateTime, value: formData?.endTime, isModifiedWhen: formData?.endTime !== formDataOrig?.endTime, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.ErrorStartEndDate || o.PropertyName === SDKUI_Localizator.ErrorEndRemDate), onContentReady: handleEndTimeContentReady, onValueChange: (value) => { setFormData({ ...formData ?? {}, endTime: value }); }, showClearButton: true, readOnly: fieldsReadOnly.endDate }) : _jsx(TMTextBox, { label: SDKUI_Localizator.Expiration, value: formData?.endTime ? formatDate(formData?.endTime) : '', readOnly: true }) })] }) }), _jsx(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: 'flex', flexDirection: 'row', width: '100%', gap: 3 }, children: children }), children: _jsx("div", { style: { width: isMobile ? '100%' : '50%', marginTop: 10 }, children: _jsx(TMDateBox, { id: "alert-time", resetTimeToZeroOnKeyPress: false, label: SDKUI_Localizator.Reminder, dateDisplayType: DateDisplayTypes.DateTime, value: formData?.remTime ?? undefined, isModifiedWhen: formData?.remTime !== formDataOrig?.remTime, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.ErrorEndRemDate), onValueChange: (value) => { setFormData({ ...formData ?? {}, remTime: value }); }, showClearButton: true, readOnly: fieldsReadOnly.remTime }) }) }), (formData?.state && [Task_States.Completed, Task_States.Waiting, Task_States.Deferred].includes(formData?.state) ||
382
383
  (formData?.response ?? "") !== "") && _jsx(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: 'flex', flexDirection: 'row', width: '100%', gap: 3 }, children: children }), children: _jsx("div", { style: { width: isMobile ? '100%' : '50%', marginTop: 10 }, children: _jsxs(ResponseCommentWrapper, { children: [_jsx(ResponseCommentTextArea, { id: "responseId", name: "response", "$isValid": true, value: formData?.response ?? '', onChange: onAnswerChange, "$isModifiedWhen": formData?.response !== formDataOrig?.response, disabled: (formData?.response ?? "") !== "" &&
383
384
  (formData?.state && ![Task_States.Completed, Task_States.Waiting, Task_States.Deferred].includes(formData?.state)) }), _jsxs(ResponseCommentLabel, { htmlFor: "responseId", children: [SDKUI_Localizator.Answer, _jsxs(TMTooltip, { content: SDKUI_Localizator.AnswerTooltip, children: [" ", _jsx("i", { className: 'dx-icon-info' }), " "] })] }), _jsx(ResponseCommentCharacterCounter, { children: `${500 - (formData?.response ?? '').length} ${SDKUI_Localizator.CharactersRemaining}` })] }) }) })] }) }) }), (showDcmtForm && formData?.iD1 && formData?.iD2) &&