@topconsultnpm/sdkui-react 6.20.0-dev1.98 → 6.20.0-dev2.1
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.
- package/lib/assets/headergradient.svg +87 -0
- package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +56 -18
- package/lib/components/NewComponents/ContextMenu/styles.js +13 -34
- package/lib/components/NewComponents/ContextMenu/types.d.ts +8 -2
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +315 -271
- package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +4 -0
- package/lib/components/NewComponents/FloatingMenuBar/styles.js +6 -2
- package/lib/components/NewComponents/FloatingMenuBar/types.d.ts +7 -4
- package/lib/components/base/TMButton.js +6 -0
- package/lib/components/base/TMClosableList.js +4 -0
- package/lib/components/base/TMDropDownMenu.js +2 -0
- package/lib/components/base/TMListView.js +1 -1
- package/lib/components/base/TMPanel.d.ts +1 -1
- package/lib/components/base/TMPanel.js +9 -5
- package/lib/components/base/TMPopUp.js +6 -0
- package/lib/components/base/TMToolbarCard.js +2 -0
- package/lib/components/base/TMTreeView.d.ts +2 -1
- package/lib/components/base/TMTreeView.js +33 -26
- package/lib/components/choosers/TMDataListItemChooser.d.ts +2 -0
- package/lib/components/choosers/TMDataListItemChooser.js +8 -2
- package/lib/components/choosers/TMDcmtTypeChooser.d.ts +1 -0
- package/lib/components/choosers/TMDcmtTypeChooser.js +11 -3
- package/lib/components/choosers/TMDistinctValues.js +2 -2
- package/lib/components/choosers/TMDynDataListItemChooser.d.ts +2 -0
- package/lib/components/choosers/TMDynDataListItemChooser.js +8 -2
- package/lib/components/choosers/TMMetadataChooser.d.ts +2 -0
- package/lib/components/choosers/TMMetadataChooser.js +11 -3
- package/lib/components/choosers/TMUserChooser.d.ts +2 -0
- package/lib/components/choosers/TMUserChooser.js +8 -2
- package/lib/components/editors/TMCheckBox.js +2 -0
- package/lib/components/editors/TMDateBox.js +18 -9
- package/lib/components/editors/TMEditorStyled.js +7 -0
- package/lib/components/editors/TMLocalizedTextBox.d.ts +3 -1
- package/lib/components/editors/TMLocalizedTextBox.js +16 -14
- package/lib/components/editors/TMMetadataEditor.d.ts +1 -0
- package/lib/components/editors/TMMetadataEditor.js +4 -4
- package/lib/components/editors/TMMetadataTextBox.d.ts +9 -0
- package/lib/components/editors/TMMetadataTextBox.js +92 -0
- package/lib/components/editors/TMMetadataValues.d.ts +2 -0
- package/lib/components/editors/TMMetadataValues.js +3 -3
- package/lib/components/editors/TMRadioButton.js +2 -0
- package/lib/components/editors/TMTextBox.d.ts +1 -1
- package/lib/components/editors/TMTextBox.js +23 -1
- package/lib/components/editors/TMTextExpression.js +6 -91
- package/lib/components/features/assistant/TMToppyDraggableHelpCenter.js +2 -0
- package/lib/components/features/documents/TMDcmtBlog.js +1 -1
- package/lib/components/features/documents/TMDcmtForm.js +121 -88
- package/lib/components/features/documents/TMDcmtPreview.js +27 -30
- package/lib/components/features/search/TMSearch.d.ts +1 -0
- package/lib/components/features/search/TMSearch.js +7 -3
- package/lib/components/features/search/TMSearchQueryEditor.d.ts +1 -0
- package/lib/components/features/search/TMSearchQueryEditor.js +10 -10
- package/lib/components/features/search/TMSearchQueryPanel.js +24 -10
- package/lib/components/features/search/TMSearchResult.d.ts +1 -0
- package/lib/components/features/search/TMSearchResult.js +171 -11
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +1 -1
- package/lib/components/features/search/TMSearchResultsMenuItems.js +24 -4
- package/lib/components/features/search/TMViewHistoryDcmt.js +45 -50
- package/lib/components/features/tasks/TMTaskForm.js +55 -24
- package/lib/components/features/tasks/TMTasksUtils.js +14 -1
- package/lib/components/features/workflow/TMWorkflowPopup.js +5 -4
- package/lib/components/features/workflow/diagram/DiagramItemComponent.js +2 -0
- package/lib/components/features/workflow/diagram/DiagramItemForm.js +1 -1
- package/lib/components/features/workflow/diagram/WFDiagram.js +1 -1
- package/lib/components/forms/Login/TMLoginForm.js +1 -1
- package/lib/components/grids/TMValidationItemsList.js +6 -0
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +1 -0
- package/lib/components/layout/panelManager/TMPanelManagerContext.js +13 -5
- package/lib/components/query/TMQueryEditor.d.ts +4 -0
- package/lib/components/query/TMQueryEditor.js +14 -10
- package/lib/components/sidebar/TMHeader.js +11 -7
- package/lib/components/sidebar/TMSidebar.d.ts +0 -1
- package/lib/components/sidebar/TMSidebar.js +16 -44
- package/lib/components/sidebar/TMSidebarItem.js +36 -17
- package/lib/helper/SDKUI_Globals.d.ts +3 -0
- package/lib/helper/SDKUI_Globals.js +6 -3
- package/lib/helper/SDKUI_Localizator.d.ts +4 -16
- package/lib/helper/SDKUI_Localizator.js +37 -157
- package/lib/helper/TMIcons.d.ts +1 -0
- package/lib/helper/TMIcons.js +3 -0
- package/lib/helper/TMToppyMessage.js +4 -0
- package/lib/helper/TMUtils.d.ts +2 -1
- package/lib/helper/TMUtils.js +13 -1
- package/lib/helper/helpers.d.ts +27 -1
- package/lib/helper/helpers.js +107 -1
- package/lib/helper/queryHelper.d.ts +1 -1
- package/lib/helper/queryHelper.js +24 -1
- package/lib/hooks/useFloatingBarPinnedItems.d.ts +11 -0
- package/lib/hooks/useFloatingBarPinnedItems.js +54 -0
- package/lib/hooks/useMetadataExpression.d.ts +19 -0
- package/lib/hooks/useMetadataExpression.js +99 -0
- package/package.json +56 -56
package/lib/helper/TMUtils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FileItem } from '../components';
|
|
3
|
-
import { DataColumnDescriptor, PdGs, SearchResultDescriptor } from '@topconsultnpm/sdk-ts';
|
|
3
|
+
import { AppModules, DataColumnDescriptor, PdGs, SearchResultDescriptor } from '@topconsultnpm/sdk-ts';
|
|
4
4
|
export declare const getFileIcon: (fileExtension: string | undefined, fileCount: number | undefined, tooltipContent?: JSX.Element | string) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
export declare function formatBytes(bytes: number | undefined, decimalPlaces?: number): string;
|
|
6
6
|
export interface RowData {
|
|
@@ -66,4 +66,5 @@ export declare const parseSignatureConfiguration: (did: number, informationSign:
|
|
|
66
66
|
copyrightValue: string;
|
|
67
67
|
};
|
|
68
68
|
export declare const convertSearchResultDescriptorToFileItems: (documents: Array<SearchResultDescriptor>) => Array<FileItem>;
|
|
69
|
+
export declare const getAppModuleGradient: (appModuleID: AppModules) => string;
|
|
69
70
|
export {};
|
package/lib/helper/TMUtils.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import styled from "styled-components";
|
|
3
3
|
import { TMTooltip } from '../components';
|
|
4
4
|
import { IconCADossier, IconKey, IconMenuCAWorkingGroups } from './TMIcons';
|
|
5
|
-
import { DataListCacheService, MetadataDataDomains, PdGs } from '@topconsultnpm/sdk-ts';
|
|
5
|
+
import { AppModules, DataListCacheService, MetadataDataDomains, PdGs } from '@topconsultnpm/sdk-ts';
|
|
6
6
|
import { SDKUI_Localizator } from './SDKUI_Localizator';
|
|
7
7
|
const StyledIconFileContainer = styled.div `
|
|
8
8
|
height: 22px;
|
|
@@ -433,3 +433,15 @@ export const convertSearchResultDescriptorToFileItems = (documents) => {
|
|
|
433
433
|
});
|
|
434
434
|
return fileItems;
|
|
435
435
|
};
|
|
436
|
+
export const getAppModuleGradient = (appModuleID) => {
|
|
437
|
+
switch (appModuleID) {
|
|
438
|
+
case AppModules.SURFER:
|
|
439
|
+
return 'linear-gradient(270deg, #46B5A2 16%, #3BAABC 34%, #3BAABC 34%, #3681AD 54%, #3368A5 72%, #2F549D 88%, #304F99 100%)';
|
|
440
|
+
case AppModules.DESIGNER:
|
|
441
|
+
return 'linear-gradient(270deg, #A06A8E 16%, #885C77 34%, #6F4C5F 54%, #5A3446 72%, #482234 100%);';
|
|
442
|
+
case AppModules.ORCHESTRATOR:
|
|
443
|
+
return 'linear-gradient(270deg, #46B5A2 16%, #3BAA8A 34%, #2F8F6F 54%, #277A5A 72%, #216948 88%, #1d6f42 100%)';
|
|
444
|
+
default:
|
|
445
|
+
return 'linear-gradient(270deg, #46B5A2 16%, #3BAABC 34%, #3BAABC 34%, #3681AD 54%, #3368A5 72%, #2F549D 88%, #304F99 100%)';
|
|
446
|
+
}
|
|
447
|
+
};
|
package/lib/helper/helpers.d.ts
CHANGED
|
@@ -67,7 +67,8 @@ export declare enum LandingPages {
|
|
|
67
67
|
RECENT = "recent",
|
|
68
68
|
AREA_MANAGER = "areaManager",
|
|
69
69
|
NOTIFICATIONS = "notifications",
|
|
70
|
-
ACTIVITIES = "activities"
|
|
70
|
+
ACTIVITIES = "activities",
|
|
71
|
+
WORKFLOW_CTRL = "workflowCtrl"
|
|
71
72
|
}
|
|
72
73
|
export declare function getExceptionMessage(ex: any): string;
|
|
73
74
|
export declare function getContrastColor(inputColor: string): {
|
|
@@ -91,3 +92,28 @@ export declare class AreaHelper {
|
|
|
91
92
|
static ExtractAreaInfo_2(areaPath: string, extractFileName: boolean): AreaValues;
|
|
92
93
|
}
|
|
93
94
|
export declare const isApprovalWorkflowView: (dtd: DcmtTypeDescriptor) => boolean;
|
|
95
|
+
export interface SessionIpInfo {
|
|
96
|
+
publicIp: string;
|
|
97
|
+
localIp: string;
|
|
98
|
+
forwardedFor: string;
|
|
99
|
+
}
|
|
100
|
+
export declare const getSessionIpInfo: () => SessionIpInfo;
|
|
101
|
+
interface BrowserAuditInfo {
|
|
102
|
+
name: string;
|
|
103
|
+
version: string;
|
|
104
|
+
os: string;
|
|
105
|
+
language: string;
|
|
106
|
+
screenWidth: number;
|
|
107
|
+
screenHeight: number;
|
|
108
|
+
viewportWidth: number;
|
|
109
|
+
viewportHeight: number;
|
|
110
|
+
colorDepth: number;
|
|
111
|
+
pixelRatio: number;
|
|
112
|
+
timezone: string;
|
|
113
|
+
cookiesEnabled: boolean;
|
|
114
|
+
onlineStatus: boolean;
|
|
115
|
+
touchSupport: boolean;
|
|
116
|
+
userAgent: string;
|
|
117
|
+
toString(): string;
|
|
118
|
+
}
|
|
119
|
+
export declare const getBrowserAuditInfo: () => BrowserAuditInfo;
|
package/lib/helper/helpers.js
CHANGED
|
@@ -27,7 +27,7 @@ const openApps = async (appModule, tmSession, appRoutes) => {
|
|
|
27
27
|
toTMSession.SessionDescr = toSessionDescr;
|
|
28
28
|
let str = (JSON.stringify(toTMSession));
|
|
29
29
|
let sessionToBase64 = Buffer.from(str).toString("base64");
|
|
30
|
-
window.open(appRoutes?.find(route => route.appName === appModule).URL + '/Homepage' + '?session=' + sessionToBase64);
|
|
30
|
+
window.open(appRoutes?.find(route => route.appName === appModule).URL + '/Homepage' + '?session=' + encodeURIComponent(sessionToBase64));
|
|
31
31
|
}
|
|
32
32
|
catch (e) {
|
|
33
33
|
TMExceptionBoxManager.show({ exception: e.message });
|
|
@@ -728,6 +728,7 @@ export var LandingPages;
|
|
|
728
728
|
LandingPages["AREA_MANAGER"] = "areaManager";
|
|
729
729
|
LandingPages["NOTIFICATIONS"] = "notifications";
|
|
730
730
|
LandingPages["ACTIVITIES"] = "activities";
|
|
731
|
+
LandingPages["WORKFLOW_CTRL"] = "workflowCtrl";
|
|
731
732
|
})(LandingPages || (LandingPages = {}));
|
|
732
733
|
// #endregion
|
|
733
734
|
// #region Exception
|
|
@@ -872,3 +873,108 @@ export const isApprovalWorkflowView = (dtd) => {
|
|
|
872
873
|
return Boolean(dtd?.isView &&
|
|
873
874
|
dtd.metadata?.some(data => data.name === WorkItemMetadataNames.WI_DID));
|
|
874
875
|
};
|
|
876
|
+
// Recupera e normalizza le informazioni IP dalla sessione corrente
|
|
877
|
+
export const getSessionIpInfo = () => {
|
|
878
|
+
// Lettura sicura del valore globale
|
|
879
|
+
const raw = SDK_Globals.tmSession?.SessionDescr?.customData2;
|
|
880
|
+
// Se non esiste, ritorna struttura vuota
|
|
881
|
+
if (!raw) {
|
|
882
|
+
return {
|
|
883
|
+
publicIp: "",
|
|
884
|
+
localIp: "",
|
|
885
|
+
forwardedFor: ""
|
|
886
|
+
};
|
|
887
|
+
}
|
|
888
|
+
try {
|
|
889
|
+
// Se è stringa, effettua il parse JSON
|
|
890
|
+
const parsed = typeof raw === "string" ? JSON.parse(raw) : raw;
|
|
891
|
+
// Normalizza i campi garantendo sempre stringhe
|
|
892
|
+
return {
|
|
893
|
+
publicIp: parsed?.publicIp ?? "",
|
|
894
|
+
localIp: parsed?.localIp ?? "",
|
|
895
|
+
forwardedFor: parsed?.forwardedFor ?? ""
|
|
896
|
+
};
|
|
897
|
+
}
|
|
898
|
+
catch {
|
|
899
|
+
// In caso di errore JSON, ritorna valori vuoti
|
|
900
|
+
return {
|
|
901
|
+
publicIp: "",
|
|
902
|
+
localIp: "",
|
|
903
|
+
forwardedFor: ""
|
|
904
|
+
};
|
|
905
|
+
}
|
|
906
|
+
};
|
|
907
|
+
export const getBrowserAuditInfo = () => {
|
|
908
|
+
// Funzione per rilevare browser e versione
|
|
909
|
+
const detectBrowser = () => {
|
|
910
|
+
const ua = navigator.userAgent;
|
|
911
|
+
if (ua.includes("Chrome") && !ua.includes("Edg")) {
|
|
912
|
+
const match = ua.match(/Chrome\/([\d.]+)/);
|
|
913
|
+
return { name: "Chrome", version: match?.[1] ?? "unknown" };
|
|
914
|
+
}
|
|
915
|
+
if (ua.includes("Edg")) {
|
|
916
|
+
const match = ua.match(/Edg\/([\d.]+)/);
|
|
917
|
+
return { name: "Edge", version: match?.[1] ?? "unknown" };
|
|
918
|
+
}
|
|
919
|
+
if (ua.includes("Firefox")) {
|
|
920
|
+
const match = ua.match(/Firefox\/([\d.]+)/);
|
|
921
|
+
return { name: "Firefox", version: match?.[1] ?? "unknown" };
|
|
922
|
+
}
|
|
923
|
+
if (ua.includes("Safari") && !ua.includes("Chrome")) {
|
|
924
|
+
const match = ua.match(/Version\/([\d.]+)/);
|
|
925
|
+
return { name: "Safari", version: match?.[1] ?? "unknown" };
|
|
926
|
+
}
|
|
927
|
+
return { name: "Unknown", version: "unknown" };
|
|
928
|
+
};
|
|
929
|
+
// Funzione per rilevare il sistema operativo (sostituisce navigator.platform deprecato)
|
|
930
|
+
const detectOS = () => {
|
|
931
|
+
const ua = navigator.userAgent;
|
|
932
|
+
if (ua.includes("Win"))
|
|
933
|
+
return "Windows";
|
|
934
|
+
if (ua.includes("Mac"))
|
|
935
|
+
return "macOS";
|
|
936
|
+
if (ua.includes("Linux"))
|
|
937
|
+
return "Linux";
|
|
938
|
+
if (ua.includes("Android"))
|
|
939
|
+
return "Android";
|
|
940
|
+
if (ua.includes("iOS") || ua.includes("iPhone") || ua.includes("iPad"))
|
|
941
|
+
return "iOS";
|
|
942
|
+
return "Unknown";
|
|
943
|
+
};
|
|
944
|
+
// Rileva supporto touch
|
|
945
|
+
const hasTouchSupport = () => {
|
|
946
|
+
return 'ontouchstart' in window || navigator.maxTouchPoints > 0;
|
|
947
|
+
};
|
|
948
|
+
const browser = detectBrowser();
|
|
949
|
+
const os = detectOS();
|
|
950
|
+
const info = {
|
|
951
|
+
name: browser.name,
|
|
952
|
+
version: browser.version,
|
|
953
|
+
os: os,
|
|
954
|
+
language: navigator.language,
|
|
955
|
+
screenWidth: screen.width,
|
|
956
|
+
screenHeight: screen.height,
|
|
957
|
+
viewportWidth: window.innerWidth,
|
|
958
|
+
viewportHeight: window.innerHeight,
|
|
959
|
+
colorDepth: screen.colorDepth,
|
|
960
|
+
pixelRatio: window.devicePixelRatio || 1,
|
|
961
|
+
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
962
|
+
cookiesEnabled: navigator.cookieEnabled,
|
|
963
|
+
onlineStatus: navigator.onLine,
|
|
964
|
+
touchSupport: hasTouchSupport(),
|
|
965
|
+
userAgent: navigator.userAgent,
|
|
966
|
+
toString() {
|
|
967
|
+
return [
|
|
968
|
+
`Browser: ${this.name} ${this.version}`,
|
|
969
|
+
`OS: ${this.os}`,
|
|
970
|
+
`Language: ${this.language}`,
|
|
971
|
+
`Timezone: ${this.timezone}`,
|
|
972
|
+
`Screen: ${this.screenWidth}x${this.screenHeight} (${this.colorDepth}bit, ${this.pixelRatio}x)`,
|
|
973
|
+
`Viewport: ${this.viewportWidth}x${this.viewportHeight}`,
|
|
974
|
+
// `Features: Cookies=${this.cookiesEnabled}, Online=${this.onlineStatus}, Touch=${this.touchSupport}`,
|
|
975
|
+
`UserAgent: ${this.userAgent}`
|
|
976
|
+
].join(' | ');
|
|
977
|
+
},
|
|
978
|
+
};
|
|
979
|
+
return info;
|
|
980
|
+
};
|
|
@@ -15,5 +15,5 @@ export declare function getDefaultOperator(dataDomain: MetadataDataDomains | und
|
|
|
15
15
|
export declare const getQD: (tid: number | undefined, easyOr: boolean, newMaxDcmtsToBeReturned: number) => Promise<QueryDescriptor | undefined>;
|
|
16
16
|
export declare const getWorkItemSetIDAsync: (vid: number, did: number) => Promise<string | undefined>;
|
|
17
17
|
export declare const getSysAllDcmtsSQD: (tid: number | undefined, easyOr: boolean) => Promise<SavedQueryDescriptor>;
|
|
18
|
-
export declare const searchResultToMetadataValues: (tid: number | undefined, dtd: DataTableDescriptor | undefined, rows: string[], mids: number[], metadata: MetadataDescriptor[], layoutMode: LayoutModes) => MetadataValueDescriptorEx[];
|
|
18
|
+
export declare const searchResultToMetadataValues: (tid: number | undefined, dtd: DataTableDescriptor | undefined, rows: string[], mids: number[], metadata: MetadataDescriptor[], layoutMode: LayoutModes, isReadOnlyOrigin?: boolean) => MetadataValueDescriptorEx[];
|
|
19
19
|
export declare const handleArchiveVisibility: (md: MetadataDescriptor) => boolean;
|
|
@@ -260,7 +260,7 @@ export const getSysAllDcmtsSQD = async (tid, easyOr) => {
|
|
|
260
260
|
sqd.qd = await getQD(tid, easyOr, SDKUI_Globals.userSettings.searchSettings?.maxDcmtsToBeReturned ?? 1000);
|
|
261
261
|
return sqd;
|
|
262
262
|
};
|
|
263
|
-
export const searchResultToMetadataValues = (tid, dtd, rows, mids, metadata, layoutMode) => {
|
|
263
|
+
export const searchResultToMetadataValues = (tid, dtd, rows, mids, metadata, layoutMode, isReadOnlyOrigin = false) => {
|
|
264
264
|
if (!metadata || metadata.length === 0) {
|
|
265
265
|
return [];
|
|
266
266
|
}
|
|
@@ -345,6 +345,29 @@ export const searchResultToMetadataValues = (tid, dtd, rows, mids, metadata, lay
|
|
|
345
345
|
}
|
|
346
346
|
return mvd;
|
|
347
347
|
};
|
|
348
|
+
// Caso: il documento proviene da un'origine esterna e non può essere modificato
|
|
349
|
+
// Documento esterno: visualizza tutti i metadati non di sistema come read-only
|
|
350
|
+
if (isReadOnlyOrigin) {
|
|
351
|
+
const columns = dtd?.columns || [];
|
|
352
|
+
const rows = dtd?.rows ?? [];
|
|
353
|
+
// Itera su ogni colonna per costruire la metadata read-only
|
|
354
|
+
columns.forEach((col, index) => {
|
|
355
|
+
// MID: identificatore unico della colonna
|
|
356
|
+
const mid = Number(col.extendedProperties?.MID);
|
|
357
|
+
// Solo se MID > 100 (per escludere i metadati di sistema)
|
|
358
|
+
if (mid > 100 && rows[0] && rows[0][index]) {
|
|
359
|
+
// Cerca nei metadata se esiste un oggetto corrispondente a questo MID
|
|
360
|
+
const md = metadata.find(m => m.fromMID === mid);
|
|
361
|
+
if (!md)
|
|
362
|
+
return;
|
|
363
|
+
// Crea le proprietà del metadata impostando isReadOnly a true
|
|
364
|
+
const metadataProps = createMetadataProps(tid, md, rows[0][index], 0);
|
|
365
|
+
metadataProps.isReadOnly = true;
|
|
366
|
+
// Aggiunge l'oggetto read-only alla lista di output
|
|
367
|
+
outputMetadataList.push(metadataProps);
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
}
|
|
348
371
|
metadata.forEach(md => {
|
|
349
372
|
if (!md.id)
|
|
350
373
|
return;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface UseFloatingBarPinnedItemsOptions {
|
|
2
|
+
defaultPinnedIds?: string[];
|
|
3
|
+
}
|
|
4
|
+
interface UseFloatingBarPinnedItemsReturn {
|
|
5
|
+
pinnedItemIds: string[];
|
|
6
|
+
isPinned: (id: string) => boolean;
|
|
7
|
+
togglePin: (id: string) => void;
|
|
8
|
+
setPinnedItemIds: (ids: string[]) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const useFloatingBarPinnedItems: (options?: UseFloatingBarPinnedItemsOptions) => UseFloatingBarPinnedItemsReturn;
|
|
11
|
+
export default useFloatingBarPinnedItems;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { useState, useCallback } from 'react';
|
|
2
|
+
import { SDKUI_Globals } from '../helper';
|
|
3
|
+
export const useFloatingBarPinnedItems = (options = {}) => {
|
|
4
|
+
const { defaultPinnedIds = [] } = options;
|
|
5
|
+
const loadPinnedIds = useCallback(() => {
|
|
6
|
+
try {
|
|
7
|
+
const settings = SDKUI_Globals.userSettings?.searchSettings?.floatingMenuBar || {};
|
|
8
|
+
if (settings.itemIds && Array.isArray(settings.itemIds) && settings.itemIds.length > 0) {
|
|
9
|
+
return settings.itemIds;
|
|
10
|
+
}
|
|
11
|
+
return defaultPinnedIds;
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
console.error('Failed to load pinned items from localStorage:', error);
|
|
15
|
+
return defaultPinnedIds;
|
|
16
|
+
}
|
|
17
|
+
}, [defaultPinnedIds]);
|
|
18
|
+
const [internalPinnedItemIds, setInternalPinnedItemIds] = useState(loadPinnedIds);
|
|
19
|
+
const savePinnedIds = useCallback((ids) => {
|
|
20
|
+
try {
|
|
21
|
+
const currentSettings = SDKUI_Globals.userSettings?.searchSettings?.floatingMenuBar || {};
|
|
22
|
+
SDKUI_Globals.userSettings.searchSettings.floatingMenuBar = {
|
|
23
|
+
...currentSettings,
|
|
24
|
+
itemIds: ids,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
console.error('Failed to save pinned items to localStorage:', error);
|
|
29
|
+
}
|
|
30
|
+
}, []);
|
|
31
|
+
const setPinnedItemIds = useCallback((ids) => {
|
|
32
|
+
setInternalPinnedItemIds(ids);
|
|
33
|
+
savePinnedIds(ids);
|
|
34
|
+
}, [savePinnedIds]);
|
|
35
|
+
const isPinned = useCallback((id) => {
|
|
36
|
+
return internalPinnedItemIds.includes(id);
|
|
37
|
+
}, [internalPinnedItemIds]);
|
|
38
|
+
const togglePin = useCallback((id) => {
|
|
39
|
+
setInternalPinnedItemIds(prev => {
|
|
40
|
+
const newIds = prev.includes(id)
|
|
41
|
+
? prev.filter(pinnedId => pinnedId !== id)
|
|
42
|
+
: [...prev, id];
|
|
43
|
+
savePinnedIds(newIds);
|
|
44
|
+
return newIds;
|
|
45
|
+
});
|
|
46
|
+
}, [savePinnedIds]);
|
|
47
|
+
return {
|
|
48
|
+
pinnedItemIds: internalPinnedItemIds,
|
|
49
|
+
isPinned,
|
|
50
|
+
togglePin,
|
|
51
|
+
setPinnedItemIds,
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
export default useFloatingBarPinnedItems;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { QueryDescriptor } from '@topconsultnpm/sdk-ts';
|
|
2
|
+
export interface MetadataHelper {
|
|
3
|
+
Mid: number;
|
|
4
|
+
MetadataName: string;
|
|
5
|
+
}
|
|
6
|
+
export interface UseMetadataExpressionProps {
|
|
7
|
+
qd?: QueryDescriptor;
|
|
8
|
+
tid?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface UseMetadataExpressionResult {
|
|
11
|
+
metadatas_Info_Source: MetadataHelper[];
|
|
12
|
+
Expression_IDs2Names: (expression: string | undefined) => string | undefined;
|
|
13
|
+
Expression_Names2IDs: (expression: string | undefined) => string | undefined;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Custom hook per gestire le espressioni con metadati.
|
|
17
|
+
* Fornisce funzioni per convertire tra IDs e nomi dei metadati e gestisce il caricamento dei metadati.
|
|
18
|
+
*/
|
|
19
|
+
export declare const useMetadataExpression: ({ qd, tid }: UseMetadataExpressionProps) => UseMetadataExpressionResult;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import { DcmtTypeListCacheService } from '@topconsultnpm/sdk-ts';
|
|
3
|
+
import { TMExceptionBoxManager } from '../components/base/TMPopUp';
|
|
4
|
+
/**
|
|
5
|
+
* Custom hook per gestire le espressioni con metadati.
|
|
6
|
+
* Fornisce funzioni per convertire tra IDs e nomi dei metadati e gestisce il caricamento dei metadati.
|
|
7
|
+
*/
|
|
8
|
+
export const useMetadataExpression = ({ qd, tid }) => {
|
|
9
|
+
const [metadatas_Info_Source, setMetadatas_Info_Source] = useState([]);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
MetadataInfos_Source_Get_Async();
|
|
12
|
+
}, [qd]);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
MetadataInfos_Source_GetByTID_Async();
|
|
15
|
+
}, [tid]);
|
|
16
|
+
async function MetadataInfos_Source_Get_Async() {
|
|
17
|
+
if (!qd?.select)
|
|
18
|
+
return;
|
|
19
|
+
let mhs_source = [];
|
|
20
|
+
try {
|
|
21
|
+
let dtd_source;
|
|
22
|
+
let md_source;
|
|
23
|
+
let tid_source = -1;
|
|
24
|
+
let si;
|
|
25
|
+
let sis = qd.select.slice();
|
|
26
|
+
sis = sis.slice().sort((a, b) => a.tid - b.tid);
|
|
27
|
+
for (si of sis) {
|
|
28
|
+
if (si.tid == undefined || si.mid == undefined)
|
|
29
|
+
continue;
|
|
30
|
+
if (tid_source != si.tid) {
|
|
31
|
+
dtd_source = await DcmtTypeListCacheService.GetAsync(si.tid, true);
|
|
32
|
+
if (dtd_source == undefined)
|
|
33
|
+
continue;
|
|
34
|
+
tid_source = si.tid;
|
|
35
|
+
}
|
|
36
|
+
if (dtd_source?.metadata == undefined)
|
|
37
|
+
continue;
|
|
38
|
+
md_source = dtd_source.metadata.find(o => o.id == si.mid);
|
|
39
|
+
if (md_source?.name == undefined)
|
|
40
|
+
continue;
|
|
41
|
+
if (tid_source == undefined)
|
|
42
|
+
continue;
|
|
43
|
+
mhs_source.push({ Mid: si.mid, MetadataName: md_source.name });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch (e) {
|
|
47
|
+
TMExceptionBoxManager.show({ exception: e, title: 'MetadataInfos_Source_Get_Async' });
|
|
48
|
+
}
|
|
49
|
+
setMetadatas_Info_Source(mhs_source);
|
|
50
|
+
}
|
|
51
|
+
async function MetadataInfos_Source_GetByTID_Async() {
|
|
52
|
+
if (!tid)
|
|
53
|
+
return;
|
|
54
|
+
let mhs_source = [];
|
|
55
|
+
try {
|
|
56
|
+
let dtd_source = await DcmtTypeListCacheService.GetAsync(tid, true);
|
|
57
|
+
if (dtd_source == undefined)
|
|
58
|
+
return;
|
|
59
|
+
if (dtd_source?.metadata == undefined)
|
|
60
|
+
return;
|
|
61
|
+
for (let md_source of dtd_source?.metadata) {
|
|
62
|
+
if (md_source?.name == undefined)
|
|
63
|
+
continue;
|
|
64
|
+
if (md_source?.id == undefined)
|
|
65
|
+
continue;
|
|
66
|
+
mhs_source.push({ Mid: md_source.id, MetadataName: md_source.name });
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch (e) {
|
|
70
|
+
TMExceptionBoxManager.show({ exception: e, title: 'MetadataInfos_Source_GetByTID_Async' });
|
|
71
|
+
}
|
|
72
|
+
setMetadatas_Info_Source(mhs_source);
|
|
73
|
+
}
|
|
74
|
+
function Expression_IDs2Names(expression) {
|
|
75
|
+
if (expression == undefined)
|
|
76
|
+
return expression;
|
|
77
|
+
let temp = expression.slice();
|
|
78
|
+
for (const mh of metadatas_Info_Source) {
|
|
79
|
+
temp = temp.replaceAll(`{@${mh.Mid}}`, `{@${mh.MetadataName}}`);
|
|
80
|
+
}
|
|
81
|
+
temp = temp.replaceAll("{@1}", "{@DID}");
|
|
82
|
+
return temp;
|
|
83
|
+
}
|
|
84
|
+
function Expression_Names2IDs(expression) {
|
|
85
|
+
if (expression == undefined)
|
|
86
|
+
return expression;
|
|
87
|
+
let temp = expression.slice();
|
|
88
|
+
for (const mh of metadatas_Info_Source) {
|
|
89
|
+
temp = temp.replaceAll(`{@${mh.MetadataName}}`, `{@${mh.Mid}}`);
|
|
90
|
+
}
|
|
91
|
+
temp = temp.replaceAll("{@DID}", "{@1}");
|
|
92
|
+
return temp;
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
metadatas_Info_Source,
|
|
96
|
+
Expression_IDs2Names,
|
|
97
|
+
Expression_Names2IDs
|
|
98
|
+
};
|
|
99
|
+
};
|
package/package.json
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
2
|
+
"name": "@topconsultnpm/sdkui-react",
|
|
3
|
+
"version": "6.20.0-dev2.1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"test": "echo \"Error: no test specified\" \u0026\u0026 exit 1",
|
|
7
|
+
"clean": "powershell Remove-Item lib/ -recurse",
|
|
8
|
+
"copy-files": "copyfiles -u 1 src/assets/*.* src/assets/ImageLibrary/*.* src/assets/thumbnails/*.* src/assets/IconsS4t/*.* src/assets/Metadata/*.* src/css/tm-sdkui.css lib/",
|
|
9
|
+
"tm-build": "npm run clean \u0026\u0026 tsc \u0026\u0026 npm run copy-files",
|
|
10
|
+
"tm-watch": "tsc -w",
|
|
11
|
+
"tm-publish": "npm publish --tag latest",
|
|
12
|
+
"tm-publish_wl": "npm publish",
|
|
13
|
+
"storybook": "storybook dev -p 6006",
|
|
14
|
+
"build-storybook": "storybook build"
|
|
15
|
+
},
|
|
16
|
+
"author": "TopConsult",
|
|
17
|
+
"license": "ISC",
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@chromatic-com/storybook": "^4.1.3",
|
|
20
|
+
"@storybook/addon-docs": "^10.1.0",
|
|
21
|
+
"@storybook/addon-onboarding": "^10.1.0",
|
|
22
|
+
"@storybook/react-vite": "^10.1.0",
|
|
23
|
+
"@types/htmlparser2": "^3.10.7",
|
|
24
|
+
"@types/node": "^20.2.5",
|
|
25
|
+
"@types/react": "^18.3.3",
|
|
26
|
+
"@types/react-dom": "^18.3.3",
|
|
27
|
+
"copyfiles": "^2.4.1",
|
|
28
|
+
"esbuild": "^0.25.0",
|
|
29
|
+
"react": "^18.3.1",
|
|
30
|
+
"react-dom": "^18.3.1",
|
|
31
|
+
"storybook": "^10.1.0",
|
|
32
|
+
"typescript": "^5.9.3",
|
|
33
|
+
"vite": "^6.1.1"
|
|
34
|
+
},
|
|
35
|
+
"main": "dist/cjs/index.js",
|
|
36
|
+
"types": "./index.d.ts",
|
|
37
|
+
"module": "lib/esm/index.js",
|
|
38
|
+
"files": [
|
|
39
|
+
"dist",
|
|
40
|
+
"lib"
|
|
41
|
+
],
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"react-router-dom": "^6.15.0",
|
|
44
|
+
"react-pdf": "^10.3.0",
|
|
45
|
+
"htmlparser2": "^10.0.0",
|
|
46
|
+
"buffer": "^6.0.3",
|
|
47
|
+
"@topconsultnpm/sdk-ts": "6.20.0-test1",
|
|
48
|
+
"exceljs": "^4.4.0",
|
|
49
|
+
"devextreme": "25.2.4",
|
|
50
|
+
"styled-components": "^6.1.1",
|
|
51
|
+
"pdfjs-dist": "5.4.296",
|
|
52
|
+
"devextreme-react": "25.2.4"
|
|
53
|
+
},
|
|
54
|
+
"overrides": {
|
|
55
|
+
"esbuild": "^0.25.0"
|
|
56
|
+
}
|
|
57
|
+
}
|