@topconsultnpm/sdkui-react 6.20.0-dev1.100 → 6.20.0-dev1.102

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.
@@ -133,8 +133,12 @@ const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTask
133
133
  setCurrentMruTID(0);
134
134
  };
135
135
  const onSQDItemClick = useCallback(async (sqd, setSqdAsync) => {
136
+ // Forza ricaricamento completo se la query è già selezionata
137
+ if (sqd.id === currentSQD?.id) {
138
+ await setSqdAsync(undefined);
139
+ }
136
140
  await setSqdAsync(sqd);
137
- }, []);
141
+ }, [currentSQD]);
138
142
  const onSQDDeleted = useCallback(async (sqd, sqdToBeSet, setSqdAsync) => {
139
143
  await loadDataSQDsAsync(true, sqd.masterTID);
140
144
  if (sqdToBeSet)
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
- import { PlatformObjectValidator, WhereItem, SDK_Localizator, OrderByItem, SelectItem, SelectItemVisibilities, SDK_Globals, SavedQueryCacheService, SearchEngine, QueryOperators } from '@topconsultnpm/sdk-ts';
3
+ import { PlatformObjectValidator, QueryDescriptor, WhereItem, SDK_Localizator, OrderByItem, SelectItem, SelectItemVisibilities, SDK_Globals, SavedQueryCacheService, SearchEngine, QueryOperators } from '@topconsultnpm/sdk-ts';
4
4
  import styled from 'styled-components';
5
5
  import TMSearchQueryEditor from './TMSearchQueryEditor';
6
- import { getDcmtTypesByQdAsync, SDKUI_Localizator, getQD, IconMenuVertical, IconAddCircleOutline, IconEdit, IconEasy, IconAdvanced, deepCompare, IconSearch, IconClear, getDefaultOperator, prepareQdForSearchAsync, IsParametricQuery, SDKUI_Globals, IconArrowRight, IconMenuCAArchive, getListMaxItems } from '../../../helper';
6
+ import { getDcmtTypesByQdAsync, SDKUI_Localizator, getQD, IconMenuVertical, IconAddCircleOutline, IconEdit, IconEasy, IconAdvanced, deepCompare, IconSearch, IconClear, getDefaultOperator, prepareQdForSearchAsync, IsParametricQuery, SDKUI_Globals, IconArrowRight, IconMenuCAArchive, getListMaxItems, DEFAULT_MAX_DCMTS_TO_BE_RETURNED } from '../../../helper';
7
7
  import { useQueryParametersDialog } from '../../../hooks/useQueryParametersDialog';
8
8
  import { FormModes } from '../../../ts';
9
9
  import { TMColors } from '../../../utils/theme';
@@ -50,19 +50,26 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
50
50
  useEffect(() => {
51
51
  pendingMidsRef.current = inputMids ?? null;
52
52
  }, [inputMids]);
53
+ // Gestisce inizializzazione/aggiornamento QD: crea nuovo QD se cambia TID, altrimenti aggiorna solo maxDcmtsToBeReturned se cambiato
53
54
  useEffect(() => {
54
55
  if (!fromDTD)
55
56
  return;
56
- // Reset appliedInputMidsRef when TID changes so pending mids can be applied to new TID
57
+ // Reset della ref quando cambia il TID per permettere la riapplicazione dei filtri sul nuovo tipo documento
57
58
  appliedInputMidsRef.current = null;
58
59
  const initQd = async () => {
59
- // Only initialize if qd doesn't exist or is for a different TID
60
- if (!qd || qd.from?.tid !== fromDTD.id || qd.maxDcmtsToBeReturned !== maxDcmtsToBeReturned) {
61
- const newQd = await getQD(fromDTD.id, false, maxDcmtsToBeReturned ?? 1000);
60
+ // Caso 1: QD non esiste o è per un TID diverso → crea nuovo QD completo
61
+ if (!qd || qd.from?.tid !== fromDTD.id) {
62
+ const newQd = await getQD(fromDTD.id, false, maxDcmtsToBeReturned ?? DEFAULT_MAX_DCMTS_TO_BE_RETURNED);
62
63
  if (newQd) {
63
64
  setQd(newQd);
64
65
  }
65
66
  }
67
+ // Caso 2: TID invariato ma maxDcmtsToBeReturned cambiato → aggiorna solo quella proprietà
68
+ else if (qd.maxDcmtsToBeReturned !== maxDcmtsToBeReturned) {
69
+ const updatedQd = new QueryDescriptor();
70
+ updatedQd.init({ ...qd, maxDcmtsToBeReturned: maxDcmtsToBeReturned ?? DEFAULT_MAX_DCMTS_TO_BE_RETURNED });
71
+ setQd(updatedQd);
72
+ }
66
73
  };
67
74
  initQd();
68
75
  }, [fromDTD?.id, maxDcmtsToBeReturned]);
@@ -47,6 +47,9 @@ export declare class ThemeSettings {
47
47
  gridSettings: DataGridSettings;
48
48
  };
49
49
  }
50
+ export declare const DEFAULT_PREVIEW_THRESHOLD = 500;
51
+ export declare const DEFAULT_PAGE_SIZE = 100;
52
+ export declare const DEFAULT_MAX_DCMTS_TO_BE_RETURNED = 200;
50
53
  export declare class SearchSettings {
51
54
  autoFindReferences: ObjectClasses[];
52
55
  invoiceRetrieveFormat: InvoiceRetrieveFormats;
@@ -90,6 +90,9 @@ export class ThemeSettings {
90
90
  };
91
91
  }
92
92
  }
93
+ export const DEFAULT_PREVIEW_THRESHOLD = 500; // KB
94
+ export const DEFAULT_PAGE_SIZE = 100;
95
+ export const DEFAULT_MAX_DCMTS_TO_BE_RETURNED = 200;
93
96
  export class SearchSettings {
94
97
  constructor() {
95
98
  this.autoFindReferences = [];
@@ -97,9 +100,9 @@ export class SearchSettings {
97
100
  this.orderRetrieveFormat = OrderRetrieveFormats.NSO_HTML;
98
101
  this.mruTIDs = [];
99
102
  this.defaultTree = -1;
100
- this.previewThreshold = 500; // KB
101
- this.pageSize = 100;
102
- this.maxDcmtsToBeReturned = 200;
103
+ this.previewThreshold = DEFAULT_PREVIEW_THRESHOLD;
104
+ this.pageSize = DEFAULT_PAGE_SIZE;
105
+ this.maxDcmtsToBeReturned = DEFAULT_MAX_DCMTS_TO_BE_RETURNED;
103
106
  this.floatingMenuBar = new FloatingMenuBarSettings();
104
107
  this.panelLayout = {};
105
108
  }
@@ -695,6 +695,6 @@ export function IconSeparator(props) {
695
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
696
  }
697
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: _jsx("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" }) }) }));
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
699
  }
700
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 };
@@ -91,3 +91,9 @@ export declare class AreaHelper {
91
91
  static ExtractAreaInfo_2(areaPath: string, extractFileName: boolean): AreaValues;
92
92
  }
93
93
  export declare const isApprovalWorkflowView: (dtd: DcmtTypeDescriptor) => boolean;
94
+ export interface SessionIpInfo {
95
+ publicIp: string;
96
+ localIp: string;
97
+ forwardedFor: string;
98
+ }
99
+ export declare const getSessionIpInfo: () => SessionIpInfo;
@@ -872,3 +872,34 @@ export const isApprovalWorkflowView = (dtd) => {
872
872
  return Boolean(dtd?.isView &&
873
873
  dtd.metadata?.some(data => data.name === WorkItemMetadataNames.WI_DID));
874
874
  };
875
+ // Recupera e normalizza le informazioni IP dalla sessione corrente
876
+ export const getSessionIpInfo = () => {
877
+ // Lettura sicura del valore globale
878
+ const raw = SDK_Globals.tmSession?.SessionDescr?.customData2;
879
+ // Se non esiste, ritorna struttura vuota
880
+ if (!raw) {
881
+ return {
882
+ publicIp: "",
883
+ localIp: "",
884
+ forwardedFor: ""
885
+ };
886
+ }
887
+ try {
888
+ // Se è stringa, effettua il parse JSON
889
+ const parsed = typeof raw === "string" ? JSON.parse(raw) : raw;
890
+ // Normalizza i campi garantendo sempre stringhe
891
+ return {
892
+ publicIp: parsed?.publicIp ?? "",
893
+ localIp: parsed?.localIp ?? "",
894
+ forwardedFor: parsed?.forwardedFor ?? ""
895
+ };
896
+ }
897
+ catch {
898
+ // In caso di errore JSON, ritorna valori vuoti
899
+ return {
900
+ publicIp: "",
901
+ localIp: "",
902
+ forwardedFor: ""
903
+ };
904
+ }
905
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.20.0-dev1.100",
3
+ "version": "6.20.0-dev1.102",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",