@topconsultnpm/sdkui-react 6.20.0-dev1.116 → 6.20.0-dev1.118
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 +2 -2
- package/lib/components/features/tasks/TMTaskForm.js +55 -24
- package/lib/components/features/tasks/TMTasksUtils.js +14 -1
- package/lib/components/layout/panelManager/TMPanelManagerContext.js +13 -5
- package/lib/helper/SDKUI_Localizator.d.ts +3 -0
- package/lib/helper/SDKUI_Localizator.js +30 -0
- package/package.json +1 -1
|
@@ -1530,8 +1530,8 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1530
1530
|
}, [onReferenceClick]);
|
|
1531
1531
|
// Mapping for objClass specific label/action. Easy to extend for future objClass types.
|
|
1532
1532
|
const referenceActionMap = useMemo(() => ({
|
|
1533
|
-
[ObjectClasses.Dossier]: { label:
|
|
1534
|
-
[ObjectClasses.WorkingGroup]: { label:
|
|
1533
|
+
[ObjectClasses.Dossier]: { label: SDKUI_Localizator.GoToDossier },
|
|
1534
|
+
[ObjectClasses.WorkingGroup]: { label: SDKUI_Localizator.GoToWorkgroup },
|
|
1535
1535
|
// add other ObjectClasses here as needed
|
|
1536
1536
|
}), []);
|
|
1537
1537
|
const renderDcmtForm = () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { ObjectClasses, TaskDescriptor, Priorities, PdGs, SDK_Globals, UserListCacheService, SDK_Localizator, Task_States } from '@topconsultnpm/sdk-ts';
|
|
4
4
|
import { areDifferentIDs, formatDate, getOriginLabel, getPriorityLocalizatorValue, getPriorityLocalizatorValues, getStatusLocalizatorValues, gotoPDGExtendedLabel, taskValidatorAsync } from './TMTasksUtils';
|
|
5
5
|
import ScrollView from 'devextreme-react/scroll-view';
|
|
@@ -21,6 +21,7 @@ import TMDcmtForm from '../documents/TMDcmtForm';
|
|
|
21
21
|
import styled from 'styled-components';
|
|
22
22
|
import { TMColors } from '../../../utils/theme';
|
|
23
23
|
import { renderContextBlock } from './TMTasksUtilsView';
|
|
24
|
+
import { DeviceType, useDeviceType } from '../../base/TMDeviceProvider';
|
|
24
25
|
const ResponseCommentWrapper = styled.div `
|
|
25
26
|
position: relative;
|
|
26
27
|
width: 100%;
|
|
@@ -105,6 +106,10 @@ const TMTaskForm = (props) => {
|
|
|
105
106
|
};
|
|
106
107
|
const { formData, setFormData, formDataOrig, validationItems, exception, saveDataAsync } = useSaveForm(formMode, id, sfo, validator, onSaved, onStatusChanged, customizeFormData);
|
|
107
108
|
const containerRef = useRef(null);
|
|
109
|
+
// Get the current device type (e.g., mobile, tablet, desktop) using a custom hook.
|
|
110
|
+
const deviceType = useDeviceType();
|
|
111
|
+
// This avoids unnecessary re-renders by only recalculating when deviceType changes.
|
|
112
|
+
let isMobileDevice = useMemo(() => { return deviceType === DeviceType.MOBILE; }, [deviceType]);
|
|
108
113
|
const [isMobile, setIsMobile] = useState(false);
|
|
109
114
|
const [showDcmtForm, setShowDcmtForm] = useState(false);
|
|
110
115
|
const mobileBreakpoint = 768;
|
|
@@ -374,29 +379,55 @@ const TMTaskForm = (props) => {
|
|
|
374
379
|
width: '100%',
|
|
375
380
|
gap: 16,
|
|
376
381
|
padding: '8px 0'
|
|
377
|
-
}, children: children })), children: _jsx("div", { style: {
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
382
|
+
}, children: children })), children: _jsx("div", { style: {
|
|
383
|
+
width: "100%",
|
|
384
|
+
display: 'flex',
|
|
385
|
+
alignItems: 'center',
|
|
386
|
+
justifyContent: 'center',
|
|
387
|
+
marginTop: 12
|
|
388
|
+
}, children: _jsxs("div", { onClick: () => formData.pdG !== PdGs.None ? gotoPDGExtendedLabelClickCallback() : null, style: {
|
|
389
|
+
backgroundColor: "#C2388B",
|
|
390
|
+
color: "#fff",
|
|
391
|
+
padding: "10px 16px",
|
|
392
|
+
borderRadius: "20px",
|
|
393
|
+
display: "flex",
|
|
394
|
+
alignItems: "center",
|
|
395
|
+
justifyContent: "space-between",
|
|
396
|
+
cursor: "pointer",
|
|
397
|
+
fontWeight: 500,
|
|
398
|
+
transition: "background-color 0.3s",
|
|
399
|
+
minWidth: "180px",
|
|
400
|
+
maxWidth: "100%",
|
|
401
|
+
flexWrap: "wrap",
|
|
402
|
+
gap: "8px",
|
|
403
|
+
}, onMouseEnter: e => {
|
|
404
|
+
if (formData.pdG !== PdGs.None)
|
|
405
|
+
e.currentTarget.style.backgroundColor = "#A12D78";
|
|
406
|
+
}, onMouseLeave: e => {
|
|
407
|
+
if (formData.pdG !== PdGs.None)
|
|
408
|
+
e.currentTarget.style.backgroundColor = "#C2388B";
|
|
409
|
+
}, children: [_jsxs("span", { style: {
|
|
410
|
+
flex: 1,
|
|
411
|
+
textAlign: "center",
|
|
412
|
+
gap: "6px",
|
|
413
|
+
display: "flex",
|
|
414
|
+
justifyContent: "center",
|
|
415
|
+
alignItems: "center",
|
|
416
|
+
}, children: [formData.pdG === PdGs.WG && _jsx("span", { children: SDKUI_Localizator.GoToWorkgroup }), formData.pdG === PdGs.CF && _jsx("span", { children: SDKUI_Localizator.GoToDossier }), formData.pdG === PdGs.DT && _jsx("span", { children: SDKUI_Localizator.GoToDocument }), (() => {
|
|
417
|
+
const originLabel = getOriginLabel(formData.pdG, formData.iD1Name);
|
|
418
|
+
if (!originLabel)
|
|
419
|
+
return null;
|
|
420
|
+
const maxLength = isMobileDevice ? 10 : 30;
|
|
421
|
+
const displayText = originLabel.length > maxLength
|
|
422
|
+
? originLabel.slice(0, maxLength) + "..."
|
|
423
|
+
: originLabel;
|
|
424
|
+
return _jsxs("span", { children: ["\u201C", displayText, "\u201D"] });
|
|
425
|
+
})()] }), _jsx(TMTooltip, { content: _jsxs("div", { style: { textAlign: "left" }, children: [formData.pdG && (_jsxs(_Fragment, { children: [_jsxs("div", { style: {
|
|
426
|
+
display: "flex",
|
|
427
|
+
alignItems: "center",
|
|
428
|
+
gap: "6px",
|
|
429
|
+
fontWeight: 600,
|
|
430
|
+
}, children: [_jsx("span", { style: { display: "flex", alignItems: "center" }, children: getPdgsIconMap().get(formData.pdG) }), _jsx("span", { children: formData.pdG === PdGs.WG ? SDKUI_Localizator.WorkGroup : formData.pdG === PdGs.CF ? SDKUI_Localizator.Dossier : formData.pdG === PdGs.DT ? SDKUI_Localizator.Document : "" })] }), _jsx("hr", { style: { margin: "4px 0 8px 0" } })] })), formData.iD1 != null && formData.iD1 !== 0 && (_jsxs("div", { children: [_jsx("b", { children: "TID" }), ": ", formData.iD1.toString()] })), formData.iD1Name && (_jsxs("div", { children: [_jsx("b", { children: "ID1NAME" }), ": ", formData.iD1Name.toString()] })), formData.iD2 != null && formData.iD2 !== 0 && (_jsxs("div", { children: [_jsx("b", { children: "DID" }), ": ", formData.iD2.toString()] }))] }), children: _jsx("i", { className: "dx-icon-info", style: { fontSize: "1.3rem", flexShrink: 0 } }) })] }) }) })), _jsx(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: 'flex', flexDirection: 'row', width: '100%', gap: 10 }, children: children }), children: _jsx("div", { style: { width: isMobile ? '100%' : '50%' }, children: _jsx(TMTextBox, { label: SDKUI_Localizator.Name, value: formData?.name ?? '', readOnly: fieldsReadOnly.name, autoFocus: true, maxLength: 100, isModifiedWhen: formData?.name !== formDataOrig?.name, onValueChanged: (e) => { setFormData({ ...formData ?? {}, name: e.target.value }); }, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.Name) }) }) }), _jsx("div", { style: { width: '100%' }, children: _jsx(TMTextArea, { label: SDKUI_Localizator.Description, value: formData?.description ?? '', maxLength: 200, readOnly: fieldsReadOnly.description, isModifiedWhen: formData?.description !== formDataOrig?.description, onValueChanged: (e) => { setFormData({ ...formData ?? {}, description: e.target.value }); }, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.Description), resize: false }) }), _jsx(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: 'flex', flexDirection: 'row', width: '100%', gap: 10 }, children: children }), children: (formMode === FormModes.Create || !areDifferentIDs(formDataOrig?.fromID, SDK_Globals.tmSession?.SessionDescr?.userID)) ?
|
|
400
431
|
_jsx("div", { id: "assignedToAnotherUserField", style: { width: isMobile ? '100%' : '50%' }, children: _jsx(TMUserChooser, { dataSource: usersList ?? undefined, allowShowAllUsers: !!taskContext?.dossier, allowMultipleSelection: false, label: SDKUI_Localizator.AssignedTo_Female, readOnly: fieldsReadOnly.assignedTO, values: formData?.toID ? [formData?.toID] : [], isModifiedWhen: formData?.toID !== formDataOrig?.toID, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.AssignedTo_Female), onValueChanged: (newValue) => {
|
|
401
432
|
if (newValue === undefined)
|
|
402
433
|
return;
|
|
@@ -297,7 +297,20 @@ newTasks // Array of new tasks to merge
|
|
|
297
297
|
return Array.from(taskMap.values());
|
|
298
298
|
};
|
|
299
299
|
export const getOriginLabel = (pdg, ID1Name) => {
|
|
300
|
-
|
|
300
|
+
let label = ID1Name ?? SDKUI_Localizator.NoSource;
|
|
301
|
+
try {
|
|
302
|
+
if (typeof label === 'string' && label.length > 0) {
|
|
303
|
+
// Rimuove: (TID: 123), (DID: 456), TID: 123, DID: 456
|
|
304
|
+
label = label.replace(/\s*\(\s*\b(?:TID|DID):\s*\d+\s*\)|\s*\b(?:TID|DID):\s*\d+/gi, '');
|
|
305
|
+
// Rimuove eventuali spazi multipli rimasti
|
|
306
|
+
label = label.replace(/\s{2,}/g, ' ').trim();
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
catch {
|
|
310
|
+
label = ID1Name ?? SDKUI_Localizator.NoSource;
|
|
311
|
+
}
|
|
312
|
+
// Se pdg esiste ritorna la label (anche se vuota), altrimenti ritorna sempre NoSource
|
|
313
|
+
return pdg ? label : SDKUI_Localizator.NoSource;
|
|
301
314
|
};
|
|
302
315
|
export const taskValidatorAsync = async (taskDescriptor) => {
|
|
303
316
|
let vil = [];
|
|
@@ -107,11 +107,19 @@ export const TMPanelManagerProvider = (props) => {
|
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
109
|
else {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
|
|
110
|
+
if (isPersistenceEnabled) {
|
|
111
|
+
// If persistence is enabled, visibility and dimensions are already synced from persisted state, so just set them directly
|
|
112
|
+
setPanelVisibility(initialVisibility);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
// If persistence is not enabled, recalculate visibility and dimensions based on the initial visibility, applying the hierarchy logic
|
|
116
|
+
let updated = { ...initialVisibility };
|
|
117
|
+
Object.entries(initialVisibility).forEach(([id, isVisible]) => {
|
|
118
|
+
updated = adjustPanelVisibilityAndSize(id, isVisible, updated);
|
|
119
|
+
});
|
|
120
|
+
// Update panel visibility state with recalculated values
|
|
121
|
+
setPanelVisibility(updated);
|
|
122
|
+
}
|
|
115
123
|
}
|
|
116
124
|
}, [isMobile]);
|
|
117
125
|
// Function to maximize a panel (and its parent panels)
|
|
@@ -302,7 +302,10 @@ export declare class SDKUI_Localizator {
|
|
|
302
302
|
static get GetFileUploadErrorMessage(): "Fehler beim Hochladen" | "Error during upload" | "Error al subir el archivo" | "Erreur lors du téléchargement" | "Erro ao carregar o arquivo" | "Errore nel caricamento";
|
|
303
303
|
static get GetFolderDeletionErrorMessage(): "Fehler beim Löschen des Ordners" | "Error deleting the folder" | "Error al eliminar la carpeta" | "Erreur lors de la suppression du dossier" | "Erro ao excluir a pasta" | "Errore nell'eliminazione della cartella";
|
|
304
304
|
static get GoTo(): "Gehe zu" | "Go to" | "Ir a" | "Aller à" | "Vai a";
|
|
305
|
+
static get GoToDocument(): "Gehe zum Dokument" | "Go to document" | "Ir al documento" | "Aller au document" | "Ir para documento" | "Vai a documento";
|
|
306
|
+
static get GoToDossier(): "Gehe zum übung" | "Go to dossier" | "Ir al expediente" | "Aller au pratique" | "Ir para prática" | "Vai a pratica";
|
|
305
307
|
static get GoToToday(): "Gehe zu heute" | "Go to today" | "Ir a hoy" | "Aller à aujourd'hui" | "Ir para hoje" | "Vai a oggi";
|
|
308
|
+
static get GoToWorkgroup(): "Gehe zur Arbeitsgruppe" | "Go to workgroup" | "Ir al grupo de trabajo" | "Aller au groupe de travail" | "Ir para grupo de trabalho" | "Vai a gruppo di lavoro";
|
|
306
309
|
static get Grids(): string;
|
|
307
310
|
static get Hide_CompleteName(): "Vollständigen Namen ausblenden" | "Hide full name" | "Ocultar nombre completo" | "Masquer le nom complet" | "Ocultar nome completo" | "Nascondi nome completo";
|
|
308
311
|
static get HideAll(): "Alle ausblenden" | "Hide all" | "Ocultar todo" | "Masquer tout" | "Ocultar tudo" | "Nascondi tutti";
|
|
@@ -2986,6 +2986,26 @@ export class SDKUI_Localizator {
|
|
|
2986
2986
|
default: return "Vai a";
|
|
2987
2987
|
}
|
|
2988
2988
|
}
|
|
2989
|
+
static get GoToDocument() {
|
|
2990
|
+
switch (this._cultureID) {
|
|
2991
|
+
case CultureIDs.De_DE: return "Gehe zum Dokument";
|
|
2992
|
+
case CultureIDs.En_US: return "Go to document";
|
|
2993
|
+
case CultureIDs.Es_ES: return "Ir al documento";
|
|
2994
|
+
case CultureIDs.Fr_FR: return "Aller au document";
|
|
2995
|
+
case CultureIDs.Pt_PT: return "Ir para documento";
|
|
2996
|
+
default: return "Vai a documento";
|
|
2997
|
+
}
|
|
2998
|
+
}
|
|
2999
|
+
static get GoToDossier() {
|
|
3000
|
+
switch (this._cultureID) {
|
|
3001
|
+
case CultureIDs.De_DE: return "Gehe zum übung";
|
|
3002
|
+
case CultureIDs.En_US: return "Go to dossier";
|
|
3003
|
+
case CultureIDs.Es_ES: return "Ir al expediente";
|
|
3004
|
+
case CultureIDs.Fr_FR: return "Aller au pratique";
|
|
3005
|
+
case CultureIDs.Pt_PT: return "Ir para prática";
|
|
3006
|
+
default: return "Vai a pratica";
|
|
3007
|
+
}
|
|
3008
|
+
}
|
|
2989
3009
|
static get GoToToday() {
|
|
2990
3010
|
switch (this._cultureID) {
|
|
2991
3011
|
case CultureIDs.De_DE: return "Gehe zu heute";
|
|
@@ -2996,6 +3016,16 @@ export class SDKUI_Localizator {
|
|
|
2996
3016
|
default: return "Vai a oggi";
|
|
2997
3017
|
}
|
|
2998
3018
|
}
|
|
3019
|
+
static get GoToWorkgroup() {
|
|
3020
|
+
switch (this._cultureID) {
|
|
3021
|
+
case CultureIDs.De_DE: return "Gehe zur Arbeitsgruppe";
|
|
3022
|
+
case CultureIDs.En_US: return "Go to workgroup";
|
|
3023
|
+
case CultureIDs.Es_ES: return "Ir al grupo de trabajo";
|
|
3024
|
+
case CultureIDs.Fr_FR: return "Aller au groupe de travail";
|
|
3025
|
+
case CultureIDs.Pt_PT: return "Ir para grupo de trabalho";
|
|
3026
|
+
default: return "Vai a gruppo di lavoro";
|
|
3027
|
+
}
|
|
3028
|
+
}
|
|
2999
3029
|
static get Grids() {
|
|
3000
3030
|
switch (this._cultureID) {
|
|
3001
3031
|
case CultureIDs.De_DE: return "Raster";
|