@topconsultnpm/sdkui-react-beta 6.8.52 → 6.8.53
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/assets/icomoon.svg +96 -96
- package/lib/components/base/Styled.d.ts +23 -1920
- package/lib/components/base/TMAlert.d.ts +2 -3
- package/lib/components/base/TMContextMenuOLD.d.ts +3 -274
- package/lib/components/base/TMDropDownMenu.d.ts +0 -1
- package/lib/components/base/TMEditorBase.d.ts +0 -1
- package/lib/components/base/TMLayout.d.ts +32 -32
- package/lib/components/base/TMRightSidebar.d.ts +4 -4
- package/lib/components/base/TMTab.d.ts +4 -4
- package/lib/components/base/TMVilViewer.d.ts +1 -1
- package/lib/components/choosers/TMRelationChooser.d.ts +5 -5
- package/lib/components/choosers/TMUserChooser.d.ts +5 -5
- package/lib/components/editors/TMEditorStyled.d.ts +21 -22
- package/lib/components/editors/TMMetadataEditor.js +10 -10
- package/lib/components/forms/TMLoginForm.d.ts +5 -5
- package/lib/components/forms/TMLoginPopupSaveLoginInfo.d.ts +2 -2
- package/lib/components/forms/TMLoginPopupSaveLoginInfo.js +118 -29
- package/lib/components/query/TMQueryEditor.d.ts +8 -550
- package/lib/components/query/TMQueryResult.d.ts +5 -5
- package/lib/components/query/TMQueryResultForm.d.ts +10 -10
- package/lib/components/sidebar/TMHeader.d.ts +2 -2
- package/lib/components/viewers/TMDataListItemViewer.d.ts +3 -3
- package/lib/components/viewers/TMMidViewer.d.ts +7 -9
- package/lib/components/viewers/TMMidViewer.js +14 -17
- package/lib/components/viewers/TMTidViewer.d.ts +5 -5
- package/lib/helper/SDKUI_Localizator.d.ts +1 -0
- package/lib/helper/SDKUI_Localizator.js +10 -0
- package/lib/helper/helpers.d.ts +1 -1
- package/lib/hooks/useForm.d.ts +0 -1
- package/lib/hooks/useOutsideClick.d.ts +0 -1
- package/package.json +2 -2
|
@@ -39,11 +39,11 @@ export declare const cultureIDsDataSource: {
|
|
|
39
39
|
}[];
|
|
40
40
|
declare const TMLoginForm: React.FunctionComponent<ITMLoginFormProps>;
|
|
41
41
|
export declare const TMChangePassword: ({ deviceType, tmSession, username, onClose, enable, hasBack }: {
|
|
42
|
-
deviceType?: DeviceType
|
|
43
|
-
hasBack?: boolean
|
|
44
|
-
tmSession?: ITopMediaSession
|
|
42
|
+
deviceType?: DeviceType;
|
|
43
|
+
hasBack?: boolean;
|
|
44
|
+
tmSession?: ITopMediaSession;
|
|
45
45
|
username: string;
|
|
46
|
-
onClose?: (
|
|
47
|
-
enable?: boolean
|
|
46
|
+
onClose?: () => void;
|
|
47
|
+
enable?: boolean;
|
|
48
48
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
49
49
|
export default TMLoginForm;
|
|
@@ -31,12 +31,12 @@ interface TMItemTitleRender {
|
|
|
31
31
|
reloadHistoryState: () => void;
|
|
32
32
|
fillLoginForm: (data: ITMLoginHistory) => void;
|
|
33
33
|
deleteItemFromLocalStorage: (name: string) => void;
|
|
34
|
+
setSearchText: React.Dispatch<React.SetStateAction<string>>;
|
|
34
35
|
}
|
|
35
|
-
export declare const TMItemTitleRender: (props: TMItemTitleRender) => import("react/jsx-runtime").JSX.Element
|
|
36
|
+
export declare const TMItemTitleRender: (props: TMItemTitleRender) => import("react/jsx-runtime").JSX.Element;
|
|
36
37
|
interface TMLoginItemTemplateProps {
|
|
37
38
|
data: ITMLoginHistory;
|
|
38
39
|
reloadHistoryState: () => void;
|
|
39
|
-
setSelectedItems: React.Dispatch<React.SetStateAction<ITMLoginHistory[]>>;
|
|
40
40
|
setSearchText: React.Dispatch<React.SetStateAction<string>>;
|
|
41
41
|
}
|
|
42
42
|
export declare const TMLoginItemTemplate: React.FC<TMLoginItemTemplateProps>;
|
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import { cultureIDsDataSource, LOGIN_HISTORY_KEY
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import { Button, LoadIndicator, Popup } from "devextreme-react";
|
|
4
|
+
import { cultureIDsDataSource, LOGIN_HISTORY_KEY } from "./TMLoginForm";
|
|
5
5
|
import { AuthenticationModes, LocalStorageService, ResultTypes, SDK_Localizator, ValidationItem } from "@topconsultnpm/sdk-ts-beta";
|
|
6
|
-
import { Item } from "devextreme-react/cjs/accordion";
|
|
7
6
|
import { SDKUI_Localizator } from "../../helper/SDKUI_Localizator";
|
|
8
7
|
import { ButtonNames, TMExceptionBoxManager, TMMessageBoxManager } from "../base/TMPopUp";
|
|
9
8
|
import TMTooltip from "../base/TMTooltip";
|
|
10
|
-
import
|
|
9
|
+
import { IconApplyAndClose, IconCloseOutline, IconDelete, IconExport, IconImport, IconShow } from "../../helper";
|
|
11
10
|
import { TMSearchBar } from "../sidebar/TMHeader";
|
|
12
|
-
import { IconApplyAndClose, IconCloseOutline, IconDelete, IconExport, IconImport } from "../../helper";
|
|
13
11
|
import TMButton from "../base/TMButton";
|
|
12
|
+
import TMTextBox from "../editors/TMTextBox";
|
|
14
13
|
const TMLoginPopupSaveLoginInfo = (props) => {
|
|
15
14
|
const { setLoginHistory, visible, hidePopup, setEndpoint, setArchive, setAuthMode, setUsername, setPassword, setDomain, setDomainArternative, setOnBeHalfUsername, setOnBeHalfPassword, setLoadLoginInfoFromExternal, onChangeLanguage } = props;
|
|
16
15
|
// State to manage loading status
|
|
17
16
|
const [loading, setLoading] = useState(false);
|
|
18
17
|
// State to store the search input text
|
|
19
18
|
const [searchText, setSearchText] = useState('');
|
|
20
|
-
// State to store selected items of type ITMLoginHistory
|
|
21
|
-
const [selectedItems, setSelectedItems] = useState([]);
|
|
22
19
|
// Retrieve the login history from local storage, sort by 'name', and return the sorted array (or an empty array if not found)
|
|
23
20
|
const getSortedLoginHistory = () => {
|
|
24
21
|
const loginHistory = LocalStorageService.getItem(LOGIN_HISTORY_KEY);
|
|
@@ -58,11 +55,6 @@ const TMLoginPopupSaveLoginInfo = (props) => {
|
|
|
58
55
|
searchedLoginHistory: updatedLoginHistory,
|
|
59
56
|
});
|
|
60
57
|
};
|
|
61
|
-
// Update selected items with the last added item from the event (or an empty array if none were added)
|
|
62
|
-
const onSelectionChanged = (e) => {
|
|
63
|
-
const newItems = e.addedItems.length ? [e.addedItems[e.addedItems.length - 1]] : [];
|
|
64
|
-
setSelectedItems(newItems);
|
|
65
|
-
};
|
|
66
58
|
// Populate the login form fields with data from the selected login history item
|
|
67
59
|
const fillLoginForm = (data) => {
|
|
68
60
|
setEndpoint(data.endpoint);
|
|
@@ -91,7 +83,6 @@ const TMLoginPopupSaveLoginInfo = (props) => {
|
|
|
91
83
|
LocalStorageService.deleteItemByField(LOGIN_HISTORY_KEY, "name", name);
|
|
92
84
|
setLoginHistory(LocalStorageService.getItem(LOGIN_HISTORY_KEY) ?? []);
|
|
93
85
|
reloadHistoryState();
|
|
94
|
-
setSelectedItems([]);
|
|
95
86
|
}
|
|
96
87
|
catch (e) {
|
|
97
88
|
TMExceptionBoxManager.show({ exception: e });
|
|
@@ -200,19 +191,40 @@ const TMLoginPopupSaveLoginInfo = (props) => {
|
|
|
200
191
|
if (historyState.searchedLoginHistory.length === 0) {
|
|
201
192
|
return (_jsx("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", textAlign: "center", padding: "20px" }, children: SDKUI_Localizator.NoCredentialsSaved }));
|
|
202
193
|
}
|
|
203
|
-
return (_jsx("div", { style: { overflowY: "auto", maxHeight: "calc(100% - 60px)", padding: "
|
|
194
|
+
return (_jsx("div", { style: { overflowY: "auto", maxHeight: "calc(100% - 60px)", padding: "0px 5px", margin: '0px 10px', border: "1px solid rgb(221, 221, 221)", borderRadius: '6px' }, children: historyState.searchedLoginHistory.map((data, index) => {
|
|
195
|
+
return _jsx(TMItemTitleRender, { titleObj: { title: data.name }, id: index + 1, historyState: historyState, reloadHistoryState: reloadHistoryState, fillLoginForm: fillLoginForm, deleteItemFromLocalStorage: deleteItemFromLocalStorage, setSearchText: setSearchText }, data.name + '-' + index);
|
|
196
|
+
}) }));
|
|
204
197
|
};
|
|
205
198
|
return (_jsxs(Popup, { maxWidth: 600, visible: visible, onHiding: closePopup, title: SDKUI_Localizator.SwitchUser, titleRender: titleRender, hideOnOutsideClick: false, showTitle: true, resizeEnabled: true, dragEnabled: true, showCloseButton: true, children: [_jsxs("div", { style: { padding: "10px", display: "flex", justifyContent: "space-between", alignItems: "center", width: "100%", position: "sticky", top: 0, backgroundColor: "#fff", zIndex: 1, }, children: [_jsx("div", { style: { display: "flex", flex: 1 }, children: _jsx(TMSearchBar, { maxWidth: "200px", marginLeft: "0px", onSearchValueChanged: (e) => setSearchText(e), searchValue: searchText }) }), _jsxs("div", { style: { display: "flex", alignItems: "center", marginRight: "5px", gap: 8 }, children: [_jsx(TMTooltip, { content: SDKUI_Localizator.Export, children: _jsx(TMButton, { label: SDKUI_Localizator.Export, color: 'primary', btnStyle: 'toolbar', icon: _jsx(IconExport, {}), onClick: onExportCallback }) }), _jsx(TMTooltip, { content: SDKUI_Localizator.Import, children: _jsx(TMButton, { label: SDKUI_Localizator.Import, color: 'secondary', btnStyle: 'toolbar', icon: _jsx(IconImport, {}), onClick: onImportCallback }) })] })] }), renderPopupContent()] }));
|
|
206
199
|
};
|
|
207
200
|
export default TMLoginPopupSaveLoginInfo;
|
|
208
201
|
// Render a styled title with its ID and title content, using flex layout
|
|
209
202
|
export const TMItemTitleRender = (props) => {
|
|
210
|
-
const { titleObj, id, historyState, reloadHistoryState, fillLoginForm, deleteItemFromLocalStorage } = props;
|
|
203
|
+
const { titleObj, id, historyState, reloadHistoryState, fillLoginForm, deleteItemFromLocalStorage, setSearchText } = props;
|
|
211
204
|
const historyItem = historyState.loginHistory.find(item => item.name === titleObj.title);
|
|
212
205
|
const [preferred, setPreferred] = useState(historyItem?.preferred ?? false);
|
|
206
|
+
const [isSelected, setIsSelected] = useState(false);
|
|
207
|
+
const [showDetails, setShowDetails] = useState(false);
|
|
208
|
+
const containerRef = useRef(null);
|
|
209
|
+
const mobileBreakpoint = 768;
|
|
213
210
|
const [isMobile, setIsMobile] = useState(false);
|
|
214
|
-
|
|
215
|
-
|
|
211
|
+
useEffect(() => {
|
|
212
|
+
const updateDimensions = (entries) => {
|
|
213
|
+
for (let entry of entries) {
|
|
214
|
+
const { width } = entry.contentRect;
|
|
215
|
+
setIsMobile(width <= mobileBreakpoint);
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
const resizeObserver = new ResizeObserver(updateDimensions);
|
|
219
|
+
if (containerRef.current) {
|
|
220
|
+
resizeObserver.observe(containerRef.current);
|
|
221
|
+
}
|
|
222
|
+
return () => {
|
|
223
|
+
if (containerRef.current) {
|
|
224
|
+
resizeObserver.unobserve(containerRef.current);
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
}, [containerRef]);
|
|
216
228
|
useEffect(() => {
|
|
217
229
|
const mediaQuery = window.matchMedia('(max-width: 768px)');
|
|
218
230
|
const handleResize = () => {
|
|
@@ -225,9 +237,13 @@ export const TMItemTitleRender = (props) => {
|
|
|
225
237
|
};
|
|
226
238
|
}, []);
|
|
227
239
|
useEffect(() => {
|
|
240
|
+
if (historyItem === undefined)
|
|
241
|
+
return;
|
|
228
242
|
setPreferred(historyItem.preferred ?? false);
|
|
229
|
-
}, [historyItem
|
|
243
|
+
}, [historyItem?.preferred]);
|
|
230
244
|
useEffect(() => {
|
|
245
|
+
if (historyItem === undefined)
|
|
246
|
+
return;
|
|
231
247
|
if (preferred === historyItem.preferred)
|
|
232
248
|
return;
|
|
233
249
|
const historyStateUpdtated = historyState.loginHistory.map(history => {
|
|
@@ -239,6 +255,14 @@ export const TMItemTitleRender = (props) => {
|
|
|
239
255
|
LocalStorageService.setItem(LOGIN_HISTORY_KEY, historyStateUpdtated);
|
|
240
256
|
reloadHistoryState();
|
|
241
257
|
}, [preferred]);
|
|
258
|
+
// Handle double-click to show the details component with a transition
|
|
259
|
+
const toogleShowDetails = (e) => {
|
|
260
|
+
if (e === undefined)
|
|
261
|
+
return;
|
|
262
|
+
e.preventDefault();
|
|
263
|
+
e.stopPropagation();
|
|
264
|
+
setShowDetails(prevState => !prevState);
|
|
265
|
+
};
|
|
242
266
|
const onPreferredCallback = (e) => {
|
|
243
267
|
if (e === undefined || e.event === undefined)
|
|
244
268
|
return;
|
|
@@ -259,18 +283,33 @@ export const TMItemTitleRender = (props) => {
|
|
|
259
283
|
}
|
|
260
284
|
});
|
|
261
285
|
};
|
|
286
|
+
const handleMouseEnter = () => {
|
|
287
|
+
// Highlight the div on mouse enter
|
|
288
|
+
setIsSelected(true);
|
|
289
|
+
};
|
|
290
|
+
const handleMouseLeave = () => {
|
|
291
|
+
// Remove highlight when mouse leaves the div
|
|
292
|
+
setIsSelected(false);
|
|
293
|
+
};
|
|
262
294
|
const onLoginCallback = (e) => {
|
|
263
|
-
if (
|
|
295
|
+
if (historyItem === undefined)
|
|
264
296
|
return;
|
|
265
|
-
e
|
|
266
|
-
|
|
297
|
+
if (e === undefined)
|
|
298
|
+
return;
|
|
299
|
+
// If it's a valid click on the parent div, proceed
|
|
300
|
+
e.preventDefault();
|
|
301
|
+
e.stopPropagation();
|
|
302
|
+
// Assuming fillLoginForm is a function that handles the form filling
|
|
267
303
|
fillLoginForm(historyItem);
|
|
268
304
|
};
|
|
269
305
|
const onDeleteCallback = (e) => {
|
|
270
|
-
if (
|
|
306
|
+
if (historyItem === undefined)
|
|
271
307
|
return;
|
|
272
|
-
e
|
|
273
|
-
|
|
308
|
+
if (e === undefined)
|
|
309
|
+
return;
|
|
310
|
+
// If it's a valid click on the parent div, proceed
|
|
311
|
+
e.preventDefault();
|
|
312
|
+
e.stopPropagation();
|
|
274
313
|
deleteItemFromLocalStorage(historyItem.name);
|
|
275
314
|
};
|
|
276
315
|
// Function to truncate title for mobile devices
|
|
@@ -279,13 +318,64 @@ export const TMItemTitleRender = (props) => {
|
|
|
279
318
|
};
|
|
280
319
|
// Function to truncate title for non-mobile devices
|
|
281
320
|
const truncateForDesktop = (title) => {
|
|
282
|
-
return title.length >
|
|
321
|
+
return title.length > 45 ? `${title.substring(0, 45)}...` : title;
|
|
283
322
|
};
|
|
284
323
|
const truncatedTitle = isMobile ? truncateForMobile(titleObj.title) : truncateForDesktop(titleObj.title);
|
|
285
|
-
return _jsxs("div", {
|
|
324
|
+
return _jsxs("div", { ref: containerRef, children: [_jsxs("div", { onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onDoubleClick: onLoginCallback, style: {
|
|
325
|
+
backgroundColor: isSelected ? '#F5F5F5' : 'transparent',
|
|
326
|
+
display: "flex",
|
|
327
|
+
fontFamily: "Arial, sans-serif",
|
|
328
|
+
width: "100%",
|
|
329
|
+
position: "relative",
|
|
330
|
+
whiteSpace: "nowrap",
|
|
331
|
+
cursor: "pointer",
|
|
332
|
+
alignItems: "center",
|
|
333
|
+
userSelect: "none",
|
|
334
|
+
touchAction: "none",
|
|
335
|
+
borderRadius: "4px",
|
|
336
|
+
minHeight: "32px",
|
|
337
|
+
padding: "6px 8px"
|
|
338
|
+
}, children: [_jsx("div", { style: { display: "inline-block", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", width: isMobile ? "72%" : "85%", verticalAlign: "top" }, children: _jsxs("div", { style: { display: "inline-flex", alignItems: "center" }, children: [_jsx(TMTooltip, { content: SDKUI_Localizator.SetAsFavorite, children: _jsxs("div", { style: { paddingTop: "5px", paddingBottom: "5px", paddingRight: "10px" }, children: [preferred && _jsx(Button, { width: 27, height: 27, style: { backgroundColor: '#EAD303', borderRadius: '50%', display: 'inline-flex', justifyContent: 'center', alignItems: 'center' }, icon: "favorites", onClick: onPreferredCallback }), !preferred && _jsx(Button, { width: 27, height: 27, style: { backgroundColor: 'transparent', borderRadius: '50%', display: 'inline-flex', justifyContent: 'center', alignItems: 'center' }, icon: "favorites", onClick: onPreferredCallback })] }) }), _jsx(TMTooltip, { content: titleObj.title, children: _jsxs("div", { style: { fontSize: isMobile ? "11px" : "12px" }, children: ["(", id, ")\u00A0", _jsx("span", { style: { fontWeight: "bold" }, children: truncatedTitle })] }) })] }) }), _jsx("div", { style: { display: "inline-block", position: "absolute", right: 0, textAlign: "right", verticalAlign: "top", whiteSpace: "nowrap" }, children: _jsxs("div", { style: { display: 'inline-flex', gap: '10px' }, children: [isMobile && _jsx(TMTooltip, { content: SDKUI_Localizator.ApplyAndClose, children: _jsx("div", { onClick: onLoginCallback, onDoubleClick: (e) => { e.preventDefault(); e.stopPropagation(); }, style: {
|
|
339
|
+
width: 27,
|
|
340
|
+
height: 27,
|
|
341
|
+
backgroundColor: '#6EB735',
|
|
342
|
+
borderRadius: '50%',
|
|
343
|
+
display: 'inline-flex',
|
|
344
|
+
justifyContent: 'center',
|
|
345
|
+
alignItems: 'center',
|
|
346
|
+
cursor: 'pointer'
|
|
347
|
+
}, children: _jsx(IconApplyAndClose, { color: "#fff" }) }) }), _jsx(TMTooltip, { content: SDKUI_Localizator.ShowDetails, children: _jsx("div", { onClick: toogleShowDetails, onDoubleClick: (e) => { e.preventDefault(); e.stopPropagation(); }, style: {
|
|
348
|
+
width: 27,
|
|
349
|
+
height: 27,
|
|
350
|
+
backgroundColor: '#2559A5',
|
|
351
|
+
borderRadius: '50%',
|
|
352
|
+
display: 'inline-flex',
|
|
353
|
+
justifyContent: 'center',
|
|
354
|
+
alignItems: 'center',
|
|
355
|
+
cursor: 'pointer'
|
|
356
|
+
}, children: _jsx(IconShow, { color: "#fff" }) }) }), _jsx(TMTooltip, { content: SDKUI_Localizator.Delete, children: _jsx("div", { onClick: onDeleteCallback, onDoubleClick: (e) => { e.preventDefault(); e.stopPropagation(); }, style: {
|
|
357
|
+
width: 27,
|
|
358
|
+
height: 27,
|
|
359
|
+
backgroundColor: '#ED153A',
|
|
360
|
+
borderRadius: '50%',
|
|
361
|
+
display: 'inline-flex',
|
|
362
|
+
justifyContent: 'center',
|
|
363
|
+
alignItems: 'center',
|
|
364
|
+
cursor: 'pointer'
|
|
365
|
+
}, children: _jsx(IconDelete, { color: "#fff" }) }) })] }) })] }), _jsx("div", { style: {
|
|
366
|
+
marginTop: "10px",
|
|
367
|
+
maxHeight: showDetails ? "500px" : "0", // Use max-height for transition
|
|
368
|
+
opacity: showDetails ? 1 : 0,
|
|
369
|
+
overflow: 'hidden',
|
|
370
|
+
transition: showDetails ?
|
|
371
|
+
'max-height 1s ease-in-out, opacity 1s ease-in-out' : // Slow transition for showing
|
|
372
|
+
'max-height 0.5s ease-out, opacity 0.5s ease-out', // Fast transition for hiding
|
|
373
|
+
transform: showDetails ? 'scaleY(1)' : 'scaleY(0)',
|
|
374
|
+
transformOrigin: 'top', // Ensures the animation grows from top to bottom
|
|
375
|
+
}, children: _jsx(TMLoginItemTemplate, { data: historyItem, reloadHistoryState: reloadHistoryState, setSearchText: setSearchText }) })] });
|
|
286
376
|
};
|
|
287
377
|
export const TMLoginItemTemplate = (props) => {
|
|
288
|
-
const { data, reloadHistoryState,
|
|
378
|
+
const { data, reloadHistoryState, setSearchText } = props;
|
|
289
379
|
const [name, setName] = useState(data.name);
|
|
290
380
|
const [error, setError] = useState(false);
|
|
291
381
|
const [validationItems, setValidationItems] = useState([]);
|
|
@@ -304,7 +394,6 @@ export const TMLoginItemTemplate = (props) => {
|
|
|
304
394
|
const dataToUpdate = { ...data, name };
|
|
305
395
|
LocalStorageService.updateItemByField(LOGIN_HISTORY_KEY, "name", data.name, dataToUpdate);
|
|
306
396
|
reloadHistoryState();
|
|
307
|
-
setSelectedItems([]);
|
|
308
397
|
setSearchText("");
|
|
309
398
|
}
|
|
310
399
|
};
|