@topconsultnpm/sdkui-react 6.21.0-dev1.39 → 6.21.0-dev1.40

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.
@@ -13,10 +13,14 @@ const TMDataListItemChooser = ({ labelColor, width = '100%', dataListId, icon, b
13
13
  const [showChooser, setShowChooser] = useState(false);
14
14
  const renderTemplate = () => {
15
15
  const MAX_VISIBLE_ITEMS = 3;
16
+ const MAX_TOOLTIP_ITEMS = 50;
16
17
  const isPlaceholder = values?.[0] === placeHolder;
17
18
  const remainingCount = (values?.length ?? 0) - MAX_VISIBLE_ITEMS;
18
19
  const totalCount = values?.length ?? 0;
19
- return (_jsxs(StyledDivHorizontal, { style: { width: '100%', justifyContent: 'flex-start', color: isPlaceholder ? '#a9a9a9' : 'inherit', alignItems: 'center' }, children: [values && values.length > 0 && _jsxs(StyledDivHorizontal, { style: { alignItems: 'center', gap: '8px' }, children: [totalCount > MAX_VISIBLE_ITEMS && _jsx(TMTooltip, { content: values.join(', '), children: _jsx(StyledDivHorizontal, { style: { alignItems: 'center', gap: '4px' }, children: _jsx("span", { style: {
20
+ const allValuesTooltip = values && values.length > MAX_TOOLTIP_ITEMS
21
+ ? values.slice(0, MAX_TOOLTIP_ITEMS).join(', ') + ` ... (+${values.length - MAX_TOOLTIP_ITEMS})`
22
+ : values?.join(', ') ?? '';
23
+ return (_jsxs(StyledDivHorizontal, { style: { width: '100%', justifyContent: 'flex-start', color: isPlaceholder ? '#a9a9a9' : 'inherit', alignItems: 'center' }, children: [values && values.length > 0 && _jsxs(StyledDivHorizontal, { style: { alignItems: 'center', gap: '8px' }, children: [totalCount > MAX_VISIBLE_ITEMS && _jsx(TMTooltip, { content: _jsx("div", { style: { maxWidth: '300px', wordWrap: 'break-word', whiteSpace: 'pre-wrap' }, children: allValuesTooltip }), children: _jsx(StyledDivHorizontal, { style: { alignItems: 'center', gap: '4px' }, children: _jsx("span", { style: {
20
24
  backgroundColor: TMColors.primary + '15',
21
25
  color: TMColors.primary,
22
26
  borderRadius: '4px',
@@ -25,7 +29,12 @@ const TMDataListItemChooser = ({ labelColor, width = '100%', dataListId, icon, b
25
29
  fontWeight: 600,
26
30
  letterSpacing: '0.3px'
27
31
  }, children: totalCount }) }) }), values.slice(0, MAX_VISIBLE_ITEMS).map((v, index) => (_jsx(React.Fragment, { children: _jsxs("span", { style: { display: 'inline-flex', alignItems: 'center' }, children: [_jsx(TMDataListItemViewer, { dataListId: dataListId, value: v, width: 'auto', showTooltip: false }), index < Math.min(values.length, MAX_VISIBLE_ITEMS) - 1 && _jsx("span", { style: { marginLeft: 0 }, children: "," })] }) }, index)))] }), values && values.length > MAX_VISIBLE_ITEMS &&
28
- _jsx(TMTooltip, { content: values.slice(MAX_VISIBLE_ITEMS).join(', '), children: _jsx("p", { style: { marginLeft: '10px' }, children: `(+${remainingCount} ${remainingCount === 1 ? 'altro' : 'altri'})` }) })] }));
32
+ _jsx(TMTooltip, { content: _jsx("div", { style: { maxWidth: '300px', wordWrap: 'break-word', whiteSpace: 'pre-wrap' }, children: (() => {
33
+ const remainingValues = values.slice(MAX_VISIBLE_ITEMS);
34
+ return remainingValues.length > MAX_TOOLTIP_ITEMS
35
+ ? remainingValues.slice(0, MAX_TOOLTIP_ITEMS).join(', ') + ` ... (+${remainingValues.length - MAX_TOOLTIP_ITEMS})`
36
+ : remainingValues.join(', ');
37
+ })() }), children: _jsx("p", { style: { marginLeft: '10px' }, children: `(+${remainingCount} ${remainingCount === 1 ? 'altro' : 'altri'})` }) })] }));
29
38
  };
30
39
  const summaryInputRef = useRef(null);
31
40
  return (_jsxs(_Fragment, { children: [_jsx(TMSummary, { ref: summaryInputRef, placeHolder: placeHolder, labelColor: labelColor, width: width, icon: icon, buttons: buttons, readOnly: readOnly, backgroundColor: backgroundColor, showBorder: showBorder, hasValue: values && values.length > 0, showClearButton: showClearButton, iconEditButton: _jsx(IconSearch, { fontSize: 16 }), onEditorClick: () => {
@@ -85,12 +85,16 @@ const TMDynDataListItemChooser = ({ tid, md, width = '100%', titleForm, openChoo
85
85
  };
86
86
  const renderTemplate = () => {
87
87
  const MAX_VISIBLE_ITEMS = 3;
88
+ const MAX_TOOLTIP_ITEMS = 50;
88
89
  const isPlaceholder = values?.[0] === placeHolder;
89
90
  const descriptions = getDescriptions(MAX_VISIBLE_ITEMS);
90
91
  const remainingCount = (values?.length ?? 0) - MAX_VISIBLE_ITEMS;
91
92
  const totalCount = values?.length ?? 0;
92
- const allDescriptions = values?.map(v => getValueDescription(v)).filter(d => d !== "").join(', ') ?? '';
93
- return (_jsxs(StyledDivHorizontal, { style: { width: '100%', color: isPlaceholder ? '#a9a9a9' : 'inherit', alignItems: 'center' }, children: [dataSource && descriptions.length > 0 && _jsxs(StyledDivHorizontal, { style: { alignItems: 'center', gap: '8px' }, children: [totalCount > MAX_VISIBLE_ITEMS && _jsx(TMTooltip, { content: allDescriptions, children: _jsx(StyledDivHorizontal, { style: { alignItems: 'center', gap: '4px' }, children: _jsx("span", { style: {
93
+ const allDescriptionsArray = values?.map(v => getValueDescription(v)).filter(d => d !== "") ?? [];
94
+ const allDescriptions = allDescriptionsArray.length > MAX_TOOLTIP_ITEMS
95
+ ? allDescriptionsArray.slice(0, MAX_TOOLTIP_ITEMS).join(', ') + ` ... (+${allDescriptionsArray.length - MAX_TOOLTIP_ITEMS})`
96
+ : allDescriptionsArray.join(', ');
97
+ return (_jsxs(StyledDivHorizontal, { style: { width: '100%', color: isPlaceholder ? '#a9a9a9' : 'inherit', alignItems: 'center' }, children: [dataSource && descriptions.length > 0 && _jsxs(StyledDivHorizontal, { style: { alignItems: 'center', gap: '8px' }, children: [totalCount > MAX_VISIBLE_ITEMS && _jsx(TMTooltip, { content: _jsx("div", { style: { maxWidth: '300px', wordWrap: 'break-word', whiteSpace: 'pre-wrap' }, children: allDescriptions }), children: _jsx(StyledDivHorizontal, { style: { alignItems: 'center', gap: '4px' }, children: _jsx("span", { style: {
94
98
  backgroundColor: TMColors.primary + '15',
95
99
  color: TMColors.primary,
96
100
  borderRadius: '4px',
@@ -99,7 +103,12 @@ const TMDynDataListItemChooser = ({ tid, md, width = '100%', titleForm, openChoo
99
103
  fontWeight: 600,
100
104
  letterSpacing: '0.3px'
101
105
  }, children: totalCount }) }) }), getIcon(), _jsx("p", { children: descriptions.join(', ') })] }), values && values.length > MAX_VISIBLE_ITEMS &&
102
- _jsx(TMTooltip, { content: values.slice(MAX_VISIBLE_ITEMS).join(', '), children: _jsx("p", { style: { marginLeft: '10px' }, children: `(+${remainingCount} ${remainingCount === 1 ? 'altro' : 'altri'})` }) })] }));
106
+ _jsx(TMTooltip, { content: _jsx("div", { style: { maxWidth: '300px', wordWrap: 'break-word', whiteSpace: 'pre-wrap' }, children: (() => {
107
+ const remainingArray = values.slice(MAX_VISIBLE_ITEMS).map(v => getValueDescription(v));
108
+ return remainingArray.length > MAX_TOOLTIP_ITEMS
109
+ ? remainingArray.slice(0, MAX_TOOLTIP_ITEMS).join(', ') + ` ... (+${remainingArray.length - MAX_TOOLTIP_ITEMS})`
110
+ : remainingArray.join(', ');
111
+ })() }), children: _jsx("p", { style: { marginLeft: '10px' }, children: `(+${remainingCount} ${remainingCount === 1 ? 'altro' : 'altri'})` }) })] }));
103
112
  };
104
113
  return (_jsxs(_Fragment, { children: [_jsx(TMSummary, { placeHolder: placeHolder, width: width, icon: icon, labelColor: labelColor, backgroundColor: backgroundColor, buttons: buttons, showBorder: showBorder, readOnly: readOnly, hasValue: values && values.length > 0, showClearButton: showClearButton, iconEditButton: _jsx(IconSearch, { fontSize: 16 }), onEditorClick: () => {
105
114
  if (!readOnly) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.21.0-dev1.39",
3
+ "version": "6.21.0-dev1.40",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",