@topconsultnpm/sdkui-react-beta 6.8.22 → 6.8.24

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.
@@ -70,10 +70,21 @@ const TMTextArea = (props) => {
70
70
  const textareaWidth = inputRef.current.offsetWidth;
71
71
  const charWidth = 8;
72
72
  const maxCharsPerLine = Math.floor(textareaWidth / charWidth);
73
- const lines = content.split('\n').reduce((acc, line) => {
74
- return acc + Math.ceil(line.length / maxCharsPerLine);
75
- }, 0);
76
- return Math.min(lines, 10);
73
+ // Split content into lines by line breaks (`\n`)
74
+ const lines = content.split('\n');
75
+ // Calculate total rows by considering lines and their character lengths
76
+ let totalRows = 0;
77
+ lines.forEach(line => {
78
+ // Every line, regardless of length, contributes at least one row
79
+ totalRows += Math.ceil(line.length / maxCharsPerLine);
80
+ });
81
+ // If the last line is empty, it should still count as a row
82
+ // This handles cases where you press "Enter" at the end (i.e., the last line is empty)
83
+ if (content.endsWith('\n')) {
84
+ totalRows += 1;
85
+ }
86
+ // Return the number of rows, limiting to a maximum of 10
87
+ return Math.min(totalRows, 10);
77
88
  };
78
89
  // Inserts text at the cursor position
79
90
  const insertText = (textToInsert) => {
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  interface TMTreeDropDownProps {
3
3
  dataSource: Array<{
4
4
  id: number;
@@ -6,6 +6,7 @@ interface TMTreeDropDownProps {
6
6
  value: string;
7
7
  categoryId?: number;
8
8
  expanded?: boolean;
9
+ tooltipContent?: ReactNode;
9
10
  }>;
10
11
  values: Array<number>;
11
12
  setValues: React.Dispatch<React.SetStateAction<Array<number>>>;
@@ -54,6 +54,10 @@ const TMTreeDropDown = (props) => {
54
54
  return value.toString();
55
55
  return SDKUI_Localizator.Filters + " (" + value.length + ")";
56
56
  }, []);
57
- return _jsx(TMTooltip, { content: getLabelsByIds(values, 'formatted'), children: _jsx(DropDownBox, { width: "100%", style: elementStyle, valueExpr: "id", displayExpr: "label", displayValueFormatter: displayValueFormatter, value: values, dataSource: dataSource, placeholder: SDKUI_Localizator.SelectDesiredFilters, onContentReady: syncTreeViewSelection, focusStateEnabled: true, contentRender: () => _jsx(TreeView, { ref: treeViewRef, keyExpr: "id", dataSource: dataSource, selectByClick: true, selectNodesRecursive: true, selectionMode: "multiple", displayExpr: "label", parentIdExpr: "categoryId", dataStructure: "plain", showCheckBoxesMode: "normal", onContentReady: syncTreeViewSelection, onItemSelectionChanged: (e) => treeViewItemSelectionChanged(e) }) }) });
57
+ const renderTreeViewItem = (item) => {
58
+ // Customize how tree view items are rendered with a tooltip
59
+ return (item.tooltipContent ? _jsx(TMTooltip, { content: item.tooltipContent, children: item.label }) : item.label);
60
+ };
61
+ return _jsx(TMTooltip, { content: getLabelsByIds(values, 'formatted'), children: _jsx(DropDownBox, { width: "100%", style: elementStyle, valueExpr: "id", displayExpr: "label", displayValueFormatter: displayValueFormatter, value: values, dataSource: dataSource, placeholder: SDKUI_Localizator.SelectDesiredFilters, onContentReady: syncTreeViewSelection, focusStateEnabled: true, contentRender: () => _jsx(TreeView, { ref: treeViewRef, keyExpr: "id", dataSource: dataSource, selectByClick: true, selectNodesRecursive: true, selectionMode: "multiple", displayExpr: "label", parentIdExpr: "categoryId", dataStructure: "plain", showCheckBoxesMode: "normal", onContentReady: syncTreeViewSelection, onItemSelectionChanged: (e) => treeViewItemSelectionChanged(e), itemRender: renderTreeViewItem }) }) });
58
62
  };
59
63
  export default TMTreeDropDown;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.8.22",
3
+ "version": "6.8.24",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",