@topconsultnpm/sdkui-react-beta 6.6.92 → 6.6.93

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.
@@ -9,6 +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
+ import { TMMetadataIcon } from '../viewers/TMMidViewer';
12
13
  const TMMetadataEditor = ({ tid, mid, value, queryParamsDynDataList, containerElement, allowMultipleSelection, autoFocus, showAsText, showAsNumber, validationItems = [], disabled = false, onValueChanged, onValueChange, onCascadeRefreshDynDataLists }) => {
13
14
  const [md, setMd] = useState();
14
15
  useEffect(() => {
@@ -18,36 +19,36 @@ const TMMetadataEditor = ({ tid, mid, value, queryParamsDynDataList, containerEl
18
19
  }, [mid]);
19
20
  let btnDistincValues = { text: 'Valori distinti', icon: _jsx(IconLayerGroup, { fontSize: 16 }), onClick: () => { ShowAlert({ message: "TODO Valori distinti", mode: 'info', title: `${"TODO"}`, duration: 3000 }); } };
20
21
  if (value?.startsWith("{@QueryParam") || value == "{@UserName}" || value == "{@UserID}")
21
- return _jsx(TMTextBox, { 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) });
22
+ return _jsx(TMTextBox, { label: md?.nameLoc, icon: _jsx(TMMetadataIcon, { md: md, tid: tid }), 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) });
22
23
  if (md?.dataDomain == MetadataDataDomains.DynamicDataList)
23
- return _jsx(TMDynDataListItemChooser, { validationItems: validationItems, 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
+ return _jsx(TMDynDataListItemChooser, { label: md?.nameLoc, icon: _jsx(TMMetadataIcon, { md: md, tid: tid }), validationItems: validationItems, 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
25
  if (!IDs || IDs.length <= 0)
25
26
  onValueChanged?.(undefined);
26
27
  else
27
28
  onValueChanged?.(IDs[0]);
28
29
  } });
29
30
  if (md?.dataDomain == MetadataDataDomains.DataList)
30
- return _jsx(TMDataListItemChooser, { 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: true, buttons: [btnDistincValues], onValueChanged: (IDs) => {
31
+ return _jsx(TMDataListItemChooser, { label: md?.nameLoc, icon: _jsx(TMMetadataIcon, { md: md, tid: tid }), 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: true, buttons: [btnDistincValues], onValueChanged: (IDs) => {
31
32
  if (!IDs || IDs.length <= 0)
32
33
  onValueChanged?.(undefined);
33
34
  else
34
35
  onValueChanged?.(IDs.join(","));
35
36
  } });
36
37
  if (md?.dataDomain == MetadataDataDomains.UserID)
37
- return _jsx(TMUserChooser, { validationItems: validationItems, 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
+ return _jsx(TMUserChooser, { label: md?.nameLoc, icon: _jsx(TMMetadataIcon, { md: md, tid: tid }), validationItems: validationItems, 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
39
  if (!IDs || IDs.length <= 0)
39
40
  onValueChanged?.(undefined);
40
41
  else
41
42
  onValueChanged?.(IDs.join(","));
42
43
  } });
43
44
  if (showAsText)
44
- return _jsx(TMTextBox, { validationItems: validationItems, 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
+ return _jsx(TMTextBox, { label: md?.nameLoc, icon: _jsx(TMMetadataIcon, { md: md, tid: tid }), validationItems: validationItems, 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
46
  if (showAsNumber)
46
- return _jsx(TMTextBox, { validationItems: validationItems, 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
+ return _jsx(TMTextBox, { label: md?.nameLoc, icon: _jsx(TMMetadataIcon, { md: md, tid: tid }), validationItems: validationItems, 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
48
  switch (md?.dataType) {
48
- case MetadataDataTypes.DateTime: return _jsx(TMDateBox, { validationItems: validationItems, 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, { validationItems: validationItems, 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, validationItems: validationItems, 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); } });
49
+ case MetadataDataTypes.DateTime: return _jsx(TMDateBox, { icon: _jsx(TMMetadataIcon, { md: md, tid: tid }), label: md?.nameLoc, validationItems: validationItems, 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); } });
50
+ case MetadataDataTypes.Number: return _jsx(TMTextBox, { label: md?.nameLoc, icon: _jsx(TMMetadataIcon, { md: md, tid: tid }), validationItems: validationItems, 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) });
51
+ default: return _jsx(TMTextBox, { label: md?.nameLoc, icon: _jsx(TMMetadataIcon, { md: md, tid: tid }), disabled: disabled, validationItems: validationItems, 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
52
  }
52
53
  };
53
54
  export default TMMetadataEditor;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.6.92",
3
+ "version": "6.6.93",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",