@topconsultnpm/sdkui-react 6.17.0-test10 → 6.17.0-test11
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 +1 -0
- package/lib/components/base/TMButton.js +6 -6
- package/lib/components/base/TMCustomButton.d.ts +1 -1
- package/lib/components/base/TMCustomButton.js +28 -26
- package/lib/components/base/TMFileManagerDataGridView.js +1 -1
- package/lib/components/base/TMModal.d.ts +2 -0
- package/lib/components/base/TMModal.js +48 -3
- package/lib/components/base/TMPopUp.js +4 -1
- package/lib/components/base/TMWaitPanel.js +8 -2
- package/lib/components/choosers/TMDataListItemChooser.js +1 -1
- package/lib/components/choosers/TMMetadataChooser.js +3 -1
- package/lib/components/choosers/TMUserChooser.d.ts +4 -0
- package/lib/components/choosers/TMUserChooser.js +21 -5
- package/lib/components/editors/TMTextArea.d.ts +1 -0
- package/lib/components/editors/TMTextArea.js +43 -9
- package/lib/components/editors/TMTextBox.js +33 -3
- package/lib/components/editors/TMTextExpression.js +36 -28
- package/lib/components/features/assistant/ToppyDraggableHelpCenter.d.ts +30 -0
- package/lib/components/features/assistant/ToppyDraggableHelpCenter.js +459 -0
- package/lib/components/features/assistant/ToppySpeechBubble.d.ts +9 -0
- package/lib/components/features/assistant/ToppySpeechBubble.js +117 -0
- package/lib/components/features/blog/TMBlogCommentForm.d.ts +2 -0
- package/lib/components/features/blog/TMBlogCommentForm.js +18 -6
- package/lib/components/features/documents/TMDcmtBlog.js +1 -1
- package/lib/components/features/documents/TMDcmtForm.js +5 -5
- package/lib/components/features/documents/TMDcmtPreview.js +45 -8
- package/lib/components/features/search/TMSearchQueryPanel.js +2 -3
- package/lib/components/features/search/TMSearchResult.js +12 -13
- package/lib/components/features/tasks/TMTaskForm.js +2 -2
- package/lib/components/features/workflow/TMWorkflowPopup.js +1 -1
- package/lib/components/forms/TMSaveForm.js +2 -2
- package/lib/components/grids/TMBlogsPost.d.ts +7 -5
- package/lib/components/grids/TMBlogsPost.js +56 -10
- package/lib/components/grids/TMBlogsPostUtils.d.ts +1 -0
- package/lib/components/grids/TMBlogsPostUtils.js +10 -0
- package/lib/components/index.d.ts +1 -1
- package/lib/components/index.js +1 -1
- package/lib/helper/SDKUI_Localizator.d.ts +5 -0
- package/lib/helper/SDKUI_Localizator.js +50 -0
- package/lib/helper/TMIcons.d.ts +2 -0
- package/lib/helper/TMIcons.js +9 -0
- package/lib/helper/TMToppyMessage.js +2 -1
- package/lib/helper/dcmtsHelper.d.ts +2 -2
- package/lib/helper/dcmtsHelper.js +54 -25
- package/lib/helper/helpers.d.ts +1 -1
- package/lib/helper/helpers.js +10 -16
- package/lib/ts/types.d.ts +2 -0
- package/package.json +2 -2
- package/lib/components/features/assistant/ToppyHelpCenter.d.ts +0 -12
- package/lib/components/features/assistant/ToppyHelpCenter.js +0 -173
|
@@ -16,6 +16,7 @@ export interface ITMButton extends ITMEditorBase {
|
|
|
16
16
|
padding?: string;
|
|
17
17
|
showTooltip?: boolean;
|
|
18
18
|
onClick?: VoidFunction;
|
|
19
|
+
onMouseDown?: (e: any) => any;
|
|
19
20
|
}
|
|
20
21
|
declare const TMButton: React.ForwardRefExoticComponent<ITMButton & React.RefAttributes<HTMLButtonElement>>;
|
|
21
22
|
export default TMButton;
|
|
@@ -145,23 +145,23 @@ const StyledAdvancedButtonText = styled.div `
|
|
|
145
145
|
padding: 5px;
|
|
146
146
|
`;
|
|
147
147
|
const TMButton = forwardRef((props, ref) => {
|
|
148
|
-
const { width, height, keyGesture, btnStyle = 'normal', advancedColor, advancedType = 'primary', color = 'primary', fontSize = FontSize.defaultFontSize, disabled = false, showTooltip = true, caption, icon, description, padding, elementStyle, onClick = () => { } } = props;
|
|
148
|
+
const { width, height, keyGesture, btnStyle = 'normal', advancedColor, advancedType = 'primary', color = 'primary', fontSize = FontSize.defaultFontSize, disabled = false, showTooltip = true, caption, icon, description, padding, elementStyle, onClick = () => { }, onMouseDown = () => { } } = props;
|
|
149
149
|
const [isHovered, setIsHovered] = useState(false);
|
|
150
150
|
const renderedButton = () => {
|
|
151
151
|
if (btnStyle === 'normal') {
|
|
152
|
-
return (_jsx(StyledNormalButton, { ref: ref, width: width, height: height, color: color, caption: caption, disabled: disabled, fontSize: fontSize, onClick: onClick, children: caption }));
|
|
152
|
+
return (_jsx(StyledNormalButton, { ref: ref, width: width, height: height, color: color, caption: caption, disabled: disabled, fontSize: fontSize, onClick: onClick, onMouseDown: (e) => !disabled && onMouseDown?.(e), children: caption }));
|
|
153
153
|
}
|
|
154
154
|
else if (btnStyle === 'toolbar') {
|
|
155
|
-
return (_jsx(StyledToolbarButton, { ref: ref, color: color, caption: caption, disabled: disabled, fontSize: fontSize, onClick: onClick, children: icon }));
|
|
155
|
+
return (_jsx(StyledToolbarButton, { ref: ref, color: color, caption: caption, disabled: disabled, fontSize: fontSize, onClick: onClick, onMouseDown: (e) => !disabled && onMouseDown?.(e), children: icon }));
|
|
156
156
|
}
|
|
157
157
|
else if (btnStyle === 'icon') {
|
|
158
|
-
return (_jsx(StyledIconButton, { ref: ref, color: color, caption: caption, disabled: disabled, fontSize: fontSize, padding: padding, onClick: onClick, children: icon }));
|
|
158
|
+
return (_jsx(StyledIconButton, { ref: ref, color: color, caption: caption, disabled: disabled, fontSize: fontSize, padding: padding, onClick: onClick, onMouseDown: (e) => !disabled && onMouseDown?.(e), children: icon }));
|
|
159
159
|
}
|
|
160
160
|
else if (btnStyle === 'advanced') {
|
|
161
|
-
return (_jsxs(StyledAdvancedButton, { ref: ref, "$width": width ?? '90px', "$height": height ?? '30px', onMouseOver: () => !disabled && setIsHovered(true), onMouseOut: () => setIsHovered(false), "$isDisabled": disabled, "$isPrimaryOutline": advancedType === 'primary' && (advancedColor === 'primaryOutline' || color === 'primaryOutline'), onClick: () => !disabled && onClick?.(), children: [_jsx(StyledAdvancedButtonIcon, { "$color": advancedColor, "$isVisible": isHovered, "$isDisabled": disabled, "$type": advancedType, children: icon }), _jsx(StyledAdvancedButtonText, { "$color": advancedColor, "$isDisabled": disabled, "$type": advancedType, children: caption })] }));
|
|
161
|
+
return (_jsxs(StyledAdvancedButton, { ref: ref, "$width": width ?? '90px', "$height": height ?? '30px', onMouseOver: () => !disabled && setIsHovered(true), onMouseOut: () => setIsHovered(false), "$isDisabled": disabled, "$isPrimaryOutline": advancedType === 'primary' && (advancedColor === 'primaryOutline' || color === 'primaryOutline'), onClick: () => !disabled && onClick?.(), onMouseDown: (e) => !disabled && onMouseDown?.(e), children: [_jsx(StyledAdvancedButtonIcon, { "$color": advancedColor, "$isVisible": isHovered, "$isDisabled": disabled, "$type": advancedType, children: icon }), _jsx(StyledAdvancedButtonText, { "$color": advancedColor, "$isDisabled": disabled, "$type": advancedType, children: caption })] }));
|
|
162
162
|
}
|
|
163
163
|
else {
|
|
164
|
-
return (_jsx(StyledTextButton, { ref: ref, color: color, caption: caption, disabled: disabled, fontSize: fontSize, onClick: onClick, children: caption }));
|
|
164
|
+
return (_jsx(StyledTextButton, { ref: ref, color: color, caption: caption, disabled: disabled, fontSize: fontSize, onClick: onClick, onMouseDown: (e) => !disabled && onMouseDown?.(e), children: caption }));
|
|
165
165
|
}
|
|
166
166
|
};
|
|
167
167
|
const renderTooltip = () => {
|
|
@@ -7,5 +7,5 @@ type TMCustomButtonProps = {
|
|
|
7
7
|
selectedItems?: Array<any>;
|
|
8
8
|
onClose?: () => void;
|
|
9
9
|
};
|
|
10
|
-
declare const TMCustomButton: (props: TMCustomButtonProps) => import("react/jsx-runtime").JSX.Element
|
|
10
|
+
declare const TMCustomButton: (props: TMCustomButtonProps) => false | import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
export default TMCustomButton;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { SDK_Globals } from '@topconsultnpm/sdk-ts';
|
|
3
2
|
import { useEffect, useRef, useState, useMemo } from 'react';
|
|
4
3
|
import TMModal from './TMModal';
|
|
5
4
|
import styled from 'styled-components';
|
|
6
|
-
import { TMLayoutWaitingContainer } from '../..';
|
|
7
|
-
import {
|
|
5
|
+
import { SDKUI_Localizator, TMLayoutWaitingContainer } from '../..';
|
|
6
|
+
import { getButtonAttributes, getSelectedItem } from '../../helper/dcmtsHelper';
|
|
8
7
|
const IframeContainer = styled.div `
|
|
9
8
|
display: flex;
|
|
10
9
|
height: 100%;
|
|
@@ -19,15 +18,14 @@ const TMCustomButton = (props) => {
|
|
|
19
18
|
const { button, isModal = true, formData, selectedItems, onClose } = props;
|
|
20
19
|
const { appName: scriptUrl, arguments: args } = button;
|
|
21
20
|
const iframeRef = useRef(null);
|
|
22
|
-
const attributes = useMemo(() =>
|
|
23
|
-
const selectedItemsProcessed = useMemo(() => processSelectedItems(selectedItems), [selectedItems]);
|
|
21
|
+
const attributes = useMemo(() => getButtonAttributes(args, formData, selectedItems), [args, formData, selectedItems]);
|
|
24
22
|
const RunOnce = button.mode === "RunOnce";
|
|
25
23
|
const [loading, setLoading] = useState(true);
|
|
26
24
|
const [error, setError] = useState(false);
|
|
27
|
-
const selectedItemsCount = selectedItems?.length ||
|
|
25
|
+
const selectedItemsCount = selectedItems?.length || 0;
|
|
28
26
|
// Stati per il wait panel
|
|
29
|
-
const [showWaitPanel, setShowWaitPanel] = useState(
|
|
30
|
-
const [waitPanelText, setWaitPanelText] = useState(
|
|
27
|
+
const [showWaitPanel, setShowWaitPanel] = useState(selectedItemsCount > 0 && !RunOnce);
|
|
28
|
+
const [waitPanelText, setWaitPanelText] = useState(SDKUI_Localizator.CustomButtonActions.replaceParams(1, selectedItemsCount));
|
|
31
29
|
const [waitPanelValue, setWaitPanelValue] = useState(0);
|
|
32
30
|
const [waitPanelMaxValue, setWaitPanelMaxValue] = useState(selectedItemsCount);
|
|
33
31
|
const [abortController, setAbortController] = useState(undefined);
|
|
@@ -48,23 +46,21 @@ const TMCustomButton = (props) => {
|
|
|
48
46
|
setError(true);
|
|
49
47
|
};
|
|
50
48
|
const executeSequentially = async (controller) => {
|
|
51
|
-
if (!
|
|
49
|
+
if (!selectedItems)
|
|
52
50
|
return;
|
|
53
|
-
const
|
|
54
|
-
for (const [index, item] of processedItems.entries()) {
|
|
51
|
+
for (const [index, item] of selectedItems.entries()) {
|
|
55
52
|
if (controller.signal.aborted)
|
|
56
53
|
break;
|
|
57
|
-
setWaitPanelText(
|
|
54
|
+
setWaitPanelText(SDKUI_Localizator.CustomButtonActions.replaceParams(index + 1, selectedItemsCount));
|
|
58
55
|
setWaitPanelValue(index);
|
|
59
56
|
// Attendi che l'iframe sia pronto e invia il messaggio
|
|
60
57
|
await new Promise((resolve) => {
|
|
61
58
|
const checkIframe = setInterval(() => {
|
|
62
59
|
if (iframeRef.current?.contentWindow) {
|
|
63
60
|
clearInterval(checkIframe);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}, targetOrigin);
|
|
61
|
+
//devo convertire item in formData
|
|
62
|
+
const processedItem = getSelectedItem(args, formData, item);
|
|
63
|
+
postMessageIframe(processedItem);
|
|
68
64
|
// Attendi prima di passare al prossimo
|
|
69
65
|
setTimeout(() => {
|
|
70
66
|
setWaitPanelValue(index + 1);
|
|
@@ -77,12 +73,17 @@ const TMCustomButton = (props) => {
|
|
|
77
73
|
setShowWaitPanel(false);
|
|
78
74
|
onClose?.();
|
|
79
75
|
};
|
|
76
|
+
const postMessageIframe = (data) => {
|
|
77
|
+
console.log("TMCustomButton - postMessageIframe - data:", data);
|
|
78
|
+
if (iframeRef.current?.contentWindow) {
|
|
79
|
+
iframeRef.current.contentWindow.postMessage({ "options": data }, targetOrigin);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
80
82
|
useEffect(() => {
|
|
81
83
|
if (loading || error)
|
|
82
84
|
return;
|
|
83
85
|
//if(error) clearTimeout(timeoutIframe);
|
|
84
|
-
|
|
85
|
-
if (!RunOnce) {
|
|
86
|
+
if (!RunOnce && selectedItemsCount > 0) {
|
|
86
87
|
// esegui per ogni item selezionato
|
|
87
88
|
const controller = new AbortController();
|
|
88
89
|
controller.signal.addEventListener('abort', () => {
|
|
@@ -93,13 +94,15 @@ const TMCustomButton = (props) => {
|
|
|
93
94
|
setWaitPanelMaxValue(selectedItemsCount);
|
|
94
95
|
executeSequentially(controller);
|
|
95
96
|
}
|
|
96
|
-
else
|
|
97
|
+
else {
|
|
97
98
|
// Modalità RunOnce: invia dati all'iframe quando è caricato
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
postMessageIframe(attributes);
|
|
100
|
+
if (!RunOnce) {
|
|
101
|
+
//chiudo l'iframe dopo 2 secondi
|
|
102
|
+
setTimeout(() => {
|
|
103
|
+
onClose?.();
|
|
104
|
+
}, 2000);
|
|
105
|
+
}
|
|
103
106
|
//clearTimeout(timeoutIframe);
|
|
104
107
|
}
|
|
105
108
|
}, [loading, error, RunOnce]);
|
|
@@ -110,7 +113,6 @@ const TMCustomButton = (props) => {
|
|
|
110
113
|
}
|
|
111
114
|
}, []);
|
|
112
115
|
const iframeContent = (_jsxs(IframeContainer, { style: !RunOnce ? { visibility: 'hidden' } : {}, children: [error && _jsx("div", { children: "Si \u00E8 verificato un errore nel caricamento del contenuto." }), !error && _jsx(StyledIframe, { ref: iframeRef, loading: 'lazy', onLoad: handleLoad, onError: handleError, src: scriptUrl })] }));
|
|
113
|
-
return isModal && RunOnce ? (_jsx(TMModal, { title: button.title, width: '60%', height: '70%', resizable: true, onClose: onClose, children: iframeContent })) : !RunOnce &&
|
|
114
|
-
: null;
|
|
116
|
+
return isModal && RunOnce ? (_jsx(TMModal, { title: button.title, width: '60%', height: '70%', resizable: true, expandable: true, onClose: onClose, children: iframeContent })) : !RunOnce && (_jsxs(_Fragment, { children: [_jsx(TMLayoutWaitingContainer, { showWaitPanel: showWaitPanel, waitPanelTitle: SDKUI_Localizator.CustomButtonAction, showWaitPanelPrimary: true, waitPanelTextPrimary: waitPanelText, waitPanelValuePrimary: waitPanelValue, waitPanelMaxValuePrimary: waitPanelMaxValue, showWaitPanelSecondary: false, isCancelable: true, abortController: abortController, children: undefined }), iframeContent] }));
|
|
115
117
|
};
|
|
116
118
|
export default TMCustomButton;
|
|
@@ -96,6 +96,6 @@ const TMFileManagerDataGridView = (props) => {
|
|
|
96
96
|
{ dataField: "creationTime", caption: SDKUI_Localizator.CreationTime, dataType: 'datetime', format: 'dd/MM/yyyy HH:mm', cellRender: cellDatetimeRender },
|
|
97
97
|
];
|
|
98
98
|
}, [searchText]);
|
|
99
|
-
return _jsx(TMDataGrid, { dataSource: items ?? [], dataColumns: dataColumns, focusedRowKey: focusedRowKey, selectedRowKeys: selectedRowKeys, onFocusedRowChanged: onFocusedRowChanged, onSelectionChanged: onSelectionChanged, onCellDblClick: onCellDblClick, onContextMenuPreparing: onContextMenuPreparing, showSearchPanel: false, noDataText: SDKUI_Localizator.FolderIsEmpty });
|
|
99
|
+
return _jsx(TMDataGrid, { dataSource: items ?? [], dataColumns: dataColumns, focusedRowKey: focusedRowKey, selectedRowKeys: selectedRowKeys, onFocusedRowChanged: onFocusedRowChanged, onSelectionChanged: onSelectionChanged, onCellDblClick: onCellDblClick, onContextMenuPreparing: onContextMenuPreparing, showSearchPanel: false, noDataText: SDKUI_Localizator.FolderIsEmpty }, items.length);
|
|
100
100
|
};
|
|
101
101
|
export default TMFileManagerDataGridView;
|
|
@@ -8,9 +8,11 @@ interface ITMModal {
|
|
|
8
8
|
fontSize?: string;
|
|
9
9
|
isModal?: boolean;
|
|
10
10
|
resizable?: boolean;
|
|
11
|
+
expandable?: boolean;
|
|
11
12
|
onClose?: () => void;
|
|
12
13
|
hidePopup?: boolean;
|
|
13
14
|
askClosingConfirm?: boolean;
|
|
15
|
+
showCloseButton?: boolean;
|
|
14
16
|
}
|
|
15
17
|
declare const TMModal: React.FC<ITMModal>;
|
|
16
18
|
export default TMModal;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useEffect } from 'react';
|
|
2
|
+
import { useState, useEffect, useRef } from 'react';
|
|
3
3
|
import { Popup } from 'devextreme-react';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
import TMLayoutContainer, { TMCard, TMLayoutItem } from './TMLayout';
|
|
6
6
|
import { FontSize, TMColors } from '../../utils/theme';
|
|
7
|
+
import { IconWindowMaximize, IconWindowMinimize, svgToString } from '../../helper';
|
|
7
8
|
const StyledModal = styled.div `
|
|
8
9
|
width: ${props => props.$width};
|
|
9
10
|
height: ${props => props.$height};
|
|
@@ -38,11 +39,46 @@ const StyledModalContext = styled.div `
|
|
|
38
39
|
overflow: auto;
|
|
39
40
|
height: 100%;
|
|
40
41
|
`;
|
|
41
|
-
const TMModal = ({ resizable = true, isModal = true, title = '', toolbar, onClose, children, width = '100%', height = '100%', fontSize = FontSize.defaultFontSize, hidePopup = true, askClosingConfirm = false }) => {
|
|
42
|
+
const TMModal = ({ resizable = true, expandable = false, isModal = true, title = '', toolbar, onClose, children, width = '100%', height = '100%', fontSize = FontSize.defaultFontSize, hidePopup = true, askClosingConfirm = false, showCloseButton = true }) => {
|
|
43
|
+
const popupRef = useRef(null);
|
|
42
44
|
const [initialWidth, setInitialWidth] = useState(width);
|
|
43
45
|
const [initialHeight, setInitialHeight] = useState(height);
|
|
44
46
|
const [showPopup, setShowPopup] = useState(false);
|
|
45
47
|
const [isResizing, setIsResizing] = useState(false);
|
|
48
|
+
const [isFullScreen, setIsFullScreen] = useState(false);
|
|
49
|
+
// Dimensioni minime di default per il popup
|
|
50
|
+
const DEFAULT_MIN_WIDTH = 500;
|
|
51
|
+
const DEFAULT_MIN_HEIGHT = 400;
|
|
52
|
+
const [minWidth, setMinWidth] = useState(0);
|
|
53
|
+
const [minHeight, setMinHeight] = useState(0);
|
|
54
|
+
/**
|
|
55
|
+
* Gestore chiamato quando il popup viene mostrato.
|
|
56
|
+
* Calcola e imposta le dimensioni minime del popup in base allo spazio disponibile.
|
|
57
|
+
* Le dimensioni minime sono il valore più piccolo tra le dimensioni effettive del parent e le dimensioni minime di default
|
|
58
|
+
*/
|
|
59
|
+
const handleShown = () => {
|
|
60
|
+
// Usa requestAnimationFrame per attendere il completamento del rendering
|
|
61
|
+
requestAnimationFrame(() => {
|
|
62
|
+
if (popupRef.current && popupRef.current.instance) {
|
|
63
|
+
const instance = popupRef.current.instance();
|
|
64
|
+
if (instance) {
|
|
65
|
+
// Ottiene l'elemento content del popup
|
|
66
|
+
const element = instance.content();
|
|
67
|
+
if (element) {
|
|
68
|
+
const parentElement = element.parentElement;
|
|
69
|
+
if (parentElement) {
|
|
70
|
+
// Legge le dimensioni effettive del contenitore parent
|
|
71
|
+
const widthPx = parentElement.offsetWidth;
|
|
72
|
+
const heightPx = parentElement.offsetHeight;
|
|
73
|
+
// Imposta le dimensioni minime usando il valore più piccolo tra le dimensioni disponibili e quelle di default
|
|
74
|
+
setMinWidth(widthPx < DEFAULT_MIN_WIDTH ? widthPx : DEFAULT_MIN_WIDTH);
|
|
75
|
+
setMinHeight(heightPx < DEFAULT_MIN_HEIGHT ? heightPx : DEFAULT_MIN_HEIGHT);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
};
|
|
46
82
|
useEffect(() => {
|
|
47
83
|
setShowPopup(isModal);
|
|
48
84
|
}, [isModal]);
|
|
@@ -65,6 +101,15 @@ const TMModal = ({ resizable = true, isModal = true, title = '', toolbar, onClos
|
|
|
65
101
|
setShowPopup(false);
|
|
66
102
|
onClose && onClose();
|
|
67
103
|
};
|
|
68
|
-
return (_jsx(_Fragment, { children: isModal ? (_jsx(Popup, { showCloseButton:
|
|
104
|
+
return (_jsx(_Fragment, { children: isModal ? (_jsx(Popup, { ref: popupRef, showCloseButton: showCloseButton, animation: undefined, minWidth: minWidth, minHeight: minHeight, maxHeight: '95%', maxWidth: '95%', dragEnabled: !isResizing, resizeEnabled: resizable, width: expandable && isFullScreen ? '95%' : initialWidth, height: expandable && isFullScreen ? '95%' : initialHeight, title: title, visible: showPopup, onShown: handleShown, onResizeStart: handleResizeStart, onResizeEnd: handleResizeEnd, onHiding: onHiding, toolbarItems: expandable ? [
|
|
105
|
+
{
|
|
106
|
+
widget: 'dxButton',
|
|
107
|
+
location: 'after',
|
|
108
|
+
options: {
|
|
109
|
+
icon: isFullScreen ? svgToString(_jsx(IconWindowMinimize, {})) : svgToString(_jsx(IconWindowMaximize, {})),
|
|
110
|
+
onClick: () => setIsFullScreen(!isFullScreen)
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
] : undefined, children: _jsxs(TMLayoutContainer, { children: [toolbar && (_jsx(TMLayoutItem, { height: "40px", children: _jsx(StyledModalToolbar, { children: toolbar }) })), _jsx(TMLayoutItem, { height: toolbar ? 'calc(100% - 40px)' : '100%', children: _jsx(TMCard, { showBorder: false, padding: false, scrollY: true, children: children }) })] }) })) : (_jsxs(StyledModal, { "$isModal": isModal, className: "temp-modal", "$fontSize": fontSize, "$width": initialWidth, "$height": initialHeight, children: [toolbar ? _jsx(StyledModalToolbar, { children: toolbar }) : _jsx(_Fragment, {}), _jsx(StyledModalContext, { children: children })] })) }));
|
|
69
114
|
};
|
|
70
115
|
export default TMModal;
|
|
@@ -33,7 +33,8 @@ const StyledExeptionToolbar = styled.div `
|
|
|
33
33
|
background-color: white;
|
|
34
34
|
`;
|
|
35
35
|
const StyledMessageToolbar = styled.div `
|
|
36
|
-
position:
|
|
36
|
+
position: sticky;
|
|
37
|
+
bottom: 0;
|
|
37
38
|
display: flex;
|
|
38
39
|
flex-direction: row;
|
|
39
40
|
justify-content: flex-end;
|
|
@@ -95,6 +96,7 @@ const ResponsiveMessageContainer = styled.div `
|
|
|
95
96
|
height: 100%;
|
|
96
97
|
width: 100%;
|
|
97
98
|
background-color: #ffffff;
|
|
99
|
+
overflow: hidden;
|
|
98
100
|
`;
|
|
99
101
|
const ResponsiveMessageContent = styled.div `
|
|
100
102
|
flex: 1;
|
|
@@ -105,6 +107,7 @@ const ResponsiveMessageContent = styled.div `
|
|
|
105
107
|
gap: clamp(8px, 2vw, 20px);
|
|
106
108
|
padding: clamp(8px, 3vw, 25px) clamp(5px, 2vw, 30px);
|
|
107
109
|
min-height: clamp(80px, 15vh, 120px);
|
|
110
|
+
overflow: auto;
|
|
108
111
|
|
|
109
112
|
@media (min-width: 300px) {
|
|
110
113
|
flex-direction: ${props => props.$isMobile ? 'column' : 'row'};
|
|
@@ -33,8 +33,14 @@ const StyledProgressText = styled.p ` font-weight: bold; color: #333; margin: 0;
|
|
|
33
33
|
const StyledMessage = styled.p ` color: #666; font-size: 0.9em; margin-top: 10px; `;
|
|
34
34
|
const StyledAbortButton = styled.button ` background: #ff4d4d; color: white; border: none; border-radius: 5px; padding: 10px 20px; font-size: 1em; cursor: pointer; margin-top: 20px; &:hover { background: #ff6666; } `;
|
|
35
35
|
export const TMWaitPanel = (props) => {
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
const calculateProgress = (value = 0, maxValue = 0) => {
|
|
37
|
+
if (maxValue === 0)
|
|
38
|
+
return 0;
|
|
39
|
+
const progress = (value / maxValue) * 100;
|
|
40
|
+
return Number.isFinite(progress) ? progress : 0;
|
|
41
|
+
};
|
|
42
|
+
let progressValue1 = calculateProgress(props.valuePrimary, props.maxValuePrimary);
|
|
43
|
+
let progressValue2 = calculateProgress(props.valueSecondary, props.maxValueSecondary);
|
|
38
44
|
return (_jsx(StyledWaitPanelOverlay, { children: _jsxs(StyledWaitPanel, { "$height": (props.showPrimary && props.showSecondary) ? '350px' : '250px', children: [_jsx(StyledTitle, { children: props.title }), props.showPrimary &&
|
|
39
45
|
_jsxs("div", { style: { width: '100%', height: '100px' }, children: [_jsx(StyledProgressBarContainer, { children: _jsx(StyledProgressBar, { style: { width: `${progressValue1.toFixed(2)}%` } }) }), _jsxs(StyledProgressText, { children: [progressValue1.toFixed(2), "%"] }), _jsx(StyledMessage, { children: props.textPrimary })] }), props.showSecondary &&
|
|
40
46
|
_jsxs("div", { style: { width: '100%', height: '100px' }, children: [_jsx(StyledProgressBarContainer, { children: _jsx(StyledProgressBar, { style: { width: `${progressValue2.toFixed(2)}%` } }) }), _jsxs(StyledProgressText, { children: [progressValue2.toFixed(2), "%"] }), _jsx(StyledMessage, { children: props.textSecondary })] }), props.isCancelable && _jsx(StyledAbortButton, { onClick: () => props.onAbortClick?.(props.abortController), children: SDKUI_Localizator.Abort })] }) }));
|
|
@@ -33,7 +33,7 @@ export const TMDataListItemChooserForm = (props) => {
|
|
|
33
33
|
if (!props.dataListId)
|
|
34
34
|
return [];
|
|
35
35
|
if (refreshCache)
|
|
36
|
-
DataListCacheService.
|
|
36
|
+
DataListCacheService.Remove();
|
|
37
37
|
TMSpinner.show({ description: `${SDKUI_Localizator.Loading} - ${SDK_Localizator.DataList} ...` });
|
|
38
38
|
let dataList = await DataListCacheService.GetAsync(props.dataListId);
|
|
39
39
|
TMSpinner.hide();
|
|
@@ -59,6 +59,7 @@ export const TMMetadataChooserForm = ({ tmSession, tids, qd, filterMetadata, qdS
|
|
|
59
59
|
dtd.init({ ...dtds[i] });
|
|
60
60
|
const alias = tids?.[i].alias ?? '';
|
|
61
61
|
dtd.customData2 = alias;
|
|
62
|
+
let mds;
|
|
62
63
|
if (!qdShowOnlySelectItems) {
|
|
63
64
|
dtd.metadata?.forEach((md) => {
|
|
64
65
|
const mdWithKey = md;
|
|
@@ -66,6 +67,7 @@ export const TMMetadataChooserForm = ({ tmSession, tids, qd, filterMetadata, qdS
|
|
|
66
67
|
mdWithKey.customData2 = alias;
|
|
67
68
|
mdWithKey.uniqueKey = `${dtd.id}_${md.id}_${alias}`;
|
|
68
69
|
});
|
|
70
|
+
mds = filterMetadata ? dtd.metadata?.filter(filterMetadata) : dtd.metadata;
|
|
69
71
|
}
|
|
70
72
|
else {
|
|
71
73
|
let newMetadata = dtd.metadata?.filter(o => qd.select?.some(s => s.tid == dtd.id && s.mid == o.id && ((s.alias ?? '') == alias)));
|
|
@@ -75,8 +77,8 @@ export const TMMetadataChooserForm = ({ tmSession, tids, qd, filterMetadata, qdS
|
|
|
75
77
|
mdWithKey.customData2 = alias;
|
|
76
78
|
mdWithKey.uniqueKey = `${dtd.id}_${md.id}_${alias}`;
|
|
77
79
|
});
|
|
80
|
+
mds = filterMetadata ? newMetadata?.filter(filterMetadata) : newMetadata;
|
|
78
81
|
}
|
|
79
|
-
let mds = filterMetadata ? dtd.metadata?.filter(filterMetadata) : dtd.metadata;
|
|
80
82
|
dtdList.push({ ...dtd, metadata: mds });
|
|
81
83
|
}
|
|
82
84
|
}
|
|
@@ -14,6 +14,8 @@ interface ITMUserChooserProps extends ITMChooserProps {
|
|
|
14
14
|
hideShowId?: boolean;
|
|
15
15
|
/** Initial value for showChooser */
|
|
16
16
|
initialShowChooser?: boolean;
|
|
17
|
+
/** Allow showing all users with toggle button */
|
|
18
|
+
allowShowAllUsers?: boolean;
|
|
17
19
|
}
|
|
18
20
|
declare const TMUserChooser: React.FunctionComponent<ITMUserChooserProps>;
|
|
19
21
|
export default TMUserChooser;
|
|
@@ -24,6 +26,8 @@ interface ITMUserChooserFormProps extends ITMChooserFormProps<UserDescriptor> {
|
|
|
24
26
|
hideRefresh?: boolean;
|
|
25
27
|
/** Nascondi pulsante mostra ID */
|
|
26
28
|
hideShowId?: boolean;
|
|
29
|
+
/** Allow showing all users with toggle button */
|
|
30
|
+
allowShowAllUsers?: boolean;
|
|
27
31
|
}
|
|
28
32
|
export declare const TMUserChooserForm: React.FunctionComponent<ITMUserChooserFormProps>;
|
|
29
33
|
export declare const TMUserIdViewer: ({ userId, showIcon, noneSelectionText }: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { OwnershipLevels, SDK_Localizator, UserLevels, UserListCacheService } from '@topconsultnpm/sdk-ts';
|
|
4
|
-
import { SDKUI_Localizator, IconSearch, IconUserLevelMember, IconUserLevelAdministrator, IconUserLevelSystemAdministrator, IconUserLevelAutonomousAdministrator, IconWarning, LocalizeOwnershipLevels, LocalizeUserLevels } from '../../helper';
|
|
4
|
+
import { SDKUI_Localizator, IconSearch, IconUserLevelMember, IconUserLevelAdministrator, IconUserLevelSystemAdministrator, IconUserLevelAutonomousAdministrator, IconWarning, LocalizeOwnershipLevels, LocalizeUserLevels, IconShowAllUsersOff, IconShowAllUsers } from '../../helper';
|
|
5
5
|
import { StyledDivHorizontal, StyledTooltipContainer, StyledTooltipSeparatorItem } from '../base/Styled';
|
|
6
6
|
import TMSpinner from '../base/TMSpinner';
|
|
7
7
|
import TMTooltip from '../base/TMTooltip';
|
|
@@ -9,7 +9,8 @@ import TMSummary from '../editors/TMSummary';
|
|
|
9
9
|
import TMChooserForm from '../forms/TMChooserForm';
|
|
10
10
|
import { TMColors } from '../../utils/theme';
|
|
11
11
|
import { TMExceptionBoxManager } from '../base/TMPopUp';
|
|
12
|
-
|
|
12
|
+
import TMButton from '../base/TMButton';
|
|
13
|
+
const TMUserChooser = ({ labelColor, titleForm, filter, readOnly = false, icon, width, dataSource, backgroundColor, openChooserBySingleClick, buttons = [], disabled = false, showBorder = true, hideRefresh = false, hideShowId = false, elementStyle, allowMultipleSelection, values, isModifiedWhen, label, placeHolder, validationItems = [], onValueChanged, showClearButton, initialShowChooser = false, allowShowAllUsers = false }) => {
|
|
13
14
|
const [showChooser, setShowChooser] = useState(initialShowChooser);
|
|
14
15
|
useEffect(() => {
|
|
15
16
|
setShowChooser(initialShowChooser);
|
|
@@ -20,13 +21,15 @@ const TMUserChooser = ({ labelColor, titleForm, filter, readOnly = false, icon,
|
|
|
20
21
|
return (_jsxs(StyledDivHorizontal, { style: { minWidth: '125px', color: isPlaceholder ? '#a9a9a9' : 'inherit' }, children: [values && values.length > 0 && _jsx(TMUserIdViewer, { userId: values?.[0], showIcon: true, noneSelectionText: '' }), values && values.length > 1 && _jsx("p", { style: { marginLeft: '10px' }, children: `(+${values.length - 1} ${values.length == 2 ? 'altro' : 'altri'})` })] }));
|
|
21
22
|
};
|
|
22
23
|
return (_jsxs(_Fragment, { children: [_jsx(TMSummary, { ref: summaryInputRef, width: width, disabled: disabled, placeHolder: placeHolder, readOnly: readOnly, labelColor: labelColor, icon: icon, backgroundColor: backgroundColor, buttons: buttons, showBorder: showBorder, hasValue: values && values.length > 0, showClearButton: showClearButton, iconEditButton: _jsx(IconSearch, { fontSize: 16 }), onEditorClick: () => !readOnly && setShowChooser(true), elementStyle: elementStyle, isModifiedWhen: isModifiedWhen, openEditorOnSummaryClick: openChooserBySingleClick, label: label, template: renderTemplate(), onClearClick: showClearButton ? () => { onValueChanged?.([]); } : undefined, validationItems: validationItems }), showChooser &&
|
|
23
|
-
_jsx(TMUserChooserForm, { title: titleForm, allowMultipleSelection: allowMultipleSelection, hasShowOnlySelectedItems: true, dataSource: dataSource, filter: filter, selectedIDs: values, hideRefresh: hideRefresh, hideShowId: hideShowId, onClose: () => {
|
|
24
|
+
_jsx(TMUserChooserForm, { title: titleForm, allowMultipleSelection: allowMultipleSelection, hasShowOnlySelectedItems: true, dataSource: dataSource, filter: filter, selectedIDs: values, hideRefresh: hideRefresh, hideShowId: hideShowId, allowShowAllUsers: allowShowAllUsers, onClose: () => {
|
|
24
25
|
setShowChooser(false);
|
|
25
26
|
summaryInputRef.current?.focus();
|
|
26
27
|
}, onChoose: (IDs) => { onValueChanged?.(IDs); } })] }));
|
|
27
28
|
};
|
|
28
29
|
export default TMUserChooser;
|
|
29
|
-
export const TMUserChooserForm = ({ allowMultipleSelection, columns, hideRefresh = false, hideShowId = false, startWithShowOnlySelectedItems = true, filter, title, hasShowOnlySelectedItems, width, height, selectedIDs, dataSource, onClose, onChoose }) => {
|
|
30
|
+
export const TMUserChooserForm = ({ allowMultipleSelection, columns, hideRefresh = false, hideShowId = false, startWithShowOnlySelectedItems = true, filter, title, hasShowOnlySelectedItems, width, height, selectedIDs, dataSource, onClose, onChoose, allowShowAllUsers = false }) => {
|
|
31
|
+
const [currentDataSource, setCurrentDataSource] = useState(dataSource);
|
|
32
|
+
const [showingAllUsers, setShowingAllUsers] = useState(false);
|
|
30
33
|
const dataColumns = useMemo(() => {
|
|
31
34
|
return [
|
|
32
35
|
{ dataField: 'domain', caption: SDKUI_Localizator.Domain, dataType: 'string' },
|
|
@@ -42,6 +45,18 @@ export const TMUserChooserForm = ({ allowMultipleSelection, columns, hideRefresh
|
|
|
42
45
|
TMSpinner.hide();
|
|
43
46
|
return users;
|
|
44
47
|
};
|
|
48
|
+
const handleToggleAllUsers = () => {
|
|
49
|
+
if (showingAllUsers) {
|
|
50
|
+
// Torna indietro: ripristina il dataSource originale
|
|
51
|
+
setCurrentDataSource(dataSource);
|
|
52
|
+
setShowingAllUsers(false);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
// Mostra tutti: rimuove il dataSource per usare getItems
|
|
56
|
+
setCurrentDataSource(undefined);
|
|
57
|
+
setShowingAllUsers(true);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
45
60
|
const getTitle = () => {
|
|
46
61
|
let title = SDK_Localizator.Users;
|
|
47
62
|
if (title)
|
|
@@ -49,7 +64,8 @@ export const TMUserChooserForm = ({ allowMultipleSelection, columns, hideRefresh
|
|
|
49
64
|
return title;
|
|
50
65
|
};
|
|
51
66
|
const cellRenderIcon = (data) => _jsx(TMUserIcon, { ud: data.data });
|
|
52
|
-
|
|
67
|
+
const customButton = (allowShowAllUsers && dataSource) ? (_jsx(TMButton, { btnStyle: 'toolbar', caption: showingAllUsers ? SDKUI_Localizator.HideAll : SDKUI_Localizator.ShowAll, onClick: handleToggleAllUsers, icon: showingAllUsers ? _jsx(IconShowAllUsersOff, {}) : _jsx(IconShowAllUsers, {}) })) : undefined;
|
|
68
|
+
return (_jsx(TMChooserForm, { title: getTitle(), allowMultipleSelection: allowMultipleSelection, startWithShowOnlySelectedItems: startWithShowOnlySelectedItems, hasShowOnlySelectedItems: hasShowOnlySelectedItems, width: width, height: height, manageUseLocalizedName: false, columns: columns ?? dataColumns, showDefaultColumns: false, selectedIDs: selectedIDs, cellRenderIcon: cellRenderIcon, dataSource: currentDataSource, getItems: getItems, hasShowId: !hideShowId, hideRefresh: hideRefresh, customButtons: customButton, onClose: onClose, onChoose: (IDs) => onChoose?.(IDs) }));
|
|
53
69
|
};
|
|
54
70
|
export const TMUserIdViewer = ({ userId, showIcon = false, noneSelectionText = `<${SDKUI_Localizator.NoneSelection}>` }) => {
|
|
55
71
|
const [ud, setUd] = useState();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect, useRef } from 'react';
|
|
3
3
|
import { StyledEditorContainer, StyledEditorIcon, StyledEditorLabel, StyledTextareaEditor } from './TMEditorStyled';
|
|
4
4
|
import { FontSize, TMColors } from '../../utils/theme';
|
|
@@ -8,8 +8,10 @@ import TMLayoutContainer, { TMLayoutItem } from '../base/TMLayout';
|
|
|
8
8
|
import TMVilViewer from '../base/TMVilViewer';
|
|
9
9
|
import TMTooltip from '../base/TMTooltip';
|
|
10
10
|
import { DeviceType, useDeviceType } from '../base/TMDeviceProvider';
|
|
11
|
-
import { IconClearButton } from '../../helper';
|
|
11
|
+
import { IconClearButton, IconDataList, SDKUI_Localizator } from '../../helper';
|
|
12
12
|
import styled from 'styled-components';
|
|
13
|
+
import { FormulaItemHelper } from './TMTextExpression';
|
|
14
|
+
import TMChooserForm from '../forms/TMChooserForm';
|
|
13
15
|
const StyledTextAreaEditorButton = styled.div `
|
|
14
16
|
color: ${TMColors.button_icon};
|
|
15
17
|
display: flex;
|
|
@@ -26,7 +28,7 @@ const StyledTextAreaEditorButton = styled.div `
|
|
|
26
28
|
// Define the TMTextArea component
|
|
27
29
|
const TMTextArea = (props) => {
|
|
28
30
|
// Extract properties from the props object
|
|
29
|
-
const { label = '', value = '', width = '100%', height = 'auto', autoFocus = false, showClearButton, validationItems = [], disabled = false, isModifiedWhen = false, fontSize = FontSize.defaultFontSize, elementStyle = {}, icon = null, labelPosition = 'left', readOnly = false, onValueChanged, onBlur, placeHolder, formulaItems = [], buttons = [], maxHeight = 'auto', rows, maxLength, resize = true } = props;
|
|
31
|
+
const { label = '', value = '', width = '100%', height = 'auto', autoFocus = false, showClearButton, validationItems = [], disabled = false, isModifiedWhen = false, fontSize = FontSize.defaultFontSize, elementStyle = {}, icon = null, labelPosition = 'left', readOnly = false, onValueChanged, onBlur, placeHolder, formulaItems = [], buttons = [], maxHeight = 'auto', rows, maxLength, resize = true, autoCalculateRows = true } = props;
|
|
30
32
|
// Reference to the textarea DOM element
|
|
31
33
|
const inputRef = useRef(null);
|
|
32
34
|
// Stores the textarea is focused
|
|
@@ -37,11 +39,15 @@ const TMTextArea = (props) => {
|
|
|
37
39
|
const [formulaMenuItems, setFormulaMenuItems] = useState([]);
|
|
38
40
|
// Stores the calculated number of rows for the textarea
|
|
39
41
|
const [calculatedRows, setCalculatedRows] = useState(rows ?? 1);
|
|
42
|
+
//Show chooserForm formulaItems
|
|
43
|
+
const [showFormulaItemsChooser, setShowFormulaItemsChooser] = useState(false);
|
|
40
44
|
// Manages the state for the custom context menu
|
|
41
45
|
const { clicked, setClicked, points, setPoints } = useContextMenu();
|
|
42
46
|
const deviceType = useDeviceType();
|
|
43
47
|
// Attach a `ResizeObserver` to the textarea to monitor changes in width: dynamically updates rows based on textarea content and width
|
|
44
48
|
useEffect(() => {
|
|
49
|
+
if (!autoCalculateRows)
|
|
50
|
+
return;
|
|
45
51
|
const observer = new ResizeObserver(() => { if (currentValue) {
|
|
46
52
|
updateRows();
|
|
47
53
|
} });
|
|
@@ -51,18 +57,18 @@ const TMTextArea = (props) => {
|
|
|
51
57
|
return () => { if (inputRef.current) {
|
|
52
58
|
observer.unobserve(inputRef.current);
|
|
53
59
|
} };
|
|
54
|
-
}, [currentValue]);
|
|
60
|
+
}, [currentValue, autoCalculateRows]);
|
|
55
61
|
// Update current value whenever the `value` prop changes, synchronize the internal state with the `value` prop
|
|
56
62
|
useEffect(() => {
|
|
57
63
|
setCurrentValue(value);
|
|
58
64
|
}, [value]);
|
|
59
65
|
// Recalculate the number of rows whenever the `currentValue` changes
|
|
60
66
|
useEffect(() => {
|
|
61
|
-
if (currentValue) {
|
|
67
|
+
if (autoCalculateRows && currentValue) {
|
|
62
68
|
const newRowCount = calculateRows(currentValue);
|
|
63
69
|
setCalculatedRows(newRowCount);
|
|
64
70
|
}
|
|
65
|
-
}, [currentValue]);
|
|
71
|
+
}, [currentValue, autoCalculateRows]);
|
|
66
72
|
// Populate the formula menu items whenever the `formulaItems` prop changes
|
|
67
73
|
useEffect(() => {
|
|
68
74
|
if (formulaItems && formulaItems.length > 0) {
|
|
@@ -73,6 +79,30 @@ const TMTextArea = (props) => {
|
|
|
73
79
|
setFormulaMenuItems(menuItems);
|
|
74
80
|
}
|
|
75
81
|
}, [formulaItems]);
|
|
82
|
+
function getFormulaDataSorce() {
|
|
83
|
+
let fiarray = [];
|
|
84
|
+
if (!formulaItems)
|
|
85
|
+
return [];
|
|
86
|
+
let i = 0;
|
|
87
|
+
for (const f of formulaItems) {
|
|
88
|
+
let fi = new FormulaItemHelper();
|
|
89
|
+
fi.id = i;
|
|
90
|
+
fi.paramName = f;
|
|
91
|
+
fiarray.push(fi);
|
|
92
|
+
i++;
|
|
93
|
+
}
|
|
94
|
+
return fiarray;
|
|
95
|
+
}
|
|
96
|
+
const openFormulaItemsChooser = () => {
|
|
97
|
+
return (showFormulaItemsChooser ?
|
|
98
|
+
_jsx(TMChooserForm, { title: SDKUI_Localizator.Parameters, height: '350', width: '300', hasShowId: false, showDefaultColumns: false, allowMultipleSelection: true, columns: [
|
|
99
|
+
{ dataField: 'paramName', caption: SDKUI_Localizator.Name, dataType: 'string', sortOrder: 'asc', alignment: 'left' }
|
|
100
|
+
], dataSource: getFormulaDataSorce(), onClose: () => { setShowFormulaItemsChooser(false); }, onChoose: (IDs) => {
|
|
101
|
+
let expr = value?.toString() ?? '';
|
|
102
|
+
IDs.map(i => expr += formulaItems[i]);
|
|
103
|
+
onValueChanged?.({ target: { value: expr } });
|
|
104
|
+
} }) : _jsx(_Fragment, {}));
|
|
105
|
+
};
|
|
76
106
|
// Adjust the rows dynamically
|
|
77
107
|
const updateRows = () => {
|
|
78
108
|
const newRowCount = calculateRows(currentValue);
|
|
@@ -136,15 +166,19 @@ const TMTextArea = (props) => {
|
|
|
136
166
|
const y = e.clientY - bounds.top;
|
|
137
167
|
// set the x and y coordinates of our users right click
|
|
138
168
|
setPoints({ x, y });
|
|
139
|
-
}, "$isMobile": deviceType === DeviceType.MOBILE, "$maxHeight": maxHeight, "$disabled": disabled, "$vil": validationItems, "$isModified": isModifiedWhen, "$fontSize": fontSize, "$width": width, "$resize": resize }), _jsxs("div", { style: { display: 'flex', flexDirection: 'row', justifyContent: 'flex-start', alignItems: 'center', position: 'absolute', right: '6px', top: label.length > 0 ? '22px' : '7px', pointerEvents: disabled ? 'none' : 'auto', opacity: disabled ? 0.4 : 1 }, children: [
|
|
169
|
+
}, "$isMobile": deviceType === DeviceType.MOBILE, "$maxHeight": maxHeight, "$disabled": disabled, "$vil": validationItems, "$isModified": isModifiedWhen, "$fontSize": fontSize, "$width": width, "$resize": resize }), _jsxs("div", { style: { display: 'flex', flexDirection: 'row', justifyContent: 'flex-start', alignItems: 'center', position: 'absolute', right: '6px', top: label.length > 0 ? '22px' : '7px', pointerEvents: disabled ? 'none' : 'auto', opacity: disabled ? 0.4 : 1 }, children: [formulaItems.length > 0 &&
|
|
170
|
+
_jsx(StyledTextAreaEditorButton, { onClick: () => {
|
|
171
|
+
setShowFormulaItemsChooser(true);
|
|
172
|
+
}, children: _jsx(IconDataList, {}) }), showClearButton && currentValue &&
|
|
140
173
|
_jsx(StyledTextAreaEditorButton, { onClick: () => {
|
|
141
174
|
onValueChanged?.({ target: { value: undefined } });
|
|
142
175
|
setCurrentValue('');
|
|
143
|
-
|
|
176
|
+
if (autoCalculateRows)
|
|
177
|
+
setCalculatedRows(1);
|
|
144
178
|
onBlur?.(undefined);
|
|
145
179
|
}, children: _jsx(IconClearButton, {}) }), buttons.map((buttonItem, index) => {
|
|
146
180
|
return (_jsx(StyledTextAreaEditorButton, { onClick: buttonItem.onClick, children: _jsx(TMTooltip, { content: buttonItem.text, children: buttonItem.icon }) }, buttonItem.text));
|
|
147
|
-
})] }), formulaItems.length > 0 && clicked && (_jsx(TMContextMenu, { menuData: formulaMenuItems, top: points.y, left: points.x, onMenuItemClick: (formula) => insertText(formula) })), _jsx(TMVilViewer, { vil: validationItems })] });
|
|
181
|
+
})] }), openFormulaItemsChooser(), formulaItems.length > 0 && clicked && (_jsx(TMContextMenu, { menuData: formulaMenuItems, top: points.y, left: points.x, onMenuItemClick: (formula) => insertText(formula) })), _jsx(TMVilViewer, { vil: validationItems })] });
|
|
148
182
|
};
|
|
149
183
|
// Layout for the textarea with a left-aligned label
|
|
150
184
|
const renderedLeftLabelTextArea = () => {
|