@topconsultnpm/sdkui-react-beta 6.7.24 → 6.7.25
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 +1919 -22
- package/lib/components/base/TMAlert.d.ts +3 -2
- package/lib/components/base/TMButton.d.ts +7 -7
- package/lib/components/base/TMContextMenuOLD.d.ts +274 -3
- package/lib/components/base/TMDropDownMenu.d.ts +1 -0
- package/lib/components/base/TMEditorBase.d.ts +1 -0
- package/lib/components/base/TMLayout.d.ts +36 -36
- package/lib/components/base/TMTab.d.ts +4 -4
- package/lib/components/base/TMVilViewer.d.ts +1 -1
- package/lib/components/choosers/TMUserChooser.d.ts +5 -5
- package/lib/components/editors/TMEditorStyled.d.ts +21 -20
- package/lib/components/editors/TMMetadataEditor.d.ts +2 -1
- package/lib/components/editors/TMMetadataEditor.js +10 -10
- package/lib/components/forms/TMLoginForm.d.ts +6 -5
- package/lib/components/forms/TMLoginForm.js +24 -1
- package/lib/components/forms/TMLoginPopupSaveLoginInfo.d.ts +4 -0
- package/lib/components/forms/TMLoginPopupSaveLoginInfo.js +29 -13
- package/lib/components/forms/TMSaveForm.d.ts +7 -7
- package/lib/components/query/TMQueryEditor.d.ts +550 -8
- 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 +5 -5
- package/lib/components/viewers/TMTidViewer.d.ts +5 -5
- package/lib/helper/SDKUI_Localizator.d.ts +1 -1
- package/lib/helper/SDKUI_Localizator.js +7 -7
- package/lib/helper/helpers.d.ts +1 -1
- package/lib/hooks/useForm.d.ts +1 -0
- package/lib/hooks/useOutsideClick.d.ts +1 -0
- package/package.json +1 -1
|
@@ -17,6 +17,7 @@ export interface ITMLoginHistory {
|
|
|
17
17
|
username: string;
|
|
18
18
|
language: CultureIDs;
|
|
19
19
|
onBehalfUsername: string;
|
|
20
|
+
preferred: boolean;
|
|
20
21
|
}
|
|
21
22
|
export type TMEndpointsType = {
|
|
22
23
|
Description: string;
|
|
@@ -38,11 +39,11 @@ export declare const cultureIDsDataSource: {
|
|
|
38
39
|
}[];
|
|
39
40
|
declare const TMLoginForm: React.FunctionComponent<ITMLoginFormProps>;
|
|
40
41
|
export declare const TMChangePassword: ({ deviceType, tmSession, username, onClose, enable, hasBack }: {
|
|
41
|
-
deviceType?: DeviceType;
|
|
42
|
-
hasBack?: boolean;
|
|
43
|
-
tmSession?: ITopMediaSession;
|
|
42
|
+
deviceType?: DeviceType | undefined;
|
|
43
|
+
hasBack?: boolean | undefined;
|
|
44
|
+
tmSession?: ITopMediaSession | undefined;
|
|
44
45
|
username: string;
|
|
45
|
-
onClose?: () => void;
|
|
46
|
-
enable?: boolean;
|
|
46
|
+
onClose?: (() => void) | undefined;
|
|
47
|
+
enable?: boolean | undefined;
|
|
47
48
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
48
49
|
export default TMLoginForm;
|
|
@@ -117,6 +117,28 @@ const TMLoginForm = (props) => {
|
|
|
117
117
|
const [saveLoginInfo, setSaveLoginInfo] = useState(false);
|
|
118
118
|
const [saveLoginInfoName, setSaveLoginInfoName] = useState("");
|
|
119
119
|
const [loginHistory, setLoginHistory] = useState(LocalStorageService.getItem(LOGIN_HISTORY_KEY) ?? []);
|
|
120
|
+
const [preferredLoginItem, setPreferredLoginItem] = useState(undefined);
|
|
121
|
+
useEffect(() => {
|
|
122
|
+
if (props.saveLoginHistoryToLocalStorage && loginHistory.length > 0) {
|
|
123
|
+
setPreferredLoginItem(loginHistory.find(item => item.preferred));
|
|
124
|
+
}
|
|
125
|
+
}, []);
|
|
126
|
+
useEffect(() => {
|
|
127
|
+
if (props.saveLoginHistoryToLocalStorage && preferredLoginItem !== undefined) {
|
|
128
|
+
setEndpoint(preferredLoginItem.endpoint);
|
|
129
|
+
setArchive(preferredLoginItem.archive);
|
|
130
|
+
setUsername(preferredLoginItem.username);
|
|
131
|
+
setPassword("");
|
|
132
|
+
setAuthMode(preferredLoginItem.authenticationMode);
|
|
133
|
+
setDomain(preferredLoginItem.domain);
|
|
134
|
+
setDomainArternative(preferredLoginItem.domainAlternative);
|
|
135
|
+
setOnBeHalfUsername(preferredLoginItem.onBehalfUsername);
|
|
136
|
+
setOnBeHalfPassword("");
|
|
137
|
+
if (props.onChangeLanguage) {
|
|
138
|
+
props.onChangeLanguage(preferredLoginItem.language);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}, [preferredLoginItem]);
|
|
120
142
|
useEffect(() => {
|
|
121
143
|
let interval;
|
|
122
144
|
if (recoveryPasswordState.step === 2 && wait > 0) {
|
|
@@ -141,7 +163,7 @@ const TMLoginForm = (props) => {
|
|
|
141
163
|
useEffect(() => {
|
|
142
164
|
setEndpoints(props.endpoints);
|
|
143
165
|
if (props.sdInput) {
|
|
144
|
-
if (props.sdInput.userName)
|
|
166
|
+
if (props.sdInput.userName && preferredLoginItem === undefined)
|
|
145
167
|
setUsername(props.sdInput.userName);
|
|
146
168
|
}
|
|
147
169
|
}, []);
|
|
@@ -696,6 +718,7 @@ const TMLoginForm = (props) => {
|
|
|
696
718
|
username: username,
|
|
697
719
|
language: props.cultureID ?? CultureIDs.None,
|
|
698
720
|
onBehalfUsername: onBehalfUsername,
|
|
721
|
+
preferred: false
|
|
699
722
|
};
|
|
700
723
|
updateLoginHistory(loginHistoryNewEntry);
|
|
701
724
|
}
|
|
@@ -25,5 +25,9 @@ interface TMLoginItemTemplateProps {
|
|
|
25
25
|
deleteItemFromLocalStorage: (name: string) => void;
|
|
26
26
|
setSelectedItems: React.Dispatch<React.SetStateAction<ITMLoginHistory[]>>;
|
|
27
27
|
setSearchText: React.Dispatch<React.SetStateAction<string>>;
|
|
28
|
+
historyState: {
|
|
29
|
+
loginHistory: Array<ITMLoginHistory>;
|
|
30
|
+
searchedLoginHistory: Array<ITMLoginHistory>;
|
|
31
|
+
};
|
|
28
32
|
}
|
|
29
33
|
export declare const TMLoginItemTemplate: React.FC<TMLoginItemTemplateProps>;
|
|
@@ -9,6 +9,7 @@ import { ButtonNames, TMExceptionBoxManager, TMMessageBoxManager } from "../base
|
|
|
9
9
|
import TMTooltip from "../base/TMTooltip";
|
|
10
10
|
import TMTextBox from "../editors/TMTextBox";
|
|
11
11
|
import { TMSearchBar } from "../sidebar/TMHeader";
|
|
12
|
+
import TMCheckBox from "../editors/TMCheckBox";
|
|
12
13
|
const TMLoginPopupSaveLoginInfo = (props) => {
|
|
13
14
|
const { setLoginHistory, visible, hidePopup, setEndpoint, setArchive, setAuthMode, setUsername, setPassword, setDomain, setDomainArternative, setOnBeHalfUsername, setOnBeHalfPassword, onChangeLanguage } = props;
|
|
14
15
|
// State to manage loading status
|
|
@@ -105,7 +106,8 @@ const TMLoginPopupSaveLoginInfo = (props) => {
|
|
|
105
106
|
const titleRender = () => (_jsxs("div", { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', width: '100%' }, children: [_jsx("h3", { children: SDKUI_Localizator.SwitchUser }), _jsx("button", { style: { background: 'none', border: 'none', fontSize: '16px', cursor: 'pointer' }, onClick: hidePopup, children: _jsx("i", { style: { fontSize: 20 }, className: "dx-icon-remove" }) })] }));
|
|
106
107
|
// Render a styled title with its ID and title content, using flex layout
|
|
107
108
|
const itemTitleRender = (titleObj, id) => {
|
|
108
|
-
|
|
109
|
+
const historyItem = historyState.loginHistory.find(item => item.name === titleObj.title);
|
|
110
|
+
return _jsxs("div", { style: { display: "flex", gap: "20px", fontFamily: "Arial, sans-serif" }, children: [_jsx("div", { style: { padding: "10px", border: "1px solid #ddd", borderRadius: "10px", }, children: id }), _jsx("div", { style: { padding: "10px", fontWeight: "bold", border: "1px solid #ddd", borderRadius: "10px", }, children: titleObj.title }), historyItem?.preferred && _jsx(TMTooltip, { position: "right", content: SDKUI_Localizator.SetAsFavorite, children: _jsx("div", { style: { padding: "10px", border: "1px solid #ddd", borderRadius: "10px", }, children: _jsx("i", { className: "dx-icon-favorites" }) }) })] });
|
|
109
111
|
};
|
|
110
112
|
// Conditionally render popup content based on loading state, available login history, or display login items in an accordion
|
|
111
113
|
const renderPopupContent = () => {
|
|
@@ -115,17 +117,19 @@ const TMLoginPopupSaveLoginInfo = (props) => {
|
|
|
115
117
|
if (historyState.searchedLoginHistory.length === 0) {
|
|
116
118
|
return (_jsx("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", textAlign: "center", padding: "20px" }, children: SDKUI_Localizator.NoCredentialsSaved }));
|
|
117
119
|
}
|
|
118
|
-
return (_jsx("div", { style: { overflowY: "auto", maxHeight: "calc(100% - 60px)", padding: "10px" }, children: _jsx(Accordion, { selectedItems: selectedItems, onSelectionChanged: onSelectionChanged, collapsible: true, multiple: false, animationDuration: 300, noDataText: SDKUI_Localizator.NoCredentialsSaved, style: { border: "1px solid #ddd", borderRadius: "6px", boxShadow: "0 2px 6px rgba(0, 0, 0, 0.1)" }, children: historyState.searchedLoginHistory.map((data, index) => (_jsx(Item, { titleRender: (titleObj) => itemTitleRender(titleObj, index), title: data.name, children: _jsx(TMLoginItemTemplate, { data: data, reloadHistoryState: reloadHistoryState, fillLoginForm: fillLoginForm, deleteItemFromLocalStorage: deleteItemFromLocalStorage, setSelectedItems: setSelectedItems, setSearchText: setSearchText }) }, data.id))) }) }));
|
|
120
|
+
return (_jsx("div", { style: { overflowY: "auto", maxHeight: "calc(100% - 60px)", padding: "10px" }, children: _jsx(Accordion, { selectedItems: selectedItems, onSelectionChanged: onSelectionChanged, collapsible: true, multiple: false, animationDuration: 300, noDataText: SDKUI_Localizator.NoCredentialsSaved, style: { border: "1px solid #ddd", borderRadius: "6px", boxShadow: "0 2px 6px rgba(0, 0, 0, 0.1)" }, children: historyState.searchedLoginHistory.map((data, index) => (_jsx(Item, { titleRender: (titleObj) => itemTitleRender(titleObj, index), title: data.name, children: _jsx(TMLoginItemTemplate, { data: data, reloadHistoryState: reloadHistoryState, fillLoginForm: fillLoginForm, deleteItemFromLocalStorage: deleteItemFromLocalStorage, setSelectedItems: setSelectedItems, setSearchText: setSearchText, historyState: historyState }) }, data.id))) }) }));
|
|
119
121
|
};
|
|
120
122
|
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: [_jsx("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", width: "100%", position: "sticky", top: 0, backgroundColor: "#fff", zIndex: 1, padding: "10px 0" }, children: _jsx(TMSearchBar, { maxWidth: "200px", marginLeft: "0px", onSearchValueChanged: (e) => setSearchText(e), searchValue: searchText }) }), renderPopupContent()] }));
|
|
121
123
|
};
|
|
122
124
|
export default TMLoginPopupSaveLoginInfo;
|
|
123
125
|
export const TMLoginItemTemplate = (props) => {
|
|
124
|
-
const { data, fillLoginForm, reloadHistoryState, deleteItemFromLocalStorage, setSelectedItems, setSearchText } = props;
|
|
126
|
+
const { data, fillLoginForm, reloadHistoryState, deleteItemFromLocalStorage, setSelectedItems, setSearchText, historyState } = props;
|
|
125
127
|
const [name, setName] = useState(data.name);
|
|
128
|
+
const [preferred, setPreferred] = useState(data.preferred ?? false);
|
|
126
129
|
const [error, setError] = useState(false);
|
|
127
130
|
const [validationItems, setValidationItems] = useState([]);
|
|
128
|
-
const
|
|
131
|
+
const isNameMatching = data.name.trim().toLowerCase() === name.trim().toLowerCase();
|
|
132
|
+
const isPreferredMatching = data.preferred === preferred;
|
|
129
133
|
// Effect to handle validation side-effects (like setting error state)
|
|
130
134
|
useEffect(() => {
|
|
131
135
|
const validationsItems = getValidationItems();
|
|
@@ -133,19 +137,31 @@ export const TMLoginItemTemplate = (props) => {
|
|
|
133
137
|
setError(validationsItems.length > 0); // Set error state based on validation result
|
|
134
138
|
}, [name]); // Only re-run when 'name' changes
|
|
135
139
|
// Update the login history item name in local storage if no errors and name is different from the initial name
|
|
136
|
-
const
|
|
137
|
-
if (error ||
|
|
140
|
+
const updateHandler = () => {
|
|
141
|
+
if (error || (isNameMatching && isPreferredMatching))
|
|
138
142
|
return;
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
143
|
+
if (!isNameMatching) {
|
|
144
|
+
const dataToUpdate = { ...data, name };
|
|
145
|
+
LocalStorageService.updateItemByField(LOGIN_HISTORY_KEY, "name", data.name, dataToUpdate);
|
|
146
|
+
reloadHistoryState();
|
|
147
|
+
setSelectedItems([]);
|
|
148
|
+
setSearchText("");
|
|
149
|
+
}
|
|
150
|
+
if (!isPreferredMatching) {
|
|
151
|
+
const historyStateUpdtated = historyState.loginHistory.map(history => {
|
|
152
|
+
if (history.name === data.name) {
|
|
153
|
+
return { ...history, preferred };
|
|
154
|
+
}
|
|
155
|
+
return { ...history, preferred: false };
|
|
156
|
+
});
|
|
157
|
+
LocalStorageService.setItem(LOGIN_HISTORY_KEY, historyStateUpdtated);
|
|
158
|
+
reloadHistoryState();
|
|
159
|
+
}
|
|
144
160
|
};
|
|
145
161
|
// Validation logic function
|
|
146
162
|
const getValidationItems = () => {
|
|
147
163
|
const validationsArray = [];
|
|
148
|
-
if (
|
|
164
|
+
if (isNameMatching)
|
|
149
165
|
return validationsArray;
|
|
150
166
|
if (name.length === 0)
|
|
151
167
|
validationsArray.push(new ValidationItem(ResultTypes.ERROR, 'saveLoginName', SDK_Localizator.RequiredField));
|
|
@@ -192,5 +208,5 @@ export const TMLoginItemTemplate = (props) => {
|
|
|
192
208
|
const randomBGColor = getRandomColorFromText(data.name);
|
|
193
209
|
// Determine the text color (black or white) based on background color luminance
|
|
194
210
|
const textColor = getTextColor(randomBGColor);
|
|
195
|
-
return _jsxs("div", { style: { display: 'flex', background: '#fff', boxShadow: '0 4px 20px rgba(0, 0, 0, 0.1)', overflow: 'hidden', width: '100%', justifyContent: 'center', alignItems: 'center' }, children: [_jsx(TMTooltip, { content: data.name, children: _jsx("div", { style: { background: randomBGColor, color: textColor, display: 'flex', justifyContent: 'center', alignItems: 'center', width: '15vw', height: '15vw', maxWidth: '70px', maxHeight: '70px', borderRadius: '50%', fontWeight: 'bold', margin: '20px', textAlign: 'center' }, children: data.name.slice(0, 3).toUpperCase() }) }), _jsxs("div", { style: { padding: '2px', flex: 1 }, children: [_jsx(TMTextBox, { type: "text", label: SDKUI_Localizator.NameForAccess, value: name, readOnly: false, buttons: [{ text: `${SDKUI_Localizator.Save}`, icon: _jsx("i", { style: { color: (error ||
|
|
211
|
+
return _jsxs("div", { style: { display: 'flex', background: '#fff', boxShadow: '0 4px 20px rgba(0, 0, 0, 0.1)', overflow: 'hidden', width: '100%', justifyContent: 'center', alignItems: 'center' }, children: [_jsx(TMTooltip, { content: data.name, children: _jsx("div", { style: { background: randomBGColor, color: textColor, display: 'flex', justifyContent: 'center', alignItems: 'center', width: '15vw', height: '15vw', maxWidth: '70px', maxHeight: '70px', borderRadius: '50%', fontWeight: 'bold', margin: '20px', textAlign: 'center' }, children: data.name.slice(0, 3).toUpperCase() }) }), _jsxs("div", { style: { padding: '2px', flex: 1 }, children: [_jsx(TMTextBox, { type: "text", label: SDKUI_Localizator.NameForAccess, value: name, readOnly: false, buttons: [{ text: `${SDKUI_Localizator.Save}`, icon: _jsx("i", { style: { color: (error || (isNameMatching && isPreferredMatching)) ? "rgb(80,80,80)" : "#28a745", fontSize: 20 }, className: "dx-icon-save" }), onClick: updateHandler }], onValueChanged: (e) => setName(e.target.value), validationItems: validationItems }, "name"), (data.endpoint && data.endpoint?.Description) && _jsx(TMTextBox, { type: "text", label: SDKUI_Localizator.Endpoint, value: data.endpoint.Description + (' (' + data.endpoint.URL + ')'), readOnly: true, onValueChanged: (e) => setName(e.target.value) }), (data.archive && data.archive?.description) && _jsx(TMTextBox, { type: "text", label: SDKUI_Localizator.ArchiveID, value: data.archive.description + (' (' + (data.archive.id ?? '-') + ')'), readOnly: true }), _jsx(TMTextBox, { type: "text", label: SDKUI_Localizator.AuthMode, value: data.authenticationMode, readOnly: true }), data.domain.length > 0 && _jsx(TMTextBox, { type: "text", label: SDKUI_Localizator.Domain, value: data.domain, readOnly: true }), _jsx(TMTextBox, { type: "text", label: SDKUI_Localizator.UserName, value: data.username, readOnly: true }), _jsx(TMTextBox, { type: "text", label: SDKUI_Localizator.CultureID, value: cultureIDsDataSource.find(item => item.value === data.language)?.display ?? '', readOnly: true }), _jsx(TMCheckBox, { elementStyle: { marginTop: 10, marginBottom: 10 }, labelPosition: "left", label: SDKUI_Localizator.SetAsFavorite, value: preferred, onValueChanged: (value) => { setPreferred(value); } }), _jsxs("div", { style: { display: 'flex', justifyContent: 'flex-start', alignItems: 'center', marginTop: 10 }, children: [_jsx(TMTooltip, { content: "Login", children: _jsx("div", { onClick: () => { fillLoginForm(data); }, style: { backgroundColor: randomBGColor, color: textColor, display: 'flex', justifyContent: 'center', alignItems: 'center', width: '15vw', height: '15vw', maxWidth: '50px', maxHeight: '50px', borderRadius: '50%', fontWeight: 'bold', marginRight: '10px', textAlign: 'center' }, children: _jsx("i", { className: "dx-icon-login", style: { fontSize: '1.5em', color: textColor, cursor: 'pointer' } }) }) }), _jsx(TMTooltip, { content: SDKUI_Localizator.Save, children: _jsx("div", { onClick: () => { updateHandler(); }, style: { backgroundColor: (error || (isNameMatching && isPreferredMatching)) ? "rgb(80,80,80, 0.5)" : "#28a745", color: textColor, display: 'flex', justifyContent: 'center', alignItems: 'center', width: '15vw', height: '15vw', maxWidth: '50px', maxHeight: '50px', borderRadius: '50%', fontWeight: 'bold', marginRight: '10px', textAlign: 'center' }, children: _jsx("i", { className: "dx-icon-save", style: { fontSize: '1.5em', color: textColor, cursor: 'pointer' } }) }) }), _jsx(TMTooltip, { content: SDKUI_Localizator.Delete, children: _jsx("div", { onClick: () => { deleteItemFromLocalStorage(data.name); }, style: { backgroundColor: "#ff4d4f", display: 'flex', justifyContent: 'center', alignItems: 'center', width: '15vw', height: '15vw', maxWidth: '50px', maxHeight: '50px', borderRadius: '50%', fontWeight: 'bold', textAlign: 'center' }, children: _jsx("i", { className: "dx-icon-trash", style: { fontSize: '1.5em', color: getTextColor("#ff4d4f"), cursor: 'pointer' } }) }) })] })] })] });
|
|
196
212
|
};
|
|
@@ -3,15 +3,15 @@ import { FormModes, ITMSaveFormBaseProps } from '../../ts/types';
|
|
|
3
3
|
declare const TMSaveForm: React.FC<ITMSaveFormBaseProps>;
|
|
4
4
|
export default TMSaveForm;
|
|
5
5
|
export declare const TMSaveFormStandardToolbar: ({ btnStyle, formMode, hasNavigation, isModified, errorsCount, onNext, onPrev, canNext, canPrev, onSaveAsync, onUndo }: {
|
|
6
|
-
btnStyle:
|
|
6
|
+
btnStyle: 'normal' | 'toolbar' | 'icon' | 'text';
|
|
7
7
|
formMode: FormModes;
|
|
8
8
|
hasNavigation: boolean;
|
|
9
9
|
isModified: boolean;
|
|
10
10
|
errorsCount: number;
|
|
11
|
-
onNext?: () => void;
|
|
12
|
-
onPrev?: () => void;
|
|
13
|
-
canNext?: boolean;
|
|
14
|
-
canPrev?: boolean;
|
|
15
|
-
onSaveAsync?: () => Promise<void
|
|
16
|
-
onUndo?: () => void;
|
|
11
|
+
onNext?: (() => void) | undefined;
|
|
12
|
+
onPrev?: (() => void) | undefined;
|
|
13
|
+
canNext?: boolean | undefined;
|
|
14
|
+
canPrev?: boolean | undefined;
|
|
15
|
+
onSaveAsync?: (() => Promise<void>) | undefined;
|
|
16
|
+
onUndo?: (() => void) | undefined;
|
|
17
17
|
}) => import("react/jsx-runtime").JSX.Element;
|