@topconsultnpm/sdkui-react-beta 6.12.27 → 6.12.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.
@@ -41,6 +41,15 @@ const TMChooserForm = ({ children, title, allowMultipleSelection = false, startW
|
|
41
41
|
const ToolbarButtons = () => {
|
42
42
|
return (_jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start', gap: '2px' }, children: [_jsx(TMButton, { btnStyle: 'toolbar', caption: SDKUI_Localizator.Apply, disabled: selectedRowCounter.length <= 0, icon: _jsx(IconApply, {}), color: 'success', fontSize: '1.3rem', onClick: () => { onChoose?.(getSelectedIDs()); onClose?.(); } }), hasShowId ? _jsx(TMButton, { btnStyle: 'toolbar', caption: showId ? SDKUI_Localizator.ID_Hide : SDKUI_Localizator.ID_Show, icon: showId ? _jsx(IconHide, {}) : _jsx(IconShow, {}), fontSize: '1.3rem', onClick: () => { setShowId(!showId); onShowIdChanged?.(); } }) : _jsx(_Fragment, {}), !hideRefresh && _jsx(TMButton, { btnStyle: 'toolbar', caption: SDKUI_Localizator.Refresh, icon: _jsx(IconRefresh, {}), fontSize: '1.3rem', onClick: () => { doGetItems(true); } }), customButtons, hasShowOnlySelectedItems && allowMultipleSelection && _jsx(TMToggleButton, { value: showOnlySelectedItems, elementStyle: { marginLeft: '10px' }, label: 'Mostra solo selezionati', onValueChanged: () => setShowOnlySelectedItems(!showOnlySelectedItems) })] }));
|
43
43
|
};
|
44
|
+
/** check if it's possible to manage double-click to choose */
|
45
|
+
const allowChooseDoubleClick = () => {
|
46
|
+
if (!allowMultipleSelection)
|
47
|
+
return true;
|
48
|
+
if (selectedRowCounter.length <= 0)
|
49
|
+
return true;
|
50
|
+
return false;
|
51
|
+
};
|
52
|
+
/** Handle the selection changed when allowMultipleSelection */
|
44
53
|
const handleSelectionChanged = useCallback((e) => {
|
45
54
|
const selectedKeys = e.component.getSelectedRowKeys() ?? [];
|
46
55
|
setSelectedRowCounter(selectedKeys);
|
@@ -48,12 +57,14 @@ const TMChooserForm = ({ children, title, allowMultipleSelection = false, startW
|
|
48
57
|
return;
|
49
58
|
setSelectedRowKeys(selectedKeys);
|
50
59
|
}, [selectedRowKeys]);
|
60
|
+
/** Handle the row double-click event */
|
51
61
|
const handleRowDoubleClick = useCallback(() => {
|
52
|
-
if (
|
62
|
+
if (!allowChooseDoubleClick())
|
53
63
|
return;
|
54
64
|
onChoose?.(getFocusedIDs());
|
55
65
|
onClose?.();
|
56
|
-
}, [
|
66
|
+
}, [allowChooseDoubleClick, onChoose, onClose, getFocusedIDs]);
|
67
|
+
/** Handle the focused row changed */
|
57
68
|
const handleFocusedRowChange = useCallback((e) => {
|
58
69
|
setFocusedRowKey(e.row?.key);
|
59
70
|
}, []);
|