@topconsultnpm/sdkui-react-beta 6.14.75 → 6.14.77
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/editors/TMMetadataValues.js +0 -1
- package/lib/components/features/documents/TMDcmtForm.js +1 -1
- package/lib/components/features/search/TMSearchQueryPanel.js +12 -5
- package/lib/components/features/search/TMTreeSelector.js +140 -23
- package/lib/components/grids/TMBlogs.d.ts +2 -0
- package/lib/components/grids/TMBlogs.js +137 -101
- package/lib/components/grids/TMRecentsManager.js +31 -28
- package/package.json +1 -1
|
@@ -84,7 +84,6 @@ const TMMetadataValues = ({ showCheckBoxes = ShowCheckBoxesMode.Never, checkPerm
|
|
|
84
84
|
return;
|
|
85
85
|
if (!currentDTD)
|
|
86
86
|
return;
|
|
87
|
-
console.log('TMMetadataValues: metadataValues', metadataValues);
|
|
88
87
|
//if no dynamic data list has changed we do not call APIs
|
|
89
88
|
if (deepCompare(metadataValues.filter(o => o.md?.dataDomain === MetadataDataDomains.DynamicDataList), prevMetadataValues.filter(o => o.md?.dataDomain === MetadataDataDomains.DynamicDataList)))
|
|
90
89
|
return;
|
|
@@ -80,7 +80,7 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
|
|
|
80
80
|
setFetchError(null); // reset errore prima del fetch
|
|
81
81
|
if (!TID)
|
|
82
82
|
return;
|
|
83
|
-
if (!DID)
|
|
83
|
+
if (!DID && layoutMode === LayoutModes.Update)
|
|
84
84
|
return;
|
|
85
85
|
TMSpinner.show({ description: 'Loading Metadata...' });
|
|
86
86
|
let getMetadataResult;
|
|
@@ -3,7 +3,7 @@ import { useCallback, useEffect, useState } from 'react';
|
|
|
3
3
|
import { PlatformObjectValidator, WhereItem, SDK_Localizator, OrderByItem, SelectItem, SelectItemVisibilities, SDK_Globals, SavedQueryCacheService, SearchEngine, QueryOperators } from '@topconsultnpm/sdk-ts-beta';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
import TMSearchQueryEditor from './TMSearchQueryEditor';
|
|
6
|
-
import
|
|
6
|
+
import Toppy from '../../../assets/Toppy-generico.png';
|
|
7
7
|
import { getDcmtTypesByQdAsync, SDKUI_Localizator, getQD, IconMenuVertical, IconAddCircleOutline, IconEdit, IconEasy, IconAdvanced, deepCompare, IconSearch, IconClear, getDefaultOperator, prepareQdForSearchAsync, IsParametricQuery, SDKUI_Globals, IconArrowRight } from '../../../helper';
|
|
8
8
|
import { useQueryParametersDialog } from '../../../hooks/useQueryParametersDialog';
|
|
9
9
|
import { FormModes } from '../../../ts';
|
|
@@ -13,7 +13,7 @@ import ShowAlert from '../../base/TMAlert';
|
|
|
13
13
|
import TMButton from '../../base/TMButton';
|
|
14
14
|
import { useDeviceType, DeviceType } from '../../base/TMDeviceProvider';
|
|
15
15
|
import TMDropDownMenu from '../../base/TMDropDownMenu';
|
|
16
|
-
import TMLayoutContainer
|
|
16
|
+
import TMLayoutContainer from '../../base/TMLayout';
|
|
17
17
|
import { TMExceptionBoxManager } from '../../base/TMPopUp';
|
|
18
18
|
import TMSpinner from '../../base/TMSpinner';
|
|
19
19
|
import TMPanel from '../../base/TMPanel';
|
|
@@ -248,7 +248,7 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
|
|
|
248
248
|
_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 &&
|
|
249
249
|
_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 })] })
|
|
250
250
|
:
|
|
251
|
-
_jsxs(TMLayoutContainer, { gap: 30, alignItems: 'center', justifyContent: 'center', children: [
|
|
251
|
+
_jsxs(TMLayoutContainer, { gap: 30, alignItems: 'center', justifyContent: 'center', children: [_jsx(StyledToppyTextContainer, { children: _jsx(StyledToppyText, { children: SDKUI_Localizator.DcmtTypeSelectOrQuickSearch }) }), _jsx("img", { src: Toppy, width: 120, alt: '' })] }), showSqdForm &&
|
|
252
252
|
_jsx(StyledModalContainer, { style: { backgroundColor: `${TMColors.backgroundColorHeader}12` }, children: _jsx(TMSavedQueryForm, { height: '50%', width: '50%', id: formModeSqdForm === FormModes.Create ? -1 : SQD?.id, title: 'Ricerca rapida', formMode: formModeSqdForm, showBackButton: true, qd: qd, isAdvancedSearch: showAdvancedSearch, isModal: false, onClose: () => { setShowSqdForm(false); }, onSaved: onSqdSaved }) })] }), showDistinctValuesPanel &&
|
|
253
253
|
_jsx(TMDistinctValues, { isModal: true, tid: focusedTidMid?.tid, mid: focusedTidMid?.mid, separator: ',', onClosePanelCallback: () => setShowDistinctValuesPanel(false), onSelectionChanged: (e) => {
|
|
254
254
|
if (!e)
|
|
@@ -328,13 +328,20 @@ export const refreshLastSearch = async (qd) => {
|
|
|
328
328
|
return searchResults;
|
|
329
329
|
};
|
|
330
330
|
export const StyledToppyTextContainer = styled.div `
|
|
331
|
-
padding: 30px
|
|
332
|
-
|
|
331
|
+
padding: 30px 5vw;
|
|
332
|
+
width: 100%;
|
|
333
|
+
max-width: 345px;
|
|
333
334
|
border: 1px solid #2559A5;
|
|
334
335
|
border-radius: 30px;
|
|
335
336
|
display: flex;
|
|
336
337
|
align-items: center;
|
|
337
338
|
justify-content: center;
|
|
339
|
+
box-sizing: border-box;
|
|
340
|
+
|
|
341
|
+
@media (max-width: 400px) {
|
|
342
|
+
padding: 20px 10px;
|
|
343
|
+
max-width: 98vw;
|
|
344
|
+
}
|
|
338
345
|
`;
|
|
339
346
|
export const StyledToppyText = styled.p `
|
|
340
347
|
text-align: center;
|
|
@@ -1,27 +1,32 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useState } from 'react';
|
|
3
|
-
import { LayoutModes, SDK_Localizator, TreeCacheService, TreeItemTypes } from '@topconsultnpm/sdk-ts-beta';
|
|
3
|
+
import { DcmtTypeListCacheService, LayoutModes, SDK_Localizator, TreeCacheService, TreeItemTypes } from '@topconsultnpm/sdk-ts-beta';
|
|
4
4
|
import { TreeList, Column, Scrolling, Selection } from 'devextreme-react/tree-list';
|
|
5
5
|
import { DropDownBox } from 'devextreme-react';
|
|
6
|
-
import { IconStarRemove, IconStar, SDKUI_Localizator, SDKUI_Globals, IconFolder } from '../../../helper';
|
|
7
|
-
import { StyledDivHorizontal } from '../../base/Styled';
|
|
6
|
+
import { IconStarRemove, IconStar, SDKUI_Localizator, SDKUI_Globals, IconFolder, IconInfo, IconCloseOutline } from '../../../helper';
|
|
7
|
+
import { StyledDivHorizontal, StyledOffCanvasPanel } from '../../base/Styled';
|
|
8
8
|
import TMButton from '../../base/TMButton';
|
|
9
9
|
import TMDataGrid from '../../base/TMDataGrid';
|
|
10
|
-
import TMLayoutContainer, { TMLayoutItem } from '../../base/TMLayout';
|
|
11
10
|
import TMPanel from '../../base/TMPanel';
|
|
12
|
-
import TMTidViewer from '../../viewers/TMTidViewer';
|
|
11
|
+
import TMTidViewer, { renderDTDTooltipContent, TMDcmtTypeTooltip } from '../../viewers/TMTidViewer';
|
|
13
12
|
import { TMColors } from '../../../utils/theme';
|
|
14
13
|
import styled from 'styled-components';
|
|
14
|
+
import { useOutsideClick } from '../../../hooks/useOutsideClick';
|
|
15
|
+
import { DeviceType, useDeviceType } from '../../base/TMDeviceProvider';
|
|
15
16
|
const TMTreeSelector = ({ layoutMode = LayoutModes.Update, isVisible, onSelectedTIDChanged, onClosePanel, allowMaximize = true, onMaximizePanel }) => {
|
|
16
17
|
const [trees, setTrees] = useState([]);
|
|
17
18
|
const [treeItems, setTreeItems] = useState([]);
|
|
18
19
|
const [selectedTreeId, setSelectedTreeId] = useState(0);
|
|
20
|
+
const [infoDTD, setInfoDTD] = useState();
|
|
19
21
|
// State to store selected row keys
|
|
20
22
|
const [selectedRowKeys, setSelectedRowKeys] = useState([]);
|
|
21
23
|
// State hook to store the currently focused row key, initially set to undefined
|
|
22
24
|
const [focusedRowKey, setFocusedRowKey] = useState(undefined);
|
|
23
25
|
const [isGridBoxOpened, setIsGridBoxOpened] = useState(false);
|
|
24
26
|
const [defaultTreeId, setDefaultTreeId] = useState(-1);
|
|
27
|
+
const deviceType = useDeviceType();
|
|
28
|
+
const isMobile = deviceType === DeviceType.MOBILE;
|
|
29
|
+
const panelRef = useOutsideClick(() => setInfoDTD(undefined));
|
|
25
30
|
useEffect(() => {
|
|
26
31
|
if (treeItems.length > 0 && treeItems[0].id) {
|
|
27
32
|
setSelectedRowKeys([treeItems[0].id]);
|
|
@@ -59,10 +64,56 @@ const TMTreeSelector = ({ layoutMode = LayoutModes.Update, isVisible, onSelected
|
|
|
59
64
|
setTreeItems(newTreeItems);
|
|
60
65
|
}, [selectedTreeId]);
|
|
61
66
|
const renderCell = (data) => {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
const treeItem = data.data;
|
|
68
|
+
const [showInfo, setShowInfo] = useState(false);
|
|
69
|
+
// Documento (DcmtType)
|
|
70
|
+
if (treeItem.type === TreeItemTypes.DcmtType) {
|
|
71
|
+
return (_jsxs(StyledDivHorizontal, { style: {
|
|
72
|
+
alignItems: 'center',
|
|
73
|
+
minWidth: 0,
|
|
74
|
+
width: '100%',
|
|
75
|
+
gap: 6,
|
|
76
|
+
position: 'relative'
|
|
77
|
+
}, onMouseEnter: async () => {
|
|
78
|
+
if (!isMobile) {
|
|
79
|
+
setShowInfo(true);
|
|
80
|
+
let dtd = await DcmtTypeListCacheService.GetAsync(treeItem.tid);
|
|
81
|
+
setInfoDTD(dtd);
|
|
82
|
+
}
|
|
83
|
+
}, onMouseLeave: () => {
|
|
84
|
+
if (!isMobile) {
|
|
85
|
+
setShowInfo(false);
|
|
86
|
+
setInfoDTD(undefined);
|
|
87
|
+
}
|
|
88
|
+
}, children: [!isMobile && (_jsx("span", { style: {
|
|
89
|
+
opacity: showInfo ? 1 : 0,
|
|
90
|
+
transition: 'opacity 0.2s',
|
|
91
|
+
pointerEvents: showInfo ? 'auto' : 'none',
|
|
92
|
+
cursor: 'pointer',
|
|
93
|
+
marginRight: 4,
|
|
94
|
+
display: 'flex',
|
|
95
|
+
alignItems: 'center',
|
|
96
|
+
position: 'relative',
|
|
97
|
+
left: 0,
|
|
98
|
+
zIndex: 2
|
|
99
|
+
}, children: _jsx(TMDcmtTypeTooltip, { dtd: infoDTD, children: _jsx(IconInfo, { color: TMColors.info }) }) })), _jsx("span", { style: { cursor: 'pointer', flex: 1, minWidth: 0 }, children: _jsx(TMTidViewer, { tid: treeItem.tid, color: TMColors.primaryColor, showIcon: false }) })] }));
|
|
100
|
+
}
|
|
101
|
+
// Folder (altri tipi)
|
|
102
|
+
return (_jsxs(StyledDivHorizontal, { style: { gap: 5, alignItems: 'center', minWidth: 0 }, children: [_jsx("span", { style: {
|
|
103
|
+
flex: '0 0 auto',
|
|
104
|
+
width: 24,
|
|
105
|
+
height: 24,
|
|
106
|
+
display: 'flex',
|
|
107
|
+
alignItems: 'center',
|
|
108
|
+
justifyContent: 'center'
|
|
109
|
+
}, children: _jsx(IconFolder, { fontSize: 24, color: TMColors.iconLight }) }), _jsx("span", { style: {
|
|
110
|
+
color: TMColors.primaryColor,
|
|
111
|
+
minWidth: 0,
|
|
112
|
+
overflow: 'hidden',
|
|
113
|
+
textOverflow: 'ellipsis',
|
|
114
|
+
whiteSpace: 'nowrap',
|
|
115
|
+
flex: 1,
|
|
116
|
+
}, children: treeItem.nameLoc })] }));
|
|
66
117
|
};
|
|
67
118
|
// Handles selection change in the data grid
|
|
68
119
|
const onSelectionChanged = useCallback((e) => {
|
|
@@ -102,23 +153,89 @@ const TMTreeSelector = ({ layoutMode = LayoutModes.Update, isVisible, onSelected
|
|
|
102
153
|
}
|
|
103
154
|
} }), children: trees.length > 0
|
|
104
155
|
?
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
156
|
+
_jsxs("div", { style: {
|
|
157
|
+
display: 'flex',
|
|
158
|
+
flexDirection: 'column',
|
|
159
|
+
height: '100%',
|
|
160
|
+
width: '100%',
|
|
161
|
+
boxSizing: 'border-box',
|
|
162
|
+
minHeight: 0,
|
|
163
|
+
}, children: [_jsx("div", { style: { padding: '10px' }, children: _jsx(DropDownBox, { dropDownOptions: {
|
|
164
|
+
resizeEnabled: true,
|
|
165
|
+
minWidth: "100%",
|
|
166
|
+
height: trees.length <= 10 ? 300 : 500,
|
|
167
|
+
maxWidth: "100%"
|
|
168
|
+
}, value: selectedTreeId, opened: isGridBoxOpened, valueExpr: "id", displayExpr: "nameLoc", deferRendering: false, dataSource: trees, onValueChanged: syncDataGridSelection, onOptionChanged: onGridBoxOpened, style: { height: 30, padding: '5px' }, children: _jsx(TMDataGrid, { height: "100%", width: "100%", dataSource: trees, dataColumns: [
|
|
169
|
+
{ dataField: 'nameLoc', caption: SDKUI_Localizator.Name, width: 'auto' },
|
|
170
|
+
{ dataField: 'description', caption: SDKUI_Localizator.Description, width: 'auto' },
|
|
171
|
+
], selection: { mode: 'single', showCheckBoxesMode: "none" }, showHeaderFilter: false, selectedRowKeys: selectedRowKeys, onSelectionChanged: onSelectionChanged, focusedRowKey: focusedRowKey, onFocusedRowChanged: onFocusedRowChanged }) }) }), _jsxs(StyledTreeListWrapper, { children: [_jsxs(TreeList, { height: "100%", dataSource: treeItems, showRowLines: false, showColumnLines: false, showBorders: false, columnAutoWidth: false, keyExpr: "id", parentIdExpr: "parentID", dataStructure: "plain", showColumnHeaders: false, onContentReady: (e) => e.component.clearSelection(), onSelectionChanged: (e) => {
|
|
172
|
+
if (e.selectedRowsData[0] && e.selectedRowsData[0].type == TreeItemTypes.DcmtType) {
|
|
173
|
+
onSelectedTIDChanged?.(e.selectedRowsData[0].tid, selectedTreeId);
|
|
174
|
+
}
|
|
175
|
+
}, children: [_jsx(Column, { dataField: "nameLoc", caption: SDKUI_Localizator.Name, cellRender: renderCell, width: "100%" }), _jsx(Scrolling, { mode: "virtual", useNative: Number(SDKUI_Globals.userSettings?.themeSettings.gridSettings.useNativeScrollbar) === 1 }), _jsx(Selection, { mode: "single" })] }), _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)] })] })] })
|
|
118
176
|
: _jsx("div", { style: { display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100%', width: '100%', fontSize: '1.5rem' }, children: SDKUI_Localizator.TreesNoAvailable }) }));
|
|
119
177
|
};
|
|
120
178
|
export default TMTreeSelector;
|
|
179
|
+
const StyledTidItem = styled.div `
|
|
180
|
+
display: flex;
|
|
181
|
+
flex-direction: column;
|
|
182
|
+
align-items: stretch;
|
|
183
|
+
min-width: 0;
|
|
184
|
+
/* padding: 10px; */
|
|
185
|
+
position: relative;
|
|
186
|
+
|
|
187
|
+
&:hover {
|
|
188
|
+
cursor: pointer;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.info-icon {
|
|
192
|
+
position: absolute;
|
|
193
|
+
left: -7px;
|
|
194
|
+
top: calc(50% - 5px);
|
|
195
|
+
transform: translateY(-50%);
|
|
196
|
+
opacity: 0;
|
|
197
|
+
transition: opacity 0.2s;
|
|
198
|
+
pointer-events: none;
|
|
199
|
+
// On mobile, never show
|
|
200
|
+
${({ $isMobile }) => $isMobile && `
|
|
201
|
+
display: none !important;
|
|
202
|
+
`}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
&:hover .info-icon {
|
|
206
|
+
opacity: 1;
|
|
207
|
+
pointer-events: auto;
|
|
208
|
+
}
|
|
209
|
+
`;
|
|
121
210
|
const StyledTreeListWrapper = styled.div `
|
|
211
|
+
width: 100%;
|
|
212
|
+
height: 100%;
|
|
213
|
+
min-height: 0;
|
|
214
|
+
flex: 1;
|
|
215
|
+
display: flex;
|
|
216
|
+
flex-direction: column;
|
|
217
|
+
|
|
218
|
+
.dx-treelist,
|
|
219
|
+
.dx-treelist-rowsview,
|
|
220
|
+
.dx-scrollable,
|
|
221
|
+
.dx-scrollable-wrapper,
|
|
222
|
+
.dx-scrollable-container,
|
|
223
|
+
.dx-scrollable-content {
|
|
224
|
+
height: 100% !important;
|
|
225
|
+
min-height: 0 !important;
|
|
226
|
+
max-height: 100% !important;
|
|
227
|
+
box-sizing: border-box;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.dx-scrollable-scrollbar.dx-scrollbar-vertical {
|
|
231
|
+
/* Mostra solo quando serve */
|
|
232
|
+
opacity: 1 !important;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.dx-scrollable-scrollbar.dx-scrollbar-horizontal {
|
|
236
|
+
display: none !important;
|
|
237
|
+
}
|
|
238
|
+
|
|
122
239
|
.dx-treelist-container>.dx-treelist-headers,
|
|
123
240
|
.dx-treelist-container>.dx-treelist-rowsview {
|
|
124
241
|
background-color: transparent;
|
|
@@ -132,7 +249,7 @@ const StyledTreeListWrapper = styled.div `
|
|
|
132
249
|
}
|
|
133
250
|
|
|
134
251
|
.dx-row > td {
|
|
135
|
-
padding: 10px
|
|
252
|
+
padding: 10px;
|
|
136
253
|
font-size: 1rem;
|
|
137
254
|
white-space: nowrap;
|
|
138
255
|
overflow: hidden;
|
|
@@ -88,6 +88,8 @@ interface TMBlogsProps {
|
|
|
88
88
|
showFloatingCommentButton?: boolean;
|
|
89
89
|
/** Context descriptor for the blog component */
|
|
90
90
|
context?: TMBlogContextDescriptor;
|
|
91
|
+
/** Layout */
|
|
92
|
+
layoutMode?: 'stacked' | 'chat';
|
|
91
93
|
}
|
|
92
94
|
declare const TMBlogs: (props: TMBlogsProps) => import("react/jsx-runtime").JSX.Element;
|
|
93
95
|
export default TMBlogs;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { DcmtTypeListCacheService, LayoutModes, ResultTypes, SDK_Globals, WorkingGroupEngine } from "@topconsultnpm/sdk-ts-beta";
|
|
4
4
|
import { ContextMenu, ScrollView } from 'devextreme-react';
|
|
5
5
|
import { SDKUI_Localizator, IconAttachment, getExceptionMessage, Globalization, IconBoard } from '../../helper';
|
|
@@ -31,7 +31,7 @@ const TMBlogs = (props) => {
|
|
|
31
31
|
isRestoreEnabled: false,
|
|
32
32
|
isRefreshEnabled: false,
|
|
33
33
|
isCreateContextualTask: false,
|
|
34
|
-
}, refreshCallback, newPosts = [], showCommentFormCallback, showTaskFormCallback, showContextMenu = true, handleAttachmentFocus, showFloatingCommentButton = false, context, } = props;
|
|
34
|
+
}, refreshCallback, newPosts = [], showCommentFormCallback, showTaskFormCallback, showContextMenu = true, handleAttachmentFocus, showFloatingCommentButton = false, context, layoutMode = 'stacked' } = props;
|
|
35
35
|
// Get the current device type (e.g., mobile, tablet, desktop) using a custom hook.
|
|
36
36
|
const deviceType = useDeviceType();
|
|
37
37
|
const { abortController, showWaitPanel, waitPanelTitle, showPrimary, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, downloadDcmtsAsync } = useDcmtOperations();
|
|
@@ -64,8 +64,11 @@ const TMBlogs = (props) => {
|
|
|
64
64
|
const [isHeaderHidden, setIsHeaderHidden] = useState(isHeaderFullyHidden(currentHeader));
|
|
65
65
|
// showId is a state variable that determines whether an ID-related component or feature should be displayed
|
|
66
66
|
const [localShowId, setLocalShowId] = useState(false);
|
|
67
|
-
// State variable to track the
|
|
68
|
-
const [
|
|
67
|
+
// State variable to track the new posts
|
|
68
|
+
const [newPostIds, setNewPostIds] = useState(new Set());
|
|
69
|
+
const firstNewPostIndex = useMemo(() => {
|
|
70
|
+
return blogPosts.findIndex(post => post.id !== undefined && newPostIds.has(post.id));
|
|
71
|
+
}, [blogPosts, newPostIds]);
|
|
69
72
|
// Ref to the container
|
|
70
73
|
const containerRef = useRef(null);
|
|
71
74
|
// State variable to control the visibility of the wait panel.
|
|
@@ -291,13 +294,23 @@ const TMBlogs = (props) => {
|
|
|
291
294
|
return menuItemsElements;
|
|
292
295
|
}, [isHeaderHidden, localShowId, setLocalShowId, focusedBlog, focusedAttachment, showDcmtForm]);
|
|
293
296
|
useEffect(() => {
|
|
294
|
-
if
|
|
295
|
-
setNewPostCount(0);
|
|
297
|
+
// Check if context exists, the engine is 'WorkingGroupEngine',
|
|
296
298
|
if (context && context.engine === 'WorkingGroupEngine' && context.object && context.object.id) {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
+
// Find the number of new posts for the active working group
|
|
300
|
+
const newPostsCount = newPosts?.find(d => d.id === context.object?.id)?.count ?? 0;
|
|
301
|
+
// If there are no blog posts or the count of new posts is 0 or less, reset the set of new post IDs to an empty set and exit early
|
|
302
|
+
if (blogPosts.length === 0 || newPostsCount <= 0) {
|
|
303
|
+
setNewPostIds(new Set());
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
// Calculate the starting index for slicing the blogPosts array to get only
|
|
307
|
+
const startIndex = Math.max(blogPosts.length - newPostsCount, 0);
|
|
308
|
+
// Extract the IDs of the posts from that slice and filter out undefined IDs
|
|
309
|
+
const ids = blogPosts.slice(startIndex).map(post => post.id).filter((id) => id !== undefined);
|
|
310
|
+
// Update the state with the new set of post IDs considered 'new'
|
|
311
|
+
setNewPostIds(new Set(ids));
|
|
299
312
|
}
|
|
300
|
-
}, [
|
|
313
|
+
}, [blogPosts, newPosts, context]);
|
|
301
314
|
useEffect(() => {
|
|
302
315
|
if (showId !== undefined)
|
|
303
316
|
setLocalShowId(showId);
|
|
@@ -434,101 +447,124 @@ const TMBlogs = (props) => {
|
|
|
434
447
|
return AttachmentElement(attachment, treeFs, draftLatestInfoMap, archivedDocumentMap, dcmtTypeDescriptors, isSelected, searchText, color, downloadDcmtsAsync, handleFocusedAttachment, setAnchorEl, contextMenuRef);
|
|
435
448
|
}) });
|
|
436
449
|
};
|
|
437
|
-
|
|
450
|
+
const renderBlogPostContent = (blogPost, index, isOwnComment) => {
|
|
451
|
+
const isSelected = focusedBlog?.id === blogPost.id;
|
|
452
|
+
const isNew = Boolean((blogPost.newPosts ?? 0) || (blogPost.id !== undefined && blogPost.id !== null && newPostIds.has(blogPost.id)));
|
|
453
|
+
const backgroundColors = {
|
|
454
|
+
default: layoutMode === 'stacked' ? colors.LIGHT_GRAY : isOwnComment ? '#D9EFE0' : '#F3E6E6',
|
|
455
|
+
selectedItems: isSelected ? color ?? colors.PRIMARY_BLUE : colors.PRIMARY_BLUE,
|
|
456
|
+
};
|
|
457
|
+
let bgColor = isSelected ? backgroundColors.selectedItems : backgroundColors.default;
|
|
458
|
+
let textColor = blogPost.isSys ? colors.RED : isSelected ? colors.WHITE : colors.BLACK;
|
|
459
|
+
let iconColor = textColor;
|
|
460
|
+
const classID = blogPost.classID;
|
|
461
|
+
if (classID) {
|
|
462
|
+
if (classID === 'DS')
|
|
463
|
+
iconColor = isSelected ? colors.WHITE : colors.PRIMARY_ORANGE;
|
|
464
|
+
if (classID === 'WG')
|
|
465
|
+
iconColor = isSelected ? colors.WHITE : colors.PRIMARY_GREEN;
|
|
466
|
+
}
|
|
467
|
+
const canNavigate = () => {
|
|
468
|
+
return Boolean(handleNavigateToWGs && id && classID === 'WG');
|
|
469
|
+
};
|
|
470
|
+
const headerClickCallback = () => {
|
|
471
|
+
const id = blogPost.id;
|
|
472
|
+
if (handleNavigateToWGs && id && classID === 'WG')
|
|
473
|
+
handleNavigateToWGs(id);
|
|
474
|
+
};
|
|
475
|
+
const onClickCallback = () => {
|
|
476
|
+
handleFocusedBlog(blogPost);
|
|
477
|
+
};
|
|
478
|
+
const handleKeyDown = (event) => {
|
|
479
|
+
event.preventDefault();
|
|
480
|
+
if (!focusedBlog)
|
|
481
|
+
return;
|
|
482
|
+
const currentIndex = blogPosts.findIndex(post => post.id === focusedBlog.id);
|
|
483
|
+
if (currentIndex === -1)
|
|
484
|
+
return;
|
|
485
|
+
switch (event.key) {
|
|
486
|
+
case 'ArrowDown':
|
|
487
|
+
const nextItem = blogPosts[currentIndex + 1];
|
|
488
|
+
if (nextItem)
|
|
489
|
+
handleFocusedBlog(nextItem);
|
|
490
|
+
break;
|
|
491
|
+
case 'Enter':
|
|
492
|
+
const item = blogPosts[currentIndex];
|
|
493
|
+
const classItemID = item.classID;
|
|
494
|
+
if (handleNavigateToWGs && item.id && classItemID === 'WG')
|
|
495
|
+
handleNavigateToWGs(item.id);
|
|
496
|
+
break;
|
|
497
|
+
default:
|
|
498
|
+
break;
|
|
499
|
+
}
|
|
500
|
+
};
|
|
501
|
+
const handleKeyUp = (event) => {
|
|
502
|
+
event.preventDefault();
|
|
503
|
+
if (event.key === 'ArrowUp' && focusedBlog) {
|
|
504
|
+
const currentIndex = blogPosts.findIndex(post => post.id === focusedBlog.id);
|
|
505
|
+
if (blogPosts[currentIndex - 1]) {
|
|
506
|
+
handleFocusedBlog(blogPosts[currentIndex - 1]);
|
|
507
|
+
}
|
|
508
|
+
;
|
|
509
|
+
}
|
|
510
|
+
};
|
|
511
|
+
const onContextMenu = (e) => {
|
|
512
|
+
e.preventDefault();
|
|
513
|
+
setAnchorEl(e.currentTarget);
|
|
514
|
+
handleFocusedBlog(blogPost);
|
|
515
|
+
handleFocusedAttachment(undefined);
|
|
516
|
+
};
|
|
517
|
+
return (_jsxs(BlogPostContainer, { id: id + "-" + blogPost.id.toString(), ref: containerRef, "$color": textColor, "$textDecoration": blogPost.isDel ? 'line-through' : 'none', "$backgroundColor": bgColor, "$isNew": Boolean(blogPost.newPosts ?? 0) || isNew, "$canNavigate": canNavigate(), "$paddingRight": layoutMode === 'chat' ? "30px" : "10px", onClick: onClickCallback, onDoubleClick: headerClickCallback, tabIndex: 0, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, onContextMenu: onContextMenu, children: [_jsxs("div", { style: { display: "flex", alignItems: "center" }, children: [OwnerInitialsBadge(blogPost), _jsx("div", { style: { flex: "1 1 auto", minWidth: "0" }, children: _jsxs("div", { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', flexWrap: "wrap", overflow: "hidden" }, children: [_jsxs("div", { children: [_jsxs("div", { style: { fontWeight: "bold", fontSize: '1rem', display: "flex", alignItems: "center" }, children: [showIconHeader && blogPost.header && blogPost.classID
|
|
518
|
+
? IconAndHeaderElement(blogPost, iconColor, isSelected, () => {
|
|
519
|
+
if (handleNavigateToWGs && blogPost.id && blogPost.classID === 'WG') {
|
|
520
|
+
handleNavigateToWGs(blogPost.id);
|
|
521
|
+
}
|
|
522
|
+
}, searchText)
|
|
523
|
+
: _jsx("span", { style: { marginLeft: showIconHeader ? "5px" : "0", color: isSelected ? "#fff" : !blogPost.isSys ? TMColors.primary : colors.RED }, children: highlightText(blogPost.ownerName ?? '', searchText, isSelected) }), (blogPost?.newPosts ?? 0) > 0 && (_jsx("div", { style: {
|
|
524
|
+
marginLeft: "5px",
|
|
525
|
+
minWidth: "20px",
|
|
526
|
+
height: "20px",
|
|
527
|
+
padding: "0 6px",
|
|
528
|
+
display: "flex",
|
|
529
|
+
alignItems: "center",
|
|
530
|
+
justifyContent: "center",
|
|
531
|
+
backgroundColor: isSelected ? '#fff' : color,
|
|
532
|
+
color: isSelected ? color : "#fff",
|
|
533
|
+
boxShadow: "1px 1px 2px #00000020",
|
|
534
|
+
borderRadius: "30px",
|
|
535
|
+
fontWeight: "bold",
|
|
536
|
+
fontSize: "12px",
|
|
537
|
+
whiteSpace: "nowrap",
|
|
538
|
+
}, children: blogPost.newPosts }))] }), _jsxs("div", { style: { fontSize: 'calc(1rem - 1px)', color: isSelected ? "#fff" : !blogPost.isSys ? TMColors.primary : colors.RED }, children: [(showIconHeader) && blogPost.header && blogPost.classID &&
|
|
539
|
+
_jsxs(_Fragment, { children: [_jsx("span", { style: { marginLeft: showIconHeader ? "5px" : "0" }, children: blogPost.ownerName }), _jsx("span", { style: { margin: "0 5px" }, children: "\u2501" })] }), blogPost.creationTime &&
|
|
540
|
+
highlightText(`${SDKUI_Localizator.WrittenOn} ${Globalization.getDateTimeDisplayValue(blogPost.creationTime)} ${new Date(blogPost.creationTime).toDateString() === new Date().toDateString() ? `(${SDKUI_Localizator.Today})` : ''}`, searchText, isSelected), localShowId && _jsxs(_Fragment, { children: [_jsx("span", { style: { margin: "0 5px" }, children: "\u2501" }), _jsxs("span", { children: ["(ID: ", blogPost.id, ")"] })] })] })] }), blogPost.attachments && showExtendedAttachments === false &&
|
|
541
|
+
_jsx("div", { style: { marginTop: "10px", fontSize: "13px", display: "flex", justifyContent: "flex-end" }, children: _jsx(TMTooltip, { content: `${SDKUI_Localizator.Attachments}: ${blogPost.attachments.length}`, children: _jsx(IconAttachment, { fontSize: 20, color: isSelected ? '#fff' : color }) }) })] }) })] }), _jsx("div", { style: { marginTop: "10px", fontSize: '1rem' }, children: _jsx(TMHtmlContentDisplay, { markup: blogPost.description ?? '-', searchText: searchText, isSelected: isSelected }) }), showExtendedAttachments && blogPost.attachments && blogPost.attachments.length > 0 &&
|
|
542
|
+
attachmentDetails(blogPost.attachments, isSelected)] }, id + "-" + blogPost.id));
|
|
543
|
+
};
|
|
544
|
+
return _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: _jsx("div", { ref: scrollRef, style: { backgroundColor: layoutMode === "stacked" ? "rgba(191, 191, 191, 0.15)" : '#fff', height: "100%", padding: "5px", overflowY: "auto", width: "100%" }, children: blogPosts.length === 0 ?
|
|
438
545
|
_jsxs("div", { style: { display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100%' }, children: [_jsx(IconBoard, { fontSize: 96 }), searchText.length > 0 ?
|
|
439
546
|
_jsx("div", { style: { fontSize: "15px", marginTop: "10px" }, children: SDKUI_Localizator.NoMessagesFound }) :
|
|
440
547
|
_jsx("div", { style: { fontSize: "15px", marginTop: "10px" }, children: SDKUI_Localizator.NoMessages })] })
|
|
441
548
|
: blogPosts.map((blogPost, index) => {
|
|
442
|
-
const
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
const headerClickCallback = () => {
|
|
462
|
-
const id = blogPost.id;
|
|
463
|
-
if (handleNavigateToWGs && id && classID === 'WG')
|
|
464
|
-
handleNavigateToWGs(id);
|
|
465
|
-
};
|
|
466
|
-
const onClickCallback = () => {
|
|
467
|
-
handleFocusedBlog(blogPost);
|
|
468
|
-
};
|
|
469
|
-
const handleKeyDown = (event) => {
|
|
470
|
-
event.preventDefault();
|
|
471
|
-
if (!focusedBlog)
|
|
472
|
-
return;
|
|
473
|
-
const currentIndex = blogPosts.findIndex(post => post.id === focusedBlog.id);
|
|
474
|
-
if (currentIndex === -1)
|
|
475
|
-
return;
|
|
476
|
-
switch (event.key) {
|
|
477
|
-
case 'ArrowDown':
|
|
478
|
-
const nextItem = blogPosts[currentIndex + 1];
|
|
479
|
-
if (nextItem)
|
|
480
|
-
handleFocusedBlog(nextItem);
|
|
481
|
-
break;
|
|
482
|
-
case 'Enter':
|
|
483
|
-
const item = blogPosts[currentIndex];
|
|
484
|
-
const classItemID = item.classID;
|
|
485
|
-
if (handleNavigateToWGs && item.id && classItemID === 'WG')
|
|
486
|
-
handleNavigateToWGs(item.id);
|
|
487
|
-
break;
|
|
488
|
-
default:
|
|
489
|
-
break;
|
|
490
|
-
}
|
|
491
|
-
};
|
|
492
|
-
const handleKeyUp = (event) => {
|
|
493
|
-
event.preventDefault();
|
|
494
|
-
if (event.key === 'ArrowUp' && focusedBlog) {
|
|
495
|
-
const currentIndex = blogPosts.findIndex(post => post.id === focusedBlog.id);
|
|
496
|
-
if (blogPosts[currentIndex - 1]) {
|
|
497
|
-
handleFocusedBlog(blogPosts[currentIndex - 1]);
|
|
498
|
-
}
|
|
499
|
-
;
|
|
500
|
-
}
|
|
501
|
-
};
|
|
502
|
-
const onContextMenu = (e) => {
|
|
503
|
-
e.preventDefault();
|
|
504
|
-
setAnchorEl(e.currentTarget);
|
|
505
|
-
handleFocusedBlog(blogPost);
|
|
506
|
-
handleFocusedAttachment(undefined);
|
|
507
|
-
};
|
|
508
|
-
return (_jsxs(BlogPostContainer, { id: id + "-" + blogPost.id.toString(), ref: containerRef, "$color": textColor, "$textDecoration": blogPost.isDel ? 'line-through' : 'none', "$backgroundColor": bgColor, "$isNew": Boolean(blogPost.newPosts ?? 0) || isNew, "$canNavigate": canNavigate(), onClick: onClickCallback, onDoubleClick: headerClickCallback, tabIndex: 0, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, onContextMenu: onContextMenu, children: [_jsxs("div", { style: { display: "flex", alignItems: "center" }, children: [OwnerInitialsBadge(blogPost), _jsx("div", { style: { flex: "1 1 auto", minWidth: "0" }, children: _jsxs("div", { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', flexWrap: "wrap", overflow: "hidden" }, children: [_jsxs("div", { children: [_jsxs("div", { style: { fontWeight: "bold", fontSize: '1rem', display: "flex", alignItems: "center" }, children: [(showIconHeader && (blogPost.header && blogPost.classID))
|
|
509
|
-
? (IconAndHeaderElement(blogPost, iconColor, isSelected, headerClickCallback, searchText))
|
|
510
|
-
: _jsx("span", { style: {
|
|
511
|
-
marginLeft: showIconHeader ? "5px" : "0",
|
|
512
|
-
color: isSelected ? "#fff" : !blogPost.isSys ? TMColors.primary : colors.RED
|
|
513
|
-
}, children: highlightText(blogPost.ownerName ?? '', searchText, isSelected) }), (blogPost?.newPosts ?? 0) > 0 && (_jsx("div", { style: {
|
|
514
|
-
marginLeft: "5px",
|
|
515
|
-
minWidth: "20px",
|
|
516
|
-
height: "20px",
|
|
517
|
-
padding: "0 6px",
|
|
518
|
-
display: "flex",
|
|
519
|
-
alignItems: "center",
|
|
520
|
-
justifyContent: "center",
|
|
521
|
-
backgroundColor: isSelected ? '#fff' : color,
|
|
522
|
-
color: isSelected ? color : "#fff",
|
|
523
|
-
boxShadow: "1px 1px 2px #00000020",
|
|
524
|
-
borderRadius: "30px",
|
|
525
|
-
fontWeight: "bold",
|
|
526
|
-
fontSize: "12px",
|
|
527
|
-
whiteSpace: "nowrap",
|
|
528
|
-
}, children: blogPost.newPosts }))] }), _jsxs("div", { style: { fontSize: 'calc(1rem - 1px)', color: isSelected ? "#fff" : !blogPost.isSys ? TMColors.primary : colors.RED }, children: [(showIconHeader && (blogPost.header && blogPost.classID)) && _jsxs("span", { style: { marginLeft: showIconHeader ? "5px" : "0" }, children: [blogPost.ownerName, _jsx("span", { style: { margin: "0 5px" }, children: "\u2501" })] }), blogPost.creationTime
|
|
529
|
-
? highlightText(SDKUI_Localizator.WrittenOn + " " + `${Globalization.getDateTimeDisplayValue(blogPost.creationTime)} ${new Date(blogPost.creationTime).toDateString() === new Date().toDateString() ? "(" + SDKUI_Localizator.Today + ")" : ''}`, searchText, isSelected)
|
|
530
|
-
: '', localShowId && _jsxs("span", { children: [_jsx("span", { style: { margin: "0 5px" }, children: "\u2501" }), _jsxs("span", { children: ["(ID: ", blogPost.id, ")"] })] })] })] }), (blogPost.attachments && showExtendedAttachments === false) &&
|
|
531
|
-
_jsx("div", { style: { marginTop: "10px", fontSize: "13px", display: "flex", justifyContent: "flex-end" }, children: _jsx(TMTooltip, { content: SDKUI_Localizator.Attachments + ": " + blogPost.attachments.length, children: _jsx(IconAttachment, { fontSize: 20, color: isSelected ? '#fff' : color }) }) })] }) })] }), _jsx("div", { style: { marginTop: "10px", fontSize: '1rem' }, children: _jsx(TMHtmlContentDisplay, { markup: blogPost.description ?? '-', searchText: searchText, isSelected: isSelected }) }), (showExtendedAttachments && blogPost.attachments && blogPost.attachments.length > 0) && attachmentDetails(blogPost.attachments, isSelected)] }, id + "-" + blogPost.id));
|
|
549
|
+
const isOwnComment = blogPost.ownerID === SDK_Globals.tmSession?.SessionDescr?.userID;
|
|
550
|
+
return (_jsxs(React.Fragment, { children: [index === firstNewPostIndex && (_jsxs("div", { style: { display: 'flex', alignItems: 'center', width: '100%', color: TMColors.primary, fontWeight: '600', fontSize: '0.9rem', userSelect: 'none', }, children: [_jsx("hr", { style: { flex: 1, border: 'none', borderTop: `1px solid ${TMColors.primary}`, marginRight: '10px' } }), _jsx("span", { children: SDKUI_Localizator.LastRead }), _jsx("hr", { style: { flex: 1, border: 'none', borderTop: `1px solid ${TMColors.primary}`, marginLeft: '10px' } })] })), layoutMode === 'stacked' ? renderBlogPostContent(blogPost, index, isOwnComment) :
|
|
551
|
+
_jsx("div", { id: 'blogPostChat-' + id + "-" + blogPost.id.toString(), style: {
|
|
552
|
+
display: "flex",
|
|
553
|
+
flexDirection: "row",
|
|
554
|
+
alignItems: "flex-start",
|
|
555
|
+
padding: "5px",
|
|
556
|
+
borderRadius: "12px",
|
|
557
|
+
cursor: "default",
|
|
558
|
+
justifyContent: isOwnComment ? "flex-end" : "flex-start",
|
|
559
|
+
}, children: _jsx("div", { style: {
|
|
560
|
+
display: "flex",
|
|
561
|
+
flexDirection: "column",
|
|
562
|
+
alignItems: isOwnComment ? "flex-end" : "flex-start",
|
|
563
|
+
textAlign: "left",
|
|
564
|
+
maxWidth: '80%',
|
|
565
|
+
borderRadius: '8px',
|
|
566
|
+
backgroundColor: isOwnComment ? '#E8EBFA' : '#f5f5f5',
|
|
567
|
+
}, children: renderBlogPostContent(blogPost, index, isOwnComment) }) }, 'blogPostChat-' + id + "-" + blogPost.id)] }, "blog-post-wrapper-" + id + "-" + blogPost.id));
|
|
532
568
|
}) }) });
|
|
533
569
|
};
|
|
534
570
|
const DataGridView = () => {
|
|
@@ -18,26 +18,26 @@ const StyledRecentTidItem = styled.div `
|
|
|
18
18
|
min-width: 0;
|
|
19
19
|
padding: 10px;
|
|
20
20
|
position: relative;
|
|
21
|
-
|
|
21
|
+
gap: 0;
|
|
22
22
|
|
|
23
23
|
&:hover {
|
|
24
24
|
cursor: pointer;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
.info-icon {
|
|
28
|
-
position: absolute;
|
|
29
|
-
left: -7px;
|
|
30
|
-
top: calc(50% - 5px);
|
|
31
|
-
transform: translateY(-50%);
|
|
32
28
|
opacity: 0;
|
|
33
|
-
transition: opacity 0.2s;
|
|
34
29
|
pointer-events: none;
|
|
35
|
-
|
|
30
|
+
transition: opacity 0.2s;
|
|
36
31
|
${({ $isMobile }) => $isMobile && `
|
|
37
32
|
display: none !important;
|
|
38
33
|
`}
|
|
39
34
|
}
|
|
40
35
|
|
|
36
|
+
&:hover .info-icon {
|
|
37
|
+
opacity: 1;
|
|
38
|
+
pointer-events: auto;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
41
|
&::after {
|
|
42
42
|
content: '';
|
|
43
43
|
display: block;
|
|
@@ -47,13 +47,8 @@ const StyledRecentTidItem = styled.div `
|
|
|
47
47
|
margin-top: 8px;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
&:hover .info-icon {
|
|
51
|
-
opacity: 1;
|
|
52
|
-
pointer-events: auto;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
50
|
&:last-child {
|
|
56
|
-
border-bottom: none;
|
|
51
|
+
border-bottom: none;
|
|
57
52
|
margin-bottom: 0;
|
|
58
53
|
}
|
|
59
54
|
`;
|
|
@@ -82,7 +77,28 @@ const TMRecentsManager = ({ deviceType, mruTIDs, currentMruTID, onSelectedTID, o
|
|
|
82
77
|
overflow: 'hidden',
|
|
83
78
|
textOverflow: 'ellipsis'
|
|
84
79
|
}, children: `${SDKUI_Localizator.AllDcmtTypes} (${DcmtTypeListCacheService.CacheCount(true)})` }) }) }, 0), recentDcmtTypes.map((dtd) => {
|
|
85
|
-
|
|
80
|
+
const isCurrent = currentMruTID == dtd.id;
|
|
81
|
+
return (_jsxs(StyledRecentTidItem, { id: `tid-${dtd.id}`, "$isMobile": isMobile, onClick: () => { onSelectedTID?.(dtd.id ?? 0); }, children: [_jsxs(StyledDivHorizontal, { style: { alignItems: 'center', gap: 8, width: '100%' }, children: [!isMobile && (_jsx("span", { className: "info-icon", style: {
|
|
82
|
+
marginRight: 4,
|
|
83
|
+
display: 'flex',
|
|
84
|
+
alignItems: 'center'
|
|
85
|
+
}, children: _jsx(TMDcmtTypeTooltip, { dtd: dtd, children: _jsx(IconInfo, { color: TMColors.info }) }) })), _jsx("div", { style: {
|
|
86
|
+
flex: 1,
|
|
87
|
+
display: 'flex',
|
|
88
|
+
alignItems: 'center',
|
|
89
|
+
justifyContent: 'center',
|
|
90
|
+
minWidth: 0
|
|
91
|
+
}, children: _jsx(TMTidViewer, { tid: dtd.id, color: TMColors.primaryColor, showIcon: false }) }), isCurrent && (_jsx("span", { style: {
|
|
92
|
+
width: 24,
|
|
93
|
+
height: 24,
|
|
94
|
+
borderRadius: 24,
|
|
95
|
+
display: 'flex',
|
|
96
|
+
alignItems: 'center',
|
|
97
|
+
justifyContent: 'center',
|
|
98
|
+
fontSize: '1rem',
|
|
99
|
+
fontWeight: 'bold',
|
|
100
|
+
marginLeft: 8
|
|
101
|
+
}, children: _jsx(IconApply, { fontSize: 24, color: 'green' }) }))] }), _jsx(ContextMenu, { dataSource: [
|
|
86
102
|
{
|
|
87
103
|
text: SDKUI_Localizator.Remove,
|
|
88
104
|
icon: iconDelete(),
|
|
@@ -95,20 +111,7 @@ const TMRecentsManager = ({ deviceType, mruTIDs, currentMruTID, onSelectedTID, o
|
|
|
95
111
|
onClick: () => { setInfoDTD(dtd); }
|
|
96
112
|
}
|
|
97
113
|
] : [])
|
|
98
|
-
], target: `#tid-${dtd.id}` }),
|
|
99
|
-
_jsx("div", { style: {
|
|
100
|
-
width: '24px',
|
|
101
|
-
height: '24px',
|
|
102
|
-
borderRadius: '24px',
|
|
103
|
-
position: 'absolute',
|
|
104
|
-
top: '5px',
|
|
105
|
-
right: '0px',
|
|
106
|
-
display: 'flex',
|
|
107
|
-
alignItems: 'center',
|
|
108
|
-
justifyContent: 'center',
|
|
109
|
-
fontSize: '1rem',
|
|
110
|
-
fontWeight: 'bold'
|
|
111
|
-
}, children: _jsx(IconApply, { fontSize: 24, color: 'green' }) })] }, dtd.id));
|
|
114
|
+
], target: `#tid-${dtd.id}` })] }, dtd.id));
|
|
112
115
|
})] }), showDcmtTypeChooser && _jsx(TMDcmtTypeChooserForm, { 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)] })] }));
|
|
113
116
|
};
|
|
114
117
|
export default TMRecentsManager;
|