@topconsultnpm/sdkui-react-beta 6.13.87 → 6.13.88

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.
@@ -1,8 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useMemo } from 'react';
2
3
  import styled from 'styled-components';
3
4
  import { getFileIcon } from '../../../helper';
4
5
  import TMTooltip from '../../base/TMTooltip';
5
6
  import { DownloadTypes } from '../../../ts';
7
+ import { DeviceType, useDeviceType } from '../../base/TMDeviceProvider';
6
8
  const StyledCellRenderDcmtIcon = styled.div `
7
9
  display: flex;
8
10
  flex-direction: row;
@@ -12,16 +14,24 @@ const StyledCellRenderDcmtIcon = styled.div `
12
14
  position: relative;
13
15
  `;
14
16
  const TMDcmtIcon = ({ fileExtension, fileCount, isLexProt, isSigned, isMail, isShared, tid, did, downloadMode = "none", onDownloadDcmtsAsync }) => {
17
+ const deviceType = useDeviceType();
18
+ let isMobile = useMemo(() => { return deviceType === DeviceType.MOBILE; }, [deviceType]);
19
+ const isDownloadable = downloadMode !== "none" &&
20
+ tid !== undefined &&
21
+ did !== undefined &&
22
+ onDownloadDcmtsAsync !== undefined;
15
23
  const handleClick = async (e) => {
16
- if (downloadMode !== "none" &&
17
- tid !== undefined &&
18
- did !== undefined && onDownloadDcmtsAsync !== undefined) {
24
+ if (isDownloadable) {
19
25
  e.stopPropagation();
20
26
  let dcmt = [{ TID: tid, DID: did, FILEEXT: fileExtension }];
21
27
  await onDownloadDcmtsAsync?.(dcmt, DownloadTypes.Dcmt, downloadMode);
22
28
  }
23
29
  };
24
- return (_jsxs(StyledCellRenderDcmtIcon, { style: { cursor: downloadMode !== "none" && tid !== undefined && did !== undefined && onDownloadDcmtsAsync !== undefined ? "pointer" : undefined }, onClick: handleClick, children: [getFileIcon(isMail == 2 ? "PEC" : fileExtension, fileCount), isLexProt == 1 && _jsx("div", { style: { position: 'absolute', left: '-7px', top: isShared ? undefined : '2px' }, children: _jsx(TMTooltip, { content: "Protezione LEX", children: _jsx(IconLexProtLock, { color: 'blue', fontSize: 13 }) }) }), isShared == 1 && _jsx("div", { style: { position: 'absolute', top: '-7px', left: '-5px' }, children: _jsx(TMTooltip, { content: "Documento condiviso", children: _jsx(IconShared, { fontSize: 16 }) }) }), isSigned == 1 && _jsx("div", { style: { position: 'absolute', bottom: '-4px', right: '-7px' }, children: _jsx(TMTooltip, { content: "Documento firmato", children: _jsx(IconSignature, { fontSize: 28 }) }) })] }));
30
+ return (_jsxs(StyledCellRenderDcmtIcon, { className: "tm-dcmt-icon", style: {
31
+ cursor: isMobile
32
+ ? (isDownloadable ? "pointer" : undefined)
33
+ : (isDownloadable ? "default" : undefined)
34
+ }, onClick: isMobile ? handleClick : undefined, onDoubleClick: !isMobile ? handleClick : undefined, children: [getFileIcon(isMail == 2 ? "PEC" : fileExtension, fileCount), isLexProt == 1 && _jsx("div", { style: { position: 'absolute', left: '-7px', top: isShared ? undefined : '2px' }, children: _jsx(TMTooltip, { content: "Protezione LEX", children: _jsx(IconLexProtLock, { color: 'blue', fontSize: 13 }) }) }), isShared == 1 && _jsx("div", { style: { position: 'absolute', top: '-7px', left: '-5px' }, children: _jsx(TMTooltip, { content: "Documento condiviso", children: _jsx(IconShared, { fontSize: 16 }) }) }), isSigned == 1 && _jsx("div", { style: { position: 'absolute', bottom: '-4px', right: '-7px' }, children: _jsx(TMTooltip, { content: "Documento firmato", children: _jsx(IconSignature, { fontSize: 28 }) }) })] }));
25
35
  };
26
36
  export default TMDcmtIcon;
27
37
  function IconLexProtLock(props) {
@@ -573,6 +573,10 @@ const TMSearchResultGrid = ({ inputFocusedItem, allowMultipleSelection = true, o
573
573
  return;
574
574
  if (e.data === undefined)
575
575
  return;
576
+ if (e.event?.target.closest('.tm-dcmt-icon')) {
577
+ // Era sull'icona, non fare nulla
578
+ return;
579
+ }
576
580
  setFocusedItem(e.data);
577
581
  onDblClick();
578
582
  }, [onDblClick]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.13.87",
3
+ "version": "6.13.88",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",