@topconsultnpm/sdkui-react-beta 6.17.7 → 6.17.9

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.
@@ -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 })
@@ -17,10 +17,10 @@ export const getSelectedDcmtsOrFocused = (selectedItems, focusedItem, fileFormat
17
17
  if (selectedItems.length <= 0 && !focusedItem)
18
18
  return [];
19
19
  if (selectedItems.length > 0) {
20
- return selectedItems.map((item) => { return { TID: item.TID, DID: item.DID, FILEEXT: item.FILEEXT, fileFormat: fileFormat, rowIndex: item.rowIndex }; });
20
+ return selectedItems.map((item) => { return { TID: item.TID, DID: item.DID, FILEEXT: item.FILEEXT, ISSIGNED: item.ISSIGNED ?? 0, fileFormat: fileFormat, rowIndex: item.rowIndex }; });
21
21
  }
22
22
  else if (focusedItem !== undefined) {
23
- return [{ TID: focusedItem.TID, DID: focusedItem.DID, FILEEXT: focusedItem.FILEEXT, fileFormat: fileFormat, rowIndex: focusedItem.rowIndex }];
23
+ return [{ TID: focusedItem.TID, DID: focusedItem.DID, FILEEXT: focusedItem.FILEEXT, ISSIGNED: focusedItem.ISSIGNED ?? 0, fileFormat: fileFormat, rowIndex: focusedItem.rowIndex }];
24
24
  }
25
25
  return [];
26
26
  };
@@ -223,11 +223,14 @@ export const getCommandsMenuItems = (isMobile, dtd, selectedItems, focusedItem,
223
223
  };
224
224
  };
225
225
  const pdfEditorMenuItem = (openEditPdfCallback) => {
226
+ const selectedDocs = getSelectedDcmtsOrFocused(selectedItems, focusedItem);
227
+ const firstDoc = selectedDocs?.[0];
228
+ const isDisabled = disabledForSingleRow(selectedItems, focusedItem) || firstDoc?.FILEEXT?.toLowerCase() !== "pdf" || firstDoc?.ISSIGNED === 1;
226
229
  return {
227
230
  icon: svgToString(_jsx(IconEdit, {})),
228
231
  text: "PDF Editor",
229
232
  operationType: 'singleRow',
230
- disabled: disabledForSingleRow(selectedItems, focusedItem) || getSelectedDcmtsOrFocused(selectedItems, focusedItem)?.[0]?.FILEEXT?.toLowerCase() !== "pdf",
233
+ disabled: isDisabled,
231
234
  onClick: () => openEditPdfCallback(getSelectedDcmtsOrFocused(selectedItems, focusedItem)),
232
235
  };
233
236
  };
package/lib/ts/types.d.ts CHANGED
@@ -72,6 +72,7 @@ export type DcmtInfo = {
72
72
  DID: number;
73
73
  FILE?: File;
74
74
  FILEEXT?: string;
75
+ ISSIGNED?: number;
75
76
  fileFormat?: FileFormats;
76
77
  metadataValues?: MetadataValueDescriptorEx[];
77
78
  fileName?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.17.7",
3
+ "version": "6.17.9",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",