@topconsultnpm/sdkui-react 6.20.0-dev1.10 → 6.20.0-dev1.101

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.
Files changed (157) hide show
  1. package/lib/assets/Toppy-help-center.png +0 -0
  2. package/lib/components/NewComponents/ContextMenu/TMContextMenu.d.ts +4 -0
  3. package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +441 -0
  4. package/lib/components/NewComponents/ContextMenu/hooks.d.ts +18 -0
  5. package/lib/components/NewComponents/ContextMenu/hooks.js +120 -0
  6. package/lib/components/NewComponents/ContextMenu/index.d.ts +5 -0
  7. package/lib/components/NewComponents/ContextMenu/index.js +3 -0
  8. package/lib/components/NewComponents/ContextMenu/styles.d.ts +35 -0
  9. package/lib/components/NewComponents/ContextMenu/styles.js +428 -0
  10. package/lib/components/NewComponents/ContextMenu/types.d.ts +39 -0
  11. package/lib/components/NewComponents/ContextMenu/types.js +1 -0
  12. package/lib/components/NewComponents/ContextMenu/useLongPress.d.ts +21 -0
  13. package/lib/components/NewComponents/ContextMenu/useLongPress.js +112 -0
  14. package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.d.ts +4 -0
  15. package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +821 -0
  16. package/lib/components/NewComponents/FloatingMenuBar/index.d.ts +2 -0
  17. package/lib/components/NewComponents/FloatingMenuBar/index.js +2 -0
  18. package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +54 -0
  19. package/lib/components/NewComponents/FloatingMenuBar/styles.js +419 -0
  20. package/lib/components/NewComponents/FloatingMenuBar/types.d.ts +36 -0
  21. package/lib/components/NewComponents/FloatingMenuBar/types.js +1 -0
  22. package/lib/components/base/TMAccordionNew.js +35 -14
  23. package/lib/components/base/TMCustomButton.js +61 -17
  24. package/lib/components/base/TMDataGrid.d.ts +7 -4
  25. package/lib/components/base/TMDataGrid.js +153 -11
  26. package/lib/components/base/TMDropDownMenu.js +19 -18
  27. package/lib/components/base/TMFileManager.d.ts +4 -3
  28. package/lib/components/base/TMFileManager.js +32 -24
  29. package/lib/components/base/TMFileManagerDataGridView.d.ts +3 -2
  30. package/lib/components/base/TMFileManagerDataGridView.js +1 -11
  31. package/lib/components/base/TMFileManagerThumbnailItems.d.ts +7 -1
  32. package/lib/components/base/TMFileManagerThumbnailItems.js +5 -2
  33. package/lib/components/base/TMFileManagerThumbnailsView.d.ts +17 -4
  34. package/lib/components/base/TMFileManagerThumbnailsView.js +18 -6
  35. package/lib/components/base/TMFileManagerUtils.d.ts +0 -12
  36. package/lib/components/base/TMListView.js +33 -15
  37. package/lib/components/base/TMPanel.d.ts +1 -1
  38. package/lib/components/base/TMPanel.js +1 -1
  39. package/lib/components/choosers/TMDistinctValues.js +1 -1
  40. package/lib/components/choosers/TMInvoiceRetrieveFormats.js +1 -1
  41. package/lib/components/choosers/TMMetadataChooser.js +8 -1
  42. package/lib/components/choosers/TMOrderRetrieveFormats.js +1 -1
  43. package/lib/components/choosers/TMUserChooser.d.ts +0 -5
  44. package/lib/components/choosers/TMUserChooser.js +25 -45
  45. package/lib/components/editors/TMDateBox.js +18 -9
  46. package/lib/components/editors/TMMetadataValues.js +23 -5
  47. package/lib/components/editors/TMTextArea.js +18 -30
  48. package/lib/components/editors/TMTextBox.js +6 -3
  49. package/lib/components/features/archive/TMArchive.js +2 -2
  50. package/lib/components/features/assistant/TMToppyDraggableHelpCenter.d.ts +15 -0
  51. package/lib/components/features/assistant/TMToppyDraggableHelpCenter.js +460 -0
  52. package/lib/components/features/assistant/TMToppySpeechBubble.d.ts +11 -0
  53. package/lib/components/features/assistant/TMToppySpeechBubble.js +126 -0
  54. package/lib/components/features/documents/TMDcmtForm.d.ts +14 -2
  55. package/lib/components/features/documents/TMDcmtForm.js +457 -206
  56. package/lib/components/features/documents/TMDcmtPreview.js +45 -108
  57. package/lib/components/features/documents/TMDcmtTasks.js +9 -9
  58. package/lib/components/features/documents/TMMasterDetailDcmts.js +38 -53
  59. package/lib/components/features/documents/TMRelationViewer.d.ts +1 -1
  60. package/lib/components/features/documents/TMRelationViewer.js +2 -2
  61. package/lib/components/features/search/TMDcmtCheckoutInfoForm.d.ts +8 -0
  62. package/lib/components/features/search/{TMSearchResultCheckoutInfoForm.js → TMDcmtCheckoutInfoForm.js} +2 -2
  63. package/lib/components/features/search/TMSavedQuerySelector.js +72 -67
  64. package/lib/components/features/search/TMSearch.d.ts +3 -0
  65. package/lib/components/features/search/TMSearch.js +50 -11
  66. package/lib/components/features/search/TMSearchQueryPanel.d.ts +1 -0
  67. package/lib/components/features/search/TMSearchQueryPanel.js +29 -21
  68. package/lib/components/features/search/TMSearchResult.d.ts +3 -0
  69. package/lib/components/features/search/TMSearchResult.js +208 -250
  70. package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +3 -3
  71. package/lib/components/features/search/TMSearchResultsMenuItems.js +205 -169
  72. package/lib/components/features/search/TMSignSettingsForm.js +1 -1
  73. package/lib/components/features/search/TMSignatureInfoContent.d.ts +6 -0
  74. package/lib/components/features/search/TMSignatureInfoContent.js +140 -0
  75. package/lib/components/features/search/TMViewHistoryDcmt.js +2 -2
  76. package/lib/components/features/tasks/TMTaskForm.js +20 -1
  77. package/lib/components/features/tasks/TMTasksAgenda.d.ts +3 -1
  78. package/lib/components/features/tasks/TMTasksAgenda.js +48 -9
  79. package/lib/components/features/tasks/TMTasksCalendar.d.ts +2 -0
  80. package/lib/components/features/tasks/TMTasksCalendar.js +19 -7
  81. package/lib/components/features/tasks/TMTasksUtils.d.ts +2 -2
  82. package/lib/components/features/tasks/TMTasksUtils.js +43 -36
  83. package/lib/components/features/tasks/TMTasksView.js +28 -19
  84. package/lib/components/features/workflow/TMWorkflowPopup.d.ts +33 -2
  85. package/lib/components/features/workflow/TMWorkflowPopup.js +139 -34
  86. package/lib/components/features/workflow/diagram/DiagramItemComponent.d.ts +2 -0
  87. package/lib/components/features/workflow/diagram/DiagramItemComponent.js +12 -7
  88. package/lib/components/features/workflow/diagram/RecipientList.js +3 -2
  89. package/lib/components/features/workflow/diagram/WFDiagram.d.ts +4 -0
  90. package/lib/components/features/workflow/diagram/WFDiagram.js +164 -13
  91. package/lib/components/forms/Login/LoginValidatorService.d.ts +2 -0
  92. package/lib/components/forms/Login/LoginValidatorService.js +7 -2
  93. package/lib/components/forms/Login/TMLoginForm.js +34 -6
  94. package/lib/components/forms/TMChooserForm.js +1 -1
  95. package/lib/components/grids/TMBlogsPost.js +56 -31
  96. package/lib/components/grids/TMRecentsManager.js +20 -10
  97. package/lib/components/index.d.ts +5 -3
  98. package/lib/components/index.js +5 -3
  99. package/lib/components/query/TMQueryEditor.d.ts +2 -1
  100. package/lib/components/query/TMQueryEditor.js +92 -92
  101. package/lib/components/settings/SettingsAppearance.d.ts +2 -1
  102. package/lib/components/settings/SettingsAppearance.js +99 -30
  103. package/lib/components/viewers/TMDataListItemViewer.d.ts +2 -1
  104. package/lib/components/viewers/TMDataListItemViewer.js +35 -71
  105. package/lib/components/viewers/TMDataUserIdItemViewer.d.ts +8 -0
  106. package/lib/components/viewers/TMDataUserIdItemViewer.js +39 -0
  107. package/lib/css/tm-sdkui.css +1 -1
  108. package/lib/helper/SDKUI_Globals.d.ts +22 -0
  109. package/lib/helper/SDKUI_Globals.js +10 -1
  110. package/lib/helper/SDKUI_Localizator.d.ts +17 -1
  111. package/lib/helper/SDKUI_Localizator.js +167 -1
  112. package/lib/helper/TMCommandsContextMenu.d.ts +4 -2
  113. package/lib/helper/TMCommandsContextMenu.js +15 -4
  114. package/lib/helper/TMIcons.d.ts +4 -0
  115. package/lib/helper/TMIcons.js +13 -3
  116. package/lib/helper/TMPdfViewer.d.ts +8 -0
  117. package/lib/helper/TMPdfViewer.js +373 -0
  118. package/lib/helper/checkinCheckoutManager.d.ts +31 -1
  119. package/lib/helper/checkinCheckoutManager.js +112 -30
  120. package/lib/helper/devextremeCustomMessages.d.ts +30 -0
  121. package/lib/helper/devextremeCustomMessages.js +30 -0
  122. package/lib/helper/helpers.d.ts +3 -1
  123. package/lib/helper/helpers.js +25 -3
  124. package/lib/helper/index.d.ts +2 -0
  125. package/lib/helper/index.js +2 -0
  126. package/lib/helper/queryHelper.d.ts +1 -1
  127. package/lib/helper/queryHelper.js +33 -3
  128. package/lib/helper/workItemsHelper.d.ts +6 -0
  129. package/lib/helper/workItemsHelper.js +230 -0
  130. package/lib/hooks/useCheckInOutOperations.d.ts +28 -0
  131. package/lib/hooks/useCheckInOutOperations.js +223 -0
  132. package/lib/hooks/useDataListItem.d.ts +12 -0
  133. package/lib/hooks/useDataListItem.js +132 -0
  134. package/lib/hooks/useDataUserIdItem.d.ts +10 -0
  135. package/lib/hooks/useDataUserIdItem.js +96 -0
  136. package/lib/hooks/useSettingsFeedback.d.ts +11 -0
  137. package/lib/hooks/useSettingsFeedback.js +38 -0
  138. package/lib/hooks/useWorkflowApprove.d.ts +4 -0
  139. package/lib/hooks/useWorkflowApprove.js +14 -1
  140. package/lib/index.d.ts +1 -0
  141. package/lib/index.js +3 -2
  142. package/lib/services/platform_services.d.ts +3 -3
  143. package/lib/ts/types.d.ts +61 -1
  144. package/lib/utils/theme.d.ts +1 -1
  145. package/lib/utils/theme.js +1 -1
  146. package/package.json +7 -4
  147. package/lib/components/base/TMContextMenu.d.ts +0 -25
  148. package/lib/components/base/TMContextMenu.js +0 -109
  149. package/lib/components/base/TMContextMenuOLD.d.ts +0 -26
  150. package/lib/components/base/TMContextMenuOLD.js +0 -56
  151. package/lib/components/base/TMFloatingToolbar.d.ts +0 -9
  152. package/lib/components/base/TMFloatingToolbar.js +0 -101
  153. package/lib/components/features/assistant/ToppyDraggableHelpCenter.d.ts +0 -30
  154. package/lib/components/features/assistant/ToppyDraggableHelpCenter.js +0 -482
  155. package/lib/components/features/assistant/ToppySpeechBubble.d.ts +0 -9
  156. package/lib/components/features/assistant/ToppySpeechBubble.js +0 -117
  157. package/lib/components/features/search/TMSearchResultCheckoutInfoForm.d.ts +0 -8
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { HidingEvent } from "devextreme/ui/context_menu";
3
3
  interface TMCommandsContextMenuProps {
4
- target: string | Element | undefined;
4
+ target?: string | Element | undefined;
5
5
  menuItems: Array<any>;
6
6
  id?: string;
7
7
  showEvent?: string | {
@@ -9,6 +9,8 @@ interface TMCommandsContextMenuProps {
9
9
  name?: string;
10
10
  } | undefined;
11
11
  onHiding?: ((e: HidingEvent<any>) => void) | undefined;
12
+ trigger?: 'right' | 'left';
13
+ children?: React.ReactNode;
12
14
  }
13
- export declare const TMCommandsContextMenu: React.MemoExoticComponent<({ target, menuItems, id, showEvent, onHiding }: TMCommandsContextMenuProps) => import("react/jsx-runtime").JSX.Element>;
15
+ export declare const TMCommandsContextMenu: React.MemoExoticComponent<({ target, menuItems, id, showEvent, onHiding, trigger, children }: TMCommandsContextMenuProps) => import("react/jsx-runtime").JSX.Element>;
14
16
  export {};
@@ -1,6 +1,17 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import React from "react";
3
- import { ContextMenu } from "devextreme-react";
4
- export const TMCommandsContextMenu = React.memo(({ target, menuItems, id, showEvent = 'contextmenu', onHiding }) => {
5
- return (_jsx(ContextMenu, { target: target, dataSource: menuItems, id: id, showEvent: showEvent, onHiding: onHiding }));
2
+ import React, { useMemo } from "react";
3
+ import { ContextMenu } from "../components/NewComponents/ContextMenu";
4
+ export const TMCommandsContextMenu = React.memo(({ target, menuItems, id, showEvent = 'contextmenu', onHiding, trigger = 'left', children }) => {
5
+ // Convert DevExtreme menu items format to TMContextMenu format
6
+ const convertedItems = useMemo(() => {
7
+ return menuItems.map(item => ({
8
+ name: item.text,
9
+ icon: item.icon,
10
+ onClick: item.onClick,
11
+ disabled: item.disabled,
12
+ beginGroup: item.beginGroup,
13
+ visible: item.visible,
14
+ }));
15
+ }, [menuItems]);
16
+ return (_jsx(ContextMenu, { target: typeof target === 'string' ? target : undefined, items: convertedItems, trigger: trigger, children: children }));
6
17
  });
@@ -238,6 +238,7 @@ export declare function IconFunction(props: Readonly<React.SVGProps<SVGSVGElemen
238
238
  export declare function IconNull(props?: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
239
239
  declare function IconZoomOutLinear(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
240
240
  declare function IconZoomInLinear(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
241
+ export declare function IconZoomAuto(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
241
242
  declare function IconRoundFileUpload(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
242
243
  declare function IconRotate(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
243
244
  declare function IconPrintOutline(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -275,4 +276,7 @@ export declare function IconUnpair(props: React.SVGProps<SVGSVGElement>): import
275
276
  export declare function IconCtrlWorkflow(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
276
277
  export declare function IconBackhandIndexPointingRight(props: Readonly<React.SVGProps<SVGSVGElement>>): import("react/jsx-runtime").JSX.Element;
277
278
  export declare function IconMoveToFolder(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
279
+ export declare function IconCustom(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
280
+ export declare function IconSeparator(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
281
+ export declare function IconCache(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
278
282
  export { Icon123, IconABC, IconAccessPoint, IconAddressBook, IconSignCert, IconServerService, IconActivity, IconActivityLog, IconAdd, IconAddCircleOutline, IconAll, IconApply, IconApplyAndClose, IconArchive, IconArchiveDoc, IconArrowDown, IconArrowLeft, IconArrowRight, IconArrowUp, IconAtSign, IconAttachment, IconAutoConfig, IconBackward, IconBasket, IconBoard, IconBoxArchiveIn, IconBxInfo, IconBxLock, IconCalendar, IconCloseCircle, IconCloseOutline, IconCloud, IconCircleInfo, IconClear, IconColumns, IconCommand, IconCopy, IconCount, IconCrown, IconDashboard, IconDcmtType, IconDcmtTypeOnlyMetadata, IconDcmtTypeSys, IconDelete, IconDetails, IconDown, IconDownload, IconDotsVerticalCircleOutline, IconDuplicate, IconEdit, IconEqual, IconEqualNot, IconEraser, IconExpandRight, IconExport, IconFastBackward, IconFoldeAdd, IconFolderSearch, IconFolderZip, IconFastForward, IconFastSearch, IconFileDots, IconFilter, IconForceStop, IconForward, IconFreeze, IconFreeSearch, IconGreaterThan, IconGreaterThanOrEqual, IconHistory, IconImport, IconTag, IconInfo, IconInsertAbove, IconInsertBelow, IconHeart, IconHide, IconLanguage, IconLeft, IconLessThan, IconLessThanOrEqual, IconLock, IconLockClosed, IconLogin, IconLink, IconLogout, IconMail, IconMapping, IconMic, IconMenuHorizontal, IconMenuKebab, IconMenuVertical, IconMetadata, IconMetadata_Computed, IconMetadata_DataList, IconMetadata_Date, IconMetadata_DynamicDataList, IconMetadata_Numerator, IconMetadata_Numeric, IconMetadata_Special, IconMetadata_Text, IconMetadata_User, IconMonitor, IconOpenInNew, IconNotification, IconPassword, IconPencil, IconPlatform, IconPlay, IconPreview, IconPrinter, IconPrintOutline, IconProcess, IconProgressAbortRequested, IconProgressCompleted, IconProgressNotCompleted, IconProgressReady, IconProgressRunning, IconProgressStarted, IconRefresh, IconReset, IconRecentlyViewed, IconRight, IconSave, IconSearch, IconSelected, IconSettings, IconShow, IconSort, IconStop, IconStopwatch, IconSuccess, IconAlarmPlus, IconHourglass, IconNone, IconNotStarted, IconProgress, IconSuccessCirlce, IconSuitcase, IconSupport, IconUndo, IconUnFreeze, IconUp, IconUpdate, IconUpload, IconUser, IconUserProfile, IconVisible, IconWarning, IconWeb, IconWifi, IconWindowMaximize, IconWindowMinimize, IconWorkflow, IconWorkspace, IconUserGroup, IconUserGroupOutline, IconUserLevelMember, IconUserLevelAdministrator, IconUserLevelSystemAdministrator, IconUserLevelAutonomousAdministrator, IconDraggabledots, IconRelation, IconEasy, IconSum, IconDisk, IconDataList, IconPalette, IconFormatPageSplit, IconPaste, IconFileSearch, IconStar, IconStarRemove, IconSearchCheck, IconLightningFill, IconArrowUnsorted, IconArrowSortedUp, IconArrowSortedDown, IconConvertFilePdf, IconExportTo, IconSharedDcmt, IconShare, IconBatchUpdate, IconCheckFile, IconStatistics, IconSubstFile, IconAdvanced, IconSync, IconSavedQuery, IconSignature, IconSignaturePencil, IconRecursiveOps, IconCheckIn, IconTree, IconGrid, IconList, IconFolder, IconFolderOpen, IconFactory, IconTest, IconCheck, IconUncheck, IconSortAsc, IconSortDesc, IconRoundFileUpload, IconSortAscLetters, IconSortDescLetters, IconRotate, IconSortAscNumbers, IconSortDescNumbers, IconSortAscClock, IconSortDescClock, IconLayerGroup, IconBell, IconBellCheck, IconBellOutline, IconBellCheckOutline, IconEnvelopeOpenText, IconChangeUser, IconUserCheck, IconRelationManyToMany, IconRelationOneToMany, IconUserExpired, IconKey, IconZoomInLinear, IconZoomOutLinear, IconMenuCAWorkingGroups, IconCADossier, IconMenuCACaseflow, IconMenuDashboard, IconMenuCAAreas, IconMenuTask, IconMenuSearch, IconMenuFullTextSearch, IconMenuFavourite, IconSAPLogin, IconSAPLogin2, IconView, IconNewSignature };
@@ -575,6 +575,9 @@ function IconZoomOutLinear(props) {
575
575
  function IconZoomInLinear(props) {
576
576
  return (_jsxs("svg", { fontSize: props?.fontSize ? props.fontSize : FONTSIZE, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "1em", height: "1em", ...props, children: [" ", _jsx("path", { fill: "currentColor", d: "M19 11h-6V5a1 1 0 0 0-2 0v6H5a1 1 0 0 0 0 2h6v6a1 1 0 0 0 2 0v-6h6a1 1 0 0 0 0-2" }), " "] }));
577
577
  }
578
+ export function IconZoomAuto(props) {
579
+ return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "1em", height: "1em", fontSize: props?.fontSize ? props.fontSize : FONTSIZE, ...props, children: _jsx("path", { fill: "currentColor", d: "m4.4 20.308l-.708-.708l3.6-3.6H4v-1h5v5H8v-3.292zm15.2 0l-3.6-3.6V20h-1v-5h5v1h-3.292l3.6 3.6zM4 9V8h3.292l-3.6-3.6l.708-.708l3.6 3.6V4h1v5zm11 0V4h1v3.292l3.6-3.6l.708.708l-3.6 3.6H20v1z" }) }));
580
+ }
578
581
  function IconRoundFileUpload(props) {
579
582
  return (_jsxs("svg", { fontSize: props?.fontSize ? props.fontSize : FONTSIZE, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "1em", height: "1em", ...props, children: [" ", _jsx("path", { fill: "currentColor", d: "M2 20V4h8l2 2h10v14zm9-3h2v-4.2l1.6 1.6L16 13l-4-4l-4 4l1.4 1.4l1.6-1.6z" }), " "] }));
580
583
  }
@@ -677,9 +680,7 @@ export function IconUnpair(props) {
677
680
  return (_jsxs("svg", { fontSize: props.fontSize ?? FONTSIZE, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "1em", height: "1em", ...props, children: [" ", _jsx("path", { fill: "currentColor", d: "M16.61 13.5c-.8.35-1.5.86-2.07 1.5H9.5a2.5 2.5 0 0 1 0-5H17v1.5H9.5c-.55 0-1 .45-1 1s.45 1 1 1zm-13.11-1c0-2.21 1.79-4 4-4H18a2.495 2.495 0 0 1 1.45 4.53c.6.04 1.18.17 1.72.38c.52-.67.83-1.5.83-2.41c0-2.21-1.79-4-4-4H7.5C4.46 7 2 9.46 2 12.5S4.46 18 7.5 18h5.59c.09-.53.25-1.03.46-1.5H7.5c-2.21 0-4-1.79-4-4M15 18v2h8v-2z" }), " "] }));
678
681
  }
679
682
  export function IconCtrlWorkflow(props) {
680
- return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fontSize: props.fontSize ?? FONTSIZE, viewBox: "0 0 20 20", width: "1em", height: "1em", ...props, children: _jsx("path", { fill: "currentColor",
681
- // stroke="currentColor" strokeWidth="0.3px"
682
- d: "M14.085 2H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h3v2H5.5a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1H13v-2h3a2 2 0 0 0 2-2V7h-1v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h10v-.5q.001-.264.085-.5M12 17H8v-2h4zm3-14.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5v3a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5V5h-.78a.5.5 0 0 0-.474.342l-.544 1.632A1.5 1.5 0 0 1 11.78 8H11v1.5a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-3a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5V7h.78a.5.5 0 0 0 .474-.342l.544-1.632A1.5 1.5 0 0 1 14.22 4H15zM10 7H8v2h2zm6-2h2V3h-2z" }) }));
683
+ return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "1em", height: "1em", ...props, children: _jsx("path", { fill: "currentColor", d: "M4 12.308V18V6zm10.577 7.923q.54 0 .924-.384q.384-.383.384-.924q0-.54-.384-.924q-.384-.383-.924-.383t-.924.383t-.384.924t.384.924t.924.384M20 12q.54 0 .924-.384q.384-.383.384-.924q0-.54-.384-.924q-.383-.383-.924-.383t-.924.383q-.384.384-.384.924t.384.924T20 12M6.5 10.5h5.27v-1H6.5zm0 4h5.27v-1H6.5zM4.616 19q-.691 0-1.153-.462T3 17.384V6.616q0-.691.463-1.153T4.615 5h14.77q.69 0 1.152.463T21 6.616h-1q0-.231-.192-.424T19.385 6H4.615q-.23 0-.423.192T4 6.616v10.769q0 .23.192.423t.423.192h5.654v1zm9.961 2.23q-.961 0-1.635-.672q-.673-.674-.673-1.635q0-.84.515-1.461q.514-.622 1.293-.787v-2.367H19.5V12.94q-.779-.165-1.293-.786q-.515-.621-.515-1.462q0-.961.674-1.634q.673-.674 1.634-.674t1.635.674t.673 1.634q0 .84-.515 1.462q-.514.621-1.293.787v2.367h-5.423v1.367q.779.166 1.293.787q.515.62.515 1.461q0 .962-.673 1.635t-1.635.673" }) }));
683
684
  }
684
685
  export function IconBackhandIndexPointingRight(props) {
685
686
  return (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 128 128", width: "1em", height: "1em", ...props, children: [_jsx("path", { fill: "#E0BB95", d: "M58.7 41.1c10.8.1 53.3.4 54.9.4c12.8.3 12.7 16.7.7 16.9c-1.5 0-25 1.1-32.2 1.3c5.2 2 7.5 11.9-3.1 14.9c5 2.6 6.4 12.9-4.2 14.7c3.8 2.5 4.3 10.9-6 14.2c-8.4 2.7-28.2 2-40.3-2.3c-9.1-3.3-8.4-5.8-16.7-5.6c-1.4 0-2.1-1.1-2.4-2.4c-1.3-5.9-1.9-26.3-.3-33.8c.4-1.6 1.7-1.8 2.2-1.9c2.1-.4 4.2-2.5 5-4.3c3.2-6.4 12.8-12.8 23.4-18.2c5.5-2.8 9.2-8.8 10.4-18.3c.8-6.3 8.6-7.7 11.8-2.5c2.2 3.6 2.9 7 2.9 10.4c.2 6.2-1.6 10.1-6.1 16.5" }), _jsx("defs", { children: _jsx("path", { id: "notoBackhandIndexPointingRightMediumLightSkinTone0", d: "M58.7 41.1c10.8.1 53.3.4 54.9.4c12.8.3 12.7 16.7.7 16.9c-1.5 0-25 1.1-32.2 1.3c5.2 2 7.5 11.9-3.1 14.9c5 2.6 6.4 12.9-4.2 14.7c3.8 2.5 4.3 10.9-6 14.2c-8.4 2.7-28.2 2-40.3-2.3c-9.1-3.3-8.4-5.8-16.7-5.6c-1.4 0-2.1-1.1-2.4-2.4c-1.3-5.9-1.9-26.3-.3-33.8c.4-1.6 1.7-1.8 2.2-1.9c2.1-.4 4.2-2.5 5-4.3c3.2-6.4 12.8-12.8 23.4-18.2c5.5-2.8 9.2-8.8 10.4-18.3c.8-6.3 8.6-7.7 11.8-2.5c2.2 3.6 2.9 7 2.9 10.4c.2 6.2-1.6 10.1-6.1 16.5" }) }), _jsx("clipPath", { id: "notoBackhandIndexPointingRightMediumLightSkinTone1", children: _jsx("use", { href: "#notoBackhandIndexPointingRightMediumLightSkinTone0" }) }), _jsx("g", { fill: "#D19661", clipPath: "url(#notoBackhandIndexPointingRightMediumLightSkinTone1)", children: _jsx("path", { d: "M73.3 59.5c.1 1.6 2.8 2.9 2.8 6.4c0 3.7-3 4.7-3.1 7.5c-.1 2.7 2 3.8 1.5 7.7c-.6 4.5-4.1 4-4.2 7.1c0 2.7 1.8 3.2 1.8 6.6c0 3.1-3 5.8-5.5 7s-1.2 3.4 0 3.4s11.9-1.3 14.5-8.2c3-8 11-29.6 8.8-36.9c-7.1-1-11.5-1.6-13.7-1.8c-.7-.1-2.9-.6-2.9 1.2M60.1 40.7c0 .9.1 1.5 1 1.5c1 0 43.6 2.1 51.6 2.3c9.2.2 8.7 7.6 5.9 10.1c-1.9 1.7.6 4 2.2 2.6s4.4-3.4 4.3-8.4s-4.4-8.6-8.4-8.9c-3.8-.3-56.6.8-56.6.8m-51.9 21c15.9 0 14.1-11.7 25.2-18.9c15.4-10.1 16.3-11.1 19.7-25.2c1.2-4.9 5.7-4.4 7.7-2.1s4.9-1.3 3.6-2.7s-7.8-7.7-14.8-1.1s-42 46.2-42 46.2z" }) }), _jsx("defs", { children: _jsx("use", { href: "#notoBackhandIndexPointingRightMediumLightSkinTone0", id: "notoBackhandIndexPointingRightMediumLightSkinTone2" }) }), _jsx("clipPath", { id: "notoBackhandIndexPointingRightMediumLightSkinTone3", children: _jsx("use", { href: "#notoBackhandIndexPointingRightMediumLightSkinTone2" }) }), _jsx("g", { fill: "#8D542E", clipPath: "url(#notoBackhandIndexPointingRightMediumLightSkinTone3)", children: _jsx("path", { d: "M58.7 41.1h-1.9c-.4 0-.8-.4-.2-1.3s5.8-8 5.8-15c0-3.2-.5-7.7-3.4-12.4c-.6-.9.2-1.4.9-1c.7.5 6.4 3.2 6.5 13.4s-7.7 16.3-7.7 16.3m65.1 8.8c-.5 0-1.1-.2-1.7 1c-.7 1.5-3.1 4.4-8.4 4.7s-38.1 2.5-38.9 2.5c-1.1 0-1.2 1.9.1 1.8c1.7-.1 7.2-.2 7.2-.2s30.9 1.8 36.9-.6c6.1-2.4 4.8-9.2 4.8-9.2M86.6 68.5c-.3-.1-.7-.1-1 .3c-1.5 2-4.6 3.5-10.6 3.3c-1.4 0-1.6 2.7.1 2.7c.7 0 4-.1 4-.1l6.6-.2zm-3.6 15c-.3-.1-.7-.1-1.1.4c-1.5 2-3.5 2.8-9.7 3c-1.5.1-1.4 2.6.2 2.6c1.1 0 2.4-.1 2.4-.1l7-.6zm-5.4 12.7c-.3-.1-.8-.2-1.2.4c-.8 1.1-2.9 3-7.5 4.4c-3.7 1.1-21.3 1.9-32.5-.7c-2.3-.5-9.9-3-13.6-5.3s-7.3-1.6-8.3-1.4s-6.3.7-6.3.7l2.5 3.7l27 8.6l38.5-.6z" }) })] }));
@@ -687,4 +688,13 @@ export function IconBackhandIndexPointingRight(props) {
687
688
  export function IconMoveToFolder(props) {
688
689
  return (_jsx("svg", { fontSize: props.fontSize ?? FONTSIZE, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 28 28", width: "1em", height: "1em", ...props, children: _jsx("path", { d: "M21.5 15a5.5 5.5 0 1 1 0 11a5.5 5.5 0 0 1 0-11zM10.207 4c.46 0 .908.141 1.284.402l.156.12L14.022 6.5h9.728a2.25 2.25 0 0 1 2.229 1.938l.016.158l.005.154v7.06a6.518 6.518 0 0 0-1.499-1.077L24.5 8.75a.75.75 0 0 0-.648-.743L23.75 8h-9.729l-2.374 1.978a2.25 2.25 0 0 1-1.244.513l-.196.009l-6.707-.001V21.75c0 .38.282.693.648.743l.102.007h11.064a6.47 6.47 0 0 0 .709 1.501L4.25 24a2.25 2.25 0 0 1-2.245-2.096L2 21.75V6.25a2.25 2.25 0 0 1 2.096-2.245L4.25 4h5.957zm11.585 13.545l-.076.044l-.07.057l-.057.07a.5.5 0 0 0 0 .568l.057.07l1.646 1.645l-4.798.001l-.09.008a.5.5 0 0 0-.402.402l-.008.09l.008.09a.5.5 0 0 0 .402.402l.09.008l4.8-.001l-1.648 1.647l-.057.07a.5.5 0 0 0 .695.695l.07-.057l2.535-2.541l.031-.042l.042-.08l.026-.083l.01-.064l-.002-.11l-.008-.042l-.026-.083l-.042-.08l-.037-.05l-2.53-2.533l-.069-.057a.5.5 0 0 0-.492-.044zM10.207 5.5H4.25a.75.75 0 0 0-.743.648L3.5 6.25v2.749L10.207 9a.75.75 0 0 0 .395-.113l.085-.06l1.891-1.578l-1.89-1.575a.75.75 0 0 0-.377-.167l-.104-.007z", fill: "currentColor", fillRule: "nonzero" }) }));
689
690
  }
691
+ export function IconCustom(props) {
692
+ return (_jsx("svg", { fontSize: props.fontSize ?? FONTSIZE, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "1em", height: "1em", ...props, children: _jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeMiterlimit: "10", strokeWidth: "1.5", d: "M14 17h6m-3 3v-6M5.6 4h2.8A1.6 1.6 0 0 1 10 5.6v2.8A1.6 1.6 0 0 1 8.4 10H5.6A1.6 1.6 0 0 1 4 8.4V5.6A1.6 1.6 0 0 1 5.6 4m0 10h2.8a1.6 1.6 0 0 1 1.6 1.6v2.8A1.6 1.6 0 0 1 8.4 20H5.6A1.6 1.6 0 0 1 4 18.4v-2.8A1.6 1.6 0 0 1 5.6 14m10-10h2.8A1.6 1.6 0 0 1 20 5.6v2.8a1.6 1.6 0 0 1-1.6 1.6h-2.8A1.6 1.6 0 0 1 14 8.4V5.6A1.6 1.6 0 0 1 15.6 4" }) }));
693
+ }
694
+ export function IconSeparator(props) {
695
+ return (_jsx("svg", { fontSize: props.fontSize ?? FONTSIZE, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "1em", height: "1em", style: { transform: 'rotate(90deg)', ...props.style }, ...props, children: _jsxs("g", { fill: "currentColor", children: [_jsx("path", { d: "M16 5a1 1 0 1 0 0-2H8a1 1 0 1 0 0 2zm0 2a1 1 0 1 1 0 2H8a1 1 0 1 1 0-2zm1 5a1 1 0 0 1-1 1H8a1 1 0 1 1 0-2h8a1 1 0 0 1 1 1m-1 9a1 1 0 1 0 0-2H8a1 1 0 1 0 0 2z", opacity: ".5" }), _jsx("path", { fillRule: "evenodd", d: "M21 16a1 1 0 0 1-1 1H4a1 1 0 1 1 0-2h16a1 1 0 0 1 1 1", clipRule: "evenodd" })] }) }));
696
+ }
697
+ export function IconCache(props) {
698
+ return (_jsx("svg", { fontSize: props.fontSize ?? FONTSIZE, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "1em", height: "1em", ...props, children: _jsxs("g", { fill: "none", children: [" ", _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M6 8a3 3 0 0 1 3-3h10a3 3 0 0 1 3 3v6a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3V8zm-2 .17A3.001 3.001 0 0 0 2 11v7a3 3 0 0 0 3 3h10a3.001 3.001 0 0 0 2.83-2H9a5 5 0 0 1-5-5V8.17zM14 3a1 1 0 0 1 1 1v5.586l1.293-1.293a1 1 0 1 1 1.414 1.414l-3 3a1 1 0 0 1-1.414 0l-3-3a1 1 0 1 1 1.414-1.414L13 9.586V4a1 1 0 0 1 1-1z", fill: "currentColor" }), " "] }) }));
699
+ }
690
700
  export { Icon123, IconABC, IconAccessPoint, IconAddressBook, IconSignCert, IconServerService, IconActivity, IconActivityLog, IconAdd, IconAddCircleOutline, IconAll, IconApply, IconApplyAndClose, IconArchive, IconArchiveDoc, IconArrowDown, IconArrowLeft, IconArrowRight, IconArrowUp, IconAtSign, IconAttachment, IconAutoConfig, IconBackward, IconBasket, IconBoard, IconBoxArchiveIn, IconBxInfo, IconBxLock, IconCalendar, IconCloseCircle, IconCloseOutline, IconCloud, IconCircleInfo, IconClear, IconColumns, IconCommand, IconCopy, IconCount, IconCrown, IconDashboard, IconDcmtType, IconDcmtTypeOnlyMetadata, IconDcmtTypeSys, IconDelete, IconDetails, IconDown, IconDownload, IconDotsVerticalCircleOutline, IconDuplicate, IconEdit, IconEqual, IconEqualNot, IconEraser, IconExpandRight, IconExport, IconFastBackward, IconFoldeAdd, IconFolderSearch, IconFolderZip, IconFastForward, IconFastSearch, IconFileDots, IconFilter, IconForceStop, IconForward, IconFreeze, IconFreeSearch, IconGreaterThan, IconGreaterThanOrEqual, IconHistory, IconImport, IconTag, IconInfo, IconInsertAbove, IconInsertBelow, IconHeart, IconHide, IconLanguage, IconLeft, IconLessThan, IconLessThanOrEqual, IconLock, IconLockClosed, IconLogin, IconLink, IconLogout, IconMail, IconMapping, IconMic, IconMenuHorizontal, IconMenuKebab, IconMenuVertical, IconMetadata, IconMetadata_Computed, IconMetadata_DataList, IconMetadata_Date, IconMetadata_DynamicDataList, IconMetadata_Numerator, IconMetadata_Numeric, IconMetadata_Special, IconMetadata_Text, IconMetadata_User, IconMonitor, IconOpenInNew, IconNotification, IconPassword, IconPencil, IconPlatform, IconPlay, IconPreview, IconPrinter, IconPrintOutline, IconProcess, IconProgressAbortRequested, IconProgressCompleted, IconProgressNotCompleted, IconProgressReady, IconProgressRunning, IconProgressStarted, IconRefresh, IconReset, IconRecentlyViewed, IconRight, IconSave, IconSearch, IconSelected, IconSettings, IconShow, IconSort, IconStop, IconStopwatch, IconSuccess, IconAlarmPlus, IconHourglass, IconNone, IconNotStarted, IconProgress, IconSuccessCirlce, IconSuitcase, IconSupport, IconUndo, IconUnFreeze, IconUp, IconUpdate, IconUpload, IconUser, IconUserProfile, IconVisible, IconWarning, IconWeb, IconWifi, IconWindowMaximize, IconWindowMinimize, IconWorkflow, IconWorkspace, IconUserGroup, IconUserGroupOutline, IconUserLevelMember, IconUserLevelAdministrator, IconUserLevelSystemAdministrator, IconUserLevelAutonomousAdministrator, IconDraggabledots, IconRelation, IconEasy, IconSum, IconDisk, IconDataList, IconPalette, IconFormatPageSplit, IconPaste, IconFileSearch, IconStar, IconStarRemove, IconSearchCheck, IconLightningFill, IconArrowUnsorted, IconArrowSortedUp, IconArrowSortedDown, IconConvertFilePdf, IconExportTo, IconSharedDcmt, IconShare, IconBatchUpdate, IconCheckFile, IconStatistics, IconSubstFile, IconAdvanced, IconSync, IconSavedQuery, IconSignature, IconSignaturePencil, IconRecursiveOps, IconCheckIn, IconTree, IconGrid, IconList, IconFolder, IconFolderOpen, IconFactory, IconTest, IconCheck, IconUncheck, IconSortAsc, IconSortDesc, IconRoundFileUpload, IconSortAscLetters, IconSortDescLetters, IconRotate, IconSortAscNumbers, IconSortDescNumbers, IconSortAscClock, IconSortDescClock, IconLayerGroup, IconBell, IconBellCheck, IconBellOutline, IconBellCheckOutline, IconEnvelopeOpenText, IconChangeUser, IconUserCheck, IconRelationManyToMany, IconRelationOneToMany, IconUserExpired, IconKey, IconZoomInLinear, IconZoomOutLinear, IconMenuCAWorkingGroups, IconCADossier, IconMenuCACaseflow, IconMenuDashboard, IconMenuCAAreas, IconMenuTask, IconMenuSearch, IconMenuFullTextSearch, IconMenuFavourite, IconSAPLogin, IconSAPLogin2, IconView, IconNewSignature };
@@ -0,0 +1,8 @@
1
+ interface TMPdfViewerProps {
2
+ pdfBlob: Blob;
3
+ title?: string;
4
+ isResizingActive?: boolean;
5
+ enableFitToWidth?: boolean;
6
+ }
7
+ declare const TMPdfViewer: (props: TMPdfViewerProps) => import("react/jsx-runtime").JSX.Element;
8
+ export default TMPdfViewer;
@@ -0,0 +1,373 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useState, useRef, useCallback } from "react";
3
+ import styled from "styled-components";
4
+ import { LoadIndicator } from 'devextreme-react/load-indicator';
5
+ import { IconCloseOutline } from "./TMIcons";
6
+ import { SDKUI_Localizator } from "./SDKUI_Localizator";
7
+ import { TMColors } from "../utils/theme";
8
+ import { TMMessageBoxManager, ButtonNames } from "../components/base/TMPopUp";
9
+ // Dynamic imports for optional dependencies
10
+ let pdfjs;
11
+ let Document;
12
+ let Page;
13
+ let isReactPdfAvailable = false;
14
+ try {
15
+ const reactPdf = require('react-pdf');
16
+ pdfjs = reactPdf.pdfjs;
17
+ Document = reactPdf.Document;
18
+ Page = reactPdf.Page;
19
+ // Configura il worker PDF.js PRIMA del rendering
20
+ pdfjs.GlobalWorkerOptions.workerSrc = `https://unpkg.com/pdfjs-dist@${pdfjs.version}/build/pdf.worker.min.mjs`;
21
+ isReactPdfAvailable = true;
22
+ }
23
+ catch (error) {
24
+ // react-pdf not available - will use iframe fallback
25
+ // console.warn('react-pdf is not installed. TMPdfViewer will use iframe fallback.');
26
+ }
27
+ const PDFViewerContainer = styled.div `
28
+ width: 100%;
29
+ height: 100%;
30
+ overflow-y: auto;
31
+ overflow-x: hidden;
32
+ background-color: #f5f5f5;
33
+ position: relative;
34
+
35
+ .react-pdf__Document {
36
+ display: flex;
37
+ flex-direction: column;
38
+ align-items: center;
39
+ gap: 10px;
40
+ padding: 10px 0;
41
+ }
42
+
43
+ .react-pdf__Page {
44
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
45
+ margin: 0 auto;
46
+ }
47
+
48
+ .react-pdf__Page__canvas {
49
+ max-width: 100%;
50
+ height: auto !important;
51
+ }
52
+ `;
53
+ const LoadingOverlay = styled.div `
54
+ position: absolute;
55
+ top: 0;
56
+ left: 0;
57
+ width: 100%;
58
+ height: 100%;
59
+ background-color: rgba(245, 245, 245, 0.95);
60
+ display: flex;
61
+ justify-content: center;
62
+ align-items: center;
63
+ z-index: 1000;
64
+ `;
65
+ const TMPdfViewer = (props) => {
66
+ const { pdfBlob, title = "Anteprima PDF", isResizingActive, enableFitToWidth = false } = props;
67
+ const [isMobile, setIsMobile] = useState(false);
68
+ const [totalPagesNumber, setTotalPagesNumber] = useState(0);
69
+ const [loadedPagesNumber, setLoadedPagesNumber] = useState(0);
70
+ const [visiblePages, setVisiblePages] = useState(new Set([1]));
71
+ const [pdfUrl, setPdfUrl] = useState("");
72
+ const [hasUnsafeContent, setHasUnsafeContent] = useState(false);
73
+ const [isCheckingPdf, setIsCheckingPdf] = useState(true);
74
+ const [jsMatches, setJsMatches] = useState([]);
75
+ const observerRef = useRef(null);
76
+ useEffect(() => {
77
+ const checkIsMobile = () => {
78
+ try {
79
+ const userAgent = navigator.userAgent || window.opera;
80
+ // Detect actual mobile/tablet devices
81
+ const isMobileDevice =
82
+ // User agent detection (phones and tablets)
83
+ /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) ||
84
+ // Media query for touch devices with coarse pointer (more reliable than screen width)
85
+ (window.matchMedia?.('(hover: none) and (pointer: coarse)').matches ?? false) ||
86
+ // Touch-capable devices excluding desktop OS
87
+ (navigator.maxTouchPoints > 1 && !/Win|Mac|Linux x86_64/i.test(userAgent));
88
+ setIsMobile(isMobileDevice);
89
+ }
90
+ catch (error) {
91
+ setIsMobile(false);
92
+ }
93
+ };
94
+ const checkPdfForJavaScript = async () => {
95
+ setIsCheckingPdf(true);
96
+ try {
97
+ // Legge il PDF come testo per cercare pattern di JavaScript
98
+ const arrayBuffer = await pdfBlob.arrayBuffer();
99
+ const uint8Array = new Uint8Array(arrayBuffer);
100
+ const text = new TextDecoder('latin1').decode(uint8Array);
101
+ // Pattern specifici per rilevare JavaScript effettivo nelle strutture PDF
102
+ const jsPatterns = [
103
+ // Esempio: /JavaScript [ (app.alert('Hello');) ]
104
+ { name: 'JavaScript Dictionary Entry', pattern: /\/JavaScript\s*[(\[<][\s\S]*?[)\]>]/i },
105
+ // Esempio: /JS 15 0 R (riferimento a un oggetto JavaScript)
106
+ { name: 'JavaScript Object Reference', pattern: /\/JS\s+\d+\s+\d+\s+R/i },
107
+ // Esempio: /JS (app.alert('Click');) o /JS <hexstring>
108
+ { name: 'Inline JavaScript Code', pattern: /\/JS\s*[(<][\s\S]*?[)>]/i },
109
+ // Esempio: /AA << /O << /S /JavaScript /JS (app.alert('Open');) >> >>
110
+ { name: 'Additional Actions (AA) with JavaScript', pattern: /\/AA\s*<<[\s\S]*?\/JS[\s\S]*?>>/is },
111
+ // Esempio: /OpenAction << /S /JavaScript /JS (this.print();) >>
112
+ { name: 'Document Open Action with JavaScript', pattern: /\/OpenAction\s*<<[\s\S]*?\/JS[\s\S]*?>>/is },
113
+ // Esempio: /Names << /JavaScript [ (MyScript) 12 0 R ] >>
114
+ { name: 'Named JavaScript Functions', pattern: /\/Names\s*<<[\s\S]*?\/JavaScript[\s\S]*?>>/is },
115
+ ];
116
+ let foundJS = false;
117
+ const matches = [];
118
+ jsPatterns.forEach(({ name, pattern }) => {
119
+ const match = text.match(pattern);
120
+ if (match) {
121
+ foundJS = true;
122
+ const matchIndex = match.index || 0;
123
+ const contextStart = Math.max(0, matchIndex - 50);
124
+ const contextEnd = Math.min(text.length, matchIndex + match[0].length + 50);
125
+ const context = text.substring(contextStart, contextEnd);
126
+ matches.push({
127
+ name,
128
+ pattern: pattern.toString(),
129
+ match: match[0],
130
+ context: context.replace(/[\r\n]+/g, ' ').trim()
131
+ });
132
+ }
133
+ });
134
+ setHasUnsafeContent(foundJS);
135
+ setJsMatches(matches);
136
+ }
137
+ catch (error) {
138
+ // console.error('Errore nella validazione del PDF:', error);
139
+ // In caso di errore, permetti la visualizzazione
140
+ setHasUnsafeContent(false);
141
+ }
142
+ finally {
143
+ setIsCheckingPdf(false);
144
+ }
145
+ };
146
+ checkIsMobile();
147
+ checkPdfForJavaScript();
148
+ // Create URL for iframe
149
+ const url = URL.createObjectURL(pdfBlob);
150
+ setPdfUrl(url);
151
+ return () => {
152
+ if (url) {
153
+ URL.revokeObjectURL(url);
154
+ }
155
+ };
156
+ }, [pdfBlob]);
157
+ /**
158
+ * Callback per l'Intersection Observer che gestisce il lazy loading delle pagine PDF.
159
+ * Viene chiamato ogni volta che una pagina entra o esce dal viewport (area visibile).
160
+ *
161
+ * - Monitora quando gli elementi (pagine) diventano visibili
162
+ * - Aggiunge il numero di pagina al Set delle pagine visibili quando entra nel viewport
163
+ * - Il rootMargin di 500px carica le pagine prima che siano effettivamente visibili (preloading)
164
+ */
165
+ const pageObserverCallback = useCallback((entries) => {
166
+ entries.forEach(entry => {
167
+ const pageNum = parseInt(entry.target.getAttribute('data-page-number') || '0');
168
+ if (entry.isIntersecting) {
169
+ // Aggiunge la pagina al Set di quelle da renderizzare
170
+ setVisiblePages(prev => new Set([...prev, pageNum]));
171
+ }
172
+ });
173
+ }, []);
174
+ /**
175
+ * Crea e configura l'Intersection Observer per il lazy loading.
176
+ *
177
+ * Configurazione:
178
+ * - root: null → osserva rispetto al viewport del browser
179
+ * - rootMargin: '500px' → inizia il caricamento 500px prima che la pagina sia visibile (buffer)
180
+ * - threshold: 0.01 → trigger quando anche solo l'1% dell'elemento è visibile
181
+ *
182
+ * Benefici:
183
+ * - Non blocca l'UI durante il rendering
184
+ * - Carica solo le pagine necessarie
185
+ * - Migliora le performance su PDF con molte pagine
186
+ */
187
+ useEffect(() => {
188
+ observerRef.current = new IntersectionObserver(pageObserverCallback, {
189
+ root: null,
190
+ rootMargin: '500px',
191
+ threshold: 0.01
192
+ });
193
+ return () => {
194
+ // Cleanup: disconnette l'observer quando il componente viene smontato
195
+ observerRef.current?.disconnect();
196
+ };
197
+ }, [pageObserverCallback]);
198
+ const showMatchDetails = () => {
199
+ const highlightMatch = (context, matchText) => {
200
+ const matchIndex = context.indexOf(matchText);
201
+ if (matchIndex === -1) {
202
+ // Se non trova il match esatto, prova con una versione normalizzata
203
+ const normalizedContext = context.replace(/\s+/g, ' ');
204
+ const normalizedMatch = matchText.replace(/\s+/g, ' ');
205
+ const normalizedIndex = normalizedContext.indexOf(normalizedMatch);
206
+ if (normalizedIndex === -1) {
207
+ // Se ancora non trova, mostra tutto in grassetto rosso
208
+ return _jsx("strong", { style: { color: '#d32f2f', fontWeight: 'bold' }, children: context });
209
+ }
210
+ return (_jsxs(_Fragment, { children: [normalizedContext.substring(0, normalizedIndex), _jsx("strong", { style: { color: '#d32f2f', fontWeight: 'bold', background: '#ffebee' }, children: normalizedContext.substring(normalizedIndex, normalizedIndex + normalizedMatch.length) }), normalizedContext.substring(normalizedIndex + normalizedMatch.length)] }));
211
+ }
212
+ return (_jsxs(_Fragment, { children: [context.substring(0, matchIndex), _jsx("strong", { style: { color: '#d32f2f', fontWeight: 'bold', background: '#ffebee' }, children: context.substring(matchIndex, matchIndex + matchText.length) }), context.substring(matchIndex + matchText.length)] }));
213
+ };
214
+ TMMessageBoxManager.show({
215
+ title: `${SDKUI_Localizator.Attention}: ${SDKUI_Localizator.PotentiallyUnsafeContent}`,
216
+ buttons: [ButtonNames.OK],
217
+ showToppy: false,
218
+ resizable: true,
219
+ initialWidth: !isMobile ? '800px' : undefined,
220
+ message: (_jsxs("div", { style: { maxHeight: '500px', overflowY: 'auto', padding: '10px', lineHeight: '1.6' }, children: [_jsxs("div", { style: {
221
+ marginBottom: '20px',
222
+ padding: '12px',
223
+ background: '#fff3cd',
224
+ border: '1px solid #ffc107',
225
+ borderRadius: '6px',
226
+ fontSize: '14px',
227
+ wordBreak: 'normal',
228
+ hyphens: 'none'
229
+ }, children: [_jsxs("strong", { children: [SDKUI_Localizator.Attention, ":"] }), " ", SDKUI_Localizator.PotentiallyUnsafeCodePatternsDetected.replaceParams(jsMatches.length.toString())] }), jsMatches.length > 0 ? (jsMatches.map((match, index) => (_jsxs("div", { style: {
230
+ marginBottom: '16px',
231
+ padding: '16px',
232
+ border: '1px solid #ffcdd2',
233
+ borderRadius: '8px',
234
+ background: '#fff',
235
+ boxShadow: '0 1px 3px rgba(0,0,0,0.1)'
236
+ }, children: [_jsx("div", { style: {
237
+ marginBottom: '12px',
238
+ paddingBottom: '8px',
239
+ borderBottom: '2px solid #f44336'
240
+ }, children: _jsxs("strong", { style: {
241
+ color: '#d32f2f',
242
+ fontSize: '15px',
243
+ display: 'flex',
244
+ alignItems: 'center',
245
+ gap: '8px'
246
+ }, children: [_jsx("span", { style: {
247
+ background: '#f44336',
248
+ color: '#fff',
249
+ borderRadius: '50%',
250
+ width: '24px',
251
+ height: '24px',
252
+ display: 'inline-flex',
253
+ alignItems: 'center',
254
+ justifyContent: 'center',
255
+ fontSize: '13px',
256
+ fontWeight: 'bold'
257
+ }, children: index + 1 }), match.name] }) }), _jsx("div", { style: { fontSize: '13px' }, children: _jsx("div", { style: {
258
+ background: '#f5f5f5',
259
+ padding: '10px',
260
+ borderRadius: '4px',
261
+ borderLeft: '3px solid #f44336',
262
+ fontFamily: 'Consolas, Monaco, monospace',
263
+ fontSize: '12px',
264
+ wordBreak: 'break-all',
265
+ color: '#333',
266
+ maxHeight: '200px',
267
+ overflowY: 'auto',
268
+ userSelect: 'text'
269
+ }, children: highlightMatch(match.context, match.match) }) })] }, index)))) : (_jsx("div", { style: { textAlign: 'center', padding: '20px', color: '#999' }, children: "Nessun dettaglio disponibile" }))] }))
270
+ });
271
+ };
272
+ // Mostra loading durante la validazione
273
+ if (isCheckingPdf) {
274
+ return (_jsx(PDFViewerContainer, { children: _jsxs("div", { style: {
275
+ display: 'flex',
276
+ justifyContent: 'center',
277
+ alignItems: 'center',
278
+ height: '100%',
279
+ flexDirection: 'column',
280
+ gap: '10px'
281
+ }, children: [_jsx(LoadIndicator, { height: 60, width: 60 }), _jsx("div", { children: "Validazione PDF in corso..." })] }) }));
282
+ }
283
+ /**
284
+ * Usa <iframe> nei seguenti casi:
285
+ * 1. react-pdf non è disponibile (libreria non installata)
286
+ * 2. Desktop E nessun contenuto JavaScript rilevato (visualizzazione nativa del browser più performante)
287
+ *
288
+ * L'iframe sfrutta il visualizzatore PDF nativo del browser, ma non può prevenire
289
+ * l'esecuzione di JavaScript embedded nel PDF.
290
+ */
291
+ if (!isReactPdfAvailable || (!isMobile && !hasUnsafeContent && pdfUrl)) {
292
+ return (_jsx(PDFViewerContainer, { children: _jsx("iframe", { src: `${pdfUrl}#${enableFitToWidth ? 'view=FitH&' : ''}scrollbar=1`, title: title, style: {
293
+ width: '100%',
294
+ height: '100%',
295
+ border: 'none',
296
+ zIndex: 0,
297
+ pointerEvents: isResizingActive === true ? "none" : "auto"
298
+ } }, pdfUrl) }));
299
+ }
300
+ /**
301
+ * Usa react-pdf nei seguenti casi:
302
+ * 1. Dispositivo mobile (migliore esperienza utente con lazy loading)
303
+ * 2. Desktop con contenuto JavaScript rilevato (rendering sicuro senza esecuzione di script)
304
+ *
305
+ * react-pdf renderizza il PDF come canvas, prevenendo l'esecuzione di JavaScript embedded,
306
+ * ma è meno performante dell'iframe nativo su desktop.
307
+ */
308
+ return _jsxs(PDFViewerContainer, { style: { display: 'flex', flexDirection: 'column' }, children: [loadedPagesNumber === 0 && totalPagesNumber > 0 && _jsx(LoadingOverlay, { children: _jsxs("div", { style: {
309
+ display: 'flex',
310
+ justifyContent: 'center',
311
+ alignItems: 'center',
312
+ flexDirection: 'column',
313
+ gap: '10px'
314
+ }, children: [_jsx(LoadIndicator, { height: 60, width: 60 }), _jsxs("div", { children: [SDKUI_Localizator.Loading, "..."] })] }) }), _jsx("div", { style: {
315
+ display: loadedPagesNumber > 0 && totalPagesNumber > 0 ? 'block' : 'none',
316
+ flex: 1,
317
+ overflow: 'auto'
318
+ }, children: _jsx(Document, { file: pdfBlob, onLoadSuccess: ({ numPages }) => {
319
+ setTotalPagesNumber(numPages);
320
+ setLoadedPagesNumber(0);
321
+ }, loading: _jsxs("div", { style: {
322
+ display: 'flex',
323
+ justifyContent: 'center',
324
+ alignItems: 'center',
325
+ height: '100%',
326
+ flexDirection: 'column',
327
+ gap: '10px'
328
+ }, children: [_jsx(LoadIndicator, { height: 60, width: 60 }), _jsxs("div", { children: [SDKUI_Localizator.Loading, "..."] })] }), error: _jsxs("div", { style: {
329
+ display: 'flex',
330
+ justifyContent: 'center',
331
+ alignItems: 'center',
332
+ height: '100%',
333
+ flexDirection: 'column',
334
+ gap: '10px'
335
+ }, children: [_jsx(IconCloseOutline, { fontSize: 64, color: TMColors.error }), _jsx("div", { children: "Errore nel caricamento del PDF" })] }), children: Array.from(new Array(totalPagesNumber), (el, index) => {
336
+ const pageNumber = index + 1;
337
+ const shouldRender = visiblePages.has(pageNumber);
338
+ return (_jsx("div", { "data-page-number": pageNumber, ref: (el) => {
339
+ if (el && observerRef.current) {
340
+ observerRef.current.observe(el);
341
+ }
342
+ }, style: {
343
+ minHeight: shouldRender ? 'auto' : '1000px',
344
+ display: 'flex',
345
+ justifyContent: 'center',
346
+ alignItems: 'center'
347
+ }, children: shouldRender && (_jsx(Page, { pageNumber: pageNumber, renderTextLayer: false, renderAnnotationLayer: false, width: Math.min(window.innerWidth - 40, 1200), loading: _jsx("div", { style: { padding: '20px' }, children: _jsx(LoadIndicator, { height: 40, width: 40 }) }), onLoadSuccess: () => {
348
+ setLoadedPagesNumber(prev => prev + 1);
349
+ } })) }, `page_${pageNumber}`));
350
+ }) }) }), hasUnsafeContent && (_jsxs("div", { style: {
351
+ display: 'flex',
352
+ justifyContent: 'center',
353
+ alignItems: 'center',
354
+ padding: '12px 20px',
355
+ background: '#fff3cd',
356
+ borderTop: '2px solid #ffc107',
357
+ gap: '8px',
358
+ flexShrink: 0
359
+ }, children: [_jsxs("span", { style: {
360
+ color: '#856404',
361
+ whiteSpace: 'nowrap',
362
+ overflow: 'hidden',
363
+ textOverflow: 'ellipsis',
364
+ flex: 1
365
+ }, children: [_jsx("strong", { children: "Attenzione:" }), " Questo documento contiene contenuti potenzialmente non sicuri."] }), jsMatches.length > 0 && (_jsx("span", { className: "dx-icon-info", style: {
366
+ fontSize: '20px',
367
+ color: '#d32f2f',
368
+ cursor: 'pointer',
369
+ transition: 'color 0.2s',
370
+ marginLeft: '4px'
371
+ }, onClick: showMatchDetails, title: "Clicca per vedere i dettagli", onMouseEnter: (e) => e.currentTarget.style.color = '#b71c1c', onMouseLeave: (e) => e.currentTarget.style.color = '#d32f2f' }))] }))] });
372
+ };
373
+ export default TMPdfViewer;
@@ -1,11 +1,20 @@
1
1
  import React from "react";
2
- import { DcmtTypeDescriptor, FileDescriptor, UserDescriptor } from "@topconsultnpm/sdk-ts";
2
+ import { AccessLevels, DcmtTypeDescriptor, FileDescriptor, UserDescriptor } from "@topconsultnpm/sdk-ts";
3
3
  import { DcmtInfo, DownloadModes, DownloadTypes } from "../ts/types";
4
4
  import { FileItem } from "../components";
5
5
  /**
6
6
  * Check-in/Check-out Manager
7
7
  * Questo modulo gestisce tutte le operazioni di check-in e check-out
8
8
  * dei documenti e delle bozze dei gruppi di lavoro.
9
+ *
10
+ * Operazioni gestite:
11
+ * - Generazione nomi file per download e checkout con timestamp e identificatori univoci
12
+ * - Download di documenti in modalità checkout
13
+ * - Gestione dello storage locale delle informazioni di checkout (aggiunta, aggiornamento, rimozione)
14
+ * - Validazione dei nomi file secondo le convenzioni di naming CICO
15
+ * - Rendering dell'interfaccia utente per conferma check-in con visualizzazione anomalie
16
+ * - Determinazione dello stato di check-out dei documenti (editMode/lockMode)
17
+ * - Verifica permessi e abilitazione funzionalità CICO per tipo documento
9
18
  */
10
19
  export interface CheckoutInfo {
11
20
  DID: string;
@@ -18,6 +27,7 @@ interface CheckoutStatusResult {
18
27
  mode: 'editMode' | 'lockMode' | '';
19
28
  version: number;
20
29
  icon: React.ReactNode | null;
30
+ editLockTooltipText: React.ReactNode | null;
21
31
  }
22
32
  export type DownloadSource = {
23
33
  type: 'fileItem';
@@ -48,6 +58,26 @@ type FileNameValidation = {
48
58
  validationResults?: FileNameValidationItems;
49
59
  };
50
60
  export declare const renderCicoCheckInContent: (source: DownloadSource, selectedFilename: File, isValid: boolean, validationItems: FileNameValidationItems | undefined, color?: string) => React.ReactNode;
61
+ interface CheckInCheckOutDcmtInfo {
62
+ CICO: number;
63
+ CanCICO: AccessLevels;
64
+ CanDelChronology: AccessLevels;
65
+ UserID_MID: number;
66
+ Date_MID: number;
67
+ Ver_MID: number;
68
+ UserID_CanViewOrUpdate: AccessLevels;
69
+ Date_CanViewOrUpdate: AccessLevels;
70
+ Ver_CanViewOrUpdate: AccessLevels;
71
+ }
72
+ export declare const getDcmtCicoInfo: (dtd: DcmtTypeDescriptor | undefined) => CheckInCheckOutDcmtInfo;
73
+ /**
74
+ * Determina lo stato di check-in/check-out di un documento
75
+ *
76
+ * @param dcmt - Il documento in formato array (MetadataValueDescriptorEx[]) o oggetto piatto
77
+ * @param allUsers - Lista di tutti gli utenti per risolvere i nomi
78
+ * @param dtd - Descrittore del tipo documento contenente le definizioni dei metadati CICO
79
+ * @returns Oggetto con cicoEnabled (se CICO è abilitato) e checkoutStatus (dettagli dello stato)
80
+ */
51
81
  export declare const getDcmtCicoStatus: (dcmt: any, allUsers: Array<UserDescriptor>, dtd: DcmtTypeDescriptor | undefined) => {
52
82
  cicoEnabled: boolean;
53
83
  checkoutStatus: CheckoutStatusResult;