@topconsultnpm/sdkui-react 6.20.0-dev1.13 → 6.20.0-dev1.131
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/assets/Toppy-help-center.png +0 -0
- package/lib/assets/headergradient.svg +87 -0
- package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +322 -30
- package/lib/components/NewComponents/ContextMenu/hooks.d.ts +8 -1
- package/lib/components/NewComponents/ContextMenu/hooks.js +80 -8
- package/lib/components/NewComponents/ContextMenu/index.d.ts +3 -0
- package/lib/components/NewComponents/ContextMenu/index.js +2 -0
- package/lib/components/NewComponents/ContextMenu/styles.d.ts +9 -1
- package/lib/components/NewComponents/ContextMenu/styles.js +146 -47
- package/lib/components/NewComponents/ContextMenu/types.d.ts +22 -3
- package/lib/components/NewComponents/ContextMenu/useLongPress.d.ts +21 -0
- package/lib/components/NewComponents/ContextMenu/useLongPress.js +112 -0
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +620 -125
- package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +25 -5
- package/lib/components/NewComponents/FloatingMenuBar/styles.js +215 -59
- package/lib/components/NewComponents/FloatingMenuBar/types.d.ts +12 -3
- package/lib/components/base/TMAccordionNew.js +35 -14
- package/lib/components/base/TMButton.js +6 -0
- package/lib/components/base/TMClosableList.js +4 -0
- package/lib/components/base/TMCustomButton.js +61 -17
- package/lib/components/base/TMDataGrid.d.ts +7 -4
- package/lib/components/base/TMDataGrid.js +153 -11
- package/lib/components/base/TMDropDownMenu.js +21 -18
- package/lib/components/base/TMFileManager.d.ts +4 -3
- package/lib/components/base/TMFileManager.js +32 -24
- package/lib/components/base/TMFileManagerDataGridView.d.ts +3 -2
- package/lib/components/base/TMFileManagerDataGridView.js +1 -11
- package/lib/components/base/TMFileManagerThumbnailItems.d.ts +7 -1
- package/lib/components/base/TMFileManagerThumbnailItems.js +5 -2
- package/lib/components/base/TMFileManagerThumbnailsView.d.ts +17 -4
- package/lib/components/base/TMFileManagerThumbnailsView.js +18 -6
- package/lib/components/base/TMFileManagerUtils.d.ts +0 -12
- package/lib/components/base/TMListView.js +33 -15
- package/lib/components/base/TMPanel.d.ts +1 -1
- package/lib/components/base/TMPanel.js +4 -2
- package/lib/components/base/TMPopUp.js +6 -0
- package/lib/components/base/TMToolbarCard.js +2 -0
- package/lib/components/base/TMTreeView.d.ts +2 -1
- package/lib/components/base/TMTreeView.js +33 -26
- package/lib/components/choosers/TMDataListItemChooser.d.ts +2 -0
- package/lib/components/choosers/TMDataListItemChooser.js +8 -2
- package/lib/components/choosers/TMDcmtTypeChooser.d.ts +1 -0
- package/lib/components/choosers/TMDcmtTypeChooser.js +11 -3
- package/lib/components/choosers/TMDistinctValues.js +2 -2
- package/lib/components/choosers/TMDynDataListItemChooser.d.ts +2 -0
- package/lib/components/choosers/TMDynDataListItemChooser.js +8 -2
- package/lib/components/choosers/TMInvoiceRetrieveFormats.js +1 -1
- package/lib/components/choosers/TMMetadataChooser.d.ts +2 -0
- package/lib/components/choosers/TMMetadataChooser.js +19 -4
- package/lib/components/choosers/TMOrderRetrieveFormats.js +1 -1
- package/lib/components/choosers/TMUserChooser.d.ts +2 -5
- package/lib/components/choosers/TMUserChooser.js +33 -47
- package/lib/components/editors/TMCheckBox.js +2 -0
- package/lib/components/editors/TMDateBox.js +18 -9
- package/lib/components/editors/TMEditorStyled.js +7 -0
- package/lib/components/editors/TMLocalizedTextBox.d.ts +3 -1
- package/lib/components/editors/TMLocalizedTextBox.js +16 -14
- package/lib/components/editors/TMMetadataEditor.d.ts +1 -0
- package/lib/components/editors/TMMetadataEditor.js +4 -4
- package/lib/components/editors/TMMetadataTextBox.d.ts +9 -0
- package/lib/components/editors/TMMetadataTextBox.js +92 -0
- package/lib/components/editors/TMMetadataValues.d.ts +2 -0
- package/lib/components/editors/TMMetadataValues.js +26 -8
- package/lib/components/editors/TMRadioButton.js +2 -0
- package/lib/components/editors/TMTextArea.js +18 -30
- package/lib/components/editors/TMTextBox.d.ts +1 -1
- package/lib/components/editors/TMTextBox.js +29 -4
- package/lib/components/editors/TMTextExpression.js +6 -91
- package/lib/components/features/archive/TMArchive.js +2 -2
- package/lib/components/features/assistant/TMToppyDraggableHelpCenter.d.ts +15 -0
- package/lib/components/features/assistant/TMToppyDraggableHelpCenter.js +462 -0
- package/lib/components/features/assistant/TMToppySpeechBubble.d.ts +11 -0
- package/lib/components/features/assistant/TMToppySpeechBubble.js +126 -0
- package/lib/components/features/documents/TMDcmtBlog.js +1 -1
- package/lib/components/features/documents/TMDcmtForm.d.ts +14 -2
- package/lib/components/features/documents/TMDcmtForm.js +576 -292
- package/lib/components/features/documents/TMDcmtPreview.js +42 -155
- package/lib/components/features/documents/TMDcmtTasks.js +9 -9
- package/lib/components/features/documents/TMMasterDetailDcmts.js +38 -53
- package/lib/components/features/documents/TMRelationViewer.d.ts +1 -1
- package/lib/components/features/documents/TMRelationViewer.js +2 -2
- package/lib/components/features/search/TMDcmtCheckoutInfoForm.d.ts +8 -0
- package/lib/components/features/search/{TMSearchResultCheckoutInfoForm.js → TMDcmtCheckoutInfoForm.js} +2 -2
- package/lib/components/features/search/TMSavedQuerySelector.js +72 -67
- package/lib/components/features/search/TMSearch.d.ts +3 -0
- package/lib/components/features/search/TMSearch.js +50 -11
- package/lib/components/features/search/TMSearchQueryEditor.d.ts +1 -0
- package/lib/components/features/search/TMSearchQueryEditor.js +10 -10
- package/lib/components/features/search/TMSearchQueryPanel.d.ts +1 -0
- package/lib/components/features/search/TMSearchQueryPanel.js +40 -25
- package/lib/components/features/search/TMSearchResult.d.ts +3 -0
- package/lib/components/features/search/TMSearchResult.js +370 -252
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +3 -3
- package/lib/components/features/search/TMSearchResultsMenuItems.js +227 -171
- package/lib/components/features/search/TMSignSettingsForm.js +1 -1
- package/lib/components/features/search/TMSignatureInfoContent.d.ts +6 -0
- package/lib/components/features/search/TMSignatureInfoContent.js +140 -0
- package/lib/components/features/search/TMViewHistoryDcmt.js +47 -52
- package/lib/components/features/tasks/TMTaskForm.js +75 -25
- package/lib/components/features/tasks/TMTasksAgenda.d.ts +3 -1
- package/lib/components/features/tasks/TMTasksAgenda.js +48 -9
- package/lib/components/features/tasks/TMTasksCalendar.d.ts +2 -0
- package/lib/components/features/tasks/TMTasksCalendar.js +19 -7
- package/lib/components/features/tasks/TMTasksUtils.d.ts +2 -2
- package/lib/components/features/tasks/TMTasksUtils.js +57 -37
- package/lib/components/features/tasks/TMTasksView.js +28 -19
- package/lib/components/features/workflow/TMWorkflowPopup.d.ts +33 -2
- package/lib/components/features/workflow/TMWorkflowPopup.js +140 -34
- package/lib/components/features/workflow/diagram/DiagramItemComponent.d.ts +2 -0
- package/lib/components/features/workflow/diagram/DiagramItemComponent.js +14 -7
- package/lib/components/features/workflow/diagram/DiagramItemForm.js +1 -1
- package/lib/components/features/workflow/diagram/RecipientList.js +3 -2
- package/lib/components/features/workflow/diagram/WFDiagram.d.ts +4 -0
- package/lib/components/features/workflow/diagram/WFDiagram.js +164 -13
- package/lib/components/forms/Login/LoginValidatorService.d.ts +2 -0
- package/lib/components/forms/Login/LoginValidatorService.js +7 -2
- package/lib/components/forms/Login/TMLoginForm.js +35 -7
- package/lib/components/forms/TMChooserForm.js +1 -1
- package/lib/components/grids/TMBlogsPost.js +56 -31
- package/lib/components/grids/TMRecentsManager.js +20 -10
- package/lib/components/grids/TMValidationItemsList.js +6 -0
- package/lib/components/index.d.ts +6 -3
- package/lib/components/index.js +6 -3
- package/lib/components/layout/panelManager/TMPanelManagerContext.js +13 -5
- package/lib/components/query/TMQueryEditor.d.ts +6 -1
- package/lib/components/query/TMQueryEditor.js +105 -101
- package/lib/components/settings/SettingsAppearance.d.ts +2 -1
- package/lib/components/settings/SettingsAppearance.js +99 -30
- package/lib/components/sidebar/TMHeader.js +11 -7
- package/lib/components/sidebar/TMSidebar.d.ts +0 -1
- package/lib/components/sidebar/TMSidebar.js +16 -44
- package/lib/components/sidebar/TMSidebarItem.js +36 -17
- package/lib/components/viewers/TMDataListItemViewer.d.ts +2 -1
- package/lib/components/viewers/TMDataListItemViewer.js +35 -71
- package/lib/components/viewers/TMDataUserIdItemViewer.d.ts +8 -0
- package/lib/components/viewers/TMDataUserIdItemViewer.js +39 -0
- package/lib/css/tm-sdkui.css +1 -1
- package/lib/helper/SDKUI_Globals.d.ts +22 -0
- package/lib/helper/SDKUI_Globals.js +10 -1
- package/lib/helper/SDKUI_Localizator.d.ts +21 -3
- package/lib/helper/SDKUI_Localizator.js +196 -10
- package/lib/helper/TMCommandsContextMenu.d.ts +4 -2
- package/lib/helper/TMCommandsContextMenu.js +15 -4
- package/lib/helper/TMIcons.d.ts +4 -0
- package/lib/helper/TMIcons.js +13 -3
- package/lib/helper/TMPdfViewer.d.ts +8 -0
- package/lib/helper/TMPdfViewer.js +373 -0
- package/lib/helper/TMToppyMessage.js +4 -0
- package/lib/helper/checkinCheckoutManager.d.ts +31 -1
- package/lib/helper/checkinCheckoutManager.js +112 -30
- package/lib/helper/devextremeCustomMessages.d.ts +30 -0
- package/lib/helper/devextremeCustomMessages.js +30 -0
- package/lib/helper/helpers.d.ts +30 -2
- package/lib/helper/helpers.js +132 -4
- package/lib/helper/index.d.ts +2 -0
- package/lib/helper/index.js +2 -0
- package/lib/helper/queryHelper.d.ts +2 -2
- package/lib/helper/queryHelper.js +80 -24
- package/lib/helper/workItemsHelper.d.ts +6 -0
- package/lib/helper/workItemsHelper.js +230 -0
- package/lib/hooks/useCheckInOutOperations.d.ts +28 -0
- package/lib/hooks/useCheckInOutOperations.js +223 -0
- package/lib/hooks/useDataListItem.d.ts +12 -0
- package/lib/hooks/useDataListItem.js +132 -0
- package/lib/hooks/useDataUserIdItem.d.ts +10 -0
- package/lib/hooks/useDataUserIdItem.js +96 -0
- package/lib/hooks/useFloatingBarPinnedItems.d.ts +11 -0
- package/lib/hooks/useFloatingBarPinnedItems.js +54 -0
- package/lib/hooks/useMetadataExpression.d.ts +19 -0
- package/lib/hooks/useMetadataExpression.js +99 -0
- package/lib/hooks/useSettingsFeedback.d.ts +11 -0
- package/lib/hooks/useSettingsFeedback.js +38 -0
- package/lib/hooks/useWorkflowApprove.d.ts +4 -0
- package/lib/hooks/useWorkflowApprove.js +14 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -2
- package/lib/services/platform_services.d.ts +3 -3
- package/lib/ts/types.d.ts +61 -1
- package/lib/utils/theme.d.ts +1 -1
- package/lib/utils/theme.js +1 -1
- package/package.json +8 -6
- package/lib/components/NewComponents/Notification/Notification.d.ts +0 -4
- package/lib/components/NewComponents/Notification/Notification.js +0 -60
- package/lib/components/NewComponents/Notification/NotificationContainer.d.ts +0 -8
- package/lib/components/NewComponents/Notification/NotificationContainer.js +0 -33
- package/lib/components/NewComponents/Notification/index.d.ts +0 -2
- package/lib/components/NewComponents/Notification/index.js +0 -2
- package/lib/components/NewComponents/Notification/styles.d.ts +0 -21
- package/lib/components/NewComponents/Notification/styles.js +0 -180
- package/lib/components/NewComponents/Notification/types.d.ts +0 -18
- package/lib/components/NewComponents/Notification/types.js +0 -1
- package/lib/components/base/TMContextMenu.d.ts +0 -25
- package/lib/components/base/TMContextMenu.js +0 -109
- package/lib/components/base/TMContextMenuOLD.d.ts +0 -26
- package/lib/components/base/TMContextMenuOLD.js +0 -56
- package/lib/components/base/TMFloatingToolbar.d.ts +0 -9
- package/lib/components/base/TMFloatingToolbar.js +0 -101
- package/lib/components/features/assistant/ToppyDraggableHelpCenter.d.ts +0 -30
- package/lib/components/features/assistant/ToppyDraggableHelpCenter.js +0 -482
- package/lib/components/features/assistant/ToppySpeechBubble.d.ts +0 -9
- package/lib/components/features/assistant/ToppySpeechBubble.js +0 -117
- package/lib/components/features/search/TMSearchResultCheckoutInfoForm.d.ts +0 -8
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import TMTextBox from './TMTextBox';
|
|
4
|
+
import TMContextMenu from '../NewComponents/ContextMenu/TMContextMenu';
|
|
5
|
+
import { useMetadataExpression } from '../../hooks/useMetadataExpression';
|
|
6
|
+
const TMMetadataTextBox = (props) => {
|
|
7
|
+
const { metadatas_Info_Source, Expression_IDs2Names, Expression_Names2IDs } = useMetadataExpression({
|
|
8
|
+
qd: props.qd,
|
|
9
|
+
tid: props.tid
|
|
10
|
+
});
|
|
11
|
+
const insertAtCursor = (textToInsert) => {
|
|
12
|
+
const currentValue = Expression_IDs2Names(props.value) || '';
|
|
13
|
+
let newValue = currentValue;
|
|
14
|
+
let cursorPosition = currentValue.length;
|
|
15
|
+
const activeElement = document.activeElement;
|
|
16
|
+
if (activeElement && activeElement.tagName === 'INPUT' && activeElement.selectionStart !== null) {
|
|
17
|
+
const start = activeElement.selectionStart || 0;
|
|
18
|
+
const end = activeElement.selectionEnd || 0;
|
|
19
|
+
newValue =
|
|
20
|
+
currentValue.substring(0, start) +
|
|
21
|
+
textToInsert +
|
|
22
|
+
currentValue.substring(end);
|
|
23
|
+
cursorPosition = start + textToInsert.length;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
newValue = currentValue + textToInsert;
|
|
27
|
+
cursorPosition = newValue.length;
|
|
28
|
+
}
|
|
29
|
+
const syntheticEvent = {
|
|
30
|
+
target: { value: Expression_Names2IDs(newValue) }
|
|
31
|
+
};
|
|
32
|
+
props.onValueChanged?.(syntheticEvent);
|
|
33
|
+
setTimeout(() => {
|
|
34
|
+
const activeElement = document.activeElement;
|
|
35
|
+
if (activeElement && activeElement.tagName === 'INPUT') {
|
|
36
|
+
activeElement.setSelectionRange(cursorPosition, cursorPosition);
|
|
37
|
+
activeElement.focus();
|
|
38
|
+
}
|
|
39
|
+
}, 0);
|
|
40
|
+
};
|
|
41
|
+
// Crea i menu items per il context menu
|
|
42
|
+
const contextMenuItems = useMemo(() => {
|
|
43
|
+
// Separa metadati di sistema (Mid < 100) da quelli normali
|
|
44
|
+
const systemMetadata = metadatas_Info_Source.filter(mh => mh.Mid < 100);
|
|
45
|
+
const normalMetadata = metadatas_Info_Source.filter(mh => mh.Mid >= 100);
|
|
46
|
+
const items = [];
|
|
47
|
+
// Aggiungi metadati normali
|
|
48
|
+
normalMetadata.forEach(mh => {
|
|
49
|
+
items.push({
|
|
50
|
+
name: mh.MetadataName,
|
|
51
|
+
onClick: () => insertAtCursor(`{@${mh.MetadataName}}`)
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
// Aggiungi sottomenu per metadati di sistema se presenti
|
|
55
|
+
if (systemMetadata.length > 0) {
|
|
56
|
+
items.push({
|
|
57
|
+
name: 'Metadati di sistema',
|
|
58
|
+
beginGroup: normalMetadata.length > 0, // Separatore se ci sono anche metadati normali
|
|
59
|
+
submenu: systemMetadata.map(mh => ({
|
|
60
|
+
name: mh.MetadataName,
|
|
61
|
+
onClick: () => insertAtCursor(`{@${mh.MetadataName}}`)
|
|
62
|
+
}))
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return items;
|
|
66
|
+
}, [metadatas_Info_Source, props.value]);
|
|
67
|
+
const renderButtons = () => {
|
|
68
|
+
const customButtons = [];
|
|
69
|
+
// Aggiungi eventuali bottoni custom passati via props
|
|
70
|
+
if (props.buttons) {
|
|
71
|
+
customButtons.push(...props.buttons);
|
|
72
|
+
}
|
|
73
|
+
return customButtons;
|
|
74
|
+
};
|
|
75
|
+
const handleValueChanged = (e) => {
|
|
76
|
+
const syntheticEvent = {
|
|
77
|
+
...e,
|
|
78
|
+
target: {
|
|
79
|
+
...e.target,
|
|
80
|
+
value: Expression_Names2IDs(e.target.value) || ''
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
props.onValueChanged?.(syntheticEvent);
|
|
84
|
+
};
|
|
85
|
+
// Se non ci sono metadati (qd o tid non specificati), usa TMTextBox normale
|
|
86
|
+
if (!props.qd && !props.tid) {
|
|
87
|
+
return (_jsx(TMTextBox, { ...props, buttons: renderButtons(), value: Expression_IDs2Names(props.value) ?? '', onValueChanged: handleValueChanged }));
|
|
88
|
+
}
|
|
89
|
+
// Altrimenti, wrappa TMTextBox con TMContextMenu
|
|
90
|
+
return (_jsx(TMContextMenu, { items: contextMenuItems, trigger: "right", children: _jsx(TMTextBox, { ...props, buttons: renderButtons(), value: Expression_IDs2Names(props.value) ?? '', onValueChanged: handleValueChanged }) }));
|
|
91
|
+
};
|
|
92
|
+
export default TMMetadataTextBox;
|
|
@@ -41,6 +41,8 @@ interface ITMMetadataValuesProps extends DeviceContextProps {
|
|
|
41
41
|
onAdvancedMenuClick?: (e: AdvancedMenuClickEventArgs) => void;
|
|
42
42
|
onValueChanged?: (mid: MetadataValueDescriptorEx[]) => void;
|
|
43
43
|
onFocusedItemChanged?: (mid: MetadataValueDescriptorEx | undefined) => void;
|
|
44
|
+
updateIsModalOpen?: (isOpen: boolean) => void;
|
|
45
|
+
isReadOnlyOrigin?: boolean;
|
|
44
46
|
}
|
|
45
47
|
declare const TMMetadataValues: React.FC<ITMMetadataValuesProps>;
|
|
46
48
|
export default TMMetadataValues;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
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 styled from "styled-components";
|
|
4
|
-
import { AccessLevels, DcmtTypeListCacheService, LayoutGroupBorderStyles, LayoutGroupOrientations, LayoutItemTypes, LayoutModes, MetadataDataDomains, MetadataDataTypes, SDK_Globals, SystemMIDsAsNumber, SystemTIDs,
|
|
5
|
-
import { IconUndo, IconPencil, IconFunction, IconMenuVertical, IconDataList, SDKUI_Localizator, IconNull, stringIsNullOrEmpty, deepCompare, SDKUI_Globals, IconDcmtTypeSys } from "../../helper";
|
|
4
|
+
import { AccessLevels, DcmtTypeListCacheService, LayoutGroupBorderStyles, LayoutGroupOrientations, LayoutItemTypes, LayoutModes, MetadataDataDomains, MetadataDataTypes, SDK_Globals, SystemMIDsAsNumber, SystemTIDs, WorkItemMetadataNames } from '@topconsultnpm/sdk-ts';
|
|
5
|
+
import { IconUndo, IconPencil, IconFunction, IconMenuVertical, IconDataList, SDKUI_Localizator, IconNull, stringIsNullOrEmpty, deepCompare, SDKUI_Globals, IconDcmtTypeSys, isApprovalWorkflowView } from "../../helper";
|
|
6
6
|
import { TMColors } from "../../utils/theme";
|
|
7
7
|
import TMButton from "../base/TMButton";
|
|
8
8
|
import TMDropDownMenu from "../base/TMDropDownMenu";
|
|
@@ -27,7 +27,7 @@ export var AdvancedMenuButtons;
|
|
|
27
27
|
AdvancedMenuButtons[AdvancedMenuButtons["FormulaEditor"] = 2] = "FormulaEditor";
|
|
28
28
|
AdvancedMenuButtons[AdvancedMenuButtons["DistinctValues"] = 3] = "DistinctValues";
|
|
29
29
|
})(AdvancedMenuButtons || (AdvancedMenuButtons = {}));
|
|
30
|
-
const TMMetadataValues = ({ showCheckBoxes = ShowCheckBoxesMode.Never, checkPerms = true, isReadOnly = false, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, customMenuItems = [], showNullValueCheckBoxes, isOpenDistinctValues = false, openChooserBySingleClick, selectedMID, onFocusedItemChanged, layoutMode = LayoutModes.Update, metadataValues = [], metadataValuesOrig = [], TID, onValueChanged, onAdvancedMenuClick, validationItems, inputMids = [], layout }) => {
|
|
30
|
+
const TMMetadataValues = ({ showCheckBoxes = ShowCheckBoxesMode.Never, checkPerms = true, isReadOnly = false, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, customMenuItems = [], showNullValueCheckBoxes, isOpenDistinctValues = false, openChooserBySingleClick, selectedMID, onFocusedItemChanged, layoutMode = LayoutModes.Update, metadataValues = [], metadataValuesOrig = [], TID, onValueChanged, onAdvancedMenuClick, validationItems, inputMids = [], layout, updateIsModalOpen, isReadOnlyOrigin = false }) => {
|
|
31
31
|
const [dynDataListsToBeRefreshed, setDynDataListsToBeRefreshed] = useState([]);
|
|
32
32
|
const [currentDTD, setCurrentDTD] = useState();
|
|
33
33
|
const [isEditableList, addOrRemoveEditableList] = useMetadataEditableList();
|
|
@@ -280,7 +280,7 @@ const TMMetadataValues = ({ showCheckBoxes = ShowCheckBoxesMode.Never, checkPerm
|
|
|
280
280
|
mdItem.value = item.value;
|
|
281
281
|
}
|
|
282
282
|
onValueChanged?.(newMetadata);
|
|
283
|
-
} }), FormulaHelper.isFormula(item.value)
|
|
283
|
+
}, updateIsModalOpen: updateIsModalOpen }), FormulaHelper.isFormula(item.value)
|
|
284
284
|
? _jsx(IconFunction, { color: "#1a89d3", fontSize: 14, style: { position: "absolute", top: item.md?.dataType === MetadataDataTypes.DateTime ? '3px' : '5px', left: '14px' } })
|
|
285
285
|
: (isEditable(item.mid) || item.isEditable)
|
|
286
286
|
? _jsx(IconPencil, { color: "#138603", fontSize: 14, style: { position: "absolute", top: item.md?.dataType === MetadataDataTypes.DateTime ? '3px' : '5px', left: '16px' } })
|
|
@@ -298,7 +298,7 @@ const TMMetadataValues = ({ showCheckBoxes = ShowCheckBoxesMode.Never, checkPerm
|
|
|
298
298
|
mvd.isSelected = !stringIsNullOrEmpty(mvd.value);
|
|
299
299
|
}
|
|
300
300
|
onValueChanged?.(newValues);
|
|
301
|
-
} }) }), !isReadOnly && _jsx("div", { style: { marginTop: item.md?.dataType === MetadataDataTypes.DateTime ? '12px' : '18px' }, onClick: () => { handleMetadataValueSelection(item); }, children: _jsx(TMDropDownMenu, { backgroundColor: 'white', color: TMColors.button_icon, borderRadius: '3px', content: _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconMenuVertical, {}), showTooltip: false }), disabled: item.isLexProt === 1, items: getAdvancedMenuItems(item) }) })] }, item.mid)), [TID, showCheckBoxes, showNullValueCheckBoxes, isReadOnly, layoutMode, selectedMID, isOpenDistinctValues, openChooserBySingleClick, dynDataListsToBeRefreshed, metadataValues, metadataValuesOrig, validationItems, onValueChanged, handleMetadataValueSelection, getAdvancedMenuItems, onChangeHandler, editorValidationHandler, isEditable]);
|
|
301
|
+
} }) }), (!isReadOnly && !isReadOnlyOrigin) && _jsx("div", { style: { marginTop: item.md?.dataType === MetadataDataTypes.DateTime ? '12px' : '18px' }, onClick: () => { handleMetadataValueSelection(item); }, children: _jsx(TMDropDownMenu, { backgroundColor: 'white', color: TMColors.button_icon, borderRadius: '3px', content: _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconMenuVertical, {}), showTooltip: false }), disabled: item.isLexProt === 1, items: getAdvancedMenuItems(item) }) })] }, item.mid)), [TID, showCheckBoxes, showNullValueCheckBoxes, isReadOnly, isReadOnlyOrigin, layoutMode, selectedMID, isOpenDistinctValues, openChooserBySingleClick, dynDataListsToBeRefreshed, metadataValues, metadataValuesOrig, validationItems, onValueChanged, handleMetadataValueSelection, getAdvancedMenuItems, onChangeHandler, editorValidationHandler, isEditable]);
|
|
302
302
|
const layoutWorkItem = useMemo(() => {
|
|
303
303
|
const workItemData = [];
|
|
304
304
|
const technicalWorkItemData = [];
|
|
@@ -389,17 +389,35 @@ const TMMetadataValues = ({ showCheckBoxes = ShowCheckBoxesMode.Never, checkPerm
|
|
|
389
389
|
return (_jsxs("div", { style: { width: '100%' }, children: [draftData.length > 0 && _jsx(TMAccordion, { title: SDKUI_Localizator.Draft, children: draftData.map(item => renderMetadataItem(item, isReadOnly)) }), checkOutData.length > 0 && _jsx(TMAccordion, { title: `${SDKUI_Localizator.CheckIn}/${SDKUI_Localizator.CheckOut}`, children: checkOutData.map(item => renderMetadataItem(item, true)) })] }));
|
|
390
390
|
}, [metadataValues, showCheckBoxes, showNullValueCheckBoxes, isReadOnly, dynDataListsToBeRefreshed, validationItems, selectedMID, isOpenDistinctValues, openChooserBySingleClick, metadataValuesOrig]);
|
|
391
391
|
const layoutChronology = useMemo(() => {
|
|
392
|
-
|
|
392
|
+
// Definiamo l'ordine desiderato: Version, Tipo, Dimensione, Autore, Data Ultima modifica
|
|
393
|
+
const desiredChronologyOrder = [
|
|
394
|
+
ChronologyMIDs.Ver,
|
|
395
|
+
SystemMIDsAsNumber.FileExt,
|
|
396
|
+
SystemMIDsAsNumber.FileSize,
|
|
397
|
+
ChronologyMIDs.AuthorID,
|
|
398
|
+
ChronologyMIDs.CheckInTime,
|
|
399
|
+
];
|
|
400
|
+
const tempChronologyDataMap = {};
|
|
393
401
|
metadataValues.forEach(item => {
|
|
394
402
|
switch (item.md?.id) {
|
|
395
403
|
case ChronologyMIDs.Ver:
|
|
396
404
|
case ChronologyMIDs.AuthorID:
|
|
397
|
-
|
|
405
|
+
case ChronologyMIDs.CheckInTime:
|
|
406
|
+
case SystemMIDsAsNumber.FileExt:
|
|
407
|
+
case SystemMIDsAsNumber.FileSize:
|
|
408
|
+
tempChronologyDataMap[item.md.id] = item;
|
|
398
409
|
break;
|
|
399
410
|
default:
|
|
400
411
|
break;
|
|
401
412
|
}
|
|
402
413
|
});
|
|
414
|
+
// Visualizziamo nell'ordine desiderato
|
|
415
|
+
const chronologyData = [];
|
|
416
|
+
desiredChronologyOrder.forEach(id => {
|
|
417
|
+
if (tempChronologyDataMap[id]) {
|
|
418
|
+
chronologyData.push(tempChronologyDataMap[id]);
|
|
419
|
+
}
|
|
420
|
+
});
|
|
403
421
|
return (_jsx("div", { style: { width: '100%' }, children: chronologyData.length > 0 && chronologyData.map(item => renderMetadataItem(item, isReadOnly)) }));
|
|
404
422
|
}, [metadataValues, showCheckBoxes, showNullValueCheckBoxes, isReadOnly, dynDataListsToBeRefreshed, validationItems, selectedMID, isOpenDistinctValues, openChooserBySingleClick, metadataValuesOrig]);
|
|
405
423
|
const layoutDsAttachs = useMemo(() => {
|
|
@@ -550,7 +568,7 @@ const TMMetadataValues = ({ showCheckBoxes = ShowCheckBoxesMode.Never, checkPerm
|
|
|
550
568
|
if (allSystem) {
|
|
551
569
|
return metadataValues.map((item) => renderMetadataItem(item, true));
|
|
552
570
|
}
|
|
553
|
-
if (currentDTD
|
|
571
|
+
if (isApprovalWorkflowView(currentDTD) && !isReadOnly) {
|
|
554
572
|
return layoutWorkItem;
|
|
555
573
|
}
|
|
556
574
|
switch (currentDTD?.id) {
|
|
@@ -39,6 +39,8 @@ const StyledradioButtonLabel = styled.label `
|
|
|
39
39
|
font-size: ${props => props.$fontSize};
|
|
40
40
|
color: ${props => !props.$disabled ? props.$isModifiedWhen ? TMColors.isModified : TMColors.text_normal : TMColors.disabled};
|
|
41
41
|
user-select: none;
|
|
42
|
+
-webkit-touch-callout: none;
|
|
43
|
+
-webkit-user-select: none;
|
|
42
44
|
width: 100%;
|
|
43
45
|
cursor: ${props => !props.$disabled && 'pointer'};
|
|
44
46
|
&:focus{
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { useState, useEffect, useRef } from 'react';
|
|
3
3
|
import { StyledEditorContainer, StyledEditorIcon, StyledEditorLabel, StyledTextareaEditor } from './TMEditorStyled';
|
|
4
4
|
import { FontSize, TMColors } from '../../utils/theme';
|
|
5
|
-
import TMContextMenu
|
|
5
|
+
import TMContextMenu from '../NewComponents/ContextMenu/TMContextMenu';
|
|
6
6
|
import { TMExceptionBoxManager } from '../base/TMPopUp';
|
|
7
7
|
import TMLayoutContainer, { TMLayoutItem } from '../base/TMLayout';
|
|
8
8
|
import TMVilViewer from '../base/TMVilViewer';
|
|
@@ -35,14 +35,10 @@ const TMTextArea = (props) => {
|
|
|
35
35
|
const [isFocused, setIsFocused] = useState(false);
|
|
36
36
|
// Stores the current value of the textarea
|
|
37
37
|
const [currentValue, setCurrentValue] = useState(value);
|
|
38
|
-
// Stores the items for the context menu
|
|
39
|
-
const [formulaMenuItems, setFormulaMenuItems] = useState([]);
|
|
40
38
|
// Stores the calculated number of rows for the textarea
|
|
41
39
|
const [calculatedRows, setCalculatedRows] = useState(rows ?? 1);
|
|
42
40
|
//Show chooserForm formulaItems
|
|
43
41
|
const [showFormulaItemsChooser, setShowFormulaItemsChooser] = useState(false);
|
|
44
|
-
// Manages the state for the custom context menu
|
|
45
|
-
const { clicked, setClicked, points, setPoints } = useContextMenu();
|
|
46
42
|
const deviceType = useDeviceType();
|
|
47
43
|
// Attach a `ResizeObserver` to the textarea to monitor changes in width: dynamically updates rows based on textarea content and width
|
|
48
44
|
useEffect(() => {
|
|
@@ -69,16 +65,15 @@ const TMTextArea = (props) => {
|
|
|
69
65
|
setCalculatedRows(newRowCount);
|
|
70
66
|
}
|
|
71
67
|
}, [currentValue, autoCalculateRows]);
|
|
72
|
-
//
|
|
73
|
-
|
|
74
|
-
if (formulaItems
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}, [formulaItems]);
|
|
68
|
+
// Build context menu items for formulas
|
|
69
|
+
const getFormulaMenuItems = () => {
|
|
70
|
+
if (!formulaItems || formulaItems.length === 0)
|
|
71
|
+
return [];
|
|
72
|
+
return formulaItems.map(formula => ({
|
|
73
|
+
name: formula,
|
|
74
|
+
onClick: () => insertText(formula)
|
|
75
|
+
}));
|
|
76
|
+
};
|
|
82
77
|
function getFormulaDataSorce() {
|
|
83
78
|
let fiarray = [];
|
|
84
79
|
if (!formulaItems)
|
|
@@ -153,20 +148,8 @@ const TMTextArea = (props) => {
|
|
|
153
148
|
};
|
|
154
149
|
// Renders the textarea
|
|
155
150
|
const renderTextArea = () => {
|
|
156
|
-
|
|
157
|
-
onBlur?.(currentValue); }, onChange: (e) => { setCurrentValue(e.target.value); onValueChanged?.(e); },
|
|
158
|
-
if (formulaItems.length <= 0)
|
|
159
|
-
return;
|
|
160
|
-
// prevent default right click behavior
|
|
161
|
-
e.preventDefault();
|
|
162
|
-
// set our click state to true when a user right clicks
|
|
163
|
-
setClicked(true);
|
|
164
|
-
const bounds = e.currentTarget.getBoundingClientRect();
|
|
165
|
-
const x = e.clientX - bounds.left;
|
|
166
|
-
const y = e.clientY - bounds.top;
|
|
167
|
-
// set the x and y coordinates of our users right click
|
|
168
|
-
setPoints({ x, y });
|
|
169
|
-
}, "$isMobile": deviceType === DeviceType.MOBILE, "$maxHeight": maxHeight, "$disabled": disabled, "$vil": validationItems, "$isModified": isModifiedWhen, "$fontSize": fontSize, "$width": width, "$resize": resize }), _jsxs("div", { style: { display: 'flex', flexDirection: 'row', justifyContent: 'flex-start', alignItems: 'center', position: 'absolute', right: '6px', top: calculatedRows === 1 ? (label.length > 0 ? '20px' : '7px') : (label.length > 0 ? '22px' : '7px'), pointerEvents: disabled ? 'none' : 'auto', opacity: disabled ? 0.4 : 1 }, children: [formulaItems.length > 0 &&
|
|
151
|
+
const textareaElement = _jsxs(_Fragment, { children: [_jsx(StyledTextareaEditor, { ref: inputRef, autoFocus: autoFocus, readOnly: readOnly, disabled: disabled, value: currentValue, placeholder: placeHolder, rows: calculatedRows, maxLength: maxLength, spellCheck: false, onFocus: () => setIsFocused(true), onBlur: (e) => { setIsFocused(false); if (currentValue != value)
|
|
152
|
+
onBlur?.(currentValue); }, onChange: (e) => { setCurrentValue(e.target.value); onValueChanged?.(e); }, "$isMobile": deviceType === DeviceType.MOBILE, "$maxHeight": maxHeight, "$disabled": disabled, "$vil": validationItems, "$isModified": isModifiedWhen, "$fontSize": fontSize, "$width": width, "$resize": resize }), _jsxs("div", { style: { display: 'flex', flexDirection: 'row', justifyContent: 'flex-start', alignItems: 'center', position: 'absolute', right: '6px', top: calculatedRows === 1 ? (label.length > 0 ? '20px' : '7px') : (label.length > 0 ? '22px' : '7px'), pointerEvents: disabled ? 'none' : 'auto', opacity: disabled ? 0.4 : 1 }, children: [formulaItems.length > 0 &&
|
|
170
153
|
_jsx(StyledTextAreaEditorButton, { onClick: () => {
|
|
171
154
|
setShowFormulaItemsChooser(true);
|
|
172
155
|
}, children: _jsx(IconDataList, {}) }), showClearButton && currentValue &&
|
|
@@ -178,7 +161,12 @@ const TMTextArea = (props) => {
|
|
|
178
161
|
onBlur?.(undefined);
|
|
179
162
|
}, children: _jsx(IconClearButton, {}) }), buttons.map((buttonItem, index) => {
|
|
180
163
|
return (_jsx(StyledTextAreaEditorButton, { onClick: buttonItem.onClick, children: _jsx(TMTooltip, { content: buttonItem.text, children: buttonItem.icon }) }, buttonItem.text));
|
|
181
|
-
})] }), openFormulaItemsChooser(),
|
|
164
|
+
})] }), openFormulaItemsChooser(), _jsx(TMVilViewer, { vil: validationItems })] });
|
|
165
|
+
// Wrap with context menu if formula items exist
|
|
166
|
+
if (formulaItems.length > 0) {
|
|
167
|
+
return (_jsx(TMContextMenu, { items: getFormulaMenuItems(), trigger: "right", children: textareaElement }));
|
|
168
|
+
}
|
|
169
|
+
return textareaElement;
|
|
182
170
|
};
|
|
183
171
|
// Layout for the textarea with a left-aligned label
|
|
184
172
|
const renderedLeftLabelTextArea = () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ITMEditorBase } from '../base/TMEditorBase';
|
|
3
3
|
export type TextBoxType = 'text' | 'email' | 'password' | 'number' | 'secureText';
|
|
4
|
-
interface ITMTextBox extends ITMEditorBase {
|
|
4
|
+
export interface ITMTextBox extends ITMEditorBase {
|
|
5
5
|
autoFocus?: boolean;
|
|
6
6
|
formulaItems?: string[];
|
|
7
7
|
maxValue?: number;
|
|
@@ -9,7 +9,7 @@ import { TMExceptionBoxManager } from '../base/TMPopUp';
|
|
|
9
9
|
import TMLayoutContainer, { TMLayoutItem } from '../base/TMLayout';
|
|
10
10
|
import TMVilViewer from '../base/TMVilViewer';
|
|
11
11
|
import TMTooltip from '../base/TMTooltip';
|
|
12
|
-
import
|
|
12
|
+
import TMContextMenu from '../NewComponents/ContextMenu/TMContextMenu';
|
|
13
13
|
import { DeviceType, useDeviceType } from '../base/TMDeviceProvider';
|
|
14
14
|
import TMChooserForm from '../forms/TMChooserForm';
|
|
15
15
|
import { FormulaItemHelper } from './TMTextExpression';
|
|
@@ -94,7 +94,10 @@ const TMTextBox = ({ autoFocus, maxLength, labelColor, precision, fromModal = fa
|
|
|
94
94
|
if (formulaItems && formulaItems.length > 0) {
|
|
95
95
|
let menuItems = [];
|
|
96
96
|
for (const formula of formulaItems) {
|
|
97
|
-
menuItems.push({
|
|
97
|
+
menuItems.push({
|
|
98
|
+
name: formula,
|
|
99
|
+
onClick: () => insertText(formula)
|
|
100
|
+
});
|
|
98
101
|
}
|
|
99
102
|
setFormulaMenuItems(menuItems);
|
|
100
103
|
}
|
|
@@ -253,13 +256,35 @@ const TMTextBox = ({ autoFocus, maxLength, labelColor, precision, fromModal = fa
|
|
|
253
256
|
? bulletEntity.repeat(currentValue?.length ?? 0)
|
|
254
257
|
: currentValue ?? '')
|
|
255
258
|
: currentValue ?? '';
|
|
259
|
+
// Calcola il padding-right necessario per evitare sovrapposizione con i bottoni
|
|
260
|
+
const calculateRightPadding = () => {
|
|
261
|
+
if (initialType === 'password')
|
|
262
|
+
return 10; // Solo l'icona show/hide password
|
|
263
|
+
let buttonCount = 0;
|
|
264
|
+
if (formulaItems.length > 0)
|
|
265
|
+
buttonCount++; // IconDataList
|
|
266
|
+
if (showClearButton && currentValue)
|
|
267
|
+
buttonCount++; // IconClearButton
|
|
268
|
+
buttonCount += buttons.length; // Custom buttons
|
|
269
|
+
if (currentType === 'number') {
|
|
270
|
+
// Per i number, non aggiungiamo padding-right perché le freccette native
|
|
271
|
+
// occupano già spazio. Se ci sono bottoni custom a sinistra delle freccette,
|
|
272
|
+
// il loro posizionamento assoluto (right: 25px) li gestisce correttamente
|
|
273
|
+
return 4; // Padding minimo
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
// Per gli altri tipi, calcolo normale
|
|
277
|
+
const buttonWidth = 28;
|
|
278
|
+
return 6 + (buttonCount * buttonWidth) + 8;
|
|
279
|
+
}
|
|
280
|
+
};
|
|
256
281
|
return (_jsxs("div", { style: { width: '100%', height: 'fit-content' }, id: `text-${id}`, children: [_jsx(StyledEditor, { ref: inputRef, id: `text-${label}-${id}`, name: label, autoFocus: autoFocus, readOnly: readOnly, type: currentType, disabled: disabled, value: displayedValue, width: width || '100%', placeholder: placeHolder, maxLength: maxLength, autoComplete: 'off', spellCheck: false, onFocus: () => setIsFocused(true), onBlur: (e) => { setIsFocused(false); if (currentValue != value)
|
|
257
282
|
onBlur?.(currentValue); }, onChange: handleInputChange, onKeyDown: (e) => {
|
|
258
283
|
if (currentType === 'number') {
|
|
259
284
|
if (!scale && (e.key == "." || e.key == ","))
|
|
260
285
|
e.preventDefault();
|
|
261
286
|
}
|
|
262
|
-
}, "$isMobile": deviceType === DeviceType.MOBILE, "$disabled": disabled, "$vil": validationItems, "$isModified": isModifiedWhen, "$fontSize": fontSize, "$maxValue": maxValue, "$width": width, "$type": currentType, "$borderRadius": borderRadius }), (initialType === 'password' || initialType === 'secureText') && _jsx(StyledShowPasswordIcon, { onClick: toggleShowPassword, "$disabled": disabled, "$vil": validationItems, "$isModified": isModifiedWhen, children: showPasswordIcon() }), initialType !== 'password' &&
|
|
287
|
+
}, "$isMobile": deviceType === DeviceType.MOBILE, "$disabled": disabled, "$vil": validationItems, "$isModified": isModifiedWhen, "$fontSize": fontSize, "$maxValue": maxValue, "$width": width, "$type": currentType, "$borderRadius": borderRadius, style: { paddingRight: `${calculateRightPadding()}px` } }), (initialType === 'password' || initialType === 'secureText') && _jsx(StyledShowPasswordIcon, { onClick: toggleShowPassword, "$disabled": disabled, "$vil": validationItems, "$isModified": isModifiedWhen, children: showPasswordIcon() }), initialType !== 'password' &&
|
|
263
288
|
_jsxs("div", { style: { display: 'flex', flexDirection: 'row', justifyContent: 'flex-start', alignItems: 'center', position: 'absolute', right: type === 'number' ? '25px' : '6px', top: label.length > 0 ? '20px' : '3px', pointerEvents: disabled ? 'none' : 'auto', opacity: disabled ? 0.4 : 1 }, children: [formulaItems.length > 0 &&
|
|
264
289
|
_jsx(StyledTextBoxEditorButton, { onClick: () => {
|
|
265
290
|
setShowFormulaItemsChooser(true);
|
|
@@ -269,7 +294,7 @@ const TMTextBox = ({ autoFocus, maxLength, labelColor, precision, fromModal = fa
|
|
|
269
294
|
onBlur?.(undefined);
|
|
270
295
|
}, children: _jsx(IconClearButton, {}) }), buttons.map((buttonItem, index) => {
|
|
271
296
|
return (_jsx(StyledTextBoxEditorButton, { onClick: buttonItem.onClick, children: _jsx(TMTooltip, { content: buttonItem.text, children: buttonItem.icon }) }, buttonItem.text));
|
|
272
|
-
})] }), openFormulaItemsChooser(), formulaItems.length > 0 && (_jsx(
|
|
297
|
+
})] }), openFormulaItemsChooser(), formulaItems.length > 0 && (_jsx(TMContextMenu, { items: formulaMenuItems, target: `#text-${id}` })), _jsx(TMVilViewer, { vil: validationItems })] }));
|
|
273
298
|
};
|
|
274
299
|
const renderedLeftLabelTextBox = () => {
|
|
275
300
|
return (_jsxs(TMLayoutContainer, { direction: 'horizontal', children: [icon && _jsx(TMLayoutItem, { width: '20px', children: _jsx(StyledEditorIcon, { "$disabled": disabled, "$vil": validationItems, "$isModified": isModifiedWhen, children: icon }) }), _jsx(TMLayoutItem, { children: _jsxs(StyledEditorContainer, { "$width": width, children: [label && _jsx(StyledEditorLabel, { "$color": labelColor, "$isFocused": isFocused, "$labelPosition": labelPosition, "$disabled": disabled, children: label }), renderInputField()] }) })] }));
|
|
@@ -1,96 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { DcmtTypeListCacheService } from '@topconsultnpm/sdk-ts';
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
4
3
|
import { IconClear, IconColumns, SDKUI_Localizator, stringIsNullOrEmpty } from '../../helper';
|
|
5
|
-
import { TMExceptionBoxManager } from '../base/TMPopUp';
|
|
6
4
|
import { TMMetadataChooserForm } from '../choosers/TMMetadataChooser';
|
|
7
5
|
import TMTextBox from './TMTextBox';
|
|
8
6
|
import TMTextArea from './TMTextArea';
|
|
7
|
+
import { useMetadataExpression } from '../../hooks/useMetadataExpression';
|
|
9
8
|
const TMTextExpression = (props) => {
|
|
10
|
-
const
|
|
9
|
+
const { metadatas_Info_Source, Expression_IDs2Names, Expression_Names2IDs } = useMetadataExpression({
|
|
10
|
+
qd: props.qd,
|
|
11
|
+
tid: props.tid
|
|
12
|
+
});
|
|
11
13
|
const [showMetadataChooser, setShowMetadataChooser] = useState(false);
|
|
12
14
|
const [showFormulaChooser, setShowFormulaChooser] = useState(false);
|
|
13
|
-
useEffect(() => { MetadataInfos_Source_Get_Async(); }, [props.qd]);
|
|
14
|
-
useEffect(() => { MetadataInfos_Source_GetByTID_Async(); }, [props.tid]);
|
|
15
|
-
async function MetadataInfos_Source_Get_Async() {
|
|
16
|
-
if (!props.qd?.select)
|
|
17
|
-
return;
|
|
18
|
-
let mhs_source = [];
|
|
19
|
-
try {
|
|
20
|
-
let dtd_source;
|
|
21
|
-
let md_source;
|
|
22
|
-
let tid_source = -1;
|
|
23
|
-
let si;
|
|
24
|
-
let sis = props.qd?.select?.slice();
|
|
25
|
-
sis = sis.slice().sort((a, b) => a.tid - b.tid);
|
|
26
|
-
for (si of sis) {
|
|
27
|
-
if (si.tid == undefined || si.mid == undefined)
|
|
28
|
-
continue;
|
|
29
|
-
if (tid_source != si.tid) {
|
|
30
|
-
dtd_source = await DcmtTypeListCacheService.GetAsync(si.tid, true);
|
|
31
|
-
if (dtd_source == undefined)
|
|
32
|
-
continue;
|
|
33
|
-
tid_source = si.tid;
|
|
34
|
-
}
|
|
35
|
-
if (dtd_source?.metadata == undefined)
|
|
36
|
-
continue;
|
|
37
|
-
md_source = dtd_source.metadata.find(o => o.id == si.mid);
|
|
38
|
-
if (md_source?.name == undefined)
|
|
39
|
-
continue;
|
|
40
|
-
if (tid_source == undefined)
|
|
41
|
-
continue;
|
|
42
|
-
mhs_source.push(new MetatadaHelper(si.mid, md_source.name));
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
catch (e) {
|
|
46
|
-
TMExceptionBoxManager.show({ exception: e, title: 'MetadataInfos_Source_Get_Async' });
|
|
47
|
-
}
|
|
48
|
-
setMetadatas_Info_Source(mhs_source);
|
|
49
|
-
}
|
|
50
|
-
async function MetadataInfos_Source_GetByTID_Async() {
|
|
51
|
-
if (!props.tid)
|
|
52
|
-
return;
|
|
53
|
-
let mhs_source = [];
|
|
54
|
-
try {
|
|
55
|
-
let dtd_source = await DcmtTypeListCacheService.GetAsync(props.tid, true);
|
|
56
|
-
if (dtd_source == undefined)
|
|
57
|
-
return;
|
|
58
|
-
if (dtd_source?.metadata == undefined)
|
|
59
|
-
return;
|
|
60
|
-
for (let md_source of dtd_source?.metadata) {
|
|
61
|
-
if (md_source?.name == undefined)
|
|
62
|
-
continue;
|
|
63
|
-
if (md_source?.id == undefined)
|
|
64
|
-
continue;
|
|
65
|
-
mhs_source.push(new MetatadaHelper(md_source.id, md_source.name));
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
catch (e) {
|
|
69
|
-
TMExceptionBoxManager.show({ exception: e, title: 'MetadataInfos_Source_GetByTID_Async' });
|
|
70
|
-
}
|
|
71
|
-
setMetadatas_Info_Source(mhs_source);
|
|
72
|
-
}
|
|
73
|
-
function Expression_IDs2Names(expression) {
|
|
74
|
-
if (expression == undefined)
|
|
75
|
-
return expression;
|
|
76
|
-
let temp = expression.slice();
|
|
77
|
-
let mh;
|
|
78
|
-
for (mh of metadatas_Info_Source) {
|
|
79
|
-
temp = temp.replaceAll(`{@${mh.Mid}}`, `{@${mh.MetadataName}}`);
|
|
80
|
-
}
|
|
81
|
-
temp = temp.replaceAll("{@1}", "{@DID}");
|
|
82
|
-
return temp;
|
|
83
|
-
}
|
|
84
|
-
function Expression_Names2IDs(expression) {
|
|
85
|
-
if (expression == undefined)
|
|
86
|
-
return expression;
|
|
87
|
-
let temp = expression.slice();
|
|
88
|
-
let mh;
|
|
89
|
-
for (mh of metadatas_Info_Source)
|
|
90
|
-
temp = temp.replaceAll(`{@${mh.MetadataName}}`, `{@${mh.Mid}}`);
|
|
91
|
-
temp = temp.replaceAll("{@DID}", "{@1}");
|
|
92
|
-
return temp;
|
|
93
|
-
}
|
|
94
15
|
const renderButtons = () => {
|
|
95
16
|
let buttons = [];
|
|
96
17
|
if (props.qd || props.tid)
|
|
@@ -167,12 +88,6 @@ const TMTextExpression = (props) => {
|
|
|
167
88
|
:
|
|
168
89
|
_jsx(TMTextArea, { buttons: renderButtons(), formulaItems: props.formulaItems, isModifiedWhen: props.value != props.valueOrig, label: props.label, rows: props.rows, resize: false, placeHolder: props.placeHolder, value: Expression_IDs2Names(props.value) ?? '', validationItems: props.validationItems, onValueChanged: (e) => { props.onValueChanged?.(Expression_Names2IDs(e.target.value)); } }), openMetadataChooseForm(), " "] }));
|
|
169
90
|
};
|
|
170
|
-
class MetatadaHelper {
|
|
171
|
-
constructor(mid, metadataName) {
|
|
172
|
-
this.Mid = mid;
|
|
173
|
-
this.MetadataName = metadataName;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
91
|
export class FormulaItemHelper {
|
|
177
92
|
constructor() {
|
|
178
93
|
this.id = 0;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
3
3
|
import Logo from '../../../assets/Toppy-generico.png';
|
|
4
4
|
import { DcmtTypeListCacheService, LayoutModes, SDK_Localizator } from '@topconsultnpm/sdk-ts';
|
|
5
|
-
import { IconTree, SDKUI_Globals, SDKUI_Localizator, IconRecentlyViewed, IconPreview, IconShow, IconBoard, IconDcmtTypeSys, removeMruTid } from '../../../helper';
|
|
5
|
+
import { IconTree, SDKUI_Globals, SDKUI_Localizator, IconRecentlyViewed, IconPreview, IconShow, IconBoard, IconDcmtTypeSys, removeMruTid, getMoreInfoTasksForDocument } from '../../../helper';
|
|
6
6
|
import { useDeviceType, DeviceType } from '../../base/TMDeviceProvider';
|
|
7
7
|
import TMLayoutContainer from '../../base/TMLayout';
|
|
8
8
|
import TMRecentsManager from '../../grids/TMRecentsManager';
|
|
@@ -77,7 +77,7 @@ const TMArchive = ({ onDcmtTypeSelect = undefined, inputTID, inputFile = null, c
|
|
|
77
77
|
if (onDcmtTypeSelect)
|
|
78
78
|
onDcmtTypeSelect(tidToUse);
|
|
79
79
|
passToSearch(tidToUse, outputMids);
|
|
80
|
-
} : undefined, isSharedDcmt: isSharedArchive, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }, currentTID)
|
|
80
|
+
} : undefined, isSharedDcmt: isSharedArchive, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, moreInfoTasks: getMoreInfoTasksForDocument(allTasks, currentTID, currentTID === inputTID ? inputDID : undefined) }, currentTID)
|
|
81
81
|
:
|
|
82
82
|
_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, currentInputMids, enableDragDropOverlay, isSharedArchive, allTasks]);
|
|
83
83
|
const allInitialPanelVisibility = {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface TMToppyDraggableHelpCenterProps {
|
|
3
|
+
/** Contenuto da visualizzare nella speech bubble */
|
|
4
|
+
content?: React.ReactNode;
|
|
5
|
+
/** Se true, renderizza Toppy nel document.body tramite Portal invece che nel parent */
|
|
6
|
+
usePortal?: boolean;
|
|
7
|
+
/** Allineamento iniziale del componente (destra o sinistra) */
|
|
8
|
+
align?: 'right' | 'left';
|
|
9
|
+
/** Visibilità del componente */
|
|
10
|
+
isVisible?: boolean;
|
|
11
|
+
/** Callback chiamato quando si clicca sull'immagine di Toppy */
|
|
12
|
+
onToppyImageClick?: () => void;
|
|
13
|
+
}
|
|
14
|
+
declare const TMToppyDraggableHelpCenter: (props: TMToppyDraggableHelpCenterProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export default TMToppyDraggableHelpCenter;
|