@topconsultnpm/sdkui-react-beta 6.17.6 → 6.17.8

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
- if (showFilterPanel && e.fullName === 'filterValue' || e.fullName?.startsWith('columns') && e.fullName.endsWith('filterValues')) {
188
- const newHasFilters = Array.isArray(e.value) ? e.value.length > 0 : !!e.value;
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,
@@ -9,6 +9,7 @@ export interface ITMDropDownMenu {
9
9
  disabled?: boolean;
10
10
  borderRadius?: string;
11
11
  items?: ITMDropDownMenuItem[];
12
+ onMenuShown?: () => void;
12
13
  }
13
14
  export interface ITMDropDownMenuItem {
14
15
  icon?: any;
@@ -30,7 +30,7 @@ const StyledMenuItem = styled.div `
30
30
  width: 100%;
31
31
  font-size: ${FontSize.defaultFontSize};
32
32
  `;
33
- const TMDropDownMenu = forwardRef(({ content, items, disabled = false, color = TMColors.text_normal, backgroundColor = TMColors.default_background, borderRadius }, ref) => {
33
+ const TMDropDownMenu = forwardRef(({ content, items, disabled = false, color = TMColors.text_normal, backgroundColor = TMColors.default_background, borderRadius, onMenuShown }, ref) => {
34
34
  const [id, setID] = useState('');
35
35
  const dropDownMenuElementRef = useRef(null); // Ref all'elemento DOM div principale
36
36
  useEffect(() => { setID(genUniqueId()); }, [content]);
@@ -40,6 +40,6 @@ const TMDropDownMenu = forwardRef(({ content, items, disabled = false, color = T
40
40
  },
41
41
  }));
42
42
  const renderItemTemplate = (itemData) => (_jsxs(StyledMenuItem, { children: [itemData.icon && _jsx("div", { style: { display: 'flex', alignItems: 'center' }, children: itemData.icon }), _jsx("span", { style: { flexGrow: 1 }, children: itemData.text }), itemData.items && _jsx("span", { className: "dx-icon-spinright dx-icon", style: { marginLeft: '10px' } })] }));
43
- return (_jsxs(_Fragment, { children: [_jsx(StyledContent, { id: `idContainer${id}`, ref: dropDownMenuElementRef, tabIndex: disabled ? -1 : 0, "$disabled": disabled, "$color": color, "$backgroundColor": backgroundColor, "$borderRadius": borderRadius, children: content }), _jsx(ContextMenu, { target: `#idContainer${id}`, dataSource: items, showEvent: 'click', itemRender: renderItemTemplate, onHidden: (e) => dropDownMenuElementRef.current?.focus() })] }));
43
+ return (_jsxs(_Fragment, { children: [_jsx(StyledContent, { id: `idContainer${id}`, ref: dropDownMenuElementRef, tabIndex: disabled ? -1 : 0, "$disabled": disabled, "$color": color, "$backgroundColor": backgroundColor, "$borderRadius": borderRadius, children: content }), _jsx(ContextMenu, { target: `#idContainer${id}`, dataSource: items, showEvent: 'click', itemRender: renderItemTemplate, onShown: (e) => onMenuShown?.(), onHidden: (e) => dropDownMenuElementRef.current?.focus() })] }));
44
44
  });
45
45
  export default TMDropDownMenu;
@@ -273,7 +273,7 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
273
273
  setQd({ ...qd, orderBy: newOrderBy });
274
274
  }, [qd, fromDTD?.metadata, SQD?.masterTID]);
275
275
  return (_jsxs(_Fragment, { children: [_jsxs(TMPanel, { title: fromDTD?.nameLoc ?? SDKUI_Localizator.Search_Metadata, allowMaximize: allowMaximize, onMaximize: onMaximizePanel, onHeaderDoubleClick: onMaximizePanel, onBack: onBack, onActiveChanged: handlePanelActiveChanged, toolbar: _jsx(_Fragment, { children: (SQD && !showSqdForm) ?
276
- _jsx(TMDropDownMenu, { backgroundColor: 'white', borderRadius: '3px', content: _jsx(TMButton, { btnStyle: 'icon', caption: 'Altro', icon: _jsx(IconMenuVertical, { color: 'white' }), showTooltip: false }), items: [
276
+ _jsx(TMDropDownMenu, { backgroundColor: 'white', borderRadius: '3px', content: _jsx(TMButton, { btnStyle: 'icon', caption: 'Altro', icon: _jsx(IconMenuVertical, { color: 'white' }), showTooltip: false, onClick: () => setIsQueryPanelActive(true) }), items: [
277
277
  ...(showBackToResultButton ? [{ icon: _jsx(IconArrowRight, {}), text: "Vai a risultato", onClick: () => { onBackToResult?.(); } }] : []),
278
278
  { icon: _jsx(IconAddCircleOutline, {}), beginGroup: true, text: SDKUI_Localizator.SavedQueryNew, onClick: () => { openSqdForm(FormModes.Create); } },
279
279
  { icon: _jsx(IconEdit, {}), text: SDKUI_Localizator.SavedQueryUpdate, disabled: (SQD && SQD.id == 1), onClick: () => { openSqdForm(FormModes.Update); } },
@@ -282,7 +282,7 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
282
282
  { icon: _jsx(IconEdit, {}), text: `${SDKUI_Localizator.Configure} - ${SDK_Localizator.QuerySelect}`, onClick: () => { setShowOutputConfig(true); } },
283
283
  { icon: _jsx(IconEdit, {}), text: `${SDKUI_Localizator.Configure} - ${SDK_Localizator.QueryOrderBy}`, onClick: () => { setShowOrderByConfig(true); } },
284
284
  { icon: _jsx(IconMenuCAArchive, { fontSize: 24 }), beginGroup: true, text: SDKUI_Localizator.PassToArchive, onClick: handlePassToArchive }
285
- ] })
285
+ ], onMenuShown: () => setIsQueryPanelActive(true) })
286
286
  : _jsx(_Fragment, {}) }), children: [_jsx(ConfirmQueryParamsDialog, {}), SQD
287
287
  ? _jsxs("div", { style: { height: '100%', width: '100%', position: 'relative', display: 'flex', flexDirection: 'column', gap: 5 }, children: [showAdvancedSearch
288
288
  ? _jsx(TMQueryEditor, { formMode: FormModes.Update, showToolbar: false, inputData: qd, validateSelect: true, showApply: false, onQDChanged: handleQdChanged })
@@ -687,7 +687,16 @@ const TMSearchResultGrid = ({ openInOffice, inputFocusedItem, showSearch, allowM
687
687
  }, [onDblClick]);
688
688
  const dataColumns = useMemo(() => {
689
689
  return [
690
- { dataType: "object", dataField: 'FILEEXT', caption: '', visible: true, width: 50, cellRender: (cellData) => renderDcmtIcon(cellData, onDownloadDcmtsAsync, openInOffice), allowResizing: false, },
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]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.17.6",
3
+ "version": "6.17.8",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",