@topconsultnpm/sdkui-react 6.19.0-dev2.32 → 6.19.0-dev2.34

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.
@@ -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,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;
@@ -37,6 +39,8 @@ 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();
@@ -73,6 +77,30 @@ const TMTextArea = (props) => {
73
77
  setFormulaMenuItems(menuItems);
74
78
  }
75
79
  }, [formulaItems]);
80
+ function getFormulaDataSorce() {
81
+ let fiarray = [];
82
+ if (!formulaItems)
83
+ return [];
84
+ let i = 0;
85
+ for (const f of formulaItems) {
86
+ let fi = new FormulaItemHelper();
87
+ fi.id = i;
88
+ fi.paramName = f;
89
+ fiarray.push(fi);
90
+ i++;
91
+ }
92
+ return fiarray;
93
+ }
94
+ const openFormulaItemsChooser = () => {
95
+ return (showFormulaItemsChooser ?
96
+ _jsx(TMChooserForm, { title: SDKUI_Localizator.Parameters, height: '350', width: '300', hasShowId: false, showDefaultColumns: false, allowMultipleSelection: true, columns: [
97
+ { dataField: 'paramName', caption: SDKUI_Localizator.Name, dataType: 'string', sortOrder: 'asc', alignment: 'left' }
98
+ ], dataSource: getFormulaDataSorce(), onClose: () => { setShowFormulaItemsChooser(false); }, onChoose: (IDs) => {
99
+ let expr = value?.toString() ?? '';
100
+ IDs.map(i => expr += formulaItems[i]);
101
+ onValueChanged?.({ target: { value: expr } });
102
+ } }) : _jsx(_Fragment, {}));
103
+ };
76
104
  // Adjust the rows dynamically
77
105
  const updateRows = () => {
78
106
  const newRowCount = calculateRows(currentValue);
@@ -136,7 +164,10 @@ const TMTextArea = (props) => {
136
164
  const y = e.clientY - bounds.top;
137
165
  // set the x and y coordinates of our users right click
138
166
  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 &&
167
+ }, "$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 &&
168
+ _jsx(StyledTextAreaEditorButton, { onClick: () => {
169
+ setShowFormulaItemsChooser(true);
170
+ }, children: _jsx(IconDataList, {}) }), showClearButton && currentValue &&
140
171
  _jsx(StyledTextAreaEditorButton, { onClick: () => {
141
172
  onValueChanged?.({ target: { value: undefined } });
142
173
  setCurrentValue('');
@@ -144,7 +175,7 @@ const TMTextArea = (props) => {
144
175
  onBlur?.(undefined);
145
176
  }, children: _jsx(IconClearButton, {}) }), buttons.map((buttonItem, index) => {
146
177
  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 })] });
178
+ })] }), openFormulaItemsChooser(), formulaItems.length > 0 && clicked && (_jsx(TMContextMenu, { menuData: formulaMenuItems, top: points.y, left: points.x, onMenuItemClick: (formula) => insertText(formula) })), _jsx(TMVilViewer, { vil: validationItems })] });
148
179
  };
149
180
  // Layout for the textarea with a left-aligned label
150
181
  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) {
@@ -57,7 +57,7 @@ const TMDcmtBlog = ({ blogsDatasource, setBlogsDatasource, hasLoadedDataOnce, se
57
57
  isRefreshEnabled: true,
58
58
  isRestoreEnabled: true,
59
59
  isCreateContextualTask: false
60
- }, externalBlogPost: externalBlogPost, resetExternalBlogPost: resetExternalBlogPost, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }) }) }) }), (showCommentForm && tid && did) && _jsx(TMBlogCommentForm, { context: { engine: 'SearchEngine', object: { tid, did } }, onClose: () => setShowCommentForm(false), refreshCallback: refreshCallback, participants: [], showAttachmentsSection: false, allArchivedDocumentsFileItems: [], onFilterCreated: handleFilterCreated })] }));
60
+ }, externalBlogPost: externalBlogPost, resetExternalBlogPost: resetExternalBlogPost, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, afterTaskSaved: refreshCallback }) }) }) }), (showCommentForm && tid && did) && _jsx(TMBlogCommentForm, { context: { engine: 'SearchEngine', object: { tid, did } }, onClose: () => setShowCommentForm(false), refreshCallback: refreshCallback, participants: [], showAttachmentsSection: false, allArchivedDocumentsFileItems: [], onFilterCreated: handleFilterCreated })] }));
61
61
  };
62
62
  export default TMDcmtBlog;
63
63
  const StyledContainer = styled.div ` user-select: none; overflow: hidden; background-color: #ffffff; width: calc(100%); height: calc(100%); display: flex; gap: 10px; `;
@@ -987,7 +987,7 @@ const TMSearchResultGrid = ({ openInOffice, inputFocusedItem, showSearch, allowM
987
987
  width: 50,
988
988
  cellRender: (cellData) => renderDcmtIcon(cellData, onDownloadDcmtsAsync, openInOffice),
989
989
  allowResizing: false,
990
- filterOperations: ['=']
990
+ filterOperations: ['=', "anyof"]
991
991
  },
992
992
  ...columns.filter(col => col.dataField !== 'FILEEXT')
993
993
  ];
@@ -163,7 +163,7 @@ const TMTaskForm = (props) => {
163
163
  newTaskDescriptor.isNew = 0;
164
164
  editTaskCallback(newTaskDescriptor);
165
165
  }
166
- else if (formDataOrig && formMode === FormModes.Create && taskContext?.dossier && currentTask) {
166
+ else if (formDataOrig && formMode === FormModes.Create && taskContext?.dossier && taskContext?.dossier?.origin === 'DossierAction' && currentTask) {
167
167
  setFieldsReadOnly({
168
168
  name: true,
169
169
  description: false,
@@ -378,7 +378,7 @@ const TMTaskForm = (props) => {
378
378
  if (formData.pdG !== PdGs.None)
379
379
  e.currentTarget.style.backgroundColor = '#f5f5f7';
380
380
  }, children: [_jsx("span", { style: { display: 'flex', alignItems: 'center' }, children: getPdgsIconMap().get(formData.pdG) }), _jsx("span", { children: getOriginLabel(formData.pdG, formData.iD1Name) })] }) }) }) }) })), _jsx(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: 'flex', flexDirection: 'row', width: '100%', gap: 10 }, children: children }), children: _jsx("div", { style: { width: isMobile ? '100%' : '50%' }, children: _jsx(TMTextBox, { label: SDKUI_Localizator.Name, value: formData?.name ?? '', readOnly: fieldsReadOnly.name, autoFocus: true, maxLength: 100, isModifiedWhen: formData?.name !== formDataOrig?.name, onValueChanged: (e) => { setFormData({ ...formData ?? {}, name: e.target.value }); }, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.Name) }) }) }), _jsx("div", { style: { width: '100%' }, children: _jsx(TMTextArea, { label: SDKUI_Localizator.Description, value: formData?.description ?? '', maxLength: 200, readOnly: fieldsReadOnly.description, isModifiedWhen: formData?.description !== formDataOrig?.description, onValueChanged: (e) => { setFormData({ ...formData ?? {}, description: e.target.value }); }, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.Description), resize: false }) }), _jsx(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: 'flex', flexDirection: 'row', width: '100%', gap: 10 }, children: children }), children: (formMode === FormModes.Create || !areDifferentIDs(formDataOrig?.fromID, SDK_Globals.tmSession?.SessionDescr?.userID)) ?
381
- _jsx("div", { id: "assignedToAnotherUserField", style: { width: isMobile ? '100%' : '50%' }, children: _jsx(TMUserChooser, { dataSource: usersList ?? undefined, allowMultipleSelection: false, label: SDKUI_Localizator.AssignedTo_Female, readOnly: fieldsReadOnly.assignedTO, values: formData?.toID ? [formData?.toID] : [], isModifiedWhen: formData?.toID !== formDataOrig?.toID, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.AssignedTo_Female), onValueChanged: (newValue) => {
381
+ _jsx("div", { id: "assignedToAnotherUserField", style: { width: isMobile ? '100%' : '50%' }, children: _jsx(TMUserChooser, { dataSource: usersList ?? undefined, allowShowAllUsers: !!taskContext?.dossier, allowMultipleSelection: false, label: SDKUI_Localizator.AssignedTo_Female, readOnly: fieldsReadOnly.assignedTO, values: formData?.toID ? [formData?.toID] : [], isModifiedWhen: formData?.toID !== formDataOrig?.toID, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.AssignedTo_Female), onValueChanged: (newValue) => {
382
382
  if (newValue === undefined)
383
383
  return;
384
384
  setFormData({ ...formData ?? {}, toID: newValue[0] });
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- import { BlogPost, HomeBlogPost, TaskDescriptor } from "@topconsultnpm/sdk-ts";
3
- import { DcmtInfo } from "../../ts";
2
+ import { BlogPost, HomeBlogPost, TaskDescriptor, UserDescriptor } from "@topconsultnpm/sdk-ts";
3
+ import { DcmtInfo, FormModes } from "../../ts";
4
4
  import { FileItem } from "../base/TMFileManagerUtils";
5
5
  import { TMBlogsPostHeader, TMBlogContextDescriptor } from "./TMBlogsPostUtils";
6
6
  interface TMBlogsPostProps {
@@ -41,6 +41,10 @@ interface TMBlogsPostProps {
41
41
  }>;
42
42
  /** Context descriptor for the blog component */
43
43
  context?: TMBlogContextDescriptor;
44
+ /** Array of participants */
45
+ participants?: Array<UserDescriptor>;
46
+ /** Callback function to be executed when a task is saved */
47
+ afterTaskSaved?: (task: TaskDescriptor | undefined, formMode: FormModes | undefined, forceRefresh?: boolean) => Promise<void>;
44
48
  /** Optional context menu params */
45
49
  contextMenuParams?: {
46
50
  isShowHideFilterEnabled: boolean;
@@ -74,14 +78,12 @@ interface TMBlogsPostProps {
74
78
  externalBlogPost?: BlogPost;
75
79
  /** Optional function to reset the external blog post */
76
80
  resetExternalBlogPost?: () => void;
77
- /** Optional function to update the selected blog post */
78
- updateSelectedBlogPosts?: (blogPosts: Array<BlogPost>) => void;
79
81
  visible?: boolean;
80
82
  allTasks?: Array<TaskDescriptor>;
81
83
  getAllTasks?: () => Promise<void>;
82
84
  deleteTaskByIdsCallback?: (deletedTaskIds: Array<number>) => Promise<void>;
83
- addTaskCallback?: (task: TaskDescriptor) => Promise<void>;
84
85
  editTaskCallback?: (task: TaskDescriptor) => Promise<void>;
86
+ addTaskCallback?: (task: TaskDescriptor) => Promise<void>;
85
87
  handleNavigateToWGs?: (value: HomeBlogPost | number) => Promise<void>;
86
88
  handleNavigateToDossiers?: (value: HomeBlogPost | number) => Promise<void>;
87
89
  }
@@ -1,11 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React, { useCallback, useEffect, useRef, useState } from "react";
3
- import { DossierEngine, LayoutModes, ResultTypes, SDK_Globals, WorkingGroupEngine } from "@topconsultnpm/sdk-ts";
3
+ import { DossierEngine, LayoutModes, ResultTypes, SDK_Globals, TaskDescriptor, WorkingGroupEngine } from "@topconsultnpm/sdk-ts";
4
4
  import { ContextMenu } from "devextreme-react";
5
- import { SDKUI_Localizator, Globalization, getExceptionMessage, TMConditionalWrapper } from "../../helper";
5
+ import { SDKUI_Localizator, Globalization, getExceptionMessage, TMConditionalWrapper, calcResponsiveSizes } from "../../helper";
6
6
  import TMToppyMessage from "../../helper/TMToppyMessage";
7
7
  import { useDcmtOperations } from "../../hooks/useDcmtOperations";
8
- import { DownloadTypes } from "../../ts";
8
+ import { DownloadTypes, FormModes } from "../../ts";
9
9
  import { TMColors } from "../../utils/theme";
10
10
  import ShowAlert from "../base/TMAlert";
11
11
  import { TMMessageBoxManager, ButtonNames } from "../base/TMPopUp";
@@ -14,12 +14,14 @@ import { TMLayoutWaitingContainer } from "../base/TMWaitPanel";
14
14
  import TMHtmlContentDisplay from "../editors/TMHtmlContentDisplay";
15
15
  import TMDcmtForm from "../features/documents/TMDcmtForm";
16
16
  import { TMResultManager } from "../forms/TMResultDialog";
17
- import { isHeaderFullyHidden, TMBlogsFilterCategoryId, getDcmtTypeDescriptor, findFileItemByDraftID, BlogPostTitle, NewBadge } from "./TMBlogsPostUtils";
17
+ import { isHeaderFullyHidden, TMBlogsFilterCategoryId, getDcmtTypeDescriptor, findFileItemByDraftID, BlogPostTitle, NewBadge, stripHtml } from "./TMBlogsPostUtils";
18
18
  import TMBlogAttachments from "./TMBlogAttachments";
19
19
  import TMBlogHeader from "./TMBlogHeader";
20
+ import TMTaskForm from "../features/tasks/TMTaskForm";
21
+ import { useDeviceType } from "../base/TMDeviceProvider";
20
22
  let localAbortController = new AbortController();
21
23
  const TMBlogsPost = (props) => {
22
- const { scrollToSelected, id, posts, displayMode = "stacked", height = "100%", width = "100%", scrollToBottom = true, header, showExtendedAttachments = true, treeFs, draftLatestInfoMap, archivedDocumentMap, context, contextMenuParams = {
24
+ const { scrollToSelected, id, posts, displayMode = "stacked", height = "100%", width = "100%", scrollToBottom = true, header, showExtendedAttachments = true, treeFs, draftLatestInfoMap, archivedDocumentMap, context, participants, contextMenuParams = {
23
25
  isShowHideFilterEnabled: true,
24
26
  isShowHideIDEnaled: true,
25
27
  isCommentEnabled: false,
@@ -30,8 +32,10 @@ const TMBlogsPost = (props) => {
30
32
  isRestoreEnabled: false,
31
33
  isRefreshEnabled: false,
32
34
  isCreateContextualTask: false,
33
- }, showFloatingCommentButton = false, showCommentFormCallback, showTaskFormCallback, refreshCallback, showId, setShowId, refreshHomePageNews, markBlogAsRead, externalBlogPost, resetExternalBlogPost, updateSelectedBlogPosts, visible = true, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, } = props;
35
+ }, showFloatingCommentButton = false, showCommentFormCallback, refreshCallback, showId, setShowId, refreshHomePageNews, markBlogAsRead, externalBlogPost, resetExternalBlogPost, visible = true, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, afterTaskSaved, handleNavigateToWGs, handleNavigateToDossiers, } = props;
34
36
  const { abortController, showWaitPanel, waitPanelTitle, showPrimary, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, downloadDcmtsAsync } = useDcmtOperations();
37
+ // Get the current device type (e.g., mobile, tablet, desktop) using a custom hook.
38
+ const deviceType = useDeviceType();
35
39
  const bottomRef = useRef(null);
36
40
  const containerRef = useRef(null);
37
41
  // State to manage the layout mode of the document form
@@ -58,6 +62,10 @@ const TMBlogsPost = (props) => {
58
62
  const [focusedItem, setFocusedItem] = useState(undefined);
59
63
  // State to manage the focused file
60
64
  const [focusedAttachment, setFocusedAttachment] = useState(undefined);
65
+ const [taskContext, setTaskContext] = useState(undefined);
66
+ const [currentTask, setCurrentTask] = useState(new TaskDescriptor());
67
+ // State to manage show task form selected file
68
+ const [showTaskForm, setShowTaskForm] = useState(false);
61
69
  // State to manage show selected file
62
70
  const [dcmtForm, setDcmtForm] = useState({ show: false, dcmt: undefined });
63
71
  const [anchorEl, setAnchorEl] = useState(null);
@@ -79,11 +87,26 @@ const TMBlogsPost = (props) => {
79
87
  markBlogAsRead(item[0]);
80
88
  }
81
89
  setSelectedItem(item ? item : []);
82
- updateSelectedBlogPosts?.(item ? item : []);
83
90
  };
84
91
  const handleFocusedAttachment = (attachment) => {
85
92
  setFocusedAttachment(attachment);
86
93
  };
94
+ useEffect(() => {
95
+ if (context === undefined)
96
+ return;
97
+ if (context.engine === 'WorkingGroupEngine' && context.object) {
98
+ setTaskContext({ workingGroup: { id: context?.object?.id ?? 0, name: context?.object?.name ?? '' } });
99
+ return;
100
+ }
101
+ if (context.engine === 'DossierEngine' && context.object) {
102
+ setTaskContext({ dossier: { id: context?.object?.id ?? 0, name: context?.object?.name ?? '' } });
103
+ return;
104
+ }
105
+ if (context.engine === 'SearchEngine' && context.object) {
106
+ setTaskContext({ document: { tid: context?.object?.tid ?? 0, did: context?.object?.did ?? 0, name: '' } });
107
+ return;
108
+ }
109
+ }, [context]);
87
110
  useEffect(() => {
88
111
  if (externalBlogPost && externalBlogPost.id) {
89
112
  const foundPost = blogPosts.find(post => post.id === externalBlogPost.id);
@@ -434,6 +457,27 @@ const TMBlogsPost = (props) => {
434
457
  }
435
458
  });
436
459
  };
460
+ const openTaskFormCallback = useCallback((targetItem) => {
461
+ const task = new TaskDescriptor();
462
+ const cleanText = stripHtml(targetItem?.description ?? '');
463
+ task.name = cleanText.slice(0, 100);
464
+ setCurrentTask(task);
465
+ setShowTaskForm(true);
466
+ }, []);
467
+ const closeTaskFormCallback = useCallback(() => {
468
+ setShowTaskForm(false);
469
+ }, []);
470
+ const onSavedTaskFormCallback = (task) => {
471
+ if (task) {
472
+ addTaskCallback?.(task);
473
+ setShowTaskForm(false);
474
+ afterTaskSaved?.(task, FormModes.Create);
475
+ ShowAlert({ message: SDKUI_Localizator.TaskSavedSuccessfully.replaceParams(task.name ?? '-'), mode: 'success', title: SDKUI_Localizator.Widget_Activities, duration: 3000 });
476
+ }
477
+ else {
478
+ ShowAlert({ message: SDKUI_Localizator.TaskSaveError, mode: 'error', title: SDKUI_Localizator.Widget_Activities, duration: 3000 });
479
+ }
480
+ };
437
481
  // Open document form
438
482
  const openDcmtForm = (dcmtInfo) => {
439
483
  setDcmtForm({ show: true, dcmt: dcmtInfo });
@@ -507,11 +551,11 @@ const TMBlogsPost = (props) => {
507
551
  onClick: () => { copyInClipboard(targetItem); }
508
552
  });
509
553
  }
510
- if (contextMenuParams.isCreateContextualTask && showTaskFormCallback) {
554
+ if (contextMenuParams.isCreateContextualTask) {
511
555
  menuItems.push({
512
556
  text: SDKUI_Localizator.CreateContextualTask,
513
557
  icon: 'plus',
514
- onClick: () => showTaskFormCallback(),
558
+ onClick: () => openTaskFormCallback(targetItem),
515
559
  disabled: isGroupArchived ? true : false,
516
560
  beginGroup: true
517
561
  });
@@ -614,7 +658,7 @@ const TMBlogsPost = (props) => {
614
658
  boxShadow: isFocused ? "0 4px 12px rgba(19, 85, 150, 0.6)" : "none",
615
659
  cursor: 'pointer',
616
660
  }, children: [_jsx(BlogPostTitle, { displayMode: displayMode, layoutMode: layoutMode, blogPost: blogPost, isSelected: isSelected, isOwnComment: isOwnComment, searchText: searchText, isSys: isSys, isHomeBlogPost: isHomeBlogPost, showId: localShowId, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), isNew && _jsx(NewBadge, { layoutMode: layoutMode }), _jsx("div", { style: { fontSize: '1rem', color: "#000", marginTop: "10px", overflow: "hidden" }, children: _jsx(TMHtmlContentDisplay, { markup: blogPost.description ?? '-', searchText: searchText, isSelected: isSelected }) }), showExtendedAttachments && blogPost.attachments && blogPost.attachments.length > 0 && (_jsx(TMBlogAttachments, { contextMenuParams: contextMenuParams, attachments: blogPost.attachments, layoutMode: layoutMode, isSelected: isSelected, searchText: searchText, dcmtTypeDescriptors: dcmtTypeDescriptors, treeFs: treeFs, draftLatestInfoMap: draftLatestInfoMap, archivedDocumentMap: archivedDocumentMap, context: context, handleAttachmentFocus: handleFocusedAttachment, openDcmtForm: openDcmtForm }))] }, `${id}-blogpost-${blogPost.id}`) })] }, "blog-post-wrapper-" + id + "-" + blogPost.id);
617
- }), _jsx("div", { ref: bottomRef }), anchorEl && _jsx("div", { style: { position: 'fixed', zIndex: 9999 }, children: _jsx(ContextMenu, { dataSource: menuItems, target: anchorEl, onHiding: closeContextMenu }) })] }), (dcmtForm.dcmt && dcmtForm.dcmt.TID && dcmtForm.dcmt.DID) && _jsx(TMDcmtForm, { TID: Number(dcmtForm.dcmt.TID), DID: Number(dcmtForm.dcmt.DID), layoutMode: LayoutModes.Update, onClose: closeDcmtForm, isClosable: true, titleModal: SDKUI_Localizator.Attachment + ": " + dcmtForm.dcmt.fileName, isModal: true, widthModal: "95%", heightModal: "95%", allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), (showFloatingCommentButton && showCommentFormCallback && !(context?.engine === 'WorkingGroupEngine' && context?.object?.customData1 === 1)) && _jsx("button", { style: {
661
+ }), _jsx("div", { ref: bottomRef }), anchorEl && _jsx("div", { style: { position: 'fixed', zIndex: 9999 }, children: _jsx(ContextMenu, { dataSource: menuItems, target: anchorEl, onHiding: closeContextMenu }) })] }), (showTaskForm && handleNavigateToWGs && handleNavigateToDossiers && getAllTasks && deleteTaskByIdsCallback && addTaskCallback && editTaskCallback) && _jsx("div", { style: { height: "100%", width: "100%" }, children: _jsx(TMTaskForm, { id: -1, title: SDKUI_Localizator.ContextualTask, isModal: true, width: calcResponsiveSizes(deviceType, '700px', '700px', '95%'), height: calcResponsiveSizes(deviceType, '670px', '80%', '95%'), formMode: FormModes.Create, visualizedTasks: [], currentTask: currentTask, setCurrentTask: () => { }, selectedRowKeys: [], handleFocusedRowKeyChange: () => { }, onStatusChanged: () => { }, onSaved: onSavedTaskFormCallback, onClose: () => closeTaskFormCallback(), onCancel: () => closeTaskFormCallback(), usersList: participants, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, isContextualCreate: true, taskContext: taskContext, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback }) }), (dcmtForm.dcmt && dcmtForm.dcmt.TID && dcmtForm.dcmt.DID) && _jsx(TMDcmtForm, { TID: Number(dcmtForm.dcmt.TID), DID: Number(dcmtForm.dcmt.DID), layoutMode: LayoutModes.Update, onClose: closeDcmtForm, isClosable: true, titleModal: SDKUI_Localizator.Attachment + ": " + dcmtForm.dcmt.fileName, isModal: true, widthModal: "95%", heightModal: "95%", allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), (showFloatingCommentButton && showCommentFormCallback && !(context?.engine === 'WorkingGroupEngine' && context?.object?.customData1 === 1)) && _jsx("button", { style: {
618
662
  position: 'absolute',
619
663
  bottom: '18px',
620
664
  right: '20px',
@@ -110,4 +110,5 @@ interface BlogPostTitleProps {
110
110
  handleNavigateToDossiers?: (blogPost: BlogPost | HomeBlogPost) => void;
111
111
  }
112
112
  export declare const BlogPostTitle: (props: BlogPostTitleProps) => import("react/jsx-runtime").JSX.Element;
113
+ export declare const stripHtml: (html: string) => string;
113
114
  export {};
@@ -248,3 +248,13 @@ export const BlogPostTitle = (props) => {
248
248
  ...getCompactEllipsisStyle(layoutMode)
249
249
  }, children: highlightText(subtitle, searchText, isSelected) }))] })] });
250
250
  };
251
+ export const stripHtml = (html) => {
252
+ try {
253
+ const doc = new DOMParser().parseFromString(html, 'text/html');
254
+ return doc.body.textContent || '';
255
+ }
256
+ catch (error) {
257
+ // Se qualcosa va storto, restituisci l'HTML originale
258
+ return html;
259
+ }
260
+ };
@@ -285,6 +285,7 @@ export declare class SDKUI_Localizator {
285
285
  static get GoToToday(): "Gehe zu heute" | "Go to today" | "Ir a hoy" | "Aller à aujourd'hui" | "Ir para hoje" | "Vai a oggi";
286
286
  static get Grids(): string;
287
287
  static get Hide_CompleteName(): "Vollständigen Namen ausblenden" | "Hide full name" | "Ocultar nombre completo" | "Masquer le nom complet" | "Ocultar nome completo" | "Nascondi nome completo";
288
+ static get HideAll(): "Alle ausblenden" | "Hide all" | "Ocultar todo" | "Masquer tout" | "Ocultar tudo" | "Nascondi tutti";
288
289
  static get HideFloatingBar(): string;
289
290
  static get HideFilters(): string;
290
291
  static get HideLeftPanel(): "Linkes Panel ausblenden" | "Hide left panel" | "Ocultar panel izquierdo" | "Masquer le panneau de gauche" | "Ocultar painel esquerdo" | "Nascondi il pannello sinistro";
@@ -2779,6 +2779,16 @@ export class SDKUI_Localizator {
2779
2779
  default: return "Nascondi nome completo";
2780
2780
  }
2781
2781
  }
2782
+ static get HideAll() {
2783
+ switch (this._cultureID) {
2784
+ case CultureIDs.De_DE: return "Alle ausblenden";
2785
+ case CultureIDs.En_US: return "Hide all";
2786
+ case CultureIDs.Es_ES: return "Ocultar todo";
2787
+ case CultureIDs.Fr_FR: return "Masquer tout";
2788
+ case CultureIDs.Pt_PT: return "Ocultar tudo";
2789
+ default: return "Nascondi tutti";
2790
+ }
2791
+ }
2782
2792
  static get HideFloatingBar() {
2783
2793
  switch (this._cultureID) {
2784
2794
  case CultureIDs.De_DE: return "Floating-Leiste ausblenden";
@@ -134,6 +134,8 @@ declare function IconImport(props: React.SVGProps<SVGSVGElement>): import("react
134
134
  declare function IconPalette(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
135
135
  declare function IconFastSearch(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
136
136
  declare function IconUserGroup(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
137
+ export declare function IconShowAllUsers(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
138
+ export declare function IconShowAllUsersOff(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
137
139
  declare function IconUserGroupOutline(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
138
140
  declare function IconBoard(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
139
141
  declare function IconActivity(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -405,6 +405,15 @@ function IconFastSearch(props) {
405
405
  function IconUserGroup(props) {
406
406
  return (_jsxs("svg", { fontSize: props.fontSize ? props.fontSize : FONTSIZE, viewBox: "0 0 640 512", fill: "currentColor", height: "1em", width: "1em", ...props, children: [" ", _jsx("path", { d: "M352 128c0 70.7-57.3 128-128 128S96 198.7 96 128 153.3 0 224 0s128 57.3 128 128zM0 482.3C0 383.8 79.8 304 178.3 304h91.4c98.5 0 178.3 79.8 178.3 178.3 0 16.4-13.3 29.7-29.7 29.7H29.7C13.3 512 0 498.7 0 482.3zM609.3 512H471.4c5.4-9.4 8.6-20.3 8.6-32v-8c0-60.7-27.1-115.2-69.8-151.8 2.4-.1 4.7-.2 7.1-.2h61.4c89.1 0 161.3 72.2 161.3 161.3 0 17-13.8 30.7-30.7 30.7zM432 256c-31 0-59-12.6-79.3-32.9 19.7-26.6 31.3-59.5 31.3-95.1 0-26.8-6.6-52.1-18.3-74.3C384.3 40.1 407.2 32 432 32c61.9 0 112 50.1 112 112s-50.1 112-112 112z" }), " "] }));
407
407
  }
408
+ export function IconShowAllUsers(props) {
409
+ return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "1em", height: "1em", fontSize: props.fontSize ? props.fontSize : FONTSIZE, ...props, children: _jsx("path", { fill: "currentColor", d: "M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5s-3 1.34-3 3s1.34 3 3 3m-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5S5 6.34 5 8s1.34 3 3 3m0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5m8 0c-.29 0-.62.02-.97.05c1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5" }) }));
410
+ }
411
+ export function IconShowAllUsersOff(props) {
412
+ return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "1em", height: "1em", fontSize: props.fontSize ? props.fontSize : FONTSIZE, ...props, children: _jsx("path", { fill: "currentColor", d: "M15 8c0-1.42-.5-2.73-1.33-3.76c.42-.14.86-.24 1.33-.24c2.21 0 4 1.79 4 4s-1.79 4-4 4h-.18l-.77-.77c.6-.94.95-2.05.95-3.23m7.83 12H23v-3c0-2.18-3.58-3.47-6.34-3.87c1.1.75 1.95 1.71 2.23 2.94zM7.24 4.41a3.996 3.996 0 0 1 5.35 5.35zM9.17 12H9c-2.21 0-4-1.79-4-4v-.17L.69 3.51L2.1 2.1l19.8 19.8l-1.41 1.41L17 19.83V20H1v-3c0-2.66 5.33-4 8-4c.37 0 .8.03 1.25.08z" }) }));
413
+ }
414
+ function IconUserGroupSlash(props) {
415
+ return (_jsxs("svg", { fontSize: props.fontSize ? props.fontSize : FONTSIZE, viewBox: "0 0 640 512", fill: "currentColor", height: "1em", width: "1em", ...props, children: [" ", _jsx("path", { d: "M352 128c0 70.7-57.3 128-128 128S96 198.7 96 128 153.3 0 224 0s128 57.3 128 128zM0 482.3C0 383.8 79.8 304 178.3 304h91.4c98.5 0 178.3 79.8 178.3 178.3 0 16.4-13.3 29.7-29.7 29.7H29.7C13.3 512 0 498.7 0 482.3zM609.3 512H471.4c5.4-9.4 8.6-20.3 8.6-32v-8c0-60.7-27.1-115.2-69.8-151.8 2.4-.1 4.7-.2 7.1-.2h61.4c89.1 0 161.3 72.2 161.3 161.3 0 17-13.8 30.7-30.7 30.7zM432 256c-31 0-59-12.6-79.3-32.9 19.7-26.6 31.3-59.5 31.3-95.1 0-26.8-6.6-52.1-18.3-74.3C384.3 40.1 407.2 32 432 32c61.9 0 112 50.1 112 112s-50.1 112-112 112z" }), " ", _jsx("line", { x1: "0", y1: "512", x2: "640", y2: "0", stroke: "currentColor", strokeWidth: "40" }), " "] }));
416
+ }
408
417
  function IconUserGroupOutline(props) {
409
418
  return (_jsxs("svg", { fontSize: props.fontSize ? props.fontSize : FONTSIZE, viewBox: "0 0 640 512", fill: "white", stroke: "black", strokeWidth: "40", height: "1em", width: "1em", ...props, children: [" ", _jsx("path", { d: "M352 128c0 70.7-57.3 128-128 128S96 198.7 96 128 153.3 0 224 0s128 57.3 128 128zM0 482.3C0 383.8 79.8 304 178.3 304h91.4c98.5 0 178.3 79.8 178.3 178.3 0 16.4-13.3 29.7-29.7 29.7H29.7C13.3 512 0 498.7 0 482.3zM609.3 512H471.4c5.4-9.4 8.6-20.3 8.6-32v-8c0-60.7-27.1-115.2-69.8-151.8 2.4-.1 4.7-.2 7.1-.2h61.4c89.1 0 161.3 72.2 161.3 161.3 0 17-13.8 30.7-30.7 30.7zM432 256c-31 0-59-12.6-79.3-32.9 19.7-26.6 31.3-59.5 31.3-95.1 0-26.8-6.6-52.1-18.3-74.3C384.3 40.1 407.2 32 432 32c61.9 0 112 50.1 112 112s-50.1 112-112 112z" }), " "] }));
410
419
  }
@@ -4,5 +4,5 @@ export declare const hasDetailRelations: (mTID: number | undefined) => Promise<b
4
4
  /** Check if dcmtType (mTID) has configured Master or Many-to-Many relations */
5
5
  export declare const hasMasterRelations: (mTID: number | undefined) => Promise<boolean>;
6
6
  export declare const isXMLFileExt: (fileExt: string | undefined) => boolean;
7
- export declare const processButtonAttributes: (args: string | undefined, formData: MetadataValueDescriptorEx[] | undefined) => Record<string, string> | undefined;
7
+ export declare const processButtonAttributes: (args: string | undefined, formData: MetadataValueDescriptorEx[] | undefined) => string[] | undefined;
8
8
  export declare const processSelectedItems: (selectedItems: Array<any> | undefined) => any[] | undefined;
@@ -36,14 +36,18 @@ export const processSelectedItems = (selectedItems) => selectedItems?.map(item =
36
36
  return acc;
37
37
  }, {});
38
38
  });
39
- const formDataMap = (data, args) => data.reduce((acc, md) => {
40
- const matches = Array.from(args.matchAll(/@\w+/g));
41
- const keys = matches.map(([match]) => match.slice(1));
42
- if (!keys.includes(md.md?.name || ''))
43
- return acc;
44
- //const key = md.md?.name;
45
- const key = md?.mid; // inserisco il mid come chiave
46
- if (key && md.value)
47
- acc[key] = md.value;
48
- return acc;
49
- }, {});
39
+ const formDataMap = (data, args) => {
40
+ const tokens = args.match(/\{@?[^}]+\}/g) || [];
41
+ return tokens.map(token => {
42
+ if (token.startsWith('{@')) {
43
+ // Campo dinamico: {@campo} -> cerca in formData
44
+ const fieldName = token.slice(2, -1); // Rimuove {@...}
45
+ const md = data.find(md => md.md?.name === fieldName);
46
+ return md?.value;
47
+ }
48
+ else {
49
+ // Campo statico: {valore} -> ritorna il valore direttamente
50
+ return token.slice(1, -1); // Rimuove {...}
51
+ }
52
+ }).filter((value) => value !== undefined && value !== null);
53
+ };
package/lib/ts/types.d.ts CHANGED
@@ -112,6 +112,7 @@ export type TaskContext = {
112
112
  dossier?: {
113
113
  id: number;
114
114
  name: string;
115
+ origin?: string;
115
116
  };
116
117
  document?: {
117
118
  tid: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.19.0-dev2.32",
3
+ "version": "6.19.0-dev2.34",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",