@topconsultnpm/sdkui-react 6.21.0-dev3.3 → 6.21.0-dev3.4

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.
@@ -58,24 +58,8 @@ const TMDynDataListItemChooser = ({ tid, md, width = '100%', titleForm, openChoo
58
58
  return "";
59
59
  if (!dynDl)
60
60
  return value;
61
- const searchValue = value.toLowerCase();
62
- const matchingRow = dataSource?.dtdResult?.rows?.find(o => {
63
- const rowValue = o[dynDl.selectItemForValue ?? 0]?.toString();
64
- if (!rowValue)
65
- return false;
66
- if (rowValue.toLowerCase() === searchValue)
67
- return true;
68
- const rowFirstPart = rowValue.split(', ')?.[0]?.toLowerCase();
69
- return rowFirstPart === searchValue;
70
- });
71
- if (!matchingRow)
72
- return value;
73
- const descValue = matchingRow[dynDl.selectItemForDescription ?? 0]?.toString();
74
- // Se value e description sono nella stessa colonna, estrai solo la parte descrizione
75
- if ((dynDl.selectItemForDescription ?? 0) === (dynDl.selectItemForValue ?? 0) && descValue?.includes(', ')) {
76
- return descValue.split(', ').slice(1).join(', '); // "01, Gennaio" → "Gennaio"
77
- }
78
- return descValue ?? value;
61
+ let description = dataSource?.dtdResult?.rows?.filter(o => o[dynDl.selectItemForValue ?? 0] == value)?.[0]?.[dynDl.selectItemForDescription ?? 0];
62
+ return description ?? value;
79
63
  };
80
64
  const getDescriptions = (maxItems = 3) => {
81
65
  if (!Array.isArray(values))
@@ -95,19 +79,7 @@ const TMDynDataListItemChooser = ({ tid, md, width = '100%', titleForm, openChoo
95
79
  return null;
96
80
  if (!dynDl)
97
81
  return null;
98
- const searchValue = values?.[0]?.toString().toLowerCase();
99
- const matchingRow = dataSource?.dtdResult?.rows?.find(o => {
100
- const rowValue = o[dynDl.selectItemForValue ?? 0]?.toString();
101
- if (!rowValue)
102
- return false;
103
- // Prima prova match esatto
104
- if (rowValue.toLowerCase() === searchValue)
105
- return true;
106
- // Poi prova match sulla prima parte (se il valore è nel formato "codice, descrizione")
107
- const rowFirstPart = rowValue.split(', ')?.[0]?.toLowerCase();
108
- return rowFirstPart === searchValue;
109
- });
110
- const description = matchingRow?.[dynDl.selectItemForDescription ?? 0];
82
+ let description = dataSource?.dtdResult?.rows?.filter(o => o[dynDl.selectItemForValue ?? 0]?.toString().toLowerCase() === values?.[0]?.toString().toLowerCase())?.[0]?.[dynDl.selectItemForDescription ?? 0];
111
83
  return description ? null :
112
84
  _jsx(TMTooltip, { content: SDKUI_Localizator.ValueNotPresent, children: _jsx(IconWarning, { color: TMColors.warning }) });
113
85
  };
@@ -160,10 +160,10 @@ export const useRelatedDocuments = ({ selectedSearchResult, focusedItem, current
160
160
  setCanArchiveDetailRelation(false);
161
161
  return;
162
162
  }
163
- const detailRelations = relations.filter(r => r.detailTID === tid);
163
+ const detailRelations = relations.filter(r => r.detailTID === tid && r.relationType !== RelationTypes.ManyToMany);
164
164
  const hasMasterWithAssociations = detailRelations.some(rel => rel.associations && rel.associations.length > 0);
165
165
  setCanArchiveMasterRelation(hasMasterWithAssociations);
166
- const masterRelations = relations.filter(r => r.masterTID === tid);
166
+ const masterRelations = relations.filter(r => r.masterTID === tid && r.relationType !== RelationTypes.ManyToMany);
167
167
  const hasDetailWithAssociations = masterRelations.some(rel => rel.associations && rel.associations.length > 0);
168
168
  setCanArchiveDetailRelation(hasDetailWithAssociations);
169
169
  }
@@ -196,8 +196,8 @@ export const useRelatedDocuments = ({ selectedSearchResult, focusedItem, current
196
196
  }, [selectedSearchResult?.fromTID]);
197
197
  const filterRelationsByType = (relations, tid, type) => {
198
198
  return type === 'detail'
199
- ? relations.filter(r => r.masterTID == tid)
200
- : relations.filter(r => r.detailTID == tid);
199
+ ? relations.filter(r => r.masterTID == tid && r.relationType !== RelationTypes.ManyToMany)
200
+ : relations.filter(r => r.detailTID == tid && r.relationType !== RelationTypes.ManyToMany);
201
201
  };
202
202
  const filterRelationsWithAssociations = (relations) => {
203
203
  return relations.filter(rel => rel.associations && rel.associations.length > 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.21.0-dev3.3",
3
+ "version": "6.21.0-dev3.4",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",