@topconsultnpm/sdkui-react 6.20.0-dev2.37 → 6.20.0-dev2.39
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/features/documents/TMDcmtForm.js +15 -1
- package/lib/components/features/tasks/TMTaskForm.js +2 -2
- package/lib/helper/helpers.d.ts +0 -2
- package/lib/helper/helpers.js +1 -20
- package/lib/hooks/useBetaFeatures.d.ts +1 -0
- package/lib/hooks/useBetaFeatures.js +41 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/package.json +1 -1
|
@@ -1846,7 +1846,21 @@ const TMDcmtFormActionButtons = (props) => {
|
|
|
1846
1846
|
alignItems: 'center',
|
|
1847
1847
|
gap: '10px'
|
|
1848
1848
|
}, children: [_jsx(TaskLink, { messagePrefix: `"${senderNameTruncated}" ti ha richiesto maggiori informazioni tramite l'attività`, name: currentTask.name ?? 'N/A', taskNameTrunc: taskNameTrunc ?? 'N/A', description: currentTask.description ?? 'N/A' }), _jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx("span", { className: "dx-icon-chat" }), caption: SDKUI_Localizator.CommentAndComplete, width: "180px", disabled: false, onClick: () => setShowCommentForm(true), onMouseDown: e => e.stopPropagation(), advancedColor: TMColors.success, color: "success" })] }))] }));
|
|
1849
|
-
})() }) })) : (_jsx("div", { style: {
|
|
1849
|
+
})() }) })) : (_jsx("div", { style: {
|
|
1850
|
+
padding: '10px',
|
|
1851
|
+
color: '#FFFFFF',
|
|
1852
|
+
maxWidth: '240px',
|
|
1853
|
+
background: 'linear-gradient(135deg, #1E90FF 0%, #0077BE 60%, #00509E 100%)',
|
|
1854
|
+
border: '1px solid rgba(255,255,255,0.15)',
|
|
1855
|
+
boxShadow: '0 8px 20px rgba(0, 0, 50, 0.4)',
|
|
1856
|
+
backdropFilter: 'blur(6px)',
|
|
1857
|
+
display: 'flex',
|
|
1858
|
+
flexDirection: 'column',
|
|
1859
|
+
alignItems: 'center',
|
|
1860
|
+
textAlign: 'center',
|
|
1861
|
+
gap: '10px',
|
|
1862
|
+
cursor: 'default',
|
|
1863
|
+
}, children: `Ci sono ${moreInfoTasks?.length ?? 0} richieste di maggiori informazioni. ${SDKUI_Localizator.ManageFromTaskPanel}` }))), hasMoreInfo && hasApprove && _jsx(Divider, {}), hasApprove && (workItems.length === 1 ?
|
|
1850
1864
|
_jsx(WorkFlowOperationButtons, { deviceType: deviceType, onApprove: () => setShowApprovePopup(true), onSignApprove: handleSignApprove, onReject: () => setShowRejectPopup(true), onReAssign: () => setShowReAssignPopup(true), onMoreInfo: () => setShowMoreInfoPopup(true), dtd: fromDTD })
|
|
1851
1865
|
:
|
|
1852
1866
|
_jsxs("div", { style: { padding: 10, color: 'white', maxWidth: '180px', borderRadius: 10, background: '#1B1464 0% 0% no-repeat padding-box', border: '1px solid #FFFFFF' }, children: [`Questo documento è associato a ${workItems.length} workitem.`, _jsx("br", {}), `Per approvare, vai alla pagina "Approvazione workflow".`] })), (hasApprove && hasReferences) || (hasMoreInfo && !hasApprove && hasReferences) ? (_jsx(Divider, {})) : null, hasReferences && (_jsx(ReferencesContainer, { children: dcmtReferences
|
|
@@ -7,7 +7,7 @@ import TMLayoutContainer from '../../base/TMLayout';
|
|
|
7
7
|
import { FormModes } from '../../../ts';
|
|
8
8
|
import { useWorkflowApprove } from '../../../hooks/useWorkflowApprove';
|
|
9
9
|
import { SaveFormOptions, useSaveForm } from '../../../hooks/useForm';
|
|
10
|
-
import { SDKUI_Localizator, calcIsModified, TMConditionalWrapper, getPdgsIconMap, DateDisplayTypes } from '../../../helper';
|
|
10
|
+
import { SDKUI_Localizator, calcIsModified, TMConditionalWrapper, getPdgsIconMap, DateDisplayTypes, getMoreInfoTasksForDocument } from '../../../helper';
|
|
11
11
|
import { TMExceptionBoxManager } from '../../base/TMPopUp';
|
|
12
12
|
import TMSpinner from '../../base/TMSpinner';
|
|
13
13
|
import TMTooltip from '../../base/TMTooltip';
|
|
@@ -437,6 +437,6 @@ const TMTaskForm = (props) => {
|
|
|
437
437
|
: _jsx(TMTextBox, { label: SDKUI_Localizator.Priority, value: getPriorityLocalizatorValue(formData?.priority ?? Priorities.Low), readOnly: true }) })] }) }), _jsx(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: 'flex', flexDirection: 'row', width: '100%', gap: 10 }, children: children }), children: _jsxs(_Fragment, { children: [_jsx("div", { style: { width: isMobile ? '100%' : '50%', marginTop: 10 }, children: !fieldsReadOnly.startDate ? _jsx(TMDateBox, { id: "start-date", resetTimeToZeroOnKeyPress: false, label: SDKUI_Localizator.StartDate, dateDisplayType: DateDisplayTypes.DateTime, value: formData?.startTime, isModifiedWhen: formData?.startTime !== formDataOrig?.startTime, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.ErrorStartEndDate), onContentReady: handleStartTimeContentReady, onValueChange: (value) => { setFormData({ ...formData ?? {}, startTime: value }); }, showClearButton: true }) : _jsx(TMTextBox, { label: SDKUI_Localizator.StartDate, value: formData?.startTime ? formatDate(formData?.startTime) : '', readOnly: true }) }), _jsx("div", { style: { width: isMobile ? '100%' : '50%', marginTop: 10 }, children: !fieldsReadOnly.startDate ? _jsx(TMDateBox, { id: "end-date", resetTimeToZeroOnKeyPress: false, label: SDKUI_Localizator.Expiration, dateDisplayType: DateDisplayTypes.DateTime, value: formData?.endTime, isModifiedWhen: formData?.endTime !== formDataOrig?.endTime, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.ErrorStartEndDate || o.PropertyName === SDKUI_Localizator.ErrorEndRemDate), onContentReady: handleEndTimeContentReady, onValueChange: (value) => { setFormData({ ...formData ?? {}, endTime: value }); }, showClearButton: true, readOnly: fieldsReadOnly.endDate }) : _jsx(TMTextBox, { label: SDKUI_Localizator.Expiration, value: formData?.endTime ? formatDate(formData?.endTime) : '', readOnly: true }) })] }) }), _jsx(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: 'flex', flexDirection: 'row', width: '100%', gap: 3 }, children: children }), children: _jsx("div", { style: { width: isMobile ? '100%' : '50%', marginTop: 10 }, children: _jsx(TMDateBox, { id: "alert-time", resetTimeToZeroOnKeyPress: false, label: SDKUI_Localizator.Reminder, dateDisplayType: DateDisplayTypes.DateTime, value: formData?.remTime ?? undefined, isModifiedWhen: formData?.remTime !== formDataOrig?.remTime, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.ErrorEndRemDate), onValueChange: (value) => { setFormData({ ...formData ?? {}, remTime: value }); }, showClearButton: true, readOnly: fieldsReadOnly.remTime }) }) }), (formData?.state && [Task_States.Completed, Task_States.Waiting, Task_States.Deferred].includes(formData?.state) ||
|
|
438
438
|
(formData?.response ?? "") !== "") && _jsx(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: 'flex', flexDirection: 'row', width: '100%', gap: 3 }, children: children }), children: _jsx("div", { style: { width: isMobile ? '100%' : '50%', marginTop: 10 }, children: _jsxs(ResponseCommentWrapper, { children: [_jsx(ResponseCommentTextArea, { id: "responseId", name: "response", "$isValid": true, value: formData?.response ?? '', onChange: onAnswerChange, "$isModifiedWhen": formData?.response !== formDataOrig?.response, disabled: (formData?.response ?? "") !== "" &&
|
|
439
439
|
(formData?.state && ![Task_States.Completed, Task_States.Waiting, Task_States.Deferred].includes(formData?.state)) }), _jsxs(ResponseCommentLabel, { htmlFor: "responseId", children: [SDKUI_Localizator.Answer, _jsxs(TMTooltip, { content: SDKUI_Localizator.AnswerTooltip, children: [" ", _jsx("i", { className: 'dx-icon-info' }), " "] })] }), _jsx(ResponseCommentCharacterCounter, { children: `${500 - (formData?.response ?? '').length} ${SDKUI_Localizator.CharactersRemaining}` })] }) }) })] }) }) }), (showDcmtForm && formData?.iD1 && formData?.iD2) &&
|
|
440
|
-
_jsx(TMDcmtForm, { titleModal: formData.iD1Name ?? '-', isModal: true, TID: formData.iD1, DID: formData.iD2, allowButtonsRefs: true, moreInfoTasks:
|
|
440
|
+
_jsx(TMDcmtForm, { titleModal: formData.iD1Name ?? '-', isModal: true, TID: formData.iD1, DID: formData.iD2, allowButtonsRefs: true, moreInfoTasks: getMoreInfoTasksForDocument(allTasks, formData?.iD1, formData?.iD2), onWFOperationCompleted: refreshWorkflowApprove, onTaskCompleted: onTaskCompleted, onClose: () => { setShowDcmtForm(false); }, onOpenS4TViewerRequest: onOpenS4TViewerRequest, s4TViewerDialogComponent: s4TViewerDialogComponent, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, onReferenceClick: handleNavigateToReference })] }) }) }));
|
|
441
441
|
};
|
|
442
442
|
export default TMTaskForm;
|
package/lib/helper/helpers.d.ts
CHANGED
|
@@ -15,8 +15,6 @@ declare const getColor: (color: ColorsType) => string;
|
|
|
15
15
|
* @returns {string} Un UUID in formato stringa.
|
|
16
16
|
*/
|
|
17
17
|
export declare const generateUUID: () => string;
|
|
18
|
-
/** Checks if beta features are enabled for a specific user and archive.*/
|
|
19
|
-
export declare const isBetaFeatureEnabled: (archiveId: string | undefined, userId: number | undefined) => boolean;
|
|
20
18
|
declare const makeID: (length: number) => string;
|
|
21
19
|
export declare const truncateText: (text: string, maxLength: number) => string;
|
|
22
20
|
declare function genUniqueId(): string;
|
package/lib/helper/helpers.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Colors } from "../utils/theme";
|
|
3
3
|
import { ButtonNames, DeviceType, TMExceptionBoxManager, TMMessageBoxManager, TMSpinner } from "../components";
|
|
4
|
-
import { AccessLevels,
|
|
4
|
+
import { AccessLevels, MetadataDataDomains, MetadataDataTypes, MetadataDescriptor, MetadataFormatDescriptor, MetadataFormats, MetadataPermission, SDK_Globals, SetGlobalsInfoAsync, SystemMIDs, SystemMIDsAsNumber, Task_States, TopMediaServer, WorkItemMetadataNames } from "@topconsultnpm/sdk-ts";
|
|
5
5
|
import { Buffer } from 'buffer';
|
|
6
6
|
import { buildTypes, FileExtensionHandler, FormModes, moduleTypes } from "../ts";
|
|
7
7
|
import { SDKUI_Localizator } from "./SDKUI_Localizator";
|
|
@@ -93,25 +93,6 @@ const getColor = (color) => {
|
|
|
93
93
|
export const generateUUID = () => {
|
|
94
94
|
return crypto.randomUUID();
|
|
95
95
|
};
|
|
96
|
-
/** Checks if beta features are enabled for a specific user and archive.*/
|
|
97
|
-
export const isBetaFeatureEnabled = (archiveId, userId) => {
|
|
98
|
-
if (!archiveId || !userId)
|
|
99
|
-
return false;
|
|
100
|
-
const localStorageKey = `FEATURES_${archiveId}_${userId}`;
|
|
101
|
-
let raw = LocalStorageService.getItem(localStorageKey);
|
|
102
|
-
if (typeof raw === 'string') {
|
|
103
|
-
try {
|
|
104
|
-
raw = JSON.parse(raw);
|
|
105
|
-
}
|
|
106
|
-
catch {
|
|
107
|
-
raw = null;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
if (raw && typeof raw === 'object' && 'devSettings' in raw) {
|
|
111
|
-
return raw.devSettings.betaFeatures === 1;
|
|
112
|
-
}
|
|
113
|
-
return false;
|
|
114
|
-
};
|
|
115
96
|
const makeID = (length) => {
|
|
116
97
|
let result = '';
|
|
117
98
|
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useBetaFeatures: () => boolean;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useEffect, useMemo } from 'react';
|
|
2
|
+
import { SDK_Globals } from '@topconsultnpm/sdk-ts';
|
|
3
|
+
import { SDKUI_Globals } from '../helper';
|
|
4
|
+
import { ShowAlert } from '../components';
|
|
5
|
+
export const useBetaFeatures = () => {
|
|
6
|
+
const tmSession = SDK_Globals.tmSession;
|
|
7
|
+
const archiveId = tmSession?.SessionDescr?.archiveID;
|
|
8
|
+
const userId = tmSession?.SessionDescr?.userID;
|
|
9
|
+
const isBetaFeaturesEnabled = useMemo(() => {
|
|
10
|
+
return SDKUI_Globals.userSettings.devSettings?.betaFeatures === 1;
|
|
11
|
+
}, [archiveId, userId]);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const handleBetaFeaturesShortcut = (e) => {
|
|
14
|
+
if (e.ctrlKey && e.altKey && e.key.toLowerCase() === 'y') {
|
|
15
|
+
e.preventDefault();
|
|
16
|
+
e.stopPropagation();
|
|
17
|
+
e.stopImmediatePropagation();
|
|
18
|
+
const currentValue = SDKUI_Globals.userSettings.devSettings?.betaFeatures;
|
|
19
|
+
const isCurrentlyEnabled = currentValue === 1;
|
|
20
|
+
if (isCurrentlyEnabled) {
|
|
21
|
+
SDKUI_Globals.userSettings.devSettings = undefined;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
SDKUI_Globals.userSettings.devSettings = { betaFeatures: 1 };
|
|
25
|
+
}
|
|
26
|
+
const status = isCurrentlyEnabled ? 'disabilitato' : 'abilitato';
|
|
27
|
+
ShowAlert({
|
|
28
|
+
message: `Beta features ${status}! Saranno ${status === 'abilitato' ? 'disponibili' : 'nascoste'} al prossimo login.`,
|
|
29
|
+
mode: 'info',
|
|
30
|
+
duration: 5000,
|
|
31
|
+
title: 'Beta Features'
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
globalThis.addEventListener('keydown', handleBetaFeaturesShortcut);
|
|
36
|
+
return () => {
|
|
37
|
+
globalThis.removeEventListener('keydown', handleBetaFeaturesShortcut);
|
|
38
|
+
};
|
|
39
|
+
}, []);
|
|
40
|
+
return isBetaFeaturesEnabled;
|
|
41
|
+
};
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -10,6 +10,7 @@ export * from './hooks/useResizeObserver';
|
|
|
10
10
|
export * from './hooks/useWorkflowApprove';
|
|
11
11
|
export * from './hooks/useRelatedDocuments';
|
|
12
12
|
export * from './hooks/useSettingsFeedback';
|
|
13
|
+
export * from './hooks/useBetaFeatures';
|
|
13
14
|
export * from './services';
|
|
14
15
|
import config from 'devextreme/core/config';
|
|
15
16
|
// DevExtreme License Key (valid for v25.2 and earlier versions)
|