@topconsultnpm/sdkui-react 6.19.0-dev1.41 → 6.19.0-dev1.43
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/components/editors/TMHtmlEditor.js +2 -0
- package/lib/components/features/archive/TMArchive.js +16 -4
- package/lib/components/features/blog/TMBlogCommentForm.js +1 -1
- package/lib/components/features/search/TMSearchQueryPanel.js +12 -5
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +1 -1
- package/lib/components/features/search/TMSearchResultsMenuItems.js +1 -1
- package/package.json +1 -1
|
@@ -11,6 +11,8 @@ export const sanitizeAndFormatComment = (raw = "") => {
|
|
|
11
11
|
if (!raw)
|
|
12
12
|
return "";
|
|
13
13
|
let cleanComment = raw
|
|
14
|
+
// Simplify dx-mention markup - replace with just @username
|
|
15
|
+
.replace(/<span class="dx-mention"[^>]*>\uFEFF?<span[^>]*><span>@<\/span>([^<]+)<\/span>\uFEFF?<\/span>/gi, '@$1')
|
|
14
16
|
// Replace </p> with '' only if followed by <ol> or <ul>
|
|
15
17
|
.replace(/<\/p>(?=\s*<(ol|ul)>)/gi, '')
|
|
16
18
|
// Replace all other </p> with '\r\n'
|
|
@@ -19,6 +19,7 @@ const TMArchive = ({ onDcmtTypeSelect = undefined, inputTID, inputFile = null, c
|
|
|
19
19
|
const [fromDTD, setFromDTD] = useState();
|
|
20
20
|
const [currentInputMids, setCurrentInputMids] = useState(inputMids);
|
|
21
21
|
const previousTIDRef = React.useRef(undefined);
|
|
22
|
+
const pendingMidsRef = React.useRef(null);
|
|
22
23
|
const deviceType = useDeviceType();
|
|
23
24
|
useEffect(() => { setMruTIDs(SDKUI_Globals.userSettings.archivingSettings.mruTIDs); }, []);
|
|
24
25
|
useEffect(() => {
|
|
@@ -26,12 +27,13 @@ const TMArchive = ({ onDcmtTypeSelect = undefined, inputTID, inputFile = null, c
|
|
|
26
27
|
return;
|
|
27
28
|
setCurrentTID(inputTID);
|
|
28
29
|
setCurrentMruTID(mruTIDs.includes(inputTID) ? inputTID : 0);
|
|
29
|
-
}, [inputTID]);
|
|
30
|
+
}, [inputTID, mruTIDs]);
|
|
30
31
|
useEffect(() => {
|
|
31
|
-
|
|
32
|
+
pendingMidsRef.current = inputMids;
|
|
32
33
|
}, [inputMids]);
|
|
33
34
|
useEffect(() => {
|
|
34
35
|
if (!currentTID || currentTID <= 0) {
|
|
36
|
+
previousTIDRef.current = currentTID;
|
|
35
37
|
return;
|
|
36
38
|
}
|
|
37
39
|
if (onDcmtTypeSelect)
|
|
@@ -39,8 +41,18 @@ const TMArchive = ({ onDcmtTypeSelect = undefined, inputTID, inputFile = null, c
|
|
|
39
41
|
DcmtTypeListCacheService.GetAsync(currentTID).then(async (dtd) => {
|
|
40
42
|
setFromDTD(dtd);
|
|
41
43
|
});
|
|
42
|
-
if (previousTIDRef.current !== undefined && previousTIDRef.current !== currentTID) {
|
|
43
|
-
|
|
44
|
+
if (previousTIDRef.current !== undefined && previousTIDRef.current > 0 && previousTIDRef.current !== currentTID) {
|
|
45
|
+
if (pendingMidsRef.current && pendingMidsRef.current.length > 0) {
|
|
46
|
+
setCurrentInputMids(pendingMidsRef.current);
|
|
47
|
+
pendingMidsRef.current = null;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
setCurrentInputMids([]);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
else if (pendingMidsRef.current) {
|
|
54
|
+
setCurrentInputMids(pendingMidsRef.current);
|
|
55
|
+
pendingMidsRef.current = null;
|
|
44
56
|
}
|
|
45
57
|
previousTIDRef.current = currentTID;
|
|
46
58
|
}, [currentTID, onDcmtTypeSelect]);
|
|
@@ -113,7 +113,7 @@ const TMBlogCommentForm = (props) => {
|
|
|
113
113
|
const blogPost = new BlogPost();
|
|
114
114
|
// Retrieve the comment from formData, or use an empty string if undefined
|
|
115
115
|
const comment = formData?.comment ?? "";
|
|
116
|
-
// Clean the comment
|
|
116
|
+
// Clean the comment using the sanitizeAndFormatComment function
|
|
117
117
|
const cleanComment = sanitizeAndFormatComment(comment);
|
|
118
118
|
// Assign the cleaned comment as the description for the blog post
|
|
119
119
|
blogPost.description = cleanComment ?? "";
|
|
@@ -42,23 +42,30 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
|
|
|
42
42
|
const isMobile = deviceType === DeviceType.MOBILE;
|
|
43
43
|
let initialMaxItems = deviceType === DeviceType.MOBILE ? 8 : 12;
|
|
44
44
|
const appliedInputMidsRef = useRef(null);
|
|
45
|
+
const pendingMidsRef = useRef(null);
|
|
45
46
|
useEffect(() => {
|
|
46
47
|
if (!SQD)
|
|
47
48
|
return;
|
|
48
49
|
setDataAsync(SQD);
|
|
49
50
|
}, [SQD]);
|
|
50
51
|
useEffect(() => {
|
|
51
|
-
|
|
52
|
+
pendingMidsRef.current = inputMids ?? null;
|
|
53
|
+
}, [inputMids]);
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
if (!qd || !fromDTD)
|
|
56
|
+
return;
|
|
57
|
+
const midsToApply = pendingMidsRef.current;
|
|
58
|
+
if (!midsToApply || midsToApply.length === 0)
|
|
52
59
|
return;
|
|
53
|
-
if (appliedInputMidsRef.current && deepCompare(appliedInputMidsRef.current,
|
|
60
|
+
if (appliedInputMidsRef.current && deepCompare(appliedInputMidsRef.current, midsToApply))
|
|
54
61
|
return;
|
|
55
|
-
appliedInputMidsRef.current =
|
|
62
|
+
appliedInputMidsRef.current = midsToApply;
|
|
56
63
|
const newWhere = qd.where?.map((curItem) => {
|
|
57
64
|
let newWi = new WhereItem();
|
|
58
65
|
newWi.init({ ...curItem, value1: undefined, value2: undefined });
|
|
59
66
|
return newWi;
|
|
60
67
|
}) || [];
|
|
61
|
-
|
|
68
|
+
midsToApply.forEach(im => {
|
|
62
69
|
const md = fromDTD.metadata?.find(m => m.id === im.mid);
|
|
63
70
|
const defaultOperator = getDefaultOperator(md?.dataDomain, md?.dataType);
|
|
64
71
|
let existingWi = newWhere.find(wi => wi.mid === im.mid);
|
|
@@ -78,7 +85,7 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
|
|
|
78
85
|
});
|
|
79
86
|
setQd({ ...qd, where: newWhere });
|
|
80
87
|
setShowAllMdWhere(true);
|
|
81
|
-
}, [
|
|
88
|
+
}, [qd, fromDTD]);
|
|
82
89
|
// Eseguire la ricerca quando shouldSearch è true e qd è definito
|
|
83
90
|
useEffect(() => {
|
|
84
91
|
if (shouldSearch && qd) {
|
|
@@ -7,4 +7,4 @@ export declare const signatureInformationCallback: (isMobile: boolean, inputDcmt
|
|
|
7
7
|
export declare const getCommandsMenuItems: (isMobile: boolean, dtd: DcmtTypeDescriptor | undefined, selectedItems: Array<any>, focusedItem: any, context: SearchResultContext, showFloatingBar: boolean, workingGroupContext: WorkingGroupDescriptor | undefined, showSearch: boolean, setShowFloatingBar: React.Dispatch<React.SetStateAction<boolean>>, openFormHandler: (layoutMode: LayoutModes) => void, openSharedArchiveHandler: () => Promise<void>, downloadDcmtsAsync: (inputDcmts: DcmtInfo[] | undefined, downloadType: DownloadTypes, downloadMode: DownloadModes, onFileDownloaded?: (dcmtFile: File | undefined) => void, confirmAttachments?: (list: FileDescriptor[]) => Promise<string[] | undefined>) => Promise<void>, runOperationAsync: (inputDcmts: DcmtInfo[] | undefined, dcmtOperationType: DcmtOperationTypes, actionAfterOperationAsync?: () => Promise<void>) => Promise<void>, onRefreshSearchAsync: (() => Promise<void>) | undefined, onRefreshDataRowsAsync: (() => Promise<void>) | undefined, onRefreshAfterAddDcmtToFavs: (() => void) | undefined, confirmFormat: () => Promise<FileFormats>, confirmAttachments: (list: FileDescriptor[]) => Promise<string[] | undefined>, openTaskFormHandler: () => void, openDetailDcmtsFormHandler: (value: boolean) => void, openMasterDcmtsFormHandler: (value: boolean) => void, openBatchUpdateFormHandler: (value: boolean) => void, openExportForm: () => void, handleToggleSearch: () => void, handleSignApprove: () => void, openWGsCopyMoveForm?: ((mode: "copyToWgDraft" | "copyToWgArchivedDoc", dcmtTypeDescriptor: DcmtTypeDescriptor, documents: Array<DcmtInfo>) => void), openCommentFormCallback?: ((documents: Array<DcmtInfo>) => void), openEditPdf?: ((documents: Array<DcmtInfo>) => void), openAddDocumentForm?: () => void, passToArchiveCallback?: (outputMids: Array<{
|
|
8
8
|
mid: number;
|
|
9
9
|
value: string;
|
|
10
|
-
}
|
|
10
|
+
}>, tid?: number) => void, archiveMasterDocuments?: (tid: number | undefined) => Promise<void>, archiveDetailDocuments?: (tid: number | undefined) => Promise<void>, hasMasterRelation?: boolean, hasDetailRelation?: boolean, canArchiveMasterRelation?: boolean, canArchiveDetailRelation?: boolean, pairManyToManyDocuments?: (isPairing: boolean) => Promise<void>, hasManyToManyRelation?: boolean) => Array<TMDataGridContextMenuItem>;
|
|
@@ -235,7 +235,7 @@ export const getCommandsMenuItems = (isMobile, dtd, selectedItems, focusedItem,
|
|
|
235
235
|
?.filter(md => md.mid && md.mid > 100 && md.value && md.value.length > 0)
|
|
236
236
|
.map(md => ({ mid: md.mid, value: md.value })) || [];
|
|
237
237
|
TMSpinner.hide();
|
|
238
|
-
passToArchiveCallback?.(outputMids);
|
|
238
|
+
passToArchiveCallback?.(outputMids, item.TID);
|
|
239
239
|
}
|
|
240
240
|
catch (error) {
|
|
241
241
|
TMSpinner.hide();
|