@topconsultnpm/sdkui-react-beta 6.13.40 → 6.13.41

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.
@@ -5,6 +5,7 @@ type TMPanelManagerProps = {
5
5
  showToolbar?: boolean;
6
6
  toolbarMode?: number;
7
7
  gutters?: number;
8
+ minPanelPercent?: number;
8
9
  };
9
10
  declare const TMPanelManager: (props: TMPanelManagerProps) => import("react/jsx-runtime").JSX.Element;
10
11
  export default TMPanelManager;
@@ -1,12 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useMemo, useRef, useState } from 'react';
2
+ import { useEffect, useMemo, useState } from 'react';
3
3
  import { flattenPanels, isAtLeastOnePanelVisible, isPanelArray } from './TMPanelManagerUtils';
4
4
  import { SDKUI_Globals, IconInfo, SDKUI_Localizator } from '../../helper';
5
5
  import { useDeviceType, DeviceType } from './TMDeviceProvider';
6
6
  import TMPanel from './TMPanel';
7
7
  import TMPanelManagerToolbar from './TMPanelManagerToolbar';
8
8
  const TMPanelManager = (props) => {
9
- const { panels, initialMobilePanelId, showToolbar = true, toolbarMode = 0, gutters = SDKUI_Globals.userSettings.themeSettings.gutters } = props;
9
+ const { panels, initialMobilePanelId, showToolbar = true, toolbarMode = 0, gutters = SDKUI_Globals.userSettings.themeSettings.gutters, minPanelPercent = 5 } = props;
10
10
  const deviceType = useDeviceType();
11
11
  let isMobile = useMemo(() => { return deviceType === DeviceType.MOBILE; }, [deviceType]);
12
12
  const allPanels = useMemo(() => flattenPanels(panels), [panels]);
@@ -15,9 +15,8 @@ const TMPanelManager = (props) => {
15
15
  allPanels.forEach(p => map.set(p.fullId, p));
16
16
  return map;
17
17
  }, [allPanels]);
18
- const panelRefs = useRef({});
19
18
  // Active buttons state & panel map
20
- const [activeButtons, setActiveButtons] = useState(() => Object.fromEntries(allPanels.map(p => [p.fullId, p.config.toolbarOptions?.isActive ?? false])));
19
+ const [activeButtons, setActiveButtons] = useState({});
21
20
  const [originalSizes, setOriginalSizes] = useState(new Map());
22
21
  const [panelsState, setPanelsState] = useState(new Map());
23
22
  const [maximizedPanelPath, setMaximizedPanelPath] = useState([]);
@@ -61,6 +60,12 @@ const TMPanelManager = (props) => {
61
60
  setOriginalSizes(newOriginalSizes);
62
61
  setPanelsState(newState);
63
62
  }, [panels]);
63
+ useEffect(() => {
64
+ if (allPanels.length > 0) {
65
+ const initialButtons = Object.fromEntries(allPanels.map(p => [p.fullId, p.config.toolbarOptions?.isActive ?? false]));
66
+ setActiveButtons(initialButtons);
67
+ }
68
+ }, [allPanels]);
64
69
  useEffect(() => {
65
70
  // If there are no original sizes available, exit early
66
71
  if (!originalSizes.size)
@@ -143,12 +148,12 @@ const TMPanelManager = (props) => {
143
148
  let newCurrent = Math.min(currentSize + deltaPercent, 100);
144
149
  let newNext = Math.min(nextSize - deltaPercent, 100);
145
150
  // Enforce minimum panel size
146
- if (newCurrent < 5) {
147
- newCurrent = 5;
151
+ if (newCurrent < minPanelPercent) {
152
+ newCurrent = minPanelPercent;
148
153
  newNext = total - newCurrent;
149
154
  }
150
- else if (newNext < 5) {
151
- newNext = 5;
155
+ else if (newNext < minPanelPercent) {
156
+ newNext = minPanelPercent;
152
157
  newCurrent = total - newNext;
153
158
  }
154
159
  // Safely get current and next panel data
@@ -219,7 +224,7 @@ const TMPanelManager = (props) => {
219
224
  return newActive;
220
225
  });
221
226
  }
222
- }, [isMobile]);
227
+ }, [isMobile, panelMap]);
223
228
  // Handler for starting to drag a column divider (for resizing panels horizontally)
224
229
  const onColumnMouseDown = (panelKey) => {
225
230
  setIsColumnDragging(panelKey); // Set the state to indicate which column is being dragged
@@ -404,11 +409,9 @@ const TMPanelManager = (props) => {
404
409
  flexGrow: 1,
405
410
  overflow: 'auto',
406
411
  };
407
- return (_jsxs("div", { ref: el => {
408
- panelRefs.current[fullId] = el;
409
- }, style: panelStyle, children: [_jsx("div", { style: contentStyle, children: hasChildren
412
+ return (_jsxs("div", { style: panelStyle, children: [_jsx("div", { style: contentStyle, children: hasChildren
410
413
  ? renderPanels(panel.contentOptions.content, fullId, 'vertical')
411
- : panel.contentOptions?.panelContainer ? _jsx(TMPanel, { title: panel.contentOptions.panelContainer.title, totalItems: panel.contentOptions.panelContainer.totalItems, displayedItemsCount: panel.contentOptions.panelContainer.displayedItemsCount, onBack: panel.contentOptions.panelContainer.onBack, onClose: () => handleTogglePanel(fullId), onMaximize: () => handleToggleMaximize(fullId), onHeaderDoubleClick: () => handleToggleMaximize(fullId), allowMaximize: !isMobile, children: typeof panel.contentOptions.content === "function" ? panel.contentOptions.content(handleTogglePanel, handleToggleMaximize, handleVisibilityButton, handleDisableButton) : panel.contentOptions.content })
414
+ : panel.contentOptions?.panelContainer ? _jsx(TMPanel, { title: panel.contentOptions.panelContainer.title, totalItems: panel.contentOptions.panelContainer.totalItems, displayedItemsCount: panel.contentOptions.panelContainer.displayedItemsCount, onBack: panel.contentOptions.panelContainer.onBack, onClose: () => handleTogglePanel(fullId), onMaximize: () => handleToggleMaximize(fullId), onHeaderDoubleClick: () => handleToggleMaximize(fullId), allowMaximize: !isMobile, toolbar: panel.contentOptions.panelContainer.toolbar, children: typeof panel.contentOptions.content === "function" ? panel.contentOptions.content(handleTogglePanel, handleToggleMaximize, handleVisibilityButton, handleDisableButton) : panel.contentOptions.content })
412
415
  :
413
416
  typeof panel.contentOptions.content === "function" ? panel.contentOptions.content(handleTogglePanel, handleToggleMaximize, handleVisibilityButton, handleDisableButton) : panel.contentOptions.content }), !isLastVisible && isActive && maximizedPanelPath.length === 0 && (_jsx("div", { style: {
414
417
  cursor: direction === 'horizontal' ? 'col-resize' : 'row-resize',
@@ -431,7 +434,7 @@ const TMPanelManager = (props) => {
431
434
  } }))] }, fullId));
432
435
  });
433
436
  };
434
- return (_jsxs("div", { style: { display: 'flex', flexDirection: isMobile ? 'column' : 'row', height: '100%', width: '100%', gap: gutters }, children: [_jsx("div", { style: {
437
+ return (_jsxs("div", { style: { display: 'flex', flexDirection: isMobile ? 'column' : 'row', height: '100%', width: '100%', gap: !isMobile ? gutters : 0 }, children: [_jsx("div", { style: {
435
438
  display: 'flex',
436
439
  flexGrow: 1,
437
440
  width: isAtLeastOnePanelVisible(activeButtons) ? `calc(100% - ${showToolbar ? (isMobile ? 0 : 70) : 0}px)` : '0%',
@@ -1,11 +1,11 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useCallback, useEffect, useState } from 'react';
2
+ import { useCallback, useEffect, useMemo, useState } from 'react';
3
3
  import { DataColumnTypes, DcmtTypeListCacheService, MetadataDataDomains, MetadataFormats, RelationCacheService, RelationTypes, ResultTypes, SDK_Globals, SystemMIDs } from '@topconsultnpm/sdk-ts-beta';
4
4
  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, IconPreview, IconBoard, IconDcmtTypeSys, IconCheckFile, IconDetailDcmts, SDKUI_Localizator, svgToString, IconMail, IconDcmtTypeOnlyMetadata, IconCopy, IconMultipleSelection, IconMenuVertical, SDKUI_Globals } from '../../../helper';
8
+ import { genUniqueId, getExceptionMessage, IconFolder, IconShow, IconBoard, IconDcmtTypeSys, IconCheckFile, IconDetailDcmts, SDKUI_Localizator, svgToString, IconMail, IconDcmtTypeOnlyMetadata, IconCopy, IconMultipleSelection, IconMenuVertical, IconSearchCheck, IconDataList } from '../../../helper';
9
9
  import { hasDetailRelations } from '../../../helper/dcmtsHelper';
10
10
  import { FormModes, SearchResultContext } from '../../../ts';
11
11
  import { TMColors } from '../../../utils/theme';
@@ -13,7 +13,6 @@ import { StyledDivHorizontal, StyledBadge } from '../../base/Styled';
13
13
  import ShowAlert from '../../base/TMAlert';
14
14
  import TMButton from '../../base/TMButton';
15
15
  import { DeviceType } from '../../base/TMDeviceProvider';
16
- import { TMSplitterLayout, TMLayoutItem } from '../../base/TMLayout';
17
16
  import { TMExceptionBoxManager } from '../../base/TMPopUp';
18
17
  import TMSpinner from '../../base/TMSpinner';
19
18
  import { TMLayoutWaitingContainer } from '../../base/TMWaitPanel';
@@ -24,8 +23,7 @@ import TMDataListItemViewer from '../../viewers/TMDataListItemViewer';
24
23
  import { TMDcmtTypeTooltip } from '../../viewers/TMTidViewer';
25
24
  import TMTreeView from '../../base/TMTreeView';
26
25
  import TMDcmtIcon from './TMDcmtIcon';
27
- import TMPanel from '../../base/TMPanel';
28
- import TMCommandsPanel from '../../sidebar/TMCommandsPanel';
26
+ import TMPanelManager from '../../base/TMPanelManager';
29
27
  let abortController = new AbortController();
30
28
  const TMMasterDetailDcmts = ({ deviceType, inputDcmts, isForMaster, showCurrentDcmtIndicator = true, allowNavigation, canNext, canPrev, onNext, onPrev, onBack, appendMasterDcmts, onTaskCreateRequest }) => {
31
29
  const [id, setID] = useState('');
@@ -380,28 +378,137 @@ const TMMasterDetailDcmts = ({ deviceType, inputDcmts, isForMaster, showCurrentD
380
378
  const toolbar = _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '10px' }, children: [allowMultipleSelection && _jsx("p", { style: { color: TMColors.colorHeader, textAlign: 'center', padding: '1px 4px', borderRadius: '3px', display: 'flex' }, children: `${selectedItems.length} selezionati` }), _jsx(TMButton, { btnStyle: 'icon', caption: 'Selezione multipla', icon: _jsx(IconMultipleSelection, { fontSize: 16, color: allowMultipleSelection ? TMColors.tertiary : 'white' }), onClick: () => setAllowMultipleSelection(!allowMultipleSelection) }), allowNavigation && canPrev != undefined && _jsx(TMSaveFormButtonPrevious, { btnStyle: 'icon', iconColor: 'white', isModified: false, formMode: FormModes.ReadOnly, canPrev: canPrev, onPrev: onPrev }), allowNavigation && canNext != undefined && _jsx(TMSaveFormButtonNext, { btnStyle: 'icon', iconColor: 'white', isModified: false, formMode: FormModes.ReadOnly, canNext: canNext, onNext: onNext }), _jsx(IconMenuVertical, { id: `commands-detail-${id}`, color: 'white', cursor: 'pointer' }), _jsx(ContextMenu, { showEvent: 'click', dataSource: commandsMenuItems, target: `#commands-detail-${id}` })] });
381
379
  const getTitle = () => isForMaster ? `${SDKUI_Localizator.DcmtsMaster} - ${dtdMaster?.nameLoc}` : SDKUI_Localizator.DcmtsDetail;
382
380
  const isMobile = deviceType === DeviceType.MOBILE;
383
- return (_jsxs("div", { style: {
384
- display: 'flex',
385
- flexDirection: isMobile ? 'column' : 'row',
386
- justifyContent: 'space-between',
387
- gap: SDKUI_Globals.userSettings.themeSettings.gutters,
388
- width: '100%',
389
- height: '100%',
390
- }, children: [_jsx("div", { style: { flex: 1, minWidth: 0, height: '100%' }, children: _jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showWaitPanel, showWaitPanelPrimary: showPrimary, waitPanelTitle: waitPanelTitle, waitPanelTextPrimary: waitPanelTextPrimary, waitPanelValuePrimary: waitPanelValuePrimary, waitPanelMaxValuePrimary: waitPanelMaxValuePrimary, isCancelable: true, abortController: abortController, children: _jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: 'visible', separatorSize: SDKUI_Globals.userSettings.themeSettings.gutters, separatorColor: 'transparent', showSeparator: focusedItem != undefined, separatorActiveColor: 'transparent', min: ['0', '0'], start: focusedItem && (showDcmtForm || showPreview || showBoard || showSysMetadata) ? deviceType != DeviceType.MOBILE ? ["40%", "60%"] : ["0%", "100%"] : ["100%", "0%"], children: [_jsx(TMPanel, { title: getTitle(), toolbar: toolbar, onBack: onBack, children: isLoading ? _jsx(_Fragment, {}) :
391
- data.length <= 0
392
- ?
393
- _jsx(TMNothingToShow, { text: getTitle(), secondText: SDKUI_Localizator.NoDataToDisplay, icon: isForMaster ? _jsx(IconDetailDcmts, { fontSize: 96, transform: 'scale(-1, 1)' }) : _jsx(IconDetailDcmts, { fontSize: 96 }) })
394
- :
395
- _jsx(TMTreeView, { dataSource: data, allowMultipleSelection: allowMultipleSelection, calculateItemsForNode: calculateItemsForNode, itemRender: renderItem, focusedItem: focusedItem, selectedItems: selectedItems, onFocusedItemChanged: handleFocusedItemChanged, onSelectionChanged: handleSelectedItemsChanged, onDataChanged: (items) => setData(updateHiddenProperty(items)) }) }), _jsx(TMLayoutItem, { children: focusedItem?.isDcmt ?
396
- _jsx(TMDcmtForm, { TID: focusedItem?.tid, DID: focusedItem.did, isClosable: deviceType !== DeviceType.MOBILE, allowNavigation: false, allowRelations: deviceType !== DeviceType.MOBILE, showDcmtFormSidebar: deviceType === DeviceType.MOBILE, showPreview: showPreview, showBoard: showBoard, showSysMetadata: showSysMetadata, showDcmtForm: showDcmtForm, onClose: () => { setShowDcmtForm(false); }, onClosePreviewPanel: () => { setShowPreview(false); } }) :
397
- _jsx(TMSearchResult, { context: SearchResultContext.METADATA_SEARCH, searchResults: focusedItem?.searchResult ?? [], showSearchResultSidebar: false, onClose: () => { setShowDcmtForm(false); }, onClosePreviewPanel: () => { setShowPreview(false); }, onTaskCreateRequest: onTaskCreateRequest }) })] }, "TMDetails-panel") }) }), _jsx(TMCommandsPanel, { isMobile: isMobile, items: [
398
- { icon: _jsx(IconShow, {}), selected: showPreview, onClick: () => { setShowPreview(!showPreview); } },
399
- { icon: _jsx(IconPreview, {}), selected: showDcmtForm, onClick: () => { setShowDcmtForm(!showDcmtForm); } },
400
- { icon: _jsx(IconBoard, {}), selected: showBoard, onClick: () => { setShowSysMetadata(false); setShowBoard(!showBoard); } },
401
- { icon: _jsx(IconDcmtTypeSys, {}), selected: showSysMetadata, onClick: () => { setShowBoard(false); setShowSysMetadata(!showSysMetadata); } },
402
- { icon: _jsx(IconCheckFile, {}), selected: showZeroDcmts, onClick: () => { setShowZeroDcmts(!showZeroDcmts); } },
403
- { icon: _jsx(IconDetailDcmts, { transform: 'scale(-1, 1)' }), disabled: !focusedItem?.isDcmt, onClick: () => { appendMasterDcmts?.(focusedItem?.tid, focusedItem?.did); } }
404
- ] })] }));
381
+ const renderTMTreeView = (handleTogglePanel) => _jsx(_Fragment, { children: isLoading ? _jsx(_Fragment, {}) :
382
+ data.length <= 0
383
+ ?
384
+ _jsx(TMNothingToShow, { text: getTitle(), secondText: SDKUI_Localizator.NoDataToDisplay, icon: isForMaster ? _jsx(IconDetailDcmts, { fontSize: 96, transform: 'scale(-1, 1)' }) : _jsx(IconDetailDcmts, { fontSize: 96 }) })
385
+ :
386
+ _jsx(TMTreeView, { dataSource: data, allowMultipleSelection: allowMultipleSelection, calculateItemsForNode: calculateItemsForNode, itemRender: renderItem, focusedItem: focusedItem, selectedItems: selectedItems, onFocusedItemChanged: handleFocusedItemChanged, onSelectionChanged: handleSelectedItemsChanged, onDataChanged: (items) => setData(updateHiddenProperty(items)) }) });
387
+ const renderTMFormOrResult = useMemo(() => (handleTogglePanel) => {
388
+ return (_jsx(_Fragment, { children: focusedItem?.isDcmt ?
389
+ _jsx(TMDcmtForm, { TID: focusedItem?.tid, DID: focusedItem.did, isClosable: deviceType !== DeviceType.MOBILE, allowNavigation: false, allowRelations: deviceType !== DeviceType.MOBILE, showDcmtFormSidebar: deviceType === DeviceType.MOBILE, showPreview: showPreview, showBoard: showBoard, showSysMetadata: showSysMetadata, showDcmtForm: showDcmtForm, onClose: () => { setShowDcmtForm(false); }, onClosePreviewPanel: () => { setShowPreview(false); } }) :
390
+ _jsx(TMSearchResult, { context: SearchResultContext.METADATA_SEARCH, allowFloatingBar: false, searchResults: focusedItem?.searchResult ?? [], showPreview: showPreview, showSearchResultSidebar: false, onClose: () => { setShowDcmtForm(false); }, onClosePreviewPanel: () => {
391
+ setShowPreview(false);
392
+ handleTogglePanel("commandPreview");
393
+ }, onTaskCreateRequest: onTaskCreateRequest }) }));
394
+ }, [focusedItem, showPreview, showBoard, showSysMetadata, showDcmtForm, deviceType]);
395
+ const panelsConfig = [
396
+ {
397
+ id: 'TMTreeView',
398
+ name: getTitle(),
399
+ toolbarOptions: { icon: _jsx(IconDataList, { fontSize: 24 }), visible: true, isActive: true, orderNumber: 1 },
400
+ type: 'content',
401
+ contentOptions: {
402
+ visible: true,
403
+ height: '100%',
404
+ width: '20%',
405
+ content: renderTMTreeView,
406
+ panelContainer: {
407
+ title: getTitle(),
408
+ allowMaximize: !isMobile,
409
+ onBack: onBack,
410
+ toolbar: toolbar
411
+ },
412
+ },
413
+ },
414
+ {
415
+ id: 'TMFormOrResult',
416
+ name: focusedItem?.isDcmt ? "Form del documento" : SDKUI_Localizator.SearchResult,
417
+ toolbarOptions: { icon: _jsx(IconSearchCheck, { fontSize: 24 }), visible: true, isActive: true, orderNumber: 2 },
418
+ type: 'content',
419
+ contentOptions: {
420
+ visible: true,
421
+ height: '100%',
422
+ width: '20%',
423
+ content: renderTMFormOrResult,
424
+ },
425
+ },
426
+ {
427
+ id: 'commandPreview',
428
+ name: SDKUI_Localizator.PreviewDocument,
429
+ toolbarOptions: {
430
+ icon: _jsx(IconShow, { fontSize: 24 }),
431
+ visible: true,
432
+ disabled: !focusedItem,
433
+ isActive: showPreview,
434
+ orderNumber: 3,
435
+ },
436
+ type: 'button',
437
+ buttonOptions: {
438
+ onClick: () => {
439
+ setShowPreview(prev => !prev);
440
+ },
441
+ },
442
+ },
443
+ {
444
+ id: 'commandSysMetadata',
445
+ name: SDKUI_Localizator.MetadataSystem,
446
+ toolbarOptions: {
447
+ icon: _jsx(IconDcmtTypeSys, { fontSize: 24 }),
448
+ visible: true,
449
+ disabled: !focusedItem,
450
+ isActive: showSysMetadata,
451
+ orderNumber: 3,
452
+ },
453
+ type: 'button',
454
+ buttonOptions: {
455
+ onClick: () => {
456
+ setShowSysMetadata(prev => !prev);
457
+ },
458
+ },
459
+ },
460
+ {
461
+ id: 'commandBoard',
462
+ name: SDKUI_Localizator.BlogCase,
463
+ toolbarOptions: {
464
+ icon: _jsx(IconBoard, { fontSize: 24 }),
465
+ disabled: !focusedItem,
466
+ visible: true,
467
+ isActive: showBoard,
468
+ orderNumber: 3,
469
+ },
470
+ type: 'button',
471
+ buttonOptions: {
472
+ onClick: () => {
473
+ setShowBoard(prev => !prev);
474
+ },
475
+ },
476
+ },
477
+ {
478
+ id: 'commandZeroDcmts',
479
+ name: "Consenti dettagli con 0 documenti",
480
+ toolbarOptions: {
481
+ icon: _jsx(IconCheckFile, { fontSize: 24 }),
482
+ visible: true,
483
+ isActive: showZeroDcmts,
484
+ orderNumber: 3,
485
+ },
486
+ type: 'button',
487
+ buttonOptions: {
488
+ onClick: () => {
489
+ setShowZeroDcmts(prev => !prev);
490
+ },
491
+ },
492
+ },
493
+ {
494
+ id: 'commandMasterDcmts',
495
+ name: SDKUI_Localizator.DcmtsMaster,
496
+ toolbarOptions: {
497
+ icon: _jsx(IconDetailDcmts, { transform: 'scale(-1, 1)', fontSize: 24 }),
498
+ disabled: !focusedItem?.isDcmt,
499
+ visible: true,
500
+ isActive: false,
501
+ orderNumber: 3,
502
+ },
503
+ type: 'button',
504
+ buttonOptions: {
505
+ onClick: () => {
506
+ appendMasterDcmts?.(focusedItem?.tid, focusedItem?.did);
507
+ },
508
+ },
509
+ },
510
+ ];
511
+ return (_jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showWaitPanel, showWaitPanelPrimary: showPrimary, waitPanelTitle: waitPanelTitle, waitPanelTextPrimary: waitPanelTextPrimary, waitPanelValuePrimary: waitPanelValuePrimary, waitPanelMaxValuePrimary: waitPanelMaxValuePrimary, isCancelable: true, abortController: abortController, children: _jsx(TMPanelManager, { panels: panelsConfig, initialMobilePanelId: 'TMTreeView', toolbarMode: 1 }) }));
405
512
  };
406
513
  export default TMMasterDetailDcmts;
407
514
  function getMetadataKeys(obj) {
@@ -4,7 +4,7 @@ import styled from 'styled-components';
4
4
  import { SharingModes, SDK_Globals, SDK_Localizator } from '@topconsultnpm/sdk-ts-beta';
5
5
  import { LocalizeSharingModes } from '../../../helper/Enum_Localizator';
6
6
  import ContextMenu from 'devextreme-react/cjs/context-menu';
7
- import { SDKUI_Localizator, Globalization, svgToString, IconStar, IconDelete, IconDashboard, IconSavedQuery, IconApply, IconInfo } from '../../../helper';
7
+ import { SDKUI_Localizator, Globalization, svgToString, IconStar, IconDelete, IconDashboard, IconSavedQuery, IconApply, IconInfo, IconCloseOutline } from '../../../helper';
8
8
  import { TMColors } from '../../../utils/theme';
9
9
  import ShowAlert from '../../base/TMAlert';
10
10
  import TMButton from '../../base/TMButton';
@@ -13,6 +13,8 @@ import TMSpinner from '../../base/TMSpinner';
13
13
  import TMTooltip from '../../base/TMTooltip';
14
14
  import { TMSearchBar } from '../../sidebar/TMHeader';
15
15
  import { DeviceType, useDeviceType } from '../../base/TMDeviceProvider';
16
+ import { StyledDivHorizontal, StyledOffCanvasPanel } from '../../base/Styled';
17
+ import { useOutsideClick } from '../../../hooks/useOutsideClick';
16
18
  const StyledSqdItem = styled.div `
17
19
  display: flex;
18
20
  flex-direction: column;
@@ -33,9 +35,13 @@ const StyledSqdItem = styled.div `
33
35
  left: -2px;
34
36
  top: 50%;
35
37
  transform: translateY(-50%);
36
- opacity: ${({ $isMobile }) => ($isMobile ? 1 : 0)};
38
+ opacity: 0;
37
39
  transition: opacity 0.2s;
38
- pointer-events: ${({ $isMobile }) => ($isMobile ? 'auto' : 'none')};
40
+ pointer-events: none;
41
+ // On mobile, never show
42
+ ${({ $isMobile }) => $isMobile && `
43
+ display: none !important;
44
+ `}
39
45
  }
40
46
 
41
47
  &:hover .info-icon {
@@ -62,13 +68,31 @@ export const getTooltipBySqd = (sqd) => {
62
68
  return (_jsxs("div", { style: { textAlign: "left" }, children: [_jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 10 }, children: [_jsx(IconSavedQuery, { color: getSharingModeColor(sqd.sharingMode), fontSize: 20, style: { flexShrink: 0 } }), _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 2 }, children: [_jsxs("div", { children: ["ID: ", sqd.id] }), _jsxs("div", { children: ["Master TID: ", sqd.masterTID] }), sqd.description && _jsx("div", { children: `${SDKUI_Localizator.Description}: ${sqd.description}` })] })] }), _jsx("hr", {}), _jsxs("div", { children: [SDKUI_Localizator.OwnerName, ": ", sqd.ownerName, " (", sqd.ownerID, ")"] }), _jsx("div", { children: LocalizeSharingModes(sqd.sharingMode) }), _jsxs("div", { children: ["Default: ", sqd.isDefault == 1 ? SDKUI_Localizator.Yes : SDKUI_Localizator.No] }), _jsxs("div", { children: ["Filtro semplice", ": ", sqd.isEasyWhere == 1 ? SDKUI_Localizator.Yes : SDKUI_Localizator.No] }), _jsxs("div", { children: ["Esegui ricerca immediatamente", ": ", sqd.runSearchWhenSelected == 1 ? SDKUI_Localizator.Yes : SDKUI_Localizator.No] }), _jsx("hr", {}), _jsxs("div", { children: [SDKUI_Localizator.CreationTime, ": ", Globalization.getDateTimeDisplayValue(sqd.creationTime)] }), _jsxs("div", { children: [SDKUI_Localizator.LastUpdateTime, ": ", Globalization.getDateTimeDisplayValue(sqd.lastUpdateTime)] })] }));
63
69
  };
64
70
  const initialSQDsMaxItems = 12;
65
- const SavedQueryContexMenu = ({ sqd, manageDefault, deleteAsync, favManageAsync, setDefaultAsync }) => _jsx(ContextMenu, { items: manageDefault ? [
66
- { text: SDKUI_Localizator.SetAsDefault2, icon: svgToString(_jsx(IconStar, { color: 'rgb(248, 215, 117)' })) },
67
- { text: SDKUI_Localizator.Delete, disabled: (sqd.id == 1), icon: svgToString(_jsx(IconDelete, {})) },
68
- { text: SDKUI_Localizator.AddToHomePage, disabled: (sqd.id == 1), icon: svgToString(_jsx(IconDashboard, {})) }
69
- ] : [
70
- { text: SDKUI_Localizator.Delete, disabled: (sqd.id == 1), icon: svgToString(_jsx(IconDelete, {})) },
71
- { text: SDKUI_Localizator.AddToHomePage, disabled: (sqd.id == 1), icon: svgToString(_jsx(IconDashboard, {})) }
71
+ const SavedQueryContexMenu = ({ sqd, manageDefault, isMobile, deleteAsync, favManageAsync, setDefaultAsync, setInfoSQD }) => _jsx(ContextMenu, { items: [
72
+ ...(manageDefault ? [{
73
+ text: SDKUI_Localizator.SetAsDefault2,
74
+ icon: svgToString(_jsx(IconStar, { color: 'rgb(248, 215, 117)' })),
75
+ onClick: () => setDefaultAsync(sqd)
76
+ }] : []),
77
+ {
78
+ text: SDKUI_Localizator.Delete,
79
+ disabled: (sqd.id == 1),
80
+ icon: svgToString(_jsx(IconDelete, {})),
81
+ onClick: () => deleteAsync(sqd)
82
+ },
83
+ {
84
+ text: SDKUI_Localizator.AddToHomePage,
85
+ disabled: (sqd.id == 1),
86
+ icon: svgToString(_jsx(IconDashboard, {})),
87
+ onClick: () => favManageAsync?.(sqd)
88
+ },
89
+ ...(isMobile ? [
90
+ {
91
+ text: SDKUI_Localizator.About,
92
+ icon: svgToString(_jsx(IconInfo, { color: TMColors.info })),
93
+ onClick: () => { setInfoSQD?.(sqd); }
94
+ }
95
+ ] : [])
72
96
  ], target: `#sqd-item-${sqd.id}`, onItemClick: (e) => {
73
97
  if (e.itemIndex == 0)
74
98
  setDefaultAsync?.(sqd);
@@ -82,8 +106,12 @@ const TMSavedQuerySelector = React.memo(({ items, selectedId, allowShowSearch =
82
106
  const [selectedItem, setSelectedItem] = useState();
83
107
  const [searchText, setSearchText] = useState('');
84
108
  const [showAllRoot, setShowAllRoot] = useState(false);
109
+ const [infoSQD, setInfoSQD] = useState();
85
110
  const deviceType = useDeviceType();
86
111
  const isMobile = deviceType === DeviceType.MOBILE;
112
+ const panelRef = useOutsideClick(() => {
113
+ setInfoSQD(undefined);
114
+ });
87
115
  useEffect(() => { loadDataAsync(false); }, [items]);
88
116
  useEffect(() => { setSelectedItem(dataSource.find(o => o.id == selectedId)); }, [selectedId, dataSource]);
89
117
  const loadDataAsync = async (refreshCache) => {
@@ -176,9 +204,9 @@ const TMSavedQuerySelector = React.memo(({ items, selectedId, allowShowSearch =
176
204
  justifyContent: 'center',
177
205
  fontSize: '1rem',
178
206
  fontWeight: 'bold'
179
- }, children: _jsx(IconApply, { fontSize: 24, color: 'green' }) }), _jsx(SavedQueryContexMenu, { sqd: sqd, manageDefault: manageDefault, setDefaultAsync: () => setDefaultSQDAsync(sqd), deleteAsync: () => deleteSQDAsync(sqd), favManageAsync: () => favManageSQDAsync(sqd) })] }, sqd.id))) }), dataSource.length > initialSQDsMaxItems && searchText.length <= 0 &&
207
+ }, children: _jsx(IconApply, { fontSize: 24, color: 'green' }) }), _jsx(SavedQueryContexMenu, { sqd: sqd, manageDefault: manageDefault, isMobile: isMobile, setInfoSQD: setInfoSQD, setDefaultAsync: () => setDefaultSQDAsync(sqd), deleteAsync: () => deleteSQDAsync(sqd), favManageAsync: () => favManageSQDAsync(sqd) })] }, sqd.id))) }), dataSource.length > initialSQDsMaxItems && searchText.length <= 0 &&
180
208
  _jsx(TMButton, { elementStyle: { display: 'flex', justifyContent: 'flex-end', padding: '10px' }, btnStyle: 'icon', caption: showAllRoot ? "Mostra meno" : `Mostra tutte le ricerche (+${dataSource.length - initialSQDsMaxItems})`, icon: showAllRoot ?
181
209
  _jsx("div", { style: { backgroundColor: TMColors.primaryColor, minWidth: '30px', minHeight: '30px', borderRadius: '10px', display: 'flex', alignItems: 'center', justifyContent: 'center' }, children: _jsx("p", { style: { color: 'white' }, children: `-${dataSource.length - initialSQDsMaxItems}` }) }) :
182
- _jsx("div", { style: { backgroundColor: TMColors.primaryColor, minWidth: '30px', minHeight: '30px', borderRadius: '10px', display: 'flex', alignItems: 'center', justifyContent: 'center' }, children: _jsx("p", { style: { color: 'white' }, children: `+${dataSource.length - initialSQDsMaxItems}` }) }), onClick: () => setShowAllRoot(!showAllRoot) })] }));
210
+ _jsx("div", { style: { backgroundColor: TMColors.primaryColor, minWidth: '30px', minHeight: '30px', borderRadius: '10px', display: 'flex', alignItems: 'center', justifyContent: 'center' }, children: _jsx("p", { style: { color: 'white' }, children: `+${dataSource.length - initialSQDsMaxItems}` }) }), onClick: () => setShowAllRoot(!showAllRoot) }), _jsxs(StyledOffCanvasPanel, { ref: panelRef, "$isOpen": isMobile && infoSQD !== undefined, children: [_jsxs(StyledDivHorizontal, { style: { gap: 10, padding: '10px 8px', width: '100%', alignItems: 'center' }, children: [_jsx("p", { style: { fontSize: '1.1rem', fontWeight: 'bold' }, children: `${SDK_Localizator.SavedQuery} - ${SDKUI_Localizator.About}` }), _jsx(IconCloseOutline, { style: { marginLeft: 'auto', cursor: 'pointer' }, onClick: () => setInfoSQD(undefined) })] }), getTooltipBySqd(infoSQD)] })] }));
183
211
  });
184
212
  export default TMSavedQuerySelector;
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
3
3
  import { SDK_Globals, DataColumnTypes, MetadataDataDomains, DataListViewModes, MetadataFormats, LayoutModes, TemplateTIDs, DcmtTypeListCacheService, AccessLevels, SystemMIDsAsNumber, ArchiveConstraints } from '@topconsultnpm/sdk-ts-beta';
4
4
  import styled from 'styled-components';
@@ -325,6 +325,8 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
325
325
  break;
326
326
  }
327
327
  };
328
+ const searchResutlToolbar = _jsxs(_Fragment, { children: [context !== SearchResultContext.METADATA_SEARCH && fromDTD?.templateTID === TemplateTIDs.WF_WIApprView && _jsx(WorkFlowOperationButtons, { deviceType: deviceType, onApprove: () => setShowApprovePopup(true), onReject: () => setShowRejectPopup(true), onReAssign: () => setShowReAssignPopup(true), approveDisable: disable, rejectDisable: disable, reassignDisable: disable, infoDisable: getSelectedDcmtsOrFocused(selectedItems, focusedItem).length !== 1 }), (dcmtsReturned != dcmtsFound) && _jsx("p", { style: { backgroundColor: `white`, color: TMColors.primaryColor, textAlign: 'center', padding: '1px 4px', borderRadius: '3px', display: 'flex' }, children: `${dcmtsReturned}/${dcmtsFound} restituiti` }), context === SearchResultContext.FAVORITES_AND_RECENTS &&
329
+ _jsx("div", { style: { display: 'flex', alignItems: 'center', gap: '5px' }, children: _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconDelete, { color: 'white' }), caption: "Rimuovi da " + (selectedSearchResult?.category === "Favorites" ? '"Preferiti"' : '"Recenti"'), disabled: getSelectedDcmtsOrFocused(selectedItems, focusedItem).length <= 0, onClick: removeDcmtFromFavsOrRecents }) }), _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconRefresh, { color: 'white' }), caption: SDKUI_Localizator.Refresh, onClick: onRefreshSearchAsync }), _jsx(IconMenuVertical, { id: `commands-header-${id}`, color: 'white', cursor: 'pointer' }), _jsx(CommandsContextMenu, { target: `#commands-header-${id}`, menuItems: getCommandsMenuItems(fromDTD, selectedItems, focusedItem, context, showFloatingBar, setShowFloatingBar, openFormHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler) })] });
328
330
  const middlePanelToolbar = _jsxs("div", { style: { width: 'max-content', display: 'flex', alignItems: 'center', gap: '10px' }, children: [_jsx(TMSaveFormButtonPrevious, { btnStyle: 'icon', isModified: false, iconColor: TMColors.default_background, formMode: FormModes.ReadOnly, canPrev: canNavigateHandler('prev'), onPrev: () => onNavigateHandler('prev') }), _jsx(TMSaveFormButtonNext, { btnStyle: 'icon', isModified: false, iconColor: TMColors.default_background, formMode: FormModes.ReadOnly, canNext: canNavigateHandler('next'), onNext: () => onNavigateHandler('next') })] });
329
331
  const handleAddItem = (tid, did) => {
330
332
  let newItem = { TID: tid ?? 0, DID: did ?? 0 };
@@ -347,7 +349,10 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
347
349
  _jsxs(TMFloatingToolbar, { backgroundColor: TMColors.primaryColor, initialLeft: '10px', initialTop: 'calc(100% - 75px)', children: [fromDTD?.perm?.canRetrieveFile === AccessLevels.Yes && _jsx(TMButton, { btnStyle: 'icon', caption: "Download file", disabled: fromDTD?.perm?.canRetrieveFile !== AccessLevels.Yes, icon: _jsx(IconDownload, { color: 'white' }), onClick: () => { downloadDcmtsAsync(getSelectedDcmtsOrFocused(selectedItems, focusedItem), DownloadTypes.Dcmt); } }), _jsx(TMButton, { btnStyle: 'icon', caption: 'Firma e marca', icon: _jsx(IconSignature, { color: 'white' }), onClick: () => { ShowAlert({ message: "TODO Firma e marca ", mode: 'info', title: `${"TODO"}`, duration: 3000 }); } }), _jsx(IconMenuVertical, { id: `commands-floating-${id}`, color: 'white', cursor: 'pointer' }), _jsx(CommandsContextMenu, { target: `#commands-floating-${id}`, menuItems: getCommandsMenuItems(fromDTD, selectedItems, focusedItem, context, showFloatingBar, setShowFloatingBar, openFormHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler) })] })] })] }), showApprovePopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onUpdate: onUpdate, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), op: 0, onClose: () => setShowApprovePopup(false) }), showRejectPopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onUpdate: onUpdate, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), op: 1, onClose: () => setShowRejectPopup(false) }), showReAssignPopup && _jsx(WorkFlowReAssignPopUp, { deviceType: deviceType, onUpdate: onUpdate, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), onClose: () => setShowReAssignPopup(false) })] }), _jsx(ConfirmFormatDialog, {}), _jsx(ConfirmAttachmentsDialog, {})] });
348
350
  const renderTMBlog = (handleTogglePanel) => _jsx(TMDcmtBlog, { tid: focusedItem?.TID, did: focusedItem?.DID });
349
351
  const renderTMSysMetadata = (handleTogglePanel) => _jsx(TMMetadataValues, { layoutMode: LayoutModes.Update, openChooserBySingleClick: true, TID: focusedItem?.TID, isReadOnly: true, deviceType: deviceType, metadataValues: currentMetadataValues.filter(o => (o.mid != undefined && o.mid <= 100)), metadataValuesOrig: currentMetadataValues.filter(o => (o.mid != undefined && o.mid <= 100)), validationItems: [] });
350
- const renderTMDcmtPreview = (handleTogglePanel) => _jsx(TMDcmtPreview, { onClose: () => { handleTogglePanel("TMDcmtPreview"); onClosePreviewPanel?.(); }, dcmtData: currentDcmt });
352
+ const renderTMDcmtPreview = (handleTogglePanel) => _jsx(TMDcmtPreview, { onClose: () => {
353
+ handleTogglePanel("TMDcmtPreview");
354
+ onClosePreviewPanel?.();
355
+ }, dcmtData: currentDcmt });
351
356
  const renderTMBatchUpdate = (handleTogglePanel) => _jsx(TMBatchUpdateForm, { inputDcmts: getSelectionDcmtInfo(), TID: focusedItem ? focusedItem?.TID : selectedItems[0]?.TID, DID: focusedItem ? focusedItem?.DID : selectedItems[0]?.DID, onBack: () => { handleTogglePanel("TMBatchUpdate"); }, onSavedCallbackAsync: async () => {
352
357
  setIsOpenBatchUpdate(false);
353
358
  setIsModifiedBatchUpdate(false);
@@ -370,15 +375,20 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
370
375
  allowMaximize: !isMobile,
371
376
  onBack: !isClosable ? onBack : undefined,
372
377
  onClose: isClosable ? onBack : undefined,
373
- toolbar: _jsxs(_Fragment, { children: [context !== SearchResultContext.METADATA_SEARCH && fromDTD?.templateTID === TemplateTIDs.WF_WIApprView && _jsx(WorkFlowOperationButtons, { deviceType: deviceType, onApprove: () => setShowApprovePopup(true), onReject: () => setShowRejectPopup(true), onReAssign: () => setShowReAssignPopup(true), approveDisable: disable, rejectDisable: disable, reassignDisable: disable, infoDisable: getSelectedDcmtsOrFocused(selectedItems, focusedItem).length !== 1 }), (dcmtsReturned != dcmtsFound) && _jsx("p", { style: { backgroundColor: `white`, color: TMColors.primaryColor, textAlign: 'center', padding: '1px 4px', borderRadius: '3px', display: 'flex' }, children: `${dcmtsReturned}/${dcmtsFound} restituiti` }), context === SearchResultContext.FAVORITES_AND_RECENTS &&
374
- _jsx("div", { style: { display: 'flex', alignItems: 'center', gap: '5px' }, children: _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconDelete, { color: 'white' }), caption: "Rimuovi da " + (selectedSearchResult?.category === "Favorites" ? '"Preferiti"' : '"Recenti"'), disabled: getSelectedDcmtsOrFocused(selectedItems, focusedItem).length <= 0, onClick: removeDcmtFromFavsOrRecents }) }), _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconRefresh, { color: 'white' }), caption: SDKUI_Localizator.Refresh, onClick: onRefreshSearchAsync }), _jsx(IconMenuVertical, { id: `commands-header-${id}`, color: 'white', cursor: 'pointer' }), _jsx(CommandsContextMenu, { target: `#commands-header-${id}`, menuItems: getCommandsMenuItems(fromDTD, selectedItems, focusedItem, context, showFloatingBar, setShowFloatingBar, openFormHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler) })] })
378
+ toolbar: searchResutlToolbar
375
379
  },
376
380
  },
377
381
  },
378
382
  {
379
383
  id: 'TMBlog',
380
384
  name: SDKUI_Localizator.BlogCase,
381
- toolbarOptions: { icon: _jsx(IconBoard, { fontSize: 24 }), disabled: !focusedItem?.DID, visible: true, isActive: false, orderNumber: 2 },
385
+ toolbarOptions: {
386
+ icon: _jsx(IconBoard, { fontSize: 24 }),
387
+ disabled: !focusedItem?.DID,
388
+ visible: true,
389
+ isActive: showBoard,
390
+ orderNumber: 2
391
+ },
382
392
  type: 'content',
383
393
  contentOptions: {
384
394
  visible: true,
@@ -395,7 +405,13 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
395
405
  {
396
406
  id: 'TMSysMetadata',
397
407
  name: SDKUI_Localizator.MetadataSystem,
398
- toolbarOptions: { icon: _jsx(IconDcmtTypeSys, { fontSize: 24 }), visible: true, disabled: !focusedItem?.DID, isActive: false, orderNumber: 3 },
408
+ toolbarOptions: {
409
+ icon: _jsx(IconDcmtTypeSys, { fontSize: 24 }),
410
+ visible: true,
411
+ disabled: !focusedItem?.DID,
412
+ isActive: showSysMetadata,
413
+ orderNumber: 3
414
+ },
399
415
  type: 'content',
400
416
  contentOptions: {
401
417
  visible: true,
@@ -412,7 +428,13 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
412
428
  {
413
429
  id: 'TMDcmtPreview',
414
430
  name: SDKUI_Localizator.PreviewDocument,
415
- toolbarOptions: { icon: _jsx(IconShow, { fontSize: 24 }), disabled: !focusedItem?.DID && fromDTD?.archiveConstraint === ArchiveConstraints.OnlyMetadata, visible: true, isActive: true, orderNumber: 4 },
431
+ toolbarOptions: {
432
+ icon: _jsx(IconShow, { fontSize: 24 }),
433
+ disabled: !focusedItem?.DID && fromDTD?.archiveConstraint === ArchiveConstraints.OnlyMetadata,
434
+ visible: true,
435
+ isActive: showPreview,
436
+ orderNumber: 4
437
+ },
416
438
  type: 'content',
417
439
  contentOptions: {
418
440
  visible: true,
@@ -465,6 +487,15 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
465
487
  },
466
488
  },
467
489
  ];
490
+ const getPanelMobile = () => {
491
+ if (showPreview)
492
+ return 'TMDcmtPreview';
493
+ if (showBoard)
494
+ return 'TMBlog';
495
+ if (showSysMetadata)
496
+ return 'TMSysMetadata';
497
+ return 'TMSearchResult';
498
+ };
468
499
  return (_jsxs(StyledMultiViewPanel, { "$isVisible": isVisible, children: [_jsx(StyledMultiViewPanel, { "$isVisible": !isOpenDcmtForm && !isOpenDetails && !isOpenMaster, style: {
469
500
  display: 'flex',
470
501
  flexDirection: isMobile ? 'column' : 'row',
@@ -472,7 +503,7 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
472
503
  gap: SDKUI_Globals.userSettings.themeSettings.gutters,
473
504
  width: '100%',
474
505
  height: '100%',
475
- }, children: _jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showWaitPanel, showWaitPanelPrimary: showPrimary, showWaitPanelSecondary: showSecondary, waitPanelTitle: waitPanelTitle, waitPanelTextPrimary: waitPanelTextPrimary, waitPanelValuePrimary: waitPanelValuePrimary, waitPanelMaxValuePrimary: waitPanelMaxValuePrimary, waitPanelTextSecondary: waitPanelTextSecondary, waitPanelValueSecondary: waitPanelValueSecondary, waitPanelMaxValueSecondary: waitPanelMaxValueSecondary, isCancelable: true, abortController: abortController, children: _jsx(TMPanelManager, { panels: panelsConfig, initialMobilePanelId: 'TMSearchResult', showToolbar: showSearchResultSidebar, toolbarMode: 1 }) }) }), _jsx(StyledMultiViewPanel, { "$isVisible": isOpenDetails, children: isOpenDetails && _jsx(TMMasterDetailDcmts, { deviceType: deviceType, isForMaster: false, inputDcmts: getSelectionDcmtInfo(), allowNavigation: focusedItem && selectedItems.length <= 0, canNext: canNavigateHandler('next'), canPrev: canNavigateHandler('prev'), onNext: () => onNavigateHandler('next'), onPrev: () => onNavigateHandler('prev'), onBack: () => setIsOpenDetails(false) }) }), _jsxs(StyledMultiViewPanel, { "$isVisible": isOpenMaster, children: [isOpenMaster && _jsx(TMMasterDetailDcmts, { deviceType: deviceType, inputDcmts: getSelectionDcmtInfo(), isForMaster: true, allowNavigation: focusedItem && selectedItems.length <= 0, canNext: canNavigateHandler('next'), canPrev: canNavigateHandler('prev'), onNext: () => onNavigateHandler('next'), onPrev: () => onNavigateHandler('prev'), onBack: () => setIsOpenMaster(false), appendMasterDcmts: handleAddItem }), secondaryMasterDcmts.length > 0 && secondaryMasterDcmts.map((dcmt, index) => {
506
+ }, children: _jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showWaitPanel, showWaitPanelPrimary: showPrimary, showWaitPanelSecondary: showSecondary, waitPanelTitle: waitPanelTitle, waitPanelTextPrimary: waitPanelTextPrimary, waitPanelValuePrimary: waitPanelValuePrimary, waitPanelMaxValuePrimary: waitPanelMaxValuePrimary, waitPanelTextSecondary: waitPanelTextSecondary, waitPanelValueSecondary: waitPanelValueSecondary, waitPanelMaxValueSecondary: waitPanelMaxValueSecondary, isCancelable: true, abortController: abortController, children: _jsx(TMPanelManager, { panels: panelsConfig, initialMobilePanelId: getPanelMobile(), showToolbar: showSearchResultSidebar, toolbarMode: 1 }) }) }), _jsx(StyledMultiViewPanel, { "$isVisible": isOpenDetails, children: isOpenDetails && _jsx(TMMasterDetailDcmts, { deviceType: deviceType, isForMaster: false, inputDcmts: getSelectionDcmtInfo(), allowNavigation: focusedItem && selectedItems.length <= 0, canNext: canNavigateHandler('next'), canPrev: canNavigateHandler('prev'), onNext: () => onNavigateHandler('next'), onPrev: () => onNavigateHandler('prev'), onBack: () => setIsOpenDetails(false) }) }), _jsxs(StyledMultiViewPanel, { "$isVisible": isOpenMaster, children: [isOpenMaster && _jsx(TMMasterDetailDcmts, { deviceType: deviceType, inputDcmts: getSelectionDcmtInfo(), isForMaster: true, allowNavigation: focusedItem && selectedItems.length <= 0, canNext: canNavigateHandler('next'), canPrev: canNavigateHandler('prev'), onNext: () => onNavigateHandler('next'), onPrev: () => onNavigateHandler('prev'), onBack: () => setIsOpenMaster(false), appendMasterDcmts: handleAddItem }), secondaryMasterDcmts.length > 0 && secondaryMasterDcmts.map((dcmt, index) => {
476
507
  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}`));
477
508
  })] }), _jsx(StyledMultiViewPanel, { "$isVisible": isOpenDcmtForm, children: isOpenDcmtForm && _jsx(TMDcmtForm, { TID: focusedItem?.TID, DID: focusedItem?.DID, layoutMode: dcmtFormLayoutMode, showPreview: deviceType !== DeviceType.MOBILE, count: visibleItems.length, itemIndex: visibleItems.findIndex(o => o.rowIndex === focusedItem?.rowIndex) + 1, canNext: canNavigateHandler('next'), canPrev: canNavigateHandler('prev'), onNext: () => onNavigateHandler('next'), onPrev: () => onNavigateHandler('prev'), onClose: () => { setIsOpenDcmtForm(false); }, onSavedAsyncCallback: async (tid, did) => { await refreshFocusedDataRowAsync(tid, did, true); } }) })] }));
478
509
  };
@@ -4,11 +4,13 @@ import { useEffect, useState } from 'react';
4
4
  import ReactDOMServer from 'react-dom/server';
5
5
  import { DcmtTypeListCacheService } from '@topconsultnpm/sdk-ts-beta';
6
6
  import ContextMenu from 'devextreme-react/cjs/context-menu';
7
- import { IconDelete, SDKUI_Localizator, IconApply, IconInfo } from '../../helper';
7
+ import { IconDelete, SDKUI_Localizator, IconApply, IconInfo, IconCloseOutline } from '../../helper';
8
8
  import { TMColors } from '../../utils/theme';
9
9
  import { DeviceType } from '../base/TMDeviceProvider';
10
10
  import { TMDcmtTypeChooserForm } from '../choosers/TMDcmtTypeChooser';
11
- import TMTidViewer, { TMDcmtTypeTooltip } from '../viewers/TMTidViewer';
11
+ import TMTidViewer, { renderDTDTooltipContent, TMDcmtTypeTooltip } from '../viewers/TMTidViewer';
12
+ import { StyledDivHorizontal, StyledOffCanvasPanel } from '../base/Styled';
13
+ import { useOutsideClick } from '../../hooks/useOutsideClick';
12
14
  const StyledRecentTidItem = styled.div `
13
15
  display: flex;
14
16
  flex-direction: column;
@@ -27,9 +29,13 @@ const StyledRecentTidItem = styled.div `
27
29
  left: -7px;
28
30
  top: 50%;
29
31
  transform: translateY(-50%);
30
- opacity: ${({ $isMobile }) => ($isMobile ? 1 : 0)};
32
+ opacity: 0;
31
33
  transition: opacity 0.2s;
32
- pointer-events: ${({ $isMobile }) => ($isMobile ? 'auto' : 'none')};
34
+ pointer-events: none;
35
+ // On mobile, never show
36
+ ${({ $isMobile }) => $isMobile && `
37
+ display: none !important;
38
+ `}
33
39
  }
34
40
 
35
41
  &:hover .info-icon {
@@ -46,13 +52,18 @@ const iconDelete = () => ReactDOMServer.renderToString(_jsx(IconDelete, {}));
46
52
  const TMRecentsManager = ({ deviceType, mruTIDs, currentMruTID, onSelectedTID, onDeletedTID }) => {
47
53
  const [showDcmtTypeChooser, setShowDcmtTypeChooser] = useState(false);
48
54
  const [recentDcmtTypes, setRecentDcmtTypes] = useState([]);
55
+ const [infoDTD, setInfoDTD] = useState();
49
56
  useEffect(() => {
50
57
  DcmtTypeListCacheService.GetAllWithoutMetadataAsync().then((allTypes) => {
51
58
  const filtered = allTypes.filter(dt => mruTIDs.includes(dt.id));
52
59
  setRecentDcmtTypes(filtered);
53
60
  });
54
61
  }, [mruTIDs]);
55
- return (_jsxs(_Fragment, { children: [_jsxs("div", { style: { overflowY: deviceType === DeviceType.MOBILE ? 'auto' : undefined, display: 'flex', flexDirection: 'column', padding: '5px', width: '100%' }, children: [_jsx(StyledRecentTidItem, { id: `tid-${0}`, "$isMobile": deviceType === DeviceType.MOBILE, onClick: () => { setShowDcmtTypeChooser(true); }, children: _jsx("div", { style: { display: 'flex', alignItems: 'center', justifyContent: 'center', width: '100%' }, children: _jsx("p", { style: {
62
+ const panelRef = useOutsideClick(() => {
63
+ setInfoDTD(undefined);
64
+ });
65
+ const isMobile = deviceType === DeviceType.MOBILE;
66
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { style: { overflowY: isMobile ? 'auto' : undefined, display: 'flex', flexDirection: 'column', padding: '5px', width: '100%' }, children: [_jsx(StyledRecentTidItem, { id: `tid-${0}`, "$isMobile": isMobile, onClick: () => { setShowDcmtTypeChooser(true); }, children: _jsx("div", { style: { display: 'flex', alignItems: 'center', justifyContent: 'center', width: '100%' }, children: _jsx("p", { style: {
56
67
  color: TMColors.primaryColor,
57
68
  fontSize: '1rem',
58
69
  fontWeight: 600,
@@ -60,7 +71,20 @@ const TMRecentsManager = ({ deviceType, mruTIDs, currentMruTID, onSelectedTID, o
60
71
  overflow: 'hidden',
61
72
  textOverflow: 'ellipsis'
62
73
  }, children: `${SDKUI_Localizator.AllDcmtTypes} (${DcmtTypeListCacheService.CacheCount(true)})` }) }) }, 0), recentDcmtTypes.map((dtd) => {
63
- return (_jsxs(StyledRecentTidItem, { id: `tid-${dtd.id}`, onClick: () => { onSelectedTID?.(dtd.id ?? 0); }, children: [_jsx("span", { className: "info-icon", children: _jsx(TMDcmtTypeTooltip, { dtd: dtd, children: _jsx(IconInfo, { color: TMColors.primaryColor }) }) }), _jsx("div", { style: { display: 'flex', justifyContent: 'center', width: '100%' }, children: _jsx(TMTidViewer, { tid: dtd.id, color: TMColors.primaryColor, showIcon: false }) }), _jsx(ContextMenu, { dataSource: [{ text: SDKUI_Localizator.Remove, icon: iconDelete(), }], target: `#tid-${dtd.id}`, onItemClick: () => { onDeletedTID?.(dtd.id ?? 0); } }), currentMruTID == dtd.id &&
74
+ return (_jsxs(StyledRecentTidItem, { id: `tid-${dtd.id}`, "$isMobile": isMobile, onClick: () => { onSelectedTID?.(dtd.id ?? 0); }, children: [_jsx("span", { className: "info-icon", children: _jsx(TMDcmtTypeTooltip, { dtd: dtd, children: _jsx(IconInfo, { color: TMColors.info }) }) }), _jsx("div", { style: { display: 'flex', justifyContent: 'center', width: '100%' }, children: _jsx(TMTidViewer, { tid: dtd.id, color: TMColors.primaryColor, showIcon: false }) }), _jsx(ContextMenu, { dataSource: [
75
+ {
76
+ text: SDKUI_Localizator.Remove,
77
+ icon: iconDelete(),
78
+ onClick: () => { onDeletedTID?.(dtd.id ?? 0); }
79
+ },
80
+ ...(isMobile ? [
81
+ {
82
+ text: SDKUI_Localizator.About,
83
+ icon: ReactDOMServer.renderToString(_jsx(IconInfo, { color: TMColors.info })),
84
+ onClick: () => { setInfoDTD(dtd); }
85
+ }
86
+ ] : [])
87
+ ], target: `#tid-${dtd.id}` }), currentMruTID == dtd.id &&
64
88
  _jsx("div", { style: {
65
89
  width: '24px',
66
90
  height: '24px',
@@ -74,6 +98,6 @@ const TMRecentsManager = ({ deviceType, mruTIDs, currentMruTID, onSelectedTID, o
74
98
  fontSize: '1rem',
75
99
  fontWeight: 'bold'
76
100
  }, children: _jsx(IconApply, { fontSize: 24, color: 'green' }) })] }, dtd.id));
77
- })] }), showDcmtTypeChooser && _jsx(TMDcmtTypeChooserForm, { onClose: () => setShowDcmtTypeChooser(false), onChoose: (tids) => { onSelectedTID?.(tids?.[0] ?? 0); } })] }));
101
+ })] }), showDcmtTypeChooser && _jsx(TMDcmtTypeChooserForm, { onClose: () => setShowDcmtTypeChooser(false), onChoose: (tids) => { onSelectedTID?.(tids?.[0] ?? 0); } }), _jsxs(StyledOffCanvasPanel, { ref: panelRef, "$isOpen": isMobile && infoDTD !== undefined, children: [_jsxs(StyledDivHorizontal, { style: { gap: 10, padding: '10px 8px', width: '100%', alignItems: 'center' }, children: [_jsx("p", { style: { fontSize: '1.1rem', fontWeight: 'bold' }, children: `${SDKUI_Localizator.DcmtType} - ${SDKUI_Localizator.About}` }), _jsx(IconCloseOutline, { style: { marginLeft: 'auto', cursor: 'pointer' }, onClick: () => setInfoDTD(undefined) })] }), renderDTDTooltipContent(infoDTD)] })] }));
78
102
  };
79
103
  export default TMRecentsManager;
@@ -0,0 +1,39 @@
1
+ import React, { ReactNode } from 'react';
2
+ type TMPanelManagerNewProps = {
3
+ children: ReactNode;
4
+ showToolbar?: boolean;
5
+ emptyContent?: ReactNode;
6
+ };
7
+ type TMPanelGroupProps = {
8
+ orientation?: 'horizontal' | 'vertical';
9
+ allowItemResize?: boolean;
10
+ gutters?: number;
11
+ panelVisibility?: boolean[];
12
+ onTogglePanel?: (idx: number) => void;
13
+ panelLabels?: string[];
14
+ children: ReactNode;
15
+ parentVisibility?: boolean;
16
+ parentPanelCount?: number;
17
+ parentPanelVisibility?: boolean[];
18
+ parentOnTogglePanel?: (idx: number, path: number[]) => void;
19
+ path?: number[];
20
+ };
21
+ type TMPanelItemProps = {
22
+ width?: string;
23
+ height?: string;
24
+ minWidth?: string;
25
+ minHeight?: string;
26
+ children: ReactNode;
27
+ style?: React.CSSProperties;
28
+ label?: string;
29
+ };
30
+ export declare const TMPanelItem: React.FC<TMPanelItemProps>;
31
+ export declare const TMPanelGroup: React.FC<TMPanelGroupProps>;
32
+ declare const TMPanelLayout: React.FC<TMPanelManagerNewProps>;
33
+ export default TMPanelLayout;
34
+ type TMPanelLayoutToolbarProps = {
35
+ panelLabels: string[];
36
+ panelVisibility: boolean[];
37
+ onTogglePanel: (idx: number) => void;
38
+ };
39
+ export declare const TMPanelLayoutToolbar: React.FC<TMPanelLayoutToolbarProps>;
@@ -0,0 +1,320 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React, { useRef, useState, Children, cloneElement, isValidElement, useEffect, useMemo, } from 'react';
3
+ import { SDKUI_Globals } from '../../helper';
4
+ export const TMPanelItem = (props) => (_jsx("div", { style: {
5
+ flexBasis: props.width || props.height || 'auto',
6
+ minWidth: props.minWidth,
7
+ minHeight: props.minHeight,
8
+ flexGrow: 0,
9
+ flexShrink: 0,
10
+ height: '100%',
11
+ width: '100%',
12
+ overflow: 'auto',
13
+ position: 'relative',
14
+ boxSizing: 'border-box',
15
+ display: 'flex',
16
+ flexDirection: 'column',
17
+ ...props.style,
18
+ }, children: props.children }));
19
+ // Utility: recursively determine if a child is a group
20
+ function isGroup(child) {
21
+ return child?.type?.displayName === 'TMPanelGroup';
22
+ }
23
+ TMPanelItem.displayName = 'TMPanelItem';
24
+ export const TMPanelGroup = ({ orientation = 'horizontal', allowItemResize = false, gutters = SDKUI_Globals.userSettings.themeSettings.gutters, panelVisibility, onTogglePanel, panelLabels, children, parentVisibility = true, parentPanelCount, parentPanelVisibility, parentOnTogglePanel, path = [], ...rest }) => {
25
+ const childArray = Children.toArray(children).filter(Boolean);
26
+ const panelCount = childArray.length;
27
+ // Initial sizes in percent
28
+ const [sizes, setSizes] = useState(childArray.map((child) => orientation === 'horizontal'
29
+ ? child.props.width
30
+ ? parseFloat(child.props.width)
31
+ : 100 / panelCount
32
+ : child.props.height
33
+ ? parseFloat(child.props.height)
34
+ : 100 / panelCount));
35
+ // Compute effective visibility for each child (recursively for groups)
36
+ const effectiveVisibility = childArray.map((child, idx) => {
37
+ if (isValidElement(child) && isGroup(child)) {
38
+ // For nested groups, pass down visibility
39
+ return !panelVisibility || panelVisibility[idx];
40
+ }
41
+ return !panelVisibility || panelVisibility[idx];
42
+ });
43
+ // Recursively render children, and collect which are visible
44
+ const renderedPanels = [];
45
+ const renderedSizes = [];
46
+ const renderedPaths = [];
47
+ let accHidden = 0;
48
+ for (let i = 0; i < panelCount; i++) {
49
+ const child = childArray[i];
50
+ const visible = effectiveVisibility[i];
51
+ let childIsVisible = visible;
52
+ let renderedChild = child;
53
+ let childPath = [...path, i];
54
+ if (isValidElement(child) && isGroup(child)) {
55
+ // Recursively render group
56
+ renderedChild = cloneElement(child, {
57
+ parentVisibility: visible,
58
+ parentPanelCount: panelCount,
59
+ parentPanelVisibility: panelVisibility,
60
+ parentOnTogglePanel: parentOnTogglePanel || onTogglePanel,
61
+ path: childPath,
62
+ });
63
+ // If the group renders nothing, treat as hidden
64
+ // We'll check after rendering below
65
+ }
66
+ // For groups, check if they actually rendered anything
67
+ let actuallyVisible = childIsVisible;
68
+ if (isValidElement(child) && isGroup(child)) {
69
+ // If the group is not visible (returns null), treat as hidden
70
+ // We'll check after rendering below
71
+ // For now, optimistically add, and filter after
72
+ renderedPanels.push(renderedChild);
73
+ renderedSizes.push(sizes[i] + accHidden);
74
+ renderedPaths.push(childPath);
75
+ accHidden = 0;
76
+ }
77
+ else if (childIsVisible) {
78
+ renderedPanels.push(renderedChild);
79
+ renderedSizes.push(sizes[i] + accHidden);
80
+ renderedPaths.push(childPath);
81
+ accHidden = 0;
82
+ }
83
+ else {
84
+ accHidden += sizes[i];
85
+ }
86
+ }
87
+ // Remove panels that are null (hidden nested groups)
88
+ let filteredPanels = [];
89
+ let filteredSizes = [];
90
+ let filteredPaths = [];
91
+ let filteredAccHidden = 0;
92
+ for (let i = 0; i < renderedPanels.length; i++) {
93
+ if (renderedPanels[i] !== null && renderedPanels[i] !== undefined) {
94
+ filteredPanels.push(renderedPanels[i]);
95
+ filteredSizes.push(renderedSizes[i] + filteredAccHidden);
96
+ filteredPaths.push(renderedPaths[i]);
97
+ filteredAccHidden = 0;
98
+ }
99
+ else {
100
+ filteredAccHidden += renderedSizes[i];
101
+ }
102
+ }
103
+ // --- CORRECTED MERGING LOGIC ---
104
+ // Merge hidden panel sizes into the nearest visible sibling (prefer previous, else next)
105
+ const mergedPanels = [];
106
+ const mergedSizes = [];
107
+ const mergedPaths = [];
108
+ for (let i = 0; i < filteredPanels.length; i++) {
109
+ if (filteredPanels[i] !== null && filteredPanels[i] !== undefined) {
110
+ mergedPanels.push(filteredPanels[i]);
111
+ mergedSizes.push(filteredSizes[i]);
112
+ mergedPaths.push(filteredPaths[i]);
113
+ }
114
+ else {
115
+ // Hidden panel: merge its size into previous visible, or next if first
116
+ if (mergedPanels.length > 0) {
117
+ mergedSizes[mergedSizes.length - 1] += filteredSizes[i];
118
+ }
119
+ else {
120
+ // No previous, merge into next visible
121
+ let j = i + 1;
122
+ while (j < filteredPanels.length &&
123
+ (filteredPanels[j] === null || filteredPanels[j] === undefined)) {
124
+ j++;
125
+ }
126
+ if (j < filteredPanels.length) {
127
+ // Next visible found
128
+ if (filteredSizes[j] !== undefined) {
129
+ filteredSizes[j] += filteredSizes[i];
130
+ }
131
+ }
132
+ }
133
+ }
134
+ }
135
+ // If nothing is visible, tell parent to treat this group as hidden
136
+ if (mergedPanels.length === 0 || parentVisibility === false) {
137
+ return null;
138
+ }
139
+ // Resizing logic (same as before, but for visible panels)
140
+ const containerRef = useRef(null);
141
+ const [dragIndex, setDragIndex] = useState(null);
142
+ const [startPos, setStartPos] = useState(0);
143
+ const [startSizes, setStartSizes] = useState([]);
144
+ const handleMouseDown = (idx) => (e) => {
145
+ setDragIndex(idx);
146
+ setStartSizes([...mergedSizes]);
147
+ setStartPos(orientation === 'horizontal' ? e.clientX : e.clientY);
148
+ document.body.style.userSelect = 'none';
149
+ };
150
+ useEffect(() => {
151
+ if (dragIndex === null)
152
+ return;
153
+ const handleMouseMove = (e) => {
154
+ if (!containerRef.current)
155
+ return;
156
+ const rect = containerRef.current.getBoundingClientRect();
157
+ const total = orientation === 'horizontal' ? rect.width : rect.height;
158
+ const currentPos = orientation === 'horizontal' ? e.clientX : e.clientY;
159
+ const deltaPx = currentPos - startPos;
160
+ const deltaPercent = (deltaPx / total) * 100;
161
+ let newSizes = [...startSizes];
162
+ let left = Math.max(5, startSizes[dragIndex] + deltaPercent);
163
+ let right = Math.max(5, startSizes[dragIndex + 1] - deltaPercent);
164
+ // Prevent overflow
165
+ const sum = startSizes[dragIndex] + startSizes[dragIndex + 1];
166
+ if (left + right > sum) {
167
+ if (left > sum - 5)
168
+ left = sum - 5;
169
+ if (right > sum - 5)
170
+ right = sum - 5;
171
+ }
172
+ newSizes[dragIndex] = left;
173
+ newSizes[dragIndex + 1] = right;
174
+ // Update the original sizes array for all panels
175
+ let newAllSizes = [...sizes];
176
+ let visIdx = 0;
177
+ for (let k = 0; k < panelCount; k++) {
178
+ if (effectiveVisibility[k]) {
179
+ // Only update for visible panels
180
+ newAllSizes[k] = newSizes[visIdx++];
181
+ }
182
+ }
183
+ setSizes(newAllSizes);
184
+ };
185
+ const handleMouseUp = () => {
186
+ setDragIndex(null);
187
+ document.body.style.userSelect = '';
188
+ };
189
+ window.addEventListener('mousemove', handleMouseMove);
190
+ window.addEventListener('mouseup', handleMouseUp);
191
+ return () => {
192
+ window.removeEventListener('mousemove', handleMouseMove);
193
+ window.removeEventListener('mouseup', handleMouseUp);
194
+ };
195
+ }, [dragIndex, orientation, startPos, startSizes, effectiveVisibility, sizes, panelCount]);
196
+ return (_jsx("div", { ref: containerRef, style: {
197
+ display: 'flex',
198
+ flexDirection: orientation === 'horizontal' ? 'row' : 'column',
199
+ width: '100%',
200
+ height: '100%',
201
+ position: 'relative',
202
+ overflow: 'hidden',
203
+ gap: allowItemResize ? 0 : gutters,
204
+ }, ...rest, children: mergedPanels.map((child, idx) => (_jsxs(React.Fragment, { children: [isValidElement(child) && !isGroup(child)
205
+ ? cloneElement(child, {
206
+ style: {
207
+ ...(child.props.style || {}),
208
+ flexBasis: `${mergedSizes[idx]}%`,
209
+ height: orientation === 'vertical'
210
+ ? `${mergedSizes[idx]}%`
211
+ : '100%',
212
+ width: orientation === 'horizontal'
213
+ ? `${mergedSizes[idx]}%`
214
+ : '100%',
215
+ },
216
+ })
217
+ : child, allowItemResize && idx < mergedPanels.length - 1 && (_jsx("div", { style: {
218
+ cursor: orientation === 'horizontal'
219
+ ? 'col-resize'
220
+ : 'row-resize',
221
+ background: 'transparent',
222
+ width: orientation === 'horizontal' ? gutters : '100%',
223
+ height: orientation === 'vertical' ? gutters : '100%',
224
+ zIndex: 10,
225
+ userSelect: 'none',
226
+ flexShrink: 0,
227
+ flexGrow: 0,
228
+ borderRadius: 3,
229
+ minHeight: orientation === 'horizontal' ? '100%' : gutters,
230
+ minWidth: orientation === 'vertical' ? '100%' : gutters,
231
+ }, onMouseDown: handleMouseDown(idx) }))] }, mergedPaths[idx].join('-')))) }));
232
+ };
233
+ TMPanelGroup.displayName = 'TMPanelGroup';
234
+ function getAllPanelPaths(children, path = []) {
235
+ const arr = Children.toArray(children).filter(Boolean);
236
+ let result = [];
237
+ arr.forEach((child, idx) => {
238
+ if (isValidElement(child) && isGroup(child)) {
239
+ result = result.concat(getAllPanelPaths(child.props.children, [...path, idx]));
240
+ }
241
+ else if (isValidElement(child)) {
242
+ result.push({ label: child.props?.label || `Panel ${path.concat(idx).join('-')}`, path: path.concat(idx) });
243
+ }
244
+ });
245
+ return result;
246
+ }
247
+ const TMPanelLayout = ({ children, showToolbar = true, emptyContent, }) => {
248
+ // Only support a single TMPanelGroup as direct child for simplicity
249
+ const group = Children.only(children);
250
+ const childArray = Children.toArray(group.props.children).filter(Boolean);
251
+ // Build a flat list of all panel paths and labels for the toolbar
252
+ const allPanels = useMemo(() => getAllPanelPaths(group.props.children), [group.props.children]);
253
+ const [panelVisibility, setPanelVisibility] = useState(childArray.map(() => true));
254
+ // Helper to check if all panels (recursively) are hidden
255
+ function isAllPanelsHidden() {
256
+ // For now, just check top-level
257
+ return panelVisibility.every(v => !v);
258
+ }
259
+ // Toggle panel visibility by path (only top-level supported for now)
260
+ const handleTogglePanel = (idx) => {
261
+ setPanelVisibility((prev) => {
262
+ if (prev.filter(Boolean).length === 1 && prev[idx])
263
+ return prev;
264
+ const newArr = [...prev];
265
+ newArr[idx] = !newArr[idx];
266
+ return newArr;
267
+ });
268
+ };
269
+ // For nested: you can extend this to track nested visibility state if needed
270
+ const allHidden = isAllPanelsHidden();
271
+ return (_jsx("div", { style: {
272
+ width: '100%',
273
+ height: '100%',
274
+ position: 'relative',
275
+ overflow: 'hidden',
276
+ display: 'flex',
277
+ flexDirection: 'column',
278
+ }, children: _jsxs("div", { style: { width: '100%', height: '100%', position: 'relative' }, children: [!allHidden &&
279
+ cloneElement(group, {
280
+ panelVisibility,
281
+ onTogglePanel: handleTogglePanel,
282
+ panelLabels: allPanels.map(p => p.label),
283
+ }), showToolbar && (_jsx("div", { style: {
284
+ position: 'absolute',
285
+ top: 10,
286
+ right: 10,
287
+ zIndex: 1000,
288
+ background: 'rgba(255,255,255,0.9)',
289
+ borderRadius: 8,
290
+ boxShadow: '0 2px 8px #0002',
291
+ padding: 8,
292
+ display: 'flex',
293
+ flexDirection: 'column',
294
+ gap: 8,
295
+ }, children: _jsx(TMPanelLayoutToolbar, { panelLabels: allPanels.map(p => p.label), panelVisibility: panelVisibility, onTogglePanel: handleTogglePanel }) })), allHidden && (_jsx("div", { style: {
296
+ position: 'absolute',
297
+ left: 0,
298
+ top: 0,
299
+ width: '100%',
300
+ height: '100%',
301
+ background: '#fafbfc',
302
+ display: 'flex',
303
+ alignItems: 'center',
304
+ justifyContent: 'center',
305
+ zIndex: 1,
306
+ }, children: emptyContent || (_jsx("span", { style: { color: '#888', fontSize: 18 }, children: "No panels visible" })) }))] }) }));
307
+ };
308
+ export default TMPanelLayout;
309
+ export const TMPanelLayoutToolbar = ({ panelLabels, panelVisibility, onTogglePanel, }) => {
310
+ return (_jsx("div", { children: panelLabels.map((label, idx) => (_jsxs("button", { style: {
311
+ margin: 2,
312
+ padding: '4px 10px',
313
+ borderRadius: 4,
314
+ border: panelVisibility[idx] ? '2px solid #1976d2' : '1px solid #bbb',
315
+ background: panelVisibility[idx] ? '#1976d2' : '#eee',
316
+ color: panelVisibility[idx] ? '#fff' : '#555',
317
+ cursor: 'pointer',
318
+ opacity: 1,
319
+ }, onClick: () => onTogglePanel(idx), children: [panelVisibility[idx] ? 'Hide' : 'Show', " ", label] }, idx))) }));
320
+ };
@@ -251,3 +251,4 @@ declare const TMTidViewer: ({ tmSession, tid, showIcon, color, showId, noneSelec
251
251
  }) => import("react/jsx-runtime").JSX.Element;
252
252
  export default TMTidViewer;
253
253
  export declare const cellRenderTID: (data: DataGridTypes.ColumnCellTemplateData, noneSelectionText?: string) => import("react/jsx-runtime").JSX.Element;
254
+ export declare const renderDTDTooltipContent: (dtd: DcmtTypeDescriptor | undefined) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useEffect, useState } from 'react';
3
3
  import { IconDcmtType, IconDcmtTypeOnlyMetadata, LocalizeArchiveConstraints, LocalizeParametricFilterTypes, SDKUI_Localizator, TMImageLibrary } from '../../helper';
4
4
  import { ArchiveConstraints, DcmtTypeListCacheService, OwnershipLevels, ParametricFilterTypes, SDK_Globals, SDK_Localizator, TemplateTIDs } from '@topconsultnpm/sdk-ts-beta';
@@ -256,15 +256,7 @@ export const TMDcmtTypeIcon = ({ dtd }) => {
256
256
  return (_jsx(TMDcmtTypeTooltip, { dtd: dtd, children: icon }));
257
257
  };
258
258
  export const TMDcmtTypeTooltip = ({ dtd, children }) => {
259
- const renderTooltipContent = (dtd) => {
260
- return (!dtd ? null
261
- : _jsxs(StyledTooltipContainer, { children: [_jsx(StyledTooltipItem, { children: `${SDK_Globals.useLocalizedName ? dtd.nameLoc : dtd.name} (${dtd.isView ? 'VID' : 'TID'}: ${dtd.id}, RootTID: ${dtd.rootTID ?? 0})` }), dtd.description && _jsx(StyledTooltipItem, { children: dtd.description }), _jsx(StyledTooltipSeparatorItem, {}), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.ArchiveConstraint}: ${LocalizeArchiveConstraints(dtd.archiveConstraint)}` }), dtd.isView && dtd.parametricFilterType != ParametricFilterTypes.None && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.ParametricFilter}: ${LocalizeParametricFilterTypes(dtd.parametricFilterType)}` }), dtd.isView && dtd.withCheckOption && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.ViewWithCheckOption}: ${SDKUI_Localizator.Yes}` }), dtd.isLexProt && dtd.isLexProt > 0 && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.LexProt}: ${SDKUI_Localizator.Yes}` }), dtd.isFreeSearchable && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Search_Free}: ${SDKUI_Localizator.Yes}` }), dtd.templateTID && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Template}: ${dtd.templateTID}` }), dtd.traceTID && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Tracing}: ${SDKUI_Localizator.Yes} - ${dtd.templateTID == TemplateTIDs.Trace_DcmtType ? SDKUI_Localizator.Destination : SDKUI_Localizator.Source} ${dtd.traceTID < 0 ? SDKUI_Localizator.Disabled : ''}` }), dtd.wfAppr && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.WorkflowApproval}: ${SDKUI_Localizator.Yes}` }), dtd.hasBlog && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.BlogCase}: ${SDKUI_Localizator.Yes}` }), dtd.cico && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.CheckIn}: ${SDKUI_Localizator.Yes}` }), dtd.perm ?
262
- _jsxs(_Fragment, { children: [_jsx(StyledTooltipItem, { "$color": 'primary', "$marginTop": '5px', children: SDKUI_Localizator.Perms }), _jsx(StyledTooltipSeparatorItem, {}), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Archive}: ${dtd.perm.canArchive}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.View_Metadato}: ${dtd.perm.canView}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Search}: ${dtd.perm.canSearch}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Update}: ${dtd.perm.canUpdate}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.RetrieveFile}: ${dtd.perm.canRetrieveFile}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.AddOrSubstFile}: ${dtd.perm.canSubstFile}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.LogDelete}: ${dtd.perm.canLogicalDelete}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.PhysDelete}: ${dtd.perm.canPhysicalDelete}` }), dtd.hasBlog && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Blog_Read}: ${dtd.perm.canReadBlog}` }), dtd.hasBlog && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Blog_Write}: ${dtd.perm.canWriteBlog}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.CheckIn}: ${dtd.perm.canCICO}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.ChronologyDelete}: ${dtd.perm.canDelChron}` })] })
263
- : dtd.ownershipLevel == OwnershipLevels.DirectOwner || dtd.ownershipLevel == OwnershipLevels.IndirectOwner ?
264
- _jsxs(_Fragment, { children: [_jsx(StyledTooltipItem, { "$color": 'primary', "$marginTop": '5px', children: SDKUI_Localizator.Perms }), _jsx(StyledTooltipSeparatorItem, {}), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Archive}: ${SDKUI_Localizator.Yes}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.View_Metadato}: ${SDKUI_Localizator.Yes}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Search}: ${SDKUI_Localizator.Yes}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Update}: ${SDKUI_Localizator.Yes}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.RetrieveFile}: ${SDKUI_Localizator.Yes}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.AddOrSubstFile}: ${SDKUI_Localizator.Yes}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.LogDelete}: ${SDKUI_Localizator.Yes}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.PhysDelete}: ${SDKUI_Localizator.Yes}` }), dtd.hasBlog && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Blog_Read}: ${SDKUI_Localizator.Yes}` }), dtd.hasBlog && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Blog_Write}: ${SDKUI_Localizator.Yes}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.CheckIn}: ${SDKUI_Localizator.Yes}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.ChronologyDelete}: ${SDKUI_Localizator.Yes}` })] })
265
- : _jsx(_Fragment, {})] }));
266
- };
267
- return (_jsx("div", { style: { pointerEvents: 'all' }, children: _jsx(TMTooltip, { content: renderTooltipContent(dtd), children: children }) }));
259
+ return (_jsx("div", { style: { pointerEvents: 'all' }, children: _jsx(TMTooltip, { content: renderDTDTooltipContent(dtd), children: children }) }));
268
260
  };
269
261
  const TMTidViewer = ({ tmSession, tid, showIcon = false, color, showId = false, noneSelectionText = `<${SDKUI_Localizator.NoneSelection}>` }) => {
270
262
  const [dtd, setDtd] = useState();
@@ -305,3 +297,11 @@ export default TMTidViewer;
305
297
  export const cellRenderTID = (data, noneSelectionText) => {
306
298
  return (_jsx(TMTidViewer, { tid: data.value, noneSelectionText: noneSelectionText }));
307
299
  };
300
+ export const renderDTDTooltipContent = (dtd) => {
301
+ return (!dtd ? null
302
+ : _jsxs(StyledTooltipContainer, { children: [_jsx(StyledTooltipItem, { children: `${SDK_Globals.useLocalizedName ? dtd.nameLoc : dtd.name} (${dtd.isView ? 'VID' : 'TID'}: ${dtd.id}, RootTID: ${dtd.rootTID ?? 0})` }), dtd.description && _jsx(StyledTooltipItem, { children: dtd.description }), _jsx(StyledTooltipSeparatorItem, {}), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.ArchiveConstraint}: ${LocalizeArchiveConstraints(dtd.archiveConstraint)}` }), dtd.isView && dtd.parametricFilterType != ParametricFilterTypes.None && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.ParametricFilter}: ${LocalizeParametricFilterTypes(dtd.parametricFilterType)}` }), dtd.isView && dtd.withCheckOption && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.ViewWithCheckOption}: ${SDKUI_Localizator.Yes}` }), dtd.isLexProt && dtd.isLexProt > 0 && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.LexProt}: ${SDKUI_Localizator.Yes}` }), dtd.isFreeSearchable && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Search_Free}: ${SDKUI_Localizator.Yes}` }), dtd.templateTID && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Template}: ${dtd.templateTID}` }), dtd.traceTID && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Tracing}: ${SDKUI_Localizator.Yes} - ${dtd.templateTID == TemplateTIDs.Trace_DcmtType ? SDKUI_Localizator.Destination : SDKUI_Localizator.Source} ${dtd.traceTID < 0 ? SDKUI_Localizator.Disabled : ''}` }), dtd.wfAppr && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.WorkflowApproval}: ${SDKUI_Localizator.Yes}` }), dtd.hasBlog && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.BlogCase}: ${SDKUI_Localizator.Yes}` }), dtd.cico && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.CheckIn}: ${SDKUI_Localizator.Yes}` }), dtd.perm ?
303
+ _jsxs(_Fragment, { children: [_jsx(StyledTooltipItem, { "$color": 'primary', "$marginTop": '5px', children: SDKUI_Localizator.Perms }), _jsx(StyledTooltipSeparatorItem, {}), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Archive}: ${dtd.perm.canArchive}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.View_Metadato}: ${dtd.perm.canView}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Search}: ${dtd.perm.canSearch}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Update}: ${dtd.perm.canUpdate}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.RetrieveFile}: ${dtd.perm.canRetrieveFile}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.AddOrSubstFile}: ${dtd.perm.canSubstFile}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.LogDelete}: ${dtd.perm.canLogicalDelete}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.PhysDelete}: ${dtd.perm.canPhysicalDelete}` }), dtd.hasBlog && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Blog_Read}: ${dtd.perm.canReadBlog}` }), dtd.hasBlog && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Blog_Write}: ${dtd.perm.canWriteBlog}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.CheckIn}: ${dtd.perm.canCICO}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.ChronologyDelete}: ${dtd.perm.canDelChron}` })] })
304
+ : dtd.ownershipLevel == OwnershipLevels.DirectOwner || dtd.ownershipLevel == OwnershipLevels.IndirectOwner ?
305
+ _jsxs(_Fragment, { children: [_jsx(StyledTooltipItem, { "$color": 'primary', "$marginTop": '5px', children: SDKUI_Localizator.Perms }), _jsx(StyledTooltipSeparatorItem, {}), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Archive}: ${SDKUI_Localizator.Yes}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.View_Metadato}: ${SDKUI_Localizator.Yes}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Search}: ${SDKUI_Localizator.Yes}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Update}: ${SDKUI_Localizator.Yes}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.RetrieveFile}: ${SDKUI_Localizator.Yes}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.AddOrSubstFile}: ${SDKUI_Localizator.Yes}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.LogDelete}: ${SDKUI_Localizator.Yes}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.PhysDelete}: ${SDKUI_Localizator.Yes}` }), dtd.hasBlog && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Blog_Read}: ${SDKUI_Localizator.Yes}` }), dtd.hasBlog && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Blog_Write}: ${SDKUI_Localizator.Yes}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.CheckIn}: ${SDKUI_Localizator.Yes}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.ChronologyDelete}: ${SDKUI_Localizator.Yes}` })] })
306
+ : _jsx(_Fragment, {})] }));
307
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.13.40",
3
+ "version": "6.13.41",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -42,7 +42,7 @@
42
42
  "lib"
43
43
  ],
44
44
  "dependencies": {
45
- "@topconsultnpm/sdk-ts-beta": "6.13.5",
45
+ "@topconsultnpm/sdk-ts-beta": "6.13.6",
46
46
  "buffer": "^6.0.3",
47
47
  "devextreme": "24.2.6",
48
48
  "devextreme-react": "24.2.6",
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- interface ResizableGridProps {
3
- panels: React.ReactNode[];
4
- minPercents?: number[];
5
- initialPercents?: number[];
6
- }
7
- declare const ResizableGrid: React.FC<ResizableGridProps>;
8
- export default ResizableGrid;
@@ -1,58 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- // ResizableGrid.tsx
3
- import React, { useRef, useState } from 'react';
4
- import { SDKUI_Globals } from '../../helper';
5
- const ResizableGrid = ({ panels, minPercents, initialPercents, }) => {
6
- const panelCount = panels.length;
7
- const defaultMinPercents = minPercents ?? Array(panelCount).fill(0.1);
8
- const [percents, setPercents] = useState(initialPercents ??
9
- Array(panelCount).fill(1 / panelCount));
10
- const containerRef = useRef(null);
11
- const handleMouseDown = (idx, e) => {
12
- e.preventDefault();
13
- const startX = e.clientX;
14
- const startPercents = [...percents];
15
- const onMouseMove = (moveEvent) => {
16
- if (!containerRef.current)
17
- return;
18
- const deltaPx = moveEvent.clientX - startX;
19
- const containerWidth = containerRef.current.offsetWidth;
20
- if (containerWidth === 0)
21
- return;
22
- const deltaPercent = deltaPx / containerWidth;
23
- let newPercents = [...startPercents];
24
- // Adjust the dragged panel and the next one
25
- newPercents[idx] = Math.max(defaultMinPercents[idx], startPercents[idx] + deltaPercent);
26
- newPercents[idx + 1] = Math.max(defaultMinPercents[idx + 1], startPercents[idx + 1] - deltaPercent);
27
- // Normalize if overflows
28
- const total = newPercents.reduce((a, b) => a + b, 0);
29
- newPercents = newPercents.map(p => p / total);
30
- setPercents(newPercents);
31
- };
32
- const onMouseUp = () => {
33
- window.removeEventListener('mousemove', onMouseMove);
34
- window.removeEventListener('mouseup', onMouseUp);
35
- };
36
- window.addEventListener('mousemove', onMouseMove);
37
- window.addEventListener('mouseup', onMouseUp);
38
- };
39
- // Build gridTemplateColumns string
40
- const gridTemplateColumns = percents
41
- .map((p, i) => `${(p * 100).toFixed(2)}%${i < panelCount - 1 ? ` ${SDKUI_Globals.userSettings.themeSettings.gutters}px` : ''}`)
42
- .join(' ');
43
- return (_jsx("div", { ref: containerRef, style: {
44
- display: 'grid',
45
- gridTemplateColumns,
46
- width: 'calc(100% - 20px)',
47
- height: '100%',
48
- position: 'relative',
49
- overflow: 'hidden',
50
- }, children: panels.map((panel, idx) => (_jsxs(React.Fragment, { children: [panel, idx < panelCount - 1 && (_jsx("div", { style: {
51
- cursor: 'col-resize',
52
- background: 'transparent',
53
- width: `${SDKUI_Globals.userSettings.themeSettings.gutters}px`,
54
- zIndex: 1,
55
- height: '100%',
56
- }, onMouseDown: e => handleMouseDown(idx, e) }))] }, idx))) }));
57
- };
58
- export default ResizableGrid;