@topconsultnpm/sdkui-react-beta 6.12.116 → 6.12.117
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.
@@ -2,16 +2,18 @@ import React from 'react';
|
|
2
2
|
import { UserDescriptor } from '@topconsultnpm/sdk-ts-beta';
|
3
3
|
import { ITMChooserFormProps, ITMChooserProps } from '../../ts';
|
4
4
|
interface ITMUserChooserProps extends ITMChooserProps {
|
5
|
-
/**
|
5
|
+
/** Contains the selected values */
|
6
6
|
values?: number[];
|
7
|
-
/**
|
7
|
+
/** Predicate function to filter users */
|
8
8
|
filter?: (value: UserDescriptor, index: number, array: UserDescriptor[]) => unknown;
|
9
|
-
/**
|
9
|
+
/** Displays the border */
|
10
10
|
showBorder?: boolean;
|
11
|
-
/**
|
11
|
+
/** Hide refresh data button */
|
12
12
|
hideRefresh?: boolean;
|
13
|
-
/**
|
13
|
+
/** Hide show ID button */
|
14
14
|
hideShowId?: boolean;
|
15
|
+
/** Initial value for showChooser */
|
16
|
+
initialShowChooser?: boolean;
|
15
17
|
}
|
16
18
|
declare const TMUserChooser: React.FunctionComponent<ITMUserChooserProps>;
|
17
19
|
export default TMUserChooser;
|
@@ -9,8 +9,11 @@ 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, dataSource, backgroundColor, openChooserBySingleClick, buttons = [], disabled = false, showBorder = true, hideRefresh = false, hideShowId = false, elementStyle, allowMultipleSelection, values, isModifiedWhen, label, placeHolder, validationItems = [], onValueChanged, showClearButton }) => {
|
13
|
-
const [showChooser, setShowChooser] = useState(
|
12
|
+
const TMUserChooser = ({ labelColor, titleForm, filter, readOnly = false, icon, dataSource, backgroundColor, openChooserBySingleClick, buttons = [], disabled = false, showBorder = true, hideRefresh = false, hideShowId = false, elementStyle, allowMultipleSelection, values, isModifiedWhen, label, placeHolder, validationItems = [], onValueChanged, showClearButton, initialShowChooser = false }) => {
|
13
|
+
const [showChooser, setShowChooser] = useState(initialShowChooser);
|
14
|
+
useEffect(() => {
|
15
|
+
setShowChooser(initialShowChooser);
|
16
|
+
}, [initialShowChooser]);
|
14
17
|
const renderTemplate = () => {
|
15
18
|
return (_jsxs(StyledDivHorizontal, { style: { minWidth: '125px' }, 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'})` })] }));
|
16
19
|
};
|