@topconsultnpm/sdkui-react-beta 6.6.58 → 6.6.60
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.
|
@@ -8,12 +8,12 @@ import TMSpinner from '../base/TMSpinner';
|
|
|
8
8
|
import TMSummary from '../editors/TMSummary';
|
|
9
9
|
import TMChooserForm from '../forms/TMChooserForm';
|
|
10
10
|
import TMDataListItemViewer from '../viewers/TMDataListItemViewer';
|
|
11
|
-
const TMDataListItemChooser = ({
|
|
11
|
+
const TMDataListItemChooser = ({ dataListId, backgroundColor, showBorder = true, buttons = [], elementStyle, allowMultipleSelection, values, isModifiedWhen, label, placeHolder, showClearButton = false, validationItems = [], onValueChanged }) => {
|
|
12
12
|
const [showChooser, setShowChooser] = useState(false);
|
|
13
13
|
const renderTemplate = () => {
|
|
14
14
|
return (_jsxs(StyledDivHorizontal, { style: { minWidth: '125px' }, children: [placeHolder && (!values || values.length <= 0) && _jsx("p", { children: placeHolder }), values && values.length > 0 && _jsx(TMDataListItemViewer, { dataListId: dataListId, value: values?.[0] }), values && values.length > 1 && _jsx("p", { style: { marginLeft: '10px' }, children: `(+${values.length - 1} ${values.length == 2 ? 'altro' : 'altri'})` })] }));
|
|
15
15
|
};
|
|
16
|
-
return (_jsxs(_Fragment, { children: [_jsx(TMSummary, { buttons: buttons, backgroundColor: backgroundColor, showBorder: showBorder, hasValue: values && values.length > 0, showClearButton: showClearButton, iconEditButton: _jsx(IconSearch, { fontSize: 16 }), onEditorClick: () =>
|
|
16
|
+
return (_jsxs(_Fragment, { children: [_jsx(TMSummary, { buttons: buttons, backgroundColor: backgroundColor, showBorder: showBorder, hasValue: values && values.length > 0, showClearButton: showClearButton, iconEditButton: _jsx(IconSearch, { fontSize: 16 }), onEditorClick: () => setShowChooser(true), elementStyle: elementStyle, isModifiedWhen: isModifiedWhen, label: label, template: renderTemplate(), onClearClick: showClearButton ? () => { onValueChanged?.([]); } : undefined, validationItems: validationItems }), showChooser &&
|
|
17
17
|
_jsx(TMDataListItemChooserForm, { allowMultipleSelection: allowMultipleSelection, dataListId: dataListId, selectedIDs: values, onClose: () => setShowChooser(false), onChoose: (IDs) => { onValueChanged?.(IDs); } })] }));
|
|
18
18
|
};
|
|
19
19
|
export default TMDataListItemChooser;
|
|
@@ -49,7 +49,7 @@ const TMDateBox = (props) => {
|
|
|
49
49
|
return "datetime";
|
|
50
50
|
return props.dateDisplayType == DateDisplayTypes.Date ? "date" : "time";
|
|
51
51
|
};
|
|
52
|
-
return (_jsxs(_Fragment, { children: [_jsx(DateBox, {
|
|
52
|
+
return (_jsxs(_Fragment, { children: [_jsx(DateBox, { ref: dateBoxRef,
|
|
53
53
|
// defaultValue={props.defaultValue}
|
|
54
54
|
showClearButton: props.showClearButton, dateSerializationFormat: props.useDateSerializationFormat ? 'yyyy-MM-ddTHH:mm:ss' : undefined, disabled: props.disabled, displayFormat: props.displayFormat ?? Globalization.getDateDisplayFormat(props.dateDisplayType), dropDownOptions: dropDownOptions, label: props.label, labelMode: 'static', type: getType(), useMaskBehavior: true, height: '28px', value: props.value, width: props.width, valueChangeEvent: 'keyup input change', onValueChange: (e) => { props.onValueChange?.(e); }, onKeyUp: (e) => {
|
|
55
55
|
if (e.event?.code == "Space") {
|
|
@@ -9,10 +9,10 @@ interface ITMMetadataEditorProps {
|
|
|
9
9
|
showAsText?: boolean;
|
|
10
10
|
showAsNumber?: boolean;
|
|
11
11
|
containerElement: Element | undefined;
|
|
12
|
-
|
|
12
|
+
disabled?: boolean;
|
|
13
13
|
onValueChanged?: (value: any) => void;
|
|
14
14
|
onValueChange?: (value: any) => void;
|
|
15
15
|
onCascadeRefreshDynDataLists?: (dynDataListsToBeRefreshed: DynDataListsToBeRefreshed[]) => void;
|
|
16
16
|
}
|
|
17
|
-
declare const TMMetadataEditor: ({ tid, mid, value, queryParamsDynDataList, containerElement, allowMultipleSelection, autoFocus, showAsText, showAsNumber,
|
|
17
|
+
declare const TMMetadataEditor: ({ tid, mid, value, queryParamsDynDataList, containerElement, allowMultipleSelection, autoFocus, showAsText, showAsNumber, disabled, onValueChanged, onValueChange, onCascadeRefreshDynDataLists }: ITMMetadataEditorProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
18
|
export default TMMetadataEditor;
|
|
@@ -9,7 +9,7 @@ import TMDynDataListItemChooser from '../choosers/TMDynDataListItemChooser';
|
|
|
9
9
|
import TMUserChooser from '../choosers/TMUserChooser';
|
|
10
10
|
import TMDateBox from './TMDateBox';
|
|
11
11
|
import TMTextBox from './TMTextBox';
|
|
12
|
-
const TMMetadataEditor = ({ tid, mid, value, queryParamsDynDataList, containerElement, allowMultipleSelection, autoFocus, showAsText, showAsNumber,
|
|
12
|
+
const TMMetadataEditor = ({ tid, mid, value, queryParamsDynDataList, containerElement, allowMultipleSelection, autoFocus, showAsText, showAsNumber, disabled = false, onValueChanged, onValueChange, onCascadeRefreshDynDataLists }) => {
|
|
13
13
|
const [md, setMd] = useState();
|
|
14
14
|
useEffect(() => {
|
|
15
15
|
DcmtTypeListCacheService.GetAsync(tid).then((dtd) => {
|
|
@@ -18,36 +18,36 @@ const TMMetadataEditor = ({ tid, mid, value, queryParamsDynDataList, containerEl
|
|
|
18
18
|
}, [mid]);
|
|
19
19
|
let btnDistincValues = { text: 'Valori distinti', icon: _jsx(IconLayerGroup, { fontSize: 16 }), onClick: () => { ShowAlert({ message: "TODO Valori distinti", mode: 'info', title: `${"TODO"}`, duration: 3000 }); } };
|
|
20
20
|
if (value?.startsWith("{@QueryParam") || value == "{@UserName}" || value == "{@UserID}")
|
|
21
|
-
return _jsx(TMTextBox, {
|
|
21
|
+
return _jsx(TMTextBox, { disabled: disabled, elementStyle: { width: '100%' }, type: 'text', maxLength: md?.length, autoFocus: autoFocus, value: value || '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => onValueChanged?.(newValue) });
|
|
22
22
|
if (md?.dataDomain == MetadataDataDomains.DynamicDataList)
|
|
23
|
-
return _jsx(TMDynDataListItemChooser, {
|
|
23
|
+
return _jsx(TMDynDataListItemChooser, { disabled: disabled, md: md, tid: tid, buttons: [btnDistincValues], queryParamsDynDataList: queryParamsDynDataList, onCascadeRefreshDynDataLists: onCascadeRefreshDynDataLists, elementStyle: { width: '100%' }, backgroundColor: TMColors.default_background, allowMultipleSelection: allowMultipleSelection, values: value ? [value] : [], showClearButton: true, onValueChanged: (IDs) => {
|
|
24
24
|
if (!IDs || IDs.length <= 0)
|
|
25
25
|
onValueChanged?.(undefined);
|
|
26
26
|
else
|
|
27
27
|
onValueChanged?.(IDs[0]);
|
|
28
28
|
} });
|
|
29
29
|
if (md?.dataDomain == MetadataDataDomains.DataList)
|
|
30
|
-
return _jsx(TMDataListItemChooser, {
|
|
30
|
+
return _jsx(TMDataListItemChooser, { disabled: disabled, elementStyle: { width: '100%' }, backgroundColor: TMColors.default_background, dataListId: md.dataListID, allowMultipleSelection: allowMultipleSelection, values: value?.split(',').map((item) => !item.startsWith("'") ? item : item.slice(1, -1)) ?? [], showClearButton: true, buttons: [btnDistincValues], onValueChanged: (IDs) => {
|
|
31
31
|
if (!IDs || IDs.length <= 0)
|
|
32
32
|
onValueChanged?.(undefined);
|
|
33
33
|
else
|
|
34
34
|
onValueChanged?.(IDs.join(","));
|
|
35
35
|
} });
|
|
36
36
|
if (md?.dataDomain == MetadataDataDomains.UserID)
|
|
37
|
-
return _jsx(TMUserChooser, { disabled:
|
|
37
|
+
return _jsx(TMUserChooser, { disabled: disabled, elementStyle: { width: '100%' }, backgroundColor: TMColors.default_background, placeHolder: " ", showClearButton: true, allowMultipleSelection: allowMultipleSelection, values: value?.split(',').map((item) => !item.startsWith("'") ? Number(item) : Number(item.slice(1, -1))) ?? [], buttons: [btnDistincValues], onValueChanged: (IDs) => {
|
|
38
38
|
if (!IDs || IDs.length <= 0)
|
|
39
39
|
onValueChanged?.(undefined);
|
|
40
40
|
else
|
|
41
41
|
onValueChanged?.(IDs.join(","));
|
|
42
42
|
} });
|
|
43
43
|
if (showAsText)
|
|
44
|
-
return _jsx(TMTextBox, {
|
|
44
|
+
return _jsx(TMTextBox, { disabled: disabled, elementStyle: { width: '100%' }, type: 'text', buttons: [btnDistincValues], showClearButton: true, maxLength: md?.length, autoFocus: autoFocus, value: value ?? '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => onValueChanged?.(newValue) });
|
|
45
45
|
if (showAsNumber)
|
|
46
|
-
return _jsx(TMTextBox, {
|
|
46
|
+
return _jsx(TMTextBox, { disabled: disabled, elementStyle: { width: '100%' }, type: 'number', showClearButton: true, precision: md?.length, scale: md?.scale, autoFocus: autoFocus, value: value ?? '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => onValueChanged?.(newValue) });
|
|
47
47
|
switch (md?.dataType) {
|
|
48
|
-
case MetadataDataTypes.DateTime: return _jsx(TMDateBox, {
|
|
49
|
-
case MetadataDataTypes.Number: return _jsx(TMTextBox, {
|
|
50
|
-
default: return _jsx(TMTextBox, {
|
|
48
|
+
case MetadataDataTypes.DateTime: return _jsx(TMDateBox, { disabled: disabled, width: '100%', value: value, buttons: [btnDistincValues], showClearButton: true, useDateSerializationFormat: true, containerElement: containerElement, onValueChange: (newValue) => { onValueChange?.(newValue ? newValue.toString() : undefined); onValueChanged?.(newValue ? newValue.toString() : undefined); } });
|
|
49
|
+
case MetadataDataTypes.Number: return _jsx(TMTextBox, { disabled: disabled, elementStyle: { width: '100%' }, type: 'number', buttons: [btnDistincValues], showClearButton: true, precision: md?.length, scale: md?.scale, autoFocus: autoFocus, value: value ?? '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => onValueChanged?.(newValue) });
|
|
50
|
+
default: return _jsx(TMTextBox, { disabled: disabled, type: 'text', elementStyle: { width: '100%' }, showClearButton: true, buttons: [btnDistincValues], autoFocus: autoFocus, maxLength: md?.length, value: value ?? '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => { onValueChanged?.(newValue); } });
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
53
|
export default TMMetadataEditor;
|