@topconsultnpm/sdkui-react-beta 6.17.6 → 6.17.7
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.
|
@@ -184,13 +184,37 @@ const TMDataGrid = React.forwardRef((props, ref) => {
|
|
|
184
184
|
}
|
|
185
185
|
}, [onContentReady]);
|
|
186
186
|
const onOptionChangedCallback = useCallback((e) => {
|
|
187
|
-
|
|
188
|
-
|
|
187
|
+
// Assicurati che component esista
|
|
188
|
+
const grid = e.component;
|
|
189
|
+
if (!grid)
|
|
190
|
+
return;
|
|
191
|
+
// Controlla se il cambiamento riguarda i filtri
|
|
192
|
+
const isFilterChange = e.fullName === 'filterValue' || (e.fullName?.startsWith('columns') && e.fullName.endsWith('filterValues'));
|
|
193
|
+
if (isFilterChange) {
|
|
194
|
+
let newHasFilters = false;
|
|
195
|
+
// Filtro globale
|
|
196
|
+
const filterValue = grid.option('filterValue');
|
|
197
|
+
if (Array.isArray(filterValue)) {
|
|
198
|
+
newHasFilters = filterValue.length > 0;
|
|
199
|
+
}
|
|
200
|
+
else if (filterValue) {
|
|
201
|
+
newHasFilters = true;
|
|
202
|
+
}
|
|
203
|
+
// Filtro per colonne
|
|
204
|
+
const columns = grid.option('columns') || [];
|
|
205
|
+
const columnFilters = columns.some((col) => {
|
|
206
|
+
if (Array.isArray(col.filterValues))
|
|
207
|
+
return col.filterValues.length > 0;
|
|
208
|
+
return !!col.filterValue;
|
|
209
|
+
});
|
|
210
|
+
if (columnFilters)
|
|
211
|
+
newHasFilters = true;
|
|
189
212
|
setHasFilters(newHasFilters);
|
|
190
213
|
onHasFiltersChange?.(newHasFilters);
|
|
191
214
|
}
|
|
215
|
+
// Propaga l'evento originale
|
|
192
216
|
onOptionChanged?.(e);
|
|
193
|
-
}, [onOptionChanged]);
|
|
217
|
+
}, [onOptionChanged, onHasFiltersChange]);
|
|
194
218
|
return _jsxs("div", { style: { width: "100%", height: "100%" }, children: [_jsx("div", { style: { width: "100%", height: counterConfig.show ? "calc(100% - 25px)" : "100%" }, children: _jsxs(DataGrid, { ref: internalRef, id: id, className: `tm-datagrid ${hasFilters ? 'has-filters' : ''}`,
|
|
195
219
|
// main properties
|
|
196
220
|
keyExpr: keyExpr, dataSource: dataSource, selectedRowKeys: selectedRowKeys, focusedRowEnabled: focusedRowEnabled, hoverStateEnabled: hoverStateEnabled,
|
|
@@ -687,7 +687,16 @@ const TMSearchResultGrid = ({ openInOffice, inputFocusedItem, showSearch, allowM
|
|
|
687
687
|
}, [onDblClick]);
|
|
688
688
|
const dataColumns = useMemo(() => {
|
|
689
689
|
return [
|
|
690
|
-
{
|
|
690
|
+
{
|
|
691
|
+
dataType: "object",
|
|
692
|
+
dataField: 'FILEEXT',
|
|
693
|
+
caption: '',
|
|
694
|
+
visible: true,
|
|
695
|
+
width: 50,
|
|
696
|
+
cellRender: (cellData) => renderDcmtIcon(cellData, onDownloadDcmtsAsync, openInOffice),
|
|
697
|
+
allowResizing: false,
|
|
698
|
+
filterOperations: ['=']
|
|
699
|
+
},
|
|
691
700
|
...columns.filter(col => col.dataField !== 'FILEEXT')
|
|
692
701
|
];
|
|
693
702
|
}, [columns, onDownloadDcmtsAsync, openInOffice]);
|