@topconsultnpm/sdkui-react 6.19.0-dev2.5 → 6.19.0-dev2.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/lib/components/base/TMButton.d.ts +1 -0
  2. package/lib/components/base/TMButton.js +6 -6
  3. package/lib/components/base/TMCustomButton.d.ts +1 -1
  4. package/lib/components/base/TMCustomButton.js +83 -28
  5. package/lib/components/base/TMDataGridExportForm.d.ts +1 -1
  6. package/lib/components/base/TMDataGridExportForm.js +9 -3
  7. package/lib/components/base/TMFileManager.js +12 -3
  8. package/lib/components/base/TMFileManagerDataGridView.d.ts +2 -0
  9. package/lib/components/base/TMFileManagerDataGridView.js +12 -3
  10. package/lib/components/base/TMFileManagerThumbnailItems.d.ts +2 -0
  11. package/lib/components/base/TMFileManagerThumbnailItems.js +12 -2
  12. package/lib/components/base/TMFileManagerThumbnailsView.d.ts +2 -0
  13. package/lib/components/base/TMFileManagerThumbnailsView.js +2 -2
  14. package/lib/components/base/TMModal.d.ts +2 -0
  15. package/lib/components/base/TMModal.js +13 -2
  16. package/lib/components/base/TMTooltip.d.ts +1 -1
  17. package/lib/components/base/TMTooltip.js +1 -1
  18. package/lib/components/base/TMWaitPanel.js +8 -2
  19. package/lib/components/choosers/TMDcmtTypeChooser.js +2 -2
  20. package/lib/components/choosers/TMMetadataChooser.d.ts +4 -1
  21. package/lib/components/choosers/TMMetadataChooser.js +31 -8
  22. package/lib/components/choosers/TMUserChooser.d.ts +4 -0
  23. package/lib/components/choosers/TMUserChooser.js +21 -5
  24. package/lib/components/editors/TMDateBox.d.ts +1 -1
  25. package/lib/components/editors/TMTextArea.d.ts +1 -0
  26. package/lib/components/editors/TMTextArea.js +43 -9
  27. package/lib/components/editors/TMTextBox.js +33 -3
  28. package/lib/components/editors/TMTextExpression.js +36 -28
  29. package/lib/components/features/assistant/ToppyDraggableHelpCenter.d.ts +28 -0
  30. package/lib/components/features/assistant/ToppyDraggableHelpCenter.js +324 -0
  31. package/lib/components/features/assistant/ToppyHelpCenter.js +1 -1
  32. package/lib/components/features/assistant/ToppySpeechBubble.d.ts +8 -0
  33. package/lib/components/features/assistant/ToppySpeechBubble.js +53 -0
  34. package/lib/components/features/blog/TMBlogCommentForm.d.ts +2 -0
  35. package/lib/components/features/blog/TMBlogCommentForm.js +18 -6
  36. package/lib/components/features/documents/TMDcmtBlog.js +1 -1
  37. package/lib/components/features/documents/TMDcmtForm.js +313 -57
  38. package/lib/components/features/documents/TMDcmtPreview.js +45 -8
  39. package/lib/components/features/documents/TMRelationViewer.js +56 -23
  40. package/lib/components/features/search/TMSavedQuerySelector.js +1 -1
  41. package/lib/components/features/search/TMSearch.js +2 -2
  42. package/lib/components/features/search/TMSearchQueryEditor.js +1 -1
  43. package/lib/components/features/search/TMSearchQueryPanel.js +8 -25
  44. package/lib/components/features/search/TMSearchResult.js +94 -13
  45. package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +2 -1
  46. package/lib/components/features/search/TMSearchResultsMenuItems.js +97 -51
  47. package/lib/components/features/tasks/TMTaskForm.js +11 -5
  48. package/lib/components/features/tasks/TMTasksAgenda.js +4 -4
  49. package/lib/components/features/tasks/TMTasksCalendar.js +2 -2
  50. package/lib/components/features/tasks/TMTasksHeader.js +1 -1
  51. package/lib/components/features/tasks/TMTasksUtils.d.ts +2 -1
  52. package/lib/components/features/tasks/TMTasksUtils.js +18 -3
  53. package/lib/components/features/tasks/TMTasksUtilsView.js +26 -4
  54. package/lib/components/features/tasks/TMTasksView.js +12 -6
  55. package/lib/components/features/workflow/TMWorkflowPopup.js +3 -3
  56. package/lib/components/features/workflow/diagram/DiagramItemForm.js +8 -3
  57. package/lib/components/forms/TMResultDialog.js +8 -2
  58. package/lib/components/forms/TMSaveForm.js +2 -2
  59. package/lib/components/grids/TMBlogsPost.d.ts +8 -3
  60. package/lib/components/grids/TMBlogsPost.js +73 -11
  61. package/lib/components/grids/TMBlogsPostUtils.d.ts +1 -0
  62. package/lib/components/grids/TMBlogsPostUtils.js +15 -3
  63. package/lib/components/grids/TMRecentsManager.js +1 -1
  64. package/lib/components/index.d.ts +2 -1
  65. package/lib/components/index.js +2 -1
  66. package/lib/components/layout/panelManager/TMPanelManagerContainer.d.ts +1 -0
  67. package/lib/components/layout/panelManager/TMPanelManagerContainer.js +2 -2
  68. package/lib/components/layout/panelManager/TMPanelManagerContext.js +0 -1
  69. package/lib/components/layout/panelManager/TMPanelManagerToolbar.js +2 -1
  70. package/lib/components/layout/panelManager/types.d.ts +1 -0
  71. package/lib/components/pages/TMPage.js +1 -1
  72. package/lib/components/settings/SettingsAppearance.js +5 -5
  73. package/lib/components/viewers/TMDataListItemViewer.d.ts +1 -1
  74. package/lib/components/viewers/TMMidViewer.d.ts +1 -1
  75. package/lib/components/viewers/TMTidViewer.d.ts +1 -1
  76. package/lib/helper/GlobalStyles.d.ts +2 -0
  77. package/lib/helper/GlobalStyles.js +10 -0
  78. package/lib/helper/Globalization.d.ts +1 -0
  79. package/lib/helper/Globalization.js +30 -0
  80. package/lib/helper/SDKUI_Localizator.d.ts +39 -2
  81. package/lib/helper/SDKUI_Localizator.js +392 -22
  82. package/lib/helper/TMCustomSearchBar.js +1 -1
  83. package/lib/helper/TMIcons.d.ts +4 -1
  84. package/lib/helper/TMIcons.js +13 -1
  85. package/lib/helper/TMUtils.d.ts +1 -4
  86. package/lib/helper/TMUtils.js +18 -23
  87. package/lib/helper/dcmtsHelper.d.ts +2 -1
  88. package/lib/helper/dcmtsHelper.js +56 -17
  89. package/lib/helper/helpers.js +5 -1
  90. package/lib/helper/index.d.ts +1 -0
  91. package/lib/helper/index.js +1 -0
  92. package/lib/hooks/useRelatedDocuments.js +35 -26
  93. package/lib/ts/types.d.ts +3 -1
  94. package/package.json +8 -8
@@ -38,7 +38,18 @@ export const TMMetadataChooserForm = ({ tmSession, tids, qd, filterMetadata, qdS
38
38
  if (checkProps)
39
39
  throw Error('Le props qd | tids | dataSource devono essere in alternativa');
40
40
  try {
41
- if (qd) {
41
+ if (dataSource) {
42
+ // Se ho dataSource, aggiungo tutti i suoi metadati con uniqueKey
43
+ dataSource.forEach((md) => {
44
+ const mdWithKey = md;
45
+ mdWithKey.uniqueKey = `${mdWithKey.customData1 ?? 0}_${md.id}_${mdWithKey.customData2 ?? ''}`;
46
+ metadata.push(mdWithKey);
47
+ });
48
+ setDcmtTypes(dtdList);
49
+ setHasSysMetadata(allowSysMetadata && metadata.findIndex(md => md.isSystem == 1) >= 0);
50
+ return showSysMetadata ? metadata : metadata.filter(o => o.isSystem != 1);
51
+ }
52
+ else if (qd) {
42
53
  let tids = getTIDsByQd(qd);
43
54
  let inputTIDs = tids.map((item) => item.tid);
44
55
  TMSpinner.show({ description: `${SDKUI_Localizator.Loading} - ${SDK_Localizator.DcmtType} ...` });
@@ -48,20 +59,26 @@ export const TMMetadataChooserForm = ({ tmSession, tids, qd, filterMetadata, qdS
48
59
  dtd.init({ ...dtds[i] });
49
60
  const alias = tids?.[i].alias ?? '';
50
61
  dtd.customData2 = alias;
62
+ let mds;
51
63
  if (!qdShowOnlySelectItems) {
52
64
  dtd.metadata?.forEach((md) => {
53
- md.customData1 = dtd.id;
54
- md.customData2 = alias;
65
+ const mdWithKey = md;
66
+ mdWithKey.customData1 = dtd.id;
67
+ mdWithKey.customData2 = alias;
68
+ mdWithKey.uniqueKey = `${dtd.id}_${md.id}_${alias}`;
55
69
  });
70
+ mds = filterMetadata ? dtd.metadata?.filter(filterMetadata) : dtd.metadata;
56
71
  }
57
72
  else {
58
73
  let newMetadata = dtd.metadata?.filter(o => qd.select?.some(s => s.tid == dtd.id && s.mid == o.id && ((s.alias ?? '') == alias)));
59
74
  newMetadata?.forEach((md) => {
60
- md.customData1 = dtd.id;
61
- md.customData2 = alias;
75
+ const mdWithKey = md;
76
+ mdWithKey.customData1 = dtd.id;
77
+ mdWithKey.customData2 = alias;
78
+ mdWithKey.uniqueKey = `${dtd.id}_${md.id}_${alias}`;
62
79
  });
80
+ mds = filterMetadata ? newMetadata?.filter(filterMetadata) : newMetadata;
63
81
  }
64
- let mds = filterMetadata ? dtd.metadata?.filter(filterMetadata) : dtd.metadata;
65
82
  dtdList.push({ ...dtd, metadata: mds });
66
83
  }
67
84
  }
@@ -81,7 +98,11 @@ export const TMMetadataChooserForm = ({ tmSession, tids, qd, filterMetadata, qdS
81
98
  continue;
82
99
  }
83
100
  let mds = filterMetadata ? dtd.metadata?.filter(filterMetadata) : dtd.metadata;
84
- mds?.forEach((md) => { md.customData1 = dtd?.id; });
101
+ mds?.forEach((md) => {
102
+ const mdWithKey = md;
103
+ mdWithKey.customData1 = dtd?.id;
104
+ mdWithKey.uniqueKey = `${dtd.id}_${md.id}_${md.customData2 ?? ''}`;
105
+ });
85
106
  dtdList.push({ ...dtd, metadata: mds });
86
107
  }
87
108
  }
@@ -130,5 +151,7 @@ export const TMMetadataChooserForm = ({ tmSession, tids, qd, filterMetadata, qdS
130
151
  const cellRenderNameAndDesc = useCallback((data) => {
131
152
  return _jsx("p", { style: { textAlign: 'left', color: data.data.isRequired == 1 ? 'red' : '' }, children: data.value });
132
153
  }, []);
133
- return (_jsx(TMChooserForm, { title: SDK_Localizator.Metadatas, allowMultipleSelection: allowMultipleSelection, allowSorting: false, allowGrouping: dcmtTypes.length > 1, width: width, height: height, selectedIDs: selectedIDs?.map((item) => item.mid), convertID: convertID, cellRenderIcon: cellRenderIcon, cellRenderNameAndDesc: cellRenderNameAndDesc, dataSource: dataSource, getItems: getItems, customButtons: renderCustomButtons(), columns: dataColumns, summaryItems: renderSummaryItems, onClose: onClose, onChoose: (IDs) => { onChoose?.(IDs); } }));
154
+ return (_jsx(TMChooserForm, { title: SDK_Localizator.Metadatas, allowMultipleSelection: allowMultipleSelection, allowSorting: false, allowGrouping: dcmtTypes.length > 1, width: width, height: height, keyName: 'uniqueKey', selectedIDs: selectedIDs?.map((item) => `${item.tid}_${item.mid}_${item.aliasTID ?? ''}`), convertID: convertID, cellRenderIcon: cellRenderIcon, cellRenderNameAndDesc: cellRenderNameAndDesc,
155
+ // dataSource={dataSource}
156
+ getItems: getItems, customButtons: renderCustomButtons(), columns: dataColumns, summaryItems: renderSummaryItems, onClose: onClose, onChoose: (IDs) => { onChoose?.(IDs); } }));
134
157
  };
@@ -14,6 +14,8 @@ interface ITMUserChooserProps extends ITMChooserProps {
14
14
  hideShowId?: boolean;
15
15
  /** Initial value for showChooser */
16
16
  initialShowChooser?: boolean;
17
+ /** Allow showing all users with toggle button */
18
+ allowShowAllUsers?: boolean;
17
19
  }
18
20
  declare const TMUserChooser: React.FunctionComponent<ITMUserChooserProps>;
19
21
  export default TMUserChooser;
@@ -24,6 +26,8 @@ interface ITMUserChooserFormProps extends ITMChooserFormProps<UserDescriptor> {
24
26
  hideRefresh?: boolean;
25
27
  /** Nascondi pulsante mostra ID */
26
28
  hideShowId?: boolean;
29
+ /** Allow showing all users with toggle button */
30
+ allowShowAllUsers?: boolean;
27
31
  }
28
32
  export declare const TMUserChooserForm: React.FunctionComponent<ITMUserChooserFormProps>;
29
33
  export declare const TMUserIdViewer: ({ userId, showIcon, noneSelectionText }: {
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useEffect, useMemo, useRef, useState } from 'react';
3
3
  import { OwnershipLevels, SDK_Localizator, UserLevels, UserListCacheService } from '@topconsultnpm/sdk-ts';
4
- import { SDKUI_Localizator, IconSearch, IconUserLevelMember, IconUserLevelAdministrator, IconUserLevelSystemAdministrator, IconUserLevelAutonomousAdministrator, IconWarning, LocalizeOwnershipLevels, LocalizeUserLevels } from '../../helper';
4
+ import { SDKUI_Localizator, IconSearch, IconUserLevelMember, IconUserLevelAdministrator, IconUserLevelSystemAdministrator, IconUserLevelAutonomousAdministrator, IconWarning, LocalizeOwnershipLevels, LocalizeUserLevels, IconShowAllUsersOff, IconShowAllUsers } from '../../helper';
5
5
  import { StyledDivHorizontal, StyledTooltipContainer, StyledTooltipSeparatorItem } from '../base/Styled';
6
6
  import TMSpinner from '../base/TMSpinner';
7
7
  import TMTooltip from '../base/TMTooltip';
@@ -9,7 +9,8 @@ import TMSummary from '../editors/TMSummary';
9
9
  import TMChooserForm from '../forms/TMChooserForm';
10
10
  import { TMColors } from '../../utils/theme';
11
11
  import { TMExceptionBoxManager } from '../base/TMPopUp';
12
- const TMUserChooser = ({ labelColor, titleForm, filter, readOnly = false, icon, width, dataSource, backgroundColor, openChooserBySingleClick, buttons = [], disabled = false, showBorder = true, hideRefresh = false, hideShowId = false, elementStyle, allowMultipleSelection, values, isModifiedWhen, label, placeHolder, validationItems = [], onValueChanged, showClearButton, initialShowChooser = false }) => {
12
+ import TMButton from '../base/TMButton';
13
+ const TMUserChooser = ({ labelColor, titleForm, filter, readOnly = false, icon, width, dataSource, backgroundColor, openChooserBySingleClick, buttons = [], disabled = false, showBorder = true, hideRefresh = false, hideShowId = false, elementStyle, allowMultipleSelection, values, isModifiedWhen, label, placeHolder, validationItems = [], onValueChanged, showClearButton, initialShowChooser = false, allowShowAllUsers = false }) => {
13
14
  const [showChooser, setShowChooser] = useState(initialShowChooser);
14
15
  useEffect(() => {
15
16
  setShowChooser(initialShowChooser);
@@ -20,13 +21,15 @@ const TMUserChooser = ({ labelColor, titleForm, filter, readOnly = false, icon,
20
21
  return (_jsxs(StyledDivHorizontal, { style: { minWidth: '125px', color: isPlaceholder ? '#a9a9a9' : 'inherit' }, children: [values && values.length > 0 && _jsx(TMUserIdViewer, { userId: values?.[0], showIcon: true, noneSelectionText: '' }), values && values.length > 1 && _jsx("p", { style: { marginLeft: '10px' }, children: `(+${values.length - 1} ${values.length == 2 ? 'altro' : 'altri'})` })] }));
21
22
  };
22
23
  return (_jsxs(_Fragment, { children: [_jsx(TMSummary, { ref: summaryInputRef, width: width, disabled: disabled, placeHolder: placeHolder, readOnly: readOnly, labelColor: labelColor, icon: icon, backgroundColor: backgroundColor, buttons: buttons, showBorder: showBorder, hasValue: values && values.length > 0, showClearButton: showClearButton, iconEditButton: _jsx(IconSearch, { fontSize: 16 }), onEditorClick: () => !readOnly && setShowChooser(true), elementStyle: elementStyle, isModifiedWhen: isModifiedWhen, openEditorOnSummaryClick: openChooserBySingleClick, label: label, template: renderTemplate(), onClearClick: showClearButton ? () => { onValueChanged?.([]); } : undefined, validationItems: validationItems }), showChooser &&
23
- _jsx(TMUserChooserForm, { title: titleForm, allowMultipleSelection: allowMultipleSelection, hasShowOnlySelectedItems: true, dataSource: dataSource, filter: filter, selectedIDs: values, hideRefresh: hideRefresh, hideShowId: hideShowId, onClose: () => {
24
+ _jsx(TMUserChooserForm, { title: titleForm, allowMultipleSelection: allowMultipleSelection, hasShowOnlySelectedItems: true, dataSource: dataSource, filter: filter, selectedIDs: values, hideRefresh: hideRefresh, hideShowId: hideShowId, allowShowAllUsers: allowShowAllUsers, onClose: () => {
24
25
  setShowChooser(false);
25
26
  summaryInputRef.current?.focus();
26
27
  }, onChoose: (IDs) => { onValueChanged?.(IDs); } })] }));
27
28
  };
28
29
  export default TMUserChooser;
29
- export const TMUserChooserForm = ({ allowMultipleSelection, columns, hideRefresh = false, hideShowId = false, startWithShowOnlySelectedItems = true, filter, title, hasShowOnlySelectedItems, width, height, selectedIDs, dataSource, onClose, onChoose }) => {
30
+ export const TMUserChooserForm = ({ allowMultipleSelection, columns, hideRefresh = false, hideShowId = false, startWithShowOnlySelectedItems = true, filter, title, hasShowOnlySelectedItems, width, height, selectedIDs, dataSource, onClose, onChoose, allowShowAllUsers = false }) => {
31
+ const [currentDataSource, setCurrentDataSource] = useState(dataSource);
32
+ const [showingAllUsers, setShowingAllUsers] = useState(false);
30
33
  const dataColumns = useMemo(() => {
31
34
  return [
32
35
  { dataField: 'domain', caption: SDKUI_Localizator.Domain, dataType: 'string' },
@@ -42,6 +45,18 @@ export const TMUserChooserForm = ({ allowMultipleSelection, columns, hideRefresh
42
45
  TMSpinner.hide();
43
46
  return users;
44
47
  };
48
+ const handleToggleAllUsers = () => {
49
+ if (showingAllUsers) {
50
+ // Torna indietro: ripristina il dataSource originale
51
+ setCurrentDataSource(dataSource);
52
+ setShowingAllUsers(false);
53
+ }
54
+ else {
55
+ // Mostra tutti: rimuove il dataSource per usare getItems
56
+ setCurrentDataSource(undefined);
57
+ setShowingAllUsers(true);
58
+ }
59
+ };
45
60
  const getTitle = () => {
46
61
  let title = SDK_Localizator.Users;
47
62
  if (title)
@@ -49,7 +64,8 @@ export const TMUserChooserForm = ({ allowMultipleSelection, columns, hideRefresh
49
64
  return title;
50
65
  };
51
66
  const cellRenderIcon = (data) => _jsx(TMUserIcon, { ud: data.data });
52
- return (_jsx(TMChooserForm, { title: getTitle(), allowMultipleSelection: allowMultipleSelection, startWithShowOnlySelectedItems: startWithShowOnlySelectedItems, hasShowOnlySelectedItems: hasShowOnlySelectedItems, width: width, height: height, manageUseLocalizedName: false, columns: columns ?? dataColumns, showDefaultColumns: false, selectedIDs: selectedIDs, cellRenderIcon: cellRenderIcon, dataSource: dataSource, getItems: getItems, hasShowId: !hideShowId, hideRefresh: hideRefresh, onClose: onClose, onChoose: (IDs) => onChoose?.(IDs) }));
67
+ const customButton = (allowShowAllUsers && dataSource) ? (_jsx(TMButton, { btnStyle: 'toolbar', caption: showingAllUsers ? SDKUI_Localizator.HideAll : SDKUI_Localizator.ShowAll, onClick: handleToggleAllUsers, icon: showingAllUsers ? _jsx(IconShowAllUsersOff, {}) : _jsx(IconShowAllUsers, {}) })) : undefined;
68
+ return (_jsx(TMChooserForm, { title: getTitle(), allowMultipleSelection: allowMultipleSelection, startWithShowOnlySelectedItems: startWithShowOnlySelectedItems, hasShowOnlySelectedItems: hasShowOnlySelectedItems, width: width, height: height, manageUseLocalizedName: false, columns: columns ?? dataColumns, showDefaultColumns: false, selectedIDs: selectedIDs, cellRenderIcon: cellRenderIcon, dataSource: currentDataSource, getItems: getItems, hasShowId: !hideShowId, hideRefresh: hideRefresh, customButtons: customButton, onClose: onClose, onChoose: (IDs) => onChoose?.(IDs) }));
53
69
  };
54
70
  export const TMUserIdViewer = ({ userId, showIcon = false, noneSelectionText = `<${SDKUI_Localizator.NoneSelection}>` }) => {
55
71
  const [ud, setUd] = useState();
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { ValidationItem } from '@topconsultnpm/sdk-ts';
3
- import { IDateBoxOptions } from 'devextreme-react/cjs/date-box';
3
+ import { IDateBoxOptions } from 'devextreme-react/date-box';
4
4
  import { DateDisplayTypes } from '../../helper';
5
5
  interface ITMDateBoxProps extends IDateBoxOptions {
6
6
  dateDisplayType?: DateDisplayTypes;
@@ -12,6 +12,7 @@ interface ITMTextArea extends ITMEditorBase {
12
12
  rows?: number;
13
13
  maxLength?: number;
14
14
  resize?: boolean;
15
+ autoCalculateRows?: boolean;
15
16
  }
16
17
  declare const TMTextArea: React.FunctionComponent<ITMTextArea>;
17
18
  export default TMTextArea;
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState, useEffect, useRef } from 'react';
3
3
  import { StyledEditorContainer, StyledEditorIcon, StyledEditorLabel, StyledTextareaEditor } from './TMEditorStyled';
4
4
  import { FontSize, TMColors } from '../../utils/theme';
@@ -8,8 +8,10 @@ import TMLayoutContainer, { TMLayoutItem } from '../base/TMLayout';
8
8
  import TMVilViewer from '../base/TMVilViewer';
9
9
  import TMTooltip from '../base/TMTooltip';
10
10
  import { DeviceType, useDeviceType } from '../base/TMDeviceProvider';
11
- import { IconClearButton } from '../../helper';
11
+ import { IconClearButton, IconDataList, SDKUI_Localizator } from '../../helper';
12
12
  import styled from 'styled-components';
13
+ import { FormulaItemHelper } from './TMTextExpression';
14
+ import TMChooserForm from '../forms/TMChooserForm';
13
15
  const StyledTextAreaEditorButton = styled.div `
14
16
  color: ${TMColors.button_icon};
15
17
  display: flex;
@@ -26,7 +28,7 @@ const StyledTextAreaEditorButton = styled.div `
26
28
  // Define the TMTextArea component
27
29
  const TMTextArea = (props) => {
28
30
  // Extract properties from the props object
29
- const { label = '', value = '', width = '100%', height = 'auto', autoFocus = false, showClearButton, validationItems = [], disabled = false, isModifiedWhen = false, fontSize = FontSize.defaultFontSize, elementStyle = {}, icon = null, labelPosition = 'left', readOnly = false, onValueChanged, onBlur, placeHolder, formulaItems = [], buttons = [], maxHeight = 'auto', rows, maxLength, resize = true } = props;
31
+ const { label = '', value = '', width = '100%', height = 'auto', autoFocus = false, showClearButton, validationItems = [], disabled = false, isModifiedWhen = false, fontSize = FontSize.defaultFontSize, elementStyle = {}, icon = null, labelPosition = 'left', readOnly = false, onValueChanged, onBlur, placeHolder, formulaItems = [], buttons = [], maxHeight = 'auto', rows, maxLength, resize = true, autoCalculateRows = true } = props;
30
32
  // Reference to the textarea DOM element
31
33
  const inputRef = useRef(null);
32
34
  // Stores the textarea is focused
@@ -37,11 +39,15 @@ const TMTextArea = (props) => {
37
39
  const [formulaMenuItems, setFormulaMenuItems] = useState([]);
38
40
  // Stores the calculated number of rows for the textarea
39
41
  const [calculatedRows, setCalculatedRows] = useState(rows ?? 1);
42
+ //Show chooserForm formulaItems
43
+ const [showFormulaItemsChooser, setShowFormulaItemsChooser] = useState(false);
40
44
  // Manages the state for the custom context menu
41
45
  const { clicked, setClicked, points, setPoints } = useContextMenu();
42
46
  const deviceType = useDeviceType();
43
47
  // Attach a `ResizeObserver` to the textarea to monitor changes in width: dynamically updates rows based on textarea content and width
44
48
  useEffect(() => {
49
+ if (!autoCalculateRows)
50
+ return;
45
51
  const observer = new ResizeObserver(() => { if (currentValue) {
46
52
  updateRows();
47
53
  } });
@@ -51,18 +57,18 @@ const TMTextArea = (props) => {
51
57
  return () => { if (inputRef.current) {
52
58
  observer.unobserve(inputRef.current);
53
59
  } };
54
- }, [currentValue]);
60
+ }, [currentValue, autoCalculateRows]);
55
61
  // Update current value whenever the `value` prop changes, synchronize the internal state with the `value` prop
56
62
  useEffect(() => {
57
63
  setCurrentValue(value);
58
64
  }, [value]);
59
65
  // Recalculate the number of rows whenever the `currentValue` changes
60
66
  useEffect(() => {
61
- if (currentValue) {
67
+ if (autoCalculateRows && currentValue) {
62
68
  const newRowCount = calculateRows(currentValue);
63
69
  setCalculatedRows(newRowCount);
64
70
  }
65
- }, [currentValue]);
71
+ }, [currentValue, autoCalculateRows]);
66
72
  // Populate the formula menu items whenever the `formulaItems` prop changes
67
73
  useEffect(() => {
68
74
  if (formulaItems && formulaItems.length > 0) {
@@ -73,6 +79,30 @@ const TMTextArea = (props) => {
73
79
  setFormulaMenuItems(menuItems);
74
80
  }
75
81
  }, [formulaItems]);
82
+ function getFormulaDataSorce() {
83
+ let fiarray = [];
84
+ if (!formulaItems)
85
+ return [];
86
+ let i = 0;
87
+ for (const f of formulaItems) {
88
+ let fi = new FormulaItemHelper();
89
+ fi.id = i;
90
+ fi.paramName = f;
91
+ fiarray.push(fi);
92
+ i++;
93
+ }
94
+ return fiarray;
95
+ }
96
+ const openFormulaItemsChooser = () => {
97
+ return (showFormulaItemsChooser ?
98
+ _jsx(TMChooserForm, { title: SDKUI_Localizator.Parameters, height: '350', width: '300', hasShowId: false, showDefaultColumns: false, allowMultipleSelection: true, columns: [
99
+ { dataField: 'paramName', caption: SDKUI_Localizator.Name, dataType: 'string', sortOrder: 'asc', alignment: 'left' }
100
+ ], dataSource: getFormulaDataSorce(), onClose: () => { setShowFormulaItemsChooser(false); }, onChoose: (IDs) => {
101
+ let expr = value?.toString() ?? '';
102
+ IDs.map(i => expr += formulaItems[i]);
103
+ onValueChanged?.({ target: { value: expr } });
104
+ } }) : _jsx(_Fragment, {}));
105
+ };
76
106
  // Adjust the rows dynamically
77
107
  const updateRows = () => {
78
108
  const newRowCount = calculateRows(currentValue);
@@ -136,15 +166,19 @@ const TMTextArea = (props) => {
136
166
  const y = e.clientY - bounds.top;
137
167
  // set the x and y coordinates of our users right click
138
168
  setPoints({ x, y });
139
- }, "$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: label.length > 0 ? '22px' : '7px', pointerEvents: disabled ? 'none' : 'auto', opacity: disabled ? 0.4 : 1 }, children: [showClearButton && currentValue &&
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: label.length > 0 ? '22px' : '7px', pointerEvents: disabled ? 'none' : 'auto', opacity: disabled ? 0.4 : 1 }, children: [formulaItems.length > 0 &&
170
+ _jsx(StyledTextAreaEditorButton, { onClick: () => {
171
+ setShowFormulaItemsChooser(true);
172
+ }, children: _jsx(IconDataList, {}) }), showClearButton && currentValue &&
140
173
  _jsx(StyledTextAreaEditorButton, { onClick: () => {
141
174
  onValueChanged?.({ target: { value: undefined } });
142
175
  setCurrentValue('');
143
- setCalculatedRows(1);
176
+ if (autoCalculateRows)
177
+ setCalculatedRows(1);
144
178
  onBlur?.(undefined);
145
179
  }, children: _jsx(IconClearButton, {}) }), buttons.map((buttonItem, index) => {
146
180
  return (_jsx(StyledTextAreaEditorButton, { onClick: buttonItem.onClick, children: _jsx(TMTooltip, { content: buttonItem.text, children: buttonItem.icon }) }, buttonItem.text));
147
- })] }), formulaItems.length > 0 && clicked && (_jsx(TMContextMenu, { menuData: formulaMenuItems, top: points.y, left: points.x, onMenuItemClick: (formula) => insertText(formula) })), _jsx(TMVilViewer, { vil: validationItems })] });
181
+ })] }), openFormulaItemsChooser(), formulaItems.length > 0 && clicked && (_jsx(TMContextMenu, { menuData: formulaMenuItems, top: points.y, left: points.x, onMenuItemClick: (formula) => insertText(formula) })), _jsx(TMVilViewer, { vil: validationItems })] });
148
182
  };
149
183
  // Layout for the textarea with a left-aligned label
150
184
  const renderedLeftLabelTextArea = () => {
@@ -3,7 +3,7 @@ import { useState, useEffect, useRef } from 'react';
3
3
  import styled from 'styled-components';
4
4
  import { StyledEditor, StyledEditorContainer, StyledEditorIcon, StyledEditorLabel, editorColorManager } from './TMEditorStyled';
5
5
  import { FontSize, TMColors } from '../../utils/theme';
6
- import { genUniqueId, IconClearButton, IconHide, IconShow, SDKUI_Localizator } from '../../helper';
6
+ import { genUniqueId, IconClearButton, IconDataList, IconHide, IconShow, SDKUI_Localizator } from '../../helper';
7
7
  import ShowAlert from '../base/TMAlert';
8
8
  import { TMExceptionBoxManager } from '../base/TMPopUp';
9
9
  import TMLayoutContainer, { TMLayoutItem } from '../base/TMLayout';
@@ -11,6 +11,8 @@ import TMVilViewer from '../base/TMVilViewer';
11
11
  import TMTooltip from '../base/TMTooltip';
12
12
  import { ContextMenu } from 'devextreme-react';
13
13
  import { DeviceType, useDeviceType } from '../base/TMDeviceProvider';
14
+ import TMChooserForm from '../forms/TMChooserForm';
15
+ import { FormulaItemHelper } from './TMTextExpression';
14
16
  const StyledShowPasswordIcon = styled.div `
15
17
  color: ${props => !props.$disabled ? (props.$vil.length === 0) ? !props.$isModified ? TMColors.text_normal : TMColors.isModified : editorColorManager(props.$vil) : TMColors.disabled};
16
18
  position: absolute;
@@ -37,6 +39,7 @@ const TMTextBox = ({ autoFocus, maxLength, labelColor, precision, fromModal = fa
37
39
  const [currentType, setCurrentType] = useState(type);
38
40
  const [currentValue, setCurrentValue] = useState(value);
39
41
  const [formulaMenuItems, setFormulaMenuItems] = useState([]);
42
+ const [showFormulaItemsChooser, setShowFormulaItemsChooser] = useState(false);
40
43
  const [isFocused, setIsFocused] = useState(false);
41
44
  const inputRef = useRef(null);
42
45
  const deviceType = useDeviceType();
@@ -219,6 +222,30 @@ const TMTextBox = ({ autoFocus, maxLength, labelColor, precision, fromModal = fa
219
222
  setCurrentValue(inputValue);
220
223
  onValueChanged?.({ target: { value: inputValue } }); // Passa il valore filtrato
221
224
  };
225
+ function getFormulaDataSorce() {
226
+ let fiarray = [];
227
+ if (!formulaItems)
228
+ return [];
229
+ let i = 0;
230
+ for (const f of formulaItems) {
231
+ let fi = new FormulaItemHelper();
232
+ fi.id = i;
233
+ fi.paramName = f;
234
+ fiarray.push(fi);
235
+ i++;
236
+ }
237
+ return fiarray;
238
+ }
239
+ const openFormulaItemsChooser = () => {
240
+ return (showFormulaItemsChooser ?
241
+ _jsx(TMChooserForm, { title: SDKUI_Localizator.Parameters, height: '350', width: '300', hasShowId: false, showDefaultColumns: false, allowMultipleSelection: true, columns: [
242
+ { dataField: 'paramName', caption: SDKUI_Localizator.Name, dataType: 'string', sortOrder: 'asc', alignment: 'left' }
243
+ ], dataSource: getFormulaDataSorce(), onClose: () => { setShowFormulaItemsChooser(false); }, onChoose: (IDs) => {
244
+ let expr = value?.toString() ?? '';
245
+ IDs.map(i => expr += formulaItems[i]);
246
+ onValueChanged?.({ target: { value: expr } });
247
+ } }) : _jsx(_Fragment, {}));
248
+ };
222
249
  const renderInputField = () => {
223
250
  const bulletEntity = '\u2022'; // &#8226;
224
251
  const displayedValue = initialType === 'secureText'
@@ -233,13 +260,16 @@ const TMTextBox = ({ autoFocus, maxLength, labelColor, precision, fromModal = fa
233
260
  e.preventDefault();
234
261
  }
235
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' &&
236
- _jsxs("div", { style: { display: 'flex', flexDirection: 'row', justifyContent: 'flex-start', alignItems: 'center', position: 'absolute', right: type === 'number' ? '25px' : '6px', top: label.length > 0 ? '20px' : '7px', pointerEvents: disabled ? 'none' : 'auto', opacity: disabled ? 0.4 : 1 }, children: [showClearButton && currentValue &&
263
+ _jsxs("div", { style: { display: 'flex', flexDirection: 'row', justifyContent: 'flex-start', alignItems: 'center', position: 'absolute', right: type === 'number' ? '25px' : '6px', top: label.length > 0 ? '20px' : '7px', pointerEvents: disabled ? 'none' : 'auto', opacity: disabled ? 0.4 : 1 }, children: [formulaItems.length > 0 &&
264
+ _jsx(StyledTextBoxEditorButton, { onClick: () => {
265
+ setShowFormulaItemsChooser(true);
266
+ }, children: _jsx(IconDataList, {}) }), showClearButton && currentValue &&
237
267
  _jsx(StyledTextBoxEditorButton, { onClick: () => {
238
268
  onValueChanged?.({ target: { value: undefined } });
239
269
  onBlur?.(undefined);
240
270
  }, children: _jsx(IconClearButton, {}) }), buttons.map((buttonItem, index) => {
241
271
  return (_jsx(StyledTextBoxEditorButton, { onClick: buttonItem.onClick, children: _jsx(TMTooltip, { content: buttonItem.text, children: buttonItem.icon }) }, buttonItem.text));
242
- })] }), formulaItems.length > 0 && (_jsx(ContextMenu, { dataSource: formulaMenuItems, target: `#text-${id}`, onItemClick: (e) => { insertText(e.itemData?.text ?? ''); } })), _jsx(TMVilViewer, { vil: validationItems })] }));
272
+ })] }), openFormulaItemsChooser(), formulaItems.length > 0 && (_jsx(ContextMenu, { dataSource: formulaMenuItems, target: `#text-${id}`, onItemClick: (e) => { insertText(e.itemData?.text ?? ''); } })), _jsx(TMVilViewer, { vil: validationItems })] }));
243
273
  };
244
274
  const renderedLeftLabelTextBox = () => {
245
275
  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,10 +1,9 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useMemo, useState } from 'react';
3
3
  import { DcmtTypeListCacheService } from '@topconsultnpm/sdk-ts';
4
- import { IconClear, IconColumns, IconDataList, SDKUI_Localizator, stringIsNullOrEmpty } from '../../helper';
4
+ import { IconClear, IconColumns, SDKUI_Localizator, stringIsNullOrEmpty } from '../../helper';
5
5
  import { TMExceptionBoxManager } from '../base/TMPopUp';
6
6
  import { TMMetadataChooserForm } from '../choosers/TMMetadataChooser';
7
- import TMChooserForm from '../forms/TMChooserForm';
8
7
  import TMTextBox from './TMTextBox';
9
8
  import TMTextArea from './TMTextArea';
10
9
  const TMTextExpression = (props) => {
@@ -96,8 +95,7 @@ const TMTextExpression = (props) => {
96
95
  let buttons = [];
97
96
  if (props.qd || props.tid)
98
97
  buttons.push({ icon: _jsx(IconColumns, {}), text: SDKUI_Localizator.MetadataReferenceInsert, onClick: () => { setShowMetadataChooser(true); } });
99
- if (props.formulaItems && props.formulaItems.length > 0)
100
- buttons.push({ icon: _jsx(IconDataList, {}), text: SDKUI_Localizator.Parameters, onClick: () => setShowFormulaChooser(true) });
98
+ // if (props.formulaItems && props.formulaItems.length > 0) buttons.push({ icon: <IconDataList />, text: SDKUI_Localizator.Parameters, onClick: () => setShowFormulaChooser(true) })
101
99
  buttons.push({ icon: _jsx(IconClear, {}), text: SDKUI_Localizator.Clear, onClick: () => props.onValueChanged?.('') });
102
100
  return buttons;
103
101
  };
@@ -120,20 +118,18 @@ const TMTextExpression = (props) => {
120
118
  }
121
119
  return output;
122
120
  }
123
- function getFormulaDataSorce() {
124
- let fiarray = [];
125
- if (!props.formulaItems)
126
- return [];
127
- let i = 0;
128
- for (const f of props.formulaItems) {
129
- let fi = new FormulaItemHelper();
130
- fi.id = i;
131
- fi.paramName = f;
132
- fiarray.push(fi);
133
- i++;
134
- }
135
- return fiarray;
136
- }
121
+ // function getFormulaDataSorce() {
122
+ // let fiarray: FormulaItemHelper[] = []
123
+ // if (!props.formulaItems) return []
124
+ // let i: number = 0;
125
+ // for (const f of props.formulaItems!) {
126
+ // let fi = new FormulaItemHelper();
127
+ // fi.id = i; fi.paramName = f;
128
+ // fiarray.push(fi);
129
+ // i++;
130
+ // }
131
+ // return fiarray;
132
+ // }
137
133
  const openMetadataChooseForm = () => {
138
134
  return (showMetadataChooser ?
139
135
  _jsx(TMMetadataChooserForm, { allowMultipleSelection: true, qd: props.qd, tids: props.tid ? [props.tid] : undefined, qdShowOnlySelectItems: true, allowSysMetadata: true, onClose: () => setShowMetadataChooser(false), onChoose: (tid_mid) => {
@@ -146,18 +142,30 @@ const TMTextExpression = (props) => {
146
142
  { dataField: 'paramName', caption: props.captionColumnChooser ?? SDKUI_Localizator.Name, dataType: 'string', sortOrder: 'asc', alignment: 'left' }
147
143
  ];
148
144
  }, []);
149
- const openFormulaChooseForm = () => {
150
- return (showFormulaChooser ?
151
- _jsx(TMChooserForm, { title: props.titleChooser ?? SDKUI_Localizator.Parameters, height: props.higthChooser ?? '350', width: props.widthChooser ?? '300', hasShowId: false, showDefaultColumns: false, allowMultipleSelection: props.disableMultipleSelection !== true, columns: dataColumns, dataSource: getFormulaDataSorce(), onClose: () => { setShowFormulaChooser(false); }, onChoose: (IDs) => {
152
- let expr = props.value ?? '';
153
- IDs.map(i => expr += props.formulaItems[i]);
154
- props.onValueChanged?.(expr);
155
- } }) : _jsx(_Fragment, {}));
156
- };
145
+ // const openFormulaChooseForm = () => {
146
+ // return (showFormulaChooser ?
147
+ // <TMChooserForm
148
+ // title={props.titleChooser ?? SDKUI_Localizator.Parameters}
149
+ // height={props.higthChooser ?? '350'}
150
+ // width={props.widthChooser ?? '300'}
151
+ // hasShowId={false}
152
+ // showDefaultColumns={false}
153
+ // allowMultipleSelection={props.disableMultipleSelection !== true}
154
+ // columns={dataColumns}
155
+ // dataSource={getFormulaDataSorce()}
156
+ // onClose={() => { setShowFormulaChooser(false); }}
157
+ // onChoose={(IDs: number[]) => {
158
+ // let expr: string = props.value ?? '';
159
+ // IDs.map(i => expr += props.formulaItems![i]);
160
+ // props.onValueChanged?.(expr)
161
+ // }}
162
+ // /> : <></>
163
+ // )
164
+ // }
157
165
  return (_jsxs(_Fragment, { children: [props.rows === undefined ?
158
- _jsx(TMTextBox, { buttons: renderButtons(), isModifiedWhen: props.value != props.valueOrig, label: props.label, value: Expression_IDs2Names(props.value) ?? '', validationItems: props.validationItems, onValueChanged: (e) => { props.onValueChanged?.(Expression_Names2IDs(e.target.value)); } })
166
+ _jsx(TMTextBox, { buttons: renderButtons(), formulaItems: props.formulaItems, isModifiedWhen: props.value != props.valueOrig, label: props.label, value: Expression_IDs2Names(props.value) ?? '', validationItems: props.validationItems, onValueChanged: (e) => { props.onValueChanged?.(Expression_Names2IDs(e.target.value)); } })
159
167
  :
160
- _jsx(TMTextArea, { buttons: renderButtons(), 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(), " ", openFormulaChooseForm()] }));
168
+ _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(), " "] }));
161
169
  };
162
170
  class MetatadaHelper {
163
171
  constructor(mid, metadataName) {
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import { DeviceType } from '../../base/TMDeviceProvider';
3
+ /**
4
+ * Proprietà del componente ToppyDraggableHelpCenter
5
+ */
6
+ interface ToppyDraggableHelpCenterProps {
7
+ /** Contenuto da visualizzare nella speech bubble */
8
+ content?: React.ReactNode;
9
+ /** Tipo di dispositivo per adattare il comportamento */
10
+ deviceType?: DeviceType;
11
+ /** Allineamento iniziale del componente (destra o sinistra) */
12
+ align?: 'right' | 'left';
13
+ /** Stato iniziale collassato/espanso */
14
+ initialIsCollapsed?: boolean;
15
+ /** Callback chiamato quando si clicca sull'immagine di Toppy */
16
+ onToppyImageClick?: () => void;
17
+ /** Visibilità del componente */
18
+ isVisible?: boolean;
19
+ }
20
+ /**
21
+ * Componente ToppyDraggableHelpCenter
22
+ *
23
+ * Renderizza un assistente virtuale (Toppy) draggable che può mostrare contenuti
24
+ * in una speech bubble. Il componente può essere trascinato all'interno del suo
25
+ * contenitore e può essere collassato/espanso con un doppio click.
26
+ */
27
+ declare const ToppyDraggableHelpCenter: React.FC<ToppyDraggableHelpCenterProps>;
28
+ export default ToppyDraggableHelpCenter;