@topconsultnpm/sdkui-react-beta 6.9.113 → 6.9.115

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,11 +10,6 @@ interface ITMUserChooserProps extends ITMChooserProps {
10
10
  declare const TMUserChooser: React.FunctionComponent<ITMUserChooserProps>;
11
11
  export default TMUserChooser;
12
12
  export declare const TMUserChooserForm: React.FunctionComponent<ITMChooserFormProps<UserDescriptor>>;
13
- export declare const TMUserIdViewer: ({ userId, showIcon, noneSelectionText }: {
14
- userId?: number;
15
- showIcon?: boolean;
16
- noneSelectionText?: string;
17
- }) => import("react/jsx-runtime").JSX.Element;
18
13
  export declare const TMUserIcon: ({ ud }: {
19
14
  ud?: UserDescriptor;
20
15
  }) => import("react/jsx-runtime").JSX.Element | null;
@@ -9,6 +9,7 @@ import TMTooltip from '../base/TMTooltip';
9
9
  import TMSummary from '../editors/TMSummary';
10
10
  import TMChooserForm from '../forms/TMChooserForm';
11
11
  import { TMColors } from '../../utils/theme';
12
+ import { TMExceptionBoxManager } from '../base/TMPopUp';
12
13
  const TMUserChooser = ({ labelColor, titleForm, readOnly = false, icon, dataSource, backgroundColor, openChooserBySingleClick, buttons = [], disabled = false, showBorder = true, elementStyle, allowMultipleSelection, values, isModifiedWhen, label, placeHolder, validationItems = [], onValueChanged, showClearButton }) => {
13
14
  const [showChooser, setShowChooser] = useState(false);
14
15
  useEffect(() => {
@@ -42,9 +43,10 @@ export const TMUserChooserForm = (props) => {
42
43
  title += `: ${props.title}`;
43
44
  return title;
44
45
  };
45
- return (_jsx(TMChooserForm, { title: getTitle(), allowMultipleSelection: props.allowMultipleSelection, hasShowOnlySelectedItems: true, width: props.width, height: props.height, manageUseLocalizedName: false, columns: renderDataGridColumns, selectedIDs: props.selectedIDs, cellRenderIcon: (data) => { return _jsx(TMUserIcon, { ud: data.data }); }, dataSource: props.dataSource, getItems: getItems, onClose: props.onClose, onChoose: (IDs) => props.onChoose?.(IDs) }));
46
+ const cellRenderIcon = (data) => _jsx(TMUserIcon, { ud: data.data });
47
+ return (_jsx(TMChooserForm, { title: getTitle(), allowMultipleSelection: props.allowMultipleSelection, hasShowOnlySelectedItems: true, width: props.width, height: props.height, manageUseLocalizedName: false, columns: renderDataGridColumns, selectedIDs: props.selectedIDs, cellRenderIcon: cellRenderIcon, dataSource: props.dataSource, getItems: getItems, onClose: props.onClose, onChoose: (IDs) => props.onChoose?.(IDs) }));
46
48
  };
47
- export const TMUserIdViewer = ({ userId, showIcon = false, noneSelectionText = `<${SDKUI_Localizator.NoneSelection}>` }) => {
49
+ const TMUserIdViewer = ({ userId, showIcon = false, noneSelectionText = `<${SDKUI_Localizator.NoneSelection}>` }) => {
48
50
  const [ud, setUd] = useState();
49
51
  useEffect(() => {
50
52
  if (!userId || userId <= 0) {
@@ -52,7 +54,7 @@ export const TMUserIdViewer = ({ userId, showIcon = false, noneSelectionText = `
52
54
  return;
53
55
  }
54
56
  TMSpinner.show({ description: `${SDKUI_Localizator.Loading} - ${SDK_Localizator.Users} ...` });
55
- UserListCacheService.GetAsync(userId).then((ud) => { setUd(ud); TMSpinner.hide(); });
57
+ UserListCacheService.GetAsync(userId).then((ud) => { setUd(ud); TMSpinner.hide(); }).catch((err) => { TMExceptionBoxManager.show({ exception: err }); });
56
58
  }, [userId]);
57
59
  const getIcon = () => {
58
60
  if (!showIcon)
@@ -64,7 +66,14 @@ export const TMUserIdViewer = ({ userId, showIcon = false, noneSelectionText = `
64
66
  :
65
67
  _jsx(TMTooltip, { content: SDKUI_Localizator.ValueNotPresent, children: _jsx(IconWarning, { color: TMColors.warning }) });
66
68
  };
67
- return (_jsxs(StyledDivHorizontal, { children: [getIcon(), _jsx("p", { style: { textAlign: 'left', marginLeft: showIcon ? '5px' : '' }, children: ud ? getCompleteUserName(ud.domain, ud.name) : userId ?? noneSelectionText })] }));
69
+ const getDescription = () => {
70
+ if (!ud)
71
+ return undefined;
72
+ if (!userId)
73
+ return undefined;
74
+ return ud ? getCompleteUserName(ud.domain, ud.name) : userId.toString() ?? noneSelectionText;
75
+ };
76
+ return (_jsxs(StyledDivHorizontal, { children: [getIcon(), _jsx("p", { style: { textAlign: 'left', marginLeft: showIcon ? '5px' : '' }, children: getDescription() })] }));
68
77
  };
69
78
  export const TMUserIcon = ({ ud }) => {
70
79
  if (!ud)
@@ -117,7 +117,7 @@ const TMTextBox = ({ autoFocus, maxLength, labelColor, precision, scale, showCle
117
117
  return Number(curValue);
118
118
  };
119
119
  const renderInputField = () => {
120
- return (_jsxs(_Fragment, { children: [_jsx(StyledEditor, { ref: inputRef, id: `text-${label}-${id}`, name: label, autoFocus: autoFocus, readOnly: readOnly, type: currentType, disabled: disabled, value: currentValue, width: width || '100%', placeholder: placeHolder, maxLength: maxLength, onFocus: () => setIsFocused(true), onBlur: (e) => { setIsFocused(false); if (currentValue != value)
120
+ 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: currentValue, width: width || '100%', placeholder: placeHolder, maxLength: maxLength, onFocus: () => setIsFocused(true), onBlur: (e) => { setIsFocused(false); if (currentValue != value)
121
121
  onBlur?.(currentValue); }, onChange: (e) => {
122
122
  if (currentType === 'number') {
123
123
  let number = Number(e.target.value);
@@ -5,14 +5,15 @@ import { IconWarning, SDKUI_Localizator, TMImageLibrary } from '../../helper';
5
5
  import { StyledDivHorizontal } from '../base/Styled';
6
6
  import TMTooltip from '../base/TMTooltip';
7
7
  import { TMColors } from '../../utils/theme';
8
+ import { TMExceptionBoxManager } from '../base/TMPopUp';
8
9
  const TMDataListItemViewer = ({ dataListId, value, viewMode = DataListViewModes.ImageAndDescription }) => {
9
10
  const [dataListItem, setDataListItem] = useState();
10
11
  useEffect(() => {
11
- if (!dataListId || dataListId <= 0 || !value || value.length <= 0) {
12
+ if (!dataListId || !value) {
12
13
  setDataListItem(undefined);
13
14
  return;
14
15
  }
15
- DataListCacheService.GetAsync(dataListId).then((dl) => { setDataListItem(dl?.items?.find(o => o.value == value)); });
16
+ DataListCacheService.GetAsync(dataListId).then((dl) => { setDataListItem(dl?.items?.find(o => o.value == value)); }).catch((err) => { TMExceptionBoxManager.show({ exception: err }); });
16
17
  }, [dataListId, value]);
17
18
  let showIcon = viewMode != DataListViewModes.Description;
18
19
  const getIcon = () => {
@@ -25,7 +26,14 @@ const TMDataListItemViewer = ({ dataListId, value, viewMode = DataListViewModes.
25
26
  :
26
27
  _jsx(TMTooltip, { content: SDKUI_Localizator.ValueNotPresent, children: _jsx(IconWarning, { color: TMColors.warning }) });
27
28
  };
28
- return (_jsxs(StyledDivHorizontal, { children: [getIcon(), _jsx("p", { style: { textAlign: 'left', marginLeft: showIcon ? '5px' : '' }, children: dataListItem ? dataListItem.name : value })] }));
29
+ const getDescription = () => {
30
+ if (!dataListItem)
31
+ return undefined;
32
+ if (!dataListId)
33
+ return undefined;
34
+ return dataListItem ? dataListItem.name : value;
35
+ };
36
+ return (_jsxs(StyledDivHorizontal, { children: [getIcon(), _jsx("p", { style: { textAlign: 'left', marginLeft: showIcon ? '5px' : '' }, children: getDescription() })] }));
29
37
  };
30
38
  export default TMDataListItemViewer;
31
39
  export const cellRenderDataListItem = (data, dataListId, viewMode) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.9.113",
3
+ "version": "6.9.115",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -28,7 +28,7 @@
28
28
  "lib"
29
29
  ],
30
30
  "dependencies": {
31
- "@topconsultnpm/sdk-ts-beta": "^6.9.16",
31
+ "@topconsultnpm/sdk-ts-beta": "^6.9.17",
32
32
  "buffer": "^6.0.3",
33
33
  "devextreme": "24.2.3",
34
34
  "devextreme-react": "24.2.3",