@topconsultnpm/sdkui-react 6.20.0-dev1.7 → 6.20.0-dev1.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +258 -17
- package/lib/components/NewComponents/ContextMenu/hooks.d.ts +2 -0
- package/lib/components/NewComponents/ContextMenu/hooks.js +17 -4
- package/lib/components/NewComponents/ContextMenu/index.d.ts +3 -0
- package/lib/components/NewComponents/ContextMenu/index.js +2 -0
- package/lib/components/NewComponents/ContextMenu/styles.d.ts +5 -1
- package/lib/components/NewComponents/ContextMenu/styles.js +59 -31
- package/lib/components/NewComponents/ContextMenu/types.d.ts +13 -0
- package/lib/components/NewComponents/ContextMenu/useLongPress.d.ts +21 -0
- package/lib/components/NewComponents/ContextMenu/useLongPress.js +112 -0
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +517 -100
- package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +19 -5
- package/lib/components/NewComponents/FloatingMenuBar/styles.js +206 -54
- package/lib/components/NewComponents/FloatingMenuBar/types.d.ts +1 -2
- package/lib/components/base/TMAccordionNew.js +35 -14
- package/lib/components/base/TMCustomButton.js +61 -17
- package/lib/components/base/TMDataGrid.d.ts +7 -4
- package/lib/components/base/TMDataGrid.js +142 -11
- package/lib/components/base/TMDropDownMenu.js +19 -18
- package/lib/components/base/TMPanel.js +1 -1
- package/lib/components/choosers/TMInvoiceRetrieveFormats.js +1 -1
- package/lib/components/choosers/TMMetadataChooser.js +8 -1
- package/lib/components/choosers/TMOrderRetrieveFormats.js +1 -1
- package/lib/components/choosers/TMUserChooser.d.ts +0 -5
- package/lib/components/choosers/TMUserChooser.js +25 -45
- package/lib/components/editors/TMMetadataValues.js +23 -5
- package/lib/components/editors/TMTextBox.js +6 -3
- package/lib/components/features/documents/TMDcmtForm.d.ts +13 -1
- package/lib/components/features/documents/TMDcmtForm.js +386 -194
- package/lib/components/features/documents/TMDcmtPreview.js +41 -105
- package/lib/components/features/documents/TMMasterDetailDcmts.js +37 -52
- package/lib/components/features/documents/TMRelationViewer.d.ts +1 -1
- package/lib/components/features/documents/TMRelationViewer.js +2 -2
- package/lib/components/features/search/TMDcmtCheckoutInfoForm.d.ts +8 -0
- package/lib/components/features/search/{TMSearchResultCheckoutInfoForm.js → TMDcmtCheckoutInfoForm.js} +5 -10
- package/lib/components/features/search/TMSavedQuerySelector.js +72 -67
- package/lib/components/features/search/TMSearch.js +41 -9
- package/lib/components/features/search/TMSearchQueryPanel.d.ts +1 -0
- package/lib/components/features/search/TMSearchQueryPanel.js +19 -18
- package/lib/components/features/search/TMSearchResult.js +118 -242
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +3 -3
- package/lib/components/features/search/TMSearchResultsMenuItems.js +205 -169
- package/lib/components/features/search/TMSignSettingsForm.js +1 -1
- package/lib/components/features/search/TMSignatureInfoContent.d.ts +6 -0
- package/lib/components/features/search/TMSignatureInfoContent.js +140 -0
- package/lib/components/features/search/TMViewHistoryDcmt.js +1 -1
- package/lib/components/features/tasks/TMTaskForm.js +20 -1
- package/lib/components/features/tasks/TMTasksUtils.d.ts +2 -2
- package/lib/components/features/tasks/TMTasksUtils.js +62 -52
- package/lib/components/features/tasks/TMTasksView.js +6 -6
- package/lib/components/features/workflow/TMWorkflowPopup.d.ts +33 -2
- package/lib/components/features/workflow/TMWorkflowPopup.js +134 -24
- package/lib/components/features/workflow/diagram/DiagramItemComponent.d.ts +1 -0
- package/lib/components/features/workflow/diagram/DiagramItemComponent.js +2 -3
- package/lib/components/features/workflow/diagram/RecipientList.js +3 -2
- package/lib/components/features/workflow/diagram/WFDiagram.d.ts +2 -0
- package/lib/components/features/workflow/diagram/WFDiagram.js +21 -4
- package/lib/components/forms/Login/LoginValidatorService.d.ts +2 -0
- package/lib/components/forms/Login/LoginValidatorService.js +7 -2
- package/lib/components/forms/Login/TMLoginForm.js +34 -6
- package/lib/components/forms/TMChooserForm.js +1 -1
- package/lib/components/grids/TMBlogsPost.js +55 -30
- package/lib/components/grids/TMRecentsManager.js +20 -10
- package/lib/components/index.d.ts +4 -0
- package/lib/components/index.js +4 -0
- package/lib/components/settings/SettingsAppearance.js +92 -29
- package/lib/components/viewers/TMDataListItemViewer.d.ts +2 -1
- package/lib/components/viewers/TMDataListItemViewer.js +35 -71
- package/lib/components/viewers/TMDataUserIdItemViewer.d.ts +8 -0
- package/lib/components/viewers/TMDataUserIdItemViewer.js +39 -0
- package/lib/css/tm-sdkui.css +1 -1
- package/lib/helper/SDKUI_Globals.d.ts +19 -0
- package/lib/helper/SDKUI_Globals.js +11 -0
- package/lib/helper/SDKUI_Localizator.d.ts +15 -1
- package/lib/helper/SDKUI_Localizator.js +147 -1
- package/lib/helper/TMIcons.d.ts +2 -0
- package/lib/helper/TMIcons.js +6 -0
- package/lib/helper/TMPdfViewer.d.ts +8 -0
- package/lib/helper/TMPdfViewer.js +373 -0
- package/lib/helper/checkinCheckoutManager.d.ts +32 -2
- package/lib/helper/checkinCheckoutManager.js +115 -38
- package/lib/helper/devextremeCustomMessages.d.ts +30 -0
- package/lib/helper/devextremeCustomMessages.js +30 -0
- package/lib/helper/helpers.d.ts +2 -1
- package/lib/helper/helpers.js +14 -3
- package/lib/helper/index.d.ts +1 -0
- package/lib/helper/index.js +1 -0
- package/lib/helper/queryHelper.d.ts +1 -1
- package/lib/helper/queryHelper.js +33 -3
- package/lib/hooks/useCheckInOutOperations.d.ts +28 -0
- package/lib/hooks/useCheckInOutOperations.js +223 -0
- package/lib/hooks/useDataListItem.d.ts +12 -0
- package/lib/hooks/useDataListItem.js +131 -0
- package/lib/hooks/useDataUserIdItem.d.ts +10 -0
- package/lib/hooks/useDataUserIdItem.js +96 -0
- package/lib/hooks/useSettingsFeedback.d.ts +11 -0
- package/lib/hooks/useSettingsFeedback.js +38 -0
- package/lib/hooks/useWorkflowApprove.d.ts +4 -0
- package/lib/hooks/useWorkflowApprove.js +14 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/ts/types.d.ts +58 -1
- package/lib/utils/theme.d.ts +1 -1
- package/lib/utils/theme.js +1 -1
- package/package.json +5 -2
- package/lib/components/NewComponents/Notification/Notification.d.ts +0 -4
- package/lib/components/NewComponents/Notification/Notification.js +0 -60
- package/lib/components/NewComponents/Notification/NotificationContainer.d.ts +0 -8
- package/lib/components/NewComponents/Notification/NotificationContainer.js +0 -33
- package/lib/components/NewComponents/Notification/index.d.ts +0 -2
- package/lib/components/NewComponents/Notification/index.js +0 -2
- package/lib/components/NewComponents/Notification/styles.d.ts +0 -21
- package/lib/components/NewComponents/Notification/styles.js +0 -180
- package/lib/components/NewComponents/Notification/types.d.ts +0 -18
- package/lib/components/NewComponents/Notification/types.js +0 -1
- package/lib/components/features/search/TMSearchResultCheckoutInfoForm.d.ts +0 -8
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
3
|
-
import { DossierEngine, LayoutModes, ResultTypes, SDK_Globals, TaskDescriptor, WorkingGroupEngine } from "@topconsultnpm/sdk-ts";
|
|
4
|
-
import { ContextMenu } from "
|
|
3
|
+
import { DossierEngine, LayoutModes, ObjectClasses, ResultTypes, SDK_Globals, TaskDescriptor, WorkingGroupEngine } from "@topconsultnpm/sdk-ts";
|
|
4
|
+
import { ContextMenu as TMContextMenu } from "../NewComponents/ContextMenu";
|
|
5
5
|
import { SDKUI_Localizator, Globalization, getExceptionMessage, TMConditionalWrapper, calcResponsiveSizes } from "../../helper";
|
|
6
6
|
import TMToppyMessage from "../../helper/TMToppyMessage";
|
|
7
7
|
import { useDcmtOperations } from "../../hooks/useDcmtOperations";
|
|
@@ -68,7 +68,8 @@ const TMBlogsPost = (props) => {
|
|
|
68
68
|
const [showTaskForm, setShowTaskForm] = useState(false);
|
|
69
69
|
// State to manage show selected file
|
|
70
70
|
const [dcmtForm, setDcmtForm] = useState({ show: false, dcmt: undefined });
|
|
71
|
-
const [
|
|
71
|
+
const [menuVisible, setMenuVisible] = useState(false);
|
|
72
|
+
const [menuPosition, setMenuPosition] = useState({ x: 0, y: 0 });
|
|
72
73
|
const [menuItems, setMenuItems] = useState([]);
|
|
73
74
|
const [localShowWaitPanel, setLocalShowWaitPanel] = useState(false);
|
|
74
75
|
const [localWaitPanelTitle, setLocalWaitPanelTitle] = useState('');
|
|
@@ -500,8 +501,8 @@ const TMBlogsPost = (props) => {
|
|
|
500
501
|
const classId = targetItem ? targetItem.classID : undefined;
|
|
501
502
|
if (contextMenuParams.isDownloadAttachmentEnabled && focusedAttachment !== undefined) {
|
|
502
503
|
menuItems.push({
|
|
503
|
-
icon: "download",
|
|
504
|
-
|
|
504
|
+
icon: _jsx("span", { className: "dx-icon-download" }),
|
|
505
|
+
name: 'Download',
|
|
505
506
|
onClick: async () => {
|
|
506
507
|
await downloadDcmtsAsync([
|
|
507
508
|
{ TID: focusedAttachment.TID, DID: focusedAttachment.DID, fileName: focusedAttachment.fileName }
|
|
@@ -511,26 +512,26 @@ const TMBlogsPost = (props) => {
|
|
|
511
512
|
}
|
|
512
513
|
if (contextMenuParams.isViewEditMetadata && focusedAttachment !== undefined) {
|
|
513
514
|
menuItems.push({
|
|
514
|
-
icon:
|
|
515
|
-
|
|
515
|
+
icon: _jsx("span", { className: "dx-icon-eyeopen" }),
|
|
516
|
+
name: SDKUI_Localizator.OpenForm,
|
|
516
517
|
onClick: () => openDcmtForm(focusedAttachment),
|
|
517
518
|
});
|
|
518
519
|
}
|
|
519
520
|
if (contextMenuParams.isCommentEnabled && showCommentFormCallback !== undefined) {
|
|
520
521
|
menuItems.push({
|
|
521
|
-
icon:
|
|
522
|
-
|
|
522
|
+
icon: _jsx("span", { className: "dx-icon-chat" }),
|
|
523
|
+
name: SDKUI_Localizator.Comment,
|
|
523
524
|
disabled: isGroupArchived ? true : false,
|
|
524
525
|
onClick: () => {
|
|
525
526
|
showCommentFormCallback(focusedAttachment);
|
|
526
527
|
},
|
|
527
|
-
beginGroup:
|
|
528
|
+
beginGroup: menuItems.length > 0
|
|
528
529
|
});
|
|
529
530
|
}
|
|
530
531
|
if (targetItem && contextMenuParams.isDeleteEnabled) {
|
|
531
532
|
menuItems.push({
|
|
532
|
-
icon: "trash",
|
|
533
|
-
|
|
533
|
+
icon: _jsx("span", { className: "dx-icon-trash" }),
|
|
534
|
+
name: SDKUI_Localizator.Delete,
|
|
534
535
|
visible: contextMenuParams.isDeleteEnabled,
|
|
535
536
|
onClick: () => deleteOrUndeleteCommentCallback(targetItem, true),
|
|
536
537
|
disabled: isNotOwner || isDeleted || isGroupArchived,
|
|
@@ -538,24 +539,24 @@ const TMBlogsPost = (props) => {
|
|
|
538
539
|
}
|
|
539
540
|
if (targetItem && contextMenuParams.isRestoreEnabled) {
|
|
540
541
|
menuItems.push({
|
|
541
|
-
icon: "undo",
|
|
542
|
-
|
|
542
|
+
icon: _jsx("span", { className: "dx-icon-undo" }),
|
|
543
|
+
name: SDKUI_Localizator.Restore,
|
|
543
544
|
onClick: () => deleteOrUndeleteCommentCallback(targetItem, false),
|
|
544
545
|
disabled: isNotOwner || (targetItem && (targetItem.isDel === undefined || targetItem.isDel === 0)),
|
|
545
546
|
});
|
|
546
547
|
}
|
|
547
548
|
if (targetItem && contextMenuParams.isCopyToClipboardEnabled) {
|
|
548
549
|
menuItems.push({
|
|
549
|
-
|
|
550
|
-
icon:
|
|
550
|
+
name: SDKUI_Localizator.CopyToClipboard,
|
|
551
|
+
icon: _jsx("span", { className: "dx-icon-copy" }),
|
|
551
552
|
disabled: false,
|
|
552
553
|
onClick: () => { copyInClipboard(targetItem); }
|
|
553
554
|
});
|
|
554
555
|
}
|
|
555
556
|
if (contextMenuParams.isCreateContextualTask) {
|
|
556
557
|
menuItems.push({
|
|
557
|
-
|
|
558
|
-
icon:
|
|
558
|
+
name: SDKUI_Localizator.CreateContextualTask,
|
|
559
|
+
icon: _jsx("span", { className: "dx-icon-plus" }),
|
|
559
560
|
onClick: () => openTaskFormCallback(targetItem),
|
|
560
561
|
disabled: isGroupArchived ? true : false,
|
|
561
562
|
beginGroup: true
|
|
@@ -563,15 +564,15 @@ const TMBlogsPost = (props) => {
|
|
|
563
564
|
}
|
|
564
565
|
if (targetItem && Boolean(classId && (classId === 'WG' || classId === 'DS'))) {
|
|
565
566
|
menuItems.push({
|
|
566
|
-
icon: "eyeclose",
|
|
567
|
-
|
|
567
|
+
icon: _jsx("span", { className: "dx-icon-eyeclose" }),
|
|
568
|
+
name: SDKUI_Localizator.Unfollow,
|
|
568
569
|
onClick: () => (targetItem && classId) && unFollowCallback(targetItem, classId),
|
|
569
570
|
});
|
|
570
571
|
}
|
|
571
572
|
if (contextMenuParams.isShowHideFilterEnabled) {
|
|
572
573
|
menuItems.push({
|
|
573
|
-
icon: isHeaderHidden ?
|
|
574
|
-
|
|
574
|
+
icon: _jsx("span", { className: isHeaderHidden ? "dx-icon-eyeopen" : "dx-icon-eyeclose" }),
|
|
575
|
+
name: isHeaderHidden ? SDKUI_Localizator.ShowFilters : SDKUI_Localizator.HideFilters,
|
|
575
576
|
onClick: toggleHeaderClick,
|
|
576
577
|
disabled: false,
|
|
577
578
|
beginGroup: true
|
|
@@ -579,23 +580,24 @@ const TMBlogsPost = (props) => {
|
|
|
579
580
|
}
|
|
580
581
|
if (contextMenuParams.isShowHideIDEnaled) {
|
|
581
582
|
menuItems.push({
|
|
582
|
-
icon: localShowId ?
|
|
583
|
+
icon: _jsx("span", { className: localShowId ? "dx-icon-eyeclose" : "dx-icon-eyeopen" }),
|
|
583
584
|
onClick: () => setLocalShowId(prevShowId => !prevShowId),
|
|
584
|
-
|
|
585
|
+
name: localShowId ? SDKUI_Localizator.ID_Hide : SDKUI_Localizator.ID_Show,
|
|
585
586
|
disabled: false,
|
|
586
587
|
});
|
|
587
588
|
}
|
|
588
589
|
if (contextMenuParams.isRefreshEnabled && refreshCallback !== undefined) {
|
|
589
590
|
menuItems.push({
|
|
590
|
-
icon: "refresh",
|
|
591
|
-
|
|
591
|
+
icon: _jsx("span", { className: "dx-icon-refresh" }),
|
|
592
|
+
name: SDKUI_Localizator.Refresh,
|
|
592
593
|
onClick: refresh,
|
|
593
594
|
disabled: false,
|
|
594
595
|
});
|
|
595
596
|
}
|
|
596
597
|
if (menuItems.length > 0) {
|
|
597
|
-
|
|
598
|
+
setMenuPosition({ x: event.clientX, y: event.clientY });
|
|
598
599
|
setMenuItems(menuItems);
|
|
600
|
+
setMenuVisible(true);
|
|
599
601
|
}
|
|
600
602
|
};
|
|
601
603
|
const handlePostsToShowChange = (value) => {
|
|
@@ -606,12 +608,31 @@ const TMBlogsPost = (props) => {
|
|
|
606
608
|
setSearchText(value);
|
|
607
609
|
};
|
|
608
610
|
const closeContextMenu = useCallback(() => {
|
|
609
|
-
|
|
611
|
+
setMenuVisible(false);
|
|
610
612
|
}, []);
|
|
613
|
+
const handleNavigateToReference = (ref) => {
|
|
614
|
+
switch (ref.objClass) {
|
|
615
|
+
case ObjectClasses.Dossier:
|
|
616
|
+
if (ref.objID)
|
|
617
|
+
handleNavigateToDossiers?.(ref.objID);
|
|
618
|
+
else
|
|
619
|
+
console.log("Dossier reference missing objID");
|
|
620
|
+
break;
|
|
621
|
+
case ObjectClasses.WorkingGroup:
|
|
622
|
+
if (ref.objID)
|
|
623
|
+
handleNavigateToWGs?.(ref.objID);
|
|
624
|
+
else
|
|
625
|
+
console.log("Working Group reference missing objID");
|
|
626
|
+
break;
|
|
627
|
+
// Handle other object types as needed
|
|
628
|
+
default:
|
|
629
|
+
console.warn(`Unhandled object type: ${ref.objClass}`);
|
|
630
|
+
}
|
|
631
|
+
};
|
|
611
632
|
return _jsx("div", { ref: containerRef, style: { height: height, width: width }, children: _jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showWaitPanel, showWaitPanelPrimary: showPrimary, showWaitPanelSecondary: showSecondary, waitPanelTitle: waitPanelTitle, waitPanelTextPrimary: waitPanelTextPrimary, waitPanelValuePrimary: waitPanelValuePrimary, waitPanelMaxValuePrimary: waitPanelMaxValuePrimary, waitPanelTextSecondary: waitPanelTextSecondary, waitPanelValueSecondary: waitPanelValueSecondary, waitPanelMaxValueSecondary: waitPanelMaxValueSecondary, isCancelable: true, abortController: abortController, children: _jsxs(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: localShowWaitPanel, showWaitPanelPrimary: localShowPrimary, waitPanelTitle: localWaitPanelTitle, waitPanelTextPrimary: localWaitPanelTextPrimary, waitPanelValuePrimary: localWaitPanelValuePrimary, waitPanelMaxValuePrimary: localWaitPanelMaxValuePrimary, isCancelable: true, abortController: localAbortController, children: [_jsx(TMBlogHeader, { isVisible: currentHeader !== undefined && !isHeaderHidden, layoutMode: layoutMode, height: layoutMode === 'extended' ? "40px" : "70px", width: "100%", allPosts: posts, postsToShow: postsToShow, onPostsToShowChange: handlePostsToShowChange, categoryIdDataSource: categoryIdDataSource, appliedCategoryIdFilters: appliedCategoryIdFilters, setAppliedCategoryIdFilters: setAppliedCategoryIdFilters, searchText: searchText, onSearchChange: handleSearchChange }), _jsxs("div", { style: {
|
|
612
633
|
width: "100%",
|
|
613
634
|
height: currentHeader !== undefined && !isHeaderHidden ? `calc(100% - ${layoutMode === 'extended' ? "40px" : "70px"})` : "100%",
|
|
614
|
-
}, children: [blogPosts.length === 0 && _jsx(TMToppyMessage, { message: searchText.length > 0 ? SDKUI_Localizator.NoMessagesFound : SDKUI_Localizator.NoMessages }), blogPosts.length > 0 && _jsxs("div", { tabIndex: 0, onKeyDown: handleKeyDown, onContextMenu: onContextMenu, style: {
|
|
635
|
+
}, children: [blogPosts.length === 0 && _jsx(TMToppyMessage, { message: searchText.length > 0 ? SDKUI_Localizator.NoMessagesFound : SDKUI_Localizator.NoMessages }), blogPosts.length > 0 && _jsxs("div", { id: `${id}-blogs-container`, tabIndex: 0, onKeyDown: handleKeyDown, onContextMenu: onContextMenu, style: {
|
|
615
636
|
height: '100%',
|
|
616
637
|
width: '100%',
|
|
617
638
|
outline: "none",
|
|
@@ -659,7 +680,11 @@ const TMBlogsPost = (props) => {
|
|
|
659
680
|
boxShadow: isFocused ? "0 4px 12px rgba(19, 85, 150, 0.6)" : "none",
|
|
660
681
|
cursor: 'pointer',
|
|
661
682
|
}, children: [_jsx(BlogPostTitle, { displayMode: displayMode, layoutMode: layoutMode, blogPost: blogPost, isSelected: isSelected, isOwnComment: isOwnComment, searchText: searchText, isSys: isSys, isHomeBlogPost: isHomeBlogPost, showId: localShowId, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), isNew && _jsx(NewBadge, { layoutMode: layoutMode }), _jsx("div", { style: { fontSize: '1rem', color: "#000", marginTop: "10px", overflow: "hidden" }, children: _jsx(TMHtmlContentDisplay, { markup: blogPost.description ?? '-', searchText: searchText, isSelected: isSelected }) }), showExtendedAttachments && blogPost.attachments && blogPost.attachments.length > 0 && (_jsx(TMBlogAttachments, { attachments: blogPost.attachments, layoutMode: layoutMode, isSelected: isSelected, searchText: searchText, dcmtTypeDescriptors: dcmtTypeDescriptors, treeFs: treeFs, draftLatestInfoMap: draftLatestInfoMap, archivedDocumentMap: archivedDocumentMap, handleAttachmentFocus: handleFocusedAttachment, openDcmtForm: openDcmtForm }))] }, `${id}-blogpost-${blogPost.id}`) })] }, "blog-post-wrapper-" + id + "-" + blogPost.id);
|
|
662
|
-
}), _jsx("div", { ref: bottomRef }),
|
|
683
|
+
}), _jsx("div", { ref: bottomRef }), _jsx(TMContextMenu, { items: menuItems, target: `#${id}-blogs-container`, externalControl: {
|
|
684
|
+
visible: menuVisible,
|
|
685
|
+
position: menuPosition,
|
|
686
|
+
onClose: closeContextMenu,
|
|
687
|
+
} })] }), (showTaskForm && handleNavigateToWGs && handleNavigateToDossiers && getAllTasks && deleteTaskByIdsCallback && addTaskCallback && editTaskCallback) && _jsx("div", { style: { height: "100%", width: "100%" }, children: _jsx(TMTaskForm, { id: -1, title: SDKUI_Localizator.ContextualTask, isModal: true, width: calcResponsiveSizes(deviceType, '700px', '700px', '95%'), height: calcResponsiveSizes(deviceType, '670px', '80%', '95%'), formMode: FormModes.Create, visualizedTasks: [], currentTask: currentTask, setCurrentTask: () => { }, selectedRowKeys: [], handleFocusedRowKeyChange: () => { }, onStatusChanged: () => { }, onSaved: onSavedTaskFormCallback, onClose: () => closeTaskFormCallback(), onCancel: () => closeTaskFormCallback(), usersList: participants, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, isContextualCreate: true, taskContext: taskContext, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback }) }), (dcmtForm.dcmt && dcmtForm.dcmt.TID && dcmtForm.dcmt.DID) && _jsx(TMDcmtForm, { TID: Number(dcmtForm.dcmt.TID), DID: Number(dcmtForm.dcmt.DID), layoutMode: LayoutModes.Update, onClose: closeDcmtForm, isClosable: true, titleModal: SDKUI_Localizator.Attachment + ": " + dcmtForm.dcmt.fileName, isModal: true, widthModal: "95%", heightModal: "95%", allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, onReferenceClick: handleNavigateToReference }), (showFloatingCommentButton && showCommentFormCallback && !(context?.engine === 'WorkingGroupEngine' && context?.object?.customData1 === 1)) && _jsx("button", { style: {
|
|
663
688
|
position: 'absolute',
|
|
664
689
|
bottom: '18px',
|
|
665
690
|
right: '20px',
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { useCallback, useEffect, useState } from 'react';
|
|
4
|
-
import ReactDOMServer from 'react-dom/server';
|
|
5
4
|
import { DcmtTypeListCacheService } from '@topconsultnpm/sdk-ts';
|
|
6
|
-
import ContextMenu from '
|
|
5
|
+
import { ContextMenu as TMContextMenu } from '../NewComponents/ContextMenu';
|
|
7
6
|
import { IconDelete, SDKUI_Localizator, IconApply, IconInfo, IconCloseOutline } from '../../helper';
|
|
8
7
|
import { TMColors } from '../../utils/theme';
|
|
9
8
|
import { DeviceType } from '../base/TMDeviceProvider';
|
|
@@ -62,11 +61,15 @@ const StyledRecentTidItem = styled.div `
|
|
|
62
61
|
margin-bottom: 0;
|
|
63
62
|
}
|
|
64
63
|
`;
|
|
65
|
-
const iconDelete = () => ReactDOMServer.renderToString(_jsx(IconDelete, {}));
|
|
66
64
|
const TMRecentsManager = ({ deviceType, mruTIDs, currentMruTID, accessFilter = 'all', onSelectedTID, onDeletedTID }) => {
|
|
67
65
|
const [showDcmtTypeChooser, setShowDcmtTypeChooser] = useState(false);
|
|
68
66
|
const [recentDcmtTypes, setRecentDcmtTypes] = useState([]);
|
|
69
67
|
const [infoDTD, setInfoDTD] = useState();
|
|
68
|
+
const [contextMenuState, setContextMenuState] = useState({
|
|
69
|
+
visible: false,
|
|
70
|
+
position: { x: 0, y: 0 },
|
|
71
|
+
tid: null
|
|
72
|
+
});
|
|
70
73
|
// Handler for the cache refresh event
|
|
71
74
|
const handleCacheRefresh = useCallback(async () => {
|
|
72
75
|
// Retrieve all document types without metadata from the refreshed cache
|
|
@@ -114,7 +117,10 @@ const TMRecentsManager = ({ deviceType, mruTIDs, currentMruTID, accessFilter = '
|
|
|
114
117
|
textOverflow: 'ellipsis'
|
|
115
118
|
}, children: `${SDKUI_Localizator.AllDcmtTypes} (${DcmtTypeListCacheService.CacheCount(true, accessFilter)})` }) }) }, 0), recentDcmtTypes.map((dtd) => {
|
|
116
119
|
const isCurrent = currentMruTID == dtd.id;
|
|
117
|
-
return (_jsxs(StyledRecentTidItem, { id: `tid-${dtd.id}`, "$isMobile": isMobile, onClick: () => { onSelectedTID?.(dtd.id ?? 0); },
|
|
120
|
+
return (_jsxs(StyledRecentTidItem, { id: `tid-${dtd.id}`, "$isMobile": isMobile, onClick: () => { onSelectedTID?.(dtd.id ?? 0); }, onContextMenu: (e) => {
|
|
121
|
+
e.preventDefault();
|
|
122
|
+
setContextMenuState({ visible: true, position: { x: e.clientX, y: e.clientY }, tid: dtd.id ?? null });
|
|
123
|
+
}, children: [_jsxs(StyledDivHorizontal, { style: { alignItems: 'center', gap: 8, width: '100%' }, children: [!isMobile && (_jsx("span", { className: "info-icon", style: {
|
|
118
124
|
marginRight: 4,
|
|
119
125
|
display: 'flex',
|
|
120
126
|
alignItems: 'center'
|
|
@@ -135,20 +141,24 @@ const TMRecentsManager = ({ deviceType, mruTIDs, currentMruTID, accessFilter = '
|
|
|
135
141
|
fontWeight: 'bold',
|
|
136
142
|
marginLeft: 8,
|
|
137
143
|
visibility: isCurrent ? 'visible' : 'hidden'
|
|
138
|
-
}, children: _jsx(IconApply, { fontSize: 24, color: 'green' }) })] }), _jsx(
|
|
144
|
+
}, children: _jsx(IconApply, { fontSize: 24, color: 'green' }) })] }), contextMenuState.tid === dtd.id && (_jsx(TMContextMenu, { items: [
|
|
139
145
|
{
|
|
140
|
-
|
|
141
|
-
icon:
|
|
146
|
+
name: SDKUI_Localizator.Remove,
|
|
147
|
+
icon: _jsx(IconDelete, {}),
|
|
142
148
|
onClick: () => { onDeletedTID?.(dtd.id ?? 0); }
|
|
143
149
|
},
|
|
144
150
|
...(isMobile ? [
|
|
145
151
|
{
|
|
146
|
-
|
|
147
|
-
icon:
|
|
152
|
+
name: SDKUI_Localizator.About,
|
|
153
|
+
icon: _jsx(IconInfo, { color: TMColors.info }),
|
|
148
154
|
onClick: () => { setInfoDTD(dtd); }
|
|
149
155
|
}
|
|
150
156
|
] : [])
|
|
151
|
-
], target: `#tid-${dtd.id}
|
|
157
|
+
], target: `#tid-${dtd.id}`, externalControl: {
|
|
158
|
+
visible: contextMenuState.visible,
|
|
159
|
+
position: contextMenuState.position,
|
|
160
|
+
onClose: () => setContextMenuState({ visible: false, position: { x: 0, y: 0 }, tid: null })
|
|
161
|
+
} }))] }, dtd.id));
|
|
152
162
|
})] }), showDcmtTypeChooser &&
|
|
153
163
|
_jsx(TMDcmtTypeChooserForm, { accessFilter: accessFilter, onClose: () => setShowDcmtTypeChooser(false), onChoose: (tids) => { onSelectedTID?.(tids?.[0] ?? 0); } }), _jsxs(StyledOffCanvasPanel, { ref: panelRef, "$isOpen": isMobile && infoDTD !== undefined, children: [_jsxs(StyledDivHorizontal, { style: { gap: 10, padding: '10px 8px', width: '100%', alignItems: 'center' }, children: [_jsx("p", { style: { fontSize: '1.1rem', fontWeight: 'bold' }, children: `${SDKUI_Localizator.DcmtType} - ${SDKUI_Localizator.About}` }), _jsx(IconCloseOutline, { style: { marginLeft: 'auto', cursor: 'pointer' }, onClick: () => setInfoDTD(undefined) })] }), renderDTDTooltipContent(infoDTD)] })] }));
|
|
154
164
|
};
|
|
@@ -16,6 +16,7 @@ export * from './base/TMTreeView';
|
|
|
16
16
|
export * from './base/TMPanel';
|
|
17
17
|
export * from './base/TMResizableMenu';
|
|
18
18
|
export * from './base/TMAccordionNew';
|
|
19
|
+
export * from './NewComponents/ContextMenu';
|
|
19
20
|
export { default as CounterBar } from './base/TMCounterBar';
|
|
20
21
|
export { default as TMProgressBar } from './base/TMProgressBar';
|
|
21
22
|
export { default as TMSpinner } from './base/TMSpinner';
|
|
@@ -92,6 +93,7 @@ export { default as SettingsAppearance } from "./settings/SettingsAppearance";
|
|
|
92
93
|
export * from "./viewers/TMTidViewer";
|
|
93
94
|
export * from "./viewers/TMMidViewer";
|
|
94
95
|
export * from "./viewers/TMDataListItemViewer";
|
|
96
|
+
export * from "./viewers/TMDataUserIdItemViewer";
|
|
95
97
|
export * from "./base/TMDeviceProvider";
|
|
96
98
|
export { default as TMDataGrid } from "./base/TMDataGrid";
|
|
97
99
|
export { default as TMFileManager } from "./base/TMFileManager";
|
|
@@ -112,5 +114,7 @@ export * from "./features/workflow/diagram/WFDiagram";
|
|
|
112
114
|
export * from "./features/workflow/diagram/workflowHelpers";
|
|
113
115
|
export * from "./features/workflow/diagram/xmlParser";
|
|
114
116
|
export * from "./features/workflow/diagram/interfaces";
|
|
117
|
+
export * from "./features/workflow/diagram/DiagramItemSvgContent";
|
|
118
|
+
export * from "./features/workflow/TMWorkflowPopup";
|
|
115
119
|
export { default as TMWizard } from './wizard/TMWizard';
|
|
116
120
|
export * from './wizard/TMWizard';
|
package/lib/components/index.js
CHANGED
|
@@ -17,6 +17,7 @@ export * from './base/TMTreeView';
|
|
|
17
17
|
export * from './base/TMPanel';
|
|
18
18
|
export * from './base/TMResizableMenu';
|
|
19
19
|
export * from './base/TMAccordionNew';
|
|
20
|
+
export * from './NewComponents/ContextMenu';
|
|
20
21
|
export { default as CounterBar } from './base/TMCounterBar';
|
|
21
22
|
export { default as TMProgressBar } from './base/TMProgressBar';
|
|
22
23
|
export { default as TMSpinner } from './base/TMSpinner';
|
|
@@ -110,6 +111,7 @@ export { default as SettingsAppearance } from "./settings/SettingsAppearance";
|
|
|
110
111
|
export * from "./viewers/TMTidViewer";
|
|
111
112
|
export * from "./viewers/TMMidViewer";
|
|
112
113
|
export * from "./viewers/TMDataListItemViewer";
|
|
114
|
+
export * from "./viewers/TMDataUserIdItemViewer";
|
|
113
115
|
//TMDeviceProvider
|
|
114
116
|
export * from "./base/TMDeviceProvider";
|
|
115
117
|
export { default as TMDataGrid } from "./base/TMDataGrid";
|
|
@@ -133,6 +135,8 @@ export * from "./features/workflow/diagram/WFDiagram";
|
|
|
133
135
|
export * from "./features/workflow/diagram/workflowHelpers";
|
|
134
136
|
export * from "./features/workflow/diagram/xmlParser";
|
|
135
137
|
export * from "./features/workflow/diagram/interfaces";
|
|
138
|
+
export * from "./features/workflow/diagram/DiagramItemSvgContent";
|
|
139
|
+
export * from "./features/workflow/TMWorkflowPopup";
|
|
136
140
|
// wizard
|
|
137
141
|
export { default as TMWizard } from './wizard/TMWizard';
|
|
138
142
|
export * from './wizard/TMWizard';
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo
|
|
3
|
-
import TMLayoutContainer from '../base/TMLayout';
|
|
2
|
+
import { useMemo } from 'react';
|
|
4
3
|
import TMDropDown from '../editors/TMDropDown';
|
|
5
4
|
import TMCheckBox from '../editors/TMCheckBox';
|
|
6
5
|
import TMButton from '../base/TMButton';
|
|
7
6
|
import { LandingPages, SDKUI_Globals, SDKUI_Localizator, ThemeSettings } from '../../helper';
|
|
7
|
+
import { useSettingsFeedback } from '../../hooks/useSettingsFeedback';
|
|
8
|
+
import TMTooltip from '../base/TMTooltip';
|
|
8
9
|
const fontSizes = [
|
|
9
10
|
{ value: "10px", display: "10px" },
|
|
10
11
|
{ value: "11px", display: "11px" },
|
|
@@ -23,8 +24,7 @@ const fontFamilies = [
|
|
|
23
24
|
{ value: "Roboto", display: "Roboto" }
|
|
24
25
|
];
|
|
25
26
|
const SettingsAppearance = ({ landingPagesOptions, permissions = { canArchive: true, canSearch: true, dossiersLicense: true, wgGroupLicense: true, workFlowLicense: true } }) => {
|
|
26
|
-
const
|
|
27
|
-
const triggerUIUpdate = () => setForceUpdate((prev) => prev + 1); // Increment dummy state to re-render
|
|
27
|
+
const { showSavedBadge, lastChanged, triggerUIUpdate, closeBadge } = useSettingsFeedback();
|
|
28
28
|
const filteredLandingPageOptopns = useMemo(() => {
|
|
29
29
|
let options = landingPagesOptions ?? [];
|
|
30
30
|
if (!permissions?.canArchive) {
|
|
@@ -44,30 +44,93 @@ const SettingsAppearance = ({ landingPagesOptions, permissions = { canArchive: t
|
|
|
44
44
|
}
|
|
45
45
|
return options;
|
|
46
46
|
}, [permissions?.canArchive, permissions?.canSearch, permissions?.wgGroupLicense, permissions?.dossiersLicense, permissions?.workFlowLicense, landingPagesOptions]);
|
|
47
|
-
return (_jsxs(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
47
|
+
return (_jsxs("div", { style: { width: "100%", height: "100%", display: "flex", flexDirection: "column", position: "relative" }, children: [_jsxs("div", { style: { flex: 1, overflowY: "auto", padding: "4px" }, children: [_jsxs("div", { style: {
|
|
48
|
+
backgroundColor: "rgba(var(--primary-rgb, 33, 150, 243), 0.04)",
|
|
49
|
+
borderLeft: "3px solid var(--primary-color, #2196f3)",
|
|
50
|
+
borderRadius: "4px",
|
|
51
|
+
padding: "10px 12px",
|
|
52
|
+
marginBottom: "6px"
|
|
53
|
+
}, children: [_jsxs("div", { style: {
|
|
54
|
+
display: "flex",
|
|
55
|
+
alignItems: "center",
|
|
56
|
+
gap: "6px",
|
|
57
|
+
marginBottom: "8px"
|
|
58
|
+
}, children: [_jsx("i", { className: "dx-icon-font", style: { fontSize: "1.1rem", color: "var(--primary-color, #2196f3)" } }), _jsx("p", { style: { fontSize: '1.05rem', fontWeight: '600', margin: 0, color: "var(--text-primary, #333)" }, children: "Font" })] }), _jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "2px" }, children: [_jsx(TMDropDown, { label: SDKUI_Localizator.Name, dataSource: fontFamilies, width: '100%', value: SDKUI_Globals.userSettings.themeSettings.fontFamily, onValueChanged: (e) => {
|
|
59
|
+
let newFamily = e.target.value;
|
|
60
|
+
SDKUI_Globals.userSettings.themeSettings.fontFamily = newFamily;
|
|
61
|
+
triggerUIUpdate(SDKUI_Localizator.Name, newFamily);
|
|
62
|
+
} }), _jsx(TMDropDown, { label: SDKUI_Localizator.Size, dataSource: fontSizes, width: '100%', value: SDKUI_Globals.userSettings.themeSettings.fontSize, onValueChanged: (e) => {
|
|
63
|
+
let newpx = e.target.value;
|
|
64
|
+
SDKUI_Globals.userSettings.themeSettings.fontSize = newpx;
|
|
65
|
+
triggerUIUpdate(SDKUI_Localizator.Size, newpx);
|
|
66
|
+
} })] })] }), _jsxs("div", { style: {
|
|
67
|
+
backgroundColor: "rgba(var(--success-rgb, 76, 175, 80), 0.04)",
|
|
68
|
+
borderLeft: "3px solid var(--success-color, #4caf50)",
|
|
69
|
+
borderRadius: "4px",
|
|
70
|
+
padding: "10px 12px",
|
|
71
|
+
marginBottom: "6px"
|
|
72
|
+
}, children: [_jsxs("div", { style: {
|
|
73
|
+
display: "flex",
|
|
74
|
+
alignItems: "center",
|
|
75
|
+
gap: "6px",
|
|
76
|
+
marginBottom: "8px"
|
|
77
|
+
}, children: [_jsx("i", { className: "dx-icon-tableproperties", style: { fontSize: "1.1rem", color: "var(--success-color, #4caf50)" } }), _jsx("p", { style: { fontSize: '1.05rem', fontWeight: '600', margin: 0, color: "var(--text-primary, #333)" }, children: SDKUI_Localizator.Grids })] }), _jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "5px" }, children: [_jsx(TMCheckBox, { label: SDKUI_Localizator.ShowRowSeparatingLines, value: SDKUI_Globals.userSettings.themeSettings.gridSettings.showRowLines, onValueChanged: (newValue) => {
|
|
78
|
+
SDKUI_Globals.userSettings.themeSettings.gridSettings.showRowLines = newValue;
|
|
79
|
+
triggerUIUpdate(SDKUI_Localizator.ShowRowSeparatingLines, newValue ? 'Attivo' : 'Non attivo');
|
|
80
|
+
} }), _jsx(TMCheckBox, { label: SDKUI_Localizator.ShowColumnSeparatingLines, value: SDKUI_Globals.userSettings.themeSettings.gridSettings.showColumnLines, onValueChanged: (newValue) => {
|
|
81
|
+
SDKUI_Globals.userSettings.themeSettings.gridSettings.showColumnLines = newValue;
|
|
82
|
+
triggerUIUpdate(SDKUI_Localizator.ShowColumnSeparatingLines, newValue ? 'Attivo' : 'Non attivo');
|
|
83
|
+
} }), _jsx(TMCheckBox, { label: SDKUI_Localizator.UseNativeScrollbar, value: SDKUI_Globals.userSettings.themeSettings.gridSettings.useNativeScrollbar, onValueChanged: (newValue) => {
|
|
84
|
+
SDKUI_Globals.userSettings.themeSettings.gridSettings.useNativeScrollbar = newValue;
|
|
85
|
+
triggerUIUpdate(SDKUI_Localizator.UseNativeScrollbar, newValue ? 'Attivo' : 'Non attivo');
|
|
86
|
+
} })] })] }), landingPagesOptions && (_jsxs("div", { style: {
|
|
87
|
+
backgroundColor: "rgba(var(--warning-rgb, 255, 152, 0), 0.04)",
|
|
88
|
+
borderLeft: "3px solid var(--warning-color, #ff9800)",
|
|
89
|
+
borderRadius: "4px",
|
|
90
|
+
padding: "10px 12px"
|
|
91
|
+
}, children: [_jsxs("div", { style: {
|
|
92
|
+
display: "flex",
|
|
93
|
+
alignItems: "center",
|
|
94
|
+
gap: "6px",
|
|
95
|
+
marginBottom: "8px"
|
|
96
|
+
}, children: [_jsx("i", { className: "dx-icon-home", style: { fontSize: "1.1rem", color: "var(--warning-color, #ff9800)" } }), _jsx("p", { style: { fontSize: '1.05rem', fontWeight: '600', margin: 0, color: "var(--text-primary, #333)" }, children: SDKUI_Localizator.LandingPage })] }), _jsx(TMDropDown, { dataSource: filteredLandingPageOptopns, value: SDKUI_Globals.userSettings.landingPage, width: '100%', onValueChanged: (e) => {
|
|
97
|
+
const selectedOption = filteredLandingPageOptopns.find(opt => opt.value === e.target.value);
|
|
98
|
+
SDKUI_Globals.userSettings.landingPage = e.target.value;
|
|
99
|
+
triggerUIUpdate(SDKUI_Localizator.LandingPage, selectedOption?.display || e.target.value);
|
|
100
|
+
} })] }))] }), _jsxs("div", { style: { borderTop: "1px solid #e0e0e0", flexShrink: 0, paddingTop: "5px", display: "flex", flexDirection: "column", alignItems: "flex-end" }, children: [_jsx(TMButton, { elementStyle: { marginTop: '0px' }, caption: SDKUI_Localizator.Restore, showTooltip: false, onClick: () => {
|
|
101
|
+
SDKUI_Globals.userSettings.themeSettings = new ThemeSettings();
|
|
102
|
+
SDKUI_Globals.userSettings.landingPage = LandingPages.DASHBOARD;
|
|
103
|
+
triggerUIUpdate(SDKUI_Localizator.Restore, 'Impostazioni predefinite', true);
|
|
104
|
+
} }), showSavedBadge && (_jsxs("div", { style: {
|
|
105
|
+
marginTop: "5px",
|
|
106
|
+
backgroundColor: "#4caf50",
|
|
107
|
+
color: "white",
|
|
108
|
+
padding: "7px 12px",
|
|
109
|
+
fontSize: "0.95rem",
|
|
110
|
+
borderRadius: "4px",
|
|
111
|
+
boxShadow: "0 2px 8px rgba(0,0,0,0.15)",
|
|
112
|
+
display: "flex",
|
|
113
|
+
alignItems: "center",
|
|
114
|
+
gap: "10px",
|
|
115
|
+
width: "100%",
|
|
116
|
+
maxWidth: "350px",
|
|
117
|
+
boxSizing: "border-box"
|
|
118
|
+
}, children: [_jsx("i", { className: "dx-icon-save", style: { fontSize: "1rem", flexShrink: 0 } }), _jsx("div", { style: {
|
|
119
|
+
flex: 1,
|
|
120
|
+
minWidth: 0,
|
|
121
|
+
overflow: "hidden"
|
|
122
|
+
}, children: _jsxs("div", { style: {
|
|
123
|
+
display: "inline-flex",
|
|
124
|
+
alignItems: "center",
|
|
125
|
+
gap: "5px",
|
|
126
|
+
whiteSpace: "nowrap",
|
|
127
|
+
overflow: "hidden",
|
|
128
|
+
textOverflow: "ellipsis"
|
|
129
|
+
}, children: [_jsx("span", { children: SDKUI_Localizator.SettingSavedSuccessfully }), _jsx(TMTooltip, { content: `${lastChanged.label}: ${lastChanged.value}`, children: _jsx("i", { className: "dx-icon-info" }) })] }) }), _jsx("i", { className: "dx-icon-close", style: {
|
|
130
|
+
fontSize: "0.9rem",
|
|
131
|
+
flexShrink: 0,
|
|
132
|
+
cursor: "pointer",
|
|
133
|
+
opacity: 0.8
|
|
134
|
+
}, onClick: closeBadge })] }))] })] }));
|
|
72
135
|
};
|
|
73
136
|
export default SettingsAppearance;
|
|
@@ -4,7 +4,8 @@ interface ITMDataListItemViewerProps {
|
|
|
4
4
|
dataListId?: number;
|
|
5
5
|
value?: string | Date | number;
|
|
6
6
|
viewMode?: DataListViewModes;
|
|
7
|
+
showTooltip?: boolean;
|
|
7
8
|
}
|
|
8
|
-
declare const TMDataListItemViewer: ({ dataListId, value, viewMode }: ITMDataListItemViewerProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare const TMDataListItemViewer: ({ dataListId, value, viewMode, showTooltip }: ITMDataListItemViewerProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
9
10
|
export default TMDataListItemViewer;
|
|
10
11
|
export declare const cellRenderDataListItem: (data: DataGridTypes.ColumnCellTemplateData, dataListId?: number, viewMode?: DataListViewModes) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,78 +1,42 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { StyledDivHorizontal } from '../base/Styled';
|
|
3
|
+
import { DataListViewModes } from '@topconsultnpm/sdk-ts';
|
|
4
|
+
import { SDKUI_Localizator } from '../../helper';
|
|
6
5
|
import TMTooltip from '../base/TMTooltip';
|
|
7
|
-
import { TMColors } from '../../utils/theme';
|
|
8
6
|
import { TMExceptionBoxManager } from '../base/TMPopUp';
|
|
9
|
-
import {
|
|
10
|
-
const TMDataListItemViewer = ({ dataListId, value, viewMode = DataListViewModes.ImageAndDescription }) => {
|
|
11
|
-
const
|
|
7
|
+
import { useDataListItem } from '../../hooks/useDataListItem';
|
|
8
|
+
const TMDataListItemViewer = ({ dataListId, value, viewMode = DataListViewModes.ImageAndDescription, showTooltip = true }) => {
|
|
9
|
+
const { loadDataListsAsync, getDataListItem, renderDataListCell, convertToDataListValue } = useDataListItem();
|
|
10
|
+
const [dataListItem, setDataListItem] = useState(undefined);
|
|
12
11
|
useEffect(() => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
stringValue = value;
|
|
44
|
-
}
|
|
45
|
-
if (FormulaHelper.isFormula(stringValue))
|
|
46
|
-
return null;
|
|
47
|
-
return dataListItem ? _jsx(TMImageLibrary, { imageID: dataListItem.imageID }) : _jsx(IconWarning, { color: TMColors.warning });
|
|
48
|
-
};
|
|
49
|
-
const getDescription = () => {
|
|
50
|
-
if (!dataListId)
|
|
51
|
-
return undefined;
|
|
52
|
-
if (value === undefined || value === null)
|
|
53
|
-
return undefined;
|
|
54
|
-
let displayValue;
|
|
55
|
-
if (value instanceof Date) {
|
|
56
|
-
displayValue = value.toLocaleDateString();
|
|
57
|
-
}
|
|
58
|
-
else if (typeof value === 'number') {
|
|
59
|
-
displayValue = value.toString();
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
displayValue = value;
|
|
63
|
-
}
|
|
64
|
-
return dataListItem ? dataListItem.name : displayValue;
|
|
65
|
-
};
|
|
66
|
-
return (_jsx(TMTooltip, { content: dataListItem ? dataListItem.value : SDKUI_Localizator.ValueNotPresent, parentStyle: { width: '100%' }, childStyle: { width: '100%' }, children: _jsxs(StyledDivHorizontal, { style: { width: '100%' }, children: [getIcon(), _jsx("p", { style: {
|
|
67
|
-
textAlign: 'left',
|
|
68
|
-
marginLeft: showIcon ? '5px' : '',
|
|
69
|
-
opacity: dataListItem ? 1 : 0.5,
|
|
70
|
-
whiteSpace: 'nowrap',
|
|
71
|
-
overflow: 'hidden',
|
|
72
|
-
textOverflow: 'ellipsis',
|
|
73
|
-
flexGrow: 1,
|
|
74
|
-
minWidth: 0
|
|
75
|
-
}, children: getDescription() })] }) }));
|
|
12
|
+
const loadData = async () => {
|
|
13
|
+
if (dataListId) {
|
|
14
|
+
try {
|
|
15
|
+
await loadDataListsAsync(new Set([dataListId]));
|
|
16
|
+
if (value !== undefined && value !== null) {
|
|
17
|
+
const stringValue = convertToDataListValue(value);
|
|
18
|
+
const item = getDataListItem(dataListId, stringValue);
|
|
19
|
+
setDataListItem(item);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
setDataListItem(undefined);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
TMExceptionBoxManager.show({ exception: err });
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
setDataListItem(undefined);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
loadData();
|
|
34
|
+
}, [dataListId, value, loadDataListsAsync, getDataListItem, convertToDataListValue]);
|
|
35
|
+
if (!dataListId || value === undefined || value === null) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
const content = renderDataListCell(value, dataListId, viewMode);
|
|
39
|
+
return showTooltip ? (_jsx(TMTooltip, { content: dataListItem ? dataListItem.value : SDKUI_Localizator.ValueNotPresent, parentStyle: { width: '100%' }, childStyle: { width: '100%' }, children: content })) : content;
|
|
76
40
|
};
|
|
77
41
|
export default TMDataListItemViewer;
|
|
78
42
|
export const cellRenderDataListItem = (data, dataListId, viewMode) => {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DataGridTypes } from 'devextreme-react/data-grid';
|
|
2
|
+
interface ITMDataUserIdItemViewerProps {
|
|
3
|
+
userId?: number;
|
|
4
|
+
showIcon?: boolean;
|
|
5
|
+
}
|
|
6
|
+
declare const TMDataUserIdItemViewer: ({ userId, showIcon }: ITMDataUserIdItemViewerProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
export default TMDataUserIdItemViewer;
|
|
8
|
+
export declare const cellRenderUserIdItem: (data: DataGridTypes.ColumnCellTemplateData, showIcon?: boolean) => import("react/jsx-runtime").JSX.Element;
|