@topconsultnpm/sdkui-react 6.19.0-dev2.11 → 6.19.0-dev2.13
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/choosers/TMMetadataChooser.d.ts +4 -1
- package/lib/components/choosers/TMMetadataChooser.js +14 -6
- package/lib/components/features/search/TMSearchResult.js +5 -2
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +1 -0
- package/lib/components/features/search/TMSearchResultsMenuItems.js +34 -6
- package/lib/components/layout/panelManager/TMPanelManagerToolbar.js +2 -1
- package/lib/components/layout/panelManager/types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -2,6 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import { MetadataDescriptor, QueryDescriptor, ValidationItem } from '@topconsultnpm/sdk-ts';
|
|
3
3
|
import { ITMChooserFormProps, ITMChooserProps, TID_MID } from '../../ts';
|
|
4
4
|
import { TID_Alias } from '../../helper/queryHelper';
|
|
5
|
+
type MetadataDescriptorWithKey = MetadataDescriptor & {
|
|
6
|
+
uniqueKey: string;
|
|
7
|
+
};
|
|
5
8
|
interface ITMMetadataChooserProps extends ITMChooserProps {
|
|
6
9
|
/** Allows you to view system metadata */
|
|
7
10
|
allowSysMetadata?: boolean;
|
|
@@ -32,7 +35,7 @@ interface ITMMetadataChooserProps extends ITMChooserProps {
|
|
|
32
35
|
}
|
|
33
36
|
declare const TMMetadataChooser: React.FunctionComponent<ITMMetadataChooserProps>;
|
|
34
37
|
export default TMMetadataChooser;
|
|
35
|
-
interface ITMMetadataChooserFormProps extends ITMChooserFormProps<
|
|
38
|
+
interface ITMMetadataChooserFormProps extends ITMChooserFormProps<MetadataDescriptorWithKey> {
|
|
36
39
|
/** Allows you to view system metadata */
|
|
37
40
|
allowSysMetadata?: boolean;
|
|
38
41
|
/** TIDs of document types to retrieve metadata from */
|
|
@@ -50,15 +50,19 @@ export const TMMetadataChooserForm = ({ tmSession, tids, qd, filterMetadata, qdS
|
|
|
50
50
|
dtd.customData2 = alias;
|
|
51
51
|
if (!qdShowOnlySelectItems) {
|
|
52
52
|
dtd.metadata?.forEach((md) => {
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
const mdWithKey = md;
|
|
54
|
+
mdWithKey.customData1 = dtd.id;
|
|
55
|
+
mdWithKey.customData2 = alias;
|
|
56
|
+
mdWithKey.uniqueKey = `${dtd.id}_${md.id}_${alias}`;
|
|
55
57
|
});
|
|
56
58
|
}
|
|
57
59
|
else {
|
|
58
60
|
let newMetadata = dtd.metadata?.filter(o => qd.select?.some(s => s.tid == dtd.id && s.mid == o.id && ((s.alias ?? '') == alias)));
|
|
59
61
|
newMetadata?.forEach((md) => {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
const mdWithKey = md;
|
|
63
|
+
mdWithKey.customData1 = dtd.id;
|
|
64
|
+
mdWithKey.customData2 = alias;
|
|
65
|
+
mdWithKey.uniqueKey = `${dtd.id}_${md.id}_${alias}`;
|
|
62
66
|
});
|
|
63
67
|
}
|
|
64
68
|
let mds = filterMetadata ? dtd.metadata?.filter(filterMetadata) : dtd.metadata;
|
|
@@ -81,7 +85,11 @@ export const TMMetadataChooserForm = ({ tmSession, tids, qd, filterMetadata, qdS
|
|
|
81
85
|
continue;
|
|
82
86
|
}
|
|
83
87
|
let mds = filterMetadata ? dtd.metadata?.filter(filterMetadata) : dtd.metadata;
|
|
84
|
-
mds?.forEach((md) => {
|
|
88
|
+
mds?.forEach((md) => {
|
|
89
|
+
const mdWithKey = md;
|
|
90
|
+
mdWithKey.customData1 = dtd?.id;
|
|
91
|
+
mdWithKey.uniqueKey = `${dtd.id}_${md.id}_${md.customData2 ?? ''}`;
|
|
92
|
+
});
|
|
85
93
|
dtdList.push({ ...dtd, metadata: mds });
|
|
86
94
|
}
|
|
87
95
|
}
|
|
@@ -130,5 +138,5 @@ export const TMMetadataChooserForm = ({ tmSession, tids, qd, filterMetadata, qdS
|
|
|
130
138
|
const cellRenderNameAndDesc = useCallback((data) => {
|
|
131
139
|
return _jsx("p", { style: { textAlign: 'left', color: data.data.isRequired == 1 ? 'red' : '' }, children: data.value });
|
|
132
140
|
}, []);
|
|
133
|
-
return (_jsx(TMChooserForm, { title: SDK_Localizator.Metadatas, allowMultipleSelection: allowMultipleSelection, allowSorting: false, allowGrouping: dcmtTypes.length > 1, width: width, height: height, selectedIDs: selectedIDs?.map((item) => item.mid), convertID: convertID, cellRenderIcon: cellRenderIcon, cellRenderNameAndDesc: cellRenderNameAndDesc, dataSource: dataSource, getItems: getItems, customButtons: renderCustomButtons(), columns: dataColumns, summaryItems: renderSummaryItems, onClose: onClose, onChoose: (IDs) => { onChoose?.(IDs); } }));
|
|
141
|
+
return (_jsx(TMChooserForm, { title: SDK_Localizator.Metadatas, allowMultipleSelection: allowMultipleSelection, allowSorting: false, allowGrouping: dcmtTypes.length > 1, width: width, height: height, keyName: 'uniqueKey', selectedIDs: selectedIDs?.map((item) => `${item.tid}_${item.mid}_${item.aliasTID ?? ''}`), convertID: convertID, cellRenderIcon: cellRenderIcon, cellRenderNameAndDesc: cellRenderNameAndDesc, dataSource: dataSource, getItems: getItems, customButtons: renderCustomButtons(), columns: dataColumns, summaryItems: renderSummaryItems, onClose: onClose, onChoose: (IDs) => { onChoose?.(IDs); } }));
|
|
134
142
|
};
|
|
@@ -331,7 +331,8 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
331
331
|
.then(async () => {
|
|
332
332
|
await downloadDcmtsAsync(getSelectedDcmtsOrFocused(selectedItems, focusedItem), DownloadTypes.Dcmt, "download");
|
|
333
333
|
result.push({ rowIndex: 0, id1: firstDoc.TID, id2: firstDoc.DID, description: SDKUI_Localizator.UpdateCompletedSuccessfully, resultType: ResultTypes.SUCCESS });
|
|
334
|
-
await refreshSelectionDataRowsAsync();
|
|
334
|
+
// await refreshSelectionDataRowsAsync();
|
|
335
|
+
await refreshFocusedDataRowAsync(firstDoc.TID, firstDoc.DID, true);
|
|
335
336
|
})
|
|
336
337
|
.catch((error) => {
|
|
337
338
|
result.push({ rowIndex: 0, id1: firstDoc.TID, id2: firstDoc.DID, resultType: ResultTypes.ERROR, description: getExceptionMessage(error) });
|
|
@@ -341,7 +342,9 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
341
342
|
else {
|
|
342
343
|
await ue.UndoCheckOutAsync()
|
|
343
344
|
.then(async () => {
|
|
344
|
-
|
|
345
|
+
result.push({ rowIndex: 0, id1: firstDoc.TID, id2: firstDoc.DID, description: SDKUI_Localizator.UpdateCompletedSuccessfully, resultType: ResultTypes.SUCCESS });
|
|
346
|
+
// await refreshSelectionDataRowsAsync();
|
|
347
|
+
await refreshFocusedDataRowAsync(firstDoc.TID, firstDoc.DID, true);
|
|
345
348
|
})
|
|
346
349
|
.catch((error) => {
|
|
347
350
|
result.push({ rowIndex: 0, id1: firstDoc.TID, id2: firstDoc.DID, resultType: ResultTypes.ERROR, description: getExceptionMessage(error) });
|
|
@@ -3,6 +3,7 @@ import { DcmtTypeDescriptor, FileDescriptor, FileFormats, LayoutModes, WorkingGr
|
|
|
3
3
|
import { TMDataGridContextMenuItem } from '../../base/TMDataGrid';
|
|
4
4
|
import { DcmtInfo, DcmtOperationTypes, DownloadModes, DownloadTypes, SearchResultContext } from '../../../ts';
|
|
5
5
|
export declare const getSelectedDcmtsOrFocused: (selectedItems: Array<any>, focusedItem: any, fileFormat?: FileFormats) => DcmtInfo[];
|
|
6
|
+
export declare const getAllFieldSelectedDcmtsOrFocused: (selectedItems: Array<any>, focusedItem: any, fileFormat?: FileFormats) => any[];
|
|
6
7
|
export declare const signatureInformationCallback: (isMobile: boolean, inputDcmts: DcmtInfo[] | undefined) => Promise<void>;
|
|
7
8
|
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>, showSharedDcmtsHandler: () => 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, handleCheckOutOperationCallback: (checkout: boolean) => Promise<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
9
|
mid: number;
|
|
@@ -40,8 +40,21 @@ const getCicoInfo = (dtd) => {
|
|
|
40
40
|
}
|
|
41
41
|
return cico;
|
|
42
42
|
};
|
|
43
|
-
const cicoIsEnabled = (
|
|
44
|
-
|
|
43
|
+
const cicoIsEnabled = (dcmt, dtd) => {
|
|
44
|
+
const cicoInfo = getCicoInfo(dtd);
|
|
45
|
+
let isCheckout = false;
|
|
46
|
+
const CICO_CheckoutUserID = dtd?.metadata?.find(md => md.name === CICO_MetadataNames.CICO_CheckoutUserID)?.id;
|
|
47
|
+
if (dcmt && CICO_CheckoutUserID) {
|
|
48
|
+
const key = dcmt.TID + "_" + CICO_CheckoutUserID;
|
|
49
|
+
const value = dcmt[key];
|
|
50
|
+
if (value && value > 0) {
|
|
51
|
+
isCheckout = true;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
cicoEnabled: cicoInfo.CICO === 1 && cicoInfo.CanCICO === AccessLevels.Yes,
|
|
56
|
+
isCheckout: isCheckout
|
|
57
|
+
};
|
|
45
58
|
};
|
|
46
59
|
const disabledForSingleRow = (selectedItems, focusedItem) => {
|
|
47
60
|
return selectedItems.length > 1 || focusedItem === undefined;
|
|
@@ -61,6 +74,17 @@ export const getSelectedDcmtsOrFocused = (selectedItems, focusedItem, fileFormat
|
|
|
61
74
|
}
|
|
62
75
|
return [];
|
|
63
76
|
};
|
|
77
|
+
export const getAllFieldSelectedDcmtsOrFocused = (selectedItems, focusedItem, fileFormat) => {
|
|
78
|
+
if (selectedItems.length <= 0 && !focusedItem)
|
|
79
|
+
return [];
|
|
80
|
+
if (selectedItems.length > 0) {
|
|
81
|
+
return selectedItems;
|
|
82
|
+
}
|
|
83
|
+
else if (focusedItem !== undefined) {
|
|
84
|
+
return [focusedItem];
|
|
85
|
+
}
|
|
86
|
+
return [];
|
|
87
|
+
};
|
|
64
88
|
export const signatureInformationCallback = async (isMobile, inputDcmts) => {
|
|
65
89
|
try {
|
|
66
90
|
if (!inputDcmts || inputDcmts.length === 0) {
|
|
@@ -333,23 +357,27 @@ export const getCommandsMenuItems = (isMobile, dtd, selectedItems, focusedItem,
|
|
|
333
357
|
};
|
|
334
358
|
};
|
|
335
359
|
const checkinMenuItem = () => {
|
|
336
|
-
|
|
360
|
+
// Get the currently selected or focused documents
|
|
361
|
+
const selectedDocs = getAllFieldSelectedDcmtsOrFocused(selectedItems, focusedItem);
|
|
362
|
+
// Take the first document (used for validation checks)
|
|
363
|
+
const firstDoc = selectedDocs?.[0];
|
|
364
|
+
const { cicoEnabled, isCheckout } = cicoIsEnabled(firstDoc, dtd);
|
|
337
365
|
return {
|
|
338
366
|
icon: svgToString(_jsx(IconFileDots, {})),
|
|
339
367
|
text: "Check in/Check out",
|
|
340
|
-
disabled: !
|
|
368
|
+
disabled: !cicoEnabled || (disabledForSingleRow(selectedItems, focusedItem) && disabledForMultiRow(selectedItems, focusedItem)),
|
|
341
369
|
items: [
|
|
342
370
|
{
|
|
343
371
|
icon: "edit",
|
|
344
372
|
text: 'Check out',
|
|
345
|
-
disabled: !
|
|
373
|
+
disabled: !cicoEnabled || (disabledForSingleRow(selectedItems, focusedItem) && disabledForMultiRow(selectedItems, focusedItem)),
|
|
346
374
|
// disabled: isNotSingleFile || isGroupLocked || isFileCheckedOut,
|
|
347
375
|
onClick: () => handleCheckOutOperationCallback(true),
|
|
348
376
|
},
|
|
349
377
|
{
|
|
350
378
|
icon: "remove",
|
|
351
379
|
text: SDKUI_Localizator.CancelCheckOut,
|
|
352
|
-
disabled: !
|
|
380
|
+
disabled: !cicoEnabled || (disabledForSingleRow(selectedItems, focusedItem) && disabledForMultiRow(selectedItems, focusedItem)),
|
|
353
381
|
// disabled: isNotSingleFile || isGroupLocked || isFileNotCheckedOut || isNotCheckedOutByCurrentUser,
|
|
354
382
|
onClick: () => handleCheckOutOperationCallback(false),
|
|
355
383
|
},
|
|
@@ -76,7 +76,8 @@ const TMPanelManagerToolbar = (props) => {
|
|
|
76
76
|
const isActive = panelVisibility[visibleLeafPanel.id];
|
|
77
77
|
const isDisabled = toolbarButtonsDisabled[visibleLeafPanel.id];
|
|
78
78
|
const count = visibleLeafPanel.toolbarOptions?.count ?? 0;
|
|
79
|
-
|
|
79
|
+
const tooltip = visibleLeafPanel.toolbarOptions?.tooltip ?? '';
|
|
80
|
+
return _jsx(TMTooltip, { content: tooltip || (visibleLeafPanel.name + (count > 0 ? ": " + count : '')), position: isMobile ? 'top' : 'left', children: _jsxs(StyledToolbarButton, { disabled: isDisabled, "$isDisabled": isDisabled, onClick: () => onClickCallback(visibleLeafPanel.id, isActive), "$isActive": isActive || visibleLeafPanel.toolbarOptions?.alwaysActiveColor, children: [typeof visibleLeafPanel.toolbarOptions?.icon === 'string' ? (_jsx("i", { className: `dx-icon dx-icon-${visibleLeafPanel.toolbarOptions?.icon}` })) : (visibleLeafPanel.toolbarOptions?.icon), (!isActive && count > 0) && _jsxs(Badge, { "$background": visibleLeafPanel.toolbarOptions?.countBackgroundColor, children: [" ", formatCount(count), " "] })] }, visibleLeafPanel.id) }, visibleLeafPanel.id);
|
|
80
81
|
}) }));
|
|
81
82
|
};
|
|
82
83
|
export default TMPanelManagerToolbar;
|