@topconsultnpm/sdkui-react-beta 6.7.96 → 6.7.98
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.
|
@@ -95,7 +95,7 @@ const TMMessageBox = ({ resizable = false, onButtonClick, title = 'TopMedia', me
|
|
|
95
95
|
const MessageToolbar = () => {
|
|
96
96
|
return (_jsxs(StyledMessageToolbar, { children: [(btns.includes(ButtonNames.OK) || btns.includes(ButtonNames.YES)) && _jsx(TMButton, { fontSize: '1.1rem', color: 'primaryOutline', btnStyle: 'text', onClick: () => { onButtonClick && btns.includes(ButtonNames.YES) ? onButtonClick(ButtonNames.YES) : onButtonClick && onButtonClick(ButtonNames.OK); setIsVisible(false); }, caption: btns.includes(ButtonNames.YES) ? SDKUI_Localizator.Yes : 'OK', showTooltip: false }), btns.includes(ButtonNames.NO) && _jsx(TMButton, { fontSize: '1.1rem', btnStyle: 'text', onClick: () => { onButtonClick && onButtonClick(ButtonNames.NO); setIsVisible(false); }, caption: SDKUI_Localizator.No, showTooltip: false, color: 'error' }), btns.includes(ButtonNames.CANCEL) && _jsx(TMButton, { fontSize: '1.1rem', btnStyle: 'text', onClick: () => { onButtonClick && onButtonClick(ButtonNames.CANCEL); setIsVisible(false); }, caption: SDKUI_Localizator.Cancel, showTooltip: false, color: 'error' })] }));
|
|
97
97
|
};
|
|
98
|
-
return (_jsx(Popup, { resizeEnabled: resizable, visible: isVisible, showCloseButton: true, width: calcResponsiveSizes(deviceType, '400px', '300px', '250px'), height: 'fit-content', minHeight: '180px', title: title, onHidden: () => { setIsVisible(false); }, children: _jsxs(TMLayoutContainer, { children: [_jsx(TMLayoutItem, { height: 'calc(100% - 40px)', children: _jsx(TMCard, { showBorder: false, scrollY: true, children: _jsxs(TMLayoutContainer, { direction: 'horizontal', alignItems: 'center', justifyContent: 'center', gap: 10, children: [_jsx(TMLayoutItem, { width: 'fit-content', children: _jsx("img", { style: { transform: 'translateY(8px)' }, src: toppy, width: 60, height: 75, alt: "" }) }), _jsx(TMLayoutItem, { height: 'fit-content', children: _jsxs("div", { children: [" ", typeof message === 'string' ? _jsx(Message, { msg: message }) : message, " "] }) })] }) }) }), _jsx(TMLayoutItem, { height: '50px', children: _jsx(MessageToolbar, {}) })] }) }));
|
|
98
|
+
return (_jsx(Popup, { resizeEnabled: resizable, animation: undefined, visible: isVisible, showCloseButton: true, width: calcResponsiveSizes(deviceType, '400px', '300px', '250px'), height: 'fit-content', minHeight: '180px', title: title, onHidden: () => { setIsVisible(false); }, children: _jsxs(TMLayoutContainer, { children: [_jsx(TMLayoutItem, { height: 'calc(100% - 40px)', children: _jsx(TMCard, { showBorder: false, scrollY: true, children: _jsxs(TMLayoutContainer, { direction: 'horizontal', alignItems: 'center', justifyContent: 'center', gap: 10, children: [_jsx(TMLayoutItem, { width: 'fit-content', children: _jsx("img", { style: { transform: 'translateY(8px)' }, src: toppy, width: 60, height: 75, alt: "" }) }), _jsx(TMLayoutItem, { height: 'fit-content', children: _jsxs("div", { children: [" ", typeof message === 'string' ? _jsx(Message, { msg: message }) : message, " "] }) })] }) }) }), _jsx(TMLayoutItem, { height: '50px', children: _jsx(MessageToolbar, {}) })] }) }));
|
|
99
99
|
};
|
|
100
100
|
const TMExceptionBox = ({ resizable = false, exception, title = `${SDK_Globals.appModule} v. ${SDK_Globals.appVersion}` }) => {
|
|
101
101
|
const [isVisible, setIsVisible] = useState(true);
|
|
@@ -14,11 +14,22 @@ const TMTextArea = (props) => {
|
|
|
14
14
|
const [isFocused, setIsFocused] = useState(false);
|
|
15
15
|
const [currentValue, setCurrentValue] = useState(value);
|
|
16
16
|
const [formulaMenuItems, setFormulaMenuItems] = useState([]);
|
|
17
|
+
const [calculatedRows, setCalculatedRows] = useState(rows ?? 1);
|
|
17
18
|
const { clicked, setClicked, points, setPoints } = useContextMenu();
|
|
18
19
|
const deviceType = useDeviceType();
|
|
19
20
|
useEffect(() => {
|
|
20
21
|
setCurrentValue(value);
|
|
21
22
|
}, [value]);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (currentValue) {
|
|
25
|
+
const newRowCount = calculateRows(currentValue);
|
|
26
|
+
setCalculatedRows(newRowCount);
|
|
27
|
+
}
|
|
28
|
+
}, [currentValue]);
|
|
29
|
+
const calculateRows = (content) => {
|
|
30
|
+
const lines = content.split('\n').length;
|
|
31
|
+
return Math.min(lines, 10);
|
|
32
|
+
};
|
|
22
33
|
useEffect(() => {
|
|
23
34
|
if (formulaItems && formulaItems.length > 0) {
|
|
24
35
|
let menuItems = [];
|
|
@@ -46,7 +57,7 @@ const TMTextArea = (props) => {
|
|
|
46
57
|
}
|
|
47
58
|
};
|
|
48
59
|
const renderTextArea = () => {
|
|
49
|
-
return _jsxs(_Fragment, { children: [_jsx(StyledTextareaEditor, { ref: inputRef, autoFocus: autoFocus, readOnly: readOnly, disabled: disabled, value: currentValue, placeholder: placeHolder, rows:
|
|
60
|
+
return _jsxs(_Fragment, { children: [_jsx(StyledTextareaEditor, { ref: inputRef, autoFocus: autoFocus, readOnly: readOnly, disabled: disabled, value: currentValue, placeholder: placeHolder, rows: calculatedRows, maxLength: maxLength, onFocus: () => setIsFocused(true), onBlur: (e) => { setIsFocused(false); if (currentValue != value)
|
|
50
61
|
onBlur?.(currentValue); }, onChange: (e) => { setCurrentValue(e.target.value); onValueChanged?.(e); }, onContextMenu: (e) => {
|
|
51
62
|
if (formulaItems.length <= 0)
|
|
52
63
|
return;
|