@topconsultnpm/sdkui-react-beta 6.7.93 → 6.7.95
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.
|
@@ -18,44 +18,45 @@ const TMMetadataEditor = ({ isModifiedWhen = false, hasLabel = false, readOnly,
|
|
|
18
18
|
setMd(dtd?.metadata?.find(o => o.id == mid));
|
|
19
19
|
});
|
|
20
20
|
}, [mid]);
|
|
21
|
+
const isReadOnly = readOnly || (md && md.isLexProt === 1) || (md && md.isLexProt === 3);
|
|
21
22
|
const showByTextarea = md && md.length && md?.dataType === MetadataDataTypes.Varchar && md.length > 80;
|
|
22
23
|
let btnDistincValues = { text: 'Valori distinti', icon: _jsx(IconLayerGroup, { fontSize: 16 }), onClick: () => { ShowAlert({ message: "TODO Valori distinti", mode: 'info', title: `${"TODO"}`, duration: 3000 }); } };
|
|
23
24
|
if (value?.startsWith("{@QueryParam") || value == "{@UserName}" || value == "{@UserID}")
|
|
24
|
-
return _jsx(TMTextBox, { isModifiedWhen: isModifiedWhen, readOnly:
|
|
25
|
+
return _jsx(TMTextBox, { isModifiedWhen: isModifiedWhen, readOnly: isReadOnly, label: hasLabel ? md?.nameLoc : undefined, icon: hasLabel ? _jsx(TMMetadataIcon, { md: md, tid: tid }) : undefined, validationItems: validationItems, disabled: disabled, elementStyle: { width: '100%' }, type: 'text', maxLength: md?.length, autoFocus: autoFocus, value: value || '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => onValueChanged?.(newValue) });
|
|
25
26
|
if (md?.dataDomain == MetadataDataDomains.DynamicDataList)
|
|
26
|
-
return _jsx(TMDynDataListItemChooser, { isModifiedWhen: isModifiedWhen, label: hasLabel ? md?.nameLoc : undefined, icon: hasLabel ? _jsx(TMMetadataIcon, { md: md, tid: tid }) : undefined, validationItems: validationItems, disabled: disabled, md: md, tid: tid, buttons: !
|
|
27
|
+
return _jsx(TMDynDataListItemChooser, { readOnly: isReadOnly, isModifiedWhen: isModifiedWhen, label: hasLabel ? md?.nameLoc : undefined, icon: hasLabel ? _jsx(TMMetadataIcon, { md: md, tid: tid }) : undefined, validationItems: validationItems, disabled: disabled, md: md, tid: tid, buttons: !isReadOnly ? [btnDistincValues] : undefined, queryParamsDynDataList: queryParamsDynDataList, onCascadeRefreshDynDataLists: onCascadeRefreshDynDataLists, elementStyle: { width: '100%' }, backgroundColor: TMColors.default_background, allowMultipleSelection: allowMultipleSelection, values: value ? [value] : [], showClearButton: !isReadOnly, onValueChanged: (IDs) => {
|
|
27
28
|
if (!IDs || IDs.length <= 0)
|
|
28
29
|
onValueChanged?.(undefined);
|
|
29
30
|
else
|
|
30
31
|
onValueChanged?.(IDs[0]);
|
|
31
32
|
} });
|
|
32
33
|
if (md?.dataDomain == MetadataDataDomains.DataList)
|
|
33
|
-
return _jsx(TMDataListItemChooser, { isModifiedWhen: isModifiedWhen, label: hasLabel ? md?.nameLoc : undefined, icon: hasLabel ? _jsx(TMMetadataIcon, { md: md, tid: tid }) : undefined, validationItems: validationItems, 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: !
|
|
34
|
+
return _jsx(TMDataListItemChooser, { isModifiedWhen: isModifiedWhen, label: hasLabel ? md?.nameLoc : undefined, icon: hasLabel ? _jsx(TMMetadataIcon, { md: md, tid: tid }) : undefined, validationItems: validationItems, 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: !isReadOnly, buttons: !isReadOnly ? [btnDistincValues] : undefined, onValueChanged: (IDs) => {
|
|
34
35
|
if (!IDs || IDs.length <= 0)
|
|
35
36
|
onValueChanged?.(undefined);
|
|
36
37
|
else
|
|
37
38
|
onValueChanged?.(IDs.join(","));
|
|
38
39
|
} });
|
|
39
40
|
if (md?.dataDomain == MetadataDataDomains.UserID)
|
|
40
|
-
return _jsx(TMUserChooser, { isModifiedWhen: isModifiedWhen, label: hasLabel ? md?.nameLoc : undefined, icon: hasLabel ? _jsx(TMMetadataIcon, { md: md, tid: tid }) : undefined, validationItems: validationItems, disabled: disabled, elementStyle: { width: '100%' }, backgroundColor: TMColors.default_background, placeHolder: " ", showClearButton: !
|
|
41
|
+
return _jsx(TMUserChooser, { isModifiedWhen: isModifiedWhen, label: hasLabel ? md?.nameLoc : undefined, icon: hasLabel ? _jsx(TMMetadataIcon, { md: md, tid: tid }) : undefined, validationItems: validationItems, disabled: disabled, elementStyle: { width: '100%' }, backgroundColor: TMColors.default_background, placeHolder: " ", showClearButton: !isReadOnly, allowMultipleSelection: allowMultipleSelection, values: value?.split(',').map((item) => !item.startsWith("'") ? Number(item) : Number(item.slice(1, -1))) ?? [], buttons: !isReadOnly ? [btnDistincValues] : undefined, onValueChanged: (IDs) => {
|
|
41
42
|
if (!IDs || IDs.length <= 0)
|
|
42
43
|
onValueChanged?.(undefined);
|
|
43
44
|
else
|
|
44
45
|
onValueChanged?.(IDs.join(","));
|
|
45
46
|
} });
|
|
46
47
|
if (showAsText)
|
|
47
|
-
return _jsx(TMTextBox, { isModifiedWhen: isModifiedWhen, readOnly:
|
|
48
|
+
return _jsx(TMTextBox, { isModifiedWhen: isModifiedWhen, readOnly: isReadOnly, label: hasLabel ? md?.nameLoc : undefined, icon: hasLabel ? _jsx(TMMetadataIcon, { md: md, tid: tid }) : undefined, validationItems: validationItems, disabled: disabled, elementStyle: { width: '100%' }, type: 'text', buttons: !isReadOnly ? [btnDistincValues] : undefined, showClearButton: !isReadOnly, maxLength: md?.length, autoFocus: autoFocus, value: value ?? '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => onValueChanged?.(newValue) });
|
|
48
49
|
if (showAsNumber)
|
|
49
|
-
return _jsx(TMTextBox, { isModifiedWhen: isModifiedWhen, readOnly:
|
|
50
|
+
return _jsx(TMTextBox, { isModifiedWhen: isModifiedWhen, readOnly: isReadOnly, label: hasLabel ? md?.nameLoc : undefined, icon: hasLabel ? _jsx(TMMetadataIcon, { md: md, tid: tid }) : undefined, validationItems: validationItems, disabled: disabled, elementStyle: { width: '100%' }, type: 'number', showClearButton: !isReadOnly, precision: md?.length, scale: md?.scale, autoFocus: autoFocus, value: value ?? '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => onValueChanged?.(newValue) });
|
|
50
51
|
switch (md?.dataType) {
|
|
51
|
-
case MetadataDataTypes.DateTime: return _jsx(TMDateBox, { isModifiedWhen: isModifiedWhen, readOnly:
|
|
52
|
-
case MetadataDataTypes.Number: return _jsx(TMTextBox, { isModifiedWhen: isModifiedWhen, readOnly:
|
|
52
|
+
case MetadataDataTypes.DateTime: return _jsx(TMDateBox, { isModifiedWhen: isModifiedWhen, readOnly: isReadOnly, icon: hasLabel ? _jsx(TMMetadataIcon, { md: md, tid: tid }) : undefined, label: hasLabel ? md?.nameLoc : undefined, validationItems: validationItems, disabled: disabled, width: '100%', value: value, buttons: !isReadOnly ? [btnDistincValues] : undefined, showClearButton: !isReadOnly, useDateSerializationFormat: true, containerElement: containerElement, onValueChange: (newValue) => { onValueChange?.(newValue ? newValue.toString() : undefined); onValueChanged?.(newValue ? newValue.toString() : undefined); } });
|
|
53
|
+
case MetadataDataTypes.Number: return _jsx(TMTextBox, { isModifiedWhen: isModifiedWhen, readOnly: isReadOnly, label: hasLabel ? md?.nameLoc : undefined, icon: hasLabel ? _jsx(TMMetadataIcon, { md: md, tid: tid }) : undefined, validationItems: validationItems, disabled: disabled, elementStyle: { width: '100%' }, type: 'number', buttons: !isReadOnly ? [btnDistincValues] : undefined, showClearButton: !isReadOnly, precision: md?.length, scale: md?.scale, autoFocus: autoFocus, value: value ?? '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => onValueChanged?.(newValue) });
|
|
53
54
|
default:
|
|
54
55
|
if (showByTextarea) {
|
|
55
|
-
return _jsx(TMTextArea, { rows: 1, readOnly:
|
|
56
|
+
return _jsx(TMTextArea, { rows: 1, readOnly: isReadOnly, label: hasLabel ? md?.nameLoc : undefined, icon: hasLabel ? _jsx(TMMetadataIcon, { md: md, tid: tid }) : undefined, isModifiedWhen: isModifiedWhen, validationItems: validationItems, disabled: disabled, elementStyle: { width: '100%' }, showClearButton: !isReadOnly, buttons: !isReadOnly ? [btnDistincValues] : undefined, autoFocus: autoFocus, maxLength: md?.length, value: value ?? '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => { onValueChanged?.(newValue); } });
|
|
56
57
|
}
|
|
57
58
|
else {
|
|
58
|
-
return _jsx(TMTextBox, { isModifiedWhen: isModifiedWhen, readOnly:
|
|
59
|
+
return _jsx(TMTextBox, { isModifiedWhen: isModifiedWhen, readOnly: isReadOnly, label: hasLabel ? md?.nameLoc : undefined, icon: hasLabel ? _jsx(TMMetadataIcon, { md: md, tid: tid }) : undefined, disabled: disabled, validationItems: validationItems, type: 'text', elementStyle: { width: '100%' }, showClearButton: !isReadOnly, buttons: !isReadOnly ? [btnDistincValues] : undefined, autoFocus: autoFocus, maxLength: md?.length, value: value ?? '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => { onValueChanged?.(newValue); } });
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
62
|
};
|