@topconsultnpm/sdkui-react-beta 6.14.26 → 6.14.27

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.
@@ -10,13 +10,13 @@ export declare const WorkFlowOperationButtons: ({ isInDcmtForm, deviceType, onAp
10
10
  infoDisable?: boolean;
11
11
  deviceType?: DeviceType;
12
12
  }) => import("react/jsx-runtime").JSX.Element;
13
- export declare const WorkFlowApproveRejectPopUp: ({ TID, DID, deviceType, isReject, onClose, selectedItems, onCompleted }: {
13
+ export declare const WorkFlowApproveRejectPopUp: ({ TID, DID, deviceType, isReject, selectedItems, onClose, onCompleted }: {
14
14
  TID?: number;
15
15
  DID?: number;
16
16
  deviceType?: DeviceType;
17
17
  selectedItems?: any[];
18
- onClose?: () => void;
19
18
  isReject: number;
19
+ onClose?: () => void;
20
20
  onCompleted?: () => Promise<void>;
21
21
  }) => import("react/jsx-runtime").JSX.Element;
22
22
  export declare const WorkFlowReAssignPopUp: ({ DID, TID, deviceType, onClose, selectedItems, onCompleted }: {
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useMemo, useState } from "react";
2
+ import { useState } from "react";
3
3
  import { SDK_Globals } from '@topconsultnpm/sdk-ts-beta';
4
4
  import styled from "styled-components";
5
5
  import { SDKUI_Localizator, IconApply, IconCloseOutline, IconUser, IconInfo } from "../../../helper";
@@ -29,30 +29,9 @@ const StyledTextArea = styled.textarea `
29
29
  }
30
30
  `;
31
31
  export const WorkFlowOperationButtons = ({ isInDcmtForm = false, deviceType = DeviceType.DESKTOP, onApprove, onReAssign, onReject, approveDisable = false, reassignDisable = false, rejectDisable = false, infoDisable = false }) => {
32
- const operations = useMemo(() => {
33
- return ([{
34
- id: '1',
35
- name: SDKUI_Localizator.Operations,
36
- items: [
37
- { id: '1_1', name: SDKUI_Localizator.Approve, icon: '', onClick: onApprove },
38
- { id: '1_2', name: SDKUI_Localizator.Reject, icon: '', onClick: onReject },
39
- { id: '1_3', name: SDKUI_Localizator.Reassign, icon: '', onClick: onReAssign },
40
- { id: '1_4', name: SDKUI_Localizator.MoreInformation, icon: '', onClick: () => alert('TODO') }
41
- ],
42
- }]);
43
- }, []);
44
- return (
45
- // deviceType === DeviceType.DESKTOP ?
46
- _jsxs(StyledWorkFlowOperationButtonsContainer, { "$isInDcmtForm": isInDcmtForm, children: [_jsx(TMButton, { btnStyle: isInDcmtForm ? 'toolbar' : 'advanced', showTooltip: isInDcmtForm, icon: _jsx(IconApply, {}), caption: SDKUI_Localizator.Approve, disabled: approveDisable, onClick: () => !approveDisable && onApprove && onApprove(), advancedColor: TMColors.success, color: 'success' }), _jsx(TMButton, { btnStyle: isInDcmtForm ? 'toolbar' : 'advanced', showTooltip: isInDcmtForm, icon: _jsx(IconCloseOutline, {}), caption: SDKUI_Localizator.Reject, disabled: rejectDisable, onClick: () => !rejectDisable && onReject && onReject(), advancedColor: TMColors.error, color: 'error' }), _jsx(TMButton, { btnStyle: isInDcmtForm ? 'toolbar' : 'advanced', showTooltip: isInDcmtForm, icon: _jsx(IconUser, { fontSize: 16 }), caption: SDKUI_Localizator.Reassign, disabled: reassignDisable, onClick: () => !reassignDisable && onReAssign && onReAssign(), advancedColor: TMColors.tertiary, color: 'tertiary' }), _jsx(TMButton, { btnStyle: isInDcmtForm ? 'toolbar' : 'advanced', showTooltip: isInDcmtForm, icon: _jsx(IconInfo, { fontSize: 16 }), caption: SDKUI_Localizator.MoreInformation, width: '180px', disabled: infoDisable, onClick: () => alert('TODO!!!'), advancedColor: TMColors.info, color: 'info' })] })
47
- // : <Menu
48
- // elementAttr={{ class: 'custom-dx-menu' }}
49
- // disabled={approveDisable && reassignDisable && rejectDisable && infoDisable}
50
- // dataSource={operations}
51
- // displayExpr="name"
52
- // />
53
- );
32
+ return (_jsxs(StyledWorkFlowOperationButtonsContainer, { "$isInDcmtForm": isInDcmtForm, children: [_jsx(TMButton, { btnStyle: isInDcmtForm ? 'toolbar' : 'advanced', showTooltip: isInDcmtForm, icon: _jsx(IconApply, {}), caption: SDKUI_Localizator.Approve, disabled: approveDisable, onClick: () => !approveDisable && onApprove && onApprove(), advancedColor: TMColors.success, color: 'success' }), _jsx(TMButton, { btnStyle: isInDcmtForm ? 'toolbar' : 'advanced', showTooltip: isInDcmtForm, icon: _jsx(IconCloseOutline, {}), caption: SDKUI_Localizator.Reject, disabled: rejectDisable, onClick: () => !rejectDisable && onReject && onReject(), advancedColor: TMColors.error, color: 'error' }), _jsx(TMButton, { btnStyle: isInDcmtForm ? 'toolbar' : 'advanced', showTooltip: isInDcmtForm, icon: _jsx(IconUser, { fontSize: 16 }), caption: SDKUI_Localizator.Reassign, disabled: reassignDisable, onClick: () => !reassignDisable && onReAssign && onReAssign(), advancedColor: TMColors.tertiary, color: 'tertiary' }), _jsx(TMButton, { btnStyle: isInDcmtForm ? 'toolbar' : 'advanced', showTooltip: isInDcmtForm, icon: _jsx(IconInfo, { fontSize: 16 }), caption: SDKUI_Localizator.MoreInformation, width: '180px', disabled: infoDisable, onClick: () => alert('TODO!!!'), advancedColor: TMColors.info, color: 'info' })] }));
54
33
  };
55
- export const WorkFlowApproveRejectPopUp = ({ TID = 0, DID = 0, deviceType = DeviceType.DESKTOP, isReject, onClose, selectedItems = [], onCompleted }) => {
34
+ export const WorkFlowApproveRejectPopUp = ({ TID = 0, DID = 0, deviceType = DeviceType.DESKTOP, isReject, selectedItems = [], onClose, onCompleted }) => {
56
35
  const [commentValue, setCommentValue] = useState('');
57
36
  const disable = commentValue.length === 0;
58
37
  const count = () => { return selectedItems.length.toString() + ' Workitem'; };
@@ -88,6 +67,7 @@ export const WorkFlowApproveRejectPopUp = ({ TID = 0, DID = 0, deviceType = Devi
88
67
  export const WorkFlowReAssignPopUp = ({ DID = 0, TID = 0, deviceType = DeviceType.DESKTOP, onClose, selectedItems = [], onCompleted }) => {
89
68
  const [commentValue, setCommentValue] = useState('');
90
69
  const [selectedUserID, setSelectedUserID] = useState();
70
+ const [participants, setParticipants] = useState([]);
91
71
  const disable = commentValue.length === 0 || !selectedUserID;
92
72
  const count = () => { return selectedItems.length.toString() + ' Workitem'; };
93
73
  const reAssignWorkFlowAsync = async () => {
@@ -112,5 +92,9 @@ export const WorkFlowReAssignPopUp = ({ DID = 0, TID = 0, deviceType = DeviceTyp
112
92
  TMSpinner.hide();
113
93
  }
114
94
  };
95
+ // useEffect(() => {
96
+ // SDK_Globals.tmSession?.NewWorkflowEngine().RetrieveAllAsync().then((o) => console.log('WFs', o));
97
+ // SDK_Globals.tmSession?.NewWorkflowEngine().RetrieveAsync(11283).then((o) => console.log('WF', o));
98
+ // }, [])
115
99
  return (_jsx(TMModal, { toolbar: _jsx(TMButton, { btnStyle: 'advanced', showTooltip: false, icon: _jsx(IconUser, { fontSize: 16 }), caption: 'Riassegna', disabled: disable, onClick: () => !disable && reAssignWorkFlowAsync(), advancedColor: TMColors.tertiary }), onClose: onClose, width: deviceType === DeviceType.MOBILE ? '95%' : '60%', height: '60%', isModal: true, title: 'Riassegna workflow ' + (selectedItems.length > 0 ? '(' + count() + ')' : ''), children: _jsxs("div", { style: { width: '100%', height: '100%', padding: '10px', display: 'flex', flexDirection: 'column', gap: 5 }, children: [_jsx(TMUserChooser, { value: selectedUserID, onValueChanged: (e) => setSelectedUserID(e) }), _jsxs("p", { style: { color: commentValue.length === 0 ? TMColors.error : 'black' }, children: ["Commento ", commentValue.length === 0 && _jsx("span", { children: ' (Campo obbligatorio)' }), " "] }), _jsx(StyledTextArea, { "$isValid": commentValue.length !== 0, value: commentValue, onChange: (e) => setCommentValue(e.target.value) })] }) }));
116
100
  };
@@ -1,9 +1,10 @@
1
1
  import { DataListViewModes } from '@topconsultnpm/sdk-ts-beta';
2
2
  import { DataGridTypes } from 'devextreme-react/cjs/data-grid';
3
- declare const TMDataListItemViewer: ({ dataListId, value, viewMode }: {
3
+ interface ITMDataListItemViewerProps {
4
4
  dataListId?: number;
5
- value?: string;
5
+ value?: string | Date | number;
6
6
  viewMode?: DataListViewModes;
7
- }) => import("react/jsx-runtime").JSX.Element;
7
+ }
8
+ declare const TMDataListItemViewer: ({ dataListId, value, viewMode }: ITMDataListItemViewerProps) => import("react/jsx-runtime").JSX.Element;
8
9
  export default TMDataListItemViewer;
9
10
  export declare const cellRenderDataListItem: (data: DataGridTypes.ColumnCellTemplateData, dataListId?: number, viewMode?: DataListViewModes) => import("react/jsx-runtime").JSX.Element;
@@ -10,28 +10,59 @@ import { FormulaHelper } from '../editors/TMFormulaEditor';
10
10
  const TMDataListItemViewer = ({ dataListId, value, viewMode = DataListViewModes.ImageAndDescription }) => {
11
11
  const [dataListItem, setDataListItem] = useState();
12
12
  useEffect(() => {
13
- if (!dataListId || !value) {
13
+ if (!dataListId || value === undefined || value === null) {
14
14
  setDataListItem(undefined);
15
15
  return;
16
16
  }
17
- DataListCacheService.GetAsync(dataListId).then((dl) => { setDataListItem(dl?.items?.find(o => o.value == value)); }).catch((err) => { TMExceptionBoxManager.show({ exception: err }); });
17
+ let stringValue;
18
+ if (value instanceof Date) {
19
+ stringValue = value.toISOString();
20
+ }
21
+ else if (typeof value === 'number') {
22
+ stringValue = value.toString();
23
+ }
24
+ else {
25
+ stringValue = value;
26
+ }
27
+ DataListCacheService.GetAsync(dataListId).then((dl) => { setDataListItem(dl?.items?.find(o => o.value == stringValue)); }).catch((err) => { TMExceptionBoxManager.show({ exception: err }); });
18
28
  }, [dataListId, value]);
19
29
  let showIcon = viewMode != DataListViewModes.Description;
20
30
  const getIcon = () => {
21
31
  if (!showIcon)
22
32
  return null;
23
- if (!value)
33
+ if (value === undefined || value === null)
24
34
  return null;
25
- if (FormulaHelper.isFormula(value))
35
+ let stringValue;
36
+ if (value instanceof Date) {
37
+ stringValue = value.toISOString();
38
+ }
39
+ else if (typeof value === 'number') {
40
+ stringValue = value.toString();
41
+ }
42
+ else {
43
+ stringValue = value;
44
+ }
45
+ console.log('getIcon', stringValue);
46
+ if (FormulaHelper.isFormula(stringValue))
26
47
  return null;
27
48
  return dataListItem ? _jsx(TMImageLibrary, { imageID: dataListItem.imageID }) : _jsx(IconWarning, { color: TMColors.warning });
28
49
  };
29
50
  const getDescription = () => {
30
51
  if (!dataListId)
31
52
  return undefined;
32
- if (!value)
53
+ if (value === undefined || value === null)
33
54
  return undefined;
34
- return dataListItem ? dataListItem.name : value.toString();
55
+ let displayValue;
56
+ if (value instanceof Date) {
57
+ displayValue = value.toLocaleDateString();
58
+ }
59
+ else if (typeof value === 'number') {
60
+ displayValue = value.toString();
61
+ }
62
+ else {
63
+ displayValue = value;
64
+ }
65
+ return dataListItem ? dataListItem.name : displayValue;
35
66
  };
36
67
  return (_jsx(TMTooltip, { content: dataListItem ? dataListItem.value : SDKUI_Localizator.ValueNotPresent, children: _jsxs(StyledDivHorizontal, { children: [getIcon(), _jsx("p", { style: { textAlign: 'left', marginLeft: showIcon ? '5px' : '', opacity: dataListItem ? 1 : 0.5 }, children: getDescription() })] }) }));
37
68
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.14.26",
3
+ "version": "6.14.27",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",