@topconsultnpm/sdkui-react 6.21.0-dev3.7 → 6.21.0-dev3.9

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.
@@ -84,10 +84,15 @@ const TMDynDataListItemChooser = ({ tid, md, width = '100%', titleForm, openChoo
84
84
  _jsx(TMTooltip, { content: SDKUI_Localizator.ValueNotPresent, children: _jsx(IconWarning, { color: TMColors.warning }) });
85
85
  };
86
86
  const renderTemplate = () => {
87
+ const isPlaceholder = values?.[0] === placeHolder;
88
+ // Selezione singola: mostra direttamente il primo valore
89
+ if (!allowMultipleSelection) {
90
+ const singleDescription = getValueDescription(values?.[0]);
91
+ return (_jsx(StyledDivHorizontal, { style: { width: '100%', color: isPlaceholder ? '#a9a9a9' : 'inherit', alignItems: 'center' }, children: dataSource && singleDescription && _jsxs(StyledDivHorizontal, { style: { alignItems: 'center', gap: '8px' }, children: [getIcon(), _jsx("p", { children: singleDescription })] }) }));
92
+ }
87
93
  const MIN_COUNT_FOR_BADGE = 1;
88
94
  const MAX_VISIBLE_ITEMS = 3;
89
95
  const MAX_TOOLTIP_ITEMS = 50;
90
- const isPlaceholder = values?.[0] === placeHolder;
91
96
  const descriptions = getDescriptions(MAX_VISIBLE_ITEMS);
92
97
  const remainingCount = (values?.length ?? 0) - MAX_VISIBLE_ITEMS;
93
98
  const totalCount = values?.length ?? 0;
@@ -79,12 +79,16 @@ const TMMetadataEditor = ({ isSelected = false, customLabel, isReadOnly, isLexPr
79
79
  if (value?.startsWith("{@QueryParam") || value == "{@UserName}" || value == "{@UserID}" || queryOperator == QueryOperators.Custom || isEditable)
80
80
  return _jsx(TMTextBox, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', isModifiedWhen: isModifiedWhenInternal(), readOnly: isReadOnlyResult, label: (modulesWithLabelTop || showLabelTop) ? (customLabel ?? md?.nameLoc) : undefined, icon: showLabelTop ? icon : undefined, validationItems: validationItems, disabled: disabled, elementStyle: { width: '100%' }, type: 'text', maxLength: isEditable ? undefined : maxLength, autoFocus: autoFocus, value: value ?? '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => onValueChanged?.(newValue) });
81
81
  if (md?.dataDomain == MetadataDataDomains.DynamicDataList)
82
- return _jsx(TMDynDataListItemChooser, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', titleForm: md.nameLoc, readOnly: isReadOnlyResult, layoutMode: layoutMode, isModifiedWhen: isModifiedWhenInternal(), label: (modulesWithLabelTop || showLabelTop) ? (customLabel ?? md?.nameLoc) : undefined, icon: showLabelTop ? icon : undefined, validationItems: validationItems, disabled: disabled, md: md, tid: tid, openChooserBySingleClick: openChooserBySingleClick, queryParamsDynDataList: queryParamsDynDataList, onCascadeRefreshDynDataLists: onCascadeRefreshDynDataLists, onCascadeUpdateMIDs: onCascadeUpdateMIDs, elementStyle: { width: '100%' }, backgroundColor: TMColors.default_background, allowMultipleSelection: multipleSelectionIsenabled, values: value ? value.split(',').filter(v => v.trim() !== '') : [], showClearButton: !isReadOnlyResult, onValueChanged: (IDs) => {
82
+ return _jsx(TMDynDataListItemChooser, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', titleForm: md.nameLoc, readOnly: isReadOnlyResult, layoutMode: layoutMode, isModifiedWhen: isModifiedWhenInternal(), label: (modulesWithLabelTop || showLabelTop) ? (customLabel ?? md?.nameLoc) : undefined, icon: showLabelTop ? icon : undefined, validationItems: validationItems, disabled: disabled, md: md, tid: tid, openChooserBySingleClick: openChooserBySingleClick, queryParamsDynDataList: queryParamsDynDataList, onCascadeRefreshDynDataLists: onCascadeRefreshDynDataLists, onCascadeUpdateMIDs: onCascadeUpdateMIDs, elementStyle: { width: '100%' }, backgroundColor: TMColors.default_background, allowMultipleSelection: multipleSelectionIsenabled, values: multipleSelectionIsenabled ? (value ? value.split(',') : []) : (value ? [value] : []), showClearButton: !isReadOnlyResult, onValueChanged: (IDs) => {
83
83
  const filteredIDs = IDs?.filter(id => id.trim() !== '');
84
84
  if (!filteredIDs || filteredIDs.length <= 0)
85
85
  onValueChanged?.(undefined);
86
- else
86
+ else if (multipleSelectionIsenabled) {
87
87
  onValueChanged?.(filteredIDs.join(","));
88
+ }
89
+ else {
90
+ onValueChanged?.(filteredIDs[0]);
91
+ }
88
92
  }, updateIsModalOpen: updateIsModalOpen });
89
93
  if (md?.dataDomain == MetadataDataDomains.DataList)
90
94
  return _jsx(TMDataListItemChooser, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', titleForm: md.nameLoc, readOnly: isReadOnlyResult, isModifiedWhen: isModifiedWhenInternal(), label: (modulesWithLabelTop || showLabelTop) ? (customLabel ?? md?.nameLoc) : undefined, icon: showLabelTop ? icon : undefined, validationItems: validationItems, disabled: disabled, elementStyle: { width: '100%' }, backgroundColor: TMColors.default_background, dataListId: md.dataListID, openChooserBySingleClick: openChooserBySingleClick, allowMultipleSelection: multipleSelectionIsenabled, values: value?.split(',').map((item) => !item.startsWith("'") ? item : item.slice(1, -1)) ?? [], showClearButton: !isReadOnlyResult, onValueChanged: (IDs) => {
@@ -148,17 +148,23 @@ const TMSearchWhereItemEditor = React.memo(({ whereItem, queryParamsDynDataList,
148
148
  let dtd = await DcmtTypeListCacheService.GetAsync(whereItem.tid, true);
149
149
  return dtd?.metadata?.find(o => o.id === whereItem.mid);
150
150
  };
151
- // Rimuove gli apici singoli da valori separati da virgola: 'msegato','plevolella' -> msegato,plevolella
151
+ // Rimuove gli apici singoli da valori separati da virgola: 'val1','val2' -> val1,val2
152
+ // Applica trim solo ai valori quotati, preservando gli spazi nei valori non quotati
152
153
  const stripQuotes = (value) => {
153
154
  if (!value || typeof value !== 'string')
154
155
  return value;
155
- return value.split(',').map(item => {
156
- const trimmed = item.trim();
157
- if (trimmed.startsWith("'") && trimmed.endsWith("'")) {
158
- return trimmed.slice(1, -1);
159
- }
160
- return trimmed;
161
- }).join(',');
156
+ try {
157
+ return value.split(',').map(item => {
158
+ const trimmed = item.trim();
159
+ if (trimmed.startsWith("'") && trimmed.endsWith("'")) {
160
+ return trimmed.slice(1, -1); // trim + rimuovi apici
161
+ }
162
+ return item; // mantieni originale (con spazi)
163
+ }).join(',');
164
+ }
165
+ catch {
166
+ return value; // in caso di errore, ritorna il valore iniziale
167
+ }
162
168
  };
163
169
  const normalizeValue = (value, isForValue1 = true) => {
164
170
  let newValues = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.21.0-dev3.7",
3
+ "version": "6.21.0-dev3.9",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -40,7 +40,7 @@
40
40
  "lib"
41
41
  ],
42
42
  "dependencies": {
43
- "@topconsultnpm/sdk-ts": "6.21.0-t2",
43
+ "@topconsultnpm/sdk-ts": "6.21.0-dev3.2",
44
44
  "@zip.js/zip.js": "2.8.26",
45
45
  "buffer": "^6.0.3",
46
46
  "devextreme": "^25.2.6",