@topconsultnpm/sdkui-react-beta 6.17.3 → 6.17.4

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.
@@ -10,7 +10,10 @@ interface ITMArchiveProps {
10
10
  connectorFileSave?: () => Promise<File>;
11
11
  onSavedAsyncCallback?: (tid: number | undefined, did: number | undefined) => Promise<void>;
12
12
  enableDragDropOverlay?: boolean;
13
- passToSearch?: () => void;
13
+ passToSearch?: (tid: number | undefined, outputMids: Array<{
14
+ mid: number;
15
+ value: string;
16
+ }>) => void;
14
17
  }
15
18
  declare const TMArchive: React.FunctionComponent<ITMArchiveProps>;
16
19
  export default TMArchive;
@@ -29,12 +29,12 @@ const TMArchive = ({ onDcmtTypeSelect = undefined, inputTID, inputFile = null, c
29
29
  if (!currentTID || currentTID <= 0) {
30
30
  return;
31
31
  }
32
- if (onDcmtTypeSelect && currentTID !== inputTID)
32
+ if (onDcmtTypeSelect)
33
33
  onDcmtTypeSelect(currentTID);
34
34
  DcmtTypeListCacheService.GetAsync(currentTID).then(async (dtd) => {
35
35
  setFromDTD(dtd);
36
36
  });
37
- }, [currentTID, onDcmtTypeSelect, inputTID]);
37
+ }, [currentTID, onDcmtTypeSelect]);
38
38
  const isMobile = deviceType === DeviceType.MOBILE;
39
39
  const tmTreeSelectorElement = useMemo(() => _jsx(TMTreeSelectorWrapper, { isMobile: isMobile, onSelectedTIDChanged: (tid) => {
40
40
  setCurrentTID(tid);
@@ -52,7 +52,11 @@ const TMArchive = ({ onDcmtTypeSelect = undefined, inputTID, inputFile = null, c
52
52
  setMruTIDs(newMruTIDS);
53
53
  } }), [mruTIDs, currentMruTID, deviceType]);
54
54
  const tmFormElement = useMemo(() => currentTID ?
55
- _jsx(TMDcmtForm, { TID: currentTID, DID: undefined, groupId: 'tmForm', layoutMode: LayoutModes.Ark, onClose: deviceType === DeviceType.MOBILE ? () => setCurrentTID(undefined) : undefined, onSaveRecents: (TIDs) => setMruTIDs(TIDs), showDcmtFormSidebar: false, inputFile: inputFile, connectorFileSave: connectorFileSave, onSavedAsyncCallback: onSavedAsyncCallback, inputMids: inputMids, enableDragDropOverlay: enableDragDropOverlay, passToSearch: passToSearch })
55
+ _jsx(TMDcmtForm, { TID: currentTID, DID: undefined, groupId: 'tmForm', layoutMode: LayoutModes.Ark, onClose: deviceType === DeviceType.MOBILE ? () => setCurrentTID(undefined) : undefined, onSaveRecents: (TIDs) => setMruTIDs(TIDs), showDcmtFormSidebar: false, inputFile: inputFile, connectorFileSave: connectorFileSave, onSavedAsyncCallback: onSavedAsyncCallback, inputMids: inputMids, enableDragDropOverlay: enableDragDropOverlay, passToSearch: passToSearch ? (outputMids) => {
56
+ if (onDcmtTypeSelect)
57
+ onDcmtTypeSelect(currentTID);
58
+ passToSearch(currentTID, outputMids);
59
+ } : undefined })
56
60
  :
57
61
  _jsx(TMPanel, { title: 'Archiviazione', allowMaximize: false, children: _jsxs(TMLayoutContainer, { gap: 30, alignItems: 'center', justifyContent: 'center', children: [_jsx(StyledToppyTextContainer, { children: _jsx(StyledToppyText, { children: SDKUI_Localizator.DcmtTypeSelect }) }), _jsx(StyledToppyImage, { src: Logo, alt: 'Toppy' })] }) }), [currentTID, deviceType, mruTIDs, inputFile, inputMids]);
58
62
  const allInitialPanelVisibility = {
@@ -41,7 +41,10 @@ interface ITMDcmtFormProps {
41
41
  onOpenS4TViewerRequest?: (dcmtInfo: Array<DcmtInfo>, onRefreshSearchAsync?: (() => Promise<void>)) => void;
42
42
  s4TViewerDialogComponent?: React.ReactNode;
43
43
  enableDragDropOverlay?: boolean;
44
- passToSearch?: () => void;
44
+ passToSearch?: (outputMids: Array<{
45
+ mid: number;
46
+ value: string;
47
+ }>) => void;
45
48
  }
46
49
  declare const TMDcmtForm: React.FC<ITMDcmtFormProps>;
47
50
  export default TMDcmtForm;
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useEffect, useMemo, useState } from 'react';
2
+ import { useEffect, useMemo, useRef, useState } from 'react';
3
3
  import TMDcmtPreview from './TMDcmtPreview';
4
4
  import { AccessLevels, ArchiveConstraints, ArchiveEngineByID, DcmtTypeListCacheService, LayoutModes, MetadataDataTypes, ResultTypes, SDK_Globals, SDK_Localizator, SystemMIDsAsNumber, SystemTIDs, Task_States, TemplateTIDs, UpdateEngineByID, ValidationItem, WorkflowCacheService, WorkItemMetadataNames } from '@topconsultnpm/sdk-ts-beta';
5
5
  import { ContextMenu } from 'devextreme-react';
@@ -8,7 +8,7 @@ import { DownloadTypes, FormModes } from '../../../ts';
8
8
  import { DeviceType, useDeviceType } from '../../base/TMDeviceProvider';
9
9
  import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
10
10
  import { getWorkItemSetIDAsync, handleArchiveVisibility, searchResultToMetadataValues } from '../../../helper/queryHelper';
11
- import { genUniqueId, IconShow, SDKUI_Localizator, updateMruTids, IconBoard, IconDcmtTypeSys, IconDetailDcmts, svgToString, IconDownload, calcIsModified, IconMenuVertical, Globalization, getListMaxItems, getSystemMetadata, IconBoxArchiveIn, IconClear, IconUndo, SDKUI_Globals, IconPreview, isTaskMoreInfo, IconWorkflow, IconSearch } from '../../../helper';
11
+ import { genUniqueId, IconShow, SDKUI_Localizator, updateMruTids, IconBoard, IconDcmtTypeSys, IconDetailDcmts, svgToString, IconDownload, calcIsModified, IconMenuVertical, Globalization, getListMaxItems, getSystemMetadata, IconBoxArchiveIn, IconClear, IconUndo, SDKUI_Globals, IconPreview, isTaskMoreInfo, IconWorkflow, IconSearch, deepCompare } from '../../../helper';
12
12
  import { hasDetailRelations, hasMasterRelations, isXMLFileExt } from '../../../helper/dcmtsHelper';
13
13
  import { Gutters, TMColors } from '../../../utils/theme';
14
14
  import { StyledFormButtonsContainer, StyledLoadingContainer, StyledModalContainer, StyledSpinner, StyledToolbarCardContainer } from '../../base/Styled';
@@ -59,6 +59,7 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
59
59
  const [showRejectPopup, setShowRejectPopup] = useState(false);
60
60
  const [showReAssignPopup, setShowReAssignPopup] = useState(false);
61
61
  const [showMoreInfoPopup, setShowMoreInfoPopup] = useState(false);
62
+ const appliedInputMidsRef = useRef(null);
62
63
  const [isOpenDetails, setIsOpenDetails] = useState(false);
63
64
  const [isOpenMaster, setIsOpenMaster] = useState(false);
64
65
  const [secondaryMasterDcmts, setSecondaryMasterDcmts] = useState([]);
@@ -203,6 +204,47 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
203
204
  return;
204
205
  setFocusedMetadataValue(undefined);
205
206
  }, [fromDTD, layoutMode]);
207
+ useEffect(() => {
208
+ if (!inputMids || inputMids.length === 0)
209
+ return;
210
+ if (layoutMode !== LayoutModes.Ark)
211
+ return;
212
+ if (!formData || formData.length === 0)
213
+ return;
214
+ if (appliedInputMidsRef.current && deepCompare(appliedInputMidsRef.current, inputMids))
215
+ return;
216
+ appliedInputMidsRef.current = inputMids;
217
+ let data = structuredClone(formData);
218
+ for (let md of data) {
219
+ if (!md.mid)
220
+ continue;
221
+ if (md.mid > 99) {
222
+ const defaultValue = md.md?.defaultValue;
223
+ if (defaultValue) {
224
+ if (FormulaHelper.isFormula(defaultValue)) {
225
+ md.value = undefined;
226
+ }
227
+ else {
228
+ md.value = defaultValue;
229
+ }
230
+ }
231
+ else if (formDataOrig.find(metadata => metadata.mid === md.mid)?.value === undefined) {
232
+ if (md.value)
233
+ md.value = undefined;
234
+ }
235
+ else if (md.value && md.value.length > 0) {
236
+ md.value = '';
237
+ }
238
+ }
239
+ }
240
+ inputMids.forEach(inputMid => {
241
+ const md = data.find(m => m.mid === inputMid.mid);
242
+ if (md) {
243
+ md.value = inputMid.value;
244
+ }
245
+ });
246
+ setFormData(data);
247
+ }, [inputMids, layoutMode, formData, formDataOrig]);
206
248
  useEffect(() => {
207
249
  const loadAllWfData = async () => {
208
250
  if (layoutMode !== LayoutModes.Update || !DID) {
@@ -279,6 +321,14 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
279
321
  const handleRemoveItem = (tid, did) => {
280
322
  setSecondaryMasterDcmts((prevItems) => prevItems.filter(item => item.TID !== tid && item.DID !== did));
281
323
  };
324
+ const handlePassToSearch = () => {
325
+ if (!passToSearch)
326
+ return;
327
+ const outputMids = formData
328
+ .filter(md => md.mid && md.mid > 100 && md.value && md.value.length > 0)
329
+ .map(md => ({ mid: md.mid, value: md.value }));
330
+ passToSearch(outputMids);
331
+ };
282
332
  const isPreviewDisabled = layoutMode === LayoutModes.Ark && fromDTD?.archiveConstraint === ArchiveConstraints.OnlyMetadata;
283
333
  const isBoardDisabled = layoutMode !== LayoutModes.Update || fromDTD?.hasBlog !== 1;
284
334
  const isSysMetadataDisabled = layoutMode !== LayoutModes.Update;
@@ -300,7 +350,7 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
300
350
  setIsOpenDetails(!isOpenDetails); } }] : []),
301
351
  ];
302
352
  const formToolbar = _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '10px' }, children: [allowNavigation && canPrev != undefined && _jsx("p", { style: { textAlign: 'center', padding: '1px 4px', display: 'flex' }, children: `${itemIndex}/${count}` }), allowNavigation && canPrev != undefined && _jsx(TMSaveFormButtonPrevious, { btnStyle: 'icon', iconColor: 'white', isModified: calcIsModified(formData, formDataOrig), formMode: formMode, canPrev: canPrev, onPrev: onPrev }), allowNavigation && canNext != undefined && _jsx(TMSaveFormButtonNext, { btnStyle: 'icon', iconColor: 'white', isModified: calcIsModified(formData, formDataOrig), formMode: formMode, canNext: canNext, onNext: onNext }), layoutMode === LayoutModes.Update && _jsx(IconMenuVertical, { id: `commands-detail-${id}`, color: 'white', cursor: 'pointer' }), layoutMode === LayoutModes.Update && _jsx(ContextMenu, { showEvent: 'click', dataSource: commandsMenuItems, target: `#commands-detail-${id}` }), layoutMode === LayoutModes.Ark &&
303
- _jsx(TMTooltip, { content: SDKUI_Localizator.PassToSearch, position: 'bottom', children: _jsx(IconSearch, { style: { cursor: 'pointer' }, onClick: passToSearch }) })] });
353
+ _jsx(TMTooltip, { content: SDKUI_Localizator.PassToSearch, position: 'bottom', children: _jsx(IconSearch, { style: { cursor: 'pointer' }, onClick: handlePassToSearch }) })] });
304
354
  function createChange(mid, metadataType, modifiedValue) {
305
355
  return { mid, metadataType, modifiedValue };
306
356
  }
@@ -6,6 +6,10 @@ interface ITMSearchProps {
6
6
  isVisible?: boolean;
7
7
  inputTID?: number;
8
8
  inputSqdID?: number;
9
+ inputMids?: Array<{
10
+ mid: number;
11
+ value: string;
12
+ }>;
9
13
  isExpertMode?: boolean;
10
14
  floatingActionConfig?: TMSearchResultFloatingActionConfig;
11
15
  onRefreshAfterAddDcmtToFavs?: () => void;
@@ -17,7 +21,10 @@ interface ITMSearchProps {
17
21
  onOpenS4TViewerRequest?: (dcmtInfo: Array<DcmtInfo>, onRefreshSearchAsync?: (() => Promise<void>)) => void;
18
22
  showTodoDcmtForm?: boolean;
19
23
  openInOffice?: (selectedDcmtsOrFocused: Array<DcmtInfo>) => Promise<void>;
20
- passToArchiveCallback?: () => void;
24
+ passToArchiveCallback?: (outputMids: Array<{
25
+ mid: number;
26
+ value: string;
27
+ }>) => void;
21
28
  onCurrentTIDChangedCallback?: (tid: number | undefined) => void;
22
29
  }
23
30
  declare const TMSearch: React.FunctionComponent<ITMSearchProps>;
@@ -18,7 +18,7 @@ var TMSearchViews;
18
18
  TMSearchViews[TMSearchViews["Search"] = 0] = "Search";
19
19
  TMSearchViews[TMSearchViews["Result"] = 1] = "Result";
20
20
  })(TMSearchViews || (TMSearchViews = {}));
21
- const TMSearch = ({ openInOffice, isVisible, inputTID, inputSqdID, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, floatingActionConfig, onFileOpened, onRefreshAfterAddDcmtToFavs, onTaskCreateRequest, openWGsCopyMoveForm, openEditPdf, openS4TViewer, onOpenS4TViewerRequest, showTodoDcmtForm, passToArchiveCallback, onCurrentTIDChangedCallback }) => {
21
+ const TMSearch = ({ openInOffice, isVisible, inputTID, inputSqdID, inputMids, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, floatingActionConfig, onFileOpened, onRefreshAfterAddDcmtToFavs, onTaskCreateRequest, openWGsCopyMoveForm, openEditPdf, openS4TViewer, onOpenS4TViewerRequest, showTodoDcmtForm, passToArchiveCallback, onCurrentTIDChangedCallback }) => {
22
22
  const [allSQDs, setAllSQDs] = useState([]);
23
23
  const [filteredByTIDSQDs, setFilteredByTIDSQDs] = useState([]);
24
24
  const [currentSQD, setCurrentSQD] = useState();
@@ -35,7 +35,7 @@ const TMSearch = ({ openInOffice, isVisible, inputTID, inputSqdID, isExpertMode
35
35
  if (onCurrentTIDChangedCallback) {
36
36
  onCurrentTIDChangedCallback(currentTID);
37
37
  }
38
- }, [currentTID]);
38
+ }, [currentTID, onCurrentTIDChangedCallback]);
39
39
  useEffect(() => {
40
40
  setMruTIDs(SDKUI_Globals.userSettings.searchSettings.mruTIDs);
41
41
  loadDataSQDsAsync(false);
@@ -153,7 +153,7 @@ const TMSearch = ({ openInOffice, isVisible, inputTID, inputSqdID, isExpertMode
153
153
  SDKUI_Globals.userSettings.searchSettings.mruTIDs = newMruTIDS;
154
154
  setMruTIDs(newMruTIDS);
155
155
  } }), [mruTIDs, currentMruTID, deviceType]);
156
- const tmSearchQueryPanelElement = useMemo(() => _jsx(TMSearchQueryPanelWrapper, { passToArchiveCallback: passToArchiveCallback, isExpertMode: isExpertMode, showBackToResultButton: searchResult.length > 0, fromDTD: fromDTD, SQD: currentSQD, onBackToResult: () => { setCurrentSearchView(TMSearchViews.Result); }, onSearchCompleted: (searchResult, qd) => {
156
+ const tmSearchQueryPanelElement = useMemo(() => _jsx(TMSearchQueryPanelWrapper, { passToArchiveCallback: passToArchiveCallback, isExpertMode: isExpertMode, showBackToResultButton: searchResult.length > 0, fromDTD: fromDTD, SQD: currentSQD, inputMids: inputMids, onBackToResult: () => { setCurrentSearchView(TMSearchViews.Result); }, onSearchCompleted: (searchResult, qd) => {
157
157
  setSearchResult(searchResult);
158
158
  if (searchResult.length <= 0)
159
159
  return;
@@ -168,7 +168,7 @@ const TMSearch = ({ openInOffice, isVisible, inputTID, inputSqdID, isExpertMode
168
168
  }, onSqdSaved: async (newSqd) => {
169
169
  await loadDataSQDsAsync(true, newSqd.masterTID);
170
170
  await setSQDAsync(newSqd);
171
- } }), [fromDTD, currentSQD, isExpertMode, mruTIDs, searchResult, passToArchiveCallback]);
171
+ } }), [fromDTD, currentSQD, isExpertMode, mruTIDs, searchResult, passToArchiveCallback, inputMids]);
172
172
  const tmSavedQuerySelectorElement = useMemo(() => _jsxs(TabPanel, { width: "100%", height: "100%", showNavButtons: true, repaintChangesOnly: true, selectedIndex: currentSQDMode, onSelectedIndexChange: (index) => setCurrentSQDMode(index), children: [(currentTID || currentSQD) ? _jsx(Item, { title: fromDTD?.nameLoc, children: _jsx(TMSavedQuerySelectorWrapper, { allowShowSearch: false, items: filteredByTIDSQDs, selectedId: currentSQD?.id, onRefreshData: () => { loadDataSQDsAsync(true); }, onItemClick: (sqd) => {
173
173
  onSQDItemClick(sqd, setSQDAsync);
174
174
  }, onDeleted: (sqd) => onSQDDeleted(sqd, sqd.id == currentSQD?.id ? filteredByTIDSQDs.find(o => o.id == 1) : currentSQD, setSQDAsync) }) }) : _jsx(_Fragment, {}), _jsx(Item, { title: SDKUI_Localizator.Alls2, children: _jsx(TMSavedQuerySelectorWrapper, { allowShowSearch: true, items: allSQDs, manageDefault: false, onItemClick: (sqd) => {
@@ -232,11 +232,11 @@ const TMRecentsManagerWrapper = ({ mruTIDs, currentMruTID, deviceType, onSelecte
232
232
  onDeletedTID?.(tid);
233
233
  } }));
234
234
  };
235
- const TMSearchQueryPanelWrapper = ({ fromDTD, SQD, isExpertMode, showBackToResultButton, onSearchCompleted, onSqdSaved, onBackToResult, passToArchiveCallback }) => {
235
+ const TMSearchQueryPanelWrapper = ({ fromDTD, SQD, isExpertMode, showBackToResultButton, onSearchCompleted, onSqdSaved, onBackToResult, passToArchiveCallback, inputMids }) => {
236
236
  const { setPanelVisibilityById, toggleMaximize, countVisibleLeafPanels } = useTMPanelManagerContext();
237
237
  const deviceType = useDeviceType();
238
238
  const isMobile = deviceType === DeviceType.MOBILE;
239
- return (_jsx(TMSearchQueryPanel, { onClosePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => setPanelVisibilityById('TMSearchQueryPanel', false) : undefined, allowMaximize: !isMobile && countVisibleLeafPanels() > 1, onMaximizePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => toggleMaximize("TMSearchQueryPanel") : undefined, isExpertMode: isExpertMode, fromDTD: fromDTD, SQD: SQD, onSearchCompleted: onSearchCompleted, onSqdSaved: onSqdSaved, showBackToResultButton: showBackToResultButton, onBackToResult: onBackToResult, passToArchiveCallback: passToArchiveCallback }));
239
+ return (_jsx(TMSearchQueryPanel, { onClosePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => setPanelVisibilityById('TMSearchQueryPanel', false) : undefined, allowMaximize: !isMobile && countVisibleLeafPanels() > 1, onMaximizePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => toggleMaximize("TMSearchQueryPanel") : undefined, isExpertMode: isExpertMode, fromDTD: fromDTD, SQD: SQD, inputMids: inputMids, onSearchCompleted: onSearchCompleted, onSqdSaved: onSqdSaved, showBackToResultButton: showBackToResultButton, onBackToResult: onBackToResult, passToArchiveCallback: passToArchiveCallback }));
240
240
  };
241
241
  const TMSavedQuerySelectorWrapper = ({ items, selectedId, allowShowSearch, manageDefault, onRefreshData, onItemClick, onDeleted }) => {
242
242
  const { setPanelVisibilityById } = useTMPanelManagerContext();
@@ -5,6 +5,10 @@ interface ITMSearchQueryPanelProps {
5
5
  SQD?: SavedQueryDescriptor;
6
6
  isExpertMode?: boolean;
7
7
  showBackToResultButton?: boolean;
8
+ inputMids?: Array<{
9
+ mid: number;
10
+ value: string;
11
+ }>;
8
12
  onBack?: () => void;
9
13
  onBackToResult?: () => void;
10
14
  onSqdSaved?: (newSqd: SavedQueryDescriptor) => void;
@@ -12,7 +16,10 @@ interface ITMSearchQueryPanelProps {
12
16
  onClosePanel?: () => void;
13
17
  allowMaximize?: boolean;
14
18
  onMaximizePanel?: () => void;
15
- passToArchiveCallback?: () => void;
19
+ passToArchiveCallback?: (outputMids: Array<{
20
+ mid: number;
21
+ value: string;
22
+ }>) => void;
16
23
  }
17
24
  declare const TMSearchQueryPanel: React.FunctionComponent<ITMSearchQueryPanelProps>;
18
25
  export default TMSearchQueryPanel;
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useCallback, useEffect, useState } from 'react';
2
+ import { useCallback, useEffect, useRef, useState } from 'react';
3
3
  import { PlatformObjectValidator, WhereItem, SDK_Localizator, OrderByItem, SelectItem, SelectItemVisibilities, SDK_Globals, SavedQueryCacheService, SearchEngine, QueryOperators } from '@topconsultnpm/sdk-ts-beta';
4
4
  import styled from 'styled-components';
5
5
  import TMSearchQueryEditor from './TMSearchQueryEditor';
@@ -23,7 +23,7 @@ import TMQueryEditor from '../../query/TMQueryEditor';
23
23
  import TMSavedQueryForm from './TMSavedQueryForm';
24
24
  import { AdvancedMenuButtons } from '../../editors/TMMetadataValues';
25
25
  import TMShowAllOrMaxItemsButton from '../../base/TMShowAllOrMaxItemsButton';
26
- const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, SQD, onSearchCompleted, onSqdSaved, onBack, onClosePanel, allowMaximize = true, onMaximizePanel, onBackToResult, passToArchiveCallback }) => {
26
+ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, SQD, inputMids, onSearchCompleted, onSqdSaved, onBack, onClosePanel, allowMaximize = true, onMaximizePanel, onBackToResult, passToArchiveCallback }) => {
27
27
  const [confirmQueryParams, ConfirmQueryParamsDialog] = useQueryParametersDialog();
28
28
  const [qd, setQd] = useState();
29
29
  const [shouldSearch, setShouldSearch] = useState(false);
@@ -42,11 +42,44 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
42
42
  const deviceType = useDeviceType();
43
43
  const isMobile = deviceType === DeviceType.MOBILE;
44
44
  let initialMaxItems = deviceType === DeviceType.MOBILE ? 8 : 12;
45
+ const appliedInputMidsRef = useRef(null);
45
46
  useEffect(() => {
46
47
  if (!SQD)
47
48
  return;
48
49
  setDataAsync(SQD);
49
50
  }, [SQD]);
51
+ useEffect(() => {
52
+ if (!inputMids || inputMids.length === 0 || !qd || !fromDTD)
53
+ return;
54
+ if (appliedInputMidsRef.current && deepCompare(appliedInputMidsRef.current, inputMids))
55
+ return;
56
+ appliedInputMidsRef.current = inputMids;
57
+ const newWhere = qd.where?.map((curItem) => {
58
+ let newWi = new WhereItem();
59
+ newWi.init({ ...curItem, value1: undefined, value2: undefined });
60
+ return newWi;
61
+ }) || [];
62
+ inputMids.forEach(im => {
63
+ const md = fromDTD.metadata?.find(m => m.id === im.mid);
64
+ const defaultOperator = getDefaultOperator(md?.dataDomain, md?.dataType);
65
+ let existingWi = newWhere.find(wi => wi.mid === im.mid);
66
+ if (existingWi) {
67
+ existingWi.value1 = im.value;
68
+ existingWi.operator = defaultOperator;
69
+ }
70
+ else {
71
+ const wi = new WhereItem();
72
+ wi.tid = fromDTD.id;
73
+ wi.mid = im.mid;
74
+ wi.value1 = im.value;
75
+ wi.operator = defaultOperator;
76
+ wi.or = false;
77
+ newWhere.push(wi);
78
+ }
79
+ });
80
+ setQd({ ...qd, where: newWhere });
81
+ setShowAllMdWhere(true);
82
+ }, [inputMids, qd, fromDTD]);
50
83
  // Eseguire la ricerca quando shouldSearch è true e qd è definito
51
84
  useEffect(() => {
52
85
  if (shouldSearch && qd) {
@@ -155,6 +188,14 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
155
188
  setShowDistinctValuesPanel(true);
156
189
  }
157
190
  }, []);
191
+ const handlePassToArchive = useCallback(() => {
192
+ if (!passToArchiveCallback || !qd?.where)
193
+ return;
194
+ const outputMids = qd.where
195
+ .filter(wi => wi.mid && wi.value1 && wi.value1.length > 0)
196
+ .map(wi => ({ mid: wi.mid, value: wi.value1 }));
197
+ passToArchiveCallback(outputMids);
198
+ }, [passToArchiveCallback, qd?.where]);
158
199
  const handleCloseFiltersConfig = useCallback(() => setShowFiltersConfig(false), []);
159
200
  const handleChooseFilters = useCallback((tid_mids) => {
160
201
  if (!fromDTD?.metadata)
@@ -240,7 +281,7 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
240
281
  { icon: _jsx(IconEdit, {}), beginGroup: true, text: `${SDKUI_Localizator.Configure} - ${SDK_Localizator.QueryWhere}`, onClick: () => { setShowFiltersConfig(true); } },
241
282
  { icon: _jsx(IconEdit, {}), text: `${SDKUI_Localizator.Configure} - ${SDK_Localizator.QuerySelect}`, onClick: () => { setShowOutputConfig(true); } },
242
283
  { icon: _jsx(IconEdit, {}), text: `${SDKUI_Localizator.Configure} - ${SDK_Localizator.QueryOrderBy}`, onClick: () => { setShowOrderByConfig(true); } },
243
- { icon: _jsx(IconMenuCAArchive, { fontSize: 24 }), beginGroup: true, text: SDKUI_Localizator.PassToArchive, onClick: () => passToArchiveCallback?.() }
284
+ { icon: _jsx(IconMenuCAArchive, { fontSize: 24 }), beginGroup: true, text: SDKUI_Localizator.PassToArchive, onClick: handlePassToArchive }
244
285
  ] })
245
286
  : _jsx(_Fragment, {}) }), children: [_jsx(ConfirmQueryParamsDialog, {}), SQD
246
287
  ? _jsxs("div", { style: { height: '100%', width: '100%', position: 'relative', display: 'flex', flexDirection: 'column', gap: 5 }, children: [showAdvancedSearch
@@ -34,7 +34,10 @@ interface ITMSearchResultProps {
34
34
  openAddDocumentForm?: () => void;
35
35
  openS4TViewer?: boolean;
36
36
  onOpenS4TViewerRequest?: (dcmtInfo: Array<DcmtInfo>, onRefreshSearchAsync?: (() => Promise<void>)) => void;
37
- passToArchiveCallback?: () => void;
37
+ passToArchiveCallback?: (outputMids: Array<{
38
+ mid: number;
39
+ value: string;
40
+ }>) => void;
38
41
  showTodoDcmtForm?: boolean;
39
42
  }
40
43
  declare const TMSearchResult: React.FC<ITMSearchResultProps>;
@@ -241,7 +241,7 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
241
241
  return;
242
242
  if (e.target === 'content') {
243
243
  e.items = e.items || [];
244
- const menuItems = getCommandsMenuItems(isMobile, fromDTD, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, showSearch, setShowFloatingBar, openFormHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, openExportForm, handleToggleSearch, handleSignApprove, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback);
244
+ const menuItems = getCommandsMenuItems(isMobile, fromDTD, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, showSearch, setShowFloatingBar, openFormHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, openExportForm, handleToggleSearch, handleSignApprove, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback, currentMetadataValues);
245
245
  e.items.push(...menuItems);
246
246
  }
247
247
  };
@@ -368,7 +368,7 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
368
368
  }
369
369
  };
370
370
  const searchResutlToolbar = _jsxs(_Fragment, { children: [(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 &&
371
- _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(TMCommandsContextMenu, { target: `#commands-header-${id}`, showEvent: "click", menuItems: getCommandsMenuItems(isMobile, fromDTD, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, showSearch, setShowFloatingBar, openFormHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, openExportForm, handleToggleSearch, handleSignApprove, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback) })] });
371
+ _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(TMCommandsContextMenu, { target: `#commands-header-${id}`, showEvent: "click", menuItems: getCommandsMenuItems(isMobile, fromDTD, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, showSearch, setShowFloatingBar, openFormHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, openExportForm, handleToggleSearch, handleSignApprove, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback, currentMetadataValues) })] });
372
372
  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') })] });
373
373
  const handleAddItem = (tid, did) => {
374
374
  let newItem = { TID: tid ?? 0, DID: did ?? 0 };
@@ -385,7 +385,7 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
385
385
  _jsx(TMLayoutItem, { children: _jsx(TMSearchResultSelector, { searchResults: currentSearchResults, disableAccordionIfSingleCategory: disableAccordionIfSingleCategory, selectedTID: selectedSearchResultTID, onSelectionChanged: onSearchResultSelectionChanged }) })
386
386
  :
387
387
  _jsx(_Fragment, {}), _jsxs(TMLayoutItem, { children: [_jsx(TMSearchResultGrid, { showSearch: showSearch, inputFocusedItem: focusedItem, inputSelectedItems: selectedItems, searchResult: searchResults.length > 1 ? selectedSearchResult : searchResults[0], lastUpdateSearchTime: lastUpdateSearchTime, openInOffice: openInOffice, onDblClick: () => openFormHandler(LayoutModes.Update), onContextMenuPreparing: onContextMenuPreparing, onSelectionChanged: (items) => { setSelectedItems(items); }, onVisibleItemChanged: setVisibleItems, onFocusedItemChanged: setFocusedItem, onDownloadDcmtsAsync: async (inputDcmts, downloadType, downloadMode, _y, confirmAttachments) => await downloadDcmtsAsync(inputDcmts, downloadType, downloadMode, onFileOpened, confirmAttachments), showExportForm: showExportForm, onCloseExportForm: onCloseExportForm }), allowFloatingBar && showFloatingBar && deviceType !== DeviceType.MOBILE &&
388
- _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 || !focusedItem?.DID, icon: _jsx(IconDownload, { color: 'white' }), onClick: () => { downloadDcmtsAsync(getSelectedDcmtsOrFocused(selectedItems, focusedItem), DownloadTypes.Dcmt, "download"); } }), allowRelations && _jsx(TMButton, { btnStyle: 'icon', disabled: !currentTIDHasDetailRelations || !focusedItem?.DID, icon: _jsx(IconDetailDcmts, { color: 'white' }), caption: SDKUI_Localizator.DcmtsDetail, onClick: () => setIsOpenDetails(true) }), allowRelations && _jsx(TMButton, { btnStyle: 'icon', disabled: !currentTIDHasMasterRelations || !focusedItem?.DID, icon: _jsx(IconDetailDcmts, { color: 'white', transform: 'scale(-1, 1)' }), caption: SDKUI_Localizator.DcmtsMaster, onClick: () => setIsOpenMaster(true) }), _jsx(IconMenuVertical, { id: `commands-floating-${id}`, color: 'white', cursor: 'pointer' }), _jsx(TMCommandsContextMenu, { target: `#commands-floating-${id}`, showEvent: "click", menuItems: getCommandsMenuItems(isMobile, fromDTD, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, showSearch, setShowFloatingBar, openFormHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, openExportForm, handleToggleSearch, handleSignApprove, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback) })] })] })] }), showApprovePopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: onWFOperationCompleted, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), isReject: 0, onClose: () => setShowApprovePopup(false) }), showRejectPopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: onWFOperationCompleted, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), isReject: 1, onClose: () => setShowRejectPopup(false) }), showReAssignPopup && _jsx(WorkFlowReAssignPopUp, { deviceType: deviceType, onCompleted: onWFOperationCompleted, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), onClose: () => setShowReAssignPopup(false) }), showMoreInfoPopup && _jsx(WorkFlowMoreInfoPopUp, { TID: focusedItem?.TID, DID: focusedItem?.DID, deviceType: deviceType, onCompleted: onWFOperationCompleted, onClose: () => setShowMoreInfoPopup(false) }), isOpenBatchUpdate && _jsx(TMBatchUpdateForm, { isModal: true, titleModal: `${SDKUI_Localizator.BatchUpdate} (${getSelectionDcmtInfo().length} documenti selezionati)`, inputDcmts: getSelectionDcmtInfo(), TID: focusedItem ? focusedItem?.TID : selectedItems[0]?.TID, DID: focusedItem ? focusedItem?.DID : selectedItems[0]?.DID, onBack: () => {
388
+ _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 || !focusedItem?.DID, icon: _jsx(IconDownload, { color: 'white' }), onClick: () => { downloadDcmtsAsync(getSelectedDcmtsOrFocused(selectedItems, focusedItem), DownloadTypes.Dcmt, "download"); } }), allowRelations && _jsx(TMButton, { btnStyle: 'icon', disabled: !currentTIDHasDetailRelations || !focusedItem?.DID, icon: _jsx(IconDetailDcmts, { color: 'white' }), caption: SDKUI_Localizator.DcmtsDetail, onClick: () => setIsOpenDetails(true) }), allowRelations && _jsx(TMButton, { btnStyle: 'icon', disabled: !currentTIDHasMasterRelations || !focusedItem?.DID, icon: _jsx(IconDetailDcmts, { color: 'white', transform: 'scale(-1, 1)' }), caption: SDKUI_Localizator.DcmtsMaster, onClick: () => setIsOpenMaster(true) }), _jsx(IconMenuVertical, { id: `commands-floating-${id}`, color: 'white', cursor: 'pointer' }), _jsx(TMCommandsContextMenu, { target: `#commands-floating-${id}`, showEvent: "click", menuItems: getCommandsMenuItems(isMobile, fromDTD, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, showSearch, setShowFloatingBar, openFormHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, openExportForm, handleToggleSearch, handleSignApprove, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback, currentMetadataValues) })] })] })] }), showApprovePopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: onWFOperationCompleted, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), isReject: 0, onClose: () => setShowApprovePopup(false) }), showRejectPopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: onWFOperationCompleted, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), isReject: 1, onClose: () => setShowRejectPopup(false) }), showReAssignPopup && _jsx(WorkFlowReAssignPopUp, { deviceType: deviceType, onCompleted: onWFOperationCompleted, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), onClose: () => setShowReAssignPopup(false) }), showMoreInfoPopup && _jsx(WorkFlowMoreInfoPopUp, { TID: focusedItem?.TID, DID: focusedItem?.DID, deviceType: deviceType, onCompleted: onWFOperationCompleted, onClose: () => setShowMoreInfoPopup(false) }), isOpenBatchUpdate && _jsx(TMBatchUpdateForm, { isModal: true, titleModal: `${SDKUI_Localizator.BatchUpdate} (${getSelectionDcmtInfo().length} documenti selezionati)`, inputDcmts: getSelectionDcmtInfo(), TID: focusedItem ? focusedItem?.TID : selectedItems[0]?.TID, DID: focusedItem ? focusedItem?.DID : selectedItems[0]?.DID, onBack: () => {
389
389
  setIsOpenBatchUpdate(false);
390
390
  }, onSavedCallbackAsync: async () => {
391
391
  setIsOpenBatchUpdate(false);
@@ -1,7 +1,10 @@
1
1
  import React from 'react';
2
2
  import { DcmtTypeDescriptor, FileDescriptor, FileFormats, LayoutModes, WorkingGroupDescriptor } from '@topconsultnpm/sdk-ts-beta';
3
3
  import { TMDataGridContextMenuItem } from '../../base/TMDataGrid';
4
- import { DcmtInfo, DcmtOperationTypes, DownloadModes, DownloadTypes, SearchResultContext } from '../../../ts';
4
+ import { DcmtInfo, DcmtOperationTypes, DownloadModes, DownloadTypes, MetadataValueDescriptorEx, SearchResultContext } from '../../../ts';
5
5
  export declare const getSelectedDcmtsOrFocused: (selectedItems: Array<any>, focusedItem: any, fileFormat?: FileFormats) => DcmtInfo[];
6
6
  export declare const signatureInformationCallback: (isMobile: boolean, inputDcmts: DcmtInfo[] | undefined) => Promise<void>;
7
- export declare const getCommandsMenuItems: (isMobile: boolean, dtd: DcmtTypeDescriptor | undefined, selectedItems: Array<any>, focusedItem: any, context: SearchResultContext, showFloatingBar: boolean, workingGroupContext: WorkingGroupDescriptor | undefined, showSearch: boolean, setShowFloatingBar: React.Dispatch<React.SetStateAction<boolean>>, openFormHandler: (layoutMode: LayoutModes) => void, downloadDcmtsAsync: (inputDcmts: DcmtInfo[] | undefined, downloadType: DownloadTypes, downloadMode: DownloadModes, onFileDownloaded?: (dcmtFile: File | undefined) => void, confirmAttachments?: (list: FileDescriptor[]) => Promise<string[] | undefined>) => Promise<void>, runOperationAsync: (inputDcmts: DcmtInfo[] | undefined, dcmtOperationType: DcmtOperationTypes, actionAfterOperationAsync?: () => Promise<void>) => Promise<void>, onRefreshSearchAsync: (() => Promise<void>) | undefined, onRefreshDataRowsAsync: (() => Promise<void>) | undefined, onRefreshAfterAddDcmtToFavs: (() => void) | undefined, confirmFormat: () => Promise<FileFormats>, confirmAttachments: (list: FileDescriptor[]) => Promise<string[] | undefined>, openTaskFormHandler: () => void, openDetailDcmtsFormHandler: (value: boolean) => void, openMasterDcmtsFormHandler: (value: boolean) => void, openBatchUpdateFormHandler: (value: boolean) => void, openExportForm: () => void, handleToggleSearch: () => void, handleSignApprove: () => void, openWGsCopyMoveForm?: ((mode: "copyToWgDraft" | "copyToWgArchivedDoc", dcmtTypeDescriptor: DcmtTypeDescriptor, documents: Array<DcmtInfo>) => void), openCommentFormCallback?: ((documents: Array<DcmtInfo>) => void), openEditPdf?: ((documents: Array<DcmtInfo>) => void), openAddDocumentForm?: () => void, passToArchiveCallback?: () => void) => Array<TMDataGridContextMenuItem>;
7
+ export declare const getCommandsMenuItems: (isMobile: boolean, dtd: DcmtTypeDescriptor | undefined, selectedItems: Array<any>, focusedItem: any, context: SearchResultContext, showFloatingBar: boolean, workingGroupContext: WorkingGroupDescriptor | undefined, showSearch: boolean, setShowFloatingBar: React.Dispatch<React.SetStateAction<boolean>>, openFormHandler: (layoutMode: LayoutModes) => void, downloadDcmtsAsync: (inputDcmts: DcmtInfo[] | undefined, downloadType: DownloadTypes, downloadMode: DownloadModes, onFileDownloaded?: (dcmtFile: File | undefined) => void, confirmAttachments?: (list: FileDescriptor[]) => Promise<string[] | undefined>) => Promise<void>, runOperationAsync: (inputDcmts: DcmtInfo[] | undefined, dcmtOperationType: DcmtOperationTypes, actionAfterOperationAsync?: () => Promise<void>) => Promise<void>, onRefreshSearchAsync: (() => Promise<void>) | undefined, onRefreshDataRowsAsync: (() => Promise<void>) | undefined, onRefreshAfterAddDcmtToFavs: (() => void) | undefined, confirmFormat: () => Promise<FileFormats>, confirmAttachments: (list: FileDescriptor[]) => Promise<string[] | undefined>, openTaskFormHandler: () => void, openDetailDcmtsFormHandler: (value: boolean) => void, openMasterDcmtsFormHandler: (value: boolean) => void, openBatchUpdateFormHandler: (value: boolean) => void, openExportForm: () => void, handleToggleSearch: () => void, handleSignApprove: () => void, openWGsCopyMoveForm?: ((mode: "copyToWgDraft" | "copyToWgArchivedDoc", dcmtTypeDescriptor: DcmtTypeDescriptor, documents: Array<DcmtInfo>) => void), openCommentFormCallback?: ((documents: Array<DcmtInfo>) => void), openEditPdf?: ((documents: Array<DcmtInfo>) => void), openAddDocumentForm?: () => void, passToArchiveCallback?: (outputMids: Array<{
8
+ mid: number;
9
+ value: string;
10
+ }>) => void, currentMetadataValues?: MetadataValueDescriptorEx[]) => Array<TMDataGridContextMenuItem>;
@@ -75,7 +75,7 @@ export const signatureInformationCallback = async (isMobile, inputDcmts) => {
75
75
  TMExceptionBoxManager.show({ exception: error });
76
76
  }
77
77
  };
78
- export const getCommandsMenuItems = (isMobile, dtd, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, showSearch, setShowFloatingBar, openFormHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, onRefreshDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, confirmAttachments, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, openExportForm, handleToggleSearch, handleSignApprove, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback) => {
78
+ export const getCommandsMenuItems = (isMobile, dtd, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, showSearch, setShowFloatingBar, openFormHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, onRefreshDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, confirmAttachments, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, openExportForm, handleToggleSearch, handleSignApprove, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback, currentMetadataValues) => {
79
79
  const addToFavoriteMenuItem = () => {
80
80
  return {
81
81
  icon: svgToString(_jsx(IconStar, {})),
@@ -214,7 +214,12 @@ export const getCommandsMenuItems = (isMobile, dtd, selectedItems, focusedItem,
214
214
  text: SDKUI_Localizator.PassToArchive,
215
215
  operationType: 'singleRow',
216
216
  disabled: disabledForSingleRow(selectedItems, focusedItem),
217
- onClick: async () => { passToArchiveCallback && passToArchiveCallback(); }
217
+ onClick: async () => {
218
+ const outputMids = currentMetadataValues
219
+ ?.filter(md => md.mid && md.mid > 100 && md.value && md.value.length > 0)
220
+ .map(md => ({ mid: md.mid, value: md.value })) || [];
221
+ passToArchiveCallback?.(outputMids);
222
+ }
218
223
  };
219
224
  };
220
225
  const pdfEditorMenuItem = (openEditPdfCallback) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.17.3",
3
+ "version": "6.17.4",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",