@topconsultnpm/sdkui-react-beta 6.13.64 → 6.13.66

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.
Files changed (25) hide show
  1. package/lib/components/features/archive/TMArchive.js +130 -44
  2. package/lib/components/features/documents/TMDcmtForm.d.ts +1 -0
  3. package/lib/components/features/documents/TMDcmtForm.js +156 -154
  4. package/lib/components/features/documents/TMDcmtPreview.d.ts +2 -0
  5. package/lib/components/features/documents/TMDcmtPreview.js +6 -6
  6. package/lib/components/features/documents/TMFileUploader.d.ts +1 -0
  7. package/lib/components/features/documents/TMFileUploader.js +2 -2
  8. package/lib/components/features/documents/TMMasterDetailDcmts.js +60 -22
  9. package/lib/components/features/search/TMSavedQuerySelector.js +1 -1
  10. package/lib/components/features/search/TMSearch.js +2 -2
  11. package/lib/components/features/search/TMSearchResult.d.ts +0 -1
  12. package/lib/components/features/search/TMSearchResult.js +3 -8
  13. package/lib/components/grids/TMRecentsManager.js +1 -1
  14. package/lib/components/index.d.ts +0 -3
  15. package/lib/components/index.js +0 -3
  16. package/lib/components/layout/panelManager/TMPanelManagerToolbar.js +2 -2
  17. package/lib/components/layout/panelManager/TMPanelWrapper.js +4 -1
  18. package/lib/components/layout/panelManager/types.d.ts +2 -0
  19. package/package.json +1 -1
  20. package/lib/components/base/TMPanelManager.d.ts +0 -11
  21. package/lib/components/base/TMPanelManager.js +0 -478
  22. package/lib/components/base/TMPanelManagerToolbar.d.ts +0 -23
  23. package/lib/components/base/TMPanelManagerToolbar.js +0 -109
  24. package/lib/components/base/TMPanelManagerUtils.d.ts +0 -37
  25. package/lib/components/base/TMPanelManagerUtils.js +0 -27
@@ -1,22 +1,23 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useCallback, useEffect, useMemo, useState } from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useMemo, useState } from 'react';
3
3
  import Logo from '../../../assets/Toppy-generico.png';
4
- import { LayoutModes } from '@topconsultnpm/sdk-ts-beta';
5
- import { IconTree, IconProgressReady, SDKUI_Globals } from '../../../helper';
4
+ import { DcmtTypeListCacheService, LayoutModes, SDK_Localizator } from '@topconsultnpm/sdk-ts-beta';
5
+ import { IconTree, SDKUI_Globals, SDKUI_Localizator, IconRecentlyViewed, IconPreview, IconShow, IconBoard, IconDcmtTypeSys } from '../../../helper';
6
6
  import { useDeviceType, DeviceType } from '../../base/TMDeviceProvider';
7
- import TMLayoutContainer, { TMSplitterLayout, TMLayoutItem } from '../../base/TMLayout';
7
+ import TMLayoutContainer, { TMLayoutItem } from '../../base/TMLayout';
8
8
  import TMRecentsManager from '../../grids/TMRecentsManager';
9
9
  import TMDcmtForm from '../documents/TMDcmtForm';
10
10
  import { StyledToppyTextContainer, StyledToppyText } from '../search/TMSearchQueryPanel';
11
11
  import TMTreeSelector from '../search/TMTreeSelector';
12
12
  import TMPanel from '../../base/TMPanel';
13
- import TMCommandsPanel from '../../sidebar/TMCommandsPanel';
13
+ import { TMPanelManagerProvider, useTMPanelManagerContext } from '../../layout/panelManager/TMPanelManagerContext';
14
+ import TMPanelManagerContainer from '../../layout/panelManager/TMPanelManagerContainer';
14
15
  const TMArchive = ({ inputTID }) => {
15
16
  const TIDs = SDKUI_Globals.userSettings.archivingSettings.mruTIDs;
16
17
  const [currentTID, setCurrentTID] = useState(0);
17
18
  const [mruTIDs, setMruTIDs] = useState(TIDs);
18
- const [showRecentsPanel, setShowRecentsPanel] = useState(true);
19
- const [showTreesPanel, setShowTreesPanel] = useState(true);
19
+ const [currentMruTID, setCurrentMruTID] = useState(0);
20
+ const [fromDTD, setFromDTD] = useState();
20
21
  const deviceType = useDeviceType();
21
22
  useEffect(() => { setMruTIDs(TIDs); }, []);
22
23
  useEffect(() => {
@@ -24,43 +25,128 @@ const TMArchive = ({ inputTID }) => {
24
25
  return;
25
26
  setCurrentTID(inputTID);
26
27
  }, [inputTID]);
27
- const setSearchByTID = (tid) => { setCurrentTID(tid); };
28
- const getPrimarySplitterStartValues = useCallback(() => {
29
- if (deviceType === DeviceType.MOBILE) {
30
- return ['0%', '100%'];
31
- }
32
- return showTreesPanel ? ['20%', '80%'] : ['0', '100%'];
33
- }, [deviceType, showTreesPanel]);
34
- const getSecondarySplitterStartValues = useCallback(() => {
35
- if (deviceType === DeviceType.MOBILE) {
36
- return currentTID ? ['0', '100%'] : ['100%', '0%'];
28
+ useEffect(() => {
29
+ if (!currentTID || currentTID <= 0) {
30
+ return;
37
31
  }
38
- return showRecentsPanel ? ['25%', '75%'] : ['0', '100%'];
39
- }, [deviceType, currentTID, showRecentsPanel]);
40
- let customSidebarItems = useMemo(() => {
41
- return ([
42
- { icon: _jsx(IconTree, {}), selected: showTreesPanel, onClick: () => { setShowTreesPanel(!showTreesPanel); } },
43
- { icon: _jsx(IconProgressReady, {}), selected: showRecentsPanel, onClick: () => { setShowRecentsPanel(!showRecentsPanel); } }
44
- ]);
45
- }, [showTreesPanel, showRecentsPanel]);
32
+ DcmtTypeListCacheService.GetAsync(currentTID).then(async (dtd) => {
33
+ setFromDTD(dtd);
34
+ });
35
+ }, [currentTID]);
36
+ const setSearchByTID = (tid) => { setCurrentTID(tid); };
46
37
  const isMobile = deviceType === DeviceType.MOBILE;
47
- return (_jsxs("div", { style: {
48
- display: 'flex',
49
- flexDirection: isMobile ? 'column' : 'row',
50
- justifyContent: 'space-between',
51
- gap: SDKUI_Globals.userSettings.themeSettings.gutters,
52
- width: '100%',
53
- height: '100%',
54
- }, children: [_jsx("div", { style: { flex: 1, minWidth: 0, height: '100%' }, children: _jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: 'visible', separatorSize: SDKUI_Globals.userSettings.themeSettings.gutters, showSeparator: deviceType !== DeviceType.MOBILE && showTreesPanel, separatorColor: 'transparent', separatorActiveColor: 'transparent', min: ['0', '0'], start: getPrimarySplitterStartValues(), children: [showTreesPanel ? _jsx(TMLayoutItem, { children: deviceType !== DeviceType.MOBILE && _jsx(TMTreeSelector, { onClosePanel: () => setShowTreesPanel(false), layoutMode: LayoutModes.Ark, onSelectedTIDChanged: (tid) => { setSearchByTID(tid); } }) }) : _jsx(_Fragment, {}), _jsx(TMLayoutItem, { children: _jsxs(TMSplitterLayout, { separatorSize: SDKUI_Globals.userSettings.themeSettings.gutters, direction: 'horizontal', overflow: 'visible', showSeparator: deviceType !== DeviceType.MOBILE && showRecentsPanel, separatorColor: 'transparent', separatorActiveColor: 'transparent', min: ['0', '0'], start: getSecondarySplitterStartValues(), children: [showRecentsPanel ? _jsx(TMLayoutItem, { children: _jsx(TMPanel, { title: 'Recenti', onClose: () => setShowRecentsPanel(false), totalItems: mruTIDs.length, children: _jsx(TMRecentsManager, { mruTIDs: mruTIDs, deviceType: deviceType, onSelectedTID: (tid) => setCurrentTID(tid), onDeletedTID: (tid) => {
55
- let newMruTIDS = mruTIDs.slice();
56
- let index = newMruTIDS.findIndex(o => o == tid);
57
- if (index >= 0)
58
- newMruTIDS.splice(index, 1);
59
- SDKUI_Globals.userSettings.archivingSettings.mruTIDs = newMruTIDS.filter(tid => tid != undefined && tid != null);
60
- setMruTIDs(newMruTIDS);
61
- } }) }) }) : _jsx(_Fragment, {}), _jsx(TMLayoutItem, { children: currentTID ?
62
- _jsx(TMDcmtForm, { TID: currentTID, DID: undefined, layoutMode: LayoutModes.Ark, customRightSidebarItems: customSidebarItems, showPreview: deviceType !== DeviceType.MOBILE, onClose: deviceType === DeviceType.MOBILE ? () => setCurrentTID(undefined) : undefined, onSaveRecents: (TIDs) => setMruTIDs(TIDs) })
63
- :
64
- _jsx(TMPanel, { title: 'Archiviazione', children: _jsxs(TMLayoutContainer, { gap: 30, alignItems: 'center', justifyContent: 'center', children: [_jsxs(TMLayoutItem, { width: 'max-content', height: 'max-content', children: [" ", _jsxs(StyledToppyTextContainer, { children: [" ", _jsxs(StyledToppyText, { children: [" ", 'Selezionare un tipo documento', " "] }), " "] }), " "] }), _jsxs(TMLayoutItem, { width: 'max-content', height: 'max-content', children: [" ", _jsx("img", { src: Logo, width: 120, alt: '' }), " "] })] }) }) })] }) })] }) }), !currentTID ? _jsx(TMCommandsPanel, { isMobile: isMobile, items: customSidebarItems }) : _jsx(_Fragment, {})] }));
38
+ const tmTreeSelectorElement = useMemo(() => _jsx(TMTreeSelectorWrapper, { isMobile: isMobile, onSelectedTIDChanged: (tid) => {
39
+ setSearchByTID(tid);
40
+ if (tid && mruTIDs.includes(tid))
41
+ setCurrentMruTID(tid);
42
+ else
43
+ setCurrentMruTID(0);
44
+ } }), [isMobile]);
45
+ const tmRecentsManagerElement = useMemo(() => _jsx(TMRecentsManagerWrapper, { mruTIDs: mruTIDs, currentMruTID: currentMruTID, deviceType: deviceType, onSelectedTID: (tid) => {
46
+ setCurrentMruTID(tid);
47
+ setCurrentTID(tid);
48
+ }, onDeletedTID: (tid) => {
49
+ let newMruTIDS = mruTIDs.slice();
50
+ let index = newMruTIDS.findIndex(o => o == tid);
51
+ if (index >= 0)
52
+ newMruTIDS.splice(index, 1);
53
+ SDKUI_Globals.userSettings.searchSettings.mruTIDs = newMruTIDS.filter(tid => tid != undefined && tid != null);
54
+ setMruTIDs(newMruTIDS);
55
+ } }), [mruTIDs, currentMruTID, deviceType]);
56
+ const tmFormElement = useMemo(() => currentTID ?
57
+ _jsx(TMDcmtForm, { TID: currentTID, DID: undefined, groupId: 'tmForm', layoutMode: LayoutModes.Ark, showPreview: deviceType !== DeviceType.MOBILE, onClose: deviceType === DeviceType.MOBILE ? () => setCurrentTID(undefined) : undefined, onSaveRecents: (TIDs) => setMruTIDs(TIDs), showDcmtFormSidebar: false })
58
+ :
59
+ _jsx(TMPanel, { title: 'Archiviazione', children: _jsxs(TMLayoutContainer, { gap: 30, alignItems: 'center', justifyContent: 'center', children: [_jsxs(TMLayoutItem, { width: 'max-content', height: 'max-content', children: [" ", _jsxs(StyledToppyTextContainer, { children: [" ", _jsxs(StyledToppyText, { children: [" ", 'Selezionare un tipo documento', " "] }), " "] }), " "] }), _jsxs(TMLayoutItem, { width: 'max-content', height: 'max-content', children: [" ", _jsx("img", { src: Logo, width: 120, alt: '' }), " "] })] }) }), [currentTID, deviceType, mruTIDs]);
60
+ const allInitialPanelVisibility = {
61
+ 'tmTreeSelector': true,
62
+ 'tmRecentsManager': true,
63
+ 'tmForm': true,
64
+ 'tmDcmtForm': true,
65
+ 'tmBlog': false,
66
+ 'tmSysMetadata': false,
67
+ 'tmDcmtPreview': true,
68
+ };
69
+ const initialPanelDimensions = {
70
+ 'tmTreeSelector': { width: '20%', height: '100%' },
71
+ 'tmRecentsManager': { width: '20%', height: '100%' },
72
+ 'tmForm': { width: '60%', height: '100%' },
73
+ 'tmDcmtForm': { width: '25%', height: '100%' },
74
+ 'tmBlog': { width: '25%', height: '100%' },
75
+ 'tmSysMetadata': { width: '25%', height: '100%' },
76
+ 'tmDcmtPreview': { width: '25%', height: '100%' },
77
+ };
78
+ const initialPanels = useMemo(() => [
79
+ {
80
+ id: 'tmTreeSelector',
81
+ name: SDK_Localizator.Trees,
82
+ contentOptions: { component: tmTreeSelectorElement },
83
+ toolbarOptions: { icon: _jsx(IconTree, { fontSize: 24 }), visible: true, orderNumber: 1, isActive: allInitialPanelVisibility['tmTreeSelector'] }
84
+ },
85
+ {
86
+ id: 'tmRecentsManager',
87
+ name: SDKUI_Localizator.Shortcuts,
88
+ contentOptions: { component: tmRecentsManagerElement, panelContainer: { title: SDKUI_Localizator.Shortcuts, totalItems: mruTIDs.length } },
89
+ toolbarOptions: { icon: _jsx(IconRecentlyViewed, { fontSize: 24 }), visible: true, orderNumber: 2, isActive: allInitialPanelVisibility['tmRecentsManager'] }
90
+ },
91
+ {
92
+ id: 'tmForm',
93
+ name: fromDTD?.nameLoc ?? SDK_Localizator.Metadatas,
94
+ contentOptions: { component: tmFormElement },
95
+ toolbarOptions: { icon: _jsx(IconPreview, { fontSize: 24 }), visible: false, orderNumber: 3, isActive: allInitialPanelVisibility['tmForm'] },
96
+ children: [
97
+ {
98
+ id: 'tmDcmtForm',
99
+ name: SDK_Localizator.Metadatas,
100
+ toolbarOptions: { icon: _jsx(IconPreview, { fontSize: 24 }), visible: false, orderNumber: 4, isActive: allInitialPanelVisibility['tmDcmtForm'] }
101
+ },
102
+ {
103
+ id: 'tmBlog',
104
+ name: SDKUI_Localizator.BlogCase,
105
+ toolbarOptions: { icon: _jsx(IconBoard, { fontSize: 24 }), visible: false, orderNumber: 5, isActive: allInitialPanelVisibility['tmBlog'] }
106
+ },
107
+ {
108
+ id: 'tmSysMetadata',
109
+ name: SDKUI_Localizator.MetadataSystem,
110
+ toolbarOptions: { icon: _jsx(IconDcmtTypeSys, { fontSize: 24 }), visible: false, orderNumber: 6, isActive: allInitialPanelVisibility['tmSysMetadata'] }
111
+ },
112
+ {
113
+ id: 'tmDcmtPreview',
114
+ name: SDKUI_Localizator.PreviewDocument,
115
+ toolbarOptions: { icon: _jsx(IconShow, { fontSize: 24 }), visible: false, orderNumber: 7, isActive: allInitialPanelVisibility['tmDcmtPreview'] }
116
+ }
117
+ ]
118
+ },
119
+ ], [tmTreeSelectorElement, tmRecentsManagerElement, tmFormElement, currentTID, mruTIDs]);
120
+ return (_jsx(TMPanelManagerProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, initialDimensions: initialPanelDimensions, initialMobilePanelId: 'tmRecentsManager', children: _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", showToolbar: true }) }));
65
121
  };
66
122
  export default TMArchive;
123
+ const TMTreeSelectorWrapper = ({ isMobile, onSelectedTIDChanged }) => {
124
+ const { setPanelVisibilityById, toggleMaximize, setToolbarButtonVisibility } = useTMPanelManagerContext();
125
+ return (_jsx(TMTreeSelector, { onClosePanel: () => setPanelVisibilityById('tmTreeSelector', false), onMaximizePanel: () => toggleMaximize('tmTreeSelector'), onSelectedTIDChanged: (tid) => {
126
+ onSelectedTIDChanged?.(tid);
127
+ if (isMobile)
128
+ setPanelVisibilityById('tmForm', true);
129
+ else {
130
+ setPanelVisibilityById('tmDcmtForm', true);
131
+ setPanelVisibilityById('tmDcmtPreview', true);
132
+ }
133
+ setToolbarButtonVisibility('tmDcmtPreview', true);
134
+ setToolbarButtonVisibility('tmDcmtForm', true);
135
+ } }));
136
+ };
137
+ const TMRecentsManagerWrapper = ({ mruTIDs, currentMruTID, deviceType, onSelectedTID, onDeletedTID }) => {
138
+ const { setPanelVisibilityById, setToolbarButtonVisibility } = useTMPanelManagerContext();
139
+ return (_jsx(TMRecentsManager, { mruTIDs: mruTIDs, currentMruTID: currentMruTID, deviceType: deviceType, onSelectedTID: (tid) => {
140
+ onSelectedTID?.(tid);
141
+ if (deviceType === DeviceType.MOBILE)
142
+ setPanelVisibilityById('tmForm', true);
143
+ else {
144
+ setPanelVisibilityById('tmDcmtForm', true);
145
+ setPanelVisibilityById('tmDcmtPreview', true);
146
+ }
147
+ setToolbarButtonVisibility('tmDcmtPreview', true);
148
+ setToolbarButtonVisibility('tmDcmtForm', true);
149
+ }, onDeletedTID: (tid) => {
150
+ onDeletedTID?.(tid);
151
+ } }));
152
+ };
@@ -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;