@topconsultnpm/sdkui-react-beta 6.13.63 → 6.13.65

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.
@@ -26,6 +26,8 @@ export interface ITMHtmlEditor {
26
26
  isEditorEnabled?: boolean;
27
27
  /** Defines the toolbar layout mode (compact: Shows a minimal toolbar, expanded: Displays the full toolbar */
28
28
  toolbarMode?: 'compact' | 'expanded';
29
+ /** If true, the editor will be focused on mount */
30
+ autoFocus?: boolean;
29
31
  }
30
32
  declare const TMHtmlEditor: (props: ITMHtmlEditor) => import("react/jsx-runtime").JSX.Element;
31
33
  export default TMHtmlEditor;
@@ -4,7 +4,7 @@ import HtmlEditor, { Toolbar, Item } from 'devextreme-react/html-editor';
4
4
  import TMVilViewer from '../base/TMVilViewer';
5
5
  import { SDKUI_Localizator } from '../../helper';
6
6
  const TMHtmlEditor = (props) => {
7
- const { width = "100%", height = "100%", initialMarkup = "", mentionsConfig, onValueChanged, validationItems = [], isEditorEnabled: isEditorEnabledProp = false, toolbarMode = 'compact' } = props;
7
+ const { width = "100%", height = "100%", initialMarkup = "", mentionsConfig, onValueChanged, validationItems = [], isEditorEnabled: isEditorEnabledProp = false, toolbarMode = 'compact', autoFocus = false } = props;
8
8
  // Ref for HtmlEditor instance
9
9
  const editorRef = useRef(null);
10
10
  // State for editor enable/disable
@@ -27,6 +27,15 @@ const TMHtmlEditor = (props) => {
27
27
  onValueChanged({ value: text });
28
28
  }
29
29
  };
30
+ // Focuses the HtmlEditor when the component mounts, if autoFocus is enabled
31
+ useEffect(() => {
32
+ if (autoFocus && editorRef.current?.instance) {
33
+ // Delay to ensure DOM is ready
34
+ setTimeout(() => {
35
+ editorRef.current?.instance().focus();
36
+ }, 500);
37
+ }
38
+ }, [autoFocus]);
30
39
  // Memoized check for validation errors
31
40
  const hasValidationErrors = useMemo(() => {
32
41
  return validationItems && validationItems.length > 0;
@@ -23,6 +23,7 @@ interface ITMDcmtFormProps {
23
23
  canNext?: boolean;
24
24
  canPrev?: boolean;
25
25
  isClosable?: boolean;
26
+ groupId?: string;
26
27
  onNext?: () => void;
27
28
  onPrev?: () => void;
28
29
  onClose?: () => void;
@@ -2,20 +2,19 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
2
2
  import { useEffect, useMemo, useState } from 'react';
3
3
  import styled, { keyframes } from 'styled-components';
4
4
  import TMDcmtPreview from './TMDcmtPreview';
5
- import { AccessLevels, ArchiveConstraints, ArchiveEngineByID, DcmtTypeListCacheService, LayoutModes, MetadataDataTypes, ResultTypes, SDK_Globals, SystemMIDsAsNumber, TemplateTIDs, UpdateEngineByID, ValidationItem } from '@topconsultnpm/sdk-ts-beta';
5
+ import { AccessLevels, ArchiveConstraints, ArchiveEngineByID, DcmtTypeListCacheService, LayoutModes, MetadataDataTypes, ResultTypes, SDK_Globals, SDK_Localizator, SystemMIDsAsNumber, TemplateTIDs, UpdateEngineByID, ValidationItem } from '@topconsultnpm/sdk-ts-beta';
6
6
  import { ContextMenu } from 'devextreme-react';
7
7
  import { WorkFlowApproveRejectPopUp, WorkFlowOperationButtons, WorkFlowReAssignPopUp } from '../workflow/TMWorkflowPopup';
8
8
  import { DownloadTypes, FormModes } from '../../../ts';
9
9
  import { DeviceType, useDeviceType } from '../../base/TMDeviceProvider';
10
10
  import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
11
11
  import { handleArchiveVisibility, searchResultToMetadataValues } from '../../../helper/queryHelper';
12
- import { genUniqueId, IconShow, SDKUI_Localizator, IconBoard, IconDcmtTypeSys, IconDetailDcmts, svgToString, IconDownload, calcIsModified, IconMenuVertical, Globalization, getListMaxItems, getSystemMetadata, IconBoxArchiveIn, IconClear, IconUndo, SDKUI_Globals, IconRoundFileUpload, IconArrowLeft, IconPreview } from '../../../helper';
12
+ import { genUniqueId, IconShow, SDKUI_Localizator, IconBoard, IconDcmtTypeSys, IconDetailDcmts, svgToString, IconDownload, calcIsModified, IconMenuVertical, Globalization, getListMaxItems, getSystemMetadata, IconBoxArchiveIn, IconClear, IconUndo, SDKUI_Globals, IconPreview } from '../../../helper';
13
13
  import { hasDetailRelations, hasMasterRelations, isXMLFileExt } from '../../../helper/dcmtsHelper';
14
14
  import { TMColors } from '../../../utils/theme';
15
15
  import { StyledFormButtonsContainer, StyledModalContainer, StyledToolbarCardContainer } from '../../base/Styled';
16
16
  import ShowAlert from '../../base/TMAlert';
17
17
  import TMButton from '../../base/TMButton';
18
- import { TMSplitterLayout, TMLayoutItem } from '../../base/TMLayout';
19
18
  import { TMExceptionBoxManager, TMMessageBoxManager, ButtonNames } from '../../base/TMPopUp';
20
19
  import TMSpinner from '../../base/TMSpinner';
21
20
  import { TMLayoutWaitingContainer } from '../../base/TMWaitPanel';
@@ -29,12 +28,12 @@ import TMMasterDetailDcmts from './TMMasterDetailDcmts';
29
28
  import TMDcmtBlog from './TMDcmtBlog';
30
29
  import { useInputAttachmentsDialog } from '../../../hooks/useInputDialog';
31
30
  import TMModal from '../../base/TMModal';
32
- import TMPanel from '../../base/TMPanel';
33
- import TMCommandsPanel from '../../sidebar/TMCommandsPanel';
34
31
  import toppy from '../../../assets/Toppy-generico.png';
32
+ import { TMPanelManagerProvider, useTMPanelManagerContext } from '../../layout/panelManager/TMPanelManagerContext';
33
+ import TMPanelManagerContainer from '../../layout/panelManager/TMPanelManagerContainer';
35
34
  let abortControllerLocal = new AbortController();
36
35
  //#endregion
37
- const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes.Update, onClose, onSavedAsyncCallback, TID, DID, formMode = FormModes.Update, canNext, canPrev, count, itemIndex, onNext, onPrev, customRightSidebarItems = [], allowNavigation = true, allowRelations = true, isClosable = false, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, showDcmtForm = true, showDcmtFormSidebar = true, showPreview = false, showBoard = false, showSysMetadata = false, onClosePreviewPanel, onCloseBlogPanel, onCloseSysMetadataPanel, titleModal, isModal = false, widthModal = "100%", heightModal = "100%" }) => {
36
+ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes.Update, onClose, onSavedAsyncCallback, TID, DID, formMode = FormModes.Update, canNext, canPrev, count, itemIndex, onNext, onPrev, customRightSidebarItems = [], allowNavigation = true, allowRelations = true, isClosable = false, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, showDcmtForm = true, showDcmtFormSidebar = true, showPreview = false, showBoard = false, showSysMetadata = false, onClosePreviewPanel, onCloseBlogPanel, onCloseSysMetadataPanel, titleModal, isModal = false, widthModal = "100%", heightModal = "100%", groupId }) => {
38
37
  const mruTIDs = SDKUI_Globals.userSettings.archivingSettings.mruTIDs;
39
38
  const [id, setID] = useState('');
40
39
  const [showWaitPanelLocal, setShowWaitPanelLocal] = useState(false);
@@ -75,7 +74,6 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
75
74
  const { openConfirmAttachmentsDialog, ConfirmAttachmentsDialog } = useInputAttachmentsDialog();
76
75
  const { abortController, showWaitPanel, waitPanelTitle, showPrimary, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, downloadDcmtsAsync } = useDcmtOperations();
77
76
  const deviceType = useDeviceType();
78
- const isOpenMiddlePanel = () => isOpenSysMetadata || isOpenBoard || isOpenTags || isOpenFormulaEditor;
79
77
  const retrieveMetadataAsync = async () => {
80
78
  try {
81
79
  await DcmtTypeListCacheService.GetAsync(TID).then(async (dtd) => {
@@ -138,62 +136,7 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
138
136
  setFocusedMetadataValue(undefined);
139
137
  }, [fromDTD, layoutMode]);
140
138
  const fileIsNotValid = (fromDTD?.archiveConstraint === ArchiveConstraints.ContentCompulsory && !dcmtFile);
141
- const fileManagerIcon = useMemo(() => {
142
- if (layoutMode === LayoutModes.Ark) {
143
- return _jsx(IconRoundFileUpload, { color: fileIsNotValid ? TMColors.error : undefined });
144
- }
145
- return _jsx(IconShow, {});
146
- }, [layoutMode, fileIsNotValid]);
147
- const closeMiddlePanel = () => {
148
- if (isOpenSysMetadata)
149
- onCloseSysMetadataPanel?.();
150
- if (isOpenBoard)
151
- onCloseBlogPanel?.();
152
- setIsOpenBoard(false);
153
- setIsOpenSysMetadata(false);
154
- setIsOpenTags(false);
155
- setIsOpenFormulaEditor(false);
156
- };
157
- const titleText = () => {
158
- if (isOpenTags)
159
- return 'Tags';
160
- if (isOpenSysMetadata)
161
- return 'Metadati di sistema';
162
- if (isOpenBoard)
163
- return 'Bacheca';
164
- if (isOpenFormulaEditor)
165
- return `${SDKUI_Localizator.FormulaEditorTitle} (${focusedMetadataValue?.md?.nameLoc})`;
166
- return '';
167
- };
168
139
  const middlePanelToolbar = _jsxs("div", { style: { width: 'max-content', display: 'flex', alignItems: 'center', gap: '10px' }, children: [layoutMode === LayoutModes.Update && _jsx(TMSaveFormButtonPrevious, { btnStyle: 'icon', isModified: false, formMode: FormModes.ReadOnly, canPrev: canPrev, onPrev: () => onPrev?.() }), layoutMode === LayoutModes.Update && _jsx(TMSaveFormButtonNext, { btnStyle: 'icon', isModified: false, formMode: FormModes.ReadOnly, canNext: canNext, onNext: () => onNext?.() })] });
169
- const getPrimarySplitterStartLayout = () => {
170
- let size = isOpenDcmtForm ? ['100%', '0'] : ['0%', '100%'];
171
- if (deviceType !== DeviceType.MOBILE) {
172
- if (isOpenPreview || isOpenMiddlePanel()) {
173
- if (layoutMode === LayoutModes.Ark) {
174
- size = ['50%', '50%'];
175
- }
176
- else if (isOpenDcmtForm) {
177
- size = ['50%', '50%'];
178
- }
179
- else
180
- size = ['0%', '100%'];
181
- }
182
- }
183
- else {
184
- size = (isOpenPreview || isOpenMiddlePanel()) ? ['0', '100%'] : ['100%', '0'];
185
- }
186
- return size;
187
- };
188
- const getSecondarySplitterStartLayout = () => {
189
- if (isOpenPreview && !isOpenMiddlePanel()) {
190
- return ['0', '100%'];
191
- }
192
- if (!isOpenPreview && isOpenMiddlePanel()) {
193
- return ['100%', '0'];
194
- }
195
- return ['40%', '60%'];
196
- };
197
140
  const getSelectionDcmtInfo = () => {
198
141
  let dcmts = [];
199
142
  dcmts.push({ TID: TID ?? 0, DID: DID ?? 0 });
@@ -206,12 +149,22 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
206
149
  const handleRemoveItem = (tid, did) => {
207
150
  setSecondaryMasterDcmts((prevItems) => prevItems.filter(item => item.TID !== tid && item.DID !== did));
208
151
  };
152
+ const isPreviewDisabled = layoutMode === LayoutModes.Ark && fromDTD?.archiveConstraint === ArchiveConstraints.OnlyMetadata;
153
+ const isBoardDisabled = layoutMode !== LayoutModes.Update;
154
+ const isSysMetadataDisabled = layoutMode !== LayoutModes.Update;
155
+ const isDetailsDisabled = layoutMode !== LayoutModes.Update || !DID;
156
+ const isMasterDisabled = layoutMode !== LayoutModes.Update || !DID;
209
157
  const getDcmts = () => { return [{ TID: currentDcmt?.tid, DID: currentDcmt?.did, FILEEXT: currentDcmt?.fileExt }]; };
210
158
  const commandsMenuItems = [
211
159
  { icon: svgToString(_jsx(IconDownload, {})), operationType: 'singleRow', disabled: fromDTD?.perm?.canRetrieveFile !== AccessLevels.Yes, text: "Download file", onClick: async () => await downloadDcmtsAsync(getDcmts(), DownloadTypes.Dcmt) },
212
160
  { icon: svgToString(_jsx(IconDownload, {})), operationType: 'singleRow', disabled: !isXMLFileExt(currentDcmt?.fileExt), text: "Download allegati XML", onClick: async () => await downloadDcmtsAsync(getDcmts(), DownloadTypes.Attachment, openConfirmAttachmentsDialog) },
161
+ ...(allowRelations && currentTIDHasMasterRelations ? [{ icon: svgToString(_jsx(IconDetailDcmts, { transform: 'scale(-1, 1)' })), operationType: 'singleRow', disabled: isMasterDisabled, text: SDKUI_Localizator.DcmtsMaster, onClick: () => { if (!isMasterDisabled)
162
+ setIsOpenMaster(!isOpenMaster); } }] : []),
163
+ ...(allowRelations && currentTIDHasDetailRelations ? [{ icon: svgToString(_jsx(IconDetailDcmts, {})), operationType: 'singleRow', disabled: isDetailsDisabled, text: SDKUI_Localizator.DcmtsDetail, onClick: () => { if (!isDetailsDisabled)
164
+ setIsOpenDetails(!isOpenDetails); } }] : []),
165
+ // ...customRightSidebarItems
213
166
  ];
214
- const formToolbar = _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '10px' }, children: [canPrev != undefined && _jsx("p", { style: { textAlign: 'center', padding: '1px 4px', display: 'flex' }, children: `${itemIndex}/${count}` }), canPrev != undefined && _jsx(TMSaveFormButtonPrevious, { btnStyle: 'icon', iconColor: 'white', isModified: calcIsModified(formData, formDataOrig), formMode: formMode, canPrev: canPrev, onPrev: onPrev }), canNext != undefined && _jsx(TMSaveFormButtonNext, { btnStyle: 'icon', iconColor: 'white', isModified: calcIsModified(formData, formDataOrig), formMode: formMode, canNext: canNext, onNext: onNext }), layoutMode === LayoutModes.Update && _jsx(IconMenuVertical, { id: `commands-detail-${id}`, color: 'white', cursor: 'pointer' }), layoutMode === LayoutModes.Update && _jsx(ContextMenu, { showEvent: 'click', dataSource: commandsMenuItems, target: `#commands-detail-${id}` })] });
167
+ const formToolbar = _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '10px' }, children: [allowNavigation && canPrev != undefined && _jsx("p", { style: { textAlign: 'center', padding: '1px 4px', display: 'flex' }, children: `${itemIndex}/${count}` }), allowNavigation && canPrev != undefined && _jsx(TMSaveFormButtonPrevious, { btnStyle: 'icon', iconColor: 'white', isModified: calcIsModified(formData, formDataOrig), formMode: formMode, canPrev: canPrev, onPrev: onPrev }), allowNavigation && canNext != undefined && _jsx(TMSaveFormButtonNext, { btnStyle: 'icon', iconColor: 'white', isModified: calcIsModified(formData, formDataOrig), formMode: formMode, canNext: canNext, onNext: onNext }), layoutMode === LayoutModes.Update && _jsx(IconMenuVertical, { id: `commands-detail-${id}`, color: 'white', cursor: 'pointer' }), layoutMode === LayoutModes.Update && _jsx(ContextMenu, { showEvent: 'click', dataSource: commandsMenuItems, target: `#commands-detail-${id}` })] });
215
168
  function createChange(mid, metadataType, modifiedValue) {
216
169
  return { mid, metadataType, modifiedValue };
217
170
  }
@@ -432,6 +385,28 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
432
385
  const metadataValuesSourceOrig = useMemo(() => {
433
386
  return showAll ? formDataOrig.filter(o => o.mid && o.mid > 100) : formDataOrig.filter(o => o.mid && o.mid > 100).slice(0, listMaxItems);
434
387
  }, [showAll, formDataOrig]);
388
+ const handleClose = () => {
389
+ if (!isModified) {
390
+ onClose?.();
391
+ return;
392
+ }
393
+ TMMessageBoxManager.show({
394
+ parentId: isModal ? "TMDcmtFormShowConfirmForClose-" + id : undefined,
395
+ message: SDKUI_Localizator.SaveQuestion, buttons: [ButtonNames.YES, ButtonNames.NO, ButtonNames.CANCEL],
396
+ onButtonClick: async (e) => {
397
+ try {
398
+ if (e == ButtonNames.CANCEL)
399
+ return;
400
+ if (e == ButtonNames.YES)
401
+ await onSavedAsync?.();
402
+ onClose?.();
403
+ }
404
+ catch (ex) {
405
+ TMExceptionBoxManager.show({ exception: ex });
406
+ }
407
+ }
408
+ });
409
+ };
435
410
  const getFormula = () => {
436
411
  let fd = new FormulaDescriptor();
437
412
  fd.expression = FormulaHelper.isFormula(focusedMetadataValue?.value) ? FormulaHelper.removeFormulaTag(focusedMetadataValue?.value) : undefined;
@@ -441,11 +416,101 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
441
416
  fd.tid = TID;
442
417
  return fd;
443
418
  };
444
- const isPreviewDisabled = layoutMode === LayoutModes.Ark && fromDTD?.archiveConstraint === ArchiveConstraints.OnlyMetadata;
445
- const isBoardDisabled = layoutMode !== LayoutModes.Update;
446
- const isSysMetadataDisabled = layoutMode !== LayoutModes.Update;
447
- const isDetailsDisabled = layoutMode !== LayoutModes.Update || !DID;
448
- const isMasterDisabled = layoutMode !== LayoutModes.Update || !DID;
419
+ const isMobile = deviceType === DeviceType.MOBILE;
420
+ const tmDcmtForm = useMemo(() => _jsx(_Fragment, { children: metadataValuesSource.length > 0 &&
421
+ _jsxs(StyledToolbarCardContainer, { children: [_jsx(TMMetadataValues, { TID: TID, metadataValues: metadataValuesSource, metadataValuesOrig: metadataValuesSourceOrig, isExpertMode: isExpertMode, isOpenDistinctValues: isOpenDistinctValues, openChooserBySingleClick: !isOpenDistinctValues, selectedMID: focusedMetadataValue?.mid, layoutMode: layoutMode, deviceType: deviceType, validationItems: validationItems, onFocusedItemChanged: (item) => { (item?.mid !== focusedMetadataValue?.mid) && setFocusedMetadataValue(item); }, onValueChanged: (newItems) => {
422
+ setFormData((prevItems) => prevItems.map((item) => {
423
+ const newItem = newItems.find((newItem) => newItem.tid === item.tid && newItem.mid === item.mid);
424
+ return newItem ? { ...item, ...newItem } : item;
425
+ }));
426
+ }, onAdvancedMenuClick: (e) => {
427
+ switch (e.button) {
428
+ case AdvancedMenuButtons.DistinctValues:
429
+ setIsOpenDistinctValues(!isOpenDistinctValues);
430
+ break;
431
+ case AdvancedMenuButtons.FormulaEditor:
432
+ setIsOpenFormulaEditor(!isOpenFormulaEditor);
433
+ break;
434
+ }
435
+ } }), _jsxs(StyledFormButtonsContainer, { children: [_jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: 10 }, children: _jsx("div", { style: { display: 'flex', justifyContent: 'center', alignItems: 'center', gap: '8px' }, children: layoutMode === LayoutModes.Update ? _jsxs(_Fragment, { children: [_jsx(TMSaveFormButtonSave, { showTooltip: false, btnStyle: 'advanced', advancedColor: '#f09c0a', isModified: isModified, formMode: formMode, errorsCount: validationItems.filter(o => o.ResultType == ResultTypes.ERROR).length, onSaveAsync: confirmActionPopup }), _jsx(TMSaveFormButtonUndo, { btnStyle: 'toolbar', showTooltip: true, color: 'primary', isModified: isModified, formMode: formMode, onUndo: onUndoHandler })] }) :
436
+ _jsxs(_Fragment, { children: [_jsx(TMButton, { disabled: archiveBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconBoxArchiveIn, {}), width: 'auto', showTooltip: false, caption: SDKUI_Localizator.Archive, advancedColor: TMColors.success, onClick: confirmActionPopup }), _jsx(TMButton, { disabled: !clearFormBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconClear, {}), width: 'auto', showTooltip: false, caption: SDKUI_Localizator.Clear, advancedColor: TMColors.tertiary, onClick: clearFormHandler }), DID && _jsx(TMButton, { disabled: undoBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconUndo, {}), width: '150px', showTooltip: false, caption: SDKUI_Localizator.Undo, advancedColor: TMColors.tertiary, onClick: onUndoHandler })] }) }) }), totalItems > listMaxItems && _jsx(TMShowAllOrMaxItemsButton, { showAll: showAll, dataSourceLength: totalItems, onClick: () => { setShowAll(!showAll); } })] }), showApprovePopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, TID: TID, DID: DID, op: 0, onClose: () => setShowApprovePopup(false) }), showRejectPopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, TID: TID, DID: DID, op: 1, onClose: () => setShowRejectPopup(false) }), showReAssignPopup && _jsx(WorkFlowReAssignPopUp, { deviceType: deviceType, TID: TID, DID: DID, onClose: () => setShowReAssignPopup(false) }), _jsx(ConfirmAttachmentsDialog, {})] }) }), [TID, DID, formData, formDataOrig, focusedMetadataValue, isOpenDistinctValues, isOpenFormulaEditor, validationItems, showAll]);
437
+ const tmBlog = useMemo(() => _jsx(TMDcmtBlog, { tid: TID, did: DID }), [TID, DID]);
438
+ const tmSysMetadata = useMemo(() => _jsx(TMMetadataValues, { layoutMode: layoutMode, openChooserBySingleClick: !isOpenDistinctValues, TID: TID, isReadOnly: true, deviceType: deviceType, metadataValues: formData.filter(o => (o.mid != undefined && o.mid <= 100)), metadataValuesOrig: formData.filter(o => (o.mid != undefined && o.mid <= 100)), validationItems: [] }), [TID, formData, deviceType]);
439
+ const tmDcmtPreview = useMemo(() => _jsx(TMDcmtPreviewWrapper, { currentDcmt: currentDcmt, dcmtFile: dcmtFile, deviceType: deviceType, fromDTD: fromDTD, layoutMode: layoutMode, onFileUpload: (setFile) => {
440
+ setDcmtFile(setFile);
441
+ } }), [currentDcmt]);
442
+ const allInitialPanelVisibility = {
443
+ 'tmDcmtForm': true,
444
+ 'tmBlog': false,
445
+ 'tmSysMetadata': false,
446
+ 'tmDcmtPreview': true,
447
+ };
448
+ const initialPanelDimensions = {
449
+ 'tmDcmtForm': { width: '25%', height: '100%' },
450
+ 'tmBlog': { width: '25%', height: '100%' },
451
+ 'tmSysMetadata': { width: '25%', height: '100%' },
452
+ 'tmDcmtPreview': { width: '25%', height: '100%' },
453
+ };
454
+ const initialPanels = useMemo(() => [
455
+ {
456
+ id: 'tmDcmtForm',
457
+ name: SDK_Localizator.Metadatas,
458
+ contentOptions: {
459
+ component: tmDcmtForm,
460
+ isClosable: isClosable,
461
+ panelContainer: {
462
+ showHeader: showHeader,
463
+ title: fromDTD?.nameLoc,
464
+ allowMaximize: !isMobile,
465
+ onBack: (isClosable && deviceType !== DeviceType.MOBILE) ? undefined : handleClose,
466
+ onClose: isClosable ? () => setIsOpenDcmtForm(false) : undefined,
467
+ toolbar: allowNavigation ? formToolbar : _jsx(_Fragment, {})
468
+ },
469
+ },
470
+ toolbarOptions: {
471
+ icon: _jsx(IconPreview, { fontSize: 24 }),
472
+ visible: true,
473
+ orderNumber: 1,
474
+ isActive: allInitialPanelVisibility['tmDcmtForm']
475
+ }
476
+ },
477
+ {
478
+ id: 'tmBlog',
479
+ name: SDKUI_Localizator.BlogCase,
480
+ contentOptions: { component: tmBlog, panelContainer: { title: SDKUI_Localizator.BlogCase, allowMaximize: !isMobile } },
481
+ toolbarOptions: { icon: _jsx(IconBoard, { fontSize: 24 }), visible: true, disabled: isBoardDisabled, orderNumber: 2, isActive: allInitialPanelVisibility['tmBlog'] }
482
+ },
483
+ {
484
+ id: 'tmSysMetadata',
485
+ name: SDKUI_Localizator.MetadataSystem,
486
+ contentOptions: { component: tmSysMetadata, panelContainer: { title: SDKUI_Localizator.MetadataSystem, allowMaximize: !isMobile } },
487
+ toolbarOptions: { icon: _jsx(IconDcmtTypeSys, { fontSize: 24 }), visible: true, disabled: isSysMetadataDisabled, orderNumber: 3, isActive: allInitialPanelVisibility['tmSysMetadata'] }
488
+ },
489
+ {
490
+ id: 'tmDcmtPreview',
491
+ name: SDKUI_Localizator.PreviewDocument,
492
+ contentOptions: { component: tmDcmtPreview },
493
+ toolbarOptions: { icon: _jsx(IconShow, { fontSize: 24 }), disabled: isPreviewDisabled, visible: true, orderNumber: 4, isActive: allInitialPanelVisibility['tmDcmtPreview'] }
494
+ }
495
+ ], [tmDcmtForm, tmBlog, tmSysMetadata, tmDcmtPreview, isPreviewDisabled, isBoardDisabled, isSysMetadataDisabled, isClosable]);
496
+ // {showDcmtFormSidebar && <TMCommandsPanel
497
+ // isMobile={deviceType === DeviceType.MOBILE}
498
+ // items={[
499
+ // ...(layoutMode === LayoutModes.Ark ? [
500
+ // { icon: <IconRoundFileUpload />, selected: isOpenPreview, disabled: isPreviewDisabled, onClick: () => { if (!isPreviewDisabled) setIsOpenPreview(!isOpenPreview); } }
501
+ // ] : []),
502
+ // ...(layoutMode !== LayoutModes.Ark ? [
503
+ // ...(deviceType === DeviceType.MOBILE ? [{ icon: <IconArrowLeft />, onClick: isClosable ? undefined : handleClose }] : []),
504
+ // { icon: <IconPreview />, selected: isOpenDcmtForm, onClick: () => { setIsOpenDcmtForm(!isOpenDcmtForm); } },
505
+ // { icon: <IconShow />, selected: isOpenPreview, disabled: isPreviewDisabled, onClick: () => { if (!isPreviewDisabled) setIsOpenPreview(!isOpenPreview); } },
506
+ // { icon: <IconBoard />, selected: isOpenBoard, disabled: isBoardDisabled, onClick: () => { if (!isBoardDisabled) { closeMiddlePanel(); setIsOpenBoard(!isOpenBoard); } } },
507
+ // { icon: <IconDcmtTypeSys />, selected: isOpenSysMetadata, disabled: isSysMetadataDisabled, onClick: () => { if (!isSysMetadataDisabled) { closeMiddlePanel(); setIsOpenSysMetadata(!isOpenSysMetadata); } } },
508
+ // ] : []),
509
+ // ...(allowRelations && currentTIDHasMasterRelations ? [{ icon: <IconDetailDcmts />, selected: isOpenMaster, disabled: isMasterDisabled, onClick: () => { if (!isMasterDisabled) setIsOpenMaster(!isOpenMaster); } }] : []),
510
+ // ...(allowRelations && currentTIDHasDetailRelations ? [{ icon: <IconDetailDcmts transform='scale(-1, 1)' />, selected: isOpenDetails, disabled: isDetailsDisabled, onClick: () => { if (!isDetailsDisabled) setIsOpenDetails(!isOpenDetails); } }] : []),
511
+ // ...customRightSidebarItems
512
+ // ]}
513
+ // />}
449
514
  const renderDcmtForm = () => {
450
515
  return (_jsxs("div", { style: {
451
516
  display: 'flex',
@@ -454,70 +519,24 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
454
519
  gap: SDKUI_Globals.userSettings.themeSettings.gutters,
455
520
  width: '100%',
456
521
  height: '100%',
457
- }, children: [_jsx("div", { style: { flex: 1, minWidth: 0, height: '100%' }, children: _jsxs(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: useWaitPanelLocalState ? showWaitPanelLocal : showWaitPanel, showWaitPanelPrimary: useWaitPanelLocalState ? showPrimaryLocal : showPrimary, showWaitPanelSecondary: useWaitPanelLocalState ? showSecondaryLocal : showSecondary, waitPanelTitle: useWaitPanelLocalState ? waitPanelTitleLocal : waitPanelTitle, waitPanelTextPrimary: useWaitPanelLocalState ? waitPanelTextPrimaryLocal : waitPanelTextPrimary, waitPanelValuePrimary: useWaitPanelLocalState ? waitPanelValuePrimaryLocal : waitPanelValuePrimary, waitPanelMaxValuePrimary: useWaitPanelLocalState ? waitPanelMaxValuePrimaryLocal : waitPanelMaxValuePrimary, waitPanelTextSecondary: useWaitPanelLocalState ? waitPanelTextSecondaryLocal : waitPanelTextSecondary, waitPanelValueSecondary: useWaitPanelLocalState ? waitPanelValueSecondaryLocal : waitPanelValueSecondary, waitPanelMaxValueSecondary: useWaitPanelLocalState ? waitPanelMaxValueSecondaryLocal : waitPanelMaxValueSecondary, isCancelable: useWaitPanelLocalState ? dcmtFile ? dcmtFile.size >= 1000000 : false : true, abortController: useWaitPanelLocalState ? abortControllerLocal : abortController, children: [_jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: 'visible', separatorSize: SDKUI_Globals.userSettings.themeSettings.gutters, separatorColor: 'transparent', showSeparator: (isOpenPreview || isOpenMiddlePanel()) && deviceType !== DeviceType.MOBILE && isOpenDcmtForm, start: getPrimarySplitterStartLayout(), min: deviceType !== DeviceType.MOBILE && isOpenDcmtForm ? ['150px', '0'] : ['0', '0'], children: [_jsx(TMLayoutItem, { children: _jsx(TMPanel, { showHeader: showHeader, title: fromDTD?.nameLoc, toolbar: allowNavigation ? formToolbar : _jsx(_Fragment, {}), onBack: (isClosable && deviceType !== DeviceType.MOBILE) ? undefined : handleClose, onClose: isClosable ? () => setIsOpenDcmtForm(false) : undefined, children: metadataValuesSource.length > 0 &&
458
- _jsxs(StyledToolbarCardContainer, { children: [_jsx(TMMetadataValues, { TID: TID, metadataValues: metadataValuesSource, metadataValuesOrig: metadataValuesSourceOrig, isExpertMode: isExpertMode, isOpenDistinctValues: isOpenDistinctValues, openChooserBySingleClick: !isOpenDistinctValues, selectedMID: focusedMetadataValue?.mid, layoutMode: layoutMode, deviceType: deviceType, validationItems: validationItems, onFocusedItemChanged: (item) => { (item?.mid !== focusedMetadataValue?.mid) && setFocusedMetadataValue(item); }, onValueChanged: (newItems) => {
459
- setFormData((prevItems) => prevItems.map((item) => {
460
- const newItem = newItems.find((newItem) => newItem.tid === item.tid && newItem.mid === item.mid);
461
- return newItem ? { ...item, ...newItem } : item;
462
- }));
463
- }, onAdvancedMenuClick: (e) => {
464
- switch (e.button) {
465
- case AdvancedMenuButtons.DistinctValues:
466
- setIsOpenDistinctValues(!isOpenDistinctValues);
467
- break;
468
- case AdvancedMenuButtons.FormulaEditor:
469
- setIsOpenFormulaEditor(!isOpenFormulaEditor);
470
- break;
471
- }
472
- } }), _jsxs(StyledFormButtonsContainer, { children: [_jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: 10 }, children: _jsx("div", { style: { display: 'flex', justifyContent: 'center', alignItems: 'center', gap: '8px' }, children: layoutMode === LayoutModes.Update ? _jsxs(_Fragment, { children: [_jsx(TMSaveFormButtonSave, { showTooltip: false, btnStyle: 'advanced', advancedColor: '#f09c0a', isModified: isModified, formMode: formMode, errorsCount: validationItems.filter(o => o.ResultType == ResultTypes.ERROR).length, onSaveAsync: confirmActionPopup }), _jsx(TMSaveFormButtonUndo, { btnStyle: 'toolbar', showTooltip: true, color: 'primary', isModified: isModified, formMode: formMode, onUndo: onUndoHandler })] }) :
473
- _jsxs(_Fragment, { children: [_jsx(TMButton, { disabled: archiveBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconBoxArchiveIn, {}), width: 'auto', showTooltip: false, caption: SDKUI_Localizator.Archive, advancedColor: TMColors.success, onClick: confirmActionPopup }), _jsx(TMButton, { disabled: !clearFormBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconClear, {}), width: 'auto', showTooltip: false, caption: SDKUI_Localizator.Clear, advancedColor: TMColors.tertiary, onClick: clearFormHandler }), DID && _jsx(TMButton, { disabled: undoBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconUndo, {}), width: '150px', showTooltip: false, caption: SDKUI_Localizator.Undo, advancedColor: TMColors.tertiary, onClick: onUndoHandler })] }) }) }), totalItems > listMaxItems && _jsx(TMShowAllOrMaxItemsButton, { showAll: showAll, dataSourceLength: totalItems, onClick: () => { setShowAll(!showAll); } })] }), showApprovePopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, TID: TID, DID: DID, op: 0, onClose: () => setShowApprovePopup(false) }), showRejectPopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, TID: TID, DID: DID, op: 1, onClose: () => setShowRejectPopup(false) }), showReAssignPopup && _jsx(WorkFlowReAssignPopUp, { deviceType: deviceType, TID: TID, DID: DID, onClose: () => setShowReAssignPopup(false) }), _jsx(ConfirmAttachmentsDialog, {})] }) }) }), isOpenPreview || isOpenMiddlePanel() ?
474
- _jsx(TMLayoutItem, { children: _jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: 'visible', separatorSize: SDKUI_Globals.userSettings.themeSettings.gutters, showSeparator: deviceType !== DeviceType.MOBILE && (isOpenPreview && isOpenMiddlePanel()), start: getSecondarySplitterStartLayout(), min: ['0', '0'], separatorColor: 'transparent', children: [isOpenMiddlePanel()
475
- ? _jsx(TMLayoutItem, { children: _jsxs(TMPanel, { showHeader: !(isOpenDetails && layoutMode === LayoutModes.Update), title: titleText(), onClose: () => { closeMiddlePanel(); }, children: [isOpenBoard && layoutMode === LayoutModes.Update &&
476
- _jsx(TMDcmtBlog, { tid: TID, did: DID }), isOpenSysMetadata && layoutMode === LayoutModes.Update &&
477
- _jsx(TMMetadataValues, { layoutMode: layoutMode, openChooserBySingleClick: !isOpenDistinctValues, TID: TID, isReadOnly: true, deviceType: deviceType, metadataValues: formData.filter(o => (o.mid != undefined && o.mid <= 100)), metadataValuesOrig: formData.filter(o => (o.mid != undefined && o.mid <= 100)), validationItems: [] }), isOpenFormulaEditor &&
478
- _jsx(TMFormulaEditor, { isModal: false, formMode: FormModes.Update, inputData: getFormula(), showBack: false, onClose: () => setIsOpenFormulaEditor(false), onApplied: (newFormula) => {
479
- setFormData((prevItems) => prevItems.map((item) => item.tid == newFormula.tid && item.mid === newFormula.mid ? { ...item, value: FormulaHelper.addFormulaTag(newFormula.expression), isSelected: true, isEditable: true } : item));
480
- setFocusedMetadataValue(prevState => ({
481
- ...prevState,
482
- isSelected: true,
483
- isEditable: true,
484
- value: FormulaHelper.addFormulaTag(newFormula.expression)
485
- }));
486
- } })] }) })
487
- : _jsx(_Fragment, {}), isOpenPreview
488
- ? _jsxs(TMLayoutItem, { children: [layoutMode === LayoutModes.Update ?
489
- _jsx(TMDcmtPreview, { onClosePanel: () => { setIsOpenPreview(false); onClosePreviewPanel?.(); }, dcmtData: currentDcmt }) :
490
- _jsx(TMFileUploader, { onFileUpload: (file) => setDcmtFile(file), onClose: () => setIsOpenPreview(false), isRequired: fromDTD?.archiveConstraint === ArchiveConstraints.ContentCompulsory && dcmtFile === null, defaultBlob: dcmtFile, deviceType: deviceType }), " "] })
491
- : _jsx(_Fragment, {})] }) }) : _jsx(_Fragment, {})] }), isOpenDistinctValues &&
492
- _jsx(TMDistinctValues, { tid: TID, mid: focusedMetadataValue?.mid, isModal: true, showHeader: false, layoutMode: layoutMode, onSelectionChanged: (e) => {
493
- if (!e)
494
- return;
495
- setFormData((prevItems) => prevItems.map((item) => item.tid == e.tid && item.mid === e.mid ? { ...item, value: e.newValue } : item));
496
- } }), (isModal && onClose) && _jsx("div", { id: "TMDcmtFormShowConfirmForClose-" + id })] }) }), showDcmtFormSidebar && _jsx(TMCommandsPanel, { isMobile: deviceType === DeviceType.MOBILE, items: [
497
- ...(layoutMode === LayoutModes.Ark ? [
498
- { icon: _jsx(IconRoundFileUpload, {}), selected: isOpenPreview, disabled: isPreviewDisabled, onClick: () => { if (!isPreviewDisabled)
499
- setIsOpenPreview(!isOpenPreview); } }
500
- ] : []),
501
- ...(layoutMode !== LayoutModes.Ark ? [
502
- ...(deviceType === DeviceType.MOBILE ? [{ icon: _jsx(IconArrowLeft, {}), onClick: isClosable ? undefined : handleClose }] : []),
503
- { icon: _jsx(IconPreview, {}), selected: isOpenDcmtForm, onClick: () => { setIsOpenDcmtForm(!isOpenDcmtForm); } },
504
- { icon: _jsx(IconShow, {}), selected: isOpenPreview, disabled: isPreviewDisabled, onClick: () => { if (!isPreviewDisabled)
505
- setIsOpenPreview(!isOpenPreview); } },
506
- { icon: _jsx(IconBoard, {}), selected: isOpenBoard, disabled: isBoardDisabled, onClick: () => { if (!isBoardDisabled) {
507
- closeMiddlePanel();
508
- setIsOpenBoard(!isOpenBoard);
509
- } } },
510
- { icon: _jsx(IconDcmtTypeSys, {}), selected: isOpenSysMetadata, disabled: isSysMetadataDisabled, onClick: () => { if (!isSysMetadataDisabled) {
511
- closeMiddlePanel();
512
- setIsOpenSysMetadata(!isOpenSysMetadata);
513
- } } },
514
- ] : []),
515
- ...(allowRelations && currentTIDHasMasterRelations ? [{ icon: _jsx(IconDetailDcmts, {}), selected: isOpenMaster, disabled: isMasterDisabled, onClick: () => { if (!isMasterDisabled)
516
- setIsOpenMaster(!isOpenMaster); } }] : []),
517
- ...(allowRelations && currentTIDHasDetailRelations ? [{ icon: _jsx(IconDetailDcmts, { transform: 'scale(-1, 1)' }), selected: isOpenDetails, disabled: isDetailsDisabled, onClick: () => { if (!isDetailsDisabled)
518
- setIsOpenDetails(!isOpenDetails); } }] : []),
519
- ...customRightSidebarItems
520
- ] }), (fromDTD?.templateTID === TemplateTIDs.WF_WIApprView && !isOpenDetails && !isOpenMaster) &&
522
+ }, children: [_jsxs(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: useWaitPanelLocalState ? showWaitPanelLocal : showWaitPanel, showWaitPanelPrimary: useWaitPanelLocalState ? showPrimaryLocal : showPrimary, showWaitPanelSecondary: useWaitPanelLocalState ? showSecondaryLocal : showSecondary, waitPanelTitle: useWaitPanelLocalState ? waitPanelTitleLocal : waitPanelTitle, waitPanelTextPrimary: useWaitPanelLocalState ? waitPanelTextPrimaryLocal : waitPanelTextPrimary, waitPanelValuePrimary: useWaitPanelLocalState ? waitPanelValuePrimaryLocal : waitPanelValuePrimary, waitPanelMaxValuePrimary: useWaitPanelLocalState ? waitPanelMaxValuePrimaryLocal : waitPanelMaxValuePrimary, waitPanelTextSecondary: useWaitPanelLocalState ? waitPanelTextSecondaryLocal : waitPanelTextSecondary, waitPanelValueSecondary: useWaitPanelLocalState ? waitPanelValueSecondaryLocal : waitPanelValueSecondary, waitPanelMaxValueSecondary: useWaitPanelLocalState ? waitPanelMaxValueSecondaryLocal : waitPanelMaxValueSecondary, isCancelable: useWaitPanelLocalState ? dcmtFile ? dcmtFile.size >= 1000000 : false : true, abortController: useWaitPanelLocalState ? abortControllerLocal : abortController, children: [(groupId && groupId.length > 0) ?
523
+ _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showDcmtFormSidebar })
524
+ :
525
+ _jsx(TMPanelManagerProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, initialDimensions: initialPanelDimensions, initialMobilePanelId: 'tmDcmtForm', children: _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showDcmtFormSidebar }) }), isOpenDistinctValues &&
526
+ _jsx(TMDistinctValues, { tid: TID, mid: focusedMetadataValue?.mid, isModal: true, showHeader: false, layoutMode: layoutMode, onSelectionChanged: (e) => {
527
+ if (!e)
528
+ return;
529
+ setFormData((prevItems) => prevItems.map((item) => item.tid == e.tid && item.mid === e.mid ? { ...item, value: e.newValue } : item));
530
+ } }), isOpenFormulaEditor &&
531
+ _jsx(TMFormulaEditor, { isModal: true, formMode: FormModes.Update, inputData: getFormula(), showBack: false, onClose: () => setIsOpenFormulaEditor(false), onApplied: (newFormula) => {
532
+ setFormData((prevItems) => prevItems.map((item) => item.tid == newFormula.tid && item.mid === newFormula.mid ? { ...item, value: FormulaHelper.addFormulaTag(newFormula.expression), isSelected: true, isEditable: true } : item));
533
+ setFocusedMetadataValue(prevState => ({
534
+ ...prevState,
535
+ isSelected: true,
536
+ isEditable: true,
537
+ value: FormulaHelper.addFormulaTag(newFormula.expression)
538
+ }));
539
+ } }), (isModal && onClose) && _jsx("div", { id: "TMDcmtFormShowConfirmForClose-" + id })] }), (fromDTD?.templateTID === TemplateTIDs.WF_WIApprView && !isOpenDetails && !isOpenMaster) &&
521
540
  _jsx(ToppyHelpCenter, { deviceType: deviceType,
522
541
  // onClick={() => isMobile ? openConfigureMode?.() : undefined}
523
542
  content: _jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: _jsx(WorkFlowOperationButtons, { onApprove: () => setShowApprovePopup(true), onReject: () => setShowRejectPopup(true), onReAssign: () => setShowReAssignPopup(true), isInDcmtForm: deviceType === DeviceType.MOBILE }) }) }), isOpenDetails &&
@@ -526,28 +545,6 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
526
545
  return (_jsx(StyledModalContainer, { style: { backgroundColor: 'white' }, children: _jsx(TMMasterDetailDcmts, { deviceType: deviceType, inputDcmts: [dcmt], isForMaster: true, allowNavigation: false, onBack: () => handleRemoveItem(dcmt.TID, dcmt.DID), appendMasterDcmts: handleAddItem }) }, `${index}-${dcmt.DID}`));
527
546
  })] })] }));
528
547
  };
529
- const handleClose = () => {
530
- if (!isModified) {
531
- onClose?.();
532
- return;
533
- }
534
- TMMessageBoxManager.show({
535
- parentId: isModal ? "TMDcmtFormShowConfirmForClose-" + id : undefined,
536
- message: SDKUI_Localizator.SaveQuestion, buttons: [ButtonNames.YES, ButtonNames.NO, ButtonNames.CANCEL],
537
- onButtonClick: async (e) => {
538
- try {
539
- if (e == ButtonNames.CANCEL)
540
- return;
541
- if (e == ButtonNames.YES)
542
- await onSavedAsync?.();
543
- onClose?.();
544
- }
545
- catch (ex) {
546
- TMExceptionBoxManager.show({ exception: ex });
547
- }
548
- }
549
- });
550
- };
551
548
  return (_jsx(_Fragment, { children: (isModal && onClose) ? _jsx(_Fragment, { children: _jsx(TMModal, { title: titleModal, onClose: handleClose, width: widthModal ?? '100%', height: heightModal ?? '100%', hidePopup: false, askClosingConfirm: true, children: _jsx("div", { style: { width: "100%", height: "100%", display: 'block', padding: "4px" }, children: renderDcmtForm() }) }) })
552
549
  : renderDcmtForm() }));
553
550
  };
@@ -607,3 +604,9 @@ const ToppyImage = styled.img `
607
604
  export const ToppyHelpCenter = ({ content, onClick, deviceType, top = -200 }) => {
608
605
  return (_jsxs(ToppyContainer, { children: [_jsx(ToppyImage, { "$isMobile": deviceType === DeviceType.MOBILE, onClick: onClick, src: toppy, alt: "Toppy" }), _jsx("div", { style: { top: deviceType === DeviceType.MOBILE ? -180 : top, right: deviceType === DeviceType.MOBILE ? 20 : 1, transform: 'rotate(20deg)', position: 'absolute', width: 'max-content', height: 'max-content' }, children: content })] }));
609
606
  };
607
+ const TMDcmtPreviewWrapper = ({ currentDcmt, layoutMode, fromDTD, dcmtFile, deviceType, onFileUpload }) => {
608
+ const { setPanelVisibilityById, toggleMaximize, isResizingActive } = useTMPanelManagerContext();
609
+ return (layoutMode === LayoutModes.Update ?
610
+ _jsx(TMDcmtPreview, { onClosePanel: () => setPanelVisibilityById('tmDcmtPreview', false), onMaximizePanel: () => toggleMaximize('tmDcmtPreview'), dcmtData: currentDcmt, isResizingActive: isResizingActive }) :
611
+ _jsx(TMFileUploader, { onFileUpload: onFileUpload, onClose: () => setPanelVisibilityById('tmDcmtPreview', false), isRequired: fromDTD?.archiveConstraint === ArchiveConstraints.ContentCompulsory && dcmtFile === null, defaultBlob: dcmtFile, deviceType: deviceType, isResizingActive: isResizingActive }));
612
+ };
@@ -4,6 +4,7 @@ interface ITMDcmtPreviewProps {
4
4
  dcmtData: ITMDcmt | undefined;
5
5
  canNext?: boolean;
6
6
  canPrev?: boolean;
7
+ isResizingActive?: boolean;
7
8
  onNext?: () => void;
8
9
  onPrev?: () => void;
9
10
  onClosePanel?: () => void;
@@ -13,6 +14,7 @@ declare const TMDcmtPreview: React.FC<ITMDcmtPreviewProps>;
13
14
  export default TMDcmtPreview;
14
15
  interface ITMFileViewerProps {
15
16
  fileBlob?: Blob;
17
+ isResizingActive?: boolean;
16
18
  }
17
19
  export declare const TMFileViewer: React.FC<ITMFileViewerProps>;
18
20
  export declare const TMNothingToShow: ({ text, secondText, fileExt, icon }: {
@@ -15,7 +15,7 @@ import { TMSaveFormButtonPrevious, TMSaveFormButtonNext } from '../../forms/TMSa
15
15
  import { StyledAnimatedComponentOpacity } from '../../base/Styled';
16
16
  import TMPanel from '../../base/TMPanel';
17
17
  import { DeviceType, useDeviceType } from '../../base/TMDeviceProvider';
18
- const TMDcmtPreview = ({ dcmtData, onClosePanel, canNext, canPrev, onNext, onPrev, onMaximizePanel }) => {
18
+ const TMDcmtPreview = ({ dcmtData, isResizingActive, onClosePanel, canNext, canPrev, onNext, onPrev, onMaximizePanel }) => {
19
19
  const [dcmtBlob, setDcmtBlob] = useState(undefined);
20
20
  const [showPreview, setShowPreview] = useState(false);
21
21
  const [isFromCache, setIsFromCache] = useState(false);
@@ -92,10 +92,10 @@ const TMDcmtPreview = ({ dcmtData, onClosePanel, canNext, canPrev, onNext, onPre
92
92
  { icon: _jsx(IconClear, {}), text: "Cancella la cache", onClick: () => { clearDcmtsFileCache(); setIsFromCache(false); } },
93
93
  ] }, "btn13") })] }), children: error
94
94
  ? _jsx(TMNothingToShow, { icon: _jsx(IconCloseOutline, { fontSize: 92, color: TMColors.error }), text: error })
95
- : renderedPreview(dcmtData?.tid, dcmtData?.did, dcmtData?.fileExt, dcmtData?.fileSize, dcmtData?.fileCount, extensionHandler(dcmtData?.fileExt), showPreview, () => { loadDocumentWithCache(); setShowPreview(true); }, dcmtBlob) }) }));
95
+ : renderedPreview(dcmtData?.tid, dcmtData?.did, dcmtData?.fileExt, dcmtData?.fileSize, dcmtData?.fileCount, extensionHandler(dcmtData?.fileExt), showPreview, isResizingActive, () => { loadDocumentWithCache(); setShowPreview(true); }, dcmtBlob) }) }));
96
96
  };
97
97
  export default TMDcmtPreview;
98
- export const TMFileViewer = ({ fileBlob }) => {
98
+ export const TMFileViewer = ({ fileBlob, isResizingActive }) => {
99
99
  const [blobUrl, setBlobUrl] = useState(undefined);
100
100
  const [fileType, setFileType] = useState(undefined);
101
101
  const [formattedXml, setFormattedXml] = useState(undefined);
@@ -134,7 +134,7 @@ export const TMFileViewer = ({ fileBlob }) => {
134
134
  if (fileBlob.type.includes('image')) {
135
135
  return (_jsx(ImageViewer, { fileBlob: fileBlob, alt: '' }));
136
136
  }
137
- return (_jsx("iframe", { srcDoc: fileType?.includes("xml") && formattedXml ? `<html><body>${formattedXml}</body></html>` : undefined, src: !fileType?.includes("xml") || !formattedXml ? blobUrl : undefined, title: "File Viewer", width: "100%", height: "100%", style: { border: 'none', zIndex: 0 } }));
137
+ return (_jsx("iframe", { srcDoc: fileType?.includes("xml") && formattedXml ? `<html><body>${formattedXml}</body></html>` : undefined, src: !fileType?.includes("xml") || !formattedXml ? blobUrl : undefined, title: "File Viewer", width: "100%", height: "100%", style: { border: 'none', zIndex: 0, pointerEvents: isResizingActive === true ? "none" : "auto" } }));
138
138
  };
139
139
  const ImageViewer = ({ fileBlob, alt = 'Image', className }) => {
140
140
  const containerRef = useRef(null);
@@ -317,7 +317,7 @@ const ImageViewer = ({ fileBlob, alt = 'Image', className }) => {
317
317
  export const TMNothingToShow = ({ text = '', secondText, fileExt, icon = _jsx(IconPreview, { fontSize: 96 }) }) => {
318
318
  return (_jsx(StyledAnimatedComponentOpacity, { style: { width: '100%', height: '100%' }, children: _jsxs(StyledPanelStatusContainer, { children: [icon, _jsxs(StyledPreviewNotAvailable, { children: [text && _jsx("div", { children: text }), _jsxs("div", { children: [" ", secondText ?? 'Anteprima non disponibile.', fileExt && _jsx("b", { children: ` (*.${fileExt})` })] })] })] }) }));
319
319
  };
320
- const renderedPreview = (tid, did, fileExt, fileSize, fileCount, extHandler, showPreview, onDownloadShowPreviewClick, dcmtBlob) => {
320
+ const renderedPreview = (tid, did, fileExt, fileSize, fileCount, extHandler, showPreview, isResizingActive, onDownloadShowPreviewClick, dcmtBlob) => {
321
321
  if (!did)
322
322
  return _jsx(TMNothingToShow, { text: 'Nessun documento selezionato.' });
323
323
  if (fileCount == 0) {
@@ -327,7 +327,7 @@ const renderedPreview = (tid, did, fileExt, fileSize, fileCount, extHandler, sho
327
327
  return _jsx(TMNothingToShow, { fileExt: fileExt });
328
328
  }
329
329
  if (showPreview) {
330
- return (_jsx(StyledPreviewContainer, { style: { overflow: 'auto' }, children: _jsx(TMFileViewer, { fileBlob: dcmtBlob }) }));
330
+ return (_jsx(StyledPreviewContainer, { style: { overflow: 'auto' }, children: _jsx(TMFileViewer, { fileBlob: dcmtBlob, isResizingActive: isResizingActive }) }));
331
331
  }
332
332
  return (_jsx(StyledAnimatedComponentOpacity, { style: { width: '100%', height: '100%' }, children: _jsxs(StyledPanelStatusContainer, { children: [_jsx(IconPreview, { fontSize: 96 }), _jsxs("p", { children: [" La dimensione del file \u00E8 ", _jsx("strong", { children: formatBytes(fileSize) }), ". Visualizzare l'anteprima? "] }), _jsx(TMButton, { caption: "Si", onClick: onDownloadShowPreviewClick, showTooltip: false })] }) }));
333
333
  };
@@ -6,6 +6,7 @@ interface ITMFileUploader {
6
6
  isRequired?: boolean;
7
7
  defaultBlob?: File | null;
8
8
  deviceType?: DeviceType;
9
+ isResizingActive?: boolean;
9
10
  }
10
11
  declare const TMFileUploader: React.FC<ITMFileUploader>;
11
12
  export default TMFileUploader;
@@ -10,7 +10,7 @@ import { DeviceType } from '../../base/TMDeviceProvider';
10
10
  import TMTooltip from '../../base/TMTooltip';
11
11
  import { TMFileViewer, StyledHeaderIcon } from './TMDcmtPreview';
12
12
  import TMPanel from '../../base/TMPanel';
13
- const TMFileUploader = ({ deviceType = DeviceType.DESKTOP, onClose, onFileUpload, isRequired = false, defaultBlob = null }) => {
13
+ const TMFileUploader = ({ deviceType = DeviceType.DESKTOP, onClose, onFileUpload, isRequired = false, defaultBlob = null, isResizingActive }) => {
14
14
  const [dragOver, setDragOver] = useState(false);
15
15
  const [uploadedFile, setUploadedFile] = useState(defaultBlob);
16
16
  const [fileName, setFileName] = useState('');
@@ -71,7 +71,7 @@ const TMFileUploader = ({ deviceType = DeviceType.DESKTOP, onClose, onFileUpload
71
71
  };
72
72
  let content = !uploadedFile ?
73
73
  _jsx("div", { style: { display: 'flex', gap: 10, width: '100%', height: '100%' }, children: _jsxs(UploadContainer, { ref: uploaderRef, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, style: { backgroundColor: dragOver ? '#76b1e6' : 'white' }, onDoubleClick: browseHandler, "$isRequired": isRequired, children: [_jsx("div", { style: { display: 'flex', gap: '10px', flexDirection: 'column', position: 'absolute', right: 5, top: 5 }, children: _jsx(TMButton, { btnStyle: 'icon', caption: 'Sfoglia', color: isRequired && !uploadedFile ? 'error' : 'primary', onClick: browseHandler, icon: _jsx(IconFolderOpen, { fontSize: 22 }) }) }), _jsx("p", { style: { fontSize: '1.2rem', fontWeight: 'bold' }, children: deviceType === DeviceType.MOBILE ? 'Clicca per sfogliare il tuo file' : 'Trascina il tuo file qui o fai doppio click per sfogliarlo' }), isRequired && _jsxs("p", { style: { fontWeight: 'bold' }, children: [" ", SDKUI_Localizator.RequiredField, " "] })] }) }) :
74
- _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 10, width: '100%', height: '100%' }, children: [_jsxs("div", { style: { backgroundColor: 'white', padding: '5px 10px', borderRadius: 8, display: 'flex', alignItems: 'center', justifyContent: 'space-between', color: TMColors.primaryColor }, children: [_jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 5 }, children: [_jsx("p", { children: "File name:" }), _jsxs("div", { style: { fontWeight: 'bold' }, children: [fileName, " ", _jsxs("span", { children: [" ", ` (${formatBytes(fileSize)})`, " "] })] })] }), uploadedFile && _jsx(TMButton, { btnStyle: 'icon', color: 'error', caption: 'Pulisci', onClick: clearFile, icon: _jsx(IconClear, { fontSize: 22 }) })] }), extensionHandler(fileExt) === FileExtensionHandler.READY_TO_SHOW ? _jsx(TMFileViewer, { fileBlob: uploadedFile }) :
74
+ _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 10, width: '100%', height: '100%' }, children: [_jsxs("div", { style: { backgroundColor: 'white', padding: '5px 10px', borderRadius: 8, display: 'flex', alignItems: 'center', justifyContent: 'space-between', color: TMColors.primaryColor }, children: [_jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 5 }, children: [_jsx("p", { children: "File name:" }), _jsxs("div", { style: { fontWeight: 'bold' }, children: [fileName, " ", _jsxs("span", { children: [" ", ` (${formatBytes(fileSize)})`, " "] })] })] }), uploadedFile && _jsx(TMButton, { btnStyle: 'icon', color: 'error', caption: 'Pulisci', onClick: clearFile, icon: _jsx(IconClear, { fontSize: 22 }) })] }), extensionHandler(fileExt) === FileExtensionHandler.READY_TO_SHOW ? _jsx(TMFileViewer, { fileBlob: uploadedFile, isResizingActive: isResizingActive }) :
75
75
  _jsx("div", { style: { backgroundColor: '#f6dbdb', padding: '5px 10px', borderRadius: 8, display: 'flex', alignItems: 'center', justifyContent: 'space-between', color: TMColors.error }, children: _jsxs("div", { children: [" ", 'Anteprima non disponibile.', fileExt && _jsx("b", { children: ` (*.${fileExt})` })] }) })] });
76
76
  return (_jsx(TMPanel, { title: 'Caricamento File', onBack: deviceType === DeviceType.MOBILE ? () => onClose?.() : undefined, toolbar: deviceType !== DeviceType.MOBILE ? _jsx(StyledHeaderIcon, { onClick: onClose, "$color": 'white', children: _jsx(TMTooltip, { content: SDKUI_Localizator.Close, children: _jsx(IconCloseOutline, {}) }) }) : undefined, children: _jsxs("div", { style: { width: '100%', height: '100%', padding: '2px', display: 'flex', flexDirection: 'column', gap: 10 }, children: [_jsx(HiddenInput, { id: "fileInput", type: "file", onChange: handleInputChange }), content] }) }));
77
77
  };
@@ -5,7 +5,7 @@ import { ContextMenu } from 'devextreme-react';
5
5
  import { TMNothingToShow } from './TMDcmtPreview';
6
6
  import TMDcmtForm from './TMDcmtForm';
7
7
  import TMSearchResult from '../search/TMSearchResult';
8
- import { genUniqueId, getExceptionMessage, IconFolder, IconShow, IconBoard, IconDcmtTypeSys, IconCheckFile, IconDetailDcmts, SDKUI_Localizator, svgToString, IconMail, IconDcmtTypeOnlyMetadata, IconCopy, IconMultipleSelection, IconMenuVertical, IconSearchCheck, IconDataList } from '../../../helper';
8
+ import { genUniqueId, getExceptionMessage, IconFolder, IconShow, IconBoard, IconDcmtTypeSys, IconCheckFile, IconDetailDcmts, SDKUI_Localizator, svgToString, IconMail, IconDcmtTypeOnlyMetadata, IconCopy, IconMultipleSelection, IconMenuVertical, IconSearchCheck, IconDataList, IconPreview } from '../../../helper';
9
9
  import { hasDetailRelations } from '../../../helper/dcmtsHelper';
10
10
  import { FormModes, SearchResultContext } from '../../../ts';
11
11
  import { TMColors } from '../../../utils/theme';
@@ -22,7 +22,7 @@ import TMDataListItemViewer from '../../viewers/TMDataListItemViewer';
22
22
  import { TMDcmtTypeTooltip } from '../../viewers/TMTidViewer';
23
23
  import TMTreeView from '../../base/TMTreeView';
24
24
  import TMDcmtIcon from './TMDcmtIcon';
25
- import { TMPanelManagerProvider } from '../../layout/panelManager/TMPanelManagerContext';
25
+ import { TMPanelManagerProvider, useTMPanelManagerContext } from '../../layout/panelManager/TMPanelManagerContext';
26
26
  import TMPanelManagerContainer from '../../layout/panelManager/TMPanelManagerContainer';
27
27
  let abortController = new AbortController();
28
28
  const TMMasterDetailDcmts = ({ deviceType, inputDcmts, isForMaster, showCurrentDcmtIndicator = true, allowNavigation, canNext, canPrev, onNext, onPrev, onBack, appendMasterDcmts, onTaskCreateRequest }) => {
@@ -405,46 +405,66 @@ const TMMasterDetailDcmts = ({ deviceType, inputDcmts, isForMaster, showCurrentD
405
405
  ?
406
406
  _jsx(TMNothingToShow, { text: getTitle(), secondText: SDKUI_Localizator.NoDataToDisplay, icon: isForMaster ? _jsx(IconDetailDcmts, { fontSize: 96, transform: 'scale(-1, 1)' }) : _jsx(IconDetailDcmts, { fontSize: 96 }) })
407
407
  :
408
- _jsx(TMTreeView, { dataSource: data, allowMultipleSelection: allowMultipleSelection, calculateItemsForNode: calculateItemsForNode, itemRender: renderItem, focusedItem: focusedItem, selectedItems: selectedItems, onFocusedItemChanged: handleFocusedItemChanged, onSelectionChanged: handleSelectedItemsChanged, onDataChanged: (items) => setData(updateHiddenProperty(items)) }) }), [data, isLoading, focusedItem, selectedItems, allowMultipleSelection, isForMaster]);
408
+ _jsx(TMTreeViewWrapper, { data: data, allowMultipleSelection: allowMultipleSelection, calculateItemsForNode: calculateItemsForNode, renderItem: renderItem, focusedItem: focusedItem, selectedItems: selectedItems, onFocusedItemChanged: handleFocusedItemChanged, onSelectionChanged: handleSelectedItemsChanged, onDataChanged: (items) => setData(updateHiddenProperty(items)) }) }), [data, isLoading, focusedItem, selectedItems, allowMultipleSelection, isForMaster]);
409
409
  const tmFormOrResult = useMemo(() => _jsx(_Fragment, { children: focusedItem?.isDcmt ?
410
- _jsx(TMDcmtForm, { TID: focusedItem?.tid, DID: focusedItem.did, isClosable: deviceType !== DeviceType.MOBILE, allowNavigation: false, allowRelations: deviceType !== DeviceType.MOBILE, showDcmtFormSidebar: deviceType === DeviceType.MOBILE }) :
411
- _jsx(TMSearchResult, { groupId: 'tmFormOrResult', context: SearchResultContext.MASTER_DETAIL, allowFloatingBar: false, allowRelations: false, openDcmtFormAsModal: true, searchResults: focusedItem?.searchResult ?? [], showSearchResultSidebar: false,
412
- // onClose={() => { setShowDcmtForm(false); }}
413
- onClosePreviewPanel: () => { }, onTaskCreateRequest: onTaskCreateRequest }) }), [focusedItem, deviceType]);
414
- const allInitialPanelVisibility = {
415
- 'tmTreeView': true,
416
- 'tmFormOrResult': true,
417
- 'tmSearchResult': true,
418
- 'tmBlog': false,
419
- 'tmSysMetadata': false,
420
- 'tmDcmtPreview': false,
421
- };
410
+ _jsx(TMDcmtForm, { groupId: 'tmFormOrResult', TID: focusedItem?.tid, DID: focusedItem.did, isClosable: deviceType !== DeviceType.MOBILE, allowNavigation: false, allowRelations: deviceType !== DeviceType.MOBILE, showDcmtFormSidebar: deviceType === DeviceType.MOBILE }) :
411
+ _jsx(TMSearchResult, { groupId: 'tmFormOrResult', isClosable: deviceType !== DeviceType.MOBILE, context: SearchResultContext.METADATA_SEARCH, allowFloatingBar: false, allowRelations: false, openDcmtFormAsModal: true, searchResults: focusedItem?.searchResult ?? [], showSearchResultSidebar: false, onTaskCreateRequest: onTaskCreateRequest }) }), [focusedItem, deviceType]);
422
412
  const initialPanelDimensions = {
423
413
  'tmTreeView': { width: '50%', height: '100%' },
424
414
  'tmFormOrResult': { width: '50%', height: '100%' },
415
+ 'tmDcmtForm': { width: '25%', height: '100%' },
425
416
  'tmSearchResult': { width: '25%', height: '100%' },
426
417
  'tmBlog': { width: '25%', height: '100%' },
427
418
  'tmSysMetadata': { width: '25%', height: '100%' },
428
419
  'tmDcmtPreview': { width: '25%', height: '100%' },
429
420
  };
421
+ const allInitialPanelVisibility = {
422
+ 'tmTreeView': true,
423
+ 'tmFormOrResult': true,
424
+ 'tmDcmtForm': false,
425
+ 'tmSearchResult': true,
426
+ 'tmBlog': false,
427
+ 'tmSysMetadata': false,
428
+ 'tmDcmtPreview': false,
429
+ };
430
430
  const initialPanels = useMemo(() => [
431
431
  {
432
432
  id: 'tmTreeView',
433
433
  name: SDK_Localizator.Relations,
434
- contentOptions: { component: tmTreeView, panelContainer: { title: getTitle(), toolbar: toolbar, allowMaximize: !isMobile } },
435
- toolbarOptions: { icon: _jsx(IconDataList, { fontSize: 24 }), visible: true, orderNumber: 1, isActive: allInitialPanelVisibility['tmTreeView'] }
434
+ contentOptions: {
435
+ component: tmTreeView,
436
+ isClosable: false,
437
+ panelContainer: {
438
+ title: getTitle(),
439
+ toolbar: toolbar,
440
+ allowMaximize: !isMobile,
441
+ onBack: onBack
442
+ }
443
+ },
444
+ toolbarOptions: {
445
+ icon: _jsx(IconDataList, { fontSize: 24 }),
446
+ visible: true,
447
+ orderNumber: 1,
448
+ isActive: allInitialPanelVisibility['tmTreeView']
449
+ }
436
450
  },
437
451
  {
438
452
  id: 'tmFormOrResult',
439
453
  name: focusedItem?.isDcmt ? SDK_Localizator.Metadatas : SDKUI_Localizator.SearchResult,
440
454
  contentOptions: {
441
- component: tmFormOrResult
455
+ component: tmFormOrResult,
456
+ isClosable: false
442
457
  },
443
458
  children: [
459
+ {
460
+ id: 'tmDcmtForm',
461
+ name: SDK_Localizator.Metadatas,
462
+ toolbarOptions: { icon: _jsx(IconPreview, { fontSize: 24 }), visible: false, orderNumber: 1, isActive: allInitialPanelVisibility['tmDcmtForm'] }
463
+ },
444
464
  {
445
465
  id: 'tmSearchResult',
446
- name: 'tmSearchResult',
447
- toolbarOptions: { icon: _jsx(IconSearchCheck, { fontSize: 24 }), visible: true, orderNumber: 3, isActive: allInitialPanelVisibility['tmSearchResult'] }
466
+ name: SDKUI_Localizator.SearchResult,
467
+ toolbarOptions: { icon: _jsx(IconSearchCheck, { fontSize: 24 }), visible: false, orderNumber: 1, isActive: allInitialPanelVisibility['tmSearchResult'] }
448
468
  },
449
469
  {
450
470
  id: 'tmBlog',
@@ -462,9 +482,9 @@ const TMMasterDetailDcmts = ({ deviceType, inputDcmts, isForMaster, showCurrentD
462
482
  toolbarOptions: { icon: _jsx(IconShow, { fontSize: 24 }), visible: true, orderNumber: 6, isActive: allInitialPanelVisibility['tmDcmtPreview'] }
463
483
  }
464
484
  ],
465
- toolbarOptions: { icon: _jsx(IconSearchCheck, { fontSize: 24 }), visible: true, orderNumber: 2, isActive: allInitialPanelVisibility['tmFormOrResult'] }
485
+ toolbarOptions: { icon: _jsx(IconSearchCheck, { fontSize: 24 }), visible: false, orderNumber: 2, isActive: allInitialPanelVisibility['tmFormOrResult'] }
466
486
  }
467
- ], [tmTreeView, tmFormOrResult, focusedItem]);
487
+ ], [tmTreeView, tmFormOrResult, focusedItem?.isDcmt]);
468
488
  return (_jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showWaitPanel, showWaitPanelPrimary: showPrimary, waitPanelTitle: waitPanelTitle, waitPanelTextPrimary: waitPanelTextPrimary, waitPanelValuePrimary: waitPanelValuePrimary, waitPanelMaxValuePrimary: waitPanelMaxValuePrimary, isCancelable: true, abortController: abortController, children: _jsx(TMPanelManagerProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, initialDimensions: initialPanelDimensions, initialMobilePanelId: 'tmTreeView', children: _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", showToolbar: true }) }) }));
469
489
  };
470
490
  export default TMMasterDetailDcmts;
@@ -545,3 +565,21 @@ const getDisplayValueByColumn = (col, value) => {
545
565
  export function IconBackhandIndexPointingRight(props) {
546
566
  return (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 128 128", width: "1em", height: "1em", ...props, children: [_jsx("path", { fill: "#E0BB95", d: "M58.7 41.1c10.8.1 53.3.4 54.9.4c12.8.3 12.7 16.7.7 16.9c-1.5 0-25 1.1-32.2 1.3c5.2 2 7.5 11.9-3.1 14.9c5 2.6 6.4 12.9-4.2 14.7c3.8 2.5 4.3 10.9-6 14.2c-8.4 2.7-28.2 2-40.3-2.3c-9.1-3.3-8.4-5.8-16.7-5.6c-1.4 0-2.1-1.1-2.4-2.4c-1.3-5.9-1.9-26.3-.3-33.8c.4-1.6 1.7-1.8 2.2-1.9c2.1-.4 4.2-2.5 5-4.3c3.2-6.4 12.8-12.8 23.4-18.2c5.5-2.8 9.2-8.8 10.4-18.3c.8-6.3 8.6-7.7 11.8-2.5c2.2 3.6 2.9 7 2.9 10.4c.2 6.2-1.6 10.1-6.1 16.5" }), _jsx("defs", { children: _jsx("path", { id: "notoBackhandIndexPointingRightMediumLightSkinTone0", d: "M58.7 41.1c10.8.1 53.3.4 54.9.4c12.8.3 12.7 16.7.7 16.9c-1.5 0-25 1.1-32.2 1.3c5.2 2 7.5 11.9-3.1 14.9c5 2.6 6.4 12.9-4.2 14.7c3.8 2.5 4.3 10.9-6 14.2c-8.4 2.7-28.2 2-40.3-2.3c-9.1-3.3-8.4-5.8-16.7-5.6c-1.4 0-2.1-1.1-2.4-2.4c-1.3-5.9-1.9-26.3-.3-33.8c.4-1.6 1.7-1.8 2.2-1.9c2.1-.4 4.2-2.5 5-4.3c3.2-6.4 12.8-12.8 23.4-18.2c5.5-2.8 9.2-8.8 10.4-18.3c.8-6.3 8.6-7.7 11.8-2.5c2.2 3.6 2.9 7 2.9 10.4c.2 6.2-1.6 10.1-6.1 16.5" }) }), _jsx("clipPath", { id: "notoBackhandIndexPointingRightMediumLightSkinTone1", children: _jsx("use", { href: "#notoBackhandIndexPointingRightMediumLightSkinTone0" }) }), _jsx("g", { fill: "#D19661", clipPath: "url(#notoBackhandIndexPointingRightMediumLightSkinTone1)", children: _jsx("path", { d: "M73.3 59.5c.1 1.6 2.8 2.9 2.8 6.4c0 3.7-3 4.7-3.1 7.5c-.1 2.7 2 3.8 1.5 7.7c-.6 4.5-4.1 4-4.2 7.1c0 2.7 1.8 3.2 1.8 6.6c0 3.1-3 5.8-5.5 7s-1.2 3.4 0 3.4s11.9-1.3 14.5-8.2c3-8 11-29.6 8.8-36.9c-7.1-1-11.5-1.6-13.7-1.8c-.7-.1-2.9-.6-2.9 1.2M60.1 40.7c0 .9.1 1.5 1 1.5c1 0 43.6 2.1 51.6 2.3c9.2.2 8.7 7.6 5.9 10.1c-1.9 1.7.6 4 2.2 2.6s4.4-3.4 4.3-8.4s-4.4-8.6-8.4-8.9c-3.8-.3-56.6.8-56.6.8m-51.9 21c15.9 0 14.1-11.7 25.2-18.9c15.4-10.1 16.3-11.1 19.7-25.2c1.2-4.9 5.7-4.4 7.7-2.1s4.9-1.3 3.6-2.7s-7.8-7.7-14.8-1.1s-42 46.2-42 46.2z" }) }), _jsx("defs", { children: _jsx("use", { href: "#notoBackhandIndexPointingRightMediumLightSkinTone0", id: "notoBackhandIndexPointingRightMediumLightSkinTone2" }) }), _jsx("clipPath", { id: "notoBackhandIndexPointingRightMediumLightSkinTone3", children: _jsx("use", { href: "#notoBackhandIndexPointingRightMediumLightSkinTone2" }) }), _jsx("g", { fill: "#8D542E", clipPath: "url(#notoBackhandIndexPointingRightMediumLightSkinTone3)", children: _jsx("path", { d: "M58.7 41.1h-1.9c-.4 0-.8-.4-.2-1.3s5.8-8 5.8-15c0-3.2-.5-7.7-3.4-12.4c-.6-.9.2-1.4.9-1c.7.5 6.4 3.2 6.5 13.4s-7.7 16.3-7.7 16.3m65.1 8.8c-.5 0-1.1-.2-1.7 1c-.7 1.5-3.1 4.4-8.4 4.7s-38.1 2.5-38.9 2.5c-1.1 0-1.2 1.9.1 1.8c1.7-.1 7.2-.2 7.2-.2s30.9 1.8 36.9-.6c6.1-2.4 4.8-9.2 4.8-9.2M86.6 68.5c-.3-.1-.7-.1-1 .3c-1.5 2-4.6 3.5-10.6 3.3c-1.4 0-1.6 2.7.1 2.7c.7 0 4-.1 4-.1l6.6-.2zm-3.6 15c-.3-.1-.7-.1-1.1.4c-1.5 2-3.5 2.8-9.7 3c-1.5.1-1.4 2.6.2 2.6c1.1 0 2.4-.1 2.4-.1l7-.6zm-5.4 12.7c-.3-.1-.8-.2-1.2.4c-.8 1.1-2.9 3-7.5 4.4c-3.7 1.1-21.3 1.9-32.5-.7c-2.3-.5-9.9-3-13.6-5.3s-7.3-1.6-8.3-1.4s-6.3.7-6.3.7l2.5 3.7l27 8.6l38.5-.6z" }) })] }));
547
567
  }
568
+ const TMTreeViewWrapper = ({ data, allowMultipleSelection, focusedItem, selectedItems, renderItem, calculateItemsForNode, onFocusedItemChanged, onSelectionChanged, onDataChanged }) => {
569
+ const { setPanelVisibilityById, setToolbarButtonVisibility } = useTMPanelManagerContext();
570
+ return (_jsx(TMTreeView, { dataSource: data, allowMultipleSelection: allowMultipleSelection, calculateItemsForNode: calculateItemsForNode, itemRender: renderItem, focusedItem: focusedItem, selectedItems: selectedItems, onFocusedItemChanged: (item) => {
571
+ onFocusedItemChanged?.(item);
572
+ if (item?.isDcmt) {
573
+ setPanelVisibilityById('tmSearchResult', false);
574
+ setPanelVisibilityById('tmDcmtForm', true);
575
+ setToolbarButtonVisibility('tmSearchResult', false);
576
+ setToolbarButtonVisibility('tmDcmtForm', true);
577
+ }
578
+ else {
579
+ setPanelVisibilityById('tmSearchResult', true);
580
+ setPanelVisibilityById('tmDcmtForm', false);
581
+ setToolbarButtonVisibility('tmSearchResult', true);
582
+ setToolbarButtonVisibility('tmDcmtForm', false);
583
+ }
584
+ }, onSelectionChanged: onSelectionChanged, onDataChanged: onDataChanged }));
585
+ };
@@ -19,7 +19,6 @@ interface ITMSearchResultProps {
19
19
  onSelectedTIDChanged?: (TID: number) => void;
20
20
  onRefreshSearchAsync?: () => Promise<void>;
21
21
  onRefreshAfterAddDcmtToFavs?: () => void;
22
- onClosePreviewPanel?: () => void;
23
22
  onTaskCreateRequest?: (taskContext: TaskContext) => void;
24
23
  }
25
24
  declare const TMSearchResult: React.FC<ITMSearchResultProps>;
@@ -49,12 +49,7 @@ const orderByName = (array) => {
49
49
  return 1;
50
50
  } return 0; });
51
51
  };
52
- const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisible = true, allowRelations = true, openDcmtFormAsModal = false, searchResults = [], showSearchResultSidebar = true, showSelector = false, groupId, onClosePreviewPanel,
53
- // showDcmtForm = false,
54
- // showBoard = false,
55
- // showPreview = false,
56
- // showSysMetadata = false,
57
- title, isClosable = false, allowFloatingBar = true, showToolbarHeader = true, onRefreshAfterAddDcmtToFavs, onRefreshSearchAsync, onSelectedTIDChanged, onUpdate, onClose, onTaskCreateRequest }) => {
52
+ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisible = true, allowRelations = true, openDcmtFormAsModal = false, searchResults = [], showSearchResultSidebar = true, showSelector = false, groupId, title, isClosable = false, allowFloatingBar = true, showToolbarHeader = true, onRefreshAfterAddDcmtToFavs, onRefreshSearchAsync, onSelectedTIDChanged, onUpdate, onClose, onTaskCreateRequest }) => {
58
53
  const [id, setID] = useState('');
59
54
  const [showApprovePopup, setShowApprovePopup] = useState(false);
60
55
  const [showRejectPopup, setShowRejectPopup] = useState(false);
@@ -703,6 +698,6 @@ const TMSearchResultSelector = ({ searchResults = [], onSelectionChanged }) => {
703
698
  };
704
699
  //#endregion TMSearchResultSelector
705
700
  const TMDcmtPreviewWrapper = ({ currentDcmt }) => {
706
- const { setPanelVisibilityById, toggleMaximize } = useTMPanelManagerContext();
707
- return (_jsx(TMDcmtPreview, { onClosePanel: () => setPanelVisibilityById('tmDcmtPreview', false), onMaximizePanel: () => toggleMaximize('tmDcmtPreview'), dcmtData: currentDcmt }));
701
+ const { setPanelVisibilityById, toggleMaximize, isResizingActive } = useTMPanelManagerContext();
702
+ return (_jsx(TMDcmtPreview, { onClosePanel: () => setPanelVisibilityById('tmDcmtPreview', false), onMaximizePanel: () => toggleMaximize('tmDcmtPreview'), dcmtData: currentDcmt, isResizingActive: isResizingActive }));
708
703
  };
@@ -6,6 +6,9 @@ import TMPanel from '../../base/TMPanel';
6
6
  const TMPanelWrapper = (props) => {
7
7
  const { panel, children } = props;
8
8
  const { panelVisibility, panelDimensions, togglePanelVisibility, maximizedPanels, toggleMaximize } = useTMPanelManagerContext();
9
+ // Default to true if isMaximizable or isClosable is undefined, ensuring safe and expected behavior
10
+ const isMaximizable = panel.contentOptions?.isMaximizable ?? true;
11
+ const isClosable = panel.contentOptions?.isClosable ?? true;
9
12
  // Get the current device type (e.g., mobile, tablet, desktop) using a custom hook
10
13
  const deviceType = useDeviceType();
11
14
  // This avoids unnecessary re-renders by only recalculating when deviceType changes
@@ -30,6 +33,6 @@ const TMPanelWrapper = (props) => {
30
33
  pointerEvents: 'auto',
31
34
  };
32
35
  return (_jsx("div", { "data-panel-id": panel.id, style: panelStyles, children: panel.contentOptions?.panelContainer ?
33
- _jsx(TMPanel, { ...panel.contentOptions.panelContainer, allowMaximize: !isMobile, onHeaderDoubleClick: () => toggleMaximize(panel.id), onMaximize: () => toggleMaximize(panel.id), onClose: () => togglePanelVisibility(panel.id), children: children }) : children }));
36
+ _jsx(TMPanel, { ...panel.contentOptions.panelContainer, allowMaximize: !isMobile, onHeaderDoubleClick: isMaximizable ? () => toggleMaximize(panel.id) : undefined, onMaximize: isMaximizable ? () => toggleMaximize(panel.id) : undefined, onClose: isClosable ? () => togglePanelVisibility(panel.id) : undefined, children: children }) : children }));
34
37
  };
35
38
  export default TMPanelWrapper;
@@ -9,6 +9,8 @@ export interface TMPanelDefinition {
9
9
  childrenGroupDirection?: TMPanelDirection;
10
10
  contentOptions?: {
11
11
  component: ReactNode;
12
+ isClosable?: boolean;
13
+ isMaximizable?: boolean;
12
14
  panelContainer?: ITMPanelProps;
13
15
  };
14
16
  toolbarOptions?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.13.63",
3
+ "version": "6.13.65",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",