@topconsultnpm/sdkui-react 6.20.0-dev1.99 → 6.20.0-dev2.10

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 (93) hide show
  1. package/lib/assets/headergradient.svg +87 -0
  2. package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +56 -18
  3. package/lib/components/NewComponents/ContextMenu/styles.js +13 -34
  4. package/lib/components/NewComponents/ContextMenu/types.d.ts +8 -2
  5. package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +315 -271
  6. package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +4 -0
  7. package/lib/components/NewComponents/FloatingMenuBar/styles.js +6 -2
  8. package/lib/components/NewComponents/FloatingMenuBar/types.d.ts +7 -4
  9. package/lib/components/base/TMButton.js +6 -0
  10. package/lib/components/base/TMClosableList.js +4 -0
  11. package/lib/components/base/TMDropDownMenu.js +2 -0
  12. package/lib/components/base/TMListView.js +1 -1
  13. package/lib/components/base/TMPanel.d.ts +1 -1
  14. package/lib/components/base/TMPanel.js +9 -5
  15. package/lib/components/base/TMPopUp.js +6 -0
  16. package/lib/components/base/TMToolbarCard.js +2 -0
  17. package/lib/components/base/TMTreeView.d.ts +2 -1
  18. package/lib/components/base/TMTreeView.js +33 -26
  19. package/lib/components/choosers/TMDataListItemChooser.d.ts +2 -0
  20. package/lib/components/choosers/TMDataListItemChooser.js +8 -2
  21. package/lib/components/choosers/TMDcmtTypeChooser.d.ts +1 -0
  22. package/lib/components/choosers/TMDcmtTypeChooser.js +11 -3
  23. package/lib/components/choosers/TMDistinctValues.js +2 -2
  24. package/lib/components/choosers/TMDynDataListItemChooser.d.ts +2 -0
  25. package/lib/components/choosers/TMDynDataListItemChooser.js +19 -8
  26. package/lib/components/choosers/TMMetadataChooser.d.ts +2 -0
  27. package/lib/components/choosers/TMMetadataChooser.js +11 -3
  28. package/lib/components/choosers/TMUserChooser.d.ts +2 -0
  29. package/lib/components/choosers/TMUserChooser.js +8 -2
  30. package/lib/components/editors/TMCheckBox.js +2 -0
  31. package/lib/components/editors/TMDateBox.js +18 -9
  32. package/lib/components/editors/TMEditorStyled.js +7 -0
  33. package/lib/components/editors/TMLocalizedTextBox.d.ts +3 -1
  34. package/lib/components/editors/TMLocalizedTextBox.js +16 -14
  35. package/lib/components/editors/TMMetadataEditor.d.ts +1 -0
  36. package/lib/components/editors/TMMetadataEditor.js +4 -4
  37. package/lib/components/editors/TMMetadataTextBox.d.ts +9 -0
  38. package/lib/components/editors/TMMetadataTextBox.js +92 -0
  39. package/lib/components/editors/TMMetadataValues.d.ts +2 -0
  40. package/lib/components/editors/TMMetadataValues.js +6 -4
  41. package/lib/components/editors/TMRadioButton.js +2 -0
  42. package/lib/components/editors/TMTextBox.d.ts +1 -1
  43. package/lib/components/editors/TMTextBox.js +23 -1
  44. package/lib/components/editors/TMTextExpression.js +6 -91
  45. package/lib/components/features/assistant/TMToppyDraggableHelpCenter.js +2 -0
  46. package/lib/components/features/documents/TMDcmtBlog.js +1 -1
  47. package/lib/components/features/documents/TMDcmtForm.js +126 -88
  48. package/lib/components/features/documents/TMDcmtPreview.js +92 -42
  49. package/lib/components/features/search/TMSearch.js +5 -1
  50. package/lib/components/features/search/TMSearchQueryEditor.d.ts +1 -0
  51. package/lib/components/features/search/TMSearchQueryEditor.js +10 -10
  52. package/lib/components/features/search/TMSearchQueryPanel.js +24 -10
  53. package/lib/components/features/search/TMSearchResult.js +198 -13
  54. package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +1 -1
  55. package/lib/components/features/search/TMSearchResultsMenuItems.js +24 -4
  56. package/lib/components/features/search/TMViewHistoryDcmt.js +45 -50
  57. package/lib/components/features/tasks/TMTaskForm.js +55 -24
  58. package/lib/components/features/tasks/TMTasksUtils.js +14 -1
  59. package/lib/components/features/workflow/TMWorkflowPopup.js +5 -4
  60. package/lib/components/features/workflow/diagram/DiagramItemComponent.js +2 -0
  61. package/lib/components/features/workflow/diagram/DiagramItemForm.js +1 -1
  62. package/lib/components/features/workflow/diagram/WFDiagram.js +1 -1
  63. package/lib/components/forms/Login/TMLoginForm.js +1 -1
  64. package/lib/components/grids/TMValidationItemsList.js +6 -0
  65. package/lib/components/index.d.ts +1 -0
  66. package/lib/components/index.js +1 -0
  67. package/lib/components/layout/panelManager/TMPanelManagerContainer.js +3 -2
  68. package/lib/components/layout/panelManager/TMPanelManagerContext.js +13 -5
  69. package/lib/components/query/TMQueryEditor.d.ts +4 -0
  70. package/lib/components/query/TMQueryEditor.js +14 -10
  71. package/lib/components/sidebar/TMHeader.js +11 -7
  72. package/lib/components/sidebar/TMSidebar.d.ts +0 -1
  73. package/lib/components/sidebar/TMSidebar.js +16 -44
  74. package/lib/components/sidebar/TMSidebarItem.js +36 -17
  75. package/lib/helper/SDKUI_Globals.d.ts +3 -0
  76. package/lib/helper/SDKUI_Globals.js +6 -3
  77. package/lib/helper/SDKUI_Localizator.d.ts +4 -16
  78. package/lib/helper/SDKUI_Localizator.js +37 -157
  79. package/lib/helper/TMIcons.d.ts +1 -0
  80. package/lib/helper/TMIcons.js +3 -0
  81. package/lib/helper/TMToppyMessage.js +4 -0
  82. package/lib/helper/TMUtils.d.ts +20 -1
  83. package/lib/helper/TMUtils.js +71 -1
  84. package/lib/helper/helpers.d.ts +27 -1
  85. package/lib/helper/helpers.js +107 -1
  86. package/lib/helper/queryHelper.d.ts +1 -1
  87. package/lib/helper/queryHelper.js +24 -1
  88. package/lib/hooks/useFloatingBarPinnedItems.d.ts +11 -0
  89. package/lib/hooks/useFloatingBarPinnedItems.js +54 -0
  90. package/lib/hooks/useMetadataExpression.d.ts +19 -0
  91. package/lib/hooks/useMetadataExpression.js +99 -0
  92. package/lib/ts/types.d.ts +3 -0
  93. package/package.json +55 -55
@@ -8,7 +8,7 @@ import TMSummary from '../editors/TMSummary';
8
8
  import TMChooserForm from '../forms/TMChooserForm';
9
9
  import TMButton from '../base/TMButton';
10
10
  import TMDataUserIdItemViewer from '../viewers/TMDataUserIdItemViewer';
11
- 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 }) => {
11
+ 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, updateIsModalOpen }) => {
12
12
  const [showChooser, setShowChooser] = useState(initialShowChooser);
13
13
  useEffect(() => {
14
14
  setShowChooser(initialShowChooser);
@@ -18,10 +18,16 @@ const TMUserChooser = ({ labelColor, titleForm, filter, readOnly = false, icon,
18
18
  const isPlaceholder = values?.[0] === placeHolder;
19
19
  return (_jsxs(StyledDivHorizontal, { style: { minWidth: '125px', color: isPlaceholder ? '#a9a9a9' : 'inherit' }, children: [values && values.length > 0 && _jsx(TMDataUserIdItemViewer, { userId: values?.[0], showIcon: true }), values && values.length > 1 && _jsx("p", { style: { marginLeft: '10px' }, children: `(+${values.length - 1} ${values.length == 2 ? 'altro' : 'altri'})` })] }));
20
20
  };
21
- 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 &&
21
+ 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: () => {
22
+ if (!readOnly) {
23
+ setShowChooser(true);
24
+ updateIsModalOpen?.(true);
25
+ }
26
+ }, elementStyle: elementStyle, isModifiedWhen: isModifiedWhen, openEditorOnSummaryClick: openChooserBySingleClick, label: label, template: renderTemplate(), onClearClick: showClearButton ? () => { onValueChanged?.([]); } : undefined, validationItems: validationItems }), showChooser &&
22
27
  _jsx(TMUserChooserForm, { title: titleForm, allowMultipleSelection: allowMultipleSelection, hasShowOnlySelectedItems: true, dataSource: dataSource, filter: filter, selectedIDs: values, hideRefresh: hideRefresh, hideShowId: hideShowId, allowShowAllUsers: allowShowAllUsers, onClose: () => {
23
28
  setShowChooser(false);
24
29
  summaryInputRef.current?.focus();
30
+ updateIsModalOpen?.(false);
25
31
  }, onChoose: (IDs) => { onValueChanged?.(IDs); } })] }));
26
32
  };
27
33
  export default TMUserChooser;
@@ -16,6 +16,8 @@ const StyledCheckBoxLabel = styled.div `
16
16
  color: ${props => !props.$disabled ? props.$isModifiedWhen ? TMColors.isModified : props.$labelColor ? props.$labelColor : TMColors.text_normal : TMColors.disabled};
17
17
  font-size: ${props => props.$fontSize};
18
18
  user-select: none;
19
+ -webkit-touch-callout: none;
20
+ -webkit-user-select: none;
19
21
  &:focus{
20
22
  outline: none;
21
23
  background-image: linear-gradient(white, #E4E9F7);
@@ -10,27 +10,36 @@ const TMDateBox = (props) => {
10
10
  let htmlElement = dateBoxRef?.current?.instance().element();
11
11
  if (!htmlElement)
12
12
  return;
13
- let color = props.isModifiedWhen ? TMColors.tertiary : TMColors.border_normal;
13
+ let borderColor = props.isModifiedWhen ? TMColors.tertiary : TMColors.border_normal;
14
+ let textColor = props.isModifiedWhen ? TMColors.isModified : TMColors.text_normal;
14
15
  let inputContainer = htmlElement.getElementsByClassName("dx-texteditor-input-container")[0];
15
16
  if (inputContainer) {
16
17
  inputContainer.style.background = props.readOnly ? 'linear-gradient(white 20%, #d6d6d6 80%)' : '';
17
- inputContainer.style.color = props.readOnly ? '#525252' : 'transparent';
18
+ inputContainer.style.color = props.readOnly ? '#525252' : textColor;
19
+ }
20
+ let input = htmlElement.querySelector(".dx-texteditor-input");
21
+ if (input) {
22
+ if (!props.readOnly) {
23
+ input.style.color = textColor;
24
+ }
25
+ input.style.fontSize = 'var(--base-font-size)';
26
+ input.style.fontFamily = 'var(--base-font-family)';
18
27
  }
19
28
  let label = htmlElement.getElementsByClassName("dx-label")[0];
20
29
  if (label) {
21
- label.style.borderBottomColor = color;
30
+ label.style.borderBottomColor = borderColor;
22
31
  }
23
32
  let labelBefore = htmlElement.getElementsByClassName("dx-label-before")[0];
24
33
  if (labelBefore) {
25
- labelBefore.style.borderBottomColor = color;
26
- labelBefore.style.borderTopColor = color;
27
- labelBefore.style.borderInlineStartColor = color;
34
+ labelBefore.style.borderBottomColor = borderColor;
35
+ labelBefore.style.borderTopColor = borderColor;
36
+ labelBefore.style.borderInlineStartColor = borderColor;
28
37
  }
29
38
  let labelAfter = htmlElement.getElementsByClassName("dx-label-after")[0];
30
39
  if (labelAfter) {
31
- labelAfter.style.borderBottomColor = color;
32
- labelAfter.style.borderTopColor = color;
33
- labelAfter.style.borderInlineEndColor = color;
40
+ labelAfter.style.borderBottomColor = borderColor;
41
+ labelAfter.style.borderTopColor = borderColor;
42
+ labelAfter.style.borderInlineEndColor = borderColor;
34
43
  }
35
44
  }, [props.isModifiedWhen, props.readOnly]);
36
45
  const dateBoxRef = useRef(null);
@@ -27,6 +27,9 @@ color: ${props => props.readOnly ? '#525252' : !props.$disabled ? (props.$vil.le
27
27
  border-radius: ${props => props.$borderRadius ?? TMEditorsDefaultBorderRadius};
28
28
  min-width: ${props => props.$isMobile && '70px'};
29
29
  background: ${props => props.readOnly ? 'linear-gradient(white 20%, #d6d6d6 80%)' : 'white'};
30
+ overflow: hidden;
31
+ text-overflow: ellipsis;
32
+ white-space: nowrap;
30
33
  &:focus{
31
34
  outline: none;
32
35
  background-image: linear-gradient(white, #E4E9F7);
@@ -48,6 +51,8 @@ export const StyledEditorIcon = styled.div `
48
51
  margin-right: 2px;
49
52
  font-size: 18px;
50
53
  user-select: none;
54
+ -webkit-touch-callout: none;
55
+ -webkit-user-select: none;
51
56
  transform: translateY(18px);
52
57
  `;
53
58
  export const StyledEditorLabel = styled.div `
@@ -55,6 +60,8 @@ export const StyledEditorLabel = styled.div `
55
60
  color:${props => !props.$disabled ? props.$isFocused ? TMColors.primary : props.$color ? props.$color : TMColors.label_normal : TMColors.disabled};
56
61
  padding: 0 3px;
57
62
  user-select: none;
63
+ -webkit-touch-callout: none;
64
+ -webkit-user-select: none;
58
65
  transform: ${props => props.$labelPosition === 'left' && 'translateY(5px)'};
59
66
  width: max-content;
60
67
  transform: translate(10px, 6px);
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { CultureIDs } from '@topconsultnpm/sdk-ts';
2
+ import { CultureIDs, QueryDescriptor } from '@topconsultnpm/sdk-ts';
3
3
  import { ValidationItem } from '@topconsultnpm/sdk-ts';
4
4
  export declare const getCultureIDImg: (cultureID: CultureIDs) => any;
5
5
  interface TMLocalizedTextBoxProps {
@@ -13,6 +13,8 @@ interface TMLocalizedTextBoxProps {
13
13
  value_ES?: string;
14
14
  value_DE?: string;
15
15
  validationItems?: ValidationItem[];
16
+ qd?: QueryDescriptor;
17
+ tid?: number;
16
18
  onValueChanged: (lang: CultureIDs, value: string) => void;
17
19
  }
18
20
  declare const TMLocalizedTextBox: React.FC<TMLocalizedTextBoxProps>;
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useRef, useState } from 'react';
3
3
  import styled from 'styled-components';
4
4
  import TMTextBox from './TMTextBox';
5
+ import TMMetadataTextBox from './TMMetadataTextBox';
5
6
  import { IconLanguage, SDKUI_Localizator } from '../../helper';
6
7
  import { CultureIDs } from '@topconsultnpm/sdk-ts';
7
8
  import it from '../../assets/italy.svg';
@@ -13,11 +14,9 @@ import pt from '../../assets/portugal.svg';
13
14
  import { createPortal } from 'react-dom';
14
15
  const Portal = ({ children, popoverRef }) => {
15
16
  const mount = document.body;
16
- // Usa un ref per l'elemento del portale per evitare di ricrearlo ad ogni render
17
17
  const elRef = useRef(document.createElement('div'));
18
18
  useEffect(() => {
19
19
  const el = elRef.current;
20
- // Assegna il ref al div del portale
21
20
  el.ref = popoverRef;
22
21
  mount.appendChild(el);
23
22
  return () => {
@@ -33,7 +32,7 @@ const LocalizedContainer = styled.div `
33
32
  const Popover = styled.div `
34
33
  display: ${props => props.$isVisible ? 'flex' : 'none'};
35
34
  flex-direction: column;
36
- position: fixed; /* Usa 'fixed' o 'absolute' a seconda del comportamento desiderato */
35
+ position: fixed;
37
36
  top: ${props => props.$top}px;
38
37
  left: ${props => props.$left}px;
39
38
  width: ${props => props.$width}px;
@@ -41,7 +40,7 @@ const Popover = styled.div `
41
40
  border-radius: 4px;
42
41
  background-color: #fff;
43
42
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
44
- z-index: 2000;
43
+ z-index: 1502;
45
44
  padding: 8px;
46
45
  `;
47
46
  const Badge = styled.span `
@@ -72,10 +71,10 @@ export const getCultureIDImg = (cultureID) => {
72
71
  default: return it;
73
72
  }
74
73
  };
75
- const TMLocalizedTextBox = ({ label, value, value_IT, value_EN, value_FR, value_PT, value_ES, value_DE, isModifiedWhen, validationItems, onValueChanged, }) => {
74
+ const TMLocalizedTextBox = ({ label, value, value_IT, value_EN, value_FR, value_PT, value_ES, value_DE, isModifiedWhen, validationItems, qd, tid, onValueChanged, }) => {
76
75
  const [isPopoverVisible, setIsPopoverVisible] = useState(false);
77
- const containerRef = useRef(null); // Riferimento al contenitore principale
78
- const popoverRef = useRef(null); // Riferimento per il Popover
76
+ const containerRef = useRef(null);
77
+ const popoverRef = useRef(null);
79
78
  const [popoverPosition, setPopoverPosition] = useState({ top: 0, left: 0, width: 0 });
80
79
  const languages = [
81
80
  { code: CultureIDs.It_IT, label: 'Italiano', value: value_IT },
@@ -85,13 +84,12 @@ const TMLocalizedTextBox = ({ label, value, value_IT, value_EN, value_FR, value_
85
84
  { code: CultureIDs.Es_ES, label: 'Español', value: value_ES },
86
85
  { code: CultureIDs.De_DE, label: 'Deutsch', value: value_DE },
87
86
  ];
88
- // Calcola il numero di lingue con valori non nulli o vuoti
89
87
  const localizedCount = languages.filter(lang => lang.value && lang.value.trim() !== '').length;
90
88
  const handleTogglePopover = () => {
91
89
  if (containerRef.current) {
92
90
  const rect = containerRef.current.getBoundingClientRect();
93
91
  setPopoverPosition({
94
- top: rect.bottom, // Posiziona sotto l'input
92
+ top: rect.bottom,
95
93
  left: rect.left,
96
94
  width: rect.width
97
95
  });
@@ -99,19 +97,23 @@ const TMLocalizedTextBox = ({ label, value, value_IT, value_EN, value_FR, value_
99
97
  setIsPopoverVisible(prev => !prev);
100
98
  };
101
99
  const handleClosePopover = () => setIsPopoverVisible(false);
102
- // Close popover when clicking outside
103
100
  useEffect(() => {
101
+ if (!isPopoverVisible)
102
+ return;
104
103
  const handleClickOutside = (event) => {
105
- if (isPopoverVisible &&
106
- containerRef.current &&
104
+ if (containerRef.current &&
107
105
  !containerRef.current.contains(event.target) &&
108
106
  popoverRef.current &&
109
107
  !popoverRef.current.contains(event.target)) {
110
108
  handleClosePopover();
111
109
  }
112
110
  };
113
- document.addEventListener("mousedown", handleClickOutside);
111
+ // Ritarda l'aggiunta del listener per evitare che catturi il click di apertura
112
+ const timeoutId = setTimeout(() => {
113
+ document.addEventListener("mousedown", handleClickOutside);
114
+ }, 0);
114
115
  return () => {
116
+ clearTimeout(timeoutId);
115
117
  document.removeEventListener("mousedown", handleClickOutside);
116
118
  };
117
119
  }, [isPopoverVisible]);
@@ -120,6 +122,6 @@ const TMLocalizedTextBox = ({ label, value, value_IT, value_EN, value_FR, value_
120
122
  icon: (_jsxs(IconContainer, { children: [_jsx(IconLanguage, {}), localizedCount > 0 && _jsx(Badge, { children: localizedCount })] })),
121
123
  onClick: handleTogglePopover,
122
124
  };
123
- return (_jsxs(LocalizedContainer, { ref: containerRef, children: [_jsx(TMTextBox, { type: "text", label: label, value: value, isModifiedWhen: isModifiedWhen, buttons: [localizationButton], validationItems: validationItems, 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) => (_jsx(TMTextBox, { label: `${lang.label}`, showClearButton: true, icon: _jsx("img", { src: getCultureIDImg(lang.code), alt: "Lang", width: 18, height: 18 }), value: lang.value || '', onValueChanged: (e) => onValueChanged(lang.code, e.target.value) }, lang.code))) }) }))] }));
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, onValueChanged: (e) => onValueChanged(CultureIDs.None, e.target.value) })) : (_jsx(TMTextBox, { type: "text", label: label, value: value, isModifiedWhen: isModifiedWhen, buttons: [localizationButton], validationItems: validationItems, 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, 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 || '', onValueChanged: (e) => onValueChanged(lang.code, e.target.value) }, lang.code)))) }) }))] }));
124
126
  };
125
127
  export default TMLocalizedTextBox;
@@ -23,6 +23,7 @@ interface ITMMetadataEditorProps {
23
23
  onValueChange?: (value: any) => void;
24
24
  onCascadeRefreshDynDataLists?: (dynDataListsToBeRefreshed: DynDataListsToBeRefreshed[]) => void;
25
25
  onCascadeUpdateMIDs?: (midsToBeUpdated: MIDsToBeUpdated[]) => void;
26
+ updateIsModalOpen?: (isOpen: boolean) => void;
26
27
  }
27
28
  declare const TMMetadataEditor: React.FC<ITMMetadataEditorProps>;
28
29
  export default TMMetadataEditor;
@@ -37,7 +37,7 @@ const getDateDisplayType = (format) => {
37
37
  default: return DateDisplayTypes.Date;
38
38
  }
39
39
  };
40
- const TMMetadataEditor = ({ isSelected = false, customLabel, isReadOnly, isLexProt, layoutMode, queryOperator, isEditable, isModifiedWhen = false, tid, mid, value, queryParamsDynDataList, containerElement, autoFocus, validationItems = [], disabled = false, openChooserBySingleClick = true, onValueChanged, onValueChange, onCascadeRefreshDynDataLists, onCascadeUpdateMIDs }) => {
40
+ const TMMetadataEditor = ({ isSelected = false, customLabel, isReadOnly, isLexProt, layoutMode, queryOperator, isEditable, isModifiedWhen = false, tid, mid, value, queryParamsDynDataList, containerElement, autoFocus, validationItems = [], disabled = false, openChooserBySingleClick = true, onValueChanged, onValueChange, onCascadeRefreshDynDataLists, onCascadeUpdateMIDs, updateIsModalOpen }) => {
41
41
  const [md, setMd] = useState();
42
42
  useEffect(() => {
43
43
  // Passiamo did = undefined, perché è già in cache
@@ -84,21 +84,21 @@ const TMMetadataEditor = ({ isSelected = false, customLabel, isReadOnly, isLexPr
84
84
  onValueChanged?.(undefined);
85
85
  else
86
86
  onValueChanged?.(IDs[0]);
87
- } });
87
+ }, updateIsModalOpen: updateIsModalOpen });
88
88
  if (md?.dataDomain == MetadataDataDomains.DataList)
89
89
  return _jsx(TMDataListItemChooser, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', titleForm: md.nameLoc, readOnly: isReadOnlyResult, isModifiedWhen: isModifiedWhenInternal(), label: (modulesWithLabelTop || showLabelTop) ? (customLabel ?? md?.nameLoc) : undefined, icon: showLabelTop ? icon : undefined, validationItems: validationItems, disabled: disabled, elementStyle: { width: '100%' }, backgroundColor: TMColors.default_background, dataListId: md.dataListID, openChooserBySingleClick: openChooserBySingleClick, allowMultipleSelection: multipleSelectionIsenabled, values: value?.split(',').map((item) => !item.startsWith("'") ? item : item.slice(1, -1)) ?? [], showClearButton: !isReadOnlyResult, onValueChanged: (IDs) => {
90
90
  if (!IDs || IDs.length <= 0)
91
91
  onValueChanged?.(undefined);
92
92
  else
93
93
  onValueChanged?.(IDs.join(","));
94
- } });
94
+ }, updateIsModalOpen: updateIsModalOpen });
95
95
  if (md?.dataDomain == MetadataDataDomains.UserID)
96
96
  return _jsx(TMUserChooser, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', titleForm: md.nameLoc, readOnly: isReadOnlyResult, isModifiedWhen: isModifiedWhenInternal(), label: (modulesWithLabelTop || showLabelTop) ? (customLabel ?? md?.nameLoc) : undefined, icon: showLabelTop ? icon : undefined, validationItems: validationItems, disabled: disabled, elementStyle: { width: '100%' }, openChooserBySingleClick: openChooserBySingleClick, backgroundColor: TMColors.default_background, showClearButton: !isReadOnlyResult, allowMultipleSelection: multipleSelectionIsenabled, values: value?.split(',').map((item) => !item.startsWith("'") ? Number(item) : Number(item.slice(1, -1))) ?? [], onValueChanged: (IDs) => {
97
97
  if (!IDs || IDs.length <= 0)
98
98
  onValueChanged?.(undefined);
99
99
  else
100
100
  onValueChanged?.(IDs.join(","));
101
- } });
101
+ }, updateIsModalOpen: updateIsModalOpen });
102
102
  if (showAsText)
103
103
  return _jsx(TMTextBox, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', isModifiedWhen: isModifiedWhenInternal(), readOnly: isReadOnlyResult, label: (modulesWithLabelTop || showLabelTop) ? (customLabel ?? md?.nameLoc) : undefined, icon: showLabelTop ? icon : undefined, validationItems: validationItems, disabled: disabled, elementStyle: { width: '100%' }, type: 'text', showClearButton: !isReadOnlyResult, maxLength: maxLength, autoFocus: autoFocus, value: value ?? '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => onValueChanged?.(newValue) });
104
104
  if (showAsNumber)
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { QueryDescriptor } from '@topconsultnpm/sdk-ts';
3
+ import type { ITMTextBox } from './TMTextBox';
4
+ interface ITMMetadataTextBox extends ITMTextBox {
5
+ qd?: QueryDescriptor;
6
+ tid?: number;
7
+ }
8
+ declare const TMMetadataTextBox: React.FC<ITMMetadataTextBox>;
9
+ export default TMMetadataTextBox;
@@ -0,0 +1,92 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useMemo } from 'react';
3
+ import TMTextBox from './TMTextBox';
4
+ import TMContextMenu from '../NewComponents/ContextMenu/TMContextMenu';
5
+ import { useMetadataExpression } from '../../hooks/useMetadataExpression';
6
+ const TMMetadataTextBox = (props) => {
7
+ const { metadatas_Info_Source, Expression_IDs2Names, Expression_Names2IDs } = useMetadataExpression({
8
+ qd: props.qd,
9
+ tid: props.tid
10
+ });
11
+ const insertAtCursor = (textToInsert) => {
12
+ const currentValue = Expression_IDs2Names(props.value) || '';
13
+ let newValue = currentValue;
14
+ let cursorPosition = currentValue.length;
15
+ const activeElement = document.activeElement;
16
+ if (activeElement && activeElement.tagName === 'INPUT' && activeElement.selectionStart !== null) {
17
+ const start = activeElement.selectionStart || 0;
18
+ const end = activeElement.selectionEnd || 0;
19
+ newValue =
20
+ currentValue.substring(0, start) +
21
+ textToInsert +
22
+ currentValue.substring(end);
23
+ cursorPosition = start + textToInsert.length;
24
+ }
25
+ else {
26
+ newValue = currentValue + textToInsert;
27
+ cursorPosition = newValue.length;
28
+ }
29
+ const syntheticEvent = {
30
+ target: { value: Expression_Names2IDs(newValue) }
31
+ };
32
+ props.onValueChanged?.(syntheticEvent);
33
+ setTimeout(() => {
34
+ const activeElement = document.activeElement;
35
+ if (activeElement && activeElement.tagName === 'INPUT') {
36
+ activeElement.setSelectionRange(cursorPosition, cursorPosition);
37
+ activeElement.focus();
38
+ }
39
+ }, 0);
40
+ };
41
+ // Crea i menu items per il context menu
42
+ const contextMenuItems = useMemo(() => {
43
+ // Separa metadati di sistema (Mid < 100) da quelli normali
44
+ const systemMetadata = metadatas_Info_Source.filter(mh => mh.Mid < 100);
45
+ const normalMetadata = metadatas_Info_Source.filter(mh => mh.Mid >= 100);
46
+ const items = [];
47
+ // Aggiungi metadati normali
48
+ normalMetadata.forEach(mh => {
49
+ items.push({
50
+ name: mh.MetadataName,
51
+ onClick: () => insertAtCursor(`{@${mh.MetadataName}}`)
52
+ });
53
+ });
54
+ // Aggiungi sottomenu per metadati di sistema se presenti
55
+ if (systemMetadata.length > 0) {
56
+ items.push({
57
+ name: 'Metadati di sistema',
58
+ beginGroup: normalMetadata.length > 0, // Separatore se ci sono anche metadati normali
59
+ submenu: systemMetadata.map(mh => ({
60
+ name: mh.MetadataName,
61
+ onClick: () => insertAtCursor(`{@${mh.MetadataName}}`)
62
+ }))
63
+ });
64
+ }
65
+ return items;
66
+ }, [metadatas_Info_Source, props.value]);
67
+ const renderButtons = () => {
68
+ const customButtons = [];
69
+ // Aggiungi eventuali bottoni custom passati via props
70
+ if (props.buttons) {
71
+ customButtons.push(...props.buttons);
72
+ }
73
+ return customButtons;
74
+ };
75
+ const handleValueChanged = (e) => {
76
+ const syntheticEvent = {
77
+ ...e,
78
+ target: {
79
+ ...e.target,
80
+ value: Expression_Names2IDs(e.target.value) || ''
81
+ }
82
+ };
83
+ props.onValueChanged?.(syntheticEvent);
84
+ };
85
+ // Se non ci sono metadati (qd o tid non specificati), usa TMTextBox normale
86
+ if (!props.qd && !props.tid) {
87
+ return (_jsx(TMTextBox, { ...props, buttons: renderButtons(), value: Expression_IDs2Names(props.value) ?? '', onValueChanged: handleValueChanged }));
88
+ }
89
+ // Altrimenti, wrappa TMTextBox con TMContextMenu
90
+ return (_jsx(TMContextMenu, { items: contextMenuItems, trigger: "right", children: _jsx(TMTextBox, { ...props, buttons: renderButtons(), value: Expression_IDs2Names(props.value) ?? '', onValueChanged: handleValueChanged }) }));
91
+ };
92
+ export default TMMetadataTextBox;
@@ -41,6 +41,8 @@ interface ITMMetadataValuesProps extends DeviceContextProps {
41
41
  onAdvancedMenuClick?: (e: AdvancedMenuClickEventArgs) => void;
42
42
  onValueChanged?: (mid: MetadataValueDescriptorEx[]) => void;
43
43
  onFocusedItemChanged?: (mid: MetadataValueDescriptorEx | undefined) => void;
44
+ updateIsModalOpen?: (isOpen: boolean) => void;
45
+ isReadOnlyOrigin?: boolean;
44
46
  }
45
47
  declare const TMMetadataValues: React.FC<ITMMetadataValuesProps>;
46
48
  export default TMMetadataValues;
@@ -14,6 +14,7 @@ import { ChronologyMIDs, DraftsMIDs, DSAttachsMIDs } from "../../ts";
14
14
  import { TMNothingToShow } from "../features/documents/TMDcmtPreview";
15
15
  import TMAccordion from "../base/TMAccordion";
16
16
  import TabPanel, { Item } from 'devextreme-react/tab-panel';
17
+ import { TMExceptionBoxManager } from "../base/TMPopUp";
17
18
  export var ShowCheckBoxesMode;
18
19
  (function (ShowCheckBoxesMode) {
19
20
  ShowCheckBoxesMode[ShowCheckBoxesMode["Never"] = 0] = "Never";
@@ -27,7 +28,7 @@ export var AdvancedMenuButtons;
27
28
  AdvancedMenuButtons[AdvancedMenuButtons["FormulaEditor"] = 2] = "FormulaEditor";
28
29
  AdvancedMenuButtons[AdvancedMenuButtons["DistinctValues"] = 3] = "DistinctValues";
29
30
  })(AdvancedMenuButtons || (AdvancedMenuButtons = {}));
30
- const TMMetadataValues = ({ showCheckBoxes = ShowCheckBoxesMode.Never, checkPerms = true, isReadOnly = false, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, customMenuItems = [], showNullValueCheckBoxes, isOpenDistinctValues = false, openChooserBySingleClick, selectedMID, onFocusedItemChanged, layoutMode = LayoutModes.Update, metadataValues = [], metadataValuesOrig = [], TID, onValueChanged, onAdvancedMenuClick, validationItems, inputMids = [], layout }) => {
31
+ const TMMetadataValues = ({ showCheckBoxes = ShowCheckBoxesMode.Never, checkPerms = true, isReadOnly = false, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, customMenuItems = [], showNullValueCheckBoxes, isOpenDistinctValues = false, openChooserBySingleClick, selectedMID, onFocusedItemChanged, layoutMode = LayoutModes.Update, metadataValues = [], metadataValuesOrig = [], TID, onValueChanged, onAdvancedMenuClick, validationItems, inputMids = [], layout, updateIsModalOpen, isReadOnlyOrigin = false }) => {
31
32
  const [dynDataListsToBeRefreshed, setDynDataListsToBeRefreshed] = useState([]);
32
33
  const [currentDTD, setCurrentDTD] = useState();
33
34
  const [isEditableList, addOrRemoveEditableList] = useMetadataEditableList();
@@ -165,7 +166,8 @@ const TMMetadataValues = ({ showCheckBoxes = ShowCheckBoxesMode.Never, checkPerm
165
166
  if (!d)
166
167
  return;
167
168
  let toBeRefreshed = [];
168
- let dynDlDataSource = await SDK_Globals.tmSession?.NewSearchEngine().GetDynDataListValuesAsync(tid, mid, layoutMode, qParams);
169
+ let dynDlDataSource = await SDK_Globals.tmSession?.NewSearchEngine().GetDynDataListValuesAsync(tid, mid, layoutMode, qParams)
170
+ .catch((err) => { TMExceptionBoxManager.show({ exception: err }); });
169
171
  if (!d.onValueChanged_DynDataListsToBeRefreshed)
170
172
  return;
171
173
  let row = dynDlDataSource?.dtdResult?.rows?.filter(o => o[d.selectItemForValue ?? 0] == value);
@@ -280,7 +282,7 @@ const TMMetadataValues = ({ showCheckBoxes = ShowCheckBoxesMode.Never, checkPerm
280
282
  mdItem.value = item.value;
281
283
  }
282
284
  onValueChanged?.(newMetadata);
283
- } }), FormulaHelper.isFormula(item.value)
285
+ }, updateIsModalOpen: updateIsModalOpen }), FormulaHelper.isFormula(item.value)
284
286
  ? _jsx(IconFunction, { color: "#1a89d3", fontSize: 14, style: { position: "absolute", top: item.md?.dataType === MetadataDataTypes.DateTime ? '3px' : '5px', left: '14px' } })
285
287
  : (isEditable(item.mid) || item.isEditable)
286
288
  ? _jsx(IconPencil, { color: "#138603", fontSize: 14, style: { position: "absolute", top: item.md?.dataType === MetadataDataTypes.DateTime ? '3px' : '5px', left: '16px' } })
@@ -298,7 +300,7 @@ const TMMetadataValues = ({ showCheckBoxes = ShowCheckBoxesMode.Never, checkPerm
298
300
  mvd.isSelected = !stringIsNullOrEmpty(mvd.value);
299
301
  }
300
302
  onValueChanged?.(newValues);
301
- } }) }), !isReadOnly && _jsx("div", { style: { marginTop: item.md?.dataType === MetadataDataTypes.DateTime ? '12px' : '18px' }, onClick: () => { handleMetadataValueSelection(item); }, children: _jsx(TMDropDownMenu, { backgroundColor: 'white', color: TMColors.button_icon, borderRadius: '3px', content: _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconMenuVertical, {}), showTooltip: false }), disabled: item.isLexProt === 1, items: getAdvancedMenuItems(item) }) })] }, item.mid)), [TID, showCheckBoxes, showNullValueCheckBoxes, isReadOnly, layoutMode, selectedMID, isOpenDistinctValues, openChooserBySingleClick, dynDataListsToBeRefreshed, metadataValues, metadataValuesOrig, validationItems, onValueChanged, handleMetadataValueSelection, getAdvancedMenuItems, onChangeHandler, editorValidationHandler, isEditable]);
303
+ } }) }), (!isReadOnly && !isReadOnlyOrigin) && _jsx("div", { style: { marginTop: item.md?.dataType === MetadataDataTypes.DateTime ? '12px' : '18px' }, onClick: () => { handleMetadataValueSelection(item); }, children: _jsx(TMDropDownMenu, { backgroundColor: 'white', color: TMColors.button_icon, borderRadius: '3px', content: _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconMenuVertical, {}), showTooltip: false }), disabled: item.isLexProt === 1, items: getAdvancedMenuItems(item) }) })] }, item.mid)), [TID, showCheckBoxes, showNullValueCheckBoxes, isReadOnly, isReadOnlyOrigin, layoutMode, selectedMID, isOpenDistinctValues, openChooserBySingleClick, dynDataListsToBeRefreshed, metadataValues, metadataValuesOrig, validationItems, onValueChanged, handleMetadataValueSelection, getAdvancedMenuItems, onChangeHandler, editorValidationHandler, isEditable]);
302
304
  const layoutWorkItem = useMemo(() => {
303
305
  const workItemData = [];
304
306
  const technicalWorkItemData = [];
@@ -39,6 +39,8 @@ const StyledradioButtonLabel = styled.label `
39
39
  font-size: ${props => props.$fontSize};
40
40
  color: ${props => !props.$disabled ? props.$isModifiedWhen ? TMColors.isModified : TMColors.text_normal : TMColors.disabled};
41
41
  user-select: none;
42
+ -webkit-touch-callout: none;
43
+ -webkit-user-select: none;
42
44
  width: 100%;
43
45
  cursor: ${props => !props.$disabled && 'pointer'};
44
46
  &:focus{
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { ITMEditorBase } from '../base/TMEditorBase';
3
3
  export type TextBoxType = 'text' | 'email' | 'password' | 'number' | 'secureText';
4
- interface ITMTextBox extends ITMEditorBase {
4
+ export interface ITMTextBox extends ITMEditorBase {
5
5
  autoFocus?: boolean;
6
6
  formulaItems?: string[];
7
7
  maxValue?: number;
@@ -256,13 +256,35 @@ const TMTextBox = ({ autoFocus, maxLength, labelColor, precision, fromModal = fa
256
256
  ? bulletEntity.repeat(currentValue?.length ?? 0)
257
257
  : currentValue ?? '')
258
258
  : currentValue ?? '';
259
+ // Calcola il padding-right necessario per evitare sovrapposizione con i bottoni
260
+ const calculateRightPadding = () => {
261
+ if (initialType === 'password')
262
+ return 10; // Solo l'icona show/hide password
263
+ let buttonCount = 0;
264
+ if (formulaItems.length > 0)
265
+ buttonCount++; // IconDataList
266
+ if (showClearButton && currentValue)
267
+ buttonCount++; // IconClearButton
268
+ buttonCount += buttons.length; // Custom buttons
269
+ if (currentType === 'number') {
270
+ // Per i number, non aggiungiamo padding-right perché le freccette native
271
+ // occupano già spazio. Se ci sono bottoni custom a sinistra delle freccette,
272
+ // il loro posizionamento assoluto (right: 25px) li gestisce correttamente
273
+ return 4; // Padding minimo
274
+ }
275
+ else {
276
+ // Per gli altri tipi, calcolo normale
277
+ const buttonWidth = 28;
278
+ return 6 + (buttonCount * buttonWidth) + 8;
279
+ }
280
+ };
259
281
  return (_jsxs("div", { style: { width: '100%', height: 'fit-content' }, id: `text-${id}`, children: [_jsx(StyledEditor, { ref: inputRef, id: `text-${label}-${id}`, name: label, autoFocus: autoFocus, readOnly: readOnly, type: currentType, disabled: disabled, value: displayedValue, width: width || '100%', placeholder: placeHolder, maxLength: maxLength, autoComplete: 'off', spellCheck: false, onFocus: () => setIsFocused(true), onBlur: (e) => { setIsFocused(false); if (currentValue != value)
260
282
  onBlur?.(currentValue); }, onChange: handleInputChange, onKeyDown: (e) => {
261
283
  if (currentType === 'number') {
262
284
  if (!scale && (e.key == "." || e.key == ","))
263
285
  e.preventDefault();
264
286
  }
265
- }, "$isMobile": deviceType === DeviceType.MOBILE, "$disabled": disabled, "$vil": validationItems, "$isModified": isModifiedWhen, "$fontSize": fontSize, "$maxValue": maxValue, "$width": width, "$type": currentType, "$borderRadius": borderRadius }), (initialType === 'password' || initialType === 'secureText') && _jsx(StyledShowPasswordIcon, { onClick: toggleShowPassword, "$disabled": disabled, "$vil": validationItems, "$isModified": isModifiedWhen, children: showPasswordIcon() }), initialType !== 'password' &&
287
+ }, "$isMobile": deviceType === DeviceType.MOBILE, "$disabled": disabled, "$vil": validationItems, "$isModified": isModifiedWhen, "$fontSize": fontSize, "$maxValue": maxValue, "$width": width, "$type": currentType, "$borderRadius": borderRadius, style: { paddingRight: `${calculateRightPadding()}px` } }), (initialType === 'password' || initialType === 'secureText') && _jsx(StyledShowPasswordIcon, { onClick: toggleShowPassword, "$disabled": disabled, "$vil": validationItems, "$isModified": isModifiedWhen, children: showPasswordIcon() }), initialType !== 'password' &&
266
288
  _jsxs("div", { style: { display: 'flex', flexDirection: 'row', justifyContent: 'flex-start', alignItems: 'center', position: 'absolute', right: type === 'number' ? '25px' : '6px', top: label.length > 0 ? '20px' : '3px', pointerEvents: disabled ? 'none' : 'auto', opacity: disabled ? 0.4 : 1 }, children: [formulaItems.length > 0 &&
267
289
  _jsx(StyledTextBoxEditorButton, { onClick: () => {
268
290
  setShowFormulaItemsChooser(true);
@@ -1,96 +1,17 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useMemo, useState } from 'react';
3
- import { DcmtTypeListCacheService } from '@topconsultnpm/sdk-ts';
2
+ import { useMemo, useState } from 'react';
4
3
  import { IconClear, IconColumns, SDKUI_Localizator, stringIsNullOrEmpty } from '../../helper';
5
- import { TMExceptionBoxManager } from '../base/TMPopUp';
6
4
  import { TMMetadataChooserForm } from '../choosers/TMMetadataChooser';
7
5
  import TMTextBox from './TMTextBox';
8
6
  import TMTextArea from './TMTextArea';
7
+ import { useMetadataExpression } from '../../hooks/useMetadataExpression';
9
8
  const TMTextExpression = (props) => {
10
- const [metadatas_Info_Source, setMetadatas_Info_Source] = useState([]);
9
+ const { metadatas_Info_Source, Expression_IDs2Names, Expression_Names2IDs } = useMetadataExpression({
10
+ qd: props.qd,
11
+ tid: props.tid
12
+ });
11
13
  const [showMetadataChooser, setShowMetadataChooser] = useState(false);
12
14
  const [showFormulaChooser, setShowFormulaChooser] = useState(false);
13
- useEffect(() => { MetadataInfos_Source_Get_Async(); }, [props.qd]);
14
- useEffect(() => { MetadataInfos_Source_GetByTID_Async(); }, [props.tid]);
15
- async function MetadataInfos_Source_Get_Async() {
16
- if (!props.qd?.select)
17
- return;
18
- let mhs_source = [];
19
- try {
20
- let dtd_source;
21
- let md_source;
22
- let tid_source = -1;
23
- let si;
24
- let sis = props.qd?.select?.slice();
25
- sis = sis.slice().sort((a, b) => a.tid - b.tid);
26
- for (si of sis) {
27
- if (si.tid == undefined || si.mid == undefined)
28
- continue;
29
- if (tid_source != si.tid) {
30
- dtd_source = await DcmtTypeListCacheService.GetAsync(si.tid, true);
31
- if (dtd_source == undefined)
32
- continue;
33
- tid_source = si.tid;
34
- }
35
- if (dtd_source?.metadata == undefined)
36
- continue;
37
- md_source = dtd_source.metadata.find(o => o.id == si.mid);
38
- if (md_source?.name == undefined)
39
- continue;
40
- if (tid_source == undefined)
41
- continue;
42
- mhs_source.push(new MetatadaHelper(si.mid, md_source.name));
43
- }
44
- }
45
- catch (e) {
46
- TMExceptionBoxManager.show({ exception: e, title: 'MetadataInfos_Source_Get_Async' });
47
- }
48
- setMetadatas_Info_Source(mhs_source);
49
- }
50
- async function MetadataInfos_Source_GetByTID_Async() {
51
- if (!props.tid)
52
- return;
53
- let mhs_source = [];
54
- try {
55
- let dtd_source = await DcmtTypeListCacheService.GetAsync(props.tid, true);
56
- if (dtd_source == undefined)
57
- return;
58
- if (dtd_source?.metadata == undefined)
59
- return;
60
- for (let md_source of dtd_source?.metadata) {
61
- if (md_source?.name == undefined)
62
- continue;
63
- if (md_source?.id == undefined)
64
- continue;
65
- mhs_source.push(new MetatadaHelper(md_source.id, md_source.name));
66
- }
67
- }
68
- catch (e) {
69
- TMExceptionBoxManager.show({ exception: e, title: 'MetadataInfos_Source_GetByTID_Async' });
70
- }
71
- setMetadatas_Info_Source(mhs_source);
72
- }
73
- function Expression_IDs2Names(expression) {
74
- if (expression == undefined)
75
- return expression;
76
- let temp = expression.slice();
77
- let mh;
78
- for (mh of metadatas_Info_Source) {
79
- temp = temp.replaceAll(`{@${mh.Mid}}`, `{@${mh.MetadataName}}`);
80
- }
81
- temp = temp.replaceAll("{@1}", "{@DID}");
82
- return temp;
83
- }
84
- function Expression_Names2IDs(expression) {
85
- if (expression == undefined)
86
- return expression;
87
- let temp = expression.slice();
88
- let mh;
89
- for (mh of metadatas_Info_Source)
90
- temp = temp.replaceAll(`{@${mh.MetadataName}}`, `{@${mh.Mid}}`);
91
- temp = temp.replaceAll("{@DID}", "{@1}");
92
- return temp;
93
- }
94
15
  const renderButtons = () => {
95
16
  let buttons = [];
96
17
  if (props.qd || props.tid)
@@ -167,12 +88,6 @@ const TMTextExpression = (props) => {
167
88
  :
168
89
  _jsx(TMTextArea, { buttons: renderButtons(), formulaItems: props.formulaItems, isModifiedWhen: props.value != props.valueOrig, label: props.label, rows: props.rows, resize: false, placeHolder: props.placeHolder, value: Expression_IDs2Names(props.value) ?? '', validationItems: props.validationItems, onValueChanged: (e) => { props.onValueChanged?.(Expression_Names2IDs(e.target.value)); } }), openMetadataChooseForm(), " "] }));
169
90
  };
170
- class MetatadaHelper {
171
- constructor(mid, metadataName) {
172
- this.Mid = mid;
173
- this.MetadataName = metadataName;
174
- }
175
- }
176
91
  export class FormulaItemHelper {
177
92
  constructor() {
178
93
  this.id = 0;
@@ -67,6 +67,8 @@ const TMToppyButton = styled.div.attrs((props) => ({
67
67
  padding: 0;
68
68
  outline: none;
69
69
  user-select: none;
70
+ -webkit-touch-callout: none;
71
+ -webkit-user-select: none;
70
72
  transition: background-color 0.3s ease, border 0.3s ease, border-radius 0.3s ease, box-shadow 0.3s ease, width 0.3s ease, height 0.3s ease;
71
73
 
72
74
  img {