@topconsultnpm/sdkui-react-beta 6.7.26 → 6.7.28
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/base/TMButton.d.ts +6 -4
- package/lib/components/base/TMButton.js +11 -6
- package/lib/components/forms/TMLoginPopupSaveLoginInfo.js +2 -2
- package/lib/components/forms/TMSaveForm.d.ts +21 -7
- package/lib/components/forms/TMSaveForm.js +23 -14
- package/lib/helper/SDKUI_Localizator.d.ts +1 -0
- package/lib/helper/SDKUI_Localizator.js +18 -2
- package/package.json +1 -1
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ITMEditorBase } from './TMEditorBase';
|
|
3
3
|
export type ButtonColors = 'error' | 'warning' | 'success' | 'info' | 'primary' | 'secondary' | 'tertiary' | 'standard' | 'primaryOutline' | 'secondaryOutline' | 'tertiaryOutline' | 'errorOutline' | 'warningOutline' | 'successOutline' | 'infoOutline';
|
|
4
|
-
type ButtonStyle = 'normal' | 'toolbar' | 'icon' | 'text';
|
|
5
|
-
|
|
4
|
+
export type ButtonStyle = 'normal' | 'toolbar' | 'icon' | 'text' | 'advanced';
|
|
5
|
+
export type AdvancedButtonType = 'success' | 'error' | 'tertiary' | 'primary';
|
|
6
|
+
export interface ITMButton extends ITMEditorBase {
|
|
6
7
|
color?: ButtonColors;
|
|
7
8
|
btnStyle?: ButtonStyle;
|
|
9
|
+
advancedType?: AdvancedButtonType;
|
|
10
|
+
advancedColor?: string;
|
|
8
11
|
caption?: string;
|
|
9
12
|
description?: string;
|
|
10
13
|
icon?: any;
|
|
@@ -15,7 +18,6 @@ interface ITMButton extends ITMEditorBase {
|
|
|
15
18
|
}
|
|
16
19
|
declare const TMButton: React.FunctionComponent<ITMButton>;
|
|
17
20
|
export default TMButton;
|
|
18
|
-
export type NewButtonType = 'success' | 'error' | 'tertiary' | 'primary';
|
|
19
21
|
export declare const TMButtonNew: ({ color, caption, disable, onClick, type, icon, width, height }: {
|
|
20
22
|
color?: string;
|
|
21
23
|
width?: string;
|
|
@@ -23,6 +25,6 @@ export declare const TMButtonNew: ({ color, caption, disable, onClick, type, ico
|
|
|
23
25
|
disable?: boolean;
|
|
24
26
|
caption?: string;
|
|
25
27
|
onClick?: () => void;
|
|
26
|
-
type?:
|
|
28
|
+
type?: AdvancedButtonType;
|
|
27
29
|
icon?: any;
|
|
28
30
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -106,7 +106,8 @@ const StyledButtonTooltipItem = styled.div `
|
|
|
106
106
|
color: ${props => props.$color ? props.$color : "primary"};
|
|
107
107
|
font-size: ${props => props.fontSize || FontSize.defaultFontSize};
|
|
108
108
|
`;
|
|
109
|
-
const TMButton = ({ width, height, keyGesture, btnStyle = 'normal', color = 'primary', fontSize = FontSize.defaultFontSize, disabled = false, showTooltip = true, caption, icon, description, padding, elementStyle, onClick = () => { } }) => {
|
|
109
|
+
const TMButton = ({ width, height, keyGesture, btnStyle = 'normal', advancedColor, advancedType = 'primary', color = 'primary', fontSize = FontSize.defaultFontSize, disabled = false, showTooltip = true, caption, icon, description, padding, elementStyle, onClick = () => { } }) => {
|
|
110
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
110
111
|
// const [random, setRandom] = useState(0.0);
|
|
111
112
|
// const [key, setKey] = useState("");
|
|
112
113
|
// let accBtns = keyGesture?.replaceAll(' ', '').split('+')
|
|
@@ -152,6 +153,9 @@ const TMButton = ({ width, height, keyGesture, btnStyle = 'normal', color = 'pri
|
|
|
152
153
|
else if (btnStyle === 'icon') {
|
|
153
154
|
return (_jsx(StyledIconButton, { color: color, caption: caption, disabled: disabled, fontSize: fontSize, padding: padding, onClick: onClick, children: icon }));
|
|
154
155
|
}
|
|
156
|
+
else if (btnStyle === 'advanced') {
|
|
157
|
+
return (_jsxs(StyledAdvancedButton, { "$width": width, "$height": height, onMouseOver: () => !disabled && setIsHovered(true), onMouseOut: () => setIsHovered(false), "$isDisabled": disabled, onClick: () => !disabled && onClick?.(), children: [_jsx(StyledAdvancedButtonIcon, { "$color": color, "$isVisible": isHovered, "$isDisabled": disabled, "$type": advancedType, children: icon }), _jsxs(StyledAdvancedButtonText, { "$color": advancedColor, "$isDisabled": disabled, "$type": advancedType, children: [" ", caption, " "] })] }));
|
|
158
|
+
}
|
|
155
159
|
else {
|
|
156
160
|
return (_jsx(StyledTextButton, { color: color, caption: caption, disabled: disabled, fontSize: fontSize, onClick: onClick, children: caption }));
|
|
157
161
|
}
|
|
@@ -163,7 +167,7 @@ const TMButton = ({ width, height, keyGesture, btnStyle = 'normal', color = 'pri
|
|
|
163
167
|
return (_jsx("div", { style: elementStyle, children: showTooltip ? _jsx(TMTooltip, { hideAfterDelay: true, content: renderTooltip(), children: renderedButton() }) : renderedButton() }));
|
|
164
168
|
};
|
|
165
169
|
export default TMButton;
|
|
166
|
-
const
|
|
170
|
+
const StyledAdvancedButton = styled.div `
|
|
167
171
|
display: flex;
|
|
168
172
|
align-items: center;
|
|
169
173
|
justify-content: flex-end;
|
|
@@ -176,18 +180,19 @@ const StyledWorkFlowOperationButton = styled.div `
|
|
|
176
180
|
color: white;
|
|
177
181
|
user-select: none;
|
|
178
182
|
`;
|
|
179
|
-
const
|
|
183
|
+
const StyledAdvancedButtonIcon = styled.div `
|
|
180
184
|
display: flex;
|
|
181
185
|
align-items: center;
|
|
182
186
|
justify-content: center;
|
|
183
|
-
width: ${props => props.$
|
|
187
|
+
width: ${props => props.$isVisible ? '25px' : '0px'};
|
|
188
|
+
|
|
184
189
|
transition: width ease-in-out 100ms;
|
|
185
190
|
height: 100%;
|
|
186
191
|
background-color: ${props => props.$isDisabled ? '#b4b4b4' : props.$color ? `${props.$color}90` : props.$type === 'success' ? `${TMColors.success}90` : props.$type === 'error' ? `${TMColors.error}90` : props.$type === 'tertiary' ? `${TMColors.tertiary}90` : `${TMColors.primary}90`};
|
|
187
192
|
border-top-left-radius: 10px;
|
|
188
193
|
border-bottom-left-radius: 10px;
|
|
189
194
|
`;
|
|
190
|
-
const
|
|
195
|
+
const StyledAdvancedButtonText = styled.div `
|
|
191
196
|
display: flex;
|
|
192
197
|
align-items: center;
|
|
193
198
|
justify-content: center;
|
|
@@ -199,5 +204,5 @@ const StyledWorkFlowOperationButtonText = styled.div `
|
|
|
199
204
|
`;
|
|
200
205
|
export const TMButtonNew = ({ color, caption = '', disable = false, onClick, type = 'primary', icon = _jsx(IconApply, {}), width = '90px', height = '30px' }) => {
|
|
201
206
|
const [isHovered, setIsHovered] = useState(false);
|
|
202
|
-
return (_jsxs(
|
|
207
|
+
return (_jsxs(StyledAdvancedButton, { "$width": width, "$height": height, onMouseOver: () => !disable && setIsHovered(true), onMouseOut: () => setIsHovered(false), "$isDisabled": disable, onClick: () => !disable && onClick && onClick(), children: [_jsx(StyledAdvancedButtonIcon, { "$color": color, "$isVisible": isHovered, "$isDisabled": disable, "$type": type, children: icon }), _jsxs(StyledAdvancedButtonText, { "$color": color, "$isDisabled": disable, "$type": type, children: [" ", caption, " "] })] }));
|
|
203
208
|
};
|
|
@@ -185,7 +185,7 @@ const TMLoginPopupSaveLoginInfo = (props) => {
|
|
|
185
185
|
handleFileRead(file, (parsedData) => {
|
|
186
186
|
const modifiedData = generateModifiedData(parsedData, historyState.loginHistory);
|
|
187
187
|
updateHistoryState(modifiedData);
|
|
188
|
-
}, () => alert(
|
|
188
|
+
}, () => alert(SDKUI_Localizator.ErrorParsingFileContent));
|
|
189
189
|
});
|
|
190
190
|
}
|
|
191
191
|
else if (e.itemData.value === 'export') {
|
|
@@ -208,7 +208,7 @@ const TMLoginPopupSaveLoginInfo = (props) => {
|
|
|
208
208
|
if (historyState.searchedLoginHistory.length === 0) {
|
|
209
209
|
return (_jsx("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", textAlign: "center", padding: "20px" }, children: SDKUI_Localizator.NoCredentialsSaved }));
|
|
210
210
|
}
|
|
211
|
-
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))) }) }));
|
|
211
|
+
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 + 1), title: data.name, children: _jsx(TMLoginItemTemplate, { data: data, reloadHistoryState: reloadHistoryState, fillLoginForm: fillLoginForm, deleteItemFromLocalStorage: deleteItemFromLocalStorage, setSelectedItems: setSelectedItems, setSearchText: setSearchText, historyState: historyState }) }, data.id))) }) }));
|
|
212
212
|
};
|
|
213
213
|
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()] }));
|
|
214
214
|
};
|
|
@@ -1,17 +1,31 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FormModes, ITMSaveFormBaseProps } from '../../ts/types';
|
|
3
|
+
import { ITMButton } from '../base/TMButton';
|
|
3
4
|
declare const TMSaveForm: React.FC<ITMSaveFormBaseProps>;
|
|
4
5
|
export default TMSaveForm;
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
interface ITMSaveFormButtonBase extends ITMButton {
|
|
7
|
+
iconColor?: string;
|
|
7
8
|
formMode: FormModes;
|
|
8
|
-
hasNavigation: boolean;
|
|
9
9
|
isModified: boolean;
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
}
|
|
11
|
+
interface ITMSaveFormButtonPreviousProps extends ITMSaveFormButtonBase {
|
|
12
|
+
canPrev?: boolean;
|
|
12
13
|
onPrev?: () => void;
|
|
14
|
+
onSaveAsync?: () => Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
export declare const TMSaveFormButtonPrevious: ({ btnStyle, formMode, isModified, onPrev, canPrev, iconColor, onSaveAsync }: ITMSaveFormButtonPreviousProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
interface ITMSaveFormButtonNextProps extends ITMSaveFormButtonBase {
|
|
13
18
|
canNext?: boolean;
|
|
14
|
-
|
|
19
|
+
onNext?: () => void;
|
|
20
|
+
onSaveAsync?: () => Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
export declare const TMSaveFormButtonNext: ({ btnStyle, formMode, isModified, onNext, canNext, iconColor, onSaveAsync }: ITMSaveFormButtonNextProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
interface ITMSaveFormButtonSaveProps extends ITMSaveFormButtonBase {
|
|
24
|
+
errorsCount: number;
|
|
15
25
|
onSaveAsync?: () => Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
export declare const TMSaveFormButtonSave: ({ btnStyle, errorsCount, isModified, iconColor, width, advancedColor, advancedType, onSaveAsync }: ITMSaveFormButtonSaveProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
interface ITMSaveFormButtonUndoProps extends ITMSaveFormButtonBase {
|
|
16
29
|
onUndo?: () => void;
|
|
17
|
-
}
|
|
30
|
+
}
|
|
31
|
+
export declare const TMSaveFormButtonUndo: ({ btnStyle, isModified, iconColor, width, advancedColor, advancedType, onUndo }: ITMSaveFormButtonUndoProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -105,16 +105,10 @@ const TMSaveForm = ({ id, formMode = FormModes.Update, showToolbar = true, skipI
|
|
|
105
105
|
: renderSaveForm() }));
|
|
106
106
|
};
|
|
107
107
|
export default TMSaveForm;
|
|
108
|
-
export const
|
|
109
|
-
const
|
|
110
|
-
await onSaveAsync?.();
|
|
111
|
-
}
|
|
112
|
-
catch (ex) {
|
|
113
|
-
TMExceptionBoxManager.show({ exception: ex });
|
|
114
|
-
} };
|
|
115
|
-
const doNext = () => {
|
|
108
|
+
export const TMSaveFormButtonPrevious = ({ btnStyle, formMode, isModified, onPrev, canPrev, iconColor, onSaveAsync }) => {
|
|
109
|
+
const doPrev = () => {
|
|
116
110
|
if (!isModified) {
|
|
117
|
-
|
|
111
|
+
onPrev?.();
|
|
118
112
|
return;
|
|
119
113
|
}
|
|
120
114
|
TMMessageBoxManager.show({
|
|
@@ -125,7 +119,7 @@ export const TMSaveFormStandardToolbar = ({ btnStyle, formMode, hasNavigation, i
|
|
|
125
119
|
return;
|
|
126
120
|
if (e == ButtonNames.YES)
|
|
127
121
|
await onSaveAsync?.();
|
|
128
|
-
|
|
122
|
+
onPrev?.();
|
|
129
123
|
}
|
|
130
124
|
catch (ex) {
|
|
131
125
|
TMExceptionBoxManager.show({ exception: ex });
|
|
@@ -133,9 +127,12 @@ export const TMSaveFormStandardToolbar = ({ btnStyle, formMode, hasNavigation, i
|
|
|
133
127
|
}
|
|
134
128
|
});
|
|
135
129
|
};
|
|
136
|
-
|
|
130
|
+
return (_jsx(TMButton, { btnStyle: btnStyle, caption: SDKUI_Localizator.Previous, icon: _jsx(IconArrowUp, { color: iconColor }), disabled: !canPrev || isModified || formMode == FormModes.Create || formMode == FormModes.Duplicate, onClick: doPrev }));
|
|
131
|
+
};
|
|
132
|
+
export const TMSaveFormButtonNext = ({ btnStyle, formMode, isModified, onNext, canNext, iconColor, onSaveAsync }) => {
|
|
133
|
+
const doNext = () => {
|
|
137
134
|
if (!isModified) {
|
|
138
|
-
|
|
135
|
+
onNext?.();
|
|
139
136
|
return;
|
|
140
137
|
}
|
|
141
138
|
TMMessageBoxManager.show({
|
|
@@ -146,7 +143,7 @@ export const TMSaveFormStandardToolbar = ({ btnStyle, formMode, hasNavigation, i
|
|
|
146
143
|
return;
|
|
147
144
|
if (e == ButtonNames.YES)
|
|
148
145
|
await onSaveAsync?.();
|
|
149
|
-
|
|
146
|
+
onNext?.();
|
|
150
147
|
}
|
|
151
148
|
catch (ex) {
|
|
152
149
|
TMExceptionBoxManager.show({ exception: ex });
|
|
@@ -154,5 +151,17 @@ export const TMSaveFormStandardToolbar = ({ btnStyle, formMode, hasNavigation, i
|
|
|
154
151
|
}
|
|
155
152
|
});
|
|
156
153
|
};
|
|
157
|
-
return (
|
|
154
|
+
return (_jsx(TMButton, { btnStyle: btnStyle, caption: SDKUI_Localizator.Next, icon: _jsx(IconArrowDown, { color: iconColor }), disabled: !canNext || isModified || formMode == FormModes.Create || formMode == FormModes.Duplicate, onClick: doNext }));
|
|
155
|
+
};
|
|
156
|
+
export const TMSaveFormButtonSave = ({ btnStyle, errorsCount, isModified, iconColor, width, advancedColor, advancedType, onSaveAsync }) => {
|
|
157
|
+
const doSaveAsync = async () => { try {
|
|
158
|
+
await onSaveAsync?.();
|
|
159
|
+
}
|
|
160
|
+
catch (ex) {
|
|
161
|
+
TMExceptionBoxManager.show({ exception: ex });
|
|
162
|
+
} };
|
|
163
|
+
return (_jsx(TMButton, { btnStyle: btnStyle, width: width, advancedColor: advancedColor, advancedType: advancedType, caption: SDKUI_Localizator.Save, icon: _jsx(IconSave, { color: iconColor }), keyGesture: "alt+s", backgroundColor: errorsCount > 0 ? TMColors.error : isModified ? TMColors.success : TMColors.disabled, onClick: doSaveAsync, color: "success", disabled: !(isModified && errorsCount <= 0) }));
|
|
164
|
+
};
|
|
165
|
+
export const TMSaveFormButtonUndo = ({ btnStyle, isModified, iconColor, width, advancedColor, advancedType, onUndo }) => {
|
|
166
|
+
return (_jsx(TMButton, { btnStyle: btnStyle, width: width, advancedColor: advancedColor, advancedType: advancedType, caption: SDKUI_Localizator.Undo, icon: _jsx(IconUndo, { color: iconColor }), keyGesture: "alt+z", color: "tertiary", disabled: !isModified, onClick: onUndo }));
|
|
158
167
|
};
|
|
@@ -234,4 +234,5 @@ export declare class SDKUI_Localizator {
|
|
|
234
234
|
static get ImportExport(): "Importieren/Exportieren" | "Import/Export" | "Importar/Exportar" | "Importer/Exporter" | "Importa/Esporta";
|
|
235
235
|
static get Import(): "Importieren" | "Import" | "Importar" | "Importer" | "Importa";
|
|
236
236
|
static get Export(): "Exportieren" | "Export" | "Exportar" | "Exporter" | "Esporta";
|
|
237
|
+
static get ErrorParsingFileContent(): "Fehler beim Parsen des Dateiinhalts. Stellen Sie sicher, dass die Datei im richtigen Format vorliegt." | "Error parsing the file content. Ensure the file is in the correct format." | "Error al analizar el contenido del archivo. Asegúrese de que el archivo esté en el formato correcto." | "Erreur lors de l'analyse du contenu du fichier. Assurez-vous que le fichier est dans le bon format." | "Erro ao analisar o conteúdo do arquivo. Certifique-se de que o arquivo está no formato correto." | "Errore durante l'analisi del contenuto del file. Assicurati che il file sia nel formato corretto.";
|
|
237
238
|
}
|
|
@@ -2331,7 +2331,7 @@ export class SDKUI_Localizator {
|
|
|
2331
2331
|
case CultureIDs.Pt_PT:
|
|
2332
2332
|
return "Importar";
|
|
2333
2333
|
default:
|
|
2334
|
-
return "Importa";
|
|
2334
|
+
return "Importa";
|
|
2335
2335
|
}
|
|
2336
2336
|
}
|
|
2337
2337
|
static get Export() {
|
|
@@ -2347,7 +2347,23 @@ export class SDKUI_Localizator {
|
|
|
2347
2347
|
case CultureIDs.Pt_PT:
|
|
2348
2348
|
return "Exportar";
|
|
2349
2349
|
default:
|
|
2350
|
-
return "Esporta";
|
|
2350
|
+
return "Esporta";
|
|
2351
|
+
}
|
|
2352
|
+
}
|
|
2353
|
+
static get ErrorParsingFileContent() {
|
|
2354
|
+
switch (this._cultureID) {
|
|
2355
|
+
case CultureIDs.De_DE:
|
|
2356
|
+
return "Fehler beim Parsen des Dateiinhalts. Stellen Sie sicher, dass die Datei im richtigen Format vorliegt.";
|
|
2357
|
+
case CultureIDs.En_US:
|
|
2358
|
+
return "Error parsing the file content. Ensure the file is in the correct format.";
|
|
2359
|
+
case CultureIDs.Es_ES:
|
|
2360
|
+
return "Error al analizar el contenido del archivo. Asegúrese de que el archivo esté en el formato correcto.";
|
|
2361
|
+
case CultureIDs.Fr_FR:
|
|
2362
|
+
return "Erreur lors de l'analyse du contenu du fichier. Assurez-vous que le fichier est dans le bon format.";
|
|
2363
|
+
case CultureIDs.Pt_PT:
|
|
2364
|
+
return "Erro ao analisar o conteúdo do arquivo. Certifique-se de que o arquivo está no formato correto.";
|
|
2365
|
+
default:
|
|
2366
|
+
return "Errore durante l'analisi del contenuto del file. Assicurati che il file sia nel formato corretto.";
|
|
2351
2367
|
}
|
|
2352
2368
|
}
|
|
2353
2369
|
}
|