@topconsultnpm/sdkui-react-beta 6.17.23 → 6.17.26
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/base/TMDataGridExportForm.js +6 -3
- package/lib/components/choosers/TMPathChooser.js +1 -1
- package/lib/components/features/search/TMSearchResultsMenuItems.js +3 -3
- package/lib/components/features/workflow/TMWorkflowPopup.js +2 -2
- package/lib/helper/TMUtils.d.ts +4 -1
- package/lib/helper/TMUtils.js +5 -1
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@ const formatDataSource = [
|
|
|
16
16
|
];
|
|
17
17
|
const TMDataGridExportForm = (props) => {
|
|
18
18
|
const { searchResult, dataSource, dataColumns, selectedRowKeys, onCloseExportForm } = props;
|
|
19
|
-
// State to track the selected export format (default: '
|
|
19
|
+
// State to track the selected export format (default: 'csv')
|
|
20
20
|
const [formatSelected, setFormatSelected] = useState('csv');
|
|
21
21
|
// Boolean state to indicate whether to export only the selected items
|
|
22
22
|
const [exportSelectedOnly, setExportSelectedOnly] = useState(selectedRowKeys.length > 0 ? true : false);
|
|
@@ -64,7 +64,7 @@ const TMDataGridExportForm = (props) => {
|
|
|
64
64
|
// Retrieve columns from the search result, or use an empty array if not available
|
|
65
65
|
const columns = searchResult?.dtdResult?.columns ?? [];
|
|
66
66
|
// If exportDescriptionsForDataLists is true, build a map of values to labels for the columns; otherwise use an empty Map
|
|
67
|
-
const valueToNameMap = exportDescriptionsForDataLists ? await buildValueToLabelMapFromDataColumns(columns) : new Map();
|
|
67
|
+
const { valueToNameMap, captions } = exportDescriptionsForDataLists ? await buildValueToLabelMapFromDataColumns(columns) : { valueToNameMap: new Map(), captions: new Set() };
|
|
68
68
|
// Create a Set from selectedRowKeys for efficient lookup
|
|
69
69
|
const selectedSet = new Set(selectedRowKeys);
|
|
70
70
|
// If exporting only selected rows, filter the dataSource accordingly; otherwise use the full dataSource
|
|
@@ -81,7 +81,10 @@ const TMDataGridExportForm = (props) => {
|
|
|
81
81
|
// Function to get the value for a column and its value in a row
|
|
82
82
|
const getValue = (col, value) => {
|
|
83
83
|
// Replace raw value with corresponding label from the map if applicable
|
|
84
|
-
let result =
|
|
84
|
+
let result = value;
|
|
85
|
+
if (exportDescriptionsForDataLists && col.caption && captions.has(col.caption.toString())) {
|
|
86
|
+
result = valueToNameMap.get(value) ?? value;
|
|
87
|
+
}
|
|
85
88
|
// If the column is a datetime type, attempt to format it as a locale date string
|
|
86
89
|
if (col.dataType === 'datetime' && result) {
|
|
87
90
|
const parsedDate = new Date(result);
|
|
@@ -28,7 +28,7 @@ const TMPathChooser = (props) => {
|
|
|
28
28
|
const [waitPanelTextSecondary, setWaitPanelTextSecondary] = useState('');
|
|
29
29
|
const [waitPanelValueSecondary, setWaitPanelValueSecondary] = useState(0);
|
|
30
30
|
const [waitPanelMaxValueSecondary, setWaitPanelMaxValueSecondary] = useState(0);
|
|
31
|
-
const formulaItems = ['{@JobName}', '{@JobStartDate}', '{@JobStartDateTime}', '{@ProcessRunID}', '{@ProcessName}', '{@ProcessStartDate}', '{@ProcessStartDateTime}'];
|
|
31
|
+
const formulaItems = ['{@JobName}', '{@JobStartDate}', '{@JobStartDate_DDMMYYYY}', '{@JobStartDateTime}', '{@ProcessRunID}', '{@ProcessName}', '{@ProcessStartDate}', '{@ProcessStartDateTime}'];
|
|
32
32
|
//useEffect(() => { setPath(props.value) }, [props.value])
|
|
33
33
|
useEffect(() => {
|
|
34
34
|
if (props.elementStyle) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { AccessLevels, AccessLevelsEx, AppModules, FileFormats, LayoutModes, SDK_Globals, DcmtTypeListCacheService, LicenseModuleStatus } from '@topconsultnpm/sdk-ts-beta';
|
|
3
|
-
import { IconActivity, IconArchiveDoc, IconBatchUpdate, IconCheckFile, IconCheckIn, IconCircleInfo, IconCloseCircle, IconConvertFilePdf, IconDelete, IconDotsVerticalCircleOutline, IconDownload, IconEdit, IconExportTo, IconFileDots, IconHide, IconInfo, IconMenuCAArchive, IconPlatform, IconPreview, IconRelation, IconSearch, IconShow,
|
|
3
|
+
import { IconActivity, IconArchiveDoc, IconBatchUpdate, IconCheckFile, IconCheckIn, IconCircleInfo, IconCloseCircle, IconConvertFilePdf, IconDelete, IconDotsVerticalCircleOutline, IconDownload, IconEdit, IconExportTo, IconFileDots, IconHide, IconInfo, IconMenuCAArchive, IconPlatform, IconPreview, IconRelation, IconSearch, IconShow, IconStar, IconSubstFile, IconUndo, IconUserGroupOutline, SDKUI_Localizator, svgToString, searchResultToMetadataValues, IconSignaturePencil } from '../../../helper';
|
|
4
4
|
import ShowAlert from '../../base/TMAlert';
|
|
5
5
|
import { TMMessageBoxManager, ButtonNames, TMExceptionBoxManager } from '../../base/TMPopUp';
|
|
6
6
|
import TMSpinner from '../../base/TMSpinner';
|
|
@@ -263,7 +263,7 @@ export const getCommandsMenuItems = (isMobile, dtd, selectedItems, focusedItem,
|
|
|
263
263
|
};
|
|
264
264
|
const signatureMenuItem = () => {
|
|
265
265
|
return {
|
|
266
|
-
icon: svgToString(_jsx(
|
|
266
|
+
icon: svgToString(_jsx(IconSignaturePencil, {})),
|
|
267
267
|
text: SDKUI_Localizator.Signature,
|
|
268
268
|
disabled: disabledForSingleRow(selectedItems, focusedItem) && disabledForMultiRow(selectedItems, focusedItem),
|
|
269
269
|
items: [
|
|
@@ -282,7 +282,7 @@ export const getCommandsMenuItems = (isMobile, dtd, selectedItems, focusedItem,
|
|
|
282
282
|
onClick: async () => { await runOperationAsync(getSelectedDcmtsOrFocused(selectedItems, focusedItem), DcmtOperationTypes.VerifySign); }
|
|
283
283
|
},
|
|
284
284
|
{
|
|
285
|
-
icon: svgToString(_jsx(
|
|
285
|
+
icon: svgToString(_jsx(IconSignaturePencil, {})),
|
|
286
286
|
operationType: 'singleRow',
|
|
287
287
|
disabled: disabledForSingleRow(selectedItems, focusedItem),
|
|
288
288
|
text: SDKUI_Localizator.Signature,
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
3
|
import { Priorities, ResultTypes, SDK_Globals, SDK_Localizator, TaskEngine, UserListCacheService, ValidationItem, WorkflowCacheService } from '@topconsultnpm/sdk-ts-beta';
|
|
4
4
|
import styled from "styled-components";
|
|
5
|
-
import { SDKUI_Localizator, IconApply, IconCloseOutline, IconUser, IconInfo,
|
|
5
|
+
import { SDKUI_Localizator, IconApply, IconCloseOutline, IconUser, IconInfo, DateDisplayTypes, TASK_MORE_INFO_PREFIX_NAME, IconSignaturePencil } from "../../../helper";
|
|
6
6
|
import { TMColors } from "../../../utils/theme";
|
|
7
7
|
import TMButton from "../../base/TMButton";
|
|
8
8
|
import { DeviceType } from "../../base/TMDeviceProvider";
|
|
@@ -67,7 +67,7 @@ const StyledHorizontalContainer = styled.div `
|
|
|
67
67
|
`;
|
|
68
68
|
export const WorkFlowOperationButtons = ({ deviceType = DeviceType.DESKTOP, approveDisable = false, signApproveDisable = false, reassignDisable = false, rejectDisable = false, infoDisable = false, onApprove, onSignApprove, onReAssign, onReject, onMoreInfo }) => {
|
|
69
69
|
const isMobile = deviceType === DeviceType.MOBILE;
|
|
70
|
-
return (_jsxs(StyledWorkFlowOperationButtonsContainer, { "$isMobile": isMobile, children: [_jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconApply, {}), caption: SDKUI_Localizator.Approve, disabled: approveDisable, onClick: () => !approveDisable && onApprove?.(), advancedColor: TMColors.success, color: 'success' }), _jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(
|
|
70
|
+
return (_jsxs(StyledWorkFlowOperationButtonsContainer, { "$isMobile": isMobile, children: [_jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconApply, {}), caption: SDKUI_Localizator.Approve, disabled: approveDisable, onClick: () => !approveDisable && onApprove?.(), advancedColor: TMColors.success, color: 'success' }), _jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconSignaturePencil, {}), caption: SDKUI_Localizator.SignatureAndApprove, width: '160px', disabled: signApproveDisable, onClick: () => !signApproveDisable && onSignApprove?.(), advancedColor: TMColors.success, color: 'success' }), _jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconCloseOutline, {}), caption: SDKUI_Localizator.Reject, disabled: rejectDisable, onClick: () => !rejectDisable && onReject?.(), advancedColor: TMColors.error, color: 'error' }), _jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconUser, { fontSize: 16 }), caption: SDKUI_Localizator.Reassign, disabled: reassignDisable, onClick: () => !reassignDisable && onReAssign?.(), advancedColor: TMColors.tertiary, color: 'tertiary' }), _jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconInfo, { fontSize: 16 }), caption: SDKUI_Localizator.MoreInformation, width: '180px', disabled: infoDisable, onClick: () => !infoDisable && onMoreInfo?.(), advancedColor: TMColors.info, color: 'info' })] }));
|
|
71
71
|
};
|
|
72
72
|
export const WorkFlowApproveRejectPopUp = ({ TID = 0, DID = 0, deviceType = DeviceType.DESKTOP, isReject, selectedItems = [], onClose, onCompleted }) => {
|
|
73
73
|
const [commentValue, setCommentValue] = useState('');
|
package/lib/helper/TMUtils.d.ts
CHANGED
|
@@ -5,6 +5,9 @@ export interface RowData {
|
|
|
5
5
|
[key: string]: string | number | null;
|
|
6
6
|
}
|
|
7
7
|
export declare const associateColumnsToRows: (columns: Array<DataColumnDescriptor> | undefined, rows: Array<Array<string>> | undefined) => Array<RowData>;
|
|
8
|
-
export declare const buildValueToLabelMapFromDataColumns: (columns: Array<DataColumnDescriptor>) => Promise<
|
|
8
|
+
export declare const buildValueToLabelMapFromDataColumns: (columns: Array<DataColumnDescriptor>) => Promise<{
|
|
9
|
+
valueToNameMap: Map<string, string>;
|
|
10
|
+
captions: Set<string>;
|
|
11
|
+
}>;
|
|
9
12
|
export declare const getAvatarColor: (name: string) => string;
|
|
10
13
|
export declare const extractInitialsFromName: (name: string) => string;
|
package/lib/helper/TMUtils.js
CHANGED
|
@@ -119,10 +119,14 @@ export const associateColumnsToRows = (columns, rows) => {
|
|
|
119
119
|
};
|
|
120
120
|
export const buildValueToLabelMapFromDataColumns = async (columns) => {
|
|
121
121
|
const valueToNameMap = new Map();
|
|
122
|
+
const captions = new Set();
|
|
122
123
|
for (const col of columns) {
|
|
123
124
|
const dataDomain = MetadataDataDomains[(col.extendedProperties?.["DataDomain"] ?? "None")];
|
|
124
125
|
const dataListID = Number(col.extendedProperties?.["DataListID"]);
|
|
125
126
|
if (dataDomain === MetadataDataDomains.DataList) {
|
|
127
|
+
if (col.caption) {
|
|
128
|
+
captions.add(col.caption);
|
|
129
|
+
}
|
|
126
130
|
const dl = await DataListCacheService.GetAsync(dataListID);
|
|
127
131
|
dl?.items?.forEach((item) => {
|
|
128
132
|
if (item?.name !== undefined && item?.value !== undefined) {
|
|
@@ -131,7 +135,7 @@ export const buildValueToLabelMapFromDataColumns = async (columns) => {
|
|
|
131
135
|
});
|
|
132
136
|
}
|
|
133
137
|
}
|
|
134
|
-
return valueToNameMap;
|
|
138
|
+
return { valueToNameMap, captions };
|
|
135
139
|
};
|
|
136
140
|
export const getAvatarColor = (name) => {
|
|
137
141
|
const colors = [
|