@topconsultnpm/sdkui-react 6.22.0-t1 → 6.22.0-t3
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/components/NewComponents/ContextMenu/TMContextMenu.js +3 -3
- package/lib/components/NewComponents/ContextMenu/hooks.d.ts +1 -1
- package/lib/components/NewComponents/ContextMenu/styles.d.ts +45 -43
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +6 -6
- package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +80 -73
- package/lib/components/base/Styled.d.ts +92 -76
- package/lib/components/base/Styled.js +7 -5
- package/lib/components/base/TMAccordionNew.js +7 -7
- package/lib/components/base/TMAlert.d.ts +32 -32
- package/lib/components/base/TMAlert.js +6 -8
- package/lib/components/base/TMAreaManager.js +53 -55
- package/lib/components/base/TMButton.d.ts +13 -0
- package/lib/components/base/TMButton.js +139 -7
- package/lib/components/base/TMClosableList.js +3 -3
- package/lib/components/base/TMCustomButton.js +40 -48
- package/lib/components/base/TMDataGrid.d.ts +4 -0
- package/lib/components/base/TMDataGrid.js +292 -12
- package/lib/components/base/TMDataGridExportForm.js +39 -30
- package/lib/components/base/TMDropDownMenu.js +1 -1
- package/lib/components/base/TMEditorBase.d.ts +2 -0
- package/lib/components/base/TMFileManager.js +5 -3
- package/lib/components/base/TMFileManagerDataGridView.js +12 -3
- package/lib/components/base/TMFileManagerThumbnailItems.js +20 -10
- package/lib/components/base/TMFileManagerUtils.d.ts +6 -6
- package/lib/components/base/TMFileManagerUtils.js +37 -1
- package/lib/components/base/TMLayout.d.ts +2 -2
- package/lib/components/base/TMLayout.js +3 -3
- package/lib/components/base/TMList.js +1 -1
- package/lib/components/base/TMListView.js +3 -3
- package/lib/components/base/TMModal.d.ts +11 -0
- package/lib/components/base/TMModal.js +47 -13
- package/lib/components/base/TMPanel.d.ts +6 -0
- package/lib/components/base/TMPanel.js +141 -28
- package/lib/components/base/TMPopUp.js +5 -2
- package/lib/components/base/TMResizableMenu.js +2 -2
- package/lib/components/base/TMRightSidebar.js +1 -1
- package/lib/components/base/TMShowAllOrMaxItemsButton.js +1 -1
- package/lib/components/base/TMSpinner.d.ts +2 -1
- package/lib/components/base/TMSpinner.js +9 -7
- package/lib/components/base/TMTab.js +2 -2
- package/lib/components/base/TMTabControl.d.ts +106 -0
- package/lib/components/base/TMTabControl.js +664 -0
- package/lib/components/base/TMToggleButton.js +2 -2
- package/lib/components/base/TMToolbarCard.js +3 -3
- package/lib/components/base/TMTooltip.d.ts +2 -1
- package/lib/components/base/TMTooltip.js +24 -8
- package/lib/components/base/TMTreeView.d.ts +13 -7
- package/lib/components/base/TMTreeView.js +143 -70
- package/lib/components/base/TMWaitPanel.js +3 -3
- package/lib/components/base/waitPanel/TMWaitPanelConfirm.d.ts +12 -0
- package/lib/components/base/waitPanel/TMWaitPanelConfirm.js +185 -0
- package/lib/components/base/waitPanel/TMWaitPanelManager.d.ts +169 -0
- package/lib/components/base/waitPanel/TMWaitPanelManager.js +320 -0
- package/lib/components/base/waitPanel/TMWaitPanelView.d.ts +53 -0
- package/lib/components/base/waitPanel/TMWaitPanelView.js +274 -0
- package/lib/components/base/waitPanel/index.d.ts +1 -0
- package/lib/components/base/waitPanel/index.js +1 -0
- package/lib/components/choosers/TMCultureIDPicker.js +2 -2
- package/lib/components/choosers/TMDataListItemChooser.js +1 -1
- package/lib/components/choosers/TMDataListItemPicker.js +2 -2
- package/lib/components/choosers/TMDcmtTypeChooser.js +5 -4
- package/lib/components/choosers/TMDiskChooser.js +1 -1
- package/lib/components/choosers/TMDistinctValues.d.ts +9 -7
- package/lib/components/choosers/TMDistinctValues.js +157 -141
- package/lib/components/choosers/TMDynDataListItemChooser.js +1 -1
- package/lib/components/choosers/TMImageIDChooser.js +1 -1
- package/lib/components/choosers/TMMetadataChooser.js +3 -3
- package/lib/components/choosers/TMPathChooser.js +17 -34
- package/lib/components/choosers/TMQuickSearchInfo.d.ts +13 -0
- package/lib/components/choosers/TMQuickSearchInfo.js +279 -0
- package/lib/components/choosers/TMQuickSearchSettingsForm.d.ts +16 -0
- package/lib/components/choosers/TMQuickSearchSettingsForm.js +94 -0
- package/lib/components/choosers/TMRelationChooser.js +1 -1
- package/lib/components/choosers/TMSelectedValuesSummary.d.ts +13 -0
- package/lib/components/choosers/TMSelectedValuesSummary.js +89 -0
- package/lib/components/choosers/TMUserChooser.js +1 -1
- package/lib/components/editors/TMCheckBox.js +1 -1
- package/lib/components/editors/TMDateBox.d.ts +16 -1
- package/lib/components/editors/TMDateBox.js +90 -22
- package/lib/components/editors/TMDropDown.d.ts +3 -0
- package/lib/components/editors/TMDropDown.js +197 -5
- package/lib/components/editors/TMEditorStyled.d.ts +21 -43
- package/lib/components/editors/TMFormulaEditor.js +1 -1
- package/lib/components/editors/TMHtmlContentDisplay.js +1 -1
- package/lib/components/editors/TMLocalizedTextBox.js +1 -1
- package/lib/components/editors/TMMetadataEditor.d.ts +5 -1
- package/lib/components/editors/TMMetadataEditor.js +27 -23
- package/lib/components/editors/TMMetadataValues.js +6 -6
- package/lib/components/editors/TMRadioButton.js +2 -2
- package/lib/components/editors/TMSummary.js +3 -3
- package/lib/components/editors/TMTextArea.d.ts +1 -0
- package/lib/components/editors/TMTextArea.js +25 -17
- package/lib/components/editors/TMTextBox.d.ts +2 -0
- package/lib/components/editors/TMTextBox.js +32 -21
- package/lib/components/editors/TMTextExpression.js +1 -1
- package/lib/components/features/archive/TMArchive.js +24 -5
- package/lib/components/features/assistant/TMHelpOnLineChat.d.ts +29 -0
- package/lib/components/features/assistant/TMHelpOnLineChat.js +1384 -0
- package/lib/components/features/assistant/TMToppyDraggableHelpCenter.js +4 -4
- package/lib/components/features/assistant/TMToppySpeechBubble.js +1 -1
- package/lib/components/features/assistant/dataset/Designer-Suggested-Questions.json +102 -0
- package/lib/components/features/assistant/dataset/Login-Suggested-Questions.json +32 -0
- package/lib/components/features/assistant/dataset/Surfer-Suggested-Questions.json +102 -0
- package/lib/components/features/documents/TMBatchUpdateForm.js +22 -9
- package/lib/components/features/documents/TMCopyToFolderForm.js +50 -42
- package/lib/components/features/documents/TMDcmtBlog.d.ts +3 -0
- package/lib/components/features/documents/TMDcmtBlog.js +4 -4
- package/lib/components/features/documents/TMDcmtForm.d.ts +7 -0
- package/lib/components/features/documents/TMDcmtForm.js +281 -113
- package/lib/components/features/documents/TMDcmtFormActionButtons.d.ts +11 -0
- package/lib/components/features/documents/TMDcmtFormActionButtons.js +79 -9
- package/lib/components/features/documents/TMDcmtIcon.d.ts +1 -3
- package/lib/components/features/documents/TMDcmtIcon.js +8 -8
- package/lib/components/features/documents/TMDcmtPreview.d.ts +7 -5
- package/lib/components/features/documents/TMDcmtPreview.js +16 -10
- package/lib/components/features/documents/TMDcmtTasks.js +2 -9
- package/lib/components/features/documents/TMDownloadRelationViewerSection.js +1 -1
- package/lib/components/features/documents/TMFileUploader.js +7 -7
- package/lib/components/features/documents/TMMasterDetailDcmts.d.ts +2 -0
- package/lib/components/features/documents/TMMasterDetailDcmts.js +95 -108
- package/lib/components/features/documents/TMMasterInfoFields.d.ts +20 -0
- package/lib/components/features/documents/TMMasterInfoFields.js +185 -0
- package/lib/components/features/documents/TMMergeToPdfForm.d.ts +1 -2
- package/lib/components/features/documents/TMMergeToPdfForm.js +83 -56
- package/lib/components/features/documents/TMMultiMasterDetailDcmtsForm.d.ts +46 -0
- package/lib/components/features/documents/TMMultiMasterDetailDcmtsForm.js +320 -0
- package/lib/components/features/documents/TMMultiMasterDetailDcmtsUtils.d.ts +370 -0
- package/lib/components/features/documents/TMMultiMasterDetailDcmtsUtils.js +283 -0
- package/lib/components/features/documents/TMRelationViewer.d.ts +29 -9
- package/lib/components/features/documents/TMRelationViewer.js +310 -208
- package/lib/components/features/documents/copyAndMergeDcmtsShared.d.ts +1 -1
- package/lib/components/features/documents/relationTreeState.d.ts +32 -0
- package/lib/components/features/documents/relationTreeState.js +89 -0
- package/lib/components/features/search/TMMetadataOutputForm.js +1 -1
- package/lib/components/features/search/TMMetadataSorterForm.js +1 -1
- package/lib/components/features/search/TMSavedQuerySelector.js +2 -2
- package/lib/components/features/search/TMSearch.d.ts +1 -1
- package/lib/components/features/search/TMSearch.js +172 -34
- package/lib/components/features/search/TMSearchQueryEditor.js +7 -5
- package/lib/components/features/search/TMSearchQueryPanel.d.ts +14 -4
- package/lib/components/features/search/TMSearchQueryPanel.js +153 -62
- package/lib/components/features/search/TMSearchResult.d.ts +21 -0
- package/lib/components/features/search/TMSearchResult.js +461 -152
- package/lib/components/features/search/TMSignatureInfoContent.js +1 -1
- package/lib/components/features/search/TMTreeSelector.js +130 -83
- package/lib/components/features/search/TMViewHistoryDcmt.js +14 -25
- package/lib/components/features/tasks/TMTaskForm.js +1 -1
- package/lib/components/features/tasks/TMTaskFormUtils.js +3 -3
- package/lib/components/features/tasks/TMTasksAgenda.js +1 -1
- package/lib/components/features/tasks/TMTasksCalendar.js +1 -1
- package/lib/components/features/tasks/TMTasksHeader.js +1 -1
- package/lib/components/features/tasks/TMTasksUtilsView.js +1 -1
- package/lib/components/features/tasks/TMTasksView.js +97 -102
- package/lib/components/features/wg/TMWGsCopyMoveForm.js +92 -92
- package/lib/components/features/workflow/TMWorkflowPopup.d.ts +10 -0
- package/lib/components/features/workflow/TMWorkflowPopup.js +9 -5
- package/lib/components/features/workflow/diagram/ConnectionComponent.js +3 -3
- package/lib/components/features/workflow/diagram/DiagramItemComponent.js +3 -3
- package/lib/components/features/workflow/diagram/DiagramItemForm.js +1 -1
- package/lib/components/features/workflow/diagram/DiagramItemSvgContent.js +1 -1
- package/lib/components/features/workflow/diagram/RecipientList.js +1 -1
- package/lib/components/features/workflow/diagram/WFDiagram.js +4 -4
- package/lib/components/features/workflow/diagram/WorkitemRecipientsEditor.d.ts +3 -1
- package/lib/components/forms/Login/ChangePasswordInputs.d.ts +3 -1
- package/lib/components/forms/Login/Menu.js +1 -1
- package/lib/components/forms/Login/OTPReader.js +1 -1
- package/lib/components/forms/Login/PasswordStrengthChecker.js +1 -1
- package/lib/components/forms/Login/RapidAccessLogin.js +2 -2
- package/lib/components/forms/Login/RecoverPasswordFlow.js +2 -2
- package/lib/components/forms/Login/SelectBox.js +1 -1
- package/lib/components/forms/Login/StepIndicator.js +1 -1
- package/lib/components/forms/Login/TMLoginForm.js +7 -7
- package/lib/components/forms/Login/TextBox.js +1 -1
- package/lib/components/forms/TMApplyForm.js +3 -3
- package/lib/components/forms/TMChooserForm.js +1 -1
- package/lib/components/forms/TMResultDialog.js +1 -1
- package/lib/components/forms/TMSaveForm.js +3 -3
- package/lib/components/grids/TMBlogAttachments.js +14 -3
- package/lib/components/grids/TMBlogHeader.js +5 -1
- package/lib/components/grids/TMBlogsPost.d.ts +2 -0
- package/lib/components/grids/TMBlogsPost.js +122 -99
- package/lib/components/grids/TMBlogsPostUtils.d.ts +1 -0
- package/lib/components/grids/TMBlogsPostUtils.js +15 -4
- package/lib/components/grids/TMRecentsManager.js +4 -4
- package/lib/components/grids/TMValidationItemsList.js +1 -1
- package/lib/components/index.d.ts +6 -0
- package/lib/components/index.js +5 -0
- package/lib/components/layout/panelManager/TMPanelManagerContainer.d.ts +1 -0
- package/lib/components/layout/panelManager/TMPanelManagerContainer.js +25 -15
- package/lib/components/layout/panelManager/TMPanelManagerContext.js +68 -93
- package/lib/components/layout/panelManager/TMPanelManagerToolbar.d.ts +4 -5
- package/lib/components/layout/panelManager/TMPanelManagerToolbar.js +1 -1
- package/lib/components/layout/panelManager/TMPanelWrapper.js +3 -3
- package/lib/components/layout/panelManager/types.d.ts +3 -0
- package/lib/components/layout/panelManager/utils.js +13 -11
- package/lib/components/pages/TMPage.js +30 -32
- package/lib/components/query/TMQueryCountButton.js +1 -1
- package/lib/components/query/TMQueryEditor.d.ts +17 -10
- package/lib/components/query/TMQueryEditor.js +9 -8
- package/lib/components/sidebar/TMCommandsPanel.d.ts +4 -4
- package/lib/components/sidebar/TMCommandsPanel.js +1 -1
- package/lib/components/sidebar/TMHeader.d.ts +1 -0
- package/lib/components/sidebar/TMHeader.js +37 -27
- package/lib/components/sidebar/TMSidebar.js +1 -1
- package/lib/components/sidebar/TMSidebarItem.js +1 -1
- package/lib/components/viewers/TMMidViewer.js +6 -3
- package/lib/components/viewers/TMTidViewer.js +89 -28
- package/lib/components/wizard/TMStepIndicator.js +3 -3
- package/lib/css/tm-sdkui.css +1 -1
- package/lib/devextreme-license.d.ts +1 -0
- package/lib/devextreme-license.js +3 -0
- package/lib/helper/Enum_Localizator.d.ts +4 -4
- package/lib/helper/Enum_Localizator.js +1 -0
- package/lib/helper/Globalization.d.ts +1 -1
- package/lib/helper/SDKUI_Globals.d.ts +110 -0
- package/lib/helper/SDKUI_Globals.js +151 -0
- package/lib/helper/SDKUI_Localizator.d.ts +756 -677
- package/lib/helper/SDKUI_Localizator.js +790 -0
- package/lib/helper/TMAppUpdatedModal.d.ts +2 -0
- package/lib/helper/TMAppUpdatedModal.js +134 -0
- package/lib/helper/TMIcons.d.ts +1 -0
- package/lib/helper/TMIcons.js +4 -3
- package/lib/helper/TMPdfViewer.js +1 -1
- package/lib/helper/TMToppyMessage.js +1 -1
- package/lib/helper/TMUtils.d.ts +51 -4
- package/lib/helper/TMUtils.js +273 -12
- package/lib/helper/ZipManager.d.ts +1 -1
- package/lib/helper/ZipManager.js +2 -1
- package/lib/helper/checkinCheckoutManager.d.ts +1 -1
- package/lib/helper/checkinCheckoutManager.js +1 -1
- package/lib/helper/dataGridSearchHelper.d.ts +28 -0
- package/lib/helper/dataGridSearchHelper.js +51 -0
- package/lib/helper/dcmtsHelper.d.ts +22 -0
- package/lib/helper/dcmtsHelper.js +60 -1
- package/lib/helper/helpers.d.ts +24 -2
- package/lib/helper/helpers.js +59 -3
- package/lib/helper/index.d.ts +2 -0
- package/lib/helper/index.js +2 -0
- package/lib/helper/queryHelper.d.ts +6 -1
- package/lib/helper/queryHelper.js +8 -3
- package/lib/hooks/tmDistinctValuesGridHelper.d.ts +16 -0
- package/lib/hooks/tmDistinctValuesGridHelper.js +31 -0
- package/lib/hooks/useArchiveListForm.d.ts +39 -0
- package/lib/hooks/useArchiveListForm.js +46 -0
- package/lib/hooks/useCaseFlowApprove.d.ts +56 -0
- package/lib/hooks/useCaseFlowApprove.js +157 -0
- package/lib/hooks/useCheckInOutOperations.d.ts +0 -6
- package/lib/hooks/useCheckInOutOperations.js +14 -34
- package/lib/hooks/useDataUserIdItem.d.ts +1 -0
- package/lib/hooks/useDataUserIdItem.js +1 -0
- package/lib/hooks/useDcmtOperations.d.ts +3 -12
- package/lib/hooks/useDcmtOperations.js +187 -179
- package/lib/hooks/useDocumentOperations.d.ts +5 -0
- package/lib/hooks/useDocumentOperations.js +64 -33
- package/lib/hooks/useInputDialog.js +1 -1
- package/lib/hooks/useMultiMasterDetailDcmts.d.ts +98 -0
- package/lib/hooks/useMultiMasterDetailDcmts.js +758 -0
- package/lib/hooks/usePreventFileDrop.js +9 -0
- package/lib/hooks/useQueryParametersDialog.js +1 -1
- package/lib/hooks/useRelatedDocuments.d.ts +1 -0
- package/lib/hooks/useRelatedDocuments.js +22 -27
- package/lib/hooks/useShowDossiersV5.d.ts +12 -0
- package/lib/hooks/useShowDossiersV5.js +37 -0
- package/lib/hooks/useTMDistinctValuesMetadataDisplay.d.ts +18 -0
- package/lib/hooks/useTMDistinctValuesMetadataDisplay.js +103 -0
- package/lib/hooks/useTMDistinctValuesQuickSearch.d.ts +49 -0
- package/lib/hooks/useTMDistinctValuesQuickSearch.js +307 -0
- package/lib/hooks/useTMDistinctValuesSelection.d.ts +42 -0
- package/lib/hooks/useTMDistinctValuesSelection.js +103 -0
- package/lib/hooks/useTMDistinctValuesSource.d.ts +29 -0
- package/lib/hooks/useTMDistinctValuesSource.js +105 -0
- package/lib/hooks/useWorkflowApprove.js +33 -17
- package/lib/index.d.ts +2 -0
- package/lib/index.js +5 -2
- package/lib/services/caseflow/CaseFlowService.d.ts +277 -0
- package/lib/services/caseflow/CaseFlowService.js +761 -0
- package/lib/services/caseflow/CaseFlowTemplateCacheService.d.ts +28 -0
- package/lib/services/caseflow/CaseFlowTemplateCacheService.js +121 -0
- package/lib/services/caseflow/caseFlowNameCache.d.ts +32 -0
- package/lib/services/caseflow/caseFlowNameCache.js +116 -0
- package/lib/services/caseflow/caseFlowWorkItemUtils.d.ts +61 -0
- package/lib/services/caseflow/caseFlowWorkItemUtils.js +113 -0
- package/lib/services/index.d.ts +4 -0
- package/lib/services/index.js +4 -0
- package/lib/services/platform_services.d.ts +4 -4
- package/package.json +16 -13
|
@@ -1,35 +1,103 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useId, useRef } from 'react';
|
|
2
|
+
import { useEffect, useId, useMemo, useRef } from 'react';
|
|
3
3
|
import { DateBox } from 'devextreme-react';
|
|
4
|
-
import {
|
|
4
|
+
import { MetadataFormats } from '@topconsultnpm/sdk-ts';
|
|
5
|
+
import { DateDisplayTypes, Globalization, SDKUI_Localizator } from '../../helper';
|
|
5
6
|
import { TMColors } from '../../utils/theme';
|
|
6
7
|
import TMVilViewer from '../base/TMVilViewer';
|
|
8
|
+
import { formatDateTimeByMetadataFormat } from '../../helper/TMUtils';
|
|
7
9
|
const TMDateBox = (props) => {
|
|
8
|
-
const
|
|
10
|
+
const { dateDisplayType, validationItems, isModifiedWhen, useDateSerializationFormat, containerElement, resetTimeToZeroOnKeyPress, icon, padding, formatCulture, metadataFormat, invalidDateMessage, readOnly, showClearButton, disabled, displayFormat, label, type, value, width, onValueChange, onInitialized, onContentReady, placeholder, name, inputAttr } = props;
|
|
11
|
+
const resetTimeToZero = resetTimeToZeroOnKeyPress ?? true;
|
|
9
12
|
const autoId = useId();
|
|
10
|
-
const effectiveInputAttr = { id: autoId, ...
|
|
13
|
+
const effectiveInputAttr = { id: autoId, ...inputAttr };
|
|
14
|
+
// Determina se il formato richiede nomi testuali (mesi/giorni) che dipendono dalla cultura
|
|
15
|
+
const requiresTextualFormat = useMemo(() => {
|
|
16
|
+
// Solo i formati con "Long" nella data hanno nomi di mesi/giorni che variano per cultura
|
|
17
|
+
return metadataFormat === MetadataFormats.LongDate ||
|
|
18
|
+
metadataFormat === MetadataFormats.LongDateShortTime ||
|
|
19
|
+
metadataFormat === MetadataFormats.LongDateLongTime;
|
|
20
|
+
}, [metadataFormat]);
|
|
21
|
+
// Funzione di formattazione personalizzata per rispettare formatCulture
|
|
22
|
+
// Usata SOLO per formati con nomi testuali (LongDate, LongDateShortTime, LongDateLongTime) e se formatCulture è specificato
|
|
23
|
+
const customDisplayFormat = useMemo(() => {
|
|
24
|
+
// Usa funzione custom solo se c'è formatCulture E il formato richiede nomi testuali
|
|
25
|
+
if (!formatCulture || !requiresTextualFormat)
|
|
26
|
+
return undefined;
|
|
27
|
+
// Restituisce una funzione che DevExtreme userà per formattare la data
|
|
28
|
+
return (date) => {
|
|
29
|
+
try {
|
|
30
|
+
if (!date)
|
|
31
|
+
return '';
|
|
32
|
+
// Assicurati che sia un oggetto Date valido
|
|
33
|
+
const dateObj = date instanceof Date ? date : new Date(date);
|
|
34
|
+
if (isNaN(dateObj.getTime()))
|
|
35
|
+
return '';
|
|
36
|
+
return formatDateTimeByMetadataFormat(dateObj, metadataFormat, formatCulture);
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
// Fallback: restituisce stringa ISO o vuota in caso di errore
|
|
40
|
+
try {
|
|
41
|
+
return date instanceof Date ? date.toISOString() : String(date ?? '');
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return '';
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}, [formatCulture, metadataFormat, requiresTextualFormat]);
|
|
49
|
+
// Genera il messaggio di errore con esempio del formato supportato
|
|
50
|
+
const computedInvalidDateMessage = useMemo(() => {
|
|
51
|
+
try {
|
|
52
|
+
if (invalidDateMessage)
|
|
53
|
+
return invalidDateMessage;
|
|
54
|
+
// Genera un esempio usando la data corrente
|
|
55
|
+
const exampleDate = new Date();
|
|
56
|
+
let exampleFormatted;
|
|
57
|
+
if (customDisplayFormat) {
|
|
58
|
+
// Usa la funzione custom se disponibile
|
|
59
|
+
exampleFormatted = customDisplayFormat(exampleDate);
|
|
60
|
+
}
|
|
61
|
+
else if (typeof displayFormat === 'string') {
|
|
62
|
+
// Usa formatDateTimeByMetadataFormat se abbiamo un formato stringa
|
|
63
|
+
exampleFormatted = formatDateTimeByMetadataFormat(exampleDate, metadataFormat, formatCulture) || displayFormat;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
// Fallback: usa il formato di Globalization o localizzazione standard
|
|
67
|
+
const globFormat = Globalization.getDateDisplayFormat(dateDisplayType);
|
|
68
|
+
exampleFormatted = typeof globFormat === 'string' ? globFormat : exampleDate.toLocaleDateString(formatCulture || 'it-IT');
|
|
69
|
+
}
|
|
70
|
+
if (!exampleFormatted)
|
|
71
|
+
return SDKUI_Localizator.ValueMustBeDateOrTime;
|
|
72
|
+
return `${SDKUI_Localizator.RequiredFormat}: ${exampleFormatted}`;
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
// In caso di errore, usa il messaggio generico tradotto
|
|
76
|
+
return SDKUI_Localizator.ValueMustBeDateOrTime;
|
|
77
|
+
}
|
|
78
|
+
}, [invalidDateMessage, customDisplayFormat, displayFormat, dateDisplayType, metadataFormat, formatCulture]);
|
|
11
79
|
useEffect(() => {
|
|
12
80
|
let htmlElement = dateBoxRef?.current?.instance().element();
|
|
13
81
|
if (!htmlElement)
|
|
14
82
|
return;
|
|
15
|
-
let borderColor =
|
|
16
|
-
let textColor =
|
|
83
|
+
let borderColor = isModifiedWhen ? TMColors.tertiary : TMColors.border_normal;
|
|
84
|
+
let textColor = isModifiedWhen ? TMColors.isModified : TMColors.text_normal;
|
|
17
85
|
let inputContainer = htmlElement.getElementsByClassName("dx-texteditor-input-container")[0];
|
|
18
86
|
if (inputContainer) {
|
|
19
|
-
inputContainer.style.background =
|
|
20
|
-
inputContainer.style.color =
|
|
87
|
+
inputContainer.style.background = readOnly ? 'linear-gradient(white 20%, #d6d6d6 80%)' : '';
|
|
88
|
+
inputContainer.style.color = readOnly ? '#525252' : textColor;
|
|
21
89
|
}
|
|
22
90
|
let input = htmlElement.querySelector(".dx-texteditor-input");
|
|
23
91
|
if (input) {
|
|
24
|
-
if (!
|
|
92
|
+
if (!readOnly) {
|
|
25
93
|
input.style.color = textColor;
|
|
26
94
|
}
|
|
27
95
|
input.style.fontSize = 'var(--base-font-size)';
|
|
28
96
|
input.style.fontFamily = 'var(--base-font-family)';
|
|
29
97
|
}
|
|
30
|
-
let
|
|
31
|
-
if (
|
|
32
|
-
|
|
98
|
+
let labelEl = htmlElement.getElementsByClassName("dx-label")[0];
|
|
99
|
+
if (labelEl) {
|
|
100
|
+
labelEl.style.borderBottomColor = borderColor;
|
|
33
101
|
}
|
|
34
102
|
let labelBefore = htmlElement.getElementsByClassName("dx-label-before")[0];
|
|
35
103
|
if (labelBefore) {
|
|
@@ -43,13 +111,13 @@ const TMDateBox = (props) => {
|
|
|
43
111
|
labelAfter.style.borderTopColor = borderColor;
|
|
44
112
|
labelAfter.style.borderInlineEndColor = borderColor;
|
|
45
113
|
}
|
|
46
|
-
}, [
|
|
114
|
+
}, [isModifiedWhen, readOnly]);
|
|
47
115
|
const dateBoxRef = useRef(null);
|
|
48
116
|
// soluzione tratta da https://supportcenter.devexpress.com/ticket/details/t1025617/setting-default-time-in-datebox
|
|
49
117
|
const dropDownOptions = {
|
|
50
|
-
container:
|
|
118
|
+
container: containerElement,
|
|
51
119
|
onShown: (e) => {
|
|
52
|
-
if (
|
|
120
|
+
if (value != undefined)
|
|
53
121
|
return;
|
|
54
122
|
let dateBoxInstance = dateBoxRef.current?.instance();
|
|
55
123
|
const currentDate = new Date();
|
|
@@ -59,13 +127,13 @@ const TMDateBox = (props) => {
|
|
|
59
127
|
}
|
|
60
128
|
};
|
|
61
129
|
const getType = () => {
|
|
62
|
-
if (
|
|
63
|
-
return
|
|
64
|
-
if (!
|
|
130
|
+
if (type != undefined)
|
|
131
|
+
return type;
|
|
132
|
+
if (!dateDisplayType || dateDisplayType == DateDisplayTypes.DateTime)
|
|
65
133
|
return "datetime";
|
|
66
|
-
return
|
|
134
|
+
return dateDisplayType == DateDisplayTypes.Date ? "date" : "time";
|
|
67
135
|
};
|
|
68
|
-
return (_jsxs("div", { style: { display: 'flex', alignItems: 'center', width: '100%', padding:
|
|
136
|
+
return (_jsxs("div", { style: { display: 'flex', alignItems: 'center', width: '100%', padding: padding }, children: [icon && (_jsx("span", { style: { marginRight: '8px', marginTop: '8px', display: 'flex', alignItems: 'center' }, children: icon })), _jsxs("div", { onContextMenu: (e) => e.stopPropagation(), style: { display: 'flex', flexDirection: 'column', gap: '5px', width: '100%' }, children: [_jsx(DateBox, { readOnly: readOnly, ref: dateBoxRef, showClearButton: showClearButton, dateSerializationFormat: useDateSerializationFormat ? 'yyyy-MM-ddTHH:mm:ss' : undefined, disabled: disabled, displayFormat: customDisplayFormat ?? displayFormat ?? Globalization.getDateDisplayFormat(dateDisplayType), dropDownOptions: dropDownOptions, invalidDateMessage: computedInvalidDateMessage, label: label, labelMode: 'static', type: getType(), useMaskBehavior: !customDisplayFormat, height: '28px', value: value, width: width, valueChangeEvent: 'keyup input change', onValueChange: (e) => { onValueChange?.(e); }, onInitialized: (e) => { onInitialized?.(e); }, onContentReady: (e) => { onContentReady?.(e); }, placeholder: placeholder, ...(name && { name: name }), inputAttr: effectiveInputAttr, onKeyUp: (e) => {
|
|
69
137
|
if (e.event?.code == "Space") {
|
|
70
138
|
const currentDate = new Date();
|
|
71
139
|
currentDate.setHours(0, 0, 0, 0);
|
|
@@ -73,7 +141,7 @@ const TMDateBox = (props) => {
|
|
|
73
141
|
}
|
|
74
142
|
}, onValueChanged: (e) => {
|
|
75
143
|
if (resetTimeToZero) {
|
|
76
|
-
if (
|
|
144
|
+
if (value != undefined)
|
|
77
145
|
return;
|
|
78
146
|
if (!e.value)
|
|
79
147
|
return;
|
|
@@ -81,6 +149,6 @@ const TMDateBox = (props) => {
|
|
|
81
149
|
currentDate.setHours(0, 0, 0, 0);
|
|
82
150
|
e.component.option("value", currentDate.toISOString());
|
|
83
151
|
}
|
|
84
|
-
} }), _jsx(TMVilViewer, { vil:
|
|
152
|
+
} }), _jsx(TMVilViewer, { vil: validationItems })] })] }));
|
|
85
153
|
};
|
|
86
154
|
export default TMDateBox;
|
|
@@ -4,6 +4,9 @@ interface ITMDropDown extends ITMEditorBase {
|
|
|
4
4
|
dataSource?: any[];
|
|
5
5
|
value?: string | number | undefined;
|
|
6
6
|
disabled?: boolean;
|
|
7
|
+
searchEnabled?: boolean;
|
|
8
|
+
usePortal?: boolean;
|
|
9
|
+
itemRender?: (item: any) => React.ReactNode;
|
|
7
10
|
onValueChanged?: (e: React.ChangeEvent<HTMLSelectElement>) => void;
|
|
8
11
|
}
|
|
9
12
|
declare const TMDropDown: React.FC<ITMDropDown>;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
import
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
4
|
+
import styled, { css } from "styled-components";
|
|
4
5
|
import { FontSize, TMColors } from '../../utils/theme';
|
|
5
6
|
import { StyledEditorContainer, StyledEditorIcon, StyledEditorLabel, TMEditorsDefaultBorderRadius, editorColorManager } from "./TMEditorStyled";
|
|
6
7
|
import TMLayoutContainer, { TMLayoutItem } from "../base/TMLayout";
|
|
7
8
|
import TMVilViewer from "../base/TMVilViewer";
|
|
8
9
|
import TMTooltip from "../base/TMTooltip";
|
|
10
|
+
import { SDKUI_Localizator } from "../../helper";
|
|
9
11
|
const StyledDropDownWrapper = styled.div `
|
|
10
12
|
position: relative;
|
|
11
13
|
width: ${props => props.$width};
|
|
@@ -54,9 +56,199 @@ const StyledDropDownEditorButton = styled.div `
|
|
|
54
56
|
align-items: center;
|
|
55
57
|
cursor: pointer;
|
|
56
58
|
`;
|
|
57
|
-
|
|
59
|
+
// Variante filtrabile: un input di testo con la stessa resa grafica della select nativa
|
|
60
|
+
const StyledSearchInput = styled.input `
|
|
61
|
+
width: 100%;
|
|
62
|
+
padding: 5px 35px 3px 9px;
|
|
63
|
+
border: 1px solid;
|
|
64
|
+
border-color: ${props => props.$isModified ? TMColors.isModified : TMColors.border_normal};
|
|
65
|
+
border-bottom: ${props => (props.$vil.length > 0) ? '3px' : '1px'} solid;
|
|
66
|
+
border-bottom-color: ${props => (props.$vil.length === 0) ? !props.$isModified ? TMColors.border_normal : TMColors.isModified : editorColorManager(props.$vil)};
|
|
67
|
+
color: ${props => !props.$disabled ? (props.$vil.length === 0 ? (!props.$isModified ? TMColors.text_normal : TMColors.isModified) : editorColorManager(props.$vil)) : TMColors.disabled};
|
|
68
|
+
border-radius: ${props => props.$borderRadius ?? TMEditorsDefaultBorderRadius};
|
|
69
|
+
font-size: ${props => props.$fontSize};
|
|
70
|
+
background-color: ${props => props.$disabled ? '#F5F5F5' : 'white'};
|
|
71
|
+
text-overflow: ellipsis;
|
|
72
|
+
|
|
73
|
+
&:focus {
|
|
74
|
+
outline: none;
|
|
75
|
+
border: ${props => props.$isModified ? `1px solid ${TMColors.isModified}` : '1px solid rgb(180,180,180)'};
|
|
76
|
+
border-bottom: 2px solid;
|
|
77
|
+
border-bottom-color: ${props => (props.$vil.length === 0) ? !props.$isModified ? TMColors.primary : TMColors.isModified : editorColorManager(props.$vil)};
|
|
78
|
+
}
|
|
79
|
+
`;
|
|
80
|
+
const OPTIONS_PANEL_MAX_HEIGHT = 220;
|
|
81
|
+
const OPTIONS_PANEL_MIN_HEIGHT = 80;
|
|
82
|
+
const OPTIONS_PANEL_MARGIN = 4;
|
|
83
|
+
// L'elenco aperto con usePortal esce dal contenitore dell'editor: deve stare sopra tutto ciò che può trovarsi nella stessa pagina
|
|
84
|
+
const DROPDOWN_OPTIONS_PANEL_Z_INDEX = 100001;
|
|
85
|
+
const optionsPanelCss = css `
|
|
86
|
+
overflow-y: auto;
|
|
87
|
+
background-color: white;
|
|
88
|
+
border: 1px solid ${TMColors.border_normal};
|
|
89
|
+
border-radius: ${TMEditorsDefaultBorderRadius};
|
|
90
|
+
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
|
|
91
|
+
`;
|
|
92
|
+
// Elenco ancorato all'editor: resta nel flusso del DOM e quindi soggetto al clipping dei contenitori con overflow
|
|
93
|
+
const StyledOptionsPanel = styled.div `
|
|
94
|
+
${optionsPanelCss}
|
|
95
|
+
position: absolute;
|
|
96
|
+
top: calc(100% + 2px);
|
|
97
|
+
left: 0;
|
|
98
|
+
right: 0;
|
|
99
|
+
z-index: 10001;
|
|
100
|
+
max-height: ${OPTIONS_PANEL_MAX_HEIGHT}px;
|
|
101
|
+
`;
|
|
102
|
+
// Variante usePortal: posizione calcolata rispetto alla finestra, così l'elenco non viene tagliato da nessun contenitore
|
|
103
|
+
const StyledPortalOptionsPanel = styled.div `
|
|
104
|
+
${optionsPanelCss}
|
|
105
|
+
position: fixed;
|
|
106
|
+
left: ${props => props.$left}px;
|
|
107
|
+
${props => props.$top !== undefined ? `top: ${props.$top}px;` : ''}
|
|
108
|
+
${props => props.$bottom !== undefined ? `bottom: ${props.$bottom}px;` : ''}
|
|
109
|
+
width: ${props => props.$width}px;
|
|
110
|
+
z-index: ${DROPDOWN_OPTIONS_PANEL_Z_INDEX};
|
|
111
|
+
max-height: ${props => props.$maxHeight}px;
|
|
112
|
+
`;
|
|
113
|
+
const StyledOption = styled.div `
|
|
114
|
+
padding: 5px 9px;
|
|
115
|
+
font-size: ${props => props.$fontSize};
|
|
116
|
+
cursor: pointer;
|
|
117
|
+
white-space: nowrap;
|
|
118
|
+
overflow: hidden;
|
|
119
|
+
text-overflow: ellipsis;
|
|
120
|
+
font-weight: ${props => props.$isSelected ? 600 : 'normal'};
|
|
121
|
+
background-color: ${props => props.$isHighlighted ? TMColors.primary_container : 'transparent'};
|
|
122
|
+
`;
|
|
123
|
+
const StyledNoOptions = styled.div `
|
|
124
|
+
padding: 5px 9px;
|
|
125
|
+
font-size: ${props => props.$fontSize};
|
|
126
|
+
color: ${TMColors.disabled};
|
|
127
|
+
`;
|
|
128
|
+
// L'elenco si apre sotto l'editor se c'è spazio, altrimenti sopra, e in ogni caso non esce dalla finestra
|
|
129
|
+
const calcOptionsPanelPosition = (rect) => {
|
|
130
|
+
const spaceBelow = window.innerHeight - rect.bottom - OPTIONS_PANEL_MARGIN;
|
|
131
|
+
const spaceAbove = rect.top - OPTIONS_PANEL_MARGIN;
|
|
132
|
+
const openUpwards = spaceBelow < OPTIONS_PANEL_MAX_HEIGHT && spaceAbove > spaceBelow;
|
|
133
|
+
const availableHeight = openUpwards ? spaceAbove : spaceBelow;
|
|
134
|
+
return {
|
|
135
|
+
left: Math.max(OPTIONS_PANEL_MARGIN, Math.min(rect.left, window.innerWidth - rect.width - OPTIONS_PANEL_MARGIN)),
|
|
136
|
+
top: openUpwards ? undefined : rect.bottom + OPTIONS_PANEL_MARGIN,
|
|
137
|
+
bottom: openUpwards ? window.innerHeight - rect.top + OPTIONS_PANEL_MARGIN : undefined,
|
|
138
|
+
width: rect.width,
|
|
139
|
+
maxHeight: Math.max(OPTIONS_PANEL_MIN_HEIGHT, Math.min(OPTIONS_PANEL_MAX_HEIGHT, availableHeight)),
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
const TMDropDown = ({ validationItems = [], disabled = false, elementStyle, isModifiedWhen, labelPosition = 'left', label, icon, width = '100%', fontSize = FontSize.defaultFontSize, dataSource, value, searchEnabled = false, usePortal = false, itemRender, onValueChanged, buttons = [], placeHolder, }) => {
|
|
58
143
|
const [isFocused, setIsFocused] = useState(false);
|
|
59
|
-
const
|
|
144
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
145
|
+
const [searchText, setSearchText] = useState('');
|
|
146
|
+
const [highlightedIndex, setHighlightedIndex] = useState(-1);
|
|
147
|
+
const [optionsPanelPosition, setOptionsPanelPosition] = useState();
|
|
148
|
+
const optionsPanelRef = useRef(null);
|
|
149
|
+
const dropDownWrapperRef = useRef(null);
|
|
150
|
+
const selectedItem = dataSource?.find(o => String(o.value) === String(value));
|
|
151
|
+
// A elenco chiuso l'input mostra la voce selezionata, ad elenco aperto il testo digitato
|
|
152
|
+
const filteredDataSource = (!isOpen || !searchText) ? (dataSource ?? []) : (dataSource ?? []).filter(o => String(o.display ?? '').toLocaleLowerCase().includes(searchText.toLocaleLowerCase()));
|
|
153
|
+
// Mantiene visibile la voce evidenziata durante la navigazione da tastiera
|
|
154
|
+
useEffect(() => {
|
|
155
|
+
if (!isOpen || highlightedIndex < 0)
|
|
156
|
+
return;
|
|
157
|
+
const option = optionsPanelRef.current?.children[highlightedIndex];
|
|
158
|
+
option?.scrollIntoView({ block: 'nearest' });
|
|
159
|
+
}, [isOpen, highlightedIndex]);
|
|
160
|
+
// Solo nel portal la posizione va ricalcolata: essendo fissa non segue lo scorrimento o il ridimensionamento del contenitore
|
|
161
|
+
useEffect(() => {
|
|
162
|
+
if (!isOpen || !usePortal)
|
|
163
|
+
return;
|
|
164
|
+
const updatePosition = () => updateOptionsPanelPosition();
|
|
165
|
+
window.addEventListener('scroll', updatePosition, true);
|
|
166
|
+
window.addEventListener('resize', updatePosition);
|
|
167
|
+
return () => {
|
|
168
|
+
window.removeEventListener('scroll', updatePosition, true);
|
|
169
|
+
window.removeEventListener('resize', updatePosition);
|
|
170
|
+
};
|
|
171
|
+
}, [isOpen, usePortal]);
|
|
172
|
+
const updateOptionsPanelPosition = () => {
|
|
173
|
+
const rect = dropDownWrapperRef.current?.getBoundingClientRect();
|
|
174
|
+
if (rect)
|
|
175
|
+
setOptionsPanelPosition(calcOptionsPanelPosition(rect));
|
|
176
|
+
};
|
|
177
|
+
const openOptions = () => {
|
|
178
|
+
if (disabled)
|
|
179
|
+
return;
|
|
180
|
+
if (usePortal)
|
|
181
|
+
updateOptionsPanelPosition();
|
|
182
|
+
setIsOpen(true);
|
|
183
|
+
setSearchText('');
|
|
184
|
+
setHighlightedIndex(dataSource?.findIndex(o => String(o.value) === String(value)) ?? -1);
|
|
185
|
+
};
|
|
186
|
+
const closeOptions = () => {
|
|
187
|
+
setIsOpen(false);
|
|
188
|
+
setSearchText('');
|
|
189
|
+
setHighlightedIndex(-1);
|
|
190
|
+
};
|
|
191
|
+
const selectItem = (item) => {
|
|
192
|
+
closeOptions();
|
|
193
|
+
// La select nativa notifica un ChangeEvent: qui viene ricostruito il solo dato letto dai consumatori (target.value)
|
|
194
|
+
onValueChanged?.({ target: { value: String(item.value) } });
|
|
195
|
+
};
|
|
196
|
+
const onSearchKeyDown = (e) => {
|
|
197
|
+
switch (e.key) {
|
|
198
|
+
case 'ArrowDown':
|
|
199
|
+
case 'ArrowUp':
|
|
200
|
+
e.preventDefault();
|
|
201
|
+
if (!isOpen) {
|
|
202
|
+
openOptions();
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
if (filteredDataSource.length <= 0)
|
|
206
|
+
return;
|
|
207
|
+
setHighlightedIndex(prev => {
|
|
208
|
+
const delta = e.key === 'ArrowDown' ? 1 : -1;
|
|
209
|
+
const next = prev + delta;
|
|
210
|
+
if (next < 0)
|
|
211
|
+
return filteredDataSource.length - 1;
|
|
212
|
+
if (next >= filteredDataSource.length)
|
|
213
|
+
return 0;
|
|
214
|
+
return next;
|
|
215
|
+
});
|
|
216
|
+
break;
|
|
217
|
+
case 'Enter': {
|
|
218
|
+
if (!isOpen)
|
|
219
|
+
return;
|
|
220
|
+
e.preventDefault();
|
|
221
|
+
const item = filteredDataSource[highlightedIndex] ?? filteredDataSource[0];
|
|
222
|
+
if (item)
|
|
223
|
+
selectItem(item);
|
|
224
|
+
break;
|
|
225
|
+
}
|
|
226
|
+
case 'Escape':
|
|
227
|
+
if (isOpen) {
|
|
228
|
+
e.preventDefault();
|
|
229
|
+
closeOptions();
|
|
230
|
+
}
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
const renderOptions = () => (filteredDataSource.length > 0
|
|
235
|
+
? filteredDataSource.map((data, index) => (_jsx(StyledOption, { $fontSize: fontSize, $isSelected: String(data.value) === String(value), $isHighlighted: index === highlightedIndex, onMouseEnter: () => setHighlightedIndex(index), onClick: () => selectItem(data), children: itemRender ? itemRender(data) : data.display }, index)))
|
|
236
|
+
: _jsx(StyledNoOptions, { $fontSize: fontSize, children: SDKUI_Localizator.NoDataToDisplay }));
|
|
237
|
+
// onMouseDown va bloccato: senza preventDefault il blur dell'input chiuderebbe l'elenco prima del click
|
|
238
|
+
const renderOptionsPanel = () => {
|
|
239
|
+
if (!isOpen)
|
|
240
|
+
return null;
|
|
241
|
+
if (!usePortal) {
|
|
242
|
+
return (_jsx(StyledOptionsPanel, { ref: optionsPanelRef, onMouseDown: (e) => e.preventDefault(), children: renderOptions() }));
|
|
243
|
+
}
|
|
244
|
+
if (!optionsPanelPosition)
|
|
245
|
+
return null;
|
|
246
|
+
return createPortal(_jsx(StyledPortalOptionsPanel, { ref: optionsPanelRef, $left: optionsPanelPosition.left, $top: optionsPanelPosition.top, $bottom: optionsPanelPosition.bottom, $width: optionsPanelPosition.width, $maxHeight: optionsPanelPosition.maxHeight, onMouseDown: (e) => e.preventDefault(), children: renderOptions() }), document.body);
|
|
247
|
+
};
|
|
248
|
+
const renderSearchableDropDown = () => (_jsxs(_Fragment, { children: [_jsx(StyledSearchInput, { value: isOpen ? searchText : (selectedItem?.display ?? ''), placeholder: isOpen ? SDKUI_Localizator.Search : placeHolder, readOnly: disabled, disabled: disabled, $disabled: disabled, $fontSize: fontSize, $isModified: isModifiedWhen, $vil: validationItems, onFocus: () => { setIsFocused(true); openOptions(); }, onBlur: () => { setIsFocused(false); closeOptions(); }, onClick: () => { if (!isOpen)
|
|
249
|
+
openOptions(); }, onChange: (e) => { setSearchText(e.target.value); setIsOpen(true); setHighlightedIndex(0); }, onKeyDown: onSearchKeyDown }), renderOptionsPanel()] }));
|
|
250
|
+
const renderNativeDropDown = () => (_jsxs(StyledDropDown, { value: value, onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), $disabled: disabled, disabled: disabled, $fontSize: fontSize, $isModified: isModifiedWhen, $vil: validationItems, onChange: onValueChanged, children: [placeHolder && _jsx("option", { value: "", disabled: true, hidden: true, children: placeHolder }), dataSource?.map((data, index) => (_jsx("option", { value: data.value, children: data.display }, index)))] }));
|
|
251
|
+
const renderedLeftLabelTextBox = () => (_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, { $isFocused: isFocused, $labelPosition: labelPosition, $disabled: disabled, children: label }), _jsxs(StyledDropDownWrapper, { ref: dropDownWrapperRef, $width: width, children: [searchEnabled ? renderSearchableDropDown() : renderNativeDropDown(), buttons.length > 0 && (_jsx(ButtonsContainer, { children: buttons.map((buttonItem) => (_jsx(StyledDropDownEditorButton, { onClick: buttonItem.onClick, children: _jsx(TMTooltip, { content: buttonItem.tooltipContent ?? buttonItem.text, children: buttonItem.icon }) }, buttonItem.text))) })), _jsx(CustomArrow, {})] }), _jsx(TMVilViewer, { vil: validationItems })] }) })] }));
|
|
60
252
|
return _jsx("div", { style: elementStyle, children: renderedLeftLabelTextBox() });
|
|
61
253
|
};
|
|
62
254
|
export default TMDropDown;
|
|
@@ -2,12 +2,14 @@ import { ValidationItem } from '@topconsultnpm/sdk-ts';
|
|
|
2
2
|
export declare const TMEditorsDefaultBorderRadius = "5px";
|
|
3
3
|
export declare const TMEditorsDefaultLabelFontSize = "0.9rem";
|
|
4
4
|
export declare const editorColorManager: (validationItems: ValidationItem[]) => string;
|
|
5
|
-
export declare const StyledEditorContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").
|
|
5
|
+
export declare const StyledEditorContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
6
|
+
style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
|
|
7
|
+
}, {
|
|
6
8
|
$width: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
}>> & string;
|
|
10
|
+
export declare const StyledEditor: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "style"> & {
|
|
11
|
+
style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
|
|
12
|
+
}, {
|
|
11
13
|
$vil: ValidationItem[];
|
|
12
14
|
$width: string;
|
|
13
15
|
$type: string;
|
|
@@ -17,50 +19,26 @@ export declare const StyledEditor: import("styled-components/dist/types").IStyle
|
|
|
17
19
|
$disabled: boolean;
|
|
18
20
|
$isMobile?: boolean;
|
|
19
21
|
$borderRadius?: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
$isModified: boolean;
|
|
25
|
-
$maxValue: number;
|
|
26
|
-
$fontSize: string;
|
|
27
|
-
$disabled: boolean;
|
|
28
|
-
$isMobile?: boolean;
|
|
29
|
-
$borderRadius?: string;
|
|
30
|
-
}, never>>> & string;
|
|
31
|
-
export declare const StyledEditorIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$disabled" | "$vil" | "$isModified"> & {
|
|
32
|
-
$vil: ValidationItem[];
|
|
33
|
-
$disabled: boolean;
|
|
34
|
-
$isModified: boolean;
|
|
35
|
-
}, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$disabled" | "$vil" | "$isModified"> & {
|
|
22
|
+
}>> & string;
|
|
23
|
+
export declare const StyledEditorIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
24
|
+
style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
|
|
25
|
+
}, {
|
|
36
26
|
$vil: ValidationItem[];
|
|
37
27
|
$disabled: boolean;
|
|
38
28
|
$isModified: boolean;
|
|
39
|
-
}
|
|
40
|
-
export declare const StyledEditorLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").
|
|
29
|
+
}>> & string;
|
|
30
|
+
export declare const StyledEditorLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
31
|
+
style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
|
|
32
|
+
}, {
|
|
41
33
|
$isFocused: boolean;
|
|
42
|
-
$labelPosition:
|
|
34
|
+
$labelPosition: 'right' | 'left' | 'top';
|
|
43
35
|
$disabled: boolean;
|
|
44
36
|
$fontSize?: string;
|
|
45
37
|
$color?: string;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
$fontSize?: string;
|
|
51
|
-
$color?: string;
|
|
52
|
-
}, never>>> & string;
|
|
53
|
-
export declare const StyledTextareaEditor: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "$width" | "$maxHeight" | "$borderRadius" | "$fontSize" | "$disabled" | "$vil" | "$isModified" | "$isMobile" | "$resize"> & {
|
|
54
|
-
$vil: ValidationItem[];
|
|
55
|
-
$width: string;
|
|
56
|
-
$isModified: boolean;
|
|
57
|
-
$fontSize: string;
|
|
58
|
-
$disabled: boolean;
|
|
59
|
-
$isMobile?: boolean;
|
|
60
|
-
$maxHeight?: string;
|
|
61
|
-
$borderRadius?: string;
|
|
62
|
-
$resize?: boolean;
|
|
63
|
-
}, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "$width" | "$maxHeight" | "$borderRadius" | "$fontSize" | "$disabled" | "$vil" | "$isModified" | "$isMobile" | "$resize"> & {
|
|
38
|
+
}>> & string;
|
|
39
|
+
export declare const StyledTextareaEditor: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "style"> & {
|
|
40
|
+
style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
|
|
41
|
+
}, {
|
|
64
42
|
$vil: ValidationItem[];
|
|
65
43
|
$width: string;
|
|
66
44
|
$isModified: boolean;
|
|
@@ -70,4 +48,4 @@ export declare const StyledTextareaEditor: import("styled-components/dist/types"
|
|
|
70
48
|
$maxHeight?: string;
|
|
71
49
|
$borderRadius?: string;
|
|
72
50
|
$resize?: boolean;
|
|
73
|
-
}
|
|
51
|
+
}>> & string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
3
3
|
import { ValidationItem, SDK_Globals, MetadataDataTypes, DBBrands, ResultTypes } from '@topconsultnpm/sdk-ts';
|
|
4
4
|
import { TreeView } from 'devextreme-react';
|
|
@@ -73,6 +73,6 @@ const TMHtmlContentDisplay = (props) => {
|
|
|
73
73
|
updatedMarkup = convertLinksToAnchors(updatedMarkup);
|
|
74
74
|
updatedMarkup = addMentionStyling(updatedMarkup, usersName);
|
|
75
75
|
updatedMarkup = highlightText(updatedMarkup, searchText);
|
|
76
|
-
return (_jsx(Wrapper, {
|
|
76
|
+
return (_jsx(Wrapper, { $isSelected: isSelected, children: _jsx("div", { dangerouslySetInnerHTML: { __html: updatedMarkup } }) }));
|
|
77
77
|
};
|
|
78
78
|
export default TMHtmlContentDisplay;
|
|
@@ -122,6 +122,6 @@ const TMLocalizedTextBox = ({ label, value, value_IT, value_EN, value_FR, value_
|
|
|
122
122
|
icon: (_jsxs(IconContainer, { children: [_jsx(IconLanguage, {}), localizedCount > 0 && _jsx(Badge, { children: localizedCount })] })),
|
|
123
123
|
onClick: handleTogglePopover,
|
|
124
124
|
};
|
|
125
|
-
return (_jsxs(LocalizedContainer, { ref: containerRef, children: [(qd || tid) ? (_jsx(TMMetadataTextBox, { type: "text", label: label, value: value, isModifiedWhen: isModifiedWhen, buttons: [localizationButton], validationItems: validationItems, qd: qd, tid: tid, readOnly: readOnly, onValueChanged: (e) => onValueChanged(CultureIDs.None, e.target.value) })) : (_jsx(TMTextBox, { type: "text", label: label, value: value, isModifiedWhen: isModifiedWhen, buttons: [localizationButton], validationItems: validationItems, readOnly: readOnly, onValueChanged: (e) => onValueChanged(CultureIDs.None, e.target.value) })), isPopoverVisible && (_jsx(Portal, { popoverRef: popoverRef, children: _jsx(Popover, { ref: popoverRef,
|
|
125
|
+
return (_jsxs(LocalizedContainer, { ref: containerRef, children: [(qd || tid) ? (_jsx(TMMetadataTextBox, { type: "text", label: label, value: value, isModifiedWhen: isModifiedWhen, buttons: [localizationButton], validationItems: validationItems, qd: qd, tid: tid, readOnly: readOnly, onValueChanged: (e) => onValueChanged(CultureIDs.None, e.target.value) })) : (_jsx(TMTextBox, { type: "text", label: label, value: value, isModifiedWhen: isModifiedWhen, buttons: [localizationButton], validationItems: validationItems, readOnly: readOnly, onValueChanged: (e) => onValueChanged(CultureIDs.None, e.target.value) })), isPopoverVisible && (_jsx(Portal, { popoverRef: popoverRef, children: _jsx(Popover, { ref: popoverRef, $isVisible: isPopoverVisible, $top: popoverPosition.top, $left: popoverPosition.left, $width: popoverPosition.width, onMouseDown: (e) => e.stopPropagation(), children: languages.map((lang) => ((qd || tid) ? (_jsx(TMMetadataTextBox, { label: `${lang.label}`, showClearButton: true, icon: _jsx("img", { src: getCultureIDImg(lang.code), alt: "Lang", width: 18, height: 18 }), value: lang.value || '', qd: qd, tid: tid, readOnly: readOnly, onValueChanged: (e) => onValueChanged(lang.code, e.target.value) }, lang.code)) : (_jsx(TMTextBox, { label: `${lang.label}`, showClearButton: true, icon: _jsx("img", { src: getCultureIDImg(lang.code), alt: "Lang", width: 18, height: 18 }), value: lang.value || '', readOnly: readOnly, onValueChanged: (e) => onValueChanged(lang.code, e.target.value) }, lang.code)))) }) }))] }));
|
|
126
126
|
};
|
|
127
127
|
export default TMLocalizedTextBox;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ValidationItem, LayoutModes, QueryOperators } from '@topconsultnpm/sdk-ts';
|
|
2
|
+
import { MetadataDescriptor, ValidationItem, LayoutModes, QueryOperators } from '@topconsultnpm/sdk-ts';
|
|
3
3
|
import { DynDataListsToBeRefreshed, MIDsToBeUpdated } from '../choosers/TMDynDataListItemChooser';
|
|
4
4
|
interface ITMMetadataEditorProps {
|
|
5
5
|
tid: number | undefined;
|
|
6
6
|
mid?: number;
|
|
7
|
+
/** MetadataDescriptor esplicito. Se valorizzato, l'editor lo usa direttamente
|
|
8
|
+
* e salta la risoluzione interna via tid/mid (utile per metadati non legati
|
|
9
|
+
* a un tipo documento, es. copertina CaseFlow). */
|
|
10
|
+
md?: MetadataDescriptor;
|
|
7
11
|
value: string | undefined;
|
|
8
12
|
queryParamsDynDataList?: string[];
|
|
9
13
|
autoFocus?: boolean;
|