@topconsultnpm/sdkui-react 6.20.0-dev1.35 → 6.20.0-dev1.36
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.
|
@@ -32,8 +32,8 @@ export interface TMDataGridProps<T> extends IDataGridOptions {
|
|
|
32
32
|
pageSize?: TMDataGridPageSize;
|
|
33
33
|
/** Configures the search panel position in the toolbar */
|
|
34
34
|
searchPanelToolbarPosition?: 'before' | 'default';
|
|
35
|
-
/**
|
|
36
|
-
|
|
35
|
+
/** Trigger to set focus on SearchPanel (only if visible) - change the number to trigger focus */
|
|
36
|
+
searchPanelFocusTrigger?: number;
|
|
37
37
|
/** Show the header filter */
|
|
38
38
|
showHeaderFilter?: boolean;
|
|
39
39
|
/** Show the filter panel */
|
|
@@ -17,7 +17,7 @@ const TMDataGrid = React.forwardRef((props, ref) => {
|
|
|
17
17
|
// main properties
|
|
18
18
|
keyExpr = 'id', dataSource, focusedRowEnabled = true, hoverStateEnabled = true, focusedRowKey, selectedRowKeys = [],
|
|
19
19
|
// custom options
|
|
20
|
-
dataColumns = [], pageSize = TMDataGridPageSize.Large, showHeaderFilter = true, showFilterPanel = true, showHeaderColumnChooser = false, showLoadPanel = true, showSearchPanel = true, searchPanelToolbarPosition = 'before',
|
|
20
|
+
dataColumns = [], pageSize = TMDataGridPageSize.Large, showHeaderFilter = true, showFilterPanel = true, showHeaderColumnChooser = false, showLoadPanel = true, showSearchPanel = true, searchPanelToolbarPosition = 'before', searchPanelFocusTrigger = 0, counterConfig = { show: false, items: new Map() }, onHasFiltersChange, customContextMenuItems,
|
|
21
21
|
// events and callbacks
|
|
22
22
|
onSelectionChanged, onFocusedRowChanged, onRowDblClick, onRowClick, onCellClick, onCellDblClick, onOptionChanged, onContentReady, onContextMenuPreparing, onInitialized, onEditorPreparing, onCellPrepared, onRowPrepared, onRowUpdating, onRowExpanded, onRowCollapsed, onRowUpdated, onSaved, onEditCanceled, onEditingStart, onEditingChange, customizeColumns, onKeyDown, scrolling = { mode: 'standard', useNative: SDKUI_Globals.userSettings?.themeSettings.gridSettings.useNativeScrollbar === 1 }, paging = { enabled: true, pageSize: pageSize }, pager = { visible: true, showInfo: true, showNavigationButtons: true }, selection = { mode: 'multiple', showCheckBoxesMode: "always", selectAllMode: "allPages" }, sorting, summary, stateStoring, grouping, groupPanel, filterRow, headerFilter, editing, rowDragging, masterDetail,
|
|
23
23
|
// other properties
|
|
@@ -39,6 +39,17 @@ const TMDataGrid = React.forwardRef((props, ref) => {
|
|
|
39
39
|
const count = getRecordCount(dataSource);
|
|
40
40
|
setTotalRecordCount(count);
|
|
41
41
|
}, [dataSource]);
|
|
42
|
+
// Handle search panel focus when trigger changes
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (!searchPanelFocusTrigger || searchPanelFocusTrigger <= 0 || !showSearchPanel || !internalRef.current)
|
|
45
|
+
return;
|
|
46
|
+
setTimeout(() => {
|
|
47
|
+
const searchInput = internalRef.current?.instance().element().querySelector('.dx-datagrid-search-panel input');
|
|
48
|
+
if (searchInput) {
|
|
49
|
+
searchInput.focus();
|
|
50
|
+
}
|
|
51
|
+
}, 100);
|
|
52
|
+
}, [searchPanelFocusTrigger, showSearchPanel]);
|
|
42
53
|
// Handle custom context menu (only when customContextMenuItems is provided)
|
|
43
54
|
useEffect(() => {
|
|
44
55
|
if (!customContextMenuItems || !gridContainerRef.current)
|
|
@@ -258,10 +269,9 @@ const TMDataGrid = React.forwardRef((props, ref) => {
|
|
|
258
269
|
return;
|
|
259
270
|
// Update state with the current number of visible rows in the DataGrid
|
|
260
271
|
setVisibleItemsCount(internalRef.current.instance()?.getVisibleRows()?.length ?? 0);
|
|
261
|
-
// Focusing SearchPanel
|
|
262
|
-
if (showSearchPanel &&
|
|
272
|
+
// Focusing SearchPanel on content ready
|
|
273
|
+
if (showSearchPanel && searchPanelFocusTrigger && searchPanelFocusTrigger > 0) {
|
|
263
274
|
// Use a small delay to ensure the DOM is fully rendered before trying to focus
|
|
264
|
-
// This can prevent issues with the focus not being set correctly
|
|
265
275
|
setTimeout(() => {
|
|
266
276
|
const searchInput = internalRef.current?.instance().element().querySelector('.dx-datagrid-search-panel input');
|
|
267
277
|
if (searchInput) {
|
|
@@ -269,7 +279,7 @@ const TMDataGrid = React.forwardRef((props, ref) => {
|
|
|
269
279
|
}
|
|
270
280
|
}, 100);
|
|
271
281
|
}
|
|
272
|
-
}, [onContentReady]);
|
|
282
|
+
}, [onContentReady, showSearchPanel, searchPanelFocusTrigger]);
|
|
273
283
|
const onOptionChangedCallback = useCallback((e) => {
|
|
274
284
|
// Assicurati che component esista
|
|
275
285
|
const grid = e.component;
|
|
@@ -88,7 +88,7 @@ const TMChooserForm = ({ children, title, allowMultipleSelection = false, allowA
|
|
|
88
88
|
}, [manageUseLocalizedName, summaryItems]);
|
|
89
89
|
return (_jsx(TMModal, { title: renderTitle(), width: width ?? '550px', height: height ?? '600px', toolbar: _jsx(ToolbarButtons, {}), onClose: onClose, children: children ??
|
|
90
90
|
filteredItems.length > 0
|
|
91
|
-
? _jsx(TMDataGrid, { dataSource: filteredItems, keyExpr: keyName, dataColumns: dataColumns, focusedRowKey: focusedRowKey, selectedRowKeys: selectedRowKeys,
|
|
91
|
+
? _jsx(TMDataGrid, { dataSource: filteredItems, keyExpr: keyName, dataColumns: dataColumns, focusedRowKey: focusedRowKey, selectedRowKeys: selectedRowKeys, searchPanelFocusTrigger: 1, headerFilter: { visible: true }, selection: { mode: allowMultipleSelection ? 'multiple' : 'single', showCheckBoxesMode: 'always', selectAllMode: 'allPages' }, grouping: allowGrouping ? { autoExpandAll: false, expandMode: 'rowClick' } : undefined, summary: customSummary, showFilterPanel: showFilterPanel, onFocusedRowChanged: handleFocusedRowChange, onSelectionChanged: handleSelectionChanged, onRowDblClick: handleRowDoubleClick })
|
|
92
92
|
: _jsx(TMLayoutContainer, { gap: 30, alignItems: 'center', justifyContent: 'center', children: _jsx(TMLayoutItem, { children: _jsx("p", { style: { height: "100%", color: TMColors.primaryColor, fontSize: "1.5rem", display: 'flex', alignItems: 'center', justifyContent: 'center' }, children: SDKUI_Localizator.NoDataToDisplay }) }) }) }));
|
|
93
93
|
};
|
|
94
94
|
export default TMChooserForm;
|